From 93c28c7970e9273b102e9efd8589806f1e849603 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 5 Feb 2016 20:39:42 -0500 Subject: TITANIC: Initial engine skeleton --- engines/titanic/configure.engine | 3 + engines/titanic/detection.cpp | 129 +++++++++++++++++++++++++++++++++++++ engines/titanic/detection_tables.h | 41 ++++++++++++ engines/titanic/module.mk | 13 ++++ engines/titanic/titanic.cpp | 58 +++++++++++++++++ engines/titanic/titanic.h | 86 +++++++++++++++++++++++++ 6 files changed, 330 insertions(+) create mode 100644 engines/titanic/configure.engine create mode 100644 engines/titanic/detection.cpp create mode 100644 engines/titanic/detection_tables.h create mode 100644 engines/titanic/module.mk create mode 100644 engines/titanic/titanic.cpp create mode 100644 engines/titanic/titanic.h diff --git a/engines/titanic/configure.engine b/engines/titanic/configure.engine new file mode 100644 index 0000000000..781b783cf5 --- /dev/null +++ b/engines/titanic/configure.engine @@ -0,0 +1,3 @@ +# This file is included from the main "configure" script +# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] +add_engine titanic "Starship Titanic" no diff --git a/engines/titanic/detection.cpp b/engines/titanic/detection.cpp new file mode 100644 index 0000000000..70fe25d532 --- /dev/null +++ b/engines/titanic/detection.cpp @@ -0,0 +1,129 @@ +/* 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 "titanic/titanic.h" + +#include "base/plugins.h" +#include "common/savefile.h" +#include "common/str-array.h" +#include "common/memstream.h" +#include "engines/advancedDetector.h" +#include "common/system.h" +#include "graphics/colormasks.h" +#include "graphics/surface.h" + +#define MAX_SAVES 99 + +namespace Titanic { + +struct TitanicGameDescription { + ADGameDescription desc; +}; + +uint32 TitanicEngine::getFeatures() const { + return _gameDescription->desc.flags; +} + +bool TitanicEngine::isDemo() const { + return (bool)(_gameDescription->desc.flags & ADGF_DEMO); +} + +Common::Language TitanicEngine::getLanguage() const { + return _gameDescription->desc.language; +} + +} // End of namespace Titanic + +static const PlainGameDescriptor TitanicGames[] = { + {"titanic", "Starship Titanic"}, + {0, 0} +}; + +#include "titanic/detection_tables.h" + +class TitanicMetaEngine : public AdvancedMetaEngine { +public: + TitanicMetaEngine() : AdvancedMetaEngine(Titanic::gameDescriptions, sizeof(Titanic::TitanicGameDescription), TitanicGames) { + _maxScanDepth = 3; + } + + virtual const char *getName() const { + return "Titanic Engine"; + } + + virtual const char *getOriginalCopyright() const { + return "Titanic Engine (c)"; + } + + virtual bool hasFeature(MetaEngineFeature f) const; + virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; + virtual SaveStateList listSaves(const char *target) const; + virtual int getMaximumSaveSlot() const; + virtual void removeSaveState(const char *target, int slot) const; + SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; +}; + +bool TitanicMetaEngine::hasFeature(MetaEngineFeature f) const { + return + (f == kSupportsListSaves) || + (f == kSupportsLoadingDuringStartup) || + (f == kSupportsDeleteSave) || + (f == kSavesSupportMetaInfo) || + (f == kSavesSupportThumbnail); +} + +bool Titanic::TitanicEngine::hasFeature(EngineFeature f) const { + return + (f == kSupportsRTL) || + (f == kSupportsLoadingDuringRuntime) || + (f == kSupportsSavingDuringRuntime); +} + +bool TitanicMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { + const Titanic::TitanicGameDescription *gd = (const Titanic::TitanicGameDescription *)desc; + *engine = new Titanic::TitanicEngine(syst, gd); + + return gd != 0; +} + +SaveStateList TitanicMetaEngine::listSaves(const char *target) const { + SaveStateList saveList; + return saveList; +} + +int TitanicMetaEngine::getMaximumSaveSlot() const { + return MAX_SAVES; +} + +void TitanicMetaEngine::removeSaveState(const char *target, int slot) const { +} + +SaveStateDescriptor TitanicMetaEngine::querySaveMetaInfos(const char *target, int slot) const { + return SaveStateDescriptor(); +} + + +#if PLUGIN_ENABLED_DYNAMIC(TITANIC) + REGISTER_PLUGIN_DYNAMIC(TITANIC, PLUGIN_TYPE_ENGINE, TitanicMetaEngine); +#else + REGISTER_PLUGIN_STATIC(TITANIC, PLUGIN_TYPE_ENGINE, TitanicMetaEngine); +#endif diff --git a/engines/titanic/detection_tables.h b/engines/titanic/detection_tables.h new file mode 100644 index 0000000000..dab7bd5462 --- /dev/null +++ b/engines/titanic/detection_tables.h @@ -0,0 +1,41 @@ +/* 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. + * + */ + +namespace Titanic { + +static const TitanicGameDescription gameDescriptions[] = { + { + { + "titanic", + 0, + AD_ENTRY1s("a.st", "b283436d90974fdc81accc95dbd8e61c", 15405985), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_NO_FLAGS, + GUIO1(GUIO_NONE) + }, + }, + + { AD_TABLE_END_MARKER } +}; + +} // End of namespace Titanic diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk new file mode 100644 index 0000000000..bb359414ab --- /dev/null +++ b/engines/titanic/module.mk @@ -0,0 +1,13 @@ +MODULE := engines/titanic + +MODULE_OBJS := \ + detection.o \ + titanic.o + +# This module can be built as a plugin +ifeq ($(ENABLE_TITANIC), DYNAMIC_PLUGIN) +PLUGIN := 1 +endif + +# Include common rules +include $(srcdir)/rules.mk diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp new file mode 100644 index 0000000000..88e9fbca5b --- /dev/null +++ b/engines/titanic/titanic.cpp @@ -0,0 +1,58 @@ +/* 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 "titanic/titanic.h" + +namespace Titanic { + +TitanicEngine::TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc) + : _gameDescription(gameDesc), Engine(syst) { +} + +TitanicEngine::~TitanicEngine() { +} + +void TitanicEngine::initialize() { + // Set up debug channels + DebugMan.addDebugChannel(kDebugCore, "core", "Core engine debug level"); + DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts"); + DebugMan.addDebugChannel(kDebugGraphics, "graphics", "Graphics handling"); + DebugMan.addDebugChannel(kDebugSound, "sound", "Sound and Music handling"); + + initGraphics(320, 200, false); + +} + +Common::Error TitanicEngine::run() { + initialize(); + + return Common::kNoError; +} + +} // End of namespace Titanic diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h new file mode 100644 index 0000000000..a49bb2d70c --- /dev/null +++ b/engines/titanic/titanic.h @@ -0,0 +1,86 @@ +/* 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. + * + */ + +#ifndef TITANIC_TITANIC_H +#define TITANIC_TITANIC_H + +#include "common/scummsys.h" +#include "common/system.h" +#include "common/serializer.h" +#include "engines/advancedDetector.h" +#include "engines/engine.h" + +/** + * This is the namespace of the Titanic engine. + * + * Status of this engine: In Development + * + * Games using this engine: + * - Starship Titanic + */ +namespace Titanic { + +enum TitanicDebugChannels { + kDebugCore = 1 << 0, + kDebugScripts = 1 << 1, + kDebugGraphics = 1 << 2, + kDebugSound = 1 << 3 +}; + +#define TITANIC_SAVEGAME_VERSION 1 + +struct TitanicGameDescription; + +struct TitanicSavegameHeader { + uint8 _version; + Common::String _saveName; + Graphics::Surface *_thumbnail; + int _year, _month, _day; + int _hour, _minute; + int _totalFrames; +}; + +class TitanicEngine : public Engine { +private: + /** + * Handles basic initialization + */ + void initialize(); +protected: + const TitanicGameDescription *_gameDescription; + int _loadSaveSlot; + + // Engine APIs + virtual Common::Error run(); + virtual bool hasFeature(EngineFeature f) const; +public: + TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc); + virtual ~TitanicEngine(); + + uint32 getFeatures() const; + bool isDemo() const; + Common::Language getLanguage() const; +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TITANIC_H */ -- cgit v1.2.3 From 021c47b0c13bf7a9e467d28cbf127974ebfd9e9d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 5 Feb 2016 21:48:01 -0500 Subject: TITANIC: Skeleton screen manager class --- engines/titanic/font.cpp | 30 +++++++++++ engines/titanic/font.h | 38 ++++++++++++++ engines/titanic/module.mk | 2 + engines/titanic/screen_manager.cpp | 74 ++++++++++++++++++++++++++ engines/titanic/screen_manager.h | 105 +++++++++++++++++++++++++++++++++++++ engines/titanic/titanic.cpp | 3 -- 6 files changed, 249 insertions(+), 3 deletions(-) create mode 100644 engines/titanic/font.cpp create mode 100644 engines/titanic/font.h create mode 100644 engines/titanic/screen_manager.cpp create mode 100644 engines/titanic/screen_manager.h diff --git a/engines/titanic/font.cpp b/engines/titanic/font.cpp new file mode 100644 index 0000000000..18f15cae92 --- /dev/null +++ b/engines/titanic/font.cpp @@ -0,0 +1,30 @@ +/* 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 "titanic/font.h" + +namespace Titanic { + +STFont::STFont() { +} + +} // End of namespace Titanic diff --git a/engines/titanic/font.h b/engines/titanic/font.h new file mode 100644 index 0000000000..f0ea5e4586 --- /dev/null +++ b/engines/titanic/font.h @@ -0,0 +1,38 @@ +/* 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. + * + */ + +#ifndef TITANIC_FONT_H +#define TITANIC_FONT_H + +#include "common/scummsys.h" + +namespace Titanic { + +class STFont { +public: +public: + STFont(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_FONT_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index bb359414ab..2ddd8d1181 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -2,6 +2,8 @@ MODULE := engines/titanic MODULE_OBJS := \ detection.o \ + font.o \ + screen_manager.o \ titanic.o # This module can be built as a plugin diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp new file mode 100644 index 0000000000..7493f1f959 --- /dev/null +++ b/engines/titanic/screen_manager.cpp @@ -0,0 +1,74 @@ +/* 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 "titanic/screen_manager.h" + +namespace Titanic { + +CScreenManagerRec::CScreenManagerRec() { + _field0 = 0; + _field4 = 0; + _field8 = 0; + _fieldC = 0; +} + +/*------------------------------------------------------------------------*/ + +CScreenManager::CScreenManager() { + _screenManagerPtr = nullptr; + + _field4 = 0; + _fontRenderSurface = nullptr; + _mouseCursor = nullptr; + _textCursor = nullptr; + _fontNumber = 0; +} + +CScreenManager::~CScreenManager() { + _screenManagerPtr = nullptr; +} + +void CScreenManager::proc2(int v) { + if (v) + _field4 = v; +} + +bool CScreenManager::proc3(int v) { + if (!v || _field4) + return false; + + _field4 = 0; + proc27(); + return true; +} + +/*------------------------------------------------------------------------*/ + +OSScreenManager::OSScreenManager(): CScreenManager() { + _field48 = 0; + _field4C = 0; + _field50 = 0; + _field54 = 0; + _directDrawManager = nullptr; +} + +} // End of namespace Titanic diff --git a/engines/titanic/screen_manager.h b/engines/titanic/screen_manager.h new file mode 100644 index 0000000000..e79fde07c3 --- /dev/null +++ b/engines/titanic/screen_manager.h @@ -0,0 +1,105 @@ +/* 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. + * + */ + +#ifndef TITANIC_SCREEN_MANAGER_H +#define TITANIC_SCREEN_MANAGER_H + +#include "common/scummsys.h" +#include "common/array.h" +#include "titanic/font.h" + +namespace Titanic { + +class CSurface { +}; + +class CScreenManagerRec { +public: + int _field0; + int _field4; + int _field8; + int _fieldC; +public: + CScreenManagerRec(); +}; + +class CScreenManager { +public: + void *_screenManagerPtr; +public: + int _field4; + Common::Array _backSurfaces; + CSurface *_fontRenderSurface; + CScreenManagerRec _entries[2]; + void *_mouseCursor; + void *_textCursor; + int _fontNumber; +public: + CScreenManager(); + virtual ~CScreenManager(); + + void fn1() {} + void fn2() {} + + virtual void proc2(int v); + virtual bool proc3(int v); + virtual void setMode() = 0; + virtual void proc5() = 0; + virtual void proc6() = 0; + virtual void proc7() = 0; + virtual void proc8() = 0; + virtual void proc9() = 0; + virtual void proc10() = 0; + virtual void proc11() = 0; + virtual void proc12() = 0; + virtual void proc13() = 0; + virtual void proc14() = 0; + virtual void proc15() = 0; + virtual void proc16() = 0; + virtual void getFont() = 0; + virtual void proc18() = 0; + virtual void proc19() = 0; + virtual void proc20() = 0; + virtual void proc21() = 0; + virtual void proc22() = 0; + virtual void proc23() = 0; + virtual void proc24() = 0; + virtual void proc25() = 0; + virtual void showCursor() = 0; + virtual void proc27() = 0; +}; + +class OSScreenManager: CScreenManager { +public: + int _field48; + int _field4C; + int _field50; + int _field54; + void *_directDrawManager; + STFont _fonts[4]; +public: + OSScreenManager(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SCREEN_MANAGER_H */ diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index 88e9fbca5b..f0a70ce191 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -44,9 +44,6 @@ void TitanicEngine::initialize() { DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts"); DebugMan.addDebugChannel(kDebugGraphics, "graphics", "Graphics handling"); DebugMan.addDebugChannel(kDebugSound, "sound", "Sound and Music handling"); - - initGraphics(320, 200, false); - } Common::Error TitanicEngine::run() { -- cgit v1.2.3 From 08be41ac52f07bdc859a9a9fd2252b69a757a569 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 5 Feb 2016 22:11:02 -0500 Subject: TITANIC: Added skeleton CMainGameWindow class --- engines/titanic/main_game_window.cpp | 36 ++++++++++++++++++++++++++ engines/titanic/main_game_window.h | 49 ++++++++++++++++++++++++++++++++++++ engines/titanic/module.mk | 1 + engines/titanic/screen_manager.cpp | 25 ++++++++++++++++++ engines/titanic/screen_manager.h | 25 ++++++++++++++++++ engines/titanic/titanic.cpp | 9 ++++++- engines/titanic/titanic.h | 5 ++++ 7 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 engines/titanic/main_game_window.cpp create mode 100644 engines/titanic/main_game_window.h diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp new file mode 100644 index 0000000000..774cde6de1 --- /dev/null +++ b/engines/titanic/main_game_window.cpp @@ -0,0 +1,36 @@ +/* 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 "titanic/main_game_window.h" + +namespace Titanic { + +CMainGameWindow::CMainGameWindow(TitanicEngine *vm): _vm(vm) { + _gameView = nullptr; + _gameManager = nullptr; + _project = nullptr; + _field50 = 0; + _image = nullptr; + _cursor = nullptr; +} + +} // End of namespace Titanic diff --git a/engines/titanic/main_game_window.h b/engines/titanic/main_game_window.h new file mode 100644 index 0000000000..ae303470ae --- /dev/null +++ b/engines/titanic/main_game_window.h @@ -0,0 +1,49 @@ +/* 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. + * + */ + +#ifndef TITANIC_MAIN_GAME_WINDOW_H +#define TITANIC_MAIN_GAME_WINDOW_H + +#include "common/scummsys.h" +#include "common/array.h" + +namespace Titanic { + +class TitanicEngine; + +class CMainGameWindow { +private: + TitanicEngine *_vm; +public: + void *_gameView; + void *_gameManager; + void *_project; + int _field50; + void *_image; + void *_cursor; +public: + CMainGameWindow(TitanicEngine *vm); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MAIN_GAME_WINDOW_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 2ddd8d1181..6f26bd441f 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -3,6 +3,7 @@ MODULE := engines/titanic MODULE_OBJS := \ detection.o \ font.o \ + main_game_window.o \ screen_manager.o \ titanic.o diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp index 7493f1f959..6ee67ca617 100644 --- a/engines/titanic/screen_manager.cpp +++ b/engines/titanic/screen_manager.cpp @@ -71,4 +71,29 @@ OSScreenManager::OSScreenManager(): CScreenManager() { _directDrawManager = nullptr; } +void OSScreenManager::setMode() {} +void OSScreenManager::proc5() {} +void OSScreenManager::proc6() {} +void OSScreenManager::proc7() {} +void OSScreenManager::proc8() {} +void OSScreenManager::proc9() {} +void OSScreenManager::proc10() {} +void OSScreenManager::proc11() {} +void OSScreenManager::proc12() {} +void OSScreenManager::proc13() {} +void OSScreenManager::proc14() {} +void OSScreenManager::proc15() {} +void OSScreenManager::proc16() {} +void OSScreenManager::getFont() {} +void OSScreenManager::proc18() {} +void OSScreenManager::proc19() {} +void OSScreenManager::proc20() {} +void OSScreenManager::proc21() {} +void OSScreenManager::proc22() {} +void OSScreenManager::proc23() {} +void OSScreenManager::proc24() {} +void OSScreenManager::proc25() {} +void OSScreenManager::showCursor() {} +void OSScreenManager::proc27() {} + } // End of namespace Titanic diff --git a/engines/titanic/screen_manager.h b/engines/titanic/screen_manager.h index e79fde07c3..b30b7a0798 100644 --- a/engines/titanic/screen_manager.h +++ b/engines/titanic/screen_manager.h @@ -98,6 +98,31 @@ public: STFont _fonts[4]; public: OSScreenManager(); + + virtual void setMode(); + virtual void proc5(); + virtual void proc6(); + virtual void proc7(); + virtual void proc8(); + virtual void proc9(); + virtual void proc10(); + virtual void proc11(); + virtual void proc12(); + virtual void proc13(); + virtual void proc14(); + virtual void proc15(); + virtual void proc16(); + virtual void getFont(); + virtual void proc18(); + virtual void proc19(); + virtual void proc20(); + virtual void proc21(); + virtual void proc22(); + virtual void proc23(); + virtual void proc24(); + virtual void proc25(); + virtual void showCursor(); + virtual void proc27(); }; } // End of namespace Titanic diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index f0a70ce191..9230717c8e 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -32,10 +32,14 @@ namespace Titanic { TitanicEngine::TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc) - : _gameDescription(gameDesc), Engine(syst) { + : _gameDescription(gameDesc), Engine(syst) { + _window = nullptr; + _screenManager = nullptr; } TitanicEngine::~TitanicEngine() { + delete _window; + delete _screenManager; } void TitanicEngine::initialize() { @@ -44,6 +48,9 @@ void TitanicEngine::initialize() { DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts"); DebugMan.addDebugChannel(kDebugGraphics, "graphics", "Graphics handling"); DebugMan.addDebugChannel(kDebugSound, "sound", "Sound and Music handling"); + + _window = new CMainGameWindow(this); + _screenManager = new OSScreenManager(); } Common::Error TitanicEngine::run() { diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index a49bb2d70c..1265e70658 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -28,6 +28,8 @@ #include "common/serializer.h" #include "engines/advancedDetector.h" #include "engines/engine.h" +#include "titanic/screen_manager.h" +#include "titanic/main_game_window.h" /** * This is the namespace of the Titanic engine. @@ -72,6 +74,9 @@ protected: // Engine APIs virtual Common::Error run(); virtual bool hasFeature(EngineFeature f) const; +public: + OSScreenManager *_screenManager; + CMainGameWindow *_window; public: TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc); virtual ~TitanicEngine(); -- cgit v1.2.3 From ab28f8714353ab5043d86375572815ebc75fe7ed Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 5 Feb 2016 23:39:27 -0500 Subject: TITANIC: Beginnings of Image class --- engines/titanic/image.cpp | 90 ++++++++++++++++++++++++++++++++++++ engines/titanic/image.h | 79 +++++++++++++++++++++++++++++++ engines/titanic/main_game_window.cpp | 6 +++ engines/titanic/main_game_window.h | 3 +- engines/titanic/module.mk | 1 + 5 files changed, 178 insertions(+), 1 deletion(-) create mode 100644 engines/titanic/image.cpp create mode 100644 engines/titanic/image.h diff --git a/engines/titanic/image.cpp b/engines/titanic/image.cpp new file mode 100644 index 0000000000..d49f2eca2d --- /dev/null +++ b/engines/titanic/image.cpp @@ -0,0 +1,90 @@ +/* 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 "titanic/image.h" + +namespace Titanic { + +BITMAPINFOHEADER::BITMAPINFOHEADER() { + _biSize = 0; + _biWidth = 0; + _biHeight = 0; + _biPlanes = 0; + _biBitCount = 0; + _biCompression = 0; + _biSizeImage = 0; + _biXPelsPerMeter = 0; + _biYPelsPerMeter = 0; + _biCirUsed = 0; + _biClrImportant = 0; +} + +/*------------------------------------------------------------------------*/ + +RGBQuad::RGBQuad() : _rgbRed(0), _rgbGreen(0), _rgbBlue(0), _rgbReserved(0) {} + +/*------------------------------------------------------------------------*/ + +Image::Image() { + _bitmapInfo = nullptr; + _bits = nullptr; + _flag = true; + + set(16, 16); +} + +void Image::proc6() { + +} + +void Image::set(int width, int height) { + delete _bitmapInfo; + if (_flag && _bitmapInfo) + delete[] _bits; + + _bitmapInfo = new tagBITMAPINFO; + _bits = new byte[(width + 3) & 0xFFFC * height]; + + tagBITMAPINFO &bi = *_bitmapInfo; + bi._bmiHeader._biWidth = width; + bi._bmiHeader._biHeight = height; + bi._bmiHeader._biPlanes = 1; + bi._bmiHeader._biBitCount = 8; +} + +void Image::proc8() { + +} + +bool Image::loadResource(const Common::String &name) { + return true; +} + +void Image::proc10() { + +} + +void Image::draw() { + +} + +} // End of namespace Titanic diff --git a/engines/titanic/image.h b/engines/titanic/image.h new file mode 100644 index 0000000000..625c78b01b --- /dev/null +++ b/engines/titanic/image.h @@ -0,0 +1,79 @@ +/* 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. + * + */ + +#ifndef TITANIC_IMAGE_H +#define TITANIC_IMAGE_H + +#include "common/scummsys.h" +#include "common/array.h" + +namespace Titanic { + +struct BITMAPINFOHEADER { + int _biSize; + int _biWidth; + int _biHeight; + int _biPlanes; + int _biBitCount; + bool _biCompression; + int _biSizeImage; + int _biXPelsPerMeter; + int _biYPelsPerMeter; + int _biCirUsed; + int _biClrImportant; + + BITMAPINFOHEADER(); +}; + +struct RGBQuad { + byte _rgbRed; + byte _rgbGreen; + byte _rgbBlue; + byte _rgbReserved; + + RGBQuad(); +}; + +struct tagBITMAPINFO { + BITMAPINFOHEADER _bmiHeader; + RGBQuad _bmiColors[256]; +}; + +class Image { +public: + tagBITMAPINFO *_bitmapInfo; + byte *_bits; + bool _flag; +public: + Image(); + + virtual void proc6(); + virtual void set(int width, int height); + virtual void proc8(); + virtual bool loadResource(const Common::String &name); + virtual void proc10(); + virtual void draw(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_IMAGE_H */ diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 774cde6de1..54fb6c23a4 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -20,6 +20,7 @@ * */ +#include "titanic/titanic.h" #include "titanic/main_game_window.h" namespace Titanic { @@ -31,6 +32,11 @@ CMainGameWindow::CMainGameWindow(TitanicEngine *vm): _vm(vm) { _field50 = 0; _image = nullptr; _cursor = nullptr; + + Image image; + bool result = image.loadResource("TITANIC"); + if (!result) + return; } } // End of namespace Titanic diff --git a/engines/titanic/main_game_window.h b/engines/titanic/main_game_window.h index ae303470ae..91e68600e0 100644 --- a/engines/titanic/main_game_window.h +++ b/engines/titanic/main_game_window.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "common/array.h" +#include "titanic/image.h" namespace Titanic { @@ -38,7 +39,7 @@ public: void *_gameManager; void *_project; int _field50; - void *_image; + Image *_image; void *_cursor; public: CMainGameWindow(TitanicEngine *vm); diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 6f26bd441f..18cde154ab 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -3,6 +3,7 @@ MODULE := engines/titanic MODULE_OBJS := \ detection.o \ font.o \ + image.o \ main_game_window.o \ screen_manager.o \ titanic.o -- cgit v1.2.3 From 0874af38dbad54551e143e541f37163ec9e7e0e7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 6 Feb 2016 11:22:08 -0500 Subject: TITANIC: Added Image::loadResource --- engines/titanic/image.cpp | 31 +++++++++++++++++++++++++++++++ engines/titanic/image.h | 6 ++++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/engines/titanic/image.cpp b/engines/titanic/image.cpp index d49f2eca2d..b18d591d37 100644 --- a/engines/titanic/image.cpp +++ b/engines/titanic/image.cpp @@ -20,6 +20,7 @@ * */ +#include "common/file.h" #include "titanic/image.h" namespace Titanic { @@ -76,6 +77,22 @@ void Image::proc8() { } bool Image::loadResource(const Common::String &name) { + // This method is hardcoded for the Titanic splash screen resource + assert(name == "TITANIC"); + + Common::File f; + if (!f.open("ST.exe")) + return false; + + // The ST.exe executable has a bitmap called "TITANIC". Since we can't use + // the Windows FindResource function in ScummVM, this is hardcoded for now + f.seek(0x29B660); + uint size = f.readUint32LE(); + if (size != 40) + return false; + + loadBitmap(f); + return true; } @@ -87,4 +104,18 @@ void Image::draw() { } +void Image::loadBitmap(Common::SeekableReadStream &s) { + _bitmapInfo->_bmiHeader._biWidth = s.readUint32LE(); + _bitmapInfo->_bmiHeader._biHeight = s.readUint32LE(); + _bitmapInfo->_bmiHeader._biPlanes = s.readUint16LE(); + _bitmapInfo->_bmiHeader._biBitCount = s.readUint16LE(); + _bitmapInfo->_bmiHeader._biCompression = s.readUint32LE(); + _bitmapInfo->_bmiHeader._biSizeImage = s.readUint32LE(); + _bitmapInfo->_bmiHeader._biXPelsPerMeter = s.readUint32LE(); + _bitmapInfo->_bmiHeader._biYPelsPerMeter = s.readUint32LE(); + _bitmapInfo->_bmiHeader._biClrUsed = s.readUint32LE(); + _bitmapInfo->_bmiHeader._biClrImportant = s.readUint32LE(); + +} + } // End of namespace Titanic diff --git a/engines/titanic/image.h b/engines/titanic/image.h index 625c78b01b..adef011df1 100644 --- a/engines/titanic/image.h +++ b/engines/titanic/image.h @@ -34,11 +34,11 @@ struct BITMAPINFOHEADER { int _biHeight; int _biPlanes; int _biBitCount; - bool _biCompression; + int _biCompression; int _biSizeImage; int _biXPelsPerMeter; int _biYPelsPerMeter; - int _biCirUsed; + int _biClrUsed; int _biClrImportant; BITMAPINFOHEADER(); @@ -59,6 +59,8 @@ struct tagBITMAPINFO { }; class Image { +private: + void loadBitmap(Common::SeekableReadStream &s); public: tagBITMAPINFO *_bitmapInfo; byte *_bits; -- cgit v1.2.3 From bc7bc8ab3487df70263721493c26c16aab9c7b81 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 7 Feb 2016 16:22:16 -0500 Subject: TITANIC: Class stubs and beginnings of CSaveableObject hierarchy --- engines/titanic/direct_draw.cpp | 45 ++++++++++++++++++++++++++ engines/titanic/direct_draw.h | 56 +++++++++++++++++++++++++++++++++ engines/titanic/image.cpp | 2 +- engines/titanic/list.cpp | 27 ++++++++++++++++ engines/titanic/list.h | 37 ++++++++++++++++++++++ engines/titanic/main_game_window.cpp | 4 ++- engines/titanic/main_game_window.h | 5 +++ engines/titanic/module.mk | 6 +++- engines/titanic/saveable_object.cpp | 61 ++++++++++++++++++++++++++++++++++++ engines/titanic/saveable_object.h | 59 ++++++++++++++++++++++++++++++++++ engines/titanic/titanic.cpp | 3 ++ engines/titanic/titanic.h | 8 +++++ engines/titanic/video_surface.cpp | 27 ++++++++++++++++ engines/titanic/video_surface.h | 42 +++++++++++++++++++++++++ 14 files changed, 379 insertions(+), 3 deletions(-) create mode 100644 engines/titanic/direct_draw.cpp create mode 100644 engines/titanic/direct_draw.h create mode 100644 engines/titanic/list.cpp create mode 100644 engines/titanic/list.h create mode 100644 engines/titanic/saveable_object.cpp create mode 100644 engines/titanic/saveable_object.h create mode 100644 engines/titanic/video_surface.cpp create mode 100644 engines/titanic/video_surface.h diff --git a/engines/titanic/direct_draw.cpp b/engines/titanic/direct_draw.cpp new file mode 100644 index 0000000000..a79edf9279 --- /dev/null +++ b/engines/titanic/direct_draw.cpp @@ -0,0 +1,45 @@ +/* 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 "titanic/direct_draw.h" + +namespace Titanic { + +DirectDraw::DirectDraw(TitanicEngine *vm) : Manager(vm) { + _field8 = 0; + _fieldC = 0; + _width = 0; + _height = 0; + _bpp = 0; + _field1C = 0; + _field24 = 0; +} + +/*------------------------------------------------------------------------*/ + +DirectDrawManager::DirectDrawManager(TitanicEngine *vm) : + Manager(vm), _directDraw(vm) { + _mainSurface = nullptr; + _backSurfaces[0] = _backSurfaces[1] = nullptr; +} + +} // End of namespace Titanic diff --git a/engines/titanic/direct_draw.h b/engines/titanic/direct_draw.h new file mode 100644 index 0000000000..f88df717e0 --- /dev/null +++ b/engines/titanic/direct_draw.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_DIRECT_DRAW_H +#define TITANIC_DIRECT_DRAW_H + +#include "common/scummsys.h" +#include "common/array.h" +#include "titanic/titanic.h" + +namespace Titanic { + +class DirectDraw: public Manager { +public: + int _field8; + int _fieldC; + int _width; + int _height; + int _bpp; + int _field1C; + int _field24; +public: + DirectDraw(TitanicEngine *vm); +}; + +class DirectDrawManager: public Manager { +public: + DirectDraw _directDraw; + void *_mainSurface; + void *_backSurfaces[2]; +public: + DirectDrawManager(TitanicEngine *vm); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DIRECT_DRAW_H */ diff --git a/engines/titanic/image.cpp b/engines/titanic/image.cpp index b18d591d37..0a130419a1 100644 --- a/engines/titanic/image.cpp +++ b/engines/titanic/image.cpp @@ -35,7 +35,7 @@ BITMAPINFOHEADER::BITMAPINFOHEADER() { _biSizeImage = 0; _biXPelsPerMeter = 0; _biYPelsPerMeter = 0; - _biCirUsed = 0; + _biClrUsed = 0; _biClrImportant = 0; } diff --git a/engines/titanic/list.cpp b/engines/titanic/list.cpp new file mode 100644 index 0000000000..2b6496f3b2 --- /dev/null +++ b/engines/titanic/list.cpp @@ -0,0 +1,27 @@ +/* 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 "titanic/list.h" + +namespace Titanic { + +} // End of namespace Titanic diff --git a/engines/titanic/list.h b/engines/titanic/list.h new file mode 100644 index 0000000000..d94ccb99ac --- /dev/null +++ b/engines/titanic/list.h @@ -0,0 +1,37 @@ +/* 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. + * + */ + +#ifndef TITANIC_LIST_H +#define TITANIC_LIST_H + +#include "common/scummsys.h" +#include "titanic/saveable_object.h" + +namespace Titanic { + +class List : public CSaveableObject { + +}; + +} // End of namespace Titanic + +#endif /* TITANIC_LIST_H */ diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 54fb6c23a4..9087cafb80 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -32,11 +32,13 @@ CMainGameWindow::CMainGameWindow(TitanicEngine *vm): _vm(vm) { _field50 = 0; _image = nullptr; _cursor = nullptr; +} +bool CMainGameWindow::Create() { Image image; bool result = image.loadResource("TITANIC"); if (!result) - return; + return true; } } // End of namespace Titanic diff --git a/engines/titanic/main_game_window.h b/engines/titanic/main_game_window.h index 91e68600e0..9b41212d7a 100644 --- a/engines/titanic/main_game_window.h +++ b/engines/titanic/main_game_window.h @@ -43,6 +43,11 @@ public: void *_cursor; public: CMainGameWindow(TitanicEngine *vm); + + /** + * Creates the window + */ + bool Create(); }; } // End of namespace Titanic diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 18cde154ab..a2a7722592 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -2,11 +2,15 @@ MODULE := engines/titanic MODULE_OBJS := \ detection.o \ + direct_draw.o \ font.o \ image.o \ + list.o \ main_game_window.o \ + saveable_object.o \ screen_manager.o \ - titanic.o + titanic.o \ + video_surface.o # This module can be built as a plugin ifeq ($(ENABLE_TITANIC), DYNAMIC_PLUGIN) diff --git a/engines/titanic/saveable_object.cpp b/engines/titanic/saveable_object.cpp new file mode 100644 index 0000000000..c1b6612d59 --- /dev/null +++ b/engines/titanic/saveable_object.cpp @@ -0,0 +1,61 @@ +/* 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 "titanic/saveable_object.h" +#include "titanic/list.h" + +namespace Titanic { + +Common::HashMap * + CSaveableObject::_classList = nullptr; + +#define DEFFN(T) CSaveableObject *Function##T() { return new T(); } +#define ADDFN(T) (*_classList)["TEST"] = Function##T + +DEFFN(List); + +void CSaveableObject::initClassList() { + _classList = new Common::HashMap(); + ADDFN(List); +} + +void CSaveableObject::freeClassList() { + delete _classList; +} + +CSaveableObject *CSaveableObject::createInstance(const Common::String &name) { + return (*_classList)[name](); +} + +void CSaveableObject::proc4() { + +} + +void CSaveableObject::proc5() { + +} + +void CSaveableObject::proc6() { + +} + +} // End of namespace Titanic diff --git a/engines/titanic/saveable_object.h b/engines/titanic/saveable_object.h new file mode 100644 index 0000000000..5253892f51 --- /dev/null +++ b/engines/titanic/saveable_object.h @@ -0,0 +1,59 @@ +/* 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. + * + */ + +#ifndef TITANIC_SAVEABLE_OBJECT_H +#define TITANIC_SAVEABLE_OBJECT_H + +#include "common/scummsys.h" +#include "common/array.h" +#include "common/hash-str.h" + +namespace Titanic { + +class CSaveableObject { + typedef CSaveableObject *(*CreateFunction)(); +private: + static Common::HashMap *_classList; +public: + /** + * Sets up the list of saveable object classes + */ + static void initClassList(); + + /** + * Free the list of saveable object classes + */ + static void freeClassList(); + + /** + * Creates a new instance of a saveable object class + */ + static CSaveableObject *createInstance(const Common::String &name); +public: + virtual void proc4(); + virtual void proc5(); + virtual void proc6(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SAVEABLE_OBJECT_H */ diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index 9230717c8e..c438c353ef 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -28,6 +28,7 @@ #include "graphics/scaler.h" #include "graphics/thumbnail.h" #include "titanic/titanic.h" +#include "titanic/saveable_object.h" namespace Titanic { @@ -40,6 +41,7 @@ TitanicEngine::TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDe TitanicEngine::~TitanicEngine() { delete _window; delete _screenManager; + CSaveableObject::freeClassList(); } void TitanicEngine::initialize() { @@ -49,6 +51,7 @@ void TitanicEngine::initialize() { DebugMan.addDebugChannel(kDebugGraphics, "graphics", "Graphics handling"); DebugMan.addDebugChannel(kDebugSound, "sound", "Sound and Music handling"); + CSaveableObject::initClassList(); _window = new CMainGameWindow(this); _screenManager = new OSScreenManager(); } diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index 1265e70658..2e51a9d75a 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -51,6 +51,7 @@ enum TitanicDebugChannels { #define TITANIC_SAVEGAME_VERSION 1 struct TitanicGameDescription; +class TitanicEngine; struct TitanicSavegameHeader { uint8 _version; @@ -61,6 +62,13 @@ struct TitanicSavegameHeader { int _totalFrames; }; +class Manager { +protected: + TitanicEngine *_vm; +public: + Manager(TitanicEngine *vm) : _vm(vm) {} +}; + class TitanicEngine : public Engine { private: /** diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp new file mode 100644 index 0000000000..d25e9da77a --- /dev/null +++ b/engines/titanic/video_surface.cpp @@ -0,0 +1,27 @@ +/* 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 "titanic/video_surface.h" + +namespace Titanic { + +} // End of namespace Titanic diff --git a/engines/titanic/video_surface.h b/engines/titanic/video_surface.h new file mode 100644 index 0000000000..259c5b0ebf --- /dev/null +++ b/engines/titanic/video_surface.h @@ -0,0 +1,42 @@ +/* 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. + * + */ + +#ifndef TITANIC_VIDEO_SURFACE_H +#define TITANIC_VIDEO_SURFACE_H + +#include "common/scummsys.h" +#include "common/array.h" +#include "titanic/font.h" + +namespace Titanic { + +class CVideoSurface { + +}; + +class OSVideoSurface : CVideoSurface { + +}; + +} // End of namespace Titanic + +#endif /* TITANIC_VIDEO_SURFACE_H */ -- cgit v1.2.3 From 43d3b138caf423bf7e84f1d251489839c0a68023 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 7 Feb 2016 18:07:44 -0500 Subject: TITANIC: Further setup of List class --- engines/titanic/list.cpp | 27 --------------------------- engines/titanic/list.h | 7 ++++++- engines/titanic/module.mk | 1 - engines/titanic/saveable_object.cpp | 2 ++ 4 files changed, 8 insertions(+), 29 deletions(-) delete mode 100644 engines/titanic/list.cpp diff --git a/engines/titanic/list.cpp b/engines/titanic/list.cpp deleted file mode 100644 index 2b6496f3b2..0000000000 --- a/engines/titanic/list.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* 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 "titanic/list.h" - -namespace Titanic { - -} // End of namespace Titanic diff --git a/engines/titanic/list.h b/engines/titanic/list.h index d94ccb99ac..0d3c62e3d2 100644 --- a/engines/titanic/list.h +++ b/engines/titanic/list.h @@ -24,11 +24,16 @@ #define TITANIC_LIST_H #include "common/scummsys.h" +#include "common/list.h" #include "titanic/saveable_object.h" namespace Titanic { -class List : public CSaveableObject { +class ListItem: public CSaveableObject { +}; + +class List : public CSaveableObject, Common::List { +public: }; diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index a2a7722592..bc37fba5ec 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -5,7 +5,6 @@ MODULE_OBJS := \ direct_draw.o \ font.o \ image.o \ - list.o \ main_game_window.o \ saveable_object.o \ screen_manager.o \ diff --git a/engines/titanic/saveable_object.cpp b/engines/titanic/saveable_object.cpp index c1b6612d59..8d0e75bef8 100644 --- a/engines/titanic/saveable_object.cpp +++ b/engines/titanic/saveable_object.cpp @@ -32,10 +32,12 @@ Common::HashMap * #define ADDFN(T) (*_classList)["TEST"] = Function##T DEFFN(List); +DEFFN(ListItem); void CSaveableObject::initClassList() { _classList = new Common::HashMap(); ADDFN(List); + ADDFN(ListItem); } void CSaveableObject::freeClassList() { -- cgit v1.2.3 From c9c85ee6223024b6102d76fad1b81d37240bb74c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 7 Feb 2016 23:25:34 -0500 Subject: TITANIC: Adding screen initialization code --- engines/titanic/direct_draw.cpp | 61 +++++++++++++++++++++++++++++++++++--- engines/titanic/direct_draw.h | 48 +++++++++++++++++++++++++----- engines/titanic/font.cpp | 4 +++ engines/titanic/font.h | 2 ++ engines/titanic/screen_manager.cpp | 61 +++++++++++++++++++++++++++++--------- engines/titanic/screen_manager.h | 37 ++++++++++++++++------- engines/titanic/titanic.cpp | 2 +- engines/titanic/titanic.h | 11 +++---- engines/titanic/video_surface.cpp | 15 ++++++++++ engines/titanic/video_surface.h | 14 +++++++-- 10 files changed, 210 insertions(+), 45 deletions(-) diff --git a/engines/titanic/direct_draw.cpp b/engines/titanic/direct_draw.cpp index a79edf9279..d503938fe4 100644 --- a/engines/titanic/direct_draw.cpp +++ b/engines/titanic/direct_draw.cpp @@ -20,26 +20,79 @@ * */ +#include "common/debug.h" +#include "engines/util.h" +#include "titanic/titanic.h" #include "titanic/direct_draw.h" namespace Titanic { -DirectDraw::DirectDraw(TitanicEngine *vm) : Manager(vm) { +DirectDraw::DirectDraw(TitanicEngine *vm) : _vm(vm) { _field8 = 0; _fieldC = 0; _width = 0; _height = 0; _bpp = 0; - _field1C = 0; + _numBackSurfaces = 0; _field24 = 0; } +void DirectDraw::setDisplayMode(int width, int height, int bpp, int refreshRate) { + debugC(ERROR_BASIC, kDebugGraphics, "DirectDraw::SetDisplayMode (%d x %d), %d bpp", + width, height, bpp); + assert(bpp == 8); + initGraphics(width, height, true); +} + +void DirectDraw::diagnostics() { + debugC(ERROR_BASIC, kDebugGraphics, "Running DirectDraw Diagnostic..."); +} + /*------------------------------------------------------------------------*/ -DirectDrawManager::DirectDrawManager(TitanicEngine *vm) : - Manager(vm), _directDraw(vm) { +DirectDrawManager::DirectDrawManager(TitanicEngine *vm, int v) : _directDraw(vm) { _mainSurface = nullptr; _backSurfaces[0] = _backSurfaces[1] = nullptr; + _directDraw._field8 = v; +} + +void DirectDrawManager::initVideo(int width, int height, int bpp, int numBackSurfaces) { + debugC(ERROR_BASIC, kDebugGraphics, "Initialising video surfaces"); + _directDraw._width = width; + _directDraw._numBackSurfaces = numBackSurfaces; + _directDraw._height = height; + _directDraw._bpp = bpp; + + if (numBackSurfaces) { + setResolution(); + } else { + initSurface(); + } +} + +void DirectDrawManager::setResolution() { + // TODO +} + +void DirectDrawManager::proc2() { + +} + +void DirectDrawManager::proc3() { + +} + +void DirectDrawManager::initSurface() { + debugC(ERROR_BASIC, kDebugGraphics, "Creating surfaces"); + _directDraw.setDisplayMode(_directDraw._width, _directDraw._height, + _directDraw._bpp, 0); + + _mainSurface = new Graphics::Surface(); + _mainSurface->create(_directDraw._width, _directDraw._height, + Graphics::PixelFormat::createFormatCLUT8()); + _backSurfaces[0] = new Graphics::Surface(); + _backSurfaces[0]->create(_directDraw._width, _directDraw._height, + Graphics::PixelFormat::createFormatCLUT8()); } } // End of namespace Titanic diff --git a/engines/titanic/direct_draw.h b/engines/titanic/direct_draw.h index f88df717e0..cb49efa513 100644 --- a/engines/titanic/direct_draw.h +++ b/engines/titanic/direct_draw.h @@ -25,30 +25,64 @@ #include "common/scummsys.h" #include "common/array.h" -#include "titanic/titanic.h" +#include "graphics/surface.h" namespace Titanic { -class DirectDraw: public Manager { +class TitanicEngine; + +class DirectDraw { +private: + TitanicEngine *_vm; public: int _field8; int _fieldC; int _width; int _height; int _bpp; - int _field1C; + int _numBackSurfaces; int _field24; public: DirectDraw(TitanicEngine *vm); + + /** + * Sets a new display mode + */ + void setDisplayMode(int width, int height, int bpp, int refreshRate); + + /** + * Logs diagnostic information + */ + void diagnostics(); }; -class DirectDrawManager: public Manager { +class DirectDrawManager { public: DirectDraw _directDraw; - void *_mainSurface; - void *_backSurfaces[2]; + Graphics::Surface *_mainSurface; + Graphics::Surface *_backSurfaces[2]; public: - DirectDrawManager(TitanicEngine *vm); + DirectDrawManager(TitanicEngine *vm, int v); + + /** + * Initializes video surfaces + * @param width Screen width + * @param height Screen height + * @param bpp Bits per pixel + * @param numBackSurfaces Number of back surfaces + */ + void initVideo(int width, int height, int bpp, int numBackSurfaces); + + void setResolution(); + + void proc2(); + + void proc3(); + + /** + * Initializes the surface for the screen + */ + void initSurface(); }; } // End of namespace Titanic diff --git a/engines/titanic/font.cpp b/engines/titanic/font.cpp index 18f15cae92..bb8f2e05e9 100644 --- a/engines/titanic/font.cpp +++ b/engines/titanic/font.cpp @@ -27,4 +27,8 @@ namespace Titanic { STFont::STFont() { } +void STFont::load(int fontNumber) { + // TODO +} + } // End of namespace Titanic diff --git a/engines/titanic/font.h b/engines/titanic/font.h index f0ea5e4586..2948505c92 100644 --- a/engines/titanic/font.h +++ b/engines/titanic/font.h @@ -31,6 +31,8 @@ class STFont { public: public: STFont(); + + void load(int fontNumber); }; } // End of namespace Titanic diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp index 6ee67ca617..61b6ff4762 100644 --- a/engines/titanic/screen_manager.cpp +++ b/engines/titanic/screen_manager.cpp @@ -21,6 +21,7 @@ */ #include "titanic/screen_manager.h" +#include "titanic/video_surface.h" namespace Titanic { @@ -33,11 +34,10 @@ CScreenManagerRec::CScreenManagerRec() { /*------------------------------------------------------------------------*/ -CScreenManager::CScreenManager() { +CScreenManager::CScreenManager(TitanicEngine *vm): _vm(vm) { _screenManagerPtr = nullptr; - _field4 = 0; - _fontRenderSurface = nullptr; + _frontRenderSurface = nullptr; _mouseCursor = nullptr; _textCursor = nullptr; _fontNumber = 0; @@ -47,31 +47,51 @@ CScreenManager::~CScreenManager() { _screenManagerPtr = nullptr; } -void CScreenManager::proc2(int v) { - if (v) - _field4 = v; +void CScreenManager::setWindowHandle(int v) { + // Not needed } -bool CScreenManager::proc3(int v) { - if (!v || _field4) - return false; - - _field4 = 0; +bool CScreenManager::resetWindowHandle(int v) { proc27(); return true; } /*------------------------------------------------------------------------*/ -OSScreenManager::OSScreenManager(): CScreenManager() { +OSScreenManager::OSScreenManager(TitanicEngine *vm): CScreenManager(vm), + _directDrawManager(vm, 0) { _field48 = 0; _field4C = 0; _field50 = 0; _field54 = 0; - _directDrawManager = nullptr; } -void OSScreenManager::setMode() {} +OSScreenManager::~OSScreenManager() { + destroyFrontAndBackBuffers(); +} + +void OSScreenManager::setMode(int width, int height, int bpp, int numBackSurfaces, bool flag2) { + destroyFrontAndBackBuffers(); + _directDrawManager.initVideo(width, height, bpp, numBackSurfaces); + + _frontRenderSurface = new OSVideoSurface(this, nullptr); + _frontRenderSurface->setSurface(this, _directDrawManager._mainSurface); + + for (uint idx = 0; idx < numBackSurfaces; ++idx) { + OSVideoSurface videoSurface(this, nullptr); + videoSurface.setSurface(this, _directDrawManager._backSurfaces[idx]); + } + + // Load fonts + _fonts[0].load(149); + _fonts[1].load(151); + _fonts[2].load(152); + _fonts[3].load(153); + + // Load the cursors + loadCursors(); +} + void OSScreenManager::proc5() {} void OSScreenManager::proc6() {} void OSScreenManager::proc7() {} @@ -96,4 +116,17 @@ void OSScreenManager::proc25() {} void OSScreenManager::showCursor() {} void OSScreenManager::proc27() {} +void OSScreenManager::destroyFrontAndBackBuffers() { + delete _frontRenderSurface; + _frontRenderSurface = nullptr; + + for (uint idx = 0; idx < _backSurfaces.size(); ++idx) + delete _backSurfaces[idx]; + _backSurfaces.clear(); +} + +void OSScreenManager::loadCursors() { + // TODO +} + } // End of namespace Titanic diff --git a/engines/titanic/screen_manager.h b/engines/titanic/screen_manager.h index b30b7a0798..4647c71c81 100644 --- a/engines/titanic/screen_manager.h +++ b/engines/titanic/screen_manager.h @@ -25,10 +25,14 @@ #include "common/scummsys.h" #include "common/array.h" +#include "titanic/direct_draw.h" #include "titanic/font.h" +#include "titanic/video_surface.h" namespace Titanic { +class TitanicEngine; + class CSurface { }; @@ -43,26 +47,27 @@ public: }; class CScreenManager { +protected: + TitanicEngine *_vm; public: void *_screenManagerPtr; public: - int _field4; - Common::Array _backSurfaces; - CSurface *_fontRenderSurface; + Common::Array _backSurfaces; + CVideoSurface *_frontRenderSurface; CScreenManagerRec _entries[2]; void *_mouseCursor; void *_textCursor; int _fontNumber; public: - CScreenManager(); + CScreenManager(TitanicEngine *vm); virtual ~CScreenManager(); void fn1() {} void fn2() {} - virtual void proc2(int v); - virtual bool proc3(int v); - virtual void setMode() = 0; + virtual void setWindowHandle(int v); + virtual bool resetWindowHandle(int v); + virtual void setMode(int width, int height, int bpp, int numBackSurfaces, bool flag2) = 0; virtual void proc5() = 0; virtual void proc6() = 0; virtual void proc7() = 0; @@ -89,17 +94,29 @@ public: }; class OSScreenManager: CScreenManager { +private: + DirectDrawManager _directDrawManager; + + /** + * Frees any surface buffers + */ + void destroyFrontAndBackBuffers(); + + /** + * Load game cursors + */ + void loadCursors(); public: int _field48; int _field4C; int _field50; int _field54; - void *_directDrawManager; STFont _fonts[4]; public: - OSScreenManager(); + OSScreenManager(TitanicEngine *vm); + virtual ~OSScreenManager(); - virtual void setMode(); + virtual void setMode(int width, int height, int bpp, int numBackSurfaces, bool flag2); virtual void proc5(); virtual void proc6(); virtual void proc7(); diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index c438c353ef..d64577c814 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -53,7 +53,7 @@ void TitanicEngine::initialize() { CSaveableObject::initClassList(); _window = new CMainGameWindow(this); - _screenManager = new OSScreenManager(); + _screenManager = new OSScreenManager(this); } Common::Error TitanicEngine::run() { diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index 2e51a9d75a..ec0585c410 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -50,6 +50,10 @@ enum TitanicDebugChannels { #define TITANIC_SAVEGAME_VERSION 1 +#define ERROR_BASIC 1 +#define ERROR_INTERMEDIATE 2 +#define ERROR_DETAILED 3 + struct TitanicGameDescription; class TitanicEngine; @@ -62,13 +66,6 @@ struct TitanicSavegameHeader { int _totalFrames; }; -class Manager { -protected: - TitanicEngine *_vm; -public: - Manager(TitanicEngine *vm) : _vm(vm) {} -}; - class TitanicEngine : public Engine { private: /** diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp index d25e9da77a..d03e2f4525 100644 --- a/engines/titanic/video_surface.cpp +++ b/engines/titanic/video_surface.cpp @@ -24,4 +24,19 @@ namespace Titanic { +CVideoSurface::CVideoSurface(CScreenManager *screenManager, Graphics::Surface *surface): + _screenManager(screenManager), _surface(surface) { +} + +void CVideoSurface::setSurface(CScreenManager *screenManager, Graphics::Surface *surface) { + _screenManager = screenManager; + _surface = surface; +} + +/*------------------------------------------------------------------------*/ + +OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, Graphics::Surface *surface): + CVideoSurface(screenManager, surface) { +} + } // End of namespace Titanic diff --git a/engines/titanic/video_surface.h b/engines/titanic/video_surface.h index 259c5b0ebf..978eacfbbe 100644 --- a/engines/titanic/video_surface.h +++ b/engines/titanic/video_surface.h @@ -25,16 +25,26 @@ #include "common/scummsys.h" #include "common/array.h" +#include "graphics/surface.h" #include "titanic/font.h" namespace Titanic { +class CScreenManager; + class CVideoSurface { +private: + CScreenManager *_screenManager; + Graphics::Surface *_surface; +public: + CVideoSurface(CScreenManager *screenManager, Graphics::Surface *surface); + void setSurface(CScreenManager *screenManager, Graphics::Surface *surface); }; -class OSVideoSurface : CVideoSurface { - +class OSVideoSurface : public CVideoSurface { +public: + OSVideoSurface(CScreenManager *screenManager, Graphics::Surface *surface); }; } // End of namespace Titanic -- cgit v1.2.3 From 3f59b21c3bb6c22bbf0a642bb0d10726af1c85ab Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 14 Feb 2016 11:55:59 -0500 Subject: TITANIC: Implement SimpleFile class --- engines/titanic/files.cpp | 167 +++++++++++++++++++++++++++++++++++++++++++++ engines/titanic/files.h | 82 ++++++++++++++++++++++ engines/titanic/module.mk | 2 + engines/titanic/string.cpp | 27 ++++++++ engines/titanic/string.h | 37 ++++++++++ 5 files changed, 315 insertions(+) create mode 100644 engines/titanic/files.cpp create mode 100644 engines/titanic/files.h create mode 100644 engines/titanic/string.cpp create mode 100644 engines/titanic/string.h diff --git a/engines/titanic/files.cpp b/engines/titanic/files.cpp new file mode 100644 index 0000000000..814746ecda --- /dev/null +++ b/engines/titanic/files.cpp @@ -0,0 +1,167 @@ +/* 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 "titanic/files.h" +#include "common/util.h" + +namespace Titanic { + +SimpleFile::SimpleFile() { +} + +void SimpleFile::open(const Common::String &name, FileMode mode) { + assert(mode == FILE_READ); + if (!_file.open(name)) + error("Could not find file - %s", name.c_str()); +} + +void SimpleFile::close() { + _file.close(); +} + +void SimpleFile::safeRead(void *dst, size_t count) { + if (_file.read(dst, count) != count) + error("Could not read %d bytes", count); +} + +int SimpleFile::unsafeRead(void *dst, size_t count) { + return _file.read(dst, count); +} + +CString SimpleFile::readString() { + char c; + CString result; + bool backslashFlag = false; + + // First skip any spaces + do { + safeRead(&c, 1); + } while (Common::isSpace(c)); + + // Ensure we've found a starting quote for the string + if (c != '"') + error("Could not find starting quote"); + + bool endFlag = false; + while (!endFlag) { + // Read the next character + safeRead(&c, 1); + + if (backslashFlag) { + backslashFlag = false; + switch (c) { + case 'n': + result += '\n'; + break; + case 'r': + result += '\r'; + break; + case '\t': + result += '\t'; + break; + default: + result += c; + break; + } + } else { + switch (c) { + case '"': + endFlag = true; + break; + case '\\': + backslashFlag = true; + break; + default: + result += c; + break; + } + } + } + + // Return the string + return result; +} + +int SimpleFile::readNumber() { + char c; + int result = 0; + bool minusFlag = false; + + // First skip any spaces + do { + safeRead(&c, 1); + } while (Common::isSpace(c)); + + // Check for prefix sign + if (c == '+' || c == '-') { + minusFlag = c == '-'; + safeRead(&c, 1); + } + + // Read in the number + if (!Common::isDigit(c)) + error("Invalid number"); + + while (Common::isDigit(c)) { + result = result * 10 + (c - '0'); + safeRead(&c, 1); + } + + // Finally, if it's a minus value, then negate it + if (minusFlag) + result = -result; + + return result; +} + +double SimpleFile::readFloat() { + char c; + Common::String result; + + // First skip any spaces + do { + safeRead(&c, 1); + } while (Common::isSpace(c)); + + // Check for prefix sign + if (c == '+' || c == '-') { + result += c; + safeRead(&c, 1); + } + + // Read in the number + if (!Common::isDigit(c)) + error("Invalid number"); + + while (Common::isDigit(c) || c == '.') { + result += c; + safeRead(&c, 1); + } + + // Convert to a float and return it + float floatValue; + sscanf(result.c_str(), "%f", &floatValue); + + return floatValue; +} + +} // End of namespace Titanic diff --git a/engines/titanic/files.h b/engines/titanic/files.h new file mode 100644 index 0000000000..d8810dc84c --- /dev/null +++ b/engines/titanic/files.h @@ -0,0 +1,82 @@ +/* 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. + * + */ + +#ifndef TITANIC_FILES_H +#define TITANIC_FILES_H + +#include "common/scummsys.h" +#include "common/file.h" +#include "titanic/string.h" + +namespace Titanic { + +enum FileMode { FILE_READ = 1, FILE_WRITE = 2 }; + +class SimpleFile { +public: + Common::File _file; +public: + SimpleFile(); + + /** + * Open a file for access + */ + virtual void open(const Common::String &name, FileMode mode = FILE_READ); + + /** + * Close the file + */ + virtual void close(); + + /** + * Read from the file with validation + */ + virtual void safeRead(void *dst, size_t count); + + /** + * Read from the file + */ + virtual int unsafeRead(void *dst, size_t count); + + /** + * Read a string from the file + */ + virtual CString readString(); + + /** + * Read a number from the file + */ + virtual int readNumber(); + + /** + * Read a floating point number from the file + */ + virtual double readFloat(); +}; + +class CompressedFile : public SimpleFile { + +}; + +} // End of namespace Titanic + +#endif /* TITANIC_FILES_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index bc37fba5ec..d65459d2d1 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -3,11 +3,13 @@ MODULE := engines/titanic MODULE_OBJS := \ detection.o \ direct_draw.o \ + files.o \ font.o \ image.o \ main_game_window.o \ saveable_object.o \ screen_manager.o \ + string.o \ titanic.o \ video_surface.o diff --git a/engines/titanic/string.cpp b/engines/titanic/string.cpp new file mode 100644 index 0000000000..cdc251d9c3 --- /dev/null +++ b/engines/titanic/string.cpp @@ -0,0 +1,27 @@ +/* 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 "titanic/files.h" + +namespace Titanic { + +} // End of namespace Titanic diff --git a/engines/titanic/string.h b/engines/titanic/string.h new file mode 100644 index 0000000000..9b8cca0396 --- /dev/null +++ b/engines/titanic/string.h @@ -0,0 +1,37 @@ +/* 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. + * + */ + +#ifndef TITANIC_STRING_H +#define TITANIC_STRING_H + +#include "common/scummsys.h" +#include "common/str.h" + +namespace Titanic { + +class CString : public Common::String { + +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STRING_H */ -- cgit v1.2.3 From 84c24b08079bc787e17995868fdd426f0a58d3da Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 14 Feb 2016 17:44:53 -0500 Subject: TITANIC: Beginnings of CompressedFile class --- engines/titanic/files.cpp | 79 +++++++++++++++++++++++++++++++++++++++++++++-- engines/titanic/files.h | 38 +++++++++++++++++++++-- 2 files changed, 113 insertions(+), 4 deletions(-) diff --git a/engines/titanic/files.cpp b/engines/titanic/files.cpp index 814746ecda..a49c47a9ab 100644 --- a/engines/titanic/files.cpp +++ b/engines/titanic/files.cpp @@ -28,6 +28,10 @@ namespace Titanic { SimpleFile::SimpleFile() { } +SimpleFile::~SimpleFile() { + _file.close(); +} + void SimpleFile::open(const Common::String &name, FileMode mode) { assert(mode == FILE_READ); if (!_file.open(name)) @@ -39,11 +43,12 @@ void SimpleFile::close() { } void SimpleFile::safeRead(void *dst, size_t count) { - if (_file.read(dst, count) != count) + assert(_file.isOpen()); + if (unsafeRead(dst, count) != count) error("Could not read %d bytes", count); } -int SimpleFile::unsafeRead(void *dst, size_t count) { +size_t SimpleFile::unsafeRead(void *dst, size_t count) { return _file.read(dst, count); } @@ -164,4 +169,74 @@ double SimpleFile::readFloat() { return floatValue; } +/*------------------------------------------------------------------------*/ + +CompressedFile::CompressedFile() : SimpleFile() { + _field48 = 0; + _isReading = 0; + _field260 = 0; + _mode = 0; +} + +CompressedFile::~CompressedFile() { +} + +void CompressedFile::open(const Common::String &name, FileMode mode) { + SimpleFile::open(name, mode); + + if (mode == FILE_READ) { + validate(&_mode, "1.0.4", 0x38); + _field48 = 2; + } else if (mode == FILE_WRITE) { + validate(&_mode, "1.0.4", 0x38); + } +} +void CompressedFile::close() { + _queue.clear(); + SimpleFile::close(); +} + +size_t CompressedFile::unsafeRead(void *dst, size_t count) { + assert(_file.isOpen()); + if (count == 0) + return 0; + + // Ensure there's enough data queued in the buffer + decompress(); + + // Pass the data to the output buffer + size_t bytesRead = 0; + byte *dataPtr = (byte *)dst; + + while (count > 0) { + if (_queue.empty()) { + decompress(); + + } + + *dataPtr++ = _queue.pop(); + ++bytesRead; + --count; + } + + return bytesRead; +} + +void CompressedFile::validate(int *mode, const char *version, int v3) { + validate2(mode, 15, version, v3); +} + +int CompressedFile::validate2(int *mode, int v15, const char *version, int v3) { + if (!version || *version != '1' || v3 != 0x38) + return -6; + if (!mode) + return -2; + + // TODO +} + +void CompressedFile::decompress() { + +} + } // End of namespace Titanic diff --git a/engines/titanic/files.h b/engines/titanic/files.h index d8810dc84c..a1fb741602 100644 --- a/engines/titanic/files.h +++ b/engines/titanic/files.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "common/file.h" +#include "common/queue.h" #include "titanic/string.h" namespace Titanic { @@ -32,10 +33,11 @@ namespace Titanic { enum FileMode { FILE_READ = 1, FILE_WRITE = 2 }; class SimpleFile { -public: +protected: Common::File _file; public: SimpleFile(); + virtual ~SimpleFile(); /** * Open a file for access @@ -55,7 +57,7 @@ public: /** * Read from the file */ - virtual int unsafeRead(void *dst, size_t count); + virtual size_t unsafeRead(void *dst, size_t count); /** * Read a string from the file @@ -74,7 +76,39 @@ public: }; class CompressedFile : public SimpleFile { +private: + Common::Queue _queue; + int _field48; + int _isReading; + int _field260; + int _mode; + + /** + * Decompress data from the source file + */ + void decompress(); + + void validate(int *mode, const char *version, int v3); + + int validate2(int *mode, int v15, const char *version, int v3); +public: + CompressedFile(); + virtual ~CompressedFile(); + + /** + * Open a file for access + */ + virtual void open(const Common::String &name, FileMode mode = FILE_READ); + + /** + * Close the file + */ + virtual void close(); + /** + * Read from the file + */ + virtual size_t unsafeRead(void *dst, size_t count); }; } // End of namespace Titanic -- cgit v1.2.3 From 2753998868fe9f456b87f87a786fb5d58fb2c232 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 15 Feb 2016 16:17:38 -0500 Subject: TITANIC: Work on decompressor --- engines/titanic/files.cpp | 96 ++++++++++++++++++++++++++++++++++++++--------- engines/titanic/files.h | 53 +++++++++++++++++++++++--- 2 files changed, 126 insertions(+), 23 deletions(-) diff --git a/engines/titanic/files.cpp b/engines/titanic/files.cpp index a49c47a9ab..6432595748 100644 --- a/engines/titanic/files.cpp +++ b/engines/titanic/files.cpp @@ -171,8 +171,79 @@ double SimpleFile::readFloat() { /*------------------------------------------------------------------------*/ +DecompressorData::DecompressorData() { + _field0 = 0; + _field4 = 0; + _field8 = 0; + _fieldC = 0; + _field10 = 0; + _field14 = 0; +} + +/*------------------------------------------------------------------------*/ + +Decompressor::Decompressor() { + _createFn = nullptr; + _destroyFn = nullptr; + _field18 = 0; + _dataPtr = nullptr; + _field28 = 0; +} + +void Decompressor::load(const char *version, int v) { + if (!version || *version != '1') + error("Bad version"); + + _field18 = 0; + if (!_createFn) { + _createFn = &Decompressor::createMethod; + _field28 = 0; + } + + if (!_destroyFn) { + _destroyFn = &Decompressor::destroyMethod; + } + + _dataPtr = (this->*_createFn)(_field28, 1, 24); + _dataPtr->_field14 = 0; + _dataPtr->_fieldC = 0; + if (v < 0) { + v = -v; + _dataPtr->_fieldC = 1; + } + + if (v < 8 || v > 15) + error("Bad parameter"); + + _dataPtr->_field10 = v; + _dataPtr->_field14 = sub1(_dataPtr->_fieldC ? nullptr : &Decompressor::method3, 1 << v); + + if (_dataPtr->_field14) + sub2(); + else + close(); +} + +int Decompressor::sub1(Method3Fn fn, int v) { + +} + +void Decompressor::close() { + +} + +DecompressorData *Decompressor::createMethod(int v1, int v2, int v3) { + return new DecompressorData(); +} + +void Decompressor::destroyMethod(DecompressorData *ptr) { + delete ptr; +} + +/*------------------------------------------------------------------------*/ + CompressedFile::CompressedFile() : SimpleFile() { - _field48 = 0; + _fileMode = 0; _isReading = 0; _field260 = 0; _mode = 0; @@ -185,10 +256,11 @@ void CompressedFile::open(const Common::String &name, FileMode mode) { SimpleFile::open(name, mode); if (mode == FILE_READ) { - validate(&_mode, "1.0.4", 0x38); - _field48 = 2; + _decompressor.load(); + _fileMode = 2; } else if (mode == FILE_WRITE) { - validate(&_mode, "1.0.4", 0x38); + _decompressor.load(); + _fileMode = 1; } } void CompressedFile::close() { @@ -211,7 +283,8 @@ size_t CompressedFile::unsafeRead(void *dst, size_t count) { while (count > 0) { if (_queue.empty()) { decompress(); - + if (_queue.empty()) + break; } *dataPtr++ = _queue.pop(); @@ -222,19 +295,6 @@ size_t CompressedFile::unsafeRead(void *dst, size_t count) { return bytesRead; } -void CompressedFile::validate(int *mode, const char *version, int v3) { - validate2(mode, 15, version, v3); -} - -int CompressedFile::validate2(int *mode, int v15, const char *version, int v3) { - if (!version || *version != '1' || v3 != 0x38) - return -6; - if (!mode) - return -2; - - // TODO -} - void CompressedFile::decompress() { } diff --git a/engines/titanic/files.h b/engines/titanic/files.h index a1fb741602..1689f392d2 100644 --- a/engines/titanic/files.h +++ b/engines/titanic/files.h @@ -32,6 +32,9 @@ namespace Titanic { enum FileMode { FILE_READ = 1, FILE_WRITE = 2 }; +class Decompressor; +class DecompressorData; + class SimpleFile { protected: Common::File _file; @@ -75,10 +78,54 @@ public: virtual double readFloat(); }; +typedef DecompressorData *(Decompressor::*DecompressorCreateFn)(int v1, int v2, int v3); +typedef void(Decompressor::*DecompressorDestroyFn)(DecompressorData *ptr); +typedef void(Decompressor::*Method3Fn)(); + +class DecompressorData { +public: + int _field0; + int _field4; + int _field8; + int _fieldC; + int _field10; + int _field14; +public: + DecompressorData(); +}; + +class Decompressor { +private: + DecompressorCreateFn _createFn; + DecompressorDestroyFn _destroyFn; + int _field18; + DecompressorData *_dataPtr; + int _field28; + + DecompressorData *createMethod(int v1, int v2, int v3); + + void destroyMethod(DecompressorData *ptr); + + void method3() { + // TODO + } + + int sub1(Method3Fn fn, int v); + + void sub2(); +public: + Decompressor(); + + void load(const char *version = "1.0.4", int v = 15); + + void close(); +}; + class CompressedFile : public SimpleFile { private: + Decompressor _decompressor; Common::Queue _queue; - int _field48; + int _fileMode; int _isReading; int _field260; int _mode; @@ -87,10 +134,6 @@ private: * Decompress data from the source file */ void decompress(); - - void validate(int *mode, const char *version, int v3); - - int validate2(int *mode, int v15, const char *version, int v3); public: CompressedFile(); virtual ~CompressedFile(); -- cgit v1.2.3 From 1e4de9a3232127f72c7d832548343699aa1088cc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 18 Feb 2016 19:29:13 -0500 Subject: TITANIC: Starting to create classes for project item hierarchy --- engines/titanic/files.cpp | 27 +++++++++-- engines/titanic/files.h | 11 +++++ engines/titanic/list.h | 2 +- engines/titanic/module.mk | 8 ++- engines/titanic/objects/file_item.cpp | 28 +++++++++++ engines/titanic/objects/file_item.h | 36 ++++++++++++++ engines/titanic/objects/message_target.cpp | 27 +++++++++++ engines/titanic/objects/message_target.h | 35 ++++++++++++++ engines/titanic/objects/project_item.cpp | 60 +++++++++++++++++++++++ engines/titanic/objects/project_item.h | 52 ++++++++++++++++++++ engines/titanic/objects/saveable_object.cpp | 75 +++++++++++++++++++++++++++++ engines/titanic/objects/saveable_object.h | 59 +++++++++++++++++++++++ engines/titanic/objects/tree_item.cpp | 27 +++++++++++ engines/titanic/objects/tree_item.h | 35 ++++++++++++++ engines/titanic/saveable_object.cpp | 63 ------------------------ engines/titanic/saveable_object.h | 59 ----------------------- engines/titanic/titanic.cpp | 2 +- 17 files changed, 476 insertions(+), 130 deletions(-) create mode 100644 engines/titanic/objects/file_item.cpp create mode 100644 engines/titanic/objects/file_item.h create mode 100644 engines/titanic/objects/message_target.cpp create mode 100644 engines/titanic/objects/message_target.h create mode 100644 engines/titanic/objects/project_item.cpp create mode 100644 engines/titanic/objects/project_item.h create mode 100644 engines/titanic/objects/saveable_object.cpp create mode 100644 engines/titanic/objects/saveable_object.h create mode 100644 engines/titanic/objects/tree_item.cpp create mode 100644 engines/titanic/objects/tree_item.h delete mode 100644 engines/titanic/saveable_object.cpp delete mode 100644 engines/titanic/saveable_object.h diff --git a/engines/titanic/files.cpp b/engines/titanic/files.cpp index 6432595748..2f5b1b511e 100644 --- a/engines/titanic/files.cpp +++ b/engines/titanic/files.cpp @@ -25,7 +25,7 @@ namespace Titanic { -SimpleFile::SimpleFile() { +SimpleFile::SimpleFile(): _stream(nullptr) { } SimpleFile::~SimpleFile() { @@ -38,18 +38,24 @@ void SimpleFile::open(const Common::String &name, FileMode mode) { error("Could not find file - %s", name.c_str()); } +void SimpleFile::open(Common::SeekableReadStream *stream, FileMode mode) { + close(); + _stream = stream; +} + void SimpleFile::close() { _file.close(); + _stream = nullptr; } void SimpleFile::safeRead(void *dst, size_t count) { - assert(_file.isOpen()); + assert(_stream); if (unsafeRead(dst, count) != count) error("Could not read %d bytes", count); } size_t SimpleFile::unsafeRead(void *dst, size_t count) { - return _file.read(dst, count); + return _stream->read(dst, count); } CString SimpleFile::readString() { @@ -225,7 +231,7 @@ void Decompressor::load(const char *version, int v) { } int Decompressor::sub1(Method3Fn fn, int v) { - + return 0; } void Decompressor::close() { @@ -263,6 +269,19 @@ void CompressedFile::open(const Common::String &name, FileMode mode) { _fileMode = 1; } } + +void CompressedFile::open(Common::SeekableReadStream *stream, FileMode mode) { + SimpleFile::open(stream, mode); + + if (mode == FILE_READ) { + _decompressor.load(); + _fileMode = 2; + } else if (mode == FILE_WRITE) { + _decompressor.load(); + _fileMode = 1; + } +} + void CompressedFile::close() { _queue.clear(); SimpleFile::close(); diff --git a/engines/titanic/files.h b/engines/titanic/files.h index 1689f392d2..0f72f60270 100644 --- a/engines/titanic/files.h +++ b/engines/titanic/files.h @@ -38,6 +38,7 @@ class DecompressorData; class SimpleFile { protected: Common::File _file; + Common::SeekableReadStream *_stream; public: SimpleFile(); virtual ~SimpleFile(); @@ -47,6 +48,11 @@ public: */ virtual void open(const Common::String &name, FileMode mode = FILE_READ); + /** + * Set up a stream for access + */ + virtual void open(Common::SeekableReadStream *stream, FileMode mode = FILE_READ); + /** * Close the file */ @@ -143,6 +149,11 @@ public: */ virtual void open(const Common::String &name, FileMode mode = FILE_READ); + /** + * Set up a stream for access + */ + virtual void open(Common::SeekableReadStream *stream, FileMode mode = FILE_READ); + /** * Close the file */ diff --git a/engines/titanic/list.h b/engines/titanic/list.h index 0d3c62e3d2..bea3776f0f 100644 --- a/engines/titanic/list.h +++ b/engines/titanic/list.h @@ -25,7 +25,7 @@ #include "common/scummsys.h" #include "common/list.h" -#include "titanic/saveable_object.h" +#include "titanic/objects/saveable_object.h" namespace Titanic { diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index d65459d2d1..6cb4fc14ec 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -7,11 +7,15 @@ MODULE_OBJS := \ font.o \ image.o \ main_game_window.o \ - saveable_object.o \ screen_manager.o \ string.o \ titanic.o \ - video_surface.o + video_surface.o \ + objects/file_item.o \ + objects/message_target.o \ + objects/project_item.o \ + objects/saveable_object.o \ + objects/tree_item.o # This module can be built as a plugin ifeq ($(ENABLE_TITANIC), DYNAMIC_PLUGIN) diff --git a/engines/titanic/objects/file_item.cpp b/engines/titanic/objects/file_item.cpp new file mode 100644 index 0000000000..d49df71fcc --- /dev/null +++ b/engines/titanic/objects/file_item.cpp @@ -0,0 +1,28 @@ +/* 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 "titanic/objects/file_item.h" + +namespace Titanic { + + +} // End of namespace Titanic diff --git a/engines/titanic/objects/file_item.h b/engines/titanic/objects/file_item.h new file mode 100644 index 0000000000..133421ae1c --- /dev/null +++ b/engines/titanic/objects/file_item.h @@ -0,0 +1,36 @@ +/* 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. + * + */ + +#ifndef TITANIC_FILE_ITEM_H +#define TITANIC_FILE_ITEM_H + +#include "titanic/objects/tree_item.h" + +namespace Titanic { + +class CFileItem: public CTreeItem { +public: +}; + +} // End of namespace Titanic + +#endif /* TITANIC_FILE_ITEM_H */ diff --git a/engines/titanic/objects/message_target.cpp b/engines/titanic/objects/message_target.cpp new file mode 100644 index 0000000000..1e727a3686 --- /dev/null +++ b/engines/titanic/objects/message_target.cpp @@ -0,0 +1,27 @@ +/* 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 "titanic/objects/message_target.h" + +namespace Titanic { + +} // End of namespace Titanic diff --git a/engines/titanic/objects/message_target.h b/engines/titanic/objects/message_target.h new file mode 100644 index 0000000000..6afd709211 --- /dev/null +++ b/engines/titanic/objects/message_target.h @@ -0,0 +1,35 @@ +/* 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. + * + */ + +#ifndef TITANIC_MESSAGE_TARGET_H +#define TITANIC_MESSAGE_TARGET_H + +#include "titanic/objects/saveable_object.h" + +namespace Titanic { + +class CMessageTarget: public CSaveableObject { +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MESSAGE_TARGET_H */ diff --git a/engines/titanic/objects/project_item.cpp b/engines/titanic/objects/project_item.cpp new file mode 100644 index 0000000000..80596ec15c --- /dev/null +++ b/engines/titanic/objects/project_item.cpp @@ -0,0 +1,60 @@ +/* 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/savefile.h" +#include "titanic/titanic.h" +#include "titanic/files.h" +#include "titanic/objects/project_item.h" + +namespace Titanic { + +void CProjectItem::load(int id) { + CompressedFile file; + Common::InSaveFile *saveFile = nullptr; + + // Clear any existing project contents + clear(); + + // Open either an existing savegame slot or the new game template + if (id > 0) { + saveFile = g_system->getSavefileManager()->openForLoading( + Common::String::format("slot%d.gam", id)); + file.open(saveFile); + } else { + file.open("newgame.st"); + } + + // Load the contents in + loadData(file); + + file.close(); +} + +void CProjectItem::clear() { + +} + +void CProjectItem::loadData(SimpleFile &file) { + +} + +} // End of namespace Titanic diff --git a/engines/titanic/objects/project_item.h b/engines/titanic/objects/project_item.h new file mode 100644 index 0000000000..2856f42110 --- /dev/null +++ b/engines/titanic/objects/project_item.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_PROJECT_ITEM_H +#define TITANIC_PROJECT_ITEM_H + +#include "common/scummsys.h" +#include "titanic/files.h" +#include "titanic/objects/file_item.h" + +namespace Titanic { + +class CProjectItem : public CFileItem { +private: + /** + * Load project data from the passed file + */ + void loadData(SimpleFile &file); +public: + /** + * Load the entire project data for a given Id + */ + void load(int id); + + /** + * Clear any currently loaded project + */ + void clear(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PROJECT_ITEM_H */ diff --git a/engines/titanic/objects/saveable_object.cpp b/engines/titanic/objects/saveable_object.cpp new file mode 100644 index 0000000000..b2384a56f2 --- /dev/null +++ b/engines/titanic/objects/saveable_object.cpp @@ -0,0 +1,75 @@ +/* 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 "titanic/objects/saveable_object.h" +#include "titanic/objects/file_item.h" +#include "titanic/objects/message_target.h" +#include "titanic/objects/project_item.h" +#include "titanic/objects/tree_item.h" +#include "titanic/list.h" + +namespace Titanic { + +Common::HashMap * + CSaveableObject::_classList = nullptr; + +#define DEFFN(T) CSaveableObject *Function##T() { return new T(); } +#define ADDFN(T) (*_classList)["TEST"] = Function##T + +DEFFN(List); +DEFFN(ListItem); +DEFFN(CMessageTarget); +DEFFN(CTreeItem); +DEFFN(CFileItem); +DEFFN(CProjectItem); + +void CSaveableObject::initClassList() { + _classList = new Common::HashMap(); + ADDFN(List); + ADDFN(ListItem); + ADDFN(CMessageTarget); + ADDFN(CTreeItem); + ADDFN(CFileItem); + ADDFN(CProjectItem); +} + +void CSaveableObject::freeClassList() { + delete _classList; +} + +CSaveableObject *CSaveableObject::createInstance(const Common::String &name) { + return (*_classList)[name](); +} + +void CSaveableObject::proc4() { + +} + +void CSaveableObject::proc5() { + +} + +void CSaveableObject::proc6() { + +} + +} // End of namespace Titanic diff --git a/engines/titanic/objects/saveable_object.h b/engines/titanic/objects/saveable_object.h new file mode 100644 index 0000000000..5253892f51 --- /dev/null +++ b/engines/titanic/objects/saveable_object.h @@ -0,0 +1,59 @@ +/* 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. + * + */ + +#ifndef TITANIC_SAVEABLE_OBJECT_H +#define TITANIC_SAVEABLE_OBJECT_H + +#include "common/scummsys.h" +#include "common/array.h" +#include "common/hash-str.h" + +namespace Titanic { + +class CSaveableObject { + typedef CSaveableObject *(*CreateFunction)(); +private: + static Common::HashMap *_classList; +public: + /** + * Sets up the list of saveable object classes + */ + static void initClassList(); + + /** + * Free the list of saveable object classes + */ + static void freeClassList(); + + /** + * Creates a new instance of a saveable object class + */ + static CSaveableObject *createInstance(const Common::String &name); +public: + virtual void proc4(); + virtual void proc5(); + virtual void proc6(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SAVEABLE_OBJECT_H */ diff --git a/engines/titanic/objects/tree_item.cpp b/engines/titanic/objects/tree_item.cpp new file mode 100644 index 0000000000..06128ce354 --- /dev/null +++ b/engines/titanic/objects/tree_item.cpp @@ -0,0 +1,27 @@ +/* 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 "titanic/objects/tree_item.h" + +namespace Titanic { + +} // End of namespace Titanic diff --git a/engines/titanic/objects/tree_item.h b/engines/titanic/objects/tree_item.h new file mode 100644 index 0000000000..170a0e905d --- /dev/null +++ b/engines/titanic/objects/tree_item.h @@ -0,0 +1,35 @@ +/* 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. + * + */ + +#ifndef TITANIC_TREE_ITEM_H +#define TITANIC_TREE_ITEM_H + +#include "titanic/objects/message_target.h" + +namespace Titanic { + +class CTreeItem: public CMessageTarget { +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TREE_ITEM_H */ diff --git a/engines/titanic/saveable_object.cpp b/engines/titanic/saveable_object.cpp deleted file mode 100644 index 8d0e75bef8..0000000000 --- a/engines/titanic/saveable_object.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* 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 "titanic/saveable_object.h" -#include "titanic/list.h" - -namespace Titanic { - -Common::HashMap * - CSaveableObject::_classList = nullptr; - -#define DEFFN(T) CSaveableObject *Function##T() { return new T(); } -#define ADDFN(T) (*_classList)["TEST"] = Function##T - -DEFFN(List); -DEFFN(ListItem); - -void CSaveableObject::initClassList() { - _classList = new Common::HashMap(); - ADDFN(List); - ADDFN(ListItem); -} - -void CSaveableObject::freeClassList() { - delete _classList; -} - -CSaveableObject *CSaveableObject::createInstance(const Common::String &name) { - return (*_classList)[name](); -} - -void CSaveableObject::proc4() { - -} - -void CSaveableObject::proc5() { - -} - -void CSaveableObject::proc6() { - -} - -} // End of namespace Titanic diff --git a/engines/titanic/saveable_object.h b/engines/titanic/saveable_object.h deleted file mode 100644 index 5253892f51..0000000000 --- a/engines/titanic/saveable_object.h +++ /dev/null @@ -1,59 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_SAVEABLE_OBJECT_H -#define TITANIC_SAVEABLE_OBJECT_H - -#include "common/scummsys.h" -#include "common/array.h" -#include "common/hash-str.h" - -namespace Titanic { - -class CSaveableObject { - typedef CSaveableObject *(*CreateFunction)(); -private: - static Common::HashMap *_classList; -public: - /** - * Sets up the list of saveable object classes - */ - static void initClassList(); - - /** - * Free the list of saveable object classes - */ - static void freeClassList(); - - /** - * Creates a new instance of a saveable object class - */ - static CSaveableObject *createInstance(const Common::String &name); -public: - virtual void proc4(); - virtual void proc5(); - virtual void proc6(); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_SAVEABLE_OBJECT_H */ diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index d64577c814..57f3c7df0c 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -28,7 +28,7 @@ #include "graphics/scaler.h" #include "graphics/thumbnail.h" #include "titanic/titanic.h" -#include "titanic/saveable_object.h" +#include "titanic/objects/saveable_object.h" namespace Titanic { -- cgit v1.2.3 From 7818eecaff50fc78b1ac084b6eeaf11adcea0a63 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 18 Feb 2016 19:40:12 -0500 Subject: TITANIC: Split SimpleFile and CompressedFile into different files --- engines/titanic/compressed_file.cpp | 169 ++++++++++++++++ engines/titanic/compressed_file.h | 120 ++++++++++++ engines/titanic/files.cpp | 321 ------------------------------- engines/titanic/files.h | 170 ---------------- engines/titanic/module.mk | 3 +- engines/titanic/objects/project_item.cpp | 2 +- engines/titanic/objects/project_item.h | 2 +- engines/titanic/simple_file.cpp | 177 +++++++++++++++++ engines/titanic/simple_file.h | 89 +++++++++ engines/titanic/string.cpp | 2 +- 10 files changed, 560 insertions(+), 495 deletions(-) create mode 100644 engines/titanic/compressed_file.cpp create mode 100644 engines/titanic/compressed_file.h delete mode 100644 engines/titanic/files.cpp delete mode 100644 engines/titanic/files.h create mode 100644 engines/titanic/simple_file.cpp create mode 100644 engines/titanic/simple_file.h diff --git a/engines/titanic/compressed_file.cpp b/engines/titanic/compressed_file.cpp new file mode 100644 index 0000000000..7c0d9872d3 --- /dev/null +++ b/engines/titanic/compressed_file.cpp @@ -0,0 +1,169 @@ +/* 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/util.h" +#include "titanic/compressed_file.h" + +namespace Titanic { + +DecompressorData::DecompressorData() { + _field0 = 0; + _field4 = 0; + _field8 = 0; + _fieldC = 0; + _field10 = 0; + _field14 = 0; +} + +/*------------------------------------------------------------------------*/ + +Decompressor::Decompressor() { + _createFn = nullptr; + _destroyFn = nullptr; + _field18 = 0; + _dataPtr = nullptr; + _field28 = 0; +} + +void Decompressor::load(const char *version, int v) { + if (!version || *version != '1') + error("Bad version"); + + _field18 = 0; + if (!_createFn) { + _createFn = &Decompressor::createMethod; + _field28 = 0; + } + + if (!_destroyFn) { + _destroyFn = &Decompressor::destroyMethod; + } + + _dataPtr = (this->*_createFn)(_field28, 1, 24); + _dataPtr->_field14 = 0; + _dataPtr->_fieldC = 0; + if (v < 0) { + v = -v; + _dataPtr->_fieldC = 1; + } + + if (v < 8 || v > 15) + error("Bad parameter"); + + _dataPtr->_field10 = v; + _dataPtr->_field14 = sub1(_dataPtr->_fieldC ? nullptr : &Decompressor::method3, 1 << v); + + if (_dataPtr->_field14) + sub2(); + else + close(); +} + +int Decompressor::sub1(Method3Fn fn, int v) { + return 0; +} + +void Decompressor::close() { + +} + +DecompressorData *Decompressor::createMethod(int v1, int v2, int v3) { + return new DecompressorData(); +} + +void Decompressor::destroyMethod(DecompressorData *ptr) { + delete ptr; +} + +/*------------------------------------------------------------------------*/ + +CompressedFile::CompressedFile() : SimpleFile() { + _fileMode = 0; + _isReading = 0; + _field260 = 0; + _mode = 0; +} + +CompressedFile::~CompressedFile() { +} + +void CompressedFile::open(const Common::String &name, FileMode mode) { + SimpleFile::open(name, mode); + + if (mode == FILE_READ) { + _decompressor.load(); + _fileMode = 2; + } else if (mode == FILE_WRITE) { + _decompressor.load(); + _fileMode = 1; + } +} + +void CompressedFile::open(Common::SeekableReadStream *stream, FileMode mode) { + SimpleFile::open(stream, mode); + + if (mode == FILE_READ) { + _decompressor.load(); + _fileMode = 2; + } else if (mode == FILE_WRITE) { + _decompressor.load(); + _fileMode = 1; + } +} + +void CompressedFile::close() { + _queue.clear(); + SimpleFile::close(); +} + +size_t CompressedFile::unsafeRead(void *dst, size_t count) { + assert(_file.isOpen()); + if (count == 0) + return 0; + + // Ensure there's enough data queued in the buffer + decompress(); + + // Pass the data to the output buffer + size_t bytesRead = 0; + byte *dataPtr = (byte *)dst; + + while (count > 0) { + if (_queue.empty()) { + decompress(); + if (_queue.empty()) + break; + } + + *dataPtr++ = _queue.pop(); + ++bytesRead; + --count; + } + + return bytesRead; +} + +void CompressedFile::decompress() { + +} + +} // End of namespace Titanic diff --git a/engines/titanic/compressed_file.h b/engines/titanic/compressed_file.h new file mode 100644 index 0000000000..814a1ab812 --- /dev/null +++ b/engines/titanic/compressed_file.h @@ -0,0 +1,120 @@ +/* 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. + * + */ + +#ifndef TITANIC_COMPRESSED_FILE_H +#define TITANIC_COMPRESSED_FILE_H + +#include "common/scummsys.h" +#include "common/file.h" +#include "common/queue.h" +#include "titanic/simple_file.h" +#include "titanic/string.h" + +namespace Titanic { + +class Decompressor; +class DecompressorData; + +typedef DecompressorData *(Decompressor::*DecompressorCreateFn)(int v1, int v2, int v3); +typedef void(Decompressor::*DecompressorDestroyFn)(DecompressorData *ptr); +typedef void(Decompressor::*Method3Fn)(); + +class DecompressorData { +public: + int _field0; + int _field4; + int _field8; + int _fieldC; + int _field10; + int _field14; +public: + DecompressorData(); +}; + +class Decompressor { +private: + DecompressorCreateFn _createFn; + DecompressorDestroyFn _destroyFn; + int _field18; + DecompressorData *_dataPtr; + int _field28; + + DecompressorData *createMethod(int v1, int v2, int v3); + + void destroyMethod(DecompressorData *ptr); + + void method3() { + // TODO + } + + int sub1(Method3Fn fn, int v); + + void sub2(); +public: + Decompressor(); + + void load(const char *version = "1.0.4", int v = 15); + + void close(); +}; + +class CompressedFile : public SimpleFile { +private: + Decompressor _decompressor; + Common::Queue _queue; + int _fileMode; + int _isReading; + int _field260; + int _mode; + + /** + * Decompress data from the source file + */ + void decompress(); +public: + CompressedFile(); + virtual ~CompressedFile(); + + /** + * Open a file for access + */ + virtual void open(const Common::String &name, FileMode mode = FILE_READ); + + /** + * Set up a stream for access + */ + virtual void open(Common::SeekableReadStream *stream, FileMode mode = FILE_READ); + + /** + * Close the file + */ + virtual void close(); + + /** + * Read from the file + */ + virtual size_t unsafeRead(void *dst, size_t count); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_COMPRESSED_FILE_H */ diff --git a/engines/titanic/files.cpp b/engines/titanic/files.cpp deleted file mode 100644 index 2f5b1b511e..0000000000 --- a/engines/titanic/files.cpp +++ /dev/null @@ -1,321 +0,0 @@ -/* 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 "titanic/files.h" -#include "common/util.h" - -namespace Titanic { - -SimpleFile::SimpleFile(): _stream(nullptr) { -} - -SimpleFile::~SimpleFile() { - _file.close(); -} - -void SimpleFile::open(const Common::String &name, FileMode mode) { - assert(mode == FILE_READ); - if (!_file.open(name)) - error("Could not find file - %s", name.c_str()); -} - -void SimpleFile::open(Common::SeekableReadStream *stream, FileMode mode) { - close(); - _stream = stream; -} - -void SimpleFile::close() { - _file.close(); - _stream = nullptr; -} - -void SimpleFile::safeRead(void *dst, size_t count) { - assert(_stream); - if (unsafeRead(dst, count) != count) - error("Could not read %d bytes", count); -} - -size_t SimpleFile::unsafeRead(void *dst, size_t count) { - return _stream->read(dst, count); -} - -CString SimpleFile::readString() { - char c; - CString result; - bool backslashFlag = false; - - // First skip any spaces - do { - safeRead(&c, 1); - } while (Common::isSpace(c)); - - // Ensure we've found a starting quote for the string - if (c != '"') - error("Could not find starting quote"); - - bool endFlag = false; - while (!endFlag) { - // Read the next character - safeRead(&c, 1); - - if (backslashFlag) { - backslashFlag = false; - switch (c) { - case 'n': - result += '\n'; - break; - case 'r': - result += '\r'; - break; - case '\t': - result += '\t'; - break; - default: - result += c; - break; - } - } else { - switch (c) { - case '"': - endFlag = true; - break; - case '\\': - backslashFlag = true; - break; - default: - result += c; - break; - } - } - } - - // Return the string - return result; -} - -int SimpleFile::readNumber() { - char c; - int result = 0; - bool minusFlag = false; - - // First skip any spaces - do { - safeRead(&c, 1); - } while (Common::isSpace(c)); - - // Check for prefix sign - if (c == '+' || c == '-') { - minusFlag = c == '-'; - safeRead(&c, 1); - } - - // Read in the number - if (!Common::isDigit(c)) - error("Invalid number"); - - while (Common::isDigit(c)) { - result = result * 10 + (c - '0'); - safeRead(&c, 1); - } - - // Finally, if it's a minus value, then negate it - if (minusFlag) - result = -result; - - return result; -} - -double SimpleFile::readFloat() { - char c; - Common::String result; - - // First skip any spaces - do { - safeRead(&c, 1); - } while (Common::isSpace(c)); - - // Check for prefix sign - if (c == '+' || c == '-') { - result += c; - safeRead(&c, 1); - } - - // Read in the number - if (!Common::isDigit(c)) - error("Invalid number"); - - while (Common::isDigit(c) || c == '.') { - result += c; - safeRead(&c, 1); - } - - // Convert to a float and return it - float floatValue; - sscanf(result.c_str(), "%f", &floatValue); - - return floatValue; -} - -/*------------------------------------------------------------------------*/ - -DecompressorData::DecompressorData() { - _field0 = 0; - _field4 = 0; - _field8 = 0; - _fieldC = 0; - _field10 = 0; - _field14 = 0; -} - -/*------------------------------------------------------------------------*/ - -Decompressor::Decompressor() { - _createFn = nullptr; - _destroyFn = nullptr; - _field18 = 0; - _dataPtr = nullptr; - _field28 = 0; -} - -void Decompressor::load(const char *version, int v) { - if (!version || *version != '1') - error("Bad version"); - - _field18 = 0; - if (!_createFn) { - _createFn = &Decompressor::createMethod; - _field28 = 0; - } - - if (!_destroyFn) { - _destroyFn = &Decompressor::destroyMethod; - } - - _dataPtr = (this->*_createFn)(_field28, 1, 24); - _dataPtr->_field14 = 0; - _dataPtr->_fieldC = 0; - if (v < 0) { - v = -v; - _dataPtr->_fieldC = 1; - } - - if (v < 8 || v > 15) - error("Bad parameter"); - - _dataPtr->_field10 = v; - _dataPtr->_field14 = sub1(_dataPtr->_fieldC ? nullptr : &Decompressor::method3, 1 << v); - - if (_dataPtr->_field14) - sub2(); - else - close(); -} - -int Decompressor::sub1(Method3Fn fn, int v) { - return 0; -} - -void Decompressor::close() { - -} - -DecompressorData *Decompressor::createMethod(int v1, int v2, int v3) { - return new DecompressorData(); -} - -void Decompressor::destroyMethod(DecompressorData *ptr) { - delete ptr; -} - -/*------------------------------------------------------------------------*/ - -CompressedFile::CompressedFile() : SimpleFile() { - _fileMode = 0; - _isReading = 0; - _field260 = 0; - _mode = 0; -} - -CompressedFile::~CompressedFile() { -} - -void CompressedFile::open(const Common::String &name, FileMode mode) { - SimpleFile::open(name, mode); - - if (mode == FILE_READ) { - _decompressor.load(); - _fileMode = 2; - } else if (mode == FILE_WRITE) { - _decompressor.load(); - _fileMode = 1; - } -} - -void CompressedFile::open(Common::SeekableReadStream *stream, FileMode mode) { - SimpleFile::open(stream, mode); - - if (mode == FILE_READ) { - _decompressor.load(); - _fileMode = 2; - } else if (mode == FILE_WRITE) { - _decompressor.load(); - _fileMode = 1; - } -} - -void CompressedFile::close() { - _queue.clear(); - SimpleFile::close(); -} - -size_t CompressedFile::unsafeRead(void *dst, size_t count) { - assert(_file.isOpen()); - if (count == 0) - return 0; - - // Ensure there's enough data queued in the buffer - decompress(); - - // Pass the data to the output buffer - size_t bytesRead = 0; - byte *dataPtr = (byte *)dst; - - while (count > 0) { - if (_queue.empty()) { - decompress(); - if (_queue.empty()) - break; - } - - *dataPtr++ = _queue.pop(); - ++bytesRead; - --count; - } - - return bytesRead; -} - -void CompressedFile::decompress() { - -} - -} // End of namespace Titanic diff --git a/engines/titanic/files.h b/engines/titanic/files.h deleted file mode 100644 index 0f72f60270..0000000000 --- a/engines/titanic/files.h +++ /dev/null @@ -1,170 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_FILES_H -#define TITANIC_FILES_H - -#include "common/scummsys.h" -#include "common/file.h" -#include "common/queue.h" -#include "titanic/string.h" - -namespace Titanic { - -enum FileMode { FILE_READ = 1, FILE_WRITE = 2 }; - -class Decompressor; -class DecompressorData; - -class SimpleFile { -protected: - Common::File _file; - Common::SeekableReadStream *_stream; -public: - SimpleFile(); - virtual ~SimpleFile(); - - /** - * Open a file for access - */ - virtual void open(const Common::String &name, FileMode mode = FILE_READ); - - /** - * Set up a stream for access - */ - virtual void open(Common::SeekableReadStream *stream, FileMode mode = FILE_READ); - - /** - * Close the file - */ - virtual void close(); - - /** - * Read from the file with validation - */ - virtual void safeRead(void *dst, size_t count); - - /** - * Read from the file - */ - virtual size_t unsafeRead(void *dst, size_t count); - - /** - * Read a string from the file - */ - virtual CString readString(); - - /** - * Read a number from the file - */ - virtual int readNumber(); - - /** - * Read a floating point number from the file - */ - virtual double readFloat(); -}; - -typedef DecompressorData *(Decompressor::*DecompressorCreateFn)(int v1, int v2, int v3); -typedef void(Decompressor::*DecompressorDestroyFn)(DecompressorData *ptr); -typedef void(Decompressor::*Method3Fn)(); - -class DecompressorData { -public: - int _field0; - int _field4; - int _field8; - int _fieldC; - int _field10; - int _field14; -public: - DecompressorData(); -}; - -class Decompressor { -private: - DecompressorCreateFn _createFn; - DecompressorDestroyFn _destroyFn; - int _field18; - DecompressorData *_dataPtr; - int _field28; - - DecompressorData *createMethod(int v1, int v2, int v3); - - void destroyMethod(DecompressorData *ptr); - - void method3() { - // TODO - } - - int sub1(Method3Fn fn, int v); - - void sub2(); -public: - Decompressor(); - - void load(const char *version = "1.0.4", int v = 15); - - void close(); -}; - -class CompressedFile : public SimpleFile { -private: - Decompressor _decompressor; - Common::Queue _queue; - int _fileMode; - int _isReading; - int _field260; - int _mode; - - /** - * Decompress data from the source file - */ - void decompress(); -public: - CompressedFile(); - virtual ~CompressedFile(); - - /** - * Open a file for access - */ - virtual void open(const Common::String &name, FileMode mode = FILE_READ); - - /** - * Set up a stream for access - */ - virtual void open(Common::SeekableReadStream *stream, FileMode mode = FILE_READ); - - /** - * Close the file - */ - virtual void close(); - - /** - * Read from the file - */ - virtual size_t unsafeRead(void *dst, size_t count); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_FILES_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 6cb4fc14ec..17805e171a 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -1,13 +1,14 @@ MODULE := engines/titanic MODULE_OBJS := \ + compressed_file.o \ detection.o \ direct_draw.o \ - files.o \ font.o \ image.o \ main_game_window.o \ screen_manager.o \ + simple_file.o \ string.o \ titanic.o \ video_surface.o \ diff --git a/engines/titanic/objects/project_item.cpp b/engines/titanic/objects/project_item.cpp index 80596ec15c..90f85d97b9 100644 --- a/engines/titanic/objects/project_item.cpp +++ b/engines/titanic/objects/project_item.cpp @@ -22,7 +22,7 @@ #include "common/savefile.h" #include "titanic/titanic.h" -#include "titanic/files.h" +#include "titanic/compressed_file.h" #include "titanic/objects/project_item.h" namespace Titanic { diff --git a/engines/titanic/objects/project_item.h b/engines/titanic/objects/project_item.h index 2856f42110..93f6e17ef0 100644 --- a/engines/titanic/objects/project_item.h +++ b/engines/titanic/objects/project_item.h @@ -24,7 +24,7 @@ #define TITANIC_PROJECT_ITEM_H #include "common/scummsys.h" -#include "titanic/files.h" +#include "titanic/simple_file.h" #include "titanic/objects/file_item.h" namespace Titanic { diff --git a/engines/titanic/simple_file.cpp b/engines/titanic/simple_file.cpp new file mode 100644 index 0000000000..038603c2d1 --- /dev/null +++ b/engines/titanic/simple_file.cpp @@ -0,0 +1,177 @@ +/* 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 "titanic/simple_file.h" + +namespace Titanic { + +SimpleFile::SimpleFile(): _stream(nullptr) { +} + +SimpleFile::~SimpleFile() { + _file.close(); +} + +void SimpleFile::open(const Common::String &name, FileMode mode) { + assert(mode == FILE_READ); + if (!_file.open(name)) + error("Could not find file - %s", name.c_str()); +} + +void SimpleFile::open(Common::SeekableReadStream *stream, FileMode mode) { + close(); + _stream = stream; +} + +void SimpleFile::close() { + _file.close(); + _stream = nullptr; +} + +void SimpleFile::safeRead(void *dst, size_t count) { + assert(_stream); + if (unsafeRead(dst, count) != count) + error("Could not read %d bytes", count); +} + +size_t SimpleFile::unsafeRead(void *dst, size_t count) { + return _stream->read(dst, count); +} + +CString SimpleFile::readString() { + char c; + CString result; + bool backslashFlag = false; + + // First skip any spaces + do { + safeRead(&c, 1); + } while (Common::isSpace(c)); + + // Ensure we've found a starting quote for the string + if (c != '"') + error("Could not find starting quote"); + + bool endFlag = false; + while (!endFlag) { + // Read the next character + safeRead(&c, 1); + + if (backslashFlag) { + backslashFlag = false; + switch (c) { + case 'n': + result += '\n'; + break; + case 'r': + result += '\r'; + break; + case '\t': + result += '\t'; + break; + default: + result += c; + break; + } + } else { + switch (c) { + case '"': + endFlag = true; + break; + case '\\': + backslashFlag = true; + break; + default: + result += c; + break; + } + } + } + + // Return the string + return result; +} + +int SimpleFile::readNumber() { + char c; + int result = 0; + bool minusFlag = false; + + // First skip any spaces + do { + safeRead(&c, 1); + } while (Common::isSpace(c)); + + // Check for prefix sign + if (c == '+' || c == '-') { + minusFlag = c == '-'; + safeRead(&c, 1); + } + + // Read in the number + if (!Common::isDigit(c)) + error("Invalid number"); + + while (Common::isDigit(c)) { + result = result * 10 + (c - '0'); + safeRead(&c, 1); + } + + // Finally, if it's a minus value, then negate it + if (minusFlag) + result = -result; + + return result; +} + +double SimpleFile::readFloat() { + char c; + Common::String result; + + // First skip any spaces + do { + safeRead(&c, 1); + } while (Common::isSpace(c)); + + // Check for prefix sign + if (c == '+' || c == '-') { + result += c; + safeRead(&c, 1); + } + + // Read in the number + if (!Common::isDigit(c)) + error("Invalid number"); + + while (Common::isDigit(c) || c == '.') { + result += c; + safeRead(&c, 1); + } + + // Convert to a float and return it + float floatValue; + sscanf(result.c_str(), "%f", &floatValue); + + return floatValue; +} + +} // End of namespace Titanic diff --git a/engines/titanic/simple_file.h b/engines/titanic/simple_file.h new file mode 100644 index 0000000000..6720d9455f --- /dev/null +++ b/engines/titanic/simple_file.h @@ -0,0 +1,89 @@ +/* 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. + * + */ + +#ifndef TITANIC_SIMPLE_FILE_H +#define TITANIC_SIMPLE_FILE_H + +#include "common/scummsys.h" +#include "common/file.h" +#include "common/queue.h" +#include "titanic/string.h" + +namespace Titanic { + +enum FileMode { FILE_READ = 1, FILE_WRITE = 2 }; + +class Decompressor; +class DecompressorData; + +class SimpleFile { +protected: + Common::File _file; + Common::SeekableReadStream *_stream; +public: + SimpleFile(); + virtual ~SimpleFile(); + + /** + * Open a file for access + */ + virtual void open(const Common::String &name, FileMode mode = FILE_READ); + + /** + * Set up a stream for access + */ + virtual void open(Common::SeekableReadStream *stream, FileMode mode = FILE_READ); + + /** + * Close the file + */ + virtual void close(); + + /** + * Read from the file with validation + */ + virtual void safeRead(void *dst, size_t count); + + /** + * Read from the file + */ + virtual size_t unsafeRead(void *dst, size_t count); + + /** + * Read a string from the file + */ + virtual CString readString(); + + /** + * Read a number from the file + */ + virtual int readNumber(); + + /** + * Read a floating point number from the file + */ + virtual double readFloat(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SIMPLE_FILE_H */ diff --git a/engines/titanic/string.cpp b/engines/titanic/string.cpp index cdc251d9c3..55b7f8ca52 100644 --- a/engines/titanic/string.cpp +++ b/engines/titanic/string.cpp @@ -20,7 +20,7 @@ * */ -#include "titanic/files.h" +#include "titanic/string.h" namespace Titanic { -- cgit v1.2.3 From c4a0d4923afa6cded68ba2863c2df30fd38d1455 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 18 Feb 2016 20:35:38 -0500 Subject: TITANIC: Implement lots of SimpleFile methods --- engines/titanic/compressed_file.cpp | 34 +++++------ engines/titanic/compressed_file.h | 11 +++- engines/titanic/simple_file.cpp | 115 +++++++++++++++++++++++++++++++++--- engines/titanic/simple_file.h | 71 +++++++++++++++++++--- 4 files changed, 192 insertions(+), 39 deletions(-) diff --git a/engines/titanic/compressed_file.cpp b/engines/titanic/compressed_file.cpp index 7c0d9872d3..ea760167d7 100644 --- a/engines/titanic/compressed_file.cpp +++ b/engines/titanic/compressed_file.cpp @@ -20,7 +20,6 @@ * */ -#include "common/util.h" #include "titanic/compressed_file.h" namespace Titanic { @@ -106,28 +105,25 @@ CompressedFile::CompressedFile() : SimpleFile() { CompressedFile::~CompressedFile() { } -void CompressedFile::open(const Common::String &name, FileMode mode) { - SimpleFile::open(name, mode); +void CompressedFile::open(const Common::String &name) { + SimpleFile::open(name); - if (mode == FILE_READ) { - _decompressor.load(); - _fileMode = 2; - } else if (mode == FILE_WRITE) { - _decompressor.load(); - _fileMode = 1; - } + _decompressor.load(); + _fileMode = 2; } -void CompressedFile::open(Common::SeekableReadStream *stream, FileMode mode) { - SimpleFile::open(stream, mode); +void CompressedFile::open(Common::SeekableReadStream *stream) { + SimpleFile::open(stream); - if (mode == FILE_READ) { - _decompressor.load(); - _fileMode = 2; - } else if (mode == FILE_WRITE) { - _decompressor.load(); - _fileMode = 1; - } + _decompressor.load(); + _fileMode = 2; +} + +void CompressedFile::open(Common::OutSaveFile *stream) { + SimpleFile::open(stream); + + _decompressor.load(); + _fileMode = 1; } void CompressedFile::close() { diff --git a/engines/titanic/compressed_file.h b/engines/titanic/compressed_file.h index 814a1ab812..56e2c23343 100644 --- a/engines/titanic/compressed_file.h +++ b/engines/titanic/compressed_file.h @@ -97,12 +97,17 @@ public: /** * Open a file for access */ - virtual void open(const Common::String &name, FileMode mode = FILE_READ); + virtual void open(const Common::String &name); /** - * Set up a stream for access + * Set up a stream for read access */ - virtual void open(Common::SeekableReadStream *stream, FileMode mode = FILE_READ); + virtual void open(Common::SeekableReadStream *stream); + + /** + * Set up a stream for write access + */ + virtual void open(Common::OutSaveFile *stream); /** * Close the file diff --git a/engines/titanic/simple_file.cpp b/engines/titanic/simple_file.cpp index 038603c2d1..5848fbee67 100644 --- a/engines/titanic/simple_file.cpp +++ b/engines/titanic/simple_file.cpp @@ -20,41 +20,63 @@ * */ +#include "common/util.h" #include "titanic/simple_file.h" namespace Titanic { -SimpleFile::SimpleFile(): _stream(nullptr) { +SimpleFile::SimpleFile(): _inStream(nullptr), _outStream(nullptr), _lineCount(1) { } SimpleFile::~SimpleFile() { _file.close(); } -void SimpleFile::open(const Common::String &name, FileMode mode) { - assert(mode == FILE_READ); +void SimpleFile::open(const Common::String &name) { + close(); + if (!_file.open(name)) error("Could not find file - %s", name.c_str()); + _inStream = &_file; } -void SimpleFile::open(Common::SeekableReadStream *stream, FileMode mode) { +void SimpleFile::open(Common::SeekableReadStream *stream) { + close(); + _inStream = stream; +} + +void SimpleFile::open(Common::OutSaveFile *stream) { close(); - _stream = stream; + _outStream = stream; } void SimpleFile::close() { _file.close(); - _stream = nullptr; + if (_outStream) + _outStream->finalize(); + + _inStream = nullptr; + _outStream = nullptr; } void SimpleFile::safeRead(void *dst, size_t count) { - assert(_stream); if (unsafeRead(dst, count) != count) error("Could not read %d bytes", count); } size_t SimpleFile::unsafeRead(void *dst, size_t count) { - return _stream->read(dst, count); + assert(_inStream); + return _inStream->read(dst, count); +} + +size_t SimpleFile::write(const void *src, size_t count) { + assert(_outStream); + return _outStream->write(src, count); +} + +bool SimpleFile::eof() const { + assert(_inStream); + return _inStream->pos() >= _inStream->size(); } CString SimpleFile::readString() { @@ -174,4 +196,81 @@ double SimpleFile::readFloat() { return floatValue; } +void SimpleFile::writeLine(const CString &str) { + write(str.c_str(), str.size()); + write("\r\n", 2); +} + +void SimpleFile::writeString(const CString &str) { + if (str.empty()) + return; + + const char *msgP = str.c_str(); + char c; + + while (c = *msgP++) { + switch (c) { + case '\r': + write("\\r", 2); + break; + case '\n': + write("\\n", 2); + break; + case '\t': + write("\\t", 2); + break; + case '\"': + write("\\\"", 2); + break; + case '\\': + write("\\\\", 2); + break; + case '{': + write("\\{", 2); + break; + case '}': + write("\\}", 2); + break; + default: + write(&c, 1); + break; + } + } +} + +void SimpleFile::writeQuotedString(const CString &str) { + write("\"", 1); + writeString(str); + write("\" ", 2); +} + +void SimpleFile::writeIndent(uint indent) { + for (uint idx = 0; idx < indent; ++idx) + write("\t", 1); +} + +bool SimpleFile::IsClassEnd() { + char c; + + do { + safeRead(&c, 1); + } while (Common::isSpace(c)); + + return c == '}'; +} + +void SimpleFile::writeClassStart(const CString &classStr, int indent) { + write("\n", 1); + writeIndent(indent); + write("{\n", 2); + writeIndent(indent + 1); + writeQuotedString(classStr); + write("\n", 1); +} + +void SimpleFile::writeClassEnd(int indent) { + writeIndent(indent); + write("}\n", 2); +} + } // End of namespace Titanic diff --git a/engines/titanic/simple_file.h b/engines/titanic/simple_file.h index 6720d9455f..45d700018a 100644 --- a/engines/titanic/simple_file.h +++ b/engines/titanic/simple_file.h @@ -26,19 +26,20 @@ #include "common/scummsys.h" #include "common/file.h" #include "common/queue.h" +#include "common/savefile.h" #include "titanic/string.h" namespace Titanic { -enum FileMode { FILE_READ = 1, FILE_WRITE = 2 }; - class Decompressor; class DecompressorData; class SimpleFile { protected: Common::File _file; - Common::SeekableReadStream *_stream; + Common::SeekableReadStream *_inStream; + Common::OutSaveFile *_outStream; + int _lineCount; public: SimpleFile(); virtual ~SimpleFile(); @@ -46,12 +47,17 @@ public: /** * Open a file for access */ - virtual void open(const Common::String &name, FileMode mode = FILE_READ); + virtual void open(const Common::String &name); + + /** + * Set up a stream for read access + */ + virtual void open(Common::SeekableReadStream *stream); /** - * Set up a stream for access + * Set up a stream for write access */ - virtual void open(Common::SeekableReadStream *stream, FileMode mode = FILE_READ); + virtual void open(Common::OutSaveFile *stream); /** * Close the file @@ -68,20 +74,67 @@ public: */ virtual size_t unsafeRead(void *dst, size_t count); + /** + * Write out data + */ + virtual size_t write(const void *src, size_t count); + + /** + * Return true if the end of the file has been reached + */ + bool eof() const; + /** * Read a string from the file */ - virtual CString readString(); + CString readString(); /** * Read a number from the file */ - virtual int readNumber(); + int readNumber(); /** * Read a floating point number from the file */ - virtual double readFloat(); + double readFloat(); + + /** + * Write a line + */ + void writeLine(const CString &str); + + /** + * Write a string + */ + void writeString(const CString &str); + + /** + * Write a quoted string + */ + void writeQuotedString(const CString &str); + + /** + * Write out a number of tabs to form an indent in the output + */ + void writeIndent(uint indent); + + /** + * Validates that the following non-space character is either + * an opening or closing squiggly bracket denoting a class + * definition start or end. Returns true if it's a class end + */ + bool IsClassEnd(); + + /** + * Write the starting header for a class definition + */ + void writeClassStart(const CString &classStr, int indent); + + /** + * Write out the ending footer for a class definition + */ + void writeClassEnd(int indent); }; } // End of namespace Titanic -- cgit v1.2.3 From 9b173df32f65ec4eec9b9acf800a2541ccf74678 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 18 Feb 2016 21:12:22 -0500 Subject: TITANIC: Implement CSaveableObject saving methods --- engines/titanic/objects/saveable_object.cpp | 16 ++++++++++----- engines/titanic/objects/saveable_object.h | 30 ++++++++++++++++++++++++++--- engines/titanic/simple_file.cpp | 11 +++++++++++ engines/titanic/simple_file.h | 14 +++++++++++++- engines/titanic/string.h | 8 +++++++- 5 files changed, 69 insertions(+), 10 deletions(-) diff --git a/engines/titanic/objects/saveable_object.cpp b/engines/titanic/objects/saveable_object.cpp index b2384a56f2..caa5192d19 100644 --- a/engines/titanic/objects/saveable_object.cpp +++ b/engines/titanic/objects/saveable_object.cpp @@ -60,16 +60,22 @@ CSaveableObject *CSaveableObject::createInstance(const Common::String &name) { return (*_classList)[name](); } -void CSaveableObject::proc4() { - +void CSaveableObject::save(SimpleFile *file, int indent) { + // Should always be overriden in descendents, so just write a dummy value + file->writeNumberLine(0, indent); } -void CSaveableObject::proc5() { - +void CSaveableObject::load(SimpleFile *file) { + // Should always be overriden in descendents, so just read a dummy value + file->readNumber(); } -void CSaveableObject::proc6() { +void CSaveableObject::saveHeader(SimpleFile *file, int indent) { + file->writeClassStart(getClassName(), indent); +} +void CSaveableObject::saveFooter(SimpleFile *file, int indent) { + file->writeClassEnd(indent); } } // End of namespace Titanic diff --git a/engines/titanic/objects/saveable_object.h b/engines/titanic/objects/saveable_object.h index 5253892f51..e99d8c5525 100644 --- a/engines/titanic/objects/saveable_object.h +++ b/engines/titanic/objects/saveable_object.h @@ -26,6 +26,7 @@ #include "common/scummsys.h" #include "common/array.h" #include "common/hash-str.h" +#include "titanic/simple_file.h" namespace Titanic { @@ -49,9 +50,32 @@ public: */ static CSaveableObject *createInstance(const Common::String &name); public: - virtual void proc4(); - virtual void proc5(); - virtual void proc6(); + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSaveableObject"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); + + /** + * Write out a header definition for the class to file + * prior to saving the actual data for the class + */ + virtual void saveHeader(SimpleFile *file, int indent); + + /** + * Writes out a footer for the class after it's data has + * been written to file + */ + virtual void saveFooter(SimpleFile *file, int indent); }; } // End of namespace Titanic diff --git a/engines/titanic/simple_file.cpp b/engines/titanic/simple_file.cpp index 5848fbee67..9f371b2009 100644 --- a/engines/titanic/simple_file.cpp +++ b/engines/titanic/simple_file.cpp @@ -244,6 +244,17 @@ void SimpleFile::writeQuotedString(const CString &str) { write("\" ", 2); } +void SimpleFile::writeNumber(int val) { + CString str = CString::format("%ld ", val); + write(str.c_str(), str.size()); +} + +void SimpleFile::writeNumberLine(int val, int indent) { + writeIndent(indent); + writeNumber(val); + write("\n", 1); +} + void SimpleFile::writeIndent(uint indent) { for (uint idx = 0; idx < indent; ++idx) write("\t", 1); diff --git a/engines/titanic/simple_file.h b/engines/titanic/simple_file.h index 45d700018a..17dd82a130 100644 --- a/engines/titanic/simple_file.h +++ b/engines/titanic/simple_file.h @@ -100,10 +100,12 @@ public: double readFloat(); /** - * Write a line + * Write a string line */ void writeLine(const CString &str); + + /** * Write a string */ @@ -114,6 +116,16 @@ public: */ void writeQuotedString(const CString &str); + /** + * Write a number to file + */ + void writeNumber(int val); + + /** + * Write a number line to file + */ + void writeNumberLine(int val, int indent); + /** * Write out a number of tabs to form an indent in the output */ diff --git a/engines/titanic/string.h b/engines/titanic/string.h index 9b8cca0396..46cbb02ad5 100644 --- a/engines/titanic/string.h +++ b/engines/titanic/string.h @@ -29,7 +29,13 @@ namespace Titanic { class CString : public Common::String { - +public: + CString() : Common::String() {} + CString(const char *str) : Common::String(str) {} + CString(const char *str, uint32 len) : Common::String(str, len) {} + CString(const char *beginP, const char *endP) : Common::String(beginP, endP) {} + CString(const String &str) : Common::String(str) {} + explicit CString(char c) : Common::String(c) {} }; } // End of namespace Titanic -- cgit v1.2.3 From e2aca904ec8c0e0f23124b00b4b1eb525105f95e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 18 Feb 2016 22:05:51 -0500 Subject: TITANIC: Implement saving methods for List and ListItem --- engines/titanic/list.h | 42 -------------- engines/titanic/module.mk | 1 + engines/titanic/objects/list.cpp | 88 +++++++++++++++++++++++++++++ engines/titanic/objects/list.h | 82 +++++++++++++++++++++++++++ engines/titanic/objects/saveable_object.cpp | 10 ++-- engines/titanic/objects/saveable_object.h | 6 +- engines/titanic/simple_file.cpp | 19 ++++++- engines/titanic/simple_file.h | 16 ++++-- 8 files changed, 208 insertions(+), 56 deletions(-) delete mode 100644 engines/titanic/list.h create mode 100644 engines/titanic/objects/list.cpp create mode 100644 engines/titanic/objects/list.h diff --git a/engines/titanic/list.h b/engines/titanic/list.h deleted file mode 100644 index bea3776f0f..0000000000 --- a/engines/titanic/list.h +++ /dev/null @@ -1,42 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_LIST_H -#define TITANIC_LIST_H - -#include "common/scummsys.h" -#include "common/list.h" -#include "titanic/objects/saveable_object.h" - -namespace Titanic { - -class ListItem: public CSaveableObject { -}; - -class List : public CSaveableObject, Common::List { -public: - -}; - -} // End of namespace Titanic - -#endif /* TITANIC_LIST_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 17805e171a..abd351250d 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -13,6 +13,7 @@ MODULE_OBJS := \ titanic.o \ video_surface.o \ objects/file_item.o \ + objects/list.o \ objects/message_target.o \ objects/project_item.o \ objects/saveable_object.o \ diff --git a/engines/titanic/objects/list.cpp b/engines/titanic/objects/list.cpp new file mode 100644 index 0000000000..ddcddb04dd --- /dev/null +++ b/engines/titanic/objects/list.cpp @@ -0,0 +1,88 @@ +/* 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 "titanic/objects/list.h" + +namespace Titanic { + +void ListItem::save(SimpleFile *file, int indent) const { + // Should always be overriden in descendents, so just write a dummy value + file->writeNumberLine(0, indent); +} + +void ListItem::load(SimpleFile *file) { + // Should always be overriden in descendents, so just read the dummy value + file->readNumber(); +} + +/*------------------------------------------------------------------------*/ + +List::List() { +} + +void List::save(SimpleFile *file, int indent) const { + file->writeNumberLine(0, indent); + saveItems(file, indent); +} + +void List::load(SimpleFile *file) { + file->readNumber(); + loadItems(file); +} + +void List::saveItems(SimpleFile *file, int indent) const { + // Write out number of items + file->writeQuotedLine("L", indent); + file->writeNumberLine(size(), indent); + + // Iterate through writing entries + List::const_iterator i; + for (i = begin(); i != end(); ++i) { + const ListItem *item = *i; + item->saveHeader(file, indent); + item->save(file, indent + 1); + item->saveFooter(file, indent); + } +} + +void List::loadItems(SimpleFile *file) { + file->readBuffer(); + uint count = file->readNumber(); + + for (uint idx = 0; idx < count; ++idx) { + // Validate the class start header + if (!file->IsClassStart()) + error("Unexpected class end"); + + // Get item's class name and use it to instantiate an item + CString className = file->readString(); + CSaveableObject *newItem = CSaveableObject::createInstance(className); + if (!newItem) + error("Could not create instance of %s", className.c_str()); + + // Validate the class end footer + if (file->IsClassStart()) + error("Unexpected class start"); + } +} + +} // End of namespace Titanic diff --git a/engines/titanic/objects/list.h b/engines/titanic/objects/list.h new file mode 100644 index 0000000000..f98912795d --- /dev/null +++ b/engines/titanic/objects/list.h @@ -0,0 +1,82 @@ +/* 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. + * + */ + +#ifndef TITANIC_LIST_H +#define TITANIC_LIST_H + +#include "common/scummsys.h" +#include "common/list.h" +#include "titanic/objects/saveable_object.h" + +namespace Titanic { + +class ListItem: public CSaveableObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "ListItem"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +class List : public CSaveableObject, Common::List { +private: + /** + * Write out the contents of the list + */ + void saveItems(SimpleFile *file, int indent) const; + + /** + * Read in the contents of a list + */ + void loadItems(SimpleFile *file); +public: + List(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "List"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_LIST_H */ diff --git a/engines/titanic/objects/saveable_object.cpp b/engines/titanic/objects/saveable_object.cpp index caa5192d19..25bd1645b5 100644 --- a/engines/titanic/objects/saveable_object.cpp +++ b/engines/titanic/objects/saveable_object.cpp @@ -22,10 +22,10 @@ #include "titanic/objects/saveable_object.h" #include "titanic/objects/file_item.h" +#include "titanic/objects/list.h" #include "titanic/objects/message_target.h" #include "titanic/objects/project_item.h" #include "titanic/objects/tree_item.h" -#include "titanic/list.h" namespace Titanic { @@ -60,21 +60,21 @@ CSaveableObject *CSaveableObject::createInstance(const Common::String &name) { return (*_classList)[name](); } -void CSaveableObject::save(SimpleFile *file, int indent) { +void CSaveableObject::save(SimpleFile *file, int indent) const { // Should always be overriden in descendents, so just write a dummy value file->writeNumberLine(0, indent); } void CSaveableObject::load(SimpleFile *file) { - // Should always be overriden in descendents, so just read a dummy value + // Should always be overriden in descendents, so just read the dummy value file->readNumber(); } -void CSaveableObject::saveHeader(SimpleFile *file, int indent) { +void CSaveableObject::saveHeader(SimpleFile *file, int indent) const { file->writeClassStart(getClassName(), indent); } -void CSaveableObject::saveFooter(SimpleFile *file, int indent) { +void CSaveableObject::saveFooter(SimpleFile *file, int indent) const { file->writeClassEnd(indent); } diff --git a/engines/titanic/objects/saveable_object.h b/engines/titanic/objects/saveable_object.h index e99d8c5525..4e7d949191 100644 --- a/engines/titanic/objects/saveable_object.h +++ b/engines/titanic/objects/saveable_object.h @@ -58,7 +58,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent); + virtual void save(SimpleFile *file, int indent) const; /** * Load the data for the class from file @@ -69,13 +69,13 @@ public: * Write out a header definition for the class to file * prior to saving the actual data for the class */ - virtual void saveHeader(SimpleFile *file, int indent); + virtual void saveHeader(SimpleFile *file, int indent) const; /** * Writes out a footer for the class after it's data has * been written to file */ - virtual void saveFooter(SimpleFile *file, int indent); + virtual void saveFooter(SimpleFile *file, int indent) const; }; } // End of namespace Titanic diff --git a/engines/titanic/simple_file.cpp b/engines/titanic/simple_file.cpp index 9f371b2009..cf95aca269 100644 --- a/engines/titanic/simple_file.cpp +++ b/engines/titanic/simple_file.cpp @@ -196,6 +196,14 @@ double SimpleFile::readFloat() { return floatValue; } +void SimpleFile::readBuffer(char *buffer, size_t count) { + CString tempString = readString(); + if (buffer) { + strncpy(buffer, tempString.c_str(), count); + buffer[count - 1] = '\0'; + } +} + void SimpleFile::writeLine(const CString &str) { write(str.c_str(), str.size()); write("\r\n", 2); @@ -244,6 +252,12 @@ void SimpleFile::writeQuotedString(const CString &str) { write("\" ", 2); } +void SimpleFile::writeQuotedLine(const CString &str, int indent) { + writeIndent(indent); + writeQuotedString(str); + write("\n", 1); +} + void SimpleFile::writeNumber(int val) { CString str = CString::format("%ld ", val); write(str.c_str(), str.size()); @@ -260,14 +274,15 @@ void SimpleFile::writeIndent(uint indent) { write("\t", 1); } -bool SimpleFile::IsClassEnd() { +bool SimpleFile::IsClassStart() { char c; do { safeRead(&c, 1); } while (Common::isSpace(c)); - return c == '}'; + assert(c == '{' || c == '}'); + return c == '{'; } void SimpleFile::writeClassStart(const CString &classStr, int indent) { diff --git a/engines/titanic/simple_file.h b/engines/titanic/simple_file.h index 17dd82a130..65b0ac6f31 100644 --- a/engines/titanic/simple_file.h +++ b/engines/titanic/simple_file.h @@ -99,13 +99,16 @@ public: */ double readFloat(); + /** + * Read a string and copy it into an optionally passed buffer + */ + void readBuffer(char *buffer = nullptr, size_t count = 0); + /** * Write a string line */ void writeLine(const CString &str); - - /** * Write a string */ @@ -116,6 +119,11 @@ public: */ void writeQuotedString(const CString &str); + /** + * Write a quoted string line + */ + void writeQuotedLine(const CString &str, int indent); + /** * Write a number to file */ @@ -134,9 +142,9 @@ public: /** * Validates that the following non-space character is either * an opening or closing squiggly bracket denoting a class - * definition start or end. Returns true if it's a class end + * definition start or end. Returns true if it's a class start */ - bool IsClassEnd(); + bool IsClassStart(); /** * Write the starting header for a class definition -- cgit v1.2.3 From ad8450209a553fd06540cd01ab29f936c0d0dc29 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 18 Feb 2016 23:07:01 -0500 Subject: TITANIC: Implement overall game saving code --- engines/titanic/compressed_file.h | 2 +- engines/titanic/objects/project_item.cpp | 55 +++++++++++++++++++++++++++++--- engines/titanic/objects/project_item.h | 31 ++++++++++++++++-- engines/titanic/objects/tree_item.cpp | 28 ++++++++++++++++ engines/titanic/objects/tree_item.h | 53 ++++++++++++++++++++++++++++++ 5 files changed, 160 insertions(+), 9 deletions(-) diff --git a/engines/titanic/compressed_file.h b/engines/titanic/compressed_file.h index 56e2c23343..cd9cf8377d 100644 --- a/engines/titanic/compressed_file.h +++ b/engines/titanic/compressed_file.h @@ -68,7 +68,7 @@ private: int sub1(Method3Fn fn, int v); - void sub2(); + void sub2() {} public: Decompressor(); diff --git a/engines/titanic/objects/project_item.cpp b/engines/titanic/objects/project_item.cpp index 90f85d97b9..e75f0e01e9 100644 --- a/engines/titanic/objects/project_item.cpp +++ b/engines/titanic/objects/project_item.cpp @@ -27,7 +27,15 @@ namespace Titanic { -void CProjectItem::load(int id) { +void CProjectItem::save(SimpleFile *file, int indent) const { + error("TODO"); +} + +void CProjectItem::load(SimpleFile *file) { + error("TODO"); +} + +void CProjectItem::loadGame(int slotId) { CompressedFile file; Common::InSaveFile *saveFile = nullptr; @@ -35,16 +43,28 @@ void CProjectItem::load(int id) { clear(); // Open either an existing savegame slot or the new game template - if (id > 0) { + if (slotId > 0) { saveFile = g_system->getSavefileManager()->openForLoading( - Common::String::format("slot%d.gam", id)); + Common::String::format("slot%d.gam", slotId)); file.open(saveFile); } else { file.open("newgame.st"); } // Load the contents in - loadData(file); + loadData(&file); + + file.close(); +} + +void CProjectItem::saveGame(int slotId) { + CompressedFile file; + Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving( + Common::String::format("slot%d.gam", slotId)); + file.open(saveFile); + + // Save the contents out + saveData(&file, this); file.close(); } @@ -53,8 +73,33 @@ void CProjectItem::clear() { } -void CProjectItem::loadData(SimpleFile &file) { +void CProjectItem::loadData(SimpleFile *file) { } +void CProjectItem::saveData(SimpleFile *file, CTreeItem *item) const { + while (item) { + item->saveHeader(file, 0); + item->save(file, 1); + item->saveFooter(file, 0); + + + CTreeItem *child = item->getFirstChild(); + if (child) { + file->write("\n{\n", 3); + file->writeQuotedString("DOWN"); + file->write("\n}\n", 3); + saveData(file, child); + file->write("\n{\n", 3); + file->writeQuotedString("UP"); + } else { + file->write("\n{\n", 3); + file->writeQuotedString("ALONG"); + } + + file->write("\n}\n", 3); + item = item->getNextSibling(); + } +} + } // End of namespace Titanic diff --git a/engines/titanic/objects/project_item.h b/engines/titanic/objects/project_item.h index 93f6e17ef0..6277af85c3 100644 --- a/engines/titanic/objects/project_item.h +++ b/engines/titanic/objects/project_item.h @@ -34,12 +34,37 @@ private: /** * Load project data from the passed file */ - void loadData(SimpleFile &file); + void loadData(SimpleFile *file); + + /** + * Save project data to the passed file + */ + void saveData(SimpleFile *file, CTreeItem *item) const; public: /** - * Load the entire project data for a given Id + * Return the class name + */ + virtual const char *getClassName() const { return "CProjectItem"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); + + /** + * Load the entire project data for a given slot Id + */ + void loadGame(int slotId); + + /** + * Save the entire project data to a given savegame slot */ - void load(int id); + void saveGame(int slotId); /** * Clear any currently loaded project diff --git a/engines/titanic/objects/tree_item.cpp b/engines/titanic/objects/tree_item.cpp index 06128ce354..dcd0e4606f 100644 --- a/engines/titanic/objects/tree_item.cpp +++ b/engines/titanic/objects/tree_item.cpp @@ -24,4 +24,32 @@ namespace Titanic { +CTreeItem::CTreeItem() : _parent(nullptr), _firstChild(nullptr), + _nextSibling(nullptr), _priorSibling(nullptr), _field14(0) { +} + +void CTreeItem::save(SimpleFile *file, int indent) const { + file->writeNumberLine(0, indent); + CMessageTarget::save(file, indent); +} + +void CTreeItem::load(SimpleFile *file) { + file->readNumber(); + CMessageTarget::load(file); +} + +CTreeItem *CTreeItem::getLastSibling() { + CTreeItem *item = this; + while (item->getNextSibling()) + item = item->getNextSibling(); + + return item; +} + +CTreeItem *CTreeItem::getLastChild() { + if (!_firstChild) + return nullptr; + return _firstChild->getLastSibling(); +} + } // End of namespace Titanic diff --git a/engines/titanic/objects/tree_item.h b/engines/titanic/objects/tree_item.h index 170a0e905d..454c3ca8ca 100644 --- a/engines/titanic/objects/tree_item.h +++ b/engines/titanic/objects/tree_item.h @@ -28,6 +28,59 @@ namespace Titanic { class CTreeItem: public CMessageTarget { +private: + CTreeItem *_parent; + CTreeItem *_nextSibling; + CTreeItem *_priorSibling; + CTreeItem *_firstChild; + int _field14; +public: + CTreeItem(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CTreeItem"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); + + /** + * Get the parent for the given item + */ + CTreeItem *getParent() const { return _parent; } + + /** + * Get the next sibling + */ + CTreeItem *getNextSibling() { return _nextSibling; } + + /** + * Get the prior sibling + */ + CTreeItem *getPriorSibling() { return _priorSibling; } + + /** + * Get the last sibling of this sibling + */ + CTreeItem *getLastSibling(); + + /** + * Get the first child of the item, if any + */ + CTreeItem *getFirstChild() { return _firstChild; } + + /** + * Get the last child of the item, if any + */ + CTreeItem *getLastChild(); }; } // End of namespace Titanic -- cgit v1.2.3 From 8c9a1c2159251570185de73a7c90003e863f3c7e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 19 Feb 2016 19:45:17 -0500 Subject: TITANIC: Implementing CProjectItem::loadData --- engines/titanic/objects/project_item.cpp | 48 +++++++++++++++++++++++++++++++- engines/titanic/objects/project_item.h | 4 ++- engines/titanic/objects/tree_item.cpp | 28 +++++++++++++++++++ engines/titanic/objects/tree_item.h | 15 ++++++++++ 4 files changed, 93 insertions(+), 2 deletions(-) diff --git a/engines/titanic/objects/project_item.cpp b/engines/titanic/objects/project_item.cpp index e75f0e01e9..599af89057 100644 --- a/engines/titanic/objects/project_item.cpp +++ b/engines/titanic/objects/project_item.cpp @@ -73,8 +73,54 @@ void CProjectItem::clear() { } -void CProjectItem::loadData(SimpleFile *file) { +CProjectItem *CProjectItem::loadData(SimpleFile *file) { + if (!file->IsClassStart()) + return nullptr; + + CProjectItem *root = nullptr; + CTreeItem *parent = nullptr; + CTreeItem *item = nullptr; + + do { + CString entryString = file->readString(); + + if (entryString == "ALONG") { + // Move along, nothing needed + } else if (entryString == "UP") { + // Move up + if (parent == nullptr || + (parent = parent->getParent()) == nullptr) + break; + } else if (entryString == "DOWN") { + // Move down + if (parent == nullptr) + parent = item; + else + parent = parent->getLastChild(); + } else { + // Create new class instance + item = dynamic_cast(CSaveableObject::createInstance(entryString)); + assert(item); + + if (root) { + // Already created root project + item->addUnder(parent); + } else { + // TODO: Validate this is correct + root = dynamic_cast(item); + assert(root); + + _filename = root->_filename; + } + + // Load the data for the item + item->load(file); + } + + file->IsClassStart(); + } while (file->IsClassStart()); + return root; } void CProjectItem::saveData(SimpleFile *file, CTreeItem *item) const { diff --git a/engines/titanic/objects/project_item.h b/engines/titanic/objects/project_item.h index 6277af85c3..60fee9b912 100644 --- a/engines/titanic/objects/project_item.h +++ b/engines/titanic/objects/project_item.h @@ -30,11 +30,13 @@ namespace Titanic { class CProjectItem : public CFileItem { +private: + CString _filename; private: /** * Load project data from the passed file */ - void loadData(SimpleFile *file); + CProjectItem *loadData(SimpleFile *file); /** * Save project data to the passed file diff --git a/engines/titanic/objects/tree_item.cpp b/engines/titanic/objects/tree_item.cpp index dcd0e4606f..bf0ae3e735 100644 --- a/engines/titanic/objects/tree_item.cpp +++ b/engines/titanic/objects/tree_item.cpp @@ -52,4 +52,32 @@ CTreeItem *CTreeItem::getLastChild() { return _firstChild->getLastSibling(); } +void CTreeItem::addUnder(CTreeItem *newParent) { + if (newParent->_firstChild) + addSibling(newParent->getLastSibling()); + else + setParent(newParent); +} + +void CTreeItem::setParent(CTreeItem *newParent) { + _parent = newParent; + _priorSibling = nullptr; + _nextSibling = newParent->_firstChild; + + if (newParent->_firstChild) + newParent->_firstChild->_priorSibling = this; + newParent->_firstChild = this; +} + +void CTreeItem::addSibling(CTreeItem *item) { + _priorSibling = item->_nextSibling; + _nextSibling = item->_nextSibling; + _parent = item->_parent; + + if (item->_nextSibling) + item->_nextSibling->_priorSibling = this; + item->_nextSibling = this; +} + + } // End of namespace Titanic diff --git a/engines/titanic/objects/tree_item.h b/engines/titanic/objects/tree_item.h index 454c3ca8ca..d3c1d34911 100644 --- a/engines/titanic/objects/tree_item.h +++ b/engines/titanic/objects/tree_item.h @@ -81,6 +81,21 @@ public: * Get the last child of the item, if any */ CTreeItem *getLastChild(); + + /** + * Adds the item under another tree item + */ + void addUnder(CTreeItem *newParent); + + /** + * Sets the parent for the item + */ + void setParent(CTreeItem *newParent); + + /** + * Adds the item as a sibling of another item + */ + void addSibling(CTreeItem *item); }; } // End of namespace Titanic -- cgit v1.2.3 From ed5ae8412dee5cadef806ad83a049ac1bc85ec4d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 20 Feb 2016 19:27:26 -0500 Subject: CREATE_PROJECT: Disable fluidsynth library by default for Visual Studio Currently we don't have a lib file for fluidsynth built for Visual Studio 2015, and I've spent 5 fruitless hours trying to compile one. So I'm disabling fluidsynth automatically for now, and we can always re-enable it again if we ever do manage to create an appropriate library --- dists/msvc14/create_msvc14.bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dists/msvc14/create_msvc14.bat b/dists/msvc14/create_msvc14.bat index 7082ac9680..4a16c43c45 100644 --- a/dists/msvc14/create_msvc14.bat +++ b/dists/msvc14/create_msvc14.bat @@ -55,14 +55,14 @@ goto done echo. echo Creating project files with all engines enabled (stable and unstable) echo. -create_project ..\.. --enable-all-engines --msvc --msvc-version 14 --build-events +create_project ..\.. --enable-all-engines --disable-fluidsynth --msvc --msvc-version 14 --build-events goto done :stable echo. echo Creating normal project files, with only the stable engines enabled echo. -create_project ..\.. --msvc --msvc-version 14 +create_project ..\.. --disable-fluidsynth --msvc --msvc-version 14 goto done :tools -- cgit v1.2.3 From f8c6724112d9b6161a0df8ee31d98d13b36d2b40 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 21 Feb 2016 21:35:55 -0500 Subject: TITANIC: Fleshed out CompressedFile class --- engines/titanic/compressed_file.cpp | 168 +++++++++++++++++------------------ engines/titanic/compressed_file.h | 65 +++----------- engines/titanic/compression.cpp | 142 +++++++++++++++++++++++++++++ engines/titanic/compression.h | 106 ++++++++++++++++++++++ engines/titanic/main_game_window.cpp | 3 + engines/titanic/module.mk | 1 + engines/titanic/screen_manager.cpp | 2 +- engines/titanic/screen_manager.h | 4 +- 8 files changed, 349 insertions(+), 142 deletions(-) create mode 100644 engines/titanic/compression.cpp create mode 100644 engines/titanic/compression.h diff --git a/engines/titanic/compressed_file.cpp b/engines/titanic/compressed_file.cpp index ea760167d7..c200370eae 100644 --- a/engines/titanic/compressed_file.cpp +++ b/engines/titanic/compressed_file.cpp @@ -24,82 +24,16 @@ namespace Titanic { -DecompressorData::DecompressorData() { - _field0 = 0; - _field4 = 0; - _field8 = 0; - _fieldC = 0; - _field10 = 0; - _field14 = 0; -} - -/*------------------------------------------------------------------------*/ - -Decompressor::Decompressor() { - _createFn = nullptr; - _destroyFn = nullptr; - _field18 = 0; - _dataPtr = nullptr; - _field28 = 0; -} - -void Decompressor::load(const char *version, int v) { - if (!version || *version != '1') - error("Bad version"); - - _field18 = 0; - if (!_createFn) { - _createFn = &Decompressor::createMethod; - _field28 = 0; - } - - if (!_destroyFn) { - _destroyFn = &Decompressor::destroyMethod; - } - - _dataPtr = (this->*_createFn)(_field28, 1, 24); - _dataPtr->_field14 = 0; - _dataPtr->_fieldC = 0; - if (v < 0) { - v = -v; - _dataPtr->_fieldC = 1; - } - - if (v < 8 || v > 15) - error("Bad parameter"); - - _dataPtr->_field10 = v; - _dataPtr->_field14 = sub1(_dataPtr->_fieldC ? nullptr : &Decompressor::method3, 1 << v); - - if (_dataPtr->_field14) - sub2(); - else - close(); -} - -int Decompressor::sub1(Method3Fn fn, int v) { - return 0; -} - -void Decompressor::close() { - -} - -DecompressorData *Decompressor::createMethod(int v1, int v2, int v3) { - return new DecompressorData(); -} - -void Decompressor::destroyMethod(DecompressorData *ptr) { - delete ptr; -} - -/*------------------------------------------------------------------------*/ +#define BUFFER_SIZE 1024 CompressedFile::CompressedFile() : SimpleFile() { - _fileMode = 0; - _isReading = 0; - _field260 = 0; - _mode = 0; + _fileMode = COMPMODE_NONE; + Common::fill(&_writeBuffer[0], &_writeBuffer[516], 0); + _dataStartPtr = nullptr; + _dataPtr = nullptr; + _dataRemaining = 0; + _dataMaxSize = 0; + _dataCount = 0; } CompressedFile::~CompressedFile() { @@ -108,27 +42,58 @@ CompressedFile::~CompressedFile() { void CompressedFile::open(const Common::String &name) { SimpleFile::open(name); - _decompressor.load(); - _fileMode = 2; + _compression.initDecompress(); + _fileMode = COMPMODE_READ; + _dataPtr = _dataStartPtr = new byte[BUFFER_SIZE]; + _dataMaxSize = BUFFER_SIZE; + _dataRemaining = 0; + _dataCount = 0; } void CompressedFile::open(Common::SeekableReadStream *stream) { SimpleFile::open(stream); - _decompressor.load(); - _fileMode = 2; + _compression.initDecompress(); + _fileMode = COMPMODE_READ; + _dataPtr = _dataStartPtr = new byte[BUFFER_SIZE]; + _dataMaxSize = BUFFER_SIZE; + _dataRemaining = 0; + _dataCount = 0; } void CompressedFile::open(Common::OutSaveFile *stream) { SimpleFile::open(stream); - _decompressor.load(); - _fileMode = 1; + _compression.initCompress(); + _fileMode = COMPMODE_WRITE; } void CompressedFile::close() { - _queue.clear(); - SimpleFile::close(); + int result; + + switch (_fileMode) { + case COMPMODE_WRITE: + do { + _compression._destPtr = _writeBuffer; + _compression._destCount = 512; + result = _compression.compress(4); + int count = 512 - _compression._destCount; + + if (count) + write(_writeBuffer, count); + } while (!result); + break; + case COMPMODE_READ: + _compression.close(); + delete[] _dataStartPtr; + _dataStartPtr = _dataPtr = nullptr; + _dataRemaining = _dataMaxSize = 0; + + SimpleFile::close(); + break; + default: + break; + } } size_t CompressedFile::unsafeRead(void *dst, size_t count) { @@ -144,22 +109,51 @@ size_t CompressedFile::unsafeRead(void *dst, size_t count) { byte *dataPtr = (byte *)dst; while (count > 0) { - if (_queue.empty()) { + if (!_dataRemaining) { decompress(); - if (_queue.empty()) + if (!_dataRemaining) break; } - *dataPtr++ = _queue.pop(); - ++bytesRead; - --count; + *dataPtr++ = *_dataPtr++; + --_dataRemaining; } return bytesRead; } void CompressedFile::decompress() { + const size_t COUNT = 1; + byte fileByte; + int count; + + _dataPtr = _dataStartPtr; + _compression._destPtr = _dataStartPtr; + _compression._destCount = _dataMaxSize; + + if (_dataMaxSize < 0x100) + return; + + // Loop to get data from the file as needed and decompress + do { + if (!_compression._srcCount) { + // Read in next byte from the source file + if (!SimpleFile::unsafeRead(&fileByte, 1)) + break; + // Set up the decompressor to process the data + _compression._srcCount = COUNT; + _compression._srcPtr = &fileByte; + } + + int count = _compression.decompress(COUNT); + _dataRemaining = _dataMaxSize - _compression._destCount; + + if (count == COUNT) { + _dataCount = COUNT; + break; + } + } while (!count && _compression._destCount > 0x100); } } // End of namespace Titanic diff --git a/engines/titanic/compressed_file.h b/engines/titanic/compressed_file.h index cd9cf8377d..30b925d9b6 100644 --- a/engines/titanic/compressed_file.h +++ b/engines/titanic/compressed_file.h @@ -25,66 +25,27 @@ #include "common/scummsys.h" #include "common/file.h" -#include "common/queue.h" +#include "titanic/compression.h" #include "titanic/simple_file.h" #include "titanic/string.h" namespace Titanic { -class Decompressor; -class DecompressorData; - -typedef DecompressorData *(Decompressor::*DecompressorCreateFn)(int v1, int v2, int v3); -typedef void(Decompressor::*DecompressorDestroyFn)(DecompressorData *ptr); -typedef void(Decompressor::*Method3Fn)(); - -class DecompressorData { -public: - int _field0; - int _field4; - int _field8; - int _fieldC; - int _field10; - int _field14; -public: - DecompressorData(); -}; - -class Decompressor { -private: - DecompressorCreateFn _createFn; - DecompressorDestroyFn _destroyFn; - int _field18; - DecompressorData *_dataPtr; - int _field28; - - DecompressorData *createMethod(int v1, int v2, int v3); - - void destroyMethod(DecompressorData *ptr); - - void method3() { - // TODO - } - - int sub1(Method3Fn fn, int v); - - void sub2() {} -public: - Decompressor(); - - void load(const char *version = "1.0.4", int v = 15); - - void close(); -}; +enum CompressedFileMode { COMPMODE_NONE, COMPMODE_WRITE, COMPMODE_READ }; +/** + * Derived file that handles compressed files + */ class CompressedFile : public SimpleFile { private: - Decompressor _decompressor; - Common::Queue _queue; - int _fileMode; - int _isReading; - int _field260; - int _mode; + Compression _compression; + CompressedFileMode _fileMode; + byte _writeBuffer[516]; + byte *_dataStartPtr; + byte *_dataPtr; + int _dataRemaining; + int _dataMaxSize; + int _dataCount; /** * Decompress data from the source file diff --git a/engines/titanic/compression.cpp b/engines/titanic/compression.cpp new file mode 100644 index 0000000000..9dad905370 --- /dev/null +++ b/engines/titanic/compression.cpp @@ -0,0 +1,142 @@ +/* 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 "titanic/compression.h" +#include "common/textconsole.h" + +namespace Titanic { + +CompressionData::CompressionData() { + _commandNum = 0; + _field4 = 0; + _field8 = 0; + _fieldC = 0; + _field10 = 0; + _field14 = 0; +} + +/*------------------------------------------------------------------------*/ + +Compression::Compression() { + _srcPtr = nullptr; + _srcCount = 0; + _field8 = 0; + _destPtr = nullptr; + _destCount = 0; + _field14 = 0; + _field18 = 0; + _compressionData = nullptr; + _createFn = nullptr; + _destroyFn = nullptr; + _field28 = 0; + _field2C = 0; + _field30 = 0; + _field34 = 0; +} + +Compression::~Compression() { + close(); +} + +void Compression::initDecompress(const char *version, int v) { + if (!version || *version != '1') + error("Bad version"); + + _field18 = 0; + if (!_createFn) { + _createFn = &Compression::createMethod; + _field28 = 0; + } + + if (!_destroyFn) { + _destroyFn = &Compression::destroyMethod; + } + + _compressionData = (this->*_createFn)(_field28, 1); + _compressionData->_field14 = 0; + _compressionData->_fieldC = 0; + if (v < 0) { + v = -v; + _compressionData->_fieldC = 1; + } + + if (v < 8 || v > 15) + error("Bad parameter"); + + _compressionData->_field10 = v; + _compressionData->_field14 = sub1(_compressionData->_fieldC ? nullptr : &Compression::method3, 1 << v); + + if (_compressionData->_field14) + sub2(); + else + close(); +} + +void Compression::initCompress(const char *version, int v) { + error("TODO"); +} + + +int Compression::sub1(Method3Fn fn, int v) { + return 0; +} + +void Compression::close() { + if (_destroyFn) + (this->*_destroyFn)(_compressionData); +} + +CompressionData *Compression::createMethod(int v1, int v2) { + return new CompressionData(); +} + +void Compression::destroyMethod(CompressionData *ptr) { + delete ptr; +} + +int Compression::compress(int v) { + return 0; +} + +int Compression::decompress(size_t count) { +/* + if (!_compressionData || !_srcPtr || !count) + // Needed fields aren't set + return -2; + + int result = -5; + do { + int ebx = 5; + + switch (_compressionData->_commandNum) { + case 0: + if (_compressionData->_field4) + return result; + + default: + return -2; + } + }*/ + return -2; +} + +} // End of namespace Titanic diff --git a/engines/titanic/compression.h b/engines/titanic/compression.h new file mode 100644 index 0000000000..6d3a5b9ac2 --- /dev/null +++ b/engines/titanic/compression.h @@ -0,0 +1,106 @@ +/* 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. + * + */ + +#ifndef TITANIC_COMPRESSION_H +#define TITANIC_COMPRESSION_H + +#include "common/scummsys.h" + +namespace Titanic { + +class Compression; +class CompressionData; + +typedef CompressionData *(Compression::*CompressionCreateFn)(int v1, int v2); +typedef void(Compression::*CompressionDestroyFn)(CompressionData *ptr); +typedef void(Compression::*Method3Fn)(); + +class CompressionData { +public: + int _commandNum; + int _field4; + int _field8; + int _fieldC; + int _field10; + int _field14; +public: + CompressionData(); +}; + +class Compression { +private: + CompressionData *createMethod(int v1, int v2); + + void destroyMethod(CompressionData *ptr); + + void method3() { + // TODO + } + + int sub1(Method3Fn fn, int v); + + void sub2() {} +public: + byte *_srcPtr; + int _srcCount; + int _field8; + byte *_destPtr; + int _destCount; + int _field14; + int _field18; + CompressionData *_compressionData; + CompressionCreateFn _createFn; + CompressionDestroyFn _destroyFn; + int _field28; + int _field2C; + int _field30; + int _field34; +public: + Compression(); + ~Compression(); + + /** + * Initialize for decompression + */ + void initDecompress(const char *version = "1.0.4", int v = 15); + + /** + * Initialize for compression + */ + void initCompress(const char *version = "1.0.4", int v = -1); + + void close(); + + /** + * Compress data + */ + int compress(int v); + + /** + * Decompress data + */ + int decompress(size_t count); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_COMPRESSION_H */ diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 9087cafb80..78e07e9af2 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -39,6 +39,9 @@ bool CMainGameWindow::Create() { bool result = image.loadResource("TITANIC"); if (!result) return true; + + // TODO: Stuff + return true; } } // End of namespace Titanic diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index abd351250d..7d126b4094 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -2,6 +2,7 @@ MODULE := engines/titanic MODULE_OBJS := \ compressed_file.o \ + compression.o \ detection.o \ direct_draw.o \ font.o \ diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp index 61b6ff4762..08262dfd61 100644 --- a/engines/titanic/screen_manager.cpp +++ b/engines/titanic/screen_manager.cpp @@ -70,7 +70,7 @@ OSScreenManager::~OSScreenManager() { destroyFrontAndBackBuffers(); } -void OSScreenManager::setMode(int width, int height, int bpp, int numBackSurfaces, bool flag2) { +void OSScreenManager::setMode(int width, int height, int bpp, uint numBackSurfaces, bool flag2) { destroyFrontAndBackBuffers(); _directDrawManager.initVideo(width, height, bpp, numBackSurfaces); diff --git a/engines/titanic/screen_manager.h b/engines/titanic/screen_manager.h index 4647c71c81..4836bb33fc 100644 --- a/engines/titanic/screen_manager.h +++ b/engines/titanic/screen_manager.h @@ -67,7 +67,7 @@ public: virtual void setWindowHandle(int v); virtual bool resetWindowHandle(int v); - virtual void setMode(int width, int height, int bpp, int numBackSurfaces, bool flag2) = 0; + virtual void setMode(int width, int height, int bpp, uint numBackSurfaces, bool flag2) = 0; virtual void proc5() = 0; virtual void proc6() = 0; virtual void proc7() = 0; @@ -116,7 +116,7 @@ public: OSScreenManager(TitanicEngine *vm); virtual ~OSScreenManager(); - virtual void setMode(int width, int height, int bpp, int numBackSurfaces, bool flag2); + virtual void setMode(int width, int height, int bpp, uint numBackSurfaces, bool flag2); virtual void proc5(); virtual void proc6(); virtual void proc7(); -- cgit v1.2.3 From 6bee18dec1578ee37f3c25d91dfd60e00cd063c7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 21 Feb 2016 23:05:16 -0500 Subject: TITANIC: Implement bulk of overall decompression method --- engines/titanic/compression.cpp | 165 ++++++++++++++++++++++++++++++++++++++-- engines/titanic/compression.h | 2 +- 2 files changed, 158 insertions(+), 9 deletions(-) diff --git a/engines/titanic/compression.cpp b/engines/titanic/compression.cpp index 9dad905370..0c12ee089f 100644 --- a/engines/titanic/compression.cpp +++ b/engines/titanic/compression.cpp @@ -43,7 +43,7 @@ Compression::Compression() { _destPtr = nullptr; _destCount = 0; _field14 = 0; - _field18 = 0; + _errorMessage = nullptr; _compressionData = nullptr; _createFn = nullptr; _destroyFn = nullptr; @@ -61,7 +61,7 @@ void Compression::initDecompress(const char *version, int v) { if (!version || *version != '1') error("Bad version"); - _field18 = 0; + _errorMessage = nullptr; if (!_createFn) { _createFn = &Compression::createMethod; _field28 = 0; @@ -118,25 +118,174 @@ int Compression::compress(int v) { } int Compression::decompress(size_t count) { -/* if (!_compressionData || !_srcPtr || !count) // Needed fields aren't set return -2; int result = -5; - do { - int ebx = 5; + int ebx = 5; + uint v; + for (;;) { switch (_compressionData->_commandNum) { case 0: - if (_compressionData->_field4) + if (!_srcCount) return result; + result = 0; + --_srcCount; + ++_field8; + _compressionData->_field4 = *_srcPtr++; + + if ((_compressionData->_field4 & 0xf) == 8) { + _compressionData->_commandNum = 13; + _compressionData->_field4 = ebx; + _errorMessage = "unknown compression method"; + } else { + if ((_compressionData->_field4 / 16 + 8) > _compressionData->_field10) { + _compressionData->_commandNum = 13; + _compressionData->_field4 = ebx; + _errorMessage = "invalid window size"; + } else { + _compressionData->_commandNum = 1; + } + } + break; + + case 1: + if (!_srcCount) + return result; + + result = 0; + --_srcCount; + ++_field8; + v = *_srcPtr++; + if ((_compressionData->_field4 * 256 + v) % 31) { + _compressionData->_commandNum = 13; + _compressionData->_field4 = ebx; + ebx = 5; + _errorMessage = "incorrect header check"; + } else if (!(v & 0x20)) { + _compressionData->_commandNum = 7; + ebx = 5; + } else { + _compressionData->_commandNum = 2; + ebx = 5; + } + break; + + case 2: + if (!_srcCount) + return result; + + result = 0; + --_srcCount; + ++_field8; + _compressionData->_field8 = (uint)*_srcPtr++ << 24; + _compressionData->_commandNum = 3; + break; + + case 3: + if (!_srcCount) + return result; + + result = 0; + --_srcCount; + ++_field8; + _compressionData->_field8 += (uint)*_srcPtr++ << 16; + _compressionData->_commandNum = 4; + break; + + case 4: + if (!_srcCount) + return result; + + result = 0; + --_srcCount; + ++_field8; + _compressionData->_field8 = (uint)*_srcPtr++ << 8; + _compressionData->_commandNum = ebx; + break; + + case 5: + if (!_srcCount) + return result; + + --_srcCount; + ++_field8; + _compressionData->_field8 += *_srcPtr++; + _compressionData->_commandNum = ebx; + _field30 = _compressionData->_field8; + _compressionData->_commandNum = 6; + return 2; + + case 6: + _compressionData->_commandNum = 13; + _compressionData->_field4 = 0; + _errorMessage = "need dictionary"; + return -2; + + case 7: + error("TODO"); + break; + + case 8: + if (!_srcCount) + return result; + + --_srcCount; + ++_field8; + _compressionData->_field8 += *_srcPtr++ << 24; + _compressionData->_commandNum = 9; + break; + + case 9: + if (!_srcCount) + return result; + + --_srcCount; + ++_field8; + _compressionData->_field8 += *_srcPtr++ << 16; + _compressionData->_commandNum = 10; + break; + + case 10: + if (!_srcCount) + return result; + + --_srcCount; + ++_field8; + _compressionData->_field8 += *_srcPtr++ << 8; + _compressionData->_commandNum = 11; + break; + + case 11: + if (!_srcCount) + return result; + + --_srcCount; + ++_field8; + _compressionData->_field8 += *_srcPtr++ << 8; + + if (_compressionData->_field4 == _compressionData->_field8) { + _compressionData->_commandNum = 12; + } else { + _compressionData->_commandNum = 13; + _compressionData->_field4 = ebx; + _errorMessage = "incorrect data check"; + } + break; + + case 12: + return 1; + + case 13: + return -3; + default: return -2; } - }*/ - return -2; + } } } // End of namespace Titanic diff --git a/engines/titanic/compression.h b/engines/titanic/compression.h index 6d3a5b9ac2..fb784ce031 100644 --- a/engines/titanic/compression.h +++ b/engines/titanic/compression.h @@ -66,7 +66,7 @@ public: byte *_destPtr; int _destCount; int _field14; - int _field18; + const char *_errorMessage; CompressionData *_compressionData; CompressionCreateFn _createFn; CompressionDestroyFn _destroyFn; -- cgit v1.2.3 From 29215ff3647b5ed2e5ccc40fd7534b0070edd62b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 22 Feb 2016 08:04:11 -0500 Subject: TITANIC: Change CompressedFile to use common/zlib.h --- engines/titanic/compressed_file.cpp | 115 ++------------ engines/titanic/compressed_file.h | 25 ++-- engines/titanic/compression.cpp | 291 ------------------------------------ engines/titanic/compression.h | 106 ------------- engines/titanic/simple_file.cpp | 5 - engines/titanic/simple_file.h | 5 - 6 files changed, 24 insertions(+), 523 deletions(-) delete mode 100644 engines/titanic/compression.cpp delete mode 100644 engines/titanic/compression.h diff --git a/engines/titanic/compressed_file.cpp b/engines/titanic/compressed_file.cpp index c200370eae..d0cd37671a 100644 --- a/engines/titanic/compressed_file.cpp +++ b/engines/titanic/compressed_file.cpp @@ -27,13 +27,8 @@ namespace Titanic { #define BUFFER_SIZE 1024 CompressedFile::CompressedFile() : SimpleFile() { - _fileMode = COMPMODE_NONE; - Common::fill(&_writeBuffer[0], &_writeBuffer[516], 0); - _dataStartPtr = nullptr; - _dataPtr = nullptr; - _dataRemaining = 0; - _dataMaxSize = 0; - _dataCount = 0; + _readStream = nullptr; + _writeStream = nullptr; } CompressedFile::~CompressedFile() { @@ -41,119 +36,39 @@ CompressedFile::~CompressedFile() { void CompressedFile::open(const Common::String &name) { SimpleFile::open(name); - - _compression.initDecompress(); - _fileMode = COMPMODE_READ; - _dataPtr = _dataStartPtr = new byte[BUFFER_SIZE]; - _dataMaxSize = BUFFER_SIZE; - _dataRemaining = 0; - _dataCount = 0; + _readStream = Common::wrapCompressedReadStream(&_file); } void CompressedFile::open(Common::SeekableReadStream *stream) { SimpleFile::open(stream); - - _compression.initDecompress(); - _fileMode = COMPMODE_READ; - _dataPtr = _dataStartPtr = new byte[BUFFER_SIZE]; - _dataMaxSize = BUFFER_SIZE; - _dataRemaining = 0; - _dataCount = 0; + _readStream = Common::wrapCompressedReadStream(&_file); } void CompressedFile::open(Common::OutSaveFile *stream) { SimpleFile::open(stream); - - _compression.initCompress(); - _fileMode = COMPMODE_WRITE; + _writeStream = Common::wrapCompressedWriteStream(stream); } void CompressedFile::close() { - int result; - - switch (_fileMode) { - case COMPMODE_WRITE: - do { - _compression._destPtr = _writeBuffer; - _compression._destCount = 512; - result = _compression.compress(4); - int count = 512 - _compression._destCount; + delete _readStream; + delete _writeStream; + _readStream = nullptr; + _writeStream = nullptr; - if (count) - write(_writeBuffer, count); - } while (!result); - break; - case COMPMODE_READ: - _compression.close(); - delete[] _dataStartPtr; - _dataStartPtr = _dataPtr = nullptr; - _dataRemaining = _dataMaxSize = 0; - - SimpleFile::close(); - break; - default: - break; - } + SimpleFile::close(); } size_t CompressedFile::unsafeRead(void *dst, size_t count) { - assert(_file.isOpen()); + assert(_readStream); if (count == 0) return 0; - // Ensure there's enough data queued in the buffer - decompress(); - - // Pass the data to the output buffer - size_t bytesRead = 0; - byte *dataPtr = (byte *)dst; - - while (count > 0) { - if (!_dataRemaining) { - decompress(); - if (!_dataRemaining) - break; - } - - *dataPtr++ = *_dataPtr++; - --_dataRemaining; - } - - return bytesRead; + // Read data and decompress + return _readStream->read(dst, count); } -void CompressedFile::decompress() { - const size_t COUNT = 1; - byte fileByte; - int count; - - _dataPtr = _dataStartPtr; - _compression._destPtr = _dataStartPtr; - _compression._destCount = _dataMaxSize; - - if (_dataMaxSize < 0x100) - return; - - // Loop to get data from the file as needed and decompress - do { - if (!_compression._srcCount) { - // Read in next byte from the source file - if (!SimpleFile::unsafeRead(&fileByte, 1)) - break; - - // Set up the decompressor to process the data - _compression._srcCount = COUNT; - _compression._srcPtr = &fileByte; - } - - int count = _compression.decompress(COUNT); - _dataRemaining = _dataMaxSize - _compression._destCount; - - if (count == COUNT) { - _dataCount = COUNT; - break; - } - } while (!count && _compression._destCount > 0x100); +size_t CompressedFile::write(const void *src, size_t count) { + return _writeStream->write(src, count); } } // End of namespace Titanic diff --git a/engines/titanic/compressed_file.h b/engines/titanic/compressed_file.h index 30b925d9b6..4b1051be5c 100644 --- a/engines/titanic/compressed_file.h +++ b/engines/titanic/compressed_file.h @@ -25,32 +25,20 @@ #include "common/scummsys.h" #include "common/file.h" -#include "titanic/compression.h" +#include "common/memstream.h" +#include "common/zlib.h" #include "titanic/simple_file.h" #include "titanic/string.h" namespace Titanic { -enum CompressedFileMode { COMPMODE_NONE, COMPMODE_WRITE, COMPMODE_READ }; - /** * Derived file that handles compressed files */ class CompressedFile : public SimpleFile { private: - Compression _compression; - CompressedFileMode _fileMode; - byte _writeBuffer[516]; - byte *_dataStartPtr; - byte *_dataPtr; - int _dataRemaining; - int _dataMaxSize; - int _dataCount; - - /** - * Decompress data from the source file - */ - void decompress(); + Common::SeekableReadStream *_readStream; + Common::WriteStream *_writeStream; public: CompressedFile(); virtual ~CompressedFile(); @@ -79,6 +67,11 @@ public: * Read from the file */ virtual size_t unsafeRead(void *dst, size_t count); + + /** + * Write out data + */ + virtual size_t write(const void *src, size_t count); }; } // End of namespace Titanic diff --git a/engines/titanic/compression.cpp b/engines/titanic/compression.cpp deleted file mode 100644 index 0c12ee089f..0000000000 --- a/engines/titanic/compression.cpp +++ /dev/null @@ -1,291 +0,0 @@ -/* 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 "titanic/compression.h" -#include "common/textconsole.h" - -namespace Titanic { - -CompressionData::CompressionData() { - _commandNum = 0; - _field4 = 0; - _field8 = 0; - _fieldC = 0; - _field10 = 0; - _field14 = 0; -} - -/*------------------------------------------------------------------------*/ - -Compression::Compression() { - _srcPtr = nullptr; - _srcCount = 0; - _field8 = 0; - _destPtr = nullptr; - _destCount = 0; - _field14 = 0; - _errorMessage = nullptr; - _compressionData = nullptr; - _createFn = nullptr; - _destroyFn = nullptr; - _field28 = 0; - _field2C = 0; - _field30 = 0; - _field34 = 0; -} - -Compression::~Compression() { - close(); -} - -void Compression::initDecompress(const char *version, int v) { - if (!version || *version != '1') - error("Bad version"); - - _errorMessage = nullptr; - if (!_createFn) { - _createFn = &Compression::createMethod; - _field28 = 0; - } - - if (!_destroyFn) { - _destroyFn = &Compression::destroyMethod; - } - - _compressionData = (this->*_createFn)(_field28, 1); - _compressionData->_field14 = 0; - _compressionData->_fieldC = 0; - if (v < 0) { - v = -v; - _compressionData->_fieldC = 1; - } - - if (v < 8 || v > 15) - error("Bad parameter"); - - _compressionData->_field10 = v; - _compressionData->_field14 = sub1(_compressionData->_fieldC ? nullptr : &Compression::method3, 1 << v); - - if (_compressionData->_field14) - sub2(); - else - close(); -} - -void Compression::initCompress(const char *version, int v) { - error("TODO"); -} - - -int Compression::sub1(Method3Fn fn, int v) { - return 0; -} - -void Compression::close() { - if (_destroyFn) - (this->*_destroyFn)(_compressionData); -} - -CompressionData *Compression::createMethod(int v1, int v2) { - return new CompressionData(); -} - -void Compression::destroyMethod(CompressionData *ptr) { - delete ptr; -} - -int Compression::compress(int v) { - return 0; -} - -int Compression::decompress(size_t count) { - if (!_compressionData || !_srcPtr || !count) - // Needed fields aren't set - return -2; - - int result = -5; - int ebx = 5; - uint v; - - for (;;) { - switch (_compressionData->_commandNum) { - case 0: - if (!_srcCount) - return result; - - result = 0; - --_srcCount; - ++_field8; - _compressionData->_field4 = *_srcPtr++; - - if ((_compressionData->_field4 & 0xf) == 8) { - _compressionData->_commandNum = 13; - _compressionData->_field4 = ebx; - _errorMessage = "unknown compression method"; - } else { - if ((_compressionData->_field4 / 16 + 8) > _compressionData->_field10) { - _compressionData->_commandNum = 13; - _compressionData->_field4 = ebx; - _errorMessage = "invalid window size"; - } else { - _compressionData->_commandNum = 1; - } - } - break; - - case 1: - if (!_srcCount) - return result; - - result = 0; - --_srcCount; - ++_field8; - v = *_srcPtr++; - if ((_compressionData->_field4 * 256 + v) % 31) { - _compressionData->_commandNum = 13; - _compressionData->_field4 = ebx; - ebx = 5; - _errorMessage = "incorrect header check"; - } else if (!(v & 0x20)) { - _compressionData->_commandNum = 7; - ebx = 5; - } else { - _compressionData->_commandNum = 2; - ebx = 5; - } - break; - - case 2: - if (!_srcCount) - return result; - - result = 0; - --_srcCount; - ++_field8; - _compressionData->_field8 = (uint)*_srcPtr++ << 24; - _compressionData->_commandNum = 3; - break; - - case 3: - if (!_srcCount) - return result; - - result = 0; - --_srcCount; - ++_field8; - _compressionData->_field8 += (uint)*_srcPtr++ << 16; - _compressionData->_commandNum = 4; - break; - - case 4: - if (!_srcCount) - return result; - - result = 0; - --_srcCount; - ++_field8; - _compressionData->_field8 = (uint)*_srcPtr++ << 8; - _compressionData->_commandNum = ebx; - break; - - case 5: - if (!_srcCount) - return result; - - --_srcCount; - ++_field8; - _compressionData->_field8 += *_srcPtr++; - _compressionData->_commandNum = ebx; - _field30 = _compressionData->_field8; - _compressionData->_commandNum = 6; - return 2; - - case 6: - _compressionData->_commandNum = 13; - _compressionData->_field4 = 0; - _errorMessage = "need dictionary"; - return -2; - - case 7: - error("TODO"); - break; - - case 8: - if (!_srcCount) - return result; - - --_srcCount; - ++_field8; - _compressionData->_field8 += *_srcPtr++ << 24; - _compressionData->_commandNum = 9; - break; - - case 9: - if (!_srcCount) - return result; - - --_srcCount; - ++_field8; - _compressionData->_field8 += *_srcPtr++ << 16; - _compressionData->_commandNum = 10; - break; - - case 10: - if (!_srcCount) - return result; - - --_srcCount; - ++_field8; - _compressionData->_field8 += *_srcPtr++ << 8; - _compressionData->_commandNum = 11; - break; - - case 11: - if (!_srcCount) - return result; - - --_srcCount; - ++_field8; - _compressionData->_field8 += *_srcPtr++ << 8; - - if (_compressionData->_field4 == _compressionData->_field8) { - _compressionData->_commandNum = 12; - } else { - _compressionData->_commandNum = 13; - _compressionData->_field4 = ebx; - _errorMessage = "incorrect data check"; - } - break; - - case 12: - return 1; - - case 13: - return -3; - - default: - return -2; - } - } -} - -} // End of namespace Titanic diff --git a/engines/titanic/compression.h b/engines/titanic/compression.h deleted file mode 100644 index fb784ce031..0000000000 --- a/engines/titanic/compression.h +++ /dev/null @@ -1,106 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_COMPRESSION_H -#define TITANIC_COMPRESSION_H - -#include "common/scummsys.h" - -namespace Titanic { - -class Compression; -class CompressionData; - -typedef CompressionData *(Compression::*CompressionCreateFn)(int v1, int v2); -typedef void(Compression::*CompressionDestroyFn)(CompressionData *ptr); -typedef void(Compression::*Method3Fn)(); - -class CompressionData { -public: - int _commandNum; - int _field4; - int _field8; - int _fieldC; - int _field10; - int _field14; -public: - CompressionData(); -}; - -class Compression { -private: - CompressionData *createMethod(int v1, int v2); - - void destroyMethod(CompressionData *ptr); - - void method3() { - // TODO - } - - int sub1(Method3Fn fn, int v); - - void sub2() {} -public: - byte *_srcPtr; - int _srcCount; - int _field8; - byte *_destPtr; - int _destCount; - int _field14; - const char *_errorMessage; - CompressionData *_compressionData; - CompressionCreateFn _createFn; - CompressionDestroyFn _destroyFn; - int _field28; - int _field2C; - int _field30; - int _field34; -public: - Compression(); - ~Compression(); - - /** - * Initialize for decompression - */ - void initDecompress(const char *version = "1.0.4", int v = 15); - - /** - * Initialize for compression - */ - void initCompress(const char *version = "1.0.4", int v = -1); - - void close(); - - /** - * Compress data - */ - int compress(int v); - - /** - * Decompress data - */ - int decompress(size_t count); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_COMPRESSION_H */ diff --git a/engines/titanic/simple_file.cpp b/engines/titanic/simple_file.cpp index cf95aca269..521f9e9b99 100644 --- a/engines/titanic/simple_file.cpp +++ b/engines/titanic/simple_file.cpp @@ -74,11 +74,6 @@ size_t SimpleFile::write(const void *src, size_t count) { return _outStream->write(src, count); } -bool SimpleFile::eof() const { - assert(_inStream); - return _inStream->pos() >= _inStream->size(); -} - CString SimpleFile::readString() { char c; CString result; diff --git a/engines/titanic/simple_file.h b/engines/titanic/simple_file.h index 65b0ac6f31..852c75b0f7 100644 --- a/engines/titanic/simple_file.h +++ b/engines/titanic/simple_file.h @@ -79,11 +79,6 @@ public: */ virtual size_t write(const void *src, size_t count); - /** - * Return true if the end of the file has been reached - */ - bool eof() const; - /** * Read a string from the file */ -- cgit v1.2.3 From 572fc8fc9ee65ec29c346f00cb34da482dda8d90 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 22 Feb 2016 20:43:14 -0500 Subject: TITANIC: Implemented bulk of applicationStarting --- engines/titanic/game_manager.cpp | 32 +++++++++++++++++++ engines/titanic/game_manager.h | 43 ++++++++++++++++++++++++++ engines/titanic/game_view.cpp | 41 +++++++++++++++++++++++++ engines/titanic/game_view.h | 56 ++++++++++++++++++++++++++++++++++ engines/titanic/main_game_window.cpp | 36 ++++++++++++++++++++++ engines/titanic/main_game_window.h | 26 ++++++++++++++-- engines/titanic/module.mk | 2 ++ engines/titanic/objects/project_item.h | 5 +++ engines/titanic/screen_manager.cpp | 11 +++++++ engines/titanic/screen_manager.h | 8 ++++- 10 files changed, 256 insertions(+), 4 deletions(-) create mode 100644 engines/titanic/game_manager.cpp create mode 100644 engines/titanic/game_manager.h create mode 100644 engines/titanic/game_view.cpp create mode 100644 engines/titanic/game_view.h diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp new file mode 100644 index 0000000000..94e1ad3fb2 --- /dev/null +++ b/engines/titanic/game_manager.cpp @@ -0,0 +1,32 @@ +/* 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 "titanic/game_manager.h" + +namespace Titanic { + +CGameManager::CGameManager(CProjectItem *project, CGameView *gameView): + _project(project), _gameView(gameView) { + // TODO +} + +} // End of namespace Titanic diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h new file mode 100644 index 0000000000..0c1374e9a3 --- /dev/null +++ b/engines/titanic/game_manager.h @@ -0,0 +1,43 @@ +/* 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. + * + */ + +#ifndef TITANIC_GAME_MANAGER_H +#define TITANIC_GAME_MANAGER_H + +#include "common/scummsys.h" + +namespace Titanic { + +class CProjectItem; +class CGameView; + +class CGameManager { +private: + CProjectItem *_project; + CGameView *_gameView; +public: + CGameManager(CProjectItem *project, CGameView *gameView); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_GAME_MANAGER_H */ diff --git a/engines/titanic/game_view.cpp b/engines/titanic/game_view.cpp new file mode 100644 index 0000000000..d8410f1457 --- /dev/null +++ b/engines/titanic/game_view.cpp @@ -0,0 +1,41 @@ +/* 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 "titanic/game_view.h" +#include "titanic/game_manager.h" + +namespace Titanic { + +CGameView::CGameView() : _gameManager(nullptr), _field8(0), _fieldC(0) { +} + +void CGameView::setGameManager(CGameManager *gameManager) { + _gameManager = gameManager; +} + +/*------------------------------------------------------------------------*/ + +CTitanicGameView::CTitanicGameView(CMainGameWindow *gameWindow) : + CGameView(), _gameWindow(gameWindow) { +} + +} // End of namespace Titanic diff --git a/engines/titanic/game_view.h b/engines/titanic/game_view.h new file mode 100644 index 0000000000..588cf938e3 --- /dev/null +++ b/engines/titanic/game_view.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_GAME_VIEW_H +#define TITANIC_GAME_VIEW_H + +#include "common/scummsys.h" + +namespace Titanic { + +class CMainGameWindow; +class CGameManager; + +class CGameView { +protected: + CGameManager *_gameManager; + int _field8; + int _fieldC; +public: + CGameView(); + + /** + * Set the game manager + */ + void setGameManager(CGameManager *gameManager); +}; + +class CTitanicGameView: public CGameView { +private: + CMainGameWindow *_gameWindow; +public: + CTitanicGameView(CMainGameWindow *gameWindow); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_GAME_VIEW_H */ diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 78e07e9af2..41eb825543 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -22,6 +22,8 @@ #include "titanic/titanic.h" #include "titanic/main_game_window.h" +#include "titanic/game_manager.h" +#include "titanic/game_view.h" namespace Titanic { @@ -44,4 +46,38 @@ bool CMainGameWindow::Create() { return true; } +void CMainGameWindow::applicationStarting() { + // Set up the game project, and get game slot + int saveSlot = selectSavegame(); + assert(_project); + + // Set the video mode + CScreenManager *screenManager = CScreenManager::setCurrent(); + screenManager->setMode(640, 480, 1, 1, false); + + // TODO: Clear surfaces + + // Create game view and manager + _gameView = new CTitanicGameView(this); + _gameManager = new CGameManager(_project, _gameView); + _gameView->setGameManager(_gameManager); + + // Load either a new game or selected existing save + _project->loadGame(saveSlot); + + // TODO: Cursor/image and message generation +} + +int CMainGameWindow::loadGame() { + _project = new CProjectItem(); + _project->setFilename("starship.prj"); + + return selectSavegame(); +} + +int CMainGameWindow::selectSavegame() { + // TODO: For now, hardcoded to -1 for new saves + return -1; +} + } // End of namespace Titanic diff --git a/engines/titanic/main_game_window.h b/engines/titanic/main_game_window.h index 9b41212d7a..dc2fdfd025 100644 --- a/engines/titanic/main_game_window.h +++ b/engines/titanic/main_game_window.h @@ -25,7 +25,10 @@ #include "common/scummsys.h" #include "common/array.h" +#include "titanic/game_manager.h" +#include "titanic/game_view.h" #include "titanic/image.h" +#include "titanic/objects/project_item.h" namespace Titanic { @@ -34,10 +37,22 @@ class TitanicEngine; class CMainGameWindow { private: TitanicEngine *_vm; + + /** + * Checks for the presence of any savegames and, if present, + * lets the user pick one to resume + */ + int loadGame(); + + /** + * Creates the game "project" and determine a game save slot + * to use + */ + int selectSavegame(); public: - void *_gameView; - void *_gameManager; - void *_project; + CGameView *_gameView; + CGameManager *_gameManager; + CProjectItem *_project; int _field50; Image *_image; void *_cursor; @@ -48,6 +63,11 @@ public: * Creates the window */ bool Create(); + + /** + * Called when the application starts + */ + void applicationStarting(); }; } // End of namespace Titanic diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 7d126b4094..fc855d2df0 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -6,6 +6,8 @@ MODULE_OBJS := \ detection.o \ direct_draw.o \ font.o \ + game_manager.o \ + game_view.o \ image.o \ main_game_window.o \ screen_manager.o \ diff --git a/engines/titanic/objects/project_item.h b/engines/titanic/objects/project_item.h index 60fee9b912..b313387a74 100644 --- a/engines/titanic/objects/project_item.h +++ b/engines/titanic/objects/project_item.h @@ -72,6 +72,11 @@ public: * Clear any currently loaded project */ void clear(); + + /** + * Set the proejct's name + */ + void setFilename(const CString &name) { _filename = name; } }; } // End of namespace Titanic diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp index 08262dfd61..9df9fc3075 100644 --- a/engines/titanic/screen_manager.cpp +++ b/engines/titanic/screen_manager.cpp @@ -34,8 +34,12 @@ CScreenManagerRec::CScreenManagerRec() { /*------------------------------------------------------------------------*/ +CScreenManager *CScreenManager::_screenManagerPtr; +CScreenManager *CScreenManager::_currentScreenManagerPtr; + CScreenManager::CScreenManager(TitanicEngine *vm): _vm(vm) { _screenManagerPtr = nullptr; + _currentScreenManagerPtr = nullptr; _frontRenderSurface = nullptr; _mouseCursor = nullptr; @@ -56,6 +60,13 @@ bool CScreenManager::resetWindowHandle(int v) { return true; } +CScreenManager *CScreenManager::setCurrent() { + if (!_currentScreenManagerPtr) + _currentScreenManagerPtr = _screenManagerPtr; + + return _currentScreenManagerPtr; +} + /*------------------------------------------------------------------------*/ OSScreenManager::OSScreenManager(TitanicEngine *vm): CScreenManager(vm), diff --git a/engines/titanic/screen_manager.h b/engines/titanic/screen_manager.h index 4836bb33fc..0b847c2b49 100644 --- a/engines/titanic/screen_manager.h +++ b/engines/titanic/screen_manager.h @@ -50,7 +50,13 @@ class CScreenManager { protected: TitanicEngine *_vm; public: - void *_screenManagerPtr; + static CScreenManager *_screenManagerPtr; + static CScreenManager *_currentScreenManagerPtr; + + /** + * Set the current screen manager + */ + static CScreenManager *setCurrent(); public: Common::Array _backSurfaces; CVideoSurface *_frontRenderSurface; -- cgit v1.2.3 From 063f8a97c842fa6745746180daffb513bda79658 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 22 Feb 2016 21:15:20 -0500 Subject: TITANIC: Fixes for game startup --- engines/titanic/detection_tables.h | 2 +- engines/titanic/game_manager.cpp | 1 + engines/titanic/main_game_window.cpp | 2 +- engines/titanic/objects/project_item.cpp | 12 +++++++----- engines/titanic/objects/saveable_object.cpp | 2 +- engines/titanic/screen_manager.cpp | 3 +++ engines/titanic/titanic.cpp | 3 ++- 7 files changed, 16 insertions(+), 9 deletions(-) diff --git a/engines/titanic/detection_tables.h b/engines/titanic/detection_tables.h index dab7bd5462..e9cdcab334 100644 --- a/engines/titanic/detection_tables.h +++ b/engines/titanic/detection_tables.h @@ -27,7 +27,7 @@ static const TitanicGameDescription gameDescriptions[] = { { "titanic", 0, - AD_ENTRY1s("a.st", "b283436d90974fdc81accc95dbd8e61c", 15405985), + AD_ENTRY1s("newgame.st", "c276f2661f0d0a547445a65db78b2292", 87227), Common::EN_ANY, Common::kPlatformWindows, ADGF_NO_FLAGS, diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index 94e1ad3fb2..d29180ff6b 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game_manager.h" +#include "titanic/screen_manager.h" namespace Titanic { diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 41eb825543..c4eec39445 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -48,7 +48,7 @@ bool CMainGameWindow::Create() { void CMainGameWindow::applicationStarting() { // Set up the game project, and get game slot - int saveSlot = selectSavegame(); + int saveSlot = loadGame(); assert(_project); // Set the video mode diff --git a/engines/titanic/objects/project_item.cpp b/engines/titanic/objects/project_item.cpp index 599af89057..ee3cb3f28d 100644 --- a/engines/titanic/objects/project_item.cpp +++ b/engines/titanic/objects/project_item.cpp @@ -28,11 +28,14 @@ namespace Titanic { void CProjectItem::save(SimpleFile *file, int indent) const { - error("TODO"); + file->writeNumberLine(6, indent); + } void CProjectItem::load(SimpleFile *file) { - error("TODO"); + file->readNumber(); + + } void CProjectItem::loadGame(int slotId) { @@ -43,7 +46,7 @@ void CProjectItem::loadGame(int slotId) { clear(); // Open either an existing savegame slot or the new game template - if (slotId > 0) { + if (slotId >= 0) { saveFile = g_system->getSavefileManager()->openForLoading( Common::String::format("slot%d.gam", slotId)); file.open(saveFile); @@ -109,8 +112,7 @@ CProjectItem *CProjectItem::loadData(SimpleFile *file) { // TODO: Validate this is correct root = dynamic_cast(item); assert(root); - - _filename = root->_filename; + root->_filename = _filename; } // Load the data for the item diff --git a/engines/titanic/objects/saveable_object.cpp b/engines/titanic/objects/saveable_object.cpp index 25bd1645b5..201fe1085e 100644 --- a/engines/titanic/objects/saveable_object.cpp +++ b/engines/titanic/objects/saveable_object.cpp @@ -33,7 +33,7 @@ Common::HashMap * CSaveableObject::_classList = nullptr; #define DEFFN(T) CSaveableObject *Function##T() { return new T(); } -#define ADDFN(T) (*_classList)["TEST"] = Function##T +#define ADDFN(T) (*_classList)[#T] = Function##T DEFFN(List); DEFFN(ListItem); diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp index 9df9fc3075..0846b81b60 100644 --- a/engines/titanic/screen_manager.cpp +++ b/engines/titanic/screen_manager.cpp @@ -45,6 +45,9 @@ CScreenManager::CScreenManager(TitanicEngine *vm): _vm(vm) { _mouseCursor = nullptr; _textCursor = nullptr; _fontNumber = 0; + // TODO: Further initialization + + _screenManagerPtr = this; } CScreenManager::~CScreenManager() { diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index 57f3c7df0c..d998ec5837 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -52,8 +52,9 @@ void TitanicEngine::initialize() { DebugMan.addDebugChannel(kDebugSound, "sound", "Sound and Music handling"); CSaveableObject::initClassList(); - _window = new CMainGameWindow(this); _screenManager = new OSScreenManager(this); + _window = new CMainGameWindow(this); + _window->applicationStarting(); } Common::Error TitanicEngine::run() { -- cgit v1.2.3 From 938316b7dfdbbdf00b2b6e50ea2f05d856e15593 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 22 Feb 2016 22:39:37 -0500 Subject: TITANIC: Implementing CProjectItem loading --- engines/titanic/objects/file_item.h | 1 + engines/titanic/objects/list.cpp | 9 ++++++ engines/titanic/objects/list.h | 5 ++++ engines/titanic/objects/project_item.cpp | 49 +++++++++++++++++++++++++++++++- engines/titanic/objects/project_item.h | 11 +++++++ 5 files changed, 74 insertions(+), 1 deletion(-) diff --git a/engines/titanic/objects/file_item.h b/engines/titanic/objects/file_item.h index 133421ae1c..2261598ea8 100644 --- a/engines/titanic/objects/file_item.h +++ b/engines/titanic/objects/file_item.h @@ -23,6 +23,7 @@ #ifndef TITANIC_FILE_ITEM_H #define TITANIC_FILE_ITEM_H +#include "titanic/objects/list.h" #include "titanic/objects/tree_item.h" namespace Titanic { diff --git a/engines/titanic/objects/list.cpp b/engines/titanic/objects/list.cpp index ddcddb04dd..1ebffac51b 100644 --- a/engines/titanic/objects/list.cpp +++ b/engines/titanic/objects/list.cpp @@ -85,4 +85,13 @@ void List::loadItems(SimpleFile *file) { } } +void List::destroyContents() { + for (iterator i = begin(); i != end(); ++i) { + CSaveableObject *obj = *i; + delete obj; + } + + clear(); +} + } // End of namespace Titanic diff --git a/engines/titanic/objects/list.h b/engines/titanic/objects/list.h index f98912795d..ceb471534d 100644 --- a/engines/titanic/objects/list.h +++ b/engines/titanic/objects/list.h @@ -75,6 +75,11 @@ public: * Load the data for the class from file */ virtual void load(SimpleFile *file); + + /** + * Clear the list and destroy any items in it + */ + void destroyContents(); }; } // End of namespace Titanic diff --git a/engines/titanic/objects/project_item.cpp b/engines/titanic/objects/project_item.cpp index ee3cb3f28d..8211854407 100644 --- a/engines/titanic/objects/project_item.cpp +++ b/engines/titanic/objects/project_item.cpp @@ -27,15 +27,62 @@ namespace Titanic { +CProjectItem::CProjectItem() : _field34(0), _field38(0), _field3C(0) { +} + void CProjectItem::save(SimpleFile *file, int indent) const { file->writeNumberLine(6, indent); } void CProjectItem::load(SimpleFile *file) { - file->readNumber(); + int val = file->readNumber(); + load2(file, val); +} + +void CProjectItem::load2(SimpleFile *file, int val) { + int count; + _items.destroyContents(); + switch (val) { + case 1: + file->readBuffer(); + _field34 = file->readNumber(); + // Deliberate fall-through + + case 0: + count = file->readNumber(); + for (int idx = 0; idx < count; ++idx) { + + } + break; + + case 6: + file->readBuffer(); + _field3C = file->readNumber(); + // Deliberate fall-through + + case 5: + file->readBuffer(); + _field38 = file->readNumber(); + // Deliberate fall-through + + case 4: + file->readBuffer(); + // Deliberate fall-through + + case 2: + case 3: + _items.load(file); + file->readBuffer(); + _field34 = file->readNumber(); + break; + + default: + break; + } + CTreeItem::load(file); } void CProjectItem::loadGame(int slotId) { diff --git a/engines/titanic/objects/project_item.h b/engines/titanic/objects/project_item.h index b313387a74..d769f3dd0f 100644 --- a/engines/titanic/objects/project_item.h +++ b/engines/titanic/objects/project_item.h @@ -32,6 +32,15 @@ namespace Titanic { class CProjectItem : public CFileItem { private: CString _filename; + List _items; + int _field34; + int _field38; + int _field3C; + + /** + * Load data for the project + */ + void load2(SimpleFile *file, int val); private: /** * Load project data from the passed file @@ -43,6 +52,8 @@ private: */ void saveData(SimpleFile *file, CTreeItem *item) const; public: + CProjectItem(); + /** * Return the class name */ -- cgit v1.2.3 From a0dbab62b99afa331b5162a8c81a4db391cbd09e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 23 Feb 2016 20:59:57 -0500 Subject: TITANIC: Major fleshing out of game loading code --- engines/titanic/game_manager.cpp | 8 ++ engines/titanic/game_manager.h | 11 +++ engines/titanic/module.mk | 4 + engines/titanic/objects/dont_save_file_item.cpp | 35 +++++++ engines/titanic/objects/dont_save_file_item.h | 50 ++++++++++ engines/titanic/objects/file_item.cpp | 19 ++++ engines/titanic/objects/file_item.h | 32 ++++++ engines/titanic/objects/game_object.cpp | 27 ++++++ engines/titanic/objects/game_object.h | 35 +++++++ engines/titanic/objects/list.cpp | 62 ------------ engines/titanic/objects/list.h | 86 ++++++++++++---- engines/titanic/objects/message_target.cpp | 10 ++ engines/titanic/objects/message_target.h | 16 +++ engines/titanic/objects/named_item.cpp | 28 ++++++ engines/titanic/objects/named_item.h | 35 +++++++ engines/titanic/objects/pet_control.cpp | 31 ++++++ engines/titanic/objects/pet_control.h | 40 ++++++++ engines/titanic/objects/project_item.cpp | 124 +++++++++++++++++++++--- engines/titanic/objects/project_item.h | 67 +++++++++++-- engines/titanic/objects/saveable_object.cpp | 8 +- engines/titanic/objects/tree_item.cpp | 68 +++++++++++++ engines/titanic/objects/tree_item.h | 38 ++++++++ 22 files changed, 728 insertions(+), 106 deletions(-) create mode 100644 engines/titanic/objects/dont_save_file_item.cpp create mode 100644 engines/titanic/objects/dont_save_file_item.h create mode 100644 engines/titanic/objects/game_object.cpp create mode 100644 engines/titanic/objects/game_object.h create mode 100644 engines/titanic/objects/named_item.cpp create mode 100644 engines/titanic/objects/named_item.h create mode 100644 engines/titanic/objects/pet_control.cpp create mode 100644 engines/titanic/objects/pet_control.h diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index d29180ff6b..5e6496218f 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -30,4 +30,12 @@ CGameManager::CGameManager(CProjectItem *project, CGameView *gameView): // TODO } +void CGameManager::load(SimpleFile *file) { + // TODO +} + +void CGameManager::gameLoaded() { + // TODO +} + } // End of namespace Titanic diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index 0c1374e9a3..d776c00048 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -24,6 +24,7 @@ #define TITANIC_GAME_MANAGER_H #include "common/scummsys.h" +#include "titanic/simple_file.h" namespace Titanic { @@ -36,6 +37,16 @@ private: CGameView *_gameView; public: CGameManager(CProjectItem *project, CGameView *gameView); + + /** + * Load data from a save file + */ + void load(SimpleFile *file); + + /** + * Called after loading a game has finished + */ + void gameLoaded(); }; } // End of namespace Titanic diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index fc855d2df0..6d1e5461f5 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -15,9 +15,13 @@ MODULE_OBJS := \ string.o \ titanic.o \ video_surface.o \ + objects/dont_save_file_item.o \ objects/file_item.o \ + objects/game_object.o \ objects/list.o \ objects/message_target.o \ + objects/named_item.o \ + objects/pet_control.o \ objects/project_item.o \ objects/saveable_object.o \ objects/tree_item.o diff --git a/engines/titanic/objects/dont_save_file_item.cpp b/engines/titanic/objects/dont_save_file_item.cpp new file mode 100644 index 0000000000..bca66da521 --- /dev/null +++ b/engines/titanic/objects/dont_save_file_item.cpp @@ -0,0 +1,35 @@ +/* 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 "titanic/objects/dont_save_file_item.h" + +namespace Titanic { + +void CDontSaveFileItem::save(SimpleFile *file, int indent) const { + file->writeNumberLine(0, indent); +} + +void CDontSaveFileItem::load(SimpleFile *file) { + file->readNumber(); +} + +} // End of namespace Titanic diff --git a/engines/titanic/objects/dont_save_file_item.h b/engines/titanic/objects/dont_save_file_item.h new file mode 100644 index 0000000000..99deacc88c --- /dev/null +++ b/engines/titanic/objects/dont_save_file_item.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_DONT_SAVE_FILE_ITEM_H +#define TITANIC_DONT_SAVE_FILE_ITEM_H + +#include "titanic/objects/file_item.h" + +namespace Titanic { + +class CDontSaveFileItem : public CFileItem { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CDontSaveFileItem"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DONT_SAVE_FILE_ITEM_H */ diff --git a/engines/titanic/objects/file_item.cpp b/engines/titanic/objects/file_item.cpp index d49df71fcc..925fc4d000 100644 --- a/engines/titanic/objects/file_item.cpp +++ b/engines/titanic/objects/file_item.cpp @@ -24,5 +24,24 @@ namespace Titanic { +void CFileItem::save(SimpleFile *file, int indent) const { + file->writeNumberLine(0, indent); + CTreeItem::save(file, indent); +} + +void CFileItem::load(SimpleFile *file) { + file->readNumber(); + + CTreeItem::load(file); +} + +CString CFileItem::formFilename() const { + return ""; +} + +CString CFileItem::getFilename() const { + //dynamic_cast(getRoot())->formDataPath(); + return _filename; +} } // End of namespace Titanic diff --git a/engines/titanic/objects/file_item.h b/engines/titanic/objects/file_item.h index 2261598ea8..94dd053ae8 100644 --- a/engines/titanic/objects/file_item.h +++ b/engines/titanic/objects/file_item.h @@ -23,13 +23,45 @@ #ifndef TITANIC_FILE_ITEM_H #define TITANIC_FILE_ITEM_H +#include "titanic/string.h" #include "titanic/objects/list.h" #include "titanic/objects/tree_item.h" namespace Titanic { class CFileItem: public CTreeItem { +private: + CString _filename; public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CFileItem"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); + + /** + * Returns true if the item is a file item + */ + virtual bool isFileItem() const { return true; } + + /** + * Form a filename for the file item + */ + CString formFilename() const; + + /** + * Get a string? + */ + CString getFilename() const; }; } // End of namespace Titanic diff --git a/engines/titanic/objects/game_object.cpp b/engines/titanic/objects/game_object.cpp new file mode 100644 index 0000000000..a1e1faccce --- /dev/null +++ b/engines/titanic/objects/game_object.cpp @@ -0,0 +1,27 @@ +/* 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 "titanic/objects/game_object.h" + +namespace Titanic { + +} // End of namespace Titanic diff --git a/engines/titanic/objects/game_object.h b/engines/titanic/objects/game_object.h new file mode 100644 index 0000000000..7e0fba6e87 --- /dev/null +++ b/engines/titanic/objects/game_object.h @@ -0,0 +1,35 @@ +/* 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. + * + */ + +#ifndef TITANIC_GAME_OBJECT_H +#define TITANIC_GAME_OBJECT_H + +#include "titanic/objects/named_item.h" + +namespace Titanic { + +class CGameObject : public CNamedItem { +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_H */ diff --git a/engines/titanic/objects/list.cpp b/engines/titanic/objects/list.cpp index 1ebffac51b..4e0178d31c 100644 --- a/engines/titanic/objects/list.cpp +++ b/engines/titanic/objects/list.cpp @@ -25,73 +25,11 @@ namespace Titanic { void ListItem::save(SimpleFile *file, int indent) const { - // Should always be overriden in descendents, so just write a dummy value file->writeNumberLine(0, indent); } void ListItem::load(SimpleFile *file) { - // Should always be overriden in descendents, so just read the dummy value file->readNumber(); } -/*------------------------------------------------------------------------*/ - -List::List() { -} - -void List::save(SimpleFile *file, int indent) const { - file->writeNumberLine(0, indent); - saveItems(file, indent); -} - -void List::load(SimpleFile *file) { - file->readNumber(); - loadItems(file); -} - -void List::saveItems(SimpleFile *file, int indent) const { - // Write out number of items - file->writeQuotedLine("L", indent); - file->writeNumberLine(size(), indent); - - // Iterate through writing entries - List::const_iterator i; - for (i = begin(); i != end(); ++i) { - const ListItem *item = *i; - item->saveHeader(file, indent); - item->save(file, indent + 1); - item->saveFooter(file, indent); - } -} - -void List::loadItems(SimpleFile *file) { - file->readBuffer(); - uint count = file->readNumber(); - - for (uint idx = 0; idx < count; ++idx) { - // Validate the class start header - if (!file->IsClassStart()) - error("Unexpected class end"); - - // Get item's class name and use it to instantiate an item - CString className = file->readString(); - CSaveableObject *newItem = CSaveableObject::createInstance(className); - if (!newItem) - error("Could not create instance of %s", className.c_str()); - - // Validate the class end footer - if (file->IsClassStart()) - error("Unexpected class start"); - } -} - -void List::destroyContents() { - for (iterator i = begin(); i != end(); ++i) { - CSaveableObject *obj = *i; - delete obj; - } - - clear(); -} - } // End of namespace Titanic diff --git a/engines/titanic/objects/list.h b/engines/titanic/objects/list.h index ceb471534d..1842d2b5f8 100644 --- a/engines/titanic/objects/list.h +++ b/engines/titanic/objects/list.h @@ -25,10 +25,14 @@ #include "common/scummsys.h" #include "common/list.h" +#include "titanic/simple_file.h" #include "titanic/objects/saveable_object.h" namespace Titanic { +/** + * Base list item class + */ class ListItem: public CSaveableObject { public: /** @@ -47,39 +51,87 @@ public: virtual void load(SimpleFile *file); }; -class List : public CSaveableObject, Common::List { -private: - /** - * Write out the contents of the list - */ - void saveItems(SimpleFile *file, int indent) const; - - /** - * Read in the contents of a list - */ - void loadItems(SimpleFile *file); +template +class List : public CSaveableObject, public Common::List { public: - List(); - /** * Return the class name */ - virtual const char *getClassName() const { return "List"; } + virtual const char *getClassName() const { return nullptr; } /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent) const { + file->writeNumberLine(0, indent); + + // Write out number of items + file->writeQuotedLine("L", indent); + file->writeNumberLine(Common::List::size(), indent); + + // Iterate through writing entries + Common::List::const_iterator i; + for (i = Common::List::begin(); i != Common::List::end(); ++i) { + const ListItem *item = *i; + item->saveHeader(file, indent); + item->save(file, indent + 1); + item->saveFooter(file, indent); + } + + } /** * Load the data for the class from file */ - virtual void load(SimpleFile *file); + virtual void load(SimpleFile *file) { + file->readNumber(); + file->readBuffer(); + + Common::List::clear(); + uint count = file->readNumber(); + + for (uint idx = 0; idx < count; ++idx) { + // Validate the class start header + if (!file->IsClassStart()) + error("Unexpected class end"); + + // Get item's class name and use it to instantiate an item + CString className = file->readString(); + T *newItem = dynamic_cast(CSaveableObject::createInstance(className)); + if (!newItem) + error("Could not create instance of %s", className.c_str()); + + // Load the item's data and add it to the list + newItem->load(file); + Common::List::push_back(newItem); + + // Validate the class end footer + if (file->IsClassStart()) + error("Unexpected class start"); + } + } /** * Clear the list and destroy any items in it */ - void destroyContents(); + void destroyContents() { + for (Common::List::iterator i = Common::List::begin(); + i != Common::List::end(); ++i) { + CSaveableObject *obj = *i; + delete obj; + } + + Common::List::clear(); + } + + /** + * Add a new item to the list of the type the list contains + */ + T *List::add() { + T *item = new T(); + Common::List::push_back(item); + return item; + } }; } // End of namespace Titanic diff --git a/engines/titanic/objects/message_target.cpp b/engines/titanic/objects/message_target.cpp index 1e727a3686..bd162ff9eb 100644 --- a/engines/titanic/objects/message_target.cpp +++ b/engines/titanic/objects/message_target.cpp @@ -23,5 +23,15 @@ #include "titanic/objects/message_target.h" namespace Titanic { + +void CMessageTarget::save(SimpleFile *file, int indent) const { + file->writeNumberLine(0, indent); + CSaveableObject::save(file, indent); +} + +void CMessageTarget::load(SimpleFile *file) { + file->readNumber(); + CSaveableObject::load(file); +} } // End of namespace Titanic diff --git a/engines/titanic/objects/message_target.h b/engines/titanic/objects/message_target.h index 6afd709211..5e29ddaf78 100644 --- a/engines/titanic/objects/message_target.h +++ b/engines/titanic/objects/message_target.h @@ -28,6 +28,22 @@ namespace Titanic { class CMessageTarget: public CSaveableObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMessageTarget"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); + }; } // End of namespace Titanic diff --git a/engines/titanic/objects/named_item.cpp b/engines/titanic/objects/named_item.cpp new file mode 100644 index 0000000000..34db645590 --- /dev/null +++ b/engines/titanic/objects/named_item.cpp @@ -0,0 +1,28 @@ +/* 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 "titanic/objects/named_item.h" + +namespace Titanic { + + +} // End of namespace Titanic diff --git a/engines/titanic/objects/named_item.h b/engines/titanic/objects/named_item.h new file mode 100644 index 0000000000..ee4ad352ed --- /dev/null +++ b/engines/titanic/objects/named_item.h @@ -0,0 +1,35 @@ +/* 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. + * + */ + +#ifndef TITANIC_NAMED_ITEM_H +#define TITANIC_NAMED_ITEM_H + +#include "titanic/objects/tree_item.h" + +namespace Titanic { + +class CNamedItem: public CTreeItem { +}; + +} // End of namespace Titanic + +#endif /* TITANIC_NAMED_ITEM_H */ diff --git a/engines/titanic/objects/pet_control.cpp b/engines/titanic/objects/pet_control.cpp new file mode 100644 index 0000000000..73ef957e78 --- /dev/null +++ b/engines/titanic/objects/pet_control.cpp @@ -0,0 +1,31 @@ +/* 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 "titanic/objects/pet_control.h" + +namespace Titanic { + +void CPetControl::gameLoaded() { + // TODO +} + +} // End of namespace Titanic diff --git a/engines/titanic/objects/pet_control.h b/engines/titanic/objects/pet_control.h new file mode 100644 index 0000000000..f6c9707df8 --- /dev/null +++ b/engines/titanic/objects/pet_control.h @@ -0,0 +1,40 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONTROL_H +#define TITANIC_PET_CONTROL_H + +#include "titanic/objects/game_object.h" + +namespace Titanic { + +class CPetControl : public CGameObject { +public: + /** + * Called after loading a game has finished + */ + void gameLoaded(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_H */ diff --git a/engines/titanic/objects/project_item.cpp b/engines/titanic/objects/project_item.cpp index 8211854407..2bd75156d8 100644 --- a/engines/titanic/objects/project_item.cpp +++ b/engines/titanic/objects/project_item.cpp @@ -21,50 +21,89 @@ */ #include "common/savefile.h" +#include "titanic/game_manager.h" #include "titanic/titanic.h" #include "titanic/compressed_file.h" +#include "titanic/objects/dont_save_file_item.h" +#include "titanic/objects/pet_control.h" #include "titanic/objects/project_item.h" namespace Titanic { -CProjectItem::CProjectItem() : _field34(0), _field38(0), _field3C(0) { +void CFileListItem::save(SimpleFile *file, int indent) const { + file->writeNumberLine(0, indent); + file->writeQuotedLine(_name, indent); + + ListItem::save(file, indent); +} + +void CFileListItem::load(SimpleFile *file) { + file->readNumber(); + _name = file->readString(); + + ListItem::load(file); +} + +/*------------------------------------------------------------------------*/ + +CProjectItem::CProjectItem() : _nextRoomNumber(0), _nextMessageNumber(0), + _nextObjectNumber(0), _gameManager(nullptr) { } void CProjectItem::save(SimpleFile *file, int indent) const { file->writeNumberLine(6, indent); + file->writeQuotedLine("Next Avail. Object Number", indent); + file->writeNumberLine(_nextObjectNumber, indent); + file->writeQuotedLine("Next Avail. Message Number", indent); + file->writeNumberLine(_nextMessageNumber, indent); + file->writeQuotedLine("Next Avail. Room Number", indent); + file->writeNumberLine(_nextRoomNumber, indent); + + CTreeItem::save(file, indent); +} + +void CProjectItem::buildFilesList() { + _files.destroyContents(); + CTreeItem *treeItem = getFirstChild(); + while (treeItem) { + if (treeItem->isFileItem()) { + CString name = static_cast(treeItem)->getFilename(); + _files.add()->_name = name; + } + + treeItem = getNextSibling(); + } } void CProjectItem::load(SimpleFile *file) { int val = file->readNumber(); - load2(file, val); -} - -void CProjectItem::load2(SimpleFile *file, int val) { + _files.destroyContents(); int count; - _items.destroyContents(); switch (val) { case 1: file->readBuffer(); - _field34 = file->readNumber(); + _nextRoomNumber = file->readNumber(); // Deliberate fall-through case 0: + // Load the list of files count = file->readNumber(); for (int idx = 0; idx < count; ++idx) { - + CString name = file->readString(); + _files.add()->_name = name; } break; case 6: file->readBuffer(); - _field3C = file->readNumber(); + _nextObjectNumber = file->readNumber(); // Deliberate fall-through case 5: file->readBuffer(); - _field38 = file->readNumber(); + _nextMessageNumber = file->readNumber(); // Deliberate fall-through case 4: @@ -73,9 +112,9 @@ void CProjectItem::load2(SimpleFile *file, int val) { case 2: case 3: - _items.load(file); + _files.load(file); file->readBuffer(); - _field34 = file->readNumber(); + _nextRoomNumber = file->readNumber(); break; default: @@ -85,6 +124,14 @@ void CProjectItem::load2(SimpleFile *file, int val) { CTreeItem::load(file); } +CGameManager *CProjectItem::getGameManager() { + return _gameManager; +} + +void CProjectItem::resetGameManager() { + _gameManager = nullptr; +} + void CProjectItem::loadGame(int slotId) { CompressedFile file; Common::InSaveFile *saveFile = nullptr; @@ -102,9 +149,27 @@ void CProjectItem::loadGame(int slotId) { } // Load the contents in - loadData(&file); + CProjectItem *newProject = loadData(&file); + file.IsClassStart(); + getGameManager()->load(&file); file.close(); + + // Clear existing project + clear(); + + // Detach each item under the loaded project, and re-attach them + // to the existing project instance (this) + CTreeItem *item; + while ((item = newProject->getFirstChild()) != nullptr) { + item->detach(); + item->addUnder(this); + } + // Loaded project instance is no longer needed + newProject->destroyAll(); + + // Post-load processing + gameLoaded(); } void CProjectItem::saveGame(int slotId) { @@ -120,7 +185,9 @@ void CProjectItem::saveGame(int slotId) { } void CProjectItem::clear() { - + CTreeItem *item; + while ((item = getFirstChild()) != nullptr) + item->destroyAll(); } CProjectItem *CProjectItem::loadData(SimpleFile *file) { @@ -156,7 +223,6 @@ CProjectItem *CProjectItem::loadData(SimpleFile *file) { // Already created root project item->addUnder(parent); } else { - // TODO: Validate this is correct root = dynamic_cast(item); assert(root); root->_filename = _filename; @@ -197,4 +263,32 @@ void CProjectItem::saveData(SimpleFile *file, CTreeItem *item) const { } } +void CProjectItem::gameLoaded() { + CGameManager *gameManager = getGameManager(); + if (gameManager) + gameManager->gameLoaded(); + + CPetControl *petControl = getPetControl(); + if (petControl) + petControl->gameLoaded(); +} + +CPetControl *CProjectItem::getPetControl() { + CDontSaveFileItem *fileItem = getDontSaveFileItem(); + CTreeItem *treeItem; + + if (!fileItem || (treeItem = fileItem->getLastChild()) == nullptr) + return nullptr; + + while (treeItem) { + CPetControl *petControl = dynamic_cast(treeItem); + if (petControl) + return petControl; + + treeItem = treeItem->getPriorSibling(); + } + + return nullptr; +} + } // End of namespace Titanic diff --git a/engines/titanic/objects/project_item.h b/engines/titanic/objects/project_item.h index d769f3dd0f..066dbf69e0 100644 --- a/engines/titanic/objects/project_item.h +++ b/engines/titanic/objects/project_item.h @@ -26,21 +26,56 @@ #include "common/scummsys.h" #include "titanic/simple_file.h" #include "titanic/objects/file_item.h" +#include "titanic/objects/list.h" namespace Titanic { +class CGameManager; +class CPetControl; + +/** + * File list item + */ +class CFileListItem : public ListItem { +public: + CString _name; + + virtual const char *getClassName() const { return "CFileListItem"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); + +}; + +/** + * Filename list + */ +class CFileList: public List { +public: + virtual const char *getClassName() const { return "CFileList"; } +}; + + class CProjectItem : public CFileItem { private: CString _filename; - List _items; - int _field34; - int _field38; - int _field3C; + CFileList _files; + int _nextRoomNumber; + int _nextMessageNumber; + int _nextObjectNumber; + CGameManager *_gameManager; /** - * Load data for the project + * Called during save, iterates through the children to do some stuff */ - void load2(SimpleFile *file, int val); + void buildFilesList(); private: /** * Load project data from the passed file @@ -51,6 +86,11 @@ private: * Save project data to the passed file */ void saveData(SimpleFile *file, CTreeItem *item) const; + + /** + * Does post-loading processing + */ + void gameLoaded(); public: CProjectItem(); @@ -69,6 +109,21 @@ public: */ virtual void load(SimpleFile *file); + /** + * Get the game manager for the project + */ + virtual CGameManager *getGameManager(); + + /** + * Get a reference to the PET control + */ + CPetControl *getPetControl(); + + /** + * Resets the game manager field + */ + void resetGameManager(); + /** * Load the entire project data for a given slot Id */ diff --git a/engines/titanic/objects/saveable_object.cpp b/engines/titanic/objects/saveable_object.cpp index 201fe1085e..45f9e132d9 100644 --- a/engines/titanic/objects/saveable_object.cpp +++ b/engines/titanic/objects/saveable_object.cpp @@ -35,8 +35,7 @@ Common::HashMap * #define DEFFN(T) CSaveableObject *Function##T() { return new T(); } #define ADDFN(T) (*_classList)[#T] = Function##T -DEFFN(List); -DEFFN(ListItem); +DEFFN(CFileListItem); DEFFN(CMessageTarget); DEFFN(CTreeItem); DEFFN(CFileItem); @@ -44,8 +43,7 @@ DEFFN(CProjectItem); void CSaveableObject::initClassList() { _classList = new Common::HashMap(); - ADDFN(List); - ADDFN(ListItem); + ADDFN(CFileListItem); ADDFN(CMessageTarget); ADDFN(CTreeItem); ADDFN(CFileItem); @@ -61,12 +59,10 @@ CSaveableObject *CSaveableObject::createInstance(const Common::String &name) { } void CSaveableObject::save(SimpleFile *file, int indent) const { - // Should always be overriden in descendents, so just write a dummy value file->writeNumberLine(0, indent); } void CSaveableObject::load(SimpleFile *file) { - // Should always be overriden in descendents, so just read the dummy value file->readNumber(); } diff --git a/engines/titanic/objects/tree_item.cpp b/engines/titanic/objects/tree_item.cpp index bf0ae3e735..3902df3d3a 100644 --- a/engines/titanic/objects/tree_item.cpp +++ b/engines/titanic/objects/tree_item.cpp @@ -21,6 +21,8 @@ */ #include "titanic/objects/tree_item.h" +#include "titanic/objects/dont_save_file_item.h" +#include "titanic/objects/file_item.h" namespace Titanic { @@ -38,6 +40,22 @@ void CTreeItem::load(SimpleFile *file) { CMessageTarget::load(file); } +CGameManager *CTreeItem::getGameManager() { + return _parent ? _parent->getGameManager() : nullptr; +} + +CTreeItem *CTreeItem::getRoot() const { + CTreeItem *parent = getParent(); + + if (parent) { + do { + parent = parent->getParent(); + } while (parent->getParent()); + } + + return parent; +} + CTreeItem *CTreeItem::getLastSibling() { CTreeItem *item = this; while (item->getNextSibling()) @@ -52,6 +70,17 @@ CTreeItem *CTreeItem::getLastChild() { return _firstChild->getLastSibling(); } +CDontSaveFileItem *CTreeItem::getDontSaveFileItem() { + CTreeItem *item = getFirstChild(); + while (item) { + CDontSaveFileItem *fileItem = dynamic_cast(item); + if (fileItem) + return fileItem; + + item = item->getNextSibling(); + } +} + void CTreeItem::addUnder(CTreeItem *newParent) { if (newParent->_firstChild) addSibling(newParent->getLastSibling()); @@ -79,5 +108,44 @@ void CTreeItem::addSibling(CTreeItem *item) { item->_nextSibling = this; } +void CTreeItem::destroyAll() { + destroyOthers(); + detach(); + delete this; +} + +int CTreeItem::destroyOthers() { + if (!_firstChild) + return 0; + + CTreeItem *item = this, *child, *nextSibling; + int total = 0; + + do { + child = item->_firstChild; + nextSibling = item->_nextSibling; + + if (child) + total += child->destroyOthers(); + child->detach(); + delete child; + ++total; + } while ((item = nextSibling) != nullptr); + + return total; +} + +void CTreeItem::detach() { + // Delink this item from any prior and/or next siblings + if (_priorSibling) + _priorSibling->_nextSibling = _nextSibling; + if (_nextSibling) + _nextSibling->_priorSibling = _priorSibling; + + if (_parent && _parent->_firstChild == this) + _parent->_firstChild = _nextSibling; + + _priorSibling = _nextSibling = _parent = nullptr; +} } // End of namespace Titanic diff --git a/engines/titanic/objects/tree_item.h b/engines/titanic/objects/tree_item.h index d3c1d34911..d6450e313a 100644 --- a/engines/titanic/objects/tree_item.h +++ b/engines/titanic/objects/tree_item.h @@ -27,6 +27,9 @@ namespace Titanic { +class CGameManager; +class CDontSaveFileItem; + class CTreeItem: public CMessageTarget { private: CTreeItem *_parent; @@ -52,11 +55,26 @@ public: */ virtual void load(SimpleFile *file); + /** + * Get the game manager for the project + */ + virtual CGameManager *getGameManager(); + + /** + * Returns true if the item is a file item + */ + virtual bool isFileItem() const { return false; } + /** * Get the parent for the given item */ CTreeItem *getParent() const { return _parent; } + /** + * Jumps up through the parents to find the sub-root item + */ + CTreeItem *getRoot() const; + /** * Get the next sibling */ @@ -82,6 +100,11 @@ public: */ CTreeItem *getLastChild(); + /** + * Get any dont save file item in the immediate children + */ + CDontSaveFileItem *getDontSaveFileItem(); + /** * Adds the item under another tree item */ @@ -96,6 +119,21 @@ public: * Adds the item as a sibling of another item */ void addSibling(CTreeItem *item); + + /** + * Destroys both the item as well as any of it's children + */ + void destroyAll(); + + /** + * Destroys all tree items around the given one + */ + int destroyOthers(); + + /** + * Detach the tree item from any other associated tree items + */ + void detach(); }; } // End of namespace Titanic -- cgit v1.2.3 From 4126cf4fb0a4a30e5abfbef9ae3ce46bce3fd620 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 23 Feb 2016 22:52:02 -0500 Subject: TITANIC: Implemented CRoomItem class --- engines/titanic/module.mk | 4 +- engines/titanic/objects/named_item.cpp | 14 ++++ engines/titanic/objects/named_item.h | 17 +++++ engines/titanic/objects/resource_key.cpp | 47 +++++++++++++ engines/titanic/objects/resource_key.h | 54 ++++++++++++++ engines/titanic/objects/saveable_object.cpp | 7 ++ engines/titanic/rooms/room_item.cpp | 105 ++++++++++++++++++++++++++++ engines/titanic/rooms/room_item.h | 80 +++++++++++++++++++++ 8 files changed, 327 insertions(+), 1 deletion(-) create mode 100644 engines/titanic/objects/resource_key.cpp create mode 100644 engines/titanic/objects/resource_key.h create mode 100644 engines/titanic/rooms/room_item.cpp create mode 100644 engines/titanic/rooms/room_item.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 6d1e5461f5..6ddb96a8e5 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -23,8 +23,10 @@ MODULE_OBJS := \ objects/named_item.o \ objects/pet_control.o \ objects/project_item.o \ + objects/resource_key.o \ objects/saveable_object.o \ - objects/tree_item.o + objects/tree_item.o \ + rooms/room_item.o # This module can be built as a plugin ifeq ($(ENABLE_TITANIC), DYNAMIC_PLUGIN) diff --git a/engines/titanic/objects/named_item.cpp b/engines/titanic/objects/named_item.cpp index 34db645590..f7d7c7b75d 100644 --- a/engines/titanic/objects/named_item.cpp +++ b/engines/titanic/objects/named_item.cpp @@ -24,5 +24,19 @@ namespace Titanic { +void CNamedItem::save(SimpleFile *file, int indent) const { + file->writeNumberLine(0, indent); + file->writeQuotedLine(_name, indent); + + CTreeItem::save(file, indent); +} + +void CNamedItem::load(SimpleFile *file) { + int val = file->readNumber(); + if (!val) + _name = file->readString(); + + CTreeItem::load(file); +} } // End of namespace Titanic diff --git a/engines/titanic/objects/named_item.h b/engines/titanic/objects/named_item.h index ee4ad352ed..d59b73065b 100644 --- a/engines/titanic/objects/named_item.h +++ b/engines/titanic/objects/named_item.h @@ -28,6 +28,23 @@ namespace Titanic { class CNamedItem: public CTreeItem { +public: + CString _name; +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CNamedItem"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); }; } // End of namespace Titanic diff --git a/engines/titanic/objects/resource_key.cpp b/engines/titanic/objects/resource_key.cpp new file mode 100644 index 0000000000..612014bb37 --- /dev/null +++ b/engines/titanic/objects/resource_key.cpp @@ -0,0 +1,47 @@ +/* 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 "titanic/simple_file.h" +#include "titanic/objects/resource_key.h" + +namespace Titanic { + +void CResourceKey::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine("Resource Key...", indent); + file->writeQuotedLine(_key, indent); + + CSaveableObject::save(file, indent); +} + +void CResourceKey::load(SimpleFile *file) { + int val = file->readNumber(); + + if (val == 1) { + file->readBuffer(); + _value = file->readString(); + } + + CSaveableObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/objects/resource_key.h b/engines/titanic/objects/resource_key.h new file mode 100644 index 0000000000..4cb40cd568 --- /dev/null +++ b/engines/titanic/objects/resource_key.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_RESOURCE_KEY_H +#define TITANIC_RESOURCE_KEY_H + +#include "titanic/string.h" +#include "titanic/objects/saveable_object.h" + +namespace Titanic { + +class CResourceKey: public CSaveableObject { +private: + CString _key; + CString _value; +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CResourceKey"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_RESOURCE_KEY_H */ diff --git a/engines/titanic/objects/saveable_object.cpp b/engines/titanic/objects/saveable_object.cpp index 45f9e132d9..f2f38f3dfb 100644 --- a/engines/titanic/objects/saveable_object.cpp +++ b/engines/titanic/objects/saveable_object.cpp @@ -26,6 +26,7 @@ #include "titanic/objects/message_target.h" #include "titanic/objects/project_item.h" #include "titanic/objects/tree_item.h" +#include "titanic/rooms/room_item.h" namespace Titanic { @@ -40,6 +41,9 @@ DEFFN(CMessageTarget); DEFFN(CTreeItem); DEFFN(CFileItem); DEFFN(CProjectItem); +DEFFN(CRoomItem); +DEFFN(CMovieClipItem); +DEFFN(CMovieClipList); void CSaveableObject::initClassList() { _classList = new Common::HashMap(); @@ -48,6 +52,9 @@ void CSaveableObject::initClassList() { ADDFN(CTreeItem); ADDFN(CFileItem); ADDFN(CProjectItem); + ADDFN(CRoomItem); + ADDFN(CMovieClipItem); + ADDFN(CMovieClipList); } void CSaveableObject::freeClassList() { diff --git a/engines/titanic/rooms/room_item.cpp b/engines/titanic/rooms/room_item.cpp new file mode 100644 index 0000000000..9e0c699cc6 --- /dev/null +++ b/engines/titanic/rooms/room_item.cpp @@ -0,0 +1,105 @@ +/* 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 "titanic/rooms/room_item.h" + +namespace Titanic { + +CRoomItem::CRoomItem() : CNamedItem(), _roomNumber(0), + _roomDimensionX(0.0), _roomDimensionY(0.0) { +} + +void CRoomItem::save(SimpleFile *file, int indent) const { + file->writeNumberLine(3, indent); + file->writeQuotedLine("Exit Movies", indent); + _exitMovieKey.save(file, indent); + + file->writeNumberLine(_roomDimensionX * 1000.0, indent + 1); + file->writeNumberLine(_roomDimensionY * 1000.0, indent + 1); + + file->writeQuotedLine("Transition Movie", indent); + _transitionMovieKey.save(file, indent); + + file->writeQuotedLine("Movie Clip list", indent); + _clipList.save(file, indent + 1); + + file->writeQuotedLine("Room Rect", indent); + file->writeNumberLine(_roomRect.left, indent + 1); + file->writeNumberLine(_roomRect.top, indent + 1); + file->writeNumberLine(_roomRect.right, indent + 1); + file->writeNumberLine(_roomRect.bottom, indent + 1); + + file->writeQuotedLine("Room Number", indent); + file->writeNumberLine(_roomNumber, indent); + + CNamedItem::save(file, indent); +} + +void CRoomItem::load(SimpleFile *file) { + int val = file->readNumber(); + + switch (val) { + case 3: + // Read exit movie + file->readBuffer(); + _exitMovieKey.load(file); + // Deliberate fall-through + + case 2: + // Read room dimensions + file->readBuffer(); + _roomDimensionX = (double)file->readNumber() / 1000.0; + _roomDimensionY = (double)file->readNumber() / 1000.0; + // Deliberate fall-through + + case 1: + // Read transition movie key and clip list + file->readBuffer(); + _transitionMovieKey.load(file); + + file->readBuffer(); + _clipList.load(file); + loading(); + // Deliberate fall-through + + case 0: + // Read room rect + file->readBuffer(); + _roomRect.left = file->readNumber(); + _roomRect.top = file->readNumber(); + _roomRect.right = file->readNumber(); + _roomRect.bottom = file->readNumber(); + file->readBuffer(); + break; + + default: + break; + } + + CNamedItem::load(file); +} + +void CRoomItem::loading() { + // TODO +} + +} // End of namespace Titanic diff --git a/engines/titanic/rooms/room_item.h b/engines/titanic/rooms/room_item.h new file mode 100644 index 0000000000..bb8bbb8619 --- /dev/null +++ b/engines/titanic/rooms/room_item.h @@ -0,0 +1,80 @@ +/* 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. + * + */ + +#ifndef TITANIC_ROOM_ITEM_H +#define TITANIC_ROOM_ITEM_H + +#include "common/rect.h" +#include "titanic/objects/list.h" +#include "titanic/objects/resource_key.h" +#include "titanic/objects/named_item.h" + +namespace Titanic { + +/** + * Movie clip item + */ +class CMovieClipItem : public ListItem { +public: + virtual const char *getClassName() const { return "CMovieClipItem"; } +}; + +/** + * Movie clip list + */ +class CMovieClipList: public List { +public: + virtual const char *getClassName() const { return "CMovieClipList"; } +}; + +class CRoomItem : public CNamedItem { +private: + Common::Rect _roomRect; + CMovieClipList _clipList; + int _roomNumber; + CResourceKey _transitionMovieKey; + CResourceKey _exitMovieKey; + double _roomDimensionX, _roomDimensionY; + + void loading(); +public: + CRoomItem(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CRoomItem"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ROOM_ITEM_H */ -- cgit v1.2.3 From 03f387b2bc624bbbea01f0894dc9a2a218e9ef6d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 24 Feb 2016 07:49:01 -0500 Subject: TITANIC: Added CMovieClip class --- engines/titanic/module.mk | 1 + engines/titanic/objects/movie_clip.cpp | 68 ++++++++++++++++++++++++ engines/titanic/objects/movie_clip.h | 82 +++++++++++++++++++++++++++++ engines/titanic/objects/saveable_object.cpp | 3 ++ engines/titanic/rooms/room_item.h | 19 +------ 5 files changed, 156 insertions(+), 17 deletions(-) create mode 100644 engines/titanic/objects/movie_clip.cpp create mode 100644 engines/titanic/objects/movie_clip.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 6ddb96a8e5..848c737b62 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -20,6 +20,7 @@ MODULE_OBJS := \ objects/game_object.o \ objects/list.o \ objects/message_target.o \ + objects/movie_clip.o \ objects/named_item.o \ objects/pet_control.o \ objects/project_item.o \ diff --git a/engines/titanic/objects/movie_clip.cpp b/engines/titanic/objects/movie_clip.cpp new file mode 100644 index 0000000000..2910051ce8 --- /dev/null +++ b/engines/titanic/objects/movie_clip.cpp @@ -0,0 +1,68 @@ +/* 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 "titanic/objects/movie_clip.h" + +namespace Titanic { + +CMovieClip::CMovieClip() { +} + +void CMovieClip::save(SimpleFile *file, int indent) const { + file->writeNumberLine(2, indent); + file->writeQuotedLine("Clip", indent); + file->writeQuotedLine(_string1, indent); + file->writeNumberLine(_field18, indent); + file->writeNumberLine(_field1C, indent); + + ListItem::save(file, indent); +} + +void CMovieClip::load(SimpleFile *file) { + int val = file->readNumber(); + + switch (val) { + case 1: + _string1 = file->readString(); + _field18 = file->readNumber(); + _field1C = file->readNumber(); + _field20 = file->readNumber(); + _field24 = file->readNumber(); + _field28 = file->readNumber(); + _field2C = file->readNumber(); + _field30 = file->readNumber(); + break; + + case 2: + _string1 = file->readString(); + _field18 = file->readNumber(); + _field1C = file->readNumber(); + break; + + default: + break; + } + + ListItem::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/objects/movie_clip.h b/engines/titanic/objects/movie_clip.h new file mode 100644 index 0000000000..18446c6dc2 --- /dev/null +++ b/engines/titanic/objects/movie_clip.h @@ -0,0 +1,82 @@ +/* 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. + * + */ + +#ifndef TITANIC_MOVIE_CLIP_H +#define TITANIC_MOVIE_CLIP_H + +#include "titanic/objects/list.h" + +namespace Titanic { + +/** + * Movie clip item + */ +class CMovieClipItem : public ListItem { +public: + virtual const char *getClassName() const { return "CMovieClipItem"; } +}; + +/** + * Movie clip list + */ +class CMovieClipList: public List { +public: + virtual const char *getClassName() const { return "CMovieClipList"; } +}; + +/** + * Movie clip + */ +class CMovieClip : public ListItem { +private: + CString _string1; + int _field18; + int _field1C; + int _field20; + int _field24; + int _field28; + int _field2C; + int _field30; + CString _string2; + CString _string3; +public: + CMovieClip(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMovieClip"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MOVIE_CLIP_H */ diff --git a/engines/titanic/objects/saveable_object.cpp b/engines/titanic/objects/saveable_object.cpp index f2f38f3dfb..adc03697a5 100644 --- a/engines/titanic/objects/saveable_object.cpp +++ b/engines/titanic/objects/saveable_object.cpp @@ -24,6 +24,7 @@ #include "titanic/objects/file_item.h" #include "titanic/objects/list.h" #include "titanic/objects/message_target.h" +#include "titanic/objects/movie_clip.h" #include "titanic/objects/project_item.h" #include "titanic/objects/tree_item.h" #include "titanic/rooms/room_item.h" @@ -42,6 +43,7 @@ DEFFN(CTreeItem); DEFFN(CFileItem); DEFFN(CProjectItem); DEFFN(CRoomItem); +DEFFN(CMovieClip); DEFFN(CMovieClipItem); DEFFN(CMovieClipList); @@ -53,6 +55,7 @@ void CSaveableObject::initClassList() { ADDFN(CFileItem); ADDFN(CProjectItem); ADDFN(CRoomItem); + ADDFN(CMovieClip); ADDFN(CMovieClipItem); ADDFN(CMovieClipList); } diff --git a/engines/titanic/rooms/room_item.h b/engines/titanic/rooms/room_item.h index bb8bbb8619..4df14aae7d 100644 --- a/engines/titanic/rooms/room_item.h +++ b/engines/titanic/rooms/room_item.h @@ -25,27 +25,12 @@ #include "common/rect.h" #include "titanic/objects/list.h" -#include "titanic/objects/resource_key.h" +#include "titanic/objects/movie_clip.h" #include "titanic/objects/named_item.h" +#include "titanic/objects/resource_key.h" namespace Titanic { -/** - * Movie clip item - */ -class CMovieClipItem : public ListItem { -public: - virtual const char *getClassName() const { return "CMovieClipItem"; } -}; - -/** - * Movie clip list - */ -class CMovieClipList: public List { -public: - virtual const char *getClassName() const { return "CMovieClipList"; } -}; - class CRoomItem : public CNamedItem { private: Common::Rect _roomRect; -- cgit v1.2.3 From 4fbcefba65f78e2346fb9a03e7b7c4cfbaf6133d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 24 Feb 2016 20:22:22 -0500 Subject: TITANIC: Fix loading of CRoomItem class --- engines/titanic/objects/movie_clip.cpp | 1 + engines/titanic/objects/movie_clip.h | 24 ++++++++---------------- engines/titanic/objects/saveable_object.cpp | 3 +-- engines/titanic/rooms/room_item.cpp | 1 + 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/engines/titanic/objects/movie_clip.cpp b/engines/titanic/objects/movie_clip.cpp index 2910051ce8..2914cc844c 100644 --- a/engines/titanic/objects/movie_clip.cpp +++ b/engines/titanic/objects/movie_clip.cpp @@ -53,6 +53,7 @@ void CMovieClip::load(SimpleFile *file) { break; case 2: + file->readString(); _string1 = file->readString(); _field18 = file->readNumber(); _field1C = file->readNumber(); diff --git a/engines/titanic/objects/movie_clip.h b/engines/titanic/objects/movie_clip.h index 18446c6dc2..e259d970fe 100644 --- a/engines/titanic/objects/movie_clip.h +++ b/engines/titanic/objects/movie_clip.h @@ -27,22 +27,6 @@ namespace Titanic { -/** - * Movie clip item - */ -class CMovieClipItem : public ListItem { -public: - virtual const char *getClassName() const { return "CMovieClipItem"; } -}; - -/** - * Movie clip list - */ -class CMovieClipList: public List { -public: - virtual const char *getClassName() const { return "CMovieClipList"; } -}; - /** * Movie clip */ @@ -77,6 +61,14 @@ public: virtual void load(SimpleFile *file); }; +/** + * Movie clip list + */ +class CMovieClipList: public List { +public: + virtual const char *getClassName() const { return "CMovieClipList"; } +}; + } // End of namespace Titanic #endif /* TITANIC_MOVIE_CLIP_H */ diff --git a/engines/titanic/objects/saveable_object.cpp b/engines/titanic/objects/saveable_object.cpp index adc03697a5..45161be277 100644 --- a/engines/titanic/objects/saveable_object.cpp +++ b/engines/titanic/objects/saveable_object.cpp @@ -44,7 +44,6 @@ DEFFN(CFileItem); DEFFN(CProjectItem); DEFFN(CRoomItem); DEFFN(CMovieClip); -DEFFN(CMovieClipItem); DEFFN(CMovieClipList); void CSaveableObject::initClassList() { @@ -56,7 +55,6 @@ void CSaveableObject::initClassList() { ADDFN(CProjectItem); ADDFN(CRoomItem); ADDFN(CMovieClip); - ADDFN(CMovieClipItem); ADDFN(CMovieClipList); } @@ -65,6 +63,7 @@ void CSaveableObject::freeClassList() { } CSaveableObject *CSaveableObject::createInstance(const Common::String &name) { +warning("%s", name.c_str()); return (*_classList)[name](); } diff --git a/engines/titanic/rooms/room_item.cpp b/engines/titanic/rooms/room_item.cpp index 9e0c699cc6..dce2bc093b 100644 --- a/engines/titanic/rooms/room_item.cpp +++ b/engines/titanic/rooms/room_item.cpp @@ -89,6 +89,7 @@ void CRoomItem::load(SimpleFile *file) { _roomRect.right = file->readNumber(); _roomRect.bottom = file->readNumber(); file->readBuffer(); + _roomNumber = file->readNumber(); break; default: -- cgit v1.2.3 From 8acf716d6554fdd7209ba6bb575891019941931e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 24 Feb 2016 20:39:12 -0500 Subject: TITANIC: Implemented CNodeItem class --- engines/titanic/module.mk | 1 + engines/titanic/objects/node_item.cpp | 54 ++++++++++++++++++++++++++++ engines/titanic/objects/node_item.h | 56 +++++++++++++++++++++++++++++ engines/titanic/objects/saveable_object.cpp | 19 +++++----- 4 files changed, 122 insertions(+), 8 deletions(-) create mode 100644 engines/titanic/objects/node_item.cpp create mode 100644 engines/titanic/objects/node_item.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 848c737b62..9dfbb2fd74 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -22,6 +22,7 @@ MODULE_OBJS := \ objects/message_target.o \ objects/movie_clip.o \ objects/named_item.o \ + objects/node_item.o \ objects/pet_control.o \ objects/project_item.o \ objects/resource_key.o \ diff --git a/engines/titanic/objects/node_item.cpp b/engines/titanic/objects/node_item.cpp new file mode 100644 index 0000000000..f2a55cf240 --- /dev/null +++ b/engines/titanic/objects/node_item.cpp @@ -0,0 +1,54 @@ +/* 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 "titanic/objects/node_item.h" + +namespace Titanic { + +CNodeItem::CNodeItem() : CNamedItem(), _field24(0), _field28(0), _field2C(0) { +} + +void CNodeItem::save(SimpleFile *file, int indent) const { + file->writeNumberLine(0, indent); + file->writeQuotedLine("N", indent); + file->writeNumberLine(_field24, indent + 1); + file->writeNumberLine(_field28, indent + 1); + + file->writeQuotedLine("N", indent); + file->writeNumberLine(_field2C, indent + 1); + + CNamedItem::save(file, indent); +} + +void CNodeItem::load(SimpleFile *file) { + file->readNumber(); + file->readBuffer(); + _field24 = file->readNumber(); + _field28 = file->readNumber(); + + file->readBuffer(); + _field2C = file->readNumber(); + + CNamedItem::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/objects/node_item.h b/engines/titanic/objects/node_item.h new file mode 100644 index 0000000000..bfb534881f --- /dev/null +++ b/engines/titanic/objects/node_item.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_NODE_ITEM_H +#define TITANIC_NODE_ITEM_H + +#include "titanic/objects/named_item.h" + +namespace Titanic { + +class CNodeItem : public CNamedItem { +private: + int _field24; + int _field28; + int _field2C; +public: + CNodeItem(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CNodeItem"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_FILE_ITEM_H */ diff --git a/engines/titanic/objects/saveable_object.cpp b/engines/titanic/objects/saveable_object.cpp index 45161be277..7e9aa4b9ab 100644 --- a/engines/titanic/objects/saveable_object.cpp +++ b/engines/titanic/objects/saveable_object.cpp @@ -25,6 +25,7 @@ #include "titanic/objects/list.h" #include "titanic/objects/message_target.h" #include "titanic/objects/movie_clip.h" +#include "titanic/objects/node_item.h" #include "titanic/objects/project_item.h" #include "titanic/objects/tree_item.h" #include "titanic/rooms/room_item.h" @@ -37,25 +38,27 @@ Common::HashMap * #define DEFFN(T) CSaveableObject *Function##T() { return new T(); } #define ADDFN(T) (*_classList)[#T] = Function##T +DEFFN(CFileItem); DEFFN(CFileListItem); DEFFN(CMessageTarget); -DEFFN(CTreeItem); -DEFFN(CFileItem); -DEFFN(CProjectItem); -DEFFN(CRoomItem); DEFFN(CMovieClip); DEFFN(CMovieClipList); +DEFFN(CNodeItem); +DEFFN(CProjectItem); +DEFFN(CRoomItem); +DEFFN(CTreeItem); void CSaveableObject::initClassList() { _classList = new Common::HashMap(); + ADDFN(CFileItem); ADDFN(CFileListItem); ADDFN(CMessageTarget); - ADDFN(CTreeItem); - ADDFN(CFileItem); - ADDFN(CProjectItem); - ADDFN(CRoomItem); ADDFN(CMovieClip); ADDFN(CMovieClipList); + ADDFN(CNodeItem); + ADDFN(CProjectItem); + ADDFN(CRoomItem); + ADDFN(CTreeItem); } void CSaveableObject::freeClassList() { -- cgit v1.2.3 From 25422a6520615cf5c5467654790e658085f28d95 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 24 Feb 2016 23:14:49 -0500 Subject: TITANIC: Implement CGameObject loading, CServiceElevatorDoro and ancestors --- engines/titanic/module.mk | 5 +- engines/titanic/objects/auto_sound_event.cpp | 46 ++++++++++++ engines/titanic/objects/auto_sound_event.h | 55 +++++++++++++++ engines/titanic/objects/game_object.cpp | 94 +++++++++++++++++++++++++ engines/titanic/objects/game_object.h | 47 +++++++++++++ engines/titanic/objects/resource_key.h | 2 + engines/titanic/objects/saveable_object.cpp | 3 + engines/titanic/rooms/door_auto_sound_event.cpp | 51 ++++++++++++++ engines/titanic/rooms/door_auto_sound_event.h | 57 +++++++++++++++ engines/titanic/rooms/service_elevator_door.cpp | 48 +++++++++++++ engines/titanic/rooms/service_elevator_door.h | 52 ++++++++++++++ engines/titanic/simple_file.cpp | 30 ++++++++ engines/titanic/simple_file.h | 21 ++++++ 13 files changed, 510 insertions(+), 1 deletion(-) create mode 100644 engines/titanic/objects/auto_sound_event.cpp create mode 100644 engines/titanic/objects/auto_sound_event.h create mode 100644 engines/titanic/rooms/door_auto_sound_event.cpp create mode 100644 engines/titanic/rooms/door_auto_sound_event.h create mode 100644 engines/titanic/rooms/service_elevator_door.cpp create mode 100644 engines/titanic/rooms/service_elevator_door.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 9dfbb2fd74..5dc7195426 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -15,6 +15,7 @@ MODULE_OBJS := \ string.o \ titanic.o \ video_surface.o \ + objects/auto_sound_event.o \ objects/dont_save_file_item.o \ objects/file_item.o \ objects/game_object.o \ @@ -28,7 +29,9 @@ MODULE_OBJS := \ objects/resource_key.o \ objects/saveable_object.o \ objects/tree_item.o \ - rooms/room_item.o + rooms/door_auto_sound_event.o \ + rooms/room_item.o \ + rooms/service_elevator_door.o # This module can be built as a plugin ifeq ($(ENABLE_TITANIC), DYNAMIC_PLUGIN) diff --git a/engines/titanic/objects/auto_sound_event.cpp b/engines/titanic/objects/auto_sound_event.cpp new file mode 100644 index 0000000000..7160ac7b24 --- /dev/null +++ b/engines/titanic/objects/auto_sound_event.cpp @@ -0,0 +1,46 @@ +/* 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 "titanic/objects/auto_sound_event.h" + +namespace Titanic { + +CAutoSoundEvent::CAutoSoundEvent() : CGameObject(), _fieldBC(-1), _fieldC0(0xFFFFFF) { +} + +void CAutoSoundEvent::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + + CGameObject::save(file, indent); +} + +void CAutoSoundEvent::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/objects/auto_sound_event.h b/engines/titanic/objects/auto_sound_event.h new file mode 100644 index 0000000000..bcfc6a49c6 --- /dev/null +++ b/engines/titanic/objects/auto_sound_event.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_AUTO_SOUND_EVENT_H +#define TITANIC_AUTO_SOUND_EVENT_H + +#include "titanic/objects/game_object.h" + +namespace Titanic { + +class CAutoSoundEvent : public CGameObject { +private: + int _fieldBC; + int _fieldC0; +public: + CAutoSoundEvent(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CAutoSoundEvent"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/objects/game_object.cpp b/engines/titanic/objects/game_object.cpp index a1e1faccce..2e35417bd5 100644 --- a/engines/titanic/objects/game_object.cpp +++ b/engines/titanic/objects/game_object.cpp @@ -21,7 +21,101 @@ */ #include "titanic/objects/game_object.h" +#include "titanic/objects/resource_key.h" namespace Titanic { +CGameObject::CGameObject(): CNamedItem() { + _bounds = Common::Rect(0, 0, 15, 15); + _field34 = 0; + _field38 = 0; + _field3C = 0; + _field40 = 0; + _field44 = 0xF0; + _field48 = 0xF0; + _field4C = 0xFF; + _field50 = 0; + _field54 = 0; + _field58 = 0; + _field5C = 1; + _field60 = 0; + _field74 = 1; + _field78 = 0; + _field8C = -1; + _field90 = 0; + _field94 = 0; + _field98 = 0; + _field9C = 0; + _fieldA0 = 0; + _fieldA4 = 0; + _fieldA8 = nullptr; + _fieldB8 = 0; +} + +void CGameObject::save(SimpleFile *file, int indent) const { + file->writeNumberLine(7, indent); + error("TODO: CGameObject::save"); + + CNamedItem::save(file, indent); +} + +void CGameObject::load(SimpleFile *file) { + int val = file->readNumber(); + CResourceKey resourceKey; + + switch (val) { + case 7: + _clipList2.load(file); + _field8C = file->readNumber(); + // Deliberate fall-through + + case 6: + val = _field74 = file->readNumber(); + // Deliberate fall-through + + case 5: + _clipList1.load(file); + // Deliberate fall-through + + case 4: + _field60 = file->readNumber(); + // Deliberate fall-through + + case 3: + _field40 = file->readNumber(); + // Deliberate fall-through + + case 2: + _string = file->readString(); + // Deliberate fall-through + + case 1: + _bounds = file->readRect(); + _field34 = file->readFloat(); + _field38 = file->readFloat(); + _field3C = file->readFloat(); + _field44 = file->readNumber(); + _field48 = file->readNumber(); + _field4C = file->readNumber(); + _fieldB8 = file->readNumber(); + _field5C = file->readNumber(); + _field50 = file->readNumber(); + _field54 = file->readNumber(); + _field58 = file->readNumber(); + + resourceKey.load(file); + _fieldA8 = nullptr; + val = file->readNumber(); + if (val) { + _string = resourceKey.getString(); + } + break; + + default: + break; + } + + CNamedItem::load(file); +} + } // End of namespace Titanic diff --git a/engines/titanic/objects/game_object.h b/engines/titanic/objects/game_object.h index 7e0fba6e87..53814f6d3d 100644 --- a/engines/titanic/objects/game_object.h +++ b/engines/titanic/objects/game_object.h @@ -23,11 +23,58 @@ #ifndef TITANIC_GAME_OBJECT_H #define TITANIC_GAME_OBJECT_H +#include "common/rect.h" +#include "titanic/objects/movie_clip.h" #include "titanic/objects/named_item.h" namespace Titanic { class CGameObject : public CNamedItem { +protected: + Common::Rect _bounds; + double _field34; + double _field38; + double _field3C; + int _field40; + int _field44; + int _field48; + int _field4C; + int _field50; + int _field54; + int _field58; + int _field5C; + int _field60; + CMovieClipList _clipList1; + int _field74; + int _field78; + CMovieClipList _clipList2; + int _field8C; + int _field90; + int _field94; + int _field98; + int _field9C; + int _fieldA0; + int _fieldA4; + void *_fieldA8; + CString _string; + int _fieldB8; +public: + CGameObject(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CGameObject"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); }; } // End of namespace Titanic diff --git a/engines/titanic/objects/resource_key.h b/engines/titanic/objects/resource_key.h index 4cb40cd568..9d1b70ffc9 100644 --- a/engines/titanic/objects/resource_key.h +++ b/engines/titanic/objects/resource_key.h @@ -47,6 +47,8 @@ public: * Load the data for the class from file */ virtual void load(SimpleFile *file); + + const CString &getString() const { return _key; } }; } // End of namespace Titanic diff --git a/engines/titanic/objects/saveable_object.cpp b/engines/titanic/objects/saveable_object.cpp index 7e9aa4b9ab..555394d45e 100644 --- a/engines/titanic/objects/saveable_object.cpp +++ b/engines/titanic/objects/saveable_object.cpp @@ -29,6 +29,7 @@ #include "titanic/objects/project_item.h" #include "titanic/objects/tree_item.h" #include "titanic/rooms/room_item.h" +#include "titanic/rooms/service_elevator_door.h" namespace Titanic { @@ -46,6 +47,7 @@ DEFFN(CMovieClipList); DEFFN(CNodeItem); DEFFN(CProjectItem); DEFFN(CRoomItem); +DEFFN(CServiceElevatorDoor); DEFFN(CTreeItem); void CSaveableObject::initClassList() { @@ -58,6 +60,7 @@ void CSaveableObject::initClassList() { ADDFN(CNodeItem); ADDFN(CProjectItem); ADDFN(CRoomItem); + ADDFN(CServiceElevatorDoor); ADDFN(CTreeItem); } diff --git a/engines/titanic/rooms/door_auto_sound_event.cpp b/engines/titanic/rooms/door_auto_sound_event.cpp new file mode 100644 index 0000000000..279f4f98e6 --- /dev/null +++ b/engines/titanic/rooms/door_auto_sound_event.cpp @@ -0,0 +1,51 @@ +/* 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 "titanic/rooms/door_auto_sound_event.h" + +namespace Titanic { + +CDoorAutoSoundEvent::CDoorAutoSoundEvent() : CAutoSoundEvent(), + _string1("z#44.wav"), _string2("z#43.wav"), _fieldDC(25), _fieldE0(25) { +} + +void CDoorAutoSoundEvent::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + file->writeNumberLine(_fieldDC, indent); + file->writeNumberLine(_fieldE0, indent); + + CAutoSoundEvent::save(file, indent); +} + +void CDoorAutoSoundEvent::load(SimpleFile *file) { + file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + _fieldDC = file->readNumber(); + _fieldE0 = file->readNumber(); + + CAutoSoundEvent::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/rooms/door_auto_sound_event.h b/engines/titanic/rooms/door_auto_sound_event.h new file mode 100644 index 0000000000..4f960273b5 --- /dev/null +++ b/engines/titanic/rooms/door_auto_sound_event.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_DOOR_AUTO_SOUND_EVENT_H +#define TITANIC_DOOR_AUTO_SOUND_EVENT_H + +#include "titanic/objects/auto_sound_event.h" + +namespace Titanic { + +class CDoorAutoSoundEvent : public CAutoSoundEvent { +protected: + CString _string1; + CString _string2; + int _fieldDC; + int _fieldE0; +public: + CDoorAutoSoundEvent(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CDoorAutoSoundEvent"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DOOR_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/rooms/service_elevator_door.cpp b/engines/titanic/rooms/service_elevator_door.cpp new file mode 100644 index 0000000000..931a9d6474 --- /dev/null +++ b/engines/titanic/rooms/service_elevator_door.cpp @@ -0,0 +1,48 @@ +/* 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 "titanic/rooms/service_elevator_door.h" + +namespace Titanic { + +CServiceElevatorDoor::CServiceElevatorDoor() : CDoorAutoSoundEvent() { + _string1 = "z#31.wav"; + _string2 = "z#32.wav"; +} + +void CServiceElevatorDoor::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string2, indent); + file->writeQuotedLine(_string1, indent); + + CDoorAutoSoundEvent::save(file, indent); +} + +void CServiceElevatorDoor::load(SimpleFile *file) { + file->readNumber(); + _string2 = file->readString(); + _string1 = file->readString(); + + CDoorAutoSoundEvent::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/rooms/service_elevator_door.h b/engines/titanic/rooms/service_elevator_door.h new file mode 100644 index 0000000000..5b924bc17c --- /dev/null +++ b/engines/titanic/rooms/service_elevator_door.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_SERVICE_ELEVATOR_DOOR_H +#define TITANIC_SERVICE_ELEVATOR_DOOR_H + +#include "titanic/rooms/door_auto_sound_event.h" + +namespace Titanic { + +class CServiceElevatorDoor : public CDoorAutoSoundEvent { +public: + CServiceElevatorDoor(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CServiceElevatorDoor"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SERVICE_ELEVATOR_DOOR_H */ diff --git a/engines/titanic/simple_file.cpp b/engines/titanic/simple_file.cpp index 521f9e9b99..045de1fe07 100644 --- a/engines/titanic/simple_file.cpp +++ b/engines/titanic/simple_file.cpp @@ -191,6 +191,24 @@ double SimpleFile::readFloat() { return floatValue; } +Common::Point SimpleFile::readPoint() { + Common::Point pt; + pt.x = readNumber(); + pt.y = readNumber(); + + return pt; +} + +Common::Rect SimpleFile::readRect() { + Common::Rect r; + r.left = readNumber(); + r.top = readNumber(); + r.right = readNumber(); + r.bottom = readNumber(); + + return r; +} + void SimpleFile::readBuffer(char *buffer, size_t count) { CString tempString = readString(); if (buffer) { @@ -264,6 +282,18 @@ void SimpleFile::writeNumberLine(int val, int indent) { write("\n", 1); } +void SimpleFile::writePoint(const Common::Point &pt, int indent) { + writeIndent(indent); + writeNumber(pt.x); + writeNumber(pt.y); + write("\n", 1); +} + +void SimpleFile::writeRect(const Common::Rect &r, int indent) { + writePoint(Common::Point(r.left, r.top), indent); + writePoint(Common::Point(r.right, r.bottom), indent); +} + void SimpleFile::writeIndent(uint indent) { for (uint idx = 0; idx < indent; ++idx) write("\t", 1); diff --git a/engines/titanic/simple_file.h b/engines/titanic/simple_file.h index 852c75b0f7..c5ca7016e7 100644 --- a/engines/titanic/simple_file.h +++ b/engines/titanic/simple_file.h @@ -26,6 +26,7 @@ #include "common/scummsys.h" #include "common/file.h" #include "common/queue.h" +#include "common/rect.h" #include "common/savefile.h" #include "titanic/string.h" @@ -94,6 +95,16 @@ public: */ double readFloat(); + /** + * Read in a point + */ + Common::Point readPoint(); + + /** + * Read in a rect + */ + Common::Rect readRect(); + /** * Read a string and copy it into an optionally passed buffer */ @@ -129,6 +140,16 @@ public: */ void writeNumberLine(int val, int indent); + /** + * Write out a point line + */ + void writePoint(const Common::Point &pt, int indent); + + /** + * Write out a rect line + */ + void writeRect(const Common::Rect &r, int indent); + /** * Write out a number of tabs to form an indent in the output */ -- cgit v1.2.3 From 45043cc6e1da458a16e64e55ef5bed624421794d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 24 Feb 2016 23:51:32 -0500 Subject: TITANIC: Added CViewItem class --- engines/titanic/module.mk | 1 + engines/titanic/objects/saveable_object.cpp | 4 +- engines/titanic/objects/view_item.cpp | 70 +++++++++++++++++++++++++++++ engines/titanic/objects/view_item.h | 62 +++++++++++++++++++++++++ engines/titanic/simple_file.cpp | 11 +++++ engines/titanic/simple_file.h | 10 +++++ 6 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 engines/titanic/objects/view_item.cpp create mode 100644 engines/titanic/objects/view_item.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 5dc7195426..b14ec0f601 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -29,6 +29,7 @@ MODULE_OBJS := \ objects/resource_key.o \ objects/saveable_object.o \ objects/tree_item.o \ + objects/view_item.o \ rooms/door_auto_sound_event.o \ rooms/room_item.o \ rooms/service_elevator_door.o diff --git a/engines/titanic/objects/saveable_object.cpp b/engines/titanic/objects/saveable_object.cpp index 555394d45e..cd5f7eba6e 100644 --- a/engines/titanic/objects/saveable_object.cpp +++ b/engines/titanic/objects/saveable_object.cpp @@ -28,6 +28,7 @@ #include "titanic/objects/node_item.h" #include "titanic/objects/project_item.h" #include "titanic/objects/tree_item.h" +#include "titanic/objects/view_item.h" #include "titanic/rooms/room_item.h" #include "titanic/rooms/service_elevator_door.h" @@ -49,6 +50,7 @@ DEFFN(CProjectItem); DEFFN(CRoomItem); DEFFN(CServiceElevatorDoor); DEFFN(CTreeItem); +DEFFN(CViewItem); void CSaveableObject::initClassList() { _classList = new Common::HashMap(); @@ -62,6 +64,7 @@ void CSaveableObject::initClassList() { ADDFN(CRoomItem); ADDFN(CServiceElevatorDoor); ADDFN(CTreeItem); + ADDFN(CViewItem); } void CSaveableObject::freeClassList() { @@ -69,7 +72,6 @@ void CSaveableObject::freeClassList() { } CSaveableObject *CSaveableObject::createInstance(const Common::String &name) { -warning("%s", name.c_str()); return (*_classList)[name](); } diff --git a/engines/titanic/objects/view_item.cpp b/engines/titanic/objects/view_item.cpp new file mode 100644 index 0000000000..1199ba9a62 --- /dev/null +++ b/engines/titanic/objects/view_item.cpp @@ -0,0 +1,70 @@ +/* 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 "titanic/objects/view_item.h" + +namespace Titanic { + +CViewItem::CViewItem() : CNamedItem() { + _field24 = 0; + _field28 = 0.0; + _field30 = 0; + _field50 = 0; + _field54 = 0; + setData(0.0); +} + +void CViewItem::setData(double v) { + _field28 = v; + _field50 = cos(_field28) * 30.0; + _field54 = sin(_field28) * -30.0; +} + +void CViewItem::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + _resourceKey.save(file, indent); + file->writeQuotedLine("V", indent); + file->writeFloatLine(_field28, indent + 1); + file->writeNumberLine(_field30, indent + 1); + + CNamedItem::save(file, indent); +} + +void CViewItem::load(SimpleFile *file) { + int val = file->readNumber(); + + switch (val) { + case 1: + _resourceKey.load(file); + // Deliberate fall-through + + default: + file->readBuffer(); + setData(file->readFloat()); + _field30 = file->readNumber(); + break; + } + + CNamedItem::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/objects/view_item.h b/engines/titanic/objects/view_item.h new file mode 100644 index 0000000000..1bd2d6d268 --- /dev/null +++ b/engines/titanic/objects/view_item.h @@ -0,0 +1,62 @@ +/* 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. + * + */ + +#ifndef TITANIC_VIEW_ITEM_H +#define TITANIC_VIEW_ITEM_H + +#include "titanic/objects/named_item.h" +#include "titanic/objects/resource_key.h" + +namespace Titanic { + +class CViewItem : public CNamedItem { +private: + void setData(double v); +protected: + int _field24; + double _field28; + int _field30; + CResourceKey _resourceKey; + int _field50; + int _field54; +public: + CViewItem(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CNamedItem"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_NAMED_ITEM_H */ diff --git a/engines/titanic/simple_file.cpp b/engines/titanic/simple_file.cpp index 045de1fe07..9bc365bf33 100644 --- a/engines/titanic/simple_file.cpp +++ b/engines/titanic/simple_file.cpp @@ -282,6 +282,17 @@ void SimpleFile::writeNumberLine(int val, int indent) { write("\n", 1); } +void SimpleFile::writeFloat(double val) { + Common::String valStr = Common::String::format("%f ", val); + write(valStr.c_str(), valStr.size()); +} + +void SimpleFile::writeFloatLine(double val, int indent) { + writeIndent(indent); + writeFloat(val); + write("\n", 1); +} + void SimpleFile::writePoint(const Common::Point &pt, int indent) { writeIndent(indent); writeNumber(pt.x); diff --git a/engines/titanic/simple_file.h b/engines/titanic/simple_file.h index c5ca7016e7..8ea2b5a35d 100644 --- a/engines/titanic/simple_file.h +++ b/engines/titanic/simple_file.h @@ -140,6 +140,16 @@ public: */ void writeNumberLine(int val, int indent); + /** + * Write a floating point number + */ + void writeFloat(double val); + + /** + * Write a floating point number as a line + */ + void writeFloatLine(double val, int indent); + /** * Write out a point line */ -- cgit v1.2.3 From f509f3322b54e2ffddc0244dca365756e0b47401 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 25 Feb 2016 07:40:04 -0500 Subject: TITANIC: Implemented CLinkItem class --- engines/titanic/module.mk | 1 + engines/titanic/objects/link_item.cpp | 100 ++++++++++++++++++++++++++++ engines/titanic/objects/link_item.h | 69 +++++++++++++++++++ engines/titanic/objects/saveable_object.cpp | 3 + 4 files changed, 173 insertions(+) create mode 100644 engines/titanic/objects/link_item.cpp create mode 100644 engines/titanic/objects/link_item.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index b14ec0f601..1120f699b0 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -19,6 +19,7 @@ MODULE_OBJS := \ objects/dont_save_file_item.o \ objects/file_item.o \ objects/game_object.o \ + objects/link_item.o \ objects/list.o \ objects/message_target.o \ objects/movie_clip.o \ diff --git a/engines/titanic/objects/link_item.cpp b/engines/titanic/objects/link_item.cpp new file mode 100644 index 0000000000..90774ad43c --- /dev/null +++ b/engines/titanic/objects/link_item.cpp @@ -0,0 +1,100 @@ +/* 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 "titanic/objects/link_item.h" + +namespace Titanic { + +CLinkItemSub::CLinkItemSub() : _field0(0), _field4(0), _field8(0), _fieldC(0) { +} + +CLinkItem::CLinkItem() : CNamedItem() { + _field24 = -1; + _field28 = -1; + _field2C = -1; + _field30 = 0; + _field34 = 1; + _name = "Link"; +} + +void CLinkItem::save(SimpleFile *file, int indent) const { + file->writeNumberLine(2, indent); + file->writeQuotedLine("L", indent); + file->writeNumberLine(_field34, indent + 1); + file->writeNumberLine(_field30, indent + 1); + file->writeNumberLine(_field24, indent + 1); + file->writeNumberLine(_field28, indent + 1); + file->writeNumberLine(_field2C, indent + 1); + + file->writeQuotedLine("Hotspot", indent + 1); + file->writeNumberLine(_sub._field0, indent + 2); + file->writeNumberLine(_sub._field4, indent + 2); + file->writeNumberLine(_sub._field8, indent + 2); + file->writeNumberLine(_sub._fieldC, indent + 2); + + CNamedItem::save(file, indent); +} + +void CLinkItem::load(SimpleFile *file) { + int val = file->readNumber(); + file->readBuffer(); + + switch (val) { + case 3: + _field34 = file->readNumber(); + // Deliberate fall-through + + case 1: + _field30 = file->readNumber(); + // Deliberate fall-through + + case 0: + _field24 = file->readNumber(); + _field28 = file->readNumber(); + _field2C = file->readNumber(); + break; + + default: + break; + } + + CNamedItem::load(file); + + if (val < 2) { + switch (_field30) { + case 2: + _field34 = 2; + break; + case 3: + _field34 = 3; + break; + case 5: + _field34 = 7; + break; + default: + _field34 = 4; + break; + } + } +} + +} // End of namespace Titanic diff --git a/engines/titanic/objects/link_item.h b/engines/titanic/objects/link_item.h new file mode 100644 index 0000000000..efe5ec1cf5 --- /dev/null +++ b/engines/titanic/objects/link_item.h @@ -0,0 +1,69 @@ +/* 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. + * + */ + +#ifndef TITANIC_LINK_ITEM_H +#define TITANIC_LINK_ITEM_H + +#include "titanic/objects/named_item.h" + +namespace Titanic { + +class CLinkItemSub { +public: + int _field0; + int _field4; + int _field8; + int _fieldC; +public: + CLinkItemSub(); +}; + +class CLinkItem : public CNamedItem { +protected: + int _field24; + int _field28; + int _field2C; + int _field30; + int _field34; + CLinkItemSub _sub; +public: + CLinkItem(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CLinkItem"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_LINK_ITEM_H */ diff --git a/engines/titanic/objects/saveable_object.cpp b/engines/titanic/objects/saveable_object.cpp index cd5f7eba6e..b6611680ed 100644 --- a/engines/titanic/objects/saveable_object.cpp +++ b/engines/titanic/objects/saveable_object.cpp @@ -22,6 +22,7 @@ #include "titanic/objects/saveable_object.h" #include "titanic/objects/file_item.h" +#include "titanic/objects/link_item.h" #include "titanic/objects/list.h" #include "titanic/objects/message_target.h" #include "titanic/objects/movie_clip.h" @@ -42,6 +43,7 @@ Common::HashMap * DEFFN(CFileItem); DEFFN(CFileListItem); +DEFFN(CLinkItem); DEFFN(CMessageTarget); DEFFN(CMovieClip); DEFFN(CMovieClipList); @@ -56,6 +58,7 @@ void CSaveableObject::initClassList() { _classList = new Common::HashMap(); ADDFN(CFileItem); ADDFN(CFileListItem); + ADDFN(CLinkItem); ADDFN(CMessageTarget); ADDFN(CMovieClip); ADDFN(CMovieClipList); -- cgit v1.2.3 From 27f5f9e926159186da254a00a8bedc6dd028d2f4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 25 Feb 2016 07:50:44 -0500 Subject: TITANIC: Fix loading CLinkItem --- engines/titanic/objects/link_item.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/engines/titanic/objects/link_item.cpp b/engines/titanic/objects/link_item.cpp index 90774ad43c..fe2a7cf162 100644 --- a/engines/titanic/objects/link_item.cpp +++ b/engines/titanic/objects/link_item.cpp @@ -59,7 +59,7 @@ void CLinkItem::load(SimpleFile *file) { file->readBuffer(); switch (val) { - case 3: + case 2: _field34 = file->readNumber(); // Deliberate fall-through @@ -71,6 +71,12 @@ void CLinkItem::load(SimpleFile *file) { _field24 = file->readNumber(); _field28 = file->readNumber(); _field2C = file->readNumber(); + + file->readBuffer(); + _sub._field0 = file->readNumber(); + _sub._field4 = file->readNumber(); + _sub._field8 = file->readNumber(); + _sub._fieldC = file->readNumber(); break; default: -- cgit v1.2.3 From 906aa791ee337f86dc7565e980afa395df5e9fdb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 25 Feb 2016 08:39:15 -0500 Subject: TITANIC: Implemented CAnnounce, CPETPosition, CSUBGlass --- engines/titanic/module.mk | 5 ++- engines/titanic/objects/saveable_object.cpp | 10 +++++ engines/titanic/rooms/announce.cpp | 50 ++++++++++++++++++++++++ engines/titanic/rooms/announce.h | 57 ++++++++++++++++++++++++++++ engines/titanic/rooms/pet_position.cpp | 37 ++++++++++++++++++ engines/titanic/rooms/pet_position.h | 50 ++++++++++++++++++++++++ engines/titanic/rooms/sub_glass.cpp | 54 ++++++++++++++++++++++++++ engines/titanic/rooms/sub_glass.h | 59 +++++++++++++++++++++++++++++ 8 files changed, 321 insertions(+), 1 deletion(-) create mode 100644 engines/titanic/rooms/announce.cpp create mode 100644 engines/titanic/rooms/announce.h create mode 100644 engines/titanic/rooms/pet_position.cpp create mode 100644 engines/titanic/rooms/pet_position.h create mode 100644 engines/titanic/rooms/sub_glass.cpp create mode 100644 engines/titanic/rooms/sub_glass.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 1120f699b0..e74e8114f4 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -31,9 +31,12 @@ MODULE_OBJS := \ objects/saveable_object.o \ objects/tree_item.o \ objects/view_item.o \ + rooms/announce.o \ rooms/door_auto_sound_event.o \ + rooms/pet_position.o \ rooms/room_item.o \ - rooms/service_elevator_door.o + rooms/service_elevator_door.o \ + rooms/sub_glass.o # This module can be built as a plugin ifeq ($(ENABLE_TITANIC), DYNAMIC_PLUGIN) diff --git a/engines/titanic/objects/saveable_object.cpp b/engines/titanic/objects/saveable_object.cpp index b6611680ed..73980d159b 100644 --- a/engines/titanic/objects/saveable_object.cpp +++ b/engines/titanic/objects/saveable_object.cpp @@ -28,10 +28,14 @@ #include "titanic/objects/movie_clip.h" #include "titanic/objects/node_item.h" #include "titanic/objects/project_item.h" +#include "titanic/objects/saveable_object.h" #include "titanic/objects/tree_item.h" #include "titanic/objects/view_item.h" +#include "titanic/rooms/announce.h" +#include "titanic/rooms/pet_position.h" #include "titanic/rooms/room_item.h" #include "titanic/rooms/service_elevator_door.h" +#include "titanic/rooms/sub_glass.h" namespace Titanic { @@ -41,6 +45,7 @@ Common::HashMap * #define DEFFN(T) CSaveableObject *Function##T() { return new T(); } #define ADDFN(T) (*_classList)[#T] = Function##T +DEFFN(CAnnounce); DEFFN(CFileItem); DEFFN(CFileListItem); DEFFN(CLinkItem); @@ -48,14 +53,17 @@ DEFFN(CMessageTarget); DEFFN(CMovieClip); DEFFN(CMovieClipList); DEFFN(CNodeItem); +DEFFN(CPETPosition); DEFFN(CProjectItem); DEFFN(CRoomItem); DEFFN(CServiceElevatorDoor); +DEFFN(CSUBGlass); DEFFN(CTreeItem); DEFFN(CViewItem); void CSaveableObject::initClassList() { _classList = new Common::HashMap(); + ADDFN(CAnnounce); ADDFN(CFileItem); ADDFN(CFileListItem); ADDFN(CLinkItem); @@ -63,9 +71,11 @@ void CSaveableObject::initClassList() { ADDFN(CMovieClip); ADDFN(CMovieClipList); ADDFN(CNodeItem); + ADDFN(CPETPosition); ADDFN(CProjectItem); ADDFN(CRoomItem); ADDFN(CServiceElevatorDoor); + ADDFN(CSUBGlass); ADDFN(CTreeItem); ADDFN(CViewItem); } diff --git a/engines/titanic/rooms/announce.cpp b/engines/titanic/rooms/announce.cpp new file mode 100644 index 0000000000..b79056637b --- /dev/null +++ b/engines/titanic/rooms/announce.cpp @@ -0,0 +1,50 @@ +/* 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 "titanic/rooms/announce.h" + +namespace Titanic { + +CAnnounce::CAnnounce() : _fieldBC(0), _fieldC0(0), _fieldC4(1), _fieldC8(0) { +} + +void CAnnounce::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_fieldC4, indent); + file->writeNumberLine(_fieldC8, indent); + + CGameObject::save(file, indent); +} + +void CAnnounce::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _fieldC4 = file->readNumber(); + _fieldC8 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/rooms/announce.h b/engines/titanic/rooms/announce.h new file mode 100644 index 0000000000..58f928d559 --- /dev/null +++ b/engines/titanic/rooms/announce.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_ANNOUNCE_H +#define TITANIC_ANNOUNCE_H + +#include "titanic/objects/game_object.h" + +namespace Titanic { + +class CAnnounce : public CGameObject { +private: + int _fieldBC; + int _fieldC0; + int _fieldC4; + int _fieldC8; +public: + CAnnounce(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CAnnounce"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ROOM_ITEM_H */ diff --git a/engines/titanic/rooms/pet_position.cpp b/engines/titanic/rooms/pet_position.cpp new file mode 100644 index 0000000000..b5bf2e6c01 --- /dev/null +++ b/engines/titanic/rooms/pet_position.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/rooms/pet_position.h" + +namespace Titanic { + +void CPETPosition::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPETPosition::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/rooms/pet_position.h b/engines/titanic/rooms/pet_position.h new file mode 100644 index 0000000000..dc27377eec --- /dev/null +++ b/engines/titanic/rooms/pet_position.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_POSITION_H +#define TITANIC_PET_POSITION_H + +#include "titanic/objects/game_object.h" + +namespace Titanic { + +class CPETPosition : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPETPosition"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ROOM_ITEM_H */ diff --git a/engines/titanic/rooms/sub_glass.cpp b/engines/titanic/rooms/sub_glass.cpp new file mode 100644 index 0000000000..27f47fd017 --- /dev/null +++ b/engines/titanic/rooms/sub_glass.cpp @@ -0,0 +1,54 @@ +/* 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 "titanic/rooms/sub_glass.h" + +namespace Titanic { + +CSUBGlass::CSUBGlass() : _fieldBC(0), _fieldC0(0), _fieldC4(1), _fieldC8(0) { +} + +void CSUBGlass::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_fieldC4, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeNumberLine(_fieldCC, indent); + file->writeQuotedLine(_string, indent); + + CGameObject::save(file, indent); +} + +void CSUBGlass::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _fieldC4 = file->readNumber(); + _fieldC8 = file->readNumber(); + _fieldCC = file->readNumber(); + _string = file->readString(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/rooms/sub_glass.h b/engines/titanic/rooms/sub_glass.h new file mode 100644 index 0000000000..b7a992db9c --- /dev/null +++ b/engines/titanic/rooms/sub_glass.h @@ -0,0 +1,59 @@ +/* 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. + * + */ + +#ifndef TITANIC_SUB_GLASS_H +#define TITANIC_SUB_GLASS_H + +#include "titanic/objects/game_object.h" + +namespace Titanic { + +class CSUBGlass : public CGameObject { +private: + int _fieldBC; + int _fieldC0; + int _fieldC4; + int _fieldC8; + int _fieldCC; + CString _string; +public: + CSUBGlass(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSUBGlass"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ROOM_ITEM_H */ -- cgit v1.2.3 From 63db0980e5f48764667863afe15b8f43b386c1a8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 25 Feb 2016 08:48:21 -0500 Subject: TITANIC: Rename of sub-folders for better clarity --- engines/titanic/core/auto_sound_event.cpp | 46 ++++ engines/titanic/core/auto_sound_event.h | 55 +++++ engines/titanic/core/dont_save_file_item.cpp | 35 +++ engines/titanic/core/dont_save_file_item.h | 50 ++++ engines/titanic/core/file_item.cpp | 47 ++++ engines/titanic/core/file_item.h | 69 ++++++ engines/titanic/core/game_object.cpp | 121 ++++++++++ engines/titanic/core/game_object.h | 82 +++++++ engines/titanic/core/link_item.cpp | 106 +++++++++ engines/titanic/core/link_item.h | 69 ++++++ engines/titanic/core/list.cpp | 35 +++ engines/titanic/core/list.h | 139 +++++++++++ engines/titanic/core/message_target.cpp | 37 +++ engines/titanic/core/message_target.h | 51 ++++ engines/titanic/core/movie_clip.cpp | 69 ++++++ engines/titanic/core/movie_clip.h | 74 ++++++ engines/titanic/core/named_item.cpp | 42 ++++ engines/titanic/core/named_item.h | 52 +++++ engines/titanic/core/node_item.cpp | 54 +++++ engines/titanic/core/node_item.h | 56 +++++ engines/titanic/core/pet_control.cpp | 31 +++ engines/titanic/core/pet_control.h | 40 ++++ engines/titanic/core/project_item.cpp | 294 ++++++++++++++++++++++++ engines/titanic/core/project_item.h | 150 ++++++++++++ engines/titanic/core/resource_key.cpp | 47 ++++ engines/titanic/core/resource_key.h | 56 +++++ engines/titanic/core/saveable_object.cpp | 107 +++++++++ engines/titanic/core/saveable_object.h | 83 +++++++ engines/titanic/core/tree_item.cpp | 151 ++++++++++++ engines/titanic/core/tree_item.h | 141 ++++++++++++ engines/titanic/core/view_item.cpp | 70 ++++++ engines/titanic/core/view_item.h | 62 +++++ engines/titanic/game/announce.cpp | 50 ++++ engines/titanic/game/announce.h | 57 +++++ engines/titanic/game/door_auto_sound_event.cpp | 51 ++++ engines/titanic/game/door_auto_sound_event.h | 57 +++++ engines/titanic/game/pet_position.cpp | 37 +++ engines/titanic/game/pet_position.h | 50 ++++ engines/titanic/game/room_item.cpp | 106 +++++++++ engines/titanic/game/room_item.h | 65 ++++++ engines/titanic/game/service_elevator_door.cpp | 48 ++++ engines/titanic/game/service_elevator_door.h | 52 +++++ engines/titanic/game/sub_glass.cpp | 54 +++++ engines/titanic/game/sub_glass.h | 59 +++++ engines/titanic/game/succubus.cpp | 54 +++++ engines/titanic/game/succubus.h | 59 +++++ engines/titanic/main_game_window.h | 2 +- engines/titanic/module.mk | 44 ++-- engines/titanic/objects/auto_sound_event.cpp | 46 ---- engines/titanic/objects/auto_sound_event.h | 55 ----- engines/titanic/objects/dont_save_file_item.cpp | 35 --- engines/titanic/objects/dont_save_file_item.h | 50 ---- engines/titanic/objects/file_item.cpp | 47 ---- engines/titanic/objects/file_item.h | 69 ------ engines/titanic/objects/game_object.cpp | 121 ---------- engines/titanic/objects/game_object.h | 82 ------- engines/titanic/objects/link_item.cpp | 106 --------- engines/titanic/objects/link_item.h | 69 ------ engines/titanic/objects/list.cpp | 35 --- engines/titanic/objects/list.h | 139 ----------- engines/titanic/objects/message_target.cpp | 37 --- engines/titanic/objects/message_target.h | 51 ---- engines/titanic/objects/movie_clip.cpp | 69 ------ engines/titanic/objects/movie_clip.h | 74 ------ engines/titanic/objects/named_item.cpp | 42 ---- engines/titanic/objects/named_item.h | 52 ----- engines/titanic/objects/node_item.cpp | 54 ----- engines/titanic/objects/node_item.h | 56 ----- engines/titanic/objects/pet_control.cpp | 31 --- engines/titanic/objects/pet_control.h | 40 ---- engines/titanic/objects/project_item.cpp | 294 ------------------------ engines/titanic/objects/project_item.h | 150 ------------ engines/titanic/objects/resource_key.cpp | 47 ---- engines/titanic/objects/resource_key.h | 56 ----- engines/titanic/objects/saveable_object.cpp | 107 --------- engines/titanic/objects/saveable_object.h | 83 ------- engines/titanic/objects/tree_item.cpp | 151 ------------ engines/titanic/objects/tree_item.h | 141 ------------ engines/titanic/objects/view_item.cpp | 70 ------ engines/titanic/objects/view_item.h | 62 ----- engines/titanic/rooms/announce.cpp | 50 ---- engines/titanic/rooms/announce.h | 57 ----- engines/titanic/rooms/door_auto_sound_event.cpp | 51 ---- engines/titanic/rooms/door_auto_sound_event.h | 57 ----- engines/titanic/rooms/pet_position.cpp | 37 --- engines/titanic/rooms/pet_position.h | 50 ---- engines/titanic/rooms/room_item.cpp | 106 --------- engines/titanic/rooms/room_item.h | 65 ------ engines/titanic/rooms/service_elevator_door.cpp | 48 ---- engines/titanic/rooms/service_elevator_door.h | 52 ----- engines/titanic/rooms/sub_glass.cpp | 54 ----- engines/titanic/rooms/sub_glass.h | 59 ----- engines/titanic/titanic.cpp | 2 +- 93 files changed, 3344 insertions(+), 3231 deletions(-) create mode 100644 engines/titanic/core/auto_sound_event.cpp create mode 100644 engines/titanic/core/auto_sound_event.h create mode 100644 engines/titanic/core/dont_save_file_item.cpp create mode 100644 engines/titanic/core/dont_save_file_item.h create mode 100644 engines/titanic/core/file_item.cpp create mode 100644 engines/titanic/core/file_item.h create mode 100644 engines/titanic/core/game_object.cpp create mode 100644 engines/titanic/core/game_object.h create mode 100644 engines/titanic/core/link_item.cpp create mode 100644 engines/titanic/core/link_item.h create mode 100644 engines/titanic/core/list.cpp create mode 100644 engines/titanic/core/list.h create mode 100644 engines/titanic/core/message_target.cpp create mode 100644 engines/titanic/core/message_target.h create mode 100644 engines/titanic/core/movie_clip.cpp create mode 100644 engines/titanic/core/movie_clip.h create mode 100644 engines/titanic/core/named_item.cpp create mode 100644 engines/titanic/core/named_item.h create mode 100644 engines/titanic/core/node_item.cpp create mode 100644 engines/titanic/core/node_item.h create mode 100644 engines/titanic/core/pet_control.cpp create mode 100644 engines/titanic/core/pet_control.h create mode 100644 engines/titanic/core/project_item.cpp create mode 100644 engines/titanic/core/project_item.h create mode 100644 engines/titanic/core/resource_key.cpp create mode 100644 engines/titanic/core/resource_key.h create mode 100644 engines/titanic/core/saveable_object.cpp create mode 100644 engines/titanic/core/saveable_object.h create mode 100644 engines/titanic/core/tree_item.cpp create mode 100644 engines/titanic/core/tree_item.h create mode 100644 engines/titanic/core/view_item.cpp create mode 100644 engines/titanic/core/view_item.h create mode 100644 engines/titanic/game/announce.cpp create mode 100644 engines/titanic/game/announce.h create mode 100644 engines/titanic/game/door_auto_sound_event.cpp create mode 100644 engines/titanic/game/door_auto_sound_event.h create mode 100644 engines/titanic/game/pet_position.cpp create mode 100644 engines/titanic/game/pet_position.h create mode 100644 engines/titanic/game/room_item.cpp create mode 100644 engines/titanic/game/room_item.h create mode 100644 engines/titanic/game/service_elevator_door.cpp create mode 100644 engines/titanic/game/service_elevator_door.h create mode 100644 engines/titanic/game/sub_glass.cpp create mode 100644 engines/titanic/game/sub_glass.h create mode 100644 engines/titanic/game/succubus.cpp create mode 100644 engines/titanic/game/succubus.h delete mode 100644 engines/titanic/objects/auto_sound_event.cpp delete mode 100644 engines/titanic/objects/auto_sound_event.h delete mode 100644 engines/titanic/objects/dont_save_file_item.cpp delete mode 100644 engines/titanic/objects/dont_save_file_item.h delete mode 100644 engines/titanic/objects/file_item.cpp delete mode 100644 engines/titanic/objects/file_item.h delete mode 100644 engines/titanic/objects/game_object.cpp delete mode 100644 engines/titanic/objects/game_object.h delete mode 100644 engines/titanic/objects/link_item.cpp delete mode 100644 engines/titanic/objects/link_item.h delete mode 100644 engines/titanic/objects/list.cpp delete mode 100644 engines/titanic/objects/list.h delete mode 100644 engines/titanic/objects/message_target.cpp delete mode 100644 engines/titanic/objects/message_target.h delete mode 100644 engines/titanic/objects/movie_clip.cpp delete mode 100644 engines/titanic/objects/movie_clip.h delete mode 100644 engines/titanic/objects/named_item.cpp delete mode 100644 engines/titanic/objects/named_item.h delete mode 100644 engines/titanic/objects/node_item.cpp delete mode 100644 engines/titanic/objects/node_item.h delete mode 100644 engines/titanic/objects/pet_control.cpp delete mode 100644 engines/titanic/objects/pet_control.h delete mode 100644 engines/titanic/objects/project_item.cpp delete mode 100644 engines/titanic/objects/project_item.h delete mode 100644 engines/titanic/objects/resource_key.cpp delete mode 100644 engines/titanic/objects/resource_key.h delete mode 100644 engines/titanic/objects/saveable_object.cpp delete mode 100644 engines/titanic/objects/saveable_object.h delete mode 100644 engines/titanic/objects/tree_item.cpp delete mode 100644 engines/titanic/objects/tree_item.h delete mode 100644 engines/titanic/objects/view_item.cpp delete mode 100644 engines/titanic/objects/view_item.h delete mode 100644 engines/titanic/rooms/announce.cpp delete mode 100644 engines/titanic/rooms/announce.h delete mode 100644 engines/titanic/rooms/door_auto_sound_event.cpp delete mode 100644 engines/titanic/rooms/door_auto_sound_event.h delete mode 100644 engines/titanic/rooms/pet_position.cpp delete mode 100644 engines/titanic/rooms/pet_position.h delete mode 100644 engines/titanic/rooms/room_item.cpp delete mode 100644 engines/titanic/rooms/room_item.h delete mode 100644 engines/titanic/rooms/service_elevator_door.cpp delete mode 100644 engines/titanic/rooms/service_elevator_door.h delete mode 100644 engines/titanic/rooms/sub_glass.cpp delete mode 100644 engines/titanic/rooms/sub_glass.h diff --git a/engines/titanic/core/auto_sound_event.cpp b/engines/titanic/core/auto_sound_event.cpp new file mode 100644 index 0000000000..1bd5f5473a --- /dev/null +++ b/engines/titanic/core/auto_sound_event.cpp @@ -0,0 +1,46 @@ +/* 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 "titanic/core/auto_sound_event.h" + +namespace Titanic { + +CAutoSoundEvent::CAutoSoundEvent() : CGameObject(), _fieldBC(-1), _fieldC0(0xFFFFFF) { +} + +void CAutoSoundEvent::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + + CGameObject::save(file, indent); +} + +void CAutoSoundEvent::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/core/auto_sound_event.h b/engines/titanic/core/auto_sound_event.h new file mode 100644 index 0000000000..4180a68aa2 --- /dev/null +++ b/engines/titanic/core/auto_sound_event.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_AUTO_SOUND_EVENT_H +#define TITANIC_AUTO_SOUND_EVENT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CAutoSoundEvent : public CGameObject { +private: + int _fieldBC; + int _fieldC0; +public: + CAutoSoundEvent(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CAutoSoundEvent"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/core/dont_save_file_item.cpp b/engines/titanic/core/dont_save_file_item.cpp new file mode 100644 index 0000000000..389cef5a9c --- /dev/null +++ b/engines/titanic/core/dont_save_file_item.cpp @@ -0,0 +1,35 @@ +/* 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 "titanic/core/dont_save_file_item.h" + +namespace Titanic { + +void CDontSaveFileItem::save(SimpleFile *file, int indent) const { + file->writeNumberLine(0, indent); +} + +void CDontSaveFileItem::load(SimpleFile *file) { + file->readNumber(); +} + +} // End of namespace Titanic diff --git a/engines/titanic/core/dont_save_file_item.h b/engines/titanic/core/dont_save_file_item.h new file mode 100644 index 0000000000..f2b321c4fc --- /dev/null +++ b/engines/titanic/core/dont_save_file_item.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_DONT_SAVE_FILE_ITEM_H +#define TITANIC_DONT_SAVE_FILE_ITEM_H + +#include "titanic/core/file_item.h" + +namespace Titanic { + +class CDontSaveFileItem : public CFileItem { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CDontSaveFileItem"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DONT_SAVE_FILE_ITEM_H */ diff --git a/engines/titanic/core/file_item.cpp b/engines/titanic/core/file_item.cpp new file mode 100644 index 0000000000..0d3316dbf3 --- /dev/null +++ b/engines/titanic/core/file_item.cpp @@ -0,0 +1,47 @@ +/* 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 "titanic/core/file_item.h" + +namespace Titanic { + +void CFileItem::save(SimpleFile *file, int indent) const { + file->writeNumberLine(0, indent); + CTreeItem::save(file, indent); +} + +void CFileItem::load(SimpleFile *file) { + file->readNumber(); + + CTreeItem::load(file); +} + +CString CFileItem::formFilename() const { + return ""; +} + +CString CFileItem::getFilename() const { + //dynamic_cast(getRoot())->formDataPath(); + return _filename; +} + +} // End of namespace Titanic diff --git a/engines/titanic/core/file_item.h b/engines/titanic/core/file_item.h new file mode 100644 index 0000000000..0795b05d11 --- /dev/null +++ b/engines/titanic/core/file_item.h @@ -0,0 +1,69 @@ +/* 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. + * + */ + +#ifndef TITANIC_FILE_ITEM_H +#define TITANIC_FILE_ITEM_H + +#include "titanic/string.h" +#include "titanic/core/list.h" +#include "titanic/core/tree_item.h" + +namespace Titanic { + +class CFileItem: public CTreeItem { +private: + CString _filename; +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CFileItem"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); + + /** + * Returns true if the item is a file item + */ + virtual bool isFileItem() const { return true; } + + /** + * Form a filename for the file item + */ + CString formFilename() const; + + /** + * Get a string? + */ + CString getFilename() const; +}; + +} // End of namespace Titanic + +#endif /* TITANIC_FILE_ITEM_H */ diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp new file mode 100644 index 0000000000..3238258a61 --- /dev/null +++ b/engines/titanic/core/game_object.cpp @@ -0,0 +1,121 @@ +/* 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 "titanic/core/game_object.h" +#include "titanic/core/resource_key.h" + +namespace Titanic { + +CGameObject::CGameObject(): CNamedItem() { + _bounds = Common::Rect(0, 0, 15, 15); + _field34 = 0; + _field38 = 0; + _field3C = 0; + _field40 = 0; + _field44 = 0xF0; + _field48 = 0xF0; + _field4C = 0xFF; + _field50 = 0; + _field54 = 0; + _field58 = 0; + _field5C = 1; + _field60 = 0; + _field74 = 1; + _field78 = 0; + _field8C = -1; + _field90 = 0; + _field94 = 0; + _field98 = 0; + _field9C = 0; + _fieldA0 = 0; + _fieldA4 = 0; + _fieldA8 = nullptr; + _fieldB8 = 0; +} + +void CGameObject::save(SimpleFile *file, int indent) const { + file->writeNumberLine(7, indent); + error("TODO: CGameObject::save"); + + CNamedItem::save(file, indent); +} + +void CGameObject::load(SimpleFile *file) { + int val = file->readNumber(); + CResourceKey resourceKey; + + switch (val) { + case 7: + _clipList2.load(file); + _field8C = file->readNumber(); + // Deliberate fall-through + + case 6: + val = _field74 = file->readNumber(); + // Deliberate fall-through + + case 5: + _clipList1.load(file); + // Deliberate fall-through + + case 4: + _field60 = file->readNumber(); + // Deliberate fall-through + + case 3: + _field40 = file->readNumber(); + // Deliberate fall-through + + case 2: + _string = file->readString(); + // Deliberate fall-through + + case 1: + _bounds = file->readRect(); + _field34 = file->readFloat(); + _field38 = file->readFloat(); + _field3C = file->readFloat(); + _field44 = file->readNumber(); + _field48 = file->readNumber(); + _field4C = file->readNumber(); + _fieldB8 = file->readNumber(); + _field5C = file->readNumber(); + _field50 = file->readNumber(); + _field54 = file->readNumber(); + _field58 = file->readNumber(); + + resourceKey.load(file); + _fieldA8 = nullptr; + val = file->readNumber(); + if (val) { + _string = resourceKey.getString(); + } + break; + + default: + break; + } + + CNamedItem::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h new file mode 100644 index 0000000000..7d15882884 --- /dev/null +++ b/engines/titanic/core/game_object.h @@ -0,0 +1,82 @@ +/* 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. + * + */ + +#ifndef TITANIC_GAME_OBJECT_H +#define TITANIC_GAME_OBJECT_H + +#include "common/rect.h" +#include "titanic/core/movie_clip.h" +#include "titanic/core/named_item.h" + +namespace Titanic { + +class CGameObject : public CNamedItem { +protected: + Common::Rect _bounds; + double _field34; + double _field38; + double _field3C; + int _field40; + int _field44; + int _field48; + int _field4C; + int _field50; + int _field54; + int _field58; + int _field5C; + int _field60; + CMovieClipList _clipList1; + int _field74; + int _field78; + CMovieClipList _clipList2; + int _field8C; + int _field90; + int _field94; + int _field98; + int _field9C; + int _fieldA0; + int _fieldA4; + void *_fieldA8; + CString _string; + int _fieldB8; +public: + CGameObject(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CGameObject"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_H */ diff --git a/engines/titanic/core/link_item.cpp b/engines/titanic/core/link_item.cpp new file mode 100644 index 0000000000..1d85dfaa7b --- /dev/null +++ b/engines/titanic/core/link_item.cpp @@ -0,0 +1,106 @@ +/* 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 "titanic/core/link_item.h" + +namespace Titanic { + +CLinkItemSub::CLinkItemSub() : _field0(0), _field4(0), _field8(0), _fieldC(0) { +} + +CLinkItem::CLinkItem() : CNamedItem() { + _field24 = -1; + _field28 = -1; + _field2C = -1; + _field30 = 0; + _field34 = 1; + _name = "Link"; +} + +void CLinkItem::save(SimpleFile *file, int indent) const { + file->writeNumberLine(2, indent); + file->writeQuotedLine("L", indent); + file->writeNumberLine(_field34, indent + 1); + file->writeNumberLine(_field30, indent + 1); + file->writeNumberLine(_field24, indent + 1); + file->writeNumberLine(_field28, indent + 1); + file->writeNumberLine(_field2C, indent + 1); + + file->writeQuotedLine("Hotspot", indent + 1); + file->writeNumberLine(_sub._field0, indent + 2); + file->writeNumberLine(_sub._field4, indent + 2); + file->writeNumberLine(_sub._field8, indent + 2); + file->writeNumberLine(_sub._fieldC, indent + 2); + + CNamedItem::save(file, indent); +} + +void CLinkItem::load(SimpleFile *file) { + int val = file->readNumber(); + file->readBuffer(); + + switch (val) { + case 2: + _field34 = file->readNumber(); + // Deliberate fall-through + + case 1: + _field30 = file->readNumber(); + // Deliberate fall-through + + case 0: + _field24 = file->readNumber(); + _field28 = file->readNumber(); + _field2C = file->readNumber(); + + file->readBuffer(); + _sub._field0 = file->readNumber(); + _sub._field4 = file->readNumber(); + _sub._field8 = file->readNumber(); + _sub._fieldC = file->readNumber(); + break; + + default: + break; + } + + CNamedItem::load(file); + + if (val < 2) { + switch (_field30) { + case 2: + _field34 = 2; + break; + case 3: + _field34 = 3; + break; + case 5: + _field34 = 7; + break; + default: + _field34 = 4; + break; + } + } +} + +} // End of namespace Titanic diff --git a/engines/titanic/core/link_item.h b/engines/titanic/core/link_item.h new file mode 100644 index 0000000000..22c07a2132 --- /dev/null +++ b/engines/titanic/core/link_item.h @@ -0,0 +1,69 @@ +/* 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. + * + */ + +#ifndef TITANIC_LINK_ITEM_H +#define TITANIC_LINK_ITEM_H + +#include "titanic/core/named_item.h" + +namespace Titanic { + +class CLinkItemSub { +public: + int _field0; + int _field4; + int _field8; + int _fieldC; +public: + CLinkItemSub(); +}; + +class CLinkItem : public CNamedItem { +protected: + int _field24; + int _field28; + int _field2C; + int _field30; + int _field34; + CLinkItemSub _sub; +public: + CLinkItem(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CLinkItem"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_LINK_ITEM_H */ diff --git a/engines/titanic/core/list.cpp b/engines/titanic/core/list.cpp new file mode 100644 index 0000000000..d733ce25c5 --- /dev/null +++ b/engines/titanic/core/list.cpp @@ -0,0 +1,35 @@ +/* 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 "titanic/core/list.h" + +namespace Titanic { + +void ListItem::save(SimpleFile *file, int indent) const { + file->writeNumberLine(0, indent); +} + +void ListItem::load(SimpleFile *file) { + file->readNumber(); +} + +} // End of namespace Titanic diff --git a/engines/titanic/core/list.h b/engines/titanic/core/list.h new file mode 100644 index 0000000000..d990aec2fa --- /dev/null +++ b/engines/titanic/core/list.h @@ -0,0 +1,139 @@ +/* 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. + * + */ + +#ifndef TITANIC_LIST_H +#define TITANIC_LIST_H + +#include "common/scummsys.h" +#include "common/list.h" +#include "titanic/simple_file.h" +#include "titanic/core/saveable_object.h" + +namespace Titanic { + +/** + * Base list item class + */ +class ListItem: public CSaveableObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "ListItem"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +template +class List : public CSaveableObject, public Common::List { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return nullptr; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const { + file->writeNumberLine(0, indent); + + // Write out number of items + file->writeQuotedLine("L", indent); + file->writeNumberLine(Common::List::size(), indent); + + // Iterate through writing entries + Common::List::const_iterator i; + for (i = Common::List::begin(); i != Common::List::end(); ++i) { + const ListItem *item = *i; + item->saveHeader(file, indent); + item->save(file, indent + 1); + item->saveFooter(file, indent); + } + + } + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file) { + file->readNumber(); + file->readBuffer(); + + Common::List::clear(); + uint count = file->readNumber(); + + for (uint idx = 0; idx < count; ++idx) { + // Validate the class start header + if (!file->IsClassStart()) + error("Unexpected class end"); + + // Get item's class name and use it to instantiate an item + CString className = file->readString(); + T *newItem = dynamic_cast(CSaveableObject::createInstance(className)); + if (!newItem) + error("Could not create instance of %s", className.c_str()); + + // Load the item's data and add it to the list + newItem->load(file); + Common::List::push_back(newItem); + + // Validate the class end footer + if (file->IsClassStart()) + error("Unexpected class start"); + } + } + + /** + * Clear the list and destroy any items in it + */ + void destroyContents() { + for (Common::List::iterator i = Common::List::begin(); + i != Common::List::end(); ++i) { + CSaveableObject *obj = *i; + delete obj; + } + + Common::List::clear(); + } + + /** + * Add a new item to the list of the type the list contains + */ + T *List::add() { + T *item = new T(); + Common::List::push_back(item); + return item; + } +}; + +} // End of namespace Titanic + +#endif /* TITANIC_LIST_H */ diff --git a/engines/titanic/core/message_target.cpp b/engines/titanic/core/message_target.cpp new file mode 100644 index 0000000000..a7dd3a02a2 --- /dev/null +++ b/engines/titanic/core/message_target.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/core/message_target.h" + +namespace Titanic { + +void CMessageTarget::save(SimpleFile *file, int indent) const { + file->writeNumberLine(0, indent); + CSaveableObject::save(file, indent); +} + +void CMessageTarget::load(SimpleFile *file) { + file->readNumber(); + CSaveableObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/core/message_target.h b/engines/titanic/core/message_target.h new file mode 100644 index 0000000000..1afc48bd9b --- /dev/null +++ b/engines/titanic/core/message_target.h @@ -0,0 +1,51 @@ +/* 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. + * + */ + +#ifndef TITANIC_MESSAGE_TARGET_H +#define TITANIC_MESSAGE_TARGET_H + +#include "titanic/core/saveable_object.h" + +namespace Titanic { + +class CMessageTarget: public CSaveableObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMessageTarget"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); + +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MESSAGE_TARGET_H */ diff --git a/engines/titanic/core/movie_clip.cpp b/engines/titanic/core/movie_clip.cpp new file mode 100644 index 0000000000..fec09f6542 --- /dev/null +++ b/engines/titanic/core/movie_clip.cpp @@ -0,0 +1,69 @@ +/* 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 "titanic/core/movie_clip.h" + +namespace Titanic { + +CMovieClip::CMovieClip() { +} + +void CMovieClip::save(SimpleFile *file, int indent) const { + file->writeNumberLine(2, indent); + file->writeQuotedLine("Clip", indent); + file->writeQuotedLine(_string1, indent); + file->writeNumberLine(_field18, indent); + file->writeNumberLine(_field1C, indent); + + ListItem::save(file, indent); +} + +void CMovieClip::load(SimpleFile *file) { + int val = file->readNumber(); + + switch (val) { + case 1: + _string1 = file->readString(); + _field18 = file->readNumber(); + _field1C = file->readNumber(); + _field20 = file->readNumber(); + _field24 = file->readNumber(); + _field28 = file->readNumber(); + _field2C = file->readNumber(); + _field30 = file->readNumber(); + break; + + case 2: + file->readString(); + _string1 = file->readString(); + _field18 = file->readNumber(); + _field1C = file->readNumber(); + break; + + default: + break; + } + + ListItem::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/core/movie_clip.h b/engines/titanic/core/movie_clip.h new file mode 100644 index 0000000000..f16e3eb820 --- /dev/null +++ b/engines/titanic/core/movie_clip.h @@ -0,0 +1,74 @@ +/* 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. + * + */ + +#ifndef TITANIC_MOVIE_CLIP_H +#define TITANIC_MOVIE_CLIP_H + +#include "titanic/core/list.h" + +namespace Titanic { + +/** + * Movie clip + */ +class CMovieClip : public ListItem { +private: + CString _string1; + int _field18; + int _field1C; + int _field20; + int _field24; + int _field28; + int _field2C; + int _field30; + CString _string2; + CString _string3; +public: + CMovieClip(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMovieClip"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +/** + * Movie clip list + */ +class CMovieClipList: public List { +public: + virtual const char *getClassName() const { return "CMovieClipList"; } +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MOVIE_CLIP_H */ diff --git a/engines/titanic/core/named_item.cpp b/engines/titanic/core/named_item.cpp new file mode 100644 index 0000000000..10d9588590 --- /dev/null +++ b/engines/titanic/core/named_item.cpp @@ -0,0 +1,42 @@ +/* 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 "titanic/core/named_item.h" + +namespace Titanic { + +void CNamedItem::save(SimpleFile *file, int indent) const { + file->writeNumberLine(0, indent); + file->writeQuotedLine(_name, indent); + + CTreeItem::save(file, indent); +} + +void CNamedItem::load(SimpleFile *file) { + int val = file->readNumber(); + if (!val) + _name = file->readString(); + + CTreeItem::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/core/named_item.h b/engines/titanic/core/named_item.h new file mode 100644 index 0000000000..75635fcf72 --- /dev/null +++ b/engines/titanic/core/named_item.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_NAMED_ITEM_H +#define TITANIC_NAMED_ITEM_H + +#include "titanic/core/tree_item.h" + +namespace Titanic { + +class CNamedItem: public CTreeItem { +public: + CString _name; +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CNamedItem"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_NAMED_ITEM_H */ diff --git a/engines/titanic/core/node_item.cpp b/engines/titanic/core/node_item.cpp new file mode 100644 index 0000000000..f44be6ddaf --- /dev/null +++ b/engines/titanic/core/node_item.cpp @@ -0,0 +1,54 @@ +/* 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 "titanic/core/node_item.h" + +namespace Titanic { + +CNodeItem::CNodeItem() : CNamedItem(), _field24(0), _field28(0), _field2C(0) { +} + +void CNodeItem::save(SimpleFile *file, int indent) const { + file->writeNumberLine(0, indent); + file->writeQuotedLine("N", indent); + file->writeNumberLine(_field24, indent + 1); + file->writeNumberLine(_field28, indent + 1); + + file->writeQuotedLine("N", indent); + file->writeNumberLine(_field2C, indent + 1); + + CNamedItem::save(file, indent); +} + +void CNodeItem::load(SimpleFile *file) { + file->readNumber(); + file->readBuffer(); + _field24 = file->readNumber(); + _field28 = file->readNumber(); + + file->readBuffer(); + _field2C = file->readNumber(); + + CNamedItem::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/core/node_item.h b/engines/titanic/core/node_item.h new file mode 100644 index 0000000000..e05c2eb6ff --- /dev/null +++ b/engines/titanic/core/node_item.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_NODE_ITEM_H +#define TITANIC_NODE_ITEM_H + +#include "titanic/core/named_item.h" + +namespace Titanic { + +class CNodeItem : public CNamedItem { +private: + int _field24; + int _field28; + int _field2C; +public: + CNodeItem(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CNodeItem"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_FILE_ITEM_H */ diff --git a/engines/titanic/core/pet_control.cpp b/engines/titanic/core/pet_control.cpp new file mode 100644 index 0000000000..eee18269d2 --- /dev/null +++ b/engines/titanic/core/pet_control.cpp @@ -0,0 +1,31 @@ +/* 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 "titanic/core/pet_control.h" + +namespace Titanic { + +void CPetControl::gameLoaded() { + // TODO +} + +} // End of namespace Titanic diff --git a/engines/titanic/core/pet_control.h b/engines/titanic/core/pet_control.h new file mode 100644 index 0000000000..b1dc4610ae --- /dev/null +++ b/engines/titanic/core/pet_control.h @@ -0,0 +1,40 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONTROL_H +#define TITANIC_PET_CONTROL_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPetControl : public CGameObject { +public: + /** + * Called after loading a game has finished + */ + void gameLoaded(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_H */ diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp new file mode 100644 index 0000000000..7a8a082a37 --- /dev/null +++ b/engines/titanic/core/project_item.cpp @@ -0,0 +1,294 @@ +/* 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/savefile.h" +#include "titanic/game_manager.h" +#include "titanic/titanic.h" +#include "titanic/compressed_file.h" +#include "titanic/core/dont_save_file_item.h" +#include "titanic/core/pet_control.h" +#include "titanic/core/project_item.h" + +namespace Titanic { + +void CFileListItem::save(SimpleFile *file, int indent) const { + file->writeNumberLine(0, indent); + file->writeQuotedLine(_name, indent); + + ListItem::save(file, indent); +} + +void CFileListItem::load(SimpleFile *file) { + file->readNumber(); + _name = file->readString(); + + ListItem::load(file); +} + +/*------------------------------------------------------------------------*/ + +CProjectItem::CProjectItem() : _nextRoomNumber(0), _nextMessageNumber(0), + _nextObjectNumber(0), _gameManager(nullptr) { +} + +void CProjectItem::save(SimpleFile *file, int indent) const { + file->writeNumberLine(6, indent); + file->writeQuotedLine("Next Avail. Object Number", indent); + file->writeNumberLine(_nextObjectNumber, indent); + file->writeQuotedLine("Next Avail. Message Number", indent); + file->writeNumberLine(_nextMessageNumber, indent); + file->writeQuotedLine("Next Avail. Room Number", indent); + file->writeNumberLine(_nextRoomNumber, indent); + + CTreeItem::save(file, indent); +} + +void CProjectItem::buildFilesList() { + _files.destroyContents(); + + CTreeItem *treeItem = getFirstChild(); + while (treeItem) { + if (treeItem->isFileItem()) { + CString name = static_cast(treeItem)->getFilename(); + _files.add()->_name = name; + } + + treeItem = getNextSibling(); + } +} + +void CProjectItem::load(SimpleFile *file) { + int val = file->readNumber(); + _files.destroyContents(); + int count; + + switch (val) { + case 1: + file->readBuffer(); + _nextRoomNumber = file->readNumber(); + // Deliberate fall-through + + case 0: + // Load the list of files + count = file->readNumber(); + for (int idx = 0; idx < count; ++idx) { + CString name = file->readString(); + _files.add()->_name = name; + } + break; + + case 6: + file->readBuffer(); + _nextObjectNumber = file->readNumber(); + // Deliberate fall-through + + case 5: + file->readBuffer(); + _nextMessageNumber = file->readNumber(); + // Deliberate fall-through + + case 4: + file->readBuffer(); + // Deliberate fall-through + + case 2: + case 3: + _files.load(file); + file->readBuffer(); + _nextRoomNumber = file->readNumber(); + break; + + default: + break; + } + + CTreeItem::load(file); +} + +CGameManager *CProjectItem::getGameManager() { + return _gameManager; +} + +void CProjectItem::resetGameManager() { + _gameManager = nullptr; +} + +void CProjectItem::loadGame(int slotId) { + CompressedFile file; + Common::InSaveFile *saveFile = nullptr; + + // Clear any existing project contents + clear(); + + // Open either an existing savegame slot or the new game template + if (slotId >= 0) { + saveFile = g_system->getSavefileManager()->openForLoading( + Common::String::format("slot%d.gam", slotId)); + file.open(saveFile); + } else { + file.open("newgame.st"); + } + + // Load the contents in + CProjectItem *newProject = loadData(&file); + file.IsClassStart(); + getGameManager()->load(&file); + + file.close(); + + // Clear existing project + clear(); + + // Detach each item under the loaded project, and re-attach them + // to the existing project instance (this) + CTreeItem *item; + while ((item = newProject->getFirstChild()) != nullptr) { + item->detach(); + item->addUnder(this); + } + // Loaded project instance is no longer needed + newProject->destroyAll(); + + // Post-load processing + gameLoaded(); +} + +void CProjectItem::saveGame(int slotId) { + CompressedFile file; + Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving( + Common::String::format("slot%d.gam", slotId)); + file.open(saveFile); + + // Save the contents out + saveData(&file, this); + + file.close(); +} + +void CProjectItem::clear() { + CTreeItem *item; + while ((item = getFirstChild()) != nullptr) + item->destroyAll(); +} + +CProjectItem *CProjectItem::loadData(SimpleFile *file) { + if (!file->IsClassStart()) + return nullptr; + + CProjectItem *root = nullptr; + CTreeItem *parent = nullptr; + CTreeItem *item = nullptr; + + do { + CString entryString = file->readString(); + + if (entryString == "ALONG") { + // Move along, nothing needed + } else if (entryString == "UP") { + // Move up + if (parent == nullptr || + (parent = parent->getParent()) == nullptr) + break; + } else if (entryString == "DOWN") { + // Move down + if (parent == nullptr) + parent = item; + else + parent = parent->getLastChild(); + } else { + // Create new class instance + item = dynamic_cast(CSaveableObject::createInstance(entryString)); + assert(item); + + if (root) { + // Already created root project + item->addUnder(parent); + } else { + root = dynamic_cast(item); + assert(root); + root->_filename = _filename; + } + + // Load the data for the item + item->load(file); + } + + file->IsClassStart(); + } while (file->IsClassStart()); + + return root; +} + +void CProjectItem::saveData(SimpleFile *file, CTreeItem *item) const { + while (item) { + item->saveHeader(file, 0); + item->save(file, 1); + item->saveFooter(file, 0); + + + CTreeItem *child = item->getFirstChild(); + if (child) { + file->write("\n{\n", 3); + file->writeQuotedString("DOWN"); + file->write("\n}\n", 3); + saveData(file, child); + file->write("\n{\n", 3); + file->writeQuotedString("UP"); + } else { + file->write("\n{\n", 3); + file->writeQuotedString("ALONG"); + } + + file->write("\n}\n", 3); + item = item->getNextSibling(); + } +} + +void CProjectItem::gameLoaded() { + CGameManager *gameManager = getGameManager(); + if (gameManager) + gameManager->gameLoaded(); + + CPetControl *petControl = getPetControl(); + if (petControl) + petControl->gameLoaded(); +} + +CPetControl *CProjectItem::getPetControl() { + CDontSaveFileItem *fileItem = getDontSaveFileItem(); + CTreeItem *treeItem; + + if (!fileItem || (treeItem = fileItem->getLastChild()) == nullptr) + return nullptr; + + while (treeItem) { + CPetControl *petControl = dynamic_cast(treeItem); + if (petControl) + return petControl; + + treeItem = treeItem->getPriorSibling(); + } + + return nullptr; +} + +} // End of namespace Titanic diff --git a/engines/titanic/core/project_item.h b/engines/titanic/core/project_item.h new file mode 100644 index 0000000000..3c334986a8 --- /dev/null +++ b/engines/titanic/core/project_item.h @@ -0,0 +1,150 @@ +/* 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. + * + */ + +#ifndef TITANIC_PROJECT_ITEM_H +#define TITANIC_PROJECT_ITEM_H + +#include "common/scummsys.h" +#include "titanic/simple_file.h" +#include "titanic/core/file_item.h" +#include "titanic/core/list.h" + +namespace Titanic { + +class CGameManager; +class CPetControl; + +/** + * File list item + */ +class CFileListItem : public ListItem { +public: + CString _name; + + virtual const char *getClassName() const { return "CFileListItem"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); + +}; + +/** + * Filename list + */ +class CFileList: public List { +public: + virtual const char *getClassName() const { return "CFileList"; } +}; + + +class CProjectItem : public CFileItem { +private: + CString _filename; + CFileList _files; + int _nextRoomNumber; + int _nextMessageNumber; + int _nextObjectNumber; + CGameManager *_gameManager; + + /** + * Called during save, iterates through the children to do some stuff + */ + void buildFilesList(); +private: + /** + * Load project data from the passed file + */ + CProjectItem *loadData(SimpleFile *file); + + /** + * Save project data to the passed file + */ + void saveData(SimpleFile *file, CTreeItem *item) const; + + /** + * Does post-loading processing + */ + void gameLoaded(); +public: + CProjectItem(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CProjectItem"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); + + /** + * Get the game manager for the project + */ + virtual CGameManager *getGameManager(); + + /** + * Get a reference to the PET control + */ + CPetControl *getPetControl(); + + /** + * Resets the game manager field + */ + void resetGameManager(); + + /** + * Load the entire project data for a given slot Id + */ + void loadGame(int slotId); + + /** + * Save the entire project data to a given savegame slot + */ + void saveGame(int slotId); + + /** + * Clear any currently loaded project + */ + void clear(); + + /** + * Set the proejct's name + */ + void setFilename(const CString &name) { _filename = name; } +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PROJECT_ITEM_H */ diff --git a/engines/titanic/core/resource_key.cpp b/engines/titanic/core/resource_key.cpp new file mode 100644 index 0000000000..eee749f15a --- /dev/null +++ b/engines/titanic/core/resource_key.cpp @@ -0,0 +1,47 @@ +/* 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 "titanic/simple_file.h" +#include "titanic/core/resource_key.h" + +namespace Titanic { + +void CResourceKey::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine("Resource Key...", indent); + file->writeQuotedLine(_key, indent); + + CSaveableObject::save(file, indent); +} + +void CResourceKey::load(SimpleFile *file) { + int val = file->readNumber(); + + if (val == 1) { + file->readBuffer(); + _value = file->readString(); + } + + CSaveableObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/core/resource_key.h b/engines/titanic/core/resource_key.h new file mode 100644 index 0000000000..1b3d900abc --- /dev/null +++ b/engines/titanic/core/resource_key.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_RESOURCE_KEY_H +#define TITANIC_RESOURCE_KEY_H + +#include "titanic/string.h" +#include "titanic/core/saveable_object.h" + +namespace Titanic { + +class CResourceKey: public CSaveableObject { +private: + CString _key; + CString _value; +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CResourceKey"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); + + const CString &getString() const { return _key; } +}; + +} // End of namespace Titanic + +#endif /* TITANIC_RESOURCE_KEY_H */ diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp new file mode 100644 index 0000000000..c7e749e9dd --- /dev/null +++ b/engines/titanic/core/saveable_object.cpp @@ -0,0 +1,107 @@ +/* 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 "titanic/core/saveable_object.h" +#include "titanic/core/file_item.h" +#include "titanic/core/link_item.h" +#include "titanic/core/list.h" +#include "titanic/core/message_target.h" +#include "titanic/core/movie_clip.h" +#include "titanic/core/node_item.h" +#include "titanic/core/project_item.h" +#include "titanic/core/saveable_object.h" +#include "titanic/core/tree_item.h" +#include "titanic/core/view_item.h" +#include "titanic/game/announce.h" +#include "titanic/game/pet_position.h" +#include "titanic/game/room_item.h" +#include "titanic/game/service_elevator_door.h" +#include "titanic/game/sub_glass.h" + +namespace Titanic { + +Common::HashMap * + CSaveableObject::_classList = nullptr; + +#define DEFFN(T) CSaveableObject *Function##T() { return new T(); } +#define ADDFN(T) (*_classList)[#T] = Function##T + +DEFFN(CAnnounce); +DEFFN(CFileItem); +DEFFN(CFileListItem); +DEFFN(CLinkItem); +DEFFN(CMessageTarget); +DEFFN(CMovieClip); +DEFFN(CMovieClipList); +DEFFN(CNodeItem); +DEFFN(CPETPosition); +DEFFN(CProjectItem); +DEFFN(CRoomItem); +DEFFN(CServiceElevatorDoor); +DEFFN(CSUBGlass); +DEFFN(CTreeItem); +DEFFN(CViewItem); + +void CSaveableObject::initClassList() { + _classList = new Common::HashMap(); + ADDFN(CAnnounce); + ADDFN(CFileItem); + ADDFN(CFileListItem); + ADDFN(CLinkItem); + ADDFN(CMessageTarget); + ADDFN(CMovieClip); + ADDFN(CMovieClipList); + ADDFN(CNodeItem); + ADDFN(CPETPosition); + ADDFN(CProjectItem); + ADDFN(CRoomItem); + ADDFN(CServiceElevatorDoor); + ADDFN(CSUBGlass); + ADDFN(CTreeItem); + ADDFN(CViewItem); +} + +void CSaveableObject::freeClassList() { + delete _classList; +} + +CSaveableObject *CSaveableObject::createInstance(const Common::String &name) { + return (*_classList)[name](); +} + +void CSaveableObject::save(SimpleFile *file, int indent) const { + file->writeNumberLine(0, indent); +} + +void CSaveableObject::load(SimpleFile *file) { + file->readNumber(); +} + +void CSaveableObject::saveHeader(SimpleFile *file, int indent) const { + file->writeClassStart(getClassName(), indent); +} + +void CSaveableObject::saveFooter(SimpleFile *file, int indent) const { + file->writeClassEnd(indent); +} + +} // End of namespace Titanic diff --git a/engines/titanic/core/saveable_object.h b/engines/titanic/core/saveable_object.h new file mode 100644 index 0000000000..4e7d949191 --- /dev/null +++ b/engines/titanic/core/saveable_object.h @@ -0,0 +1,83 @@ +/* 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. + * + */ + +#ifndef TITANIC_SAVEABLE_OBJECT_H +#define TITANIC_SAVEABLE_OBJECT_H + +#include "common/scummsys.h" +#include "common/array.h" +#include "common/hash-str.h" +#include "titanic/simple_file.h" + +namespace Titanic { + +class CSaveableObject { + typedef CSaveableObject *(*CreateFunction)(); +private: + static Common::HashMap *_classList; +public: + /** + * Sets up the list of saveable object classes + */ + static void initClassList(); + + /** + * Free the list of saveable object classes + */ + static void freeClassList(); + + /** + * Creates a new instance of a saveable object class + */ + static CSaveableObject *createInstance(const Common::String &name); +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSaveableObject"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); + + /** + * Write out a header definition for the class to file + * prior to saving the actual data for the class + */ + virtual void saveHeader(SimpleFile *file, int indent) const; + + /** + * Writes out a footer for the class after it's data has + * been written to file + */ + virtual void saveFooter(SimpleFile *file, int indent) const; +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SAVEABLE_OBJECT_H */ diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp new file mode 100644 index 0000000000..d20e1da4f0 --- /dev/null +++ b/engines/titanic/core/tree_item.cpp @@ -0,0 +1,151 @@ +/* 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 "titanic/core/tree_item.h" +#include "titanic/core/dont_save_file_item.h" +#include "titanic/core/file_item.h" + +namespace Titanic { + +CTreeItem::CTreeItem() : _parent(nullptr), _firstChild(nullptr), + _nextSibling(nullptr), _priorSibling(nullptr), _field14(0) { +} + +void CTreeItem::save(SimpleFile *file, int indent) const { + file->writeNumberLine(0, indent); + CMessageTarget::save(file, indent); +} + +void CTreeItem::load(SimpleFile *file) { + file->readNumber(); + CMessageTarget::load(file); +} + +CGameManager *CTreeItem::getGameManager() { + return _parent ? _parent->getGameManager() : nullptr; +} + +CTreeItem *CTreeItem::getRoot() const { + CTreeItem *parent = getParent(); + + if (parent) { + do { + parent = parent->getParent(); + } while (parent->getParent()); + } + + return parent; +} + +CTreeItem *CTreeItem::getLastSibling() { + CTreeItem *item = this; + while (item->getNextSibling()) + item = item->getNextSibling(); + + return item; +} + +CTreeItem *CTreeItem::getLastChild() { + if (!_firstChild) + return nullptr; + return _firstChild->getLastSibling(); +} + +CDontSaveFileItem *CTreeItem::getDontSaveFileItem() { + CTreeItem *item = getFirstChild(); + while (item) { + CDontSaveFileItem *fileItem = dynamic_cast(item); + if (fileItem) + return fileItem; + + item = item->getNextSibling(); + } +} + +void CTreeItem::addUnder(CTreeItem *newParent) { + if (newParent->_firstChild) + addSibling(newParent->getLastSibling()); + else + setParent(newParent); +} + +void CTreeItem::setParent(CTreeItem *newParent) { + _parent = newParent; + _priorSibling = nullptr; + _nextSibling = newParent->_firstChild; + + if (newParent->_firstChild) + newParent->_firstChild->_priorSibling = this; + newParent->_firstChild = this; +} + +void CTreeItem::addSibling(CTreeItem *item) { + _priorSibling = item->_nextSibling; + _nextSibling = item->_nextSibling; + _parent = item->_parent; + + if (item->_nextSibling) + item->_nextSibling->_priorSibling = this; + item->_nextSibling = this; +} + +void CTreeItem::destroyAll() { + destroyOthers(); + detach(); + delete this; +} + +int CTreeItem::destroyOthers() { + if (!_firstChild) + return 0; + + CTreeItem *item = this, *child, *nextSibling; + int total = 0; + + do { + child = item->_firstChild; + nextSibling = item->_nextSibling; + + if (child) + total += child->destroyOthers(); + child->detach(); + delete child; + ++total; + } while ((item = nextSibling) != nullptr); + + return total; +} + +void CTreeItem::detach() { + // Delink this item from any prior and/or next siblings + if (_priorSibling) + _priorSibling->_nextSibling = _nextSibling; + if (_nextSibling) + _nextSibling->_priorSibling = _priorSibling; + + if (_parent && _parent->_firstChild == this) + _parent->_firstChild = _nextSibling; + + _priorSibling = _nextSibling = _parent = nullptr; +} + +} // End of namespace Titanic diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h new file mode 100644 index 0000000000..ea5de32161 --- /dev/null +++ b/engines/titanic/core/tree_item.h @@ -0,0 +1,141 @@ +/* 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. + * + */ + +#ifndef TITANIC_TREE_ITEM_H +#define TITANIC_TREE_ITEM_H + +#include "titanic/core/message_target.h" + +namespace Titanic { + +class CGameManager; +class CDontSaveFileItem; + +class CTreeItem: public CMessageTarget { +private: + CTreeItem *_parent; + CTreeItem *_nextSibling; + CTreeItem *_priorSibling; + CTreeItem *_firstChild; + int _field14; +public: + CTreeItem(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CTreeItem"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); + + /** + * Get the game manager for the project + */ + virtual CGameManager *getGameManager(); + + /** + * Returns true if the item is a file item + */ + virtual bool isFileItem() const { return false; } + + /** + * Get the parent for the given item + */ + CTreeItem *getParent() const { return _parent; } + + /** + * Jumps up through the parents to find the sub-root item + */ + CTreeItem *getRoot() const; + + /** + * Get the next sibling + */ + CTreeItem *getNextSibling() { return _nextSibling; } + + /** + * Get the prior sibling + */ + CTreeItem *getPriorSibling() { return _priorSibling; } + + /** + * Get the last sibling of this sibling + */ + CTreeItem *getLastSibling(); + + /** + * Get the first child of the item, if any + */ + CTreeItem *getFirstChild() { return _firstChild; } + + /** + * Get the last child of the item, if any + */ + CTreeItem *getLastChild(); + + /** + * Get any dont save file item in the immediate children + */ + CDontSaveFileItem *getDontSaveFileItem(); + + /** + * Adds the item under another tree item + */ + void addUnder(CTreeItem *newParent); + + /** + * Sets the parent for the item + */ + void setParent(CTreeItem *newParent); + + /** + * Adds the item as a sibling of another item + */ + void addSibling(CTreeItem *item); + + /** + * Destroys both the item as well as any of it's children + */ + void destroyAll(); + + /** + * Destroys all tree items around the given one + */ + int destroyOthers(); + + /** + * Detach the tree item from any other associated tree items + */ + void detach(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TREE_ITEM_H */ diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp new file mode 100644 index 0000000000..e64229e3d3 --- /dev/null +++ b/engines/titanic/core/view_item.cpp @@ -0,0 +1,70 @@ +/* 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 "titanic/core/view_item.h" + +namespace Titanic { + +CViewItem::CViewItem() : CNamedItem() { + _field24 = 0; + _field28 = 0.0; + _field30 = 0; + _field50 = 0; + _field54 = 0; + setData(0.0); +} + +void CViewItem::setData(double v) { + _field28 = v; + _field50 = cos(_field28) * 30.0; + _field54 = sin(_field28) * -30.0; +} + +void CViewItem::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + _resourceKey.save(file, indent); + file->writeQuotedLine("V", indent); + file->writeFloatLine(_field28, indent + 1); + file->writeNumberLine(_field30, indent + 1); + + CNamedItem::save(file, indent); +} + +void CViewItem::load(SimpleFile *file) { + int val = file->readNumber(); + + switch (val) { + case 1: + _resourceKey.load(file); + // Deliberate fall-through + + default: + file->readBuffer(); + setData(file->readFloat()); + _field30 = file->readNumber(); + break; + } + + CNamedItem::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/core/view_item.h b/engines/titanic/core/view_item.h new file mode 100644 index 0000000000..592bb21632 --- /dev/null +++ b/engines/titanic/core/view_item.h @@ -0,0 +1,62 @@ +/* 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. + * + */ + +#ifndef TITANIC_VIEW_ITEM_H +#define TITANIC_VIEW_ITEM_H + +#include "titanic/core/named_item.h" +#include "titanic/core/resource_key.h" + +namespace Titanic { + +class CViewItem : public CNamedItem { +private: + void setData(double v); +protected: + int _field24; + double _field28; + int _field30; + CResourceKey _resourceKey; + int _field50; + int _field54; +public: + CViewItem(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CNamedItem"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_NAMED_ITEM_H */ diff --git a/engines/titanic/game/announce.cpp b/engines/titanic/game/announce.cpp new file mode 100644 index 0000000000..098ae70aa7 --- /dev/null +++ b/engines/titanic/game/announce.cpp @@ -0,0 +1,50 @@ +/* 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 "titanic/game/announce.h" + +namespace Titanic { + +CAnnounce::CAnnounce() : _fieldBC(0), _fieldC0(0), _fieldC4(1), _fieldC8(0) { +} + +void CAnnounce::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_fieldC4, indent); + file->writeNumberLine(_fieldC8, indent); + + CGameObject::save(file, indent); +} + +void CAnnounce::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _fieldC4 = file->readNumber(); + _fieldC8 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/announce.h b/engines/titanic/game/announce.h new file mode 100644 index 0000000000..baa5f1a55a --- /dev/null +++ b/engines/titanic/game/announce.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_ANNOUNCE_H +#define TITANIC_ANNOUNCE_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CAnnounce : public CGameObject { +private: + int _fieldBC; + int _fieldC0; + int _fieldC4; + int _fieldC8; +public: + CAnnounce(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CAnnounce"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ROOM_ITEM_H */ diff --git a/engines/titanic/game/door_auto_sound_event.cpp b/engines/titanic/game/door_auto_sound_event.cpp new file mode 100644 index 0000000000..158c147296 --- /dev/null +++ b/engines/titanic/game/door_auto_sound_event.cpp @@ -0,0 +1,51 @@ +/* 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 "titanic/game/door_auto_sound_event.h" + +namespace Titanic { + +CDoorAutoSoundEvent::CDoorAutoSoundEvent() : CAutoSoundEvent(), + _string1("z#44.wav"), _string2("z#43.wav"), _fieldDC(25), _fieldE0(25) { +} + +void CDoorAutoSoundEvent::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + file->writeNumberLine(_fieldDC, indent); + file->writeNumberLine(_fieldE0, indent); + + CAutoSoundEvent::save(file, indent); +} + +void CDoorAutoSoundEvent::load(SimpleFile *file) { + file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + _fieldDC = file->readNumber(); + _fieldE0 = file->readNumber(); + + CAutoSoundEvent::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/door_auto_sound_event.h b/engines/titanic/game/door_auto_sound_event.h new file mode 100644 index 0000000000..66e9594b40 --- /dev/null +++ b/engines/titanic/game/door_auto_sound_event.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_DOOR_AUTO_SOUND_EVENT_H +#define TITANIC_DOOR_AUTO_SOUND_EVENT_H + +#include "titanic/core/auto_sound_event.h" + +namespace Titanic { + +class CDoorAutoSoundEvent : public CAutoSoundEvent { +protected: + CString _string1; + CString _string2; + int _fieldDC; + int _fieldE0; +public: + CDoorAutoSoundEvent(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CDoorAutoSoundEvent"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DOOR_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/game/pet_position.cpp b/engines/titanic/game/pet_position.cpp new file mode 100644 index 0000000000..eb3156da32 --- /dev/null +++ b/engines/titanic/game/pet_position.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/pet_position.h" + +namespace Titanic { + +void CPETPosition::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPETPosition::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet_position.h b/engines/titanic/game/pet_position.h new file mode 100644 index 0000000000..7ca6725059 --- /dev/null +++ b/engines/titanic/game/pet_position.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_POSITION_H +#define TITANIC_PET_POSITION_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPETPosition : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPETPosition"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ROOM_ITEM_H */ diff --git a/engines/titanic/game/room_item.cpp b/engines/titanic/game/room_item.cpp new file mode 100644 index 0000000000..17e0ffca2d --- /dev/null +++ b/engines/titanic/game/room_item.cpp @@ -0,0 +1,106 @@ +/* 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 "titanic/game/room_item.h" + +namespace Titanic { + +CRoomItem::CRoomItem() : CNamedItem(), _roomNumber(0), + _roomDimensionX(0.0), _roomDimensionY(0.0) { +} + +void CRoomItem::save(SimpleFile *file, int indent) const { + file->writeNumberLine(3, indent); + file->writeQuotedLine("Exit Movies", indent); + _exitMovieKey.save(file, indent); + + file->writeNumberLine(_roomDimensionX * 1000.0, indent + 1); + file->writeNumberLine(_roomDimensionY * 1000.0, indent + 1); + + file->writeQuotedLine("Transition Movie", indent); + _transitionMovieKey.save(file, indent); + + file->writeQuotedLine("Movie Clip list", indent); + _clipList.save(file, indent + 1); + + file->writeQuotedLine("Room Rect", indent); + file->writeNumberLine(_roomRect.left, indent + 1); + file->writeNumberLine(_roomRect.top, indent + 1); + file->writeNumberLine(_roomRect.right, indent + 1); + file->writeNumberLine(_roomRect.bottom, indent + 1); + + file->writeQuotedLine("Room Number", indent); + file->writeNumberLine(_roomNumber, indent); + + CNamedItem::save(file, indent); +} + +void CRoomItem::load(SimpleFile *file) { + int val = file->readNumber(); + + switch (val) { + case 3: + // Read exit movie + file->readBuffer(); + _exitMovieKey.load(file); + // Deliberate fall-through + + case 2: + // Read room dimensions + file->readBuffer(); + _roomDimensionX = (double)file->readNumber() / 1000.0; + _roomDimensionY = (double)file->readNumber() / 1000.0; + // Deliberate fall-through + + case 1: + // Read transition movie key and clip list + file->readBuffer(); + _transitionMovieKey.load(file); + + file->readBuffer(); + _clipList.load(file); + loading(); + // Deliberate fall-through + + case 0: + // Read room rect + file->readBuffer(); + _roomRect.left = file->readNumber(); + _roomRect.top = file->readNumber(); + _roomRect.right = file->readNumber(); + _roomRect.bottom = file->readNumber(); + file->readBuffer(); + _roomNumber = file->readNumber(); + break; + + default: + break; + } + + CNamedItem::load(file); +} + +void CRoomItem::loading() { + // TODO +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/room_item.h b/engines/titanic/game/room_item.h new file mode 100644 index 0000000000..c213d38caa --- /dev/null +++ b/engines/titanic/game/room_item.h @@ -0,0 +1,65 @@ +/* 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. + * + */ + +#ifndef TITANIC_ROOM_ITEM_H +#define TITANIC_ROOM_ITEM_H + +#include "common/rect.h" +#include "titanic/core/list.h" +#include "titanic/core/movie_clip.h" +#include "titanic/core/named_item.h" +#include "titanic/core/resource_key.h" + +namespace Titanic { + +class CRoomItem : public CNamedItem { +private: + Common::Rect _roomRect; + CMovieClipList _clipList; + int _roomNumber; + CResourceKey _transitionMovieKey; + CResourceKey _exitMovieKey; + double _roomDimensionX, _roomDimensionY; + + void loading(); +public: + CRoomItem(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CRoomItem"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ROOM_ITEM_H */ diff --git a/engines/titanic/game/service_elevator_door.cpp b/engines/titanic/game/service_elevator_door.cpp new file mode 100644 index 0000000000..717b61dc72 --- /dev/null +++ b/engines/titanic/game/service_elevator_door.cpp @@ -0,0 +1,48 @@ +/* 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 "titanic/game/service_elevator_door.h" + +namespace Titanic { + +CServiceElevatorDoor::CServiceElevatorDoor() : CDoorAutoSoundEvent() { + _string1 = "z#31.wav"; + _string2 = "z#32.wav"; +} + +void CServiceElevatorDoor::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string2, indent); + file->writeQuotedLine(_string1, indent); + + CDoorAutoSoundEvent::save(file, indent); +} + +void CServiceElevatorDoor::load(SimpleFile *file) { + file->readNumber(); + _string2 = file->readString(); + _string1 = file->readString(); + + CDoorAutoSoundEvent::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/service_elevator_door.h b/engines/titanic/game/service_elevator_door.h new file mode 100644 index 0000000000..3ad897c089 --- /dev/null +++ b/engines/titanic/game/service_elevator_door.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_SERVICE_ELEVATOR_DOOR_H +#define TITANIC_SERVICE_ELEVATOR_DOOR_H + +#include "titanic/game/door_auto_sound_event.h" + +namespace Titanic { + +class CServiceElevatorDoor : public CDoorAutoSoundEvent { +public: + CServiceElevatorDoor(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CServiceElevatorDoor"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SERVICE_ELEVATOR_DOOR_H */ diff --git a/engines/titanic/game/sub_glass.cpp b/engines/titanic/game/sub_glass.cpp new file mode 100644 index 0000000000..b16199deed --- /dev/null +++ b/engines/titanic/game/sub_glass.cpp @@ -0,0 +1,54 @@ +/* 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 "titanic/game/sub_glass.h" + +namespace Titanic { + +CSUBGlass::CSUBGlass() : _fieldBC(0), _fieldC0(0), _fieldC4(1), _fieldC8(0) { +} + +void CSUBGlass::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_fieldC4, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeNumberLine(_fieldCC, indent); + file->writeQuotedLine(_string, indent); + + CGameObject::save(file, indent); +} + +void CSUBGlass::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _fieldC4 = file->readNumber(); + _fieldC8 = file->readNumber(); + _fieldCC = file->readNumber(); + _string = file->readString(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sub_glass.h b/engines/titanic/game/sub_glass.h new file mode 100644 index 0000000000..00ff26fbeb --- /dev/null +++ b/engines/titanic/game/sub_glass.h @@ -0,0 +1,59 @@ +/* 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. + * + */ + +#ifndef TITANIC_SUB_GLASS_H +#define TITANIC_SUB_GLASS_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CSUBGlass : public CGameObject { +private: + int _fieldBC; + int _fieldC0; + int _fieldC4; + int _fieldC8; + int _fieldCC; + CString _string; +public: + CSUBGlass(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSUBGlass"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ROOM_ITEM_H */ diff --git a/engines/titanic/game/succubus.cpp b/engines/titanic/game/succubus.cpp new file mode 100644 index 0000000000..27f47fd017 --- /dev/null +++ b/engines/titanic/game/succubus.cpp @@ -0,0 +1,54 @@ +/* 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 "titanic/rooms/sub_glass.h" + +namespace Titanic { + +CSUBGlass::CSUBGlass() : _fieldBC(0), _fieldC0(0), _fieldC4(1), _fieldC8(0) { +} + +void CSUBGlass::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_fieldC4, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeNumberLine(_fieldCC, indent); + file->writeQuotedLine(_string, indent); + + CGameObject::save(file, indent); +} + +void CSUBGlass::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _fieldC4 = file->readNumber(); + _fieldC8 = file->readNumber(); + _fieldCC = file->readNumber(); + _string = file->readString(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/succubus.h b/engines/titanic/game/succubus.h new file mode 100644 index 0000000000..f99597b53e --- /dev/null +++ b/engines/titanic/game/succubus.h @@ -0,0 +1,59 @@ +/* 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. + * + */ + +#ifndef TITANIC_SUCCUBUS_H +#define TITANIC_SUCCUBUS_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CSuccUBus : public CGameObject { +private: + int _fieldBC; + int _fieldC0; + int _fieldC4; + int _fieldC8; + int _fieldCC; + CString _string; +public: + CSuccUBus(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSuccUBus"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SUCCUBUS_H */ diff --git a/engines/titanic/main_game_window.h b/engines/titanic/main_game_window.h index dc2fdfd025..4796a4fdcb 100644 --- a/engines/titanic/main_game_window.h +++ b/engines/titanic/main_game_window.h @@ -28,7 +28,7 @@ #include "titanic/game_manager.h" #include "titanic/game_view.h" #include "titanic/image.h" -#include "titanic/objects/project_item.h" +#include "titanic/core/project_item.h" namespace Titanic { diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index e74e8114f4..97053a52b7 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -15,28 +15,28 @@ MODULE_OBJS := \ string.o \ titanic.o \ video_surface.o \ - objects/auto_sound_event.o \ - objects/dont_save_file_item.o \ - objects/file_item.o \ - objects/game_object.o \ - objects/link_item.o \ - objects/list.o \ - objects/message_target.o \ - objects/movie_clip.o \ - objects/named_item.o \ - objects/node_item.o \ - objects/pet_control.o \ - objects/project_item.o \ - objects/resource_key.o \ - objects/saveable_object.o \ - objects/tree_item.o \ - objects/view_item.o \ - rooms/announce.o \ - rooms/door_auto_sound_event.o \ - rooms/pet_position.o \ - rooms/room_item.o \ - rooms/service_elevator_door.o \ - rooms/sub_glass.o + core/auto_sound_event.o \ + core/dont_save_file_item.o \ + core/file_item.o \ + core/game_object.o \ + core/link_item.o \ + core/list.o \ + core/message_target.o \ + core/movie_clip.o \ + core/named_item.o \ + core/node_item.o \ + core/pet_control.o \ + core/project_item.o \ + core/resource_key.o \ + core/saveable_object.o \ + core/tree_item.o \ + core/view_item.o \ + game/announce.o \ + game/door_auto_sound_event.o \ + game/pet_position.o \ + game/room_item.o \ + game/service_elevator_door.o \ + game/sub_glass.o # This module can be built as a plugin ifeq ($(ENABLE_TITANIC), DYNAMIC_PLUGIN) diff --git a/engines/titanic/objects/auto_sound_event.cpp b/engines/titanic/objects/auto_sound_event.cpp deleted file mode 100644 index 7160ac7b24..0000000000 --- a/engines/titanic/objects/auto_sound_event.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* 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 "titanic/objects/auto_sound_event.h" - -namespace Titanic { - -CAutoSoundEvent::CAutoSoundEvent() : CGameObject(), _fieldBC(-1), _fieldC0(0xFFFFFF) { -} - -void CAutoSoundEvent::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldBC, indent); - file->writeNumberLine(_fieldC0, indent); - - CGameObject::save(file, indent); -} - -void CAutoSoundEvent::load(SimpleFile *file) { - file->readNumber(); - _fieldBC = file->readNumber(); - _fieldC0 = file->readNumber(); - - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/objects/auto_sound_event.h b/engines/titanic/objects/auto_sound_event.h deleted file mode 100644 index bcfc6a49c6..0000000000 --- a/engines/titanic/objects/auto_sound_event.h +++ /dev/null @@ -1,55 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_AUTO_SOUND_EVENT_H -#define TITANIC_AUTO_SOUND_EVENT_H - -#include "titanic/objects/game_object.h" - -namespace Titanic { - -class CAutoSoundEvent : public CGameObject { -private: - int _fieldBC; - int _fieldC0; -public: - CAutoSoundEvent(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CAutoSoundEvent"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/objects/dont_save_file_item.cpp b/engines/titanic/objects/dont_save_file_item.cpp deleted file mode 100644 index bca66da521..0000000000 --- a/engines/titanic/objects/dont_save_file_item.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 "titanic/objects/dont_save_file_item.h" - -namespace Titanic { - -void CDontSaveFileItem::save(SimpleFile *file, int indent) const { - file->writeNumberLine(0, indent); -} - -void CDontSaveFileItem::load(SimpleFile *file) { - file->readNumber(); -} - -} // End of namespace Titanic diff --git a/engines/titanic/objects/dont_save_file_item.h b/engines/titanic/objects/dont_save_file_item.h deleted file mode 100644 index 99deacc88c..0000000000 --- a/engines/titanic/objects/dont_save_file_item.h +++ /dev/null @@ -1,50 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_DONT_SAVE_FILE_ITEM_H -#define TITANIC_DONT_SAVE_FILE_ITEM_H - -#include "titanic/objects/file_item.h" - -namespace Titanic { - -class CDontSaveFileItem : public CFileItem { -public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CDontSaveFileItem"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_DONT_SAVE_FILE_ITEM_H */ diff --git a/engines/titanic/objects/file_item.cpp b/engines/titanic/objects/file_item.cpp deleted file mode 100644 index 925fc4d000..0000000000 --- a/engines/titanic/objects/file_item.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* 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 "titanic/objects/file_item.h" - -namespace Titanic { - -void CFileItem::save(SimpleFile *file, int indent) const { - file->writeNumberLine(0, indent); - CTreeItem::save(file, indent); -} - -void CFileItem::load(SimpleFile *file) { - file->readNumber(); - - CTreeItem::load(file); -} - -CString CFileItem::formFilename() const { - return ""; -} - -CString CFileItem::getFilename() const { - //dynamic_cast(getRoot())->formDataPath(); - return _filename; -} - -} // End of namespace Titanic diff --git a/engines/titanic/objects/file_item.h b/engines/titanic/objects/file_item.h deleted file mode 100644 index 94dd053ae8..0000000000 --- a/engines/titanic/objects/file_item.h +++ /dev/null @@ -1,69 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_FILE_ITEM_H -#define TITANIC_FILE_ITEM_H - -#include "titanic/string.h" -#include "titanic/objects/list.h" -#include "titanic/objects/tree_item.h" - -namespace Titanic { - -class CFileItem: public CTreeItem { -private: - CString _filename; -public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CFileItem"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); - - /** - * Returns true if the item is a file item - */ - virtual bool isFileItem() const { return true; } - - /** - * Form a filename for the file item - */ - CString formFilename() const; - - /** - * Get a string? - */ - CString getFilename() const; -}; - -} // End of namespace Titanic - -#endif /* TITANIC_FILE_ITEM_H */ diff --git a/engines/titanic/objects/game_object.cpp b/engines/titanic/objects/game_object.cpp deleted file mode 100644 index 2e35417bd5..0000000000 --- a/engines/titanic/objects/game_object.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* 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 "titanic/objects/game_object.h" -#include "titanic/objects/resource_key.h" - -namespace Titanic { - -CGameObject::CGameObject(): CNamedItem() { - _bounds = Common::Rect(0, 0, 15, 15); - _field34 = 0; - _field38 = 0; - _field3C = 0; - _field40 = 0; - _field44 = 0xF0; - _field48 = 0xF0; - _field4C = 0xFF; - _field50 = 0; - _field54 = 0; - _field58 = 0; - _field5C = 1; - _field60 = 0; - _field74 = 1; - _field78 = 0; - _field8C = -1; - _field90 = 0; - _field94 = 0; - _field98 = 0; - _field9C = 0; - _fieldA0 = 0; - _fieldA4 = 0; - _fieldA8 = nullptr; - _fieldB8 = 0; -} - -void CGameObject::save(SimpleFile *file, int indent) const { - file->writeNumberLine(7, indent); - error("TODO: CGameObject::save"); - - CNamedItem::save(file, indent); -} - -void CGameObject::load(SimpleFile *file) { - int val = file->readNumber(); - CResourceKey resourceKey; - - switch (val) { - case 7: - _clipList2.load(file); - _field8C = file->readNumber(); - // Deliberate fall-through - - case 6: - val = _field74 = file->readNumber(); - // Deliberate fall-through - - case 5: - _clipList1.load(file); - // Deliberate fall-through - - case 4: - _field60 = file->readNumber(); - // Deliberate fall-through - - case 3: - _field40 = file->readNumber(); - // Deliberate fall-through - - case 2: - _string = file->readString(); - // Deliberate fall-through - - case 1: - _bounds = file->readRect(); - _field34 = file->readFloat(); - _field38 = file->readFloat(); - _field3C = file->readFloat(); - _field44 = file->readNumber(); - _field48 = file->readNumber(); - _field4C = file->readNumber(); - _fieldB8 = file->readNumber(); - _field5C = file->readNumber(); - _field50 = file->readNumber(); - _field54 = file->readNumber(); - _field58 = file->readNumber(); - - resourceKey.load(file); - _fieldA8 = nullptr; - val = file->readNumber(); - if (val) { - _string = resourceKey.getString(); - } - break; - - default: - break; - } - - CNamedItem::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/objects/game_object.h b/engines/titanic/objects/game_object.h deleted file mode 100644 index 53814f6d3d..0000000000 --- a/engines/titanic/objects/game_object.h +++ /dev/null @@ -1,82 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_GAME_OBJECT_H -#define TITANIC_GAME_OBJECT_H - -#include "common/rect.h" -#include "titanic/objects/movie_clip.h" -#include "titanic/objects/named_item.h" - -namespace Titanic { - -class CGameObject : public CNamedItem { -protected: - Common::Rect _bounds; - double _field34; - double _field38; - double _field3C; - int _field40; - int _field44; - int _field48; - int _field4C; - int _field50; - int _field54; - int _field58; - int _field5C; - int _field60; - CMovieClipList _clipList1; - int _field74; - int _field78; - CMovieClipList _clipList2; - int _field8C; - int _field90; - int _field94; - int _field98; - int _field9C; - int _fieldA0; - int _fieldA4; - void *_fieldA8; - CString _string; - int _fieldB8; -public: - CGameObject(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CGameObject"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_H */ diff --git a/engines/titanic/objects/link_item.cpp b/engines/titanic/objects/link_item.cpp deleted file mode 100644 index fe2a7cf162..0000000000 --- a/engines/titanic/objects/link_item.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* 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 "titanic/objects/link_item.h" - -namespace Titanic { - -CLinkItemSub::CLinkItemSub() : _field0(0), _field4(0), _field8(0), _fieldC(0) { -} - -CLinkItem::CLinkItem() : CNamedItem() { - _field24 = -1; - _field28 = -1; - _field2C = -1; - _field30 = 0; - _field34 = 1; - _name = "Link"; -} - -void CLinkItem::save(SimpleFile *file, int indent) const { - file->writeNumberLine(2, indent); - file->writeQuotedLine("L", indent); - file->writeNumberLine(_field34, indent + 1); - file->writeNumberLine(_field30, indent + 1); - file->writeNumberLine(_field24, indent + 1); - file->writeNumberLine(_field28, indent + 1); - file->writeNumberLine(_field2C, indent + 1); - - file->writeQuotedLine("Hotspot", indent + 1); - file->writeNumberLine(_sub._field0, indent + 2); - file->writeNumberLine(_sub._field4, indent + 2); - file->writeNumberLine(_sub._field8, indent + 2); - file->writeNumberLine(_sub._fieldC, indent + 2); - - CNamedItem::save(file, indent); -} - -void CLinkItem::load(SimpleFile *file) { - int val = file->readNumber(); - file->readBuffer(); - - switch (val) { - case 2: - _field34 = file->readNumber(); - // Deliberate fall-through - - case 1: - _field30 = file->readNumber(); - // Deliberate fall-through - - case 0: - _field24 = file->readNumber(); - _field28 = file->readNumber(); - _field2C = file->readNumber(); - - file->readBuffer(); - _sub._field0 = file->readNumber(); - _sub._field4 = file->readNumber(); - _sub._field8 = file->readNumber(); - _sub._fieldC = file->readNumber(); - break; - - default: - break; - } - - CNamedItem::load(file); - - if (val < 2) { - switch (_field30) { - case 2: - _field34 = 2; - break; - case 3: - _field34 = 3; - break; - case 5: - _field34 = 7; - break; - default: - _field34 = 4; - break; - } - } -} - -} // End of namespace Titanic diff --git a/engines/titanic/objects/link_item.h b/engines/titanic/objects/link_item.h deleted file mode 100644 index efe5ec1cf5..0000000000 --- a/engines/titanic/objects/link_item.h +++ /dev/null @@ -1,69 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_LINK_ITEM_H -#define TITANIC_LINK_ITEM_H - -#include "titanic/objects/named_item.h" - -namespace Titanic { - -class CLinkItemSub { -public: - int _field0; - int _field4; - int _field8; - int _fieldC; -public: - CLinkItemSub(); -}; - -class CLinkItem : public CNamedItem { -protected: - int _field24; - int _field28; - int _field2C; - int _field30; - int _field34; - CLinkItemSub _sub; -public: - CLinkItem(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CLinkItem"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_LINK_ITEM_H */ diff --git a/engines/titanic/objects/list.cpp b/engines/titanic/objects/list.cpp deleted file mode 100644 index 4e0178d31c..0000000000 --- a/engines/titanic/objects/list.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 "titanic/objects/list.h" - -namespace Titanic { - -void ListItem::save(SimpleFile *file, int indent) const { - file->writeNumberLine(0, indent); -} - -void ListItem::load(SimpleFile *file) { - file->readNumber(); -} - -} // End of namespace Titanic diff --git a/engines/titanic/objects/list.h b/engines/titanic/objects/list.h deleted file mode 100644 index 1842d2b5f8..0000000000 --- a/engines/titanic/objects/list.h +++ /dev/null @@ -1,139 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_LIST_H -#define TITANIC_LIST_H - -#include "common/scummsys.h" -#include "common/list.h" -#include "titanic/simple_file.h" -#include "titanic/objects/saveable_object.h" - -namespace Titanic { - -/** - * Base list item class - */ -class ListItem: public CSaveableObject { -public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "ListItem"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -template -class List : public CSaveableObject, public Common::List { -public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return nullptr; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const { - file->writeNumberLine(0, indent); - - // Write out number of items - file->writeQuotedLine("L", indent); - file->writeNumberLine(Common::List::size(), indent); - - // Iterate through writing entries - Common::List::const_iterator i; - for (i = Common::List::begin(); i != Common::List::end(); ++i) { - const ListItem *item = *i; - item->saveHeader(file, indent); - item->save(file, indent + 1); - item->saveFooter(file, indent); - } - - } - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file) { - file->readNumber(); - file->readBuffer(); - - Common::List::clear(); - uint count = file->readNumber(); - - for (uint idx = 0; idx < count; ++idx) { - // Validate the class start header - if (!file->IsClassStart()) - error("Unexpected class end"); - - // Get item's class name and use it to instantiate an item - CString className = file->readString(); - T *newItem = dynamic_cast(CSaveableObject::createInstance(className)); - if (!newItem) - error("Could not create instance of %s", className.c_str()); - - // Load the item's data and add it to the list - newItem->load(file); - Common::List::push_back(newItem); - - // Validate the class end footer - if (file->IsClassStart()) - error("Unexpected class start"); - } - } - - /** - * Clear the list and destroy any items in it - */ - void destroyContents() { - for (Common::List::iterator i = Common::List::begin(); - i != Common::List::end(); ++i) { - CSaveableObject *obj = *i; - delete obj; - } - - Common::List::clear(); - } - - /** - * Add a new item to the list of the type the list contains - */ - T *List::add() { - T *item = new T(); - Common::List::push_back(item); - return item; - } -}; - -} // End of namespace Titanic - -#endif /* TITANIC_LIST_H */ diff --git a/engines/titanic/objects/message_target.cpp b/engines/titanic/objects/message_target.cpp deleted file mode 100644 index bd162ff9eb..0000000000 --- a/engines/titanic/objects/message_target.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 "titanic/objects/message_target.h" - -namespace Titanic { - -void CMessageTarget::save(SimpleFile *file, int indent) const { - file->writeNumberLine(0, indent); - CSaveableObject::save(file, indent); -} - -void CMessageTarget::load(SimpleFile *file) { - file->readNumber(); - CSaveableObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/objects/message_target.h b/engines/titanic/objects/message_target.h deleted file mode 100644 index 5e29ddaf78..0000000000 --- a/engines/titanic/objects/message_target.h +++ /dev/null @@ -1,51 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_MESSAGE_TARGET_H -#define TITANIC_MESSAGE_TARGET_H - -#include "titanic/objects/saveable_object.h" - -namespace Titanic { - -class CMessageTarget: public CSaveableObject { -public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMessageTarget"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); - -}; - -} // End of namespace Titanic - -#endif /* TITANIC_MESSAGE_TARGET_H */ diff --git a/engines/titanic/objects/movie_clip.cpp b/engines/titanic/objects/movie_clip.cpp deleted file mode 100644 index 2914cc844c..0000000000 --- a/engines/titanic/objects/movie_clip.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* 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 "titanic/objects/movie_clip.h" - -namespace Titanic { - -CMovieClip::CMovieClip() { -} - -void CMovieClip::save(SimpleFile *file, int indent) const { - file->writeNumberLine(2, indent); - file->writeQuotedLine("Clip", indent); - file->writeQuotedLine(_string1, indent); - file->writeNumberLine(_field18, indent); - file->writeNumberLine(_field1C, indent); - - ListItem::save(file, indent); -} - -void CMovieClip::load(SimpleFile *file) { - int val = file->readNumber(); - - switch (val) { - case 1: - _string1 = file->readString(); - _field18 = file->readNumber(); - _field1C = file->readNumber(); - _field20 = file->readNumber(); - _field24 = file->readNumber(); - _field28 = file->readNumber(); - _field2C = file->readNumber(); - _field30 = file->readNumber(); - break; - - case 2: - file->readString(); - _string1 = file->readString(); - _field18 = file->readNumber(); - _field1C = file->readNumber(); - break; - - default: - break; - } - - ListItem::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/objects/movie_clip.h b/engines/titanic/objects/movie_clip.h deleted file mode 100644 index e259d970fe..0000000000 --- a/engines/titanic/objects/movie_clip.h +++ /dev/null @@ -1,74 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_MOVIE_CLIP_H -#define TITANIC_MOVIE_CLIP_H - -#include "titanic/objects/list.h" - -namespace Titanic { - -/** - * Movie clip - */ -class CMovieClip : public ListItem { -private: - CString _string1; - int _field18; - int _field1C; - int _field20; - int _field24; - int _field28; - int _field2C; - int _field30; - CString _string2; - CString _string3; -public: - CMovieClip(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMovieClip"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -/** - * Movie clip list - */ -class CMovieClipList: public List { -public: - virtual const char *getClassName() const { return "CMovieClipList"; } -}; - -} // End of namespace Titanic - -#endif /* TITANIC_MOVIE_CLIP_H */ diff --git a/engines/titanic/objects/named_item.cpp b/engines/titanic/objects/named_item.cpp deleted file mode 100644 index f7d7c7b75d..0000000000 --- a/engines/titanic/objects/named_item.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* 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 "titanic/objects/named_item.h" - -namespace Titanic { - -void CNamedItem::save(SimpleFile *file, int indent) const { - file->writeNumberLine(0, indent); - file->writeQuotedLine(_name, indent); - - CTreeItem::save(file, indent); -} - -void CNamedItem::load(SimpleFile *file) { - int val = file->readNumber(); - if (!val) - _name = file->readString(); - - CTreeItem::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/objects/named_item.h b/engines/titanic/objects/named_item.h deleted file mode 100644 index d59b73065b..0000000000 --- a/engines/titanic/objects/named_item.h +++ /dev/null @@ -1,52 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_NAMED_ITEM_H -#define TITANIC_NAMED_ITEM_H - -#include "titanic/objects/tree_item.h" - -namespace Titanic { - -class CNamedItem: public CTreeItem { -public: - CString _name; -public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CNamedItem"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_NAMED_ITEM_H */ diff --git a/engines/titanic/objects/node_item.cpp b/engines/titanic/objects/node_item.cpp deleted file mode 100644 index f2a55cf240..0000000000 --- a/engines/titanic/objects/node_item.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* 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 "titanic/objects/node_item.h" - -namespace Titanic { - -CNodeItem::CNodeItem() : CNamedItem(), _field24(0), _field28(0), _field2C(0) { -} - -void CNodeItem::save(SimpleFile *file, int indent) const { - file->writeNumberLine(0, indent); - file->writeQuotedLine("N", indent); - file->writeNumberLine(_field24, indent + 1); - file->writeNumberLine(_field28, indent + 1); - - file->writeQuotedLine("N", indent); - file->writeNumberLine(_field2C, indent + 1); - - CNamedItem::save(file, indent); -} - -void CNodeItem::load(SimpleFile *file) { - file->readNumber(); - file->readBuffer(); - _field24 = file->readNumber(); - _field28 = file->readNumber(); - - file->readBuffer(); - _field2C = file->readNumber(); - - CNamedItem::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/objects/node_item.h b/engines/titanic/objects/node_item.h deleted file mode 100644 index bfb534881f..0000000000 --- a/engines/titanic/objects/node_item.h +++ /dev/null @@ -1,56 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_NODE_ITEM_H -#define TITANIC_NODE_ITEM_H - -#include "titanic/objects/named_item.h" - -namespace Titanic { - -class CNodeItem : public CNamedItem { -private: - int _field24; - int _field28; - int _field2C; -public: - CNodeItem(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CNodeItem"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_FILE_ITEM_H */ diff --git a/engines/titanic/objects/pet_control.cpp b/engines/titanic/objects/pet_control.cpp deleted file mode 100644 index 73ef957e78..0000000000 --- a/engines/titanic/objects/pet_control.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 "titanic/objects/pet_control.h" - -namespace Titanic { - -void CPetControl::gameLoaded() { - // TODO -} - -} // End of namespace Titanic diff --git a/engines/titanic/objects/pet_control.h b/engines/titanic/objects/pet_control.h deleted file mode 100644 index f6c9707df8..0000000000 --- a/engines/titanic/objects/pet_control.h +++ /dev/null @@ -1,40 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_CONTROL_H -#define TITANIC_PET_CONTROL_H - -#include "titanic/objects/game_object.h" - -namespace Titanic { - -class CPetControl : public CGameObject { -public: - /** - * Called after loading a game has finished - */ - void gameLoaded(); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_H */ diff --git a/engines/titanic/objects/project_item.cpp b/engines/titanic/objects/project_item.cpp deleted file mode 100644 index 2bd75156d8..0000000000 --- a/engines/titanic/objects/project_item.cpp +++ /dev/null @@ -1,294 +0,0 @@ -/* 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/savefile.h" -#include "titanic/game_manager.h" -#include "titanic/titanic.h" -#include "titanic/compressed_file.h" -#include "titanic/objects/dont_save_file_item.h" -#include "titanic/objects/pet_control.h" -#include "titanic/objects/project_item.h" - -namespace Titanic { - -void CFileListItem::save(SimpleFile *file, int indent) const { - file->writeNumberLine(0, indent); - file->writeQuotedLine(_name, indent); - - ListItem::save(file, indent); -} - -void CFileListItem::load(SimpleFile *file) { - file->readNumber(); - _name = file->readString(); - - ListItem::load(file); -} - -/*------------------------------------------------------------------------*/ - -CProjectItem::CProjectItem() : _nextRoomNumber(0), _nextMessageNumber(0), - _nextObjectNumber(0), _gameManager(nullptr) { -} - -void CProjectItem::save(SimpleFile *file, int indent) const { - file->writeNumberLine(6, indent); - file->writeQuotedLine("Next Avail. Object Number", indent); - file->writeNumberLine(_nextObjectNumber, indent); - file->writeQuotedLine("Next Avail. Message Number", indent); - file->writeNumberLine(_nextMessageNumber, indent); - file->writeQuotedLine("Next Avail. Room Number", indent); - file->writeNumberLine(_nextRoomNumber, indent); - - CTreeItem::save(file, indent); -} - -void CProjectItem::buildFilesList() { - _files.destroyContents(); - - CTreeItem *treeItem = getFirstChild(); - while (treeItem) { - if (treeItem->isFileItem()) { - CString name = static_cast(treeItem)->getFilename(); - _files.add()->_name = name; - } - - treeItem = getNextSibling(); - } -} - -void CProjectItem::load(SimpleFile *file) { - int val = file->readNumber(); - _files.destroyContents(); - int count; - - switch (val) { - case 1: - file->readBuffer(); - _nextRoomNumber = file->readNumber(); - // Deliberate fall-through - - case 0: - // Load the list of files - count = file->readNumber(); - for (int idx = 0; idx < count; ++idx) { - CString name = file->readString(); - _files.add()->_name = name; - } - break; - - case 6: - file->readBuffer(); - _nextObjectNumber = file->readNumber(); - // Deliberate fall-through - - case 5: - file->readBuffer(); - _nextMessageNumber = file->readNumber(); - // Deliberate fall-through - - case 4: - file->readBuffer(); - // Deliberate fall-through - - case 2: - case 3: - _files.load(file); - file->readBuffer(); - _nextRoomNumber = file->readNumber(); - break; - - default: - break; - } - - CTreeItem::load(file); -} - -CGameManager *CProjectItem::getGameManager() { - return _gameManager; -} - -void CProjectItem::resetGameManager() { - _gameManager = nullptr; -} - -void CProjectItem::loadGame(int slotId) { - CompressedFile file; - Common::InSaveFile *saveFile = nullptr; - - // Clear any existing project contents - clear(); - - // Open either an existing savegame slot or the new game template - if (slotId >= 0) { - saveFile = g_system->getSavefileManager()->openForLoading( - Common::String::format("slot%d.gam", slotId)); - file.open(saveFile); - } else { - file.open("newgame.st"); - } - - // Load the contents in - CProjectItem *newProject = loadData(&file); - file.IsClassStart(); - getGameManager()->load(&file); - - file.close(); - - // Clear existing project - clear(); - - // Detach each item under the loaded project, and re-attach them - // to the existing project instance (this) - CTreeItem *item; - while ((item = newProject->getFirstChild()) != nullptr) { - item->detach(); - item->addUnder(this); - } - // Loaded project instance is no longer needed - newProject->destroyAll(); - - // Post-load processing - gameLoaded(); -} - -void CProjectItem::saveGame(int slotId) { - CompressedFile file; - Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving( - Common::String::format("slot%d.gam", slotId)); - file.open(saveFile); - - // Save the contents out - saveData(&file, this); - - file.close(); -} - -void CProjectItem::clear() { - CTreeItem *item; - while ((item = getFirstChild()) != nullptr) - item->destroyAll(); -} - -CProjectItem *CProjectItem::loadData(SimpleFile *file) { - if (!file->IsClassStart()) - return nullptr; - - CProjectItem *root = nullptr; - CTreeItem *parent = nullptr; - CTreeItem *item = nullptr; - - do { - CString entryString = file->readString(); - - if (entryString == "ALONG") { - // Move along, nothing needed - } else if (entryString == "UP") { - // Move up - if (parent == nullptr || - (parent = parent->getParent()) == nullptr) - break; - } else if (entryString == "DOWN") { - // Move down - if (parent == nullptr) - parent = item; - else - parent = parent->getLastChild(); - } else { - // Create new class instance - item = dynamic_cast(CSaveableObject::createInstance(entryString)); - assert(item); - - if (root) { - // Already created root project - item->addUnder(parent); - } else { - root = dynamic_cast(item); - assert(root); - root->_filename = _filename; - } - - // Load the data for the item - item->load(file); - } - - file->IsClassStart(); - } while (file->IsClassStart()); - - return root; -} - -void CProjectItem::saveData(SimpleFile *file, CTreeItem *item) const { - while (item) { - item->saveHeader(file, 0); - item->save(file, 1); - item->saveFooter(file, 0); - - - CTreeItem *child = item->getFirstChild(); - if (child) { - file->write("\n{\n", 3); - file->writeQuotedString("DOWN"); - file->write("\n}\n", 3); - saveData(file, child); - file->write("\n{\n", 3); - file->writeQuotedString("UP"); - } else { - file->write("\n{\n", 3); - file->writeQuotedString("ALONG"); - } - - file->write("\n}\n", 3); - item = item->getNextSibling(); - } -} - -void CProjectItem::gameLoaded() { - CGameManager *gameManager = getGameManager(); - if (gameManager) - gameManager->gameLoaded(); - - CPetControl *petControl = getPetControl(); - if (petControl) - petControl->gameLoaded(); -} - -CPetControl *CProjectItem::getPetControl() { - CDontSaveFileItem *fileItem = getDontSaveFileItem(); - CTreeItem *treeItem; - - if (!fileItem || (treeItem = fileItem->getLastChild()) == nullptr) - return nullptr; - - while (treeItem) { - CPetControl *petControl = dynamic_cast(treeItem); - if (petControl) - return petControl; - - treeItem = treeItem->getPriorSibling(); - } - - return nullptr; -} - -} // End of namespace Titanic diff --git a/engines/titanic/objects/project_item.h b/engines/titanic/objects/project_item.h deleted file mode 100644 index 066dbf69e0..0000000000 --- a/engines/titanic/objects/project_item.h +++ /dev/null @@ -1,150 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PROJECT_ITEM_H -#define TITANIC_PROJECT_ITEM_H - -#include "common/scummsys.h" -#include "titanic/simple_file.h" -#include "titanic/objects/file_item.h" -#include "titanic/objects/list.h" - -namespace Titanic { - -class CGameManager; -class CPetControl; - -/** - * File list item - */ -class CFileListItem : public ListItem { -public: - CString _name; - - virtual const char *getClassName() const { return "CFileListItem"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); - -}; - -/** - * Filename list - */ -class CFileList: public List { -public: - virtual const char *getClassName() const { return "CFileList"; } -}; - - -class CProjectItem : public CFileItem { -private: - CString _filename; - CFileList _files; - int _nextRoomNumber; - int _nextMessageNumber; - int _nextObjectNumber; - CGameManager *_gameManager; - - /** - * Called during save, iterates through the children to do some stuff - */ - void buildFilesList(); -private: - /** - * Load project data from the passed file - */ - CProjectItem *loadData(SimpleFile *file); - - /** - * Save project data to the passed file - */ - void saveData(SimpleFile *file, CTreeItem *item) const; - - /** - * Does post-loading processing - */ - void gameLoaded(); -public: - CProjectItem(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CProjectItem"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); - - /** - * Get the game manager for the project - */ - virtual CGameManager *getGameManager(); - - /** - * Get a reference to the PET control - */ - CPetControl *getPetControl(); - - /** - * Resets the game manager field - */ - void resetGameManager(); - - /** - * Load the entire project data for a given slot Id - */ - void loadGame(int slotId); - - /** - * Save the entire project data to a given savegame slot - */ - void saveGame(int slotId); - - /** - * Clear any currently loaded project - */ - void clear(); - - /** - * Set the proejct's name - */ - void setFilename(const CString &name) { _filename = name; } -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PROJECT_ITEM_H */ diff --git a/engines/titanic/objects/resource_key.cpp b/engines/titanic/objects/resource_key.cpp deleted file mode 100644 index 612014bb37..0000000000 --- a/engines/titanic/objects/resource_key.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* 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 "titanic/simple_file.h" -#include "titanic/objects/resource_key.h" - -namespace Titanic { - -void CResourceKey::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeQuotedLine("Resource Key...", indent); - file->writeQuotedLine(_key, indent); - - CSaveableObject::save(file, indent); -} - -void CResourceKey::load(SimpleFile *file) { - int val = file->readNumber(); - - if (val == 1) { - file->readBuffer(); - _value = file->readString(); - } - - CSaveableObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/objects/resource_key.h b/engines/titanic/objects/resource_key.h deleted file mode 100644 index 9d1b70ffc9..0000000000 --- a/engines/titanic/objects/resource_key.h +++ /dev/null @@ -1,56 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_RESOURCE_KEY_H -#define TITANIC_RESOURCE_KEY_H - -#include "titanic/string.h" -#include "titanic/objects/saveable_object.h" - -namespace Titanic { - -class CResourceKey: public CSaveableObject { -private: - CString _key; - CString _value; -public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CResourceKey"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); - - const CString &getString() const { return _key; } -}; - -} // End of namespace Titanic - -#endif /* TITANIC_RESOURCE_KEY_H */ diff --git a/engines/titanic/objects/saveable_object.cpp b/engines/titanic/objects/saveable_object.cpp deleted file mode 100644 index 73980d159b..0000000000 --- a/engines/titanic/objects/saveable_object.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* 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 "titanic/objects/saveable_object.h" -#include "titanic/objects/file_item.h" -#include "titanic/objects/link_item.h" -#include "titanic/objects/list.h" -#include "titanic/objects/message_target.h" -#include "titanic/objects/movie_clip.h" -#include "titanic/objects/node_item.h" -#include "titanic/objects/project_item.h" -#include "titanic/objects/saveable_object.h" -#include "titanic/objects/tree_item.h" -#include "titanic/objects/view_item.h" -#include "titanic/rooms/announce.h" -#include "titanic/rooms/pet_position.h" -#include "titanic/rooms/room_item.h" -#include "titanic/rooms/service_elevator_door.h" -#include "titanic/rooms/sub_glass.h" - -namespace Titanic { - -Common::HashMap * - CSaveableObject::_classList = nullptr; - -#define DEFFN(T) CSaveableObject *Function##T() { return new T(); } -#define ADDFN(T) (*_classList)[#T] = Function##T - -DEFFN(CAnnounce); -DEFFN(CFileItem); -DEFFN(CFileListItem); -DEFFN(CLinkItem); -DEFFN(CMessageTarget); -DEFFN(CMovieClip); -DEFFN(CMovieClipList); -DEFFN(CNodeItem); -DEFFN(CPETPosition); -DEFFN(CProjectItem); -DEFFN(CRoomItem); -DEFFN(CServiceElevatorDoor); -DEFFN(CSUBGlass); -DEFFN(CTreeItem); -DEFFN(CViewItem); - -void CSaveableObject::initClassList() { - _classList = new Common::HashMap(); - ADDFN(CAnnounce); - ADDFN(CFileItem); - ADDFN(CFileListItem); - ADDFN(CLinkItem); - ADDFN(CMessageTarget); - ADDFN(CMovieClip); - ADDFN(CMovieClipList); - ADDFN(CNodeItem); - ADDFN(CPETPosition); - ADDFN(CProjectItem); - ADDFN(CRoomItem); - ADDFN(CServiceElevatorDoor); - ADDFN(CSUBGlass); - ADDFN(CTreeItem); - ADDFN(CViewItem); -} - -void CSaveableObject::freeClassList() { - delete _classList; -} - -CSaveableObject *CSaveableObject::createInstance(const Common::String &name) { - return (*_classList)[name](); -} - -void CSaveableObject::save(SimpleFile *file, int indent) const { - file->writeNumberLine(0, indent); -} - -void CSaveableObject::load(SimpleFile *file) { - file->readNumber(); -} - -void CSaveableObject::saveHeader(SimpleFile *file, int indent) const { - file->writeClassStart(getClassName(), indent); -} - -void CSaveableObject::saveFooter(SimpleFile *file, int indent) const { - file->writeClassEnd(indent); -} - -} // End of namespace Titanic diff --git a/engines/titanic/objects/saveable_object.h b/engines/titanic/objects/saveable_object.h deleted file mode 100644 index 4e7d949191..0000000000 --- a/engines/titanic/objects/saveable_object.h +++ /dev/null @@ -1,83 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_SAVEABLE_OBJECT_H -#define TITANIC_SAVEABLE_OBJECT_H - -#include "common/scummsys.h" -#include "common/array.h" -#include "common/hash-str.h" -#include "titanic/simple_file.h" - -namespace Titanic { - -class CSaveableObject { - typedef CSaveableObject *(*CreateFunction)(); -private: - static Common::HashMap *_classList; -public: - /** - * Sets up the list of saveable object classes - */ - static void initClassList(); - - /** - * Free the list of saveable object classes - */ - static void freeClassList(); - - /** - * Creates a new instance of a saveable object class - */ - static CSaveableObject *createInstance(const Common::String &name); -public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSaveableObject"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); - - /** - * Write out a header definition for the class to file - * prior to saving the actual data for the class - */ - virtual void saveHeader(SimpleFile *file, int indent) const; - - /** - * Writes out a footer for the class after it's data has - * been written to file - */ - virtual void saveFooter(SimpleFile *file, int indent) const; -}; - -} // End of namespace Titanic - -#endif /* TITANIC_SAVEABLE_OBJECT_H */ diff --git a/engines/titanic/objects/tree_item.cpp b/engines/titanic/objects/tree_item.cpp deleted file mode 100644 index 3902df3d3a..0000000000 --- a/engines/titanic/objects/tree_item.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/* 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 "titanic/objects/tree_item.h" -#include "titanic/objects/dont_save_file_item.h" -#include "titanic/objects/file_item.h" - -namespace Titanic { - -CTreeItem::CTreeItem() : _parent(nullptr), _firstChild(nullptr), - _nextSibling(nullptr), _priorSibling(nullptr), _field14(0) { -} - -void CTreeItem::save(SimpleFile *file, int indent) const { - file->writeNumberLine(0, indent); - CMessageTarget::save(file, indent); -} - -void CTreeItem::load(SimpleFile *file) { - file->readNumber(); - CMessageTarget::load(file); -} - -CGameManager *CTreeItem::getGameManager() { - return _parent ? _parent->getGameManager() : nullptr; -} - -CTreeItem *CTreeItem::getRoot() const { - CTreeItem *parent = getParent(); - - if (parent) { - do { - parent = parent->getParent(); - } while (parent->getParent()); - } - - return parent; -} - -CTreeItem *CTreeItem::getLastSibling() { - CTreeItem *item = this; - while (item->getNextSibling()) - item = item->getNextSibling(); - - return item; -} - -CTreeItem *CTreeItem::getLastChild() { - if (!_firstChild) - return nullptr; - return _firstChild->getLastSibling(); -} - -CDontSaveFileItem *CTreeItem::getDontSaveFileItem() { - CTreeItem *item = getFirstChild(); - while (item) { - CDontSaveFileItem *fileItem = dynamic_cast(item); - if (fileItem) - return fileItem; - - item = item->getNextSibling(); - } -} - -void CTreeItem::addUnder(CTreeItem *newParent) { - if (newParent->_firstChild) - addSibling(newParent->getLastSibling()); - else - setParent(newParent); -} - -void CTreeItem::setParent(CTreeItem *newParent) { - _parent = newParent; - _priorSibling = nullptr; - _nextSibling = newParent->_firstChild; - - if (newParent->_firstChild) - newParent->_firstChild->_priorSibling = this; - newParent->_firstChild = this; -} - -void CTreeItem::addSibling(CTreeItem *item) { - _priorSibling = item->_nextSibling; - _nextSibling = item->_nextSibling; - _parent = item->_parent; - - if (item->_nextSibling) - item->_nextSibling->_priorSibling = this; - item->_nextSibling = this; -} - -void CTreeItem::destroyAll() { - destroyOthers(); - detach(); - delete this; -} - -int CTreeItem::destroyOthers() { - if (!_firstChild) - return 0; - - CTreeItem *item = this, *child, *nextSibling; - int total = 0; - - do { - child = item->_firstChild; - nextSibling = item->_nextSibling; - - if (child) - total += child->destroyOthers(); - child->detach(); - delete child; - ++total; - } while ((item = nextSibling) != nullptr); - - return total; -} - -void CTreeItem::detach() { - // Delink this item from any prior and/or next siblings - if (_priorSibling) - _priorSibling->_nextSibling = _nextSibling; - if (_nextSibling) - _nextSibling->_priorSibling = _priorSibling; - - if (_parent && _parent->_firstChild == this) - _parent->_firstChild = _nextSibling; - - _priorSibling = _nextSibling = _parent = nullptr; -} - -} // End of namespace Titanic diff --git a/engines/titanic/objects/tree_item.h b/engines/titanic/objects/tree_item.h deleted file mode 100644 index d6450e313a..0000000000 --- a/engines/titanic/objects/tree_item.h +++ /dev/null @@ -1,141 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_TREE_ITEM_H -#define TITANIC_TREE_ITEM_H - -#include "titanic/objects/message_target.h" - -namespace Titanic { - -class CGameManager; -class CDontSaveFileItem; - -class CTreeItem: public CMessageTarget { -private: - CTreeItem *_parent; - CTreeItem *_nextSibling; - CTreeItem *_priorSibling; - CTreeItem *_firstChild; - int _field14; -public: - CTreeItem(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CTreeItem"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); - - /** - * Get the game manager for the project - */ - virtual CGameManager *getGameManager(); - - /** - * Returns true if the item is a file item - */ - virtual bool isFileItem() const { return false; } - - /** - * Get the parent for the given item - */ - CTreeItem *getParent() const { return _parent; } - - /** - * Jumps up through the parents to find the sub-root item - */ - CTreeItem *getRoot() const; - - /** - * Get the next sibling - */ - CTreeItem *getNextSibling() { return _nextSibling; } - - /** - * Get the prior sibling - */ - CTreeItem *getPriorSibling() { return _priorSibling; } - - /** - * Get the last sibling of this sibling - */ - CTreeItem *getLastSibling(); - - /** - * Get the first child of the item, if any - */ - CTreeItem *getFirstChild() { return _firstChild; } - - /** - * Get the last child of the item, if any - */ - CTreeItem *getLastChild(); - - /** - * Get any dont save file item in the immediate children - */ - CDontSaveFileItem *getDontSaveFileItem(); - - /** - * Adds the item under another tree item - */ - void addUnder(CTreeItem *newParent); - - /** - * Sets the parent for the item - */ - void setParent(CTreeItem *newParent); - - /** - * Adds the item as a sibling of another item - */ - void addSibling(CTreeItem *item); - - /** - * Destroys both the item as well as any of it's children - */ - void destroyAll(); - - /** - * Destroys all tree items around the given one - */ - int destroyOthers(); - - /** - * Detach the tree item from any other associated tree items - */ - void detach(); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_TREE_ITEM_H */ diff --git a/engines/titanic/objects/view_item.cpp b/engines/titanic/objects/view_item.cpp deleted file mode 100644 index 1199ba9a62..0000000000 --- a/engines/titanic/objects/view_item.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* 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 "titanic/objects/view_item.h" - -namespace Titanic { - -CViewItem::CViewItem() : CNamedItem() { - _field24 = 0; - _field28 = 0.0; - _field30 = 0; - _field50 = 0; - _field54 = 0; - setData(0.0); -} - -void CViewItem::setData(double v) { - _field28 = v; - _field50 = cos(_field28) * 30.0; - _field54 = sin(_field28) * -30.0; -} - -void CViewItem::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - _resourceKey.save(file, indent); - file->writeQuotedLine("V", indent); - file->writeFloatLine(_field28, indent + 1); - file->writeNumberLine(_field30, indent + 1); - - CNamedItem::save(file, indent); -} - -void CViewItem::load(SimpleFile *file) { - int val = file->readNumber(); - - switch (val) { - case 1: - _resourceKey.load(file); - // Deliberate fall-through - - default: - file->readBuffer(); - setData(file->readFloat()); - _field30 = file->readNumber(); - break; - } - - CNamedItem::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/objects/view_item.h b/engines/titanic/objects/view_item.h deleted file mode 100644 index 1bd2d6d268..0000000000 --- a/engines/titanic/objects/view_item.h +++ /dev/null @@ -1,62 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_VIEW_ITEM_H -#define TITANIC_VIEW_ITEM_H - -#include "titanic/objects/named_item.h" -#include "titanic/objects/resource_key.h" - -namespace Titanic { - -class CViewItem : public CNamedItem { -private: - void setData(double v); -protected: - int _field24; - double _field28; - int _field30; - CResourceKey _resourceKey; - int _field50; - int _field54; -public: - CViewItem(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CNamedItem"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_NAMED_ITEM_H */ diff --git a/engines/titanic/rooms/announce.cpp b/engines/titanic/rooms/announce.cpp deleted file mode 100644 index b79056637b..0000000000 --- a/engines/titanic/rooms/announce.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* 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 "titanic/rooms/announce.h" - -namespace Titanic { - -CAnnounce::CAnnounce() : _fieldBC(0), _fieldC0(0), _fieldC4(1), _fieldC8(0) { -} - -void CAnnounce::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldBC, indent); - file->writeNumberLine(_fieldC0, indent); - file->writeNumberLine(_fieldC4, indent); - file->writeNumberLine(_fieldC8, indent); - - CGameObject::save(file, indent); -} - -void CAnnounce::load(SimpleFile *file) { - file->readNumber(); - _fieldBC = file->readNumber(); - _fieldC0 = file->readNumber(); - _fieldC4 = file->readNumber(); - _fieldC8 = file->readNumber(); - - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/rooms/announce.h b/engines/titanic/rooms/announce.h deleted file mode 100644 index 58f928d559..0000000000 --- a/engines/titanic/rooms/announce.h +++ /dev/null @@ -1,57 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_ANNOUNCE_H -#define TITANIC_ANNOUNCE_H - -#include "titanic/objects/game_object.h" - -namespace Titanic { - -class CAnnounce : public CGameObject { -private: - int _fieldBC; - int _fieldC0; - int _fieldC4; - int _fieldC8; -public: - CAnnounce(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CAnnounce"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_ROOM_ITEM_H */ diff --git a/engines/titanic/rooms/door_auto_sound_event.cpp b/engines/titanic/rooms/door_auto_sound_event.cpp deleted file mode 100644 index 279f4f98e6..0000000000 --- a/engines/titanic/rooms/door_auto_sound_event.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* 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 "titanic/rooms/door_auto_sound_event.h" - -namespace Titanic { - -CDoorAutoSoundEvent::CDoorAutoSoundEvent() : CAutoSoundEvent(), - _string1("z#44.wav"), _string2("z#43.wav"), _fieldDC(25), _fieldE0(25) { -} - -void CDoorAutoSoundEvent::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeQuotedLine(_string1, indent); - file->writeQuotedLine(_string2, indent); - file->writeNumberLine(_fieldDC, indent); - file->writeNumberLine(_fieldE0, indent); - - CAutoSoundEvent::save(file, indent); -} - -void CDoorAutoSoundEvent::load(SimpleFile *file) { - file->readNumber(); - _string1 = file->readString(); - _string2 = file->readString(); - _fieldDC = file->readNumber(); - _fieldE0 = file->readNumber(); - - CAutoSoundEvent::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/rooms/door_auto_sound_event.h b/engines/titanic/rooms/door_auto_sound_event.h deleted file mode 100644 index 4f960273b5..0000000000 --- a/engines/titanic/rooms/door_auto_sound_event.h +++ /dev/null @@ -1,57 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_DOOR_AUTO_SOUND_EVENT_H -#define TITANIC_DOOR_AUTO_SOUND_EVENT_H - -#include "titanic/objects/auto_sound_event.h" - -namespace Titanic { - -class CDoorAutoSoundEvent : public CAutoSoundEvent { -protected: - CString _string1; - CString _string2; - int _fieldDC; - int _fieldE0; -public: - CDoorAutoSoundEvent(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CDoorAutoSoundEvent"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_DOOR_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/rooms/pet_position.cpp b/engines/titanic/rooms/pet_position.cpp deleted file mode 100644 index b5bf2e6c01..0000000000 --- a/engines/titanic/rooms/pet_position.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 "titanic/rooms/pet_position.h" - -namespace Titanic { - -void CPETPosition::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - CGameObject::save(file, indent); -} - -void CPETPosition::load(SimpleFile *file) { - file->readNumber(); - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/rooms/pet_position.h b/engines/titanic/rooms/pet_position.h deleted file mode 100644 index dc27377eec..0000000000 --- a/engines/titanic/rooms/pet_position.h +++ /dev/null @@ -1,50 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_POSITION_H -#define TITANIC_PET_POSITION_H - -#include "titanic/objects/game_object.h" - -namespace Titanic { - -class CPETPosition : public CGameObject { -public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPETPosition"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_ROOM_ITEM_H */ diff --git a/engines/titanic/rooms/room_item.cpp b/engines/titanic/rooms/room_item.cpp deleted file mode 100644 index dce2bc093b..0000000000 --- a/engines/titanic/rooms/room_item.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* 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 "titanic/rooms/room_item.h" - -namespace Titanic { - -CRoomItem::CRoomItem() : CNamedItem(), _roomNumber(0), - _roomDimensionX(0.0), _roomDimensionY(0.0) { -} - -void CRoomItem::save(SimpleFile *file, int indent) const { - file->writeNumberLine(3, indent); - file->writeQuotedLine("Exit Movies", indent); - _exitMovieKey.save(file, indent); - - file->writeNumberLine(_roomDimensionX * 1000.0, indent + 1); - file->writeNumberLine(_roomDimensionY * 1000.0, indent + 1); - - file->writeQuotedLine("Transition Movie", indent); - _transitionMovieKey.save(file, indent); - - file->writeQuotedLine("Movie Clip list", indent); - _clipList.save(file, indent + 1); - - file->writeQuotedLine("Room Rect", indent); - file->writeNumberLine(_roomRect.left, indent + 1); - file->writeNumberLine(_roomRect.top, indent + 1); - file->writeNumberLine(_roomRect.right, indent + 1); - file->writeNumberLine(_roomRect.bottom, indent + 1); - - file->writeQuotedLine("Room Number", indent); - file->writeNumberLine(_roomNumber, indent); - - CNamedItem::save(file, indent); -} - -void CRoomItem::load(SimpleFile *file) { - int val = file->readNumber(); - - switch (val) { - case 3: - // Read exit movie - file->readBuffer(); - _exitMovieKey.load(file); - // Deliberate fall-through - - case 2: - // Read room dimensions - file->readBuffer(); - _roomDimensionX = (double)file->readNumber() / 1000.0; - _roomDimensionY = (double)file->readNumber() / 1000.0; - // Deliberate fall-through - - case 1: - // Read transition movie key and clip list - file->readBuffer(); - _transitionMovieKey.load(file); - - file->readBuffer(); - _clipList.load(file); - loading(); - // Deliberate fall-through - - case 0: - // Read room rect - file->readBuffer(); - _roomRect.left = file->readNumber(); - _roomRect.top = file->readNumber(); - _roomRect.right = file->readNumber(); - _roomRect.bottom = file->readNumber(); - file->readBuffer(); - _roomNumber = file->readNumber(); - break; - - default: - break; - } - - CNamedItem::load(file); -} - -void CRoomItem::loading() { - // TODO -} - -} // End of namespace Titanic diff --git a/engines/titanic/rooms/room_item.h b/engines/titanic/rooms/room_item.h deleted file mode 100644 index 4df14aae7d..0000000000 --- a/engines/titanic/rooms/room_item.h +++ /dev/null @@ -1,65 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_ROOM_ITEM_H -#define TITANIC_ROOM_ITEM_H - -#include "common/rect.h" -#include "titanic/objects/list.h" -#include "titanic/objects/movie_clip.h" -#include "titanic/objects/named_item.h" -#include "titanic/objects/resource_key.h" - -namespace Titanic { - -class CRoomItem : public CNamedItem { -private: - Common::Rect _roomRect; - CMovieClipList _clipList; - int _roomNumber; - CResourceKey _transitionMovieKey; - CResourceKey _exitMovieKey; - double _roomDimensionX, _roomDimensionY; - - void loading(); -public: - CRoomItem(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CRoomItem"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_ROOM_ITEM_H */ diff --git a/engines/titanic/rooms/service_elevator_door.cpp b/engines/titanic/rooms/service_elevator_door.cpp deleted file mode 100644 index 931a9d6474..0000000000 --- a/engines/titanic/rooms/service_elevator_door.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* 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 "titanic/rooms/service_elevator_door.h" - -namespace Titanic { - -CServiceElevatorDoor::CServiceElevatorDoor() : CDoorAutoSoundEvent() { - _string1 = "z#31.wav"; - _string2 = "z#32.wav"; -} - -void CServiceElevatorDoor::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeQuotedLine(_string2, indent); - file->writeQuotedLine(_string1, indent); - - CDoorAutoSoundEvent::save(file, indent); -} - -void CServiceElevatorDoor::load(SimpleFile *file) { - file->readNumber(); - _string2 = file->readString(); - _string1 = file->readString(); - - CDoorAutoSoundEvent::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/rooms/service_elevator_door.h b/engines/titanic/rooms/service_elevator_door.h deleted file mode 100644 index 5b924bc17c..0000000000 --- a/engines/titanic/rooms/service_elevator_door.h +++ /dev/null @@ -1,52 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_SERVICE_ELEVATOR_DOOR_H -#define TITANIC_SERVICE_ELEVATOR_DOOR_H - -#include "titanic/rooms/door_auto_sound_event.h" - -namespace Titanic { - -class CServiceElevatorDoor : public CDoorAutoSoundEvent { -public: - CServiceElevatorDoor(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CServiceElevatorDoor"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_SERVICE_ELEVATOR_DOOR_H */ diff --git a/engines/titanic/rooms/sub_glass.cpp b/engines/titanic/rooms/sub_glass.cpp deleted file mode 100644 index 27f47fd017..0000000000 --- a/engines/titanic/rooms/sub_glass.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* 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 "titanic/rooms/sub_glass.h" - -namespace Titanic { - -CSUBGlass::CSUBGlass() : _fieldBC(0), _fieldC0(0), _fieldC4(1), _fieldC8(0) { -} - -void CSUBGlass::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldBC, indent); - file->writeNumberLine(_fieldC0, indent); - file->writeNumberLine(_fieldC4, indent); - file->writeNumberLine(_fieldC8, indent); - file->writeNumberLine(_fieldCC, indent); - file->writeQuotedLine(_string, indent); - - CGameObject::save(file, indent); -} - -void CSUBGlass::load(SimpleFile *file) { - file->readNumber(); - _fieldBC = file->readNumber(); - _fieldC0 = file->readNumber(); - _fieldC4 = file->readNumber(); - _fieldC8 = file->readNumber(); - _fieldCC = file->readNumber(); - _string = file->readString(); - - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/rooms/sub_glass.h b/engines/titanic/rooms/sub_glass.h deleted file mode 100644 index b7a992db9c..0000000000 --- a/engines/titanic/rooms/sub_glass.h +++ /dev/null @@ -1,59 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_SUB_GLASS_H -#define TITANIC_SUB_GLASS_H - -#include "titanic/objects/game_object.h" - -namespace Titanic { - -class CSUBGlass : public CGameObject { -private: - int _fieldBC; - int _fieldC0; - int _fieldC4; - int _fieldC8; - int _fieldCC; - CString _string; -public: - CSUBGlass(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSUBGlass"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_ROOM_ITEM_H */ diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index d998ec5837..47b7c1336a 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -28,7 +28,7 @@ #include "graphics/scaler.h" #include "graphics/thumbnail.h" #include "titanic/titanic.h" -#include "titanic/objects/saveable_object.h" +#include "titanic/core/saveable_object.h" namespace Titanic { -- cgit v1.2.3 From 4bd8ae116624802dd9e6e371bae8599523aa19b2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 25 Feb 2016 19:52:21 -0500 Subject: TITANIC: Implemented CSuccUBus and ancestor classes --- engines/titanic/core/saveable_object.cpp | 3 + engines/titanic/game/succubus.cpp | 54 -------- engines/titanic/game/succubus.h | 59 --------- engines/titanic/module.mk | 5 +- engines/titanic/npcs/character.cpp | 50 +++++++ engines/titanic/npcs/character.h | 57 ++++++++ engines/titanic/npcs/succubus.cpp | 215 +++++++++++++++++++++++++++++++ engines/titanic/npcs/succubus.h | 110 ++++++++++++++++ engines/titanic/npcs/true_talk_npc.cpp | 66 ++++++++++ engines/titanic/npcs/true_talk_npc.h | 64 +++++++++ 10 files changed, 569 insertions(+), 114 deletions(-) delete mode 100644 engines/titanic/game/succubus.cpp delete mode 100644 engines/titanic/game/succubus.h create mode 100644 engines/titanic/npcs/character.cpp create mode 100644 engines/titanic/npcs/character.h create mode 100644 engines/titanic/npcs/succubus.cpp create mode 100644 engines/titanic/npcs/succubus.h create mode 100644 engines/titanic/npcs/true_talk_npc.cpp create mode 100644 engines/titanic/npcs/true_talk_npc.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index c7e749e9dd..ec0f2937ec 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -36,6 +36,7 @@ #include "titanic/game/room_item.h" #include "titanic/game/service_elevator_door.h" #include "titanic/game/sub_glass.h" +#include "titanic/npcs/succubus.h" namespace Titanic { @@ -58,6 +59,7 @@ DEFFN(CProjectItem); DEFFN(CRoomItem); DEFFN(CServiceElevatorDoor); DEFFN(CSUBGlass); +DEFFN(CSuccUBus); DEFFN(CTreeItem); DEFFN(CViewItem); @@ -76,6 +78,7 @@ void CSaveableObject::initClassList() { ADDFN(CRoomItem); ADDFN(CServiceElevatorDoor); ADDFN(CSUBGlass); + ADDFN(CSuccUBus); ADDFN(CTreeItem); ADDFN(CViewItem); } diff --git a/engines/titanic/game/succubus.cpp b/engines/titanic/game/succubus.cpp deleted file mode 100644 index 27f47fd017..0000000000 --- a/engines/titanic/game/succubus.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* 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 "titanic/rooms/sub_glass.h" - -namespace Titanic { - -CSUBGlass::CSUBGlass() : _fieldBC(0), _fieldC0(0), _fieldC4(1), _fieldC8(0) { -} - -void CSUBGlass::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldBC, indent); - file->writeNumberLine(_fieldC0, indent); - file->writeNumberLine(_fieldC4, indent); - file->writeNumberLine(_fieldC8, indent); - file->writeNumberLine(_fieldCC, indent); - file->writeQuotedLine(_string, indent); - - CGameObject::save(file, indent); -} - -void CSUBGlass::load(SimpleFile *file) { - file->readNumber(); - _fieldBC = file->readNumber(); - _fieldC0 = file->readNumber(); - _fieldC4 = file->readNumber(); - _fieldC8 = file->readNumber(); - _fieldCC = file->readNumber(); - _string = file->readString(); - - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/succubus.h b/engines/titanic/game/succubus.h deleted file mode 100644 index f99597b53e..0000000000 --- a/engines/titanic/game/succubus.h +++ /dev/null @@ -1,59 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_SUCCUBUS_H -#define TITANIC_SUCCUBUS_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CSuccUBus : public CGameObject { -private: - int _fieldBC; - int _fieldC0; - int _fieldC4; - int _fieldC8; - int _fieldCC; - CString _string; -public: - CSuccUBus(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSuccUBus"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_SUCCUBUS_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 97053a52b7..7ae284add1 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -36,7 +36,10 @@ MODULE_OBJS := \ game/pet_position.o \ game/room_item.o \ game/service_elevator_door.o \ - game/sub_glass.o + game/sub_glass.o \ + npcs/character.o \ + npcs/succubus.o \ + npcs/true_talk_npc.o # This module can be built as a plugin ifeq ($(ENABLE_TITANIC), DYNAMIC_PLUGIN) diff --git a/engines/titanic/npcs/character.cpp b/engines/titanic/npcs/character.cpp new file mode 100644 index 0000000000..b8112ce56b --- /dev/null +++ b/engines/titanic/npcs/character.cpp @@ -0,0 +1,50 @@ +/* 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 "titanic/npcs/character.h" + +namespace Titanic { + +CCharacter::CCharacter() : CGameObject(), _fieldBC(0), _fieldC0(0), _fieldC4(1) { +} + +void CCharacter::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_fieldC4, indent); + file->writeQuotedLine(_charName, indent); + + CGameObject::save(file, indent); +} + +void CCharacter::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _fieldC4 = file->readNumber(); + _charName = file->readString(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/npcs/character.h b/engines/titanic/npcs/character.h new file mode 100644 index 0000000000..7f489d238f --- /dev/null +++ b/engines/titanic/npcs/character.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_CHARACTER_H +#define TITANIC_CHARACTER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CCharacter : public CGameObject { +protected: + int _fieldBC; + int _fieldC0; + int _fieldC4; + CString _charName; +public: + CCharacter(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CCharacter"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SUCCUBUS_H */ diff --git a/engines/titanic/npcs/succubus.cpp b/engines/titanic/npcs/succubus.cpp new file mode 100644 index 0000000000..7570338274 --- /dev/null +++ b/engines/titanic/npcs/succubus.cpp @@ -0,0 +1,215 @@ +/* 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 "titanic/npcs/succubus.h" + +namespace Titanic { + +int CSuccUBus::_v0; +int CSuccUBus::_v1; +int CSuccUBus::_v2; +int CSuccUBus::_v3; +int CSuccUBus::_v4; + +CSuccUBus::CSuccUBus() : CTrueTalkNPC() { + _field108 = -1; + _field10C = -1; + _field110 = -1; + _field114 = -1; + _field118 = 0x44; + _field11C = 0xA8; + _field120 = 0xA8; + _field124 = 0xF8; + _field128 = 0; + _field12C = 0x0E; + _field130 = 0x0E; + _field134 = 27; + _field138 = 40; + _field13C = 0x44; + _field140 = 1; + _field144 = 0; + _field148 = 0; + _field14C = 0; + _field150 = 0xE0; + _field154 = 0; + _field158 = 0; + _field15C = 0; + _string2 = "NULL"; + _field16C = 28; + _field170 = 40; + _field174 = 82; + _field178 = 284; + _field17C = 148; + _field180 = 339; + _field184 = 15; + _field188 = 0; + _field18C = 0; + _field190 = 0; + _field194 = 240; + _field198 = 340; + _field19C = 0; + _field1A0 = -1; + _field1A4 = 0; + _field1A8 = 0; + _field1AC = 0; + _field1B0 = 0; + _field1B4 = 303; + _field1B8 = 312; + _field1BC = 313; + _field1C0 = 325; + _field1C4 = 326; + _field1C8 = 347; + _field1CC = 348; + _field1D0 = 375; + _field1D4 = 1; + _field1D8 = 0; +} + +void CSuccUBus::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + + file->writeNumberLine(_v0, indent); + file->writeNumberLine(_field108, indent); + file->writeNumberLine(_field10C, indent); + file->writeNumberLine(_field110, indent); + file->writeNumberLine(_field114, indent); + file->writeNumberLine(_field118, indent); + file->writeNumberLine(_field11C, indent); + file->writeNumberLine(_field120, indent); + file->writeNumberLine(_field124, indent); + file->writeNumberLine(_field128, indent); + file->writeNumberLine(_field12C, indent); + file->writeNumberLine(_field130, indent); + file->writeNumberLine(_field134, indent); + file->writeNumberLine(_field138, indent); + file->writeNumberLine(_field13C, indent); + file->writeNumberLine(_field140, indent); + + file->writeNumberLine(_v2, indent); + file->writeNumberLine(_field148, indent); + file->writeNumberLine(_field14C, indent); + file->writeNumberLine(_field150, indent); + file->writeNumberLine(_field154, indent); + file->writeNumberLine(_field158, indent); + file->writeNumberLine(_field15C, indent); + + file->writeQuotedLine(_string2, indent); + file->writeNumberLine(_field16C, indent); + file->writeNumberLine(_field170, indent); + file->writeNumberLine(_field174, indent); + file->writeNumberLine(_field178, indent); + file->writeNumberLine(_field17C, indent); + file->writeNumberLine(_field180, indent); + file->writeNumberLine(_field184, indent); + file->writeNumberLine(_field188, indent); + file->writeNumberLine(_field18C, indent); + file->writeNumberLine(_field190, indent); + file->writeNumberLine(_field194, indent); + file->writeNumberLine(_field198, indent); + file->writeNumberLine(_field19C, indent); + file->writeNumberLine(_field1A0, indent); + file->writeNumberLine(_field1A4, indent); + file->writeNumberLine(_field1A8, indent); + file->writeNumberLine(_field1AC, indent); + file->writeNumberLine(_field1B0, indent); + file->writeNumberLine(_field1B4, indent); + file->writeNumberLine(_field1B8, indent); + file->writeNumberLine(_field1BC, indent); + file->writeNumberLine(_field1C0, indent); + file->writeNumberLine(_field1C4, indent); + file->writeNumberLine(_field1C8, indent); + file->writeNumberLine(_field1CC, indent); + file->writeNumberLine(_field1D0, indent); + file->writeNumberLine(_field1D4, indent); + + file->writeNumberLine(_v3, indent); + file->writeNumberLine(_field1D8, indent); + file->writeNumberLine(_field104, indent); + + CTrueTalkNPC::save(file, indent); +} + +void CSuccUBus::load(SimpleFile *file) { + file->readNumber(); + + _v0 = file->readNumber(); + _field108 = file->readNumber(); + _field10C = file->readNumber(); + _field110 = file->readNumber(); + _field114 = file->readNumber(); + _field118 = file->readNumber(); + _field11C = file->readNumber(); + _field120 = file->readNumber(); + _field124 = file->readNumber(); + _field128 = file->readNumber(); + _field12C = file->readNumber(); + _field130 = file->readNumber(); + _field134 = file->readNumber(); + _field138 = file->readNumber(); + _field13C = file->readNumber(); + _field140 = file->readNumber(); + + _v2 = file->readNumber(); + _field148 = file->readNumber(); + _field14C = file->readNumber(); + _field150 = file->readNumber(); + _field154 = file->readNumber(); + _field158 = file->readNumber(); + _field15C = file->readNumber(); + + _string2 = file->readString(); + _field16C = file->readNumber(); + _field170 = file->readNumber(); + _field174 = file->readNumber(); + _field178 = file->readNumber(); + _field17C = file->readNumber(); + _field180 = file->readNumber(); + _field184 = file->readNumber(); + _field188 = file->readNumber(); + _field18C = file->readNumber(); + _field190 = file->readNumber(); + _field194 = file->readNumber(); + _field198 = file->readNumber(); + _field19C = file->readNumber(); + _field1A0 = file->readNumber(); + _field1A4 = file->readNumber(); + _field1A8 = file->readNumber(); + _field1AC = file->readNumber(); + _field1B0 = file->readNumber(); + _field1B4 = file->readNumber(); + _field1B8 = file->readNumber(); + _field1BC = file->readNumber(); + _field1C0 = file->readNumber(); + _field1C4 = file->readNumber(); + _field1C8 = file->readNumber(); + _field1CC = file->readNumber(); + _field1D0 = file->readNumber(); + _field1D4 = file->readNumber(); + + _v3 = file->readNumber(); + _field1D8 = file->readNumber(); + _field104 = file->readNumber(); + + CTrueTalkNPC::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/npcs/succubus.h b/engines/titanic/npcs/succubus.h new file mode 100644 index 0000000000..2e30b12ab5 --- /dev/null +++ b/engines/titanic/npcs/succubus.h @@ -0,0 +1,110 @@ +/* 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. + * + */ + +#ifndef TITANIC_SUCCUBUS_H +#define TITANIC_SUCCUBUS_H + +#include "titanic/npcs/true_talk_npc.h" + +namespace Titanic { + +class CSuccUBus : public CTrueTalkNPC { +private: + static int _v0; + static int _v1; + static int _v2; + static int _v3; + static int _v4; +private: + int _field108; + int _field10C; + int _field110; + int _field114; + int _field118; + int _field11C; + int _field120; + int _field124; + int _field128; + int _field12C; + int _field130; + int _field134; + int _field138; + int _field13C; + int _field140; + int _field144; + int _field148; + int _field14C; + int _field150; + int _field154; + int _field158; + int _field15C; + CString _string2; + int _field16C; + int _field170; + int _field174; + int _field178; + int _field17C; + int _field180; + int _field184; + int _field188; + int _field18C; + int _field190; + int _field194; + int _field198; + int _field19C; + int _field1A0; + int _field1A4; + int _field1A8; + int _field1AC; + int _field1B0; + int _field1B4; + int _field1B8; + int _field1BC; + int _field1C0; + int _field1C4; + int _field1C8; + int _field1CC; + int _field1D0; + int _field1D4; + int _field1D8; +public: + CSuccUBus(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSuccUBus"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SUCCUBUS_H */ diff --git a/engines/titanic/npcs/true_talk_npc.cpp b/engines/titanic/npcs/true_talk_npc.cpp new file mode 100644 index 0000000000..924ea5657c --- /dev/null +++ b/engines/titanic/npcs/true_talk_npc.cpp @@ -0,0 +1,66 @@ +/* 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 "titanic/npcs/true_talk_npc.h" + +namespace Titanic { + +CTrueTalkNPC::CTrueTalkNPC() : _string1("z451.dlg"), + _fieldD4(0x11170), _fieldE4(0), _fieldE8(0), _fieldEC(0), _fieldF0(0), + _fieldF4(0), _fieldF8(0), _fieldFC(0), _field100(0), _field104(0) { +} + +void CTrueTalkNPC::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldD4, indent); + file->writeQuotedLine(_string1, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_fieldEC, indent); + file->writeNumberLine(_fieldF0, indent); + file->writeNumberLine(_fieldF4, indent); + file->writeNumberLine(_fieldF8, indent); + file->writeNumberLine(_fieldFC, indent); + file->writeNumberLine(_field100, indent); + file->writeNumberLine(_field104, indent); + + CCharacter::save(file, indent); +} + +void CTrueTalkNPC::load(SimpleFile *file) { + file->readNumber(); + _fieldD4 = file->readNumber(); + _string1 = file->readString(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + _fieldEC = file->readNumber(); + _fieldF0 = file->readNumber(); + _fieldF4 = file->readNumber(); + _fieldF8 = file->readNumber(); + _fieldFC = file->readNumber(); + _field100 = file->readNumber(); + _field104 = file->readNumber(); + + CCharacter::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/npcs/true_talk_npc.h b/engines/titanic/npcs/true_talk_npc.h new file mode 100644 index 0000000000..aed1ddb404 --- /dev/null +++ b/engines/titanic/npcs/true_talk_npc.h @@ -0,0 +1,64 @@ +/* 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. + * + */ + +#ifndef TITANIC_TRUE_TALK_NPC_H +#define TITANIC_TRUE_TALK_NPC_H + +#include "titanic/npcs/character.h" + +namespace Titanic { + +class CTrueTalkNPC : public CCharacter { +protected: + int _fieldD4; + CString _string1; + int _fieldE4; + int _fieldE8; + int _fieldEC; + int _fieldF0; + int _fieldF4; + int _fieldF8; + int _fieldFC; + int _field100; + int _field104; +public: + CTrueTalkNPC(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CTrueTalkNPC"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TRUE_TALK_NPC_H */ -- cgit v1.2.3 From 06ce0dbfddb016dc18ac38bbd938b8b5c71f454a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 25 Feb 2016 21:42:10 -0500 Subject: TITANIC: Implement TrueTalk NPC classes --- engines/titanic/core/saveable_object.cpp | 21 +++ engines/titanic/module.mk | 7 + engines/titanic/npcs/barbot.cpp | 236 +++++++++++++++++++++++++++++++ engines/titanic/npcs/barbot.h | 196 +++++++++++++++++++++++++ engines/titanic/npcs/bellbot.cpp | 44 ++++++ engines/titanic/npcs/bellbot.h | 54 +++++++ engines/titanic/npcs/deskbot.cpp | 53 +++++++ engines/titanic/npcs/deskbot.h | 58 ++++++++ engines/titanic/npcs/doorbot.cpp | 63 +++++++++ engines/titanic/npcs/doorbot.h | 60 ++++++++ engines/titanic/npcs/liftbot.cpp | 51 +++++++ engines/titanic/npcs/liftbot.h | 57 ++++++++ engines/titanic/npcs/maitre_d.cpp | 68 +++++++++ engines/titanic/npcs/maitre_d.h | 64 +++++++++ engines/titanic/npcs/parrot.cpp | 143 +++++++++++++++++++ engines/titanic/npcs/parrot.h | 115 +++++++++++++++ 16 files changed, 1290 insertions(+) create mode 100644 engines/titanic/npcs/barbot.cpp create mode 100644 engines/titanic/npcs/barbot.h create mode 100644 engines/titanic/npcs/bellbot.cpp create mode 100644 engines/titanic/npcs/bellbot.h create mode 100644 engines/titanic/npcs/deskbot.cpp create mode 100644 engines/titanic/npcs/deskbot.h create mode 100644 engines/titanic/npcs/doorbot.cpp create mode 100644 engines/titanic/npcs/doorbot.h create mode 100644 engines/titanic/npcs/liftbot.cpp create mode 100644 engines/titanic/npcs/liftbot.h create mode 100644 engines/titanic/npcs/maitre_d.cpp create mode 100644 engines/titanic/npcs/maitre_d.h create mode 100644 engines/titanic/npcs/parrot.cpp create mode 100644 engines/titanic/npcs/parrot.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index ec0f2937ec..8f7c38692f 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -36,6 +36,13 @@ #include "titanic/game/room_item.h" #include "titanic/game/service_elevator_door.h" #include "titanic/game/sub_glass.h" +#include "titanic/npcs/barbot.h" +#include "titanic/npcs/bellbot.h" +#include "titanic/npcs/deskbot.h" +#include "titanic/npcs/doorbot.h" +#include "titanic/npcs/liftbot.h" +#include "titanic/npcs/maitre_d.h" +#include "titanic/npcs/parrot.h" #include "titanic/npcs/succubus.h" namespace Titanic { @@ -47,13 +54,20 @@ Common::HashMap * #define ADDFN(T) (*_classList)[#T] = Function##T DEFFN(CAnnounce); +DEFFN(CBarbot); +DEFFN(CBellBot); +DEFFN(CDeskbot); +DEFFN(CDoorbot); DEFFN(CFileItem); DEFFN(CFileListItem); +DEFFN(CLiftBot); DEFFN(CLinkItem); +DEFFN(CMaitreD); DEFFN(CMessageTarget); DEFFN(CMovieClip); DEFFN(CMovieClipList); DEFFN(CNodeItem); +DEFFN(CParrot); DEFFN(CPETPosition); DEFFN(CProjectItem); DEFFN(CRoomItem); @@ -66,13 +80,20 @@ DEFFN(CViewItem); void CSaveableObject::initClassList() { _classList = new Common::HashMap(); ADDFN(CAnnounce); + ADDFN(CBarbot); + ADDFN(CBellBot); + ADDFN(CDeskbot); + ADDFN(CDoorbot); ADDFN(CFileItem); ADDFN(CFileListItem); + ADDFN(CLiftBot); ADDFN(CLinkItem); + ADDFN(CMaitreD); ADDFN(CMessageTarget); ADDFN(CMovieClip); ADDFN(CMovieClipList); ADDFN(CNodeItem); + ADDFN(CParrot); ADDFN(CPETPosition); ADDFN(CProjectItem); ADDFN(CRoomItem); diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 7ae284add1..1d94289315 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -37,7 +37,14 @@ MODULE_OBJS := \ game/room_item.o \ game/service_elevator_door.o \ game/sub_glass.o \ + npcs/barbot.o \ + npcs/bellbot.o \ npcs/character.o \ + npcs/deskbot.o \ + npcs/doorbot.o \ + npcs/liftbot.o \ + npcs/maitre_d.o \ + npcs/parrot.o \ npcs/succubus.o \ npcs/true_talk_npc.o diff --git a/engines/titanic/npcs/barbot.cpp b/engines/titanic/npcs/barbot.cpp new file mode 100644 index 0000000000..a460bdb672 --- /dev/null +++ b/engines/titanic/npcs/barbot.cpp @@ -0,0 +1,236 @@ +/* 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 "titanic/npcs/barbot.h" + +namespace Titanic { + +int CBarbot::_v0; + +CBarbot::CBarbot() : CTrueTalkNPC() { + _field108 = 0; + _field10C = 0; + _field110 = 0; + _field114 = 0; + _field118 = 0; + _field11C = 0; + _field120 = 0; + _field124 = 0; + _field128 = 0; + _field12C = 0; + _field130 = 0; + _field134 = 0; + _field138 = 0; + _field13C = -1; + _field140 = 30; + _field144 = -1; + _field148 = -1; + _field14C = 0; + _field150 = 0; + _field154 = 0; + _field158 = -1; + _field15C = 0; + _field160 = 0; + _field164 = 558; + _field168 = 585; + _field16C = 659; + _field170 = 692; + _field174 = 802; + _field178 = 816; + _field17C = 1941; + _field180 = 1977; + _field184 = 1901; + _field188 = 1941; + _field18C = 810; + _field190 = 816; + _field194 = 857; + _field198 = 865; + _field19C = 842; + _field1A0 = 857; + _field1A4 = 821; + _field1A8 = 842; + _field1AC = 682; + _field1B0 = 692; + _field1B4 = 1977; + _field1B8 = 2018; + _field1BC = 2140; + _field1C0 = 2170; + _field1C4 = 2101; + _field1C8 = 2139; + _field1CC = 2018; + _field1D0 = 2099; + _field1D4 = 1902; + _field1D8 = 2015; + _field1E0 = 1811; + _field1E4 = 1901; + _field1E8 = 1810; + _field1EC = 1703; + _field1F0 = 1750; + _field1F4 = 1681; + _field1F8 = 1702; + _field1FC = 1642; + + _field200 = 1702; + _field204 = 1571; + _field208 = 1641; + _field20C = 1499; + _field210 = 1570; + _field214 = 1403; + _field218 = 1463; + _field21C = 1464; + _field220 = 1499; + _field224 = 1288; + _field228 = 1295; + _field22C = 1266; + _field230 = 1287; + _field234 = 1245; + _field238 = 1265; + _field23C = 1208; + _field240 = 1244; + _field244 = 1171; + _field248 = 1207; + _field24C = 1120; + _field250 = 1170; + _field254 = 1092; + _field258 = 1120; + _field25C = 1092; + _field260 = 1092; + _field264 = 1044; + _field268 = 1091; + _field26C = 1011; + _field270 = 1043; + _field274 = 1001; + _field278 = 1010; + _field27C = 985; + _field280 = 1001; + _field284 = 927; + _field288 = 984; + _field28C = 912; + _field290 = 926; + _field294 = 898; + _field298 = 906; + _field29C = 802; + _field2A0 = 896; + _field2A4 = 865; + _field2A8 = 896; + _field2AC = 842; + _field2B0 = 865; + _field2B4 = 816; + _field2B8 = 842; + _field2BC = 802; + _field2C0 = 842; + _field2C4 = 740; + _field2C8 = 740; + _field2CC = 740; + _field2D0 = 692; + _field2D4 = 610; + _field2D8 = 558; + _field2E0 = 610; + _field2E4 = 500; + _field2E8 = 558; + _field2EC = 467; + _field2F0 = 500; + _field2F4 = 421; + _field2F8 = 466; + _field2FC = 349; + _field300 = 306; + _field304 = 306; + _field308 = 348; + _field30C = 305; + _field310 = 306; + _field314 = 281; + _field318 = 305; + _field31C = 202; + _field320 = 281; + _field324 = 182; + _field328 = 202; + _field32C = 165; + _field330 = 182; + _field334 = 96; + _field338 = 165; + _field33C = 0; + _field340 = 95; +} + +void CBarbot::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field108, indent); + file->writeNumberLine(_field10C, indent); + file->writeNumberLine(_field110, indent); + file->writeNumberLine(_field114, indent); + file->writeNumberLine(_field118, indent); + file->writeNumberLine(_field11C, indent); + file->writeNumberLine(_field120, indent); + file->writeNumberLine(_field124, indent); + file->writeNumberLine(_field128, indent); + + file->writeNumberLine(_v0, indent); + file->writeNumberLine(_field12C, indent); + file->writeNumberLine(_field130, indent); + file->writeNumberLine(_field134, indent); + file->writeNumberLine(_field138, indent); + file->writeNumberLine(_field13C, indent); + file->writeNumberLine(_field140, indent); + file->writeNumberLine(_field144, indent); + file->writeNumberLine(_field148, indent); + file->writeNumberLine(_field14C, indent); + file->writeNumberLine(_field150, indent); + file->writeNumberLine(_field154, indent); + file->writeNumberLine(_field158, indent); + file->writeNumberLine(_field15C, indent); + file->writeNumberLine(_field160, indent); + + CTrueTalkNPC::save(file, indent); +} + +void CBarbot::load(SimpleFile *file) { + file->readNumber(); + _field108 = file->readNumber(); + _field10C = file->readNumber(); + _field110 = file->readNumber(); + _field114 = file->readNumber(); + _field118 = file->readNumber(); + _field11C = file->readNumber(); + _field120 = file->readNumber(); + _field124 = file->readNumber(); + _field128 = file->readNumber(); + + _v0 = file->readNumber(); + _field12C = file->readNumber(); + _field130 = file->readNumber(); + _field134 = file->readNumber(); + _field138 = file->readNumber(); + _field13C = file->readNumber(); + _field140 = file->readNumber(); + _field144 = file->readNumber(); + _field148 = file->readNumber(); + _field14C = file->readNumber(); + _field150 = file->readNumber(); + _field154 = file->readNumber(); + _field158 = file->readNumber(); + _field15C = file->readNumber(); + _field160 = file->readNumber(); + + CTrueTalkNPC::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/npcs/barbot.h b/engines/titanic/npcs/barbot.h new file mode 100644 index 0000000000..d14d5a2d1d --- /dev/null +++ b/engines/titanic/npcs/barbot.h @@ -0,0 +1,196 @@ +/* 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. + * + */ + +#ifndef TITANIC_BARBOT_H +#define TITANIC_BARBOT_H + +#include "titanic/npcs/true_talk_npc.h" + +namespace Titanic { + +class CBarbot : public CTrueTalkNPC { +private: + static int _v0; +private: + int _field108; + int _field10C; + int _field110; + int _field114; + int _field118; + int _field11C; + int _field120; + int _field124; + int _field128; + int _field12C; + int _field130; + int _field134; + int _field138; + int _field13C; + int _field140; + int _field144; + int _field148; + int _field14C; + int _field150; + int _field154; + int _field158; + int _field15C; + int _field160; + int _field164; + int _field168; + int _field16C; + int _field170; + int _field174; + int _field178; + int _field17C; + int _field180; + int _field184; + int _field188; + int _field18C; + int _field190; + int _field194; + int _field198; + int _field19C; + int _field1A0; + int _field1A4; + int _field1A8; + int _field1AC; + int _field1B0; + int _field1B4; + int _field1B8; + int _field1BC; + int _field1C0; + int _field1C4; + int _field1C8; + int _field1CC; + int _field1D0; + int _field1D4; + int _field1D8; + int _field1E0; + int _field1E4; + int _field1E8; + int _field1EC; + int _field1F0; + int _field1F4; + int _field1F8; + int _field1FC; + int _field200; + int _field204; + int _field208; + int _field20C; + int _field210; + int _field214; + int _field218; + int _field21C; + int _field220; + int _field224; + int _field228; + int _field22C; + int _field230; + int _field234; + int _field238; + int _field23C; + int _field240; + int _field244; + int _field248; + int _field24C; + int _field250; + int _field254; + int _field258; + int _field25C; + int _field260; + int _field264; + int _field268; + int _field26C; + int _field270; + int _field274; + int _field278; + int _field27C; + int _field280; + int _field284; + int _field288; + int _field28C; + int _field290; + int _field294; + int _field298; + int _field29C; + int _field2A0; + int _field2A4; + int _field2A8; + int _field2AC; + int _field2B0; + int _field2B4; + int _field2B8; + int _field2BC; + int _field2C0; + int _field2C4; + int _field2C8; + int _field2CC; + int _field2D0; + int _field2D4; + int _field2D8; + int _field2E0; + int _field2E4; + int _field2E8; + int _field2EC; + int _field2F0; + int _field2F4; + int _field2F8; + int _field2FC; + int _field300; + int _field304; + int _field308; + int _field30C; + int _field310; + int _field314; + int _field318; + int _field31C; + int _field320; + int _field324; + int _field328; + int _field32C; + int _field330; + int _field334; + int _field338; + int _field33C; + int _field340; +public: + CBarbot(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBarbot"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BARBOT_H */ diff --git a/engines/titanic/npcs/bellbot.cpp b/engines/titanic/npcs/bellbot.cpp new file mode 100644 index 0000000000..48747228f8 --- /dev/null +++ b/engines/titanic/npcs/bellbot.cpp @@ -0,0 +1,44 @@ +/* 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 "titanic/npcs/bellbot.h" + +namespace Titanic { + +CBellBot::CBellBot() : CTrueTalkNPC(), _field108(0) { +} + +void CBellBot::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field108, indent); + + CTrueTalkNPC::save(file, indent); +} + +void CBellBot::load(SimpleFile *file) { + file->readNumber(); + _field108 = file->readNumber(); + + CTrueTalkNPC::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/npcs/bellbot.h b/engines/titanic/npcs/bellbot.h new file mode 100644 index 0000000000..b47daa1404 --- /dev/null +++ b/engines/titanic/npcs/bellbot.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_BELLBOT_H +#define TITANIC_BELLBOT_H + +#include "titanic/npcs/true_talk_npc.h" + +namespace Titanic { + +class CBellBot : public CTrueTalkNPC { +private: + int _field108; +public: + CBellBot(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBellBot"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BELLBOT_H */ diff --git a/engines/titanic/npcs/deskbot.cpp b/engines/titanic/npcs/deskbot.cpp new file mode 100644 index 0000000000..c4745ae8d6 --- /dev/null +++ b/engines/titanic/npcs/deskbot.cpp @@ -0,0 +1,53 @@ +/* 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 "titanic/npcs/deskbot.h" + +namespace Titanic { + +int CDeskbot::_v1; +int CDeskbot::_v2; + +CDeskbot::CDeskbot() : CTrueTalkNPC(), _field108(0), _field10C(0) { +} + +void CDeskbot::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_v2, indent); + file->writeNumberLine(_field108, indent); + file->writeNumberLine(_field10C, indent); + + CTrueTalkNPC::save(file, indent); +} + +void CDeskbot::load(SimpleFile *file) { + file->readNumber(); + _v1 = file->readNumber(); + _v2 = file->readNumber(); + _field108 = file->readNumber(); + _field10C = file->readNumber(); + + CTrueTalkNPC::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/npcs/deskbot.h b/engines/titanic/npcs/deskbot.h new file mode 100644 index 0000000000..2826b01660 --- /dev/null +++ b/engines/titanic/npcs/deskbot.h @@ -0,0 +1,58 @@ +/* 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. + * + */ + +#ifndef TITANIC_DESKBOT_H +#define TITANIC_DESKBOT_H + +#include "titanic/npcs/true_talk_npc.h" + +namespace Titanic { + +class CDeskbot : public CTrueTalkNPC { +private: + static int _v1; + static int _v2; +private: + int _field108; + int _field10C; +public: + CDeskbot(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CDeskbot"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DESKBOT_H */ diff --git a/engines/titanic/npcs/doorbot.cpp b/engines/titanic/npcs/doorbot.cpp new file mode 100644 index 0000000000..17db94f2d7 --- /dev/null +++ b/engines/titanic/npcs/doorbot.cpp @@ -0,0 +1,63 @@ +/* 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 "titanic/npcs/doorbot.h" + +namespace Titanic { + +int CDoorbot::_v1; +int CDoorbot::_v2; + +CDoorbot::CDoorbot() : CTrueTalkNPC() { + _field108 = 0; + _field10C = 0; + _field110 = 0; + _field114 = 0; +} + +void CDoorbot::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_v2, indent); + + file->writeNumberLine(_field108, indent); + file->writeNumberLine(_field10C, indent); + file->writeNumberLine(_field110, indent); + file->writeNumberLine(_field114, indent); + + CTrueTalkNPC::save(file, indent); +} + +void CDoorbot::load(SimpleFile *file) { + file->readNumber(); + _v1 = file->readNumber(); + _v2 = file->readNumber(); + + _field108 = file->readNumber(); + _field10C = file->readNumber(); + _field110 = file->readNumber(); + _field114 = file->readNumber(); + + CTrueTalkNPC::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/npcs/doorbot.h b/engines/titanic/npcs/doorbot.h new file mode 100644 index 0000000000..e3ec7e83a4 --- /dev/null +++ b/engines/titanic/npcs/doorbot.h @@ -0,0 +1,60 @@ +/* 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. + * + */ + +#ifndef TITANIC_DOORBOT_H +#define TITANIC_DOORBOT_H + +#include "titanic/npcs/true_talk_npc.h" + +namespace Titanic { + +class CDoorbot : public CTrueTalkNPC { +private: + static int _v1; + static int _v2; +private: + int _field108; + int _field10C; + int _field110; + int _field114; +public: + CDoorbot(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CDoorbot"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DOORBOT_H */ diff --git a/engines/titanic/npcs/liftbot.cpp b/engines/titanic/npcs/liftbot.cpp new file mode 100644 index 0000000000..3a0040ddca --- /dev/null +++ b/engines/titanic/npcs/liftbot.cpp @@ -0,0 +1,51 @@ +/* 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 "titanic/npcs/liftbot.h" + +namespace Titanic { + +int CLiftBot::_v1; +int CLiftBot::_v2; + +CLiftBot::CLiftBot() : CTrueTalkNPC(), _field108(1) { +} + +void CLiftBot::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_field108, indent); + file->writeNumberLine(_v2, indent); + + CTrueTalkNPC::save(file, indent); +} + +void CLiftBot::load(SimpleFile *file) { + file->readNumber(); + _v1 = file->readNumber(); + _field108 = file->readNumber(); + _v2 = file->readNumber(); + + CTrueTalkNPC::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/npcs/liftbot.h b/engines/titanic/npcs/liftbot.h new file mode 100644 index 0000000000..f18fd7f32d --- /dev/null +++ b/engines/titanic/npcs/liftbot.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_LIFTBOT_H +#define TITANIC_LIFTBOT_H + +#include "titanic/npcs/true_talk_npc.h" + +namespace Titanic { + +class CLiftBot : public CTrueTalkNPC { +private: + static int _v1; + static int _v2; +private: + int _field108; +public: + CLiftBot(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CLiftBot"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_LIFTBOT_H */ diff --git a/engines/titanic/npcs/maitre_d.cpp b/engines/titanic/npcs/maitre_d.cpp new file mode 100644 index 0000000000..d100a0b301 --- /dev/null +++ b/engines/titanic/npcs/maitre_d.cpp @@ -0,0 +1,68 @@ +/* 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 "titanic/npcs/maitre_d.h" + +namespace Titanic { + +int CMaitreD::_v1; + +CMaitreD::CMaitreD() : CTrueTalkNPC(), + _string2("z#40.wav"), _string3("z#40.wav"), _field108(0), _field118(1), + _field11C(0), _field12C(0), _field130(1), _field134(0), _field138(0) { +} + +void CMaitreD::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field108, indent); + file->writeQuotedLine(_string2, indent); + file->writeNumberLine(_field118, indent); + file->writeNumberLine(_field11C, indent); + file->writeQuotedLine(_string3, indent); + file->writeNumberLine(_field12C, indent); + file->writeNumberLine(_field130, indent); + + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_field134, indent); + file->writeNumberLine(_field138, indent); + + CTrueTalkNPC::save(file, indent); +} + +void CMaitreD::load(SimpleFile *file) { + file->readNumber(); + _field108 = file->readNumber(); + _string2 = file->readString(); + _field118 = file->readNumber(); + _field11C = file->readNumber(); + _string3 = file->readString(); + _field12C = file->readNumber(); + _field130 = file->readNumber(); + + _v1 = file->readNumber(); + _field134 = file->readNumber(); + _field138 = file->readNumber(); + + CTrueTalkNPC::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/npcs/maitre_d.h b/engines/titanic/npcs/maitre_d.h new file mode 100644 index 0000000000..f44d6eeec0 --- /dev/null +++ b/engines/titanic/npcs/maitre_d.h @@ -0,0 +1,64 @@ +/* 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. + * + */ + +#ifndef TITANIC_MAITRED_H +#define TITANIC_MAITRED_H + +#include "titanic/npcs/true_talk_npc.h" + +namespace Titanic { + +class CMaitreD : public CTrueTalkNPC { +private: + static int _v1; +private: + int _field108; + CString _string2; + int _field118; + int _field11C; + CString _string3; + int _field12C; + int _field130; + int _field134; + int _field138; +public: + CMaitreD(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMaitreD"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MAITRED_H */ diff --git a/engines/titanic/npcs/parrot.cpp b/engines/titanic/npcs/parrot.cpp new file mode 100644 index 0000000000..c350079f76 --- /dev/null +++ b/engines/titanic/npcs/parrot.cpp @@ -0,0 +1,143 @@ +/* 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 "titanic/npcs/parrot.h" + +namespace Titanic { + +int CParrot::_v1; +int CParrot::_v2; +int CParrot::_v3; +int CParrot::_v4; +int CParrot::_v5; + +CParrot::CParrot() : CTrueTalkNPC() { + _field108 = 0; + _string2 = "CarryParrot"; + _field118 = 1; + _field11C = 25; + _field120 = 0; + _field124 = 73; + _field128 = 58; + _field12C = 0; + _field130 = 0; + _field134 = 0; + _field138 = 851; + _field13C = 851; + _field140 = 265; + _field144 = 274; + _field148 = 726; + _field14C = 730; + _field150 = 510; + _field154 = 570; + _field158 = 569; + _field15C = 689; + _field160 = 690; + _field164 = 725; + _field168 = 375; + _field16C = 508; + _field170 = 363; + _field174 = 375; + _field178 = 303; + _field17C = 313; + _field180 = 279; + _field184 = 302; + _field188 = 260; + _field18C = 264; + _field190 = 315; + _field194 = 327; + _field198 = 330; + _field19C = 360; + _field1A0 = 175; + _field1A4 = 259; + _field1A8 = 175; + _field1AC = 175; + _field1B0 = 162; + _field1B4 = 175; + _field1B8 = 150; + _field1BC = 162; + _field1C0 = 135; + _field1C4 = 150; + _field1C8 = 95; + _field1CC = 135; + _field1D0 = 76; + _field1D4 = 95; + _field1D8 = 55; + _field1DC = 76; + _field1E0 = 30; + _field1E4 = 55; + _field1E8 = 0; + _field1EC = 30; + + _string1 = "z454.dlg"; + _fieldD4 = 0x13880; +} + +void CParrot::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldD4, indent); + + file->writeQuotedLine(_string1, indent); + file->writeNumberLine(_field108, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_v2, indent); + file->writeNumberLine(_v3, indent); + + file->writeQuotedLine(_string2, indent); + file->writeNumberLine(_field118, indent); + file->writeNumberLine(_field11C, indent); + file->writeNumberLine(_field120, indent); + file->writeNumberLine(_field124, indent); + file->writeNumberLine(_field128, indent); + file->writeNumberLine(_field12C, indent); + file->writeNumberLine(_field130, indent); + file->writeNumberLine(_v4, indent); + file->writeNumberLine(_v5, indent); + + CTrueTalkNPC::save(file, indent); +} + +void CParrot::load(SimpleFile *file) { + file->readNumber(); + _fieldD4 = file->readNumber(); + + _string1 = file->readString(); + _field108 = file->readNumber(); + _v1 = file->readNumber(); + _v2 = file->readNumber(); + _v3 = file->readNumber(); + + _string2 = file->readString(); + _field118 = file->readNumber(); + _field11C = file->readNumber(); + _field120 = file->readNumber(); + _field124 = file->readNumber(); + _field128 = file->readNumber(); + _field12C = file->readNumber(); + _field130 = file->readNumber(); + _v4 = file->readNumber(); + _v5 = file->readNumber(); + + CTrueTalkNPC::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/npcs/parrot.h b/engines/titanic/npcs/parrot.h new file mode 100644 index 0000000000..991066e3b5 --- /dev/null +++ b/engines/titanic/npcs/parrot.h @@ -0,0 +1,115 @@ +/* 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. + * + */ + +#ifndef TITANIC_PARROT_H +#define TITANIC_PARROT_H + +#include "titanic/npcs/true_talk_npc.h" + +namespace Titanic { + +class CParrot : public CTrueTalkNPC { +private: + static int _v1; + static int _v2; + static int _v3; + static int _v4; + static int _v5; +private: + int _field108; + CString _string2; + int _field118; + int _field11C; + int _field120; + int _field124; + int _field128; + int _field12C; + int _field130; + int _field134; + int _field138; + int _field13C; + int _field140; + int _field144; + int _field148; + int _field14C; + int _field150; + int _field154; + int _field158; + int _field15C; + int _field160; + int _field164; + int _field168; + int _field16C; + int _field170; + int _field174; + int _field178; + int _field17C; + int _field180; + int _field184; + int _field188; + int _field18C; + int _field190; + int _field194; + int _field198; + int _field19C; + int _field1A0; + int _field1A4; + int _field1A8; + int _field1AC; + int _field1B0; + int _field1B4; + int _field1B8; + int _field1BC; + int _field1C0; + int _field1C4; + int _field1C8; + int _field1CC; + int _field1D0; + int _field1D4; + int _field1D8; + int _field1DC; + int _field1E0; + int _field1E4; + int _field1E8; + int _field1EC; +public: + CParrot(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CParrot"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PARROT_H */ -- cgit v1.2.3 From f2cb4a6d98d914aa0557f35c84d3052d9739c5d5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 25 Feb 2016 22:08:30 -0500 Subject: TITANIC: Implement non-TrueTalk character classes --- engines/titanic/core/saveable_object.cpp | 9 ++++ engines/titanic/module.mk | 3 ++ engines/titanic/npcs/mobile.cpp | 46 +++++++++++++++++++ engines/titanic/npcs/mobile.h | 55 +++++++++++++++++++++++ engines/titanic/npcs/starlings.cpp | 46 +++++++++++++++++++ engines/titanic/npcs/starlings.h | 54 ++++++++++++++++++++++ engines/titanic/npcs/titania.cpp | 77 ++++++++++++++++++++++++++++++++ engines/titanic/npcs/titania.h | 65 +++++++++++++++++++++++++++ 8 files changed, 355 insertions(+) create mode 100644 engines/titanic/npcs/mobile.cpp create mode 100644 engines/titanic/npcs/mobile.h create mode 100644 engines/titanic/npcs/starlings.cpp create mode 100644 engines/titanic/npcs/starlings.h create mode 100644 engines/titanic/npcs/titania.cpp create mode 100644 engines/titanic/npcs/titania.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 8f7c38692f..758c56cfa5 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -42,8 +42,11 @@ #include "titanic/npcs/doorbot.h" #include "titanic/npcs/liftbot.h" #include "titanic/npcs/maitre_d.h" +#include "titanic/npcs/mobile.h" #include "titanic/npcs/parrot.h" +#include "titanic/npcs/starlings.h" #include "titanic/npcs/succubus.h" +#include "titanic/npcs/titania.h" namespace Titanic { @@ -64,6 +67,7 @@ DEFFN(CLiftBot); DEFFN(CLinkItem); DEFFN(CMaitreD); DEFFN(CMessageTarget); +DEFFN(CMobile); DEFFN(CMovieClip); DEFFN(CMovieClipList); DEFFN(CNodeItem); @@ -72,8 +76,10 @@ DEFFN(CPETPosition); DEFFN(CProjectItem); DEFFN(CRoomItem); DEFFN(CServiceElevatorDoor); +DEFFN(CStarlings); DEFFN(CSUBGlass); DEFFN(CSuccUBus); +DEFFN(CTitania); DEFFN(CTreeItem); DEFFN(CViewItem); @@ -90,6 +96,7 @@ void CSaveableObject::initClassList() { ADDFN(CLinkItem); ADDFN(CMaitreD); ADDFN(CMessageTarget); + ADDFN(CMobile); ADDFN(CMovieClip); ADDFN(CMovieClipList); ADDFN(CNodeItem); @@ -98,8 +105,10 @@ void CSaveableObject::initClassList() { ADDFN(CProjectItem); ADDFN(CRoomItem); ADDFN(CServiceElevatorDoor); + ADDFN(CStarlings); ADDFN(CSUBGlass); ADDFN(CSuccUBus); + ADDFN(CTitania); ADDFN(CTreeItem); ADDFN(CViewItem); } diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 1d94289315..3fadf67fd4 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -44,8 +44,11 @@ MODULE_OBJS := \ npcs/doorbot.o \ npcs/liftbot.o \ npcs/maitre_d.o \ + npcs/mobile.o \ npcs/parrot.o \ + npcs/starlings.o \ npcs/succubus.o \ + npcs/titania.o \ npcs/true_talk_npc.o # This module can be built as a plugin diff --git a/engines/titanic/npcs/mobile.cpp b/engines/titanic/npcs/mobile.cpp new file mode 100644 index 0000000000..37c1d13fee --- /dev/null +++ b/engines/titanic/npcs/mobile.cpp @@ -0,0 +1,46 @@ +/* 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 "titanic/npcs/mobile.h" + +namespace Titanic { + +CMobile::CMobile() : CCharacter(), _fieldDC(0) { +} + +void CMobile::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writePoint(_pos1, indent); + file->writeNumberLine(_fieldDC, indent); + + CCharacter::save(file, indent); +} + +void CMobile::load(SimpleFile *file) { + file->readNumber(); + _pos1 = file->readPoint(); + _fieldDC = file->readNumber(); + + CCharacter::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/npcs/mobile.h b/engines/titanic/npcs/mobile.h new file mode 100644 index 0000000000..9c74170ac0 --- /dev/null +++ b/engines/titanic/npcs/mobile.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_MOBILE_H +#define TITANIC_MOBILE_H + +#include "titanic/npcs/character.h" + +namespace Titanic { + +class CMobile : public CCharacter { +private: + Common::Point _pos1; + int _fieldDC; +public: + CMobile(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMobile"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MOBILE_H */ diff --git a/engines/titanic/npcs/starlings.cpp b/engines/titanic/npcs/starlings.cpp new file mode 100644 index 0000000000..dcb9fbda81 --- /dev/null +++ b/engines/titanic/npcs/starlings.cpp @@ -0,0 +1,46 @@ +/* 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 "titanic/npcs/starlings.h" + +namespace Titanic { + +int CStarlings::_v1; + +CStarlings::CStarlings() : CCharacter() { +} + +void CStarlings::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_v1, indent); + + CCharacter::save(file, indent); +} + +void CStarlings::load(SimpleFile *file) { + file->readNumber(); + _v1 = file->readNumber(); + + CCharacter::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/npcs/starlings.h b/engines/titanic/npcs/starlings.h new file mode 100644 index 0000000000..472d0f58fb --- /dev/null +++ b/engines/titanic/npcs/starlings.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_STARLINGS_H +#define TITANIC_STARLINGS_H + +#include "titanic/npcs/character.h" + +namespace Titanic { + +class CStarlings : public CCharacter { +private: + static int _v1; +public: + CStarlings(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CStarlings"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STARLING_H */ diff --git a/engines/titanic/npcs/titania.cpp b/engines/titanic/npcs/titania.cpp new file mode 100644 index 0000000000..3a71d7fea1 --- /dev/null +++ b/engines/titanic/npcs/titania.cpp @@ -0,0 +1,77 @@ +/* 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 "titanic/npcs/titania.h" + +namespace Titanic { + +CTitania::CTitania() : CCharacter() { + _fieldD4 = 0; + _fieldD8 = 0; + _fieldE0 = 0; + _fieldE4 = 0; + _fieldE8 = 0; + _fieldEC = 0; + _fieldF0 = 0; + _fieldF4 = 0; + _fieldF8 = 0; + _fieldFC = 0; + _field100 = 1; +} + +void CTitania::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldD4, indent); + file->writeNumberLine(_fieldD8, indent); + file->writeNumberLine(_fieldDC, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_fieldEC, indent); + file->writeNumberLine(_fieldF0, indent); + file->writeNumberLine(_fieldF4, indent); + file->writeNumberLine(_fieldF8, indent); + file->writeNumberLine(_fieldFC, indent); + file->writeNumberLine(_field100, indent); + + CCharacter::save(file, indent); +} + +void CTitania::load(SimpleFile *file) { + file->readNumber(); + _fieldD4 = file->readNumber(); + _fieldD8 = file->readNumber(); + _fieldDC = file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + _fieldEC = file->readNumber(); + _fieldF0 = file->readNumber(); + _fieldF4 = file->readNumber(); + _fieldF8 = file->readNumber(); + _fieldFC = file->readNumber(); + _field100 = file->readNumber(); + + CCharacter::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/npcs/titania.h b/engines/titanic/npcs/titania.h new file mode 100644 index 0000000000..ee61222be4 --- /dev/null +++ b/engines/titanic/npcs/titania.h @@ -0,0 +1,65 @@ +/* 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. + * + */ + +#ifndef TITANIC_TITANIA_H +#define TITANIC_TITANIA_H + +#include "titanic/npcs/character.h" + +namespace Titanic { + +class CTitania : public CCharacter { +private: + int _fieldD4; + int _fieldD8; + int _fieldDC; + int _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; + int _fieldF0; + int _fieldF4; + int _fieldF8; + int _fieldFC; + int _field100; +public: + CTitania(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CTitania"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TITANIA_H */ -- cgit v1.2.3 From 5c77a55328f98f1df79de86f82135ed60ee6f4fd Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 25 Feb 2016 22:21:43 -0500 Subject: TITANIC: Implemented CBackground class --- engines/titanic/core/background.cpp | 52 ++++++++++++++++++++++++++++ engines/titanic/core/background.h | 58 ++++++++++++++++++++++++++++++++ engines/titanic/core/saveable_object.cpp | 3 ++ engines/titanic/module.mk | 1 + 4 files changed, 114 insertions(+) create mode 100644 engines/titanic/core/background.cpp create mode 100644 engines/titanic/core/background.h diff --git a/engines/titanic/core/background.cpp b/engines/titanic/core/background.cpp new file mode 100644 index 0000000000..63aaf30ae0 --- /dev/null +++ b/engines/titanic/core/background.cpp @@ -0,0 +1,52 @@ +/* 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 "titanic/core/background.h" + +namespace Titanic { + +CBackground::CBackground() : CGameObject(), _fieldBC(0), _fieldC0(0), _fieldDC(0) { +} + +void CBackground::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + file->writeNumberLine(_fieldDC, indent); + + CGameObject::save(file, indent); +} + +void CBackground::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + _fieldDC = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/core/background.h b/engines/titanic/core/background.h new file mode 100644 index 0000000000..a4735250ae --- /dev/null +++ b/engines/titanic/core/background.h @@ -0,0 +1,58 @@ +/* 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. + * + */ + +#ifndef TITANIC_BACKGROUND_H +#define TITANIC_BACKGROUND_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CBackground : public CGameObject { +protected: + int _fieldBC; + int _fieldC0; + CString _string1; + CString _string2; + int _fieldDC; +public: + CBackground(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBackground"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BACKGROUND_H */ diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 758c56cfa5..551cd47278 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -21,6 +21,7 @@ */ #include "titanic/core/saveable_object.h" +#include "titanic/core/background.h" #include "titanic/core/file_item.h" #include "titanic/core/link_item.h" #include "titanic/core/list.h" @@ -57,6 +58,7 @@ Common::HashMap * #define ADDFN(T) (*_classList)[#T] = Function##T DEFFN(CAnnounce); +DEFFN(CBackground); DEFFN(CBarbot); DEFFN(CBellBot); DEFFN(CDeskbot); @@ -86,6 +88,7 @@ DEFFN(CViewItem); void CSaveableObject::initClassList() { _classList = new Common::HashMap(); ADDFN(CAnnounce); + ADDFN(CBackground); ADDFN(CBarbot); ADDFN(CBellBot); ADDFN(CDeskbot); diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 3fadf67fd4..74206ea262 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -16,6 +16,7 @@ MODULE_OBJS := \ titanic.o \ video_surface.o \ core/auto_sound_event.o \ + core/background.o \ core/dont_save_file_item.o \ core/file_item.o \ core/game_object.o \ -- cgit v1.2.3 From 83ad770f498b5c99b4667b838b8c7a8def087e71 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 25 Feb 2016 23:49:10 -0500 Subject: TITANIC: Implement CMovePlayerTo class hierarchy --- engines/titanic/core/saveable_object.cpp | 96 ++++++++++++++++------ engines/titanic/messages/enter_bomb_room.cpp | 40 +++++++++ engines/titanic/messages/enter_bomb_room.h | 54 ++++++++++++ engines/titanic/messages/exit_arboretum.cpp | 49 +++++++++++ engines/titanic/messages/exit_arboretum.h | 56 +++++++++++++ engines/titanic/messages/exit_bridge.cpp | 42 ++++++++++ engines/titanic/messages/exit_bridge.h | 54 ++++++++++++ engines/titanic/messages/exit_state_room.cpp | 40 +++++++++ engines/titanic/messages/exit_state_room.h | 54 ++++++++++++ engines/titanic/messages/exit_titania.cpp | 51 ++++++++++++ engines/titanic/messages/exit_titania.h | 57 +++++++++++++ .../messages/move_player_in_parrot_room.cpp | 40 +++++++++ .../titanic/messages/move_player_in_parrot_room.h | 52 ++++++++++++ engines/titanic/messages/move_player_to.cpp | 44 ++++++++++ engines/titanic/messages/move_player_to.h | 54 ++++++++++++ engines/titanic/messages/move_player_to_from.cpp | 44 ++++++++++ engines/titanic/messages/move_player_to_from.h | 54 ++++++++++++ engines/titanic/messages/multi_move.cpp | 52 ++++++++++++ engines/titanic/messages/multi_move.h | 58 +++++++++++++ engines/titanic/messages/pan_from_pel.cpp | 46 +++++++++++ engines/titanic/messages/pan_from_pel.h | 55 +++++++++++++ .../titanic/messages/restaurant_pan_handler.cpp | 46 +++++++++++ engines/titanic/messages/restaurant_pan_handler.h | 55 +++++++++++++ engines/titanic/messages/restricted_move.cpp | 44 ++++++++++ engines/titanic/messages/restricted_move.h | 54 ++++++++++++ engines/titanic/messages/trip_down_canal.cpp | 40 +++++++++ engines/titanic/messages/trip_down_canal.h | 52 ++++++++++++ engines/titanic/module.mk | 13 +++ 28 files changed, 1370 insertions(+), 26 deletions(-) create mode 100644 engines/titanic/messages/enter_bomb_room.cpp create mode 100644 engines/titanic/messages/enter_bomb_room.h create mode 100644 engines/titanic/messages/exit_arboretum.cpp create mode 100644 engines/titanic/messages/exit_arboretum.h create mode 100644 engines/titanic/messages/exit_bridge.cpp create mode 100644 engines/titanic/messages/exit_bridge.h create mode 100644 engines/titanic/messages/exit_state_room.cpp create mode 100644 engines/titanic/messages/exit_state_room.h create mode 100644 engines/titanic/messages/exit_titania.cpp create mode 100644 engines/titanic/messages/exit_titania.h create mode 100644 engines/titanic/messages/move_player_in_parrot_room.cpp create mode 100644 engines/titanic/messages/move_player_in_parrot_room.h create mode 100644 engines/titanic/messages/move_player_to.cpp create mode 100644 engines/titanic/messages/move_player_to.h create mode 100644 engines/titanic/messages/move_player_to_from.cpp create mode 100644 engines/titanic/messages/move_player_to_from.h create mode 100644 engines/titanic/messages/multi_move.cpp create mode 100644 engines/titanic/messages/multi_move.h create mode 100644 engines/titanic/messages/pan_from_pel.cpp create mode 100644 engines/titanic/messages/pan_from_pel.h create mode 100644 engines/titanic/messages/restaurant_pan_handler.cpp create mode 100644 engines/titanic/messages/restaurant_pan_handler.h create mode 100644 engines/titanic/messages/restricted_move.cpp create mode 100644 engines/titanic/messages/restricted_move.h create mode 100644 engines/titanic/messages/trip_down_canal.cpp create mode 100644 engines/titanic/messages/trip_down_canal.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 551cd47278..382023da95 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -37,6 +37,20 @@ #include "titanic/game/room_item.h" #include "titanic/game/service_elevator_door.h" #include "titanic/game/sub_glass.h" + +#include "titanic/messages/enter_bomb_room.h" +#include "titanic/messages/exit_arboretum.h" +#include "titanic/messages/exit_bridge.h" +#include "titanic/messages/exit_state_room.h" +#include "titanic/messages/move_player_in_parrot_room.h" +#include "titanic/messages/move_player_to.h" +#include "titanic/messages/move_player_to_from.h" +#include "titanic/messages/multi_move.h" +#include "titanic/messages/pan_from_pel.h" +#include "titanic/messages/restaurant_pan_handler.h" +#include "titanic/messages/restricted_move.h" +#include "titanic/messages/trip_down_canal.h" + #include "titanic/npcs/barbot.h" #include "titanic/npcs/bellbot.h" #include "titanic/npcs/deskbot.h" @@ -57,63 +71,93 @@ Common::HashMap * #define DEFFN(T) CSaveableObject *Function##T() { return new T(); } #define ADDFN(T) (*_classList)[#T] = Function##T -DEFFN(CAnnounce); DEFFN(CBackground); -DEFFN(CBarbot); -DEFFN(CBellBot); -DEFFN(CDeskbot); -DEFFN(CDoorbot); DEFFN(CFileItem); DEFFN(CFileListItem); -DEFFN(CLiftBot); DEFFN(CLinkItem); -DEFFN(CMaitreD); DEFFN(CMessageTarget); -DEFFN(CMobile); DEFFN(CMovieClip); DEFFN(CMovieClipList); DEFFN(CNodeItem); -DEFFN(CParrot); -DEFFN(CPETPosition); DEFFN(CProjectItem); +DEFFN(CTreeItem); +DEFFN(CViewItem); + +DEFFN(CAnnounce); +DEFFN(CPETPosition); DEFFN(CRoomItem); DEFFN(CServiceElevatorDoor); -DEFFN(CStarlings); DEFFN(CSUBGlass); + +DEFFN(CEnterBombRoom); +DEFFN(CExitArboretum); +DEFFN(CExitBridge); +DEFFN(CExitStateRoom); +DEFFN(CMovePlayerInParrotRoom); +DEFFN(CMovePlayerTo); +DEFFN(CMovePlayerToFrom); +DEFFN(CMultiMove); +DEFFN(CPanFromPel); +DEFFN(CRestaurantPanHandler); +DEFFN(CRestrictedMove); +DEFFN(CTripDownCanal); + +DEFFN(CBarbot); +DEFFN(CBellBot); +DEFFN(CDeskbot); +DEFFN(CDoorbot); +DEFFN(CLiftBot); +DEFFN(CMaitreD); +DEFFN(CMobile); +DEFFN(CParrot); +DEFFN(CStarlings); DEFFN(CSuccUBus); DEFFN(CTitania); -DEFFN(CTreeItem); -DEFFN(CViewItem); void CSaveableObject::initClassList() { _classList = new Common::HashMap(); - ADDFN(CAnnounce); ADDFN(CBackground); - ADDFN(CBarbot); - ADDFN(CBellBot); - ADDFN(CDeskbot); - ADDFN(CDoorbot); ADDFN(CFileItem); ADDFN(CFileListItem); - ADDFN(CLiftBot); ADDFN(CLinkItem); - ADDFN(CMaitreD); ADDFN(CMessageTarget); - ADDFN(CMobile); ADDFN(CMovieClip); ADDFN(CMovieClipList); ADDFN(CNodeItem); - ADDFN(CParrot); - ADDFN(CPETPosition); ADDFN(CProjectItem); + ADDFN(CTreeItem); + ADDFN(CViewItem); + + ADDFN(CAnnounce); + ADDFN(CPETPosition); ADDFN(CRoomItem); ADDFN(CServiceElevatorDoor); - ADDFN(CStarlings); ADDFN(CSUBGlass); + + ADDFN(CEnterBombRoom); + ADDFN(CExitArboretum); + ADDFN(CExitBridge); + ADDFN(CExitStateRoom); + ADDFN(CMovePlayerInParrotRoom); + ADDFN(CMovePlayerTo); + ADDFN(CMovePlayerToFrom); + ADDFN(CMultiMove); + ADDFN(CPanFromPel); + ADDFN(CRestaurantPanHandler); + ADDFN(CRestrictedMove); + ADDFN(CTripDownCanal); + + ADDFN(CBarbot); + ADDFN(CBellBot); + ADDFN(CDeskbot); + ADDFN(CDoorbot); + ADDFN(CMaitreD); + ADDFN(CLiftBot); + ADDFN(CMobile); + ADDFN(CParrot); + ADDFN(CStarlings); ADDFN(CSuccUBus); ADDFN(CTitania); - ADDFN(CTreeItem); - ADDFN(CViewItem); } void CSaveableObject::freeClassList() { diff --git a/engines/titanic/messages/enter_bomb_room.cpp b/engines/titanic/messages/enter_bomb_room.cpp new file mode 100644 index 0000000000..049c3f45ae --- /dev/null +++ b/engines/titanic/messages/enter_bomb_room.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/messages/enter_bomb_room.h" + +namespace Titanic { + +CEnterBombRoom::CEnterBombRoom() : CMovePlayerTo(), _fieldC8(0) { +} + +void CEnterBombRoom::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CMovePlayerTo::save(file, indent); +} + +void CEnterBombRoom::load(SimpleFile *file) { + file->readNumber(); + CMovePlayerTo::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/enter_bomb_room.h b/engines/titanic/messages/enter_bomb_room.h new file mode 100644 index 0000000000..3ec5616db0 --- /dev/null +++ b/engines/titanic/messages/enter_bomb_room.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_ENTER_BOMB_ROOM_H +#define TITANIC_ENTER_BOMB_ROOM_H + +#include "titanic/messages/move_player_to.h" + +namespace Titanic { + +class CEnterBombRoom : public CMovePlayerTo { +protected: + int _fieldC8; +public: + CEnterBombRoom(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CEnterBombRoom"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ENTER_BOMB_ROOM_H */ diff --git a/engines/titanic/messages/exit_arboretum.cpp b/engines/titanic/messages/exit_arboretum.cpp new file mode 100644 index 0000000000..0a50377afb --- /dev/null +++ b/engines/titanic/messages/exit_arboretum.cpp @@ -0,0 +1,49 @@ +/* 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 "titanic/messages/exit_arboretum.h" + +namespace Titanic { + +CExitArboretum::CExitArboretum() : CMovePlayerTo(), + _fieldC8(0), _fieldCC(0), _fieldD0(1) { +} + +void CExitArboretum::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeNumberLine(_fieldCC, indent); + file->writeNumberLine(_fieldD0, indent); + + CMovePlayerTo::save(file, indent); +} + +void CExitArboretum::load(SimpleFile *file) { + file->readNumber(); + _fieldC8 = file->readNumber(); + _fieldCC = file->readNumber(); + _fieldD0 = file->readNumber(); + + CMovePlayerTo::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/exit_arboretum.h b/engines/titanic/messages/exit_arboretum.h new file mode 100644 index 0000000000..4ee135e6bc --- /dev/null +++ b/engines/titanic/messages/exit_arboretum.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_EXIT_ARBORETUM_H +#define TITANIC_EXIT_ARBORETUM_H + +#include "titanic/messages/move_player_to.h" + +namespace Titanic { + +class CExitArboretum : public CMovePlayerTo { +protected: + int _fieldC8; + int _fieldCC; + int _fieldD0; +public: + CExitArboretum(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CExitArboretum"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BACKGROUND_H */ diff --git a/engines/titanic/messages/exit_bridge.cpp b/engines/titanic/messages/exit_bridge.cpp new file mode 100644 index 0000000000..27f923bf11 --- /dev/null +++ b/engines/titanic/messages/exit_bridge.cpp @@ -0,0 +1,42 @@ +/* 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 "titanic/messages/exit_bridge.h" + +namespace Titanic { + +CExitBridge::CExitBridge() : CMovePlayerTo() { +} + +void CExitBridge::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CMovePlayerTo::save(file, indent); +} + +void CExitBridge::load(SimpleFile *file) { + file->readNumber(); + _string1 = file->readString(); + + CMovePlayerTo::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/exit_bridge.h b/engines/titanic/messages/exit_bridge.h new file mode 100644 index 0000000000..6d65a0028a --- /dev/null +++ b/engines/titanic/messages/exit_bridge.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_EXIT_BRIDGE_H +#define TITANIC_EXIT_BRIDGE_H + +#include "titanic/messages/move_player_to.h" + +namespace Titanic { + +class CExitBridge : public CMovePlayerTo { +private: + CString _string1; +public: + CExitBridge(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CExitBridge"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_EXIT_BRIDGE_H */ diff --git a/engines/titanic/messages/exit_state_room.cpp b/engines/titanic/messages/exit_state_room.cpp new file mode 100644 index 0000000000..f1acd910d8 --- /dev/null +++ b/engines/titanic/messages/exit_state_room.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/messages/exit_state_room.h" + +namespace Titanic { + +CExitStateRoom::CExitStateRoom() : CMovePlayerTo(), _fieldC8(0) { +} + +void CExitStateRoom::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CMovePlayerTo::save(file, indent); +} + +void CExitStateRoom::load(SimpleFile *file) { + file->readNumber(); + CMovePlayerTo::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/exit_state_room.h b/engines/titanic/messages/exit_state_room.h new file mode 100644 index 0000000000..12adcfba44 --- /dev/null +++ b/engines/titanic/messages/exit_state_room.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_EXIT_STATE_ROOM_H +#define TITANIC_EXIT_STATE_ROOM_H + +#include "titanic/messages/move_player_to.h" + +namespace Titanic { + +class CExitStateRoom : public CMovePlayerTo { +protected: + int _fieldC8; +public: + CExitStateRoom(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CExitStateRoom"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_EXIT_STATE_ROOM_H */ diff --git a/engines/titanic/messages/exit_titania.cpp b/engines/titanic/messages/exit_titania.cpp new file mode 100644 index 0000000000..e94d0cd706 --- /dev/null +++ b/engines/titanic/messages/exit_titania.cpp @@ -0,0 +1,51 @@ +/* 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 "titanic/messages/exit_titania.h" + +namespace Titanic { + +CExitTitania::CExitTitania() : CMovePlayerTo(), _fieldC8(0), + _string1("NULL"), _string2("NULL"), _string3("NULL") { +} + +void CExitTitania::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + file->writeQuotedLine(_string3, indent); + + CMovePlayerTo::save(file, indent); +} + +void CExitTitania::load(SimpleFile *file) { + file->readNumber(); + _fieldC8 = file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + _string3 = file->readString(); + + CMovePlayerTo::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/exit_titania.h b/engines/titanic/messages/exit_titania.h new file mode 100644 index 0000000000..529886aee9 --- /dev/null +++ b/engines/titanic/messages/exit_titania.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_EXIT_TITANIA_H +#define TITANIC_EXIT_TITANIA_H + +#include "titanic/messages/move_player_to.h" + +namespace Titanic { + +class CExitTitania : public CMovePlayerTo { +private: + int _fieldC8; + CString _string1; + CString _string2; + CString _string3; +public: + CExitTitania(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CExitTitania"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_EXIT_TITANIA_H */ diff --git a/engines/titanic/messages/move_player_in_parrot_room.cpp b/engines/titanic/messages/move_player_in_parrot_room.cpp new file mode 100644 index 0000000000..b1040bfb75 --- /dev/null +++ b/engines/titanic/messages/move_player_in_parrot_room.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/messages/move_player_in_parrot_room.h" + +namespace Titanic { + +CMovePlayerInParrotRoom::CMovePlayerInParrotRoom() : CMovePlayerTo() { +} + +void CMovePlayerInParrotRoom::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CMovePlayerInParrotRoom::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/move_player_in_parrot_room.h b/engines/titanic/messages/move_player_in_parrot_room.h new file mode 100644 index 0000000000..f4e5779fd8 --- /dev/null +++ b/engines/titanic/messages/move_player_in_parrot_room.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_MOVE_PLAYER_IN_PARROT_ROOM_H +#define TITANIC_MOVE_PLAYER_IN_PARROT_ROOM_H + +#include "titanic/messages/move_player_to.h" + +namespace Titanic { + +class CMovePlayerInParrotRoom : public CMovePlayerTo { +public: + CMovePlayerInParrotRoom(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMovePlayerInParrotRoom"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MOVE_PLAYER_IN_PARROT_ROOM_H */ diff --git a/engines/titanic/messages/move_player_to.cpp b/engines/titanic/messages/move_player_to.cpp new file mode 100644 index 0000000000..66a71e8fa5 --- /dev/null +++ b/engines/titanic/messages/move_player_to.cpp @@ -0,0 +1,44 @@ +/* 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 "titanic/messages/move_player_to.h" + +namespace Titanic { + +CMovePlayerTo::CMovePlayerTo() : CGameObject() { +} + +void CMovePlayerTo::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_destination, indent); + + CGameObject::save(file, indent); +} + +void CMovePlayerTo::load(SimpleFile *file) { + file->readNumber(); + _destination = file->readString(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/move_player_to.h b/engines/titanic/messages/move_player_to.h new file mode 100644 index 0000000000..aa785b9167 --- /dev/null +++ b/engines/titanic/messages/move_player_to.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_MOVE_PLAYER_TO_H +#define TITANIC_MOVE_PLAYER_TO_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CMovePlayerTo : public CGameObject { +protected: + CString _destination; +public: + CMovePlayerTo(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMovePlayerTo"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MOVE_PLAYER_TO_H */ diff --git a/engines/titanic/messages/move_player_to_from.cpp b/engines/titanic/messages/move_player_to_from.cpp new file mode 100644 index 0000000000..77c74d5b50 --- /dev/null +++ b/engines/titanic/messages/move_player_to_from.cpp @@ -0,0 +1,44 @@ +/* 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 "titanic/messages/move_player_to_from.h" + +namespace Titanic { + +CMovePlayerToFrom::CMovePlayerToFrom() : CGameObject() { +} + +void CMovePlayerToFrom::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string2, indent); + + CGameObject::save(file, indent); +} + +void CMovePlayerToFrom::load(SimpleFile *file) { + file->readNumber(); + _string2 = file->readString(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/move_player_to_from.h b/engines/titanic/messages/move_player_to_from.h new file mode 100644 index 0000000000..82fe5db2ec --- /dev/null +++ b/engines/titanic/messages/move_player_to_from.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_MOVE_PLAYER_TO_FROM_H +#define TITANIC_MOVE_PLAYER_TO_FROM_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CMovePlayerToFrom : public CGameObject { +private: + CString _string2; +public: + CMovePlayerToFrom(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMovePlayerToFrom"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MOVE_PLAYER_TO_FROM_H */ diff --git a/engines/titanic/messages/multi_move.cpp b/engines/titanic/messages/multi_move.cpp new file mode 100644 index 0000000000..dd1948c435 --- /dev/null +++ b/engines/titanic/messages/multi_move.cpp @@ -0,0 +1,52 @@ +/* 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 "titanic/messages/multi_move.h" + +namespace Titanic { + +CMultiMove::CMultiMove() : CMovePlayerTo() { +} + +void CMultiMove::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + file->writeQuotedLine(_string3, indent); + file->writeQuotedLine(_string4, indent); + file->writeQuotedLine(_string5, indent); + + CMovePlayerTo::save(file, indent); +} + +void CMultiMove::load(SimpleFile *file) { + file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + _string3 = file->readString(); + _string5 = file->readString(); + _string4 = file->readString(); + + CMovePlayerTo::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/multi_move.h b/engines/titanic/messages/multi_move.h new file mode 100644 index 0000000000..2cc4f4e6bb --- /dev/null +++ b/engines/titanic/messages/multi_move.h @@ -0,0 +1,58 @@ +/* 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. + * + */ + +#ifndef TITANIC_MULTI_MOVE_H +#define TITANIC_MULTI_MOVE_H + +#include "titanic/messages/move_player_to.h" + +namespace Titanic { + +class CMultiMove : public CMovePlayerTo { +private: + CString _string1; + CString _string2; + CString _string3; + CString _string4; + CString _string5; +public: + CMultiMove(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMultiMove"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MULTI_MOVE_H */ diff --git a/engines/titanic/messages/pan_from_pel.cpp b/engines/titanic/messages/pan_from_pel.cpp new file mode 100644 index 0000000000..718927f9c7 --- /dev/null +++ b/engines/titanic/messages/pan_from_pel.cpp @@ -0,0 +1,46 @@ +/* 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 "titanic/messages/pan_from_pel.h" + +namespace Titanic { + +CPanFromPel::CPanFromPel() : CMovePlayerTo(), _fieldC8(0) { +} + +void CPanFromPel::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeQuotedLine(_string1, indent); + + CMovePlayerTo::save(file, indent); +} + +void CPanFromPel::load(SimpleFile *file) { + file->readNumber(); + _fieldC8 = file->readNumber(); + _string1 = file->readString(); + + CMovePlayerTo::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/pan_from_pel.h b/engines/titanic/messages/pan_from_pel.h new file mode 100644 index 0000000000..abb565c9ce --- /dev/null +++ b/engines/titanic/messages/pan_from_pel.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_PAN_FROM_PEL_H +#define TITANIC_PAN_FROM_PEL_H + +#include "titanic/messages/move_player_to.h" + +namespace Titanic { + +class CPanFromPel : public CMovePlayerTo { +protected: + int _fieldC8; + CString _string1; +public: + CPanFromPel(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPanFromPel"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PAN_FROM_PEL_H */ diff --git a/engines/titanic/messages/restaurant_pan_handler.cpp b/engines/titanic/messages/restaurant_pan_handler.cpp new file mode 100644 index 0000000000..14fd383cde --- /dev/null +++ b/engines/titanic/messages/restaurant_pan_handler.cpp @@ -0,0 +1,46 @@ +/* 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 "titanic/messages/restaurant_pan_handler.h" + +namespace Titanic { + +CRestaurantPanHandler::CRestaurantPanHandler() : CMovePlayerTo() { +} + +void CRestaurantPanHandler::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + + CMovePlayerTo::save(file, indent); +} + +void CRestaurantPanHandler::load(SimpleFile *file) { + file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + + CMovePlayerTo::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/restaurant_pan_handler.h b/engines/titanic/messages/restaurant_pan_handler.h new file mode 100644 index 0000000000..dd757bef7c --- /dev/null +++ b/engines/titanic/messages/restaurant_pan_handler.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_RESTAURANT_PAN_HANDLER_H +#define TITANIC_RESTAURANT_PAN_HANDLER_H + +#include "titanic/messages/move_player_to.h" + +namespace Titanic { + +class CRestaurantPanHandler : public CMovePlayerTo { +protected: + CString _string1; + CString _string2; +public: + CRestaurantPanHandler(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CRestaurantPanHandler"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_RESTAURANT_PAN_HANDLER_H */ diff --git a/engines/titanic/messages/restricted_move.cpp b/engines/titanic/messages/restricted_move.cpp new file mode 100644 index 0000000000..147cf11c08 --- /dev/null +++ b/engines/titanic/messages/restricted_move.cpp @@ -0,0 +1,44 @@ +/* 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 "titanic/messages/restricted_move.h" + +namespace Titanic { + +CRestrictedMove::CRestrictedMove() : CMovePlayerTo(), _fieldC8(0) { +} + +void CRestrictedMove::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldC8, indent); + + CMovePlayerTo::save(file, indent); +} + +void CRestrictedMove::load(SimpleFile *file) { + file->readNumber(); + _fieldC8 = file->readNumber(); + + CMovePlayerTo::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/restricted_move.h b/engines/titanic/messages/restricted_move.h new file mode 100644 index 0000000000..5feae2985b --- /dev/null +++ b/engines/titanic/messages/restricted_move.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_RESTRICTED_MOVE_H +#define TITANIC_RESTRICTED_MOVE_H + +#include "titanic/messages/move_player_to.h" + +namespace Titanic { + +class CRestrictedMove : public CMovePlayerTo { +protected: + int _fieldC8; +public: + CRestrictedMove(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CRestrictedMove"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_RESTRICTED_MOVE_H */ diff --git a/engines/titanic/messages/trip_down_canal.cpp b/engines/titanic/messages/trip_down_canal.cpp new file mode 100644 index 0000000000..be5f28321f --- /dev/null +++ b/engines/titanic/messages/trip_down_canal.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/messages/trip_down_canal.h" + +namespace Titanic { + +CTripDownCanal::CTripDownCanal() : CMovePlayerTo() { +} + +void CTripDownCanal::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CMovePlayerTo::save(file, indent); +} + +void CTripDownCanal::load(SimpleFile *file) { + file->readNumber(); + CMovePlayerTo::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/trip_down_canal.h b/engines/titanic/messages/trip_down_canal.h new file mode 100644 index 0000000000..117ce94c12 --- /dev/null +++ b/engines/titanic/messages/trip_down_canal.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_TRIP_DOWN_CANAL_H +#define TITANIC_TRIP_DOWN_CANAL_H + +#include "titanic/messages/move_player_to.h" + +namespace Titanic { + +class CTripDownCanal : public CMovePlayerTo { +public: + CTripDownCanal(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CTripDownCanal"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TRIP_DOWN_CANAL_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 74206ea262..66157be507 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -38,6 +38,19 @@ MODULE_OBJS := \ game/room_item.o \ game/service_elevator_door.o \ game/sub_glass.o \ + messages/enter_bomb_room.o \ + messages/exit_arboretum.o \ + messages/exit_bridge.o \ + messages/exit_state_room.o \ + messages/exit_titania.o \ + messages/move_player_in_parrot_room.o \ + messages/move_player_to_from.o \ + messages/move_player_to.o \ + messages/multi_move.o \ + messages/pan_from_pel.o \ + messages/restaurant_pan_handler.o \ + messages/restricted_move.o \ + messages/trip_down_canal.o \ npcs/barbot.o \ npcs/bellbot.o \ npcs/character.o \ -- cgit v1.2.3 From ba8cbcb229ae4086a6c1940fc0173527bb8fb1ae Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 25 Feb 2016 23:52:22 -0500 Subject: TITANIC: Renames messages sub-folder to moves --- engines/titanic/messages/enter_bomb_room.cpp | 40 --------------- engines/titanic/messages/enter_bomb_room.h | 54 -------------------- engines/titanic/messages/exit_arboretum.cpp | 49 ------------------ engines/titanic/messages/exit_arboretum.h | 56 --------------------- engines/titanic/messages/exit_bridge.cpp | 42 ---------------- engines/titanic/messages/exit_bridge.h | 54 -------------------- engines/titanic/messages/exit_state_room.cpp | 40 --------------- engines/titanic/messages/exit_state_room.h | 54 -------------------- engines/titanic/messages/exit_titania.cpp | 51 ------------------- engines/titanic/messages/exit_titania.h | 57 --------------------- .../messages/move_player_in_parrot_room.cpp | 40 --------------- .../titanic/messages/move_player_in_parrot_room.h | 52 ------------------- engines/titanic/messages/move_player_to.cpp | 44 ---------------- engines/titanic/messages/move_player_to.h | 54 -------------------- engines/titanic/messages/move_player_to_from.cpp | 44 ---------------- engines/titanic/messages/move_player_to_from.h | 54 -------------------- engines/titanic/messages/multi_move.cpp | 52 ------------------- engines/titanic/messages/multi_move.h | 58 ---------------------- engines/titanic/messages/pan_from_pel.cpp | 46 ----------------- engines/titanic/messages/pan_from_pel.h | 55 -------------------- .../titanic/messages/restaurant_pan_handler.cpp | 46 ----------------- engines/titanic/messages/restaurant_pan_handler.h | 55 -------------------- engines/titanic/messages/restricted_move.cpp | 44 ---------------- engines/titanic/messages/restricted_move.h | 54 -------------------- engines/titanic/messages/trip_down_canal.cpp | 40 --------------- engines/titanic/messages/trip_down_canal.h | 52 ------------------- engines/titanic/moves/enter_bomb_room.cpp | 40 +++++++++++++++ engines/titanic/moves/enter_bomb_room.h | 54 ++++++++++++++++++++ engines/titanic/moves/exit_arboretum.cpp | 49 ++++++++++++++++++ engines/titanic/moves/exit_arboretum.h | 56 +++++++++++++++++++++ engines/titanic/moves/exit_bridge.cpp | 42 ++++++++++++++++ engines/titanic/moves/exit_bridge.h | 54 ++++++++++++++++++++ engines/titanic/moves/exit_state_room.cpp | 40 +++++++++++++++ engines/titanic/moves/exit_state_room.h | 54 ++++++++++++++++++++ engines/titanic/moves/exit_titania.cpp | 51 +++++++++++++++++++ engines/titanic/moves/exit_titania.h | 57 +++++++++++++++++++++ .../titanic/moves/move_player_in_parrot_room.cpp | 40 +++++++++++++++ engines/titanic/moves/move_player_in_parrot_room.h | 52 +++++++++++++++++++ engines/titanic/moves/move_player_to.cpp | 44 ++++++++++++++++ engines/titanic/moves/move_player_to.h | 54 ++++++++++++++++++++ engines/titanic/moves/move_player_to_from.cpp | 44 ++++++++++++++++ engines/titanic/moves/move_player_to_from.h | 54 ++++++++++++++++++++ engines/titanic/moves/multi_move.cpp | 52 +++++++++++++++++++ engines/titanic/moves/multi_move.h | 58 ++++++++++++++++++++++ engines/titanic/moves/pan_from_pel.cpp | 46 +++++++++++++++++ engines/titanic/moves/pan_from_pel.h | 55 ++++++++++++++++++++ engines/titanic/moves/restaurant_pan_handler.cpp | 46 +++++++++++++++++ engines/titanic/moves/restaurant_pan_handler.h | 55 ++++++++++++++++++++ engines/titanic/moves/restricted_move.cpp | 44 ++++++++++++++++ engines/titanic/moves/restricted_move.h | 54 ++++++++++++++++++++ engines/titanic/moves/trip_down_canal.cpp | 40 +++++++++++++++ engines/titanic/moves/trip_down_canal.h | 52 +++++++++++++++++++ 52 files changed, 1287 insertions(+), 1287 deletions(-) delete mode 100644 engines/titanic/messages/enter_bomb_room.cpp delete mode 100644 engines/titanic/messages/enter_bomb_room.h delete mode 100644 engines/titanic/messages/exit_arboretum.cpp delete mode 100644 engines/titanic/messages/exit_arboretum.h delete mode 100644 engines/titanic/messages/exit_bridge.cpp delete mode 100644 engines/titanic/messages/exit_bridge.h delete mode 100644 engines/titanic/messages/exit_state_room.cpp delete mode 100644 engines/titanic/messages/exit_state_room.h delete mode 100644 engines/titanic/messages/exit_titania.cpp delete mode 100644 engines/titanic/messages/exit_titania.h delete mode 100644 engines/titanic/messages/move_player_in_parrot_room.cpp delete mode 100644 engines/titanic/messages/move_player_in_parrot_room.h delete mode 100644 engines/titanic/messages/move_player_to.cpp delete mode 100644 engines/titanic/messages/move_player_to.h delete mode 100644 engines/titanic/messages/move_player_to_from.cpp delete mode 100644 engines/titanic/messages/move_player_to_from.h delete mode 100644 engines/titanic/messages/multi_move.cpp delete mode 100644 engines/titanic/messages/multi_move.h delete mode 100644 engines/titanic/messages/pan_from_pel.cpp delete mode 100644 engines/titanic/messages/pan_from_pel.h delete mode 100644 engines/titanic/messages/restaurant_pan_handler.cpp delete mode 100644 engines/titanic/messages/restaurant_pan_handler.h delete mode 100644 engines/titanic/messages/restricted_move.cpp delete mode 100644 engines/titanic/messages/restricted_move.h delete mode 100644 engines/titanic/messages/trip_down_canal.cpp delete mode 100644 engines/titanic/messages/trip_down_canal.h create mode 100644 engines/titanic/moves/enter_bomb_room.cpp create mode 100644 engines/titanic/moves/enter_bomb_room.h create mode 100644 engines/titanic/moves/exit_arboretum.cpp create mode 100644 engines/titanic/moves/exit_arboretum.h create mode 100644 engines/titanic/moves/exit_bridge.cpp create mode 100644 engines/titanic/moves/exit_bridge.h create mode 100644 engines/titanic/moves/exit_state_room.cpp create mode 100644 engines/titanic/moves/exit_state_room.h create mode 100644 engines/titanic/moves/exit_titania.cpp create mode 100644 engines/titanic/moves/exit_titania.h create mode 100644 engines/titanic/moves/move_player_in_parrot_room.cpp create mode 100644 engines/titanic/moves/move_player_in_parrot_room.h create mode 100644 engines/titanic/moves/move_player_to.cpp create mode 100644 engines/titanic/moves/move_player_to.h create mode 100644 engines/titanic/moves/move_player_to_from.cpp create mode 100644 engines/titanic/moves/move_player_to_from.h create mode 100644 engines/titanic/moves/multi_move.cpp create mode 100644 engines/titanic/moves/multi_move.h create mode 100644 engines/titanic/moves/pan_from_pel.cpp create mode 100644 engines/titanic/moves/pan_from_pel.h create mode 100644 engines/titanic/moves/restaurant_pan_handler.cpp create mode 100644 engines/titanic/moves/restaurant_pan_handler.h create mode 100644 engines/titanic/moves/restricted_move.cpp create mode 100644 engines/titanic/moves/restricted_move.h create mode 100644 engines/titanic/moves/trip_down_canal.cpp create mode 100644 engines/titanic/moves/trip_down_canal.h diff --git a/engines/titanic/messages/enter_bomb_room.cpp b/engines/titanic/messages/enter_bomb_room.cpp deleted file mode 100644 index 049c3f45ae..0000000000 --- a/engines/titanic/messages/enter_bomb_room.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* 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 "titanic/messages/enter_bomb_room.h" - -namespace Titanic { - -CEnterBombRoom::CEnterBombRoom() : CMovePlayerTo(), _fieldC8(0) { -} - -void CEnterBombRoom::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - CMovePlayerTo::save(file, indent); -} - -void CEnterBombRoom::load(SimpleFile *file) { - file->readNumber(); - CMovePlayerTo::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/messages/enter_bomb_room.h b/engines/titanic/messages/enter_bomb_room.h deleted file mode 100644 index 3ec5616db0..0000000000 --- a/engines/titanic/messages/enter_bomb_room.h +++ /dev/null @@ -1,54 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_ENTER_BOMB_ROOM_H -#define TITANIC_ENTER_BOMB_ROOM_H - -#include "titanic/messages/move_player_to.h" - -namespace Titanic { - -class CEnterBombRoom : public CMovePlayerTo { -protected: - int _fieldC8; -public: - CEnterBombRoom(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CEnterBombRoom"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_ENTER_BOMB_ROOM_H */ diff --git a/engines/titanic/messages/exit_arboretum.cpp b/engines/titanic/messages/exit_arboretum.cpp deleted file mode 100644 index 0a50377afb..0000000000 --- a/engines/titanic/messages/exit_arboretum.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* 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 "titanic/messages/exit_arboretum.h" - -namespace Titanic { - -CExitArboretum::CExitArboretum() : CMovePlayerTo(), - _fieldC8(0), _fieldCC(0), _fieldD0(1) { -} - -void CExitArboretum::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldC8, indent); - file->writeNumberLine(_fieldCC, indent); - file->writeNumberLine(_fieldD0, indent); - - CMovePlayerTo::save(file, indent); -} - -void CExitArboretum::load(SimpleFile *file) { - file->readNumber(); - _fieldC8 = file->readNumber(); - _fieldCC = file->readNumber(); - _fieldD0 = file->readNumber(); - - CMovePlayerTo::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/messages/exit_arboretum.h b/engines/titanic/messages/exit_arboretum.h deleted file mode 100644 index 4ee135e6bc..0000000000 --- a/engines/titanic/messages/exit_arboretum.h +++ /dev/null @@ -1,56 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_EXIT_ARBORETUM_H -#define TITANIC_EXIT_ARBORETUM_H - -#include "titanic/messages/move_player_to.h" - -namespace Titanic { - -class CExitArboretum : public CMovePlayerTo { -protected: - int _fieldC8; - int _fieldCC; - int _fieldD0; -public: - CExitArboretum(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CExitArboretum"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_BACKGROUND_H */ diff --git a/engines/titanic/messages/exit_bridge.cpp b/engines/titanic/messages/exit_bridge.cpp deleted file mode 100644 index 27f923bf11..0000000000 --- a/engines/titanic/messages/exit_bridge.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* 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 "titanic/messages/exit_bridge.h" - -namespace Titanic { - -CExitBridge::CExitBridge() : CMovePlayerTo() { -} - -void CExitBridge::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - CMovePlayerTo::save(file, indent); -} - -void CExitBridge::load(SimpleFile *file) { - file->readNumber(); - _string1 = file->readString(); - - CMovePlayerTo::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/messages/exit_bridge.h b/engines/titanic/messages/exit_bridge.h deleted file mode 100644 index 6d65a0028a..0000000000 --- a/engines/titanic/messages/exit_bridge.h +++ /dev/null @@ -1,54 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_EXIT_BRIDGE_H -#define TITANIC_EXIT_BRIDGE_H - -#include "titanic/messages/move_player_to.h" - -namespace Titanic { - -class CExitBridge : public CMovePlayerTo { -private: - CString _string1; -public: - CExitBridge(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CExitBridge"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_EXIT_BRIDGE_H */ diff --git a/engines/titanic/messages/exit_state_room.cpp b/engines/titanic/messages/exit_state_room.cpp deleted file mode 100644 index f1acd910d8..0000000000 --- a/engines/titanic/messages/exit_state_room.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* 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 "titanic/messages/exit_state_room.h" - -namespace Titanic { - -CExitStateRoom::CExitStateRoom() : CMovePlayerTo(), _fieldC8(0) { -} - -void CExitStateRoom::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - CMovePlayerTo::save(file, indent); -} - -void CExitStateRoom::load(SimpleFile *file) { - file->readNumber(); - CMovePlayerTo::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/messages/exit_state_room.h b/engines/titanic/messages/exit_state_room.h deleted file mode 100644 index 12adcfba44..0000000000 --- a/engines/titanic/messages/exit_state_room.h +++ /dev/null @@ -1,54 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_EXIT_STATE_ROOM_H -#define TITANIC_EXIT_STATE_ROOM_H - -#include "titanic/messages/move_player_to.h" - -namespace Titanic { - -class CExitStateRoom : public CMovePlayerTo { -protected: - int _fieldC8; -public: - CExitStateRoom(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CExitStateRoom"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_EXIT_STATE_ROOM_H */ diff --git a/engines/titanic/messages/exit_titania.cpp b/engines/titanic/messages/exit_titania.cpp deleted file mode 100644 index e94d0cd706..0000000000 --- a/engines/titanic/messages/exit_titania.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* 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 "titanic/messages/exit_titania.h" - -namespace Titanic { - -CExitTitania::CExitTitania() : CMovePlayerTo(), _fieldC8(0), - _string1("NULL"), _string2("NULL"), _string3("NULL") { -} - -void CExitTitania::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldC8, indent); - file->writeQuotedLine(_string1, indent); - file->writeQuotedLine(_string2, indent); - file->writeQuotedLine(_string3, indent); - - CMovePlayerTo::save(file, indent); -} - -void CExitTitania::load(SimpleFile *file) { - file->readNumber(); - _fieldC8 = file->readNumber(); - _string1 = file->readString(); - _string2 = file->readString(); - _string3 = file->readString(); - - CMovePlayerTo::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/messages/exit_titania.h b/engines/titanic/messages/exit_titania.h deleted file mode 100644 index 529886aee9..0000000000 --- a/engines/titanic/messages/exit_titania.h +++ /dev/null @@ -1,57 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_EXIT_TITANIA_H -#define TITANIC_EXIT_TITANIA_H - -#include "titanic/messages/move_player_to.h" - -namespace Titanic { - -class CExitTitania : public CMovePlayerTo { -private: - int _fieldC8; - CString _string1; - CString _string2; - CString _string3; -public: - CExitTitania(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CExitTitania"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_EXIT_TITANIA_H */ diff --git a/engines/titanic/messages/move_player_in_parrot_room.cpp b/engines/titanic/messages/move_player_in_parrot_room.cpp deleted file mode 100644 index b1040bfb75..0000000000 --- a/engines/titanic/messages/move_player_in_parrot_room.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* 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 "titanic/messages/move_player_in_parrot_room.h" - -namespace Titanic { - -CMovePlayerInParrotRoom::CMovePlayerInParrotRoom() : CMovePlayerTo() { -} - -void CMovePlayerInParrotRoom::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - CGameObject::save(file, indent); -} - -void CMovePlayerInParrotRoom::load(SimpleFile *file) { - file->readNumber(); - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/messages/move_player_in_parrot_room.h b/engines/titanic/messages/move_player_in_parrot_room.h deleted file mode 100644 index f4e5779fd8..0000000000 --- a/engines/titanic/messages/move_player_in_parrot_room.h +++ /dev/null @@ -1,52 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_MOVE_PLAYER_IN_PARROT_ROOM_H -#define TITANIC_MOVE_PLAYER_IN_PARROT_ROOM_H - -#include "titanic/messages/move_player_to.h" - -namespace Titanic { - -class CMovePlayerInParrotRoom : public CMovePlayerTo { -public: - CMovePlayerInParrotRoom(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMovePlayerInParrotRoom"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_MOVE_PLAYER_IN_PARROT_ROOM_H */ diff --git a/engines/titanic/messages/move_player_to.cpp b/engines/titanic/messages/move_player_to.cpp deleted file mode 100644 index 66a71e8fa5..0000000000 --- a/engines/titanic/messages/move_player_to.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* 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 "titanic/messages/move_player_to.h" - -namespace Titanic { - -CMovePlayerTo::CMovePlayerTo() : CGameObject() { -} - -void CMovePlayerTo::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeQuotedLine(_destination, indent); - - CGameObject::save(file, indent); -} - -void CMovePlayerTo::load(SimpleFile *file) { - file->readNumber(); - _destination = file->readString(); - - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/messages/move_player_to.h b/engines/titanic/messages/move_player_to.h deleted file mode 100644 index aa785b9167..0000000000 --- a/engines/titanic/messages/move_player_to.h +++ /dev/null @@ -1,54 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_MOVE_PLAYER_TO_H -#define TITANIC_MOVE_PLAYER_TO_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CMovePlayerTo : public CGameObject { -protected: - CString _destination; -public: - CMovePlayerTo(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMovePlayerTo"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_MOVE_PLAYER_TO_H */ diff --git a/engines/titanic/messages/move_player_to_from.cpp b/engines/titanic/messages/move_player_to_from.cpp deleted file mode 100644 index 77c74d5b50..0000000000 --- a/engines/titanic/messages/move_player_to_from.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* 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 "titanic/messages/move_player_to_from.h" - -namespace Titanic { - -CMovePlayerToFrom::CMovePlayerToFrom() : CGameObject() { -} - -void CMovePlayerToFrom::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeQuotedLine(_string2, indent); - - CGameObject::save(file, indent); -} - -void CMovePlayerToFrom::load(SimpleFile *file) { - file->readNumber(); - _string2 = file->readString(); - - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/messages/move_player_to_from.h b/engines/titanic/messages/move_player_to_from.h deleted file mode 100644 index 82fe5db2ec..0000000000 --- a/engines/titanic/messages/move_player_to_from.h +++ /dev/null @@ -1,54 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_MOVE_PLAYER_TO_FROM_H -#define TITANIC_MOVE_PLAYER_TO_FROM_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CMovePlayerToFrom : public CGameObject { -private: - CString _string2; -public: - CMovePlayerToFrom(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMovePlayerToFrom"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_MOVE_PLAYER_TO_FROM_H */ diff --git a/engines/titanic/messages/multi_move.cpp b/engines/titanic/messages/multi_move.cpp deleted file mode 100644 index dd1948c435..0000000000 --- a/engines/titanic/messages/multi_move.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* 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 "titanic/messages/multi_move.h" - -namespace Titanic { - -CMultiMove::CMultiMove() : CMovePlayerTo() { -} - -void CMultiMove::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeQuotedLine(_string1, indent); - file->writeQuotedLine(_string2, indent); - file->writeQuotedLine(_string3, indent); - file->writeQuotedLine(_string4, indent); - file->writeQuotedLine(_string5, indent); - - CMovePlayerTo::save(file, indent); -} - -void CMultiMove::load(SimpleFile *file) { - file->readNumber(); - _string1 = file->readString(); - _string2 = file->readString(); - _string3 = file->readString(); - _string5 = file->readString(); - _string4 = file->readString(); - - CMovePlayerTo::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/messages/multi_move.h b/engines/titanic/messages/multi_move.h deleted file mode 100644 index 2cc4f4e6bb..0000000000 --- a/engines/titanic/messages/multi_move.h +++ /dev/null @@ -1,58 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_MULTI_MOVE_H -#define TITANIC_MULTI_MOVE_H - -#include "titanic/messages/move_player_to.h" - -namespace Titanic { - -class CMultiMove : public CMovePlayerTo { -private: - CString _string1; - CString _string2; - CString _string3; - CString _string4; - CString _string5; -public: - CMultiMove(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMultiMove"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_MULTI_MOVE_H */ diff --git a/engines/titanic/messages/pan_from_pel.cpp b/engines/titanic/messages/pan_from_pel.cpp deleted file mode 100644 index 718927f9c7..0000000000 --- a/engines/titanic/messages/pan_from_pel.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* 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 "titanic/messages/pan_from_pel.h" - -namespace Titanic { - -CPanFromPel::CPanFromPel() : CMovePlayerTo(), _fieldC8(0) { -} - -void CPanFromPel::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldC8, indent); - file->writeQuotedLine(_string1, indent); - - CMovePlayerTo::save(file, indent); -} - -void CPanFromPel::load(SimpleFile *file) { - file->readNumber(); - _fieldC8 = file->readNumber(); - _string1 = file->readString(); - - CMovePlayerTo::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/messages/pan_from_pel.h b/engines/titanic/messages/pan_from_pel.h deleted file mode 100644 index abb565c9ce..0000000000 --- a/engines/titanic/messages/pan_from_pel.h +++ /dev/null @@ -1,55 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PAN_FROM_PEL_H -#define TITANIC_PAN_FROM_PEL_H - -#include "titanic/messages/move_player_to.h" - -namespace Titanic { - -class CPanFromPel : public CMovePlayerTo { -protected: - int _fieldC8; - CString _string1; -public: - CPanFromPel(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPanFromPel"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PAN_FROM_PEL_H */ diff --git a/engines/titanic/messages/restaurant_pan_handler.cpp b/engines/titanic/messages/restaurant_pan_handler.cpp deleted file mode 100644 index 14fd383cde..0000000000 --- a/engines/titanic/messages/restaurant_pan_handler.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* 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 "titanic/messages/restaurant_pan_handler.h" - -namespace Titanic { - -CRestaurantPanHandler::CRestaurantPanHandler() : CMovePlayerTo() { -} - -void CRestaurantPanHandler::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeQuotedLine(_string1, indent); - file->writeQuotedLine(_string2, indent); - - CMovePlayerTo::save(file, indent); -} - -void CRestaurantPanHandler::load(SimpleFile *file) { - file->readNumber(); - _string1 = file->readString(); - _string2 = file->readString(); - - CMovePlayerTo::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/messages/restaurant_pan_handler.h b/engines/titanic/messages/restaurant_pan_handler.h deleted file mode 100644 index dd757bef7c..0000000000 --- a/engines/titanic/messages/restaurant_pan_handler.h +++ /dev/null @@ -1,55 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_RESTAURANT_PAN_HANDLER_H -#define TITANIC_RESTAURANT_PAN_HANDLER_H - -#include "titanic/messages/move_player_to.h" - -namespace Titanic { - -class CRestaurantPanHandler : public CMovePlayerTo { -protected: - CString _string1; - CString _string2; -public: - CRestaurantPanHandler(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CRestaurantPanHandler"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_RESTAURANT_PAN_HANDLER_H */ diff --git a/engines/titanic/messages/restricted_move.cpp b/engines/titanic/messages/restricted_move.cpp deleted file mode 100644 index 147cf11c08..0000000000 --- a/engines/titanic/messages/restricted_move.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* 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 "titanic/messages/restricted_move.h" - -namespace Titanic { - -CRestrictedMove::CRestrictedMove() : CMovePlayerTo(), _fieldC8(0) { -} - -void CRestrictedMove::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldC8, indent); - - CMovePlayerTo::save(file, indent); -} - -void CRestrictedMove::load(SimpleFile *file) { - file->readNumber(); - _fieldC8 = file->readNumber(); - - CMovePlayerTo::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/messages/restricted_move.h b/engines/titanic/messages/restricted_move.h deleted file mode 100644 index 5feae2985b..0000000000 --- a/engines/titanic/messages/restricted_move.h +++ /dev/null @@ -1,54 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_RESTRICTED_MOVE_H -#define TITANIC_RESTRICTED_MOVE_H - -#include "titanic/messages/move_player_to.h" - -namespace Titanic { - -class CRestrictedMove : public CMovePlayerTo { -protected: - int _fieldC8; -public: - CRestrictedMove(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CRestrictedMove"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_RESTRICTED_MOVE_H */ diff --git a/engines/titanic/messages/trip_down_canal.cpp b/engines/titanic/messages/trip_down_canal.cpp deleted file mode 100644 index be5f28321f..0000000000 --- a/engines/titanic/messages/trip_down_canal.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* 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 "titanic/messages/trip_down_canal.h" - -namespace Titanic { - -CTripDownCanal::CTripDownCanal() : CMovePlayerTo() { -} - -void CTripDownCanal::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - CMovePlayerTo::save(file, indent); -} - -void CTripDownCanal::load(SimpleFile *file) { - file->readNumber(); - CMovePlayerTo::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/messages/trip_down_canal.h b/engines/titanic/messages/trip_down_canal.h deleted file mode 100644 index 117ce94c12..0000000000 --- a/engines/titanic/messages/trip_down_canal.h +++ /dev/null @@ -1,52 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_TRIP_DOWN_CANAL_H -#define TITANIC_TRIP_DOWN_CANAL_H - -#include "titanic/messages/move_player_to.h" - -namespace Titanic { - -class CTripDownCanal : public CMovePlayerTo { -public: - CTripDownCanal(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CTripDownCanal"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_TRIP_DOWN_CANAL_H */ diff --git a/engines/titanic/moves/enter_bomb_room.cpp b/engines/titanic/moves/enter_bomb_room.cpp new file mode 100644 index 0000000000..049c3f45ae --- /dev/null +++ b/engines/titanic/moves/enter_bomb_room.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/messages/enter_bomb_room.h" + +namespace Titanic { + +CEnterBombRoom::CEnterBombRoom() : CMovePlayerTo(), _fieldC8(0) { +} + +void CEnterBombRoom::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CMovePlayerTo::save(file, indent); +} + +void CEnterBombRoom::load(SimpleFile *file) { + file->readNumber(); + CMovePlayerTo::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/moves/enter_bomb_room.h b/engines/titanic/moves/enter_bomb_room.h new file mode 100644 index 0000000000..3ec5616db0 --- /dev/null +++ b/engines/titanic/moves/enter_bomb_room.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_ENTER_BOMB_ROOM_H +#define TITANIC_ENTER_BOMB_ROOM_H + +#include "titanic/messages/move_player_to.h" + +namespace Titanic { + +class CEnterBombRoom : public CMovePlayerTo { +protected: + int _fieldC8; +public: + CEnterBombRoom(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CEnterBombRoom"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ENTER_BOMB_ROOM_H */ diff --git a/engines/titanic/moves/exit_arboretum.cpp b/engines/titanic/moves/exit_arboretum.cpp new file mode 100644 index 0000000000..0a50377afb --- /dev/null +++ b/engines/titanic/moves/exit_arboretum.cpp @@ -0,0 +1,49 @@ +/* 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 "titanic/messages/exit_arboretum.h" + +namespace Titanic { + +CExitArboretum::CExitArboretum() : CMovePlayerTo(), + _fieldC8(0), _fieldCC(0), _fieldD0(1) { +} + +void CExitArboretum::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeNumberLine(_fieldCC, indent); + file->writeNumberLine(_fieldD0, indent); + + CMovePlayerTo::save(file, indent); +} + +void CExitArboretum::load(SimpleFile *file) { + file->readNumber(); + _fieldC8 = file->readNumber(); + _fieldCC = file->readNumber(); + _fieldD0 = file->readNumber(); + + CMovePlayerTo::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/moves/exit_arboretum.h b/engines/titanic/moves/exit_arboretum.h new file mode 100644 index 0000000000..4ee135e6bc --- /dev/null +++ b/engines/titanic/moves/exit_arboretum.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_EXIT_ARBORETUM_H +#define TITANIC_EXIT_ARBORETUM_H + +#include "titanic/messages/move_player_to.h" + +namespace Titanic { + +class CExitArboretum : public CMovePlayerTo { +protected: + int _fieldC8; + int _fieldCC; + int _fieldD0; +public: + CExitArboretum(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CExitArboretum"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BACKGROUND_H */ diff --git a/engines/titanic/moves/exit_bridge.cpp b/engines/titanic/moves/exit_bridge.cpp new file mode 100644 index 0000000000..27f923bf11 --- /dev/null +++ b/engines/titanic/moves/exit_bridge.cpp @@ -0,0 +1,42 @@ +/* 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 "titanic/messages/exit_bridge.h" + +namespace Titanic { + +CExitBridge::CExitBridge() : CMovePlayerTo() { +} + +void CExitBridge::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CMovePlayerTo::save(file, indent); +} + +void CExitBridge::load(SimpleFile *file) { + file->readNumber(); + _string1 = file->readString(); + + CMovePlayerTo::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/moves/exit_bridge.h b/engines/titanic/moves/exit_bridge.h new file mode 100644 index 0000000000..6d65a0028a --- /dev/null +++ b/engines/titanic/moves/exit_bridge.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_EXIT_BRIDGE_H +#define TITANIC_EXIT_BRIDGE_H + +#include "titanic/messages/move_player_to.h" + +namespace Titanic { + +class CExitBridge : public CMovePlayerTo { +private: + CString _string1; +public: + CExitBridge(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CExitBridge"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_EXIT_BRIDGE_H */ diff --git a/engines/titanic/moves/exit_state_room.cpp b/engines/titanic/moves/exit_state_room.cpp new file mode 100644 index 0000000000..f1acd910d8 --- /dev/null +++ b/engines/titanic/moves/exit_state_room.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/messages/exit_state_room.h" + +namespace Titanic { + +CExitStateRoom::CExitStateRoom() : CMovePlayerTo(), _fieldC8(0) { +} + +void CExitStateRoom::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CMovePlayerTo::save(file, indent); +} + +void CExitStateRoom::load(SimpleFile *file) { + file->readNumber(); + CMovePlayerTo::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/moves/exit_state_room.h b/engines/titanic/moves/exit_state_room.h new file mode 100644 index 0000000000..12adcfba44 --- /dev/null +++ b/engines/titanic/moves/exit_state_room.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_EXIT_STATE_ROOM_H +#define TITANIC_EXIT_STATE_ROOM_H + +#include "titanic/messages/move_player_to.h" + +namespace Titanic { + +class CExitStateRoom : public CMovePlayerTo { +protected: + int _fieldC8; +public: + CExitStateRoom(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CExitStateRoom"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_EXIT_STATE_ROOM_H */ diff --git a/engines/titanic/moves/exit_titania.cpp b/engines/titanic/moves/exit_titania.cpp new file mode 100644 index 0000000000..e94d0cd706 --- /dev/null +++ b/engines/titanic/moves/exit_titania.cpp @@ -0,0 +1,51 @@ +/* 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 "titanic/messages/exit_titania.h" + +namespace Titanic { + +CExitTitania::CExitTitania() : CMovePlayerTo(), _fieldC8(0), + _string1("NULL"), _string2("NULL"), _string3("NULL") { +} + +void CExitTitania::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + file->writeQuotedLine(_string3, indent); + + CMovePlayerTo::save(file, indent); +} + +void CExitTitania::load(SimpleFile *file) { + file->readNumber(); + _fieldC8 = file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + _string3 = file->readString(); + + CMovePlayerTo::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/moves/exit_titania.h b/engines/titanic/moves/exit_titania.h new file mode 100644 index 0000000000..529886aee9 --- /dev/null +++ b/engines/titanic/moves/exit_titania.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_EXIT_TITANIA_H +#define TITANIC_EXIT_TITANIA_H + +#include "titanic/messages/move_player_to.h" + +namespace Titanic { + +class CExitTitania : public CMovePlayerTo { +private: + int _fieldC8; + CString _string1; + CString _string2; + CString _string3; +public: + CExitTitania(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CExitTitania"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_EXIT_TITANIA_H */ diff --git a/engines/titanic/moves/move_player_in_parrot_room.cpp b/engines/titanic/moves/move_player_in_parrot_room.cpp new file mode 100644 index 0000000000..b1040bfb75 --- /dev/null +++ b/engines/titanic/moves/move_player_in_parrot_room.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/messages/move_player_in_parrot_room.h" + +namespace Titanic { + +CMovePlayerInParrotRoom::CMovePlayerInParrotRoom() : CMovePlayerTo() { +} + +void CMovePlayerInParrotRoom::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CMovePlayerInParrotRoom::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/moves/move_player_in_parrot_room.h b/engines/titanic/moves/move_player_in_parrot_room.h new file mode 100644 index 0000000000..f4e5779fd8 --- /dev/null +++ b/engines/titanic/moves/move_player_in_parrot_room.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_MOVE_PLAYER_IN_PARROT_ROOM_H +#define TITANIC_MOVE_PLAYER_IN_PARROT_ROOM_H + +#include "titanic/messages/move_player_to.h" + +namespace Titanic { + +class CMovePlayerInParrotRoom : public CMovePlayerTo { +public: + CMovePlayerInParrotRoom(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMovePlayerInParrotRoom"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MOVE_PLAYER_IN_PARROT_ROOM_H */ diff --git a/engines/titanic/moves/move_player_to.cpp b/engines/titanic/moves/move_player_to.cpp new file mode 100644 index 0000000000..66a71e8fa5 --- /dev/null +++ b/engines/titanic/moves/move_player_to.cpp @@ -0,0 +1,44 @@ +/* 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 "titanic/messages/move_player_to.h" + +namespace Titanic { + +CMovePlayerTo::CMovePlayerTo() : CGameObject() { +} + +void CMovePlayerTo::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_destination, indent); + + CGameObject::save(file, indent); +} + +void CMovePlayerTo::load(SimpleFile *file) { + file->readNumber(); + _destination = file->readString(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/moves/move_player_to.h b/engines/titanic/moves/move_player_to.h new file mode 100644 index 0000000000..aa785b9167 --- /dev/null +++ b/engines/titanic/moves/move_player_to.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_MOVE_PLAYER_TO_H +#define TITANIC_MOVE_PLAYER_TO_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CMovePlayerTo : public CGameObject { +protected: + CString _destination; +public: + CMovePlayerTo(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMovePlayerTo"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MOVE_PLAYER_TO_H */ diff --git a/engines/titanic/moves/move_player_to_from.cpp b/engines/titanic/moves/move_player_to_from.cpp new file mode 100644 index 0000000000..77c74d5b50 --- /dev/null +++ b/engines/titanic/moves/move_player_to_from.cpp @@ -0,0 +1,44 @@ +/* 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 "titanic/messages/move_player_to_from.h" + +namespace Titanic { + +CMovePlayerToFrom::CMovePlayerToFrom() : CGameObject() { +} + +void CMovePlayerToFrom::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string2, indent); + + CGameObject::save(file, indent); +} + +void CMovePlayerToFrom::load(SimpleFile *file) { + file->readNumber(); + _string2 = file->readString(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/moves/move_player_to_from.h b/engines/titanic/moves/move_player_to_from.h new file mode 100644 index 0000000000..82fe5db2ec --- /dev/null +++ b/engines/titanic/moves/move_player_to_from.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_MOVE_PLAYER_TO_FROM_H +#define TITANIC_MOVE_PLAYER_TO_FROM_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CMovePlayerToFrom : public CGameObject { +private: + CString _string2; +public: + CMovePlayerToFrom(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMovePlayerToFrom"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MOVE_PLAYER_TO_FROM_H */ diff --git a/engines/titanic/moves/multi_move.cpp b/engines/titanic/moves/multi_move.cpp new file mode 100644 index 0000000000..dd1948c435 --- /dev/null +++ b/engines/titanic/moves/multi_move.cpp @@ -0,0 +1,52 @@ +/* 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 "titanic/messages/multi_move.h" + +namespace Titanic { + +CMultiMove::CMultiMove() : CMovePlayerTo() { +} + +void CMultiMove::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + file->writeQuotedLine(_string3, indent); + file->writeQuotedLine(_string4, indent); + file->writeQuotedLine(_string5, indent); + + CMovePlayerTo::save(file, indent); +} + +void CMultiMove::load(SimpleFile *file) { + file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + _string3 = file->readString(); + _string5 = file->readString(); + _string4 = file->readString(); + + CMovePlayerTo::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/moves/multi_move.h b/engines/titanic/moves/multi_move.h new file mode 100644 index 0000000000..2cc4f4e6bb --- /dev/null +++ b/engines/titanic/moves/multi_move.h @@ -0,0 +1,58 @@ +/* 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. + * + */ + +#ifndef TITANIC_MULTI_MOVE_H +#define TITANIC_MULTI_MOVE_H + +#include "titanic/messages/move_player_to.h" + +namespace Titanic { + +class CMultiMove : public CMovePlayerTo { +private: + CString _string1; + CString _string2; + CString _string3; + CString _string4; + CString _string5; +public: + CMultiMove(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMultiMove"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MULTI_MOVE_H */ diff --git a/engines/titanic/moves/pan_from_pel.cpp b/engines/titanic/moves/pan_from_pel.cpp new file mode 100644 index 0000000000..718927f9c7 --- /dev/null +++ b/engines/titanic/moves/pan_from_pel.cpp @@ -0,0 +1,46 @@ +/* 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 "titanic/messages/pan_from_pel.h" + +namespace Titanic { + +CPanFromPel::CPanFromPel() : CMovePlayerTo(), _fieldC8(0) { +} + +void CPanFromPel::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeQuotedLine(_string1, indent); + + CMovePlayerTo::save(file, indent); +} + +void CPanFromPel::load(SimpleFile *file) { + file->readNumber(); + _fieldC8 = file->readNumber(); + _string1 = file->readString(); + + CMovePlayerTo::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/moves/pan_from_pel.h b/engines/titanic/moves/pan_from_pel.h new file mode 100644 index 0000000000..abb565c9ce --- /dev/null +++ b/engines/titanic/moves/pan_from_pel.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_PAN_FROM_PEL_H +#define TITANIC_PAN_FROM_PEL_H + +#include "titanic/messages/move_player_to.h" + +namespace Titanic { + +class CPanFromPel : public CMovePlayerTo { +protected: + int _fieldC8; + CString _string1; +public: + CPanFromPel(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPanFromPel"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PAN_FROM_PEL_H */ diff --git a/engines/titanic/moves/restaurant_pan_handler.cpp b/engines/titanic/moves/restaurant_pan_handler.cpp new file mode 100644 index 0000000000..14fd383cde --- /dev/null +++ b/engines/titanic/moves/restaurant_pan_handler.cpp @@ -0,0 +1,46 @@ +/* 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 "titanic/messages/restaurant_pan_handler.h" + +namespace Titanic { + +CRestaurantPanHandler::CRestaurantPanHandler() : CMovePlayerTo() { +} + +void CRestaurantPanHandler::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + + CMovePlayerTo::save(file, indent); +} + +void CRestaurantPanHandler::load(SimpleFile *file) { + file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + + CMovePlayerTo::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/moves/restaurant_pan_handler.h b/engines/titanic/moves/restaurant_pan_handler.h new file mode 100644 index 0000000000..dd757bef7c --- /dev/null +++ b/engines/titanic/moves/restaurant_pan_handler.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_RESTAURANT_PAN_HANDLER_H +#define TITANIC_RESTAURANT_PAN_HANDLER_H + +#include "titanic/messages/move_player_to.h" + +namespace Titanic { + +class CRestaurantPanHandler : public CMovePlayerTo { +protected: + CString _string1; + CString _string2; +public: + CRestaurantPanHandler(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CRestaurantPanHandler"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_RESTAURANT_PAN_HANDLER_H */ diff --git a/engines/titanic/moves/restricted_move.cpp b/engines/titanic/moves/restricted_move.cpp new file mode 100644 index 0000000000..147cf11c08 --- /dev/null +++ b/engines/titanic/moves/restricted_move.cpp @@ -0,0 +1,44 @@ +/* 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 "titanic/messages/restricted_move.h" + +namespace Titanic { + +CRestrictedMove::CRestrictedMove() : CMovePlayerTo(), _fieldC8(0) { +} + +void CRestrictedMove::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldC8, indent); + + CMovePlayerTo::save(file, indent); +} + +void CRestrictedMove::load(SimpleFile *file) { + file->readNumber(); + _fieldC8 = file->readNumber(); + + CMovePlayerTo::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/moves/restricted_move.h b/engines/titanic/moves/restricted_move.h new file mode 100644 index 0000000000..5feae2985b --- /dev/null +++ b/engines/titanic/moves/restricted_move.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_RESTRICTED_MOVE_H +#define TITANIC_RESTRICTED_MOVE_H + +#include "titanic/messages/move_player_to.h" + +namespace Titanic { + +class CRestrictedMove : public CMovePlayerTo { +protected: + int _fieldC8; +public: + CRestrictedMove(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CRestrictedMove"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_RESTRICTED_MOVE_H */ diff --git a/engines/titanic/moves/trip_down_canal.cpp b/engines/titanic/moves/trip_down_canal.cpp new file mode 100644 index 0000000000..be5f28321f --- /dev/null +++ b/engines/titanic/moves/trip_down_canal.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/messages/trip_down_canal.h" + +namespace Titanic { + +CTripDownCanal::CTripDownCanal() : CMovePlayerTo() { +} + +void CTripDownCanal::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CMovePlayerTo::save(file, indent); +} + +void CTripDownCanal::load(SimpleFile *file) { + file->readNumber(); + CMovePlayerTo::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/moves/trip_down_canal.h b/engines/titanic/moves/trip_down_canal.h new file mode 100644 index 0000000000..117ce94c12 --- /dev/null +++ b/engines/titanic/moves/trip_down_canal.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_TRIP_DOWN_CANAL_H +#define TITANIC_TRIP_DOWN_CANAL_H + +#include "titanic/messages/move_player_to.h" + +namespace Titanic { + +class CTripDownCanal : public CMovePlayerTo { +public: + CTripDownCanal(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CTripDownCanal"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TRIP_DOWN_CANAL_H */ -- cgit v1.2.3 From db4dfcebeb669f83c1a3768380e641f598fb9049 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 25 Feb 2016 23:55:31 -0500 Subject: TITANIC: Renames messages sub-folder to moves --- engines/titanic/core/saveable_object.cpp | 24 ++++++++++---------- engines/titanic/module.mk | 26 +++++++++++----------- engines/titanic/moves/enter_bomb_room.cpp | 2 +- engines/titanic/moves/enter_bomb_room.h | 2 +- engines/titanic/moves/exit_arboretum.cpp | 2 +- engines/titanic/moves/exit_arboretum.h | 2 +- engines/titanic/moves/exit_bridge.cpp | 2 +- engines/titanic/moves/exit_bridge.h | 2 +- engines/titanic/moves/exit_state_room.cpp | 2 +- engines/titanic/moves/exit_state_room.h | 2 +- engines/titanic/moves/exit_titania.cpp | 2 +- engines/titanic/moves/exit_titania.h | 2 +- .../titanic/moves/move_player_in_parrot_room.cpp | 2 +- engines/titanic/moves/move_player_in_parrot_room.h | 2 +- engines/titanic/moves/move_player_to.cpp | 2 +- engines/titanic/moves/move_player_to_from.cpp | 2 +- engines/titanic/moves/multi_move.cpp | 2 +- engines/titanic/moves/multi_move.h | 2 +- engines/titanic/moves/pan_from_pel.cpp | 2 +- engines/titanic/moves/pan_from_pel.h | 2 +- engines/titanic/moves/restaurant_pan_handler.cpp | 2 +- engines/titanic/moves/restaurant_pan_handler.h | 2 +- engines/titanic/moves/restricted_move.cpp | 2 +- engines/titanic/moves/restricted_move.h | 2 +- engines/titanic/moves/trip_down_canal.cpp | 2 +- engines/titanic/moves/trip_down_canal.h | 2 +- 26 files changed, 49 insertions(+), 49 deletions(-) diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 382023da95..080cdb6aa2 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -38,18 +38,18 @@ #include "titanic/game/service_elevator_door.h" #include "titanic/game/sub_glass.h" -#include "titanic/messages/enter_bomb_room.h" -#include "titanic/messages/exit_arboretum.h" -#include "titanic/messages/exit_bridge.h" -#include "titanic/messages/exit_state_room.h" -#include "titanic/messages/move_player_in_parrot_room.h" -#include "titanic/messages/move_player_to.h" -#include "titanic/messages/move_player_to_from.h" -#include "titanic/messages/multi_move.h" -#include "titanic/messages/pan_from_pel.h" -#include "titanic/messages/restaurant_pan_handler.h" -#include "titanic/messages/restricted_move.h" -#include "titanic/messages/trip_down_canal.h" +#include "titanic/moves/enter_bomb_room.h" +#include "titanic/moves/exit_arboretum.h" +#include "titanic/moves/exit_bridge.h" +#include "titanic/moves/exit_state_room.h" +#include "titanic/moves/move_player_in_parrot_room.h" +#include "titanic/moves/move_player_to.h" +#include "titanic/moves/move_player_to_from.h" +#include "titanic/moves/multi_move.h" +#include "titanic/moves/pan_from_pel.h" +#include "titanic/moves/restaurant_pan_handler.h" +#include "titanic/moves/restricted_move.h" +#include "titanic/moves/trip_down_canal.h" #include "titanic/npcs/barbot.h" #include "titanic/npcs/bellbot.h" diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 66157be507..dcfe38c2d5 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -38,19 +38,19 @@ MODULE_OBJS := \ game/room_item.o \ game/service_elevator_door.o \ game/sub_glass.o \ - messages/enter_bomb_room.o \ - messages/exit_arboretum.o \ - messages/exit_bridge.o \ - messages/exit_state_room.o \ - messages/exit_titania.o \ - messages/move_player_in_parrot_room.o \ - messages/move_player_to_from.o \ - messages/move_player_to.o \ - messages/multi_move.o \ - messages/pan_from_pel.o \ - messages/restaurant_pan_handler.o \ - messages/restricted_move.o \ - messages/trip_down_canal.o \ + moves/enter_bomb_room.o \ + moves/exit_arboretum.o \ + moves/exit_bridge.o \ + moves/exit_state_room.o \ + moves/exit_titania.o \ + moves/move_player_in_parrot_room.o \ + moves/move_player_to_from.o \ + moves/move_player_to.o \ + moves/multi_move.o \ + moves/pan_from_pel.o \ + moves/restaurant_pan_handler.o \ + moves/restricted_move.o \ + moves/trip_down_canal.o \ npcs/barbot.o \ npcs/bellbot.o \ npcs/character.o \ diff --git a/engines/titanic/moves/enter_bomb_room.cpp b/engines/titanic/moves/enter_bomb_room.cpp index 049c3f45ae..e989d47114 100644 --- a/engines/titanic/moves/enter_bomb_room.cpp +++ b/engines/titanic/moves/enter_bomb_room.cpp @@ -20,7 +20,7 @@ * */ -#include "titanic/messages/enter_bomb_room.h" +#include "titanic/moves/enter_bomb_room.h" namespace Titanic { diff --git a/engines/titanic/moves/enter_bomb_room.h b/engines/titanic/moves/enter_bomb_room.h index 3ec5616db0..fc4d1360ec 100644 --- a/engines/titanic/moves/enter_bomb_room.h +++ b/engines/titanic/moves/enter_bomb_room.h @@ -23,7 +23,7 @@ #ifndef TITANIC_ENTER_BOMB_ROOM_H #define TITANIC_ENTER_BOMB_ROOM_H -#include "titanic/messages/move_player_to.h" +#include "titanic/moves/move_player_to.h" namespace Titanic { diff --git a/engines/titanic/moves/exit_arboretum.cpp b/engines/titanic/moves/exit_arboretum.cpp index 0a50377afb..2b5b497f5c 100644 --- a/engines/titanic/moves/exit_arboretum.cpp +++ b/engines/titanic/moves/exit_arboretum.cpp @@ -20,7 +20,7 @@ * */ -#include "titanic/messages/exit_arboretum.h" +#include "titanic/moves/exit_arboretum.h" namespace Titanic { diff --git a/engines/titanic/moves/exit_arboretum.h b/engines/titanic/moves/exit_arboretum.h index 4ee135e6bc..4e5815d284 100644 --- a/engines/titanic/moves/exit_arboretum.h +++ b/engines/titanic/moves/exit_arboretum.h @@ -23,7 +23,7 @@ #ifndef TITANIC_EXIT_ARBORETUM_H #define TITANIC_EXIT_ARBORETUM_H -#include "titanic/messages/move_player_to.h" +#include "titanic/moves/move_player_to.h" namespace Titanic { diff --git a/engines/titanic/moves/exit_bridge.cpp b/engines/titanic/moves/exit_bridge.cpp index 27f923bf11..99138f946e 100644 --- a/engines/titanic/moves/exit_bridge.cpp +++ b/engines/titanic/moves/exit_bridge.cpp @@ -20,7 +20,7 @@ * */ -#include "titanic/messages/exit_bridge.h" +#include "titanic/moves/exit_bridge.h" namespace Titanic { diff --git a/engines/titanic/moves/exit_bridge.h b/engines/titanic/moves/exit_bridge.h index 6d65a0028a..c85c1bcab7 100644 --- a/engines/titanic/moves/exit_bridge.h +++ b/engines/titanic/moves/exit_bridge.h @@ -23,7 +23,7 @@ #ifndef TITANIC_EXIT_BRIDGE_H #define TITANIC_EXIT_BRIDGE_H -#include "titanic/messages/move_player_to.h" +#include "titanic/moves/move_player_to.h" namespace Titanic { diff --git a/engines/titanic/moves/exit_state_room.cpp b/engines/titanic/moves/exit_state_room.cpp index f1acd910d8..0dc4a4f967 100644 --- a/engines/titanic/moves/exit_state_room.cpp +++ b/engines/titanic/moves/exit_state_room.cpp @@ -20,7 +20,7 @@ * */ -#include "titanic/messages/exit_state_room.h" +#include "titanic/moves/exit_state_room.h" namespace Titanic { diff --git a/engines/titanic/moves/exit_state_room.h b/engines/titanic/moves/exit_state_room.h index 12adcfba44..ecef4f1dc3 100644 --- a/engines/titanic/moves/exit_state_room.h +++ b/engines/titanic/moves/exit_state_room.h @@ -23,7 +23,7 @@ #ifndef TITANIC_EXIT_STATE_ROOM_H #define TITANIC_EXIT_STATE_ROOM_H -#include "titanic/messages/move_player_to.h" +#include "titanic/moves/move_player_to.h" namespace Titanic { diff --git a/engines/titanic/moves/exit_titania.cpp b/engines/titanic/moves/exit_titania.cpp index e94d0cd706..99585f56d9 100644 --- a/engines/titanic/moves/exit_titania.cpp +++ b/engines/titanic/moves/exit_titania.cpp @@ -20,7 +20,7 @@ * */ -#include "titanic/messages/exit_titania.h" +#include "titanic/moves/exit_titania.h" namespace Titanic { diff --git a/engines/titanic/moves/exit_titania.h b/engines/titanic/moves/exit_titania.h index 529886aee9..1d2226ae54 100644 --- a/engines/titanic/moves/exit_titania.h +++ b/engines/titanic/moves/exit_titania.h @@ -23,7 +23,7 @@ #ifndef TITANIC_EXIT_TITANIA_H #define TITANIC_EXIT_TITANIA_H -#include "titanic/messages/move_player_to.h" +#include "titanic/moves/move_player_to.h" namespace Titanic { diff --git a/engines/titanic/moves/move_player_in_parrot_room.cpp b/engines/titanic/moves/move_player_in_parrot_room.cpp index b1040bfb75..cfe4cb689f 100644 --- a/engines/titanic/moves/move_player_in_parrot_room.cpp +++ b/engines/titanic/moves/move_player_in_parrot_room.cpp @@ -20,7 +20,7 @@ * */ -#include "titanic/messages/move_player_in_parrot_room.h" +#include "titanic/moves/move_player_in_parrot_room.h" namespace Titanic { diff --git a/engines/titanic/moves/move_player_in_parrot_room.h b/engines/titanic/moves/move_player_in_parrot_room.h index f4e5779fd8..91f8b993a6 100644 --- a/engines/titanic/moves/move_player_in_parrot_room.h +++ b/engines/titanic/moves/move_player_in_parrot_room.h @@ -23,7 +23,7 @@ #ifndef TITANIC_MOVE_PLAYER_IN_PARROT_ROOM_H #define TITANIC_MOVE_PLAYER_IN_PARROT_ROOM_H -#include "titanic/messages/move_player_to.h" +#include "titanic/moves/move_player_to.h" namespace Titanic { diff --git a/engines/titanic/moves/move_player_to.cpp b/engines/titanic/moves/move_player_to.cpp index 66a71e8fa5..8ce8f77896 100644 --- a/engines/titanic/moves/move_player_to.cpp +++ b/engines/titanic/moves/move_player_to.cpp @@ -20,7 +20,7 @@ * */ -#include "titanic/messages/move_player_to.h" +#include "titanic/moves/move_player_to.h" namespace Titanic { diff --git a/engines/titanic/moves/move_player_to_from.cpp b/engines/titanic/moves/move_player_to_from.cpp index 77c74d5b50..f349c5c265 100644 --- a/engines/titanic/moves/move_player_to_from.cpp +++ b/engines/titanic/moves/move_player_to_from.cpp @@ -20,7 +20,7 @@ * */ -#include "titanic/messages/move_player_to_from.h" +#include "titanic/moves/move_player_to_from.h" namespace Titanic { diff --git a/engines/titanic/moves/multi_move.cpp b/engines/titanic/moves/multi_move.cpp index dd1948c435..6b35b88654 100644 --- a/engines/titanic/moves/multi_move.cpp +++ b/engines/titanic/moves/multi_move.cpp @@ -20,7 +20,7 @@ * */ -#include "titanic/messages/multi_move.h" +#include "titanic/moves/multi_move.h" namespace Titanic { diff --git a/engines/titanic/moves/multi_move.h b/engines/titanic/moves/multi_move.h index 2cc4f4e6bb..102b4b7473 100644 --- a/engines/titanic/moves/multi_move.h +++ b/engines/titanic/moves/multi_move.h @@ -23,7 +23,7 @@ #ifndef TITANIC_MULTI_MOVE_H #define TITANIC_MULTI_MOVE_H -#include "titanic/messages/move_player_to.h" +#include "titanic/moves/move_player_to.h" namespace Titanic { diff --git a/engines/titanic/moves/pan_from_pel.cpp b/engines/titanic/moves/pan_from_pel.cpp index 718927f9c7..db3c9bf49c 100644 --- a/engines/titanic/moves/pan_from_pel.cpp +++ b/engines/titanic/moves/pan_from_pel.cpp @@ -20,7 +20,7 @@ * */ -#include "titanic/messages/pan_from_pel.h" +#include "titanic/moves/pan_from_pel.h" namespace Titanic { diff --git a/engines/titanic/moves/pan_from_pel.h b/engines/titanic/moves/pan_from_pel.h index abb565c9ce..41f3fdb339 100644 --- a/engines/titanic/moves/pan_from_pel.h +++ b/engines/titanic/moves/pan_from_pel.h @@ -23,7 +23,7 @@ #ifndef TITANIC_PAN_FROM_PEL_H #define TITANIC_PAN_FROM_PEL_H -#include "titanic/messages/move_player_to.h" +#include "titanic/moves/move_player_to.h" namespace Titanic { diff --git a/engines/titanic/moves/restaurant_pan_handler.cpp b/engines/titanic/moves/restaurant_pan_handler.cpp index 14fd383cde..b2487a4cb1 100644 --- a/engines/titanic/moves/restaurant_pan_handler.cpp +++ b/engines/titanic/moves/restaurant_pan_handler.cpp @@ -20,7 +20,7 @@ * */ -#include "titanic/messages/restaurant_pan_handler.h" +#include "titanic/moves/restaurant_pan_handler.h" namespace Titanic { diff --git a/engines/titanic/moves/restaurant_pan_handler.h b/engines/titanic/moves/restaurant_pan_handler.h index dd757bef7c..f2f2c0cc9b 100644 --- a/engines/titanic/moves/restaurant_pan_handler.h +++ b/engines/titanic/moves/restaurant_pan_handler.h @@ -23,7 +23,7 @@ #ifndef TITANIC_RESTAURANT_PAN_HANDLER_H #define TITANIC_RESTAURANT_PAN_HANDLER_H -#include "titanic/messages/move_player_to.h" +#include "titanic/moves/move_player_to.h" namespace Titanic { diff --git a/engines/titanic/moves/restricted_move.cpp b/engines/titanic/moves/restricted_move.cpp index 147cf11c08..d6a046d30c 100644 --- a/engines/titanic/moves/restricted_move.cpp +++ b/engines/titanic/moves/restricted_move.cpp @@ -20,7 +20,7 @@ * */ -#include "titanic/messages/restricted_move.h" +#include "titanic/moves/restricted_move.h" namespace Titanic { diff --git a/engines/titanic/moves/restricted_move.h b/engines/titanic/moves/restricted_move.h index 5feae2985b..48ddefe9b8 100644 --- a/engines/titanic/moves/restricted_move.h +++ b/engines/titanic/moves/restricted_move.h @@ -23,7 +23,7 @@ #ifndef TITANIC_RESTRICTED_MOVE_H #define TITANIC_RESTRICTED_MOVE_H -#include "titanic/messages/move_player_to.h" +#include "titanic/moves/move_player_to.h" namespace Titanic { diff --git a/engines/titanic/moves/trip_down_canal.cpp b/engines/titanic/moves/trip_down_canal.cpp index be5f28321f..349a7e945c 100644 --- a/engines/titanic/moves/trip_down_canal.cpp +++ b/engines/titanic/moves/trip_down_canal.cpp @@ -20,7 +20,7 @@ * */ -#include "titanic/messages/trip_down_canal.h" +#include "titanic/moves/trip_down_canal.h" namespace Titanic { diff --git a/engines/titanic/moves/trip_down_canal.h b/engines/titanic/moves/trip_down_canal.h index 117ce94c12..0a5f918fb2 100644 --- a/engines/titanic/moves/trip_down_canal.h +++ b/engines/titanic/moves/trip_down_canal.h @@ -23,7 +23,7 @@ #ifndef TITANIC_TRIP_DOWN_CANAL_H #define TITANIC_TRIP_DOWN_CANAL_H -#include "titanic/messages/move_player_to.h" +#include "titanic/moves/move_player_to.h" namespace Titanic { -- cgit v1.2.3 From c5847f5b8093833edc5dc4c26bf239d462b9f2f1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 26 Feb 2016 00:16:25 -0500 Subject: TITANIC: Start of new messages sub-folder --- engines/titanic/core/auto_sound_event.cpp | 46 ----------------- engines/titanic/core/auto_sound_event.h | 55 --------------------- engines/titanic/core/saveable_object.cpp | 9 ++++ engines/titanic/core/tree_item.cpp | 2 + engines/titanic/game/door_auto_sound_event.h | 2 +- engines/titanic/messages/auto_sound_event.cpp | 46 +++++++++++++++++ engines/titanic/messages/auto_sound_event.h | 55 +++++++++++++++++++++ engines/titanic/messages/door_auto_sound_event.cpp | 51 +++++++++++++++++++ engines/titanic/messages/door_auto_sound_event.h | 57 ++++++++++++++++++++++ engines/titanic/module.mk | 4 +- 10 files changed, 223 insertions(+), 104 deletions(-) delete mode 100644 engines/titanic/core/auto_sound_event.cpp delete mode 100644 engines/titanic/core/auto_sound_event.h create mode 100644 engines/titanic/messages/auto_sound_event.cpp create mode 100644 engines/titanic/messages/auto_sound_event.h create mode 100644 engines/titanic/messages/door_auto_sound_event.cpp create mode 100644 engines/titanic/messages/door_auto_sound_event.h diff --git a/engines/titanic/core/auto_sound_event.cpp b/engines/titanic/core/auto_sound_event.cpp deleted file mode 100644 index 1bd5f5473a..0000000000 --- a/engines/titanic/core/auto_sound_event.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* 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 "titanic/core/auto_sound_event.h" - -namespace Titanic { - -CAutoSoundEvent::CAutoSoundEvent() : CGameObject(), _fieldBC(-1), _fieldC0(0xFFFFFF) { -} - -void CAutoSoundEvent::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldBC, indent); - file->writeNumberLine(_fieldC0, indent); - - CGameObject::save(file, indent); -} - -void CAutoSoundEvent::load(SimpleFile *file) { - file->readNumber(); - _fieldBC = file->readNumber(); - _fieldC0 = file->readNumber(); - - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/core/auto_sound_event.h b/engines/titanic/core/auto_sound_event.h deleted file mode 100644 index 4180a68aa2..0000000000 --- a/engines/titanic/core/auto_sound_event.h +++ /dev/null @@ -1,55 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_AUTO_SOUND_EVENT_H -#define TITANIC_AUTO_SOUND_EVENT_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CAutoSoundEvent : public CGameObject { -private: - int _fieldBC; - int _fieldC0; -public: - CAutoSoundEvent(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CAutoSoundEvent"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 080cdb6aa2..296ee6a9fe 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -38,6 +38,9 @@ #include "titanic/game/service_elevator_door.h" #include "titanic/game/sub_glass.h" +#include "titanic/messages/auto_sound_event.h" +#include "titanic/messages/door_auto_sound_event.h" + #include "titanic/moves/enter_bomb_room.h" #include "titanic/moves/exit_arboretum.h" #include "titanic/moves/exit_bridge.h" @@ -89,6 +92,9 @@ DEFFN(CRoomItem); DEFFN(CServiceElevatorDoor); DEFFN(CSUBGlass); +DEFFN(CAutoSoundEvent); +DEFFN(CDoorAutoSoundEvent); + DEFFN(CEnterBombRoom); DEFFN(CExitArboretum); DEFFN(CExitBridge); @@ -134,6 +140,9 @@ void CSaveableObject::initClassList() { ADDFN(CServiceElevatorDoor); ADDFN(CSUBGlass); + ADDFN(CAutoSoundEvent); + ADDFN(CDoorAutoSoundEvent); + ADDFN(CEnterBombRoom); ADDFN(CExitArboretum); ADDFN(CExitBridge); diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index d20e1da4f0..8c9080fd84 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -79,6 +79,8 @@ CDontSaveFileItem *CTreeItem::getDontSaveFileItem() { item = item->getNextSibling(); } + + return nullptr; } void CTreeItem::addUnder(CTreeItem *newParent) { diff --git a/engines/titanic/game/door_auto_sound_event.h b/engines/titanic/game/door_auto_sound_event.h index 66e9594b40..9bba304daa 100644 --- a/engines/titanic/game/door_auto_sound_event.h +++ b/engines/titanic/game/door_auto_sound_event.h @@ -23,7 +23,7 @@ #ifndef TITANIC_DOOR_AUTO_SOUND_EVENT_H #define TITANIC_DOOR_AUTO_SOUND_EVENT_H -#include "titanic/core/auto_sound_event.h" +#include "titanic/messages/auto_sound_event.h" namespace Titanic { diff --git a/engines/titanic/messages/auto_sound_event.cpp b/engines/titanic/messages/auto_sound_event.cpp new file mode 100644 index 0000000000..a9c8fc3dcd --- /dev/null +++ b/engines/titanic/messages/auto_sound_event.cpp @@ -0,0 +1,46 @@ +/* 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 "titanic/messages/auto_sound_event.h" + +namespace Titanic { + +CAutoSoundEvent::CAutoSoundEvent() : CGameObject(), _fieldBC(-1), _fieldC0(0xFFFFFF) { +} + +void CAutoSoundEvent::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + + CGameObject::save(file, indent); +} + +void CAutoSoundEvent::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/auto_sound_event.h b/engines/titanic/messages/auto_sound_event.h new file mode 100644 index 0000000000..f3a805c1e1 --- /dev/null +++ b/engines/titanic/messages/auto_sound_event.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_AUTO_SOUND_EVENT_H +#define TITANIC_AUTO_SOUND_EVENT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CAutoSoundEvent : public CGameObject { +protected: + int _fieldBC; + int _fieldC0; +public: + CAutoSoundEvent(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CAutoSoundEvent"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/messages/door_auto_sound_event.cpp b/engines/titanic/messages/door_auto_sound_event.cpp new file mode 100644 index 0000000000..69191a6576 --- /dev/null +++ b/engines/titanic/messages/door_auto_sound_event.cpp @@ -0,0 +1,51 @@ +/* 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 "titanic/messages/door_auto_sound_event.h" + +namespace Titanic { + +CDoorAutoSoundEvent::CDoorAutoSoundEvent() : CAutoSoundEvent(), + _string1("z#44.wav"), _string2("z#43.wav"), _fieldDC(25), _fieldE0(25) { +} + +void CDoorAutoSoundEvent::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + file->writeNumberLine(_fieldDC, indent); + file->writeNumberLine(_fieldE0, indent); + + CAutoSoundEvent::save(file, indent); +} + +void CDoorAutoSoundEvent::load(SimpleFile *file) { + file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + _fieldDC = file->readNumber(); + _fieldE0 = file->readNumber(); + + CAutoSoundEvent::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/door_auto_sound_event.h b/engines/titanic/messages/door_auto_sound_event.h new file mode 100644 index 0000000000..a231b2fa52 --- /dev/null +++ b/engines/titanic/messages/door_auto_sound_event.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_DOOR_AUTO_SOUND_EVENT_H +#define TITANIC_DOOR_AUTO_SOUND_EVENT_H + +#include "titanic/messages/auto_sound_event.h" + +namespace Titanic { + +class CDoorAutoSoundEvent : public CAutoSoundEvent { +private: + CString _string1; + CString _string2; + int _fieldDC; + int _fieldE0; +public: + CDoorAutoSoundEvent(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CDoorAutoSoundEvent"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DOOR_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index dcfe38c2d5..c012fc2269 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -15,7 +15,6 @@ MODULE_OBJS := \ string.o \ titanic.o \ video_surface.o \ - core/auto_sound_event.o \ core/background.o \ core/dont_save_file_item.o \ core/file_item.o \ @@ -33,11 +32,12 @@ MODULE_OBJS := \ core/tree_item.o \ core/view_item.o \ game/announce.o \ - game/door_auto_sound_event.o \ game/pet_position.o \ game/room_item.o \ game/service_elevator_door.o \ game/sub_glass.o \ + messages/auto_sound_event.o \ + messages/door_auto_sound_event.o \ moves/enter_bomb_room.o \ moves/exit_arboretum.o \ moves/exit_bridge.o \ -- cgit v1.2.3 From b08d0dd1304250143a5015db6dc1206d708bceca Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 26 Feb 2016 07:36:51 -0500 Subject: TITANIC: Added CTurnOnPlaySound and CTurnOnObject --- engines/titanic/core/saveable_object.cpp | 7 ++++ engines/titanic/core/turn_on_object.cpp | 44 +++++++++++++++++++++++ engines/titanic/core/turn_on_object.h | 54 ++++++++++++++++++++++++++++ engines/titanic/core/turn_on_play_sound.cpp | 49 +++++++++++++++++++++++++ engines/titanic/core/turn_on_play_sound.h | 56 +++++++++++++++++++++++++++++ engines/titanic/module.mk | 2 ++ 6 files changed, 212 insertions(+) create mode 100644 engines/titanic/core/turn_on_object.cpp create mode 100644 engines/titanic/core/turn_on_object.h create mode 100644 engines/titanic/core/turn_on_play_sound.cpp create mode 100644 engines/titanic/core/turn_on_play_sound.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 296ee6a9fe..6b6b439a72 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -30,8 +30,11 @@ #include "titanic/core/node_item.h" #include "titanic/core/project_item.h" #include "titanic/core/saveable_object.h" +#include "titanic/core/turn_on_object.h" +#include "titanic/core/turn_on_play_sound.h" #include "titanic/core/tree_item.h" #include "titanic/core/view_item.h" + #include "titanic/game/announce.h" #include "titanic/game/pet_position.h" #include "titanic/game/room_item.h" @@ -83,6 +86,8 @@ DEFFN(CMovieClip); DEFFN(CMovieClipList); DEFFN(CNodeItem); DEFFN(CProjectItem); +DEFFN(CTurnOnObject); +DEFFN(CTurnOnPlaySound); DEFFN(CTreeItem); DEFFN(CViewItem); @@ -132,6 +137,8 @@ void CSaveableObject::initClassList() { ADDFN(CNodeItem); ADDFN(CProjectItem); ADDFN(CTreeItem); + ADDFN(CTurnOnObject); + ADDFN(CTurnOnPlaySound); ADDFN(CViewItem); ADDFN(CAnnounce); diff --git a/engines/titanic/core/turn_on_object.cpp b/engines/titanic/core/turn_on_object.cpp new file mode 100644 index 0000000000..b4ed2b4525 --- /dev/null +++ b/engines/titanic/core/turn_on_object.cpp @@ -0,0 +1,44 @@ +/* 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 "titanic/core/turn_on_object.h" + +namespace Titanic { + +CTurnOnObject::CTurnOnObject() : CBackground(), _string3("NULL") { +} + +void CTurnOnObject::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string3, indent); + + CBackground::save(file, indent); +} + +void CTurnOnObject::load(SimpleFile *file) { + file->readNumber(); + _string3 = file->readString(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/core/turn_on_object.h b/engines/titanic/core/turn_on_object.h new file mode 100644 index 0000000000..a17d58e762 --- /dev/null +++ b/engines/titanic/core/turn_on_object.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_TURN_ON_OBJECT_H +#define TITANIC_TURN_ON_OBJECT_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CTurnOnObject : public CBackground { +protected: + CString _string3; +public: + CTurnOnObject(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CTurnOnObject"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TURN_ON_OBJECT_H */ diff --git a/engines/titanic/core/turn_on_play_sound.cpp b/engines/titanic/core/turn_on_play_sound.cpp new file mode 100644 index 0000000000..d56aef8bb7 --- /dev/null +++ b/engines/titanic/core/turn_on_play_sound.cpp @@ -0,0 +1,49 @@ +/* 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 "titanic/core/turn_on_play_sound.h" + +namespace Titanic { + +CTurnOnPlaySound::CTurnOnPlaySound() : CTurnOnObject(), + _string3("NULL"), _fieldF8(80), _fieldFC(0) { +} + +void CTurnOnPlaySound::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string3, indent); + file->writeNumberLine(_fieldF8, indent); + file->writeNumberLine(_fieldFC, indent); + + CTurnOnObject::save(file, indent); +} + +void CTurnOnPlaySound::load(SimpleFile *file) { + file->readNumber(); + _string3 = file->readString(); + _fieldF8 = file->readNumber(); + _fieldFC = file->readNumber(); + + CTurnOnObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/core/turn_on_play_sound.h b/engines/titanic/core/turn_on_play_sound.h new file mode 100644 index 0000000000..a0fc8eedfb --- /dev/null +++ b/engines/titanic/core/turn_on_play_sound.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_TURN_ON_PLAY_SOUND_H +#define TITANIC_TURN_ON_PLAY_SOUND_H + +#include "titanic/core/turn_on_object.h" + +namespace Titanic { + +class CTurnOnPlaySound : public CTurnOnObject { +private: + CString _string3; + int _fieldF8; + int _fieldFC; +public: + CTurnOnPlaySound(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CTurnOnPlaySound"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TURN_ON_PLAY_SOUND_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index c012fc2269..d4fcfd0300 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -29,6 +29,8 @@ MODULE_OBJS := \ core/project_item.o \ core/resource_key.o \ core/saveable_object.o \ + core/turn_on_object.o \ + core/turn_on_play_sound.o \ core/tree_item.o \ core/view_item.o \ game/announce.o \ -- cgit v1.2.3 From 16bcc6beba1b28c822c194aa35368e69b48f43cb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 26 Feb 2016 07:55:34 -0500 Subject: TITANIC: Implemented CCallBot --- engines/titanic/core/saveable_object.cpp | 3 ++ engines/titanic/module.mk | 1 + engines/titanic/npcs/callbot.cpp | 46 ++++++++++++++++++++++++++ engines/titanic/npcs/callbot.h | 55 ++++++++++++++++++++++++++++++++ 4 files changed, 105 insertions(+) create mode 100644 engines/titanic/npcs/callbot.cpp create mode 100644 engines/titanic/npcs/callbot.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 6b6b439a72..c154dde388 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -59,6 +59,7 @@ #include "titanic/npcs/barbot.h" #include "titanic/npcs/bellbot.h" +#include "titanic/npcs/callbot.h" #include "titanic/npcs/deskbot.h" #include "titanic/npcs/doorbot.h" #include "titanic/npcs/liftbot.h" @@ -115,6 +116,7 @@ DEFFN(CTripDownCanal); DEFFN(CBarbot); DEFFN(CBellBot); +DEFFN(CCallBot); DEFFN(CDeskbot); DEFFN(CDoorbot); DEFFN(CLiftBot); @@ -165,6 +167,7 @@ void CSaveableObject::initClassList() { ADDFN(CBarbot); ADDFN(CBellBot); + ADDFN(CCallBot); ADDFN(CDeskbot); ADDFN(CDoorbot); ADDFN(CMaitreD); diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index d4fcfd0300..12b07a68d3 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -55,6 +55,7 @@ MODULE_OBJS := \ moves/trip_down_canal.o \ npcs/barbot.o \ npcs/bellbot.o \ + npcs/callbot.o \ npcs/character.o \ npcs/deskbot.o \ npcs/doorbot.o \ diff --git a/engines/titanic/npcs/callbot.cpp b/engines/titanic/npcs/callbot.cpp new file mode 100644 index 0000000000..3fb7ee2f59 --- /dev/null +++ b/engines/titanic/npcs/callbot.cpp @@ -0,0 +1,46 @@ +/* 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 "titanic/npcs/callbot.h" + +namespace Titanic { + +CCallBot::CCallBot() : CGameObject(), _fieldC8(0) { +} + +void CCallBot::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string1, indent); + file->writeNumberLine(_fieldC8, indent); + + CGameObject::save(file, indent); +} + +void CCallBot::load(SimpleFile *file) { + file->readNumber(); + _string1 = file->readString(); + _fieldC8 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/npcs/callbot.h b/engines/titanic/npcs/callbot.h new file mode 100644 index 0000000000..2f9edd3734 --- /dev/null +++ b/engines/titanic/npcs/callbot.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_CALLBOT_H +#define TITANIC_CALLBOT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CCallBot : public CGameObject { +protected: + CString _string1; + int _fieldC8; +public: + CCallBot(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CCallBot"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CALLBOT_H */ -- cgit v1.2.3 From b361f2bf1484a54dd776f1b67cbd15037201348a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 26 Feb 2016 19:11:30 -0500 Subject: TITANIC: Implemented CAutoMusicPlayer and CSeasonalMusicPlayer --- engines/titanic/core/saveable_object.cpp | 6 +++ engines/titanic/module.mk | 5 +- engines/titanic/sound/auto_music_player.cpp | 44 ++++++++++++++++ engines/titanic/sound/auto_music_player.h | 54 +++++++++++++++++++ engines/titanic/sound/auto_music_player_base.cpp | 52 +++++++++++++++++++ engines/titanic/sound/auto_music_player_base.h | 58 +++++++++++++++++++++ engines/titanic/sound/seasonal_music_player.cpp | 66 ++++++++++++++++++++++++ engines/titanic/sound/seasonal_music_player.h | 61 ++++++++++++++++++++++ 8 files changed, 345 insertions(+), 1 deletion(-) create mode 100644 engines/titanic/sound/auto_music_player.cpp create mode 100644 engines/titanic/sound/auto_music_player.h create mode 100644 engines/titanic/sound/auto_music_player_base.cpp create mode 100644 engines/titanic/sound/auto_music_player_base.h create mode 100644 engines/titanic/sound/seasonal_music_player.cpp create mode 100644 engines/titanic/sound/seasonal_music_player.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index c154dde388..4eb905287e 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -70,6 +70,8 @@ #include "titanic/npcs/succubus.h" #include "titanic/npcs/titania.h" +#include "titanic/sound/auto_music_player.h" + namespace Titanic { Common::HashMap * @@ -127,6 +129,8 @@ DEFFN(CStarlings); DEFFN(CSuccUBus); DEFFN(CTitania); +DEFFN(CAutoMusicPlayer); + void CSaveableObject::initClassList() { _classList = new Common::HashMap(); ADDFN(CBackground); @@ -177,6 +181,8 @@ void CSaveableObject::initClassList() { ADDFN(CStarlings); ADDFN(CSuccUBus); ADDFN(CTitania); + + ADDFN(CAutoMusicPlayer); } void CSaveableObject::freeClassList() { diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 12b07a68d3..e1540c25ef 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -66,7 +66,10 @@ MODULE_OBJS := \ npcs/starlings.o \ npcs/succubus.o \ npcs/titania.o \ - npcs/true_talk_npc.o + npcs/true_talk_npc.o \ + sound/auto_music_player.o \ + sound/auto_music_player_base.o \ + sound/seasonal_music_player.o # This module can be built as a plugin ifeq ($(ENABLE_TITANIC), DYNAMIC_PLUGIN) diff --git a/engines/titanic/sound/auto_music_player.cpp b/engines/titanic/sound/auto_music_player.cpp new file mode 100644 index 0000000000..2040bfc20a --- /dev/null +++ b/engines/titanic/sound/auto_music_player.cpp @@ -0,0 +1,44 @@ +/* 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 "titanic/sound/auto_music_player.h" + +namespace Titanic { + +CAutoMusicPlayer::CAutoMusicPlayer() : CAutoMusicPlayerBase() { +} + +void CAutoMusicPlayer::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string2, indent); + + CAutoMusicPlayerBase::save(file, indent); +} + +void CAutoMusicPlayer::load(SimpleFile *file) { + file->readNumber(); + _string2 = file->readString(); + + CAutoMusicPlayerBase::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/sound/auto_music_player.h b/engines/titanic/sound/auto_music_player.h new file mode 100644 index 0000000000..11e46b0478 --- /dev/null +++ b/engines/titanic/sound/auto_music_player.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_AUTO_MUSIC_PLAYER_H +#define TITANIC_AUTO_MUSIC_PLAYER_H + +#include "titanic/sound/auto_music_player_base.h" + +namespace Titanic { + +class CAutoMusicPlayer : public CAutoMusicPlayerBase { +private: + CString _string2; +public: + CAutoMusicPlayer(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CAutoMusicPlayer"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_LINK_ITEM_H */ diff --git a/engines/titanic/sound/auto_music_player_base.cpp b/engines/titanic/sound/auto_music_player_base.cpp new file mode 100644 index 0000000000..116fcf7186 --- /dev/null +++ b/engines/titanic/sound/auto_music_player_base.cpp @@ -0,0 +1,52 @@ +/* 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 "titanic/sound/auto_music_player_base.h" + +namespace Titanic { + +CAutoMusicPlayerBase::CAutoMusicPlayerBase() : CGameObject(), + _fieldC8(1), _fieldCC(0), _fieldD0(-1), _fieldD4(1) { +} +void CAutoMusicPlayerBase::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string1, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeNumberLine(_fieldCC, indent); + file->writeNumberLine(_fieldD0, indent); + file->writeNumberLine(_fieldD4, indent); + + CGameObject::save(file, indent); +} + +void CAutoMusicPlayerBase::load(SimpleFile *file) { + file->readNumber(); + _string1 = file->readString(); + _fieldC8 = file->readNumber(); + _fieldCC = file->readNumber(); + _fieldD0 = file->readNumber(); + _fieldD4 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/sound/auto_music_player_base.h b/engines/titanic/sound/auto_music_player_base.h new file mode 100644 index 0000000000..66ffabb61c --- /dev/null +++ b/engines/titanic/sound/auto_music_player_base.h @@ -0,0 +1,58 @@ +/* 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. + * + */ + +#ifndef TITANIC_AUTO_MUSIC_PLAYER_BASE_H +#define TITANIC_AUTO_MUSIC_PLAYER_BASE_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CAutoMusicPlayerBase : public CGameObject { +protected: + CString _string1; + int _fieldC8; + int _fieldCC; + int _fieldD0; + int _fieldD4; +public: + CAutoMusicPlayerBase(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CAutoMusicPlayerBase"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_AUTO_MUSIC_PLAYER_BASE_H */ diff --git a/engines/titanic/sound/seasonal_music_player.cpp b/engines/titanic/sound/seasonal_music_player.cpp new file mode 100644 index 0000000000..c4a8f02f43 --- /dev/null +++ b/engines/titanic/sound/seasonal_music_player.cpp @@ -0,0 +1,66 @@ +/* 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 "titanic/sound/seasonal_music_player.h" + +namespace Titanic { + +CSeasonalMusicPlayer::CSeasonalMusicPlayer() : CAutoMusicPlayerBase() { + _fieldD8 = 0; + _fieldDC = 1; + _fieldE0 = 0; + _fieldE4 = 0; + _fieldE8 = -4; + _fieldEC = -2; + _fieldF0 = -4; + _fieldF4 = -4; +} + +void CSeasonalMusicPlayer::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldD8, indent); + file->writeNumberLine(_fieldDC, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_fieldEC, indent); + file->writeNumberLine(_fieldF0, indent); + file->writeNumberLine(_fieldF4, indent); + + CAutoMusicPlayerBase::save(file, indent); +} + +void CSeasonalMusicPlayer::load(SimpleFile *file) { + file->readNumber(); + _fieldD8 = file->readNumber(); + _fieldDC = file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + _fieldEC = file->readNumber(); + _fieldF0 = file->readNumber(); + _fieldF4 = file->readNumber(); + + CAutoMusicPlayerBase::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/sound/seasonal_music_player.h b/engines/titanic/sound/seasonal_music_player.h new file mode 100644 index 0000000000..fe3a60be9d --- /dev/null +++ b/engines/titanic/sound/seasonal_music_player.h @@ -0,0 +1,61 @@ +/* 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. + * + */ + +#ifndef TITANIC_SEASONAL_MUSIC_PLAYER_H +#define TITANIC_SEASONAL_MUSIC_PLAYER_H + +#include "titanic/sound/auto_music_player_base.h" + +namespace Titanic { + +class CSeasonalMusicPlayer : public CAutoMusicPlayerBase { +private: + int _fieldD8; + int _fieldDC; + int _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; + int _fieldF0; + int _fieldF4; +public: + CSeasonalMusicPlayer(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSeasonalMusicPlayer"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_LINK_ITEM_H */ -- cgit v1.2.3 From 1a98b49f607a9dcf133f54c0e133fb774def4a7c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 26 Feb 2016 19:27:56 -0500 Subject: TITANIC: Implement CSummonBots and CRobotController --- engines/titanic/core/saveable_object.cpp | 3 ++ engines/titanic/module.mk | 2 ++ engines/titanic/npcs/character.h | 2 +- engines/titanic/npcs/robot_controller.cpp | 44 ++++++++++++++++++++++++ engines/titanic/npcs/robot_controller.h | 54 +++++++++++++++++++++++++++++ engines/titanic/npcs/summon_bots.cpp | 49 +++++++++++++++++++++++++++ engines/titanic/npcs/summon_bots.h | 56 +++++++++++++++++++++++++++++++ 7 files changed, 209 insertions(+), 1 deletion(-) create mode 100644 engines/titanic/npcs/robot_controller.cpp create mode 100644 engines/titanic/npcs/robot_controller.h create mode 100644 engines/titanic/npcs/summon_bots.cpp create mode 100644 engines/titanic/npcs/summon_bots.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 4eb905287e..1cbae873db 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -68,6 +68,7 @@ #include "titanic/npcs/parrot.h" #include "titanic/npcs/starlings.h" #include "titanic/npcs/succubus.h" +#include "titanic/npcs/summon_bots.h" #include "titanic/npcs/titania.h" #include "titanic/sound/auto_music_player.h" @@ -126,6 +127,7 @@ DEFFN(CMaitreD); DEFFN(CMobile); DEFFN(CParrot); DEFFN(CStarlings); +DEFFN(CSummonBots); DEFFN(CSuccUBus); DEFFN(CTitania); @@ -180,6 +182,7 @@ void CSaveableObject::initClassList() { ADDFN(CParrot); ADDFN(CStarlings); ADDFN(CSuccUBus); + ADDFN(CSummonBots); ADDFN(CTitania); ADDFN(CAutoMusicPlayer); diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index e1540c25ef..fb24d5018d 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -63,8 +63,10 @@ MODULE_OBJS := \ npcs/maitre_d.o \ npcs/mobile.o \ npcs/parrot.o \ + npcs/robot_controller.o \ npcs/starlings.o \ npcs/succubus.o \ + npcs/summon_bots.o \ npcs/titania.o \ npcs/true_talk_npc.o \ sound/auto_music_player.o \ diff --git a/engines/titanic/npcs/character.h b/engines/titanic/npcs/character.h index 7f489d238f..8e1e87eb95 100644 --- a/engines/titanic/npcs/character.h +++ b/engines/titanic/npcs/character.h @@ -54,4 +54,4 @@ public: } // End of namespace Titanic -#endif /* TITANIC_SUCCUBUS_H */ +#endif /* TITANIC_CHARACTER_H */ diff --git a/engines/titanic/npcs/robot_controller.cpp b/engines/titanic/npcs/robot_controller.cpp new file mode 100644 index 0000000000..c6ef4222ef --- /dev/null +++ b/engines/titanic/npcs/robot_controller.cpp @@ -0,0 +1,44 @@ +/* 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 "titanic/npcs/robot_controller.h" + +namespace Titanic { + +CRobotController::CRobotController() : CGameObject(), _string1("BellBot") { +} + +void CRobotController::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string1, indent); + + CGameObject::save(file, indent); +} + +void CRobotController::load(SimpleFile *file) { + file->readNumber(); + _string1 = file->readString(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/npcs/robot_controller.h b/engines/titanic/npcs/robot_controller.h new file mode 100644 index 0000000000..876285e70d --- /dev/null +++ b/engines/titanic/npcs/robot_controller.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_ROBOT_CONTROLLER_H +#define TITANIC_ROBOT_CONTROLLER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CRobotController : public CGameObject { +protected: + CString _string1; +public: + CRobotController(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CRobotController"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ROBOT_CONTROLLER_H */ diff --git a/engines/titanic/npcs/summon_bots.cpp b/engines/titanic/npcs/summon_bots.cpp new file mode 100644 index 0000000000..661b3f0490 --- /dev/null +++ b/engines/titanic/npcs/summon_bots.cpp @@ -0,0 +1,49 @@ +/* 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 "titanic/npcs/summon_bots.h" + +namespace Titanic { + +CSummonBots::CSummonBots() : CRobotController(), _string2("NULL"), + _fieldC8(0), _fieldCC(0) { +} + +void CSummonBots::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeNumberLine(_fieldCC, indent); + file->writeQuotedLine(_string2, indent); + + CRobotController::save(file, indent); +} + +void CSummonBots::load(SimpleFile *file) { + file->readNumber(); + _fieldC8 = file->readNumber(); + _fieldCC = file->readNumber(); + _string2 = file->readString(); + + CRobotController::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/npcs/summon_bots.h b/engines/titanic/npcs/summon_bots.h new file mode 100644 index 0000000000..d525ff69f3 --- /dev/null +++ b/engines/titanic/npcs/summon_bots.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_SUMMON_BOTS_H +#define TITANIC_SUMMON_BOTS_H + +#include "titanic/npcs/robot_controller.h" + +namespace Titanic { + +class CSummonBots : public CRobotController { +protected: + CString _string2; + int _fieldC8; + int _fieldCC; +public: + CSummonBots(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSummonBots"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SUMMON_BOTS_H */ -- cgit v1.2.3 From 859c30a4e1129cc3d1b5d4e4a0660229a16dfd24 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 26 Feb 2016 19:45:30 -0500 Subject: TITANIC: Implemented CTelevision --- engines/titanic/core/saveable_object.cpp | 3 ++ engines/titanic/game/television.cpp | 72 ++++++++++++++++++++++++++++++++ engines/titanic/game/television.h | 65 ++++++++++++++++++++++++++++ engines/titanic/module.mk | 1 + 4 files changed, 141 insertions(+) create mode 100644 engines/titanic/game/television.cpp create mode 100644 engines/titanic/game/television.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 1cbae873db..a52b53da05 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -40,6 +40,7 @@ #include "titanic/game/room_item.h" #include "titanic/game/service_elevator_door.h" #include "titanic/game/sub_glass.h" +#include "titanic/game/television.h" #include "titanic/messages/auto_sound_event.h" #include "titanic/messages/door_auto_sound_event.h" @@ -100,6 +101,7 @@ DEFFN(CPETPosition); DEFFN(CRoomItem); DEFFN(CServiceElevatorDoor); DEFFN(CSUBGlass); +DEFFN(CTelevision); DEFFN(CAutoSoundEvent); DEFFN(CDoorAutoSoundEvent); @@ -154,6 +156,7 @@ void CSaveableObject::initClassList() { ADDFN(CRoomItem); ADDFN(CServiceElevatorDoor); ADDFN(CSUBGlass); + ADDFN(CTelevision); ADDFN(CAutoSoundEvent); ADDFN(CDoorAutoSoundEvent); diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp new file mode 100644 index 0000000000..4c6b38ad32 --- /dev/null +++ b/engines/titanic/game/television.cpp @@ -0,0 +1,72 @@ +/* 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 "titanic/game/television.h" + +namespace Titanic { + +int CTelevision::_v1; +int CTelevision::_v2; +int CTelevision::_v3; +int CTelevision::_v4; +int CTelevision::_v5; +int CTelevision::_v6; + +CTelevision::CTelevision() : CBackground(), _fieldE0(1), + _fieldE4(7), _fieldE8(0), _fieldEC(0), _fieldF0(0) { +} + +void CTelevision::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_v2, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_v3, indent); + file->writeNumberLine(_fieldEC, indent); + file->writeNumberLine(_v4, indent); + file->writeNumberLine(_fieldF0, indent); + file->writeNumberLine(_v5, indent); + file->writeNumberLine(_v6, indent); + + CBackground::save(file, indent); +} + +void CTelevision::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _v1 = file->readNumber(); + _fieldE4 = file->readNumber(); + _v2 = file->readNumber(); + _fieldE8 = file->readNumber(); + _v3 = file->readNumber(); + _fieldEC = file->readNumber(); + _v4 = file->readNumber(); + _fieldF0 = file->readNumber(); + _v5 = file->readNumber(); + _v6 = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/television.h b/engines/titanic/game/television.h new file mode 100644 index 0000000000..4f39d60b9f --- /dev/null +++ b/engines/titanic/game/television.h @@ -0,0 +1,65 @@ +/* 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. + * + */ + +#ifndef TITANIC_TELEVISION_H +#define TITANIC_TELEVISION_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CTelevision : public CBackground { +private: + static int _v1; + static int _v2; + static int _v3; + static int _v4; + static int _v5; + static int _v6; +private: + int _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; + int _fieldF0; +public: + CTelevision(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CTelevision"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TELEVISION_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index fb24d5018d..e28f0f3e1c 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -38,6 +38,7 @@ MODULE_OBJS := \ game/room_item.o \ game/service_elevator_door.o \ game/sub_glass.o \ + game/television.o \ messages/auto_sound_event.o \ messages/door_auto_sound_event.o \ moves/enter_bomb_room.o \ -- cgit v1.2.3 From 34ffd06c7896ec0b9c4874800a57d8003862c8c4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 26 Feb 2016 20:35:12 -0500 Subject: TITANIC: Implemented CSTButton class and descendents --- engines/titanic/core/saveable_object.cpp | 24 ++++++++++ engines/titanic/gfx/act_button.cpp | 40 +++++++++++++++++ engines/titanic/gfx/act_button.h | 52 ++++++++++++++++++++++ engines/titanic/gfx/changes_season_button.cpp | 40 +++++++++++++++++ engines/titanic/gfx/changes_season_button.h | 52 ++++++++++++++++++++++ engines/titanic/gfx/elevator_button.cpp | 40 +++++++++++++++++ engines/titanic/gfx/elevator_button.h | 52 ++++++++++++++++++++++ engines/titanic/gfx/move_object_button.cpp | 46 +++++++++++++++++++ engines/titanic/gfx/move_object_button.h | 55 +++++++++++++++++++++++ engines/titanic/gfx/slider_button.cpp | 51 ++++++++++++++++++++++ engines/titanic/gfx/slider_button.h | 57 ++++++++++++++++++++++++ engines/titanic/gfx/st_button.cpp | 63 +++++++++++++++++++++++++++ engines/titanic/gfx/st_button.h | 60 +++++++++++++++++++++++++ engines/titanic/gfx/status_change_button.cpp | 40 +++++++++++++++++ engines/titanic/gfx/status_change_button.h | 52 ++++++++++++++++++++++ engines/titanic/module.mk | 7 +++ 16 files changed, 731 insertions(+) create mode 100644 engines/titanic/gfx/act_button.cpp create mode 100644 engines/titanic/gfx/act_button.h create mode 100644 engines/titanic/gfx/changes_season_button.cpp create mode 100644 engines/titanic/gfx/changes_season_button.h create mode 100644 engines/titanic/gfx/elevator_button.cpp create mode 100644 engines/titanic/gfx/elevator_button.h create mode 100644 engines/titanic/gfx/move_object_button.cpp create mode 100644 engines/titanic/gfx/move_object_button.h create mode 100644 engines/titanic/gfx/slider_button.cpp create mode 100644 engines/titanic/gfx/slider_button.h create mode 100644 engines/titanic/gfx/st_button.cpp create mode 100644 engines/titanic/gfx/st_button.h create mode 100644 engines/titanic/gfx/status_change_button.cpp create mode 100644 engines/titanic/gfx/status_change_button.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index a52b53da05..e5fb365f08 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -42,6 +42,14 @@ #include "titanic/game/sub_glass.h" #include "titanic/game/television.h" +#include "titanic/gfx/act_button.h" +#include "titanic/gfx/changes_season_button.h" +#include "titanic/gfx/elevator_button.h" +#include "titanic/gfx/move_object_button.h" +#include "titanic/gfx/slider_button.h" +#include "titanic/gfx/st_button.h" +#include "titanic/gfx/status_change_button.h" + #include "titanic/messages/auto_sound_event.h" #include "titanic/messages/door_auto_sound_event.h" @@ -103,6 +111,14 @@ DEFFN(CServiceElevatorDoor); DEFFN(CSUBGlass); DEFFN(CTelevision); +DEFFN(CActButton); +DEFFN(CChangesSeasonButton); +DEFFN(CElevatorButton); +DEFFN(CMoveObjectButton); +DEFFN(CSliderButton); +DEFFN(CStatusChangeButton); +DEFFN(CSTButton); + DEFFN(CAutoSoundEvent); DEFFN(CDoorAutoSoundEvent); @@ -158,6 +174,14 @@ void CSaveableObject::initClassList() { ADDFN(CSUBGlass); ADDFN(CTelevision); + ADDFN(CActButton); + ADDFN(CChangesSeasonButton); + ADDFN(CElevatorButton); + ADDFN(CMoveObjectButton); + ADDFN(CSliderButton); + ADDFN(CStatusChangeButton); + ADDFN(CSTButton); + ADDFN(CAutoSoundEvent); ADDFN(CDoorAutoSoundEvent); diff --git a/engines/titanic/gfx/act_button.cpp b/engines/titanic/gfx/act_button.cpp new file mode 100644 index 0000000000..3e79a171c1 --- /dev/null +++ b/engines/titanic/gfx/act_button.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/gfx/act_button.h" + +namespace Titanic { + +CActButton::CActButton() : CSTButton() { +} + +void CActButton::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CSTButton::save(file, indent); +} + +void CActButton::load(SimpleFile *file) { + file->readNumber(); + CSTButton::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/act_button.h b/engines/titanic/gfx/act_button.h new file mode 100644 index 0000000000..0ae2d4d92e --- /dev/null +++ b/engines/titanic/gfx/act_button.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_ACT_BUTTON_H +#define TITANIC_ACT_BUTTON_H + +#include "titanic/gfx/st_button.h" + +namespace Titanic { + +class CActButton : public CSTButton { +public: + CActButton(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CActButton"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ACT_BUTTON_H */ diff --git a/engines/titanic/gfx/changes_season_button.cpp b/engines/titanic/gfx/changes_season_button.cpp new file mode 100644 index 0000000000..a5f6778815 --- /dev/null +++ b/engines/titanic/gfx/changes_season_button.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/gfx/changes_season_button.h" + +namespace Titanic { + +CChangesSeasonButton::CChangesSeasonButton() : CSTButton() { +} + +void CChangesSeasonButton::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CSTButton::save(file, indent); +} + +void CChangesSeasonButton::load(SimpleFile *file) { + file->readNumber(); + CSTButton::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/changes_season_button.h b/engines/titanic/gfx/changes_season_button.h new file mode 100644 index 0000000000..8a756341fd --- /dev/null +++ b/engines/titanic/gfx/changes_season_button.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_CHANGES_SEASON_BUTTON_H +#define TITANIC_CHANGES_SEASON_BUTTON_H + +#include "titanic/gfx/st_button.h" + +namespace Titanic { + +class CChangesSeasonButton : public CSTButton { +public: + CChangesSeasonButton(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CChangesSeasonButton"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CHANGES_SEASON_BUTTON_H */ diff --git a/engines/titanic/gfx/elevator_button.cpp b/engines/titanic/gfx/elevator_button.cpp new file mode 100644 index 0000000000..81c9598b03 --- /dev/null +++ b/engines/titanic/gfx/elevator_button.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/gfx/elevator_button.h" + +namespace Titanic { + +CElevatorButton::CElevatorButton() : CSTButton() { +} + +void CElevatorButton::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CSTButton::save(file, indent); +} + +void CElevatorButton::load(SimpleFile *file) { + file->readNumber(); + CSTButton::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/elevator_button.h b/engines/titanic/gfx/elevator_button.h new file mode 100644 index 0000000000..1090ea800a --- /dev/null +++ b/engines/titanic/gfx/elevator_button.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_ELEVATOR_BUTTON_H +#define TITANIC_ELEVATOR_BUTTON_H + +#include "titanic/gfx/st_button.h" + +namespace Titanic { + +class CElevatorButton : public CSTButton { +public: + CElevatorButton(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CElevatorButton"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ELEVATOR_BUTTON_H */ diff --git a/engines/titanic/gfx/move_object_button.cpp b/engines/titanic/gfx/move_object_button.cpp new file mode 100644 index 0000000000..4ab0825864 --- /dev/null +++ b/engines/titanic/gfx/move_object_button.cpp @@ -0,0 +1,46 @@ +/* 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 "titanic/gfx/move_object_button.h" + +namespace Titanic { + +CMoveObjectButton::CMoveObjectButton() : CSTButton(), _field11C(1) { +} + +void CMoveObjectButton::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writePoint(_pos1, indent); + file->writeNumberLine(_field11C, indent); + + CSTButton::save(file, indent); +} + +void CMoveObjectButton::load(SimpleFile *file) { + file->readNumber(); + _pos1 = file->readPoint(); + _field11C = file->readNumber(); + + CSTButton::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/move_object_button.h b/engines/titanic/gfx/move_object_button.h new file mode 100644 index 0000000000..b00ba7b00f --- /dev/null +++ b/engines/titanic/gfx/move_object_button.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_MOVE_OBJECT_BUTTON_H +#define TITANIC_MOVE_OBJECT_BUTTON_H + +#include "titanic/gfx/st_button.h" + +namespace Titanic { + +class CMoveObjectButton : public CSTButton { +private: + Common::Point _pos1; + int _field11C; +public: + CMoveObjectButton(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMoveObjectButton"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MOVE_OBJECT_BUTTON_H */ diff --git a/engines/titanic/gfx/slider_button.cpp b/engines/titanic/gfx/slider_button.cpp new file mode 100644 index 0000000000..bcd9adde57 --- /dev/null +++ b/engines/titanic/gfx/slider_button.cpp @@ -0,0 +1,51 @@ +/* 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 "titanic/gfx/slider_button.h" + +namespace Titanic { + +CSliderButton::CSliderButton() : CSTButton(), _field114(0), + _field118(0), _field11C(0) { +} + +void CSliderButton::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field114, indent); + file->writeNumberLine(_field118, indent); + file->writeNumberLine(_field11C, indent); + file->writePoint(_pos1, indent); + + CSTButton::save(file, indent); +} + +void CSliderButton::load(SimpleFile *file) { + file->readNumber(); + _field114 = file->readNumber(); + _field118 = file->readNumber(); + _field11C = file->readNumber(); + _pos1 = file->readPoint(); + + CSTButton::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/slider_button.h b/engines/titanic/gfx/slider_button.h new file mode 100644 index 0000000000..e39a5f8c41 --- /dev/null +++ b/engines/titanic/gfx/slider_button.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_SLIDER_BUTTON_H +#define TITANIC_SLIDER_BUTTON_H + +#include "titanic/gfx/st_button.h" + +namespace Titanic { + +class CSliderButton : public CSTButton { +private: + int _field114; + int _field118; + int _field11C; + Common::Point _pos1; +public: + CSliderButton(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSliderButton"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SLIDER_BUTTON_H */ diff --git a/engines/titanic/gfx/st_button.cpp b/engines/titanic/gfx/st_button.cpp new file mode 100644 index 0000000000..44aa5cb7c5 --- /dev/null +++ b/engines/titanic/gfx/st_button.cpp @@ -0,0 +1,63 @@ +/* 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 "titanic/gfx/st_button.h" + +namespace Titanic { + +CSTButton::CSTButton() : CBackground() { + _fieldE0 = 0; + _string3 = "NULL"; + _fieldF0 = 0; + _fieldF4 = 0; + _string4 = "NULL"; + _string5 = "NULL"; + _field110 = 0; +} + +void CSTButton::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeQuotedLine(_string3, indent); + file->writeNumberLine(_fieldF0, indent); + file->writeNumberLine(_fieldF4, indent); + file->writeQuotedLine(_string4, indent); + file->writeQuotedLine(_string5, indent); + file->writeNumberLine(_field110, indent); + + CBackground::save(file, indent); +} + +void CSTButton::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _string3 = file->readString(); + _fieldF0 = file->readNumber(); + _fieldF4 = file->readNumber(); + _string4 = file->readString(); + _string5 = file->readString(); + _field110 = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/st_button.h b/engines/titanic/gfx/st_button.h new file mode 100644 index 0000000000..39b3765848 --- /dev/null +++ b/engines/titanic/gfx/st_button.h @@ -0,0 +1,60 @@ +/* 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. + * + */ + +#ifndef TITANIC_ST_BUTTON_H +#define TITANIC_ST_BUTTON_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CSTButton : public CBackground { +private: + int _fieldE0; + CString _string3; + int _fieldF0; + int _fieldF4; + CString _string4; + CString _string5; + int _field110; +public: + CSTButton(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSTButton"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ST_BUTTON_H */ diff --git a/engines/titanic/gfx/status_change_button.cpp b/engines/titanic/gfx/status_change_button.cpp new file mode 100644 index 0000000000..36037a2564 --- /dev/null +++ b/engines/titanic/gfx/status_change_button.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/gfx/status_change_button.h" + +namespace Titanic { + +CStatusChangeButton::CStatusChangeButton() : CSTButton() { +} + +void CStatusChangeButton::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CSTButton::save(file, indent); +} + +void CStatusChangeButton::load(SimpleFile *file) { + file->readNumber(); + CSTButton::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/status_change_button.h b/engines/titanic/gfx/status_change_button.h new file mode 100644 index 0000000000..b3b41254b3 --- /dev/null +++ b/engines/titanic/gfx/status_change_button.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_STATUS_CHANGE_BUTTON_H +#define TITANIC_STATUS_CHANGE_BUTTON_H + +#include "titanic/gfx/st_button.h" + +namespace Titanic { + +class CStatusChangeButton : public CSTButton { +public: + CStatusChangeButton(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CStatusChangeButton"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STATUS_CHANGE_BUTTON_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index e28f0f3e1c..e91a60222c 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -39,6 +39,13 @@ MODULE_OBJS := \ game/service_elevator_door.o \ game/sub_glass.o \ game/television.o \ + gfx/act_button.o \ + gfx/changes_season_button.o \ + gfx/elevator_button.o \ + gfx/move_object_button.o \ + gfx/slider_button.o \ + gfx/st_button.o \ + gfx/status_change_button.o \ messages/auto_sound_event.o \ messages/door_auto_sound_event.o \ moves/enter_bomb_room.o \ -- cgit v1.2.3 From b7cd6be9ebacf5ff7d0ee2e9a5220397c00e6943 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 26 Feb 2016 21:41:30 -0500 Subject: TITANIC: Implemented CToggleSwitch and descendents --- engines/titanic/core/saveable_object.cpp | 72 +++++++++++++++++++++++++++- engines/titanic/gfx/chev_left_off.cpp | 40 ++++++++++++++++ engines/titanic/gfx/chev_left_off.h | 52 ++++++++++++++++++++ engines/titanic/gfx/chev_left_on.cpp | 40 ++++++++++++++++ engines/titanic/gfx/chev_left_on.h | 52 ++++++++++++++++++++ engines/titanic/gfx/chev_right_off.cpp | 40 ++++++++++++++++ engines/titanic/gfx/chev_right_off.h | 52 ++++++++++++++++++++ engines/titanic/gfx/chev_right_on.cpp | 40 ++++++++++++++++ engines/titanic/gfx/chev_right_on.h | 52 ++++++++++++++++++++ engines/titanic/gfx/chev_send_rec_switch.cpp | 40 ++++++++++++++++ engines/titanic/gfx/chev_send_rec_switch.h | 52 ++++++++++++++++++++ engines/titanic/gfx/chev_switch.cpp | 40 ++++++++++++++++ engines/titanic/gfx/chev_switch.h | 52 ++++++++++++++++++++ engines/titanic/gfx/get_from_succ.cpp | 40 ++++++++++++++++ engines/titanic/gfx/get_from_succ.h | 52 ++++++++++++++++++++ engines/titanic/gfx/helmet_on_off.cpp | 40 ++++++++++++++++ engines/titanic/gfx/helmet_on_off.h | 52 ++++++++++++++++++++ engines/titanic/gfx/home_photo.cpp | 40 ++++++++++++++++ engines/titanic/gfx/home_photo.h | 52 ++++++++++++++++++++ engines/titanic/gfx/icon_nav_action.cpp | 40 ++++++++++++++++ engines/titanic/gfx/icon_nav_action.h | 52 ++++++++++++++++++++ engines/titanic/gfx/icon_nav_down.cpp | 40 ++++++++++++++++ engines/titanic/gfx/icon_nav_down.h | 52 ++++++++++++++++++++ engines/titanic/gfx/icon_nav_left.cpp | 40 ++++++++++++++++ engines/titanic/gfx/icon_nav_left.h | 52 ++++++++++++++++++++ engines/titanic/gfx/icon_nav_right.cpp | 40 ++++++++++++++++ engines/titanic/gfx/icon_nav_right.h | 52 ++++++++++++++++++++ engines/titanic/gfx/icon_nav_up.cpp | 40 ++++++++++++++++ engines/titanic/gfx/icon_nav_up.h | 52 ++++++++++++++++++++ engines/titanic/gfx/keybrd_butt.cpp | 40 ++++++++++++++++ engines/titanic/gfx/keybrd_butt.h | 52 ++++++++++++++++++++ engines/titanic/gfx/pet_mode_off.cpp | 40 ++++++++++++++++ engines/titanic/gfx/pet_mode_off.h | 52 ++++++++++++++++++++ engines/titanic/gfx/pet_mode_on.cpp | 40 ++++++++++++++++ engines/titanic/gfx/pet_mode_on.h | 52 ++++++++++++++++++++ engines/titanic/gfx/pet_mode_panel.cpp | 40 ++++++++++++++++ engines/titanic/gfx/pet_mode_panel.h | 52 ++++++++++++++++++++ engines/titanic/gfx/send_to_succ.cpp | 40 ++++++++++++++++ engines/titanic/gfx/send_to_succ.h | 52 ++++++++++++++++++++ engines/titanic/gfx/small_chev_left_off.cpp | 40 ++++++++++++++++ engines/titanic/gfx/small_chev_left_off.h | 52 ++++++++++++++++++++ engines/titanic/gfx/small_chev_left_on.cpp | 40 ++++++++++++++++ engines/titanic/gfx/small_chev_left_on.h | 52 ++++++++++++++++++++ engines/titanic/gfx/small_chev_right_off.cpp | 40 ++++++++++++++++ engines/titanic/gfx/small_chev_right_off.h | 52 ++++++++++++++++++++ engines/titanic/gfx/small_chev_right_on.cpp | 40 ++++++++++++++++ engines/titanic/gfx/small_chev_right_on.h | 52 ++++++++++++++++++++ engines/titanic/gfx/toggle_switch.cpp | 46 ++++++++++++++++++ engines/titanic/gfx/toggle_switch.h | 55 +++++++++++++++++++++ engines/titanic/module.mk | 27 ++++++++++- 50 files changed, 2314 insertions(+), 2 deletions(-) create mode 100644 engines/titanic/gfx/chev_left_off.cpp create mode 100644 engines/titanic/gfx/chev_left_off.h create mode 100644 engines/titanic/gfx/chev_left_on.cpp create mode 100644 engines/titanic/gfx/chev_left_on.h create mode 100644 engines/titanic/gfx/chev_right_off.cpp create mode 100644 engines/titanic/gfx/chev_right_off.h create mode 100644 engines/titanic/gfx/chev_right_on.cpp create mode 100644 engines/titanic/gfx/chev_right_on.h create mode 100644 engines/titanic/gfx/chev_send_rec_switch.cpp create mode 100644 engines/titanic/gfx/chev_send_rec_switch.h create mode 100644 engines/titanic/gfx/chev_switch.cpp create mode 100644 engines/titanic/gfx/chev_switch.h create mode 100644 engines/titanic/gfx/get_from_succ.cpp create mode 100644 engines/titanic/gfx/get_from_succ.h create mode 100644 engines/titanic/gfx/helmet_on_off.cpp create mode 100644 engines/titanic/gfx/helmet_on_off.h create mode 100644 engines/titanic/gfx/home_photo.cpp create mode 100644 engines/titanic/gfx/home_photo.h create mode 100644 engines/titanic/gfx/icon_nav_action.cpp create mode 100644 engines/titanic/gfx/icon_nav_action.h create mode 100644 engines/titanic/gfx/icon_nav_down.cpp create mode 100644 engines/titanic/gfx/icon_nav_down.h create mode 100644 engines/titanic/gfx/icon_nav_left.cpp create mode 100644 engines/titanic/gfx/icon_nav_left.h create mode 100644 engines/titanic/gfx/icon_nav_right.cpp create mode 100644 engines/titanic/gfx/icon_nav_right.h create mode 100644 engines/titanic/gfx/icon_nav_up.cpp create mode 100644 engines/titanic/gfx/icon_nav_up.h create mode 100644 engines/titanic/gfx/keybrd_butt.cpp create mode 100644 engines/titanic/gfx/keybrd_butt.h create mode 100644 engines/titanic/gfx/pet_mode_off.cpp create mode 100644 engines/titanic/gfx/pet_mode_off.h create mode 100644 engines/titanic/gfx/pet_mode_on.cpp create mode 100644 engines/titanic/gfx/pet_mode_on.h create mode 100644 engines/titanic/gfx/pet_mode_panel.cpp create mode 100644 engines/titanic/gfx/pet_mode_panel.h create mode 100644 engines/titanic/gfx/send_to_succ.cpp create mode 100644 engines/titanic/gfx/send_to_succ.h create mode 100644 engines/titanic/gfx/small_chev_left_off.cpp create mode 100644 engines/titanic/gfx/small_chev_left_off.h create mode 100644 engines/titanic/gfx/small_chev_left_on.cpp create mode 100644 engines/titanic/gfx/small_chev_left_on.h create mode 100644 engines/titanic/gfx/small_chev_right_off.cpp create mode 100644 engines/titanic/gfx/small_chev_right_off.h create mode 100644 engines/titanic/gfx/small_chev_right_on.cpp create mode 100644 engines/titanic/gfx/small_chev_right_on.h create mode 100644 engines/titanic/gfx/toggle_switch.cpp create mode 100644 engines/titanic/gfx/toggle_switch.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index e5fb365f08..e87325a84d 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -44,11 +44,35 @@ #include "titanic/gfx/act_button.h" #include "titanic/gfx/changes_season_button.h" +#include "titanic/gfx/chev_left_off.h" +#include "titanic/gfx/chev_left_on.h" +#include "titanic/gfx/chev_right_off.h" +#include "titanic/gfx/chev_right_on.h" +#include "titanic/gfx/chev_send_rec_switch.h" +#include "titanic/gfx/chev_switch.h" #include "titanic/gfx/elevator_button.h" +#include "titanic/gfx/get_from_succ.h" +#include "titanic/gfx/helmet_on_off.h" +#include "titanic/gfx/home_photo.h" +#include "titanic/gfx/icon_nav_action.h" +#include "titanic/gfx/icon_nav_down.h" +#include "titanic/gfx/icon_nav_left.h" +#include "titanic/gfx/icon_nav_right.h" +#include "titanic/gfx/icon_nav_up.h" +#include "titanic/gfx/keybrd_butt.h" #include "titanic/gfx/move_object_button.h" +#include "titanic/gfx/pet_mode_off.h" +#include "titanic/gfx/pet_mode_on.h" +#include "titanic/gfx/pet_mode_panel.h" +#include "titanic/gfx/send_to_succ.h" #include "titanic/gfx/slider_button.h" -#include "titanic/gfx/st_button.h" +#include "titanic/gfx/small_chev_left_off.h" +#include "titanic/gfx/small_chev_left_on.h" +#include "titanic/gfx/small_chev_right_off.h" +#include "titanic/gfx/small_chev_right_on.h" #include "titanic/gfx/status_change_button.h" +#include "titanic/gfx/st_button.h" +#include "titanic/gfx/toggle_switch.h" #include "titanic/messages/auto_sound_event.h" #include "titanic/messages/door_auto_sound_event.h" @@ -113,9 +137,32 @@ DEFFN(CTelevision); DEFFN(CActButton); DEFFN(CChangesSeasonButton); +DEFFN(CChevLeftOff); +DEFFN(CChevLeftOn); +DEFFN(CChevRightOff); +DEFFN(CChevRightOn); +DEFFN(CChevSendRecSwitch); +DEFFN(CChevSwitch); DEFFN(CElevatorButton); +DEFFN(CGetFromSucc); +DEFFN(CHelmetOnOff); +DEFFN(CHomePhoto); +DEFFN(CIconNavAction); +DEFFN(CIconNavDown); +DEFFN(CIconNavLeft); +DEFFN(CIconNavRight); +DEFFN(CIconNavUp); +DEFFN(CKeybrdButt); DEFFN(CMoveObjectButton); +DEFFN(CPetModeOff); +DEFFN(CPetModeOn); +DEFFN(CPetModePanel); +DEFFN(CSendToSucc); DEFFN(CSliderButton); +DEFFN(CSmallChevLeftOff); +DEFFN(CSmallChevLeftOn); +DEFFN(CSmallChevRightOff); +DEFFN(CSmallChevRightOn); DEFFN(CStatusChangeButton); DEFFN(CSTButton); @@ -176,9 +223,32 @@ void CSaveableObject::initClassList() { ADDFN(CActButton); ADDFN(CChangesSeasonButton); + ADDFN(CChevLeftOff); + ADDFN(CChevLeftOn); + ADDFN(CChevRightOff); + ADDFN(CChevRightOn); + ADDFN(CChevSendRecSwitch); + ADDFN(CChevSwitch); ADDFN(CElevatorButton); + ADDFN(CGetFromSucc); + ADDFN(CHelmetOnOff); + ADDFN(CHomePhoto); + ADDFN(CIconNavAction); + ADDFN(CIconNavDown); + ADDFN(CIconNavLeft); + ADDFN(CIconNavRight); + ADDFN(CIconNavUp); + ADDFN(CKeybrdButt); ADDFN(CMoveObjectButton); + ADDFN(CPetModeOff); + ADDFN(CPetModeOn); + ADDFN(CPetModePanel); + ADDFN(CSendToSucc); ADDFN(CSliderButton); + ADDFN(CSmallChevLeftOff); + ADDFN(CSmallChevLeftOn); + ADDFN(CSmallChevRightOff); + ADDFN(CSmallChevRightOn); ADDFN(CStatusChangeButton); ADDFN(CSTButton); diff --git a/engines/titanic/gfx/chev_left_off.cpp b/engines/titanic/gfx/chev_left_off.cpp new file mode 100644 index 0000000000..736cc0d6c4 --- /dev/null +++ b/engines/titanic/gfx/chev_left_off.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/gfx/chev_left_off.h" + +namespace Titanic { + +CChevLeftOff::CChevLeftOff() : CToggleSwitch() { +} + +void CChevLeftOff::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CToggleSwitch::save(file, indent); +} + +void CChevLeftOff::load(SimpleFile *file) { + file->readNumber(); + CToggleSwitch::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/chev_left_off.h b/engines/titanic/gfx/chev_left_off.h new file mode 100644 index 0000000000..c3ea05dabc --- /dev/null +++ b/engines/titanic/gfx/chev_left_off.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_CHEV_LEFT_OFF_H +#define TITANIC_CHEV_LEFT_OFF_H + +#include "titanic/gfx/toggle_switch.h" + +namespace Titanic { + +class CChevLeftOff : public CToggleSwitch { +public: + CChevLeftOff(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CChevLeftOff"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CHEV_LEFT_OFF_H */ diff --git a/engines/titanic/gfx/chev_left_on.cpp b/engines/titanic/gfx/chev_left_on.cpp new file mode 100644 index 0000000000..f233c53a43 --- /dev/null +++ b/engines/titanic/gfx/chev_left_on.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/gfx/chev_left_on.h" + +namespace Titanic { + +CChevLeftOn::CChevLeftOn() : CToggleSwitch() { +} + +void CChevLeftOn::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CToggleSwitch::save(file, indent); +} + +void CChevLeftOn::load(SimpleFile *file) { + file->readNumber(); + CToggleSwitch::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/chev_left_on.h b/engines/titanic/gfx/chev_left_on.h new file mode 100644 index 0000000000..c2f23c30c7 --- /dev/null +++ b/engines/titanic/gfx/chev_left_on.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_CHEV_LEFT_ON_H +#define TITANIC_CHEV_LEFT_ON_H + +#include "titanic/gfx/toggle_switch.h" + +namespace Titanic { + +class CChevLeftOn : public CToggleSwitch { +public: + CChevLeftOn(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CChevLeftOn"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CHEV_LEFT_ON_H */ diff --git a/engines/titanic/gfx/chev_right_off.cpp b/engines/titanic/gfx/chev_right_off.cpp new file mode 100644 index 0000000000..7cf3b11d19 --- /dev/null +++ b/engines/titanic/gfx/chev_right_off.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/gfx/chev_right_off.h" + +namespace Titanic { + +CChevRightOff::CChevRightOff() : CToggleSwitch() { +} + +void CChevRightOff::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CToggleSwitch::save(file, indent); +} + +void CChevRightOff::load(SimpleFile *file) { + file->readNumber(); + CToggleSwitch::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/chev_right_off.h b/engines/titanic/gfx/chev_right_off.h new file mode 100644 index 0000000000..da28759abf --- /dev/null +++ b/engines/titanic/gfx/chev_right_off.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_CHEV_RIGHT_OFF_H +#define TITANIC_CHEV_RIGHT_OFF_H + +#include "titanic/gfx/toggle_switch.h" + +namespace Titanic { + +class CChevRightOff : public CToggleSwitch { +public: + CChevRightOff(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CChevRightOff"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CHEV_RIGHT_OFF_H */ diff --git a/engines/titanic/gfx/chev_right_on.cpp b/engines/titanic/gfx/chev_right_on.cpp new file mode 100644 index 0000000000..848abfc005 --- /dev/null +++ b/engines/titanic/gfx/chev_right_on.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/gfx/chev_right_on.h" + +namespace Titanic { + +CChevRightOn::CChevRightOn() : CToggleSwitch() { +} + +void CChevRightOn::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CToggleSwitch::save(file, indent); +} + +void CChevRightOn::load(SimpleFile *file) { + file->readNumber(); + CToggleSwitch::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/chev_right_on.h b/engines/titanic/gfx/chev_right_on.h new file mode 100644 index 0000000000..eb307c16f7 --- /dev/null +++ b/engines/titanic/gfx/chev_right_on.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_CHEV_RIGHT_ON_H +#define TITANIC_CHEV_RIGHT_ON_H + +#include "titanic/gfx/toggle_switch.h" + +namespace Titanic { + +class CChevRightOn : public CToggleSwitch { +public: + CChevRightOn(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CChevRightOn"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CHEV_RIGHT_ON_H */ diff --git a/engines/titanic/gfx/chev_send_rec_switch.cpp b/engines/titanic/gfx/chev_send_rec_switch.cpp new file mode 100644 index 0000000000..affe9bce8f --- /dev/null +++ b/engines/titanic/gfx/chev_send_rec_switch.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/gfx/chev_send_rec_switch.h" + +namespace Titanic { + +CChevSendRecSwitch::CChevSendRecSwitch() : CToggleSwitch() { +} + +void CChevSendRecSwitch::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CToggleSwitch::save(file, indent); +} + +void CChevSendRecSwitch::load(SimpleFile *file) { + file->readNumber(); + CToggleSwitch::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/chev_send_rec_switch.h b/engines/titanic/gfx/chev_send_rec_switch.h new file mode 100644 index 0000000000..8cd06e6ab0 --- /dev/null +++ b/engines/titanic/gfx/chev_send_rec_switch.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_CHEV_SEND_REC_SWITCH_H +#define TITANIC_CHEV_SEND_REC_SWITCH_H + +#include "titanic/gfx/toggle_switch.h" + +namespace Titanic { + +class CChevSendRecSwitch : public CToggleSwitch { +public: + CChevSendRecSwitch(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSendRecSwitch"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CHEV_SEND_REC_SWITCH_H */ diff --git a/engines/titanic/gfx/chev_switch.cpp b/engines/titanic/gfx/chev_switch.cpp new file mode 100644 index 0000000000..d7f1107c17 --- /dev/null +++ b/engines/titanic/gfx/chev_switch.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/gfx/chev_switch.h" + +namespace Titanic { + +CChevSwitch::CChevSwitch() : CToggleSwitch() { +} + +void CChevSwitch::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CToggleSwitch::save(file, indent); +} + +void CChevSwitch::load(SimpleFile *file) { + file->readNumber(); + CToggleSwitch::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/chev_switch.h b/engines/titanic/gfx/chev_switch.h new file mode 100644 index 0000000000..e7b43c3805 --- /dev/null +++ b/engines/titanic/gfx/chev_switch.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_CHEV_SWITCH_H +#define TITANIC_CHEV_SWITCH_H + +#include "titanic/gfx/toggle_switch.h" + +namespace Titanic { + +class CChevSwitch : public CToggleSwitch { +public: + CChevSwitch(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CChevSwitch"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CHEV_SWITCH_H */ diff --git a/engines/titanic/gfx/get_from_succ.cpp b/engines/titanic/gfx/get_from_succ.cpp new file mode 100644 index 0000000000..ad7b5dc2e8 --- /dev/null +++ b/engines/titanic/gfx/get_from_succ.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/gfx/get_from_succ.h" + +namespace Titanic { + +CGetFromSucc::CGetFromSucc() : CToggleSwitch() { +} + +void CGetFromSucc::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CToggleSwitch::save(file, indent); +} + +void CGetFromSucc::load(SimpleFile *file) { + file->readNumber(); + CToggleSwitch::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/get_from_succ.h b/engines/titanic/gfx/get_from_succ.h new file mode 100644 index 0000000000..810eb3117c --- /dev/null +++ b/engines/titanic/gfx/get_from_succ.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_GET_FROM_SUCC_H +#define TITANIC_GET_FROM_SUCC_H + +#include "titanic/gfx/toggle_switch.h" + +namespace Titanic { + +class CGetFromSucc : public CToggleSwitch { +public: + CGetFromSucc(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CGetFromSucc"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_GET_FROM_SUCC_H */ diff --git a/engines/titanic/gfx/helmet_on_off.cpp b/engines/titanic/gfx/helmet_on_off.cpp new file mode 100644 index 0000000000..e1c698932e --- /dev/null +++ b/engines/titanic/gfx/helmet_on_off.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/gfx/helmet_on_off.h" + +namespace Titanic { + +CHelmetOnOff::CHelmetOnOff() : CToggleSwitch() { +} + +void CHelmetOnOff::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CToggleSwitch::save(file, indent); +} + +void CHelmetOnOff::load(SimpleFile *file) { + file->readNumber(); + CToggleSwitch::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/helmet_on_off.h b/engines/titanic/gfx/helmet_on_off.h new file mode 100644 index 0000000000..839c2a533f --- /dev/null +++ b/engines/titanic/gfx/helmet_on_off.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_HELMET_ON_OFF_H +#define TITANIC_HELMET_ON_OFF_H + +#include "titanic/gfx/toggle_switch.h" + +namespace Titanic { + +class CHelmetOnOff : public CToggleSwitch { +public: + CHelmetOnOff(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CHelmetOnOff"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_HELMET_ON_OFF_H */ diff --git a/engines/titanic/gfx/home_photo.cpp b/engines/titanic/gfx/home_photo.cpp new file mode 100644 index 0000000000..48661fc70d --- /dev/null +++ b/engines/titanic/gfx/home_photo.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/gfx/home_photo.h" + +namespace Titanic { + +CHomePhoto::CHomePhoto() : CToggleSwitch() { +} + +void CHomePhoto::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CToggleSwitch::save(file, indent); +} + +void CHomePhoto::load(SimpleFile *file) { + file->readNumber(); + CToggleSwitch::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/home_photo.h b/engines/titanic/gfx/home_photo.h new file mode 100644 index 0000000000..f8ad297534 --- /dev/null +++ b/engines/titanic/gfx/home_photo.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_HOME_PHOTO_H +#define TITANIC_HOME_PHOTO_H + +#include "titanic/gfx/toggle_switch.h" + +namespace Titanic { + +class CHomePhoto : public CToggleSwitch { +public: + CHomePhoto(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CHomePhoto"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_HOME_PHOTO_H */ diff --git a/engines/titanic/gfx/icon_nav_action.cpp b/engines/titanic/gfx/icon_nav_action.cpp new file mode 100644 index 0000000000..f8aaa72396 --- /dev/null +++ b/engines/titanic/gfx/icon_nav_action.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/gfx/icon_nav_action.h" + +namespace Titanic { + +CIconNavAction::CIconNavAction() : CToggleSwitch() { +} + +void CIconNavAction::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CToggleSwitch::save(file, indent); +} + +void CIconNavAction::load(SimpleFile *file) { + file->readNumber(); + CToggleSwitch::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/icon_nav_action.h b/engines/titanic/gfx/icon_nav_action.h new file mode 100644 index 0000000000..812930bfdb --- /dev/null +++ b/engines/titanic/gfx/icon_nav_action.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_ICON_NAV_ACTION_H +#define TITANIC_ICON_NAV_ACTION_H + +#include "titanic/gfx/toggle_switch.h" + +namespace Titanic { + +class CIconNavAction : public CToggleSwitch { +public: + CIconNavAction(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CIconNavAction"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ICON_NAV_ACTION_H */ diff --git a/engines/titanic/gfx/icon_nav_down.cpp b/engines/titanic/gfx/icon_nav_down.cpp new file mode 100644 index 0000000000..947aa4c4f0 --- /dev/null +++ b/engines/titanic/gfx/icon_nav_down.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/gfx/icon_nav_down.h" + +namespace Titanic { + +CIconNavDown::CIconNavDown() : CToggleSwitch() { +} + +void CIconNavDown::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CToggleSwitch::save(file, indent); +} + +void CIconNavDown::load(SimpleFile *file) { + file->readNumber(); + CToggleSwitch::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/icon_nav_down.h b/engines/titanic/gfx/icon_nav_down.h new file mode 100644 index 0000000000..c6acfa04a3 --- /dev/null +++ b/engines/titanic/gfx/icon_nav_down.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_ICON_NAV_DOWN_H +#define TITANIC_ICON_NAV_DOWN_H + +#include "titanic/gfx/toggle_switch.h" + +namespace Titanic { + +class CIconNavDown : public CToggleSwitch { +public: + CIconNavDown(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CIconNavDown"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ICON_NAV_DOWN_H */ diff --git a/engines/titanic/gfx/icon_nav_left.cpp b/engines/titanic/gfx/icon_nav_left.cpp new file mode 100644 index 0000000000..5ec50904d2 --- /dev/null +++ b/engines/titanic/gfx/icon_nav_left.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/gfx/icon_nav_left.h" + +namespace Titanic { + +CIconNavLeft::CIconNavLeft() : CToggleSwitch() { +} + +void CIconNavLeft::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CToggleSwitch::save(file, indent); +} + +void CIconNavLeft::load(SimpleFile *file) { + file->readNumber(); + CToggleSwitch::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/icon_nav_left.h b/engines/titanic/gfx/icon_nav_left.h new file mode 100644 index 0000000000..006056babd --- /dev/null +++ b/engines/titanic/gfx/icon_nav_left.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_ICON_NAV_LEFT_H +#define TITANIC_ICON_NAV_LEFT_H + +#include "titanic/gfx/toggle_switch.h" + +namespace Titanic { + +class CIconNavLeft : public CToggleSwitch { +public: + CIconNavLeft(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CIconNavLeft"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ICON_NAV_LEFT_H */ diff --git a/engines/titanic/gfx/icon_nav_right.cpp b/engines/titanic/gfx/icon_nav_right.cpp new file mode 100644 index 0000000000..d133ed3b81 --- /dev/null +++ b/engines/titanic/gfx/icon_nav_right.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/gfx/icon_nav_right.h" + +namespace Titanic { + +CIconNavRight::CIconNavRight() : CToggleSwitch() { +} + +void CIconNavRight::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CToggleSwitch::save(file, indent); +} + +void CIconNavRight::load(SimpleFile *file) { + file->readNumber(); + CToggleSwitch::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/icon_nav_right.h b/engines/titanic/gfx/icon_nav_right.h new file mode 100644 index 0000000000..9f319d1065 --- /dev/null +++ b/engines/titanic/gfx/icon_nav_right.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_ICON_NAV_RIGHT_H +#define TITANIC_ICON_NAV_RIGHT_H + +#include "titanic/gfx/toggle_switch.h" + +namespace Titanic { + +class CIconNavRight : public CToggleSwitch { +public: + CIconNavRight(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CIconNavRight"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ICON_NAV_RIGHT_H */ diff --git a/engines/titanic/gfx/icon_nav_up.cpp b/engines/titanic/gfx/icon_nav_up.cpp new file mode 100644 index 0000000000..5b5d5ec9f0 --- /dev/null +++ b/engines/titanic/gfx/icon_nav_up.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/gfx/icon_nav_up.h" + +namespace Titanic { + +CIconNavUp::CIconNavUp() : CToggleSwitch() { +} + +void CIconNavUp::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CToggleSwitch::save(file, indent); +} + +void CIconNavUp::load(SimpleFile *file) { + file->readNumber(); + CToggleSwitch::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/icon_nav_up.h b/engines/titanic/gfx/icon_nav_up.h new file mode 100644 index 0000000000..010b6093a3 --- /dev/null +++ b/engines/titanic/gfx/icon_nav_up.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_ICON_NAV_UP_H +#define TITANIC_ICON_NAV_UP_H + +#include "titanic/gfx/toggle_switch.h" + +namespace Titanic { + +class CIconNavUp : public CToggleSwitch { +public: + CIconNavUp(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CIconNavUp"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ICON_NAV_UP_H */ diff --git a/engines/titanic/gfx/keybrd_butt.cpp b/engines/titanic/gfx/keybrd_butt.cpp new file mode 100644 index 0000000000..3e7f5c19de --- /dev/null +++ b/engines/titanic/gfx/keybrd_butt.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/gfx/keybrd_butt.h" + +namespace Titanic { + +CKeybrdButt::CKeybrdButt() : CToggleSwitch() { +} + +void CKeybrdButt::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CToggleSwitch::save(file, indent); +} + +void CKeybrdButt::load(SimpleFile *file) { + file->readNumber(); + CToggleSwitch::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/keybrd_butt.h b/engines/titanic/gfx/keybrd_butt.h new file mode 100644 index 0000000000..52fff7700f --- /dev/null +++ b/engines/titanic/gfx/keybrd_butt.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_KEYBRD_BUTT_H +#define TITANIC_KEYBRD_BUTT_H + +#include "titanic/gfx/toggle_switch.h" + +namespace Titanic { + +class CKeybrdButt : public CToggleSwitch { +public: + CKeybrdButt(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CKeybrdButt"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_KEYBRD_BUTT_H */ diff --git a/engines/titanic/gfx/pet_mode_off.cpp b/engines/titanic/gfx/pet_mode_off.cpp new file mode 100644 index 0000000000..d94ced085e --- /dev/null +++ b/engines/titanic/gfx/pet_mode_off.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/gfx/pet_mode_off.h" + +namespace Titanic { + +CPetModeOff::CPetModeOff() : CToggleSwitch() { +} + +void CPetModeOff::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CToggleSwitch::save(file, indent); +} + +void CPetModeOff::load(SimpleFile *file) { + file->readNumber(); + CToggleSwitch::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/pet_mode_off.h b/engines/titanic/gfx/pet_mode_off.h new file mode 100644 index 0000000000..45b1010e45 --- /dev/null +++ b/engines/titanic/gfx/pet_mode_off.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_MODE_OFF_H +#define TITANIC_PET_MODE_OFF_H + +#include "titanic/gfx/toggle_switch.h" + +namespace Titanic { + +class CPetModeOff : public CToggleSwitch { +public: + CPetModeOff(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPetModeOff"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_MODE_OFF_H */ diff --git a/engines/titanic/gfx/pet_mode_on.cpp b/engines/titanic/gfx/pet_mode_on.cpp new file mode 100644 index 0000000000..2de07455fa --- /dev/null +++ b/engines/titanic/gfx/pet_mode_on.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/gfx/pet_mode_on.h" + +namespace Titanic { + +CPetModeOn::CPetModeOn() : CToggleSwitch() { +} + +void CPetModeOn::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CToggleSwitch::save(file, indent); +} + +void CPetModeOn::load(SimpleFile *file) { + file->readNumber(); + CToggleSwitch::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/pet_mode_on.h b/engines/titanic/gfx/pet_mode_on.h new file mode 100644 index 0000000000..8ebfd8de3e --- /dev/null +++ b/engines/titanic/gfx/pet_mode_on.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_MODE_ON_H +#define TITANIC_PET_MODE_ON_H + +#include "titanic/gfx/toggle_switch.h" + +namespace Titanic { + +class CPetModeOn : public CToggleSwitch { +public: + CPetModeOn(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPetModeOn"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_MODE_ON_H */ diff --git a/engines/titanic/gfx/pet_mode_panel.cpp b/engines/titanic/gfx/pet_mode_panel.cpp new file mode 100644 index 0000000000..050cb768df --- /dev/null +++ b/engines/titanic/gfx/pet_mode_panel.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/gfx/pet_mode_panel.h" + +namespace Titanic { + +CPetModePanel::CPetModePanel() : CToggleSwitch() { +} + +void CPetModePanel::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CToggleSwitch::save(file, indent); +} + +void CPetModePanel::load(SimpleFile *file) { + file->readNumber(); + CToggleSwitch::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/pet_mode_panel.h b/engines/titanic/gfx/pet_mode_panel.h new file mode 100644 index 0000000000..3a394dfe05 --- /dev/null +++ b/engines/titanic/gfx/pet_mode_panel.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_MODE_PANEL_H +#define TITANIC_PET_MODE_PANEL_H + +#include "titanic/gfx/toggle_switch.h" + +namespace Titanic { + +class CPetModePanel : public CToggleSwitch { +public: + CPetModePanel(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPetModePanel"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_MODE_PANEL_H */ diff --git a/engines/titanic/gfx/send_to_succ.cpp b/engines/titanic/gfx/send_to_succ.cpp new file mode 100644 index 0000000000..82c923c045 --- /dev/null +++ b/engines/titanic/gfx/send_to_succ.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/gfx/send_to_succ.h" + +namespace Titanic { + +CSendToSucc::CSendToSucc() : CToggleSwitch() { +} + +void CSendToSucc::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CToggleSwitch::save(file, indent); +} + +void CSendToSucc::load(SimpleFile *file) { + file->readNumber(); + CToggleSwitch::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/send_to_succ.h b/engines/titanic/gfx/send_to_succ.h new file mode 100644 index 0000000000..971c2e7f3f --- /dev/null +++ b/engines/titanic/gfx/send_to_succ.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_SEND_TO_SUCC_H +#define TITANIC_SEND_TO_SUCC_H + +#include "titanic/gfx/toggle_switch.h" + +namespace Titanic { + +class CSendToSucc : public CToggleSwitch { +public: + CSendToSucc(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSendToSucc"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SEND_TO_SUCC_H */ diff --git a/engines/titanic/gfx/small_chev_left_off.cpp b/engines/titanic/gfx/small_chev_left_off.cpp new file mode 100644 index 0000000000..8614e336e1 --- /dev/null +++ b/engines/titanic/gfx/small_chev_left_off.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/gfx/small_chev_left_off.h" + +namespace Titanic { + +CSmallChevLeftOff::CSmallChevLeftOff() : CToggleSwitch() { +} + +void CSmallChevLeftOff::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CToggleSwitch::save(file, indent); +} + +void CSmallChevLeftOff::load(SimpleFile *file) { + file->readNumber(); + CToggleSwitch::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/small_chev_left_off.h b/engines/titanic/gfx/small_chev_left_off.h new file mode 100644 index 0000000000..bf73c7425b --- /dev/null +++ b/engines/titanic/gfx/small_chev_left_off.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_SMALL_CHEV_LEFT_OFF_H +#define TITANIC_SMALL_CHEV_LEFT_OFF_H + +#include "titanic/gfx/toggle_switch.h" + +namespace Titanic { + +class CSmallChevLeftOff : public CToggleSwitch { +public: + CSmallChevLeftOff(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSmallChevLeftOff"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SMALL_CHEV_LEFT_OFF_H */ diff --git a/engines/titanic/gfx/small_chev_left_on.cpp b/engines/titanic/gfx/small_chev_left_on.cpp new file mode 100644 index 0000000000..7f6a4ee3db --- /dev/null +++ b/engines/titanic/gfx/small_chev_left_on.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/gfx/small_chev_left_on.h" + +namespace Titanic { + +CSmallChevLeftOn::CSmallChevLeftOn() : CToggleSwitch() { +} + +void CSmallChevLeftOn::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CToggleSwitch::save(file, indent); +} + +void CSmallChevLeftOn::load(SimpleFile *file) { + file->readNumber(); + CToggleSwitch::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/small_chev_left_on.h b/engines/titanic/gfx/small_chev_left_on.h new file mode 100644 index 0000000000..c98108bec1 --- /dev/null +++ b/engines/titanic/gfx/small_chev_left_on.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_SMALL_CHEV_LEFT_ON_H +#define TITANIC_SMALL_CHEV_LEFT_ON_H + +#include "titanic/gfx/toggle_switch.h" + +namespace Titanic { + +class CSmallChevLeftOn : public CToggleSwitch { +public: + CSmallChevLeftOn(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSmallChevLeftOn"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SMALL_CHEV_LEFT_ON_H */ diff --git a/engines/titanic/gfx/small_chev_right_off.cpp b/engines/titanic/gfx/small_chev_right_off.cpp new file mode 100644 index 0000000000..1a3051bb4d --- /dev/null +++ b/engines/titanic/gfx/small_chev_right_off.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/gfx/small_chev_right_off.h" + +namespace Titanic { + +CSmallChevRightOff::CSmallChevRightOff() : CToggleSwitch() { +} + +void CSmallChevRightOff::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CToggleSwitch::save(file, indent); +} + +void CSmallChevRightOff::load(SimpleFile *file) { + file->readNumber(); + CToggleSwitch::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/small_chev_right_off.h b/engines/titanic/gfx/small_chev_right_off.h new file mode 100644 index 0000000000..5a6f3cc3ce --- /dev/null +++ b/engines/titanic/gfx/small_chev_right_off.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_SMALL_CHEV_RIGHT_OFF_H +#define TITANIC_SMALL_CHEV_RIGHT_OFF_H + +#include "titanic/gfx/toggle_switch.h" + +namespace Titanic { + +class CSmallChevRightOff : public CToggleSwitch { +public: + CSmallChevRightOff(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSmallChevRightOff"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SMALL_CHEV_RIGHT_OFF_H */ diff --git a/engines/titanic/gfx/small_chev_right_on.cpp b/engines/titanic/gfx/small_chev_right_on.cpp new file mode 100644 index 0000000000..714b6b314b --- /dev/null +++ b/engines/titanic/gfx/small_chev_right_on.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/gfx/small_chev_right_on.h" + +namespace Titanic { + +CSmallChevRightOn::CSmallChevRightOn() : CToggleSwitch() { +} + +void CSmallChevRightOn::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CToggleSwitch::save(file, indent); +} + +void CSmallChevRightOn::load(SimpleFile *file) { + file->readNumber(); + CToggleSwitch::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/small_chev_right_on.h b/engines/titanic/gfx/small_chev_right_on.h new file mode 100644 index 0000000000..f0100109f2 --- /dev/null +++ b/engines/titanic/gfx/small_chev_right_on.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_SMALL_CHEV_RIGHT_ON_H +#define TITANIC_SMALL_CHEV_RIGHT_ON_H + +#include "titanic/gfx/toggle_switch.h" + +namespace Titanic { + +class CSmallChevRightOn : public CToggleSwitch { +public: + CSmallChevRightOn(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSmallChevRightOn"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SMALL_CHEV_RIGHT_ON_H */ diff --git a/engines/titanic/gfx/toggle_switch.cpp b/engines/titanic/gfx/toggle_switch.cpp new file mode 100644 index 0000000000..330714693f --- /dev/null +++ b/engines/titanic/gfx/toggle_switch.cpp @@ -0,0 +1,46 @@ +/* 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 "titanic/gfx/toggle_switch.h" + +namespace Titanic { + +CToggleSwitch::CToggleSwitch() : CGameObject(), _fieldBC(0) { +} + +void CToggleSwitch::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writePoint(_pos1, indent); + + CGameObject::save(file, indent); +} + +void CToggleSwitch::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _pos1 = file->readPoint(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/toggle_switch.h b/engines/titanic/gfx/toggle_switch.h new file mode 100644 index 0000000000..977661df53 --- /dev/null +++ b/engines/titanic/gfx/toggle_switch.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_TOGGLE_SWITCH_H +#define TITANIC_TOGGLE_SWITCH_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CToggleSwitch : public CGameObject { +private: + int _fieldBC; + Common::Point _pos1; +public: + CToggleSwitch(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CToggleSwitch"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TOGGLE_SWITCH_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index e91a60222c..d8d87f0b8d 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -41,11 +41,35 @@ MODULE_OBJS := \ game/television.o \ gfx/act_button.o \ gfx/changes_season_button.o \ + gfx/chev_left_off.o \ + gfx/chev_left_on.o \ + gfx/chev_right_off.o \ + gfx/chev_right_on.o \ + gfx/chev_send_rec_switch.o \ + gfx/chev_switch.o \ gfx/elevator_button.o \ + gfx/get_from_succ.o \ + gfx/helmet_on_off.o \ + gfx/home_photo.o \ + gfx/icon_nav_action.o \ + gfx/icon_nav_down.o \ + gfx/icon_nav_left.o \ + gfx/icon_nav_right.o \ + gfx/icon_nav_up.o \ + gfx/keybrd_butt.o \ gfx/move_object_button.o \ + gfx/pet_mode_off.o \ + gfx/pet_mode_on.o \ + gfx/pet_mode_panel.o \ + gfx/send_to_succ.o \ gfx/slider_button.o \ - gfx/st_button.o \ + gfx/small_chev_left_off.o \ + gfx/small_chev_left_on.o \ + gfx/small_chev_right_off.o \ + gfx/small_chev_right_on.o \ gfx/status_change_button.o \ + gfx/st_button.o \ + gfx/toggle_switch.o \ messages/auto_sound_event.o \ messages/door_auto_sound_event.o \ moves/enter_bomb_room.o \ @@ -88,3 +112,4 @@ endif # Include common rules include $(srcdir)/rules.mk + -- cgit v1.2.3 From bc3e04400843615a77fd8df5a911070350f2323e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 26 Feb 2016 22:08:54 -0500 Subject: TITANIC: Implemented CStartAction and CHammerDispensorButton --- engines/titanic/core/saveable_object.cpp | 6 +++ engines/titanic/game/door_auto_sound_event.cpp | 51 -------------------- engines/titanic/game/door_auto_sound_event.h | 57 ---------------------- engines/titanic/game/hammer_dispensor_button.cpp | 56 ++++++++++++++++++++++ engines/titanic/game/hammer_dispensor_button.h | 60 ++++++++++++++++++++++++ engines/titanic/game/service_elevator_door.h | 2 +- engines/titanic/game/start_action.cpp | 46 ++++++++++++++++++ engines/titanic/game/start_action.h | 55 ++++++++++++++++++++++ engines/titanic/messages/door_auto_sound_event.h | 2 +- engines/titanic/module.mk | 2 + 10 files changed, 227 insertions(+), 110 deletions(-) delete mode 100644 engines/titanic/game/door_auto_sound_event.cpp delete mode 100644 engines/titanic/game/door_auto_sound_event.h create mode 100644 engines/titanic/game/hammer_dispensor_button.cpp create mode 100644 engines/titanic/game/hammer_dispensor_button.h create mode 100644 engines/titanic/game/start_action.cpp create mode 100644 engines/titanic/game/start_action.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index e87325a84d..966e441050 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -36,9 +36,11 @@ #include "titanic/core/view_item.h" #include "titanic/game/announce.h" +#include "titanic/game/hammer_dispensor_button.h" #include "titanic/game/pet_position.h" #include "titanic/game/room_item.h" #include "titanic/game/service_elevator_door.h" +#include "titanic/game/start_action.h" #include "titanic/game/sub_glass.h" #include "titanic/game/television.h" @@ -129,9 +131,11 @@ DEFFN(CTreeItem); DEFFN(CViewItem); DEFFN(CAnnounce); +DEFFN(CHammerDispensorButton); DEFFN(CPETPosition); DEFFN(CRoomItem); DEFFN(CServiceElevatorDoor); +DEFFN(CStartAction); DEFFN(CSUBGlass); DEFFN(CTelevision); @@ -215,9 +219,11 @@ void CSaveableObject::initClassList() { ADDFN(CViewItem); ADDFN(CAnnounce); + ADDFN(CHammerDispensorButton); ADDFN(CPETPosition); ADDFN(CRoomItem); ADDFN(CServiceElevatorDoor); + ADDFN(CStartAction); ADDFN(CSUBGlass); ADDFN(CTelevision); diff --git a/engines/titanic/game/door_auto_sound_event.cpp b/engines/titanic/game/door_auto_sound_event.cpp deleted file mode 100644 index 158c147296..0000000000 --- a/engines/titanic/game/door_auto_sound_event.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* 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 "titanic/game/door_auto_sound_event.h" - -namespace Titanic { - -CDoorAutoSoundEvent::CDoorAutoSoundEvent() : CAutoSoundEvent(), - _string1("z#44.wav"), _string2("z#43.wav"), _fieldDC(25), _fieldE0(25) { -} - -void CDoorAutoSoundEvent::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeQuotedLine(_string1, indent); - file->writeQuotedLine(_string2, indent); - file->writeNumberLine(_fieldDC, indent); - file->writeNumberLine(_fieldE0, indent); - - CAutoSoundEvent::save(file, indent); -} - -void CDoorAutoSoundEvent::load(SimpleFile *file) { - file->readNumber(); - _string1 = file->readString(); - _string2 = file->readString(); - _fieldDC = file->readNumber(); - _fieldE0 = file->readNumber(); - - CAutoSoundEvent::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/door_auto_sound_event.h b/engines/titanic/game/door_auto_sound_event.h deleted file mode 100644 index 9bba304daa..0000000000 --- a/engines/titanic/game/door_auto_sound_event.h +++ /dev/null @@ -1,57 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_DOOR_AUTO_SOUND_EVENT_H -#define TITANIC_DOOR_AUTO_SOUND_EVENT_H - -#include "titanic/messages/auto_sound_event.h" - -namespace Titanic { - -class CDoorAutoSoundEvent : public CAutoSoundEvent { -protected: - CString _string1; - CString _string2; - int _fieldDC; - int _fieldE0; -public: - CDoorAutoSoundEvent(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CDoorAutoSoundEvent"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_DOOR_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/game/hammer_dispensor_button.cpp b/engines/titanic/game/hammer_dispensor_button.cpp new file mode 100644 index 0000000000..eb9fa3845b --- /dev/null +++ b/engines/titanic/game/hammer_dispensor_button.cpp @@ -0,0 +1,56 @@ +/* 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 "titanic/game/hammer_dispensor_button.h" + +namespace Titanic { + +CHammerDispensorButton::CHammerDispensorButton() : CStartAction(), + _fieldF8(0), _fieldFC(0), _field100(0), _field104(56), + _field108(6), _field10C(0), _field110(0) { +} + +void CHammerDispensorButton::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldF8, indent); + file->writeNumberLine(_fieldFC, indent); + file->writeNumberLine(_field100, indent); + file->writeNumberLine(_field104, indent); + file->writeNumberLine(_field108, indent); + file->writeNumberLine(_field110, indent); + + CStartAction::save(file, indent); +} + +void CHammerDispensorButton::load(SimpleFile *file) { + file->readNumber(); + _fieldF8 = file->readNumber(); + _fieldFC = file->readNumber(); + _field100 = file->readNumber(); + _field104 = file->readNumber(); + _field108 = file->readNumber(); + _field110 = file->readNumber(); + + CStartAction::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/hammer_dispensor_button.h b/engines/titanic/game/hammer_dispensor_button.h new file mode 100644 index 0000000000..e4b5fc13b1 --- /dev/null +++ b/engines/titanic/game/hammer_dispensor_button.h @@ -0,0 +1,60 @@ +/* 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. + * + */ + +#ifndef TITANIC_HAMMER_DISPENSOR_H +#define TITANIC_HAMMER_DISPENSOR_H + +#include "titanic/game/start_action.h" + +namespace Titanic { + +class CHammerDispensorButton : public CStartAction { +private: + int _fieldF8; + int _fieldFC; + int _field100; + int _field104; + int _field108; + int _field10C; + int _field110; +public: + CHammerDispensorButton(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CHammerDispensorButton"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_HAMMER_DISPENSOR_H */ diff --git a/engines/titanic/game/service_elevator_door.h b/engines/titanic/game/service_elevator_door.h index 3ad897c089..a3a8388405 100644 --- a/engines/titanic/game/service_elevator_door.h +++ b/engines/titanic/game/service_elevator_door.h @@ -23,7 +23,7 @@ #ifndef TITANIC_SERVICE_ELEVATOR_DOOR_H #define TITANIC_SERVICE_ELEVATOR_DOOR_H -#include "titanic/game/door_auto_sound_event.h" +#include "titanic/messages/door_auto_sound_event.h" namespace Titanic { diff --git a/engines/titanic/game/start_action.cpp b/engines/titanic/game/start_action.cpp new file mode 100644 index 0000000000..9bafd01282 --- /dev/null +++ b/engines/titanic/game/start_action.cpp @@ -0,0 +1,46 @@ +/* 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 "titanic/game/start_action.h" + +namespace Titanic { + +CStartAction::CStartAction() : CBackground() { +} + +void CStartAction::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string3, indent); + file->writeQuotedLine(_string4, indent); + + CBackground::save(file, indent); +} + +void CStartAction::load(SimpleFile *file) { + file->readNumber(); + _string3 = file->readString(); + _string4 = file->readString(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/start_action.h b/engines/titanic/game/start_action.h new file mode 100644 index 0000000000..3725dbc4a0 --- /dev/null +++ b/engines/titanic/game/start_action.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_START_ACTION_H +#define TITANIC_START_ACTION_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CStartAction : public CBackground { +protected: + CString _string3; + CString _string4; +public: + CStartAction(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CStartAction"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_START_ACTION_H */ diff --git a/engines/titanic/messages/door_auto_sound_event.h b/engines/titanic/messages/door_auto_sound_event.h index a231b2fa52..9bba304daa 100644 --- a/engines/titanic/messages/door_auto_sound_event.h +++ b/engines/titanic/messages/door_auto_sound_event.h @@ -28,7 +28,7 @@ namespace Titanic { class CDoorAutoSoundEvent : public CAutoSoundEvent { -private: +protected: CString _string1; CString _string2; int _fieldDC; diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index d8d87f0b8d..e10fe31e42 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -34,9 +34,11 @@ MODULE_OBJS := \ core/tree_item.o \ core/view_item.o \ game/announce.o \ + game/hammer_dispensor_button.o \ game/pet_position.o \ game/room_item.o \ game/service_elevator_door.o \ + game/start_action.o \ game/sub_glass.o \ game/television.o \ gfx/act_button.o \ -- cgit v1.2.3 From 405c1d97330a1f158bdc5c472ff1bf778542fb5a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 26 Feb 2016 22:15:08 -0500 Subject: TITANIC: Implemented CDeadArea --- engines/titanic/core/saveable_object.cpp | 3 ++ engines/titanic/game/dead_area.cpp | 40 ++++++++++++++++++++++++ engines/titanic/game/dead_area.h | 52 ++++++++++++++++++++++++++++++++ engines/titanic/module.mk | 1 + 4 files changed, 96 insertions(+) create mode 100644 engines/titanic/game/dead_area.cpp create mode 100644 engines/titanic/game/dead_area.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 966e441050..7451852520 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -36,6 +36,7 @@ #include "titanic/core/view_item.h" #include "titanic/game/announce.h" +#include "titanic/game/dead_area.h" #include "titanic/game/hammer_dispensor_button.h" #include "titanic/game/pet_position.h" #include "titanic/game/room_item.h" @@ -131,6 +132,7 @@ DEFFN(CTreeItem); DEFFN(CViewItem); DEFFN(CAnnounce); +DEFFN(CDeadArea); DEFFN(CHammerDispensorButton); DEFFN(CPETPosition); DEFFN(CRoomItem); @@ -219,6 +221,7 @@ void CSaveableObject::initClassList() { ADDFN(CViewItem); ADDFN(CAnnounce); + ADDFN(CDeadArea); ADDFN(CHammerDispensorButton); ADDFN(CPETPosition); ADDFN(CRoomItem); diff --git a/engines/titanic/game/dead_area.cpp b/engines/titanic/game/dead_area.cpp new file mode 100644 index 0000000000..1692d6b8d1 --- /dev/null +++ b/engines/titanic/game/dead_area.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/game/dead_area.h" + +namespace Titanic { + +CDeadArea::CDeadArea() : CGameObject() { +} + +void CDeadArea::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CDeadArea::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/dead_area.h b/engines/titanic/game/dead_area.h new file mode 100644 index 0000000000..374e45e9d3 --- /dev/null +++ b/engines/titanic/game/dead_area.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_DEAD_AREA_H +#define TITANIC_DEAD_AREA_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CDeadArea : public CGameObject { +public: + CDeadArea(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CDeadArea"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DEAD_AREA_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index e10fe31e42..c90f300274 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -34,6 +34,7 @@ MODULE_OBJS := \ core/tree_item.o \ core/view_item.o \ game/announce.o \ + game/dead_area.o \ game/hammer_dispensor_button.o \ game/pet_position.o \ game/room_item.o \ -- cgit v1.2.3 From 03f842f8ebe6413db2592785a5e69830f9a6e58b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 26 Feb 2016 22:36:59 -0500 Subject: TITANIC: Implement computer and CDROM classes --- engines/titanic/core/saveable_object.cpp | 12 +++++++ engines/titanic/game/cdrom.cpp | 42 +++++++++++++++++++++++ engines/titanic/game/cdrom.h | 54 ++++++++++++++++++++++++++++++ engines/titanic/game/cdrom_computer.cpp | 51 ++++++++++++++++++++++++++++ engines/titanic/game/cdrom_computer.h | 57 ++++++++++++++++++++++++++++++++ engines/titanic/game/cdrom_tray.cpp | 46 ++++++++++++++++++++++++++ engines/titanic/game/cdrom_tray.h | 55 ++++++++++++++++++++++++++++++ engines/titanic/game/computer_screen.cpp | 40 ++++++++++++++++++++++ engines/titanic/game/computer_screen.h | 52 +++++++++++++++++++++++++++++ engines/titanic/module.mk | 4 +++ 10 files changed, 413 insertions(+) create mode 100644 engines/titanic/game/cdrom.cpp create mode 100644 engines/titanic/game/cdrom.h create mode 100644 engines/titanic/game/cdrom_computer.cpp create mode 100644 engines/titanic/game/cdrom_computer.h create mode 100644 engines/titanic/game/cdrom_tray.cpp create mode 100644 engines/titanic/game/cdrom_tray.h create mode 100644 engines/titanic/game/computer_screen.cpp create mode 100644 engines/titanic/game/computer_screen.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 7451852520..83b1d3c46a 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -36,6 +36,10 @@ #include "titanic/core/view_item.h" #include "titanic/game/announce.h" +#include "titanic/game/cdrom.h" +#include "titanic/game/cdrom_computer.h" +#include "titanic/game/cdrom_tray.h" +#include "titanic/game/computer_screen.h" #include "titanic/game/dead_area.h" #include "titanic/game/hammer_dispensor_button.h" #include "titanic/game/pet_position.h" @@ -132,6 +136,10 @@ DEFFN(CTreeItem); DEFFN(CViewItem); DEFFN(CAnnounce); +DEFFN(CCDROM); +DEFFN(CCDROMComputer); +DEFFN(CCDROMTray); +DEFFN(CComputerScreen); DEFFN(CDeadArea); DEFFN(CHammerDispensorButton); DEFFN(CPETPosition); @@ -221,6 +229,10 @@ void CSaveableObject::initClassList() { ADDFN(CViewItem); ADDFN(CAnnounce); + ADDFN(CCDROM); + ADDFN(CCDROMComputer); + ADDFN(CCDROMTray); + ADDFN(CComputerScreen); ADDFN(CDeadArea); ADDFN(CHammerDispensorButton); ADDFN(CPETPosition); diff --git a/engines/titanic/game/cdrom.cpp b/engines/titanic/game/cdrom.cpp new file mode 100644 index 0000000000..40e8ed05d8 --- /dev/null +++ b/engines/titanic/game/cdrom.cpp @@ -0,0 +1,42 @@ +/* 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 "titanic/game/cdrom.h" + +namespace Titanic { + +CCDROM::CCDROM() : CGameObject() { +} + +void CCDROM::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writePoint(_pos1, indent); + CGameObject::save(file, indent); +} + +void CCDROM::load(SimpleFile *file) { + file->readNumber(); + _pos1 = file->readPoint(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/cdrom.h b/engines/titanic/game/cdrom.h new file mode 100644 index 0000000000..cd05c79d0a --- /dev/null +++ b/engines/titanic/game/cdrom.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_CDROM_H +#define TITANIC_CDROM_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CCDROM : public CGameObject { +private: + Common::Point _pos1; +public: + CCDROM(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CCDROM"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CDROM_H */ diff --git a/engines/titanic/game/cdrom_computer.cpp b/engines/titanic/game/cdrom_computer.cpp new file mode 100644 index 0000000000..e67e4fb1d8 --- /dev/null +++ b/engines/titanic/game/cdrom_computer.cpp @@ -0,0 +1,51 @@ +/* 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 "titanic/game/cdrom_computer.h" + +namespace Titanic { + +CCDROMComputer::CCDROMComputer() : CGameObject(), + _fieldBC(0), _fieldC0(3), _fieldC4(55), _fieldC8(32) { +} + +void CCDROMComputer::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_fieldC4, indent); + file->writeNumberLine(_fieldC8, indent); + + CGameObject::save(file, indent); +} + +void CCDROMComputer::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _fieldC4 = file->readNumber(); + _fieldC8 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/cdrom_computer.h b/engines/titanic/game/cdrom_computer.h new file mode 100644 index 0000000000..368c45f266 --- /dev/null +++ b/engines/titanic/game/cdrom_computer.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_CDROM_COMPUTER_H +#define TITANIC_CDROM_COMPUTER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CCDROMComputer : public CGameObject { +private: + int _fieldBC; + int _fieldC0; + int _fieldC4; + int _fieldC8; +public: + CCDROMComputer(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CCDROMComputer"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CDROM_COMPUTER_H */ diff --git a/engines/titanic/game/cdrom_tray.cpp b/engines/titanic/game/cdrom_tray.cpp new file mode 100644 index 0000000000..32eea0648b --- /dev/null +++ b/engines/titanic/game/cdrom_tray.cpp @@ -0,0 +1,46 @@ +/* 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 "titanic/game/cdrom_tray.h" + +namespace Titanic { + +CCDROMTray::CCDROMTray() : CGameObject(), _fieldBC(0) { +} + +void CCDROMTray::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeQuotedLine(_string1, indent); + + CGameObject::save(file, indent); +} + +void CCDROMTray::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _string1 = file->readString(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/cdrom_tray.h b/engines/titanic/game/cdrom_tray.h new file mode 100644 index 0000000000..371187e946 --- /dev/null +++ b/engines/titanic/game/cdrom_tray.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_CDROM_TRAY_H +#define TITANIC_CDROM_TRAY_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CCDROMTray : public CGameObject { +private: + int _fieldBC; + CString _string1; +public: + CCDROMTray(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CCDROMTray"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CDROM_TRAY_H */ diff --git a/engines/titanic/game/computer_screen.cpp b/engines/titanic/game/computer_screen.cpp new file mode 100644 index 0000000000..04de5e50d8 --- /dev/null +++ b/engines/titanic/game/computer_screen.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/game/computer_screen.h" + +namespace Titanic { + +CComputerScreen::CComputerScreen() : CGameObject() { +} + +void CComputerScreen::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CComputerScreen::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/computer_screen.h b/engines/titanic/game/computer_screen.h new file mode 100644 index 0000000000..adb8b99093 --- /dev/null +++ b/engines/titanic/game/computer_screen.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_COMPUTER_SCREEN_H +#define TITANIC_COMPUTER_SCREEN_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CComputerScreen : public CGameObject { +public: + CComputerScreen(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CComputerScreen"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_COMPUTER_SCREEN_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index c90f300274..40b5b3280d 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -34,6 +34,10 @@ MODULE_OBJS := \ core/tree_item.o \ core/view_item.o \ game/announce.o \ + game/cdrom.o \ + game/cdrom_computer.o \ + game/cdrom_tray.o \ + game/computer_screen.o \ game/dead_area.o \ game/hammer_dispensor_button.o \ game/pet_position.o \ -- cgit v1.2.3 From b93f4e70777275cf259d3ac763d10134805b4042 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 27 Feb 2016 09:11:59 -0500 Subject: TITANIC: Added CCarry and descendent classes --- engines/titanic/carry/arm.cpp | 75 ++++++++++++++++++++++ engines/titanic/carry/arm.h | 67 ++++++++++++++++++++ engines/titanic/carry/brain.cpp | 49 +++++++++++++++ engines/titanic/carry/brain.h | 57 +++++++++++++++++ engines/titanic/carry/bridge_piece.cpp | 49 +++++++++++++++ engines/titanic/carry/bridge_piece.h | 57 +++++++++++++++++ engines/titanic/carry/carry.cpp | 81 ++++++++++++++++++++++++ engines/titanic/carry/carry.h | 71 +++++++++++++++++++++ engines/titanic/carry/carry_parrot.cpp | 52 ++++++++++++++++ engines/titanic/carry/carry_parrot.h | 61 ++++++++++++++++++ engines/titanic/carry/chicken.cpp | 53 ++++++++++++++++ engines/titanic/carry/chicken.h | 59 ++++++++++++++++++ engines/titanic/carry/crushed_tv.cpp | 40 ++++++++++++ engines/titanic/carry/crushed_tv.h | 52 ++++++++++++++++ engines/titanic/carry/ear.cpp | 40 ++++++++++++ engines/titanic/carry/ear.h | 52 ++++++++++++++++ engines/titanic/carry/eye.cpp | 42 +++++++++++++ engines/titanic/carry/eye.h | 54 ++++++++++++++++ engines/titanic/carry/feathers.cpp | 40 ++++++++++++ engines/titanic/carry/feathers.h | 52 ++++++++++++++++ engines/titanic/carry/fruit.cpp | 51 +++++++++++++++ engines/titanic/carry/fruit.h | 57 +++++++++++++++++ engines/titanic/carry/glass.cpp | 42 +++++++++++++ engines/titanic/carry/glass.h | 54 ++++++++++++++++ engines/titanic/carry/hammer.cpp | 40 ++++++++++++ engines/titanic/carry/hammer.h | 52 ++++++++++++++++ engines/titanic/carry/head_piece.cpp | 49 +++++++++++++++ engines/titanic/carry/head_piece.h | 56 +++++++++++++++++ engines/titanic/carry/hose.cpp | 43 +++++++++++++ engines/titanic/carry/hose.h | 54 ++++++++++++++++ engines/titanic/carry/key.cpp | 40 ++++++++++++ engines/titanic/carry/key.h | 52 ++++++++++++++++ engines/titanic/carry/liftbot_head.cpp | 42 +++++++++++++ engines/titanic/carry/liftbot_head.h | 54 ++++++++++++++++ engines/titanic/carry/long_stick.cpp | 40 ++++++++++++ engines/titanic/carry/long_stick.h | 52 ++++++++++++++++ engines/titanic/carry/magazine.cpp | 46 ++++++++++++++ engines/titanic/carry/magazine.h | 55 +++++++++++++++++ engines/titanic/carry/mouth.cpp | 40 ++++++++++++ engines/titanic/carry/mouth.h | 52 ++++++++++++++++ engines/titanic/carry/napkin.cpp | 40 ++++++++++++ engines/titanic/carry/napkin.h | 52 ++++++++++++++++ engines/titanic/carry/nose.cpp | 40 ++++++++++++ engines/titanic/carry/nose.h | 52 ++++++++++++++++ engines/titanic/carry/note.cpp | 46 ++++++++++++++ engines/titanic/carry/note.h | 55 +++++++++++++++++ engines/titanic/carry/parcel.cpp | 40 ++++++++++++ engines/titanic/carry/parcel.h | 52 ++++++++++++++++ engines/titanic/carry/phonograph_cylinder.cpp | 89 +++++++++++++++++++++++++++ engines/titanic/carry/phonograph_cylinder.h | 74 ++++++++++++++++++++++ engines/titanic/carry/photograph.cpp | 50 +++++++++++++++ engines/titanic/carry/photograph.h | 57 +++++++++++++++++ engines/titanic/carry/plug_in.cpp | 40 ++++++++++++ engines/titanic/carry/plug_in.h | 54 ++++++++++++++++ engines/titanic/carry/sweets.cpp | 40 ++++++++++++ engines/titanic/carry/sweets.h | 52 ++++++++++++++++ engines/titanic/core/saveable_object.cpp | 77 +++++++++++++++++++++++ engines/titanic/module.mk | 29 ++++++++- 58 files changed, 3012 insertions(+), 1 deletion(-) create mode 100644 engines/titanic/carry/arm.cpp create mode 100644 engines/titanic/carry/arm.h create mode 100644 engines/titanic/carry/brain.cpp create mode 100644 engines/titanic/carry/brain.h create mode 100644 engines/titanic/carry/bridge_piece.cpp create mode 100644 engines/titanic/carry/bridge_piece.h create mode 100644 engines/titanic/carry/carry.cpp create mode 100644 engines/titanic/carry/carry.h create mode 100644 engines/titanic/carry/carry_parrot.cpp create mode 100644 engines/titanic/carry/carry_parrot.h create mode 100644 engines/titanic/carry/chicken.cpp create mode 100644 engines/titanic/carry/chicken.h create mode 100644 engines/titanic/carry/crushed_tv.cpp create mode 100644 engines/titanic/carry/crushed_tv.h create mode 100644 engines/titanic/carry/ear.cpp create mode 100644 engines/titanic/carry/ear.h create mode 100644 engines/titanic/carry/eye.cpp create mode 100644 engines/titanic/carry/eye.h create mode 100644 engines/titanic/carry/feathers.cpp create mode 100644 engines/titanic/carry/feathers.h create mode 100644 engines/titanic/carry/fruit.cpp create mode 100644 engines/titanic/carry/fruit.h create mode 100644 engines/titanic/carry/glass.cpp create mode 100644 engines/titanic/carry/glass.h create mode 100644 engines/titanic/carry/hammer.cpp create mode 100644 engines/titanic/carry/hammer.h create mode 100644 engines/titanic/carry/head_piece.cpp create mode 100644 engines/titanic/carry/head_piece.h create mode 100644 engines/titanic/carry/hose.cpp create mode 100644 engines/titanic/carry/hose.h create mode 100644 engines/titanic/carry/key.cpp create mode 100644 engines/titanic/carry/key.h create mode 100644 engines/titanic/carry/liftbot_head.cpp create mode 100644 engines/titanic/carry/liftbot_head.h create mode 100644 engines/titanic/carry/long_stick.cpp create mode 100644 engines/titanic/carry/long_stick.h create mode 100644 engines/titanic/carry/magazine.cpp create mode 100644 engines/titanic/carry/magazine.h create mode 100644 engines/titanic/carry/mouth.cpp create mode 100644 engines/titanic/carry/mouth.h create mode 100644 engines/titanic/carry/napkin.cpp create mode 100644 engines/titanic/carry/napkin.h create mode 100644 engines/titanic/carry/nose.cpp create mode 100644 engines/titanic/carry/nose.h create mode 100644 engines/titanic/carry/note.cpp create mode 100644 engines/titanic/carry/note.h create mode 100644 engines/titanic/carry/parcel.cpp create mode 100644 engines/titanic/carry/parcel.h create mode 100644 engines/titanic/carry/phonograph_cylinder.cpp create mode 100644 engines/titanic/carry/phonograph_cylinder.h create mode 100644 engines/titanic/carry/photograph.cpp create mode 100644 engines/titanic/carry/photograph.h create mode 100644 engines/titanic/carry/plug_in.cpp create mode 100644 engines/titanic/carry/plug_in.h create mode 100644 engines/titanic/carry/sweets.cpp create mode 100644 engines/titanic/carry/sweets.h diff --git a/engines/titanic/carry/arm.cpp b/engines/titanic/carry/arm.cpp new file mode 100644 index 0000000000..fdf73e93f3 --- /dev/null +++ b/engines/titanic/carry/arm.cpp @@ -0,0 +1,75 @@ +/* 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 "titanic/carry/arm.h" + +namespace Titanic { + +CArm::CArm() : CCarry(), _string6("Key"), + _field138(0), _field13C(0), _field140(0), _field144(0), + _field148(0), _field158(0), _field15C(220), _field160(208), + _field164(409), _field168(350), _field16C(3), _field170(0) { +} + +void CArm::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string6, indent); + file->writeNumberLine(_field138, indent); + file->writeNumberLine(_field13C, indent); + file->writeNumberLine(_field140, indent); + file->writeNumberLine(_field144, indent); + file->writeNumberLine(_field148, indent); + + file->writeQuotedLine(_string7, indent); + file->writeNumberLine(_field158, indent); + file->writeNumberLine(_field15C, indent); + file->writeNumberLine(_field160, indent); + file->writeNumberLine(_field164, indent); + file->writeNumberLine(_field168, indent); + file->writeNumberLine(_field16C, indent); + file->writeNumberLine(_field170, indent); + + CCarry::save(file, indent); +} + +void CArm::load(SimpleFile *file) { + file->readNumber(); + _string6 = file->readString(); + _field138 = file->readNumber(); + _field13C = file->readNumber(); + _field140 = file->readNumber(); + _field144 = file->readNumber(); + _field148 = file->readNumber(); + + _string7 = file->readString(); + _field158 = file->readNumber(); + _field15C = file->readNumber(); + _field160 = file->readNumber(); + _field164 = file->readNumber(); + _field168 = file->readNumber(); + _field16C = file->readNumber(); + _field170 = file->readNumber(); + + CCarry::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/arm.h b/engines/titanic/carry/arm.h new file mode 100644 index 0000000000..4874707fc5 --- /dev/null +++ b/engines/titanic/carry/arm.h @@ -0,0 +1,67 @@ +/* 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. + * + */ + +#ifndef TITANIC_ARM_H +#define TITANIC_ARM_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CArm : public CCarry { +private: + CString _string6; + int _field138; + int _field13C; + int _field140; + int _field144; + int _field148; + CString _string7; + int _field158; + int _field15C; + int _field160; + int _field164; + int _field168; + int _field16C; + int _field170; +public: + CArm(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CArm"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ARM_H */ diff --git a/engines/titanic/carry/brain.cpp b/engines/titanic/carry/brain.cpp new file mode 100644 index 0000000000..f37549c94c --- /dev/null +++ b/engines/titanic/carry/brain.cpp @@ -0,0 +1,49 @@ +/* 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 "titanic/carry/brain.h" + +namespace Titanic { + +CBrain::CBrain() : CCarry(), _field12C(0), + _field130(0), _field134(0), _field138(0) { +} + +void CBrain::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field12C, indent); + file->writeNumberLine(_field134, indent); + file->writeNumberLine(_field138, indent); + + CCarry::save(file, indent); +} + +void CBrain::load(SimpleFile *file) { + file->readNumber(); + _field12C = file->readNumber(); + _field134 = file->readNumber(); + _field138 = file->readNumber(); + + CCarry::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/brain.h b/engines/titanic/carry/brain.h new file mode 100644 index 0000000000..903723050c --- /dev/null +++ b/engines/titanic/carry/brain.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_BRAIN_H +#define TITANIC_BRAIN_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CBrain : public CCarry { +private: + int _field12C; + int _field130; + int _field134; + int _field138; +public: + CBrain(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBrain"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BRAIN_H */ diff --git a/engines/titanic/carry/bridge_piece.cpp b/engines/titanic/carry/bridge_piece.cpp new file mode 100644 index 0000000000..b9c998d9d1 --- /dev/null +++ b/engines/titanic/carry/bridge_piece.cpp @@ -0,0 +1,49 @@ +/* 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 "titanic/carry/bridge_piece.h" + +namespace Titanic { + +CBridgePiece::CBridgePiece() : CCarry(), + _field138(0), _field13C(0), _field140(0) { +} + +void CBridgePiece::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string6, indent); + file->writeNumberLine(_field138, indent); + file->writeNumberLine(_field140, indent); + + CCarry::save(file, indent); +} + +void CBridgePiece::load(SimpleFile *file) { + file->readNumber(); + _string6 = file->readString(); + _field138 = file->readNumber(); + _field140 = file->readNumber(); + + CCarry::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/bridge_piece.h b/engines/titanic/carry/bridge_piece.h new file mode 100644 index 0000000000..f38e27e6c9 --- /dev/null +++ b/engines/titanic/carry/bridge_piece.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_BRIDGE_PIECE_H +#define TITANIC_BRIDGE_PIECE_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CBridgePiece : public CCarry { +private: + CString _string6; + int _field138; + int _field13C; + int _field140; +public: + CBridgePiece(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBridgePiece"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BRIDGE_PIECE_H */ diff --git a/engines/titanic/carry/carry.cpp b/engines/titanic/carry/carry.cpp new file mode 100644 index 0000000000..604c952658 --- /dev/null +++ b/engines/titanic/carry/carry.cpp @@ -0,0 +1,81 @@ +/* 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 "titanic/carry/carry.h" + +namespace Titanic { + +CCarry::CCarry() : CGameObject(), _fieldC8(0), _fieldCC(0), + _fieldDC(0), _fieldE0(1), _fieldFC(0), _field100(0), + _field104(0), _field108(0), _field10C(0), _field110(0), + _field120(0), _field124(0), _field128(0), + _string1("None"), + _string2("NULL"), + _string3("That doesn't seem to do anything."), + _string4("It doesn't seem to want this.") { +} + +void CCarry::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string1, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeQuotedLine(_string2, indent); + file->writeNumberLine(_fieldDC, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeQuotedLine(_string3, indent); + file->writeQuotedLine(_string4, indent); + file->writeNumberLine(_fieldFC, indent); + file->writeNumberLine(_field104, indent); + file->writeNumberLine(_field108, indent); + file->writeNumberLine(_field10C, indent); + file->writeNumberLine(_field110, indent); + file->writeQuotedLine(_string5, indent); + file->writeNumberLine(_field120, indent); + file->writeNumberLine(_field124, indent); + file->writeNumberLine(_field128, indent); + + CGameObject::save(file, indent); +} + +void CCarry::load(SimpleFile *file) { + file->readNumber(); + _string1 = file->readString(); + _fieldC8 = file->readNumber(); + _string2 = file->readString(); + _fieldDC = file->readNumber(); + _fieldE0 = file->readNumber(); + _string3 = file->readString(); + _string4 = file->readString(); + _fieldFC = file->readNumber(); + _field104 = file->readNumber(); + _field108 = file->readNumber(); + _field10C = file->readNumber(); + _field110 = file->readNumber(); + _string5 = file->readString(); + _field120 = file->readNumber(); + _field124 = file->readNumber(); + _field128 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/carry.h b/engines/titanic/carry/carry.h new file mode 100644 index 0000000000..4bf98b7132 --- /dev/null +++ b/engines/titanic/carry/carry.h @@ -0,0 +1,71 @@ +/* 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. + * + */ + +#ifndef TITANIC_CARRY_H +#define TITANIC_CARRY_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CCarry : public CGameObject { +private: + CString _string1; + int _fieldC8; + int _fieldCC; + CString _string2; + int _fieldDC; + int _fieldE0; + CString _string3; + CString _string4; + int _fieldFC; + int _field100; + int _field104; + int _field108; + int _field10C; + int _field110; + CString _string5; + int _field120; + int _field124; + int _field128; +public: + CCarry(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CCarry"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CARRY_H */ diff --git a/engines/titanic/carry/carry_parrot.cpp b/engines/titanic/carry/carry_parrot.cpp new file mode 100644 index 0000000000..80c833261c --- /dev/null +++ b/engines/titanic/carry/carry_parrot.cpp @@ -0,0 +1,52 @@ +/* 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 "titanic/carry/carry_parrot.h" + +namespace Titanic { + +CCarryParrot::CCarryParrot() : CCarry(), _string6("PerchedParrot"), + _field138(0), _field13C(0), _field140(0), _field144(10), + _field148(25), _field14C(0), _field150(8) { +} + +void CCarryParrot::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string6, indent); + file->writeNumberLine(_field138, indent); + file->writeNumberLine(_field13C, indent); + file->writeNumberLine(_field140, indent); + + CCarry::save(file, indent); +} + +void CCarryParrot::load(SimpleFile *file) { + file->readNumber(); + _string6 = file->readString(); + _field138 = file->readNumber(); + _field13C = file->readNumber(); + _field140 = file->readNumber(); + + CCarry::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/carry_parrot.h b/engines/titanic/carry/carry_parrot.h new file mode 100644 index 0000000000..d4c71000fe --- /dev/null +++ b/engines/titanic/carry/carry_parrot.h @@ -0,0 +1,61 @@ +/* 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. + * + */ + +#ifndef TITANIC_CARRY_PARROT_H +#define TITANIC_CARRY_PARROT_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CCarryParrot : public CCarry { +private: + CString _string6; + int _field138; + int _field13C; + int _field140; + int _field144; + int _field148; + int _field14C; + int _field150; +public: + CCarryParrot(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CCarryParrot"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CARRY_PARROT_H */ diff --git a/engines/titanic/carry/chicken.cpp b/engines/titanic/carry/chicken.cpp new file mode 100644 index 0000000000..972c993ec4 --- /dev/null +++ b/engines/titanic/carry/chicken.cpp @@ -0,0 +1,53 @@ +/* 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 "titanic/carry/chicken.h" + +namespace Titanic { + +int CChicken::_v1; + +CChicken::CChicken() : CCarry(), _string6("None"), + _field12C(1), _field13C(0), _field140(0) { +} + +void CChicken::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field12C, indent); + file->writeQuotedLine(_string6, indent); + file->writeNumberLine(_field13C, indent); + file->writeNumberLine(_field140, indent); + + CCarry::save(file, indent); +} + +void CChicken::load(SimpleFile *file) { + file->readNumber(); + _field12C = file->readNumber(); + _string6 = file->readString(); + _field13C = file->readNumber(); + _field140 = file->readNumber(); + + CCarry::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/chicken.h b/engines/titanic/carry/chicken.h new file mode 100644 index 0000000000..a2ca321998 --- /dev/null +++ b/engines/titanic/carry/chicken.h @@ -0,0 +1,59 @@ +/* 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. + * + */ + +#ifndef TITANIC_CHICKEN_H +#define TITANIC_CHICKEN_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CChicken : public CCarry { +private: + static int _v1; +private: + int _field12C; + CString _string6; + int _field13C; + int _field140; +public: + CChicken(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CChicken"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CHICKEN_H */ diff --git a/engines/titanic/carry/crushed_tv.cpp b/engines/titanic/carry/crushed_tv.cpp new file mode 100644 index 0000000000..a0a7ee7a43 --- /dev/null +++ b/engines/titanic/carry/crushed_tv.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/carry/crushed_tv.h" + +namespace Titanic { + +CCrushedTV::CCrushedTV() : CCarry() { +} + +void CCrushedTV::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CCarry::save(file, indent); +} + +void CCrushedTV::load(SimpleFile *file) { + file->readNumber(); + CCarry::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/crushed_tv.h b/engines/titanic/carry/crushed_tv.h new file mode 100644 index 0000000000..ccbeac577a --- /dev/null +++ b/engines/titanic/carry/crushed_tv.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_CRUSHED_TV_H +#define TITANIC_CRUSHED_TV_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CCrushedTV : public CCarry { +public: + CCrushedTV(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CCrushedTV"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CRUSHED_TV_H */ diff --git a/engines/titanic/carry/ear.cpp b/engines/titanic/carry/ear.cpp new file mode 100644 index 0000000000..d87b09d9b4 --- /dev/null +++ b/engines/titanic/carry/ear.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/carry/ear.h" + +namespace Titanic { + +CEar::CEar() : CHeadPiece() { +} + +void CEar::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CHeadPiece::save(file, indent); +} + +void CEar::load(SimpleFile *file) { + file->readNumber(); + CHeadPiece::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/ear.h b/engines/titanic/carry/ear.h new file mode 100644 index 0000000000..fbee7d02a3 --- /dev/null +++ b/engines/titanic/carry/ear.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_EAR_H +#define TITANIC_EAR_H + +#include "titanic/carry/head_piece.h" + +namespace Titanic { + +class CEar : public CHeadPiece { +public: + CEar(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CEar"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_EAR_H */ diff --git a/engines/titanic/carry/eye.cpp b/engines/titanic/carry/eye.cpp new file mode 100644 index 0000000000..21fc3faa7e --- /dev/null +++ b/engines/titanic/carry/eye.cpp @@ -0,0 +1,42 @@ +/* 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 "titanic/carry/eye.h" + +namespace Titanic { + +CEye::CEye() : CHeadPiece(), _eyeNum(0) { +} + +void CEye::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_eyeNum, indent); + CHeadPiece::save(file, indent); +} + +void CEye::load(SimpleFile *file) { + file->readNumber(); + _eyeNum = file->readNumber(); + CHeadPiece::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/eye.h b/engines/titanic/carry/eye.h new file mode 100644 index 0000000000..0f0e73b0d3 --- /dev/null +++ b/engines/titanic/carry/eye.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_EYE_H +#define TITANIC_EYE_H + +#include "titanic/carry/head_piece.h" + +namespace Titanic { + +class CEye : public CHeadPiece { +private: + int _eyeNum; +public: + CEye(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CEye"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_EYE_H */ diff --git a/engines/titanic/carry/feathers.cpp b/engines/titanic/carry/feathers.cpp new file mode 100644 index 0000000000..c03b73859b --- /dev/null +++ b/engines/titanic/carry/feathers.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/carry/feathers.h" + +namespace Titanic { + +CFeathers::CFeathers() : CCarry() { +} + +void CFeathers::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CCarry::save(file, indent); +} + +void CFeathers::load(SimpleFile *file) { + file->readNumber(); + CCarry::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/feathers.h b/engines/titanic/carry/feathers.h new file mode 100644 index 0000000000..8fc11b7137 --- /dev/null +++ b/engines/titanic/carry/feathers.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_FEATHERS_H +#define TITANIC_FEATHERS_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CFeathers : public CCarry { +public: + CFeathers(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CFeathers"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_FEATHERS_H */ diff --git a/engines/titanic/carry/fruit.cpp b/engines/titanic/carry/fruit.cpp new file mode 100644 index 0000000000..3355d6e006 --- /dev/null +++ b/engines/titanic/carry/fruit.cpp @@ -0,0 +1,51 @@ +/* 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 "titanic/carry/fruit.h" + +namespace Titanic { + +CFruit::CFruit() : CCarry(), _field12C(0), + _field130(0), _field134(0), _field138(0) { +} + +void CFruit::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field12C, indent); + file->writeNumberLine(_field130, indent); + file->writeNumberLine(_field134, indent); + file->writeNumberLine(_field138, indent); + + CCarry::save(file, indent); +} + +void CFruit::load(SimpleFile *file) { + file->readNumber(); + _field12C = file->readNumber(); + _field130 = file->readNumber(); + _field134 = file->readNumber(); + _field138 = file->readNumber(); + + CCarry::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/fruit.h b/engines/titanic/carry/fruit.h new file mode 100644 index 0000000000..bc8a109e0f --- /dev/null +++ b/engines/titanic/carry/fruit.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_FRUIT_H +#define TITANIC_FRUIT_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CFruit : public CCarry { +private: + int _field12C; + int _field130; + int _field134; + int _field138; +public: + CFruit(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CFruit"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_FRUIT_H */ diff --git a/engines/titanic/carry/glass.cpp b/engines/titanic/carry/glass.cpp new file mode 100644 index 0000000000..1f0e059f54 --- /dev/null +++ b/engines/titanic/carry/glass.cpp @@ -0,0 +1,42 @@ +/* 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 "titanic/carry/glass.h" + +namespace Titanic { + +CGlass::CGlass() : CCarry(), _string6("None") { +} + +void CGlass::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string6, indent); + CCarry::save(file, indent); +} + +void CGlass::load(SimpleFile *file) { + file->readNumber(); + _string6 = file->readString(); + CCarry::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/glass.h b/engines/titanic/carry/glass.h new file mode 100644 index 0000000000..57922c1920 --- /dev/null +++ b/engines/titanic/carry/glass.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_GLASS_H +#define TITANIC_GLASS_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CGlass : public CCarry { +private: + CString _string6; +public: + CGlass(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CGlass"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_GLASS_H */ diff --git a/engines/titanic/carry/hammer.cpp b/engines/titanic/carry/hammer.cpp new file mode 100644 index 0000000000..f1dc3b2aa0 --- /dev/null +++ b/engines/titanic/carry/hammer.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/carry/hammer.h" + +namespace Titanic { + +CHammer::CHammer() : CCarry() { +} + +void CHammer::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CCarry::save(file, indent); +} + +void CHammer::load(SimpleFile *file) { + file->readNumber(); + CCarry::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/hammer.h b/engines/titanic/carry/hammer.h new file mode 100644 index 0000000000..ec05435529 --- /dev/null +++ b/engines/titanic/carry/hammer.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_HAMMER_H +#define TITANIC_HAMMER_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CHammer : public CCarry { +public: + CHammer(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CHammer"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_HAMMER_H */ diff --git a/engines/titanic/carry/head_piece.cpp b/engines/titanic/carry/head_piece.cpp new file mode 100644 index 0000000000..1eab585462 --- /dev/null +++ b/engines/titanic/carry/head_piece.cpp @@ -0,0 +1,49 @@ +/* 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 "titanic/carry/head_piece.h" + +namespace Titanic { + +CHeadPiece::CHeadPiece() : CCarry(), _string6("Not Working"), + _field12C(0), _field13C(0) { +} + +void CHeadPiece::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field12C, indent); + file->writeQuotedLine(_string6, indent); + file->writeNumberLine(_field13C, indent); + + CCarry::save(file, indent); +} + +void CHeadPiece::load(SimpleFile *file) { + file->readNumber(); + _field12C = file->readNumber(); + _string6 = file->readString(); + _field13C = file->readNumber(); + + CCarry::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/head_piece.h b/engines/titanic/carry/head_piece.h new file mode 100644 index 0000000000..ddadb75880 --- /dev/null +++ b/engines/titanic/carry/head_piece.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_HEAD_PIECE_H +#define TITANIC_HEAD_PIECE_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CHeadPiece : public CCarry { +private: + int _field12C; + CString _string6; + int _field13C; +public: + CHeadPiece(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CHeadPiece"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_HEAD_PIECE_H */ diff --git a/engines/titanic/carry/hose.cpp b/engines/titanic/carry/hose.cpp new file mode 100644 index 0000000000..bb52ec34d5 --- /dev/null +++ b/engines/titanic/carry/hose.cpp @@ -0,0 +1,43 @@ +/* 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 "titanic/carry/hose.h" + +namespace Titanic { + +CHose::CHose() : CCarry(), + _string6("Succ-U-Bus auxiliary hose attachment incompatible with sliding glass cover.") { +} + +void CHose::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string6, indent); + CCarry::save(file, indent); +} + +void CHose::load(SimpleFile *file) { + file->readNumber(); + _string6 = file->readString(); + CCarry::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/hose.h b/engines/titanic/carry/hose.h new file mode 100644 index 0000000000..87f47b3bc4 --- /dev/null +++ b/engines/titanic/carry/hose.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_HOSE_H +#define TITANIC_HOSE_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CHose : public CCarry { +private: + CString _string6; +public: + CHose(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CHose"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_HOSE_H */ diff --git a/engines/titanic/carry/key.cpp b/engines/titanic/carry/key.cpp new file mode 100644 index 0000000000..2c559bb6c9 --- /dev/null +++ b/engines/titanic/carry/key.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/carry/key.h" + +namespace Titanic { + +CKey::CKey() : CCarry() { +} + +void CKey::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CCarry::save(file, indent); +} + +void CKey::load(SimpleFile *file) { + file->readNumber(); + CCarry::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/key.h b/engines/titanic/carry/key.h new file mode 100644 index 0000000000..815bb95c2b --- /dev/null +++ b/engines/titanic/carry/key.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_KEY_H +#define TITANIC_KEY_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CKey : public CCarry { +public: + CKey(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CKey"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_KEY_H */ diff --git a/engines/titanic/carry/liftbot_head.cpp b/engines/titanic/carry/liftbot_head.cpp new file mode 100644 index 0000000000..422d88ad0f --- /dev/null +++ b/engines/titanic/carry/liftbot_head.cpp @@ -0,0 +1,42 @@ +/* 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 "titanic/carry/liftbot_head.h" + +namespace Titanic { + +CLiftbotHead::CLiftbotHead() : CCarry(), _field12C(0) { +} + +void CLiftbotHead::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field12C, indent); + CCarry::save(file, indent); +} + +void CLiftbotHead::load(SimpleFile *file) { + file->readNumber(); + _field12C = file->readNumber(); + CCarry::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/liftbot_head.h b/engines/titanic/carry/liftbot_head.h new file mode 100644 index 0000000000..be4ad581b4 --- /dev/null +++ b/engines/titanic/carry/liftbot_head.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_LIFTBOT_HEAD_H +#define TITANIC_LIFTBOT_HEAD_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CLiftbotHead : public CCarry { +private: + int _field12C; +public: + CLiftbotHead(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CLiftbotHead"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_LIFTBOT_HEAD_H */ diff --git a/engines/titanic/carry/long_stick.cpp b/engines/titanic/carry/long_stick.cpp new file mode 100644 index 0000000000..d5bf73b9b0 --- /dev/null +++ b/engines/titanic/carry/long_stick.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/carry/long_stick.h" + +namespace Titanic { + +CLongStick::CLongStick() : CCarry() { +} + +void CLongStick::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CCarry::save(file, indent); +} + +void CLongStick::load(SimpleFile *file) { + file->readNumber(); + CCarry::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/long_stick.h b/engines/titanic/carry/long_stick.h new file mode 100644 index 0000000000..3c8646d6a2 --- /dev/null +++ b/engines/titanic/carry/long_stick.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_LONG_STICK_H +#define TITANIC_LONG_STICK_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CLongStick : public CCarry { +public: + CLongStick(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CLongStick"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_LONG_STICK_H */ diff --git a/engines/titanic/carry/magazine.cpp b/engines/titanic/carry/magazine.cpp new file mode 100644 index 0000000000..efb68c1256 --- /dev/null +++ b/engines/titanic/carry/magazine.cpp @@ -0,0 +1,46 @@ +/* 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 "titanic/carry/magazine.h" + +namespace Titanic { + +CMagazine::CMagazine() : CCarry() { +} + +void CMagazine::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field12C, indent); + file->writeNumberLine(_field130, indent); + + CCarry::save(file, indent); +} + +void CMagazine::load(SimpleFile *file) { + file->readNumber(); + _field12C = file->readNumber(); + _field130 = file->readNumber(); + + CCarry::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/magazine.h b/engines/titanic/carry/magazine.h new file mode 100644 index 0000000000..a1a7eee148 --- /dev/null +++ b/engines/titanic/carry/magazine.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_MAGAZINE_H +#define TITANIC_MAGAZINE_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CMagazine : public CCarry { +private: + int _field12C; + int _field130; +public: + CMagazine(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMagazine"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MAGAZINE_H */ diff --git a/engines/titanic/carry/mouth.cpp b/engines/titanic/carry/mouth.cpp new file mode 100644 index 0000000000..058ffc42d7 --- /dev/null +++ b/engines/titanic/carry/mouth.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/carry/mouth.h" + +namespace Titanic { + +CMouth::CMouth() : CHeadPiece() { +} + +void CMouth::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CHeadPiece::save(file, indent); +} + +void CMouth::load(SimpleFile *file) { + file->readNumber(); + CHeadPiece::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/mouth.h b/engines/titanic/carry/mouth.h new file mode 100644 index 0000000000..837a658d9e --- /dev/null +++ b/engines/titanic/carry/mouth.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_MOUTH_H +#define TITANIC_MOUTH_H + +#include "titanic/carry/head_piece.h" + +namespace Titanic { + +class CMouth : public CHeadPiece { +public: + CMouth(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMouth"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MOUTH_H */ diff --git a/engines/titanic/carry/napkin.cpp b/engines/titanic/carry/napkin.cpp new file mode 100644 index 0000000000..48d03819ee --- /dev/null +++ b/engines/titanic/carry/napkin.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/carry/napkin.h" + +namespace Titanic { + +CNapkin::CNapkin() : CCarry() { +} + +void CNapkin::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CCarry::save(file, indent); +} + +void CNapkin::load(SimpleFile *file) { + file->readNumber(); + CCarry::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/napkin.h b/engines/titanic/carry/napkin.h new file mode 100644 index 0000000000..549b29293e --- /dev/null +++ b/engines/titanic/carry/napkin.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_NAPKIN_H +#define TITANIC_NAPKIN_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CNapkin : public CCarry { +public: + CNapkin(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CNapkin"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_NAPKIN_H */ diff --git a/engines/titanic/carry/nose.cpp b/engines/titanic/carry/nose.cpp new file mode 100644 index 0000000000..cd5085db44 --- /dev/null +++ b/engines/titanic/carry/nose.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/carry/nose.h" + +namespace Titanic { + +CNose::CNose() : CHeadPiece() { +} + +void CNose::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CHeadPiece::save(file, indent); +} + +void CNose::load(SimpleFile *file) { + file->readNumber(); + CHeadPiece::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/nose.h b/engines/titanic/carry/nose.h new file mode 100644 index 0000000000..349c0c6e9b --- /dev/null +++ b/engines/titanic/carry/nose.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_NOSE_H +#define TITANIC_NOSE_H + +#include "titanic/carry/head_piece.h" + +namespace Titanic { + +class CNose : public CHeadPiece { +public: + CNose(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CNose"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_NOSE_H */ diff --git a/engines/titanic/carry/note.cpp b/engines/titanic/carry/note.cpp new file mode 100644 index 0000000000..e8400126ac --- /dev/null +++ b/engines/titanic/carry/note.cpp @@ -0,0 +1,46 @@ +/* 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 "titanic/carry/note.h" + +namespace Titanic { + +CNote::CNote() : CCarry(), _field138(1) { +} + +void CNote::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string6, indent); + file->writeNumberLine(_field138, indent); + + CCarry::save(file, indent); +} + +void CNote::load(SimpleFile *file) { + file->readNumber(); + _string6 = file->readString(); + _field138 = file->readNumber(); + + CCarry::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/note.h b/engines/titanic/carry/note.h new file mode 100644 index 0000000000..d3923c8402 --- /dev/null +++ b/engines/titanic/carry/note.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_NOTE_H +#define TITANIC_NOTE_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CNote : public CCarry { +private: + CString _string6; + int _field138; +public: + CNote(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CNote"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_NOTE_H */ diff --git a/engines/titanic/carry/parcel.cpp b/engines/titanic/carry/parcel.cpp new file mode 100644 index 0000000000..b450d887c5 --- /dev/null +++ b/engines/titanic/carry/parcel.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/carry/parcel.h" + +namespace Titanic { + +CParcel::CParcel() : CCarry() { +} + +void CParcel::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CCarry::save(file, indent); +} + +void CParcel::load(SimpleFile *file) { + file->readNumber(); + CCarry::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/parcel.h b/engines/titanic/carry/parcel.h new file mode 100644 index 0000000000..e16ea9bcf9 --- /dev/null +++ b/engines/titanic/carry/parcel.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_PARCEL_H +#define TITANIC_PARCEL_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CParcel : public CCarry { +public: + CParcel(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CParcel"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PARCEL_H */ diff --git a/engines/titanic/carry/phonograph_cylinder.cpp b/engines/titanic/carry/phonograph_cylinder.cpp new file mode 100644 index 0000000000..fb58c3214f --- /dev/null +++ b/engines/titanic/carry/phonograph_cylinder.cpp @@ -0,0 +1,89 @@ +/* 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 "titanic/carry/phonograph_cylinder.h" + +namespace Titanic { + +CPhonographCylinder::CPhonographCylinder() : CCarry(), + _field138(0), _field13C(0), _field140(0), _field144(0), + _field148(0), _field14C(0), _field150(0), _field154(0), + _field158(0), _field15C(0), _field160(0), _field164(0), + _field168(0), _field16C(0), _field170(0), _field174(0), + _field178(0), _field17C(0), _field180(0), _field184(0) { +} + +void CPhonographCylinder::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string6, indent); + file->writeNumberLine(_field138, indent); + file->writeNumberLine(_field13C, indent); + file->writeNumberLine(_field140, indent); + file->writeNumberLine(_field144, indent); + file->writeNumberLine(_field148, indent); + file->writeNumberLine(_field14C, indent); + file->writeNumberLine(_field150, indent); + file->writeNumberLine(_field154, indent); + file->writeNumberLine(_field158, indent); + file->writeNumberLine(_field15C, indent); + file->writeNumberLine(_field160, indent); + file->writeNumberLine(_field164, indent); + file->writeNumberLine(_field168, indent); + file->writeNumberLine(_field16C, indent); + file->writeNumberLine(_field170, indent); + file->writeNumberLine(_field174, indent); + file->writeNumberLine(_field178, indent); + file->writeNumberLine(_field17C, indent); + file->writeNumberLine(_field180, indent); + file->writeNumberLine(_field184, indent); + + CCarry::save(file, indent); +} + +void CPhonographCylinder::load(SimpleFile *file) { + file->readNumber(); + _string6 = file->readString(); + _field138 = file->readNumber(); + _field13C = file->readNumber(); + _field140 = file->readNumber(); + _field144 = file->readNumber(); + _field148 = file->readNumber(); + _field14C = file->readNumber(); + _field150 = file->readNumber(); + _field154 = file->readNumber(); + _field158 = file->readNumber(); + _field15C = file->readNumber(); + _field160 = file->readNumber(); + _field164 = file->readNumber(); + _field168 = file->readNumber(); + _field16C = file->readNumber(); + _field170 = file->readNumber(); + _field174 = file->readNumber(); + _field178 = file->readNumber(); + _field17C = file->readNumber(); + _field180 = file->readNumber(); + _field184 = file->readNumber(); + + CCarry::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/phonograph_cylinder.h b/engines/titanic/carry/phonograph_cylinder.h new file mode 100644 index 0000000000..327ba3e541 --- /dev/null +++ b/engines/titanic/carry/phonograph_cylinder.h @@ -0,0 +1,74 @@ +/* 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. + * + */ + +#ifndef TITANIC_PHONOGRAPH_CYLINDER_H +#define TITANIC_PHONOGRAPH_CYLINDER_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CPhonographCylinder : public CCarry { +private: + CString _string6; + int _field138; + int _field13C; + int _field140; + int _field144; + int _field148; + int _field14C; + int _field150; + int _field154; + int _field158; + int _field15C; + int _field160; + int _field164; + int _field168; + int _field16C; + int _field170; + int _field174; + int _field178; + int _field17C; + int _field180; + int _field184; +public: + CPhonographCylinder(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPhonographCylinder"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PHONOGRAPH_CYLINDER_H */ diff --git a/engines/titanic/carry/photograph.cpp b/engines/titanic/carry/photograph.cpp new file mode 100644 index 0000000000..92549b3ce5 --- /dev/null +++ b/engines/titanic/carry/photograph.cpp @@ -0,0 +1,50 @@ +/* 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 "titanic/carry/photograph.h" + +namespace Titanic { + +int CPhotograph::_v1; + +CPhotograph::CPhotograph() : CCarry(), _field12C(0), _field130(0) { +} + +void CPhotograph::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field12C, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_field130, indent); + + CCarry::save(file, indent); +} + +void CPhotograph::load(SimpleFile *file) { + file->readNumber(); + _field12C = file->readNumber(); + _v1 = file->readNumber(); + _field130 = file->readNumber(); + + CCarry::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/photograph.h b/engines/titanic/carry/photograph.h new file mode 100644 index 0000000000..1148df1ec3 --- /dev/null +++ b/engines/titanic/carry/photograph.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_PHOTOGRAPH_H +#define TITANIC_PHOTOGRAPH_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CPhotograph : public CCarry { +private: + static int _v1; +private: + int _field12C; + int _field130; +public: + CPhotograph(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPhotograph"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PHOTOGRAPH_H */ diff --git a/engines/titanic/carry/plug_in.cpp b/engines/titanic/carry/plug_in.cpp new file mode 100644 index 0000000000..ff8d9b158f --- /dev/null +++ b/engines/titanic/carry/plug_in.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/carry/plug_in.h" + +namespace Titanic { + +CPlugIn::CPlugIn() : CCarry(), _field12C(0) { +} + +void CPlugIn::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CCarry::save(file, indent); +} + +void CPlugIn::load(SimpleFile *file) { + file->readNumber(); + CCarry::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/plug_in.h b/engines/titanic/carry/plug_in.h new file mode 100644 index 0000000000..aefb3d113a --- /dev/null +++ b/engines/titanic/carry/plug_in.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_PLUG_IN_H +#define TITANIC_PLUG_IN_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CPlugIn : public CCarry { +private: + int _field12C; +public: + CPlugIn(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPlugIn"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PLUG_IN_H */ diff --git a/engines/titanic/carry/sweets.cpp b/engines/titanic/carry/sweets.cpp new file mode 100644 index 0000000000..faf3ad9dea --- /dev/null +++ b/engines/titanic/carry/sweets.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/carry/sweets.h" + +namespace Titanic { + +CSweets::CSweets() : CCarry() { +} + +void CSweets::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CCarry::save(file, indent); +} + +void CSweets::load(SimpleFile *file) { + file->readNumber(); + CCarry::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/sweets.h b/engines/titanic/carry/sweets.h new file mode 100644 index 0000000000..1912e89789 --- /dev/null +++ b/engines/titanic/carry/sweets.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_SWEETS_H +#define TITANIC_SWEETS_H + +#include "titanic/carry/carry.h" + +namespace Titanic { + +class CSweets : public CCarry { +public: + CSweets(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSweets"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SWEETS_H */ diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 83b1d3c46a..88688f2efc 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -20,6 +20,35 @@ * */ +#include "titanic/carry/arm.h" +#include "titanic/carry/brain.h" +#include "titanic/carry/bridge_piece.h" +#include "titanic/carry/carry.h" +#include "titanic/carry/carry_parrot.h" +#include "titanic/carry/chicken.h" +#include "titanic/carry/crushed_tv.h" +#include "titanic/carry/ear.h" +#include "titanic/carry/eye.h" +#include "titanic/carry/feathers.h" +#include "titanic/carry/fruit.h" +#include "titanic/carry/glass.h" +#include "titanic/carry/hammer.h" +#include "titanic/carry/head_piece.h" +#include "titanic/carry/hose.h" +#include "titanic/carry/key.h" +#include "titanic/carry/liftbot_head.h" +#include "titanic/carry/long_stick.h" +#include "titanic/carry/magazine.h" +#include "titanic/carry/mouth.h" +#include "titanic/carry/napkin.h" +#include "titanic/carry/nose.h" +#include "titanic/carry/note.h" +#include "titanic/carry/parcel.h" +#include "titanic/carry/phonograph_cylinder.h" +#include "titanic/carry/photograph.h" +#include "titanic/carry/plug_in.h" +#include "titanic/carry/sweets.h" + #include "titanic/core/saveable_object.h" #include "titanic/core/background.h" #include "titanic/core/file_item.h" @@ -121,6 +150,30 @@ Common::HashMap * #define DEFFN(T) CSaveableObject *Function##T() { return new T(); } #define ADDFN(T) (*_classList)[#T] = Function##T +DEFFN(CArm); +DEFFN(CBrain); +DEFFN(CBridgePiece); +DEFFN(CCarryParrot); +DEFFN(CChicken); +DEFFN(CCrushedTV); +DEFFN(CFeathers); +DEFFN(CFruit); +DEFFN(CGlass); +DEFFN(CHammer); +DEFFN(CHeadPiece); +DEFFN(CHose); +DEFFN(CKey); +DEFFN(CLiftbotHead); +DEFFN(CLongStick); +DEFFN(CMagazine); +DEFFN(CNapkin); +DEFFN(CNote); +DEFFN(CParcel); +DEFFN(CPhonographCylinder); +DEFFN(CPhotograph); +DEFFN(CPlugIn); +DEFFN(CSweets); + DEFFN(CBackground); DEFFN(CFileItem); DEFFN(CFileListItem); @@ -214,6 +267,30 @@ DEFFN(CAutoMusicPlayer); void CSaveableObject::initClassList() { _classList = new Common::HashMap(); + ADDFN(CArm); + ADDFN(CBrain); + ADDFN(CBridgePiece); + ADDFN(CCarryParrot); + ADDFN(CChicken); + ADDFN(CCrushedTV); + ADDFN(CFeathers); + ADDFN(CFruit); + ADDFN(CGlass); + ADDFN(CHammer); + ADDFN(CHeadPiece); + ADDFN(CHose); + ADDFN(CKey); + ADDFN(CLiftbotHead); + ADDFN(CLongStick); + ADDFN(CMagazine); + ADDFN(CNapkin); + ADDFN(CNote); + ADDFN(CParcel); + ADDFN(CPhonographCylinder); + ADDFN(CPhotograph); + ADDFN(CPlugIn); + ADDFN(CSweets); + ADDFN(CBackground); ADDFN(CFileItem); ADDFN(CFileListItem); diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 40b5b3280d..d17314a5cd 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -15,6 +15,34 @@ MODULE_OBJS := \ string.o \ titanic.o \ video_surface.o \ + carry/arm.o \ + carry/brain.o \ + carry/bridge_piece.o \ + carry/carry.o \ + carry/carry_parrot.oo \ + carry/chicken.o \ + carry/crushed_tv.o \ + carry/ear.o \ + carry/eye.o \ + carry/feathers.o \ + carry/fruit.o \ + carry/glass.o \ + carry/hammer.o \ + carry/head_piece.o \ + carry/hose.o \ + carry/key.o \ + carry/liftbot_head.o \ + carry/long_stick.o \ + carry/magazine.o \ + carry/mouth.o \ + carry/napkin.o \ + carry/nose.o \ + carry/note.o \ + carry/parcel.o \ + carry/phonograph_cylinder.o \ + carry/photograph.o \ + carry/plug_in.o \ + carry/sweets.o \ core/background.o \ core/dont_save_file_item.o \ core/file_item.o \ @@ -119,4 +147,3 @@ endif # Include common rules include $(srcdir)/rules.mk - -- cgit v1.2.3 From dd5fdcd8d9a69a11547cb96f370a8d6717eb5114 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 27 Feb 2016 10:39:01 -0500 Subject: TITANIC: Fix CCarry loading/saving --- engines/titanic/carry/carry.cpp | 15 +++++++-------- engines/titanic/carry/carry.h | 5 ++--- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/engines/titanic/carry/carry.cpp b/engines/titanic/carry/carry.cpp index 604c952658..74544896dd 100644 --- a/engines/titanic/carry/carry.cpp +++ b/engines/titanic/carry/carry.cpp @@ -24,10 +24,9 @@ namespace Titanic { -CCarry::CCarry() : CGameObject(), _fieldC8(0), _fieldCC(0), - _fieldDC(0), _fieldE0(1), _fieldFC(0), _field100(0), - _field104(0), _field108(0), _field10C(0), _field110(0), - _field120(0), _field124(0), _field128(0), +CCarry::CCarry() : CGameObject(), _fieldDC(0), _fieldE0(1), + _field100(0), _field104(0), _field108(0), _field10C(0), + _field110(0), _field120(0), _field124(0), _field128(0), _string1("None"), _string2("NULL"), _string3("That doesn't seem to do anything."), @@ -37,13 +36,13 @@ CCarry::CCarry() : CGameObject(), _fieldC8(0), _fieldCC(0), void CCarry::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); file->writeQuotedLine(_string1, indent); - file->writeNumberLine(_fieldC8, indent); + file->writePoint(_pos1, indent); file->writeQuotedLine(_string2, indent); file->writeNumberLine(_fieldDC, indent); file->writeNumberLine(_fieldE0, indent); file->writeQuotedLine(_string3, indent); file->writeQuotedLine(_string4, indent); - file->writeNumberLine(_fieldFC, indent); + file->writePoint(_pos2, indent); file->writeNumberLine(_field104, indent); file->writeNumberLine(_field108, indent); file->writeNumberLine(_field10C, indent); @@ -59,13 +58,13 @@ void CCarry::save(SimpleFile *file, int indent) const { void CCarry::load(SimpleFile *file) { file->readNumber(); _string1 = file->readString(); - _fieldC8 = file->readNumber(); + _pos1 = file->readPoint(); _string2 = file->readString(); _fieldDC = file->readNumber(); _fieldE0 = file->readNumber(); _string3 = file->readString(); _string4 = file->readString(); - _fieldFC = file->readNumber(); + _pos2 = file->readPoint(); _field104 = file->readNumber(); _field108 = file->readNumber(); _field10C = file->readNumber(); diff --git a/engines/titanic/carry/carry.h b/engines/titanic/carry/carry.h index 4bf98b7132..b83ecb7aca 100644 --- a/engines/titanic/carry/carry.h +++ b/engines/titanic/carry/carry.h @@ -30,14 +30,13 @@ namespace Titanic { class CCarry : public CGameObject { private: CString _string1; - int _fieldC8; - int _fieldCC; + Common::Point _pos1; CString _string2; int _fieldDC; int _fieldE0; CString _string3; CString _string4; - int _fieldFC; + Common::Point _pos2; int _field100; int _field104; int _field108; -- cgit v1.2.3 From 9364b2791746dd76b0cec46af4d58da1c347f5bb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 27 Feb 2016 11:49:48 -0500 Subject: TITANIC: Implemented state room classes --- engines/titanic/core/saveable_object.cpp | 10 +++ engines/titanic/game/doorbot_home_handler.cpp | 40 ++++++++++ engines/titanic/game/doorbot_home_handler.h | 52 +++++++++++++ engines/titanic/game/drawer.cpp | 42 +++++++++++ engines/titanic/game/drawer.h | 54 ++++++++++++++ engines/titanic/game/drop_target.cpp | 72 ++++++++++++++++++ engines/titanic/game/drop_target.h | 67 +++++++++++++++++ engines/titanic/game/sgt_state_room.cpp | 85 ++++++++++++++++++++++ engines/titanic/game/sgt_state_room.h | 77 ++++++++++++++++++++ .../messages/doorbot_needed_in_elevator_msg.cpp | 46 ++++++++++++ .../messages/doorbot_needed_in_elevator_msg.h | 55 ++++++++++++++ .../messages/doorbot_needed_in_home_msg.cpp | 46 ++++++++++++ .../titanic/messages/doorbot_needed_in_home_msg.h | 55 ++++++++++++++ engines/titanic/messages/drop_object_msg.cpp | 46 ++++++++++++ engines/titanic/messages/drop_object_msg.h | 55 ++++++++++++++ .../titanic/messages/drop_zone_got_object_msg.cpp | 46 ++++++++++++ .../titanic/messages/drop_zone_got_object_msg.h | 55 ++++++++++++++ engines/titanic/messages/message.cpp | 39 ++++++++++ engines/titanic/messages/message.h | 52 +++++++++++++ engines/titanic/module.mk | 9 +++ 20 files changed, 1003 insertions(+) create mode 100644 engines/titanic/game/doorbot_home_handler.cpp create mode 100644 engines/titanic/game/doorbot_home_handler.h create mode 100644 engines/titanic/game/drawer.cpp create mode 100644 engines/titanic/game/drawer.h create mode 100644 engines/titanic/game/drop_target.cpp create mode 100644 engines/titanic/game/drop_target.h create mode 100644 engines/titanic/game/sgt_state_room.cpp create mode 100644 engines/titanic/game/sgt_state_room.h create mode 100644 engines/titanic/messages/doorbot_needed_in_elevator_msg.cpp create mode 100644 engines/titanic/messages/doorbot_needed_in_elevator_msg.h create mode 100644 engines/titanic/messages/doorbot_needed_in_home_msg.cpp create mode 100644 engines/titanic/messages/doorbot_needed_in_home_msg.h create mode 100644 engines/titanic/messages/drop_object_msg.cpp create mode 100644 engines/titanic/messages/drop_object_msg.h create mode 100644 engines/titanic/messages/drop_zone_got_object_msg.cpp create mode 100644 engines/titanic/messages/drop_zone_got_object_msg.h create mode 100644 engines/titanic/messages/message.cpp create mode 100644 engines/titanic/messages/message.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 88688f2efc..f76163318c 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -70,10 +70,14 @@ #include "titanic/game/cdrom_tray.h" #include "titanic/game/computer_screen.h" #include "titanic/game/dead_area.h" +#include "titanic/game/doorbot_home_handler.h" +#include "titanic/game/drawer.h" +#include "titanic/game/drop_target.h" #include "titanic/game/hammer_dispensor_button.h" #include "titanic/game/pet_position.h" #include "titanic/game/room_item.h" #include "titanic/game/service_elevator_door.h" +#include "titanic/game/sgt_state_room.h" #include "titanic/game/start_action.h" #include "titanic/game/sub_glass.h" #include "titanic/game/television.h" @@ -194,10 +198,13 @@ DEFFN(CCDROMComputer); DEFFN(CCDROMTray); DEFFN(CComputerScreen); DEFFN(CDeadArea); +DEFFN(CDoorbotHomeHandler); +DEFFN(CDropTarget); DEFFN(CHammerDispensorButton); DEFFN(CPETPosition); DEFFN(CRoomItem); DEFFN(CServiceElevatorDoor); +DEFFN(CSGTStateRoom); DEFFN(CStartAction); DEFFN(CSUBGlass); DEFFN(CTelevision); @@ -311,10 +318,13 @@ void CSaveableObject::initClassList() { ADDFN(CCDROMTray); ADDFN(CComputerScreen); ADDFN(CDeadArea); + ADDFN(CDoorbotHomeHandler); + ADDFN(CDropTarget); ADDFN(CHammerDispensorButton); ADDFN(CPETPosition); ADDFN(CRoomItem); ADDFN(CServiceElevatorDoor); + ADDFN(CSGTStateRoom); ADDFN(CStartAction); ADDFN(CSUBGlass); ADDFN(CTelevision); diff --git a/engines/titanic/game/doorbot_home_handler.cpp b/engines/titanic/game/doorbot_home_handler.cpp new file mode 100644 index 0000000000..5d250172b1 --- /dev/null +++ b/engines/titanic/game/doorbot_home_handler.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/game/doorbot_home_handler.h" + +namespace Titanic { + +CDoorbotHomeHandler::CDoorbotHomeHandler() { +} + +void CDoorbotHomeHandler::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CDoorbotHomeHandler::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/doorbot_home_handler.h b/engines/titanic/game/doorbot_home_handler.h new file mode 100644 index 0000000000..1557dbf91d --- /dev/null +++ b/engines/titanic/game/doorbot_home_handler.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_DOORBOT_HOME_HANDLER_H +#define TITANIC_DOORBOT_HOME_HANDLER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CDoorbotHomeHandler : public CGameObject { +public: + CDoorbotHomeHandler(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CDoorbotHomeHandler"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DOORBOT_HOME_HANDLER_H */ diff --git a/engines/titanic/game/drawer.cpp b/engines/titanic/game/drawer.cpp new file mode 100644 index 0000000000..3409522f9d --- /dev/null +++ b/engines/titanic/game/drawer.cpp @@ -0,0 +1,42 @@ +/* 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 "titanic/game/drawer.h" + +namespace Titanic { + +CDrawer::CDrawer() : CSGTStateRoom(), _fieldF4(0) { +} + +void CDrawer::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldF4, indent); + CSGTStateRoom::save(file, indent); +} + +void CDrawer::load(SimpleFile *file) { + file->readNumber(); + _fieldF4 = file->readNumber(); + CSGTStateRoom::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/drawer.h b/engines/titanic/game/drawer.h new file mode 100644 index 0000000000..020b1059c0 --- /dev/null +++ b/engines/titanic/game/drawer.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_DRAWER_H +#define TITANIC_DRAWER_H + +#include "titanic/game/sgt_state_room.h" + +namespace Titanic { + +class CDrawer : public CSGTStateRoom { +private: + int _fieldF4; +public: + CDrawer(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CDrawer"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DRAWER_H */ diff --git a/engines/titanic/game/drop_target.cpp b/engines/titanic/game/drop_target.cpp new file mode 100644 index 0000000000..34a87e067e --- /dev/null +++ b/engines/titanic/game/drop_target.cpp @@ -0,0 +1,72 @@ +/* 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 "titanic/game/drop_target.h" + +namespace Titanic { + +CDropTarget::CDropTarget() : CGameObject(), _fieldC4(0), + _fieldD4(0), _fieldE4(0), _fieldF4(0), _fieldF8(0), + _fieldFC(0), _field10C(1), _field110(8), _field114(20) { +} + +void CDropTarget::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writePoint(_pos1, indent); + file->writeNumberLine(_fieldC4, indent); + file->writeQuotedLine(_string1, indent); + file->writeNumberLine(_fieldD4, indent); + file->writeQuotedLine(_string2, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeQuotedLine(_string3, indent); + file->writeNumberLine(_fieldF4, indent); + file->writeNumberLine(_fieldF8, indent); + file->writeNumberLine(_fieldFC, indent); + file->writeQuotedLine(_string4, indent); + file->writeNumberLine(_field10C, indent); + file->writeNumberLine(_field110, indent); + file->writeNumberLine(_field114, indent); + + CGameObject::save(file, indent); +} + +void CDropTarget::load(SimpleFile *file) { + file->readNumber(); + _pos1 = file->readPoint(); + _fieldC4 = file->readNumber(); + _string1 = file->readString(); + _fieldD4 = file->readNumber(); + _string2 = file->readString(); + _fieldE4 = file->readNumber(); + _string3 = file->readString(); + _fieldF4 = file->readNumber(); + _fieldF8 = file->readNumber(); + _fieldFC = file->readNumber(); + _string4 = file->readString(); + _field10C = file->readNumber(); + _field110 = file->readNumber(); + _field114 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/drop_target.h b/engines/titanic/game/drop_target.h new file mode 100644 index 0000000000..b106623f62 --- /dev/null +++ b/engines/titanic/game/drop_target.h @@ -0,0 +1,67 @@ +/* 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. + * + */ + +#ifndef TITANIC_DROP_TARGET_H +#define TITANIC_DROP_TARGET_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CDropTarget : public CGameObject { +private: + Common::Point _pos1; + int _fieldC4; + CString _string1; + int _fieldD4; + CString _string2; + int _fieldE4; + CString _string3; + int _fieldF4; + int _fieldF8; + int _fieldFC; + CString _string4; + int _field10C; + int _field110; + int _field114; +public: + CDropTarget(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CDropTarget"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DROP_TARGET_H */ diff --git a/engines/titanic/game/sgt_state_room.cpp b/engines/titanic/game/sgt_state_room.cpp new file mode 100644 index 0000000000..10bec50781 --- /dev/null +++ b/engines/titanic/game/sgt_state_room.cpp @@ -0,0 +1,85 @@ +/* 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 "titanic/game/sgt_state_room.h" + +namespace Titanic { + +CSGTStateRoomStatics *_statics; + +CSGTStateRoom::CSGTStateRoom() : CBackground(), _fieldE0(1), + _fieldE4(1), _fieldE8(0), _fieldEC(1), _fieldF0(1) { +} + +void CSGTStateRoom::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_statics->_v1, indent); + file->writeQuotedLine(_statics->_v2, indent); + file->writeQuotedLine(_statics->_v3, indent); + file->writeQuotedLine(_statics->_v4, indent); + file->writeQuotedLine(_statics->_v5, indent); + file->writeQuotedLine(_statics->_v6, indent); + file->writeQuotedLine(_statics->_v7, indent); + file->writeQuotedLine(_statics->_v8, indent); + file->writeQuotedLine(_statics->_v9, indent); + file->writeQuotedLine(_statics->_v10, indent); + file->writeQuotedLine(_statics->_v11, indent); + file->writeQuotedLine(_statics->_v12, indent); + + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_statics->_v13, indent); + file->writeNumberLine(_statics->_v14, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_fieldEC, indent); + file->writeNumberLine(_fieldF0, indent); + + CBackground::save(file, indent); +} + +void CSGTStateRoom::load(SimpleFile *file) { + file->readNumber(); + _statics->_v1 = file->readString(); + _statics->_v2 = file->readString(); + _statics->_v3 = file->readString(); + _statics->_v4 = file->readString(); + _statics->_v5 = file->readString(); + _statics->_v6 = file->readString(); + _statics->_v7 = file->readString(); + _statics->_v8 = file->readString(); + _statics->_v9 = file->readString(); + _statics->_v10 = file->readString(); + _statics->_v11 = file->readString(); + _statics->_v12 = file->readString(); + + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _statics->_v13 = file->readNumber(); + _statics->_v14 = file->readNumber(); + _fieldE8 = file->readNumber(); + _fieldEC = file->readNumber(); + _fieldF0 = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt_state_room.h b/engines/titanic/game/sgt_state_room.h new file mode 100644 index 0000000000..ba70e541a3 --- /dev/null +++ b/engines/titanic/game/sgt_state_room.h @@ -0,0 +1,77 @@ +/* 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. + * + */ + +#ifndef TITANIC_SGT_STATE_ROOM_H +#define TITANIC_SGT_STATE_ROOM_H + +#include "titanic/core/background.h" + +namespace Titanic { + +struct CSGTStateRoomStatics { + CString _v1; + CString _v2; + CString _v3; + CString _v4; + CString _v5; + CString _v6; + CString _v7; + CString _v8; + CString _v9; + CString _v10; + CString _v11; + CString _v12; + int _v13; + int _v14; +}; + +class CSGTStateRoom : public CBackground { +private: + CSGTStateRoomStatics *_statics; +private: + int _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; + int _fieldF0; +public: + CSGTStateRoom(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSGTStateRoom"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SGT_STATE_ROOM_H */ diff --git a/engines/titanic/messages/doorbot_needed_in_elevator_msg.cpp b/engines/titanic/messages/doorbot_needed_in_elevator_msg.cpp new file mode 100644 index 0000000000..a9c8fc3dcd --- /dev/null +++ b/engines/titanic/messages/doorbot_needed_in_elevator_msg.cpp @@ -0,0 +1,46 @@ +/* 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 "titanic/messages/auto_sound_event.h" + +namespace Titanic { + +CAutoSoundEvent::CAutoSoundEvent() : CGameObject(), _fieldBC(-1), _fieldC0(0xFFFFFF) { +} + +void CAutoSoundEvent::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + + CGameObject::save(file, indent); +} + +void CAutoSoundEvent::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/doorbot_needed_in_elevator_msg.h b/engines/titanic/messages/doorbot_needed_in_elevator_msg.h new file mode 100644 index 0000000000..50b2c3f793 --- /dev/null +++ b/engines/titanic/messages/doorbot_needed_in_elevator_msg.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_DOORBOT_NEEDED_IN_ELEVATOR_MSG_H +#define TITANIC_DOORBOT_NEEDED_IN_ELEVATOR_MSG_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CAutoSoundEvent : public CMessage { +protected: + int _fieldBC; + int _fieldC0; +public: + CAutoSoundEvent(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CAutoSoundEvent"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DOORBOT_NEEDED_IN_ELEVATOR_MSG_H */ diff --git a/engines/titanic/messages/doorbot_needed_in_home_msg.cpp b/engines/titanic/messages/doorbot_needed_in_home_msg.cpp new file mode 100644 index 0000000000..a9c8fc3dcd --- /dev/null +++ b/engines/titanic/messages/doorbot_needed_in_home_msg.cpp @@ -0,0 +1,46 @@ +/* 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 "titanic/messages/auto_sound_event.h" + +namespace Titanic { + +CAutoSoundEvent::CAutoSoundEvent() : CGameObject(), _fieldBC(-1), _fieldC0(0xFFFFFF) { +} + +void CAutoSoundEvent::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + + CGameObject::save(file, indent); +} + +void CAutoSoundEvent::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/doorbot_needed_in_home_msg.h b/engines/titanic/messages/doorbot_needed_in_home_msg.h new file mode 100644 index 0000000000..f3a805c1e1 --- /dev/null +++ b/engines/titanic/messages/doorbot_needed_in_home_msg.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_AUTO_SOUND_EVENT_H +#define TITANIC_AUTO_SOUND_EVENT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CAutoSoundEvent : public CGameObject { +protected: + int _fieldBC; + int _fieldC0; +public: + CAutoSoundEvent(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CAutoSoundEvent"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/messages/drop_object_msg.cpp b/engines/titanic/messages/drop_object_msg.cpp new file mode 100644 index 0000000000..a9c8fc3dcd --- /dev/null +++ b/engines/titanic/messages/drop_object_msg.cpp @@ -0,0 +1,46 @@ +/* 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 "titanic/messages/auto_sound_event.h" + +namespace Titanic { + +CAutoSoundEvent::CAutoSoundEvent() : CGameObject(), _fieldBC(-1), _fieldC0(0xFFFFFF) { +} + +void CAutoSoundEvent::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + + CGameObject::save(file, indent); +} + +void CAutoSoundEvent::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/drop_object_msg.h b/engines/titanic/messages/drop_object_msg.h new file mode 100644 index 0000000000..f3a805c1e1 --- /dev/null +++ b/engines/titanic/messages/drop_object_msg.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_AUTO_SOUND_EVENT_H +#define TITANIC_AUTO_SOUND_EVENT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CAutoSoundEvent : public CGameObject { +protected: + int _fieldBC; + int _fieldC0; +public: + CAutoSoundEvent(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CAutoSoundEvent"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/messages/drop_zone_got_object_msg.cpp b/engines/titanic/messages/drop_zone_got_object_msg.cpp new file mode 100644 index 0000000000..a9c8fc3dcd --- /dev/null +++ b/engines/titanic/messages/drop_zone_got_object_msg.cpp @@ -0,0 +1,46 @@ +/* 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 "titanic/messages/auto_sound_event.h" + +namespace Titanic { + +CAutoSoundEvent::CAutoSoundEvent() : CGameObject(), _fieldBC(-1), _fieldC0(0xFFFFFF) { +} + +void CAutoSoundEvent::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + + CGameObject::save(file, indent); +} + +void CAutoSoundEvent::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/drop_zone_got_object_msg.h b/engines/titanic/messages/drop_zone_got_object_msg.h new file mode 100644 index 0000000000..f3a805c1e1 --- /dev/null +++ b/engines/titanic/messages/drop_zone_got_object_msg.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_AUTO_SOUND_EVENT_H +#define TITANIC_AUTO_SOUND_EVENT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CAutoSoundEvent : public CGameObject { +protected: + int _fieldBC; + int _fieldC0; +public: + CAutoSoundEvent(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CAutoSoundEvent"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/messages/message.cpp b/engines/titanic/messages/message.cpp new file mode 100644 index 0000000000..08df20e6a8 --- /dev/null +++ b/engines/titanic/messages/message.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/messages/message.h" + +namespace Titanic { + +CMessage::CMessage() : CSaveableObject() { +} + +void CMessage::save(SimpleFile *file, int indent) const { + file->writeNumberLine(0, indent); +} + +void CMessage::load(SimpleFile *file) { + file->readNumber(); + CSaveableObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/message.h b/engines/titanic/messages/message.h new file mode 100644 index 0000000000..59cc94ec08 --- /dev/null +++ b/engines/titanic/messages/message.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_MESSAGE_H +#define TITANIC_MESSAGE_H + +#include "titanic/core/saveable_object.h" + +namespace Titanic { + +class CMessage : public CSaveableObject { +public: + CMessage(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMessage"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MESSAGE_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index d17314a5cd..1c7e5a5c1e 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -67,10 +67,14 @@ MODULE_OBJS := \ game/cdrom_tray.o \ game/computer_screen.o \ game/dead_area.o \ + game/doorbot_home_handler.o \ + game/drawer.o \ + game/drop_target.o \ game/hammer_dispensor_button.o \ game/pet_position.o \ game/room_item.o \ game/service_elevator_door.o \ + game/sgt_state_room.o \ game/start_action.o \ game/sub_glass.o \ game/television.o \ @@ -107,6 +111,11 @@ MODULE_OBJS := \ gfx/toggle_switch.o \ messages/auto_sound_event.o \ messages/door_auto_sound_event.o \ + messages/doorbot_needed_in_elevator_msg.o \ + messages/doorbot_needed_in_home_msg.o \ + messages/drop_object_msg.o \ + messages/drop_zone_got_object_msg.o \ + messages/message.o \ moves/enter_bomb_room.o \ moves/exit_arboretum.o \ moves/exit_bridge.o \ -- cgit v1.2.3 From def2a92ebfad1d7ff6b23ca5e82aa2148a7ade45 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 27 Feb 2016 21:04:47 -0500 Subject: TITANIC: Add event class definitions --- engines/titanic/core/saveable_object.cpp | 332 ++++++++++++++++++++- .../messages/doorbot_needed_in_elevator_msg.cpp | 46 --- .../messages/doorbot_needed_in_elevator_msg.h | 55 ---- .../messages/doorbot_needed_in_home_msg.cpp | 46 --- .../titanic/messages/doorbot_needed_in_home_msg.h | 55 ---- engines/titanic/messages/drop_object_msg.cpp | 46 --- engines/titanic/messages/drop_object_msg.h | 55 ---- .../titanic/messages/drop_zone_got_object_msg.cpp | 46 --- .../titanic/messages/drop_zone_got_object_msg.h | 55 ---- engines/titanic/messages/edit_control_msg.h | 50 ++++ engines/titanic/messages/is_hooked_on_msg.h | 50 ++++ engines/titanic/messages/lights_msg.h | 48 +++ engines/titanic/messages/message.h | 217 ++++++++++++++ engines/titanic/messages/sub_accept_ccarry_msg.h | 45 +++ engines/titanic/messages/transport_msg.h | 45 +++ engines/titanic/module.mk | 4 - 16 files changed, 785 insertions(+), 410 deletions(-) delete mode 100644 engines/titanic/messages/doorbot_needed_in_elevator_msg.cpp delete mode 100644 engines/titanic/messages/doorbot_needed_in_elevator_msg.h delete mode 100644 engines/titanic/messages/doorbot_needed_in_home_msg.cpp delete mode 100644 engines/titanic/messages/doorbot_needed_in_home_msg.h delete mode 100644 engines/titanic/messages/drop_object_msg.cpp delete mode 100644 engines/titanic/messages/drop_object_msg.h delete mode 100644 engines/titanic/messages/drop_zone_got_object_msg.cpp delete mode 100644 engines/titanic/messages/drop_zone_got_object_msg.h create mode 100644 engines/titanic/messages/edit_control_msg.h create mode 100644 engines/titanic/messages/is_hooked_on_msg.h create mode 100644 engines/titanic/messages/lights_msg.h create mode 100644 engines/titanic/messages/sub_accept_ccarry_msg.h create mode 100644 engines/titanic/messages/transport_msg.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index f76163318c..fdb8df6955 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -114,8 +114,12 @@ #include "titanic/gfx/st_button.h" #include "titanic/gfx/toggle_switch.h" -#include "titanic/messages/auto_sound_event.h" -#include "titanic/messages/door_auto_sound_event.h" +#include "titanic/messages/message.h" +#include "titanic/messages/edit_control_msg.h" +#include "titanic/messages/is_hooked_on_msg.h" +#include "titanic/messages/lights_msg.h" +#include "titanic/messages/sub_accept_ccarry_msg.h" +#include "titanic/messages/transport_msg.h" #include "titanic/moves/enter_bomb_room.h" #include "titanic/moves/exit_arboretum.h" @@ -240,8 +244,170 @@ DEFFN(CSmallChevRightOn); DEFFN(CStatusChangeButton); DEFFN(CSTButton); +DEFFN(CActMsg); +DEFFN(CActivationmsg); +DEFFN(CAddHeadPieceMsg); +DEFFN(CAnimateMaitreDMsg); +DEFFN(CArboretumGateMsg); +DEFFN(CArmPickedUpFromTableMsg); DEFFN(CAutoSoundEvent); +DEFFN(CBodyInBilgeRoomMsg); +DEFFN(CBowlStateChange); +DEFFN(CCarryObjectArrivedMsg); +DEFFN(CChangeSeasonMsg); +DEFFN(CCheckAllPossibleCodes); +DEFFN(CCheckChevCode); +DEFFN(CChildDragEndMsg); +DEFFN(CChildDragMoveMsg); +DEFFN(CChildDragStartMsg); +DEFFN(CClearChevPanelBits); +DEFFN(CCorrectMusicPlayedMsg); +DEFFN(CCreateMusicPlayerMsg); +DEFFN(CCylinderHolderReadyMsg); +DEFFN(CDeactivationMsg); +DEFFN(CDeliverCCarryMsg); +DEFFN(CDisableMaitreDProdReceptor); +DEFFN(CDismissBotMsg); +DEFFN(CDoffNavHelmet); +DEFFN(CDonNavHelmet); DEFFN(CDoorAutoSoundEvent); +DEFFN(CDoorbotNeededInElevatorMsg); +DEFFN(CDoorbotNeededInHomeMsg); +DEFFN(CDropobjectMsg); +DEFFN(CDropZoneGotObjectMsg); +DEFFN(CDropZoneLostObjectMsg); +DEFFN(CEditControlMsg); +DEFFN(CEjectCylinderMsg); +DEFFN(CErasePhonographCylinderMsg); +DEFFN(CFreshenCookieMsg); +DEFFN(CGetChevClassBits); +DEFFN(CGetChevClassNum); +DEFFN(CGetChevCodeFromRoomNameMsg); +DEFFN(CGetChevFloorBits); +DEFFN(CGetChevFloorNum); +DEFFN(CGetChevLiftBits); +DEFFN(CGetChevLiftNum); +DEFFN(CGetChevRoomBits); +DEFFN(CGetChevRoomNum); +DEFFN(CHoseConnectedMsg); +DEFFN(CInitializeAnimMsg); +DEFFN(CIsEarBowlPuzzleDone); +DEFFN(CIsHookedOnMsg); +DEFFN(CIsParrotPresentMsg); +DEFFN(CKeyCharMsg); +DEFFN(CLemonFallsFromTreeMsg); +DEFFN(CLightsMsg); +DEFFN(CLockPhonographMsg); +DEFFN(CMaitreDDefeatedMsg); +DEFFN(CMaitreDHappyMsg); +DEFFN(CMissiveOMatActionMsg); +DEFFN(CMoveToStartPosMsg); +DEFFN(CMovieEndMsg); +DEFFN(CMovieFrameMsg); +DEFFN(CMusicHasStartedMsg); +DEFFN(CMusicHasStoppedMsg); +DEFFN(CMusicSettingChangedMsg); +DEFFN(CNPCPlayAnimationMsg); +DEFFN(CNPCPlayIdleAnimationMsg); +DEFFN(CNPCPlayTalkingAnimationMsg); +DEFFN(CNPCQueueIdleAnimMsg); +DEFFN(CNutPuzzleMsg); +DEFFN(COnSummonBotMsg); +DEFFN(COpeningCreditsMsg); +DEFFN(CPETDeliverMsg); +DEFFN(CPETGainedObjectMsg); +DEFFN(CPETHelmetOnOffMsg); +DEFFN(CPETKeyboardOnOffMsg); +DEFFN(CPETLostObjectMsg); +DEFFN(CPETObjectSelectedMsg); +DEFFN(CPETObjectStateMsg); +DEFFN(CPETPhotoOnOffMsg); +DEFFN(CPETPlaySoundMsg); +DEFFN(CPETReceiveMsg); +DEFFN(CPETSetStarDestinationMsg); +DEFFN(CPETStarFieldLockMsg); +DEFFN(CPETStereoFieldOnOffMsg); +DEFFN(CPETTargetMsg); +DEFFN(CPanningAwayFromParrotMsg); +DEFFN(CParrotSpeakMsg); +DEFFN(CParrotTriesChickenMsg); +DEFFN(CPassOnDragStartMsg); +DEFFN(CPhonographPlayMsg); +DEFFN(CPhonographReadyToPlayMsg); +DEFFN(CPhonographRecordMsg); +DEFFN(CPhonographStopMsg); +DEFFN(CPlayRangeMsg); +DEFFN(CPlayerTriesRestaurantTableMsg); +DEFFN(CPreSaveMsg); +DEFFN(CProdMaitreDMsg); +DEFFN(CPumpingMsg); +DEFFN(CPutBotBackInHisBoxMsg); +DEFFN(CPutParrotBackMsg); +DEFFN(CPuzzleSolvedMsg); +DEFFN(CQueryCylinderHolderMsg); +DEFFN(CQueryCylinderMsg); +DEFFN(CQueryCylinderNameMsg); +DEFFN(CQueryCylinderTypeMsg); +DEFFN(CQueryMusicControlSettingMsg); +DEFFN(CQueryPhonographState); +DEFFN(CRecordOntoCylinderMsg); +DEFFN(CRemoveFromGameMsg); +DEFFN(CReplaceBowlAndNutsMsg); +DEFFN(CRestaurantMusicChanged); +DEFFN(CSendCCarryMsg); +DEFFN(CSenseWorkingMsg); +DEFFN(CServiceElevatorFloorChangeMsg); +DEFFN(CServiceElevatorFloorRequestMsg); +DEFFN(CServiceElevatorMsg); +DEFFN(CSetChevButtonImageMsg); +DEFFN(CSetChevClassBits); +DEFFN(CSetChevFloorBits); +DEFFN(CSetChevLiftBits); +DEFFN(CSetChevPanelBitMsg); +DEFFN(CSetChevPanelButtonsMsg); +DEFFN(CSetChevRoomBits); +DEFFN(CSetMusicControlsMsg); +DEFFN(CSetVarMsg); +DEFFN(CSetVolumeMsg); +DEFFN(CShipSettingMsg); +DEFFN(CShowTextMsg); +DEFFN(CSignalObject); +DEFFN(CSpeechFallsFromTreeMsg); +DEFFN(CStartMusicMsg); +DEFFN(CStatusChangeMsg); +DEFFN(CStopMusicMsg); +DEFFN(CSubAcceptCCarryMsg); +DEFFN(CSubDeliverCCarryMsg); +DEFFN(CSubSendCCarryMsg); +DEFFN(CSUBTransition); +DEFFN(CSubTurnOffMsg); +DEFFN(CSubTurnOnMsg); +DEFFN(CSummonBotMsg); +DEFFN(CSummonBotQuerryMsg); +DEFFN(CTakeHeadPieceMsg); +DEFFN(CTextInputMsg); +DEFFN(CTimeDilationMsg); +DEFFN(CTimeMsg); +DEFFN(CTitleSequenceEndedMsg); +DEFFN(CTransitMsg); +DEFFN(CTransportMsg); +DEFFN(CTriggerAutoMusicPlayerMsg); +DEFFN(CTriggerNPCEvent); +DEFFN(CTrueTalkGetAnimSetMsg); +DEFFN(CTrueTalkGetAssetDetailsMsg); +DEFFN(CTrueTalkGetStateValueMsg); +DEFFN(CTrueTalkNotifySpeechEndedMsg); +DEFFN(CTrueTalkNotifySpeechStartedMsg); +DEFFN(CTrueTalkQueueUpAnimSetMsg); +DEFFN(CTrueTalkSelfQueueAnimSetMsg); +DEFFN(CTrueTalkTriggerActionMsg); +DEFFN(CTurnOff); +DEFFN(CTurnOn); +DEFFN(CUse); +DEFFN(CUseWithCharMsg); +DEFFN(CUseWithOtherMsg); +DEFFN(CVirtualKeyCharMsg); +DEFFN(CVisibleMsg); DEFFN(CEnterBombRoom); DEFFN(CExitArboretum); @@ -360,8 +526,170 @@ void CSaveableObject::initClassList() { ADDFN(CStatusChangeButton); ADDFN(CSTButton); + ADDFN(CActMsg); + ADDFN(CActivationmsg); + ADDFN(CAddHeadPieceMsg); + ADDFN(CAnimateMaitreDMsg); + ADDFN(CArboretumGateMsg); + ADDFN(CArmPickedUpFromTableMsg); ADDFN(CAutoSoundEvent); + ADDFN(CBodyInBilgeRoomMsg); + ADDFN(CBowlStateChange); + ADDFN(CCarryObjectArrivedMsg); + ADDFN(CChangeSeasonMsg); + ADDFN(CCheckAllPossibleCodes); + ADDFN(CCheckChevCode); + ADDFN(CChildDragEndMsg); + ADDFN(CChildDragMoveMsg); + ADDFN(CChildDragStartMsg); + ADDFN(CClearChevPanelBits); + ADDFN(CCorrectMusicPlayedMsg); + ADDFN(CCreateMusicPlayerMsg); + ADDFN(CCylinderHolderReadyMsg); + ADDFN(CDeactivationMsg); + ADDFN(CDeliverCCarryMsg); + ADDFN(CDisableMaitreDProdReceptor); + ADDFN(CDismissBotMsg); + ADDFN(CDoffNavHelmet); + ADDFN(CDonNavHelmet); ADDFN(CDoorAutoSoundEvent); + ADDFN(CDoorbotNeededInElevatorMsg); + ADDFN(CDoorbotNeededInHomeMsg); + ADDFN(CDropobjectMsg); + ADDFN(CDropZoneGotObjectMsg); + ADDFN(CDropZoneLostObjectMsg); + ADDFN(CEditControlMsg); + ADDFN(CEjectCylinderMsg); + ADDFN(CErasePhonographCylinderMsg); + ADDFN(CFreshenCookieMsg); + ADDFN(CGetChevClassBits); + ADDFN(CGetChevClassNum); + ADDFN(CGetChevCodeFromRoomNameMsg); + ADDFN(CGetChevFloorBits); + ADDFN(CGetChevFloorNum); + ADDFN(CGetChevLiftBits); + ADDFN(CGetChevLiftNum); + ADDFN(CGetChevRoomBits); + ADDFN(CGetChevRoomNum); + ADDFN(CHoseConnectedMsg); + ADDFN(CInitializeAnimMsg); + ADDFN(CIsEarBowlPuzzleDone); + ADDFN(CIsHookedOnMsg); + ADDFN(CIsParrotPresentMsg); + ADDFN(CKeyCharMsg); + ADDFN(CLemonFallsFromTreeMsg); + ADDFN(CLightsMsg); + ADDFN(CLockPhonographMsg); + ADDFN(CMaitreDDefeatedMsg); + ADDFN(CMaitreDHappyMsg); + ADDFN(CMissiveOMatActionMsg); + ADDFN(CMoveToStartPosMsg); + ADDFN(CMovieEndMsg); + ADDFN(CMovieFrameMsg); + ADDFN(CMusicHasStartedMsg); + ADDFN(CMusicHasStoppedMsg); + ADDFN(CMusicSettingChangedMsg); + ADDFN(CNPCPlayAnimationMsg); + ADDFN(CNPCPlayIdleAnimationMsg); + ADDFN(CNPCPlayTalkingAnimationMsg); + ADDFN(CNPCQueueIdleAnimMsg); + ADDFN(CNutPuzzleMsg); + ADDFN(COnSummonBotMsg); + ADDFN(COpeningCreditsMsg); + ADDFN(CPETDeliverMsg); + ADDFN(CPETGainedObjectMsg); + ADDFN(CPETHelmetOnOffMsg); + ADDFN(CPETKeyboardOnOffMsg); + ADDFN(CPETLostObjectMsg); + ADDFN(CPETObjectSelectedMsg); + ADDFN(CPETObjectStateMsg); + ADDFN(CPETPhotoOnOffMsg); + ADDFN(CPETPlaySoundMsg); + ADDFN(CPETReceiveMsg); + ADDFN(CPETSetStarDestinationMsg); + ADDFN(CPETStarFieldLockMsg); + ADDFN(CPETStereoFieldOnOffMsg); + ADDFN(CPETTargetMsg); + ADDFN(CPanningAwayFromParrotMsg); + ADDFN(CParrotSpeakMsg); + ADDFN(CParrotTriesChickenMsg); + ADDFN(CPassOnDragStartMsg); + ADDFN(CPhonographPlayMsg); + ADDFN(CPhonographReadyToPlayMsg); + ADDFN(CPhonographRecordMsg); + ADDFN(CPhonographStopMsg); + ADDFN(CPlayRangeMsg); + ADDFN(CPlayerTriesRestaurantTableMsg); + ADDFN(CPreSaveMsg); + ADDFN(CProdMaitreDMsg); + ADDFN(CPumpingMsg); + ADDFN(CPutBotBackInHisBoxMsg); + ADDFN(CPutParrotBackMsg); + ADDFN(CPuzzleSolvedMsg); + ADDFN(CQueryCylinderHolderMsg); + ADDFN(CQueryCylinderMsg); + ADDFN(CQueryCylinderNameMsg); + ADDFN(CQueryCylinderTypeMsg); + ADDFN(CQueryMusicControlSettingMsg); + ADDFN(CQueryPhonographState); + ADDFN(CRecordOntoCylinderMsg); + ADDFN(CRemoveFromGameMsg); + ADDFN(CReplaceBowlAndNutsMsg); + ADDFN(CRestaurantMusicChanged); + ADDFN(CSendCCarryMsg); + ADDFN(CSenseWorkingMsg); + ADDFN(CServiceElevatorFloorChangeMsg); + ADDFN(CServiceElevatorFloorRequestMsg); + ADDFN(CServiceElevatorMsg); + ADDFN(CSetChevButtonImageMsg); + ADDFN(CSetChevClassBits); + ADDFN(CSetChevFloorBits); + ADDFN(CSetChevLiftBits); + ADDFN(CSetChevPanelBitMsg); + ADDFN(CSetChevPanelButtonsMsg); + ADDFN(CSetChevRoomBits); + ADDFN(CSetMusicControlsMsg); + ADDFN(CSetVarMsg); + ADDFN(CSetVolumeMsg); + ADDFN(CShipSettingMsg); + ADDFN(CShowTextMsg); + ADDFN(CSignalObject); + ADDFN(CSpeechFallsFromTreeMsg); + ADDFN(CStartMusicMsg); + ADDFN(CStatusChangeMsg); + ADDFN(CStopMusicMsg); + ADDFN(CSubAcceptCCarryMsg); + ADDFN(CSubDeliverCCarryMsg); + ADDFN(CSubSendCCarryMsg); + ADDFN(CSUBTransition); + ADDFN(CSubTurnOffMsg); + ADDFN(CSubTurnOnMsg); + ADDFN(CSummonBotMsg); + ADDFN(CSummonBotQuerryMsg); + ADDFN(CTakeHeadPieceMsg); + ADDFN(CTextInputMsg); + ADDFN(CTimeDilationMsg); + ADDFN(CTimeMsg); + ADDFN(CTitleSequenceEndedMsg); + ADDFN(CTransitMsg); + ADDFN(CTransportMsg); + ADDFN(CTriggerAutoMusicPlayerMsg); + ADDFN(CTriggerNPCEvent); + ADDFN(CTrueTalkGetAnimSetMsg); + ADDFN(CTrueTalkGetAssetDetailsMsg); + ADDFN(CTrueTalkGetStateValueMsg); + ADDFN(CTrueTalkNotifySpeechEndedMsg); + ADDFN(CTrueTalkNotifySpeechStartedMsg); + ADDFN(CTrueTalkQueueUpAnimSetMsg); + ADDFN(CTrueTalkSelfQueueAnimSetMsg); + ADDFN(CTrueTalkTriggerActionMsg); + ADDFN(CTurnOff); + ADDFN(CTurnOn); + ADDFN(CUse); + ADDFN(CUseWithCharMsg); + ADDFN(CUseWithOtherMsg); + ADDFN(CVirtualKeyCharMsg); + ADDFN(CVisibleMsg); ADDFN(CEnterBombRoom); ADDFN(CExitArboretum); diff --git a/engines/titanic/messages/doorbot_needed_in_elevator_msg.cpp b/engines/titanic/messages/doorbot_needed_in_elevator_msg.cpp deleted file mode 100644 index a9c8fc3dcd..0000000000 --- a/engines/titanic/messages/doorbot_needed_in_elevator_msg.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* 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 "titanic/messages/auto_sound_event.h" - -namespace Titanic { - -CAutoSoundEvent::CAutoSoundEvent() : CGameObject(), _fieldBC(-1), _fieldC0(0xFFFFFF) { -} - -void CAutoSoundEvent::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldBC, indent); - file->writeNumberLine(_fieldC0, indent); - - CGameObject::save(file, indent); -} - -void CAutoSoundEvent::load(SimpleFile *file) { - file->readNumber(); - _fieldBC = file->readNumber(); - _fieldC0 = file->readNumber(); - - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/messages/doorbot_needed_in_elevator_msg.h b/engines/titanic/messages/doorbot_needed_in_elevator_msg.h deleted file mode 100644 index 50b2c3f793..0000000000 --- a/engines/titanic/messages/doorbot_needed_in_elevator_msg.h +++ /dev/null @@ -1,55 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_DOORBOT_NEEDED_IN_ELEVATOR_MSG_H -#define TITANIC_DOORBOT_NEEDED_IN_ELEVATOR_MSG_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CAutoSoundEvent : public CMessage { -protected: - int _fieldBC; - int _fieldC0; -public: - CAutoSoundEvent(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CAutoSoundEvent"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_DOORBOT_NEEDED_IN_ELEVATOR_MSG_H */ diff --git a/engines/titanic/messages/doorbot_needed_in_home_msg.cpp b/engines/titanic/messages/doorbot_needed_in_home_msg.cpp deleted file mode 100644 index a9c8fc3dcd..0000000000 --- a/engines/titanic/messages/doorbot_needed_in_home_msg.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* 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 "titanic/messages/auto_sound_event.h" - -namespace Titanic { - -CAutoSoundEvent::CAutoSoundEvent() : CGameObject(), _fieldBC(-1), _fieldC0(0xFFFFFF) { -} - -void CAutoSoundEvent::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldBC, indent); - file->writeNumberLine(_fieldC0, indent); - - CGameObject::save(file, indent); -} - -void CAutoSoundEvent::load(SimpleFile *file) { - file->readNumber(); - _fieldBC = file->readNumber(); - _fieldC0 = file->readNumber(); - - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/messages/doorbot_needed_in_home_msg.h b/engines/titanic/messages/doorbot_needed_in_home_msg.h deleted file mode 100644 index f3a805c1e1..0000000000 --- a/engines/titanic/messages/doorbot_needed_in_home_msg.h +++ /dev/null @@ -1,55 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_AUTO_SOUND_EVENT_H -#define TITANIC_AUTO_SOUND_EVENT_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CAutoSoundEvent : public CGameObject { -protected: - int _fieldBC; - int _fieldC0; -public: - CAutoSoundEvent(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CAutoSoundEvent"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/messages/drop_object_msg.cpp b/engines/titanic/messages/drop_object_msg.cpp deleted file mode 100644 index a9c8fc3dcd..0000000000 --- a/engines/titanic/messages/drop_object_msg.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* 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 "titanic/messages/auto_sound_event.h" - -namespace Titanic { - -CAutoSoundEvent::CAutoSoundEvent() : CGameObject(), _fieldBC(-1), _fieldC0(0xFFFFFF) { -} - -void CAutoSoundEvent::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldBC, indent); - file->writeNumberLine(_fieldC0, indent); - - CGameObject::save(file, indent); -} - -void CAutoSoundEvent::load(SimpleFile *file) { - file->readNumber(); - _fieldBC = file->readNumber(); - _fieldC0 = file->readNumber(); - - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/messages/drop_object_msg.h b/engines/titanic/messages/drop_object_msg.h deleted file mode 100644 index f3a805c1e1..0000000000 --- a/engines/titanic/messages/drop_object_msg.h +++ /dev/null @@ -1,55 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_AUTO_SOUND_EVENT_H -#define TITANIC_AUTO_SOUND_EVENT_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CAutoSoundEvent : public CGameObject { -protected: - int _fieldBC; - int _fieldC0; -public: - CAutoSoundEvent(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CAutoSoundEvent"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/messages/drop_zone_got_object_msg.cpp b/engines/titanic/messages/drop_zone_got_object_msg.cpp deleted file mode 100644 index a9c8fc3dcd..0000000000 --- a/engines/titanic/messages/drop_zone_got_object_msg.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* 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 "titanic/messages/auto_sound_event.h" - -namespace Titanic { - -CAutoSoundEvent::CAutoSoundEvent() : CGameObject(), _fieldBC(-1), _fieldC0(0xFFFFFF) { -} - -void CAutoSoundEvent::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldBC, indent); - file->writeNumberLine(_fieldC0, indent); - - CGameObject::save(file, indent); -} - -void CAutoSoundEvent::load(SimpleFile *file) { - file->readNumber(); - _fieldBC = file->readNumber(); - _fieldC0 = file->readNumber(); - - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/messages/drop_zone_got_object_msg.h b/engines/titanic/messages/drop_zone_got_object_msg.h deleted file mode 100644 index f3a805c1e1..0000000000 --- a/engines/titanic/messages/drop_zone_got_object_msg.h +++ /dev/null @@ -1,55 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_AUTO_SOUND_EVENT_H -#define TITANIC_AUTO_SOUND_EVENT_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CAutoSoundEvent : public CGameObject { -protected: - int _fieldBC; - int _fieldC0; -public: - CAutoSoundEvent(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CAutoSoundEvent"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/messages/edit_control_msg.h b/engines/titanic/messages/edit_control_msg.h new file mode 100644 index 0000000000..b44035a02a --- /dev/null +++ b/engines/titanic/messages/edit_control_msg.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_EDIT_CONTROL_MSG_H +#define TITANIC_EDIT_CONTROL_MSG_H + +#include "titanic/messages/message.h" + +namespace Titanic { + +class CEditControlMsg : public CMessage { +private: + int _field4; + int _field8; + CString _string1; + int _field18; + int _field1C; + int _field20; +public: + CEditControlMsg() : _field4(0), _field8(0), _field18(0), + _field1C(0), _field20(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CEditControlMsg"; } +}; + +} // End of namespace Titanic + +#endif /* TITANIC_EDIT_CONTROL_MSG_H */ diff --git a/engines/titanic/messages/is_hooked_on_msg.h b/engines/titanic/messages/is_hooked_on_msg.h new file mode 100644 index 0000000000..f8a5062fbb --- /dev/null +++ b/engines/titanic/messages/is_hooked_on_msg.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_IS_HOOKED_ON_MSG_H +#define TITANIC_IS_HOOKED_ON_MSG_H + +#include "titanic/messages/message.h" + +namespace Titanic { + +class CIsHookedOnMsg : public CMessage { +private: + int _field4; + int _field8; + CString _string1; + int _field18; + int _field1C; + int _field20; +public: + CIsHookedOnMsg() : CMessage(), _field4(0), _field8(0), + _field18(0), _field1C(0), _field20(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CIsHookedOnMsg"; } +}; + +} // End of namespace Titanic + +#endif /* TITANIC_IS_HOOKED_ON_MSG_H */ diff --git a/engines/titanic/messages/lights_msg.h b/engines/titanic/messages/lights_msg.h new file mode 100644 index 0000000000..1cd82ca8f2 --- /dev/null +++ b/engines/titanic/messages/lights_msg.h @@ -0,0 +1,48 @@ +/* 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. + * + */ + +#ifndef TITANIC_LIGHTS_MSG_H +#define TITANIC_LIGHTS_MSG_H + +#include "titanic/messages/message.h" + +namespace Titanic { + +class CLightsMsg : public CMessage { +public: + int _field4; + int _field8; + int _fieldC; + int _field10; +public: + CLightsMsg() : CMessage(), _field4(0), _field8(0), + _fieldC(0), _field10(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CLightsMsg"; } +}; + +} // End of namespace Titanic + +#endif /* TITANIC_LIGHTS_MSG_H */ diff --git a/engines/titanic/messages/message.h b/engines/titanic/messages/message.h index 59cc94ec08..9f10a7ed4a 100644 --- a/engines/titanic/messages/message.h +++ b/engines/titanic/messages/message.h @@ -47,6 +47,223 @@ public: virtual void load(SimpleFile *file); }; +#define RAW_MESSAGE(NAME) class NAME: public CMessage { \ + virtual const char *getClassName() const { return #NAME; } \ + } +#define STR_MESSAGE(NAME, FIELD) class NAME: public CMessage { \ + public: CString FIELD; \ + virtual const char *getClassName() const { return #NAME; } \ + } +#define STR2_MESSAGE(NAME, FIELD1, FIELD2) class NAME: public CMessage { \ + public: CString FIELD1, FIELD2; \ + virtual const char *getClassName() const { return #NAME; } \ + } +#define STR_MESSAGE_VAL(NAME, FIELD, VAL) class NAME: public CMessage { \ + public: CString FIELD; \ + NAME(): FIELD(VAL) {} \ + virtual const char *getClassName() const { return #NAME; } \ + } +#define NUM_MESSAGE(NAME, FIELD) class NAME: public CMessage { \ + public: int FIELD; \ + NAME(): FIELD(0) {} \ + virtual const char *getClassName() const { return #NAME; } \ + } +#define NUM_MESSAGE_VAL(NAME, FIELD, VAL) class NAME: public CMessage { \ + public: int FIELD; \ + NAME(): CMessage(), FIELD(VAL) {} \ + virtual const char *getClassName() const { return #NAME; } \ + } +#define NUM2_MESSAGE(NAME, FIELD1, FIELD2) class NAME: public CMessage { \ + public: int FIELD1, FIELD2; \ + NAME(): CMessage(), FIELD1(0), FIELD2(0) {} \ + virtual const char *getClassName() const { return #NAME; } \ + } +#define NUM3_MESSAGE(NAME, FIELD1, FIELD2, FIELD3) class NAME: public CMessage { \ + public: int FIELD1, FIELD2, FIELD3; \ + NAME(): CMessage(), FIELD1(0), FIELD2(0), FIELD3(0) {} \ + virtual const char *getClassName() const { return #NAME; } \ + } +#define NUM4_MESSAGE(NAME, FIELD1, FIELD2, FIELD3, FIELD4) \ + class NAME: public CMessage { \ + public: int FIELD1, FIELD2, FIELD3, FIELD4; \ + NAME(): CMessage(), FIELD1(0), FIELD2(0), FIELD3(0), FIELD4(0) {} \ + virtual const char *getClassName() const { return #NAME; } \ + } +#define NUM2_MESSAGE_VAL(NAME, FIELD1, FIELD2, VAL1, VAL2) \ + class NAME: public CMessage { \ + public: int FIELD1, FIELD2; \ + NAME(): CMessage(), FIELD1(VAL1), FIELD2(VAL2) {} \ + virtual const char *getClassName() const { return #NAME; } \ + } +#define SNUM_MESSAGE(NAME, SFIELD, NFIELD) class NAME: public CMessage { \ + public: CString SFIELD; CString NFIELD; \ + virtual const char *getClassName() const { return #NAME; } \ + } +#define SNUM_MESSAGE_VAL(NAME, SFIELD, NFIELD, SVAL, NVAL) \ + class NAME: public CMessage { \ + public: CString SFIELD; CString NFIELD; \ + NAME(): CMessage(), SFIELD(SVAL), NFIELD(NVAL) {} \ + virtual const char *getClassName() const { return #NAME; } \ + } + +STR_MESSAGE(CActMsg, _value); +STR_MESSAGE(CActivationmsg, _value); +STR_MESSAGE_VAL(CAddHeadPieceMsg, _value, "NULL"); +NUM_MESSAGE(CAnimateMaitreDMsg, _value); +NUM_MESSAGE(CArboretumGateMsg, _value); +RAW_MESSAGE(CArmPickedUpFromTableMsg); +RAW_MESSAGE(CBodyInBilgeRoomMsg); +NUM_MESSAGE(CBowlStateChange, _value); +SNUM_MESSAGE(CCarryObjectArrivedMsg, _strValue, _numValue); +STR_MESSAGE_VAL(CChangeSeasonMsg, _season, "Summer"); +RAW_MESSAGE(CCheckAllPossibleCodes); +NUM2_MESSAGE(CCheckChevCode, _value1, _value2); +NUM_MESSAGE(CChildDragEndMsg, _value); +NUM2_MESSAGE(CChildDragMoveMsg, _value1, _value2); +NUM2_MESSAGE(CChildDragStartMsg, _value1, _value2); +RAW_MESSAGE(CClearChevPanelBits); +RAW_MESSAGE(CCorrectMusicPlayedMsg); +RAW_MESSAGE(CCreateMusicPlayerMsg); +RAW_MESSAGE(CCylinderHolderReadyMsg); +RAW_MESSAGE(CDeactivationMsg); +STR_MESSAGE(CDeliverCCarryMsg, _value); +RAW_MESSAGE(CDisableMaitreDProdReceptor); +RAW_MESSAGE(CDismissBotMsg); +RAW_MESSAGE(CDoffNavHelmet); +RAW_MESSAGE(CDonNavHelmet); +NUM_MESSAGE(CDoorbotNeededInElevatorMsg, _value); +RAW_MESSAGE(CDoorbotNeededInHomeMsg); +NUM_MESSAGE(CDropobjectMsg, _value); +NUM_MESSAGE(CDropZoneGotObjectMsg, _value); +NUM_MESSAGE(CDropZoneLostObjectMsg, _value); +NUM_MESSAGE(CEjectCylinderMsg, _value); +RAW_MESSAGE(CErasePhonographCylinderMsg); +NUM2_MESSAGE(CFreshenCookieMsg, _value1, _value2); +NUM_MESSAGE(CGetChevClassBits, _value); +NUM_MESSAGE(CGetChevClassNum, _value); +SNUM_MESSAGE(CGetChevCodeFromRoomNameMsg, _strValue, _numValue); +NUM_MESSAGE(CGetChevFloorBits, _value); +NUM_MESSAGE(CGetChevFloorNum, _value); +NUM_MESSAGE(CGetChevLiftBits, _value); +NUM_MESSAGE(CGetChevLiftNum, _value); +NUM_MESSAGE(CGetChevRoomBits, _value); +NUM_MESSAGE(CGetChevRoomNum, _value); +NUM2_MESSAGE_VAL(CHoseConnectedMsg, _value1, _value2, 1, 0); +RAW_MESSAGE(CInitializeAnimMsg); +NUM_MESSAGE(CIsEarBowlPuzzleDone, _value); +NUM_MESSAGE(CIsParrotPresentMsg, _value); +NUM_MESSAGE_VAL(CKeyCharMsg, _value, 32); +NUM2_MESSAGE(CLemonFallsFromTreeMsg, _value1, _value2); +NUM_MESSAGE(CLockPhonographMsg, _value); +RAW_MESSAGE(CMaitreDDefeatedMsg); +RAW_MESSAGE(CMaitreDHappyMsg); +NUM_MESSAGE(CMissiveOMatActionMsg, _value); +RAW_MESSAGE(CMoveToStartPosMsg); +NUM2_MESSAGE(CMovieEndMsg, _value1, _value2); +NUM2_MESSAGE(CMovieFrameMsg, _value1, _value2); +RAW_MESSAGE(CMusicHasStartedMsg); +RAW_MESSAGE(CMusicHasStoppedMsg); +RAW_MESSAGE(CMusicSettingChangedMsg); +NUM2_MESSAGE(CNPCPlayAnimationMsg, _value1, _value2); +NUM_MESSAGE(CNPCPlayIdleAnimationMsg, _value); +NUM3_MESSAGE(CNPCPlayTalkingAnimationMsg, _value1, _value2, _value3); +RAW_MESSAGE(CNPCQueueIdleAnimMsg); +STR_MESSAGE(CNutPuzzleMsg, _value); +NUM_MESSAGE(COnSummonBotMsg, _value); +RAW_MESSAGE(COpeningCreditsMsg); +RAW_MESSAGE(CPETDeliverMsg); +RAW_MESSAGE(CPETGainedObjectMsg); +RAW_MESSAGE(CPETHelmetOnOffMsg); +RAW_MESSAGE(CPETKeyboardOnOffMsg); +RAW_MESSAGE(CPETLostObjectMsg); +RAW_MESSAGE(CPETObjectSelectedMsg); +NUM_MESSAGE(CPETObjectStateMsg, _value); +RAW_MESSAGE(CPETPhotoOnOffMsg); +NUM_MESSAGE(CPETPlaySoundMsg, _value); +RAW_MESSAGE(CPETReceiveMsg); +RAW_MESSAGE(CPETSetStarDestinationMsg); +NUM_MESSAGE(CPETStarFieldLockMsg, _value); +RAW_MESSAGE(CPETStereoFieldOnOffMsg); +SNUM_MESSAGE_VAL(CPETTargetMsg, _strValue, _numValue, nullptr, -1); +NUM_MESSAGE(CPanningAwayFromParrotMsg, _value); +STR2_MESSAGE(CParrotSpeakMsg, _value1, _value2); +NUM2_MESSAGE(CParrotTriesChickenMsg, _value1, _value2); +NUM4_MESSAGE(CPassOnDragStartMsg, _value1, _value2, _value3, _value4); +NUM_MESSAGE(CPhonographPlayMsg, _value); +RAW_MESSAGE(CPhonographReadyToPlayMsg); +NUM_MESSAGE(CPhonographRecordMsg, _value); +NUM3_MESSAGE(CPhonographStopMsg, _value1, _value2, _value3); +NUM2_MESSAGE(CPlayRangeMsg, _value1, _value2); +NUM2_MESSAGE(CPlayerTriesRestaurantTableMsg, _value1, _value2); +NUM_MESSAGE(CPreSaveMsg, _value); +NUM_MESSAGE(CProdMaitreDMsg, _value); +NUM2_MESSAGE(CPumpingMsg, _value1, _value2); +NUM_MESSAGE(CPutBotBackInHisBoxMsg, _value); +NUM_MESSAGE(CPutParrotBackMsg, _value); +RAW_MESSAGE(CPuzzleSolvedMsg); +NUM3_MESSAGE(CQueryCylinderHolderMsg, _value1, _value2, _value3); +NUM3_MESSAGE(CQueryCylinderMsg, _value1, _value2, _value3); +NUM3_MESSAGE(CQueryCylinderNameMsg, _value1, _value2, _value3); +NUM3_MESSAGE(CQueryCylinderTypeMsg, _value1, _value2, _value3); +NUM_MESSAGE(CQueryMusicControlSettingMsg, _value); +NUM_MESSAGE(CQueryPhonographState, _value); +RAW_MESSAGE(CRecordOntoCylinderMsg); +RAW_MESSAGE(CRemoveFromGameMsg); +RAW_MESSAGE(CReplaceBowlAndNutsMsg); +STR_MESSAGE(CRestaurantMusicChanged, _value); +SNUM_MESSAGE(CSendCCarryMsg, _strValue, _numValue); +STR_MESSAGE_VAL(CSenseWorkingMsg, _value, "Not Working"); +NUM2_MESSAGE(CServiceElevatorFloorChangeMsg, _value1, _value2); +RAW_MESSAGE(CServiceElevatorFloorRequestMsg); +NUM_MESSAGE_VAL(CServiceElevatorMsg, _value, 4); +NUM2_MESSAGE(CSetChevButtonImageMsg, _value1, _value2); +NUM_MESSAGE(CSetChevClassBits, _value); +NUM_MESSAGE(CSetChevFloorBits, _value); +NUM_MESSAGE(CSetChevLiftBits, _value); +NUM2_MESSAGE(CSetChevPanelBitMsg, _value1, _value2); +NUM_MESSAGE(CSetChevPanelButtonsMsg, _value); +NUM_MESSAGE(CSetChevRoomBits, _value); +RAW_MESSAGE(CSetMusicControlsMsg); +SNUM_MESSAGE(CSetVarMsg, _varName, _value); +NUM2_MESSAGE_VAL(CSetVolumeMsg, _value1, _value2, 70, 0); +SNUM_MESSAGE(CShipSettingMsg, _strValue, _numValue); +STR_MESSAGE_VAL(CShowTextMsg, _value, "NO TEXT INCLUDED!!!"); +SNUM_MESSAGE(CSignalObject, _strValue, _numValue); +NUM2_MESSAGE(CSpeechFallsFromTreeMsg, _value1, _value2); +NUM_MESSAGE(CStartMusicMsg, _value); +NUM3_MESSAGE(CStatusChangeMsg, _value1, _value2, _value3); +NUM_MESSAGE(CStopMusicMsg, _value); +RAW_MESSAGE(CSubDeliverCCarryMsg); +RAW_MESSAGE(CSubSendCCarryMsg); +RAW_MESSAGE(CSUBTransition); +RAW_MESSAGE(CSubTurnOffMsg); +RAW_MESSAGE(CSubTurnOnMsg); +SNUM_MESSAGE(CSummonBotMsg, _strValue, _numValue); +STR_MESSAGE(CSummonBotQuerryMsg, _value); +STR_MESSAGE(CTakeHeadPieceMsg, _value); +STR2_MESSAGE(CTextInputMsg, _value1, _value2); +NUM_MESSAGE(CTimeDilationMsg, _value); +NUM_MESSAGE(CTimeMsg, _value); +RAW_MESSAGE(CTitleSequenceEndedMsg); +RAW_MESSAGE(CTransitMsg); +NUM_MESSAGE(CTriggerAutoMusicPlayerMsg, _value); +NUM_MESSAGE(CTriggerNPCEvent, _value); +NUM4_MESSAGE(CTrueTalkGetAnimSetMsg, _value1, _value2, _value3, _value4); +SNUM_MESSAGE(CTrueTalkGetAssetDetailsMsg, _strValue, _numValue); +NUM2_MESSAGE_VAL(CTrueTalkGetStateValueMsg, _value1, _value2, 0, -1000); +NUM2_MESSAGE(CTrueTalkNotifySpeechEndedMsg, _value1, _value2); +NUM3_MESSAGE(CTrueTalkNotifySpeechStartedMsg, _value1, _value2, _value); +NUM_MESSAGE(CTrueTalkQueueUpAnimSetMsg, _value); +RAW_MESSAGE(CTrueTalkSelfQueueAnimSetMsg); +NUM3_MESSAGE(CTrueTalkTriggerActionMsg, _value1, _value2, _value3); +RAW_MESSAGE(CTurnOff); +RAW_MESSAGE(CTurnOn); +NUM_MESSAGE(CUse, _value); +NUM_MESSAGE(CUseWithCharMsg, _value); +NUM_MESSAGE(CUseWithOtherMsg, _value); +NUM_MESSAGE(CVirtualKeyCharMsg, _value); +NUM2_MESSAGE_VAL(CVisibleMsg, _value1, _value2, 1, 0); + } // End of namespace Titanic #endif /* TITANIC_MESSAGE_H */ diff --git a/engines/titanic/messages/sub_accept_ccarry_msg.h b/engines/titanic/messages/sub_accept_ccarry_msg.h new file mode 100644 index 0000000000..b7c48ae81e --- /dev/null +++ b/engines/titanic/messages/sub_accept_ccarry_msg.h @@ -0,0 +1,45 @@ +/* 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. + * + */ + +#ifndef TITANIC_SUB_ACCEPT_CCARRY_MSG_H +#define TITANIC_SUB_ACCEPT_CCARRY_MSG_H + +#include "titanic/messages/message.h" + +namespace Titanic { + +class CSubAcceptCCarryMsg : public CMessage { +public: + CString _string1; + int _value1, _value2, _value3; +public: + CSubAcceptCCarryMsg() : _value1(0), _value2(0), _value3(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSubAcceptCCarryMsg"; } +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SUB_ACCEPT_CCARRY_MSG_H */ diff --git a/engines/titanic/messages/transport_msg.h b/engines/titanic/messages/transport_msg.h new file mode 100644 index 0000000000..513a2504bc --- /dev/null +++ b/engines/titanic/messages/transport_msg.h @@ -0,0 +1,45 @@ +/* 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. + * + */ + +#ifndef TITANIC_TRANSPORT_MSG_H +#define TITANIC_TRANSPORT_MSG_H + +#include "titanic/messages/message.h" + +namespace Titanic { + +class CTransportMsg : public CMessage { +public: + CString _string; + int _value1, _value2; +public: + CTransportMsg() : _value1(0), _value2(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CTransportMsg"; } +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TRANSPORT_MSG_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 1c7e5a5c1e..c20afb299b 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -111,10 +111,6 @@ MODULE_OBJS := \ gfx/toggle_switch.o \ messages/auto_sound_event.o \ messages/door_auto_sound_event.o \ - messages/doorbot_needed_in_elevator_msg.o \ - messages/doorbot_needed_in_home_msg.o \ - messages/drop_object_msg.o \ - messages/drop_zone_got_object_msg.o \ messages/message.o \ moves/enter_bomb_room.o \ moves/exit_arboretum.o \ -- cgit v1.2.3 From 9080781b08830449e3f762ab45924a15446435ef Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 27 Feb 2016 23:22:38 -0500 Subject: TITANIC: Add mouse events, cleanup of existing events --- engines/titanic/core/saveable_object.cpp | 29 +- engines/titanic/game/service_elevator_door.h | 2 +- engines/titanic/messages/auto_sound_event.cpp | 46 --- engines/titanic/messages/auto_sound_event.h | 55 --- engines/titanic/messages/door_auto_sound_event.cpp | 51 --- engines/titanic/messages/door_auto_sound_event.h | 57 --- engines/titanic/messages/edit_control_msg.h | 50 --- engines/titanic/messages/is_hooked_on_msg.h | 50 --- engines/titanic/messages/lights_msg.h | 48 --- engines/titanic/messages/message.cpp | 39 --- engines/titanic/messages/message.h | 269 -------------- engines/titanic/messages/messages.cpp | 87 +++++ engines/titanic/messages/messages.h | 385 +++++++++++++++++++++ engines/titanic/messages/mouse_messages.h | 96 +++++ engines/titanic/messages/pet_messages.h | 47 +++ engines/titanic/messages/sub_accept_ccarry_msg.h | 45 --- engines/titanic/messages/transport_msg.h | 45 --- engines/titanic/module.mk | 2 +- 18 files changed, 640 insertions(+), 763 deletions(-) delete mode 100644 engines/titanic/messages/auto_sound_event.cpp delete mode 100644 engines/titanic/messages/auto_sound_event.h delete mode 100644 engines/titanic/messages/door_auto_sound_event.cpp delete mode 100644 engines/titanic/messages/door_auto_sound_event.h delete mode 100644 engines/titanic/messages/edit_control_msg.h delete mode 100644 engines/titanic/messages/is_hooked_on_msg.h delete mode 100644 engines/titanic/messages/lights_msg.h delete mode 100644 engines/titanic/messages/message.cpp delete mode 100644 engines/titanic/messages/message.h create mode 100644 engines/titanic/messages/messages.cpp create mode 100644 engines/titanic/messages/messages.h create mode 100644 engines/titanic/messages/mouse_messages.h create mode 100644 engines/titanic/messages/pet_messages.h delete mode 100644 engines/titanic/messages/sub_accept_ccarry_msg.h delete mode 100644 engines/titanic/messages/transport_msg.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index fdb8df6955..dbbf8aa205 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -114,12 +114,9 @@ #include "titanic/gfx/st_button.h" #include "titanic/gfx/toggle_switch.h" -#include "titanic/messages/message.h" -#include "titanic/messages/edit_control_msg.h" -#include "titanic/messages/is_hooked_on_msg.h" -#include "titanic/messages/lights_msg.h" -#include "titanic/messages/sub_accept_ccarry_msg.h" -#include "titanic/messages/transport_msg.h" +#include "titanic/messages/messages.h" +#include "titanic/messages/mouse_messages.h" +#include "titanic/messages/pet_messages.h" #include "titanic/moves/enter_bomb_room.h" #include "titanic/moves/exit_arboretum.h" @@ -301,6 +298,16 @@ DEFFN(CLockPhonographMsg); DEFFN(CMaitreDDefeatedMsg); DEFFN(CMaitreDHappyMsg); DEFFN(CMissiveOMatActionMsg); +DEFFN(CMouseMsg); +DEFFN(CMouseMoveMsg); +DEFFN(CMouseButtonMsg); +DEFFN(CMouseButtonDownMsg); +DEFFN(CMouseButtonUpMsg); +DEFFN(CMouseButtonDoubleClickMsg); +DEFFN(CMouseDragMsg); +DEFFN(CMouseDragStartMsg); +DEFFN(CMouseDragMoveMsg); +DEFFN(CMouseDragEndMsg); DEFFN(CMoveToStartPosMsg); DEFFN(CMovieEndMsg); DEFFN(CMovieFrameMsg); @@ -583,6 +590,16 @@ void CSaveableObject::initClassList() { ADDFN(CMaitreDDefeatedMsg); ADDFN(CMaitreDHappyMsg); ADDFN(CMissiveOMatActionMsg); + ADDFN(CMouseMsg); + ADDFN(CMouseMoveMsg); + ADDFN(CMouseButtonMsg); + ADDFN(CMouseButtonDownMsg); + ADDFN(CMouseButtonUpMsg); + ADDFN(CMouseButtonDoubleClickMsg); + ADDFN(CMouseDragMsg); + ADDFN(CMouseDragStartMsg); + ADDFN(CMouseDragMoveMsg); + ADDFN(CMouseDragEndMsg); ADDFN(CMoveToStartPosMsg); ADDFN(CMovieEndMsg); ADDFN(CMovieFrameMsg); diff --git a/engines/titanic/game/service_elevator_door.h b/engines/titanic/game/service_elevator_door.h index a3a8388405..616601d196 100644 --- a/engines/titanic/game/service_elevator_door.h +++ b/engines/titanic/game/service_elevator_door.h @@ -23,7 +23,7 @@ #ifndef TITANIC_SERVICE_ELEVATOR_DOOR_H #define TITANIC_SERVICE_ELEVATOR_DOOR_H -#include "titanic/messages/door_auto_sound_event.h" +#include "titanic/messages/messages.h" namespace Titanic { diff --git a/engines/titanic/messages/auto_sound_event.cpp b/engines/titanic/messages/auto_sound_event.cpp deleted file mode 100644 index a9c8fc3dcd..0000000000 --- a/engines/titanic/messages/auto_sound_event.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* 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 "titanic/messages/auto_sound_event.h" - -namespace Titanic { - -CAutoSoundEvent::CAutoSoundEvent() : CGameObject(), _fieldBC(-1), _fieldC0(0xFFFFFF) { -} - -void CAutoSoundEvent::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldBC, indent); - file->writeNumberLine(_fieldC0, indent); - - CGameObject::save(file, indent); -} - -void CAutoSoundEvent::load(SimpleFile *file) { - file->readNumber(); - _fieldBC = file->readNumber(); - _fieldC0 = file->readNumber(); - - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/messages/auto_sound_event.h b/engines/titanic/messages/auto_sound_event.h deleted file mode 100644 index f3a805c1e1..0000000000 --- a/engines/titanic/messages/auto_sound_event.h +++ /dev/null @@ -1,55 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_AUTO_SOUND_EVENT_H -#define TITANIC_AUTO_SOUND_EVENT_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CAutoSoundEvent : public CGameObject { -protected: - int _fieldBC; - int _fieldC0; -public: - CAutoSoundEvent(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CAutoSoundEvent"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/messages/door_auto_sound_event.cpp b/engines/titanic/messages/door_auto_sound_event.cpp deleted file mode 100644 index 69191a6576..0000000000 --- a/engines/titanic/messages/door_auto_sound_event.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* 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 "titanic/messages/door_auto_sound_event.h" - -namespace Titanic { - -CDoorAutoSoundEvent::CDoorAutoSoundEvent() : CAutoSoundEvent(), - _string1("z#44.wav"), _string2("z#43.wav"), _fieldDC(25), _fieldE0(25) { -} - -void CDoorAutoSoundEvent::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeQuotedLine(_string1, indent); - file->writeQuotedLine(_string2, indent); - file->writeNumberLine(_fieldDC, indent); - file->writeNumberLine(_fieldE0, indent); - - CAutoSoundEvent::save(file, indent); -} - -void CDoorAutoSoundEvent::load(SimpleFile *file) { - file->readNumber(); - _string1 = file->readString(); - _string2 = file->readString(); - _fieldDC = file->readNumber(); - _fieldE0 = file->readNumber(); - - CAutoSoundEvent::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/messages/door_auto_sound_event.h b/engines/titanic/messages/door_auto_sound_event.h deleted file mode 100644 index 9bba304daa..0000000000 --- a/engines/titanic/messages/door_auto_sound_event.h +++ /dev/null @@ -1,57 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_DOOR_AUTO_SOUND_EVENT_H -#define TITANIC_DOOR_AUTO_SOUND_EVENT_H - -#include "titanic/messages/auto_sound_event.h" - -namespace Titanic { - -class CDoorAutoSoundEvent : public CAutoSoundEvent { -protected: - CString _string1; - CString _string2; - int _fieldDC; - int _fieldE0; -public: - CDoorAutoSoundEvent(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CDoorAutoSoundEvent"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_DOOR_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/messages/edit_control_msg.h b/engines/titanic/messages/edit_control_msg.h deleted file mode 100644 index b44035a02a..0000000000 --- a/engines/titanic/messages/edit_control_msg.h +++ /dev/null @@ -1,50 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_EDIT_CONTROL_MSG_H -#define TITANIC_EDIT_CONTROL_MSG_H - -#include "titanic/messages/message.h" - -namespace Titanic { - -class CEditControlMsg : public CMessage { -private: - int _field4; - int _field8; - CString _string1; - int _field18; - int _field1C; - int _field20; -public: - CEditControlMsg() : _field4(0), _field8(0), _field18(0), - _field1C(0), _field20(0) {} - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CEditControlMsg"; } -}; - -} // End of namespace Titanic - -#endif /* TITANIC_EDIT_CONTROL_MSG_H */ diff --git a/engines/titanic/messages/is_hooked_on_msg.h b/engines/titanic/messages/is_hooked_on_msg.h deleted file mode 100644 index f8a5062fbb..0000000000 --- a/engines/titanic/messages/is_hooked_on_msg.h +++ /dev/null @@ -1,50 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_IS_HOOKED_ON_MSG_H -#define TITANIC_IS_HOOKED_ON_MSG_H - -#include "titanic/messages/message.h" - -namespace Titanic { - -class CIsHookedOnMsg : public CMessage { -private: - int _field4; - int _field8; - CString _string1; - int _field18; - int _field1C; - int _field20; -public: - CIsHookedOnMsg() : CMessage(), _field4(0), _field8(0), - _field18(0), _field1C(0), _field20(0) {} - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CIsHookedOnMsg"; } -}; - -} // End of namespace Titanic - -#endif /* TITANIC_IS_HOOKED_ON_MSG_H */ diff --git a/engines/titanic/messages/lights_msg.h b/engines/titanic/messages/lights_msg.h deleted file mode 100644 index 1cd82ca8f2..0000000000 --- a/engines/titanic/messages/lights_msg.h +++ /dev/null @@ -1,48 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_LIGHTS_MSG_H -#define TITANIC_LIGHTS_MSG_H - -#include "titanic/messages/message.h" - -namespace Titanic { - -class CLightsMsg : public CMessage { -public: - int _field4; - int _field8; - int _fieldC; - int _field10; -public: - CLightsMsg() : CMessage(), _field4(0), _field8(0), - _fieldC(0), _field10(0) {} - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CLightsMsg"; } -}; - -} // End of namespace Titanic - -#endif /* TITANIC_LIGHTS_MSG_H */ diff --git a/engines/titanic/messages/message.cpp b/engines/titanic/messages/message.cpp deleted file mode 100644 index 08df20e6a8..0000000000 --- a/engines/titanic/messages/message.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* 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 "titanic/messages/message.h" - -namespace Titanic { - -CMessage::CMessage() : CSaveableObject() { -} - -void CMessage::save(SimpleFile *file, int indent) const { - file->writeNumberLine(0, indent); -} - -void CMessage::load(SimpleFile *file) { - file->readNumber(); - CSaveableObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/messages/message.h b/engines/titanic/messages/message.h deleted file mode 100644 index 9f10a7ed4a..0000000000 --- a/engines/titanic/messages/message.h +++ /dev/null @@ -1,269 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_MESSAGE_H -#define TITANIC_MESSAGE_H - -#include "titanic/core/saveable_object.h" - -namespace Titanic { - -class CMessage : public CSaveableObject { -public: - CMessage(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMessage"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -#define RAW_MESSAGE(NAME) class NAME: public CMessage { \ - virtual const char *getClassName() const { return #NAME; } \ - } -#define STR_MESSAGE(NAME, FIELD) class NAME: public CMessage { \ - public: CString FIELD; \ - virtual const char *getClassName() const { return #NAME; } \ - } -#define STR2_MESSAGE(NAME, FIELD1, FIELD2) class NAME: public CMessage { \ - public: CString FIELD1, FIELD2; \ - virtual const char *getClassName() const { return #NAME; } \ - } -#define STR_MESSAGE_VAL(NAME, FIELD, VAL) class NAME: public CMessage { \ - public: CString FIELD; \ - NAME(): FIELD(VAL) {} \ - virtual const char *getClassName() const { return #NAME; } \ - } -#define NUM_MESSAGE(NAME, FIELD) class NAME: public CMessage { \ - public: int FIELD; \ - NAME(): FIELD(0) {} \ - virtual const char *getClassName() const { return #NAME; } \ - } -#define NUM_MESSAGE_VAL(NAME, FIELD, VAL) class NAME: public CMessage { \ - public: int FIELD; \ - NAME(): CMessage(), FIELD(VAL) {} \ - virtual const char *getClassName() const { return #NAME; } \ - } -#define NUM2_MESSAGE(NAME, FIELD1, FIELD2) class NAME: public CMessage { \ - public: int FIELD1, FIELD2; \ - NAME(): CMessage(), FIELD1(0), FIELD2(0) {} \ - virtual const char *getClassName() const { return #NAME; } \ - } -#define NUM3_MESSAGE(NAME, FIELD1, FIELD2, FIELD3) class NAME: public CMessage { \ - public: int FIELD1, FIELD2, FIELD3; \ - NAME(): CMessage(), FIELD1(0), FIELD2(0), FIELD3(0) {} \ - virtual const char *getClassName() const { return #NAME; } \ - } -#define NUM4_MESSAGE(NAME, FIELD1, FIELD2, FIELD3, FIELD4) \ - class NAME: public CMessage { \ - public: int FIELD1, FIELD2, FIELD3, FIELD4; \ - NAME(): CMessage(), FIELD1(0), FIELD2(0), FIELD3(0), FIELD4(0) {} \ - virtual const char *getClassName() const { return #NAME; } \ - } -#define NUM2_MESSAGE_VAL(NAME, FIELD1, FIELD2, VAL1, VAL2) \ - class NAME: public CMessage { \ - public: int FIELD1, FIELD2; \ - NAME(): CMessage(), FIELD1(VAL1), FIELD2(VAL2) {} \ - virtual const char *getClassName() const { return #NAME; } \ - } -#define SNUM_MESSAGE(NAME, SFIELD, NFIELD) class NAME: public CMessage { \ - public: CString SFIELD; CString NFIELD; \ - virtual const char *getClassName() const { return #NAME; } \ - } -#define SNUM_MESSAGE_VAL(NAME, SFIELD, NFIELD, SVAL, NVAL) \ - class NAME: public CMessage { \ - public: CString SFIELD; CString NFIELD; \ - NAME(): CMessage(), SFIELD(SVAL), NFIELD(NVAL) {} \ - virtual const char *getClassName() const { return #NAME; } \ - } - -STR_MESSAGE(CActMsg, _value); -STR_MESSAGE(CActivationmsg, _value); -STR_MESSAGE_VAL(CAddHeadPieceMsg, _value, "NULL"); -NUM_MESSAGE(CAnimateMaitreDMsg, _value); -NUM_MESSAGE(CArboretumGateMsg, _value); -RAW_MESSAGE(CArmPickedUpFromTableMsg); -RAW_MESSAGE(CBodyInBilgeRoomMsg); -NUM_MESSAGE(CBowlStateChange, _value); -SNUM_MESSAGE(CCarryObjectArrivedMsg, _strValue, _numValue); -STR_MESSAGE_VAL(CChangeSeasonMsg, _season, "Summer"); -RAW_MESSAGE(CCheckAllPossibleCodes); -NUM2_MESSAGE(CCheckChevCode, _value1, _value2); -NUM_MESSAGE(CChildDragEndMsg, _value); -NUM2_MESSAGE(CChildDragMoveMsg, _value1, _value2); -NUM2_MESSAGE(CChildDragStartMsg, _value1, _value2); -RAW_MESSAGE(CClearChevPanelBits); -RAW_MESSAGE(CCorrectMusicPlayedMsg); -RAW_MESSAGE(CCreateMusicPlayerMsg); -RAW_MESSAGE(CCylinderHolderReadyMsg); -RAW_MESSAGE(CDeactivationMsg); -STR_MESSAGE(CDeliverCCarryMsg, _value); -RAW_MESSAGE(CDisableMaitreDProdReceptor); -RAW_MESSAGE(CDismissBotMsg); -RAW_MESSAGE(CDoffNavHelmet); -RAW_MESSAGE(CDonNavHelmet); -NUM_MESSAGE(CDoorbotNeededInElevatorMsg, _value); -RAW_MESSAGE(CDoorbotNeededInHomeMsg); -NUM_MESSAGE(CDropobjectMsg, _value); -NUM_MESSAGE(CDropZoneGotObjectMsg, _value); -NUM_MESSAGE(CDropZoneLostObjectMsg, _value); -NUM_MESSAGE(CEjectCylinderMsg, _value); -RAW_MESSAGE(CErasePhonographCylinderMsg); -NUM2_MESSAGE(CFreshenCookieMsg, _value1, _value2); -NUM_MESSAGE(CGetChevClassBits, _value); -NUM_MESSAGE(CGetChevClassNum, _value); -SNUM_MESSAGE(CGetChevCodeFromRoomNameMsg, _strValue, _numValue); -NUM_MESSAGE(CGetChevFloorBits, _value); -NUM_MESSAGE(CGetChevFloorNum, _value); -NUM_MESSAGE(CGetChevLiftBits, _value); -NUM_MESSAGE(CGetChevLiftNum, _value); -NUM_MESSAGE(CGetChevRoomBits, _value); -NUM_MESSAGE(CGetChevRoomNum, _value); -NUM2_MESSAGE_VAL(CHoseConnectedMsg, _value1, _value2, 1, 0); -RAW_MESSAGE(CInitializeAnimMsg); -NUM_MESSAGE(CIsEarBowlPuzzleDone, _value); -NUM_MESSAGE(CIsParrotPresentMsg, _value); -NUM_MESSAGE_VAL(CKeyCharMsg, _value, 32); -NUM2_MESSAGE(CLemonFallsFromTreeMsg, _value1, _value2); -NUM_MESSAGE(CLockPhonographMsg, _value); -RAW_MESSAGE(CMaitreDDefeatedMsg); -RAW_MESSAGE(CMaitreDHappyMsg); -NUM_MESSAGE(CMissiveOMatActionMsg, _value); -RAW_MESSAGE(CMoveToStartPosMsg); -NUM2_MESSAGE(CMovieEndMsg, _value1, _value2); -NUM2_MESSAGE(CMovieFrameMsg, _value1, _value2); -RAW_MESSAGE(CMusicHasStartedMsg); -RAW_MESSAGE(CMusicHasStoppedMsg); -RAW_MESSAGE(CMusicSettingChangedMsg); -NUM2_MESSAGE(CNPCPlayAnimationMsg, _value1, _value2); -NUM_MESSAGE(CNPCPlayIdleAnimationMsg, _value); -NUM3_MESSAGE(CNPCPlayTalkingAnimationMsg, _value1, _value2, _value3); -RAW_MESSAGE(CNPCQueueIdleAnimMsg); -STR_MESSAGE(CNutPuzzleMsg, _value); -NUM_MESSAGE(COnSummonBotMsg, _value); -RAW_MESSAGE(COpeningCreditsMsg); -RAW_MESSAGE(CPETDeliverMsg); -RAW_MESSAGE(CPETGainedObjectMsg); -RAW_MESSAGE(CPETHelmetOnOffMsg); -RAW_MESSAGE(CPETKeyboardOnOffMsg); -RAW_MESSAGE(CPETLostObjectMsg); -RAW_MESSAGE(CPETObjectSelectedMsg); -NUM_MESSAGE(CPETObjectStateMsg, _value); -RAW_MESSAGE(CPETPhotoOnOffMsg); -NUM_MESSAGE(CPETPlaySoundMsg, _value); -RAW_MESSAGE(CPETReceiveMsg); -RAW_MESSAGE(CPETSetStarDestinationMsg); -NUM_MESSAGE(CPETStarFieldLockMsg, _value); -RAW_MESSAGE(CPETStereoFieldOnOffMsg); -SNUM_MESSAGE_VAL(CPETTargetMsg, _strValue, _numValue, nullptr, -1); -NUM_MESSAGE(CPanningAwayFromParrotMsg, _value); -STR2_MESSAGE(CParrotSpeakMsg, _value1, _value2); -NUM2_MESSAGE(CParrotTriesChickenMsg, _value1, _value2); -NUM4_MESSAGE(CPassOnDragStartMsg, _value1, _value2, _value3, _value4); -NUM_MESSAGE(CPhonographPlayMsg, _value); -RAW_MESSAGE(CPhonographReadyToPlayMsg); -NUM_MESSAGE(CPhonographRecordMsg, _value); -NUM3_MESSAGE(CPhonographStopMsg, _value1, _value2, _value3); -NUM2_MESSAGE(CPlayRangeMsg, _value1, _value2); -NUM2_MESSAGE(CPlayerTriesRestaurantTableMsg, _value1, _value2); -NUM_MESSAGE(CPreSaveMsg, _value); -NUM_MESSAGE(CProdMaitreDMsg, _value); -NUM2_MESSAGE(CPumpingMsg, _value1, _value2); -NUM_MESSAGE(CPutBotBackInHisBoxMsg, _value); -NUM_MESSAGE(CPutParrotBackMsg, _value); -RAW_MESSAGE(CPuzzleSolvedMsg); -NUM3_MESSAGE(CQueryCylinderHolderMsg, _value1, _value2, _value3); -NUM3_MESSAGE(CQueryCylinderMsg, _value1, _value2, _value3); -NUM3_MESSAGE(CQueryCylinderNameMsg, _value1, _value2, _value3); -NUM3_MESSAGE(CQueryCylinderTypeMsg, _value1, _value2, _value3); -NUM_MESSAGE(CQueryMusicControlSettingMsg, _value); -NUM_MESSAGE(CQueryPhonographState, _value); -RAW_MESSAGE(CRecordOntoCylinderMsg); -RAW_MESSAGE(CRemoveFromGameMsg); -RAW_MESSAGE(CReplaceBowlAndNutsMsg); -STR_MESSAGE(CRestaurantMusicChanged, _value); -SNUM_MESSAGE(CSendCCarryMsg, _strValue, _numValue); -STR_MESSAGE_VAL(CSenseWorkingMsg, _value, "Not Working"); -NUM2_MESSAGE(CServiceElevatorFloorChangeMsg, _value1, _value2); -RAW_MESSAGE(CServiceElevatorFloorRequestMsg); -NUM_MESSAGE_VAL(CServiceElevatorMsg, _value, 4); -NUM2_MESSAGE(CSetChevButtonImageMsg, _value1, _value2); -NUM_MESSAGE(CSetChevClassBits, _value); -NUM_MESSAGE(CSetChevFloorBits, _value); -NUM_MESSAGE(CSetChevLiftBits, _value); -NUM2_MESSAGE(CSetChevPanelBitMsg, _value1, _value2); -NUM_MESSAGE(CSetChevPanelButtonsMsg, _value); -NUM_MESSAGE(CSetChevRoomBits, _value); -RAW_MESSAGE(CSetMusicControlsMsg); -SNUM_MESSAGE(CSetVarMsg, _varName, _value); -NUM2_MESSAGE_VAL(CSetVolumeMsg, _value1, _value2, 70, 0); -SNUM_MESSAGE(CShipSettingMsg, _strValue, _numValue); -STR_MESSAGE_VAL(CShowTextMsg, _value, "NO TEXT INCLUDED!!!"); -SNUM_MESSAGE(CSignalObject, _strValue, _numValue); -NUM2_MESSAGE(CSpeechFallsFromTreeMsg, _value1, _value2); -NUM_MESSAGE(CStartMusicMsg, _value); -NUM3_MESSAGE(CStatusChangeMsg, _value1, _value2, _value3); -NUM_MESSAGE(CStopMusicMsg, _value); -RAW_MESSAGE(CSubDeliverCCarryMsg); -RAW_MESSAGE(CSubSendCCarryMsg); -RAW_MESSAGE(CSUBTransition); -RAW_MESSAGE(CSubTurnOffMsg); -RAW_MESSAGE(CSubTurnOnMsg); -SNUM_MESSAGE(CSummonBotMsg, _strValue, _numValue); -STR_MESSAGE(CSummonBotQuerryMsg, _value); -STR_MESSAGE(CTakeHeadPieceMsg, _value); -STR2_MESSAGE(CTextInputMsg, _value1, _value2); -NUM_MESSAGE(CTimeDilationMsg, _value); -NUM_MESSAGE(CTimeMsg, _value); -RAW_MESSAGE(CTitleSequenceEndedMsg); -RAW_MESSAGE(CTransitMsg); -NUM_MESSAGE(CTriggerAutoMusicPlayerMsg, _value); -NUM_MESSAGE(CTriggerNPCEvent, _value); -NUM4_MESSAGE(CTrueTalkGetAnimSetMsg, _value1, _value2, _value3, _value4); -SNUM_MESSAGE(CTrueTalkGetAssetDetailsMsg, _strValue, _numValue); -NUM2_MESSAGE_VAL(CTrueTalkGetStateValueMsg, _value1, _value2, 0, -1000); -NUM2_MESSAGE(CTrueTalkNotifySpeechEndedMsg, _value1, _value2); -NUM3_MESSAGE(CTrueTalkNotifySpeechStartedMsg, _value1, _value2, _value); -NUM_MESSAGE(CTrueTalkQueueUpAnimSetMsg, _value); -RAW_MESSAGE(CTrueTalkSelfQueueAnimSetMsg); -NUM3_MESSAGE(CTrueTalkTriggerActionMsg, _value1, _value2, _value3); -RAW_MESSAGE(CTurnOff); -RAW_MESSAGE(CTurnOn); -NUM_MESSAGE(CUse, _value); -NUM_MESSAGE(CUseWithCharMsg, _value); -NUM_MESSAGE(CUseWithOtherMsg, _value); -NUM_MESSAGE(CVirtualKeyCharMsg, _value); -NUM2_MESSAGE_VAL(CVisibleMsg, _value1, _value2, 1, 0); - -} // End of namespace Titanic - -#endif /* TITANIC_MESSAGE_H */ diff --git a/engines/titanic/messages/messages.cpp b/engines/titanic/messages/messages.cpp new file mode 100644 index 0000000000..f60ad12cd7 --- /dev/null +++ b/engines/titanic/messages/messages.cpp @@ -0,0 +1,87 @@ +/* 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 "titanic/messages/messages.h" +#include "titanic/core/game_object.h" + +namespace Titanic { + +CMessage::CMessage() : CSaveableObject() { +} + +void CMessage::save(SimpleFile *file, int indent) const { + file->writeNumberLine(0, indent); +} + +void CMessage::load(SimpleFile *file) { + file->readNumber(); + CSaveableObject::load(file); +} + +/*------------------------------------------------------------------------*/ + +CAutoSoundEvent::CAutoSoundEvent() : CGameObject(), _fieldBC(-1), _fieldC0(0xFFFFFF) { +} + +void CAutoSoundEvent::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + + CGameObject::save(file, indent); +} + +void CAutoSoundEvent::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + + CGameObject::load(file); +} + +/*------------------------------------------------------------------------*/ + +CDoorAutoSoundEvent::CDoorAutoSoundEvent() : CAutoSoundEvent(), +_string1("z#44.wav"), _string2("z#43.wav"), _fieldDC(25), _fieldE0(25) { +} + +void CDoorAutoSoundEvent::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + file->writeNumberLine(_fieldDC, indent); + file->writeNumberLine(_fieldE0, indent); + + CAutoSoundEvent::save(file, indent); +} + +void CDoorAutoSoundEvent::load(SimpleFile *file) { + file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + _fieldDC = file->readNumber(); + _fieldE0 = file->readNumber(); + + CAutoSoundEvent::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h new file mode 100644 index 0000000000..e9490a8cb5 --- /dev/null +++ b/engines/titanic/messages/messages.h @@ -0,0 +1,385 @@ +/* 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. + * + */ + +#ifndef TITANIC_MESSAGES_H +#define TITANIC_MESSAGES_H + +#include "titanic/core/saveable_object.h" +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CMessage : public CSaveableObject { +public: + CMessage(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMessage"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +class CAutoSoundEvent : public CGameObject { +protected: + int _fieldBC; + int _fieldC0; +public: + CAutoSoundEvent(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CAutoSoundEvent"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + + +class CDoorAutoSoundEvent : public CAutoSoundEvent { +protected: + CString _string1; + CString _string2; + int _fieldDC; + int _fieldE0; +public: + CDoorAutoSoundEvent(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CDoorAutoSoundEvent"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + + +class CEditControlMsg : public CMessage { +private: + int _field4; + int _field8; + CString _string1; + int _field18; + int _field1C; + int _field20; +public: + CEditControlMsg() : _field4(0), _field8(0), _field18(0), + _field1C(0), _field20(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CEditControlMsg"; } +}; + +class CLightsMsg : public CMessage { +public: + int _field4; + int _field8; + int _fieldC; + int _field10; +public: + CLightsMsg() : CMessage(), _field4(0), _field8(0), + _fieldC(0), _field10(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CLightsMsg"; } +}; + +class CIsHookedOnMsg : public CMessage { +private: + int _field4; + int _field8; + CString _string1; + int _field18; + int _field1C; + int _field20; +public: + CIsHookedOnMsg() : CMessage(), _field4(0), _field8(0), + _field18(0), _field1C(0), _field20(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CIsHookedOnMsg"; } +}; + + +class CSubAcceptCCarryMsg : public CMessage { +public: + CString _string1; + int _value1, _value2, _value3; +public: + CSubAcceptCCarryMsg() : _value1(0), _value2(0), _value3(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSubAcceptCCarryMsg"; } +}; + +class CTransportMsg : public CMessage { +public: + CString _string; + int _value1, _value2; +public: + CTransportMsg() : _value1(0), _value2(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CTransportMsg"; } +}; + +#define RAW_MESSAGE(NAME) class NAME: public CMessage { \ + virtual const char *getClassName() const { return #NAME; } \ + } +#define STR_MESSAGE(NAME, FIELD) class NAME: public CMessage { \ + public: CString FIELD; \ + virtual const char *getClassName() const { return #NAME; } \ + } +#define STR2_MESSAGE(NAME, FIELD1, FIELD2) class NAME: public CMessage { \ + public: CString FIELD1, FIELD2; \ + virtual const char *getClassName() const { return #NAME; } \ + } +#define STR_MESSAGE_VAL(NAME, FIELD, VAL) class NAME: public CMessage { \ + public: CString FIELD; \ + NAME(): FIELD(VAL) {} \ + virtual const char *getClassName() const { return #NAME; } \ + } +#define NUM_MESSAGE(NAME, FIELD) class NAME: public CMessage { \ + public: int FIELD; \ + NAME(): FIELD(0) {} \ + virtual const char *getClassName() const { return #NAME; } \ + } +#define NUM_MESSAGE_VAL(NAME, FIELD, VAL) class NAME: public CMessage { \ + public: int FIELD; \ + NAME(): CMessage(), FIELD(VAL) {} \ + virtual const char *getClassName() const { return #NAME; } \ + } +#define NUM2_MESSAGE(NAME, FIELD1, FIELD2) class NAME: public CMessage { \ + public: int FIELD1, FIELD2; \ + NAME(): CMessage(), FIELD1(0), FIELD2(0) {} \ + virtual const char *getClassName() const { return #NAME; } \ + } +#define NUM3_MESSAGE(NAME, FIELD1, FIELD2, FIELD3) class NAME: public CMessage { \ + public: int FIELD1, FIELD2, FIELD3; \ + NAME(): CMessage(), FIELD1(0), FIELD2(0), FIELD3(0) {} \ + virtual const char *getClassName() const { return #NAME; } \ + } +#define NUM4_MESSAGE(NAME, FIELD1, FIELD2, FIELD3, FIELD4) \ + class NAME: public CMessage { \ + public: int FIELD1, FIELD2, FIELD3, FIELD4; \ + NAME(): CMessage(), FIELD1(0), FIELD2(0), FIELD3(0), FIELD4(0) {} \ + virtual const char *getClassName() const { return #NAME; } \ + } +#define NUM2_MESSAGE_VAL(NAME, FIELD1, FIELD2, VAL1, VAL2) \ + class NAME: public CMessage { \ + public: int FIELD1, FIELD2; \ + NAME(): CMessage(), FIELD1(VAL1), FIELD2(VAL2) {} \ + virtual const char *getClassName() const { return #NAME; } \ + } +#define SNUM_MESSAGE(NAME, SFIELD, NFIELD) class NAME: public CMessage { \ + public: CString SFIELD; CString NFIELD; \ + virtual const char *getClassName() const { return #NAME; } \ + } +#define SNUM_MESSAGE_VAL(NAME, SFIELD, NFIELD, SVAL, NVAL) \ + class NAME: public CMessage { \ + public: CString SFIELD; CString NFIELD; \ + NAME(): CMessage(), SFIELD(SVAL), NFIELD(NVAL) {} \ + virtual const char *getClassName() const { return #NAME; } \ + } + +STR_MESSAGE(CActMsg, _value); +STR_MESSAGE(CActivationmsg, _value); +STR_MESSAGE_VAL(CAddHeadPieceMsg, _value, "NULL"); +NUM_MESSAGE(CAnimateMaitreDMsg, _value); +NUM_MESSAGE(CArboretumGateMsg, _value); +RAW_MESSAGE(CArmPickedUpFromTableMsg); +RAW_MESSAGE(CBodyInBilgeRoomMsg); +NUM_MESSAGE(CBowlStateChange, _value); +SNUM_MESSAGE(CCarryObjectArrivedMsg, _strValue, _numValue); +STR_MESSAGE_VAL(CChangeSeasonMsg, _season, "Summer"); +RAW_MESSAGE(CCheckAllPossibleCodes); +NUM2_MESSAGE(CCheckChevCode, _value1, _value2); +NUM_MESSAGE(CChildDragEndMsg, _value); +NUM2_MESSAGE(CChildDragMoveMsg, _value1, _value2); +NUM2_MESSAGE(CChildDragStartMsg, _value1, _value2); +RAW_MESSAGE(CClearChevPanelBits); +RAW_MESSAGE(CCorrectMusicPlayedMsg); +RAW_MESSAGE(CCreateMusicPlayerMsg); +RAW_MESSAGE(CCylinderHolderReadyMsg); +RAW_MESSAGE(CDeactivationMsg); +STR_MESSAGE(CDeliverCCarryMsg, _value); +RAW_MESSAGE(CDisableMaitreDProdReceptor); +RAW_MESSAGE(CDismissBotMsg); +RAW_MESSAGE(CDoffNavHelmet); +RAW_MESSAGE(CDonNavHelmet); +NUM_MESSAGE(CDoorbotNeededInElevatorMsg, _value); +RAW_MESSAGE(CDoorbotNeededInHomeMsg); +NUM_MESSAGE(CDropobjectMsg, _value); +NUM_MESSAGE(CDropZoneGotObjectMsg, _value); +NUM_MESSAGE(CDropZoneLostObjectMsg, _value); +NUM_MESSAGE(CEjectCylinderMsg, _value); +RAW_MESSAGE(CErasePhonographCylinderMsg); +NUM2_MESSAGE(CFreshenCookieMsg, _value1, _value2); +NUM_MESSAGE(CGetChevClassBits, _value); +NUM_MESSAGE(CGetChevClassNum, _value); +SNUM_MESSAGE(CGetChevCodeFromRoomNameMsg, _strValue, _numValue); +NUM_MESSAGE(CGetChevFloorBits, _value); +NUM_MESSAGE(CGetChevFloorNum, _value); +NUM_MESSAGE(CGetChevLiftBits, _value); +NUM_MESSAGE(CGetChevLiftNum, _value); +NUM_MESSAGE(CGetChevRoomBits, _value); +NUM_MESSAGE(CGetChevRoomNum, _value); +NUM2_MESSAGE_VAL(CHoseConnectedMsg, _value1, _value2, 1, 0); +RAW_MESSAGE(CInitializeAnimMsg); +NUM_MESSAGE(CIsEarBowlPuzzleDone, _value); +NUM_MESSAGE(CIsParrotPresentMsg, _value); +NUM_MESSAGE_VAL(CKeyCharMsg, _value, 32); +NUM2_MESSAGE(CLemonFallsFromTreeMsg, _value1, _value2); +NUM_MESSAGE(CLockPhonographMsg, _value); +RAW_MESSAGE(CMaitreDDefeatedMsg); +RAW_MESSAGE(CMaitreDHappyMsg); +NUM_MESSAGE(CMissiveOMatActionMsg, _value); +RAW_MESSAGE(CMoveToStartPosMsg); +NUM2_MESSAGE(CMovieEndMsg, _value1, _value2); +NUM2_MESSAGE(CMovieFrameMsg, _value1, _value2); +RAW_MESSAGE(CMusicHasStartedMsg); +RAW_MESSAGE(CMusicHasStoppedMsg); +RAW_MESSAGE(CMusicSettingChangedMsg); +NUM2_MESSAGE(CNPCPlayAnimationMsg, _value1, _value2); +NUM_MESSAGE(CNPCPlayIdleAnimationMsg, _value); +NUM3_MESSAGE(CNPCPlayTalkingAnimationMsg, _value1, _value2, _value3); +RAW_MESSAGE(CNPCQueueIdleAnimMsg); +STR_MESSAGE(CNutPuzzleMsg, _value); +NUM_MESSAGE(COnSummonBotMsg, _value); +RAW_MESSAGE(COpeningCreditsMsg); +NUM_MESSAGE(CPanningAwayFromParrotMsg, _value); +STR2_MESSAGE(CParrotSpeakMsg, _value1, _value2); +NUM2_MESSAGE(CParrotTriesChickenMsg, _value1, _value2); +NUM4_MESSAGE(CPassOnDragStartMsg, _value1, _value2, _value3, _value4); +NUM_MESSAGE(CPhonographPlayMsg, _value); +RAW_MESSAGE(CPhonographReadyToPlayMsg); +NUM_MESSAGE(CPhonographRecordMsg, _value); +NUM3_MESSAGE(CPhonographStopMsg, _value1, _value2, _value3); +NUM2_MESSAGE(CPlayRangeMsg, _value1, _value2); +NUM2_MESSAGE(CPlayerTriesRestaurantTableMsg, _value1, _value2); +NUM_MESSAGE(CPreSaveMsg, _value); +NUM_MESSAGE(CProdMaitreDMsg, _value); +NUM2_MESSAGE(CPumpingMsg, _value1, _value2); +NUM_MESSAGE(CPutBotBackInHisBoxMsg, _value); +NUM_MESSAGE(CPutParrotBackMsg, _value); +RAW_MESSAGE(CPuzzleSolvedMsg); +NUM3_MESSAGE(CQueryCylinderHolderMsg, _value1, _value2, _value3); +NUM3_MESSAGE(CQueryCylinderMsg, _value1, _value2, _value3); +NUM3_MESSAGE(CQueryCylinderNameMsg, _value1, _value2, _value3); +NUM3_MESSAGE(CQueryCylinderTypeMsg, _value1, _value2, _value3); +NUM_MESSAGE(CQueryMusicControlSettingMsg, _value); +NUM_MESSAGE(CQueryPhonographState, _value); +RAW_MESSAGE(CRecordOntoCylinderMsg); +RAW_MESSAGE(CRemoveFromGameMsg); +RAW_MESSAGE(CReplaceBowlAndNutsMsg); +STR_MESSAGE(CRestaurantMusicChanged, _value); +SNUM_MESSAGE(CSendCCarryMsg, _strValue, _numValue); +STR_MESSAGE_VAL(CSenseWorkingMsg, _value, "Not Working"); +NUM2_MESSAGE(CServiceElevatorFloorChangeMsg, _value1, _value2); +RAW_MESSAGE(CServiceElevatorFloorRequestMsg); +NUM_MESSAGE_VAL(CServiceElevatorMsg, _value, 4); +NUM2_MESSAGE(CSetChevButtonImageMsg, _value1, _value2); +NUM_MESSAGE(CSetChevClassBits, _value); +NUM_MESSAGE(CSetChevFloorBits, _value); +NUM_MESSAGE(CSetChevLiftBits, _value); +NUM2_MESSAGE(CSetChevPanelBitMsg, _value1, _value2); +NUM_MESSAGE(CSetChevPanelButtonsMsg, _value); +NUM_MESSAGE(CSetChevRoomBits, _value); +RAW_MESSAGE(CSetMusicControlsMsg); +SNUM_MESSAGE(CSetVarMsg, _varName, _value); +NUM2_MESSAGE_VAL(CSetVolumeMsg, _value1, _value2, 70, 0); +SNUM_MESSAGE(CShipSettingMsg, _strValue, _numValue); +STR_MESSAGE_VAL(CShowTextMsg, _value, "NO TEXT INCLUDED!!!"); +SNUM_MESSAGE(CSignalObject, _strValue, _numValue); +NUM2_MESSAGE(CSpeechFallsFromTreeMsg, _value1, _value2); +NUM_MESSAGE(CStartMusicMsg, _value); +NUM3_MESSAGE(CStatusChangeMsg, _value1, _value2, _value3); +NUM_MESSAGE(CStopMusicMsg, _value); +RAW_MESSAGE(CSubDeliverCCarryMsg); +RAW_MESSAGE(CSubSendCCarryMsg); +RAW_MESSAGE(CSUBTransition); +RAW_MESSAGE(CSubTurnOffMsg); +RAW_MESSAGE(CSubTurnOnMsg); +SNUM_MESSAGE(CSummonBotMsg, _strValue, _numValue); +STR_MESSAGE(CSummonBotQuerryMsg, _value); +STR_MESSAGE(CTakeHeadPieceMsg, _value); +STR2_MESSAGE(CTextInputMsg, _value1, _value2); +NUM_MESSAGE(CTimeDilationMsg, _value); +NUM_MESSAGE(CTimeMsg, _value); +RAW_MESSAGE(CTitleSequenceEndedMsg); +RAW_MESSAGE(CTransitMsg); +NUM_MESSAGE(CTriggerAutoMusicPlayerMsg, _value); +NUM_MESSAGE(CTriggerNPCEvent, _value); +NUM4_MESSAGE(CTrueTalkGetAnimSetMsg, _value1, _value2, _value3, _value4); +SNUM_MESSAGE(CTrueTalkGetAssetDetailsMsg, _strValue, _numValue); +NUM2_MESSAGE_VAL(CTrueTalkGetStateValueMsg, _value1, _value2, 0, -1000); +NUM2_MESSAGE(CTrueTalkNotifySpeechEndedMsg, _value1, _value2); +NUM3_MESSAGE(CTrueTalkNotifySpeechStartedMsg, _value1, _value2, _value); +NUM_MESSAGE(CTrueTalkQueueUpAnimSetMsg, _value); +RAW_MESSAGE(CTrueTalkSelfQueueAnimSetMsg); +NUM3_MESSAGE(CTrueTalkTriggerActionMsg, _value1, _value2, _value3); +RAW_MESSAGE(CTurnOff); +RAW_MESSAGE(CTurnOn); +NUM_MESSAGE(CUse, _value); +NUM_MESSAGE(CUseWithCharMsg, _value); +NUM_MESSAGE(CUseWithOtherMsg, _value); +NUM_MESSAGE(CVirtualKeyCharMsg, _value); +NUM2_MESSAGE_VAL(CVisibleMsg, _value1, _value2, 1, 0); + +} // End of namespace Titanic + +#endif /* TITANIC_MESSAGE_H */ diff --git a/engines/titanic/messages/mouse_messages.h b/engines/titanic/messages/mouse_messages.h new file mode 100644 index 0000000000..6b466038db --- /dev/null +++ b/engines/titanic/messages/mouse_messages.h @@ -0,0 +1,96 @@ +/* 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. + * + */ + +#ifndef TITANIC_MOUSE_MESSAGES_H +#define TITANIC_MOUSE_MESSAGES_H + +#include "titanic/messages/messages.h" + +namespace Titanic { + +class CMouseMsg : public CMessage { +public: + int _buttons; + Common::Point _mousePos; +public: + CMouseMsg() : _buttons(0) {} + virtual const char *getClassName() const { return "CMouseMsg"; } +}; + +class CMouseMoveMsg : public CMouseMsg { +public: + virtual const char *getClassName() const { return "CMouseMoveMsg"; } +}; + +class CMouseButtonMsg : public CMouseMsg { +public: + int _field10; +public: + CMouseButtonMsg() : CMouseMsg(), _field10(0) {} + virtual const char *getClassName() const { return "CMouseButtonMsg"; } +}; + +class CMouseButtonDownMsg : public CMouseButtonMsg { +public: + virtual const char *getClassName() const { return "CMouseButtonDownMsg"; } +}; + +class CMouseButtonUpMsg : public CMouseButtonMsg { +public: + virtual const char *getClassName() const { return "CMouseButtonUpMsg"; } +}; + +class CMouseButtonDoubleClickMsg : public CMouseButtonMsg { +public: + virtual const char *getClassName() const { return "CMouseButtonDoubleClickMsg"; } +}; + +class CMouseDragMsg : public CMouseMsg { +public: + virtual const char *getClassName() const { return "CMouseDragMsg"; } +}; + +class CMouseDragMoveMsg : public CMouseDragMsg { +public: + virtual const char *getClassName() const { return "CMouseDragMoveMsg"; } +}; + +class CMouseDragStartMsg : public CMouseDragMsg { +public: + int _field10; + int _field14; +public: + CMouseDragStartMsg() : CMouseDragMsg(), _field10(0), _field14(0) {} + virtual const char *getClassName() const { return "CMouseDragStartMsg"; } +}; + +class CMouseDragEndMsg : public CMouseDragMsg { +public: + int _field10; +public: + CMouseDragEndMsg() : CMouseDragMsg(), _field10(0) {} + virtual const char *getClassName() const { return "CMouseDragEndMsg"; } +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MOUSE_MESSAGES_H */ diff --git a/engines/titanic/messages/pet_messages.h b/engines/titanic/messages/pet_messages.h new file mode 100644 index 0000000000..1aeaec0d0d --- /dev/null +++ b/engines/titanic/messages/pet_messages.h @@ -0,0 +1,47 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_MESSAGES_H +#define TITANIC_PET_MESSAGES_H + +#include "titanic/messages/messages.h" + +namespace Titanic { + +RAW_MESSAGE(CPETDeliverMsg); +RAW_MESSAGE(CPETGainedObjectMsg); +RAW_MESSAGE(CPETHelmetOnOffMsg); +RAW_MESSAGE(CPETKeyboardOnOffMsg); +RAW_MESSAGE(CPETLostObjectMsg); +RAW_MESSAGE(CPETObjectSelectedMsg); +NUM_MESSAGE(CPETObjectStateMsg, _value); +RAW_MESSAGE(CPETPhotoOnOffMsg); +NUM_MESSAGE(CPETPlaySoundMsg, _value); +RAW_MESSAGE(CPETReceiveMsg); +RAW_MESSAGE(CPETSetStarDestinationMsg); +NUM_MESSAGE(CPETStarFieldLockMsg, _value); +RAW_MESSAGE(CPETStereoFieldOnOffMsg); +SNUM_MESSAGE_VAL(CPETTargetMsg, _strValue, _numValue, nullptr, -1); + +} // End of namespace Titanic + +#endif /* TITANIC_PET_MESSAGES_H */ diff --git a/engines/titanic/messages/sub_accept_ccarry_msg.h b/engines/titanic/messages/sub_accept_ccarry_msg.h deleted file mode 100644 index b7c48ae81e..0000000000 --- a/engines/titanic/messages/sub_accept_ccarry_msg.h +++ /dev/null @@ -1,45 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_SUB_ACCEPT_CCARRY_MSG_H -#define TITANIC_SUB_ACCEPT_CCARRY_MSG_H - -#include "titanic/messages/message.h" - -namespace Titanic { - -class CSubAcceptCCarryMsg : public CMessage { -public: - CString _string1; - int _value1, _value2, _value3; -public: - CSubAcceptCCarryMsg() : _value1(0), _value2(0), _value3(0) {} - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSubAcceptCCarryMsg"; } -}; - -} // End of namespace Titanic - -#endif /* TITANIC_SUB_ACCEPT_CCARRY_MSG_H */ diff --git a/engines/titanic/messages/transport_msg.h b/engines/titanic/messages/transport_msg.h deleted file mode 100644 index 513a2504bc..0000000000 --- a/engines/titanic/messages/transport_msg.h +++ /dev/null @@ -1,45 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_TRANSPORT_MSG_H -#define TITANIC_TRANSPORT_MSG_H - -#include "titanic/messages/message.h" - -namespace Titanic { - -class CTransportMsg : public CMessage { -public: - CString _string; - int _value1, _value2; -public: - CTransportMsg() : _value1(0), _value2(0) {} - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CTransportMsg"; } -}; - -} // End of namespace Titanic - -#endif /* TITANIC_TRANSPORT_MSG_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index c20afb299b..d8fdbebc73 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -111,7 +111,7 @@ MODULE_OBJS := \ gfx/toggle_switch.o \ messages/auto_sound_event.o \ messages/door_auto_sound_event.o \ - messages/message.o \ + messages/messages.o \ moves/enter_bomb_room.o \ moves/exit_arboretum.o \ moves/exit_bridge.o \ -- cgit v1.2.3 From 9cb1390c2636f6b586b0f6dfca6573bc05dc6592 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Feb 2016 07:49:21 -0500 Subject: TITANIC: Implemented CClickResponder and descendents --- engines/titanic/core/click_responder.cpp | 43 +++++++++++++++++++++ engines/titanic/core/click_responder.h | 52 +++++++++++++++++++++++++ engines/titanic/core/saveable_object.cpp | 12 ++++++ engines/titanic/game/desk_click_responder.cpp | 43 +++++++++++++++++++++ engines/titanic/game/desk_click_responder.h | 53 ++++++++++++++++++++++++++ engines/titanic/game/null_port_hole.cpp | 48 +++++++++++++++++++++++ engines/titanic/game/null_port_hole.h | 52 +++++++++++++++++++++++++ engines/titanic/game/sgt_upper_doors_sound.cpp | 45 ++++++++++++++++++++++ engines/titanic/game/sgt_upper_doors_sound.h | 52 +++++++++++++++++++++++++ engines/titanic/module.mk | 4 ++ 10 files changed, 404 insertions(+) create mode 100644 engines/titanic/core/click_responder.cpp create mode 100644 engines/titanic/core/click_responder.h create mode 100644 engines/titanic/game/desk_click_responder.cpp create mode 100644 engines/titanic/game/desk_click_responder.h create mode 100644 engines/titanic/game/null_port_hole.cpp create mode 100644 engines/titanic/game/null_port_hole.h create mode 100644 engines/titanic/game/sgt_upper_doors_sound.cpp create mode 100644 engines/titanic/game/sgt_upper_doors_sound.h diff --git a/engines/titanic/core/click_responder.cpp b/engines/titanic/core/click_responder.cpp new file mode 100644 index 0000000000..9e8564b6d5 --- /dev/null +++ b/engines/titanic/core/click_responder.cpp @@ -0,0 +1,43 @@ +/* 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 "titanic/core/click_responder.h" + +namespace Titanic { + +void CClickResponder::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + + CGameObject::save(file, indent); +} + +void CClickResponder::load(SimpleFile *file) { + file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/core/click_responder.h b/engines/titanic/core/click_responder.h new file mode 100644 index 0000000000..1f2fa72f18 --- /dev/null +++ b/engines/titanic/core/click_responder.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_CLICK_RESPONDER_H +#define TITANIC_CLICK_RESPONDER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CClickResponder : public CGameObject { +protected: + CString _string1, _string2; +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CClickResponder"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CLICK_RESPONDER_H */ diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index dbbf8aa205..3ad4c7365b 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -51,6 +51,7 @@ #include "titanic/core/saveable_object.h" #include "titanic/core/background.h" +#include "titanic/core/click_responder.h" #include "titanic/core/file_item.h" #include "titanic/core/link_item.h" #include "titanic/core/list.h" @@ -70,14 +71,17 @@ #include "titanic/game/cdrom_tray.h" #include "titanic/game/computer_screen.h" #include "titanic/game/dead_area.h" +#include "titanic/game/desk_click_responder.h" #include "titanic/game/doorbot_home_handler.h" #include "titanic/game/drawer.h" #include "titanic/game/drop_target.h" #include "titanic/game/hammer_dispensor_button.h" +#include "titanic/game/null_port_hole.h" #include "titanic/game/pet_position.h" #include "titanic/game/room_item.h" #include "titanic/game/service_elevator_door.h" #include "titanic/game/sgt_state_room.h" +#include "titanic/game/sgt_upper_doors_sound.h" #include "titanic/game/start_action.h" #include "titanic/game/sub_glass.h" #include "titanic/game/television.h" @@ -180,6 +184,7 @@ DEFFN(CPlugIn); DEFFN(CSweets); DEFFN(CBackground); +DEFFN(CClickResponder); DEFFN(CFileItem); DEFFN(CFileListItem); DEFFN(CLinkItem); @@ -199,13 +204,16 @@ DEFFN(CCDROMComputer); DEFFN(CCDROMTray); DEFFN(CComputerScreen); DEFFN(CDeadArea); +DEFFN(CDeskClickResponder); DEFFN(CDoorbotHomeHandler); DEFFN(CDropTarget); DEFFN(CHammerDispensorButton); +DEFFN(CNullPortHole); DEFFN(CPETPosition); DEFFN(CRoomItem); DEFFN(CServiceElevatorDoor); DEFFN(CSGTStateRoom); +DEFFN(CSGTUpperDoorsSound); DEFFN(CStartAction); DEFFN(CSUBGlass); DEFFN(CTelevision); @@ -472,6 +480,7 @@ void CSaveableObject::initClassList() { ADDFN(CSweets); ADDFN(CBackground); + ADDFN(CClickResponder); ADDFN(CFileItem); ADDFN(CFileListItem); ADDFN(CLinkItem); @@ -491,13 +500,16 @@ void CSaveableObject::initClassList() { ADDFN(CCDROMTray); ADDFN(CComputerScreen); ADDFN(CDeadArea); + ADDFN(CDeskClickResponder); ADDFN(CDoorbotHomeHandler); ADDFN(CDropTarget); ADDFN(CHammerDispensorButton); + ADDFN(CNullPortHole); ADDFN(CPETPosition); ADDFN(CRoomItem); ADDFN(CServiceElevatorDoor); ADDFN(CSGTStateRoom); + ADDFN(CSGTUpperDoorsSound); ADDFN(CStartAction); ADDFN(CSUBGlass); ADDFN(CTelevision); diff --git a/engines/titanic/game/desk_click_responder.cpp b/engines/titanic/game/desk_click_responder.cpp new file mode 100644 index 0000000000..312fe564af --- /dev/null +++ b/engines/titanic/game/desk_click_responder.cpp @@ -0,0 +1,43 @@ +/* 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 "titanic/game/desk_click_responder.h" + +namespace Titanic { + +void CDeskClickResponder::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldD4, indent); + file->writeNumberLine(_fieldD8, indent); + + CClickResponder::save(file, indent); +} + +void CDeskClickResponder::load(SimpleFile *file) { + file->readNumber(); + _fieldD4 = file->readNumber(); + _fieldD8 = file->readNumber(); + + CClickResponder::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/desk_click_responder.h b/engines/titanic/game/desk_click_responder.h new file mode 100644 index 0000000000..94afece266 --- /dev/null +++ b/engines/titanic/game/desk_click_responder.h @@ -0,0 +1,53 @@ +/* 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. + * + */ + +#ifndef TITANIC_DESK_CLICK_RESPONDER_H +#define TITANIC_DESK_CLICK_RESPONDER_H + +#include "titanic/core/click_responder.h" + +namespace Titanic { + +class CDeskClickResponder : public CClickResponder { +protected: + int _fieldD4; + int _fieldD8; +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CDeskClickResponder"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DESK_CLICK_RESPONDER_H */ diff --git a/engines/titanic/game/null_port_hole.cpp b/engines/titanic/game/null_port_hole.cpp new file mode 100644 index 0000000000..c437dfea10 --- /dev/null +++ b/engines/titanic/game/null_port_hole.cpp @@ -0,0 +1,48 @@ +/* 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 "titanic/game/null_port_hole.h" + +namespace Titanic { + +CNullPortHole::CNullPortHole() : CClickResponder() { + _string1 = "For a better view, why not visit the Promenade Deck?"; + _string2 = "b#48.wav"; +} + +void CNullPortHole::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string2, indent); + file->writeQuotedLine(_string1, indent); + + CClickResponder::save(file, indent); +} + +void CNullPortHole::load(SimpleFile *file) { + file->readNumber(); + _string2 = file->readString(); + _string1 = file->readString(); + + CClickResponder::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/null_port_hole.h b/engines/titanic/game/null_port_hole.h new file mode 100644 index 0000000000..2caff276d5 --- /dev/null +++ b/engines/titanic/game/null_port_hole.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_NULL_PORT_HOLE_H +#define TITANIC_NULL_PORT_HOLE_H + +#include "titanic/core/click_responder.h" + +namespace Titanic { + +class CNullPortHole : public CClickResponder { +public: + CNullPortHole(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CNullPortHole"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_NULL_PORT_HOLE_H */ diff --git a/engines/titanic/game/sgt_upper_doors_sound.cpp b/engines/titanic/game/sgt_upper_doors_sound.cpp new file mode 100644 index 0000000000..23809262e1 --- /dev/null +++ b/engines/titanic/game/sgt_upper_doors_sound.cpp @@ -0,0 +1,45 @@ +/* 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 "titanic/game/sgt_upper_doors_sound.h" + +namespace Titanic { + +CSGTUpperDoorsSound::CSGTUpperDoorsSound() { + _string2 = "b#53.wav"; +} + +void CSGTUpperDoorsSound::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string2, indent); + + CClickResponder::save(file, indent); +} + +void CSGTUpperDoorsSound::load(SimpleFile *file) { + file->readNumber(); + _string2 = file->readString(); + + CClickResponder::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt_upper_doors_sound.h b/engines/titanic/game/sgt_upper_doors_sound.h new file mode 100644 index 0000000000..ed97627315 --- /dev/null +++ b/engines/titanic/game/sgt_upper_doors_sound.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_SGT_UPPER_DOORS_SOUND_H +#define TITANIC_SGT_UPPER_DOORS_SOUND_H + +#include "titanic/core/click_responder.h" + +namespace Titanic { + +class CSGTUpperDoorsSound : public CClickResponder { +public: + CSGTUpperDoorsSound(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSGTUpperDoorsSound"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SGT_UPPER_DOORS_SOUND_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index d8fdbebc73..855ba0bcb7 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -44,6 +44,7 @@ MODULE_OBJS := \ carry/plug_in.o \ carry/sweets.o \ core/background.o \ + core/click_responder.o \ core/dont_save_file_item.o \ core/file_item.o \ core/game_object.o \ @@ -67,14 +68,17 @@ MODULE_OBJS := \ game/cdrom_tray.o \ game/computer_screen.o \ game/dead_area.o \ + game/desk_click_responder.o \ game/doorbot_home_handler.o \ game/drawer.o \ game/drop_target.o \ game/hammer_dispensor_button.o \ game/pet_position.o \ + game/null_port_hole.o \ game/room_item.o \ game/service_elevator_door.o \ game/sgt_state_room.o \ + game/sgt_upper_doors_sound.o \ game/start_action.o \ game/sub_glass.o \ game/television.o \ -- cgit v1.2.3 From 6cb2a5e81f03ff984a2bc8b214c02f0a3c255952 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Feb 2016 08:09:29 -0500 Subject: TITANIC: Added CCredits --- engines/titanic/core/saveable_object.cpp | 6 ++++ engines/titanic/game/credits.cpp | 46 +++++++++++++++++++++++++++ engines/titanic/game/credits.h | 54 ++++++++++++++++++++++++++++++++ engines/titanic/game/credits_button.cpp | 42 +++++++++++++++++++++++++ engines/titanic/game/credits_button.h | 54 ++++++++++++++++++++++++++++++++ engines/titanic/module.mk | 2 ++ 6 files changed, 204 insertions(+) create mode 100644 engines/titanic/game/credits.cpp create mode 100644 engines/titanic/game/credits.h create mode 100644 engines/titanic/game/credits_button.cpp create mode 100644 engines/titanic/game/credits_button.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 3ad4c7365b..799ee3c766 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -70,6 +70,8 @@ #include "titanic/game/cdrom_computer.h" #include "titanic/game/cdrom_tray.h" #include "titanic/game/computer_screen.h" +#include "titanic/game/credits.h" +#include "titanic/game/credits_button.h" #include "titanic/game/dead_area.h" #include "titanic/game/desk_click_responder.h" #include "titanic/game/doorbot_home_handler.h" @@ -203,6 +205,8 @@ DEFFN(CCDROM); DEFFN(CCDROMComputer); DEFFN(CCDROMTray); DEFFN(CComputerScreen); +DEFFN(CCredits); +DEFFN(CCreditsButton); DEFFN(CDeadArea); DEFFN(CDeskClickResponder); DEFFN(CDoorbotHomeHandler); @@ -499,6 +503,8 @@ void CSaveableObject::initClassList() { ADDFN(CCDROMComputer); ADDFN(CCDROMTray); ADDFN(CComputerScreen); + ADDFN(CCredits); + ADDFN(CCreditsButton); ADDFN(CDeadArea); ADDFN(CDeskClickResponder); ADDFN(CDoorbotHomeHandler); diff --git a/engines/titanic/game/credits.cpp b/engines/titanic/game/credits.cpp new file mode 100644 index 0000000000..178d268fb6 --- /dev/null +++ b/engines/titanic/game/credits.cpp @@ -0,0 +1,46 @@ +/* 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 "titanic/game/credits.h" + +namespace Titanic { + +CCredits::CCredits() : CGameObject(), _fieldBC(-1), _fieldC0(1) { +} + +void CCredits::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + + CGameObject::save(file, indent); +} + +void CCredits::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/credits.h b/engines/titanic/game/credits.h new file mode 100644 index 0000000000..0e35a58174 --- /dev/null +++ b/engines/titanic/game/credits.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_CREDITS_H +#define TITANIC_CREDITS_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CCredits : public CGameObject { +public: + int _fieldBC, _fieldC0; +public: + CCredits(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CCredits"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CREDITS_H */ diff --git a/engines/titanic/game/credits_button.cpp b/engines/titanic/game/credits_button.cpp new file mode 100644 index 0000000000..0ab23c1efc --- /dev/null +++ b/engines/titanic/game/credits_button.cpp @@ -0,0 +1,42 @@ +/* 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 "titanic/game/credits_button.h" + +namespace Titanic { + +CCreditsButton::CCreditsButton() : CBackground(), _fieldE0(1) { +} + +void CCreditsButton::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + CBackground::save(file, indent); +} + +void CCreditsButton::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/credits_button.h b/engines/titanic/game/credits_button.h new file mode 100644 index 0000000000..b22ce79a3b --- /dev/null +++ b/engines/titanic/game/credits_button.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_CREDITS_BUTTON_H +#define TITANIC_CREDITS_BUTTON_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CCreditsButton : public CBackground { +public: + int _fieldE0; +public: + CCreditsButton(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CCreditsButton"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CREDITS_BUTTON_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 855ba0bcb7..9faf157534 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -67,6 +67,8 @@ MODULE_OBJS := \ game/cdrom_computer.o \ game/cdrom_tray.o \ game/computer_screen.o \ + game/credits.o \ + game/credits_button.o \ game/dead_area.o \ game/desk_click_responder.o \ game/doorbot_home_handler.o \ -- cgit v1.2.3 From decec97c4b7611c56135cf222544afa9f043c894 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Feb 2016 10:57:45 -0500 Subject: TITANIC: Implement various parrot classes --- engines/titanic/core/drop_target.cpp | 72 ++++++++++++++++++++++ engines/titanic/core/drop_target.h | 67 ++++++++++++++++++++ engines/titanic/core/multi_drop_target.cpp | 43 +++++++++++++ engines/titanic/core/multi_drop_target.h | 55 +++++++++++++++++ engines/titanic/core/saveable_object.cpp | 44 ++++++++++++- engines/titanic/game/drop_target.cpp | 72 ---------------------- engines/titanic/game/drop_target.h | 67 -------------------- .../game/parrot/parrot_lobby_controller.cpp | 37 +++++++++++ .../titanic/game/parrot/parrot_lobby_controller.h | 50 +++++++++++++++ .../game/parrot/parrot_lobby_link_updater.cpp | 37 +++++++++++ .../game/parrot/parrot_lobby_link_updater.h | 54 ++++++++++++++++ .../titanic/game/parrot/parrot_lobby_object.cpp | 59 ++++++++++++++++++ engines/titanic/game/parrot/parrot_lobby_object.h | 57 +++++++++++++++++ .../game/parrot/parrot_lobby_view_object.cpp | 39 ++++++++++++ .../titanic/game/parrot/parrot_lobby_view_object.h | 54 ++++++++++++++++ engines/titanic/game/parrot/parrot_loser.cpp | 37 +++++++++++ engines/titanic/game/parrot/parrot_loser.h | 50 +++++++++++++++ .../titanic/game/parrot/parrot_nut_bowl_actor.cpp | 47 ++++++++++++++ .../titanic/game/parrot/parrot_nut_bowl_actor.h | 54 ++++++++++++++++ engines/titanic/game/parrot/parrot_nut_eater.cpp | 45 ++++++++++++++ engines/titanic/game/parrot/parrot_nut_eater.h | 58 +++++++++++++++++ .../titanic/game/parrot/parrot_perch_holder.cpp | 37 +++++++++++ engines/titanic/game/parrot/parrot_perch_holder.h | 50 +++++++++++++++ engines/titanic/game/parrot/parrot_succubus.cpp | 49 +++++++++++++++ engines/titanic/game/parrot/parrot_succubus.h | 58 +++++++++++++++++ engines/titanic/game/parrot/parrot_trigger.cpp | 39 ++++++++++++ engines/titanic/game/parrot/parrot_trigger.h | 54 ++++++++++++++++ engines/titanic/game/port_hole.cpp | 49 +++++++++++++++ engines/titanic/game/port_hole.h | 55 +++++++++++++++++ engines/titanic/game/sweet_bowl.cpp | 37 +++++++++++ engines/titanic/game/sweet_bowl.h | 50 +++++++++++++++ engines/titanic/module.mk | 15 ++++- engines/titanic/titanic.cpp | 3 + 33 files changed, 1452 insertions(+), 142 deletions(-) create mode 100644 engines/titanic/core/drop_target.cpp create mode 100644 engines/titanic/core/drop_target.h create mode 100644 engines/titanic/core/multi_drop_target.cpp create mode 100644 engines/titanic/core/multi_drop_target.h delete mode 100644 engines/titanic/game/drop_target.cpp delete mode 100644 engines/titanic/game/drop_target.h create mode 100644 engines/titanic/game/parrot/parrot_lobby_controller.cpp create mode 100644 engines/titanic/game/parrot/parrot_lobby_controller.h create mode 100644 engines/titanic/game/parrot/parrot_lobby_link_updater.cpp create mode 100644 engines/titanic/game/parrot/parrot_lobby_link_updater.h create mode 100644 engines/titanic/game/parrot/parrot_lobby_object.cpp create mode 100644 engines/titanic/game/parrot/parrot_lobby_object.h create mode 100644 engines/titanic/game/parrot/parrot_lobby_view_object.cpp create mode 100644 engines/titanic/game/parrot/parrot_lobby_view_object.h create mode 100644 engines/titanic/game/parrot/parrot_loser.cpp create mode 100644 engines/titanic/game/parrot/parrot_loser.h create mode 100644 engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp create mode 100644 engines/titanic/game/parrot/parrot_nut_bowl_actor.h create mode 100644 engines/titanic/game/parrot/parrot_nut_eater.cpp create mode 100644 engines/titanic/game/parrot/parrot_nut_eater.h create mode 100644 engines/titanic/game/parrot/parrot_perch_holder.cpp create mode 100644 engines/titanic/game/parrot/parrot_perch_holder.h create mode 100644 engines/titanic/game/parrot/parrot_succubus.cpp create mode 100644 engines/titanic/game/parrot/parrot_succubus.h create mode 100644 engines/titanic/game/parrot/parrot_trigger.cpp create mode 100644 engines/titanic/game/parrot/parrot_trigger.h create mode 100644 engines/titanic/game/port_hole.cpp create mode 100644 engines/titanic/game/port_hole.h create mode 100644 engines/titanic/game/sweet_bowl.cpp create mode 100644 engines/titanic/game/sweet_bowl.h diff --git a/engines/titanic/core/drop_target.cpp b/engines/titanic/core/drop_target.cpp new file mode 100644 index 0000000000..9782967105 --- /dev/null +++ b/engines/titanic/core/drop_target.cpp @@ -0,0 +1,72 @@ +/* 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 "titanic/core/drop_target.h" + +namespace Titanic { + +CDropTarget::CDropTarget() : CGameObject(), _fieldC4(0), + _fieldD4(0), _fieldE4(0), _fieldF4(0), _fieldF8(0), + _fieldFC(0), _field10C(1), _field110(8), _field114(20) { +} + +void CDropTarget::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writePoint(_pos1, indent); + file->writeNumberLine(_fieldC4, indent); + file->writeQuotedLine(_string1, indent); + file->writeNumberLine(_fieldD4, indent); + file->writeQuotedLine(_string2, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeQuotedLine(_string3, indent); + file->writeNumberLine(_fieldF4, indent); + file->writeNumberLine(_fieldF8, indent); + file->writeNumberLine(_fieldFC, indent); + file->writeQuotedLine(_string4, indent); + file->writeNumberLine(_field10C, indent); + file->writeNumberLine(_field110, indent); + file->writeNumberLine(_field114, indent); + + CGameObject::save(file, indent); +} + +void CDropTarget::load(SimpleFile *file) { + file->readNumber(); + _pos1 = file->readPoint(); + _fieldC4 = file->readNumber(); + _string1 = file->readString(); + _fieldD4 = file->readNumber(); + _string2 = file->readString(); + _fieldE4 = file->readNumber(); + _string3 = file->readString(); + _fieldF4 = file->readNumber(); + _fieldF8 = file->readNumber(); + _fieldFC = file->readNumber(); + _string4 = file->readString(); + _field10C = file->readNumber(); + _field110 = file->readNumber(); + _field114 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/core/drop_target.h b/engines/titanic/core/drop_target.h new file mode 100644 index 0000000000..b106623f62 --- /dev/null +++ b/engines/titanic/core/drop_target.h @@ -0,0 +1,67 @@ +/* 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. + * + */ + +#ifndef TITANIC_DROP_TARGET_H +#define TITANIC_DROP_TARGET_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CDropTarget : public CGameObject { +private: + Common::Point _pos1; + int _fieldC4; + CString _string1; + int _fieldD4; + CString _string2; + int _fieldE4; + CString _string3; + int _fieldF4; + int _fieldF8; + int _fieldFC; + CString _string4; + int _field10C; + int _field110; + int _field114; +public: + CDropTarget(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CDropTarget"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DROP_TARGET_H */ diff --git a/engines/titanic/core/multi_drop_target.cpp b/engines/titanic/core/multi_drop_target.cpp new file mode 100644 index 0000000000..1f6e6cf210 --- /dev/null +++ b/engines/titanic/core/multi_drop_target.cpp @@ -0,0 +1,43 @@ +/* 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 "titanic/core/multi_drop_target.h" + +namespace Titanic { + +void CMultiDropTarget::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string5, indent); + file->writeQuotedLine(_string6, indent); + + CDropTarget::save(file, indent); +} + +void CMultiDropTarget::load(SimpleFile *file) { + file->readNumber(); + _string5 = file->readString(); + _string6 = file->readString(); + + CDropTarget::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/core/multi_drop_target.h b/engines/titanic/core/multi_drop_target.h new file mode 100644 index 0000000000..db6f605062 --- /dev/null +++ b/engines/titanic/core/multi_drop_target.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_MULTI_DROP_TARGET_H +#define TITANIC_MULTI_DROP_TARGET_H + +#include "titanic/core/drop_target.h" + +namespace Titanic { + +class CMultiDropTarget : public CDropTarget { +public: + CString _string5; + CString _string6; +public: + CMultiDropTarget() : CDropTarget(), _string5("1,2") {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMultiDropTarget"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CLICK_RESPONDER_H */ diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 799ee3c766..411f1b4ff9 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -52,11 +52,13 @@ #include "titanic/core/saveable_object.h" #include "titanic/core/background.h" #include "titanic/core/click_responder.h" +#include "titanic/core/drop_target.h" #include "titanic/core/file_item.h" #include "titanic/core/link_item.h" #include "titanic/core/list.h" #include "titanic/core/message_target.h" #include "titanic/core/movie_clip.h" +#include "titanic/core/multi_drop_target.h" #include "titanic/core/node_item.h" #include "titanic/core/project_item.h" #include "titanic/core/saveable_object.h" @@ -76,17 +78,28 @@ #include "titanic/game/desk_click_responder.h" #include "titanic/game/doorbot_home_handler.h" #include "titanic/game/drawer.h" -#include "titanic/game/drop_target.h" #include "titanic/game/hammer_dispensor_button.h" #include "titanic/game/null_port_hole.h" #include "titanic/game/pet_position.h" +#include "titanic/game/port_hole.h" #include "titanic/game/room_item.h" #include "titanic/game/service_elevator_door.h" #include "titanic/game/sgt_state_room.h" #include "titanic/game/sgt_upper_doors_sound.h" #include "titanic/game/start_action.h" #include "titanic/game/sub_glass.h" +#include "titanic/game/sweet_bowl.h" #include "titanic/game/television.h" +#include "titanic/game/parrot/parrot_lobby_controller.h" +#include "titanic/game/parrot/parrot_lobby_link_updater.h" +#include "titanic/game/parrot/parrot_lobby_object.h" +#include "titanic/game/parrot/parrot_lobby_view_object.h" +#include "titanic/game/parrot/parrot_loser.h" +#include "titanic/game/parrot/parrot_nut_bowl_actor.h" +#include "titanic/game/parrot/parrot_nut_eater.h" +#include "titanic/game/parrot/parrot_perch_holder.h" +#include "titanic/game/parrot/parrot_succubus.h" +#include "titanic/game/parrot/parrot_trigger.h" #include "titanic/gfx/act_button.h" #include "titanic/gfx/changes_season_button.h" @@ -187,12 +200,14 @@ DEFFN(CSweets); DEFFN(CBackground); DEFFN(CClickResponder); +DEFFN(CDropTarget); DEFFN(CFileItem); DEFFN(CFileListItem); DEFFN(CLinkItem); DEFFN(CMessageTarget); DEFFN(CMovieClip); DEFFN(CMovieClipList); +DEFFN(CMultiDropTarget); DEFFN(CNodeItem); DEFFN(CProjectItem); DEFFN(CTurnOnObject); @@ -210,17 +225,28 @@ DEFFN(CCreditsButton); DEFFN(CDeadArea); DEFFN(CDeskClickResponder); DEFFN(CDoorbotHomeHandler); -DEFFN(CDropTarget); DEFFN(CHammerDispensorButton); DEFFN(CNullPortHole); DEFFN(CPETPosition); +DEFFN(CPortHole); DEFFN(CRoomItem); DEFFN(CServiceElevatorDoor); DEFFN(CSGTStateRoom); DEFFN(CSGTUpperDoorsSound); DEFFN(CStartAction); DEFFN(CSUBGlass); +DEFFN(CSweetBowl); DEFFN(CTelevision); +DEFFN(CParrotLobbyController); +DEFFN(CParrotLobbyLinkUpdater); +DEFFN(CParrotLobbyObject); +DEFFN(CParrotLobbyViewObject); +DEFFN(CParrotLoser); +DEFFN(CParrotNutBowlActor); +DEFFN(CParrotNutEater); +DEFFN(CParrotPerchHolder); +DEFFN(CParrotSuccUBus); +DEFFN(CParrotTrigger); DEFFN(CActButton); DEFFN(CChangesSeasonButton); @@ -485,12 +511,14 @@ void CSaveableObject::initClassList() { ADDFN(CBackground); ADDFN(CClickResponder); + ADDFN(CDropTarget); ADDFN(CFileItem); ADDFN(CFileListItem); ADDFN(CLinkItem); ADDFN(CMessageTarget); ADDFN(CMovieClip); ADDFN(CMovieClipList); + ADDFN(CMultiDropTarget); ADDFN(CNodeItem); ADDFN(CProjectItem); ADDFN(CTreeItem); @@ -512,13 +540,25 @@ void CSaveableObject::initClassList() { ADDFN(CHammerDispensorButton); ADDFN(CNullPortHole); ADDFN(CPETPosition); + ADDFN(CPortHole); ADDFN(CRoomItem); ADDFN(CServiceElevatorDoor); ADDFN(CSGTStateRoom); ADDFN(CSGTUpperDoorsSound); ADDFN(CStartAction); ADDFN(CSUBGlass); + ADDFN(CSweetBowl); ADDFN(CTelevision); + ADDFN(CParrotLobbyController); + ADDFN(CParrotLobbyLinkUpdater); + ADDFN(CParrotLobbyObject); + ADDFN(CParrotLobbyViewObject); + ADDFN(CParrotLoser); + ADDFN(CParrotNutBowlActor); + ADDFN(CParrotNutEater); + ADDFN(CParrotPerchHolder); + ADDFN(CParrotSuccUBus); + ADDFN(CParrotTrigger); ADDFN(CActButton); ADDFN(CChangesSeasonButton); diff --git a/engines/titanic/game/drop_target.cpp b/engines/titanic/game/drop_target.cpp deleted file mode 100644 index 34a87e067e..0000000000 --- a/engines/titanic/game/drop_target.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* 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 "titanic/game/drop_target.h" - -namespace Titanic { - -CDropTarget::CDropTarget() : CGameObject(), _fieldC4(0), - _fieldD4(0), _fieldE4(0), _fieldF4(0), _fieldF8(0), - _fieldFC(0), _field10C(1), _field110(8), _field114(20) { -} - -void CDropTarget::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writePoint(_pos1, indent); - file->writeNumberLine(_fieldC4, indent); - file->writeQuotedLine(_string1, indent); - file->writeNumberLine(_fieldD4, indent); - file->writeQuotedLine(_string2, indent); - file->writeNumberLine(_fieldE4, indent); - file->writeQuotedLine(_string3, indent); - file->writeNumberLine(_fieldF4, indent); - file->writeNumberLine(_fieldF8, indent); - file->writeNumberLine(_fieldFC, indent); - file->writeQuotedLine(_string4, indent); - file->writeNumberLine(_field10C, indent); - file->writeNumberLine(_field110, indent); - file->writeNumberLine(_field114, indent); - - CGameObject::save(file, indent); -} - -void CDropTarget::load(SimpleFile *file) { - file->readNumber(); - _pos1 = file->readPoint(); - _fieldC4 = file->readNumber(); - _string1 = file->readString(); - _fieldD4 = file->readNumber(); - _string2 = file->readString(); - _fieldE4 = file->readNumber(); - _string3 = file->readString(); - _fieldF4 = file->readNumber(); - _fieldF8 = file->readNumber(); - _fieldFC = file->readNumber(); - _string4 = file->readString(); - _field10C = file->readNumber(); - _field110 = file->readNumber(); - _field114 = file->readNumber(); - - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/drop_target.h b/engines/titanic/game/drop_target.h deleted file mode 100644 index b106623f62..0000000000 --- a/engines/titanic/game/drop_target.h +++ /dev/null @@ -1,67 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_DROP_TARGET_H -#define TITANIC_DROP_TARGET_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CDropTarget : public CGameObject { -private: - Common::Point _pos1; - int _fieldC4; - CString _string1; - int _fieldD4; - CString _string2; - int _fieldE4; - CString _string3; - int _fieldF4; - int _fieldF8; - int _fieldFC; - CString _string4; - int _field10C; - int _field110; - int _field114; -public: - CDropTarget(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CDropTarget"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_DROP_TARGET_H */ diff --git a/engines/titanic/game/parrot/parrot_lobby_controller.cpp b/engines/titanic/game/parrot/parrot_lobby_controller.cpp new file mode 100644 index 0000000000..2376cea25c --- /dev/null +++ b/engines/titanic/game/parrot/parrot_lobby_controller.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/parrot/parrot_lobby_controller.h" + +namespace Titanic { + +void CParrotLobbyController::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CParrotLobbyObject::save(file, indent); +} + +void CParrotLobbyController::load(SimpleFile *file) { + file->readNumber(); + CParrotLobbyObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_lobby_controller.h b/engines/titanic/game/parrot/parrot_lobby_controller.h new file mode 100644 index 0000000000..371e31eaa9 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_lobby_controller.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PARROT_LOBBY_CONTROLLER_H +#define TITANIC_PARROT_LOBBY_CONTROLLER_H + +#include "titanic/game/parrot/parrot_lobby_object.h" + +namespace Titanic { + +class CParrotLobbyController : public CParrotLobbyObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CParrotLobbyController"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PARROT_LOBBY_CONTROLLER_H */ diff --git a/engines/titanic/game/parrot/parrot_lobby_link_updater.cpp b/engines/titanic/game/parrot/parrot_lobby_link_updater.cpp new file mode 100644 index 0000000000..912495dbd8 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_lobby_link_updater.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/parrot/parrot_lobby_link_updater.h" + +namespace Titanic { + +void CParrotLobbyLinkUpdater::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CParrotLobbyLinkUpdater::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_lobby_link_updater.h b/engines/titanic/game/parrot/parrot_lobby_link_updater.h new file mode 100644 index 0000000000..d0843fe9ec --- /dev/null +++ b/engines/titanic/game/parrot/parrot_lobby_link_updater.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_PARROT_LOBBY_LINK_UPDATER_H +#define TITANIC_PARROT_LOBBY_LINK_UPDATER_H + +#include "titanic/game/parrot/parrot_lobby_object.h" + +namespace Titanic { + +class CParrotLobbyLinkUpdater : public CParrotLobbyObject { +public: + int _fieldBC; +public: + CParrotLobbyLinkUpdater() : CParrotLobbyObject(), _fieldBC(1) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CParrotLobbyLinkUpdater"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PARROT_LOBBY_LINK_UPDATER_H */ diff --git a/engines/titanic/game/parrot/parrot_lobby_object.cpp b/engines/titanic/game/parrot/parrot_lobby_object.cpp new file mode 100644 index 0000000000..137f3e2ff9 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_lobby_object.cpp @@ -0,0 +1,59 @@ +/* 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 "titanic/game/parrot/parrot_lobby_object.h" + +namespace Titanic { + +int CParrotLobbyObject::_v1; +int CParrotLobbyObject::_v2; +int CParrotLobbyObject::_v3; +int CParrotLobbyObject::_v4; + +void CParrotLobbyObject::init() { + _v1 = 1; + _v2 = 1; + _v3 = 1; + _v4 = 7; +} + +void CParrotLobbyObject::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_v2, indent); + file->writeNumberLine(_v3, indent); + file->writeNumberLine(_v4, indent); + + CGameObject::save(file, indent); +} + +void CParrotLobbyObject::load(SimpleFile *file) { + file->readNumber(); + _v1 = file->readNumber(); + _v2 = file->readNumber(); + _v3 = file->readNumber(); + _v4 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_lobby_object.h b/engines/titanic/game/parrot/parrot_lobby_object.h new file mode 100644 index 0000000000..85f2c3bc77 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_lobby_object.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_PARROT_LOBBY_OBJECT_H +#define TITANIC_PARROT_LOBBY_OBJECT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CParrotLobbyObject : public CGameObject { +public: + static int _v1; + static int _v2; + static int _v3; + static int _v4; + + static void init(); +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CParrotLobbyObject"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PARROT_LOBBY_OBJECT_H */ diff --git a/engines/titanic/game/parrot/parrot_lobby_view_object.cpp b/engines/titanic/game/parrot/parrot_lobby_view_object.cpp new file mode 100644 index 0000000000..740eac83de --- /dev/null +++ b/engines/titanic/game/parrot/parrot_lobby_view_object.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/parrot/parrot_lobby_view_object.h" + +namespace Titanic { + +void CParrotLobbyViewObject::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + CParrotLobbyObject::save(file, indent); +} + +void CParrotLobbyViewObject::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + CParrotLobbyObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_lobby_view_object.h b/engines/titanic/game/parrot/parrot_lobby_view_object.h new file mode 100644 index 0000000000..00f7bbc72d --- /dev/null +++ b/engines/titanic/game/parrot/parrot_lobby_view_object.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_PARROT_LOBBY_VIEW_OBJECT_H +#define TITANIC_PARROT_LOBBY_VIEW_OBJECT_H + +#include "titanic/game/parrot/parrot_lobby_object.h" + +namespace Titanic { + +class CParrotLobbyViewObject : public CParrotLobbyObject { +public: + int _fieldBC; +public: + CParrotLobbyViewObject() : CParrotLobbyObject(), _fieldBC(1) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CParrotLobbyViewObject"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PARROT_LOBBY_VIEW_OBJECT_H */ diff --git a/engines/titanic/game/parrot/parrot_loser.cpp b/engines/titanic/game/parrot/parrot_loser.cpp new file mode 100644 index 0000000000..e82506e137 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_loser.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/parrot/parrot_loser.h" + +namespace Titanic { + +void CParrotLoser::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CParrotLoser::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_loser.h b/engines/titanic/game/parrot/parrot_loser.h new file mode 100644 index 0000000000..dac253e189 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_loser.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PARROT_LOSER_H +#define TITANIC_PARROT_LOSER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CParrotLoser : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CParrotLoser"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PARROT_LOSER_H */ diff --git a/engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp b/engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp new file mode 100644 index 0000000000..0917319da0 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp @@ -0,0 +1,47 @@ +/* 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 "titanic/game/parrot/parrot_nut_bowl_actor.h" + +namespace Titanic { + +CParrotNutBowlActor::CParrotNutBowlActor() : CGameObject(), + _value1(0), _value2(0) { +} + +void CParrotNutBowlActor::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value1, indent); + file->writeNumberLine(_value2, indent); + + CGameObject::save(file, indent); +} + +void CParrotNutBowlActor::load(SimpleFile *file) { + file->readNumber(); + _value1 = file->readNumber(); + _value2 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_nut_bowl_actor.h b/engines/titanic/game/parrot/parrot_nut_bowl_actor.h new file mode 100644 index 0000000000..623918c85b --- /dev/null +++ b/engines/titanic/game/parrot/parrot_nut_bowl_actor.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_PARROT_NUT_BOWL_ACTOR_H +#define TITANIC_PARROT_NUT_BOWL_ACTOR_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CParrotNutBowlActor : public CGameObject { +public: + int _value1, _value2; +public: + CParrotNutBowlActor(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CParrotNutBowlActor"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PARROT_NUT_BOWL_ACTOR_H */ diff --git a/engines/titanic/game/parrot/parrot_nut_eater.cpp b/engines/titanic/game/parrot/parrot_nut_eater.cpp new file mode 100644 index 0000000000..9d58632c89 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_nut_eater.cpp @@ -0,0 +1,45 @@ +/* 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 "titanic/game/parrot/parrot_nut_eater.h" + +namespace Titanic { + +CParrotNutEater::CParrotNutEater() : CGameObject(), _fieldBC(0), + _fieldC0(69), _fieldC4(132), _fieldC8(0), _fieldCC(68) { +} + +void CParrotNutEater::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + + CGameObject::save(file, indent); +} + +void CParrotNutEater::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_nut_eater.h b/engines/titanic/game/parrot/parrot_nut_eater.h new file mode 100644 index 0000000000..55367af818 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_nut_eater.h @@ -0,0 +1,58 @@ +/* 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. + * + */ + +#ifndef TITANIC_PARROT_NUT_EATER_H +#define TITANIC_PARROT_NUT_EATER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CParrotNutEater : public CGameObject { +public: + int _fieldBC; + int _fieldC0; + int _fieldC4; + int _fieldC8; + int _fieldCC; +public: + CParrotNutEater(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CParrotNutEater"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CREDITS_H */ diff --git a/engines/titanic/game/parrot/parrot_perch_holder.cpp b/engines/titanic/game/parrot/parrot_perch_holder.cpp new file mode 100644 index 0000000000..00dfe4a1c9 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_perch_holder.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/parrot/parrot_perch_holder.h" + +namespace Titanic { + +void CParrotPerchHolder::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CMultiDropTarget::save(file, indent); +} + +void CParrotPerchHolder::load(SimpleFile *file) { + file->readNumber(); + CMultiDropTarget::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_perch_holder.h b/engines/titanic/game/parrot/parrot_perch_holder.h new file mode 100644 index 0000000000..489e124a91 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_perch_holder.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PARROT_PERCH_HOLDER_H +#define TITANIC_PARROT_PERCH_HOLDER_H + +#include "titanic/core/multi_drop_target.h" + +namespace Titanic { + +class CParrotPerchHolder : public CMultiDropTarget { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CParrotPerchHolder"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PARROT_PERCH_HOLDER_H */ diff --git a/engines/titanic/game/parrot/parrot_succubus.cpp b/engines/titanic/game/parrot/parrot_succubus.cpp new file mode 100644 index 0000000000..e29c6a6781 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_succubus.cpp @@ -0,0 +1,49 @@ +/* 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 "titanic/game/parrot/parrot_succubus.h" + +namespace Titanic { + +CParrotSuccUBus::CParrotSuccUBus() : CSuccUBus(), _field1DC(0), + _field1EC(0), _field1F0(376), _field1F4(393) { +} + +void CParrotSuccUBus::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field1DC, indent); + file->writeQuotedLine(_string3, indent); + file->writeNumberLine(_field1EC, indent); + + CSuccUBus::save(file, indent); +} + +void CParrotSuccUBus::load(SimpleFile *file) { + file->readNumber(); + _field1DC = file->readNumber(); + _string3 = file->readString(); + _field1EC = file->readNumber(); + + CSuccUBus::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_succubus.h b/engines/titanic/game/parrot/parrot_succubus.h new file mode 100644 index 0000000000..aad8a7ffa5 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_succubus.h @@ -0,0 +1,58 @@ +/* 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. + * + */ + +#ifndef TITANIC_PARROT_SUCCUBUS_H +#define TITANIC_PARROT_SUCCUBUS_H + +#include "titanic/npcs/succubus.h" + +namespace Titanic { + +class CParrotSuccUBus : public CSuccUBus { +public: + int _field1DC; + CString _string3; + int _field1EC; + int _field1F0; + int _field1F4; +public: + CParrotSuccUBus(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CParrotSuccUBus"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PARROT_SUCCUBUS_H */ diff --git a/engines/titanic/game/parrot/parrot_trigger.cpp b/engines/titanic/game/parrot/parrot_trigger.cpp new file mode 100644 index 0000000000..aeab3c1ea7 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_trigger.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/parrot/parrot_trigger.h" + +namespace Titanic { + +void CParrotTrigger::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CGameObject::save(file, indent); +} + +void CParrotTrigger::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/parrot/parrot_trigger.h b/engines/titanic/game/parrot/parrot_trigger.h new file mode 100644 index 0000000000..cb0d59c320 --- /dev/null +++ b/engines/titanic/game/parrot/parrot_trigger.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_PARROT_TRIGGER_H +#define TITANIC_PARROT_TRIGGER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CParrotTrigger : public CGameObject { +public: + int _value; +public: + CParrotTrigger() : CGameObject(), _value(0x446AB) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CParrotTrigger"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PARROT_TRIGGER_H */ diff --git a/engines/titanic/game/port_hole.cpp b/engines/titanic/game/port_hole.cpp new file mode 100644 index 0000000000..556473263b --- /dev/null +++ b/engines/titanic/game/port_hole.cpp @@ -0,0 +1,49 @@ +/* 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 "titanic/game/port_hole.h" + +namespace Titanic { + +CPortHole::CPortHole() : CGameObject(), _fieldBC(0), + _string1("b#47.wav"), _string2("b#46.wav") { +} + +void CPortHole::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + + CGameObject::save(file, indent); +} + +void CPortHole::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/port_hole.h b/engines/titanic/game/port_hole.h new file mode 100644 index 0000000000..60aab51bb6 --- /dev/null +++ b/engines/titanic/game/port_hole.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_PORT_HOLE_H +#define TITANIC_PORT_HOLE_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPortHole : public CGameObject { +private: + int _fieldBC; + CString _string1, _string2; +public: + CPortHole(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPortHole"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PORT_HOLE_H */ diff --git a/engines/titanic/game/sweet_bowl.cpp b/engines/titanic/game/sweet_bowl.cpp new file mode 100644 index 0000000000..f6bbb2c89c --- /dev/null +++ b/engines/titanic/game/sweet_bowl.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/sweet_bowl.h" + +namespace Titanic { + +void CSweetBowl::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CSweetBowl::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sweet_bowl.h b/engines/titanic/game/sweet_bowl.h new file mode 100644 index 0000000000..8fb20e4041 --- /dev/null +++ b/engines/titanic/game/sweet_bowl.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_SWEET_BOWL_H +#define TITANIC_SWEET_BOWL_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CSweetBowl : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSweetBowl"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CREDITS_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 9faf157534..f2265bfafb 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -46,12 +46,14 @@ MODULE_OBJS := \ core/background.o \ core/click_responder.o \ core/dont_save_file_item.o \ + core/drop_target.o \ core/file_item.o \ core/game_object.o \ core/link_item.o \ core/list.o \ core/message_target.o \ core/movie_clip.o \ + core/multi_drop_target.o \ core/named_item.o \ core/node_item.o \ core/pet_control.o \ @@ -73,9 +75,9 @@ MODULE_OBJS := \ game/desk_click_responder.o \ game/doorbot_home_handler.o \ game/drawer.o \ - game/drop_target.o \ game/hammer_dispensor_button.o \ game/pet_position.o \ + game/port_hole.o \ game/null_port_hole.o \ game/room_item.o \ game/service_elevator_door.o \ @@ -83,7 +85,18 @@ MODULE_OBJS := \ game/sgt_upper_doors_sound.o \ game/start_action.o \ game/sub_glass.o \ + game/sweet_bowl.o \ game/television.o \ + game/parrot/parrot_lobby_controller.o \ + game/parrot/parrot_lobby_link_updater.o \ + game/parrot/parrot_lobby_object.o \ + game/parrot/parrot_lobby_view_object.o \ + game/parrot/parrot_loser.o \ + game/parrot/parrot_nut_bowl_actor.o \ + game/parrot/parrot_nut_eater.o \ + game/parrot/parrot_perch_holder.o \ + game/parrot/parrot_succubus.o \ + game/parrot/parrot_trigger.o \ gfx/act_button.o \ gfx/changes_season_button.o \ gfx/chev_left_off.o \ diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index 47b7c1336a..9deb5e6e7a 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -29,6 +29,7 @@ #include "graphics/thumbnail.h" #include "titanic/titanic.h" #include "titanic/core/saveable_object.h" +#include "titanic/game/parrot/parrot_lobby_object.h" namespace Titanic { @@ -52,6 +53,8 @@ void TitanicEngine::initialize() { DebugMan.addDebugChannel(kDebugSound, "sound", "Sound and Music handling"); CSaveableObject::initClassList(); + CParrotLobbyObject::init(); + _screenManager = new OSScreenManager(this); _window = new CMainGameWindow(this); _window->applicationStarting(); -- cgit v1.2.3 From fa015808acb611f681a8027128e48fb458a84d14 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Feb 2016 11:53:57 -0500 Subject: TITANIC: Implement bowl and ear classes --- engines/titanic/carry/bowl_ear.cpp | 37 ++++++++++++++++++++++ engines/titanic/carry/bowl_ear.h | 50 +++++++++++++++++++++++++++++ engines/titanic/carry/phonograph_ear.cpp | 37 ++++++++++++++++++++++ engines/titanic/carry/phonograph_ear.h | 50 +++++++++++++++++++++++++++++ engines/titanic/core/saveable_object.cpp | 24 +++++++++++++- engines/titanic/game/bowl_unlocker.cpp | 39 +++++++++++++++++++++++ engines/titanic/game/bowl_unlocker.h | 54 ++++++++++++++++++++++++++++++++ engines/titanic/game/ear_sweet_bowl.cpp | 37 ++++++++++++++++++++++ engines/titanic/game/ear_sweet_bowl.h | 50 +++++++++++++++++++++++++++++ engines/titanic/game/empty_nut_bowl.cpp | 39 +++++++++++++++++++++++ engines/titanic/game/empty_nut_bowl.h | 54 ++++++++++++++++++++++++++++++++ engines/titanic/game/no_nut_bowl.cpp | 37 ++++++++++++++++++++++ engines/titanic/game/no_nut_bowl.h | 50 +++++++++++++++++++++++++++++ engines/titanic/game/nut_replacer.cpp | 37 ++++++++++++++++++++++ engines/titanic/game/nut_replacer.h | 50 +++++++++++++++++++++++++++++ engines/titanic/module.mk | 7 +++++ 16 files changed, 651 insertions(+), 1 deletion(-) create mode 100644 engines/titanic/carry/bowl_ear.cpp create mode 100644 engines/titanic/carry/bowl_ear.h create mode 100644 engines/titanic/carry/phonograph_ear.cpp create mode 100644 engines/titanic/carry/phonograph_ear.h create mode 100644 engines/titanic/game/bowl_unlocker.cpp create mode 100644 engines/titanic/game/bowl_unlocker.h create mode 100644 engines/titanic/game/ear_sweet_bowl.cpp create mode 100644 engines/titanic/game/ear_sweet_bowl.h create mode 100644 engines/titanic/game/empty_nut_bowl.cpp create mode 100644 engines/titanic/game/empty_nut_bowl.h create mode 100644 engines/titanic/game/no_nut_bowl.cpp create mode 100644 engines/titanic/game/no_nut_bowl.h create mode 100644 engines/titanic/game/nut_replacer.cpp create mode 100644 engines/titanic/game/nut_replacer.h diff --git a/engines/titanic/carry/bowl_ear.cpp b/engines/titanic/carry/bowl_ear.cpp new file mode 100644 index 0000000000..70d2409a05 --- /dev/null +++ b/engines/titanic/carry/bowl_ear.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/carry/bowl_ear.h" + +namespace Titanic { + +void CBowlEar::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CEar::save(file, indent); +} + +void CBowlEar::load(SimpleFile *file) { + file->readNumber(); + CEar::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/bowl_ear.h b/engines/titanic/carry/bowl_ear.h new file mode 100644 index 0000000000..c03446dc99 --- /dev/null +++ b/engines/titanic/carry/bowl_ear.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_BOWL_EAR_H +#define TITANIC_BOWL_EAR_H + +#include "titanic/carry/ear.h" + +namespace Titanic { + +class CBowlEar : public CEar { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBowlEar"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BOWL_EAR_H */ diff --git a/engines/titanic/carry/phonograph_ear.cpp b/engines/titanic/carry/phonograph_ear.cpp new file mode 100644 index 0000000000..759356ab30 --- /dev/null +++ b/engines/titanic/carry/phonograph_ear.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/carry/phonograph_ear.h" + +namespace Titanic { + +void CPhonographEar::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CEar::save(file, indent); +} + +void CPhonographEar::load(SimpleFile *file) { + file->readNumber(); + CEar::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/phonograph_ear.h b/engines/titanic/carry/phonograph_ear.h new file mode 100644 index 0000000000..59042000c9 --- /dev/null +++ b/engines/titanic/carry/phonograph_ear.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PHONOGRAPH_EYE_H +#define TITANIC_PHONOGRAPH_EYE_H + +#include "titanic/carry/ear.h" + +namespace Titanic { + +class CPhonographEar : public CEar { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPhonographEar"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PHONOGRAPH_EYE_H */ diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 411f1b4ff9..f0429a73d3 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -21,13 +21,13 @@ */ #include "titanic/carry/arm.h" +#include "titanic/carry/bowl_ear.h" #include "titanic/carry/brain.h" #include "titanic/carry/bridge_piece.h" #include "titanic/carry/carry.h" #include "titanic/carry/carry_parrot.h" #include "titanic/carry/chicken.h" #include "titanic/carry/crushed_tv.h" -#include "titanic/carry/ear.h" #include "titanic/carry/eye.h" #include "titanic/carry/feathers.h" #include "titanic/carry/fruit.h" @@ -45,6 +45,7 @@ #include "titanic/carry/note.h" #include "titanic/carry/parcel.h" #include "titanic/carry/phonograph_cylinder.h" +#include "titanic/carry/phonograph_ear.h" #include "titanic/carry/photograph.h" #include "titanic/carry/plug_in.h" #include "titanic/carry/sweets.h" @@ -68,6 +69,7 @@ #include "titanic/core/view_item.h" #include "titanic/game/announce.h" +#include "titanic/game/bowl_unlocker.h" #include "titanic/game/cdrom.h" #include "titanic/game/cdrom_computer.h" #include "titanic/game/cdrom_tray.h" @@ -78,8 +80,12 @@ #include "titanic/game/desk_click_responder.h" #include "titanic/game/doorbot_home_handler.h" #include "titanic/game/drawer.h" +#include "titanic/game/ear_sweet_bowl.h" +#include "titanic/game/empty_nut_bowl.h" #include "titanic/game/hammer_dispensor_button.h" +#include "titanic/game/no_nut_bowl.h" #include "titanic/game/null_port_hole.h" +#include "titanic/game/nut_replacer.h" #include "titanic/game/pet_position.h" #include "titanic/game/port_hole.h" #include "titanic/game/room_item.h" @@ -175,11 +181,13 @@ Common::HashMap * #define ADDFN(T) (*_classList)[#T] = Function##T DEFFN(CArm); +DEFFN(CBowlEar); DEFFN(CBrain); DEFFN(CBridgePiece); DEFFN(CCarryParrot); DEFFN(CChicken); DEFFN(CCrushedTV); +DEFFN(CEar); DEFFN(CFeathers); DEFFN(CFruit); DEFFN(CGlass); @@ -194,6 +202,7 @@ DEFFN(CNapkin); DEFFN(CNote); DEFFN(CParcel); DEFFN(CPhonographCylinder); +DEFFN(CPhonographEar); DEFFN(CPhotograph); DEFFN(CPlugIn); DEFFN(CSweets); @@ -216,6 +225,7 @@ DEFFN(CTreeItem); DEFFN(CViewItem); DEFFN(CAnnounce); +DEFFN(CBowlUnlocker); DEFFN(CCDROM); DEFFN(CCDROMComputer); DEFFN(CCDROMTray); @@ -225,8 +235,12 @@ DEFFN(CCreditsButton); DEFFN(CDeadArea); DEFFN(CDeskClickResponder); DEFFN(CDoorbotHomeHandler); +DEFFN(CEarSweetBowl); +DEFFN(CEmptyNutBowl); DEFFN(CHammerDispensorButton); +DEFFN(CNoNutBowl); DEFFN(CNullPortHole); +DEFFN(CNutReplacer); DEFFN(CPETPosition); DEFFN(CPortHole); DEFFN(CRoomItem); @@ -486,11 +500,13 @@ DEFFN(CAutoMusicPlayer); void CSaveableObject::initClassList() { _classList = new Common::HashMap(); ADDFN(CArm); + ADDFN(CBowlEar); ADDFN(CBrain); ADDFN(CBridgePiece); ADDFN(CCarryParrot); ADDFN(CChicken); ADDFN(CCrushedTV); + ADDFN(CEar); ADDFN(CFeathers); ADDFN(CFruit); ADDFN(CGlass); @@ -505,6 +521,7 @@ void CSaveableObject::initClassList() { ADDFN(CNote); ADDFN(CParcel); ADDFN(CPhonographCylinder); + ADDFN(CPhonographEar); ADDFN(CPhotograph); ADDFN(CPlugIn); ADDFN(CSweets); @@ -527,6 +544,7 @@ void CSaveableObject::initClassList() { ADDFN(CViewItem); ADDFN(CAnnounce); + ADDFN(CBowlUnlocker); ADDFN(CCDROM); ADDFN(CCDROMComputer); ADDFN(CCDROMTray); @@ -537,8 +555,12 @@ void CSaveableObject::initClassList() { ADDFN(CDeskClickResponder); ADDFN(CDoorbotHomeHandler); ADDFN(CDropTarget); + ADDFN(CEarSweetBowl); + ADDFN(CEmptyNutBowl); ADDFN(CHammerDispensorButton); + ADDFN(CNoNutBowl); ADDFN(CNullPortHole); + ADDFN(CNutReplacer); ADDFN(CPETPosition); ADDFN(CPortHole); ADDFN(CRoomItem); diff --git a/engines/titanic/game/bowl_unlocker.cpp b/engines/titanic/game/bowl_unlocker.cpp new file mode 100644 index 0000000000..83ae9e35d5 --- /dev/null +++ b/engines/titanic/game/bowl_unlocker.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/bowl_unlocker.h" + +namespace Titanic { + +void CBowlUnlocker::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CGameObject::save(file, indent); +} + +void CBowlUnlocker::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/bowl_unlocker.h b/engines/titanic/game/bowl_unlocker.h new file mode 100644 index 0000000000..455b0a7fd8 --- /dev/null +++ b/engines/titanic/game/bowl_unlocker.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_BOWL_UNLOCKER_H +#define TITANIC_BOWL_UNLOCKER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CBowlUnlocker : public CGameObject { +public: + int _value; +public: + CBowlUnlocker() : CGameObject(), _value(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBowlUnlocker"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BOWL_UNLOCKER_H */ diff --git a/engines/titanic/game/ear_sweet_bowl.cpp b/engines/titanic/game/ear_sweet_bowl.cpp new file mode 100644 index 0000000000..dc4ca7af08 --- /dev/null +++ b/engines/titanic/game/ear_sweet_bowl.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/ear_sweet_bowl.h" + +namespace Titanic { + +void CEarSweetBowl::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CSweetBowl::save(file, indent); +} + +void CEarSweetBowl::load(SimpleFile *file) { + file->readNumber(); + CSweetBowl::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/ear_sweet_bowl.h b/engines/titanic/game/ear_sweet_bowl.h new file mode 100644 index 0000000000..3e27516a60 --- /dev/null +++ b/engines/titanic/game/ear_sweet_bowl.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_EAR_SWEET_BOWL_H +#define TITANIC_EAR_SWEET_BOWL_H + +#include "titanic/game/sweet_bowl.h" + +namespace Titanic { + +class CEarSweetBowl : public CSweetBowl { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CEarSweetBowl"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_EAR_SWEET_BOWL_H */ diff --git a/engines/titanic/game/empty_nut_bowl.cpp b/engines/titanic/game/empty_nut_bowl.cpp new file mode 100644 index 0000000000..217029be19 --- /dev/null +++ b/engines/titanic/game/empty_nut_bowl.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/empty_nut_bowl.h" + +namespace Titanic { + +void CEmptyNutBowl::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CGameObject::save(file, indent); +} + +void CEmptyNutBowl::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/empty_nut_bowl.h b/engines/titanic/game/empty_nut_bowl.h new file mode 100644 index 0000000000..c1c553a697 --- /dev/null +++ b/engines/titanic/game/empty_nut_bowl.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_EMPTY_NUT_BOWL_H +#define TITANIC_EMPTY_NUT_BOWL_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CEmptyNutBowl : public CGameObject { +public: + int _value; +public: + CEmptyNutBowl() : CGameObject(), _value(1) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CEmptyNutBowl"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_NO_NUT_BOWL_H */ diff --git a/engines/titanic/game/no_nut_bowl.cpp b/engines/titanic/game/no_nut_bowl.cpp new file mode 100644 index 0000000000..354dea3cd8 --- /dev/null +++ b/engines/titanic/game/no_nut_bowl.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/no_nut_bowl.h" + +namespace Titanic { + +void CNoNutBowl::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CBackground::save(file, indent); +} + +void CNoNutBowl::load(SimpleFile *file) { + file->readNumber(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/no_nut_bowl.h b/engines/titanic/game/no_nut_bowl.h new file mode 100644 index 0000000000..40e8fd15f1 --- /dev/null +++ b/engines/titanic/game/no_nut_bowl.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_NO_NUT_BOWL_H +#define TITANIC_NO_NUT_BOWL_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CNoNutBowl : public CBackground { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CNoNutBowl"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_NO_NUT_BOWL_H */ diff --git a/engines/titanic/game/nut_replacer.cpp b/engines/titanic/game/nut_replacer.cpp new file mode 100644 index 0000000000..36c0510b20 --- /dev/null +++ b/engines/titanic/game/nut_replacer.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/nut_replacer.h" + +namespace Titanic { + +void CNutReplacer::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CNutReplacer::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/nut_replacer.h b/engines/titanic/game/nut_replacer.h new file mode 100644 index 0000000000..ef800c71a6 --- /dev/null +++ b/engines/titanic/game/nut_replacer.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_NUT_REPLACER_H +#define TITANIC_NUT_REPLACER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CNutReplacer : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CNutReplacer"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_NUT_REPLACER_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index f2265bfafb..0b43dbbbc1 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -16,6 +16,7 @@ MODULE_OBJS := \ titanic.o \ video_surface.o \ carry/arm.o \ + carry/bowl_ear.o \ carry/brain.o \ carry/bridge_piece.o \ carry/carry.o \ @@ -40,6 +41,7 @@ MODULE_OBJS := \ carry/note.o \ carry/parcel.o \ carry/phonograph_cylinder.o \ + carry/phonograph_ear.o \ carry/photograph.o \ carry/plug_in.o \ carry/sweets.o \ @@ -65,6 +67,7 @@ MODULE_OBJS := \ core/tree_item.o \ core/view_item.o \ game/announce.o \ + game/bowl_unlocker.o \ game/cdrom.o \ game/cdrom_computer.o \ game/cdrom_tray.o \ @@ -75,10 +78,14 @@ MODULE_OBJS := \ game/desk_click_responder.o \ game/doorbot_home_handler.o \ game/drawer.o \ + game/ear_sweet_bowl.o \ + game/empty_nut_bowl.o \ game/hammer_dispensor_button.o \ + game/no_nut_bowl.o \ game/pet_position.o \ game/port_hole.o \ game/null_port_hole.o \ + game/nut_replacer.o \ game/room_item.o \ game/service_elevator_door.o \ game/sgt_state_room.o \ -- cgit v1.2.3 From 0471a25575d7cabff26f8abbace55c1dadaf6320 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Feb 2016 12:46:48 -0500 Subject: TITANIC: Implement light switch and buttons --- engines/titanic/core/saveable_object.cpp | 14 +++++ .../titanic/game/enter_exit_first_class_state.cpp | 49 +++++++++++++++++ .../titanic/game/enter_exit_first_class_state.h | 62 ++++++++++++++++++++++ engines/titanic/game/light.cpp | 60 +++++++++++++++++++++ engines/titanic/game/light.h | 61 +++++++++++++++++++++ engines/titanic/game/light_switch.cpp | 53 ++++++++++++++++++ engines/titanic/game/light_switch.h | 58 ++++++++++++++++++++ engines/titanic/game/little_lift_button.cpp | 39 ++++++++++++++ engines/titanic/game/little_lift_button.h | 54 +++++++++++++++++++ engines/titanic/module.mk | 4 ++ engines/titanic/titanic.cpp | 6 +++ engines/titanic/titanic.h | 5 ++ 12 files changed, 465 insertions(+) create mode 100644 engines/titanic/game/enter_exit_first_class_state.cpp create mode 100644 engines/titanic/game/enter_exit_first_class_state.h create mode 100644 engines/titanic/game/light.cpp create mode 100644 engines/titanic/game/light.h create mode 100644 engines/titanic/game/light_switch.cpp create mode 100644 engines/titanic/game/light_switch.h create mode 100644 engines/titanic/game/little_lift_button.cpp create mode 100644 engines/titanic/game/little_lift_button.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index f0429a73d3..12efdc17d2 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -82,7 +82,11 @@ #include "titanic/game/drawer.h" #include "titanic/game/ear_sweet_bowl.h" #include "titanic/game/empty_nut_bowl.h" +#include "titanic/game/enter_exit_first_class_state.h" #include "titanic/game/hammer_dispensor_button.h" +#include "titanic/game/light.h" +#include "titanic/game/light_switch.h" +#include "titanic/game/little_lift_button.h" #include "titanic/game/no_nut_bowl.h" #include "titanic/game/null_port_hole.h" #include "titanic/game/nut_replacer.h" @@ -188,6 +192,7 @@ DEFFN(CCarryParrot); DEFFN(CChicken); DEFFN(CCrushedTV); DEFFN(CEar); +DEFFN(CEye); DEFFN(CFeathers); DEFFN(CFruit); DEFFN(CGlass); @@ -237,7 +242,11 @@ DEFFN(CDeskClickResponder); DEFFN(CDoorbotHomeHandler); DEFFN(CEarSweetBowl); DEFFN(CEmptyNutBowl); +DEFFN(CEnterExitFirstClassState); DEFFN(CHammerDispensorButton); +DEFFN(CLight); +DEFFN(CLightSwitch); +DEFFN(CLittleLiftButton); DEFFN(CNoNutBowl); DEFFN(CNullPortHole); DEFFN(CNutReplacer); @@ -507,6 +516,7 @@ void CSaveableObject::initClassList() { ADDFN(CChicken); ADDFN(CCrushedTV); ADDFN(CEar); + ADDFN(CEye); ADDFN(CFeathers); ADDFN(CFruit); ADDFN(CGlass); @@ -557,7 +567,11 @@ void CSaveableObject::initClassList() { ADDFN(CDropTarget); ADDFN(CEarSweetBowl); ADDFN(CEmptyNutBowl); + ADDFN(CEnterExitFirstClassState); ADDFN(CHammerDispensorButton); + ADDFN(CLight); + ADDFN(CLightSwitch); + ADDFN(CLittleLiftButton); ADDFN(CNoNutBowl); ADDFN(CNullPortHole); ADDFN(CNutReplacer); diff --git a/engines/titanic/game/enter_exit_first_class_state.cpp b/engines/titanic/game/enter_exit_first_class_state.cpp new file mode 100644 index 0000000000..7fa191b0e3 --- /dev/null +++ b/engines/titanic/game/enter_exit_first_class_state.cpp @@ -0,0 +1,49 @@ +/* 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 "titanic/game/enter_exit_first_class_state.h" + +namespace Titanic { + +CString *CEnterExitFirstClassState::_v1; + +void CEnterExitFirstClassState::init() { + _v1 = new CString(); +} + +void CEnterExitFirstClassState::deinit() { + delete _v1; +} + +void CEnterExitFirstClassState::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(*_v1, indent); + CGameObject::save(file, indent); +} + +void CEnterExitFirstClassState::load(SimpleFile *file) { + file->readNumber(); + *_v1 = file->readString(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/enter_exit_first_class_state.h b/engines/titanic/game/enter_exit_first_class_state.h new file mode 100644 index 0000000000..f7bc4c69f7 --- /dev/null +++ b/engines/titanic/game/enter_exit_first_class_state.h @@ -0,0 +1,62 @@ +/* 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. + * + */ + +#ifndef TITANIC_ENTER_EXIT_FIRST_CLASS_STATE_H +#define TITANIC_ENTER_EXIT_FIRST_CLASS_STATE_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CEnterExitFirstClassState : public CGameObject { +public: + static CString *_v1; + + /** + * Initialize static data + */ + static void init(); + + /** + * De-initialize static data + */ + static void deinit(); +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBowlUnlocker"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ENTER_EXIT_FIRST_CLASS_STATE_H */ diff --git a/engines/titanic/game/light.cpp b/engines/titanic/game/light.cpp new file mode 100644 index 0000000000..4f5a492f2f --- /dev/null +++ b/engines/titanic/game/light.cpp @@ -0,0 +1,60 @@ +/* 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 "titanic/game/light.h" + +namespace Titanic { + +CLight::CLight() : CBackground(), _fieldE0(0), _fieldE4(0), + _fieldE8(0), _fieldEC(0), _fieldF0(0), _fieldF4(0), + _fieldF8(0), _fieldFC(0) { +} + +void CLight::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_fieldEC, indent); + file->writeNumberLine(_fieldF0, indent); + file->writeNumberLine(_fieldF4, indent); + file->writeNumberLine(_fieldF8, indent); + file->writeNumberLine(_fieldFC, indent); + + CBackground::save(file, indent); +} + +void CLight::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + _fieldEC = file->readNumber(); + _fieldF0 = file->readNumber(); + _fieldF4 = file->readNumber(); + _fieldF8 = file->readNumber(); + _fieldFC = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/light.h b/engines/titanic/game/light.h new file mode 100644 index 0000000000..482d1be65b --- /dev/null +++ b/engines/titanic/game/light.h @@ -0,0 +1,61 @@ +/* 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. + * + */ + +#ifndef TITANIC_LIGHT_H +#define TITANIC_LIGHT_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CLight : public CBackground { +private: + int _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; + int _fieldF0; + int _fieldF4; + int _fieldF8; + int _fieldFC; +public: + CLight(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CLight"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_LIGHT_H */ diff --git a/engines/titanic/game/light_switch.cpp b/engines/titanic/game/light_switch.cpp new file mode 100644 index 0000000000..605fab37f8 --- /dev/null +++ b/engines/titanic/game/light_switch.cpp @@ -0,0 +1,53 @@ +/* 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 "titanic/game/light_switch.h" + +namespace Titanic { + +int CLightSwitch::_v1; + +CLightSwitch::CLightSwitch() : CBackground(), + _fieldE0(0), _fieldE4(0), _fieldE8(0) { +} + +void CLightSwitch::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_fieldE8, indent); + + CBackground::save(file, indent); +} + +void CLightSwitch::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _v1 = file->readNumber(); + _fieldE8 = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/light_switch.h b/engines/titanic/game/light_switch.h new file mode 100644 index 0000000000..0228b1009b --- /dev/null +++ b/engines/titanic/game/light_switch.h @@ -0,0 +1,58 @@ +/* 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. + * + */ + +#ifndef TITANIC_LIGHT_SWITCH_H +#define TITANIC_LIGHT_SWITCH_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CLightSwitch : public CBackground { +public: + static int _v1; +private: + int _fieldE0; + int _fieldE4; + int _fieldE8; +public: + CLightSwitch(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CLightSwitch"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_LIGHT_SWITCH_H */ diff --git a/engines/titanic/game/little_lift_button.cpp b/engines/titanic/game/little_lift_button.cpp new file mode 100644 index 0000000000..3e2fbdd6e8 --- /dev/null +++ b/engines/titanic/game/little_lift_button.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/little_lift_button.h" + +namespace Titanic { + +void CLittleLiftButton::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CBackground::save(file, indent); +} + +void CLittleLiftButton::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/little_lift_button.h b/engines/titanic/game/little_lift_button.h new file mode 100644 index 0000000000..475b8435d5 --- /dev/null +++ b/engines/titanic/game/little_lift_button.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_LITTLE_LIFT_BUTTON_H +#define TITANIC_LITTLE_LIFT_BUTTON_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CLittleLiftButton : public CBackground { +private: + int _value; +public: + CLittleLiftButton() : CBackground(), _value(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CLittleLiftButton"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_LITTLE_LIFT_BUTTON_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 0b43dbbbc1..111fd25de2 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -80,7 +80,11 @@ MODULE_OBJS := \ game/drawer.o \ game/ear_sweet_bowl.o \ game/empty_nut_bowl.o \ + game/enter_exit_first_class_state.o \ game/hammer_dispensor_button.o \ + game/light.o \ + game/light_switch.o \ + game/little_lift_button.o \ game/no_nut_bowl.o \ game/pet_position.o \ game/port_hole.o \ diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index 9deb5e6e7a..b3aae7bf1b 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -30,6 +30,7 @@ #include "titanic/titanic.h" #include "titanic/core/saveable_object.h" #include "titanic/game/parrot/parrot_lobby_object.h" +#include "titanic/game/enter_exit_first_class_state.h" namespace Titanic { @@ -54,12 +55,17 @@ void TitanicEngine::initialize() { CSaveableObject::initClassList(); CParrotLobbyObject::init(); + CEnterExitFirstClassState::init(); _screenManager = new OSScreenManager(this); _window = new CMainGameWindow(this); _window->applicationStarting(); } +void TitanicEngine::deinitialize() { + CEnterExitFirstClassState::deinit(); +} + Common::Error TitanicEngine::run() { initialize(); diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index ec0585c410..3a95e86b54 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -72,6 +72,11 @@ private: * Handles basic initialization */ void initialize(); + + /** + * Handles game deinitialization + */ + void deinitialize(); protected: const TitanicGameDescription *_gameDescription; int _loadSaveSlot; -- cgit v1.2.3 From 6eb777fe362d77189425c2ae137bedab0af5ee5f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Feb 2016 21:42:13 -0500 Subject: TITANIC: Added a lot of class definitions Let's be honest here, it's a s**t-load of class definitions --- engines/titanic/carry/test_carry.cpp | 43 ++++++++++ engines/titanic/carry/test_carry.h | 54 +++++++++++++ engines/titanic/core/saveable_object.cpp | 54 +++++++++++-- engines/titanic/core/static_image.cpp | 37 +++++++++ engines/titanic/core/static_image.h | 50 ++++++++++++ engines/titanic/game/annoy_barbot.cpp | 37 +++++++++ engines/titanic/game/annoy_barbot.h | 50 ++++++++++++ engines/titanic/game/bar_bell.cpp | 53 +++++++++++++ engines/titanic/game/bar_bell.h | 58 ++++++++++++++ engines/titanic/game/bar_menu.cpp | 40 ++++++++++ engines/titanic/game/bar_menu.h | 56 +++++++++++++ engines/titanic/game/bar_menu_button.cpp | 39 +++++++++ engines/titanic/game/bar_menu_button.h | 54 +++++++++++++ engines/titanic/game/belbot_get_light.cpp | 39 +++++++++ engines/titanic/game/belbot_get_light.h | 52 ++++++++++++ engines/titanic/game/bottom_of_well_monitor.cpp | 39 +++++++++ engines/titanic/game/bottom_of_well_monitor.h | 54 +++++++++++++ engines/titanic/game/brain_slot.cpp | 50 ++++++++++++ engines/titanic/game/brain_slot.h | 56 +++++++++++++ engines/titanic/game/bridge_door.cpp | 37 +++++++++ engines/titanic/game/bridge_door.h | 50 ++++++++++++ engines/titanic/game/call_pellerator.cpp | 37 +++++++++ engines/titanic/game/call_pellerator.h | 50 ++++++++++++ engines/titanic/game/chev_code.cpp | 39 +++++++++ engines/titanic/game/chev_code.h | 54 +++++++++++++ engines/titanic/game/chev_panel.cpp | 45 +++++++++++ engines/titanic/game/chev_panel.h | 56 +++++++++++++ engines/titanic/game/chicken_cooler.cpp | 37 +++++++++ engines/titanic/game/chicken_cooler.h | 55 +++++++++++++ engines/titanic/game/cookie.cpp | 43 ++++++++++ engines/titanic/game/cookie.h | 55 +++++++++++++ engines/titanic/game/doorbot_elevator_handler.cpp | 39 +++++++++ engines/titanic/game/doorbot_elevator_handler.h | 52 ++++++++++++ engines/titanic/game/drawer.h | 2 +- engines/titanic/game/elevator_action_area.cpp | 37 +++++++++ engines/titanic/game/elevator_action_area.h | 54 +++++++++++++ engines/titanic/game/end_credit_text.cpp | 37 +++++++++ engines/titanic/game/end_credit_text.h | 50 ++++++++++++ engines/titanic/game/end_credits.cpp | 39 +++++++++ engines/titanic/game/end_credits.h | 54 +++++++++++++ engines/titanic/game/end_explode_ship.cpp | 43 ++++++++++ engines/titanic/game/end_explode_ship.h | 54 +++++++++++++ engines/titanic/game/end_game_credits.cpp | 37 +++++++++ engines/titanic/game/end_game_credits.h | 50 ++++++++++++ engines/titanic/game/end_sequence_control.cpp | 37 +++++++++ engines/titanic/game/end_sequence_control.h | 50 ++++++++++++ engines/titanic/game/enter_bridge.cpp | 39 +++++++++ engines/titanic/game/enter_bridge.h | 54 +++++++++++++ .../game/enter_exit_sec_class_mini_lift.cpp | 37 +++++++++ .../titanic/game/enter_exit_sec_class_mini_lift.h | 50 ++++++++++++ engines/titanic/game/enter_exit_view.cpp | 53 +++++++++++++ engines/titanic/game/enter_exit_view.h | 58 ++++++++++++++ engines/titanic/game/enter_sec_class_state.cpp | 43 ++++++++++ engines/titanic/game/enter_sec_class_state.h | 54 +++++++++++++ engines/titanic/game/exit_lift.cpp | 43 ++++++++++ engines/titanic/game/exit_lift.h | 54 +++++++++++++ engines/titanic/game/exit_pellerator.cpp | 37 +++++++++ engines/titanic/game/exit_pellerator.h | 50 ++++++++++++ engines/titanic/game/fan.cpp | 43 ++++++++++ engines/titanic/game/fan.h | 54 +++++++++++++ engines/titanic/game/fan_control.cpp | 53 +++++++++++++ engines/titanic/game/fan_control.h | 58 ++++++++++++++ engines/titanic/game/fan_decrease.cpp | 37 +++++++++ engines/titanic/game/fan_decrease.h | 50 ++++++++++++ engines/titanic/game/fan_increase.cpp | 37 +++++++++ engines/titanic/game/fan_increase.h | 50 ++++++++++++ engines/titanic/game/fan_noises.cpp | 58 ++++++++++++++ engines/titanic/game/fan_noises.h | 60 ++++++++++++++ engines/titanic/game/floor_indicator.cpp | 37 +++++++++ engines/titanic/game/floor_indicator.h | 50 ++++++++++++ engines/titanic/game/get_lift_eye2.cpp | 37 +++++++++ engines/titanic/game/get_lift_eye2.h | 50 ++++++++++++ engines/titanic/game/glass_smasher.cpp | 37 +++++++++ engines/titanic/game/glass_smasher.h | 50 ++++++++++++ engines/titanic/game/gondolier_base.cpp | 37 +++++++++ engines/titanic/game/gondolier_base.h | 50 ++++++++++++ engines/titanic/game/hammer_clip.cpp | 39 +++++++++ engines/titanic/game/hammer_clip.h | 54 +++++++++++++ engines/titanic/game/head_slot.cpp | 64 +++++++++++++++ engines/titanic/game/head_slot.h | 64 +++++++++++++++ engines/titanic/game/head_spinner.cpp | 43 ++++++++++ engines/titanic/game/head_spinner.h | 54 +++++++++++++ engines/titanic/game/idle_summoner.cpp | 63 +++++++++++++++ engines/titanic/game/idle_summoner.h | 62 +++++++++++++++ engines/titanic/game/leave_sec_class_state.cpp | 37 +++++++++ engines/titanic/game/leave_sec_class_state.h | 50 ++++++++++++ engines/titanic/game/long_stick_dispenser.cpp | 37 +++++++++ engines/titanic/game/long_stick_dispenser.h | 57 ++++++++++++++ engines/titanic/game/mail_man.cpp | 39 +++++++++ engines/titanic/game/mail_man.h | 54 +++++++++++++ engines/titanic/game/missiveomat.cpp | 55 +++++++++++++ engines/titanic/game/missiveomat.h | 59 ++++++++++++++ engines/titanic/game/movie_tester.cpp | 41 ++++++++++ engines/titanic/game/movie_tester.h | 54 +++++++++++++ engines/titanic/game/navigation_computer.cpp | 37 +++++++++ engines/titanic/game/navigation_computer.h | 50 ++++++++++++ .../game/parrot/parrot_lobby_link_updater.cpp | 4 +- .../titanic/game/parrot/player_meets_parrot.cpp | 37 +++++++++ engines/titanic/game/parrot/player_meets_parrot.h | 50 ++++++++++++ engines/titanic/game/pet/pet.cpp | 57 ++++++++++++++ engines/titanic/game/pet/pet.h | 60 ++++++++++++++ engines/titanic/game/pet/pet_class1.cpp | 37 +++++++++ engines/titanic/game/pet/pet_class1.h | 50 ++++++++++++ engines/titanic/game/pet/pet_class2.cpp | 37 +++++++++ engines/titanic/game/pet/pet_class2.h | 50 ++++++++++++ engines/titanic/game/pet/pet_class3.cpp | 37 +++++++++ engines/titanic/game/pet/pet_class3.h | 50 ++++++++++++ engines/titanic/game/pet/pet_monitor.cpp | 37 +++++++++ engines/titanic/game/pet/pet_monitor.h | 50 ++++++++++++ engines/titanic/game/pet/pet_position.cpp | 37 +++++++++ engines/titanic/game/pet/pet_position.h | 50 ++++++++++++ engines/titanic/game/pet/pet_sentinal.cpp | 37 +++++++++ engines/titanic/game/pet/pet_sentinal.h | 50 ++++++++++++ engines/titanic/game/pet/pet_sounds.cpp | 39 +++++++++ engines/titanic/game/pet/pet_sounds.h | 54 +++++++++++++ engines/titanic/game/pet/pet_transition.cpp | 37 +++++++++ engines/titanic/game/pet/pet_transition.h | 50 ++++++++++++ engines/titanic/game/pet/pet_transport.cpp | 37 +++++++++ engines/titanic/game/pet/pet_transport.h | 50 ++++++++++++ engines/titanic/game/pet_disabler.cpp | 39 +++++++++ engines/titanic/game/pet_disabler.h | 54 +++++++++++++ engines/titanic/game/pet_graphic.cpp | 37 +++++++++ engines/titanic/game/pet_graphic.h | 50 ++++++++++++ engines/titanic/game/pet_graphic2.cpp | 37 +++++++++ engines/titanic/game/pet_graphic2.h | 50 ++++++++++++ engines/titanic/game/pet_position.cpp | 37 --------- engines/titanic/game/pet_position.h | 50 ------------ engines/titanic/game/phonograph_lid.cpp | 37 +++++++++ engines/titanic/game/phonograph_lid.h | 50 ++++++++++++ engines/titanic/game/place_holder.cpp | 37 +++++++++ engines/titanic/game/place_holder.h | 50 ++++++++++++ engines/titanic/game/reserved_table.cpp | 42 ++++++++++ engines/titanic/game/reserved_table.h | 54 +++++++++++++ engines/titanic/game/search_point.cpp | 39 +++++++++ engines/titanic/game/search_point.h | 54 +++++++++++++ engines/titanic/game/sgt/sgt_doors.cpp | 43 ++++++++++ engines/titanic/game/sgt/sgt_doors.h | 54 +++++++++++++ engines/titanic/game/sgt/sgt_navigation.cpp | 37 +++++++++ engines/titanic/game/sgt/sgt_navigation.h | 50 ++++++++++++ engines/titanic/game/sgt/sgt_restaurant_doors.cpp | 37 +++++++++ engines/titanic/game/sgt/sgt_restaurant_doors.h | 50 ++++++++++++ engines/titanic/game/sgt/sgt_state_room.cpp | 85 ++++++++++++++++++++ engines/titanic/game/sgt/sgt_state_room.h | 77 ++++++++++++++++++ engines/titanic/game/sgt/sgt_upper_doors_sound.cpp | 45 +++++++++++ engines/titanic/game/sgt/sgt_upper_doors_sound.h | 52 ++++++++++++ engines/titanic/game/sgt_state_room.cpp | 85 -------------------- engines/titanic/game/sgt_state_room.h | 77 ------------------ engines/titanic/game/sgt_upper_doors_sound.cpp | 45 ----------- engines/titanic/game/sgt_upper_doors_sound.h | 52 ------------ engines/titanic/game/ship_setting_button.cpp | 37 +++++++++ engines/titanic/game/ship_setting_button.h | 50 ++++++++++++ engines/titanic/game/show_cell_points.cpp | 41 ++++++++++ engines/titanic/game/show_cell_points.h | 55 +++++++++++++ engines/titanic/game/splash_animation.cpp | 37 +++++++++ engines/titanic/game/splash_animation.h | 50 ++++++++++++ engines/titanic/game/star_control.cpp | 37 +++++++++ engines/titanic/game/star_control.h | 50 ++++++++++++ engines/titanic/game/starling_puret.cpp | 37 +++++++++ engines/titanic/game/starling_puret.h | 50 ++++++++++++ engines/titanic/game/sub_wrapper.cpp | 39 +++++++++ engines/titanic/game/sub_wrapper.h | 54 +++++++++++++ engines/titanic/game/throw_tv_down_well.cpp | 41 ++++++++++ engines/titanic/game/throw_tv_down_well.h | 55 +++++++++++++ engines/titanic/game/titania_still_control.cpp | 37 +++++++++ engines/titanic/game/titania_still_control.h | 50 ++++++++++++ engines/titanic/game/tow_parrot_nav.cpp | 37 +++++++++ engines/titanic/game/tow_parrot_nav.h | 50 ++++++++++++ engines/titanic/module.mk | 92 ++++++++++++++++++++-- engines/titanic/sound/auto_sound_player.cpp | 42 ++++++++++ engines/titanic/sound/auto_sound_player.h | 63 +++++++++++++++ engines/titanic/sound/background_sound_maker.cpp | 39 +++++++++ engines/titanic/sound/background_sound_maker.h | 54 +++++++++++++ engines/titanic/sound/music_player.cpp | 37 +++++++++ engines/titanic/sound/music_player.h | 58 ++++++++++++++ engines/titanic/sound/titania_speech.cpp | 43 ++++++++++ engines/titanic/sound/titania_speech.h | 54 +++++++++++++ .../titanic/sound/trigger_auto_music_player.cpp | 37 +++++++++ engines/titanic/sound/trigger_auto_music_player.h | 50 ++++++++++++ 178 files changed, 8060 insertions(+), 360 deletions(-) create mode 100644 engines/titanic/carry/test_carry.cpp create mode 100644 engines/titanic/carry/test_carry.h create mode 100644 engines/titanic/core/static_image.cpp create mode 100644 engines/titanic/core/static_image.h create mode 100644 engines/titanic/game/annoy_barbot.cpp create mode 100644 engines/titanic/game/annoy_barbot.h create mode 100644 engines/titanic/game/bar_bell.cpp create mode 100644 engines/titanic/game/bar_bell.h create mode 100644 engines/titanic/game/bar_menu.cpp create mode 100644 engines/titanic/game/bar_menu.h create mode 100644 engines/titanic/game/bar_menu_button.cpp create mode 100644 engines/titanic/game/bar_menu_button.h create mode 100644 engines/titanic/game/belbot_get_light.cpp create mode 100644 engines/titanic/game/belbot_get_light.h create mode 100644 engines/titanic/game/bottom_of_well_monitor.cpp create mode 100644 engines/titanic/game/bottom_of_well_monitor.h create mode 100644 engines/titanic/game/brain_slot.cpp create mode 100644 engines/titanic/game/brain_slot.h create mode 100644 engines/titanic/game/bridge_door.cpp create mode 100644 engines/titanic/game/bridge_door.h create mode 100644 engines/titanic/game/call_pellerator.cpp create mode 100644 engines/titanic/game/call_pellerator.h create mode 100644 engines/titanic/game/chev_code.cpp create mode 100644 engines/titanic/game/chev_code.h create mode 100644 engines/titanic/game/chev_panel.cpp create mode 100644 engines/titanic/game/chev_panel.h create mode 100644 engines/titanic/game/chicken_cooler.cpp create mode 100644 engines/titanic/game/chicken_cooler.h create mode 100644 engines/titanic/game/cookie.cpp create mode 100644 engines/titanic/game/cookie.h create mode 100644 engines/titanic/game/doorbot_elevator_handler.cpp create mode 100644 engines/titanic/game/doorbot_elevator_handler.h create mode 100644 engines/titanic/game/elevator_action_area.cpp create mode 100644 engines/titanic/game/elevator_action_area.h create mode 100644 engines/titanic/game/end_credit_text.cpp create mode 100644 engines/titanic/game/end_credit_text.h create mode 100644 engines/titanic/game/end_credits.cpp create mode 100644 engines/titanic/game/end_credits.h create mode 100644 engines/titanic/game/end_explode_ship.cpp create mode 100644 engines/titanic/game/end_explode_ship.h create mode 100644 engines/titanic/game/end_game_credits.cpp create mode 100644 engines/titanic/game/end_game_credits.h create mode 100644 engines/titanic/game/end_sequence_control.cpp create mode 100644 engines/titanic/game/end_sequence_control.h create mode 100644 engines/titanic/game/enter_bridge.cpp create mode 100644 engines/titanic/game/enter_bridge.h create mode 100644 engines/titanic/game/enter_exit_sec_class_mini_lift.cpp create mode 100644 engines/titanic/game/enter_exit_sec_class_mini_lift.h create mode 100644 engines/titanic/game/enter_exit_view.cpp create mode 100644 engines/titanic/game/enter_exit_view.h create mode 100644 engines/titanic/game/enter_sec_class_state.cpp create mode 100644 engines/titanic/game/enter_sec_class_state.h create mode 100644 engines/titanic/game/exit_lift.cpp create mode 100644 engines/titanic/game/exit_lift.h create mode 100644 engines/titanic/game/exit_pellerator.cpp create mode 100644 engines/titanic/game/exit_pellerator.h create mode 100644 engines/titanic/game/fan.cpp create mode 100644 engines/titanic/game/fan.h create mode 100644 engines/titanic/game/fan_control.cpp create mode 100644 engines/titanic/game/fan_control.h create mode 100644 engines/titanic/game/fan_decrease.cpp create mode 100644 engines/titanic/game/fan_decrease.h create mode 100644 engines/titanic/game/fan_increase.cpp create mode 100644 engines/titanic/game/fan_increase.h create mode 100644 engines/titanic/game/fan_noises.cpp create mode 100644 engines/titanic/game/fan_noises.h create mode 100644 engines/titanic/game/floor_indicator.cpp create mode 100644 engines/titanic/game/floor_indicator.h create mode 100644 engines/titanic/game/get_lift_eye2.cpp create mode 100644 engines/titanic/game/get_lift_eye2.h create mode 100644 engines/titanic/game/glass_smasher.cpp create mode 100644 engines/titanic/game/glass_smasher.h create mode 100644 engines/titanic/game/gondolier_base.cpp create mode 100644 engines/titanic/game/gondolier_base.h create mode 100644 engines/titanic/game/hammer_clip.cpp create mode 100644 engines/titanic/game/hammer_clip.h create mode 100644 engines/titanic/game/head_slot.cpp create mode 100644 engines/titanic/game/head_slot.h create mode 100644 engines/titanic/game/head_spinner.cpp create mode 100644 engines/titanic/game/head_spinner.h create mode 100644 engines/titanic/game/idle_summoner.cpp create mode 100644 engines/titanic/game/idle_summoner.h create mode 100644 engines/titanic/game/leave_sec_class_state.cpp create mode 100644 engines/titanic/game/leave_sec_class_state.h create mode 100644 engines/titanic/game/long_stick_dispenser.cpp create mode 100644 engines/titanic/game/long_stick_dispenser.h create mode 100644 engines/titanic/game/mail_man.cpp create mode 100644 engines/titanic/game/mail_man.h create mode 100644 engines/titanic/game/missiveomat.cpp create mode 100644 engines/titanic/game/missiveomat.h create mode 100644 engines/titanic/game/movie_tester.cpp create mode 100644 engines/titanic/game/movie_tester.h create mode 100644 engines/titanic/game/navigation_computer.cpp create mode 100644 engines/titanic/game/navigation_computer.h create mode 100644 engines/titanic/game/parrot/player_meets_parrot.cpp create mode 100644 engines/titanic/game/parrot/player_meets_parrot.h create mode 100644 engines/titanic/game/pet/pet.cpp create mode 100644 engines/titanic/game/pet/pet.h create mode 100644 engines/titanic/game/pet/pet_class1.cpp create mode 100644 engines/titanic/game/pet/pet_class1.h create mode 100644 engines/titanic/game/pet/pet_class2.cpp create mode 100644 engines/titanic/game/pet/pet_class2.h create mode 100644 engines/titanic/game/pet/pet_class3.cpp create mode 100644 engines/titanic/game/pet/pet_class3.h create mode 100644 engines/titanic/game/pet/pet_monitor.cpp create mode 100644 engines/titanic/game/pet/pet_monitor.h create mode 100644 engines/titanic/game/pet/pet_position.cpp create mode 100644 engines/titanic/game/pet/pet_position.h create mode 100644 engines/titanic/game/pet/pet_sentinal.cpp create mode 100644 engines/titanic/game/pet/pet_sentinal.h create mode 100644 engines/titanic/game/pet/pet_sounds.cpp create mode 100644 engines/titanic/game/pet/pet_sounds.h create mode 100644 engines/titanic/game/pet/pet_transition.cpp create mode 100644 engines/titanic/game/pet/pet_transition.h create mode 100644 engines/titanic/game/pet/pet_transport.cpp create mode 100644 engines/titanic/game/pet/pet_transport.h create mode 100644 engines/titanic/game/pet_disabler.cpp create mode 100644 engines/titanic/game/pet_disabler.h create mode 100644 engines/titanic/game/pet_graphic.cpp create mode 100644 engines/titanic/game/pet_graphic.h create mode 100644 engines/titanic/game/pet_graphic2.cpp create mode 100644 engines/titanic/game/pet_graphic2.h delete mode 100644 engines/titanic/game/pet_position.cpp delete mode 100644 engines/titanic/game/pet_position.h create mode 100644 engines/titanic/game/phonograph_lid.cpp create mode 100644 engines/titanic/game/phonograph_lid.h create mode 100644 engines/titanic/game/place_holder.cpp create mode 100644 engines/titanic/game/place_holder.h create mode 100644 engines/titanic/game/reserved_table.cpp create mode 100644 engines/titanic/game/reserved_table.h create mode 100644 engines/titanic/game/search_point.cpp create mode 100644 engines/titanic/game/search_point.h create mode 100644 engines/titanic/game/sgt/sgt_doors.cpp create mode 100644 engines/titanic/game/sgt/sgt_doors.h create mode 100644 engines/titanic/game/sgt/sgt_navigation.cpp create mode 100644 engines/titanic/game/sgt/sgt_navigation.h create mode 100644 engines/titanic/game/sgt/sgt_restaurant_doors.cpp create mode 100644 engines/titanic/game/sgt/sgt_restaurant_doors.h create mode 100644 engines/titanic/game/sgt/sgt_state_room.cpp create mode 100644 engines/titanic/game/sgt/sgt_state_room.h create mode 100644 engines/titanic/game/sgt/sgt_upper_doors_sound.cpp create mode 100644 engines/titanic/game/sgt/sgt_upper_doors_sound.h delete mode 100644 engines/titanic/game/sgt_state_room.cpp delete mode 100644 engines/titanic/game/sgt_state_room.h delete mode 100644 engines/titanic/game/sgt_upper_doors_sound.cpp delete mode 100644 engines/titanic/game/sgt_upper_doors_sound.h create mode 100644 engines/titanic/game/ship_setting_button.cpp create mode 100644 engines/titanic/game/ship_setting_button.h create mode 100644 engines/titanic/game/show_cell_points.cpp create mode 100644 engines/titanic/game/show_cell_points.h create mode 100644 engines/titanic/game/splash_animation.cpp create mode 100644 engines/titanic/game/splash_animation.h create mode 100644 engines/titanic/game/star_control.cpp create mode 100644 engines/titanic/game/star_control.h create mode 100644 engines/titanic/game/starling_puret.cpp create mode 100644 engines/titanic/game/starling_puret.h create mode 100644 engines/titanic/game/sub_wrapper.cpp create mode 100644 engines/titanic/game/sub_wrapper.h create mode 100644 engines/titanic/game/throw_tv_down_well.cpp create mode 100644 engines/titanic/game/throw_tv_down_well.h create mode 100644 engines/titanic/game/titania_still_control.cpp create mode 100644 engines/titanic/game/titania_still_control.h create mode 100644 engines/titanic/game/tow_parrot_nav.cpp create mode 100644 engines/titanic/game/tow_parrot_nav.h create mode 100644 engines/titanic/sound/auto_sound_player.cpp create mode 100644 engines/titanic/sound/auto_sound_player.h create mode 100644 engines/titanic/sound/background_sound_maker.cpp create mode 100644 engines/titanic/sound/background_sound_maker.h create mode 100644 engines/titanic/sound/music_player.cpp create mode 100644 engines/titanic/sound/music_player.h create mode 100644 engines/titanic/sound/titania_speech.cpp create mode 100644 engines/titanic/sound/titania_speech.h create mode 100644 engines/titanic/sound/trigger_auto_music_player.cpp create mode 100644 engines/titanic/sound/trigger_auto_music_player.h diff --git a/engines/titanic/carry/test_carry.cpp b/engines/titanic/carry/test_carry.cpp new file mode 100644 index 0000000000..26b4f566e9 --- /dev/null +++ b/engines/titanic/carry/test_carry.cpp @@ -0,0 +1,43 @@ +/* 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 "titanic/carry/test_carry.h" + +namespace Titanic { + +void CTestArray::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value1, indent); + file->writeNumberLine(_value2, indent); + + CGameObject::save(file, indent); +} + +void CTestArray::load(SimpleFile *file) { + file->readNumber(); + _value1 = file->readNumber(); + _value2 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/test_carry.h b/engines/titanic/carry/test_carry.h new file mode 100644 index 0000000000..b542fb7aac --- /dev/null +++ b/engines/titanic/carry/test_carry.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_TEST_CARRY_H +#define TITANIC_TEST_CARRY_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CTestArray : public CGameObject { +public: + int _value1, _value2; +public: + CTestArray() : CGameObject(), _value1(0), _value2(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CTestArray"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TEST_CARRY_H */ diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 12efdc17d2..f76340c83b 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -69,6 +69,7 @@ #include "titanic/core/view_item.h" #include "titanic/game/announce.h" +#include "titanic/game/belbot_get_light.h" #include "titanic/game/bowl_unlocker.h" #include "titanic/game/cdrom.h" #include "titanic/game/cdrom_computer.h" @@ -90,12 +91,9 @@ #include "titanic/game/no_nut_bowl.h" #include "titanic/game/null_port_hole.h" #include "titanic/game/nut_replacer.h" -#include "titanic/game/pet_position.h" #include "titanic/game/port_hole.h" #include "titanic/game/room_item.h" #include "titanic/game/service_elevator_door.h" -#include "titanic/game/sgt_state_room.h" -#include "titanic/game/sgt_upper_doors_sound.h" #include "titanic/game/start_action.h" #include "titanic/game/sub_glass.h" #include "titanic/game/sweet_bowl.h" @@ -110,6 +108,21 @@ #include "titanic/game/parrot/parrot_perch_holder.h" #include "titanic/game/parrot/parrot_succubus.h" #include "titanic/game/parrot/parrot_trigger.h" +#include "titanic/game/pet/pet.h" +#include "titanic/game/pet/pet_class1.h" +#include "titanic/game/pet/pet_class2.h" +#include "titanic/game/pet/pet_class3.h" +#include "titanic/game/pet/pet_monitor.h" +#include "titanic/game/pet/pet_position.h" +#include "titanic/game/pet/pet_sentinal.h" +#include "titanic/game/pet/pet_sounds.h" +#include "titanic/game/pet/pet_transition.h" +#include "titanic/game/pet/pet_transport.h" +#include "titanic/game/sgt/sgt_doors.h" +#include "titanic/game/sgt/sgt_navigation.h" +#include "titanic/game/sgt/sgt_restaurant_doors.h" +#include "titanic/game/sgt/sgt_state_room.h" +#include "titanic/game/sgt/sgt_upper_doors_sound.h" #include "titanic/gfx/act_button.h" #include "titanic/gfx/changes_season_button.h" @@ -230,6 +243,7 @@ DEFFN(CTreeItem); DEFFN(CViewItem); DEFFN(CAnnounce); +DEFFN(CBelbotGetLight); DEFFN(CBowlUnlocker); DEFFN(CCDROM); DEFFN(CCDROMComputer); @@ -250,12 +264,9 @@ DEFFN(CLittleLiftButton); DEFFN(CNoNutBowl); DEFFN(CNullPortHole); DEFFN(CNutReplacer); -DEFFN(CPETPosition); DEFFN(CPortHole); DEFFN(CRoomItem); DEFFN(CServiceElevatorDoor); -DEFFN(CSGTStateRoom); -DEFFN(CSGTUpperDoorsSound); DEFFN(CStartAction); DEFFN(CSUBGlass); DEFFN(CSweetBowl); @@ -270,6 +281,21 @@ DEFFN(CParrotNutEater); DEFFN(CParrotPerchHolder); DEFFN(CParrotSuccUBus); DEFFN(CParrotTrigger); +DEFFN(CPET); +DEFFN(CPETClass1); +DEFFN(CPETClass2); +DEFFN(CPETClass3); +DEFFN(CPETMonitor); +DEFFN(CPETPosition); +DEFFN(CPETSentinal); +DEFFN(CPETSounds); +DEFFN(CPETTransition); +DEFFN(CPETTransport); +DEFFN(CSGTDoors); +DEFFN(CSGTNavigation); +DEFFN(CSGTRestaurantDoors); +DEFFN(CSGTStateRoom); +DEFFN(CSGTUpperDoorsSound); DEFFN(CActButton); DEFFN(CChangesSeasonButton); @@ -554,6 +580,7 @@ void CSaveableObject::initClassList() { ADDFN(CViewItem); ADDFN(CAnnounce); + ADDFN(CBelbotGetLight); ADDFN(CBowlUnlocker); ADDFN(CCDROM); ADDFN(CCDROMComputer); @@ -595,6 +622,21 @@ void CSaveableObject::initClassList() { ADDFN(CParrotPerchHolder); ADDFN(CParrotSuccUBus); ADDFN(CParrotTrigger); + ADDFN(CPET); + ADDFN(CPETClass1); + ADDFN(CPETClass2); + ADDFN(CPETClass3); + ADDFN(CPETMonitor); + ADDFN(CPETPosition); + ADDFN(CPETSentinal); + ADDFN(CPETSounds); + ADDFN(CPETTransition); + ADDFN(CPETTransport); + ADDFN(CSGTDoors); + ADDFN(CSGTNavigation); + ADDFN(CSGTRestaurantDoors); + ADDFN(CSGTStateRoom); + ADDFN(CSGTUpperDoorsSound); ADDFN(CActButton); ADDFN(CChangesSeasonButton); diff --git a/engines/titanic/core/static_image.cpp b/engines/titanic/core/static_image.cpp new file mode 100644 index 0000000000..54a041fff5 --- /dev/null +++ b/engines/titanic/core/static_image.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/core/static_image.h" + +namespace Titanic { + +void CStaticImage::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CStaticImage::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/core/static_image.h b/engines/titanic/core/static_image.h new file mode 100644 index 0000000000..ac556f243e --- /dev/null +++ b/engines/titanic/core/static_image.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_STATIC_IMAGE_H +#define TITANIC_STATIC_IMAGE_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CStaticImage : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CStaticImage"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STATIC_IMAGE_H */ diff --git a/engines/titanic/game/annoy_barbot.cpp b/engines/titanic/game/annoy_barbot.cpp new file mode 100644 index 0000000000..c21e828659 --- /dev/null +++ b/engines/titanic/game/annoy_barbot.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/annoy_barbot.h" + +namespace Titanic { + +void CAnnoyBarbot::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CAnnoyBarbot::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/annoy_barbot.h b/engines/titanic/game/annoy_barbot.h new file mode 100644 index 0000000000..18be7c1b15 --- /dev/null +++ b/engines/titanic/game/annoy_barbot.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_ANNOY_BARBOT_H +#define TITANIC_ANNOY_BARBOT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CAnnoyBarbot : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CAnnoyBarbot"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ANNOY_BARBOT_H */ diff --git a/engines/titanic/game/bar_bell.cpp b/engines/titanic/game/bar_bell.cpp new file mode 100644 index 0000000000..71f0e878df --- /dev/null +++ b/engines/titanic/game/bar_bell.cpp @@ -0,0 +1,53 @@ +/* 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 "titanic/game/bar_bell.h" + +namespace Titanic { + +CBarBell::CBarBell() : CGameObject(), _fieldBC(0), + _fieldC0(65), _fieldC4(0), _fieldC8(0), _fieldCC(0) { +} + +void CBarBell::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_fieldC4, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeNumberLine(_fieldCC, indent); + + CGameObject::save(file, indent); +} + +void CBarBell::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _fieldC4 = file->readNumber(); + _fieldC8 = file->readNumber(); + _fieldCC = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/bar_bell.h b/engines/titanic/game/bar_bell.h new file mode 100644 index 0000000000..87c244d9bf --- /dev/null +++ b/engines/titanic/game/bar_bell.h @@ -0,0 +1,58 @@ +/* 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. + * + */ + +#ifndef TITANIC_BAR_BELL_H +#define TITANIC_BAR_BELL_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CBarBell : public CGameObject { +public: + int _fieldBC; + int _fieldC0; + int _fieldC4; + int _fieldC8; + int _fieldCC; +public: + CBarBell(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBarBell"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BAR_BELL_H */ diff --git a/engines/titanic/game/bar_menu.cpp b/engines/titanic/game/bar_menu.cpp new file mode 100644 index 0000000000..53ed48aa57 --- /dev/null +++ b/engines/titanic/game/bar_menu.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/game/bar_menu.h" + +namespace Titanic { + +CBarMenu::CBarMenu() : CGameObject(), _fieldBC(0), _fieldC0(0), _fieldC4(6) { +} + +void CBarMenu::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CBarMenu::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/bar_menu.h b/engines/titanic/game/bar_menu.h new file mode 100644 index 0000000000..69ba0aa3e3 --- /dev/null +++ b/engines/titanic/game/bar_menu.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_BAR_MENU_H +#define TITANIC_BAR_MENU_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CBarMenu : public CGameObject { +public: + int _fieldBC; + int _fieldC0; + int _fieldC4; +public: + CBarMenu(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBarMenu"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BAR_MENU_H */ diff --git a/engines/titanic/game/bar_menu_button.cpp b/engines/titanic/game/bar_menu_button.cpp new file mode 100644 index 0000000000..897c7a8e1e --- /dev/null +++ b/engines/titanic/game/bar_menu_button.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/bar_menu_button.h" + +namespace Titanic { + +void CBarMenuButton::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CGameObject::save(file, indent); +} + +void CBarMenuButton::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/bar_menu_button.h b/engines/titanic/game/bar_menu_button.h new file mode 100644 index 0000000000..56b618dd1e --- /dev/null +++ b/engines/titanic/game/bar_menu_button.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_BAR_MENU_BUTTON_H +#define TITANIC_BAR_MENU_BUTTON_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CBarMenuButton : public CGameObject { +public: + int _value; +public: + CBarMenuButton() : CGameObject(), _value(1) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBarMenuButton"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BAR_MENU_BUTTON_H */ diff --git a/engines/titanic/game/belbot_get_light.cpp b/engines/titanic/game/belbot_get_light.cpp new file mode 100644 index 0000000000..4bbafcd31c --- /dev/null +++ b/engines/titanic/game/belbot_get_light.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/belbot_get_light.h" + +namespace Titanic { + +void CBelbotGetLight::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_value, indent); + CGameObject::save(file, indent); +} + +void CBelbotGetLight::load(SimpleFile *file) { + file->readNumber(); + _value = file->readString(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/belbot_get_light.h b/engines/titanic/game/belbot_get_light.h new file mode 100644 index 0000000000..2c2d547dcc --- /dev/null +++ b/engines/titanic/game/belbot_get_light.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_BELBOT_GET_LIGHT_H +#define TITANIC_BELBOT_GET_LIGHT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CBelbotGetLight : public CGameObject { +private: + CString _value; +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBelbotGetLight"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_LIGHT_H */ diff --git a/engines/titanic/game/bottom_of_well_monitor.cpp b/engines/titanic/game/bottom_of_well_monitor.cpp new file mode 100644 index 0000000000..daca5dbb5f --- /dev/null +++ b/engines/titanic/game/bottom_of_well_monitor.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/bottom_of_well_monitor.h" + +namespace Titanic { + +void CBottomOfWellMonitor::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CGameObject::save(file, indent); +} + +void CBottomOfWellMonitor::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/bottom_of_well_monitor.h b/engines/titanic/game/bottom_of_well_monitor.h new file mode 100644 index 0000000000..de07aacf35 --- /dev/null +++ b/engines/titanic/game/bottom_of_well_monitor.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_BOTTOM_OF_WELL_MONITOR_H +#define TITANIC_BOTTOM_OF_WELL_MONITOR_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CBottomOfWellMonitor : public CGameObject { +public: + int _value; +public: + CBottomOfWellMonitor() : _value(1) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBottomOfWellMonitor"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BOTTOM_OF_WELL_MONITOR_H */ diff --git a/engines/titanic/game/brain_slot.cpp b/engines/titanic/game/brain_slot.cpp new file mode 100644 index 0000000000..f8a029ed67 --- /dev/null +++ b/engines/titanic/game/brain_slot.cpp @@ -0,0 +1,50 @@ +/* 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 "titanic/game/brain_slot.h" + +namespace Titanic { + +int CBrainSlot::_v1; +int CBrainSlot::_v2; + +void CBrainSlot::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value1, indent); + file->writeNumberLine(_value2, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_v2, indent); + + CGameObject::save(file, indent); +} + +void CBrainSlot::load(SimpleFile *file) { + file->readNumber(); + _value1 = file->readNumber(); + _value2 = file->readNumber(); + _v1 = file->readNumber(); + _v2 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/brain_slot.h b/engines/titanic/game/brain_slot.h new file mode 100644 index 0000000000..982541f945 --- /dev/null +++ b/engines/titanic/game/brain_slot.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_BRAIN_SLOT_H +#define TITANIC_BRAIN_SLOT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CBrainSlot : public CGameObject { +public: + static int _v1, _v2; +public: + int _value1, _value2; +public: + CBrainSlot() : CGameObject(), _value1(0), _value2(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBrainSlot"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BRAIN_SLOT_H */ diff --git a/engines/titanic/game/bridge_door.cpp b/engines/titanic/game/bridge_door.cpp new file mode 100644 index 0000000000..b24f7a6b6a --- /dev/null +++ b/engines/titanic/game/bridge_door.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/bridge_door.h" + +namespace Titanic { + +void CBridgeDoor::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CBridgeDoor::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/bridge_door.h b/engines/titanic/game/bridge_door.h new file mode 100644 index 0000000000..96703c1c6f --- /dev/null +++ b/engines/titanic/game/bridge_door.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_BRIDGE_DOOR_H +#define TITANIC_BRIDGE_DOOR_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CBridgeDoor : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBridgeDoor"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BRIDGE_DOOR_H */ diff --git a/engines/titanic/game/call_pellerator.cpp b/engines/titanic/game/call_pellerator.cpp new file mode 100644 index 0000000000..85f2ab83b5 --- /dev/null +++ b/engines/titanic/game/call_pellerator.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/call_pellerator.h" + +namespace Titanic { + +void CCallPellerator::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CCallPellerator::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/call_pellerator.h b/engines/titanic/game/call_pellerator.h new file mode 100644 index 0000000000..a6e8ded2a2 --- /dev/null +++ b/engines/titanic/game/call_pellerator.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_CALL_PELLERATOR_H +#define TITANIC_CALL_PELLERATOR_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CCallPellerator : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CCallPellerator"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CALL_PELLERATOR_H */ diff --git a/engines/titanic/game/chev_code.cpp b/engines/titanic/game/chev_code.cpp new file mode 100644 index 0000000000..d2818f60a8 --- /dev/null +++ b/engines/titanic/game/chev_code.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/chev_code.h" + +namespace Titanic { + +void CChevCode::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CGameObject::save(file, indent); +} + +void CChevCode::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/chev_code.h b/engines/titanic/game/chev_code.h new file mode 100644 index 0000000000..6bd624258e --- /dev/null +++ b/engines/titanic/game/chev_code.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_CHEV_CODE_H +#define TITANIC_CHEV_CODE_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CChevCode : public CGameObject { +public: + int _value; +public: + CChevCode() : CGameObject(), _value(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CChevCode"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CHEV_CODE_H */ diff --git a/engines/titanic/game/chev_panel.cpp b/engines/titanic/game/chev_panel.cpp new file mode 100644 index 0000000000..665b91dca2 --- /dev/null +++ b/engines/titanic/game/chev_panel.cpp @@ -0,0 +1,45 @@ +/* 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 "titanic/game/chev_panel.h" + +namespace Titanic { + +void CChevPanel::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_fieldC4, indent); + + CGameObject::save(file, indent); +} + +void CChevPanel::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _fieldC4 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/chev_panel.h b/engines/titanic/game/chev_panel.h new file mode 100644 index 0000000000..39ad43628d --- /dev/null +++ b/engines/titanic/game/chev_panel.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_CHEV_PANEL_H +#define TITANIC_CHEV_PANEL_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CChevPanel : public CGameObject { +public: + int _fieldBC; + int _fieldC0; + int _fieldC4; +public: + CChevPanel() : _fieldBC(0), _fieldC0(0), _fieldC4(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CChevPanel"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CHEV_PANEL_H */ diff --git a/engines/titanic/game/chicken_cooler.cpp b/engines/titanic/game/chicken_cooler.cpp new file mode 100644 index 0000000000..feb3b4cade --- /dev/null +++ b/engines/titanic/game/chicken_cooler.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/chicken_cooler.h" + +namespace Titanic { + +void CChickenCooler::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CChickenCooler::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/chicken_cooler.h b/engines/titanic/game/chicken_cooler.h new file mode 100644 index 0000000000..42e8a2724e --- /dev/null +++ b/engines/titanic/game/chicken_cooler.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_CHICKEN_COOLER_H +#define TITANIC_CHICKEN_COOLER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CChickenCooler : public CGameObject { +public: + int _fieldBC; + int _fieldC0; +public: + CChickenCooler() : CGameObject(), _fieldBC(0), _fieldC0(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CChickenCooler"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CHICKEN_COOLER_H */ diff --git a/engines/titanic/game/cookie.cpp b/engines/titanic/game/cookie.cpp new file mode 100644 index 0000000000..98621d04ab --- /dev/null +++ b/engines/titanic/game/cookie.cpp @@ -0,0 +1,43 @@ +/* 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 "titanic/game/cookie.h" + +namespace Titanic { + +void CCookie::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value1, indent); + file->writeNumberLine(_value2, indent); + + CGameObject::save(file, indent); +} + +void CCookie::load(SimpleFile *file) { + file->readNumber(); + _value1 = file->readNumber(); + _value2 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/cookie.h b/engines/titanic/game/cookie.h new file mode 100644 index 0000000000..a1a72c96c8 --- /dev/null +++ b/engines/titanic/game/cookie.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_COOKIE_H +#define TITANIC_COOKIE_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CCookie : public CGameObject { +public: + int _value1; + int _value2; +public: + CCookie() : CGameObject(), _value1(0), _value2(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CCookie"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_COOKIE_H */ diff --git a/engines/titanic/game/doorbot_elevator_handler.cpp b/engines/titanic/game/doorbot_elevator_handler.cpp new file mode 100644 index 0000000000..1a85793bdd --- /dev/null +++ b/engines/titanic/game/doorbot_elevator_handler.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/doorbot_elevator_handler.h" + +namespace Titanic { + +void CDoorbotElevatorHandler::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CGameObject::save(file, indent); +} + +void CDoorbotElevatorHandler::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/doorbot_elevator_handler.h b/engines/titanic/game/doorbot_elevator_handler.h new file mode 100644 index 0000000000..041e2c5723 --- /dev/null +++ b/engines/titanic/game/doorbot_elevator_handler.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_DOORBOT_ELEVATOR_HANDLER_H +#define TITANIC_DOORBOT_ELEVATOR_HANDLER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CDoorbotElevatorHandler : public CGameObject { +public: + int _value; +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CDoorbotElevatorHandler"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DOORBOT_ELEVATOR_HANDLER_H */ diff --git a/engines/titanic/game/drawer.h b/engines/titanic/game/drawer.h index 020b1059c0..100e27cb52 100644 --- a/engines/titanic/game/drawer.h +++ b/engines/titanic/game/drawer.h @@ -23,7 +23,7 @@ #ifndef TITANIC_DRAWER_H #define TITANIC_DRAWER_H -#include "titanic/game/sgt_state_room.h" +#include "titanic/game/sgt/sgt_state_room.h" namespace Titanic { diff --git a/engines/titanic/game/elevator_action_area.cpp b/engines/titanic/game/elevator_action_area.cpp new file mode 100644 index 0000000000..3beef1b0e1 --- /dev/null +++ b/engines/titanic/game/elevator_action_area.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/elevator_action_area.h" + +namespace Titanic { + +void CElevatorActionArea::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CElevatorActionArea::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/elevator_action_area.h b/engines/titanic/game/elevator_action_area.h new file mode 100644 index 0000000000..07c4f13990 --- /dev/null +++ b/engines/titanic/game/elevator_action_area.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_ELEVATOR_ACTION_AREA_H +#define TITANIC_ELEVATOR_ACTION_AREA_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CElevatorActionArea : public CGameObject { +public: + int _value; +public: + CElevatorActionArea() : CGameObject(), _value(4) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CElevatorActionArea"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ELEVATOR_ACTION_AREA_H */ diff --git a/engines/titanic/game/end_credit_text.cpp b/engines/titanic/game/end_credit_text.cpp new file mode 100644 index 0000000000..949c6e2187 --- /dev/null +++ b/engines/titanic/game/end_credit_text.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/end_credit_text.h" + +namespace Titanic { + +void CEndCreditText::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CEndCreditText::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/end_credit_text.h b/engines/titanic/game/end_credit_text.h new file mode 100644 index 0000000000..258b1a3ef3 --- /dev/null +++ b/engines/titanic/game/end_credit_text.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_END_CREDIT_TEXT_H +#define TITANIC_END_CREDIT_TEXT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CEndCreditText : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CEndCreditText"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_END_CREDIT_TEXT_H */ diff --git a/engines/titanic/game/end_credits.cpp b/engines/titanic/game/end_credits.cpp new file mode 100644 index 0000000000..0f71cfc91a --- /dev/null +++ b/engines/titanic/game/end_credits.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/end_credits.h" + +namespace Titanic { + +void CEndCredits::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CGameObject::save(file, indent); +} + +void CEndCredits::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/end_credits.h b/engines/titanic/game/end_credits.h new file mode 100644 index 0000000000..cf5c45ae45 --- /dev/null +++ b/engines/titanic/game/end_credits.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_END_CREDITS_H +#define TITANIC_END_CREDITS_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CEndCredits : public CGameObject { +public: + int _value; +public: + CEndCredits() : CGameObject(), _value(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CEndCredits"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_END_CREDITS_H */ diff --git a/engines/titanic/game/end_explode_ship.cpp b/engines/titanic/game/end_explode_ship.cpp new file mode 100644 index 0000000000..e12e03e28d --- /dev/null +++ b/engines/titanic/game/end_explode_ship.cpp @@ -0,0 +1,43 @@ +/* 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 "titanic/game/end_explode_ship.h" + +namespace Titanic { + +void CEndExplodeShip::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value1, indent); + file->writeNumberLine(_value2, indent); + + CGameObject::save(file, indent); +} + +void CEndExplodeShip::load(SimpleFile *file) { + file->readNumber(); + _value1 = file->readNumber(); + _value2 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/end_explode_ship.h b/engines/titanic/game/end_explode_ship.h new file mode 100644 index 0000000000..df2e0b1b8c --- /dev/null +++ b/engines/titanic/game/end_explode_ship.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_END_EXPLODE_SHIP_H +#define TITANIC_END_EXPLODE_SHIP_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CEndExplodeShip : public CGameObject { +public: + int _value1, _value2; +public: + CEndExplodeShip() : CGameObject(), _value1(0), _value2(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CEndExplodeShip"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_END_EXPLODE_SHIP_H */ diff --git a/engines/titanic/game/end_game_credits.cpp b/engines/titanic/game/end_game_credits.cpp new file mode 100644 index 0000000000..36c0510b20 --- /dev/null +++ b/engines/titanic/game/end_game_credits.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/nut_replacer.h" + +namespace Titanic { + +void CNutReplacer::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CNutReplacer::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/end_game_credits.h b/engines/titanic/game/end_game_credits.h new file mode 100644 index 0000000000..c243f9a79c --- /dev/null +++ b/engines/titanic/game/end_game_credits.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_END_GAME_SHIP_H +#define TITANIC_END_GAME_SHIP_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CEndGameShip : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CEndGameShip"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_END_GAME_SHIP_H */ diff --git a/engines/titanic/game/end_sequence_control.cpp b/engines/titanic/game/end_sequence_control.cpp new file mode 100644 index 0000000000..1432435a28 --- /dev/null +++ b/engines/titanic/game/end_sequence_control.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/end_sequence_control.h" + +namespace Titanic { + +void CEndSequenceControl::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CEndSequenceControl::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/end_sequence_control.h b/engines/titanic/game/end_sequence_control.h new file mode 100644 index 0000000000..dc849295ec --- /dev/null +++ b/engines/titanic/game/end_sequence_control.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_END_SEQUENCE_CONTROL_H +#define TITANIC_END_SEQUENCE_CONTROL_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CEndSequenceControl : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CEndSequenceControl"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_END_SEQUENCE_CONTROL_H */ diff --git a/engines/titanic/game/enter_bridge.cpp b/engines/titanic/game/enter_bridge.cpp new file mode 100644 index 0000000000..13e4a50264 --- /dev/null +++ b/engines/titanic/game/enter_bridge.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/enter_bridge.h" + +namespace Titanic { + +void CEnterBridge::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CGameObject::save(file, indent); +} + +void CEnterBridge::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/enter_bridge.h b/engines/titanic/game/enter_bridge.h new file mode 100644 index 0000000000..bbc4cc96d0 --- /dev/null +++ b/engines/titanic/game/enter_bridge.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_ENTER_BRIDGE_H +#define TITANIC_ENTER_BRIDGE_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CEnterBridge : public CGameObject { +public: + int _value; +public: + CEnterBridge() : CGameObject(), _value(1) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CEnterBridge"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ENTER_BRIDGE_H */ diff --git a/engines/titanic/game/enter_exit_sec_class_mini_lift.cpp b/engines/titanic/game/enter_exit_sec_class_mini_lift.cpp new file mode 100644 index 0000000000..d4162ac008 --- /dev/null +++ b/engines/titanic/game/enter_exit_sec_class_mini_lift.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/enter_exit_sec_class_mini_lift.h" + +namespace Titanic { + +void CEnterExitSecClassMiniLift::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CEnterExitSecClassMiniLift::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/enter_exit_sec_class_mini_lift.h b/engines/titanic/game/enter_exit_sec_class_mini_lift.h new file mode 100644 index 0000000000..aa3f9b3731 --- /dev/null +++ b/engines/titanic/game/enter_exit_sec_class_mini_lift.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_ENTER_EXIT_SEC_CLASS_MINI_LIFT_H +#define TITANIC_ENTER_EXIT_SEC_CLASS_MINI_LIFT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CEnterExitSecClassMiniLift : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CEnterExitSecClassMiniLift"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ENTER_EXIT_SEC_CLASS_MINI_LIFT_H */ diff --git a/engines/titanic/game/enter_exit_view.cpp b/engines/titanic/game/enter_exit_view.cpp new file mode 100644 index 0000000000..e892161757 --- /dev/null +++ b/engines/titanic/game/enter_exit_view.cpp @@ -0,0 +1,53 @@ +/* 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 "titanic/game/enter_exit_view.h" + +namespace Titanic { + +CEnterExitView::CEnterExitView() : CGameObject(), _fieldBC(0), + _fieldC0(0), _fieldC4(0), _fieldC8(0), _fieldCC(0) { +} + +void CEnterExitView::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_fieldC4, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeNumberLine(_fieldCC, indent); + + CGameObject::save(file, indent); +} + +void CEnterExitView::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _fieldC4 = file->readNumber(); + _fieldC8 = file->readNumber(); + _fieldCC = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/enter_exit_view.h b/engines/titanic/game/enter_exit_view.h new file mode 100644 index 0000000000..05ed63da5c --- /dev/null +++ b/engines/titanic/game/enter_exit_view.h @@ -0,0 +1,58 @@ +/* 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. + * + */ + +#ifndef TITANIC_ENTER_EXIT_VIEW_H +#define TITANIC_ENTER_EXIT_VIEW_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CEnterExitView : public CGameObject { +public: + int _fieldBC; + int _fieldC0; + int _fieldC4; + int _fieldC8; + int _fieldCC; +public: + CEnterExitView(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CEnterExitView"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ENTER_EXIT_VIEW_H */ diff --git a/engines/titanic/game/enter_sec_class_state.cpp b/engines/titanic/game/enter_sec_class_state.cpp new file mode 100644 index 0000000000..2a18e81b6a --- /dev/null +++ b/engines/titanic/game/enter_sec_class_state.cpp @@ -0,0 +1,43 @@ +/* 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 "titanic/game/enter_sec_class_state.h" + +namespace Titanic { + +void CEnterSecClassState::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value1, indent); + file->writeNumberLine(_value2, indent); + + CGameObject::save(file, indent); +} + +void CEnterSecClassState::load(SimpleFile *file) { + file->readNumber(); + _value1 = file->readNumber(); + _value2 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/enter_sec_class_state.h b/engines/titanic/game/enter_sec_class_state.h new file mode 100644 index 0000000000..5da623dc08 --- /dev/null +++ b/engines/titanic/game/enter_sec_class_state.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_ENTER_SEC_CLASS_STATE_H +#define TITANIC_ENTER_SEC_CLASS_STATE_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CEnterSecClassState : public CGameObject { +public: + int _value1, _value2; +public: + CEnterSecClassState() : CGameObject(), _value1(0), _value2(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CEnterSecClassState"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ENTER_SEC_CLASS_STATE_H */ diff --git a/engines/titanic/game/exit_lift.cpp b/engines/titanic/game/exit_lift.cpp new file mode 100644 index 0000000000..82e4411f6f --- /dev/null +++ b/engines/titanic/game/exit_lift.cpp @@ -0,0 +1,43 @@ +/* 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 "titanic/game/exit_lift.h" + +namespace Titanic { + +void CExitLift::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value1, indent); + file->writeNumberLine(_value2, indent); + + CGameObject::save(file, indent); +} + +void CExitLift::load(SimpleFile *file) { + file->readNumber(); + _value1 = file->readNumber(); + _value2 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/exit_lift.h b/engines/titanic/game/exit_lift.h new file mode 100644 index 0000000000..9531fd6528 --- /dev/null +++ b/engines/titanic/game/exit_lift.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_EXIT_LIFT_H +#define TITANIC_EXIT_LIFT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CExitLift : public CGameObject { +public: + int _value1, _value2; +public: + CExitLift() : CGameObject(), _value1(0), _value2(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CExitLift"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_EXIT_LIFT_H */ diff --git a/engines/titanic/game/exit_pellerator.cpp b/engines/titanic/game/exit_pellerator.cpp new file mode 100644 index 0000000000..79754f8567 --- /dev/null +++ b/engines/titanic/game/exit_pellerator.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/exit_pellerator.h" + +namespace Titanic { + +void CExitPellerator::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CExitPellerator::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/exit_pellerator.h b/engines/titanic/game/exit_pellerator.h new file mode 100644 index 0000000000..6185f61e01 --- /dev/null +++ b/engines/titanic/game/exit_pellerator.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_EXIT_PELLERATOR_H +#define TITANIC_EXIT_PELLERATOR_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CExitPellerator : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CExitPellerator"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_EXIT_PELLERATOR_H */ diff --git a/engines/titanic/game/fan.cpp b/engines/titanic/game/fan.cpp new file mode 100644 index 0000000000..4715aa76dd --- /dev/null +++ b/engines/titanic/game/fan.cpp @@ -0,0 +1,43 @@ +/* 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 "titanic/game/fan.h" + +namespace Titanic { + +void CFan::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value1, indent); + file->writeNumberLine(_value2, indent); + + CGameObject::save(file, indent); +} + +void CFan::load(SimpleFile *file) { + file->readNumber(); + _value1 = file->readNumber(); + _value2 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/fan.h b/engines/titanic/game/fan.h new file mode 100644 index 0000000000..75bdea5b6c --- /dev/null +++ b/engines/titanic/game/fan.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_FAN_H +#define TITANIC_FAN_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CFan : public CGameObject { +public: + int _value1, _value2; +public: + CFan() : CGameObject(), _value1(0), _value2(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CFan"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_FAN_H */ diff --git a/engines/titanic/game/fan_control.cpp b/engines/titanic/game/fan_control.cpp new file mode 100644 index 0000000000..44e36b2b6c --- /dev/null +++ b/engines/titanic/game/fan_control.cpp @@ -0,0 +1,53 @@ +/* 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 "titanic/game/fan_control.h" + +namespace Titanic { + +CFanControl::CFanControl() : CGameObject(), _fieldBC(0), + _fieldC0(0), _fieldC4(0), _fieldC8(0), _fieldCC(0) { +} + +void CFanControl::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_fieldC4, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeNumberLine(_fieldCC, indent); + + CGameObject::save(file, indent); +} + +void CFanControl::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _fieldC4 = file->readNumber(); + _fieldC8 = file->readNumber(); + _fieldCC = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/fan_control.h b/engines/titanic/game/fan_control.h new file mode 100644 index 0000000000..dfb1ccc6a4 --- /dev/null +++ b/engines/titanic/game/fan_control.h @@ -0,0 +1,58 @@ +/* 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. + * + */ + +#ifndef TITANIC_FAN_CONTROL_H +#define TITANIC_FAN_CONTROL_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CFanControl : public CGameObject { +public: + int _fieldBC; + int _fieldC0; + int _fieldC4; + int _fieldC8; + int _fieldCC; +public: + CFanControl(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CFanControl"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_FAN_CONTROL_H */ diff --git a/engines/titanic/game/fan_decrease.cpp b/engines/titanic/game/fan_decrease.cpp new file mode 100644 index 0000000000..41e227e98b --- /dev/null +++ b/engines/titanic/game/fan_decrease.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/fan_decrease.h" + +namespace Titanic { + +void CFanDecrease::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CFanDecrease::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/fan_decrease.h b/engines/titanic/game/fan_decrease.h new file mode 100644 index 0000000000..9831873829 --- /dev/null +++ b/engines/titanic/game/fan_decrease.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_FAN_DECREASE_H +#define TITANIC_FAN_DECREASE_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CFanDecrease : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CFanDecrease"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_FAN_DECREASE_H */ diff --git a/engines/titanic/game/fan_increase.cpp b/engines/titanic/game/fan_increase.cpp new file mode 100644 index 0000000000..06fcf474b7 --- /dev/null +++ b/engines/titanic/game/fan_increase.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/fan_increase.h" + +namespace Titanic { + +void CFanIncrease::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CFanIncrease::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/fan_increase.h b/engines/titanic/game/fan_increase.h new file mode 100644 index 0000000000..1b9a0fd191 --- /dev/null +++ b/engines/titanic/game/fan_increase.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_FAN_INCREASE_H +#define TITANIC_FAN_INCREASE_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CFanIncrease : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CFanIncrease"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_FAN_INCREASE_H */ diff --git a/engines/titanic/game/fan_noises.cpp b/engines/titanic/game/fan_noises.cpp new file mode 100644 index 0000000000..ed77dc609f --- /dev/null +++ b/engines/titanic/game/fan_noises.cpp @@ -0,0 +1,58 @@ +/* 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 "titanic/game/fan_noises.h" + +namespace Titanic { + +CFanNoises::CFanNoises() : CGameObject(), _fieldBC(-1), + _fieldC0(0), _fieldC4(70), _fieldC8(-1), _fieldCC(0), + _fieldD0(0), _fieldD4(-1) { +} + +void CFanNoises::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_fieldC4, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeNumberLine(_fieldCC, indent); + file->writeNumberLine(_fieldD0, indent); + file->writeNumberLine(_fieldD4, indent); + + CGameObject::save(file, indent); +} + +void CFanNoises::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _fieldC4 = file->readNumber(); + _fieldC8 = file->readNumber(); + _fieldCC = file->readNumber(); + _fieldD0 = file->readNumber(); + _fieldD4 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/fan_noises.h b/engines/titanic/game/fan_noises.h new file mode 100644 index 0000000000..5e817a3a5b --- /dev/null +++ b/engines/titanic/game/fan_noises.h @@ -0,0 +1,60 @@ +/* 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. + * + */ + +#ifndef TITANIC_FAN_NOISES_H +#define TITANIC_FAN_NOISES_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CFanNoises : public CGameObject { +public: + int _fieldBC; + int _fieldC0; + int _fieldC4; + int _fieldC8; + int _fieldCC; + int _fieldD0; + int _fieldD4; +public: + CFanNoises(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CFanNoises"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_FAN_NOISES_H */ diff --git a/engines/titanic/game/floor_indicator.cpp b/engines/titanic/game/floor_indicator.cpp new file mode 100644 index 0000000000..b17bd4beeb --- /dev/null +++ b/engines/titanic/game/floor_indicator.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/floor_indicator.h" + +namespace Titanic { + +void CFloorIndicator::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CFloorIndicator::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/floor_indicator.h b/engines/titanic/game/floor_indicator.h new file mode 100644 index 0000000000..86a7125aa2 --- /dev/null +++ b/engines/titanic/game/floor_indicator.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_FLOOR_INDICATOR_H +#define TITANIC_FLOOR_INDICATOR_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CFloorIndicator : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CFloorIndicator"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_FLOOR_INDICATOR_H */ diff --git a/engines/titanic/game/get_lift_eye2.cpp b/engines/titanic/game/get_lift_eye2.cpp new file mode 100644 index 0000000000..67a7b43be6 --- /dev/null +++ b/engines/titanic/game/get_lift_eye2.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/get_lift_eye2.h" + +namespace Titanic { + +void CGetLiftEye2::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CGetLiftEye2::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/get_lift_eye2.h b/engines/titanic/game/get_lift_eye2.h new file mode 100644 index 0000000000..baca1204d8 --- /dev/null +++ b/engines/titanic/game/get_lift_eye2.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_GET_LIFT_EYE2_H +#define TITANIC_GET_LIFT_EYE2_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CGetLiftEye2 : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CGetLiftEye2"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_GET_LIFT_EYE2_H */ diff --git a/engines/titanic/game/glass_smasher.cpp b/engines/titanic/game/glass_smasher.cpp new file mode 100644 index 0000000000..80b665d6d8 --- /dev/null +++ b/engines/titanic/game/glass_smasher.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/glass_smasher.h" + +namespace Titanic { + +void CGlassSmasher::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CGlassSmasher::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/glass_smasher.h b/engines/titanic/game/glass_smasher.h new file mode 100644 index 0000000000..c2b7ee6c5b --- /dev/null +++ b/engines/titanic/game/glass_smasher.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_GLASS_SMASHER_H +#define TITANIC_GLASS_SMASHER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CGlassSmasher : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CGlassSmasher"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_GLASS_SMASHER_H */ diff --git a/engines/titanic/game/gondolier_base.cpp b/engines/titanic/game/gondolier_base.cpp new file mode 100644 index 0000000000..32f434e3f2 --- /dev/null +++ b/engines/titanic/game/gondolier_base.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/gondolier_base.h" + +namespace Titanic { + +void CGondolierBase::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CGondolierBase::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/gondolier_base.h b/engines/titanic/game/gondolier_base.h new file mode 100644 index 0000000000..99e0c99572 --- /dev/null +++ b/engines/titanic/game/gondolier_base.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_GONDOLIER_BASE_H +#define TITANIC_GONDOLIER_BASE_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CGondolierBase : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CGondolierBase"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_GONDOLIER_BASE_H */ diff --git a/engines/titanic/game/hammer_clip.cpp b/engines/titanic/game/hammer_clip.cpp new file mode 100644 index 0000000000..60955a21ff --- /dev/null +++ b/engines/titanic/game/hammer_clip.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/hammer_clip.h" + +namespace Titanic { + +void CHammerClip::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CGameObject::save(file, indent); +} + +void CHammerClip::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/hammer_clip.h b/engines/titanic/game/hammer_clip.h new file mode 100644 index 0000000000..70abae5d7e --- /dev/null +++ b/engines/titanic/game/hammer_clip.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_HAMMER_CLIP_H +#define TITANIC_HAMMER_CLIP_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CHammerClip : public CGameObject { +public: + int _value; +public: + CHammerClip() : CGameObject(), _value(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CHammerClip"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_HAMMER_CLIP_H */ diff --git a/engines/titanic/game/head_slot.cpp b/engines/titanic/game/head_slot.cpp new file mode 100644 index 0000000000..c037238e7c --- /dev/null +++ b/engines/titanic/game/head_slot.cpp @@ -0,0 +1,64 @@ +/* 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 "titanic/game/head_slot.h" + +namespace Titanic { + +CHeadSlot::CHeadSlot() : CGameObject(), _string1("NotWorking"), _string2("NULL"), + _fieldBC(0), _fieldD8(0), _fieldDC(27), _fieldE0(56), + _fieldE4(82), _fieldE8(112), _fieldEC(0) { +} + +void CHeadSlot::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + file->writeNumberLine(_fieldD8, indent); + file->writeNumberLine(_fieldDC, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_fieldEC, indent); + + CGameObject::save(file, indent); +} + +void CHeadSlot::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + _fieldD8 = file->readNumber(); + _fieldDC = file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + _v1 = file->readNumber(); + _fieldEC = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/head_slot.h b/engines/titanic/game/head_slot.h new file mode 100644 index 0000000000..210546a2d4 --- /dev/null +++ b/engines/titanic/game/head_slot.h @@ -0,0 +1,64 @@ +/* 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. + * + */ + +#ifndef TITANIC_HEAD_SLOT_H +#define TITANIC_HEAD_SLOT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CHeadSlot : public CGameObject { +public: + static int _v1; +public: + int _fieldBC; + CString _string1; + CString _string2; + int _fieldD8; + int _fieldDC; + int _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; +public: + CHeadSlot(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CHeadSlot"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_HEAD_SLOT_H */ diff --git a/engines/titanic/game/head_spinner.cpp b/engines/titanic/game/head_spinner.cpp new file mode 100644 index 0000000000..a01f4ea1f3 --- /dev/null +++ b/engines/titanic/game/head_spinner.cpp @@ -0,0 +1,43 @@ +/* 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 "titanic/game/head_spinner.h" + +namespace Titanic { + +void CHeadSpinner::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value1, indent); + file->writeNumberLine(_value2, indent); + + CGameObject::save(file, indent); +} + +void CHeadSpinner::load(SimpleFile *file) { + file->readNumber(); + _value1 = file->readNumber(); + _value2 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/head_spinner.h b/engines/titanic/game/head_spinner.h new file mode 100644 index 0000000000..8d3de61f07 --- /dev/null +++ b/engines/titanic/game/head_spinner.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_HEAD_SPINNER_H +#define TITANIC_HEAD_SPINNER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CHeadSpinner : public CGameObject { +public: + int _value1, _value2; +public: + CHeadSpinner() : CGameObject(), _value1(0), _value2(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CHeadSpinner"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_HEAD_SPINNER_H */ diff --git a/engines/titanic/game/idle_summoner.cpp b/engines/titanic/game/idle_summoner.cpp new file mode 100644 index 0000000000..39327266e4 --- /dev/null +++ b/engines/titanic/game/idle_summoner.cpp @@ -0,0 +1,63 @@ +/* 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 "titanic/game/idle_summoner.h" + +namespace Titanic { + +CIdleSummoner::CIdleSummoner() : CGameObject(), _fieldBC(0x57E40), + _fieldC0(0xEA60), _fieldC4(0x57E40), _fieldC8(0xEA60), + _fieldCC(0xEA60), _fieldD0(0xEA60), _fieldD4(0xEA60), + _fieldD8(0xEA60), _fieldDC(0xEA60) { +} + +void CIdleSummoner::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_fieldC4, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeNumberLine(_fieldCC, indent); + file->writeNumberLine(_fieldD0, indent); + file->writeNumberLine(_fieldD4, indent); + file->writeNumberLine(_fieldD8, indent); + file->writeNumberLine(_fieldDC, indent); + + CGameObject::save(file, indent); +} + +void CIdleSummoner::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _fieldC4 = file->readNumber(); + _fieldC8 = file->readNumber(); + _fieldCC = file->readNumber(); + _fieldD0 = file->readNumber(); + _fieldD4 = file->readNumber(); + _fieldD8 = file->readNumber(); + _fieldDC = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/idle_summoner.h b/engines/titanic/game/idle_summoner.h new file mode 100644 index 0000000000..8f251b842b --- /dev/null +++ b/engines/titanic/game/idle_summoner.h @@ -0,0 +1,62 @@ +/* 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. + * + */ + +#ifndef TITANIC_IDLE_SUMMONER_H +#define TITANIC_IDLE_SUMMONER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CIdleSummoner : public CGameObject { +public: + int _fieldBC; + int _fieldC0; + int _fieldC4; + int _fieldC8; + int _fieldCC; + int _fieldD0; + int _fieldD4; + int _fieldD8; + int _fieldDC; +public: + CIdleSummoner(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CIdleSummoner"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_IDLE_SUMMONER_H */ diff --git a/engines/titanic/game/leave_sec_class_state.cpp b/engines/titanic/game/leave_sec_class_state.cpp new file mode 100644 index 0000000000..cbeb872dc8 --- /dev/null +++ b/engines/titanic/game/leave_sec_class_state.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/leave_sec_class_state.h" + +namespace Titanic { + +void CLeaveSecClassState::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CLeaveSecClassState::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/leave_sec_class_state.h b/engines/titanic/game/leave_sec_class_state.h new file mode 100644 index 0000000000..3bcfe812df --- /dev/null +++ b/engines/titanic/game/leave_sec_class_state.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_LEAVE_SEC_CLASS_STATE_H +#define TITANIC_LEAVE_SEC_CLASS_STATE_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CLeaveSecClassState : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CLeaveSecClassState"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_LEAVE_SEC_CLASS_STATE_H */ diff --git a/engines/titanic/game/long_stick_dispenser.cpp b/engines/titanic/game/long_stick_dispenser.cpp new file mode 100644 index 0000000000..bdd6240c70 --- /dev/null +++ b/engines/titanic/game/long_stick_dispenser.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/long_stick_dispenser.h" + +namespace Titanic { + +void CLongStickDispenser::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CLongStickDispenser::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/long_stick_dispenser.h b/engines/titanic/game/long_stick_dispenser.h new file mode 100644 index 0000000000..2e2842025c --- /dev/null +++ b/engines/titanic/game/long_stick_dispenser.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_LONG_STICK_DISPENSER_H +#define TITANIC_LONG_STICK_DISPENSER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CLongStickDispenser : public CGameObject { +public: + int _fieldBC; + int _fieldC0; + int _fieldC4; +public: + CLongStickDispenser() : CGameObject(), _fieldBC(0), + _fieldC0(0), _fieldC4(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CLongStickDispenser"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_LONG_STICK_DISPENSER_H */ diff --git a/engines/titanic/game/mail_man.cpp b/engines/titanic/game/mail_man.cpp new file mode 100644 index 0000000000..9096fc55d1 --- /dev/null +++ b/engines/titanic/game/mail_man.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/mail_man.h" + +namespace Titanic { + +void CMailMan::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CGameObject::save(file, indent); +} + +void CMailMan::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/mail_man.h b/engines/titanic/game/mail_man.h new file mode 100644 index 0000000000..29ca165935 --- /dev/null +++ b/engines/titanic/game/mail_man.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_MAIL_MAN_H +#define TITANIC_MAIL_MAN_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CMailMan : public CGameObject { +public: + int _value; +public: + CMailMan() : CGameObject(), _value(1) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMailMan"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MAIL_MAN_H */ diff --git a/engines/titanic/game/missiveomat.cpp b/engines/titanic/game/missiveomat.cpp new file mode 100644 index 0000000000..fbe430fb13 --- /dev/null +++ b/engines/titanic/game/missiveomat.cpp @@ -0,0 +1,55 @@ +/* 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 "titanic/game/missiveomat.h" + +namespace Titanic { + +CMissiveOMat::CMissiveOMat() : CGameObject(), _fieldBC(1), + _fieldC0(0), _fieldC4(0), _fieldE0(-1) { +} + +void CMissiveOMat::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_fieldC4, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + file->writeNumberLine(_fieldE0, indent); + + CGameObject::save(file, indent); +} + +void CMissiveOMat::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _fieldC4 = file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + _fieldE0 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/missiveomat.h b/engines/titanic/game/missiveomat.h new file mode 100644 index 0000000000..77ba4cb574 --- /dev/null +++ b/engines/titanic/game/missiveomat.h @@ -0,0 +1,59 @@ +/* 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. + * + */ + +#ifndef TITANIC_MISSIVEOMAT_H +#define TITANIC_MISSIVEOMAT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CMissiveOMat : public CGameObject { +public: + int _fieldBC; + int _fieldC0; + int _fieldC4; + CString _string1; + CString _string2; + int _fieldE0; +public: + CMissiveOMat(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMissiveOMat"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MISSIVEOMAT_H */ diff --git a/engines/titanic/game/movie_tester.cpp b/engines/titanic/game/movie_tester.cpp new file mode 100644 index 0000000000..0a4f4a9a9c --- /dev/null +++ b/engines/titanic/game/movie_tester.cpp @@ -0,0 +1,41 @@ +/* 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 "titanic/game/movie_tester.h" + +namespace Titanic { + +void CMovieTester::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value1, indent); + file->writeNumberLine(_value2, indent); + CGameObject::save(file, indent); +} + +void CMovieTester::load(SimpleFile *file) { + file->readNumber(); + _value1 = file->readNumber(); + _value2 = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/movie_tester.h b/engines/titanic/game/movie_tester.h new file mode 100644 index 0000000000..b5e4032be9 --- /dev/null +++ b/engines/titanic/game/movie_tester.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_MOVIE_TESTER_H +#define TITANIC_MOVIE_TESTER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CMovieTester : public CGameObject { +public: + int _value1, _value2; +public: + CMovieTester() : CGameObject(), _value1(0), _value2(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMovieTester"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MOVIE_TESTER_H */ diff --git a/engines/titanic/game/navigation_computer.cpp b/engines/titanic/game/navigation_computer.cpp new file mode 100644 index 0000000000..be2f189083 --- /dev/null +++ b/engines/titanic/game/navigation_computer.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/navigation_computer.h" + +namespace Titanic { + +void CNavigationComputer::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CNavigationComputer::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/navigation_computer.h b/engines/titanic/game/navigation_computer.h new file mode 100644 index 0000000000..49e382a14c --- /dev/null +++ b/engines/titanic/game/navigation_computer.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_NAVIGATION_COMPUTER_H +#define TITANIC_NAVIGATION_COMPUTER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CNavigationComputer : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CNavigationComputer"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_NAVIGATION_COMPUTER_H */ diff --git a/engines/titanic/game/parrot/parrot_lobby_link_updater.cpp b/engines/titanic/game/parrot/parrot_lobby_link_updater.cpp index 912495dbd8..e62e9dde48 100644 --- a/engines/titanic/game/parrot/parrot_lobby_link_updater.cpp +++ b/engines/titanic/game/parrot/parrot_lobby_link_updater.cpp @@ -26,12 +26,12 @@ namespace Titanic { void CParrotLobbyLinkUpdater::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); - CGameObject::save(file, indent); + CParrotLobbyObject::save(file, indent); } void CParrotLobbyLinkUpdater::load(SimpleFile *file) { file->readNumber(); - CGameObject::load(file); + CParrotLobbyObject::load(file); } } // End of namespace Titanic diff --git a/engines/titanic/game/parrot/player_meets_parrot.cpp b/engines/titanic/game/parrot/player_meets_parrot.cpp new file mode 100644 index 0000000000..1d7bd657ac --- /dev/null +++ b/engines/titanic/game/parrot/player_meets_parrot.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/parrot/player_meets_parrot.h" + +namespace Titanic { + +void CPlayerMeetsParrot::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPlayerMeetsParrot::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/parrot/player_meets_parrot.h b/engines/titanic/game/parrot/player_meets_parrot.h new file mode 100644 index 0000000000..685e67a95d --- /dev/null +++ b/engines/titanic/game/parrot/player_meets_parrot.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PLAYER_MEETS_PARROT_H +#define TITANIC_PLAYER_MEETS_PARROT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPlayerMeetsParrot : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPlayerMeetsParrot"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PLAYER_MEETS_PARROT_H */ diff --git a/engines/titanic/game/pet/pet.cpp b/engines/titanic/game/pet/pet.cpp new file mode 100644 index 0000000000..3e65755989 --- /dev/null +++ b/engines/titanic/game/pet/pet.cpp @@ -0,0 +1,57 @@ +/* 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 "titanic/game/pet/pet.h" + +namespace Titanic { + +CPET::CPET() : CGameObject(), _fieldBC(0), _fieldC0(3), + _fieldC4(0), _fieldC8(0), _fieldD8(0), _fieldDC(0) { +} + +void CPET::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_fieldC4, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeQuotedLine(_string1, indent); + file->writeNumberLine(_fieldD8, indent); + file->writeNumberLine(_fieldDC, indent); + + CGameObject::save(file, indent); +} + +void CPET::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _fieldC4 = file->readNumber(); + _fieldC8 = file->readNumber(); + _string1 = file->readString(); + _fieldD8 = file->readNumber(); + _fieldDC = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet.h b/engines/titanic/game/pet/pet.h new file mode 100644 index 0000000000..096c1de9bf --- /dev/null +++ b/engines/titanic/game/pet/pet.h @@ -0,0 +1,60 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_H +#define TITANIC_PET_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPET : public CGameObject { +public: + int _fieldBC; + int _fieldC0; + int _fieldC4; + int _fieldC8; + CString _string1; + int _fieldD8; + int _fieldDC; +public: + CPET(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPET"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_H */ diff --git a/engines/titanic/game/pet/pet_class1.cpp b/engines/titanic/game/pet/pet_class1.cpp new file mode 100644 index 0000000000..4bd25560fb --- /dev/null +++ b/engines/titanic/game/pet/pet_class1.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/pet/pet_class1.h" + +namespace Titanic { + +void CPETClass1::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPETClass1::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_class1.h b/engines/titanic/game/pet/pet_class1.h new file mode 100644 index 0000000000..c390a8732e --- /dev/null +++ b/engines/titanic/game/pet/pet_class1.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CLASS1_H +#define TITANIC_PET_CLASS1_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPETClass1 : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPETClass1"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CLASS1_H */ diff --git a/engines/titanic/game/pet/pet_class2.cpp b/engines/titanic/game/pet/pet_class2.cpp new file mode 100644 index 0000000000..8399468489 --- /dev/null +++ b/engines/titanic/game/pet/pet_class2.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/pet/pet_class2.h" + +namespace Titanic { + +void CPETClass2::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPETClass2::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_class2.h b/engines/titanic/game/pet/pet_class2.h new file mode 100644 index 0000000000..cfa445e6e2 --- /dev/null +++ b/engines/titanic/game/pet/pet_class2.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CLASS2_H +#define TITANIC_PET_CLASS2_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPETClass2 : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPETClass2"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CLASS2_H */ diff --git a/engines/titanic/game/pet/pet_class3.cpp b/engines/titanic/game/pet/pet_class3.cpp new file mode 100644 index 0000000000..96ce66461f --- /dev/null +++ b/engines/titanic/game/pet/pet_class3.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/pet/pet_class3.h" + +namespace Titanic { + +void CPETClass3::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPETClass3::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_class3.h b/engines/titanic/game/pet/pet_class3.h new file mode 100644 index 0000000000..a41a4d53f6 --- /dev/null +++ b/engines/titanic/game/pet/pet_class3.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CLASS3_H +#define TITANIC_PET_CLASS3_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPETClass3 : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPETClass3"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CLASS3_H */ diff --git a/engines/titanic/game/pet/pet_monitor.cpp b/engines/titanic/game/pet/pet_monitor.cpp new file mode 100644 index 0000000000..534fb3fb03 --- /dev/null +++ b/engines/titanic/game/pet/pet_monitor.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/pet/pet_monitor.h" + +namespace Titanic { + +void CPETMonitor::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPETMonitor::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_monitor.h b/engines/titanic/game/pet/pet_monitor.h new file mode 100644 index 0000000000..544bbdea0e --- /dev/null +++ b/engines/titanic/game/pet/pet_monitor.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_MONITOR_H +#define TITANIC_PET_MONITOR_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPETMonitor : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPETMonitor"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_MONITOR_H */ diff --git a/engines/titanic/game/pet/pet_position.cpp b/engines/titanic/game/pet/pet_position.cpp new file mode 100644 index 0000000000..80ccec74cd --- /dev/null +++ b/engines/titanic/game/pet/pet_position.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/pet/pet_position.h" + +namespace Titanic { + +void CPETPosition::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPETPosition::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_position.h b/engines/titanic/game/pet/pet_position.h new file mode 100644 index 0000000000..6454b1e489 --- /dev/null +++ b/engines/titanic/game/pet/pet_position.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_POSITION_H +#define TITANIC_PET_POSITION_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPETPosition : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPETPosition"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_POSITION_H */ diff --git a/engines/titanic/game/pet/pet_sentinal.cpp b/engines/titanic/game/pet/pet_sentinal.cpp new file mode 100644 index 0000000000..4ced872b00 --- /dev/null +++ b/engines/titanic/game/pet/pet_sentinal.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/pet/pet_sentinal.h" + +namespace Titanic { + +void CPETSentinal::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPETSentinal::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_sentinal.h b/engines/titanic/game/pet/pet_sentinal.h new file mode 100644 index 0000000000..98f05dfee6 --- /dev/null +++ b/engines/titanic/game/pet/pet_sentinal.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_SENTINAL_H +#define TITANIC_PET_SENTINAL_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPETSentinal : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPETSentinal"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_SENTINAL_H */ diff --git a/engines/titanic/game/pet/pet_sounds.cpp b/engines/titanic/game/pet/pet_sounds.cpp new file mode 100644 index 0000000000..abf6ba3264 --- /dev/null +++ b/engines/titanic/game/pet/pet_sounds.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/pet/pet_sounds.h" + +namespace Titanic { + +void CPETSounds::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CGameObject::save(file, indent); +} + +void CPETSounds::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_sounds.h b/engines/titanic/game/pet/pet_sounds.h new file mode 100644 index 0000000000..cae45ac89d --- /dev/null +++ b/engines/titanic/game/pet/pet_sounds.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_SOUNDS_H +#define TITANIC_PET_SOUNDS_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPETSounds : public CGameObject { +public: + int _value; +public: + CPETSounds() : CGameObject(), _value(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPETSounds"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_SOUNDS_H */ diff --git a/engines/titanic/game/pet/pet_transition.cpp b/engines/titanic/game/pet/pet_transition.cpp new file mode 100644 index 0000000000..fed2d2c63a --- /dev/null +++ b/engines/titanic/game/pet/pet_transition.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/pet/pet_transition.h" + +namespace Titanic { + +void CPETTransition::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPETTransition::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_transition.h b/engines/titanic/game/pet/pet_transition.h new file mode 100644 index 0000000000..3ccb45fb04 --- /dev/null +++ b/engines/titanic/game/pet/pet_transition.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_TRANSITION_H +#define TITANIC_PET_TRANSITION_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPETTransition : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPETTransition"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_TRANSITION_H */ diff --git a/engines/titanic/game/pet/pet_transport.cpp b/engines/titanic/game/pet/pet_transport.cpp new file mode 100644 index 0000000000..037e0b3278 --- /dev/null +++ b/engines/titanic/game/pet/pet_transport.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/pet/pet_transport.h" + +namespace Titanic { + +void CPETTransport::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPETTransport::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_transport.h b/engines/titanic/game/pet/pet_transport.h new file mode 100644 index 0000000000..af821ef334 --- /dev/null +++ b/engines/titanic/game/pet/pet_transport.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_TRANSPORT_H +#define TITANIC_PET_TRANSPORT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPETTransport : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPETTransport"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_TRANSPORT_H */ diff --git a/engines/titanic/game/pet_disabler.cpp b/engines/titanic/game/pet_disabler.cpp new file mode 100644 index 0000000000..94a4964ed2 --- /dev/null +++ b/engines/titanic/game/pet_disabler.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/pet_disabler.h" + +namespace Titanic { + +void CPetDisabler::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_value, indent); + CGameObject::save(file, indent); +} + +void CPetDisabler::load(SimpleFile *file) { + file->readNumber(); + _value = file->readString(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet_disabler.h b/engines/titanic/game/pet_disabler.h new file mode 100644 index 0000000000..3e8c799bad --- /dev/null +++ b/engines/titanic/game/pet_disabler.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_DISABLER_H +#define TITANIC_PET_DISABLER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPetDisabler : public CGameObject { +public: + CString _value; +public: + CPetDisabler() : CGameObject() {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPetDisabler"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_DISABLER_H */ diff --git a/engines/titanic/game/pet_graphic.cpp b/engines/titanic/game/pet_graphic.cpp new file mode 100644 index 0000000000..38226c9678 --- /dev/null +++ b/engines/titanic/game/pet_graphic.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/pet_graphic.h" + +namespace Titanic { + +void CPetGraphic::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPetGraphic::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet_graphic.h b/engines/titanic/game/pet_graphic.h new file mode 100644 index 0000000000..28b5d9aeca --- /dev/null +++ b/engines/titanic/game/pet_graphic.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_GRAPHIC_H +#define TITANIC_PET_GRAPHIC_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPetGraphic : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPetGraphic"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_GRAPHIC_H */ diff --git a/engines/titanic/game/pet_graphic2.cpp b/engines/titanic/game/pet_graphic2.cpp new file mode 100644 index 0000000000..a8d244e102 --- /dev/null +++ b/engines/titanic/game/pet_graphic2.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/pet_graphic2.h" + +namespace Titanic { + +void CPetGraphic2::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPetGraphic2::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet_graphic2.h b/engines/titanic/game/pet_graphic2.h new file mode 100644 index 0000000000..aabf058cf6 --- /dev/null +++ b/engines/titanic/game/pet_graphic2.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_GRAPHIC2_H +#define TITANIC_PET_GRAPHIC2_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPetGraphic2 : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CNutReplacer"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_GRAPHIC2_H */ diff --git a/engines/titanic/game/pet_position.cpp b/engines/titanic/game/pet_position.cpp deleted file mode 100644 index eb3156da32..0000000000 --- a/engines/titanic/game/pet_position.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 "titanic/game/pet_position.h" - -namespace Titanic { - -void CPETPosition::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - CGameObject::save(file, indent); -} - -void CPETPosition::load(SimpleFile *file) { - file->readNumber(); - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/pet_position.h b/engines/titanic/game/pet_position.h deleted file mode 100644 index 7ca6725059..0000000000 --- a/engines/titanic/game/pet_position.h +++ /dev/null @@ -1,50 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_POSITION_H -#define TITANIC_PET_POSITION_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CPETPosition : public CGameObject { -public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPETPosition"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_ROOM_ITEM_H */ diff --git a/engines/titanic/game/phonograph_lid.cpp b/engines/titanic/game/phonograph_lid.cpp new file mode 100644 index 0000000000..c7c1bd3328 --- /dev/null +++ b/engines/titanic/game/phonograph_lid.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/phonograph_lid.h" + +namespace Titanic { + +void CPhonographLid::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPhonographLid::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/phonograph_lid.h b/engines/titanic/game/phonograph_lid.h new file mode 100644 index 0000000000..040fec447a --- /dev/null +++ b/engines/titanic/game/phonograph_lid.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PHONOGRAPH_LID_H +#define TITANIC_PHONOGRAPH_LID_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPhonographLid : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPhonographLid"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PHONOGRAPH_LID_H */ diff --git a/engines/titanic/game/place_holder.cpp b/engines/titanic/game/place_holder.cpp new file mode 100644 index 0000000000..f0308809fa --- /dev/null +++ b/engines/titanic/game/place_holder.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/place_holder.h" + +namespace Titanic { + +void CPlaceHolder::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPlaceHolder::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/place_holder.h b/engines/titanic/game/place_holder.h new file mode 100644 index 0000000000..dd1c89dd86 --- /dev/null +++ b/engines/titanic/game/place_holder.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PLACE_HOLDER_H +#define TITANIC_PLACE_HOLDER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPlaceHolder : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPlaceHolder"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PLACE_HOLDER_H */ diff --git a/engines/titanic/game/reserved_table.cpp b/engines/titanic/game/reserved_table.cpp new file mode 100644 index 0000000000..222712ac1c --- /dev/null +++ b/engines/titanic/game/reserved_table.cpp @@ -0,0 +1,42 @@ +/* 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 "titanic/game/reserved_table.h" + +namespace Titanic { + +void CReservedTable::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value1, indent); + file->writeNumberLine(_value2, indent); + + CGameObject::save(file, indent); +} + +void CReservedTable::load(SimpleFile *file) { + file->readNumber(); + _value1 = file->readNumber(); + _value2 = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/reserved_table.h b/engines/titanic/game/reserved_table.h new file mode 100644 index 0000000000..abf3a657be --- /dev/null +++ b/engines/titanic/game/reserved_table.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_RESERVED_TABLE_H +#define TITANIC_RESERVED_TABLE_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CReservedTable : public CGameObject { +public: + int _value1, _value2; +public: + CReservedTable() : CGameObject(), _value1(0), _value2(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CReservedTable"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_RESERVED_TABLE_H */ diff --git a/engines/titanic/game/search_point.cpp b/engines/titanic/game/search_point.cpp new file mode 100644 index 0000000000..c235e4765a --- /dev/null +++ b/engines/titanic/game/search_point.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/search_point.h" + +namespace Titanic { + +void CSearchPoint::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CGameObject::save(file, indent); +} + +void CSearchPoint::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/search_point.h b/engines/titanic/game/search_point.h new file mode 100644 index 0000000000..3908d87ee6 --- /dev/null +++ b/engines/titanic/game/search_point.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_SEARCH_POINT_H +#define TITANIC_SEARCH_POINT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CSearchPoint : public CGameObject { +public: + int _value; +public: + CSearchPoint() : CGameObject(), _value(2) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSearchPoint"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SEARCH_POINT_H */ diff --git a/engines/titanic/game/sgt/sgt_doors.cpp b/engines/titanic/game/sgt/sgt_doors.cpp new file mode 100644 index 0000000000..587a961ac1 --- /dev/null +++ b/engines/titanic/game/sgt/sgt_doors.cpp @@ -0,0 +1,43 @@ +/* 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 "titanic/game/sgt/sgt_doors.h" + +namespace Titanic { + +void CSGTDoors::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value1, indent); + file->writeNumberLine(_value2, indent); + + CGameObject::save(file, indent); +} + +void CSGTDoors::load(SimpleFile *file) { + file->readNumber(); + _value1 = file->readNumber(); + _value2 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/sgt_doors.h b/engines/titanic/game/sgt/sgt_doors.h new file mode 100644 index 0000000000..946404936f --- /dev/null +++ b/engines/titanic/game/sgt/sgt_doors.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_SGT_DOORS_H +#define TITANIC_SGT_DOORS_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CSGTDoors : public CGameObject { +public: + int _value1, _value2; +public: + CSGTDoors() : CGameObject(), _value1(0), _value2(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSGTDoors"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SGT_DOORS_H */ diff --git a/engines/titanic/game/sgt/sgt_navigation.cpp b/engines/titanic/game/sgt/sgt_navigation.cpp new file mode 100644 index 0000000000..eba37fd4f3 --- /dev/null +++ b/engines/titanic/game/sgt/sgt_navigation.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/sgt/sgt_navigation.h" + +namespace Titanic { + +void CSGTNavigation::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CSGTNavigation::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/sgt_navigation.h b/engines/titanic/game/sgt/sgt_navigation.h new file mode 100644 index 0000000000..15c903f35c --- /dev/null +++ b/engines/titanic/game/sgt/sgt_navigation.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_SGT_NAVIGATION_H +#define TITANIC_SGT_NAVIGATION_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CSGTNavigation : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSGTNavigation"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SGT_NAVIGATION_H */ diff --git a/engines/titanic/game/sgt/sgt_restaurant_doors.cpp b/engines/titanic/game/sgt/sgt_restaurant_doors.cpp new file mode 100644 index 0000000000..e7d8f7bda1 --- /dev/null +++ b/engines/titanic/game/sgt/sgt_restaurant_doors.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/sgt/sgt_restaurant_doors.h" + +namespace Titanic { + +void CSGTRestaurantDoors::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CSGTRestaurantDoors::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/sgt_restaurant_doors.h b/engines/titanic/game/sgt/sgt_restaurant_doors.h new file mode 100644 index 0000000000..287452e074 --- /dev/null +++ b/engines/titanic/game/sgt/sgt_restaurant_doors.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_SGT_RESTAURANT_DOORS_H +#define TITANIC_SGT_RESTAURANT_DOORS_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CSGTRestaurantDoors : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSGTRestaurantDoors"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SGT_RESTAURANT_DOORS_H */ diff --git a/engines/titanic/game/sgt/sgt_state_room.cpp b/engines/titanic/game/sgt/sgt_state_room.cpp new file mode 100644 index 0000000000..d244309351 --- /dev/null +++ b/engines/titanic/game/sgt/sgt_state_room.cpp @@ -0,0 +1,85 @@ +/* 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 "titanic/game/sgt/sgt_state_room.h" + +namespace Titanic { + +CSGTStateRoomStatics *_statics; + +CSGTStateRoom::CSGTStateRoom() : CBackground(), _fieldE0(1), + _fieldE4(1), _fieldE8(0), _fieldEC(1), _fieldF0(1) { +} + +void CSGTStateRoom::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_statics->_v1, indent); + file->writeQuotedLine(_statics->_v2, indent); + file->writeQuotedLine(_statics->_v3, indent); + file->writeQuotedLine(_statics->_v4, indent); + file->writeQuotedLine(_statics->_v5, indent); + file->writeQuotedLine(_statics->_v6, indent); + file->writeQuotedLine(_statics->_v7, indent); + file->writeQuotedLine(_statics->_v8, indent); + file->writeQuotedLine(_statics->_v9, indent); + file->writeQuotedLine(_statics->_v10, indent); + file->writeQuotedLine(_statics->_v11, indent); + file->writeQuotedLine(_statics->_v12, indent); + + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_statics->_v13, indent); + file->writeNumberLine(_statics->_v14, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_fieldEC, indent); + file->writeNumberLine(_fieldF0, indent); + + CBackground::save(file, indent); +} + +void CSGTStateRoom::load(SimpleFile *file) { + file->readNumber(); + _statics->_v1 = file->readString(); + _statics->_v2 = file->readString(); + _statics->_v3 = file->readString(); + _statics->_v4 = file->readString(); + _statics->_v5 = file->readString(); + _statics->_v6 = file->readString(); + _statics->_v7 = file->readString(); + _statics->_v8 = file->readString(); + _statics->_v9 = file->readString(); + _statics->_v10 = file->readString(); + _statics->_v11 = file->readString(); + _statics->_v12 = file->readString(); + + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _statics->_v13 = file->readNumber(); + _statics->_v14 = file->readNumber(); + _fieldE8 = file->readNumber(); + _fieldEC = file->readNumber(); + _fieldF0 = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/sgt_state_room.h b/engines/titanic/game/sgt/sgt_state_room.h new file mode 100644 index 0000000000..ba70e541a3 --- /dev/null +++ b/engines/titanic/game/sgt/sgt_state_room.h @@ -0,0 +1,77 @@ +/* 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. + * + */ + +#ifndef TITANIC_SGT_STATE_ROOM_H +#define TITANIC_SGT_STATE_ROOM_H + +#include "titanic/core/background.h" + +namespace Titanic { + +struct CSGTStateRoomStatics { + CString _v1; + CString _v2; + CString _v3; + CString _v4; + CString _v5; + CString _v6; + CString _v7; + CString _v8; + CString _v9; + CString _v10; + CString _v11; + CString _v12; + int _v13; + int _v14; +}; + +class CSGTStateRoom : public CBackground { +private: + CSGTStateRoomStatics *_statics; +private: + int _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; + int _fieldF0; +public: + CSGTStateRoom(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSGTStateRoom"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SGT_STATE_ROOM_H */ diff --git a/engines/titanic/game/sgt/sgt_upper_doors_sound.cpp b/engines/titanic/game/sgt/sgt_upper_doors_sound.cpp new file mode 100644 index 0000000000..83a500e022 --- /dev/null +++ b/engines/titanic/game/sgt/sgt_upper_doors_sound.cpp @@ -0,0 +1,45 @@ +/* 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 "titanic/game/sgt/sgt_upper_doors_sound.h" + +namespace Titanic { + +CSGTUpperDoorsSound::CSGTUpperDoorsSound() { + _string2 = "b#53.wav"; +} + +void CSGTUpperDoorsSound::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string2, indent); + + CClickResponder::save(file, indent); +} + +void CSGTUpperDoorsSound::load(SimpleFile *file) { + file->readNumber(); + _string2 = file->readString(); + + CClickResponder::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/sgt_upper_doors_sound.h b/engines/titanic/game/sgt/sgt_upper_doors_sound.h new file mode 100644 index 0000000000..ed97627315 --- /dev/null +++ b/engines/titanic/game/sgt/sgt_upper_doors_sound.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_SGT_UPPER_DOORS_SOUND_H +#define TITANIC_SGT_UPPER_DOORS_SOUND_H + +#include "titanic/core/click_responder.h" + +namespace Titanic { + +class CSGTUpperDoorsSound : public CClickResponder { +public: + CSGTUpperDoorsSound(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSGTUpperDoorsSound"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SGT_UPPER_DOORS_SOUND_H */ diff --git a/engines/titanic/game/sgt_state_room.cpp b/engines/titanic/game/sgt_state_room.cpp deleted file mode 100644 index 10bec50781..0000000000 --- a/engines/titanic/game/sgt_state_room.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* 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 "titanic/game/sgt_state_room.h" - -namespace Titanic { - -CSGTStateRoomStatics *_statics; - -CSGTStateRoom::CSGTStateRoom() : CBackground(), _fieldE0(1), - _fieldE4(1), _fieldE8(0), _fieldEC(1), _fieldF0(1) { -} - -void CSGTStateRoom::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeQuotedLine(_statics->_v1, indent); - file->writeQuotedLine(_statics->_v2, indent); - file->writeQuotedLine(_statics->_v3, indent); - file->writeQuotedLine(_statics->_v4, indent); - file->writeQuotedLine(_statics->_v5, indent); - file->writeQuotedLine(_statics->_v6, indent); - file->writeQuotedLine(_statics->_v7, indent); - file->writeQuotedLine(_statics->_v8, indent); - file->writeQuotedLine(_statics->_v9, indent); - file->writeQuotedLine(_statics->_v10, indent); - file->writeQuotedLine(_statics->_v11, indent); - file->writeQuotedLine(_statics->_v12, indent); - - file->writeNumberLine(_fieldE0, indent); - file->writeNumberLine(_fieldE4, indent); - file->writeNumberLine(_statics->_v13, indent); - file->writeNumberLine(_statics->_v14, indent); - file->writeNumberLine(_fieldE8, indent); - file->writeNumberLine(_fieldEC, indent); - file->writeNumberLine(_fieldF0, indent); - - CBackground::save(file, indent); -} - -void CSGTStateRoom::load(SimpleFile *file) { - file->readNumber(); - _statics->_v1 = file->readString(); - _statics->_v2 = file->readString(); - _statics->_v3 = file->readString(); - _statics->_v4 = file->readString(); - _statics->_v5 = file->readString(); - _statics->_v6 = file->readString(); - _statics->_v7 = file->readString(); - _statics->_v8 = file->readString(); - _statics->_v9 = file->readString(); - _statics->_v10 = file->readString(); - _statics->_v11 = file->readString(); - _statics->_v12 = file->readString(); - - _fieldE0 = file->readNumber(); - _fieldE4 = file->readNumber(); - _statics->_v13 = file->readNumber(); - _statics->_v14 = file->readNumber(); - _fieldE8 = file->readNumber(); - _fieldEC = file->readNumber(); - _fieldF0 = file->readNumber(); - - CBackground::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/sgt_state_room.h b/engines/titanic/game/sgt_state_room.h deleted file mode 100644 index ba70e541a3..0000000000 --- a/engines/titanic/game/sgt_state_room.h +++ /dev/null @@ -1,77 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_SGT_STATE_ROOM_H -#define TITANIC_SGT_STATE_ROOM_H - -#include "titanic/core/background.h" - -namespace Titanic { - -struct CSGTStateRoomStatics { - CString _v1; - CString _v2; - CString _v3; - CString _v4; - CString _v5; - CString _v6; - CString _v7; - CString _v8; - CString _v9; - CString _v10; - CString _v11; - CString _v12; - int _v13; - int _v14; -}; - -class CSGTStateRoom : public CBackground { -private: - CSGTStateRoomStatics *_statics; -private: - int _fieldE0; - int _fieldE4; - int _fieldE8; - int _fieldEC; - int _fieldF0; -public: - CSGTStateRoom(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSGTStateRoom"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_SGT_STATE_ROOM_H */ diff --git a/engines/titanic/game/sgt_upper_doors_sound.cpp b/engines/titanic/game/sgt_upper_doors_sound.cpp deleted file mode 100644 index 23809262e1..0000000000 --- a/engines/titanic/game/sgt_upper_doors_sound.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* 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 "titanic/game/sgt_upper_doors_sound.h" - -namespace Titanic { - -CSGTUpperDoorsSound::CSGTUpperDoorsSound() { - _string2 = "b#53.wav"; -} - -void CSGTUpperDoorsSound::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeQuotedLine(_string2, indent); - - CClickResponder::save(file, indent); -} - -void CSGTUpperDoorsSound::load(SimpleFile *file) { - file->readNumber(); - _string2 = file->readString(); - - CClickResponder::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/sgt_upper_doors_sound.h b/engines/titanic/game/sgt_upper_doors_sound.h deleted file mode 100644 index ed97627315..0000000000 --- a/engines/titanic/game/sgt_upper_doors_sound.h +++ /dev/null @@ -1,52 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_SGT_UPPER_DOORS_SOUND_H -#define TITANIC_SGT_UPPER_DOORS_SOUND_H - -#include "titanic/core/click_responder.h" - -namespace Titanic { - -class CSGTUpperDoorsSound : public CClickResponder { -public: - CSGTUpperDoorsSound(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSGTUpperDoorsSound"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_SGT_UPPER_DOORS_SOUND_H */ diff --git a/engines/titanic/game/ship_setting_button.cpp b/engines/titanic/game/ship_setting_button.cpp new file mode 100644 index 0000000000..c1318b1bc4 --- /dev/null +++ b/engines/titanic/game/ship_setting_button.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/ship_setting_button.h" + +namespace Titanic { + +void CShipSettingButton::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CShipSettingButton::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/ship_setting_button.h b/engines/titanic/game/ship_setting_button.h new file mode 100644 index 0000000000..008ab783df --- /dev/null +++ b/engines/titanic/game/ship_setting_button.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_SHIP_SETTING_BUTTON_H +#define TITANIC_SHIP_SETTING_BUTTON_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CShipSettingButton : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CShipSettingButton"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SHIP_SETTING_BUTTON_H */ diff --git a/engines/titanic/game/show_cell_points.cpp b/engines/titanic/game/show_cell_points.cpp new file mode 100644 index 0000000000..e23d588b76 --- /dev/null +++ b/engines/titanic/game/show_cell_points.cpp @@ -0,0 +1,41 @@ +/* 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 "titanic/game/show_cell_points.h" + +namespace Titanic { + +void CShowCellpoints::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_strValue, indent); + file->writeNumberLine(_numValue, indent); + CGameObject::save(file, indent); +} + +void CShowCellpoints::load(SimpleFile *file) { + file->readNumber(); + _strValue = file->readString(); + _numValue = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/show_cell_points.h b/engines/titanic/game/show_cell_points.h new file mode 100644 index 0000000000..c807cd5ed6 --- /dev/null +++ b/engines/titanic/game/show_cell_points.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef SHOW_CELL_POINTS_H +#define SHOW_CELL_POINTS_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CShowCellpoints : public CGameObject { +public: + CString _strValue; + int _numValue; +public: + CShowCellpoints() : CGameObject(), _numValue(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CShowCellpoints"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* SHOW_CELL_POINTS_H */ diff --git a/engines/titanic/game/splash_animation.cpp b/engines/titanic/game/splash_animation.cpp new file mode 100644 index 0000000000..16cf067629 --- /dev/null +++ b/engines/titanic/game/splash_animation.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/splash_animation.h" + +namespace Titanic { + +void CSplashAnimation::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CSplashAnimation::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/splash_animation.h b/engines/titanic/game/splash_animation.h new file mode 100644 index 0000000000..8ac59d9d1c --- /dev/null +++ b/engines/titanic/game/splash_animation.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_SPLASH_ANIMATION_H +#define TITANIC_SPLASH_ANIMATION_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CSplashAnimation : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSplashAnimation"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SPLASH_ANIMATION_H */ diff --git a/engines/titanic/game/star_control.cpp b/engines/titanic/game/star_control.cpp new file mode 100644 index 0000000000..0996a0fc21 --- /dev/null +++ b/engines/titanic/game/star_control.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/star_control.h" + +namespace Titanic { + +void CStarControl::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CStarControl::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/star_control.h b/engines/titanic/game/star_control.h new file mode 100644 index 0000000000..c76e9be382 --- /dev/null +++ b/engines/titanic/game/star_control.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_CONTROL_H +#define TITANIC_STAR_CONTROL_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CStarControl : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CStarControl"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_H */ diff --git a/engines/titanic/game/starling_puret.cpp b/engines/titanic/game/starling_puret.cpp new file mode 100644 index 0000000000..026128b53a --- /dev/null +++ b/engines/titanic/game/starling_puret.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/starling_puret.h" + +namespace Titanic { + +void CStarlingPuret::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CStarlingPuret::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/starling_puret.h b/engines/titanic/game/starling_puret.h new file mode 100644 index 0000000000..5c53a53b47 --- /dev/null +++ b/engines/titanic/game/starling_puret.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_STARLING_PURET_H +#define TITANIC_STARLING_PURET_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CStarlingPuret : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CStarlingPuret"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STARLING_PURET_H */ diff --git a/engines/titanic/game/sub_wrapper.cpp b/engines/titanic/game/sub_wrapper.cpp new file mode 100644 index 0000000000..be6b3e275f --- /dev/null +++ b/engines/titanic/game/sub_wrapper.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/sub_wrapper.h" + +namespace Titanic { + +void CSUBWrapper::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CGameObject::save(file, indent); +} + +void CSUBWrapper::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sub_wrapper.h b/engines/titanic/game/sub_wrapper.h new file mode 100644 index 0000000000..b67d4e506f --- /dev/null +++ b/engines/titanic/game/sub_wrapper.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_SUB_WRAPPER_H +#define TITANIC_SUB_WRAPPER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CSUBWrapper : public CGameObject { +public: + int _value; +public: + CSUBWrapper() : CGameObject(), _value(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSUBWrapper"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SUB_WRAPPER_H */ diff --git a/engines/titanic/game/throw_tv_down_well.cpp b/engines/titanic/game/throw_tv_down_well.cpp new file mode 100644 index 0000000000..d77d7760c5 --- /dev/null +++ b/engines/titanic/game/throw_tv_down_well.cpp @@ -0,0 +1,41 @@ +/* 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 "titanic/game/throw_tv_down_well.h" + +namespace Titanic { + +void CThrowTVDownWell::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_strValue, indent); + file->writeNumberLine(_numValue, indent); + CGameObject::save(file, indent); +} + +void CThrowTVDownWell::load(SimpleFile *file) { + file->readNumber(); + _strValue = file->readString(); + _numValue = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/throw_tv_down_well.h b/engines/titanic/game/throw_tv_down_well.h new file mode 100644 index 0000000000..0f8f731be3 --- /dev/null +++ b/engines/titanic/game/throw_tv_down_well.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_THROW_TV_DOWN_WELL_H +#define TITANIC_THROW_TV_DOWN_WELL_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CThrowTVDownWell : public CGameObject { +public: + CString _strValue; + int _numValue; +public: + CThrowTVDownWell() : CGameObject(), _numValue(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CThrowTVDownWell"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_THROW_TV_DOWN_WELL_H */ diff --git a/engines/titanic/game/titania_still_control.cpp b/engines/titanic/game/titania_still_control.cpp new file mode 100644 index 0000000000..96c003defe --- /dev/null +++ b/engines/titanic/game/titania_still_control.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/titania_still_control.h" + +namespace Titanic { + +void CTitaniaStillControl::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CTitaniaStillControl::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/titania_still_control.h b/engines/titanic/game/titania_still_control.h new file mode 100644 index 0000000000..141f0c5cf9 --- /dev/null +++ b/engines/titanic/game/titania_still_control.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_TITANIA_STILL_CONTROL_H +#define TITANIC_TITANIA_STILL_CONTROL_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CTitaniaStillControl : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CTitaniaStillControl"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TITANIA_STILL_CONTROL_H */ diff --git a/engines/titanic/game/tow_parrot_nav.cpp b/engines/titanic/game/tow_parrot_nav.cpp new file mode 100644 index 0000000000..d476681ad4 --- /dev/null +++ b/engines/titanic/game/tow_parrot_nav.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/tow_parrot_nav.h" + +namespace Titanic { + +void CTOWParrotNav::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CTOWParrotNav::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/tow_parrot_nav.h b/engines/titanic/game/tow_parrot_nav.h new file mode 100644 index 0000000000..6233728198 --- /dev/null +++ b/engines/titanic/game/tow_parrot_nav.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_TOW_PARROT_NAV_H +#define TITANIC_TOW_PARROT_NAV_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CTOWParrotNav : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CTOWParrotNav"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TOW_PARROT_NAV_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 111fd25de2..97fe788719 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -45,6 +45,7 @@ MODULE_OBJS := \ carry/photograph.o \ carry/plug_in.o \ carry/sweets.o \ + carry/test_carry.o \ core/background.o \ core/click_responder.o \ core/dont_save_file_item.o \ @@ -62,42 +63,102 @@ MODULE_OBJS := \ core/project_item.o \ core/resource_key.o \ core/saveable_object.o \ + core/static_image.o \ core/turn_on_object.o \ core/turn_on_play_sound.o \ core/tree_item.o \ core/view_item.o \ game/announce.o \ + game/annoy_barbot.o \ + game/bar_menu.o \ + game/bar_menu_button.o \ + game/bar_bell.o \ + game/belbot_get_light.o \ + game/bottom_of_well_monitor.o \ game/bowl_unlocker.o \ + game/brain_slot.o \ + game/bridge_door.o \ + game/call_pellerator.o \ game/cdrom.o \ game/cdrom_computer.o \ game/cdrom_tray.o \ + game/chev_code.o \ + game/chev_panel.o \ + game/chicken_cooler.o \ + game/cookie.o \ game/computer_screen.o \ game/credits.o \ game/credits_button.o \ game/dead_area.o \ game/desk_click_responder.o \ + game/doorbot_elevator_handler.o \ game/doorbot_home_handler.o \ game/drawer.o \ game/ear_sweet_bowl.o \ + game/elevator_action_area.o \ game/empty_nut_bowl.o \ + game/end_credit_text.o \ + game/end_credits.o \ + game/end_explode_ship.o \ + game/end_game_cerdits.o \ + game/end_sequence_control.o \ + game/enter_bridge.o \ game/enter_exit_first_class_state.o \ + game/enter_exit_sec_class_mini_lift.o \ + game/enter_exit_view.o \ + game/enter_sec_class_state.o \ game/hammer_dispensor_button.o \ + game/exit_lift.o \ + game/exit_pellerator.o \ + game/fan.o \ + game/fan_control.o \ + game/fan_decrease.o \ + game/fan_increase.o \ + game/fan_noises.o \ + game/floor_indicator.o \ + game/get_lift_eye2.o \ + game/glass_smasher.o \ + game/gondolier_base.o \ + game/hammer_clip.o \ + game/head_slot.o \ + game/head_spinner.o \ + game/idle_summoner.o \ + game/leave_sec_class_state.o \ game/light.o \ game/light_switch.o \ game/little_lift_button.o \ + game/long_stick_dispenser.o \ + game/mail_man.o \ + game/missiveomat.o \ + game/movie_tester.o \ + game/navigation_computer.o \ game/no_nut_bowl.o \ - game/pet_position.o \ - game/port_hole.o \ game/null_port_hole.o \ game/nut_replacer.o \ + game/pet_controler.o \ + game/pet_disabler.o \ + game/pet_graphic2.o \ + game/pet_graphic.o \ + game/phonograph_lid.o \ + game/place_holder.o \ + game/port_hole.o \ + game/reserved_table.o \ game/room_item.o \ + game/search_point.o \ game/service_elevator_door.o \ - game/sgt_state_room.o \ - game/sgt_upper_doors_sound.o \ + game/ship_setting_button.o \ + game/show_cell_points.o \ + game/splash_animation.o \ + game/star_control.o \ + game/starling_puret.o \ game/start_action.o \ game/sub_glass.o \ + game/sub_wrapper.o \ game/sweet_bowl.o \ game/television.o \ + game/tow_parrot_nav.o \ + game/throw_tv_down_well.o \ + game/titania_still_control.o \ game/parrot/parrot_lobby_controller.o \ game/parrot/parrot_lobby_link_updater.o \ game/parrot/parrot_lobby_object.o \ @@ -108,6 +169,22 @@ MODULE_OBJS := \ game/parrot/parrot_perch_holder.o \ game/parrot/parrot_succubus.o \ game/parrot/parrot_trigger.o \ + game/parrot/player_meets_parrot.o \ + game/pet/pet.o \ + game/pet/pet_class1.o \ + game/pet/pet_class2.o \ + game/pet/pet_class3.o \ + game/pet/pet_monitor.o \ + game/pet/pet_position.o \ + game/pet/pet_sentinal.o \ + game/pet/pet_sounds.o \ + game/pet/pet_transition.o \ + game/pet/pet_transport.o \ + game/sgt/sgt_doors.o \ + game/sgt/sgt_navigation.o \ + game/sgt/sgt_restaurant_doors.o \ + game/sgt/sgt_state_room.o \ + game/sgt/sgt_upper_doors_sound.o \ gfx/act_button.o \ gfx/changes_season_button.o \ gfx/chev_left_off.o \ @@ -173,7 +250,12 @@ MODULE_OBJS := \ npcs/true_talk_npc.o \ sound/auto_music_player.o \ sound/auto_music_player_base.o \ - sound/seasonal_music_player.o + sound/auto_sound_player.o \ + sound/background_sound_maker.o \ + sound/music_player.o \ + sound/seasonal_music_player.o \ + sound/titania_speech.o \ + sound/trigger_auto_music_player.o # This module can be built as a plugin ifeq ($(ENABLE_TITANIC), DYNAMIC_PLUGIN) diff --git a/engines/titanic/sound/auto_sound_player.cpp b/engines/titanic/sound/auto_sound_player.cpp new file mode 100644 index 0000000000..619c36298e --- /dev/null +++ b/engines/titanic/sound/auto_sound_player.cpp @@ -0,0 +1,42 @@ +/* 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 "titanic/sound/auto_sound_player.h" + +namespace Titanic { + +CAutoSoundPlayer::CAutoSoundPlayer() : CGameObject(), + _fieldC8(0), _fieldCC(70), _fieldD0(0), _fieldD4(0), _fieldD8(-1), + _fieldDC(0), _fieldE0(-1), _fieldE4(0), _fieldE8(0) { +} + +void CAutoSoundPlayer::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CAutoSoundPlayer::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/sound/auto_sound_player.h b/engines/titanic/sound/auto_sound_player.h new file mode 100644 index 0000000000..07ac0acd2e --- /dev/null +++ b/engines/titanic/sound/auto_sound_player.h @@ -0,0 +1,63 @@ +/* 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. + * + */ + +#ifndef TITANIC_AUTO_SOUND_PLAYER_H +#define TITANIC_AUTO_SOUND_PLAYER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CAutoSoundPlayer : public CGameObject { +public: + CString _string1; + int _fieldC8; + int _fieldCC; + int _fieldD0; + int _fieldD4; + int _fieldD8; + int _fieldDC; + int _fieldE0; + int _fieldE4; + int _fieldE8; +public: + CAutoSoundPlayer(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CAutoSoundPlayer"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_AUTO_SOUND_PLAYER_H */ diff --git a/engines/titanic/sound/background_sound_maker.cpp b/engines/titanic/sound/background_sound_maker.cpp new file mode 100644 index 0000000000..111e641054 --- /dev/null +++ b/engines/titanic/sound/background_sound_maker.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/sound/background_sound_maker.h" + +namespace Titanic { + +void CBackgroundSoundMaker::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CGameObject::save(file, indent); +} + +void CBackgroundSoundMaker::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/sound/background_sound_maker.h b/engines/titanic/sound/background_sound_maker.h new file mode 100644 index 0000000000..5a234ae048 --- /dev/null +++ b/engines/titanic/sound/background_sound_maker.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_BACKGROUND_SOUND_MAKER_H +#define TITANIC_BACKGROUND_SOUND_MAKER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CBackgroundSoundMaker : public CGameObject { +public: + int _value; +public: + CBackgroundSoundMaker() : CGameObject(), _value(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBackgroundSoundMaker"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BACKGROUND_SOUND_MAKER_H */ diff --git a/engines/titanic/sound/music_player.cpp b/engines/titanic/sound/music_player.cpp new file mode 100644 index 0000000000..39e97ed10e --- /dev/null +++ b/engines/titanic/sound/music_player.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/sound/music_player.h" + +namespace Titanic { + +void CMusicPlayer::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CMusicPlayer::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/sound/music_player.h b/engines/titanic/sound/music_player.h new file mode 100644 index 0000000000..19539c89f7 --- /dev/null +++ b/engines/titanic/sound/music_player.h @@ -0,0 +1,58 @@ +/* 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. + * + */ + +#ifndef TITANIC_MUSIC_PLAYER_H +#define TITANIC_MUSIC_PLAYER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CMusicPlayer : public CGameObject { +public: + int _fieldBC; + CString _string1; + int _fieldCC; + int _fieldD0; +public: + CMusicPlayer() : CGameObject(), + _fieldBC(0), _fieldCC(0), _fieldD0(100) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMusicPlayer"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MUSIC_PLAYER_H */ diff --git a/engines/titanic/sound/titania_speech.cpp b/engines/titanic/sound/titania_speech.cpp new file mode 100644 index 0000000000..fac166901f --- /dev/null +++ b/engines/titanic/sound/titania_speech.cpp @@ -0,0 +1,43 @@ +/* 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 "titanic/sound/titania_speech.h" + +namespace Titanic { + +void CTitaniaSpeech::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value1, indent); + file->writeNumberLine(_value2, indent); + + CGameObject::save(file, indent); +} + +void CTitaniaSpeech::load(SimpleFile *file) { + file->readNumber(); + _value1 = file->readNumber(); + _value2 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/sound/titania_speech.h b/engines/titanic/sound/titania_speech.h new file mode 100644 index 0000000000..a81544a903 --- /dev/null +++ b/engines/titanic/sound/titania_speech.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_TITANIA_SPEECH_H +#define TITANIC_TITANIA_SPEECH_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CTitaniaSpeech : public CGameObject { +public: + int _value1, _value2; +public: + CTitaniaSpeech() : CGameObject(), _value1(1), _value2(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CTitaniaSpeech"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TITANIA_SPEECH_H */ diff --git a/engines/titanic/sound/trigger_auto_music_player.cpp b/engines/titanic/sound/trigger_auto_music_player.cpp new file mode 100644 index 0000000000..adcc18c591 --- /dev/null +++ b/engines/titanic/sound/trigger_auto_music_player.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/sound/trigger_auto_music_player.h" + +namespace Titanic { + +void CTriggerAutoMusicPlayer::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CTriggerAutoMusicPlayer::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/sound/trigger_auto_music_player.h b/engines/titanic/sound/trigger_auto_music_player.h new file mode 100644 index 0000000000..9cc71ee0f0 --- /dev/null +++ b/engines/titanic/sound/trigger_auto_music_player.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_AUTO_MUSIC_PLAYER_H +#define TITANIC_AUTO_MUSIC_PLAYER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CTriggerAutoMusicPlayer : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CTriggerAutoMusicPlayer"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_AUTO_MUSIC_PLAYER_H */ -- cgit v1.2.3 From 95ebd2394bd4bd84f7894a94baf9fa1423345fad Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 28 Feb 2016 22:16:02 -0500 Subject: TITANIC: Loading bugfixes and implemented CBrain descendents --- engines/titanic/carry/auditory_centre.cpp | 37 ++++++++++++++ engines/titanic/carry/auditory_centre.h | 50 +++++++++++++++++++ engines/titanic/carry/brain.cpp | 7 ++- engines/titanic/carry/brain.h | 3 +- engines/titanic/carry/central_core.cpp | 37 ++++++++++++++ engines/titanic/carry/central_core.h | 50 +++++++++++++++++++ engines/titanic/carry/speech_centre.cpp | 45 +++++++++++++++++ engines/titanic/carry/speech_centre.h | 57 ++++++++++++++++++++++ engines/titanic/carry/vision_centre.cpp | 37 ++++++++++++++ engines/titanic/carry/vision_centre.h | 50 +++++++++++++++++++ engines/titanic/core/saveable_object.cpp | 15 ++++++ engines/titanic/module.mk | 6 ++- .../titanic/moves/move_player_in_parrot_room.cpp | 4 +- 13 files changed, 389 insertions(+), 9 deletions(-) create mode 100644 engines/titanic/carry/auditory_centre.cpp create mode 100644 engines/titanic/carry/auditory_centre.h create mode 100644 engines/titanic/carry/central_core.cpp create mode 100644 engines/titanic/carry/central_core.h create mode 100644 engines/titanic/carry/speech_centre.cpp create mode 100644 engines/titanic/carry/speech_centre.h create mode 100644 engines/titanic/carry/vision_centre.cpp create mode 100644 engines/titanic/carry/vision_centre.h diff --git a/engines/titanic/carry/auditory_centre.cpp b/engines/titanic/carry/auditory_centre.cpp new file mode 100644 index 0000000000..e5dedcd654 --- /dev/null +++ b/engines/titanic/carry/auditory_centre.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/carry/auditory_centre.h" + +namespace Titanic { + +void CAuditoryCentre::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CBrain::save(file, indent); +} + +void CAuditoryCentre::load(SimpleFile *file) { + file->readNumber(); + CBrain::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/auditory_centre.h b/engines/titanic/carry/auditory_centre.h new file mode 100644 index 0000000000..9708b6fbfa --- /dev/null +++ b/engines/titanic/carry/auditory_centre.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_AUDITORY_CENTRE_H +#define TITANIC_AUDITORY_CENTRE_H + +#include "titanic/carry/brain.h" + +namespace Titanic { + +class CAuditoryCentre : public CBrain { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CAuditoryCentre"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_AUDITORY_CENTRE_H */ diff --git a/engines/titanic/carry/brain.cpp b/engines/titanic/carry/brain.cpp index f37549c94c..0d1cdf7518 100644 --- a/engines/titanic/carry/brain.cpp +++ b/engines/titanic/carry/brain.cpp @@ -24,13 +24,12 @@ namespace Titanic { -CBrain::CBrain() : CCarry(), _field12C(0), - _field130(0), _field134(0), _field138(0) { +CBrain::CBrain() : CCarry(), _field134(0), _field138(0) { } void CBrain::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); - file->writeNumberLine(_field12C, indent); + file->writePoint(_pos1, indent); file->writeNumberLine(_field134, indent); file->writeNumberLine(_field138, indent); @@ -39,7 +38,7 @@ void CBrain::save(SimpleFile *file, int indent) const { void CBrain::load(SimpleFile *file) { file->readNumber(); - _field12C = file->readNumber(); + _pos1 = file->readPoint(); _field134 = file->readNumber(); _field138 = file->readNumber(); diff --git a/engines/titanic/carry/brain.h b/engines/titanic/carry/brain.h index 903723050c..b5ec70e836 100644 --- a/engines/titanic/carry/brain.h +++ b/engines/titanic/carry/brain.h @@ -29,8 +29,7 @@ namespace Titanic { class CBrain : public CCarry { private: - int _field12C; - int _field130; + Common::Point _pos1; int _field134; int _field138; public: diff --git a/engines/titanic/carry/central_core.cpp b/engines/titanic/carry/central_core.cpp new file mode 100644 index 0000000000..97309e0a86 --- /dev/null +++ b/engines/titanic/carry/central_core.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/carry/central_core.h" + +namespace Titanic { + +void CCentralCore::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CBrain::save(file, indent); +} + +void CCentralCore::load(SimpleFile *file) { + file->readNumber(); + CBrain::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/central_core.h b/engines/titanic/carry/central_core.h new file mode 100644 index 0000000000..277b302e5b --- /dev/null +++ b/engines/titanic/carry/central_core.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_CENTRAL_CORE_H +#define TITANIC_CENTRAL_CORE_H + +#include "titanic/carry/brain.h" + +namespace Titanic { + +class CCentralCore : public CBrain { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CCentralCore"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CENTRAL_CORE_H */ diff --git a/engines/titanic/carry/speech_centre.cpp b/engines/titanic/carry/speech_centre.cpp new file mode 100644 index 0000000000..c5875bd22c --- /dev/null +++ b/engines/titanic/carry/speech_centre.cpp @@ -0,0 +1,45 @@ +/* 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 "titanic/carry/speech_centre.h" + +namespace Titanic { + +void CSpeechCentre::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field13C, indent); + file->writeQuotedLine(_string1, indent); + file->writeNumberLine(_field14C, indent); + + CCarry::save(file, indent); +} + +void CSpeechCentre::load(SimpleFile *file) { + file->readNumber(); + _field13C = file->readNumber(); + _string1 = file->readString(); + _field14C = file->readNumber(); + + CCarry::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/speech_centre.h b/engines/titanic/carry/speech_centre.h new file mode 100644 index 0000000000..4b5ced53a0 --- /dev/null +++ b/engines/titanic/carry/speech_centre.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_SPEECH_CENTRE_H +#define TITANIC_SPEECH_CENTRE_H + +#include "titanic/carry/brain.h" + +namespace Titanic { + +class CSpeechCentre : public CBrain { +private: + int _field13C; + CString _string1; + int _field14C; +public: + CSpeechCentre() : CBrain(), _string1("Summer"), + _field13C(1), _field14C(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSpeechCentre"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SPEECH_CENTRE_H */ diff --git a/engines/titanic/carry/vision_centre.cpp b/engines/titanic/carry/vision_centre.cpp new file mode 100644 index 0000000000..b85f99fbf1 --- /dev/null +++ b/engines/titanic/carry/vision_centre.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/carry/vision_centre.h" + +namespace Titanic { + +void CVisionCentre::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CBrain::save(file, indent); +} + +void CVisionCentre::load(SimpleFile *file) { + file->readNumber(); + CBrain::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/vision_centre.h b/engines/titanic/carry/vision_centre.h new file mode 100644 index 0000000000..ce21fe547c --- /dev/null +++ b/engines/titanic/carry/vision_centre.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_VISION_CENTRE_H +#define TITANIC_VISION_CENTRE_H + +#include "titanic/carry/brain.h" + +namespace Titanic { + +class CVisionCentre : public CBrain { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CVisionCentre"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_VISION_CENTRE_H */ diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index f76340c83b..f36b7acc62 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -21,11 +21,13 @@ */ #include "titanic/carry/arm.h" +#include "titanic/carry/auditory_centre.h" #include "titanic/carry/bowl_ear.h" #include "titanic/carry/brain.h" #include "titanic/carry/bridge_piece.h" #include "titanic/carry/carry.h" #include "titanic/carry/carry_parrot.h" +#include "titanic/carry/central_core.h" #include "titanic/carry/chicken.h" #include "titanic/carry/crushed_tv.h" #include "titanic/carry/eye.h" @@ -48,7 +50,9 @@ #include "titanic/carry/phonograph_ear.h" #include "titanic/carry/photograph.h" #include "titanic/carry/plug_in.h" +#include "titanic/carry/speech_centre.h" #include "titanic/carry/sweets.h" +#include "titanic/carry/vision_centre.h" #include "titanic/core/saveable_object.h" #include "titanic/core/background.h" @@ -75,6 +79,7 @@ #include "titanic/game/cdrom_computer.h" #include "titanic/game/cdrom_tray.h" #include "titanic/game/computer_screen.h" +#include "titanic/game/cookie.h" #include "titanic/game/credits.h" #include "titanic/game/credits_button.h" #include "titanic/game/dead_area.h" @@ -198,10 +203,12 @@ Common::HashMap * #define ADDFN(T) (*_classList)[#T] = Function##T DEFFN(CArm); +DEFFN(CAuditoryCentre); DEFFN(CBowlEar); DEFFN(CBrain); DEFFN(CBridgePiece); DEFFN(CCarryParrot); +DEFFN(CCentralCore); DEFFN(CChicken); DEFFN(CCrushedTV); DEFFN(CEar); @@ -223,7 +230,9 @@ DEFFN(CPhonographCylinder); DEFFN(CPhonographEar); DEFFN(CPhotograph); DEFFN(CPlugIn); +DEFFN(CSpeechCentre); DEFFN(CSweets); +DEFFN(CVisionCentre); DEFFN(CBackground); DEFFN(CClickResponder); @@ -248,6 +257,7 @@ DEFFN(CBowlUnlocker); DEFFN(CCDROM); DEFFN(CCDROMComputer); DEFFN(CCDROMTray); +DEFFN(CCookie); DEFFN(CComputerScreen); DEFFN(CCredits); DEFFN(CCreditsButton); @@ -535,10 +545,12 @@ DEFFN(CAutoMusicPlayer); void CSaveableObject::initClassList() { _classList = new Common::HashMap(); ADDFN(CArm); + ADDFN(CAuditoryCentre); ADDFN(CBowlEar); ADDFN(CBrain); ADDFN(CBridgePiece); ADDFN(CCarryParrot); + ADDFN(CCentralCore); ADDFN(CChicken); ADDFN(CCrushedTV); ADDFN(CEar); @@ -560,7 +572,9 @@ void CSaveableObject::initClassList() { ADDFN(CPhonographEar); ADDFN(CPhotograph); ADDFN(CPlugIn); + ADDFN(CSpeechCentre); ADDFN(CSweets); + ADDFN(CVisionCentre); ADDFN(CBackground); ADDFN(CClickResponder); @@ -586,6 +600,7 @@ void CSaveableObject::initClassList() { ADDFN(CCDROMComputer); ADDFN(CCDROMTray); ADDFN(CComputerScreen); + ADDFN(CCookie); ADDFN(CCredits); ADDFN(CCreditsButton); ADDFN(CDeadArea); diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 97fe788719..a5a5db4874 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -15,12 +15,14 @@ MODULE_OBJS := \ string.o \ titanic.o \ video_surface.o \ + carry/auditory_centre.o \ carry/arm.o \ carry/bowl_ear.o \ carry/brain.o \ carry/bridge_piece.o \ carry/carry.o \ - carry/carry_parrot.oo \ + carry/carry_parrot.o \ + carry/central_core.o \ carry/chicken.o \ carry/crushed_tv.o \ carry/ear.o \ @@ -44,8 +46,10 @@ MODULE_OBJS := \ carry/phonograph_ear.o \ carry/photograph.o \ carry/plug_in.o \ + carry/speech_centre.o \ carry/sweets.o \ carry/test_carry.o \ + carry/vision_centre.o \ core/background.o \ core/click_responder.o \ core/dont_save_file_item.o \ diff --git a/engines/titanic/moves/move_player_in_parrot_room.cpp b/engines/titanic/moves/move_player_in_parrot_room.cpp index cfe4cb689f..91c1706abf 100644 --- a/engines/titanic/moves/move_player_in_parrot_room.cpp +++ b/engines/titanic/moves/move_player_in_parrot_room.cpp @@ -29,12 +29,12 @@ CMovePlayerInParrotRoom::CMovePlayerInParrotRoom() : CMovePlayerTo() { void CMovePlayerInParrotRoom::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); - CGameObject::save(file, indent); + CMovePlayerTo::save(file, indent); } void CMovePlayerInParrotRoom::load(SimpleFile *file) { file->readNumber(); - CGameObject::load(file); + CMovePlayerTo::load(file); } } // End of namespace Titanic -- cgit v1.2.3 From a89dd72f2007b00304d0cc01ac4b6dc08ed6625e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 29 Feb 2016 21:20:33 -0500 Subject: TITANIC: Implemented lots of CBackground descendent classes --- engines/titanic/core/saveable_object.cpp | 154 +++++++++++++++++++++- engines/titanic/game/arb_background.cpp | 51 +++++++ engines/titanic/game/arb_background.h | 57 ++++++++ engines/titanic/game/arboretum_gate.cpp | 136 +++++++++++++++++++ engines/titanic/game/arboretum_gate.h | 87 ++++++++++++ engines/titanic/game/auto_animate.cpp | 43 ++++++ engines/titanic/game/auto_animate.h | 55 ++++++++ engines/titanic/game/bomb.cpp | 72 ++++++++++ engines/titanic/game/bomb.h | 63 +++++++++ engines/titanic/game/bridge_view.cpp | 39 ++++++ engines/titanic/game/bridge_view.h | 54 ++++++++ engines/titanic/game/broken_pell_base.cpp | 39 ++++++ engines/titanic/game/broken_pell_base.h | 54 ++++++++ engines/titanic/game/cage.cpp | 46 +++++++ engines/titanic/game/cage.h | 53 ++++++++ engines/titanic/game/captains_wheel.cpp | 56 ++++++++ engines/titanic/game/captains_wheel.h | 59 +++++++++ engines/titanic/game/cell_point_button.cpp | 79 +++++++++++ engines/titanic/game/cell_point_button.h | 66 ++++++++++ engines/titanic/game/chicken_dispensor.cpp | 48 +++++++ engines/titanic/game/chicken_dispensor.h | 56 ++++++++ engines/titanic/game/close_broken_pel.cpp | 39 ++++++ engines/titanic/game/close_broken_pel.h | 52 ++++++++ engines/titanic/game/computer.cpp | 41 ++++++ engines/titanic/game/computer.h | 55 ++++++++ engines/titanic/game/eject_phonograph_button.cpp | 47 +++++++ engines/titanic/game/eject_phonograph_button.h | 57 ++++++++ engines/titanic/game/emma_control.cpp | 43 ++++++ engines/titanic/game/emma_control.h | 54 ++++++++ engines/titanic/game/empty_nut_bowl.h | 2 +- engines/titanic/game/games_console.cpp | 39 ++++++ engines/titanic/game/games_console.h | 54 ++++++++ engines/titanic/game/head_smash_event.cpp | 37 ++++++ engines/titanic/game/head_smash_event.h | 50 +++++++ engines/titanic/game/head_smash_lever.cpp | 48 +++++++ engines/titanic/game/head_smash_lever.h | 56 ++++++++ engines/titanic/game/lemon_dispensor.cpp | 51 +++++++ engines/titanic/game/lemon_dispensor.h | 57 ++++++++ engines/titanic/game/musical_instrument.cpp | 37 ++++++ engines/titanic/game/musical_instrument.h | 50 +++++++ engines/titanic/game/play_music_button.cpp | 43 ++++++ engines/titanic/game/play_music_button.h | 55 ++++++++ engines/titanic/game/play_on_act.cpp | 37 ++++++ engines/titanic/game/play_on_act.h | 50 +++++++ engines/titanic/game/record_phonograph_button.cpp | 39 ++++++ engines/titanic/game/record_phonograph_button.h | 54 ++++++++ engines/titanic/game/replacement_ear.cpp | 37 ++++++ engines/titanic/game/replacement_ear.h | 50 +++++++ engines/titanic/game/sauce_dispensor.cpp | 66 ++++++++++ engines/titanic/game/sauce_dispensor.h | 62 +++++++++ engines/titanic/game/season_background.cpp | 51 +++++++ engines/titanic/game/season_background.h | 57 ++++++++ engines/titanic/game/season_barrel.cpp | 42 ++++++ engines/titanic/game/season_barrel.h | 55 ++++++++ engines/titanic/game/seasonal_adjustment.cpp | 43 ++++++ engines/titanic/game/seasonal_adjustment.h | 55 ++++++++ engines/titanic/game/service_elevator_window.cpp | 51 +++++++ engines/titanic/game/service_elevator_window.h | 57 ++++++++ engines/titanic/game/ship_setting.cpp | 51 +++++++ engines/titanic/game/ship_setting.h | 57 ++++++++ engines/titanic/game/speech_dispensor.cpp | 37 ++++++ engines/titanic/game/speech_dispensor.h | 50 +++++++ engines/titanic/game/stop_phonograph_button.cpp | 37 ++++++ engines/titanic/game/stop_phonograph_button.h | 50 +++++++ engines/titanic/game/third_class_canal.cpp | 37 ++++++ engines/titanic/game/third_class_canal.h | 50 +++++++ engines/titanic/game/wheel_button.cpp | 49 +++++++ engines/titanic/game/wheel_button.h | 56 ++++++++ engines/titanic/game/wheel_hotspot.cpp | 43 ++++++ engines/titanic/game/wheel_hotspot.h | 55 ++++++++ engines/titanic/game/wheel_spin.cpp | 39 ++++++ engines/titanic/game/wheel_spin.h | 54 ++++++++ engines/titanic/gfx/music_control.cpp | 51 +++++++ engines/titanic/gfx/music_control.h | 57 ++++++++ engines/titanic/gfx/music_slider.h | 56 ++++++++ engines/titanic/gfx/music_slider_pitch.h | 56 ++++++++ engines/titanic/gfx/music_slider_speed.h | 56 ++++++++ engines/titanic/gfx/music_switch.h | 56 ++++++++ engines/titanic/gfx/music_switch_inversion.h | 56 ++++++++ engines/titanic/gfx/music_switch_reverse.h | 56 ++++++++ engines/titanic/gfx/music_voice_mute.h | 56 ++++++++ engines/titanic/module.mk | 36 +++++ engines/titanic/sound/trigger_auto_music_player.h | 6 +- 83 files changed, 4338 insertions(+), 9 deletions(-) create mode 100644 engines/titanic/game/arb_background.cpp create mode 100644 engines/titanic/game/arb_background.h create mode 100644 engines/titanic/game/arboretum_gate.cpp create mode 100644 engines/titanic/game/arboretum_gate.h create mode 100644 engines/titanic/game/auto_animate.cpp create mode 100644 engines/titanic/game/auto_animate.h create mode 100644 engines/titanic/game/bomb.cpp create mode 100644 engines/titanic/game/bomb.h create mode 100644 engines/titanic/game/bridge_view.cpp create mode 100644 engines/titanic/game/bridge_view.h create mode 100644 engines/titanic/game/broken_pell_base.cpp create mode 100644 engines/titanic/game/broken_pell_base.h create mode 100644 engines/titanic/game/cage.cpp create mode 100644 engines/titanic/game/cage.h create mode 100644 engines/titanic/game/captains_wheel.cpp create mode 100644 engines/titanic/game/captains_wheel.h create mode 100644 engines/titanic/game/cell_point_button.cpp create mode 100644 engines/titanic/game/cell_point_button.h create mode 100644 engines/titanic/game/chicken_dispensor.cpp create mode 100644 engines/titanic/game/chicken_dispensor.h create mode 100644 engines/titanic/game/close_broken_pel.cpp create mode 100644 engines/titanic/game/close_broken_pel.h create mode 100644 engines/titanic/game/computer.cpp create mode 100644 engines/titanic/game/computer.h create mode 100644 engines/titanic/game/eject_phonograph_button.cpp create mode 100644 engines/titanic/game/eject_phonograph_button.h create mode 100644 engines/titanic/game/emma_control.cpp create mode 100644 engines/titanic/game/emma_control.h create mode 100644 engines/titanic/game/games_console.cpp create mode 100644 engines/titanic/game/games_console.h create mode 100644 engines/titanic/game/head_smash_event.cpp create mode 100644 engines/titanic/game/head_smash_event.h create mode 100644 engines/titanic/game/head_smash_lever.cpp create mode 100644 engines/titanic/game/head_smash_lever.h create mode 100644 engines/titanic/game/lemon_dispensor.cpp create mode 100644 engines/titanic/game/lemon_dispensor.h create mode 100644 engines/titanic/game/musical_instrument.cpp create mode 100644 engines/titanic/game/musical_instrument.h create mode 100644 engines/titanic/game/play_music_button.cpp create mode 100644 engines/titanic/game/play_music_button.h create mode 100644 engines/titanic/game/play_on_act.cpp create mode 100644 engines/titanic/game/play_on_act.h create mode 100644 engines/titanic/game/record_phonograph_button.cpp create mode 100644 engines/titanic/game/record_phonograph_button.h create mode 100644 engines/titanic/game/replacement_ear.cpp create mode 100644 engines/titanic/game/replacement_ear.h create mode 100644 engines/titanic/game/sauce_dispensor.cpp create mode 100644 engines/titanic/game/sauce_dispensor.h create mode 100644 engines/titanic/game/season_background.cpp create mode 100644 engines/titanic/game/season_background.h create mode 100644 engines/titanic/game/season_barrel.cpp create mode 100644 engines/titanic/game/season_barrel.h create mode 100644 engines/titanic/game/seasonal_adjustment.cpp create mode 100644 engines/titanic/game/seasonal_adjustment.h create mode 100644 engines/titanic/game/service_elevator_window.cpp create mode 100644 engines/titanic/game/service_elevator_window.h create mode 100644 engines/titanic/game/ship_setting.cpp create mode 100644 engines/titanic/game/ship_setting.h create mode 100644 engines/titanic/game/speech_dispensor.cpp create mode 100644 engines/titanic/game/speech_dispensor.h create mode 100644 engines/titanic/game/stop_phonograph_button.cpp create mode 100644 engines/titanic/game/stop_phonograph_button.h create mode 100644 engines/titanic/game/third_class_canal.cpp create mode 100644 engines/titanic/game/third_class_canal.h create mode 100644 engines/titanic/game/wheel_button.cpp create mode 100644 engines/titanic/game/wheel_button.h create mode 100644 engines/titanic/game/wheel_hotspot.cpp create mode 100644 engines/titanic/game/wheel_hotspot.h create mode 100644 engines/titanic/game/wheel_spin.cpp create mode 100644 engines/titanic/game/wheel_spin.h create mode 100644 engines/titanic/gfx/music_control.cpp create mode 100644 engines/titanic/gfx/music_control.h create mode 100644 engines/titanic/gfx/music_slider.h create mode 100644 engines/titanic/gfx/music_slider_pitch.h create mode 100644 engines/titanic/gfx/music_slider_speed.h create mode 100644 engines/titanic/gfx/music_switch.h create mode 100644 engines/titanic/gfx/music_switch_inversion.h create mode 100644 engines/titanic/gfx/music_switch_reverse.h create mode 100644 engines/titanic/gfx/music_voice_mute.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index f36b7acc62..20d6fec86e 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -73,11 +73,23 @@ #include "titanic/core/view_item.h" #include "titanic/game/announce.h" +#include "titanic/game/arb_background.h" +#include "titanic/game/arboretum_gate.h" +#include "titanic/game/auto_animate.h" #include "titanic/game/belbot_get_light.h" +#include "titanic/game/bomb.h" #include "titanic/game/bowl_unlocker.h" +#include "titanic/game/bridge_view.h" +#include "titanic/game/broken_pell_base.h" +#include "titanic/game/cage.h" +#include "titanic/game/captains_wheel.h" #include "titanic/game/cdrom.h" #include "titanic/game/cdrom_computer.h" #include "titanic/game/cdrom_tray.h" +#include "titanic/game/cell_point_button.h" +#include "titanic/game/chicken_dispensor.h" +#include "titanic/game/close_broken_pel.h" +#include "titanic/game/computer.h" #include "titanic/game/computer_screen.h" #include "titanic/game/cookie.h" #include "titanic/game/credits.h" @@ -87,22 +99,45 @@ #include "titanic/game/doorbot_home_handler.h" #include "titanic/game/drawer.h" #include "titanic/game/ear_sweet_bowl.h" +#include "titanic/game/eject_phonograph_button.h" +#include "titanic/game/emma_control.h" #include "titanic/game/empty_nut_bowl.h" #include "titanic/game/enter_exit_first_class_state.h" +#include "titanic/game/games_console.h" #include "titanic/game/hammer_dispensor_button.h" +#include "titanic/game/head_smash_event.h" +#include "titanic/game/head_smash_lever.h" +#include "titanic/game/lemon_dispensor.h" #include "titanic/game/light.h" #include "titanic/game/light_switch.h" #include "titanic/game/little_lift_button.h" +#include "titanic/game/musical_instrument.h" #include "titanic/game/no_nut_bowl.h" #include "titanic/game/null_port_hole.h" #include "titanic/game/nut_replacer.h" +#include "titanic/game/play_music_button.h" +#include "titanic/game/play_on_act.h" #include "titanic/game/port_hole.h" +#include "titanic/game/record_phonograph_button.h" +#include "titanic/game/replacement_ear.h" #include "titanic/game/room_item.h" +#include "titanic/game/sauce_dispensor.h" +#include "titanic/game/season_background.h" +#include "titanic/game/season_barrel.h" +#include "titanic/game/seasonal_adjustment.h" #include "titanic/game/service_elevator_door.h" +#include "titanic/game/service_elevator_window.h" +#include "titanic/game/ship_setting.h" +#include "titanic/game/speech_dispensor.h" #include "titanic/game/start_action.h" +#include "titanic/game/stop_phonograph_button.h" #include "titanic/game/sub_glass.h" #include "titanic/game/sweet_bowl.h" #include "titanic/game/television.h" +#include "titanic/game/third_class_canal.h" +#include "titanic/game/wheel_button.h" +#include "titanic/game/wheel_hotspot.h" +#include "titanic/game/wheel_spin.h" #include "titanic/game/parrot/parrot_lobby_controller.h" #include "titanic/game/parrot/parrot_lobby_link_updater.h" #include "titanic/game/parrot/parrot_lobby_object.h" @@ -128,7 +163,6 @@ #include "titanic/game/sgt/sgt_restaurant_doors.h" #include "titanic/game/sgt/sgt_state_room.h" #include "titanic/game/sgt/sgt_upper_doors_sound.h" - #include "titanic/gfx/act_button.h" #include "titanic/gfx/changes_season_button.h" #include "titanic/gfx/chev_left_off.h" @@ -148,6 +182,13 @@ #include "titanic/gfx/icon_nav_up.h" #include "titanic/gfx/keybrd_butt.h" #include "titanic/gfx/move_object_button.h" +#include "titanic/gfx/music_control.h" +#include "titanic/gfx/music_slider_pitch.h" +#include "titanic/gfx/music_slider_speed.h" +#include "titanic/gfx/music_switch.h" +#include "titanic/gfx/music_switch_inversion.h" +#include "titanic/gfx/music_switch_reverse.h" +#include "titanic/gfx/music_voice_mute.h" #include "titanic/gfx/pet_mode_off.h" #include "titanic/gfx/pet_mode_on.h" #include "titanic/gfx/pet_mode_panel.h" @@ -160,7 +201,6 @@ #include "titanic/gfx/status_change_button.h" #include "titanic/gfx/st_button.h" #include "titanic/gfx/toggle_switch.h" - #include "titanic/messages/messages.h" #include "titanic/messages/mouse_messages.h" #include "titanic/messages/pet_messages.h" @@ -193,6 +233,13 @@ #include "titanic/npcs/titania.h" #include "titanic/sound/auto_music_player.h" +#include "titanic/sound/auto_music_player_base.h" +#include "titanic/sound/auto_sound_player.h" +#include "titanic/sound/background_sound_maker.h" +#include "titanic/sound/music_player.h" +#include "titanic/sound/seasonal_music_player.h" +#include "titanic/sound/titania_speech.h" +#include "titanic/sound/trigger_auto_music_player.h" namespace Titanic { @@ -252,11 +299,23 @@ DEFFN(CTreeItem); DEFFN(CViewItem); DEFFN(CAnnounce); +DEFFN(CArbBackground); +DEFFN(CArboretumGate); +DEFFN(CAutoAnimate); DEFFN(CBelbotGetLight); DEFFN(CBowlUnlocker); +DEFFN(CBomb); +DEFFN(CBridgeView); +DEFFN(CBrokenPellBase) +DEFFN(CCage); +DEFFN(CCaptainsWheel); DEFFN(CCDROM); DEFFN(CCDROMComputer); DEFFN(CCDROMTray); +DEFFN(CCellPointButton); +DEFFN(CChickenDispensor); +DEFFN(CCloseBrokenPel); +DEFFN(CComputer); DEFFN(CCookie); DEFFN(CComputerScreen); DEFFN(CCredits); @@ -265,22 +324,45 @@ DEFFN(CDeadArea); DEFFN(CDeskClickResponder); DEFFN(CDoorbotHomeHandler); DEFFN(CEarSweetBowl); +DEFFN(CEjectPhonographButton); +DEFFN(CEmmaControl); DEFFN(CEmptyNutBowl); DEFFN(CEnterExitFirstClassState); +DEFFN(CGamesConsole); DEFFN(CHammerDispensorButton); +DEFFN(CHeadSmashEvent); +DEFFN(CHeadSmashLever); +DEFFN(CLemonDispensor); DEFFN(CLight); DEFFN(CLightSwitch); DEFFN(CLittleLiftButton); +DEFFN(CMusicalInstrument); DEFFN(CNoNutBowl); DEFFN(CNullPortHole); DEFFN(CNutReplacer); +DEFFN(CPlayMusicButton); +DEFFN(CPlayOnAct); DEFFN(CPortHole); +DEFFN(CRecordPhonographButton); +DEFFN(CReplacementEar); DEFFN(CRoomItem); +DEFFN(CSauceDispensor); +DEFFN(CSeasonBackground); +DEFFN(CSeasonBarrel); +DEFFN(CSeasonalAdjustment); DEFFN(CServiceElevatorDoor); +DEFFN(CServiceElevatorWindow); +DEFFN(CShipSetting); +DEFFN(CSpeechDispensor); DEFFN(CStartAction); +DEFFN(CStopPhonographButton); DEFFN(CSUBGlass); DEFFN(CSweetBowl); DEFFN(CTelevision); +DEFFN(CThirdClassCanal); +DEFFN(CWheelButton); +DEFFN(CWheelHotSpot); +DEFFN(CWheelSpin); DEFFN(CParrotLobbyController); DEFFN(CParrotLobbyLinkUpdater); DEFFN(CParrotLobbyObject); @@ -326,6 +408,14 @@ DEFFN(CIconNavRight); DEFFN(CIconNavUp); DEFFN(CKeybrdButt); DEFFN(CMoveObjectButton); +DEFFN(CMusicControl); +DEFFN(CMusicSlider); +DEFFN(CMusicSliderPitch); +DEFFN(CMusicSliderSpeed); +DEFFN(CMusicSwitch); +DEFFN(CMusicSwitchInversion); +DEFFN(CMusicSwitchReverse); +DEFFN(CMusicVoiceMute); DEFFN(CPetModeOff); DEFFN(CPetModeOn); DEFFN(CPetModePanel); @@ -539,8 +629,14 @@ DEFFN(CStarlings); DEFFN(CSummonBots); DEFFN(CSuccUBus); DEFFN(CTitania); - DEFFN(CAutoMusicPlayer); +DEFFN(CAutoMusicPlayerBase); +DEFFN(CAutoSoundPlayer); +DEFFN(CBackgroundSoundMaker); +DEFFN(CMusicPlayer); +DEFFN(CSeasonalMusicPlayer); +DEFFN(CTitaniaSpeech); +DEFFN(CTriggerAutoMusicPlayer); void CSaveableObject::initClassList() { _classList = new Common::HashMap(); @@ -594,12 +690,24 @@ void CSaveableObject::initClassList() { ADDFN(CViewItem); ADDFN(CAnnounce); + ADDFN(CArbBackground); + ADDFN(CArboretumGate); + ADDFN(CAutoAnimate); ADDFN(CBelbotGetLight); + ADDFN(CBomb); ADDFN(CBowlUnlocker); + ADDFN(CBridgeView); + ADDFN(CBrokenPellBase); + ADDFN(CCage); + ADDFN(CCaptainsWheel); ADDFN(CCDROM); ADDFN(CCDROMComputer); ADDFN(CCDROMTray); + ADDFN(CCellPointButton); + ADDFN(CChickenDispensor); ADDFN(CComputerScreen); + ADDFN(CCloseBrokenPel); + ADDFN(CComputer); ADDFN(CCookie); ADDFN(CCredits); ADDFN(CCreditsButton); @@ -608,25 +716,46 @@ void CSaveableObject::initClassList() { ADDFN(CDoorbotHomeHandler); ADDFN(CDropTarget); ADDFN(CEarSweetBowl); + ADDFN(CEjectPhonographButton); + ADDFN(CEmmaControl); ADDFN(CEmptyNutBowl); ADDFN(CEnterExitFirstClassState); + ADDFN(CGamesConsole); ADDFN(CHammerDispensorButton); + ADDFN(CHeadSmashEvent); + ADDFN(CHeadSmashLever); + ADDFN(CLemonDispensor); ADDFN(CLight); ADDFN(CLightSwitch); ADDFN(CLittleLiftButton); + ADDFN(CMusicalInstrument); ADDFN(CNoNutBowl); ADDFN(CNullPortHole); ADDFN(CNutReplacer); ADDFN(CPETPosition); + ADDFN(CPlayMusicButton); + ADDFN(CPlayOnAct); ADDFN(CPortHole); + ADDFN(CRecordPhonographButton); + ADDFN(CReplacementEar); ADDFN(CRoomItem); + ADDFN(CSauceDispensor); + ADDFN(CSeasonBackground); + ADDFN(CSeasonBarrel); + ADDFN(CSeasonalAdjustment); ADDFN(CServiceElevatorDoor); - ADDFN(CSGTStateRoom); - ADDFN(CSGTUpperDoorsSound); + ADDFN(CServiceElevatorWindow); + ADDFN(CShipSetting); + ADDFN(CSpeechDispensor); ADDFN(CStartAction); + ADDFN(CStopPhonographButton); ADDFN(CSUBGlass); ADDFN(CSweetBowl); ADDFN(CTelevision); + ADDFN(CThirdClassCanal); + ADDFN(CWheelButton); + ADDFN(CWheelHotSpot); + ADDFN(CWheelSpin); ADDFN(CParrotLobbyController); ADDFN(CParrotLobbyLinkUpdater); ADDFN(CParrotLobbyObject); @@ -672,6 +801,13 @@ void CSaveableObject::initClassList() { ADDFN(CIconNavUp); ADDFN(CKeybrdButt); ADDFN(CMoveObjectButton); + ADDFN(CMusicControl); + ADDFN(CMusicSlider); + ADDFN(CMusicSliderPitch); + ADDFN(CMusicSliderSpeed); + ADDFN(CMusicSwitch); + ADDFN(CMusicSwitchInversion); + ADDFN(CMusicSwitchReverse); ADDFN(CPetModeOff); ADDFN(CPetModeOn); ADDFN(CPetModePanel); @@ -887,6 +1023,14 @@ void CSaveableObject::initClassList() { ADDFN(CTitania); ADDFN(CAutoMusicPlayer); + ADDFN(CAutoMusicPlayerBase); + ADDFN(CAutoSoundPlayer); + ADDFN(CBackgroundSoundMaker); + ADDFN(CMusicPlayer); + ADDFN(CSeasonalMusicPlayer); + ADDFN(CAutoMusicPlayer); + ADDFN(CTitaniaSpeech); + ADDFN(CTriggerAutoMusicPlayer); } void CSaveableObject::freeClassList() { diff --git a/engines/titanic/game/arb_background.cpp b/engines/titanic/game/arb_background.cpp new file mode 100644 index 0000000000..54e9c17e3c --- /dev/null +++ b/engines/titanic/game/arb_background.cpp @@ -0,0 +1,51 @@ +/* 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 "titanic/game/arb_background.h" + +namespace Titanic { + +CArbBackground::CArbBackground() : CBackground(), + _fieldE0(0), _fieldE4(61), _fieldE8(62), _fieldEC(118) { +} + +void CArbBackground::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_fieldEC, indent); + + CBackground::save(file, indent); +} + +void CArbBackground::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + _fieldEC = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/arb_background.h b/engines/titanic/game/arb_background.h new file mode 100644 index 0000000000..e443c4b41c --- /dev/null +++ b/engines/titanic/game/arb_background.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_ARB_BACKGROUND_H +#define TITANIC_ARB_BACKGROUND_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CArbBackground : public CBackground { +public: + int _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; +public: + CArbBackground(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CArbBackground"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ARB_BACKGROUND_H */ diff --git a/engines/titanic/game/arboretum_gate.cpp b/engines/titanic/game/arboretum_gate.cpp new file mode 100644 index 0000000000..3f13676796 --- /dev/null +++ b/engines/titanic/game/arboretum_gate.cpp @@ -0,0 +1,136 @@ +/* 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 "titanic/game/arboretum_gate.h" + +namespace Titanic { + +int CArboretumGate::_v1; +int CArboretumGate::_v2; +int CArboretumGate::_v3; + +CArboretumGate::CArboretumGate() : CBackground() { + _string1 = "NULL"; + _string2 = "NULL"; + _fieldE0 = 0; + _fieldF0 = 0; + _fieldF4 = 244; + _fieldF8 = 304; + _fieldFC = 122; + _field100 = 182; + _field104 = 183; + _field108 = 243; + _field10C = 665; + _field110 = 724; + _field114 = 61; + _field118 = 121; + _field11C = 0; + _field120 = 60; + _field124 = 485; + _field128 = 544; + _field12C = 425; + _field130 = 484; + _field134 = 545; + _field138 = 604; + _field13C = 605; + _field140 = 664; + _field144 = 305; + _field148 = 364; + _field14C = 365; + _field150 = 424; +} + +void CArboretumGate::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_v2, indent); + file->writeNumberLine(_v3, indent); + file->writeQuotedLine(_string1, indent); + file->writeNumberLine(_fieldF0, indent); + file->writeNumberLine(_fieldF4, indent); + file->writeNumberLine(_fieldF8, indent); + file->writeNumberLine(_fieldFC, indent); + file->writeNumberLine(_field100, indent); + file->writeNumberLine(_field104, indent); + file->writeNumberLine(_field108, indent); + file->writeNumberLine(_field10C, indent); + file->writeNumberLine(_field110, indent); + file->writeNumberLine(_field114, indent); + file->writeNumberLine(_field118, indent); + file->writeNumberLine(_field11C, indent); + file->writeNumberLine(_field120, indent); + file->writeNumberLine(_field124, indent); + file->writeNumberLine(_field128, indent); + file->writeNumberLine(_field12C, indent); + file->writeNumberLine(_field130, indent); + file->writeNumberLine(_field134, indent); + file->writeNumberLine(_field138, indent); + file->writeNumberLine(_field13C, indent); + file->writeNumberLine(_field140, indent); + file->writeNumberLine(_field144, indent); + file->writeNumberLine(_field148, indent); + file->writeNumberLine(_field14C, indent); + file->writeNumberLine(_field150, indent); + file->writeQuotedLine(_string2, indent); + + CBackground::save(file, indent); +} + +void CArboretumGate::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _v1 = file->readNumber(); + _v2 = file->readNumber(); + _v3 = file->readNumber(); + _string1 = file->readString(); + _fieldF0 = file->readNumber(); + _fieldF4 = file->readNumber(); + _fieldF8 = file->readNumber(); + _fieldFC = file->readNumber(); + _field100 = file->readNumber(); + _field104 = file->readNumber(); + _field108 = file->readNumber(); + _field10C = file->readNumber(); + _field110 = file->readNumber(); + _field114 = file->readNumber(); + _field118 = file->readNumber(); + _field11C = file->readNumber(); + _field120 = file->readNumber(); + _field124 = file->readNumber(); + _field128 = file->readNumber(); + _field12C = file->readNumber(); + _field130 = file->readNumber(); + _field134 = file->readNumber(); + _field138 = file->readNumber(); + _field13C = file->readNumber(); + _field140 = file->readNumber(); + _field144 = file->readNumber(); + _field148 = file->readNumber(); + _field14C = file->readNumber(); + _field150 = file->readNumber(); + _string2 = file->readString(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/arboretum_gate.h b/engines/titanic/game/arboretum_gate.h new file mode 100644 index 0000000000..8cbe49be14 --- /dev/null +++ b/engines/titanic/game/arboretum_gate.h @@ -0,0 +1,87 @@ +/* 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. + * + */ + +#ifndef TITANIC_ARBORETUM_GATE_H +#define TITANIC_ARBORETUM_GATE_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CArboretumGate : public CBackground { +public: + static int _v1; + static int _v2; + static int _v3; +public: + int _fieldE0; + CString _string1; + int _fieldE8; + int _fieldEC; + int _fieldF0; + int _fieldF4; + int _fieldF8; + int _fieldFC; + int _field100; + int _field104; + int _field108; + int _field10C; + int _field110; + int _field114; + int _field118; + int _field11C; + int _field120; + int _field124; + int _field128; + int _field12C; + int _field130; + int _field134; + int _field138; + int _field13C; + int _field140; + int _field144; + int _field148; + int _field14C; + int _field150; + CString _string2; +public: + CArboretumGate(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CArboretumGate"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ARBORETUM_GATE_H */ diff --git a/engines/titanic/game/auto_animate.cpp b/engines/titanic/game/auto_animate.cpp new file mode 100644 index 0000000000..bbaeebf091 --- /dev/null +++ b/engines/titanic/game/auto_animate.cpp @@ -0,0 +1,43 @@ +/* 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 "titanic/game/auto_animate.h" + +namespace Titanic { + +void CAutoAnimate::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + CBackground::save(file, indent); +} + +void CAutoAnimate::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/auto_animate.h b/engines/titanic/game/auto_animate.h new file mode 100644 index 0000000000..2afb85b9d5 --- /dev/null +++ b/engines/titanic/game/auto_animate.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_AUTO_ANIMATE_H +#define TITANIC_AUTO_ANIMATE_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CAutoAnimate : public CBackground { +public: + int _fieldE0; + int _fieldE4; + int _fieldE8; +public: + CAutoAnimate() : CBackground(), _fieldE0(1), _fieldE4(1), _fieldE8(0) {} + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CAutoAnimate"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_AUTO_ANIMATE_H */ diff --git a/engines/titanic/game/bomb.cpp b/engines/titanic/game/bomb.cpp new file mode 100644 index 0000000000..108376efb3 --- /dev/null +++ b/engines/titanic/game/bomb.cpp @@ -0,0 +1,72 @@ +/* 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 "titanic/game/bomb.h" + +namespace Titanic { + +CBomb::CBomb() : CBackground() { + _fieldE0 = 0; + _fieldE4 = 0; + _fieldE8 = 17; + _fieldEC = 9; + _fieldF0 = 0; + _fieldF4 = 999; + _fieldF8 = 0; + _fieldFC = 0; + _field100 = 0; + _field104 = 60; +} + +void CBomb::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_fieldEC, indent); + file->writeNumberLine(_fieldF0, indent); + file->writeNumberLine(_fieldF4, indent); + file->writeNumberLine(_fieldF8, indent); + file->writeNumberLine(_fieldFC, indent); + file->writeNumberLine(_field100, indent); + file->writeNumberLine(_field104, indent); + + CBackground::save(file, indent); +} + +void CBomb::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + _fieldEC = file->readNumber(); + _fieldF0 = file->readNumber(); + _fieldF4 = file->readNumber(); + _fieldF8 = file->readNumber(); + _fieldFC = file->readNumber(); + _field100 = file->readNumber(); + _field104 = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/bomb.h b/engines/titanic/game/bomb.h new file mode 100644 index 0000000000..a7294f422a --- /dev/null +++ b/engines/titanic/game/bomb.h @@ -0,0 +1,63 @@ +/* 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. + * + */ + +#ifndef TITANIC_BOMB_H +#define TITANIC_BOMB_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CBomb : public CBackground { +public: + int _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; + int _fieldF0; + int _fieldF4; + int _fieldF8; + int _fieldFC; + int _field100; + int _field104; +public: + CBomb(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBomb"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BOMB_H */ diff --git a/engines/titanic/game/bridge_view.cpp b/engines/titanic/game/bridge_view.cpp new file mode 100644 index 0000000000..8afca38cf1 --- /dev/null +++ b/engines/titanic/game/bridge_view.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/bridge_view.h" + +namespace Titanic { + +void CBridgeView::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + CBackground::save(file, indent); +} + +void CBridgeView::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/bridge_view.h b/engines/titanic/game/bridge_view.h new file mode 100644 index 0000000000..7a765cf21a --- /dev/null +++ b/engines/titanic/game/bridge_view.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_BRIDGE_VIEW_H +#define TITANIC_BRIDGE_VIEW_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CBridgeView : public CBackground { +public: + int _fieldE0; +public: + CBridgeView() : CBackground(), _fieldE0(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBridgeView"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BRIDGE_VIEW_H */ diff --git a/engines/titanic/game/broken_pell_base.cpp b/engines/titanic/game/broken_pell_base.cpp new file mode 100644 index 0000000000..9e2a97462a --- /dev/null +++ b/engines/titanic/game/broken_pell_base.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/broken_pell_base.h" + +namespace Titanic { + +void CBrokenPellBase::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + CBackground::save(file, indent); +} + +void CBrokenPellBase::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/broken_pell_base.h b/engines/titanic/game/broken_pell_base.h new file mode 100644 index 0000000000..fa53af3c62 --- /dev/null +++ b/engines/titanic/game/broken_pell_base.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_BROKEN_PELL_BASE_H +#define TITANIC_BROKEN_PELL_BASE_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CBrokenPellBase : public CBackground { +public: + int _fieldE0; +public: + CBrokenPellBase() : CBackground(), _fieldE0(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBrokenPellBase"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BROKEN_PELL_BASE_H */ diff --git a/engines/titanic/game/cage.cpp b/engines/titanic/game/cage.cpp new file mode 100644 index 0000000000..480944fb47 --- /dev/null +++ b/engines/titanic/game/cage.cpp @@ -0,0 +1,46 @@ +/* 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 "titanic/game/cage.h" + +namespace Titanic { + +int CCage::_v1; +int CCage::_v2; + +void CCage::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_v2, indent); + + CBackground::save(file, indent); +} + +void CCage::load(SimpleFile *file) { + file->readNumber(); + _v1 = file->readNumber(); + _v2 = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/cage.h b/engines/titanic/game/cage.h new file mode 100644 index 0000000000..4c097f3b93 --- /dev/null +++ b/engines/titanic/game/cage.h @@ -0,0 +1,53 @@ +/* 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. + * + */ + +#ifndef TITANIC_CAGE_H +#define TITANIC_CAGE_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CCage : public CBackground { +public: + static int _v1; + static int _v2; +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CCage"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CAGE_H */ diff --git a/engines/titanic/game/captains_wheel.cpp b/engines/titanic/game/captains_wheel.cpp new file mode 100644 index 0000000000..b4e31fdc40 --- /dev/null +++ b/engines/titanic/game/captains_wheel.cpp @@ -0,0 +1,56 @@ +/* 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 "titanic/game/captains_wheel.h" + +namespace Titanic { + +CCaptainsWheel::CCaptainsWheel() : CBackground(), + _fieldE0(0), _fieldE4(0), _fieldE8(0), _fieldEC(0), + _fieldF0(0), _fieldF4(0) { +} + +void CCaptainsWheel::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_fieldEC, indent); + file->writeNumberLine(_fieldF0, indent); + file->writeNumberLine(_fieldF4, indent); + + CBackground::save(file, indent); +} + +void CCaptainsWheel::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + _fieldEC = file->readNumber(); + _fieldF0 = file->readNumber(); + _fieldF4 = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/captains_wheel.h b/engines/titanic/game/captains_wheel.h new file mode 100644 index 0000000000..3d35b9b041 --- /dev/null +++ b/engines/titanic/game/captains_wheel.h @@ -0,0 +1,59 @@ +/* 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. + * + */ + +#ifndef TITANIC_CAPTAINS_WHEEL_H +#define TITANIC_CAPTAINS_WHEEL_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CCaptainsWheel : public CBackground { +public: + int _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; + int _fieldF0; + int _fieldF4; +public: + CCaptainsWheel(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CCaptainsWheel"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CAPTAINS_WHEEL_H */ diff --git a/engines/titanic/game/cell_point_button.cpp b/engines/titanic/game/cell_point_button.cpp new file mode 100644 index 0000000000..45ddad8164 --- /dev/null +++ b/engines/titanic/game/cell_point_button.cpp @@ -0,0 +1,79 @@ +/* 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 "titanic/game/cell_point_button.h" + +namespace Titanic { + +CCellPointButton::CCellPointButton() : CBackground() { + _fieldE0 = 0; + _fieldE4 = 0; + _fieldE8 = 0; + _fieldEC = 0; + _fieldF0 = 0; + _fieldF4 = 0; + _fieldF8 = 0; + _fieldFC = 0; + _field100 = 0; + _field104 = 0; + _field108 = 1; +} + +void CCellPointButton::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_fieldEC, indent); + file->writeNumberLine(_fieldF0, indent); + file->writeNumberLine(_fieldF4, indent); + file->writeNumberLine(_fieldF8, indent); + file->writeNumberLine(_fieldFC, indent); + file->writeNumberLine(_field100, indent); + file->writeNumberLine(_field104, indent); + file->writeNumberLine(_field108, indent); + file->writeQuotedLine(_string3, indent); + file->writeNumberLine(_field118, indent); + + CBackground::save(file, indent); +} + +void CCellPointButton::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + _fieldEC = file->readNumber(); + _fieldF0 = file->readNumber(); + _fieldF4 = file->readNumber(); + _fieldF8 = file->readNumber(); + _fieldFC = file->readNumber(); + _field100 = file->readNumber(); + _field104 = file->readNumber(); + _field108 = file->readNumber(); + _string3 = file->readString(); + _field118 = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/cell_point_button.h b/engines/titanic/game/cell_point_button.h new file mode 100644 index 0000000000..a16e7ae705 --- /dev/null +++ b/engines/titanic/game/cell_point_button.h @@ -0,0 +1,66 @@ +/* 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. + * + */ + +#ifndef TITANIC_CELL_POINT_BUTTON_H +#define TITANIC_CELL_POINT_BUTTON_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CCellPointButton : public CBackground { +public: + int _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; + int _fieldF0; + int _fieldF4; + int _fieldF8; + int _fieldFC; + int _field100; + int _field104; + int _field108; + CString _string3; + int _field118; +public: + CCellPointButton(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CCellPointButton"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CELL_POINT_BUTTON_H */ diff --git a/engines/titanic/game/chicken_dispensor.cpp b/engines/titanic/game/chicken_dispensor.cpp new file mode 100644 index 0000000000..d3660bdf03 --- /dev/null +++ b/engines/titanic/game/chicken_dispensor.cpp @@ -0,0 +1,48 @@ +/* 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 "titanic/game/chicken_dispensor.h" + +namespace Titanic { + +CChickenDispensor::CChickenDispensor() : CBackground(), + _fieldE0(0), _fieldE4(0), _fieldE8(0) { +} + +void CChickenDispensor::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + CBackground::save(file, indent); +} + +void CChickenDispensor::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/chicken_dispensor.h b/engines/titanic/game/chicken_dispensor.h new file mode 100644 index 0000000000..10fcba1d17 --- /dev/null +++ b/engines/titanic/game/chicken_dispensor.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_CHICKEN_DISPENSOR_H +#define TITANIC_CHICKEN_DISPENSOR_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CChickenDispensor : public CBackground { +public: + int _fieldE0; + int _fieldE4; + int _fieldE8; +public: + CChickenDispensor(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CNoNutBowl"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CHICKEN_DISPENSOR_H */ diff --git a/engines/titanic/game/close_broken_pel.cpp b/engines/titanic/game/close_broken_pel.cpp new file mode 100644 index 0000000000..9cc4eb6535 --- /dev/null +++ b/engines/titanic/game/close_broken_pel.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/close_broken_pel.h" + +namespace Titanic { + +void CCloseBrokenPel::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string3, indent); + CBackground::save(file, indent); +} + +void CCloseBrokenPel::load(SimpleFile *file) { + file->readNumber(); + _string3 = file->readString(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/close_broken_pel.h b/engines/titanic/game/close_broken_pel.h new file mode 100644 index 0000000000..ea174a4f1c --- /dev/null +++ b/engines/titanic/game/close_broken_pel.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_CLOSE_BROKEN_PEL_H +#define TITANIC_CLOSE_BROKEN_PEL_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CCloseBrokenPel : public CBackground { +public: + CString _string3; +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CCloseBrokenPel"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CLOSE_BROKEN_PEL_H */ diff --git a/engines/titanic/game/computer.cpp b/engines/titanic/game/computer.cpp new file mode 100644 index 0000000000..a28292184e --- /dev/null +++ b/engines/titanic/game/computer.cpp @@ -0,0 +1,41 @@ +/* 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 "titanic/game/computer.h" + +namespace Titanic { + +void CComputer::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string3, indent); + file->writeNumberLine(_fieldEC, indent); + CBackground::save(file, indent); +} + +void CComputer::load(SimpleFile *file) { + file->readNumber(); + _string3 = file->readString(); + _fieldEC = file->readNumber(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/computer.h b/engines/titanic/game/computer.h new file mode 100644 index 0000000000..074d17c0fa --- /dev/null +++ b/engines/titanic/game/computer.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_COMPUTER_H +#define TITANIC_COMPUTER_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CComputer : public CBackground { +public: + CString _string3; + int _fieldEC; +public: + CComputer() : CBackground(), _string3("None"), _fieldEC(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CComputer"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_COMPUTER_H */ diff --git a/engines/titanic/game/eject_phonograph_button.cpp b/engines/titanic/game/eject_phonograph_button.cpp new file mode 100644 index 0000000000..bd444f94e5 --- /dev/null +++ b/engines/titanic/game/eject_phonograph_button.cpp @@ -0,0 +1,47 @@ +/* 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 "titanic/game/eject_phonograph_button.h" + +namespace Titanic { + +void CEjectPhonographButton::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeQuotedLine(_string3, indent); + file->writeQuotedLine(_string4, indent); + + CBackground::save(file, indent); +} + +void CEjectPhonographButton::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _string3 = file->readString(); + _string4 = file->readString(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/eject_phonograph_button.h b/engines/titanic/game/eject_phonograph_button.h new file mode 100644 index 0000000000..e37a061bd4 --- /dev/null +++ b/engines/titanic/game/eject_phonograph_button.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_EJECT_PHONOGRAPH_BUTTON_H +#define TITANIC_EJECT_PHONOGRAPH_BUTTON_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CEjectPhonographButton : public CBackground { +public: + int _fieldE0; + int _fieldE4; + CString _string3; + CString _string4; +public: + CEjectPhonographButton() : CBackground(), _fieldE0(0), _fieldE4(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CEjectPhonographButton"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_EJECT_PHONOGRAPH_BUTTON_H */ diff --git a/engines/titanic/game/emma_control.cpp b/engines/titanic/game/emma_control.cpp new file mode 100644 index 0000000000..ce3b325e4c --- /dev/null +++ b/engines/titanic/game/emma_control.cpp @@ -0,0 +1,43 @@ +/* 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 "titanic/game/emma_control.h" + +namespace Titanic { + +void CEmmaControl::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_wavFile1, indent); + file->writeQuotedLine(_wavFile2, indent); + + CBackground::save(file, indent); +} + +void CEmmaControl::load(SimpleFile *file) { + file->readNumber(); + _wavFile1 = file->readString(); + _wavFile2 = file->readString(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/emma_control.h b/engines/titanic/game/emma_control.h new file mode 100644 index 0000000000..f61d2372d9 --- /dev/null +++ b/engines/titanic/game/emma_control.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_EMMA_CONTROL_H +#define TITANIC_EMMA_CONTROL_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CEmmaControl : public CBackground { +public: + CString _wavFile1, _wavFile2; +public: + CEmmaControl() : CBackground(), _wavFile1("b#39.wav"), _wavFile2("b#38.wav") {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CEmmaControl"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_EMMA_CONTROL_H */ diff --git a/engines/titanic/game/empty_nut_bowl.h b/engines/titanic/game/empty_nut_bowl.h index c1c553a697..57668ca49d 100644 --- a/engines/titanic/game/empty_nut_bowl.h +++ b/engines/titanic/game/empty_nut_bowl.h @@ -51,4 +51,4 @@ public: } // End of namespace Titanic -#endif /* TITANIC_NO_NUT_BOWL_H */ +#endif /* TITANIC_EMPTY_NUT_BOWL_H */ diff --git a/engines/titanic/game/games_console.cpp b/engines/titanic/game/games_console.cpp new file mode 100644 index 0000000000..13a726058a --- /dev/null +++ b/engines/titanic/game/games_console.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/games_console.h" + +namespace Titanic { + +void CGamesConsole::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + CBackground::save(file, indent); +} + +void CGamesConsole::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/games_console.h b/engines/titanic/game/games_console.h new file mode 100644 index 0000000000..4caeda8715 --- /dev/null +++ b/engines/titanic/game/games_console.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_GAMES_CONSOLE_H +#define TITANIC_GAMES_CONSOLE_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CGamesConsole : public CBackground { +public: + int _fieldE0; +public: + CGamesConsole() : CBackground(), _fieldE0(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CGamesConsole"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_GAMES_CONSOLE_H */ diff --git a/engines/titanic/game/head_smash_event.cpp b/engines/titanic/game/head_smash_event.cpp new file mode 100644 index 0000000000..a3d3395a6e --- /dev/null +++ b/engines/titanic/game/head_smash_event.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/head_smash_event.h" + +namespace Titanic { + +void CHeadSmashEvent::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CBackground::save(file, indent); +} + +void CHeadSmashEvent::load(SimpleFile *file) { + file->readNumber(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/head_smash_event.h b/engines/titanic/game/head_smash_event.h new file mode 100644 index 0000000000..4032098817 --- /dev/null +++ b/engines/titanic/game/head_smash_event.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_HEAD_SMASH_EVENT_H +#define TITANIC_HEAD_SMASH_EVENT_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CHeadSmashEvent : public CBackground { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CHeadSmashEvent"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_HEAD_SMASH_EVENT_H */ diff --git a/engines/titanic/game/head_smash_lever.cpp b/engines/titanic/game/head_smash_lever.cpp new file mode 100644 index 0000000000..23ca96d6f9 --- /dev/null +++ b/engines/titanic/game/head_smash_lever.cpp @@ -0,0 +1,48 @@ +/* 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 "titanic/game/head_smash_lever.h" + +namespace Titanic { + +CHeadSmashLever::CHeadSmashLever() : CBackground(), + _fieldE0(0), _fieldE4(0), _fieldE8(0) {} + +void CHeadSmashLever::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + + CBackground::save(file, indent); +} + +void CHeadSmashLever::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/head_smash_lever.h b/engines/titanic/game/head_smash_lever.h new file mode 100644 index 0000000000..7268cb8a4a --- /dev/null +++ b/engines/titanic/game/head_smash_lever.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_HEAD_SMASH_LEVER_H +#define TITANIC_HEAD_SMASH_LEVER_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CHeadSmashLever : public CBackground { +public: + int _fieldE0; + int _fieldE4; + int _fieldE8; +public: + CHeadSmashLever(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CHeadSmashLever"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_HEAD_SMASH_LEVER_H */ diff --git a/engines/titanic/game/lemon_dispensor.cpp b/engines/titanic/game/lemon_dispensor.cpp new file mode 100644 index 0000000000..3cf7cc9525 --- /dev/null +++ b/engines/titanic/game/lemon_dispensor.cpp @@ -0,0 +1,51 @@ +/* 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 "titanic/game/lemon_dispensor.h" + +namespace Titanic { + +CLemonDispensor::CLemonDispensor() : CBackground(), + _fieldE0(0), _fieldE4(9), _fieldE8(15), _fieldEC(0) { +} + +void CLemonDispensor::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_fieldEC, indent); + + CBackground::save(file, indent); +} + +void CLemonDispensor::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + _fieldEC = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/lemon_dispensor.h b/engines/titanic/game/lemon_dispensor.h new file mode 100644 index 0000000000..7f3164f192 --- /dev/null +++ b/engines/titanic/game/lemon_dispensor.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_LEMON_DISPENSOR_H +#define TITANIC_LEMON_DISPENSOR_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CLemonDispensor : public CBackground { +public: + int _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; +public: + CLemonDispensor(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CLemonDispensor"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_LEMON_DISPENSOR_H */ diff --git a/engines/titanic/game/musical_instrument.cpp b/engines/titanic/game/musical_instrument.cpp new file mode 100644 index 0000000000..6695104aba --- /dev/null +++ b/engines/titanic/game/musical_instrument.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/musical_instrument.h" + +namespace Titanic { + +void CMusicalInstrument::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CBackground::save(file, indent); +} + +void CMusicalInstrument::load(SimpleFile *file) { + file->readNumber(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/musical_instrument.h b/engines/titanic/game/musical_instrument.h new file mode 100644 index 0000000000..8eafca5e3b --- /dev/null +++ b/engines/titanic/game/musical_instrument.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_MUSICAL_INSTRUMENT_H +#define TITANIC_MUSICAL_INSTRUMENT_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CMusicalInstrument : public CBackground { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMusicalInstrument"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MUSICAL_INSTRUMENT_H */ diff --git a/engines/titanic/game/play_music_button.cpp b/engines/titanic/game/play_music_button.cpp new file mode 100644 index 0000000000..49e128cb66 --- /dev/null +++ b/engines/titanic/game/play_music_button.cpp @@ -0,0 +1,43 @@ +/* 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 "titanic/game/play_music_button.h" + +namespace Titanic { + +void CPlayMusicButton::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + + CBackground::save(file, indent); +} + +void CPlayMusicButton::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/play_music_button.h b/engines/titanic/game/play_music_button.h new file mode 100644 index 0000000000..29a13a688a --- /dev/null +++ b/engines/titanic/game/play_music_button.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_PLAY_MUSIC_BUTTON_H +#define TITANIC_PLAY_MUSIC_BUTTON_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CPlayMusicButton : public CBackground { +public: + int _fieldE0; + int _fieldE4; +public: + CPlayMusicButton() : CBackground(), _fieldE0(0), _fieldE4(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPlayMusicButton"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PLAY_MUSIC_BUTTON_H */ diff --git a/engines/titanic/game/play_on_act.cpp b/engines/titanic/game/play_on_act.cpp new file mode 100644 index 0000000000..b0236cda5a --- /dev/null +++ b/engines/titanic/game/play_on_act.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/play_on_act.h" + +namespace Titanic { + +void CPlayOnAct::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CBackground::save(file, indent); +} + +void CPlayOnAct::load(SimpleFile *file) { + file->readNumber(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/play_on_act.h b/engines/titanic/game/play_on_act.h new file mode 100644 index 0000000000..b8fdb2ac15 --- /dev/null +++ b/engines/titanic/game/play_on_act.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PLAY_ON_ACT_H +#define TITANIC_PLAY_ON_ACT_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CPlayOnAct : public CBackground { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPlayOnAct"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PLAY_ON_ACT_H */ diff --git a/engines/titanic/game/record_phonograph_button.cpp b/engines/titanic/game/record_phonograph_button.cpp new file mode 100644 index 0000000000..896e9d2be6 --- /dev/null +++ b/engines/titanic/game/record_phonograph_button.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/record_phonograph_button.h" + +namespace Titanic { + +void CRecordPhonographButton::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CBackground::save(file, indent); +} + +void CRecordPhonographButton::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/record_phonograph_button.h b/engines/titanic/game/record_phonograph_button.h new file mode 100644 index 0000000000..4b2c6c885e --- /dev/null +++ b/engines/titanic/game/record_phonograph_button.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_RECORD_PHONOGRAPH_BUTTON_H +#define TITANIC_RECORD_PHONOGRAPH_BUTTON_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CRecordPhonographButton : public CBackground { +public: + int _value; +public: + CRecordPhonographButton() : CBackground(), _value(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CRecordPhonographButton"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_RECORD_PHONOGRAPH_BUTTON_H */ diff --git a/engines/titanic/game/replacement_ear.cpp b/engines/titanic/game/replacement_ear.cpp new file mode 100644 index 0000000000..4926932c17 --- /dev/null +++ b/engines/titanic/game/replacement_ear.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/replacement_ear.h" + +namespace Titanic { + +void CReplacementEar::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CBackground::save(file, indent); +} + +void CReplacementEar::load(SimpleFile *file) { + file->readNumber(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/replacement_ear.h b/engines/titanic/game/replacement_ear.h new file mode 100644 index 0000000000..9c4a8e1398 --- /dev/null +++ b/engines/titanic/game/replacement_ear.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_REPLACEMENT_EAR_H +#define TITANIC_REPLACEMENT_EAR_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CReplacementEar : public CBackground { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CNoNutBowl"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_REPLACEMENT_EAR_H */ diff --git a/engines/titanic/game/sauce_dispensor.cpp b/engines/titanic/game/sauce_dispensor.cpp new file mode 100644 index 0000000000..4982df6e26 --- /dev/null +++ b/engines/titanic/game/sauce_dispensor.cpp @@ -0,0 +1,66 @@ +/* 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 "titanic/game/sauce_dispensor.h" + +namespace Titanic { + +CSauceDispensor::CSauceDispensor() : CBackground() { + _fieldEC = 0; + _fieldF0 = 0; + _fieldF4 = 0; + _fieldF8 = 0; + _fieldFC = 0; + _field100 = 0; + _field104 = 0; + _field108 = 0; +} + +void CSauceDispensor::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldEC, indent); + file->writeNumberLine(_fieldF0, indent); + file->writeNumberLine(_fieldF4, indent); + file->writeNumberLine(_fieldF8, indent); + file->writeNumberLine(_fieldFC, indent); + file->writeNumberLine(_field100, indent); + file->writeNumberLine(_field104, indent); + file->writeNumberLine(_field108, indent); + + CBackground::save(file, indent); +} + +void CSauceDispensor::load(SimpleFile *file) { + file->readNumber(); + _fieldEC = file->readNumber(); + _fieldF0 = file->readNumber(); + _fieldF4 = file->readNumber(); + _fieldF8 = file->readNumber(); + _fieldFC = file->readNumber(); + _field100 = file->readNumber(); + _field104 = file->readNumber(); + _field108 = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sauce_dispensor.h b/engines/titanic/game/sauce_dispensor.h new file mode 100644 index 0000000000..791839d545 --- /dev/null +++ b/engines/titanic/game/sauce_dispensor.h @@ -0,0 +1,62 @@ +/* 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. + * + */ + +#ifndef TITANIC_SAUCE_DISPENSOR_H +#define TITANIC_SAUCE_DISPENSOR_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CSauceDispensor : public CBackground { +public: + CString _string3; + int _fieldEC; + int _fieldF0; + int _fieldF4; + int _fieldF8; + int _fieldFC; + int _field100; + int _field104; + int _field108; +public: + CSauceDispensor(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSauceDispensor"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SAUCE_DISPENSOR_H */ diff --git a/engines/titanic/game/season_background.cpp b/engines/titanic/game/season_background.cpp new file mode 100644 index 0000000000..a4de590ecd --- /dev/null +++ b/engines/titanic/game/season_background.cpp @@ -0,0 +1,51 @@ +/* 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 "titanic/game/season_background.h" + +namespace Titanic { + +CSeasonBackground::CSeasonBackground() : CBackground(), + _fieldE0(0), _fieldE4(0), _fieldE8(46), _fieldEC(0) { +} + +void CSeasonBackground::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_fieldEC, indent); + + CBackground::save(file, indent); +} + +void CSeasonBackground::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + _fieldEC = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/season_background.h b/engines/titanic/game/season_background.h new file mode 100644 index 0000000000..28998538da --- /dev/null +++ b/engines/titanic/game/season_background.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_SEASON_BACKGROUND_H +#define TITANIC_SEASON_BACKGROUND_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CSeasonBackground : public CBackground { +public: + int _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; +public: + CSeasonBackground(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSeasonBackground"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SEASON_BACKGROUND_H */ diff --git a/engines/titanic/game/season_barrel.cpp b/engines/titanic/game/season_barrel.cpp new file mode 100644 index 0000000000..8aa7b22033 --- /dev/null +++ b/engines/titanic/game/season_barrel.cpp @@ -0,0 +1,42 @@ +/* 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 "titanic/game/season_barrel.h" + +namespace Titanic { + +void CSeasonBarrel::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + + CBackground::save(file, indent); +} + +void CSeasonBarrel::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/season_barrel.h b/engines/titanic/game/season_barrel.h new file mode 100644 index 0000000000..af22c14f73 --- /dev/null +++ b/engines/titanic/game/season_barrel.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_SEASON_BARREL_H +#define TITANIC_SEASON_BARREL_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CSeasonBarrel : public CBackground { +public: + int _fieldE0; + int _fieldE4; +public: + CSeasonBarrel() : CBackground(), _fieldE0(0), _fieldE4(7) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSeasonBarrel"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SEASON_BARREL_H */ diff --git a/engines/titanic/game/seasonal_adjustment.cpp b/engines/titanic/game/seasonal_adjustment.cpp new file mode 100644 index 0000000000..c0c7b2f1b4 --- /dev/null +++ b/engines/titanic/game/seasonal_adjustment.cpp @@ -0,0 +1,43 @@ +/* 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 "titanic/game/seasonal_adjustment.h" + +namespace Titanic { + +void CSeasonalAdjustment::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + + CBackground::save(file, indent); +} + +void CSeasonalAdjustment::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/seasonal_adjustment.h b/engines/titanic/game/seasonal_adjustment.h new file mode 100644 index 0000000000..2db94033db --- /dev/null +++ b/engines/titanic/game/seasonal_adjustment.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_SEASONAL_ADJUSTMENT_H +#define TITANIC_SEASONAL_ADJUSTMENT_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CSeasonalAdjustment : public CBackground { +public: + int _fieldE0; + int _fieldE4; +public: + CSeasonalAdjustment() : CBackground(), _fieldE0(0), _fieldE4(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSeasonalAdjustment"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SEASONAL_ADJUSTMENT_H */ diff --git a/engines/titanic/game/service_elevator_window.cpp b/engines/titanic/game/service_elevator_window.cpp new file mode 100644 index 0000000000..1371fb7c48 --- /dev/null +++ b/engines/titanic/game/service_elevator_window.cpp @@ -0,0 +1,51 @@ +/* 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 "titanic/game/service_elevator_window.h" + +namespace Titanic { + +CServiceElevatorWindow::CServiceElevatorWindow() : CBackground(), + _fieldE0(0), _fieldE4(0), _fieldE8(0), _fieldEC(0) { +} + +void CServiceElevatorWindow::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_fieldEC, indent); + + CBackground::save(file, indent); +} + +void CServiceElevatorWindow::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + _fieldEC = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/service_elevator_window.h b/engines/titanic/game/service_elevator_window.h new file mode 100644 index 0000000000..493776c7af --- /dev/null +++ b/engines/titanic/game/service_elevator_window.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_SERVICE_ELEVATOR_WINDOW_H +#define TITANIC_SERVICE_ELEVATOR_WINDOW_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CServiceElevatorWindow : public CBackground { +public: + int _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; +public: + CServiceElevatorWindow(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CServiceElevatorWindow"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SERVICE_ELEVATOR_WINDOW_H */ diff --git a/engines/titanic/game/ship_setting.cpp b/engines/titanic/game/ship_setting.cpp new file mode 100644 index 0000000000..d53c5289e6 --- /dev/null +++ b/engines/titanic/game/ship_setting.cpp @@ -0,0 +1,51 @@ +/* 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 "titanic/game/ship_setting.h" + +namespace Titanic { + +CShipSetting::CShipSetting() : CBackground(), + _string4("NULL"), _string5("NULL") { +} + +void CShipSetting::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string3, indent); + file->writePoint(_pos1, indent); + file->writeQuotedLine(_string4, indent); + file->writeQuotedLine(_string5, indent); + + CBackground::save(file, indent); +} + +void CShipSetting::load(SimpleFile *file) { + file->readNumber(); + _string3 = file->readString(); + _pos1 = file->readPoint(); + _string4 = file->readString(); + _string5 = file->readString(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/ship_setting.h b/engines/titanic/game/ship_setting.h new file mode 100644 index 0000000000..8e57e53125 --- /dev/null +++ b/engines/titanic/game/ship_setting.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_SHIP_SETTING_H +#define TITANIC_SHIP_SETTING_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CShipSetting : public CBackground { +public: + CString _string3; + Common::Point _pos1; + CString _string4; + CString _string5; +public: + CShipSetting(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CShipSetting"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SHIP_SETTING_H */ diff --git a/engines/titanic/game/speech_dispensor.cpp b/engines/titanic/game/speech_dispensor.cpp new file mode 100644 index 0000000000..d8fc66b07a --- /dev/null +++ b/engines/titanic/game/speech_dispensor.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/speech_dispensor.h" + +namespace Titanic { + +void CSpeechDispensor::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CBackground::save(file, indent); +} + +void CSpeechDispensor::load(SimpleFile *file) { + file->readNumber(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/speech_dispensor.h b/engines/titanic/game/speech_dispensor.h new file mode 100644 index 0000000000..857750dc95 --- /dev/null +++ b/engines/titanic/game/speech_dispensor.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_SPEECH_DISPENSOR_H +#define TITANIC_SPEECH_DISPENSOR_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CSpeechDispensor : public CBackground { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSpeechDispensor"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SPEECH_DISPENSOR_H */ diff --git a/engines/titanic/game/stop_phonograph_button.cpp b/engines/titanic/game/stop_phonograph_button.cpp new file mode 100644 index 0000000000..7c4367a9c7 --- /dev/null +++ b/engines/titanic/game/stop_phonograph_button.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/stop_phonograph_button.h" + +namespace Titanic { + +void CStopPhonographButton::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CBackground::save(file, indent); +} + +void CStopPhonographButton::load(SimpleFile *file) { + file->readNumber(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/stop_phonograph_button.h b/engines/titanic/game/stop_phonograph_button.h new file mode 100644 index 0000000000..945345cd61 --- /dev/null +++ b/engines/titanic/game/stop_phonograph_button.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_STOP_PHONOGRAPH_BUTTON_H +#define TITANIC_STOP_PHONOGRAPH_BUTTON_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CStopPhonographButton : public CBackground { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CStopPhonographButton"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STOP_PHONOGRAPH_BUTTON_H */ diff --git a/engines/titanic/game/third_class_canal.cpp b/engines/titanic/game/third_class_canal.cpp new file mode 100644 index 0000000000..a25d5f20ef --- /dev/null +++ b/engines/titanic/game/third_class_canal.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/third_class_canal.h" + +namespace Titanic { + +void CThirdClassCanal::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CBackground::save(file, indent); +} + +void CThirdClassCanal::load(SimpleFile *file) { + file->readNumber(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/third_class_canal.h b/engines/titanic/game/third_class_canal.h new file mode 100644 index 0000000000..4465cba07b --- /dev/null +++ b/engines/titanic/game/third_class_canal.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_THIRD_CLASS_CANAL_H +#define TITANIC_THIRD_CLASS_CANAL_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CThirdClassCanal : public CBackground { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CThirdClassCanal"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_THIRD_CLASS_CANAL_H */ diff --git a/engines/titanic/game/wheel_button.cpp b/engines/titanic/game/wheel_button.cpp new file mode 100644 index 0000000000..0fad6848fd --- /dev/null +++ b/engines/titanic/game/wheel_button.cpp @@ -0,0 +1,49 @@ +/* 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 "titanic/game/wheel_button.h" + +namespace Titanic { + +CWheelButton::CWheelButton() : CBackground(), + _fieldE0(0), _fieldE4(0), _fieldE8(0) { +} + +void CWheelButton::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + + CBackground::save(file, indent); +} + +void CWheelButton::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/wheel_button.h b/engines/titanic/game/wheel_button.h new file mode 100644 index 0000000000..b1721ebbdd --- /dev/null +++ b/engines/titanic/game/wheel_button.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_WHEEL_BUTTON_H +#define TITANIC_WHEEL_BUTTON_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CWheelButton : public CBackground { +public: + int _fieldE0; + int _fieldE4; + int _fieldE8; +public: + CWheelButton(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CWheelButton"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_WHEEL_BUTTON_H */ diff --git a/engines/titanic/game/wheel_hotspot.cpp b/engines/titanic/game/wheel_hotspot.cpp new file mode 100644 index 0000000000..8b05f45642 --- /dev/null +++ b/engines/titanic/game/wheel_hotspot.cpp @@ -0,0 +1,43 @@ +/* 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 "titanic/game/wheel_hotspot.h" + +namespace Titanic { + +void CWheelHotSpot::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + + CBackground::save(file, indent); +} + +void CWheelHotSpot::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/wheel_hotspot.h b/engines/titanic/game/wheel_hotspot.h new file mode 100644 index 0000000000..6887407a1e --- /dev/null +++ b/engines/titanic/game/wheel_hotspot.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_WHEEL_HOTSPOT_H +#define TITANIC_WHEEL_HOTSPOT_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CWheelHotSpot : public CBackground { +public: + int _fieldE0; + int _fieldE4; +public: + CWheelHotSpot() : CBackground(), _fieldE0(0), _fieldE4(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CWheelHotSpot"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_WHEEL_HOTSPOT_H */ diff --git a/engines/titanic/game/wheel_spin.cpp b/engines/titanic/game/wheel_spin.cpp new file mode 100644 index 0000000000..7f16a4c559 --- /dev/null +++ b/engines/titanic/game/wheel_spin.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/wheel_spin.h" + +namespace Titanic { + +void CWheelSpin::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CBackground::save(file, indent); +} + +void CWheelSpin::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/wheel_spin.h b/engines/titanic/game/wheel_spin.h new file mode 100644 index 0000000000..64006afa0f --- /dev/null +++ b/engines/titanic/game/wheel_spin.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_WHEEL_SPIN_H +#define TITANIC_WHEEL_SPIN_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CWheelSpin : public CBackground { +public: + int _value; +public: + CWheelSpin() : CBackground(), _value(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CWheelSpin"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_WHEEL_SPIN_H */ diff --git a/engines/titanic/gfx/music_control.cpp b/engines/titanic/gfx/music_control.cpp new file mode 100644 index 0000000000..5ca079f9ff --- /dev/null +++ b/engines/titanic/gfx/music_control.cpp @@ -0,0 +1,51 @@ +/* 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 "titanic/gfx/music_control.h" + +namespace Titanic { + +CMusicControl::CMusicControl() : CBackground(), + _fieldE0(0), _fieldE4(0), _fieldE8(1), _fieldEC(1) { +} + +void CMusicControl::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_fieldEC, indent); + + CBackground::save(file, indent); +} + +void CMusicControl::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + _fieldEC = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/music_control.h b/engines/titanic/gfx/music_control.h new file mode 100644 index 0000000000..a6063f4f9e --- /dev/null +++ b/engines/titanic/gfx/music_control.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_MUSIC_CONTROL_H +#define TITANIC_MUSIC_CONTROL_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CMusicControl : public CBackground { +public: + int _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; +public: + CMusicControl(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMusicControl"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MUSIC_CONTROL_H */ diff --git a/engines/titanic/gfx/music_slider.h b/engines/titanic/gfx/music_slider.h new file mode 100644 index 0000000000..911698656d --- /dev/null +++ b/engines/titanic/gfx/music_slider.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_MUSIC_SLIDER_H +#define TITANIC_MUSIC_SLIDER_H + +#include "titanic/gfx/music_control.h" + +namespace Titanic { + +class CMusicSlider : public CMusicControl { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMusicSlider"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CMusicControl::save(file, indent); + } + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file) { + file->readNumber(); + CMusicControl::load(file); + } +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MUSIC_SLIDER_H */ diff --git a/engines/titanic/gfx/music_slider_pitch.h b/engines/titanic/gfx/music_slider_pitch.h new file mode 100644 index 0000000000..ba2514bf28 --- /dev/null +++ b/engines/titanic/gfx/music_slider_pitch.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_MUSIC_SLIDER_PITCH_H +#define TITANIC_MUSIC_SLIDER_PITCH_H + +#include "titanic/gfx/music_slider.h" + +namespace Titanic { + +class CMusicSliderPitch : public CMusicSlider { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMusicSliderPitch"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CMusicSlider::save(file, indent); + } + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file) { + file->readNumber(); + CMusicSlider::load(file); + } +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MUSIC_SLIDER_PITCH_H */ diff --git a/engines/titanic/gfx/music_slider_speed.h b/engines/titanic/gfx/music_slider_speed.h new file mode 100644 index 0000000000..fb3e7e1d41 --- /dev/null +++ b/engines/titanic/gfx/music_slider_speed.h @@ -0,0 +1,56 @@ +/* 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. +* +*/ + +#ifndef TITANIC_MUSIC_SLIDER_SPEED_H +#define TITANIC_MUSIC_SLIDER_SPEED_H + +#include "titanic/gfx/music_slider.h" + +namespace Titanic { + + class CMusicSliderSpeed : public CMusicSlider { + public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMusicSliderSpeed"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CMusicSlider::save(file, indent); + } + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file) { + file->readNumber(); + CMusicSlider::load(file); + } + }; + +} // End of namespace Titanic + +#endif /* TITANIC_MUSIC_SLIDER_SPEED_H */ diff --git a/engines/titanic/gfx/music_switch.h b/engines/titanic/gfx/music_switch.h new file mode 100644 index 0000000000..0f277c5905 --- /dev/null +++ b/engines/titanic/gfx/music_switch.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_MUSIC_SWITCH_H +#define TITANIC_MUSIC_SWITCH_H + +#include "titanic/gfx/music_control.h" + +namespace Titanic { + +class CMusicSwitch : public CMusicControl { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMusicSwitch"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CMusicControl::save(file, indent); + } + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file) { + file->readNumber(); + CMusicControl::load(file); + } +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MUSIC_SWITCH_H */ diff --git a/engines/titanic/gfx/music_switch_inversion.h b/engines/titanic/gfx/music_switch_inversion.h new file mode 100644 index 0000000000..23562482e0 --- /dev/null +++ b/engines/titanic/gfx/music_switch_inversion.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_MUSIC_SWITCH_INVERSION_H +#define TITANIC_MUSIC_SWITCH_INVERSION_H + +#include "titanic/gfx/music_switch.h" + +namespace Titanic { + +class CMusicSwitchInversion : public CMusicSwitch { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMusicSwitchInversion"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CMusicSwitch::save(file, indent); + } + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file) { + file->readNumber(); + CMusicSwitch::load(file); + } +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MUSIC_SWITCH_INVERSION_H */ diff --git a/engines/titanic/gfx/music_switch_reverse.h b/engines/titanic/gfx/music_switch_reverse.h new file mode 100644 index 0000000000..5467ededb7 --- /dev/null +++ b/engines/titanic/gfx/music_switch_reverse.h @@ -0,0 +1,56 @@ +/* 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. +* +*/ + +#ifndef TITANIC_MUSIC_SWITCH_REVERSE_H +#define TITANIC_MUSIC_SWITCH_REVERSE_H + +#include "titanic/gfx/music_switch.h" + +namespace Titanic { + + class CMusicSwitchReverse : public CMusicSwitch { + public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMusicSwitchReverse"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CMusicSwitch::save(file, indent); + } + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file) { + file->readNumber(); + CMusicSwitch::load(file); + } + }; + +} // End of namespace Titanic + +#endif /* TITANIC_MUSIC_SWITCH_REVERSE_H */ diff --git a/engines/titanic/gfx/music_voice_mute.h b/engines/titanic/gfx/music_voice_mute.h new file mode 100644 index 0000000000..2a2acdedaa --- /dev/null +++ b/engines/titanic/gfx/music_voice_mute.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_MUSIC_VOICE_MUTE_H +#define TITANIC_MUSIC_VOICE_MUTE_H + +#include "titanic/gfx/music_control.h" + +namespace Titanic { + +class CMusicVoiceMute : public CMusicControl { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMusicVoiceMute"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CMusicControl::save(file, indent); + } + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file) { + file->readNumber(); + CMusicControl::load(file); + } +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MUSIC_VOICE_MUTE_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index a5a5db4874..5894bf3317 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -74,6 +74,10 @@ MODULE_OBJS := \ core/view_item.o \ game/announce.o \ game/annoy_barbot.o \ + game/arb_background.o \ + game/arboretum_gate.o \ + game/auto_animate.o \ + game/bomb.o \ game/bar_menu.o \ game/bar_menu_button.o \ game/bar_bell.o \ @@ -82,14 +86,22 @@ MODULE_OBJS := \ game/bowl_unlocker.o \ game/brain_slot.o \ game/bridge_door.o \ + game/bridge_view.o \ + game/broken_pell_base.o \ game/call_pellerator.o \ + game/cage.o \ + game/captains_wheel.o \ game/cdrom.o \ game/cdrom_computer.o \ game/cdrom_tray.o \ + game/cell_point_button.o \ game/chev_code.o \ game/chev_panel.o \ game/chicken_cooler.o \ + game/chicken_dispensor.o \ + game/close_broken_pel.o \ game/cookie.o \ + game/computer.o \ game/computer_screen.o \ game/credits.o \ game/credits_button.o \ @@ -99,7 +111,9 @@ MODULE_OBJS := \ game/doorbot_home_handler.o \ game/drawer.o \ game/ear_sweet_bowl.o \ + game/eject_phonograph_button.o \ game/elevator_action_area.o \ + game/emma_control.o \ game/empty_nut_bowl.o \ game/end_credit_text.o \ game/end_credits.o \ @@ -120,14 +134,18 @@ MODULE_OBJS := \ game/fan_increase.o \ game/fan_noises.o \ game/floor_indicator.o \ + game/games_console.o \ game/get_lift_eye2.o \ game/glass_smasher.o \ game/gondolier_base.o \ game/hammer_clip.o \ game/head_slot.o \ + game/head_smash_event.o \ + game/head_smash_lever.o \ game/head_spinner.o \ game/idle_summoner.o \ game/leave_sec_class_state.o \ + game/lemon_dispensor.o \ game/light.o \ game/light_switch.o \ game/little_lift_button.o \ @@ -135,6 +153,7 @@ MODULE_OBJS := \ game/mail_man.o \ game/missiveomat.o \ game/movie_tester.o \ + game/musical_instrument.o \ game/navigation_computer.o \ game/no_nut_bowl.o \ game/null_port_hole.o \ @@ -145,24 +164,40 @@ MODULE_OBJS := \ game/pet_graphic.o \ game/phonograph_lid.o \ game/place_holder.o \ + game/play_music_button.o \ + game/play_on_act.o \ game/port_hole.o \ + game/record_phonograph_button.o \ + game/replacement_ear.o \ game/reserved_table.o \ game/room_item.o \ + game/sauce_dispensor.o \ game/search_point.o \ + game/season_background.o \ + game/season_barrel.o \ + game/seasonal_adjustment.o \ game/service_elevator_door.o \ + game/service_elevator_window.o \ + game/ship_setting.o \ game/ship_setting_button.o \ game/show_cell_points.o \ + game/speech_dispensor.o \ game/splash_animation.o \ game/star_control.o \ game/starling_puret.o \ game/start_action.o \ + game/stop_phonograph_button.o \ game/sub_glass.o \ game/sub_wrapper.o \ game/sweet_bowl.o \ game/television.o \ + game/third_class_canal.o \ game/tow_parrot_nav.o \ game/throw_tv_down_well.o \ game/titania_still_control.o \ + game/wheel_button.o \ + game/wheel_hotspot.o \ + game/wheel_spin.o \ game/parrot/parrot_lobby_controller.o \ game/parrot/parrot_lobby_link_updater.o \ game/parrot/parrot_lobby_object.o \ @@ -208,6 +243,7 @@ MODULE_OBJS := \ gfx/icon_nav_up.o \ gfx/keybrd_butt.o \ gfx/move_object_button.o \ + gfx/music_control.o \ gfx/pet_mode_off.o \ gfx/pet_mode_on.o \ gfx/pet_mode_panel.o \ diff --git a/engines/titanic/sound/trigger_auto_music_player.h b/engines/titanic/sound/trigger_auto_music_player.h index 9cc71ee0f0..d67add2565 100644 --- a/engines/titanic/sound/trigger_auto_music_player.h +++ b/engines/titanic/sound/trigger_auto_music_player.h @@ -20,8 +20,8 @@ * */ -#ifndef TITANIC_AUTO_MUSIC_PLAYER_H -#define TITANIC_AUTO_MUSIC_PLAYER_H +#ifndef TITANIC_TRIGGER_AUTO_MUSIC_PLAYER_H +#define TITANIC_TRIGGER_AUTO_MUSIC_PLAYER_H #include "titanic/core/game_object.h" @@ -47,4 +47,4 @@ public: } // End of namespace Titanic -#endif /* TITANIC_AUTO_MUSIC_PLAYER_H */ +#endif /* TITANIC_TRIGGER_AUTO_MUSIC_PLAYER_H */ -- cgit v1.2.3 From 5dd3798ebf8177d9c21d79d4e36b173568c09a70 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 29 Feb 2016 22:56:16 -0500 Subject: TITANIC: Added a bunch of classes, loading method fixes --- engines/titanic/carry/hose.cpp | 14 +++++ engines/titanic/carry/hose.h | 11 +++- engines/titanic/carry/hose_end.cpp | 43 ++++++++++++++++ engines/titanic/carry/hose_end.h | 52 +++++++++++++++++++ engines/titanic/carry/perch.cpp | 37 +++++++++++++ engines/titanic/carry/perch.h | 50 ++++++++++++++++++ engines/titanic/core/saveable_object.cpp | 40 +++++++++++++++ engines/titanic/game/chicken_cooler.cpp | 6 +++ engines/titanic/game/maitred_arm_holder.cpp | 37 +++++++++++++ engines/titanic/game/maitred_arm_holder.h | 50 ++++++++++++++++++ engines/titanic/game/music_system_lock.cpp | 39 ++++++++++++++ engines/titanic/game/music_system_lock.h | 54 +++++++++++++++++++ engines/titanic/game/nose_holder.cpp | 44 ++++++++++++++++ engines/titanic/game/nose_holder.h | 55 ++++++++++++++++++++ .../titanic/game/restaurant_cylinder_holder.cpp | 58 +++++++++++++++++++++ engines/titanic/game/restaurant_cylinder_holder.h | 60 ++++++++++++++++++++++ engines/titanic/game/sgt/sgt_state_room.cpp | 10 +++- engines/titanic/game/sgt/sgt_state_room.h | 4 +- engines/titanic/game/up_lighter.cpp | 51 ++++++++++++++++++ engines/titanic/game/up_lighter.h | 57 ++++++++++++++++++++ engines/titanic/module.mk | 7 +++ engines/titanic/titanic.cpp | 8 ++- 22 files changed, 783 insertions(+), 4 deletions(-) create mode 100644 engines/titanic/carry/hose_end.cpp create mode 100644 engines/titanic/carry/hose_end.h create mode 100644 engines/titanic/carry/perch.cpp create mode 100644 engines/titanic/carry/perch.h create mode 100644 engines/titanic/game/maitred_arm_holder.cpp create mode 100644 engines/titanic/game/maitred_arm_holder.h create mode 100644 engines/titanic/game/music_system_lock.cpp create mode 100644 engines/titanic/game/music_system_lock.h create mode 100644 engines/titanic/game/nose_holder.cpp create mode 100644 engines/titanic/game/nose_holder.h create mode 100644 engines/titanic/game/restaurant_cylinder_holder.cpp create mode 100644 engines/titanic/game/restaurant_cylinder_holder.h create mode 100644 engines/titanic/game/up_lighter.cpp create mode 100644 engines/titanic/game/up_lighter.h diff --git a/engines/titanic/carry/hose.cpp b/engines/titanic/carry/hose.cpp index bb52ec34d5..1617feffc1 100644 --- a/engines/titanic/carry/hose.cpp +++ b/engines/titanic/carry/hose.cpp @@ -24,18 +24,32 @@ namespace Titanic { +CHoseStatics *CHose::_statics; + +void CHose::init() { + _statics = new CHoseStatics(); +} + +void CHose::deinit() { + delete _statics; +} + CHose::CHose() : CCarry(), _string6("Succ-U-Bus auxiliary hose attachment incompatible with sliding glass cover.") { } void CHose::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeNumberLine(_statics->_v1, indent); + file->writeQuotedLine(_statics->_v2, indent); file->writeQuotedLine(_string6, indent); CCarry::save(file, indent); } void CHose::load(SimpleFile *file) { file->readNumber(); + _statics->_v1 = file->readNumber(); + _statics->_v2 = file->readString(); _string6 = file->readString(); CCarry::load(file); } diff --git a/engines/titanic/carry/hose.h b/engines/titanic/carry/hose.h index 87f47b3bc4..dc60f6832f 100644 --- a/engines/titanic/carry/hose.h +++ b/engines/titanic/carry/hose.h @@ -27,11 +27,20 @@ namespace Titanic { +struct CHoseStatics { + int _v1; + CString _v2; +}; + class CHose : public CCarry { -private: +protected: + static CHoseStatics *_statics; + CString _string6; public: CHose(); + static void init(); + static void deinit(); /** * Return the class name diff --git a/engines/titanic/carry/hose_end.cpp b/engines/titanic/carry/hose_end.cpp new file mode 100644 index 0000000000..97d75b0ac4 --- /dev/null +++ b/engines/titanic/carry/hose_end.cpp @@ -0,0 +1,43 @@ +/* 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 "titanic/carry/hose_end.h" + +namespace Titanic { + +CHoseEnd::CHoseEnd() : CHose() { + _string6 = "Connection refused by remote hose."; +} + +void CHoseEnd::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string6, indent); + CHose::save(file, indent); +} + +void CHoseEnd::load(SimpleFile *file) { + file->readNumber(); + _string6 = file->readString(); + CHose::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/hose_end.h b/engines/titanic/carry/hose_end.h new file mode 100644 index 0000000000..efce6b8db0 --- /dev/null +++ b/engines/titanic/carry/hose_end.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_HOSE_END_H +#define TITANIC_HOSE_END_H + +#include "titanic/carry/hose.h" + +namespace Titanic { + +class CHoseEnd : public CHose { +public: + CHoseEnd(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CHoseEnd"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_HOSE_END_H */ diff --git a/engines/titanic/carry/perch.cpp b/engines/titanic/carry/perch.cpp new file mode 100644 index 0000000000..976921beb0 --- /dev/null +++ b/engines/titanic/carry/perch.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/carry/perch.h" + +namespace Titanic { + +void CPerch::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CCentralCore::save(file, indent); +} + +void CPerch::load(SimpleFile *file) { + file->readNumber(); + CCentralCore::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/perch.h b/engines/titanic/carry/perch.h new file mode 100644 index 0000000000..ce13dbe684 --- /dev/null +++ b/engines/titanic/carry/perch.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PERCH_H +#define TITANIC_PERCH_H + +#include "titanic/carry/central_core.h" + +namespace Titanic { + +class CPerch : public CCentralCore { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPerch"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PERCH_H */ diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 20d6fec86e..9267e17dae 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -37,6 +37,7 @@ #include "titanic/carry/hammer.h" #include "titanic/carry/head_piece.h" #include "titanic/carry/hose.h" +#include "titanic/carry/hose_end.h" #include "titanic/carry/key.h" #include "titanic/carry/liftbot_head.h" #include "titanic/carry/long_stick.h" @@ -46,6 +47,7 @@ #include "titanic/carry/nose.h" #include "titanic/carry/note.h" #include "titanic/carry/parcel.h" +#include "titanic/carry/perch.h" #include "titanic/carry/phonograph_cylinder.h" #include "titanic/carry/phonograph_ear.h" #include "titanic/carry/photograph.h" @@ -87,6 +89,7 @@ #include "titanic/game/cdrom_computer.h" #include "titanic/game/cdrom_tray.h" #include "titanic/game/cell_point_button.h" +#include "titanic/game/chicken_cooler.h" #include "titanic/game/chicken_dispensor.h" #include "titanic/game/close_broken_pel.h" #include "titanic/game/computer.h" @@ -103,6 +106,8 @@ #include "titanic/game/emma_control.h" #include "titanic/game/empty_nut_bowl.h" #include "titanic/game/enter_exit_first_class_state.h" +#include "titanic/game/enter_exit_view.h" +#include "titanic/game/floor_indicator.h" #include "titanic/game/games_console.h" #include "titanic/game/hammer_dispensor_button.h" #include "titanic/game/head_smash_event.h" @@ -111,8 +116,11 @@ #include "titanic/game/light.h" #include "titanic/game/light_switch.h" #include "titanic/game/little_lift_button.h" +#include "titanic/game/maitred_arm_holder.h" #include "titanic/game/musical_instrument.h" +#include "titanic/game/music_system_lock.h" #include "titanic/game/no_nut_bowl.h" +#include "titanic/game/nose_holder.h" #include "titanic/game/null_port_hole.h" #include "titanic/game/nut_replacer.h" #include "titanic/game/play_music_button.h" @@ -120,6 +128,7 @@ #include "titanic/game/port_hole.h" #include "titanic/game/record_phonograph_button.h" #include "titanic/game/replacement_ear.h" +#include "titanic/game/restaurant_cylinder_holder.h" #include "titanic/game/room_item.h" #include "titanic/game/sauce_dispensor.h" #include "titanic/game/season_background.h" @@ -135,6 +144,8 @@ #include "titanic/game/sweet_bowl.h" #include "titanic/game/television.h" #include "titanic/game/third_class_canal.h" +#include "titanic/game/throw_tv_down_well.h" +#include "titanic/game/up_lighter.h" #include "titanic/game/wheel_button.h" #include "titanic/game/wheel_hotspot.h" #include "titanic/game/wheel_spin.h" @@ -148,6 +159,7 @@ #include "titanic/game/parrot/parrot_perch_holder.h" #include "titanic/game/parrot/parrot_succubus.h" #include "titanic/game/parrot/parrot_trigger.h" +#include "titanic/game/parrot/player_meets_parrot.h" #include "titanic/game/pet/pet.h" #include "titanic/game/pet/pet_class1.h" #include "titanic/game/pet/pet_class2.h" @@ -257,6 +269,7 @@ DEFFN(CBridgePiece); DEFFN(CCarryParrot); DEFFN(CCentralCore); DEFFN(CChicken); +DEFFN(CChickenCooler); DEFFN(CCrushedTV); DEFFN(CEar); DEFFN(CEye); @@ -266,13 +279,17 @@ DEFFN(CGlass); DEFFN(CHammer); DEFFN(CHeadPiece); DEFFN(CHose); +DEFFN(CHoseEnd); DEFFN(CKey); DEFFN(CLiftbotHead); DEFFN(CLongStick); DEFFN(CMagazine); +DEFFN(CMouth); DEFFN(CNapkin); +DEFFN(CNose); DEFFN(CNote); DEFFN(CParcel); +DEFFN(CPerch); DEFFN(CPhonographCylinder); DEFFN(CPhonographEar); DEFFN(CPhotograph); @@ -328,6 +345,8 @@ DEFFN(CEjectPhonographButton); DEFFN(CEmmaControl); DEFFN(CEmptyNutBowl); DEFFN(CEnterExitFirstClassState); +DEFFN(CEnterExitView); +DEFFN(CFloorIndicator); DEFFN(CGamesConsole); DEFFN(CHammerDispensorButton); DEFFN(CHeadSmashEvent); @@ -336,8 +355,11 @@ DEFFN(CLemonDispensor); DEFFN(CLight); DEFFN(CLightSwitch); DEFFN(CLittleLiftButton); +DEFFN(CMaitreDArmHolder); DEFFN(CMusicalInstrument); +DEFFN(CMusicSystemLock); DEFFN(CNoNutBowl); +DEFFN(CNoseHolder); DEFFN(CNullPortHole); DEFFN(CNutReplacer); DEFFN(CPlayMusicButton); @@ -345,6 +367,7 @@ DEFFN(CPlayOnAct); DEFFN(CPortHole); DEFFN(CRecordPhonographButton); DEFFN(CReplacementEar); +DEFFN(CRestaurantCylinderHolder); DEFFN(CRoomItem); DEFFN(CSauceDispensor); DEFFN(CSeasonBackground); @@ -360,6 +383,8 @@ DEFFN(CSUBGlass); DEFFN(CSweetBowl); DEFFN(CTelevision); DEFFN(CThirdClassCanal); +DEFFN(CThrowTVDownWell); +DEFFN(CUpLighter); DEFFN(CWheelButton); DEFFN(CWheelHotSpot); DEFFN(CWheelSpin); @@ -373,6 +398,7 @@ DEFFN(CParrotNutEater); DEFFN(CParrotPerchHolder); DEFFN(CParrotSuccUBus); DEFFN(CParrotTrigger); +DEFFN(CPlayerMeetsParrot); DEFFN(CPET); DEFFN(CPETClass1); DEFFN(CPETClass2); @@ -648,6 +674,7 @@ void CSaveableObject::initClassList() { ADDFN(CCarryParrot); ADDFN(CCentralCore); ADDFN(CChicken); + ADDFN(CChickenCooler); ADDFN(CCrushedTV); ADDFN(CEar); ADDFN(CEye); @@ -657,13 +684,17 @@ void CSaveableObject::initClassList() { ADDFN(CHammer); ADDFN(CHeadPiece); ADDFN(CHose); + ADDFN(CHoseEnd); ADDFN(CKey); ADDFN(CLiftbotHead); ADDFN(CLongStick); ADDFN(CMagazine); + ADDFN(CMouth); ADDFN(CNapkin); + ADDFN(CNose); ADDFN(CNote); ADDFN(CParcel); + ADDFN(CPerch); ADDFN(CPhonographCylinder); ADDFN(CPhonographEar); ADDFN(CPhotograph); @@ -720,6 +751,8 @@ void CSaveableObject::initClassList() { ADDFN(CEmmaControl); ADDFN(CEmptyNutBowl); ADDFN(CEnterExitFirstClassState); + ADDFN(CEnterExitView); + ADDFN(CFloorIndicator); ADDFN(CGamesConsole); ADDFN(CHammerDispensorButton); ADDFN(CHeadSmashEvent); @@ -728,8 +761,11 @@ void CSaveableObject::initClassList() { ADDFN(CLight); ADDFN(CLightSwitch); ADDFN(CLittleLiftButton); + ADDFN(CMaitreDArmHolder); ADDFN(CMusicalInstrument); + ADDFN(CMusicSystemLock); ADDFN(CNoNutBowl); + ADDFN(CNoseHolder); ADDFN(CNullPortHole); ADDFN(CNutReplacer); ADDFN(CPETPosition); @@ -738,6 +774,7 @@ void CSaveableObject::initClassList() { ADDFN(CPortHole); ADDFN(CRecordPhonographButton); ADDFN(CReplacementEar); + ADDFN(CRestaurantCylinderHolder); ADDFN(CRoomItem); ADDFN(CSauceDispensor); ADDFN(CSeasonBackground); @@ -753,6 +790,8 @@ void CSaveableObject::initClassList() { ADDFN(CSweetBowl); ADDFN(CTelevision); ADDFN(CThirdClassCanal); + ADDFN(CThrowTVDownWell); + ADDFN(CUpLighter); ADDFN(CWheelButton); ADDFN(CWheelHotSpot); ADDFN(CWheelSpin); @@ -766,6 +805,7 @@ void CSaveableObject::initClassList() { ADDFN(CParrotPerchHolder); ADDFN(CParrotSuccUBus); ADDFN(CParrotTrigger); + ADDFN(CPlayerMeetsParrot); ADDFN(CPET); ADDFN(CPETClass1); ADDFN(CPETClass2); diff --git a/engines/titanic/game/chicken_cooler.cpp b/engines/titanic/game/chicken_cooler.cpp index feb3b4cade..335ed36fb6 100644 --- a/engines/titanic/game/chicken_cooler.cpp +++ b/engines/titanic/game/chicken_cooler.cpp @@ -26,11 +26,17 @@ namespace Titanic { void CChickenCooler::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + CGameObject::save(file, indent); } void CChickenCooler::load(SimpleFile *file) { file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + CGameObject::load(file); } diff --git a/engines/titanic/game/maitred_arm_holder.cpp b/engines/titanic/game/maitred_arm_holder.cpp new file mode 100644 index 0000000000..81ad43556b --- /dev/null +++ b/engines/titanic/game/maitred_arm_holder.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/maitred_arm_holder.h" + +namespace Titanic { + +void CMaitreDArmHolder::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CDropTarget::save(file, indent); +} + +void CMaitreDArmHolder::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/maitred_arm_holder.h b/engines/titanic/game/maitred_arm_holder.h new file mode 100644 index 0000000000..b838109fa3 --- /dev/null +++ b/engines/titanic/game/maitred_arm_holder.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_MAITRED_ARM_HOLDER_H +#define TITANIC_MAITRED_ARM_HOLDER_H + +#include "titanic/core/drop_target.h" + +namespace Titanic { + +class CMaitreDArmHolder : public CDropTarget { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMaitreDArmHolder"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MAITRED_ARM_HOLDER_H */ diff --git a/engines/titanic/game/music_system_lock.cpp b/engines/titanic/game/music_system_lock.cpp new file mode 100644 index 0000000000..a5419d983f --- /dev/null +++ b/engines/titanic/game/music_system_lock.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/music_system_lock.h" + +namespace Titanic { + +void CMusicSystemLock::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CDropTarget::save(file, indent); +} + +void CMusicSystemLock::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/music_system_lock.h b/engines/titanic/game/music_system_lock.h new file mode 100644 index 0000000000..98dc68b0dd --- /dev/null +++ b/engines/titanic/game/music_system_lock.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_MUSIC_SYSTEM_LOCK_H +#define TITANIC_MUSIC_SYSTEM_LOCK_H + +#include "titanic/core/drop_target.h" + +namespace Titanic { + +class CMusicSystemLock : public CDropTarget { +private: + int _value; +public: + CMusicSystemLock() : CDropTarget(), _value(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMusicSystemLock"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MUSIC_SYSTEM_LOCK_H */ diff --git a/engines/titanic/game/nose_holder.cpp b/engines/titanic/game/nose_holder.cpp new file mode 100644 index 0000000000..ba512d015a --- /dev/null +++ b/engines/titanic/game/nose_holder.cpp @@ -0,0 +1,44 @@ +/* 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 "titanic/game/nose_holder.h" + +namespace Titanic { + +CNoseHolder::CNoseHolder() : CDropTarget(), _field118(0), _field11C(0) { +} + +void CNoseHolder::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field11C, indent); + + CDropTarget::save(file, indent); +} + +void CNoseHolder::load(SimpleFile *file) { + file->readNumber(); + _field11C = file->readNumber(); + + CDropTarget::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/nose_holder.h b/engines/titanic/game/nose_holder.h new file mode 100644 index 0000000000..3512e62bb4 --- /dev/null +++ b/engines/titanic/game/nose_holder.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_NOSE_HOLDER_H +#define TITANIC_NOSE_HOLDER_H + +#include "titanic/core/drop_target.h" + +namespace Titanic { + +class CNoseHolder : public CDropTarget { +private: + int _field118; + int _field11C; +public: + CNoseHolder(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CNoseHolder"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_NOSE_HOLDER_H */ diff --git a/engines/titanic/game/restaurant_cylinder_holder.cpp b/engines/titanic/game/restaurant_cylinder_holder.cpp new file mode 100644 index 0000000000..1662064d17 --- /dev/null +++ b/engines/titanic/game/restaurant_cylinder_holder.cpp @@ -0,0 +1,58 @@ +/* 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 "titanic/game/restaurant_cylinder_holder.h" + +namespace Titanic { + +CRestaurantCylinderHolder::CRestaurantCylinderHolder() : CDropTarget(), + _field118(0), _field11C(0), _field12C(0), _field130(0), + _string6("z#61.wav"), _field140(1) { +} + +void CRestaurantCylinderHolder::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field118, indent); + file->writeNumberLine(_field11C, indent); + file->writeQuotedLine(_string5, indent); + file->writeNumberLine(_field12C, indent); + file->writeNumberLine(_field130, indent); + file->writeQuotedLine(_string6, indent); + file->writeNumberLine(_field140, indent); + + CDropTarget::save(file, indent); +} + +void CRestaurantCylinderHolder::load(SimpleFile *file) { + file->readNumber(); + _field118 = file->readNumber(); + _field11C = file->readNumber(); + _string5 = file->readString(); + _field12C = file->readNumber(); + _field130 = file->readNumber(); + _string6 = file->readString(); + _field140 = file->readNumber(); + + CDropTarget::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/restaurant_cylinder_holder.h b/engines/titanic/game/restaurant_cylinder_holder.h new file mode 100644 index 0000000000..29e2958f98 --- /dev/null +++ b/engines/titanic/game/restaurant_cylinder_holder.h @@ -0,0 +1,60 @@ +/* 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. + * + */ + +#ifndef TITANIC_RESTAURANT_CYLINDER_HOLDER_H +#define TITANIC_RESTAURANT_CYLINDER_HOLDER_H + +#include "titanic/core/drop_target.h" + +namespace Titanic { + +class CRestaurantCylinderHolder : public CDropTarget { +private: + int _field118; + int _field11C; + CString _string5; + int _field12C; + int _field130; + CString _string6; + int _field140; +public: + CRestaurantCylinderHolder(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CRestaurantCylinderHolder"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_RESTAURANT_CYLINDER_HOLDER_H */ diff --git a/engines/titanic/game/sgt/sgt_state_room.cpp b/engines/titanic/game/sgt/sgt_state_room.cpp index d244309351..e0d8de1282 100644 --- a/engines/titanic/game/sgt/sgt_state_room.cpp +++ b/engines/titanic/game/sgt/sgt_state_room.cpp @@ -24,7 +24,15 @@ namespace Titanic { -CSGTStateRoomStatics *_statics; +CSGTStateRoomStatics *CSGTStateRoom::_statics; + +void CSGTStateRoom::init() { + _statics = new CSGTStateRoomStatics(); +} + +void CSGTStateRoom::deinit() { + delete _statics; +} CSGTStateRoom::CSGTStateRoom() : CBackground(), _fieldE0(1), _fieldE4(1), _fieldE8(0), _fieldEC(1), _fieldF0(1) { diff --git a/engines/titanic/game/sgt/sgt_state_room.h b/engines/titanic/game/sgt/sgt_state_room.h index ba70e541a3..f67a916f1f 100644 --- a/engines/titanic/game/sgt/sgt_state_room.h +++ b/engines/titanic/game/sgt/sgt_state_room.h @@ -46,7 +46,7 @@ struct CSGTStateRoomStatics { class CSGTStateRoom : public CBackground { private: - CSGTStateRoomStatics *_statics; + static CSGTStateRoomStatics *_statics; private: int _fieldE0; int _fieldE4; @@ -55,6 +55,8 @@ private: int _fieldF0; public: CSGTStateRoom(); + static void init(); + static void deinit(); /** * Return the class name diff --git a/engines/titanic/game/up_lighter.cpp b/engines/titanic/game/up_lighter.cpp new file mode 100644 index 0000000000..0e6c4d88cc --- /dev/null +++ b/engines/titanic/game/up_lighter.cpp @@ -0,0 +1,51 @@ +/* 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 "titanic/game/up_lighter.h" + +namespace Titanic { + +CUpLighter::CUpLighter() : CDropTarget(), _field118(0), + _field11C(0), _field120(0), _field124(0) { +} + +void CUpLighter::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field118, indent); + file->writeNumberLine(_field11C, indent); + file->writeNumberLine(_field120, indent); + file->writeNumberLine(_field124, indent); + + CDropTarget::save(file, indent); +} + +void CUpLighter::load(SimpleFile *file) { + file->readNumber(); + _field118 = file->readNumber(); + _field11C = file->readNumber(); + _field120 = file->readNumber(); + _field124 = file->readNumber(); + + CDropTarget::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/up_lighter.h b/engines/titanic/game/up_lighter.h new file mode 100644 index 0000000000..e7c6cdf38e --- /dev/null +++ b/engines/titanic/game/up_lighter.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_UP_LIGHTER_H +#define TITANIC_UP_LIGHTER_H + +#include "titanic/core/drop_target.h" + +namespace Titanic { + +class CUpLighter : public CDropTarget { +private: + int _field118; + int _field11C; + int _field120; + int _field124; +public: + CUpLighter(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CUpLighter"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_UP_LIGHTER_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 5894bf3317..f9927867b5 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -33,6 +33,7 @@ MODULE_OBJS := \ carry/hammer.o \ carry/head_piece.o \ carry/hose.o \ + carry/hose_end.o \ carry/key.o \ carry/liftbot_head.o \ carry/long_stick.o \ @@ -42,6 +43,7 @@ MODULE_OBJS := \ carry/nose.o \ carry/note.o \ carry/parcel.o \ + carry/perch.o \ carry/phonograph_cylinder.o \ carry/phonograph_ear.o \ carry/photograph.o \ @@ -151,11 +153,14 @@ MODULE_OBJS := \ game/little_lift_button.o \ game/long_stick_dispenser.o \ game/mail_man.o \ + game/maitred_arm_holder.o \ game/missiveomat.o \ game/movie_tester.o \ + game/music_system_lock.o \ game/musical_instrument.o \ game/navigation_computer.o \ game/no_nut_bowl.o \ + game/nose_holder.o \ game/null_port_hole.o \ game/nut_replacer.o \ game/pet_controler.o \ @@ -170,6 +175,7 @@ MODULE_OBJS := \ game/record_phonograph_button.o \ game/replacement_ear.o \ game/reserved_table.o \ + game/restaurant_cylinder_holder.o \ game/room_item.o \ game/sauce_dispensor.o \ game/search_point.o \ @@ -195,6 +201,7 @@ MODULE_OBJS := \ game/tow_parrot_nav.o \ game/throw_tv_down_well.o \ game/titania_still_control.o \ + game/up_lighter.o \ game/wheel_button.o \ game/wheel_hotspot.o \ game/wheel_spin.o \ diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index b3aae7bf1b..62a0ae25c1 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -29,8 +29,10 @@ #include "graphics/thumbnail.h" #include "titanic/titanic.h" #include "titanic/core/saveable_object.h" -#include "titanic/game/parrot/parrot_lobby_object.h" #include "titanic/game/enter_exit_first_class_state.h" +#include "titanic/game/parrot/parrot_lobby_object.h" +#include "titanic/game/sgt/sgt_state_room.h" +#include "titanic/carry/hose.h" namespace Titanic { @@ -56,6 +58,8 @@ void TitanicEngine::initialize() { CSaveableObject::initClassList(); CParrotLobbyObject::init(); CEnterExitFirstClassState::init(); + CHose::init(); + CSGTStateRoom::init(); _screenManager = new OSScreenManager(this); _window = new CMainGameWindow(this); @@ -64,6 +68,8 @@ void TitanicEngine::initialize() { void TitanicEngine::deinitialize() { CEnterExitFirstClassState::deinit(); + CHose::deinit(); + CSGTStateRoom::deinit(); } Common::Error TitanicEngine::run() { -- cgit v1.2.3 From 32d84ed33d88e42bc521b3736b35bacdfa5c13e7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 1 Mar 2016 08:07:05 -0500 Subject: TITANIC: Added lots more miscellaneous classes --- engines/titanic/carry/chicken.cpp | 2 + engines/titanic/carry/phonograph_ear.cpp | 2 + engines/titanic/carry/phonograph_ear.h | 8 ++- engines/titanic/core/saveable_object.cpp | 74 +++++++++++++++++++++- engines/titanic/game/hammer_dispensor.cpp | 49 ++++++++++++++ engines/titanic/game/hammer_dispensor.h | 56 ++++++++++++++++ engines/titanic/game/hammer_dispensor_button.h | 6 +- engines/titanic/game/music_console_button.cpp | 37 +++++++++++ engines/titanic/game/music_console_button.h | 50 +++++++++++++++ engines/titanic/game/music_room_phonograph.cpp | 39 ++++++++++++ engines/titanic/game/music_room_phonograph.h | 54 ++++++++++++++++ .../game/music_room_stop_phonograph_button.cpp | 39 ++++++++++++ .../game/music_room_stop_phonograph_button.h | 54 ++++++++++++++++ engines/titanic/game/phonograph.cpp | 58 +++++++++++++++++ engines/titanic/game/phonograph.h | 60 ++++++++++++++++++ engines/titanic/game/restaurant_phonograph.cpp | 51 +++++++++++++++ engines/titanic/game/restaurant_phonograph.h | 57 +++++++++++++++++ engines/titanic/game/sauce_dispensor.cpp | 25 +++----- engines/titanic/game/sauce_dispensor.h | 6 +- engines/titanic/game/sgt/enter_exit_mini_lift.cpp | 43 +++++++++++++ engines/titanic/game/sgt/enter_exit_mini_lift.h | 55 ++++++++++++++++ engines/titanic/game/sgt/sgt_navigation.cpp | 18 ++++++ engines/titanic/game/sgt/sgt_navigation.h | 11 ++++ engines/titanic/game/sgt/sgt_restaurant_doors.cpp | 2 + engines/titanic/game/sgt/sgt_restaurant_doors.h | 4 ++ engines/titanic/game/transport/gondolier.cpp | 37 +++++++++++ engines/titanic/game/transport/gondolier.h | 50 +++++++++++++++ engines/titanic/game/transport/lift.cpp | 60 ++++++++++++++++++ engines/titanic/game/transport/lift.h | 61 ++++++++++++++++++ engines/titanic/game/transport/lift_indicator.cpp | 51 +++++++++++++++ engines/titanic/game/transport/lift_indicator.h | 57 +++++++++++++++++ engines/titanic/game/transport/pellerator.cpp | 37 +++++++++++ engines/titanic/game/transport/pellerator.h | 50 +++++++++++++++ .../titanic/game/transport/service_elevator.cpp | 51 +++++++++++++++ engines/titanic/game/transport/service_elevator.h | 57 +++++++++++++++++ engines/titanic/game/transport/transport.cpp | 46 ++++++++++++++ engines/titanic/game/transport/transport.h | 55 ++++++++++++++++ engines/titanic/gfx/volume_control.cpp | 48 ++++++++++++++ engines/titanic/gfx/volume_control.h | 56 ++++++++++++++++ engines/titanic/module.mk | 15 +++++ engines/titanic/sound/music_player.cpp | 10 +++ .../titanic/sound/restricted_auto_music_player.cpp | 47 ++++++++++++++ .../titanic/sound/restricted_auto_music_player.h | 55 ++++++++++++++++ engines/titanic/titanic.cpp | 3 + 44 files changed, 1679 insertions(+), 27 deletions(-) create mode 100644 engines/titanic/game/hammer_dispensor.cpp create mode 100644 engines/titanic/game/hammer_dispensor.h create mode 100644 engines/titanic/game/music_console_button.cpp create mode 100644 engines/titanic/game/music_console_button.h create mode 100644 engines/titanic/game/music_room_phonograph.cpp create mode 100644 engines/titanic/game/music_room_phonograph.h create mode 100644 engines/titanic/game/music_room_stop_phonograph_button.cpp create mode 100644 engines/titanic/game/music_room_stop_phonograph_button.h create mode 100644 engines/titanic/game/phonograph.cpp create mode 100644 engines/titanic/game/phonograph.h create mode 100644 engines/titanic/game/restaurant_phonograph.cpp create mode 100644 engines/titanic/game/restaurant_phonograph.h create mode 100644 engines/titanic/game/sgt/enter_exit_mini_lift.cpp create mode 100644 engines/titanic/game/sgt/enter_exit_mini_lift.h create mode 100644 engines/titanic/game/transport/gondolier.cpp create mode 100644 engines/titanic/game/transport/gondolier.h create mode 100644 engines/titanic/game/transport/lift.cpp create mode 100644 engines/titanic/game/transport/lift.h create mode 100644 engines/titanic/game/transport/lift_indicator.cpp create mode 100644 engines/titanic/game/transport/lift_indicator.h create mode 100644 engines/titanic/game/transport/pellerator.cpp create mode 100644 engines/titanic/game/transport/pellerator.h create mode 100644 engines/titanic/game/transport/service_elevator.cpp create mode 100644 engines/titanic/game/transport/service_elevator.h create mode 100644 engines/titanic/game/transport/transport.cpp create mode 100644 engines/titanic/game/transport/transport.h create mode 100644 engines/titanic/gfx/volume_control.cpp create mode 100644 engines/titanic/gfx/volume_control.h create mode 100644 engines/titanic/sound/restricted_auto_music_player.cpp create mode 100644 engines/titanic/sound/restricted_auto_music_player.h diff --git a/engines/titanic/carry/chicken.cpp b/engines/titanic/carry/chicken.cpp index 972c993ec4..52f3c25cef 100644 --- a/engines/titanic/carry/chicken.cpp +++ b/engines/titanic/carry/chicken.cpp @@ -34,6 +34,7 @@ void CChicken::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); file->writeNumberLine(_field12C, indent); file->writeQuotedLine(_string6, indent); + file->writeNumberLine(_v1, indent); file->writeNumberLine(_field13C, indent); file->writeNumberLine(_field140, indent); @@ -44,6 +45,7 @@ void CChicken::load(SimpleFile *file) { file->readNumber(); _field12C = file->readNumber(); _string6 = file->readString(); + _v1 = file->readNumber(); _field13C = file->readNumber(); _field140 = file->readNumber(); diff --git a/engines/titanic/carry/phonograph_ear.cpp b/engines/titanic/carry/phonograph_ear.cpp index 759356ab30..0b4142ca37 100644 --- a/engines/titanic/carry/phonograph_ear.cpp +++ b/engines/titanic/carry/phonograph_ear.cpp @@ -26,11 +26,13 @@ namespace Titanic { void CPhonographEar::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeNumberLine(_field140, indent); CEar::save(file, indent); } void CPhonographEar::load(SimpleFile *file) { file->readNumber(); + _field140 = file->readNumber(); CEar::load(file); } diff --git a/engines/titanic/carry/phonograph_ear.h b/engines/titanic/carry/phonograph_ear.h index 59042000c9..ec6cfedf5e 100644 --- a/engines/titanic/carry/phonograph_ear.h +++ b/engines/titanic/carry/phonograph_ear.h @@ -20,15 +20,19 @@ * */ -#ifndef TITANIC_PHONOGRAPH_EYE_H -#define TITANIC_PHONOGRAPH_EYE_H +#ifndef TITANIC_PHONOGRAPH_EAR_H +#define TITANIC_PHONOGRAPH_EAR_H #include "titanic/carry/ear.h" namespace Titanic { class CPhonographEar : public CEar { +private: + int _field140; public: + CPhonographEar() : CEar(), _field140(1) {} + /** * Return the class name */ diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 9267e17dae..8328aa5e49 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -69,6 +69,7 @@ #include "titanic/core/node_item.h" #include "titanic/core/project_item.h" #include "titanic/core/saveable_object.h" +#include "titanic/core/static_image.h" #include "titanic/core/turn_on_object.h" #include "titanic/core/turn_on_play_sound.h" #include "titanic/core/tree_item.h" @@ -84,6 +85,7 @@ #include "titanic/game/bridge_view.h" #include "titanic/game/broken_pell_base.h" #include "titanic/game/cage.h" +#include "titanic/game/call_pellerator.h" #include "titanic/game/captains_wheel.h" #include "titanic/game/cdrom.h" #include "titanic/game/cdrom_computer.h" @@ -107,8 +109,15 @@ #include "titanic/game/empty_nut_bowl.h" #include "titanic/game/enter_exit_first_class_state.h" #include "titanic/game/enter_exit_view.h" +#include "titanic/game/fan.h" +#include "titanic/game/fan_control.h" +#include "titanic/game/fan_decrease.h" +#include "titanic/game/fan_increase.h" +#include "titanic/game/fan_noises.h" #include "titanic/game/floor_indicator.h" #include "titanic/game/games_console.h" +#include "titanic/game/hammer_clip.h" +#include "titanic/game/hammer_dispensor.h" #include "titanic/game/hammer_dispensor_button.h" #include "titanic/game/head_smash_event.h" #include "titanic/game/head_smash_lever.h" @@ -118,17 +127,22 @@ #include "titanic/game/little_lift_button.h" #include "titanic/game/maitred_arm_holder.h" #include "titanic/game/musical_instrument.h" +#include "titanic/game/music_console_button.h" +#include "titanic/game/music_room_phonograph.h" +#include "titanic/game/music_room_stop_phonograph_button.h" #include "titanic/game/music_system_lock.h" #include "titanic/game/no_nut_bowl.h" #include "titanic/game/nose_holder.h" #include "titanic/game/null_port_hole.h" #include "titanic/game/nut_replacer.h" +#include "titanic/game/phonograph.h" #include "titanic/game/play_music_button.h" #include "titanic/game/play_on_act.h" #include "titanic/game/port_hole.h" #include "titanic/game/record_phonograph_button.h" #include "titanic/game/replacement_ear.h" #include "titanic/game/restaurant_cylinder_holder.h" +#include "titanic/game/restaurant_phonograph.h" #include "titanic/game/room_item.h" #include "titanic/game/sauce_dispensor.h" #include "titanic/game/season_background.h" @@ -138,6 +152,7 @@ #include "titanic/game/service_elevator_window.h" #include "titanic/game/ship_setting.h" #include "titanic/game/speech_dispensor.h" +#include "titanic/game/starling_puret.h" #include "titanic/game/start_action.h" #include "titanic/game/stop_phonograph_button.h" #include "titanic/game/sub_glass.h" @@ -170,11 +185,18 @@ #include "titanic/game/pet/pet_sounds.h" #include "titanic/game/pet/pet_transition.h" #include "titanic/game/pet/pet_transport.h" +#include "titanic/game/sgt/enter_exit_mini_lift.h" #include "titanic/game/sgt/sgt_doors.h" #include "titanic/game/sgt/sgt_navigation.h" #include "titanic/game/sgt/sgt_restaurant_doors.h" #include "titanic/game/sgt/sgt_state_room.h" #include "titanic/game/sgt/sgt_upper_doors_sound.h" +#include "titanic/game/transport/gondolier.h" +#include "titanic/game/transport/lift.h" +#include "titanic/game/transport/lift_indicator.h" +#include "titanic/game/transport/pellerator.h" +#include "titanic/game/transport/service_elevator.h" +#include "titanic/game/transport/transport.h" #include "titanic/gfx/act_button.h" #include "titanic/gfx/changes_season_button.h" #include "titanic/gfx/chev_left_off.h" @@ -213,6 +235,7 @@ #include "titanic/gfx/status_change_button.h" #include "titanic/gfx/st_button.h" #include "titanic/gfx/toggle_switch.h" +#include "titanic/gfx/volume_control.h" #include "titanic/messages/messages.h" #include "titanic/messages/mouse_messages.h" #include "titanic/messages/pet_messages.h" @@ -249,6 +272,7 @@ #include "titanic/sound/auto_sound_player.h" #include "titanic/sound/background_sound_maker.h" #include "titanic/sound/music_player.h" +#include "titanic/sound/restricted_auto_music_player.h" #include "titanic/sound/seasonal_music_player.h" #include "titanic/sound/titania_speech.h" #include "titanic/sound/trigger_auto_music_player.h" @@ -310,6 +334,7 @@ DEFFN(CMovieClipList); DEFFN(CMultiDropTarget); DEFFN(CNodeItem); DEFFN(CProjectItem); +DEFFN(CStaticImage); DEFFN(CTurnOnObject); DEFFN(CTurnOnPlaySound); DEFFN(CTreeItem); @@ -325,6 +350,7 @@ DEFFN(CBomb); DEFFN(CBridgeView); DEFFN(CBrokenPellBase) DEFFN(CCage); +DEFFN(CCallPellerator); DEFFN(CCaptainsWheel); DEFFN(CCDROM); DEFFN(CCDROMComputer); @@ -346,8 +372,15 @@ DEFFN(CEmmaControl); DEFFN(CEmptyNutBowl); DEFFN(CEnterExitFirstClassState); DEFFN(CEnterExitView); +DEFFN(CFan); +DEFFN(CFanControl); +DEFFN(CFanDecrease); +DEFFN(CFanIncrease); +DEFFN(CFanNoises); DEFFN(CFloorIndicator); DEFFN(CGamesConsole); +DEFFN(CHammerClip); +DEFFN(CHammerDispensor); DEFFN(CHammerDispensorButton); DEFFN(CHeadSmashEvent); DEFFN(CHeadSmashLever); @@ -357,17 +390,22 @@ DEFFN(CLightSwitch); DEFFN(CLittleLiftButton); DEFFN(CMaitreDArmHolder); DEFFN(CMusicalInstrument); +DEFFN(CMusicConsoleButton); +DEFFN(CMusicRoomPhonograph); +DEFFN(CMusicRoomStopPhonographButton); DEFFN(CMusicSystemLock); DEFFN(CNoNutBowl); DEFFN(CNoseHolder); DEFFN(CNullPortHole); DEFFN(CNutReplacer); +DEFFN(CPhonograph); DEFFN(CPlayMusicButton); DEFFN(CPlayOnAct); DEFFN(CPortHole); DEFFN(CRecordPhonographButton); DEFFN(CReplacementEar); DEFFN(CRestaurantCylinderHolder); +DEFFN(CRestaurantPhonograph); DEFFN(CRoomItem); DEFFN(CSauceDispensor); DEFFN(CSeasonBackground); @@ -377,6 +415,7 @@ DEFFN(CServiceElevatorDoor); DEFFN(CServiceElevatorWindow); DEFFN(CShipSetting); DEFFN(CSpeechDispensor); +DEFFN(CStarlingPuret); DEFFN(CStartAction); DEFFN(CStopPhonographButton); DEFFN(CSUBGlass); @@ -409,11 +448,18 @@ DEFFN(CPETSentinal); DEFFN(CPETSounds); DEFFN(CPETTransition); DEFFN(CPETTransport); +DEFFN(CEnterExitMiniLift); DEFFN(CSGTDoors); DEFFN(CSGTNavigation); DEFFN(CSGTRestaurantDoors); DEFFN(CSGTStateRoom); DEFFN(CSGTUpperDoorsSound); +DEFFN(CGondolier); +DEFFN(CLift); +DEFFN(CLiftindicator); +DEFFN(CPellerator); +DEFFN(CServiceElevator); +DEFFN(CTransport); DEFFN(CActButton); DEFFN(CChangesSeasonButton); @@ -453,6 +499,7 @@ DEFFN(CSmallChevRightOff); DEFFN(CSmallChevRightOn); DEFFN(CStatusChangeButton); DEFFN(CSTButton); +DEFFN(CVolumeControl); DEFFN(CActMsg); DEFFN(CActivationmsg); @@ -660,6 +707,7 @@ DEFFN(CAutoMusicPlayerBase); DEFFN(CAutoSoundPlayer); DEFFN(CBackgroundSoundMaker); DEFFN(CMusicPlayer); +DEFFN(CRestrictedAutoMusicPlayer); DEFFN(CSeasonalMusicPlayer); DEFFN(CTitaniaSpeech); DEFFN(CTriggerAutoMusicPlayer); @@ -715,6 +763,7 @@ void CSaveableObject::initClassList() { ADDFN(CMultiDropTarget); ADDFN(CNodeItem); ADDFN(CProjectItem); + ADDFN(CStaticImage); ADDFN(CTreeItem); ADDFN(CTurnOnObject); ADDFN(CTurnOnPlaySound); @@ -730,6 +779,7 @@ void CSaveableObject::initClassList() { ADDFN(CBridgeView); ADDFN(CBrokenPellBase); ADDFN(CCage); + ADDFN(CCallPellerator); ADDFN(CCaptainsWheel); ADDFN(CCDROM); ADDFN(CCDROMComputer); @@ -752,8 +802,15 @@ void CSaveableObject::initClassList() { ADDFN(CEmptyNutBowl); ADDFN(CEnterExitFirstClassState); ADDFN(CEnterExitView); + ADDFN(CFan); + ADDFN(CFanControl); + ADDFN(CFanDecrease); + ADDFN(CFanIncrease); + ADDFN(CFanNoises); ADDFN(CFloorIndicator); ADDFN(CGamesConsole); + ADDFN(CHammerClip); + ADDFN(CHammerDispensor); ADDFN(CHammerDispensorButton); ADDFN(CHeadSmashEvent); ADDFN(CHeadSmashLever); @@ -763,18 +820,22 @@ void CSaveableObject::initClassList() { ADDFN(CLittleLiftButton); ADDFN(CMaitreDArmHolder); ADDFN(CMusicalInstrument); + ADDFN(CMusicConsoleButton); + ADDFN(CMusicRoomPhonograph); + ADDFN(CMusicRoomStopPhonographButton); ADDFN(CMusicSystemLock); ADDFN(CNoNutBowl); ADDFN(CNoseHolder); ADDFN(CNullPortHole); ADDFN(CNutReplacer); - ADDFN(CPETPosition); + ADDFN(CPhonograph); ADDFN(CPlayMusicButton); ADDFN(CPlayOnAct); ADDFN(CPortHole); ADDFN(CRecordPhonographButton); ADDFN(CReplacementEar); ADDFN(CRestaurantCylinderHolder); + ADDFN(CRestaurantPhonograph); ADDFN(CRoomItem); ADDFN(CSauceDispensor); ADDFN(CSeasonBackground); @@ -784,6 +845,7 @@ void CSaveableObject::initClassList() { ADDFN(CServiceElevatorWindow); ADDFN(CShipSetting); ADDFN(CSpeechDispensor); + ADDFN(CStarlingPuret); ADDFN(CStartAction); ADDFN(CStopPhonographButton); ADDFN(CSUBGlass); @@ -816,11 +878,18 @@ void CSaveableObject::initClassList() { ADDFN(CPETSounds); ADDFN(CPETTransition); ADDFN(CPETTransport); + ADDFN(CEnterExitMiniLift); ADDFN(CSGTDoors); ADDFN(CSGTNavigation); ADDFN(CSGTRestaurantDoors); ADDFN(CSGTStateRoom); ADDFN(CSGTUpperDoorsSound); + ADDFN(CGondolier); + ADDFN(CLift); + ADDFN(CLiftindicator); + ADDFN(CPellerator); + ADDFN(CServiceElevator); + ADDFN(CTransport); ADDFN(CActButton); ADDFN(CChangesSeasonButton); @@ -848,6 +917,7 @@ void CSaveableObject::initClassList() { ADDFN(CMusicSwitch); ADDFN(CMusicSwitchInversion); ADDFN(CMusicSwitchReverse); + ADDFN(CMusicVoiceMute); ADDFN(CPetModeOff); ADDFN(CPetModeOn); ADDFN(CPetModePanel); @@ -859,6 +929,7 @@ void CSaveableObject::initClassList() { ADDFN(CSmallChevRightOn); ADDFN(CStatusChangeButton); ADDFN(CSTButton); + ADDFN(CVolumeControl); ADDFN(CActMsg); ADDFN(CActivationmsg); @@ -1067,6 +1138,7 @@ void CSaveableObject::initClassList() { ADDFN(CAutoSoundPlayer); ADDFN(CBackgroundSoundMaker); ADDFN(CMusicPlayer); + ADDFN(CRestrictedAutoMusicPlayer); ADDFN(CSeasonalMusicPlayer); ADDFN(CAutoMusicPlayer); ADDFN(CTitaniaSpeech); diff --git a/engines/titanic/game/hammer_dispensor.cpp b/engines/titanic/game/hammer_dispensor.cpp new file mode 100644 index 0000000000..d486910843 --- /dev/null +++ b/engines/titanic/game/hammer_dispensor.cpp @@ -0,0 +1,49 @@ +/* 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 "titanic/game/hammer_dispensor.h" + +namespace Titanic { + +CHammerDispensor::CHammerDispensor() : CBackground(), + _fieldE0(0), _fieldE4(0), _fieldE8(0) { +} + +void CHammerDispensor::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + + CBackground::save(file, indent); +} + +void CHammerDispensor::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/hammer_dispensor.h b/engines/titanic/game/hammer_dispensor.h new file mode 100644 index 0000000000..60b70546fd --- /dev/null +++ b/engines/titanic/game/hammer_dispensor.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_HAMMER_DISPENSOR_H +#define TITANIC_HAMMER_DISPENSOR_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CHammerDispensor : public CBackground { +private: + int _fieldE0; + int _fieldE4; + int _fieldE8; +public: + CHammerDispensor(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CHammerDispensor"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_HAMMER_DISPENSOR_H */ diff --git a/engines/titanic/game/hammer_dispensor_button.h b/engines/titanic/game/hammer_dispensor_button.h index e4b5fc13b1..978c1d3c9f 100644 --- a/engines/titanic/game/hammer_dispensor_button.h +++ b/engines/titanic/game/hammer_dispensor_button.h @@ -20,8 +20,8 @@ * */ -#ifndef TITANIC_HAMMER_DISPENSOR_H -#define TITANIC_HAMMER_DISPENSOR_H +#ifndef TITANIC_HAMMER_DISPENSOR_BUTTON_H +#define TITANIC_HAMMER_DISPENSOR_BUTTON_H #include "titanic/game/start_action.h" @@ -57,4 +57,4 @@ public: } // End of namespace Titanic -#endif /* TITANIC_HAMMER_DISPENSOR_H */ +#endif /* TITANIC_HAMMER_DISPENSOR_BUTTON_H */ diff --git a/engines/titanic/game/music_console_button.cpp b/engines/titanic/game/music_console_button.cpp new file mode 100644 index 0000000000..d92dd4d3bb --- /dev/null +++ b/engines/titanic/game/music_console_button.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/music_console_button.h" + +namespace Titanic { + +void CMusicConsoleButton::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CMusicPlayer::save(file, indent); +} + +void CMusicConsoleButton::load(SimpleFile *file) { + file->readNumber(); + CMusicPlayer::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/music_console_button.h b/engines/titanic/game/music_console_button.h new file mode 100644 index 0000000000..84a7452b28 --- /dev/null +++ b/engines/titanic/game/music_console_button.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_MUSIC_CONSOLE_BUTTON_H +#define TITANIC_MUSIC_CONSOLE_BUTTON_H + +#include "titanic/sound/music_player.h" + +namespace Titanic { + +class CMusicConsoleButton : public CMusicPlayer { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMusicConsoleButton"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MUSIC_CONSOLE_BUTTON_H */ diff --git a/engines/titanic/game/music_room_phonograph.cpp b/engines/titanic/game/music_room_phonograph.cpp new file mode 100644 index 0000000000..7fa30f5dcf --- /dev/null +++ b/engines/titanic/game/music_room_phonograph.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/music_room_phonograph.h" + +namespace Titanic { + +void CMusicRoomPhonograph::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field118, indent); + CRestaurantPhonograph::save(file, indent); +} + +void CMusicRoomPhonograph::load(SimpleFile *file) { + file->readNumber(); + _field118 = file->readNumber(); + CRestaurantPhonograph::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/music_room_phonograph.h b/engines/titanic/game/music_room_phonograph.h new file mode 100644 index 0000000000..2d34b160c9 --- /dev/null +++ b/engines/titanic/game/music_room_phonograph.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_MUSIC_ROOM_PHONOGRAPH_H +#define TITANIC_MUSIC_ROOM_PHONOGRAPH_H + +#include "titanic/game/restaurant_phonograph.h" + +namespace Titanic { + +class CMusicRoomPhonograph : public CRestaurantPhonograph { +private: + int _field118; +public: + CMusicRoomPhonograph() : CRestaurantPhonograph(), _field118(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMusicRoomPhonograph"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MUSIC_ROOM_PHONOGRAPH_H */ diff --git a/engines/titanic/game/music_room_stop_phonograph_button.cpp b/engines/titanic/game/music_room_stop_phonograph_button.cpp new file mode 100644 index 0000000000..7e00bade35 --- /dev/null +++ b/engines/titanic/game/music_room_stop_phonograph_button.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/music_room_stop_phonograph_button.h" + +namespace Titanic { + +void CMusicRoomStopPhonographButton::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field100, indent); + CEjectPhonographButton::save(file, indent); +} + +void CMusicRoomStopPhonographButton::load(SimpleFile *file) { + file->readNumber(); + _field100 = file->readNumber(); + CEjectPhonographButton::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/music_room_stop_phonograph_button.h b/engines/titanic/game/music_room_stop_phonograph_button.h new file mode 100644 index 0000000000..4fd4aa6535 --- /dev/null +++ b/engines/titanic/game/music_room_stop_phonograph_button.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_MUSIC_ROOM_STOP_PHONOGRAPH_BUTTON_H +#define TITANIC_MUSIC_ROOM_STOP_PHONOGRAPH_BUTTON_H + +#include "titanic/game/eject_phonograph_button.h" + +namespace Titanic { + +class CMusicRoomStopPhonographButton : public CEjectPhonographButton { +private: + int _field100; +public: + CMusicRoomStopPhonographButton() : CEjectPhonographButton(), _field100(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMusicRoomStopPhonographButton"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MUSIC_ROOM_STOP_PHONOGRAPH_BUTTON_H */ diff --git a/engines/titanic/game/phonograph.cpp b/engines/titanic/game/phonograph.cpp new file mode 100644 index 0000000000..3461e34cb6 --- /dev/null +++ b/engines/titanic/game/phonograph.cpp @@ -0,0 +1,58 @@ +/* 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 "titanic/game/phonograph.h" + +namespace Titanic { + +CPhonograph::CPhonograph() : CMusicPlayer(), + _fieldE0(0), _fieldE4(0), _fieldE8(0), _fieldEC(0), + _fieldF0(0), _fieldF4(0) { +} + +void CPhonograph::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string2, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_fieldEC, indent); + file->writeNumberLine(_fieldF0, indent); + file->writeNumberLine(_fieldF4, indent); + + CMusicPlayer::save(file, indent); +} + +void CPhonograph::load(SimpleFile *file) { + file->readNumber(); + _string2 = file->readString(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + _fieldEC = file->readNumber(); + _fieldF0 = file->readNumber(); + _fieldF4 = file->readNumber(); + + CMusicPlayer::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/phonograph.h b/engines/titanic/game/phonograph.h new file mode 100644 index 0000000000..e7fcddf0ae --- /dev/null +++ b/engines/titanic/game/phonograph.h @@ -0,0 +1,60 @@ +/* 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. + * + */ + +#ifndef TITANIC_PHONOGRAPH_H +#define TITANIC_PHONOGRAPH_H + +#include "titanic/sound/music_player.h" + +namespace Titanic { + +class CPhonograph : public CMusicPlayer { +protected: + CString _string2; + int _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; + int _fieldF0; + int _fieldF4; +public: + CPhonograph(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPhonograph"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MUSIC_CONSOLE_BUTTON_H */ diff --git a/engines/titanic/game/restaurant_phonograph.cpp b/engines/titanic/game/restaurant_phonograph.cpp new file mode 100644 index 0000000000..c73bd51d34 --- /dev/null +++ b/engines/titanic/game/restaurant_phonograph.cpp @@ -0,0 +1,51 @@ +/* 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 "titanic/game/restaurant_phonograph.h" + +namespace Titanic { + +CRestaurantPhonograph::CRestaurantPhonograph() : CPhonograph(), + _fieldF8(1), _field114(0) {} + +void CRestaurantPhonograph::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldF8, indent); + file->writeQuotedLine(_string2, indent); + file->writeQuotedLine(_string3, indent); + + file->writeNumberLine(_field114, indent); + + CPhonograph::save(file, indent); +} + +void CRestaurantPhonograph::load(SimpleFile *file) { + file->readNumber(); + _fieldF8 = file->readNumber(); + _string2 = file->readString(); + _string3 = file->readString(); + _field114 = file->readNumber(); + + CPhonograph::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/restaurant_phonograph.h b/engines/titanic/game/restaurant_phonograph.h new file mode 100644 index 0000000000..777ec34358 --- /dev/null +++ b/engines/titanic/game/restaurant_phonograph.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_RESTAURANT_PHONOGRAPH_H +#define TITANIC_RESTAURANT_PHONOGRAPH_H + +#include "titanic/game/phonograph.h" + +namespace Titanic { + +class CRestaurantPhonograph : public CPhonograph { +private: + int _fieldF8; + CString _string2; + CString _string3; + int _field114; +public: + CRestaurantPhonograph(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CRestaurantPhonograph"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_RESTAURANT_PHONOGRAPH_H */ diff --git a/engines/titanic/game/sauce_dispensor.cpp b/engines/titanic/game/sauce_dispensor.cpp index 4982df6e26..6365f6e57b 100644 --- a/engines/titanic/game/sauce_dispensor.cpp +++ b/engines/titanic/game/sauce_dispensor.cpp @@ -24,25 +24,17 @@ namespace Titanic { -CSauceDispensor::CSauceDispensor() : CBackground() { - _fieldEC = 0; - _fieldF0 = 0; - _fieldF4 = 0; - _fieldF8 = 0; - _fieldFC = 0; - _field100 = 0; - _field104 = 0; - _field108 = 0; +CSauceDispensor::CSauceDispensor() : CBackground(), + _fieldEC(0), _fieldF0(0), _field104(0), _field108(0) { } void CSauceDispensor::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeQuotedLine(_string3, indent); file->writeNumberLine(_fieldEC, indent); file->writeNumberLine(_fieldF0, indent); - file->writeNumberLine(_fieldF4, indent); - file->writeNumberLine(_fieldF8, indent); - file->writeNumberLine(_fieldFC, indent); - file->writeNumberLine(_field100, indent); + file->writePoint(_pos1, indent); + file->writePoint(_pos2, indent); file->writeNumberLine(_field104, indent); file->writeNumberLine(_field108, indent); @@ -51,12 +43,11 @@ void CSauceDispensor::save(SimpleFile *file, int indent) const { void CSauceDispensor::load(SimpleFile *file) { file->readNumber(); + _string3 = file->readString(); _fieldEC = file->readNumber(); _fieldF0 = file->readNumber(); - _fieldF4 = file->readNumber(); - _fieldF8 = file->readNumber(); - _fieldFC = file->readNumber(); - _field100 = file->readNumber(); + _pos1 = file->readPoint(); + _pos2 = file->readPoint(); _field104 = file->readNumber(); _field108 = file->readNumber(); diff --git a/engines/titanic/game/sauce_dispensor.h b/engines/titanic/game/sauce_dispensor.h index 791839d545..fd9afd979c 100644 --- a/engines/titanic/game/sauce_dispensor.h +++ b/engines/titanic/game/sauce_dispensor.h @@ -32,10 +32,8 @@ public: CString _string3; int _fieldEC; int _fieldF0; - int _fieldF4; - int _fieldF8; - int _fieldFC; - int _field100; + Common::Point _pos1; + Common::Point _pos2; int _field104; int _field108; public: diff --git a/engines/titanic/game/sgt/enter_exit_mini_lift.cpp b/engines/titanic/game/sgt/enter_exit_mini_lift.cpp new file mode 100644 index 0000000000..a7f85b9952 --- /dev/null +++ b/engines/titanic/game/sgt/enter_exit_mini_lift.cpp @@ -0,0 +1,43 @@ +/* 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 "titanic/game/sgt/enter_exit_mini_lift.h" + +namespace Titanic { + +void CEnterExitMiniLift::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + + CSGTNavigation::save(file, indent); +} + +void CEnterExitMiniLift::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + + CSGTNavigation::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/enter_exit_mini_lift.h b/engines/titanic/game/sgt/enter_exit_mini_lift.h new file mode 100644 index 0000000000..417e25d13f --- /dev/null +++ b/engines/titanic/game/sgt/enter_exit_mini_lift.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_ENTER_EXIT_MINI_LIFT_H +#define TITANIC_ENTER_EXIT_MINI_LIFT_H + +#include "titanic/game/sgt/sgt_navigation.h" + +namespace Titanic { + +class CEnterExitMiniLift : public CSGTNavigation { +private: + int _fieldBC; + int _fieldC0; +public: + CEnterExitMiniLift() : CSGTNavigation(), _fieldBC(0), _fieldC0(1) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CEnterExitMiniLift"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ENTER_EXIT_MINI_LIFT_H */ diff --git a/engines/titanic/game/sgt/sgt_navigation.cpp b/engines/titanic/game/sgt/sgt_navigation.cpp index eba37fd4f3..666459bbf1 100644 --- a/engines/titanic/game/sgt/sgt_navigation.cpp +++ b/engines/titanic/game/sgt/sgt_navigation.cpp @@ -24,13 +24,31 @@ namespace Titanic { +CSGTNavigationStatics *CSGTNavigation::_statics; + +void CSGTNavigation::init() { + _statics = new CSGTNavigationStatics(); +} + +void CSGTNavigation::deinit() { + delete _statics; +} + void CSGTNavigation::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeNumberLine(_statics->_v1, indent); + file->writeQuotedLine(_statics->_v2, indent); + file->writeQuotedLine(_statics->_v3, indent); + CGameObject::save(file, indent); } void CSGTNavigation::load(SimpleFile *file) { file->readNumber(); + _statics->_v1 = file->readNumber(); + _statics->_v2 = file->readString(); + _statics->_v3 = file->readString(); + CGameObject::load(file); } diff --git a/engines/titanic/game/sgt/sgt_navigation.h b/engines/titanic/game/sgt/sgt_navigation.h index 15c903f35c..539a6073a8 100644 --- a/engines/titanic/game/sgt/sgt_navigation.h +++ b/engines/titanic/game/sgt/sgt_navigation.h @@ -27,8 +27,19 @@ namespace Titanic { +struct CSGTNavigationStatics { + int _v1; + CString _v2; + CString _v3; +}; + class CSGTNavigation : public CGameObject { +private: + static CSGTNavigationStatics *_statics; public: + static void init(); + static void deinit(); + /** * Return the class name */ diff --git a/engines/titanic/game/sgt/sgt_restaurant_doors.cpp b/engines/titanic/game/sgt/sgt_restaurant_doors.cpp index e7d8f7bda1..1e4a167357 100644 --- a/engines/titanic/game/sgt/sgt_restaurant_doors.cpp +++ b/engines/titanic/game/sgt/sgt_restaurant_doors.cpp @@ -26,11 +26,13 @@ namespace Titanic { void CSGTRestaurantDoors::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); CGameObject::save(file, indent); } void CSGTRestaurantDoors::load(SimpleFile *file) { file->readNumber(); + _fieldBC = file->readNumber(); CGameObject::load(file); } diff --git a/engines/titanic/game/sgt/sgt_restaurant_doors.h b/engines/titanic/game/sgt/sgt_restaurant_doors.h index 287452e074..904c0c6b60 100644 --- a/engines/titanic/game/sgt/sgt_restaurant_doors.h +++ b/engines/titanic/game/sgt/sgt_restaurant_doors.h @@ -28,7 +28,11 @@ namespace Titanic { class CSGTRestaurantDoors : public CGameObject { +private: + int _fieldBC; public: + CSGTRestaurantDoors() : CGameObject(), _fieldBC(0) {} + /** * Return the class name */ diff --git a/engines/titanic/game/transport/gondolier.cpp b/engines/titanic/game/transport/gondolier.cpp new file mode 100644 index 0000000000..f67a3b68d9 --- /dev/null +++ b/engines/titanic/game/transport/gondolier.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/transport/gondolier.h" + +namespace Titanic { + +void CGondolier::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CTransport::save(file, indent); +} + +void CGondolier::load(SimpleFile *file) { + file->readNumber(); + CTransport::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/transport/gondolier.h b/engines/titanic/game/transport/gondolier.h new file mode 100644 index 0000000000..1d874beb3a --- /dev/null +++ b/engines/titanic/game/transport/gondolier.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_GONDOLIER_H +#define TITANIC_GONDOLIER_H + +#include "titanic/game/transport/transport.h" + +namespace Titanic { + +class CGondolier : public CTransport { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CGondolier"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_GONDOLIER_H */ diff --git a/engines/titanic/game/transport/lift.cpp b/engines/titanic/game/transport/lift.cpp new file mode 100644 index 0000000000..1e21b9f582 --- /dev/null +++ b/engines/titanic/game/transport/lift.cpp @@ -0,0 +1,60 @@ +/* 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 "titanic/game/transport/lift.h" + +namespace Titanic { + +int CLift::_v1; +int CLift::_v2; +int CLift::_v3; +int CLift::_v4; +int CLift::_v5; +int CLift::_v6; + +void CLift::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_v2, indent); + file->writeNumberLine(_v3, indent); + file->writeNumberLine(_v4, indent); + file->writeNumberLine(_v5, indent); + file->writeNumberLine(_fieldF8, indent); + file->writeNumberLine(_v6, indent); + + CTransport::save(file, indent); +} + +void CLift::load(SimpleFile *file) { + file->readNumber(); + _v1 = file->readNumber(); + _v2 = file->readNumber(); + _v3 = file->readNumber(); + _v4 = file->readNumber(); + _v5 = file->readNumber(); + _fieldF8 = file->readNumber(); + _v6 = file->readNumber(); + + CTransport::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/transport/lift.h b/engines/titanic/game/transport/lift.h new file mode 100644 index 0000000000..acb5fde45b --- /dev/null +++ b/engines/titanic/game/transport/lift.h @@ -0,0 +1,61 @@ +/* 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. +* +*/ + +#ifndef TITANIC_LIFT_H +#define TITANIC_LIFT_H + +#include "titanic/game/transport/transport.h" + +namespace Titanic { + +class CLift : public CTransport { +private: + static int _v1; + static int _v2; + static int _v3; + static int _v4; + static int _v5; + static int _v6; + + int _fieldF8; +public: + CLift() : CTransport(), _fieldF8(1) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CLift"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_LIFT_H */ diff --git a/engines/titanic/game/transport/lift_indicator.cpp b/engines/titanic/game/transport/lift_indicator.cpp new file mode 100644 index 0000000000..ebeaf55e2e --- /dev/null +++ b/engines/titanic/game/transport/lift_indicator.cpp @@ -0,0 +1,51 @@ +/* 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 "titanic/game/transport/lift_indicator.h" + +namespace Titanic { + +CLiftindicator::CLiftindicator() : CLift(), + _fieldFC(0), _field108(0), _field10C(0) { +} + +void CLiftindicator::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldFC, indent); + file->writePoint(_pos2, indent); + file->writeNumberLine(_field108, indent); + file->writeNumberLine(_field10C, indent); + + CLift::save(file, indent); +} + +void CLiftindicator::load(SimpleFile *file) { + file->readNumber(); + _fieldFC = file->readNumber(); + _pos2 = file->readPoint(); + _field108 = file->readNumber(); + _field10C = file->readNumber(); + + CLift::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/transport/lift_indicator.h b/engines/titanic/game/transport/lift_indicator.h new file mode 100644 index 0000000000..bbd6cb2867 --- /dev/null +++ b/engines/titanic/game/transport/lift_indicator.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_LIFT_INDICATOR_H +#define TITANIC_LIFT_INDICATOR_H + +#include "titanic/game/transport/lift.h" + +namespace Titanic { + +class CLiftindicator : public CLift { +private: + int _fieldFC; + Common::Point _pos2; + int _field108; + int _field10C; +public: + CLiftindicator(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CLiftindicator"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_LIFT_INDICATOR_H */ diff --git a/engines/titanic/game/transport/pellerator.cpp b/engines/titanic/game/transport/pellerator.cpp new file mode 100644 index 0000000000..1ab8935008 --- /dev/null +++ b/engines/titanic/game/transport/pellerator.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/transport/pellerator.h" + +namespace Titanic { + +void CPellerator::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CTransport::save(file, indent); +} + +void CPellerator::load(SimpleFile *file) { + file->readNumber(); + CTransport::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/transport/pellerator.h b/engines/titanic/game/transport/pellerator.h new file mode 100644 index 0000000000..6ccc56f595 --- /dev/null +++ b/engines/titanic/game/transport/pellerator.h @@ -0,0 +1,50 @@ +/* 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. +* +*/ + +#ifndef TITANIC_PELLERATOR_H +#define TITANIC_PELLERATOR_H + +#include "titanic/game/transport/transport.h" + +namespace Titanic { + +class CPellerator : public CTransport { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPellerator"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PELLERATOR_H */ diff --git a/engines/titanic/game/transport/service_elevator.cpp b/engines/titanic/game/transport/service_elevator.cpp new file mode 100644 index 0000000000..df88c13454 --- /dev/null +++ b/engines/titanic/game/transport/service_elevator.cpp @@ -0,0 +1,51 @@ +/* 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 "titanic/game/transport/service_elevator.h" + +namespace Titanic { + +CServiceElevator::CServiceElevator() : CTransport(), + _fieldF8(0), _fieldFC(0), _field100(0), _field104(0) { +} + +void CServiceElevator::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldF8, indent); + file->writeNumberLine(_fieldFC, indent); + file->writeNumberLine(_field100, indent); + file->writeNumberLine(_field104, indent); + + CTransport::save(file, indent); +} + +void CServiceElevator::load(SimpleFile *file) { + file->readNumber(); + _fieldF8 = file->readNumber(); + _fieldFC = file->readNumber(); + _field100 = file->readNumber(); + _field104 = file->readNumber(); + + CTransport::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/transport/service_elevator.h b/engines/titanic/game/transport/service_elevator.h new file mode 100644 index 0000000000..b41c6b155c --- /dev/null +++ b/engines/titanic/game/transport/service_elevator.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_SERVICE_ELEVATOR_H +#define TITANIC_SERVICE_ELEVATOR_H + +#include "titanic/game/transport/transport.h" + +namespace Titanic { + +class CServiceElevator : public CTransport { +public: + int _fieldF8; + int _fieldFC; + int _field100; + int _field104; +public: + CServiceElevator(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CServiceElevator"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SERVICE_ELEVATOR_H */ diff --git a/engines/titanic/game/transport/transport.cpp b/engines/titanic/game/transport/transport.cpp new file mode 100644 index 0000000000..ef31a07367 --- /dev/null +++ b/engines/titanic/game/transport/transport.cpp @@ -0,0 +1,46 @@ +/* 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 "titanic/game/transport/transport.h" + +namespace Titanic { + +CTransport::CTransport() : CMobile(), _string1("*.*.*") { +} + +void CTransport::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + + CMobile::save(file, indent); +} + +void CTransport::load(SimpleFile *file) { + file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + + CMobile::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/transport/transport.h b/engines/titanic/game/transport/transport.h new file mode 100644 index 0000000000..6e3f1a2d1d --- /dev/null +++ b/engines/titanic/game/transport/transport.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_TRANSPORT_H +#define TITANIC_TRANSPORT_H + +#include "titanic/npcs/mobile.h" + +namespace Titanic { + +class CTransport : public CMobile { +public: + CString _string1; + CString _string2; +public: + CTransport(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CTransport"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TRANSPORT_H */ diff --git a/engines/titanic/gfx/volume_control.cpp b/engines/titanic/gfx/volume_control.cpp new file mode 100644 index 0000000000..7c829169bb --- /dev/null +++ b/engines/titanic/gfx/volume_control.cpp @@ -0,0 +1,48 @@ +/* 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 "titanic/gfx/volume_control.h" + +namespace Titanic { + +CVolumeControl::CVolumeControl() : CGameObject() { +} + +void CVolumeControl::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeQuotedLine(_string1, indent); + file->writeNumberLine(_fieldCC, indent); + + CGameObject::save(file, indent); +} + +void CVolumeControl::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _string1 = file->readString(); + _fieldCC = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/volume_control.h b/engines/titanic/gfx/volume_control.h new file mode 100644 index 0000000000..5ff5c732b1 --- /dev/null +++ b/engines/titanic/gfx/volume_control.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_VOLUME_CONTROL_H +#define TITANIC_VOLUME_CONTROL_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CVolumeControl : public CGameObject { +private: + int _fieldBC; + CString _string1; + int _fieldCC; +public: + CVolumeControl(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CVolumeControl"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_VOLUME_CONTROL_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index f9927867b5..87d5774878 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -127,6 +127,7 @@ MODULE_OBJS := \ game/enter_exit_sec_class_mini_lift.o \ game/enter_exit_view.o \ game/enter_sec_class_state.o \ + game/hammer_dispensor.o \ game/hammer_dispensor_button.o \ game/exit_lift.o \ game/exit_pellerator.o \ @@ -156,6 +157,9 @@ MODULE_OBJS := \ game/maitred_arm_holder.o \ game/missiveomat.o \ game/movie_tester.o \ + game/music_console_button.o \ + game/music_room_phonograph.o \ + game/music_room_stop_phonograph_button.o \ game/music_system_lock.o \ game/musical_instrument.o \ game/navigation_computer.o \ @@ -167,6 +171,7 @@ MODULE_OBJS := \ game/pet_disabler.o \ game/pet_graphic2.o \ game/pet_graphic.o \ + game/phonograph.o \ game/phonograph_lid.o \ game/place_holder.o \ game/play_music_button.o \ @@ -176,6 +181,7 @@ MODULE_OBJS := \ game/replacement_ear.o \ game/reserved_table.o \ game/restaurant_cylinder_holder.o \ + game/restaurant_phonograph.o \ game/room_item.o \ game/sauce_dispensor.o \ game/search_point.o \ @@ -226,6 +232,13 @@ MODULE_OBJS := \ game/pet/pet_sounds.o \ game/pet/pet_transition.o \ game/pet/pet_transport.o \ + game/transport/gondolier.o \ + game/transport/lift.o \ + game/transport/lift_indicator.o \ + game/transport/pellerator.o \ + game/transport/service_elevator.o \ + game/transport/transport.o \ + game/sgt/enter_exit_mini_lift.o \ game/sgt/sgt_doors.o \ game/sgt/sgt_navigation.o \ game/sgt/sgt_restaurant_doors.o \ @@ -263,6 +276,7 @@ MODULE_OBJS := \ gfx/status_change_button.o \ gfx/st_button.o \ gfx/toggle_switch.o \ + gfx/volume_control.o \ messages/auto_sound_event.o \ messages/door_auto_sound_event.o \ messages/messages.o \ @@ -300,6 +314,7 @@ MODULE_OBJS := \ sound/auto_sound_player.o \ sound/background_sound_maker.o \ sound/music_player.o \ + sound/restricted_auto_music_player.o \ sound/seasonal_music_player.o \ sound/titania_speech.o \ sound/trigger_auto_music_player.o diff --git a/engines/titanic/sound/music_player.cpp b/engines/titanic/sound/music_player.cpp index 39e97ed10e..6bab2d91dc 100644 --- a/engines/titanic/sound/music_player.cpp +++ b/engines/titanic/sound/music_player.cpp @@ -26,11 +26,21 @@ namespace Titanic { void CMusicPlayer::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeQuotedLine(_string1, indent); + file->writeNumberLine(_fieldCC, indent); + file->writeNumberLine(_fieldD0, indent); + CGameObject::save(file, indent); } void CMusicPlayer::load(SimpleFile *file) { file->readNumber(); + _fieldBC = file->readNumber(); + _string1 = file->readString(); + _fieldCC = file->readNumber(); + _fieldD0 = file->readNumber(); + CGameObject::load(file); } diff --git a/engines/titanic/sound/restricted_auto_music_player.cpp b/engines/titanic/sound/restricted_auto_music_player.cpp new file mode 100644 index 0000000000..442dc90ce2 --- /dev/null +++ b/engines/titanic/sound/restricted_auto_music_player.cpp @@ -0,0 +1,47 @@ +/* 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 "titanic/sound/restricted_auto_music_player.h" + +namespace Titanic { + +void CRestrictedAutoMusicPlayer::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string3, indent); + file->writeQuotedLine(_string4, indent); + file->writeQuotedLine(_string5, indent); + file->writeQuotedLine(_string6, indent); + + CAutoMusicPlayer::save(file, indent); +} + +void CRestrictedAutoMusicPlayer::load(SimpleFile *file) { + file->readNumber(); + _string3 = file->readString(); + _string4 = file->readString(); + _string5 = file->readString(); + _string6 = file->readString(); + + CAutoMusicPlayer::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/sound/restricted_auto_music_player.h b/engines/titanic/sound/restricted_auto_music_player.h new file mode 100644 index 0000000000..ab8e26e9da --- /dev/null +++ b/engines/titanic/sound/restricted_auto_music_player.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_RESTRICTED_AUTO_MUSIC_PLAYER_H +#define TITANIC_RESTRICTED_AUTO_MUSIC_PLAYER_H + +#include "titanic/sound/auto_music_player.h" + +namespace Titanic { + +class CRestrictedAutoMusicPlayer : public CAutoMusicPlayer { +private: + CString _string3; + CString _string4; + CString _string5; + CString _string6; +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CRestrictedAutoMusicPlayer"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_RESTRICTED_AUTO_MUSIC_PLAYER_H */ diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index 62a0ae25c1..03dbacd6da 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -31,6 +31,7 @@ #include "titanic/core/saveable_object.h" #include "titanic/game/enter_exit_first_class_state.h" #include "titanic/game/parrot/parrot_lobby_object.h" +#include "titanic/game/sgt/sgt_navigation.h" #include "titanic/game/sgt/sgt_state_room.h" #include "titanic/carry/hose.h" @@ -59,6 +60,7 @@ void TitanicEngine::initialize() { CParrotLobbyObject::init(); CEnterExitFirstClassState::init(); CHose::init(); + CSGTNavigation::init(); CSGTStateRoom::init(); _screenManager = new OSScreenManager(this); @@ -69,6 +71,7 @@ void TitanicEngine::initialize() { void TitanicEngine::deinitialize() { CEnterExitFirstClassState::deinit(); CHose::deinit(); + CSGTNavigation::deinit(); CSGTStateRoom::deinit(); } -- cgit v1.2.3 From 9ce8e1130cc32c49e31a2160b2f4034f05430b4b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 1 Mar 2016 20:41:07 -0500 Subject: TITANIC: Lots more miscellaneous classes --- engines/titanic/core/saveable_object.cpp | 52 +++++++++++++++--- engines/titanic/core/turn_on_turn_off.cpp | 53 ++++++++++++++++++ engines/titanic/core/turn_on_turn_off.h | 58 ++++++++++++++++++++ engines/titanic/game/end_credit_text.cpp | 2 + engines/titanic/game/end_credit_text.h | 4 ++ engines/titanic/game/end_game_credits.cpp | 15 ++++-- engines/titanic/game/end_game_credits.h | 15 ++++-- engines/titanic/game/enter_bridge.cpp | 39 -------------- engines/titanic/game/enter_bridge.h | 54 ------------------- .../titanic/game/enter_exit_first_class_state.cpp | 49 ----------------- .../titanic/game/enter_exit_first_class_state.h | 62 ---------------------- .../game/enter_exit_sec_class_mini_lift.cpp | 37 ------------- .../titanic/game/enter_exit_sec_class_mini_lift.h | 50 ----------------- engines/titanic/game/enter_exit_view.cpp | 53 ------------------ engines/titanic/game/enter_exit_view.h | 58 -------------------- engines/titanic/game/enter_sec_class_state.cpp | 43 --------------- engines/titanic/game/enter_sec_class_state.h | 54 ------------------- engines/titanic/game/exit_lift.cpp | 43 --------------- engines/titanic/game/exit_lift.h | 54 ------------------- engines/titanic/game/exit_pellerator.cpp | 37 ------------- engines/titanic/game/exit_pellerator.h | 50 ----------------- engines/titanic/game/get_lift_eye2.cpp | 12 +++++ engines/titanic/game/get_lift_eye2.h | 5 ++ engines/titanic/game/sgt/enter_exit_mini_lift.cpp | 43 --------------- engines/titanic/game/sgt/enter_exit_mini_lift.h | 55 ------------------- engines/titanic/game/starling_puret.cpp | 2 + engines/titanic/game/starling_puret.h | 4 ++ engines/titanic/module.mk | 25 +++++---- engines/titanic/moves/enter_bridge.cpp | 39 ++++++++++++++ engines/titanic/moves/enter_bridge.h | 54 +++++++++++++++++++ .../titanic/moves/enter_exit_first_class_state.cpp | 49 +++++++++++++++++ .../titanic/moves/enter_exit_first_class_state.h | 62 ++++++++++++++++++++++ engines/titanic/moves/enter_exit_mini_lift.cpp | 43 +++++++++++++++ engines/titanic/moves/enter_exit_mini_lift.h | 55 +++++++++++++++++++ .../moves/enter_exit_sec_class_mini_lift.cpp | 37 +++++++++++++ .../titanic/moves/enter_exit_sec_class_mini_lift.h | 50 +++++++++++++++++ engines/titanic/moves/enter_exit_view.cpp | 53 ++++++++++++++++++ engines/titanic/moves/enter_exit_view.h | 58 ++++++++++++++++++++ engines/titanic/moves/enter_sec_class_state.cpp | 43 +++++++++++++++ engines/titanic/moves/enter_sec_class_state.h | 54 +++++++++++++++++++ engines/titanic/moves/exit_lift.cpp | 39 ++++++++++++++ engines/titanic/moves/exit_lift.h | 52 ++++++++++++++++++ engines/titanic/moves/exit_pellerator.cpp | 37 +++++++++++++ engines/titanic/moves/exit_pellerator.h | 50 +++++++++++++++++ engines/titanic/sound/auto_sound_player.cpp | 24 ++++++++- engines/titanic/sound/auto_sound_player.h | 2 +- engines/titanic/sound/bird_song.cpp | 39 ++++++++++++++ engines/titanic/sound/bird_song.h | 54 +++++++++++++++++++ engines/titanic/sound/gondolier_song.cpp | 39 ++++++++++++++ engines/titanic/sound/gondolier_song.h | 54 +++++++++++++++++++ engines/titanic/sound/room_auto_sound_player.cpp | 37 +++++++++++++ engines/titanic/sound/room_auto_sound_player.h | 50 +++++++++++++++++ engines/titanic/sound/water_lapping_sounds.cpp | 39 ++++++++++++++ engines/titanic/sound/water_lapping_sounds.h | 54 +++++++++++++++++++ engines/titanic/titanic.cpp | 9 ++-- 55 files changed, 1392 insertions(+), 812 deletions(-) create mode 100644 engines/titanic/core/turn_on_turn_off.cpp create mode 100644 engines/titanic/core/turn_on_turn_off.h delete mode 100644 engines/titanic/game/enter_bridge.cpp delete mode 100644 engines/titanic/game/enter_bridge.h delete mode 100644 engines/titanic/game/enter_exit_first_class_state.cpp delete mode 100644 engines/titanic/game/enter_exit_first_class_state.h delete mode 100644 engines/titanic/game/enter_exit_sec_class_mini_lift.cpp delete mode 100644 engines/titanic/game/enter_exit_sec_class_mini_lift.h delete mode 100644 engines/titanic/game/enter_exit_view.cpp delete mode 100644 engines/titanic/game/enter_exit_view.h delete mode 100644 engines/titanic/game/enter_sec_class_state.cpp delete mode 100644 engines/titanic/game/enter_sec_class_state.h delete mode 100644 engines/titanic/game/exit_lift.cpp delete mode 100644 engines/titanic/game/exit_lift.h delete mode 100644 engines/titanic/game/exit_pellerator.cpp delete mode 100644 engines/titanic/game/exit_pellerator.h delete mode 100644 engines/titanic/game/sgt/enter_exit_mini_lift.cpp delete mode 100644 engines/titanic/game/sgt/enter_exit_mini_lift.h create mode 100644 engines/titanic/moves/enter_bridge.cpp create mode 100644 engines/titanic/moves/enter_bridge.h create mode 100644 engines/titanic/moves/enter_exit_first_class_state.cpp create mode 100644 engines/titanic/moves/enter_exit_first_class_state.h create mode 100644 engines/titanic/moves/enter_exit_mini_lift.cpp create mode 100644 engines/titanic/moves/enter_exit_mini_lift.h create mode 100644 engines/titanic/moves/enter_exit_sec_class_mini_lift.cpp create mode 100644 engines/titanic/moves/enter_exit_sec_class_mini_lift.h create mode 100644 engines/titanic/moves/enter_exit_view.cpp create mode 100644 engines/titanic/moves/enter_exit_view.h create mode 100644 engines/titanic/moves/enter_sec_class_state.cpp create mode 100644 engines/titanic/moves/enter_sec_class_state.h create mode 100644 engines/titanic/moves/exit_lift.cpp create mode 100644 engines/titanic/moves/exit_lift.h create mode 100644 engines/titanic/moves/exit_pellerator.cpp create mode 100644 engines/titanic/moves/exit_pellerator.h create mode 100644 engines/titanic/sound/bird_song.cpp create mode 100644 engines/titanic/sound/bird_song.h create mode 100644 engines/titanic/sound/gondolier_song.cpp create mode 100644 engines/titanic/sound/gondolier_song.h create mode 100644 engines/titanic/sound/room_auto_sound_player.cpp create mode 100644 engines/titanic/sound/room_auto_sound_player.h create mode 100644 engines/titanic/sound/water_lapping_sounds.cpp create mode 100644 engines/titanic/sound/water_lapping_sounds.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 8328aa5e49..08a3668053 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -72,6 +72,7 @@ #include "titanic/core/static_image.h" #include "titanic/core/turn_on_object.h" #include "titanic/core/turn_on_play_sound.h" +#include "titanic/core/turn_on_turn_off.h" #include "titanic/core/tree_item.h" #include "titanic/core/view_item.h" @@ -107,8 +108,11 @@ #include "titanic/game/eject_phonograph_button.h" #include "titanic/game/emma_control.h" #include "titanic/game/empty_nut_bowl.h" -#include "titanic/game/enter_exit_first_class_state.h" -#include "titanic/game/enter_exit_view.h" +#include "titanic/game/end_credit_text.h" +#include "titanic/game/end_credits.h" +#include "titanic/game/end_explode_ship.h" +#include "titanic/game/end_game_credits.h" +#include "titanic/game/end_sequence_control.h" #include "titanic/game/fan.h" #include "titanic/game/fan_control.h" #include "titanic/game/fan_decrease.h" @@ -116,6 +120,7 @@ #include "titanic/game/fan_noises.h" #include "titanic/game/floor_indicator.h" #include "titanic/game/games_console.h" +#include "titanic/game/get_lift_eye2.h" #include "titanic/game/hammer_clip.h" #include "titanic/game/hammer_dispensor.h" #include "titanic/game/hammer_dispensor_button.h" @@ -185,7 +190,6 @@ #include "titanic/game/pet/pet_sounds.h" #include "titanic/game/pet/pet_transition.h" #include "titanic/game/pet/pet_transport.h" -#include "titanic/game/sgt/enter_exit_mini_lift.h" #include "titanic/game/sgt/sgt_doors.h" #include "titanic/game/sgt/sgt_navigation.h" #include "titanic/game/sgt/sgt_restaurant_doors.h" @@ -241,8 +245,13 @@ #include "titanic/messages/pet_messages.h" #include "titanic/moves/enter_bomb_room.h" +#include "titanic/moves/enter_bridge.h" +#include "titanic/moves/enter_exit_first_class_state.h" +#include "titanic/moves/enter_exit_mini_lift.h" +#include "titanic/moves/enter_exit_view.h" #include "titanic/moves/exit_arboretum.h" #include "titanic/moves/exit_bridge.h" +#include "titanic/moves/exit_lift.h" #include "titanic/moves/exit_state_room.h" #include "titanic/moves/move_player_in_parrot_room.h" #include "titanic/moves/move_player_to.h" @@ -271,11 +280,14 @@ #include "titanic/sound/auto_music_player_base.h" #include "titanic/sound/auto_sound_player.h" #include "titanic/sound/background_sound_maker.h" +#include "titanic/sound/bird_song.h" +#include "titanic/sound/gondolier_song.h" #include "titanic/sound/music_player.h" #include "titanic/sound/restricted_auto_music_player.h" #include "titanic/sound/seasonal_music_player.h" #include "titanic/sound/titania_speech.h" #include "titanic/sound/trigger_auto_music_player.h" +#include "titanic/sound/water_lapping_sounds.h" namespace Titanic { @@ -337,6 +349,7 @@ DEFFN(CProjectItem); DEFFN(CStaticImage); DEFFN(CTurnOnObject); DEFFN(CTurnOnPlaySound); +DEFFN(CTurnOnTurnOff); DEFFN(CTreeItem); DEFFN(CViewItem); @@ -370,8 +383,11 @@ DEFFN(CEarSweetBowl); DEFFN(CEjectPhonographButton); DEFFN(CEmmaControl); DEFFN(CEmptyNutBowl); -DEFFN(CEnterExitFirstClassState); -DEFFN(CEnterExitView); +DEFFN(CEndCreditText); +DEFFN(CEndCredits); +DEFFN(CEndExplodeShip); +DEFFN(CEndGameCredits); +DEFFN(CEndSequenceControl); DEFFN(CFan); DEFFN(CFanControl); DEFFN(CFanDecrease); @@ -379,6 +395,7 @@ DEFFN(CFanIncrease); DEFFN(CFanNoises); DEFFN(CFloorIndicator); DEFFN(CGamesConsole); +DEFFN(CGetLiftEye2); DEFFN(CHammerClip); DEFFN(CHammerDispensor); DEFFN(CHammerDispensorButton); @@ -677,8 +694,12 @@ DEFFN(CVirtualKeyCharMsg); DEFFN(CVisibleMsg); DEFFN(CEnterBombRoom); +DEFFN(CEnterBridge); +DEFFN(CEnterExitFirstClassState); +DEFFN(CEnterExitView); DEFFN(CExitArboretum); DEFFN(CExitBridge); +DEFFN(CExitLift); DEFFN(CExitStateRoom); DEFFN(CMovePlayerInParrotRoom); DEFFN(CMovePlayerTo); @@ -706,11 +727,14 @@ DEFFN(CAutoMusicPlayer); DEFFN(CAutoMusicPlayerBase); DEFFN(CAutoSoundPlayer); DEFFN(CBackgroundSoundMaker); +DEFFN(CBirdSong); +DEFFN(CGondolierSong); DEFFN(CMusicPlayer); DEFFN(CRestrictedAutoMusicPlayer); DEFFN(CSeasonalMusicPlayer); DEFFN(CTitaniaSpeech); DEFFN(CTriggerAutoMusicPlayer); +DEFFN(CWaterLappingSounds); void CSaveableObject::initClassList() { _classList = new Common::HashMap(); @@ -764,9 +788,10 @@ void CSaveableObject::initClassList() { ADDFN(CNodeItem); ADDFN(CProjectItem); ADDFN(CStaticImage); - ADDFN(CTreeItem); ADDFN(CTurnOnObject); + ADDFN(CTreeItem); ADDFN(CTurnOnPlaySound); + ADDFN(CTurnOnTurnOff); ADDFN(CViewItem); ADDFN(CAnnounce); @@ -800,8 +825,11 @@ void CSaveableObject::initClassList() { ADDFN(CEjectPhonographButton); ADDFN(CEmmaControl); ADDFN(CEmptyNutBowl); - ADDFN(CEnterExitFirstClassState); - ADDFN(CEnterExitView); + ADDFN(CEndCreditText); + ADDFN(CEndCredits); + ADDFN(CEndExplodeShip); + ADDFN(CEndGameCredits); + ADDFN(CEndSequenceControl); ADDFN(CFan); ADDFN(CFanControl); ADDFN(CFanDecrease); @@ -809,6 +837,7 @@ void CSaveableObject::initClassList() { ADDFN(CFanNoises); ADDFN(CFloorIndicator); ADDFN(CGamesConsole); + ADDFN(CGetLiftEye2); ADDFN(CHammerClip); ADDFN(CHammerDispensor); ADDFN(CHammerDispensorButton); @@ -1107,8 +1136,12 @@ void CSaveableObject::initClassList() { ADDFN(CVisibleMsg); ADDFN(CEnterBombRoom); + ADDFN(CEnterBridge); + ADDFN(CEnterExitFirstClassState); + ADDFN(CEnterExitView); ADDFN(CExitArboretum); ADDFN(CExitBridge); + ADDFN(CExitLift); ADDFN(CExitStateRoom); ADDFN(CMovePlayerInParrotRoom); ADDFN(CMovePlayerTo); @@ -1137,12 +1170,15 @@ void CSaveableObject::initClassList() { ADDFN(CAutoMusicPlayerBase); ADDFN(CAutoSoundPlayer); ADDFN(CBackgroundSoundMaker); + ADDFN(CBirdSong); + ADDFN(CGondolierSong); ADDFN(CMusicPlayer); ADDFN(CRestrictedAutoMusicPlayer); ADDFN(CSeasonalMusicPlayer); ADDFN(CAutoMusicPlayer); ADDFN(CTitaniaSpeech); ADDFN(CTriggerAutoMusicPlayer); + ADDFN(CWaterLappingSounds); } void CSaveableObject::freeClassList() { diff --git a/engines/titanic/core/turn_on_turn_off.cpp b/engines/titanic/core/turn_on_turn_off.cpp new file mode 100644 index 0000000000..a6a65e30f2 --- /dev/null +++ b/engines/titanic/core/turn_on_turn_off.cpp @@ -0,0 +1,53 @@ +/* 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 "titanic/core/turn_on_turn_off.h" + +namespace Titanic { + +CTurnOnTurnOff::CTurnOnTurnOff() : CBackground(), _fieldE0(0), + _fieldE4(0), _fieldE8(0), _fieldEC(0), _fieldF0(0) { +} + +void CTurnOnTurnOff::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_fieldEC, indent); + file->writeNumberLine(_fieldF0, indent); + + CBackground::save(file, indent); +} + +void CTurnOnTurnOff::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + _fieldEC = file->readNumber(); + _fieldF0 = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/core/turn_on_turn_off.h b/engines/titanic/core/turn_on_turn_off.h new file mode 100644 index 0000000000..41a0156391 --- /dev/null +++ b/engines/titanic/core/turn_on_turn_off.h @@ -0,0 +1,58 @@ +/* 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. + * + */ + +#ifndef TITANIC_TURN_ON_TURN_OFF_H +#define TITANIC_TURN_ON_TURN_OFF_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CTurnOnTurnOff : public CBackground { +private: + int _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; + int _fieldF0; +public: + CTurnOnTurnOff(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CTurnOnTurnOff"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TURN_ON_TURN_OFF_H */ diff --git a/engines/titanic/game/end_credit_text.cpp b/engines/titanic/game/end_credit_text.cpp index 949c6e2187..8ae83ac8d0 100644 --- a/engines/titanic/game/end_credit_text.cpp +++ b/engines/titanic/game/end_credit_text.cpp @@ -26,11 +26,13 @@ namespace Titanic { void CEndCreditText::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); CGameObject::save(file, indent); } void CEndCreditText::load(SimpleFile *file) { file->readNumber(); + _value = file->readNumber(); CGameObject::load(file); } diff --git a/engines/titanic/game/end_credit_text.h b/engines/titanic/game/end_credit_text.h index 258b1a3ef3..de0e54d7e0 100644 --- a/engines/titanic/game/end_credit_text.h +++ b/engines/titanic/game/end_credit_text.h @@ -28,7 +28,11 @@ namespace Titanic { class CEndCreditText : public CGameObject { +private: + int _value; public: + CEndCreditText() : CGameObject(), _value(0) {} + /** * Return the class name */ diff --git a/engines/titanic/game/end_game_credits.cpp b/engines/titanic/game/end_game_credits.cpp index 36c0510b20..56b06e6ec0 100644 --- a/engines/titanic/game/end_game_credits.cpp +++ b/engines/titanic/game/end_game_credits.cpp @@ -20,17 +20,26 @@ * */ -#include "titanic/game/nut_replacer.h" +#include "titanic/game/end_game_credits.h" namespace Titanic { -void CNutReplacer::save(SimpleFile *file, int indent) const { +CEndGameCredits::CEndGameCredits() : CGameObject(), _fieldBC(0) { +} + +void CEndGameCredits::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writePoint(_pos1, indent); + CGameObject::save(file, indent); } -void CNutReplacer::load(SimpleFile *file) { +void CEndGameCredits::load(SimpleFile *file) { file->readNumber(); + _fieldBC = file->readNumber(); + _pos1 = file->readPoint(); + CGameObject::load(file); } diff --git a/engines/titanic/game/end_game_credits.h b/engines/titanic/game/end_game_credits.h index c243f9a79c..f8ec6b00a7 100644 --- a/engines/titanic/game/end_game_credits.h +++ b/engines/titanic/game/end_game_credits.h @@ -20,19 +20,24 @@ * */ -#ifndef TITANIC_END_GAME_SHIP_H -#define TITANIC_END_GAME_SHIP_H +#ifndef TITANIC_END_GAME_CREDITS_H +#define TITANIC_END_GAME_CREDITS_H #include "titanic/core/game_object.h" namespace Titanic { -class CEndGameShip : public CGameObject { +class CEndGameCredits : public CGameObject { +private: + int _fieldBC; + Common::Point _pos1; public: + CEndGameCredits(); + /** * Return the class name */ - virtual const char *getClassName() const { return "CEndGameShip"; } + virtual const char *getClassName() const { return "CEndGameCredits"; } /** * Save the data for the class to file @@ -47,4 +52,4 @@ public: } // End of namespace Titanic -#endif /* TITANIC_END_GAME_SHIP_H */ +#endif /* TITANIC_END_GAME_CREDITS_H */ diff --git a/engines/titanic/game/enter_bridge.cpp b/engines/titanic/game/enter_bridge.cpp deleted file mode 100644 index 13e4a50264..0000000000 --- a/engines/titanic/game/enter_bridge.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* 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 "titanic/game/enter_bridge.h" - -namespace Titanic { - -void CEnterBridge::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeNumberLine(_value, indent); - CGameObject::save(file, indent); -} - -void CEnterBridge::load(SimpleFile *file) { - file->readNumber(); - _value = file->readNumber(); - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/enter_bridge.h b/engines/titanic/game/enter_bridge.h deleted file mode 100644 index bbc4cc96d0..0000000000 --- a/engines/titanic/game/enter_bridge.h +++ /dev/null @@ -1,54 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_ENTER_BRIDGE_H -#define TITANIC_ENTER_BRIDGE_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CEnterBridge : public CGameObject { -public: - int _value; -public: - CEnterBridge() : CGameObject(), _value(1) {} - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CEnterBridge"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_ENTER_BRIDGE_H */ diff --git a/engines/titanic/game/enter_exit_first_class_state.cpp b/engines/titanic/game/enter_exit_first_class_state.cpp deleted file mode 100644 index 7fa191b0e3..0000000000 --- a/engines/titanic/game/enter_exit_first_class_state.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* 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 "titanic/game/enter_exit_first_class_state.h" - -namespace Titanic { - -CString *CEnterExitFirstClassState::_v1; - -void CEnterExitFirstClassState::init() { - _v1 = new CString(); -} - -void CEnterExitFirstClassState::deinit() { - delete _v1; -} - -void CEnterExitFirstClassState::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeQuotedLine(*_v1, indent); - CGameObject::save(file, indent); -} - -void CEnterExitFirstClassState::load(SimpleFile *file) { - file->readNumber(); - *_v1 = file->readString(); - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/enter_exit_first_class_state.h b/engines/titanic/game/enter_exit_first_class_state.h deleted file mode 100644 index f7bc4c69f7..0000000000 --- a/engines/titanic/game/enter_exit_first_class_state.h +++ /dev/null @@ -1,62 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_ENTER_EXIT_FIRST_CLASS_STATE_H -#define TITANIC_ENTER_EXIT_FIRST_CLASS_STATE_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CEnterExitFirstClassState : public CGameObject { -public: - static CString *_v1; - - /** - * Initialize static data - */ - static void init(); - - /** - * De-initialize static data - */ - static void deinit(); -public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBowlUnlocker"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_ENTER_EXIT_FIRST_CLASS_STATE_H */ diff --git a/engines/titanic/game/enter_exit_sec_class_mini_lift.cpp b/engines/titanic/game/enter_exit_sec_class_mini_lift.cpp deleted file mode 100644 index d4162ac008..0000000000 --- a/engines/titanic/game/enter_exit_sec_class_mini_lift.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 "titanic/game/enter_exit_sec_class_mini_lift.h" - -namespace Titanic { - -void CEnterExitSecClassMiniLift::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - CGameObject::save(file, indent); -} - -void CEnterExitSecClassMiniLift::load(SimpleFile *file) { - file->readNumber(); - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/enter_exit_sec_class_mini_lift.h b/engines/titanic/game/enter_exit_sec_class_mini_lift.h deleted file mode 100644 index aa3f9b3731..0000000000 --- a/engines/titanic/game/enter_exit_sec_class_mini_lift.h +++ /dev/null @@ -1,50 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_ENTER_EXIT_SEC_CLASS_MINI_LIFT_H -#define TITANIC_ENTER_EXIT_SEC_CLASS_MINI_LIFT_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CEnterExitSecClassMiniLift : public CGameObject { -public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CEnterExitSecClassMiniLift"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_ENTER_EXIT_SEC_CLASS_MINI_LIFT_H */ diff --git a/engines/titanic/game/enter_exit_view.cpp b/engines/titanic/game/enter_exit_view.cpp deleted file mode 100644 index e892161757..0000000000 --- a/engines/titanic/game/enter_exit_view.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* 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 "titanic/game/enter_exit_view.h" - -namespace Titanic { - -CEnterExitView::CEnterExitView() : CGameObject(), _fieldBC(0), - _fieldC0(0), _fieldC4(0), _fieldC8(0), _fieldCC(0) { -} - -void CEnterExitView::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldBC, indent); - file->writeNumberLine(_fieldC0, indent); - file->writeNumberLine(_fieldC4, indent); - file->writeNumberLine(_fieldC8, indent); - file->writeNumberLine(_fieldCC, indent); - - CGameObject::save(file, indent); -} - -void CEnterExitView::load(SimpleFile *file) { - file->readNumber(); - _fieldBC = file->readNumber(); - _fieldC0 = file->readNumber(); - _fieldC4 = file->readNumber(); - _fieldC8 = file->readNumber(); - _fieldCC = file->readNumber(); - - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/enter_exit_view.h b/engines/titanic/game/enter_exit_view.h deleted file mode 100644 index 05ed63da5c..0000000000 --- a/engines/titanic/game/enter_exit_view.h +++ /dev/null @@ -1,58 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_ENTER_EXIT_VIEW_H -#define TITANIC_ENTER_EXIT_VIEW_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CEnterExitView : public CGameObject { -public: - int _fieldBC; - int _fieldC0; - int _fieldC4; - int _fieldC8; - int _fieldCC; -public: - CEnterExitView(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CEnterExitView"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_ENTER_EXIT_VIEW_H */ diff --git a/engines/titanic/game/enter_sec_class_state.cpp b/engines/titanic/game/enter_sec_class_state.cpp deleted file mode 100644 index 2a18e81b6a..0000000000 --- a/engines/titanic/game/enter_sec_class_state.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* 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 "titanic/game/enter_sec_class_state.h" - -namespace Titanic { - -void CEnterSecClassState::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeNumberLine(_value1, indent); - file->writeNumberLine(_value2, indent); - - CGameObject::save(file, indent); -} - -void CEnterSecClassState::load(SimpleFile *file) { - file->readNumber(); - _value1 = file->readNumber(); - _value2 = file->readNumber(); - - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/enter_sec_class_state.h b/engines/titanic/game/enter_sec_class_state.h deleted file mode 100644 index 5da623dc08..0000000000 --- a/engines/titanic/game/enter_sec_class_state.h +++ /dev/null @@ -1,54 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_ENTER_SEC_CLASS_STATE_H -#define TITANIC_ENTER_SEC_CLASS_STATE_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CEnterSecClassState : public CGameObject { -public: - int _value1, _value2; -public: - CEnterSecClassState() : CGameObject(), _value1(0), _value2(0) {} - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CEnterSecClassState"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_ENTER_SEC_CLASS_STATE_H */ diff --git a/engines/titanic/game/exit_lift.cpp b/engines/titanic/game/exit_lift.cpp deleted file mode 100644 index 82e4411f6f..0000000000 --- a/engines/titanic/game/exit_lift.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* 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 "titanic/game/exit_lift.h" - -namespace Titanic { - -void CExitLift::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeNumberLine(_value1, indent); - file->writeNumberLine(_value2, indent); - - CGameObject::save(file, indent); -} - -void CExitLift::load(SimpleFile *file) { - file->readNumber(); - _value1 = file->readNumber(); - _value2 = file->readNumber(); - - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/exit_lift.h b/engines/titanic/game/exit_lift.h deleted file mode 100644 index 9531fd6528..0000000000 --- a/engines/titanic/game/exit_lift.h +++ /dev/null @@ -1,54 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_EXIT_LIFT_H -#define TITANIC_EXIT_LIFT_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CExitLift : public CGameObject { -public: - int _value1, _value2; -public: - CExitLift() : CGameObject(), _value1(0), _value2(0) {} - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CExitLift"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_EXIT_LIFT_H */ diff --git a/engines/titanic/game/exit_pellerator.cpp b/engines/titanic/game/exit_pellerator.cpp deleted file mode 100644 index 79754f8567..0000000000 --- a/engines/titanic/game/exit_pellerator.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 "titanic/game/exit_pellerator.h" - -namespace Titanic { - -void CExitPellerator::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - CGameObject::save(file, indent); -} - -void CExitPellerator::load(SimpleFile *file) { - file->readNumber(); - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/exit_pellerator.h b/engines/titanic/game/exit_pellerator.h deleted file mode 100644 index 6185f61e01..0000000000 --- a/engines/titanic/game/exit_pellerator.h +++ /dev/null @@ -1,50 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_EXIT_PELLERATOR_H -#define TITANIC_EXIT_PELLERATOR_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CExitPellerator : public CGameObject { -public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CExitPellerator"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_EXIT_PELLERATOR_H */ diff --git a/engines/titanic/game/get_lift_eye2.cpp b/engines/titanic/game/get_lift_eye2.cpp index 67a7b43be6..472f884d01 100644 --- a/engines/titanic/game/get_lift_eye2.cpp +++ b/engines/titanic/game/get_lift_eye2.cpp @@ -24,13 +24,25 @@ namespace Titanic { +CString *CGetLiftEye2::_v1; + +void CGetLiftEye2::init() { + _v1 = new CString(); +} + +void CGetLiftEye2::deinit() { + delete _v1; +} + void CGetLiftEye2::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeQuotedLine(*_v1, indent); CGameObject::save(file, indent); } void CGetLiftEye2::load(SimpleFile *file) { file->readNumber(); + *_v1 = file->readString(); CGameObject::load(file); } diff --git a/engines/titanic/game/get_lift_eye2.h b/engines/titanic/game/get_lift_eye2.h index baca1204d8..e8149cacae 100644 --- a/engines/titanic/game/get_lift_eye2.h +++ b/engines/titanic/game/get_lift_eye2.h @@ -28,7 +28,12 @@ namespace Titanic { class CGetLiftEye2 : public CGameObject { +private: + static CString *_v1; public: + static void init(); + static void deinit(); + /** * Return the class name */ diff --git a/engines/titanic/game/sgt/enter_exit_mini_lift.cpp b/engines/titanic/game/sgt/enter_exit_mini_lift.cpp deleted file mode 100644 index a7f85b9952..0000000000 --- a/engines/titanic/game/sgt/enter_exit_mini_lift.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* 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 "titanic/game/sgt/enter_exit_mini_lift.h" - -namespace Titanic { - -void CEnterExitMiniLift::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldBC, indent); - file->writeNumberLine(_fieldC0, indent); - - CSGTNavigation::save(file, indent); -} - -void CEnterExitMiniLift::load(SimpleFile *file) { - file->readNumber(); - _fieldBC = file->readNumber(); - _fieldC0 = file->readNumber(); - - CSGTNavigation::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/enter_exit_mini_lift.h b/engines/titanic/game/sgt/enter_exit_mini_lift.h deleted file mode 100644 index 417e25d13f..0000000000 --- a/engines/titanic/game/sgt/enter_exit_mini_lift.h +++ /dev/null @@ -1,55 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_ENTER_EXIT_MINI_LIFT_H -#define TITANIC_ENTER_EXIT_MINI_LIFT_H - -#include "titanic/game/sgt/sgt_navigation.h" - -namespace Titanic { - -class CEnterExitMiniLift : public CSGTNavigation { -private: - int _fieldBC; - int _fieldC0; -public: - CEnterExitMiniLift() : CSGTNavigation(), _fieldBC(0), _fieldC0(1) {} - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CEnterExitMiniLift"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_ENTER_EXIT_MINI_LIFT_H */ diff --git a/engines/titanic/game/starling_puret.cpp b/engines/titanic/game/starling_puret.cpp index 026128b53a..1fa0dc82ea 100644 --- a/engines/titanic/game/starling_puret.cpp +++ b/engines/titanic/game/starling_puret.cpp @@ -26,11 +26,13 @@ namespace Titanic { void CStarlingPuret::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); CGameObject::save(file, indent); } void CStarlingPuret::load(SimpleFile *file) { file->readNumber(); + _value = file->readNumber(); CGameObject::load(file); } diff --git a/engines/titanic/game/starling_puret.h b/engines/titanic/game/starling_puret.h index 5c53a53b47..5bfdd660f9 100644 --- a/engines/titanic/game/starling_puret.h +++ b/engines/titanic/game/starling_puret.h @@ -28,7 +28,11 @@ namespace Titanic { class CStarlingPuret : public CGameObject { +private: + int _value; public: + CStarlingPuret() : CGameObject(), _value(0) {} + /** * Return the class name */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 87d5774878..d4bbed8f7a 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -72,6 +72,7 @@ MODULE_OBJS := \ core/static_image.o \ core/turn_on_object.o \ core/turn_on_play_sound.o \ + core/turn_on_turn_off.o \ core/tree_item.o \ core/view_item.o \ game/announce.o \ @@ -120,17 +121,10 @@ MODULE_OBJS := \ game/end_credit_text.o \ game/end_credits.o \ game/end_explode_ship.o \ - game/end_game_cerdits.o \ + game/end_game_credits.o \ game/end_sequence_control.o \ - game/enter_bridge.o \ - game/enter_exit_first_class_state.o \ - game/enter_exit_sec_class_mini_lift.o \ - game/enter_exit_view.o \ - game/enter_sec_class_state.o \ game/hammer_dispensor.o \ game/hammer_dispensor_button.o \ - game/exit_lift.o \ - game/exit_pellerator.o \ game/fan.o \ game/fan_control.o \ game/fan_decrease.o \ @@ -238,7 +232,6 @@ MODULE_OBJS := \ game/transport/pellerator.o \ game/transport/service_elevator.o \ game/transport/transport.o \ - game/sgt/enter_exit_mini_lift.o \ game/sgt/sgt_doors.o \ game/sgt/sgt_navigation.o \ game/sgt/sgt_restaurant_doors.o \ @@ -281,8 +274,16 @@ MODULE_OBJS := \ messages/door_auto_sound_event.o \ messages/messages.o \ moves/enter_bomb_room.o \ + moves/enter_bridge.o \ + moves/enter_exit_first_class_state.o \ + moves/enter_exit_mini_lift.o \ + moves/enter_exit_sec_class_mini_lift.o \ + moves/enter_exit_view.o \ + moves/enter_sec_class_state.o \ moves/exit_arboretum.o \ moves/exit_bridge.o \ + moves/exit_lift.o \ + moves/exit_pellerator.o \ moves/exit_state_room.o \ moves/exit_titania.o \ moves/move_player_in_parrot_room.o \ @@ -313,11 +314,15 @@ MODULE_OBJS := \ sound/auto_music_player_base.o \ sound/auto_sound_player.o \ sound/background_sound_maker.o \ + sound/bird_song.o \ + sound/gondolier_song.o \ sound/music_player.o \ sound/restricted_auto_music_player.o \ + sound/room_auto_sound_player.o \ sound/seasonal_music_player.o \ sound/titania_speech.o \ - sound/trigger_auto_music_player.o + sound/trigger_auto_music_player.o \ + sound/water_lapping_sounds.o # This module can be built as a plugin ifeq ($(ENABLE_TITANIC), DYNAMIC_PLUGIN) diff --git a/engines/titanic/moves/enter_bridge.cpp b/engines/titanic/moves/enter_bridge.cpp new file mode 100644 index 0000000000..a1e0b7e489 --- /dev/null +++ b/engines/titanic/moves/enter_bridge.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/moves/enter_bridge.h" + +namespace Titanic { + +void CEnterBridge::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CGameObject::save(file, indent); +} + +void CEnterBridge::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/moves/enter_bridge.h b/engines/titanic/moves/enter_bridge.h new file mode 100644 index 0000000000..bbc4cc96d0 --- /dev/null +++ b/engines/titanic/moves/enter_bridge.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_ENTER_BRIDGE_H +#define TITANIC_ENTER_BRIDGE_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CEnterBridge : public CGameObject { +public: + int _value; +public: + CEnterBridge() : CGameObject(), _value(1) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CEnterBridge"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ENTER_BRIDGE_H */ diff --git a/engines/titanic/moves/enter_exit_first_class_state.cpp b/engines/titanic/moves/enter_exit_first_class_state.cpp new file mode 100644 index 0000000000..ed80947c07 --- /dev/null +++ b/engines/titanic/moves/enter_exit_first_class_state.cpp @@ -0,0 +1,49 @@ +/* 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 "titanic/moves/enter_exit_first_class_state.h" + +namespace Titanic { + +CString *CEnterExitFirstClassState::_v1; + +void CEnterExitFirstClassState::init() { + _v1 = new CString(); +} + +void CEnterExitFirstClassState::deinit() { + delete _v1; +} + +void CEnterExitFirstClassState::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(*_v1, indent); + CGameObject::save(file, indent); +} + +void CEnterExitFirstClassState::load(SimpleFile *file) { + file->readNumber(); + *_v1 = file->readString(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/moves/enter_exit_first_class_state.h b/engines/titanic/moves/enter_exit_first_class_state.h new file mode 100644 index 0000000000..f7bc4c69f7 --- /dev/null +++ b/engines/titanic/moves/enter_exit_first_class_state.h @@ -0,0 +1,62 @@ +/* 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. + * + */ + +#ifndef TITANIC_ENTER_EXIT_FIRST_CLASS_STATE_H +#define TITANIC_ENTER_EXIT_FIRST_CLASS_STATE_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CEnterExitFirstClassState : public CGameObject { +public: + static CString *_v1; + + /** + * Initialize static data + */ + static void init(); + + /** + * De-initialize static data + */ + static void deinit(); +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBowlUnlocker"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ENTER_EXIT_FIRST_CLASS_STATE_H */ diff --git a/engines/titanic/moves/enter_exit_mini_lift.cpp b/engines/titanic/moves/enter_exit_mini_lift.cpp new file mode 100644 index 0000000000..b6a1423875 --- /dev/null +++ b/engines/titanic/moves/enter_exit_mini_lift.cpp @@ -0,0 +1,43 @@ +/* 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 "titanic/moves/enter_exit_mini_lift.h" + +namespace Titanic { + +void CEnterExitMiniLift::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + + CSGTNavigation::save(file, indent); +} + +void CEnterExitMiniLift::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + + CSGTNavigation::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/moves/enter_exit_mini_lift.h b/engines/titanic/moves/enter_exit_mini_lift.h new file mode 100644 index 0000000000..417e25d13f --- /dev/null +++ b/engines/titanic/moves/enter_exit_mini_lift.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_ENTER_EXIT_MINI_LIFT_H +#define TITANIC_ENTER_EXIT_MINI_LIFT_H + +#include "titanic/game/sgt/sgt_navigation.h" + +namespace Titanic { + +class CEnterExitMiniLift : public CSGTNavigation { +private: + int _fieldBC; + int _fieldC0; +public: + CEnterExitMiniLift() : CSGTNavigation(), _fieldBC(0), _fieldC0(1) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CEnterExitMiniLift"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ENTER_EXIT_MINI_LIFT_H */ diff --git a/engines/titanic/moves/enter_exit_sec_class_mini_lift.cpp b/engines/titanic/moves/enter_exit_sec_class_mini_lift.cpp new file mode 100644 index 0000000000..11df8d9ad8 --- /dev/null +++ b/engines/titanic/moves/enter_exit_sec_class_mini_lift.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/moves/enter_exit_sec_class_mini_lift.h" + +namespace Titanic { + +void CEnterExitSecClassMiniLift::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CEnterExitSecClassMiniLift::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/moves/enter_exit_sec_class_mini_lift.h b/engines/titanic/moves/enter_exit_sec_class_mini_lift.h new file mode 100644 index 0000000000..aa3f9b3731 --- /dev/null +++ b/engines/titanic/moves/enter_exit_sec_class_mini_lift.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_ENTER_EXIT_SEC_CLASS_MINI_LIFT_H +#define TITANIC_ENTER_EXIT_SEC_CLASS_MINI_LIFT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CEnterExitSecClassMiniLift : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CEnterExitSecClassMiniLift"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ENTER_EXIT_SEC_CLASS_MINI_LIFT_H */ diff --git a/engines/titanic/moves/enter_exit_view.cpp b/engines/titanic/moves/enter_exit_view.cpp new file mode 100644 index 0000000000..3e5789eebe --- /dev/null +++ b/engines/titanic/moves/enter_exit_view.cpp @@ -0,0 +1,53 @@ +/* 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 "titanic/moves/enter_exit_view.h" + +namespace Titanic { + +CEnterExitView::CEnterExitView() : CGameObject(), _fieldBC(0), + _fieldC0(0), _fieldC4(0), _fieldC8(0), _fieldCC(0) { +} + +void CEnterExitView::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_fieldC4, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeNumberLine(_fieldCC, indent); + + CGameObject::save(file, indent); +} + +void CEnterExitView::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _fieldC4 = file->readNumber(); + _fieldC8 = file->readNumber(); + _fieldCC = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/moves/enter_exit_view.h b/engines/titanic/moves/enter_exit_view.h new file mode 100644 index 0000000000..05ed63da5c --- /dev/null +++ b/engines/titanic/moves/enter_exit_view.h @@ -0,0 +1,58 @@ +/* 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. + * + */ + +#ifndef TITANIC_ENTER_EXIT_VIEW_H +#define TITANIC_ENTER_EXIT_VIEW_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CEnterExitView : public CGameObject { +public: + int _fieldBC; + int _fieldC0; + int _fieldC4; + int _fieldC8; + int _fieldCC; +public: + CEnterExitView(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CEnterExitView"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ENTER_EXIT_VIEW_H */ diff --git a/engines/titanic/moves/enter_sec_class_state.cpp b/engines/titanic/moves/enter_sec_class_state.cpp new file mode 100644 index 0000000000..74f6176650 --- /dev/null +++ b/engines/titanic/moves/enter_sec_class_state.cpp @@ -0,0 +1,43 @@ +/* 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 "titanic/moves/enter_sec_class_state.h" + +namespace Titanic { + +void CEnterSecClassState::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value1, indent); + file->writeNumberLine(_value2, indent); + + CGameObject::save(file, indent); +} + +void CEnterSecClassState::load(SimpleFile *file) { + file->readNumber(); + _value1 = file->readNumber(); + _value2 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/moves/enter_sec_class_state.h b/engines/titanic/moves/enter_sec_class_state.h new file mode 100644 index 0000000000..5da623dc08 --- /dev/null +++ b/engines/titanic/moves/enter_sec_class_state.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_ENTER_SEC_CLASS_STATE_H +#define TITANIC_ENTER_SEC_CLASS_STATE_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CEnterSecClassState : public CGameObject { +public: + int _value1, _value2; +public: + CEnterSecClassState() : CGameObject(), _value1(0), _value2(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CEnterSecClassState"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ENTER_SEC_CLASS_STATE_H */ diff --git a/engines/titanic/moves/exit_lift.cpp b/engines/titanic/moves/exit_lift.cpp new file mode 100644 index 0000000000..376b9e04f1 --- /dev/null +++ b/engines/titanic/moves/exit_lift.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/moves/exit_lift.h" + +namespace Titanic { + +void CExitLift::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_value, indent); + CGameObject::save(file, indent); +} + +void CExitLift::load(SimpleFile *file) { + file->readNumber(); + _value = file->readString(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/moves/exit_lift.h b/engines/titanic/moves/exit_lift.h new file mode 100644 index 0000000000..534de1b8ec --- /dev/null +++ b/engines/titanic/moves/exit_lift.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_EXIT_LIFT_H +#define TITANIC_EXIT_LIFT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CExitLift : public CGameObject { +public: + CString _value; +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CExitLift"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_EXIT_LIFT_H */ diff --git a/engines/titanic/moves/exit_pellerator.cpp b/engines/titanic/moves/exit_pellerator.cpp new file mode 100644 index 0000000000..81bec82748 --- /dev/null +++ b/engines/titanic/moves/exit_pellerator.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/moves/exit_pellerator.h" + +namespace Titanic { + +void CExitPellerator::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CExitPellerator::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/moves/exit_pellerator.h b/engines/titanic/moves/exit_pellerator.h new file mode 100644 index 0000000000..6185f61e01 --- /dev/null +++ b/engines/titanic/moves/exit_pellerator.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_EXIT_PELLERATOR_H +#define TITANIC_EXIT_PELLERATOR_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CExitPellerator : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CExitPellerator"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_EXIT_PELLERATOR_H */ diff --git a/engines/titanic/sound/auto_sound_player.cpp b/engines/titanic/sound/auto_sound_player.cpp index 619c36298e..7b20f65907 100644 --- a/engines/titanic/sound/auto_sound_player.cpp +++ b/engines/titanic/sound/auto_sound_player.cpp @@ -25,17 +25,39 @@ namespace Titanic { CAutoSoundPlayer::CAutoSoundPlayer() : CGameObject(), - _fieldC8(0), _fieldCC(70), _fieldD0(0), _fieldD4(0), _fieldD8(-1), + _fieldBC(0), _fieldCC(70), _fieldD0(0), _fieldD4(0), _fieldD8(-1), _fieldDC(0), _fieldE0(-1), _fieldE4(0), _fieldE8(0) { } void CAutoSoundPlayer::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeQuotedLine(_string1, indent); + file->writeNumberLine(_fieldCC, indent); + file->writeNumberLine(_fieldD0, indent); + file->writeNumberLine(_fieldD4, indent); + file->writeNumberLine(_fieldD8, indent); + file->writeNumberLine(_fieldDC, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + CGameObject::save(file, indent); } void CAutoSoundPlayer::load(SimpleFile *file) { file->readNumber(); + _fieldBC = file->readNumber(); + _string1 = file->readString(); + _fieldCC = file->readNumber(); + _fieldD0 = file->readNumber(); + _fieldD4 = file->readNumber(); + _fieldD8 = file->readNumber(); + _fieldDC = file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + CGameObject::load(file); } diff --git a/engines/titanic/sound/auto_sound_player.h b/engines/titanic/sound/auto_sound_player.h index 07ac0acd2e..bc849341df 100644 --- a/engines/titanic/sound/auto_sound_player.h +++ b/engines/titanic/sound/auto_sound_player.h @@ -29,8 +29,8 @@ namespace Titanic { class CAutoSoundPlayer : public CGameObject { public: + int _fieldBC; CString _string1; - int _fieldC8; int _fieldCC; int _fieldD0; int _fieldD4; diff --git a/engines/titanic/sound/bird_song.cpp b/engines/titanic/sound/bird_song.cpp new file mode 100644 index 0000000000..f003a4f2c4 --- /dev/null +++ b/engines/titanic/sound/bird_song.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/sound/bird_song.h" + +namespace Titanic { + +void CBirdSong::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CRoomAutoSoundPlayer::save(file, indent); +} + +void CBirdSong::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CRoomAutoSoundPlayer::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/sound/bird_song.h b/engines/titanic/sound/bird_song.h new file mode 100644 index 0000000000..50c1f2b722 --- /dev/null +++ b/engines/titanic/sound/bird_song.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_BIRD_SONG_H +#define TITANIC_BIRD_SONG_H + +#include "titanic/sound/room_auto_sound_player.h" + +namespace Titanic { + +class CBirdSong : public CRoomAutoSoundPlayer { +public: + int _value; +public: + CBirdSong() : CRoomAutoSoundPlayer(), _value(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBirdSong"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BIRD_SONG_H */ diff --git a/engines/titanic/sound/gondolier_song.cpp b/engines/titanic/sound/gondolier_song.cpp new file mode 100644 index 0000000000..52b7ae04bf --- /dev/null +++ b/engines/titanic/sound/gondolier_song.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/sound/gondolier_song.h" + +namespace Titanic { + +void CGondolierSong::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CRoomAutoSoundPlayer::save(file, indent); +} + +void CGondolierSong::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CRoomAutoSoundPlayer::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/sound/gondolier_song.h b/engines/titanic/sound/gondolier_song.h new file mode 100644 index 0000000000..38f7e867f8 --- /dev/null +++ b/engines/titanic/sound/gondolier_song.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_GONDOLIER_SONG_H +#define TITANIC_GONDOLIER_SONG_H + +#include "titanic/sound/room_auto_sound_player.h" + +namespace Titanic { + +class CGondolierSong : public CRoomAutoSoundPlayer { +public: + int _value; +public: + CGondolierSong() : CRoomAutoSoundPlayer(), _value(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CGondolierSong"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_GONDOLIER_SONG_H */ diff --git a/engines/titanic/sound/room_auto_sound_player.cpp b/engines/titanic/sound/room_auto_sound_player.cpp new file mode 100644 index 0000000000..8c54726afc --- /dev/null +++ b/engines/titanic/sound/room_auto_sound_player.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/sound/room_auto_sound_player.h" + +namespace Titanic { + +void CRoomAutoSoundPlayer::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CAutoSoundPlayer::save(file, indent); +} + +void CRoomAutoSoundPlayer::load(SimpleFile *file) { + file->readNumber(); + CAutoSoundPlayer::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/sound/room_auto_sound_player.h b/engines/titanic/sound/room_auto_sound_player.h new file mode 100644 index 0000000000..719eddcb84 --- /dev/null +++ b/engines/titanic/sound/room_auto_sound_player.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_ROOM_AUTO_SOUND_PLAYER_H +#define TITANIC_ROOM_AUTO_SOUND_PLAYER_H + +#include "titanic/sound/auto_sound_player.h" + +namespace Titanic { + +class CRoomAutoSoundPlayer : public CAutoSoundPlayer { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CRoomAutoSoundPlayer"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ROOM_AUTO_SOUND_PLAYER_H */ diff --git a/engines/titanic/sound/water_lapping_sounds.cpp b/engines/titanic/sound/water_lapping_sounds.cpp new file mode 100644 index 0000000000..7222b5a16d --- /dev/null +++ b/engines/titanic/sound/water_lapping_sounds.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/sound/water_lapping_sounds.h" + +namespace Titanic { + +void CWaterLappingSounds::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CRoomAutoSoundPlayer::save(file, indent); +} + +void CWaterLappingSounds::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CRoomAutoSoundPlayer::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/sound/water_lapping_sounds.h b/engines/titanic/sound/water_lapping_sounds.h new file mode 100644 index 0000000000..3dd72b5250 --- /dev/null +++ b/engines/titanic/sound/water_lapping_sounds.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_WATER_LAPPING_SOUNDS_H +#define TITANIC_WATER_LAPPING_SOUNDS_H + +#include "titanic/sound/room_auto_sound_player.h" + +namespace Titanic { + +class CWaterLappingSounds : public CRoomAutoSoundPlayer { +public: + int _value; +public: + CWaterLappingSounds() : CRoomAutoSoundPlayer(), _value(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CWaterLappingSounds"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_WATER_LAPPING_SOUNDS_H */ diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index 03dbacd6da..d8d4c77429 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -28,12 +28,13 @@ #include "graphics/scaler.h" #include "graphics/thumbnail.h" #include "titanic/titanic.h" +#include "titanic/carry/hose.h" #include "titanic/core/saveable_object.h" -#include "titanic/game/enter_exit_first_class_state.h" +#include "titanic/game/get_lift_eye2.h" #include "titanic/game/parrot/parrot_lobby_object.h" #include "titanic/game/sgt/sgt_navigation.h" #include "titanic/game/sgt/sgt_state_room.h" -#include "titanic/carry/hose.h" +#include "titanic/moves/enter_exit_first_class_state.h" namespace Titanic { @@ -57,9 +58,10 @@ void TitanicEngine::initialize() { DebugMan.addDebugChannel(kDebugSound, "sound", "Sound and Music handling"); CSaveableObject::initClassList(); - CParrotLobbyObject::init(); CEnterExitFirstClassState::init(); + CGetLiftEye2::init(); CHose::init(); + CParrotLobbyObject::init(); CSGTNavigation::init(); CSGTStateRoom::init(); @@ -70,6 +72,7 @@ void TitanicEngine::initialize() { void TitanicEngine::deinitialize() { CEnterExitFirstClassState::deinit(); + CGetLiftEye2::deinit(); CHose::deinit(); CSGTNavigation::deinit(); CSGTStateRoom::deinit(); -- cgit v1.2.3 From f7e057e4d74a7f38ac40024bba29ebc0071975c5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 1 Mar 2016 23:40:59 -0500 Subject: TITANIC: Added more miscellaneous classes --- engines/titanic/core/saveable_object.cpp | 124 ++++++++++++++++++++- engines/titanic/game/annoy_barbot.cpp | 4 + engines/titanic/game/annoy_barbot.h | 2 + engines/titanic/game/bar_menu.cpp | 8 ++ engines/titanic/game/doorbot_elevator_handler.cpp | 4 + engines/titanic/game/doorbot_elevator_handler.h | 3 +- engines/titanic/game/drawer.cpp | 42 ------- engines/titanic/game/drawer.h | 54 --------- engines/titanic/game/elevator_action_area.cpp | 2 + engines/titanic/game/emma_control.cpp | 4 + engines/titanic/game/emma_control.h | 4 +- engines/titanic/game/long_stick_dispenser.cpp | 8 ++ engines/titanic/game/long_stick_dispenser.h | 2 +- engines/titanic/game/pet/pet_lift.cpp | 37 ++++++ engines/titanic/game/pet/pet_lift.h | 50 +++++++++ engines/titanic/game/pet/pet_pellerator.cpp | 37 ++++++ engines/titanic/game/pet/pet_pellerator.h | 50 +++++++++ engines/titanic/game/pickup/pick_up.cpp | 39 +++++++ engines/titanic/game/pickup/pick_up.h | 54 +++++++++ engines/titanic/game/pickup/pick_up_bar_glass.cpp | 37 ++++++ engines/titanic/game/pickup/pick_up_bar_glass.h | 50 +++++++++ engines/titanic/game/pickup/pick_up_hose.cpp | 39 +++++++ engines/titanic/game/pickup/pick_up_hose.h | 52 +++++++++ engines/titanic/game/pickup/pick_up_lemon.cpp | 37 ++++++ engines/titanic/game/pickup/pick_up_lemon.h | 50 +++++++++ .../titanic/game/pickup/pick_up_speech_centre.cpp | 37 ++++++ .../titanic/game/pickup/pick_up_speech_centre.h | 50 +++++++++ engines/titanic/game/pickup/pick_up_vis_centre.cpp | 37 ++++++ engines/titanic/game/pickup/pick_up_vis_centre.h | 50 +++++++++ engines/titanic/game/place_holder.cpp | 37 ------ engines/titanic/game/place_holder.h | 50 --------- .../game/placeholder/bar_shelf_vis_centre.cpp | 39 +++++++ .../game/placeholder/bar_shelf_vis_centre.h | 53 +++++++++ engines/titanic/game/placeholder/lemon_on_bar.cpp | 39 +++++++ engines/titanic/game/placeholder/lemon_on_bar.h | 52 +++++++++ engines/titanic/game/placeholder/place_holder.cpp | 37 ++++++ engines/titanic/game/placeholder/place_holder.h | 50 +++++++++ engines/titanic/game/placeholder/tv_on_bar.cpp | 39 +++++++ engines/titanic/game/placeholder/tv_on_bar.h | 52 +++++++++ engines/titanic/game/sgt/armchair.cpp | 37 ++++++ engines/titanic/game/sgt/armchair.h | 50 +++++++++ engines/titanic/game/sgt/basin.cpp | 37 ++++++ engines/titanic/game/sgt/basin.h | 50 +++++++++ engines/titanic/game/sgt/bedfoot.cpp | 37 ++++++ engines/titanic/game/sgt/bedfoot.h | 50 +++++++++ engines/titanic/game/sgt/bedhead.cpp | 37 ++++++ engines/titanic/game/sgt/bedhead.h | 50 +++++++++ engines/titanic/game/sgt/chest_of_drawers.cpp | 37 ++++++ engines/titanic/game/sgt/chest_of_drawers.h | 50 +++++++++ engines/titanic/game/sgt/desk.cpp | 37 ++++++ engines/titanic/game/sgt/desk.h | 50 +++++++++ engines/titanic/game/sgt/deskchair.cpp | 37 ++++++ engines/titanic/game/sgt/deskchair.h | 50 +++++++++ engines/titanic/game/sgt/drawer.cpp | 42 +++++++ engines/titanic/game/sgt/drawer.h | 54 +++++++++ engines/titanic/game/sgt/sgt_nav.cpp | 37 ++++++ engines/titanic/game/sgt/sgt_nav.h | 50 +++++++++ engines/titanic/game/sgt/sgt_state_control.cpp | 39 +++++++ engines/titanic/game/sgt/sgt_state_control.h | 54 +++++++++ engines/titanic/game/sgt/sgt_tv.cpp | 37 ++++++ engines/titanic/game/sgt/sgt_tv.h | 50 +++++++++ engines/titanic/game/sgt/toilet.cpp | 37 ++++++ engines/titanic/game/sgt/toilet.h | 50 +++++++++ engines/titanic/game/sgt/vase.cpp | 37 ++++++ engines/titanic/game/sgt/vase.h | 50 +++++++++ engines/titanic/game/sgt/washstand.cpp | 37 ++++++ engines/titanic/game/sgt/washstand.h | 50 +++++++++ engines/titanic/game/transport/exit_pellerator.cpp | 46 ++++++++ engines/titanic/game/transport/exit_pellerator.h | 53 +++++++++ engines/titanic/game/transport/pellerator.cpp | 9 ++ engines/titanic/game/transport/pellerator.h | 3 + .../titanic/game/transport/service_elevator.cpp | 10 ++ engines/titanic/game/transport/service_elevator.h | 6 +- engines/titanic/module.mk | 27 ++++- .../moves/enter_exit_sec_class_mini_lift.cpp | 18 +++ .../titanic/moves/enter_exit_sec_class_mini_lift.h | 13 +++ engines/titanic/moves/exit_pellerator.cpp | 18 +++ engines/titanic/moves/exit_pellerator.h | 11 ++ engines/titanic/titanic.cpp | 6 + 79 files changed, 2677 insertions(+), 191 deletions(-) delete mode 100644 engines/titanic/game/drawer.cpp delete mode 100644 engines/titanic/game/drawer.h create mode 100644 engines/titanic/game/pet/pet_lift.cpp create mode 100644 engines/titanic/game/pet/pet_lift.h create mode 100644 engines/titanic/game/pet/pet_pellerator.cpp create mode 100644 engines/titanic/game/pet/pet_pellerator.h create mode 100644 engines/titanic/game/pickup/pick_up.cpp create mode 100644 engines/titanic/game/pickup/pick_up.h create mode 100644 engines/titanic/game/pickup/pick_up_bar_glass.cpp create mode 100644 engines/titanic/game/pickup/pick_up_bar_glass.h create mode 100644 engines/titanic/game/pickup/pick_up_hose.cpp create mode 100644 engines/titanic/game/pickup/pick_up_hose.h create mode 100644 engines/titanic/game/pickup/pick_up_lemon.cpp create mode 100644 engines/titanic/game/pickup/pick_up_lemon.h create mode 100644 engines/titanic/game/pickup/pick_up_speech_centre.cpp create mode 100644 engines/titanic/game/pickup/pick_up_speech_centre.h create mode 100644 engines/titanic/game/pickup/pick_up_vis_centre.cpp create mode 100644 engines/titanic/game/pickup/pick_up_vis_centre.h delete mode 100644 engines/titanic/game/place_holder.cpp delete mode 100644 engines/titanic/game/place_holder.h create mode 100644 engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp create mode 100644 engines/titanic/game/placeholder/bar_shelf_vis_centre.h create mode 100644 engines/titanic/game/placeholder/lemon_on_bar.cpp create mode 100644 engines/titanic/game/placeholder/lemon_on_bar.h create mode 100644 engines/titanic/game/placeholder/place_holder.cpp create mode 100644 engines/titanic/game/placeholder/place_holder.h create mode 100644 engines/titanic/game/placeholder/tv_on_bar.cpp create mode 100644 engines/titanic/game/placeholder/tv_on_bar.h create mode 100644 engines/titanic/game/sgt/armchair.cpp create mode 100644 engines/titanic/game/sgt/armchair.h create mode 100644 engines/titanic/game/sgt/basin.cpp create mode 100644 engines/titanic/game/sgt/basin.h create mode 100644 engines/titanic/game/sgt/bedfoot.cpp create mode 100644 engines/titanic/game/sgt/bedfoot.h create mode 100644 engines/titanic/game/sgt/bedhead.cpp create mode 100644 engines/titanic/game/sgt/bedhead.h create mode 100644 engines/titanic/game/sgt/chest_of_drawers.cpp create mode 100644 engines/titanic/game/sgt/chest_of_drawers.h create mode 100644 engines/titanic/game/sgt/desk.cpp create mode 100644 engines/titanic/game/sgt/desk.h create mode 100644 engines/titanic/game/sgt/deskchair.cpp create mode 100644 engines/titanic/game/sgt/deskchair.h create mode 100644 engines/titanic/game/sgt/drawer.cpp create mode 100644 engines/titanic/game/sgt/drawer.h create mode 100644 engines/titanic/game/sgt/sgt_nav.cpp create mode 100644 engines/titanic/game/sgt/sgt_nav.h create mode 100644 engines/titanic/game/sgt/sgt_state_control.cpp create mode 100644 engines/titanic/game/sgt/sgt_state_control.h create mode 100644 engines/titanic/game/sgt/sgt_tv.cpp create mode 100644 engines/titanic/game/sgt/sgt_tv.h create mode 100644 engines/titanic/game/sgt/toilet.cpp create mode 100644 engines/titanic/game/sgt/toilet.h create mode 100644 engines/titanic/game/sgt/vase.cpp create mode 100644 engines/titanic/game/sgt/vase.h create mode 100644 engines/titanic/game/sgt/washstand.cpp create mode 100644 engines/titanic/game/sgt/washstand.h create mode 100644 engines/titanic/game/transport/exit_pellerator.cpp create mode 100644 engines/titanic/game/transport/exit_pellerator.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 08a3668053..a2273fdff1 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -77,9 +77,13 @@ #include "titanic/core/view_item.h" #include "titanic/game/announce.h" +#include "titanic/game/annoy_barbot.h" #include "titanic/game/arb_background.h" #include "titanic/game/arboretum_gate.h" #include "titanic/game/auto_animate.h" +#include "titanic/game/bar_bell.h" +#include "titanic/game/bar_menu.h" +#include "titanic/game/bar_menu_button.h" #include "titanic/game/belbot_get_light.h" #include "titanic/game/bomb.h" #include "titanic/game/bowl_unlocker.h" @@ -102,10 +106,11 @@ #include "titanic/game/credits_button.h" #include "titanic/game/dead_area.h" #include "titanic/game/desk_click_responder.h" +#include "titanic/game/doorbot_elevator_handler.h" #include "titanic/game/doorbot_home_handler.h" -#include "titanic/game/drawer.h" #include "titanic/game/ear_sweet_bowl.h" #include "titanic/game/eject_phonograph_button.h" +#include "titanic/game/elevator_action_area.h" #include "titanic/game/emma_control.h" #include "titanic/game/empty_nut_bowl.h" #include "titanic/game/end_credit_text.h" @@ -121,15 +126,18 @@ #include "titanic/game/floor_indicator.h" #include "titanic/game/games_console.h" #include "titanic/game/get_lift_eye2.h" +#include "titanic/game/glass_smasher.h" #include "titanic/game/hammer_clip.h" #include "titanic/game/hammer_dispensor.h" #include "titanic/game/hammer_dispensor_button.h" #include "titanic/game/head_smash_event.h" #include "titanic/game/head_smash_lever.h" +#include "titanic/game/idle_summoner.h" #include "titanic/game/lemon_dispensor.h" #include "titanic/game/light.h" #include "titanic/game/light_switch.h" #include "titanic/game/little_lift_button.h" +#include "titanic/game/long_stick_dispenser.h" #include "titanic/game/maitred_arm_holder.h" #include "titanic/game/musical_instrument.h" #include "titanic/game/music_console_button.h" @@ -165,6 +173,7 @@ #include "titanic/game/television.h" #include "titanic/game/third_class_canal.h" #include "titanic/game/throw_tv_down_well.h" +#include "titanic/game/tow_parrot_nav.h" #include "titanic/game/up_lighter.h" #include "titanic/game/wheel_button.h" #include "titanic/game/wheel_hotspot.h" @@ -184,17 +193,43 @@ #include "titanic/game/pet/pet_class1.h" #include "titanic/game/pet/pet_class2.h" #include "titanic/game/pet/pet_class3.h" +#include "titanic/game/pet/pet_lift.h" #include "titanic/game/pet/pet_monitor.h" +#include "titanic/game/pet/pet_pellerator.h" #include "titanic/game/pet/pet_position.h" #include "titanic/game/pet/pet_sentinal.h" #include "titanic/game/pet/pet_sounds.h" #include "titanic/game/pet/pet_transition.h" #include "titanic/game/pet/pet_transport.h" +#include "titanic/game/pickup/pick_up.h" +#include "titanic/game/pickup/pick_up_bar_glass.h" +#include "titanic/game/pickup/pick_up_hose.h" +#include "titanic/game/pickup/pick_up_lemon.h" +#include "titanic/game/pickup/pick_up_speech_centre.h" +#include "titanic/game/pickup/pick_up_vis_centre.h" +#include "titanic/game/placeholder/bar_shelf_vis_centre.h" +#include "titanic/game/placeholder/lemon_on_bar.h" +#include "titanic/game/placeholder/place_holder.h" +#include "titanic/game/placeholder/tv_on_bar.h" +#include "titanic/game/sgt/armchair.h" +#include "titanic/game/sgt/basin.h" +#include "titanic/game/sgt/bedfoot.h" +#include "titanic/game/sgt/bedhead.h" +#include "titanic/game/sgt/chest_of_drawers.h" +#include "titanic/game/sgt/desk.h" +#include "titanic/game/sgt/deskchair.h" +#include "titanic/game/sgt/drawer.h" #include "titanic/game/sgt/sgt_doors.h" +#include "titanic/game/sgt/sgt_nav.h" #include "titanic/game/sgt/sgt_navigation.h" #include "titanic/game/sgt/sgt_restaurant_doors.h" +#include "titanic/game/sgt/sgt_state_control.h" #include "titanic/game/sgt/sgt_state_room.h" +#include "titanic/game/sgt/sgt_tv.h" #include "titanic/game/sgt/sgt_upper_doors_sound.h" +#include "titanic/game/sgt/toilet.h" +#include "titanic/game/sgt/vase.h" +#include "titanic/game/sgt/washstand.h" #include "titanic/game/transport/gondolier.h" #include "titanic/game/transport/lift.h" #include "titanic/game/transport/lift_indicator.h" @@ -248,10 +283,13 @@ #include "titanic/moves/enter_bridge.h" #include "titanic/moves/enter_exit_first_class_state.h" #include "titanic/moves/enter_exit_mini_lift.h" +#include "titanic/moves/enter_exit_sec_class_mini_lift.h" #include "titanic/moves/enter_exit_view.h" +#include "titanic/moves/enter_sec_class_state.h" #include "titanic/moves/exit_arboretum.h" #include "titanic/moves/exit_bridge.h" #include "titanic/moves/exit_lift.h" +#include "titanic/moves/exit_pellerator.h" #include "titanic/moves/exit_state_room.h" #include "titanic/moves/move_player_in_parrot_room.h" #include "titanic/moves/move_player_to.h" @@ -354,9 +392,13 @@ DEFFN(CTreeItem); DEFFN(CViewItem); DEFFN(CAnnounce); +DEFFN(CAnnoyBarbot); DEFFN(CArbBackground); DEFFN(CArboretumGate); DEFFN(CAutoAnimate); +DEFFN(CBarBell); +DEFFN(CBarMenu); +DEFFN(CBarMenuButton); DEFFN(CBelbotGetLight); DEFFN(CBowlUnlocker); DEFFN(CBomb); @@ -378,9 +420,11 @@ DEFFN(CCredits); DEFFN(CCreditsButton); DEFFN(CDeadArea); DEFFN(CDeskClickResponder); +DEFFN(CDoorbotElevatorHandler); DEFFN(CDoorbotHomeHandler); DEFFN(CEarSweetBowl); DEFFN(CEjectPhonographButton); +DEFFN(CElevatorActionArea); DEFFN(CEmmaControl); DEFFN(CEmptyNutBowl); DEFFN(CEndCreditText); @@ -396,15 +440,18 @@ DEFFN(CFanNoises); DEFFN(CFloorIndicator); DEFFN(CGamesConsole); DEFFN(CGetLiftEye2); +DEFFN(CGlassSmasher); DEFFN(CHammerClip); DEFFN(CHammerDispensor); DEFFN(CHammerDispensorButton); DEFFN(CHeadSmashEvent); DEFFN(CHeadSmashLever); +DEFFN(CIdleSummoner); DEFFN(CLemonDispensor); DEFFN(CLight); DEFFN(CLightSwitch); DEFFN(CLittleLiftButton); +DEFFN(CLongStickDispenser); DEFFN(CMaitreDArmHolder); DEFFN(CMusicalInstrument); DEFFN(CMusicConsoleButton); @@ -440,6 +487,7 @@ DEFFN(CSweetBowl); DEFFN(CTelevision); DEFFN(CThirdClassCanal); DEFFN(CThrowTVDownWell); +DEFFN(CTOWParrotNav); DEFFN(CUpLighter); DEFFN(CWheelButton); DEFFN(CWheelHotSpot); @@ -459,18 +507,44 @@ DEFFN(CPET); DEFFN(CPETClass1); DEFFN(CPETClass2); DEFFN(CPETClass3); +DEFFN(CPETLift); DEFFN(CPETMonitor); +DEFFN(CPETPellerator); DEFFN(CPETPosition); DEFFN(CPETSentinal); DEFFN(CPETSounds); DEFFN(CPETTransition); DEFFN(CPETTransport); -DEFFN(CEnterExitMiniLift); +DEFFN(CPickUp); +DEFFN(CPickUpBarGlass); +DEFFN(CPickUpHose); +DEFFN(CPickUpLemon); +DEFFN(CPickUpSpeechCentre); +DEFFN(CPickUpVisCentre); +DEFFN(CBarShelfVisCentre); +DEFFN(CLemonOnBar); +DEFFN(CPlaceHolder); +DEFFN(CTVOnBar); +DEFFN(CArmchair); +DEFFN(CBasin); +DEFFN(CBedfoot); +DEFFN(CBedhead); +DEFFN(CChestOfDrawers); +DEFFN(CDesk); +DEFFN(CDeskchair); +DEFFN(CDrawer); DEFFN(CSGTDoors); +DEFFN(SGTNav); DEFFN(CSGTNavigation); DEFFN(CSGTRestaurantDoors); +DEFFN(CSGTStateControl); DEFFN(CSGTStateRoom); +DEFFN(CSGTTV); DEFFN(CSGTUpperDoorsSound); +DEFFN(CToilet); +DEFFN(CVase); +DEFFN(CWashstand); + DEFFN(CGondolier); DEFFN(CLift); DEFFN(CLiftindicator); @@ -696,10 +770,14 @@ DEFFN(CVisibleMsg); DEFFN(CEnterBombRoom); DEFFN(CEnterBridge); DEFFN(CEnterExitFirstClassState); +DEFFN(CEnterExitMiniLift); +DEFFN(CEnterExitSecClassMiniLift); DEFFN(CEnterExitView); +DEFFN(CEnterSecClassState); DEFFN(CExitArboretum); DEFFN(CExitBridge); DEFFN(CExitLift); +DEFFN(CExitPellerator); DEFFN(CExitStateRoom); DEFFN(CMovePlayerInParrotRoom); DEFFN(CMovePlayerTo); @@ -795,9 +873,13 @@ void CSaveableObject::initClassList() { ADDFN(CViewItem); ADDFN(CAnnounce); + ADDFN(CAnnoyBarbot); ADDFN(CArbBackground); ADDFN(CArboretumGate); ADDFN(CAutoAnimate); + ADDFN(CBarBell); + ADDFN(CBarMenu); + ADDFN(CBarMenuButton); ADDFN(CBelbotGetLight); ADDFN(CBomb); ADDFN(CBowlUnlocker); @@ -819,10 +901,12 @@ void CSaveableObject::initClassList() { ADDFN(CCreditsButton); ADDFN(CDeadArea); ADDFN(CDeskClickResponder); + ADDFN(CDoorbotElevatorHandler); ADDFN(CDoorbotHomeHandler); ADDFN(CDropTarget); ADDFN(CEarSweetBowl); ADDFN(CEjectPhonographButton); + ADDFN(CElevatorActionArea); ADDFN(CEmmaControl); ADDFN(CEmptyNutBowl); ADDFN(CEndCreditText); @@ -838,15 +922,18 @@ void CSaveableObject::initClassList() { ADDFN(CFloorIndicator); ADDFN(CGamesConsole); ADDFN(CGetLiftEye2); + ADDFN(CGlassSmasher); ADDFN(CHammerClip); ADDFN(CHammerDispensor); ADDFN(CHammerDispensorButton); ADDFN(CHeadSmashEvent); ADDFN(CHeadSmashLever); + ADDFN(CIdleSummoner); ADDFN(CLemonDispensor); ADDFN(CLight); ADDFN(CLightSwitch); ADDFN(CLittleLiftButton); + ADDFN(CLongStickDispenser); ADDFN(CMaitreDArmHolder); ADDFN(CMusicalInstrument); ADDFN(CMusicConsoleButton); @@ -882,6 +969,7 @@ void CSaveableObject::initClassList() { ADDFN(CTelevision); ADDFN(CThirdClassCanal); ADDFN(CThrowTVDownWell); + ADDFN(CTOWParrotNav); ADDFN(CUpLighter); ADDFN(CWheelButton); ADDFN(CWheelHotSpot); @@ -901,18 +989,44 @@ void CSaveableObject::initClassList() { ADDFN(CPETClass1); ADDFN(CPETClass2); ADDFN(CPETClass3); + ADDFN(CPETLift); ADDFN(CPETMonitor); + ADDFN(CPETPellerator); ADDFN(CPETPosition); ADDFN(CPETSentinal); ADDFN(CPETSounds); ADDFN(CPETTransition); ADDFN(CPETTransport); - ADDFN(CEnterExitMiniLift); + ADDFN(CPickUp); + ADDFN(CPickUpBarGlass); + ADDFN(CPickUpHose); + ADDFN(CPickUpLemon); + ADDFN(CPickUpSpeechCentre); + ADDFN(CPickUpVisCentre); + ADDFN(CBarShelfVisCentre); + ADDFN(CLemonOnBar); + ADDFN(CPlaceHolder); + ADDFN(CTVOnBar); + ADDFN(CArmchair); + ADDFN(CBasin); + ADDFN(CBedfoot); + ADDFN(CBedhead); + ADDFN(CChestOfDrawers); + ADDFN(CDesk); + ADDFN(CDeskchair); + ADDFN(CDrawer); ADDFN(CSGTDoors); + ADDFN(SGTNav); ADDFN(CSGTNavigation); ADDFN(CSGTRestaurantDoors); + ADDFN(CSGTStateControl); ADDFN(CSGTStateRoom); + ADDFN(CSGTTV); ADDFN(CSGTUpperDoorsSound); + ADDFN(CToilet); + ADDFN(CVase); + ADDFN(CWashstand); + ADDFN(CGondolier); ADDFN(CLift); ADDFN(CLiftindicator); @@ -1138,10 +1252,14 @@ void CSaveableObject::initClassList() { ADDFN(CEnterBombRoom); ADDFN(CEnterBridge); ADDFN(CEnterExitFirstClassState); + ADDFN(CEnterExitMiniLift); + ADDFN(CEnterExitSecClassMiniLift); ADDFN(CEnterExitView); + ADDFN(CEnterSecClassState); ADDFN(CExitArboretum); ADDFN(CExitBridge); ADDFN(CExitLift); + ADDFN(CExitPellerator); ADDFN(CExitStateRoom); ADDFN(CMovePlayerInParrotRoom); ADDFN(CMovePlayerTo); diff --git a/engines/titanic/game/annoy_barbot.cpp b/engines/titanic/game/annoy_barbot.cpp index c21e828659..caea823105 100644 --- a/engines/titanic/game/annoy_barbot.cpp +++ b/engines/titanic/game/annoy_barbot.cpp @@ -24,13 +24,17 @@ namespace Titanic { +int CAnnoyBarbot::_v1; + void CAnnoyBarbot::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeNumberLine(_v1, indent); CGameObject::save(file, indent); } void CAnnoyBarbot::load(SimpleFile *file) { file->readNumber(); + _v1 = file->readNumber(); CGameObject::load(file); } diff --git a/engines/titanic/game/annoy_barbot.h b/engines/titanic/game/annoy_barbot.h index 18be7c1b15..c1598e100d 100644 --- a/engines/titanic/game/annoy_barbot.h +++ b/engines/titanic/game/annoy_barbot.h @@ -28,6 +28,8 @@ namespace Titanic { class CAnnoyBarbot : public CGameObject { +private: + static int _v1; public: /** * Return the class name diff --git a/engines/titanic/game/bar_menu.cpp b/engines/titanic/game/bar_menu.cpp index 53ed48aa57..25da001660 100644 --- a/engines/titanic/game/bar_menu.cpp +++ b/engines/titanic/game/bar_menu.cpp @@ -29,11 +29,19 @@ CBarMenu::CBarMenu() : CGameObject(), _fieldBC(0), _fieldC0(0), _fieldC4(6) { void CBarMenu::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_fieldC4, indent); + CGameObject::save(file, indent); } void CBarMenu::load(SimpleFile *file) { file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _fieldC4 = file->readNumber(); + CGameObject::load(file); } diff --git a/engines/titanic/game/doorbot_elevator_handler.cpp b/engines/titanic/game/doorbot_elevator_handler.cpp index 1a85793bdd..e4232c087b 100644 --- a/engines/titanic/game/doorbot_elevator_handler.cpp +++ b/engines/titanic/game/doorbot_elevator_handler.cpp @@ -24,15 +24,19 @@ namespace Titanic { +int CDoorbotElevatorHandler::_v1; + void CDoorbotElevatorHandler::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); + file->writeNumberLine(_v1, indent); CGameObject::save(file, indent); } void CDoorbotElevatorHandler::load(SimpleFile *file) { file->readNumber(); _value = file->readNumber(); + _v1 = file->readNumber(); CGameObject::load(file); } diff --git a/engines/titanic/game/doorbot_elevator_handler.h b/engines/titanic/game/doorbot_elevator_handler.h index 041e2c5723..41d6068f1b 100644 --- a/engines/titanic/game/doorbot_elevator_handler.h +++ b/engines/titanic/game/doorbot_elevator_handler.h @@ -28,7 +28,8 @@ namespace Titanic { class CDoorbotElevatorHandler : public CGameObject { -public: +private: + static int _v1; int _value; public: /** diff --git a/engines/titanic/game/drawer.cpp b/engines/titanic/game/drawer.cpp deleted file mode 100644 index 3409522f9d..0000000000 --- a/engines/titanic/game/drawer.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* 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 "titanic/game/drawer.h" - -namespace Titanic { - -CDrawer::CDrawer() : CSGTStateRoom(), _fieldF4(0) { -} - -void CDrawer::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldF4, indent); - CSGTStateRoom::save(file, indent); -} - -void CDrawer::load(SimpleFile *file) { - file->readNumber(); - _fieldF4 = file->readNumber(); - CSGTStateRoom::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/drawer.h b/engines/titanic/game/drawer.h deleted file mode 100644 index 100e27cb52..0000000000 --- a/engines/titanic/game/drawer.h +++ /dev/null @@ -1,54 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_DRAWER_H -#define TITANIC_DRAWER_H - -#include "titanic/game/sgt/sgt_state_room.h" - -namespace Titanic { - -class CDrawer : public CSGTStateRoom { -private: - int _fieldF4; -public: - CDrawer(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CDrawer"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_DRAWER_H */ diff --git a/engines/titanic/game/elevator_action_area.cpp b/engines/titanic/game/elevator_action_area.cpp index 3beef1b0e1..c9916bfc73 100644 --- a/engines/titanic/game/elevator_action_area.cpp +++ b/engines/titanic/game/elevator_action_area.cpp @@ -26,11 +26,13 @@ namespace Titanic { void CElevatorActionArea::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); CGameObject::save(file, indent); } void CElevatorActionArea::load(SimpleFile *file) { file->readNumber(); + _value = file->readNumber(); CGameObject::load(file); } diff --git a/engines/titanic/game/emma_control.cpp b/engines/titanic/game/emma_control.cpp index ce3b325e4c..fac429ccec 100644 --- a/engines/titanic/game/emma_control.cpp +++ b/engines/titanic/game/emma_control.cpp @@ -24,8 +24,11 @@ namespace Titanic { +int CEmmaControl::_v1; + void CEmmaControl::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeNumberLine(_v1, indent); file->writeQuotedLine(_wavFile1, indent); file->writeQuotedLine(_wavFile2, indent); @@ -34,6 +37,7 @@ void CEmmaControl::save(SimpleFile *file, int indent) const { void CEmmaControl::load(SimpleFile *file) { file->readNumber(); + _v1 = file->readNumber(); _wavFile1 = file->readString(); _wavFile2 = file->readString(); diff --git a/engines/titanic/game/emma_control.h b/engines/titanic/game/emma_control.h index f61d2372d9..590c6f7fcf 100644 --- a/engines/titanic/game/emma_control.h +++ b/engines/titanic/game/emma_control.h @@ -28,7 +28,9 @@ namespace Titanic { class CEmmaControl : public CBackground { -public: +private: + static int _v1; + CString _wavFile1, _wavFile2; public: CEmmaControl() : CBackground(), _wavFile1("b#39.wav"), _wavFile2("b#38.wav") {} diff --git a/engines/titanic/game/long_stick_dispenser.cpp b/engines/titanic/game/long_stick_dispenser.cpp index bdd6240c70..97981cc01d 100644 --- a/engines/titanic/game/long_stick_dispenser.cpp +++ b/engines/titanic/game/long_stick_dispenser.cpp @@ -26,11 +26,19 @@ namespace Titanic { void CLongStickDispenser::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_fieldC4, indent); + CGameObject::save(file, indent); } void CLongStickDispenser::load(SimpleFile *file) { file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _fieldC4 = file->readNumber(); + CGameObject::load(file); } diff --git a/engines/titanic/game/long_stick_dispenser.h b/engines/titanic/game/long_stick_dispenser.h index 2e2842025c..4912ea384b 100644 --- a/engines/titanic/game/long_stick_dispenser.h +++ b/engines/titanic/game/long_stick_dispenser.h @@ -34,7 +34,7 @@ public: int _fieldC4; public: CLongStickDispenser() : CGameObject(), _fieldBC(0), - _fieldC0(0), _fieldC4(0) {} + _fieldC0(0), _fieldC4(1) {} /** * Return the class name diff --git a/engines/titanic/game/pet/pet_lift.cpp b/engines/titanic/game/pet/pet_lift.cpp new file mode 100644 index 0000000000..8a16c678d5 --- /dev/null +++ b/engines/titanic/game/pet/pet_lift.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/pet/pet_lift.h" + +namespace Titanic { + +void CPETLift::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CPETTransport::save(file, indent); +} + +void CPETLift::load(SimpleFile *file) { + file->readNumber(); + CPETTransport::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_lift.h b/engines/titanic/game/pet/pet_lift.h new file mode 100644 index 0000000000..11207cde26 --- /dev/null +++ b/engines/titanic/game/pet/pet_lift.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_LIFT_H +#define TITANIC_PET_LIFT_H + +#include "titanic/game/pet/pet_transport.h" + +namespace Titanic { + +class CPETLift : public CPETTransport { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPETLift"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_LIFT_H */ diff --git a/engines/titanic/game/pet/pet_pellerator.cpp b/engines/titanic/game/pet/pet_pellerator.cpp new file mode 100644 index 0000000000..bcddc75919 --- /dev/null +++ b/engines/titanic/game/pet/pet_pellerator.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/pet/pet_pellerator.h" + +namespace Titanic { + +void CPETPellerator::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CPETTransport::save(file, indent); +} + +void CPETPellerator::load(SimpleFile *file) { + file->readNumber(); + CPETTransport::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_pellerator.h b/engines/titanic/game/pet/pet_pellerator.h new file mode 100644 index 0000000000..7314f7297a --- /dev/null +++ b/engines/titanic/game/pet/pet_pellerator.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_PELLERATOR_H +#define TITANIC_PET_PELLERATOR_H + +#include "titanic/game/pet/pet_transport.h" + +namespace Titanic { + +class CPETPellerator : public CPETTransport { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPETPellerator"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_PELLERATOR_H */ diff --git a/engines/titanic/game/pickup/pick_up.cpp b/engines/titanic/game/pickup/pick_up.cpp new file mode 100644 index 0000000000..58ffc5ad09 --- /dev/null +++ b/engines/titanic/game/pickup/pick_up.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/pickup/pick_up.h" + +namespace Titanic { + +void CPickUp::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + CGameObject::save(file, indent); +} + +void CPickUp::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pickup/pick_up.h b/engines/titanic/game/pickup/pick_up.h new file mode 100644 index 0000000000..e1783ef322 --- /dev/null +++ b/engines/titanic/game/pickup/pick_up.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_PICK_UP_H +#define TITANIC_PICK_UP_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPickUp : public CGameObject { +private: + int _fieldBC; +public: + CPickUp() : CGameObject(), _fieldBC(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CAnnoyBarbot"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ANNOY_BARBOT_H */ diff --git a/engines/titanic/game/pickup/pick_up_bar_glass.cpp b/engines/titanic/game/pickup/pick_up_bar_glass.cpp new file mode 100644 index 0000000000..1d475c2a85 --- /dev/null +++ b/engines/titanic/game/pickup/pick_up_bar_glass.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/pickup/pick_up_bar_glass.h" + +namespace Titanic { + +void CPickUpBarGlass::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CPickUp::save(file, indent); +} + +void CPickUpBarGlass::load(SimpleFile *file) { + file->readNumber(); + CPickUp::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pickup/pick_up_bar_glass.h b/engines/titanic/game/pickup/pick_up_bar_glass.h new file mode 100644 index 0000000000..9bec56cdd5 --- /dev/null +++ b/engines/titanic/game/pickup/pick_up_bar_glass.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PICK_UP_BAR_GLASS_H +#define TITANIC_PICK_UP_BAR_GLASS_H + +#include "titanic/game/pickup/pick_up.h" + +namespace Titanic { + +class CPickUpBarGlass : public CPickUp { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPickUpBarGlass"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PICK_UP_BAR_GLASS_H */ diff --git a/engines/titanic/game/pickup/pick_up_hose.cpp b/engines/titanic/game/pickup/pick_up_hose.cpp new file mode 100644 index 0000000000..35ac7f8049 --- /dev/null +++ b/engines/titanic/game/pickup/pick_up_hose.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/pickup/pick_up_hose.h" + +namespace Titanic { + +void CPickUpHose::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string1, indent); + CPickUp::save(file, indent); +} + +void CPickUpHose::load(SimpleFile *file) { + file->readNumber(); + _string1 = file->readString(); + CPickUp::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pickup/pick_up_hose.h b/engines/titanic/game/pickup/pick_up_hose.h new file mode 100644 index 0000000000..56596c50fc --- /dev/null +++ b/engines/titanic/game/pickup/pick_up_hose.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_PICK_UP_HOSE_H +#define TITANIC_PICK_UP_HOSE_H + +#include "titanic/game/pickup/pick_up.h" + +namespace Titanic { + +class CPickUpHose : public CPickUp { +private: + CString _string1; +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPickUpHose"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PICK_UP_HOSE_H */ diff --git a/engines/titanic/game/pickup/pick_up_lemon.cpp b/engines/titanic/game/pickup/pick_up_lemon.cpp new file mode 100644 index 0000000000..7364fee299 --- /dev/null +++ b/engines/titanic/game/pickup/pick_up_lemon.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/pickup/pick_up_lemon.h" + +namespace Titanic { + +void CPickUpLemon::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CPickUp::save(file, indent); +} + +void CPickUpLemon::load(SimpleFile *file) { + file->readNumber(); + CPickUp::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pickup/pick_up_lemon.h b/engines/titanic/game/pickup/pick_up_lemon.h new file mode 100644 index 0000000000..fee2485c1e --- /dev/null +++ b/engines/titanic/game/pickup/pick_up_lemon.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PICK_UP_LEMON_H +#define TITANIC_PICK_UP_LEMON_H + +#include "titanic/game/pickup/pick_up.h" + +namespace Titanic { + +class CPickUpLemon : public CPickUp { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPickUpLemon"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PICK_UP_LEMON_H */ diff --git a/engines/titanic/game/pickup/pick_up_speech_centre.cpp b/engines/titanic/game/pickup/pick_up_speech_centre.cpp new file mode 100644 index 0000000000..74c473943e --- /dev/null +++ b/engines/titanic/game/pickup/pick_up_speech_centre.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/pickup/pick_up_speech_centre.h" + +namespace Titanic { + +void CPickUpSpeechCentre::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CPickUp::save(file, indent); +} + +void CPickUpSpeechCentre::load(SimpleFile *file) { + file->readNumber(); + CPickUp::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pickup/pick_up_speech_centre.h b/engines/titanic/game/pickup/pick_up_speech_centre.h new file mode 100644 index 0000000000..b68761b83c --- /dev/null +++ b/engines/titanic/game/pickup/pick_up_speech_centre.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PICK_UP_SPEECH_CENTRE_H +#define TITANIC_PICK_UP_SPEECH_CENTRE_H + +#include "titanic/game/pickup/pick_up.h" + +namespace Titanic { + +class CPickUpSpeechCentre : public CPickUp { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPickUpSpeechCentre"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PICK_UP_SPEECH_CENTRE_H */ diff --git a/engines/titanic/game/pickup/pick_up_vis_centre.cpp b/engines/titanic/game/pickup/pick_up_vis_centre.cpp new file mode 100644 index 0000000000..8fda66fe3d --- /dev/null +++ b/engines/titanic/game/pickup/pick_up_vis_centre.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/pickup/pick_up_vis_centre.h" + +namespace Titanic { + +void CPickUpVisCentre::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CPickUp::save(file, indent); +} + +void CPickUpVisCentre::load(SimpleFile *file) { + file->readNumber(); + CPickUp::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pickup/pick_up_vis_centre.h b/engines/titanic/game/pickup/pick_up_vis_centre.h new file mode 100644 index 0000000000..16db8f2b73 --- /dev/null +++ b/engines/titanic/game/pickup/pick_up_vis_centre.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PICK_UP_VIS_CENTRE_H +#define TITANIC_PICK_UP_VIS_CENTRE_H + +#include "titanic/game/pickup/pick_up.h" + +namespace Titanic { + +class CPickUpVisCentre : public CPickUp { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPickUpVisCentre"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PICK_UP_VIS_CENTRE_H */ diff --git a/engines/titanic/game/place_holder.cpp b/engines/titanic/game/place_holder.cpp deleted file mode 100644 index f0308809fa..0000000000 --- a/engines/titanic/game/place_holder.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 "titanic/game/place_holder.h" - -namespace Titanic { - -void CPlaceHolder::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - CGameObject::save(file, indent); -} - -void CPlaceHolder::load(SimpleFile *file) { - file->readNumber(); - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/place_holder.h b/engines/titanic/game/place_holder.h deleted file mode 100644 index dd1c89dd86..0000000000 --- a/engines/titanic/game/place_holder.h +++ /dev/null @@ -1,50 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PLACE_HOLDER_H -#define TITANIC_PLACE_HOLDER_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CPlaceHolder : public CGameObject { -public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPlaceHolder"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PLACE_HOLDER_H */ diff --git a/engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp b/engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp new file mode 100644 index 0000000000..3d3a05692f --- /dev/null +++ b/engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/placeholder/bar_shelf_vis_centre.h" + +namespace Titanic { + +void CBarShelfVisCentre::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CPlaceHolder::save(file, indent); +} + +void CBarShelfVisCentre::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CPlaceHolder::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/placeholder/bar_shelf_vis_centre.h b/engines/titanic/game/placeholder/bar_shelf_vis_centre.h new file mode 100644 index 0000000000..1cd3ca22bf --- /dev/null +++ b/engines/titanic/game/placeholder/bar_shelf_vis_centre.h @@ -0,0 +1,53 @@ +/* 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. + * + */ + +#ifndef TITANIC_BAR_SHELF_VIS_CENTRE_H +#define TITANIC_BAR_SHELF_VIS_CENTRE_H + +#include "titanic/game/placeholder/place_holder.h" + +namespace Titanic { + +class CBarShelfVisCentre : public CPlaceHolder { +private: + int _value; +public: + CBarShelfVisCentre() : CPlaceHolder(), _value(0) {} + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBarShelfVisCentre"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BAR_SHELF_VIS_CENTRE_H */ diff --git a/engines/titanic/game/placeholder/lemon_on_bar.cpp b/engines/titanic/game/placeholder/lemon_on_bar.cpp new file mode 100644 index 0000000000..336933a8df --- /dev/null +++ b/engines/titanic/game/placeholder/lemon_on_bar.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/placeholder/lemon_on_bar.h" + +namespace Titanic { + +void CLemonOnBar::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writePoint(_pos1, indent); + CPlaceHolder::save(file, indent); +} + +void CLemonOnBar::load(SimpleFile *file) { + file->readNumber(); + _pos1 = file->readPoint(); + CPlaceHolder::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/placeholder/lemon_on_bar.h b/engines/titanic/game/placeholder/lemon_on_bar.h new file mode 100644 index 0000000000..d02f7a9eb8 --- /dev/null +++ b/engines/titanic/game/placeholder/lemon_on_bar.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_LEMON_ON_BAR_H +#define TITANIC_LEMON_ON_BAR_H + +#include "titanic/game/placeholder/place_holder.h" + +namespace Titanic { + +class CLemonOnBar : public CPlaceHolder { +private: + Common::Point _pos1; +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CLemonOnBar"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_LEMON_ON_BAR_H */ diff --git a/engines/titanic/game/placeholder/place_holder.cpp b/engines/titanic/game/placeholder/place_holder.cpp new file mode 100644 index 0000000000..d96f551ee4 --- /dev/null +++ b/engines/titanic/game/placeholder/place_holder.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/placeholder/place_holder.h" + +namespace Titanic { + +void CPlaceHolder::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPlaceHolder::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/placeholder/place_holder.h b/engines/titanic/game/placeholder/place_holder.h new file mode 100644 index 0000000000..dd1c89dd86 --- /dev/null +++ b/engines/titanic/game/placeholder/place_holder.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PLACE_HOLDER_H +#define TITANIC_PLACE_HOLDER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPlaceHolder : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPlaceHolder"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PLACE_HOLDER_H */ diff --git a/engines/titanic/game/placeholder/tv_on_bar.cpp b/engines/titanic/game/placeholder/tv_on_bar.cpp new file mode 100644 index 0000000000..5b22069a93 --- /dev/null +++ b/engines/titanic/game/placeholder/tv_on_bar.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/placeholder/tv_on_bar.h" + +namespace Titanic { + +void CTVOnBar::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writePoint(_pos1, indent); + CPlaceHolder::save(file, indent); +} + +void CTVOnBar::load(SimpleFile *file) { + file->readNumber(); + _pos1 = file->readPoint(); + CPlaceHolder::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/placeholder/tv_on_bar.h b/engines/titanic/game/placeholder/tv_on_bar.h new file mode 100644 index 0000000000..1583dad05a --- /dev/null +++ b/engines/titanic/game/placeholder/tv_on_bar.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_TV_ON_BAR_H +#define TITANIC_TV_ON_BAR_H + +#include "titanic/game/placeholder/place_holder.h" + +namespace Titanic { + +class CTVOnBar : public CPlaceHolder { +private: + Common::Point _pos1; +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CTVOnBar"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TV_ON_BAR_H */ diff --git a/engines/titanic/game/sgt/armchair.cpp b/engines/titanic/game/sgt/armchair.cpp new file mode 100644 index 0000000000..3491452a8d --- /dev/null +++ b/engines/titanic/game/sgt/armchair.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/sgt/armchair.h" + +namespace Titanic { + +void CArmchair::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CSGTStateRoom::save(file, indent); +} + +void CArmchair::load(SimpleFile *file) { + file->readNumber(); + CSGTStateRoom::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/armchair.h b/engines/titanic/game/sgt/armchair.h new file mode 100644 index 0000000000..2157c3c556 --- /dev/null +++ b/engines/titanic/game/sgt/armchair.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_ARMCHAIR_H +#define TITANIC_ARMCHAIR_H + +#include "titanic/game/sgt/sgt_state_room.h" + +namespace Titanic { + +class CArmchair : public CSGTStateRoom { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CArmchair"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ARMCHAIR_H */ diff --git a/engines/titanic/game/sgt/basin.cpp b/engines/titanic/game/sgt/basin.cpp new file mode 100644 index 0000000000..75c53bce72 --- /dev/null +++ b/engines/titanic/game/sgt/basin.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/sgt/basin.h" + +namespace Titanic { + +void CBasin::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CSGTStateRoom::save(file, indent); +} + +void CBasin::load(SimpleFile *file) { + file->readNumber(); + CSGTStateRoom::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/basin.h b/engines/titanic/game/sgt/basin.h new file mode 100644 index 0000000000..85aaf476dd --- /dev/null +++ b/engines/titanic/game/sgt/basin.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_BASIN_H +#define TITANIC_BASIN_H + +#include "titanic/game/sgt/sgt_state_room.h" + +namespace Titanic { + +class CBasin : public CSGTStateRoom { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBasin"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BASIN_H */ diff --git a/engines/titanic/game/sgt/bedfoot.cpp b/engines/titanic/game/sgt/bedfoot.cpp new file mode 100644 index 0000000000..b039f8a9d8 --- /dev/null +++ b/engines/titanic/game/sgt/bedfoot.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/sgt/bedfoot.h" + +namespace Titanic { + +void CBedfoot::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CSGTStateRoom::save(file, indent); +} + +void CBedfoot::load(SimpleFile *file) { + file->readNumber(); + CSGTStateRoom::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/bedfoot.h b/engines/titanic/game/sgt/bedfoot.h new file mode 100644 index 0000000000..7794fc4349 --- /dev/null +++ b/engines/titanic/game/sgt/bedfoot.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_BEDFOOT_H +#define TITANIC_BEDFOOT_H + +#include "titanic/game/sgt/sgt_state_room.h" + +namespace Titanic { + +class CBedfoot : public CSGTStateRoom { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBedfoot"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BEDFOOT_H */ diff --git a/engines/titanic/game/sgt/bedhead.cpp b/engines/titanic/game/sgt/bedhead.cpp new file mode 100644 index 0000000000..758c1ffe37 --- /dev/null +++ b/engines/titanic/game/sgt/bedhead.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/sgt/bedhead.h" + +namespace Titanic { + +void CBedhead::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CSGTStateRoom::save(file, indent); +} + +void CBedhead::load(SimpleFile *file) { + file->readNumber(); + CSGTStateRoom::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/bedhead.h b/engines/titanic/game/sgt/bedhead.h new file mode 100644 index 0000000000..36691639fc --- /dev/null +++ b/engines/titanic/game/sgt/bedhead.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_BEDHEAD_H +#define TITANIC_BEDHEAD_H + +#include "titanic/game/sgt/sgt_state_room.h" + +namespace Titanic { + +class CBedhead : public CSGTStateRoom { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBedhead"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BEDHEAD_H */ diff --git a/engines/titanic/game/sgt/chest_of_drawers.cpp b/engines/titanic/game/sgt/chest_of_drawers.cpp new file mode 100644 index 0000000000..5ec98e8d5a --- /dev/null +++ b/engines/titanic/game/sgt/chest_of_drawers.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/sgt/chest_of_drawers.h" + +namespace Titanic { + +void CChestOfDrawers::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CSGTStateRoom::save(file, indent); +} + +void CChestOfDrawers::load(SimpleFile *file) { + file->readNumber(); + CSGTStateRoom::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/chest_of_drawers.h b/engines/titanic/game/sgt/chest_of_drawers.h new file mode 100644 index 0000000000..17f5cf9e9b --- /dev/null +++ b/engines/titanic/game/sgt/chest_of_drawers.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_CHEST_OF_DRAWERS_H +#define TITANIC_CHEST_OF_DRAWERS_H + +#include "titanic/game/sgt/sgt_state_room.h" + +namespace Titanic { + +class CChestOfDrawers : public CSGTStateRoom { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CChestOfDrawers"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CHEST_OF_DRAWERS_H */ diff --git a/engines/titanic/game/sgt/desk.cpp b/engines/titanic/game/sgt/desk.cpp new file mode 100644 index 0000000000..ea00c24f46 --- /dev/null +++ b/engines/titanic/game/sgt/desk.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/sgt/desk.h" + +namespace Titanic { + +void CDesk::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CSGTStateRoom::save(file, indent); +} + +void CDesk::load(SimpleFile *file) { + file->readNumber(); + CSGTStateRoom::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/desk.h b/engines/titanic/game/sgt/desk.h new file mode 100644 index 0000000000..4c89c04e4b --- /dev/null +++ b/engines/titanic/game/sgt/desk.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_DESK_H +#define TITANIC_DESK_H + +#include "titanic/game/sgt/sgt_state_room.h" + +namespace Titanic { + +class CDesk : public CSGTStateRoom { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CDesk"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DESK_H */ diff --git a/engines/titanic/game/sgt/deskchair.cpp b/engines/titanic/game/sgt/deskchair.cpp new file mode 100644 index 0000000000..337b55a5d1 --- /dev/null +++ b/engines/titanic/game/sgt/deskchair.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/sgt/deskchair.h" + +namespace Titanic { + +void CDeskchair::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CSGTStateRoom::save(file, indent); +} + +void CDeskchair::load(SimpleFile *file) { + file->readNumber(); + CSGTStateRoom::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/deskchair.h b/engines/titanic/game/sgt/deskchair.h new file mode 100644 index 0000000000..762b639eb7 --- /dev/null +++ b/engines/titanic/game/sgt/deskchair.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_DESKCHAIR_H +#define TITANIC_DESKCHAIR_H + +#include "titanic/game/sgt/sgt_state_room.h" + +namespace Titanic { + +class CDeskchair : public CSGTStateRoom { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CDeskchair"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DESKCHAIR_H */ diff --git a/engines/titanic/game/sgt/drawer.cpp b/engines/titanic/game/sgt/drawer.cpp new file mode 100644 index 0000000000..1d7fad275b --- /dev/null +++ b/engines/titanic/game/sgt/drawer.cpp @@ -0,0 +1,42 @@ +/* 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 "titanic/game/sgt/drawer.h" + +namespace Titanic { + +CDrawer::CDrawer() : CSGTStateRoom(), _fieldF4(0) { +} + +void CDrawer::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldF4, indent); + CSGTStateRoom::save(file, indent); +} + +void CDrawer::load(SimpleFile *file) { + file->readNumber(); + _fieldF4 = file->readNumber(); + CSGTStateRoom::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/drawer.h b/engines/titanic/game/sgt/drawer.h new file mode 100644 index 0000000000..100e27cb52 --- /dev/null +++ b/engines/titanic/game/sgt/drawer.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_DRAWER_H +#define TITANIC_DRAWER_H + +#include "titanic/game/sgt/sgt_state_room.h" + +namespace Titanic { + +class CDrawer : public CSGTStateRoom { +private: + int _fieldF4; +public: + CDrawer(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CDrawer"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DRAWER_H */ diff --git a/engines/titanic/game/sgt/sgt_nav.cpp b/engines/titanic/game/sgt/sgt_nav.cpp new file mode 100644 index 0000000000..e40d34d446 --- /dev/null +++ b/engines/titanic/game/sgt/sgt_nav.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/sgt/sgt_nav.h" + +namespace Titanic { + +void SGTNav::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CSGTStateRoom::save(file, indent); +} + +void SGTNav::load(SimpleFile *file) { + file->readNumber(); + CSGTStateRoom::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/sgt_nav.h b/engines/titanic/game/sgt/sgt_nav.h new file mode 100644 index 0000000000..7f1912dc35 --- /dev/null +++ b/engines/titanic/game/sgt/sgt_nav.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_SGT_NAV_H +#define TITANIC_SGT_NAV_H + +#include "titanic/game/sgt/sgt_state_room.h" + +namespace Titanic { + +class SGTNav : public CSGTStateRoom { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "SGTNav"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SGT_NAV_H */ diff --git a/engines/titanic/game/sgt/sgt_state_control.cpp b/engines/titanic/game/sgt/sgt_state_control.cpp new file mode 100644 index 0000000000..113bd0dd2a --- /dev/null +++ b/engines/titanic/game/sgt/sgt_state_control.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/sgt/sgt_state_control.h" + +namespace Titanic { + +void CSGTStateControl::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + CBackground::save(file, indent); +} + +void CSGTStateControl::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/sgt_state_control.h b/engines/titanic/game/sgt/sgt_state_control.h new file mode 100644 index 0000000000..b22095cb14 --- /dev/null +++ b/engines/titanic/game/sgt/sgt_state_control.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_SGT_STATE_CONTROL_H +#define TITANIC_SGT_STATE_CONTROL_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CSGTStateControl : public CBackground { +private: + int _fieldE0; +public: + CSGTStateControl() : CBackground(), _fieldE0(1) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSGTStateControl"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SGT_STATE_CONTROL_H */ diff --git a/engines/titanic/game/sgt/sgt_tv.cpp b/engines/titanic/game/sgt/sgt_tv.cpp new file mode 100644 index 0000000000..316545860e --- /dev/null +++ b/engines/titanic/game/sgt/sgt_tv.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/sgt/sgt_tv.h" + +namespace Titanic { + +void CSGTTV::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CSGTStateRoom::save(file, indent); +} + +void CSGTTV::load(SimpleFile *file) { + file->readNumber(); + CSGTStateRoom::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/sgt_tv.h b/engines/titanic/game/sgt/sgt_tv.h new file mode 100644 index 0000000000..79e7efde4f --- /dev/null +++ b/engines/titanic/game/sgt/sgt_tv.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_SGT_TV_H +#define TITANIC_SGT_TV_H + +#include "titanic/game/sgt/sgt_state_room.h" + +namespace Titanic { + +class CSGTTV : public CSGTStateRoom { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSGTTV"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SGT_TV_H */ diff --git a/engines/titanic/game/sgt/toilet.cpp b/engines/titanic/game/sgt/toilet.cpp new file mode 100644 index 0000000000..ed4ac52412 --- /dev/null +++ b/engines/titanic/game/sgt/toilet.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/sgt/toilet.h" + +namespace Titanic { + +void CToilet::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CSGTStateRoom::save(file, indent); +} + +void CToilet::load(SimpleFile *file) { + file->readNumber(); + CSGTStateRoom::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/toilet.h b/engines/titanic/game/sgt/toilet.h new file mode 100644 index 0000000000..a5265e7473 --- /dev/null +++ b/engines/titanic/game/sgt/toilet.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_TOILET_H +#define TITANIC_TOILET_H + +#include "titanic/game/sgt/sgt_state_room.h" + +namespace Titanic { + +class CToilet : public CSGTStateRoom { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CToilet"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TOILET_H */ diff --git a/engines/titanic/game/sgt/vase.cpp b/engines/titanic/game/sgt/vase.cpp new file mode 100644 index 0000000000..04c5165795 --- /dev/null +++ b/engines/titanic/game/sgt/vase.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/sgt/vase.h" + +namespace Titanic { + +void CVase::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CSGTStateRoom::save(file, indent); +} + +void CVase::load(SimpleFile *file) { + file->readNumber(); + CSGTStateRoom::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/vase.h b/engines/titanic/game/sgt/vase.h new file mode 100644 index 0000000000..37a58181a2 --- /dev/null +++ b/engines/titanic/game/sgt/vase.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_VASE_H +#define TITANIC_VASE_H + +#include "titanic/game/sgt/sgt_state_room.h" + +namespace Titanic { + +class CVase : public CSGTStateRoom { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CVase"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_VASE_H */ diff --git a/engines/titanic/game/sgt/washstand.cpp b/engines/titanic/game/sgt/washstand.cpp new file mode 100644 index 0000000000..f361b14e1d --- /dev/null +++ b/engines/titanic/game/sgt/washstand.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/sgt/washstand.h" + +namespace Titanic { + +void CWashstand::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CSGTStateRoom::save(file, indent); +} + +void CWashstand::load(SimpleFile *file) { + file->readNumber(); + CSGTStateRoom::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/sgt/washstand.h b/engines/titanic/game/sgt/washstand.h new file mode 100644 index 0000000000..40eb5a4eee --- /dev/null +++ b/engines/titanic/game/sgt/washstand.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_WASHSTAND_H +#define TITANIC_WASHSTAND_H + +#include "titanic/game/sgt/sgt_state_room.h" + +namespace Titanic { + +class CWashstand : public CSGTStateRoom { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CWashstand"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_WASHSTAND_H */ diff --git a/engines/titanic/game/transport/exit_pellerator.cpp b/engines/titanic/game/transport/exit_pellerator.cpp new file mode 100644 index 0000000000..400214a140 --- /dev/null +++ b/engines/titanic/game/transport/exit_pellerator.cpp @@ -0,0 +1,46 @@ +/* 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 "titanic/game/transport/pellerator.h" + +namespace Titanic { + +int CPellerator::_v1; +int CPellerator::_v2; + +void CPellerator::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_v2, indent); + + CTransport::save(file, indent); +} + +void CPellerator::load(SimpleFile *file) { + file->readNumber(); + _v1 = file->readNumber(); + _v2 = file->readNumber(); + + CTransport::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/transport/exit_pellerator.h b/engines/titanic/game/transport/exit_pellerator.h new file mode 100644 index 0000000000..d327ea6ba6 --- /dev/null +++ b/engines/titanic/game/transport/exit_pellerator.h @@ -0,0 +1,53 @@ +/* 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. +* +*/ + +#ifndef TITANIC_PELLERATOR_H +#define TITANIC_PELLERATOR_H + +#include "titanic/game/transport/transport.h" + +namespace Titanic { + +class CPellerator : public CTransport { +private: + static int _v1; + static int _v2; +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPellerator"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PELLERATOR_H */ diff --git a/engines/titanic/game/transport/pellerator.cpp b/engines/titanic/game/transport/pellerator.cpp index 1ab8935008..400214a140 100644 --- a/engines/titanic/game/transport/pellerator.cpp +++ b/engines/titanic/game/transport/pellerator.cpp @@ -24,13 +24,22 @@ namespace Titanic { +int CPellerator::_v1; +int CPellerator::_v2; + void CPellerator::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_v2, indent); + CTransport::save(file, indent); } void CPellerator::load(SimpleFile *file) { file->readNumber(); + _v1 = file->readNumber(); + _v2 = file->readNumber(); + CTransport::load(file); } diff --git a/engines/titanic/game/transport/pellerator.h b/engines/titanic/game/transport/pellerator.h index 6ccc56f595..d327ea6ba6 100644 --- a/engines/titanic/game/transport/pellerator.h +++ b/engines/titanic/game/transport/pellerator.h @@ -28,6 +28,9 @@ namespace Titanic { class CPellerator : public CTransport { +private: + static int _v1; + static int _v2; public: /** * Return the class name diff --git a/engines/titanic/game/transport/service_elevator.cpp b/engines/titanic/game/transport/service_elevator.cpp index df88c13454..ba68bc8c2b 100644 --- a/engines/titanic/game/transport/service_elevator.cpp +++ b/engines/titanic/game/transport/service_elevator.cpp @@ -24,12 +24,19 @@ namespace Titanic { +int CServiceElevator::_v1; +int CServiceElevator::_v2; +int CServiceElevator::_v3; + CServiceElevator::CServiceElevator() : CTransport(), _fieldF8(0), _fieldFC(0), _field100(0), _field104(0) { } void CServiceElevator::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_v2, indent); + file->writeNumberLine(_v3, indent); file->writeNumberLine(_fieldF8, indent); file->writeNumberLine(_fieldFC, indent); file->writeNumberLine(_field100, indent); @@ -40,6 +47,9 @@ void CServiceElevator::save(SimpleFile *file, int indent) const { void CServiceElevator::load(SimpleFile *file) { file->readNumber(); + _v1 = file->readNumber(); + _v2 = file->readNumber(); + _v3 = file->readNumber(); _fieldF8 = file->readNumber(); _fieldFC = file->readNumber(); _field100 = file->readNumber(); diff --git a/engines/titanic/game/transport/service_elevator.h b/engines/titanic/game/transport/service_elevator.h index b41c6b155c..f97e3bcd5e 100644 --- a/engines/titanic/game/transport/service_elevator.h +++ b/engines/titanic/game/transport/service_elevator.h @@ -28,7 +28,11 @@ namespace Titanic { class CServiceElevator : public CTransport { -public: +private: + static int _v1; + static int _v2; + static int _v3; + int _fieldF8; int _fieldFC; int _field100; diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index d4bbed8f7a..618c00871a 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -167,7 +167,6 @@ MODULE_OBJS := \ game/pet_graphic.o \ game/phonograph.o \ game/phonograph_lid.o \ - game/place_holder.o \ game/play_music_button.o \ game/play_on_act.o \ game/port_hole.o \ @@ -220,23 +219,49 @@ MODULE_OBJS := \ game/pet/pet_class1.o \ game/pet/pet_class2.o \ game/pet/pet_class3.o \ + game/pet/pet_lift.o \ game/pet/pet_monitor.o \ + game/pet/pet_pellerator.o \ game/pet/pet_position.o \ game/pet/pet_sentinal.o \ game/pet/pet_sounds.o \ game/pet/pet_transition.o \ game/pet/pet_transport.o \ + game/pickup/pick_up.o \ + game/pickup/pick_up_bar_glass.o \ + game/pickup/pick_up_hose.o \ + game/pickup/pick_up_lemon.o \ + game/pickup/pick_up_speech_centre.o \ + game/pickup/pick_up_vis_centre.o \ + game/placeholder/bar_shelf_vis_centre.o \ + game/placeholder/place_holder.o \ + game/placeholder/lemon_on_bar.o \ + game/placeholder/tv_on_bar.o \ game/transport/gondolier.o \ game/transport/lift.o \ game/transport/lift_indicator.o \ game/transport/pellerator.o \ game/transport/service_elevator.o \ game/transport/transport.o \ + game/sgt/armchair.o \ + game/sgt/basin.o \ + game/sgt/bedfoot.o \ + game/sgt/bedhead.o \ + game/sgt/chest_of_drawers.o \ + game/sgt/desk.o \ + game/sgt/deskchair.o \ + game/sgt/drawer.o \ game/sgt/sgt_doors.o \ + game/sgt/sgt_nav.o \ game/sgt/sgt_navigation.o \ game/sgt/sgt_restaurant_doors.o \ + game/sgt/sgt_state_control.o \ game/sgt/sgt_state_room.o \ + game/sgt/sgt_tv.o \ game/sgt/sgt_upper_doors_sound.o \ + game/sgt/toilet.o \ + game/sgt/vase.o \ + game/sgt/washstand.o \ gfx/act_button.o \ gfx/changes_season_button.o \ gfx/chev_left_off.o \ diff --git a/engines/titanic/moves/enter_exit_sec_class_mini_lift.cpp b/engines/titanic/moves/enter_exit_sec_class_mini_lift.cpp index 11df8d9ad8..f993d26797 100644 --- a/engines/titanic/moves/enter_exit_sec_class_mini_lift.cpp +++ b/engines/titanic/moves/enter_exit_sec_class_mini_lift.cpp @@ -24,13 +24,31 @@ namespace Titanic { +CEnterExitSecClassMiniLiftStatics *CEnterExitSecClassMiniLift::_statics; + +void CEnterExitSecClassMiniLift::init() { + _statics = new CEnterExitSecClassMiniLiftStatics(); +} + +void CEnterExitSecClassMiniLift::deinit() { + delete _statics; +} + void CEnterExitSecClassMiniLift::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeQuotedLine(_statics->_v1, indent); + file->writeNumberLine(_statics->_v2, indent); + file->writeNumberLine(_value, indent); + CGameObject::save(file, indent); } void CEnterExitSecClassMiniLift::load(SimpleFile *file) { file->readNumber(); + _statics->_v1 = file->readString(); + _statics->_v2 = file->readNumber(); + _value = file->readNumber(); + CGameObject::load(file); } diff --git a/engines/titanic/moves/enter_exit_sec_class_mini_lift.h b/engines/titanic/moves/enter_exit_sec_class_mini_lift.h index aa3f9b3731..364b2e3dc6 100644 --- a/engines/titanic/moves/enter_exit_sec_class_mini_lift.h +++ b/engines/titanic/moves/enter_exit_sec_class_mini_lift.h @@ -27,8 +27,21 @@ namespace Titanic { +struct CEnterExitSecClassMiniLiftStatics { + CString _v1; + int _v2; + + CEnterExitSecClassMiniLiftStatics() : _v2(1) {} +}; + class CEnterExitSecClassMiniLift : public CGameObject { +private: + static CEnterExitSecClassMiniLiftStatics *_statics; + int _value; public: + CEnterExitSecClassMiniLift() : CGameObject(), _value(0) {} + static void init(); + static void deinit(); /** * Return the class name */ diff --git a/engines/titanic/moves/exit_pellerator.cpp b/engines/titanic/moves/exit_pellerator.cpp index 81bec82748..7c0a52b2ae 100644 --- a/engines/titanic/moves/exit_pellerator.cpp +++ b/engines/titanic/moves/exit_pellerator.cpp @@ -24,13 +24,31 @@ namespace Titanic { +CExitPelleratorStatics *CExitPellerator::_statics; + +void CExitPellerator::init() { + _statics = new CExitPelleratorStatics(); +} + +void CExitPellerator::deinit() { + delete _statics; +} + void CExitPellerator::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeQuotedLine(_statics->_v1, indent); + file->writeNumberLine(_statics->_v2, indent); + file->writeNumberLine(_statics->_v3, indent); + CGameObject::save(file, indent); } void CExitPellerator::load(SimpleFile *file) { file->readNumber(); + _statics->_v1 = file->readString(); + _statics->_v2 = file->readNumber(); + _statics->_v3 = file->readNumber(); + CGameObject::load(file); } diff --git a/engines/titanic/moves/exit_pellerator.h b/engines/titanic/moves/exit_pellerator.h index 6185f61e01..7df5657691 100644 --- a/engines/titanic/moves/exit_pellerator.h +++ b/engines/titanic/moves/exit_pellerator.h @@ -27,8 +27,19 @@ namespace Titanic { +struct CExitPelleratorStatics { + CString _v1; + int _v2; + int _v3; +}; + class CExitPellerator : public CGameObject { +private: + static CExitPelleratorStatics *_statics; public: + static void init(); + static void deinit(); + /** * Return the class name */ diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index d8d4c77429..bcccf1b880 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -35,6 +35,8 @@ #include "titanic/game/sgt/sgt_navigation.h" #include "titanic/game/sgt/sgt_state_room.h" #include "titanic/moves/enter_exit_first_class_state.h" +#include "titanic/moves/enter_exit_sec_class_mini_lift.h" +#include "titanic/moves/exit_pellerator.h" namespace Titanic { @@ -64,6 +66,8 @@ void TitanicEngine::initialize() { CParrotLobbyObject::init(); CSGTNavigation::init(); CSGTStateRoom::init(); + CExitPellerator::init(); + CEnterExitSecClassMiniLift::init(); _screenManager = new OSScreenManager(this); _window = new CMainGameWindow(this); @@ -76,6 +80,8 @@ void TitanicEngine::deinitialize() { CHose::deinit(); CSGTNavigation::deinit(); CSGTStateRoom::deinit(); + CExitPellerator::deinit(); + CEnterExitSecClassMiniLift::deinit(); } Common::Error TitanicEngine::run() { -- cgit v1.2.3 From 700b77e1eaea257f322efdb2336b8a46dd3b91ec Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 2 Mar 2016 08:01:03 -0500 Subject: TITANIC: Added more miscellaneous classes --- engines/titanic/core/saveable_object.cpp | 22 +++++++++ engines/titanic/module.mk | 7 ++- engines/titanic/moves/exit_tiania.cpp | 51 +++++++++++++++++++ engines/titanic/moves/exit_tiania.h | 57 ++++++++++++++++++++++ engines/titanic/moves/exit_titania.cpp | 51 ------------------- engines/titanic/moves/exit_titania.h | 57 ---------------------- engines/titanic/sound/auto_sound_player_adsr.cpp | 43 ++++++++++++++++ engines/titanic/sound/auto_sound_player_adsr.h | 54 ++++++++++++++++++++ .../sound/enter_view_toggles_other_music.cpp | 44 +++++++++++++++++ .../titanic/sound/enter_view_toggles_other_music.h | 54 ++++++++++++++++++++ engines/titanic/sound/node_auto_sound_player.cpp | 39 +++++++++++++++ engines/titanic/sound/node_auto_sound_player.h | 54 ++++++++++++++++++++ .../titanic/sound/trigger_auto_music_player.cpp | 2 + engines/titanic/sound/trigger_auto_music_player.h | 2 + engines/titanic/sound/view_auto_sound_player.cpp | 39 +++++++++++++++ engines/titanic/sound/view_auto_sound_player.h | 54 ++++++++++++++++++++ engines/titanic/sound/view_toggles_other_music.cpp | 44 +++++++++++++++++ engines/titanic/sound/view_toggles_other_music.h | 54 ++++++++++++++++++++ engines/titanic/sound/water_lapping_sounds.cpp | 8 +++ 19 files changed, 627 insertions(+), 109 deletions(-) create mode 100644 engines/titanic/moves/exit_tiania.cpp create mode 100644 engines/titanic/moves/exit_tiania.h delete mode 100644 engines/titanic/moves/exit_titania.cpp delete mode 100644 engines/titanic/moves/exit_titania.h create mode 100644 engines/titanic/sound/auto_sound_player_adsr.cpp create mode 100644 engines/titanic/sound/auto_sound_player_adsr.h create mode 100644 engines/titanic/sound/enter_view_toggles_other_music.cpp create mode 100644 engines/titanic/sound/enter_view_toggles_other_music.h create mode 100644 engines/titanic/sound/node_auto_sound_player.cpp create mode 100644 engines/titanic/sound/node_auto_sound_player.h create mode 100644 engines/titanic/sound/view_auto_sound_player.cpp create mode 100644 engines/titanic/sound/view_auto_sound_player.h create mode 100644 engines/titanic/sound/view_toggles_other_music.cpp create mode 100644 engines/titanic/sound/view_toggles_other_music.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index a2273fdff1..db058cb121 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -291,6 +291,7 @@ #include "titanic/moves/exit_lift.h" #include "titanic/moves/exit_pellerator.h" #include "titanic/moves/exit_state_room.h" +#include "titanic/moves/exit_tiania.h" #include "titanic/moves/move_player_in_parrot_room.h" #include "titanic/moves/move_player_to.h" #include "titanic/moves/move_player_to_from.h" @@ -317,14 +318,20 @@ #include "titanic/sound/auto_music_player.h" #include "titanic/sound/auto_music_player_base.h" #include "titanic/sound/auto_sound_player.h" +#include "titanic/sound/auto_sound_player_adsr.h" #include "titanic/sound/background_sound_maker.h" #include "titanic/sound/bird_song.h" #include "titanic/sound/gondolier_song.h" +#include "titanic/sound/enter_view_toggles_other_music.h" #include "titanic/sound/music_player.h" +#include "titanic/sound/node_auto_sound_player.h" #include "titanic/sound/restricted_auto_music_player.h" +#include "titanic/sound/room_auto_sound_player.h" #include "titanic/sound/seasonal_music_player.h" #include "titanic/sound/titania_speech.h" #include "titanic/sound/trigger_auto_music_player.h" +#include "titanic/sound/view_auto_sound_player.h" +#include "titanic/sound/view_toggles_other_music.h" #include "titanic/sound/water_lapping_sounds.h" namespace Titanic { @@ -779,6 +786,7 @@ DEFFN(CExitBridge); DEFFN(CExitLift); DEFFN(CExitPellerator); DEFFN(CExitStateRoom); +DEFFN(CExitTiania); DEFFN(CMovePlayerInParrotRoom); DEFFN(CMovePlayerTo); DEFFN(CMovePlayerToFrom); @@ -804,14 +812,20 @@ DEFFN(CTitania); DEFFN(CAutoMusicPlayer); DEFFN(CAutoMusicPlayerBase); DEFFN(CAutoSoundPlayer); +DEFFN(CAutoSoundPlayerADSR); DEFFN(CBackgroundSoundMaker); DEFFN(CBirdSong); +DEFFN(CEnterViewTogglesOtherMusic); DEFFN(CGondolierSong); DEFFN(CMusicPlayer); +DEFFN(CNodeAutoSoundPlayer); DEFFN(CRestrictedAutoMusicPlayer); +DEFFN(CRoomAutoSoundPlayer); DEFFN(CSeasonalMusicPlayer); DEFFN(CTitaniaSpeech); DEFFN(CTriggerAutoMusicPlayer); +DEFFN(CViewAutoSoundPlayer); +DEFFN(CViewTogglesOtherMusic); DEFFN(CWaterLappingSounds); void CSaveableObject::initClassList() { @@ -1261,6 +1275,7 @@ void CSaveableObject::initClassList() { ADDFN(CExitLift); ADDFN(CExitPellerator); ADDFN(CExitStateRoom); + ADDFN(CExitTiania); ADDFN(CMovePlayerInParrotRoom); ADDFN(CMovePlayerTo); ADDFN(CMovePlayerToFrom); @@ -1287,15 +1302,22 @@ void CSaveableObject::initClassList() { ADDFN(CAutoMusicPlayer); ADDFN(CAutoMusicPlayerBase); ADDFN(CAutoSoundPlayer); + ADDFN(CAutoSoundPlayerADSR); ADDFN(CBackgroundSoundMaker); ADDFN(CBirdSong); ADDFN(CGondolierSong); + ADDFN(CEnterViewTogglesOtherMusic); + ADDFN(CGondolierSong); ADDFN(CMusicPlayer); + ADDFN(CNodeAutoSoundPlayer); ADDFN(CRestrictedAutoMusicPlayer); + ADDFN(CRoomAutoSoundPlayer); ADDFN(CSeasonalMusicPlayer); ADDFN(CAutoMusicPlayer); ADDFN(CTitaniaSpeech); ADDFN(CTriggerAutoMusicPlayer); + ADDFN(CViewAutoSoundPlayer); + ADDFN(CViewTogglesOtherMusic); ADDFN(CWaterLappingSounds); } diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 618c00871a..0a236d92ca 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -310,7 +310,7 @@ MODULE_OBJS := \ moves/exit_lift.o \ moves/exit_pellerator.o \ moves/exit_state_room.o \ - moves/exit_titania.o \ + moves/exit_tiania.o \ moves/move_player_in_parrot_room.o \ moves/move_player_to_from.o \ moves/move_player_to.o \ @@ -338,15 +338,20 @@ MODULE_OBJS := \ sound/auto_music_player.o \ sound/auto_music_player_base.o \ sound/auto_sound_player.o \ + sound/auto_sound_player_adsr.o \ sound/background_sound_maker.o \ sound/bird_song.o \ + sound/enter_view_toggles_other_music.o \ sound/gondolier_song.o \ sound/music_player.o \ + sound/node_auto_sound_player.o \ sound/restricted_auto_music_player.o \ sound/room_auto_sound_player.o \ sound/seasonal_music_player.o \ sound/titania_speech.o \ sound/trigger_auto_music_player.o \ + sound/view_auto_sound_player.o \ + sound/view_toggles_other_music.o \ sound/water_lapping_sounds.o # This module can be built as a plugin diff --git a/engines/titanic/moves/exit_tiania.cpp b/engines/titanic/moves/exit_tiania.cpp new file mode 100644 index 0000000000..99b6c96db7 --- /dev/null +++ b/engines/titanic/moves/exit_tiania.cpp @@ -0,0 +1,51 @@ +/* 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 "titanic/moves/exit_tiania.h" + +namespace Titanic { + +CExitTiania::CExitTiania() : CMovePlayerTo(), _fieldC8(0), + _string1("NULL"), _string2("NULL"), _string3("NULL") { +} + +void CExitTiania::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + file->writeQuotedLine(_string3, indent); + + CMovePlayerTo::save(file, indent); +} + +void CExitTiania::load(SimpleFile *file) { + file->readNumber(); + _fieldC8 = file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + _string3 = file->readString(); + + CMovePlayerTo::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/moves/exit_tiania.h b/engines/titanic/moves/exit_tiania.h new file mode 100644 index 0000000000..63e120fcf3 --- /dev/null +++ b/engines/titanic/moves/exit_tiania.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_EXIT_TIANIA_H +#define TITANIC_EXIT_TIANIA_H + +#include "titanic/moves/move_player_to.h" + +namespace Titanic { + +class CExitTiania : public CMovePlayerTo { +private: + int _fieldC8; + CString _string1; + CString _string2; + CString _string3; +public: + CExitTiania(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CExitTiania"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_EXIT_TIANIA_H */ diff --git a/engines/titanic/moves/exit_titania.cpp b/engines/titanic/moves/exit_titania.cpp deleted file mode 100644 index 99585f56d9..0000000000 --- a/engines/titanic/moves/exit_titania.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* 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 "titanic/moves/exit_titania.h" - -namespace Titanic { - -CExitTitania::CExitTitania() : CMovePlayerTo(), _fieldC8(0), - _string1("NULL"), _string2("NULL"), _string3("NULL") { -} - -void CExitTitania::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldC8, indent); - file->writeQuotedLine(_string1, indent); - file->writeQuotedLine(_string2, indent); - file->writeQuotedLine(_string3, indent); - - CMovePlayerTo::save(file, indent); -} - -void CExitTitania::load(SimpleFile *file) { - file->readNumber(); - _fieldC8 = file->readNumber(); - _string1 = file->readString(); - _string2 = file->readString(); - _string3 = file->readString(); - - CMovePlayerTo::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/moves/exit_titania.h b/engines/titanic/moves/exit_titania.h deleted file mode 100644 index 1d2226ae54..0000000000 --- a/engines/titanic/moves/exit_titania.h +++ /dev/null @@ -1,57 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_EXIT_TITANIA_H -#define TITANIC_EXIT_TITANIA_H - -#include "titanic/moves/move_player_to.h" - -namespace Titanic { - -class CExitTitania : public CMovePlayerTo { -private: - int _fieldC8; - CString _string1; - CString _string2; - CString _string3; -public: - CExitTitania(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CExitTitania"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_EXIT_TITANIA_H */ diff --git a/engines/titanic/sound/auto_sound_player_adsr.cpp b/engines/titanic/sound/auto_sound_player_adsr.cpp new file mode 100644 index 0000000000..815c1cde52 --- /dev/null +++ b/engines/titanic/sound/auto_sound_player_adsr.cpp @@ -0,0 +1,43 @@ +/* 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 "titanic/sound/auto_sound_player_adsr.h" + +namespace Titanic { + +void CAutoSoundPlayerADSR::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string2, indent); + file->writeQuotedLine(_string3, indent); + file->writeQuotedLine(_string4, indent); + CAutoSoundPlayer::save(file, indent); +} + +void CAutoSoundPlayerADSR::load(SimpleFile *file) { + file->readNumber(); + _string2 = file->readString(); + _string3 = file->readString(); + _string4 = file->readString(); + CAutoSoundPlayer::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/sound/auto_sound_player_adsr.h b/engines/titanic/sound/auto_sound_player_adsr.h new file mode 100644 index 0000000000..9c2a082ba5 --- /dev/null +++ b/engines/titanic/sound/auto_sound_player_adsr.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_AUTO_SOUND_PLAYER_ADSR_H +#define TITANIC_AUTO_SOUND_PLAYER_ADSR_H + +#include "titanic/sound/auto_sound_player.h" + +namespace Titanic { + +class CAutoSoundPlayerADSR : public CAutoSoundPlayer { +private: + CString _string2; + CString _string3; + CString _string4; +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CAutoSoundPlayerADSR"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_AUTO_SOUND_PLAYER_ADSR_H */ diff --git a/engines/titanic/sound/enter_view_toggles_other_music.cpp b/engines/titanic/sound/enter_view_toggles_other_music.cpp new file mode 100644 index 0000000000..fbf5b4a46d --- /dev/null +++ b/engines/titanic/sound/enter_view_toggles_other_music.cpp @@ -0,0 +1,44 @@ +/* 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 "titanic/sound/enter_view_toggles_other_music.h" + +namespace Titanic { + +CEnterViewTogglesOtherMusic::CEnterViewTogglesOtherMusic() : CTriggerAutoMusicPlayer(), _fieldC8(0) { +} + +void CEnterViewTogglesOtherMusic::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldC8, indent); + + CTriggerAutoMusicPlayer::save(file, indent); +} + +void CEnterViewTogglesOtherMusic::load(SimpleFile *file) { + file->readNumber(); + _fieldC8 = file->readNumber(); + + CTriggerAutoMusicPlayer::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/sound/enter_view_toggles_other_music.h b/engines/titanic/sound/enter_view_toggles_other_music.h new file mode 100644 index 0000000000..3e7976e877 --- /dev/null +++ b/engines/titanic/sound/enter_view_toggles_other_music.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_ENTER_VIEW_TOGGLES_OTHER_MUSIC_H +#define TITANIC_ENTER_VIEW_TOGGLES_OTHER_MUSIC_H + +#include "titanic/sound/trigger_auto_music_player.h" + +namespace Titanic { + +class CEnterViewTogglesOtherMusic : public CTriggerAutoMusicPlayer { +protected: + int _fieldC8; +public: + CEnterViewTogglesOtherMusic(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CEnterViewTogglesOtherMusic"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ENTER_VIEW_TOGGLES_OTHER_MUSIC_H */ diff --git a/engines/titanic/sound/node_auto_sound_player.cpp b/engines/titanic/sound/node_auto_sound_player.cpp new file mode 100644 index 0000000000..3a69535bd7 --- /dev/null +++ b/engines/titanic/sound/node_auto_sound_player.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/sound/node_auto_sound_player.h" + +namespace Titanic { + +void CNodeAutoSoundPlayer::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldEC, indent); + CAutoSoundPlayer::save(file, indent); +} + +void CNodeAutoSoundPlayer::load(SimpleFile *file) { + file->readNumber(); + _fieldEC = file->readNumber(); + CAutoSoundPlayer::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/sound/node_auto_sound_player.h b/engines/titanic/sound/node_auto_sound_player.h new file mode 100644 index 0000000000..5f4b70b93d --- /dev/null +++ b/engines/titanic/sound/node_auto_sound_player.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_NODE_AUTO_SOUND_PLAYER_H +#define TITANIC_NODE_AUTO_SOUND_PLAYER_H + +#include "titanic/sound/auto_sound_player.h" + +namespace Titanic { + +class CNodeAutoSoundPlayer : public CAutoSoundPlayer { +private: + int _fieldEC; +public: + CNodeAutoSoundPlayer() : CAutoSoundPlayer(), _fieldEC(1) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CViewAutoSoundPlayer"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_NODE_AUTO_SOUND_PLAYER_H */ diff --git a/engines/titanic/sound/trigger_auto_music_player.cpp b/engines/titanic/sound/trigger_auto_music_player.cpp index adcc18c591..17499a70e1 100644 --- a/engines/titanic/sound/trigger_auto_music_player.cpp +++ b/engines/titanic/sound/trigger_auto_music_player.cpp @@ -26,11 +26,13 @@ namespace Titanic { void CTriggerAutoMusicPlayer::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeQuotedLine(_fieldBC, indent); CGameObject::save(file, indent); } void CTriggerAutoMusicPlayer::load(SimpleFile *file) { file->readNumber(); + _fieldBC = file->readString(); CGameObject::load(file); } diff --git a/engines/titanic/sound/trigger_auto_music_player.h b/engines/titanic/sound/trigger_auto_music_player.h index d67add2565..8f7a42c5c2 100644 --- a/engines/titanic/sound/trigger_auto_music_player.h +++ b/engines/titanic/sound/trigger_auto_music_player.h @@ -28,6 +28,8 @@ namespace Titanic { class CTriggerAutoMusicPlayer : public CGameObject { +protected: + CString _fieldBC; public: /** * Return the class name diff --git a/engines/titanic/sound/view_auto_sound_player.cpp b/engines/titanic/sound/view_auto_sound_player.cpp new file mode 100644 index 0000000000..3d6c92fe22 --- /dev/null +++ b/engines/titanic/sound/view_auto_sound_player.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/sound/view_auto_sound_player.h" + +namespace Titanic { + +void CViewAutoSoundPlayer::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldEC, indent); + CAutoSoundPlayer::save(file, indent); +} + +void CViewAutoSoundPlayer::load(SimpleFile *file) { + file->readNumber(); + _fieldEC = file->readNumber(); + CAutoSoundPlayer::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/sound/view_auto_sound_player.h b/engines/titanic/sound/view_auto_sound_player.h new file mode 100644 index 0000000000..9e87d74d8d --- /dev/null +++ b/engines/titanic/sound/view_auto_sound_player.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_VIEW_AUTO_SOUND_PLAYER_H +#define TITANIC_VIEW_AUTO_SOUND_PLAYER_H + +#include "titanic/sound/auto_sound_player.h" + +namespace Titanic { + +class CViewAutoSoundPlayer : public CAutoSoundPlayer { +private: + int _fieldEC; +public: + CViewAutoSoundPlayer() : CAutoSoundPlayer(), _fieldEC(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CViewAutoSoundPlayer"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_VIEW_AUTO_SOUND_PLAYER_H */ diff --git a/engines/titanic/sound/view_toggles_other_music.cpp b/engines/titanic/sound/view_toggles_other_music.cpp new file mode 100644 index 0000000000..262d7de628 --- /dev/null +++ b/engines/titanic/sound/view_toggles_other_music.cpp @@ -0,0 +1,44 @@ +/* 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 "titanic/sound/view_toggles_other_music.h" + +namespace Titanic { + +CViewTogglesOtherMusic::CViewTogglesOtherMusic() : CEnterViewTogglesOtherMusic(), _fieldCC(0) { +} + +void CViewTogglesOtherMusic::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldCC, indent); + + CEnterViewTogglesOtherMusic::save(file, indent); +} + +void CViewTogglesOtherMusic::load(SimpleFile *file) { + file->readNumber(); + _fieldCC = file->readNumber(); + + CEnterViewTogglesOtherMusic::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/sound/view_toggles_other_music.h b/engines/titanic/sound/view_toggles_other_music.h new file mode 100644 index 0000000000..e0da2437cc --- /dev/null +++ b/engines/titanic/sound/view_toggles_other_music.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_VIEW_TOGGLES_OTHER_MUSIC_H +#define TITANIC_VIEW_TOGGLES_OTHER_MUSIC_H + +#include "titanic/sound/enter_view_toggles_other_music.h" + +namespace Titanic { + +class CViewTogglesOtherMusic : public CEnterViewTogglesOtherMusic { +private: + int _fieldCC; +public: + CViewTogglesOtherMusic(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CViewTogglesOtherMusic"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_VIEW_TOGGLES_OTHER_MUSIC_H */ diff --git a/engines/titanic/sound/water_lapping_sounds.cpp b/engines/titanic/sound/water_lapping_sounds.cpp index 7222b5a16d..b3f5d23a2c 100644 --- a/engines/titanic/sound/water_lapping_sounds.cpp +++ b/engines/titanic/sound/water_lapping_sounds.cpp @@ -26,13 +26,21 @@ namespace Titanic { void CWaterLappingSounds::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeQuotedLine(_string1, indent); + file->writeNumberLine(_fieldD4, indent); + file->writeNumberLine(_fieldE0, indent); file->writeNumberLine(_value, indent); + CRoomAutoSoundPlayer::save(file, indent); } void CWaterLappingSounds::load(SimpleFile *file) { file->readNumber(); + _string1 = file->readString(); + _fieldD4 = file->readNumber(); + _fieldE0 = file->readNumber(); _value = file->readNumber(); + CRoomAutoSoundPlayer::load(file); } -- cgit v1.2.3 From 96825e282392d24e683c0e9cb7b7a1ac9aa4f467 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 2 Mar 2016 18:29:09 -0500 Subject: TITANIC: More saveable classes implemented --- engines/titanic/carry/bridge_piece.cpp | 7 ++- engines/titanic/carry/bridge_piece.h | 3 +- engines/titanic/core/saveable_object.cpp | 38 ++++++++++++- engines/titanic/game/bottom_of_well_monitor.cpp | 7 +++ engines/titanic/game/bottom_of_well_monitor.h | 1 + engines/titanic/game/brain_slot.cpp | 4 +- engines/titanic/game/brain_slot.h | 5 +- engines/titanic/game/code_wheel.cpp | 48 +++++++++++++++++ engines/titanic/game/code_wheel.h | 56 +++++++++++++++++++ engines/titanic/game/head_slot.cpp | 2 + engines/titanic/game/missiveomat_button.cpp | 41 ++++++++++++++ engines/titanic/game/missiveomat_button.h | 54 +++++++++++++++++++ engines/titanic/game/ship_setting_button.cpp | 11 ++++ engines/titanic/game/ship_setting_button.h | 6 +++ engines/titanic/gfx/edit_control.cpp | 72 +++++++++++++++++++++++++ engines/titanic/gfx/edit_control.h | 66 +++++++++++++++++++++++ engines/titanic/module.mk | 4 ++ 17 files changed, 414 insertions(+), 11 deletions(-) create mode 100644 engines/titanic/game/code_wheel.cpp create mode 100644 engines/titanic/game/code_wheel.h create mode 100644 engines/titanic/game/missiveomat_button.cpp create mode 100644 engines/titanic/game/missiveomat_button.h create mode 100644 engines/titanic/gfx/edit_control.cpp create mode 100644 engines/titanic/gfx/edit_control.h diff --git a/engines/titanic/carry/bridge_piece.cpp b/engines/titanic/carry/bridge_piece.cpp index b9c998d9d1..e93d3c455a 100644 --- a/engines/titanic/carry/bridge_piece.cpp +++ b/engines/titanic/carry/bridge_piece.cpp @@ -24,14 +24,13 @@ namespace Titanic { -CBridgePiece::CBridgePiece() : CCarry(), - _field138(0), _field13C(0), _field140(0) { +CBridgePiece::CBridgePiece() : CCarry(), _field140(0) { } void CBridgePiece::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); file->writeQuotedLine(_string6, indent); - file->writeNumberLine(_field138, indent); + file->writePoint(_pos3, indent); file->writeNumberLine(_field140, indent); CCarry::save(file, indent); @@ -40,7 +39,7 @@ void CBridgePiece::save(SimpleFile *file, int indent) const { void CBridgePiece::load(SimpleFile *file) { file->readNumber(); _string6 = file->readString(); - _field138 = file->readNumber(); + _pos3 = file->readPoint(); _field140 = file->readNumber(); CCarry::load(file); diff --git a/engines/titanic/carry/bridge_piece.h b/engines/titanic/carry/bridge_piece.h index f38e27e6c9..50a26c9048 100644 --- a/engines/titanic/carry/bridge_piece.h +++ b/engines/titanic/carry/bridge_piece.h @@ -30,8 +30,7 @@ namespace Titanic { class CBridgePiece : public CCarry { private: CString _string6; - int _field138; - int _field13C; + Common::Point _pos3; int _field140; public: CBridgePiece(); diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index db058cb121..a29bde69cd 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -86,7 +86,9 @@ #include "titanic/game/bar_menu_button.h" #include "titanic/game/belbot_get_light.h" #include "titanic/game/bomb.h" +#include "titanic/game/bottom_of_well_monitor.h" #include "titanic/game/bowl_unlocker.h" +#include "titanic/game/brain_slot.h" #include "titanic/game/bridge_view.h" #include "titanic/game/broken_pell_base.h" #include "titanic/game/cage.h" @@ -101,6 +103,7 @@ #include "titanic/game/close_broken_pel.h" #include "titanic/game/computer.h" #include "titanic/game/computer_screen.h" +#include "titanic/game/code_wheel.h" #include "titanic/game/cookie.h" #include "titanic/game/credits.h" #include "titanic/game/credits_button.h" @@ -130,6 +133,7 @@ #include "titanic/game/hammer_clip.h" #include "titanic/game/hammer_dispensor.h" #include "titanic/game/hammer_dispensor_button.h" +#include "titanic/game/head_slot.h" #include "titanic/game/head_smash_event.h" #include "titanic/game/head_smash_lever.h" #include "titanic/game/idle_summoner.h" @@ -139,6 +143,8 @@ #include "titanic/game/little_lift_button.h" #include "titanic/game/long_stick_dispenser.h" #include "titanic/game/maitred_arm_holder.h" +#include "titanic/game/missiveomat.h" +#include "titanic/game/missiveomat_button.h" #include "titanic/game/musical_instrument.h" #include "titanic/game/music_console_button.h" #include "titanic/game/music_room_phonograph.h" @@ -148,6 +154,9 @@ #include "titanic/game/nose_holder.h" #include "titanic/game/null_port_hole.h" #include "titanic/game/nut_replacer.h" +#include "titanic/game/pet_disabler.h" +#include "titanic/game/pet_graphic.h" +#include "titanic/game/pet_graphic2.h" #include "titanic/game/phonograph.h" #include "titanic/game/play_music_button.h" #include "titanic/game/play_on_act.h" @@ -164,6 +173,7 @@ #include "titanic/game/service_elevator_door.h" #include "titanic/game/service_elevator_window.h" #include "titanic/game/ship_setting.h" +#include "titanic/game/ship_setting_button.h" #include "titanic/game/speech_dispensor.h" #include "titanic/game/starling_puret.h" #include "titanic/game/start_action.h" @@ -173,6 +183,7 @@ #include "titanic/game/television.h" #include "titanic/game/third_class_canal.h" #include "titanic/game/throw_tv_down_well.h" +#include "titanic/game/titania_still_control.h" #include "titanic/game/tow_parrot_nav.h" #include "titanic/game/up_lighter.h" #include "titanic/game/wheel_button.h" @@ -244,6 +255,7 @@ #include "titanic/gfx/chev_right_on.h" #include "titanic/gfx/chev_send_rec_switch.h" #include "titanic/gfx/chev_switch.h" +#include "titanic/gfx/edit_control.h" #include "titanic/gfx/elevator_button.h" #include "titanic/gfx/get_from_succ.h" #include "titanic/gfx/helmet_on_off.h" @@ -407,8 +419,10 @@ DEFFN(CBarBell); DEFFN(CBarMenu); DEFFN(CBarMenuButton); DEFFN(CBelbotGetLight); -DEFFN(CBowlUnlocker); DEFFN(CBomb); +DEFFN(CBottomOfWellMonitor); +DEFFN(CBowlUnlocker); +DEFFN(CBrainSlot); DEFFN(CBridgeView); DEFFN(CBrokenPellBase) DEFFN(CCage); @@ -420,6 +434,7 @@ DEFFN(CCDROMTray); DEFFN(CCellPointButton); DEFFN(CChickenDispensor); DEFFN(CCloseBrokenPel); +DEFFN(CodeWheel); DEFFN(CComputer); DEFFN(CCookie); DEFFN(CComputerScreen); @@ -451,6 +466,7 @@ DEFFN(CGlassSmasher); DEFFN(CHammerClip); DEFFN(CHammerDispensor); DEFFN(CHammerDispensorButton); +DEFFN(CHeadSlot); DEFFN(CHeadSmashEvent); DEFFN(CHeadSmashLever); DEFFN(CIdleSummoner); @@ -460,6 +476,8 @@ DEFFN(CLightSwitch); DEFFN(CLittleLiftButton); DEFFN(CLongStickDispenser); DEFFN(CMaitreDArmHolder); +DEFFN(CMissiveOMat); +DEFFN(CMissiveOMatButton); DEFFN(CMusicalInstrument); DEFFN(CMusicConsoleButton); DEFFN(CMusicRoomPhonograph); @@ -469,6 +487,9 @@ DEFFN(CNoNutBowl); DEFFN(CNoseHolder); DEFFN(CNullPortHole); DEFFN(CNutReplacer); +DEFFN(CPetDisabler); +DEFFN(CPetGraphic); +DEFFN(CPetGraphic2); DEFFN(CPhonograph); DEFFN(CPlayMusicButton); DEFFN(CPlayOnAct); @@ -485,6 +506,7 @@ DEFFN(CSeasonalAdjustment); DEFFN(CServiceElevatorDoor); DEFFN(CServiceElevatorWindow); DEFFN(CShipSetting); +DEFFN(CShipSettingButton); DEFFN(CSpeechDispensor); DEFFN(CStarlingPuret); DEFFN(CStartAction); @@ -494,6 +516,7 @@ DEFFN(CSweetBowl); DEFFN(CTelevision); DEFFN(CThirdClassCanal); DEFFN(CThrowTVDownWell); +DEFFN(CTitaniaStillControl); DEFFN(CTOWParrotNav); DEFFN(CUpLighter); DEFFN(CWheelButton); @@ -567,6 +590,7 @@ DEFFN(CChevRightOff); DEFFN(CChevRightOn); DEFFN(CChevSendRecSwitch); DEFFN(CChevSwitch); +DEFFN(CEditControl); DEFFN(CElevatorButton); DEFFN(CGetFromSucc); DEFFN(CHelmetOnOff); @@ -896,6 +920,8 @@ void CSaveableObject::initClassList() { ADDFN(CBarMenuButton); ADDFN(CBelbotGetLight); ADDFN(CBomb); + ADDFN(CBottomOfWellMonitor); + ADDFN(CBrainSlot); ADDFN(CBowlUnlocker); ADDFN(CBridgeView); ADDFN(CBrokenPellBase); @@ -907,6 +933,7 @@ void CSaveableObject::initClassList() { ADDFN(CCDROMTray); ADDFN(CCellPointButton); ADDFN(CChickenDispensor); + ADDFN(CodeWheel); ADDFN(CComputerScreen); ADDFN(CCloseBrokenPel); ADDFN(CComputer); @@ -940,6 +967,7 @@ void CSaveableObject::initClassList() { ADDFN(CHammerClip); ADDFN(CHammerDispensor); ADDFN(CHammerDispensorButton); + ADDFN(CHeadSlot); ADDFN(CHeadSmashEvent); ADDFN(CHeadSmashLever); ADDFN(CIdleSummoner); @@ -949,6 +977,8 @@ void CSaveableObject::initClassList() { ADDFN(CLittleLiftButton); ADDFN(CLongStickDispenser); ADDFN(CMaitreDArmHolder); + ADDFN(CMissiveOMat); + ADDFN(CMissiveOMatButton); ADDFN(CMusicalInstrument); ADDFN(CMusicConsoleButton); ADDFN(CMusicRoomPhonograph); @@ -958,6 +988,9 @@ void CSaveableObject::initClassList() { ADDFN(CNoseHolder); ADDFN(CNullPortHole); ADDFN(CNutReplacer); + ADDFN(CPetDisabler); + ADDFN(CPetGraphic); + ADDFN(CPetGraphic2); ADDFN(CPhonograph); ADDFN(CPlayMusicButton); ADDFN(CPlayOnAct); @@ -974,6 +1007,7 @@ void CSaveableObject::initClassList() { ADDFN(CServiceElevatorDoor); ADDFN(CServiceElevatorWindow); ADDFN(CShipSetting); + ADDFN(CShipSettingButton); ADDFN(CSpeechDispensor); ADDFN(CStarlingPuret); ADDFN(CStartAction); @@ -983,6 +1017,7 @@ void CSaveableObject::initClassList() { ADDFN(CTelevision); ADDFN(CThirdClassCanal); ADDFN(CThrowTVDownWell); + ADDFN(CTitaniaStillControl); ADDFN(CTOWParrotNav); ADDFN(CUpLighter); ADDFN(CWheelButton); @@ -1056,6 +1091,7 @@ void CSaveableObject::initClassList() { ADDFN(CChevRightOn); ADDFN(CChevSendRecSwitch); ADDFN(CChevSwitch); + ADDFN(CEditControl); ADDFN(CElevatorButton); ADDFN(CGetFromSucc); ADDFN(CHelmetOnOff); diff --git a/engines/titanic/game/bottom_of_well_monitor.cpp b/engines/titanic/game/bottom_of_well_monitor.cpp index daca5dbb5f..b48b5ad291 100644 --- a/engines/titanic/game/bottom_of_well_monitor.cpp +++ b/engines/titanic/game/bottom_of_well_monitor.cpp @@ -24,14 +24,21 @@ namespace Titanic { +int CBottomOfWellMonitor::_v1; +int CBottomOfWellMonitor::_v2; + void CBottomOfWellMonitor::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_v2, indent); file->writeNumberLine(_value, indent); CGameObject::save(file, indent); } void CBottomOfWellMonitor::load(SimpleFile *file) { file->readNumber(); + _v1 = file->readNumber(); + _v2 = file->readNumber(); _value = file->readNumber(); CGameObject::load(file); } diff --git a/engines/titanic/game/bottom_of_well_monitor.h b/engines/titanic/game/bottom_of_well_monitor.h index de07aacf35..f1a9f5d710 100644 --- a/engines/titanic/game/bottom_of_well_monitor.h +++ b/engines/titanic/game/bottom_of_well_monitor.h @@ -29,6 +29,7 @@ namespace Titanic { class CBottomOfWellMonitor : public CGameObject { public: + static int _v1, _v2; int _value; public: CBottomOfWellMonitor() : _value(1) {} diff --git a/engines/titanic/game/brain_slot.cpp b/engines/titanic/game/brain_slot.cpp index f8a029ed67..f655a963d5 100644 --- a/engines/titanic/game/brain_slot.cpp +++ b/engines/titanic/game/brain_slot.cpp @@ -30,7 +30,7 @@ int CBrainSlot::_v2; void CBrainSlot::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); file->writeNumberLine(_value1, indent); - file->writeNumberLine(_value2, indent); + file->writeQuotedLine(_value2, indent); file->writeNumberLine(_v1, indent); file->writeNumberLine(_v2, indent); @@ -40,7 +40,7 @@ void CBrainSlot::save(SimpleFile *file, int indent) const { void CBrainSlot::load(SimpleFile *file) { file->readNumber(); _value1 = file->readNumber(); - _value2 = file->readNumber(); + _value2 = file->readString(); _v1 = file->readNumber(); _v2 = file->readNumber(); diff --git a/engines/titanic/game/brain_slot.h b/engines/titanic/game/brain_slot.h index 982541f945..fa197a85d7 100644 --- a/engines/titanic/game/brain_slot.h +++ b/engines/titanic/game/brain_slot.h @@ -31,9 +31,10 @@ class CBrainSlot : public CGameObject { public: static int _v1, _v2; public: - int _value1, _value2; + int _value1; + CString _value2; public: - CBrainSlot() : CGameObject(), _value1(0), _value2(0) {} + CBrainSlot() : CGameObject(), _value1(0) {} /** * Return the class name diff --git a/engines/titanic/game/code_wheel.cpp b/engines/titanic/game/code_wheel.cpp new file mode 100644 index 0000000000..a10a70c974 --- /dev/null +++ b/engines/titanic/game/code_wheel.cpp @@ -0,0 +1,48 @@ +/* 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 "titanic/game/code_wheel.h" + +namespace Titanic { + +CodeWheel::CodeWheel() : CBomb(), _field108(0), _field10C(4), _field110(0) { +} + +void CodeWheel::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field108, indent); + file->writeNumberLine(_field10C, indent); + file->writeNumberLine(_field110, indent); + + CBomb::save(file, indent); +} + +void CodeWheel::load(SimpleFile *file) { + file->readNumber(); + _field108 = file->readNumber(); + _field10C = file->readNumber(); + _field110 = file->readNumber(); + + CBomb::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/code_wheel.h b/engines/titanic/game/code_wheel.h new file mode 100644 index 0000000000..70879826e9 --- /dev/null +++ b/engines/titanic/game/code_wheel.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_CODE_WHEEL_H +#define TITANIC_CODE_WHEEL_H + +#include "titanic/game/bomb.h" + +namespace Titanic { + +class CodeWheel : public CBomb { +private: + int _field108; + int _field10C; + int _field110; +public: + CodeWheel(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CodeWheel"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CODE_WHEEL_H */ diff --git a/engines/titanic/game/head_slot.cpp b/engines/titanic/game/head_slot.cpp index c037238e7c..4cb15ccd1e 100644 --- a/engines/titanic/game/head_slot.cpp +++ b/engines/titanic/game/head_slot.cpp @@ -24,6 +24,8 @@ namespace Titanic { +int CHeadSlot::_v1; + CHeadSlot::CHeadSlot() : CGameObject(), _string1("NotWorking"), _string2("NULL"), _fieldBC(0), _fieldD8(0), _fieldDC(27), _fieldE0(56), _fieldE4(82), _fieldE8(112), _fieldEC(0) { diff --git a/engines/titanic/game/missiveomat_button.cpp b/engines/titanic/game/missiveomat_button.cpp new file mode 100644 index 0000000000..8f0918a294 --- /dev/null +++ b/engines/titanic/game/missiveomat_button.cpp @@ -0,0 +1,41 @@ +/* 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 "titanic/game/missiveomat_button.h" + +namespace Titanic { + +void CMissiveOMatButton::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldFC, indent); + + CEditControl::save(file, indent); +} + +void CMissiveOMatButton::load(SimpleFile *file) { + file->readNumber(); + _fieldFC = file->readNumber(); + + CEditControl::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/missiveomat_button.h b/engines/titanic/game/missiveomat_button.h new file mode 100644 index 0000000000..f383e88798 --- /dev/null +++ b/engines/titanic/game/missiveomat_button.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_MISSIVEOMAT_BUTTON_H +#define TITANIC_MISSIVEOMAT_BUTTON_H + +#include "titanic/gfx/edit_control.h" + +namespace Titanic { + +class CMissiveOMatButton : public CEditControl { +public: + int _fieldFC; +public: + CMissiveOMatButton() : CEditControl(), _fieldFC(2) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMissiveOMatButton"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MISSIVEOMAT_BUTTON_H */ diff --git a/engines/titanic/game/ship_setting_button.cpp b/engines/titanic/game/ship_setting_button.cpp index c1318b1bc4..95507f3c90 100644 --- a/engines/titanic/game/ship_setting_button.cpp +++ b/engines/titanic/game/ship_setting_button.cpp @@ -24,13 +24,24 @@ namespace Titanic { +CShipSettingButton::CShipSettingButton() : CGameObject(), _fieldC8(0), _fieldCC(0) { +} + void CShipSettingButton::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeQuotedLine(_string1, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeNumberLine(_fieldCC, indent); + CGameObject::save(file, indent); } void CShipSettingButton::load(SimpleFile *file) { file->readNumber(); + _string1 = file->readString(); + _fieldC8 = file->readNumber(); + _fieldCC = file->readNumber(); + CGameObject::load(file); } diff --git a/engines/titanic/game/ship_setting_button.h b/engines/titanic/game/ship_setting_button.h index 008ab783df..fb8d533a7f 100644 --- a/engines/titanic/game/ship_setting_button.h +++ b/engines/titanic/game/ship_setting_button.h @@ -28,7 +28,13 @@ namespace Titanic { class CShipSettingButton : public CGameObject { +private: + CString _string1; + int _fieldC8; + int _fieldCC; public: + CShipSettingButton(); + /** * Return the class name */ diff --git a/engines/titanic/gfx/edit_control.cpp b/engines/titanic/gfx/edit_control.cpp new file mode 100644 index 0000000000..17a56d6677 --- /dev/null +++ b/engines/titanic/gfx/edit_control.cpp @@ -0,0 +1,72 @@ +/* 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 "titanic/gfx/edit_control.h" + +namespace Titanic { + +CEditControl::CEditControl() : CGameObject(), _fieldBC(0), _fieldC0(0), + _fieldC4(0), _fieldC8(0), _fieldCC(0), _fieldD0(0), _fieldD4(2), + _fieldD8(0), _fieldDC(0), _fieldE0(0), _fieldF0(0), _fieldF4(0) + +{ +} + +void CEditControl::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_fieldC4, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeNumberLine(_fieldCC, indent); + file->writeNumberLine(_fieldD0, indent); + file->writeNumberLine(_fieldD4, indent); + file->writeNumberLine(_fieldD8, indent); + file->writeNumberLine(_fieldDC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeQuotedLine(_string1, indent); + file->writeNumberLine(_fieldF0, indent); + file->writeNumberLine(_fieldF4, indent); + + CGameObject::save(file, indent); +} + +void CEditControl::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _fieldC4 = file->readNumber(); + _fieldC8 = file->readNumber(); + _fieldCC = file->readNumber(); + _fieldD0 = file->readNumber(); + _fieldD4 = file->readNumber(); + _fieldD8 = file->readNumber(); + _fieldDC = file->readNumber(); + _fieldE0 = file->readNumber(); + _string1 = file->readString(); + _fieldF0 = file->readNumber(); + _fieldF4 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/edit_control.h b/engines/titanic/gfx/edit_control.h new file mode 100644 index 0000000000..79b20f7108 --- /dev/null +++ b/engines/titanic/gfx/edit_control.h @@ -0,0 +1,66 @@ +/* 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. + * + */ + +#ifndef TITANIC_EDIT_CONTROL_H +#define TITANIC_EDIT_CONTROL_H + +#include "titanic/gfx/toggle_switch.h" + +namespace Titanic { + +class CEditControl : public CGameObject { +protected: + int _fieldBC; + int _fieldC0; + int _fieldC4; + int _fieldC8; + int _fieldCC; + int _fieldD0; + int _fieldD4; + int _fieldD8; + int _fieldDC; + int _fieldE0; + CString _string1; + int _fieldF0; + int _fieldF4; +public: + CEditControl(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CEditControl"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_EDIT_CONTROL_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 0a236d92ca..86ddafddef 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -86,6 +86,7 @@ MODULE_OBJS := \ game/bar_bell.o \ game/belbot_get_light.o \ game/bottom_of_well_monitor.o \ + game/bomb.o \ game/bowl_unlocker.o \ game/brain_slot.o \ game/bridge_door.o \ @@ -103,6 +104,7 @@ MODULE_OBJS := \ game/chicken_cooler.o \ game/chicken_dispensor.o \ game/close_broken_pel.o \ + game/code_wheel.o \ game/cookie.o \ game/computer.o \ game/computer_screen.o \ @@ -150,6 +152,7 @@ MODULE_OBJS := \ game/mail_man.o \ game/maitred_arm_holder.o \ game/missiveomat.o \ + game/missiveomat_button.o \ game/movie_tester.o \ game/music_console_button.o \ game/music_room_phonograph.o \ @@ -270,6 +273,7 @@ MODULE_OBJS := \ gfx/chev_right_on.o \ gfx/chev_send_rec_switch.o \ gfx/chev_switch.o \ + gfx/edit_control.o \ gfx/elevator_button.o \ gfx/get_from_succ.o \ gfx/helmet_on_off.o \ -- cgit v1.2.3 From 5dce31417cd257785b9bbc790a9686e64a4aff37 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 2 Mar 2016 19:21:31 -0500 Subject: TITANIC: More saveable classes implemented --- engines/titanic/core/saveable_object.cpp | 36 +++++++++++++-- engines/titanic/game/bilge_succubus.cpp | 51 ++++++++++++++++++++ engines/titanic/game/bilge_succubus.h | 57 +++++++++++++++++++++++ engines/titanic/game/nav_helmet.cpp | 39 ++++++++++++++++ engines/titanic/game/nav_helmet.h | 54 ++++++++++++++++++++++ engines/titanic/game/service_elevator_door.h | 2 +- engines/titanic/game/useless_lever.cpp | 37 +++++++++++++++ engines/titanic/game/useless_lever.h | 50 ++++++++++++++++++++ engines/titanic/game/wheel_spin_horn.cpp | 43 +++++++++++++++++ engines/titanic/game/wheel_spin_horn.h | 53 +++++++++++++++++++++ engines/titanic/gfx/toggle_button.cpp | 41 ++++++++++++++++ engines/titanic/gfx/toggle_button.h | 54 ++++++++++++++++++++++ engines/titanic/messages/messages.cpp | 47 ------------------- engines/titanic/messages/messages.h | 50 -------------------- engines/titanic/module.mk | 10 +++- engines/titanic/sound/auto_sound_event.cpp | 46 ++++++++++++++++++ engines/titanic/sound/auto_sound_event.h | 55 ++++++++++++++++++++++ engines/titanic/sound/bilge_auto_sound_event.cpp | 37 +++++++++++++++ engines/titanic/sound/bilge_auto_sound_event.h | 50 ++++++++++++++++++++ engines/titanic/sound/door_auto_sound_event.cpp | 47 +++++++++++++++++++ engines/titanic/sound/door_auto_sound_event.h | 59 ++++++++++++++++++++++++ 21 files changed, 814 insertions(+), 104 deletions(-) create mode 100644 engines/titanic/game/bilge_succubus.cpp create mode 100644 engines/titanic/game/bilge_succubus.h create mode 100644 engines/titanic/game/nav_helmet.cpp create mode 100644 engines/titanic/game/nav_helmet.h create mode 100644 engines/titanic/game/useless_lever.cpp create mode 100644 engines/titanic/game/useless_lever.h create mode 100644 engines/titanic/game/wheel_spin_horn.cpp create mode 100644 engines/titanic/game/wheel_spin_horn.h create mode 100644 engines/titanic/gfx/toggle_button.cpp create mode 100644 engines/titanic/gfx/toggle_button.h create mode 100644 engines/titanic/sound/auto_sound_event.cpp create mode 100644 engines/titanic/sound/auto_sound_event.h create mode 100644 engines/titanic/sound/bilge_auto_sound_event.cpp create mode 100644 engines/titanic/sound/bilge_auto_sound_event.h create mode 100644 engines/titanic/sound/door_auto_sound_event.cpp create mode 100644 engines/titanic/sound/door_auto_sound_event.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index a29bde69cd..84f0887b57 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -85,6 +85,7 @@ #include "titanic/game/bar_menu.h" #include "titanic/game/bar_menu_button.h" #include "titanic/game/belbot_get_light.h" +#include "titanic/game/bilge_succubus.h" #include "titanic/game/bomb.h" #include "titanic/game/bottom_of_well_monitor.h" #include "titanic/game/bowl_unlocker.h" @@ -150,6 +151,8 @@ #include "titanic/game/music_room_phonograph.h" #include "titanic/game/music_room_stop_phonograph_button.h" #include "titanic/game/music_system_lock.h" +#include "titanic/game/nav_helmet.h" +#include "titanic/game/navigation_computer.h" #include "titanic/game/no_nut_bowl.h" #include "titanic/game/nose_holder.h" #include "titanic/game/null_port_hole.h" @@ -174,6 +177,7 @@ #include "titanic/game/service_elevator_window.h" #include "titanic/game/ship_setting.h" #include "titanic/game/ship_setting_button.h" +#include "titanic/game/show_cell_points.h" #include "titanic/game/speech_dispensor.h" #include "titanic/game/starling_puret.h" #include "titanic/game/start_action.h" @@ -186,9 +190,11 @@ #include "titanic/game/titania_still_control.h" #include "titanic/game/tow_parrot_nav.h" #include "titanic/game/up_lighter.h" +#include "titanic/game/useless_lever.h" #include "titanic/game/wheel_button.h" #include "titanic/game/wheel_hotspot.h" #include "titanic/game/wheel_spin.h" +#include "titanic/game/wheel_spin_horn.h" #include "titanic/game/parrot/parrot_lobby_controller.h" #include "titanic/game/parrot/parrot_lobby_link_updater.h" #include "titanic/game/parrot/parrot_lobby_object.h" @@ -285,6 +291,7 @@ #include "titanic/gfx/small_chev_right_on.h" #include "titanic/gfx/status_change_button.h" #include "titanic/gfx/st_button.h" +#include "titanic/gfx/toggle_button.h" #include "titanic/gfx/toggle_switch.h" #include "titanic/gfx/volume_control.h" #include "titanic/messages/messages.h" @@ -329,10 +336,13 @@ #include "titanic/sound/auto_music_player.h" #include "titanic/sound/auto_music_player_base.h" +#include "titanic/sound/auto_sound_event.h" #include "titanic/sound/auto_sound_player.h" #include "titanic/sound/auto_sound_player_adsr.h" #include "titanic/sound/background_sound_maker.h" +#include "titanic/sound/bilge_auto_sound_event.h" #include "titanic/sound/bird_song.h" +#include "titanic/sound/door_auto_sound_event.h" #include "titanic/sound/gondolier_song.h" #include "titanic/sound/enter_view_toggles_other_music.h" #include "titanic/sound/music_player.h" @@ -419,6 +429,7 @@ DEFFN(CBarBell); DEFFN(CBarMenu); DEFFN(CBarMenuButton); DEFFN(CBelbotGetLight); +DEFFN(CBilgeSuccUBus); DEFFN(CBomb); DEFFN(CBottomOfWellMonitor); DEFFN(CBowlUnlocker); @@ -483,6 +494,8 @@ DEFFN(CMusicConsoleButton); DEFFN(CMusicRoomPhonograph); DEFFN(CMusicRoomStopPhonographButton); DEFFN(CMusicSystemLock); +DEFFN(CNavHelmet); +DEFFN(CNavigationComputer); DEFFN(CNoNutBowl); DEFFN(CNoseHolder); DEFFN(CNullPortHole); @@ -507,6 +520,7 @@ DEFFN(CServiceElevatorDoor); DEFFN(CServiceElevatorWindow); DEFFN(CShipSetting); DEFFN(CShipSettingButton); +DEFFN(CShowCellpoints); DEFFN(CSpeechDispensor); DEFFN(CStarlingPuret); DEFFN(CStartAction); @@ -519,9 +533,11 @@ DEFFN(CThrowTVDownWell); DEFFN(CTitaniaStillControl); DEFFN(CTOWParrotNav); DEFFN(CUpLighter); +DEFFN(CUselessLever); DEFFN(CWheelButton); DEFFN(CWheelHotSpot); DEFFN(CWheelSpin); +DEFFN(CWheelSpinHorn); DEFFN(CParrotLobbyController); DEFFN(CParrotLobbyLinkUpdater); DEFFN(CParrotLobbyObject); @@ -621,6 +637,8 @@ DEFFN(CSmallChevRightOff); DEFFN(CSmallChevRightOn); DEFFN(CStatusChangeButton); DEFFN(CSTButton); +DEFFN(CToggleButton); +DEFFN(CToggleSwitch); DEFFN(CVolumeControl); DEFFN(CActMsg); @@ -629,7 +647,6 @@ DEFFN(CAddHeadPieceMsg); DEFFN(CAnimateMaitreDMsg); DEFFN(CArboretumGateMsg); DEFFN(CArmPickedUpFromTableMsg); -DEFFN(CAutoSoundEvent); DEFFN(CBodyInBilgeRoomMsg); DEFFN(CBowlStateChange); DEFFN(CCarryObjectArrivedMsg); @@ -649,7 +666,6 @@ DEFFN(CDisableMaitreDProdReceptor); DEFFN(CDismissBotMsg); DEFFN(CDoffNavHelmet); DEFFN(CDonNavHelmet); -DEFFN(CDoorAutoSoundEvent); DEFFN(CDoorbotNeededInElevatorMsg); DEFFN(CDoorbotNeededInHomeMsg); DEFFN(CDropobjectMsg); @@ -834,11 +850,14 @@ DEFFN(CSummonBots); DEFFN(CSuccUBus); DEFFN(CTitania); DEFFN(CAutoMusicPlayer); +DEFFN(CAutoSoundEvent); DEFFN(CAutoMusicPlayerBase); DEFFN(CAutoSoundPlayer); DEFFN(CAutoSoundPlayerADSR); DEFFN(CBackgroundSoundMaker); +DEFFN(CBilgeAutoSoundEvent); DEFFN(CBirdSong); +DEFFN(CDoorAutoSoundEvent); DEFFN(CEnterViewTogglesOtherMusic); DEFFN(CGondolierSong); DEFFN(CMusicPlayer); @@ -919,6 +938,7 @@ void CSaveableObject::initClassList() { ADDFN(CBarMenu); ADDFN(CBarMenuButton); ADDFN(CBelbotGetLight); + ADDFN(CBilgeSuccUBus); ADDFN(CBomb); ADDFN(CBottomOfWellMonitor); ADDFN(CBrainSlot); @@ -984,6 +1004,8 @@ void CSaveableObject::initClassList() { ADDFN(CMusicRoomPhonograph); ADDFN(CMusicRoomStopPhonographButton); ADDFN(CMusicSystemLock); + ADDFN(CNavHelmet); + ADDFN(CNavigationComputer); ADDFN(CNoNutBowl); ADDFN(CNoseHolder); ADDFN(CNullPortHole); @@ -1008,6 +1030,7 @@ void CSaveableObject::initClassList() { ADDFN(CServiceElevatorWindow); ADDFN(CShipSetting); ADDFN(CShipSettingButton); + ADDFN(CShowCellpoints); ADDFN(CSpeechDispensor); ADDFN(CStarlingPuret); ADDFN(CStartAction); @@ -1020,9 +1043,11 @@ void CSaveableObject::initClassList() { ADDFN(CTitaniaStillControl); ADDFN(CTOWParrotNav); ADDFN(CUpLighter); + ADDFN(CUselessLever); ADDFN(CWheelButton); ADDFN(CWheelHotSpot); ADDFN(CWheelSpin); + ADDFN(CWheelSpinHorn); ADDFN(CParrotLobbyController); ADDFN(CParrotLobbyLinkUpdater); ADDFN(CParrotLobbyObject); @@ -1122,6 +1147,8 @@ void CSaveableObject::initClassList() { ADDFN(CSmallChevRightOn); ADDFN(CStatusChangeButton); ADDFN(CSTButton); + ADDFN(CToggleButton); + ADDFN(CToggleSwitch); ADDFN(CVolumeControl); ADDFN(CActMsg); @@ -1130,7 +1157,6 @@ void CSaveableObject::initClassList() { ADDFN(CAnimateMaitreDMsg); ADDFN(CArboretumGateMsg); ADDFN(CArmPickedUpFromTableMsg); - ADDFN(CAutoSoundEvent); ADDFN(CBodyInBilgeRoomMsg); ADDFN(CBowlStateChange); ADDFN(CCarryObjectArrivedMsg); @@ -1150,7 +1176,6 @@ void CSaveableObject::initClassList() { ADDFN(CDismissBotMsg); ADDFN(CDoffNavHelmet); ADDFN(CDonNavHelmet); - ADDFN(CDoorAutoSoundEvent); ADDFN(CDoorbotNeededInElevatorMsg); ADDFN(CDoorbotNeededInHomeMsg); ADDFN(CDropobjectMsg); @@ -1336,11 +1361,14 @@ void CSaveableObject::initClassList() { ADDFN(CTitania); ADDFN(CAutoMusicPlayer); + ADDFN(CAutoSoundEvent); ADDFN(CAutoMusicPlayerBase); ADDFN(CAutoSoundPlayer); ADDFN(CAutoSoundPlayerADSR); ADDFN(CBackgroundSoundMaker); + ADDFN(CBilgeAutoSoundEvent); ADDFN(CBirdSong); + ADDFN(CDoorAutoSoundEvent); ADDFN(CGondolierSong); ADDFN(CEnterViewTogglesOtherMusic); ADDFN(CGondolierSong); diff --git a/engines/titanic/game/bilge_succubus.cpp b/engines/titanic/game/bilge_succubus.cpp new file mode 100644 index 0000000000..9c19d81020 --- /dev/null +++ b/engines/titanic/game/bilge_succubus.cpp @@ -0,0 +1,51 @@ +/* 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 "titanic/game/bilge_succubus.h" + +namespace Titanic { + +CBilgeSuccUBus::CBilgeSuccUBus() : CSuccUBus(), _field1DC(0), + _field1E0(0), _field1E4(0), _field1E8(0) { +} + +void CBilgeSuccUBus::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field1DC, indent); + file->writeNumberLine(_field1E0, indent); + file->writeNumberLine(_field1E4, indent); + file->writeNumberLine(_field1E8, indent); + + CSuccUBus::save(file, indent); +} + +void CBilgeSuccUBus::load(SimpleFile *file) { + file->readNumber(); + _field1DC = file->readNumber(); + _field1E0 = file->readNumber(); + _field1E4 = file->readNumber(); + _field1E8 = file->readNumber(); + + CSuccUBus::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/bilge_succubus.h b/engines/titanic/game/bilge_succubus.h new file mode 100644 index 0000000000..795fe865c2 --- /dev/null +++ b/engines/titanic/game/bilge_succubus.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_BILGE_SUCCUBUS_H +#define TITANIC_BILGE_SUCCUBUS_H + +#include "titanic/npcs/succubus.h" + +namespace Titanic { + +class CBilgeSuccUBus : public CSuccUBus { +public: + int _field1DC; + int _field1E0; + int _field1E4; + int _field1E8; +public: + CBilgeSuccUBus(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBilgeSuccUBus"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BILGE_SUCCUBUS_H */ diff --git a/engines/titanic/game/nav_helmet.cpp b/engines/titanic/game/nav_helmet.cpp new file mode 100644 index 0000000000..c1dbb115f5 --- /dev/null +++ b/engines/titanic/game/nav_helmet.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/nav_helmet.h" + +namespace Titanic { + +void CNavHelmet::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CGameObject::save(file, indent); +} + +void CNavHelmet::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/nav_helmet.h b/engines/titanic/game/nav_helmet.h new file mode 100644 index 0000000000..31eee9977a --- /dev/null +++ b/engines/titanic/game/nav_helmet.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_NAV_HELMET_H +#define TITANIC_NAV_HELMET_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CNavHelmet : public CGameObject { +private: + int _value; +public: + CNavHelmet() : CGameObject(), _value(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CNavHelmet"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_NAV_HELMET_H */ diff --git a/engines/titanic/game/service_elevator_door.h b/engines/titanic/game/service_elevator_door.h index 616601d196..52465d842d 100644 --- a/engines/titanic/game/service_elevator_door.h +++ b/engines/titanic/game/service_elevator_door.h @@ -23,7 +23,7 @@ #ifndef TITANIC_SERVICE_ELEVATOR_DOOR_H #define TITANIC_SERVICE_ELEVATOR_DOOR_H -#include "titanic/messages/messages.h" +#include "titanic/sound/door_auto_sound_event.h" namespace Titanic { diff --git a/engines/titanic/game/useless_lever.cpp b/engines/titanic/game/useless_lever.cpp new file mode 100644 index 0000000000..afc025b58f --- /dev/null +++ b/engines/titanic/game/useless_lever.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/useless_lever.h" + +namespace Titanic { + +void CUselessLever::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CToggleButton::save(file, indent); +} + +void CUselessLever::load(SimpleFile *file) { + file->readNumber(); + CToggleButton::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/useless_lever.h b/engines/titanic/game/useless_lever.h new file mode 100644 index 0000000000..444df0c69f --- /dev/null +++ b/engines/titanic/game/useless_lever.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_USELESS_LEVER_H +#define TITANIC_USELESS_LEVER_H + +#include "titanic/gfx/toggle_button.h" + +namespace Titanic { + +class CUselessLever : public CToggleButton { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CUselessLever"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_UP_LIGHTER_H */ diff --git a/engines/titanic/game/wheel_spin_horn.cpp b/engines/titanic/game/wheel_spin_horn.cpp new file mode 100644 index 0000000000..3bc705dddb --- /dev/null +++ b/engines/titanic/game/wheel_spin_horn.cpp @@ -0,0 +1,43 @@ +/* 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 "titanic/game/wheel_spin_horn.h" + +namespace Titanic { + +void CWheelSpinHorn::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + + CWheelSpin::save(file, indent); +} + +void CWheelSpinHorn::load(SimpleFile *file) { + file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + + CWheelSpin::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/wheel_spin_horn.h b/engines/titanic/game/wheel_spin_horn.h new file mode 100644 index 0000000000..b96b20b6c4 --- /dev/null +++ b/engines/titanic/game/wheel_spin_horn.h @@ -0,0 +1,53 @@ +/* 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. + * + */ + +#ifndef TITANIC_WHEEL_SPIN_HORN_H +#define TITANIC_WHEEL_SPIN_HORN_H + +#include "titanic/game/wheel_spin.h" + +namespace Titanic { + +class CWheelSpinHorn : public CWheelSpin { +public: + CString _string1; + CString _string2; +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CWheelSpinHorn"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_WHEEL_SPIN_HORN_H */ diff --git a/engines/titanic/gfx/toggle_button.cpp b/engines/titanic/gfx/toggle_button.cpp new file mode 100644 index 0000000000..8284d35aac --- /dev/null +++ b/engines/titanic/gfx/toggle_button.cpp @@ -0,0 +1,41 @@ +/* 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 "titanic/gfx/toggle_button.h" + +namespace Titanic { + +void CToggleButton::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + + CBackground::save(file, indent); +} + +void CToggleButton::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + + CBackground::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/toggle_button.h b/engines/titanic/gfx/toggle_button.h new file mode 100644 index 0000000000..b5113d7f95 --- /dev/null +++ b/engines/titanic/gfx/toggle_button.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_TOGGLE_BUTTON_H +#define TITANIC_TOGGLE_BUTTON_H + +#include "titanic/core/background.h" + +namespace Titanic { + +class CToggleButton : public CBackground { +private: + int _fieldE0; +public: + CToggleButton() : CBackground(), _fieldE0(1) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CToggleButton"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TOGGLE_BUTTON_H */ diff --git a/engines/titanic/messages/messages.cpp b/engines/titanic/messages/messages.cpp index f60ad12cd7..c2a6197d4a 100644 --- a/engines/titanic/messages/messages.cpp +++ b/engines/titanic/messages/messages.cpp @@ -37,51 +37,4 @@ void CMessage::load(SimpleFile *file) { CSaveableObject::load(file); } -/*------------------------------------------------------------------------*/ - -CAutoSoundEvent::CAutoSoundEvent() : CGameObject(), _fieldBC(-1), _fieldC0(0xFFFFFF) { -} - -void CAutoSoundEvent::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldBC, indent); - file->writeNumberLine(_fieldC0, indent); - - CGameObject::save(file, indent); -} - -void CAutoSoundEvent::load(SimpleFile *file) { - file->readNumber(); - _fieldBC = file->readNumber(); - _fieldC0 = file->readNumber(); - - CGameObject::load(file); -} - -/*------------------------------------------------------------------------*/ - -CDoorAutoSoundEvent::CDoorAutoSoundEvent() : CAutoSoundEvent(), -_string1("z#44.wav"), _string2("z#43.wav"), _fieldDC(25), _fieldE0(25) { -} - -void CDoorAutoSoundEvent::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeQuotedLine(_string1, indent); - file->writeQuotedLine(_string2, indent); - file->writeNumberLine(_fieldDC, indent); - file->writeNumberLine(_fieldE0, indent); - - CAutoSoundEvent::save(file, indent); -} - -void CDoorAutoSoundEvent::load(SimpleFile *file) { - file->readNumber(); - _string1 = file->readString(); - _string2 = file->readString(); - _fieldDC = file->readNumber(); - _fieldE0 = file->readNumber(); - - CAutoSoundEvent::load(file); -} - } // End of namespace Titanic diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index e9490a8cb5..6b6695d28c 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -48,56 +48,6 @@ public: virtual void load(SimpleFile *file); }; -class CAutoSoundEvent : public CGameObject { -protected: - int _fieldBC; - int _fieldC0; -public: - CAutoSoundEvent(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CAutoSoundEvent"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - - -class CDoorAutoSoundEvent : public CAutoSoundEvent { -protected: - CString _string1; - CString _string2; - int _fieldDC; - int _fieldE0; -public: - CDoorAutoSoundEvent(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CDoorAutoSoundEvent"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - - class CEditControlMsg : public CMessage { private: int _field4; diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 86ddafddef..975d5aa08c 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -80,6 +80,7 @@ MODULE_OBJS := \ game/arb_background.o \ game/arboretum_gate.o \ game/auto_animate.o \ + game/bilge_succubus.o \ game/bomb.o \ game/bar_menu.o \ game/bar_menu_button.o \ @@ -159,6 +160,7 @@ MODULE_OBJS := \ game/music_room_stop_phonograph_button.o \ game/music_system_lock.o \ game/musical_instrument.o \ + game/nav_helmet.o \ game/navigation_computer.o \ game/no_nut_bowl.o \ game/nose_holder.o \ @@ -204,9 +206,11 @@ MODULE_OBJS := \ game/throw_tv_down_well.o \ game/titania_still_control.o \ game/up_lighter.o \ + game/useless_lever.o \ game/wheel_button.o \ game/wheel_hotspot.o \ game/wheel_spin.o \ + game/wheel_spin_horn.o \ game/parrot/parrot_lobby_controller.o \ game/parrot/parrot_lobby_link_updater.o \ game/parrot/parrot_lobby_object.o \ @@ -297,10 +301,9 @@ MODULE_OBJS := \ gfx/small_chev_right_on.o \ gfx/status_change_button.o \ gfx/st_button.o \ + gfx/toggle_button.o \ gfx/toggle_switch.o \ gfx/volume_control.o \ - messages/auto_sound_event.o \ - messages/door_auto_sound_event.o \ messages/messages.o \ moves/enter_bomb_room.o \ moves/enter_bridge.o \ @@ -341,10 +344,13 @@ MODULE_OBJS := \ npcs/true_talk_npc.o \ sound/auto_music_player.o \ sound/auto_music_player_base.o \ + sound/auto_sound_event.o \ sound/auto_sound_player.o \ sound/auto_sound_player_adsr.o \ sound/background_sound_maker.o \ + sound/bilge_auto_sound_event.o \ sound/bird_song.o \ + sound/door_auto_sound_event.o \ sound/enter_view_toggles_other_music.o \ sound/gondolier_song.o \ sound/music_player.o \ diff --git a/engines/titanic/sound/auto_sound_event.cpp b/engines/titanic/sound/auto_sound_event.cpp new file mode 100644 index 0000000000..673f35b210 --- /dev/null +++ b/engines/titanic/sound/auto_sound_event.cpp @@ -0,0 +1,46 @@ +/* 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 "titanic/sound/auto_sound_event.h" + +namespace Titanic { + +CAutoSoundEvent::CAutoSoundEvent() : CGameObject(), _value1(0), _value2(70) { +} + +void CAutoSoundEvent::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value1, indent); + file->writeNumberLine(_value2, indent); + + CGameObject::save(file, indent); +} + +void CAutoSoundEvent::load(SimpleFile *file) { + file->readNumber(); + _value1 = file->readNumber(); + _value2 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/sound/auto_sound_event.h b/engines/titanic/sound/auto_sound_event.h new file mode 100644 index 0000000000..cb5bfee788 --- /dev/null +++ b/engines/titanic/sound/auto_sound_event.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_AUTO_SOUND_EVENT_H +#define TITANIC_AUTO_SOUND_EVENT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CAutoSoundEvent : public CGameObject { +public: + int _value1; + int _value2; +public: + CAutoSoundEvent(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CAutoSoundEvent"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/sound/bilge_auto_sound_event.cpp b/engines/titanic/sound/bilge_auto_sound_event.cpp new file mode 100644 index 0000000000..2446a5df06 --- /dev/null +++ b/engines/titanic/sound/bilge_auto_sound_event.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/sound/bilge_auto_sound_event.h" + +namespace Titanic { + +void CBilgeAutoSoundEvent::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CAutoSoundEvent::save(file, indent); +} + +void CBilgeAutoSoundEvent::load(SimpleFile *file) { + file->readNumber(); + CAutoSoundEvent::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/sound/bilge_auto_sound_event.h b/engines/titanic/sound/bilge_auto_sound_event.h new file mode 100644 index 0000000000..96572839ae --- /dev/null +++ b/engines/titanic/sound/bilge_auto_sound_event.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_BILGE_AUTO_SOUND_EVENT_H +#define TITANIC_BILGE_AUTO_SOUND_EVENT_H + +#include "titanic/sound/auto_sound_event.h" + +namespace Titanic { + +class CBilgeAutoSoundEvent : public CAutoSoundEvent { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBilgeAutoSoundEvent"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BILGE_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/sound/door_auto_sound_event.cpp b/engines/titanic/sound/door_auto_sound_event.cpp new file mode 100644 index 0000000000..f0e77fce91 --- /dev/null +++ b/engines/titanic/sound/door_auto_sound_event.cpp @@ -0,0 +1,47 @@ +/* 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 "titanic/sound/door_auto_sound_event.h" + +namespace Titanic { + +void CDoorAutoSoundEvent::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + file->writeNumberLine(_fieldDC, indent); + file->writeNumberLine(_fieldE0, indent); + + CAutoSoundEvent::save(file, indent); +} + +void CDoorAutoSoundEvent::load(SimpleFile *file) { + file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + _fieldDC = file->readNumber(); + _fieldE0 = file->readNumber(); + + CAutoSoundEvent::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/sound/door_auto_sound_event.h b/engines/titanic/sound/door_auto_sound_event.h new file mode 100644 index 0000000000..017912dc36 --- /dev/null +++ b/engines/titanic/sound/door_auto_sound_event.h @@ -0,0 +1,59 @@ +/* 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. + * + */ + +#ifndef TITANIC_DOOR_AUTO_SOUND_EVENT_H +#define TITANIC_DOOR_AUTO_SOUND_EVENT_H + +#include "titanic/sound/auto_sound_event.h" + +namespace Titanic { + +class CDoorAutoSoundEvent : public CAutoSoundEvent { +public: + CString _string1; + CString _string2; + int _fieldDC; + int _fieldE0; +public: + CDoorAutoSoundEvent::CDoorAutoSoundEvent() : CAutoSoundEvent(), + _string1("z#44.wav"), _string2("z#43.wav"), _fieldDC(25), _fieldE0(25) { + } + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CDoorAutoSoundEvent"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DOOR_AUTO_SOUND_EVENT_H */ -- cgit v1.2.3 From 3ae4e63c80cda635f941370e72536988bde67698 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 2 Mar 2016 22:05:25 -0500 Subject: TITANIC: Implemented more saveable classes --- engines/titanic/carry/maitred_left_arm.cpp | 39 +++++++++++++ engines/titanic/carry/maitred_left_arm.h | 54 ++++++++++++++++++ engines/titanic/carry/maitred_right_arm.cpp | 37 +++++++++++++ engines/titanic/carry/maitred_right_arm.h | 50 +++++++++++++++++ engines/titanic/carry/speech_centre.cpp | 4 +- engines/titanic/core/saveable_object.cpp | 64 ++++++++++++++++++---- engines/titanic/game/broken_pell_base.cpp | 7 +++ engines/titanic/game/broken_pell_base.h | 5 +- engines/titanic/game/broken_pellerator.cpp | 47 ++++++++++++++++ engines/titanic/game/broken_pellerator.h | 55 +++++++++++++++++++ engines/titanic/game/broken_pellerator_froz.cpp | 47 ++++++++++++++++ engines/titanic/game/broken_pellerator_froz.h | 55 +++++++++++++++++++ engines/titanic/game/gondolier_base.cpp | 33 +++++++++++ engines/titanic/game/gondolier_base.h | 11 ++++ engines/titanic/game/gondolier_mixer.cpp | 59 ++++++++++++++++++++ engines/titanic/game/gondolier_mixer.h | 60 ++++++++++++++++++++ engines/titanic/game/lemon_dispensor.cpp | 10 ++++ engines/titanic/game/lemon_dispensor.h | 6 +- .../titanic/game/maitred/maitred_arm_holder.cpp | 37 +++++++++++++ engines/titanic/game/maitred/maitred_arm_holder.h | 50 +++++++++++++++++ engines/titanic/game/maitred/maitred_body.cpp | 39 +++++++++++++ engines/titanic/game/maitred/maitred_body.h | 54 ++++++++++++++++++ engines/titanic/game/maitred/maitred_legs.cpp | 39 +++++++++++++ engines/titanic/game/maitred/maitred_legs.h | 54 ++++++++++++++++++ .../titanic/game/maitred/maitred_prod_receptor.cpp | 45 +++++++++++++++ .../titanic/game/maitred/maitred_prod_receptor.h | 57 +++++++++++++++++++ engines/titanic/game/maitred_arm_holder.cpp | 37 ------------- engines/titanic/game/maitred_arm_holder.h | 50 ----------------- engines/titanic/game/pickup/pick_up_hose.cpp | 6 ++ engines/titanic/game/pickup/pick_up_hose.h | 2 + engines/titanic/game/service_elevator_door.cpp | 48 ---------------- engines/titanic/game/service_elevator_door.h | 52 ------------------ engines/titanic/game/speech_dispensor.cpp | 16 ++++++ engines/titanic/game/speech_dispensor.h | 9 +++ engines/titanic/messages/auto_sound_event.cpp | 46 ++++++++++++++++ engines/titanic/messages/auto_sound_event.h | 55 +++++++++++++++++++ .../titanic/messages/bilge_auto_sound_event.cpp | 37 +++++++++++++ engines/titanic/messages/bilge_auto_sound_event.h | 50 +++++++++++++++++ engines/titanic/messages/bilge_dispensor_event.cpp | 37 +++++++++++++ engines/titanic/messages/bilge_dispensor_event.h | 50 +++++++++++++++++ engines/titanic/messages/door_auto_sound_event.cpp | 47 ++++++++++++++++ engines/titanic/messages/door_auto_sound_event.h | 59 ++++++++++++++++++++ engines/titanic/messages/service_elevator_door.cpp | 48 ++++++++++++++++ engines/titanic/messages/service_elevator_door.h | 52 ++++++++++++++++++ engines/titanic/module.mk | 21 +++++-- engines/titanic/sound/auto_sound_event.cpp | 46 ---------------- engines/titanic/sound/auto_sound_event.h | 55 ------------------- engines/titanic/sound/bilge_auto_sound_event.cpp | 37 ------------- engines/titanic/sound/bilge_auto_sound_event.h | 50 ----------------- engines/titanic/sound/dome_from_top_of_well.cpp | 37 +++++++++++++ engines/titanic/sound/dome_from_top_of_well.h | 50 +++++++++++++++++ engines/titanic/sound/door_auto_sound_event.cpp | 47 ---------------- engines/titanic/sound/door_auto_sound_event.h | 59 -------------------- engines/titanic/sound/season_noises.cpp | 53 ++++++++++++++++++ engines/titanic/sound/season_noises.h | 58 ++++++++++++++++++++ 55 files changed, 1730 insertions(+), 502 deletions(-) create mode 100644 engines/titanic/carry/maitred_left_arm.cpp create mode 100644 engines/titanic/carry/maitred_left_arm.h create mode 100644 engines/titanic/carry/maitred_right_arm.cpp create mode 100644 engines/titanic/carry/maitred_right_arm.h create mode 100644 engines/titanic/game/broken_pellerator.cpp create mode 100644 engines/titanic/game/broken_pellerator.h create mode 100644 engines/titanic/game/broken_pellerator_froz.cpp create mode 100644 engines/titanic/game/broken_pellerator_froz.h create mode 100644 engines/titanic/game/gondolier_mixer.cpp create mode 100644 engines/titanic/game/gondolier_mixer.h create mode 100644 engines/titanic/game/maitred/maitred_arm_holder.cpp create mode 100644 engines/titanic/game/maitred/maitred_arm_holder.h create mode 100644 engines/titanic/game/maitred/maitred_body.cpp create mode 100644 engines/titanic/game/maitred/maitred_body.h create mode 100644 engines/titanic/game/maitred/maitred_legs.cpp create mode 100644 engines/titanic/game/maitred/maitred_legs.h create mode 100644 engines/titanic/game/maitred/maitred_prod_receptor.cpp create mode 100644 engines/titanic/game/maitred/maitred_prod_receptor.h delete mode 100644 engines/titanic/game/maitred_arm_holder.cpp delete mode 100644 engines/titanic/game/maitred_arm_holder.h delete mode 100644 engines/titanic/game/service_elevator_door.cpp delete mode 100644 engines/titanic/game/service_elevator_door.h create mode 100644 engines/titanic/messages/auto_sound_event.cpp create mode 100644 engines/titanic/messages/auto_sound_event.h create mode 100644 engines/titanic/messages/bilge_auto_sound_event.cpp create mode 100644 engines/titanic/messages/bilge_auto_sound_event.h create mode 100644 engines/titanic/messages/bilge_dispensor_event.cpp create mode 100644 engines/titanic/messages/bilge_dispensor_event.h create mode 100644 engines/titanic/messages/door_auto_sound_event.cpp create mode 100644 engines/titanic/messages/door_auto_sound_event.h create mode 100644 engines/titanic/messages/service_elevator_door.cpp create mode 100644 engines/titanic/messages/service_elevator_door.h delete mode 100644 engines/titanic/sound/auto_sound_event.cpp delete mode 100644 engines/titanic/sound/auto_sound_event.h delete mode 100644 engines/titanic/sound/bilge_auto_sound_event.cpp delete mode 100644 engines/titanic/sound/bilge_auto_sound_event.h create mode 100644 engines/titanic/sound/dome_from_top_of_well.cpp create mode 100644 engines/titanic/sound/dome_from_top_of_well.h delete mode 100644 engines/titanic/sound/door_auto_sound_event.cpp delete mode 100644 engines/titanic/sound/door_auto_sound_event.h create mode 100644 engines/titanic/sound/season_noises.cpp create mode 100644 engines/titanic/sound/season_noises.h diff --git a/engines/titanic/carry/maitred_left_arm.cpp b/engines/titanic/carry/maitred_left_arm.cpp new file mode 100644 index 0000000000..6fb93ecc63 --- /dev/null +++ b/engines/titanic/carry/maitred_left_arm.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/carry/maitred_left_arm.h" + +namespace Titanic { + +void CMaitreDLeftArm::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_field174, indent); + CArm::save(file, indent); +} + +void CMaitreDLeftArm::load(SimpleFile *file) { + file->readNumber(); + _field174 = file->readNumber(); + CArm::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/maitred_left_arm.h b/engines/titanic/carry/maitred_left_arm.h new file mode 100644 index 0000000000..f6cf6986ef --- /dev/null +++ b/engines/titanic/carry/maitred_left_arm.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_LEFT_ARM_H +#define TITANIC_LEFT_ARM_H + +#include "titanic/carry/arm.h" + +namespace Titanic { + +class CMaitreDLeftArm : public CArm { +private: + int _field174; +public: + CMaitreDLeftArm() : CArm(), _field174(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMaitreDLeftArm"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_LEFT_ARM_H */ diff --git a/engines/titanic/carry/maitred_right_arm.cpp b/engines/titanic/carry/maitred_right_arm.cpp new file mode 100644 index 0000000000..15767a2fc2 --- /dev/null +++ b/engines/titanic/carry/maitred_right_arm.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/carry/maitred_right_arm.h" + +namespace Titanic { + +void CMaitreDRightArm::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CArm::save(file, indent); +} + +void CMaitreDRightArm::load(SimpleFile *file) { + file->readNumber(); + CArm::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/carry/maitred_right_arm.h b/engines/titanic/carry/maitred_right_arm.h new file mode 100644 index 0000000000..a4a44895da --- /dev/null +++ b/engines/titanic/carry/maitred_right_arm.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_MAITRED_RIGHT_ARM_H +#define TITANIC_MAITRED_RIGHT_ARM_H + +#include "titanic/carry/arm.h" + +namespace Titanic { + +class CMaitreDRightArm : public CArm { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMaitreDRightArm"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MAITRED_RIGHT_ARM_H */ diff --git a/engines/titanic/carry/speech_centre.cpp b/engines/titanic/carry/speech_centre.cpp index c5875bd22c..86ed730284 100644 --- a/engines/titanic/carry/speech_centre.cpp +++ b/engines/titanic/carry/speech_centre.cpp @@ -30,7 +30,7 @@ void CSpeechCentre::save(SimpleFile *file, int indent) const { file->writeQuotedLine(_string1, indent); file->writeNumberLine(_field14C, indent); - CCarry::save(file, indent); + CBrain::save(file, indent); } void CSpeechCentre::load(SimpleFile *file) { @@ -39,7 +39,7 @@ void CSpeechCentre::load(SimpleFile *file) { _string1 = file->readString(); _field14C = file->readNumber(); - CCarry::load(file); + CBrain::load(file); } } // End of namespace Titanic diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 84f0887b57..7a41230214 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -42,6 +42,8 @@ #include "titanic/carry/liftbot_head.h" #include "titanic/carry/long_stick.h" #include "titanic/carry/magazine.h" +#include "titanic/carry/maitred_left_arm.h" +#include "titanic/carry/maitred_right_arm.h" #include "titanic/carry/mouth.h" #include "titanic/carry/napkin.h" #include "titanic/carry/nose.h" @@ -92,6 +94,8 @@ #include "titanic/game/brain_slot.h" #include "titanic/game/bridge_view.h" #include "titanic/game/broken_pell_base.h" +#include "titanic/game/broken_pellerator.h" +#include "titanic/game/broken_pellerator_froz.h" #include "titanic/game/cage.h" #include "titanic/game/call_pellerator.h" #include "titanic/game/captains_wheel.h" @@ -131,6 +135,8 @@ #include "titanic/game/games_console.h" #include "titanic/game/get_lift_eye2.h" #include "titanic/game/glass_smasher.h" +#include "titanic/game/gondolier_base.h" +#include "titanic/game/gondolier_mixer.h" #include "titanic/game/hammer_clip.h" #include "titanic/game/hammer_dispensor.h" #include "titanic/game/hammer_dispensor_button.h" @@ -143,7 +149,6 @@ #include "titanic/game/light_switch.h" #include "titanic/game/little_lift_button.h" #include "titanic/game/long_stick_dispenser.h" -#include "titanic/game/maitred_arm_holder.h" #include "titanic/game/missiveomat.h" #include "titanic/game/missiveomat_button.h" #include "titanic/game/musical_instrument.h" @@ -166,14 +171,15 @@ #include "titanic/game/port_hole.h" #include "titanic/game/record_phonograph_button.h" #include "titanic/game/replacement_ear.h" +#include "titanic/game/reserved_table.h" #include "titanic/game/restaurant_cylinder_holder.h" #include "titanic/game/restaurant_phonograph.h" #include "titanic/game/room_item.h" #include "titanic/game/sauce_dispensor.h" +#include "titanic/game/search_point.h" #include "titanic/game/season_background.h" #include "titanic/game/season_barrel.h" #include "titanic/game/seasonal_adjustment.h" -#include "titanic/game/service_elevator_door.h" #include "titanic/game/service_elevator_window.h" #include "titanic/game/ship_setting.h" #include "titanic/game/ship_setting_button.h" @@ -195,6 +201,10 @@ #include "titanic/game/wheel_hotspot.h" #include "titanic/game/wheel_spin.h" #include "titanic/game/wheel_spin_horn.h" +#include "titanic/game/maitred/maitred_arm_holder.h" +#include "titanic/game/maitred/maitred_body.h" +#include "titanic/game/maitred/maitred_legs.h" +#include "titanic/game/maitred/maitred_prod_receptor.h" #include "titanic/game/parrot/parrot_lobby_controller.h" #include "titanic/game/parrot/parrot_lobby_link_updater.h" #include "titanic/game/parrot/parrot_lobby_object.h" @@ -294,9 +304,15 @@ #include "titanic/gfx/toggle_button.h" #include "titanic/gfx/toggle_switch.h" #include "titanic/gfx/volume_control.h" + #include "titanic/messages/messages.h" +#include "titanic/messages/auto_sound_event.h" +#include "titanic/messages/bilge_auto_sound_event.h" +#include "titanic/messages/bilge_dispensor_event.h" +#include "titanic/messages/door_auto_sound_event.h" #include "titanic/messages/mouse_messages.h" #include "titanic/messages/pet_messages.h" +#include "titanic/messages/service_elevator_door.h" #include "titanic/moves/enter_bomb_room.h" #include "titanic/moves/enter_bridge.h" @@ -336,19 +352,17 @@ #include "titanic/sound/auto_music_player.h" #include "titanic/sound/auto_music_player_base.h" -#include "titanic/sound/auto_sound_event.h" #include "titanic/sound/auto_sound_player.h" #include "titanic/sound/auto_sound_player_adsr.h" #include "titanic/sound/background_sound_maker.h" -#include "titanic/sound/bilge_auto_sound_event.h" #include "titanic/sound/bird_song.h" -#include "titanic/sound/door_auto_sound_event.h" #include "titanic/sound/gondolier_song.h" #include "titanic/sound/enter_view_toggles_other_music.h" #include "titanic/sound/music_player.h" #include "titanic/sound/node_auto_sound_player.h" #include "titanic/sound/restricted_auto_music_player.h" #include "titanic/sound/room_auto_sound_player.h" +#include "titanic/sound/season_noises.h" #include "titanic/sound/seasonal_music_player.h" #include "titanic/sound/titania_speech.h" #include "titanic/sound/trigger_auto_music_player.h" @@ -387,6 +401,8 @@ DEFFN(CKey); DEFFN(CLiftbotHead); DEFFN(CLongStick); DEFFN(CMagazine); +DEFFN(CMaitreDLeftArm); +DEFFN(CMaitreDRightArm); DEFFN(CMouth); DEFFN(CNapkin); DEFFN(CNose); @@ -436,6 +452,8 @@ DEFFN(CBowlUnlocker); DEFFN(CBrainSlot); DEFFN(CBridgeView); DEFFN(CBrokenPellBase) +DEFFN(CBrokenPellerator); +DEFFN(CBrokenPelleratorFroz); DEFFN(CCage); DEFFN(CCallPellerator); DEFFN(CCaptainsWheel); @@ -474,6 +492,8 @@ DEFFN(CFloorIndicator); DEFFN(CGamesConsole); DEFFN(CGetLiftEye2); DEFFN(CGlassSmasher); +DEFFN(CGondolierBase); +DEFFN(CGondolierMixer); DEFFN(CHammerClip); DEFFN(CHammerDispensor); DEFFN(CHammerDispensorButton); @@ -486,7 +506,6 @@ DEFFN(CLight); DEFFN(CLightSwitch); DEFFN(CLittleLiftButton); DEFFN(CLongStickDispenser); -DEFFN(CMaitreDArmHolder); DEFFN(CMissiveOMat); DEFFN(CMissiveOMatButton); DEFFN(CMusicalInstrument); @@ -509,14 +528,15 @@ DEFFN(CPlayOnAct); DEFFN(CPortHole); DEFFN(CRecordPhonographButton); DEFFN(CReplacementEar); +DEFFN(CReservedTable); DEFFN(CRestaurantCylinderHolder); DEFFN(CRestaurantPhonograph); DEFFN(CRoomItem); DEFFN(CSauceDispensor); +DEFFN(CSearchPoint); DEFFN(CSeasonBackground); DEFFN(CSeasonBarrel); DEFFN(CSeasonalAdjustment); -DEFFN(CServiceElevatorDoor); DEFFN(CServiceElevatorWindow); DEFFN(CShipSetting); DEFFN(CShipSettingButton); @@ -538,6 +558,10 @@ DEFFN(CWheelButton); DEFFN(CWheelHotSpot); DEFFN(CWheelSpin); DEFFN(CWheelSpinHorn); +DEFFN(CMaitreDArmHolder); +DEFFN(CMaitreDBody); +DEFFN(CMaitreDLegs); +DEFFN(CMaitreDProdReceptor); DEFFN(CParrotLobbyController); DEFFN(CParrotLobbyLinkUpdater); DEFFN(CParrotLobbyObject); @@ -647,6 +671,9 @@ DEFFN(CAddHeadPieceMsg); DEFFN(CAnimateMaitreDMsg); DEFFN(CArboretumGateMsg); DEFFN(CArmPickedUpFromTableMsg); +DEFFN(CAutoSoundEvent); +DEFFN(CBilgeAutoSoundEvent); +DEFFN(CBilgeDispensorEvent); DEFFN(CBodyInBilgeRoomMsg); DEFFN(CBowlStateChange); DEFFN(CCarryObjectArrivedMsg); @@ -666,6 +693,7 @@ DEFFN(CDisableMaitreDProdReceptor); DEFFN(CDismissBotMsg); DEFFN(CDoffNavHelmet); DEFFN(CDonNavHelmet); +DEFFN(CDoorAutoSoundEvent); DEFFN(CDoorbotNeededInElevatorMsg); DEFFN(CDoorbotNeededInHomeMsg); DEFFN(CDropobjectMsg); @@ -761,6 +789,7 @@ DEFFN(CReplaceBowlAndNutsMsg); DEFFN(CRestaurantMusicChanged); DEFFN(CSendCCarryMsg); DEFFN(CSenseWorkingMsg); +DEFFN(CServiceElevatorDoor); DEFFN(CServiceElevatorFloorChangeMsg); DEFFN(CServiceElevatorFloorRequestMsg); DEFFN(CServiceElevatorMsg); @@ -850,20 +879,18 @@ DEFFN(CSummonBots); DEFFN(CSuccUBus); DEFFN(CTitania); DEFFN(CAutoMusicPlayer); -DEFFN(CAutoSoundEvent); DEFFN(CAutoMusicPlayerBase); DEFFN(CAutoSoundPlayer); DEFFN(CAutoSoundPlayerADSR); DEFFN(CBackgroundSoundMaker); -DEFFN(CBilgeAutoSoundEvent); DEFFN(CBirdSong); -DEFFN(CDoorAutoSoundEvent); DEFFN(CEnterViewTogglesOtherMusic); DEFFN(CGondolierSong); DEFFN(CMusicPlayer); DEFFN(CNodeAutoSoundPlayer); DEFFN(CRestrictedAutoMusicPlayer); DEFFN(CRoomAutoSoundPlayer); +DEFFN(CSeasonNoises); DEFFN(CSeasonalMusicPlayer); DEFFN(CTitaniaSpeech); DEFFN(CTriggerAutoMusicPlayer); @@ -896,6 +923,8 @@ void CSaveableObject::initClassList() { ADDFN(CLiftbotHead); ADDFN(CLongStick); ADDFN(CMagazine); + ADDFN(CMaitreDLeftArm); + ADDFN(CMaitreDRightArm); ADDFN(CMouth); ADDFN(CNapkin); ADDFN(CNose); @@ -945,6 +974,8 @@ void CSaveableObject::initClassList() { ADDFN(CBowlUnlocker); ADDFN(CBridgeView); ADDFN(CBrokenPellBase); + ADDFN(CBrokenPellerator); + ADDFN(CBrokenPelleratorFroz); ADDFN(CCage); ADDFN(CCallPellerator); ADDFN(CCaptainsWheel); @@ -984,6 +1015,8 @@ void CSaveableObject::initClassList() { ADDFN(CGamesConsole); ADDFN(CGetLiftEye2); ADDFN(CGlassSmasher); + ADDFN(CGondolierBase); + ADDFN(CGondolierMixer); ADDFN(CHammerClip); ADDFN(CHammerDispensor); ADDFN(CHammerDispensorButton); @@ -996,7 +1029,6 @@ void CSaveableObject::initClassList() { ADDFN(CLightSwitch); ADDFN(CLittleLiftButton); ADDFN(CLongStickDispenser); - ADDFN(CMaitreDArmHolder); ADDFN(CMissiveOMat); ADDFN(CMissiveOMatButton); ADDFN(CMusicalInstrument); @@ -1019,14 +1051,15 @@ void CSaveableObject::initClassList() { ADDFN(CPortHole); ADDFN(CRecordPhonographButton); ADDFN(CReplacementEar); + ADDFN(CReservedTable); ADDFN(CRestaurantCylinderHolder); ADDFN(CRestaurantPhonograph); ADDFN(CRoomItem); ADDFN(CSauceDispensor); + ADDFN(CSearchPoint); ADDFN(CSeasonBackground); ADDFN(CSeasonBarrel); ADDFN(CSeasonalAdjustment); - ADDFN(CServiceElevatorDoor); ADDFN(CServiceElevatorWindow); ADDFN(CShipSetting); ADDFN(CShipSettingButton); @@ -1048,6 +1081,10 @@ void CSaveableObject::initClassList() { ADDFN(CWheelHotSpot); ADDFN(CWheelSpin); ADDFN(CWheelSpinHorn); + ADDFN(CMaitreDArmHolder); + ADDFN(CMaitreDBody); + ADDFN(CMaitreDLegs); + ADDFN(CMaitreDProdReceptor); ADDFN(CParrotLobbyController); ADDFN(CParrotLobbyLinkUpdater); ADDFN(CParrotLobbyObject); @@ -1271,6 +1308,7 @@ void CSaveableObject::initClassList() { ADDFN(CRestaurantMusicChanged); ADDFN(CSendCCarryMsg); ADDFN(CSenseWorkingMsg); + ADDFN(CServiceElevatorDoor); ADDFN(CServiceElevatorFloorChangeMsg); ADDFN(CServiceElevatorFloorRequestMsg); ADDFN(CServiceElevatorMsg); @@ -1367,6 +1405,7 @@ void CSaveableObject::initClassList() { ADDFN(CAutoSoundPlayerADSR); ADDFN(CBackgroundSoundMaker); ADDFN(CBilgeAutoSoundEvent); + ADDFN(CBilgeDispensorEvent); ADDFN(CBirdSong); ADDFN(CDoorAutoSoundEvent); ADDFN(CGondolierSong); @@ -1376,6 +1415,7 @@ void CSaveableObject::initClassList() { ADDFN(CNodeAutoSoundPlayer); ADDFN(CRestrictedAutoMusicPlayer); ADDFN(CRoomAutoSoundPlayer); + ADDFN(CSeasonNoises); ADDFN(CSeasonalMusicPlayer); ADDFN(CAutoMusicPlayer); ADDFN(CTitaniaSpeech); diff --git a/engines/titanic/game/broken_pell_base.cpp b/engines/titanic/game/broken_pell_base.cpp index 9e2a97462a..2d11e544e2 100644 --- a/engines/titanic/game/broken_pell_base.cpp +++ b/engines/titanic/game/broken_pell_base.cpp @@ -24,14 +24,21 @@ namespace Titanic { +int CBrokenPellBase::_v1; +int CBrokenPellBase::_v2; + void CBrokenPellBase::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_v2, indent); file->writeNumberLine(_fieldE0, indent); CBackground::save(file, indent); } void CBrokenPellBase::load(SimpleFile *file) { file->readNumber(); + _v1 = file->readNumber(); + _v2 = file->readNumber(); _fieldE0 = file->readNumber(); CBackground::load(file); } diff --git a/engines/titanic/game/broken_pell_base.h b/engines/titanic/game/broken_pell_base.h index fa53af3c62..8e77501aa5 100644 --- a/engines/titanic/game/broken_pell_base.h +++ b/engines/titanic/game/broken_pell_base.h @@ -28,7 +28,10 @@ namespace Titanic { class CBrokenPellBase : public CBackground { -public: +private: + static int _v1; + static int _v2; + int _fieldE0; public: CBrokenPellBase() : CBackground(), _fieldE0(0) {} diff --git a/engines/titanic/game/broken_pellerator.cpp b/engines/titanic/game/broken_pellerator.cpp new file mode 100644 index 0000000000..ea167677bf --- /dev/null +++ b/engines/titanic/game/broken_pellerator.cpp @@ -0,0 +1,47 @@ +/* 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 "titanic/game/broken_pellerator.h" + +namespace Titanic { + +void CBrokenPellerator::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string2, indent); + file->writeQuotedLine(_string3, indent); + file->writeQuotedLine(_string4, indent); + file->writeQuotedLine(_string5, indent); + + CBrokenPellBase::save(file, indent); +} + +void CBrokenPellerator::load(SimpleFile *file) { + file->readNumber(); + _string2 = file->readString(); + _string3 = file->readString(); + _string4 = file->readString(); + _string5 = file->readString(); + + CBrokenPellBase::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/broken_pellerator.h b/engines/titanic/game/broken_pellerator.h new file mode 100644 index 0000000000..71bae32e17 --- /dev/null +++ b/engines/titanic/game/broken_pellerator.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_BROKEN_PELLERATOR_H +#define TITANIC_BROKEN_PELLERATOR_H + +#include "titanic/game/broken_pell_base.h" + +namespace Titanic { + +class CBrokenPellerator : public CBrokenPellBase { +private: + CString _string2; + CString _string3; + CString _string4; + CString _string5; +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBrokenPellerator"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BROKEN_PELLERATOR_H */ diff --git a/engines/titanic/game/broken_pellerator_froz.cpp b/engines/titanic/game/broken_pellerator_froz.cpp new file mode 100644 index 0000000000..6b077d27ec --- /dev/null +++ b/engines/titanic/game/broken_pellerator_froz.cpp @@ -0,0 +1,47 @@ +/* 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 "titanic/game/broken_pellerator_froz.h" + +namespace Titanic { + +void CBrokenPelleratorFroz::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string2, indent); + file->writeQuotedLine(_string3, indent); + file->writeQuotedLine(_string4, indent); + file->writeQuotedLine(_string5, indent); + + CBrokenPellBase::save(file, indent); +} + +void CBrokenPelleratorFroz::load(SimpleFile *file) { + file->readNumber(); + _string2 = file->readString(); + _string3 = file->readString(); + _string4 = file->readString(); + _string5 = file->readString(); + + CBrokenPellBase::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/broken_pellerator_froz.h b/engines/titanic/game/broken_pellerator_froz.h new file mode 100644 index 0000000000..1fded7c09f --- /dev/null +++ b/engines/titanic/game/broken_pellerator_froz.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_BROKEN_PELLERATOR_FROZ_H +#define TITANIC_BROKEN_PELLERATOR_FROZ_H + +#include "titanic/game/broken_pell_base.h" + +namespace Titanic { + +class CBrokenPelleratorFroz : public CBrokenPellBase { +private: + CString _string2; + CString _string3; + CString _string4; + CString _string5; +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBrokenPelleratorFroz"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BROKEN_PELLERATOR_FROZ_H */ diff --git a/engines/titanic/game/gondolier_base.cpp b/engines/titanic/game/gondolier_base.cpp index 32f434e3f2..59c9b5cd0c 100644 --- a/engines/titanic/game/gondolier_base.cpp +++ b/engines/titanic/game/gondolier_base.cpp @@ -24,13 +24,46 @@ namespace Titanic { +int CGondolierBase::_v1; +int CGondolierBase::_v2; +int CGondolierBase::_v3; +int CGondolierBase::_v4; +int CGondolierBase::_v5; +int CGondolierBase::_v6; +int CGondolierBase::_v7; +int CGondolierBase::_v8; +int CGondolierBase::_v9; +int CGondolierBase::_v10; + void CGondolierBase::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_v2, indent); + file->writeNumberLine(_v3, indent); + file->writeNumberLine(_v4, indent); + file->writeNumberLine(_v5, indent); + file->writeNumberLine(_v6, indent); + file->writeNumberLine(_v7, indent); + file->writeNumberLine(_v8, indent); + file->writeNumberLine(_v9, indent); + file->writeNumberLine(_v10, indent); + CGameObject::save(file, indent); } void CGondolierBase::load(SimpleFile *file) { file->readNumber(); + _v1 = file->readNumber(); + _v2 = file->readNumber(); + _v3 = file->readNumber(); + _v4 = file->readNumber(); + _v5 = file->readNumber(); + _v6 = file->readNumber(); + _v7 = file->readNumber(); + _v8 = file->readNumber(); + _v9 = file->readNumber(); + _v10 = file->readNumber(); + CGameObject::load(file); } diff --git a/engines/titanic/game/gondolier_base.h b/engines/titanic/game/gondolier_base.h index 99e0c99572..3f0cede70d 100644 --- a/engines/titanic/game/gondolier_base.h +++ b/engines/titanic/game/gondolier_base.h @@ -28,6 +28,17 @@ namespace Titanic { class CGondolierBase : public CGameObject { +private: + static int _v1; + static int _v2; + static int _v3; + static int _v4; + static int _v5; + static int _v6; + static int _v7; + static int _v8; + static int _v9; + static int _v10; public: /** * Return the class name diff --git a/engines/titanic/game/gondolier_mixer.cpp b/engines/titanic/game/gondolier_mixer.cpp new file mode 100644 index 0000000000..33cc883bb0 --- /dev/null +++ b/engines/titanic/game/gondolier_mixer.cpp @@ -0,0 +1,59 @@ +/* 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 "titanic/game/gondolier_mixer.h" + +namespace Titanic { + +CGondolierMixer::CGondolierMixer() : CGondolierBase(), + _string1("c#0.wav"), _string2("c#1.wav"), + _fieldBC(-1), _fieldC0(-1), _fieldC4(0), _fieldC8(0), + _fieldE4(0) { +} + +void CGondolierMixer::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_fieldC4, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + file->writeNumberLine(_fieldE4, indent); + + CGondolierBase::save(file, indent); +} + +void CGondolierMixer::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _fieldC4 = file->readNumber(); + _fieldC8 = file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + _fieldE4 = file->readNumber(); + + CGondolierBase::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/gondolier_mixer.h b/engines/titanic/game/gondolier_mixer.h new file mode 100644 index 0000000000..dfc46210c3 --- /dev/null +++ b/engines/titanic/game/gondolier_mixer.h @@ -0,0 +1,60 @@ +/* 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. + * + */ + +#ifndef TITANIC_GONDOLIER_MIXER_H +#define TITANIC_GONDOLIER_MIXER_H + +#include "titanic/game/gondolier_base.h" + +namespace Titanic { + +class CGondolierMixer : public CGondolierBase { +private: + int _fieldBC; + int _fieldC0; + int _fieldC4; + int _fieldC8; + CString _string1; + CString _string2; + int _fieldE4; +public: + CGondolierMixer(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CGondolierMixer"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_GONDOLIER_MIXER_H */ diff --git a/engines/titanic/game/lemon_dispensor.cpp b/engines/titanic/game/lemon_dispensor.cpp index 3cf7cc9525..b13b6d8f0b 100644 --- a/engines/titanic/game/lemon_dispensor.cpp +++ b/engines/titanic/game/lemon_dispensor.cpp @@ -24,12 +24,19 @@ namespace Titanic { +int CLemonDispensor::_v1; +int CLemonDispensor::_v2; +int CLemonDispensor::_v3; + CLemonDispensor::CLemonDispensor() : CBackground(), _fieldE0(0), _fieldE4(9), _fieldE8(15), _fieldEC(0) { } void CLemonDispensor::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_v2, indent); + file->writeNumberLine(_v3, indent); file->writeNumberLine(_fieldE0, indent); file->writeNumberLine(_fieldE4, indent); file->writeNumberLine(_fieldE8, indent); @@ -40,6 +47,9 @@ void CLemonDispensor::save(SimpleFile *file, int indent) const { void CLemonDispensor::load(SimpleFile *file) { file->readNumber(); + _v1 = file->readNumber(); + _v2 = file->readNumber(); + _v3 = file->readNumber(); _fieldE0 = file->readNumber(); _fieldE4 = file->readNumber(); _fieldE8 = file->readNumber(); diff --git a/engines/titanic/game/lemon_dispensor.h b/engines/titanic/game/lemon_dispensor.h index 7f3164f192..c2c76eac6a 100644 --- a/engines/titanic/game/lemon_dispensor.h +++ b/engines/titanic/game/lemon_dispensor.h @@ -28,7 +28,11 @@ namespace Titanic { class CLemonDispensor : public CBackground { -public: +private: + static int _v1; + static int _v2; + static int _v3; + int _fieldE0; int _fieldE4; int _fieldE8; diff --git a/engines/titanic/game/maitred/maitred_arm_holder.cpp b/engines/titanic/game/maitred/maitred_arm_holder.cpp new file mode 100644 index 0000000000..b6fc494441 --- /dev/null +++ b/engines/titanic/game/maitred/maitred_arm_holder.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/maitred/maitred_arm_holder.h" + +namespace Titanic { + +void CMaitreDArmHolder::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CDropTarget::save(file, indent); +} + +void CMaitreDArmHolder::load(SimpleFile *file) { + file->readNumber(); + CDropTarget::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/maitred/maitred_arm_holder.h b/engines/titanic/game/maitred/maitred_arm_holder.h new file mode 100644 index 0000000000..b838109fa3 --- /dev/null +++ b/engines/titanic/game/maitred/maitred_arm_holder.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_MAITRED_ARM_HOLDER_H +#define TITANIC_MAITRED_ARM_HOLDER_H + +#include "titanic/core/drop_target.h" + +namespace Titanic { + +class CMaitreDArmHolder : public CDropTarget { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMaitreDArmHolder"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MAITRED_ARM_HOLDER_H */ diff --git a/engines/titanic/game/maitred/maitred_body.cpp b/engines/titanic/game/maitred/maitred_body.cpp new file mode 100644 index 0000000000..4cdd5899de --- /dev/null +++ b/engines/titanic/game/maitred/maitred_body.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/maitred/maitred_legs.h" + +namespace Titanic { + +void CMaitreDLegs::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldC8, indent); + CMaitreDProdReceptor::save(file, indent); +} + +void CMaitreDLegs::load(SimpleFile *file) { + file->readNumber(); + _fieldC8 = file->readNumber(); + CMaitreDProdReceptor::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/maitred/maitred_body.h b/engines/titanic/game/maitred/maitred_body.h new file mode 100644 index 0000000000..29e528b1f6 --- /dev/null +++ b/engines/titanic/game/maitred/maitred_body.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_MAITRED_BODY_H +#define TITANIC_MAITRED_BODY_H + +#include "titanic/game/maitred/maitred_prod_receptor.h" + +namespace Titanic { + +class CMaitreDBody : public CMaitreDProdReceptor { +private: + int _fieldC8; +public: + CMaitreDBody() : CMaitreDProdReceptor(), _fieldC8(1) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMaitreDBody"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MAITRED_BODY_H */ diff --git a/engines/titanic/game/maitred/maitred_legs.cpp b/engines/titanic/game/maitred/maitred_legs.cpp new file mode 100644 index 0000000000..ce7054e057 --- /dev/null +++ b/engines/titanic/game/maitred/maitred_legs.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/maitred/maitred_body.h" + +namespace Titanic { + +void CMaitreDBody::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldC8, indent); + CMaitreDProdReceptor::save(file, indent); +} + +void CMaitreDBody::load(SimpleFile *file) { + file->readNumber(); + _fieldC8 = file->readNumber(); + CMaitreDProdReceptor::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/maitred/maitred_legs.h b/engines/titanic/game/maitred/maitred_legs.h new file mode 100644 index 0000000000..e3ac93c870 --- /dev/null +++ b/engines/titanic/game/maitred/maitred_legs.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_MAITRED_LEGS_H +#define TITANIC_MAITRED_LEGS_H + +#include "titanic/game/maitred/maitred_prod_receptor.h" + +namespace Titanic { + +class CMaitreDLegs : public CMaitreDProdReceptor { +private: + int _fieldC8; +public: + CMaitreDLegs() : CMaitreDProdReceptor(), _fieldC8(1) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMaitreDLegs"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MAITRED_LEGS_H */ diff --git a/engines/titanic/game/maitred/maitred_prod_receptor.cpp b/engines/titanic/game/maitred/maitred_prod_receptor.cpp new file mode 100644 index 0000000000..6e6143c510 --- /dev/null +++ b/engines/titanic/game/maitred/maitred_prod_receptor.cpp @@ -0,0 +1,45 @@ +/* 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 "titanic/game/maitred/maitred_prod_receptor.h" + +namespace Titanic { + +void CMaitreDProdReceptor::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_fieldC4, indent); + + CGameObject::save(file, indent); +} + +void CMaitreDProdReceptor::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _fieldC4 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/maitred/maitred_prod_receptor.h b/engines/titanic/game/maitred/maitred_prod_receptor.h new file mode 100644 index 0000000000..130bc547b2 --- /dev/null +++ b/engines/titanic/game/maitred/maitred_prod_receptor.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_MAITRED_PROD_RECEPTOR_H +#define TITANIC_MAITRED_PROD_RECEPTOR_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CMaitreDProdReceptor : public CGameObject { +protected: + int _fieldBC; + int _fieldC0; + int _fieldC4; +public: + CMaitreDProdReceptor() : CGameObject(), + _fieldBC(0), _fieldC0(0), _fieldC4(1) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CMaitreDProdReceptor"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MAITRED_PROD_RECEPTOR_H */ diff --git a/engines/titanic/game/maitred_arm_holder.cpp b/engines/titanic/game/maitred_arm_holder.cpp deleted file mode 100644 index 81ad43556b..0000000000 --- a/engines/titanic/game/maitred_arm_holder.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 "titanic/game/maitred_arm_holder.h" - -namespace Titanic { - -void CMaitreDArmHolder::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - CDropTarget::save(file, indent); -} - -void CMaitreDArmHolder::load(SimpleFile *file) { - file->readNumber(); - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/maitred_arm_holder.h b/engines/titanic/game/maitred_arm_holder.h deleted file mode 100644 index b838109fa3..0000000000 --- a/engines/titanic/game/maitred_arm_holder.h +++ /dev/null @@ -1,50 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_MAITRED_ARM_HOLDER_H -#define TITANIC_MAITRED_ARM_HOLDER_H - -#include "titanic/core/drop_target.h" - -namespace Titanic { - -class CMaitreDArmHolder : public CDropTarget { -public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMaitreDArmHolder"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_MAITRED_ARM_HOLDER_H */ diff --git a/engines/titanic/game/pickup/pick_up_hose.cpp b/engines/titanic/game/pickup/pick_up_hose.cpp index 35ac7f8049..e6902cb6b3 100644 --- a/engines/titanic/game/pickup/pick_up_hose.cpp +++ b/engines/titanic/game/pickup/pick_up_hose.cpp @@ -24,15 +24,21 @@ namespace Titanic { +int CPickUpHose::_v1; + void CPickUpHose::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); file->writeQuotedLine(_string1, indent); + file->writeNumberLine(_v1, indent); + CPickUp::save(file, indent); } void CPickUpHose::load(SimpleFile *file) { file->readNumber(); _string1 = file->readString(); + _v1 = file->readNumber(); + CPickUp::load(file); } diff --git a/engines/titanic/game/pickup/pick_up_hose.h b/engines/titanic/game/pickup/pick_up_hose.h index 56596c50fc..13d5810177 100644 --- a/engines/titanic/game/pickup/pick_up_hose.h +++ b/engines/titanic/game/pickup/pick_up_hose.h @@ -29,6 +29,8 @@ namespace Titanic { class CPickUpHose : public CPickUp { private: + static int _v1; + CString _string1; public: /** diff --git a/engines/titanic/game/service_elevator_door.cpp b/engines/titanic/game/service_elevator_door.cpp deleted file mode 100644 index 717b61dc72..0000000000 --- a/engines/titanic/game/service_elevator_door.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* 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 "titanic/game/service_elevator_door.h" - -namespace Titanic { - -CServiceElevatorDoor::CServiceElevatorDoor() : CDoorAutoSoundEvent() { - _string1 = "z#31.wav"; - _string2 = "z#32.wav"; -} - -void CServiceElevatorDoor::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeQuotedLine(_string2, indent); - file->writeQuotedLine(_string1, indent); - - CDoorAutoSoundEvent::save(file, indent); -} - -void CServiceElevatorDoor::load(SimpleFile *file) { - file->readNumber(); - _string2 = file->readString(); - _string1 = file->readString(); - - CDoorAutoSoundEvent::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/service_elevator_door.h b/engines/titanic/game/service_elevator_door.h deleted file mode 100644 index 52465d842d..0000000000 --- a/engines/titanic/game/service_elevator_door.h +++ /dev/null @@ -1,52 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_SERVICE_ELEVATOR_DOOR_H -#define TITANIC_SERVICE_ELEVATOR_DOOR_H - -#include "titanic/sound/door_auto_sound_event.h" - -namespace Titanic { - -class CServiceElevatorDoor : public CDoorAutoSoundEvent { -public: - CServiceElevatorDoor(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CServiceElevatorDoor"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_SERVICE_ELEVATOR_DOOR_H */ diff --git a/engines/titanic/game/speech_dispensor.cpp b/engines/titanic/game/speech_dispensor.cpp index d8fc66b07a..72873391db 100644 --- a/engines/titanic/game/speech_dispensor.cpp +++ b/engines/titanic/game/speech_dispensor.cpp @@ -26,11 +26,27 @@ namespace Titanic { void CSpeechDispensor::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldEC, indent); + file->writeNumberLine(_fieldF0, indent); + file->writeNumberLine(_fieldF4, indent); + file->writeNumberLine(_fieldF8, indent); + file->writeNumberLine(_fieldFC, indent); + CBackground::save(file, indent); } void CSpeechDispensor::load(SimpleFile *file) { file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldEC = file->readNumber(); + _fieldF0 = file->readNumber(); + _fieldF4 = file->readNumber(); + _fieldF8 = file->readNumber(); + _fieldFC = file->readNumber(); + CBackground::load(file); } diff --git a/engines/titanic/game/speech_dispensor.h b/engines/titanic/game/speech_dispensor.h index 857750dc95..19f31fcf68 100644 --- a/engines/titanic/game/speech_dispensor.h +++ b/engines/titanic/game/speech_dispensor.h @@ -28,6 +28,15 @@ namespace Titanic { class CSpeechDispensor : public CBackground { +private: + int _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; + int _fieldF0; + int _fieldF4; + int _fieldF8; + int _fieldFC; public: /** * Return the class name diff --git a/engines/titanic/messages/auto_sound_event.cpp b/engines/titanic/messages/auto_sound_event.cpp new file mode 100644 index 0000000000..006762c49b --- /dev/null +++ b/engines/titanic/messages/auto_sound_event.cpp @@ -0,0 +1,46 @@ +/* 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 "titanic/messages/auto_sound_event.h" + +namespace Titanic { + +CAutoSoundEvent::CAutoSoundEvent() : CGameObject(), _value1(0), _value2(70) { +} + +void CAutoSoundEvent::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value1, indent); + file->writeNumberLine(_value2, indent); + + CGameObject::save(file, indent); +} + +void CAutoSoundEvent::load(SimpleFile *file) { + file->readNumber(); + _value1 = file->readNumber(); + _value2 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/auto_sound_event.h b/engines/titanic/messages/auto_sound_event.h new file mode 100644 index 0000000000..cb5bfee788 --- /dev/null +++ b/engines/titanic/messages/auto_sound_event.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_AUTO_SOUND_EVENT_H +#define TITANIC_AUTO_SOUND_EVENT_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CAutoSoundEvent : public CGameObject { +public: + int _value1; + int _value2; +public: + CAutoSoundEvent(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CAutoSoundEvent"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/messages/bilge_auto_sound_event.cpp b/engines/titanic/messages/bilge_auto_sound_event.cpp new file mode 100644 index 0000000000..7bc91da0bc --- /dev/null +++ b/engines/titanic/messages/bilge_auto_sound_event.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/messages/bilge_auto_sound_event.h" + +namespace Titanic { + +void CBilgeAutoSoundEvent::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CAutoSoundEvent::save(file, indent); +} + +void CBilgeAutoSoundEvent::load(SimpleFile *file) { + file->readNumber(); + CAutoSoundEvent::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/bilge_auto_sound_event.h b/engines/titanic/messages/bilge_auto_sound_event.h new file mode 100644 index 0000000000..94f38d3e65 --- /dev/null +++ b/engines/titanic/messages/bilge_auto_sound_event.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_BILGE_AUTO_SOUND_EVENT_H +#define TITANIC_BILGE_AUTO_SOUND_EVENT_H + +#include "titanic/messages/auto_sound_event.h" + +namespace Titanic { + +class CBilgeAutoSoundEvent : public CAutoSoundEvent { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBilgeAutoSoundEvent"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BILGE_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/messages/bilge_dispensor_event.cpp b/engines/titanic/messages/bilge_dispensor_event.cpp new file mode 100644 index 0000000000..9252d123e9 --- /dev/null +++ b/engines/titanic/messages/bilge_dispensor_event.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/messages/bilge_dispensor_event.h" + +namespace Titanic { + +void CBilgeDispensorEvent::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CAutoSoundEvent::save(file, indent); +} + +void CBilgeDispensorEvent::load(SimpleFile *file) { + file->readNumber(); + CAutoSoundEvent::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/bilge_dispensor_event.h b/engines/titanic/messages/bilge_dispensor_event.h new file mode 100644 index 0000000000..8308d474b2 --- /dev/null +++ b/engines/titanic/messages/bilge_dispensor_event.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_BILGE_DISPENSOR_EVENT_H +#define TITANIC_BILGE_DISPENSOR_EVENT_H + +#include "titanic/messages/auto_sound_event.h" + +namespace Titanic { + +class CBilgeDispensorEvent : public CAutoSoundEvent { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CBilgeDispensorEvent"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BILGE_DISPENSOR_EVENT_H */ diff --git a/engines/titanic/messages/door_auto_sound_event.cpp b/engines/titanic/messages/door_auto_sound_event.cpp new file mode 100644 index 0000000000..ff9101f506 --- /dev/null +++ b/engines/titanic/messages/door_auto_sound_event.cpp @@ -0,0 +1,47 @@ +/* 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 "titanic/messages/door_auto_sound_event.h" + +namespace Titanic { + +void CDoorAutoSoundEvent::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + file->writeNumberLine(_fieldDC, indent); + file->writeNumberLine(_fieldE0, indent); + + CAutoSoundEvent::save(file, indent); +} + +void CDoorAutoSoundEvent::load(SimpleFile *file) { + file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + _fieldDC = file->readNumber(); + _fieldE0 = file->readNumber(); + + CAutoSoundEvent::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/door_auto_sound_event.h b/engines/titanic/messages/door_auto_sound_event.h new file mode 100644 index 0000000000..ef417560dc --- /dev/null +++ b/engines/titanic/messages/door_auto_sound_event.h @@ -0,0 +1,59 @@ +/* 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. + * + */ + +#ifndef TITANIC_DOOR_AUTO_SOUND_EVENT_H +#define TITANIC_DOOR_AUTO_SOUND_EVENT_H + +#include "titanic/messages/auto_sound_event.h" + +namespace Titanic { + +class CDoorAutoSoundEvent : public CAutoSoundEvent { +public: + CString _string1; + CString _string2; + int _fieldDC; + int _fieldE0; +public: + CDoorAutoSoundEvent::CDoorAutoSoundEvent() : CAutoSoundEvent(), + _string1("z#44.wav"), _string2("z#43.wav"), _fieldDC(25), _fieldE0(25) { + } + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CDoorAutoSoundEvent"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DOOR_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/messages/service_elevator_door.cpp b/engines/titanic/messages/service_elevator_door.cpp new file mode 100644 index 0000000000..e771f14484 --- /dev/null +++ b/engines/titanic/messages/service_elevator_door.cpp @@ -0,0 +1,48 @@ +/* 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 "titanic/messages/service_elevator_door.h" + +namespace Titanic { + +CServiceElevatorDoor::CServiceElevatorDoor() : CDoorAutoSoundEvent() { + _string1 = "z#31.wav"; + _string2 = "z#32.wav"; +} + +void CServiceElevatorDoor::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeQuotedLine(_string2, indent); + file->writeQuotedLine(_string1, indent); + + CDoorAutoSoundEvent::save(file, indent); +} + +void CServiceElevatorDoor::load(SimpleFile *file) { + file->readNumber(); + _string2 = file->readString(); + _string1 = file->readString(); + + CDoorAutoSoundEvent::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/service_elevator_door.h b/engines/titanic/messages/service_elevator_door.h new file mode 100644 index 0000000000..a3a8388405 --- /dev/null +++ b/engines/titanic/messages/service_elevator_door.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_SERVICE_ELEVATOR_DOOR_H +#define TITANIC_SERVICE_ELEVATOR_DOOR_H + +#include "titanic/messages/door_auto_sound_event.h" + +namespace Titanic { + +class CServiceElevatorDoor : public CDoorAutoSoundEvent { +public: + CServiceElevatorDoor(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CServiceElevatorDoor"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SERVICE_ELEVATOR_DOOR_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 975d5aa08c..191b61bcd7 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -38,6 +38,8 @@ MODULE_OBJS := \ carry/liftbot_head.o \ carry/long_stick.o \ carry/magazine.o \ + carry/maitred_left_arm.o \ + carry/maitred_right_arm.o \ carry/mouth.o \ carry/napkin.o \ carry/nose.o \ @@ -93,6 +95,8 @@ MODULE_OBJS := \ game/bridge_door.o \ game/bridge_view.o \ game/broken_pell_base.o \ + game/broken_pellerator.o \ + game/broken_pellerator_froz.o \ game/call_pellerator.o \ game/cage.o \ game/captains_wheel.o \ @@ -138,6 +142,7 @@ MODULE_OBJS := \ game/get_lift_eye2.o \ game/glass_smasher.o \ game/gondolier_base.o \ + game/gondolier_mixer.o \ game/hammer_clip.o \ game/head_slot.o \ game/head_smash_event.o \ @@ -151,7 +156,6 @@ MODULE_OBJS := \ game/little_lift_button.o \ game/long_stick_dispenser.o \ game/mail_man.o \ - game/maitred_arm_holder.o \ game/missiveomat.o \ game/missiveomat_button.o \ game/movie_tester.o \ @@ -186,7 +190,6 @@ MODULE_OBJS := \ game/season_background.o \ game/season_barrel.o \ game/seasonal_adjustment.o \ - game/service_elevator_door.o \ game/service_elevator_window.o \ game/ship_setting.o \ game/ship_setting_button.o \ @@ -211,6 +214,10 @@ MODULE_OBJS := \ game/wheel_hotspot.o \ game/wheel_spin.o \ game/wheel_spin_horn.o \ + game/maitred/maitred_arm_holder.o \ + game/maitred/maitred_body.o \ + game/maitred/maitred_legs.o \ + game/maitred/maitred_prod_receptor.o \ game/parrot/parrot_lobby_controller.o \ game/parrot/parrot_lobby_link_updater.o \ game/parrot/parrot_lobby_object.o \ @@ -304,7 +311,12 @@ MODULE_OBJS := \ gfx/toggle_button.o \ gfx/toggle_switch.o \ gfx/volume_control.o \ + messages/auto_sound_event.o \ + messages/bilge_auto_sound_event.o \ + messages/bilge_dispensor_event.o \ + messages/door_auto_sound_event.o \ messages/messages.o \ + messages/service_elevator_door.o \ moves/enter_bomb_room.o \ moves/enter_bridge.o \ moves/enter_exit_first_class_state.o \ @@ -344,19 +356,18 @@ MODULE_OBJS := \ npcs/true_talk_npc.o \ sound/auto_music_player.o \ sound/auto_music_player_base.o \ - sound/auto_sound_event.o \ sound/auto_sound_player.o \ sound/auto_sound_player_adsr.o \ sound/background_sound_maker.o \ - sound/bilge_auto_sound_event.o \ sound/bird_song.o \ - sound/door_auto_sound_event.o \ + sound/dome_from_top_of_well.o \ sound/enter_view_toggles_other_music.o \ sound/gondolier_song.o \ sound/music_player.o \ sound/node_auto_sound_player.o \ sound/restricted_auto_music_player.o \ sound/room_auto_sound_player.o \ + sound/season_noises.o \ sound/seasonal_music_player.o \ sound/titania_speech.o \ sound/trigger_auto_music_player.o \ diff --git a/engines/titanic/sound/auto_sound_event.cpp b/engines/titanic/sound/auto_sound_event.cpp deleted file mode 100644 index 673f35b210..0000000000 --- a/engines/titanic/sound/auto_sound_event.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* 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 "titanic/sound/auto_sound_event.h" - -namespace Titanic { - -CAutoSoundEvent::CAutoSoundEvent() : CGameObject(), _value1(0), _value2(70) { -} - -void CAutoSoundEvent::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeNumberLine(_value1, indent); - file->writeNumberLine(_value2, indent); - - CGameObject::save(file, indent); -} - -void CAutoSoundEvent::load(SimpleFile *file) { - file->readNumber(); - _value1 = file->readNumber(); - _value2 = file->readNumber(); - - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/sound/auto_sound_event.h b/engines/titanic/sound/auto_sound_event.h deleted file mode 100644 index cb5bfee788..0000000000 --- a/engines/titanic/sound/auto_sound_event.h +++ /dev/null @@ -1,55 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_AUTO_SOUND_EVENT_H -#define TITANIC_AUTO_SOUND_EVENT_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CAutoSoundEvent : public CGameObject { -public: - int _value1; - int _value2; -public: - CAutoSoundEvent(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CAutoSoundEvent"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/sound/bilge_auto_sound_event.cpp b/engines/titanic/sound/bilge_auto_sound_event.cpp deleted file mode 100644 index 2446a5df06..0000000000 --- a/engines/titanic/sound/bilge_auto_sound_event.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 "titanic/sound/bilge_auto_sound_event.h" - -namespace Titanic { - -void CBilgeAutoSoundEvent::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - CAutoSoundEvent::save(file, indent); -} - -void CBilgeAutoSoundEvent::load(SimpleFile *file) { - file->readNumber(); - CAutoSoundEvent::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/sound/bilge_auto_sound_event.h b/engines/titanic/sound/bilge_auto_sound_event.h deleted file mode 100644 index 96572839ae..0000000000 --- a/engines/titanic/sound/bilge_auto_sound_event.h +++ /dev/null @@ -1,50 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_BILGE_AUTO_SOUND_EVENT_H -#define TITANIC_BILGE_AUTO_SOUND_EVENT_H - -#include "titanic/sound/auto_sound_event.h" - -namespace Titanic { - -class CBilgeAutoSoundEvent : public CAutoSoundEvent { -public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBilgeAutoSoundEvent"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_BILGE_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/sound/dome_from_top_of_well.cpp b/engines/titanic/sound/dome_from_top_of_well.cpp new file mode 100644 index 0000000000..6e31937af0 --- /dev/null +++ b/engines/titanic/sound/dome_from_top_of_well.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/sound/dome_from_top_of_well.h" + +namespace Titanic { + +void CDomeFromTopOfWell::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CViewAutoSoundPlayer::save(file, indent); +} + +void CDomeFromTopOfWell::load(SimpleFile *file) { + file->readNumber(); + CViewAutoSoundPlayer::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/sound/dome_from_top_of_well.h b/engines/titanic/sound/dome_from_top_of_well.h new file mode 100644 index 0000000000..faea805b1a --- /dev/null +++ b/engines/titanic/sound/dome_from_top_of_well.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_DOME_FROM_TOP_OF_WELL_H +#define TITANIC_DOME_FROM_TOP_OF_WELL_H + +#include "titanic/sound/view_auto_sound_player.h" + +namespace Titanic { + +class CDomeFromTopOfWell : public CViewAutoSoundPlayer { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CDomeFromTopOfWell"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DOME_FROM_TOP_OF_WELL_H */ diff --git a/engines/titanic/sound/door_auto_sound_event.cpp b/engines/titanic/sound/door_auto_sound_event.cpp deleted file mode 100644 index f0e77fce91..0000000000 --- a/engines/titanic/sound/door_auto_sound_event.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* 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 "titanic/sound/door_auto_sound_event.h" - -namespace Titanic { - -void CDoorAutoSoundEvent::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeQuotedLine(_string1, indent); - file->writeQuotedLine(_string2, indent); - file->writeNumberLine(_fieldDC, indent); - file->writeNumberLine(_fieldE0, indent); - - CAutoSoundEvent::save(file, indent); -} - -void CDoorAutoSoundEvent::load(SimpleFile *file) { - file->readNumber(); - _string1 = file->readString(); - _string2 = file->readString(); - _fieldDC = file->readNumber(); - _fieldE0 = file->readNumber(); - - CAutoSoundEvent::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/sound/door_auto_sound_event.h b/engines/titanic/sound/door_auto_sound_event.h deleted file mode 100644 index 017912dc36..0000000000 --- a/engines/titanic/sound/door_auto_sound_event.h +++ /dev/null @@ -1,59 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_DOOR_AUTO_SOUND_EVENT_H -#define TITANIC_DOOR_AUTO_SOUND_EVENT_H - -#include "titanic/sound/auto_sound_event.h" - -namespace Titanic { - -class CDoorAutoSoundEvent : public CAutoSoundEvent { -public: - CString _string1; - CString _string2; - int _fieldDC; - int _fieldE0; -public: - CDoorAutoSoundEvent::CDoorAutoSoundEvent() : CAutoSoundEvent(), - _string1("z#44.wav"), _string2("z#43.wav"), _fieldDC(25), _fieldE0(25) { - } - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CDoorAutoSoundEvent"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_DOOR_AUTO_SOUND_EVENT_H */ diff --git a/engines/titanic/sound/season_noises.cpp b/engines/titanic/sound/season_noises.cpp new file mode 100644 index 0000000000..beacdefffa --- /dev/null +++ b/engines/titanic/sound/season_noises.cpp @@ -0,0 +1,53 @@ +/* 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 "titanic/sound/season_noises.h" + +namespace Titanic { + +CSeasonNoises::CSeasonNoises() : CViewAutoSoundPlayer(), _fieldF0(0), + _string2("NULL"), _string3("NULL"), _string4("NULL"), _string5("NULL") { +} + +void CSeasonNoises::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldF0, indent); + file->writeQuotedLine(_string2, indent); + file->writeQuotedLine(_string3, indent); + file->writeQuotedLine(_string4, indent); + file->writeQuotedLine(_string5, indent); + + CViewAutoSoundPlayer::save(file, indent); +} + +void CSeasonNoises::load(SimpleFile *file) { + file->readNumber(); + _fieldF0 = file->readNumber(); + _string2 = file->readString(); + _string3 = file->readString(); + _string4 = file->readString(); + _string5 = file->readString(); + + CViewAutoSoundPlayer::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/sound/season_noises.h b/engines/titanic/sound/season_noises.h new file mode 100644 index 0000000000..def709c536 --- /dev/null +++ b/engines/titanic/sound/season_noises.h @@ -0,0 +1,58 @@ +/* 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. + * + */ + +#ifndef TITANIC_SEASON_NOISES_H +#define TITANIC_SEASON_NOISES_H + +#include "titanic/sound/view_auto_sound_player.h" + +namespace Titanic { + +class CSeasonNoises : public CViewAutoSoundPlayer { +private: + int _fieldF0; + CString _string2; + CString _string3; + CString _string4; + CString _string5; +public: + CSeasonNoises(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSeasonNoises"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SEASON_NOISES_H */ -- cgit v1.2.3 From e688850e932f0c8be6d10a73fe416c90799733b0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 2 Mar 2016 23:40:06 -0500 Subject: TITANIC: Implemented more saveable classes --- engines/titanic/core/saveable_object.cpp | 86 +++++++++++++++++++--- engines/titanic/game/gondolier/gondolier_base.cpp | 70 ++++++++++++++++++ engines/titanic/game/gondolier/gondolier_base.h | 61 +++++++++++++++ engines/titanic/game/gondolier/gondolier_chest.cpp | 37 ++++++++++ engines/titanic/game/gondolier/gondolier_chest.h | 50 +++++++++++++ engines/titanic/game/gondolier/gondolier_face.cpp | 39 ++++++++++ engines/titanic/game/gondolier/gondolier_face.h | 54 ++++++++++++++ engines/titanic/game/gondolier/gondolier_mixer.cpp | 59 +++++++++++++++ engines/titanic/game/gondolier/gondolier_mixer.h | 60 +++++++++++++++ .../titanic/game/gondolier/gondolier_slider.cpp | 82 +++++++++++++++++++++ engines/titanic/game/gondolier/gondolier_slider.h | 71 ++++++++++++++++++ engines/titanic/game/gondolier_base.cpp | 70 ------------------ engines/titanic/game/gondolier_base.h | 61 --------------- engines/titanic/game/gondolier_mixer.cpp | 59 --------------- engines/titanic/game/gondolier_mixer.h | 60 --------------- engines/titanic/game/music_system_lock.cpp | 2 +- engines/titanic/game/pet_graphic.cpp | 37 ---------- engines/titanic/game/pet_graphic.h | 50 ------------- engines/titanic/game/pet_graphic2.cpp | 37 ---------- engines/titanic/game/pet_graphic2.h | 50 ------------- engines/titanic/game/phonograph_lid.cpp | 2 + engines/titanic/game/phonograph_lid.h | 4 + engines/titanic/gfx/icon_nav_butt.cpp | 37 ++++++++++ engines/titanic/gfx/icon_nav_butt.h | 50 +++++++++++++ engines/titanic/gfx/icon_nav_image.cpp | 37 ++++++++++ engines/titanic/gfx/icon_nav_image.h | 50 +++++++++++++ engines/titanic/gfx/icon_nav_receive.cpp | 37 ++++++++++ engines/titanic/gfx/icon_nav_receive.h | 50 +++++++++++++ engines/titanic/gfx/icon_nav_send.cpp | 37 ++++++++++ engines/titanic/gfx/icon_nav_send.h | 50 +++++++++++++ engines/titanic/gfx/pet_drag_chev.cpp | 37 ++++++++++ engines/titanic/gfx/pet_drag_chev.h | 50 +++++++++++++ engines/titanic/gfx/pet_graphic.cpp | 37 ++++++++++ engines/titanic/gfx/pet_graphic.h | 50 +++++++++++++ engines/titanic/gfx/pet_graphic2.cpp | 37 ++++++++++ engines/titanic/gfx/pet_graphic2.h | 50 +++++++++++++ engines/titanic/gfx/pet_leaf.cpp | 37 ++++++++++ engines/titanic/gfx/pet_leaf.h | 50 +++++++++++++ engines/titanic/gfx/pet_pannel1.cpp | 37 ++++++++++ engines/titanic/gfx/pet_pannel1.h | 50 +++++++++++++ engines/titanic/gfx/pet_pannel2.cpp | 37 ++++++++++ engines/titanic/gfx/pet_pannel2.h | 50 +++++++++++++ engines/titanic/gfx/pet_pannel3.cpp | 37 ++++++++++ engines/titanic/gfx/pet_pannel3.h | 50 +++++++++++++ engines/titanic/gfx/sgt_selector.cpp | 37 ++++++++++ engines/titanic/gfx/sgt_selector.h | 50 +++++++++++++ engines/titanic/gfx/text_down.cpp | 37 ++++++++++ engines/titanic/gfx/text_down.h | 50 +++++++++++++ engines/titanic/gfx/text_skrew.cpp | 37 ++++++++++ engines/titanic/gfx/text_skrew.h | 50 +++++++++++++ engines/titanic/gfx/text_up.cpp | 37 ++++++++++ engines/titanic/gfx/text_up.h | 50 +++++++++++++ engines/titanic/module.mk | 25 ++++++- engines/titanic/moves/restaurant_pan_handler.cpp | 5 +- engines/titanic/moves/restaurant_pan_handler.h | 4 +- engines/titanic/moves/scraliontis_table.cpp | 51 +++++++++++++ engines/titanic/moves/scraliontis_table.h | 57 ++++++++++++++ 57 files changed, 2103 insertions(+), 445 deletions(-) create mode 100644 engines/titanic/game/gondolier/gondolier_base.cpp create mode 100644 engines/titanic/game/gondolier/gondolier_base.h create mode 100644 engines/titanic/game/gondolier/gondolier_chest.cpp create mode 100644 engines/titanic/game/gondolier/gondolier_chest.h create mode 100644 engines/titanic/game/gondolier/gondolier_face.cpp create mode 100644 engines/titanic/game/gondolier/gondolier_face.h create mode 100644 engines/titanic/game/gondolier/gondolier_mixer.cpp create mode 100644 engines/titanic/game/gondolier/gondolier_mixer.h create mode 100644 engines/titanic/game/gondolier/gondolier_slider.cpp create mode 100644 engines/titanic/game/gondolier/gondolier_slider.h delete mode 100644 engines/titanic/game/gondolier_base.cpp delete mode 100644 engines/titanic/game/gondolier_base.h delete mode 100644 engines/titanic/game/gondolier_mixer.cpp delete mode 100644 engines/titanic/game/gondolier_mixer.h delete mode 100644 engines/titanic/game/pet_graphic.cpp delete mode 100644 engines/titanic/game/pet_graphic.h delete mode 100644 engines/titanic/game/pet_graphic2.cpp delete mode 100644 engines/titanic/game/pet_graphic2.h create mode 100644 engines/titanic/gfx/icon_nav_butt.cpp create mode 100644 engines/titanic/gfx/icon_nav_butt.h create mode 100644 engines/titanic/gfx/icon_nav_image.cpp create mode 100644 engines/titanic/gfx/icon_nav_image.h create mode 100644 engines/titanic/gfx/icon_nav_receive.cpp create mode 100644 engines/titanic/gfx/icon_nav_receive.h create mode 100644 engines/titanic/gfx/icon_nav_send.cpp create mode 100644 engines/titanic/gfx/icon_nav_send.h create mode 100644 engines/titanic/gfx/pet_drag_chev.cpp create mode 100644 engines/titanic/gfx/pet_drag_chev.h create mode 100644 engines/titanic/gfx/pet_graphic.cpp create mode 100644 engines/titanic/gfx/pet_graphic.h create mode 100644 engines/titanic/gfx/pet_graphic2.cpp create mode 100644 engines/titanic/gfx/pet_graphic2.h create mode 100644 engines/titanic/gfx/pet_leaf.cpp create mode 100644 engines/titanic/gfx/pet_leaf.h create mode 100644 engines/titanic/gfx/pet_pannel1.cpp create mode 100644 engines/titanic/gfx/pet_pannel1.h create mode 100644 engines/titanic/gfx/pet_pannel2.cpp create mode 100644 engines/titanic/gfx/pet_pannel2.h create mode 100644 engines/titanic/gfx/pet_pannel3.cpp create mode 100644 engines/titanic/gfx/pet_pannel3.h create mode 100644 engines/titanic/gfx/sgt_selector.cpp create mode 100644 engines/titanic/gfx/sgt_selector.h create mode 100644 engines/titanic/gfx/text_down.cpp create mode 100644 engines/titanic/gfx/text_down.h create mode 100644 engines/titanic/gfx/text_skrew.cpp create mode 100644 engines/titanic/gfx/text_skrew.h create mode 100644 engines/titanic/gfx/text_up.cpp create mode 100644 engines/titanic/gfx/text_up.h create mode 100644 engines/titanic/moves/scraliontis_table.cpp create mode 100644 engines/titanic/moves/scraliontis_table.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 7a41230214..8966ea6e67 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -61,6 +61,7 @@ #include "titanic/core/saveable_object.h" #include "titanic/core/background.h" #include "titanic/core/click_responder.h" +#include "titanic/core/dont_save_file_item.h" #include "titanic/core/drop_target.h" #include "titanic/core/file_item.h" #include "titanic/core/link_item.h" @@ -69,6 +70,7 @@ #include "titanic/core/movie_clip.h" #include "titanic/core/multi_drop_target.h" #include "titanic/core/node_item.h" +#include "titanic/core/pet_control.h" #include "titanic/core/project_item.h" #include "titanic/core/saveable_object.h" #include "titanic/core/static_image.h" @@ -135,8 +137,6 @@ #include "titanic/game/games_console.h" #include "titanic/game/get_lift_eye2.h" #include "titanic/game/glass_smasher.h" -#include "titanic/game/gondolier_base.h" -#include "titanic/game/gondolier_mixer.h" #include "titanic/game/hammer_clip.h" #include "titanic/game/hammer_dispensor.h" #include "titanic/game/hammer_dispensor_button.h" @@ -163,9 +163,8 @@ #include "titanic/game/null_port_hole.h" #include "titanic/game/nut_replacer.h" #include "titanic/game/pet_disabler.h" -#include "titanic/game/pet_graphic.h" -#include "titanic/game/pet_graphic2.h" #include "titanic/game/phonograph.h" +#include "titanic/game/phonograph_lid.h" #include "titanic/game/play_music_button.h" #include "titanic/game/play_on_act.h" #include "titanic/game/port_hole.h" @@ -201,6 +200,11 @@ #include "titanic/game/wheel_hotspot.h" #include "titanic/game/wheel_spin.h" #include "titanic/game/wheel_spin_horn.h" +#include "titanic/game/gondolier/gondolier_base.h" +#include "titanic/game/gondolier/gondolier_chest.h" +#include "titanic/game/gondolier/gondolier_face.h" +#include "titanic/game/gondolier/gondolier_mixer.h" +#include "titanic/game/gondolier/gondolier_slider.h" #include "titanic/game/maitred/maitred_arm_holder.h" #include "titanic/game/maitred/maitred_body.h" #include "titanic/game/maitred/maitred_legs.h" @@ -277,9 +281,13 @@ #include "titanic/gfx/helmet_on_off.h" #include "titanic/gfx/home_photo.h" #include "titanic/gfx/icon_nav_action.h" +#include "titanic/gfx/icon_nav_butt.h" #include "titanic/gfx/icon_nav_down.h" +#include "titanic/gfx/icon_nav_image.h" #include "titanic/gfx/icon_nav_left.h" +#include "titanic/gfx/icon_nav_receive.h" #include "titanic/gfx/icon_nav_right.h" +#include "titanic/gfx/icon_nav_send.h" #include "titanic/gfx/icon_nav_up.h" #include "titanic/gfx/keybrd_butt.h" #include "titanic/gfx/move_object_button.h" @@ -290,10 +298,18 @@ #include "titanic/gfx/music_switch_inversion.h" #include "titanic/gfx/music_switch_reverse.h" #include "titanic/gfx/music_voice_mute.h" +#include "titanic/gfx/pet_drag_chev.h" +#include "titanic/gfx/pet_graphic.h" +#include "titanic/gfx/pet_graphic2.h" +#include "titanic/gfx/pet_leaf.h" #include "titanic/gfx/pet_mode_off.h" #include "titanic/gfx/pet_mode_on.h" #include "titanic/gfx/pet_mode_panel.h" +#include "titanic/gfx/pet_pannel1.h" +#include "titanic/gfx/pet_pannel2.h" +#include "titanic/gfx/pet_pannel3.h" #include "titanic/gfx/send_to_succ.h" +#include "titanic/gfx/sgt_selector.h" #include "titanic/gfx/slider_button.h" #include "titanic/gfx/small_chev_left_off.h" #include "titanic/gfx/small_chev_left_on.h" @@ -302,6 +318,9 @@ #include "titanic/gfx/status_change_button.h" #include "titanic/gfx/st_button.h" #include "titanic/gfx/toggle_button.h" +#include "titanic/gfx/text_down.h" +#include "titanic/gfx/text_skrew.h" +#include "titanic/gfx/text_up.h" #include "titanic/gfx/toggle_switch.h" #include "titanic/gfx/volume_control.h" @@ -334,6 +353,7 @@ #include "titanic/moves/pan_from_pel.h" #include "titanic/moves/restaurant_pan_handler.h" #include "titanic/moves/restricted_move.h" +#include "titanic/moves/scraliontis_table.h" #include "titanic/moves/trip_down_canal.h" #include "titanic/npcs/barbot.h" @@ -383,6 +403,7 @@ DEFFN(CAuditoryCentre); DEFFN(CBowlEar); DEFFN(CBrain); DEFFN(CBridgePiece); +DEFFN(CCarry); DEFFN(CCarryParrot); DEFFN(CCentralCore); DEFFN(CChicken); @@ -419,6 +440,7 @@ DEFFN(CVisionCentre); DEFFN(CBackground); DEFFN(CClickResponder); +DEFFN(CDontSaveFileItem); DEFFN(CDropTarget); DEFFN(CFileItem); DEFFN(CFileListItem); @@ -428,6 +450,7 @@ DEFFN(CMovieClip); DEFFN(CMovieClipList); DEFFN(CMultiDropTarget); DEFFN(CNodeItem); +DEFFN(CPetControl); DEFFN(CProjectItem); DEFFN(CStaticImage); DEFFN(CTurnOnObject); @@ -492,8 +515,6 @@ DEFFN(CFloorIndicator); DEFFN(CGamesConsole); DEFFN(CGetLiftEye2); DEFFN(CGlassSmasher); -DEFFN(CGondolierBase); -DEFFN(CGondolierMixer); DEFFN(CHammerClip); DEFFN(CHammerDispensor); DEFFN(CHammerDispensorButton); @@ -520,9 +541,8 @@ DEFFN(CNoseHolder); DEFFN(CNullPortHole); DEFFN(CNutReplacer); DEFFN(CPetDisabler); -DEFFN(CPetGraphic); -DEFFN(CPetGraphic2); DEFFN(CPhonograph); +DEFFN(CPhonographLid); DEFFN(CPlayMusicButton); DEFFN(CPlayOnAct); DEFFN(CPortHole); @@ -558,6 +578,11 @@ DEFFN(CWheelButton); DEFFN(CWheelHotSpot); DEFFN(CWheelSpin); DEFFN(CWheelSpinHorn); +DEFFN(CGondolierBase); +DEFFN(CGondolierChest); +DEFFN(CGondolierFace); +DEFFN(CGondolierMixer); +DEFFN(CGondolierSlider); DEFFN(CMaitreDArmHolder); DEFFN(CMaitreDBody); DEFFN(CMaitreDLegs); @@ -577,6 +602,10 @@ DEFFN(CPET); DEFFN(CPETClass1); DEFFN(CPETClass2); DEFFN(CPETClass3); +DEFFN(CPetDragChev); +DEFFN(CPetGraphic); +DEFFN(CPetGraphic2); +DEFFN(PETLeaf); DEFFN(CPETLift); DEFFN(CPETMonitor); DEFFN(CPETPellerator); @@ -636,9 +665,13 @@ DEFFN(CGetFromSucc); DEFFN(CHelmetOnOff); DEFFN(CHomePhoto); DEFFN(CIconNavAction); +DEFFN(CIconNavButt); DEFFN(CIconNavDown); +DEFFN(CIconNavImage); DEFFN(CIconNavLeft); +DEFFN(CIconNavReceive); DEFFN(CIconNavRight); +DEFFN(CIconNavSend); DEFFN(CIconNavUp); DEFFN(CKeybrdButt); DEFFN(CMoveObjectButton); @@ -653,7 +686,11 @@ DEFFN(CMusicVoiceMute); DEFFN(CPetModeOff); DEFFN(CPetModeOn); DEFFN(CPetModePanel); +DEFFN(CPetPannel1); +DEFFN(CPetPannel2); +DEFFN(CPetPannel3); DEFFN(CSendToSucc); +DEFFN(CSGTSelector); DEFFN(CSliderButton); DEFFN(CSmallChevLeftOff); DEFFN(CSmallChevLeftOn); @@ -661,6 +698,9 @@ DEFFN(CSmallChevRightOff); DEFFN(CSmallChevRightOn); DEFFN(CStatusChangeButton); DEFFN(CSTButton); +DEFFN(CTextDown); +DEFFN(CTextSkrew); +DEFFN(CTextUp); DEFFN(CToggleButton); DEFFN(CToggleSwitch); DEFFN(CVolumeControl); @@ -862,6 +902,7 @@ DEFFN(CMovePlayerToFrom); DEFFN(CMultiMove); DEFFN(CPanFromPel); DEFFN(CRestaurantPanHandler); +DEFFN(CScraliontisTable); DEFFN(CRestrictedMove); DEFFN(CTripDownCanal); @@ -905,6 +946,7 @@ void CSaveableObject::initClassList() { ADDFN(CBowlEar); ADDFN(CBrain); ADDFN(CBridgePiece); + ADDFN(CCarry); ADDFN(CCarryParrot); ADDFN(CCentralCore); ADDFN(CChicken); @@ -941,6 +983,7 @@ void CSaveableObject::initClassList() { ADDFN(CBackground); ADDFN(CClickResponder); + ADDFN(CDontSaveFileItem); ADDFN(CDropTarget); ADDFN(CFileItem); ADDFN(CFileListItem); @@ -950,6 +993,7 @@ void CSaveableObject::initClassList() { ADDFN(CMovieClipList); ADDFN(CMultiDropTarget); ADDFN(CNodeItem); + ADDFN(CPetControl); ADDFN(CProjectItem); ADDFN(CStaticImage); ADDFN(CTurnOnObject); @@ -1015,8 +1059,6 @@ void CSaveableObject::initClassList() { ADDFN(CGamesConsole); ADDFN(CGetLiftEye2); ADDFN(CGlassSmasher); - ADDFN(CGondolierBase); - ADDFN(CGondolierMixer); ADDFN(CHammerClip); ADDFN(CHammerDispensor); ADDFN(CHammerDispensorButton); @@ -1043,9 +1085,8 @@ void CSaveableObject::initClassList() { ADDFN(CNullPortHole); ADDFN(CNutReplacer); ADDFN(CPetDisabler); - ADDFN(CPetGraphic); - ADDFN(CPetGraphic2); ADDFN(CPhonograph); + ADDFN(CPhonographLid); ADDFN(CPlayMusicButton); ADDFN(CPlayOnAct); ADDFN(CPortHole); @@ -1081,6 +1122,11 @@ void CSaveableObject::initClassList() { ADDFN(CWheelHotSpot); ADDFN(CWheelSpin); ADDFN(CWheelSpinHorn); + ADDFN(CGondolierBase); + ADDFN(CGondolierChest); + ADDFN(CGondolierFace); + ADDFN(CGondolierMixer); + ADDFN(CGondolierSlider); ADDFN(CMaitreDArmHolder); ADDFN(CMaitreDBody); ADDFN(CMaitreDLegs); @@ -1100,6 +1146,10 @@ void CSaveableObject::initClassList() { ADDFN(CPETClass1); ADDFN(CPETClass2); ADDFN(CPETClass3); + ADDFN(CPetDragChev); + ADDFN(CPetGraphic); + ADDFN(CPetGraphic2); + ADDFN(PETLeaf); ADDFN(CPETLift); ADDFN(CPETMonitor); ADDFN(CPETPellerator); @@ -1159,9 +1209,13 @@ void CSaveableObject::initClassList() { ADDFN(CHelmetOnOff); ADDFN(CHomePhoto); ADDFN(CIconNavAction); + ADDFN(CIconNavButt); ADDFN(CIconNavDown); + ADDFN(CIconNavImage); ADDFN(CIconNavLeft); + ADDFN(CIconNavReceive); ADDFN(CIconNavRight); + ADDFN(CIconNavSend); ADDFN(CIconNavUp); ADDFN(CKeybrdButt); ADDFN(CMoveObjectButton); @@ -1176,7 +1230,11 @@ void CSaveableObject::initClassList() { ADDFN(CPetModeOff); ADDFN(CPetModeOn); ADDFN(CPetModePanel); + ADDFN(CPetPannel1); + ADDFN(CPetPannel2); + ADDFN(CPetPannel3); ADDFN(CSendToSucc); + ADDFN(CSGTSelector); ADDFN(CSliderButton); ADDFN(CSmallChevLeftOff); ADDFN(CSmallChevLeftOn); @@ -1184,6 +1242,9 @@ void CSaveableObject::initClassList() { ADDFN(CSmallChevRightOn); ADDFN(CStatusChangeButton); ADDFN(CSTButton); + ADDFN(CTextDown); + ADDFN(CTextSkrew); + ADDFN(CTextUp); ADDFN(CToggleButton); ADDFN(CToggleSwitch); ADDFN(CVolumeControl); @@ -1381,6 +1442,7 @@ void CSaveableObject::initClassList() { ADDFN(CMultiMove); ADDFN(CPanFromPel); ADDFN(CRestaurantPanHandler); + ADDFN(CScraliontisTable); ADDFN(CRestrictedMove); ADDFN(CTripDownCanal); diff --git a/engines/titanic/game/gondolier/gondolier_base.cpp b/engines/titanic/game/gondolier/gondolier_base.cpp new file mode 100644 index 0000000000..bf54ed4d8d --- /dev/null +++ b/engines/titanic/game/gondolier/gondolier_base.cpp @@ -0,0 +1,70 @@ +/* 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 "titanic/game/gondolier/gondolier_base.h" + +namespace Titanic { + +int CGondolierBase::_v1; +int CGondolierBase::_v2; +int CGondolierBase::_v3; +int CGondolierBase::_v4; +int CGondolierBase::_v5; +int CGondolierBase::_v6; +int CGondolierBase::_v7; +int CGondolierBase::_v8; +int CGondolierBase::_v9; +int CGondolierBase::_v10; + +void CGondolierBase::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_v1, indent); + file->writeNumberLine(_v2, indent); + file->writeNumberLine(_v3, indent); + file->writeNumberLine(_v4, indent); + file->writeNumberLine(_v5, indent); + file->writeNumberLine(_v6, indent); + file->writeNumberLine(_v7, indent); + file->writeNumberLine(_v8, indent); + file->writeNumberLine(_v9, indent); + file->writeNumberLine(_v10, indent); + + CGameObject::save(file, indent); +} + +void CGondolierBase::load(SimpleFile *file) { + file->readNumber(); + _v1 = file->readNumber(); + _v2 = file->readNumber(); + _v3 = file->readNumber(); + _v4 = file->readNumber(); + _v5 = file->readNumber(); + _v6 = file->readNumber(); + _v7 = file->readNumber(); + _v8 = file->readNumber(); + _v9 = file->readNumber(); + _v10 = file->readNumber(); + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/gondolier/gondolier_base.h b/engines/titanic/game/gondolier/gondolier_base.h new file mode 100644 index 0000000000..3f0cede70d --- /dev/null +++ b/engines/titanic/game/gondolier/gondolier_base.h @@ -0,0 +1,61 @@ +/* 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. + * + */ + +#ifndef TITANIC_GONDOLIER_BASE_H +#define TITANIC_GONDOLIER_BASE_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CGondolierBase : public CGameObject { +private: + static int _v1; + static int _v2; + static int _v3; + static int _v4; + static int _v5; + static int _v6; + static int _v7; + static int _v8; + static int _v9; + static int _v10; +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CGondolierBase"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_GONDOLIER_BASE_H */ diff --git a/engines/titanic/game/gondolier/gondolier_chest.cpp b/engines/titanic/game/gondolier/gondolier_chest.cpp new file mode 100644 index 0000000000..441a8bac31 --- /dev/null +++ b/engines/titanic/game/gondolier/gondolier_chest.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/gondolier/gondolier_chest.h" + +namespace Titanic { + +void CGondolierChest::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGondolierBase::save(file, indent); +} + +void CGondolierChest::load(SimpleFile *file) { + file->readNumber(); + CGondolierBase::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/gondolier/gondolier_chest.h b/engines/titanic/game/gondolier/gondolier_chest.h new file mode 100644 index 0000000000..277faf994f --- /dev/null +++ b/engines/titanic/game/gondolier/gondolier_chest.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_GONDOLIER_CHEST_H +#define TITANIC_GONDOLIER_CHEST_H + +#include "titanic/game/gondolier/gondolier_base.h" + +namespace Titanic { + +class CGondolierChest : public CGondolierBase { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CGondolierChest"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_GONDOLIER_CHEST_H */ diff --git a/engines/titanic/game/gondolier/gondolier_face.cpp b/engines/titanic/game/gondolier/gondolier_face.cpp new file mode 100644 index 0000000000..6db23d8a1a --- /dev/null +++ b/engines/titanic/game/gondolier/gondolier_face.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/game/gondolier/gondolier_face.h" + +namespace Titanic { + +void CGondolierFace::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + CGondolierBase::save(file, indent); +} + +void CGondolierFace::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + CGondolierBase::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/gondolier/gondolier_face.h b/engines/titanic/game/gondolier/gondolier_face.h new file mode 100644 index 0000000000..5007431337 --- /dev/null +++ b/engines/titanic/game/gondolier/gondolier_face.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_GONDOLIER_FACE_H +#define TITANIC_GONDOLIER_FACE_H + +#include "titanic/game/gondolier/gondolier_base.h" + +namespace Titanic { + +class CGondolierFace : public CGondolierBase { +private: + int _fieldBC; +public: + CGondolierFace() : CGondolierBase(), _fieldBC(0) {} + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CGondolierMixer"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_GONDOLIER_FACE_H */ diff --git a/engines/titanic/game/gondolier/gondolier_mixer.cpp b/engines/titanic/game/gondolier/gondolier_mixer.cpp new file mode 100644 index 0000000000..e81ad34c87 --- /dev/null +++ b/engines/titanic/game/gondolier/gondolier_mixer.cpp @@ -0,0 +1,59 @@ +/* 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 "titanic/game/gondolier/gondolier_mixer.h" + +namespace Titanic { + +CGondolierMixer::CGondolierMixer() : CGondolierBase(), + _string1("c#0.wav"), _string2("c#1.wav"), + _fieldBC(-1), _fieldC0(-1), _fieldC4(0), _fieldC8(0), + _fieldE4(0) { +} + +void CGondolierMixer::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_fieldC4, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + file->writeNumberLine(_fieldE4, indent); + + CGondolierBase::save(file, indent); +} + +void CGondolierMixer::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _fieldC4 = file->readNumber(); + _fieldC8 = file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + _fieldE4 = file->readNumber(); + + CGondolierBase::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/gondolier/gondolier_mixer.h b/engines/titanic/game/gondolier/gondolier_mixer.h new file mode 100644 index 0000000000..5b92bc2fb8 --- /dev/null +++ b/engines/titanic/game/gondolier/gondolier_mixer.h @@ -0,0 +1,60 @@ +/* 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. + * + */ + +#ifndef TITANIC_GONDOLIER_MIXER_H +#define TITANIC_GONDOLIER_MIXER_H + +#include "titanic/game/gondolier/gondolier_base.h" + +namespace Titanic { + +class CGondolierMixer : public CGondolierBase { +private: + int _fieldBC; + int _fieldC0; + int _fieldC4; + int _fieldC8; + CString _string1; + CString _string2; + int _fieldE4; +public: + CGondolierMixer(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CGondolierMixer"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_GONDOLIER_MIXER_H */ diff --git a/engines/titanic/game/gondolier/gondolier_slider.cpp b/engines/titanic/game/gondolier/gondolier_slider.cpp new file mode 100644 index 0000000000..dff464ce64 --- /dev/null +++ b/engines/titanic/game/gondolier/gondolier_slider.cpp @@ -0,0 +1,82 @@ +/* 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 "titanic/game/gondolier/gondolier_slider.h" + +namespace Titanic { + +CGondolierSlider::CGondolierSlider() : CGondolierBase(), + _fieldBC(0), _fieldC0(0), _fieldC4(0), _fieldC8(0), + _fieldCC(0), _fieldD0(0), _fieldD4(0), _fieldD8(0), + _fieldDC(0), _fieldE0(0), _fieldE4(0), _fieldE8(0), + _fieldEC(0), _string1("NULL"), _fieldFC(0), _field118(0) { +} + +void CGondolierSlider::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_fieldC0, indent); + file->writeNumberLine(_fieldC4, indent); + file->writeNumberLine(_fieldC8, indent); + file->writeNumberLine(_fieldCC, indent); + file->writeNumberLine(_fieldD0, indent); + file->writeNumberLine(_fieldD4, indent); + file->writeNumberLine(_fieldD8, indent); + file->writeNumberLine(_fieldDC, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_fieldCC, indent); + file->writeQuotedLine(_string1, indent); + file->writeNumberLine(_fieldFC, indent); + file->writeQuotedLine(_string2, indent); + file->writeQuotedLine(_string3, indent); + file->writeNumberLine(_field118, indent); + + CGondolierBase::save(file, indent); +} + +void CGondolierSlider::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _fieldC0 = file->readNumber(); + _fieldC4 = file->readNumber(); + _fieldC8 = file->readNumber(); + _fieldCC = file->readNumber(); + _fieldD0 = file->readNumber(); + _fieldD4 = file->readNumber(); + _fieldD8 = file->readNumber(); + _fieldDC = file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + _fieldEC = file->readNumber(); + _string1 = file->readString(); + _fieldFC = file->readNumber(); + _string2 = file->readString(); + _string3 = file->readString(); + _field118 = file->readNumber(); + + CGondolierBase::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/gondolier/gondolier_slider.h b/engines/titanic/game/gondolier/gondolier_slider.h new file mode 100644 index 0000000000..9522483dc0 --- /dev/null +++ b/engines/titanic/game/gondolier/gondolier_slider.h @@ -0,0 +1,71 @@ +/* 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. + * + */ + +#ifndef TITANIC_GONDOLIER_SLIDER_H +#define TITANIC_GONDOLIER_SLIDER_H + +#include "titanic/game/gondolier/gondolier_base.h" + +namespace Titanic { + +class CGondolierSlider : public CGondolierBase { +private: + int _fieldBC; + int _fieldC0; + int _fieldC4; + int _fieldC8; + int _fieldCC; + int _fieldD0; + int _fieldD4; + int _fieldD8; + int _fieldDC; + int _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; + CString _string1; + int _fieldFC; + CString _string2; + CString _string3; + int _field118; +public: + CGondolierSlider(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CGondolierSlider"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_GONDOLIER_SLIDER_H */ diff --git a/engines/titanic/game/gondolier_base.cpp b/engines/titanic/game/gondolier_base.cpp deleted file mode 100644 index 59c9b5cd0c..0000000000 --- a/engines/titanic/game/gondolier_base.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* 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 "titanic/game/gondolier_base.h" - -namespace Titanic { - -int CGondolierBase::_v1; -int CGondolierBase::_v2; -int CGondolierBase::_v3; -int CGondolierBase::_v4; -int CGondolierBase::_v5; -int CGondolierBase::_v6; -int CGondolierBase::_v7; -int CGondolierBase::_v8; -int CGondolierBase::_v9; -int CGondolierBase::_v10; - -void CGondolierBase::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeNumberLine(_v1, indent); - file->writeNumberLine(_v2, indent); - file->writeNumberLine(_v3, indent); - file->writeNumberLine(_v4, indent); - file->writeNumberLine(_v5, indent); - file->writeNumberLine(_v6, indent); - file->writeNumberLine(_v7, indent); - file->writeNumberLine(_v8, indent); - file->writeNumberLine(_v9, indent); - file->writeNumberLine(_v10, indent); - - CGameObject::save(file, indent); -} - -void CGondolierBase::load(SimpleFile *file) { - file->readNumber(); - _v1 = file->readNumber(); - _v2 = file->readNumber(); - _v3 = file->readNumber(); - _v4 = file->readNumber(); - _v5 = file->readNumber(); - _v6 = file->readNumber(); - _v7 = file->readNumber(); - _v8 = file->readNumber(); - _v9 = file->readNumber(); - _v10 = file->readNumber(); - - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/gondolier_base.h b/engines/titanic/game/gondolier_base.h deleted file mode 100644 index 3f0cede70d..0000000000 --- a/engines/titanic/game/gondolier_base.h +++ /dev/null @@ -1,61 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_GONDOLIER_BASE_H -#define TITANIC_GONDOLIER_BASE_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CGondolierBase : public CGameObject { -private: - static int _v1; - static int _v2; - static int _v3; - static int _v4; - static int _v5; - static int _v6; - static int _v7; - static int _v8; - static int _v9; - static int _v10; -public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CGondolierBase"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_GONDOLIER_BASE_H */ diff --git a/engines/titanic/game/gondolier_mixer.cpp b/engines/titanic/game/gondolier_mixer.cpp deleted file mode 100644 index 33cc883bb0..0000000000 --- a/engines/titanic/game/gondolier_mixer.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* 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 "titanic/game/gondolier_mixer.h" - -namespace Titanic { - -CGondolierMixer::CGondolierMixer() : CGondolierBase(), - _string1("c#0.wav"), _string2("c#1.wav"), - _fieldBC(-1), _fieldC0(-1), _fieldC4(0), _fieldC8(0), - _fieldE4(0) { -} - -void CGondolierMixer::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldBC, indent); - file->writeNumberLine(_fieldC0, indent); - file->writeNumberLine(_fieldC4, indent); - file->writeNumberLine(_fieldC8, indent); - file->writeQuotedLine(_string1, indent); - file->writeQuotedLine(_string2, indent); - file->writeNumberLine(_fieldE4, indent); - - CGondolierBase::save(file, indent); -} - -void CGondolierMixer::load(SimpleFile *file) { - file->readNumber(); - _fieldBC = file->readNumber(); - _fieldC0 = file->readNumber(); - _fieldC4 = file->readNumber(); - _fieldC8 = file->readNumber(); - _string1 = file->readString(); - _string2 = file->readString(); - _fieldE4 = file->readNumber(); - - CGondolierBase::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/gondolier_mixer.h b/engines/titanic/game/gondolier_mixer.h deleted file mode 100644 index dfc46210c3..0000000000 --- a/engines/titanic/game/gondolier_mixer.h +++ /dev/null @@ -1,60 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_GONDOLIER_MIXER_H -#define TITANIC_GONDOLIER_MIXER_H - -#include "titanic/game/gondolier_base.h" - -namespace Titanic { - -class CGondolierMixer : public CGondolierBase { -private: - int _fieldBC; - int _fieldC0; - int _fieldC4; - int _fieldC8; - CString _string1; - CString _string2; - int _fieldE4; -public: - CGondolierMixer(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CGondolierMixer"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_GONDOLIER_MIXER_H */ diff --git a/engines/titanic/game/music_system_lock.cpp b/engines/titanic/game/music_system_lock.cpp index a5419d983f..6bd83f6811 100644 --- a/engines/titanic/game/music_system_lock.cpp +++ b/engines/titanic/game/music_system_lock.cpp @@ -33,7 +33,7 @@ void CMusicSystemLock::save(SimpleFile *file, int indent) const { void CMusicSystemLock::load(SimpleFile *file) { file->readNumber(); _value = file->readNumber(); - CGameObject::load(file); + CDropTarget::load(file); } } // End of namespace Titanic diff --git a/engines/titanic/game/pet_graphic.cpp b/engines/titanic/game/pet_graphic.cpp deleted file mode 100644 index 38226c9678..0000000000 --- a/engines/titanic/game/pet_graphic.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 "titanic/game/pet_graphic.h" - -namespace Titanic { - -void CPetGraphic::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - CGameObject::save(file, indent); -} - -void CPetGraphic::load(SimpleFile *file) { - file->readNumber(); - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/pet_graphic.h b/engines/titanic/game/pet_graphic.h deleted file mode 100644 index 28b5d9aeca..0000000000 --- a/engines/titanic/game/pet_graphic.h +++ /dev/null @@ -1,50 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_GRAPHIC_H -#define TITANIC_PET_GRAPHIC_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CPetGraphic : public CGameObject { -public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPetGraphic"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_GRAPHIC_H */ diff --git a/engines/titanic/game/pet_graphic2.cpp b/engines/titanic/game/pet_graphic2.cpp deleted file mode 100644 index a8d244e102..0000000000 --- a/engines/titanic/game/pet_graphic2.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 "titanic/game/pet_graphic2.h" - -namespace Titanic { - -void CPetGraphic2::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - CGameObject::save(file, indent); -} - -void CPetGraphic2::load(SimpleFile *file) { - file->readNumber(); - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/pet_graphic2.h b/engines/titanic/game/pet_graphic2.h deleted file mode 100644 index aabf058cf6..0000000000 --- a/engines/titanic/game/pet_graphic2.h +++ /dev/null @@ -1,50 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_GRAPHIC2_H -#define TITANIC_PET_GRAPHIC2_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CPetGraphic2 : public CGameObject { -public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CNutReplacer"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_GRAPHIC2_H */ diff --git a/engines/titanic/game/phonograph_lid.cpp b/engines/titanic/game/phonograph_lid.cpp index c7c1bd3328..a228af8c70 100644 --- a/engines/titanic/game/phonograph_lid.cpp +++ b/engines/titanic/game/phonograph_lid.cpp @@ -26,11 +26,13 @@ namespace Titanic { void CPhonographLid::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); CGameObject::save(file, indent); } void CPhonographLid::load(SimpleFile *file) { file->readNumber(); + _value = file->readNumber(); CGameObject::load(file); } diff --git a/engines/titanic/game/phonograph_lid.h b/engines/titanic/game/phonograph_lid.h index 040fec447a..2252551ad7 100644 --- a/engines/titanic/game/phonograph_lid.h +++ b/engines/titanic/game/phonograph_lid.h @@ -28,7 +28,11 @@ namespace Titanic { class CPhonographLid : public CGameObject { +private: + int _value; public: + CPhonographLid() : CGameObject(), _value(0) {} + /** * Return the class name */ diff --git a/engines/titanic/gfx/icon_nav_butt.cpp b/engines/titanic/gfx/icon_nav_butt.cpp new file mode 100644 index 0000000000..85eb1304c2 --- /dev/null +++ b/engines/titanic/gfx/icon_nav_butt.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/gfx/icon_nav_butt.h" + +namespace Titanic { + +void CIconNavButt::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CPetGraphic::save(file, indent); +} + +void CIconNavButt::load(SimpleFile *file) { + file->readNumber(); + CPetGraphic::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/icon_nav_butt.h b/engines/titanic/gfx/icon_nav_butt.h new file mode 100644 index 0000000000..018904eb73 --- /dev/null +++ b/engines/titanic/gfx/icon_nav_butt.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_ICON_NAV_BUTT_H +#define TITANIC_ICON_NAV_BUTT_H + +#include "titanic/gfx/pet_graphic.h" + +namespace Titanic { + +class CIconNavButt : public CPetGraphic { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CIconNavButt"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ICON_NAV_BUTT_H */ diff --git a/engines/titanic/gfx/icon_nav_image.cpp b/engines/titanic/gfx/icon_nav_image.cpp new file mode 100644 index 0000000000..1e8a1ca2c3 --- /dev/null +++ b/engines/titanic/gfx/icon_nav_image.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/gfx/icon_nav_image.h" + +namespace Titanic { + +void CIconNavImage::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CPetGraphic::save(file, indent); +} + +void CIconNavImage::load(SimpleFile *file) { + file->readNumber(); + CPetGraphic::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/icon_nav_image.h b/engines/titanic/gfx/icon_nav_image.h new file mode 100644 index 0000000000..403936d06e --- /dev/null +++ b/engines/titanic/gfx/icon_nav_image.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_ICON_NAV_IMAGE_H +#define TITANIC_ICON_NAV_IMAGE_H + +#include "titanic/gfx/pet_graphic.h" + +namespace Titanic { + +class CIconNavImage : public CPetGraphic { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CIconNavImage"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ICON_NAV_IMAGE_H */ diff --git a/engines/titanic/gfx/icon_nav_receive.cpp b/engines/titanic/gfx/icon_nav_receive.cpp new file mode 100644 index 0000000000..ad7e0e7160 --- /dev/null +++ b/engines/titanic/gfx/icon_nav_receive.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/gfx/icon_nav_receive.h" + +namespace Titanic { + +void CIconNavReceive::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CPetGraphic::save(file, indent); +} + +void CIconNavReceive::load(SimpleFile *file) { + file->readNumber(); + CPetGraphic::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/icon_nav_receive.h b/engines/titanic/gfx/icon_nav_receive.h new file mode 100644 index 0000000000..b158fdaf87 --- /dev/null +++ b/engines/titanic/gfx/icon_nav_receive.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_ICON_NAV_RECEIVE_H +#define TITANIC_ICON_NAV_RECEIVE_H + +#include "titanic/gfx/pet_graphic.h" + +namespace Titanic { + +class CIconNavReceive : public CPetGraphic { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CIconNavReceive"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ICON_NAV_RECEIVE_H */ diff --git a/engines/titanic/gfx/icon_nav_send.cpp b/engines/titanic/gfx/icon_nav_send.cpp new file mode 100644 index 0000000000..856560c175 --- /dev/null +++ b/engines/titanic/gfx/icon_nav_send.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/gfx/icon_nav_send.h" + +namespace Titanic { + +void CIconNavSend::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CPetGraphic::save(file, indent); +} + +void CIconNavSend::load(SimpleFile *file) { + file->readNumber(); + CPetGraphic::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/icon_nav_send.h b/engines/titanic/gfx/icon_nav_send.h new file mode 100644 index 0000000000..59cb670687 --- /dev/null +++ b/engines/titanic/gfx/icon_nav_send.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_ICON_NAV_SEND_H +#define TITANIC_ICON_NAV_SEND_H + +#include "titanic/gfx/pet_graphic.h" + +namespace Titanic { + +class CIconNavSend : public CPetGraphic { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CIconNavSend"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ICON_NAV_SEND_H */ diff --git a/engines/titanic/gfx/pet_drag_chev.cpp b/engines/titanic/gfx/pet_drag_chev.cpp new file mode 100644 index 0000000000..24b4666b3a --- /dev/null +++ b/engines/titanic/gfx/pet_drag_chev.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/gfx/pet_drag_chev.h" + +namespace Titanic { + +void CPetDragChev::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CPetGraphic2::save(file, indent); +} + +void CPetDragChev::load(SimpleFile *file) { + file->readNumber(); + CPetGraphic2::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/pet_drag_chev.h b/engines/titanic/gfx/pet_drag_chev.h new file mode 100644 index 0000000000..72f83dddf8 --- /dev/null +++ b/engines/titanic/gfx/pet_drag_chev.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_DRAG_CHEV_H +#define TITANIC_PET_DRAG_CHEV_H + +#include "titanic/gfx/pet_graphic2.h" + +namespace Titanic { + +class CPetDragChev : public CPetGraphic2 { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPetDragChev"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_DRAG_CHEV_H */ diff --git a/engines/titanic/gfx/pet_graphic.cpp b/engines/titanic/gfx/pet_graphic.cpp new file mode 100644 index 0000000000..b625c1dfdb --- /dev/null +++ b/engines/titanic/gfx/pet_graphic.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/gfx/pet_graphic.h" + +namespace Titanic { + +void CPetGraphic::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPetGraphic::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/pet_graphic.h b/engines/titanic/gfx/pet_graphic.h new file mode 100644 index 0000000000..28b5d9aeca --- /dev/null +++ b/engines/titanic/gfx/pet_graphic.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_GRAPHIC_H +#define TITANIC_PET_GRAPHIC_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPetGraphic : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPetGraphic"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_GRAPHIC_H */ diff --git a/engines/titanic/gfx/pet_graphic2.cpp b/engines/titanic/gfx/pet_graphic2.cpp new file mode 100644 index 0000000000..5588c72fba --- /dev/null +++ b/engines/titanic/gfx/pet_graphic2.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/gfx/pet_graphic2.h" + +namespace Titanic { + +void CPetGraphic2::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPetGraphic2::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/pet_graphic2.h b/engines/titanic/gfx/pet_graphic2.h new file mode 100644 index 0000000000..aabf058cf6 --- /dev/null +++ b/engines/titanic/gfx/pet_graphic2.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_GRAPHIC2_H +#define TITANIC_PET_GRAPHIC2_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPetGraphic2 : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CNutReplacer"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_GRAPHIC2_H */ diff --git a/engines/titanic/gfx/pet_leaf.cpp b/engines/titanic/gfx/pet_leaf.cpp new file mode 100644 index 0000000000..adb6ccd144 --- /dev/null +++ b/engines/titanic/gfx/pet_leaf.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/gfx/pet_leaf.h" + +namespace Titanic { + +void PETLeaf::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void PETLeaf::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/pet_leaf.h b/engines/titanic/gfx/pet_leaf.h new file mode 100644 index 0000000000..95fe1e6062 --- /dev/null +++ b/engines/titanic/gfx/pet_leaf.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_LEAF_H +#define TITANIC_PET_LEAF_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class PETLeaf : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "PETLeaf"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_LEAF_H */ diff --git a/engines/titanic/gfx/pet_pannel1.cpp b/engines/titanic/gfx/pet_pannel1.cpp new file mode 100644 index 0000000000..baa7558ea0 --- /dev/null +++ b/engines/titanic/gfx/pet_pannel1.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/gfx/pet_pannel1.h" + +namespace Titanic { + +void CPetPannel1::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CPetGraphic::save(file, indent); +} + +void CPetPannel1::load(SimpleFile *file) { + file->readNumber(); + CPetGraphic::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/pet_pannel1.h b/engines/titanic/gfx/pet_pannel1.h new file mode 100644 index 0000000000..3d9b4068db --- /dev/null +++ b/engines/titanic/gfx/pet_pannel1.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_PANNEL1_H +#define TITANIC_PET_PANNEL1_H + +#include "titanic/gfx/pet_graphic.h" + +namespace Titanic { + +class CPetPannel1 : public CPetGraphic { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPetPannel1"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_PANNEL1_H */ diff --git a/engines/titanic/gfx/pet_pannel2.cpp b/engines/titanic/gfx/pet_pannel2.cpp new file mode 100644 index 0000000000..7376fcc4c5 --- /dev/null +++ b/engines/titanic/gfx/pet_pannel2.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/gfx/pet_pannel2.h" + +namespace Titanic { + +void CPetPannel2::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CPetGraphic::save(file, indent); +} + +void CPetPannel2::load(SimpleFile *file) { + file->readNumber(); + CPetGraphic::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/pet_pannel2.h b/engines/titanic/gfx/pet_pannel2.h new file mode 100644 index 0000000000..6fdad872ba --- /dev/null +++ b/engines/titanic/gfx/pet_pannel2.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_PANNEL2_H +#define TITANIC_PET_PANNEL2_H + +#include "titanic/gfx/pet_graphic.h" + +namespace Titanic { + +class CPetPannel2 : public CPetGraphic { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPetPannel2"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_PANNEL2_H */ diff --git a/engines/titanic/gfx/pet_pannel3.cpp b/engines/titanic/gfx/pet_pannel3.cpp new file mode 100644 index 0000000000..f4bd1fb0cc --- /dev/null +++ b/engines/titanic/gfx/pet_pannel3.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/gfx/pet_pannel3.h" + +namespace Titanic { + +void CPetPannel3::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CPetGraphic::save(file, indent); +} + +void CPetPannel3::load(SimpleFile *file) { + file->readNumber(); + CPetGraphic::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/pet_pannel3.h b/engines/titanic/gfx/pet_pannel3.h new file mode 100644 index 0000000000..521d5179c2 --- /dev/null +++ b/engines/titanic/gfx/pet_pannel3.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_PANNEL3_H +#define TITANIC_PET_PANNEL3_H + +#include "titanic/gfx/pet_graphic.h" + +namespace Titanic { + +class CPetPannel3 : public CPetGraphic { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPetPannel3"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_PANNEL3_H */ diff --git a/engines/titanic/gfx/sgt_selector.cpp b/engines/titanic/gfx/sgt_selector.cpp new file mode 100644 index 0000000000..7ad126b60a --- /dev/null +++ b/engines/titanic/gfx/sgt_selector.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/gfx/sgt_selector.h" + +namespace Titanic { + +void CSGTSelector::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CPetGraphic::save(file, indent); +} + +void CSGTSelector::load(SimpleFile *file) { + file->readNumber(); + CPetGraphic::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/sgt_selector.h b/engines/titanic/gfx/sgt_selector.h new file mode 100644 index 0000000000..92832889d4 --- /dev/null +++ b/engines/titanic/gfx/sgt_selector.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_SGT_SELECTOR_H +#define TITANIC_SGT_SELECTOR_H + +#include "titanic/gfx/pet_graphic.h" + +namespace Titanic { + +class CSGTSelector : public CPetGraphic { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CSGTSelector"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SGT_SELECTOR_H */ diff --git a/engines/titanic/gfx/text_down.cpp b/engines/titanic/gfx/text_down.cpp new file mode 100644 index 0000000000..d4bdfdb72f --- /dev/null +++ b/engines/titanic/gfx/text_down.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/gfx/text_down.h" + +namespace Titanic { + +void CTextDown::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CPetGraphic::save(file, indent); +} + +void CTextDown::load(SimpleFile *file) { + file->readNumber(); + CPetGraphic::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/text_down.h b/engines/titanic/gfx/text_down.h new file mode 100644 index 0000000000..8fc16d8aee --- /dev/null +++ b/engines/titanic/gfx/text_down.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_TEXT_DOWN_H +#define TITANIC_TEXT_DOWN_H + +#include "titanic/gfx/pet_graphic.h" + +namespace Titanic { + +class CTextDown : public CPetGraphic { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CTextDown"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TEXT_DOWN_H */ diff --git a/engines/titanic/gfx/text_skrew.cpp b/engines/titanic/gfx/text_skrew.cpp new file mode 100644 index 0000000000..8d1f026913 --- /dev/null +++ b/engines/titanic/gfx/text_skrew.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/gfx/text_skrew.h" + +namespace Titanic { + +void CTextSkrew::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CPetGraphic::save(file, indent); +} + +void CTextSkrew::load(SimpleFile *file) { + file->readNumber(); + CPetGraphic::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/text_skrew.h b/engines/titanic/gfx/text_skrew.h new file mode 100644 index 0000000000..88a6a9ab81 --- /dev/null +++ b/engines/titanic/gfx/text_skrew.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_TEXT_SKREW_H +#define TITANIC_TEXT_SKREW_H + +#include "titanic/gfx/pet_graphic.h" + +namespace Titanic { + +class CTextSkrew : public CPetGraphic { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CTextSkrew"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TEXT_SKREW_H */ diff --git a/engines/titanic/gfx/text_up.cpp b/engines/titanic/gfx/text_up.cpp new file mode 100644 index 0000000000..ce3ff100dc --- /dev/null +++ b/engines/titanic/gfx/text_up.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/gfx/text_up.h" + +namespace Titanic { + +void CTextUp::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CPetGraphic::save(file, indent); +} + +void CTextUp::load(SimpleFile *file) { + file->readNumber(); + CPetGraphic::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/text_up.h b/engines/titanic/gfx/text_up.h new file mode 100644 index 0000000000..cce4c6c6b4 --- /dev/null +++ b/engines/titanic/gfx/text_up.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_TEXT_UP_H +#define TITANIC_TEXT_UP_H + +#include "titanic/gfx/pet_graphic.h" + +namespace Titanic { + +class CTextUp : public CPetGraphic { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CTextUp"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TEXT_UP_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 191b61bcd7..de45be024c 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -141,8 +141,6 @@ MODULE_OBJS := \ game/games_console.o \ game/get_lift_eye2.o \ game/glass_smasher.o \ - game/gondolier_base.o \ - game/gondolier_mixer.o \ game/hammer_clip.o \ game/head_slot.o \ game/head_smash_event.o \ @@ -172,8 +170,6 @@ MODULE_OBJS := \ game/nut_replacer.o \ game/pet_controler.o \ game/pet_disabler.o \ - game/pet_graphic2.o \ - game/pet_graphic.o \ game/phonograph.o \ game/phonograph_lid.o \ game/play_music_button.o \ @@ -214,6 +210,11 @@ MODULE_OBJS := \ game/wheel_hotspot.o \ game/wheel_spin.o \ game/wheel_spin_horn.o \ + game/gondolier/gondolier_base.o \ + game/gondolier/gondolier_chest.o \ + game/gondolier/gondolier_face.o \ + game/gondolier/gondolier_mixer.o \ + game/gondolier/gondolier_slider.o \ game/maitred/maitred_arm_holder.o \ game/maitred/maitred_body.o \ game/maitred/maitred_legs.o \ @@ -290,17 +291,29 @@ MODULE_OBJS := \ gfx/helmet_on_off.o \ gfx/home_photo.o \ gfx/icon_nav_action.o \ + gfx/icon_nav_butt.o \ gfx/icon_nav_down.o \ + gfx/icon_nav_image.o \ gfx/icon_nav_left.o \ + gfx/icon_nav_receive.o \ gfx/icon_nav_right.o \ + gfx/icon_nav_send.o \ gfx/icon_nav_up.o \ gfx/keybrd_butt.o \ gfx/move_object_button.o \ gfx/music_control.o \ + gfx/pet_drag_chev.o \ + gfx/pet_graphic2.o \ + gfx/pet_graphic.o \ + gfx/pet_leaf.o \ gfx/pet_mode_off.o \ gfx/pet_mode_on.o \ gfx/pet_mode_panel.o \ + gfx/pet_pannel1.o \ + gfx/pet_pannel2.o \ + gfx/pet_pannel3.o \ gfx/send_to_succ.o \ + gfx/sgt_selector.o \ gfx/slider_button.o \ gfx/small_chev_left_off.o \ gfx/small_chev_left_on.o \ @@ -308,6 +321,9 @@ MODULE_OBJS := \ gfx/small_chev_right_on.o \ gfx/status_change_button.o \ gfx/st_button.o \ + gfx/text_down.o \ + gfx/text_skrew.o \ + gfx/text_up.o \ gfx/toggle_button.o \ gfx/toggle_switch.o \ gfx/volume_control.o \ @@ -337,6 +353,7 @@ MODULE_OBJS := \ moves/pan_from_pel.o \ moves/restaurant_pan_handler.o \ moves/restricted_move.o \ + moves/scraliontis_table.o \ moves/trip_down_canal.o \ npcs/barbot.o \ npcs/bellbot.o \ diff --git a/engines/titanic/moves/restaurant_pan_handler.cpp b/engines/titanic/moves/restaurant_pan_handler.cpp index b2487a4cb1..8efc5cbe65 100644 --- a/engines/titanic/moves/restaurant_pan_handler.cpp +++ b/engines/titanic/moves/restaurant_pan_handler.cpp @@ -24,11 +24,11 @@ namespace Titanic { -CRestaurantPanHandler::CRestaurantPanHandler() : CMovePlayerTo() { -} +int CRestaurantPanHandler::_v1; void CRestaurantPanHandler::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); + file->writeNumberLine(_v1, indent); file->writeQuotedLine(_string1, indent); file->writeQuotedLine(_string2, indent); @@ -37,6 +37,7 @@ void CRestaurantPanHandler::save(SimpleFile *file, int indent) const { void CRestaurantPanHandler::load(SimpleFile *file) { file->readNumber(); + _v1 = file->readNumber(); _string1 = file->readString(); _string2 = file->readString(); diff --git a/engines/titanic/moves/restaurant_pan_handler.h b/engines/titanic/moves/restaurant_pan_handler.h index f2f2c0cc9b..d2db5843a8 100644 --- a/engines/titanic/moves/restaurant_pan_handler.h +++ b/engines/titanic/moves/restaurant_pan_handler.h @@ -29,11 +29,11 @@ namespace Titanic { class CRestaurantPanHandler : public CMovePlayerTo { protected: + static int _v1; + CString _string1; CString _string2; public: - CRestaurantPanHandler(); - /** * Return the class name */ diff --git a/engines/titanic/moves/scraliontis_table.cpp b/engines/titanic/moves/scraliontis_table.cpp new file mode 100644 index 0000000000..d67b2f3622 --- /dev/null +++ b/engines/titanic/moves/scraliontis_table.cpp @@ -0,0 +1,51 @@ +/* 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 "titanic/moves/scraliontis_table.h" + +namespace Titanic { + +CScraliontisTable::CScraliontisTable() : CRestaurantPanHandler(), + _fieldE0(0), _fieldE4(0), _fieldE8(0), _fieldEC(0) { +} + +void CScraliontisTable::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_fieldE4, indent); + file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_fieldEC, indent); + + CRestaurantPanHandler::save(file, indent); +} + +void CScraliontisTable::load(SimpleFile *file) { + file->readNumber(); + _fieldE0 = file->readNumber(); + _fieldE4 = file->readNumber(); + _fieldE8 = file->readNumber(); + _fieldEC = file->readNumber(); + + CRestaurantPanHandler::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/moves/scraliontis_table.h b/engines/titanic/moves/scraliontis_table.h new file mode 100644 index 0000000000..d7c2ad69ab --- /dev/null +++ b/engines/titanic/moves/scraliontis_table.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_SCRALIONTIS_TABLE_H +#define TITANIC_SCRALIONTIS_TABLE_H + +#include "titanic/moves/restaurant_pan_handler.h" + +namespace Titanic { + +class CScraliontisTable : public CRestaurantPanHandler { +private: + int _fieldE0; + int _fieldE4; + int _fieldE8; + int _fieldEC; +public: + CScraliontisTable(); + + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CScraliontisTable"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SCRALIONTIS_TABLE_H */ -- cgit v1.2.3 From d07fbeb25552b9deaa00f607aaca15e51353f8da Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 4 Mar 2016 07:46:39 -0500 Subject: TITANIC: Beginnings of CPetControl support classes --- engines/titanic/core/pet_control.cpp | 31 --------- engines/titanic/core/pet_control.h | 40 ----------- engines/titanic/core/project_item.cpp | 2 +- engines/titanic/core/saveable_object.cpp | 8 ++- engines/titanic/game/pet/pet_control.cpp | 79 +++++++++++++++++++++ engines/titanic/game/pet/pet_control.h | 85 +++++++++++++++++++++++ engines/titanic/game/pet/pet_control_sub1.cpp | 35 ++++++++++ engines/titanic/game/pet/pet_control_sub1.h | 45 ++++++++++++ engines/titanic/game/pet/pet_control_sub2.cpp | 35 ++++++++++ engines/titanic/game/pet/pet_control_sub2.h | 45 ++++++++++++ engines/titanic/game/pet/pet_control_sub3.cpp | 35 ++++++++++ engines/titanic/game/pet/pet_control_sub3.h | 45 ++++++++++++ engines/titanic/game/pet/pet_control_sub4.cpp | 35 ++++++++++ engines/titanic/game/pet/pet_control_sub4.h | 45 ++++++++++++ engines/titanic/game/pet/pet_control_sub5.cpp | 35 ++++++++++ engines/titanic/game/pet/pet_control_sub5.h | 45 ++++++++++++ engines/titanic/game/pet/pet_control_sub6.cpp | 35 ++++++++++ engines/titanic/game/pet/pet_control_sub6.h | 45 ++++++++++++ engines/titanic/game/pet/pet_control_sub7.cpp | 35 ++++++++++ engines/titanic/game/pet/pet_control_sub7.h | 45 ++++++++++++ engines/titanic/game/pet/pet_control_sub8.cpp | 35 ++++++++++ engines/titanic/game/pet/pet_control_sub8.h | 45 ++++++++++++ engines/titanic/game/pet/pet_control_sub_base.cpp | 27 +++++++ engines/titanic/game/pet/pet_control_sub_base.h | 49 +++++++++++++ engines/titanic/game/pet/pet_val.cpp | 28 ++++++++ engines/titanic/game/pet/pet_val.h | 41 +++++++++++ engines/titanic/game/pet/pet_val_base.cpp | 31 +++++++++ engines/titanic/game/pet/pet_val_base.h | 61 ++++++++++++++++ engines/titanic/module.mk | 13 +++- 29 files changed, 1059 insertions(+), 76 deletions(-) delete mode 100644 engines/titanic/core/pet_control.cpp delete mode 100644 engines/titanic/core/pet_control.h create mode 100644 engines/titanic/game/pet/pet_control.cpp create mode 100644 engines/titanic/game/pet/pet_control.h create mode 100644 engines/titanic/game/pet/pet_control_sub1.cpp create mode 100644 engines/titanic/game/pet/pet_control_sub1.h create mode 100644 engines/titanic/game/pet/pet_control_sub2.cpp create mode 100644 engines/titanic/game/pet/pet_control_sub2.h create mode 100644 engines/titanic/game/pet/pet_control_sub3.cpp create mode 100644 engines/titanic/game/pet/pet_control_sub3.h create mode 100644 engines/titanic/game/pet/pet_control_sub4.cpp create mode 100644 engines/titanic/game/pet/pet_control_sub4.h create mode 100644 engines/titanic/game/pet/pet_control_sub5.cpp create mode 100644 engines/titanic/game/pet/pet_control_sub5.h create mode 100644 engines/titanic/game/pet/pet_control_sub6.cpp create mode 100644 engines/titanic/game/pet/pet_control_sub6.h create mode 100644 engines/titanic/game/pet/pet_control_sub7.cpp create mode 100644 engines/titanic/game/pet/pet_control_sub7.h create mode 100644 engines/titanic/game/pet/pet_control_sub8.cpp create mode 100644 engines/titanic/game/pet/pet_control_sub8.h create mode 100644 engines/titanic/game/pet/pet_control_sub_base.cpp create mode 100644 engines/titanic/game/pet/pet_control_sub_base.h create mode 100644 engines/titanic/game/pet/pet_val.cpp create mode 100644 engines/titanic/game/pet/pet_val.h create mode 100644 engines/titanic/game/pet/pet_val_base.cpp create mode 100644 engines/titanic/game/pet/pet_val_base.h diff --git a/engines/titanic/core/pet_control.cpp b/engines/titanic/core/pet_control.cpp deleted file mode 100644 index eee18269d2..0000000000 --- a/engines/titanic/core/pet_control.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 "titanic/core/pet_control.h" - -namespace Titanic { - -void CPetControl::gameLoaded() { - // TODO -} - -} // End of namespace Titanic diff --git a/engines/titanic/core/pet_control.h b/engines/titanic/core/pet_control.h deleted file mode 100644 index b1dc4610ae..0000000000 --- a/engines/titanic/core/pet_control.h +++ /dev/null @@ -1,40 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_CONTROL_H -#define TITANIC_PET_CONTROL_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CPetControl : public CGameObject { -public: - /** - * Called after loading a game has finished - */ - void gameLoaded(); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_H */ diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp index 7a8a082a37..2c3d070245 100644 --- a/engines/titanic/core/project_item.cpp +++ b/engines/titanic/core/project_item.cpp @@ -25,8 +25,8 @@ #include "titanic/titanic.h" #include "titanic/compressed_file.h" #include "titanic/core/dont_save_file_item.h" -#include "titanic/core/pet_control.h" #include "titanic/core/project_item.h" +#include "titanic/game/pet/pet_control.h" namespace Titanic { diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 8966ea6e67..937fef9864 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -70,7 +70,6 @@ #include "titanic/core/movie_clip.h" #include "titanic/core/multi_drop_target.h" #include "titanic/core/node_item.h" -#include "titanic/core/pet_control.h" #include "titanic/core/project_item.h" #include "titanic/core/saveable_object.h" #include "titanic/core/static_image.h" @@ -162,6 +161,9 @@ #include "titanic/game/nose_holder.h" #include "titanic/game/null_port_hole.h" #include "titanic/game/nut_replacer.h" +#include "titanic/game/pet/pet_control.h" +#include "titanic/game/pet/pet_control_sub_base.h" +#include "titanic/game/pet/pet_control_sub1.h" #include "titanic/game/pet_disabler.h" #include "titanic/game/phonograph.h" #include "titanic/game/phonograph_lid.h" @@ -450,7 +452,6 @@ DEFFN(CMovieClip); DEFFN(CMovieClipList); DEFFN(CMultiDropTarget); DEFFN(CNodeItem); -DEFFN(CPetControl); DEFFN(CProjectItem); DEFFN(CStaticImage); DEFFN(CTurnOnObject); @@ -602,6 +603,7 @@ DEFFN(CPET); DEFFN(CPETClass1); DEFFN(CPETClass2); DEFFN(CPETClass3); +DEFFN(CPetControl); DEFFN(CPetDragChev); DEFFN(CPetGraphic); DEFFN(CPetGraphic2); @@ -993,7 +995,6 @@ void CSaveableObject::initClassList() { ADDFN(CMovieClipList); ADDFN(CMultiDropTarget); ADDFN(CNodeItem); - ADDFN(CPetControl); ADDFN(CProjectItem); ADDFN(CStaticImage); ADDFN(CTurnOnObject); @@ -1146,6 +1147,7 @@ void CSaveableObject::initClassList() { ADDFN(CPETClass1); ADDFN(CPETClass2); ADDFN(CPETClass3); + ADDFN(CPetControl); ADDFN(CPetDragChev); ADDFN(CPetGraphic); ADDFN(CPetGraphic2); diff --git a/engines/titanic/game/pet/pet_control.cpp b/engines/titanic/game/pet/pet_control.cpp new file mode 100644 index 0000000000..f85b767a85 --- /dev/null +++ b/engines/titanic/game/pet/pet_control.cpp @@ -0,0 +1,79 @@ +/* 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 "titanic/game/pet/pet_control.h" + +namespace Titanic { + +void CPetControl::save(SimpleFile *file, int indent) const { + file->writeNumberLine(0, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + + saveSubObjects(file, indent); + CGameObject::save(file, indent); +} + +void CPetControl::load(SimpleFile *file) { + int val = file->readNumber(); + // TODO: sub_43A9E0 + + if (!val) { + _fieldBC = file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + + loadSubObjects(file); + } + + CGameObject::load(file); +} + +void CPetControl::gameLoaded() { + // TODO +} + +void CPetControl::loadSubObjects(SimpleFile *file) { + _sub1.load(file); + _sub2.load(file); + _sub3.load(file); + _sub4.load(file); + _sub5.load(file); + _sub6.load(file); + _sub7.load(file); + _sub8.load(file); +} + +void CPetControl::saveSubObjects(SimpleFile *file, int indent) const { + _sub1.save(file, indent); + _sub2.save(file, indent); + _sub3.save(file, indent); + _sub4.save(file, indent); + _sub5.save(file, indent); + _sub6.save(file, indent); + _sub7.save(file, indent); + _sub8.save(file, indent); +} + + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_control.h b/engines/titanic/game/pet/pet_control.h new file mode 100644 index 0000000000..33fa11d847 --- /dev/null +++ b/engines/titanic/game/pet/pet_control.h @@ -0,0 +1,85 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONTROL_H +#define TITANIC_PET_CONTROL_H + +#include "titanic/core/game_object.h" +#include "titanic/game/pet/pet_control_sub1.h" +#include "titanic/game/pet/pet_control_sub2.h" +#include "titanic/game/pet/pet_control_sub3.h" +#include "titanic/game/pet/pet_control_sub4.h" +#include "titanic/game/pet/pet_control_sub5.h" +#include "titanic/game/pet/pet_control_sub6.h" +#include "titanic/game/pet/pet_control_sub7.h" +#include "titanic/game/pet/pet_control_sub8.h" + +namespace Titanic { + +class CPetControl : public CGameObject { +private: + int _fieldBC; + int _fieldC0; + int _fieldC4; + int _fieldC8; + CPetControlSub1 _sub1; + CPetControlSub2 _sub2; + CPetControlSub3 _sub3; + CPetControlSub4 _sub4; + CPetControlSub5 _sub5; + CPetControlSub6 _sub6; + CPetControlSub7 _sub7; + CPetControlSub8 _sub8; + int _field1384; + CString _string1; + int _field1394; + CString _string2; + int _field13A4; +private: + void loadSubObjects(SimpleFile *file); + + void saveSubObjects(SimpleFile *file, int indent) const; +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPetControl"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); + + /** + * Called after loading a game has finished + */ + void gameLoaded(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_H */ diff --git a/engines/titanic/game/pet/pet_control_sub1.cpp b/engines/titanic/game/pet/pet_control_sub1.cpp new file mode 100644 index 0000000000..5aa84bd192 --- /dev/null +++ b/engines/titanic/game/pet/pet_control_sub1.cpp @@ -0,0 +1,35 @@ +/* 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 "titanic/game/pet/pet_control_sub1.h" + +namespace Titanic { + +void CPetControlSub1::save(SimpleFile *file, int indent) const { + +} + +void CPetControlSub1::load(SimpleFile *file) { + +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_control_sub1.h b/engines/titanic/game/pet/pet_control_sub1.h new file mode 100644 index 0000000000..31e1129cae --- /dev/null +++ b/engines/titanic/game/pet/pet_control_sub1.h @@ -0,0 +1,45 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONTROL_SUB1_H +#define TITANIC_PET_CONTROL_SUB1_H + +#include "titanic/game/pet/pet_control_sub_base.h" + +namespace Titanic { + +class CPetControlSub1 : public CPetControlSubBase { +public: + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_H */ diff --git a/engines/titanic/game/pet/pet_control_sub2.cpp b/engines/titanic/game/pet/pet_control_sub2.cpp new file mode 100644 index 0000000000..c8c905ef3c --- /dev/null +++ b/engines/titanic/game/pet/pet_control_sub2.cpp @@ -0,0 +1,35 @@ +/* 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 "titanic/game/pet/pet_control_sub2.h" + +namespace Titanic { + +void CPetControlSub2::save(SimpleFile *file, int indent) const { + +} + +void CPetControlSub2::load(SimpleFile *file) { + +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_control_sub2.h b/engines/titanic/game/pet/pet_control_sub2.h new file mode 100644 index 0000000000..c4e2b208fd --- /dev/null +++ b/engines/titanic/game/pet/pet_control_sub2.h @@ -0,0 +1,45 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONTROL_SUB2_H +#define TITANIC_PET_CONTROL_SUB2_H + +#include "titanic/game/pet/pet_control_sub_base.h" + +namespace Titanic { + +class CPetControlSub2 : public CPetControlSubBase { +public: + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_SUB2_H */ diff --git a/engines/titanic/game/pet/pet_control_sub3.cpp b/engines/titanic/game/pet/pet_control_sub3.cpp new file mode 100644 index 0000000000..5504b1384f --- /dev/null +++ b/engines/titanic/game/pet/pet_control_sub3.cpp @@ -0,0 +1,35 @@ +/* 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 "titanic/game/pet/pet_control_sub3.h" + +namespace Titanic { + +void CPetControlSub3::save(SimpleFile *file, int indent) const { + +} + +void CPetControlSub3::load(SimpleFile *file) { + +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_control_sub3.h b/engines/titanic/game/pet/pet_control_sub3.h new file mode 100644 index 0000000000..1b67a1eb1f --- /dev/null +++ b/engines/titanic/game/pet/pet_control_sub3.h @@ -0,0 +1,45 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONTROL_SUB3_H +#define TITANIC_PET_CONTROL_SUB3_H + +#include "titanic/game/pet/pet_control_sub_base.h" + +namespace Titanic { + +class CPetControlSub3 : public CPetControlSubBase { +public: + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_SUB3_H */ diff --git a/engines/titanic/game/pet/pet_control_sub4.cpp b/engines/titanic/game/pet/pet_control_sub4.cpp new file mode 100644 index 0000000000..eb605b8826 --- /dev/null +++ b/engines/titanic/game/pet/pet_control_sub4.cpp @@ -0,0 +1,35 @@ +/* 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 "titanic/game/pet/pet_control_sub4.h" + +namespace Titanic { + +void CPetControlSub4::save(SimpleFile *file, int indent) const { + +} + +void CPetControlSub4::load(SimpleFile *file) { + +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_control_sub4.h b/engines/titanic/game/pet/pet_control_sub4.h new file mode 100644 index 0000000000..426137e519 --- /dev/null +++ b/engines/titanic/game/pet/pet_control_sub4.h @@ -0,0 +1,45 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONTROL_SUB4_H +#define TITANIC_PET_CONTROL_SUB4_H + +#include "titanic/game/pet/pet_control_sub_base.h" + +namespace Titanic { + +class CPetControlSub4 : public CPetControlSubBase { +public: + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_SUB4_H */ diff --git a/engines/titanic/game/pet/pet_control_sub5.cpp b/engines/titanic/game/pet/pet_control_sub5.cpp new file mode 100644 index 0000000000..d46b3db16c --- /dev/null +++ b/engines/titanic/game/pet/pet_control_sub5.cpp @@ -0,0 +1,35 @@ +/* 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 "titanic/game/pet/pet_control_sub5.h" + +namespace Titanic { + +void CPetControlSub5::save(SimpleFile *file, int indent) const { + +} + +void CPetControlSub5::load(SimpleFile *file) { + +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_control_sub5.h b/engines/titanic/game/pet/pet_control_sub5.h new file mode 100644 index 0000000000..d76cf8f8cc --- /dev/null +++ b/engines/titanic/game/pet/pet_control_sub5.h @@ -0,0 +1,45 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONTROL_SUB5_H +#define TITANIC_PET_CONTROL_SUB5_H + +#include "titanic/game/pet/pet_control_sub_base.h" + +namespace Titanic { + +class CPetControlSub5 : public CPetControlSubBase { +public: + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_SUB5_H */ diff --git a/engines/titanic/game/pet/pet_control_sub6.cpp b/engines/titanic/game/pet/pet_control_sub6.cpp new file mode 100644 index 0000000000..2a3f26e0fa --- /dev/null +++ b/engines/titanic/game/pet/pet_control_sub6.cpp @@ -0,0 +1,35 @@ +/* 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 "titanic/game/pet/pet_control_sub6.h" + +namespace Titanic { + +void CPetControlSub6::save(SimpleFile *file, int indent) const { + +} + +void CPetControlSub6::load(SimpleFile *file) { + +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_control_sub6.h b/engines/titanic/game/pet/pet_control_sub6.h new file mode 100644 index 0000000000..4417665e16 --- /dev/null +++ b/engines/titanic/game/pet/pet_control_sub6.h @@ -0,0 +1,45 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONTROL_SUB6_H +#define TITANIC_PET_CONTROL_SUB6_H + +#include "titanic/game/pet/pet_control_sub_base.h" + +namespace Titanic { + +class CPetControlSub6 : public CPetControlSubBase { +public: + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_SUB6_H */ diff --git a/engines/titanic/game/pet/pet_control_sub7.cpp b/engines/titanic/game/pet/pet_control_sub7.cpp new file mode 100644 index 0000000000..7be9b11bc5 --- /dev/null +++ b/engines/titanic/game/pet/pet_control_sub7.cpp @@ -0,0 +1,35 @@ +/* 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 "titanic/game/pet/pet_control_sub7.h" + +namespace Titanic { + +void CPetControlSub7::save(SimpleFile *file, int indent) const { + +} + +void CPetControlSub7::load(SimpleFile *file) { + +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_control_sub7.h b/engines/titanic/game/pet/pet_control_sub7.h new file mode 100644 index 0000000000..cc42f9e27f --- /dev/null +++ b/engines/titanic/game/pet/pet_control_sub7.h @@ -0,0 +1,45 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONTROL_SUB7_H +#define TITANIC_PET_CONTROL_SUB7_H + +#include "titanic/game/pet/pet_control_sub_base.h" + +namespace Titanic { + +class CPetControlSub7 : public CPetControlSubBase { +public: + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_SUB7_H */ diff --git a/engines/titanic/game/pet/pet_control_sub8.cpp b/engines/titanic/game/pet/pet_control_sub8.cpp new file mode 100644 index 0000000000..f88e8fdcf0 --- /dev/null +++ b/engines/titanic/game/pet/pet_control_sub8.cpp @@ -0,0 +1,35 @@ +/* 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 "titanic/game/pet/pet_control_sub8.h" + +namespace Titanic { + +void CPetControlSub8::save(SimpleFile *file, int indent) const { + +} + +void CPetControlSub8::load(SimpleFile *file) { + +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_control_sub8.h b/engines/titanic/game/pet/pet_control_sub8.h new file mode 100644 index 0000000000..76dc6b1688 --- /dev/null +++ b/engines/titanic/game/pet/pet_control_sub8.h @@ -0,0 +1,45 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONTROL_SUB8_H +#define TITANIC_PET_CONTROL_SUB8_H + +#include "titanic/game/pet/pet_control_sub_base.h" + +namespace Titanic { + +class CPetControlSub8 : public CPetControlSubBase { +public: + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_SUB8_H */ diff --git a/engines/titanic/game/pet/pet_control_sub_base.cpp b/engines/titanic/game/pet/pet_control_sub_base.cpp new file mode 100644 index 0000000000..9afb18895e --- /dev/null +++ b/engines/titanic/game/pet/pet_control_sub_base.cpp @@ -0,0 +1,27 @@ +/* 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 "titanic/game/pet/pet_control_sub_base.h" + +namespace Titanic { + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_control_sub_base.h b/engines/titanic/game/pet/pet_control_sub_base.h new file mode 100644 index 0000000000..b11f5cc78b --- /dev/null +++ b/engines/titanic/game/pet/pet_control_sub_base.h @@ -0,0 +1,49 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONTROL_SUB_BASE_H +#define TITANIC_PET_CONTROL_SUB_BASE_H + +#include "titanic/simple_file.h" + +namespace Titanic { + +class CPetControlSubBase { +protected: + int _field4; +public: + CPetControlSubBase() : _field4(0) {} + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const = 0; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file) = 0; +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_SUB_BASE_H */ diff --git a/engines/titanic/game/pet/pet_val.cpp b/engines/titanic/game/pet/pet_val.cpp new file mode 100644 index 0000000000..b978a8b724 --- /dev/null +++ b/engines/titanic/game/pet/pet_val.cpp @@ -0,0 +1,28 @@ +/* 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 "titanic/game/pet/pet_val.h" + +namespace Titanic { + + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_val.h b/engines/titanic/game/pet/pet_val.h new file mode 100644 index 0000000000..f5cae8222d --- /dev/null +++ b/engines/titanic/game/pet/pet_val.h @@ -0,0 +1,41 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_VAL_H +#define TITANIC_PET_VAL_H + +#include "titanic/game/pet/pet_val_base.h" + +namespace Titanic { + +class CPetVal: public CPetValBase { +private: + int _field18; + int _field1C; + int _field20; +public: + CPetVal() : CPetValBase(), _field18(0), _field1C(0), _field20(0) {} +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_VAL_H */ diff --git a/engines/titanic/game/pet/pet_val_base.cpp b/engines/titanic/game/pet/pet_val_base.cpp new file mode 100644 index 0000000000..d77f366436 --- /dev/null +++ b/engines/titanic/game/pet/pet_val_base.cpp @@ -0,0 +1,31 @@ +/* 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 "titanic/game/pet/pet_val_base.h" + +namespace Titanic { + +CPetValBase::CPetValBase() : _field4(0), _field8(0), + _fieldC(0), _field10(0), _field14(0) { +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_val_base.h b/engines/titanic/game/pet/pet_val_base.h new file mode 100644 index 0000000000..310b0675b1 --- /dev/null +++ b/engines/titanic/game/pet/pet_val_base.h @@ -0,0 +1,61 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_VAL_BASE_H +#define TITANIC_PET_VAL_BASE_H + +namespace Titanic { + +class CPetValBase { +protected: + int _field4; + int _field8; + int _fieldC; + int _field10; + int _field14; +public: + CPetValBase(); + + virtual void proc1() {} + virtual void proc2() {} + virtual void proc3() {} + virtual void proc4() {} + + virtual void proc5() {} + + virtual void proc6() {} + virtual void proc7() {} + virtual void proc8() {} + virtual void proc9() {} + virtual void proc10() {} + virtual void proc11() {} + virtual void proc12() {} + virtual void proc13() {} + virtual void proc14() {} + virtual void proc15() {} + virtual void proc16() {} + virtual void proc17() {} +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_VAL_BASE_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index de45be024c..9edb440fa4 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -67,7 +67,6 @@ MODULE_OBJS := \ core/multi_drop_target.o \ core/named_item.o \ core/node_item.o \ - core/pet_control.o \ core/project_item.o \ core/resource_key.o \ core/saveable_object.o \ @@ -236,12 +235,24 @@ MODULE_OBJS := \ game/pet/pet_class3.o \ game/pet/pet_lift.o \ game/pet/pet_monitor.o \ + game/pet/pet_control.o \ + game/pet/pet_control_sub_base.o \ + game/pet/pet_control_sub1.o \ + game/pet/pet_control_sub2.o \ + game/pet/pet_control_sub3.o \ + game/pet/pet_control_sub4.o \ + game/pet/pet_control_sub5.o \ + game/pet/pet_control_sub6.o \ + game/pet/pet_control_sub7.o \ + game/pet/pet_control_sub8.o \ game/pet/pet_pellerator.o \ game/pet/pet_position.o \ game/pet/pet_sentinal.o \ game/pet/pet_sounds.o \ game/pet/pet_transition.o \ game/pet/pet_transport.o \ + game/pet/pet_val_base.o \ + game/pet/pet_val.o \ game/pickup/pick_up.o \ game/pickup/pick_up_bar_glass.o \ game/pickup/pick_up_hose.o \ -- cgit v1.2.3 From 61518fb20882d556615a025074659cdd2f89fb69 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 4 Mar 2016 20:21:02 -0500 Subject: TITANIC: Move CPetControl and direct support classes to new folder --- engines/titanic/core/project_item.cpp | 2 +- engines/titanic/core/saveable_object.cpp | 5 +- engines/titanic/game/pet/pet_control.cpp | 79 -------------------- engines/titanic/game/pet/pet_control.h | 85 ---------------------- engines/titanic/game/pet/pet_control_sub1.cpp | 35 --------- engines/titanic/game/pet/pet_control_sub1.h | 45 ------------ engines/titanic/game/pet/pet_control_sub2.cpp | 35 --------- engines/titanic/game/pet/pet_control_sub2.h | 45 ------------ engines/titanic/game/pet/pet_control_sub3.cpp | 35 --------- engines/titanic/game/pet/pet_control_sub3.h | 45 ------------ engines/titanic/game/pet/pet_control_sub4.cpp | 35 --------- engines/titanic/game/pet/pet_control_sub4.h | 45 ------------ engines/titanic/game/pet/pet_control_sub5.cpp | 35 --------- engines/titanic/game/pet/pet_control_sub5.h | 45 ------------ engines/titanic/game/pet/pet_control_sub6.cpp | 35 --------- engines/titanic/game/pet/pet_control_sub6.h | 45 ------------ engines/titanic/game/pet/pet_control_sub7.cpp | 35 --------- engines/titanic/game/pet/pet_control_sub7.h | 45 ------------ engines/titanic/game/pet/pet_control_sub8.cpp | 35 --------- engines/titanic/game/pet/pet_control_sub8.h | 45 ------------ engines/titanic/game/pet/pet_control_sub_base.cpp | 27 ------- engines/titanic/game/pet/pet_control_sub_base.h | 49 ------------- engines/titanic/module.mk | 20 ++--- engines/titanic/pet_control/pet_control.cpp | 79 ++++++++++++++++++++ engines/titanic/pet_control/pet_control.h | 85 ++++++++++++++++++++++ engines/titanic/pet_control/pet_control_sub1.cpp | 35 +++++++++ engines/titanic/pet_control/pet_control_sub1.h | 45 ++++++++++++ engines/titanic/pet_control/pet_control_sub2.cpp | 35 +++++++++ engines/titanic/pet_control/pet_control_sub2.h | 45 ++++++++++++ engines/titanic/pet_control/pet_control_sub3.cpp | 35 +++++++++ engines/titanic/pet_control/pet_control_sub3.h | 45 ++++++++++++ engines/titanic/pet_control/pet_control_sub4.cpp | 35 +++++++++ engines/titanic/pet_control/pet_control_sub4.h | 45 ++++++++++++ engines/titanic/pet_control/pet_control_sub5.cpp | 35 +++++++++ engines/titanic/pet_control/pet_control_sub5.h | 45 ++++++++++++ engines/titanic/pet_control/pet_control_sub6.cpp | 35 +++++++++ engines/titanic/pet_control/pet_control_sub6.h | 45 ++++++++++++ engines/titanic/pet_control/pet_control_sub7.cpp | 35 +++++++++ engines/titanic/pet_control/pet_control_sub7.h | 45 ++++++++++++ engines/titanic/pet_control/pet_control_sub8.cpp | 35 +++++++++ engines/titanic/pet_control/pet_control_sub8.h | 45 ++++++++++++ .../titanic/pet_control/pet_control_sub_base.cpp | 27 +++++++ engines/titanic/pet_control/pet_control_sub_base.h | 49 +++++++++++++ 43 files changed, 893 insertions(+), 894 deletions(-) delete mode 100644 engines/titanic/game/pet/pet_control.cpp delete mode 100644 engines/titanic/game/pet/pet_control.h delete mode 100644 engines/titanic/game/pet/pet_control_sub1.cpp delete mode 100644 engines/titanic/game/pet/pet_control_sub1.h delete mode 100644 engines/titanic/game/pet/pet_control_sub2.cpp delete mode 100644 engines/titanic/game/pet/pet_control_sub2.h delete mode 100644 engines/titanic/game/pet/pet_control_sub3.cpp delete mode 100644 engines/titanic/game/pet/pet_control_sub3.h delete mode 100644 engines/titanic/game/pet/pet_control_sub4.cpp delete mode 100644 engines/titanic/game/pet/pet_control_sub4.h delete mode 100644 engines/titanic/game/pet/pet_control_sub5.cpp delete mode 100644 engines/titanic/game/pet/pet_control_sub5.h delete mode 100644 engines/titanic/game/pet/pet_control_sub6.cpp delete mode 100644 engines/titanic/game/pet/pet_control_sub6.h delete mode 100644 engines/titanic/game/pet/pet_control_sub7.cpp delete mode 100644 engines/titanic/game/pet/pet_control_sub7.h delete mode 100644 engines/titanic/game/pet/pet_control_sub8.cpp delete mode 100644 engines/titanic/game/pet/pet_control_sub8.h delete mode 100644 engines/titanic/game/pet/pet_control_sub_base.cpp delete mode 100644 engines/titanic/game/pet/pet_control_sub_base.h create mode 100644 engines/titanic/pet_control/pet_control.cpp create mode 100644 engines/titanic/pet_control/pet_control.h create mode 100644 engines/titanic/pet_control/pet_control_sub1.cpp create mode 100644 engines/titanic/pet_control/pet_control_sub1.h create mode 100644 engines/titanic/pet_control/pet_control_sub2.cpp create mode 100644 engines/titanic/pet_control/pet_control_sub2.h create mode 100644 engines/titanic/pet_control/pet_control_sub3.cpp create mode 100644 engines/titanic/pet_control/pet_control_sub3.h create mode 100644 engines/titanic/pet_control/pet_control_sub4.cpp create mode 100644 engines/titanic/pet_control/pet_control_sub4.h create mode 100644 engines/titanic/pet_control/pet_control_sub5.cpp create mode 100644 engines/titanic/pet_control/pet_control_sub5.h create mode 100644 engines/titanic/pet_control/pet_control_sub6.cpp create mode 100644 engines/titanic/pet_control/pet_control_sub6.h create mode 100644 engines/titanic/pet_control/pet_control_sub7.cpp create mode 100644 engines/titanic/pet_control/pet_control_sub7.h create mode 100644 engines/titanic/pet_control/pet_control_sub8.cpp create mode 100644 engines/titanic/pet_control/pet_control_sub8.h create mode 100644 engines/titanic/pet_control/pet_control_sub_base.cpp create mode 100644 engines/titanic/pet_control/pet_control_sub_base.h diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp index 2c3d070245..e759b87e9f 100644 --- a/engines/titanic/core/project_item.cpp +++ b/engines/titanic/core/project_item.cpp @@ -26,7 +26,7 @@ #include "titanic/compressed_file.h" #include "titanic/core/dont_save_file_item.h" #include "titanic/core/project_item.h" -#include "titanic/game/pet/pet_control.h" +#include "titanic/pet_control/pet_control.h" namespace Titanic { diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 937fef9864..dcd47b78a4 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -161,9 +161,6 @@ #include "titanic/game/nose_holder.h" #include "titanic/game/null_port_hole.h" #include "titanic/game/nut_replacer.h" -#include "titanic/game/pet/pet_control.h" -#include "titanic/game/pet/pet_control_sub_base.h" -#include "titanic/game/pet/pet_control_sub1.h" #include "titanic/game/pet_disabler.h" #include "titanic/game/phonograph.h" #include "titanic/game/phonograph_lid.h" @@ -372,6 +369,8 @@ #include "titanic/npcs/summon_bots.h" #include "titanic/npcs/titania.h" +#include "titanic/pet_control/pet_control.h" + #include "titanic/sound/auto_music_player.h" #include "titanic/sound/auto_music_player_base.h" #include "titanic/sound/auto_sound_player.h" diff --git a/engines/titanic/game/pet/pet_control.cpp b/engines/titanic/game/pet/pet_control.cpp deleted file mode 100644 index f85b767a85..0000000000 --- a/engines/titanic/game/pet/pet_control.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* 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 "titanic/game/pet/pet_control.h" - -namespace Titanic { - -void CPetControl::save(SimpleFile *file, int indent) const { - file->writeNumberLine(0, indent); - file->writeNumberLine(_fieldBC, indent); - file->writeQuotedLine(_string1, indent); - file->writeQuotedLine(_string2, indent); - - saveSubObjects(file, indent); - CGameObject::save(file, indent); -} - -void CPetControl::load(SimpleFile *file) { - int val = file->readNumber(); - // TODO: sub_43A9E0 - - if (!val) { - _fieldBC = file->readNumber(); - _string1 = file->readString(); - _string2 = file->readString(); - - loadSubObjects(file); - } - - CGameObject::load(file); -} - -void CPetControl::gameLoaded() { - // TODO -} - -void CPetControl::loadSubObjects(SimpleFile *file) { - _sub1.load(file); - _sub2.load(file); - _sub3.load(file); - _sub4.load(file); - _sub5.load(file); - _sub6.load(file); - _sub7.load(file); - _sub8.load(file); -} - -void CPetControl::saveSubObjects(SimpleFile *file, int indent) const { - _sub1.save(file, indent); - _sub2.save(file, indent); - _sub3.save(file, indent); - _sub4.save(file, indent); - _sub5.save(file, indent); - _sub6.save(file, indent); - _sub7.save(file, indent); - _sub8.save(file, indent); -} - - -} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_control.h b/engines/titanic/game/pet/pet_control.h deleted file mode 100644 index 33fa11d847..0000000000 --- a/engines/titanic/game/pet/pet_control.h +++ /dev/null @@ -1,85 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_CONTROL_H -#define TITANIC_PET_CONTROL_H - -#include "titanic/core/game_object.h" -#include "titanic/game/pet/pet_control_sub1.h" -#include "titanic/game/pet/pet_control_sub2.h" -#include "titanic/game/pet/pet_control_sub3.h" -#include "titanic/game/pet/pet_control_sub4.h" -#include "titanic/game/pet/pet_control_sub5.h" -#include "titanic/game/pet/pet_control_sub6.h" -#include "titanic/game/pet/pet_control_sub7.h" -#include "titanic/game/pet/pet_control_sub8.h" - -namespace Titanic { - -class CPetControl : public CGameObject { -private: - int _fieldBC; - int _fieldC0; - int _fieldC4; - int _fieldC8; - CPetControlSub1 _sub1; - CPetControlSub2 _sub2; - CPetControlSub3 _sub3; - CPetControlSub4 _sub4; - CPetControlSub5 _sub5; - CPetControlSub6 _sub6; - CPetControlSub7 _sub7; - CPetControlSub8 _sub8; - int _field1384; - CString _string1; - int _field1394; - CString _string2; - int _field13A4; -private: - void loadSubObjects(SimpleFile *file); - - void saveSubObjects(SimpleFile *file, int indent) const; -public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPetControl"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); - - /** - * Called after loading a game has finished - */ - void gameLoaded(); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_H */ diff --git a/engines/titanic/game/pet/pet_control_sub1.cpp b/engines/titanic/game/pet/pet_control_sub1.cpp deleted file mode 100644 index 5aa84bd192..0000000000 --- a/engines/titanic/game/pet/pet_control_sub1.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 "titanic/game/pet/pet_control_sub1.h" - -namespace Titanic { - -void CPetControlSub1::save(SimpleFile *file, int indent) const { - -} - -void CPetControlSub1::load(SimpleFile *file) { - -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_control_sub1.h b/engines/titanic/game/pet/pet_control_sub1.h deleted file mode 100644 index 31e1129cae..0000000000 --- a/engines/titanic/game/pet/pet_control_sub1.h +++ /dev/null @@ -1,45 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_CONTROL_SUB1_H -#define TITANIC_PET_CONTROL_SUB1_H - -#include "titanic/game/pet/pet_control_sub_base.h" - -namespace Titanic { - -class CPetControlSub1 : public CPetControlSubBase { -public: - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_H */ diff --git a/engines/titanic/game/pet/pet_control_sub2.cpp b/engines/titanic/game/pet/pet_control_sub2.cpp deleted file mode 100644 index c8c905ef3c..0000000000 --- a/engines/titanic/game/pet/pet_control_sub2.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 "titanic/game/pet/pet_control_sub2.h" - -namespace Titanic { - -void CPetControlSub2::save(SimpleFile *file, int indent) const { - -} - -void CPetControlSub2::load(SimpleFile *file) { - -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_control_sub2.h b/engines/titanic/game/pet/pet_control_sub2.h deleted file mode 100644 index c4e2b208fd..0000000000 --- a/engines/titanic/game/pet/pet_control_sub2.h +++ /dev/null @@ -1,45 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_CONTROL_SUB2_H -#define TITANIC_PET_CONTROL_SUB2_H - -#include "titanic/game/pet/pet_control_sub_base.h" - -namespace Titanic { - -class CPetControlSub2 : public CPetControlSubBase { -public: - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_SUB2_H */ diff --git a/engines/titanic/game/pet/pet_control_sub3.cpp b/engines/titanic/game/pet/pet_control_sub3.cpp deleted file mode 100644 index 5504b1384f..0000000000 --- a/engines/titanic/game/pet/pet_control_sub3.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 "titanic/game/pet/pet_control_sub3.h" - -namespace Titanic { - -void CPetControlSub3::save(SimpleFile *file, int indent) const { - -} - -void CPetControlSub3::load(SimpleFile *file) { - -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_control_sub3.h b/engines/titanic/game/pet/pet_control_sub3.h deleted file mode 100644 index 1b67a1eb1f..0000000000 --- a/engines/titanic/game/pet/pet_control_sub3.h +++ /dev/null @@ -1,45 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_CONTROL_SUB3_H -#define TITANIC_PET_CONTROL_SUB3_H - -#include "titanic/game/pet/pet_control_sub_base.h" - -namespace Titanic { - -class CPetControlSub3 : public CPetControlSubBase { -public: - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_SUB3_H */ diff --git a/engines/titanic/game/pet/pet_control_sub4.cpp b/engines/titanic/game/pet/pet_control_sub4.cpp deleted file mode 100644 index eb605b8826..0000000000 --- a/engines/titanic/game/pet/pet_control_sub4.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 "titanic/game/pet/pet_control_sub4.h" - -namespace Titanic { - -void CPetControlSub4::save(SimpleFile *file, int indent) const { - -} - -void CPetControlSub4::load(SimpleFile *file) { - -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_control_sub4.h b/engines/titanic/game/pet/pet_control_sub4.h deleted file mode 100644 index 426137e519..0000000000 --- a/engines/titanic/game/pet/pet_control_sub4.h +++ /dev/null @@ -1,45 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_CONTROL_SUB4_H -#define TITANIC_PET_CONTROL_SUB4_H - -#include "titanic/game/pet/pet_control_sub_base.h" - -namespace Titanic { - -class CPetControlSub4 : public CPetControlSubBase { -public: - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_SUB4_H */ diff --git a/engines/titanic/game/pet/pet_control_sub5.cpp b/engines/titanic/game/pet/pet_control_sub5.cpp deleted file mode 100644 index d46b3db16c..0000000000 --- a/engines/titanic/game/pet/pet_control_sub5.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 "titanic/game/pet/pet_control_sub5.h" - -namespace Titanic { - -void CPetControlSub5::save(SimpleFile *file, int indent) const { - -} - -void CPetControlSub5::load(SimpleFile *file) { - -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_control_sub5.h b/engines/titanic/game/pet/pet_control_sub5.h deleted file mode 100644 index d76cf8f8cc..0000000000 --- a/engines/titanic/game/pet/pet_control_sub5.h +++ /dev/null @@ -1,45 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_CONTROL_SUB5_H -#define TITANIC_PET_CONTROL_SUB5_H - -#include "titanic/game/pet/pet_control_sub_base.h" - -namespace Titanic { - -class CPetControlSub5 : public CPetControlSubBase { -public: - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_SUB5_H */ diff --git a/engines/titanic/game/pet/pet_control_sub6.cpp b/engines/titanic/game/pet/pet_control_sub6.cpp deleted file mode 100644 index 2a3f26e0fa..0000000000 --- a/engines/titanic/game/pet/pet_control_sub6.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 "titanic/game/pet/pet_control_sub6.h" - -namespace Titanic { - -void CPetControlSub6::save(SimpleFile *file, int indent) const { - -} - -void CPetControlSub6::load(SimpleFile *file) { - -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_control_sub6.h b/engines/titanic/game/pet/pet_control_sub6.h deleted file mode 100644 index 4417665e16..0000000000 --- a/engines/titanic/game/pet/pet_control_sub6.h +++ /dev/null @@ -1,45 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_CONTROL_SUB6_H -#define TITANIC_PET_CONTROL_SUB6_H - -#include "titanic/game/pet/pet_control_sub_base.h" - -namespace Titanic { - -class CPetControlSub6 : public CPetControlSubBase { -public: - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_SUB6_H */ diff --git a/engines/titanic/game/pet/pet_control_sub7.cpp b/engines/titanic/game/pet/pet_control_sub7.cpp deleted file mode 100644 index 7be9b11bc5..0000000000 --- a/engines/titanic/game/pet/pet_control_sub7.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 "titanic/game/pet/pet_control_sub7.h" - -namespace Titanic { - -void CPetControlSub7::save(SimpleFile *file, int indent) const { - -} - -void CPetControlSub7::load(SimpleFile *file) { - -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_control_sub7.h b/engines/titanic/game/pet/pet_control_sub7.h deleted file mode 100644 index cc42f9e27f..0000000000 --- a/engines/titanic/game/pet/pet_control_sub7.h +++ /dev/null @@ -1,45 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_CONTROL_SUB7_H -#define TITANIC_PET_CONTROL_SUB7_H - -#include "titanic/game/pet/pet_control_sub_base.h" - -namespace Titanic { - -class CPetControlSub7 : public CPetControlSubBase { -public: - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_SUB7_H */ diff --git a/engines/titanic/game/pet/pet_control_sub8.cpp b/engines/titanic/game/pet/pet_control_sub8.cpp deleted file mode 100644 index f88e8fdcf0..0000000000 --- a/engines/titanic/game/pet/pet_control_sub8.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 "titanic/game/pet/pet_control_sub8.h" - -namespace Titanic { - -void CPetControlSub8::save(SimpleFile *file, int indent) const { - -} - -void CPetControlSub8::load(SimpleFile *file) { - -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_control_sub8.h b/engines/titanic/game/pet/pet_control_sub8.h deleted file mode 100644 index 76dc6b1688..0000000000 --- a/engines/titanic/game/pet/pet_control_sub8.h +++ /dev/null @@ -1,45 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_CONTROL_SUB8_H -#define TITANIC_PET_CONTROL_SUB8_H - -#include "titanic/game/pet/pet_control_sub_base.h" - -namespace Titanic { - -class CPetControlSub8 : public CPetControlSubBase { -public: - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_SUB8_H */ diff --git a/engines/titanic/game/pet/pet_control_sub_base.cpp b/engines/titanic/game/pet/pet_control_sub_base.cpp deleted file mode 100644 index 9afb18895e..0000000000 --- a/engines/titanic/game/pet/pet_control_sub_base.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* 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 "titanic/game/pet/pet_control_sub_base.h" - -namespace Titanic { - -} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_control_sub_base.h b/engines/titanic/game/pet/pet_control_sub_base.h deleted file mode 100644 index b11f5cc78b..0000000000 --- a/engines/titanic/game/pet/pet_control_sub_base.h +++ /dev/null @@ -1,49 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_CONTROL_SUB_BASE_H -#define TITANIC_PET_CONTROL_SUB_BASE_H - -#include "titanic/simple_file.h" - -namespace Titanic { - -class CPetControlSubBase { -protected: - int _field4; -public: - CPetControlSubBase() : _field4(0) {} - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const = 0; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file) = 0; -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_SUB_BASE_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 9edb440fa4..922878bc8e 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -235,16 +235,6 @@ MODULE_OBJS := \ game/pet/pet_class3.o \ game/pet/pet_lift.o \ game/pet/pet_monitor.o \ - game/pet/pet_control.o \ - game/pet/pet_control_sub_base.o \ - game/pet/pet_control_sub1.o \ - game/pet/pet_control_sub2.o \ - game/pet/pet_control_sub3.o \ - game/pet/pet_control_sub4.o \ - game/pet/pet_control_sub5.o \ - game/pet/pet_control_sub6.o \ - game/pet/pet_control_sub7.o \ - game/pet/pet_control_sub8.o \ game/pet/pet_pellerator.o \ game/pet/pet_position.o \ game/pet/pet_sentinal.o \ @@ -382,6 +372,16 @@ MODULE_OBJS := \ npcs/summon_bots.o \ npcs/titania.o \ npcs/true_talk_npc.o \ + pet_control/pet_control.o \ + pet_control/pet_control_sub_base.o \ + pet_control/pet_control_sub1.o \ + pet_control/pet_control_sub2.o \ + pet_control/pet_control_sub3.o \ + pet_control/pet_control_sub4.o \ + pet_control/pet_control_sub5.o \ + pet_control/pet_control_sub6.o \ + pet_control/pet_control_sub7.o \ + pet_control/pet_control_sub8.o \ sound/auto_music_player.o \ sound/auto_music_player_base.o \ sound/auto_sound_player.o \ diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp new file mode 100644 index 0000000000..354ed393a8 --- /dev/null +++ b/engines/titanic/pet_control/pet_control.cpp @@ -0,0 +1,79 @@ +/* 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 "titanic/pet_control/pet_control.h" + +namespace Titanic { + +void CPetControl::save(SimpleFile *file, int indent) const { + file->writeNumberLine(0, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + + saveSubObjects(file, indent); + CGameObject::save(file, indent); +} + +void CPetControl::load(SimpleFile *file) { + int val = file->readNumber(); + // TODO: sub_43A9E0 + + if (!val) { + _fieldBC = file->readNumber(); + _string1 = file->readString(); + _string2 = file->readString(); + + loadSubObjects(file); + } + + CGameObject::load(file); +} + +void CPetControl::gameLoaded() { + // TODO +} + +void CPetControl::loadSubObjects(SimpleFile *file) { + _sub1.load(file); + _sub2.load(file); + _sub3.load(file); + _sub4.load(file); + _sub5.load(file); + _sub6.load(file); + _sub7.load(file); + _sub8.load(file); +} + +void CPetControl::saveSubObjects(SimpleFile *file, int indent) const { + _sub1.save(file, indent); + _sub2.save(file, indent); + _sub3.save(file, indent); + _sub4.save(file, indent); + _sub5.save(file, indent); + _sub6.save(file, indent); + _sub7.save(file, indent); + _sub8.save(file, indent); +} + + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h new file mode 100644 index 0000000000..dab44266c4 --- /dev/null +++ b/engines/titanic/pet_control/pet_control.h @@ -0,0 +1,85 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONTROL_H +#define TITANIC_PET_CONTROL_H + +#include "titanic/core/game_object.h" +#include "titanic/pet_control/pet_control_sub1.h" +#include "titanic/pet_control/pet_control_sub2.h" +#include "titanic/pet_control/pet_control_sub3.h" +#include "titanic/pet_control/pet_control_sub4.h" +#include "titanic/pet_control/pet_control_sub5.h" +#include "titanic/pet_control/pet_control_sub6.h" +#include "titanic/pet_control/pet_control_sub7.h" +#include "titanic/pet_control/pet_control_sub8.h" + +namespace Titanic { + +class CPetControl : public CGameObject { +private: + int _fieldBC; + int _fieldC0; + int _fieldC4; + int _fieldC8; + CPetControlSub1 _sub1; + CPetControlSub2 _sub2; + CPetControlSub3 _sub3; + CPetControlSub4 _sub4; + CPetControlSub5 _sub5; + CPetControlSub6 _sub6; + CPetControlSub7 _sub7; + CPetControlSub8 _sub8; + int _field1384; + CString _string1; + int _field1394; + CString _string2; + int _field13A4; +private: + void loadSubObjects(SimpleFile *file); + + void saveSubObjects(SimpleFile *file, int indent) const; +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CPetControl"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); + + /** + * Called after loading a game has finished + */ + void gameLoaded(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_H */ diff --git a/engines/titanic/pet_control/pet_control_sub1.cpp b/engines/titanic/pet_control/pet_control_sub1.cpp new file mode 100644 index 0000000000..808358678a --- /dev/null +++ b/engines/titanic/pet_control/pet_control_sub1.cpp @@ -0,0 +1,35 @@ +/* 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 "titanic/pet_control/pet_control_sub1.h" + +namespace Titanic { + +void CPetControlSub1::save(SimpleFile *file, int indent) const { + +} + +void CPetControlSub1::load(SimpleFile *file) { + +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub1.h b/engines/titanic/pet_control/pet_control_sub1.h new file mode 100644 index 0000000000..5e38523858 --- /dev/null +++ b/engines/titanic/pet_control/pet_control_sub1.h @@ -0,0 +1,45 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONTROL_SUB1_H +#define TITANIC_PET_CONTROL_SUB1_H + +#include "titanic/pet_control/pet_control_sub_base.h" + +namespace Titanic { + +class CPetControlSub1 : public CPetControlSubBase { +public: + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_H */ diff --git a/engines/titanic/pet_control/pet_control_sub2.cpp b/engines/titanic/pet_control/pet_control_sub2.cpp new file mode 100644 index 0000000000..a48869e806 --- /dev/null +++ b/engines/titanic/pet_control/pet_control_sub2.cpp @@ -0,0 +1,35 @@ +/* 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 "titanic/pet_control/pet_control_sub2.h" + +namespace Titanic { + +void CPetControlSub2::save(SimpleFile *file, int indent) const { + +} + +void CPetControlSub2::load(SimpleFile *file) { + +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub2.h b/engines/titanic/pet_control/pet_control_sub2.h new file mode 100644 index 0000000000..a54142c225 --- /dev/null +++ b/engines/titanic/pet_control/pet_control_sub2.h @@ -0,0 +1,45 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONTROL_SUB2_H +#define TITANIC_PET_CONTROL_SUB2_H + +#include "titanic/pet_control/pet_control_sub_base.h" + +namespace Titanic { + +class CPetControlSub2 : public CPetControlSubBase { +public: + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_SUB2_H */ diff --git a/engines/titanic/pet_control/pet_control_sub3.cpp b/engines/titanic/pet_control/pet_control_sub3.cpp new file mode 100644 index 0000000000..2f508be3e6 --- /dev/null +++ b/engines/titanic/pet_control/pet_control_sub3.cpp @@ -0,0 +1,35 @@ +/* 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 "titanic/pet_control/pet_control_sub3.h" + +namespace Titanic { + +void CPetControlSub3::save(SimpleFile *file, int indent) const { + +} + +void CPetControlSub3::load(SimpleFile *file) { + +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub3.h b/engines/titanic/pet_control/pet_control_sub3.h new file mode 100644 index 0000000000..1b37628131 --- /dev/null +++ b/engines/titanic/pet_control/pet_control_sub3.h @@ -0,0 +1,45 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONTROL_SUB3_H +#define TITANIC_PET_CONTROL_SUB3_H + +#include "titanic/pet_control/pet_control_sub_base.h" + +namespace Titanic { + +class CPetControlSub3 : public CPetControlSubBase { +public: + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_SUB3_H */ diff --git a/engines/titanic/pet_control/pet_control_sub4.cpp b/engines/titanic/pet_control/pet_control_sub4.cpp new file mode 100644 index 0000000000..35367a6186 --- /dev/null +++ b/engines/titanic/pet_control/pet_control_sub4.cpp @@ -0,0 +1,35 @@ +/* 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 "titanic/pet_control/pet_control_sub4.h" + +namespace Titanic { + +void CPetControlSub4::save(SimpleFile *file, int indent) const { + +} + +void CPetControlSub4::load(SimpleFile *file) { + +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub4.h b/engines/titanic/pet_control/pet_control_sub4.h new file mode 100644 index 0000000000..b00acffdd9 --- /dev/null +++ b/engines/titanic/pet_control/pet_control_sub4.h @@ -0,0 +1,45 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONTROL_SUB4_H +#define TITANIC_PET_CONTROL_SUB4_H + +#include "titanic/pet_control/pet_control_sub_base.h" + +namespace Titanic { + +class CPetControlSub4 : public CPetControlSubBase { +public: + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_SUB4_H */ diff --git a/engines/titanic/pet_control/pet_control_sub5.cpp b/engines/titanic/pet_control/pet_control_sub5.cpp new file mode 100644 index 0000000000..461fb1ebc1 --- /dev/null +++ b/engines/titanic/pet_control/pet_control_sub5.cpp @@ -0,0 +1,35 @@ +/* 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 "titanic/pet_control/pet_control_sub5.h" + +namespace Titanic { + +void CPetControlSub5::save(SimpleFile *file, int indent) const { + +} + +void CPetControlSub5::load(SimpleFile *file) { + +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub5.h b/engines/titanic/pet_control/pet_control_sub5.h new file mode 100644 index 0000000000..2142a1050c --- /dev/null +++ b/engines/titanic/pet_control/pet_control_sub5.h @@ -0,0 +1,45 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONTROL_SUB5_H +#define TITANIC_PET_CONTROL_SUB5_H + +#include "titanic/pet_control/pet_control_sub_base.h" + +namespace Titanic { + +class CPetControlSub5 : public CPetControlSubBase { +public: + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_SUB5_H */ diff --git a/engines/titanic/pet_control/pet_control_sub6.cpp b/engines/titanic/pet_control/pet_control_sub6.cpp new file mode 100644 index 0000000000..d33ea1f824 --- /dev/null +++ b/engines/titanic/pet_control/pet_control_sub6.cpp @@ -0,0 +1,35 @@ +/* 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 "titanic/pet_control/pet_control_sub6.h" + +namespace Titanic { + +void CPetControlSub6::save(SimpleFile *file, int indent) const { + +} + +void CPetControlSub6::load(SimpleFile *file) { + +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub6.h b/engines/titanic/pet_control/pet_control_sub6.h new file mode 100644 index 0000000000..d26c8f2753 --- /dev/null +++ b/engines/titanic/pet_control/pet_control_sub6.h @@ -0,0 +1,45 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONTROL_SUB6_H +#define TITANIC_PET_CONTROL_SUB6_H + +#include "titanic/pet_control/pet_control_sub_base.h" + +namespace Titanic { + +class CPetControlSub6 : public CPetControlSubBase { +public: + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_SUB6_H */ diff --git a/engines/titanic/pet_control/pet_control_sub7.cpp b/engines/titanic/pet_control/pet_control_sub7.cpp new file mode 100644 index 0000000000..8333dc1508 --- /dev/null +++ b/engines/titanic/pet_control/pet_control_sub7.cpp @@ -0,0 +1,35 @@ +/* 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 "titanic/pet_control/pet_control_sub7.h" + +namespace Titanic { + +void CPetControlSub7::save(SimpleFile *file, int indent) const { + +} + +void CPetControlSub7::load(SimpleFile *file) { + +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub7.h b/engines/titanic/pet_control/pet_control_sub7.h new file mode 100644 index 0000000000..660fe2a542 --- /dev/null +++ b/engines/titanic/pet_control/pet_control_sub7.h @@ -0,0 +1,45 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONTROL_SUB7_H +#define TITANIC_PET_CONTROL_SUB7_H + +#include "titanic/pet_control/pet_control_sub_base.h" + +namespace Titanic { + +class CPetControlSub7 : public CPetControlSubBase { +public: + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_SUB7_H */ diff --git a/engines/titanic/pet_control/pet_control_sub8.cpp b/engines/titanic/pet_control/pet_control_sub8.cpp new file mode 100644 index 0000000000..471630835f --- /dev/null +++ b/engines/titanic/pet_control/pet_control_sub8.cpp @@ -0,0 +1,35 @@ +/* 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 "titanic/pet_control/pet_control_sub8.h" + +namespace Titanic { + +void CPetControlSub8::save(SimpleFile *file, int indent) const { + +} + +void CPetControlSub8::load(SimpleFile *file) { + +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub8.h b/engines/titanic/pet_control/pet_control_sub8.h new file mode 100644 index 0000000000..e6de1f89e1 --- /dev/null +++ b/engines/titanic/pet_control/pet_control_sub8.h @@ -0,0 +1,45 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONTROL_SUB8_H +#define TITANIC_PET_CONTROL_SUB8_H + +#include "titanic/pet_control/pet_control_sub_base.h" + +namespace Titanic { + +class CPetControlSub8 : public CPetControlSubBase { +public: + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_SUB8_H */ diff --git a/engines/titanic/pet_control/pet_control_sub_base.cpp b/engines/titanic/pet_control/pet_control_sub_base.cpp new file mode 100644 index 0000000000..35194317c3 --- /dev/null +++ b/engines/titanic/pet_control/pet_control_sub_base.cpp @@ -0,0 +1,27 @@ +/* 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 "titanic/pet_control/pet_control_sub_base.h" + +namespace Titanic { + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub_base.h b/engines/titanic/pet_control/pet_control_sub_base.h new file mode 100644 index 0000000000..b11f5cc78b --- /dev/null +++ b/engines/titanic/pet_control/pet_control_sub_base.h @@ -0,0 +1,49 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONTROL_SUB_BASE_H +#define TITANIC_PET_CONTROL_SUB_BASE_H + +#include "titanic/simple_file.h" + +namespace Titanic { + +class CPetControlSubBase { +protected: + int _field4; +public: + CPetControlSubBase() : _field4(0) {} + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const = 0; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file) = 0; +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_SUB_BASE_H */ -- cgit v1.2.3 From e03a1106628e2d3e954c67c21bada5eae07c5c7d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 4 Mar 2016 23:37:40 -0500 Subject: TITANIC: Fleshing out CPetControl support classes --- engines/titanic/core/link_item.cpp | 8 ++- engines/titanic/core/link_item.h | 4 +- engines/titanic/module.mk | 9 +++ .../titanic/pet_control/pet_control_list_item.cpp | 27 ++++++++ .../titanic/pet_control/pet_control_list_item.h | 42 +++++++++++++ .../titanic/pet_control/pet_control_list_item2.cpp | 34 ++++++++++ .../titanic/pet_control/pet_control_list_item2.h | 49 +++++++++++++++ engines/titanic/pet_control/pet_control_sub1.cpp | 3 + engines/titanic/pet_control/pet_control_sub1.h | 24 +++++++ engines/titanic/pet_control/pet_control_sub10.cpp | 48 ++++++++++++++ engines/titanic/pet_control/pet_control_sub10.h | 54 ++++++++++++++++ engines/titanic/pet_control/pet_control_sub11.cpp | 27 ++++++++ engines/titanic/pet_control/pet_control_sub11.h | 36 +++++++++++ engines/titanic/pet_control/pet_control_sub12.cpp | 38 +++++++++++ engines/titanic/pet_control/pet_control_sub12.h | 69 ++++++++++++++++++++ engines/titanic/pet_control/pet_control_sub2.cpp | 7 +++ engines/titanic/pet_control/pet_control_sub2.h | 24 +++++++ engines/titanic/pet_control/pet_control_sub3.h | 17 +++++ engines/titanic/pet_control/pet_control_sub4.cpp | 7 +++ engines/titanic/pet_control/pet_control_sub4.h | 14 +++++ engines/titanic/pet_control/pet_control_sub5.h | 12 ++++ engines/titanic/pet_control/pet_control_sub6.h | 5 ++ engines/titanic/pet_control/pet_control_sub7.h | 4 ++ engines/titanic/pet_control/pet_control_sub8.cpp | 9 +++ engines/titanic/pet_control/pet_control_sub8.h | 13 ++++ .../titanic/pet_control/pet_control_sub_base.cpp | 33 ++++++++++ engines/titanic/pet_control/pet_control_sub_base.h | 57 ++++++++++++++++- engines/titanic/pet_control/pet_val.cpp | 61 ++++++++++++++++++ engines/titanic/pet_control/pet_val.h | 50 +++++++++++++++ engines/titanic/pet_control/pet_val_base.cpp | 73 ++++++++++++++++++++++ engines/titanic/pet_control/pet_val_base.h | 67 ++++++++++++++++++++ 31 files changed, 921 insertions(+), 4 deletions(-) create mode 100644 engines/titanic/pet_control/pet_control_list_item.cpp create mode 100644 engines/titanic/pet_control/pet_control_list_item.h create mode 100644 engines/titanic/pet_control/pet_control_list_item2.cpp create mode 100644 engines/titanic/pet_control/pet_control_list_item2.h create mode 100644 engines/titanic/pet_control/pet_control_sub10.cpp create mode 100644 engines/titanic/pet_control/pet_control_sub10.h create mode 100644 engines/titanic/pet_control/pet_control_sub11.cpp create mode 100644 engines/titanic/pet_control/pet_control_sub11.h create mode 100644 engines/titanic/pet_control/pet_control_sub12.cpp create mode 100644 engines/titanic/pet_control/pet_control_sub12.h create mode 100644 engines/titanic/pet_control/pet_val.cpp create mode 100644 engines/titanic/pet_control/pet_val.h create mode 100644 engines/titanic/pet_control/pet_val_base.cpp create mode 100644 engines/titanic/pet_control/pet_val_base.h diff --git a/engines/titanic/core/link_item.cpp b/engines/titanic/core/link_item.cpp index 1d85dfaa7b..9a895b774b 100644 --- a/engines/titanic/core/link_item.cpp +++ b/engines/titanic/core/link_item.cpp @@ -24,9 +24,15 @@ namespace Titanic { -CLinkItemSub::CLinkItemSub() : _field0(0), _field4(0), _field8(0), _fieldC(0) { +void CLinkItemSub::clear() { + _field0 = 0; + _field4 = 0; + _field8 = 0; + _fieldC = 0; } +/*------------------------------------------------------------------------*/ + CLinkItem::CLinkItem() : CNamedItem() { _field24 = -1; _field28 = -1; diff --git a/engines/titanic/core/link_item.h b/engines/titanic/core/link_item.h index 22c07a2132..aeb827e69d 100644 --- a/engines/titanic/core/link_item.h +++ b/engines/titanic/core/link_item.h @@ -34,7 +34,9 @@ public: int _field8; int _fieldC; public: - CLinkItemSub(); + CLinkItemSub() { clear(); } + + void clear(); }; class CLinkItem : public CNamedItem { diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 922878bc8e..62dbdcb89f 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -373,7 +373,11 @@ MODULE_OBJS := \ npcs/titania.o \ npcs/true_talk_npc.o \ pet_control/pet_control.o \ + pet_control/pet_control_list_item.o \ + pet_control/pet_control_list_item2.o \ pet_control/pet_control_sub_base.o \ + pet_control/pet_control_sub_list_item.o \ + pet_control/pet_control_sub_list_item2.o \ pet_control/pet_control_sub1.o \ pet_control/pet_control_sub2.o \ pet_control/pet_control_sub3.o \ @@ -382,6 +386,11 @@ MODULE_OBJS := \ pet_control/pet_control_sub6.o \ pet_control/pet_control_sub7.o \ pet_control/pet_control_sub8.o \ + pet_control/pet_control_sub10.o \ + pet_control/pet_control_sub11.o \ + pet_control/pet_control_sub12.o \ + pet_control/pet_val_base.o \ + pet_control/pet_val.o \ sound/auto_music_player.o \ sound/auto_music_player_base.o \ sound/auto_sound_player.o \ diff --git a/engines/titanic/pet_control/pet_control_list_item.cpp b/engines/titanic/pet_control/pet_control_list_item.cpp new file mode 100644 index 0000000000..ea678754f5 --- /dev/null +++ b/engines/titanic/pet_control/pet_control_list_item.cpp @@ -0,0 +1,27 @@ +/* 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 "titanic/pet_control/pet_control_list_item.h" + +namespace Titanic { + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_list_item.h b/engines/titanic/pet_control/pet_control_list_item.h new file mode 100644 index 0000000000..64808c0309 --- /dev/null +++ b/engines/titanic/pet_control/pet_control_list_item.h @@ -0,0 +1,42 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONTROL_LIST_ITEM_H +#define TITANIC_PET_CONTROL_LIST_ITEM_H + +#include "titanic/core/list.h" +#include "titanic/pet_control/pet_val.h" + +namespace Titanic { + +class CPetControlListItem : public ListItem { +protected: + CPetVal _val; + int _field30; +public: + CPetControlListItem() : _field30(0) {} + +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_LIST_ITEM_H */ diff --git a/engines/titanic/pet_control/pet_control_list_item2.cpp b/engines/titanic/pet_control/pet_control_list_item2.cpp new file mode 100644 index 0000000000..05847a9fe5 --- /dev/null +++ b/engines/titanic/pet_control/pet_control_list_item2.cpp @@ -0,0 +1,34 @@ +/* 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 "titanic/pet_control/pet_control_list_item2.h" + +namespace Titanic { +/* +CPetControlListItem2::CPetControlListItem2(), + _field34(0), _field38(0), _field3C(0), _field40(0), + _field44(0), _field48(0), _field4C(0), _field50(0), + _field54(0), _field58(0), _field5C(0) { +} +*/ + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_list_item2.h b/engines/titanic/pet_control/pet_control_list_item2.h new file mode 100644 index 0000000000..26f32d5371 --- /dev/null +++ b/engines/titanic/pet_control/pet_control_list_item2.h @@ -0,0 +1,49 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONTROL_LIST_ITEM2_H +#define TITANIC_PET_CONTROL_LIST_ITEM2_H + +#include "titanic/pet_control/pet_control_list_item.h" + +namespace Titanic { + +class CPetControlListItem2 : public CPetControlListItem { +protected: + int _field34; + int _field38; + int _field3C; + int _field40; + int _field44; + int _field48; + int _field4C; + int _field50; + int _field54; + int _field58; + int _field5C; +public: + //CPetControlListItem2(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_LIST_ITEM2_H */ diff --git a/engines/titanic/pet_control/pet_control_sub1.cpp b/engines/titanic/pet_control/pet_control_sub1.cpp index 808358678a..7ca6d6ffbc 100644 --- a/engines/titanic/pet_control/pet_control_sub1.cpp +++ b/engines/titanic/pet_control/pet_control_sub1.cpp @@ -24,6 +24,9 @@ namespace Titanic { +CPetControlSub1::CPetControlSub1() : _field414(0), _field418(0) { +} + void CPetControlSub1::save(SimpleFile *file, int indent) const { } diff --git a/engines/titanic/pet_control/pet_control_sub1.h b/engines/titanic/pet_control/pet_control_sub1.h index 5e38523858..fbe1bbb510 100644 --- a/engines/titanic/pet_control/pet_control_sub1.h +++ b/engines/titanic/pet_control/pet_control_sub1.h @@ -24,11 +24,35 @@ #define TITANIC_PET_CONTROL_SUB1_H #include "titanic/pet_control/pet_control_sub_base.h" +#include "titanic/pet_control/pet_control_sub12.h" +#include "titanic/pet_control/pet_val.h" namespace Titanic { class CPetControlSub1 : public CPetControlSubBase { +private: + CPetVal _val1; + CPetVal _val2; + CPetVal _val3; + CPetVal _valArray1[3]; + CPetVal _val4; + CPetVal _val5; + CPetVal _val6; + CPetControlSubData _field14C; + CPetVal _val7; + CPetVal _val8; + CPetVal _val9; + CPetVal _valArray2[9]; + int _field30C; + CPetControlSub12 _sub1; + CPetControlSub12 _sub2; + int _valArray3[3]; + int _field414; + int _field418; + CString _string1; public: + CPetControlSub1(); + /** * Save the data for the class to file */ diff --git a/engines/titanic/pet_control/pet_control_sub10.cpp b/engines/titanic/pet_control/pet_control_sub10.cpp new file mode 100644 index 0000000000..226ac4ec8b --- /dev/null +++ b/engines/titanic/pet_control/pet_control_sub10.cpp @@ -0,0 +1,48 @@ +/* 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/textconsole.h" +#include "titanic/pet_control/pet_control_sub10.h" + +namespace Titanic { + +CPetControlSub10::CPetControlSub10() : _field10(0), _field14(7), + _field18(-1), _field1C(-1), _field20(0), _field24(0) { +} + +void CPetControlSub10::proc8() { + error("TODO"); +} + +void CPetControlSub10::proc9() { + error("TODO"); +} + +void CPetControlSub10::proc10() { + error("TODO"); +} + +void CPetControlSub10::proc11() { + error("TODO"); +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub10.h b/engines/titanic/pet_control/pet_control_sub10.h new file mode 100644 index 0000000000..f8534d7089 --- /dev/null +++ b/engines/titanic/pet_control/pet_control_sub10.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONTROL_SUB10_H +#define TITANIC_PET_CONTROL_SUB10_H + +#include "titanic/core/list.h" +#include "titanic/pet_control/pet_control_sub10.h" +#include "titanic/pet_control/pet_control_list_item.h" + +namespace Titanic { + +class CPetControlSub10 : public List { +protected: + int _field10; + int _field14; + int _field18; + int _field1C; + int _field20; + int _field24; + CPetVal _val1; + CPetVal _val2; + CPetVal _val3; +public: + CPetControlSub10(); + + virtual void proc8(); + virtual void proc9(); + virtual void proc10(); + virtual void proc11(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_SUB10_H */ diff --git a/engines/titanic/pet_control/pet_control_sub11.cpp b/engines/titanic/pet_control/pet_control_sub11.cpp new file mode 100644 index 0000000000..5148d1267a --- /dev/null +++ b/engines/titanic/pet_control/pet_control_sub11.cpp @@ -0,0 +1,27 @@ +/* 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 "titanic/pet_control/pet_control_sub11.h" + +namespace Titanic { + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub11.h b/engines/titanic/pet_control/pet_control_sub11.h new file mode 100644 index 0000000000..ebad13bff5 --- /dev/null +++ b/engines/titanic/pet_control/pet_control_sub11.h @@ -0,0 +1,36 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONTROL_SUB11_H +#define TITANIC_PET_CONTROL_SUB11_H + +#include "titanic/pet_control/pet_control_sub10.h" + +namespace Titanic { + +class CPetControlSub11 : public CPetControlSub10 { +public: +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_SUB11_H */ diff --git a/engines/titanic/pet_control/pet_control_sub12.cpp b/engines/titanic/pet_control/pet_control_sub12.cpp new file mode 100644 index 0000000000..1e8d62834e --- /dev/null +++ b/engines/titanic/pet_control/pet_control_sub12.cpp @@ -0,0 +1,38 @@ +/* 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(0), you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation(0), 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(0), 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(0), if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/pet_control/pet_control_sub12.h" + +namespace Titanic { + +CPetControlSub12::CPetControlSub12() : + _field0(0), _field4(0), _field8(0), _field18(0), + _field1C(0), _field20(0), _field24(0), _field28(0), + _field2C(0), _field30(0), _field34(0), _field38(0), + _field3C(0), _field40(0), _field44(0), _field48(0), + _field4C(0), _field50(0), _field54(0), _field58(0), + _field5C(0), _field60(0), _field64(0), _field68(0), + _field6C(0), _field70(0), _field74(0), _field78(0), + _field7C(0) { +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub12.h b/engines/titanic/pet_control/pet_control_sub12.h new file mode 100644 index 0000000000..b90c451d5e --- /dev/null +++ b/engines/titanic/pet_control/pet_control_sub12.h @@ -0,0 +1,69 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONTROL_SUB12_H +#define TITANIC_PET_CONTROL_SUB12_H + +#include "titanic/simple_file.h" + +namespace Titanic { + +class CPetControlSub12 { +protected: + int _field0; + int _field4; + int _field8; + CString _string1; + int _field18; + int _field1C; + int _field20; + int _field24; + int _field28; + int _field2C; + int _field30; + int _field34; + int _field38; + int _field3C; + int _field40; + int _field44; + int _field48; + int _field4C; + int _field50; + int _field54; + int _field58; + int _field5C; + int _field60; + int _field64; + int _field68; + int _field6C; + int _field70; + int _field74; + int _field78; + int _field7C; +public: + CPetControlSub12(); + +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONTROL_SUB12_H */ diff --git a/engines/titanic/pet_control/pet_control_sub2.cpp b/engines/titanic/pet_control/pet_control_sub2.cpp index a48869e806..84896bb939 100644 --- a/engines/titanic/pet_control/pet_control_sub2.cpp +++ b/engines/titanic/pet_control/pet_control_sub2.cpp @@ -24,6 +24,13 @@ namespace Titanic { +CPetControlSub2::CPetControlSub2() : + _field100(0), _field104(0), _field108(0), _field10C(0), + _field110(0), _field114(0), _field118(0), _field11C(0), + _field1C0(0), _field1C4(0), _field1C8(0), _field1CC(0), + _field1D0(0), _field1D4(0) { +} + void CPetControlSub2::save(SimpleFile *file, int indent) const { } diff --git a/engines/titanic/pet_control/pet_control_sub2.h b/engines/titanic/pet_control/pet_control_sub2.h index a54142c225..46ad1acacc 100644 --- a/engines/titanic/pet_control/pet_control_sub2.h +++ b/engines/titanic/pet_control/pet_control_sub2.h @@ -24,11 +24,35 @@ #define TITANIC_PET_CONTROL_SUB2_H #include "titanic/pet_control/pet_control_sub_base.h" +#include "titanic/pet_control/pet_control_sub11.h" +#include "titanic/pet_control/pet_control_sub12.h" +#include "titanic/pet_control/pet_control_list_item2.h" namespace Titanic { class CPetControlSub2 : public CPetControlSubBase { +private: + CPetControlSub11 _sub11; + CPetControlListItem2 _listItem; + int _field100; + int _field104; + int _field108; + int _field10C; + int _field110; + int _field114; + int _field118; + int _field11C; + CPetVal _val1; + CPetControlSub12 _sub12; + int _field1C0; + int _field1C4; + int _field1C8; + int _field1CC; + int _field1D0; + int _field1D4; public: + CPetControlSub2(); + /** * Save the data for the class to file */ diff --git a/engines/titanic/pet_control/pet_control_sub3.h b/engines/titanic/pet_control/pet_control_sub3.h index 1b37628131..b5eebb1fb6 100644 --- a/engines/titanic/pet_control/pet_control_sub3.h +++ b/engines/titanic/pet_control/pet_control_sub3.h @@ -24,10 +24,27 @@ #define TITANIC_PET_CONTROL_SUB3_H #include "titanic/pet_control/pet_control_sub_base.h" +#include "titanic/pet_control/pet_control_sub10.h" +#include "titanic/pet_control/pet_control_sub12.h" +#include "titanic/pet_control/pet_val.h" namespace Titanic { class CPetControlSub3 : public CPetControlSubBase { +private: + CPetControlSub10 _sub10; + CPetVal _val1; + CPetVal _val2; + CPetVal _val3; + CPetVal _val4; + CPetVal _val5; + CPetVal _val6; + CPetVal _val7; + CPetVal _val8; + CPetVal _val9; + CPetVal _val10; + CPetVal _val11; + CPetControlSub12 _sub12; public: /** * Save the data for the class to file diff --git a/engines/titanic/pet_control/pet_control_sub4.cpp b/engines/titanic/pet_control/pet_control_sub4.cpp index 35367a6186..49e5cb23fd 100644 --- a/engines/titanic/pet_control/pet_control_sub4.cpp +++ b/engines/titanic/pet_control/pet_control_sub4.cpp @@ -24,6 +24,13 @@ namespace Titanic { +CPetControlSub4::CPetControlSub4() : _field28C(0), + _field290(0), _field294(0), _field298(0) { + for (int idx = 0; idx < 46; ++idx) { + _valArray1[idx] = _valArray2[idx] = 0; + } +} + void CPetControlSub4::save(SimpleFile *file, int indent) const { } diff --git a/engines/titanic/pet_control/pet_control_sub4.h b/engines/titanic/pet_control/pet_control_sub4.h index b00acffdd9..b5de13b468 100644 --- a/engines/titanic/pet_control/pet_control_sub4.h +++ b/engines/titanic/pet_control/pet_control_sub4.h @@ -23,12 +23,26 @@ #ifndef TITANIC_PET_CONTROL_SUB4_H #define TITANIC_PET_CONTROL_SUB4_H +#include "titanic/simple_file.h" #include "titanic/pet_control/pet_control_sub_base.h" +#include "titanic/pet_control/pet_control_sub10.h" +#include "titanic/pet_control/pet_control_sub12.h" namespace Titanic { class CPetControlSub4 : public CPetControlSubBase { +private: + CPetControlSub12 _sub12; + CPetControlSub10 _sub10; + int _valArray1[46]; + int _valArray2[46]; + int _field28C; + int _field290; + int _field294; + int _field298; public: + CPetControlSub4(); + /** * Save the data for the class to file */ diff --git a/engines/titanic/pet_control/pet_control_sub5.h b/engines/titanic/pet_control/pet_control_sub5.h index 2142a1050c..41b37fd7b2 100644 --- a/engines/titanic/pet_control/pet_control_sub5.h +++ b/engines/titanic/pet_control/pet_control_sub5.h @@ -24,10 +24,22 @@ #define TITANIC_PET_CONTROL_SUB5_H #include "titanic/pet_control/pet_control_sub_base.h" +#include "titanic/pet_control/pet_val.h" namespace Titanic { class CPetControlSub5 : public CPetControlSubBase { +private: + CPetVal _val1; + CPetVal _val2; + CPetVal _val3; + CPetVal _val4; + CPetControlSubData _field17C; + int _field98; + int _field9C; + int _fieldA0; + CPetVal _valArray1[6]; + public: /** * Save the data for the class to file diff --git a/engines/titanic/pet_control/pet_control_sub6.h b/engines/titanic/pet_control/pet_control_sub6.h index d26c8f2753..93f83c2d6b 100644 --- a/engines/titanic/pet_control/pet_control_sub6.h +++ b/engines/titanic/pet_control/pet_control_sub6.h @@ -24,10 +24,15 @@ #define TITANIC_PET_CONTROL_SUB6_H #include "titanic/pet_control/pet_control_sub_base.h" +#include "titanic/pet_control/pet_control_sub10.h" +#include "titanic/pet_control/pet_control_sub12.h" namespace Titanic { class CPetControlSub6 : public CPetControlSubBase { +private: + CPetControlSub10 _sub10; + CPetControlSub10 _sub12; public: /** * Save the data for the class to file diff --git a/engines/titanic/pet_control/pet_control_sub7.h b/engines/titanic/pet_control/pet_control_sub7.h index 660fe2a542..d74ac3c405 100644 --- a/engines/titanic/pet_control/pet_control_sub7.h +++ b/engines/titanic/pet_control/pet_control_sub7.h @@ -24,10 +24,14 @@ #define TITANIC_PET_CONTROL_SUB7_H #include "titanic/pet_control/pet_control_sub_base.h" +#include "titanic/pet_control/pet_control_sub12.h" namespace Titanic { class CPetControlSub7 : public CPetControlSubBase { +private: + CPetControlSub12 _sub1; + CPetControlSub12 _sub2; public: /** * Save the data for the class to file diff --git a/engines/titanic/pet_control/pet_control_sub8.cpp b/engines/titanic/pet_control/pet_control_sub8.cpp index 471630835f..c2b0f7f67f 100644 --- a/engines/titanic/pet_control/pet_control_sub8.cpp +++ b/engines/titanic/pet_control/pet_control_sub8.cpp @@ -24,6 +24,15 @@ namespace Titanic { +static const int INDEXES[6] = { 1, 0, 2, 3, 4, 5 }; + +int CPetControlSub8::_indexes[6]; + +CPetControlSub8::CPetControlSub8() { + for (int idx = 0; idx < 6; ++idx) + _indexes[INDEXES[idx]] = idx; +} + void CPetControlSub8::save(SimpleFile *file, int indent) const { } diff --git a/engines/titanic/pet_control/pet_control_sub8.h b/engines/titanic/pet_control/pet_control_sub8.h index e6de1f89e1..391d4cf1fa 100644 --- a/engines/titanic/pet_control/pet_control_sub8.h +++ b/engines/titanic/pet_control/pet_control_sub8.h @@ -24,11 +24,24 @@ #define TITANIC_PET_CONTROL_SUB8_H #include "titanic/pet_control/pet_control_sub_base.h" +#include "titanic/pet_control/pet_val.h" namespace Titanic { class CPetControlSub8 : public CPetControlSubBase { +private: + static int _indexes[6]; + + CPetVal _valArray1[6]; + CPetVal _valArray2[6]; + CPetVal _val1; + CPetVal _val2; + CPetVal _val3; + CPetVal _val4; + CPetVal _valArray3[7]; public: + CPetControlSub8(); + /** * Save the data for the class to file */ diff --git a/engines/titanic/pet_control/pet_control_sub_base.cpp b/engines/titanic/pet_control/pet_control_sub_base.cpp index 35194317c3..05a3425b5f 100644 --- a/engines/titanic/pet_control/pet_control_sub_base.cpp +++ b/engines/titanic/pet_control/pet_control_sub_base.cpp @@ -20,8 +20,41 @@ * */ +#include "common/textconsole.h" #include "titanic/pet_control/pet_control_sub_base.h" namespace Titanic { +void CPetControlSubBase::proc4() { + error("TODO"); +} + +void CPetControlSubBase::proc16() { + error("TODO"); +} + +void CPetControlSubBase::proc25() { + error("TODO"); +} + +void CPetControlSubBase::proc27() { + error("TODO"); +} + +void CPetControlSubBase::proc28() { + error("TODO"); +} + +void CPetControlSubBase::proc29() { + error("TODO"); +} + +void CPetControlSubBase::proc30() { + error("TODO"); +} + +void CPetControlSubBase::proc31() { + error("TODO"); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub_base.h b/engines/titanic/pet_control/pet_control_sub_base.h index b11f5cc78b..85423820f4 100644 --- a/engines/titanic/pet_control/pet_control_sub_base.h +++ b/engines/titanic/pet_control/pet_control_sub_base.h @@ -27,21 +27,74 @@ namespace Titanic { +struct CPetControlSubData { + int _field0; + int _field4; + int _field8; + int _fieldC; + + CPetControlSubData() : _field0(0), _field4(0), + _field8(0), _fieldC(0) {} +}; + class CPetControlSubBase { protected: int _field4; public: CPetControlSubBase() : _field4(0) {} + virtual int proc1() { return 0; } + virtual int proc2() { return 0; } + virtual void proc3() {} + virtual void proc4(); + virtual void proc5() {} + virtual int proc6() { return 0; } + virtual int proc7() { return 0; } + virtual int proc8() { return 0; } + virtual int proc9() { return 0; } + virtual int proc10() { return 0; } + virtual int proc11() { return 0; } + virtual int proc12() { return 0; } + virtual int proc13() { return 0; } + virtual int proc14() { return 0; } + virtual int proc15() { return 0; } + virtual void proc16(); + /** - * Save the data for the class to file + * Returns true if the object is in a valid state */ - virtual void save(SimpleFile *file, int indent) const = 0; + virtual bool isValid() const { return false; } /** * Load the data for the class from file */ virtual void load(SimpleFile *file) = 0; + + virtual void proc19() {} + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const = 0; + + virtual void proc21() {} + virtual void proc22() {} + virtual void proc23() {} + virtual void proc24() {} + virtual void proc25(); + virtual int proc26() { return 0; } + virtual void proc27(); + virtual void proc28(); + virtual void proc29(); + virtual void proc30(); + virtual void proc31(); + virtual void proc32() {} + virtual void proc33() {} + virtual void proc34() {} + virtual void proc35() {} + virtual void proc36() {} + virtual void proc37() {} + virtual void proc38() {} }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_val.cpp b/engines/titanic/pet_control/pet_val.cpp new file mode 100644 index 0000000000..f3ee2bf9bf --- /dev/null +++ b/engines/titanic/pet_control/pet_val.cpp @@ -0,0 +1,61 @@ +/* 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/textconsole.h" +#include "titanic/pet_control/pet_val.h" + +namespace Titanic { + +void CPetVal::proc1() { + error("TODO"); +} + +void CPetVal::proc2() { + error("TODO"); +} + +void CPetVal::proc3() { + error("TODO"); +} + +void CPetVal::proc4() { + error("TODO"); +} + +void CPetVal::proc5(CLinkItemSub *linkItem) { + error("TODO"); +} + +int CPetVal::proc16() { + switch (!_field14) { + case 0: + return _field18; + case 1: + return _field1C; + case 2: + return _field20; + default: + return 0; + } +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_val.h b/engines/titanic/pet_control/pet_val.h new file mode 100644 index 0000000000..f1f9bd1f3c --- /dev/null +++ b/engines/titanic/pet_control/pet_val.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_VAL_H +#define TITANIC_PET_VAL_H + +#include "titanic/pet_control/pet_val_base.h" + +namespace Titanic { + +class CPetVal: public CPetValBase { +protected: + int _field18; + int _field1C; + int _field20; +public: + CPetVal() : CPetValBase(), _field18(0), _field1C(0), _field20(0) {} + + virtual void proc1(); + virtual void proc2(); + virtual void proc3(); + virtual void proc4(); + + virtual void proc5(CLinkItemSub *linkItem); + + virtual int proc16(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_VAL_H */ diff --git a/engines/titanic/pet_control/pet_val_base.cpp b/engines/titanic/pet_control/pet_val_base.cpp new file mode 100644 index 0000000000..fed1b0d709 --- /dev/null +++ b/engines/titanic/pet_control/pet_val_base.cpp @@ -0,0 +1,73 @@ +/* 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/textconsole.h" +#include "titanic/pet_control/pet_val_base.h" + +namespace Titanic { + +void CPetValBase::proc5(CLinkItemSub *linkItem) { + if (linkItem) + linkItem->clear(); +} + +int CPetValBase::proc6() { + error("TODO"); +} + +int CPetValBase::proc7() { + error("TODO"); +} + +void CPetValBase::proc8() { + error("TODO"); +} + +int CPetValBase::proc9() { + error("TODO"); +} + +void CPetValBase::proc10() { + error("TODO"); +} + +void CPetValBase::proc11() { + error("TODO"); +} + +void CPetValBase::proc12() { + error("TODO"); +} + +void CPetValBase::proc13() { + error("TODO"); +} + +void CPetValBase::proc14() { + error("TODO"); +} + +void CPetValBase::proc15() { + error("TODO"); +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_val_base.h b/engines/titanic/pet_control/pet_val_base.h new file mode 100644 index 0000000000..a2701149a7 --- /dev/null +++ b/engines/titanic/pet_control/pet_val_base.h @@ -0,0 +1,67 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_VAL_BASE_H +#define TITANIC_PET_VAL_BASE_H + +#include "titanic/simple_file.h" +#include "titanic/core/link_item.h" + +namespace Titanic { + +class CPetValBase { +protected: + int _field4; + int _field8; + int _fieldC; + int _field10; + int _field14; +public: + CPetValBase() : _field4(0), _field8(0), _fieldC(0), + _field10(0), _field14(0) {} + + virtual void proc1() {} + virtual void proc2() {} + virtual void proc3() {} + virtual void proc4() {} + + virtual void proc5(CLinkItemSub *linkItem); + + virtual int proc6(); + virtual int proc7(); + virtual void proc8(); + virtual int proc9(); + virtual void proc10(); + virtual void proc11(); + virtual void proc12(); + virtual void proc13(); + virtual void proc14(); + virtual void proc15(); + + virtual int proc16() { return 0; } + + virtual void proc17(int v) { _field14 = v; } +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_VAL_BASE_H */ -- cgit v1.2.3 From 5bdb873c47be734a6086510a6c8ff4cae19db21c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 5 Mar 2016 00:04:26 -0500 Subject: TITANIC: gcc compilation fixes --- engines/titanic/core/list.h | 7 +- engines/titanic/core/saveable_object.cpp | 1064 ++++++++++---------- engines/titanic/core/saveable_object.h | 2 + engines/titanic/image.h | 1 + engines/titanic/messages/door_auto_sound_event.h | 2 +- engines/titanic/messages/pet_messages.h | 2 +- engines/titanic/module.mk | 1 - engines/titanic/pet_control/pet_control_sub_base.h | 1 + engines/titanic/pet_control/pet_val_base.h | 1 + engines/titanic/simple_file.cpp | 6 +- 10 files changed, 546 insertions(+), 541 deletions(-) diff --git a/engines/titanic/core/list.h b/engines/titanic/core/list.h index d990aec2fa..00474b9f23 100644 --- a/engines/titanic/core/list.h +++ b/engines/titanic/core/list.h @@ -70,7 +70,7 @@ public: file->writeNumberLine(Common::List::size(), indent); // Iterate through writing entries - Common::List::const_iterator i; + typename Common::List::const_iterator i; for (i = Common::List::begin(); i != Common::List::end(); ++i) { const ListItem *item = *i; item->saveHeader(file, indent); @@ -115,7 +115,8 @@ public: * Clear the list and destroy any items in it */ void destroyContents() { - for (Common::List::iterator i = Common::List::begin(); + typename Common::List::iterator i; + for (i = Common::List::begin(); i != Common::List::end(); ++i) { CSaveableObject *obj = *i; delete obj; @@ -127,7 +128,7 @@ public: /** * Add a new item to the list of the type the list contains */ - T *List::add() { + T *add() { T *item = new T(); Common::List::push_back(item); return item; diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index dcd47b78a4..5a60798d9f 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -399,546 +399,546 @@ Common::HashMap * #define DEFFN(T) CSaveableObject *Function##T() { return new T(); } #define ADDFN(T) (*_classList)[#T] = Function##T -DEFFN(CArm); -DEFFN(CAuditoryCentre); -DEFFN(CBowlEar); -DEFFN(CBrain); -DEFFN(CBridgePiece); -DEFFN(CCarry); -DEFFN(CCarryParrot); -DEFFN(CCentralCore); -DEFFN(CChicken); -DEFFN(CChickenCooler); -DEFFN(CCrushedTV); -DEFFN(CEar); -DEFFN(CEye); -DEFFN(CFeathers); -DEFFN(CFruit); -DEFFN(CGlass); -DEFFN(CHammer); -DEFFN(CHeadPiece); -DEFFN(CHose); -DEFFN(CHoseEnd); -DEFFN(CKey); -DEFFN(CLiftbotHead); -DEFFN(CLongStick); -DEFFN(CMagazine); -DEFFN(CMaitreDLeftArm); -DEFFN(CMaitreDRightArm); -DEFFN(CMouth); -DEFFN(CNapkin); -DEFFN(CNose); -DEFFN(CNote); -DEFFN(CParcel); -DEFFN(CPerch); -DEFFN(CPhonographCylinder); -DEFFN(CPhonographEar); -DEFFN(CPhotograph); -DEFFN(CPlugIn); -DEFFN(CSpeechCentre); -DEFFN(CSweets); -DEFFN(CVisionCentre); +DEFFN(CArm) +DEFFN(CAuditoryCentre) +DEFFN(CBowlEar) +DEFFN(CBrain) +DEFFN(CBridgePiece) +DEFFN(CCarry) +DEFFN(CCarryParrot) +DEFFN(CCentralCore) +DEFFN(CChicken) +DEFFN(CChickenCooler) +DEFFN(CCrushedTV) +DEFFN(CEar) +DEFFN(CEye) +DEFFN(CFeathers) +DEFFN(CFruit) +DEFFN(CGlass) +DEFFN(CHammer) +DEFFN(CHeadPiece) +DEFFN(CHose) +DEFFN(CHoseEnd) +DEFFN(CKey) +DEFFN(CLiftbotHead) +DEFFN(CLongStick) +DEFFN(CMagazine) +DEFFN(CMaitreDLeftArm) +DEFFN(CMaitreDRightArm) +DEFFN(CMouth) +DEFFN(CNapkin) +DEFFN(CNose) +DEFFN(CNote) +DEFFN(CParcel) +DEFFN(CPerch) +DEFFN(CPhonographCylinder) +DEFFN(CPhonographEar) +DEFFN(CPhotograph) +DEFFN(CPlugIn) +DEFFN(CSpeechCentre) +DEFFN(CSweets) +DEFFN(CVisionCentre) -DEFFN(CBackground); -DEFFN(CClickResponder); -DEFFN(CDontSaveFileItem); -DEFFN(CDropTarget); -DEFFN(CFileItem); -DEFFN(CFileListItem); -DEFFN(CLinkItem); -DEFFN(CMessageTarget); -DEFFN(CMovieClip); -DEFFN(CMovieClipList); -DEFFN(CMultiDropTarget); -DEFFN(CNodeItem); -DEFFN(CProjectItem); -DEFFN(CStaticImage); -DEFFN(CTurnOnObject); -DEFFN(CTurnOnPlaySound); -DEFFN(CTurnOnTurnOff); -DEFFN(CTreeItem); -DEFFN(CViewItem); +DEFFN(CBackground) +DEFFN(CClickResponder) +DEFFN(CDontSaveFileItem) +DEFFN(CDropTarget) +DEFFN(CFileItem) +DEFFN(CFileListItem) +DEFFN(CLinkItem) +DEFFN(CMessageTarget) +DEFFN(CMovieClip) +DEFFN(CMovieClipList) +DEFFN(CMultiDropTarget) +DEFFN(CNodeItem) +DEFFN(CProjectItem) +DEFFN(CStaticImage) +DEFFN(CTurnOnObject) +DEFFN(CTurnOnPlaySound) +DEFFN(CTurnOnTurnOff) +DEFFN(CTreeItem) +DEFFN(CViewItem) -DEFFN(CAnnounce); -DEFFN(CAnnoyBarbot); -DEFFN(CArbBackground); -DEFFN(CArboretumGate); -DEFFN(CAutoAnimate); -DEFFN(CBarBell); -DEFFN(CBarMenu); -DEFFN(CBarMenuButton); -DEFFN(CBelbotGetLight); -DEFFN(CBilgeSuccUBus); -DEFFN(CBomb); -DEFFN(CBottomOfWellMonitor); -DEFFN(CBowlUnlocker); -DEFFN(CBrainSlot); -DEFFN(CBridgeView); +DEFFN(CAnnounce) +DEFFN(CAnnoyBarbot) +DEFFN(CArbBackground) +DEFFN(CArboretumGate) +DEFFN(CAutoAnimate) +DEFFN(CBarBell) +DEFFN(CBarMenu) +DEFFN(CBarMenuButton) +DEFFN(CBelbotGetLight) +DEFFN(CBilgeSuccUBus) +DEFFN(CBomb) +DEFFN(CBottomOfWellMonitor) +DEFFN(CBowlUnlocker) +DEFFN(CBrainSlot) +DEFFN(CBridgeView) DEFFN(CBrokenPellBase) -DEFFN(CBrokenPellerator); -DEFFN(CBrokenPelleratorFroz); -DEFFN(CCage); -DEFFN(CCallPellerator); -DEFFN(CCaptainsWheel); -DEFFN(CCDROM); -DEFFN(CCDROMComputer); -DEFFN(CCDROMTray); -DEFFN(CCellPointButton); -DEFFN(CChickenDispensor); -DEFFN(CCloseBrokenPel); -DEFFN(CodeWheel); -DEFFN(CComputer); -DEFFN(CCookie); -DEFFN(CComputerScreen); -DEFFN(CCredits); -DEFFN(CCreditsButton); -DEFFN(CDeadArea); -DEFFN(CDeskClickResponder); -DEFFN(CDoorbotElevatorHandler); -DEFFN(CDoorbotHomeHandler); -DEFFN(CEarSweetBowl); -DEFFN(CEjectPhonographButton); -DEFFN(CElevatorActionArea); -DEFFN(CEmmaControl); -DEFFN(CEmptyNutBowl); -DEFFN(CEndCreditText); -DEFFN(CEndCredits); -DEFFN(CEndExplodeShip); -DEFFN(CEndGameCredits); -DEFFN(CEndSequenceControl); -DEFFN(CFan); -DEFFN(CFanControl); -DEFFN(CFanDecrease); -DEFFN(CFanIncrease); -DEFFN(CFanNoises); -DEFFN(CFloorIndicator); -DEFFN(CGamesConsole); -DEFFN(CGetLiftEye2); -DEFFN(CGlassSmasher); -DEFFN(CHammerClip); -DEFFN(CHammerDispensor); -DEFFN(CHammerDispensorButton); -DEFFN(CHeadSlot); -DEFFN(CHeadSmashEvent); -DEFFN(CHeadSmashLever); -DEFFN(CIdleSummoner); -DEFFN(CLemonDispensor); -DEFFN(CLight); -DEFFN(CLightSwitch); -DEFFN(CLittleLiftButton); -DEFFN(CLongStickDispenser); -DEFFN(CMissiveOMat); -DEFFN(CMissiveOMatButton); -DEFFN(CMusicalInstrument); -DEFFN(CMusicConsoleButton); -DEFFN(CMusicRoomPhonograph); -DEFFN(CMusicRoomStopPhonographButton); -DEFFN(CMusicSystemLock); -DEFFN(CNavHelmet); -DEFFN(CNavigationComputer); -DEFFN(CNoNutBowl); -DEFFN(CNoseHolder); -DEFFN(CNullPortHole); -DEFFN(CNutReplacer); -DEFFN(CPetDisabler); -DEFFN(CPhonograph); -DEFFN(CPhonographLid); -DEFFN(CPlayMusicButton); -DEFFN(CPlayOnAct); -DEFFN(CPortHole); -DEFFN(CRecordPhonographButton); -DEFFN(CReplacementEar); -DEFFN(CReservedTable); -DEFFN(CRestaurantCylinderHolder); -DEFFN(CRestaurantPhonograph); -DEFFN(CRoomItem); -DEFFN(CSauceDispensor); -DEFFN(CSearchPoint); -DEFFN(CSeasonBackground); -DEFFN(CSeasonBarrel); -DEFFN(CSeasonalAdjustment); -DEFFN(CServiceElevatorWindow); -DEFFN(CShipSetting); -DEFFN(CShipSettingButton); -DEFFN(CShowCellpoints); -DEFFN(CSpeechDispensor); -DEFFN(CStarlingPuret); -DEFFN(CStartAction); -DEFFN(CStopPhonographButton); -DEFFN(CSUBGlass); -DEFFN(CSweetBowl); -DEFFN(CTelevision); -DEFFN(CThirdClassCanal); -DEFFN(CThrowTVDownWell); -DEFFN(CTitaniaStillControl); -DEFFN(CTOWParrotNav); -DEFFN(CUpLighter); -DEFFN(CUselessLever); -DEFFN(CWheelButton); -DEFFN(CWheelHotSpot); -DEFFN(CWheelSpin); -DEFFN(CWheelSpinHorn); -DEFFN(CGondolierBase); -DEFFN(CGondolierChest); -DEFFN(CGondolierFace); -DEFFN(CGondolierMixer); -DEFFN(CGondolierSlider); -DEFFN(CMaitreDArmHolder); -DEFFN(CMaitreDBody); -DEFFN(CMaitreDLegs); -DEFFN(CMaitreDProdReceptor); -DEFFN(CParrotLobbyController); -DEFFN(CParrotLobbyLinkUpdater); -DEFFN(CParrotLobbyObject); -DEFFN(CParrotLobbyViewObject); -DEFFN(CParrotLoser); -DEFFN(CParrotNutBowlActor); -DEFFN(CParrotNutEater); -DEFFN(CParrotPerchHolder); -DEFFN(CParrotSuccUBus); -DEFFN(CParrotTrigger); -DEFFN(CPlayerMeetsParrot); -DEFFN(CPET); -DEFFN(CPETClass1); -DEFFN(CPETClass2); -DEFFN(CPETClass3); -DEFFN(CPetControl); -DEFFN(CPetDragChev); -DEFFN(CPetGraphic); -DEFFN(CPetGraphic2); -DEFFN(PETLeaf); -DEFFN(CPETLift); -DEFFN(CPETMonitor); -DEFFN(CPETPellerator); -DEFFN(CPETPosition); -DEFFN(CPETSentinal); -DEFFN(CPETSounds); -DEFFN(CPETTransition); -DEFFN(CPETTransport); -DEFFN(CPickUp); -DEFFN(CPickUpBarGlass); -DEFFN(CPickUpHose); -DEFFN(CPickUpLemon); -DEFFN(CPickUpSpeechCentre); -DEFFN(CPickUpVisCentre); -DEFFN(CBarShelfVisCentre); -DEFFN(CLemonOnBar); -DEFFN(CPlaceHolder); -DEFFN(CTVOnBar); -DEFFN(CArmchair); -DEFFN(CBasin); -DEFFN(CBedfoot); -DEFFN(CBedhead); -DEFFN(CChestOfDrawers); -DEFFN(CDesk); -DEFFN(CDeskchair); -DEFFN(CDrawer); -DEFFN(CSGTDoors); -DEFFN(SGTNav); -DEFFN(CSGTNavigation); -DEFFN(CSGTRestaurantDoors); -DEFFN(CSGTStateControl); -DEFFN(CSGTStateRoom); -DEFFN(CSGTTV); -DEFFN(CSGTUpperDoorsSound); -DEFFN(CToilet); -DEFFN(CVase); -DEFFN(CWashstand); +DEFFN(CBrokenPellerator) +DEFFN(CBrokenPelleratorFroz) +DEFFN(CCage) +DEFFN(CCallPellerator) +DEFFN(CCaptainsWheel) +DEFFN(CCDROM) +DEFFN(CCDROMComputer) +DEFFN(CCDROMTray) +DEFFN(CCellPointButton) +DEFFN(CChickenDispensor) +DEFFN(CCloseBrokenPel) +DEFFN(CodeWheel) +DEFFN(CComputer) +DEFFN(CCookie) +DEFFN(CComputerScreen) +DEFFN(CCredits) +DEFFN(CCreditsButton) +DEFFN(CDeadArea) +DEFFN(CDeskClickResponder) +DEFFN(CDoorbotElevatorHandler) +DEFFN(CDoorbotHomeHandler) +DEFFN(CEarSweetBowl) +DEFFN(CEjectPhonographButton) +DEFFN(CElevatorActionArea) +DEFFN(CEmmaControl) +DEFFN(CEmptyNutBowl) +DEFFN(CEndCreditText) +DEFFN(CEndCredits) +DEFFN(CEndExplodeShip) +DEFFN(CEndGameCredits) +DEFFN(CEndSequenceControl) +DEFFN(CFan) +DEFFN(CFanControl) +DEFFN(CFanDecrease) +DEFFN(CFanIncrease) +DEFFN(CFanNoises) +DEFFN(CFloorIndicator) +DEFFN(CGamesConsole) +DEFFN(CGetLiftEye2) +DEFFN(CGlassSmasher) +DEFFN(CHammerClip) +DEFFN(CHammerDispensor) +DEFFN(CHammerDispensorButton) +DEFFN(CHeadSlot) +DEFFN(CHeadSmashEvent) +DEFFN(CHeadSmashLever) +DEFFN(CIdleSummoner) +DEFFN(CLemonDispensor) +DEFFN(CLight) +DEFFN(CLightSwitch) +DEFFN(CLittleLiftButton) +DEFFN(CLongStickDispenser) +DEFFN(CMissiveOMat) +DEFFN(CMissiveOMatButton) +DEFFN(CMusicalInstrument) +DEFFN(CMusicConsoleButton) +DEFFN(CMusicRoomPhonograph) +DEFFN(CMusicRoomStopPhonographButton) +DEFFN(CMusicSystemLock) +DEFFN(CNavHelmet) +DEFFN(CNavigationComputer) +DEFFN(CNoNutBowl) +DEFFN(CNoseHolder) +DEFFN(CNullPortHole) +DEFFN(CNutReplacer) +DEFFN(CPetDisabler) +DEFFN(CPhonograph) +DEFFN(CPhonographLid) +DEFFN(CPlayMusicButton) +DEFFN(CPlayOnAct) +DEFFN(CPortHole) +DEFFN(CRecordPhonographButton) +DEFFN(CReplacementEar) +DEFFN(CReservedTable) +DEFFN(CRestaurantCylinderHolder) +DEFFN(CRestaurantPhonograph) +DEFFN(CRoomItem) +DEFFN(CSauceDispensor) +DEFFN(CSearchPoint) +DEFFN(CSeasonBackground) +DEFFN(CSeasonBarrel) +DEFFN(CSeasonalAdjustment) +DEFFN(CServiceElevatorWindow) +DEFFN(CShipSetting) +DEFFN(CShipSettingButton) +DEFFN(CShowCellpoints) +DEFFN(CSpeechDispensor) +DEFFN(CStarlingPuret) +DEFFN(CStartAction) +DEFFN(CStopPhonographButton) +DEFFN(CSUBGlass) +DEFFN(CSweetBowl) +DEFFN(CTelevision) +DEFFN(CThirdClassCanal) +DEFFN(CThrowTVDownWell) +DEFFN(CTitaniaStillControl) +DEFFN(CTOWParrotNav) +DEFFN(CUpLighter) +DEFFN(CUselessLever) +DEFFN(CWheelButton) +DEFFN(CWheelHotSpot) +DEFFN(CWheelSpin) +DEFFN(CWheelSpinHorn) +DEFFN(CGondolierBase) +DEFFN(CGondolierChest) +DEFFN(CGondolierFace) +DEFFN(CGondolierMixer) +DEFFN(CGondolierSlider) +DEFFN(CMaitreDArmHolder) +DEFFN(CMaitreDBody) +DEFFN(CMaitreDLegs) +DEFFN(CMaitreDProdReceptor) +DEFFN(CParrotLobbyController) +DEFFN(CParrotLobbyLinkUpdater) +DEFFN(CParrotLobbyObject) +DEFFN(CParrotLobbyViewObject) +DEFFN(CParrotLoser) +DEFFN(CParrotNutBowlActor) +DEFFN(CParrotNutEater) +DEFFN(CParrotPerchHolder) +DEFFN(CParrotSuccUBus) +DEFFN(CParrotTrigger) +DEFFN(CPlayerMeetsParrot) +DEFFN(CPET) +DEFFN(CPETClass1) +DEFFN(CPETClass2) +DEFFN(CPETClass3) +DEFFN(CPetControl) +DEFFN(CPetDragChev) +DEFFN(CPetGraphic) +DEFFN(CPetGraphic2) +DEFFN(PETLeaf) +DEFFN(CPETLift) +DEFFN(CPETMonitor) +DEFFN(CPETPellerator) +DEFFN(CPETPosition) +DEFFN(CPETSentinal) +DEFFN(CPETSounds) +DEFFN(CPETTransition) +DEFFN(CPETTransport) +DEFFN(CPickUp) +DEFFN(CPickUpBarGlass) +DEFFN(CPickUpHose) +DEFFN(CPickUpLemon) +DEFFN(CPickUpSpeechCentre) +DEFFN(CPickUpVisCentre) +DEFFN(CBarShelfVisCentre) +DEFFN(CLemonOnBar) +DEFFN(CPlaceHolder) +DEFFN(CTVOnBar) +DEFFN(CArmchair) +DEFFN(CBasin) +DEFFN(CBedfoot) +DEFFN(CBedhead) +DEFFN(CChestOfDrawers) +DEFFN(CDesk) +DEFFN(CDeskchair) +DEFFN(CDrawer) +DEFFN(CSGTDoors) +DEFFN(SGTNav) +DEFFN(CSGTNavigation) +DEFFN(CSGTRestaurantDoors) +DEFFN(CSGTStateControl) +DEFFN(CSGTStateRoom) +DEFFN(CSGTTV) +DEFFN(CSGTUpperDoorsSound) +DEFFN(CToilet) +DEFFN(CVase) +DEFFN(CWashstand) -DEFFN(CGondolier); -DEFFN(CLift); -DEFFN(CLiftindicator); -DEFFN(CPellerator); -DEFFN(CServiceElevator); -DEFFN(CTransport); +DEFFN(CGondolier) +DEFFN(CLift) +DEFFN(CLiftindicator) +DEFFN(CPellerator) +DEFFN(CServiceElevator) +DEFFN(CTransport) -DEFFN(CActButton); -DEFFN(CChangesSeasonButton); -DEFFN(CChevLeftOff); -DEFFN(CChevLeftOn); -DEFFN(CChevRightOff); -DEFFN(CChevRightOn); -DEFFN(CChevSendRecSwitch); -DEFFN(CChevSwitch); -DEFFN(CEditControl); -DEFFN(CElevatorButton); -DEFFN(CGetFromSucc); -DEFFN(CHelmetOnOff); -DEFFN(CHomePhoto); -DEFFN(CIconNavAction); -DEFFN(CIconNavButt); -DEFFN(CIconNavDown); -DEFFN(CIconNavImage); -DEFFN(CIconNavLeft); -DEFFN(CIconNavReceive); -DEFFN(CIconNavRight); -DEFFN(CIconNavSend); -DEFFN(CIconNavUp); -DEFFN(CKeybrdButt); -DEFFN(CMoveObjectButton); -DEFFN(CMusicControl); -DEFFN(CMusicSlider); -DEFFN(CMusicSliderPitch); -DEFFN(CMusicSliderSpeed); -DEFFN(CMusicSwitch); -DEFFN(CMusicSwitchInversion); -DEFFN(CMusicSwitchReverse); -DEFFN(CMusicVoiceMute); -DEFFN(CPetModeOff); -DEFFN(CPetModeOn); -DEFFN(CPetModePanel); -DEFFN(CPetPannel1); -DEFFN(CPetPannel2); -DEFFN(CPetPannel3); -DEFFN(CSendToSucc); -DEFFN(CSGTSelector); -DEFFN(CSliderButton); -DEFFN(CSmallChevLeftOff); -DEFFN(CSmallChevLeftOn); -DEFFN(CSmallChevRightOff); -DEFFN(CSmallChevRightOn); -DEFFN(CStatusChangeButton); -DEFFN(CSTButton); -DEFFN(CTextDown); -DEFFN(CTextSkrew); -DEFFN(CTextUp); -DEFFN(CToggleButton); -DEFFN(CToggleSwitch); -DEFFN(CVolumeControl); +DEFFN(CActButton) +DEFFN(CChangesSeasonButton) +DEFFN(CChevLeftOff) +DEFFN(CChevLeftOn) +DEFFN(CChevRightOff) +DEFFN(CChevRightOn) +DEFFN(CChevSendRecSwitch) +DEFFN(CChevSwitch) +DEFFN(CEditControl) +DEFFN(CElevatorButton) +DEFFN(CGetFromSucc) +DEFFN(CHelmetOnOff) +DEFFN(CHomePhoto) +DEFFN(CIconNavAction) +DEFFN(CIconNavButt) +DEFFN(CIconNavDown) +DEFFN(CIconNavImage) +DEFFN(CIconNavLeft) +DEFFN(CIconNavReceive) +DEFFN(CIconNavRight) +DEFFN(CIconNavSend) +DEFFN(CIconNavUp) +DEFFN(CKeybrdButt) +DEFFN(CMoveObjectButton) +DEFFN(CMusicControl) +DEFFN(CMusicSlider) +DEFFN(CMusicSliderPitch) +DEFFN(CMusicSliderSpeed) +DEFFN(CMusicSwitch) +DEFFN(CMusicSwitchInversion) +DEFFN(CMusicSwitchReverse) +DEFFN(CMusicVoiceMute) +DEFFN(CPetModeOff) +DEFFN(CPetModeOn) +DEFFN(CPetModePanel) +DEFFN(CPetPannel1) +DEFFN(CPetPannel2) +DEFFN(CPetPannel3) +DEFFN(CSendToSucc) +DEFFN(CSGTSelector) +DEFFN(CSliderButton) +DEFFN(CSmallChevLeftOff) +DEFFN(CSmallChevLeftOn) +DEFFN(CSmallChevRightOff) +DEFFN(CSmallChevRightOn) +DEFFN(CStatusChangeButton) +DEFFN(CSTButton) +DEFFN(CTextDown) +DEFFN(CTextSkrew) +DEFFN(CTextUp) +DEFFN(CToggleButton) +DEFFN(CToggleSwitch) +DEFFN(CVolumeControl) -DEFFN(CActMsg); -DEFFN(CActivationmsg); -DEFFN(CAddHeadPieceMsg); -DEFFN(CAnimateMaitreDMsg); -DEFFN(CArboretumGateMsg); -DEFFN(CArmPickedUpFromTableMsg); -DEFFN(CAutoSoundEvent); -DEFFN(CBilgeAutoSoundEvent); -DEFFN(CBilgeDispensorEvent); -DEFFN(CBodyInBilgeRoomMsg); -DEFFN(CBowlStateChange); -DEFFN(CCarryObjectArrivedMsg); -DEFFN(CChangeSeasonMsg); -DEFFN(CCheckAllPossibleCodes); -DEFFN(CCheckChevCode); -DEFFN(CChildDragEndMsg); -DEFFN(CChildDragMoveMsg); -DEFFN(CChildDragStartMsg); -DEFFN(CClearChevPanelBits); -DEFFN(CCorrectMusicPlayedMsg); -DEFFN(CCreateMusicPlayerMsg); -DEFFN(CCylinderHolderReadyMsg); -DEFFN(CDeactivationMsg); -DEFFN(CDeliverCCarryMsg); -DEFFN(CDisableMaitreDProdReceptor); -DEFFN(CDismissBotMsg); -DEFFN(CDoffNavHelmet); -DEFFN(CDonNavHelmet); -DEFFN(CDoorAutoSoundEvent); -DEFFN(CDoorbotNeededInElevatorMsg); -DEFFN(CDoorbotNeededInHomeMsg); -DEFFN(CDropobjectMsg); -DEFFN(CDropZoneGotObjectMsg); -DEFFN(CDropZoneLostObjectMsg); -DEFFN(CEditControlMsg); -DEFFN(CEjectCylinderMsg); -DEFFN(CErasePhonographCylinderMsg); -DEFFN(CFreshenCookieMsg); -DEFFN(CGetChevClassBits); -DEFFN(CGetChevClassNum); -DEFFN(CGetChevCodeFromRoomNameMsg); -DEFFN(CGetChevFloorBits); -DEFFN(CGetChevFloorNum); -DEFFN(CGetChevLiftBits); -DEFFN(CGetChevLiftNum); -DEFFN(CGetChevRoomBits); -DEFFN(CGetChevRoomNum); -DEFFN(CHoseConnectedMsg); -DEFFN(CInitializeAnimMsg); -DEFFN(CIsEarBowlPuzzleDone); -DEFFN(CIsHookedOnMsg); -DEFFN(CIsParrotPresentMsg); -DEFFN(CKeyCharMsg); -DEFFN(CLemonFallsFromTreeMsg); -DEFFN(CLightsMsg); -DEFFN(CLockPhonographMsg); -DEFFN(CMaitreDDefeatedMsg); -DEFFN(CMaitreDHappyMsg); -DEFFN(CMissiveOMatActionMsg); -DEFFN(CMouseMsg); -DEFFN(CMouseMoveMsg); -DEFFN(CMouseButtonMsg); -DEFFN(CMouseButtonDownMsg); -DEFFN(CMouseButtonUpMsg); -DEFFN(CMouseButtonDoubleClickMsg); -DEFFN(CMouseDragMsg); -DEFFN(CMouseDragStartMsg); -DEFFN(CMouseDragMoveMsg); -DEFFN(CMouseDragEndMsg); -DEFFN(CMoveToStartPosMsg); -DEFFN(CMovieEndMsg); -DEFFN(CMovieFrameMsg); -DEFFN(CMusicHasStartedMsg); -DEFFN(CMusicHasStoppedMsg); -DEFFN(CMusicSettingChangedMsg); -DEFFN(CNPCPlayAnimationMsg); -DEFFN(CNPCPlayIdleAnimationMsg); -DEFFN(CNPCPlayTalkingAnimationMsg); -DEFFN(CNPCQueueIdleAnimMsg); -DEFFN(CNutPuzzleMsg); -DEFFN(COnSummonBotMsg); -DEFFN(COpeningCreditsMsg); -DEFFN(CPETDeliverMsg); -DEFFN(CPETGainedObjectMsg); -DEFFN(CPETHelmetOnOffMsg); -DEFFN(CPETKeyboardOnOffMsg); -DEFFN(CPETLostObjectMsg); -DEFFN(CPETObjectSelectedMsg); -DEFFN(CPETObjectStateMsg); -DEFFN(CPETPhotoOnOffMsg); -DEFFN(CPETPlaySoundMsg); -DEFFN(CPETReceiveMsg); -DEFFN(CPETSetStarDestinationMsg); -DEFFN(CPETStarFieldLockMsg); -DEFFN(CPETStereoFieldOnOffMsg); -DEFFN(CPETTargetMsg); -DEFFN(CPanningAwayFromParrotMsg); -DEFFN(CParrotSpeakMsg); -DEFFN(CParrotTriesChickenMsg); -DEFFN(CPassOnDragStartMsg); -DEFFN(CPhonographPlayMsg); -DEFFN(CPhonographReadyToPlayMsg); -DEFFN(CPhonographRecordMsg); -DEFFN(CPhonographStopMsg); -DEFFN(CPlayRangeMsg); -DEFFN(CPlayerTriesRestaurantTableMsg); -DEFFN(CPreSaveMsg); -DEFFN(CProdMaitreDMsg); -DEFFN(CPumpingMsg); -DEFFN(CPutBotBackInHisBoxMsg); -DEFFN(CPutParrotBackMsg); -DEFFN(CPuzzleSolvedMsg); -DEFFN(CQueryCylinderHolderMsg); -DEFFN(CQueryCylinderMsg); -DEFFN(CQueryCylinderNameMsg); -DEFFN(CQueryCylinderTypeMsg); -DEFFN(CQueryMusicControlSettingMsg); -DEFFN(CQueryPhonographState); -DEFFN(CRecordOntoCylinderMsg); -DEFFN(CRemoveFromGameMsg); -DEFFN(CReplaceBowlAndNutsMsg); -DEFFN(CRestaurantMusicChanged); -DEFFN(CSendCCarryMsg); -DEFFN(CSenseWorkingMsg); -DEFFN(CServiceElevatorDoor); -DEFFN(CServiceElevatorFloorChangeMsg); -DEFFN(CServiceElevatorFloorRequestMsg); -DEFFN(CServiceElevatorMsg); -DEFFN(CSetChevButtonImageMsg); -DEFFN(CSetChevClassBits); -DEFFN(CSetChevFloorBits); -DEFFN(CSetChevLiftBits); -DEFFN(CSetChevPanelBitMsg); -DEFFN(CSetChevPanelButtonsMsg); -DEFFN(CSetChevRoomBits); -DEFFN(CSetMusicControlsMsg); -DEFFN(CSetVarMsg); -DEFFN(CSetVolumeMsg); -DEFFN(CShipSettingMsg); -DEFFN(CShowTextMsg); -DEFFN(CSignalObject); -DEFFN(CSpeechFallsFromTreeMsg); -DEFFN(CStartMusicMsg); -DEFFN(CStatusChangeMsg); -DEFFN(CStopMusicMsg); -DEFFN(CSubAcceptCCarryMsg); -DEFFN(CSubDeliverCCarryMsg); -DEFFN(CSubSendCCarryMsg); -DEFFN(CSUBTransition); -DEFFN(CSubTurnOffMsg); -DEFFN(CSubTurnOnMsg); -DEFFN(CSummonBotMsg); -DEFFN(CSummonBotQuerryMsg); -DEFFN(CTakeHeadPieceMsg); -DEFFN(CTextInputMsg); -DEFFN(CTimeDilationMsg); -DEFFN(CTimeMsg); -DEFFN(CTitleSequenceEndedMsg); -DEFFN(CTransitMsg); -DEFFN(CTransportMsg); -DEFFN(CTriggerAutoMusicPlayerMsg); -DEFFN(CTriggerNPCEvent); -DEFFN(CTrueTalkGetAnimSetMsg); -DEFFN(CTrueTalkGetAssetDetailsMsg); -DEFFN(CTrueTalkGetStateValueMsg); -DEFFN(CTrueTalkNotifySpeechEndedMsg); -DEFFN(CTrueTalkNotifySpeechStartedMsg); -DEFFN(CTrueTalkQueueUpAnimSetMsg); -DEFFN(CTrueTalkSelfQueueAnimSetMsg); -DEFFN(CTrueTalkTriggerActionMsg); -DEFFN(CTurnOff); -DEFFN(CTurnOn); -DEFFN(CUse); -DEFFN(CUseWithCharMsg); -DEFFN(CUseWithOtherMsg); -DEFFN(CVirtualKeyCharMsg); -DEFFN(CVisibleMsg); +DEFFN(CActMsg) +DEFFN(CActivationmsg) +DEFFN(CAddHeadPieceMsg) +DEFFN(CAnimateMaitreDMsg) +DEFFN(CArboretumGateMsg) +DEFFN(CArmPickedUpFromTableMsg) +DEFFN(CAutoSoundEvent) +DEFFN(CBilgeAutoSoundEvent) +DEFFN(CBilgeDispensorEvent) +DEFFN(CBodyInBilgeRoomMsg) +DEFFN(CBowlStateChange) +DEFFN(CCarryObjectArrivedMsg) +DEFFN(CChangeSeasonMsg) +DEFFN(CCheckAllPossibleCodes) +DEFFN(CCheckChevCode) +DEFFN(CChildDragEndMsg) +DEFFN(CChildDragMoveMsg) +DEFFN(CChildDragStartMsg) +DEFFN(CClearChevPanelBits) +DEFFN(CCorrectMusicPlayedMsg) +DEFFN(CCreateMusicPlayerMsg) +DEFFN(CCylinderHolderReadyMsg) +DEFFN(CDeactivationMsg) +DEFFN(CDeliverCCarryMsg) +DEFFN(CDisableMaitreDProdReceptor) +DEFFN(CDismissBotMsg) +DEFFN(CDoffNavHelmet) +DEFFN(CDonNavHelmet) +DEFFN(CDoorAutoSoundEvent) +DEFFN(CDoorbotNeededInElevatorMsg) +DEFFN(CDoorbotNeededInHomeMsg) +DEFFN(CDropobjectMsg) +DEFFN(CDropZoneGotObjectMsg) +DEFFN(CDropZoneLostObjectMsg) +DEFFN(CEditControlMsg) +DEFFN(CEjectCylinderMsg) +DEFFN(CErasePhonographCylinderMsg) +DEFFN(CFreshenCookieMsg) +DEFFN(CGetChevClassBits) +DEFFN(CGetChevClassNum) +DEFFN(CGetChevCodeFromRoomNameMsg) +DEFFN(CGetChevFloorBits) +DEFFN(CGetChevFloorNum) +DEFFN(CGetChevLiftBits) +DEFFN(CGetChevLiftNum) +DEFFN(CGetChevRoomBits) +DEFFN(CGetChevRoomNum) +DEFFN(CHoseConnectedMsg) +DEFFN(CInitializeAnimMsg) +DEFFN(CIsEarBowlPuzzleDone) +DEFFN(CIsHookedOnMsg) +DEFFN(CIsParrotPresentMsg) +DEFFN(CKeyCharMsg) +DEFFN(CLemonFallsFromTreeMsg) +DEFFN(CLightsMsg) +DEFFN(CLockPhonographMsg) +DEFFN(CMaitreDDefeatedMsg) +DEFFN(CMaitreDHappyMsg) +DEFFN(CMissiveOMatActionMsg) +DEFFN(CMouseMsg) +DEFFN(CMouseMoveMsg) +DEFFN(CMouseButtonMsg) +DEFFN(CMouseButtonDownMsg) +DEFFN(CMouseButtonUpMsg) +DEFFN(CMouseButtonDoubleClickMsg) +DEFFN(CMouseDragMsg) +DEFFN(CMouseDragStartMsg) +DEFFN(CMouseDragMoveMsg) +DEFFN(CMouseDragEndMsg) +DEFFN(CMoveToStartPosMsg) +DEFFN(CMovieEndMsg) +DEFFN(CMovieFrameMsg) +DEFFN(CMusicHasStartedMsg) +DEFFN(CMusicHasStoppedMsg) +DEFFN(CMusicSettingChangedMsg) +DEFFN(CNPCPlayAnimationMsg) +DEFFN(CNPCPlayIdleAnimationMsg) +DEFFN(CNPCPlayTalkingAnimationMsg) +DEFFN(CNPCQueueIdleAnimMsg) +DEFFN(CNutPuzzleMsg) +DEFFN(COnSummonBotMsg) +DEFFN(COpeningCreditsMsg) +DEFFN(CPETDeliverMsg) +DEFFN(CPETGainedObjectMsg) +DEFFN(CPETHelmetOnOffMsg) +DEFFN(CPETKeyboardOnOffMsg) +DEFFN(CPETLostObjectMsg) +DEFFN(CPETObjectSelectedMsg) +DEFFN(CPETObjectStateMsg) +DEFFN(CPETPhotoOnOffMsg) +DEFFN(CPETPlaySoundMsg) +DEFFN(CPETReceiveMsg) +DEFFN(CPETSetStarDestinationMsg) +DEFFN(CPETStarFieldLockMsg) +DEFFN(CPETStereoFieldOnOffMsg) +DEFFN(CPETTargetMsg) +DEFFN(CPanningAwayFromParrotMsg) +DEFFN(CParrotSpeakMsg) +DEFFN(CParrotTriesChickenMsg) +DEFFN(CPassOnDragStartMsg) +DEFFN(CPhonographPlayMsg) +DEFFN(CPhonographReadyToPlayMsg) +DEFFN(CPhonographRecordMsg) +DEFFN(CPhonographStopMsg) +DEFFN(CPlayRangeMsg) +DEFFN(CPlayerTriesRestaurantTableMsg) +DEFFN(CPreSaveMsg) +DEFFN(CProdMaitreDMsg) +DEFFN(CPumpingMsg) +DEFFN(CPutBotBackInHisBoxMsg) +DEFFN(CPutParrotBackMsg) +DEFFN(CPuzzleSolvedMsg) +DEFFN(CQueryCylinderHolderMsg) +DEFFN(CQueryCylinderMsg) +DEFFN(CQueryCylinderNameMsg) +DEFFN(CQueryCylinderTypeMsg) +DEFFN(CQueryMusicControlSettingMsg) +DEFFN(CQueryPhonographState) +DEFFN(CRecordOntoCylinderMsg) +DEFFN(CRemoveFromGameMsg) +DEFFN(CReplaceBowlAndNutsMsg) +DEFFN(CRestaurantMusicChanged) +DEFFN(CSendCCarryMsg) +DEFFN(CSenseWorkingMsg) +DEFFN(CServiceElevatorDoor) +DEFFN(CServiceElevatorFloorChangeMsg) +DEFFN(CServiceElevatorFloorRequestMsg) +DEFFN(CServiceElevatorMsg) +DEFFN(CSetChevButtonImageMsg) +DEFFN(CSetChevClassBits) +DEFFN(CSetChevFloorBits) +DEFFN(CSetChevLiftBits) +DEFFN(CSetChevPanelBitMsg) +DEFFN(CSetChevPanelButtonsMsg) +DEFFN(CSetChevRoomBits) +DEFFN(CSetMusicControlsMsg) +DEFFN(CSetVarMsg) +DEFFN(CSetVolumeMsg) +DEFFN(CShipSettingMsg) +DEFFN(CShowTextMsg) +DEFFN(CSignalObject) +DEFFN(CSpeechFallsFromTreeMsg) +DEFFN(CStartMusicMsg) +DEFFN(CStatusChangeMsg) +DEFFN(CStopMusicMsg) +DEFFN(CSubAcceptCCarryMsg) +DEFFN(CSubDeliverCCarryMsg) +DEFFN(CSubSendCCarryMsg) +DEFFN(CSUBTransition) +DEFFN(CSubTurnOffMsg) +DEFFN(CSubTurnOnMsg) +DEFFN(CSummonBotMsg) +DEFFN(CSummonBotQuerryMsg) +DEFFN(CTakeHeadPieceMsg) +DEFFN(CTextInputMsg) +DEFFN(CTimeDilationMsg) +DEFFN(CTimeMsg) +DEFFN(CTitleSequenceEndedMsg) +DEFFN(CTransitMsg) +DEFFN(CTransportMsg) +DEFFN(CTriggerAutoMusicPlayerMsg) +DEFFN(CTriggerNPCEvent) +DEFFN(CTrueTalkGetAnimSetMsg) +DEFFN(CTrueTalkGetAssetDetailsMsg) +DEFFN(CTrueTalkGetStateValueMsg) +DEFFN(CTrueTalkNotifySpeechEndedMsg) +DEFFN(CTrueTalkNotifySpeechStartedMsg) +DEFFN(CTrueTalkQueueUpAnimSetMsg) +DEFFN(CTrueTalkSelfQueueAnimSetMsg) +DEFFN(CTrueTalkTriggerActionMsg) +DEFFN(CTurnOff) +DEFFN(CTurnOn) +DEFFN(CUse) +DEFFN(CUseWithCharMsg) +DEFFN(CUseWithOtherMsg) +DEFFN(CVirtualKeyCharMsg) +DEFFN(CVisibleMsg) -DEFFN(CEnterBombRoom); -DEFFN(CEnterBridge); -DEFFN(CEnterExitFirstClassState); -DEFFN(CEnterExitMiniLift); -DEFFN(CEnterExitSecClassMiniLift); -DEFFN(CEnterExitView); -DEFFN(CEnterSecClassState); -DEFFN(CExitArboretum); -DEFFN(CExitBridge); -DEFFN(CExitLift); -DEFFN(CExitPellerator); -DEFFN(CExitStateRoom); -DEFFN(CExitTiania); -DEFFN(CMovePlayerInParrotRoom); -DEFFN(CMovePlayerTo); -DEFFN(CMovePlayerToFrom); -DEFFN(CMultiMove); -DEFFN(CPanFromPel); -DEFFN(CRestaurantPanHandler); -DEFFN(CScraliontisTable); -DEFFN(CRestrictedMove); -DEFFN(CTripDownCanal); +DEFFN(CEnterBombRoom) +DEFFN(CEnterBridge) +DEFFN(CEnterExitFirstClassState) +DEFFN(CEnterExitMiniLift) +DEFFN(CEnterExitSecClassMiniLift) +DEFFN(CEnterExitView) +DEFFN(CEnterSecClassState) +DEFFN(CExitArboretum) +DEFFN(CExitBridge) +DEFFN(CExitLift) +DEFFN(CExitPellerator) +DEFFN(CExitStateRoom) +DEFFN(CExitTiania) +DEFFN(CMovePlayerInParrotRoom) +DEFFN(CMovePlayerTo) +DEFFN(CMovePlayerToFrom) +DEFFN(CMultiMove) +DEFFN(CPanFromPel) +DEFFN(CRestaurantPanHandler) +DEFFN(CScraliontisTable) +DEFFN(CRestrictedMove) +DEFFN(CTripDownCanal) -DEFFN(CBarbot); -DEFFN(CBellBot); -DEFFN(CCallBot); -DEFFN(CDeskbot); -DEFFN(CDoorbot); -DEFFN(CLiftBot); -DEFFN(CMaitreD); -DEFFN(CMobile); -DEFFN(CParrot); -DEFFN(CStarlings); -DEFFN(CSummonBots); -DEFFN(CSuccUBus); -DEFFN(CTitania); -DEFFN(CAutoMusicPlayer); -DEFFN(CAutoMusicPlayerBase); -DEFFN(CAutoSoundPlayer); -DEFFN(CAutoSoundPlayerADSR); -DEFFN(CBackgroundSoundMaker); -DEFFN(CBirdSong); -DEFFN(CEnterViewTogglesOtherMusic); -DEFFN(CGondolierSong); -DEFFN(CMusicPlayer); -DEFFN(CNodeAutoSoundPlayer); -DEFFN(CRestrictedAutoMusicPlayer); -DEFFN(CRoomAutoSoundPlayer); -DEFFN(CSeasonNoises); -DEFFN(CSeasonalMusicPlayer); -DEFFN(CTitaniaSpeech); -DEFFN(CTriggerAutoMusicPlayer); -DEFFN(CViewAutoSoundPlayer); -DEFFN(CViewTogglesOtherMusic); -DEFFN(CWaterLappingSounds); +DEFFN(CBarbot) +DEFFN(CBellBot) +DEFFN(CCallBot) +DEFFN(CDeskbot) +DEFFN(CDoorbot) +DEFFN(CLiftBot) +DEFFN(CMaitreD) +DEFFN(CMobile) +DEFFN(CParrot) +DEFFN(CStarlings) +DEFFN(CSummonBots) +DEFFN(CSuccUBus) +DEFFN(CTitania) +DEFFN(CAutoMusicPlayer) +DEFFN(CAutoMusicPlayerBase) +DEFFN(CAutoSoundPlayer) +DEFFN(CAutoSoundPlayerADSR) +DEFFN(CBackgroundSoundMaker) +DEFFN(CBirdSong) +DEFFN(CEnterViewTogglesOtherMusic) +DEFFN(CGondolierSong) +DEFFN(CMusicPlayer) +DEFFN(CNodeAutoSoundPlayer) +DEFFN(CRestrictedAutoMusicPlayer) +DEFFN(CRoomAutoSoundPlayer) +DEFFN(CSeasonNoises) +DEFFN(CSeasonalMusicPlayer) +DEFFN(CTitaniaSpeech) +DEFFN(CTriggerAutoMusicPlayer) +DEFFN(CViewAutoSoundPlayer) +DEFFN(CViewTogglesOtherMusic) +DEFFN(CWaterLappingSounds) void CSaveableObject::initClassList() { _classList = new Common::HashMap(); diff --git a/engines/titanic/core/saveable_object.h b/engines/titanic/core/saveable_object.h index 4e7d949191..ed26163557 100644 --- a/engines/titanic/core/saveable_object.h +++ b/engines/titanic/core/saveable_object.h @@ -50,6 +50,8 @@ public: */ static CSaveableObject *createInstance(const Common::String &name); public: + virtual ~CSaveableObject() {} + /** * Return the class name */ diff --git a/engines/titanic/image.h b/engines/titanic/image.h index adef011df1..9030e81ad7 100644 --- a/engines/titanic/image.h +++ b/engines/titanic/image.h @@ -67,6 +67,7 @@ public: bool _flag; public: Image(); + virtual ~Image() {} virtual void proc6(); virtual void set(int width, int height); diff --git a/engines/titanic/messages/door_auto_sound_event.h b/engines/titanic/messages/door_auto_sound_event.h index ef417560dc..7eb1d04bf4 100644 --- a/engines/titanic/messages/door_auto_sound_event.h +++ b/engines/titanic/messages/door_auto_sound_event.h @@ -34,7 +34,7 @@ public: int _fieldDC; int _fieldE0; public: - CDoorAutoSoundEvent::CDoorAutoSoundEvent() : CAutoSoundEvent(), + CDoorAutoSoundEvent() : CAutoSoundEvent(), _string1("z#44.wav"), _string2("z#43.wav"), _fieldDC(25), _fieldE0(25) { } diff --git a/engines/titanic/messages/pet_messages.h b/engines/titanic/messages/pet_messages.h index 1aeaec0d0d..96e52eb61c 100644 --- a/engines/titanic/messages/pet_messages.h +++ b/engines/titanic/messages/pet_messages.h @@ -40,7 +40,7 @@ RAW_MESSAGE(CPETReceiveMsg); RAW_MESSAGE(CPETSetStarDestinationMsg); NUM_MESSAGE(CPETStarFieldLockMsg, _value); RAW_MESSAGE(CPETStereoFieldOnOffMsg); -SNUM_MESSAGE_VAL(CPETTargetMsg, _strValue, _numValue, nullptr, -1); +SNUM_MESSAGE_VAL(CPETTargetMsg, _strValue, _numValue, (const char *)nullptr, -1); } // End of namespace Titanic diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 62dbdcb89f..258dc2ede5 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -2,7 +2,6 @@ MODULE := engines/titanic MODULE_OBJS := \ compressed_file.o \ - compression.o \ detection.o \ direct_draw.o \ font.o \ diff --git a/engines/titanic/pet_control/pet_control_sub_base.h b/engines/titanic/pet_control/pet_control_sub_base.h index 85423820f4..ead9a6e6dd 100644 --- a/engines/titanic/pet_control/pet_control_sub_base.h +++ b/engines/titanic/pet_control/pet_control_sub_base.h @@ -42,6 +42,7 @@ protected: int _field4; public: CPetControlSubBase() : _field4(0) {} + virtual ~CPetControlSubBase() {} virtual int proc1() { return 0; } virtual int proc2() { return 0; } diff --git a/engines/titanic/pet_control/pet_val_base.h b/engines/titanic/pet_control/pet_val_base.h index a2701149a7..1d5399b70b 100644 --- a/engines/titanic/pet_control/pet_val_base.h +++ b/engines/titanic/pet_control/pet_val_base.h @@ -38,6 +38,7 @@ protected: public: CPetValBase() : _field4(0), _field8(0), _fieldC(0), _field10(0), _field14(0) {} + virtual ~CPetValBase() {} virtual void proc1() {} virtual void proc2() {} diff --git a/engines/titanic/simple_file.cpp b/engines/titanic/simple_file.cpp index 9bc365bf33..ef6f26d827 100644 --- a/engines/titanic/simple_file.cpp +++ b/engines/titanic/simple_file.cpp @@ -61,7 +61,7 @@ void SimpleFile::close() { void SimpleFile::safeRead(void *dst, size_t count) { if (unsafeRead(dst, count) != count) - error("Could not read %d bytes", count); + error("Could not read %d bytes", (int)count); } size_t SimpleFile::unsafeRead(void *dst, size_t count) { @@ -229,7 +229,7 @@ void SimpleFile::writeString(const CString &str) { const char *msgP = str.c_str(); char c; - while (c = *msgP++) { + while ((c = *msgP++) != '\0') { switch (c) { case '\r': write("\\r", 2); @@ -272,7 +272,7 @@ void SimpleFile::writeQuotedLine(const CString &str, int indent) { } void SimpleFile::writeNumber(int val) { - CString str = CString::format("%ld ", val); + CString str = CString::format("%d ", val); write(str.c_str(), str.size()); } -- cgit v1.2.3 From 7e966dbc5e9285da69a55312a81ff280845752ea Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 5 Mar 2016 00:12:53 -0500 Subject: TITANIC: gcc compilation fixes --- engines/titanic/core/list.h | 2 +- engines/titanic/module.mk | 4 ---- engines/titanic/pet_control/pet_val.cpp | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/engines/titanic/core/list.h b/engines/titanic/core/list.h index 00474b9f23..0ede36e9cc 100644 --- a/engines/titanic/core/list.h +++ b/engines/titanic/core/list.h @@ -70,7 +70,7 @@ public: file->writeNumberLine(Common::List::size(), indent); // Iterate through writing entries - typename Common::List::const_iterator i; + typename Common::List::const_iterator i; for (i = Common::List::begin(); i != Common::List::end(); ++i) { const ListItem *item = *i; item->saveHeader(file, indent); diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 258dc2ede5..f11512eced 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -117,7 +117,6 @@ MODULE_OBJS := \ game/desk_click_responder.o \ game/doorbot_elevator_handler.o \ game/doorbot_home_handler.o \ - game/drawer.o \ game/ear_sweet_bowl.o \ game/eject_phonograph_button.o \ game/elevator_action_area.o \ @@ -166,7 +165,6 @@ MODULE_OBJS := \ game/nose_holder.o \ game/null_port_hole.o \ game/nut_replacer.o \ - game/pet_controler.o \ game/pet_disabler.o \ game/phonograph.o \ game/phonograph_lid.o \ @@ -375,8 +373,6 @@ MODULE_OBJS := \ pet_control/pet_control_list_item.o \ pet_control/pet_control_list_item2.o \ pet_control/pet_control_sub_base.o \ - pet_control/pet_control_sub_list_item.o \ - pet_control/pet_control_sub_list_item2.o \ pet_control/pet_control_sub1.o \ pet_control/pet_control_sub2.o \ pet_control/pet_control_sub3.o \ diff --git a/engines/titanic/pet_control/pet_val.cpp b/engines/titanic/pet_control/pet_val.cpp index f3ee2bf9bf..f0b9b92cde 100644 --- a/engines/titanic/pet_control/pet_val.cpp +++ b/engines/titanic/pet_control/pet_val.cpp @@ -46,7 +46,7 @@ void CPetVal::proc5(CLinkItemSub *linkItem) { } int CPetVal::proc16() { - switch (!_field14) { + switch (_field14) { case 0: return _field18; case 1: -- cgit v1.2.3 From 03d3d5b539500a77c894ef4479bbe14e1b392fa3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 5 Mar 2016 12:14:52 -0500 Subject: TITANIC: Implemented remaining CPetControl classes loading --- engines/titanic/game/pet/pet_val.cpp | 28 ----------- engines/titanic/game/pet/pet_val.h | 41 --------------- engines/titanic/module.mk | 2 - engines/titanic/pet_control/pet_control.cpp | 31 +++++++----- engines/titanic/pet_control/pet_control.h | 7 ++- .../titanic/pet_control/pet_control_list_item2.cpp | 9 ++-- .../titanic/pet_control/pet_control_list_item2.h | 4 +- engines/titanic/pet_control/pet_control_sub1.cpp | 6 ++- engines/titanic/pet_control/pet_control_sub1.h | 2 +- engines/titanic/pet_control/pet_control_sub12.cpp | 58 +++++++++++++++++++--- engines/titanic/pet_control/pet_control_sub12.h | 19 ++++--- engines/titanic/pet_control/pet_control_sub2.cpp | 21 +++++++- engines/titanic/pet_control/pet_control_sub2.h | 2 +- engines/titanic/pet_control/pet_control_sub3.cpp | 8 --- engines/titanic/pet_control/pet_control_sub3.h | 11 +--- engines/titanic/pet_control/pet_control_sub4.cpp | 4 +- engines/titanic/pet_control/pet_control_sub4.h | 2 +- engines/titanic/pet_control/pet_control_sub5.cpp | 12 ++++- engines/titanic/pet_control/pet_control_sub5.h | 12 +++-- engines/titanic/pet_control/pet_control_sub6.cpp | 8 --- engines/titanic/pet_control/pet_control_sub6.h | 8 --- engines/titanic/pet_control/pet_control_sub7.cpp | 8 --- engines/titanic/pet_control/pet_control_sub7.h | 8 --- engines/titanic/pet_control/pet_control_sub8.cpp | 8 --- engines/titanic/pet_control/pet_control_sub8.h | 9 ---- engines/titanic/pet_control/pet_control_sub_base.h | 4 +- engines/titanic/pet_control/pet_val_base.cpp | 3 ++ engines/titanic/pet_control/pet_val_base.h | 3 +- 28 files changed, 153 insertions(+), 185 deletions(-) delete mode 100644 engines/titanic/game/pet/pet_val.cpp delete mode 100644 engines/titanic/game/pet/pet_val.h diff --git a/engines/titanic/game/pet/pet_val.cpp b/engines/titanic/game/pet/pet_val.cpp deleted file mode 100644 index b978a8b724..0000000000 --- a/engines/titanic/game/pet/pet_val.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* 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 "titanic/game/pet/pet_val.h" - -namespace Titanic { - - -} // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_val.h b/engines/titanic/game/pet/pet_val.h deleted file mode 100644 index f5cae8222d..0000000000 --- a/engines/titanic/game/pet/pet_val.h +++ /dev/null @@ -1,41 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_VAL_H -#define TITANIC_PET_VAL_H - -#include "titanic/game/pet/pet_val_base.h" - -namespace Titanic { - -class CPetVal: public CPetValBase { -private: - int _field18; - int _field1C; - int _field20; -public: - CPetVal() : CPetValBase(), _field18(0), _field1C(0), _field20(0) {} -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_VAL_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index f11512eced..e597860b51 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -238,8 +238,6 @@ MODULE_OBJS := \ game/pet/pet_sounds.o \ game/pet/pet_transition.o \ game/pet/pet_transport.o \ - game/pet/pet_val_base.o \ - game/pet/pet_val.o \ game/pickup/pick_up.o \ game/pickup/pick_up_bar_glass.o \ game/pickup/pick_up_hose.o \ diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 354ed393a8..e123e99dc5 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -36,14 +36,14 @@ void CPetControl::save(SimpleFile *file, int indent) const { void CPetControl::load(SimpleFile *file) { int val = file->readNumber(); - // TODO: sub_43A9E0 + bool valid = isValid(); - if (!val) { + if (!valid) { _fieldBC = file->readNumber(); _string1 = file->readString(); _string2 = file->readString(); - loadSubObjects(file); + loadSubObjects(file, 0); } CGameObject::load(file); @@ -53,15 +53,22 @@ void CPetControl::gameLoaded() { // TODO } -void CPetControl::loadSubObjects(SimpleFile *file) { - _sub1.load(file); - _sub2.load(file); - _sub3.load(file); - _sub4.load(file); - _sub5.load(file); - _sub6.load(file); - _sub7.load(file); - _sub8.load(file); +bool CPetControl::isValid() const { + return _sub1.isValid() && _sub2.isValid() + && _sub3.isValid() && _sub4.isValid() + && _sub5.isValid() && _sub6.isValid() + && _sub7.isValid() && _sub8.isValid(); +} + +void CPetControl::loadSubObjects(SimpleFile *file, int param) { + _sub1.load(file, param); + _sub2.load(file, param); + _sub3.load(file, param); + _sub4.load(file, param); + _sub5.load(file, param); + _sub6.load(file, param); + _sub7.load(file, param); + _sub8.load(file, param); } void CPetControl::saveSubObjects(SimpleFile *file, int indent) const { diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index dab44266c4..087ecd1d8f 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -55,7 +55,12 @@ private: CString _string2; int _field13A4; private: - void loadSubObjects(SimpleFile *file); + /** + * Returns true if the control is in a valid state + */ + bool isValid() const; + + void loadSubObjects(SimpleFile *file, int param); void saveSubObjects(SimpleFile *file, int indent) const; public: diff --git a/engines/titanic/pet_control/pet_control_list_item2.cpp b/engines/titanic/pet_control/pet_control_list_item2.cpp index 05847a9fe5..82b59929d2 100644 --- a/engines/titanic/pet_control/pet_control_list_item2.cpp +++ b/engines/titanic/pet_control/pet_control_list_item2.cpp @@ -23,12 +23,15 @@ #include "titanic/pet_control/pet_control_list_item2.h" namespace Titanic { -/* -CPetControlListItem2::CPetControlListItem2(), + +CPetControlListItem2::CPetControlListItem2() : _field34(0), _field38(0), _field3C(0), _field40(0), _field44(0), _field48(0), _field4C(0), _field50(0), _field54(0), _field58(0), _field5C(0) { } -*/ + +void CPetControlListItem2::setField34(int val) { + _field34 = val; +} } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_list_item2.h b/engines/titanic/pet_control/pet_control_list_item2.h index 26f32d5371..a7f28fa12d 100644 --- a/engines/titanic/pet_control/pet_control_list_item2.h +++ b/engines/titanic/pet_control/pet_control_list_item2.h @@ -41,7 +41,9 @@ protected: int _field58; int _field5C; public: - //CPetControlListItem2(); + CPetControlListItem2(); + + void setField34(int val); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub1.cpp b/engines/titanic/pet_control/pet_control_sub1.cpp index 7ca6d6ffbc..0daae0637d 100644 --- a/engines/titanic/pet_control/pet_control_sub1.cpp +++ b/engines/titanic/pet_control/pet_control_sub1.cpp @@ -31,8 +31,12 @@ void CPetControlSub1::save(SimpleFile *file, int indent) const { } -void CPetControlSub1::load(SimpleFile *file) { +void CPetControlSub1::load(SimpleFile *file, int param) { + _sub2.load(file, param); + _sub1.load(file, param); + for (int idx = 0; idx < 3; ++idx) + _valArray3[idx] = file->readNumber(); } } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub1.h b/engines/titanic/pet_control/pet_control_sub1.h index fbe1bbb510..e826182afc 100644 --- a/engines/titanic/pet_control/pet_control_sub1.h +++ b/engines/titanic/pet_control/pet_control_sub1.h @@ -61,7 +61,7 @@ public: /** * Load the data for the class from file */ - virtual void load(SimpleFile *file); + virtual void load(SimpleFile *file, int param); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub12.cpp b/engines/titanic/pet_control/pet_control_sub12.cpp index 1e8d62834e..616d6920ae 100644 --- a/engines/titanic/pet_control/pet_control_sub12.cpp +++ b/engines/titanic/pet_control/pet_control_sub12.cpp @@ -24,15 +24,57 @@ namespace Titanic { -CPetControlSub12::CPetControlSub12() : - _field0(0), _field4(0), _field8(0), _field18(0), - _field1C(0), _field20(0), _field24(0), _field28(0), - _field2C(0), _field30(0), _field34(0), _field38(0), - _field3C(0), _field40(0), _field44(0), _field48(0), - _field4C(0), _field50(0), _field54(0), _field58(0), - _field5C(0), _field60(0), _field64(0), _field68(0), - _field6C(0), _field70(0), _field74(0), _field78(0), +CPetControlSub12::CPetControlSub12(int count) : + _field18(0), _field1C(0), _field20(0), _field24(0), + _field28(0), _field30(-1), _field34(0), _field38(-1), + _field3C(0), _field40(0), _field44(0), _field48(0xff), + _field4C(0xff), _field50(0xff), _field54(0), _field58(0), + _field5C(200), _field60(0), _field64(0), _field68(0), + _field6C(0), _field70(1), _field74(0), _field78(0), _field7C(0) { + setupArrays(count); } +void CPetControlSub12::setupArrays(int count) { + freeArrays(); + if (count < 10 || count > 60) + count = 10; + _array.resize(count); +} + +void CPetControlSub12::freeArrays() { + _array.clear(); +} + +void CPetControlSub12::load(SimpleFile *file, int param) { + if (!param) { + int var1 = file->readNumber(); + int var2 = file->readNumber(); + uint count = file->readNumber(); + _field1C = file->readNumber(); + _field20 = file->readNumber(); + _field24 = file->readNumber(); + _field28 = file->readNumber(); + _field3C = file->readNumber(); + _field40 = file->readNumber(); + _field44 = file->readNumber(); + _field48 = file->readNumber(); + _field4C = file->readNumber(); + _field50 = file->readNumber(); + _field54 = file->readNumber(); + _field58 = file->readNumber(); + _field5C = file->readNumber(); + _field70 = file->readNumber(); + _field74 = file->readNumber(); + + assert(_array.size() >= count); + for (uint idx = 0; idx < count; ++idx) { + _array[idx]._string1 = file->readString(); + _array[idx]._string2 = file->readString(); + _array[idx]._string3 = file->readString(); + } + } +} + + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub12.h b/engines/titanic/pet_control/pet_control_sub12.h index b90c451d5e..5c0f0b397c 100644 --- a/engines/titanic/pet_control/pet_control_sub12.h +++ b/engines/titanic/pet_control/pet_control_sub12.h @@ -28,17 +28,19 @@ namespace Titanic { class CPetControlSub12 { -protected: - int _field0; - int _field4; - int _field8; + struct ArrayEntry { + CString _string1; + CString _string2; + CString _string3; + }; +private: + Common::Array _array; CString _string1; int _field18; int _field1C; int _field20; int _field24; int _field28; - int _field2C; int _field30; int _field34; int _field38; @@ -59,9 +61,14 @@ protected: int _field74; int _field78; int _field7C; +private: + void setupArrays(int count); + + void freeArrays(); public: - CPetControlSub12(); + CPetControlSub12(int count = 10); + void load(SimpleFile *file, int param); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub2.cpp b/engines/titanic/pet_control/pet_control_sub2.cpp index 84896bb939..2e8b35e2f0 100644 --- a/engines/titanic/pet_control/pet_control_sub2.cpp +++ b/engines/titanic/pet_control/pet_control_sub2.cpp @@ -35,8 +35,25 @@ void CPetControlSub2::save(SimpleFile *file, int indent) const { } -void CPetControlSub2::load(SimpleFile *file) { - +void CPetControlSub2::load(SimpleFile *file, int param) { + if (!param) { + int count = file->readNumber(); + + for (int idx = 0; idx < count; ++idx) { + int v1 = file->readNumber(); + int v2 = file->readNumber(); + warning("TODO: CPetControlSub2::load - %d,%d", v1, v2); + } + + _listItem.setField34(file->readNumber()); + file->readNumber(); + _field1C0 = file->readNumber(); + _field1C4 = file->readNumber(); + _field1C8 = file->readNumber(); + _field1CC = file->readNumber(); + _field1D0 = file->readNumber(); + _field1D4 = file->readNumber(); + } } } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub2.h b/engines/titanic/pet_control/pet_control_sub2.h index 46ad1acacc..d32b30aea0 100644 --- a/engines/titanic/pet_control/pet_control_sub2.h +++ b/engines/titanic/pet_control/pet_control_sub2.h @@ -61,7 +61,7 @@ public: /** * Load the data for the class from file */ - virtual void load(SimpleFile *file); + virtual void load(SimpleFile *file, int param); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub3.cpp b/engines/titanic/pet_control/pet_control_sub3.cpp index 2f508be3e6..d134b1bbc3 100644 --- a/engines/titanic/pet_control/pet_control_sub3.cpp +++ b/engines/titanic/pet_control/pet_control_sub3.cpp @@ -24,12 +24,4 @@ namespace Titanic { -void CPetControlSub3::save(SimpleFile *file, int indent) const { - -} - -void CPetControlSub3::load(SimpleFile *file) { - -} - } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub3.h b/engines/titanic/pet_control/pet_control_sub3.h index b5eebb1fb6..aa53db5e00 100644 --- a/engines/titanic/pet_control/pet_control_sub3.h +++ b/engines/titanic/pet_control/pet_control_sub3.h @@ -46,15 +46,8 @@ private: CPetVal _val11; CPetControlSub12 _sub12; public: - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); + + }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub4.cpp b/engines/titanic/pet_control/pet_control_sub4.cpp index 49e5cb23fd..041bf50fa6 100644 --- a/engines/titanic/pet_control/pet_control_sub4.cpp +++ b/engines/titanic/pet_control/pet_control_sub4.cpp @@ -35,8 +35,8 @@ void CPetControlSub4::save(SimpleFile *file, int indent) const { } -void CPetControlSub4::load(SimpleFile *file) { - +void CPetControlSub4::load(SimpleFile *file, int param) { + _field298 = file->readNumber(); } } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub4.h b/engines/titanic/pet_control/pet_control_sub4.h index b5de13b468..18dbd7c1ae 100644 --- a/engines/titanic/pet_control/pet_control_sub4.h +++ b/engines/titanic/pet_control/pet_control_sub4.h @@ -51,7 +51,7 @@ public: /** * Load the data for the class from file */ - virtual void load(SimpleFile *file); + virtual void load(SimpleFile *file, int param); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub5.cpp b/engines/titanic/pet_control/pet_control_sub5.cpp index 461fb1ebc1..6a9b92e7b2 100644 --- a/engines/titanic/pet_control/pet_control_sub5.cpp +++ b/engines/titanic/pet_control/pet_control_sub5.cpp @@ -24,12 +24,20 @@ namespace Titanic { +CPetControlSub5::CPetControlSub5() : + _field98(0), _field9C(0), _fieldA0(0), + _field18C(0), _field20C(0), _field210(0) { +} + void CPetControlSub5::save(SimpleFile *file, int indent) const { } -void CPetControlSub5::load(SimpleFile *file) { - +void CPetControlSub5::load(SimpleFile *file, int param) { + if (!param) { + _field20C = file->readNumber(); + _field210 = file->readNumber(); + } } } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub5.h b/engines/titanic/pet_control/pet_control_sub5.h index 41b37fd7b2..5ef1b26312 100644 --- a/engines/titanic/pet_control/pet_control_sub5.h +++ b/engines/titanic/pet_control/pet_control_sub5.h @@ -24,6 +24,7 @@ #define TITANIC_PET_CONTROL_SUB5_H #include "titanic/pet_control/pet_control_sub_base.h" +#include "titanic/pet_control/pet_control_sub12.h" #include "titanic/pet_control/pet_val.h" namespace Titanic { @@ -34,13 +35,18 @@ private: CPetVal _val2; CPetVal _val3; CPetVal _val4; - CPetControlSubData _field17C; int _field98; int _field9C; int _fieldA0; CPetVal _valArray1[6]; - + CPetControlSubData _field17C; + int _field18C; + CPetControlSub12 _sub12; + int _field20C; + int _field210; public: + CPetControlSub5(); + /** * Save the data for the class to file */ @@ -49,7 +55,7 @@ public: /** * Load the data for the class from file */ - virtual void load(SimpleFile *file); + virtual void load(SimpleFile *file, int param); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub6.cpp b/engines/titanic/pet_control/pet_control_sub6.cpp index d33ea1f824..d017e81d9e 100644 --- a/engines/titanic/pet_control/pet_control_sub6.cpp +++ b/engines/titanic/pet_control/pet_control_sub6.cpp @@ -24,12 +24,4 @@ namespace Titanic { -void CPetControlSub6::save(SimpleFile *file, int indent) const { - -} - -void CPetControlSub6::load(SimpleFile *file) { - -} - } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub6.h b/engines/titanic/pet_control/pet_control_sub6.h index 93f83c2d6b..420da0c7ae 100644 --- a/engines/titanic/pet_control/pet_control_sub6.h +++ b/engines/titanic/pet_control/pet_control_sub6.h @@ -34,15 +34,7 @@ private: CPetControlSub10 _sub10; CPetControlSub10 _sub12; public: - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub7.cpp b/engines/titanic/pet_control/pet_control_sub7.cpp index 8333dc1508..f57454da67 100644 --- a/engines/titanic/pet_control/pet_control_sub7.cpp +++ b/engines/titanic/pet_control/pet_control_sub7.cpp @@ -24,12 +24,4 @@ namespace Titanic { -void CPetControlSub7::save(SimpleFile *file, int indent) const { - -} - -void CPetControlSub7::load(SimpleFile *file) { - -} - } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub7.h b/engines/titanic/pet_control/pet_control_sub7.h index d74ac3c405..f4a1decf12 100644 --- a/engines/titanic/pet_control/pet_control_sub7.h +++ b/engines/titanic/pet_control/pet_control_sub7.h @@ -33,15 +33,7 @@ private: CPetControlSub12 _sub1; CPetControlSub12 _sub2; public: - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub8.cpp b/engines/titanic/pet_control/pet_control_sub8.cpp index c2b0f7f67f..18c68c7ddb 100644 --- a/engines/titanic/pet_control/pet_control_sub8.cpp +++ b/engines/titanic/pet_control/pet_control_sub8.cpp @@ -33,12 +33,4 @@ CPetControlSub8::CPetControlSub8() { _indexes[INDEXES[idx]] = idx; } -void CPetControlSub8::save(SimpleFile *file, int indent) const { - -} - -void CPetControlSub8::load(SimpleFile *file) { - -} - } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub8.h b/engines/titanic/pet_control/pet_control_sub8.h index 391d4cf1fa..115e6d508f 100644 --- a/engines/titanic/pet_control/pet_control_sub8.h +++ b/engines/titanic/pet_control/pet_control_sub8.h @@ -42,15 +42,6 @@ private: public: CPetControlSub8(); - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub_base.h b/engines/titanic/pet_control/pet_control_sub_base.h index ead9a6e6dd..b59c85b30a 100644 --- a/engines/titanic/pet_control/pet_control_sub_base.h +++ b/engines/titanic/pet_control/pet_control_sub_base.h @@ -69,14 +69,14 @@ public: /** * Load the data for the class from file */ - virtual void load(SimpleFile *file) = 0; + virtual void load(SimpleFile *file, int param) {} virtual void proc19() {} /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const = 0; + virtual void save(SimpleFile *file, int indent) const {} virtual void proc21() {} virtual void proc22() {} diff --git a/engines/titanic/pet_control/pet_val_base.cpp b/engines/titanic/pet_control/pet_val_base.cpp index fed1b0d709..c1d2fa7d4f 100644 --- a/engines/titanic/pet_control/pet_val_base.cpp +++ b/engines/titanic/pet_control/pet_val_base.cpp @@ -25,6 +25,9 @@ namespace Titanic { +CPetValBase::CPetValBase() : _field4(0), _field8(0), _fieldC(0), + _field10(0), _field14(0) {} + void CPetValBase::proc5(CLinkItemSub *linkItem) { if (linkItem) linkItem->clear(); diff --git a/engines/titanic/pet_control/pet_val_base.h b/engines/titanic/pet_control/pet_val_base.h index 1d5399b70b..f5f6e58387 100644 --- a/engines/titanic/pet_control/pet_val_base.h +++ b/engines/titanic/pet_control/pet_val_base.h @@ -36,8 +36,7 @@ protected: int _field10; int _field14; public: - CPetValBase() : _field4(0), _field8(0), _fieldC(0), - _field10(0), _field14(0) {} + CPetValBase(); virtual ~CPetValBase() {} virtual void proc1() {} -- cgit v1.2.3 From f01bd1be9f6334a614cdd5ca7a7123b40c4397be Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 5 Mar 2016 15:44:39 -0500 Subject: TITANIC: Create stubs for CStarControl support classes --- engines/titanic/core/saveable_object.cpp | 4 ++ engines/titanic/game/star_control.cpp | 37 --------------- engines/titanic/game/star_control.h | 50 -------------------- engines/titanic/module.mk | 14 +++++- engines/titanic/star_control/star_control.cpp | 42 +++++++++++++++++ engines/titanic/star_control/star_control.h | 50 ++++++++++++++++++++ engines/titanic/star_control/star_control_sub1.cpp | 32 +++++++++++++ engines/titanic/star_control/star_control_sub1.h | 54 ++++++++++++++++++++++ .../titanic/star_control/star_control_sub10.cpp | 28 +++++++++++ engines/titanic/star_control/star_control_sub10.h | 38 +++++++++++++++ engines/titanic/star_control/star_control_sub2.cpp | 28 +++++++++++ engines/titanic/star_control/star_control_sub2.h | 37 +++++++++++++++ engines/titanic/star_control/star_control_sub3.cpp | 31 +++++++++++++ engines/titanic/star_control/star_control_sub3.h | 45 ++++++++++++++++++ engines/titanic/star_control/star_control_sub4.cpp | 31 +++++++++++++ engines/titanic/star_control/star_control_sub4.h | 43 +++++++++++++++++ engines/titanic/star_control/star_control_sub5.cpp | 31 +++++++++++++ engines/titanic/star_control/star_control_sub5.h | 50 ++++++++++++++++++++ engines/titanic/star_control/star_control_sub6.cpp | 33 +++++++++++++ engines/titanic/star_control/star_control_sub6.h | 48 +++++++++++++++++++ engines/titanic/star_control/star_control_sub7.cpp | 28 +++++++++++ engines/titanic/star_control/star_control_sub7.h | 35 ++++++++++++++ engines/titanic/star_control/star_control_sub8.cpp | 31 +++++++++++++ engines/titanic/star_control/star_control_sub8.h | 47 +++++++++++++++++++ engines/titanic/star_control/star_control_sub9.cpp | 28 +++++++++++ engines/titanic/star_control/star_control_sub9.h | 42 +++++++++++++++++ 26 files changed, 848 insertions(+), 89 deletions(-) delete mode 100644 engines/titanic/game/star_control.cpp delete mode 100644 engines/titanic/game/star_control.h create mode 100644 engines/titanic/star_control/star_control.cpp create mode 100644 engines/titanic/star_control/star_control.h create mode 100644 engines/titanic/star_control/star_control_sub1.cpp create mode 100644 engines/titanic/star_control/star_control_sub1.h create mode 100644 engines/titanic/star_control/star_control_sub10.cpp create mode 100644 engines/titanic/star_control/star_control_sub10.h create mode 100644 engines/titanic/star_control/star_control_sub2.cpp create mode 100644 engines/titanic/star_control/star_control_sub2.h create mode 100644 engines/titanic/star_control/star_control_sub3.cpp create mode 100644 engines/titanic/star_control/star_control_sub3.h create mode 100644 engines/titanic/star_control/star_control_sub4.cpp create mode 100644 engines/titanic/star_control/star_control_sub4.h create mode 100644 engines/titanic/star_control/star_control_sub5.cpp create mode 100644 engines/titanic/star_control/star_control_sub5.h create mode 100644 engines/titanic/star_control/star_control_sub6.cpp create mode 100644 engines/titanic/star_control/star_control_sub6.h create mode 100644 engines/titanic/star_control/star_control_sub7.cpp create mode 100644 engines/titanic/star_control/star_control_sub7.h create mode 100644 engines/titanic/star_control/star_control_sub8.cpp create mode 100644 engines/titanic/star_control/star_control_sub8.h create mode 100644 engines/titanic/star_control/star_control_sub9.cpp create mode 100644 engines/titanic/star_control/star_control_sub9.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 5a60798d9f..8c91c5741b 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -391,6 +391,8 @@ #include "titanic/sound/view_toggles_other_music.h" #include "titanic/sound/water_lapping_sounds.h" +#include "titanic/star_control/star_control.h" + namespace Titanic { Common::HashMap * @@ -939,6 +941,7 @@ DEFFN(CTriggerAutoMusicPlayer) DEFFN(CViewAutoSoundPlayer) DEFFN(CViewTogglesOtherMusic) DEFFN(CWaterLappingSounds) +DEFFN(CStarControl); void CSaveableObject::initClassList() { _classList = new Common::HashMap(); @@ -1486,6 +1489,7 @@ void CSaveableObject::initClassList() { ADDFN(CViewAutoSoundPlayer); ADDFN(CViewTogglesOtherMusic); ADDFN(CWaterLappingSounds); + ADDFN(CStarControl); } void CSaveableObject::freeClassList() { diff --git a/engines/titanic/game/star_control.cpp b/engines/titanic/game/star_control.cpp deleted file mode 100644 index 0996a0fc21..0000000000 --- a/engines/titanic/game/star_control.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 "titanic/game/star_control.h" - -namespace Titanic { - -void CStarControl::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - CGameObject::save(file, indent); -} - -void CStarControl::load(SimpleFile *file) { - file->readNumber(); - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/star_control.h b/engines/titanic/game/star_control.h deleted file mode 100644 index c76e9be382..0000000000 --- a/engines/titanic/game/star_control.h +++ /dev/null @@ -1,50 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_STAR_CONTROL_H -#define TITANIC_STAR_CONTROL_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CStarControl : public CGameObject { -public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CStarControl"; } - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_STAR_CONTROL_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index e597860b51..a8fd6eb839 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -188,7 +188,6 @@ MODULE_OBJS := \ game/show_cell_points.o \ game/speech_dispensor.o \ game/splash_animation.o \ - game/star_control.o \ game/starling_puret.o \ game/start_action.o \ game/stop_phonograph_button.o \ @@ -403,7 +402,18 @@ MODULE_OBJS := \ sound/trigger_auto_music_player.o \ sound/view_auto_sound_player.o \ sound/view_toggles_other_music.o \ - sound/water_lapping_sounds.o + sound/water_lapping_sounds.o \ + star_control/star_control.o \ + star_control/star_control_sub1.o \ + star_control/star_control_sub2.o \ + star_control/star_control_sub3.o \ + star_control/star_control_sub4.o \ + star_control/star_control_sub5.o \ + star_control/star_control_sub6.o \ + star_control/star_control_sub7.o \ + star_control/star_control_sub8.o \ + star_control/star_control_sub9.o \ + star_control/star_control_sub10.o # This module can be built as a plugin ifeq ($(ENABLE_TITANIC), DYNAMIC_PLUGIN) diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp new file mode 100644 index 0000000000..d6cd20a4a0 --- /dev/null +++ b/engines/titanic/star_control/star_control.cpp @@ -0,0 +1,42 @@ +/* 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 "titanic/star_control/star_control.h" + +namespace Titanic { + +void CStarControl::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CStarControl::load(SimpleFile *file) { + int val = file->readNumber(); + + if (!val) { + + } + + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control.h b/engines/titanic/star_control/star_control.h new file mode 100644 index 0000000000..c76e9be382 --- /dev/null +++ b/engines/titanic/star_control/star_control.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_CONTROL_H +#define TITANIC_STAR_CONTROL_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CStarControl : public CGameObject { +public: + /** + * Return the class name + */ + virtual const char *getClassName() const { return "CStarControl"; } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_H */ diff --git a/engines/titanic/star_control/star_control_sub1.cpp b/engines/titanic/star_control/star_control_sub1.cpp new file mode 100644 index 0000000000..7122347677 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub1.cpp @@ -0,0 +1,32 @@ +/* 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 "titanic/star_control/star_control_sub1.h" + +namespace Titanic { + +CStarControlSub1::CStarControlSub1() : + _field7DA8(0), _field7DAC(0), _field7DB0(0), + _field7DB4(1), _field7DB8(0), _field7DBC(0) { +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub1.h b/engines/titanic/star_control/star_control_sub1.h new file mode 100644 index 0000000000..ce160ebc89 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub1.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_CONTROL_SUB1_H +#define TITANIC_STAR_CONTROL_SUB1_H + +#include "titanic/star_control/star_control_sub2.h" +#include "titanic/star_control/star_control_sub5.h" +#include "titanic/star_control/star_control_sub7.h" +#include "titanic/star_control/star_control_sub8.h" +#include "titanic/star_control/star_control_sub9.h" +#include "titanic/star_control/star_control_sub10.h" + +namespace Titanic { + +class CStarControlSub1 : public CStarControlSub2 { +private: + CStarControlSub7 _sub7; + CStarControlSub8 _sub8; + CStarControlSub9 _sub9; + CStarControlSub10 _sub10; + CStarControlSub5 _sub5; + int _field7DA8; + int _field7DAC; + int _field7DB0; + int _field7DB4; + int _field7DB8; + int _field7DBC; +public: + CStarControlSub1(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB1_H */ diff --git a/engines/titanic/star_control/star_control_sub10.cpp b/engines/titanic/star_control/star_control_sub10.cpp new file mode 100644 index 0000000000..ca32f5e7dc --- /dev/null +++ b/engines/titanic/star_control/star_control_sub10.cpp @@ -0,0 +1,28 @@ +/* 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 "titanic/star_control/star_control_sub10.h" + +namespace Titanic { + + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub10.h b/engines/titanic/star_control/star_control_sub10.h new file mode 100644 index 0000000000..af4ad17c6e --- /dev/null +++ b/engines/titanic/star_control/star_control_sub10.h @@ -0,0 +1,38 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_CONTROL_SUB10_H +#define TITANIC_STAR_CONTROL_SUB10_H + +namespace Titanic { + +class CStarControlSub10 { +private: + int _field0; + int _field4; +public: + CStarControlSub10() : _field0(0), _field4(0) {} +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB10_H */ diff --git a/engines/titanic/star_control/star_control_sub2.cpp b/engines/titanic/star_control/star_control_sub2.cpp new file mode 100644 index 0000000000..9b9a5f84ad --- /dev/null +++ b/engines/titanic/star_control/star_control_sub2.cpp @@ -0,0 +1,28 @@ +/* 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 "titanic/star_control/star_control_sub2.h" + +namespace Titanic { + + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub2.h b/engines/titanic/star_control/star_control_sub2.h new file mode 100644 index 0000000000..2bae029c96 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub2.h @@ -0,0 +1,37 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_CONTROL_SUB2_H +#define TITANIC_STAR_CONTROL_SUB2_H + +#include "titanic/star_control/star_control_sub3.h" + +namespace Titanic { + +class CStarControlSub2: public CStarControlSub3 { +public: + virtual ~CStarControlSub2() {} +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB2_H */ diff --git a/engines/titanic/star_control/star_control_sub3.cpp b/engines/titanic/star_control/star_control_sub3.cpp new file mode 100644 index 0000000000..72991b1f33 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub3.cpp @@ -0,0 +1,31 @@ +/* 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 "titanic/star_control/star_control_sub3.h" + +namespace Titanic { + +CStarControlSub3::CStarControlSub3() : _field4(0), _field8(0), + _fieldC(1), _field28(0), _field2C(0x3F800000) { +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub3.h b/engines/titanic/star_control/star_control_sub3.h new file mode 100644 index 0000000000..cc214c328c --- /dev/null +++ b/engines/titanic/star_control/star_control_sub3.h @@ -0,0 +1,45 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_CONTROL_SUB3_H +#define TITANIC_STAR_CONTROL_SUB3_H + +#include "titanic/star_control/star_control_sub4.h" + +namespace Titanic { + +class CStarControlSub3 { +protected: + int _field4; + int _field8; + int _fieldC; + CStarControlSub4 _sub4; + int _field28; + int _field2C; +public: + CStarControlSub3(); + virtual ~CStarControlSub3() {} +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB3_H */ diff --git a/engines/titanic/star_control/star_control_sub4.cpp b/engines/titanic/star_control/star_control_sub4.cpp new file mode 100644 index 0000000000..27ef859f51 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub4.cpp @@ -0,0 +1,31 @@ +/* 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 "titanic/star_control/star_control_sub4.h" + +namespace Titanic { + +CStarControlSub4::CStarControlSub4() : _field0(0), + _field4(0), _fieldC(0), _field10(0), _field14(0) { +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub4.h b/engines/titanic/star_control/star_control_sub4.h new file mode 100644 index 0000000000..4aa75f8566 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub4.h @@ -0,0 +1,43 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_CONTROL_SUB4_H +#define TITANIC_STAR_CONTROL_SUB4_H + +namespace Titanic { + +class CStarControlSub4 { +private: + int _field0; + int _field4; + int _field8; + int _fieldC; + int _field10; + int _field14; +public: + CStarControlSub4(); + +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB4_H */ diff --git a/engines/titanic/star_control/star_control_sub5.cpp b/engines/titanic/star_control/star_control_sub5.cpp new file mode 100644 index 0000000000..64e48e1814 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub5.cpp @@ -0,0 +1,31 @@ +/* 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 "titanic/star_control/star_control_sub5.h" + +namespace Titanic { + +CStarControlSub5::CStarControlSub5() : + _field4(1), _field78AC(0), _field78B0(0) { +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub5.h b/engines/titanic/star_control/star_control_sub5.h new file mode 100644 index 0000000000..c3621e93b4 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub5.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_CONTROL_SUB5_H +#define TITANIC_STAR_CONTROL_SUB5_H + +#include "titanic/star_control/star_control_sub6.h" + +namespace Titanic { + +class CStarControlSub5 { + struct SubEntry { + int _field0; + int _field4; + int _field8; + int _fieldC; + }; +private: + int _field4; + SubEntry _array[5]; + CStarControlSub6 _sub1, _sub2; + int _field7914; + int _field78AC; + int _field78B0; +public: + CStarControlSub5(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB5_H */ diff --git a/engines/titanic/star_control/star_control_sub6.cpp b/engines/titanic/star_control/star_control_sub6.cpp new file mode 100644 index 0000000000..48285a7dbe --- /dev/null +++ b/engines/titanic/star_control/star_control_sub6.cpp @@ -0,0 +1,33 @@ +/* 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 "titanic/star_control/star_control_sub6.h" + +namespace Titanic { + +CStarControlSub6::CStarControlSub6() : + _field0(0x3F800000), _field4(0), _field8(0), _fieldC(0), + _field10(0x3F800000), _field14(0), _field18(0), _field1C(0), + _field20(0x3F800000), _field24(0), _field28(0), _field2C(0) { +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub6.h b/engines/titanic/star_control/star_control_sub6.h new file mode 100644 index 0000000000..d57b35cf7c --- /dev/null +++ b/engines/titanic/star_control/star_control_sub6.h @@ -0,0 +1,48 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_CONTROL_SUB6_H +#define TITANIC_STAR_CONTROL_SUB6_H + +namespace Titanic { + +class CStarControlSub6 { +private: + int _field0; + int _field4; + int _field8; + int _fieldC; + int _field10; + int _field14; + int _field18; + int _field1C; + int _field20; + int _field24; + int _field28; + int _field2C; +public: + CStarControlSub6(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB6_H */ diff --git a/engines/titanic/star_control/star_control_sub7.cpp b/engines/titanic/star_control/star_control_sub7.cpp new file mode 100644 index 0000000000..0677e33558 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub7.cpp @@ -0,0 +1,28 @@ +/* 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 "titanic/star_control/star_control_sub7.h" + +namespace Titanic { + + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub7.h b/engines/titanic/star_control/star_control_sub7.h new file mode 100644 index 0000000000..9999423d94 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub7.h @@ -0,0 +1,35 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_CONTROL_SUB7_H +#define TITANIC_STAR_CONTROL_SUB7_H + +#include "titanic/star_control/star_control_sub3.h" +namespace Titanic { + +class CStarControlSub7 : public CStarControlSub3 { +public: +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB7_H */ diff --git a/engines/titanic/star_control/star_control_sub8.cpp b/engines/titanic/star_control/star_control_sub8.cpp new file mode 100644 index 0000000000..cdb249b663 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub8.cpp @@ -0,0 +1,31 @@ +/* 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 "titanic/star_control/star_control_sub8.h" + +namespace Titanic { + +CStarControlSub8::CStarControlSub8() : + _field0(0), _field4(0), _field8(-1), _fieldC(-1) { +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub8.h b/engines/titanic/star_control/star_control_sub8.h new file mode 100644 index 0000000000..511bee47e7 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub8.h @@ -0,0 +1,47 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_CONTROL_SUB8_H +#define TITANIC_STAR_CONTROL_SUB8_H + +namespace Titanic { + +class CStarControlSub8 { + struct StructEntry { + int _field0; + int _field4; + int _field8; + int _fieldC; + }; +private: + int _field0; + int _field4; + int _field8; + int _fieldC; + StructEntry _array[3]; +public: + CStarControlSub8(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB8_H */ diff --git a/engines/titanic/star_control/star_control_sub9.cpp b/engines/titanic/star_control/star_control_sub9.cpp new file mode 100644 index 0000000000..92ce8f6a85 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub9.cpp @@ -0,0 +1,28 @@ +/* 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 "titanic/star_control/star_control_sub9.h" + +namespace Titanic { + + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub9.h b/engines/titanic/star_control/star_control_sub9.h new file mode 100644 index 0000000000..67a14a5109 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub9.h @@ -0,0 +1,42 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_CONTROL_SUB9_H +#define TITANIC_STAR_CONTROL_SUB9_H + +namespace Titanic { + +class CStarControlSub9 { + struct ArrayEntry { + int _field0; + int _field4; + int _field8; + ArrayEntry() : _field0(0), _field4(0), _field8(0) {} + }; +private: + ArrayEntry _array[80]; +public: +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB9_H */ -- cgit v1.2.3 From 20725a0edaa8e92d49a59328e6a63bfb97c4a57c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 5 Mar 2016 21:44:57 -0500 Subject: TITANIC: Further work on CStarControl support classes and loading --- engines/titanic/module.mk | 7 +- engines/titanic/star_control/star_control.cpp | 14 ++++ engines/titanic/star_control/star_control.h | 13 ++++ engines/titanic/star_control/star_control_sub1.cpp | 17 +++++ engines/titanic/star_control/star_control_sub1.h | 7 ++ .../titanic/star_control/star_control_sub11.cpp | 51 +++++++++++++++ engines/titanic/star_control/star_control_sub11.h | 62 ++++++++++++++++++ .../titanic/star_control/star_control_sub12.cpp | 40 ++++++++++++ engines/titanic/star_control/star_control_sub12.h | 63 ++++++++++++++++++ .../titanic/star_control/star_control_sub13.cpp | 75 ++++++++++++++++++++++ engines/titanic/star_control/star_control_sub13.h | 73 +++++++++++++++++++++ .../titanic/star_control/star_control_sub14.cpp | 50 +++++++++++++++ engines/titanic/star_control/star_control_sub14.h | 58 +++++++++++++++++ .../titanic/star_control/star_control_sub15.cpp | 31 +++++++++ engines/titanic/star_control/star_control_sub15.h | 43 +++++++++++++ engines/titanic/star_control/star_control_sub3.cpp | 4 ++ engines/titanic/star_control/star_control_sub3.h | 13 ++++ engines/titanic/star_control/star_control_sub8.h | 12 ++++ 18 files changed, 632 insertions(+), 1 deletion(-) create mode 100644 engines/titanic/star_control/star_control_sub11.cpp create mode 100644 engines/titanic/star_control/star_control_sub11.h create mode 100644 engines/titanic/star_control/star_control_sub12.cpp create mode 100644 engines/titanic/star_control/star_control_sub12.h create mode 100644 engines/titanic/star_control/star_control_sub13.cpp create mode 100644 engines/titanic/star_control/star_control_sub13.h create mode 100644 engines/titanic/star_control/star_control_sub14.cpp create mode 100644 engines/titanic/star_control/star_control_sub14.h create mode 100644 engines/titanic/star_control/star_control_sub15.cpp create mode 100644 engines/titanic/star_control/star_control_sub15.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index a8fd6eb839..b9f5b641ed 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -413,7 +413,12 @@ MODULE_OBJS := \ star_control/star_control_sub7.o \ star_control/star_control_sub8.o \ star_control/star_control_sub9.o \ - star_control/star_control_sub10.o + star_control/star_control_sub10.o \ + star_control/star_control_sub11.o \ + star_control/star_control_sub12.o \ + star_control/star_control_sub13.o \ + star_control/star_control_sub14.o \ + star_control/star_control_sub15.o # This module can be built as a plugin ifeq ($(ENABLE_TITANIC), DYNAMIC_PLUGIN) diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp index d6cd20a4a0..c8ee8c2d7b 100644 --- a/engines/titanic/star_control/star_control.cpp +++ b/engines/titanic/star_control/star_control.cpp @@ -20,10 +20,15 @@ * */ +#include "titanic/screen_manager.h" #include "titanic/star_control/star_control.h" namespace Titanic { +CStarControl::CStarControl() : _fieldBC(0), _field80A0(0), + _field80A4(0), _field80A8(0), _field80AC(0), _field80B0(0) { +} + void CStarControl::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CGameObject::save(file, indent); @@ -33,7 +38,16 @@ void CStarControl::load(SimpleFile *file) { int val = file->readNumber(); if (!val) { + _sub1.load(file, 0); + if (!_sub1.initDocument()) + error("Couldn't initialise the StarField document"); + + _sub11.load(file, 0); + CScreenManager *screenManager = CScreenManager::setCurrent(); + if (!screenManager) + error("There's no screen manager during loading"); + warning("TODO"); } CGameObject::load(file); diff --git a/engines/titanic/star_control/star_control.h b/engines/titanic/star_control/star_control.h index c76e9be382..2a24e517fc 100644 --- a/engines/titanic/star_control/star_control.h +++ b/engines/titanic/star_control/star_control.h @@ -24,11 +24,24 @@ #define TITANIC_STAR_CONTROL_H #include "titanic/core/game_object.h" +#include "titanic/star_control/star_control_sub1.h" +#include "titanic/star_control/star_control_sub11.h" namespace Titanic { class CStarControl : public CGameObject { +private: + int _fieldBC; + CStarControlSub1 _sub1; + CStarControlSub11 _sub11; + int _field80A0; + int _field80A4; + int _field80A8; + int _field80AC; + int _field80B0; public: + CStarControl(); + /** * Return the class name */ diff --git a/engines/titanic/star_control/star_control_sub1.cpp b/engines/titanic/star_control/star_control_sub1.cpp index 7122347677..6adc9a64d0 100644 --- a/engines/titanic/star_control/star_control_sub1.cpp +++ b/engines/titanic/star_control/star_control_sub1.cpp @@ -29,4 +29,21 @@ CStarControlSub1::CStarControlSub1() : _field7DB4(1), _field7DB8(0), _field7DBC(0) { } +void CStarControlSub1::load(SimpleFile *file, int param) { + if (!param) { + _sub7.load(file); + _sub8.load(file); + _field7DA8 = file->readNumber(); + _field7DAC = file->readNumber(); + _field7DB0 = file->readNumber(); + _field7DB4 = file->readNumber(); + _field7DBC = file->readNumber(); + } +} + +bool CStarControlSub1::initDocument() { + warning("CStarControlSub1::initDocument"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub1.h b/engines/titanic/star_control/star_control_sub1.h index ce160ebc89..2e76a1ff41 100644 --- a/engines/titanic/star_control/star_control_sub1.h +++ b/engines/titanic/star_control/star_control_sub1.h @@ -47,6 +47,13 @@ private: int _field7DBC; public: CStarControlSub1(); + + /** + * Load the data for the class from file + */ + void load(SimpleFile *file, int param); + + bool initDocument(); }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub11.cpp b/engines/titanic/star_control/star_control_sub11.cpp new file mode 100644 index 0000000000..a2bd7b2aa6 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub11.cpp @@ -0,0 +1,51 @@ +/* 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 "titanic/screen_manager.h" +#include "titanic/star_control/star_control_sub11.h" + +namespace Titanic { + +CStarControlSub11::CStarControlSub11() : + _sub12(nullptr, nullptr), _sub13(nullptr), + _field4(0), _field8(0), _field20C(0), _field210(0), + _field214(0), _field218(0), _field21C(0) { + _sub12.proc3(); +} + +void CStarControlSub11::load(SimpleFile *file, int param) { + if (!param) { + _sub12.load(file, param); + + int val = file->readNumber(); + if (val) + _sub13.load(file, 0); + + _field218 = file->readNumber(); + _field21C = file->readNumber(); + } +} + +void CStarControlSub11::save(SimpleFile *file, int indent) const { +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub11.h b/engines/titanic/star_control/star_control_sub11.h new file mode 100644 index 0000000000..bff246f3fb --- /dev/null +++ b/engines/titanic/star_control/star_control_sub11.h @@ -0,0 +1,62 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_CONTROL_SUB11_H +#define TITANIC_STAR_CONTROL_SUB11_H + +#include "titanic/simple_file.h" +#include "titanic/star_control/star_control_sub12.h" +#include "titanic/star_control/star_control_sub13.h" +#include "titanic/star_control/star_control_sub15.h" + +namespace Titanic { + +class CStarControlSub11 { +private: + int _field0; + int _field4; + int _field8; + CStarControlSub12 _sub12; + CStarControlSub13 _sub13; + CStarControlSub15 _sub15; + int _field20C; + int _field210; + int _field214; + int _field218; + int _field21C; +public: + CStarControlSub11(); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file, int param); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB11_H */ diff --git a/engines/titanic/star_control/star_control_sub12.cpp b/engines/titanic/star_control/star_control_sub12.cpp new file mode 100644 index 0000000000..3e288e83c0 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub12.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/star_control/star_control_sub12.h" + +namespace Titanic { + +CStarControlSub12::CStarControlSub12(void *val1, void *val2) : + _field4(-1), _field2C(0), _field108(0), + _sub13(val1) { +} + +void CStarControlSub12::load(SimpleFile *file, int param) { + _sub13.load(file, param); +} + +void CStarControlSub12::save(SimpleFile *file, int indent) const { + _sub13.save(file, indent); +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub12.h b/engines/titanic/star_control/star_control_sub12.h new file mode 100644 index 0000000000..92192ec74b --- /dev/null +++ b/engines/titanic/star_control/star_control_sub12.h @@ -0,0 +1,63 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_CONTROL_SUB12_H +#define TITANIC_STAR_CONTROL_SUB12_H + +#include "titanic/simple_file.h" +#include "titanic/star_control/star_control_sub13.h" + +namespace Titanic { + +class CStarControlSub12 { + struct ArrayEntry { + int _field0; + int _field4; + int _field8; + ArrayEntry() : _field0(0), _field4(0), _field8(0) {} + }; +private: + int _field4; + ArrayEntry _array[3]; + int _field2C; + CStarControlSub13 _sub13; + int _field108; + int _field21C; +public: + CStarControlSub12(void *val1, void *val2); + + virtual void proc3() {} + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file, int param); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB12_H */ diff --git a/engines/titanic/star_control/star_control_sub13.cpp b/engines/titanic/star_control/star_control_sub13.cpp new file mode 100644 index 0000000000..fbe40b9532 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub13.cpp @@ -0,0 +1,75 @@ +/* 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 "titanic/star_control/star_control_sub13.h" + +namespace Titanic { + +CStarControlSub13::CStarControlSub13(void *ptr): + _field0(0), _field4(0), _field8(0), _fieldC0(0), + _fieldC4(0), _fieldC8(0), _fieldCC(0), _fieldD0(0) { + if (ptr) { + setup(ptr); + } else { + _fieldC = 0; + _field10 = 0x44480000; + _field14 = 0x461C4000; + _field18 = 0x41A00000; + _field1C = 0x41A00000; + _field20 = 600; + _field22 = 340; + _field24 = 0; + } + + _fieldD4 = 0; +} + +void CStarControlSub13::setup(void *ptr) { + // TODO +} + +void CStarControlSub13::load(SimpleFile *file, int param) { + _field0 = file->readFloat(); + _field4 = file->readFloat(); + _field8 = file->readFloat(); + _fieldC = file->readFloat(); + _field10 = file->readFloat(); + _field14 = file->readFloat(); + _field18 = file->readFloat(); + _field1C = file->readFloat(); + _field20 = file->readNumber(); + _field22 = _field20 >> 16; + _field24 = file->readNumber(); + + for (int idx = 0; idx < 5; ++idx) + _valArray[idx] = file->readFloat(); + + _sub14.load(file, param); + _fieldD4 = 0; +} + +void CStarControlSub13::save(SimpleFile *file, int indent) const { + _sub14.save(file, indent); +} + + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub13.h b/engines/titanic/star_control/star_control_sub13.h new file mode 100644 index 0000000000..983fa1c9d4 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub13.h @@ -0,0 +1,73 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_CONTROL_SUB13_H +#define TITANIC_STAR_CONTROL_SUB13_H + +#include "titanic/simple_file.h" +#include "titanic/star_control/star_control_sub6.h" +#include "titanic/star_control/star_control_sub14.h" + +namespace Titanic { + +class CStarControlSub13 { +private: + double _field0; + double _field4; + double _field8; + double _fieldC; + double _field10; + double _field14; + double _field18; + double _field1C; + int _field20; + int _field22; + int _field24; + double _valArray[5]; + CStarControlSub14 _sub14; + CStarControlSub6 _sub1; + CStarControlSub6 _sub2; + int _fieldC0; + int _fieldC4; + int _fieldC8; + int _fieldCC; + int _fieldD0; + int _fieldD4; +private: + void setup(void *ptr); +public: + CStarControlSub13(void *ptr); + + /** + * Load the data for the class from file + */ + void load(SimpleFile *file, int param); + + /** + * Save the data for the class to file + */ + void save(SimpleFile *file, int indent) const; +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB13_H */ diff --git a/engines/titanic/star_control/star_control_sub14.cpp b/engines/titanic/star_control/star_control_sub14.cpp new file mode 100644 index 0000000000..3d02705af5 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub14.cpp @@ -0,0 +1,50 @@ +/* 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 "titanic/star_control/star_control_sub14.h" + +namespace Titanic { + +CStarControlSub14::CStarControlSub14() : + _field0(0x3F800000), _field4(0), _field8(0), _fieldC(0), + _field10(0x3F800000), _field14(0), _field18(0), _field1C(0), + _field20(0x3F800000) { +} + +void CStarControlSub14::load(SimpleFile *file, int param) { + _field0 = file->readFloat(); + _field4 = file->readFloat(); + _field8 = file->readFloat(); + _fieldC = file->readFloat(); + _field10 = file->readFloat(); + _field14 = file->readFloat(); + _field18 = file->readFloat(); + _field1C = file->readFloat(); + _field20 = file->readFloat(); +} + +void CStarControlSub14::save(SimpleFile *file, int indent) const { + +} + + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub14.h b/engines/titanic/star_control/star_control_sub14.h new file mode 100644 index 0000000000..63a58bf9c6 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub14.h @@ -0,0 +1,58 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_CONTROL_SUB14_H +#define TITANIC_STAR_CONTROL_SUB14_H + +#include "titanic/simple_file.h" + +namespace Titanic { + +class CStarControlSub14 { +private: + double _field0; + double _field4; + double _field8; + double _fieldC; + double _field10; + double _field14; + double _field18; + double _field1C; + double _field20; +public: + CStarControlSub14(); + + /** + * Load the data for the class from file + */ + void load(SimpleFile *file, int param); + + /** + * Save the data for the class to file + */ + void save(SimpleFile *file, int indent) const; + +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB13_H */ diff --git a/engines/titanic/star_control/star_control_sub15.cpp b/engines/titanic/star_control/star_control_sub15.cpp new file mode 100644 index 0000000000..07ed80ccc5 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub15.cpp @@ -0,0 +1,31 @@ +/* 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 "titanic/star_control/star_control_sub15.h" + +namespace Titanic { + +CStarControlSub15::CStarControlSub15() : _field4(-1), + _field8(32), _fieldC(0), _field10(0), _field14(0) { +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub15.h b/engines/titanic/star_control/star_control_sub15.h new file mode 100644 index 0000000000..2151c5a622 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub15.h @@ -0,0 +1,43 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_CONTROL_SUB15_H +#define TITANIC_STAR_CONTROL_SUB15_H + +#include "titanic/simple_file.h" + +namespace Titanic { + +class CStarControlSub15 { +private: + double _field4; + double _field8; + double _fieldC; + double _field10; + double _field14; +public: + CStarControlSub15(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB15_H */ diff --git a/engines/titanic/star_control/star_control_sub3.cpp b/engines/titanic/star_control/star_control_sub3.cpp index 72991b1f33..c65a308535 100644 --- a/engines/titanic/star_control/star_control_sub3.cpp +++ b/engines/titanic/star_control/star_control_sub3.cpp @@ -28,4 +28,8 @@ CStarControlSub3::CStarControlSub3() : _field4(0), _field8(0), _fieldC(1), _field28(0), _field2C(0x3F800000) { } +void CStarControlSub3::proc2() { + error("TODO"); +} + } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub3.h b/engines/titanic/star_control/star_control_sub3.h index cc214c328c..d6d1c30eed 100644 --- a/engines/titanic/star_control/star_control_sub3.h +++ b/engines/titanic/star_control/star_control_sub3.h @@ -23,6 +23,7 @@ #ifndef TITANIC_STAR_CONTROL_SUB3_H #define TITANIC_STAR_CONTROL_SUB3_H +#include "titanic/simple_file.h" #include "titanic/star_control/star_control_sub4.h" namespace Titanic { @@ -38,6 +39,18 @@ protected: public: CStarControlSub3(); virtual ~CStarControlSub3() {} + + virtual void proc2(); + virtual int proc3() { return 1; } + virtual int proc4() { return 0; } + virtual int proc5() { return 0; } + virtual int proc6() { return 0; } + virtual int proc7() { return 1; } + + virtual void load(SimpleFile *file) {} + + virtual void proc9() {} + }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub8.h b/engines/titanic/star_control/star_control_sub8.h index 511bee47e7..c4b677c2ba 100644 --- a/engines/titanic/star_control/star_control_sub8.h +++ b/engines/titanic/star_control/star_control_sub8.h @@ -23,6 +23,8 @@ #ifndef TITANIC_STAR_CONTROL_SUB8_H #define TITANIC_STAR_CONTROL_SUB8_H +#include "titanic/simple_file.h" + namespace Titanic { class CStarControlSub8 { @@ -40,6 +42,16 @@ private: StructEntry _array[3]; public: CStarControlSub8(); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file) {} + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const {} }; } // End of namespace Titanic -- cgit v1.2.3 From ac930083ac701eb21bab1f04cada545ec60211dd Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 5 Mar 2016 22:46:35 -0500 Subject: TITANIC: Fixes for CStarControl loading --- engines/titanic/star_control/star_control_sub11.cpp | 8 ++++---- engines/titanic/star_control/star_control_sub11.h | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/engines/titanic/star_control/star_control_sub11.cpp b/engines/titanic/star_control/star_control_sub11.cpp index a2bd7b2aa6..6c782933ae 100644 --- a/engines/titanic/star_control/star_control_sub11.cpp +++ b/engines/titanic/star_control/star_control_sub11.cpp @@ -27,8 +27,8 @@ namespace Titanic { CStarControlSub11::CStarControlSub11() : _sub12(nullptr, nullptr), _sub13(nullptr), - _field4(0), _field8(0), _field20C(0), _field210(0), - _field214(0), _field218(0), _field21C(0) { + _field4(0), _field8(0), _field118(0), _field20C(0), + _field210(0), _field214(0), _field218(0), _field21C(0) { _sub12.proc3(); } @@ -36,8 +36,8 @@ void CStarControlSub11::load(SimpleFile *file, int param) { if (!param) { _sub12.load(file, param); - int val = file->readNumber(); - if (val) + _field118 = file->readNumber(); + if (_field118) _sub13.load(file, 0); _field218 = file->readNumber(); diff --git a/engines/titanic/star_control/star_control_sub11.h b/engines/titanic/star_control/star_control_sub11.h index bff246f3fb..6e47f85807 100644 --- a/engines/titanic/star_control/star_control_sub11.h +++ b/engines/titanic/star_control/star_control_sub11.h @@ -36,6 +36,7 @@ private: int _field4; int _field8; CStarControlSub12 _sub12; + int _field118; CStarControlSub13 _sub13; CStarControlSub15 _sub15; int _field20C; -- cgit v1.2.3 From f423d4d41a0d94067162acf868bc7eba99cd3e17 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 5 Mar 2016 22:49:12 -0500 Subject: TITANIC: Add missing CMailMan to saveable object list --- engines/titanic/core/saveable_object.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 8c91c5741b..8a1d3c982e 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -148,6 +148,7 @@ #include "titanic/game/light_switch.h" #include "titanic/game/little_lift_button.h" #include "titanic/game/long_stick_dispenser.h" +#include "titanic/game/mail_man.h" #include "titanic/game/missiveomat.h" #include "titanic/game/missiveomat_button.h" #include "titanic/game/musical_instrument.h" @@ -529,6 +530,7 @@ DEFFN(CLight) DEFFN(CLightSwitch) DEFFN(CLittleLiftButton) DEFFN(CLongStickDispenser) +DEFFN(CMailMan) DEFFN(CMissiveOMat) DEFFN(CMissiveOMatButton) DEFFN(CMusicalInstrument) @@ -1074,6 +1076,7 @@ void CSaveableObject::initClassList() { ADDFN(CLightSwitch); ADDFN(CLittleLiftButton); ADDFN(CLongStickDispenser); + ADDFN(CMailMan); ADDFN(CMissiveOMat); ADDFN(CMissiveOMatButton); ADDFN(CMusicalInstrument); -- cgit v1.2.3 From 7375394b810f3503f168d5770555aa1932d7892d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 6 Mar 2016 19:12:49 -0500 Subject: TITANIC: Converting saveable objects hierarchy to have type data This is necessary for at least message sending, and probably other areas, that needs to be able to pass class filtering for message targets. And I could figure out a clean way to use the built-in RTTI --- engines/titanic/carry/arm.h | 6 +- engines/titanic/carry/auditory_centre.h | 5 +- engines/titanic/carry/bowl_ear.h | 5 +- engines/titanic/carry/brain.h | 6 +- engines/titanic/carry/bridge_piece.h | 6 +- engines/titanic/carry/carry.h | 6 +- engines/titanic/carry/carry_parrot.h | 6 +- engines/titanic/carry/central_core.h | 5 +- engines/titanic/carry/chicken.h | 6 +- engines/titanic/carry/crushed_tv.h | 6 +- engines/titanic/carry/ear.h | 6 +- engines/titanic/carry/eye.h | 6 +- engines/titanic/carry/feathers.h | 6 +- engines/titanic/carry/fruit.h | 6 +- engines/titanic/carry/glass.h | 6 +- engines/titanic/carry/hammer.h | 6 +- engines/titanic/carry/head_piece.h | 6 +- engines/titanic/carry/hose.h | 6 +- engines/titanic/carry/hose_end.h | 6 +- engines/titanic/carry/key.h | 6 +- engines/titanic/carry/liftbot_head.h | 6 +- engines/titanic/carry/long_stick.h | 6 +- engines/titanic/carry/magazine.h | 6 +- engines/titanic/carry/maitred_left_arm.h | 6 +- engines/titanic/carry/maitred_right_arm.h | 5 +- engines/titanic/carry/mouth.h | 6 +- engines/titanic/carry/napkin.h | 6 +- engines/titanic/carry/nose.h | 6 +- engines/titanic/carry/note.h | 6 +- engines/titanic/carry/parcel.h | 6 +- engines/titanic/carry/perch.h | 5 +- engines/titanic/carry/phonograph_cylinder.h | 6 +- engines/titanic/carry/phonograph_ear.h | 6 +- engines/titanic/carry/photograph.h | 6 +- engines/titanic/carry/plug_in.h | 6 +- engines/titanic/carry/speech_centre.h | 6 +- engines/titanic/carry/sweets.h | 6 +- engines/titanic/carry/test_carry.h | 6 +- engines/titanic/carry/vision_centre.h | 5 +- engines/titanic/core/background.h | 6 +- engines/titanic/core/click_responder.h | 5 +- engines/titanic/core/dont_save_file_item.h | 5 +- engines/titanic/core/drop_target.h | 6 +- engines/titanic/core/file_item.h | 5 +- engines/titanic/core/game_object.h | 6 +- engines/titanic/core/link_item.h | 6 +- engines/titanic/core/list.h | 10 +- engines/titanic/core/message_target.h | 5 +- engines/titanic/core/movie_clip.h | 8 +- engines/titanic/core/multi_drop_target.h | 6 +- engines/titanic/core/named_item.h | 5 +- engines/titanic/core/node_item.h | 6 +- engines/titanic/core/project_item.h | 12 +- engines/titanic/core/resource_key.h | 5 +- engines/titanic/core/saveable_object.cpp | 1146 ++++++++++---------- engines/titanic/core/saveable_object.h | 33 +- engines/titanic/core/static_image.h | 5 +- engines/titanic/core/tree_item.h | 6 +- engines/titanic/core/turn_on_object.h | 6 +- engines/titanic/core/turn_on_play_sound.h | 6 +- engines/titanic/core/turn_on_turn_off.h | 6 +- engines/titanic/core/view_item.h | 6 +- engines/titanic/game/announce.h | 6 +- engines/titanic/game/annoy_barbot.h | 5 +- engines/titanic/game/arb_background.h | 6 +- engines/titanic/game/arboretum_gate.h | 6 +- engines/titanic/game/auto_animate.h | 5 +- engines/titanic/game/bar_bell.h | 6 +- engines/titanic/game/bar_menu.h | 6 +- engines/titanic/game/bar_menu_button.h | 6 +- engines/titanic/game/belbot_get_light.h | 5 +- engines/titanic/game/bilge_succubus.h | 6 +- engines/titanic/game/bomb.h | 6 +- engines/titanic/game/bottom_of_well_monitor.h | 6 +- engines/titanic/game/bowl_unlocker.h | 6 +- engines/titanic/game/brain_slot.h | 6 +- engines/titanic/game/bridge_door.h | 5 +- engines/titanic/game/bridge_view.h | 6 +- engines/titanic/game/broken_pell_base.h | 6 +- engines/titanic/game/broken_pellerator.h | 5 +- engines/titanic/game/broken_pellerator_froz.h | 5 +- engines/titanic/game/cage.h | 5 +- engines/titanic/game/call_pellerator.h | 5 +- engines/titanic/game/captains_wheel.h | 6 +- engines/titanic/game/cdrom.h | 6 +- engines/titanic/game/cdrom_computer.h | 6 +- engines/titanic/game/cdrom_tray.h | 6 +- engines/titanic/game/cell_point_button.h | 6 +- engines/titanic/game/chev_code.h | 6 +- engines/titanic/game/chev_panel.h | 6 +- engines/titanic/game/chicken_cooler.h | 6 +- engines/titanic/game/chicken_dispensor.h | 6 +- engines/titanic/game/close_broken_pel.h | 5 +- engines/titanic/game/code_wheel.h | 6 +- engines/titanic/game/computer.h | 6 +- engines/titanic/game/computer_screen.h | 6 +- engines/titanic/game/cookie.h | 6 +- engines/titanic/game/credits.h | 6 +- engines/titanic/game/credits_button.h | 6 +- engines/titanic/game/dead_area.h | 6 +- engines/titanic/game/desk_click_responder.h | 5 +- engines/titanic/game/doorbot_elevator_handler.h | 5 +- engines/titanic/game/doorbot_home_handler.h | 6 +- engines/titanic/game/ear_sweet_bowl.h | 5 +- engines/titanic/game/eject_phonograph_button.h | 6 +- engines/titanic/game/elevator_action_area.h | 6 +- engines/titanic/game/emma_control.h | 6 +- engines/titanic/game/empty_nut_bowl.h | 6 +- engines/titanic/game/end_credit_text.h | 6 +- engines/titanic/game/end_credits.h | 6 +- engines/titanic/game/end_explode_ship.h | 6 +- engines/titanic/game/end_game_credits.h | 6 +- engines/titanic/game/end_sequence_control.h | 5 +- engines/titanic/game/fan.h | 6 +- engines/titanic/game/fan_control.h | 6 +- engines/titanic/game/fan_decrease.h | 5 +- engines/titanic/game/fan_increase.h | 5 +- engines/titanic/game/fan_noises.h | 6 +- engines/titanic/game/floor_indicator.h | 5 +- engines/titanic/game/games_console.h | 6 +- engines/titanic/game/get_lift_eye2.h | 6 +- engines/titanic/game/glass_smasher.h | 5 +- engines/titanic/game/gondolier/gondolier_base.h | 5 +- engines/titanic/game/gondolier/gondolier_chest.h | 5 +- engines/titanic/game/gondolier/gondolier_face.h | 6 +- engines/titanic/game/gondolier/gondolier_mixer.h | 6 +- engines/titanic/game/gondolier/gondolier_slider.h | 6 +- engines/titanic/game/hammer_clip.h | 6 +- engines/titanic/game/hammer_dispensor.h | 6 +- engines/titanic/game/hammer_dispensor_button.h | 6 +- engines/titanic/game/head_slot.h | 6 +- engines/titanic/game/head_smash_event.h | 5 +- engines/titanic/game/head_smash_lever.h | 6 +- engines/titanic/game/head_spinner.h | 6 +- engines/titanic/game/idle_summoner.h | 6 +- engines/titanic/game/leave_sec_class_state.h | 5 +- engines/titanic/game/lemon_dispensor.h | 6 +- engines/titanic/game/light.h | 6 +- engines/titanic/game/light_switch.h | 6 +- engines/titanic/game/little_lift_button.h | 6 +- engines/titanic/game/long_stick_dispenser.h | 6 +- engines/titanic/game/mail_man.h | 6 +- engines/titanic/game/maitred/maitred_arm_holder.h | 5 +- engines/titanic/game/maitred/maitred_body.h | 6 +- engines/titanic/game/maitred/maitred_legs.h | 6 +- .../titanic/game/maitred/maitred_prod_receptor.h | 6 +- engines/titanic/game/missiveomat.h | 6 +- engines/titanic/game/missiveomat_button.h | 6 +- engines/titanic/game/movie_tester.h | 6 +- engines/titanic/game/music_console_button.h | 5 +- engines/titanic/game/music_room_phonograph.h | 6 +- .../game/music_room_stop_phonograph_button.h | 6 +- engines/titanic/game/music_system_lock.h | 6 +- engines/titanic/game/musical_instrument.h | 5 +- engines/titanic/game/nav_helmet.h | 6 +- engines/titanic/game/navigation_computer.h | 5 +- engines/titanic/game/no_nut_bowl.h | 5 +- engines/titanic/game/nose_holder.h | 6 +- engines/titanic/game/null_port_hole.h | 6 +- engines/titanic/game/nut_replacer.h | 5 +- .../titanic/game/parrot/parrot_lobby_controller.h | 5 +- .../game/parrot/parrot_lobby_link_updater.h | 6 +- engines/titanic/game/parrot/parrot_lobby_object.h | 5 +- .../titanic/game/parrot/parrot_lobby_view_object.h | 6 +- engines/titanic/game/parrot/parrot_loser.h | 5 +- .../titanic/game/parrot/parrot_nut_bowl_actor.h | 6 +- engines/titanic/game/parrot/parrot_nut_eater.h | 6 +- engines/titanic/game/parrot/parrot_perch_holder.h | 5 +- engines/titanic/game/parrot/parrot_succubus.h | 6 +- engines/titanic/game/parrot/parrot_trigger.h | 6 +- engines/titanic/game/parrot/player_meets_parrot.h | 5 +- engines/titanic/game/pet/pet.h | 6 +- engines/titanic/game/pet/pet_class1.h | 5 +- engines/titanic/game/pet/pet_class2.h | 5 +- engines/titanic/game/pet/pet_class3.h | 5 +- engines/titanic/game/pet/pet_lift.h | 5 +- engines/titanic/game/pet/pet_monitor.h | 5 +- engines/titanic/game/pet/pet_pellerator.h | 5 +- engines/titanic/game/pet/pet_position.h | 5 +- engines/titanic/game/pet/pet_sentinal.h | 5 +- engines/titanic/game/pet/pet_sounds.h | 6 +- engines/titanic/game/pet/pet_transition.h | 5 +- engines/titanic/game/pet/pet_transport.h | 5 +- engines/titanic/game/pet_disabler.h | 6 +- engines/titanic/game/phonograph.h | 6 +- engines/titanic/game/phonograph_lid.h | 6 +- engines/titanic/game/pickup/pick_up.h | 6 +- engines/titanic/game/pickup/pick_up_bar_glass.h | 5 +- engines/titanic/game/pickup/pick_up_hose.h | 5 +- engines/titanic/game/pickup/pick_up_lemon.h | 5 +- .../titanic/game/pickup/pick_up_speech_centre.h | 5 +- engines/titanic/game/pickup/pick_up_vis_centre.h | 5 +- .../game/placeholder/bar_shelf_vis_centre.h | 7 +- engines/titanic/game/placeholder/lemon_on_bar.h | 5 +- engines/titanic/game/placeholder/place_holder.h | 5 +- engines/titanic/game/placeholder/tv_on_bar.h | 5 +- engines/titanic/game/play_music_button.h | 6 +- engines/titanic/game/play_on_act.h | 5 +- engines/titanic/game/port_hole.h | 6 +- engines/titanic/game/record_phonograph_button.h | 6 +- engines/titanic/game/replacement_ear.h | 5 +- engines/titanic/game/reserved_table.h | 6 +- engines/titanic/game/restaurant_cylinder_holder.h | 6 +- engines/titanic/game/restaurant_phonograph.h | 6 +- engines/titanic/game/room_item.h | 6 +- engines/titanic/game/sauce_dispensor.h | 6 +- engines/titanic/game/search_point.h | 6 +- engines/titanic/game/season_background.h | 6 +- engines/titanic/game/season_barrel.h | 6 +- engines/titanic/game/seasonal_adjustment.h | 6 +- engines/titanic/game/service_elevator_window.h | 6 +- engines/titanic/game/sgt/armchair.h | 5 +- engines/titanic/game/sgt/basin.h | 5 +- engines/titanic/game/sgt/bedfoot.h | 5 +- engines/titanic/game/sgt/bedhead.h | 5 +- engines/titanic/game/sgt/chest_of_drawers.h | 5 +- engines/titanic/game/sgt/desk.h | 5 +- engines/titanic/game/sgt/deskchair.h | 5 +- engines/titanic/game/sgt/drawer.h | 6 +- engines/titanic/game/sgt/sgt_doors.h | 6 +- engines/titanic/game/sgt/sgt_nav.h | 5 +- engines/titanic/game/sgt/sgt_navigation.h | 6 +- engines/titanic/game/sgt/sgt_restaurant_doors.h | 6 +- engines/titanic/game/sgt/sgt_state_control.h | 6 +- engines/titanic/game/sgt/sgt_state_room.h | 6 +- engines/titanic/game/sgt/sgt_tv.h | 5 +- engines/titanic/game/sgt/sgt_upper_doors_sound.h | 6 +- engines/titanic/game/sgt/toilet.h | 5 +- engines/titanic/game/sgt/vase.h | 5 +- engines/titanic/game/sgt/washstand.h | 5 +- engines/titanic/game/ship_setting.h | 6 +- engines/titanic/game/ship_setting_button.h | 6 +- engines/titanic/game/show_cell_points.h | 6 +- engines/titanic/game/speech_dispensor.h | 5 +- engines/titanic/game/splash_animation.h | 5 +- engines/titanic/game/starling_puret.h | 6 +- engines/titanic/game/start_action.h | 6 +- engines/titanic/game/stop_phonograph_button.h | 5 +- engines/titanic/game/sub_glass.h | 6 +- engines/titanic/game/sub_wrapper.h | 6 +- engines/titanic/game/sweet_bowl.h | 5 +- engines/titanic/game/television.h | 6 +- engines/titanic/game/third_class_canal.h | 5 +- engines/titanic/game/throw_tv_down_well.h | 6 +- engines/titanic/game/titania_still_control.h | 5 +- engines/titanic/game/tow_parrot_nav.h | 5 +- engines/titanic/game/transport/exit_pellerator.h | 5 +- engines/titanic/game/transport/gondolier.h | 5 +- engines/titanic/game/transport/lift.h | 6 +- engines/titanic/game/transport/lift_indicator.h | 6 +- engines/titanic/game/transport/pellerator.h | 5 +- engines/titanic/game/transport/service_elevator.h | 6 +- engines/titanic/game/transport/transport.h | 6 +- engines/titanic/game/up_lighter.h | 6 +- engines/titanic/game/useless_lever.h | 5 +- engines/titanic/game/wheel_button.h | 6 +- engines/titanic/game/wheel_hotspot.h | 6 +- engines/titanic/game/wheel_spin.h | 6 +- engines/titanic/game/wheel_spin_horn.h | 5 +- engines/titanic/gfx/act_button.h | 6 +- engines/titanic/gfx/changes_season_button.h | 6 +- engines/titanic/gfx/chev_left_off.h | 6 +- engines/titanic/gfx/chev_left_on.h | 6 +- engines/titanic/gfx/chev_right_off.h | 6 +- engines/titanic/gfx/chev_right_on.h | 6 +- engines/titanic/gfx/chev_send_rec_switch.h | 6 +- engines/titanic/gfx/chev_switch.h | 6 +- engines/titanic/gfx/edit_control.h | 6 +- engines/titanic/gfx/elevator_button.h | 6 +- engines/titanic/gfx/get_from_succ.h | 6 +- engines/titanic/gfx/helmet_on_off.h | 6 +- engines/titanic/gfx/home_photo.h | 6 +- engines/titanic/gfx/icon_nav_action.h | 6 +- engines/titanic/gfx/icon_nav_butt.h | 5 +- engines/titanic/gfx/icon_nav_down.h | 6 +- engines/titanic/gfx/icon_nav_image.h | 5 +- engines/titanic/gfx/icon_nav_left.h | 6 +- engines/titanic/gfx/icon_nav_receive.h | 5 +- engines/titanic/gfx/icon_nav_right.h | 6 +- engines/titanic/gfx/icon_nav_send.h | 5 +- engines/titanic/gfx/icon_nav_up.h | 6 +- engines/titanic/gfx/keybrd_butt.h | 6 +- engines/titanic/gfx/move_object_button.h | 6 +- engines/titanic/gfx/music_control.h | 6 +- engines/titanic/gfx/music_slider.h | 5 +- engines/titanic/gfx/music_slider_pitch.h | 5 +- engines/titanic/gfx/music_slider_speed.h | 5 +- engines/titanic/gfx/music_switch.h | 5 +- engines/titanic/gfx/music_switch_inversion.h | 5 +- engines/titanic/gfx/music_switch_reverse.h | 5 +- engines/titanic/gfx/music_voice_mute.h | 5 +- engines/titanic/gfx/pet_drag_chev.h | 5 +- engines/titanic/gfx/pet_graphic.h | 5 +- engines/titanic/gfx/pet_graphic2.h | 5 +- engines/titanic/gfx/pet_leaf.h | 5 +- engines/titanic/gfx/pet_mode_off.h | 6 +- engines/titanic/gfx/pet_mode_on.h | 6 +- engines/titanic/gfx/pet_mode_panel.h | 6 +- engines/titanic/gfx/pet_pannel1.h | 5 +- engines/titanic/gfx/pet_pannel2.h | 5 +- engines/titanic/gfx/pet_pannel3.h | 5 +- engines/titanic/gfx/send_to_succ.h | 8 +- engines/titanic/gfx/sgt_selector.h | 5 +- engines/titanic/gfx/slider_button.h | 6 +- engines/titanic/gfx/small_chev_left_off.h | 6 +- engines/titanic/gfx/small_chev_left_on.h | 6 +- engines/titanic/gfx/small_chev_right_off.h | 6 +- engines/titanic/gfx/small_chev_right_on.h | 6 +- engines/titanic/gfx/st_button.h | 6 +- engines/titanic/gfx/status_change_button.h | 6 +- engines/titanic/gfx/text_down.h | 5 +- engines/titanic/gfx/text_skrew.h | 5 +- engines/titanic/gfx/text_up.h | 5 +- engines/titanic/gfx/toggle_button.h | 6 +- engines/titanic/gfx/toggle_switch.h | 6 +- engines/titanic/gfx/volume_control.h | 6 +- engines/titanic/messages/auto_sound_event.h | 6 +- engines/titanic/messages/bilge_auto_sound_event.h | 5 +- engines/titanic/messages/bilge_dispensor_event.h | 5 +- engines/titanic/messages/door_auto_sound_event.h | 6 +- engines/titanic/messages/messages.h | 398 +++---- engines/titanic/messages/mouse_messages.h | 20 +- engines/titanic/messages/pet_messages.h | 28 +- engines/titanic/messages/service_elevator_door.h | 6 +- engines/titanic/module.mk | 1 + engines/titanic/moves/enter_bomb_room.h | 6 +- engines/titanic/moves/enter_bridge.h | 6 +- .../titanic/moves/enter_exit_first_class_state.h | 5 +- engines/titanic/moves/enter_exit_mini_lift.h | 6 +- .../titanic/moves/enter_exit_sec_class_mini_lift.h | 7 +- engines/titanic/moves/enter_exit_view.h | 6 +- engines/titanic/moves/enter_sec_class_state.h | 6 +- engines/titanic/moves/exit_arboretum.h | 6 +- engines/titanic/moves/exit_bridge.h | 6 +- engines/titanic/moves/exit_lift.h | 5 +- engines/titanic/moves/exit_pellerator.h | 6 +- engines/titanic/moves/exit_state_room.h | 6 +- engines/titanic/moves/exit_tiania.h | 6 +- engines/titanic/moves/move_player_in_parrot_room.h | 6 +- engines/titanic/moves/move_player_to.h | 6 +- engines/titanic/moves/move_player_to_from.h | 6 +- engines/titanic/moves/multi_move.h | 6 +- engines/titanic/moves/pan_from_pel.h | 6 +- engines/titanic/moves/restaurant_pan_handler.h | 5 +- engines/titanic/moves/restricted_move.h | 6 +- engines/titanic/moves/scraliontis_table.h | 6 +- engines/titanic/moves/trip_down_canal.h | 6 +- engines/titanic/npcs/barbot.h | 6 +- engines/titanic/npcs/bellbot.h | 6 +- engines/titanic/npcs/callbot.h | 6 +- engines/titanic/npcs/character.h | 6 +- engines/titanic/npcs/deskbot.h | 6 +- engines/titanic/npcs/doorbot.h | 6 +- engines/titanic/npcs/liftbot.h | 6 +- engines/titanic/npcs/maitre_d.h | 6 +- engines/titanic/npcs/mobile.h | 6 +- engines/titanic/npcs/parrot.h | 6 +- engines/titanic/npcs/robot_controller.h | 6 +- engines/titanic/npcs/starlings.h | 6 +- engines/titanic/npcs/succubus.h | 6 +- engines/titanic/npcs/summon_bots.h | 6 +- engines/titanic/npcs/titania.h | 6 +- engines/titanic/npcs/true_talk_npc.h | 6 +- engines/titanic/pet_control/pet_control.h | 5 +- engines/titanic/sound/auto_music_player.h | 6 +- engines/titanic/sound/auto_music_player_base.h | 6 +- engines/titanic/sound/auto_sound_player.h | 6 +- engines/titanic/sound/auto_sound_player_adsr.h | 5 +- engines/titanic/sound/background_sound_maker.h | 6 +- engines/titanic/sound/bird_song.h | 6 +- engines/titanic/sound/dome_from_top_of_well.h | 5 +- .../titanic/sound/enter_view_toggles_other_music.h | 6 +- engines/titanic/sound/gondolier_song.h | 6 +- engines/titanic/sound/music_player.h | 6 +- engines/titanic/sound/node_auto_sound_player.h | 6 +- .../titanic/sound/restricted_auto_music_player.h | 5 +- engines/titanic/sound/room_auto_sound_player.h | 5 +- engines/titanic/sound/season_noises.h | 6 +- engines/titanic/sound/seasonal_music_player.h | 6 +- engines/titanic/sound/titania_speech.h | 6 +- engines/titanic/sound/trigger_auto_music_player.h | 5 +- engines/titanic/sound/view_auto_sound_player.h | 6 +- engines/titanic/sound/view_toggles_other_music.h | 6 +- engines/titanic/sound/water_lapping_sounds.h | 6 +- engines/titanic/star_control/star_control.h | 6 +- 385 files changed, 1215 insertions(+), 2579 deletions(-) diff --git a/engines/titanic/carry/arm.h b/engines/titanic/carry/arm.h index 4874707fc5..1f93009d04 100644 --- a/engines/titanic/carry/arm.h +++ b/engines/titanic/carry/arm.h @@ -44,13 +44,9 @@ private: int _field16C; int _field170; public: + CLASSDEF CArm(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CArm"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/auditory_centre.h b/engines/titanic/carry/auditory_centre.h index 9708b6fbfa..c429fd78cd 100644 --- a/engines/titanic/carry/auditory_centre.h +++ b/engines/titanic/carry/auditory_centre.h @@ -29,10 +29,7 @@ namespace Titanic { class CAuditoryCentre : public CBrain { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CAuditoryCentre"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/carry/bowl_ear.h b/engines/titanic/carry/bowl_ear.h index c03446dc99..1617ceda8d 100644 --- a/engines/titanic/carry/bowl_ear.h +++ b/engines/titanic/carry/bowl_ear.h @@ -29,10 +29,7 @@ namespace Titanic { class CBowlEar : public CEar { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBowlEar"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/carry/brain.h b/engines/titanic/carry/brain.h index b5ec70e836..8cfd491cea 100644 --- a/engines/titanic/carry/brain.h +++ b/engines/titanic/carry/brain.h @@ -33,13 +33,9 @@ private: int _field134; int _field138; public: + CLASSDEF CBrain(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBrain"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/bridge_piece.h b/engines/titanic/carry/bridge_piece.h index 50a26c9048..b96015a2a9 100644 --- a/engines/titanic/carry/bridge_piece.h +++ b/engines/titanic/carry/bridge_piece.h @@ -33,13 +33,9 @@ private: Common::Point _pos3; int _field140; public: + CLASSDEF CBridgePiece(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBridgePiece"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/carry.h b/engines/titanic/carry/carry.h index b83ecb7aca..6b3ae2323e 100644 --- a/engines/titanic/carry/carry.h +++ b/engines/titanic/carry/carry.h @@ -47,13 +47,9 @@ private: int _field124; int _field128; public: + CLASSDEF CCarry(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CCarry"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/carry_parrot.h b/engines/titanic/carry/carry_parrot.h index d4c71000fe..a2b17004ac 100644 --- a/engines/titanic/carry/carry_parrot.h +++ b/engines/titanic/carry/carry_parrot.h @@ -38,13 +38,9 @@ private: int _field14C; int _field150; public: + CLASSDEF CCarryParrot(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CCarryParrot"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/central_core.h b/engines/titanic/carry/central_core.h index 277b302e5b..b397046088 100644 --- a/engines/titanic/carry/central_core.h +++ b/engines/titanic/carry/central_core.h @@ -29,10 +29,7 @@ namespace Titanic { class CCentralCore : public CBrain { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CCentralCore"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/carry/chicken.h b/engines/titanic/carry/chicken.h index a2ca321998..a81c27c7e1 100644 --- a/engines/titanic/carry/chicken.h +++ b/engines/titanic/carry/chicken.h @@ -36,13 +36,9 @@ private: int _field13C; int _field140; public: + CLASSDEF CChicken(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CChicken"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/crushed_tv.h b/engines/titanic/carry/crushed_tv.h index ccbeac577a..b2bfd7580e 100644 --- a/engines/titanic/carry/crushed_tv.h +++ b/engines/titanic/carry/crushed_tv.h @@ -29,13 +29,9 @@ namespace Titanic { class CCrushedTV : public CCarry { public: + CLASSDEF CCrushedTV(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CCrushedTV"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/ear.h b/engines/titanic/carry/ear.h index fbee7d02a3..2a20620342 100644 --- a/engines/titanic/carry/ear.h +++ b/engines/titanic/carry/ear.h @@ -29,13 +29,9 @@ namespace Titanic { class CEar : public CHeadPiece { public: + CLASSDEF CEar(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CEar"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/eye.h b/engines/titanic/carry/eye.h index 0f0e73b0d3..f7e17fa81f 100644 --- a/engines/titanic/carry/eye.h +++ b/engines/titanic/carry/eye.h @@ -31,13 +31,9 @@ class CEye : public CHeadPiece { private: int _eyeNum; public: + CLASSDEF CEye(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CEye"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/feathers.h b/engines/titanic/carry/feathers.h index 8fc11b7137..106e9a0620 100644 --- a/engines/titanic/carry/feathers.h +++ b/engines/titanic/carry/feathers.h @@ -29,13 +29,9 @@ namespace Titanic { class CFeathers : public CCarry { public: + CLASSDEF CFeathers(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CFeathers"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/fruit.h b/engines/titanic/carry/fruit.h index bc8a109e0f..3d23afd389 100644 --- a/engines/titanic/carry/fruit.h +++ b/engines/titanic/carry/fruit.h @@ -34,13 +34,9 @@ private: int _field134; int _field138; public: + CLASSDEF CFruit(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CFruit"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/glass.h b/engines/titanic/carry/glass.h index 57922c1920..55c032269a 100644 --- a/engines/titanic/carry/glass.h +++ b/engines/titanic/carry/glass.h @@ -31,13 +31,9 @@ class CGlass : public CCarry { private: CString _string6; public: + CLASSDEF CGlass(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CGlass"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/hammer.h b/engines/titanic/carry/hammer.h index ec05435529..e3180e76a0 100644 --- a/engines/titanic/carry/hammer.h +++ b/engines/titanic/carry/hammer.h @@ -29,13 +29,9 @@ namespace Titanic { class CHammer : public CCarry { public: + CLASSDEF CHammer(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CHammer"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/head_piece.h b/engines/titanic/carry/head_piece.h index ddadb75880..daa5925530 100644 --- a/engines/titanic/carry/head_piece.h +++ b/engines/titanic/carry/head_piece.h @@ -33,13 +33,9 @@ private: CString _string6; int _field13C; public: + CLASSDEF CHeadPiece(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CHeadPiece"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/hose.h b/engines/titanic/carry/hose.h index dc60f6832f..c16351b937 100644 --- a/engines/titanic/carry/hose.h +++ b/engines/titanic/carry/hose.h @@ -38,15 +38,11 @@ protected: CString _string6; public: + CLASSDEF CHose(); static void init(); static void deinit(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CHose"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/hose_end.h b/engines/titanic/carry/hose_end.h index efce6b8db0..d9efb594bc 100644 --- a/engines/titanic/carry/hose_end.h +++ b/engines/titanic/carry/hose_end.h @@ -29,13 +29,9 @@ namespace Titanic { class CHoseEnd : public CHose { public: + CLASSDEF CHoseEnd(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CHoseEnd"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/key.h b/engines/titanic/carry/key.h index 815bb95c2b..e6973b5c7c 100644 --- a/engines/titanic/carry/key.h +++ b/engines/titanic/carry/key.h @@ -29,13 +29,9 @@ namespace Titanic { class CKey : public CCarry { public: + CLASSDEF CKey(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CKey"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/liftbot_head.h b/engines/titanic/carry/liftbot_head.h index be4ad581b4..f2b60c1d7e 100644 --- a/engines/titanic/carry/liftbot_head.h +++ b/engines/titanic/carry/liftbot_head.h @@ -31,13 +31,9 @@ class CLiftbotHead : public CCarry { private: int _field12C; public: + CLASSDEF CLiftbotHead(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CLiftbotHead"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/long_stick.h b/engines/titanic/carry/long_stick.h index 3c8646d6a2..e2718a3d2b 100644 --- a/engines/titanic/carry/long_stick.h +++ b/engines/titanic/carry/long_stick.h @@ -29,13 +29,9 @@ namespace Titanic { class CLongStick : public CCarry { public: + CLASSDEF CLongStick(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CLongStick"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/magazine.h b/engines/titanic/carry/magazine.h index a1a7eee148..7621599038 100644 --- a/engines/titanic/carry/magazine.h +++ b/engines/titanic/carry/magazine.h @@ -32,13 +32,9 @@ private: int _field12C; int _field130; public: + CLASSDEF CMagazine(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMagazine"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/maitred_left_arm.h b/engines/titanic/carry/maitred_left_arm.h index f6cf6986ef..e46485cdac 100644 --- a/engines/titanic/carry/maitred_left_arm.h +++ b/engines/titanic/carry/maitred_left_arm.h @@ -31,13 +31,9 @@ class CMaitreDLeftArm : public CArm { private: int _field174; public: + CLASSDEF CMaitreDLeftArm() : CArm(), _field174(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMaitreDLeftArm"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/maitred_right_arm.h b/engines/titanic/carry/maitred_right_arm.h index a4a44895da..c89b7e82a3 100644 --- a/engines/titanic/carry/maitred_right_arm.h +++ b/engines/titanic/carry/maitred_right_arm.h @@ -29,10 +29,7 @@ namespace Titanic { class CMaitreDRightArm : public CArm { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMaitreDRightArm"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/carry/mouth.h b/engines/titanic/carry/mouth.h index 837a658d9e..1c446b2296 100644 --- a/engines/titanic/carry/mouth.h +++ b/engines/titanic/carry/mouth.h @@ -29,13 +29,9 @@ namespace Titanic { class CMouth : public CHeadPiece { public: + CLASSDEF CMouth(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMouth"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/napkin.h b/engines/titanic/carry/napkin.h index 549b29293e..144189be5c 100644 --- a/engines/titanic/carry/napkin.h +++ b/engines/titanic/carry/napkin.h @@ -29,13 +29,9 @@ namespace Titanic { class CNapkin : public CCarry { public: + CLASSDEF CNapkin(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CNapkin"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/nose.h b/engines/titanic/carry/nose.h index 349c0c6e9b..717b639e82 100644 --- a/engines/titanic/carry/nose.h +++ b/engines/titanic/carry/nose.h @@ -29,13 +29,9 @@ namespace Titanic { class CNose : public CHeadPiece { public: + CLASSDEF CNose(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CNose"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/note.h b/engines/titanic/carry/note.h index d3923c8402..b96e2cf855 100644 --- a/engines/titanic/carry/note.h +++ b/engines/titanic/carry/note.h @@ -32,13 +32,9 @@ private: CString _string6; int _field138; public: + CLASSDEF CNote(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CNote"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/parcel.h b/engines/titanic/carry/parcel.h index e16ea9bcf9..59f3ed9d6c 100644 --- a/engines/titanic/carry/parcel.h +++ b/engines/titanic/carry/parcel.h @@ -29,13 +29,9 @@ namespace Titanic { class CParcel : public CCarry { public: + CLASSDEF CParcel(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CParcel"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/perch.h b/engines/titanic/carry/perch.h index ce13dbe684..1ed2ccaa9f 100644 --- a/engines/titanic/carry/perch.h +++ b/engines/titanic/carry/perch.h @@ -29,10 +29,7 @@ namespace Titanic { class CPerch : public CCentralCore { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPerch"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/carry/phonograph_cylinder.h b/engines/titanic/carry/phonograph_cylinder.h index 327ba3e541..271ede54b0 100644 --- a/engines/titanic/carry/phonograph_cylinder.h +++ b/engines/titanic/carry/phonograph_cylinder.h @@ -51,13 +51,9 @@ private: int _field180; int _field184; public: + CLASSDEF CPhonographCylinder(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPhonographCylinder"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/phonograph_ear.h b/engines/titanic/carry/phonograph_ear.h index ec6cfedf5e..71ef38f926 100644 --- a/engines/titanic/carry/phonograph_ear.h +++ b/engines/titanic/carry/phonograph_ear.h @@ -31,13 +31,9 @@ class CPhonographEar : public CEar { private: int _field140; public: + CLASSDEF CPhonographEar() : CEar(), _field140(1) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPhonographEar"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/photograph.h b/engines/titanic/carry/photograph.h index 1148df1ec3..4141280a6b 100644 --- a/engines/titanic/carry/photograph.h +++ b/engines/titanic/carry/photograph.h @@ -34,13 +34,9 @@ private: int _field12C; int _field130; public: + CLASSDEF CPhotograph(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPhotograph"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/plug_in.h b/engines/titanic/carry/plug_in.h index aefb3d113a..89a483278d 100644 --- a/engines/titanic/carry/plug_in.h +++ b/engines/titanic/carry/plug_in.h @@ -31,13 +31,9 @@ class CPlugIn : public CCarry { private: int _field12C; public: + CLASSDEF CPlugIn(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPlugIn"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/speech_centre.h b/engines/titanic/carry/speech_centre.h index 4b5ced53a0..8f6fdfdcd0 100644 --- a/engines/titanic/carry/speech_centre.h +++ b/engines/titanic/carry/speech_centre.h @@ -33,14 +33,10 @@ private: CString _string1; int _field14C; public: + CLASSDEF CSpeechCentre() : CBrain(), _string1("Summer"), _field13C(1), _field14C(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSpeechCentre"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/sweets.h b/engines/titanic/carry/sweets.h index 1912e89789..a18a1fbeeb 100644 --- a/engines/titanic/carry/sweets.h +++ b/engines/titanic/carry/sweets.h @@ -29,13 +29,9 @@ namespace Titanic { class CSweets : public CCarry { public: + CLASSDEF CSweets(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSweets"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/test_carry.h b/engines/titanic/carry/test_carry.h index b542fb7aac..56526b424e 100644 --- a/engines/titanic/carry/test_carry.h +++ b/engines/titanic/carry/test_carry.h @@ -31,13 +31,9 @@ class CTestArray : public CGameObject { public: int _value1, _value2; public: + CLASSDEF CTestArray() : CGameObject(), _value1(0), _value2(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CTestArray"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/carry/vision_centre.h b/engines/titanic/carry/vision_centre.h index ce21fe547c..ce1d9599a2 100644 --- a/engines/titanic/carry/vision_centre.h +++ b/engines/titanic/carry/vision_centre.h @@ -29,10 +29,7 @@ namespace Titanic { class CVisionCentre : public CBrain { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CVisionCentre"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/core/background.h b/engines/titanic/core/background.h index a4735250ae..4ce5651fc4 100644 --- a/engines/titanic/core/background.h +++ b/engines/titanic/core/background.h @@ -35,13 +35,9 @@ protected: CString _string2; int _fieldDC; public: + CLASSDEF CBackground(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBackground"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/core/click_responder.h b/engines/titanic/core/click_responder.h index 1f2fa72f18..68d3e34cdd 100644 --- a/engines/titanic/core/click_responder.h +++ b/engines/titanic/core/click_responder.h @@ -31,10 +31,7 @@ class CClickResponder : public CGameObject { protected: CString _string1, _string2; public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CClickResponder"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/core/dont_save_file_item.h b/engines/titanic/core/dont_save_file_item.h index f2b321c4fc..d4d5da2e4b 100644 --- a/engines/titanic/core/dont_save_file_item.h +++ b/engines/titanic/core/dont_save_file_item.h @@ -29,10 +29,7 @@ namespace Titanic { class CDontSaveFileItem : public CFileItem { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CDontSaveFileItem"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/core/drop_target.h b/engines/titanic/core/drop_target.h index b106623f62..22cb057bb7 100644 --- a/engines/titanic/core/drop_target.h +++ b/engines/titanic/core/drop_target.h @@ -44,13 +44,9 @@ private: int _field110; int _field114; public: + CLASSDEF CDropTarget(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CDropTarget"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/core/file_item.h b/engines/titanic/core/file_item.h index 0795b05d11..65dbf9d526 100644 --- a/engines/titanic/core/file_item.h +++ b/engines/titanic/core/file_item.h @@ -33,10 +33,7 @@ class CFileItem: public CTreeItem { private: CString _filename; public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CFileItem"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 7d15882884..0d9f9184b2 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -59,13 +59,9 @@ protected: CString _string; int _fieldB8; public: + CLASSDEF CGameObject(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CGameObject"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/core/link_item.h b/engines/titanic/core/link_item.h index aeb827e69d..f46f8d3ba0 100644 --- a/engines/titanic/core/link_item.h +++ b/engines/titanic/core/link_item.h @@ -48,13 +48,9 @@ protected: int _field34; CLinkItemSub _sub; public: + CLASSDEF CLinkItem(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CLinkItem"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/core/list.h b/engines/titanic/core/list.h index 0ede36e9cc..a37bca3db2 100644 --- a/engines/titanic/core/list.h +++ b/engines/titanic/core/list.h @@ -35,10 +35,7 @@ namespace Titanic { */ class ListItem: public CSaveableObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "ListItem"; } + CLASSDEF /** * Save the data for the class to file @@ -54,10 +51,7 @@ public: template class List : public CSaveableObject, public Common::List { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return nullptr; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/core/message_target.h b/engines/titanic/core/message_target.h index 1afc48bd9b..b099546852 100644 --- a/engines/titanic/core/message_target.h +++ b/engines/titanic/core/message_target.h @@ -29,10 +29,7 @@ namespace Titanic { class CMessageTarget: public CSaveableObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMessageTarget"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/core/movie_clip.h b/engines/titanic/core/movie_clip.h index f16e3eb820..3db24debb6 100644 --- a/engines/titanic/core/movie_clip.h +++ b/engines/titanic/core/movie_clip.h @@ -43,13 +43,9 @@ private: CString _string2; CString _string3; public: + CLASSDEF CMovieClip(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMovieClip"; } - /** * Save the data for the class to file */ @@ -66,7 +62,7 @@ public: */ class CMovieClipList: public List { public: - virtual const char *getClassName() const { return "CMovieClipList"; } + CLASSDEF }; } // End of namespace Titanic diff --git a/engines/titanic/core/multi_drop_target.h b/engines/titanic/core/multi_drop_target.h index db6f605062..ddf20e441e 100644 --- a/engines/titanic/core/multi_drop_target.h +++ b/engines/titanic/core/multi_drop_target.h @@ -32,13 +32,9 @@ public: CString _string5; CString _string6; public: + CLASSDEF CMultiDropTarget() : CDropTarget(), _string5("1,2") {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMultiDropTarget"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/core/named_item.h b/engines/titanic/core/named_item.h index 75635fcf72..c86aae2529 100644 --- a/engines/titanic/core/named_item.h +++ b/engines/titanic/core/named_item.h @@ -31,10 +31,7 @@ class CNamedItem: public CTreeItem { public: CString _name; public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CNamedItem"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/core/node_item.h b/engines/titanic/core/node_item.h index e05c2eb6ff..45309a1891 100644 --- a/engines/titanic/core/node_item.h +++ b/engines/titanic/core/node_item.h @@ -33,13 +33,9 @@ private: int _field28; int _field2C; public: + CLASSDEF CNodeItem(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CNodeItem"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/core/project_item.h b/engines/titanic/core/project_item.h index 3c334986a8..f454392383 100644 --- a/engines/titanic/core/project_item.h +++ b/engines/titanic/core/project_item.h @@ -39,8 +39,8 @@ class CPetControl; class CFileListItem : public ListItem { public: CString _name; - - virtual const char *getClassName() const { return "CFileListItem"; } +public: + CLASSDEF /** * Save the data for the class to file @@ -59,7 +59,7 @@ public: */ class CFileList: public List { public: - virtual const char *getClassName() const { return "CFileList"; } + CLASSDEF }; @@ -92,13 +92,9 @@ private: */ void gameLoaded(); public: + CLASSDEF CProjectItem(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CProjectItem"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/core/resource_key.h b/engines/titanic/core/resource_key.h index 1b3d900abc..b38448aa4f 100644 --- a/engines/titanic/core/resource_key.h +++ b/engines/titanic/core/resource_key.h @@ -33,10 +33,7 @@ private: CString _key; CString _value; public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CResourceKey"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 8a1d3c982e..1b56d1b85f 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -93,6 +93,7 @@ #include "titanic/game/bottom_of_well_monitor.h" #include "titanic/game/bowl_unlocker.h" #include "titanic/game/brain_slot.h" +#include "titanic/game/bridge_door.h" #include "titanic/game/bridge_view.h" #include "titanic/game/broken_pell_base.h" #include "titanic/game/broken_pellerator.h" @@ -104,6 +105,8 @@ #include "titanic/game/cdrom_computer.h" #include "titanic/game/cdrom_tray.h" #include "titanic/game/cell_point_button.h" +#include "titanic/game/chev_code.h" +#include "titanic/game/chev_panel.h" #include "titanic/game/chicken_cooler.h" #include "titanic/game/chicken_dispensor.h" #include "titanic/game/close_broken_pel.h" @@ -142,7 +145,9 @@ #include "titanic/game/head_slot.h" #include "titanic/game/head_smash_event.h" #include "titanic/game/head_smash_lever.h" +#include "titanic/game/head_spinner.h" #include "titanic/game/idle_summoner.h" +#include "titanic/game/leave_sec_class_state.h" #include "titanic/game/lemon_dispensor.h" #include "titanic/game/light.h" #include "titanic/game/light_switch.h" @@ -151,6 +156,7 @@ #include "titanic/game/mail_man.h" #include "titanic/game/missiveomat.h" #include "titanic/game/missiveomat_button.h" +#include "titanic/game/movie_tester.h" #include "titanic/game/musical_instrument.h" #include "titanic/game/music_console_button.h" #include "titanic/game/music_room_phonograph.h" @@ -184,10 +190,12 @@ #include "titanic/game/ship_setting_button.h" #include "titanic/game/show_cell_points.h" #include "titanic/game/speech_dispensor.h" +#include "titanic/game/splash_animation.h" #include "titanic/game/starling_puret.h" #include "titanic/game/start_action.h" #include "titanic/game/stop_phonograph_button.h" #include "titanic/game/sub_glass.h" +#include "titanic/game/sub_wrapper.h" #include "titanic/game/sweet_bowl.h" #include "titanic/game/television.h" #include "titanic/game/third_class_canal.h" @@ -369,6 +377,7 @@ #include "titanic/npcs/succubus.h" #include "titanic/npcs/summon_bots.h" #include "titanic/npcs/titania.h" +#include "titanic/npcs/true_talk_npc.h" #include "titanic/pet_control/pet_control.h" @@ -378,6 +387,7 @@ #include "titanic/sound/auto_sound_player_adsr.h" #include "titanic/sound/background_sound_maker.h" #include "titanic/sound/bird_song.h" +#include "titanic/sound/dome_from_top_of_well.h" #include "titanic/sound/gondolier_song.h" #include "titanic/sound/enter_view_toggles_other_music.h" #include "titanic/sound/music_player.h" @@ -398,9 +408,12 @@ namespace Titanic { Common::HashMap * CSaveableObject::_classList = nullptr; +Common::List *CSaveableObject::_classDefs; -#define DEFFN(T) CSaveableObject *Function##T() { return new T(); } -#define ADDFN(T) (*_classList)[#T] = Function##T +#define DEFFN(T) ClassDef *T::_type; \ + CSaveableObject *Function##T() { return new T(); } +#define ADDFN(CHILD, PARENT) (*_classList)[#CHILD] = Function##CHILD; \ + ##CHILD::_type = new TypeTemplate(#CHILD, nullptr) DEFFN(CArm) DEFFN(CAuditoryCentre) @@ -411,7 +424,6 @@ DEFFN(CCarry) DEFFN(CCarryParrot) DEFFN(CCentralCore) DEFFN(CChicken) -DEFFN(CChickenCooler) DEFFN(CCrushedTV) DEFFN(CEar) DEFFN(CEye) @@ -448,13 +460,17 @@ DEFFN(CDontSaveFileItem) DEFFN(CDropTarget) DEFFN(CFileItem) DEFFN(CFileListItem) +DEFFN(CGameObject) DEFFN(CLinkItem) +DEFFN(ListItem) DEFFN(CMessageTarget) DEFFN(CMovieClip) DEFFN(CMovieClipList) DEFFN(CMultiDropTarget) +DEFFN(CNamedItem) DEFFN(CNodeItem) DEFFN(CProjectItem) +DEFFN(CSaveableObject) DEFFN(CStaticImage) DEFFN(CTurnOnObject) DEFFN(CTurnOnPlaySound) @@ -476,6 +492,7 @@ DEFFN(CBomb) DEFFN(CBottomOfWellMonitor) DEFFN(CBowlUnlocker) DEFFN(CBrainSlot) +DEFFN(CBridgeDoor) DEFFN(CBridgeView) DEFFN(CBrokenPellBase) DEFFN(CBrokenPellerator) @@ -487,12 +504,15 @@ DEFFN(CCDROM) DEFFN(CCDROMComputer) DEFFN(CCDROMTray) DEFFN(CCellPointButton) +DEFFN(CChevCode) +DEFFN(CChevPanel) +DEFFN(CChickenCooler) DEFFN(CChickenDispensor) DEFFN(CCloseBrokenPel) DEFFN(CodeWheel) DEFFN(CComputer) -DEFFN(CCookie) DEFFN(CComputerScreen) +DEFFN(CCookie) DEFFN(CCredits) DEFFN(CCreditsButton) DEFFN(CDeadArea) @@ -524,7 +544,9 @@ DEFFN(CHammerDispensorButton) DEFFN(CHeadSlot) DEFFN(CHeadSmashEvent) DEFFN(CHeadSmashLever) +DEFFN(CHeadSpinner) DEFFN(CIdleSummoner) +DEFFN(CLeaveSecClassState) DEFFN(CLemonDispensor) DEFFN(CLight) DEFFN(CLightSwitch) @@ -533,6 +555,7 @@ DEFFN(CLongStickDispenser) DEFFN(CMailMan) DEFFN(CMissiveOMat) DEFFN(CMissiveOMatButton) +DEFFN(CMovieTester); DEFFN(CMusicalInstrument) DEFFN(CMusicConsoleButton) DEFFN(CMusicRoomPhonograph) @@ -566,10 +589,12 @@ DEFFN(CShipSetting) DEFFN(CShipSettingButton) DEFFN(CShowCellpoints) DEFFN(CSpeechDispensor) +DEFFN(CSplashAnimation) DEFFN(CStarlingPuret) DEFFN(CStartAction) DEFFN(CStopPhonographButton) DEFFN(CSUBGlass) +DEFFN(CSUBWrapper) DEFFN(CSweetBowl) DEFFN(CTelevision) DEFFN(CThirdClassCanal) @@ -914,22 +939,26 @@ DEFFN(CTripDownCanal) DEFFN(CBarbot) DEFFN(CBellBot) DEFFN(CCallBot) +DEFFN(CCharacter) DEFFN(CDeskbot) DEFFN(CDoorbot) DEFFN(CLiftBot) DEFFN(CMaitreD) DEFFN(CMobile) DEFFN(CParrot) +DEFFN(CRobotController) DEFFN(CStarlings) DEFFN(CSummonBots) DEFFN(CSuccUBus) DEFFN(CTitania) +DEFFN(CTrueTalkNPC) DEFFN(CAutoMusicPlayer) DEFFN(CAutoMusicPlayerBase) DEFFN(CAutoSoundPlayer) DEFFN(CAutoSoundPlayerADSR) DEFFN(CBackgroundSoundMaker) DEFFN(CBirdSong) +DEFFN(CDomeFromTopOfWell) DEFFN(CEnterViewTogglesOtherMusic) DEFFN(CGondolierSong) DEFFN(CMusicPlayer) @@ -946,556 +975,579 @@ DEFFN(CWaterLappingSounds) DEFFN(CStarControl); void CSaveableObject::initClassList() { + _classDefs = new Common::List(); _classList = new Common::HashMap(); - ADDFN(CArm); - ADDFN(CAuditoryCentre); - ADDFN(CBowlEar); - ADDFN(CBrain); - ADDFN(CBridgePiece); - ADDFN(CCarry); - ADDFN(CCarryParrot); - ADDFN(CCentralCore); - ADDFN(CChicken); - ADDFN(CChickenCooler); - ADDFN(CCrushedTV); - ADDFN(CEar); - ADDFN(CEye); - ADDFN(CFeathers); - ADDFN(CFruit); - ADDFN(CGlass); - ADDFN(CHammer); - ADDFN(CHeadPiece); - ADDFN(CHose); - ADDFN(CHoseEnd); - ADDFN(CKey); - ADDFN(CLiftbotHead); - ADDFN(CLongStick); - ADDFN(CMagazine); - ADDFN(CMaitreDLeftArm); - ADDFN(CMaitreDRightArm); - ADDFN(CMouth); - ADDFN(CNapkin); - ADDFN(CNose); - ADDFN(CNote); - ADDFN(CParcel); - ADDFN(CPerch); - ADDFN(CPhonographCylinder); - ADDFN(CPhonographEar); - ADDFN(CPhotograph); - ADDFN(CPlugIn); - ADDFN(CSpeechCentre); - ADDFN(CSweets); - ADDFN(CVisionCentre); - - ADDFN(CBackground); - ADDFN(CClickResponder); - ADDFN(CDontSaveFileItem); - ADDFN(CDropTarget); - ADDFN(CFileItem); - ADDFN(CFileListItem); - ADDFN(CLinkItem); - ADDFN(CMessageTarget); - ADDFN(CMovieClip); - ADDFN(CMovieClipList); - ADDFN(CMultiDropTarget); - ADDFN(CNodeItem); - ADDFN(CProjectItem); - ADDFN(CStaticImage); - ADDFN(CTurnOnObject); - ADDFN(CTreeItem); - ADDFN(CTurnOnPlaySound); - ADDFN(CTurnOnTurnOff); - ADDFN(CViewItem); + ADDFN(CArm, CCarry); + ADDFN(CAuditoryCentre, CBrain); + ADDFN(CBowlEar, CEar); + ADDFN(CBrain, CCarry); + ADDFN(CBridgePiece, CCarry); + ADDFN(CCarry, CGameObject); + ADDFN(CCarryParrot, CCarry); + ADDFN(CCentralCore, CBrain); + ADDFN(CChicken, CCarry); + ADDFN(CCrushedTV, CCarry); + ADDFN(CEar, CHeadPiece); + ADDFN(CEye, CHeadPiece); + ADDFN(CFeathers, CCarry); + ADDFN(CFruit, CCarry); + ADDFN(CGlass, CCarry); + ADDFN(CHammer, CCarry); + ADDFN(CHeadPiece, CCarry); + ADDFN(CHose, CCarry); + ADDFN(CHoseEnd, CHose); + ADDFN(CKey, CCarry); + ADDFN(CLiftbotHead, CCarry); + ADDFN(CLongStick, CCarry); + ADDFN(CMagazine, CCarry); + ADDFN(CMaitreDLeftArm, CArm); + ADDFN(CMaitreDRightArm, CArm); + ADDFN(CMouth, CHeadPiece); + ADDFN(CNapkin, CCarry); + ADDFN(CNose, CHeadPiece); + ADDFN(CNote, CCarry); + ADDFN(CParcel, CCarry); + ADDFN(CPerch, CCentralCore); + ADDFN(CPhonographCylinder, CCarry); + ADDFN(CPhonographEar, CEar); + ADDFN(CPhotograph, CCarry); + ADDFN(CPlugIn, CCarry); + ADDFN(CSpeechCentre, CBrain); + ADDFN(CSweets, CCarry); + ADDFN(CVisionCentre, CBrain); - ADDFN(CAnnounce); - ADDFN(CAnnoyBarbot); - ADDFN(CArbBackground); - ADDFN(CArboretumGate); - ADDFN(CAutoAnimate); - ADDFN(CBarBell); - ADDFN(CBarMenu); - ADDFN(CBarMenuButton); - ADDFN(CBelbotGetLight); - ADDFN(CBilgeSuccUBus); - ADDFN(CBomb); - ADDFN(CBottomOfWellMonitor); - ADDFN(CBrainSlot); - ADDFN(CBowlUnlocker); - ADDFN(CBridgeView); - ADDFN(CBrokenPellBase); - ADDFN(CBrokenPellerator); - ADDFN(CBrokenPelleratorFroz); - ADDFN(CCage); - ADDFN(CCallPellerator); - ADDFN(CCaptainsWheel); - ADDFN(CCDROM); - ADDFN(CCDROMComputer); - ADDFN(CCDROMTray); - ADDFN(CCellPointButton); - ADDFN(CChickenDispensor); - ADDFN(CodeWheel); - ADDFN(CComputerScreen); - ADDFN(CCloseBrokenPel); - ADDFN(CComputer); - ADDFN(CCookie); - ADDFN(CCredits); - ADDFN(CCreditsButton); - ADDFN(CDeadArea); - ADDFN(CDeskClickResponder); - ADDFN(CDoorbotElevatorHandler); - ADDFN(CDoorbotHomeHandler); - ADDFN(CDropTarget); - ADDFN(CEarSweetBowl); - ADDFN(CEjectPhonographButton); - ADDFN(CElevatorActionArea); - ADDFN(CEmmaControl); - ADDFN(CEmptyNutBowl); - ADDFN(CEndCreditText); - ADDFN(CEndCredits); - ADDFN(CEndExplodeShip); - ADDFN(CEndGameCredits); - ADDFN(CEndSequenceControl); - ADDFN(CFan); - ADDFN(CFanControl); - ADDFN(CFanDecrease); - ADDFN(CFanIncrease); - ADDFN(CFanNoises); - ADDFN(CFloorIndicator); - ADDFN(CGamesConsole); - ADDFN(CGetLiftEye2); - ADDFN(CGlassSmasher); - ADDFN(CHammerClip); - ADDFN(CHammerDispensor); - ADDFN(CHammerDispensorButton); - ADDFN(CHeadSlot); - ADDFN(CHeadSmashEvent); - ADDFN(CHeadSmashLever); - ADDFN(CIdleSummoner); - ADDFN(CLemonDispensor); - ADDFN(CLight); - ADDFN(CLightSwitch); - ADDFN(CLittleLiftButton); - ADDFN(CLongStickDispenser); - ADDFN(CMailMan); - ADDFN(CMissiveOMat); - ADDFN(CMissiveOMatButton); - ADDFN(CMusicalInstrument); - ADDFN(CMusicConsoleButton); - ADDFN(CMusicRoomPhonograph); - ADDFN(CMusicRoomStopPhonographButton); - ADDFN(CMusicSystemLock); - ADDFN(CNavHelmet); - ADDFN(CNavigationComputer); - ADDFN(CNoNutBowl); - ADDFN(CNoseHolder); - ADDFN(CNullPortHole); - ADDFN(CNutReplacer); - ADDFN(CPetDisabler); - ADDFN(CPhonograph); - ADDFN(CPhonographLid); - ADDFN(CPlayMusicButton); - ADDFN(CPlayOnAct); - ADDFN(CPortHole); - ADDFN(CRecordPhonographButton); - ADDFN(CReplacementEar); - ADDFN(CReservedTable); - ADDFN(CRestaurantCylinderHolder); - ADDFN(CRestaurantPhonograph); - ADDFN(CRoomItem); - ADDFN(CSauceDispensor); - ADDFN(CSearchPoint); - ADDFN(CSeasonBackground); - ADDFN(CSeasonBarrel); - ADDFN(CSeasonalAdjustment); - ADDFN(CServiceElevatorWindow); - ADDFN(CShipSetting); - ADDFN(CShipSettingButton); - ADDFN(CShowCellpoints); - ADDFN(CSpeechDispensor); - ADDFN(CStarlingPuret); - ADDFN(CStartAction); - ADDFN(CStopPhonographButton); - ADDFN(CSUBGlass); - ADDFN(CSweetBowl); - ADDFN(CTelevision); - ADDFN(CThirdClassCanal); - ADDFN(CThrowTVDownWell); - ADDFN(CTitaniaStillControl); - ADDFN(CTOWParrotNav); - ADDFN(CUpLighter); - ADDFN(CUselessLever); - ADDFN(CWheelButton); - ADDFN(CWheelHotSpot); - ADDFN(CWheelSpin); - ADDFN(CWheelSpinHorn); - ADDFN(CGondolierBase); - ADDFN(CGondolierChest); - ADDFN(CGondolierFace); - ADDFN(CGondolierMixer); - ADDFN(CGondolierSlider); - ADDFN(CMaitreDArmHolder); - ADDFN(CMaitreDBody); - ADDFN(CMaitreDLegs); - ADDFN(CMaitreDProdReceptor); - ADDFN(CParrotLobbyController); - ADDFN(CParrotLobbyLinkUpdater); - ADDFN(CParrotLobbyObject); - ADDFN(CParrotLobbyViewObject); - ADDFN(CParrotLoser); - ADDFN(CParrotNutBowlActor); - ADDFN(CParrotNutEater); - ADDFN(CParrotPerchHolder); - ADDFN(CParrotSuccUBus); - ADDFN(CParrotTrigger); - ADDFN(CPlayerMeetsParrot); - ADDFN(CPET); - ADDFN(CPETClass1); - ADDFN(CPETClass2); - ADDFN(CPETClass3); - ADDFN(CPetControl); - ADDFN(CPetDragChev); - ADDFN(CPetGraphic); - ADDFN(CPetGraphic2); - ADDFN(PETLeaf); - ADDFN(CPETLift); - ADDFN(CPETMonitor); - ADDFN(CPETPellerator); - ADDFN(CPETPosition); - ADDFN(CPETSentinal); - ADDFN(CPETSounds); - ADDFN(CPETTransition); - ADDFN(CPETTransport); - ADDFN(CPickUp); - ADDFN(CPickUpBarGlass); - ADDFN(CPickUpHose); - ADDFN(CPickUpLemon); - ADDFN(CPickUpSpeechCentre); - ADDFN(CPickUpVisCentre); - ADDFN(CBarShelfVisCentre); - ADDFN(CLemonOnBar); - ADDFN(CPlaceHolder); - ADDFN(CTVOnBar); - ADDFN(CArmchair); - ADDFN(CBasin); - ADDFN(CBedfoot); - ADDFN(CBedhead); - ADDFN(CChestOfDrawers); - ADDFN(CDesk); - ADDFN(CDeskchair); - ADDFN(CDrawer); - ADDFN(CSGTDoors); - ADDFN(SGTNav); - ADDFN(CSGTNavigation); - ADDFN(CSGTRestaurantDoors); - ADDFN(CSGTStateControl); - ADDFN(CSGTStateRoom); - ADDFN(CSGTTV); - ADDFN(CSGTUpperDoorsSound); - ADDFN(CToilet); - ADDFN(CVase); - ADDFN(CWashstand); + ADDFN(CBackground, CGameObject); + ADDFN(CClickResponder, CGameObject); + ADDFN(CDontSaveFileItem, CFileItem); + ADDFN(CDropTarget, CGameObject); + ADDFN(CFileItem, CTreeItem); + ADDFN(CFileListItem, ListItem); + ADDFN(CGameObject, CNamedItem); + ADDFN(CLinkItem, CNamedItem); + ADDFN(ListItem, CSaveableObject); + ADDFN(CMessageTarget, CSaveableObject); + ADDFN(CMovieClip, ListItem); + ADDFN(CMovieClipList, List); + ADDFN(CMultiDropTarget, CDropTarget); + ADDFN(CNamedItem, CTreeItem); + ADDFN(CNodeItem, CNamedItem); + ADDFN(CProjectItem, CFileItem); + ADDFN(CSaveableObject, CSaveableObject); + ADDFN(CStaticImage, CGameObject); + ADDFN(CTurnOnObject, CBackground); + ADDFN(CTreeItem, CMessageTarget); + ADDFN(CTurnOnPlaySound, CTurnOnObject); + ADDFN(CTurnOnTurnOff, CBackground); + ADDFN(CViewItem, CNamedItem); - ADDFN(CGondolier); - ADDFN(CLift); - ADDFN(CLiftindicator); - ADDFN(CPellerator); - ADDFN(CServiceElevator); - ADDFN(CTransport); + ADDFN(CAnnounce, CGameObject); + ADDFN(CAnnoyBarbot, CGameObject); + ADDFN(CArbBackground, CBackground); + ADDFN(CArboretumGate, CBackground); + ADDFN(CAutoAnimate, CBackground); + ADDFN(CBarBell, CGameObject); + ADDFN(CBarMenu, CGameObject); + ADDFN(CBarMenuButton, CGameObject); + ADDFN(CBelbotGetLight, CGameObject); + ADDFN(CBilgeSuccUBus, CSuccUBus); + ADDFN(CBomb, CBackground); + ADDFN(CBottomOfWellMonitor, CGameObject); + ADDFN(CBowlUnlocker, CGameObject); + ADDFN(CBrainSlot, CGameObject); + ADDFN(CBridgeDoor, CGameObject); + ADDFN(CBridgeView, CBackground); + ADDFN(CBrokenPellBase, CBackground); + ADDFN(CBrokenPellerator, CBrokenPellBase); + ADDFN(CBrokenPelleratorFroz, CBrokenPellBase); + ADDFN(CCage, CBackground); + ADDFN(CCallPellerator, CGameObject); + ADDFN(CCaptainsWheel, CBackground); + ADDFN(CCDROM, CGameObject); + ADDFN(CCDROMComputer, CGameObject); + ADDFN(CCDROMTray, CGameObject); + ADDFN(CCellPointButton, CBackground); + ADDFN(CChevCode, CGameObject); + ADDFN(CChevPanel, CGameObject); + ADDFN(CChickenCooler, CGameObject); + ADDFN(CChickenDispensor, CBackground); + ADDFN(CodeWheel, CBomb); + ADDFN(CCloseBrokenPel, CBackground); + ADDFN(CComputer, CBackground); + ADDFN(CComputerScreen, CGameObject); + ADDFN(CCookie, CGameObject); + ADDFN(CCredits, CGameObject); + ADDFN(CCreditsButton, CBackground); + ADDFN(CDeadArea, CGameObject); + ADDFN(CDeskClickResponder, CClickResponder); + ADDFN(CDoorbotElevatorHandler, CGameObject); + ADDFN(CDoorbotHomeHandler, CGameObject); + ADDFN(CDropTarget, CGameObject); + ADDFN(CEarSweetBowl, CSweetBowl); + ADDFN(CEjectPhonographButton, CBackground); + ADDFN(CElevatorActionArea, CGameObject); + ADDFN(CEmmaControl, CBackground); + ADDFN(CEmptyNutBowl, CGameObject); + ADDFN(CEndCreditText, CGameObject); + ADDFN(CEndCredits, CGameObject); + ADDFN(CEndExplodeShip, CGameObject); + ADDFN(CEndGameCredits, CGameObject); + ADDFN(CEndSequenceControl, CGameObject); + ADDFN(CFan, CGameObject); + ADDFN(CFanControl, CGameObject); + ADDFN(CFanDecrease, CGameObject); + ADDFN(CFanIncrease, CGameObject); + ADDFN(CFanNoises, CGameObject); + ADDFN(CFloorIndicator, CGameObject); + ADDFN(CGamesConsole, CBackground); + ADDFN(CGetLiftEye2, CGameObject); + ADDFN(CGlassSmasher, CGameObject); + ADDFN(CHammerClip, CGameObject); + ADDFN(CHammerDispensor, CBackground); + ADDFN(CHammerDispensorButton, CStartAction); + ADDFN(CHeadSlot, CGameObject); + ADDFN(CHeadSmashEvent, CBackground); + ADDFN(CHeadSmashLever, CBackground); + ADDFN(CHeadSpinner, CGameObject); + ADDFN(CIdleSummoner, CGameObject); + ADDFN(CLeaveSecClassState, CGameObject); + ADDFN(CLemonDispensor, CBackground); + ADDFN(CLight, CBackground); + ADDFN(CLightSwitch, CBackground); + ADDFN(CLittleLiftButton, CBackground); + ADDFN(CLongStickDispenser, CGameObject); + ADDFN(CMailMan, CGameObject); + ADDFN(CMissiveOMat, CGameObject); + ADDFN(CMissiveOMatButton, CEditControl); + ADDFN(CMovieTester, CGameObject); + ADDFN(CMusicalInstrument, CBackground); + ADDFN(CMusicConsoleButton, CMusicPlayer); + ADDFN(CMusicRoomPhonograph, CRestaurantPhonograph); + ADDFN(CMusicRoomStopPhonographButton, CEjectPhonographButton); + ADDFN(CMusicSystemLock, CDropTarget); + ADDFN(CNavHelmet, CGameObject); + ADDFN(CNavigationComputer, CGameObject); + ADDFN(CNoNutBowl, CBackground); + ADDFN(CNoseHolder, CDropTarget); + ADDFN(CNullPortHole, CClickResponder); + ADDFN(CNutReplacer, CGameObject); + ADDFN(CPetDisabler, CGameObject); + ADDFN(CPhonograph, CMusicPlayer); + ADDFN(CPhonographLid, CGameObject); + ADDFN(CPlayMusicButton, CBackground); + ADDFN(CPlayOnAct, CBackground); + ADDFN(CPortHole, CGameObject); + ADDFN(CRecordPhonographButton, CBackground); + ADDFN(CReplacementEar, CBackground); + ADDFN(CReservedTable, CGameObject); + ADDFN(CRestaurantCylinderHolder, CDropTarget); + ADDFN(CRestaurantPhonograph, CPhonograph); + ADDFN(CRoomItem, CNamedItem); + ADDFN(CSauceDispensor, CBackground); + ADDFN(CSearchPoint, CGameObject); + ADDFN(CSeasonBackground, CBackground); + ADDFN(CSeasonBarrel, CBackground); + ADDFN(CSeasonalAdjustment, CBackground); + ADDFN(CServiceElevatorWindow, CBackground); + ADDFN(CShipSetting, CBackground); + ADDFN(CShipSettingButton, CGameObject); + ADDFN(CShowCellpoints, CGameObject); + ADDFN(CSpeechDispensor, CBackground); + ADDFN(CSplashAnimation, CGameObject); + ADDFN(CStarlingPuret, CGameObject); + ADDFN(CStartAction, CBackground); + ADDFN(CStopPhonographButton, CBackground); + ADDFN(CSUBGlass, CGameObject); + ADDFN(CSUBWrapper, CGameObject); + ADDFN(CSweetBowl, CGameObject); + ADDFN(CTelevision, CBackground); + ADDFN(CThirdClassCanal, CBackground); + ADDFN(CThrowTVDownWell, CGameObject); + ADDFN(CTitaniaStillControl, CGameObject); + ADDFN(CTOWParrotNav, CGameObject); + ADDFN(CUpLighter, CDropTarget); + ADDFN(CUselessLever, CToggleButton); + ADDFN(CWheelButton, CBackground); + ADDFN(CWheelHotSpot, CBackground); + ADDFN(CWheelSpin, CBackground); + ADDFN(CWheelSpinHorn, CWheelSpin); + ADDFN(CGondolierBase, CGameObject); + ADDFN(CGondolierChest, CGondolierBase); + ADDFN(CGondolierFace, CGondolierBase); + ADDFN(CGondolierMixer, CGondolierBase); + ADDFN(CGondolierSlider, CGondolierBase); + ADDFN(CMaitreDArmHolder, CDropTarget); + ADDFN(CMaitreDBody, CMaitreDProdReceptor); + ADDFN(CMaitreDLegs, CMaitreDProdReceptor); + ADDFN(CMaitreDProdReceptor, CGameObject); + ADDFN(CParrotLobbyController, CParrotLobbyObject); + ADDFN(CParrotLobbyLinkUpdater, CParrotLobbyObject); + ADDFN(CParrotLobbyObject, CGameObject); + ADDFN(CParrotLobbyViewObject, CParrotLobbyObject); + ADDFN(CParrotLoser, CGameObject); + ADDFN(CParrotNutBowlActor, CGameObject); + ADDFN(CParrotNutEater, CGameObject); + ADDFN(CParrotPerchHolder, CMultiDropTarget); + ADDFN(CParrotSuccUBus, CSuccUBus); + ADDFN(CParrotTrigger, CGameObject); + ADDFN(CPlayerMeetsParrot, CGameObject); + ADDFN(CPET, CGameObject); + ADDFN(CPETClass1, CGameObject); + ADDFN(CPETClass2, CGameObject); + ADDFN(CPETClass3, CGameObject); + ADDFN(CPETLift, CPETTransport); + ADDFN(CPETMonitor, CGameObject); + ADDFN(CPETPellerator, CPETTransport); + ADDFN(CPETPosition, CGameObject); + ADDFN(CPETSentinal, CGameObject); + ADDFN(CPETSounds, CGameObject); + ADDFN(CPETTransition, CGameObject); + ADDFN(CPETTransport, CGameObject); + ADDFN(CPickUp, CGameObject); + ADDFN(CPickUpBarGlass, CPickUp); + ADDFN(CPickUpHose, CPickUp); + ADDFN(CPickUpLemon, CPickUp); + ADDFN(CPickUpSpeechCentre, CPickUp); + ADDFN(CPickUpVisCentre, CPickUp); + ADDFN(CBarShelfVisCentre, CPlaceHolder); + ADDFN(CLemonOnBar, CPlaceHolder); + ADDFN(CPlaceHolder, CGameObject); + ADDFN(CTVOnBar, CPlaceHolder); + ADDFN(CArmchair, CSGTStateRoom); + ADDFN(CBasin, CSGTStateRoom); + ADDFN(CBedfoot, CSGTStateRoom); + ADDFN(CBedhead, CSGTStateRoom); + ADDFN(CChestOfDrawers, CSGTStateRoom); + ADDFN(CDesk, CSGTStateRoom); + ADDFN(CDeskchair, CSGTStateRoom); + ADDFN(CDrawer, CSGTStateRoom); + ADDFN(CSGTDoors, CGameObject); + ADDFN(SGTNav, CSGTStateRoom); + ADDFN(CSGTNavigation, CGameObject); + ADDFN(CSGTRestaurantDoors, CGameObject); + ADDFN(CSGTStateControl, CBackground); + ADDFN(CSGTStateRoom, CBackground); + ADDFN(CSGTTV, CSGTStateRoom); + ADDFN(CSGTUpperDoorsSound, CClickResponder); + ADDFN(CToilet, CSGTStateRoom); + ADDFN(CVase, CSGTStateRoom); + ADDFN(CWashstand, CSGTStateRoom); - ADDFN(CActButton); - ADDFN(CChangesSeasonButton); - ADDFN(CChevLeftOff); - ADDFN(CChevLeftOn); - ADDFN(CChevRightOff); - ADDFN(CChevRightOn); - ADDFN(CChevSendRecSwitch); - ADDFN(CChevSwitch); - ADDFN(CEditControl); - ADDFN(CElevatorButton); - ADDFN(CGetFromSucc); - ADDFN(CHelmetOnOff); - ADDFN(CHomePhoto); - ADDFN(CIconNavAction); - ADDFN(CIconNavButt); - ADDFN(CIconNavDown); - ADDFN(CIconNavImage); - ADDFN(CIconNavLeft); - ADDFN(CIconNavReceive); - ADDFN(CIconNavRight); - ADDFN(CIconNavSend); - ADDFN(CIconNavUp); - ADDFN(CKeybrdButt); - ADDFN(CMoveObjectButton); - ADDFN(CMusicControl); - ADDFN(CMusicSlider); - ADDFN(CMusicSliderPitch); - ADDFN(CMusicSliderSpeed); - ADDFN(CMusicSwitch); - ADDFN(CMusicSwitchInversion); - ADDFN(CMusicSwitchReverse); - ADDFN(CMusicVoiceMute); - ADDFN(CPetModeOff); - ADDFN(CPetModeOn); - ADDFN(CPetModePanel); - ADDFN(CPetPannel1); - ADDFN(CPetPannel2); - ADDFN(CPetPannel3); - ADDFN(CSendToSucc); - ADDFN(CSGTSelector); - ADDFN(CSliderButton); - ADDFN(CSmallChevLeftOff); - ADDFN(CSmallChevLeftOn); - ADDFN(CSmallChevRightOff); - ADDFN(CSmallChevRightOn); - ADDFN(CStatusChangeButton); - ADDFN(CSTButton); - ADDFN(CTextDown); - ADDFN(CTextSkrew); - ADDFN(CTextUp); - ADDFN(CToggleButton); - ADDFN(CToggleSwitch); - ADDFN(CVolumeControl); + ADDFN(CGondolier, CTransport); + ADDFN(CLift, CTransport); + ADDFN(CLiftindicator, CLift); + ADDFN(CPellerator, CTransport); + ADDFN(CServiceElevator, CTransport); + ADDFN(CTransport, CMobile); - ADDFN(CActMsg); - ADDFN(CActivationmsg); - ADDFN(CAddHeadPieceMsg); - ADDFN(CAnimateMaitreDMsg); - ADDFN(CArboretumGateMsg); - ADDFN(CArmPickedUpFromTableMsg); - ADDFN(CBodyInBilgeRoomMsg); - ADDFN(CBowlStateChange); - ADDFN(CCarryObjectArrivedMsg); - ADDFN(CChangeSeasonMsg); - ADDFN(CCheckAllPossibleCodes); - ADDFN(CCheckChevCode); - ADDFN(CChildDragEndMsg); - ADDFN(CChildDragMoveMsg); - ADDFN(CChildDragStartMsg); - ADDFN(CClearChevPanelBits); - ADDFN(CCorrectMusicPlayedMsg); - ADDFN(CCreateMusicPlayerMsg); - ADDFN(CCylinderHolderReadyMsg); - ADDFN(CDeactivationMsg); - ADDFN(CDeliverCCarryMsg); - ADDFN(CDisableMaitreDProdReceptor); - ADDFN(CDismissBotMsg); - ADDFN(CDoffNavHelmet); - ADDFN(CDonNavHelmet); - ADDFN(CDoorbotNeededInElevatorMsg); - ADDFN(CDoorbotNeededInHomeMsg); - ADDFN(CDropobjectMsg); - ADDFN(CDropZoneGotObjectMsg); - ADDFN(CDropZoneLostObjectMsg); - ADDFN(CEditControlMsg); - ADDFN(CEjectCylinderMsg); - ADDFN(CErasePhonographCylinderMsg); - ADDFN(CFreshenCookieMsg); - ADDFN(CGetChevClassBits); - ADDFN(CGetChevClassNum); - ADDFN(CGetChevCodeFromRoomNameMsg); - ADDFN(CGetChevFloorBits); - ADDFN(CGetChevFloorNum); - ADDFN(CGetChevLiftBits); - ADDFN(CGetChevLiftNum); - ADDFN(CGetChevRoomBits); - ADDFN(CGetChevRoomNum); - ADDFN(CHoseConnectedMsg); - ADDFN(CInitializeAnimMsg); - ADDFN(CIsEarBowlPuzzleDone); - ADDFN(CIsHookedOnMsg); - ADDFN(CIsParrotPresentMsg); - ADDFN(CKeyCharMsg); - ADDFN(CLemonFallsFromTreeMsg); - ADDFN(CLightsMsg); - ADDFN(CLockPhonographMsg); - ADDFN(CMaitreDDefeatedMsg); - ADDFN(CMaitreDHappyMsg); - ADDFN(CMissiveOMatActionMsg); - ADDFN(CMouseMsg); - ADDFN(CMouseMoveMsg); - ADDFN(CMouseButtonMsg); - ADDFN(CMouseButtonDownMsg); - ADDFN(CMouseButtonUpMsg); - ADDFN(CMouseButtonDoubleClickMsg); - ADDFN(CMouseDragMsg); - ADDFN(CMouseDragStartMsg); - ADDFN(CMouseDragMoveMsg); - ADDFN(CMouseDragEndMsg); - ADDFN(CMoveToStartPosMsg); - ADDFN(CMovieEndMsg); - ADDFN(CMovieFrameMsg); - ADDFN(CMusicHasStartedMsg); - ADDFN(CMusicHasStoppedMsg); - ADDFN(CMusicSettingChangedMsg); - ADDFN(CNPCPlayAnimationMsg); - ADDFN(CNPCPlayIdleAnimationMsg); - ADDFN(CNPCPlayTalkingAnimationMsg); - ADDFN(CNPCQueueIdleAnimMsg); - ADDFN(CNutPuzzleMsg); - ADDFN(COnSummonBotMsg); - ADDFN(COpeningCreditsMsg); - ADDFN(CPETDeliverMsg); - ADDFN(CPETGainedObjectMsg); - ADDFN(CPETHelmetOnOffMsg); - ADDFN(CPETKeyboardOnOffMsg); - ADDFN(CPETLostObjectMsg); - ADDFN(CPETObjectSelectedMsg); - ADDFN(CPETObjectStateMsg); - ADDFN(CPETPhotoOnOffMsg); - ADDFN(CPETPlaySoundMsg); - ADDFN(CPETReceiveMsg); - ADDFN(CPETSetStarDestinationMsg); - ADDFN(CPETStarFieldLockMsg); - ADDFN(CPETStereoFieldOnOffMsg); - ADDFN(CPETTargetMsg); - ADDFN(CPanningAwayFromParrotMsg); - ADDFN(CParrotSpeakMsg); - ADDFN(CParrotTriesChickenMsg); - ADDFN(CPassOnDragStartMsg); - ADDFN(CPhonographPlayMsg); - ADDFN(CPhonographReadyToPlayMsg); - ADDFN(CPhonographRecordMsg); - ADDFN(CPhonographStopMsg); - ADDFN(CPlayRangeMsg); - ADDFN(CPlayerTriesRestaurantTableMsg); - ADDFN(CPreSaveMsg); - ADDFN(CProdMaitreDMsg); - ADDFN(CPumpingMsg); - ADDFN(CPutBotBackInHisBoxMsg); - ADDFN(CPutParrotBackMsg); - ADDFN(CPuzzleSolvedMsg); - ADDFN(CQueryCylinderHolderMsg); - ADDFN(CQueryCylinderMsg); - ADDFN(CQueryCylinderNameMsg); - ADDFN(CQueryCylinderTypeMsg); - ADDFN(CQueryMusicControlSettingMsg); - ADDFN(CQueryPhonographState); - ADDFN(CRecordOntoCylinderMsg); - ADDFN(CRemoveFromGameMsg); - ADDFN(CReplaceBowlAndNutsMsg); - ADDFN(CRestaurantMusicChanged); - ADDFN(CSendCCarryMsg); - ADDFN(CSenseWorkingMsg); - ADDFN(CServiceElevatorDoor); - ADDFN(CServiceElevatorFloorChangeMsg); - ADDFN(CServiceElevatorFloorRequestMsg); - ADDFN(CServiceElevatorMsg); - ADDFN(CSetChevButtonImageMsg); - ADDFN(CSetChevClassBits); - ADDFN(CSetChevFloorBits); - ADDFN(CSetChevLiftBits); - ADDFN(CSetChevPanelBitMsg); - ADDFN(CSetChevPanelButtonsMsg); - ADDFN(CSetChevRoomBits); - ADDFN(CSetMusicControlsMsg); - ADDFN(CSetVarMsg); - ADDFN(CSetVolumeMsg); - ADDFN(CShipSettingMsg); - ADDFN(CShowTextMsg); - ADDFN(CSignalObject); - ADDFN(CSpeechFallsFromTreeMsg); - ADDFN(CStartMusicMsg); - ADDFN(CStatusChangeMsg); - ADDFN(CStopMusicMsg); - ADDFN(CSubAcceptCCarryMsg); - ADDFN(CSubDeliverCCarryMsg); - ADDFN(CSubSendCCarryMsg); - ADDFN(CSUBTransition); - ADDFN(CSubTurnOffMsg); - ADDFN(CSubTurnOnMsg); - ADDFN(CSummonBotMsg); - ADDFN(CSummonBotQuerryMsg); - ADDFN(CTakeHeadPieceMsg); - ADDFN(CTextInputMsg); - ADDFN(CTimeDilationMsg); - ADDFN(CTimeMsg); - ADDFN(CTitleSequenceEndedMsg); - ADDFN(CTransitMsg); - ADDFN(CTransportMsg); - ADDFN(CTriggerAutoMusicPlayerMsg); - ADDFN(CTriggerNPCEvent); - ADDFN(CTrueTalkGetAnimSetMsg); - ADDFN(CTrueTalkGetAssetDetailsMsg); - ADDFN(CTrueTalkGetStateValueMsg); - ADDFN(CTrueTalkNotifySpeechEndedMsg); - ADDFN(CTrueTalkNotifySpeechStartedMsg); - ADDFN(CTrueTalkQueueUpAnimSetMsg); - ADDFN(CTrueTalkSelfQueueAnimSetMsg); - ADDFN(CTrueTalkTriggerActionMsg); - ADDFN(CTurnOff); - ADDFN(CTurnOn); - ADDFN(CUse); - ADDFN(CUseWithCharMsg); - ADDFN(CUseWithOtherMsg); - ADDFN(CVirtualKeyCharMsg); - ADDFN(CVisibleMsg); + ADDFN(CActButton, CSTButton); + ADDFN(CChangesSeasonButton, CSTButton); + ADDFN(CChevLeftOff, CToggleSwitch); + ADDFN(CChevLeftOn, CToggleSwitch); + ADDFN(CChevRightOff, CToggleSwitch); + ADDFN(CChevRightOn, CToggleSwitch); + ADDFN(CChevSendRecSwitch, CToggleSwitch); + ADDFN(CChevSwitch, CToggleSwitch); + ADDFN(CEditControl, CGameObject); + ADDFN(CElevatorButton, CSTButton); + ADDFN(CGetFromSucc, CToggleSwitch); + ADDFN(CHelmetOnOff, CToggleSwitch); + ADDFN(CHomePhoto, CToggleSwitch); + ADDFN(CIconNavAction, CToggleSwitch); + ADDFN(CIconNavButt, CPetGraphic); + ADDFN(CIconNavDown, CToggleSwitch); + ADDFN(CIconNavImage, CPetGraphic); + ADDFN(CIconNavLeft, CToggleSwitch); + ADDFN(CIconNavReceive, CPetGraphic); + ADDFN(CIconNavRight, CToggleSwitch); + ADDFN(CIconNavSend, CPetGraphic); + ADDFN(CIconNavUp, CToggleSwitch); + ADDFN(CKeybrdButt, CToggleSwitch); + ADDFN(CMoveObjectButton, CSTButton); + ADDFN(CMusicControl, CBackground); + ADDFN(CMusicSlider, CMusicControl); + ADDFN(CMusicSliderPitch, CMusicSlider); + ADDFN(CMusicSliderSpeed, CMusicSlider); + ADDFN(CMusicSwitch, CMusicControl); + ADDFN(CMusicSwitchInversion, CMusicSwitch); + ADDFN(CMusicSwitchReverse, CMusicSwitch); + ADDFN(CMusicVoiceMute, CMusicControl); + ADDFN(CPetControl, CGameObject); + ADDFN(CPetDragChev, CPetGraphic2); + ADDFN(CPetGraphic, CGameObject); + ADDFN(CPetGraphic2, CGameObject); + ADDFN(PETLeaf, CGameObject); + ADDFN(CPetModeOff, CToggleSwitch); + ADDFN(CPetModeOn, CToggleSwitch); + ADDFN(CPetModePanel, CToggleSwitch); + ADDFN(CPetPannel1, CPetGraphic); + ADDFN(CPetPannel2, CPetGraphic); + ADDFN(CPetPannel3, CPetGraphic); + ADDFN(CSendToSucc, CToggleSwitch); + ADDFN(CSGTSelector, CPetGraphic); + ADDFN(CSliderButton, CSTButton); + ADDFN(CSmallChevLeftOff, CToggleSwitch); + ADDFN(CSmallChevLeftOn, CToggleSwitch); + ADDFN(CSmallChevRightOff, CToggleSwitch); + ADDFN(CSmallChevRightOn, CToggleSwitch); + ADDFN(CStatusChangeButton, CSTButtonClass); + ADDFN(CSTButton, CBackground); + ADDFN(CTextDown, CPetGraphic); + ADDFN(CTextSkrew, CPetGraphic); + ADDFN(CTextUp, CPetGraphic); + ADDFN(CToggleButton, CBackground); + ADDFN(CToggleSwitch, CGameObject); + ADDFN(CVolumeControl, CGameObject); + + ADDFN(CActMsg, CMessage); + ADDFN(CActivationmsg, CMessage); + ADDFN(CAddHeadPieceMsg, CMessage); + ADDFN(CAnimateMaitreDMsg, CMessage); + ADDFN(CArboretumGateMsg, CMessage); + ADDFN(CArmPickedUpFromTableMsg, CMessage); + ADDFN(CAutoSoundEvent, CGameObject); + ADDFN(CBilgeAutoSoundEvent, CAutoSoundEvent); + ADDFN(CBilgeDispensorEvent, CAutoSoundEvent); + ADDFN(CBodyInBilgeRoomMsg, CMessage); + ADDFN(CBowlStateChange, CMessage); + ADDFN(CCarryObjectArrivedMsg, CMessage); + ADDFN(CChangeSeasonMsg, CMessage); + ADDFN(CCheckAllPossibleCodes, CMessage); + ADDFN(CCheckChevCode, CMessage); + ADDFN(CChildDragEndMsg, CMessage); + ADDFN(CChildDragMoveMsg, CMessage); + ADDFN(CChildDragStartMsg, CMessage); + ADDFN(CClearChevPanelBits, CMessage); + ADDFN(CCorrectMusicPlayedMsg, CMessage); + ADDFN(CCreateMusicPlayerMsg, CMessage); + ADDFN(CCylinderHolderReadyMsg, CMessage); + ADDFN(CDeactivationMsg, CMessage); + ADDFN(CDeliverCCarryMsg, CMessage); + ADDFN(CDisableMaitreDProdReceptor, CMessage); + ADDFN(CDismissBotMsg, CMessage); + ADDFN(CDoffNavHelmet, CMessage); + ADDFN(CDonNavHelmet, CMessage); + ADDFN(CDoorAutoSoundEvent, CAutoSoundEvent); + ADDFN(CDoorbotNeededInElevatorMsg, CMessage); + ADDFN(CDoorbotNeededInHomeMsg, CMessage); + ADDFN(CDropobjectMsg, CMessage); + ADDFN(CDropZoneGotObjectMsg, CMessage); + ADDFN(CDropZoneLostObjectMsg, CMessage); + ADDFN(CEditControlMsg, CMessage); + ADDFN(CEjectCylinderMsg, CMessage); + ADDFN(CErasePhonographCylinderMsg, CMessage); + ADDFN(CFreshenCookieMsg, CMessage); + ADDFN(CGetChevClassBits, CMessage); + ADDFN(CGetChevClassNum, CMessage); + ADDFN(CGetChevCodeFromRoomNameMsg, CMessage); + ADDFN(CGetChevFloorBits, CMessage); + ADDFN(CGetChevFloorNum, CMessage); + ADDFN(CGetChevLiftBits, CMessage); + ADDFN(CGetChevLiftNum, CMessage); + ADDFN(CGetChevRoomBits, CMessage); + ADDFN(CGetChevRoomNum, CMessage); + ADDFN(CHoseConnectedMsg, CMessage); + ADDFN(CInitializeAnimMsg, CMessage); + ADDFN(CIsEarBowlPuzzleDone, CMessage); + ADDFN(CIsHookedOnMsg, CMessage); + ADDFN(CIsParrotPresentMsg, CMessage); + ADDFN(CKeyCharMsg, CMessage); + ADDFN(CLemonFallsFromTreeMsg, CMessage); + ADDFN(CLightsMsg, CMessage); + ADDFN(CLockPhonographMsg, CMessage); + ADDFN(CMaitreDDefeatedMsg, CMessage); + ADDFN(CMaitreDHappyMsg, CMessage); + ADDFN(CMissiveOMatActionMsg, CMessage); + ADDFN(CMouseMsg, CMessage); + ADDFN(CMouseMoveMsg, CMouseMsg); + ADDFN(CMouseButtonMsg, CMouseMsg); + ADDFN(CMouseButtonDownMsg, CMouseButtonMsg); + ADDFN(CMouseButtonUpMsg, CMouseButtonMsg); + ADDFN(CMouseButtonDoubleClickMsg, CMouseButtonMsg); + ADDFN(CMouseDragMsg, CMouseMsg); + ADDFN(CMouseDragStartMsg, CMouseDragMsg); + ADDFN(CMouseDragMoveMsg, CMouseDragMsg); + ADDFN(CMouseDragEndMsg, CMouseDragMsg); + ADDFN(CMoveToStartPosMsg, CMessage); + ADDFN(CMovieEndMsg, CMessage); + ADDFN(CMovieFrameMsg, CMessage); + ADDFN(CMusicHasStartedMsg, CMessage); + ADDFN(CMusicHasStoppedMsg, CMessage); + ADDFN(CMusicSettingChangedMsg, CMessage); + ADDFN(CNPCPlayAnimationMsg, CMessage); + ADDFN(CNPCPlayIdleAnimationMsg, CMessage); + ADDFN(CNPCPlayTalkingAnimationMsg, CMessage); + ADDFN(CNPCQueueIdleAnimMsg, CMessage); + ADDFN(CNutPuzzleMsg, CMessage); + ADDFN(COnSummonBotMsg, CMessage); + ADDFN(COpeningCreditsMsg, CMessage); + ADDFN(CPETDeliverMsg, CMessage); + ADDFN(CPETGainedObjectMsg, CMessage); + ADDFN(CPETHelmetOnOffMsg, CMessage); + ADDFN(CPETKeyboardOnOffMsg, CMessage); + ADDFN(CPETLostObjectMsg, CMessage); + ADDFN(CPETObjectSelectedMsg, CMessage); + ADDFN(CPETObjectStateMsg, CMessage); + ADDFN(CPETPhotoOnOffMsg, CMessage); + ADDFN(CPETPlaySoundMsg, CMessage); + ADDFN(CPETReceiveMsg, CMessage); + ADDFN(CPETSetStarDestinationMsg, CMessage); + ADDFN(CPETStarFieldLockMsg, CMessage); + ADDFN(CPETStereoFieldOnOffMsg, CMessage); + ADDFN(CPETTargetMsg, CMessage); + ADDFN(CPanningAwayFromParrotMsg, CMessage); + ADDFN(CParrotSpeakMsg, CMessage); + ADDFN(CParrotTriesChickenMsg, CMessage); + ADDFN(CPassOnDragStartMsg, CMessage); + ADDFN(CPhonographPlayMsg, CMessage); + ADDFN(CPhonographReadyToPlayMsg, CMessage); + ADDFN(CPhonographRecordMsg, CMessage); + ADDFN(CPhonographStopMsg, CMessage); + ADDFN(CPlayRangeMsg, CMessage); + ADDFN(CPlayerTriesRestaurantTableMsg, CMessage); + ADDFN(CPreSaveMsg, CMessage); + ADDFN(CProdMaitreDMsg, CMessage); + ADDFN(CPumpingMsg, CMessage); + ADDFN(CPutBotBackInHisBoxMsg, CMessage); + ADDFN(CPutParrotBackMsg, CMessage); + ADDFN(CPuzzleSolvedMsg, CMessage); + ADDFN(CQueryCylinderHolderMsg, CMessage); + ADDFN(CQueryCylinderMsg, CMessage); + ADDFN(CQueryCylinderNameMsg, CMessage); + ADDFN(CQueryCylinderTypeMsg, CMessage); + ADDFN(CQueryMusicControlSettingMsg, CMessage); + ADDFN(CQueryPhonographState, CMessage); + ADDFN(CRecordOntoCylinderMsg, CMessage); + ADDFN(CRemoveFromGameMsg, CMessage); + ADDFN(CReplaceBowlAndNutsMsg, CMessage); + ADDFN(CRestaurantMusicChanged, CMessage); + ADDFN(CSendCCarryMsg, CMessage); + ADDFN(CSenseWorkingMsg, CMessage); + ADDFN(CServiceElevatorDoor, CMessage); + ADDFN(CServiceElevatorFloorChangeMsg, CMessage); + ADDFN(CServiceElevatorFloorRequestMsg, CMessage); + ADDFN(CServiceElevatorMsg, CMessage); + ADDFN(CSetChevButtonImageMsg, CMessage); + ADDFN(CSetChevClassBits, CMessage); + ADDFN(CSetChevFloorBits, CMessage); + ADDFN(CSetChevLiftBits, CMessage); + ADDFN(CSetChevPanelBitMsg, CMessage); + ADDFN(CSetChevPanelButtonsMsg, CMessage); + ADDFN(CSetChevRoomBits, CMessage); + ADDFN(CSetMusicControlsMsg, CMessage); + ADDFN(CSetVarMsg, CMessage); + ADDFN(CSetVolumeMsg, CMessage); + ADDFN(CShipSettingMsg, CMessage); + ADDFN(CShowTextMsg, CMessage); + ADDFN(CSignalObject, CMessage); + ADDFN(CSpeechFallsFromTreeMsg, CMessage); + ADDFN(CStartMusicMsg, CMessage); + ADDFN(CStatusChangeMsg, CMessage); + ADDFN(CStopMusicMsg, CMessage); + ADDFN(CSubAcceptCCarryMsg, CMessage); + ADDFN(CSubDeliverCCarryMsg, CMessage); + ADDFN(CSubSendCCarryMsg, CMessage); + ADDFN(CSUBTransition, CMessage); + ADDFN(CSubTurnOffMsg, CMessage); + ADDFN(CSubTurnOnMsg, CMessage); + ADDFN(CSummonBotMsg, CMessage); + ADDFN(CSummonBotQuerryMsg, CMessage); + ADDFN(CTakeHeadPieceMsg, CMessage); + ADDFN(CTextInputMsg, CMessage); + ADDFN(CTimeDilationMsg, CMessage); + ADDFN(CTimeMsg, CMessage); + ADDFN(CTitleSequenceEndedMsg, CMessage); + ADDFN(CTransitMsg, CMessage); + ADDFN(CTransportMsg, CMessage); + ADDFN(CTriggerAutoMusicPlayerMsg, CMessage); + ADDFN(CTriggerNPCEvent, CMessage); + ADDFN(CTrueTalkGetAnimSetMsg, CMessage); + ADDFN(CTrueTalkGetAssetDetailsMsg, CMessage); + ADDFN(CTrueTalkGetStateValueMsg, CMessage); + ADDFN(CTrueTalkNotifySpeechEndedMsg, CMessage); + ADDFN(CTrueTalkNotifySpeechStartedMsg, CMessage); + ADDFN(CTrueTalkQueueUpAnimSetMsg, CMessage); + ADDFN(CTrueTalkSelfQueueAnimSetMsg, CMessage); + ADDFN(CTrueTalkTriggerActionMsg, CMessage); + ADDFN(CTurnOff, CMessage); + ADDFN(CTurnOn, CMessage); + ADDFN(CUse, CMessage); + ADDFN(CUseWithCharMsg, CMessage); + ADDFN(CUseWithOtherMsg, CMessage); + ADDFN(CVirtualKeyCharMsg, CMessage); + ADDFN(CVisibleMsg, CMessage); - ADDFN(CEnterBombRoom); - ADDFN(CEnterBridge); - ADDFN(CEnterExitFirstClassState); - ADDFN(CEnterExitMiniLift); - ADDFN(CEnterExitSecClassMiniLift); - ADDFN(CEnterExitView); - ADDFN(CEnterSecClassState); - ADDFN(CExitArboretum); - ADDFN(CExitBridge); - ADDFN(CExitLift); - ADDFN(CExitPellerator); - ADDFN(CExitStateRoom); - ADDFN(CExitTiania); - ADDFN(CMovePlayerInParrotRoom); - ADDFN(CMovePlayerTo); - ADDFN(CMovePlayerToFrom); - ADDFN(CMultiMove); - ADDFN(CPanFromPel); - ADDFN(CRestaurantPanHandler); - ADDFN(CScraliontisTable); - ADDFN(CRestrictedMove); - ADDFN(CTripDownCanal); + ADDFN(CEnterBombRoom, CMovePlayerTo); + ADDFN(CEnterBridge, CGameObject); + ADDFN(CEnterExitFirstClassState, CGameObject); + ADDFN(CEnterExitMiniLift, CSGTNavigation); + ADDFN(CEnterExitSecClassMiniLift, CGameObject); + ADDFN(CEnterExitView, CGameObject); + ADDFN(CEnterSecClassState, CGameObject); + ADDFN(CExitArboretum, CMovePlayerTo); + ADDFN(CExitBridge, CMovePlayerTo); + ADDFN(CExitLift, CGameObject); + ADDFN(CExitPellerator, CGameObject); + ADDFN(CExitStateRoom, CMovePlayerTo); + ADDFN(CExitTiania, CMovePlayerTo); + ADDFN(CMovePlayerInParrotRoom, CMovePlayerTo); + ADDFN(CMovePlayerTo, CGameObject); + ADDFN(CMovePlayerToFrom, CGameObject); + ADDFN(CMultiMove, CMovePlayerTo); + ADDFN(CPanFromPel, CMovePlayerTo); + ADDFN(CRestaurantPanHandler, CMovePlayerTo); + ADDFN(CScraliontisTable, CRestaurantPanHandler); + ADDFN(CRestrictedMove, CMovePlayerTo); + ADDFN(CTripDownCanal, CMovePlayerTo); - ADDFN(CBarbot); - ADDFN(CBellBot); - ADDFN(CCallBot); - ADDFN(CDeskbot); - ADDFN(CDoorbot); - ADDFN(CMaitreD); - ADDFN(CLiftBot); - ADDFN(CMobile); - ADDFN(CParrot); - ADDFN(CStarlings); - ADDFN(CSuccUBus); - ADDFN(CSummonBots); - ADDFN(CTitania); + ADDFN(CBarbot, CTrueTalkNPC); + ADDFN(CBellBot, CTrueTalkNPC); + ADDFN(CCallBot, CGameObject); + ADDFN(CCharacter, CGameObject); + ADDFN(CDeskbot, CTrueTalkNPC); + ADDFN(CDoorbot, CTrueTalkNPC); + ADDFN(CMaitreD, CTrueTalkNPC); + ADDFN(CLiftBot, CTrueTalkNPC); + ADDFN(CMobile, CCharacter); + ADDFN(CParrot, CTrueTalkNPC); + ADDFN(CRobotController, CGameObject); + ADDFN(CStarlings, CCharacter); + ADDFN(CSuccUBus, CTrueTalkNPC); + ADDFN(CSummonBots, CRobotController); + ADDFN(CTitania, CCharacter); + ADDFN(CTrueTalkNPC, CCharacter); - ADDFN(CAutoMusicPlayer); - ADDFN(CAutoSoundEvent); - ADDFN(CAutoMusicPlayerBase); - ADDFN(CAutoSoundPlayer); - ADDFN(CAutoSoundPlayerADSR); - ADDFN(CBackgroundSoundMaker); - ADDFN(CBilgeAutoSoundEvent); - ADDFN(CBilgeDispensorEvent); - ADDFN(CBirdSong); - ADDFN(CDoorAutoSoundEvent); - ADDFN(CGondolierSong); - ADDFN(CEnterViewTogglesOtherMusic); - ADDFN(CGondolierSong); - ADDFN(CMusicPlayer); - ADDFN(CNodeAutoSoundPlayer); - ADDFN(CRestrictedAutoMusicPlayer); - ADDFN(CRoomAutoSoundPlayer); - ADDFN(CSeasonNoises); - ADDFN(CSeasonalMusicPlayer); - ADDFN(CAutoMusicPlayer); - ADDFN(CTitaniaSpeech); - ADDFN(CTriggerAutoMusicPlayer); - ADDFN(CViewAutoSoundPlayer); - ADDFN(CViewTogglesOtherMusic); - ADDFN(CWaterLappingSounds); - ADDFN(CStarControl); + ADDFN(CAutoMusicPlayer, CAutoMusicPlayerBase); + ADDFN(CAutoMusicPlayerBase, CGameObject); + ADDFN(CAutoSoundPlayer, CGameObject); + ADDFN(CAutoSoundPlayerADSR, CAutoSoundPlayer); + ADDFN(CBackgroundSoundMaker, CGameObject); + ADDFN(CBirdSong, CRoomAutoSoundPlayer); + ADDFN(CDomeFromTopOfWell, CViewAutoSoundPlayer); + ADDFN(CGondolierSong, CGameObject); + ADDFN(CEnterViewTogglesOtherMusic, CTriggerAutoMusicPlayer); + ADDFN(CGondolierSong, CRoomAutoSoundPlayer); + ADDFN(CMusicPlayer, CGameObject); + ADDFN(CNodeAutoSoundPlayer, CAutoSoundPlayer); + ADDFN(CRestrictedAutoMusicPlayer, CAutoMusicPlayer); + ADDFN(CRoomAutoSoundPlayer, CAutoSoundPlayer); + ADDFN(CSeasonNoises, CViewAutoSoundPlayer); + ADDFN(CSeasonalMusicPlayer, CAutoMusicPlayerBase); + ADDFN(CAutoMusicPlayer, CAutoMusicPlayerBase); + ADDFN(CAutoMusicPlayerBase, CAutoMusicPlayer); + ADDFN(CTitaniaSpeech, CGameObject); + ADDFN(CTriggerAutoMusicPlayer, CGameObject); + ADDFN(CViewAutoSoundPlayer, CAutoSoundPlayer); + ADDFN(CViewTogglesOtherMusic, CEnterViewTogglesOtherMusic); + ADDFN(CWaterLappingSounds, CRoomAutoSoundPlayer); + ADDFN(CStarControl, CGameObject); } void CSaveableObject::freeClassList() { + Common::List::iterator i; + for (i = _classDefs->begin(); i != _classDefs->end(); ++i) + delete *i; + + delete _classDefs; delete _classList; } @@ -1512,11 +1564,17 @@ void CSaveableObject::load(SimpleFile *file) { } void CSaveableObject::saveHeader(SimpleFile *file, int indent) const { - file->writeClassStart(getClassName(), indent); + file->writeClassStart(getType()->_className, indent); } void CSaveableObject::saveFooter(SimpleFile *file, int indent) const { file->writeClassEnd(indent); } +/*------------------------------------------------------------------------*/ + +CSaveableObject *ClassDef::create() { + return new CSaveableObject(); +} + } // End of namespace Titanic diff --git a/engines/titanic/core/saveable_object.h b/engines/titanic/core/saveable_object.h index ed26163557..8368c71d3f 100644 --- a/engines/titanic/core/saveable_object.h +++ b/engines/titanic/core/saveable_object.h @@ -30,9 +30,34 @@ namespace Titanic { +class CSaveableObject; + +class ClassDef { +public: + const char *_className; + ClassDef *_parent; +public: + ClassDef(const char *className, ClassDef *parent) : + _className(className), _parent(parent) {} + virtual CSaveableObject *create(); +}; + +template +class TypeTemplate : public ClassDef { +public: + TypeTemplate(const char *className, ClassDef *parent) : + ClassDef(className, parent) {} + virtual CSaveableObject *create() { return new T(); } +}; + +#define CLASSDEF \ + static ClassDef *_type; \ + virtual ClassDef *getType() const { return _type; } + class CSaveableObject { typedef CSaveableObject *(*CreateFunction)(); private: + static Common::List *_classDefs; static Common::HashMap *_classList; public: /** @@ -50,13 +75,9 @@ public: */ static CSaveableObject *createInstance(const Common::String &name); public: + CLASSDEF virtual ~CSaveableObject() {} - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSaveableObject"; } - + /** * Save the data for the class to file */ diff --git a/engines/titanic/core/static_image.h b/engines/titanic/core/static_image.h index ac556f243e..2b0a3ad071 100644 --- a/engines/titanic/core/static_image.h +++ b/engines/titanic/core/static_image.h @@ -29,10 +29,7 @@ namespace Titanic { class CStaticImage : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CStaticImage"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index ea5de32161..78a58fa735 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -38,13 +38,9 @@ private: CTreeItem *_firstChild; int _field14; public: + CLASSDEF CTreeItem(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CTreeItem"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/core/turn_on_object.h b/engines/titanic/core/turn_on_object.h index a17d58e762..d87e205983 100644 --- a/engines/titanic/core/turn_on_object.h +++ b/engines/titanic/core/turn_on_object.h @@ -31,13 +31,9 @@ class CTurnOnObject : public CBackground { protected: CString _string3; public: + CLASSDEF CTurnOnObject(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CTurnOnObject"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/core/turn_on_play_sound.h b/engines/titanic/core/turn_on_play_sound.h index a0fc8eedfb..263709b844 100644 --- a/engines/titanic/core/turn_on_play_sound.h +++ b/engines/titanic/core/turn_on_play_sound.h @@ -33,13 +33,9 @@ private: int _fieldF8; int _fieldFC; public: + CLASSDEF CTurnOnPlaySound(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CTurnOnPlaySound"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/core/turn_on_turn_off.h b/engines/titanic/core/turn_on_turn_off.h index 41a0156391..5683a0db0e 100644 --- a/engines/titanic/core/turn_on_turn_off.h +++ b/engines/titanic/core/turn_on_turn_off.h @@ -35,13 +35,9 @@ private: int _fieldEC; int _fieldF0; public: + CLASSDEF CTurnOnTurnOff(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CTurnOnTurnOff"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/core/view_item.h b/engines/titanic/core/view_item.h index 592bb21632..a5ce575171 100644 --- a/engines/titanic/core/view_item.h +++ b/engines/titanic/core/view_item.h @@ -39,13 +39,9 @@ protected: int _field50; int _field54; public: + CLASSDEF CViewItem(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CNamedItem"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/announce.h b/engines/titanic/game/announce.h index baa5f1a55a..18702c3baf 100644 --- a/engines/titanic/game/announce.h +++ b/engines/titanic/game/announce.h @@ -34,13 +34,9 @@ private: int _fieldC4; int _fieldC8; public: + CLASSDEF CAnnounce(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CAnnounce"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/annoy_barbot.h b/engines/titanic/game/annoy_barbot.h index c1598e100d..c15b41dc85 100644 --- a/engines/titanic/game/annoy_barbot.h +++ b/engines/titanic/game/annoy_barbot.h @@ -31,10 +31,7 @@ class CAnnoyBarbot : public CGameObject { private: static int _v1; public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CAnnoyBarbot"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/arb_background.h b/engines/titanic/game/arb_background.h index e443c4b41c..50a9075750 100644 --- a/engines/titanic/game/arb_background.h +++ b/engines/titanic/game/arb_background.h @@ -34,13 +34,9 @@ public: int _fieldE8; int _fieldEC; public: + CLASSDEF CArbBackground(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CArbBackground"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/arboretum_gate.h b/engines/titanic/game/arboretum_gate.h index 8cbe49be14..eb82333f8f 100644 --- a/engines/titanic/game/arboretum_gate.h +++ b/engines/titanic/game/arboretum_gate.h @@ -64,13 +64,9 @@ public: int _field150; CString _string2; public: + CLASSDEF CArboretumGate(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CArboretumGate"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/auto_animate.h b/engines/titanic/game/auto_animate.h index 2afb85b9d5..0fd4ad768f 100644 --- a/engines/titanic/game/auto_animate.h +++ b/engines/titanic/game/auto_animate.h @@ -33,11 +33,8 @@ public: int _fieldE4; int _fieldE8; public: + CLASSDEF CAutoAnimate() : CBackground(), _fieldE0(1), _fieldE4(1), _fieldE8(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CAutoAnimate"; } /** * Save the data for the class to file diff --git a/engines/titanic/game/bar_bell.h b/engines/titanic/game/bar_bell.h index 87c244d9bf..279379feaf 100644 --- a/engines/titanic/game/bar_bell.h +++ b/engines/titanic/game/bar_bell.h @@ -35,13 +35,9 @@ public: int _fieldC8; int _fieldCC; public: + CLASSDEF CBarBell(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBarBell"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/bar_menu.h b/engines/titanic/game/bar_menu.h index 69ba0aa3e3..ac253fc747 100644 --- a/engines/titanic/game/bar_menu.h +++ b/engines/titanic/game/bar_menu.h @@ -33,13 +33,9 @@ public: int _fieldC0; int _fieldC4; public: + CLASSDEF CBarMenu(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBarMenu"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/bar_menu_button.h b/engines/titanic/game/bar_menu_button.h index 56b618dd1e..1a9d42c5d2 100644 --- a/engines/titanic/game/bar_menu_button.h +++ b/engines/titanic/game/bar_menu_button.h @@ -31,13 +31,9 @@ class CBarMenuButton : public CGameObject { public: int _value; public: + CLASSDEF CBarMenuButton() : CGameObject(), _value(1) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBarMenuButton"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/belbot_get_light.h b/engines/titanic/game/belbot_get_light.h index 2c2d547dcc..05c14f5b45 100644 --- a/engines/titanic/game/belbot_get_light.h +++ b/engines/titanic/game/belbot_get_light.h @@ -31,10 +31,7 @@ class CBelbotGetLight : public CGameObject { private: CString _value; public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBelbotGetLight"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/bilge_succubus.h b/engines/titanic/game/bilge_succubus.h index 795fe865c2..4ff72a57c7 100644 --- a/engines/titanic/game/bilge_succubus.h +++ b/engines/titanic/game/bilge_succubus.h @@ -34,13 +34,9 @@ public: int _field1E4; int _field1E8; public: + CLASSDEF CBilgeSuccUBus(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBilgeSuccUBus"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/bomb.h b/engines/titanic/game/bomb.h index a7294f422a..2e7ba4658e 100644 --- a/engines/titanic/game/bomb.h +++ b/engines/titanic/game/bomb.h @@ -40,13 +40,9 @@ public: int _field100; int _field104; public: + CLASSDEF CBomb(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBomb"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/bottom_of_well_monitor.h b/engines/titanic/game/bottom_of_well_monitor.h index f1a9f5d710..e063579056 100644 --- a/engines/titanic/game/bottom_of_well_monitor.h +++ b/engines/titanic/game/bottom_of_well_monitor.h @@ -32,13 +32,9 @@ public: static int _v1, _v2; int _value; public: + CLASSDEF CBottomOfWellMonitor() : _value(1) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBottomOfWellMonitor"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/bowl_unlocker.h b/engines/titanic/game/bowl_unlocker.h index 455b0a7fd8..7b886c406a 100644 --- a/engines/titanic/game/bowl_unlocker.h +++ b/engines/titanic/game/bowl_unlocker.h @@ -31,13 +31,9 @@ class CBowlUnlocker : public CGameObject { public: int _value; public: + CLASSDEF CBowlUnlocker() : CGameObject(), _value(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBowlUnlocker"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/brain_slot.h b/engines/titanic/game/brain_slot.h index fa197a85d7..ae797ebb2f 100644 --- a/engines/titanic/game/brain_slot.h +++ b/engines/titanic/game/brain_slot.h @@ -34,13 +34,9 @@ public: int _value1; CString _value2; public: + CLASSDEF CBrainSlot() : CGameObject(), _value1(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBrainSlot"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/bridge_door.h b/engines/titanic/game/bridge_door.h index 96703c1c6f..828562dfa3 100644 --- a/engines/titanic/game/bridge_door.h +++ b/engines/titanic/game/bridge_door.h @@ -29,10 +29,7 @@ namespace Titanic { class CBridgeDoor : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBridgeDoor"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/bridge_view.h b/engines/titanic/game/bridge_view.h index 7a765cf21a..35de076573 100644 --- a/engines/titanic/game/bridge_view.h +++ b/engines/titanic/game/bridge_view.h @@ -31,13 +31,9 @@ class CBridgeView : public CBackground { public: int _fieldE0; public: + CLASSDEF CBridgeView() : CBackground(), _fieldE0(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBridgeView"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/broken_pell_base.h b/engines/titanic/game/broken_pell_base.h index 8e77501aa5..46e7a70581 100644 --- a/engines/titanic/game/broken_pell_base.h +++ b/engines/titanic/game/broken_pell_base.h @@ -34,13 +34,9 @@ private: int _fieldE0; public: + CLASSDEF CBrokenPellBase() : CBackground(), _fieldE0(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBrokenPellBase"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/broken_pellerator.h b/engines/titanic/game/broken_pellerator.h index 71bae32e17..974d5d21b4 100644 --- a/engines/titanic/game/broken_pellerator.h +++ b/engines/titanic/game/broken_pellerator.h @@ -34,10 +34,7 @@ private: CString _string4; CString _string5; public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBrokenPellerator"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/broken_pellerator_froz.h b/engines/titanic/game/broken_pellerator_froz.h index 1fded7c09f..c3674f0af7 100644 --- a/engines/titanic/game/broken_pellerator_froz.h +++ b/engines/titanic/game/broken_pellerator_froz.h @@ -34,10 +34,7 @@ private: CString _string4; CString _string5; public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBrokenPelleratorFroz"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/cage.h b/engines/titanic/game/cage.h index 4c097f3b93..08fc8c8c43 100644 --- a/engines/titanic/game/cage.h +++ b/engines/titanic/game/cage.h @@ -32,10 +32,7 @@ public: static int _v1; static int _v2; public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CCage"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/call_pellerator.h b/engines/titanic/game/call_pellerator.h index a6e8ded2a2..dc9afe0a1a 100644 --- a/engines/titanic/game/call_pellerator.h +++ b/engines/titanic/game/call_pellerator.h @@ -29,10 +29,7 @@ namespace Titanic { class CCallPellerator : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CCallPellerator"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/captains_wheel.h b/engines/titanic/game/captains_wheel.h index 3d35b9b041..bcfc5136e7 100644 --- a/engines/titanic/game/captains_wheel.h +++ b/engines/titanic/game/captains_wheel.h @@ -36,13 +36,9 @@ public: int _fieldF0; int _fieldF4; public: + CLASSDEF CCaptainsWheel(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CCaptainsWheel"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/cdrom.h b/engines/titanic/game/cdrom.h index cd05c79d0a..f810056e4f 100644 --- a/engines/titanic/game/cdrom.h +++ b/engines/titanic/game/cdrom.h @@ -31,13 +31,9 @@ class CCDROM : public CGameObject { private: Common::Point _pos1; public: + CLASSDEF CCDROM(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CCDROM"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/cdrom_computer.h b/engines/titanic/game/cdrom_computer.h index 368c45f266..de070b007b 100644 --- a/engines/titanic/game/cdrom_computer.h +++ b/engines/titanic/game/cdrom_computer.h @@ -34,13 +34,9 @@ private: int _fieldC4; int _fieldC8; public: + CLASSDEF CCDROMComputer(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CCDROMComputer"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/cdrom_tray.h b/engines/titanic/game/cdrom_tray.h index 371187e946..85d26c5a1d 100644 --- a/engines/titanic/game/cdrom_tray.h +++ b/engines/titanic/game/cdrom_tray.h @@ -32,13 +32,9 @@ private: int _fieldBC; CString _string1; public: + CLASSDEF CCDROMTray(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CCDROMTray"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/cell_point_button.h b/engines/titanic/game/cell_point_button.h index a16e7ae705..02710f6ce5 100644 --- a/engines/titanic/game/cell_point_button.h +++ b/engines/titanic/game/cell_point_button.h @@ -43,13 +43,9 @@ public: CString _string3; int _field118; public: + CLASSDEF CCellPointButton(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CCellPointButton"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/chev_code.h b/engines/titanic/game/chev_code.h index 6bd624258e..3d5347bd05 100644 --- a/engines/titanic/game/chev_code.h +++ b/engines/titanic/game/chev_code.h @@ -31,13 +31,9 @@ class CChevCode : public CGameObject { public: int _value; public: + CLASSDEF CChevCode() : CGameObject(), _value(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CChevCode"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/chev_panel.h b/engines/titanic/game/chev_panel.h index 39ad43628d..9ddca37dc3 100644 --- a/engines/titanic/game/chev_panel.h +++ b/engines/titanic/game/chev_panel.h @@ -33,13 +33,9 @@ public: int _fieldC0; int _fieldC4; public: + CLASSDEF CChevPanel() : _fieldBC(0), _fieldC0(0), _fieldC4(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CChevPanel"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/chicken_cooler.h b/engines/titanic/game/chicken_cooler.h index 42e8a2724e..9e150572f4 100644 --- a/engines/titanic/game/chicken_cooler.h +++ b/engines/titanic/game/chicken_cooler.h @@ -32,13 +32,9 @@ public: int _fieldBC; int _fieldC0; public: + CLASSDEF CChickenCooler() : CGameObject(), _fieldBC(0), _fieldC0(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CChickenCooler"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/chicken_dispensor.h b/engines/titanic/game/chicken_dispensor.h index 10fcba1d17..97e5f864f6 100644 --- a/engines/titanic/game/chicken_dispensor.h +++ b/engines/titanic/game/chicken_dispensor.h @@ -33,13 +33,9 @@ public: int _fieldE4; int _fieldE8; public: + CLASSDEF CChickenDispensor(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CNoNutBowl"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/close_broken_pel.h b/engines/titanic/game/close_broken_pel.h index ea174a4f1c..ecf38d904c 100644 --- a/engines/titanic/game/close_broken_pel.h +++ b/engines/titanic/game/close_broken_pel.h @@ -31,10 +31,7 @@ class CCloseBrokenPel : public CBackground { public: CString _string3; public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CCloseBrokenPel"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/code_wheel.h b/engines/titanic/game/code_wheel.h index 70879826e9..6080e92041 100644 --- a/engines/titanic/game/code_wheel.h +++ b/engines/titanic/game/code_wheel.h @@ -33,13 +33,9 @@ private: int _field10C; int _field110; public: + CLASSDEF CodeWheel(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CodeWheel"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/computer.h b/engines/titanic/game/computer.h index 074d17c0fa..793fecc491 100644 --- a/engines/titanic/game/computer.h +++ b/engines/titanic/game/computer.h @@ -32,13 +32,9 @@ public: CString _string3; int _fieldEC; public: + CLASSDEF CComputer() : CBackground(), _string3("None"), _fieldEC(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CComputer"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/computer_screen.h b/engines/titanic/game/computer_screen.h index adb8b99093..aa47482207 100644 --- a/engines/titanic/game/computer_screen.h +++ b/engines/titanic/game/computer_screen.h @@ -29,13 +29,9 @@ namespace Titanic { class CComputerScreen : public CGameObject { public: + CLASSDEF CComputerScreen(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CComputerScreen"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/cookie.h b/engines/titanic/game/cookie.h index a1a72c96c8..bd9d1fff04 100644 --- a/engines/titanic/game/cookie.h +++ b/engines/titanic/game/cookie.h @@ -32,13 +32,9 @@ public: int _value1; int _value2; public: + CLASSDEF CCookie() : CGameObject(), _value1(0), _value2(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CCookie"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/credits.h b/engines/titanic/game/credits.h index 0e35a58174..dc229127c8 100644 --- a/engines/titanic/game/credits.h +++ b/engines/titanic/game/credits.h @@ -31,13 +31,9 @@ class CCredits : public CGameObject { public: int _fieldBC, _fieldC0; public: + CLASSDEF CCredits(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CCredits"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/credits_button.h b/engines/titanic/game/credits_button.h index b22ce79a3b..fd7a8ad0c2 100644 --- a/engines/titanic/game/credits_button.h +++ b/engines/titanic/game/credits_button.h @@ -31,13 +31,9 @@ class CCreditsButton : public CBackground { public: int _fieldE0; public: + CLASSDEF CCreditsButton(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CCreditsButton"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/dead_area.h b/engines/titanic/game/dead_area.h index 374e45e9d3..4abcd58dd9 100644 --- a/engines/titanic/game/dead_area.h +++ b/engines/titanic/game/dead_area.h @@ -29,13 +29,9 @@ namespace Titanic { class CDeadArea : public CGameObject { public: + CLASSDEF CDeadArea(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CDeadArea"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/desk_click_responder.h b/engines/titanic/game/desk_click_responder.h index 94afece266..a11d7ae328 100644 --- a/engines/titanic/game/desk_click_responder.h +++ b/engines/titanic/game/desk_click_responder.h @@ -32,10 +32,7 @@ protected: int _fieldD4; int _fieldD8; public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CDeskClickResponder"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/doorbot_elevator_handler.h b/engines/titanic/game/doorbot_elevator_handler.h index 41d6068f1b..e46929dfed 100644 --- a/engines/titanic/game/doorbot_elevator_handler.h +++ b/engines/titanic/game/doorbot_elevator_handler.h @@ -32,10 +32,7 @@ private: static int _v1; int _value; public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CDoorbotElevatorHandler"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/doorbot_home_handler.h b/engines/titanic/game/doorbot_home_handler.h index 1557dbf91d..1e5d128a7d 100644 --- a/engines/titanic/game/doorbot_home_handler.h +++ b/engines/titanic/game/doorbot_home_handler.h @@ -29,13 +29,9 @@ namespace Titanic { class CDoorbotHomeHandler : public CGameObject { public: + CLASSDEF CDoorbotHomeHandler(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CDoorbotHomeHandler"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/ear_sweet_bowl.h b/engines/titanic/game/ear_sweet_bowl.h index 3e27516a60..aa276f82a7 100644 --- a/engines/titanic/game/ear_sweet_bowl.h +++ b/engines/titanic/game/ear_sweet_bowl.h @@ -29,10 +29,7 @@ namespace Titanic { class CEarSweetBowl : public CSweetBowl { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CEarSweetBowl"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/eject_phonograph_button.h b/engines/titanic/game/eject_phonograph_button.h index e37a061bd4..d3e8a50618 100644 --- a/engines/titanic/game/eject_phonograph_button.h +++ b/engines/titanic/game/eject_phonograph_button.h @@ -34,13 +34,9 @@ public: CString _string3; CString _string4; public: + CLASSDEF CEjectPhonographButton() : CBackground(), _fieldE0(0), _fieldE4(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CEjectPhonographButton"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/elevator_action_area.h b/engines/titanic/game/elevator_action_area.h index 07c4f13990..570ee808ed 100644 --- a/engines/titanic/game/elevator_action_area.h +++ b/engines/titanic/game/elevator_action_area.h @@ -31,13 +31,9 @@ class CElevatorActionArea : public CGameObject { public: int _value; public: + CLASSDEF CElevatorActionArea() : CGameObject(), _value(4) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CElevatorActionArea"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/emma_control.h b/engines/titanic/game/emma_control.h index 590c6f7fcf..ea30c52279 100644 --- a/engines/titanic/game/emma_control.h +++ b/engines/titanic/game/emma_control.h @@ -33,13 +33,9 @@ private: CString _wavFile1, _wavFile2; public: + CLASSDEF CEmmaControl() : CBackground(), _wavFile1("b#39.wav"), _wavFile2("b#38.wav") {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CEmmaControl"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/empty_nut_bowl.h b/engines/titanic/game/empty_nut_bowl.h index 57668ca49d..9645284e1b 100644 --- a/engines/titanic/game/empty_nut_bowl.h +++ b/engines/titanic/game/empty_nut_bowl.h @@ -31,13 +31,9 @@ class CEmptyNutBowl : public CGameObject { public: int _value; public: + CLASSDEF CEmptyNutBowl() : CGameObject(), _value(1) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CEmptyNutBowl"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/end_credit_text.h b/engines/titanic/game/end_credit_text.h index de0e54d7e0..0003a8b4e3 100644 --- a/engines/titanic/game/end_credit_text.h +++ b/engines/titanic/game/end_credit_text.h @@ -31,13 +31,9 @@ class CEndCreditText : public CGameObject { private: int _value; public: + CLASSDEF CEndCreditText() : CGameObject(), _value(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CEndCreditText"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/end_credits.h b/engines/titanic/game/end_credits.h index cf5c45ae45..a259a215a4 100644 --- a/engines/titanic/game/end_credits.h +++ b/engines/titanic/game/end_credits.h @@ -31,13 +31,9 @@ class CEndCredits : public CGameObject { public: int _value; public: + CLASSDEF CEndCredits() : CGameObject(), _value(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CEndCredits"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/end_explode_ship.h b/engines/titanic/game/end_explode_ship.h index df2e0b1b8c..a6b053fe55 100644 --- a/engines/titanic/game/end_explode_ship.h +++ b/engines/titanic/game/end_explode_ship.h @@ -31,13 +31,9 @@ class CEndExplodeShip : public CGameObject { public: int _value1, _value2; public: + CLASSDEF CEndExplodeShip() : CGameObject(), _value1(0), _value2(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CEndExplodeShip"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/end_game_credits.h b/engines/titanic/game/end_game_credits.h index f8ec6b00a7..68e86c6220 100644 --- a/engines/titanic/game/end_game_credits.h +++ b/engines/titanic/game/end_game_credits.h @@ -32,13 +32,9 @@ private: int _fieldBC; Common::Point _pos1; public: + CLASSDEF CEndGameCredits(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CEndGameCredits"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/end_sequence_control.h b/engines/titanic/game/end_sequence_control.h index dc849295ec..5e2ba30611 100644 --- a/engines/titanic/game/end_sequence_control.h +++ b/engines/titanic/game/end_sequence_control.h @@ -29,10 +29,7 @@ namespace Titanic { class CEndSequenceControl : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CEndSequenceControl"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/fan.h b/engines/titanic/game/fan.h index 75bdea5b6c..6f234074f5 100644 --- a/engines/titanic/game/fan.h +++ b/engines/titanic/game/fan.h @@ -31,13 +31,9 @@ class CFan : public CGameObject { public: int _value1, _value2; public: + CLASSDEF CFan() : CGameObject(), _value1(0), _value2(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CFan"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/fan_control.h b/engines/titanic/game/fan_control.h index dfb1ccc6a4..54ebbe27f3 100644 --- a/engines/titanic/game/fan_control.h +++ b/engines/titanic/game/fan_control.h @@ -35,13 +35,9 @@ public: int _fieldC8; int _fieldCC; public: + CLASSDEF CFanControl(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CFanControl"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/fan_decrease.h b/engines/titanic/game/fan_decrease.h index 9831873829..bac102823d 100644 --- a/engines/titanic/game/fan_decrease.h +++ b/engines/titanic/game/fan_decrease.h @@ -29,10 +29,7 @@ namespace Titanic { class CFanDecrease : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CFanDecrease"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/fan_increase.h b/engines/titanic/game/fan_increase.h index 1b9a0fd191..62561f1c54 100644 --- a/engines/titanic/game/fan_increase.h +++ b/engines/titanic/game/fan_increase.h @@ -29,10 +29,7 @@ namespace Titanic { class CFanIncrease : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CFanIncrease"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/fan_noises.h b/engines/titanic/game/fan_noises.h index 5e817a3a5b..ba35edcf76 100644 --- a/engines/titanic/game/fan_noises.h +++ b/engines/titanic/game/fan_noises.h @@ -37,13 +37,9 @@ public: int _fieldD0; int _fieldD4; public: + CLASSDEF CFanNoises(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CFanNoises"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/floor_indicator.h b/engines/titanic/game/floor_indicator.h index 86a7125aa2..a3511fb622 100644 --- a/engines/titanic/game/floor_indicator.h +++ b/engines/titanic/game/floor_indicator.h @@ -29,10 +29,7 @@ namespace Titanic { class CFloorIndicator : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CFloorIndicator"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/games_console.h b/engines/titanic/game/games_console.h index 4caeda8715..67634d8d41 100644 --- a/engines/titanic/game/games_console.h +++ b/engines/titanic/game/games_console.h @@ -31,13 +31,9 @@ class CGamesConsole : public CBackground { public: int _fieldE0; public: + CLASSDEF CGamesConsole() : CBackground(), _fieldE0(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CGamesConsole"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/get_lift_eye2.h b/engines/titanic/game/get_lift_eye2.h index e8149cacae..6782a56f11 100644 --- a/engines/titanic/game/get_lift_eye2.h +++ b/engines/titanic/game/get_lift_eye2.h @@ -31,14 +31,10 @@ class CGetLiftEye2 : public CGameObject { private: static CString *_v1; public: + CLASSDEF static void init(); static void deinit(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CGetLiftEye2"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/glass_smasher.h b/engines/titanic/game/glass_smasher.h index c2b7ee6c5b..9c25065ecf 100644 --- a/engines/titanic/game/glass_smasher.h +++ b/engines/titanic/game/glass_smasher.h @@ -29,10 +29,7 @@ namespace Titanic { class CGlassSmasher : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CGlassSmasher"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/gondolier/gondolier_base.h b/engines/titanic/game/gondolier/gondolier_base.h index 3f0cede70d..c45e3e2283 100644 --- a/engines/titanic/game/gondolier/gondolier_base.h +++ b/engines/titanic/game/gondolier/gondolier_base.h @@ -40,10 +40,7 @@ private: static int _v9; static int _v10; public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CGondolierBase"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/gondolier/gondolier_chest.h b/engines/titanic/game/gondolier/gondolier_chest.h index 277faf994f..d2c13812f4 100644 --- a/engines/titanic/game/gondolier/gondolier_chest.h +++ b/engines/titanic/game/gondolier/gondolier_chest.h @@ -29,10 +29,7 @@ namespace Titanic { class CGondolierChest : public CGondolierBase { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CGondolierChest"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/gondolier/gondolier_face.h b/engines/titanic/game/gondolier/gondolier_face.h index 5007431337..334cab143f 100644 --- a/engines/titanic/game/gondolier/gondolier_face.h +++ b/engines/titanic/game/gondolier/gondolier_face.h @@ -31,13 +31,9 @@ class CGondolierFace : public CGondolierBase { private: int _fieldBC; public: + CLASSDEF CGondolierFace() : CGondolierBase(), _fieldBC(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CGondolierMixer"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/gondolier/gondolier_mixer.h b/engines/titanic/game/gondolier/gondolier_mixer.h index 5b92bc2fb8..173bcd8ac2 100644 --- a/engines/titanic/game/gondolier/gondolier_mixer.h +++ b/engines/titanic/game/gondolier/gondolier_mixer.h @@ -37,13 +37,9 @@ private: CString _string2; int _fieldE4; public: + CLASSDEF CGondolierMixer(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CGondolierMixer"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/gondolier/gondolier_slider.h b/engines/titanic/game/gondolier/gondolier_slider.h index 9522483dc0..eef4a58089 100644 --- a/engines/titanic/game/gondolier/gondolier_slider.h +++ b/engines/titanic/game/gondolier/gondolier_slider.h @@ -48,13 +48,9 @@ private: CString _string3; int _field118; public: + CLASSDEF CGondolierSlider(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CGondolierSlider"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/hammer_clip.h b/engines/titanic/game/hammer_clip.h index 70abae5d7e..d1891d8c09 100644 --- a/engines/titanic/game/hammer_clip.h +++ b/engines/titanic/game/hammer_clip.h @@ -31,13 +31,9 @@ class CHammerClip : public CGameObject { public: int _value; public: + CLASSDEF CHammerClip() : CGameObject(), _value(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CHammerClip"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/hammer_dispensor.h b/engines/titanic/game/hammer_dispensor.h index 60b70546fd..b99045dcb5 100644 --- a/engines/titanic/game/hammer_dispensor.h +++ b/engines/titanic/game/hammer_dispensor.h @@ -33,13 +33,9 @@ private: int _fieldE4; int _fieldE8; public: + CLASSDEF CHammerDispensor(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CHammerDispensor"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/hammer_dispensor_button.h b/engines/titanic/game/hammer_dispensor_button.h index 978c1d3c9f..3f28360a8f 100644 --- a/engines/titanic/game/hammer_dispensor_button.h +++ b/engines/titanic/game/hammer_dispensor_button.h @@ -37,13 +37,9 @@ private: int _field10C; int _field110; public: + CLASSDEF CHammerDispensorButton(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CHammerDispensorButton"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/head_slot.h b/engines/titanic/game/head_slot.h index 210546a2d4..3ba94a6669 100644 --- a/engines/titanic/game/head_slot.h +++ b/engines/titanic/game/head_slot.h @@ -41,13 +41,9 @@ public: int _fieldE8; int _fieldEC; public: + CLASSDEF CHeadSlot(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CHeadSlot"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/head_smash_event.h b/engines/titanic/game/head_smash_event.h index 4032098817..847e86eeba 100644 --- a/engines/titanic/game/head_smash_event.h +++ b/engines/titanic/game/head_smash_event.h @@ -29,10 +29,7 @@ namespace Titanic { class CHeadSmashEvent : public CBackground { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CHeadSmashEvent"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/head_smash_lever.h b/engines/titanic/game/head_smash_lever.h index 7268cb8a4a..8a67f56c67 100644 --- a/engines/titanic/game/head_smash_lever.h +++ b/engines/titanic/game/head_smash_lever.h @@ -33,13 +33,9 @@ public: int _fieldE4; int _fieldE8; public: + CLASSDEF CHeadSmashLever(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CHeadSmashLever"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/head_spinner.h b/engines/titanic/game/head_spinner.h index 8d3de61f07..3ed3e1f01a 100644 --- a/engines/titanic/game/head_spinner.h +++ b/engines/titanic/game/head_spinner.h @@ -32,11 +32,7 @@ public: int _value1, _value2; public: CHeadSpinner() : CGameObject(), _value1(0), _value2(0) {} - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CHeadSpinner"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/idle_summoner.h b/engines/titanic/game/idle_summoner.h index 8f251b842b..a983684a15 100644 --- a/engines/titanic/game/idle_summoner.h +++ b/engines/titanic/game/idle_summoner.h @@ -40,11 +40,7 @@ public: int _fieldDC; public: CIdleSummoner(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CIdleSummoner"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/leave_sec_class_state.h b/engines/titanic/game/leave_sec_class_state.h index 3bcfe812df..34ba31b6c0 100644 --- a/engines/titanic/game/leave_sec_class_state.h +++ b/engines/titanic/game/leave_sec_class_state.h @@ -29,10 +29,7 @@ namespace Titanic { class CLeaveSecClassState : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CLeaveSecClassState"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/lemon_dispensor.h b/engines/titanic/game/lemon_dispensor.h index c2c76eac6a..091c6d7b27 100644 --- a/engines/titanic/game/lemon_dispensor.h +++ b/engines/titanic/game/lemon_dispensor.h @@ -38,13 +38,9 @@ private: int _fieldE8; int _fieldEC; public: + CLASSDEF CLemonDispensor(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CLemonDispensor"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/light.h b/engines/titanic/game/light.h index 482d1be65b..ea6073d038 100644 --- a/engines/titanic/game/light.h +++ b/engines/titanic/game/light.h @@ -38,13 +38,9 @@ private: int _fieldF8; int _fieldFC; public: + CLASSDEF CLight(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CLight"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/light_switch.h b/engines/titanic/game/light_switch.h index 0228b1009b..334cba75a6 100644 --- a/engines/titanic/game/light_switch.h +++ b/engines/titanic/game/light_switch.h @@ -35,13 +35,9 @@ private: int _fieldE4; int _fieldE8; public: + CLASSDEF CLightSwitch(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CLightSwitch"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/little_lift_button.h b/engines/titanic/game/little_lift_button.h index 475b8435d5..92f084aba1 100644 --- a/engines/titanic/game/little_lift_button.h +++ b/engines/titanic/game/little_lift_button.h @@ -31,13 +31,9 @@ class CLittleLiftButton : public CBackground { private: int _value; public: + CLASSDEF CLittleLiftButton() : CBackground(), _value(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CLittleLiftButton"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/long_stick_dispenser.h b/engines/titanic/game/long_stick_dispenser.h index 4912ea384b..30e3541087 100644 --- a/engines/titanic/game/long_stick_dispenser.h +++ b/engines/titanic/game/long_stick_dispenser.h @@ -33,14 +33,10 @@ public: int _fieldC0; int _fieldC4; public: + CLASSDEF CLongStickDispenser() : CGameObject(), _fieldBC(0), _fieldC0(0), _fieldC4(1) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CLongStickDispenser"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/mail_man.h b/engines/titanic/game/mail_man.h index 29ca165935..a75d75a865 100644 --- a/engines/titanic/game/mail_man.h +++ b/engines/titanic/game/mail_man.h @@ -31,13 +31,9 @@ class CMailMan : public CGameObject { public: int _value; public: + CLASSDEF CMailMan() : CGameObject(), _value(1) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMailMan"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/maitred/maitred_arm_holder.h b/engines/titanic/game/maitred/maitred_arm_holder.h index b838109fa3..e329157837 100644 --- a/engines/titanic/game/maitred/maitred_arm_holder.h +++ b/engines/titanic/game/maitred/maitred_arm_holder.h @@ -29,10 +29,7 @@ namespace Titanic { class CMaitreDArmHolder : public CDropTarget { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMaitreDArmHolder"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/maitred/maitred_body.h b/engines/titanic/game/maitred/maitred_body.h index 29e528b1f6..9dcc2af4ea 100644 --- a/engines/titanic/game/maitred/maitred_body.h +++ b/engines/titanic/game/maitred/maitred_body.h @@ -31,13 +31,9 @@ class CMaitreDBody : public CMaitreDProdReceptor { private: int _fieldC8; public: + CLASSDEF CMaitreDBody() : CMaitreDProdReceptor(), _fieldC8(1) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMaitreDBody"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/maitred/maitred_legs.h b/engines/titanic/game/maitred/maitred_legs.h index e3ac93c870..0dc1b34143 100644 --- a/engines/titanic/game/maitred/maitred_legs.h +++ b/engines/titanic/game/maitred/maitred_legs.h @@ -31,13 +31,9 @@ class CMaitreDLegs : public CMaitreDProdReceptor { private: int _fieldC8; public: + CLASSDEF CMaitreDLegs() : CMaitreDProdReceptor(), _fieldC8(1) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMaitreDLegs"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/maitred/maitred_prod_receptor.h b/engines/titanic/game/maitred/maitred_prod_receptor.h index 130bc547b2..b82c95b9b5 100644 --- a/engines/titanic/game/maitred/maitred_prod_receptor.h +++ b/engines/titanic/game/maitred/maitred_prod_receptor.h @@ -33,14 +33,10 @@ protected: int _fieldC0; int _fieldC4; public: + CLASSDEF CMaitreDProdReceptor() : CGameObject(), _fieldBC(0), _fieldC0(0), _fieldC4(1) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMaitreDProdReceptor"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/missiveomat.h b/engines/titanic/game/missiveomat.h index 77ba4cb574..a58c928497 100644 --- a/engines/titanic/game/missiveomat.h +++ b/engines/titanic/game/missiveomat.h @@ -36,13 +36,9 @@ public: CString _string2; int _fieldE0; public: + CLASSDEF CMissiveOMat(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMissiveOMat"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/missiveomat_button.h b/engines/titanic/game/missiveomat_button.h index f383e88798..603d2f5955 100644 --- a/engines/titanic/game/missiveomat_button.h +++ b/engines/titanic/game/missiveomat_button.h @@ -31,13 +31,9 @@ class CMissiveOMatButton : public CEditControl { public: int _fieldFC; public: + CLASSDEF CMissiveOMatButton() : CEditControl(), _fieldFC(2) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMissiveOMatButton"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/movie_tester.h b/engines/titanic/game/movie_tester.h index b5e4032be9..2fffd5d2c0 100644 --- a/engines/titanic/game/movie_tester.h +++ b/engines/titanic/game/movie_tester.h @@ -31,13 +31,9 @@ class CMovieTester : public CGameObject { public: int _value1, _value2; public: + CLASSDEF CMovieTester() : CGameObject(), _value1(0), _value2(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMovieTester"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/music_console_button.h b/engines/titanic/game/music_console_button.h index 84a7452b28..f6c33a91c5 100644 --- a/engines/titanic/game/music_console_button.h +++ b/engines/titanic/game/music_console_button.h @@ -29,10 +29,7 @@ namespace Titanic { class CMusicConsoleButton : public CMusicPlayer { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMusicConsoleButton"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/music_room_phonograph.h b/engines/titanic/game/music_room_phonograph.h index 2d34b160c9..6660503616 100644 --- a/engines/titanic/game/music_room_phonograph.h +++ b/engines/titanic/game/music_room_phonograph.h @@ -31,13 +31,9 @@ class CMusicRoomPhonograph : public CRestaurantPhonograph { private: int _field118; public: + CLASSDEF CMusicRoomPhonograph() : CRestaurantPhonograph(), _field118(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMusicRoomPhonograph"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/music_room_stop_phonograph_button.h b/engines/titanic/game/music_room_stop_phonograph_button.h index 4fd4aa6535..c37065fde4 100644 --- a/engines/titanic/game/music_room_stop_phonograph_button.h +++ b/engines/titanic/game/music_room_stop_phonograph_button.h @@ -31,13 +31,9 @@ class CMusicRoomStopPhonographButton : public CEjectPhonographButton { private: int _field100; public: + CLASSDEF CMusicRoomStopPhonographButton() : CEjectPhonographButton(), _field100(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMusicRoomStopPhonographButton"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/music_system_lock.h b/engines/titanic/game/music_system_lock.h index 98dc68b0dd..b5f4da55d6 100644 --- a/engines/titanic/game/music_system_lock.h +++ b/engines/titanic/game/music_system_lock.h @@ -31,13 +31,9 @@ class CMusicSystemLock : public CDropTarget { private: int _value; public: + CLASSDEF CMusicSystemLock() : CDropTarget(), _value(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMusicSystemLock"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/musical_instrument.h b/engines/titanic/game/musical_instrument.h index 8eafca5e3b..b4abe4fdb2 100644 --- a/engines/titanic/game/musical_instrument.h +++ b/engines/titanic/game/musical_instrument.h @@ -29,10 +29,7 @@ namespace Titanic { class CMusicalInstrument : public CBackground { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMusicalInstrument"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/nav_helmet.h b/engines/titanic/game/nav_helmet.h index 31eee9977a..ff39280e5b 100644 --- a/engines/titanic/game/nav_helmet.h +++ b/engines/titanic/game/nav_helmet.h @@ -31,13 +31,9 @@ class CNavHelmet : public CGameObject { private: int _value; public: + CLASSDEF CNavHelmet() : CGameObject(), _value(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CNavHelmet"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/navigation_computer.h b/engines/titanic/game/navigation_computer.h index 49e382a14c..a7077f7dcd 100644 --- a/engines/titanic/game/navigation_computer.h +++ b/engines/titanic/game/navigation_computer.h @@ -29,10 +29,7 @@ namespace Titanic { class CNavigationComputer : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CNavigationComputer"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/no_nut_bowl.h b/engines/titanic/game/no_nut_bowl.h index 40e8fd15f1..7557491b68 100644 --- a/engines/titanic/game/no_nut_bowl.h +++ b/engines/titanic/game/no_nut_bowl.h @@ -29,10 +29,7 @@ namespace Titanic { class CNoNutBowl : public CBackground { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CNoNutBowl"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/nose_holder.h b/engines/titanic/game/nose_holder.h index 3512e62bb4..e26c70fa1d 100644 --- a/engines/titanic/game/nose_holder.h +++ b/engines/titanic/game/nose_holder.h @@ -32,13 +32,9 @@ private: int _field118; int _field11C; public: + CLASSDEF CNoseHolder(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CNoseHolder"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/null_port_hole.h b/engines/titanic/game/null_port_hole.h index 2caff276d5..fb07462ea8 100644 --- a/engines/titanic/game/null_port_hole.h +++ b/engines/titanic/game/null_port_hole.h @@ -29,13 +29,9 @@ namespace Titanic { class CNullPortHole : public CClickResponder { public: + CLASSDEF CNullPortHole(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CNullPortHole"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/nut_replacer.h b/engines/titanic/game/nut_replacer.h index ef800c71a6..0917b40bd2 100644 --- a/engines/titanic/game/nut_replacer.h +++ b/engines/titanic/game/nut_replacer.h @@ -29,10 +29,7 @@ namespace Titanic { class CNutReplacer : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CNutReplacer"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/parrot/parrot_lobby_controller.h b/engines/titanic/game/parrot/parrot_lobby_controller.h index 371e31eaa9..6515a23944 100644 --- a/engines/titanic/game/parrot/parrot_lobby_controller.h +++ b/engines/titanic/game/parrot/parrot_lobby_controller.h @@ -29,10 +29,7 @@ namespace Titanic { class CParrotLobbyController : public CParrotLobbyObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CParrotLobbyController"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/parrot/parrot_lobby_link_updater.h b/engines/titanic/game/parrot/parrot_lobby_link_updater.h index d0843fe9ec..2f3ce7bac4 100644 --- a/engines/titanic/game/parrot/parrot_lobby_link_updater.h +++ b/engines/titanic/game/parrot/parrot_lobby_link_updater.h @@ -31,13 +31,9 @@ class CParrotLobbyLinkUpdater : public CParrotLobbyObject { public: int _fieldBC; public: + CLASSDEF CParrotLobbyLinkUpdater() : CParrotLobbyObject(), _fieldBC(1) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CParrotLobbyLinkUpdater"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/parrot/parrot_lobby_object.h b/engines/titanic/game/parrot/parrot_lobby_object.h index 85f2c3bc77..9cc979cd26 100644 --- a/engines/titanic/game/parrot/parrot_lobby_object.h +++ b/engines/titanic/game/parrot/parrot_lobby_object.h @@ -36,10 +36,7 @@ public: static void init(); public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CParrotLobbyObject"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/parrot/parrot_lobby_view_object.h b/engines/titanic/game/parrot/parrot_lobby_view_object.h index 00f7bbc72d..1e3e398c2c 100644 --- a/engines/titanic/game/parrot/parrot_lobby_view_object.h +++ b/engines/titanic/game/parrot/parrot_lobby_view_object.h @@ -31,13 +31,9 @@ class CParrotLobbyViewObject : public CParrotLobbyObject { public: int _fieldBC; public: + CLASSDEF CParrotLobbyViewObject() : CParrotLobbyObject(), _fieldBC(1) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CParrotLobbyViewObject"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/parrot/parrot_loser.h b/engines/titanic/game/parrot/parrot_loser.h index dac253e189..806195db19 100644 --- a/engines/titanic/game/parrot/parrot_loser.h +++ b/engines/titanic/game/parrot/parrot_loser.h @@ -29,10 +29,7 @@ namespace Titanic { class CParrotLoser : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CParrotLoser"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/parrot/parrot_nut_bowl_actor.h b/engines/titanic/game/parrot/parrot_nut_bowl_actor.h index 623918c85b..d1ccca6a71 100644 --- a/engines/titanic/game/parrot/parrot_nut_bowl_actor.h +++ b/engines/titanic/game/parrot/parrot_nut_bowl_actor.h @@ -31,13 +31,9 @@ class CParrotNutBowlActor : public CGameObject { public: int _value1, _value2; public: + CLASSDEF CParrotNutBowlActor(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CParrotNutBowlActor"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/parrot/parrot_nut_eater.h b/engines/titanic/game/parrot/parrot_nut_eater.h index 55367af818..6a7afd94cf 100644 --- a/engines/titanic/game/parrot/parrot_nut_eater.h +++ b/engines/titanic/game/parrot/parrot_nut_eater.h @@ -35,13 +35,9 @@ public: int _fieldC8; int _fieldCC; public: + CLASSDEF CParrotNutEater(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CParrotNutEater"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/parrot/parrot_perch_holder.h b/engines/titanic/game/parrot/parrot_perch_holder.h index 489e124a91..f355263846 100644 --- a/engines/titanic/game/parrot/parrot_perch_holder.h +++ b/engines/titanic/game/parrot/parrot_perch_holder.h @@ -29,10 +29,7 @@ namespace Titanic { class CParrotPerchHolder : public CMultiDropTarget { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CParrotPerchHolder"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/parrot/parrot_succubus.h b/engines/titanic/game/parrot/parrot_succubus.h index aad8a7ffa5..e60d35cd6c 100644 --- a/engines/titanic/game/parrot/parrot_succubus.h +++ b/engines/titanic/game/parrot/parrot_succubus.h @@ -35,13 +35,9 @@ public: int _field1F0; int _field1F4; public: + CLASSDEF CParrotSuccUBus(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CParrotSuccUBus"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/parrot/parrot_trigger.h b/engines/titanic/game/parrot/parrot_trigger.h index cb0d59c320..33aea157ad 100644 --- a/engines/titanic/game/parrot/parrot_trigger.h +++ b/engines/titanic/game/parrot/parrot_trigger.h @@ -31,13 +31,9 @@ class CParrotTrigger : public CGameObject { public: int _value; public: + CLASSDEF CParrotTrigger() : CGameObject(), _value(0x446AB) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CParrotTrigger"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/parrot/player_meets_parrot.h b/engines/titanic/game/parrot/player_meets_parrot.h index 685e67a95d..d0c3b9d9f3 100644 --- a/engines/titanic/game/parrot/player_meets_parrot.h +++ b/engines/titanic/game/parrot/player_meets_parrot.h @@ -29,10 +29,7 @@ namespace Titanic { class CPlayerMeetsParrot : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPlayerMeetsParrot"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/pet/pet.h b/engines/titanic/game/pet/pet.h index 096c1de9bf..58e3577235 100644 --- a/engines/titanic/game/pet/pet.h +++ b/engines/titanic/game/pet/pet.h @@ -37,13 +37,9 @@ public: int _fieldD8; int _fieldDC; public: + CLASSDEF CPET(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPET"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/pet/pet_class1.h b/engines/titanic/game/pet/pet_class1.h index c390a8732e..12dfb322b2 100644 --- a/engines/titanic/game/pet/pet_class1.h +++ b/engines/titanic/game/pet/pet_class1.h @@ -29,10 +29,7 @@ namespace Titanic { class CPETClass1 : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPETClass1"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/pet/pet_class2.h b/engines/titanic/game/pet/pet_class2.h index cfa445e6e2..5b96118c7c 100644 --- a/engines/titanic/game/pet/pet_class2.h +++ b/engines/titanic/game/pet/pet_class2.h @@ -29,10 +29,7 @@ namespace Titanic { class CPETClass2 : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPETClass2"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/pet/pet_class3.h b/engines/titanic/game/pet/pet_class3.h index a41a4d53f6..d68cb098ec 100644 --- a/engines/titanic/game/pet/pet_class3.h +++ b/engines/titanic/game/pet/pet_class3.h @@ -29,10 +29,7 @@ namespace Titanic { class CPETClass3 : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPETClass3"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/pet/pet_lift.h b/engines/titanic/game/pet/pet_lift.h index 11207cde26..1c56b0515a 100644 --- a/engines/titanic/game/pet/pet_lift.h +++ b/engines/titanic/game/pet/pet_lift.h @@ -29,10 +29,7 @@ namespace Titanic { class CPETLift : public CPETTransport { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPETLift"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/pet/pet_monitor.h b/engines/titanic/game/pet/pet_monitor.h index 544bbdea0e..ff2209802d 100644 --- a/engines/titanic/game/pet/pet_monitor.h +++ b/engines/titanic/game/pet/pet_monitor.h @@ -29,10 +29,7 @@ namespace Titanic { class CPETMonitor : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPETMonitor"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/pet/pet_pellerator.h b/engines/titanic/game/pet/pet_pellerator.h index 7314f7297a..1036c93c66 100644 --- a/engines/titanic/game/pet/pet_pellerator.h +++ b/engines/titanic/game/pet/pet_pellerator.h @@ -29,10 +29,7 @@ namespace Titanic { class CPETPellerator : public CPETTransport { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPETPellerator"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/pet/pet_position.h b/engines/titanic/game/pet/pet_position.h index 6454b1e489..407a42f0ae 100644 --- a/engines/titanic/game/pet/pet_position.h +++ b/engines/titanic/game/pet/pet_position.h @@ -29,10 +29,7 @@ namespace Titanic { class CPETPosition : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPETPosition"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/pet/pet_sentinal.h b/engines/titanic/game/pet/pet_sentinal.h index 98f05dfee6..728ddbfe57 100644 --- a/engines/titanic/game/pet/pet_sentinal.h +++ b/engines/titanic/game/pet/pet_sentinal.h @@ -29,10 +29,7 @@ namespace Titanic { class CPETSentinal : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPETSentinal"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/pet/pet_sounds.h b/engines/titanic/game/pet/pet_sounds.h index cae45ac89d..f099d9efb5 100644 --- a/engines/titanic/game/pet/pet_sounds.h +++ b/engines/titanic/game/pet/pet_sounds.h @@ -31,13 +31,9 @@ class CPETSounds : public CGameObject { public: int _value; public: + CLASSDEF CPETSounds() : CGameObject(), _value(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPETSounds"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/pet/pet_transition.h b/engines/titanic/game/pet/pet_transition.h index 3ccb45fb04..c8dc153d53 100644 --- a/engines/titanic/game/pet/pet_transition.h +++ b/engines/titanic/game/pet/pet_transition.h @@ -29,10 +29,7 @@ namespace Titanic { class CPETTransition : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPETTransition"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/pet/pet_transport.h b/engines/titanic/game/pet/pet_transport.h index af821ef334..1aa6df8ced 100644 --- a/engines/titanic/game/pet/pet_transport.h +++ b/engines/titanic/game/pet/pet_transport.h @@ -29,10 +29,7 @@ namespace Titanic { class CPETTransport : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPETTransport"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/pet_disabler.h b/engines/titanic/game/pet_disabler.h index 3e8c799bad..5db5d7b533 100644 --- a/engines/titanic/game/pet_disabler.h +++ b/engines/titanic/game/pet_disabler.h @@ -31,13 +31,9 @@ class CPetDisabler : public CGameObject { public: CString _value; public: + CLASSDEF CPetDisabler() : CGameObject() {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPetDisabler"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/phonograph.h b/engines/titanic/game/phonograph.h index e7fcddf0ae..14712e5c1b 100644 --- a/engines/titanic/game/phonograph.h +++ b/engines/titanic/game/phonograph.h @@ -37,13 +37,9 @@ protected: int _fieldF0; int _fieldF4; public: + CLASSDEF CPhonograph(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPhonograph"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/phonograph_lid.h b/engines/titanic/game/phonograph_lid.h index 2252551ad7..38c8924885 100644 --- a/engines/titanic/game/phonograph_lid.h +++ b/engines/titanic/game/phonograph_lid.h @@ -31,13 +31,9 @@ class CPhonographLid : public CGameObject { private: int _value; public: + CLASSDEF CPhonographLid() : CGameObject(), _value(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPhonographLid"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/pickup/pick_up.h b/engines/titanic/game/pickup/pick_up.h index e1783ef322..d5a858017d 100644 --- a/engines/titanic/game/pickup/pick_up.h +++ b/engines/titanic/game/pickup/pick_up.h @@ -31,13 +31,9 @@ class CPickUp : public CGameObject { private: int _fieldBC; public: + CLASSDEF CPickUp() : CGameObject(), _fieldBC(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CAnnoyBarbot"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/pickup/pick_up_bar_glass.h b/engines/titanic/game/pickup/pick_up_bar_glass.h index 9bec56cdd5..f1c75555ad 100644 --- a/engines/titanic/game/pickup/pick_up_bar_glass.h +++ b/engines/titanic/game/pickup/pick_up_bar_glass.h @@ -29,10 +29,7 @@ namespace Titanic { class CPickUpBarGlass : public CPickUp { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPickUpBarGlass"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/pickup/pick_up_hose.h b/engines/titanic/game/pickup/pick_up_hose.h index 13d5810177..9014934ba1 100644 --- a/engines/titanic/game/pickup/pick_up_hose.h +++ b/engines/titanic/game/pickup/pick_up_hose.h @@ -33,10 +33,7 @@ private: CString _string1; public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPickUpHose"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/pickup/pick_up_lemon.h b/engines/titanic/game/pickup/pick_up_lemon.h index fee2485c1e..dc2942f366 100644 --- a/engines/titanic/game/pickup/pick_up_lemon.h +++ b/engines/titanic/game/pickup/pick_up_lemon.h @@ -29,10 +29,7 @@ namespace Titanic { class CPickUpLemon : public CPickUp { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPickUpLemon"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/pickup/pick_up_speech_centre.h b/engines/titanic/game/pickup/pick_up_speech_centre.h index b68761b83c..5d7d133ccc 100644 --- a/engines/titanic/game/pickup/pick_up_speech_centre.h +++ b/engines/titanic/game/pickup/pick_up_speech_centre.h @@ -29,10 +29,7 @@ namespace Titanic { class CPickUpSpeechCentre : public CPickUp { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPickUpSpeechCentre"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/pickup/pick_up_vis_centre.h b/engines/titanic/game/pickup/pick_up_vis_centre.h index 16db8f2b73..4345fceda9 100644 --- a/engines/titanic/game/pickup/pick_up_vis_centre.h +++ b/engines/titanic/game/pickup/pick_up_vis_centre.h @@ -29,10 +29,7 @@ namespace Titanic { class CPickUpVisCentre : public CPickUp { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPickUpVisCentre"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/placeholder/bar_shelf_vis_centre.h b/engines/titanic/game/placeholder/bar_shelf_vis_centre.h index 1cd3ca22bf..a2d39c3ea7 100644 --- a/engines/titanic/game/placeholder/bar_shelf_vis_centre.h +++ b/engines/titanic/game/placeholder/bar_shelf_vis_centre.h @@ -31,12 +31,9 @@ class CBarShelfVisCentre : public CPlaceHolder { private: int _value; public: + CLASSDEF CBarShelfVisCentre() : CPlaceHolder(), _value(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBarShelfVisCentre"; } - + /** * Save the data for the class to file */ diff --git a/engines/titanic/game/placeholder/lemon_on_bar.h b/engines/titanic/game/placeholder/lemon_on_bar.h index d02f7a9eb8..c88698fcab 100644 --- a/engines/titanic/game/placeholder/lemon_on_bar.h +++ b/engines/titanic/game/placeholder/lemon_on_bar.h @@ -31,10 +31,7 @@ class CLemonOnBar : public CPlaceHolder { private: Common::Point _pos1; public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CLemonOnBar"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/placeholder/place_holder.h b/engines/titanic/game/placeholder/place_holder.h index dd1c89dd86..4d01cd6c39 100644 --- a/engines/titanic/game/placeholder/place_holder.h +++ b/engines/titanic/game/placeholder/place_holder.h @@ -29,10 +29,7 @@ namespace Titanic { class CPlaceHolder : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPlaceHolder"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/placeholder/tv_on_bar.h b/engines/titanic/game/placeholder/tv_on_bar.h index 1583dad05a..3358cd6fec 100644 --- a/engines/titanic/game/placeholder/tv_on_bar.h +++ b/engines/titanic/game/placeholder/tv_on_bar.h @@ -31,10 +31,7 @@ class CTVOnBar : public CPlaceHolder { private: Common::Point _pos1; public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CTVOnBar"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/play_music_button.h b/engines/titanic/game/play_music_button.h index 29a13a688a..9e0bb464b3 100644 --- a/engines/titanic/game/play_music_button.h +++ b/engines/titanic/game/play_music_button.h @@ -32,13 +32,9 @@ public: int _fieldE0; int _fieldE4; public: + CLASSDEF CPlayMusicButton() : CBackground(), _fieldE0(0), _fieldE4(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPlayMusicButton"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/play_on_act.h b/engines/titanic/game/play_on_act.h index b8fdb2ac15..22bb54de6a 100644 --- a/engines/titanic/game/play_on_act.h +++ b/engines/titanic/game/play_on_act.h @@ -29,10 +29,7 @@ namespace Titanic { class CPlayOnAct : public CBackground { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPlayOnAct"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/port_hole.h b/engines/titanic/game/port_hole.h index 60aab51bb6..2672614d68 100644 --- a/engines/titanic/game/port_hole.h +++ b/engines/titanic/game/port_hole.h @@ -32,13 +32,9 @@ private: int _fieldBC; CString _string1, _string2; public: + CLASSDEF CPortHole(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPortHole"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/record_phonograph_button.h b/engines/titanic/game/record_phonograph_button.h index 4b2c6c885e..3ae7fb1dea 100644 --- a/engines/titanic/game/record_phonograph_button.h +++ b/engines/titanic/game/record_phonograph_button.h @@ -31,13 +31,9 @@ class CRecordPhonographButton : public CBackground { public: int _value; public: + CLASSDEF CRecordPhonographButton() : CBackground(), _value(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CRecordPhonographButton"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/replacement_ear.h b/engines/titanic/game/replacement_ear.h index 9c4a8e1398..0cff55d684 100644 --- a/engines/titanic/game/replacement_ear.h +++ b/engines/titanic/game/replacement_ear.h @@ -29,10 +29,7 @@ namespace Titanic { class CReplacementEar : public CBackground { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CNoNutBowl"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/reserved_table.h b/engines/titanic/game/reserved_table.h index abf3a657be..49cd5e8e39 100644 --- a/engines/titanic/game/reserved_table.h +++ b/engines/titanic/game/reserved_table.h @@ -31,13 +31,9 @@ class CReservedTable : public CGameObject { public: int _value1, _value2; public: + CLASSDEF CReservedTable() : CGameObject(), _value1(0), _value2(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CReservedTable"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/restaurant_cylinder_holder.h b/engines/titanic/game/restaurant_cylinder_holder.h index 29e2958f98..9f3911d850 100644 --- a/engines/titanic/game/restaurant_cylinder_holder.h +++ b/engines/titanic/game/restaurant_cylinder_holder.h @@ -37,13 +37,9 @@ private: CString _string6; int _field140; public: + CLASSDEF CRestaurantCylinderHolder(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CRestaurantCylinderHolder"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/restaurant_phonograph.h b/engines/titanic/game/restaurant_phonograph.h index 777ec34358..40116f5d07 100644 --- a/engines/titanic/game/restaurant_phonograph.h +++ b/engines/titanic/game/restaurant_phonograph.h @@ -34,13 +34,9 @@ private: CString _string3; int _field114; public: + CLASSDEF CRestaurantPhonograph(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CRestaurantPhonograph"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/room_item.h b/engines/titanic/game/room_item.h index c213d38caa..7441ed01bc 100644 --- a/engines/titanic/game/room_item.h +++ b/engines/titanic/game/room_item.h @@ -42,13 +42,9 @@ private: void loading(); public: + CLASSDEF CRoomItem(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CRoomItem"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/sauce_dispensor.h b/engines/titanic/game/sauce_dispensor.h index fd9afd979c..6969adb326 100644 --- a/engines/titanic/game/sauce_dispensor.h +++ b/engines/titanic/game/sauce_dispensor.h @@ -37,13 +37,9 @@ public: int _field104; int _field108; public: + CLASSDEF CSauceDispensor(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSauceDispensor"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/search_point.h b/engines/titanic/game/search_point.h index 3908d87ee6..7bd05d8d1e 100644 --- a/engines/titanic/game/search_point.h +++ b/engines/titanic/game/search_point.h @@ -31,13 +31,9 @@ class CSearchPoint : public CGameObject { public: int _value; public: + CLASSDEF CSearchPoint() : CGameObject(), _value(2) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSearchPoint"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/season_background.h b/engines/titanic/game/season_background.h index 28998538da..709f1002c3 100644 --- a/engines/titanic/game/season_background.h +++ b/engines/titanic/game/season_background.h @@ -34,13 +34,9 @@ public: int _fieldE8; int _fieldEC; public: + CLASSDEF CSeasonBackground(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSeasonBackground"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/season_barrel.h b/engines/titanic/game/season_barrel.h index af22c14f73..d3f7b1a91e 100644 --- a/engines/titanic/game/season_barrel.h +++ b/engines/titanic/game/season_barrel.h @@ -32,13 +32,9 @@ public: int _fieldE0; int _fieldE4; public: + CLASSDEF CSeasonBarrel() : CBackground(), _fieldE0(0), _fieldE4(7) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSeasonBarrel"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/seasonal_adjustment.h b/engines/titanic/game/seasonal_adjustment.h index 2db94033db..4bfec1a47a 100644 --- a/engines/titanic/game/seasonal_adjustment.h +++ b/engines/titanic/game/seasonal_adjustment.h @@ -32,13 +32,9 @@ public: int _fieldE0; int _fieldE4; public: + CLASSDEF CSeasonalAdjustment() : CBackground(), _fieldE0(0), _fieldE4(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSeasonalAdjustment"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/service_elevator_window.h b/engines/titanic/game/service_elevator_window.h index 493776c7af..70c38753b2 100644 --- a/engines/titanic/game/service_elevator_window.h +++ b/engines/titanic/game/service_elevator_window.h @@ -34,13 +34,9 @@ public: int _fieldE8; int _fieldEC; public: + CLASSDEF CServiceElevatorWindow(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CServiceElevatorWindow"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/sgt/armchair.h b/engines/titanic/game/sgt/armchair.h index 2157c3c556..1ce6955c58 100644 --- a/engines/titanic/game/sgt/armchair.h +++ b/engines/titanic/game/sgt/armchair.h @@ -29,10 +29,7 @@ namespace Titanic { class CArmchair : public CSGTStateRoom { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CArmchair"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/sgt/basin.h b/engines/titanic/game/sgt/basin.h index 85aaf476dd..cc9739fd1d 100644 --- a/engines/titanic/game/sgt/basin.h +++ b/engines/titanic/game/sgt/basin.h @@ -29,10 +29,7 @@ namespace Titanic { class CBasin : public CSGTStateRoom { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBasin"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/sgt/bedfoot.h b/engines/titanic/game/sgt/bedfoot.h index 7794fc4349..55be4fdadd 100644 --- a/engines/titanic/game/sgt/bedfoot.h +++ b/engines/titanic/game/sgt/bedfoot.h @@ -29,10 +29,7 @@ namespace Titanic { class CBedfoot : public CSGTStateRoom { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBedfoot"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/sgt/bedhead.h b/engines/titanic/game/sgt/bedhead.h index 36691639fc..317b7eb2a3 100644 --- a/engines/titanic/game/sgt/bedhead.h +++ b/engines/titanic/game/sgt/bedhead.h @@ -29,10 +29,7 @@ namespace Titanic { class CBedhead : public CSGTStateRoom { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBedhead"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/sgt/chest_of_drawers.h b/engines/titanic/game/sgt/chest_of_drawers.h index 17f5cf9e9b..e0bdd7579e 100644 --- a/engines/titanic/game/sgt/chest_of_drawers.h +++ b/engines/titanic/game/sgt/chest_of_drawers.h @@ -29,10 +29,7 @@ namespace Titanic { class CChestOfDrawers : public CSGTStateRoom { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CChestOfDrawers"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/sgt/desk.h b/engines/titanic/game/sgt/desk.h index 4c89c04e4b..7fbb65ad5e 100644 --- a/engines/titanic/game/sgt/desk.h +++ b/engines/titanic/game/sgt/desk.h @@ -29,10 +29,7 @@ namespace Titanic { class CDesk : public CSGTStateRoom { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CDesk"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/sgt/deskchair.h b/engines/titanic/game/sgt/deskchair.h index 762b639eb7..205209c22c 100644 --- a/engines/titanic/game/sgt/deskchair.h +++ b/engines/titanic/game/sgt/deskchair.h @@ -29,10 +29,7 @@ namespace Titanic { class CDeskchair : public CSGTStateRoom { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CDeskchair"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/sgt/drawer.h b/engines/titanic/game/sgt/drawer.h index 100e27cb52..8436e5ccb7 100644 --- a/engines/titanic/game/sgt/drawer.h +++ b/engines/titanic/game/sgt/drawer.h @@ -31,13 +31,9 @@ class CDrawer : public CSGTStateRoom { private: int _fieldF4; public: + CLASSDEF CDrawer(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CDrawer"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/sgt/sgt_doors.h b/engines/titanic/game/sgt/sgt_doors.h index 946404936f..9828708377 100644 --- a/engines/titanic/game/sgt/sgt_doors.h +++ b/engines/titanic/game/sgt/sgt_doors.h @@ -31,13 +31,9 @@ class CSGTDoors : public CGameObject { public: int _value1, _value2; public: + CLASSDEF CSGTDoors() : CGameObject(), _value1(0), _value2(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSGTDoors"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/sgt/sgt_nav.h b/engines/titanic/game/sgt/sgt_nav.h index 7f1912dc35..7d7f57f851 100644 --- a/engines/titanic/game/sgt/sgt_nav.h +++ b/engines/titanic/game/sgt/sgt_nav.h @@ -29,10 +29,7 @@ namespace Titanic { class SGTNav : public CSGTStateRoom { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "SGTNav"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/sgt/sgt_navigation.h b/engines/titanic/game/sgt/sgt_navigation.h index 539a6073a8..083efa8cfa 100644 --- a/engines/titanic/game/sgt/sgt_navigation.h +++ b/engines/titanic/game/sgt/sgt_navigation.h @@ -37,14 +37,10 @@ class CSGTNavigation : public CGameObject { private: static CSGTNavigationStatics *_statics; public: + CLASSDEF static void init(); static void deinit(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSGTNavigation"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/sgt/sgt_restaurant_doors.h b/engines/titanic/game/sgt/sgt_restaurant_doors.h index 904c0c6b60..14677ea5f9 100644 --- a/engines/titanic/game/sgt/sgt_restaurant_doors.h +++ b/engines/titanic/game/sgt/sgt_restaurant_doors.h @@ -31,13 +31,9 @@ class CSGTRestaurantDoors : public CGameObject { private: int _fieldBC; public: + CLASSDEF CSGTRestaurantDoors() : CGameObject(), _fieldBC(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSGTRestaurantDoors"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/sgt/sgt_state_control.h b/engines/titanic/game/sgt/sgt_state_control.h index b22095cb14..05d8fde7d1 100644 --- a/engines/titanic/game/sgt/sgt_state_control.h +++ b/engines/titanic/game/sgt/sgt_state_control.h @@ -31,13 +31,9 @@ class CSGTStateControl : public CBackground { private: int _fieldE0; public: + CLASSDEF CSGTStateControl() : CBackground(), _fieldE0(1) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSGTStateControl"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/sgt/sgt_state_room.h b/engines/titanic/game/sgt/sgt_state_room.h index f67a916f1f..dfac6894b9 100644 --- a/engines/titanic/game/sgt/sgt_state_room.h +++ b/engines/titanic/game/sgt/sgt_state_room.h @@ -54,15 +54,11 @@ private: int _fieldEC; int _fieldF0; public: + CLASSDEF CSGTStateRoom(); static void init(); static void deinit(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSGTStateRoom"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/sgt/sgt_tv.h b/engines/titanic/game/sgt/sgt_tv.h index 79e7efde4f..347d2c74ab 100644 --- a/engines/titanic/game/sgt/sgt_tv.h +++ b/engines/titanic/game/sgt/sgt_tv.h @@ -29,10 +29,7 @@ namespace Titanic { class CSGTTV : public CSGTStateRoom { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSGTTV"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/sgt/sgt_upper_doors_sound.h b/engines/titanic/game/sgt/sgt_upper_doors_sound.h index ed97627315..cd62aa5cf6 100644 --- a/engines/titanic/game/sgt/sgt_upper_doors_sound.h +++ b/engines/titanic/game/sgt/sgt_upper_doors_sound.h @@ -29,13 +29,9 @@ namespace Titanic { class CSGTUpperDoorsSound : public CClickResponder { public: + CLASSDEF CSGTUpperDoorsSound(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSGTUpperDoorsSound"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/sgt/toilet.h b/engines/titanic/game/sgt/toilet.h index a5265e7473..08926516ee 100644 --- a/engines/titanic/game/sgt/toilet.h +++ b/engines/titanic/game/sgt/toilet.h @@ -29,10 +29,7 @@ namespace Titanic { class CToilet : public CSGTStateRoom { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CToilet"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/sgt/vase.h b/engines/titanic/game/sgt/vase.h index 37a58181a2..1b2a89f17b 100644 --- a/engines/titanic/game/sgt/vase.h +++ b/engines/titanic/game/sgt/vase.h @@ -29,10 +29,7 @@ namespace Titanic { class CVase : public CSGTStateRoom { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CVase"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/sgt/washstand.h b/engines/titanic/game/sgt/washstand.h index 40eb5a4eee..975a4d57c9 100644 --- a/engines/titanic/game/sgt/washstand.h +++ b/engines/titanic/game/sgt/washstand.h @@ -29,10 +29,7 @@ namespace Titanic { class CWashstand : public CSGTStateRoom { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CWashstand"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/ship_setting.h b/engines/titanic/game/ship_setting.h index 8e57e53125..a3b5d5f511 100644 --- a/engines/titanic/game/ship_setting.h +++ b/engines/titanic/game/ship_setting.h @@ -34,13 +34,9 @@ public: CString _string4; CString _string5; public: + CLASSDEF CShipSetting(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CShipSetting"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/ship_setting_button.h b/engines/titanic/game/ship_setting_button.h index fb8d533a7f..e6a6822854 100644 --- a/engines/titanic/game/ship_setting_button.h +++ b/engines/titanic/game/ship_setting_button.h @@ -33,13 +33,9 @@ private: int _fieldC8; int _fieldCC; public: + CLASSDEF CShipSettingButton(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CShipSettingButton"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/show_cell_points.h b/engines/titanic/game/show_cell_points.h index c807cd5ed6..a3d7ba2e5a 100644 --- a/engines/titanic/game/show_cell_points.h +++ b/engines/titanic/game/show_cell_points.h @@ -32,13 +32,9 @@ public: CString _strValue; int _numValue; public: + CLASSDEF CShowCellpoints() : CGameObject(), _numValue(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CShowCellpoints"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/speech_dispensor.h b/engines/titanic/game/speech_dispensor.h index 19f31fcf68..440746e5c2 100644 --- a/engines/titanic/game/speech_dispensor.h +++ b/engines/titanic/game/speech_dispensor.h @@ -38,10 +38,7 @@ private: int _fieldF8; int _fieldFC; public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSpeechDispensor"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/splash_animation.h b/engines/titanic/game/splash_animation.h index 8ac59d9d1c..2f4056231b 100644 --- a/engines/titanic/game/splash_animation.h +++ b/engines/titanic/game/splash_animation.h @@ -29,10 +29,7 @@ namespace Titanic { class CSplashAnimation : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSplashAnimation"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/starling_puret.h b/engines/titanic/game/starling_puret.h index 5bfdd660f9..7299c68449 100644 --- a/engines/titanic/game/starling_puret.h +++ b/engines/titanic/game/starling_puret.h @@ -31,13 +31,9 @@ class CStarlingPuret : public CGameObject { private: int _value; public: + CLASSDEF CStarlingPuret() : CGameObject(), _value(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CStarlingPuret"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/start_action.h b/engines/titanic/game/start_action.h index 3725dbc4a0..fc7a2ea514 100644 --- a/engines/titanic/game/start_action.h +++ b/engines/titanic/game/start_action.h @@ -32,13 +32,9 @@ protected: CString _string3; CString _string4; public: + CLASSDEF CStartAction(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CStartAction"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/stop_phonograph_button.h b/engines/titanic/game/stop_phonograph_button.h index 945345cd61..b1accfe1e1 100644 --- a/engines/titanic/game/stop_phonograph_button.h +++ b/engines/titanic/game/stop_phonograph_button.h @@ -29,10 +29,7 @@ namespace Titanic { class CStopPhonographButton : public CBackground { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CStopPhonographButton"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/sub_glass.h b/engines/titanic/game/sub_glass.h index 00ff26fbeb..b7ba51379e 100644 --- a/engines/titanic/game/sub_glass.h +++ b/engines/titanic/game/sub_glass.h @@ -36,13 +36,9 @@ private: int _fieldCC; CString _string; public: + CLASSDEF CSUBGlass(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSUBGlass"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/sub_wrapper.h b/engines/titanic/game/sub_wrapper.h index b67d4e506f..6b724f8000 100644 --- a/engines/titanic/game/sub_wrapper.h +++ b/engines/titanic/game/sub_wrapper.h @@ -31,13 +31,9 @@ class CSUBWrapper : public CGameObject { public: int _value; public: + CLASSDEF CSUBWrapper() : CGameObject(), _value(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSUBWrapper"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/sweet_bowl.h b/engines/titanic/game/sweet_bowl.h index 8fb20e4041..fa607bb67b 100644 --- a/engines/titanic/game/sweet_bowl.h +++ b/engines/titanic/game/sweet_bowl.h @@ -29,10 +29,7 @@ namespace Titanic { class CSweetBowl : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSweetBowl"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/television.h b/engines/titanic/game/television.h index 4f39d60b9f..d64c253d90 100644 --- a/engines/titanic/game/television.h +++ b/engines/titanic/game/television.h @@ -42,13 +42,9 @@ private: int _fieldEC; int _fieldF0; public: + CLASSDEF CTelevision(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CTelevision"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/third_class_canal.h b/engines/titanic/game/third_class_canal.h index 4465cba07b..7a2c3d4f77 100644 --- a/engines/titanic/game/third_class_canal.h +++ b/engines/titanic/game/third_class_canal.h @@ -29,10 +29,7 @@ namespace Titanic { class CThirdClassCanal : public CBackground { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CThirdClassCanal"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/throw_tv_down_well.h b/engines/titanic/game/throw_tv_down_well.h index 0f8f731be3..dee145014b 100644 --- a/engines/titanic/game/throw_tv_down_well.h +++ b/engines/titanic/game/throw_tv_down_well.h @@ -32,13 +32,9 @@ public: CString _strValue; int _numValue; public: + CLASSDEF CThrowTVDownWell() : CGameObject(), _numValue(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CThrowTVDownWell"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/titania_still_control.h b/engines/titanic/game/titania_still_control.h index 141f0c5cf9..a0f739db01 100644 --- a/engines/titanic/game/titania_still_control.h +++ b/engines/titanic/game/titania_still_control.h @@ -29,10 +29,7 @@ namespace Titanic { class CTitaniaStillControl : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CTitaniaStillControl"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/tow_parrot_nav.h b/engines/titanic/game/tow_parrot_nav.h index 6233728198..420c29bfab 100644 --- a/engines/titanic/game/tow_parrot_nav.h +++ b/engines/titanic/game/tow_parrot_nav.h @@ -29,10 +29,7 @@ namespace Titanic { class CTOWParrotNav : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CTOWParrotNav"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/transport/exit_pellerator.h b/engines/titanic/game/transport/exit_pellerator.h index d327ea6ba6..e72cbb4b9d 100644 --- a/engines/titanic/game/transport/exit_pellerator.h +++ b/engines/titanic/game/transport/exit_pellerator.h @@ -32,10 +32,7 @@ private: static int _v1; static int _v2; public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPellerator"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/transport/gondolier.h b/engines/titanic/game/transport/gondolier.h index 1d874beb3a..bdfb3e7156 100644 --- a/engines/titanic/game/transport/gondolier.h +++ b/engines/titanic/game/transport/gondolier.h @@ -29,10 +29,7 @@ namespace Titanic { class CGondolier : public CTransport { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CGondolier"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/transport/lift.h b/engines/titanic/game/transport/lift.h index acb5fde45b..b1cd48960e 100644 --- a/engines/titanic/game/transport/lift.h +++ b/engines/titanic/game/transport/lift.h @@ -38,13 +38,9 @@ private: int _fieldF8; public: + CLASSDEF CLift() : CTransport(), _fieldF8(1) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CLift"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/transport/lift_indicator.h b/engines/titanic/game/transport/lift_indicator.h index bbd6cb2867..2fe6e1a61e 100644 --- a/engines/titanic/game/transport/lift_indicator.h +++ b/engines/titanic/game/transport/lift_indicator.h @@ -34,13 +34,9 @@ private: int _field108; int _field10C; public: + CLASSDEF CLiftindicator(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CLiftindicator"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/transport/pellerator.h b/engines/titanic/game/transport/pellerator.h index d327ea6ba6..e72cbb4b9d 100644 --- a/engines/titanic/game/transport/pellerator.h +++ b/engines/titanic/game/transport/pellerator.h @@ -32,10 +32,7 @@ private: static int _v1; static int _v2; public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPellerator"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/transport/service_elevator.h b/engines/titanic/game/transport/service_elevator.h index f97e3bcd5e..9edc1f9100 100644 --- a/engines/titanic/game/transport/service_elevator.h +++ b/engines/titanic/game/transport/service_elevator.h @@ -38,13 +38,9 @@ private: int _field100; int _field104; public: + CLASSDEF CServiceElevator(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CServiceElevator"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/transport/transport.h b/engines/titanic/game/transport/transport.h index 6e3f1a2d1d..faa00b4dd9 100644 --- a/engines/titanic/game/transport/transport.h +++ b/engines/titanic/game/transport/transport.h @@ -32,13 +32,9 @@ public: CString _string1; CString _string2; public: + CLASSDEF CTransport(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CTransport"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/up_lighter.h b/engines/titanic/game/up_lighter.h index e7c6cdf38e..e24e712c1c 100644 --- a/engines/titanic/game/up_lighter.h +++ b/engines/titanic/game/up_lighter.h @@ -34,13 +34,9 @@ private: int _field120; int _field124; public: + CLASSDEF CUpLighter(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CUpLighter"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/useless_lever.h b/engines/titanic/game/useless_lever.h index 444df0c69f..f582bdee63 100644 --- a/engines/titanic/game/useless_lever.h +++ b/engines/titanic/game/useless_lever.h @@ -29,10 +29,7 @@ namespace Titanic { class CUselessLever : public CToggleButton { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CUselessLever"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/game/wheel_button.h b/engines/titanic/game/wheel_button.h index b1721ebbdd..75e1268585 100644 --- a/engines/titanic/game/wheel_button.h +++ b/engines/titanic/game/wheel_button.h @@ -33,13 +33,9 @@ public: int _fieldE4; int _fieldE8; public: + CLASSDEF CWheelButton(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CWheelButton"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/wheel_hotspot.h b/engines/titanic/game/wheel_hotspot.h index 6887407a1e..7164b88b71 100644 --- a/engines/titanic/game/wheel_hotspot.h +++ b/engines/titanic/game/wheel_hotspot.h @@ -32,13 +32,9 @@ public: int _fieldE0; int _fieldE4; public: + CLASSDEF CWheelHotSpot() : CBackground(), _fieldE0(0), _fieldE4(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CWheelHotSpot"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/wheel_spin.h b/engines/titanic/game/wheel_spin.h index 64006afa0f..2e21da4984 100644 --- a/engines/titanic/game/wheel_spin.h +++ b/engines/titanic/game/wheel_spin.h @@ -31,13 +31,9 @@ class CWheelSpin : public CBackground { public: int _value; public: + CLASSDEF CWheelSpin() : CBackground(), _value(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CWheelSpin"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/game/wheel_spin_horn.h b/engines/titanic/game/wheel_spin_horn.h index b96b20b6c4..e4c0bd738c 100644 --- a/engines/titanic/game/wheel_spin_horn.h +++ b/engines/titanic/game/wheel_spin_horn.h @@ -32,10 +32,7 @@ public: CString _string1; CString _string2; public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CWheelSpinHorn"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/gfx/act_button.h b/engines/titanic/gfx/act_button.h index 0ae2d4d92e..b8f8f21173 100644 --- a/engines/titanic/gfx/act_button.h +++ b/engines/titanic/gfx/act_button.h @@ -29,13 +29,9 @@ namespace Titanic { class CActButton : public CSTButton { public: + CLASSDEF CActButton(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CActButton"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/changes_season_button.h b/engines/titanic/gfx/changes_season_button.h index 8a756341fd..f39cfdc647 100644 --- a/engines/titanic/gfx/changes_season_button.h +++ b/engines/titanic/gfx/changes_season_button.h @@ -29,13 +29,9 @@ namespace Titanic { class CChangesSeasonButton : public CSTButton { public: + CLASSDEF CChangesSeasonButton(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CChangesSeasonButton"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/chev_left_off.h b/engines/titanic/gfx/chev_left_off.h index c3ea05dabc..753aba3be0 100644 --- a/engines/titanic/gfx/chev_left_off.h +++ b/engines/titanic/gfx/chev_left_off.h @@ -29,13 +29,9 @@ namespace Titanic { class CChevLeftOff : public CToggleSwitch { public: + CLASSDEF CChevLeftOff(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CChevLeftOff"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/chev_left_on.h b/engines/titanic/gfx/chev_left_on.h index c2f23c30c7..99126d792c 100644 --- a/engines/titanic/gfx/chev_left_on.h +++ b/engines/titanic/gfx/chev_left_on.h @@ -29,13 +29,9 @@ namespace Titanic { class CChevLeftOn : public CToggleSwitch { public: + CLASSDEF CChevLeftOn(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CChevLeftOn"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/chev_right_off.h b/engines/titanic/gfx/chev_right_off.h index da28759abf..1a31007f19 100644 --- a/engines/titanic/gfx/chev_right_off.h +++ b/engines/titanic/gfx/chev_right_off.h @@ -29,13 +29,9 @@ namespace Titanic { class CChevRightOff : public CToggleSwitch { public: + CLASSDEF CChevRightOff(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CChevRightOff"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/chev_right_on.h b/engines/titanic/gfx/chev_right_on.h index eb307c16f7..084b02ea08 100644 --- a/engines/titanic/gfx/chev_right_on.h +++ b/engines/titanic/gfx/chev_right_on.h @@ -29,13 +29,9 @@ namespace Titanic { class CChevRightOn : public CToggleSwitch { public: + CLASSDEF CChevRightOn(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CChevRightOn"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/chev_send_rec_switch.h b/engines/titanic/gfx/chev_send_rec_switch.h index 8cd06e6ab0..29d6e7ab82 100644 --- a/engines/titanic/gfx/chev_send_rec_switch.h +++ b/engines/titanic/gfx/chev_send_rec_switch.h @@ -29,13 +29,9 @@ namespace Titanic { class CChevSendRecSwitch : public CToggleSwitch { public: + CLASSDEF CChevSendRecSwitch(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSendRecSwitch"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/chev_switch.h b/engines/titanic/gfx/chev_switch.h index e7b43c3805..6c0314be4c 100644 --- a/engines/titanic/gfx/chev_switch.h +++ b/engines/titanic/gfx/chev_switch.h @@ -29,13 +29,9 @@ namespace Titanic { class CChevSwitch : public CToggleSwitch { public: + CLASSDEF CChevSwitch(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CChevSwitch"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/edit_control.h b/engines/titanic/gfx/edit_control.h index 79b20f7108..d782b72669 100644 --- a/engines/titanic/gfx/edit_control.h +++ b/engines/titanic/gfx/edit_control.h @@ -43,13 +43,9 @@ protected: int _fieldF0; int _fieldF4; public: + CLASSDEF CEditControl(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CEditControl"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/elevator_button.h b/engines/titanic/gfx/elevator_button.h index 1090ea800a..dddb7077b3 100644 --- a/engines/titanic/gfx/elevator_button.h +++ b/engines/titanic/gfx/elevator_button.h @@ -29,13 +29,9 @@ namespace Titanic { class CElevatorButton : public CSTButton { public: + CLASSDEF CElevatorButton(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CElevatorButton"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/get_from_succ.h b/engines/titanic/gfx/get_from_succ.h index 810eb3117c..f0b028afa0 100644 --- a/engines/titanic/gfx/get_from_succ.h +++ b/engines/titanic/gfx/get_from_succ.h @@ -29,13 +29,9 @@ namespace Titanic { class CGetFromSucc : public CToggleSwitch { public: + CLASSDEF CGetFromSucc(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CGetFromSucc"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/helmet_on_off.h b/engines/titanic/gfx/helmet_on_off.h index 839c2a533f..41621f340e 100644 --- a/engines/titanic/gfx/helmet_on_off.h +++ b/engines/titanic/gfx/helmet_on_off.h @@ -29,13 +29,9 @@ namespace Titanic { class CHelmetOnOff : public CToggleSwitch { public: + CLASSDEF CHelmetOnOff(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CHelmetOnOff"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/home_photo.h b/engines/titanic/gfx/home_photo.h index f8ad297534..6e6f4976a2 100644 --- a/engines/titanic/gfx/home_photo.h +++ b/engines/titanic/gfx/home_photo.h @@ -29,13 +29,9 @@ namespace Titanic { class CHomePhoto : public CToggleSwitch { public: + CLASSDEF CHomePhoto(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CHomePhoto"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/icon_nav_action.h b/engines/titanic/gfx/icon_nav_action.h index 812930bfdb..cb8fae932a 100644 --- a/engines/titanic/gfx/icon_nav_action.h +++ b/engines/titanic/gfx/icon_nav_action.h @@ -29,13 +29,9 @@ namespace Titanic { class CIconNavAction : public CToggleSwitch { public: + CLASSDEF CIconNavAction(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CIconNavAction"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/icon_nav_butt.h b/engines/titanic/gfx/icon_nav_butt.h index 018904eb73..36d3eb0890 100644 --- a/engines/titanic/gfx/icon_nav_butt.h +++ b/engines/titanic/gfx/icon_nav_butt.h @@ -29,10 +29,7 @@ namespace Titanic { class CIconNavButt : public CPetGraphic { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CIconNavButt"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/gfx/icon_nav_down.h b/engines/titanic/gfx/icon_nav_down.h index c6acfa04a3..b7759e059d 100644 --- a/engines/titanic/gfx/icon_nav_down.h +++ b/engines/titanic/gfx/icon_nav_down.h @@ -29,13 +29,9 @@ namespace Titanic { class CIconNavDown : public CToggleSwitch { public: + CLASSDEF CIconNavDown(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CIconNavDown"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/icon_nav_image.h b/engines/titanic/gfx/icon_nav_image.h index 403936d06e..61febfd2a4 100644 --- a/engines/titanic/gfx/icon_nav_image.h +++ b/engines/titanic/gfx/icon_nav_image.h @@ -29,10 +29,7 @@ namespace Titanic { class CIconNavImage : public CPetGraphic { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CIconNavImage"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/gfx/icon_nav_left.h b/engines/titanic/gfx/icon_nav_left.h index 006056babd..e507d2c2dd 100644 --- a/engines/titanic/gfx/icon_nav_left.h +++ b/engines/titanic/gfx/icon_nav_left.h @@ -29,13 +29,9 @@ namespace Titanic { class CIconNavLeft : public CToggleSwitch { public: + CLASSDEF CIconNavLeft(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CIconNavLeft"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/icon_nav_receive.h b/engines/titanic/gfx/icon_nav_receive.h index b158fdaf87..cce1df2279 100644 --- a/engines/titanic/gfx/icon_nav_receive.h +++ b/engines/titanic/gfx/icon_nav_receive.h @@ -29,10 +29,7 @@ namespace Titanic { class CIconNavReceive : public CPetGraphic { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CIconNavReceive"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/gfx/icon_nav_right.h b/engines/titanic/gfx/icon_nav_right.h index 9f319d1065..db3bab4bb8 100644 --- a/engines/titanic/gfx/icon_nav_right.h +++ b/engines/titanic/gfx/icon_nav_right.h @@ -29,13 +29,9 @@ namespace Titanic { class CIconNavRight : public CToggleSwitch { public: + CLASSDEF CIconNavRight(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CIconNavRight"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/icon_nav_send.h b/engines/titanic/gfx/icon_nav_send.h index 59cb670687..1ffb8e9e15 100644 --- a/engines/titanic/gfx/icon_nav_send.h +++ b/engines/titanic/gfx/icon_nav_send.h @@ -29,10 +29,7 @@ namespace Titanic { class CIconNavSend : public CPetGraphic { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CIconNavSend"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/gfx/icon_nav_up.h b/engines/titanic/gfx/icon_nav_up.h index 010b6093a3..7eeeb773b1 100644 --- a/engines/titanic/gfx/icon_nav_up.h +++ b/engines/titanic/gfx/icon_nav_up.h @@ -29,13 +29,9 @@ namespace Titanic { class CIconNavUp : public CToggleSwitch { public: + CLASSDEF CIconNavUp(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CIconNavUp"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/keybrd_butt.h b/engines/titanic/gfx/keybrd_butt.h index 52fff7700f..a4f233b209 100644 --- a/engines/titanic/gfx/keybrd_butt.h +++ b/engines/titanic/gfx/keybrd_butt.h @@ -29,13 +29,9 @@ namespace Titanic { class CKeybrdButt : public CToggleSwitch { public: + CLASSDEF CKeybrdButt(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CKeybrdButt"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/move_object_button.h b/engines/titanic/gfx/move_object_button.h index b00ba7b00f..70df8f6a7f 100644 --- a/engines/titanic/gfx/move_object_button.h +++ b/engines/titanic/gfx/move_object_button.h @@ -32,13 +32,9 @@ private: Common::Point _pos1; int _field11C; public: + CLASSDEF CMoveObjectButton(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMoveObjectButton"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/music_control.h b/engines/titanic/gfx/music_control.h index a6063f4f9e..97a0077c18 100644 --- a/engines/titanic/gfx/music_control.h +++ b/engines/titanic/gfx/music_control.h @@ -34,13 +34,9 @@ public: int _fieldE8; int _fieldEC; public: + CLASSDEF CMusicControl(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMusicControl"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/music_slider.h b/engines/titanic/gfx/music_slider.h index 911698656d..3fd0ab341e 100644 --- a/engines/titanic/gfx/music_slider.h +++ b/engines/titanic/gfx/music_slider.h @@ -29,10 +29,7 @@ namespace Titanic { class CMusicSlider : public CMusicControl { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMusicSlider"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/gfx/music_slider_pitch.h b/engines/titanic/gfx/music_slider_pitch.h index ba2514bf28..f50958bdcd 100644 --- a/engines/titanic/gfx/music_slider_pitch.h +++ b/engines/titanic/gfx/music_slider_pitch.h @@ -29,10 +29,7 @@ namespace Titanic { class CMusicSliderPitch : public CMusicSlider { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMusicSliderPitch"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/gfx/music_slider_speed.h b/engines/titanic/gfx/music_slider_speed.h index fb3e7e1d41..8ed18625ff 100644 --- a/engines/titanic/gfx/music_slider_speed.h +++ b/engines/titanic/gfx/music_slider_speed.h @@ -29,10 +29,7 @@ namespace Titanic { class CMusicSliderSpeed : public CMusicSlider { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMusicSliderSpeed"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/gfx/music_switch.h b/engines/titanic/gfx/music_switch.h index 0f277c5905..534eb251de 100644 --- a/engines/titanic/gfx/music_switch.h +++ b/engines/titanic/gfx/music_switch.h @@ -29,10 +29,7 @@ namespace Titanic { class CMusicSwitch : public CMusicControl { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMusicSwitch"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/gfx/music_switch_inversion.h b/engines/titanic/gfx/music_switch_inversion.h index 23562482e0..6aea692f61 100644 --- a/engines/titanic/gfx/music_switch_inversion.h +++ b/engines/titanic/gfx/music_switch_inversion.h @@ -29,10 +29,7 @@ namespace Titanic { class CMusicSwitchInversion : public CMusicSwitch { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMusicSwitchInversion"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/gfx/music_switch_reverse.h b/engines/titanic/gfx/music_switch_reverse.h index 5467ededb7..99460f1845 100644 --- a/engines/titanic/gfx/music_switch_reverse.h +++ b/engines/titanic/gfx/music_switch_reverse.h @@ -29,10 +29,7 @@ namespace Titanic { class CMusicSwitchReverse : public CMusicSwitch { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMusicSwitchReverse"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/gfx/music_voice_mute.h b/engines/titanic/gfx/music_voice_mute.h index 2a2acdedaa..2198b96e42 100644 --- a/engines/titanic/gfx/music_voice_mute.h +++ b/engines/titanic/gfx/music_voice_mute.h @@ -29,10 +29,7 @@ namespace Titanic { class CMusicVoiceMute : public CMusicControl { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMusicVoiceMute"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/gfx/pet_drag_chev.h b/engines/titanic/gfx/pet_drag_chev.h index 72f83dddf8..e82afd0a1b 100644 --- a/engines/titanic/gfx/pet_drag_chev.h +++ b/engines/titanic/gfx/pet_drag_chev.h @@ -29,10 +29,7 @@ namespace Titanic { class CPetDragChev : public CPetGraphic2 { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPetDragChev"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/gfx/pet_graphic.h b/engines/titanic/gfx/pet_graphic.h index 28b5d9aeca..112d75a870 100644 --- a/engines/titanic/gfx/pet_graphic.h +++ b/engines/titanic/gfx/pet_graphic.h @@ -29,10 +29,7 @@ namespace Titanic { class CPetGraphic : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPetGraphic"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/gfx/pet_graphic2.h b/engines/titanic/gfx/pet_graphic2.h index aabf058cf6..d9bb514915 100644 --- a/engines/titanic/gfx/pet_graphic2.h +++ b/engines/titanic/gfx/pet_graphic2.h @@ -29,10 +29,7 @@ namespace Titanic { class CPetGraphic2 : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CNutReplacer"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/gfx/pet_leaf.h b/engines/titanic/gfx/pet_leaf.h index 95fe1e6062..073374970c 100644 --- a/engines/titanic/gfx/pet_leaf.h +++ b/engines/titanic/gfx/pet_leaf.h @@ -29,10 +29,7 @@ namespace Titanic { class PETLeaf : public CGameObject { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "PETLeaf"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/gfx/pet_mode_off.h b/engines/titanic/gfx/pet_mode_off.h index 45b1010e45..ea88255b93 100644 --- a/engines/titanic/gfx/pet_mode_off.h +++ b/engines/titanic/gfx/pet_mode_off.h @@ -29,13 +29,9 @@ namespace Titanic { class CPetModeOff : public CToggleSwitch { public: + CLASSDEF CPetModeOff(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPetModeOff"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/pet_mode_on.h b/engines/titanic/gfx/pet_mode_on.h index 8ebfd8de3e..1434fb20db 100644 --- a/engines/titanic/gfx/pet_mode_on.h +++ b/engines/titanic/gfx/pet_mode_on.h @@ -29,13 +29,9 @@ namespace Titanic { class CPetModeOn : public CToggleSwitch { public: + CLASSDEF CPetModeOn(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPetModeOn"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/pet_mode_panel.h b/engines/titanic/gfx/pet_mode_panel.h index 3a394dfe05..ef68ca8b06 100644 --- a/engines/titanic/gfx/pet_mode_panel.h +++ b/engines/titanic/gfx/pet_mode_panel.h @@ -29,13 +29,9 @@ namespace Titanic { class CPetModePanel : public CToggleSwitch { public: + CLASSDEF CPetModePanel(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPetModePanel"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/pet_pannel1.h b/engines/titanic/gfx/pet_pannel1.h index 3d9b4068db..9261af9077 100644 --- a/engines/titanic/gfx/pet_pannel1.h +++ b/engines/titanic/gfx/pet_pannel1.h @@ -29,10 +29,7 @@ namespace Titanic { class CPetPannel1 : public CPetGraphic { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPetPannel1"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/gfx/pet_pannel2.h b/engines/titanic/gfx/pet_pannel2.h index 6fdad872ba..561c0d74a2 100644 --- a/engines/titanic/gfx/pet_pannel2.h +++ b/engines/titanic/gfx/pet_pannel2.h @@ -29,10 +29,7 @@ namespace Titanic { class CPetPannel2 : public CPetGraphic { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPetPannel2"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/gfx/pet_pannel3.h b/engines/titanic/gfx/pet_pannel3.h index 521d5179c2..590818406a 100644 --- a/engines/titanic/gfx/pet_pannel3.h +++ b/engines/titanic/gfx/pet_pannel3.h @@ -29,10 +29,7 @@ namespace Titanic { class CPetPannel3 : public CPetGraphic { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPetPannel3"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/gfx/send_to_succ.h b/engines/titanic/gfx/send_to_succ.h index 971c2e7f3f..fb237f206d 100644 --- a/engines/titanic/gfx/send_to_succ.h +++ b/engines/titanic/gfx/send_to_succ.h @@ -29,13 +29,9 @@ namespace Titanic { class CSendToSucc : public CToggleSwitch { public: + CLASSDEF CSendToSucc(); - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSendToSucc"; } - + /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/sgt_selector.h b/engines/titanic/gfx/sgt_selector.h index 92832889d4..678ee77b06 100644 --- a/engines/titanic/gfx/sgt_selector.h +++ b/engines/titanic/gfx/sgt_selector.h @@ -29,10 +29,7 @@ namespace Titanic { class CSGTSelector : public CPetGraphic { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSGTSelector"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/gfx/slider_button.h b/engines/titanic/gfx/slider_button.h index e39a5f8c41..afb96dbd70 100644 --- a/engines/titanic/gfx/slider_button.h +++ b/engines/titanic/gfx/slider_button.h @@ -34,13 +34,9 @@ private: int _field11C; Common::Point _pos1; public: + CLASSDEF CSliderButton(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSliderButton"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/small_chev_left_off.h b/engines/titanic/gfx/small_chev_left_off.h index bf73c7425b..fc500cee69 100644 --- a/engines/titanic/gfx/small_chev_left_off.h +++ b/engines/titanic/gfx/small_chev_left_off.h @@ -29,13 +29,9 @@ namespace Titanic { class CSmallChevLeftOff : public CToggleSwitch { public: + CLASSDEF CSmallChevLeftOff(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSmallChevLeftOff"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/small_chev_left_on.h b/engines/titanic/gfx/small_chev_left_on.h index c98108bec1..8ab9417468 100644 --- a/engines/titanic/gfx/small_chev_left_on.h +++ b/engines/titanic/gfx/small_chev_left_on.h @@ -29,13 +29,9 @@ namespace Titanic { class CSmallChevLeftOn : public CToggleSwitch { public: + CLASSDEF CSmallChevLeftOn(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSmallChevLeftOn"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/small_chev_right_off.h b/engines/titanic/gfx/small_chev_right_off.h index 5a6f3cc3ce..fae9c3c674 100644 --- a/engines/titanic/gfx/small_chev_right_off.h +++ b/engines/titanic/gfx/small_chev_right_off.h @@ -29,13 +29,9 @@ namespace Titanic { class CSmallChevRightOff : public CToggleSwitch { public: + CLASSDEF CSmallChevRightOff(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSmallChevRightOff"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/small_chev_right_on.h b/engines/titanic/gfx/small_chev_right_on.h index f0100109f2..c5cb4d792d 100644 --- a/engines/titanic/gfx/small_chev_right_on.h +++ b/engines/titanic/gfx/small_chev_right_on.h @@ -29,13 +29,9 @@ namespace Titanic { class CSmallChevRightOn : public CToggleSwitch { public: + CLASSDEF CSmallChevRightOn(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSmallChevRightOn"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/st_button.h b/engines/titanic/gfx/st_button.h index 39b3765848..e63d1c831c 100644 --- a/engines/titanic/gfx/st_button.h +++ b/engines/titanic/gfx/st_button.h @@ -37,13 +37,9 @@ private: CString _string5; int _field110; public: + CLASSDEF CSTButton(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSTButton"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/status_change_button.h b/engines/titanic/gfx/status_change_button.h index b3b41254b3..be0d9985b2 100644 --- a/engines/titanic/gfx/status_change_button.h +++ b/engines/titanic/gfx/status_change_button.h @@ -29,13 +29,9 @@ namespace Titanic { class CStatusChangeButton : public CSTButton { public: + CLASSDEF CStatusChangeButton(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CStatusChangeButton"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/text_down.h b/engines/titanic/gfx/text_down.h index 8fc16d8aee..6fc55bb647 100644 --- a/engines/titanic/gfx/text_down.h +++ b/engines/titanic/gfx/text_down.h @@ -29,10 +29,7 @@ namespace Titanic { class CTextDown : public CPetGraphic { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CTextDown"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/gfx/text_skrew.h b/engines/titanic/gfx/text_skrew.h index 88a6a9ab81..6d7e714963 100644 --- a/engines/titanic/gfx/text_skrew.h +++ b/engines/titanic/gfx/text_skrew.h @@ -29,10 +29,7 @@ namespace Titanic { class CTextSkrew : public CPetGraphic { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CTextSkrew"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/gfx/text_up.h b/engines/titanic/gfx/text_up.h index cce4c6c6b4..328aeee0ee 100644 --- a/engines/titanic/gfx/text_up.h +++ b/engines/titanic/gfx/text_up.h @@ -29,10 +29,7 @@ namespace Titanic { class CTextUp : public CPetGraphic { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CTextUp"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/gfx/toggle_button.h b/engines/titanic/gfx/toggle_button.h index b5113d7f95..a98a94df9e 100644 --- a/engines/titanic/gfx/toggle_button.h +++ b/engines/titanic/gfx/toggle_button.h @@ -31,13 +31,9 @@ class CToggleButton : public CBackground { private: int _fieldE0; public: + CLASSDEF CToggleButton() : CBackground(), _fieldE0(1) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CToggleButton"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/toggle_switch.h b/engines/titanic/gfx/toggle_switch.h index 977661df53..9b4fc4219b 100644 --- a/engines/titanic/gfx/toggle_switch.h +++ b/engines/titanic/gfx/toggle_switch.h @@ -32,13 +32,9 @@ private: int _fieldBC; Common::Point _pos1; public: + CLASSDEF CToggleSwitch(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CToggleSwitch"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/gfx/volume_control.h b/engines/titanic/gfx/volume_control.h index 5ff5c732b1..7778bb8c52 100644 --- a/engines/titanic/gfx/volume_control.h +++ b/engines/titanic/gfx/volume_control.h @@ -33,13 +33,9 @@ private: CString _string1; int _fieldCC; public: + CLASSDEF CVolumeControl(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CVolumeControl"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/messages/auto_sound_event.h b/engines/titanic/messages/auto_sound_event.h index cb5bfee788..03baba354f 100644 --- a/engines/titanic/messages/auto_sound_event.h +++ b/engines/titanic/messages/auto_sound_event.h @@ -32,13 +32,9 @@ public: int _value1; int _value2; public: + CLASSDEF CAutoSoundEvent(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CAutoSoundEvent"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/messages/bilge_auto_sound_event.h b/engines/titanic/messages/bilge_auto_sound_event.h index 94f38d3e65..e51f74bfa5 100644 --- a/engines/titanic/messages/bilge_auto_sound_event.h +++ b/engines/titanic/messages/bilge_auto_sound_event.h @@ -29,10 +29,7 @@ namespace Titanic { class CBilgeAutoSoundEvent : public CAutoSoundEvent { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBilgeAutoSoundEvent"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/messages/bilge_dispensor_event.h b/engines/titanic/messages/bilge_dispensor_event.h index 8308d474b2..fb88a6bd32 100644 --- a/engines/titanic/messages/bilge_dispensor_event.h +++ b/engines/titanic/messages/bilge_dispensor_event.h @@ -29,10 +29,7 @@ namespace Titanic { class CBilgeDispensorEvent : public CAutoSoundEvent { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBilgeDispensorEvent"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/messages/door_auto_sound_event.h b/engines/titanic/messages/door_auto_sound_event.h index 7eb1d04bf4..cccc3fff9d 100644 --- a/engines/titanic/messages/door_auto_sound_event.h +++ b/engines/titanic/messages/door_auto_sound_event.h @@ -34,15 +34,11 @@ public: int _fieldDC; int _fieldE0; public: + CLASSDEF CDoorAutoSoundEvent() : CAutoSoundEvent(), _string1("z#44.wav"), _string2("z#43.wav"), _fieldDC(25), _fieldE0(25) { } - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CDoorAutoSoundEvent"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 6b6695d28c..c11d688985 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -30,13 +30,9 @@ namespace Titanic { class CMessage : public CSaveableObject { public: + CLASSDEF CMessage(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMessage"; } - /** * Save the data for the class to file */ @@ -57,13 +53,9 @@ private: int _field1C; int _field20; public: + CLASSDEF CEditControlMsg() : _field4(0), _field8(0), _field18(0), _field1C(0), _field20(0) {} - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CEditControlMsg"; } }; class CLightsMsg : public CMessage { @@ -73,13 +65,9 @@ public: int _fieldC; int _field10; public: + CLASSDEF CLightsMsg() : CMessage(), _field4(0), _field8(0), _fieldC(0), _field10(0) {} - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CLightsMsg"; } }; class CIsHookedOnMsg : public CMessage { @@ -91,27 +79,18 @@ private: int _field1C; int _field20; public: + CLASSDEF CIsHookedOnMsg() : CMessage(), _field4(0), _field8(0), _field18(0), _field1C(0), _field20(0) {} - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CIsHookedOnMsg"; } }; - class CSubAcceptCCarryMsg : public CMessage { public: CString _string1; int _value1, _value2, _value3; public: + CLASSDEF CSubAcceptCCarryMsg() : _value1(0), _value2(0), _value3(0) {} - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSubAcceptCCarryMsg"; } }; class CTransportMsg : public CMessage { @@ -119,216 +98,187 @@ public: CString _string; int _value1, _value2; public: + CLASSDEF CTransportMsg() : _value1(0), _value2(0) {} - - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CTransportMsg"; } }; -#define RAW_MESSAGE(NAME) class NAME: public CMessage { \ - virtual const char *getClassName() const { return #NAME; } \ - } -#define STR_MESSAGE(NAME, FIELD) class NAME: public CMessage { \ - public: CString FIELD; \ - virtual const char *getClassName() const { return #NAME; } \ - } -#define STR2_MESSAGE(NAME, FIELD1, FIELD2) class NAME: public CMessage { \ - public: CString FIELD1, FIELD2; \ - virtual const char *getClassName() const { return #NAME; } \ - } -#define STR_MESSAGE_VAL(NAME, FIELD, VAL) class NAME: public CMessage { \ - public: CString FIELD; \ - NAME(): FIELD(VAL) {} \ - virtual const char *getClassName() const { return #NAME; } \ - } -#define NUM_MESSAGE(NAME, FIELD) class NAME: public CMessage { \ - public: int FIELD; \ - NAME(): FIELD(0) {} \ - virtual const char *getClassName() const { return #NAME; } \ - } -#define NUM_MESSAGE_VAL(NAME, FIELD, VAL) class NAME: public CMessage { \ - public: int FIELD; \ - NAME(): CMessage(), FIELD(VAL) {} \ - virtual const char *getClassName() const { return #NAME; } \ - } -#define NUM2_MESSAGE(NAME, FIELD1, FIELD2) class NAME: public CMessage { \ - public: int FIELD1, FIELD2; \ - NAME(): CMessage(), FIELD1(0), FIELD2(0) {} \ - virtual const char *getClassName() const { return #NAME; } \ - } -#define NUM3_MESSAGE(NAME, FIELD1, FIELD2, FIELD3) class NAME: public CMessage { \ - public: int FIELD1, FIELD2, FIELD3; \ - NAME(): CMessage(), FIELD1(0), FIELD2(0), FIELD3(0) {} \ - virtual const char *getClassName() const { return #NAME; } \ +#define MESSAGE0(NAME) \ + class NAME: public CMessage { \ + public: NAME() : CMessage() {} \ + CLASSDEF \ } -#define NUM4_MESSAGE(NAME, FIELD1, FIELD2, FIELD3, FIELD4) \ +#define MESSAGE1(NAME, F1, N1, V1) \ class NAME: public CMessage { \ - public: int FIELD1, FIELD2, FIELD3, FIELD4; \ - NAME(): CMessage(), FIELD1(0), FIELD2(0), FIELD3(0), FIELD4(0) {} \ - virtual const char *getClassName() const { return #NAME; } \ + public: F1 _N1; \ + NAME() : CMessage(), _N1(V1) {} \ + NAME(F1 N1) : CMessage(), _N1(N1) {} \ + CLASSDEF \ } -#define NUM2_MESSAGE_VAL(NAME, FIELD1, FIELD2, VAL1, VAL2) \ +#define MESSAGE2(NAME, F1, N1, V1, F2, N2, V2) \ class NAME: public CMessage { \ - public: int FIELD1, FIELD2; \ - NAME(): CMessage(), FIELD1(VAL1), FIELD2(VAL2) {} \ - virtual const char *getClassName() const { return #NAME; } \ + public: F1 _N1; F2 _N2; \ + NAME() : CMessage(), _N1(V1), _N2(V2) {} \ + NAME(F1 N1, F2 N2) : CMessage(), _N1(N1), _N2(N2) {} \ + CLASSDEF \ } -#define SNUM_MESSAGE(NAME, SFIELD, NFIELD) class NAME: public CMessage { \ - public: CString SFIELD; CString NFIELD; \ - virtual const char *getClassName() const { return #NAME; } \ +#define MESSAGE3(NAME, F1, N1, V1, F2, N2, V2, F3, N3, V3) \ + class NAME: public CMessage { \ + public: F1 _N1; F2 _N2; F3 _N3; \ + NAME() : CMessage(), _N1(V1), _N2(V2), _N3(V3) {} \ + NAME(F1 N1, F2 N2, F3 N3) : CMessage(), _N1(N1), _N2(N2), _N3(N3) {} \ + CLASSDEF \ } -#define SNUM_MESSAGE_VAL(NAME, SFIELD, NFIELD, SVAL, NVAL) \ +#define MESSAGE4(NAME, F1, N1, V1, F2, N2, V2, F3, N3, V3, F4, N4, V4) \ class NAME: public CMessage { \ - public: CString SFIELD; CString NFIELD; \ - NAME(): CMessage(), SFIELD(SVAL), NFIELD(NVAL) {} \ - virtual const char *getClassName() const { return #NAME; } \ + public: F1 _N1; F2 _N2; F3 _N3; F4 _N4; \ + NAME() : CMessage(), _N1(V1), _N2(V2), _N3(V3), _N4(V4) {} \ + NAME(F1 N1, F2 N2, F3 N3, F4 N4) : CMessage(), _N1(N1), _N2(N2), _N3(N3), _N4(N4) {} \ + CLASSDEF \ } -STR_MESSAGE(CActMsg, _value); -STR_MESSAGE(CActivationmsg, _value); -STR_MESSAGE_VAL(CAddHeadPieceMsg, _value, "NULL"); -NUM_MESSAGE(CAnimateMaitreDMsg, _value); -NUM_MESSAGE(CArboretumGateMsg, _value); -RAW_MESSAGE(CArmPickedUpFromTableMsg); -RAW_MESSAGE(CBodyInBilgeRoomMsg); -NUM_MESSAGE(CBowlStateChange, _value); -SNUM_MESSAGE(CCarryObjectArrivedMsg, _strValue, _numValue); -STR_MESSAGE_VAL(CChangeSeasonMsg, _season, "Summer"); -RAW_MESSAGE(CCheckAllPossibleCodes); -NUM2_MESSAGE(CCheckChevCode, _value1, _value2); -NUM_MESSAGE(CChildDragEndMsg, _value); -NUM2_MESSAGE(CChildDragMoveMsg, _value1, _value2); -NUM2_MESSAGE(CChildDragStartMsg, _value1, _value2); -RAW_MESSAGE(CClearChevPanelBits); -RAW_MESSAGE(CCorrectMusicPlayedMsg); -RAW_MESSAGE(CCreateMusicPlayerMsg); -RAW_MESSAGE(CCylinderHolderReadyMsg); -RAW_MESSAGE(CDeactivationMsg); -STR_MESSAGE(CDeliverCCarryMsg, _value); -RAW_MESSAGE(CDisableMaitreDProdReceptor); -RAW_MESSAGE(CDismissBotMsg); -RAW_MESSAGE(CDoffNavHelmet); -RAW_MESSAGE(CDonNavHelmet); -NUM_MESSAGE(CDoorbotNeededInElevatorMsg, _value); -RAW_MESSAGE(CDoorbotNeededInHomeMsg); -NUM_MESSAGE(CDropobjectMsg, _value); -NUM_MESSAGE(CDropZoneGotObjectMsg, _value); -NUM_MESSAGE(CDropZoneLostObjectMsg, _value); -NUM_MESSAGE(CEjectCylinderMsg, _value); -RAW_MESSAGE(CErasePhonographCylinderMsg); -NUM2_MESSAGE(CFreshenCookieMsg, _value1, _value2); -NUM_MESSAGE(CGetChevClassBits, _value); -NUM_MESSAGE(CGetChevClassNum, _value); -SNUM_MESSAGE(CGetChevCodeFromRoomNameMsg, _strValue, _numValue); -NUM_MESSAGE(CGetChevFloorBits, _value); -NUM_MESSAGE(CGetChevFloorNum, _value); -NUM_MESSAGE(CGetChevLiftBits, _value); -NUM_MESSAGE(CGetChevLiftNum, _value); -NUM_MESSAGE(CGetChevRoomBits, _value); -NUM_MESSAGE(CGetChevRoomNum, _value); -NUM2_MESSAGE_VAL(CHoseConnectedMsg, _value1, _value2, 1, 0); -RAW_MESSAGE(CInitializeAnimMsg); -NUM_MESSAGE(CIsEarBowlPuzzleDone, _value); -NUM_MESSAGE(CIsParrotPresentMsg, _value); -NUM_MESSAGE_VAL(CKeyCharMsg, _value, 32); -NUM2_MESSAGE(CLemonFallsFromTreeMsg, _value1, _value2); -NUM_MESSAGE(CLockPhonographMsg, _value); -RAW_MESSAGE(CMaitreDDefeatedMsg); -RAW_MESSAGE(CMaitreDHappyMsg); -NUM_MESSAGE(CMissiveOMatActionMsg, _value); -RAW_MESSAGE(CMoveToStartPosMsg); -NUM2_MESSAGE(CMovieEndMsg, _value1, _value2); -NUM2_MESSAGE(CMovieFrameMsg, _value1, _value2); -RAW_MESSAGE(CMusicHasStartedMsg); -RAW_MESSAGE(CMusicHasStoppedMsg); -RAW_MESSAGE(CMusicSettingChangedMsg); -NUM2_MESSAGE(CNPCPlayAnimationMsg, _value1, _value2); -NUM_MESSAGE(CNPCPlayIdleAnimationMsg, _value); -NUM3_MESSAGE(CNPCPlayTalkingAnimationMsg, _value1, _value2, _value3); -RAW_MESSAGE(CNPCQueueIdleAnimMsg); -STR_MESSAGE(CNutPuzzleMsg, _value); -NUM_MESSAGE(COnSummonBotMsg, _value); -RAW_MESSAGE(COpeningCreditsMsg); -NUM_MESSAGE(CPanningAwayFromParrotMsg, _value); -STR2_MESSAGE(CParrotSpeakMsg, _value1, _value2); -NUM2_MESSAGE(CParrotTriesChickenMsg, _value1, _value2); -NUM4_MESSAGE(CPassOnDragStartMsg, _value1, _value2, _value3, _value4); -NUM_MESSAGE(CPhonographPlayMsg, _value); -RAW_MESSAGE(CPhonographReadyToPlayMsg); -NUM_MESSAGE(CPhonographRecordMsg, _value); -NUM3_MESSAGE(CPhonographStopMsg, _value1, _value2, _value3); -NUM2_MESSAGE(CPlayRangeMsg, _value1, _value2); -NUM2_MESSAGE(CPlayerTriesRestaurantTableMsg, _value1, _value2); -NUM_MESSAGE(CPreSaveMsg, _value); -NUM_MESSAGE(CProdMaitreDMsg, _value); -NUM2_MESSAGE(CPumpingMsg, _value1, _value2); -NUM_MESSAGE(CPutBotBackInHisBoxMsg, _value); -NUM_MESSAGE(CPutParrotBackMsg, _value); -RAW_MESSAGE(CPuzzleSolvedMsg); -NUM3_MESSAGE(CQueryCylinderHolderMsg, _value1, _value2, _value3); -NUM3_MESSAGE(CQueryCylinderMsg, _value1, _value2, _value3); -NUM3_MESSAGE(CQueryCylinderNameMsg, _value1, _value2, _value3); -NUM3_MESSAGE(CQueryCylinderTypeMsg, _value1, _value2, _value3); -NUM_MESSAGE(CQueryMusicControlSettingMsg, _value); -NUM_MESSAGE(CQueryPhonographState, _value); -RAW_MESSAGE(CRecordOntoCylinderMsg); -RAW_MESSAGE(CRemoveFromGameMsg); -RAW_MESSAGE(CReplaceBowlAndNutsMsg); -STR_MESSAGE(CRestaurantMusicChanged, _value); -SNUM_MESSAGE(CSendCCarryMsg, _strValue, _numValue); -STR_MESSAGE_VAL(CSenseWorkingMsg, _value, "Not Working"); -NUM2_MESSAGE(CServiceElevatorFloorChangeMsg, _value1, _value2); -RAW_MESSAGE(CServiceElevatorFloorRequestMsg); -NUM_MESSAGE_VAL(CServiceElevatorMsg, _value, 4); -NUM2_MESSAGE(CSetChevButtonImageMsg, _value1, _value2); -NUM_MESSAGE(CSetChevClassBits, _value); -NUM_MESSAGE(CSetChevFloorBits, _value); -NUM_MESSAGE(CSetChevLiftBits, _value); -NUM2_MESSAGE(CSetChevPanelBitMsg, _value1, _value2); -NUM_MESSAGE(CSetChevPanelButtonsMsg, _value); -NUM_MESSAGE(CSetChevRoomBits, _value); -RAW_MESSAGE(CSetMusicControlsMsg); -SNUM_MESSAGE(CSetVarMsg, _varName, _value); -NUM2_MESSAGE_VAL(CSetVolumeMsg, _value1, _value2, 70, 0); -SNUM_MESSAGE(CShipSettingMsg, _strValue, _numValue); -STR_MESSAGE_VAL(CShowTextMsg, _value, "NO TEXT INCLUDED!!!"); -SNUM_MESSAGE(CSignalObject, _strValue, _numValue); -NUM2_MESSAGE(CSpeechFallsFromTreeMsg, _value1, _value2); -NUM_MESSAGE(CStartMusicMsg, _value); -NUM3_MESSAGE(CStatusChangeMsg, _value1, _value2, _value3); -NUM_MESSAGE(CStopMusicMsg, _value); -RAW_MESSAGE(CSubDeliverCCarryMsg); -RAW_MESSAGE(CSubSendCCarryMsg); -RAW_MESSAGE(CSUBTransition); -RAW_MESSAGE(CSubTurnOffMsg); -RAW_MESSAGE(CSubTurnOnMsg); -SNUM_MESSAGE(CSummonBotMsg, _strValue, _numValue); -STR_MESSAGE(CSummonBotQuerryMsg, _value); -STR_MESSAGE(CTakeHeadPieceMsg, _value); -STR2_MESSAGE(CTextInputMsg, _value1, _value2); -NUM_MESSAGE(CTimeDilationMsg, _value); -NUM_MESSAGE(CTimeMsg, _value); -RAW_MESSAGE(CTitleSequenceEndedMsg); -RAW_MESSAGE(CTransitMsg); -NUM_MESSAGE(CTriggerAutoMusicPlayerMsg, _value); -NUM_MESSAGE(CTriggerNPCEvent, _value); -NUM4_MESSAGE(CTrueTalkGetAnimSetMsg, _value1, _value2, _value3, _value4); -SNUM_MESSAGE(CTrueTalkGetAssetDetailsMsg, _strValue, _numValue); -NUM2_MESSAGE_VAL(CTrueTalkGetStateValueMsg, _value1, _value2, 0, -1000); -NUM2_MESSAGE(CTrueTalkNotifySpeechEndedMsg, _value1, _value2); -NUM3_MESSAGE(CTrueTalkNotifySpeechStartedMsg, _value1, _value2, _value); -NUM_MESSAGE(CTrueTalkQueueUpAnimSetMsg, _value); -RAW_MESSAGE(CTrueTalkSelfQueueAnimSetMsg); -NUM3_MESSAGE(CTrueTalkTriggerActionMsg, _value1, _value2, _value3); -RAW_MESSAGE(CTurnOff); -RAW_MESSAGE(CTurnOn); -NUM_MESSAGE(CUse, _value); -NUM_MESSAGE(CUseWithCharMsg, _value); -NUM_MESSAGE(CUseWithOtherMsg, _value); -NUM_MESSAGE(CVirtualKeyCharMsg, _value); -NUM2_MESSAGE_VAL(CVisibleMsg, _value1, _value2, 1, 0); +MESSAGE1(CActMsg, CString, value, nullptr); +MESSAGE1(CActivationmsg, CString, value, nullptr); +MESSAGE1(CAddHeadPieceMsg, CString, value, "NULL"); +MESSAGE1(CAnimateMaitreDMsg, int, value, 0); +MESSAGE1(CArboretumGateMsg, int, value, 0); +MESSAGE0(CArmPickedUpFromTableMsg); +MESSAGE0(CBodyInBilgeRoomMsg); +MESSAGE1(CBowlStateChange, int, value, 0); +MESSAGE2(CCarryObjectArrivedMsg, CString, strValue, nullptr, int, numValue, 0); +MESSAGE1(CChangeSeasonMsg, CString, season, "Summer"); +MESSAGE0(CCheckAllPossibleCodes); +MESSAGE2(CCheckChevCode, int, value1, 0, int, value2, 0); +MESSAGE1(CChildDragEndMsg, int, value, 0); +MESSAGE2(CChildDragMoveMsg, int, value1, 0, int, value2, 0); +MESSAGE2(CChildDragStartMsg, int, value1, 0, int, value2, 0); +MESSAGE0(CClearChevPanelBits); +MESSAGE0(CCorrectMusicPlayedMsg); +MESSAGE0(CCreateMusicPlayerMsg); +MESSAGE0(CCylinderHolderReadyMsg); +MESSAGE0(CDeactivationMsg); +MESSAGE1(CDeliverCCarryMsg, CString, value, nullptr); +MESSAGE0(CDisableMaitreDProdReceptor); +MESSAGE0(CDismissBotMsg); +MESSAGE0(CDoffNavHelmet); +MESSAGE0(CDonNavHelmet); +MESSAGE1(CDoorbotNeededInElevatorMsg, int, value, 0); +MESSAGE0(CDoorbotNeededInHomeMsg); +MESSAGE1(CDropobjectMsg, int, value, 0); +MESSAGE1(CDropZoneGotObjectMsg, int, value, 0); +MESSAGE1(CDropZoneLostObjectMsg, int, value, 0); +MESSAGE1(CEjectCylinderMsg, int, value, 0); +MESSAGE0(CErasePhonographCylinderMsg); +MESSAGE2(CFreshenCookieMsg, int, value1, 0, int, value2, 0); +MESSAGE1(CGetChevClassBits, int, value, 0); +MESSAGE1(CGetChevClassNum, int, value, 0); +MESSAGE2(CGetChevCodeFromRoomNameMsg, CString, strValue, nullptr, int, numValue, 0); +MESSAGE1(CGetChevFloorBits, int, value, 0); +MESSAGE1(CGetChevFloorNum, int, value, 0); +MESSAGE1(CGetChevLiftBits, int, value, 0); +MESSAGE1(CGetChevLiftNum, int, value, 0); +MESSAGE1(CGetChevRoomBits, int, value, 0); +MESSAGE1(CGetChevRoomNum, int, value, 0); +MESSAGE2(CHoseConnectedMsg, int, value1, 1, int, value2, 0); +MESSAGE0(CInitializeAnimMsg); +MESSAGE1(CIsEarBowlPuzzleDone, int, value, 0); +MESSAGE1(CIsParrotPresentMsg, int, value, 0); +MESSAGE1(CKeyCharMsg, int, value, 32); +MESSAGE2(CLemonFallsFromTreeMsg, int, value1, 0, int, value2, 0); +MESSAGE1(CLockPhonographMsg, int, value, 0); +MESSAGE0(CMaitreDDefeatedMsg); +MESSAGE0(CMaitreDHappyMsg); +MESSAGE1(CMissiveOMatActionMsg, int, value, 0); +MESSAGE0(CMoveToStartPosMsg); +MESSAGE2(CMovieEndMsg, int, value1, 0, int, value2, 0); +MESSAGE2(CMovieFrameMsg, int, value1, 0, int, value2, 0); +MESSAGE0(CMusicHasStartedMsg); +MESSAGE0(CMusicHasStoppedMsg); +MESSAGE0(CMusicSettingChangedMsg); +MESSAGE2(CNPCPlayAnimationMsg, int, value1, 0, int, value2, 0); +MESSAGE1(CNPCPlayIdleAnimationMsg, int, value, 0); +MESSAGE3(CNPCPlayTalkingAnimationMsg, int, value1, 0, int, value2, 0, int, value3, 0); +MESSAGE0(CNPCQueueIdleAnimMsg); +MESSAGE1(CNutPuzzleMsg, CString, value, nullptr); +MESSAGE1(COnSummonBotMsg, int, value, 0); +MESSAGE0(COpeningCreditsMsg); +MESSAGE1(CPanningAwayFromParrotMsg, int, value, 0); +MESSAGE2(CParrotSpeakMsg, CString, value1, nullptr, CString, value2, nullptr); +MESSAGE2(CParrotTriesChickenMsg, int, value1, 0, int, value2, 0); +MESSAGE4(CPassOnDragStartMsg, int, value1, 0, int, value2, 0, int, value3, 0, int, value4, 0); +MESSAGE1(CPhonographPlayMsg, int, value, 0); +MESSAGE0(CPhonographReadyToPlayMsg); +MESSAGE1(CPhonographRecordMsg, int, value, 0); +MESSAGE3(CPhonographStopMsg, int, value1, 0, int, value2, 0, int, value3, 0); +MESSAGE2(CPlayRangeMsg, int, value1, 0, int, value2, 0); +MESSAGE2(CPlayerTriesRestaurantTableMsg, int, value1, 0, int, value2, 0); +MESSAGE1(CPreSaveMsg, int, value, 0); +MESSAGE1(CProdMaitreDMsg, int, value, 0); +MESSAGE2(CPumpingMsg, int, value1, 0, int, value2, 0); +MESSAGE1(CPutBotBackInHisBoxMsg, int, value, 0); +MESSAGE1(CPutParrotBackMsg, int, value, 0); +MESSAGE0(CPuzzleSolvedMsg); +MESSAGE3(CQueryCylinderHolderMsg, int, value1, 0, int, value2, 0, int, value3, 0); +MESSAGE3(CQueryCylinderMsg, int, value1, 0, int, value2, 0, int, value3, 0); +MESSAGE3(CQueryCylinderNameMsg, int, value1, 0, int, value2, 0, int, value3, 0); +MESSAGE3(CQueryCylinderTypeMsg, int, value1, 0, int, value2, 0, int, value3, 0); +MESSAGE1(CQueryMusicControlSettingMsg, int, value, 0); +MESSAGE1(CQueryPhonographState, int, value, 0); +MESSAGE0(CRecordOntoCylinderMsg); +MESSAGE0(CRemoveFromGameMsg); +MESSAGE0(CReplaceBowlAndNutsMsg); +MESSAGE1(CRestaurantMusicChanged, CString, value, nullptr); +MESSAGE2(CSendCCarryMsg, CString, strValue, nullptr, int, numValue, 0); +MESSAGE1(CSenseWorkingMsg, CString, value, "Not Working"); +MESSAGE2(CServiceElevatorFloorChangeMsg, int, value1, 0, int, value2, 0); +MESSAGE0(CServiceElevatorFloorRequestMsg); +MESSAGE1(CServiceElevatorMsg, int, value, 4); +MESSAGE2(CSetChevButtonImageMsg, int, value1, 0, int, value2, 0); +MESSAGE1(CSetChevClassBits, int, value, 0); +MESSAGE1(CSetChevFloorBits, int, value, 0); +MESSAGE1(CSetChevLiftBits, int, value, 0); +MESSAGE2(CSetChevPanelBitMsg, int, value1, 0, int, value2, 0); +MESSAGE1(CSetChevPanelButtonsMsg, int, value, 0); +MESSAGE1(CSetChevRoomBits, int, value, 0); +MESSAGE0(CSetMusicControlsMsg); +MESSAGE2(CSetVarMsg, CString, varName, nullptr, int, value, 0); +MESSAGE2(CSetVolumeMsg, int, value1, 70, int, value2, 0); +MESSAGE2(CShipSettingMsg, CString, strValue, nullptr, int, numValue, 0); +MESSAGE1(CShowTextMsg, CString, value, "NO TEXT INCLUDED!!!"); +MESSAGE2(CSignalObject, CString, strValue, nullptr, int, numValue, 0); +MESSAGE2(CSpeechFallsFromTreeMsg, int, value1, 0, int, value2, 0); +MESSAGE1(CStartMusicMsg, int, value, 0); +MESSAGE3(CStatusChangeMsg, int, value1, 0, int, value2, 0, int, value3, 0); +MESSAGE1(CStopMusicMsg, int, value, 0); +MESSAGE0(CSubDeliverCCarryMsg); +MESSAGE0(CSubSendCCarryMsg); +MESSAGE0(CSUBTransition); +MESSAGE0(CSubTurnOffMsg); +MESSAGE0(CSubTurnOnMsg); +MESSAGE2(CSummonBotMsg, CString, strValue, nullptr, int, numValue, 0); +MESSAGE1(CSummonBotQuerryMsg, CString, value, nullptr); +MESSAGE1(CTakeHeadPieceMsg, CString, value, nullptr); +MESSAGE2(CTextInputMsg, CString, value1, nullptr, CString, value2, nullptr); +MESSAGE1(CTimeDilationMsg, int, value, 0); +MESSAGE1(CTimeMsg, int, value, 0); +MESSAGE0(CTitleSequenceEndedMsg); +MESSAGE0(CTransitMsg); +MESSAGE1(CTriggerAutoMusicPlayerMsg, int, value, 0); +MESSAGE1(CTriggerNPCEvent, int, value, 0); +MESSAGE4(CTrueTalkGetAnimSetMsg, int, value1, 0, int, value2, 0, int, value3, 0, int, value4, 0); +MESSAGE2(CTrueTalkGetAssetDetailsMsg, CString, strValue, nullptr, int, numValue, 0); +MESSAGE2(CTrueTalkGetStateValueMsg, int, value1, 0, int, value2, -1000); +MESSAGE2(CTrueTalkNotifySpeechEndedMsg, int, value1, 0, int, value2, 0); +MESSAGE3(CTrueTalkNotifySpeechStartedMsg, int, value1, 0, int, value2, 0, int, value, 0); +MESSAGE1(CTrueTalkQueueUpAnimSetMsg, int, value, 0); +MESSAGE0(CTrueTalkSelfQueueAnimSetMsg); +MESSAGE3(CTrueTalkTriggerActionMsg, int, value1, 0, int, value2, 0, int, value3, 0); +MESSAGE0(CTurnOff); +MESSAGE0(CTurnOn); +MESSAGE1(CUse, int, value, 0); +MESSAGE1(CUseWithCharMsg, int, value, 0); +MESSAGE1(CUseWithOtherMsg, int, value, 0); +MESSAGE1(CVirtualKeyCharMsg, int, value, 0); +MESSAGE2(CVisibleMsg, int, value1, 1, int, value2, 0); } // End of namespace Titanic diff --git a/engines/titanic/messages/mouse_messages.h b/engines/titanic/messages/mouse_messages.h index 6b466038db..d3a0566f3d 100644 --- a/engines/titanic/messages/mouse_messages.h +++ b/engines/titanic/messages/mouse_messages.h @@ -32,46 +32,46 @@ public: int _buttons; Common::Point _mousePos; public: + CLASSDEF CMouseMsg() : _buttons(0) {} - virtual const char *getClassName() const { return "CMouseMsg"; } }; class CMouseMoveMsg : public CMouseMsg { public: - virtual const char *getClassName() const { return "CMouseMoveMsg"; } + CLASSDEF }; class CMouseButtonMsg : public CMouseMsg { public: int _field10; public: + CLASSDEF CMouseButtonMsg() : CMouseMsg(), _field10(0) {} - virtual const char *getClassName() const { return "CMouseButtonMsg"; } }; class CMouseButtonDownMsg : public CMouseButtonMsg { public: - virtual const char *getClassName() const { return "CMouseButtonDownMsg"; } + CLASSDEF }; class CMouseButtonUpMsg : public CMouseButtonMsg { public: - virtual const char *getClassName() const { return "CMouseButtonUpMsg"; } + CLASSDEF }; class CMouseButtonDoubleClickMsg : public CMouseButtonMsg { public: - virtual const char *getClassName() const { return "CMouseButtonDoubleClickMsg"; } + CLASSDEF }; class CMouseDragMsg : public CMouseMsg { public: - virtual const char *getClassName() const { return "CMouseDragMsg"; } + CLASSDEF }; class CMouseDragMoveMsg : public CMouseDragMsg { public: - virtual const char *getClassName() const { return "CMouseDragMoveMsg"; } + CLASSDEF }; class CMouseDragStartMsg : public CMouseDragMsg { @@ -79,16 +79,16 @@ public: int _field10; int _field14; public: + CLASSDEF CMouseDragStartMsg() : CMouseDragMsg(), _field10(0), _field14(0) {} - virtual const char *getClassName() const { return "CMouseDragStartMsg"; } }; class CMouseDragEndMsg : public CMouseDragMsg { public: int _field10; public: + CLASSDEF CMouseDragEndMsg() : CMouseDragMsg(), _field10(0) {} - virtual const char *getClassName() const { return "CMouseDragEndMsg"; } }; } // End of namespace Titanic diff --git a/engines/titanic/messages/pet_messages.h b/engines/titanic/messages/pet_messages.h index 96e52eb61c..195bf8a0d2 100644 --- a/engines/titanic/messages/pet_messages.h +++ b/engines/titanic/messages/pet_messages.h @@ -27,20 +27,20 @@ namespace Titanic { -RAW_MESSAGE(CPETDeliverMsg); -RAW_MESSAGE(CPETGainedObjectMsg); -RAW_MESSAGE(CPETHelmetOnOffMsg); -RAW_MESSAGE(CPETKeyboardOnOffMsg); -RAW_MESSAGE(CPETLostObjectMsg); -RAW_MESSAGE(CPETObjectSelectedMsg); -NUM_MESSAGE(CPETObjectStateMsg, _value); -RAW_MESSAGE(CPETPhotoOnOffMsg); -NUM_MESSAGE(CPETPlaySoundMsg, _value); -RAW_MESSAGE(CPETReceiveMsg); -RAW_MESSAGE(CPETSetStarDestinationMsg); -NUM_MESSAGE(CPETStarFieldLockMsg, _value); -RAW_MESSAGE(CPETStereoFieldOnOffMsg); -SNUM_MESSAGE_VAL(CPETTargetMsg, _strValue, _numValue, (const char *)nullptr, -1); +MESSAGE0(CPETDeliverMsg); +MESSAGE0(CPETGainedObjectMsg); +MESSAGE0(CPETHelmetOnOffMsg); +MESSAGE0(CPETKeyboardOnOffMsg); +MESSAGE0(CPETLostObjectMsg); +MESSAGE0(CPETObjectSelectedMsg); +MESSAGE1(CPETObjectStateMsg, int, value, 0); +MESSAGE0(CPETPhotoOnOffMsg); +MESSAGE1(CPETPlaySoundMsg, int, value, 0); +MESSAGE0(CPETReceiveMsg); +MESSAGE0(CPETSetStarDestinationMsg); +MESSAGE1(CPETStarFieldLockMsg, int, value, 0); +MESSAGE0(CPETStereoFieldOnOffMsg); +MESSAGE2(CPETTargetMsg, CString, strValue, nullptr, int, numValue, -1); } // End of namespace Titanic diff --git a/engines/titanic/messages/service_elevator_door.h b/engines/titanic/messages/service_elevator_door.h index a3a8388405..ac5cf5148d 100644 --- a/engines/titanic/messages/service_elevator_door.h +++ b/engines/titanic/messages/service_elevator_door.h @@ -29,13 +29,9 @@ namespace Titanic { class CServiceElevatorDoor : public CDoorAutoSoundEvent { public: + CLASSDEF CServiceElevatorDoor(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CServiceElevatorDoor"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index b9f5b641ed..f1d39ec870 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -115,6 +115,7 @@ MODULE_OBJS := \ game/credits_button.o \ game/dead_area.o \ game/desk_click_responder.o \ + game/dome_from_top_of_well.o \ game/doorbot_elevator_handler.o \ game/doorbot_home_handler.o \ game/ear_sweet_bowl.o \ diff --git a/engines/titanic/moves/enter_bomb_room.h b/engines/titanic/moves/enter_bomb_room.h index fc4d1360ec..dabde2e308 100644 --- a/engines/titanic/moves/enter_bomb_room.h +++ b/engines/titanic/moves/enter_bomb_room.h @@ -31,13 +31,9 @@ class CEnterBombRoom : public CMovePlayerTo { protected: int _fieldC8; public: + CLASSDEF CEnterBombRoom(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CEnterBombRoom"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/moves/enter_bridge.h b/engines/titanic/moves/enter_bridge.h index bbc4cc96d0..6a6e7161dd 100644 --- a/engines/titanic/moves/enter_bridge.h +++ b/engines/titanic/moves/enter_bridge.h @@ -31,13 +31,9 @@ class CEnterBridge : public CGameObject { public: int _value; public: + CLASSDEF CEnterBridge() : CGameObject(), _value(1) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CEnterBridge"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/moves/enter_exit_first_class_state.h b/engines/titanic/moves/enter_exit_first_class_state.h index f7bc4c69f7..728395d20c 100644 --- a/engines/titanic/moves/enter_exit_first_class_state.h +++ b/engines/titanic/moves/enter_exit_first_class_state.h @@ -41,10 +41,7 @@ public: */ static void deinit(); public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBowlUnlocker"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/moves/enter_exit_mini_lift.h b/engines/titanic/moves/enter_exit_mini_lift.h index 417e25d13f..5a91d397f9 100644 --- a/engines/titanic/moves/enter_exit_mini_lift.h +++ b/engines/titanic/moves/enter_exit_mini_lift.h @@ -32,13 +32,9 @@ private: int _fieldBC; int _fieldC0; public: + CLASSDEF CEnterExitMiniLift() : CSGTNavigation(), _fieldBC(0), _fieldC0(1) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CEnterExitMiniLift"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/moves/enter_exit_sec_class_mini_lift.h b/engines/titanic/moves/enter_exit_sec_class_mini_lift.h index 364b2e3dc6..a1081c2836 100644 --- a/engines/titanic/moves/enter_exit_sec_class_mini_lift.h +++ b/engines/titanic/moves/enter_exit_sec_class_mini_lift.h @@ -39,14 +39,11 @@ private: static CEnterExitSecClassMiniLiftStatics *_statics; int _value; public: + CLASSDEF CEnterExitSecClassMiniLift() : CGameObject(), _value(0) {} static void init(); static void deinit(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CEnterExitSecClassMiniLift"; } - + /** * Save the data for the class to file */ diff --git a/engines/titanic/moves/enter_exit_view.h b/engines/titanic/moves/enter_exit_view.h index 05ed63da5c..e967723558 100644 --- a/engines/titanic/moves/enter_exit_view.h +++ b/engines/titanic/moves/enter_exit_view.h @@ -35,13 +35,9 @@ public: int _fieldC8; int _fieldCC; public: + CLASSDEF CEnterExitView(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CEnterExitView"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/moves/enter_sec_class_state.h b/engines/titanic/moves/enter_sec_class_state.h index 5da623dc08..2e80939976 100644 --- a/engines/titanic/moves/enter_sec_class_state.h +++ b/engines/titanic/moves/enter_sec_class_state.h @@ -31,13 +31,9 @@ class CEnterSecClassState : public CGameObject { public: int _value1, _value2; public: + CLASSDEF CEnterSecClassState() : CGameObject(), _value1(0), _value2(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CEnterSecClassState"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/moves/exit_arboretum.h b/engines/titanic/moves/exit_arboretum.h index 4e5815d284..0da67dd5a0 100644 --- a/engines/titanic/moves/exit_arboretum.h +++ b/engines/titanic/moves/exit_arboretum.h @@ -33,13 +33,9 @@ protected: int _fieldCC; int _fieldD0; public: + CLASSDEF CExitArboretum(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CExitArboretum"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/moves/exit_bridge.h b/engines/titanic/moves/exit_bridge.h index c85c1bcab7..9231728e12 100644 --- a/engines/titanic/moves/exit_bridge.h +++ b/engines/titanic/moves/exit_bridge.h @@ -31,13 +31,9 @@ class CExitBridge : public CMovePlayerTo { private: CString _string1; public: + CLASSDEF CExitBridge(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CExitBridge"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/moves/exit_lift.h b/engines/titanic/moves/exit_lift.h index 534de1b8ec..e97f041804 100644 --- a/engines/titanic/moves/exit_lift.h +++ b/engines/titanic/moves/exit_lift.h @@ -31,10 +31,7 @@ class CExitLift : public CGameObject { public: CString _value; public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CExitLift"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/moves/exit_pellerator.h b/engines/titanic/moves/exit_pellerator.h index 7df5657691..3ae70dbed8 100644 --- a/engines/titanic/moves/exit_pellerator.h +++ b/engines/titanic/moves/exit_pellerator.h @@ -37,14 +37,10 @@ class CExitPellerator : public CGameObject { private: static CExitPelleratorStatics *_statics; public: + CLASSDEF static void init(); static void deinit(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CExitPellerator"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/moves/exit_state_room.h b/engines/titanic/moves/exit_state_room.h index ecef4f1dc3..ccf52ce3f3 100644 --- a/engines/titanic/moves/exit_state_room.h +++ b/engines/titanic/moves/exit_state_room.h @@ -31,13 +31,9 @@ class CExitStateRoom : public CMovePlayerTo { protected: int _fieldC8; public: + CLASSDEF CExitStateRoom(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CExitStateRoom"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/moves/exit_tiania.h b/engines/titanic/moves/exit_tiania.h index 63e120fcf3..3af5aadc2e 100644 --- a/engines/titanic/moves/exit_tiania.h +++ b/engines/titanic/moves/exit_tiania.h @@ -34,13 +34,9 @@ private: CString _string2; CString _string3; public: + CLASSDEF CExitTiania(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CExitTiania"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/moves/move_player_in_parrot_room.h b/engines/titanic/moves/move_player_in_parrot_room.h index 91f8b993a6..5339a60a9c 100644 --- a/engines/titanic/moves/move_player_in_parrot_room.h +++ b/engines/titanic/moves/move_player_in_parrot_room.h @@ -29,13 +29,9 @@ namespace Titanic { class CMovePlayerInParrotRoom : public CMovePlayerTo { public: + CLASSDEF CMovePlayerInParrotRoom(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMovePlayerInParrotRoom"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/moves/move_player_to.h b/engines/titanic/moves/move_player_to.h index aa785b9167..2617b46097 100644 --- a/engines/titanic/moves/move_player_to.h +++ b/engines/titanic/moves/move_player_to.h @@ -31,13 +31,9 @@ class CMovePlayerTo : public CGameObject { protected: CString _destination; public: + CLASSDEF CMovePlayerTo(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMovePlayerTo"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/moves/move_player_to_from.h b/engines/titanic/moves/move_player_to_from.h index 82fe5db2ec..bc1878af38 100644 --- a/engines/titanic/moves/move_player_to_from.h +++ b/engines/titanic/moves/move_player_to_from.h @@ -31,13 +31,9 @@ class CMovePlayerToFrom : public CGameObject { private: CString _string2; public: + CLASSDEF CMovePlayerToFrom(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMovePlayerToFrom"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/moves/multi_move.h b/engines/titanic/moves/multi_move.h index 102b4b7473..a06632df52 100644 --- a/engines/titanic/moves/multi_move.h +++ b/engines/titanic/moves/multi_move.h @@ -35,13 +35,9 @@ private: CString _string4; CString _string5; public: + CLASSDEF CMultiMove(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMultiMove"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/moves/pan_from_pel.h b/engines/titanic/moves/pan_from_pel.h index 41f3fdb339..b94f5166d7 100644 --- a/engines/titanic/moves/pan_from_pel.h +++ b/engines/titanic/moves/pan_from_pel.h @@ -32,13 +32,9 @@ protected: int _fieldC8; CString _string1; public: + CLASSDEF CPanFromPel(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPanFromPel"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/moves/restaurant_pan_handler.h b/engines/titanic/moves/restaurant_pan_handler.h index d2db5843a8..29f7832b74 100644 --- a/engines/titanic/moves/restaurant_pan_handler.h +++ b/engines/titanic/moves/restaurant_pan_handler.h @@ -34,10 +34,7 @@ protected: CString _string1; CString _string2; public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CRestaurantPanHandler"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/moves/restricted_move.h b/engines/titanic/moves/restricted_move.h index 48ddefe9b8..ef95e0f5b5 100644 --- a/engines/titanic/moves/restricted_move.h +++ b/engines/titanic/moves/restricted_move.h @@ -31,13 +31,9 @@ class CRestrictedMove : public CMovePlayerTo { protected: int _fieldC8; public: + CLASSDEF CRestrictedMove(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CRestrictedMove"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/moves/scraliontis_table.h b/engines/titanic/moves/scraliontis_table.h index d7c2ad69ab..53b000646b 100644 --- a/engines/titanic/moves/scraliontis_table.h +++ b/engines/titanic/moves/scraliontis_table.h @@ -34,13 +34,9 @@ private: int _fieldE8; int _fieldEC; public: + CLASSDEF CScraliontisTable(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CScraliontisTable"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/moves/trip_down_canal.h b/engines/titanic/moves/trip_down_canal.h index 0a5f918fb2..80d5dcf706 100644 --- a/engines/titanic/moves/trip_down_canal.h +++ b/engines/titanic/moves/trip_down_canal.h @@ -29,13 +29,9 @@ namespace Titanic { class CTripDownCanal : public CMovePlayerTo { public: + CLASSDEF CTripDownCanal(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CTripDownCanal"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/npcs/barbot.h b/engines/titanic/npcs/barbot.h index d14d5a2d1d..7e2d323d46 100644 --- a/engines/titanic/npcs/barbot.h +++ b/engines/titanic/npcs/barbot.h @@ -173,13 +173,9 @@ private: int _field33C; int _field340; public: + CLASSDEF CBarbot(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBarbot"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/npcs/bellbot.h b/engines/titanic/npcs/bellbot.h index b47daa1404..c3d38f65ec 100644 --- a/engines/titanic/npcs/bellbot.h +++ b/engines/titanic/npcs/bellbot.h @@ -31,13 +31,9 @@ class CBellBot : public CTrueTalkNPC { private: int _field108; public: + CLASSDEF CBellBot(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBellBot"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/npcs/callbot.h b/engines/titanic/npcs/callbot.h index 2f9edd3734..299a329c07 100644 --- a/engines/titanic/npcs/callbot.h +++ b/engines/titanic/npcs/callbot.h @@ -32,13 +32,9 @@ protected: CString _string1; int _fieldC8; public: + CLASSDEF CCallBot(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CCallBot"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/npcs/character.h b/engines/titanic/npcs/character.h index 8e1e87eb95..2fb83e9288 100644 --- a/engines/titanic/npcs/character.h +++ b/engines/titanic/npcs/character.h @@ -34,13 +34,9 @@ protected: int _fieldC4; CString _charName; public: + CLASSDEF CCharacter(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CCharacter"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/npcs/deskbot.h b/engines/titanic/npcs/deskbot.h index 2826b01660..cb977e416d 100644 --- a/engines/titanic/npcs/deskbot.h +++ b/engines/titanic/npcs/deskbot.h @@ -35,13 +35,9 @@ private: int _field108; int _field10C; public: + CLASSDEF CDeskbot(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CDeskbot"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/npcs/doorbot.h b/engines/titanic/npcs/doorbot.h index e3ec7e83a4..f0c46e5a16 100644 --- a/engines/titanic/npcs/doorbot.h +++ b/engines/titanic/npcs/doorbot.h @@ -37,13 +37,9 @@ private: int _field110; int _field114; public: + CLASSDEF CDoorbot(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CDoorbot"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/npcs/liftbot.h b/engines/titanic/npcs/liftbot.h index f18fd7f32d..27556ed942 100644 --- a/engines/titanic/npcs/liftbot.h +++ b/engines/titanic/npcs/liftbot.h @@ -34,13 +34,9 @@ private: private: int _field108; public: + CLASSDEF CLiftBot(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CLiftBot"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/npcs/maitre_d.h b/engines/titanic/npcs/maitre_d.h index f44d6eeec0..bae682bc74 100644 --- a/engines/titanic/npcs/maitre_d.h +++ b/engines/titanic/npcs/maitre_d.h @@ -41,13 +41,9 @@ private: int _field134; int _field138; public: + CLASSDEF CMaitreD(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMaitreD"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/npcs/mobile.h b/engines/titanic/npcs/mobile.h index 9c74170ac0..512bb9fe9f 100644 --- a/engines/titanic/npcs/mobile.h +++ b/engines/titanic/npcs/mobile.h @@ -32,13 +32,9 @@ private: Common::Point _pos1; int _fieldDC; public: + CLASSDEF CMobile(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMobile"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/npcs/parrot.h b/engines/titanic/npcs/parrot.h index 991066e3b5..b69c8723d3 100644 --- a/engines/titanic/npcs/parrot.h +++ b/engines/titanic/npcs/parrot.h @@ -92,13 +92,9 @@ private: int _field1E8; int _field1EC; public: + CLASSDEF CParrot(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CParrot"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/npcs/robot_controller.h b/engines/titanic/npcs/robot_controller.h index 876285e70d..998453eb62 100644 --- a/engines/titanic/npcs/robot_controller.h +++ b/engines/titanic/npcs/robot_controller.h @@ -31,13 +31,9 @@ class CRobotController : public CGameObject { protected: CString _string1; public: + CLASSDEF CRobotController(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CRobotController"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/npcs/starlings.h b/engines/titanic/npcs/starlings.h index 472d0f58fb..f7b144273c 100644 --- a/engines/titanic/npcs/starlings.h +++ b/engines/titanic/npcs/starlings.h @@ -31,13 +31,9 @@ class CStarlings : public CCharacter { private: static int _v1; public: + CLASSDEF CStarlings(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CStarlings"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/npcs/succubus.h b/engines/titanic/npcs/succubus.h index 2e30b12ab5..e46592caa1 100644 --- a/engines/titanic/npcs/succubus.h +++ b/engines/titanic/npcs/succubus.h @@ -87,13 +87,9 @@ private: int _field1D4; int _field1D8; public: + CLASSDEF CSuccUBus(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSuccUBus"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/npcs/summon_bots.h b/engines/titanic/npcs/summon_bots.h index d525ff69f3..80aef73486 100644 --- a/engines/titanic/npcs/summon_bots.h +++ b/engines/titanic/npcs/summon_bots.h @@ -33,13 +33,9 @@ protected: int _fieldC8; int _fieldCC; public: + CLASSDEF CSummonBots(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSummonBots"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/npcs/titania.h b/engines/titanic/npcs/titania.h index ee61222be4..4c4c81267b 100644 --- a/engines/titanic/npcs/titania.h +++ b/engines/titanic/npcs/titania.h @@ -42,13 +42,9 @@ private: int _fieldFC; int _field100; public: + CLASSDEF CTitania(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CTitania"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/npcs/true_talk_npc.h b/engines/titanic/npcs/true_talk_npc.h index aed1ddb404..9546f18e0c 100644 --- a/engines/titanic/npcs/true_talk_npc.h +++ b/engines/titanic/npcs/true_talk_npc.h @@ -41,13 +41,9 @@ protected: int _field100; int _field104; public: + CLASSDEF CTrueTalkNPC(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CTrueTalkNPC"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 087ecd1d8f..0eb2034675 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -64,10 +64,7 @@ private: void saveSubObjects(SimpleFile *file, int indent) const; public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CPetControl"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/sound/auto_music_player.h b/engines/titanic/sound/auto_music_player.h index 11e46b0478..cec8117dd9 100644 --- a/engines/titanic/sound/auto_music_player.h +++ b/engines/titanic/sound/auto_music_player.h @@ -31,13 +31,9 @@ class CAutoMusicPlayer : public CAutoMusicPlayerBase { private: CString _string2; public: + CLASSDEF CAutoMusicPlayer(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CAutoMusicPlayer"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/sound/auto_music_player_base.h b/engines/titanic/sound/auto_music_player_base.h index 66ffabb61c..e762ef40b9 100644 --- a/engines/titanic/sound/auto_music_player_base.h +++ b/engines/titanic/sound/auto_music_player_base.h @@ -35,13 +35,9 @@ protected: int _fieldD0; int _fieldD4; public: + CLASSDEF CAutoMusicPlayerBase(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CAutoMusicPlayerBase"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/sound/auto_sound_player.h b/engines/titanic/sound/auto_sound_player.h index bc849341df..15f1325e06 100644 --- a/engines/titanic/sound/auto_sound_player.h +++ b/engines/titanic/sound/auto_sound_player.h @@ -40,13 +40,9 @@ public: int _fieldE4; int _fieldE8; public: + CLASSDEF CAutoSoundPlayer(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CAutoSoundPlayer"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/sound/auto_sound_player_adsr.h b/engines/titanic/sound/auto_sound_player_adsr.h index 9c2a082ba5..c88a861f9b 100644 --- a/engines/titanic/sound/auto_sound_player_adsr.h +++ b/engines/titanic/sound/auto_sound_player_adsr.h @@ -33,10 +33,7 @@ private: CString _string3; CString _string4; public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CAutoSoundPlayerADSR"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/sound/background_sound_maker.h b/engines/titanic/sound/background_sound_maker.h index 5a234ae048..68c1d7d1a9 100644 --- a/engines/titanic/sound/background_sound_maker.h +++ b/engines/titanic/sound/background_sound_maker.h @@ -31,13 +31,9 @@ class CBackgroundSoundMaker : public CGameObject { public: int _value; public: + CLASSDEF CBackgroundSoundMaker() : CGameObject(), _value(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBackgroundSoundMaker"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/sound/bird_song.h b/engines/titanic/sound/bird_song.h index 50c1f2b722..d932cfde7d 100644 --- a/engines/titanic/sound/bird_song.h +++ b/engines/titanic/sound/bird_song.h @@ -31,13 +31,9 @@ class CBirdSong : public CRoomAutoSoundPlayer { public: int _value; public: + CLASSDEF CBirdSong() : CRoomAutoSoundPlayer(), _value(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CBirdSong"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/sound/dome_from_top_of_well.h b/engines/titanic/sound/dome_from_top_of_well.h index faea805b1a..bb8ab6372a 100644 --- a/engines/titanic/sound/dome_from_top_of_well.h +++ b/engines/titanic/sound/dome_from_top_of_well.h @@ -29,10 +29,7 @@ namespace Titanic { class CDomeFromTopOfWell : public CViewAutoSoundPlayer { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CDomeFromTopOfWell"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/sound/enter_view_toggles_other_music.h b/engines/titanic/sound/enter_view_toggles_other_music.h index 3e7976e877..991a6ad2bc 100644 --- a/engines/titanic/sound/enter_view_toggles_other_music.h +++ b/engines/titanic/sound/enter_view_toggles_other_music.h @@ -31,13 +31,9 @@ class CEnterViewTogglesOtherMusic : public CTriggerAutoMusicPlayer { protected: int _fieldC8; public: + CLASSDEF CEnterViewTogglesOtherMusic(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CEnterViewTogglesOtherMusic"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/sound/gondolier_song.h b/engines/titanic/sound/gondolier_song.h index 38f7e867f8..6377279c04 100644 --- a/engines/titanic/sound/gondolier_song.h +++ b/engines/titanic/sound/gondolier_song.h @@ -31,13 +31,9 @@ class CGondolierSong : public CRoomAutoSoundPlayer { public: int _value; public: + CLASSDEF CGondolierSong() : CRoomAutoSoundPlayer(), _value(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CGondolierSong"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/sound/music_player.h b/engines/titanic/sound/music_player.h index 19539c89f7..0a750cc538 100644 --- a/engines/titanic/sound/music_player.h +++ b/engines/titanic/sound/music_player.h @@ -34,14 +34,10 @@ public: int _fieldCC; int _fieldD0; public: + CLASSDEF CMusicPlayer() : CGameObject(), _fieldBC(0), _fieldCC(0), _fieldD0(100) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CMusicPlayer"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/sound/node_auto_sound_player.h b/engines/titanic/sound/node_auto_sound_player.h index 5f4b70b93d..6fc56098f8 100644 --- a/engines/titanic/sound/node_auto_sound_player.h +++ b/engines/titanic/sound/node_auto_sound_player.h @@ -31,13 +31,9 @@ class CNodeAutoSoundPlayer : public CAutoSoundPlayer { private: int _fieldEC; public: + CLASSDEF CNodeAutoSoundPlayer() : CAutoSoundPlayer(), _fieldEC(1) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CViewAutoSoundPlayer"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/sound/restricted_auto_music_player.h b/engines/titanic/sound/restricted_auto_music_player.h index ab8e26e9da..cb6220cbc7 100644 --- a/engines/titanic/sound/restricted_auto_music_player.h +++ b/engines/titanic/sound/restricted_auto_music_player.h @@ -34,10 +34,7 @@ private: CString _string5; CString _string6; public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CRestrictedAutoMusicPlayer"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/sound/room_auto_sound_player.h b/engines/titanic/sound/room_auto_sound_player.h index 719eddcb84..ebee0165f6 100644 --- a/engines/titanic/sound/room_auto_sound_player.h +++ b/engines/titanic/sound/room_auto_sound_player.h @@ -29,10 +29,7 @@ namespace Titanic { class CRoomAutoSoundPlayer : public CAutoSoundPlayer { public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CRoomAutoSoundPlayer"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/sound/season_noises.h b/engines/titanic/sound/season_noises.h index def709c536..7746c164e8 100644 --- a/engines/titanic/sound/season_noises.h +++ b/engines/titanic/sound/season_noises.h @@ -35,13 +35,9 @@ private: CString _string4; CString _string5; public: + CLASSDEF CSeasonNoises(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSeasonNoises"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/sound/seasonal_music_player.h b/engines/titanic/sound/seasonal_music_player.h index fe3a60be9d..da19e1f0b0 100644 --- a/engines/titanic/sound/seasonal_music_player.h +++ b/engines/titanic/sound/seasonal_music_player.h @@ -38,13 +38,9 @@ private: int _fieldF0; int _fieldF4; public: + CLASSDEF CSeasonalMusicPlayer(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CSeasonalMusicPlayer"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/sound/titania_speech.h b/engines/titanic/sound/titania_speech.h index a81544a903..fc55c20af5 100644 --- a/engines/titanic/sound/titania_speech.h +++ b/engines/titanic/sound/titania_speech.h @@ -31,13 +31,9 @@ class CTitaniaSpeech : public CGameObject { public: int _value1, _value2; public: + CLASSDEF CTitaniaSpeech() : CGameObject(), _value1(1), _value2(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CTitaniaSpeech"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/sound/trigger_auto_music_player.h b/engines/titanic/sound/trigger_auto_music_player.h index 8f7a42c5c2..6387236181 100644 --- a/engines/titanic/sound/trigger_auto_music_player.h +++ b/engines/titanic/sound/trigger_auto_music_player.h @@ -31,10 +31,7 @@ class CTriggerAutoMusicPlayer : public CGameObject { protected: CString _fieldBC; public: - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CTriggerAutoMusicPlayer"; } + CLASSDEF /** * Save the data for the class to file diff --git a/engines/titanic/sound/view_auto_sound_player.h b/engines/titanic/sound/view_auto_sound_player.h index 9e87d74d8d..60de391ecb 100644 --- a/engines/titanic/sound/view_auto_sound_player.h +++ b/engines/titanic/sound/view_auto_sound_player.h @@ -31,13 +31,9 @@ class CViewAutoSoundPlayer : public CAutoSoundPlayer { private: int _fieldEC; public: + CLASSDEF CViewAutoSoundPlayer() : CAutoSoundPlayer(), _fieldEC(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CViewAutoSoundPlayer"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/sound/view_toggles_other_music.h b/engines/titanic/sound/view_toggles_other_music.h index e0da2437cc..68fa47b2be 100644 --- a/engines/titanic/sound/view_toggles_other_music.h +++ b/engines/titanic/sound/view_toggles_other_music.h @@ -31,13 +31,9 @@ class CViewTogglesOtherMusic : public CEnterViewTogglesOtherMusic { private: int _fieldCC; public: + CLASSDEF CViewTogglesOtherMusic(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CViewTogglesOtherMusic"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/sound/water_lapping_sounds.h b/engines/titanic/sound/water_lapping_sounds.h index 3dd72b5250..0d885bedd4 100644 --- a/engines/titanic/sound/water_lapping_sounds.h +++ b/engines/titanic/sound/water_lapping_sounds.h @@ -31,13 +31,9 @@ class CWaterLappingSounds : public CRoomAutoSoundPlayer { public: int _value; public: + CLASSDEF CWaterLappingSounds() : CRoomAutoSoundPlayer(), _value(0) {} - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CWaterLappingSounds"; } - /** * Save the data for the class to file */ diff --git a/engines/titanic/star_control/star_control.h b/engines/titanic/star_control/star_control.h index 2a24e517fc..9462cee559 100644 --- a/engines/titanic/star_control/star_control.h +++ b/engines/titanic/star_control/star_control.h @@ -40,13 +40,9 @@ private: int _field80AC; int _field80B0; public: + CLASSDEF CStarControl(); - /** - * Return the class name - */ - virtual const char *getClassName() const { return "CStarControl"; } - /** * Save the data for the class to file */ -- cgit v1.2.3 From dd5c119f322b8d6462bb5b7a3028d1536c7c3214 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 6 Mar 2016 19:57:01 -0500 Subject: TITANIC: gcc compilation fixes --- engines/titanic/core/saveable_object.cpp | 16 ++++++++--- engines/titanic/core/saveable_object.h | 1 + engines/titanic/messages/messages.h | 34 +++++++++++------------ engines/titanic/messages/pet_messages.h | 2 +- engines/titanic/module.mk | 1 - engines/titanic/pet_control/pet_control_sub10.h | 1 + engines/titanic/star_control/star_control_sub11.h | 4 +-- engines/titanic/star_control/star_control_sub12.h | 5 ++-- engines/titanic/star_control/star_control_sub8.h | 4 +-- 9 files changed, 39 insertions(+), 29 deletions(-) diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 1b56d1b85f..943715b8f8 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -412,8 +412,8 @@ Common::List *CSaveableObject::_classDefs; #define DEFFN(T) ClassDef *T::_type; \ CSaveableObject *Function##T() { return new T(); } -#define ADDFN(CHILD, PARENT) (*_classList)[#CHILD] = Function##CHILD; \ - ##CHILD::_type = new TypeTemplate(#CHILD, nullptr) +#define ADDFN(CHILD, PARENT) CHILD::_type = new TypeTemplate(#CHILD, nullptr); \ + (*_classList)[#CHILD] = Function##CHILD DEFFN(CArm) DEFFN(CAuditoryCentre) @@ -459,6 +459,7 @@ DEFFN(CClickResponder) DEFFN(CDontSaveFileItem) DEFFN(CDropTarget) DEFFN(CFileItem) +DEFFN(CFileList) DEFFN(CFileListItem) DEFFN(CGameObject) DEFFN(CLinkItem) @@ -470,6 +471,7 @@ DEFFN(CMultiDropTarget) DEFFN(CNamedItem) DEFFN(CNodeItem) DEFFN(CProjectItem) +DEFFN(CResourceKey) DEFFN(CSaveableObject) DEFFN(CStaticImage) DEFFN(CTurnOnObject) @@ -555,7 +557,7 @@ DEFFN(CLongStickDispenser) DEFFN(CMailMan) DEFFN(CMissiveOMat) DEFFN(CMissiveOMatButton) -DEFFN(CMovieTester); +DEFFN(CMovieTester) DEFFN(CMusicalInstrument) DEFFN(CMusicConsoleButton) DEFFN(CMusicRoomPhonograph) @@ -632,6 +634,7 @@ DEFFN(CPETClass1) DEFFN(CPETClass2) DEFFN(CPETClass3) DEFFN(CPetControl) +DEFFN(CPetControlSub10) DEFFN(CPetDragChev) DEFFN(CPetGraphic) DEFFN(CPetGraphic2) @@ -793,6 +796,7 @@ DEFFN(CLightsMsg) DEFFN(CLockPhonographMsg) DEFFN(CMaitreDDefeatedMsg) DEFFN(CMaitreDHappyMsg) +DEFFN(CMessage) DEFFN(CMissiveOMatActionMsg) DEFFN(CMouseMsg) DEFFN(CMouseMoveMsg) @@ -972,7 +976,7 @@ DEFFN(CTriggerAutoMusicPlayer) DEFFN(CViewAutoSoundPlayer) DEFFN(CViewTogglesOtherMusic) DEFFN(CWaterLappingSounds) -DEFFN(CStarControl); +DEFFN(CStarControl) void CSaveableObject::initClassList() { _classDefs = new Common::List(); @@ -1021,6 +1025,7 @@ void CSaveableObject::initClassList() { ADDFN(CDontSaveFileItem, CFileItem); ADDFN(CDropTarget, CGameObject); ADDFN(CFileItem, CTreeItem); + ADDFN(CFileList, List); ADDFN(CFileListItem, ListItem); ADDFN(CGameObject, CNamedItem); ADDFN(CLinkItem, CNamedItem); @@ -1032,6 +1037,7 @@ void CSaveableObject::initClassList() { ADDFN(CNamedItem, CTreeItem); ADDFN(CNodeItem, CNamedItem); ADDFN(CProjectItem, CFileItem); + ADDFN(CResourceKey, CSaveableObject); ADDFN(CSaveableObject, CSaveableObject); ADDFN(CStaticImage, CGameObject); ADDFN(CTurnOnObject, CBackground); @@ -1272,6 +1278,7 @@ void CSaveableObject::initClassList() { ADDFN(CMusicSwitchReverse, CMusicSwitch); ADDFN(CMusicVoiceMute, CMusicControl); ADDFN(CPetControl, CGameObject); + ADDFN(CPetControlSub10, List); ADDFN(CPetDragChev, CPetGraphic2); ADDFN(CPetGraphic, CGameObject); ADDFN(CPetGraphic2, CGameObject); @@ -1356,6 +1363,7 @@ void CSaveableObject::initClassList() { ADDFN(CLockPhonographMsg, CMessage); ADDFN(CMaitreDDefeatedMsg, CMessage); ADDFN(CMaitreDHappyMsg, CMessage); + ADDFN(CMessage, CSaveableObject); ADDFN(CMissiveOMatActionMsg, CMessage); ADDFN(CMouseMsg, CMessage); ADDFN(CMouseMoveMsg, CMouseMsg); diff --git a/engines/titanic/core/saveable_object.h b/engines/titanic/core/saveable_object.h index 8368c71d3f..32b277f53b 100644 --- a/engines/titanic/core/saveable_object.h +++ b/engines/titanic/core/saveable_object.h @@ -39,6 +39,7 @@ public: public: ClassDef(const char *className, ClassDef *parent) : _className(className), _parent(parent) {} + virtual ~ClassDef() {} virtual CSaveableObject *create(); }; diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index c11d688985..5e6e0d7939 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -136,15 +136,15 @@ public: CLASSDEF \ } -MESSAGE1(CActMsg, CString, value, nullptr); -MESSAGE1(CActivationmsg, CString, value, nullptr); +MESSAGE1(CActMsg, CString, value, ""); +MESSAGE1(CActivationmsg, CString, value, ""); MESSAGE1(CAddHeadPieceMsg, CString, value, "NULL"); MESSAGE1(CAnimateMaitreDMsg, int, value, 0); MESSAGE1(CArboretumGateMsg, int, value, 0); MESSAGE0(CArmPickedUpFromTableMsg); MESSAGE0(CBodyInBilgeRoomMsg); MESSAGE1(CBowlStateChange, int, value, 0); -MESSAGE2(CCarryObjectArrivedMsg, CString, strValue, nullptr, int, numValue, 0); +MESSAGE2(CCarryObjectArrivedMsg, CString, strValue, "", int, numValue, 0); MESSAGE1(CChangeSeasonMsg, CString, season, "Summer"); MESSAGE0(CCheckAllPossibleCodes); MESSAGE2(CCheckChevCode, int, value1, 0, int, value2, 0); @@ -156,7 +156,7 @@ MESSAGE0(CCorrectMusicPlayedMsg); MESSAGE0(CCreateMusicPlayerMsg); MESSAGE0(CCylinderHolderReadyMsg); MESSAGE0(CDeactivationMsg); -MESSAGE1(CDeliverCCarryMsg, CString, value, nullptr); +MESSAGE1(CDeliverCCarryMsg, CString, value, ""); MESSAGE0(CDisableMaitreDProdReceptor); MESSAGE0(CDismissBotMsg); MESSAGE0(CDoffNavHelmet); @@ -171,7 +171,7 @@ MESSAGE0(CErasePhonographCylinderMsg); MESSAGE2(CFreshenCookieMsg, int, value1, 0, int, value2, 0); MESSAGE1(CGetChevClassBits, int, value, 0); MESSAGE1(CGetChevClassNum, int, value, 0); -MESSAGE2(CGetChevCodeFromRoomNameMsg, CString, strValue, nullptr, int, numValue, 0); +MESSAGE2(CGetChevCodeFromRoomNameMsg, CString, strValue, "", int, numValue, 0); MESSAGE1(CGetChevFloorBits, int, value, 0); MESSAGE1(CGetChevFloorNum, int, value, 0); MESSAGE1(CGetChevLiftBits, int, value, 0); @@ -198,11 +198,11 @@ MESSAGE2(CNPCPlayAnimationMsg, int, value1, 0, int, value2, 0); MESSAGE1(CNPCPlayIdleAnimationMsg, int, value, 0); MESSAGE3(CNPCPlayTalkingAnimationMsg, int, value1, 0, int, value2, 0, int, value3, 0); MESSAGE0(CNPCQueueIdleAnimMsg); -MESSAGE1(CNutPuzzleMsg, CString, value, nullptr); +MESSAGE1(CNutPuzzleMsg, CString, value, ""); MESSAGE1(COnSummonBotMsg, int, value, 0); MESSAGE0(COpeningCreditsMsg); MESSAGE1(CPanningAwayFromParrotMsg, int, value, 0); -MESSAGE2(CParrotSpeakMsg, CString, value1, nullptr, CString, value2, nullptr); +MESSAGE2(CParrotSpeakMsg, CString, value1, "", CString, value2, ""); MESSAGE2(CParrotTriesChickenMsg, int, value1, 0, int, value2, 0); MESSAGE4(CPassOnDragStartMsg, int, value1, 0, int, value2, 0, int, value3, 0, int, value4, 0); MESSAGE1(CPhonographPlayMsg, int, value, 0); @@ -226,8 +226,8 @@ MESSAGE1(CQueryPhonographState, int, value, 0); MESSAGE0(CRecordOntoCylinderMsg); MESSAGE0(CRemoveFromGameMsg); MESSAGE0(CReplaceBowlAndNutsMsg); -MESSAGE1(CRestaurantMusicChanged, CString, value, nullptr); -MESSAGE2(CSendCCarryMsg, CString, strValue, nullptr, int, numValue, 0); +MESSAGE1(CRestaurantMusicChanged, CString, value, ""); +MESSAGE2(CSendCCarryMsg, CString, strValue, "", int, numValue, 0); MESSAGE1(CSenseWorkingMsg, CString, value, "Not Working"); MESSAGE2(CServiceElevatorFloorChangeMsg, int, value1, 0, int, value2, 0); MESSAGE0(CServiceElevatorFloorRequestMsg); @@ -240,11 +240,11 @@ MESSAGE2(CSetChevPanelBitMsg, int, value1, 0, int, value2, 0); MESSAGE1(CSetChevPanelButtonsMsg, int, value, 0); MESSAGE1(CSetChevRoomBits, int, value, 0); MESSAGE0(CSetMusicControlsMsg); -MESSAGE2(CSetVarMsg, CString, varName, nullptr, int, value, 0); +MESSAGE2(CSetVarMsg, CString, varName, "", int, value, 0); MESSAGE2(CSetVolumeMsg, int, value1, 70, int, value2, 0); -MESSAGE2(CShipSettingMsg, CString, strValue, nullptr, int, numValue, 0); +MESSAGE2(CShipSettingMsg, CString, strValue, "", int, numValue, 0); MESSAGE1(CShowTextMsg, CString, value, "NO TEXT INCLUDED!!!"); -MESSAGE2(CSignalObject, CString, strValue, nullptr, int, numValue, 0); +MESSAGE2(CSignalObject, CString, strValue, "", int, numValue, 0); MESSAGE2(CSpeechFallsFromTreeMsg, int, value1, 0, int, value2, 0); MESSAGE1(CStartMusicMsg, int, value, 0); MESSAGE3(CStatusChangeMsg, int, value1, 0, int, value2, 0, int, value3, 0); @@ -254,10 +254,10 @@ MESSAGE0(CSubSendCCarryMsg); MESSAGE0(CSUBTransition); MESSAGE0(CSubTurnOffMsg); MESSAGE0(CSubTurnOnMsg); -MESSAGE2(CSummonBotMsg, CString, strValue, nullptr, int, numValue, 0); -MESSAGE1(CSummonBotQuerryMsg, CString, value, nullptr); -MESSAGE1(CTakeHeadPieceMsg, CString, value, nullptr); -MESSAGE2(CTextInputMsg, CString, value1, nullptr, CString, value2, nullptr); +MESSAGE2(CSummonBotMsg, CString, strValue, "", int, numValue, 0); +MESSAGE1(CSummonBotQuerryMsg, CString, value, ""); +MESSAGE1(CTakeHeadPieceMsg, CString, value, ""); +MESSAGE2(CTextInputMsg, CString, value1, "", CString, value2, ""); MESSAGE1(CTimeDilationMsg, int, value, 0); MESSAGE1(CTimeMsg, int, value, 0); MESSAGE0(CTitleSequenceEndedMsg); @@ -265,7 +265,7 @@ MESSAGE0(CTransitMsg); MESSAGE1(CTriggerAutoMusicPlayerMsg, int, value, 0); MESSAGE1(CTriggerNPCEvent, int, value, 0); MESSAGE4(CTrueTalkGetAnimSetMsg, int, value1, 0, int, value2, 0, int, value3, 0, int, value4, 0); -MESSAGE2(CTrueTalkGetAssetDetailsMsg, CString, strValue, nullptr, int, numValue, 0); +MESSAGE2(CTrueTalkGetAssetDetailsMsg, CString, strValue, "", int, numValue, 0); MESSAGE2(CTrueTalkGetStateValueMsg, int, value1, 0, int, value2, -1000); MESSAGE2(CTrueTalkNotifySpeechEndedMsg, int, value1, 0, int, value2, 0); MESSAGE3(CTrueTalkNotifySpeechStartedMsg, int, value1, 0, int, value2, 0, int, value, 0); diff --git a/engines/titanic/messages/pet_messages.h b/engines/titanic/messages/pet_messages.h index 195bf8a0d2..ac9c3ccc75 100644 --- a/engines/titanic/messages/pet_messages.h +++ b/engines/titanic/messages/pet_messages.h @@ -40,7 +40,7 @@ MESSAGE0(CPETReceiveMsg); MESSAGE0(CPETSetStarDestinationMsg); MESSAGE1(CPETStarFieldLockMsg, int, value, 0); MESSAGE0(CPETStereoFieldOnOffMsg); -MESSAGE2(CPETTargetMsg, CString, strValue, nullptr, int, numValue, -1); +MESSAGE2(CPETTargetMsg, CString, strValue, "", int, numValue, -1); } // End of namespace Titanic diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index f1d39ec870..b9f5b641ed 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -115,7 +115,6 @@ MODULE_OBJS := \ game/credits_button.o \ game/dead_area.o \ game/desk_click_responder.o \ - game/dome_from_top_of_well.o \ game/doorbot_elevator_handler.o \ game/doorbot_home_handler.o \ game/ear_sweet_bowl.o \ diff --git a/engines/titanic/pet_control/pet_control_sub10.h b/engines/titanic/pet_control/pet_control_sub10.h index f8534d7089..e532f9c116 100644 --- a/engines/titanic/pet_control/pet_control_sub10.h +++ b/engines/titanic/pet_control/pet_control_sub10.h @@ -41,6 +41,7 @@ protected: CPetVal _val2; CPetVal _val3; public: + CLASSDEF CPetControlSub10(); virtual void proc8(); diff --git a/engines/titanic/star_control/star_control_sub11.h b/engines/titanic/star_control/star_control_sub11.h index 6e47f85807..6b6807049f 100644 --- a/engines/titanic/star_control/star_control_sub11.h +++ b/engines/titanic/star_control/star_control_sub11.h @@ -50,12 +50,12 @@ public: /** * Load the data for the class from file */ - virtual void load(SimpleFile *file, int param); + void load(SimpleFile *file, int param); /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + void save(SimpleFile *file, int indent) const; }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub12.h b/engines/titanic/star_control/star_control_sub12.h index 92192ec74b..6bfc4158b4 100644 --- a/engines/titanic/star_control/star_control_sub12.h +++ b/engines/titanic/star_control/star_control_sub12.h @@ -44,18 +44,19 @@ private: int _field21C; public: CStarControlSub12(void *val1, void *val2); + virtual ~CStarControlSub12() {} virtual void proc3() {} /** * Load the data for the class from file */ - virtual void load(SimpleFile *file, int param); + void load(SimpleFile *file, int param); /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + void save(SimpleFile *file, int indent) const; }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub8.h b/engines/titanic/star_control/star_control_sub8.h index c4b677c2ba..da95f89af9 100644 --- a/engines/titanic/star_control/star_control_sub8.h +++ b/engines/titanic/star_control/star_control_sub8.h @@ -46,12 +46,12 @@ public: /** * Load the data for the class from file */ - virtual void load(SimpleFile *file) {} + void load(SimpleFile *file) {} /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const {} + void save(SimpleFile *file, int indent) const {} }; } // End of namespace Titanic -- cgit v1.2.3 From 2395e5601ca09c001ba5cff7c67a0dd70019f789 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 6 Mar 2016 20:23:35 -0500 Subject: TITANIC: Further gcc compilation fixes --- engines/titanic/core/list.h | 2 -- engines/titanic/core/movie_clip.h | 1 - engines/titanic/core/project_item.h | 1 - engines/titanic/core/saveable_object.cpp | 6 ------ engines/titanic/pet_control/pet_control_sub10.h | 1 - 5 files changed, 11 deletions(-) diff --git a/engines/titanic/core/list.h b/engines/titanic/core/list.h index a37bca3db2..312405dca9 100644 --- a/engines/titanic/core/list.h +++ b/engines/titanic/core/list.h @@ -51,8 +51,6 @@ public: template class List : public CSaveableObject, public Common::List { public: - CLASSDEF - /** * Save the data for the class to file */ diff --git a/engines/titanic/core/movie_clip.h b/engines/titanic/core/movie_clip.h index 3db24debb6..cd6125d438 100644 --- a/engines/titanic/core/movie_clip.h +++ b/engines/titanic/core/movie_clip.h @@ -62,7 +62,6 @@ public: */ class CMovieClipList: public List { public: - CLASSDEF }; } // End of namespace Titanic diff --git a/engines/titanic/core/project_item.h b/engines/titanic/core/project_item.h index f454392383..81b1869a6b 100644 --- a/engines/titanic/core/project_item.h +++ b/engines/titanic/core/project_item.h @@ -59,7 +59,6 @@ public: */ class CFileList: public List { public: - CLASSDEF }; diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 943715b8f8..e831cca8b0 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -459,14 +459,12 @@ DEFFN(CClickResponder) DEFFN(CDontSaveFileItem) DEFFN(CDropTarget) DEFFN(CFileItem) -DEFFN(CFileList) DEFFN(CFileListItem) DEFFN(CGameObject) DEFFN(CLinkItem) DEFFN(ListItem) DEFFN(CMessageTarget) DEFFN(CMovieClip) -DEFFN(CMovieClipList) DEFFN(CMultiDropTarget) DEFFN(CNamedItem) DEFFN(CNodeItem) @@ -634,7 +632,6 @@ DEFFN(CPETClass1) DEFFN(CPETClass2) DEFFN(CPETClass3) DEFFN(CPetControl) -DEFFN(CPetControlSub10) DEFFN(CPetDragChev) DEFFN(CPetGraphic) DEFFN(CPetGraphic2) @@ -1025,14 +1022,12 @@ void CSaveableObject::initClassList() { ADDFN(CDontSaveFileItem, CFileItem); ADDFN(CDropTarget, CGameObject); ADDFN(CFileItem, CTreeItem); - ADDFN(CFileList, List); ADDFN(CFileListItem, ListItem); ADDFN(CGameObject, CNamedItem); ADDFN(CLinkItem, CNamedItem); ADDFN(ListItem, CSaveableObject); ADDFN(CMessageTarget, CSaveableObject); ADDFN(CMovieClip, ListItem); - ADDFN(CMovieClipList, List); ADDFN(CMultiDropTarget, CDropTarget); ADDFN(CNamedItem, CTreeItem); ADDFN(CNodeItem, CNamedItem); @@ -1278,7 +1273,6 @@ void CSaveableObject::initClassList() { ADDFN(CMusicSwitchReverse, CMusicSwitch); ADDFN(CMusicVoiceMute, CMusicControl); ADDFN(CPetControl, CGameObject); - ADDFN(CPetControlSub10, List); ADDFN(CPetDragChev, CPetGraphic2); ADDFN(CPetGraphic, CGameObject); ADDFN(CPetGraphic2, CGameObject); diff --git a/engines/titanic/pet_control/pet_control_sub10.h b/engines/titanic/pet_control/pet_control_sub10.h index e532f9c116..f8534d7089 100644 --- a/engines/titanic/pet_control/pet_control_sub10.h +++ b/engines/titanic/pet_control/pet_control_sub10.h @@ -41,7 +41,6 @@ protected: CPetVal _val2; CPetVal _val3; public: - CLASSDEF CPetControlSub10(); virtual void proc8(); -- cgit v1.2.3 From fbcd4de457cfa18d121158e6be45ade57a3428f1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 6 Mar 2016 22:57:45 -0500 Subject: TITANIC: Overall message handling method --- engines/titanic/core/saveable_object.cpp | 17 ++++++++++++++--- engines/titanic/core/saveable_object.h | 2 ++ engines/titanic/core/tree_item.cpp | 17 +++++++++++++++++ engines/titanic/core/tree_item.h | 2 ++ engines/titanic/messages/messages.cpp | 29 +++++++++++++++++++++++++++++ engines/titanic/messages/messages.h | 8 ++++++++ 6 files changed, 72 insertions(+), 3 deletions(-) diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index e831cca8b0..7ec4f949f2 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -406,6 +406,12 @@ namespace Titanic { +CSaveableObject *ClassDef::create() { + return new CSaveableObject(); +} + +/*------------------------------------------------------------------------*/ + Common::HashMap * CSaveableObject::_classList = nullptr; Common::List *CSaveableObject::_classDefs; @@ -1573,10 +1579,15 @@ void CSaveableObject::saveFooter(SimpleFile *file, int indent) const { file->writeClassEnd(indent); } -/*------------------------------------------------------------------------*/ +bool CSaveableObject::isInstanceOf(const ClassDef &classDef) { + for (ClassDef *def = getType(); def != nullptr; def = def->_parent) { + if (def == &classDef) + return true; + } -CSaveableObject *ClassDef::create() { - return new CSaveableObject(); + return false; } + + } // End of namespace Titanic diff --git a/engines/titanic/core/saveable_object.h b/engines/titanic/core/saveable_object.h index 32b277f53b..b15dd13072 100644 --- a/engines/titanic/core/saveable_object.h +++ b/engines/titanic/core/saveable_object.h @@ -79,6 +79,8 @@ public: CLASSDEF virtual ~CSaveableObject() {} + bool isInstanceOf(const ClassDef &classDef); + /** * Save the data for the class to file */ diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index 8c9080fd84..ee89a0532e 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -70,6 +70,23 @@ CTreeItem *CTreeItem::getLastChild() { return _firstChild->getLastSibling(); } +CTreeItem *CTreeItem::scan(CTreeItem *item) { + if (_firstChild) + return _firstChild; + + CTreeItem *treeItem = this; + while (treeItem != item) { + if (treeItem->_nextSibling) + return treeItem->_nextSibling; + + treeItem = treeItem->_parent; + if (!treeItem) + break; + } + + return nullptr; +} + CDontSaveFileItem *CTreeItem::getDontSaveFileItem() { CTreeItem *item = getFirstChild(); while (item) { diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index 78a58fa735..eed30a3ecb 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -96,6 +96,8 @@ public: */ CTreeItem *getLastChild(); + CTreeItem *scan(CTreeItem *item); + /** * Get any dont save file item in the immediate children */ diff --git a/engines/titanic/messages/messages.cpp b/engines/titanic/messages/messages.cpp index c2a6197d4a..f9648f9dfb 100644 --- a/engines/titanic/messages/messages.cpp +++ b/engines/titanic/messages/messages.cpp @@ -22,6 +22,7 @@ #include "titanic/messages/messages.h" #include "titanic/core/game_object.h" +#include "titanic/core/tree_item.h" namespace Titanic { @@ -37,4 +38,32 @@ void CMessage::load(SimpleFile *file) { CSaveableObject::load(file); } +bool CMessage::execute(CTreeItem *target, const ClassDef *classDef, int flags) { + // If no target was specified, then there's nothing to do + if (!target) + return false; + + bool result = false; + CTreeItem *item = target; + CTreeItem *nextItem = nullptr; + do { + if (flags & MSGFLAG_SCAN) + nextItem = item->scan(target); + + if (!(flags & MSGFLAG_CLASS_DEF) || item->isInstanceOf(*classDef)) { + bool handled = true; // item->handleEvent(this); + + if (handled) { + result = true; + if (flags & MSGFLAG_BREAK_IF_HANDLED) + return true; + } + } + + item = nextItem; + } while (nextItem); + + return result; +} + } // End of namespace Titanic diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 5e6e0d7939..e369157f1d 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -28,11 +28,19 @@ namespace Titanic { +enum MessageFlag { + MSGFLAG_SCAN = 1, + MSGFLAG_BREAK_IF_HANDLED = 2, + MSGFLAG_CLASS_DEF = 4 +}; + class CMessage : public CSaveableObject { public: CLASSDEF CMessage(); + bool execute(CTreeItem *target, const ClassDef *classDef, int flags); + /** * Save the data for the class to file */ -- cgit v1.2.3 From 3103c9aaa9d14a5f6ad360eab2637c0be3141428 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 7 Mar 2016 08:11:06 -0500 Subject: TITANIC: Implemented message target classes --- engines/titanic/core/saveable_object.cpp | 2 + engines/titanic/game/arboretum_gate.h | 19 ++++++- engines/titanic/game_manager.cpp | 6 +- engines/titanic/messages/messages.cpp | 2 +- engines/titanic/messages/messages.h | 93 +++++++++++++++++++++++++++---- engines/titanic/messages/mouse_messages.h | 48 ++++++++++++++++ 6 files changed, 153 insertions(+), 17 deletions(-) diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 7ec4f949f2..8e3ab1e067 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -796,6 +796,7 @@ DEFFN(CIsParrotPresentMsg) DEFFN(CKeyCharMsg) DEFFN(CLemonFallsFromTreeMsg) DEFFN(CLightsMsg) +DEFFN(CLoadSuccessMsg) DEFFN(CLockPhonographMsg) DEFFN(CMaitreDDefeatedMsg) DEFFN(CMaitreDHappyMsg) @@ -1360,6 +1361,7 @@ void CSaveableObject::initClassList() { ADDFN(CKeyCharMsg, CMessage); ADDFN(CLemonFallsFromTreeMsg, CMessage); ADDFN(CLightsMsg, CMessage); + ADDFN(CLoadSuccessMsg, CMessage); ADDFN(CLockPhonographMsg, CMessage); ADDFN(CMaitreDDefeatedMsg, CMessage); ADDFN(CMaitreDHappyMsg, CMessage); diff --git a/engines/titanic/game/arboretum_gate.h b/engines/titanic/game/arboretum_gate.h index eb82333f8f..2c2b81feab 100644 --- a/engines/titanic/game/arboretum_gate.h +++ b/engines/titanic/game/arboretum_gate.h @@ -24,15 +24,20 @@ #define TITANIC_ARBORETUM_GATE_H #include "titanic/core/background.h" +#include "titanic/messages/messages.h" +#include "titanic/messages/mouse_messages.h" namespace Titanic { -class CArboretumGate : public CBackground { -public: +class CArboretumGate : public CBackground, public CActMsgTarget, + public CLeaveViewMsgTarget, public CTurnOffTarget, + public CMouseButtonDownMsgTarget, public CEnterViewMsgTarget, + public CTurnOnTarget, public CMovieEndMsgTarget { +private: static int _v1; static int _v2; static int _v3; -public: +private: int _fieldE0; CString _string1; int _fieldE8; @@ -63,6 +68,14 @@ public: int _field14C; int _field150; CString _string2; +protected: + virtual bool handleEvent(const CActMsg &msg) { return false; } + virtual bool handleEvent(const CLeaveViewMsg &msg) { return false; } + virtual bool handleEvent(const CTurnOff &msg) { return false; } + virtual bool handleEvent(const CMouseButtonDownMsg &msg) { return false; } + virtual bool handleEvent(const CEnterViewMsg &msg) { return false; } + virtual bool handleEvent(const CTurnOn &msg) { return false; } + virtual bool handleEvent(const CMovieEndMsg &msg) { return false; } public: CLASSDEF CArboretumGate(); diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index 5e6496218f..6c9d5e1695 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game_manager.h" +#include "titanic/messages/messages.h" #include "titanic/screen_manager.h" namespace Titanic { @@ -36,6 +37,9 @@ void CGameManager::load(SimpleFile *file) { void CGameManager::gameLoaded() { // TODO + + //CLoadSuccessMsg msg(0); + } -} // End of namespace Titanic +} // End of namespace Titanic z diff --git a/engines/titanic/messages/messages.cpp b/engines/titanic/messages/messages.cpp index f9648f9dfb..1f7a5a07d4 100644 --- a/engines/titanic/messages/messages.cpp +++ b/engines/titanic/messages/messages.cpp @@ -51,7 +51,7 @@ bool CMessage::execute(CTreeItem *target, const ClassDef *classDef, int flags) { nextItem = item->scan(target); if (!(flags & MSGFLAG_CLASS_DEF) || item->isInstanceOf(*classDef)) { - bool handled = true; // item->handleEvent(this); + bool handled = perform(item); if (handled) { result = true; diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index e369157f1d..1908b7351c 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -34,6 +34,9 @@ enum MessageFlag { MSGFLAG_CLASS_DEF = 4 }; +#define MSGTARGET(NAME) class NAME; class NAME##Target { public: \ + virtual bool handleEvent(const NAME &msg) = 0; } + class CMessage : public CSaveableObject { public: CLASSDEF @@ -41,6 +44,8 @@ public: bool execute(CTreeItem *target, const ClassDef *classDef, int flags); + virtual bool perform(CTreeItem *treeItem) { return false; } + /** * Save the data for the class to file */ @@ -52,8 +57,11 @@ public: virtual void load(SimpleFile *file); }; +MSGTARGET(CEditControlMsg); class CEditControlMsg : public CMessage { -private: +protected: + virtual bool handleMessage(CEditControlMsg &msg) { return false; } +public: int _field4; int _field8; CString _string1; @@ -64,9 +72,17 @@ public: CLASSDEF CEditControlMsg() : _field4(0), _field8(0), _field18(0), _field1C(0), _field20(0) {} + + virtual bool perform(CTreeItem *treeItem) { + CEditControlMsg *dest = dynamic_cast(treeItem); + return dest != nullptr && dest->handleMessage(*this); + } }; +MSGTARGET(CLightsMsg); class CLightsMsg : public CMessage { +protected: + virtual bool handleMessage(CLightsMsg &msg) { return false; } public: int _field4; int _field8; @@ -76,10 +92,18 @@ public: CLASSDEF CLightsMsg() : CMessage(), _field4(0), _field8(0), _fieldC(0), _field10(0) {} + + virtual bool perform(CTreeItem *treeItem) { + CLightsMsg *dest = dynamic_cast(treeItem); + return dest != nullptr && dest->handleMessage(*this); + } }; +MSGTARGET(CIsHookedOnMsg); class CIsHookedOnMsg : public CMessage { -private: +protected: + virtual bool handleMessage(CIsHookedOnMsg &msg) { return false; } +public: int _field4; int _field8; CString _string1; @@ -90,59 +114,100 @@ public: CLASSDEF CIsHookedOnMsg() : CMessage(), _field4(0), _field8(0), _field18(0), _field1C(0), _field20(0) {} + + virtual bool perform(CTreeItem *treeItem) { + CIsHookedOnMsg *dest = dynamic_cast(treeItem); + return dest != nullptr && dest->handleMessage(*this); + } }; +MSGTARGET(CSubAcceptCCarryMsg); class CSubAcceptCCarryMsg : public CMessage { +protected: + virtual bool handleMessage(CSubAcceptCCarryMsg &msg) { return false; } public: CString _string1; int _value1, _value2, _value3; public: CLASSDEF CSubAcceptCCarryMsg() : _value1(0), _value2(0), _value3(0) {} + + virtual bool perform(CTreeItem *treeItem) { + CSubAcceptCCarryMsg *dest = dynamic_cast(treeItem); + return dest != nullptr && dest->handleMessage(*this); + } }; +MSGTARGET(CTransportMsg); class CTransportMsg : public CMessage { +protected: + virtual bool handleMessage(CTransportMsg &msg) { return false; } public: CString _string; int _value1, _value2; public: CLASSDEF CTransportMsg() : _value1(0), _value2(0) {} + + virtual bool perform(CTreeItem *treeItem) { + CTransportMsg *dest = dynamic_cast(treeItem); + return dest != nullptr && dest->handleMessage(*this); + } }; -#define MESSAGE0(NAME) \ +#define MESSAGE0(NAME) MSGTARGET(NAME); \ class NAME: public CMessage { \ public: NAME() : CMessage() {} \ CLASSDEF \ - } -#define MESSAGE1(NAME, F1, N1, V1) \ + virtual bool handleMessage(NAME &msg) { return false; } \ + virtual bool perform(CTreeItem *treeItem) { \ + NAME *dest = dynamic_cast(treeItem); \ + return dest != nullptr && dest->handleMessage(*this); \ + } } +#define MESSAGE1(NAME, F1, N1, V1) MSGTARGET(NAME); \ class NAME: public CMessage { \ public: F1 _N1; \ NAME() : CMessage(), _N1(V1) {} \ NAME(F1 N1) : CMessage(), _N1(N1) {} \ CLASSDEF \ - } -#define MESSAGE2(NAME, F1, N1, V1, F2, N2, V2) \ + virtual bool handleMessage(NAME &msg) { return false; } \ + virtual bool perform(CTreeItem *treeItem) { \ + NAME *dest = dynamic_cast(treeItem); \ + return dest != nullptr && dest->handleMessage(*this); \ + } } +#define MESSAGE2(NAME, F1, N1, V1, F2, N2, V2) MSGTARGET(NAME); \ class NAME: public CMessage { \ public: F1 _N1; F2 _N2; \ NAME() : CMessage(), _N1(V1), _N2(V2) {} \ NAME(F1 N1, F2 N2) : CMessage(), _N1(N1), _N2(N2) {} \ CLASSDEF \ - } -#define MESSAGE3(NAME, F1, N1, V1, F2, N2, V2, F3, N3, V3) \ + virtual bool handleMessage(NAME &msg) { return false; } \ + virtual bool perform(CTreeItem *treeItem) { \ + NAME *dest = dynamic_cast(treeItem); \ + return dest != nullptr && dest->handleMessage(*this); \ + } } +#define MESSAGE3(NAME, F1, N1, V1, F2, N2, V2, F3, N3, V3) MSGTARGET(NAME); \ class NAME: public CMessage { \ public: F1 _N1; F2 _N2; F3 _N3; \ NAME() : CMessage(), _N1(V1), _N2(V2), _N3(V3) {} \ NAME(F1 N1, F2 N2, F3 N3) : CMessage(), _N1(N1), _N2(N2), _N3(N3) {} \ CLASSDEF \ - } -#define MESSAGE4(NAME, F1, N1, V1, F2, N2, V2, F3, N3, V3, F4, N4, V4) \ + virtual bool handleMessage(NAME &msg) { return false; } \ + virtual bool perform(CTreeItem *treeItem) { \ + NAME *dest = dynamic_cast(treeItem); \ + return dest != nullptr && dest->handleMessage(*this); \ + } } +#define MESSAGE4(NAME, F1, N1, V1, F2, N2, V2, F3, N3, V3, F4, N4, V4) MSGTARGET(NAME); \ class NAME: public CMessage { \ public: F1 _N1; F2 _N2; F3 _N3; F4 _N4; \ NAME() : CMessage(), _N1(V1), _N2(V2), _N3(V3), _N4(V4) {} \ NAME(F1 N1, F2 N2, F3 N3, F4 N4) : CMessage(), _N1(N1), _N2(N2), _N3(N3), _N4(N4) {} \ CLASSDEF \ - } + virtual bool handleMessage(NAME &msg) { return false; } \ + virtual bool perform(CTreeItem *treeItem) { \ + NAME *dest = dynamic_cast(treeItem); \ + return dest != nullptr && dest->handleMessage(*this); \ + } } MESSAGE1(CActMsg, CString, value, ""); MESSAGE1(CActivationmsg, CString, value, ""); @@ -175,6 +240,8 @@ MESSAGE1(CDropobjectMsg, int, value, 0); MESSAGE1(CDropZoneGotObjectMsg, int, value, 0); MESSAGE1(CDropZoneLostObjectMsg, int, value, 0); MESSAGE1(CEjectCylinderMsg, int, value, 0); +MESSAGE0(CEnterNodeMsg); +MESSAGE0(CEnterViewMsg); MESSAGE0(CErasePhonographCylinderMsg); MESSAGE2(CFreshenCookieMsg, int, value1, 0, int, value2, 0); MESSAGE1(CGetChevClassBits, int, value, 0); @@ -191,7 +258,9 @@ MESSAGE0(CInitializeAnimMsg); MESSAGE1(CIsEarBowlPuzzleDone, int, value, 0); MESSAGE1(CIsParrotPresentMsg, int, value, 0); MESSAGE1(CKeyCharMsg, int, value, 32); +MESSAGE0(CLeaveViewMsg); MESSAGE2(CLemonFallsFromTreeMsg, int, value1, 0, int, value2, 0); +MESSAGE1(CLoadSuccessMsg, int, ticks, 0); MESSAGE1(CLockPhonographMsg, int, value, 0); MESSAGE0(CMaitreDDefeatedMsg); MESSAGE0(CMaitreDHappyMsg); diff --git a/engines/titanic/messages/mouse_messages.h b/engines/titanic/messages/mouse_messages.h index d3a0566f3d..79c45afcfa 100644 --- a/engines/titanic/messages/mouse_messages.h +++ b/engines/titanic/messages/mouse_messages.h @@ -36,9 +36,16 @@ public: CMouseMsg() : _buttons(0) {} }; +MSGTARGET(CMouseMoveMsg); class CMouseMoveMsg : public CMouseMsg { public: CLASSDEF + + virtual bool handleMessage(CMouseMoveMsg &msg) { return false; } + virtual bool perform(CTreeItem *treeItem) { + CMouseMoveMsg *dest = dynamic_cast(treeItem); + return dest != nullptr && dest->handleMessage(*this); + } }; class CMouseButtonMsg : public CMouseMsg { @@ -49,19 +56,40 @@ public: CMouseButtonMsg() : CMouseMsg(), _field10(0) {} }; +MSGTARGET(CMouseButtonDownMsg); class CMouseButtonDownMsg : public CMouseButtonMsg { public: CLASSDEF + + virtual bool handleMessage(CMouseButtonDownMsg &msg) { return false; } + virtual bool perform(CTreeItem *treeItem) { + CMouseButtonDownMsg *dest = dynamic_cast(treeItem); + return dest != nullptr && dest->handleMessage(*this); + } }; +MSGTARGET(CMouseButtonUpMsg); class CMouseButtonUpMsg : public CMouseButtonMsg { public: CLASSDEF + + virtual bool handleMessage(CMouseButtonUpMsg &msg) { return false; } + virtual bool perform(CTreeItem *treeItem) { + CMouseButtonUpMsg *dest = dynamic_cast(treeItem); + return dest != nullptr && dest->handleMessage(*this); + } }; +MSGTARGET(CMouseButtonDoubleClickMsg); class CMouseButtonDoubleClickMsg : public CMouseButtonMsg { public: CLASSDEF + + virtual bool handleMessage(CMouseButtonDoubleClickMsg &msg) { return false; } + virtual bool perform(CTreeItem *treeItem) { + CMouseButtonDoubleClickMsg *dest = dynamic_cast(treeItem); + return dest != nullptr && dest->handleMessage(*this); + } }; class CMouseDragMsg : public CMouseMsg { @@ -72,8 +100,15 @@ public: class CMouseDragMoveMsg : public CMouseDragMsg { public: CLASSDEF + + virtual bool handleMessage(CMouseDragMoveMsg &msg) { return false; } + virtual bool perform(CTreeItem *treeItem) { + CMouseDragMoveMsg *dest = dynamic_cast(treeItem); + return dest != nullptr && dest->handleMessage(*this); + } }; +MSGTARGET(CMouseDragStartMsg); class CMouseDragStartMsg : public CMouseDragMsg { public: int _field10; @@ -81,14 +116,27 @@ public: public: CLASSDEF CMouseDragStartMsg() : CMouseDragMsg(), _field10(0), _field14(0) {} + + virtual bool handleMessage(CMouseDragStartMsg &msg) { return false; } + virtual bool perform(CTreeItem *treeItem) { + CMouseDragStartMsg *dest = dynamic_cast(treeItem); + return dest != nullptr && dest->handleMessage(*this); + } }; +MSGTARGET(CMouseDragEndMsg); class CMouseDragEndMsg : public CMouseDragMsg { public: int _field10; public: CLASSDEF CMouseDragEndMsg() : CMouseDragMsg(), _field10(0) {} + + virtual bool handleMessage(CMouseDragEndMsg &msg) { return false; } + virtual bool perform(CTreeItem *treeItem) { + CMouseDragEndMsg *dest = dynamic_cast(treeItem); + return dest != nullptr && dest->handleMessage(*this); + } }; } // End of namespace Titanic -- cgit v1.2.3 From 0645a3dbde92fe4fbd46895cf24470535b7245aa Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 8 Mar 2016 18:48:26 -0500 Subject: TITANIC: Fix crash when compressed newgame.st file was closed --- engines/titanic/compressed_file.cpp | 43 ++--------------------------------- engines/titanic/compressed_file.h | 27 ++-------------------- engines/titanic/core/project_item.cpp | 9 +++++--- engines/titanic/simple_file.cpp | 20 +++++++--------- engines/titanic/simple_file.h | 9 +++----- 5 files changed, 21 insertions(+), 87 deletions(-) diff --git a/engines/titanic/compressed_file.cpp b/engines/titanic/compressed_file.cpp index d0cd37671a..3db93522dc 100644 --- a/engines/titanic/compressed_file.cpp +++ b/engines/titanic/compressed_file.cpp @@ -24,51 +24,12 @@ namespace Titanic { -#define BUFFER_SIZE 1024 - -CompressedFile::CompressedFile() : SimpleFile() { - _readStream = nullptr; - _writeStream = nullptr; -} - -CompressedFile::~CompressedFile() { -} - -void CompressedFile::open(const Common::String &name) { - SimpleFile::open(name); - _readStream = Common::wrapCompressedReadStream(&_file); -} - void CompressedFile::open(Common::SeekableReadStream *stream) { - SimpleFile::open(stream); - _readStream = Common::wrapCompressedReadStream(&_file); + SimpleFile::open(Common::wrapCompressedReadStream(stream)); } void CompressedFile::open(Common::OutSaveFile *stream) { - SimpleFile::open(stream); - _writeStream = Common::wrapCompressedWriteStream(stream); -} - -void CompressedFile::close() { - delete _readStream; - delete _writeStream; - _readStream = nullptr; - _writeStream = nullptr; - - SimpleFile::close(); -} - -size_t CompressedFile::unsafeRead(void *dst, size_t count) { - assert(_readStream); - if (count == 0) - return 0; - - // Read data and decompress - return _readStream->read(dst, count); -} - -size_t CompressedFile::write(const void *src, size_t count) { - return _writeStream->write(src, count); + SimpleFile::open(Common::wrapCompressedWriteStream(stream)); } } // End of namespace Titanic diff --git a/engines/titanic/compressed_file.h b/engines/titanic/compressed_file.h index 4b1051be5c..3be852f3b4 100644 --- a/engines/titanic/compressed_file.h +++ b/engines/titanic/compressed_file.h @@ -36,17 +36,9 @@ namespace Titanic { * Derived file that handles compressed files */ class CompressedFile : public SimpleFile { -private: - Common::SeekableReadStream *_readStream; - Common::WriteStream *_writeStream; public: - CompressedFile(); - virtual ~CompressedFile(); - - /** - * Open a file for access - */ - virtual void open(const Common::String &name); + CompressedFile() : SimpleFile() {} + virtual ~CompressedFile() {} /** * Set up a stream for read access @@ -57,21 +49,6 @@ public: * Set up a stream for write access */ virtual void open(Common::OutSaveFile *stream); - - /** - * Close the file - */ - virtual void close(); - - /** - * Read from the file - */ - virtual size_t unsafeRead(void *dst, size_t count); - - /** - * Write out data - */ - virtual size_t write(const void *src, size_t count); }; } // End of namespace Titanic diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp index e759b87e9f..2fa65f9e33 100644 --- a/engines/titanic/core/project_item.cpp +++ b/engines/titanic/core/project_item.cpp @@ -134,18 +134,20 @@ void CProjectItem::resetGameManager() { void CProjectItem::loadGame(int slotId) { CompressedFile file; - Common::InSaveFile *saveFile = nullptr; // Clear any existing project contents clear(); // Open either an existing savegame slot or the new game template if (slotId >= 0) { - saveFile = g_system->getSavefileManager()->openForLoading( + Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading( Common::String::format("slot%d.gam", slotId)); file.open(saveFile); } else { - file.open("newgame.st"); + Common::File *newFile = new Common::File(); + if (!newFile->open("newgame.st")) + error("Could not open newgame.st"); + file.open(newFile); } // Load the contents in @@ -165,6 +167,7 @@ void CProjectItem::loadGame(int slotId) { item->detach(); item->addUnder(this); } + // Loaded project instance is no longer needed newProject->destroyAll(); diff --git a/engines/titanic/simple_file.cpp b/engines/titanic/simple_file.cpp index ef6f26d827..4be8bb3d88 100644 --- a/engines/titanic/simple_file.cpp +++ b/engines/titanic/simple_file.cpp @@ -29,15 +29,7 @@ SimpleFile::SimpleFile(): _inStream(nullptr), _outStream(nullptr), _lineCount(1) } SimpleFile::~SimpleFile() { - _file.close(); -} - -void SimpleFile::open(const Common::String &name) { close(); - - if (!_file.open(name)) - error("Could not find file - %s", name.c_str()); - _inStream = &_file; } void SimpleFile::open(Common::SeekableReadStream *stream) { @@ -51,12 +43,16 @@ void SimpleFile::open(Common::OutSaveFile *stream) { } void SimpleFile::close() { - _file.close(); - if (_outStream) + if (_outStream) { _outStream->finalize(); + delete _outStream; + _outStream = nullptr; + } - _inStream = nullptr; - _outStream = nullptr; + if (_inStream) { + delete _inStream; + _inStream = nullptr; + } } void SimpleFile::safeRead(void *dst, size_t count) { diff --git a/engines/titanic/simple_file.h b/engines/titanic/simple_file.h index 8ea2b5a35d..4426380966 100644 --- a/engines/titanic/simple_file.h +++ b/engines/titanic/simple_file.h @@ -35,9 +35,11 @@ namespace Titanic { class Decompressor; class DecompressorData; +/** + * This class implements basic reading and writing to files + */ class SimpleFile { protected: - Common::File _file; Common::SeekableReadStream *_inStream; Common::OutSaveFile *_outStream; int _lineCount; @@ -45,11 +47,6 @@ public: SimpleFile(); virtual ~SimpleFile(); - /** - * Open a file for access - */ - virtual void open(const Common::String &name); - /** * Set up a stream for read access */ -- cgit v1.2.3 From d1a29a1d1ad3ab60737f3a9a837907cd72562b63 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 8 Mar 2016 18:57:17 -0500 Subject: TITANIC: Moved CompressedFile class into simple_file.h One of the joys of working with ScummVM was that, using existing Common functionality, the entirety of the original's CompressedFile class could be reduced to a couple of lines. As such, CompressedFile doesn't really need it's own seperate files anymore. --- engines/titanic/compressed_file.cpp | 35 --------------------- engines/titanic/compressed_file.h | 56 ---------------------------------- engines/titanic/core/project_item.cpp | 2 +- engines/titanic/core/saveable_object.h | 1 + engines/titanic/module.mk | 1 - engines/titanic/simple_file.h | 28 +++++++++++++++-- 6 files changed, 27 insertions(+), 96 deletions(-) delete mode 100644 engines/titanic/compressed_file.cpp delete mode 100644 engines/titanic/compressed_file.h diff --git a/engines/titanic/compressed_file.cpp b/engines/titanic/compressed_file.cpp deleted file mode 100644 index 3db93522dc..0000000000 --- a/engines/titanic/compressed_file.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 "titanic/compressed_file.h" - -namespace Titanic { - -void CompressedFile::open(Common::SeekableReadStream *stream) { - SimpleFile::open(Common::wrapCompressedReadStream(stream)); -} - -void CompressedFile::open(Common::OutSaveFile *stream) { - SimpleFile::open(Common::wrapCompressedWriteStream(stream)); -} - -} // End of namespace Titanic diff --git a/engines/titanic/compressed_file.h b/engines/titanic/compressed_file.h deleted file mode 100644 index 3be852f3b4..0000000000 --- a/engines/titanic/compressed_file.h +++ /dev/null @@ -1,56 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_COMPRESSED_FILE_H -#define TITANIC_COMPRESSED_FILE_H - -#include "common/scummsys.h" -#include "common/file.h" -#include "common/memstream.h" -#include "common/zlib.h" -#include "titanic/simple_file.h" -#include "titanic/string.h" - -namespace Titanic { - -/** - * Derived file that handles compressed files - */ -class CompressedFile : public SimpleFile { -public: - CompressedFile() : SimpleFile() {} - virtual ~CompressedFile() {} - - /** - * Set up a stream for read access - */ - virtual void open(Common::SeekableReadStream *stream); - - /** - * Set up a stream for write access - */ - virtual void open(Common::OutSaveFile *stream); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_COMPRESSED_FILE_H */ diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp index 2fa65f9e33..354e373a53 100644 --- a/engines/titanic/core/project_item.cpp +++ b/engines/titanic/core/project_item.cpp @@ -20,10 +20,10 @@ * */ +#include "common/file.h" #include "common/savefile.h" #include "titanic/game_manager.h" #include "titanic/titanic.h" -#include "titanic/compressed_file.h" #include "titanic/core/dont_save_file_item.h" #include "titanic/core/project_item.h" #include "titanic/pet_control/pet_control.h" diff --git a/engines/titanic/core/saveable_object.h b/engines/titanic/core/saveable_object.h index b15dd13072..c4615c52b2 100644 --- a/engines/titanic/core/saveable_object.h +++ b/engines/titanic/core/saveable_object.h @@ -26,6 +26,7 @@ #include "common/scummsys.h" #include "common/array.h" #include "common/hash-str.h" +#include "common/list.h" #include "titanic/simple_file.h" namespace Titanic { diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index b9f5b641ed..6309ac8d8f 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -1,7 +1,6 @@ MODULE := engines/titanic MODULE_OBJS := \ - compressed_file.o \ detection.o \ direct_draw.o \ font.o \ diff --git a/engines/titanic/simple_file.h b/engines/titanic/simple_file.h index 4426380966..cc68d2d54c 100644 --- a/engines/titanic/simple_file.h +++ b/engines/titanic/simple_file.h @@ -23,11 +23,10 @@ #ifndef TITANIC_SIMPLE_FILE_H #define TITANIC_SIMPLE_FILE_H -#include "common/scummsys.h" -#include "common/file.h" -#include "common/queue.h" #include "common/rect.h" #include "common/savefile.h" +#include "common/stream.h" +#include "common/zlib.h" #include "titanic/string.h" namespace Titanic { @@ -180,6 +179,29 @@ public: void writeClassEnd(int indent); }; +/** + * Derived file that handles compressed files + */ +class CompressedFile : public SimpleFile { +public: + CompressedFile() : SimpleFile() {} + virtual ~CompressedFile() {} + + /** + * Set up a stream for read access + */ + virtual void open(Common::SeekableReadStream *stream) { + SimpleFile::open(Common::wrapCompressedReadStream(stream)); + } + + /** + * Set up a stream for write access + */ + virtual void open(Common::OutSaveFile *stream) { + SimpleFile::open(Common::wrapCompressedWriteStream(stream)); + } +}; + } // End of namespace Titanic #endif /* TITANIC_SIMPLE_FILE_H */ -- cgit v1.2.3 From eff4ed1ac1b432744de77014f3a7001753580b0e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 8 Mar 2016 19:35:30 -0500 Subject: TITANIC: Fleshing out CProjectItem methods --- engines/titanic/core/project_item.cpp | 62 +++++++++++++++++++++++++++++++++++ engines/titanic/core/project_item.h | 31 ++++++++++++++++++ engines/titanic/core/tree_item.h | 4 +++ 3 files changed, 97 insertions(+) diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp index 354e373a53..e1f5ec4b34 100644 --- a/engines/titanic/core/project_item.cpp +++ b/engines/titanic/core/project_item.cpp @@ -294,4 +294,66 @@ CPetControl *CProjectItem::getPetControl() { return nullptr; } +CRoomItem *CProjectItem::findFirstRoom() { + return dynamic_cast(findChildInstance(*CRoomItem::_type)); +} + +CTreeItem *CProjectItem::findChildInstance(ClassDef &classDef) { + CTreeItem *treeItem = getFirstChild(); + if (treeItem == nullptr) + return nullptr; + + do { + CTreeItem *childItem = treeItem->getFirstChild(); + if (childItem) { + do { + if (childItem->isInstanceOf(classDef)) + return childItem; + } while ((childItem = childItem->getNextSibling()) != nullptr); + } + } while ((treeItem = treeItem->getNextSibling()) != nullptr); + + return nullptr; +} + +CRoomItem *CProjectItem::findNextRoom(CRoomItem *priorRoom) { + return dynamic_cast(findSiblingInstanceOf(*CRoomItem::_type, priorRoom)); +} + +CTreeItem *CProjectItem::findSiblingInstanceOf(ClassDef &classDef, CTreeItem *startItem) { + CTreeItem *treeItem = startItem->getParent()->getNextSibling(); + if (treeItem == nullptr) + return nullptr; + + return findChildInstance(classDef); +} + +CDontSaveFileItem *CProjectItem::getDontSaveFileItem() { + for (CTreeItem *treeItem = getFirstChild(); treeItem; treeItem = treeItem->getNextSibling()) { + if (treeItem->isInstanceOf(*CDontSaveFileItem::_type)) + return dynamic_cast(treeItem); + } + + return nullptr; +} + +CRoomItem *CProjectItem::findHiddenRoom() const { + return dynamic_cast(findByName("HiddenRoom")); +} + +CNamedItem *CProjectItem::findByName(const CString &name, int maxChars) const { + /* + CString nameLower = name; + nameLower.toLowercase(); + + CTreeItem *treeItem = this; + while (treeItem) { + CString nodeName = treeItem->getName(); + + } + */ + return nullptr; +} + + } // End of namespace Titanic diff --git a/engines/titanic/core/project_item.h b/engines/titanic/core/project_item.h index 81b1869a6b..07a585237b 100644 --- a/engines/titanic/core/project_item.h +++ b/engines/titanic/core/project_item.h @@ -25,8 +25,10 @@ #include "common/scummsys.h" #include "titanic/simple_file.h" +#include "titanic/core/dont_save_file_item.h" #include "titanic/core/file_item.h" #include "titanic/core/list.h" +#include "titanic/game/room_item.h" namespace Titanic { @@ -75,6 +77,16 @@ private: * Called during save, iterates through the children to do some stuff */ void buildFilesList(); + + /** + * Finds the first child instance of a given class type + */ + CTreeItem *findChildInstance(ClassDef &classDef); + + /** + * Finds the next sibling occurance of a given class type + */ + CTreeItem *findSiblingInstanceOf(ClassDef &classDef, CTreeItem *startItem); private: /** * Load project data from the passed file @@ -138,6 +150,25 @@ public: * Set the proejct's name */ void setFilename(const CString &name) { _filename = name; } + + /** + * Returns a reference to the first room item in the project + */ + CRoomItem *findFirstRoom(); + + /** + * Returns a reference to the next room following the specified room + */ + CRoomItem *findNextRoom(CRoomItem *priorRoom); + + /** + * Returns the don't save file item, if it exists in the project + */ + CDontSaveFileItem *getDontSaveFileItem(); + + CRoomItem *findHiddenRoom() const; + + CNamedItem *findByName(const CString &name, int maxChars = 0) const; }; } // End of namespace Titanic diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index eed30a3ecb..4e1581b1f6 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -96,6 +96,10 @@ public: */ CTreeItem *getLastChild(); + /** + * Given all the recursive children of the tree item, gives the next + * item in sequence to the passed starting item + */ CTreeItem *scan(CTreeItem *item); /** -- cgit v1.2.3 From 34ade1f8cbd964314ebb603ffe4c8a76fbdb32c9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 8 Mar 2016 20:33:57 -0500 Subject: TITANIC: Add const suffix to many tree item methods --- engines/titanic/core/project_item.cpp | 14 +++++++------- engines/titanic/core/project_item.h | 14 +++++++------- engines/titanic/core/tree_item.cpp | 21 ++++----------------- engines/titanic/core/tree_item.h | 17 ++++++----------- 4 files changed, 24 insertions(+), 42 deletions(-) diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp index e1f5ec4b34..488cdba6c9 100644 --- a/engines/titanic/core/project_item.cpp +++ b/engines/titanic/core/project_item.cpp @@ -124,7 +124,7 @@ void CProjectItem::load(SimpleFile *file) { CTreeItem::load(file); } -CGameManager *CProjectItem::getGameManager() { +CGameManager *CProjectItem::getGameManager() const { return _gameManager; } @@ -276,7 +276,7 @@ void CProjectItem::gameLoaded() { petControl->gameLoaded(); } -CPetControl *CProjectItem::getPetControl() { +CPetControl *CProjectItem::getPetControl() const { CDontSaveFileItem *fileItem = getDontSaveFileItem(); CTreeItem *treeItem; @@ -294,11 +294,11 @@ CPetControl *CProjectItem::getPetControl() { return nullptr; } -CRoomItem *CProjectItem::findFirstRoom() { +CRoomItem *CProjectItem::findFirstRoom() const { return dynamic_cast(findChildInstance(*CRoomItem::_type)); } -CTreeItem *CProjectItem::findChildInstance(ClassDef &classDef) { +CTreeItem *CProjectItem::findChildInstance(ClassDef &classDef) const { CTreeItem *treeItem = getFirstChild(); if (treeItem == nullptr) return nullptr; @@ -316,11 +316,11 @@ CTreeItem *CProjectItem::findChildInstance(ClassDef &classDef) { return nullptr; } -CRoomItem *CProjectItem::findNextRoom(CRoomItem *priorRoom) { +CRoomItem *CProjectItem::findNextRoom(CRoomItem *priorRoom) const { return dynamic_cast(findSiblingInstanceOf(*CRoomItem::_type, priorRoom)); } -CTreeItem *CProjectItem::findSiblingInstanceOf(ClassDef &classDef, CTreeItem *startItem) { +CTreeItem *CProjectItem::findSiblingInstanceOf(ClassDef &classDef, CTreeItem *startItem) const { CTreeItem *treeItem = startItem->getParent()->getNextSibling(); if (treeItem == nullptr) return nullptr; @@ -328,7 +328,7 @@ CTreeItem *CProjectItem::findSiblingInstanceOf(ClassDef &classDef, CTreeItem *st return findChildInstance(classDef); } -CDontSaveFileItem *CProjectItem::getDontSaveFileItem() { +CDontSaveFileItem *CProjectItem::getDontSaveFileItem() const { for (CTreeItem *treeItem = getFirstChild(); treeItem; treeItem = treeItem->getNextSibling()) { if (treeItem->isInstanceOf(*CDontSaveFileItem::_type)) return dynamic_cast(treeItem); diff --git a/engines/titanic/core/project_item.h b/engines/titanic/core/project_item.h index 07a585237b..2ec3a73647 100644 --- a/engines/titanic/core/project_item.h +++ b/engines/titanic/core/project_item.h @@ -81,12 +81,12 @@ private: /** * Finds the first child instance of a given class type */ - CTreeItem *findChildInstance(ClassDef &classDef); + CTreeItem *findChildInstance(ClassDef &classDef) const; /** * Finds the next sibling occurance of a given class type */ - CTreeItem *findSiblingInstanceOf(ClassDef &classDef, CTreeItem *startItem); + CTreeItem *findSiblingInstanceOf(ClassDef &classDef, CTreeItem *startItem) const; private: /** * Load project data from the passed file @@ -119,12 +119,12 @@ public: /** * Get the game manager for the project */ - virtual CGameManager *getGameManager(); + virtual CGameManager *getGameManager() const; /** * Get a reference to the PET control */ - CPetControl *getPetControl(); + CPetControl *getPetControl() const; /** * Resets the game manager field @@ -154,17 +154,17 @@ public: /** * Returns a reference to the first room item in the project */ - CRoomItem *findFirstRoom(); + CRoomItem *findFirstRoom() const; /** * Returns a reference to the next room following the specified room */ - CRoomItem *findNextRoom(CRoomItem *priorRoom); + CRoomItem *findNextRoom(CRoomItem *priorRoom) const; /** * Returns the don't save file item, if it exists in the project */ - CDontSaveFileItem *getDontSaveFileItem(); + CDontSaveFileItem *getDontSaveFileItem() const; CRoomItem *findHiddenRoom() const; diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index ee89a0532e..22c4e1ddac 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -40,7 +40,7 @@ void CTreeItem::load(SimpleFile *file) { CMessageTarget::load(file); } -CGameManager *CTreeItem::getGameManager() { +CGameManager *CTreeItem::getGameManager() const { return _parent ? _parent->getGameManager() : nullptr; } @@ -64,17 +64,17 @@ CTreeItem *CTreeItem::getLastSibling() { return item; } -CTreeItem *CTreeItem::getLastChild() { +CTreeItem *CTreeItem::getLastChild() const { if (!_firstChild) return nullptr; return _firstChild->getLastSibling(); } -CTreeItem *CTreeItem::scan(CTreeItem *item) { +CTreeItem *CTreeItem::scan(CTreeItem *item) const { if (_firstChild) return _firstChild; - CTreeItem *treeItem = this; + const CTreeItem *treeItem = this; while (treeItem != item) { if (treeItem->_nextSibling) return treeItem->_nextSibling; @@ -87,19 +87,6 @@ CTreeItem *CTreeItem::scan(CTreeItem *item) { return nullptr; } -CDontSaveFileItem *CTreeItem::getDontSaveFileItem() { - CTreeItem *item = getFirstChild(); - while (item) { - CDontSaveFileItem *fileItem = dynamic_cast(item); - if (fileItem) - return fileItem; - - item = item->getNextSibling(); - } - - return nullptr; -} - void CTreeItem::addUnder(CTreeItem *newParent) { if (newParent->_firstChild) addSibling(newParent->getLastSibling()); diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index 4e1581b1f6..acfd8bf2f4 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -54,7 +54,7 @@ public: /** * Get the game manager for the project */ - virtual CGameManager *getGameManager(); + virtual CGameManager *getGameManager() const; /** * Returns true if the item is a file item @@ -74,12 +74,12 @@ public: /** * Get the next sibling */ - CTreeItem *getNextSibling() { return _nextSibling; } + CTreeItem *getNextSibling() const { return _nextSibling; } /** * Get the prior sibling */ - CTreeItem *getPriorSibling() { return _priorSibling; } + CTreeItem *getPriorSibling() const { return _priorSibling; } /** * Get the last sibling of this sibling @@ -89,23 +89,18 @@ public: /** * Get the first child of the item, if any */ - CTreeItem *getFirstChild() { return _firstChild; } + CTreeItem *getFirstChild() const { return _firstChild; } /** * Get the last child of the item, if any */ - CTreeItem *getLastChild(); + CTreeItem *getLastChild() const; /** * Given all the recursive children of the tree item, gives the next * item in sequence to the passed starting item */ - CTreeItem *scan(CTreeItem *item); - - /** - * Get any dont save file item in the immediate children - */ - CDontSaveFileItem *getDontSaveFileItem(); + CTreeItem *scan(CTreeItem *item) const; /** * Adds the item under another tree item -- cgit v1.2.3 From 8a404e62aab32a236c77a32804bd934c533d9605 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 8 Mar 2016 21:13:24 -0500 Subject: TITANIC: Implemented CTreeItem::findByName --- engines/titanic/core/named_item.cpp | 8 ++++++++ engines/titanic/core/named_item.h | 15 +++++++++++++++ engines/titanic/core/project_item.cpp | 17 +---------------- engines/titanic/core/project_item.h | 4 +--- engines/titanic/core/tree_item.cpp | 21 +++++++++++++++++++++ engines/titanic/core/tree_item.h | 21 +++++++++++++++++++++ engines/titanic/string.cpp | 16 ++++++++++++++++ engines/titanic/string.h | 15 +++++++++++++++ 8 files changed, 98 insertions(+), 19 deletions(-) diff --git a/engines/titanic/core/named_item.cpp b/engines/titanic/core/named_item.cpp index 10d9588590..641efbd249 100644 --- a/engines/titanic/core/named_item.cpp +++ b/engines/titanic/core/named_item.cpp @@ -39,4 +39,12 @@ void CNamedItem::load(SimpleFile *file) { CTreeItem::load(file); } +int CNamedItem::compareTo(const CString &name, int maxLen) const { + if (maxLen) { + return getName().left(maxLen).compareToIgnoreCase(name); + } else { + return getName().compareToIgnoreCase(name); + } +} + } // End of namespace Titanic diff --git a/engines/titanic/core/named_item.h b/engines/titanic/core/named_item.h index c86aae2529..0afbf709c5 100644 --- a/engines/titanic/core/named_item.h +++ b/engines/titanic/core/named_item.h @@ -42,6 +42,21 @@ public: * Load the data for the class from file */ virtual void load(SimpleFile *file); + + /** + * Returns true if the item is a named item + */ + virtual bool isNamedItem() const { return true; } + + /** + * Gets the name of the item, if any + */ + virtual const CString getName() const { return _name; } + + /** + * Compares the name of the item to a passed name + */ + virtual int compareTo(const CString &name, int maxLen) const; }; } // End of namespace Titanic diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp index 488cdba6c9..de43b5bb41 100644 --- a/engines/titanic/core/project_item.cpp +++ b/engines/titanic/core/project_item.cpp @@ -337,23 +337,8 @@ CDontSaveFileItem *CProjectItem::getDontSaveFileItem() const { return nullptr; } -CRoomItem *CProjectItem::findHiddenRoom() const { +CRoomItem *CProjectItem::findHiddenRoom() { return dynamic_cast(findByName("HiddenRoom")); } -CNamedItem *CProjectItem::findByName(const CString &name, int maxChars) const { - /* - CString nameLower = name; - nameLower.toLowercase(); - - CTreeItem *treeItem = this; - while (treeItem) { - CString nodeName = treeItem->getName(); - - } - */ - return nullptr; -} - - } // End of namespace Titanic diff --git a/engines/titanic/core/project_item.h b/engines/titanic/core/project_item.h index 2ec3a73647..4271559184 100644 --- a/engines/titanic/core/project_item.h +++ b/engines/titanic/core/project_item.h @@ -166,9 +166,7 @@ public: */ CDontSaveFileItem *getDontSaveFileItem() const; - CRoomItem *findHiddenRoom() const; - - CNamedItem *findByName(const CString &name, int maxChars = 0) const; + CRoomItem *findHiddenRoom(); }; } // End of namespace Titanic diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index 22c4e1ddac..31deab860d 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -23,6 +23,7 @@ #include "titanic/core/tree_item.h" #include "titanic/core/dont_save_file_item.h" #include "titanic/core/file_item.h" +#include "titanic/core/named_item.h" namespace Titanic { @@ -154,4 +155,24 @@ void CTreeItem::detach() { _priorSibling = _nextSibling = _parent = nullptr; } +CNamedItem *CTreeItem::findByName(const CString &name, int maxLen) { + CString nameLower = name; + nameLower.toLowercase(); + + for (CTreeItem *treeItem = this; treeItem; treeItem = scan(treeItem)) { + CString nodeName = treeItem->getName(); + nodeName.toLowercase(); + + if (maxLen) { + if (nodeName.left(maxLen).compareTo(nameLower)) + return dynamic_cast(treeItem); + } else { + if (nodeName.compareTo(nameLower)) + return dynamic_cast(treeItem); + } + } + + return nullptr; +} + } // End of namespace Titanic diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index acfd8bf2f4..afca5254df 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -29,6 +29,7 @@ namespace Titanic { class CGameManager; class CDontSaveFileItem; +class CNamedItem; class CTreeItem: public CMessageTarget { private: @@ -61,6 +62,21 @@ public: */ virtual bool isFileItem() const { return false; } + /** + * Returns true if the item is a named item + */ + virtual bool isNamedItem() const { return false; } + + /** + * Gets the name of the item, if any + */ + virtual const CString getName() const { return CString(); } + + /** + * Compares the name of the item to a passed name + */ + virtual int compareTo(const CString &name, int maxLen) const { return false; } + /** * Get the parent for the given item */ @@ -131,6 +147,11 @@ public: * Detach the tree item from any other associated tree items */ void detach(); + + /** + * Finds a tree item by name + */ + CNamedItem *findByName(const CString &name, int maxLen = 0); }; } // End of namespace Titanic diff --git a/engines/titanic/string.cpp b/engines/titanic/string.cpp index 55b7f8ca52..128a9a38eb 100644 --- a/engines/titanic/string.cpp +++ b/engines/titanic/string.cpp @@ -20,8 +20,24 @@ * */ +#include "common/algorithm.h" #include "titanic/string.h" namespace Titanic { +CString CString::left(uint count) const { + return (count > size()) ? *this : CString(c_str(), c_str() + count); +} + +CString CString::right(uint count) const { + return (count > size()) ? *this : CString(c_str() - count, c_str()); +} + +CString CString::mid(uint start, uint count) const { + if (start >= size()) + return CString(); + else + return CString(c_str() + start, MIN(count, size() - start)); +} + } // End of namespace Titanic diff --git a/engines/titanic/string.h b/engines/titanic/string.h index 46cbb02ad5..076cce05a2 100644 --- a/engines/titanic/string.h +++ b/engines/titanic/string.h @@ -36,6 +36,21 @@ public: CString(const char *beginP, const char *endP) : Common::String(beginP, endP) {} CString(const String &str) : Common::String(str) {} explicit CString(char c) : Common::String(c) {} + + /** + * Returns the left n characters of the string + */ + CString left(uint count) const; + + /** + * Returns the right n characters of the string + */ + CString right(uint count) const; + + /** + * Returns a substring from within the string + */ + CString mid(uint start, uint count) const; }; } // End of namespace Titanic -- cgit v1.2.3 From 71c3129ecff1e5e4e847825eba58d1be9594b1c8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 8 Mar 2016 22:34:51 -0500 Subject: TITANIC: Added skeletons for game manager support classes --- engines/titanic/game_manager.cpp | 13 +++++- engines/titanic/game_manager.h | 23 +++++++++++ engines/titanic/game_state.cpp | 35 ++++++++++++++++ engines/titanic/game_state.h | 66 ++++++++++++++++++++++++++++++ engines/titanic/game_state_sub.cpp | 32 +++++++++++++++ engines/titanic/game_state_sub.h | 44 ++++++++++++++++++++ engines/titanic/input_handler.cpp | 39 ++++++++++++++++++ engines/titanic/input_handler.h | 53 ++++++++++++++++++++++++ engines/titanic/input_translator.cpp | 33 +++++++++++++++ engines/titanic/input_translator.h | 39 ++++++++++++++++++ engines/titanic/module.mk | 7 ++++ engines/titanic/npcs/true_talk_manager.cpp | 30 ++++++++++++++ engines/titanic/npcs/true_talk_manager.h | 39 ++++++++++++++++++ engines/titanic/screen_manager.cpp | 1 + engines/titanic/screen_manager.h | 2 + engines/titanic/sound/music_room.cpp | 31 ++++++++++++++ engines/titanic/sound/music_room.h | 39 ++++++++++++++++++ engines/titanic/sound/sound.cpp | 30 ++++++++++++++ engines/titanic/sound/sound.h | 39 ++++++++++++++++++ 19 files changed, 593 insertions(+), 2 deletions(-) create mode 100644 engines/titanic/game_state.cpp create mode 100644 engines/titanic/game_state.h create mode 100644 engines/titanic/game_state_sub.cpp create mode 100644 engines/titanic/game_state_sub.h create mode 100644 engines/titanic/input_handler.cpp create mode 100644 engines/titanic/input_handler.h create mode 100644 engines/titanic/input_translator.cpp create mode 100644 engines/titanic/input_translator.h create mode 100644 engines/titanic/npcs/true_talk_manager.cpp create mode 100644 engines/titanic/npcs/true_talk_manager.h create mode 100644 engines/titanic/sound/music_room.cpp create mode 100644 engines/titanic/sound/music_room.h create mode 100644 engines/titanic/sound/sound.cpp create mode 100644 engines/titanic/sound/sound.h diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index 6c9d5e1695..d8e64543fe 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -27,12 +27,21 @@ namespace Titanic { CGameManager::CGameManager(CProjectItem *project, CGameView *gameView): - _project(project), _gameView(gameView) { + _project(project), _gameView(gameView), _trueTalkManager(this), + _inputHandler(this), _inputTranslator(&_inputHandler), + _gameState(this), _sound(this), _musicRoom(this), + _videoSurface(nullptr), _field30(0), _field34(0), _field48(0), + _field4C(0), _field50(0), _field54(0), _tickCount(0) { // TODO } void CGameManager::load(SimpleFile *file) { - // TODO + file->readNumber(); + + //_gameState.load(file); + //_list.load(file); + + } void CGameManager::gameLoaded() { diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index d776c00048..7ba1b3e01c 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -24,7 +24,14 @@ #define TITANIC_GAME_MANAGER_H #include "common/scummsys.h" +#include "titanic/game_state.h" +#include "titanic/input_handler.h" +#include "titanic/input_translator.h" #include "titanic/simple_file.h" +#include "titanic/video_surface.h" +#include "titanic/npcs/true_talk_manager.h" +#include "titanic/sound/music_room.h" +#include "titanic/sound/sound.h" namespace Titanic { @@ -35,8 +42,24 @@ class CGameManager { private: CProjectItem *_project; CGameView *_gameView; + CGameState _gameState; + CSound _sound; + CInputHandler _inputHandler; + CInputTranslator _inputTranslator; + CMusicRoom _musicRoom; + CTrueTalkManager _trueTalkManager; + Common::Rect _bounds; + int _field30; + int _field34; + int _field48; + int _field4C; + int _field50; + int _field54; + CVideoSurface *_videoSurface; + int _tickCount; public: CGameManager(CProjectItem *project, CGameView *gameView); + ~CGameManager(); /** * Load data from a save file diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp new file mode 100644 index 0000000000..3ead6d153e --- /dev/null +++ b/engines/titanic/game_state.cpp @@ -0,0 +1,35 @@ +/* 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 "titanic/game_state.h" + +namespace Titanic { + +CGameState::CGameState(CGameManager *gameManager) : + _gameManager(gameManager), _sub(this), + _field8(0), _fieldC(0), _field10(10), _field14(0), _field18(0), + _field1C(0), _field20(0), _field24(0), _field28(0), _field2C(0), + _field30(0), _field34(0), _field38(0) { + +} + +} // End of namespace Titanic z diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h new file mode 100644 index 0000000000..f52e0d6b8d --- /dev/null +++ b/engines/titanic/game_state.h @@ -0,0 +1,66 @@ +/* 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. + * + */ + +#ifndef TITANIC_GAME_STATE_H +#define TITANIC_GAME_STATE_H + +#include "titanic/core/list.h" +#include "titanic/simple_file.h" +#include "titanic/game_state_sub.h" + +namespace Titanic { + +class CGameManager; + +class CGameStateList : public List { +public: + int _field10; + int _field14; +public: + CGameStateList() : List(), _field10(0), _field14(0) {} +}; + +class CGameState { +public: + CGameManager *_gameManager; + CGameStateSub _sub; + CGameStateList _list; + int _field8; + int _fieldC; + int _field10; + int _field14; + int _field18; + int _field1C; + int _field20; + int _field24; + int _field28; + int _field2C; + int _field30; + int _field34; + int _field38; +public: + CGameState(CGameManager *gameManager); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_GAME_STATE_H */ diff --git a/engines/titanic/game_state_sub.cpp b/engines/titanic/game_state_sub.cpp new file mode 100644 index 0000000000..11cea2b3b0 --- /dev/null +++ b/engines/titanic/game_state_sub.cpp @@ -0,0 +1,32 @@ +/* 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 "titanic/game_state_sub.h" +#include "titanic/game_state.h" + +namespace Titanic { + +CGameStateSub::CGameStateSub(CGameState *owner) : _gameState(owner), + _field0(0), _field4(0), _field8(0), _fieldC(0) { +} + +} // End of namespace Titanic z diff --git a/engines/titanic/game_state_sub.h b/engines/titanic/game_state_sub.h new file mode 100644 index 0000000000..41f27df8fc --- /dev/null +++ b/engines/titanic/game_state_sub.h @@ -0,0 +1,44 @@ +/* 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. + * + */ + +#ifndef TITANIC_GAME_STATE_SUB_H +#define TITANIC_GAME_STATE_SUB_H + +namespace Titanic { + +class CGameState; + +class CGameStateSub { +private: + CGameState *_gameState; +public: + int _field0; + int _field4; + int _field8; + int _fieldC; +public: + CGameStateSub(CGameState *owner); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_GAME_STATE_SUB_H */ diff --git a/engines/titanic/input_handler.cpp b/engines/titanic/input_handler.cpp new file mode 100644 index 0000000000..0c09429bd4 --- /dev/null +++ b/engines/titanic/input_handler.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/input_handler.h" +#include "titanic/screen_manager.h" + +namespace Titanic { + +CInputHandler::CInputHandler(CGameManager *owner) : + _gameManager(owner), _inputTranslator(nullptr), + _field4(0), _field8(0), _fieldC(0), _field10(0), _field14(0), + _field18(0), _field1C(0), _field20(0), _field24(0) { + CScreenManager::_screenManagerPtr->_inputHandler = this; +} + +void CInputHandler::setTranslator(CInputTranslator *translator) { + _inputTranslator = translator; +} + +} // End of namespace Titanic z diff --git a/engines/titanic/input_handler.h b/engines/titanic/input_handler.h new file mode 100644 index 0000000000..288630c633 --- /dev/null +++ b/engines/titanic/input_handler.h @@ -0,0 +1,53 @@ +/* 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. + * + */ + +#ifndef TITANIC_INPUT_HANDLER_H +#define TITANIC_INPUT_HANDLER_H + +#include "titanic/input_translator.h" + +namespace Titanic { + +class CGameManager; + +class CInputHandler { +public: + CGameManager *_gameManager; + CInputTranslator *_inputTranslator; + int _field4; + int _field8; + int _fieldC; + int _field10; + int _field14; + int _field18; + int _field1C; + int _field20; + int _field24; +public: + CInputHandler(CGameManager *owner); + + void setTranslator(CInputTranslator *translator); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_INPUT_HANDLER_H */ diff --git a/engines/titanic/input_translator.cpp b/engines/titanic/input_translator.cpp new file mode 100644 index 0000000000..b2ee6eb819 --- /dev/null +++ b/engines/titanic/input_translator.cpp @@ -0,0 +1,33 @@ +/* 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 "titanic/input_handler.h" +#include "titanic/input_translator.h" + +namespace Titanic { + +CInputTranslator::CInputTranslator(CInputHandler *inputHandler) : + _inputHandler(inputHandler) { + inputHandler->setTranslator(this); +} + +} // End of namespace Titanic z diff --git a/engines/titanic/input_translator.h b/engines/titanic/input_translator.h new file mode 100644 index 0000000000..98cd2bb09e --- /dev/null +++ b/engines/titanic/input_translator.h @@ -0,0 +1,39 @@ +/* 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. + * + */ + +#ifndef TITANIC_INPUT_TRANSLATOR_H +#define TITANIC_INPUT_TRANSLATOR_H + +namespace Titanic { + +class CInputHandler; + +class CInputTranslator { +public: + CInputHandler *_inputHandler; +public: + CInputTranslator(CInputHandler *inputHandler); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_INPUT_TRANSLATOR_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 6309ac8d8f..b150ba2fb2 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -5,8 +5,12 @@ MODULE_OBJS := \ direct_draw.o \ font.o \ game_manager.o \ + game_state.o \ + game_state_sub.o \ game_view.o \ image.o \ + input_handler.o \ + input_translator.o \ main_game_window.o \ screen_manager.o \ simple_file.o \ @@ -364,6 +368,7 @@ MODULE_OBJS := \ npcs/succubus.o \ npcs/summon_bots.o \ npcs/titania.o \ + npcs/true_talk_manager.o \ npcs/true_talk_npc.o \ pet_control/pet_control.o \ pet_control/pet_control_list_item.o \ @@ -391,12 +396,14 @@ MODULE_OBJS := \ sound/dome_from_top_of_well.o \ sound/enter_view_toggles_other_music.o \ sound/gondolier_song.o \ + sound/music_room.o \ sound/music_player.o \ sound/node_auto_sound_player.o \ sound/restricted_auto_music_player.o \ sound/room_auto_sound_player.o \ sound/season_noises.o \ sound/seasonal_music_player.o \ + sound/sound.o \ sound/titania_speech.o \ sound/trigger_auto_music_player.o \ sound/view_auto_sound_player.o \ diff --git a/engines/titanic/npcs/true_talk_manager.cpp b/engines/titanic/npcs/true_talk_manager.cpp new file mode 100644 index 0000000000..a9cc829e72 --- /dev/null +++ b/engines/titanic/npcs/true_talk_manager.cpp @@ -0,0 +1,30 @@ +/* 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 "titanic/npcs/true_talk_manager.h" + +namespace Titanic { + +CTrueTalkManager::CTrueTalkManager(CGameManager *owner) : _gameManager(owner) { +} + +} // End of namespace Titanic diff --git a/engines/titanic/npcs/true_talk_manager.h b/engines/titanic/npcs/true_talk_manager.h new file mode 100644 index 0000000000..decc593773 --- /dev/null +++ b/engines/titanic/npcs/true_talk_manager.h @@ -0,0 +1,39 @@ +/* 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. + * + */ + +#ifndef TITANIC_TRUE_TALK_MANAGER_H +#define TITANIC_TRUE_TALK_MANAGER_H + +namespace Titanic { + +class CGameManager; + +class CTrueTalkManager { +public: + CGameManager *_gameManager; +public: + CTrueTalkManager(CGameManager *owner); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TRUE_TALK_MANAGER_H */ diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp index 0846b81b60..1da9b585d8 100644 --- a/engines/titanic/screen_manager.cpp +++ b/engines/titanic/screen_manager.cpp @@ -44,6 +44,7 @@ CScreenManager::CScreenManager(TitanicEngine *vm): _vm(vm) { _frontRenderSurface = nullptr; _mouseCursor = nullptr; _textCursor = nullptr; + _inputHandler = nullptr; _fontNumber = 0; // TODO: Further initialization diff --git a/engines/titanic/screen_manager.h b/engines/titanic/screen_manager.h index 0b847c2b49..d56020afce 100644 --- a/engines/titanic/screen_manager.h +++ b/engines/titanic/screen_manager.h @@ -27,6 +27,7 @@ #include "common/array.h" #include "titanic/direct_draw.h" #include "titanic/font.h" +#include "titanic/input_handler.h" #include "titanic/video_surface.h" namespace Titanic { @@ -63,6 +64,7 @@ public: CScreenManagerRec _entries[2]; void *_mouseCursor; void *_textCursor; + CInputHandler *_inputHandler; int _fontNumber; public: CScreenManager(TitanicEngine *vm); diff --git a/engines/titanic/sound/music_room.cpp b/engines/titanic/sound/music_room.cpp new file mode 100644 index 0000000000..2b959a0847 --- /dev/null +++ b/engines/titanic/sound/music_room.cpp @@ -0,0 +1,31 @@ +/* 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 "titanic/sound/music_room.h" + +namespace Titanic { + +CMusicRoom::CMusicRoom(CGameManager *gameManager) : + _gameManager(gameManager) { +} + +} // End of namespace Titanic diff --git a/engines/titanic/sound/music_room.h b/engines/titanic/sound/music_room.h new file mode 100644 index 0000000000..7fcd99db1e --- /dev/null +++ b/engines/titanic/sound/music_room.h @@ -0,0 +1,39 @@ +/* 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. + * + */ + +#ifndef TITANIC_MUSIC_ROOM_H +#define TITANIC_MUSIC_ROOM_H + +namespace Titanic { + +class CGameManager; + +class CMusicRoom { +public: + CGameManager *_gameManager; +public: + CMusicRoom(CGameManager *owner); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MUSIC_ROOM_H */ diff --git a/engines/titanic/sound/sound.cpp b/engines/titanic/sound/sound.cpp new file mode 100644 index 0000000000..c0fd9fe2ed --- /dev/null +++ b/engines/titanic/sound/sound.cpp @@ -0,0 +1,30 @@ +/* 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 "titanic/sound/sound.h" + +namespace Titanic { + +CSound::CSound(CGameManager *owner) : _gameManager(owner) { +} + +} // End of namespace Titanic z diff --git a/engines/titanic/sound/sound.h b/engines/titanic/sound/sound.h new file mode 100644 index 0000000000..d9db81961a --- /dev/null +++ b/engines/titanic/sound/sound.h @@ -0,0 +1,39 @@ +/* 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. + * + */ + +#ifndef TITANIC_SOUND_H +#define TITANIC_SOUND_H + +namespace Titanic { + +class CGameManager; + +class CSound { +public: + CGameManager *_gameManager; +public: + CSound(CGameManager *owner); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SOUND_H */ -- cgit v1.2.3 From 759c0e3b4584d412f12250e0f248bad062581215 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 8 Mar 2016 22:56:34 -0500 Subject: TITANIC: More game manager setup --- engines/titanic/core/project_item.cpp | 5 +++++ engines/titanic/core/project_item.h | 5 +++++ engines/titanic/game_manager.cpp | 8 +++++--- engines/titanic/screen_manager.cpp | 6 +++++- engines/titanic/screen_manager.h | 4 ++-- 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp index de43b5bb41..18b0c42815 100644 --- a/engines/titanic/core/project_item.cpp +++ b/engines/titanic/core/project_item.cpp @@ -128,6 +128,11 @@ CGameManager *CProjectItem::getGameManager() const { return _gameManager; } +void CProjectItem::setGameManager(CGameManager *gameManager) { + if (!_gameManager) + _gameManager = gameManager; +} + void CProjectItem::resetGameManager() { _gameManager = nullptr; } diff --git a/engines/titanic/core/project_item.h b/engines/titanic/core/project_item.h index 4271559184..f4148b0678 100644 --- a/engines/titanic/core/project_item.h +++ b/engines/titanic/core/project_item.h @@ -121,6 +121,11 @@ public: */ virtual CGameManager *getGameManager() const; + /** + * Sets the game manager for the project, if not already set + */ + void setGameManager(CGameManager *gameManager); + /** * Get a reference to the PET control */ diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index d8e64543fe..b26c9b3297 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -21,8 +21,9 @@ */ #include "titanic/game_manager.h" -#include "titanic/messages/messages.h" #include "titanic/screen_manager.h" +#include "titanic/core/project_item.h" +#include "titanic/messages/messages.h" namespace Titanic { @@ -30,9 +31,10 @@ CGameManager::CGameManager(CProjectItem *project, CGameView *gameView): _project(project), _gameView(gameView), _trueTalkManager(this), _inputHandler(this), _inputTranslator(&_inputHandler), _gameState(this), _sound(this), _musicRoom(this), - _videoSurface(nullptr), _field30(0), _field34(0), _field48(0), + _field30(0), _field34(0), _field48(0), _field4C(0), _field50(0), _field54(0), _tickCount(0) { - // TODO + _videoSurface = CScreenManager::_screenManagerPtr->createSurface(600, 340); + _project->setGameManager(this); } void CGameManager::load(SimpleFile *file) { diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp index 1da9b585d8..145ba432c0 100644 --- a/engines/titanic/screen_manager.cpp +++ b/engines/titanic/screen_manager.cpp @@ -124,7 +124,11 @@ void OSScreenManager::proc18() {} void OSScreenManager::proc19() {} void OSScreenManager::proc20() {} void OSScreenManager::proc21() {} -void OSScreenManager::proc22() {} + +CVideoSurface *OSScreenManager::createSurface(int w, int h) { + error("TODO"); +} + void OSScreenManager::proc23() {} void OSScreenManager::proc24() {} void OSScreenManager::proc25() {} diff --git a/engines/titanic/screen_manager.h b/engines/titanic/screen_manager.h index d56020afce..914fc85eb7 100644 --- a/engines/titanic/screen_manager.h +++ b/engines/titanic/screen_manager.h @@ -93,7 +93,7 @@ public: virtual void proc19() = 0; virtual void proc20() = 0; virtual void proc21() = 0; - virtual void proc22() = 0; + virtual CVideoSurface *createSurface(int w, int h) = 0; virtual void proc23() = 0; virtual void proc24() = 0; virtual void proc25() = 0; @@ -142,7 +142,7 @@ public: virtual void proc19(); virtual void proc20(); virtual void proc21(); - virtual void proc22(); + virtual CVideoSurface *createSurface(int w, int h); virtual void proc23(); virtual void proc24(); virtual void proc25(); -- cgit v1.2.3 From 0fead6fe565d6e4a70adc1ab2273b55026e07655 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 10 Mar 2016 18:44:18 -0500 Subject: TITANIC: Beginnings of game manager data loading --- engines/titanic/game_manager.cpp | 7 +++-- engines/titanic/game_manager.h | 7 +++++ engines/titanic/game_state.cpp | 23 +++++++++++++++ engines/titanic/game_state.h | 10 +++++++ engines/titanic/game_state_sub.cpp | 13 +++++++++ engines/titanic/game_state_sub.h | 12 ++++++++ engines/titanic/npcs/true_talk_manager.cpp | 47 ++++++++++++++++++++++++++++++ engines/titanic/npcs/true_talk_manager.h | 26 +++++++++++++++++ engines/titanic/screen_manager.cpp | 3 +- engines/titanic/sound/sound.cpp | 8 +++++ engines/titanic/sound/sound.h | 12 ++++++++ 11 files changed, 164 insertions(+), 4 deletions(-) diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index b26c9b3297..b677bf28e0 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -40,9 +40,10 @@ CGameManager::CGameManager(CProjectItem *project, CGameView *gameView): void CGameManager::load(SimpleFile *file) { file->readNumber(); - //_gameState.load(file); - //_list.load(file); - + _gameState.load(file); + _list.load(file); + _trueTalkManager.load(file); + _sound.load(file); } diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index 7ba1b3e01c..200f34fd5c 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -38,6 +38,12 @@ namespace Titanic { class CProjectItem; class CGameView; +class CGameManagerListItem : public ListItem { +}; + +class CGameManagerList : public List { +}; + class CGameManager { private: CProjectItem *_project; @@ -49,6 +55,7 @@ private: CMusicRoom _musicRoom; CTrueTalkManager _trueTalkManager; Common::Rect _bounds; + CGameManagerList _list; int _field30; int _field34; int _field48; diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index 3ead6d153e..59e4b7b837 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -29,7 +29,30 @@ CGameState::CGameState(CGameManager *gameManager) : _field8(0), _fieldC(0), _field10(10), _field14(0), _field18(0), _field1C(0), _field20(0), _field24(0), _field28(0), _field2C(0), _field30(0), _field34(0), _field38(0) { +} + +void CGameState::save(SimpleFile *file) const { + file->writeNumber(_field18); + file->writeNumber(_field8); + file->writeNumber(_fieldC); + file->writeNumber(_field14); + file->writeNumber(_field24); + file->writeNumber(_field38); + _sub.save(file); + file->writeNumber(_field1C); +} + +void CGameState::load(SimpleFile *file) { + _field18 = file->readNumber(); + _field8 = file->readNumber(); + _fieldC = file->readNumber(); + _field14 = file->readNumber(); + _field24 = file->readNumber(); + _field38 = file->readNumber(); + _sub.load(file); + _field1C = file->readNumber(); + _field28 = _field2C = 0; } } // End of namespace Titanic z diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h index f52e0d6b8d..e6275dee01 100644 --- a/engines/titanic/game_state.h +++ b/engines/titanic/game_state.h @@ -59,6 +59,16 @@ public: int _field38; public: CGameState(CGameManager *gameManager); + + /** + * Save the data for the class to file + */ + void save(SimpleFile *file) const; + + /** + * Load the data for the class from file + */ + void load(SimpleFile *file); }; } // End of namespace Titanic diff --git a/engines/titanic/game_state_sub.cpp b/engines/titanic/game_state_sub.cpp index 11cea2b3b0..212fcce676 100644 --- a/engines/titanic/game_state_sub.cpp +++ b/engines/titanic/game_state_sub.cpp @@ -29,4 +29,17 @@ CGameStateSub::CGameStateSub(CGameState *owner) : _gameState(owner), _field0(0), _field4(0), _field8(0), _fieldC(0) { } +void CGameStateSub::save(SimpleFile *file) const { + file->writeNumber(_field4); + file->writeNumber(_field8); + file->writeNumber(_fieldC); +} + +void CGameStateSub::load(SimpleFile *file) { + _field0 = 0; + _field4 = file->readNumber(); + _field8 = file->readNumber(); + _fieldC = file->readNumber(); +} + } // End of namespace Titanic z diff --git a/engines/titanic/game_state_sub.h b/engines/titanic/game_state_sub.h index 41f27df8fc..2ea6bd60b0 100644 --- a/engines/titanic/game_state_sub.h +++ b/engines/titanic/game_state_sub.h @@ -23,6 +23,8 @@ #ifndef TITANIC_GAME_STATE_SUB_H #define TITANIC_GAME_STATE_SUB_H +#include "titanic/simple_file.h" + namespace Titanic { class CGameState; @@ -37,6 +39,16 @@ public: int _fieldC; public: CGameStateSub(CGameState *owner); + + /** + * Save the data for the class to file + */ + void save(SimpleFile *file) const; + + /** + * Load the data for the class from file + */ + void load(SimpleFile *file); }; } // End of namespace Titanic diff --git a/engines/titanic/npcs/true_talk_manager.cpp b/engines/titanic/npcs/true_talk_manager.cpp index a9cc829e72..dbf97128a7 100644 --- a/engines/titanic/npcs/true_talk_manager.cpp +++ b/engines/titanic/npcs/true_talk_manager.cpp @@ -24,7 +24,54 @@ namespace Titanic { +int CTrueTalkManager::_v1; +int CTrueTalkManager::_v2; +int CTrueTalkManager::_v3; +bool CTrueTalkManager::_v4; +bool CTrueTalkManager::_v5; +int CTrueTalkManager::_v6; +int CTrueTalkManager::_v7; +bool CTrueTalkManager::_v8; +int CTrueTalkManager::_v9; +bool CTrueTalkManager::_v10; +int CTrueTalkManager::_v11[41]; + CTrueTalkManager::CTrueTalkManager(CGameManager *owner) : _gameManager(owner) { } +void CTrueTalkManager::save(SimpleFile *file) const { + +} + +void CTrueTalkManager::load(SimpleFile *file) { + loadStatics(file); + + int count = file->readNumber(); + //TODO +} + +void CTrueTalkManager::loadStatics(SimpleFile *file) { + int count = file->readNumber(); + _v1 = file->readNumber(); + _v2 = file->readNumber(); + _v3 = file->readNumber(); + _v4 = file->readNumber() != 0; + _v5 = file->readNumber() != 0; + _v6 = file->readNumber(); + _v7 = file->readNumber(); + _v8 = file->readNumber() != 0; + _v9 = file->readNumber(); + _v10 = file->readNumber() != 0; + + for (int idx = count; count > 10; --idx) + file->readNumber(); + + int count2 = file->readNumber(); + for (int idx = 0; idx < count2; ++idx) { + int v = file->readNumber(); + if (idx < 41) + _v11[idx] = v; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/npcs/true_talk_manager.h b/engines/titanic/npcs/true_talk_manager.h index decc593773..d491a61dab 100644 --- a/engines/titanic/npcs/true_talk_manager.h +++ b/engines/titanic/npcs/true_talk_manager.h @@ -23,15 +23,41 @@ #ifndef TITANIC_TRUE_TALK_MANAGER_H #define TITANIC_TRUE_TALK_MANAGER_H +#include "titanic/simple_file.h" + namespace Titanic { class CGameManager; class CTrueTalkManager { +private: + void loadStatics(SimpleFile *file); +public: + static int _v1; + static int _v2; + static int _v3; + static bool _v4; + static bool _v5; + static int _v6; + static int _v7; + static bool _v8; + static int _v9; + static bool _v10; + static int _v11[41]; public: CGameManager *_gameManager; public: CTrueTalkManager(CGameManager *owner); + + /** + * Save the data for the class to file + */ + void save(SimpleFile *file) const; + + /** + * Load the data for the class from file + */ + void load(SimpleFile *file); }; } // End of namespace Titanic diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp index 145ba432c0..47e5d3d49a 100644 --- a/engines/titanic/screen_manager.cpp +++ b/engines/titanic/screen_manager.cpp @@ -126,7 +126,8 @@ void OSScreenManager::proc20() {} void OSScreenManager::proc21() {} CVideoSurface *OSScreenManager::createSurface(int w, int h) { - error("TODO"); + warning("TODO"); + return nullptr; } void OSScreenManager::proc23() {} diff --git a/engines/titanic/sound/sound.cpp b/engines/titanic/sound/sound.cpp index c0fd9fe2ed..cea377eef7 100644 --- a/engines/titanic/sound/sound.cpp +++ b/engines/titanic/sound/sound.cpp @@ -27,4 +27,12 @@ namespace Titanic { CSound::CSound(CGameManager *owner) : _gameManager(owner) { } +void CSound::save(SimpleFile *file) const { + +} + +void CSound::load(SimpleFile *file) { + +} + } // End of namespace Titanic z diff --git a/engines/titanic/sound/sound.h b/engines/titanic/sound/sound.h index d9db81961a..2d0ccecbc5 100644 --- a/engines/titanic/sound/sound.h +++ b/engines/titanic/sound/sound.h @@ -23,6 +23,8 @@ #ifndef TITANIC_SOUND_H #define TITANIC_SOUND_H +#include "titanic/simple_file.h" + namespace Titanic { class CGameManager; @@ -32,6 +34,16 @@ public: CGameManager *_gameManager; public: CSound(CGameManager *owner); + + /** + * Save the data for the class to file + */ + void save(SimpleFile *file) const; + + /** + * Load the data for the class from file + */ + void load(SimpleFile *file); }; } // End of namespace Titanic -- cgit v1.2.3 From e68e8334ed1d0516d68e19a716ca0feeed6c3de1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 11 Mar 2016 22:55:14 -0500 Subject: TITANIC: Beginnings of True Talk scripts hierarchy --- engines/titanic/game_manager.h | 2 +- engines/titanic/module.mk | 9 +- engines/titanic/npcs/true_talk_manager.cpp | 77 ----------- engines/titanic/npcs/true_talk_manager.h | 65 --------- engines/titanic/true_talk/true_talk_manager.cpp | 77 +++++++++++ engines/titanic/true_talk/true_talk_manager.h | 67 ++++++++++ engines/titanic/true_talk/tt_named_script.cpp | 171 ++++++++++++++++++++++++ engines/titanic/true_talk/tt_named_script.h | 104 ++++++++++++++ engines/titanic/true_talk/tt_script_base.cpp | 92 +++++++++++++ engines/titanic/true_talk/tt_script_base.h | 70 ++++++++++ engines/titanic/true_talk/tt_scripts.cpp | 28 ++++ engines/titanic/true_talk/tt_scripts.h | 35 +++++ engines/titanic/true_talk/tt_string.cpp | 27 ++++ engines/titanic/true_talk/tt_string.h | 43 ++++++ engines/titanic/true_talk/tt_unnamed_script.cpp | 64 +++++++++ engines/titanic/true_talk/tt_unnamed_script.h | 62 +++++++++ 16 files changed, 848 insertions(+), 145 deletions(-) delete mode 100644 engines/titanic/npcs/true_talk_manager.cpp delete mode 100644 engines/titanic/npcs/true_talk_manager.h create mode 100644 engines/titanic/true_talk/true_talk_manager.cpp create mode 100644 engines/titanic/true_talk/true_talk_manager.h create mode 100644 engines/titanic/true_talk/tt_named_script.cpp create mode 100644 engines/titanic/true_talk/tt_named_script.h create mode 100644 engines/titanic/true_talk/tt_script_base.cpp create mode 100644 engines/titanic/true_talk/tt_script_base.h create mode 100644 engines/titanic/true_talk/tt_scripts.cpp create mode 100644 engines/titanic/true_talk/tt_scripts.h create mode 100644 engines/titanic/true_talk/tt_string.cpp create mode 100644 engines/titanic/true_talk/tt_string.h create mode 100644 engines/titanic/true_talk/tt_unnamed_script.cpp create mode 100644 engines/titanic/true_talk/tt_unnamed_script.h diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index 200f34fd5c..37a4a415fb 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -29,7 +29,7 @@ #include "titanic/input_translator.h" #include "titanic/simple_file.h" #include "titanic/video_surface.h" -#include "titanic/npcs/true_talk_manager.h" +#include "titanic/true_talk/true_talk_manager.h" #include "titanic/sound/music_room.h" #include "titanic/sound/sound.h" diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index b150ba2fb2..8a248d1595 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -368,7 +368,6 @@ MODULE_OBJS := \ npcs/succubus.o \ npcs/summon_bots.o \ npcs/titania.o \ - npcs/true_talk_manager.o \ npcs/true_talk_npc.o \ pet_control/pet_control.o \ pet_control/pet_control_list_item.o \ @@ -424,7 +423,13 @@ MODULE_OBJS := \ star_control/star_control_sub12.o \ star_control/star_control_sub13.o \ star_control/star_control_sub14.o \ - star_control/star_control_sub15.o + star_control/star_control_sub15.o \ + true_talk/true_talk_manager.o \ + true_talk/tt_script_base.o \ + true_talk/tt_unnamed_script.o \ + true_talk/tt_named_script.o \ + true_talk/tt_scripts.o \ + true_talk/tt_string.o # This module can be built as a plugin ifeq ($(ENABLE_TITANIC), DYNAMIC_PLUGIN) diff --git a/engines/titanic/npcs/true_talk_manager.cpp b/engines/titanic/npcs/true_talk_manager.cpp deleted file mode 100644 index dbf97128a7..0000000000 --- a/engines/titanic/npcs/true_talk_manager.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* 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 "titanic/npcs/true_talk_manager.h" - -namespace Titanic { - -int CTrueTalkManager::_v1; -int CTrueTalkManager::_v2; -int CTrueTalkManager::_v3; -bool CTrueTalkManager::_v4; -bool CTrueTalkManager::_v5; -int CTrueTalkManager::_v6; -int CTrueTalkManager::_v7; -bool CTrueTalkManager::_v8; -int CTrueTalkManager::_v9; -bool CTrueTalkManager::_v10; -int CTrueTalkManager::_v11[41]; - -CTrueTalkManager::CTrueTalkManager(CGameManager *owner) : _gameManager(owner) { -} - -void CTrueTalkManager::save(SimpleFile *file) const { - -} - -void CTrueTalkManager::load(SimpleFile *file) { - loadStatics(file); - - int count = file->readNumber(); - //TODO -} - -void CTrueTalkManager::loadStatics(SimpleFile *file) { - int count = file->readNumber(); - _v1 = file->readNumber(); - _v2 = file->readNumber(); - _v3 = file->readNumber(); - _v4 = file->readNumber() != 0; - _v5 = file->readNumber() != 0; - _v6 = file->readNumber(); - _v7 = file->readNumber(); - _v8 = file->readNumber() != 0; - _v9 = file->readNumber(); - _v10 = file->readNumber() != 0; - - for (int idx = count; count > 10; --idx) - file->readNumber(); - - int count2 = file->readNumber(); - for (int idx = 0; idx < count2; ++idx) { - int v = file->readNumber(); - if (idx < 41) - _v11[idx] = v; - } -} - -} // End of namespace Titanic diff --git a/engines/titanic/npcs/true_talk_manager.h b/engines/titanic/npcs/true_talk_manager.h deleted file mode 100644 index d491a61dab..0000000000 --- a/engines/titanic/npcs/true_talk_manager.h +++ /dev/null @@ -1,65 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_TRUE_TALK_MANAGER_H -#define TITANIC_TRUE_TALK_MANAGER_H - -#include "titanic/simple_file.h" - -namespace Titanic { - -class CGameManager; - -class CTrueTalkManager { -private: - void loadStatics(SimpleFile *file); -public: - static int _v1; - static int _v2; - static int _v3; - static bool _v4; - static bool _v5; - static int _v6; - static int _v7; - static bool _v8; - static int _v9; - static bool _v10; - static int _v11[41]; -public: - CGameManager *_gameManager; -public: - CTrueTalkManager(CGameManager *owner); - - /** - * Save the data for the class to file - */ - void save(SimpleFile *file) const; - - /** - * Load the data for the class from file - */ - void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_TRUE_TALK_MANAGER_H */ diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp new file mode 100644 index 0000000000..aeaa677371 --- /dev/null +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -0,0 +1,77 @@ +/* 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 "titanic/true_talk/true_talk_manager.h" + +namespace Titanic { + +int CTrueTalkManager::_v1; +int CTrueTalkManager::_v2; +int CTrueTalkManager::_v3; +bool CTrueTalkManager::_v4; +bool CTrueTalkManager::_v5; +int CTrueTalkManager::_v6; +int CTrueTalkManager::_v7; +bool CTrueTalkManager::_v8; +int CTrueTalkManager::_v9; +bool CTrueTalkManager::_v10; +int CTrueTalkManager::_v11[41]; + +CTrueTalkManager::CTrueTalkManager(CGameManager *owner) : _gameManager(owner) { +} + +void CTrueTalkManager::save(SimpleFile *file) const { + +} + +void CTrueTalkManager::load(SimpleFile *file) { + loadStatics(file); + + int count = file->readNumber(); + //TODO +} + +void CTrueTalkManager::loadStatics(SimpleFile *file) { + int count = file->readNumber(); + _v1 = file->readNumber(); + _v2 = file->readNumber(); + _v3 = file->readNumber(); + _v4 = file->readNumber() != 0; + _v5 = file->readNumber() != 0; + _v6 = file->readNumber(); + _v7 = file->readNumber(); + _v8 = file->readNumber() != 0; + _v9 = file->readNumber(); + _v10 = file->readNumber() != 0; + + for (int idx = count; count > 10; --idx) + file->readNumber(); + + int count2 = file->readNumber(); + for (int idx = 0; idx < count2; ++idx) { + int v = file->readNumber(); + if (idx < 41) + _v11[idx] = v; + } +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h new file mode 100644 index 0000000000..b61bc3d6ad --- /dev/null +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -0,0 +1,67 @@ +/* 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. + * + */ + +#ifndef TITANIC_TRUE_TALK_MANAGER_H +#define TITANIC_TRUE_TALK_MANAGER_H + +#include "titanic/simple_file.h" +#include "titanic/true_talk/tt_scripts.h" + +namespace Titanic { + +class CGameManager; + +class CTrueTalkManager { +private: + void loadStatics(SimpleFile *file); +public: + static int _v1; + static int _v2; + static int _v3; + static bool _v4; + static bool _v5; + static int _v6; + static int _v7; + static bool _v8; + static int _v9; + static bool _v10; + static int _v11[41]; +public: + CGameManager *_gameManager; + TTScripts _scripts; +public: + CTrueTalkManager(CGameManager *owner); + + /** + * Save the data for the class to file + */ + void save(SimpleFile *file) const; + + /** + * Load the data for the class from file + */ + void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TRUE_TALK_MANAGER_H */ diff --git a/engines/titanic/true_talk/tt_named_script.cpp b/engines/titanic/true_talk/tt_named_script.cpp new file mode 100644 index 0000000000..6f12012b10 --- /dev/null +++ b/engines/titanic/true_talk/tt_named_script.cpp @@ -0,0 +1,171 @@ +/* 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/textconsole.h" +#include "titanic/true_talk/tt_named_script.h" + +namespace Titanic { + +TTNamedScriptBase::TTNamedScriptBase(int val1, const char *charClass, int v2, + const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : + TTScriptBase(0, charClass, v2, charName, v3, v4, v5, v6, v7), + _val1(val1), _field54(0), _val2(val2) { +} + +/*------------------------------------------------------------------------*/ + +TTNamedScript::TTNamedScript(int val1, const char *charClass, int v2, + const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : + TTNamedScriptBase(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { + +} + +void TTNamedScript::proc4(int v) { + warning("TODO"); +} + +int TTNamedScript::proc6() const { + return 1; +} + +void TTNamedScript::proc7(int v1, int v2) { + warning("TODO"); +} + +int TTNamedScript::proc8() const { + return 0; +} + +int TTNamedScript::proc9() const { + return 2; +} + +int TTNamedScript::proc10() const { + return 2; +} + +int TTNamedScript::proc11() const { + return 2; +} + +int TTNamedScript::proc12() const { + return 1; +} + +void TTNamedScript::proc13() const { + warning("TODO"); +} + +void TTNamedScript::proc14(int v) { + warning("TODO"); +} + +int TTNamedScript::proc15() const { + return 0; +} + +int TTNamedScript::proc16() const { + return 1; +} + +int TTNamedScript::proc17() const { + return 1; +} + +int TTNamedScript::proc18() const { + return 1; +} + +void TTNamedScript::proc19(int v) { + warning("TODO"); +} + +void TTNamedScript::proc20(int v) { + warning("TODO"); +} + +int TTNamedScript::proc21(int v) { + return v; +} + +int TTNamedScript::proc22() const { + return 0; +} + +int TTNamedScript::proc23() const { + return 0; +} + +int TTNamedScript::proc25() const { + return 0; +} + +void TTNamedScript::proc26() { +} + +void TTNamedScript::save1(SimpleFile *file) { + error("TODO"); +} + +void TTNamedScript::proc28(int v) { + warning("TODO"); +} + +void TTNamedScript::save2(SimpleFile *file) { + error("TODO"); +} + +void TTNamedScript::proc30(int v) { + warning("TODO"); +} + +void TTNamedScript::proc31() { + warning("TODO"); +} + +void TTNamedScript::proc32() { + warning("TODO"); +} + +void TTNamedScript::proc33(int v1, int v2) { + warning("TODO"); +} + +int TTNamedScript::proc34() { + warning("TODO"); + return 0; +} + +int TTNamedScript::proc35(int v1, int v2) { + warning("TODO"); + return 0; +} + +int TTNamedScript::proc36() const { + return 0; +} + +int TTNamedScript::proc37() const { + return 0; +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_named_script.h b/engines/titanic/true_talk/tt_named_script.h new file mode 100644 index 0000000000..cdff44888d --- /dev/null +++ b/engines/titanic/true_talk/tt_named_script.h @@ -0,0 +1,104 @@ +/* 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. + * + */ + +#ifndef TITANIC_TT_NAMED_SCRIPT_H +#define TITANIC_TT_NAMED_SCRIPT_H + +#include "titanic/simple_file.h" +#include "titanic/true_talk/tt_script_base.h" + +namespace Titanic { + + +class TTNamedScriptBase : public TTScriptBase { +protected: + int _val1; + int _field54; + int _val2; +public: + TTNamedScriptBase(int val1, const char *charClass, int v2, + const char *charName, int v3, int val2, int v4, + int v5, int v6, int v7); + + virtual void proc6() = 0; + virtual void proc7() = 0; + virtual void proc8() = 0; + virtual void proc9() = 0; + virtual void proc10() = 0; + virtual void proc11() = 0; + virtual void proc12() = 0; +}; +class TTNamedScript : public TTNamedScriptBase { +private: + int _field5C; + int _field60; + int _field64; + int _field68; + int _field6C; + int _field70; + int _field74; + int _field78; + int _field7C; + int _field80; +public: + TTNamedScript(int val1, const char *charClass, int v2, + const char *charName, int v3, int val2, int v4, + int v5, int v6, int v7); + + virtual void proc4(int v); + virtual int proc6() const; + virtual void proc7(int v1, int v2); + virtual int proc8() const; + virtual int proc9() const; + virtual int proc10() const; + virtual int proc11() const; + virtual int proc12() const; + virtual void proc13() const; + virtual void proc14(int v); + virtual int proc15() const; + virtual int proc16() const; + virtual int proc17() const; + virtual int proc18() const; + virtual void proc19(int v); + virtual void proc20(int v); + virtual int proc21(int v); + virtual int proc22() const; + virtual int proc23() const; + virtual void proc24() = 0; + virtual int proc25() const; + virtual void proc26(); + virtual void save1(SimpleFile *file); + virtual void proc28(int v); + virtual void save2(SimpleFile *file); + virtual void proc30(int v); + virtual void proc31(); + virtual void proc32(); + virtual void proc33(int v1, int v2); + virtual int proc34(); + virtual int proc35(int v1, int v2); + virtual int proc36() const; + virtual int proc37() const; +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_CHARACTER1_H */ diff --git a/engines/titanic/true_talk/tt_script_base.cpp b/engines/titanic/true_talk/tt_script_base.cpp new file mode 100644 index 0000000000..1430f031ce --- /dev/null +++ b/engines/titanic/true_talk/tt_script_base.cpp @@ -0,0 +1,92 @@ +/* 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/textconsole.h" +#include "titanic/true_talk/tt_script_base.h" + +namespace Titanic { + +TTScriptBase::TTScriptBase(int v1, const char *charClass, int v2, + const char *charName, int v3, int v4, int v5, int v6, int v7) : + _charName(charName), _charClass(charClass), + _field4(0), _field8(0), _fieldC(0), + _field20(0), _field24(0), _field28(0), _field2C(0), + _field30(0), _field34(0), _field38(0), _field3C(0), + _field40(0), _field44(0), _field48(0), _status(0) { + if (!areNamesValid()) { + if (!v7 || !getStatus()) { + _field8 = v1; + _field20 = v3; + _field24 = v4; + _field28 = v5; + _field2C = v6; + _field30 = v7; + _field34 = v2; + } else { + _status = 5; + } + } + + if (_status) + reset(); +} + +bool TTScriptBase::areNamesValid() { + bool result = !_charName.isValid() && !_charClass.isValid(); + _status = result ? 0 : 11; + return result; +} + +void TTScriptBase::reset() { + _field4 = 0; + _field8 = 4; + _fieldC = 0; + _field20 = 0; + _field24 = -1; + _field28 = -1; + _field2C = -1; + _field30 = 0; + _field34 = 0; + _field38 = 0; + _field3C = 0; + _field40 = 0; + _field44 = 0; + _field48 = 0; +} + +void TTScriptBase::proc2(int v) { + warning("TODO"); +} + +void TTScriptBase::proc3(int v) { + warning("TODO"); +} + +void TTScriptBase::proc4(int v) { + warning("TODO"); +} + +void TTScriptBase::proc5() { + warning("TODO"); +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_script_base.h b/engines/titanic/true_talk/tt_script_base.h new file mode 100644 index 0000000000..4021a0b738 --- /dev/null +++ b/engines/titanic/true_talk/tt_script_base.h @@ -0,0 +1,70 @@ +/* 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. + * + */ + +#ifndef TITANIC_TT_SCRIPT_BASE_H +#define TITANIC_TT_SCRIPT_BASE_H + +#include "titanic/true_talk/tt_string.h" + +namespace Titanic { + +class TTScriptBase { +private: + void reset(); +protected: + int _field4; + int _field8; + int _fieldC; + TTString _charName, _charClass; + int _field20; + int _field24; + int _field28; + int _field2C; + int _field30; + int _field34; + int _field38; + int _field3C; + int _field40; + int _field44; + int _field48; + int _status; +public: + TTScriptBase(int v1, const char *charClass, int v2, const char *charName, + int v3, int v4, int v5, int v6, int v7); + + bool areNamesValid(); + + int getStatus() const { return _status; } + + virtual void proc2(int v); + + virtual void proc3(int v); + + virtual void proc4(int v); + + virtual void proc5(); +}; + + +} // End of namespace Titanic + +#endif /* TITANIC_TT_SCRIPT_BASE_H */ diff --git a/engines/titanic/true_talk/tt_scripts.cpp b/engines/titanic/true_talk/tt_scripts.cpp new file mode 100644 index 0000000000..52368adc7f --- /dev/null +++ b/engines/titanic/true_talk/tt_scripts.cpp @@ -0,0 +1,28 @@ +/* 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 "titanic/true_talk/tt_scripts.h" + +namespace Titanic { + + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_scripts.h b/engines/titanic/true_talk/tt_scripts.h new file mode 100644 index 0000000000..b87a7c2a1a --- /dev/null +++ b/engines/titanic/true_talk/tt_scripts.h @@ -0,0 +1,35 @@ +/* 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. + * + */ + +#ifndef TITANIC_TT_SCRIPTS_H +#define TITANIC_TT_SCRIPTS_H + +namespace Titanic { + +class TTScripts { +public: + TTScripts() {} +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_CHARACTERS_H */ diff --git a/engines/titanic/true_talk/tt_string.cpp b/engines/titanic/true_talk/tt_string.cpp new file mode 100644 index 0000000000..f9ae5d6e11 --- /dev/null +++ b/engines/titanic/true_talk/tt_string.cpp @@ -0,0 +1,27 @@ +/* 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 "titanic/true_talk/tt_string.h" + +namespace Titanic { + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h new file mode 100644 index 0000000000..8f42e62783 --- /dev/null +++ b/engines/titanic/true_talk/tt_string.h @@ -0,0 +1,43 @@ +/* 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. + * + */ + +#ifndef TITANIC_TT_STRING_H +#define TITANIC_TT_STRING_H + +#include "titanic/string.h" + +namespace Titanic { + +class TTString: public CString { +public: + int _status; +public: + TTString() : CString(), _status(0) {} + TTString(const char *str) : CString(str), _status(0) {} + ~TTString(); + + bool isValid() const { return !_status; } +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_OBJ8_H */ diff --git a/engines/titanic/true_talk/tt_unnamed_script.cpp b/engines/titanic/true_talk/tt_unnamed_script.cpp new file mode 100644 index 0000000000..8c91290fba --- /dev/null +++ b/engines/titanic/true_talk/tt_unnamed_script.cpp @@ -0,0 +1,64 @@ +/* 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/textconsole.h" +#include "titanic/true_talk/tt_unnamed_script.h" + +namespace Titanic { + +TTUnnamedScriptBase::TTUnnamedScriptBase(int scriptId, + const char *charClass, const char *charName, + int v3, int v4, int v5, int v6, int v2, int v7) : _scriptId(scriptId), + TTScriptBase(3, charClass, v2, charName, v3, v4, v5, v6, v7) { +} + +/*------------------------------------------------------------------------*/ + +TTUnnamedScript::TTUnnamedScript(int scriptId) : + TTUnnamedScriptBase(scriptId, "", "", 0, -1, -1, -1, 0, 0) { +} + +void TTUnnamedScript::proc6() { + warning("TODO"); +} + +void TTUnnamedScript::proc7() { + warning("TODO"); +} + +void TTUnnamedScript::proc8() { + warning("TODO"); +} + +void TTUnnamedScript::proc9() { + warning("TODO"); +} + +void TTUnnamedScript::proc10() { + warning("TODO"); +} + +void TTUnnamedScript::proc11() { + warning("TODO"); +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_unnamed_script.h b/engines/titanic/true_talk/tt_unnamed_script.h new file mode 100644 index 0000000000..f4702166b1 --- /dev/null +++ b/engines/titanic/true_talk/tt_unnamed_script.h @@ -0,0 +1,62 @@ +/* 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. + * + */ + +#ifndef TITANIC_TT_UNNAMED_SCRIPT_H +#define TITANIC_TT_UNNAMED_SCRIPT_H + +#include "titanic/true_talk/tt_script_base.h" + +namespace Titanic { + +class TTUnnamedScriptBase : public TTScriptBase { +protected: + int _scriptId; +public: + TTUnnamedScriptBase(int scriptId, const char *charClass, const char *charName, + int v3, int v4, int v5, int v6, int v2, int v7); + + virtual void proc6() = 0; + virtual void proc7() = 0; + virtual void proc8() = 0; + virtual void proc9() = 0; + virtual void proc10() = 0; + virtual void proc11() = 0; +}; + + +class TTUnnamedScript : public TTUnnamedScriptBase { +private: + int _field54; +public: + TTUnnamedScript(int scriptId); + + virtual void proc6(); + virtual void proc7(); + virtual void proc8(); + virtual void proc9(); + virtual void proc10(); + virtual void proc11(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_UNNAMED_SCRIPT_H */ -- cgit v1.2.3 From c0de794584e1e4689db48eb1c94dc9d9aa7726c7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 12 Mar 2016 07:59:44 -0500 Subject: TITANIC: Added stubs for the different script classes --- engines/titanic/core/list.h | 20 ++++ engines/titanic/module.mk | 9 ++ engines/titanic/true_talk/barbot_script.cpp | 103 +++++++++++++++++++ engines/titanic/true_talk/barbot_script.h | 56 ++++++++++ engines/titanic/true_talk/bellbot_script.cpp | 114 +++++++++++++++++++++ engines/titanic/true_talk/bellbot_script.h | 60 +++++++++++ engines/titanic/true_talk/deskbot_script.cpp | 131 ++++++++++++++++++++++++ engines/titanic/true_talk/deskbot_script.h | 59 +++++++++++ engines/titanic/true_talk/doorbot_script.cpp | 103 +++++++++++++++++++ engines/titanic/true_talk/doorbot_script.h | 58 +++++++++++ engines/titanic/true_talk/liftbot_script.cpp | 103 +++++++++++++++++++ engines/titanic/true_talk/liftbot_script.h | 56 ++++++++++ engines/titanic/true_talk/maitred_script.cpp | 103 +++++++++++++++++++ engines/titanic/true_talk/maitred_script.h | 52 ++++++++++ engines/titanic/true_talk/parrot_script.cpp | 69 +++++++++++++ engines/titanic/true_talk/parrot_script.h | 49 +++++++++ engines/titanic/true_talk/succubus_script.cpp | 74 +++++++++++++ engines/titanic/true_talk/succubus_script.h | 53 ++++++++++ engines/titanic/true_talk/title_engine.cpp | 27 +++++ engines/titanic/true_talk/title_engine.h | 33 ++++++ engines/titanic/true_talk/true_talk_manager.cpp | 39 ++++++- engines/titanic/true_talk/true_talk_manager.h | 10 +- engines/titanic/true_talk/tt_named_script.cpp | 17 +++ engines/titanic/true_talk/tt_named_script.h | 22 ++-- engines/titanic/true_talk/tt_scripts.cpp | 34 ++++++ engines/titanic/true_talk/tt_scripts.h | 33 +++++- engines/titanic/true_talk/tt_string.h | 2 +- 27 files changed, 1475 insertions(+), 14 deletions(-) create mode 100644 engines/titanic/true_talk/barbot_script.cpp create mode 100644 engines/titanic/true_talk/barbot_script.h create mode 100644 engines/titanic/true_talk/bellbot_script.cpp create mode 100644 engines/titanic/true_talk/bellbot_script.h create mode 100644 engines/titanic/true_talk/deskbot_script.cpp create mode 100644 engines/titanic/true_talk/deskbot_script.h create mode 100644 engines/titanic/true_talk/doorbot_script.cpp create mode 100644 engines/titanic/true_talk/doorbot_script.h create mode 100644 engines/titanic/true_talk/liftbot_script.cpp create mode 100644 engines/titanic/true_talk/liftbot_script.h create mode 100644 engines/titanic/true_talk/maitred_script.cpp create mode 100644 engines/titanic/true_talk/maitred_script.h create mode 100644 engines/titanic/true_talk/parrot_script.cpp create mode 100644 engines/titanic/true_talk/parrot_script.h create mode 100644 engines/titanic/true_talk/succubus_script.cpp create mode 100644 engines/titanic/true_talk/succubus_script.h create mode 100644 engines/titanic/true_talk/title_engine.cpp create mode 100644 engines/titanic/true_talk/title_engine.h diff --git a/engines/titanic/core/list.h b/engines/titanic/core/list.h index 312405dca9..e3623c15b4 100644 --- a/engines/titanic/core/list.h +++ b/engines/titanic/core/list.h @@ -48,6 +48,26 @@ public: virtual void load(SimpleFile *file); }; +/** + * List item macro for managed pointers an item + */ +#define PTR_LIST_ITEM(T) class T##ListItem : public ListItem { \ + public: T *_item; \ + T##ListItem() : _item(nullptr) {} \ + T##ListItem(T *item) : _item(item) {} \ + virtual ~T##ListItem() { delete _item; } \ + } + +template +class PtrListItem : public ListItem { +public: + T *_item; +public: + PtrListItem() : _item(nullptr) {} + PtrListItem(T *item) : _item(item) {} + virtual ~PtrListItem() { delete _item; } +}; + template class List : public CSaveableObject, public Common::List { public: diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 8a248d1595..bfb9317adc 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -424,6 +424,15 @@ MODULE_OBJS := \ star_control/star_control_sub13.o \ star_control/star_control_sub14.o \ star_control/star_control_sub15.o \ + true_talk/barbot_script.o \ + true_talk/bellbot_script.o \ + true_talk/deskbot_script.o \ + true_talk/doorbot_script.o \ + true_talk/liftbot_script.o \ + true_talk/maitred_script.o \ + true_talk/parrot_script.o \ + true_talk/succubus_script.o \ + true_talk/title_engine.o \ true_talk/true_talk_manager.o \ true_talk/tt_script_base.o \ true_talk/tt_unnamed_script.o \ diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp new file mode 100644 index 0000000000..a9a0be16c3 --- /dev/null +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -0,0 +1,103 @@ +/* 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/textconsole.h" +#include "titanic/true_talk/barbot_script.h" + +namespace Titanic { + +int BarbotScript::proc6() const { + warning("TODO"); + return 2; +} + +void BarbotScript::proc7(int v1, int v2) { + warning("TODO"); +} + +int BarbotScript::proc10() const { + warning("TODO"); + return 0; +} + +int BarbotScript::proc15() const { + warning("TODO"); + return 0; +} + +int BarbotScript::proc16() const { + warning("TODO"); + return 0; +} + +int BarbotScript::proc17() const { + warning("TODO"); + return 0; +} + +int BarbotScript::proc18() const { + warning("TODO"); + return 0; +} + +int BarbotScript::proc21(int v) { + warning("TODO"); + return 0; +} + +int BarbotScript::proc22() const { + warning("TODO"); + return 0; +} + +int BarbotScript::proc23() const { + warning("TODO"); + return 0; +} + +void BarbotScript::proc24() { + warning("TODO"); +} + +int BarbotScript::proc25() const { + warning("TODO"); + return 0; +} + +void BarbotScript::proc26() { +} + +void BarbotScript::proc32() { + warning("TODO"); +} + +int BarbotScript::proc36() const { + warning("TODO"); + return 0; +} + +int BarbotScript::proc37() const { + warning("TODO"); + return 0; +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h new file mode 100644 index 0000000000..f40c67dfab --- /dev/null +++ b/engines/titanic/true_talk/barbot_script.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_BARBOT_SCRIPT_H +#define TITANIC_BARBOT_SCRIPT_H + +#include "titanic/true_talk/tt_named_script.h" + +namespace Titanic { + +class BarbotScript : public TTNamedScript { +public: + BarbotScript(int val1, const char *charClass, int v2, + const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : + TTNamedScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} + + virtual int proc6() const; + virtual void proc7(int v1, int v2); + virtual int proc10() const; + virtual int proc15() const; + virtual int proc16() const; + virtual int proc17() const; + virtual int proc18() const; + virtual int proc21(int v); + virtual int proc22() const; + virtual int proc23() const; + virtual void proc24(); + virtual int proc25() const; + virtual void proc26(); + virtual void proc32(); + virtual int proc36() const; + virtual int proc37() const; +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BARBOT_SCRIPT_H */ diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp new file mode 100644 index 0000000000..a296752004 --- /dev/null +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -0,0 +1,114 @@ +/* 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/textconsole.h" +#include "titanic/true_talk/bellbot_script.h" +#include "titanic/true_talk/true_talk_manager.h" + +namespace Titanic { + +BellbotScript::BellbotScript(int val1, const char *charClass, int v2, + const char *charName, int v3, int val2) : + TTNamedScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0), + _field2D0(0), _field2D4(0), _field2D8(0), _field2DC(0) { + CTrueTalkManager::setFlags(25, 0); + CTrueTalkManager::setFlags(24, 0); + CTrueTalkManager::setFlags(40, 0); + CTrueTalkManager::setFlags(26, 0); + + randomizeFlags(); + _array[0] = 100; + _array[1] = 0; +} + +int BellbotScript::proc6() const { + warning("TODO"); + return 2; +} + +void BellbotScript::proc7(int v1, int v2) { + warning("TODO"); +} + +int BellbotScript::proc10() const { + warning("TODO"); + return 0; +} + +int BellbotScript::proc15() const { + warning("TODO"); + return 0; +} + +int BellbotScript::proc16() const { + warning("TODO"); + return 0; +} + +int BellbotScript::proc17() const { + warning("TODO"); + return 0; +} + +int BellbotScript::proc18() const { + warning("TODO"); + return 0; +} + +int BellbotScript::proc21(int v) { + warning("TODO"); + return 0; +} + +int BellbotScript::proc22() const { + warning("TODO"); + return 0; +} + +int BellbotScript::proc23() const { + warning("TODO"); + return 0; +} + +void BellbotScript::proc24() { + warning("TODO"); +} + +int BellbotScript::proc25() const { + warning("TODO"); + return 0; +} + +void BellbotScript::proc26() { +} + +int BellbotScript::proc36() const { + warning("TODO"); + return 0; +} + +int BellbotScript::proc37() const { + warning("TODO"); + return 0; +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h new file mode 100644 index 0000000000..e792d160e4 --- /dev/null +++ b/engines/titanic/true_talk/bellbot_script.h @@ -0,0 +1,60 @@ +/* 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. + * + */ + +#ifndef TITANIC_BELLBOT_SCRIPT_H +#define TITANIC_BELLBOT_SCRIPT_H + +#include "titanic/true_talk/tt_named_script.h" + +namespace Titanic { + +class BellbotScript : public TTNamedScript { +private: + int _array[150]; + int _field2D0; + int _field2D4; + int _field2D8; + int _field2DC; +public: + BellbotScript(int val1, const char *charClass, int v2, + const char *charName, int v3, int val2); + + virtual int proc6() const; + virtual void proc7(int v1, int v2); + virtual int proc10() const; + virtual int proc15() const; + virtual int proc16() const; + virtual int proc17() const; + virtual int proc18() const; + virtual int proc21(int v); + virtual int proc22() const; + virtual int proc23() const; + virtual void proc24(); + virtual int proc25() const; + virtual void proc26(); + virtual int proc36() const; + virtual int proc37() const; +}; + +} // End of namespace Titanic + +#endif /* TITANIC_BELLBOT_SCRIPT_H */ diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp new file mode 100644 index 0000000000..b79714e2e1 --- /dev/null +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -0,0 +1,131 @@ +/* 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/textconsole.h" +#include "titanic/true_talk/deskbot_script.h" +#include "titanic/true_talk/true_talk_manager.h" + +namespace Titanic { + +DeskbotScript::DeskbotScript(int val1, const char *charClass, int v2, + const char *charName, int v3, int val2) : + TTNamedScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0) { + CTrueTalkManager::setFlags(18, 0); + CTrueTalkManager::setFlags(19, 0); + CTrueTalkManager::setFlags(20, 0); + CTrueTalkManager::setFlags(21, 0); + CTrueTalkManager::setFlags(22, 0); + + randomizeFlags(); + _array[0] = 100; + if (_field74 == 1) + _field74 = 0; +} + +int DeskbotScript::proc6() const { + warning("TODO"); + return 2; +} + +void DeskbotScript::proc7(int v1, int v2) { + warning("TODO"); +} + +int DeskbotScript::proc10() const { + warning("TODO"); + return 0; +} + +int DeskbotScript::proc15() const { + warning("TODO"); + return 0; +} + +int DeskbotScript::proc16() const { + warning("TODO"); + return 0; +} + +int DeskbotScript::proc17() const { + warning("TODO"); + return 0; +} + +int DeskbotScript::proc18() const { + warning("TODO"); + return 0; +} + +int DeskbotScript::proc21(int v) { + warning("TODO"); + return 0; +} + +int DeskbotScript::proc22() const { + warning("TODO"); + return 0; +} + +int DeskbotScript::proc23() const { + warning("TODO"); + return 0; +} + +void DeskbotScript::proc24() { + warning("TODO"); +} + +int DeskbotScript::proc25() const { + warning("TODO"); + return 0; +} + +void DeskbotScript::proc26() { +} + +int DeskbotScript::proc36() const { + warning("TODO"); + return 0; +} + +int DeskbotScript::proc37() const { + warning("TODO"); + return 0; +} + +void DeskbotScript::proc38() { + warning("TODO"); +} + +void DeskbotScript::proc39() { + warning("TODO"); +} + +void DeskbotScript::proc40() { + warning("TODO"); +} + +void DeskbotScript::proc41() { + warning("TODO"); +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h new file mode 100644 index 0000000000..c40aca988a --- /dev/null +++ b/engines/titanic/true_talk/deskbot_script.h @@ -0,0 +1,59 @@ +/* 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. + * + */ + +#ifndef TITANIC_DESKBOT_SCRIPT_H +#define TITANIC_DESKBOT_SCRIPT_H + +#include "titanic/true_talk/tt_named_script.h" + +namespace Titanic { + +class DeskbotScript : public TTNamedScript { +public: + DeskbotScript(int val1, const char *charClass, int v2, + const char *charName, int v3, int val2); + + virtual int proc6() const; + virtual void proc7(int v1, int v2); + virtual int proc10() const; + virtual int proc15() const; + virtual int proc16() const; + virtual int proc17() const; + virtual int proc18() const; + virtual int proc21(int v); + virtual int proc22() const; + virtual int proc23() const; + virtual void proc24(); + virtual int proc25() const; + virtual void proc26(); + virtual int proc36() const; + virtual int proc37() const; + + virtual void proc38(); + virtual void proc39(); + virtual void proc40(); + virtual void proc41(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DESKBOT_SCRIPT_H */ diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp new file mode 100644 index 0000000000..4bca9a6491 --- /dev/null +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -0,0 +1,103 @@ +/* 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/textconsole.h" +#include "titanic/true_talk/doorbot_script.h" + +namespace Titanic { + +int DoorbotScript::proc6() const { + warning("TODO"); + return 2; +} + +void DoorbotScript::proc7(int v1, int v2) { + warning("TODO"); +} + +int DoorbotScript::proc10() const { + warning("TODO"); + return 0; +} + +int DoorbotScript::proc15() const { + warning("TODO"); + return 0; +} + +int DoorbotScript::proc16() const { + warning("TODO"); + return 0; +} + +int DoorbotScript::proc17() const { + warning("TODO"); + return 0; +} + +int DoorbotScript::proc18() const { + warning("TODO"); + return 0; +} + +int DoorbotScript::proc21(int v) { + warning("TODO"); + return 0; +} + +int DoorbotScript::proc22() const { + warning("TODO"); + return 0; +} + +int DoorbotScript::proc23() const { + warning("TODO"); + return 0; +} + +void DoorbotScript::proc24() { + warning("TODO"); +} + +int DoorbotScript::proc25() const { + warning("TODO"); + return 0; +} + +void DoorbotScript::proc26() { +} + +void DoorbotScript::proc32() { + warning("TODO"); +} + +int DoorbotScript::proc36() const { + warning("TODO"); + return 0; +} + +int DoorbotScript::proc37() const { + warning("TODO"); + return 0; +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h new file mode 100644 index 0000000000..549476036d --- /dev/null +++ b/engines/titanic/true_talk/doorbot_script.h @@ -0,0 +1,58 @@ +/* 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. + * + */ + +#ifndef TITANIC_DOORBOT_SCRIPT_H +#define TITANIC_DOORBOT_SCRIPT_H + +#include "titanic/true_talk/tt_named_script.h" + +namespace Titanic { + +class DoorbotScript : public TTNamedScript { +private: + int _array[148]; +public: + DoorbotScript(int val1, const char *charClass, int v2, + const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : + TTNamedScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} + + virtual int proc6() const; + virtual void proc7(int v1, int v2); + virtual int proc10() const; + virtual int proc15() const; + virtual int proc16() const; + virtual int proc17() const; + virtual int proc18() const; + virtual int proc21(int v); + virtual int proc22() const; + virtual int proc23() const; + virtual void proc24(); + virtual int proc25() const; + virtual void proc26(); + virtual void proc32(); + virtual int proc36() const; + virtual int proc37() const; +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_CHARACTER1_H */ diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp new file mode 100644 index 0000000000..4bd994fbbc --- /dev/null +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -0,0 +1,103 @@ +/* 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/textconsole.h" +#include "titanic/true_talk/liftbot_script.h" + +namespace Titanic { + +int LiftbotScript::proc6() const { + warning("TODO"); + return 2; +} + +void LiftbotScript::proc7(int v1, int v2) { + warning("TODO"); +} + +int LiftbotScript::proc9() const { + warning("TODO"); + return 0; +} + +int LiftbotScript::proc10() const { + warning("TODO"); + return 0; +} + +int LiftbotScript::proc15() const { + warning("TODO"); + return 0; +} + +int LiftbotScript::proc16() const { + warning("TODO"); + return 0; +} + +int LiftbotScript::proc17() const { + warning("TODO"); + return 0; +} + +int LiftbotScript::proc18() const { + warning("TODO"); + return 0; +} + +int LiftbotScript::proc21(int v) { + warning("TODO"); + return 0; +} + +int LiftbotScript::proc22() const { + warning("TODO"); + return 0; +} + +int LiftbotScript::proc23() const { + warning("TODO"); + return 0; +} + +void LiftbotScript::proc24() { + warning("TODO"); +} + +int LiftbotScript::proc25() const { + warning("TODO"); + return 0; +} + +void LiftbotScript::proc26() { +} + +void LiftbotScript::proc32() { + warning("TODO"); +} + +int LiftbotScript::proc37() const { + warning("TODO"); + return 0; +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h new file mode 100644 index 0000000000..ddbdabb145 --- /dev/null +++ b/engines/titanic/true_talk/liftbot_script.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_LIFTBOT_SCRIPT_H +#define TITANIC_LIFTBOT_SCRIPT_H + +#include "titanic/true_talk/tt_named_script.h" + +namespace Titanic { + +class LiftbotScript : public TTNamedScript { +public: + LiftbotScript(int val1, const char *charClass, int v2, + const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : + TTNamedScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} + + virtual int proc6() const; + virtual void proc7(int v1, int v2); + virtual int proc9() const; + virtual int proc10() const; + virtual int proc15() const; + virtual int proc16() const; + virtual int proc17() const; + virtual int proc18() const; + virtual int proc21(int v); + virtual int proc22() const; + virtual int proc23() const; + virtual void proc24(); + virtual int proc25() const; + virtual void proc26(); + virtual void proc32(); + virtual int proc37() const; +}; + +} // End of namespace Titanic + +#endif /* TITANIC_LIFTBOT_SCRIPT_H */ diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp new file mode 100644 index 0000000000..1caec6249b --- /dev/null +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -0,0 +1,103 @@ +/* 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/textconsole.h" +#include "titanic/true_talk/maitred_script.h" +#include "titanic/true_talk/true_talk_manager.h" + +namespace Titanic { + +MaitreDScript::MaitreDScript(int val1, const char *charClass, int v2, + const char *charName, int v3, int val2) : + TTNamedScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0) { + CTrueTalkManager::setFlags(9, 1); + CTrueTalkManager::setFlags(10, 0); + CTrueTalkManager::setFlags(11, 0); + CTrueTalkManager::setFlags(12, 0); + CTrueTalkManager::setFlags(13, 0); + CTrueTalkManager::setFlags(14, 0); + CTrueTalkManager::setFlags(15, 0); + CTrueTalkManager::setFlags(16, 0); +} + +int MaitreDScript::proc6() const { + warning("TODO"); + return 2; +} + +void MaitreDScript::proc7(int v1, int v2) { + warning("TODO"); +} + +int MaitreDScript::proc10() const { + warning("TODO"); + return 0; +} + +int MaitreDScript::proc16() const { + warning("TODO"); + return 0; +} + +int MaitreDScript::proc17() const { + warning("TODO"); + return 0; +} + +int MaitreDScript::proc18() const { + warning("TODO"); + return 0; +} + +int MaitreDScript::proc21(int v) { + warning("TODO"); + return 0; +} + +int MaitreDScript::proc22() const { + warning("TODO"); + return 0; +} + +int MaitreDScript::proc23() const { + warning("TODO"); + return 0; +} + +void MaitreDScript::proc24() { + warning("TODO"); +} + +int MaitreDScript::proc25() const { + warning("TODO"); + return 0; +} + +void MaitreDScript::proc26() { +} + +int MaitreDScript::proc37() const { + warning("TODO"); + return 0; +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h new file mode 100644 index 0000000000..2af3f42dac --- /dev/null +++ b/engines/titanic/true_talk/maitred_script.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_MAITRED_SCRIPT_H +#define TITANIC_MAITRED_SCRIPT_H + +#include "titanic/true_talk/tt_named_script.h" + +namespace Titanic { + +class MaitreDScript : public TTNamedScript { +public: + MaitreDScript(int val1, const char *charClass, int v2, + const char *charName, int v3, int val2); + + virtual int proc6() const; + virtual void proc7(int v1, int v2); + virtual int proc10() const; + virtual int proc16() const; + virtual int proc17() const; + virtual int proc18() const; + virtual int proc21(int v); + virtual int proc22() const; + virtual int proc23() const; + virtual void proc24(); + virtual int proc25() const; + virtual void proc26(); + virtual int proc37() const; +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MAITRED_SCRIPT_H */ diff --git a/engines/titanic/true_talk/parrot_script.cpp b/engines/titanic/true_talk/parrot_script.cpp new file mode 100644 index 0000000000..9772f2111c --- /dev/null +++ b/engines/titanic/true_talk/parrot_script.cpp @@ -0,0 +1,69 @@ +/* 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/textconsole.h" +#include "titanic/true_talk/parrot_script.h" + +namespace Titanic { + +int ParrotScript::proc6() const { + warning("TODO"); + return 2; +} + +void ParrotScript::proc7(int v1, int v2) { + warning("TODO"); +} + +int ParrotScript::proc10() const { + warning("TODO"); + return 0; +} + +int ParrotScript::proc17() const { + warning("TODO"); + return 0; +} + +int ParrotScript::proc18() const { + warning("TODO"); + return 0; +} + +int ParrotScript::proc23() const { + warning("TODO"); + return 0; +} + +void ParrotScript::proc24() { + warning("TODO"); +} + +int ParrotScript::proc25() const { + warning("TODO"); + return 0; +} + +void ParrotScript::proc26() { +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/parrot_script.h b/engines/titanic/true_talk/parrot_script.h new file mode 100644 index 0000000000..0dde14d10f --- /dev/null +++ b/engines/titanic/true_talk/parrot_script.h @@ -0,0 +1,49 @@ +/* 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. + * + */ + +#ifndef TITANIC_PARROT_SCRIPT_H +#define TITANIC_PARROT_SCRIPT_H + +#include "titanic/true_talk/tt_named_script.h" + +namespace Titanic { + +class ParrotScript : public TTNamedScript { +public: + ParrotScript(int val1, const char *charClass, int v2, + const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : + TTNamedScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} + + virtual int proc6() const; + virtual void proc7(int v1, int v2); + virtual int proc10() const; + virtual int proc17() const; + virtual int proc18() const; + virtual int proc23() const; + virtual void proc24(); + virtual int proc25() const; + virtual void proc26(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PARROT_SCRIPT_H */ diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp new file mode 100644 index 0000000000..c21edefd8f --- /dev/null +++ b/engines/titanic/true_talk/succubus_script.cpp @@ -0,0 +1,74 @@ +/* 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/textconsole.h" +#include "titanic/true_talk/succubus_script.h" + +namespace Titanic { + +int SuccUBusScript::proc6() const { + warning("TODO"); + return 2; +} + +void SuccUBusScript::proc7(int v1, int v2) { + warning("TODO"); +} + +int SuccUBusScript::proc10() const { + warning("TODO"); + return 0; +} + +int SuccUBusScript::proc17() const { + warning("TODO"); + return 0; +} + +int SuccUBusScript::proc18() const { + warning("TODO"); + return 0; +} + +int SuccUBusScript::proc21(int v) { + warning("TODO"); + return 0; +} + +int SuccUBusScript::proc23() const { + warning("TODO"); + return 0; +} + +void SuccUBusScript::proc24() { + warning("TODO"); +} + +int SuccUBusScript::proc25() const { + warning("TODO"); + return 0; +} + +void SuccUBusScript::proc26() { +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h new file mode 100644 index 0000000000..595657b8e7 --- /dev/null +++ b/engines/titanic/true_talk/succubus_script.h @@ -0,0 +1,53 @@ +/* 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. + * + */ + +#ifndef TITANIC_SUCCUBUS_SCRIPT_H +#define TITANIC_SUCCUBUS_SCRIPT_H + +#include "titanic/true_talk/tt_named_script.h" + +namespace Titanic { + +class SuccUBusScript : public TTNamedScript { +private: + int _field2D0; +public: + SuccUBusScript(int val1, const char *charClass, int v2, + const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : + TTNamedScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7), + _field2D0(0) {} + + virtual int proc6() const; + virtual void proc7(int v1, int v2); + virtual int proc10() const; + virtual int proc17() const; + virtual int proc18() const; + virtual int proc21(int v); + virtual int proc23() const; + virtual void proc24(); + virtual int proc25() const; + virtual void proc26(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SUCCUBUS_SCRIPT_H */ diff --git a/engines/titanic/true_talk/title_engine.cpp b/engines/titanic/true_talk/title_engine.cpp new file mode 100644 index 0000000000..1369af6a5c --- /dev/null +++ b/engines/titanic/true_talk/title_engine.cpp @@ -0,0 +1,27 @@ +/* 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 "titanic/true_talk/title_engine.h" + +namespace Titanic { + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/title_engine.h b/engines/titanic/true_talk/title_engine.h new file mode 100644 index 0000000000..c854704cdc --- /dev/null +++ b/engines/titanic/true_talk/title_engine.h @@ -0,0 +1,33 @@ +/* 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. + * + */ + +#ifndef TITANIC_TITLE_ENGINE_H +#define TITANIC_TITLE_ENGINE_H + +namespace Titanic { + +class CTitleEngine { +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TITLE_ENGINE_H */ diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index aeaa677371..d48a4d3b3d 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -36,7 +36,8 @@ int CTrueTalkManager::_v9; bool CTrueTalkManager::_v10; int CTrueTalkManager::_v11[41]; -CTrueTalkManager::CTrueTalkManager(CGameManager *owner) : _gameManager(owner) { +CTrueTalkManager::CTrueTalkManager(CGameManager *owner) : + _gameManager(owner), _scripts(&_titleEngine) { } void CTrueTalkManager::save(SimpleFile *file) const { @@ -74,4 +75,40 @@ void CTrueTalkManager::loadStatics(SimpleFile *file) { } } +void CTrueTalkManager::setFlags(int index, int val) { + switch (index) { + case 1: + if (val >= 1 && val <= 3) + _v3 = val; + break; + + case 2: + _v4 = !val; + break; + + case 3: + _v5 = val != 0; + break; + + case 4: + if (val >= 0 && val <= 3) + _v6 = val; + break; + + case 5: + _v7 = val; + break; + + case 6: + _v8 = val != 0; + break; + + default: + if (index < 41) + _v11[index] = val; + break; + } +} + + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index b61bc3d6ad..7bf0f5f331 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -24,6 +24,7 @@ #define TITANIC_TRUE_TALK_MANAGER_H #include "titanic/simple_file.h" +#include "titanic/true_talk/title_engine.h" #include "titanic/true_talk/tt_scripts.h" namespace Titanic { @@ -31,6 +32,10 @@ namespace Titanic { class CGameManager; class CTrueTalkManager { +private: + CGameManager *_gameManager; + CTitleEngine _titleEngine; + TTScripts _scripts; private: void loadStatics(SimpleFile *file); public: @@ -45,9 +50,8 @@ public: static int _v9; static bool _v10; static int _v11[41]; -public: - CGameManager *_gameManager; - TTScripts _scripts; + + static void setFlags(int index, int val); public: CTrueTalkManager(CGameManager *owner); diff --git a/engines/titanic/true_talk/tt_named_script.cpp b/engines/titanic/true_talk/tt_named_script.cpp index 6f12012b10..8d225f1b28 100644 --- a/engines/titanic/true_talk/tt_named_script.cpp +++ b/engines/titanic/true_talk/tt_named_script.cpp @@ -22,6 +22,7 @@ #include "common/textconsole.h" #include "titanic/true_talk/tt_named_script.h" +#include "titanic/true_talk/true_talk_manager.h" namespace Titanic { @@ -36,7 +37,23 @@ TTNamedScriptBase::TTNamedScriptBase(int val1, const char *charClass, int v2, TTNamedScript::TTNamedScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTNamedScriptBase(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { + CTrueTalkManager::_v2 = 0; + Common::fill(&_array[0], &_array[147], 0); + if (!CTrueTalkManager::_v10) { + Common::fill(&CTrueTalkManager::_v11[0], &CTrueTalkManager::_v11[41], 0); + CTrueTalkManager::_v10 = true; + } + + resetFlags(); +} + +void TTNamedScript::resetFlags() { + Common::fill(&_array[26], &_array[146], 0); +} + +void TTNamedScript::randomizeFlags() { + warning("TODO"); } void TTNamedScript::proc4(int v) { diff --git a/engines/titanic/true_talk/tt_named_script.h b/engines/titanic/true_talk/tt_named_script.h index cdff44888d..b747cee498 100644 --- a/engines/titanic/true_talk/tt_named_script.h +++ b/engines/titanic/true_talk/tt_named_script.h @@ -39,16 +39,17 @@ public: const char *charName, int v3, int val2, int v4, int v5, int v6, int v7); - virtual void proc6() = 0; - virtual void proc7() = 0; - virtual void proc8() = 0; - virtual void proc9() = 0; - virtual void proc10() = 0; - virtual void proc11() = 0; - virtual void proc12() = 0; + virtual int proc6() const = 0; + virtual void proc7(int v1, int v2) = 0; + virtual int proc8() const = 0; + virtual int proc9() const = 0; + virtual int proc10() const = 0; + virtual int proc11() const = 0; + virtual int proc12() const = 0; }; + class TTNamedScript : public TTNamedScriptBase { -private: +protected: int _field5C; int _field60; int _field64; @@ -59,6 +60,11 @@ private: int _field78; int _field7C; int _field80; + int _array[147]; +protected: + void resetFlags(); + + void randomizeFlags(); public: TTNamedScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, diff --git a/engines/titanic/true_talk/tt_scripts.cpp b/engines/titanic/true_talk/tt_scripts.cpp index 52368adc7f..981fe66933 100644 --- a/engines/titanic/true_talk/tt_scripts.cpp +++ b/engines/titanic/true_talk/tt_scripts.cpp @@ -21,8 +21,42 @@ */ #include "titanic/true_talk/tt_scripts.h" +#include "titanic/true_talk/title_engine.h" +#include "titanic/true_talk/barbot_script.h" +#include "titanic/true_talk/bellbot_script.h" +#include "titanic/true_talk/deskbot_script.h" +#include "titanic/true_talk/doorbot_script.h" +#include "titanic/true_talk/liftbot_script.h" +#include "titanic/true_talk/maitred_script.h" +#include "titanic/true_talk/parrot_script.h" +#include "titanic/true_talk/succubus_script.h" namespace Titanic { +TTScripts::TTScripts(CTitleEngine *titleEngine) : + _titleEngine(titleEngine), _field24(0), _field28(0) { + // Load unnamed scripts + for (int scriptNum = 100; scriptNum < 133; ++scriptNum) + addScript(new TTUnnamedScript(scriptNum)); + + // Load named scripts + addScript(new DoorbotScript(104, "Doorbot", 0, "Fentible", 11, 1, -1, -1, -1, 0)); + addScript(new BellbotScript(101, "Bellbot", 0, "Krage", 8, 1)); + addScript(new LiftbotScript(105, "LiftBot", 0, "Nobby", 11, 1, -1, -1, -1, 0)); + addScript(new DeskbotScript(103, "DeskBot", 0, "Marsinta", 11, 2)); + addScript(new BarbotScript(100, "Barbot", 0, "Fortillian", 9, 1, -1, -1, -1, 0)); + addScript(new ParrotScript(107, "Parrot", 0, "The Parrot", 5, 1, -1, -1, -1, 0)); + addScript(new MaitreDScript(112, "MaitreDBot", 0, "Dastrogaaar", 8, 1)); + addScript(new SuccUBusScript(111, "Succubus", 0, "Shorbert", 9, 1, -1, -1, -1, 0)); +} + +void TTScripts::addScript(TTNamedScript *script) { + script->proc13(); + _namedScripts.push_back(new TTNamedScriptListItem(script)); +} + +void TTScripts::addScript(TTUnnamedScript *script) { + _unnamedScripts.push_back(new TTUnnamedScriptListItem(script)); +} } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_scripts.h b/engines/titanic/true_talk/tt_scripts.h index b87a7c2a1a..e47a7b2f87 100644 --- a/engines/titanic/true_talk/tt_scripts.h +++ b/engines/titanic/true_talk/tt_scripts.h @@ -23,11 +23,42 @@ #ifndef TITANIC_TT_SCRIPTS_H #define TITANIC_TT_SCRIPTS_H +#include "titanic/core/list.h" +#include "titanic/true_talk/tt_named_script.h" +#include "titanic/true_talk/tt_unnamed_script.h" + namespace Titanic { +class CTitleEngine; + +PTR_LIST_ITEM(TTNamedScript); +PTR_LIST_ITEM(TTUnnamedScript); + +class TTNamedScriptList : public List { +}; + +class TTUnamedScriptList : public List { +}; + class TTScripts { +private: + TTNamedScriptList _namedScripts; + TTUnamedScriptList _unnamedScripts; + CTitleEngine *_titleEngine; + int _field24; + int _field28; +private: + /** + * Add a named script to the named scripts list + */ + void addScript(TTNamedScript *script); + + /** + * Add an unnamed script to the unnamed scripts list + */ + void addScript(TTUnnamedScript *script); public: - TTScripts() {} + TTScripts(CTitleEngine *titleEngine); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index 8f42e62783..cf940a4d32 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -33,7 +33,7 @@ public: public: TTString() : CString(), _status(0) {} TTString(const char *str) : CString(str), _status(0) {} - ~TTString(); + virtual ~TTString() {} bool isValid() const { return !_status; } }; -- cgit v1.2.3 From 60e137c65121bd284b200d97cc930c4d1e15114c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 12 Mar 2016 10:51:34 -0500 Subject: TITANIC: Implemented true talk manager & script loading --- engines/titanic/true_talk/true_talk_manager.cpp | 51 ++++++++++++++++- engines/titanic/true_talk/true_talk_manager.h | 17 +++++- engines/titanic/true_talk/tt_named_script.cpp | 74 ++++++++++++++++++++----- engines/titanic/true_talk/tt_named_script.h | 23 +++++--- engines/titanic/true_talk/tt_scripts.cpp | 57 +++++++++++++++---- engines/titanic/true_talk/tt_scripts.h | 32 +++++++++-- engines/titanic/true_talk/tt_unnamed_script.h | 2 +- 7 files changed, 215 insertions(+), 41 deletions(-) diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index d48a4d3b3d..416a4e2a72 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -22,6 +22,8 @@ #include "titanic/true_talk/true_talk_manager.h" +#define MKTAG_BE(a3,a2,a1,a0) ((uint32)((a3) | ((a2) << 8) | ((a1) << 16) | ((a0) << 24))) + namespace Titanic { int CTrueTalkManager::_v1; @@ -41,14 +43,31 @@ CTrueTalkManager::CTrueTalkManager(CGameManager *owner) : } void CTrueTalkManager::save(SimpleFile *file) const { - + saveStatics(file); + + saveNPC(file, 101); + saveNPC(file, 103); + saveNPC(file, 104); + saveNPC(file, 105); + saveNPC(file, 111); + saveNPC(file, 100); + saveNPC(file, 112); + saveNPC(file, 107); + file->writeNumber(0); } void CTrueTalkManager::load(SimpleFile *file) { loadStatics(file); - int count = file->readNumber(); - //TODO + // Iterate through loading characters + int charId = file->readNumber(); + while (charId) { + uint ident = MKTAG_BE('U', 'R', 'A', 'H'); + + do { + + } while (1); + } } void CTrueTalkManager::loadStatics(SimpleFile *file) { @@ -75,6 +94,24 @@ void CTrueTalkManager::loadStatics(SimpleFile *file) { } } +void CTrueTalkManager::saveStatics(SimpleFile *file) { + file->writeNumber(10); + file->writeNumber(_v1); + file->writeNumber(_v2); + file->writeNumber(_v3); + file->writeNumber(_v4 ? 1 : 0); + file->writeNumber(_v5 ? 1 : 0); + file->writeNumber(_v6); + file->writeNumber(_v7); + file->writeNumber(_v8 ? 1 : 0); + file->writeNumber(_v9); + file->writeNumber(_v10 ? 1 : 0); + + file->writeNumber(41); + for (int idx = 0; idx < 41; ++idx) + file->writeNumber(_v11[idx]); +} + void CTrueTalkManager::setFlags(int index, int val) { switch (index) { case 1: @@ -110,5 +147,13 @@ void CTrueTalkManager::setFlags(int index, int val) { } } +void CTrueTalkManager::saveNPC(SimpleFile *file, int charId) const { + TTNamedScript *script = _scripts.getNamedScript(charId); + if (script) { + script->save(file); + file->writeNumber(MKTAG_BE('U', 'R', 'A', 'H')); + file->writeNumber(MKTAG_BE('A', 'K', 'E', 'R')); + } +} } // End of namespace Titanic diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index 7bf0f5f331..cd70af3113 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -37,7 +37,17 @@ private: CTitleEngine _titleEngine; TTScripts _scripts; private: - void loadStatics(SimpleFile *file); + /** + * Loads the statics for the class + */ + static void loadStatics(SimpleFile *file); + + /** + * Saves the statics associated with the class + */ + static void saveStatics(SimpleFile *file); + + void saveNPC(SimpleFile *file, int charId) const; public: static int _v1; static int _v2; @@ -64,6 +74,11 @@ public: * Load the data for the class from file */ void load(SimpleFile *file); + + /** + * Returns the scripts for the manager + */ + TTScripts &getScripts() { return _scripts; } }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_named_script.cpp b/engines/titanic/true_talk/tt_named_script.cpp index 8d225f1b28..129727c62b 100644 --- a/engines/titanic/true_talk/tt_named_script.cpp +++ b/engines/titanic/true_talk/tt_named_script.cpp @@ -26,17 +26,17 @@ namespace Titanic { -TTNamedScriptBase::TTNamedScriptBase(int val1, const char *charClass, int v2, +TTNamedScriptBase::TTNamedScriptBase(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTScriptBase(0, charClass, v2, charName, v3, v4, v5, v6, v7), - _val1(val1), _field54(0), _val2(val2) { + _charId(charId), _field54(0), _val2(val2) { } /*------------------------------------------------------------------------*/ -TTNamedScript::TTNamedScript(int val1, const char *charClass, int v2, +TTNamedScript::TTNamedScript(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : - TTNamedScriptBase(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { + TTNamedScriptBase(charId, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { CTrueTalkManager::_v2 = 0; Common::fill(&_array[0], &_array[147], 0); @@ -139,24 +139,66 @@ int TTNamedScript::proc25() const { void TTNamedScript::proc26() { } -void TTNamedScript::save1(SimpleFile *file) { - error("TODO"); +void TTNamedScript::save(SimpleFile *file) { + file->writeNumber(charId()); + saveBody(file); + + file->writeNumber(4); + file->writeNumber(_field70); + file->writeNumber(_field74); + file->writeNumber(_field78); + file->writeNumber(_field7C); + + file->writeNumber(10); + for (int idx = 0; idx < 10; ++idx) + file->writeNumber(_array[idx]); } -void TTNamedScript::proc28(int v) { - warning("TODO"); +void TTNamedScript::load(SimpleFile *file) { + loadBody(file); + + int count = file->readNumber(); + _field70 = file->readNumber(); + _field74 = file->readNumber(); + _field78 = file->readNumber(); + _field7C = file->readNumber(); + + for (int idx = count; idx > 4; --idx) + file->readNumber(); + + count = file->readNumber(); + for (int idx = 0; idx < count; ++idx) { + int v = file->readNumber(); + if (idx < 10) + _array[idx] = v; + } } -void TTNamedScript::save2(SimpleFile *file) { - error("TODO"); +void TTNamedScript::saveBody(SimpleFile *file) { + int v = proc31(); + file->writeNumber(v); + + if (v > 0 && _subPtr) { + warning("TODO"); + } } -void TTNamedScript::proc30(int v) { - warning("TODO"); +void TTNamedScript::loadBody(SimpleFile *file) { + int count = file->readNumber(); + preLoad(); + + for (int index = 0; index < count; index += 2) { + int v = file->readNumber(); + + if (_subPtr) { + error("TODO - %d", v); + } + } } -void TTNamedScript::proc31() { +int TTNamedScript::proc31() { warning("TODO"); + return 0; } void TTNamedScript::proc32() { @@ -185,4 +227,10 @@ int TTNamedScript::proc37() const { return 0; } +void TTNamedScript::preLoad() { + if (_subPtr) { + error("TODO"); + } +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_named_script.h b/engines/titanic/true_talk/tt_named_script.h index b747cee498..968ec2222e 100644 --- a/engines/titanic/true_talk/tt_named_script.h +++ b/engines/titanic/true_talk/tt_named_script.h @@ -31,11 +31,12 @@ namespace Titanic { class TTNamedScriptBase : public TTScriptBase { protected: - int _val1; int _field54; int _val2; public: - TTNamedScriptBase(int val1, const char *charClass, int v2, + int _charId; +public: + TTNamedScriptBase(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7); @@ -46,11 +47,13 @@ public: virtual int proc10() const = 0; virtual int proc11() const = 0; virtual int proc12() const = 0; + + int charId() const { return _charId; } }; class TTNamedScript : public TTNamedScriptBase { protected: - int _field5C; + byte *_subPtr; int _field60; int _field64; int _field68; @@ -66,7 +69,7 @@ protected: void randomizeFlags(); public: - TTNamedScript(int val1, const char *charClass, int v2, + TTNamedScript(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7); @@ -92,17 +95,19 @@ public: virtual void proc24() = 0; virtual int proc25() const; virtual void proc26(); - virtual void save1(SimpleFile *file); - virtual void proc28(int v); - virtual void save2(SimpleFile *file); - virtual void proc30(int v); - virtual void proc31(); + virtual void save(SimpleFile *file); + virtual void load(SimpleFile *file); + virtual void saveBody(SimpleFile *file); + virtual void loadBody(SimpleFile *file); + virtual int proc31(); virtual void proc32(); virtual void proc33(int v1, int v2); virtual int proc34(); virtual int proc35(int v1, int v2); virtual int proc36() const; virtual int proc37() const; + + void preLoad(); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_scripts.cpp b/engines/titanic/true_talk/tt_scripts.cpp index 981fe66933..8e34ec5d2b 100644 --- a/engines/titanic/true_talk/tt_scripts.cpp +++ b/engines/titanic/true_talk/tt_scripts.cpp @@ -32,6 +32,30 @@ #include "titanic/true_talk/succubus_script.h" namespace Titanic { + +TTNamedScript *TTNamedScriptList::findById(int charId) const { + for (TTNamedScriptList::const_iterator i = begin(); i != end(); ++i) { + const TTNamedScriptListItem *item = *i; + if (item->_script->_charId == charId) + return item->_script; + } + + return nullptr; +} + +/*------------------------------------------------------------------------*/ + +TTUnnamedScript *TTUnnamedScriptList::findById(int scriptId) const { + for (TTUnnamedScriptList::const_iterator i = begin(); i != end(); ++i) { + const TTUnnamedScriptListItem *item = *i; + if (item->_item->_scriptId == scriptId) + return item->_item; + } + + return nullptr; +} + +/*------------------------------------------------------------------------*/ TTScripts::TTScripts(CTitleEngine *titleEngine) : _titleEngine(titleEngine), _field24(0), _field28(0) { @@ -40,23 +64,36 @@ TTScripts::TTScripts(CTitleEngine *titleEngine) : addScript(new TTUnnamedScript(scriptNum)); // Load named scripts - addScript(new DoorbotScript(104, "Doorbot", 0, "Fentible", 11, 1, -1, -1, -1, 0)); - addScript(new BellbotScript(101, "Bellbot", 0, "Krage", 8, 1)); - addScript(new LiftbotScript(105, "LiftBot", 0, "Nobby", 11, 1, -1, -1, -1, 0)); - addScript(new DeskbotScript(103, "DeskBot", 0, "Marsinta", 11, 2)); - addScript(new BarbotScript(100, "Barbot", 0, "Fortillian", 9, 1, -1, -1, -1, 0)); - addScript(new ParrotScript(107, "Parrot", 0, "The Parrot", 5, 1, -1, -1, -1, 0)); - addScript(new MaitreDScript(112, "MaitreDBot", 0, "Dastrogaaar", 8, 1)); - addScript(new SuccUBusScript(111, "Succubus", 0, "Shorbert", 9, 1, -1, -1, -1, 0)); + addScript(new DoorbotScript(104, "Doorbot", 0, "Fentible", 11, 1, -1, -1, -1, 0), 100); + addScript(new BellbotScript(101, "Bellbot", 0, "Krage", 8, 1), 110); + addScript(new LiftbotScript(105, "LiftBot", 0, "Nobby", 11, 1, -1, -1, -1, 0), 103); + addScript(new DeskbotScript(103, "DeskBot", 0, "Marsinta", 11, 2), 110); + addScript(new BarbotScript(100, "Barbot", 0, "Fortillian", 9, 1, -1, -1, -1, 0), 112); + addScript(new ParrotScript(107, "Parrot", 0, "The Parrot", 5, 1, -1, -1, -1, 0), 111); + addScript(new MaitreDScript(112, "MaitreDBot", 0, "Dastrogaaar", 8, 1), 132); + addScript(new SuccUBusScript(111, "Succubus", 0, "Shorbert", 9, 1, -1, -1, -1, 0), 110); } -void TTScripts::addScript(TTNamedScript *script) { +void TTScripts::addScript(TTNamedScript *script, int scriptId) { script->proc13(); - _namedScripts.push_back(new TTNamedScriptListItem(script)); + + // Find the unnamed script this is associated with + TTUnnamedScript *unnamedScript = getUnnamedScript(scriptId); + assert(unnamedScript); + + _namedScripts.push_back(new TTNamedScriptListItem(script, unnamedScript)); } void TTScripts::addScript(TTUnnamedScript *script) { _unnamedScripts.push_back(new TTUnnamedScriptListItem(script)); } +TTUnnamedScript *TTScripts::getUnnamedScript(int scriptId) const { + return _unnamedScripts.findById(scriptId); +} + +TTNamedScript *TTScripts::getNamedScript(int charId) const { + return _namedScripts.findById(charId); +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_scripts.h b/engines/titanic/true_talk/tt_scripts.h index e47a7b2f87..5934eb3625 100644 --- a/engines/titanic/true_talk/tt_scripts.h +++ b/engines/titanic/true_talk/tt_scripts.h @@ -31,19 +31,33 @@ namespace Titanic { class CTitleEngine; -PTR_LIST_ITEM(TTNamedScript); +class TTNamedScriptListItem : public ListItem { +public: + TTNamedScript *_script; + TTUnnamedScript *_unnamedScript; +public: + TTNamedScriptListItem() : _script(nullptr), _unnamedScript(nullptr) {} + TTNamedScriptListItem(TTNamedScript *script, TTUnnamedScript *unnamedScript) : + _script(script), _unnamedScript(unnamedScript) {} + virtual ~TTNamedScriptListItem() { delete _script; } +}; + PTR_LIST_ITEM(TTUnnamedScript); class TTNamedScriptList : public List { +public: + TTNamedScript *findById(int charId) const; }; -class TTUnamedScriptList : public List { +class TTUnnamedScriptList : public List { +public: + TTUnnamedScript *findById(int scriptId) const; }; class TTScripts { private: TTNamedScriptList _namedScripts; - TTUnamedScriptList _unnamedScripts; + TTUnnamedScriptList _unnamedScripts; CTitleEngine *_titleEngine; int _field24; int _field28; @@ -51,7 +65,7 @@ private: /** * Add a named script to the named scripts list */ - void addScript(TTNamedScript *script); + void addScript(TTNamedScript *script, int charId); /** * Add an unnamed script to the unnamed scripts list @@ -59,6 +73,16 @@ private: void addScript(TTUnnamedScript *script); public: TTScripts(CTitleEngine *titleEngine); + + /** + * Return a pointer to the specified script + */ + TTUnnamedScript *getUnnamedScript(int scriptId) const; + + /** + * Return a pointer to the specified named character script + */ + TTNamedScript *getNamedScript(int charId) const; }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_unnamed_script.h b/engines/titanic/true_talk/tt_unnamed_script.h index f4702166b1..eeba200193 100644 --- a/engines/titanic/true_talk/tt_unnamed_script.h +++ b/engines/titanic/true_talk/tt_unnamed_script.h @@ -28,7 +28,7 @@ namespace Titanic { class TTUnnamedScriptBase : public TTScriptBase { -protected: +public: int _scriptId; public: TTUnnamedScriptBase(int scriptId, const char *charClass, const char *charName, -- cgit v1.2.3 From c269c770ac27cbc845c06dfec8c7ac99d4fe657d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 12 Mar 2016 12:35:41 -0500 Subject: TITANIC: Implemented sound manager loading --- engines/titanic/module.mk | 1 + engines/titanic/sound/sound.cpp | 4 +- engines/titanic/sound/sound.h | 4 +- engines/titanic/sound/sound_manager.cpp | 127 ++++++++++++++++++++++++ engines/titanic/sound/sound_manager.h | 118 ++++++++++++++++++++++ engines/titanic/true_talk/true_talk_manager.cpp | 25 ++++- engines/titanic/true_talk/true_talk_manager.h | 2 + engines/titanic/true_talk/tt_named_script.cpp | 5 +- 8 files changed, 279 insertions(+), 7 deletions(-) create mode 100644 engines/titanic/sound/sound_manager.cpp create mode 100644 engines/titanic/sound/sound_manager.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index bfb9317adc..e95977ab56 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -403,6 +403,7 @@ MODULE_OBJS := \ sound/season_noises.o \ sound/seasonal_music_player.o \ sound/sound.o \ + sound/sound_manager.o \ sound/titania_speech.o \ sound/trigger_auto_music_player.o \ sound/view_auto_sound_player.o \ diff --git a/engines/titanic/sound/sound.cpp b/engines/titanic/sound/sound.cpp index cea377eef7..35c1c708a6 100644 --- a/engines/titanic/sound/sound.cpp +++ b/engines/titanic/sound/sound.cpp @@ -28,11 +28,11 @@ CSound::CSound(CGameManager *owner) : _gameManager(owner) { } void CSound::save(SimpleFile *file) const { - + _soundManager.save(file); } void CSound::load(SimpleFile *file) { - + _soundManager.load(file); } } // End of namespace Titanic z diff --git a/engines/titanic/sound/sound.h b/engines/titanic/sound/sound.h index 2d0ccecbc5..6ae4019557 100644 --- a/engines/titanic/sound/sound.h +++ b/engines/titanic/sound/sound.h @@ -24,14 +24,16 @@ #define TITANIC_SOUND_H #include "titanic/simple_file.h" +#include "titanic/sound/sound_manager.h" namespace Titanic { class CGameManager; class CSound { -public: +private: CGameManager *_gameManager; + QSoundManager _soundManager; public: CSound(CGameManager *owner); diff --git a/engines/titanic/sound/sound_manager.cpp b/engines/titanic/sound/sound_manager.cpp new file mode 100644 index 0000000000..143dd8385f --- /dev/null +++ b/engines/titanic/sound/sound_manager.cpp @@ -0,0 +1,127 @@ +/* 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 "titanic/sound/sound_manager.h" + +namespace Titanic { + +SoundManager::SoundManager() : _field4(0), _field8(0), + _fieldC(0), _field10(0), _field14(1) { +} + +/*------------------------------------------------------------------------*/ + +QSoundManager::QSoundManager() : _field18(0), _field1C(0) { + Common::fill(&_field4A0[0], &_field4A0[16], 0); +} + +int QSoundManager::proc3() { + warning("TODO"); + return 0; +} + +int QSoundManager::proc4() { + warning("TODO"); + return 0; +} + +int QSoundManager::proc5() { + warning("TODO"); + return 0; +} + +void QSoundManager::proc6() { + warning("TODO"); +} + +void QSoundManager::proc7() { + warning("TODO"); +} + +void QSoundManager::proc8() { + warning("TODO"); +} + +void QSoundManager::proc9() { + warning("TODO"); +} + +void QSoundManager::proc10() { + warning("TODO"); +} + +void QSoundManager::proc11() { + warning("TODO"); +} + +void QSoundManager::proc12() { + warning("TODO"); +} + +void QSoundManager::proc13() { + warning("TODO"); +} + +void QSoundManager::proc14() { + warning("TODO"); +} + +int QSoundManager::proc15() { + warning("TODO"); + return 0; +} + +int QSoundManager::proc16() { + warning("TODO"); + return 0; +} + +void QSoundManager::WaveMixPump() { + warning("TODO"); +} + +int QSoundManager::proc18() const { + warning("TODO"); + return 0; +} + +void QSoundManager::proc19(int v) { + warning("TODO"); +} + +void QSoundManager::proc20(int v) { + warning("TODO"); +} + +void QSoundManager::proc21(int v) { + warning("TODO"); +} + +void QSoundManager::proc29() { + warning("TODO"); +} + +void QSoundManager::proc30() { + warning("TODO"); +} + +} // End of namespace Titanic z diff --git a/engines/titanic/sound/sound_manager.h b/engines/titanic/sound/sound_manager.h new file mode 100644 index 0000000000..4936625245 --- /dev/null +++ b/engines/titanic/sound/sound_manager.h @@ -0,0 +1,118 @@ +/* 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. + * + */ + +#ifndef TITANIC_SOUND_MANAGER_H +#define TITANIC_SOUND_MANAGER_H + +#include "titanic/simple_file.h" + +namespace Titanic { + +class SoundManager { +protected: + int _field4; + int _field8; + int _fieldC; + int _field10; + int _field14; +public: + SoundManager(); + + virtual int proc3() const { return 0; } + virtual int proc4() const { return 0; } + virtual int proc5() const { return 0; } + virtual void proc6() = 0; + virtual void proc7() = 0; + virtual void proc8() = 0; + virtual void proc9() {} + virtual void proc10() = 0; + virtual void proc11() = 0; + virtual void proc12() {} + virtual void proc13() {} + virtual void proc14() = 0; + virtual int proc15() const { return 0; } + virtual int proc16() const { return 0; } + virtual void WaveMixPump() {} + virtual int proc18() const { return 0; } + virtual void proc19(int v) { _field4 = v; } + virtual void proc20(int v) { _field8 = v; } + virtual void proc21(int v) { _fieldC = v; } + virtual void proc22(int v) { _field10 = v; } + virtual void proc23() { proc10(); } + + /** + * Load the data for the class from file + */ + void load(SimpleFile *file) {} + + virtual void proc25() {} + virtual void proc26() {} + + /** + * Save the data for the class to file + */ + void save(SimpleFile *file) const {} + + /** + * Called after saving is complete + */ + virtual void postSave() {} + + virtual void proc29() {} +}; + +class QSoundManager : public SoundManager { +public: + int _field18; + int _field1C; + + int _field4A0[16]; +public: + QSoundManager(); + + virtual int proc3(); + virtual int proc4(); + virtual int proc5(); + virtual void proc6(); + virtual void proc7(); + virtual void proc8(); + virtual void proc9(); + virtual void proc10(); + virtual void proc11(); + virtual void proc12(); + virtual void proc13(); + virtual void proc14(); + virtual int proc15(); + virtual int proc16(); + virtual void WaveMixPump(); + virtual int proc18() const; + virtual void proc19(int v); + virtual void proc20(int v); + virtual void proc21(int v); + + virtual void proc29(); + virtual void proc30(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_QSOUND_MANAGER_H */ diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 416a4e2a72..f176b2f3cf 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -62,11 +62,24 @@ void CTrueTalkManager::load(SimpleFile *file) { // Iterate through loading characters int charId = file->readNumber(); while (charId) { - uint ident = MKTAG_BE('U', 'R', 'A', 'H'); + loadNPC(file, charId); - do { + int ident1 = file->readNumber(); + int ident2 = file->readNumber(); + int v = 0; - } while (1); + if (ident1 != MKTAG_BE('U', 'R', 'A', 'H')) { + while (ident2 != MKTAG_BE('A', 'K', 'E', 'R')) { + ident1 = ident2; + ident2 = file->readNumber(); + + if (!ident1) + break; + } + } + + // Get start of next character + charId = file->readNumber(); } } @@ -147,6 +160,12 @@ void CTrueTalkManager::setFlags(int index, int val) { } } +void CTrueTalkManager::loadNPC(SimpleFile *file, int charId) { + TTNamedScript *script = _scripts.getNamedScript(charId); + if (script) + script->load(file); +} + void CTrueTalkManager::saveNPC(SimpleFile *file, int charId) const { TTNamedScript *script = _scripts.getNamedScript(charId); if (script) { diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index cd70af3113..274b5ccc65 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -47,6 +47,8 @@ private: */ static void saveStatics(SimpleFile *file); + void loadNPC(SimpleFile *file, int charId); + void saveNPC(SimpleFile *file, int charId) const; public: static int _v1; diff --git a/engines/titanic/true_talk/tt_named_script.cpp b/engines/titanic/true_talk/tt_named_script.cpp index 129727c62b..dfc5bb243d 100644 --- a/engines/titanic/true_talk/tt_named_script.cpp +++ b/engines/titanic/true_talk/tt_named_script.cpp @@ -36,7 +36,10 @@ TTNamedScriptBase::TTNamedScriptBase(int charId, const char *charClass, int v2, TTNamedScript::TTNamedScript(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : - TTNamedScriptBase(charId, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { + TTNamedScriptBase(charId, charClass, v2, charName, v3, val2, v4, v5, v6, v7), + _subPtr(nullptr), _field60(0), _field64(0), _field68(0), + _field6C(0), _field70(0), _field74(0), _field78(0), + _field7C(0), _field80(0) { CTrueTalkManager::_v2 = 0; Common::fill(&_array[0], &_array[147], 0); -- cgit v1.2.3 From bad72e2ae491cb99843f3af971725231e3defb2e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 12 Mar 2016 19:23:00 -0500 Subject: TITANIC: Implement various post-load methods --- engines/titanic/core/node_item.cpp | 6 +-- engines/titanic/core/node_item.h | 5 ++- engines/titanic/core/project_item.cpp | 64 ++++++++++++++++++++++----- engines/titanic/core/project_item.h | 15 +++++-- engines/titanic/core/saveable_object.cpp | 4 +- engines/titanic/core/saveable_object.h | 2 +- engines/titanic/core/tree_item.cpp | 20 +++++++++ engines/titanic/core/tree_item.h | 10 +++++ engines/titanic/core/view_item.cpp | 6 +-- engines/titanic/core/view_item.h | 3 +- engines/titanic/game/room_item.h | 2 +- engines/titanic/game_manager.cpp | 44 +++++++++++++++--- engines/titanic/game_manager.h | 16 +++++-- engines/titanic/game_state_sub.cpp | 5 +++ engines/titanic/game_state_sub.h | 2 + engines/titanic/game_view.cpp | 28 +++++++++++- engines/titanic/game_view.h | 21 +++++++-- engines/titanic/main_game_window.cpp | 10 ++++- engines/titanic/main_game_window.h | 4 ++ engines/titanic/messages/messages.cpp | 2 +- engines/titanic/messages/messages.h | 3 +- engines/titanic/pet_control/pet_control.cpp | 2 +- engines/titanic/pet_control/pet_control.h | 2 +- engines/titanic/sound/sound.h | 5 +++ engines/titanic/sound/sound_manager.h | 6 ++- engines/titanic/true_talk/true_talk_manager.h | 5 +++ 26 files changed, 245 insertions(+), 47 deletions(-) diff --git a/engines/titanic/core/node_item.cpp b/engines/titanic/core/node_item.cpp index f44be6ddaf..22c9b9b37f 100644 --- a/engines/titanic/core/node_item.cpp +++ b/engines/titanic/core/node_item.cpp @@ -24,7 +24,7 @@ namespace Titanic { -CNodeItem::CNodeItem() : CNamedItem(), _field24(0), _field28(0), _field2C(0) { +CNodeItem::CNodeItem() : CNamedItem(), _field24(0), _field28(0), _nodeNumber(0) { } void CNodeItem::save(SimpleFile *file, int indent) const { @@ -34,7 +34,7 @@ void CNodeItem::save(SimpleFile *file, int indent) const { file->writeNumberLine(_field28, indent + 1); file->writeQuotedLine("N", indent); - file->writeNumberLine(_field2C, indent + 1); + file->writeNumberLine(_nodeNumber, indent + 1); CNamedItem::save(file, indent); } @@ -46,7 +46,7 @@ void CNodeItem::load(SimpleFile *file) { _field28 = file->readNumber(); file->readBuffer(); - _field2C = file->readNumber(); + _nodeNumber = file->readNumber(); CNamedItem::load(file); } diff --git a/engines/titanic/core/node_item.h b/engines/titanic/core/node_item.h index 45309a1891..4f0391ae88 100644 --- a/engines/titanic/core/node_item.h +++ b/engines/titanic/core/node_item.h @@ -28,10 +28,11 @@ namespace Titanic { class CNodeItem : public CNamedItem { -private: +protected: int _field24; int _field28; - int _field2C; +public: + int _nodeNumber; public: CLASSDEF CNodeItem(); diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp index 18b0c42815..bf31388963 100644 --- a/engines/titanic/core/project_item.cpp +++ b/engines/titanic/core/project_item.cpp @@ -25,7 +25,9 @@ #include "titanic/game_manager.h" #include "titanic/titanic.h" #include "titanic/core/dont_save_file_item.h" +#include "titanic/core/node_item.h" #include "titanic/core/project_item.h" +#include "titanic/core/view_item.h" #include "titanic/pet_control/pet_control.h" namespace Titanic { @@ -177,7 +179,7 @@ void CProjectItem::loadGame(int slotId) { newProject->destroyAll(); // Post-load processing - gameLoaded(); + postLoad(); } void CProjectItem::saveGame(int slotId) { @@ -251,7 +253,6 @@ void CProjectItem::saveData(SimpleFile *file, CTreeItem *item) const { item->saveHeader(file, 0); item->save(file, 1); item->saveFooter(file, 0); - CTreeItem *child = item->getFirstChild(); if (child) { @@ -271,14 +272,14 @@ void CProjectItem::saveData(SimpleFile *file, CTreeItem *item) const { } } -void CProjectItem::gameLoaded() { +void CProjectItem::postLoad() { CGameManager *gameManager = getGameManager(); if (gameManager) - gameManager->gameLoaded(); + gameManager->postLoad(this); CPetControl *petControl = getPetControl(); if (petControl) - petControl->gameLoaded(); + petControl->postLoad(); } CPetControl *CProjectItem::getPetControl() const { @@ -300,10 +301,10 @@ CPetControl *CProjectItem::getPetControl() const { } CRoomItem *CProjectItem::findFirstRoom() const { - return dynamic_cast(findChildInstance(*CRoomItem::_type)); + return dynamic_cast(findChildInstance(CRoomItem::_type)); } -CTreeItem *CProjectItem::findChildInstance(ClassDef &classDef) const { +CTreeItem *CProjectItem::findChildInstance(ClassDef *classDef) const { CTreeItem *treeItem = getFirstChild(); if (treeItem == nullptr) return nullptr; @@ -322,10 +323,10 @@ CTreeItem *CProjectItem::findChildInstance(ClassDef &classDef) const { } CRoomItem *CProjectItem::findNextRoom(CRoomItem *priorRoom) const { - return dynamic_cast(findSiblingInstanceOf(*CRoomItem::_type, priorRoom)); + return dynamic_cast(findSiblingInstanceOf(CRoomItem::_type, priorRoom)); } -CTreeItem *CProjectItem::findSiblingInstanceOf(ClassDef &classDef, CTreeItem *startItem) const { +CTreeItem *CProjectItem::findSiblingInstanceOf(ClassDef *classDef, CTreeItem *startItem) const { CTreeItem *treeItem = startItem->getParent()->getNextSibling(); if (treeItem == nullptr) return nullptr; @@ -335,7 +336,7 @@ CTreeItem *CProjectItem::findSiblingInstanceOf(ClassDef &classDef, CTreeItem *st CDontSaveFileItem *CProjectItem::getDontSaveFileItem() const { for (CTreeItem *treeItem = getFirstChild(); treeItem; treeItem = treeItem->getNextSibling()) { - if (treeItem->isInstanceOf(*CDontSaveFileItem::_type)) + if (treeItem->isInstanceOf(CDontSaveFileItem::_type)) return dynamic_cast(treeItem); } @@ -346,4 +347,47 @@ CRoomItem *CProjectItem::findHiddenRoom() { return dynamic_cast(findByName("HiddenRoom")); } +CViewItem *CProjectItem::findView(int roomNumber, int nodeNumber, int viewNumber) { + CTreeItem *treeItem = getFirstChild(); + CRoomItem *roomItem = nullptr; + + // Scan for the specified room + if (treeItem) { + do { + CTreeItem *childItem = treeItem->getFirstChild(); + CRoomItem *rItem = dynamic_cast(childItem); + if (rItem && rItem->_roomNumber == roomNumber) { + roomItem = rItem; + break; + } + } while ((treeItem = treeItem->getNextSibling()) != nullptr); + } + if (!roomItem) + return nullptr; + + // Scan for the specified node within the room + CNodeItem *nodeItem = nullptr; + + CNodeItem *nItem = dynamic_cast( + roomItem->findChildInstanceOf(CNodeItem::_type)); + for (; nItem && !nodeItem; nItem = dynamic_cast( + findNextInstanceOf(CNodeItem::_type, nItem))) { + if (nItem->_nodeNumber == nodeNumber) + nodeItem = nItem; + } + if (!nodeItem) + return nullptr; + + // Scan for the specified view within the node + CViewItem *viewItem = dynamic_cast( + nodeItem->findChildInstanceOf(CViewItem::_type)); + for (; viewItem; viewItem = dynamic_cast( + findNextInstanceOf(CViewItem::_type, viewItem))) { + if (viewItem->_viewNumber == viewNumber) + return viewItem; + } + + return nullptr; +} + } // End of namespace Titanic diff --git a/engines/titanic/core/project_item.h b/engines/titanic/core/project_item.h index f4148b0678..65fe8b88bd 100644 --- a/engines/titanic/core/project_item.h +++ b/engines/titanic/core/project_item.h @@ -34,6 +34,7 @@ namespace Titanic { class CGameManager; class CPetControl; +class CViewItem; /** * File list item @@ -81,12 +82,12 @@ private: /** * Finds the first child instance of a given class type */ - CTreeItem *findChildInstance(ClassDef &classDef) const; + CTreeItem *findChildInstance(ClassDef *classDef) const; /** * Finds the next sibling occurance of a given class type */ - CTreeItem *findSiblingInstanceOf(ClassDef &classDef, CTreeItem *startItem) const; + CTreeItem *findSiblingInstanceOf(ClassDef *classDef, CTreeItem *startItem) const; private: /** * Load project data from the passed file @@ -101,7 +102,7 @@ private: /** * Does post-loading processing */ - void gameLoaded(); + void postLoad(); public: CLASSDEF CProjectItem(); @@ -171,7 +172,15 @@ public: */ CDontSaveFileItem *getDontSaveFileItem() const; + /** + * Finds the hidden room node of the project + */ CRoomItem *findHiddenRoom(); + + /** + * Finds a view + */ + CViewItem *findView(int roomNumber, int nodeNumber, int viewNumber); }; } // End of namespace Titanic diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 8e3ab1e067..8e9ec4e1d6 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -1581,9 +1581,9 @@ void CSaveableObject::saveFooter(SimpleFile *file, int indent) const { file->writeClassEnd(indent); } -bool CSaveableObject::isInstanceOf(const ClassDef &classDef) { +bool CSaveableObject::isInstanceOf(const ClassDef *classDef) { for (ClassDef *def = getType(); def != nullptr; def = def->_parent) { - if (def == &classDef) + if (def == classDef) return true; } diff --git a/engines/titanic/core/saveable_object.h b/engines/titanic/core/saveable_object.h index c4615c52b2..1fb509bf20 100644 --- a/engines/titanic/core/saveable_object.h +++ b/engines/titanic/core/saveable_object.h @@ -80,7 +80,7 @@ public: CLASSDEF virtual ~CSaveableObject() {} - bool isInstanceOf(const ClassDef &classDef); + bool isInstanceOf(const ClassDef *classDef); /** * Save the data for the class to file diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index 31deab860d..ffcee40c6a 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -88,6 +88,26 @@ CTreeItem *CTreeItem::scan(CTreeItem *item) const { return nullptr; } +CTreeItem *CTreeItem::findChildInstanceOf(ClassDef *classDef) const { + for (CTreeItem *treeItem = _firstChild; treeItem; treeItem = treeItem->getNextSibling()) { + if (treeItem->isInstanceOf(classDef)) + return treeItem; + } + + return nullptr; +} + +CTreeItem *CTreeItem::findNextInstanceOf(ClassDef *classDef, CTreeItem *startItem) const { + CTreeItem *treeItem = startItem ? startItem->getNextSibling() : getFirstChild(); + + for (; treeItem; treeItem = treeItem->getNextSibling()) { + if (treeItem->isInstanceOf(classDef)) + return treeItem; + } + + return nullptr; +} + void CTreeItem::addUnder(CTreeItem *newParent) { if (newParent->_firstChild) addSibling(newParent->getLastSibling()); diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index afca5254df..e218cf3dbb 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -118,6 +118,16 @@ public: */ CTreeItem *scan(CTreeItem *item) const; + /** + * Find the first child item that is of a given type + */ + CTreeItem *findChildInstanceOf(ClassDef *classDef) const; + + /** + * Find the next sibling item that is of the given type + */ + CTreeItem *findNextInstanceOf(ClassDef *classDef, CTreeItem *startItem) const; + /** * Adds the item under another tree item */ diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index e64229e3d3..5253f24749 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -27,7 +27,7 @@ namespace Titanic { CViewItem::CViewItem() : CNamedItem() { _field24 = 0; _field28 = 0.0; - _field30 = 0; + _viewNumber = 0; _field50 = 0; _field54 = 0; setData(0.0); @@ -44,7 +44,7 @@ void CViewItem::save(SimpleFile *file, int indent) const { _resourceKey.save(file, indent); file->writeQuotedLine("V", indent); file->writeFloatLine(_field28, indent + 1); - file->writeNumberLine(_field30, indent + 1); + file->writeNumberLine(_viewNumber, indent + 1); CNamedItem::save(file, indent); } @@ -60,7 +60,7 @@ void CViewItem::load(SimpleFile *file) { default: file->readBuffer(); setData(file->readFloat()); - _field30 = file->readNumber(); + _viewNumber = file->readNumber(); break; } diff --git a/engines/titanic/core/view_item.h b/engines/titanic/core/view_item.h index a5ce575171..805b7a4f9c 100644 --- a/engines/titanic/core/view_item.h +++ b/engines/titanic/core/view_item.h @@ -34,10 +34,11 @@ private: protected: int _field24; double _field28; - int _field30; CResourceKey _resourceKey; int _field50; int _field54; +public: + int _viewNumber; public: CLASSDEF CViewItem(); diff --git a/engines/titanic/game/room_item.h b/engines/titanic/game/room_item.h index 7441ed01bc..2235f6a5d2 100644 --- a/engines/titanic/game/room_item.h +++ b/engines/titanic/game/room_item.h @@ -32,7 +32,7 @@ namespace Titanic { class CRoomItem : public CNamedItem { -private: +public: Common::Rect _roomRect; CMovieClipList _clipList; int _roomNumber; diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index b677bf28e0..d8409e6864 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -21,18 +21,33 @@ */ #include "titanic/game_manager.h" +#include "titanic/game_view.h" #include "titanic/screen_manager.h" #include "titanic/core/project_item.h" #include "titanic/messages/messages.h" + namespace Titanic { +void CGameManagerList::postLoad(uint ticks, CProjectItem *project) { + for (iterator i = begin(); i != end(); ++i) + (*i)->postLoad(ticks, project); +} + +/*------------------------------------------------------------------------*/ + +void CGameManagerListItem::postLoad(uint ticks, CProjectItem *project) { + warning("TODO"); +} + +/*------------------------------------------------------------------------*/ + CGameManager::CGameManager(CProjectItem *project, CGameView *gameView): _project(project), _gameView(gameView), _trueTalkManager(this), _inputHandler(this), _inputTranslator(&_inputHandler), _gameState(this), _sound(this), _musicRoom(this), - _field30(0), _field34(0), _field48(0), - _field4C(0), _field50(0), _field54(0), _tickCount(0) { + _field30(0), _field34(0), _field48(0), _field4C(0), + _field50(0), _field54(0), _tickCount1(0), _tickCount2(0) { _videoSurface = CScreenManager::_screenManagerPtr->createSurface(600, 340); _project->setGameManager(this); } @@ -44,14 +59,29 @@ void CGameManager::load(SimpleFile *file) { _list.load(file); _trueTalkManager.load(file); _sound.load(file); - } -void CGameManager::gameLoaded() { - // TODO +void CGameManager::postLoad(CProjectItem *project) { + if (_gameView) { + _gameView->postLoad(); + + if (!_gameView->_fieldC) { + int v = fn2(); + if (v) + _gameView->proc3(v); + } + } + + // Signal to anything interested that the game has been loaded + CLoadSuccessMsg msg(_tickCount1 - _tickCount2); + msg.execute(project, nullptr, MSGFLAG_SCAN); - //CLoadSuccessMsg msg(0); + // Signal to any registered list items + _list.postLoad(_tickCount1, _project); + // Signal the true talk manager and sound + _trueTalkManager.postLoad(); + _sound.postLoad(); } -} // End of namespace Titanic z +} // End of namespace Titanic diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index 37a4a415fb..1d2a88e626 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -39,14 +39,19 @@ class CProjectItem; class CGameView; class CGameManagerListItem : public ListItem { +private: + static int _v1; +public: + void postLoad(uint ticks, CProjectItem *project); }; class CGameManagerList : public List { +public: + void postLoad(uint ticks, CProjectItem *project); }; class CGameManager { private: - CProjectItem *_project; CGameView *_gameView; CGameState _gameState; CSound _sound; @@ -63,7 +68,10 @@ private: int _field50; int _field54; CVideoSurface *_videoSurface; - int _tickCount; + uint _tickCount1; + uint _tickCount2; +public: + CProjectItem *_project; public: CGameManager(CProjectItem *project, CGameView *gameView); ~CGameManager(); @@ -76,7 +84,9 @@ public: /** * Called after loading a game has finished */ - void gameLoaded(); + void postLoad(CProjectItem *project); + + int fn2() { return _gameState._sub.fn2(); } }; } // End of namespace Titanic diff --git a/engines/titanic/game_state_sub.cpp b/engines/titanic/game_state_sub.cpp index 212fcce676..2e379a0edd 100644 --- a/engines/titanic/game_state_sub.cpp +++ b/engines/titanic/game_state_sub.cpp @@ -42,4 +42,9 @@ void CGameStateSub::load(SimpleFile *file) { _fieldC = file->readNumber(); } +int CGameStateSub::fn2() { + warning("TODO"); + return 0; +} + } // End of namespace Titanic z diff --git a/engines/titanic/game_state_sub.h b/engines/titanic/game_state_sub.h index 2ea6bd60b0..82917d9021 100644 --- a/engines/titanic/game_state_sub.h +++ b/engines/titanic/game_state_sub.h @@ -49,6 +49,8 @@ public: * Load the data for the class from file */ void load(SimpleFile *file); + + int fn2(); }; } // End of namespace Titanic diff --git a/engines/titanic/game_view.cpp b/engines/titanic/game_view.cpp index d8410f1457..a0542b548f 100644 --- a/engines/titanic/game_view.cpp +++ b/engines/titanic/game_view.cpp @@ -22,20 +22,44 @@ #include "titanic/game_view.h" #include "titanic/game_manager.h" +#include "titanic/main_game_window.h" namespace Titanic { -CGameView::CGameView() : _gameManager(nullptr), _field8(0), _fieldC(0) { +CGameView::CGameView() : _gameManager(nullptr), _fieldC(nullptr), + _field8(0) { } void CGameView::setGameManager(CGameManager *gameManager) { _gameManager = gameManager; } +void CGameView::postLoad() { + if (_fieldC) + warning("TODO"); + + _fieldC = nullptr; +} + +void CGameView::deleteView(int roomNumber, int nodeNumber, int viewNumber) { + CViewItem *view = _gameManager->_project->findView(roomNumber, nodeNumber, viewNumber); + if (view) + delete view; +} + + /*------------------------------------------------------------------------*/ -CTitanicGameView::CTitanicGameView(CMainGameWindow *gameWindow) : +CSTGameView::CSTGameView(CMainGameWindow *gameWindow) : CGameView(), _gameWindow(gameWindow) { } +void CSTGameView::proc3(int v) { + _gameWindow->fn1(v); +} + +void CSTGameView::proc4() { + _gameWindow->fn2(); +} + } // End of namespace Titanic diff --git a/engines/titanic/game_view.h b/engines/titanic/game_view.h index 588cf938e3..5a2c04a9c8 100644 --- a/engines/titanic/game_view.h +++ b/engines/titanic/game_view.h @@ -24,6 +24,7 @@ #define TITANIC_GAME_VIEW_H #include "common/scummsys.h" +#include "titanic/core/view_item.h" namespace Titanic { @@ -34,7 +35,8 @@ class CGameView { protected: CGameManager *_gameManager; int _field8; - int _fieldC; +public: + void *_fieldC; public: CGameView(); @@ -42,13 +44,26 @@ public: * Set the game manager */ void setGameManager(CGameManager *gameManager); + + /** + * Called after loading a game has finished + */ + void postLoad(); + + virtual void deleteView(int roomNumber, int nodeNumber, int viewNumber); + + virtual void proc3(int v) = 0; + virtual void proc4() = 0; }; -class CTitanicGameView: public CGameView { +class CSTGameView: public CGameView { private: CMainGameWindow *_gameWindow; public: - CTitanicGameView(CMainGameWindow *gameWindow); + CSTGameView(CMainGameWindow *gameWindow); + + virtual void proc3(int v); + virtual void proc4(); }; } // End of namespace Titanic diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index c4eec39445..32647051d7 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -58,7 +58,7 @@ void CMainGameWindow::applicationStarting() { // TODO: Clear surfaces // Create game view and manager - _gameView = new CTitanicGameView(this); + _gameView = new CSTGameView(this); _gameManager = new CGameManager(_project, _gameView); _gameView->setGameManager(_gameManager); @@ -80,4 +80,12 @@ int CMainGameWindow::selectSavegame() { return -1; } +void CMainGameWindow::fn1(int v) { + warning("TODO"); +} + +void CMainGameWindow::fn2() { + warning("TODO"); +} + } // End of namespace Titanic diff --git a/engines/titanic/main_game_window.h b/engines/titanic/main_game_window.h index 4796a4fdcb..e6e724191a 100644 --- a/engines/titanic/main_game_window.h +++ b/engines/titanic/main_game_window.h @@ -68,6 +68,10 @@ public: * Called when the application starts */ void applicationStarting(); + + void fn1(int v); + + void fn2(); }; } // End of namespace Titanic diff --git a/engines/titanic/messages/messages.cpp b/engines/titanic/messages/messages.cpp index 1f7a5a07d4..1e49994915 100644 --- a/engines/titanic/messages/messages.cpp +++ b/engines/titanic/messages/messages.cpp @@ -50,7 +50,7 @@ bool CMessage::execute(CTreeItem *target, const ClassDef *classDef, int flags) { if (flags & MSGFLAG_SCAN) nextItem = item->scan(target); - if (!(flags & MSGFLAG_CLASS_DEF) || item->isInstanceOf(*classDef)) { + if (!(flags & MSGFLAG_CLASS_DEF) || item->isInstanceOf(classDef)) { bool handled = perform(item); if (handled) { diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 1908b7351c..80ce590b87 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -42,7 +42,8 @@ public: CLASSDEF CMessage(); - bool execute(CTreeItem *target, const ClassDef *classDef, int flags); + bool execute(CTreeItem *target, const ClassDef *classDef = nullptr, + int flags = MSGFLAG_SCAN | MSGFLAG_BREAK_IF_HANDLED); virtual bool perform(CTreeItem *treeItem) { return false; } diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index e123e99dc5..7ed223d595 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -49,7 +49,7 @@ void CPetControl::load(SimpleFile *file) { CGameObject::load(file); } -void CPetControl::gameLoaded() { +void CPetControl::postLoad() { // TODO } diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 0eb2034675..70f6850bc7 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -79,7 +79,7 @@ public: /** * Called after loading a game has finished */ - void gameLoaded(); + void postLoad(); }; } // End of namespace Titanic diff --git a/engines/titanic/sound/sound.h b/engines/titanic/sound/sound.h index 6ae4019557..a78bc79741 100644 --- a/engines/titanic/sound/sound.h +++ b/engines/titanic/sound/sound.h @@ -46,6 +46,11 @@ public: * Load the data for the class from file */ void load(SimpleFile *file); + + /** + * Called when loading a game is complete + */ + void postLoad() { _soundManager.postLoad(); } }; } // End of namespace Titanic diff --git a/engines/titanic/sound/sound_manager.h b/engines/titanic/sound/sound_manager.h index 4936625245..cb88b6684c 100644 --- a/engines/titanic/sound/sound_manager.h +++ b/engines/titanic/sound/sound_manager.h @@ -64,7 +64,11 @@ public: */ void load(SimpleFile *file) {} - virtual void proc25() {} + /** + * Called after loading of a game is completed + */ + virtual void postLoad() {} + virtual void proc26() {} /** diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index 274b5ccc65..904f3c479b 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -77,6 +77,11 @@ public: */ void load(SimpleFile *file); + /** + * Called when loading a game is complete + */ + void postLoad() {} + /** * Returns the scripts for the manager */ -- cgit v1.2.3 From c6b07dcdd7d2ec629d0287922f47e48de90dfc97 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 12 Mar 2016 22:03:01 -0500 Subject: TITANIC: Added CGameObjectDescItem class --- engines/titanic/core/game_object.h | 2 +- engines/titanic/core/game_object_desc_item.cpp | 57 ++++++++++++++++++++++++++ engines/titanic/core/game_object_desc_item.h | 56 +++++++++++++++++++++++++ engines/titanic/core/saveable_object.cpp | 8 ++-- engines/titanic/core/saveable_object.h | 2 +- engines/titanic/core/tree_item.cpp | 38 +++++++++++++++++ engines/titanic/core/tree_item.h | 34 ++++++++++++++- engines/titanic/module.mk | 1 + engines/titanic/pet_control/pet_control_sub1.h | 2 +- 9 files changed, 192 insertions(+), 8 deletions(-) create mode 100644 engines/titanic/core/game_object_desc_item.cpp create mode 100644 engines/titanic/core/game_object_desc_item.h diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 0d9f9184b2..3809ae38d0 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -75,4 +75,4 @@ public: } // End of namespace Titanic -#endif /* TITANIC_PET_CONTROL_H */ +#endif /* TITANIC_GAME_OBJECT_H */ diff --git a/engines/titanic/core/game_object_desc_item.cpp b/engines/titanic/core/game_object_desc_item.cpp new file mode 100644 index 0000000000..77174e5d06 --- /dev/null +++ b/engines/titanic/core/game_object_desc_item.cpp @@ -0,0 +1,57 @@ +/* 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 "titanic/core/game_object_desc_item.h" + +namespace Titanic { + +CGameObjectDescItem::CGameObjectDescItem(): CTreeItem() { +} + +void CGameObjectDescItem::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + _clipList.save(file, indent); + file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_string2, indent); + _list1.save(file, indent); + _list2.save(file, indent); + + CTreeItem::save(file, indent); +} + +void CGameObjectDescItem::load(SimpleFile *file) { + int val = file->readNumber(); + + if (val != 1) { + if (val) + _clipList.load(file); + + _string1 = file->readString(); + _string2 = file->readString(); + _list1.load(file); + _list1.load(file); + } + + CTreeItem::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/core/game_object_desc_item.h b/engines/titanic/core/game_object_desc_item.h new file mode 100644 index 0000000000..4ac5816dbc --- /dev/null +++ b/engines/titanic/core/game_object_desc_item.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_GAME_OBJECT_DESK_ITEM_H +#define TITANIC_GAME_OBJECT_DESK_ITEM_H + +#include "titanic/core/movie_clip.h" +#include "titanic/core/tree_item.h" +#include "titanic/core/list.h" + +namespace Titanic { + +class CGameObjectDescItem : public CTreeItem { +protected: + CString _string1; + CString _string2; + List _list1; + List _list2; + CMovieClipList _clipList; +public: + CLASSDEF + CGameObjectDescItem(); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_GAME_OBJECT_DESK_ITEM_H */ diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 8e9ec4e1d6..95175ca174 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -64,6 +64,8 @@ #include "titanic/core/dont_save_file_item.h" #include "titanic/core/drop_target.h" #include "titanic/core/file_item.h" +#include "titanic/core/game_object.h" +#include "titanic/core/game_object_desc_item.h" #include "titanic/core/link_item.h" #include "titanic/core/list.h" #include "titanic/core/message_target.h" @@ -467,6 +469,7 @@ DEFFN(CDropTarget) DEFFN(CFileItem) DEFFN(CFileListItem) DEFFN(CGameObject) +DEFFN(CGameObjectDescItem) DEFFN(CLinkItem) DEFFN(ListItem) DEFFN(CMessageTarget) @@ -1031,6 +1034,7 @@ void CSaveableObject::initClassList() { ADDFN(CFileItem, CTreeItem); ADDFN(CFileListItem, ListItem); ADDFN(CGameObject, CNamedItem); + ADDFN(CGameObjectDescItem, CTreeItem); ADDFN(CLinkItem, CNamedItem); ADDFN(ListItem, CSaveableObject); ADDFN(CMessageTarget, CSaveableObject); @@ -1581,7 +1585,7 @@ void CSaveableObject::saveFooter(SimpleFile *file, int indent) const { file->writeClassEnd(indent); } -bool CSaveableObject::isInstanceOf(const ClassDef *classDef) { +bool CSaveableObject::isInstanceOf(const ClassDef *classDef) const { for (ClassDef *def = getType(); def != nullptr; def = def->_parent) { if (def == classDef) return true; @@ -1590,6 +1594,4 @@ bool CSaveableObject::isInstanceOf(const ClassDef *classDef) { return false; } - - } // End of namespace Titanic diff --git a/engines/titanic/core/saveable_object.h b/engines/titanic/core/saveable_object.h index 1fb509bf20..5a6e4c999d 100644 --- a/engines/titanic/core/saveable_object.h +++ b/engines/titanic/core/saveable_object.h @@ -80,7 +80,7 @@ public: CLASSDEF virtual ~CSaveableObject() {} - bool isInstanceOf(const ClassDef *classDef); + bool isInstanceOf(const ClassDef *classDef) const; /** * Save the data for the class to file diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index ffcee40c6a..127a95071a 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -23,7 +23,13 @@ #include "titanic/core/tree_item.h" #include "titanic/core/dont_save_file_item.h" #include "titanic/core/file_item.h" +#include "titanic/core/game_object.h" +#include "titanic/core/game_object_desc_item.h" +#include "titanic/core/link_item.h" #include "titanic/core/named_item.h" +#include "titanic/core/node_item.h" +#include "titanic/core/view_item.h" +#include "titanic/game/room_item.h" namespace Titanic { @@ -31,6 +37,38 @@ CTreeItem::CTreeItem() : _parent(nullptr), _firstChild(nullptr), _nextSibling(nullptr), _priorSibling(nullptr), _field14(0) { } +bool CTreeItem::isFileItem() const { + return isInstanceOf(CFileItem::_type); +} + +bool CTreeItem::isRoomItem() const { + return isInstanceOf(CRoomItem::_type); +} + +bool CTreeItem::isNodeItem() const { + return isInstanceOf(CNodeItem::_type); +} + +bool CTreeItem::isViewItem() const { + return isInstanceOf(CViewItem::_type); +} + +bool CTreeItem::isLinkItem() const { + return isInstanceOf(CLinkItem::_type); +} + +bool CTreeItem::isNamedItem() const { + return isInstanceOf(CNamedItem::_type); +} + +bool CTreeItem::isGameObject() const { + return isInstanceOf(CGameObject::_type); +} + +bool CTreeItem::isGameObjectDescItem() const { + return isInstanceOf(CGameObjectDescItem::_type); +} + void CTreeItem::save(SimpleFile *file, int indent) const { file->writeNumberLine(0, indent); CMessageTarget::save(file, indent); diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index e218cf3dbb..32b76c987e 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -60,12 +60,42 @@ public: /** * Returns true if the item is a file item */ - virtual bool isFileItem() const { return false; } + virtual bool isFileItem() const; + + /** + * Returns true if the item is a room item + */ + virtual bool isRoomItem() const; + + /** + * Returns true if the item is a node item + */ + virtual bool isNodeItem() const; + + /** + * Returns true if the item is a view item + */ + virtual bool isViewItem() const; + + /** + * Returns true if the item is a link item + */ + virtual bool isLinkItem() const; /** * Returns true if the item is a named item */ - virtual bool isNamedItem() const { return false; } + virtual bool isNamedItem() const; + + /** + * Returns true if the item is a game object + */ + virtual bool isGameObject() const; + + /** + * Returns true if the item is a game object desc item + */ + virtual bool isGameObjectDescItem() const; /** * Gets the name of the item, if any diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index e95977ab56..3c82bdba99 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -62,6 +62,7 @@ MODULE_OBJS := \ core/drop_target.o \ core/file_item.o \ core/game_object.o \ + core/game_object_desc_item.o \ core/link_item.o \ core/list.o \ core/message_target.o \ diff --git a/engines/titanic/pet_control/pet_control_sub1.h b/engines/titanic/pet_control/pet_control_sub1.h index e826182afc..5d0edb6c9f 100644 --- a/engines/titanic/pet_control/pet_control_sub1.h +++ b/engines/titanic/pet_control/pet_control_sub1.h @@ -66,4 +66,4 @@ public: } // End of namespace Titanic -#endif /* TITANIC_PET_CONTROL_H */ +#endif /* TITANIC_PET_CONTROL_SUB1_H */ -- cgit v1.2.3 From f0d992d8548ee8bacae72ecc15e69f9de4187549 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 13 Mar 2016 10:28:45 -0400 Subject: TITANIC: Implemented setMode method for game state --- engines/titanic/game_manager.h | 10 ++++++++++ engines/titanic/game_state.cpp | 25 ++++++++++++++++++++++++- engines/titanic/game_state.h | 7 ++++++- engines/titanic/input_handler.cpp | 12 +++++++++++- engines/titanic/input_handler.h | 16 +++++++++++++--- engines/titanic/screen_manager.h | 7 ++++++- 6 files changed, 70 insertions(+), 7 deletions(-) diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index 1d2a88e626..d53a611a72 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -87,6 +87,16 @@ public: void postLoad(CProjectItem *project); int fn2() { return _gameState._sub.fn2(); } + + /** + * Lock the input handler + */ + void lockInputHandler() { _inputHandler.incLockCount(); } + + /** + * Unlock the input handler + */ + void unlockInputHandler() { _inputHandler.decLockCount(); } }; } // End of namespace Titanic diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index 59e4b7b837..41c4388f64 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -21,12 +21,14 @@ */ #include "titanic/game_state.h" +#include "titanic/game_manager.h" +#include "titanic/screen_manager.h" namespace Titanic { CGameState::CGameState(CGameManager *gameManager) : _gameManager(gameManager), _sub(this), - _field8(0), _fieldC(0), _field10(10), _field14(0), _field18(0), + _field8(0), _fieldC(0), _mode(10), _field14(0), _field18(0), _field1C(0), _field20(0), _field24(0), _field28(0), _field2C(0), _field30(0), _field34(0), _field38(0) { } @@ -55,4 +57,25 @@ void CGameState::load(SimpleFile *file) { _field28 = _field2C = 0; } +void CGameState::setMode(int newMode) { + CScreenManager *sm = CScreenManager::_screenManagerPtr; + + if (newMode == 2 && newMode != _mode) { + if (_gameManager) + _gameManager->lockInputHandler(); + + if (sm && sm->_mouseCursor) + sm->_mouseCursor->hide(); + + } else if (newMode != 2 && newMode != _mode) { + if (sm && sm->_mouseCursor) + sm->_mouseCursor->show(); + + if (_gameManager) + _gameManager->unlockInputHandler(); + } + + _mode = newMode; +} + } // End of namespace Titanic z diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h index e6275dee01..1f93f693c8 100644 --- a/engines/titanic/game_state.h +++ b/engines/titanic/game_state.h @@ -46,7 +46,7 @@ public: CGameStateList _list; int _field8; int _fieldC; - int _field10; + int _mode; int _field14; int _field18; int _field1C; @@ -69,6 +69,11 @@ public: * Load the data for the class from file */ void load(SimpleFile *file); + + /** + * Sets a new mode + */ + void setMode(int newMode); }; } // End of namespace Titanic diff --git a/engines/titanic/input_handler.cpp b/engines/titanic/input_handler.cpp index 0c09429bd4..d5825c0c32 100644 --- a/engines/titanic/input_handler.cpp +++ b/engines/titanic/input_handler.cpp @@ -28,7 +28,7 @@ namespace Titanic { CInputHandler::CInputHandler(CGameManager *owner) : _gameManager(owner), _inputTranslator(nullptr), _field4(0), _field8(0), _fieldC(0), _field10(0), _field14(0), - _field18(0), _field1C(0), _field20(0), _field24(0) { + _lockCount(0), _field24(0) { CScreenManager::_screenManagerPtr->_inputHandler = this; } @@ -36,4 +36,14 @@ void CInputHandler::setTranslator(CInputTranslator *translator) { _inputTranslator = translator; } +void CInputHandler::incLockCount() { + ++_lockCount; +} + +void CInputHandler::decLockCount() { + if (--_lockCount == 0 && _inputTranslator) { + warning("TODO"); + } +} + } // End of namespace Titanic z diff --git a/engines/titanic/input_handler.h b/engines/titanic/input_handler.h index 288630c633..1bc6dc9fe7 100644 --- a/engines/titanic/input_handler.h +++ b/engines/titanic/input_handler.h @@ -23,6 +23,7 @@ #ifndef TITANIC_INPUT_HANDLER_H #define TITANIC_INPUT_HANDLER_H +#include "common/rect.h" #include "titanic/input_translator.h" namespace Titanic { @@ -38,14 +39,23 @@ public: int _fieldC; int _field10; int _field14; - int _field18; - int _field1C; - int _field20; + Common::Point _mousePos; + int _lockCount; int _field24; public: CInputHandler(CGameManager *owner); void setTranslator(CInputTranslator *translator); + + /** + * Increment the lock count + */ + void incLockCount(); + + /** + * Decrement the lock count on the input handler + */ + void decLockCount(); }; } // End of namespace Titanic diff --git a/engines/titanic/screen_manager.h b/engines/titanic/screen_manager.h index 914fc85eb7..d0bcc5dbd8 100644 --- a/engines/titanic/screen_manager.h +++ b/engines/titanic/screen_manager.h @@ -47,6 +47,11 @@ public: CScreenManagerRec(); }; +struct MouseCursor { + void show() {} + void hide() {} +}; + class CScreenManager { protected: TitanicEngine *_vm; @@ -62,7 +67,7 @@ public: Common::Array _backSurfaces; CVideoSurface *_frontRenderSurface; CScreenManagerRec _entries[2]; - void *_mouseCursor; + MouseCursor *_mouseCursor; void *_textCursor; CInputHandler *_inputHandler; int _fontNumber; -- cgit v1.2.3 From c92bf22f0331fbdbc7e440b43ae1973b679befb3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 13 Mar 2016 15:07:27 -0400 Subject: TITANIC: Changed CGameStateSub to CGameLocation, properly implemented it --- engines/titanic/core/named_item.cpp | 22 +++++++ engines/titanic/core/named_item.h | 18 ++++-- engines/titanic/core/project_item.h | 2 +- engines/titanic/core/room_item.cpp | 106 +++++++++++++++++++++++++++++++ engines/titanic/core/room_item.h | 61 ++++++++++++++++++ engines/titanic/core/saveable_object.cpp | 6 +- engines/titanic/core/tree_item.cpp | 2 +- engines/titanic/game/room_item.cpp | 106 ------------------------------- engines/titanic/game/room_item.h | 61 ------------------ engines/titanic/game_location.cpp | 94 +++++++++++++++++++++++++++ engines/titanic/game_location.h | 74 +++++++++++++++++++++ engines/titanic/game_manager.cpp | 6 +- engines/titanic/game_manager.h | 2 +- engines/titanic/game_state.cpp | 6 +- engines/titanic/game_state.h | 4 +- engines/titanic/game_state_sub.cpp | 50 --------------- engines/titanic/game_state_sub.h | 58 ----------------- engines/titanic/game_view.cpp | 4 +- engines/titanic/game_view.h | 12 +++- engines/titanic/main_game_window.cpp | 2 +- engines/titanic/main_game_window.h | 5 +- engines/titanic/module.mk | 4 +- 22 files changed, 403 insertions(+), 302 deletions(-) create mode 100644 engines/titanic/core/room_item.cpp create mode 100644 engines/titanic/core/room_item.h delete mode 100644 engines/titanic/game/room_item.cpp delete mode 100644 engines/titanic/game/room_item.h create mode 100644 engines/titanic/game_location.cpp create mode 100644 engines/titanic/game_location.h delete mode 100644 engines/titanic/game_state_sub.cpp delete mode 100644 engines/titanic/game_state_sub.h diff --git a/engines/titanic/core/named_item.cpp b/engines/titanic/core/named_item.cpp index 641efbd249..cd798a297e 100644 --- a/engines/titanic/core/named_item.cpp +++ b/engines/titanic/core/named_item.cpp @@ -21,6 +21,8 @@ */ #include "titanic/core/named_item.h" +#include "titanic/core/node_item.h" +#include "titanic/core/room_item.h" namespace Titanic { @@ -47,4 +49,24 @@ int CNamedItem::compareTo(const CString &name, int maxLen) const { } } +CNodeItem *CNamedItem::findNode() const { + for (CTreeItem *parent = getParent(); parent; parent = parent->getParent()) { + CNodeItem *node = dynamic_cast(parent); + if (node) + return node; + } + + error("Couldn't find parent node"); +} + +CRoomItem *CNamedItem::findRoom() const { + for (CTreeItem *parent = getParent(); parent; parent = parent->getParent()) { + CRoomItem *room = dynamic_cast(parent); + if (room) + return room; + } + + error("Couldn't find parent node"); +} + } // End of namespace Titanic diff --git a/engines/titanic/core/named_item.h b/engines/titanic/core/named_item.h index 0afbf709c5..6e6178edd4 100644 --- a/engines/titanic/core/named_item.h +++ b/engines/titanic/core/named_item.h @@ -27,6 +27,9 @@ namespace Titanic { +class CNodeItem; +class CRoomItem; + class CNamedItem: public CTreeItem { public: CString _name; @@ -43,11 +46,6 @@ public: */ virtual void load(SimpleFile *file); - /** - * Returns true if the item is a named item - */ - virtual bool isNamedItem() const { return true; } - /** * Gets the name of the item, if any */ @@ -57,6 +55,16 @@ public: * Compares the name of the item to a passed name */ virtual int compareTo(const CString &name, int maxLen) const; + + /** + * Find a parent node for the item + */ + virtual CNodeItem *findNode() const; + + /** + * Find a parent room item for the item + */ + virtual CRoomItem *findRoom() const; }; } // End of namespace Titanic diff --git a/engines/titanic/core/project_item.h b/engines/titanic/core/project_item.h index 65fe8b88bd..bb96f81245 100644 --- a/engines/titanic/core/project_item.h +++ b/engines/titanic/core/project_item.h @@ -28,7 +28,7 @@ #include "titanic/core/dont_save_file_item.h" #include "titanic/core/file_item.h" #include "titanic/core/list.h" -#include "titanic/game/room_item.h" +#include "titanic/core/room_item.h" namespace Titanic { diff --git a/engines/titanic/core/room_item.cpp b/engines/titanic/core/room_item.cpp new file mode 100644 index 0000000000..b0cefcaf74 --- /dev/null +++ b/engines/titanic/core/room_item.cpp @@ -0,0 +1,106 @@ +/* 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 "titanic/core/room_item.h" + +namespace Titanic { + +CRoomItem::CRoomItem() : CNamedItem(), _roomNumber(0), + _roomDimensionX(0.0), _roomDimensionY(0.0) { +} + +void CRoomItem::save(SimpleFile *file, int indent) const { + file->writeNumberLine(3, indent); + file->writeQuotedLine("Exit Movies", indent); + _exitMovieKey.save(file, indent); + + file->writeNumberLine(_roomDimensionX * 1000.0, indent + 1); + file->writeNumberLine(_roomDimensionY * 1000.0, indent + 1); + + file->writeQuotedLine("Transition Movie", indent); + _transitionMovieKey.save(file, indent); + + file->writeQuotedLine("Movie Clip list", indent); + _clipList.save(file, indent + 1); + + file->writeQuotedLine("Room Rect", indent); + file->writeNumberLine(_roomRect.left, indent + 1); + file->writeNumberLine(_roomRect.top, indent + 1); + file->writeNumberLine(_roomRect.right, indent + 1); + file->writeNumberLine(_roomRect.bottom, indent + 1); + + file->writeQuotedLine("Room Number", indent); + file->writeNumberLine(_roomNumber, indent); + + CNamedItem::save(file, indent); +} + +void CRoomItem::load(SimpleFile *file) { + int val = file->readNumber(); + + switch (val) { + case 3: + // Read exit movie + file->readBuffer(); + _exitMovieKey.load(file); + // Deliberate fall-through + + case 2: + // Read room dimensions + file->readBuffer(); + _roomDimensionX = (double)file->readNumber() / 1000.0; + _roomDimensionY = (double)file->readNumber() / 1000.0; + // Deliberate fall-through + + case 1: + // Read transition movie key and clip list + file->readBuffer(); + _transitionMovieKey.load(file); + + file->readBuffer(); + _clipList.load(file); + loading(); + // Deliberate fall-through + + case 0: + // Read room rect + file->readBuffer(); + _roomRect.left = file->readNumber(); + _roomRect.top = file->readNumber(); + _roomRect.right = file->readNumber(); + _roomRect.bottom = file->readNumber(); + file->readBuffer(); + _roomNumber = file->readNumber(); + break; + + default: + break; + } + + CNamedItem::load(file); +} + +void CRoomItem::loading() { + // TODO +} + +} // End of namespace Titanic diff --git a/engines/titanic/core/room_item.h b/engines/titanic/core/room_item.h new file mode 100644 index 0000000000..2235f6a5d2 --- /dev/null +++ b/engines/titanic/core/room_item.h @@ -0,0 +1,61 @@ +/* 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. + * + */ + +#ifndef TITANIC_ROOM_ITEM_H +#define TITANIC_ROOM_ITEM_H + +#include "common/rect.h" +#include "titanic/core/list.h" +#include "titanic/core/movie_clip.h" +#include "titanic/core/named_item.h" +#include "titanic/core/resource_key.h" + +namespace Titanic { + +class CRoomItem : public CNamedItem { +public: + Common::Rect _roomRect; + CMovieClipList _clipList; + int _roomNumber; + CResourceKey _transitionMovieKey; + CResourceKey _exitMovieKey; + double _roomDimensionX, _roomDimensionY; + + void loading(); +public: + CLASSDEF + CRoomItem(); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ROOM_ITEM_H */ diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 95175ca174..449eb9a5fb 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -73,6 +73,7 @@ #include "titanic/core/multi_drop_target.h" #include "titanic/core/node_item.h" #include "titanic/core/project_item.h" +#include "titanic/core/room_item.h" #include "titanic/core/saveable_object.h" #include "titanic/core/static_image.h" #include "titanic/core/turn_on_object.h" @@ -181,7 +182,6 @@ #include "titanic/game/reserved_table.h" #include "titanic/game/restaurant_cylinder_holder.h" #include "titanic/game/restaurant_phonograph.h" -#include "titanic/game/room_item.h" #include "titanic/game/sauce_dispensor.h" #include "titanic/game/search_point.h" #include "titanic/game/season_background.h" @@ -479,6 +479,7 @@ DEFFN(CNamedItem) DEFFN(CNodeItem) DEFFN(CProjectItem) DEFFN(CResourceKey) +DEFFN(CRoomItem) DEFFN(CSaveableObject) DEFFN(CStaticImage) DEFFN(CTurnOnObject) @@ -587,7 +588,6 @@ DEFFN(CReplacementEar) DEFFN(CReservedTable) DEFFN(CRestaurantCylinderHolder) DEFFN(CRestaurantPhonograph) -DEFFN(CRoomItem) DEFFN(CSauceDispensor) DEFFN(CSearchPoint) DEFFN(CSeasonBackground) @@ -1044,6 +1044,7 @@ void CSaveableObject::initClassList() { ADDFN(CNodeItem, CNamedItem); ADDFN(CProjectItem, CFileItem); ADDFN(CResourceKey, CSaveableObject); + ADDFN(CRoomItem, CNamedItem); ADDFN(CSaveableObject, CSaveableObject); ADDFN(CStaticImage, CGameObject); ADDFN(CTurnOnObject, CBackground); @@ -1153,7 +1154,6 @@ void CSaveableObject::initClassList() { ADDFN(CReservedTable, CGameObject); ADDFN(CRestaurantCylinderHolder, CDropTarget); ADDFN(CRestaurantPhonograph, CPhonograph); - ADDFN(CRoomItem, CNamedItem); ADDFN(CSauceDispensor, CBackground); ADDFN(CSearchPoint, CGameObject); ADDFN(CSeasonBackground, CBackground); diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index 127a95071a..3599732080 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -29,7 +29,7 @@ #include "titanic/core/named_item.h" #include "titanic/core/node_item.h" #include "titanic/core/view_item.h" -#include "titanic/game/room_item.h" +#include "titanic/core/room_item.h" namespace Titanic { diff --git a/engines/titanic/game/room_item.cpp b/engines/titanic/game/room_item.cpp deleted file mode 100644 index 17e0ffca2d..0000000000 --- a/engines/titanic/game/room_item.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* 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 "titanic/game/room_item.h" - -namespace Titanic { - -CRoomItem::CRoomItem() : CNamedItem(), _roomNumber(0), - _roomDimensionX(0.0), _roomDimensionY(0.0) { -} - -void CRoomItem::save(SimpleFile *file, int indent) const { - file->writeNumberLine(3, indent); - file->writeQuotedLine("Exit Movies", indent); - _exitMovieKey.save(file, indent); - - file->writeNumberLine(_roomDimensionX * 1000.0, indent + 1); - file->writeNumberLine(_roomDimensionY * 1000.0, indent + 1); - - file->writeQuotedLine("Transition Movie", indent); - _transitionMovieKey.save(file, indent); - - file->writeQuotedLine("Movie Clip list", indent); - _clipList.save(file, indent + 1); - - file->writeQuotedLine("Room Rect", indent); - file->writeNumberLine(_roomRect.left, indent + 1); - file->writeNumberLine(_roomRect.top, indent + 1); - file->writeNumberLine(_roomRect.right, indent + 1); - file->writeNumberLine(_roomRect.bottom, indent + 1); - - file->writeQuotedLine("Room Number", indent); - file->writeNumberLine(_roomNumber, indent); - - CNamedItem::save(file, indent); -} - -void CRoomItem::load(SimpleFile *file) { - int val = file->readNumber(); - - switch (val) { - case 3: - // Read exit movie - file->readBuffer(); - _exitMovieKey.load(file); - // Deliberate fall-through - - case 2: - // Read room dimensions - file->readBuffer(); - _roomDimensionX = (double)file->readNumber() / 1000.0; - _roomDimensionY = (double)file->readNumber() / 1000.0; - // Deliberate fall-through - - case 1: - // Read transition movie key and clip list - file->readBuffer(); - _transitionMovieKey.load(file); - - file->readBuffer(); - _clipList.load(file); - loading(); - // Deliberate fall-through - - case 0: - // Read room rect - file->readBuffer(); - _roomRect.left = file->readNumber(); - _roomRect.top = file->readNumber(); - _roomRect.right = file->readNumber(); - _roomRect.bottom = file->readNumber(); - file->readBuffer(); - _roomNumber = file->readNumber(); - break; - - default: - break; - } - - CNamedItem::load(file); -} - -void CRoomItem::loading() { - // TODO -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/room_item.h b/engines/titanic/game/room_item.h deleted file mode 100644 index 2235f6a5d2..0000000000 --- a/engines/titanic/game/room_item.h +++ /dev/null @@ -1,61 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_ROOM_ITEM_H -#define TITANIC_ROOM_ITEM_H - -#include "common/rect.h" -#include "titanic/core/list.h" -#include "titanic/core/movie_clip.h" -#include "titanic/core/named_item.h" -#include "titanic/core/resource_key.h" - -namespace Titanic { - -class CRoomItem : public CNamedItem { -public: - Common::Rect _roomRect; - CMovieClipList _clipList; - int _roomNumber; - CResourceKey _transitionMovieKey; - CResourceKey _exitMovieKey; - double _roomDimensionX, _roomDimensionY; - - void loading(); -public: - CLASSDEF - CRoomItem(); - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_ROOM_ITEM_H */ diff --git a/engines/titanic/game_location.cpp b/engines/titanic/game_location.cpp new file mode 100644 index 0000000000..cd4481ed31 --- /dev/null +++ b/engines/titanic/game_location.cpp @@ -0,0 +1,94 @@ +/* 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 "titanic/game_location.h" +#include "titanic/game_manager.h" +#include "titanic/game_state.h" +#include "titanic/core/project_item.h" + +namespace Titanic { + +#define STARTING_ROOM 3 +#define STARTING_NODE 1 +#define STARTING_VIEW 4 + +CGameLocation::CGameLocation(CGameState *owner) : _gameState(owner), + _view(nullptr), _roomNumber(STARTING_ROOM), + _nodeNumber(STARTING_NODE), _viewNumber(STARTING_VIEW) { +} + +void CGameLocation::save(SimpleFile *file) const { + file->writeNumber(_roomNumber); + file->writeNumber(_nodeNumber); + file->writeNumber(_viewNumber); +} + +void CGameLocation::load(SimpleFile *file) { + _view = nullptr; + _roomNumber = file->readNumber(); + _nodeNumber = file->readNumber(); + _viewNumber = file->readNumber(); +} + +CViewItem *CGameLocation::getView() { + if (!_view) { + CGameManager *gm = _gameState->_gameManager; + _view = gm->_project->findView(_roomNumber, _nodeNumber, _viewNumber); + + if (!_view) { + // Fallback if view not found + _view = gm->_project->findView(STARTING_ROOM, + STARTING_NODE, STARTING_VIEW); + + if (!_view) { + // Fallback for the fallback + for (int idx = 0; idx < 99 && !_view; ++idx) { + _view = gm->_project->findView(idx, 1, 1); + } + } + } + } + + if (!_view) { + // Okay seriously, yet another fallback if view not found + _viewNumber = _nodeNumber = _roomNumber = -1; + _view = nullptr; + } else { + _viewNumber = _view->_viewNumber; + _nodeNumber = getNode()->_nodeNumber; + _roomNumber = getRoom()->_roomNumber; + } + + return _view; +} + +CNodeItem *CGameLocation::getNode() { + CViewItem *view = getView(); + return !view ? nullptr : view->findNode(); +} + +CRoomItem *CGameLocation::getRoom() { + CViewItem *view = getView(); + return !view ? nullptr : view->findRoom(); +} + +} // End of namespace Titanic z diff --git a/engines/titanic/game_location.h b/engines/titanic/game_location.h new file mode 100644 index 0000000000..94cea799e8 --- /dev/null +++ b/engines/titanic/game_location.h @@ -0,0 +1,74 @@ +/* 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. + * + */ + +#ifndef TITANIC_GAME_LOCATION_H +#define TITANIC_GAME_LOCATION_H + +#include "titanic/simple_file.h" +#include "titanic/core/node_item.h" +#include "titanic/core/room_item.h" +#include "titanic/core/view_item.h" + +namespace Titanic { + +class CGameState; + +class CGameLocation { +private: + CGameState *_gameState; + CViewItem *_view; + + int _roomNumber; + int _nodeNumber; + int _viewNumber; +public: + CGameLocation(CGameState *owner); + + /** + * Save the data for the class to file + */ + void save(SimpleFile *file) const; + + /** + * Load the data for the class from file + */ + void load(SimpleFile *file); + + /** + * Get the current view + */ + CViewItem *getView(); + + /** + * Get the current node + */ + CNodeItem *getNode(); + + /** + * Get the current room + */ + CRoomItem *getRoom(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_GAME_LOCATION_H */ diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index d8409e6864..53e7b34409 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -66,9 +66,9 @@ void CGameManager::postLoad(CProjectItem *project) { _gameView->postLoad(); if (!_gameView->_fieldC) { - int v = fn2(); - if (v) - _gameView->proc3(v); + CViewItem *view = getView(); + if (view) + _gameView->setView(view); } } diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index d53a611a72..394bb6777a 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -86,7 +86,7 @@ public: */ void postLoad(CProjectItem *project); - int fn2() { return _gameState._sub.fn2(); } + CViewItem *getView() { return _gameState._gameLocation.getView(); } /** * Lock the input handler diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index 41c4388f64..b8b5ec1362 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -27,7 +27,7 @@ namespace Titanic { CGameState::CGameState(CGameManager *gameManager) : - _gameManager(gameManager), _sub(this), + _gameManager(gameManager), _gameLocation(this), _field8(0), _fieldC(0), _mode(10), _field14(0), _field18(0), _field1C(0), _field20(0), _field24(0), _field28(0), _field2C(0), _field30(0), _field34(0), _field38(0) { @@ -40,7 +40,7 @@ void CGameState::save(SimpleFile *file) const { file->writeNumber(_field14); file->writeNumber(_field24); file->writeNumber(_field38); - _sub.save(file); + _gameLocation.save(file); file->writeNumber(_field1C); } @@ -51,7 +51,7 @@ void CGameState::load(SimpleFile *file) { _field14 = file->readNumber(); _field24 = file->readNumber(); _field38 = file->readNumber(); - _sub.load(file); + _gameLocation.load(file); _field1C = file->readNumber(); _field28 = _field2C = 0; diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h index 1f93f693c8..f08216383e 100644 --- a/engines/titanic/game_state.h +++ b/engines/titanic/game_state.h @@ -25,7 +25,7 @@ #include "titanic/core/list.h" #include "titanic/simple_file.h" -#include "titanic/game_state_sub.h" +#include "titanic/game_location.h" namespace Titanic { @@ -42,7 +42,7 @@ public: class CGameState { public: CGameManager *_gameManager; - CGameStateSub _sub; + CGameLocation _gameLocation; CGameStateList _list; int _field8; int _fieldC; diff --git a/engines/titanic/game_state_sub.cpp b/engines/titanic/game_state_sub.cpp deleted file mode 100644 index 2e379a0edd..0000000000 --- a/engines/titanic/game_state_sub.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* 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 "titanic/game_state_sub.h" -#include "titanic/game_state.h" - -namespace Titanic { - -CGameStateSub::CGameStateSub(CGameState *owner) : _gameState(owner), - _field0(0), _field4(0), _field8(0), _fieldC(0) { -} - -void CGameStateSub::save(SimpleFile *file) const { - file->writeNumber(_field4); - file->writeNumber(_field8); - file->writeNumber(_fieldC); -} - -void CGameStateSub::load(SimpleFile *file) { - _field0 = 0; - _field4 = file->readNumber(); - _field8 = file->readNumber(); - _fieldC = file->readNumber(); -} - -int CGameStateSub::fn2() { - warning("TODO"); - return 0; -} - -} // End of namespace Titanic z diff --git a/engines/titanic/game_state_sub.h b/engines/titanic/game_state_sub.h deleted file mode 100644 index 82917d9021..0000000000 --- a/engines/titanic/game_state_sub.h +++ /dev/null @@ -1,58 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_GAME_STATE_SUB_H -#define TITANIC_GAME_STATE_SUB_H - -#include "titanic/simple_file.h" - -namespace Titanic { - -class CGameState; - -class CGameStateSub { -private: - CGameState *_gameState; -public: - int _field0; - int _field4; - int _field8; - int _fieldC; -public: - CGameStateSub(CGameState *owner); - - /** - * Save the data for the class to file - */ - void save(SimpleFile *file) const; - - /** - * Load the data for the class from file - */ - void load(SimpleFile *file); - - int fn2(); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_GAME_STATE_SUB_H */ diff --git a/engines/titanic/game_view.cpp b/engines/titanic/game_view.cpp index a0542b548f..a8b8a02530 100644 --- a/engines/titanic/game_view.cpp +++ b/engines/titanic/game_view.cpp @@ -54,8 +54,8 @@ CSTGameView::CSTGameView(CMainGameWindow *gameWindow) : CGameView(), _gameWindow(gameWindow) { } -void CSTGameView::proc3(int v) { - _gameWindow->fn1(v); +void CSTGameView::setView(CViewItem *view) { + _gameWindow->setActiveView(view); } void CSTGameView::proc4() { diff --git a/engines/titanic/game_view.h b/engines/titanic/game_view.h index 5a2c04a9c8..2e4f700ad5 100644 --- a/engines/titanic/game_view.h +++ b/engines/titanic/game_view.h @@ -52,7 +52,11 @@ public: virtual void deleteView(int roomNumber, int nodeNumber, int viewNumber); - virtual void proc3(int v) = 0; + /** + * Set the currently active view + */ + virtual void setView(CViewItem *item) = 0; + virtual void proc4() = 0; }; @@ -62,7 +66,11 @@ private: public: CSTGameView(CMainGameWindow *gameWindow); - virtual void proc3(int v); + /** + * Set the currently active view + */ + virtual void setView(CViewItem *item); + virtual void proc4(); }; diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 32647051d7..18f8dca984 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -80,7 +80,7 @@ int CMainGameWindow::selectSavegame() { return -1; } -void CMainGameWindow::fn1(int v) { +void CMainGameWindow::setActiveView(CViewItem *view) { warning("TODO"); } diff --git a/engines/titanic/main_game_window.h b/engines/titanic/main_game_window.h index e6e724191a..ec8eff3ec6 100644 --- a/engines/titanic/main_game_window.h +++ b/engines/titanic/main_game_window.h @@ -69,7 +69,10 @@ public: */ void applicationStarting(); - void fn1(int v); + /** + * Sets the view to be shown + */ + void setActiveView(CViewItem *view); void fn2(); }; diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 3c82bdba99..48f6ce640b 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -4,9 +4,9 @@ MODULE_OBJS := \ detection.o \ direct_draw.o \ font.o \ + game_location.o \ game_manager.o \ game_state.o \ - game_state_sub.o \ game_view.o \ image.o \ input_handler.o \ @@ -72,6 +72,7 @@ MODULE_OBJS := \ core/node_item.o \ core/project_item.o \ core/resource_key.o \ + core/room_item.o \ core/saveable_object.o \ core/static_image.o \ core/turn_on_object.o \ @@ -180,7 +181,6 @@ MODULE_OBJS := \ game/reserved_table.o \ game/restaurant_cylinder_holder.o \ game/restaurant_phonograph.o \ - game/room_item.o \ game/sauce_dispensor.o \ game/search_point.o \ game/season_background.o \ -- cgit v1.2.3 From 819b773491b728ab0be933ffdcfc333e20d582d3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 13 Mar 2016 15:30:12 -0400 Subject: TITANIC: Add message generation at end of applicationStarting --- engines/titanic/core/saveable_object.cpp | 6 ++++++ engines/titanic/game_manager.cpp | 5 +++++ engines/titanic/game_manager.h | 7 ++++++- engines/titanic/main_game_window.cpp | 18 +++++++++++++++++- engines/titanic/messages/messages.h | 12 +++++++++--- engines/titanic/titanic.h | 3 +++ 6 files changed, 46 insertions(+), 5 deletions(-) diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 449eb9a5fb..3144e60c97 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -779,6 +779,9 @@ DEFFN(CDropobjectMsg) DEFFN(CDropZoneGotObjectMsg) DEFFN(CDropZoneLostObjectMsg) DEFFN(CEditControlMsg) +DEFFN(CEnterNodeMsg); +DEFFN(CEnterRoomMsg); +DEFFN(CEnterViewMsg); DEFFN(CEjectCylinderMsg) DEFFN(CErasePhonographCylinderMsg) DEFFN(CFreshenCookieMsg) @@ -1345,6 +1348,9 @@ void CSaveableObject::initClassList() { ADDFN(CDropZoneGotObjectMsg, CMessage); ADDFN(CDropZoneLostObjectMsg, CMessage); ADDFN(CEditControlMsg, CMessage); + ADDFN(CEnterNodeMsg, CMessage); + ADDFN(CEnterRoomMsg, CMessage); + ADDFN(CEnterViewMsg, CMessage); ADDFN(CEjectCylinderMsg, CMessage); ADDFN(CErasePhonographCylinderMsg, CMessage); ADDFN(CFreshenCookieMsg, CMessage); diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index 53e7b34409..0495d08dbd 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -20,6 +20,7 @@ * */ +#include "titanic/titanic.h" #include "titanic/game_manager.h" #include "titanic/game_view.h" #include "titanic/screen_manager.h" @@ -84,4 +85,8 @@ void CGameManager::postLoad(CProjectItem *project) { _sound.postLoad(); } +void CGameManager::initBounds() { + _bounds = Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); +} + } // End of namespace Titanic diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index 394bb6777a..a9bdaaa71f 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -53,7 +53,6 @@ public: class CGameManager { private: CGameView *_gameView; - CGameState _gameState; CSound _sound; CInputHandler _inputHandler; CInputTranslator _inputTranslator; @@ -72,6 +71,7 @@ private: uint _tickCount2; public: CProjectItem *_project; + CGameState _gameState; public: CGameManager(CProjectItem *project, CGameView *gameView); ~CGameManager(); @@ -97,6 +97,11 @@ public: * Unlock the input handler */ void unlockInputHandler() { _inputHandler.decLockCount(); } + + /** + * Set default screen bounds + */ + void initBounds(); }; } // End of namespace Titanic diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 18f8dca984..01996e6b13 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -24,6 +24,7 @@ #include "titanic/main_game_window.h" #include "titanic/game_manager.h" #include "titanic/game_view.h" +#include "titanic/messages/messages.h" namespace Titanic { @@ -65,7 +66,22 @@ void CMainGameWindow::applicationStarting() { // Load either a new game or selected existing save _project->loadGame(saveSlot); - // TODO: Cursor/image and message generation + // TODO: Cursor/image + + // Generate starting messages + CViewItem *view = _gameManager->_gameState._gameLocation.getView(); + CEnterViewMsg enterViewMsg(view); + enterViewMsg.execute(view, nullptr, MSGFLAG_SCAN); + + CNodeItem *node = view->findNode(); + CEnterNodeMsg enterNodeMsg(node); + enterNodeMsg.execute(node, nullptr, MSGFLAG_SCAN); + + CRoomItem *room = view->findRoom(); + CEnterRoomMsg enterRoomMsg(room); + enterRoomMsg.execute(room, nullptr, MSGFLAG_SCAN); + + _gameManager->initBounds(); } int CMainGameWindow::loadGame() { diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 80ce590b87..5331881b85 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -25,6 +25,9 @@ #include "titanic/core/saveable_object.h" #include "titanic/core/game_object.h" +#include "titanic/core/node_item.h" +#include "titanic/core/room_item.h" +#include "titanic/core/view_item.h" namespace Titanic { @@ -241,8 +244,9 @@ MESSAGE1(CDropobjectMsg, int, value, 0); MESSAGE1(CDropZoneGotObjectMsg, int, value, 0); MESSAGE1(CDropZoneLostObjectMsg, int, value, 0); MESSAGE1(CEjectCylinderMsg, int, value, 0); -MESSAGE0(CEnterNodeMsg); -MESSAGE0(CEnterViewMsg); +MESSAGE1(CEnterNodeMsg, CNodeItem *, node, nullptr); +MESSAGE1(CEnterRoomMsg, CRoomItem *, room, nullptr); +MESSAGE1(CEnterViewMsg, CViewItem *, view, nullptr); MESSAGE0(CErasePhonographCylinderMsg); MESSAGE2(CFreshenCookieMsg, int, value1, 0, int, value2, 0); MESSAGE1(CGetChevClassBits, int, value, 0); @@ -259,7 +263,9 @@ MESSAGE0(CInitializeAnimMsg); MESSAGE1(CIsEarBowlPuzzleDone, int, value, 0); MESSAGE1(CIsParrotPresentMsg, int, value, 0); MESSAGE1(CKeyCharMsg, int, value, 32); -MESSAGE0(CLeaveViewMsg); +MESSAGE1(CLeaveNodeMsg, CNodeItem *, node, nullptr); +MESSAGE1(CLeaveRoomMsg, CRoomItem *, room, nullptr); +MESSAGE1(CLeaveViewMsg, CViewItem *, view, nullptr); MESSAGE2(CLemonFallsFromTreeMsg, int, value1, 0, int, value2, 0); MESSAGE1(CLoadSuccessMsg, int, ticks, 0); MESSAGE1(CLockPhonographMsg, int, value, 0); diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index 3a95e86b54..978f9b3d4f 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -50,6 +50,9 @@ enum TitanicDebugChannels { #define TITANIC_SAVEGAME_VERSION 1 +#define SCREEN_WIDTH 640 +#define SCREEN_HEIGHT 480 + #define ERROR_BASIC 1 #define ERROR_INTERMEDIATE 2 #define ERROR_DETAILED 3 -- cgit v1.2.3 From b57805bd4b5f9beca9fe6e8e697744c89cad09f3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 13 Mar 2016 15:39:35 -0400 Subject: TITANIC: Added main game event loop --- engines/titanic/titanic.cpp | 13 +++++++++++++ engines/titanic/titanic.h | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index bcccf1b880..b00e1c3088 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -87,7 +87,20 @@ void TitanicEngine::deinitialize() { Common::Error TitanicEngine::run() { initialize(); + // Main event loop + while (!shouldQuit()) { + processEvents(); + g_system->delayMillis(5); + } + + deinitialize(); return Common::kNoError; } +void TitanicEngine::processEvents() { + Common::Event evt; + g_system->getEventManager()->pollEvent(evt); + +} + } // End of namespace Titanic diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index 978f9b3d4f..ad0ed75165 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -80,6 +80,11 @@ private: * Handles game deinitialization */ void deinitialize(); + + /** + * Processes pending events + */ + void processEvents(); protected: const TitanicGameDescription *_gameDescription; int _loadSaveSlot; -- cgit v1.2.3 From 0cc014d06ba3b2588dfb7cb46366aa3d0a875d04 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 13 Mar 2016 16:25:25 -0400 Subject: TITANIC: Implemented dumping of the project hierarchy --- engines/titanic/core/named_item.cpp | 7 +++++++ engines/titanic/core/named_item.h | 5 +++++ engines/titanic/core/tree_item.cpp | 21 +++++++++++++++++++++ engines/titanic/core/tree_item.h | 11 +++++++++++ engines/titanic/main_game_window.cpp | 3 +++ 5 files changed, 47 insertions(+) diff --git a/engines/titanic/core/named_item.cpp b/engines/titanic/core/named_item.cpp index cd798a297e..49cfdb4622 100644 --- a/engines/titanic/core/named_item.cpp +++ b/engines/titanic/core/named_item.cpp @@ -26,6 +26,13 @@ namespace Titanic { +CString CNamedItem::dumpItem(int indent) const { + CString result = CTreeItem::dumpItem(indent); + result += " " + _name; + + return result; +} + void CNamedItem::save(SimpleFile *file, int indent) const { file->writeNumberLine(0, indent); file->writeQuotedLine(_name, indent); diff --git a/engines/titanic/core/named_item.h b/engines/titanic/core/named_item.h index 6e6178edd4..aac81ec209 100644 --- a/engines/titanic/core/named_item.h +++ b/engines/titanic/core/named_item.h @@ -36,6 +36,11 @@ public: public: CLASSDEF + /** + * Dump the item + */ + virtual CString dumpItem(int indent) const; + /** * Save the data for the class to file */ diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index 3599732080..cda3ca4b2f 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -37,6 +37,27 @@ CTreeItem::CTreeItem() : _parent(nullptr), _firstChild(nullptr), _nextSibling(nullptr), _priorSibling(nullptr), _field14(0) { } +void CTreeItem::dump(int indent) { + CString line = dumpItem(indent); + debug("%s", line.c_str()); + + CTreeItem *item = getFirstChild(); + while (item) { + item->dump(indent + 1); + + item = item->getNextSibling(); + } +} + +CString CTreeItem::dumpItem(int indent) const { + CString result; + for (int idx = 0; idx < indent; ++idx) + result += '\t'; + result += getType()->_className; + + return result; +} + bool CTreeItem::isFileItem() const { return isInstanceOf(CFileItem::_type); } diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index 32b76c987e..be381c55c1 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -42,6 +42,17 @@ public: CLASSDEF CTreeItem(); + + /** + * Dump the item and any of it's children + */ + void dump(int indent); + + /** + * Dump the item + */ + virtual CString dumpItem(int indent) const; + /** * Save the data for the class to file */ diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 01996e6b13..18b033f1c9 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -67,6 +67,9 @@ void CMainGameWindow::applicationStarting() { _project->loadGame(saveSlot); // TODO: Cursor/image + //***DEBUG**** + _project->dump(0); + return; // Generate starting messages CViewItem *view = _gameManager->_gameState._gameLocation.getView(); -- cgit v1.2.3 From 75286e83212111bfb0d53ff7ea175559afd64963 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 13 Mar 2016 18:00:30 -0400 Subject: TITANIC: Fix loading project data --- engines/titanic/core/tree_item.cpp | 2 +- engines/titanic/game_location.cpp | 4 ++-- engines/titanic/main_game_window.cpp | 3 --- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index cda3ca4b2f..b476777d90 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -169,7 +169,7 @@ CTreeItem *CTreeItem::findNextInstanceOf(ClassDef *classDef, CTreeItem *startIte void CTreeItem::addUnder(CTreeItem *newParent) { if (newParent->_firstChild) - addSibling(newParent->getLastSibling()); + addSibling(newParent->_firstChild->getLastSibling()); else setParent(newParent); } diff --git a/engines/titanic/game_location.cpp b/engines/titanic/game_location.cpp index cd4481ed31..5f87d3bc67 100644 --- a/engines/titanic/game_location.cpp +++ b/engines/titanic/game_location.cpp @@ -74,8 +74,8 @@ CViewItem *CGameLocation::getView() { _view = nullptr; } else { _viewNumber = _view->_viewNumber; - _nodeNumber = getNode()->_nodeNumber; - _roomNumber = getRoom()->_roomNumber; + _nodeNumber = _view->findNode()->_nodeNumber; + _roomNumber = _view->findRoom()->_roomNumber; } return _view; diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 18b033f1c9..01996e6b13 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -67,9 +67,6 @@ void CMainGameWindow::applicationStarting() { _project->loadGame(saveSlot); // TODO: Cursor/image - //***DEBUG**** - _project->dump(0); - return; // Generate starting messages CViewItem *view = _gameManager->_gameState._gameLocation.getView(); -- cgit v1.2.3 From bc1585ccee0fe156a4f6d2e6e721c606ac6dd8a9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 13 Mar 2016 18:21:12 -0400 Subject: TITANIC: Change some script method return types --- engines/titanic/true_talk/barbot_script.cpp | 12 ++++++------ engines/titanic/true_talk/barbot_script.h | 6 +++--- engines/titanic/true_talk/bellbot_script.cpp | 6 +++--- engines/titanic/true_talk/bellbot_script.h | 6 +++--- engines/titanic/true_talk/deskbot_script.cpp | 6 +++--- engines/titanic/true_talk/deskbot_script.h | 6 +++--- engines/titanic/true_talk/doorbot_script.cpp | 6 +++--- engines/titanic/true_talk/doorbot_script.h | 6 +++--- engines/titanic/true_talk/liftbot_script.cpp | 6 +++--- engines/titanic/true_talk/liftbot_script.h | 6 +++--- engines/titanic/true_talk/maitred_script.cpp | 6 +++--- engines/titanic/true_talk/maitred_script.h | 6 +++--- engines/titanic/true_talk/parrot_script.cpp | 4 ++-- engines/titanic/true_talk/parrot_script.h | 4 ++-- engines/titanic/true_talk/succubus_script.cpp | 4 ++-- engines/titanic/true_talk/succubus_script.h | 4 ++-- engines/titanic/true_talk/tt_named_script.cpp | 14 +++++++------- engines/titanic/true_talk/tt_named_script.h | 8 ++++---- 18 files changed, 58 insertions(+), 58 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index a9a0be16c3..ab4fbb2384 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -44,19 +44,19 @@ int BarbotScript::proc15() const { return 0; } -int BarbotScript::proc16() const { +bool BarbotScript::proc16() const { warning("TODO"); - return 0; + return false; } -int BarbotScript::proc17() const { +bool BarbotScript::proc17() const { warning("TODO"); - return 0; + return false; } -int BarbotScript::proc18() const { +bool BarbotScript::proc18() const { warning("TODO"); - return 0; + return false; } int BarbotScript::proc21(int v) { diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index f40c67dfab..2ea86f0803 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -37,9 +37,9 @@ public: virtual void proc7(int v1, int v2); virtual int proc10() const; virtual int proc15() const; - virtual int proc16() const; - virtual int proc17() const; - virtual int proc18() const; + virtual bool proc16() const; + virtual bool proc17() const; + virtual bool proc18() const; virtual int proc21(int v); virtual int proc22() const; virtual int proc23() const; diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index a296752004..52d8a19145 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -59,17 +59,17 @@ int BellbotScript::proc15() const { return 0; } -int BellbotScript::proc16() const { +bool BellbotScript::proc16() const { warning("TODO"); return 0; } -int BellbotScript::proc17() const { +bool BellbotScript::proc17() const { warning("TODO"); return 0; } -int BellbotScript::proc18() const { +bool BellbotScript::proc18() const { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index e792d160e4..cc71c263b1 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -42,9 +42,9 @@ public: virtual void proc7(int v1, int v2); virtual int proc10() const; virtual int proc15() const; - virtual int proc16() const; - virtual int proc17() const; - virtual int proc18() const; + virtual bool proc16() const; + virtual bool proc17() const; + virtual bool proc18() const; virtual int proc21(int v); virtual int proc22() const; virtual int proc23() const; diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index b79714e2e1..f17c04145e 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -60,17 +60,17 @@ int DeskbotScript::proc15() const { return 0; } -int DeskbotScript::proc16() const { +bool DeskbotScript::proc16() const { warning("TODO"); return 0; } -int DeskbotScript::proc17() const { +bool DeskbotScript::proc17() const { warning("TODO"); return 0; } -int DeskbotScript::proc18() const { +bool DeskbotScript::proc18() const { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index c40aca988a..dcab218e97 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -36,9 +36,9 @@ public: virtual void proc7(int v1, int v2); virtual int proc10() const; virtual int proc15() const; - virtual int proc16() const; - virtual int proc17() const; - virtual int proc18() const; + virtual bool proc16() const; + virtual bool proc17() const; + virtual bool proc18() const; virtual int proc21(int v); virtual int proc22() const; virtual int proc23() const; diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 4bca9a6491..43b9e46335 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -44,17 +44,17 @@ int DoorbotScript::proc15() const { return 0; } -int DoorbotScript::proc16() const { +bool DoorbotScript::proc16() const { warning("TODO"); return 0; } -int DoorbotScript::proc17() const { +bool DoorbotScript::proc17() const { warning("TODO"); return 0; } -int DoorbotScript::proc18() const { +bool DoorbotScript::proc18() const { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 549476036d..37722d4862 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -39,9 +39,9 @@ public: virtual void proc7(int v1, int v2); virtual int proc10() const; virtual int proc15() const; - virtual int proc16() const; - virtual int proc17() const; - virtual int proc18() const; + virtual bool proc16() const; + virtual bool proc17() const; + virtual bool proc18() const; virtual int proc21(int v); virtual int proc22() const; virtual int proc23() const; diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index 4bd994fbbc..c30d226c89 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -49,17 +49,17 @@ int LiftbotScript::proc15() const { return 0; } -int LiftbotScript::proc16() const { +bool LiftbotScript::proc16() const { warning("TODO"); return 0; } -int LiftbotScript::proc17() const { +bool LiftbotScript::proc17() const { warning("TODO"); return 0; } -int LiftbotScript::proc18() const { +bool LiftbotScript::proc18() const { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index ddbdabb145..8564bb53ef 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -38,9 +38,9 @@ public: virtual int proc9() const; virtual int proc10() const; virtual int proc15() const; - virtual int proc16() const; - virtual int proc17() const; - virtual int proc18() const; + virtual bool proc16() const; + virtual bool proc17() const; + virtual bool proc18() const; virtual int proc21(int v); virtual int proc22() const; virtual int proc23() const; diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index 1caec6249b..b88dfc611e 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -53,17 +53,17 @@ int MaitreDScript::proc10() const { return 0; } -int MaitreDScript::proc16() const { +bool MaitreDScript::proc16() const { warning("TODO"); return 0; } -int MaitreDScript::proc17() const { +bool MaitreDScript::proc17() const { warning("TODO"); return 0; } -int MaitreDScript::proc18() const { +bool MaitreDScript::proc18() const { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index 2af3f42dac..a5fbb72c82 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -35,9 +35,9 @@ public: virtual int proc6() const; virtual void proc7(int v1, int v2); virtual int proc10() const; - virtual int proc16() const; - virtual int proc17() const; - virtual int proc18() const; + virtual bool proc16() const; + virtual bool proc17() const; + virtual bool proc18() const; virtual int proc21(int v); virtual int proc22() const; virtual int proc23() const; diff --git a/engines/titanic/true_talk/parrot_script.cpp b/engines/titanic/true_talk/parrot_script.cpp index 9772f2111c..e97d32dd30 100644 --- a/engines/titanic/true_talk/parrot_script.cpp +++ b/engines/titanic/true_talk/parrot_script.cpp @@ -39,12 +39,12 @@ int ParrotScript::proc10() const { return 0; } -int ParrotScript::proc17() const { +bool ParrotScript::proc17() const { warning("TODO"); return 0; } -int ParrotScript::proc18() const { +bool ParrotScript::proc18() const { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/parrot_script.h b/engines/titanic/true_talk/parrot_script.h index 0dde14d10f..ac0b08c982 100644 --- a/engines/titanic/true_talk/parrot_script.h +++ b/engines/titanic/true_talk/parrot_script.h @@ -36,8 +36,8 @@ public: virtual int proc6() const; virtual void proc7(int v1, int v2); virtual int proc10() const; - virtual int proc17() const; - virtual int proc18() const; + virtual bool proc17() const; + virtual bool proc18() const; virtual int proc23() const; virtual void proc24(); virtual int proc25() const; diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp index c21edefd8f..0c1f6700ee 100644 --- a/engines/titanic/true_talk/succubus_script.cpp +++ b/engines/titanic/true_talk/succubus_script.cpp @@ -39,12 +39,12 @@ int SuccUBusScript::proc10() const { return 0; } -int SuccUBusScript::proc17() const { +bool SuccUBusScript::proc17() const { warning("TODO"); return 0; } -int SuccUBusScript::proc18() const { +bool SuccUBusScript::proc18() const { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h index 595657b8e7..2131775fa5 100644 --- a/engines/titanic/true_talk/succubus_script.h +++ b/engines/titanic/true_talk/succubus_script.h @@ -39,8 +39,8 @@ public: virtual int proc6() const; virtual void proc7(int v1, int v2); virtual int proc10() const; - virtual int proc17() const; - virtual int proc18() const; + virtual bool proc17() const; + virtual bool proc18() const; virtual int proc21(int v); virtual int proc23() const; virtual void proc24(); diff --git a/engines/titanic/true_talk/tt_named_script.cpp b/engines/titanic/true_talk/tt_named_script.cpp index dfc5bb243d..89adb16702 100644 --- a/engines/titanic/true_talk/tt_named_script.cpp +++ b/engines/titanic/true_talk/tt_named_script.cpp @@ -91,7 +91,7 @@ int TTNamedScript::proc12() const { return 1; } -void TTNamedScript::proc13() const { +bool TTNamedScript::proc13() const { warning("TODO"); } @@ -103,16 +103,16 @@ int TTNamedScript::proc15() const { return 0; } -int TTNamedScript::proc16() const { - return 1; +bool TTNamedScript::proc16() const { + return true; } -int TTNamedScript::proc17() const { - return 1; +bool TTNamedScript::proc17() const { + return true; } -int TTNamedScript::proc18() const { - return 1; +bool TTNamedScript::proc18() const { + return true; } void TTNamedScript::proc19(int v) { diff --git a/engines/titanic/true_talk/tt_named_script.h b/engines/titanic/true_talk/tt_named_script.h index 968ec2222e..9186507e87 100644 --- a/engines/titanic/true_talk/tt_named_script.h +++ b/engines/titanic/true_talk/tt_named_script.h @@ -81,12 +81,12 @@ public: virtual int proc10() const; virtual int proc11() const; virtual int proc12() const; - virtual void proc13() const; + virtual bool proc13() const; virtual void proc14(int v); virtual int proc15() const; - virtual int proc16() const; - virtual int proc17() const; - virtual int proc18() const; + virtual bool proc16() const; + virtual bool proc17() const; + virtual bool proc18() const; virtual void proc19(int v); virtual void proc20(int v); virtual int proc21(int v); -- cgit v1.2.3 From 041c6475d6dd86f563dae2e19ae732b16ec34ce6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 14 Mar 2016 20:03:32 -0400 Subject: TITANIC: Fleshed out DirectDrawSurface creation --- engines/titanic/core/game_object.cpp | 4 +++ engines/titanic/core/game_object.h | 2 ++ engines/titanic/direct_draw.cpp | 20 +++++++++++++-- engines/titanic/direct_draw.h | 26 +++++++++++++++++-- engines/titanic/game_location.cpp | 21 +++++++++++++++ engines/titanic/game_location.h | 5 ++++ engines/titanic/screen_manager.cpp | 8 ++++-- engines/titanic/screen_manager.h | 24 ++++++++++++++++- engines/titanic/true_talk/tt_named_script.cpp | 1 + engines/titanic/video_surface.cpp | 37 +++++++++++++++++++++++---- engines/titanic/video_surface.h | 36 +++++++++++++++++++++----- 11 files changed, 166 insertions(+), 18 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 3238258a61..f5e9806365 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -118,4 +118,8 @@ void CGameObject::load(SimpleFile *file) { CNamedItem::load(file); } +void CGameObject::fn2() { + error("TODO"); +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 3809ae38d0..c284fb4ebe 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -71,6 +71,8 @@ public: * Load the data for the class from file */ virtual void load(SimpleFile *file); + + void fn2(); }; } // End of namespace Titanic diff --git a/engines/titanic/direct_draw.cpp b/engines/titanic/direct_draw.cpp index d503938fe4..9691ea91f4 100644 --- a/engines/titanic/direct_draw.cpp +++ b/engines/titanic/direct_draw.cpp @@ -22,6 +22,7 @@ #include "common/debug.h" #include "engines/util.h" +#include "graphics/pixelformat.h" #include "titanic/titanic.h" #include "titanic/direct_draw.h" @@ -48,6 +49,13 @@ void DirectDraw::diagnostics() { debugC(ERROR_BASIC, kDebugGraphics, "Running DirectDraw Diagnostic..."); } +DirectDrawSurface *DirectDraw::createSurfaceFromDesc(const DDSurfaceDesc &desc) { + DirectDrawSurface *surface = new DirectDrawSurface(); + surface->create(desc._w, desc._h, Graphics::PixelFormat::createFormatCLUT8()); + + return surface; +} + /*------------------------------------------------------------------------*/ DirectDrawManager::DirectDrawManager(TitanicEngine *vm, int v) : _directDraw(vm) { @@ -87,12 +95,20 @@ void DirectDrawManager::initSurface() { _directDraw.setDisplayMode(_directDraw._width, _directDraw._height, _directDraw._bpp, 0); - _mainSurface = new Graphics::Surface(); + _mainSurface = new DirectDrawSurface(); _mainSurface->create(_directDraw._width, _directDraw._height, Graphics::PixelFormat::createFormatCLUT8()); - _backSurfaces[0] = new Graphics::Surface(); + _backSurfaces[0] = new DirectDrawSurface(); _backSurfaces[0]->create(_directDraw._width, _directDraw._height, Graphics::PixelFormat::createFormatCLUT8()); } +DirectDrawSurface *DirectDrawManager::createSurface(int w, int h, int surfaceNum) { + if (surfaceNum) + return nullptr; + + assert(_mainSurface); + return _directDraw.createSurfaceFromDesc(DDSurfaceDesc(w, h)); +} + } // End of namespace Titanic diff --git a/engines/titanic/direct_draw.h b/engines/titanic/direct_draw.h index cb49efa513..728094e7f7 100644 --- a/engines/titanic/direct_draw.h +++ b/engines/titanic/direct_draw.h @@ -31,6 +31,18 @@ namespace Titanic { class TitanicEngine; +struct DDSurfaceDesc { + int _w; + int _h; + int _flags; + int _caps; + + DDSurfaceDesc(int w, int h) : _w(w), _h(h), _flags(0x1006), _caps(64) {} +}; + +class DirectDrawSurface : public Graphics::Surface { +}; + class DirectDraw { private: TitanicEngine *_vm; @@ -54,13 +66,18 @@ public: * Logs diagnostic information */ void diagnostics(); + + /** + * Create a surface from a passed description record + */ + DirectDrawSurface *createSurfaceFromDesc(const DDSurfaceDesc &desc); }; class DirectDrawManager { public: DirectDraw _directDraw; - Graphics::Surface *_mainSurface; - Graphics::Surface *_backSurfaces[2]; + DirectDrawSurface *_mainSurface; + DirectDrawSurface *_backSurfaces[2]; public: DirectDrawManager(TitanicEngine *vm, int v); @@ -83,6 +100,11 @@ public: * Initializes the surface for the screen */ void initSurface(); + + /** + * Create a surface + */ + DirectDrawSurface *createSurface(int w, int h, int surfaceNum); }; } // End of namespace Titanic diff --git a/engines/titanic/game_location.cpp b/engines/titanic/game_location.cpp index 5f87d3bc67..2a01bbf248 100644 --- a/engines/titanic/game_location.cpp +++ b/engines/titanic/game_location.cpp @@ -23,6 +23,7 @@ #include "titanic/game_location.h" #include "titanic/game_manager.h" #include "titanic/game_state.h" +#include "titanic/core/game_object.h" #include "titanic/core/project_item.h" namespace Titanic { @@ -49,6 +50,26 @@ void CGameLocation::load(SimpleFile *file) { _viewNumber = file->readNumber(); } +void CGameLocation::setView(CViewItem *view) { + if (_view) { + for (CTreeItem *treeItem = view; treeItem; + treeItem = treeItem->scan(_view)) { + CGameObject *obj = dynamic_cast(treeItem); + if (obj) + obj->fn2(); + } + } + + _view = view; + if (_view) { + _viewNumber = _view->_viewNumber; + _nodeNumber = _view->findNode()->_nodeNumber; + _roomNumber = _view->findRoom()->_roomNumber; + } else { + _viewNumber = _nodeNumber = _roomNumber = -1; + } +} + CViewItem *CGameLocation::getView() { if (!_view) { CGameManager *gm = _gameState->_gameManager; diff --git a/engines/titanic/game_location.h b/engines/titanic/game_location.h index 94cea799e8..a64a82403b 100644 --- a/engines/titanic/game_location.h +++ b/engines/titanic/game_location.h @@ -53,6 +53,11 @@ public: */ void load(SimpleFile *file); + /** + * Set the current view + */ + void setView(CViewItem *view); + /** * Get the current view */ diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp index 47e5d3d49a..ebde0e0a6c 100644 --- a/engines/titanic/screen_manager.cpp +++ b/engines/titanic/screen_manager.cpp @@ -126,8 +126,12 @@ void OSScreenManager::proc20() {} void OSScreenManager::proc21() {} CVideoSurface *OSScreenManager::createSurface(int w, int h) { - warning("TODO"); - return nullptr; + DirectDrawSurface *ddSurface = _directDrawManager.createSurface(w, h, 0); + return new OSVideoSurface(this, ddSurface); +} + +CVideoSurface *OSScreenManager::createSurface(const CResourceKey &key) { + return new OSVideoSurface(this, key); } void OSScreenManager::proc23() {} diff --git a/engines/titanic/screen_manager.h b/engines/titanic/screen_manager.h index d0bcc5dbd8..0fd6bfad8b 100644 --- a/engines/titanic/screen_manager.h +++ b/engines/titanic/screen_manager.h @@ -29,6 +29,7 @@ #include "titanic/font.h" #include "titanic/input_handler.h" #include "titanic/video_surface.h" +#include "titanic/core/resource_key.h" namespace Titanic { @@ -78,6 +79,8 @@ public: void fn1() {} void fn2() {} + + virtual void setWindowHandle(int v); virtual bool resetWindowHandle(int v); virtual void setMode(int width, int height, int bpp, uint numBackSurfaces, bool flag2) = 0; @@ -98,8 +101,17 @@ public: virtual void proc19() = 0; virtual void proc20() = 0; virtual void proc21() = 0; + + /** + * Creates a surface of a given size + */ virtual CVideoSurface *createSurface(int w, int h) = 0; - virtual void proc23() = 0; + + /** + * Creates a surface from a specified resource + */ + virtual CVideoSurface *createSurface(const CResourceKey &key) = 0; + virtual void proc24() = 0; virtual void proc25() = 0; virtual void showCursor() = 0; @@ -147,7 +159,17 @@ public: virtual void proc19(); virtual void proc20(); virtual void proc21(); + + /** + * Creates a surface of a given size + */ virtual CVideoSurface *createSurface(int w, int h); + + /** + * Creates a surface from a specified resource + */ + virtual CVideoSurface *createSurface(const CResourceKey &key); + virtual void proc23(); virtual void proc24(); virtual void proc25(); diff --git a/engines/titanic/true_talk/tt_named_script.cpp b/engines/titanic/true_talk/tt_named_script.cpp index 89adb16702..7f4bb5b201 100644 --- a/engines/titanic/true_talk/tt_named_script.cpp +++ b/engines/titanic/true_talk/tt_named_script.cpp @@ -93,6 +93,7 @@ int TTNamedScript::proc12() const { bool TTNamedScript::proc13() const { warning("TODO"); + return true; } void TTNamedScript::proc14(int v) { diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp index d03e2f4525..780ea2bc9e 100644 --- a/engines/titanic/video_surface.cpp +++ b/engines/titanic/video_surface.cpp @@ -24,19 +24,46 @@ namespace Titanic { -CVideoSurface::CVideoSurface(CScreenManager *screenManager, Graphics::Surface *surface): - _screenManager(screenManager), _surface(surface) { +int CVideoSurface::_videoSurfaceCounter = 0; + +CVideoSurface::CVideoSurface(CScreenManager *screenManager) : + _screenManager(screenManager), _field2C(0), + _field34(0), _field38(0), _field3C(0), _field40(0), + _field44(4), _field48(0), _field50(1) { + _videoSurfaceNum = _videoSurfaceCounter++; } -void CVideoSurface::setSurface(CScreenManager *screenManager, Graphics::Surface *surface) { +void CVideoSurface::setSurface(CScreenManager *screenManager, DirectDrawSurface *surface) { _screenManager = screenManager; _surface = surface; } /*------------------------------------------------------------------------*/ -OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, Graphics::Surface *surface): - CVideoSurface(screenManager, surface) { +OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, DirectDrawSurface *surface) : + CVideoSurface(screenManager) { + _surface = surface; +} + +OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, const CResourceKey &key, bool flag) : + CVideoSurface(screenManager) { + _surface = nullptr; + _field38 = flag; + + if (_field38) { + proc8(key); + } else { + _resourceKey = key; + proc43(); + } +} + +void OSVideoSurface::proc8(const CResourceKey &key) { + warning("TODO"); +} + +void OSVideoSurface::proc43() { + warning("TODO"); } } // End of namespace Titanic diff --git a/engines/titanic/video_surface.h b/engines/titanic/video_surface.h index 978eacfbbe..04d9fa8c58 100644 --- a/engines/titanic/video_surface.h +++ b/engines/titanic/video_surface.h @@ -25,26 +25,50 @@ #include "common/scummsys.h" #include "common/array.h" -#include "graphics/surface.h" #include "titanic/font.h" +#include "titanic/direct_draw.h" +#include "titanic/core/list.h" +#include "titanic/core/resource_key.h" namespace Titanic { class CScreenManager; -class CVideoSurface { +class CVideoSurface : public ListItem { private: + static int _videoSurfaceCounter; +protected: CScreenManager *_screenManager; - Graphics::Surface *_surface; + CResourceKey _resourceKey; + DirectDrawSurface *_surface; + int _field2C; + int _field34; + bool _field38; + int _field3C; + int _field40; + int _field44; + int _field48; + int _videoSurfaceNum; + int _field50; + int _accessCtr; public: - CVideoSurface(CScreenManager *screenManager, Graphics::Surface *surface); + CVideoSurface(CScreenManager *screenManager); - void setSurface(CScreenManager *screenManager, Graphics::Surface *surface); + void setSurface(CScreenManager *screenManager, DirectDrawSurface *surface); + + virtual void proc8(const CResourceKey &key) = 0; + + virtual void proc43() = 0; }; class OSVideoSurface : public CVideoSurface { public: - OSVideoSurface(CScreenManager *screenManager, Graphics::Surface *surface); + OSVideoSurface(CScreenManager *screenManager, DirectDrawSurface *surface); + OSVideoSurface(CScreenManager *screenManager, const CResourceKey &key, bool flag = false); + + virtual void proc8(const CResourceKey &key); + + virtual void proc43(); }; } // End of namespace Titanic -- cgit v1.2.3 From 3c29a101309b2d74cedf345c2d7314ef82fd9367 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 14 Mar 2016 23:09:57 -0400 Subject: TITANIC: Further graphics setup, beginnings of files manager --- engines/titanic/direct_draw.cpp | 29 ++++++++--------- engines/titanic/direct_draw.h | 13 +++++--- engines/titanic/files_manager.cpp | 56 +++++++++++++++++++++++++++++++++ engines/titanic/files_manager.h | 61 ++++++++++++++++++++++++++++++++++++ engines/titanic/game_manager.cpp | 7 +++-- engines/titanic/game_manager.h | 4 +-- engines/titanic/main_game_window.cpp | 2 +- engines/titanic/module.mk | 1 + engines/titanic/screen_manager.cpp | 2 +- engines/titanic/string.cpp | 5 +++ engines/titanic/string.h | 5 +++ engines/titanic/titanic.cpp | 3 ++ engines/titanic/titanic.h | 4 +++ engines/titanic/video_surface.cpp | 10 +++++- engines/titanic/video_surface.h | 4 +-- 15 files changed, 177 insertions(+), 29 deletions(-) create mode 100644 engines/titanic/files_manager.cpp create mode 100644 engines/titanic/files_manager.h diff --git a/engines/titanic/direct_draw.cpp b/engines/titanic/direct_draw.cpp index 9691ea91f4..71f0d35630 100644 --- a/engines/titanic/direct_draw.cpp +++ b/engines/titanic/direct_draw.cpp @@ -28,21 +28,18 @@ namespace Titanic { -DirectDraw::DirectDraw(TitanicEngine *vm) : _vm(vm) { - _field8 = 0; - _fieldC = 0; - _width = 0; - _height = 0; - _bpp = 0; - _numBackSurfaces = 0; - _field24 = 0; +DirectDraw::DirectDraw(TitanicEngine *vm) : _vm(vm), + _windowed(false), _fieldC(0), _width(0), _height(0), + _bpp(0), _numBackSurfaces(0), _field24(0) { } void DirectDraw::setDisplayMode(int width, int height, int bpp, int refreshRate) { debugC(ERROR_BASIC, kDebugGraphics, "DirectDraw::SetDisplayMode (%d x %d), %d bpp", width, height, bpp); - assert(bpp == 8); - initGraphics(width, height, true); + assert(bpp == 16); + + Graphics::PixelFormat pixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); + initGraphics(width, height, true, &pixelFormat); } void DirectDraw::diagnostics() { @@ -58,10 +55,10 @@ DirectDrawSurface *DirectDraw::createSurfaceFromDesc(const DDSurfaceDesc &desc) /*------------------------------------------------------------------------*/ -DirectDrawManager::DirectDrawManager(TitanicEngine *vm, int v) : _directDraw(vm) { +DirectDrawManager::DirectDrawManager(TitanicEngine *vm, bool windowed) : _directDraw(vm) { _mainSurface = nullptr; _backSurfaces[0] = _backSurfaces[1] = nullptr; - _directDraw._field8 = v; + _directDraw._windowed = windowed; } void DirectDrawManager::initVideo(int width, int height, int bpp, int numBackSurfaces) { @@ -71,10 +68,10 @@ void DirectDrawManager::initVideo(int width, int height, int bpp, int numBackSur _directDraw._height = height; _directDraw._bpp = bpp; - if (numBackSurfaces) { - setResolution(); + if (_directDraw._windowed) { + initWindowed(); } else { - initSurface(); + initFullScreen(); } } @@ -90,7 +87,7 @@ void DirectDrawManager::proc3() { } -void DirectDrawManager::initSurface() { +void DirectDrawManager::initFullScreen() { debugC(ERROR_BASIC, kDebugGraphics, "Creating surfaces"); _directDraw.setDisplayMode(_directDraw._width, _directDraw._height, _directDraw._bpp, 0); diff --git a/engines/titanic/direct_draw.h b/engines/titanic/direct_draw.h index 728094e7f7..6dedcd0e52 100644 --- a/engines/titanic/direct_draw.h +++ b/engines/titanic/direct_draw.h @@ -47,7 +47,7 @@ class DirectDraw { private: TitanicEngine *_vm; public: - int _field8; + bool _windowed; int _fieldC; int _width; int _height; @@ -79,7 +79,7 @@ public: DirectDrawSurface *_mainSurface; DirectDrawSurface *_backSurfaces[2]; public: - DirectDrawManager(TitanicEngine *vm, int v); + DirectDrawManager(TitanicEngine *vm, bool windowed); /** * Initializes video surfaces @@ -97,9 +97,14 @@ public: void proc3(); /** - * Initializes the surface for the screen + * Initializes the surfaces in windowed mode */ - void initSurface(); + void initWindowed() { initFullScreen(); } + + /** + * Initializes the surfaces for the screen + */ + void initFullScreen(); /** * Create a surface diff --git a/engines/titanic/files_manager.cpp b/engines/titanic/files_manager.cpp new file mode 100644 index 0000000000..4dcee2e062 --- /dev/null +++ b/engines/titanic/files_manager.cpp @@ -0,0 +1,56 @@ +/* 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 "titanic/files_manager.h" +#include "titanic/game_manager.h" + +namespace Titanic { + +CFilesManager::CFilesManager() : _gameManager(nullptr), + _field0(0), _field14(0), _field18(0), _field1C(0), _field3C(0) { +} + +int CFilesManager::fn1(const CString &name) { + if (name.empty()) + return 0; + + CString str = name; + str.toLowercase(); + + if (str[0] == 'z' || str[0] == 'y') { + return 1; + } else if (str[0] < 'a' || str[0] > 'c') { + return 0; + } + + CString tempStr = str; + int idx = tempStr.indexOf('#'); + if (idx >= 0) { + tempStr = tempStr.left(idx); + str = str.c_str() + idx + 1; + str += ".st"; + } + + return 0; +} + +} // End of namespace Titanic diff --git a/engines/titanic/files_manager.h b/engines/titanic/files_manager.h new file mode 100644 index 0000000000..29a67e6605 --- /dev/null +++ b/engines/titanic/files_manager.h @@ -0,0 +1,61 @@ +/* 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. + * + */ + +#ifndef TITANIC_FILES_MANAGER_H +#define TITANIC_FILES_MANAGER_H + +#include "titanic/core/list.h" + +namespace Titanic { + +class CGameManager; + +class CFilesManagerList : public List { +}; + +class CFilesManager { +private: + CGameManager *_gameManager; + CFilesManagerList _list; + CString _string1; + CString _string2; + int _field0; + int _field14; + int _field18; + int _field1C; + int _field3C; +public: + CFilesManager(); + + /** + * Sets the game manager + */ + void setGameManager(CGameManager *gameManager) { + _gameManager = gameManager; + } + + int fn1(const CString &name); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_FILES_MANAGER_H */ diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index 0495d08dbd..2f718626e9 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -47,10 +47,13 @@ CGameManager::CGameManager(CProjectItem *project, CGameView *gameView): _project(project), _gameView(gameView), _trueTalkManager(this), _inputHandler(this), _inputTranslator(&_inputHandler), _gameState(this), _sound(this), _musicRoom(this), - _field30(0), _field34(0), _field48(0), _field4C(0), + _field30(0), _field34(0), _field4C(0), _field50(0), _field54(0), _tickCount1(0), _tickCount2(0) { - _videoSurface = CScreenManager::_screenManagerPtr->createSurface(600, 340); + + _videoSurface1 = nullptr; + _videoSurface2 = CScreenManager::_screenManagerPtr->createSurface(600, 340); _project->setGameManager(this); + g_vm->_filesManager.setGameManager(this); } void CGameManager::load(SimpleFile *file) { diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index a9bdaaa71f..82ab6d1e3b 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -62,11 +62,11 @@ private: CGameManagerList _list; int _field30; int _field34; - int _field48; + CVideoSurface *_videoSurface1; int _field4C; int _field50; int _field54; - CVideoSurface *_videoSurface; + CVideoSurface *_videoSurface2; uint _tickCount1; uint _tickCount2; public: diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 01996e6b13..e9fb423bd1 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -54,7 +54,7 @@ void CMainGameWindow::applicationStarting() { // Set the video mode CScreenManager *screenManager = CScreenManager::setCurrent(); - screenManager->setMode(640, 480, 1, 1, false); + screenManager->setMode(640, 480, 16, 1, true); // TODO: Clear surfaces diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 48f6ce640b..664dc0a3e5 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -3,6 +3,7 @@ MODULE := engines/titanic MODULE_OBJS := \ detection.o \ direct_draw.o \ + files_manager.o \ font.o \ game_location.o \ game_manager.o \ diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp index ebde0e0a6c..e2d62bec54 100644 --- a/engines/titanic/screen_manager.cpp +++ b/engines/titanic/screen_manager.cpp @@ -74,7 +74,7 @@ CScreenManager *CScreenManager::setCurrent() { /*------------------------------------------------------------------------*/ OSScreenManager::OSScreenManager(TitanicEngine *vm): CScreenManager(vm), - _directDrawManager(vm, 0) { + _directDrawManager(vm, false) { _field48 = 0; _field4C = 0; _field50 = 0; diff --git a/engines/titanic/string.cpp b/engines/titanic/string.cpp index 128a9a38eb..f726f78c21 100644 --- a/engines/titanic/string.cpp +++ b/engines/titanic/string.cpp @@ -40,4 +40,9 @@ CString CString::mid(uint start, uint count) const { return CString(c_str() + start, MIN(count, size() - start)); } +int CString::indexOf(char c) { + const char *charP = strchr(c_str(), c); + return charP ? charP - c_str() : -1; +} + } // End of namespace Titanic diff --git a/engines/titanic/string.h b/engines/titanic/string.h index 076cce05a2..de442647ca 100644 --- a/engines/titanic/string.h +++ b/engines/titanic/string.h @@ -51,6 +51,11 @@ public: * Returns a substring from within the string */ CString mid(uint start, uint count) const; + + /** + * Returns the index of the first occurance of a given character + */ + int indexOf(char c); }; } // End of namespace Titanic diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index b00e1c3088..d1d8386228 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -40,8 +40,11 @@ namespace Titanic { +TitanicEngine *g_vm; + TitanicEngine::TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc) : _gameDescription(gameDesc), Engine(syst) { + g_vm = this; _window = nullptr; _screenManager = nullptr; } diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index ad0ed75165..9513f8d759 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -28,6 +28,7 @@ #include "common/serializer.h" #include "engines/advancedDetector.h" #include "engines/engine.h" +#include "titanic/files_manager.h" #include "titanic/screen_manager.h" #include "titanic/main_game_window.h" @@ -93,6 +94,7 @@ protected: virtual Common::Error run(); virtual bool hasFeature(EngineFeature f) const; public: + CFilesManager _filesManager; OSScreenManager *_screenManager; CMainGameWindow *_window; public: @@ -104,6 +106,8 @@ public: Common::Language getLanguage() const; }; +extern TitanicEngine *g_vm; + } // End of namespace Titanic #endif /* TITANIC_TITANIC_H */ diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp index 780ea2bc9e..c7643cf656 100644 --- a/engines/titanic/video_surface.cpp +++ b/engines/titanic/video_surface.cpp @@ -59,7 +59,15 @@ OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, const CResourceKey } void OSVideoSurface::proc8(const CResourceKey &key) { - warning("TODO"); + _resourceKey = key; + _field38 = 1; + + if (hasSurface()) + proc43(); +} + +bool OSVideoSurface::hasSurface() { + return _surface != nullptr; } void OSVideoSurface::proc43() { diff --git a/engines/titanic/video_surface.h b/engines/titanic/video_surface.h index 04d9fa8c58..71a2fd668c 100644 --- a/engines/titanic/video_surface.h +++ b/engines/titanic/video_surface.h @@ -57,7 +57,7 @@ public: void setSurface(CScreenManager *screenManager, DirectDrawSurface *surface); virtual void proc8(const CResourceKey &key) = 0; - + virtual bool hasSurface() = 0; virtual void proc43() = 0; }; @@ -67,7 +67,7 @@ public: OSVideoSurface(CScreenManager *screenManager, const CResourceKey &key, bool flag = false); virtual void proc8(const CResourceKey &key); - + virtual bool hasSurface(); virtual void proc43(); }; -- cgit v1.2.3 From 6a26539abbf7951f4783935b336dcabfbf548055 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 15 Mar 2016 23:49:18 -0400 Subject: TITANIC: Fleshing out resource key and view loading --- engines/titanic/core/resource_key.cpp | 34 ++++++++++++++++++++++++++++++++-- engines/titanic/core/resource_key.h | 11 +++++++++++ engines/titanic/core/view_item.cpp | 6 ++++++ engines/titanic/core/view_item.h | 5 +++++ engines/titanic/files_manager.cpp | 15 ++++++++++++--- engines/titanic/files_manager.h | 8 +++++++- engines/titanic/game_manager.cpp | 4 ++++ engines/titanic/game_manager.h | 2 ++ engines/titanic/main_game_window.cpp | 9 +++++++-- engines/titanic/main_game_window.h | 2 +- engines/titanic/string.cpp | 11 +++++++++++ engines/titanic/string.h | 10 ++++++++++ engines/titanic/titanic.cpp | 6 ++++++ engines/titanic/titanic.h | 1 + 14 files changed, 115 insertions(+), 9 deletions(-) diff --git a/engines/titanic/core/resource_key.cpp b/engines/titanic/core/resource_key.cpp index eee749f15a..685e026d23 100644 --- a/engines/titanic/core/resource_key.cpp +++ b/engines/titanic/core/resource_key.cpp @@ -20,6 +20,7 @@ * */ +#include "common/file.h" #include "titanic/simple_file.h" #include "titanic/core/resource_key.h" @@ -36,12 +37,41 @@ void CResourceKey::save(SimpleFile *file, int indent) const { void CResourceKey::load(SimpleFile *file) { int val = file->readNumber(); - if (val == 1) { + if (val == 0 || val == 1) { file->readBuffer(); - _value = file->readString(); + CString str = file->readString(); + setValue(str); } CSaveableObject::load(file); } +void CResourceKey::setValue(const CString &name) { + CString nameStr = name; + nameStr.toLowercase(); + _key = nameStr; + + _value = nameStr; + int idx = _value.lastIndexOf('\\'); + if (idx >= 0) + _value = _value.mid(idx + 1); +} + +CString CResourceKey::exists() { + CString name = _key; + + // Check for the resource being within an ST container file + int idx = name.indexOf('#'); + if (idx >= 0) { + CString str = name.left(idx); + name = name.mid(idx + 1); + name += ".st"; + } + + // The original did tests for the file in the different + // asset paths, which aren't needed in ScummVM + Common::File f; + return f.exists(name) ? name : CString(); +} + } // End of namespace Titanic diff --git a/engines/titanic/core/resource_key.h b/engines/titanic/core/resource_key.h index b38448aa4f..a165a11e1a 100644 --- a/engines/titanic/core/resource_key.h +++ b/engines/titanic/core/resource_key.h @@ -32,6 +32,8 @@ class CResourceKey: public CSaveableObject { private: CString _key; CString _value; + + void setValue(const CString &name); public: CLASSDEF @@ -45,7 +47,16 @@ public: */ virtual void load(SimpleFile *file); + /** + * Return the key + */ const CString &getString() const { return _key; } + + /** + * Checks whether a file for the given key exists, + * and returns it's filename if it does + */ + CString exists(); }; } // End of namespace Titanic diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index 5253f24749..7038e94538 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -67,4 +67,10 @@ void CViewItem::load(SimpleFile *file) { CNamedItem::load(file); } +bool CViewItem::getResourceKey(CResourceKey *key) { + *key = _resourceKey; + CString filename = key->exists(); + return !filename.empty(); +} + } // End of namespace Titanic diff --git a/engines/titanic/core/view_item.h b/engines/titanic/core/view_item.h index 805b7a4f9c..106c795773 100644 --- a/engines/titanic/core/view_item.h +++ b/engines/titanic/core/view_item.h @@ -52,6 +52,11 @@ public: * Load the data for the class from file */ virtual void load(SimpleFile *file); + + /** + * Get the resource key for the view + */ + bool getResourceKey(CResourceKey *key); }; } // End of namespace Titanic diff --git a/engines/titanic/files_manager.cpp b/engines/titanic/files_manager.cpp index 4dcee2e062..b7562b638a 100644 --- a/engines/titanic/files_manager.cpp +++ b/engines/titanic/files_manager.cpp @@ -20,16 +20,18 @@ * */ +#include "common/file.h" #include "titanic/files_manager.h" #include "titanic/game_manager.h" namespace Titanic { CFilesManager::CFilesManager() : _gameManager(nullptr), - _field0(0), _field14(0), _field18(0), _field1C(0), _field3C(0) { + _assetsPath("Assets"), _field0(0), _field14(0), + _field18(0), _field1C(0), _field3C(0) { } -int CFilesManager::fn1(const CString &name) { +bool CFilesManager::fn1(const CString &name) { if (name.empty()) return 0; @@ -50,7 +52,14 @@ int CFilesManager::fn1(const CString &name) { str += ".st"; } - return 0; + + + return true; +} + +bool CFilesManager::fileExists(const CString &name) { + Common::File f; + return f.exists(name); } } // End of namespace Titanic diff --git a/engines/titanic/files_manager.h b/engines/titanic/files_manager.h index 29a67e6605..63eda5ec1e 100644 --- a/engines/titanic/files_manager.h +++ b/engines/titanic/files_manager.h @@ -43,6 +43,7 @@ private: int _field18; int _field1C; int _field3C; + const CString _assetsPath; public: CFilesManager(); @@ -53,7 +54,12 @@ public: _gameManager = gameManager; } - int fn1(const CString &name); + bool fn1(const CString &name); + + /** + * Returns true if a file of the given name exists + */ + static bool fileExists(const CString &name); }; } // End of namespace Titanic diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index 2f718626e9..5d5dc164ed 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -92,4 +92,8 @@ void CGameManager::initBounds() { _bounds = Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); } +void CGameManager::fn2() { + warning("TODO"); +} + } // End of namespace Titanic diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index 82ab6d1e3b..6a4905239e 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -102,6 +102,8 @@ public: * Set default screen bounds */ void initBounds(); + + void fn2(); }; } // End of namespace Titanic diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index e9fb423bd1..bf5ec6efd1 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -96,8 +96,13 @@ int CMainGameWindow::selectSavegame() { return -1; } -void CMainGameWindow::setActiveView(CViewItem *view) { - warning("TODO"); +void CMainGameWindow::setActiveView(CViewItem *viewItem) { + _gameManager->_gameState._gameLocation.setView(viewItem); + + CResourceKey key; + if (viewItem->getResourceKey(&key)) { + // TODO + } } void CMainGameWindow::fn2() { diff --git a/engines/titanic/main_game_window.h b/engines/titanic/main_game_window.h index ec8eff3ec6..eedac23ef8 100644 --- a/engines/titanic/main_game_window.h +++ b/engines/titanic/main_game_window.h @@ -72,7 +72,7 @@ public: /** * Sets the view to be shown */ - void setActiveView(CViewItem *view); + void setActiveView(CViewItem *viewItem); void fn2(); }; diff --git a/engines/titanic/string.cpp b/engines/titanic/string.cpp index f726f78c21..c1afb4ff52 100644 --- a/engines/titanic/string.cpp +++ b/engines/titanic/string.cpp @@ -40,9 +40,20 @@ CString CString::mid(uint start, uint count) const { return CString(c_str() + start, MIN(count, size() - start)); } +CString CString::mid(uint start) const { + uint strSize = size(); + assert(start <= strSize); + return mid(start, strSize - start); +} + int CString::indexOf(char c) { const char *charP = strchr(c_str(), c); return charP ? charP - c_str() : -1; } +int CString::lastIndexOf(char c) { + const char *charP = strrchr(c_str(), c); + return charP ? charP - c_str() : -1; +} + } // End of namespace Titanic diff --git a/engines/titanic/string.h b/engines/titanic/string.h index de442647ca..d70e23d023 100644 --- a/engines/titanic/string.h +++ b/engines/titanic/string.h @@ -52,10 +52,20 @@ public: */ CString mid(uint start, uint count) const; + /** + * Returns a substring from within the string + */ + CString mid(uint start) const; + /** * Returns the index of the first occurance of a given character */ int indexOf(char c); + + /** + * Returns the index of the last occurance of a given character + */ + int lastIndexOf(char c); }; } // End of namespace Titanic diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index d1d8386228..a9d0cc9421 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -21,6 +21,7 @@ */ #include "common/scummsys.h" +#include "common/archive.h" #include "common/config-manager.h" #include "common/debug-channels.h" #include "common/events.h" @@ -55,6 +56,11 @@ TitanicEngine::~TitanicEngine() { CSaveableObject::freeClassList(); } +void TitanicEngine::initializePath(const Common::FSNode &gamePath) { + Engine::initializePath(gamePath); + SearchMan.addSubDirectoryMatching(gamePath, "assets"); +} + void TitanicEngine::initialize() { // Set up debug channels DebugMan.addDebugChannel(kDebugCore, "core", "Core engine debug level"); diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index 9513f8d759..112d6d63c1 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -91,6 +91,7 @@ protected: int _loadSaveSlot; // Engine APIs + virtual void initializePath(const Common::FSNode &gamePath); virtual Common::Error run(); virtual bool hasFeature(EngineFeature f) const; public: -- cgit v1.2.3 From eaead0c6aee10f1fdd347a723bd9b816f80abff6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 16 Mar 2016 07:56:26 -0400 Subject: TITANIC: Starting to implement game view loading --- engines/titanic/core/resource_key.cpp | 5 ++--- engines/titanic/game_view.cpp | 3 +++ engines/titanic/game_view.h | 5 +++++ engines/titanic/main_game_window.cpp | 3 ++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/engines/titanic/core/resource_key.cpp b/engines/titanic/core/resource_key.cpp index 685e026d23..4788f7a493 100644 --- a/engines/titanic/core/resource_key.cpp +++ b/engines/titanic/core/resource_key.cpp @@ -60,11 +60,10 @@ void CResourceKey::setValue(const CString &name) { CString CResourceKey::exists() { CString name = _key; - // Check for the resource being within an ST container file + // Check for a resource being specified within an ST container int idx = name.indexOf('#'); if (idx >= 0) { - CString str = name.left(idx); - name = name.mid(idx + 1); + name = name.left(idx); name += ".st"; } diff --git a/engines/titanic/game_view.cpp b/engines/titanic/game_view.cpp index a8b8a02530..a2905d148c 100644 --- a/engines/titanic/game_view.cpp +++ b/engines/titanic/game_view.cpp @@ -47,6 +47,9 @@ void CGameView::deleteView(int roomNumber, int nodeNumber, int viewNumber) { delete view; } +void CGameView::createSurface(const CResourceKey &key) { + +} /*------------------------------------------------------------------------*/ diff --git a/engines/titanic/game_view.h b/engines/titanic/game_view.h index 2e4f700ad5..bf406b5acc 100644 --- a/engines/titanic/game_view.h +++ b/engines/titanic/game_view.h @@ -58,6 +58,11 @@ public: virtual void setView(CViewItem *item) = 0; virtual void proc4() = 0; + + /** + * Creates a surface from a specified resource + */ + void createSurface(const CResourceKey &key); }; class CSTGameView: public CGameView { diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index bf5ec6efd1..6bde296453 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -101,7 +101,8 @@ void CMainGameWindow::setActiveView(CViewItem *viewItem) { CResourceKey key; if (viewItem->getResourceKey(&key)) { - // TODO + // Create a surface based on the key + _gameView->createSurface(key); } } -- cgit v1.2.3 From 8ec499c177d88e11930b8550c47c352d65dc603a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 16 Mar 2016 19:05:16 -0400 Subject: TITANIC: Implementing setActiveView, surface clearing --- engines/titanic/direct_draw.cpp | 18 ++++++++++++++++++ engines/titanic/direct_draw.h | 6 ++++++ engines/titanic/game_manager.cpp | 2 +- engines/titanic/game_manager.h | 2 +- engines/titanic/game_state.cpp | 8 ++++---- engines/titanic/game_state.h | 6 ++++-- engines/titanic/game_view.cpp | 19 ++++++++++++------- engines/titanic/game_view.h | 4 ++-- engines/titanic/main_game_window.cpp | 26 +++++++++++++++++++++++++- engines/titanic/screen_manager.cpp | 9 ++++++++- engines/titanic/screen_manager.h | 14 ++++++++++++-- engines/titanic/video_surface.cpp | 8 ++++---- engines/titanic/video_surface.h | 2 +- 13 files changed, 98 insertions(+), 26 deletions(-) diff --git a/engines/titanic/direct_draw.cpp b/engines/titanic/direct_draw.cpp index 71f0d35630..17e13610e0 100644 --- a/engines/titanic/direct_draw.cpp +++ b/engines/titanic/direct_draw.cpp @@ -108,4 +108,22 @@ DirectDrawSurface *DirectDrawManager::createSurface(int w, int h, int surfaceNum return _directDraw.createSurfaceFromDesc(DDSurfaceDesc(w, h)); } +/*------------------------------------------------------------------------*/ + +void DirectDrawSurface::fill(const Common::Rect *bounds, uint32 color) { + Common::Rect tempBounds; + + if (bounds) { + // Bounds are provided, clip them to the bounds of this surface + tempBounds = *bounds; + tempBounds.clip(Common::Rect(0, 0, this->w, this->h)); + } else { + // No bounds provided, so use the entire surface + tempBounds = Common::Rect(0, 0, this->w, this->h); + } + + // Fill the area + fillRect(tempBounds, color); +} + } // End of namespace Titanic diff --git a/engines/titanic/direct_draw.h b/engines/titanic/direct_draw.h index 6dedcd0e52..bd6a77dc2d 100644 --- a/engines/titanic/direct_draw.h +++ b/engines/titanic/direct_draw.h @@ -41,6 +41,12 @@ struct DDSurfaceDesc { }; class DirectDrawSurface : public Graphics::Surface { +public: + /** + * Fills an area of the surfae with the specified color. If no bounds are passed, + * then the entire surface is filled + */ + void fill(const Common::Rect *bounds, uint32 color); }; class DirectDraw { diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index 5d5dc164ed..efa816d8e2 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -69,7 +69,7 @@ void CGameManager::postLoad(CProjectItem *project) { if (_gameView) { _gameView->postLoad(); - if (!_gameView->_fieldC) { + if (!_gameView->_surface) { CViewItem *view = getView(); if (view) _gameView->setView(view); diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index 6a4905239e..1509554bf8 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -58,7 +58,6 @@ private: CInputTranslator _inputTranslator; CMusicRoom _musicRoom; CTrueTalkManager _trueTalkManager; - Common::Rect _bounds; CGameManagerList _list; int _field30; int _field34; @@ -72,6 +71,7 @@ private: public: CProjectItem *_project; CGameState _gameState; + Common::Rect _bounds; public: CGameManager(CProjectItem *project, CGameView *gameView); ~CGameManager(); diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index b8b5ec1362..3ce8b2b42e 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -28,7 +28,7 @@ namespace Titanic { CGameState::CGameState(CGameManager *gameManager) : _gameManager(gameManager), _gameLocation(this), - _field8(0), _fieldC(0), _mode(10), _field14(0), _field18(0), + _field8(0), _fieldC(0), _mode(GSMODE_0), _field14(0), _field18(0), _field1C(0), _field20(0), _field24(0), _field28(0), _field2C(0), _field30(0), _field34(0), _field38(0) { } @@ -57,17 +57,17 @@ void CGameState::load(SimpleFile *file) { _field28 = _field2C = 0; } -void CGameState::setMode(int newMode) { +void CGameState::setMode(GameStateMode newMode) { CScreenManager *sm = CScreenManager::_screenManagerPtr; - if (newMode == 2 && newMode != _mode) { + if (newMode == GSMODE_2 && newMode != _mode) { if (_gameManager) _gameManager->lockInputHandler(); if (sm && sm->_mouseCursor) sm->_mouseCursor->hide(); - } else if (newMode != 2 && newMode != _mode) { + } else if (newMode != GSMODE_2 && newMode != _mode) { if (sm && sm->_mouseCursor) sm->_mouseCursor->show(); diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h index f08216383e..3c3b720d95 100644 --- a/engines/titanic/game_state.h +++ b/engines/titanic/game_state.h @@ -31,6 +31,8 @@ namespace Titanic { class CGameManager; +enum GameStateMode { GSMODE_0 = 0, GSMODE_1 = 1, GSMODE_2 = 2, GSMODE_3 = 3, GSMODE_4 = 4, GSMODE_5 = 5 }; + class CGameStateList : public List { public: int _field10; @@ -46,7 +48,7 @@ public: CGameStateList _list; int _field8; int _fieldC; - int _mode; + GameStateMode _mode; int _field14; int _field18; int _field1C; @@ -73,7 +75,7 @@ public: /** * Sets a new mode */ - void setMode(int newMode); + void setMode(GameStateMode newMode); }; } // End of namespace Titanic diff --git a/engines/titanic/game_view.cpp b/engines/titanic/game_view.cpp index a2905d148c..315b2a8909 100644 --- a/engines/titanic/game_view.cpp +++ b/engines/titanic/game_view.cpp @@ -23,11 +23,11 @@ #include "titanic/game_view.h" #include "titanic/game_manager.h" #include "titanic/main_game_window.h" +#include "titanic/screen_manager.h" namespace Titanic { -CGameView::CGameView() : _gameManager(nullptr), _fieldC(nullptr), - _field8(0) { +CGameView::CGameView() : _gameManager(nullptr), _surface(nullptr) { } void CGameView::setGameManager(CGameManager *gameManager) { @@ -35,10 +35,8 @@ void CGameView::setGameManager(CGameManager *gameManager) { } void CGameView::postLoad() { - if (_fieldC) - warning("TODO"); - - _fieldC = nullptr; + delete _surface; + _surface = nullptr; } void CGameView::deleteView(int roomNumber, int nodeNumber, int viewNumber) { @@ -48,7 +46,14 @@ void CGameView::deleteView(int roomNumber, int nodeNumber, int viewNumber) { } void CGameView::createSurface(const CResourceKey &key) { - + // Reset any current view surface + _gameManager->initBounds(); + delete _surface; + _surface = nullptr; + + // Create a fresh surface + CScreenManager::setCurrent(); + _surface = CScreenManager::_currentScreenManagerPtr->createSurface(key); } /*------------------------------------------------------------------------*/ diff --git a/engines/titanic/game_view.h b/engines/titanic/game_view.h index bf406b5acc..9ede9d6c36 100644 --- a/engines/titanic/game_view.h +++ b/engines/titanic/game_view.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "titanic/core/view_item.h" +#include "titanic/video_surface.h" namespace Titanic { @@ -34,9 +35,8 @@ class CGameManager; class CGameView { protected: CGameManager *_gameManager; - int _field8; public: - void *_fieldC; + CVideoSurface *_surface; public: CGameView(); diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 6bde296453..a964f928f9 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -107,7 +107,31 @@ void CMainGameWindow::setActiveView(CViewItem *viewItem) { } void CMainGameWindow::fn2() { - warning("TODO"); + if (_gameManager) { + if (_gameView->_surface) { + CViewItem *view = _gameManager->getView(); + if (view) + setActiveView(view); + } + + CScreenManager *scrManager = CScreenManager::setCurrent(); + scrManager->clearSurface(0, &_gameManager->_bounds); + + switch (_gameManager->_gameState._mode) { + case GSMODE_1: + case GSMODE_2: + if (_gameManager->_gameState._field18) + warning("TODO: Field18_fn1(this)"); + warning("TODO: Stuff"); + + case GSMODE_5: + warning("TODO: FilesManager::fn1"); + break; + + default: + break; + } + } } } // End of namespace Titanic diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp index e2d62bec54..f64468e90b 100644 --- a/engines/titanic/screen_manager.cpp +++ b/engines/titanic/screen_manager.cpp @@ -122,7 +122,14 @@ void OSScreenManager::proc16() {} void OSScreenManager::getFont() {} void OSScreenManager::proc18() {} void OSScreenManager::proc19() {} -void OSScreenManager::proc20() {} + +void OSScreenManager::clearSurface(int surfaceNum, Common::Rect *bounds) { + if (surfaceNum == -1) + _directDrawManager._mainSurface->fill(bounds, 0); + else if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) + _directDrawManager._backSurfaces[surfaceNum]->fill(bounds, 0); +} + void OSScreenManager::proc21() {} CVideoSurface *OSScreenManager::createSurface(int w, int h) { diff --git a/engines/titanic/screen_manager.h b/engines/titanic/screen_manager.h index 0fd6bfad8b..075e36cadf 100644 --- a/engines/titanic/screen_manager.h +++ b/engines/titanic/screen_manager.h @@ -99,7 +99,12 @@ public: virtual void getFont() = 0; virtual void proc18() = 0; virtual void proc19() = 0; - virtual void proc20() = 0; + + /** + * Clear a portion of a specified surface + */ + virtual void clearSurface(int surfaceNum, Common::Rect *_bounds) = 0; + virtual void proc21() = 0; /** @@ -157,7 +162,12 @@ public: virtual void getFont(); virtual void proc18(); virtual void proc19(); - virtual void proc20(); + + /** + * Clear a portion of the screen surface + */ + virtual void clearSurface(int surfaceNum, Common::Rect *bounds); + virtual void proc21(); /** diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp index c7643cf656..1db23830b4 100644 --- a/engines/titanic/video_surface.cpp +++ b/engines/titanic/video_surface.cpp @@ -35,19 +35,19 @@ CVideoSurface::CVideoSurface(CScreenManager *screenManager) : void CVideoSurface::setSurface(CScreenManager *screenManager, DirectDrawSurface *surface) { _screenManager = screenManager; - _surface = surface; + _ddSurface = surface; } /*------------------------------------------------------------------------*/ OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, DirectDrawSurface *surface) : CVideoSurface(screenManager) { - _surface = surface; + _ddSurface = surface; } OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, const CResourceKey &key, bool flag) : CVideoSurface(screenManager) { - _surface = nullptr; + _ddSurface = nullptr; _field38 = flag; if (_field38) { @@ -67,7 +67,7 @@ void OSVideoSurface::proc8(const CResourceKey &key) { } bool OSVideoSurface::hasSurface() { - return _surface != nullptr; + return _ddSurface != nullptr; } void OSVideoSurface::proc43() { diff --git a/engines/titanic/video_surface.h b/engines/titanic/video_surface.h index 71a2fd668c..d0fa54bf85 100644 --- a/engines/titanic/video_surface.h +++ b/engines/titanic/video_surface.h @@ -40,7 +40,7 @@ private: protected: CScreenManager *_screenManager; CResourceKey _resourceKey; - DirectDrawSurface *_surface; + DirectDrawSurface *_ddSurface; int _field2C; int _field34; bool _field38; -- cgit v1.2.3 From 6be64df2f0c0bf50e551187c2ba989d756f2dd36 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 16 Mar 2016 21:01:01 -0400 Subject: TITANIC: Implemented overall surface loading method --- engines/titanic/core/resource_key.cpp | 13 ++++ engines/titanic/core/resource_key.h | 15 +++++ engines/titanic/files_manager.cpp | 44 ++++++------- engines/titanic/files_manager.h | 7 ++- engines/titanic/string.cpp | 38 ++++++++++++ engines/titanic/string.h | 19 ++++++ engines/titanic/video_surface.cpp | 64 +++++++++++++++++-- engines/titanic/video_surface.h | 112 ++++++++++++++++++++++++++++++++-- 8 files changed, 278 insertions(+), 34 deletions(-) diff --git a/engines/titanic/core/resource_key.cpp b/engines/titanic/core/resource_key.cpp index 4788f7a493..4b52082b77 100644 --- a/engines/titanic/core/resource_key.cpp +++ b/engines/titanic/core/resource_key.cpp @@ -21,6 +21,7 @@ */ #include "common/file.h" +#include "titanic/titanic.h" #include "titanic/simple_file.h" #include "titanic/core/resource_key.h" @@ -73,4 +74,16 @@ CString CResourceKey::exists() { return f.exists(name) ? name : CString(); } +bool CResourceKey::scanForFile() const { + return g_vm->_filesManager.scanForFile(_value); +} + +FileType CResourceKey::fileTypeSuffix() const { + return _value.fileTypeSuffix(); +} + +ImageType CResourceKey::imageTypeSuffix() const { + return _value.imageTypeSuffix(); +} + } // End of namespace Titanic diff --git a/engines/titanic/core/resource_key.h b/engines/titanic/core/resource_key.h index a165a11e1a..111cec5c7c 100644 --- a/engines/titanic/core/resource_key.h +++ b/engines/titanic/core/resource_key.h @@ -57,6 +57,21 @@ public: * and returns it's filename if it does */ CString exists(); + + /** + * Scans for a file with a matching name + */ + bool scanForFile() const; + + /** + * Returns the type of the resource based on it's extension + */ + FileType fileTypeSuffix() const; + + /** + * Returns the type of the resource based on it's extension + */ + ImageType imageTypeSuffix() const; }; } // End of namespace Titanic diff --git a/engines/titanic/files_manager.cpp b/engines/titanic/files_manager.cpp index b7562b638a..662a882e3e 100644 --- a/engines/titanic/files_manager.cpp +++ b/engines/titanic/files_manager.cpp @@ -31,35 +31,35 @@ CFilesManager::CFilesManager() : _gameManager(nullptr), _field18(0), _field1C(0), _field3C(0) { } -bool CFilesManager::fn1(const CString &name) { +bool CFilesManager::fileExists(const CString &name) { + Common::File f; + return f.exists(name); +} + +bool CFilesManager::scanForFile(const CString &name) { if (name.empty()) - return 0; + return false; - CString str = name; - str.toLowercase(); + CString filename = name; + filename.toLowercase(); - if (str[0] == 'z' || str[0] == 'y') { - return 1; - } else if (str[0] < 'a' || str[0] > 'c') { - return 0; - } + if (filename[0] == 'y' || filename[0] == 'z') + return true; + else if (filename[0] < 'a' || filename[0] > 'c') + return false; - CString tempStr = str; - int idx = tempStr.indexOf('#'); + CString fname = filename; + int idx = fname.indexOf('#'); if (idx >= 0) { - tempStr = tempStr.left(idx); - str = str.c_str() + idx + 1; - str += ".st"; + fname = fname.left(idx); + fname += ".st"; } - - - return true; -} - -bool CFilesManager::fileExists(const CString &name) { - Common::File f; - return f.exists(name); + // The original had a bunch of code here handling determining + // which asset path, if any, the filename was present for, + // and storing the "active asset path" it was found on. + // This is redundant for ScummVM, which takes care of the paths + return fileExists(fname); } } // End of namespace Titanic diff --git a/engines/titanic/files_manager.h b/engines/titanic/files_manager.h index 63eda5ec1e..93505230f8 100644 --- a/engines/titanic/files_manager.h +++ b/engines/titanic/files_manager.h @@ -54,12 +54,15 @@ public: _gameManager = gameManager; } - bool fn1(const CString &name); - /** * Returns true if a file of the given name exists */ static bool fileExists(const CString &name); + + /** + * Scans for a file with a matching name + */ + bool scanForFile(const CString &name); }; } // End of namespace Titanic diff --git a/engines/titanic/string.cpp b/engines/titanic/string.cpp index c1afb4ff52..dbe0617f06 100644 --- a/engines/titanic/string.cpp +++ b/engines/titanic/string.cpp @@ -56,4 +56,42 @@ int CString::lastIndexOf(char c) { return charP ? charP - c_str() : -1; } +FileType CString::fileTypeSuffix() const { + CString ext = right(1); + if (ext == "0" || ext == "4") + return FILETYPE_IMAGE; + else if (ext == "1") + return FILETYPE_WAV; + else if (ext == "2" || ext == "3") + return FILETYPE_MOVIE; + + ext = right(3); + if (ext == "tga" || ext == "jpg") + return FILETYPE_IMAGE; + else if (ext == "wav") + return FILETYPE_WAV; + else if (ext == "avi" || ext == "mov") + return FILETYPE_MOVIE; + else if (ext == "dlg") + return FILETYPE_DLG; + else + return FILETYPE_UNKNOWN; +} + +ImageType CString::imageTypeSuffix() const { + CString ext = right(1); + if (ext == "0") + return IMAGETYPE_TARGA; + else if (ext == "4") + return IMAGETYPE_JPEG; + + ext = right(3); + if (ext == "tga") + return IMAGETYPE_TARGA; + else if (ext == "jpg") + return IMAGETYPE_JPEG; + else + return IMAGETYPE_UNKNOWN; +} + } // End of namespace Titanic diff --git a/engines/titanic/string.h b/engines/titanic/string.h index d70e23d023..6b8e4b784e 100644 --- a/engines/titanic/string.h +++ b/engines/titanic/string.h @@ -28,6 +28,15 @@ namespace Titanic { +enum FileType { + FILETYPE_UNKNOWN = 0, FILETYPE_IMAGE = 1, FILETYPE_MOVIE = 2, + FILETYPE_WAV = 3, FILETYPE_DLG = 4 +}; + +enum ImageType { + IMAGETYPE_UNKNOWN = 0, IMAGETYPE_TARGA = 1, IMAGETYPE_JPEG = 2 +}; + class CString : public Common::String { public: CString() : Common::String() {} @@ -66,6 +75,16 @@ public: * Returns the index of the last occurance of a given character */ int lastIndexOf(char c); + + /** + * Returns the type of a filename based on it's extension + */ + FileType fileTypeSuffix() const; + + /** + * Returns the type of an image filename based on it's extension + */ + ImageType imageTypeSuffix() const; }; } // End of namespace Titanic diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp index 1db23830b4..e649532b81 100644 --- a/engines/titanic/video_surface.cpp +++ b/engines/titanic/video_surface.cpp @@ -21,6 +21,7 @@ */ #include "titanic/video_surface.h" +#include "titanic/screen_manager.h" namespace Titanic { @@ -51,27 +52,78 @@ OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, const CResourceKey _field38 = flag; if (_field38) { - proc8(key); + loadResource(key); } else { _resourceKey = key; - proc43(); + load(); } } -void OSVideoSurface::proc8(const CResourceKey &key) { +void OSVideoSurface::loadResource(const CResourceKey &key) { _resourceKey = key; _field38 = 1; if (hasSurface()) - proc43(); + load(); +} + +void OSVideoSurface::loadTarga() { + warning("TODO"); +} + +void OSVideoSurface::loadJPEG() { + warning("TODO"); +} + +void OSVideoSurface::loadMovie() { + warning("TODO"); } bool OSVideoSurface::hasSurface() { return _ddSurface != nullptr; } -void OSVideoSurface::proc43() { - warning("TODO"); +int OSVideoSurface::getWidth() const { + assert(_ddSurface); + return _ddSurface->w; +} + +int OSVideoSurface::getHeight() const { + assert(_ddSurface); + return _ddSurface->h; +} + +int OSVideoSurface::getPitch() const { + assert(_ddSurface); + return _ddSurface->pitch; +} + +void OSVideoSurface::load() { + if (!_resourceKey.scanForFile()) + return; + + bool result = true; + switch (_resourceKey.fileTypeSuffix()) { + case FILETYPE_IMAGE: + switch (_resourceKey.imageTypeSuffix()) { + case IMAGETYPE_TARGA: + loadTarga(); + break; + case IMAGETYPE_JPEG: + loadJPEG(); + break; + default: + break; + } + return true; + + case FILETYPE_MOVIE: + loadMovie(); + return true; + + default: + return false; + } } } // End of namespace Titanic diff --git a/engines/titanic/video_surface.h b/engines/titanic/video_surface.h index d0fa54bf85..1c4bf322ab 100644 --- a/engines/titanic/video_surface.h +++ b/engines/titanic/video_surface.h @@ -54,11 +54,64 @@ protected: public: CVideoSurface(CScreenManager *screenManager); + /** + * Set the underlying surface for this video surface + */ void setSurface(CScreenManager *screenManager, DirectDrawSurface *surface); - virtual void proc8(const CResourceKey &key) = 0; + /** + * Load the surface with the passed resource + */ + virtual void loadResource(const CResourceKey &key) = 0; + + /** + * Loads a Targa image file specified by the resource key + */ + virtual void loadTarga() = 0; + + /** + * Loads a JPEG image file specified by the resource key + */ + virtual void loadJPEG() = 0; + + /** + * Loads a movie file specified by the resource key + */ + virtual void loadMovie() = 0; + + /** + * Lock the surface for direct access to the pixels + */ + virtual void lock() = 0; + + /** + * Unlocks the surface after prior calls to lock() + */ + virtual void unlock() = 0; + + /** + * Returns true if an underlying raw surface has been set + */ virtual bool hasSurface() = 0; - virtual void proc43() = 0; + + /** + * Returns the width of the surface + */ + virtual int getWidth() = 0; + + /** + * Returns the height of the surface + */ + virtual int getHeight() const = 0; + + /** + * Returns the pitch of the surface in bytes + */ + virtual int getPitch() const = 0; + /** + * Loads the surface data based on the currently set resource key + */ + virtual void load() const = 0; }; class OSVideoSurface : public CVideoSurface { @@ -66,9 +119,60 @@ public: OSVideoSurface(CScreenManager *screenManager, DirectDrawSurface *surface); OSVideoSurface(CScreenManager *screenManager, const CResourceKey &key, bool flag = false); - virtual void proc8(const CResourceKey &key); + /** + * Load the surface with the passed resource + */ + virtual void loadResource(const CResourceKey &key); + + /** + * Loads a Targa image file specified by the resource key + */ + virtual void loadTarga(); + + /** + * Loads a JPEG image file specified by the resource key + */ + virtual void loadJPEG(); + + /** + * Loads a movie file specified by the resource key + */ + virtual void loadMovie(); + + /** + * Lock the surface for direct access to the pixels + */ + virtual void lock(); + + /** + * Unlocks the surface after prior calls to lock() + */ + virtual void unlock(); + + /** + * Returns true if an underlying raw surface has been set + */ virtual bool hasSurface(); - virtual void proc43(); + + /** + * Returns the width of the surface + */ + virtual int getWidth() const; + + /** + * Returns the height of the surface + */ + virtual int getHeight() const; + + /** + * Returns the pitch of the surface in bytes + */ + virtual int getPitch() const; + + /** + * Loads the surface data based on the currently set resource key + */ + virtual void load(); }; } // End of namespace Titanic -- cgit v1.2.3 From c78e2fefd9f7a36b17c0206539536be95fca20f3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 16 Mar 2016 21:27:58 -0400 Subject: TITANIC: Implement surface lock and unlocking --- engines/titanic/direct_draw.cpp | 9 +++++++++ engines/titanic/direct_draw.h | 10 ++++++++++ engines/titanic/simple_file.cpp | 9 +++++++++ engines/titanic/simple_file.h | 8 ++++++++ engines/titanic/video_surface.cpp | 37 +++++++++++++++++++++++++++++++++---- engines/titanic/video_surface.h | 21 +++++++++++++-------- 6 files changed, 82 insertions(+), 12 deletions(-) diff --git a/engines/titanic/direct_draw.cpp b/engines/titanic/direct_draw.cpp index 17e13610e0..1d0ddab4fb 100644 --- a/engines/titanic/direct_draw.cpp +++ b/engines/titanic/direct_draw.cpp @@ -110,6 +110,15 @@ DirectDrawSurface *DirectDrawManager::createSurface(int w, int h, int surfaceNum /*------------------------------------------------------------------------*/ +void *DirectDrawSurface::lock(const Common::Rect *bounds, int flags) { + assert(w != 0 && h != 0); + return getPixels(); +} + +void DirectDrawSurface::unlock() { + assert(w != 0 && h != 0); +} + void DirectDrawSurface::fill(const Common::Rect *bounds, uint32 color) { Common::Rect tempBounds; diff --git a/engines/titanic/direct_draw.h b/engines/titanic/direct_draw.h index bd6a77dc2d..71210f1b28 100644 --- a/engines/titanic/direct_draw.h +++ b/engines/titanic/direct_draw.h @@ -42,6 +42,16 @@ struct DDSurfaceDesc { class DirectDrawSurface : public Graphics::Surface { public: + /** + * Lock the surface for access + */ + void *lock(const Common::Rect *bounds, int flags); + + /** + * Unlocks the surface at the end of direct accesses + */ + void unlock(); + /** * Fills an area of the surfae with the specified color. If no bounds are passed, * then the entire surface is filled diff --git a/engines/titanic/simple_file.cpp b/engines/titanic/simple_file.cpp index 4be8bb3d88..f2fdf4effb 100644 --- a/engines/titanic/simple_file.cpp +++ b/engines/titanic/simple_file.cpp @@ -331,4 +331,13 @@ void SimpleFile::writeClassEnd(int indent) { write("}\n", 2); } +/*------------------------------------------------------------------------*/ + +StdCWadFile::StdCWadFile(const CString &name): SimpleFile() { + if (!_file.open(name)) + error("Could not open file - %s", name.c_str()); + + open(&_file); +} + } // End of namespace Titanic diff --git a/engines/titanic/simple_file.h b/engines/titanic/simple_file.h index cc68d2d54c..0a452e49cd 100644 --- a/engines/titanic/simple_file.h +++ b/engines/titanic/simple_file.h @@ -23,6 +23,7 @@ #ifndef TITANIC_SIMPLE_FILE_H #define TITANIC_SIMPLE_FILE_H +#include "common/file.h" #include "common/rect.h" #include "common/savefile.h" #include "common/stream.h" @@ -202,6 +203,13 @@ public: } }; +class StdCWadFile : public SimpleFile { +private: + Common::File _file; +public: + StdCWadFile(const CString &name); +}; + } // End of namespace Titanic #endif /* TITANIC_SIMPLE_FILE_H */ diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp index e649532b81..771c7779e0 100644 --- a/engines/titanic/video_surface.cpp +++ b/engines/titanic/video_surface.cpp @@ -28,7 +28,7 @@ namespace Titanic { int CVideoSurface::_videoSurfaceCounter = 0; CVideoSurface::CVideoSurface(CScreenManager *screenManager) : - _screenManager(screenManager), _field2C(0), + _screenManager(screenManager), _pixels(nullptr), _field34(0), _field38(0), _field3C(0), _field40(0), _field44(4), _field48(0), _field50(1) { _videoSurfaceNum = _videoSurfaceCounter++; @@ -79,6 +79,22 @@ void OSVideoSurface::loadMovie() { warning("TODO"); } +bool OSVideoSurface::lock() { + if (!proc42()) + return false; + + ++_lockCount; + _pixels = (uint16 *)_ddSurface->lock(nullptr, 0); + return true; +} + +void OSVideoSurface::unlock() { + if (_pixels) + _ddSurface->unlock(); + _pixels = nullptr; + --_lockCount; +} + bool OSVideoSurface::hasSurface() { return _ddSurface != nullptr; } @@ -98,11 +114,10 @@ int OSVideoSurface::getPitch() const { return _ddSurface->pitch; } -void OSVideoSurface::load() { +bool OSVideoSurface::load() { if (!_resourceKey.scanForFile()) - return; + return false; - bool result = true; switch (_resourceKey.fileTypeSuffix()) { case FILETYPE_IMAGE: switch (_resourceKey.imageTypeSuffix()) { @@ -126,4 +141,18 @@ void OSVideoSurface::load() { } } +bool OSVideoSurface::proc42() { + _videoSurfaceNum = _videoSurfaceCounter; + + if (hasSurface()) { + return true; + } else if (_field38) { + _field50 = 1; + load(); + return true; + } else { + return false; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/video_surface.h b/engines/titanic/video_surface.h index 1c4bf322ab..445165c9df 100644 --- a/engines/titanic/video_surface.h +++ b/engines/titanic/video_surface.h @@ -35,13 +35,13 @@ namespace Titanic { class CScreenManager; class CVideoSurface : public ListItem { -private: +protected: static int _videoSurfaceCounter; protected: CScreenManager *_screenManager; CResourceKey _resourceKey; DirectDrawSurface *_ddSurface; - int _field2C; + uint16 *_pixels; int _field34; bool _field38; int _field3C; @@ -50,7 +50,7 @@ protected: int _field48; int _videoSurfaceNum; int _field50; - int _accessCtr; + int _lockCount; public: CVideoSurface(CScreenManager *screenManager); @@ -82,7 +82,7 @@ public: /** * Lock the surface for direct access to the pixels */ - virtual void lock() = 0; + virtual bool lock() = 0; /** * Unlocks the surface after prior calls to lock() @@ -97,7 +97,7 @@ public: /** * Returns the width of the surface */ - virtual int getWidth() = 0; + virtual int getWidth() const = 0; /** * Returns the height of the surface @@ -108,10 +108,13 @@ public: * Returns the pitch of the surface in bytes */ virtual int getPitch() const = 0; + /** * Loads the surface data based on the currently set resource key */ - virtual void load() const = 0; + virtual bool load() = 0; + + virtual bool proc42() = 0; }; class OSVideoSurface : public CVideoSurface { @@ -142,7 +145,7 @@ public: /** * Lock the surface for direct access to the pixels */ - virtual void lock(); + virtual bool lock(); /** * Unlocks the surface after prior calls to lock() @@ -172,7 +175,9 @@ public: /** * Loads the surface data based on the currently set resource key */ - virtual void load(); + virtual bool load(); + + virtual bool proc42(); }; } // End of namespace Titanic -- cgit v1.2.3 From b5d64f9c20611eb99b4d908d72e6cfd05f1a4c65 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 16 Mar 2016 21:35:41 -0400 Subject: TITANIC: Renames/fixes for OSVideoSurface methods --- engines/titanic/string.cpp | 6 ++++-- engines/titanic/video_surface.cpp | 16 ++++++++-------- engines/titanic/video_surface.h | 12 +++++++++--- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/engines/titanic/string.cpp b/engines/titanic/string.cpp index dbe0617f06..44e0e627f3 100644 --- a/engines/titanic/string.cpp +++ b/engines/titanic/string.cpp @@ -26,11 +26,13 @@ namespace Titanic { CString CString::left(uint count) const { - return (count > size()) ? *this : CString(c_str(), c_str() + count); + return (count > size()) ? CString() : CString(c_str(), c_str() + count); } CString CString::right(uint count) const { - return (count > size()) ? *this : CString(c_str() - count, c_str()); + int strSize = size(); + return (count > strSize) ? CString() : + CString(c_str() + strSize - count, c_str() + strSize); } CString CString::mid(uint start, uint count) const { diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp index 771c7779e0..44b91c0ed0 100644 --- a/engines/titanic/video_surface.cpp +++ b/engines/titanic/video_surface.cpp @@ -29,7 +29,7 @@ int CVideoSurface::_videoSurfaceCounter = 0; CVideoSurface::CVideoSurface(CScreenManager *screenManager) : _screenManager(screenManager), _pixels(nullptr), - _field34(0), _field38(0), _field3C(0), _field40(0), + _field34(0), _pendingLoad(false), _field3C(0), _field40(0), _field44(4), _field48(0), _field50(1) { _videoSurfaceNum = _videoSurfaceCounter++; } @@ -46,12 +46,12 @@ OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, DirectDrawSurface _ddSurface = surface; } -OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, const CResourceKey &key, bool flag) : +OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, const CResourceKey &key, bool pendingLoad) : CVideoSurface(screenManager) { _ddSurface = nullptr; - _field38 = flag; + _pendingLoad = pendingLoad; - if (_field38) { + if (_pendingLoad) { loadResource(key); } else { _resourceKey = key; @@ -61,7 +61,7 @@ OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, const CResourceKey void OSVideoSurface::loadResource(const CResourceKey &key) { _resourceKey = key; - _field38 = 1; + _pendingLoad = true; if (hasSurface()) load(); @@ -80,7 +80,7 @@ void OSVideoSurface::loadMovie() { } bool OSVideoSurface::lock() { - if (!proc42()) + if (!loadIfReady()) return false; ++_lockCount; @@ -141,12 +141,12 @@ bool OSVideoSurface::load() { } } -bool OSVideoSurface::proc42() { +bool OSVideoSurface::loadIfReady() { _videoSurfaceNum = _videoSurfaceCounter; if (hasSurface()) { return true; - } else if (_field38) { + } else if (_pendingLoad) { _field50 = 1; load(); return true; diff --git a/engines/titanic/video_surface.h b/engines/titanic/video_surface.h index 445165c9df..d03e322d03 100644 --- a/engines/titanic/video_surface.h +++ b/engines/titanic/video_surface.h @@ -43,7 +43,7 @@ protected: DirectDrawSurface *_ddSurface; uint16 *_pixels; int _field34; - bool _field38; + bool _pendingLoad; int _field3C; int _field40; int _field44; @@ -114,7 +114,10 @@ public: */ virtual bool load() = 0; - virtual bool proc42() = 0; + /** + * Loads the surface's resource if there's one pending + */ + virtual bool loadIfReady() = 0; }; class OSVideoSurface : public CVideoSurface { @@ -177,7 +180,10 @@ public: */ virtual bool load(); - virtual bool proc42(); + /** + * Loads the surface's resource if there's one pending + */ + virtual bool loadIfReady(); }; } // End of namespace Titanic -- cgit v1.2.3 From 103f3b524eecc8714f27670e49c414a2198fca90 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 16 Mar 2016 22:40:50 -0400 Subject: TITANIC: Implemented surface resizing and freeing --- engines/titanic/direct_draw.h | 5 +++ engines/titanic/image_decoders.cpp | 45 +++++++++++++++++++++ engines/titanic/image_decoders.h | 81 ++++++++++++++++++++++++++++++++++++++ engines/titanic/module.mk | 1 + engines/titanic/screen_manager.cpp | 5 ++- engines/titanic/screen_manager.h | 12 ++++-- engines/titanic/video_surface.cpp | 36 ++++++++++++++++- engines/titanic/video_surface.h | 23 ++++++++++- 8 files changed, 202 insertions(+), 6 deletions(-) create mode 100644 engines/titanic/image_decoders.cpp create mode 100644 engines/titanic/image_decoders.h diff --git a/engines/titanic/direct_draw.h b/engines/titanic/direct_draw.h index 71210f1b28..4bd723bcd3 100644 --- a/engines/titanic/direct_draw.h +++ b/engines/titanic/direct_draw.h @@ -42,6 +42,11 @@ struct DDSurfaceDesc { class DirectDrawSurface : public Graphics::Surface { public: + /** + * Return the size of the surface in ytes + */ + int getSize() const { return pitch * h; } + /** * Lock the surface for access */ diff --git a/engines/titanic/image_decoders.cpp b/engines/titanic/image_decoders.cpp new file mode 100644 index 0000000000..896155d7b8 --- /dev/null +++ b/engines/titanic/image_decoders.cpp @@ -0,0 +1,45 @@ +/* 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 "titanic/image_decoders.h" + +namespace Titanic { + +CJPEGDecode::CJPEGDecode(const CString &name): _file(name), + _width(0), _height(0) { +} + +void CJPEGDecode::decode(OSVideoSurface &surface) { + +} + +/*------------------------------------------------------------------------*/ + + +CTargaDecode::CTargaDecode(const CString &name) : _file(name), + _width(0), _height(0) { +} + +void CTargaDecode::decode(OSVideoSurface &surface) { +} + +} // End of namespace Titanic diff --git a/engines/titanic/image_decoders.h b/engines/titanic/image_decoders.h new file mode 100644 index 0000000000..258595846c --- /dev/null +++ b/engines/titanic/image_decoders.h @@ -0,0 +1,81 @@ +/* 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. + * + */ + +#ifndef TITANIC_IMAGE_DECODERS_H +#define TITANIC_IMAGE_DECODERS_H + +#include "titanic/string.h" +#include "titanic/simple_file.h" +#include "titanic/video_surface.h" + +namespace Titanic { + +class CJPEGDecode { +private: + StdCWadFile _file; + int _width, _height; +public: + CJPEGDecode(const CString &name); + + /** + * Return the width of the JPEG + */ + int getWidth() const { return _width; } + + /** + * Return the height of the JPEG + */ + int getHeight() const { return _height; } + + /** + * Decode the image onto the passed surface + */ + void decode(OSVideoSurface &surface); +}; + +class CTargaDecode { +private: + StdCWadFile _file; + int _width, _height; +public: + CTargaDecode(const CString &name); + + /** + * Return the width of the JPEG + */ + int getWidth() const { return _width; } + + /** + * Return the height of the JPEG + */ + int getHeight() const { return _height; } + + /** + * Decode the image onto the passed surface + */ + void decode(OSVideoSurface &surface); + +}; + +} // End of namespace Titanic + +#endif /* TITANIC_IMAGE_DECODERS_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 664dc0a3e5..ec55392833 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -10,6 +10,7 @@ MODULE_OBJS := \ game_state.o \ game_view.o \ image.o \ + image_decoders.o \ input_handler.o \ input_translator.o \ main_game_window.o \ diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp index f64468e90b..9c88dc6de9 100644 --- a/engines/titanic/screen_manager.cpp +++ b/engines/titanic/screen_manager.cpp @@ -130,7 +130,10 @@ void OSScreenManager::clearSurface(int surfaceNum, Common::Rect *bounds) { _directDrawManager._backSurfaces[surfaceNum]->fill(bounds, 0); } -void OSScreenManager::proc21() {} +void OSScreenManager::resizeSurface(CVideoSurface *surface, int width, int height) { + DirectDrawSurface *ddSurface = _directDrawManager.createSurface(width, height, 0); + surface->setSurface(this, ddSurface); +} CVideoSurface *OSScreenManager::createSurface(int w, int h) { DirectDrawSurface *ddSurface = _directDrawManager.createSurface(w, h, 0); diff --git a/engines/titanic/screen_manager.h b/engines/titanic/screen_manager.h index 075e36cadf..caaefc87a6 100644 --- a/engines/titanic/screen_manager.h +++ b/engines/titanic/screen_manager.h @@ -105,7 +105,10 @@ public: */ virtual void clearSurface(int surfaceNum, Common::Rect *_bounds) = 0; - virtual void proc21() = 0; + /** + * Resize the passed surface + */ + virtual void resizeSurface(CVideoSurface *surface, int width, int height) = 0; /** * Creates a surface of a given size @@ -167,8 +170,11 @@ public: * Clear a portion of the screen surface */ virtual void clearSurface(int surfaceNum, Common::Rect *bounds); - - virtual void proc21(); + + /** + * Resize the passed surface + */ + virtual void resizeSurface(CVideoSurface *surface, int width, int height); /** * Creates a surface of a given size diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp index 44b91c0ed0..4f79cd8189 100644 --- a/engines/titanic/video_surface.cpp +++ b/engines/titanic/video_surface.cpp @@ -21,6 +21,7 @@ */ #include "titanic/video_surface.h" +#include "titanic/image_decoders.h" #include "titanic/screen_manager.h" namespace Titanic { @@ -29,11 +30,19 @@ int CVideoSurface::_videoSurfaceCounter = 0; CVideoSurface::CVideoSurface(CScreenManager *screenManager) : _screenManager(screenManager), _pixels(nullptr), - _field34(0), _pendingLoad(false), _field3C(0), _field40(0), + _field34(nullptr), _pendingLoad(false), _field3C(0), _field40(0), _field44(4), _field48(0), _field50(1) { _videoSurfaceNum = _videoSurfaceCounter++; } + +CVideoSurface::~CVideoSurface() { + if (_ddSurface) + _videoSurfaceCounter -= freeSurface(); + --_videoSurfaceCounter; +} + + void CVideoSurface::setSurface(CScreenManager *screenManager, DirectDrawSurface *surface) { _screenManager = screenManager; _ddSurface = surface; @@ -72,6 +81,10 @@ void OSVideoSurface::loadTarga() { } void OSVideoSurface::loadJPEG() { + CString filename = _resourceKey.exists(); + CJPEGDecode decoder(filename); + + warning("TODO"); } @@ -114,6 +127,14 @@ int OSVideoSurface::getPitch() const { return _ddSurface->pitch; } +void OSVideoSurface::resize(int width, int height) { + freeSurface(); + + _screenManager->resizeSurface(this, width, height); + if (_ddSurface) + _videoSurfaceCounter += _ddSurface->getSize(); +} + bool OSVideoSurface::load() { if (!_resourceKey.scanForFile()) return false; @@ -155,4 +176,17 @@ bool OSVideoSurface::loadIfReady() { } } +int OSVideoSurface::freeSurface() { + if (!_ddSurface) + return 0; + int surfaceSize = _ddSurface->getSize(); + + delete _field34; + _field34 = nullptr; + delete _ddSurface; + _ddSurface = nullptr; + + return surfaceSize; +} + } // End of namespace Titanic diff --git a/engines/titanic/video_surface.h b/engines/titanic/video_surface.h index d03e322d03..cd1fc2e786 100644 --- a/engines/titanic/video_surface.h +++ b/engines/titanic/video_surface.h @@ -42,7 +42,7 @@ protected: CResourceKey _resourceKey; DirectDrawSurface *_ddSurface; uint16 *_pixels; - int _field34; + void *_field34; bool _pendingLoad; int _field3C; int _field40; @@ -53,6 +53,7 @@ protected: int _lockCount; public: CVideoSurface(CScreenManager *screenManager); + virtual ~CVideoSurface(); /** * Set the underlying surface for this video surface @@ -109,6 +110,11 @@ public: */ virtual int getPitch() const = 0; + /** + * Reiszes the surface + */ + virtual void resize(int width, int height) = 0; + /** * Loads the surface data based on the currently set resource key */ @@ -118,6 +124,11 @@ public: * Loads the surface's resource if there's one pending */ virtual bool loadIfReady() = 0; + + /** + * Frees the underlying surface + */ + virtual int freeSurface() { return 0; } }; class OSVideoSurface : public CVideoSurface { @@ -175,6 +186,11 @@ public: */ virtual int getPitch() const; + /** + * Reiszes the surface + */ + virtual void resize(int width, int height); + /** * Loads the surface data based on the currently set resource key */ @@ -184,6 +200,11 @@ public: * Loads the surface's resource if there's one pending */ virtual bool loadIfReady(); + + /** + * Frees the underlying surface + */ + virtual int freeSurface(); }; } // End of namespace Titanic -- cgit v1.2.3 From c1f2912fc464dd17a840d74a7e545ee2dcfd485f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 16 Mar 2016 23:06:01 -0400 Subject: TITANIC: Implemented surface shiftColors --- engines/titanic/core/resource_key.cpp | 2 +- engines/titanic/core/resource_key.h | 2 +- engines/titanic/video_surface.cpp | 50 +++++++++++++++++++++++++++++------ engines/titanic/video_surface.h | 30 +++++++++++++++------ 4 files changed, 66 insertions(+), 18 deletions(-) diff --git a/engines/titanic/core/resource_key.cpp b/engines/titanic/core/resource_key.cpp index 4b52082b77..089df9856a 100644 --- a/engines/titanic/core/resource_key.cpp +++ b/engines/titanic/core/resource_key.cpp @@ -58,7 +58,7 @@ void CResourceKey::setValue(const CString &name) { _value = _value.mid(idx + 1); } -CString CResourceKey::exists() { +CString CResourceKey::exists() const { CString name = _key; // Check for a resource being specified within an ST container diff --git a/engines/titanic/core/resource_key.h b/engines/titanic/core/resource_key.h index 111cec5c7c..dc4c791cea 100644 --- a/engines/titanic/core/resource_key.h +++ b/engines/titanic/core/resource_key.h @@ -56,7 +56,7 @@ public: * Checks whether a file for the given key exists, * and returns it's filename if it does */ - CString exists(); + CString exists() const; /** * Scans for a file with a matching name diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp index 4f79cd8189..19dcf25610 100644 --- a/engines/titanic/video_surface.cpp +++ b/engines/titanic/video_surface.cpp @@ -35,14 +35,12 @@ CVideoSurface::CVideoSurface(CScreenManager *screenManager) : _videoSurfaceNum = _videoSurfaceCounter++; } - CVideoSurface::~CVideoSurface() { if (_ddSurface) _videoSurfaceCounter -= freeSurface(); --_videoSurfaceCounter; } - void CVideoSurface::setSurface(CScreenManager *screenManager, DirectDrawSurface *surface) { _screenManager = screenManager; _ddSurface = surface; @@ -76,16 +74,21 @@ void OSVideoSurface::loadResource(const CResourceKey &key) { load(); } -void OSVideoSurface::loadTarga() { +void OSVideoSurface::loadTarga(const CResourceKey &key) { warning("TODO"); } -void OSVideoSurface::loadJPEG() { - CString filename = _resourceKey.exists(); +void OSVideoSurface::loadJPEG(const CResourceKey &key) { + CString filename = key.exists(); + + // Decode the image CJPEGDecode decoder(filename); + decoder.decode(*this); + if (proc26() == 2) + shiftColors(); - warning("TODO"); + _resourceKey = key; } void OSVideoSurface::loadMovie() { @@ -135,6 +138,14 @@ void OSVideoSurface::resize(int width, int height) { _videoSurfaceCounter += _ddSurface->getSize(); } +int OSVideoSurface::proc26() { + if (!loadIfReady()) + assert(0); + + warning("TODO"); + return 0; +} + bool OSVideoSurface::load() { if (!_resourceKey.scanForFile()) return false; @@ -143,10 +154,10 @@ bool OSVideoSurface::load() { case FILETYPE_IMAGE: switch (_resourceKey.imageTypeSuffix()) { case IMAGETYPE_TARGA: - loadTarga(); + loadTarga(_resourceKey); break; case IMAGETYPE_JPEG: - loadJPEG(); + loadJPEG(_resourceKey); break; default: break; @@ -162,6 +173,29 @@ bool OSVideoSurface::load() { } } +void OSVideoSurface::shiftColors() { + if (!loadIfReady()) + return; + + if (!lock()) + assert(0); + + int width = getWidth(); + int height = getHeight(); + int pitch = getPitch(); + uint16 *pixels = _pixels; + uint16 *p; + int x, y; + + for (y = 0; y < height; ++y, pixels += pitch) { + for (x = 0, p = pixels; x < width; ++x, ++p) { + *p = ((*p & 0xFFE0) * 2) | (*p & 0x1F); + } + } + + unlock(); +} + bool OSVideoSurface::loadIfReady() { _videoSurfaceNum = _videoSurfaceCounter; diff --git a/engines/titanic/video_surface.h b/engines/titanic/video_surface.h index cd1fc2e786..838529f770 100644 --- a/engines/titanic/video_surface.h +++ b/engines/titanic/video_surface.h @@ -68,12 +68,12 @@ public: /** * Loads a Targa image file specified by the resource key */ - virtual void loadTarga() = 0; + virtual void loadTarga(const CResourceKey &key) = 0; /** * Loads a JPEG image file specified by the resource key */ - virtual void loadJPEG() = 0; + virtual void loadJPEG(const CResourceKey &key) = 0; /** * Loads a movie file specified by the resource key @@ -115,16 +115,23 @@ public: */ virtual void resize(int width, int height) = 0; + virtual int proc26() = 0; + /** - * Loads the surface data based on the currently set resource key + * Shifts the colors of the surface.. maybe greys it out? */ - virtual bool load() = 0; + virtual void shiftColors() = 0; /** * Loads the surface's resource if there's one pending */ virtual bool loadIfReady() = 0; + /** + * Loads the surface data based on the currently set resource key + */ + virtual bool load() = 0; + /** * Frees the underlying surface */ @@ -144,12 +151,12 @@ public: /** * Loads a Targa image file specified by the resource key */ - virtual void loadTarga(); + virtual void loadTarga(const CResourceKey &key); /** * Loads a JPEG image file specified by the resource key */ - virtual void loadJPEG(); + virtual void loadJPEG(const CResourceKey &key); /** * Loads a movie file specified by the resource key @@ -191,16 +198,23 @@ public: */ virtual void resize(int width, int height); + virtual int proc26(); + /** - * Loads the surface data based on the currently set resource key + * Shifts the colors of the surface.. maybe greys it out? */ - virtual bool load(); + virtual void shiftColors(); /** * Loads the surface's resource if there's one pending */ virtual bool loadIfReady(); + /** + * Loads the surface data based on the currently set resource key + */ + virtual bool load(); + /** * Frees the underlying surface */ -- cgit v1.2.3 From 5a3aa81ab628fce76a33a07dc97010bd4d439a4e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 17 Mar 2016 07:28:58 -0400 Subject: TITANIC: Implemented CStdCWADFile class --- engines/titanic/image_decoders.cpp | 7 +++--- engines/titanic/simple_file.cpp | 49 ++++++++++++++++++++++++++++++++++---- engines/titanic/simple_file.h | 22 ++++++++++++++--- engines/titanic/string.cpp | 4 ++-- engines/titanic/string.h | 11 +++++++-- engines/titanic/video_surface.cpp | 4 +--- 6 files changed, 79 insertions(+), 18 deletions(-) diff --git a/engines/titanic/image_decoders.cpp b/engines/titanic/image_decoders.cpp index 896155d7b8..bf941f83b5 100644 --- a/engines/titanic/image_decoders.cpp +++ b/engines/titanic/image_decoders.cpp @@ -24,8 +24,8 @@ namespace Titanic { -CJPEGDecode::CJPEGDecode(const CString &name): _file(name), - _width(0), _height(0) { +CJPEGDecode::CJPEGDecode(const CString &name) : _width(0), _height(0) { + _file.open(name); } void CJPEGDecode::decode(OSVideoSurface &surface) { @@ -35,8 +35,7 @@ void CJPEGDecode::decode(OSVideoSurface &surface) { /*------------------------------------------------------------------------*/ -CTargaDecode::CTargaDecode(const CString &name) : _file(name), - _width(0), _height(0) { +CTargaDecode::CTargaDecode(const CString &name) : _width(0), _height(0) { } void CTargaDecode::decode(OSVideoSurface &surface) { diff --git a/engines/titanic/simple_file.cpp b/engines/titanic/simple_file.cpp index f2fdf4effb..c975a27b28 100644 --- a/engines/titanic/simple_file.cpp +++ b/engines/titanic/simple_file.cpp @@ -25,6 +25,13 @@ namespace Titanic { +bool File::open(const Common::String &name) { + if (!Common::File::open(name)) + error("Could not open file - %s", name.c_str()); +} + +/*------------------------------------------------------------------------*/ + SimpleFile::SimpleFile(): _inStream(nullptr), _outStream(nullptr), _lineCount(1) { } @@ -333,11 +340,45 @@ void SimpleFile::writeClassEnd(int indent) { /*------------------------------------------------------------------------*/ -StdCWadFile::StdCWadFile(const CString &name): SimpleFile() { - if (!_file.open(name)) - error("Could not open file - %s", name.c_str()); +void StdCWadFile::open(const CString &name) { + File f; + + // Check for whether it is indeed a file/resource pair + int idx = name.indexOf('#'); + + if (idx < 0) { + // Nope, so open up file for standard reading + assert(!name.empty()); + f.open(name); + + SimpleFile::open(f.readStream(f.size())); + return; + } - open(&_file); + // Split up the name and resource, and get the resource index + CString filename = name.left(idx) + ".st"; + int extPos = name.lastIndexOf('.'); + CString resStr = name.mid(idx + 1, extPos - idx - 1); + int resIndex = resStr.readInt(); + + // Open up the index for access + f.open(filename); + int indexSize = f.readUint32LE() / 4; + assert(resIndex < indexSize); + + // Get the specific resource's offset, and size by also + // getting the offset of the following resource + f.seek(resIndex * 4); + uint resOffset = f.readUint32LE(); + uint nextOffset = (resIndex == (indexSize - 1)) ? f.size() : + f.readUint32LE(); + + // Read in the resource + f.seek(resOffset); + Common::SeekableReadStream *stream = f.readStream(nextOffset - resOffset); + SimpleFile::open(stream); + + f.close(); } } // End of namespace Titanic diff --git a/engines/titanic/simple_file.h b/engines/titanic/simple_file.h index 0a452e49cd..b779fd0a35 100644 --- a/engines/titanic/simple_file.h +++ b/engines/titanic/simple_file.h @@ -35,6 +35,15 @@ namespace Titanic { class Decompressor; class DecompressorData; +/** + * Simple ScummVM File descendent that throws a wobbly if + * the file it tries to open isn't present + */ +class File : public Common::File { +public: + virtual bool open(const Common::String &name); +}; + /** * This class implements basic reading and writing to files */ @@ -203,11 +212,18 @@ public: } }; +/** + * Derived file that handles WAD archives containing multiple files + */ class StdCWadFile : public SimpleFile { -private: - Common::File _file; public: - StdCWadFile(const CString &name); + StdCWadFile() : SimpleFile() {} + virtual ~StdCWadFile() {} + + /** + * Open up the specified file + */ + void open(const CString &name); }; } // End of namespace Titanic diff --git a/engines/titanic/string.cpp b/engines/titanic/string.cpp index 44e0e627f3..ed5379be65 100644 --- a/engines/titanic/string.cpp +++ b/engines/titanic/string.cpp @@ -48,12 +48,12 @@ CString CString::mid(uint start) const { return mid(start, strSize - start); } -int CString::indexOf(char c) { +int CString::indexOf(char c) const { const char *charP = strchr(c_str(), c); return charP ? charP - c_str() : -1; } -int CString::lastIndexOf(char c) { +int CString::lastIndexOf(char c) const { const char *charP = strrchr(c_str(), c); return charP ? charP - c_str() : -1; } diff --git a/engines/titanic/string.h b/engines/titanic/string.h index 6b8e4b784e..08b5649dc9 100644 --- a/engines/titanic/string.h +++ b/engines/titanic/string.h @@ -69,12 +69,12 @@ public: /** * Returns the index of the first occurance of a given character */ - int indexOf(char c); + int indexOf(char c) const; /** * Returns the index of the last occurance of a given character */ - int lastIndexOf(char c); + int lastIndexOf(char c) const; /** * Returns the type of a filename based on it's extension @@ -85,6 +85,13 @@ public: * Returns the type of an image filename based on it's extension */ ImageType imageTypeSuffix() const; + + /** + * Parses the string as an integer and returns the value + */ + int readInt() const { + return atoi(c_str()); + } }; } // End of namespace Titanic diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp index 19dcf25610..840680070c 100644 --- a/engines/titanic/video_surface.cpp +++ b/engines/titanic/video_surface.cpp @@ -79,10 +79,8 @@ void OSVideoSurface::loadTarga(const CResourceKey &key) { } void OSVideoSurface::loadJPEG(const CResourceKey &key) { - CString filename = key.exists(); - // Decode the image - CJPEGDecode decoder(filename); + CJPEGDecode decoder(key.getString()); decoder.decode(*this); if (proc26() == 2) -- cgit v1.2.3 From 8a1d238fd59a6aef21f74721f039cc0375c18a24 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 17 Mar 2016 13:11:01 -0400 Subject: TITANIC: Implemented the CJPEGDecode and CTargaDecode classes Thank goodness for the existing ScummVM image decoders for these types.. it made implementing the classes sooooo much easier --- engines/titanic/direct_draw.cpp | 4 ++-- engines/titanic/direct_draw.h | 2 +- engines/titanic/image_decoders.cpp | 47 ++++++++++++++++++++++++++++++++------ engines/titanic/image_decoders.h | 45 +++++++----------------------------- engines/titanic/simple_file.h | 5 ++++ engines/titanic/video_surface.cpp | 24 ++++++++++++------- engines/titanic/video_surface.h | 6 ++++- 7 files changed, 77 insertions(+), 56 deletions(-) diff --git a/engines/titanic/direct_draw.cpp b/engines/titanic/direct_draw.cpp index 1d0ddab4fb..d5a8cf2409 100644 --- a/engines/titanic/direct_draw.cpp +++ b/engines/titanic/direct_draw.cpp @@ -110,9 +110,9 @@ DirectDrawSurface *DirectDrawManager::createSurface(int w, int h, int surfaceNum /*------------------------------------------------------------------------*/ -void *DirectDrawSurface::lock(const Common::Rect *bounds, int flags) { +Graphics::Surface *DirectDrawSurface::lock(const Common::Rect *bounds, int flags) { assert(w != 0 && h != 0); - return getPixels(); + return this; } void DirectDrawSurface::unlock() { diff --git a/engines/titanic/direct_draw.h b/engines/titanic/direct_draw.h index 4bd723bcd3..5ec0f3d5c7 100644 --- a/engines/titanic/direct_draw.h +++ b/engines/titanic/direct_draw.h @@ -50,7 +50,7 @@ public: /** * Lock the surface for access */ - void *lock(const Common::Rect *bounds, int flags); + Graphics::Surface *lock(const Common::Rect *bounds, int flags); /** * Unlocks the surface at the end of direct accesses diff --git a/engines/titanic/image_decoders.cpp b/engines/titanic/image_decoders.cpp index bf941f83b5..e6e547f009 100644 --- a/engines/titanic/image_decoders.cpp +++ b/engines/titanic/image_decoders.cpp @@ -24,21 +24,54 @@ namespace Titanic { -CJPEGDecode::CJPEGDecode(const CString &name) : _width(0), _height(0) { - _file.open(name); -} +void CJPEGDecode::decode(OSVideoSurface &surface, const CString &name) { + // Open up the resource + StdCWadFile file; + file.open(name); + + // Use the ScucmmVM deoder to decode it + loadStream(*file.readStream()); + const Graphics::Surface *srcSurf = getSurface(); + + // Resize the surface if necessary + if (surface.getWidth() != srcSurf->w || surface.getHeight() != srcSurf->h) + surface.resize(srcSurf->w, srcSurf->h); -void CJPEGDecode::decode(OSVideoSurface &surface) { + // Convert the decoded surface to the correct pixel format, and then copy it over + surface.lock(); + Graphics::Surface *convertedSurface = srcSurf->convertTo(surface._rawSurface->format); + Common::copy((byte *)convertedSurface->getPixels(), (byte *)convertedSurface->getPixels() + + surface.getPitch() * surface.getHeight(), (byte *)surface._rawSurface->getPixels()); + + delete convertedSurface; + surface.unlock(); } /*------------------------------------------------------------------------*/ +void CTargaDecode::decode(OSVideoSurface &surface, const CString &name) { + // Open up the resource + StdCWadFile file; + file.open(name); -CTargaDecode::CTargaDecode(const CString &name) : _width(0), _height(0) { -} + // Use the ScucmmVM deoder to decode it + loadStream(*file.readStream()); + const Graphics::Surface *srcSurf = getSurface(); + + // Resize the surface if necessary + if (surface.getWidth() != srcSurf->w || surface.getHeight() != srcSurf->h) + surface.resize(srcSurf->w, srcSurf->h); + + // Convert the decoded surface to the correct pixel format, and then copy it over + surface.lock(); + Graphics::Surface *convertedSurface = srcSurf->convertTo(surface._rawSurface->format); + + Common::copy((byte *)convertedSurface->getPixels(), (byte *)convertedSurface->getPixels() + + surface.getPitch() * surface.getHeight(), (byte *)surface._rawSurface->getPixels()); -void CTargaDecode::decode(OSVideoSurface &surface) { + delete convertedSurface; + surface.unlock(); } } // End of namespace Titanic diff --git a/engines/titanic/image_decoders.h b/engines/titanic/image_decoders.h index 258595846c..d72d6fee5d 100644 --- a/engines/titanic/image_decoders.h +++ b/engines/titanic/image_decoders.h @@ -23,57 +23,28 @@ #ifndef TITANIC_IMAGE_DECODERS_H #define TITANIC_IMAGE_DECODERS_H +#include "image/jpeg.h" +#include "image/tga.h" #include "titanic/string.h" #include "titanic/simple_file.h" #include "titanic/video_surface.h" namespace Titanic { -class CJPEGDecode { -private: - StdCWadFile _file; - int _width, _height; +class CJPEGDecode : public Image::JPEGDecoder { public: - CJPEGDecode(const CString &name); - - /** - * Return the width of the JPEG - */ - int getWidth() const { return _width; } - /** - * Return the height of the JPEG + * Decode the image file onto the passed surface */ - int getHeight() const { return _height; } - - /** - * Decode the image onto the passed surface - */ - void decode(OSVideoSurface &surface); + void decode(OSVideoSurface &surface, const CString &name); }; -class CTargaDecode { -private: - StdCWadFile _file; - int _width, _height; +class CTargaDecode : public Image::TGADecoder { public: - CTargaDecode(const CString &name); - /** - * Return the width of the JPEG + * Decode the image file onto the passed surface */ - int getWidth() const { return _width; } - - /** - * Return the height of the JPEG - */ - int getHeight() const { return _height; } - - /** - * Decode the image onto the passed surface - */ - void decode(OSVideoSurface &surface); - + void decode(OSVideoSurface &surface, const CString &name); }; } // End of namespace Titanic diff --git a/engines/titanic/simple_file.h b/engines/titanic/simple_file.h index b779fd0a35..815896fc7e 100644 --- a/engines/titanic/simple_file.h +++ b/engines/titanic/simple_file.h @@ -224,6 +224,11 @@ public: * Open up the specified file */ void open(const CString &name); + + /** + * Return a reference to the read stream + */ + Common::SeekableReadStream *readStream() const { return _inStream; } }; } // End of namespace Titanic diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp index 840680070c..fdb9224001 100644 --- a/engines/titanic/video_surface.cpp +++ b/engines/titanic/video_surface.cpp @@ -29,7 +29,7 @@ namespace Titanic { int CVideoSurface::_videoSurfaceCounter = 0; CVideoSurface::CVideoSurface(CScreenManager *screenManager) : - _screenManager(screenManager), _pixels(nullptr), + _screenManager(screenManager), _rawSurface(nullptr), _field34(nullptr), _pendingLoad(false), _field3C(0), _field40(0), _field44(4), _field48(0), _field50(1) { _videoSurfaceNum = _videoSurfaceCounter++; @@ -75,13 +75,21 @@ void OSVideoSurface::loadResource(const CResourceKey &key) { } void OSVideoSurface::loadTarga(const CResourceKey &key) { - warning("TODO"); + // Decode the image + CTargaDecode decoder; + decoder.decode(*this, key.getString()); + + if (proc26() == 2) + shiftColors(); + + _resourceKey = key; + } void OSVideoSurface::loadJPEG(const CResourceKey &key) { // Decode the image - CJPEGDecode decoder(key.getString()); - decoder.decode(*this); + CJPEGDecode decoder; + decoder.decode(*this, key.getString()); if (proc26() == 2) shiftColors(); @@ -98,14 +106,14 @@ bool OSVideoSurface::lock() { return false; ++_lockCount; - _pixels = (uint16 *)_ddSurface->lock(nullptr, 0); + _rawSurface = _ddSurface->lock(nullptr, 0); return true; } void OSVideoSurface::unlock() { - if (_pixels) + if (_rawSurface) _ddSurface->unlock(); - _pixels = nullptr; + _rawSurface = nullptr; --_lockCount; } @@ -181,7 +189,7 @@ void OSVideoSurface::shiftColors() { int width = getWidth(); int height = getHeight(); int pitch = getPitch(); - uint16 *pixels = _pixels; + uint16 *pixels = (uint16 *)_rawSurface->getPixels(); uint16 *p; int x, y; diff --git a/engines/titanic/video_surface.h b/engines/titanic/video_surface.h index 838529f770..412b50f66c 100644 --- a/engines/titanic/video_surface.h +++ b/engines/titanic/video_surface.h @@ -33,15 +33,19 @@ namespace Titanic { class CScreenManager; +class CJPEGDecode; +class CTargaDecode; class CVideoSurface : public ListItem { + friend class CJPEGDecode; + friend class CTargaDecode; protected: static int _videoSurfaceCounter; protected: CScreenManager *_screenManager; CResourceKey _resourceKey; DirectDrawSurface *_ddSurface; - uint16 *_pixels; + Graphics::Surface *_rawSurface; void *_field34; bool _pendingLoad; int _field3C; -- cgit v1.2.3 From e80a15170640a495b5c7861abeea71d0325684cd Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 17 Mar 2016 19:13:05 -0400 Subject: TITANIC: Fix image decoders --- engines/titanic/direct_draw.cpp | 4 +++- engines/titanic/game_view.cpp | 1 + engines/titanic/image_decoders.cpp | 6 ++++-- engines/titanic/video_surface.cpp | 2 +- engines/titanic/video_surface.h | 3 ++- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/engines/titanic/direct_draw.cpp b/engines/titanic/direct_draw.cpp index d5a8cf2409..551be5b87e 100644 --- a/engines/titanic/direct_draw.cpp +++ b/engines/titanic/direct_draw.cpp @@ -48,7 +48,9 @@ void DirectDraw::diagnostics() { DirectDrawSurface *DirectDraw::createSurfaceFromDesc(const DDSurfaceDesc &desc) { DirectDrawSurface *surface = new DirectDrawSurface(); - surface->create(desc._w, desc._h, Graphics::PixelFormat::createFormatCLUT8()); + + Graphics::PixelFormat pixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); + surface->create(desc._w, desc._h, pixelFormat); return surface; } diff --git a/engines/titanic/game_view.cpp b/engines/titanic/game_view.cpp index 315b2a8909..bf901bb704 100644 --- a/engines/titanic/game_view.cpp +++ b/engines/titanic/game_view.cpp @@ -54,6 +54,7 @@ void CGameView::createSurface(const CResourceKey &key) { // Create a fresh surface CScreenManager::setCurrent(); _surface = CScreenManager::_currentScreenManagerPtr->createSurface(key); + _surface->_field3C = true; } /*------------------------------------------------------------------------*/ diff --git a/engines/titanic/image_decoders.cpp b/engines/titanic/image_decoders.cpp index e6e547f009..721342ef6d 100644 --- a/engines/titanic/image_decoders.cpp +++ b/engines/titanic/image_decoders.cpp @@ -34,7 +34,8 @@ void CJPEGDecode::decode(OSVideoSurface &surface, const CString &name) { const Graphics::Surface *srcSurf = getSurface(); // Resize the surface if necessary - if (surface.getWidth() != srcSurf->w || surface.getHeight() != srcSurf->h) + if (!surface.hasSurface() || surface.getWidth() != srcSurf->w + || surface.getHeight() != srcSurf->h) surface.resize(srcSurf->w, srcSurf->h); // Convert the decoded surface to the correct pixel format, and then copy it over @@ -60,7 +61,8 @@ void CTargaDecode::decode(OSVideoSurface &surface, const CString &name) { const Graphics::Surface *srcSurf = getSurface(); // Resize the surface if necessary - if (surface.getWidth() != srcSurf->w || surface.getHeight() != srcSurf->h) + if (!surface.hasSurface() || surface.getWidth() != srcSurf->w + || surface.getHeight() != srcSurf->h) surface.resize(srcSurf->w, srcSurf->h); // Convert the decoded surface to the correct pixel format, and then copy it over diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp index fdb9224001..08ba64ac75 100644 --- a/engines/titanic/video_surface.cpp +++ b/engines/titanic/video_surface.cpp @@ -30,7 +30,7 @@ int CVideoSurface::_videoSurfaceCounter = 0; CVideoSurface::CVideoSurface(CScreenManager *screenManager) : _screenManager(screenManager), _rawSurface(nullptr), - _field34(nullptr), _pendingLoad(false), _field3C(0), _field40(0), + _field34(nullptr), _pendingLoad(false), _field3C(false), _field40(0), _field44(4), _field48(0), _field50(1) { _videoSurfaceNum = _videoSurfaceCounter++; } diff --git a/engines/titanic/video_surface.h b/engines/titanic/video_surface.h index 412b50f66c..47caffdcaf 100644 --- a/engines/titanic/video_surface.h +++ b/engines/titanic/video_surface.h @@ -48,13 +48,14 @@ protected: Graphics::Surface *_rawSurface; void *_field34; bool _pendingLoad; - int _field3C; int _field40; int _field44; int _field48; int _videoSurfaceNum; int _field50; int _lockCount; +public: + bool _field3C; public: CVideoSurface(CScreenManager *screenManager); virtual ~CVideoSurface(); -- cgit v1.2.3 From a8d94d448ea977bdd5b1171e177de6dd714792a2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 17 Mar 2016 19:58:59 -0400 Subject: TITANIC: Fixes to make message handling const, adding CEnterRoomMsg handlers --- engines/titanic/game/bar_bell.cpp | 5 +++ engines/titanic/game/bar_bell.h | 5 ++- engines/titanic/game/bomb.cpp | 15 ++++++-- engines/titanic/game/bomb.h | 9 +++-- engines/titanic/game/chicken_cooler.cpp | 5 +++ engines/titanic/game/chicken_cooler.h | 7 ++-- engines/titanic/game/end_sequence_control.cpp | 5 +++ engines/titanic/game/end_sequence_control.h | 5 ++- engines/titanic/game/fan_noises.cpp | 5 +++ engines/titanic/game/fan_noises.h | 7 ++-- engines/titanic/game/get_lift_eye2.cpp | 5 +++ engines/titanic/game/get_lift_eye2.h | 6 ++-- engines/titanic/game/gondolier/gondolier_mixer.cpp | 8 +++++ engines/titanic/game/gondolier/gondolier_mixer.h | 5 ++- engines/titanic/messages/bilge_dispensor_event.cpp | 5 +++ engines/titanic/messages/bilge_dispensor_event.h | 3 ++ engines/titanic/messages/messages.cpp | 2 +- engines/titanic/messages/messages.h | 42 +++++++++++----------- engines/titanic/messages/mouse_messages.h | 14 ++++---- engines/titanic/moves/enter_bridge.cpp | 5 +++ engines/titanic/moves/enter_bridge.h | 7 ++-- engines/titanic/npcs/barbot.cpp | 5 +++ engines/titanic/npcs/barbot.h | 5 ++- engines/titanic/sound/auto_music_player.cpp | 8 +++++ engines/titanic/sound/auto_music_player.h | 5 ++- engines/titanic/titanic.cpp | 3 +- engines/titanic/titanic.h | 4 +++ 27 files changed, 151 insertions(+), 49 deletions(-) diff --git a/engines/titanic/game/bar_bell.cpp b/engines/titanic/game/bar_bell.cpp index 71f0e878df..1639b7da39 100644 --- a/engines/titanic/game/bar_bell.cpp +++ b/engines/titanic/game/bar_bell.cpp @@ -50,4 +50,9 @@ void CBarBell::load(SimpleFile *file) { CGameObject::load(file); } +bool CBarBell::handleEvent(const CEnterRoomMsg &msg) { + _fieldBC = 0; + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/bar_bell.h b/engines/titanic/game/bar_bell.h index 279379feaf..432bf3a281 100644 --- a/engines/titanic/game/bar_bell.h +++ b/engines/titanic/game/bar_bell.h @@ -24,16 +24,19 @@ #define TITANIC_BAR_BELL_H #include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CBarBell : public CGameObject { +class CBarBell : public CGameObject, CEnterRoomMsgTarget { public: int _fieldBC; int _fieldC0; int _fieldC4; int _fieldC8; int _fieldCC; +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF CBarBell(); diff --git a/engines/titanic/game/bomb.cpp b/engines/titanic/game/bomb.cpp index 108376efb3..429f254d66 100644 --- a/engines/titanic/game/bomb.cpp +++ b/engines/titanic/game/bomb.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/bomb.h" +#include "titanic/titanic.h" namespace Titanic { @@ -33,7 +34,7 @@ CBomb::CBomb() : CBackground() { _fieldF4 = 999; _fieldF8 = 0; _fieldFC = 0; - _field100 = 0; + _startingTicks = 0; _field104 = 60; } @@ -47,7 +48,7 @@ void CBomb::save(SimpleFile *file, int indent) const { file->writeNumberLine(_fieldF4, indent); file->writeNumberLine(_fieldF8, indent); file->writeNumberLine(_fieldFC, indent); - file->writeNumberLine(_field100, indent); + file->writeNumberLine(_startingTicks, indent); file->writeNumberLine(_field104, indent); CBackground::save(file, indent); @@ -63,10 +64,18 @@ void CBomb::load(SimpleFile *file) { _fieldF4 = file->readNumber(); _fieldF8 = file->readNumber(); _fieldFC = file->readNumber(); - _field100 = file->readNumber(); + _startingTicks = file->readNumber(); _field104 = file->readNumber(); CBackground::load(file); } +bool CBomb::handleEvent(const CEnterRoomMsg &msg) { + _fieldE8 = 12; + _fieldEC = 9; + _fieldF0 = 0; + _startingTicks = g_vm->_ticksCount; + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/bomb.h b/engines/titanic/game/bomb.h index 2e7ba4658e..4c7c9526ea 100644 --- a/engines/titanic/game/bomb.h +++ b/engines/titanic/game/bomb.h @@ -24,11 +24,12 @@ #define TITANIC_BOMB_H #include "titanic/core/background.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CBomb : public CBackground { -public: +class CBomb : public CBackground, CEnterRoomMsgTarget { +private: int _fieldE0; int _fieldE4; int _fieldE8; @@ -37,8 +38,10 @@ public: int _fieldF4; int _fieldF8; int _fieldFC; - int _field100; + int _startingTicks; int _field104; +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF CBomb(); diff --git a/engines/titanic/game/chicken_cooler.cpp b/engines/titanic/game/chicken_cooler.cpp index 335ed36fb6..54acc405fd 100644 --- a/engines/titanic/game/chicken_cooler.cpp +++ b/engines/titanic/game/chicken_cooler.cpp @@ -40,4 +40,9 @@ void CChickenCooler::load(SimpleFile *file) { CGameObject::load(file); } +bool CChickenCooler::handleEvent(const CEnterRoomMsg &msg) { + warning("CChickenCoolor::handlEvent"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/chicken_cooler.h b/engines/titanic/game/chicken_cooler.h index 9e150572f4..6f75649957 100644 --- a/engines/titanic/game/chicken_cooler.h +++ b/engines/titanic/game/chicken_cooler.h @@ -24,13 +24,16 @@ #define TITANIC_CHICKEN_COOLER_H #include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CChickenCooler : public CGameObject { -public: +class CChickenCooler : public CGameObject, CEnterRoomMsgTarget { +private: int _fieldBC; int _fieldC0; +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF CChickenCooler() : CGameObject(), _fieldBC(0), _fieldC0(0) {} diff --git a/engines/titanic/game/end_sequence_control.cpp b/engines/titanic/game/end_sequence_control.cpp index 1432435a28..f930d61787 100644 --- a/engines/titanic/game/end_sequence_control.cpp +++ b/engines/titanic/game/end_sequence_control.cpp @@ -34,4 +34,9 @@ void CEndSequenceControl::load(SimpleFile *file) { CGameObject::load(file); } +bool CEndSequenceControl::handleEvent(const CEnterRoomMsg &msg) { + warning("TODO: CEndSequenceControl::handleEvent"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/end_sequence_control.h b/engines/titanic/game/end_sequence_control.h index 5e2ba30611..fb1fa3a13c 100644 --- a/engines/titanic/game/end_sequence_control.h +++ b/engines/titanic/game/end_sequence_control.h @@ -24,10 +24,13 @@ #define TITANIC_END_SEQUENCE_CONTROL_H #include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CEndSequenceControl : public CGameObject { +class CEndSequenceControl : public CGameObject, CEnterRoomMsgTarget { +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/fan_noises.cpp b/engines/titanic/game/fan_noises.cpp index ed77dc609f..6627332465 100644 --- a/engines/titanic/game/fan_noises.cpp +++ b/engines/titanic/game/fan_noises.cpp @@ -55,4 +55,9 @@ void CFanNoises::load(SimpleFile *file) { CGameObject::load(file); } +bool CFanNoises::handleEvent(const CEnterRoomMsg &msg) { + warning("CFanNoises::handleEvent"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/fan_noises.h b/engines/titanic/game/fan_noises.h index ba35edcf76..2cd96a33cb 100644 --- a/engines/titanic/game/fan_noises.h +++ b/engines/titanic/game/fan_noises.h @@ -24,11 +24,12 @@ #define TITANIC_FAN_NOISES_H #include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CFanNoises : public CGameObject { -public: +class CFanNoises : public CGameObject, CEnterRoomMsgTarget { +private: int _fieldBC; int _fieldC0; int _fieldC4; @@ -36,6 +37,8 @@ public: int _fieldCC; int _fieldD0; int _fieldD4; +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF CFanNoises(); diff --git a/engines/titanic/game/get_lift_eye2.cpp b/engines/titanic/game/get_lift_eye2.cpp index 472f884d01..bc51f7cabc 100644 --- a/engines/titanic/game/get_lift_eye2.cpp +++ b/engines/titanic/game/get_lift_eye2.cpp @@ -46,4 +46,9 @@ void CGetLiftEye2::load(SimpleFile *file) { CGameObject::load(file); } +bool CGetLiftEye2::handleEvent(const CEnterRoomMsg &msg) { + warning("CGetLiftEye2::handleEvent"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/get_lift_eye2.h b/engines/titanic/game/get_lift_eye2.h index 6782a56f11..d9465b48bc 100644 --- a/engines/titanic/game/get_lift_eye2.h +++ b/engines/titanic/game/get_lift_eye2.h @@ -24,12 +24,14 @@ #define TITANIC_GET_LIFT_EYE2_H #include "titanic/core/game_object.h" - +#include "titanic/messages/messages.h" namespace Titanic { -class CGetLiftEye2 : public CGameObject { +class CGetLiftEye2 : public CGameObject, CEnterRoomMsgTarget { private: static CString *_v1; +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF static void init(); diff --git a/engines/titanic/game/gondolier/gondolier_mixer.cpp b/engines/titanic/game/gondolier/gondolier_mixer.cpp index e81ad34c87..391c513ccc 100644 --- a/engines/titanic/game/gondolier/gondolier_mixer.cpp +++ b/engines/titanic/game/gondolier/gondolier_mixer.cpp @@ -56,4 +56,12 @@ void CGondolierMixer::load(SimpleFile *file) { CGondolierBase::load(file); } +bool CGondolierMixer::handleEvent(const CEnterRoomMsg &msg) { + CTreeItem *parent = getParent(); + if (parent == msg._room) + msg.execute(parent); + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/gondolier/gondolier_mixer.h b/engines/titanic/game/gondolier/gondolier_mixer.h index 173bcd8ac2..ce8959b77a 100644 --- a/engines/titanic/game/gondolier/gondolier_mixer.h +++ b/engines/titanic/game/gondolier/gondolier_mixer.h @@ -24,10 +24,11 @@ #define TITANIC_GONDOLIER_MIXER_H #include "titanic/game/gondolier/gondolier_base.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CGondolierMixer : public CGondolierBase { +class CGondolierMixer : public CGondolierBase, CEnterRoomMsgTarget { private: int _fieldBC; int _fieldC0; @@ -36,6 +37,8 @@ private: CString _string1; CString _string2; int _fieldE4; +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF CGondolierMixer(); diff --git a/engines/titanic/messages/bilge_dispensor_event.cpp b/engines/titanic/messages/bilge_dispensor_event.cpp index 9252d123e9..c4c8375f5d 100644 --- a/engines/titanic/messages/bilge_dispensor_event.cpp +++ b/engines/titanic/messages/bilge_dispensor_event.cpp @@ -34,4 +34,9 @@ void CBilgeDispensorEvent::load(SimpleFile *file) { CAutoSoundEvent::load(file); } +bool CBilgeDispensorEvent::handleEvent(const CEnterRoomMsg &msg) { + _value1 = 0; + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/messages/bilge_dispensor_event.h b/engines/titanic/messages/bilge_dispensor_event.h index fb88a6bd32..4334465c02 100644 --- a/engines/titanic/messages/bilge_dispensor_event.h +++ b/engines/titanic/messages/bilge_dispensor_event.h @@ -24,10 +24,13 @@ #define TITANIC_BILGE_DISPENSOR_EVENT_H #include "titanic/messages/auto_sound_event.h" +#include "titanic/messages/messages.h" namespace Titanic { class CBilgeDispensorEvent : public CAutoSoundEvent { +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/messages/messages.cpp b/engines/titanic/messages/messages.cpp index 1e49994915..00debc562c 100644 --- a/engines/titanic/messages/messages.cpp +++ b/engines/titanic/messages/messages.cpp @@ -38,7 +38,7 @@ void CMessage::load(SimpleFile *file) { CSaveableObject::load(file); } -bool CMessage::execute(CTreeItem *target, const ClassDef *classDef, int flags) { +bool CMessage::execute(CTreeItem *target, const ClassDef *classDef, int flags) const { // If no target was specified, then there's nothing to do if (!target) return false; diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 5331881b85..958275868d 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -46,9 +46,9 @@ public: CMessage(); bool execute(CTreeItem *target, const ClassDef *classDef = nullptr, - int flags = MSGFLAG_SCAN | MSGFLAG_BREAK_IF_HANDLED); + int flags = MSGFLAG_SCAN | MSGFLAG_BREAK_IF_HANDLED) const; - virtual bool perform(CTreeItem *treeItem) { return false; } + virtual bool perform(CTreeItem *treeItem) const { return false; } /** * Save the data for the class to file @@ -64,7 +64,7 @@ public: MSGTARGET(CEditControlMsg); class CEditControlMsg : public CMessage { protected: - virtual bool handleMessage(CEditControlMsg &msg) { return false; } + virtual bool handleMessage(const CEditControlMsg &msg) { return false; } public: int _field4; int _field8; @@ -77,7 +77,7 @@ public: CEditControlMsg() : _field4(0), _field8(0), _field18(0), _field1C(0), _field20(0) {} - virtual bool perform(CTreeItem *treeItem) { + virtual bool perform(CTreeItem *treeItem) const { CEditControlMsg *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } @@ -86,7 +86,7 @@ public: MSGTARGET(CLightsMsg); class CLightsMsg : public CMessage { protected: - virtual bool handleMessage(CLightsMsg &msg) { return false; } + virtual bool handleMessage(const CLightsMsg &msg) { return false; } public: int _field4; int _field8; @@ -97,7 +97,7 @@ public: CLightsMsg() : CMessage(), _field4(0), _field8(0), _fieldC(0), _field10(0) {} - virtual bool perform(CTreeItem *treeItem) { + virtual bool perform(CTreeItem *treeItem) const { CLightsMsg *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } @@ -106,7 +106,7 @@ public: MSGTARGET(CIsHookedOnMsg); class CIsHookedOnMsg : public CMessage { protected: - virtual bool handleMessage(CIsHookedOnMsg &msg) { return false; } + virtual bool handleMessage(const CIsHookedOnMsg &msg) { return false; } public: int _field4; int _field8; @@ -119,7 +119,7 @@ public: CIsHookedOnMsg() : CMessage(), _field4(0), _field8(0), _field18(0), _field1C(0), _field20(0) {} - virtual bool perform(CTreeItem *treeItem) { + virtual bool perform(CTreeItem *treeItem) const { CIsHookedOnMsg *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } @@ -128,7 +128,7 @@ public: MSGTARGET(CSubAcceptCCarryMsg); class CSubAcceptCCarryMsg : public CMessage { protected: - virtual bool handleMessage(CSubAcceptCCarryMsg &msg) { return false; } + virtual bool handleMessage(const CSubAcceptCCarryMsg &msg) { return false; } public: CString _string1; int _value1, _value2, _value3; @@ -136,7 +136,7 @@ public: CLASSDEF CSubAcceptCCarryMsg() : _value1(0), _value2(0), _value3(0) {} - virtual bool perform(CTreeItem *treeItem) { + virtual bool perform(CTreeItem *treeItem) const { CSubAcceptCCarryMsg *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } @@ -145,7 +145,7 @@ public: MSGTARGET(CTransportMsg); class CTransportMsg : public CMessage { protected: - virtual bool handleMessage(CTransportMsg &msg) { return false; } + virtual bool handleMessage(const CTransportMsg &msg) { return false; } public: CString _string; int _value1, _value2; @@ -153,7 +153,7 @@ public: CLASSDEF CTransportMsg() : _value1(0), _value2(0) {} - virtual bool perform(CTreeItem *treeItem) { + virtual bool perform(CTreeItem *treeItem) const { CTransportMsg *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } @@ -163,18 +163,18 @@ public: class NAME: public CMessage { \ public: NAME() : CMessage() {} \ CLASSDEF \ - virtual bool handleMessage(NAME &msg) { return false; } \ - virtual bool perform(CTreeItem *treeItem) { \ + virtual bool handleMessage(const NAME &msg) { return false; } \ + virtual bool perform(CTreeItem *treeItem) const { \ NAME *dest = dynamic_cast(treeItem); \ return dest != nullptr && dest->handleMessage(*this); \ } } #define MESSAGE1(NAME, F1, N1, V1) MSGTARGET(NAME); \ class NAME: public CMessage { \ - public: F1 _N1; \ - NAME() : CMessage(), _N1(V1) {} \ - NAME(F1 N1) : CMessage(), _N1(N1) {} \ + public: F1 _##N1; \ + NAME() : CMessage(), _##N1(V1) {} \ + NAME(F1 N1) : CMessage(), _##N1(N1) {} \ CLASSDEF \ - virtual bool handleMessage(NAME &msg) { return false; } \ + virtual bool handleMessage(const NAME &msg) { return false; } \ virtual bool perform(CTreeItem *treeItem) { \ NAME *dest = dynamic_cast(treeItem); \ return dest != nullptr && dest->handleMessage(*this); \ @@ -185,7 +185,7 @@ public: NAME() : CMessage(), _N1(V1), _N2(V2) {} \ NAME(F1 N1, F2 N2) : CMessage(), _N1(N1), _N2(N2) {} \ CLASSDEF \ - virtual bool handleMessage(NAME &msg) { return false; } \ + virtual bool handleMessage(const NAME &msg) { return false; } \ virtual bool perform(CTreeItem *treeItem) { \ NAME *dest = dynamic_cast(treeItem); \ return dest != nullptr && dest->handleMessage(*this); \ @@ -196,7 +196,7 @@ public: NAME() : CMessage(), _N1(V1), _N2(V2), _N3(V3) {} \ NAME(F1 N1, F2 N2, F3 N3) : CMessage(), _N1(N1), _N2(N2), _N3(N3) {} \ CLASSDEF \ - virtual bool handleMessage(NAME &msg) { return false; } \ + virtual bool handleMessage(const NAME &msg) { return false; } \ virtual bool perform(CTreeItem *treeItem) { \ NAME *dest = dynamic_cast(treeItem); \ return dest != nullptr && dest->handleMessage(*this); \ @@ -207,7 +207,7 @@ public: NAME() : CMessage(), _N1(V1), _N2(V2), _N3(V3), _N4(V4) {} \ NAME(F1 N1, F2 N2, F3 N3, F4 N4) : CMessage(), _N1(N1), _N2(N2), _N3(N3), _N4(N4) {} \ CLASSDEF \ - virtual bool handleMessage(NAME &msg) { return false; } \ + virtual bool handleMessage(const NAME &msg) { return false; } \ virtual bool perform(CTreeItem *treeItem) { \ NAME *dest = dynamic_cast(treeItem); \ return dest != nullptr && dest->handleMessage(*this); \ diff --git a/engines/titanic/messages/mouse_messages.h b/engines/titanic/messages/mouse_messages.h index 79c45afcfa..0386eb6bd9 100644 --- a/engines/titanic/messages/mouse_messages.h +++ b/engines/titanic/messages/mouse_messages.h @@ -41,7 +41,7 @@ class CMouseMoveMsg : public CMouseMsg { public: CLASSDEF - virtual bool handleMessage(CMouseMoveMsg &msg) { return false; } + virtual bool handleMessage(const CMouseMoveMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { CMouseMoveMsg *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); @@ -61,7 +61,7 @@ class CMouseButtonDownMsg : public CMouseButtonMsg { public: CLASSDEF - virtual bool handleMessage(CMouseButtonDownMsg &msg) { return false; } + virtual bool handleMessage(const CMouseButtonDownMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { CMouseButtonDownMsg *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); @@ -73,7 +73,7 @@ class CMouseButtonUpMsg : public CMouseButtonMsg { public: CLASSDEF - virtual bool handleMessage(CMouseButtonUpMsg &msg) { return false; } + virtual bool handleMessage(const CMouseButtonUpMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { CMouseButtonUpMsg *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); @@ -85,7 +85,7 @@ class CMouseButtonDoubleClickMsg : public CMouseButtonMsg { public: CLASSDEF - virtual bool handleMessage(CMouseButtonDoubleClickMsg &msg) { return false; } + virtual bool handleMessage(const CMouseButtonDoubleClickMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { CMouseButtonDoubleClickMsg *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); @@ -101,7 +101,7 @@ class CMouseDragMoveMsg : public CMouseDragMsg { public: CLASSDEF - virtual bool handleMessage(CMouseDragMoveMsg &msg) { return false; } + virtual bool handleMessage(const CMouseDragMoveMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { CMouseDragMoveMsg *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); @@ -117,7 +117,7 @@ public: CLASSDEF CMouseDragStartMsg() : CMouseDragMsg(), _field10(0), _field14(0) {} - virtual bool handleMessage(CMouseDragStartMsg &msg) { return false; } + virtual bool handleMessage(const CMouseDragStartMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { CMouseDragStartMsg *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); @@ -132,7 +132,7 @@ public: CLASSDEF CMouseDragEndMsg() : CMouseDragMsg(), _field10(0) {} - virtual bool handleMessage(CMouseDragEndMsg &msg) { return false; } + virtual bool handleMessage(const CMouseDragEndMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { CMouseDragEndMsg *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); diff --git a/engines/titanic/moves/enter_bridge.cpp b/engines/titanic/moves/enter_bridge.cpp index a1e0b7e489..6f8ba4cd41 100644 --- a/engines/titanic/moves/enter_bridge.cpp +++ b/engines/titanic/moves/enter_bridge.cpp @@ -36,4 +36,9 @@ void CEnterBridge::load(SimpleFile *file) { CGameObject::load(file); } +bool CEnterBridge::handleEvent(const CEnterRoomMsg &msg) { + warning("CEnterBridge::handlEvent"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/moves/enter_bridge.h b/engines/titanic/moves/enter_bridge.h index 6a6e7161dd..3685bed8a1 100644 --- a/engines/titanic/moves/enter_bridge.h +++ b/engines/titanic/moves/enter_bridge.h @@ -24,12 +24,15 @@ #define TITANIC_ENTER_BRIDGE_H #include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CEnterBridge : public CGameObject { -public: +class CEnterBridge : public CGameObject, CEnterRoomMsgTarget { +private: int _value; +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF CEnterBridge() : CGameObject(), _value(1) {} diff --git a/engines/titanic/npcs/barbot.cpp b/engines/titanic/npcs/barbot.cpp index a460bdb672..c9a96b989b 100644 --- a/engines/titanic/npcs/barbot.cpp +++ b/engines/titanic/npcs/barbot.cpp @@ -233,4 +233,9 @@ void CBarbot::load(SimpleFile *file) { CTrueTalkNPC::load(file); } +bool CBarbot::handleEvent(const CEnterRoomMsg &msg) { + warning("TODO: Barbot::CEnterRoomMsg"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/npcs/barbot.h b/engines/titanic/npcs/barbot.h index 7e2d323d46..160edd63d9 100644 --- a/engines/titanic/npcs/barbot.h +++ b/engines/titanic/npcs/barbot.h @@ -24,10 +24,11 @@ #define TITANIC_BARBOT_H #include "titanic/npcs/true_talk_npc.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CBarbot : public CTrueTalkNPC { +class CBarbot : public CTrueTalkNPC, CEnterRoomMsgTarget { private: static int _v0; private: @@ -172,6 +173,8 @@ private: int _field338; int _field33C; int _field340; +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF CBarbot(); diff --git a/engines/titanic/sound/auto_music_player.cpp b/engines/titanic/sound/auto_music_player.cpp index 2040bfc20a..97c59d075d 100644 --- a/engines/titanic/sound/auto_music_player.cpp +++ b/engines/titanic/sound/auto_music_player.cpp @@ -41,4 +41,12 @@ void CAutoMusicPlayer::load(SimpleFile *file) { CAutoMusicPlayerBase::load(file); } +bool CAutoMusicPlayer::handleEvent(const CEnterRoomMsg &msg) { + if (!_fieldCC) { + warning("TODO"); + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/sound/auto_music_player.h b/engines/titanic/sound/auto_music_player.h index cec8117dd9..6fdf3766c6 100644 --- a/engines/titanic/sound/auto_music_player.h +++ b/engines/titanic/sound/auto_music_player.h @@ -24,12 +24,15 @@ #define TITANIC_AUTO_MUSIC_PLAYER_H #include "titanic/sound/auto_music_player_base.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CAutoMusicPlayer : public CAutoMusicPlayerBase { +class CAutoMusicPlayer : public CAutoMusicPlayerBase, CEnterRoomMsgTarget { private: CString _string2; +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF CAutoMusicPlayer(); diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index a9d0cc9421..e7bbd84c34 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -44,7 +44,8 @@ namespace Titanic { TitanicEngine *g_vm; TitanicEngine::TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc) - : _gameDescription(gameDesc), Engine(syst) { + : _gameDescription(gameDesc), Engine(syst), _randomSource("Titanic"), + _ticksCount(0), _frameCounter(0) { g_vm = this; _window = nullptr; _screenManager = nullptr; diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index 112d6d63c1..c5c642629f 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -24,6 +24,7 @@ #define TITANIC_TITANIC_H #include "common/scummsys.h" +#include "common/random.h" #include "common/system.h" #include "common/serializer.h" #include "engines/advancedDetector.h" @@ -98,6 +99,9 @@ public: CFilesManager _filesManager; OSScreenManager *_screenManager; CMainGameWindow *_window; + Common::RandomSource _randomSource; + uint _frameCounter; + uint _ticksCount; public: TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc); virtual ~TitanicEngine(); -- cgit v1.2.3 From 12ae5e10f3a20b1b909a6ec40257e39e063b78c5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 17 Mar 2016 20:55:32 -0400 Subject: TITANIC: Added stubbed CEnterRoomMsg event handlers as needed --- engines/titanic/core/saveable_object.cpp | 3 ++ engines/titanic/game/light.cpp | 5 +++ engines/titanic/game/light.h | 5 ++- engines/titanic/game/light_switch.cpp | 5 +++ engines/titanic/game/light_switch.h | 5 ++- engines/titanic/game/long_stick_dispenser.cpp | 6 +++ engines/titanic/game/long_stick_dispenser.h | 5 ++- .../titanic/game/parrot/player_meets_parrot.cpp | 5 +++ engines/titanic/game/parrot/player_meets_parrot.h | 5 ++- engines/titanic/game/pet/pet_monitor.cpp | 5 +++ engines/titanic/game/pet/pet_monitor.h | 5 ++- engines/titanic/game/pet/pet_position.cpp | 5 +++ engines/titanic/game/pet/pet_position.h | 5 ++- engines/titanic/game/pet/pet_transport.cpp | 5 +++ engines/titanic/game/pet/pet_transport.h | 5 ++- engines/titanic/game/phonograph.cpp | 5 +++ engines/titanic/game/phonograph.h | 5 ++- engines/titanic/game/sgt/sgt_state_room.cpp | 5 +++ engines/titanic/game/sgt/sgt_state_room.h | 5 ++- engines/titanic/game/ship_setting.cpp | 5 +++ engines/titanic/game/ship_setting.h | 7 ++- engines/titanic/game/transport/lift.cpp | 5 +++ engines/titanic/game/transport/lift.h | 5 ++- engines/titanic/game/transport/lift_indicator.h | 5 ++- engines/titanic/game/transport/pellerator.cpp | 5 +++ engines/titanic/game/transport/pellerator.h | 5 ++- engines/titanic/game/up_lighter.cpp | 5 +++ engines/titanic/game/up_lighter.h | 5 ++- engines/titanic/module.mk | 1 + engines/titanic/npcs/liftbot.cpp | 5 +++ engines/titanic/npcs/liftbot.h | 5 ++- engines/titanic/sound/music_player.cpp | 5 +++ engines/titanic/sound/music_player.h | 7 ++- .../titanic/sound/restricted_auto_music_player.cpp | 5 +++ .../titanic/sound/restricted_auto_music_player.h | 5 ++- engines/titanic/sound/room_auto_sound_player.cpp | 5 +++ engines/titanic/sound/room_auto_sound_player.h | 5 ++- .../sound/room_trigger_auto_music_player.cpp | 42 ++++++++++++++++++ .../titanic/sound/room_trigger_auto_music_player.h | 50 ++++++++++++++++++++++ engines/titanic/sound/titania_speech.cpp | 5 +++ engines/titanic/sound/titania_speech.h | 5 ++- 41 files changed, 265 insertions(+), 21 deletions(-) create mode 100644 engines/titanic/sound/room_trigger_auto_music_player.cpp create mode 100644 engines/titanic/sound/room_trigger_auto_music_player.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 3144e60c97..e833a056ac 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -396,6 +396,7 @@ #include "titanic/sound/node_auto_sound_player.h" #include "titanic/sound/restricted_auto_music_player.h" #include "titanic/sound/room_auto_sound_player.h" +#include "titanic/sound/room_trigger_auto_music_player.h" #include "titanic/sound/season_noises.h" #include "titanic/sound/seasonal_music_player.h" #include "titanic/sound/titania_speech.h" @@ -979,6 +980,7 @@ DEFFN(CMusicPlayer) DEFFN(CNodeAutoSoundPlayer) DEFFN(CRestrictedAutoMusicPlayer) DEFFN(CRoomAutoSoundPlayer) +DEFFN(CRoomTriggerAutoMusicPlayer); DEFFN(CSeasonNoises) DEFFN(CSeasonalMusicPlayer) DEFFN(CTitaniaSpeech) @@ -1550,6 +1552,7 @@ void CSaveableObject::initClassList() { ADDFN(CNodeAutoSoundPlayer, CAutoSoundPlayer); ADDFN(CRestrictedAutoMusicPlayer, CAutoMusicPlayer); ADDFN(CRoomAutoSoundPlayer, CAutoSoundPlayer); + ADDFN(CRoomTriggerAutoMusicPlayer, CTriggerAutoMusicPlayer); ADDFN(CSeasonNoises, CViewAutoSoundPlayer); ADDFN(CSeasonalMusicPlayer, CAutoMusicPlayerBase); ADDFN(CAutoMusicPlayer, CAutoMusicPlayerBase); diff --git a/engines/titanic/game/light.cpp b/engines/titanic/game/light.cpp index 4f5a492f2f..7a24391b0e 100644 --- a/engines/titanic/game/light.cpp +++ b/engines/titanic/game/light.cpp @@ -57,4 +57,9 @@ void CLight::load(SimpleFile *file) { CBackground::load(file); } +bool CLight::handleEvent(const CEnterRoomMsg &msg) { + warning("CLight::handleEvent"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/light.h b/engines/titanic/game/light.h index ea6073d038..650e6ba87e 100644 --- a/engines/titanic/game/light.h +++ b/engines/titanic/game/light.h @@ -24,10 +24,11 @@ #define TITANIC_LIGHT_H #include "titanic/core/background.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CLight : public CBackground { +class CLight : public CBackground, CEnterRoomMsgTarget { private: int _fieldE0; int _fieldE4; @@ -37,6 +38,8 @@ private: int _fieldF4; int _fieldF8; int _fieldFC; +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF CLight(); diff --git a/engines/titanic/game/light_switch.cpp b/engines/titanic/game/light_switch.cpp index 605fab37f8..5e1b94ac18 100644 --- a/engines/titanic/game/light_switch.cpp +++ b/engines/titanic/game/light_switch.cpp @@ -50,4 +50,9 @@ void CLightSwitch::load(SimpleFile *file) { CBackground::load(file); } +bool CLightSwitch::handleEvent(const CEnterRoomMsg &msg) { + warning("CLightSwitch::handleEvent"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/light_switch.h b/engines/titanic/game/light_switch.h index 334cba75a6..fd2c392d13 100644 --- a/engines/titanic/game/light_switch.h +++ b/engines/titanic/game/light_switch.h @@ -24,16 +24,19 @@ #define TITANIC_LIGHT_SWITCH_H #include "titanic/core/background.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CLightSwitch : public CBackground { +class CLightSwitch : public CBackground, CEnterRoomMsgTarget { public: static int _v1; private: int _fieldE0; int _fieldE4; int _fieldE8; +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF CLightSwitch(); diff --git a/engines/titanic/game/long_stick_dispenser.cpp b/engines/titanic/game/long_stick_dispenser.cpp index 97981cc01d..237c1f6112 100644 --- a/engines/titanic/game/long_stick_dispenser.cpp +++ b/engines/titanic/game/long_stick_dispenser.cpp @@ -42,4 +42,10 @@ void CLongStickDispenser::load(SimpleFile *file) { CGameObject::load(file); } +bool CLongStickDispenser::handleEvent(const CEnterRoomMsg &msg) { + _fieldC0 = 0; + _fieldC4 = 1; + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/long_stick_dispenser.h b/engines/titanic/game/long_stick_dispenser.h index 30e3541087..75ada29a96 100644 --- a/engines/titanic/game/long_stick_dispenser.h +++ b/engines/titanic/game/long_stick_dispenser.h @@ -24,14 +24,17 @@ #define TITANIC_LONG_STICK_DISPENSER_H #include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" namespace Titanic { class CLongStickDispenser : public CGameObject { -public: +private: int _fieldBC; int _fieldC0; int _fieldC4; +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF CLongStickDispenser() : CGameObject(), _fieldBC(0), diff --git a/engines/titanic/game/parrot/player_meets_parrot.cpp b/engines/titanic/game/parrot/player_meets_parrot.cpp index 1d7bd657ac..70628b345a 100644 --- a/engines/titanic/game/parrot/player_meets_parrot.cpp +++ b/engines/titanic/game/parrot/player_meets_parrot.cpp @@ -34,4 +34,9 @@ void CPlayerMeetsParrot::load(SimpleFile *file) { CGameObject::load(file); } +bool CPlayerMeetsParrot::handleEvent(const CEnterRoomMsg &msg) { + warning("CPlayerMeetsParrot::handleEvent"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/parrot/player_meets_parrot.h b/engines/titanic/game/parrot/player_meets_parrot.h index d0c3b9d9f3..8572fd701d 100644 --- a/engines/titanic/game/parrot/player_meets_parrot.h +++ b/engines/titanic/game/parrot/player_meets_parrot.h @@ -24,10 +24,13 @@ #define TITANIC_PLAYER_MEETS_PARROT_H #include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CPlayerMeetsParrot : public CGameObject { +class CPlayerMeetsParrot : public CGameObject, CEnterRoomMsgTarget { +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/pet/pet_monitor.cpp b/engines/titanic/game/pet/pet_monitor.cpp index 534fb3fb03..649ac978e9 100644 --- a/engines/titanic/game/pet/pet_monitor.cpp +++ b/engines/titanic/game/pet/pet_monitor.cpp @@ -34,4 +34,9 @@ void CPETMonitor::load(SimpleFile *file) { CGameObject::load(file); } +bool CPETMonitor::handleEvent(const CEnterRoomMsg &msg) { + warning("CPETMonitor::handleEvent"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_monitor.h b/engines/titanic/game/pet/pet_monitor.h index ff2209802d..97961ee929 100644 --- a/engines/titanic/game/pet/pet_monitor.h +++ b/engines/titanic/game/pet/pet_monitor.h @@ -24,10 +24,13 @@ #define TITANIC_PET_MONITOR_H #include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CPETMonitor : public CGameObject { +class CPETMonitor : public CGameObject, CEnterRoomMsgTarget { +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/pet/pet_position.cpp b/engines/titanic/game/pet/pet_position.cpp index 80ccec74cd..aafc21beb2 100644 --- a/engines/titanic/game/pet/pet_position.cpp +++ b/engines/titanic/game/pet/pet_position.cpp @@ -34,4 +34,9 @@ void CPETPosition::load(SimpleFile *file) { CGameObject::load(file); } +bool CPETPosition::handleEvent(const CEnterRoomMsg &msg) { + warning("CPETPosition::handleEvent"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_position.h b/engines/titanic/game/pet/pet_position.h index 407a42f0ae..d72f42ca3a 100644 --- a/engines/titanic/game/pet/pet_position.h +++ b/engines/titanic/game/pet/pet_position.h @@ -24,10 +24,13 @@ #define TITANIC_PET_POSITION_H #include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CPETPosition : public CGameObject { +class CPETPosition : public CGameObject, CEnterRoomMsgTarget { +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/pet/pet_transport.cpp b/engines/titanic/game/pet/pet_transport.cpp index 037e0b3278..40cc155c5b 100644 --- a/engines/titanic/game/pet/pet_transport.cpp +++ b/engines/titanic/game/pet/pet_transport.cpp @@ -34,4 +34,9 @@ void CPETTransport::load(SimpleFile *file) { CGameObject::load(file); } +bool CPETTransport::handleEvent(const CEnterRoomMsg &msg) { + warning("CPETTransport::handleEvent"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_transport.h b/engines/titanic/game/pet/pet_transport.h index 1aa6df8ced..1eb48322e2 100644 --- a/engines/titanic/game/pet/pet_transport.h +++ b/engines/titanic/game/pet/pet_transport.h @@ -24,10 +24,13 @@ #define TITANIC_PET_TRANSPORT_H #include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CPETTransport : public CGameObject { +class CPETTransport : public CGameObject, CEnterRoomMsgTarget { +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/phonograph.cpp b/engines/titanic/game/phonograph.cpp index 3461e34cb6..2ff8ca99bb 100644 --- a/engines/titanic/game/phonograph.cpp +++ b/engines/titanic/game/phonograph.cpp @@ -55,4 +55,9 @@ void CPhonograph::load(SimpleFile *file) { CMusicPlayer::load(file); } +bool CPhonograph::handleEvent(const CEnterRoomMsg &msg) { + warning("CPhonograph::handleEvent"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/phonograph.h b/engines/titanic/game/phonograph.h index 14712e5c1b..3ba2d1ce87 100644 --- a/engines/titanic/game/phonograph.h +++ b/engines/titanic/game/phonograph.h @@ -24,10 +24,11 @@ #define TITANIC_PHONOGRAPH_H #include "titanic/sound/music_player.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CPhonograph : public CMusicPlayer { +class CPhonograph : public CMusicPlayer, CEnterRoomMsgTarget { protected: CString _string2; int _fieldE0; @@ -36,6 +37,8 @@ protected: int _fieldEC; int _fieldF0; int _fieldF4; +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF CPhonograph(); diff --git a/engines/titanic/game/sgt/sgt_state_room.cpp b/engines/titanic/game/sgt/sgt_state_room.cpp index e0d8de1282..a6dc523bcf 100644 --- a/engines/titanic/game/sgt/sgt_state_room.cpp +++ b/engines/titanic/game/sgt/sgt_state_room.cpp @@ -90,4 +90,9 @@ void CSGTStateRoom::load(SimpleFile *file) { CBackground::load(file); } +bool CSGTStateRoom::handleEvent(const CEnterRoomMsg &msg) { + warning("CSGTStateRoom::handleEvent"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/sgt/sgt_state_room.h b/engines/titanic/game/sgt/sgt_state_room.h index dfac6894b9..dbe4538ced 100644 --- a/engines/titanic/game/sgt/sgt_state_room.h +++ b/engines/titanic/game/sgt/sgt_state_room.h @@ -24,6 +24,7 @@ #define TITANIC_SGT_STATE_ROOM_H #include "titanic/core/background.h" +#include "titanic/messages/messages.h" namespace Titanic { @@ -44,7 +45,7 @@ struct CSGTStateRoomStatics { int _v14; }; -class CSGTStateRoom : public CBackground { +class CSGTStateRoom : public CBackground, CEnterRoomMsgTarget { private: static CSGTStateRoomStatics *_statics; private: @@ -53,6 +54,8 @@ private: int _fieldE8; int _fieldEC; int _fieldF0; +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF CSGTStateRoom(); diff --git a/engines/titanic/game/ship_setting.cpp b/engines/titanic/game/ship_setting.cpp index d53c5289e6..7a3951df71 100644 --- a/engines/titanic/game/ship_setting.cpp +++ b/engines/titanic/game/ship_setting.cpp @@ -48,4 +48,9 @@ void CShipSetting::load(SimpleFile *file) { CBackground::load(file); } +bool CShipSetting::handleEvent(const CEnterRoomMsg &msg) { + warning("CShipSetting::handleEvent"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/ship_setting.h b/engines/titanic/game/ship_setting.h index a3b5d5f511..30780fd3d7 100644 --- a/engines/titanic/game/ship_setting.h +++ b/engines/titanic/game/ship_setting.h @@ -24,15 +24,18 @@ #define TITANIC_SHIP_SETTING_H #include "titanic/core/background.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CShipSetting : public CBackground { -public: +class CShipSetting : public CBackground, CEnterRoomMsgTarget { +private: CString _string3; Common::Point _pos1; CString _string4; CString _string5; +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF CShipSetting(); diff --git a/engines/titanic/game/transport/lift.cpp b/engines/titanic/game/transport/lift.cpp index 1e21b9f582..22201291aa 100644 --- a/engines/titanic/game/transport/lift.cpp +++ b/engines/titanic/game/transport/lift.cpp @@ -57,4 +57,9 @@ void CLift::load(SimpleFile *file) { CTransport::load(file); } +bool CLift::handleEvent(const CEnterRoomMsg &msg) { + warning("CLift::handleEvent"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/transport/lift.h b/engines/titanic/game/transport/lift.h index b1cd48960e..42a340c61f 100644 --- a/engines/titanic/game/transport/lift.h +++ b/engines/titanic/game/transport/lift.h @@ -24,10 +24,11 @@ #define TITANIC_LIFT_H #include "titanic/game/transport/transport.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CLift : public CTransport { +class CLift : public CTransport, CEnterRoomMsgTarget { private: static int _v1; static int _v2; @@ -37,6 +38,8 @@ private: static int _v6; int _fieldF8; +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF CLift() : CTransport(), _fieldF8(1) {} diff --git a/engines/titanic/game/transport/lift_indicator.h b/engines/titanic/game/transport/lift_indicator.h index 2fe6e1a61e..de913c56a5 100644 --- a/engines/titanic/game/transport/lift_indicator.h +++ b/engines/titanic/game/transport/lift_indicator.h @@ -24,15 +24,18 @@ #define TITANIC_LIFT_INDICATOR_H #include "titanic/game/transport/lift.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CLiftindicator : public CLift { +class CLiftindicator : public CLift, CEnterRoomMsgTarget { private: int _fieldFC; Common::Point _pos2; int _field108; int _field10C; +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg) { return true; } public: CLASSDEF CLiftindicator(); diff --git a/engines/titanic/game/transport/pellerator.cpp b/engines/titanic/game/transport/pellerator.cpp index 400214a140..99c4db3160 100644 --- a/engines/titanic/game/transport/pellerator.cpp +++ b/engines/titanic/game/transport/pellerator.cpp @@ -43,4 +43,9 @@ void CPellerator::load(SimpleFile *file) { CTransport::load(file); } +bool CPellerator::handleEvent(const CEnterRoomMsg &msg) { + warning("CPellerator::handleEvent"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/transport/pellerator.h b/engines/titanic/game/transport/pellerator.h index e72cbb4b9d..502af2430a 100644 --- a/engines/titanic/game/transport/pellerator.h +++ b/engines/titanic/game/transport/pellerator.h @@ -24,13 +24,16 @@ #define TITANIC_PELLERATOR_H #include "titanic/game/transport/transport.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CPellerator : public CTransport { +class CPellerator : public CTransport, CEnterRoomMsgTarget { private: static int _v1; static int _v2; +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/up_lighter.cpp b/engines/titanic/game/up_lighter.cpp index 0e6c4d88cc..beb159f967 100644 --- a/engines/titanic/game/up_lighter.cpp +++ b/engines/titanic/game/up_lighter.cpp @@ -48,4 +48,9 @@ void CUpLighter::load(SimpleFile *file) { CDropTarget::load(file); } +bool CUpLighter::handleEvent(const CEnterRoomMsg &msg) { + warning("CUpLighter::handleEvent"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/up_lighter.h b/engines/titanic/game/up_lighter.h index e24e712c1c..15fa14c16a 100644 --- a/engines/titanic/game/up_lighter.h +++ b/engines/titanic/game/up_lighter.h @@ -24,15 +24,18 @@ #define TITANIC_UP_LIGHTER_H #include "titanic/core/drop_target.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CUpLighter : public CDropTarget { +class CUpLighter : public CDropTarget, CEnterRoomMsgTarget { private: int _field118; int _field11C; int _field120; int _field124; +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF CUpLighter(); diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index ec55392833..23ac75056d 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -403,6 +403,7 @@ MODULE_OBJS := \ sound/node_auto_sound_player.o \ sound/restricted_auto_music_player.o \ sound/room_auto_sound_player.o \ + sound/room_trigger_auto_music_player.o \ sound/season_noises.o \ sound/seasonal_music_player.o \ sound/sound.o \ diff --git a/engines/titanic/npcs/liftbot.cpp b/engines/titanic/npcs/liftbot.cpp index 3a0040ddca..76a48f07d1 100644 --- a/engines/titanic/npcs/liftbot.cpp +++ b/engines/titanic/npcs/liftbot.cpp @@ -48,4 +48,9 @@ void CLiftBot::load(SimpleFile *file) { CTrueTalkNPC::load(file); } +bool CLiftBot::handleEvent(const CEnterRoomMsg &msg) { + warning("CLiftBot::handleEvent"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/npcs/liftbot.h b/engines/titanic/npcs/liftbot.h index 27556ed942..81c5399e7f 100644 --- a/engines/titanic/npcs/liftbot.h +++ b/engines/titanic/npcs/liftbot.h @@ -24,15 +24,18 @@ #define TITANIC_LIFTBOT_H #include "titanic/npcs/true_talk_npc.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CLiftBot : public CTrueTalkNPC { +class CLiftBot : public CTrueTalkNPC, CEnterRoomMsgTarget { private: static int _v1; static int _v2; private: int _field108; +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF CLiftBot(); diff --git a/engines/titanic/sound/music_player.cpp b/engines/titanic/sound/music_player.cpp index 6bab2d91dc..e2299e6297 100644 --- a/engines/titanic/sound/music_player.cpp +++ b/engines/titanic/sound/music_player.cpp @@ -44,4 +44,9 @@ void CMusicPlayer::load(SimpleFile *file) { CGameObject::load(file); } +bool CMusicPlayer::handleEvent(const CEnterRoomMsg &msg) { + warning("TODO: CMusicPlayer::handleEvent"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/sound/music_player.h b/engines/titanic/sound/music_player.h index 0a750cc538..1796a25d4b 100644 --- a/engines/titanic/sound/music_player.h +++ b/engines/titanic/sound/music_player.h @@ -24,15 +24,18 @@ #define TITANIC_MUSIC_PLAYER_H #include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CMusicPlayer : public CGameObject { -public: +class CMusicPlayer : public CGameObject, CEnterRoomMsgTarget { +protected: int _fieldBC; CString _string1; int _fieldCC; int _fieldD0; +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF CMusicPlayer() : CGameObject(), diff --git a/engines/titanic/sound/restricted_auto_music_player.cpp b/engines/titanic/sound/restricted_auto_music_player.cpp index 442dc90ce2..a57769bf25 100644 --- a/engines/titanic/sound/restricted_auto_music_player.cpp +++ b/engines/titanic/sound/restricted_auto_music_player.cpp @@ -44,4 +44,9 @@ void CRestrictedAutoMusicPlayer::load(SimpleFile *file) { CAutoMusicPlayer::load(file); } +bool CRestrictedAutoMusicPlayer::handleEvent(const CEnterRoomMsg &msg) { + warning("CRestrictedAutoMusicPlayer::handleEvent"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/sound/restricted_auto_music_player.h b/engines/titanic/sound/restricted_auto_music_player.h index cb6220cbc7..60dcc6809d 100644 --- a/engines/titanic/sound/restricted_auto_music_player.h +++ b/engines/titanic/sound/restricted_auto_music_player.h @@ -24,15 +24,18 @@ #define TITANIC_RESTRICTED_AUTO_MUSIC_PLAYER_H #include "titanic/sound/auto_music_player.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CRestrictedAutoMusicPlayer : public CAutoMusicPlayer { +class CRestrictedAutoMusicPlayer : public CAutoMusicPlayer, CEnterRoomMsgTarget { private: CString _string3; CString _string4; CString _string5; CString _string6; +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/sound/room_auto_sound_player.cpp b/engines/titanic/sound/room_auto_sound_player.cpp index 8c54726afc..b8557aaa81 100644 --- a/engines/titanic/sound/room_auto_sound_player.cpp +++ b/engines/titanic/sound/room_auto_sound_player.cpp @@ -34,4 +34,9 @@ void CRoomAutoSoundPlayer::load(SimpleFile *file) { CAutoSoundPlayer::load(file); } +bool CRoomAutoSoundPlayer::handleEvent(const CEnterRoomMsg &msg) { + warning("CRoomAutoSoundPlayer::handleEvent"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/sound/room_auto_sound_player.h b/engines/titanic/sound/room_auto_sound_player.h index ebee0165f6..bda9727a0f 100644 --- a/engines/titanic/sound/room_auto_sound_player.h +++ b/engines/titanic/sound/room_auto_sound_player.h @@ -24,10 +24,13 @@ #define TITANIC_ROOM_AUTO_SOUND_PLAYER_H #include "titanic/sound/auto_sound_player.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CRoomAutoSoundPlayer : public CAutoSoundPlayer { +class CRoomAutoSoundPlayer : public CAutoSoundPlayer, CEnterRoomMsgTarget { +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/sound/room_trigger_auto_music_player.cpp b/engines/titanic/sound/room_trigger_auto_music_player.cpp new file mode 100644 index 0000000000..9e4da684d9 --- /dev/null +++ b/engines/titanic/sound/room_trigger_auto_music_player.cpp @@ -0,0 +1,42 @@ +/* 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 "titanic/sound/room_trigger_auto_music_player.h" + +namespace Titanic { + +void CRoomTriggerAutoMusicPlayer::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CTriggerAutoMusicPlayer::save(file, indent); +} + +void CRoomTriggerAutoMusicPlayer::load(SimpleFile *file) { + file->readNumber(); + CTriggerAutoMusicPlayer::load(file); +} + +bool CRoomTriggerAutoMusicPlayer::handleEvent(const CEnterRoomMsg &msg) { + warning("CRoomTriggerAutoMusicPlayer::handleEvent"); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/sound/room_trigger_auto_music_player.h b/engines/titanic/sound/room_trigger_auto_music_player.h new file mode 100644 index 0000000000..1915f92de1 --- /dev/null +++ b/engines/titanic/sound/room_trigger_auto_music_player.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_ROOM_TRIGGER_AUTO_MUSIC_PLAYER_H +#define TITANIC_ROOM_TRIGGER_AUTO_MUSIC_PLAYER_H + +#include "titanic/sound/trigger_auto_music_player.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +class CRoomTriggerAutoMusicPlayer : public CTriggerAutoMusicPlayer, CEnterRoomMsgTarget { +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); +public: + CLASSDEF + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ROOM_TRIGGER_AUTO_MUSIC_PLAYER_H */ diff --git a/engines/titanic/sound/titania_speech.cpp b/engines/titanic/sound/titania_speech.cpp index fac166901f..87ab18a2cb 100644 --- a/engines/titanic/sound/titania_speech.cpp +++ b/engines/titanic/sound/titania_speech.cpp @@ -40,4 +40,9 @@ void CTitaniaSpeech::load(SimpleFile *file) { CGameObject::load(file); } +bool CTitaniaSpeech::handleEvent(const CEnterRoomMsg &msg) { + warning("CTitaniaSpeech::handleEvent"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/sound/titania_speech.h b/engines/titanic/sound/titania_speech.h index fc55c20af5..a981029c7d 100644 --- a/engines/titanic/sound/titania_speech.h +++ b/engines/titanic/sound/titania_speech.h @@ -24,12 +24,15 @@ #define TITANIC_TITANIA_SPEECH_H #include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" namespace Titanic { class CTitaniaSpeech : public CGameObject { -public: +private: int _value1, _value2; +protected: + virtual bool handleEvent(const CEnterRoomMsg &msg); public: CLASSDEF CTitaniaSpeech() : CGameObject(), _value1(1), _value2(0) {} -- cgit v1.2.3 From 13a8e5f822a9a77c5bee1d7f60adfdb32decfb1d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 17 Mar 2016 22:29:16 -0400 Subject: TITANIC: Implement debugger with dump and room commands --- engines/titanic/core/tree_item.cpp | 4 +- engines/titanic/debugger.cpp | 175 +++++++++++++++++++++++++++++++++++++ engines/titanic/debugger.h | 91 +++++++++++++++++++ engines/titanic/module.mk | 1 + engines/titanic/titanic.cpp | 25 +++++- engines/titanic/titanic.h | 2 + 6 files changed, 293 insertions(+), 5 deletions(-) create mode 100644 engines/titanic/debugger.cpp create mode 100644 engines/titanic/debugger.h diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index b476777d90..39c3fe1f10 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -238,7 +238,7 @@ CNamedItem *CTreeItem::findByName(const CString &name, int maxLen) { CString nameLower = name; nameLower.toLowercase(); - for (CTreeItem *treeItem = this; treeItem; treeItem = scan(treeItem)) { + for (CTreeItem *treeItem = this; treeItem; treeItem = treeItem->scan(this)) { CString nodeName = treeItem->getName(); nodeName.toLowercase(); @@ -246,7 +246,7 @@ CNamedItem *CTreeItem::findByName(const CString &name, int maxLen) { if (nodeName.left(maxLen).compareTo(nameLower)) return dynamic_cast(treeItem); } else { - if (nodeName.compareTo(nameLower)) + if (!nodeName.compareTo(nameLower)) return dynamic_cast(treeItem); } } diff --git a/engines/titanic/debugger.cpp b/engines/titanic/debugger.cpp new file mode 100644 index 0000000000..b759b12846 --- /dev/null +++ b/engines/titanic/debugger.cpp @@ -0,0 +1,175 @@ +/* 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 "titanic/debugger.h" +#include "titanic/titanic.h" +#include "titanic/core/tree_item.h" + +namespace Titanic { + +Debugger::Debugger(TitanicEngine *vm) : GUI::Debugger(), _vm(vm) { + registerCmd("continue", WRAP_METHOD(Debugger, cmdExit)); + registerCmd("dump", WRAP_METHOD(Debugger, cmdDump)); + registerCmd("room", WRAP_METHOD(Debugger, cmdRoom)); +} + +int Debugger::strToInt(const char *s) { + if (!*s) + // No string at all + return 0; + else if (toupper(s[strlen(s) - 1]) != 'H') + // Standard decimal string + return atoi(s); + + // Hexadecimal string + uint tmp = 0; + int read = sscanf(s, "%xh", &tmp); + if (read < 1) + error("strToInt failed on string \"%s\"", s); + return (int)tmp; +} + +CRoomItem *Debugger::findRoom(const char *name) { + CTreeItem *root = g_vm->_window->_gameManager->_project; + CRoomItem *roomItem = dynamic_cast(root->findByName(name)); + if (roomItem) + return roomItem; + + int roomNumber = strToInt(name); + for (CTreeItem *treeItem = root; treeItem; treeItem = treeItem->scan(root)) { + roomItem = dynamic_cast(treeItem); + if (roomItem && roomItem->_roomNumber == roomNumber) + return roomItem; + } + + return nullptr; +} + +CNodeItem *Debugger::findNode(CRoomItem *room, const char *name) { + CNodeItem *nodeItem = dynamic_cast(room->findByName(name)); + if (nodeItem) + return nodeItem; + + int nodeNumber = strToInt(name); + nodeItem = dynamic_cast(room->findChildInstanceOf(CNodeItem::_type)); + while (nodeItem) { + if (nodeItem->_nodeNumber == nodeNumber) + return nodeItem; + + nodeItem = dynamic_cast(room->findNextInstanceOf(CNodeItem::_type, nodeItem)); + } + + return nullptr; +} + +CViewItem *Debugger::findView(CNodeItem *node, const char *name) { + CViewItem *viewItem = dynamic_cast(node->findByName(name)); + if (viewItem) + return viewItem; + + int viewNumber = strToInt(name); + viewItem = dynamic_cast(node->findChildInstanceOf(CViewItem::_type)); + while (viewItem) { + if (viewItem->_viewNumber == viewNumber) + return viewItem; + + viewItem = dynamic_cast(node->findNextInstanceOf(CViewItem::_type, viewItem)); + } + + return nullptr; +} + +void Debugger::listRooms() { + CTreeItem *root = g_vm->_window->_gameManager->_project; + + for (CTreeItem *treeItem = root; treeItem; treeItem = treeItem->scan(root)) { + CRoomItem *roomItem = dynamic_cast(treeItem); + if (roomItem) + debugPrintf("%s\n", roomItem->_name.c_str()); + } +} + +void Debugger::listRoom(CRoomItem *room) { + for (CTreeItem *treeItem = room; treeItem; treeItem = treeItem->scan(room)) { + CNodeItem *nodeItem = dynamic_cast(treeItem); + if (nodeItem) + debugPrintf("%s\n", nodeItem->_name.c_str()); + } +} + +void Debugger::listNode(CNodeItem *node) { + for (CTreeItem *treeItem = node; treeItem; treeItem = treeItem->scan(node)) { + CViewItem *viewItem = dynamic_cast(treeItem); + if (viewItem) + debugPrintf("%s\n", viewItem->_name.c_str()); + } +} + +bool Debugger::cmdDump(int argc, const char **argv) { + // Get the starting node + CTreeItem *root = g_vm->_window->_gameManager->_project; + if (argc == 2) + root = root->findByName(argv[1]); + + if (root == nullptr) { + debugPrintf("Could not find item\n"); + } else { + root->dump(0); + debugPrintf("Item and it's content were dumped to stdout\n"); + } + + return true; +} + +bool Debugger::cmdRoom(int argc, const char **argv) { + if (argc == 1) { + listRooms(); + } else if (argc >= 2) { + CRoomItem *roomItem = findRoom(argv[1]); + + if (!roomItem) + debugPrintf("Could not find room - %s\n", argv[1]); + else if (argc == 2) + listRoom(roomItem); + else { + CNodeItem *nodeItem = findNode(roomItem, argv[2]); + + if (!nodeItem) + debugPrintf("Could not find node - %s\n", argv[2]); + else if (argc == 3) + listNode(nodeItem); + else { + CViewItem *viewItem = findView(nodeItem, argv[3]); + + if (!viewItem) + debugPrintf("Could not find view - %s\n", argv[3]); + else { + debugPrintf("Found view. TODO: Jump to it\n"); + } + } + } + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/debugger.h b/engines/titanic/debugger.h new file mode 100644 index 0000000000..2f3bb91a46 --- /dev/null +++ b/engines/titanic/debugger.h @@ -0,0 +1,91 @@ +/* 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. + * + */ + +#ifndef TITANIC_DEBUGGER_H +#define TITANIC_DEBUGGER_H + +#include "common/scummsys.h" +#include "gui/debugger.h" +#include "titanic/core/room_item.h" +#include "titanic/core/node_item.h" +#include "titanic/core/view_item.h" + +namespace Titanic { + +class TitanicEngine; + +class Debugger : public GUI::Debugger { +private: + /** + * Converts a decimal or hexadecimal string into a number + */ + int strToInt(const char *s); + + /** + * Find a room by name or number + */ + CRoomItem *findRoom(const char *name); + + /** + * Find a node within a room by name or number + */ + CNodeItem *findNode(CRoomItem *room, const char *name); + + /** + * Find a view within a room node by name or number + */ + CViewItem *findView(CNodeItem *node, const char *name); + + /** + * List all the rooms in the game + */ + void listRooms(); + + /** + * List the nodes within a room + */ + void listRoom(CRoomItem *room); + + /** + * List the views within a room node + */ + void listNode(CNodeItem *node); + + /** + * Dump a portion of the game project + */ + bool cmdDump(int argc, const char **argv); + + /** + * List room details, or jump to a specific view + */ + bool cmdRoom(int argc, const char **argv); +protected: + TitanicEngine *_vm; +public: + Debugger(TitanicEngine *vm); + virtual ~Debugger() {} +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DEBUGGER_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 23ac75056d..7f9adaa0b4 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -1,6 +1,7 @@ MODULE := engines/titanic MODULE_OBJS := \ + debugger.o \ detection.o \ direct_draw.o \ files_manager.o \ diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index e7bbd84c34..e5417c1e7d 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -29,6 +29,7 @@ #include "graphics/scaler.h" #include "graphics/thumbnail.h" #include "titanic/titanic.h" +#include "titanic/debugger.h" #include "titanic/carry/hose.h" #include "titanic/core/saveable_object.h" #include "titanic/game/get_lift_eye2.h" @@ -47,11 +48,13 @@ TitanicEngine::TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDe : _gameDescription(gameDesc), Engine(syst), _randomSource("Titanic"), _ticksCount(0), _frameCounter(0) { g_vm = this; + _debugger = nullptr; _window = nullptr; _screenManager = nullptr; } TitanicEngine::~TitanicEngine() { + delete _debugger; delete _window; delete _screenManager; CSaveableObject::freeClassList(); @@ -79,6 +82,7 @@ void TitanicEngine::initialize() { CExitPellerator::init(); CEnterExitSecClassMiniLift::init(); + _debugger = new Debugger(this); _screenManager = new OSScreenManager(this); _window = new CMainGameWindow(this); _window->applicationStarting(); @@ -108,9 +112,24 @@ Common::Error TitanicEngine::run() { } void TitanicEngine::processEvents() { - Common::Event evt; - g_system->getEventManager()->pollEvent(evt); - + Common::Event event; + g_system->getEventManager()->pollEvent(event); + + // Give time to the debugger + _debugger->onFrame(); + + switch (event.type) { + case Common::EVENT_KEYDOWN: + if (event.kbd.keycode == Common::KEYCODE_d && (event.kbd.flags & Common::KBD_CTRL)) { + // Attach to the debugger + _debugger->attach(); + _debugger->onFrame(); + } + break; + + default: + break; + } } } // End of namespace Titanic diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index c5c642629f..c2a66fbc03 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -29,6 +29,7 @@ #include "common/serializer.h" #include "engines/advancedDetector.h" #include "engines/engine.h" +#include "titanic/debugger.h" #include "titanic/files_manager.h" #include "titanic/screen_manager.h" #include "titanic/main_game_window.h" @@ -97,6 +98,7 @@ protected: virtual bool hasFeature(EngineFeature f) const; public: CFilesManager _filesManager; + Debugger *_debugger; OSScreenManager *_screenManager; CMainGameWindow *_window; Common::RandomSource _randomSource; -- cgit v1.2.3 From 39a4db06fa00c994ac225b68a9e236ca6cf39a35 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 17 Mar 2016 22:32:39 -0400 Subject: TITANIC: Add room number to debugger rooms listing --- engines/titanic/debugger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/titanic/debugger.cpp b/engines/titanic/debugger.cpp index b759b12846..7af86fc71d 100644 --- a/engines/titanic/debugger.cpp +++ b/engines/titanic/debugger.cpp @@ -104,7 +104,7 @@ void Debugger::listRooms() { for (CTreeItem *treeItem = root; treeItem; treeItem = treeItem->scan(root)) { CRoomItem *roomItem = dynamic_cast(treeItem); if (roomItem) - debugPrintf("%s\n", roomItem->_name.c_str()); + debugPrintf("%d - %s\n", roomItem->_roomNumber, roomItem->_name.c_str()); } } -- cgit v1.2.3 From 04b8c75a9371d0ad353cbf4cc86da6087e94c7df Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 17 Mar 2016 22:51:29 -0400 Subject: TITANIC: Add stubs for CEnterNodeMsg message handlers --- engines/titanic/core/saveable_object.cpp | 6 +-- engines/titanic/game/doorbot_elevator_handler.cpp | 5 ++ engines/titanic/game/doorbot_elevator_handler.h | 5 +- engines/titanic/game/phonograph.h | 2 +- engines/titanic/game/transport/lift_indicator.h | 2 +- engines/titanic/game/volume_control.cpp | 53 +++++++++++++++++++++ engines/titanic/game/volume_control.h | 55 ++++++++++++++++++++++ engines/titanic/gfx/volume_control.cpp | 48 ------------------- engines/titanic/gfx/volume_control.h | 52 -------------------- engines/titanic/module.mk | 2 +- engines/titanic/sound/node_auto_sound_player.cpp | 5 ++ engines/titanic/sound/node_auto_sound_player.h | 5 +- .../titanic/sound/restricted_auto_music_player.h | 2 +- 13 files changed, 133 insertions(+), 109 deletions(-) create mode 100644 engines/titanic/game/volume_control.cpp create mode 100644 engines/titanic/game/volume_control.h delete mode 100644 engines/titanic/gfx/volume_control.cpp delete mode 100644 engines/titanic/gfx/volume_control.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index e833a056ac..3e9dad369e 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -206,6 +206,7 @@ #include "titanic/game/tow_parrot_nav.h" #include "titanic/game/up_lighter.h" #include "titanic/game/useless_lever.h" +#include "titanic/game/volume_control.h" #include "titanic/game/wheel_button.h" #include "titanic/game/wheel_hotspot.h" #include "titanic/game/wheel_spin.h" @@ -332,7 +333,6 @@ #include "titanic/gfx/text_skrew.h" #include "titanic/gfx/text_up.h" #include "titanic/gfx/toggle_switch.h" -#include "titanic/gfx/volume_control.h" #include "titanic/messages/messages.h" #include "titanic/messages/auto_sound_event.h" @@ -613,6 +613,7 @@ DEFFN(CTitaniaStillControl) DEFFN(CTOWParrotNav) DEFFN(CUpLighter) DEFFN(CUselessLever) +DEFFN(CVolumeControl) DEFFN(CWheelButton) DEFFN(CWheelHotSpot) DEFFN(CWheelSpin) @@ -743,7 +744,6 @@ DEFFN(CTextSkrew) DEFFN(CTextUp) DEFFN(CToggleButton) DEFFN(CToggleSwitch) -DEFFN(CVolumeControl) DEFFN(CActMsg) DEFFN(CActivationmsg) @@ -1183,6 +1183,7 @@ void CSaveableObject::initClassList() { ADDFN(CTOWParrotNav, CGameObject); ADDFN(CUpLighter, CDropTarget); ADDFN(CUselessLever, CToggleButton); + ADDFN(CVolumeControl, CGameObject); ADDFN(CWheelButton, CBackground); ADDFN(CWheelHotSpot, CBackground); ADDFN(CWheelSpin, CBackground); @@ -1313,7 +1314,6 @@ void CSaveableObject::initClassList() { ADDFN(CTextUp, CPetGraphic); ADDFN(CToggleButton, CBackground); ADDFN(CToggleSwitch, CGameObject); - ADDFN(CVolumeControl, CGameObject); ADDFN(CActMsg, CMessage); ADDFN(CActivationmsg, CMessage); diff --git a/engines/titanic/game/doorbot_elevator_handler.cpp b/engines/titanic/game/doorbot_elevator_handler.cpp index e4232c087b..b8cec40e1a 100644 --- a/engines/titanic/game/doorbot_elevator_handler.cpp +++ b/engines/titanic/game/doorbot_elevator_handler.cpp @@ -40,4 +40,9 @@ void CDoorbotElevatorHandler::load(SimpleFile *file) { CGameObject::load(file); } +bool CDoorbotElevatorHandler::handleEvent(const CEnterNodeMsg &msg) { + warning("CDoorbotElevatorHandler::handleEvent"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/doorbot_elevator_handler.h b/engines/titanic/game/doorbot_elevator_handler.h index e46929dfed..4c34248a71 100644 --- a/engines/titanic/game/doorbot_elevator_handler.h +++ b/engines/titanic/game/doorbot_elevator_handler.h @@ -24,13 +24,16 @@ #define TITANIC_DOORBOT_ELEVATOR_HANDLER_H #include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CDoorbotElevatorHandler : public CGameObject { +class CDoorbotElevatorHandler : public CGameObject, CEnterNodeMsgTarget { private: static int _v1; int _value; +protected: + virtual bool handleEvent(const CEnterNodeMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/phonograph.h b/engines/titanic/game/phonograph.h index 3ba2d1ce87..157bd44052 100644 --- a/engines/titanic/game/phonograph.h +++ b/engines/titanic/game/phonograph.h @@ -28,7 +28,7 @@ namespace Titanic { -class CPhonograph : public CMusicPlayer, CEnterRoomMsgTarget { +class CPhonograph : public CMusicPlayer { protected: CString _string2; int _fieldE0; diff --git a/engines/titanic/game/transport/lift_indicator.h b/engines/titanic/game/transport/lift_indicator.h index de913c56a5..b707fbbed9 100644 --- a/engines/titanic/game/transport/lift_indicator.h +++ b/engines/titanic/game/transport/lift_indicator.h @@ -28,7 +28,7 @@ namespace Titanic { -class CLiftindicator : public CLift, CEnterRoomMsgTarget { +class CLiftindicator : public CLift { private: int _fieldFC; Common::Point _pos2; diff --git a/engines/titanic/game/volume_control.cpp b/engines/titanic/game/volume_control.cpp new file mode 100644 index 0000000000..26f89a7b55 --- /dev/null +++ b/engines/titanic/game/volume_control.cpp @@ -0,0 +1,53 @@ +/* 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 "titanic/game/volume_control.h" + +namespace Titanic { + +CVolumeControl::CVolumeControl() : CGameObject() { +} + +void CVolumeControl::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_fieldBC, indent); + file->writeQuotedLine(_string1, indent); + file->writeNumberLine(_fieldCC, indent); + + CGameObject::save(file, indent); +} + +void CVolumeControl::load(SimpleFile *file) { + file->readNumber(); + _fieldBC = file->readNumber(); + _string1 = file->readString(); + _fieldCC = file->readNumber(); + + CGameObject::load(file); +} + +bool CVolumeControl::handleEvent(const CEnterNodeMsg &msg) { + warning("CVolumeControl::handleEvent"); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/volume_control.h b/engines/titanic/game/volume_control.h new file mode 100644 index 0000000000..8fa7d01a77 --- /dev/null +++ b/engines/titanic/game/volume_control.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_VOLUME_CONTROL_H +#define TITANIC_VOLUME_CONTROL_H + +#include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +class CVolumeControl : public CGameObject, CEnterNodeMsgTarget { +private: + int _fieldBC; + CString _string1; + int _fieldCC; +protected: + virtual bool handleEvent(const CEnterNodeMsg &msg); +public: + CLASSDEF + CVolumeControl(); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_VOLUME_CONTROL_H */ diff --git a/engines/titanic/gfx/volume_control.cpp b/engines/titanic/gfx/volume_control.cpp deleted file mode 100644 index 7c829169bb..0000000000 --- a/engines/titanic/gfx/volume_control.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* 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 "titanic/gfx/volume_control.h" - -namespace Titanic { - -CVolumeControl::CVolumeControl() : CGameObject() { -} - -void CVolumeControl::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldBC, indent); - file->writeQuotedLine(_string1, indent); - file->writeNumberLine(_fieldCC, indent); - - CGameObject::save(file, indent); -} - -void CVolumeControl::load(SimpleFile *file) { - file->readNumber(); - _fieldBC = file->readNumber(); - _string1 = file->readString(); - _fieldCC = file->readNumber(); - - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/gfx/volume_control.h b/engines/titanic/gfx/volume_control.h deleted file mode 100644 index 7778bb8c52..0000000000 --- a/engines/titanic/gfx/volume_control.h +++ /dev/null @@ -1,52 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_VOLUME_CONTROL_H -#define TITANIC_VOLUME_CONTROL_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CVolumeControl : public CGameObject { -private: - int _fieldBC; - CString _string1; - int _fieldCC; -public: - CLASSDEF - CVolumeControl(); - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_VOLUME_CONTROL_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 7f9adaa0b4..0fc6d3b7dd 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -208,6 +208,7 @@ MODULE_OBJS := \ game/titania_still_control.o \ game/up_lighter.o \ game/useless_lever.o \ + game/volume_control.o \ game/wheel_button.o \ game/wheel_hotspot.o \ game/wheel_spin.o \ @@ -328,7 +329,6 @@ MODULE_OBJS := \ gfx/text_up.o \ gfx/toggle_button.o \ gfx/toggle_switch.o \ - gfx/volume_control.o \ messages/auto_sound_event.o \ messages/bilge_auto_sound_event.o \ messages/bilge_dispensor_event.o \ diff --git a/engines/titanic/sound/node_auto_sound_player.cpp b/engines/titanic/sound/node_auto_sound_player.cpp index 3a69535bd7..5709cf5e81 100644 --- a/engines/titanic/sound/node_auto_sound_player.cpp +++ b/engines/titanic/sound/node_auto_sound_player.cpp @@ -36,4 +36,9 @@ void CNodeAutoSoundPlayer::load(SimpleFile *file) { CAutoSoundPlayer::load(file); } +bool CNodeAutoSoundPlayer::handleEvent(const CEnterNodeMsg &msg) { + warning("CNodeAutoSoundPlayer::handleEvent"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/sound/node_auto_sound_player.h b/engines/titanic/sound/node_auto_sound_player.h index 6fc56098f8..c635d7e3e9 100644 --- a/engines/titanic/sound/node_auto_sound_player.h +++ b/engines/titanic/sound/node_auto_sound_player.h @@ -24,12 +24,15 @@ #define TITANIC_NODE_AUTO_SOUND_PLAYER_H #include "titanic/sound/auto_sound_player.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CNodeAutoSoundPlayer : public CAutoSoundPlayer { +class CNodeAutoSoundPlayer : public CAutoSoundPlayer, CEnterNodeMsgTarget { private: int _fieldEC; +protected: + virtual bool handleEvent(const CEnterNodeMsg &msg); public: CLASSDEF CNodeAutoSoundPlayer() : CAutoSoundPlayer(), _fieldEC(1) {} diff --git a/engines/titanic/sound/restricted_auto_music_player.h b/engines/titanic/sound/restricted_auto_music_player.h index 60dcc6809d..a9f17d8729 100644 --- a/engines/titanic/sound/restricted_auto_music_player.h +++ b/engines/titanic/sound/restricted_auto_music_player.h @@ -28,7 +28,7 @@ namespace Titanic { -class CRestrictedAutoMusicPlayer : public CAutoMusicPlayer, CEnterRoomMsgTarget { +class CRestrictedAutoMusicPlayer : public CAutoMusicPlayer { private: CString _string3; CString _string4; -- cgit v1.2.3 From ea585b0aa53544e114cdb0080cacbcb324e6e1ff Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 17 Mar 2016 23:01:46 -0400 Subject: TITANIC: Add some CEnterViewMsg stubs --- engines/titanic/game/arboretum_gate.cpp | 13 +++++++++++++ engines/titanic/game/arboretum_gate.h | 14 +++++++------- engines/titanic/game/auto_animate.cpp | 5 +++++ engines/titanic/game/auto_animate.h | 5 ++++- 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/engines/titanic/game/arboretum_gate.cpp b/engines/titanic/game/arboretum_gate.cpp index 3f13676796..f4193b0f2f 100644 --- a/engines/titanic/game/arboretum_gate.cpp +++ b/engines/titanic/game/arboretum_gate.cpp @@ -133,4 +133,17 @@ void CArboretumGate::load(SimpleFile *file) { CBackground::load(file); } +bool CArboretumGate::handleEvent(const CActMsg &msg) { return false; } +bool CArboretumGate::handleEvent(const CLeaveViewMsg &msg) { return false; } +bool CArboretumGate::handleEvent(const CTurnOff &msg) { return false; } +bool CArboretumGate::handleEvent(const CMouseButtonDownMsg &msg) { return false; } + +bool CArboretumGate::handleEvent(const CEnterViewMsg &msg) { + warning("CArboretumGate::handleEvent"); + return false; +} + +bool CArboretumGate::handleEvent(const CTurnOn &msg) { return false; } +bool CArboretumGate::handleEvent(const CMovieEndMsg &msg) { return false; } + } // End of namespace Titanic diff --git a/engines/titanic/game/arboretum_gate.h b/engines/titanic/game/arboretum_gate.h index 2c2b81feab..514192e151 100644 --- a/engines/titanic/game/arboretum_gate.h +++ b/engines/titanic/game/arboretum_gate.h @@ -69,13 +69,13 @@ private: int _field150; CString _string2; protected: - virtual bool handleEvent(const CActMsg &msg) { return false; } - virtual bool handleEvent(const CLeaveViewMsg &msg) { return false; } - virtual bool handleEvent(const CTurnOff &msg) { return false; } - virtual bool handleEvent(const CMouseButtonDownMsg &msg) { return false; } - virtual bool handleEvent(const CEnterViewMsg &msg) { return false; } - virtual bool handleEvent(const CTurnOn &msg) { return false; } - virtual bool handleEvent(const CMovieEndMsg &msg) { return false; } + virtual bool handleEvent(const CActMsg &msg); + virtual bool handleEvent(const CLeaveViewMsg &msg); + virtual bool handleEvent(const CTurnOff &msg); + virtual bool handleEvent(const CMouseButtonDownMsg &msg); + virtual bool handleEvent(const CEnterViewMsg &msg); + virtual bool handleEvent(const CTurnOn &msg); + virtual bool handleEvent(const CMovieEndMsg &msg); public: CLASSDEF CArboretumGate(); diff --git a/engines/titanic/game/auto_animate.cpp b/engines/titanic/game/auto_animate.cpp index bbaeebf091..c79fa74167 100644 --- a/engines/titanic/game/auto_animate.cpp +++ b/engines/titanic/game/auto_animate.cpp @@ -40,4 +40,9 @@ void CAutoAnimate::load(SimpleFile *file) { CBackground::load(file); } +bool CAutoAnimate::handleEvent(const CEnterViewMsg &msg) { + warning("CAutoAnimate::handleEvent"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/auto_animate.h b/engines/titanic/game/auto_animate.h index 0fd4ad768f..160fe09d90 100644 --- a/engines/titanic/game/auto_animate.h +++ b/engines/titanic/game/auto_animate.h @@ -24,14 +24,17 @@ #define TITANIC_AUTO_ANIMATE_H #include "titanic/core/background.h" +#include "titanic/messages/messages.h" namespace Titanic { class CAutoAnimate : public CBackground { -public: +private: int _fieldE0; int _fieldE4; int _fieldE8; +protected: + virtual bool handleEvent(const CEnterViewMsg &msg); public: CLASSDEF CAutoAnimate() : CBackground(), _fieldE0(1), _fieldE4(1), _fieldE8(0) {} -- cgit v1.2.3 From 8b9f3dc0b8929d920cb101a06cef8ba14fee59f0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 17 Mar 2016 23:58:24 -0400 Subject: TITANIC: Fleshing out CLinkItem class --- engines/titanic/core/link_item.cpp | 66 ++++++++++++++++++++-------- engines/titanic/core/link_item.h | 43 +++++++++++++++--- engines/titanic/core/named_item.cpp | 11 +++++ engines/titanic/core/named_item.h | 6 +++ engines/titanic/core/tree_item.cpp | 5 ++- engines/titanic/core/tree_item.h | 5 ++- engines/titanic/pet_control/pet_val.cpp | 2 +- engines/titanic/pet_control/pet_val.h | 2 +- engines/titanic/pet_control/pet_val_base.cpp | 2 +- engines/titanic/pet_control/pet_val_base.h | 2 +- 10 files changed, 112 insertions(+), 32 deletions(-) diff --git a/engines/titanic/core/link_item.cpp b/engines/titanic/core/link_item.cpp index 9a895b774b..175c11f8d0 100644 --- a/engines/titanic/core/link_item.cpp +++ b/engines/titanic/core/link_item.cpp @@ -21,10 +21,13 @@ */ #include "titanic/core/link_item.h" +#include "titanic/core/node_item.h" +#include "titanic/core/project_item.h" +#include "titanic/core/view_item.h" namespace Titanic { -void CLinkItemSub::clear() { +void CLinkItemHotspot::clear() { _field0 = 0; _field4 = 0; _field8 = 0; @@ -34,28 +37,33 @@ void CLinkItemSub::clear() { /*------------------------------------------------------------------------*/ CLinkItem::CLinkItem() : CNamedItem() { - _field24 = -1; - _field28 = -1; - _field2C = -1; + _roomNumber = -1; + _nodeNumber = -1; + _viewNumber = -1; _field30 = 0; _field34 = 1; _name = "Link"; } +CString CLinkItem::formName() { + warning("TODO: CLinkItem::formName"); + return ""; +} + void CLinkItem::save(SimpleFile *file, int indent) const { file->writeNumberLine(2, indent); file->writeQuotedLine("L", indent); file->writeNumberLine(_field34, indent + 1); file->writeNumberLine(_field30, indent + 1); - file->writeNumberLine(_field24, indent + 1); - file->writeNumberLine(_field28, indent + 1); - file->writeNumberLine(_field2C, indent + 1); + file->writeNumberLine(_roomNumber, indent + 1); + file->writeNumberLine(_nodeNumber, indent + 1); + file->writeNumberLine(_viewNumber, indent + 1); file->writeQuotedLine("Hotspot", indent + 1); - file->writeNumberLine(_sub._field0, indent + 2); - file->writeNumberLine(_sub._field4, indent + 2); - file->writeNumberLine(_sub._field8, indent + 2); - file->writeNumberLine(_sub._fieldC, indent + 2); + file->writeNumberLine(_hotspot._field0, indent + 2); + file->writeNumberLine(_hotspot._field4, indent + 2); + file->writeNumberLine(_hotspot._field8, indent + 2); + file->writeNumberLine(_hotspot._fieldC, indent + 2); CNamedItem::save(file, indent); } @@ -74,15 +82,15 @@ void CLinkItem::load(SimpleFile *file) { // Deliberate fall-through case 0: - _field24 = file->readNumber(); - _field28 = file->readNumber(); - _field2C = file->readNumber(); + _roomNumber = file->readNumber(); + _nodeNumber = file->readNumber(); + _viewNumber = file->readNumber(); file->readBuffer(); - _sub._field0 = file->readNumber(); - _sub._field4 = file->readNumber(); - _sub._field8 = file->readNumber(); - _sub._fieldC = file->readNumber(); + _hotspot._field0 = file->readNumber(); + _hotspot._field4 = file->readNumber(); + _hotspot._field8 = file->readNumber(); + _hotspot._fieldC = file->readNumber(); break; default: @@ -109,4 +117,26 @@ void CLinkItem::load(SimpleFile *file) { } } +void CLinkItem::setDestination(int roomNumber, int nodeNumber, + int viewNumber, int v) { + _roomNumber = roomNumber; + _nodeNumber = nodeNumber; + _viewNumber = viewNumber; + _field30 = v; + + _name = formName(); +} + +CViewItem *CLinkItem::getDestView() const { + return getRoot()->findView(_roomNumber, _nodeNumber, _viewNumber); +} + +CNodeItem *CLinkItem::getDestNode() const { + return getDestView()->findNode(); +} + +CRoomItem *CLinkItem::getDestRoom() const { + return getDestNode()->findRoom(); +} + } // End of namespace Titanic diff --git a/engines/titanic/core/link_item.h b/engines/titanic/core/link_item.h index f46f8d3ba0..06d55f3f44 100644 --- a/engines/titanic/core/link_item.h +++ b/engines/titanic/core/link_item.h @@ -27,26 +27,36 @@ namespace Titanic { -class CLinkItemSub { +class CViewItem; +class CNodeItem; +class CRoomItem; + +class CLinkItemHotspot { public: int _field0; int _field4; int _field8; int _fieldC; public: - CLinkItemSub() { clear(); } + CLinkItemHotspot() { clear(); } void clear(); }; class CLinkItem : public CNamedItem { +private: + /** + * Returns a new name for the link item, based on the + * current values for it's destination + */ + CString formName(); protected: - int _field24; - int _field28; - int _field2C; + int _roomNumber; + int _nodeNumber; + int _viewNumber; int _field30; int _field34; - CLinkItemSub _sub; + CLinkItemHotspot _hotspot; public: CLASSDEF CLinkItem(); @@ -60,6 +70,27 @@ public: * Load the data for the class from file */ virtual void load(SimpleFile *file); + + /** + * Set the destination for the link item + */ + virtual void setDestination(int roomNumber, int nodeNumber, + int viewNumber, int v); + + /** + * Get the destination view for the link item + */ + virtual CViewItem *getDestView() const; + + /** + * Get the destination node for the link item + */ + virtual CNodeItem *getDestNode() const; + + /** + * Get the destination view for the link item + */ + virtual CRoomItem *getDestRoom() const; }; } // End of namespace Titanic diff --git a/engines/titanic/core/named_item.cpp b/engines/titanic/core/named_item.cpp index 49cfdb4622..02e75044aa 100644 --- a/engines/titanic/core/named_item.cpp +++ b/engines/titanic/core/named_item.cpp @@ -23,6 +23,7 @@ #include "titanic/core/named_item.h" #include "titanic/core/node_item.h" #include "titanic/core/room_item.h" +#include "titanic/core/view_item.h" namespace Titanic { @@ -56,6 +57,16 @@ int CNamedItem::compareTo(const CString &name, int maxLen) const { } } +CViewItem *CNamedItem::findView() const { + for (CTreeItem *parent = getParent(); parent; parent = parent->getParent()) { + CViewItem *view = dynamic_cast(parent); + if (view) + return view; + } + + error("Couldn't find parent view"); +} + CNodeItem *CNamedItem::findNode() const { for (CTreeItem *parent = getParent(); parent; parent = parent->getParent()) { CNodeItem *node = dynamic_cast(parent); diff --git a/engines/titanic/core/named_item.h b/engines/titanic/core/named_item.h index aac81ec209..6ee11e960e 100644 --- a/engines/titanic/core/named_item.h +++ b/engines/titanic/core/named_item.h @@ -27,6 +27,7 @@ namespace Titanic { +class CViewItem; class CNodeItem; class CRoomItem; @@ -61,6 +62,11 @@ public: */ virtual int compareTo(const CString &name, int maxLen) const; + /** + * Find a parent node for the item + */ + virtual CViewItem *findView() const; + /** * Find a parent node for the item */ diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index 39c3fe1f10..72c158d103 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -28,6 +28,7 @@ #include "titanic/core/link_item.h" #include "titanic/core/named_item.h" #include "titanic/core/node_item.h" +#include "titanic/core/project_item.h" #include "titanic/core/view_item.h" #include "titanic/core/room_item.h" @@ -104,7 +105,7 @@ CGameManager *CTreeItem::getGameManager() const { return _parent ? _parent->getGameManager() : nullptr; } -CTreeItem *CTreeItem::getRoot() const { +CProjectItem *CTreeItem::getRoot() const { CTreeItem *parent = getParent(); if (parent) { @@ -113,7 +114,7 @@ CTreeItem *CTreeItem::getRoot() const { } while (parent->getParent()); } - return parent; + return dynamic_cast(parent); } CTreeItem *CTreeItem::getLastSibling() { diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index be381c55c1..aea22ffa40 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -30,6 +30,7 @@ namespace Titanic { class CGameManager; class CDontSaveFileItem; class CNamedItem; +class CProjectItem; class CTreeItem: public CMessageTarget { private: @@ -124,9 +125,9 @@ public: CTreeItem *getParent() const { return _parent; } /** - * Jumps up through the parents to find the sub-root item + * Jumps up through the parents to find the root item */ - CTreeItem *getRoot() const; + CProjectItem *getRoot() const; /** * Get the next sibling diff --git a/engines/titanic/pet_control/pet_val.cpp b/engines/titanic/pet_control/pet_val.cpp index f0b9b92cde..31494e1033 100644 --- a/engines/titanic/pet_control/pet_val.cpp +++ b/engines/titanic/pet_control/pet_val.cpp @@ -41,7 +41,7 @@ void CPetVal::proc4() { error("TODO"); } -void CPetVal::proc5(CLinkItemSub *linkItem) { +void CPetVal::proc5(CLinkItemHotspot *linkItem) { error("TODO"); } diff --git a/engines/titanic/pet_control/pet_val.h b/engines/titanic/pet_control/pet_val.h index f1f9bd1f3c..2bf082fbc8 100644 --- a/engines/titanic/pet_control/pet_val.h +++ b/engines/titanic/pet_control/pet_val.h @@ -40,7 +40,7 @@ public: virtual void proc3(); virtual void proc4(); - virtual void proc5(CLinkItemSub *linkItem); + virtual void proc5(CLinkItemHotspot *linkItem); virtual int proc16(); }; diff --git a/engines/titanic/pet_control/pet_val_base.cpp b/engines/titanic/pet_control/pet_val_base.cpp index c1d2fa7d4f..2eb93394a9 100644 --- a/engines/titanic/pet_control/pet_val_base.cpp +++ b/engines/titanic/pet_control/pet_val_base.cpp @@ -28,7 +28,7 @@ namespace Titanic { CPetValBase::CPetValBase() : _field4(0), _field8(0), _fieldC(0), _field10(0), _field14(0) {} -void CPetValBase::proc5(CLinkItemSub *linkItem) { +void CPetValBase::proc5(CLinkItemHotspot *linkItem) { if (linkItem) linkItem->clear(); } diff --git a/engines/titanic/pet_control/pet_val_base.h b/engines/titanic/pet_control/pet_val_base.h index f5f6e58387..e6e78ae4b0 100644 --- a/engines/titanic/pet_control/pet_val_base.h +++ b/engines/titanic/pet_control/pet_val_base.h @@ -44,7 +44,7 @@ public: virtual void proc3() {} virtual void proc4() {} - virtual void proc5(CLinkItemSub *linkItem); + virtual void proc5(CLinkItemHotspot *linkItem); virtual int proc6(); virtual int proc7(); -- cgit v1.2.3 From 61947ef56b77ab4778adafde93388fb526911eb7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 18 Mar 2016 20:04:54 -0400 Subject: TITANIC: Create Event manager class --- engines/titanic/events.cpp | 88 +++++++++++++++++++++++++++++++++++++++++++ engines/titanic/events.h | 74 ++++++++++++++++++++++++++++++++++++ engines/titanic/game/bomb.cpp | 2 +- engines/titanic/module.mk | 1 + engines/titanic/string.cpp | 2 +- engines/titanic/titanic.cpp | 30 +++------------ engines/titanic/titanic.h | 9 +---- 7 files changed, 172 insertions(+), 34 deletions(-) create mode 100644 engines/titanic/events.cpp create mode 100644 engines/titanic/events.h diff --git a/engines/titanic/events.cpp b/engines/titanic/events.cpp new file mode 100644 index 0000000000..c9e4e5dc98 --- /dev/null +++ b/engines/titanic/events.cpp @@ -0,0 +1,88 @@ +/* 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/events.h" +#include "common/system.h" +#include "engines/util.h" +#include "titanic/events.h" +#include "titanic/titanic.h" + +namespace Titanic { + +Events::Events(TitanicEngine *vm): _vm(vm), + _frameCounter(1), _priorFrameTime(0) { +} + +void Events::pollEvents() { + checkForNextFrameCounter(); + + Common::Event event; + g_system->getEventManager()->pollEvent(event); + + // Give time to the debugger + _vm->_debugger->onFrame(); + + switch (event.type) { + case Common::EVENT_KEYDOWN: + if (event.kbd.keycode == Common::KEYCODE_d && (event.kbd.flags & Common::KBD_CTRL)) { + // Attach to the debugger + _vm->_debugger->attach(); + _vm->_debugger->onFrame(); + } + break; + + default: + break; + } +} + +void Events::pollEventsAndWait() { + pollEvents(); + g_system->delayMillis(10); +} + +bool Events::checkForNextFrameCounter() { + // Check for next game frame + uint32 milli = g_system->getMillis(); + if ((milli - _priorFrameTime) >= GAME_FRAME_TIME) { + ++_frameCounter; + _priorFrameTime = milli; + + // Give time to the debugger + _vm->_debugger->onFrame(); + + // Display the frame + //_vm->_screen->update(); + + return true; + } + + return false; +} + +uint32 Events::getTicksCount() const { + return g_system->getMillis(); +} + + +} // End of namespace Titanic diff --git a/engines/titanic/events.h b/engines/titanic/events.h new file mode 100644 index 0000000000..2de04d44b1 --- /dev/null +++ b/engines/titanic/events.h @@ -0,0 +1,74 @@ +/* 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. + * + */ + +#ifndef TITANIC_EVENTS_H +#define TITANIC_EVENTS_H + +#include "common/scummsys.h" +#include "common/events.h" + +namespace Titanic { + +#define GAME_FRAME_RATE 30 +#define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE) + +class TitanicEngine; + +class Events { +private: + TitanicEngine *_vm; + uint32 _frameCounter; + uint32 _priorFrameTime; + + /** + * Check whether it's time to display the next screen frame + */ + bool checkForNextFrameCounter(); +public: + Events(TitanicEngine *vm); + ~Events() {} + + /** + * Check for any pending events + */ + void pollEvents(); + + /** + * Poll for events and introduce a small delay, to allow the system to + * yield to other running programs + */ + void pollEventsAndWait(); + + /** + * Return the current game frame number + */ + uint32 getFrameCounter() const { return _frameCounter; } + + /** + * Get the elapsed playtime + */ + uint32 getTicksCount() const; +}; + +} // End of namespace Titanic + +#endif /* TITANIC_EVENTS_H */ diff --git a/engines/titanic/game/bomb.cpp b/engines/titanic/game/bomb.cpp index 429f254d66..e4cf1b3830 100644 --- a/engines/titanic/game/bomb.cpp +++ b/engines/titanic/game/bomb.cpp @@ -74,7 +74,7 @@ bool CBomb::handleEvent(const CEnterRoomMsg &msg) { _fieldE8 = 12; _fieldEC = 9; _fieldF0 = 0; - _startingTicks = g_vm->_ticksCount; + _startingTicks = g_vm->_events->getTicksCount(); return true; } diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 0fc6d3b7dd..da194bf00e 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -4,6 +4,7 @@ MODULE_OBJS := \ debugger.o \ detection.o \ direct_draw.o \ + events.o \ files_manager.o \ font.o \ game_location.o \ diff --git a/engines/titanic/string.cpp b/engines/titanic/string.cpp index ed5379be65..5831b7dc3a 100644 --- a/engines/titanic/string.cpp +++ b/engines/titanic/string.cpp @@ -30,7 +30,7 @@ CString CString::left(uint count) const { } CString CString::right(uint count) const { - int strSize = size(); + uint strSize = size(); return (count > strSize) ? CString() : CString(c_str() + strSize - count, c_str() + strSize); } diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index e5417c1e7d..f29e776791 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -45,16 +45,17 @@ namespace Titanic { TitanicEngine *g_vm; TitanicEngine::TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc) - : _gameDescription(gameDesc), Engine(syst), _randomSource("Titanic"), - _ticksCount(0), _frameCounter(0) { + : _gameDescription(gameDesc), Engine(syst), _randomSource("Titanic") { g_vm = this; _debugger = nullptr; + _events = nullptr; _window = nullptr; _screenManager = nullptr; } TitanicEngine::~TitanicEngine() { delete _debugger; + delete _events; delete _window; delete _screenManager; CSaveableObject::freeClassList(); @@ -83,6 +84,7 @@ void TitanicEngine::initialize() { CEnterExitSecClassMiniLift::init(); _debugger = new Debugger(this); + _events = new Events(this); _screenManager = new OSScreenManager(this); _window = new CMainGameWindow(this); _window->applicationStarting(); @@ -103,33 +105,11 @@ Common::Error TitanicEngine::run() { // Main event loop while (!shouldQuit()) { - processEvents(); - g_system->delayMillis(5); + _events->pollEventsAndWait(); } deinitialize(); return Common::kNoError; } -void TitanicEngine::processEvents() { - Common::Event event; - g_system->getEventManager()->pollEvent(event); - - // Give time to the debugger - _debugger->onFrame(); - - switch (event.type) { - case Common::EVENT_KEYDOWN: - if (event.kbd.keycode == Common::KEYCODE_d && (event.kbd.flags & Common::KBD_CTRL)) { - // Attach to the debugger - _debugger->attach(); - _debugger->onFrame(); - } - break; - - default: - break; - } -} - } // End of namespace Titanic diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index c2a66fbc03..8ed353f413 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -30,6 +30,7 @@ #include "engines/advancedDetector.h" #include "engines/engine.h" #include "titanic/debugger.h" +#include "titanic/events.h" #include "titanic/files_manager.h" #include "titanic/screen_manager.h" #include "titanic/main_game_window.h" @@ -83,11 +84,6 @@ private: * Handles game deinitialization */ void deinitialize(); - - /** - * Processes pending events - */ - void processEvents(); protected: const TitanicGameDescription *_gameDescription; int _loadSaveSlot; @@ -99,11 +95,10 @@ protected: public: CFilesManager _filesManager; Debugger *_debugger; + Events *_events; OSScreenManager *_screenManager; CMainGameWindow *_window; Common::RandomSource _randomSource; - uint _frameCounter; - uint _ticksCount; public: TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc); virtual ~TitanicEngine(); -- cgit v1.2.3 From 9565fbaeac8f48ea0090ebbd751a18eacc6d1230 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 18 Mar 2016 21:34:04 -0400 Subject: TITANIC: Implement input translator event methods --- engines/titanic/core/saveable_object.cpp | 6 ++ engines/titanic/events.cpp | 123 +++++++++++++++++++++++++++--- engines/titanic/events.h | 24 ++++++ engines/titanic/files_manager.cpp | 4 + engines/titanic/files_manager.h | 2 + engines/titanic/game_manager.cpp | 4 + engines/titanic/game_manager.h | 9 ++- engines/titanic/input_handler.cpp | 16 ++++ engines/titanic/input_handler.h | 10 +++ engines/titanic/input_translator.cpp | 57 +++++++++++++- engines/titanic/input_translator.h | 18 +++++ engines/titanic/main_game_window.cpp | 7 +- engines/titanic/main_game_window.h | 7 +- engines/titanic/messages/messages.cpp | 57 ++++++++++++++ engines/titanic/messages/messages.h | 18 +++++ engines/titanic/messages/mouse_messages.h | 14 ++++ 16 files changed, 359 insertions(+), 17 deletions(-) diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 3e9dad369e..4ad9938c9c 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -856,6 +856,9 @@ DEFFN(CPhonographRecordMsg) DEFFN(CPhonographStopMsg) DEFFN(CPlayRangeMsg) DEFFN(CPlayerTriesRestaurantTableMsg) +DEFFN(CPreEnterNodeMsg); +DEFFN(CPreEnterRoomMsg); +DEFFN(CPreEnterViewMsg); DEFFN(CPreSaveMsg) DEFFN(CProdMaitreDMsg) DEFFN(CPumpingMsg) @@ -1426,6 +1429,9 @@ void CSaveableObject::initClassList() { ADDFN(CPhonographStopMsg, CMessage); ADDFN(CPlayRangeMsg, CMessage); ADDFN(CPlayerTriesRestaurantTableMsg, CMessage); + ADDFN(CEnterNodeMsg, CMessage); + ADDFN(CEnterRoomMsg, CMessage); + ADDFN(CEnterViewMsg, CMessage); ADDFN(CPreSaveMsg, CMessage); ADDFN(CProdMaitreDMsg, CMessage); ADDFN(CPumpingMsg, CMessage); diff --git a/engines/titanic/events.cpp b/engines/titanic/events.cpp index c9e4e5dc98..09ec3e5872 100644 --- a/engines/titanic/events.cpp +++ b/engines/titanic/events.cpp @@ -26,31 +26,46 @@ #include "engines/util.h" #include "titanic/events.h" #include "titanic/titanic.h" +#include "titanic/main_game_window.h" namespace Titanic { -Events::Events(TitanicEngine *vm): _vm(vm), - _frameCounter(1), _priorFrameTime(0) { +Events::Events(TitanicEngine *vm): _vm(vm), _specialButtons(0), + _frameCounter(1), _priorFrameTime(0), _priorLeftDownTime(0), + _priorMiddleDownTime(0), _priorRightDownTime(0) { } void Events::pollEvents() { checkForNextFrameCounter(); Common::Event event; - g_system->getEventManager()->pollEvent(event); - - // Give time to the debugger - _vm->_debugger->onFrame(); + if (!g_system->getEventManager()->pollEvent(event)) + return; switch (event.type) { + case Common::EVENT_MOUSEMOVE: + _mousePos = event.mouse; + mouseMove(); + break; + case Common::EVENT_LBUTTONDOWN: + _mousePos = event.mouse; + leftButtonDown(); + break; + case Common::EVENT_LBUTTONUP: + _mousePos = event.mouse; + leftButtonUp(); + break; + case Common::EVENT_MBUTTONDOWN: + _mousePos = event.mouse; + middleButtonDown(); + break; + case Common::EVENT_MBUTTONUP: + _mousePos = event.mouse; + middleButtonUp(); + break; case Common::EVENT_KEYDOWN: - if (event.kbd.keycode == Common::KEYCODE_d && (event.kbd.flags & Common::KBD_CTRL)) { - // Attach to the debugger - _vm->_debugger->attach(); - _vm->_debugger->onFrame(); - } + keyDown(event.kbd); break; - default: break; } @@ -84,5 +99,89 @@ uint32 Events::getTicksCount() const { return g_system->getMillis(); } +#define HANDLE_MESSAGE(method) if (_vm->_window->_inputAllowed) { \ + _vm->_window->_gameManager->_inputTranslator.leftButtonDown(_specialButtons, _mousePos); \ + _vm->_window->mouseChanged(); \ + } + + +void Events::mouseMove() { + HANDLE_MESSAGE(mouseMove) +} + +void Events::leftButtonDown() { + _specialButtons |= MK_LBUTTON; + + if ((getTicksCount() - _priorLeftDownTime) < DOUBLE_CLICK_TIME) { + _priorLeftDownTime = 0; + leftButtonDoubleClick(); + } else { + _priorLeftDownTime = getTicksCount(); + HANDLE_MESSAGE(leftButtonDown) + } +} + +void Events::leftButtonUp() { + _specialButtons &= ~MK_LBUTTON; + HANDLE_MESSAGE(leftButtonUp) +} + +void Events::leftButtonDoubleClick() { + HANDLE_MESSAGE(leftButtonDoubleClick) +} + +void Events::middleButtonDown() { + _specialButtons |= MK_MBUTTON; + + if ((getTicksCount() - _priorMiddleDownTime) < DOUBLE_CLICK_TIME) { + _priorMiddleDownTime = 0; + middleButtonDoubleClick(); + } else { + _priorMiddleDownTime = getTicksCount(); + HANDLE_MESSAGE(middleButtonDown) + } +} + +void Events::middleButtonUp() { + _specialButtons &= ~MK_MBUTTON; + HANDLE_MESSAGE(middleButtonUp) +} + +void Events::middleButtonDoubleClick() { + HANDLE_MESSAGE(middleButtonDoubleClick) +} + +void Events::rightButtonDown() { + _specialButtons |= MK_RBUTTON; + + if ((getTicksCount() - _priorRightDownTime) < DOUBLE_CLICK_TIME) { + _priorRightDownTime = 0; + rightButtonDoubleClick(); + } else { + _priorRightDownTime = getTicksCount(); + HANDLE_MESSAGE(rightButtonDown) + } +} + +void Events::rightButtonUp() { + _specialButtons &= ~MK_RBUTTON; + HANDLE_MESSAGE(rightButtonUp) +} + +void Events::rightButtonDoubleClick() { + HANDLE_MESSAGE(rightButtonDoubleClick) +} + +void Events::charPress(char c) { + +} + +void Events::keyDown(Common::KeyState keyState) { + if (keyState.keycode == Common::KEYCODE_d && (keyState.flags & Common::KBD_CTRL)) { + // Attach to the debugger + _vm->_debugger->attach(); + _vm->_debugger->onFrame(); + } +} } // End of namespace Titanic diff --git a/engines/titanic/events.h b/engines/titanic/events.h index 2de04d44b1..dc1781fae1 100644 --- a/engines/titanic/events.h +++ b/engines/titanic/events.h @@ -30,6 +30,12 @@ namespace Titanic { #define GAME_FRAME_RATE 30 #define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE) +#define DOUBLE_CLICK_TIME 100 + +enum SpecialButtons { + MK_LBUTTON = 1, MK_RBUTTON = 2, MK_SHIFT = 4, MK_CONTROL = 8, + MK_MBUTTON = 0x10 +}; class TitanicEngine; @@ -38,11 +44,29 @@ private: TitanicEngine *_vm; uint32 _frameCounter; uint32 _priorFrameTime; + uint32 _priorLeftDownTime; + uint32 _priorMiddleDownTime; + uint32 _priorRightDownTime; + Common::Point _mousePos; + int _specialButtons; /** * Check whether it's time to display the next screen frame */ bool checkForNextFrameCounter(); + + void mouseMove(); + void leftButtonDown(); + void leftButtonUp(); + void leftButtonDoubleClick(); + void middleButtonDown(); + void middleButtonUp(); + void middleButtonDoubleClick(); + void rightButtonDown(); + void rightButtonUp(); + void rightButtonDoubleClick(); + void charPress(char c); + void keyDown(Common::KeyState keyState); public: Events(TitanicEngine *vm); ~Events() {} diff --git a/engines/titanic/files_manager.cpp b/engines/titanic/files_manager.cpp index 662a882e3e..d668563258 100644 --- a/engines/titanic/files_manager.cpp +++ b/engines/titanic/files_manager.cpp @@ -62,4 +62,8 @@ bool CFilesManager::scanForFile(const CString &name) { return fileExists(fname); } +void CFilesManager::fn1() { + warning("TODO: CFilesManager::fn1"); +} + } // End of namespace Titanic diff --git a/engines/titanic/files_manager.h b/engines/titanic/files_manager.h index 93505230f8..ae5703373d 100644 --- a/engines/titanic/files_manager.h +++ b/engines/titanic/files_manager.h @@ -63,6 +63,8 @@ public: * Scans for a file with a matching name */ bool scanForFile(const CString &name); + + void fn1(); }; } // End of namespace Titanic diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index efa816d8e2..aeacd73890 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -96,4 +96,8 @@ void CGameManager::fn2() { warning("TODO"); } +void CGameManager::update() { + warning("TODO: CGameManager::update"); +} + } // End of namespace Titanic diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index 1509554bf8..d132ff39ef 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -54,8 +54,6 @@ class CGameManager { private: CGameView *_gameView; CSound _sound; - CInputHandler _inputHandler; - CInputTranslator _inputTranslator; CMusicRoom _musicRoom; CTrueTalkManager _trueTalkManager; CGameManagerList _list; @@ -72,6 +70,8 @@ public: CProjectItem *_project; CGameState _gameState; Common::Rect _bounds; + CInputHandler _inputHandler; + CInputTranslator _inputTranslator; public: CGameManager(CProjectItem *project, CGameView *gameView); ~CGameManager(); @@ -104,6 +104,11 @@ public: void initBounds(); void fn2(); + + /** + * Updates the state of the manager + */ + void update(); }; } // End of namespace Titanic diff --git a/engines/titanic/input_handler.cpp b/engines/titanic/input_handler.cpp index d5825c0c32..d7199215f7 100644 --- a/engines/titanic/input_handler.cpp +++ b/engines/titanic/input_handler.cpp @@ -21,7 +21,9 @@ */ #include "titanic/input_handler.h" +#include "titanic/game_manager.h" #include "titanic/screen_manager.h" +#include "titanic/titanic.h" namespace Titanic { @@ -46,4 +48,18 @@ void CInputHandler::decLockCount() { } } +void CInputHandler::handleMessage(const CMessage &msg, bool respectLock) { + if (!respectLock || _lockCount <= 0) { + if (_gameManager->_gameState._mode == GSMODE_1) { + processMessage(msg); + } else if (!msg.isMouseMsg()) { + g_vm->_filesManager.fn1(); + } + } +} + +void CInputHandler::processMessage(const CMessage &msg) { + warning("TODO: CInputHandler::processMessage"); +} + } // End of namespace Titanic z diff --git a/engines/titanic/input_handler.h b/engines/titanic/input_handler.h index 1bc6dc9fe7..461011f63e 100644 --- a/engines/titanic/input_handler.h +++ b/engines/titanic/input_handler.h @@ -31,6 +31,11 @@ namespace Titanic { class CGameManager; class CInputHandler { +private: + /** + * Process and dispatch a passed message + */ + void processMessage(const CMessage &msg); public: CGameManager *_gameManager; CInputTranslator *_inputTranslator; @@ -56,6 +61,11 @@ public: * Decrement the lock count on the input handler */ void decLockCount(); + + /** + * Handles a genereated mouse message + */ + void handleMessage(const CMessage &msg, bool respectLock = true); }; } // End of namespace Titanic diff --git a/engines/titanic/input_translator.cpp b/engines/titanic/input_translator.cpp index b2ee6eb819..8b12646474 100644 --- a/engines/titanic/input_translator.cpp +++ b/engines/titanic/input_translator.cpp @@ -22,6 +22,8 @@ #include "titanic/input_handler.h" #include "titanic/input_translator.h" +#include "titanic/events.h" +#include "titanic/messages/mouse_messages.h" namespace Titanic { @@ -30,4 +32,57 @@ CInputTranslator::CInputTranslator(CInputHandler *inputHandler) : inputHandler->setTranslator(this); } -} // End of namespace Titanic z +int CInputTranslator::getButtons(int special) const { + int buttons = 0; + if (special & MK_LBUTTON) + buttons |= MB_LEFT; + if (special & MK_MBUTTON) + buttons |= MB_MIDDLE; + if (special & MK_RBUTTON) + buttons |= MB_RIGHT; + + return buttons; +} + +void CInputTranslator::mouseMove(int special, const Common::Point &pt) { + CMouseMoveMsg msg(pt, getButtons(special)); + _inputHandler->handleMessage(msg); +} + +void CInputTranslator::leftButtonDown(int special, const Common::Point &pt) { + +} + +void CInputTranslator::leftButtonUp(int special, const Common::Point &pt) { + +} + +void CInputTranslator::leftButtonDoubleClick(int special, const Common::Point &pt) { + +} + +void CInputTranslator::middleButtonDown(int special, const Common::Point &pt) { + +} + +void CInputTranslator::middleButtonUp(int special, const Common::Point &pt) { + +} + +void CInputTranslator::middleButtonDoubleClick(int special, const Common::Point &pt) { + +} + +void CInputTranslator::rightButtonDown(int special, const Common::Point &pt) { + +} + +void CInputTranslator::rightButtonUp(int special, const Common::Point &pt) { + +} + +void CInputTranslator::rightButtonDoubleClick(int special, const Common::Point &pt) { + +} + +} // End of namespace Titanic diff --git a/engines/titanic/input_translator.h b/engines/titanic/input_translator.h index 98cd2bb09e..2748ca4951 100644 --- a/engines/titanic/input_translator.h +++ b/engines/titanic/input_translator.h @@ -23,15 +23,33 @@ #ifndef TITANIC_INPUT_TRANSLATOR_H #define TITANIC_INPUT_TRANSLATOR_H +#include "titanic/messages/mouse_messages.h" + namespace Titanic { class CInputHandler; class CInputTranslator { +private: + /** + * Converts the special buttons bitset into a buttons bitset + */ + int getButtons(int special) const; public: CInputHandler *_inputHandler; public: CInputTranslator(CInputHandler *inputHandler); + + void mouseMove(int special, const Common::Point &pt); + void leftButtonDown(int special, const Common::Point &pt); + void leftButtonUp(int special, const Common::Point &pt); + void leftButtonDoubleClick(int special, const Common::Point &pt); + void middleButtonDown(int special, const Common::Point &pt); + void middleButtonUp(int special, const Common::Point &pt); + void middleButtonDoubleClick(int special, const Common::Point &pt); + void rightButtonDown(int special, const Common::Point &pt); + void rightButtonUp(int special, const Common::Point &pt); + void rightButtonDoubleClick(int special, const Common::Point &pt); }; } // End of namespace Titanic diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index a964f928f9..429991dab7 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -32,7 +32,7 @@ CMainGameWindow::CMainGameWindow(TitanicEngine *vm): _vm(vm) { _gameView = nullptr; _gameManager = nullptr; _project = nullptr; - _field50 = 0; + _inputAllowed = false; _image = nullptr; _cursor = nullptr; } @@ -134,4 +134,9 @@ void CMainGameWindow::fn2() { } } +void CMainGameWindow::mouseChanged() { + if (_gameManager->_gameState._mode != GSMODE_5) + _gameManager->update(); +} + } // End of namespace Titanic diff --git a/engines/titanic/main_game_window.h b/engines/titanic/main_game_window.h index eedac23ef8..6a72dbf45e 100644 --- a/engines/titanic/main_game_window.h +++ b/engines/titanic/main_game_window.h @@ -53,7 +53,7 @@ public: CGameView *_gameView; CGameManager *_gameManager; CProjectItem *_project; - int _field50; + bool _inputAllowed; Image *_image; void *_cursor; public: @@ -75,6 +75,11 @@ public: void setActiveView(CViewItem *viewItem); void fn2(); + + /** + * Called by the event handler when a mouse event has been generated + */ + void mouseChanged(); }; } // End of namespace Titanic diff --git a/engines/titanic/messages/messages.cpp b/engines/titanic/messages/messages.cpp index 00debc562c..b44748d899 100644 --- a/engines/titanic/messages/messages.cpp +++ b/engines/titanic/messages/messages.cpp @@ -21,6 +21,7 @@ */ #include "titanic/messages/messages.h" +#include "titanic/messages/mouse_messages.h" #include "titanic/core/game_object.h" #include "titanic/core/tree_item.h" @@ -66,4 +67,60 @@ bool CMessage::execute(CTreeItem *target, const ClassDef *classDef, int flags) c return result; } +bool CMessage::isMouseMsg() const { + return dynamic_cast(this) != nullptr; +} + +bool CMessage::isButtonDownMsg() const { + return dynamic_cast(this) != nullptr; +} + +bool CMessage::isButtonUpMsg() const { + return dynamic_cast(this) != nullptr; +} + +bool CMessage::isMouseMoveMsg() const { + return dynamic_cast(this) != nullptr; +} + +bool CMessage::isDoubleClickMsg() const { + return dynamic_cast(this) != nullptr; +} + +bool CMessage::isEnterRoomMsg() const { + return dynamic_cast(this) != nullptr; +} + +bool CMessage::isPreEnterRoomMsg() const { + return dynamic_cast(this) != nullptr; +} + +bool CMessage::isleaveRoomMsg() const { + return dynamic_cast(this) != nullptr; +} + +bool CMessage::isEnterNodeMsg() const { + return dynamic_cast(this) != nullptr; +} + +bool CMessage::isPreEnterNodeMsg() const { + return dynamic_cast(this) != nullptr; +} + +bool CMessage::isLeaveNodeMsg() const { + return dynamic_cast(this) != nullptr; +} + +bool CMessage::isEnterViewMsg() const { + return dynamic_cast(this) != nullptr; +} + +bool CMessage::isPreEnterViewMsg() const { + return dynamic_cast(this) != nullptr; +} + +bool CMessage::isLeaveViewMsg() const { + return dynamic_cast(this) != nullptr; +} + } // End of namespace Titanic diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 958275868d..d22144332b 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -59,6 +59,21 @@ public: * Load the data for the class from file */ virtual void load(SimpleFile *file); + + virtual bool isMouseMsg() const; + virtual bool isButtonDownMsg() const; + virtual bool isButtonUpMsg() const; + virtual bool isMouseMoveMsg() const; + virtual bool isDoubleClickMsg() const; + virtual bool isEnterRoomMsg() const; + virtual bool isPreEnterRoomMsg() const; + virtual bool isleaveRoomMsg() const; + virtual bool isEnterNodeMsg() const; + virtual bool isPreEnterNodeMsg() const; + virtual bool isLeaveNodeMsg() const; + virtual bool isEnterViewMsg() const; + virtual bool isPreEnterViewMsg() const; + virtual bool isLeaveViewMsg() const; }; MSGTARGET(CEditControlMsg); @@ -244,6 +259,9 @@ MESSAGE1(CDropobjectMsg, int, value, 0); MESSAGE1(CDropZoneGotObjectMsg, int, value, 0); MESSAGE1(CDropZoneLostObjectMsg, int, value, 0); MESSAGE1(CEjectCylinderMsg, int, value, 0); +MESSAGE1(CPreEnterNodeMsg, CNodeItem *, node, nullptr); +MESSAGE1(CPreEnterRoomMsg, CRoomItem *, room, nullptr); +MESSAGE1(CPreEnterViewMsg, CViewItem *, view, nullptr); MESSAGE1(CEnterNodeMsg, CNodeItem *, node, nullptr); MESSAGE1(CEnterRoomMsg, CRoomItem *, room, nullptr); MESSAGE1(CEnterViewMsg, CViewItem *, view, nullptr); diff --git a/engines/titanic/messages/mouse_messages.h b/engines/titanic/messages/mouse_messages.h index 0386eb6bd9..e36b54dcc0 100644 --- a/engines/titanic/messages/mouse_messages.h +++ b/engines/titanic/messages/mouse_messages.h @@ -23,10 +23,13 @@ #ifndef TITANIC_MOUSE_MESSAGES_H #define TITANIC_MOUSE_MESSAGES_H +#include "common/rect.h" #include "titanic/messages/messages.h" namespace Titanic { +enum MouseButton { MB_LEFT = 1, MB_MIDDLE = 2, MB_RIGHT = 4 }; + class CMouseMsg : public CMessage { public: int _buttons; @@ -34,12 +37,16 @@ public: public: CLASSDEF CMouseMsg() : _buttons(0) {} + CMouseMsg(const Common::Point &pt, int buttons) : + _mousePos(pt), _buttons(buttons) {} }; MSGTARGET(CMouseMoveMsg); class CMouseMoveMsg : public CMouseMsg { public: CLASSDEF + CMouseMoveMsg() : CMouseMsg() {} + CMouseMoveMsg(const Common::Point &pt, int buttons) : CMouseMsg(pt, buttons) {} virtual bool handleMessage(const CMouseMoveMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { @@ -54,12 +61,15 @@ public: public: CLASSDEF CMouseButtonMsg() : CMouseMsg(), _field10(0) {} + CMouseButtonMsg(const Common::Point &pt, int buttons) : CMouseMsg(pt, buttons) {} }; MSGTARGET(CMouseButtonDownMsg); class CMouseButtonDownMsg : public CMouseButtonMsg { public: CLASSDEF + CMouseButtonDownMsg() : CMouseButtonMsg() {} + CMouseButtonDownMsg(const Common::Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} virtual bool handleMessage(const CMouseButtonDownMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { @@ -72,6 +82,8 @@ MSGTARGET(CMouseButtonUpMsg); class CMouseButtonUpMsg : public CMouseButtonMsg { public: CLASSDEF + CMouseButtonUpMsg() : CMouseButtonMsg() {} + CMouseButtonUpMsg(const Common::Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} virtual bool handleMessage(const CMouseButtonUpMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { @@ -84,6 +96,8 @@ MSGTARGET(CMouseButtonDoubleClickMsg); class CMouseButtonDoubleClickMsg : public CMouseButtonMsg { public: CLASSDEF + CMouseButtonDoubleClickMsg() : CMouseButtonMsg() {} + CMouseButtonDoubleClickMsg(const Common::Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} virtual bool handleMessage(const CMouseButtonDoubleClickMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { -- cgit v1.2.3 From 7a38b51357ba581fe51a392a031d09dd238039e8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 18 Mar 2016 23:15:31 -0400 Subject: TITANIC: Implemented drag/drop handling --- engines/titanic/game_manager.cpp | 2 +- engines/titanic/game_manager.h | 2 +- engines/titanic/game_state.cpp | 6 ++- engines/titanic/game_state.h | 8 ++- engines/titanic/input_handler.cpp | 88 ++++++++++++++++++++++++++++--- engines/titanic/input_handler.h | 22 +++++--- engines/titanic/messages/mouse_messages.h | 16 ++++-- 7 files changed, 123 insertions(+), 21 deletions(-) diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index aeacd73890..a2732d8b1c 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -48,7 +48,7 @@ CGameManager::CGameManager(CProjectItem *project, CGameView *gameView): _inputHandler(this), _inputTranslator(&_inputHandler), _gameState(this), _sound(this), _musicRoom(this), _field30(0), _field34(0), _field4C(0), - _field50(0), _field54(0), _tickCount1(0), _tickCount2(0) { + _dragItem(nullptr), _field54(0), _tickCount1(0), _tickCount2(0) { _videoSurface1 = nullptr; _videoSurface2 = CScreenManager::_screenManagerPtr->createSurface(600, 340); diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index d132ff39ef..a331f3a0b4 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -61,7 +61,6 @@ private: int _field34; CVideoSurface *_videoSurface1; int _field4C; - int _field50; int _field54; CVideoSurface *_videoSurface2; uint _tickCount1; @@ -72,6 +71,7 @@ public: Common::Rect _bounds; CInputHandler _inputHandler; CInputTranslator _inputTranslator; + CTreeItem *_dragItem; public: CGameManager(CProjectItem *project, CGameView *gameView); ~CGameManager(); diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index 3ce8b2b42e..30185fc5f6 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -30,7 +30,7 @@ CGameState::CGameState(CGameManager *gameManager) : _gameManager(gameManager), _gameLocation(this), _field8(0), _fieldC(0), _mode(GSMODE_0), _field14(0), _field18(0), _field1C(0), _field20(0), _field24(0), _field28(0), _field2C(0), - _field30(0), _field34(0), _field38(0) { + _field38(0) { } void CGameState::save(SimpleFile *file) const { @@ -78,4 +78,8 @@ void CGameState::setMode(GameStateMode newMode) { _mode = newMode; } +void CGameState::setMousePos(const Common::Point &pt) { + _mousePos = pt; +} + } // End of namespace Titanic z diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h index 3c3b720d95..1c0b750a44 100644 --- a/engines/titanic/game_state.h +++ b/engines/titanic/game_state.h @@ -56,8 +56,7 @@ public: int _field24; int _field28; int _field2C; - int _field30; - int _field34; + Common::Point _mousePos; int _field38; public: CGameState(CGameManager *gameManager); @@ -76,6 +75,11 @@ public: * Sets a new mode */ void setMode(GameStateMode newMode); + + /** + * Sets the current mouse position + */ + void setMousePos(const Common::Point &pt); }; } // End of namespace Titanic diff --git a/engines/titanic/input_handler.cpp b/engines/titanic/input_handler.cpp index d7199215f7..5d50c00377 100644 --- a/engines/titanic/input_handler.cpp +++ b/engines/titanic/input_handler.cpp @@ -24,13 +24,13 @@ #include "titanic/game_manager.h" #include "titanic/screen_manager.h" #include "titanic/titanic.h" +#include "titanic/pet_control/pet_control.h" namespace Titanic { CInputHandler::CInputHandler(CGameManager *owner) : - _gameManager(owner), _inputTranslator(nullptr), - _field4(0), _field8(0), _fieldC(0), _field10(0), _field14(0), - _lockCount(0), _field24(0) { + _gameManager(owner), _inputTranslator(nullptr), _dragging(false), + _buttonDown(false), _dragItem(nullptr), _lockCount(0), _field24(0) { CScreenManager::_screenManagerPtr->_inputHandler = this; } @@ -51,15 +51,91 @@ void CInputHandler::decLockCount() { void CInputHandler::handleMessage(const CMessage &msg, bool respectLock) { if (!respectLock || _lockCount <= 0) { if (_gameManager->_gameState._mode == GSMODE_1) { - processMessage(msg); + processMessage(&msg); } else if (!msg.isMouseMsg()) { g_vm->_filesManager.fn1(); } } } -void CInputHandler::processMessage(const CMessage &msg) { - warning("TODO: CInputHandler::processMessage"); +void CInputHandler::processMessage(const CMessage *msg) { + const CMouseMsg *mouseMsg = dynamic_cast(msg); + _field24 = 0; + dispatchMessage(msg); + + if (_field24) { + _field24 = 0; + } else if (mouseMsg) { + // Keep the game state mouse position up to date + if (_mousePos != mouseMsg->_mousePos) { + _mousePos = mouseMsg->_mousePos; + _gameManager->_gameState.setMousePos(mouseMsg->_mousePos); + } + + // Set flag for whether a mouse button is currently being pressed + if (mouseMsg->isButtonDownMsg()) + _buttonDown = true; + else if (mouseMsg->isButtonUpMsg()) + _buttonDown = false; + + // Drag events generation + if (_dragging) { + if (mouseMsg->isMouseMoveMsg()) { + if (_dragItem) { + CMouseDragMoveMsg moveMsg(_mousePos); + moveMsg.execute(_dragItem); + } + } else { + if (mouseMsg->isButtonUpMsg() && _dragItem) { + // Mouse drag ended + dragEnd(_mousePos, _dragItem); + CMouseDragEndMsg endMsg(_mousePos, _dragItem); + endMsg.execute(_dragItem); + } + + _dragging = false; + _dragItem = nullptr; + } + } else if (_buttonDown) { + if (!mouseMsg->isMouseMoveMsg()) { + // Save where the drag movement started from + _dragStartPos = _mousePos; + } else { + Common::Point delta = mouseMsg->_mousePos - _dragStartPos; + int distance = (int)sqrt(double(delta.x * delta.x + delta.y * delta.y)); + + if (distance > 4) { + // We've moved far enough with the mouse button held down + // to trigger an official dragging operation + CMouseDragStartMsg startMsg(_dragStartPos); + dispatchMessage(&startMsg); + + // Set the drag item, if any, that a handler will have set on the message + _dragItem = startMsg._dragItem; + _gameManager->_dragItem = startMsg._dragItem; + + if (_dragItem) { + CMouseDragMoveMsg moveMsg(_dragStartPos); + dispatchMessage(&moveMsg); + } + + _dragging = true; + } + } + } + } +} + +void CInputHandler::dispatchMessage(const CMessage *msg) { + CPetControl *pet = _gameManager->_project->getPetControl(); + if (!pet || !msg->execute(pet, nullptr, MSGFLAG_BREAK_IF_HANDLED)) { + CViewItem *view = _gameManager->getView(); + msg->execute(view); + } +} + +void CInputHandler::dragEnd(const Common::Point &mousePos, CTreeItem *dragItem) { + warning("TODO CInputHandler::dragEnd"); } } // End of namespace Titanic z diff --git a/engines/titanic/input_handler.h b/engines/titanic/input_handler.h index 461011f63e..ad1ba86215 100644 --- a/engines/titanic/input_handler.h +++ b/engines/titanic/input_handler.h @@ -25,6 +25,7 @@ #include "common/rect.h" #include "titanic/input_translator.h" +#include "titanic/core/tree_item.h" namespace Titanic { @@ -35,15 +36,24 @@ private: /** * Process and dispatch a passed message */ - void processMessage(const CMessage &msg); + void processMessage(const CMessage *msg); + + /** + * Dispatches a message to the project + */ + void dispatchMessage(const CMessage *msg); + + /** + * Called when a drag operation has ended + */ + void dragEnd(const Common::Point &mousePos, CTreeItem *dragItem); public: CGameManager *_gameManager; CInputTranslator *_inputTranslator; - int _field4; - int _field8; - int _fieldC; - int _field10; - int _field14; + bool _dragging; + bool _buttonDown; + CTreeItem *_dragItem; + Common::Point _dragStartPos; Common::Point _mousePos; int _lockCount; int _field24; diff --git a/engines/titanic/messages/mouse_messages.h b/engines/titanic/messages/mouse_messages.h index e36b54dcc0..fff392e465 100644 --- a/engines/titanic/messages/mouse_messages.h +++ b/engines/titanic/messages/mouse_messages.h @@ -109,11 +109,15 @@ public: class CMouseDragMsg : public CMouseMsg { public: CLASSDEF + CMouseDragMsg() : CMouseMsg() {} + CMouseDragMsg(const Common::Point &pt) : CMouseMsg(pt, 0) {} }; class CMouseDragMoveMsg : public CMouseDragMsg { public: CLASSDEF + CMouseDragMoveMsg() : CMouseDragMsg() {} + CMouseDragMoveMsg(const Common::Point &pt) : CMouseDragMsg(pt) {} virtual bool handleMessage(const CMouseDragMoveMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { @@ -125,11 +129,13 @@ public: MSGTARGET(CMouseDragStartMsg); class CMouseDragStartMsg : public CMouseDragMsg { public: - int _field10; + CTreeItem *_dragItem; int _field14; public: CLASSDEF - CMouseDragStartMsg() : CMouseDragMsg(), _field10(0), _field14(0) {} + CMouseDragStartMsg() : CMouseDragMsg(), _dragItem(nullptr), _field14(0) {} + CMouseDragStartMsg(const Common::Point &pt) : CMouseDragMsg(pt), + _dragItem(nullptr), _field14(0) {} virtual bool handleMessage(const CMouseDragStartMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { @@ -141,10 +147,12 @@ public: MSGTARGET(CMouseDragEndMsg); class CMouseDragEndMsg : public CMouseDragMsg { public: - int _field10; + CTreeItem *_dragItem; public: CLASSDEF - CMouseDragEndMsg() : CMouseDragMsg(), _field10(0) {} + CMouseDragEndMsg() : CMouseDragMsg(), _dragItem(nullptr) {} + CMouseDragEndMsg(const Common::Point &pt, CTreeItem *dragItem = nullptr) : + CMouseDragMsg(pt), _dragItem(dragItem) {} virtual bool handleMessage(const CMouseDragEndMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { -- cgit v1.2.3 From 4f5202f958d55ccfda6e67a6b8933630de240e87 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 18 Mar 2016 23:18:59 -0400 Subject: TITANIC: Remove const prefix from passed messages Turns out that some of the messages have properties that the objects that handle them can set. For example, the CMouseDragStartMsg has a _dragItem property that an item that allows dragging will explicitly set, allowing the input handler to keep track of what was dragged. --- engines/titanic/game/arboretum_gate.cpp | 14 +++++++------- engines/titanic/game/arboretum_gate.h | 14 +++++++------- engines/titanic/game/auto_animate.cpp | 2 +- engines/titanic/game/auto_animate.h | 2 +- engines/titanic/game/bar_bell.cpp | 2 +- engines/titanic/game/bar_bell.h | 2 +- engines/titanic/game/bomb.cpp | 2 +- engines/titanic/game/bomb.h | 2 +- engines/titanic/game/chicken_cooler.cpp | 2 +- engines/titanic/game/chicken_cooler.h | 2 +- engines/titanic/game/doorbot_elevator_handler.cpp | 2 +- engines/titanic/game/doorbot_elevator_handler.h | 2 +- engines/titanic/game/end_sequence_control.cpp | 2 +- engines/titanic/game/end_sequence_control.h | 2 +- engines/titanic/game/fan_noises.cpp | 2 +- engines/titanic/game/fan_noises.h | 2 +- engines/titanic/game/get_lift_eye2.cpp | 2 +- engines/titanic/game/get_lift_eye2.h | 2 +- engines/titanic/game/gondolier/gondolier_mixer.cpp | 2 +- engines/titanic/game/gondolier/gondolier_mixer.h | 2 +- engines/titanic/game/light.cpp | 2 +- engines/titanic/game/light.h | 2 +- engines/titanic/game/light_switch.cpp | 2 +- engines/titanic/game/light_switch.h | 2 +- engines/titanic/game/long_stick_dispenser.cpp | 2 +- engines/titanic/game/long_stick_dispenser.h | 2 +- engines/titanic/game/parrot/player_meets_parrot.cpp | 2 +- engines/titanic/game/parrot/player_meets_parrot.h | 2 +- engines/titanic/game/pet/pet_monitor.cpp | 2 +- engines/titanic/game/pet/pet_monitor.h | 2 +- engines/titanic/game/pet/pet_position.cpp | 2 +- engines/titanic/game/pet/pet_position.h | 2 +- engines/titanic/game/pet/pet_transport.cpp | 2 +- engines/titanic/game/pet/pet_transport.h | 2 +- engines/titanic/game/phonograph.cpp | 2 +- engines/titanic/game/phonograph.h | 2 +- engines/titanic/game/sgt/sgt_state_room.cpp | 2 +- engines/titanic/game/sgt/sgt_state_room.h | 2 +- engines/titanic/game/ship_setting.cpp | 2 +- engines/titanic/game/ship_setting.h | 2 +- engines/titanic/game/transport/lift.cpp | 2 +- engines/titanic/game/transport/lift.h | 2 +- engines/titanic/game/transport/lift_indicator.h | 2 +- engines/titanic/game/transport/pellerator.cpp | 2 +- engines/titanic/game/transport/pellerator.h | 2 +- engines/titanic/game/up_lighter.cpp | 2 +- engines/titanic/game/up_lighter.h | 2 +- engines/titanic/game/volume_control.cpp | 2 +- engines/titanic/game/volume_control.h | 2 +- engines/titanic/messages/bilge_dispensor_event.cpp | 2 +- engines/titanic/messages/bilge_dispensor_event.h | 2 +- engines/titanic/messages/messages.h | 2 +- engines/titanic/moves/enter_bridge.cpp | 2 +- engines/titanic/moves/enter_bridge.h | 2 +- engines/titanic/npcs/barbot.cpp | 2 +- engines/titanic/npcs/barbot.h | 2 +- engines/titanic/npcs/liftbot.cpp | 2 +- engines/titanic/npcs/liftbot.h | 2 +- engines/titanic/sound/auto_music_player.cpp | 2 +- engines/titanic/sound/auto_music_player.h | 2 +- engines/titanic/sound/music_player.cpp | 2 +- engines/titanic/sound/music_player.h | 2 +- engines/titanic/sound/node_auto_sound_player.cpp | 2 +- engines/titanic/sound/node_auto_sound_player.h | 2 +- engines/titanic/sound/restricted_auto_music_player.cpp | 2 +- engines/titanic/sound/restricted_auto_music_player.h | 2 +- engines/titanic/sound/room_auto_sound_player.cpp | 2 +- engines/titanic/sound/room_auto_sound_player.h | 2 +- engines/titanic/sound/room_trigger_auto_music_player.cpp | 2 +- engines/titanic/sound/room_trigger_auto_music_player.h | 2 +- engines/titanic/sound/titania_speech.cpp | 2 +- engines/titanic/sound/titania_speech.h | 2 +- 72 files changed, 84 insertions(+), 84 deletions(-) diff --git a/engines/titanic/game/arboretum_gate.cpp b/engines/titanic/game/arboretum_gate.cpp index f4193b0f2f..a892e65fc8 100644 --- a/engines/titanic/game/arboretum_gate.cpp +++ b/engines/titanic/game/arboretum_gate.cpp @@ -133,17 +133,17 @@ void CArboretumGate::load(SimpleFile *file) { CBackground::load(file); } -bool CArboretumGate::handleEvent(const CActMsg &msg) { return false; } -bool CArboretumGate::handleEvent(const CLeaveViewMsg &msg) { return false; } -bool CArboretumGate::handleEvent(const CTurnOff &msg) { return false; } -bool CArboretumGate::handleEvent(const CMouseButtonDownMsg &msg) { return false; } +bool CArboretumGate::handleEvent(CActMsg &msg) { return false; } +bool CArboretumGate::handleEvent(CLeaveViewMsg &msg) { return false; } +bool CArboretumGate::handleEvent(CTurnOff &msg) { return false; } +bool CArboretumGate::handleEvent(CMouseButtonDownMsg &msg) { return false; } -bool CArboretumGate::handleEvent(const CEnterViewMsg &msg) { +bool CArboretumGate::handleEvent(CEnterViewMsg &msg) { warning("CArboretumGate::handleEvent"); return false; } -bool CArboretumGate::handleEvent(const CTurnOn &msg) { return false; } -bool CArboretumGate::handleEvent(const CMovieEndMsg &msg) { return false; } +bool CArboretumGate::handleEvent(CTurnOn &msg) { return false; } +bool CArboretumGate::handleEvent(CMovieEndMsg &msg) { return false; } } // End of namespace Titanic diff --git a/engines/titanic/game/arboretum_gate.h b/engines/titanic/game/arboretum_gate.h index 514192e151..7432799460 100644 --- a/engines/titanic/game/arboretum_gate.h +++ b/engines/titanic/game/arboretum_gate.h @@ -69,13 +69,13 @@ private: int _field150; CString _string2; protected: - virtual bool handleEvent(const CActMsg &msg); - virtual bool handleEvent(const CLeaveViewMsg &msg); - virtual bool handleEvent(const CTurnOff &msg); - virtual bool handleEvent(const CMouseButtonDownMsg &msg); - virtual bool handleEvent(const CEnterViewMsg &msg); - virtual bool handleEvent(const CTurnOn &msg); - virtual bool handleEvent(const CMovieEndMsg &msg); + virtual bool handleEvent(CActMsg &msg); + virtual bool handleEvent(CLeaveViewMsg &msg); + virtual bool handleEvent(CTurnOff &msg); + virtual bool handleEvent(CMouseButtonDownMsg &msg); + virtual bool handleEvent(CEnterViewMsg &msg); + virtual bool handleEvent(CTurnOn &msg); + virtual bool handleEvent(CMovieEndMsg &msg); public: CLASSDEF CArboretumGate(); diff --git a/engines/titanic/game/auto_animate.cpp b/engines/titanic/game/auto_animate.cpp index c79fa74167..958200f4cc 100644 --- a/engines/titanic/game/auto_animate.cpp +++ b/engines/titanic/game/auto_animate.cpp @@ -40,7 +40,7 @@ void CAutoAnimate::load(SimpleFile *file) { CBackground::load(file); } -bool CAutoAnimate::handleEvent(const CEnterViewMsg &msg) { +bool CAutoAnimate::handleEvent(CEnterViewMsg &msg) { warning("CAutoAnimate::handleEvent"); return true; } diff --git a/engines/titanic/game/auto_animate.h b/engines/titanic/game/auto_animate.h index 160fe09d90..56e40a470c 100644 --- a/engines/titanic/game/auto_animate.h +++ b/engines/titanic/game/auto_animate.h @@ -34,7 +34,7 @@ private: int _fieldE4; int _fieldE8; protected: - virtual bool handleEvent(const CEnterViewMsg &msg); + virtual bool handleEvent(CEnterViewMsg &msg); public: CLASSDEF CAutoAnimate() : CBackground(), _fieldE0(1), _fieldE4(1), _fieldE8(0) {} diff --git a/engines/titanic/game/bar_bell.cpp b/engines/titanic/game/bar_bell.cpp index 1639b7da39..1ac7568b0f 100644 --- a/engines/titanic/game/bar_bell.cpp +++ b/engines/titanic/game/bar_bell.cpp @@ -50,7 +50,7 @@ void CBarBell::load(SimpleFile *file) { CGameObject::load(file); } -bool CBarBell::handleEvent(const CEnterRoomMsg &msg) { +bool CBarBell::handleEvent(CEnterRoomMsg &msg) { _fieldBC = 0; return true; } diff --git a/engines/titanic/game/bar_bell.h b/engines/titanic/game/bar_bell.h index 432bf3a281..111b0ac267 100644 --- a/engines/titanic/game/bar_bell.h +++ b/engines/titanic/game/bar_bell.h @@ -36,7 +36,7 @@ public: int _fieldC8; int _fieldCC; protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF CBarBell(); diff --git a/engines/titanic/game/bomb.cpp b/engines/titanic/game/bomb.cpp index e4cf1b3830..a8bf15ec33 100644 --- a/engines/titanic/game/bomb.cpp +++ b/engines/titanic/game/bomb.cpp @@ -70,7 +70,7 @@ void CBomb::load(SimpleFile *file) { CBackground::load(file); } -bool CBomb::handleEvent(const CEnterRoomMsg &msg) { +bool CBomb::handleEvent(CEnterRoomMsg &msg) { _fieldE8 = 12; _fieldEC = 9; _fieldF0 = 0; diff --git a/engines/titanic/game/bomb.h b/engines/titanic/game/bomb.h index 4c7c9526ea..9cbdf84081 100644 --- a/engines/titanic/game/bomb.h +++ b/engines/titanic/game/bomb.h @@ -41,7 +41,7 @@ private: int _startingTicks; int _field104; protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF CBomb(); diff --git a/engines/titanic/game/chicken_cooler.cpp b/engines/titanic/game/chicken_cooler.cpp index 54acc405fd..4ece0d6d05 100644 --- a/engines/titanic/game/chicken_cooler.cpp +++ b/engines/titanic/game/chicken_cooler.cpp @@ -40,7 +40,7 @@ void CChickenCooler::load(SimpleFile *file) { CGameObject::load(file); } -bool CChickenCooler::handleEvent(const CEnterRoomMsg &msg) { +bool CChickenCooler::handleEvent(CEnterRoomMsg &msg) { warning("CChickenCoolor::handlEvent"); return true; } diff --git a/engines/titanic/game/chicken_cooler.h b/engines/titanic/game/chicken_cooler.h index 6f75649957..210183a474 100644 --- a/engines/titanic/game/chicken_cooler.h +++ b/engines/titanic/game/chicken_cooler.h @@ -33,7 +33,7 @@ private: int _fieldBC; int _fieldC0; protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF CChickenCooler() : CGameObject(), _fieldBC(0), _fieldC0(0) {} diff --git a/engines/titanic/game/doorbot_elevator_handler.cpp b/engines/titanic/game/doorbot_elevator_handler.cpp index b8cec40e1a..718a464bf3 100644 --- a/engines/titanic/game/doorbot_elevator_handler.cpp +++ b/engines/titanic/game/doorbot_elevator_handler.cpp @@ -40,7 +40,7 @@ void CDoorbotElevatorHandler::load(SimpleFile *file) { CGameObject::load(file); } -bool CDoorbotElevatorHandler::handleEvent(const CEnterNodeMsg &msg) { +bool CDoorbotElevatorHandler::handleEvent(CEnterNodeMsg &msg) { warning("CDoorbotElevatorHandler::handleEvent"); return true; } diff --git a/engines/titanic/game/doorbot_elevator_handler.h b/engines/titanic/game/doorbot_elevator_handler.h index 4c34248a71..04f3a75b18 100644 --- a/engines/titanic/game/doorbot_elevator_handler.h +++ b/engines/titanic/game/doorbot_elevator_handler.h @@ -33,7 +33,7 @@ private: static int _v1; int _value; protected: - virtual bool handleEvent(const CEnterNodeMsg &msg); + virtual bool handleEvent(CEnterNodeMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/end_sequence_control.cpp b/engines/titanic/game/end_sequence_control.cpp index f930d61787..c3f5a2a007 100644 --- a/engines/titanic/game/end_sequence_control.cpp +++ b/engines/titanic/game/end_sequence_control.cpp @@ -34,7 +34,7 @@ void CEndSequenceControl::load(SimpleFile *file) { CGameObject::load(file); } -bool CEndSequenceControl::handleEvent(const CEnterRoomMsg &msg) { +bool CEndSequenceControl::handleEvent(CEnterRoomMsg &msg) { warning("TODO: CEndSequenceControl::handleEvent"); return true; } diff --git a/engines/titanic/game/end_sequence_control.h b/engines/titanic/game/end_sequence_control.h index fb1fa3a13c..d0ddd9c920 100644 --- a/engines/titanic/game/end_sequence_control.h +++ b/engines/titanic/game/end_sequence_control.h @@ -30,7 +30,7 @@ namespace Titanic { class CEndSequenceControl : public CGameObject, CEnterRoomMsgTarget { protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/fan_noises.cpp b/engines/titanic/game/fan_noises.cpp index 6627332465..7ec55c46f9 100644 --- a/engines/titanic/game/fan_noises.cpp +++ b/engines/titanic/game/fan_noises.cpp @@ -55,7 +55,7 @@ void CFanNoises::load(SimpleFile *file) { CGameObject::load(file); } -bool CFanNoises::handleEvent(const CEnterRoomMsg &msg) { +bool CFanNoises::handleEvent(CEnterRoomMsg &msg) { warning("CFanNoises::handleEvent"); return true; } diff --git a/engines/titanic/game/fan_noises.h b/engines/titanic/game/fan_noises.h index 2cd96a33cb..835d853d09 100644 --- a/engines/titanic/game/fan_noises.h +++ b/engines/titanic/game/fan_noises.h @@ -38,7 +38,7 @@ private: int _fieldD0; int _fieldD4; protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF CFanNoises(); diff --git a/engines/titanic/game/get_lift_eye2.cpp b/engines/titanic/game/get_lift_eye2.cpp index bc51f7cabc..7894c5ef58 100644 --- a/engines/titanic/game/get_lift_eye2.cpp +++ b/engines/titanic/game/get_lift_eye2.cpp @@ -46,7 +46,7 @@ void CGetLiftEye2::load(SimpleFile *file) { CGameObject::load(file); } -bool CGetLiftEye2::handleEvent(const CEnterRoomMsg &msg) { +bool CGetLiftEye2::handleEvent(CEnterRoomMsg &msg) { warning("CGetLiftEye2::handleEvent"); return true; } diff --git a/engines/titanic/game/get_lift_eye2.h b/engines/titanic/game/get_lift_eye2.h index d9465b48bc..5803ad03bd 100644 --- a/engines/titanic/game/get_lift_eye2.h +++ b/engines/titanic/game/get_lift_eye2.h @@ -31,7 +31,7 @@ class CGetLiftEye2 : public CGameObject, CEnterRoomMsgTarget { private: static CString *_v1; protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF static void init(); diff --git a/engines/titanic/game/gondolier/gondolier_mixer.cpp b/engines/titanic/game/gondolier/gondolier_mixer.cpp index 391c513ccc..f4fb655cf2 100644 --- a/engines/titanic/game/gondolier/gondolier_mixer.cpp +++ b/engines/titanic/game/gondolier/gondolier_mixer.cpp @@ -56,7 +56,7 @@ void CGondolierMixer::load(SimpleFile *file) { CGondolierBase::load(file); } -bool CGondolierMixer::handleEvent(const CEnterRoomMsg &msg) { +bool CGondolierMixer::handleEvent(CEnterRoomMsg &msg) { CTreeItem *parent = getParent(); if (parent == msg._room) msg.execute(parent); diff --git a/engines/titanic/game/gondolier/gondolier_mixer.h b/engines/titanic/game/gondolier/gondolier_mixer.h index ce8959b77a..1288290d6f 100644 --- a/engines/titanic/game/gondolier/gondolier_mixer.h +++ b/engines/titanic/game/gondolier/gondolier_mixer.h @@ -38,7 +38,7 @@ private: CString _string2; int _fieldE4; protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF CGondolierMixer(); diff --git a/engines/titanic/game/light.cpp b/engines/titanic/game/light.cpp index 7a24391b0e..856e6a463f 100644 --- a/engines/titanic/game/light.cpp +++ b/engines/titanic/game/light.cpp @@ -57,7 +57,7 @@ void CLight::load(SimpleFile *file) { CBackground::load(file); } -bool CLight::handleEvent(const CEnterRoomMsg &msg) { +bool CLight::handleEvent(CEnterRoomMsg &msg) { warning("CLight::handleEvent"); return true; } diff --git a/engines/titanic/game/light.h b/engines/titanic/game/light.h index 650e6ba87e..42e7224a72 100644 --- a/engines/titanic/game/light.h +++ b/engines/titanic/game/light.h @@ -39,7 +39,7 @@ private: int _fieldF8; int _fieldFC; protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF CLight(); diff --git a/engines/titanic/game/light_switch.cpp b/engines/titanic/game/light_switch.cpp index 5e1b94ac18..b857bfb159 100644 --- a/engines/titanic/game/light_switch.cpp +++ b/engines/titanic/game/light_switch.cpp @@ -50,7 +50,7 @@ void CLightSwitch::load(SimpleFile *file) { CBackground::load(file); } -bool CLightSwitch::handleEvent(const CEnterRoomMsg &msg) { +bool CLightSwitch::handleEvent(CEnterRoomMsg &msg) { warning("CLightSwitch::handleEvent"); return true; } diff --git a/engines/titanic/game/light_switch.h b/engines/titanic/game/light_switch.h index fd2c392d13..1cda539dd0 100644 --- a/engines/titanic/game/light_switch.h +++ b/engines/titanic/game/light_switch.h @@ -36,7 +36,7 @@ private: int _fieldE4; int _fieldE8; protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF CLightSwitch(); diff --git a/engines/titanic/game/long_stick_dispenser.cpp b/engines/titanic/game/long_stick_dispenser.cpp index 237c1f6112..5d7df1df12 100644 --- a/engines/titanic/game/long_stick_dispenser.cpp +++ b/engines/titanic/game/long_stick_dispenser.cpp @@ -42,7 +42,7 @@ void CLongStickDispenser::load(SimpleFile *file) { CGameObject::load(file); } -bool CLongStickDispenser::handleEvent(const CEnterRoomMsg &msg) { +bool CLongStickDispenser::handleEvent(CEnterRoomMsg &msg) { _fieldC0 = 0; _fieldC4 = 1; return true; diff --git a/engines/titanic/game/long_stick_dispenser.h b/engines/titanic/game/long_stick_dispenser.h index 75ada29a96..14785a785b 100644 --- a/engines/titanic/game/long_stick_dispenser.h +++ b/engines/titanic/game/long_stick_dispenser.h @@ -34,7 +34,7 @@ private: int _fieldC0; int _fieldC4; protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF CLongStickDispenser() : CGameObject(), _fieldBC(0), diff --git a/engines/titanic/game/parrot/player_meets_parrot.cpp b/engines/titanic/game/parrot/player_meets_parrot.cpp index 70628b345a..adb2dc5d36 100644 --- a/engines/titanic/game/parrot/player_meets_parrot.cpp +++ b/engines/titanic/game/parrot/player_meets_parrot.cpp @@ -34,7 +34,7 @@ void CPlayerMeetsParrot::load(SimpleFile *file) { CGameObject::load(file); } -bool CPlayerMeetsParrot::handleEvent(const CEnterRoomMsg &msg) { +bool CPlayerMeetsParrot::handleEvent(CEnterRoomMsg &msg) { warning("CPlayerMeetsParrot::handleEvent"); return true; } diff --git a/engines/titanic/game/parrot/player_meets_parrot.h b/engines/titanic/game/parrot/player_meets_parrot.h index 8572fd701d..9b8138f124 100644 --- a/engines/titanic/game/parrot/player_meets_parrot.h +++ b/engines/titanic/game/parrot/player_meets_parrot.h @@ -30,7 +30,7 @@ namespace Titanic { class CPlayerMeetsParrot : public CGameObject, CEnterRoomMsgTarget { protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/pet/pet_monitor.cpp b/engines/titanic/game/pet/pet_monitor.cpp index 649ac978e9..44d24f264e 100644 --- a/engines/titanic/game/pet/pet_monitor.cpp +++ b/engines/titanic/game/pet/pet_monitor.cpp @@ -34,7 +34,7 @@ void CPETMonitor::load(SimpleFile *file) { CGameObject::load(file); } -bool CPETMonitor::handleEvent(const CEnterRoomMsg &msg) { +bool CPETMonitor::handleEvent(CEnterRoomMsg &msg) { warning("CPETMonitor::handleEvent"); return true; } diff --git a/engines/titanic/game/pet/pet_monitor.h b/engines/titanic/game/pet/pet_monitor.h index 97961ee929..1d66a58d29 100644 --- a/engines/titanic/game/pet/pet_monitor.h +++ b/engines/titanic/game/pet/pet_monitor.h @@ -30,7 +30,7 @@ namespace Titanic { class CPETMonitor : public CGameObject, CEnterRoomMsgTarget { protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/pet/pet_position.cpp b/engines/titanic/game/pet/pet_position.cpp index aafc21beb2..b25111f62c 100644 --- a/engines/titanic/game/pet/pet_position.cpp +++ b/engines/titanic/game/pet/pet_position.cpp @@ -34,7 +34,7 @@ void CPETPosition::load(SimpleFile *file) { CGameObject::load(file); } -bool CPETPosition::handleEvent(const CEnterRoomMsg &msg) { +bool CPETPosition::handleEvent(CEnterRoomMsg &msg) { warning("CPETPosition::handleEvent"); return true; } diff --git a/engines/titanic/game/pet/pet_position.h b/engines/titanic/game/pet/pet_position.h index d72f42ca3a..8a0623932b 100644 --- a/engines/titanic/game/pet/pet_position.h +++ b/engines/titanic/game/pet/pet_position.h @@ -30,7 +30,7 @@ namespace Titanic { class CPETPosition : public CGameObject, CEnterRoomMsgTarget { protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/pet/pet_transport.cpp b/engines/titanic/game/pet/pet_transport.cpp index 40cc155c5b..a88b703b10 100644 --- a/engines/titanic/game/pet/pet_transport.cpp +++ b/engines/titanic/game/pet/pet_transport.cpp @@ -34,7 +34,7 @@ void CPETTransport::load(SimpleFile *file) { CGameObject::load(file); } -bool CPETTransport::handleEvent(const CEnterRoomMsg &msg) { +bool CPETTransport::handleEvent(CEnterRoomMsg &msg) { warning("CPETTransport::handleEvent"); return true; } diff --git a/engines/titanic/game/pet/pet_transport.h b/engines/titanic/game/pet/pet_transport.h index 1eb48322e2..3dc856d5b2 100644 --- a/engines/titanic/game/pet/pet_transport.h +++ b/engines/titanic/game/pet/pet_transport.h @@ -30,7 +30,7 @@ namespace Titanic { class CPETTransport : public CGameObject, CEnterRoomMsgTarget { protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/phonograph.cpp b/engines/titanic/game/phonograph.cpp index 2ff8ca99bb..f7a696e549 100644 --- a/engines/titanic/game/phonograph.cpp +++ b/engines/titanic/game/phonograph.cpp @@ -55,7 +55,7 @@ void CPhonograph::load(SimpleFile *file) { CMusicPlayer::load(file); } -bool CPhonograph::handleEvent(const CEnterRoomMsg &msg) { +bool CPhonograph::handleEvent(CEnterRoomMsg &msg) { warning("CPhonograph::handleEvent"); return true; } diff --git a/engines/titanic/game/phonograph.h b/engines/titanic/game/phonograph.h index 157bd44052..6efe10bab2 100644 --- a/engines/titanic/game/phonograph.h +++ b/engines/titanic/game/phonograph.h @@ -38,7 +38,7 @@ protected: int _fieldF0; int _fieldF4; protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF CPhonograph(); diff --git a/engines/titanic/game/sgt/sgt_state_room.cpp b/engines/titanic/game/sgt/sgt_state_room.cpp index a6dc523bcf..cf735dd6d0 100644 --- a/engines/titanic/game/sgt/sgt_state_room.cpp +++ b/engines/titanic/game/sgt/sgt_state_room.cpp @@ -90,7 +90,7 @@ void CSGTStateRoom::load(SimpleFile *file) { CBackground::load(file); } -bool CSGTStateRoom::handleEvent(const CEnterRoomMsg &msg) { +bool CSGTStateRoom::handleEvent(CEnterRoomMsg &msg) { warning("CSGTStateRoom::handleEvent"); return true; } diff --git a/engines/titanic/game/sgt/sgt_state_room.h b/engines/titanic/game/sgt/sgt_state_room.h index dbe4538ced..4ec1617875 100644 --- a/engines/titanic/game/sgt/sgt_state_room.h +++ b/engines/titanic/game/sgt/sgt_state_room.h @@ -55,7 +55,7 @@ private: int _fieldEC; int _fieldF0; protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF CSGTStateRoom(); diff --git a/engines/titanic/game/ship_setting.cpp b/engines/titanic/game/ship_setting.cpp index 7a3951df71..6d12e59c81 100644 --- a/engines/titanic/game/ship_setting.cpp +++ b/engines/titanic/game/ship_setting.cpp @@ -48,7 +48,7 @@ void CShipSetting::load(SimpleFile *file) { CBackground::load(file); } -bool CShipSetting::handleEvent(const CEnterRoomMsg &msg) { +bool CShipSetting::handleEvent(CEnterRoomMsg &msg) { warning("CShipSetting::handleEvent"); return true; } diff --git a/engines/titanic/game/ship_setting.h b/engines/titanic/game/ship_setting.h index 30780fd3d7..cbf4e9f61a 100644 --- a/engines/titanic/game/ship_setting.h +++ b/engines/titanic/game/ship_setting.h @@ -35,7 +35,7 @@ private: CString _string4; CString _string5; protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF CShipSetting(); diff --git a/engines/titanic/game/transport/lift.cpp b/engines/titanic/game/transport/lift.cpp index 22201291aa..edf69fe31a 100644 --- a/engines/titanic/game/transport/lift.cpp +++ b/engines/titanic/game/transport/lift.cpp @@ -57,7 +57,7 @@ void CLift::load(SimpleFile *file) { CTransport::load(file); } -bool CLift::handleEvent(const CEnterRoomMsg &msg) { +bool CLift::handleEvent(CEnterRoomMsg &msg) { warning("CLift::handleEvent"); return true; } diff --git a/engines/titanic/game/transport/lift.h b/engines/titanic/game/transport/lift.h index 42a340c61f..439e65bb30 100644 --- a/engines/titanic/game/transport/lift.h +++ b/engines/titanic/game/transport/lift.h @@ -39,7 +39,7 @@ private: int _fieldF8; protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF CLift() : CTransport(), _fieldF8(1) {} diff --git a/engines/titanic/game/transport/lift_indicator.h b/engines/titanic/game/transport/lift_indicator.h index b707fbbed9..161f032480 100644 --- a/engines/titanic/game/transport/lift_indicator.h +++ b/engines/titanic/game/transport/lift_indicator.h @@ -35,7 +35,7 @@ private: int _field108; int _field10C; protected: - virtual bool handleEvent(const CEnterRoomMsg &msg) { return true; } + virtual bool handleEvent(CEnterRoomMsg &msg) { return true; } public: CLASSDEF CLiftindicator(); diff --git a/engines/titanic/game/transport/pellerator.cpp b/engines/titanic/game/transport/pellerator.cpp index 99c4db3160..16f42772c3 100644 --- a/engines/titanic/game/transport/pellerator.cpp +++ b/engines/titanic/game/transport/pellerator.cpp @@ -43,7 +43,7 @@ void CPellerator::load(SimpleFile *file) { CTransport::load(file); } -bool CPellerator::handleEvent(const CEnterRoomMsg &msg) { +bool CPellerator::handleEvent(CEnterRoomMsg &msg) { warning("CPellerator::handleEvent"); return true; } diff --git a/engines/titanic/game/transport/pellerator.h b/engines/titanic/game/transport/pellerator.h index 502af2430a..c997373382 100644 --- a/engines/titanic/game/transport/pellerator.h +++ b/engines/titanic/game/transport/pellerator.h @@ -33,7 +33,7 @@ private: static int _v1; static int _v2; protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/up_lighter.cpp b/engines/titanic/game/up_lighter.cpp index beb159f967..817b179e3e 100644 --- a/engines/titanic/game/up_lighter.cpp +++ b/engines/titanic/game/up_lighter.cpp @@ -48,7 +48,7 @@ void CUpLighter::load(SimpleFile *file) { CDropTarget::load(file); } -bool CUpLighter::handleEvent(const CEnterRoomMsg &msg) { +bool CUpLighter::handleEvent(CEnterRoomMsg &msg) { warning("CUpLighter::handleEvent"); return true; } diff --git a/engines/titanic/game/up_lighter.h b/engines/titanic/game/up_lighter.h index 15fa14c16a..6c722ddc2a 100644 --- a/engines/titanic/game/up_lighter.h +++ b/engines/titanic/game/up_lighter.h @@ -35,7 +35,7 @@ private: int _field120; int _field124; protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF CUpLighter(); diff --git a/engines/titanic/game/volume_control.cpp b/engines/titanic/game/volume_control.cpp index 26f89a7b55..801dfd1b60 100644 --- a/engines/titanic/game/volume_control.cpp +++ b/engines/titanic/game/volume_control.cpp @@ -45,7 +45,7 @@ void CVolumeControl::load(SimpleFile *file) { CGameObject::load(file); } -bool CVolumeControl::handleEvent(const CEnterNodeMsg &msg) { +bool CVolumeControl::handleEvent(CEnterNodeMsg &msg) { warning("CVolumeControl::handleEvent"); return true; } diff --git a/engines/titanic/game/volume_control.h b/engines/titanic/game/volume_control.h index 8fa7d01a77..f3f6a75278 100644 --- a/engines/titanic/game/volume_control.h +++ b/engines/titanic/game/volume_control.h @@ -34,7 +34,7 @@ private: CString _string1; int _fieldCC; protected: - virtual bool handleEvent(const CEnterNodeMsg &msg); + virtual bool handleEvent(CEnterNodeMsg &msg); public: CLASSDEF CVolumeControl(); diff --git a/engines/titanic/messages/bilge_dispensor_event.cpp b/engines/titanic/messages/bilge_dispensor_event.cpp index c4c8375f5d..c20fe10992 100644 --- a/engines/titanic/messages/bilge_dispensor_event.cpp +++ b/engines/titanic/messages/bilge_dispensor_event.cpp @@ -34,7 +34,7 @@ void CBilgeDispensorEvent::load(SimpleFile *file) { CAutoSoundEvent::load(file); } -bool CBilgeDispensorEvent::handleEvent(const CEnterRoomMsg &msg) { +bool CBilgeDispensorEvent::handleEvent(CEnterRoomMsg &msg) { _value1 = 0; return true; } diff --git a/engines/titanic/messages/bilge_dispensor_event.h b/engines/titanic/messages/bilge_dispensor_event.h index 4334465c02..9f91b61ef9 100644 --- a/engines/titanic/messages/bilge_dispensor_event.h +++ b/engines/titanic/messages/bilge_dispensor_event.h @@ -30,7 +30,7 @@ namespace Titanic { class CBilgeDispensorEvent : public CAutoSoundEvent { protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index d22144332b..d89b0e1ae5 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -38,7 +38,7 @@ enum MessageFlag { }; #define MSGTARGET(NAME) class NAME; class NAME##Target { public: \ - virtual bool handleEvent(const NAME &msg) = 0; } + virtual bool handleEvent(NAME &msg) = 0; } class CMessage : public CSaveableObject { public: diff --git a/engines/titanic/moves/enter_bridge.cpp b/engines/titanic/moves/enter_bridge.cpp index 6f8ba4cd41..359cfcb48f 100644 --- a/engines/titanic/moves/enter_bridge.cpp +++ b/engines/titanic/moves/enter_bridge.cpp @@ -36,7 +36,7 @@ void CEnterBridge::load(SimpleFile *file) { CGameObject::load(file); } -bool CEnterBridge::handleEvent(const CEnterRoomMsg &msg) { +bool CEnterBridge::handleEvent(CEnterRoomMsg &msg) { warning("CEnterBridge::handlEvent"); return true; } diff --git a/engines/titanic/moves/enter_bridge.h b/engines/titanic/moves/enter_bridge.h index 3685bed8a1..39343ef904 100644 --- a/engines/titanic/moves/enter_bridge.h +++ b/engines/titanic/moves/enter_bridge.h @@ -32,7 +32,7 @@ class CEnterBridge : public CGameObject, CEnterRoomMsgTarget { private: int _value; protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF CEnterBridge() : CGameObject(), _value(1) {} diff --git a/engines/titanic/npcs/barbot.cpp b/engines/titanic/npcs/barbot.cpp index c9a96b989b..907d3c0c71 100644 --- a/engines/titanic/npcs/barbot.cpp +++ b/engines/titanic/npcs/barbot.cpp @@ -233,7 +233,7 @@ void CBarbot::load(SimpleFile *file) { CTrueTalkNPC::load(file); } -bool CBarbot::handleEvent(const CEnterRoomMsg &msg) { +bool CBarbot::handleEvent(CEnterRoomMsg &msg) { warning("TODO: Barbot::CEnterRoomMsg"); return true; } diff --git a/engines/titanic/npcs/barbot.h b/engines/titanic/npcs/barbot.h index 160edd63d9..442578ef6c 100644 --- a/engines/titanic/npcs/barbot.h +++ b/engines/titanic/npcs/barbot.h @@ -174,7 +174,7 @@ private: int _field33C; int _field340; protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF CBarbot(); diff --git a/engines/titanic/npcs/liftbot.cpp b/engines/titanic/npcs/liftbot.cpp index 76a48f07d1..dfc0a4f0ad 100644 --- a/engines/titanic/npcs/liftbot.cpp +++ b/engines/titanic/npcs/liftbot.cpp @@ -48,7 +48,7 @@ void CLiftBot::load(SimpleFile *file) { CTrueTalkNPC::load(file); } -bool CLiftBot::handleEvent(const CEnterRoomMsg &msg) { +bool CLiftBot::handleEvent(CEnterRoomMsg &msg) { warning("CLiftBot::handleEvent"); return true; } diff --git a/engines/titanic/npcs/liftbot.h b/engines/titanic/npcs/liftbot.h index 81c5399e7f..3a41bf3a96 100644 --- a/engines/titanic/npcs/liftbot.h +++ b/engines/titanic/npcs/liftbot.h @@ -35,7 +35,7 @@ private: private: int _field108; protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF CLiftBot(); diff --git a/engines/titanic/sound/auto_music_player.cpp b/engines/titanic/sound/auto_music_player.cpp index 97c59d075d..638cac8c26 100644 --- a/engines/titanic/sound/auto_music_player.cpp +++ b/engines/titanic/sound/auto_music_player.cpp @@ -41,7 +41,7 @@ void CAutoMusicPlayer::load(SimpleFile *file) { CAutoMusicPlayerBase::load(file); } -bool CAutoMusicPlayer::handleEvent(const CEnterRoomMsg &msg) { +bool CAutoMusicPlayer::handleEvent(CEnterRoomMsg &msg) { if (!_fieldCC) { warning("TODO"); } diff --git a/engines/titanic/sound/auto_music_player.h b/engines/titanic/sound/auto_music_player.h index 6fdf3766c6..d2f42ac5c5 100644 --- a/engines/titanic/sound/auto_music_player.h +++ b/engines/titanic/sound/auto_music_player.h @@ -32,7 +32,7 @@ class CAutoMusicPlayer : public CAutoMusicPlayerBase, CEnterRoomMsgTarget { private: CString _string2; protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF CAutoMusicPlayer(); diff --git a/engines/titanic/sound/music_player.cpp b/engines/titanic/sound/music_player.cpp index e2299e6297..25f73b0dc5 100644 --- a/engines/titanic/sound/music_player.cpp +++ b/engines/titanic/sound/music_player.cpp @@ -44,7 +44,7 @@ void CMusicPlayer::load(SimpleFile *file) { CGameObject::load(file); } -bool CMusicPlayer::handleEvent(const CEnterRoomMsg &msg) { +bool CMusicPlayer::handleEvent(CEnterRoomMsg &msg) { warning("TODO: CMusicPlayer::handleEvent"); return true; } diff --git a/engines/titanic/sound/music_player.h b/engines/titanic/sound/music_player.h index 1796a25d4b..96a6968c6d 100644 --- a/engines/titanic/sound/music_player.h +++ b/engines/titanic/sound/music_player.h @@ -35,7 +35,7 @@ protected: int _fieldCC; int _fieldD0; protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF CMusicPlayer() : CGameObject(), diff --git a/engines/titanic/sound/node_auto_sound_player.cpp b/engines/titanic/sound/node_auto_sound_player.cpp index 5709cf5e81..0ef6c8d2ac 100644 --- a/engines/titanic/sound/node_auto_sound_player.cpp +++ b/engines/titanic/sound/node_auto_sound_player.cpp @@ -36,7 +36,7 @@ void CNodeAutoSoundPlayer::load(SimpleFile *file) { CAutoSoundPlayer::load(file); } -bool CNodeAutoSoundPlayer::handleEvent(const CEnterNodeMsg &msg) { +bool CNodeAutoSoundPlayer::handleEvent(CEnterNodeMsg &msg) { warning("CNodeAutoSoundPlayer::handleEvent"); return true; } diff --git a/engines/titanic/sound/node_auto_sound_player.h b/engines/titanic/sound/node_auto_sound_player.h index c635d7e3e9..258aa47eea 100644 --- a/engines/titanic/sound/node_auto_sound_player.h +++ b/engines/titanic/sound/node_auto_sound_player.h @@ -32,7 +32,7 @@ class CNodeAutoSoundPlayer : public CAutoSoundPlayer, CEnterNodeMsgTarget { private: int _fieldEC; protected: - virtual bool handleEvent(const CEnterNodeMsg &msg); + virtual bool handleEvent(CEnterNodeMsg &msg); public: CLASSDEF CNodeAutoSoundPlayer() : CAutoSoundPlayer(), _fieldEC(1) {} diff --git a/engines/titanic/sound/restricted_auto_music_player.cpp b/engines/titanic/sound/restricted_auto_music_player.cpp index a57769bf25..2ee8f2d082 100644 --- a/engines/titanic/sound/restricted_auto_music_player.cpp +++ b/engines/titanic/sound/restricted_auto_music_player.cpp @@ -44,7 +44,7 @@ void CRestrictedAutoMusicPlayer::load(SimpleFile *file) { CAutoMusicPlayer::load(file); } -bool CRestrictedAutoMusicPlayer::handleEvent(const CEnterRoomMsg &msg) { +bool CRestrictedAutoMusicPlayer::handleEvent(CEnterRoomMsg &msg) { warning("CRestrictedAutoMusicPlayer::handleEvent"); return true; } diff --git a/engines/titanic/sound/restricted_auto_music_player.h b/engines/titanic/sound/restricted_auto_music_player.h index a9f17d8729..efb3dc2892 100644 --- a/engines/titanic/sound/restricted_auto_music_player.h +++ b/engines/titanic/sound/restricted_auto_music_player.h @@ -35,7 +35,7 @@ private: CString _string5; CString _string6; protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/sound/room_auto_sound_player.cpp b/engines/titanic/sound/room_auto_sound_player.cpp index b8557aaa81..549f27be63 100644 --- a/engines/titanic/sound/room_auto_sound_player.cpp +++ b/engines/titanic/sound/room_auto_sound_player.cpp @@ -34,7 +34,7 @@ void CRoomAutoSoundPlayer::load(SimpleFile *file) { CAutoSoundPlayer::load(file); } -bool CRoomAutoSoundPlayer::handleEvent(const CEnterRoomMsg &msg) { +bool CRoomAutoSoundPlayer::handleEvent(CEnterRoomMsg &msg) { warning("CRoomAutoSoundPlayer::handleEvent"); return true; } diff --git a/engines/titanic/sound/room_auto_sound_player.h b/engines/titanic/sound/room_auto_sound_player.h index bda9727a0f..a3ec35cb04 100644 --- a/engines/titanic/sound/room_auto_sound_player.h +++ b/engines/titanic/sound/room_auto_sound_player.h @@ -30,7 +30,7 @@ namespace Titanic { class CRoomAutoSoundPlayer : public CAutoSoundPlayer, CEnterRoomMsgTarget { protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/sound/room_trigger_auto_music_player.cpp b/engines/titanic/sound/room_trigger_auto_music_player.cpp index 9e4da684d9..3c0ac0536b 100644 --- a/engines/titanic/sound/room_trigger_auto_music_player.cpp +++ b/engines/titanic/sound/room_trigger_auto_music_player.cpp @@ -34,7 +34,7 @@ void CRoomTriggerAutoMusicPlayer::load(SimpleFile *file) { CTriggerAutoMusicPlayer::load(file); } -bool CRoomTriggerAutoMusicPlayer::handleEvent(const CEnterRoomMsg &msg) { +bool CRoomTriggerAutoMusicPlayer::handleEvent(CEnterRoomMsg &msg) { warning("CRoomTriggerAutoMusicPlayer::handleEvent"); return true; } diff --git a/engines/titanic/sound/room_trigger_auto_music_player.h b/engines/titanic/sound/room_trigger_auto_music_player.h index 1915f92de1..9a478a0a08 100644 --- a/engines/titanic/sound/room_trigger_auto_music_player.h +++ b/engines/titanic/sound/room_trigger_auto_music_player.h @@ -30,7 +30,7 @@ namespace Titanic { class CRoomTriggerAutoMusicPlayer : public CTriggerAutoMusicPlayer, CEnterRoomMsgTarget { protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/sound/titania_speech.cpp b/engines/titanic/sound/titania_speech.cpp index 87ab18a2cb..16a88e40ec 100644 --- a/engines/titanic/sound/titania_speech.cpp +++ b/engines/titanic/sound/titania_speech.cpp @@ -40,7 +40,7 @@ void CTitaniaSpeech::load(SimpleFile *file) { CGameObject::load(file); } -bool CTitaniaSpeech::handleEvent(const CEnterRoomMsg &msg) { +bool CTitaniaSpeech::handleEvent(CEnterRoomMsg &msg) { warning("CTitaniaSpeech::handleEvent"); return true; } diff --git a/engines/titanic/sound/titania_speech.h b/engines/titanic/sound/titania_speech.h index a981029c7d..09a8495fef 100644 --- a/engines/titanic/sound/titania_speech.h +++ b/engines/titanic/sound/titania_speech.h @@ -32,7 +32,7 @@ class CTitaniaSpeech : public CGameObject { private: int _value1, _value2; protected: - virtual bool handleEvent(const CEnterRoomMsg &msg); + virtual bool handleEvent(CEnterRoomMsg &msg); public: CLASSDEF CTitaniaSpeech() : CGameObject(), _value1(1), _value2(0) {} -- cgit v1.2.3 From c864deee1cdafdfd9201af3706dafff644e39908 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 18 Mar 2016 23:28:11 -0400 Subject: TITANIC: Implement more events in CInputTranslator --- engines/titanic/input_translator.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/engines/titanic/input_translator.cpp b/engines/titanic/input_translator.cpp index 8b12646474..bd33f20a70 100644 --- a/engines/titanic/input_translator.cpp +++ b/engines/titanic/input_translator.cpp @@ -50,39 +50,48 @@ void CInputTranslator::mouseMove(int special, const Common::Point &pt) { } void CInputTranslator::leftButtonDown(int special, const Common::Point &pt) { - + CMouseButtonDownMsg msg(pt, getButtons(special)); + _inputHandler->handleMessage(msg); } void CInputTranslator::leftButtonUp(int special, const Common::Point &pt) { - + CMouseButtonUpMsg msg(pt, getButtons(special)); + _inputHandler->handleMessage(msg); } void CInputTranslator::leftButtonDoubleClick(int special, const Common::Point &pt) { - + CMouseButtonDoubleClickMsg msg(pt, getButtons(special)); + _inputHandler->handleMessage(msg); } void CInputTranslator::middleButtonDown(int special, const Common::Point &pt) { - + CMouseButtonDownMsg msg(pt, getButtons(special)); + _inputHandler->handleMessage(msg); } void CInputTranslator::middleButtonUp(int special, const Common::Point &pt) { - + CMouseButtonUpMsg msg(pt, getButtons(special)); + _inputHandler->handleMessage(msg); } void CInputTranslator::middleButtonDoubleClick(int special, const Common::Point &pt) { - + CMouseButtonDoubleClickMsg msg(pt, getButtons(special)); + _inputHandler->handleMessage(msg); } void CInputTranslator::rightButtonDown(int special, const Common::Point &pt) { - + CMouseButtonDownMsg msg(pt, getButtons(special)); + _inputHandler->handleMessage(msg); } void CInputTranslator::rightButtonUp(int special, const Common::Point &pt) { - + CMouseButtonUpMsg msg(pt, getButtons(special)); + _inputHandler->handleMessage(msg); } void CInputTranslator::rightButtonDoubleClick(int special, const Common::Point &pt) { - + CMouseButtonDoubleClickMsg msg(pt, getButtons(special)); + _inputHandler->handleMessage(msg); } } // End of namespace Titanic -- cgit v1.2.3 From abb9a549c86b9c83925cd41f02b27e3e88162b9b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 18 Mar 2016 23:36:54 -0400 Subject: TITANIC: Enable event handlng --- engines/titanic/main_game_window.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 429991dab7..a6a5dcabf5 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -55,8 +55,10 @@ void CMainGameWindow::applicationStarting() { // Set the video mode CScreenManager *screenManager = CScreenManager::setCurrent(); screenManager->setMode(640, 480, 16, 1, true); + _inputAllowed = true; + + // TODO: Remove initial background and palette - // TODO: Clear surfaces // Create game view and manager _gameView = new CSTGameView(this); -- cgit v1.2.3 From 3a42c8ca449248dfc67a98f3bedd65c237d06fa0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 19 Mar 2016 07:48:23 -0400 Subject: TITANIC: Added various preLoad methods --- engines/titanic/core/project_item.cpp | 8 +++++++- engines/titanic/core/project_item.h | 16 ++++++++++------ engines/titanic/game_manager.cpp | 19 ++++++++++++++++--- engines/titanic/game_manager.h | 14 ++++++++++++-- engines/titanic/sound/music_room.cpp | 5 +++++ engines/titanic/sound/music_room.h | 5 +++++ engines/titanic/sound/sound.cpp | 8 ++++++++ engines/titanic/sound/sound.h | 5 +++++ engines/titanic/sound/sound_manager.h | 6 +++++- engines/titanic/true_talk/true_talk_manager.cpp | 4 ++++ engines/titanic/true_talk/true_talk_manager.h | 5 +++++ 11 files changed, 82 insertions(+), 13 deletions(-) diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp index bf31388963..90e6d06ed1 100644 --- a/engines/titanic/core/project_item.cpp +++ b/engines/titanic/core/project_item.cpp @@ -142,8 +142,9 @@ void CProjectItem::resetGameManager() { void CProjectItem::loadGame(int slotId) { CompressedFile file; - // Clear any existing project contents + // Clear any existing project contents and call preload code clear(); + preLoad(); // Open either an existing savegame slot or the new game template if (slotId >= 0) { @@ -272,6 +273,11 @@ void CProjectItem::saveData(SimpleFile *file, CTreeItem *item) const { } } +void CProjectItem::preLoad() { + if (_gameManager) + _gameManager->preLoad(); +} + void CProjectItem::postLoad() { CGameManager *gameManager = getGameManager(); if (gameManager) diff --git a/engines/titanic/core/project_item.h b/engines/titanic/core/project_item.h index bb96f81245..87dfc3f0dd 100644 --- a/engines/titanic/core/project_item.h +++ b/engines/titanic/core/project_item.h @@ -54,7 +54,6 @@ public: * Load the data for the class from file */ virtual void load(SimpleFile *file); - }; /** @@ -78,6 +77,16 @@ private: * Called during save, iterates through the children to do some stuff */ void buildFilesList(); + + /** + * Called at the beginning of loading a game + */ + void preLoad(); + + /** + * Does post-loading processing + */ + void postLoad(); /** * Finds the first child instance of a given class type @@ -98,11 +107,6 @@ private: * Save project data to the passed file */ void saveData(SimpleFile *file, CTreeItem *item) const; - - /** - * Does post-loading processing - */ - void postLoad(); public: CLASSDEF CProjectItem(); diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index a2732d8b1c..b181edcaeb 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -48,7 +48,7 @@ CGameManager::CGameManager(CProjectItem *project, CGameView *gameView): _inputHandler(this), _inputTranslator(&_inputHandler), _gameState(this), _sound(this), _musicRoom(this), _field30(0), _field34(0), _field4C(0), - _dragItem(nullptr), _field54(0), _tickCount1(0), _tickCount2(0) { + _dragItem(nullptr), _field54(0), _lastDiskTicksCount(0), _tickCount2(0) { _videoSurface1 = nullptr; _videoSurface2 = CScreenManager::_screenManagerPtr->createSurface(600, 340); @@ -65,6 +65,15 @@ void CGameManager::load(SimpleFile *file) { _sound.load(file); } +void CGameManager::preLoad() { + updateDiskTicksCount(); + _list.destroyContents(); + _field34 = 0; + + _trueTalkManager.preLoad(); + _sound.preLoad(); +} + void CGameManager::postLoad(CProjectItem *project) { if (_gameView) { _gameView->postLoad(); @@ -77,11 +86,11 @@ void CGameManager::postLoad(CProjectItem *project) { } // Signal to anything interested that the game has been loaded - CLoadSuccessMsg msg(_tickCount1 - _tickCount2); + CLoadSuccessMsg msg(_lastDiskTicksCount - _tickCount2); msg.execute(project, nullptr, MSGFLAG_SCAN); // Signal to any registered list items - _list.postLoad(_tickCount1, _project); + _list.postLoad(_lastDiskTicksCount, _project); // Signal the true talk manager and sound _trueTalkManager.postLoad(); @@ -100,4 +109,8 @@ void CGameManager::update() { warning("TODO: CGameManager::update"); } +void CGameManager::updateDiskTicksCount() { + _lastDiskTicksCount = g_vm->_events->getTicksCount(); +} + } // End of namespace Titanic diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index a331f3a0b4..4380e4f8ec 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -54,7 +54,6 @@ class CGameManager { private: CGameView *_gameView; CSound _sound; - CMusicRoom _musicRoom; CTrueTalkManager _trueTalkManager; CGameManagerList _list; int _field30; @@ -63,7 +62,7 @@ private: int _field4C; int _field54; CVideoSurface *_videoSurface2; - uint _tickCount1; + uint _lastDiskTicksCount; uint _tickCount2; public: CProjectItem *_project; @@ -72,6 +71,7 @@ public: CInputHandler _inputHandler; CInputTranslator _inputTranslator; CTreeItem *_dragItem; + CMusicRoom _musicRoom; public: CGameManager(CProjectItem *project, CGameView *gameView); ~CGameManager(); @@ -81,11 +81,21 @@ public: */ void load(SimpleFile *file); + /** + * Called when a game is about to be loaded + */ + void preLoad(); + /** * Called after loading a game has finished */ void postLoad(CProjectItem *project); + /** + * Updates the game time when the last disk access started + */ + void updateDiskTicksCount(); + CViewItem *getView() { return _gameState._gameLocation.getView(); } /** diff --git a/engines/titanic/sound/music_room.cpp b/engines/titanic/sound/music_room.cpp index 2b959a0847..593c572277 100644 --- a/engines/titanic/sound/music_room.cpp +++ b/engines/titanic/sound/music_room.cpp @@ -21,6 +21,7 @@ */ #include "titanic/sound/music_room.h" +#include "common/textconsole.h" namespace Titanic { @@ -28,4 +29,8 @@ CMusicRoom::CMusicRoom(CGameManager *gameManager) : _gameManager(gameManager) { } +void CMusicRoom::preLoad() { + warning("TODO: CMusicRoom::preLoad"); +} + } // End of namespace Titanic diff --git a/engines/titanic/sound/music_room.h b/engines/titanic/sound/music_room.h index 7fcd99db1e..ce262a2b99 100644 --- a/engines/titanic/sound/music_room.h +++ b/engines/titanic/sound/music_room.h @@ -32,6 +32,11 @@ public: CGameManager *_gameManager; public: CMusicRoom(CGameManager *owner); + + /** + * Called when a game is about to be loaded + */ + void preLoad(); }; } // End of namespace Titanic diff --git a/engines/titanic/sound/sound.cpp b/engines/titanic/sound/sound.cpp index 35c1c708a6..062e43debc 100644 --- a/engines/titanic/sound/sound.cpp +++ b/engines/titanic/sound/sound.cpp @@ -21,6 +21,7 @@ */ #include "titanic/sound/sound.h" +#include "titanic/game_manager.h" namespace Titanic { @@ -35,4 +36,11 @@ void CSound::load(SimpleFile *file) { _soundManager.load(file); } +void CSound::preLoad() { + _soundManager.preLoad(); + + if (_gameManager) + _gameManager->_musicRoom.preLoad(); +} + } // End of namespace Titanic z diff --git a/engines/titanic/sound/sound.h b/engines/titanic/sound/sound.h index a78bc79741..1b98507a93 100644 --- a/engines/titanic/sound/sound.h +++ b/engines/titanic/sound/sound.h @@ -47,6 +47,11 @@ public: */ void load(SimpleFile *file); + /** + * Called when a game is about to be loaded + */ + void preLoad(); + /** * Called when loading a game is complete */ diff --git a/engines/titanic/sound/sound_manager.h b/engines/titanic/sound/sound_manager.h index cb88b6684c..6a2e5a79d3 100644 --- a/engines/titanic/sound/sound_manager.h +++ b/engines/titanic/sound/sound_manager.h @@ -57,7 +57,11 @@ public: virtual void proc20(int v) { _field8 = v; } virtual void proc21(int v) { _fieldC = v; } virtual void proc22(int v) { _field10 = v; } - virtual void proc23() { proc10(); } + + /** + * Called when a game is about to be loaded + */ + virtual void preLoad() { proc10(); } /** * Load the data for the class from file diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index f176b2f3cf..5afaeb3873 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -175,4 +175,8 @@ void CTrueTalkManager::saveNPC(SimpleFile *file, int charId) const { } } +void CTrueTalkManager::preLoad() { + warning("TODO: CTrueTalkManager::preLoad"); +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index 904f3c479b..ac36102cf0 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -77,6 +77,11 @@ public: */ void load(SimpleFile *file); + /** + * Called when a game is about to be loaded + */ + void preLoad(); + /** * Called when loading a game is complete */ -- cgit v1.2.3 From 2665e0e08f0f1c8e70738dad793de20176e0d9c4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 19 Mar 2016 08:08:01 -0400 Subject: TITANIC: Added various preSave and postSave methods --- engines/titanic/game_manager.cpp | 36 ++++++++++++++++++++++++++- engines/titanic/game_manager.h | 36 +++++++++++++++++++++++++++ engines/titanic/sound/sound.h | 10 ++++++++ engines/titanic/sound/sound_manager.h | 5 +++- engines/titanic/true_talk/true_talk_manager.h | 10 ++++++++ 5 files changed, 95 insertions(+), 2 deletions(-) diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index b181edcaeb..1d34650552 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -27,7 +27,6 @@ #include "titanic/core/project_item.h" #include "titanic/messages/messages.h" - namespace Titanic { void CGameManagerList::postLoad(uint ticks, CProjectItem *project) { @@ -35,12 +34,30 @@ void CGameManagerList::postLoad(uint ticks, CProjectItem *project) { (*i)->postLoad(ticks, project); } +void CGameManagerList::preSave() { + for (iterator i = begin(); i != end(); ++i) + (*i)->preSave(); +} + +void CGameManagerList::postSave() { + for (iterator i = begin(); i != end(); ++i) + (*i)->postSave(); +} + /*------------------------------------------------------------------------*/ void CGameManagerListItem::postLoad(uint ticks, CProjectItem *project) { warning("TODO"); } +void CGameManagerListItem::preSave() { + warning("TODO: CGameManagerListItem::preSave"); +} + +void CGameManagerListItem::postSave() { + warning("TODO: CGameManagerListItem::postSave"); +} + /*------------------------------------------------------------------------*/ CGameManager::CGameManager(CProjectItem *project, CGameView *gameView): @@ -97,6 +114,23 @@ void CGameManager::postLoad(CProjectItem *project) { _sound.postLoad(); } +void CGameManager::preSave(CProjectItem *project) { + // Generate a message that a save is being done + updateDiskTicksCount(); + CPreSaveMsg msg(_lastDiskTicksCount); + msg.execute(project, nullptr, MSGFLAG_SCAN); + + // Notify sub-objects of the save + _list.preSave(); + _trueTalkManager.preSave(); + _sound.preSave(); +} + +void CGameManager::postSave() { + _list.postSave(); + _trueTalkManager.postSave(); +} + void CGameManager::initBounds() { _bounds = Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); } diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index 4380e4f8ec..43d0dff025 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -42,12 +42,38 @@ class CGameManagerListItem : public ListItem { private: static int _v1; public: + /** + * Called after loading a game has finished + */ void postLoad(uint ticks, CProjectItem *project); + + /** + * Called when a game is about to be saved + */ + void preSave(); + + /** + * Called when a game has finished being saved + */ + void postSave(); }; class CGameManagerList : public List { public: + /** + * Called after loading a game has finished + */ void postLoad(uint ticks, CProjectItem *project); + + /** + * Called when a game is about to be saved + */ + void preSave(); + + /** + * Called when a game has finished being saved + */ + void postSave(); }; class CGameManager { @@ -91,6 +117,16 @@ public: */ void postLoad(CProjectItem *project); + /** + * Called when a game is about to be saved + */ + void preSave(CProjectItem *project); + + /** + * Called when a game has finished being saved + */ + void postSave(); + /** * Updates the game time when the last disk access started */ diff --git a/engines/titanic/sound/sound.h b/engines/titanic/sound/sound.h index 1b98507a93..fce29eb625 100644 --- a/engines/titanic/sound/sound.h +++ b/engines/titanic/sound/sound.h @@ -56,6 +56,16 @@ public: * Called when loading a game is complete */ void postLoad() { _soundManager.postLoad(); } + + /** + * Called when a game is about to be saved + */ + void preSave() { _soundManager.preSave(); } + + /** + * Called when a game has finished being saved + */ + void postSave() { _soundManager.postSave(); } }; } // End of namespace Titanic diff --git a/engines/titanic/sound/sound_manager.h b/engines/titanic/sound/sound_manager.h index 6a2e5a79d3..99513aefe8 100644 --- a/engines/titanic/sound/sound_manager.h +++ b/engines/titanic/sound/sound_manager.h @@ -73,7 +73,10 @@ public: */ virtual void postLoad() {} - virtual void proc26() {} + /** + * Called when a game is about to be saved + */ + virtual void preSave() {} /** * Save the data for the class to file diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index ac36102cf0..8a59655075 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -87,6 +87,16 @@ public: */ void postLoad() {} + /** + * Called when a game is about to be saved + */ + void preSave() {} + + /** + * Called when a game has finished being saved + */ + void postSave() {} + /** * Returns the scripts for the manager */ -- cgit v1.2.3 From abb5e0a5c123ada15d77380a1a9d5253306c36bb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 19 Mar 2016 09:29:11 -0400 Subject: TITANIC: Added CGameManager::viewChange --- engines/titanic/core/project_item.cpp | 15 +++++++++++++++ engines/titanic/core/project_item.h | 10 ++++++++++ engines/titanic/core/tree_item.cpp | 20 ++++++++++---------- engines/titanic/core/tree_item.h | 10 ++++++++++ engines/titanic/game_manager.cpp | 14 ++++++++++++++ engines/titanic/game_manager.h | 5 +++++ engines/titanic/true_talk/true_talk_manager.cpp | 4 ++++ engines/titanic/true_talk/true_talk_manager.h | 5 +++++ 8 files changed, 73 insertions(+), 10 deletions(-) diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp index 90e6d06ed1..7546f20936 100644 --- a/engines/titanic/core/project_item.cpp +++ b/engines/titanic/core/project_item.cpp @@ -189,10 +189,15 @@ void CProjectItem::saveGame(int slotId) { Common::String::format("slot%d.gam", slotId)); file.open(saveFile); + // Signal the game is being saved + preSave(); + // Save the contents out saveData(&file, this); + // Close the file and signal that the saving has finished file.close(); + postSave(); } void CProjectItem::clear() { @@ -288,6 +293,16 @@ void CProjectItem::postLoad() { petControl->postLoad(); } +void CProjectItem::preSave() { + if (_gameManager) + _gameManager->preSave(this); +} + +void CProjectItem::postSave() { + if (_gameManager) + _gameManager->postSave(); +} + CPetControl *CProjectItem::getPetControl() const { CDontSaveFileItem *fileItem = getDontSaveFileItem(); CTreeItem *treeItem; diff --git a/engines/titanic/core/project_item.h b/engines/titanic/core/project_item.h index 87dfc3f0dd..ef7ccb65f9 100644 --- a/engines/titanic/core/project_item.h +++ b/engines/titanic/core/project_item.h @@ -88,6 +88,16 @@ private: */ void postLoad(); + /** + * Called when a game is about to be saved + */ + void preSave(); + + /** + * Called when a game has finished being saved + */ + void postSave(); + /** * Finds the first child instance of a given class type */ diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index 72c158d103..a1dcce1abe 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -59,6 +59,16 @@ CString CTreeItem::dumpItem(int indent) const { return result; } +void CTreeItem::save(SimpleFile *file, int indent) const { + file->writeNumberLine(0, indent); + CMessageTarget::save(file, indent); +} + +void CTreeItem::load(SimpleFile *file) { + file->readNumber(); + CMessageTarget::load(file); +} + bool CTreeItem::isFileItem() const { return isInstanceOf(CFileItem::_type); } @@ -91,16 +101,6 @@ bool CTreeItem::isGameObjectDescItem() const { return isInstanceOf(CGameObjectDescItem::_type); } -void CTreeItem::save(SimpleFile *file, int indent) const { - file->writeNumberLine(0, indent); - CMessageTarget::save(file, indent); -} - -void CTreeItem::load(SimpleFile *file) { - file->readNumber(); - CMessageTarget::load(file); -} - CGameManager *CTreeItem::getGameManager() const { return _parent ? _parent->getGameManager() : nullptr; } diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index aea22ffa40..a4156d6ad1 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -119,6 +119,16 @@ public: */ virtual int compareTo(const CString &name, int maxLen) const { return false; } + /** + * Gets the bounds occupied by the item + */ + virtual Common::Rect getBounds() { return Common::Rect(); } + + /** + * Called when the view changes + */ + virtual void viewChange() {} + /** * Get the parent for the given item */ diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index 1d34650552..296299a526 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -147,4 +147,18 @@ void CGameManager::updateDiskTicksCount() { _lastDiskTicksCount = g_vm->_events->getTicksCount(); } +void CGameManager::viewChange() { + delete _videoSurface1; + delete _videoSurface2; + + _videoSurface1 = nullptr; + _videoSurface2 = CScreenManager::_screenManagerPtr->createSurface(600, 340); + _trueTalkManager.viewChange(); + + for (CTreeItem *treeItem = _project; treeItem; treeItem = treeItem->scan(_project)) + treeItem->viewChange(); + + initBounds(); +} + } // End of namespace Titanic diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index 43d0dff025..6404845fa2 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -155,6 +155,11 @@ public: * Updates the state of the manager */ void update(); + + /** + * Called when the view changes + */ + void viewChange(); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 5afaeb3873..3d4a8ecc9d 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -179,4 +179,8 @@ void CTrueTalkManager::preLoad() { warning("TODO: CTrueTalkManager::preLoad"); } +void CTrueTalkManager::viewChange() { + warning("CTrueTalkManager::viewChange"); +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index 8a59655075..4c74ac2bc5 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -97,6 +97,11 @@ public: */ void postSave() {} + /** + * Called when the view changes + */ + void viewChange(); + /** * Returns the scripts for the manager */ -- cgit v1.2.3 From f1d674c745ba117e1e62ff6fa3ebb8a7cace3615 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 19 Mar 2016 09:50:47 -0400 Subject: TITANIC: Implemented CViewItem::viewChange --- engines/titanic/core/saveable_object.cpp | 6 ++++++ engines/titanic/core/view_item.cpp | 28 ++++++++++++++++++++++++++++ engines/titanic/core/view_item.h | 5 +++++ engines/titanic/messages/messages.h | 6 +++--- 4 files changed, 42 insertions(+), 3 deletions(-) diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 4ad9938c9c..5fbe88878f 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -801,6 +801,9 @@ DEFFN(CIsEarBowlPuzzleDone) DEFFN(CIsHookedOnMsg) DEFFN(CIsParrotPresentMsg) DEFFN(CKeyCharMsg) +DEFFN(CLeaveNodeMsg); +DEFFN(CLeaveRoomMsg); +DEFFN(CLeaveViewMsg); DEFFN(CLemonFallsFromTreeMsg) DEFFN(CLightsMsg) DEFFN(CLoadSuccessMsg) @@ -1374,6 +1377,9 @@ void CSaveableObject::initClassList() { ADDFN(CIsHookedOnMsg, CMessage); ADDFN(CIsParrotPresentMsg, CMessage); ADDFN(CKeyCharMsg, CMessage); + ADDFN(CLeaveNodeMsg, CMessage); + ADDFN(CLeaveRoomMsg, CMessage); + ADDFN(CLeaveViewMsg, CMessage); ADDFN(CLemonFallsFromTreeMsg, CMessage); ADDFN(CLightsMsg, CMessage); ADDFN(CLoadSuccessMsg, CMessage); diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index 7038e94538..60463545d3 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -21,6 +21,8 @@ */ #include "titanic/core/view_item.h" +#include "titanic/messages/messages.h" +#include "titanic/game_manager.h" namespace Titanic { @@ -73,4 +75,30 @@ bool CViewItem::getResourceKey(CResourceKey *key) { return !filename.empty(); } +void CViewItem::viewChange(CViewItem *newView) { + // Only do the processing if we've been passed a view, and it's not the same + if (newView && newView != this) { + CLeaveViewMsg viewMsg(this, newView); + viewMsg.execute(this, nullptr, MSGFLAG_SCAN); + + CNodeItem *oldNode = findNode(); + CNodeItem *newNode = newView->findNode(); + if (newNode != oldNode) { + CLeaveNodeMsg nodeMsg(oldNode, newNode); + nodeMsg.execute(oldNode, nullptr, MSGFLAG_SCAN); + + CRoomItem *oldRoom = oldNode->findRoom(); + CRoomItem *newRoom = newNode->findRoom(); + if (newRoom != oldRoom) { + CGameManager *gm = getGameManager(); + if (gm) + gm->viewChange(); + + CLeaveRoomMsg roomMsg(oldRoom, newRoom); + roomMsg.execute(oldRoom, nullptr, MSGFLAG_SCAN); + } + } + } +} + } // End of namespace Titanic diff --git a/engines/titanic/core/view_item.h b/engines/titanic/core/view_item.h index 106c795773..632c8e7358 100644 --- a/engines/titanic/core/view_item.h +++ b/engines/titanic/core/view_item.h @@ -57,6 +57,11 @@ public: * Get the resource key for the view */ bool getResourceKey(CResourceKey *key); + + /** + * Called when changing from one view to another + */ + void viewChange(CViewItem *newView); }; } // End of namespace Titanic diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index d89b0e1ae5..4e00648f1b 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -281,9 +281,9 @@ MESSAGE0(CInitializeAnimMsg); MESSAGE1(CIsEarBowlPuzzleDone, int, value, 0); MESSAGE1(CIsParrotPresentMsg, int, value, 0); MESSAGE1(CKeyCharMsg, int, value, 32); -MESSAGE1(CLeaveNodeMsg, CNodeItem *, node, nullptr); -MESSAGE1(CLeaveRoomMsg, CRoomItem *, room, nullptr); -MESSAGE1(CLeaveViewMsg, CViewItem *, view, nullptr); +MESSAGE2(CLeaveNodeMsg, CNodeItem *, oldNode, nullptr, CNodeItem *, newNode, nullptr); +MESSAGE2(CLeaveRoomMsg, CRoomItem *, oldRoom, nullptr, CRoomItem *, newRoom, nullptr); +MESSAGE2(CLeaveViewMsg, CViewItem *, oldView, nullptr, CViewItem *, newView, nullptr); MESSAGE2(CLemonFallsFromTreeMsg, int, value1, 0, int, value2, 0); MESSAGE1(CLoadSuccessMsg, int, ticks, 0); MESSAGE1(CLockPhonographMsg, int, value, 0); -- cgit v1.2.3 From d86941f8c6b497f2d3d8409c2628af88bc600dae Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 19 Mar 2016 11:03:03 -0400 Subject: TITANIC: Implement preEnterView and enterView --- engines/titanic/core/view_item.cpp | 61 +++++++++++++++++++++- engines/titanic/core/view_item.h | 14 ++++- engines/titanic/game/gondolier/gondolier_mixer.cpp | 6 +-- engines/titanic/game_state.cpp | 13 +++-- engines/titanic/game_state.h | 9 +++- engines/titanic/main_game_window.cpp | 9 ++-- engines/titanic/messages/messages.h | 30 +++++------ engines/titanic/pet_control/pet_control.cpp | 18 +++++-- engines/titanic/pet_control/pet_control.h | 12 +++++ engines/titanic/pet_control/pet_control_sub_base.h | 8 ++- 10 files changed, 144 insertions(+), 36 deletions(-) diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index 60463545d3..c632458939 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -20,9 +20,12 @@ * */ +#include "titanic/game_manager.h" +#include "titanic/core/project_item.h" +#include "titanic/core/room_item.h" #include "titanic/core/view_item.h" #include "titanic/messages/messages.h" -#include "titanic/game_manager.h" +#include "titanic/pet_control/pet_control.h" namespace Titanic { @@ -75,7 +78,7 @@ bool CViewItem::getResourceKey(CResourceKey *key) { return !filename.empty(); } -void CViewItem::viewChange(CViewItem *newView) { +void CViewItem::leaveView(CViewItem *newView) { // Only do the processing if we've been passed a view, and it's not the same if (newView && newView != this) { CLeaveViewMsg viewMsg(this, newView); @@ -101,4 +104,58 @@ void CViewItem::viewChange(CViewItem *newView) { } } +void CViewItem::preEnterView(CViewItem *newView) { + // Only do the processing if we've been passed a view, and it's not the same + if (newView && newView != this) { + CPreEnterViewMsg viewMsg(this, newView); + viewMsg.execute(this, nullptr, MSGFLAG_SCAN); + + CNodeItem *oldNode = findNode(); + CNodeItem *newNode = newView->findNode(); + if (newNode != oldNode) { + CPreEnterNodeMsg nodeMsg(oldNode, newNode); + nodeMsg.execute(oldNode, nullptr, MSGFLAG_SCAN); + + CRoomItem *oldRoom = oldNode->findRoom(); + CRoomItem *newRoom = newNode->findRoom(); + if (newRoom != oldRoom) { + CPreEnterRoomMsg roomMsg(oldRoom, newRoom); + roomMsg.execute(oldRoom, nullptr, MSGFLAG_SCAN); + } + } + } +} + +void CViewItem::enterView(CViewItem *newView) { + // Only do the processing if we've been passed a view, and it's not the same + if (newView && newView != this) { + CEnterViewMsg viewMsg(this, newView); + viewMsg.execute(this, nullptr, MSGFLAG_SCAN); + + CNodeItem *oldNode = findNode(); + CNodeItem *newNode = newView->findNode(); + if (newNode != oldNode) { + CEnterNodeMsg nodeMsg(oldNode, newNode); + nodeMsg.execute(oldNode, nullptr, MSGFLAG_SCAN); + + CRoomItem *oldRoom = oldNode->findRoom(); + CRoomItem *newRoom = newNode->findRoom(); + + CPetControl *petControl = nullptr; + if (newRoom != nullptr) { + petControl = newRoom->getRoot()->getPetControl(); + petControl->enterNode(newNode); + } + + if (newRoom != oldRoom) { + CEnterRoomMsg roomMsg(oldRoom, newRoom); + roomMsg.execute(oldRoom, nullptr, MSGFLAG_SCAN); + + if (petControl) + petControl->enterRoom(newRoom); + } + } + } +} + } // End of namespace Titanic diff --git a/engines/titanic/core/view_item.h b/engines/titanic/core/view_item.h index 632c8e7358..ad09ed69e6 100644 --- a/engines/titanic/core/view_item.h +++ b/engines/titanic/core/view_item.h @@ -59,9 +59,19 @@ public: bool getResourceKey(CResourceKey *key); /** - * Called when changing from one view to another + * Called when leaving the view */ - void viewChange(CViewItem *newView); + void leaveView(CViewItem *newView); + + /** + * Called on an old view just left, and about to enter a new view + */ + void preEnterView(CViewItem *newView); + + /** + * Called when a new view is being entered + */ + void enterView(CViewItem *newView); }; } // End of namespace Titanic diff --git a/engines/titanic/game/gondolier/gondolier_mixer.cpp b/engines/titanic/game/gondolier/gondolier_mixer.cpp index f4fb655cf2..b647a31ac2 100644 --- a/engines/titanic/game/gondolier/gondolier_mixer.cpp +++ b/engines/titanic/game/gondolier/gondolier_mixer.cpp @@ -57,9 +57,9 @@ void CGondolierMixer::load(SimpleFile *file) { } bool CGondolierMixer::handleEvent(CEnterRoomMsg &msg) { - CTreeItem *parent = getParent(); - if (parent == msg._room) - msg.execute(parent); + CTreeItem *parentRoom = getParent(); + if (parentRoom == msg._newRoom) + msg.execute(parentRoom); return true; } diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index 30185fc5f6..d0baf21599 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game_state.h" +#include "titanic/titanic.h" #include "titanic/game_manager.h" #include "titanic/screen_manager.h" @@ -29,8 +30,8 @@ namespace Titanic { CGameState::CGameState(CGameManager *gameManager) : _gameManager(gameManager), _gameLocation(this), _field8(0), _fieldC(0), _mode(GSMODE_0), _field14(0), _field18(0), - _field1C(0), _field20(0), _field24(0), _field28(0), _field2C(0), - _field38(0) { + _field1C(0), _field20(0), _field24(0), _nodeChangeCtr(0), + _nodeEnterTicks(0), _field38(0) { } void CGameState::save(SimpleFile *file) const { @@ -54,7 +55,8 @@ void CGameState::load(SimpleFile *file) { _gameLocation.load(file); _field1C = file->readNumber(); - _field28 = _field2C = 0; + _nodeChangeCtr = 0; + _nodeEnterTicks = 0; } void CGameState::setMode(GameStateMode newMode) { @@ -82,4 +84,9 @@ void CGameState::setMousePos(const Common::Point &pt) { _mousePos = pt; } +void CGameState::enterNode() { + ++_nodeChangeCtr; + _nodeEnterTicks = g_vm->_events->getTicksCount(); +} + } // End of namespace Titanic z diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h index 1c0b750a44..10b87b5f9a 100644 --- a/engines/titanic/game_state.h +++ b/engines/titanic/game_state.h @@ -54,8 +54,8 @@ public: int _field1C; int _field20; int _field24; - int _field28; - int _field2C; + uint _nodeChangeCtr; + uint32 _nodeEnterTicks; Common::Point _mousePos; int _field38; public: @@ -80,6 +80,11 @@ public: * Sets the current mouse position */ void setMousePos(const Common::Point &pt); + + /** + * Called by the PET when a new node is entered + */ + void enterNode(); }; } // End of namespace Titanic diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index a6a5dcabf5..0c80149173 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -70,17 +70,18 @@ void CMainGameWindow::applicationStarting() { // TODO: Cursor/image - // Generate starting messages + // Generate starting messages for entering the view, node, and room. + // Note the old fields are nullptr, since there's no previous view/node/room CViewItem *view = _gameManager->_gameState._gameLocation.getView(); - CEnterViewMsg enterViewMsg(view); + CEnterViewMsg enterViewMsg(nullptr, view); enterViewMsg.execute(view, nullptr, MSGFLAG_SCAN); CNodeItem *node = view->findNode(); - CEnterNodeMsg enterNodeMsg(node); + CEnterNodeMsg enterNodeMsg(nullptr, node); enterNodeMsg.execute(node, nullptr, MSGFLAG_SCAN); CRoomItem *room = view->findRoom(); - CEnterRoomMsg enterRoomMsg(room); + CEnterRoomMsg enterRoomMsg(nullptr, room); enterRoomMsg.execute(room, nullptr, MSGFLAG_SCAN); _gameManager->initBounds(); diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 4e00648f1b..0776ab9493 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -196,9 +196,9 @@ public: } } #define MESSAGE2(NAME, F1, N1, V1, F2, N2, V2) MSGTARGET(NAME); \ class NAME: public CMessage { \ - public: F1 _N1; F2 _N2; \ - NAME() : CMessage(), _N1(V1), _N2(V2) {} \ - NAME(F1 N1, F2 N2) : CMessage(), _N1(N1), _N2(N2) {} \ + public: F1 _##N1; F2 _##N2; \ + NAME() : CMessage(), _##N1(V1), _##N2(V2) {} \ + NAME(F1 N1, F2 N2) : CMessage(), _##N1(N1), _##N2(N2) {} \ CLASSDEF \ virtual bool handleMessage(const NAME &msg) { return false; } \ virtual bool perform(CTreeItem *treeItem) { \ @@ -207,9 +207,9 @@ public: } } #define MESSAGE3(NAME, F1, N1, V1, F2, N2, V2, F3, N3, V3) MSGTARGET(NAME); \ class NAME: public CMessage { \ - public: F1 _N1; F2 _N2; F3 _N3; \ - NAME() : CMessage(), _N1(V1), _N2(V2), _N3(V3) {} \ - NAME(F1 N1, F2 N2, F3 N3) : CMessage(), _N1(N1), _N2(N2), _N3(N3) {} \ + public: F1 _##N1; F2 _##N2; F3 _##N3; \ + NAME() : CMessage(), _##N1(V1), _##N2(V2), _##N3(V3) {} \ + NAME(F1 N1, F2 N2, F3 N3) : CMessage(), _##N1(N1), _##N2(N2), _##N3(N3) {} \ CLASSDEF \ virtual bool handleMessage(const NAME &msg) { return false; } \ virtual bool perform(CTreeItem *treeItem) { \ @@ -218,9 +218,9 @@ public: } } #define MESSAGE4(NAME, F1, N1, V1, F2, N2, V2, F3, N3, V3, F4, N4, V4) MSGTARGET(NAME); \ class NAME: public CMessage { \ - public: F1 _N1; F2 _N2; F3 _N3; F4 _N4; \ - NAME() : CMessage(), _N1(V1), _N2(V2), _N3(V3), _N4(V4) {} \ - NAME(F1 N1, F2 N2, F3 N3, F4 N4) : CMessage(), _N1(N1), _N2(N2), _N3(N3), _N4(N4) {} \ + public: F1 _##N1; F2 _##N2; F3 _##N3; F4 _##N4; \ + NAME() : CMessage(), _##N1(V1), _##N2(V2), _##N3(V3), _##N4(V4) {} \ + NAME(F1 N1, F2 N2, F3 N3, F4 N4) : CMessage(), _##N1(N1), _##N2(N2), _##N3(N3), _##N4(N4) {} \ CLASSDEF \ virtual bool handleMessage(const NAME &msg) { return false; } \ virtual bool perform(CTreeItem *treeItem) { \ @@ -259,12 +259,12 @@ MESSAGE1(CDropobjectMsg, int, value, 0); MESSAGE1(CDropZoneGotObjectMsg, int, value, 0); MESSAGE1(CDropZoneLostObjectMsg, int, value, 0); MESSAGE1(CEjectCylinderMsg, int, value, 0); -MESSAGE1(CPreEnterNodeMsg, CNodeItem *, node, nullptr); -MESSAGE1(CPreEnterRoomMsg, CRoomItem *, room, nullptr); -MESSAGE1(CPreEnterViewMsg, CViewItem *, view, nullptr); -MESSAGE1(CEnterNodeMsg, CNodeItem *, node, nullptr); -MESSAGE1(CEnterRoomMsg, CRoomItem *, room, nullptr); -MESSAGE1(CEnterViewMsg, CViewItem *, view, nullptr); +MESSAGE2(CPreEnterNodeMsg, CNodeItem *, oldNode, nullptr, CNodeItem *, newNode, nullptr); +MESSAGE2(CPreEnterRoomMsg, CRoomItem *, oldRoom, nullptr, CRoomItem *, newRoom, nullptr); +MESSAGE2(CPreEnterViewMsg, CViewItem *, oldView, nullptr, CViewItem *, newView, nullptr); +MESSAGE2(CEnterNodeMsg, CNodeItem *, oldNode, nullptr, CNodeItem *, newNode, nullptr); +MESSAGE2(CEnterRoomMsg, CRoomItem *, oldRoom, nullptr, CRoomItem *, newRoom, nullptr); +MESSAGE2(CEnterViewMsg, CViewItem *, oldView, nullptr, CViewItem *, newView, nullptr); MESSAGE0(CErasePhonographCylinderMsg); MESSAGE2(CFreshenCookieMsg, int, value1, 0, int, value2, 0); MESSAGE1(CGetChevClassBits, int, value, 0); diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 7ed223d595..a61773d319 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -21,6 +21,8 @@ */ #include "titanic/pet_control/pet_control.h" +#include "titanic/game_manager.h" +#include "titanic/game_state.h" namespace Titanic { @@ -49,10 +51,6 @@ void CPetControl::load(SimpleFile *file) { CGameObject::load(file); } -void CPetControl::postLoad() { - // TODO -} - bool CPetControl::isValid() const { return _sub1.isValid() && _sub2.isValid() && _sub3.isValid() && _sub4.isValid() @@ -82,5 +80,17 @@ void CPetControl::saveSubObjects(SimpleFile *file, int indent) const { _sub8.save(file, indent); } +void CPetControl::postLoad() { + warning("TODO: CPetControl::postLoad"); +} + +void CPetControl::enterNode(CNodeItem *node) { + getGameManager()->_gameState.enterNode(); +} + +void CPetControl::enterRoom(CRoomItem *room) { + _sub2.enterRoom(room); + _sub3.enterRoom(room); +} } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 70f6850bc7..f1e4bb2a10 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -24,6 +24,8 @@ #define TITANIC_PET_CONTROL_H #include "titanic/core/game_object.h" +#include "titanic/core/node_item.h" +#include "titanic/core/room_item.h" #include "titanic/pet_control/pet_control_sub1.h" #include "titanic/pet_control/pet_control_sub2.h" #include "titanic/pet_control/pet_control_sub3.h" @@ -80,6 +82,16 @@ public: * Called after loading a game has finished */ void postLoad(); + + /** + * Called when a new node is entered + */ + void enterNode(CNodeItem *node); + + /** + * Called when a new room is entered + */ + void enterRoom(CRoomItem *room); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub_base.h b/engines/titanic/pet_control/pet_control_sub_base.h index b59c85b30a..f95e1a98f5 100644 --- a/engines/titanic/pet_control/pet_control_sub_base.h +++ b/engines/titanic/pet_control/pet_control_sub_base.h @@ -24,6 +24,7 @@ #define TITANIC_PET_CONTROL_SUB_BASE_H #include "titanic/simple_file.h" +#include "titanic/core/room_item.h" namespace Titanic { @@ -81,7 +82,12 @@ public: virtual void proc21() {} virtual void proc22() {} virtual void proc23() {} - virtual void proc24() {} + + /** + * Called when a new room is entered + */ + virtual void enterRoom(CRoomItem *room) {} + virtual void proc25(); virtual int proc26() { return 0; } virtual void proc27(); -- cgit v1.2.3 From 4704d72d6af60db97959c3d170a2ea524a0f0f1f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 19 Mar 2016 18:19:45 -0400 Subject: TITANIC: Implementing view item message handling --- engines/titanic/core/game_object.cpp | 9 ++- engines/titanic/core/game_object.h | 7 ++- engines/titanic/core/link_item.cpp | 25 +++----- engines/titanic/core/link_item.h | 14 +---- engines/titanic/core/view_item.cpp | 67 ++++++++++++++++++++++ engines/titanic/core/view_item.h | 17 +++++- engines/titanic/files_manager.cpp | 7 +++ engines/titanic/files_manager.h | 3 + engines/titanic/game/gondolier/gondolier_mixer.cpp | 3 +- engines/titanic/game_manager.cpp | 4 ++ engines/titanic/game_manager.h | 4 +- engines/titanic/game_state.cpp | 11 ++++ engines/titanic/game_state.h | 11 +++- engines/titanic/main_game_window.cpp | 2 +- engines/titanic/messages/messages.h | 10 ++-- engines/titanic/module.mk | 1 + engines/titanic/mouse_cursor.cpp | 40 +++++++++++++ engines/titanic/mouse_cursor.h | 40 +++++++++++++ engines/titanic/pet_control/pet_val.cpp | 2 +- engines/titanic/pet_control/pet_val.h | 2 +- engines/titanic/pet_control/pet_val_base.cpp | 6 +- engines/titanic/pet_control/pet_val_base.h | 2 +- engines/titanic/screen_manager.cpp | 11 +++- engines/titanic/screen_manager.h | 14 ++--- 24 files changed, 250 insertions(+), 62 deletions(-) create mode 100644 engines/titanic/mouse_cursor.cpp create mode 100644 engines/titanic/mouse_cursor.h diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index f5e9806365..884873ec0e 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -39,7 +39,7 @@ CGameObject::CGameObject(): CNamedItem() { _field58 = 0; _field5C = 1; _field60 = 0; - _field74 = 1; + _cursorId = 1; _field78 = 0; _field8C = -1; _field90 = 0; @@ -70,7 +70,7 @@ void CGameObject::load(SimpleFile *file) { // Deliberate fall-through case 6: - val = _field74 = file->readNumber(); + val = _cursorId = file->readNumber(); // Deliberate fall-through case 5: @@ -122,4 +122,9 @@ void CGameObject::fn2() { error("TODO"); } +bool CGameObject::checkPoint(const Common::Point &pt, int v0, int v1) { + warning("TODO: CGameObject::checkPoint"); + return false; +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index c284fb4ebe..693f334608 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -43,9 +43,7 @@ protected: int _field54; int _field58; int _field5C; - int _field60; CMovieClipList _clipList1; - int _field74; int _field78; CMovieClipList _clipList2; int _field8C; @@ -58,6 +56,9 @@ protected: void *_fieldA8; CString _string; int _fieldB8; +public: + int _field60; + int _cursorId; public: CLASSDEF CGameObject(); @@ -73,6 +74,8 @@ public: virtual void load(SimpleFile *file); void fn2(); + + bool checkPoint(const Common::Point &pt, int v0, int v1); }; } // End of namespace Titanic diff --git a/engines/titanic/core/link_item.cpp b/engines/titanic/core/link_item.cpp index 175c11f8d0..8d077d0423 100644 --- a/engines/titanic/core/link_item.cpp +++ b/engines/titanic/core/link_item.cpp @@ -27,15 +27,6 @@ namespace Titanic { -void CLinkItemHotspot::clear() { - _field0 = 0; - _field4 = 0; - _field8 = 0; - _fieldC = 0; -} - -/*------------------------------------------------------------------------*/ - CLinkItem::CLinkItem() : CNamedItem() { _roomNumber = -1; _nodeNumber = -1; @@ -60,10 +51,10 @@ void CLinkItem::save(SimpleFile *file, int indent) const { file->writeNumberLine(_viewNumber, indent + 1); file->writeQuotedLine("Hotspot", indent + 1); - file->writeNumberLine(_hotspot._field0, indent + 2); - file->writeNumberLine(_hotspot._field4, indent + 2); - file->writeNumberLine(_hotspot._field8, indent + 2); - file->writeNumberLine(_hotspot._fieldC, indent + 2); + file->writeNumberLine(_hotspot.left, indent + 2); + file->writeNumberLine(_hotspot.top, indent + 2); + file->writeNumberLine(_hotspot.right, indent + 2); + file->writeNumberLine(_hotspot.bottom, indent + 2); CNamedItem::save(file, indent); } @@ -87,10 +78,10 @@ void CLinkItem::load(SimpleFile *file) { _viewNumber = file->readNumber(); file->readBuffer(); - _hotspot._field0 = file->readNumber(); - _hotspot._field4 = file->readNumber(); - _hotspot._field8 = file->readNumber(); - _hotspot._fieldC = file->readNumber(); + _hotspot.left = file->readNumber(); + _hotspot.top = file->readNumber(); + _hotspot.right = file->readNumber(); + _hotspot.bottom = file->readNumber(); break; default: diff --git a/engines/titanic/core/link_item.h b/engines/titanic/core/link_item.h index 06d55f3f44..55219c08cc 100644 --- a/engines/titanic/core/link_item.h +++ b/engines/titanic/core/link_item.h @@ -31,18 +31,6 @@ class CViewItem; class CNodeItem; class CRoomItem; -class CLinkItemHotspot { -public: - int _field0; - int _field4; - int _field8; - int _fieldC; -public: - CLinkItemHotspot() { clear(); } - - void clear(); -}; - class CLinkItem : public CNamedItem { private: /** @@ -56,7 +44,7 @@ protected: int _viewNumber; int _field30; int _field34; - CLinkItemHotspot _hotspot; + Common::Rect _hotspot; public: CLASSDEF CLinkItem(); diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index c632458939..485062db27 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game_manager.h" +#include "titanic/screen_manager.h" #include "titanic/core/project_item.h" #include "titanic/core/room_item.h" #include "titanic/core/view_item.h" @@ -30,6 +31,7 @@ namespace Titanic { CViewItem::CViewItem() : CNamedItem() { + Common::fill(&_buttonUpTargets[0], &_buttonUpTargets[3], nullptr); _field24 = 0; _field28 = 0.0; _viewNumber = 0; @@ -158,4 +160,69 @@ void CViewItem::enterView(CViewItem *newView) { } } +bool CViewItem::handleEvent(CMouseButtonDownMsg &msg) { + if (msg._buttons & MB_LEFT) { + mouseChange(&msg, true); + // TODO + } + + return true; +} + +bool CViewItem::mouseChange(const CMouseMsg *msg, bool flag) { + const CMouseButtonUpMsg *upMsg = dynamic_cast(msg); + if (msg->isButtonUpMsg()) { + mouseButtonUp(upMsg); + return true; + } + + Common::Array gameObjects; + CTreeItem *treeItem = scan(this); + while (treeItem) { + CGameObject *gameObject = dynamic_cast(treeItem); + if (gameObject) { + if (gameObject->checkPoint(msg->_mousePos, 0, 1) && + (!flag || !gameObject->_field60)) { + if (gameObjects.size() < 256) + gameObjects.push_back(gameObject); + } + } + } + + const CMouseMoveMsg *moveMsg = dynamic_cast(msg); + if (moveMsg) { + if (gameObjects.size() == 0) + return false; + + for (int idx = (int)gameObjects.size() - 1; idx >= 0; ++idx) { + if (gameObjects[idx]->_cursorId != 12) { + CScreenManager::_screenManagerPtr->_mouseCursor->setCursorId(gameObjects[idx]->_cursorId); + break; + } + } + } + + bool result = false; + for (int idx = (int)gameObjects.size() - 1; idx >= 0; --idx) { + if (msg->execute(gameObjects[idx])) { + if (msg->isButtonDownMsg()) + _buttonUpTargets[msg->_buttons >> 1] = gameObjects[idx]; + return true; + } + + // TODO + } + + return result; +} + +void CViewItem::mouseButtonUp(const CMouseButtonUpMsg *msg) { + CTreeItem *&target = _buttonUpTargets[msg->_buttons >> 1]; + + if (target) { + msg->execute(target); + target = nullptr; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/core/view_item.h b/engines/titanic/core/view_item.h index ad09ed69e6..9994ec6625 100644 --- a/engines/titanic/core/view_item.h +++ b/engines/titanic/core/view_item.h @@ -25,18 +25,33 @@ #include "titanic/core/named_item.h" #include "titanic/core/resource_key.h" +#include "titanic/messages/mouse_messages.h" namespace Titanic { -class CViewItem : public CNamedItem { +class CViewItem : public CNamedItem { //, CMouseButtonDownMsgTarget { +private: + CTreeItem *_buttonUpTargets[4]; private: void setData(double v); + + /** + * Called to handle mouse messagaes on the view + */ + bool mouseChange(const CMouseMsg *msg, bool flag); + + /** + * Handles mouse button up messages + */ + void mouseButtonUp(const CMouseButtonUpMsg *msg); protected: int _field24; double _field28; CResourceKey _resourceKey; int _field50; int _field54; +protected: + virtual bool handleEvent(CMouseButtonDownMsg &msg); public: int _viewNumber; public: diff --git a/engines/titanic/files_manager.cpp b/engines/titanic/files_manager.cpp index d668563258..47da8e53ba 100644 --- a/engines/titanic/files_manager.cpp +++ b/engines/titanic/files_manager.cpp @@ -55,6 +55,9 @@ bool CFilesManager::scanForFile(const CString &name) { fname += ".st"; } + if (_gameManager) + _gameManager->viewChange(); + // The original had a bunch of code here handling determining // which asset path, if any, the filename was present for, // and storing the "active asset path" it was found on. @@ -66,4 +69,8 @@ void CFilesManager::fn1() { warning("TODO: CFilesManager::fn1"); } +void CFilesManager::debug(CScreenManager *screenManager) { + warning("TODO: CFilesManager::debug"); +} + } // End of namespace Titanic diff --git a/engines/titanic/files_manager.h b/engines/titanic/files_manager.h index ae5703373d..a767056bdf 100644 --- a/engines/titanic/files_manager.h +++ b/engines/titanic/files_manager.h @@ -24,6 +24,7 @@ #define TITANIC_FILES_MANAGER_H #include "titanic/core/list.h" +#include "titanic/screen_manager.h" namespace Titanic { @@ -65,6 +66,8 @@ public: bool scanForFile(const CString &name); void fn1(); + + void debug(CScreenManager *screenManager); }; } // End of namespace Titanic diff --git a/engines/titanic/game/gondolier/gondolier_mixer.cpp b/engines/titanic/game/gondolier/gondolier_mixer.cpp index b647a31ac2..3d0a0e1f19 100644 --- a/engines/titanic/game/gondolier/gondolier_mixer.cpp +++ b/engines/titanic/game/gondolier/gondolier_mixer.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/gondolier/gondolier_mixer.h" +#include "titanic/core/room_item.h" namespace Titanic { @@ -57,7 +58,7 @@ void CGondolierMixer::load(SimpleFile *file) { } bool CGondolierMixer::handleEvent(CEnterRoomMsg &msg) { - CTreeItem *parentRoom = getParent(); + CRoomItem *parentRoom = dynamic_cast(getParent()); if (parentRoom == msg._newRoom) msg.execute(parentRoom); diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index 296299a526..1177ca8abd 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -139,6 +139,10 @@ void CGameManager::fn2() { warning("TODO"); } +void CGameManager::fn10(void *param1, CRoomItem *oldRoom, CRoomItem *newRoom) { + warning("TODO: CGameManager::fn10"); +} + void CGameManager::update() { warning("TODO: CGameManager::update"); } diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index 6404845fa2..3e33e7a928 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -78,7 +78,6 @@ public: class CGameManager { private: - CGameView *_gameView; CSound _sound; CTrueTalkManager _trueTalkManager; CGameManagerList _list; @@ -92,6 +91,7 @@ private: uint _tickCount2; public: CProjectItem *_project; + CGameView *_gameView; CGameState _gameState; Common::Rect _bounds; CInputHandler _inputHandler; @@ -151,6 +151,8 @@ public: void fn2(); + void fn10(void *param1, CRoomItem *oldRoom, CRoomItem *newRoom); + /** * Updates the state of the manager */ diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index d0baf21599..ad91a5a948 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -89,4 +89,15 @@ void CGameState::enterNode() { _nodeEnterTicks = g_vm->_events->getTicksCount(); } +void CGameState::enterView() { + CViewItem *oldView = _gameLocation.getView(); + CViewItem *newView = _list._view; + oldView->preEnterView(newView); + + _gameManager->_gameView->setView(newView); + CRoomItem *oldRoom = oldView->findNode()->findRoom(); + CRoomItem *newRoom = newView->findNode()->findRoom(); + _gameManager->fn10(_list._field14, oldRoom, newRoom); +} + } // End of namespace Titanic z diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h index 10b87b5f9a..19a59f8424 100644 --- a/engines/titanic/game_state.h +++ b/engines/titanic/game_state.h @@ -35,10 +35,10 @@ enum GameStateMode { GSMODE_0 = 0, GSMODE_1 = 1, GSMODE_2 = 2, GSMODE_3 = 3, GSM class CGameStateList : public List { public: - int _field10; - int _field14; + CViewItem *_view; + void *_field14; public: - CGameStateList() : List(), _field10(0), _field14(0) {} + CGameStateList() : List(), _view(nullptr), _field14(nullptr) {} }; class CGameState { @@ -85,6 +85,11 @@ public: * Called by the PET when a new node is entered */ void enterNode(); + + /** + * Enters a new view + */ + void enterView(); }; } // End of namespace Titanic diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 0c80149173..2c148c8c2e 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -128,7 +128,7 @@ void CMainGameWindow::fn2() { warning("TODO: Stuff"); case GSMODE_5: - warning("TODO: FilesManager::fn1"); + g_vm->_filesManager.fn1(); break; default: diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 0776ab9493..54581a7b07 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -24,10 +24,7 @@ #define TITANIC_MESSAGES_H #include "titanic/core/saveable_object.h" -#include "titanic/core/game_object.h" -#include "titanic/core/node_item.h" -#include "titanic/core/room_item.h" -#include "titanic/core/view_item.h" +#include "titanic/core/tree_item.h" namespace Titanic { @@ -40,6 +37,11 @@ enum MessageFlag { #define MSGTARGET(NAME) class NAME; class NAME##Target { public: \ virtual bool handleEvent(NAME &msg) = 0; } +class CGameObject; +class CRoomItem; +class CNodeItem; +class CViewItem; + class CMessage : public CSaveableObject { public: CLASSDEF diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index da194bf00e..af5c89c072 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -16,6 +16,7 @@ MODULE_OBJS := \ input_handler.o \ input_translator.o \ main_game_window.o \ + mouse_cursor.o \ screen_manager.o \ simple_file.o \ string.o \ diff --git a/engines/titanic/mouse_cursor.cpp b/engines/titanic/mouse_cursor.cpp new file mode 100644 index 0000000000..ee252ccf63 --- /dev/null +++ b/engines/titanic/mouse_cursor.cpp @@ -0,0 +1,40 @@ +/* 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/textconsole.h" +#include "titanic/mouse_cursor.h" + +namespace Titanic { + +void CMouseCursor::show() { + warning("CMouseCursor::show"); +} + +void CMouseCursor::hide() { + warning("CMouseCursor::hide"); +} + +void CMouseCursor::setCursorId(int id) { + warning("CMouseCursor::setCursorId"); +} + +} // End of namespace Titanic diff --git a/engines/titanic/mouse_cursor.h b/engines/titanic/mouse_cursor.h new file mode 100644 index 0000000000..ecbee8569c --- /dev/null +++ b/engines/titanic/mouse_cursor.h @@ -0,0 +1,40 @@ +/* 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. + * + */ + +#ifndef TITANIC_MOUSE_CURSOR_H +#define TITANIC_MOUSE_CURSOR_H + +#include "common/scummsys.h" + +namespace Titanic { + +class CMouseCursor { +public: + void show(); + void hide(); + void setCursorId(int id); +}; + + +} // End of namespace Titanic + +#endif /* TITANIC_MOUSE_CURSOR_H */ diff --git a/engines/titanic/pet_control/pet_val.cpp b/engines/titanic/pet_control/pet_val.cpp index 31494e1033..96b82f1632 100644 --- a/engines/titanic/pet_control/pet_val.cpp +++ b/engines/titanic/pet_control/pet_val.cpp @@ -41,7 +41,7 @@ void CPetVal::proc4() { error("TODO"); } -void CPetVal::proc5(CLinkItemHotspot *linkItem) { +void CPetVal::proc5(Common::Rect *rect) { error("TODO"); } diff --git a/engines/titanic/pet_control/pet_val.h b/engines/titanic/pet_control/pet_val.h index 2bf082fbc8..bd1fb9e55c 100644 --- a/engines/titanic/pet_control/pet_val.h +++ b/engines/titanic/pet_control/pet_val.h @@ -40,7 +40,7 @@ public: virtual void proc3(); virtual void proc4(); - virtual void proc5(CLinkItemHotspot *linkItem); + virtual void proc5(Common::Rect *linkItem); virtual int proc16(); }; diff --git a/engines/titanic/pet_control/pet_val_base.cpp b/engines/titanic/pet_control/pet_val_base.cpp index 2eb93394a9..c798c37971 100644 --- a/engines/titanic/pet_control/pet_val_base.cpp +++ b/engines/titanic/pet_control/pet_val_base.cpp @@ -28,9 +28,9 @@ namespace Titanic { CPetValBase::CPetValBase() : _field4(0), _field8(0), _fieldC(0), _field10(0), _field14(0) {} -void CPetValBase::proc5(CLinkItemHotspot *linkItem) { - if (linkItem) - linkItem->clear(); +void CPetValBase::proc5(Common::Rect *rect) { + if (rect) + *rect = Common::Rect(); } int CPetValBase::proc6() { diff --git a/engines/titanic/pet_control/pet_val_base.h b/engines/titanic/pet_control/pet_val_base.h index e6e78ae4b0..c4ff66568d 100644 --- a/engines/titanic/pet_control/pet_val_base.h +++ b/engines/titanic/pet_control/pet_val_base.h @@ -44,7 +44,7 @@ public: virtual void proc3() {} virtual void proc4() {} - virtual void proc5(CLinkItemHotspot *linkItem); + virtual void proc5(Common::Rect *rect); virtual int proc6(); virtual int proc7(); diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp index 9c88dc6de9..0c3ab6f556 100644 --- a/engines/titanic/screen_manager.cpp +++ b/engines/titanic/screen_manager.cpp @@ -110,7 +110,16 @@ void OSScreenManager::setMode(int width, int height, int bpp, uint numBackSurfac void OSScreenManager::proc5() {} void OSScreenManager::proc6() {} void OSScreenManager::proc7() {} -void OSScreenManager::proc8() {} + +CVideoSurface *OSScreenManager::getSurface(int surfaceNum) const { + if (surfaceNum == -1) + return _frontRenderSurface; + else if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) + return _backSurfaces[surfaceNum]; + else + return nullptr; +} + void OSScreenManager::proc9() {} void OSScreenManager::proc10() {} void OSScreenManager::proc11() {} diff --git a/engines/titanic/screen_manager.h b/engines/titanic/screen_manager.h index caaefc87a6..1be2de9a8c 100644 --- a/engines/titanic/screen_manager.h +++ b/engines/titanic/screen_manager.h @@ -28,6 +28,7 @@ #include "titanic/direct_draw.h" #include "titanic/font.h" #include "titanic/input_handler.h" +#include "titanic/mouse_cursor.h" #include "titanic/video_surface.h" #include "titanic/core/resource_key.h" @@ -48,11 +49,6 @@ public: CScreenManagerRec(); }; -struct MouseCursor { - void show() {} - void hide() {} -}; - class CScreenManager { protected: TitanicEngine *_vm; @@ -68,7 +64,7 @@ public: Common::Array _backSurfaces; CVideoSurface *_frontRenderSurface; CScreenManagerRec _entries[2]; - MouseCursor *_mouseCursor; + CMouseCursor *_mouseCursor; void *_textCursor; CInputHandler *_inputHandler; int _fontNumber; @@ -79,15 +75,13 @@ public: void fn1() {} void fn2() {} - - virtual void setWindowHandle(int v); virtual bool resetWindowHandle(int v); virtual void setMode(int width, int height, int bpp, uint numBackSurfaces, bool flag2) = 0; virtual void proc5() = 0; virtual void proc6() = 0; virtual void proc7() = 0; - virtual void proc8() = 0; + virtual CVideoSurface *getSurface(int surfaceNum) const = 0; virtual void proc9() = 0; virtual void proc10() = 0; virtual void proc11() = 0; @@ -153,7 +147,7 @@ public: virtual void proc5(); virtual void proc6(); virtual void proc7(); - virtual void proc8(); + virtual CVideoSurface *getSurface(int surfaceNum) const; virtual void proc9(); virtual void proc10(); virtual void proc11(); -- cgit v1.2.3 From 46d5af527d5731eee812a18a57c4105bc01447c6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 19 Mar 2016 18:31:56 -0400 Subject: TITANIC: Finished CViewItem::mouseChange --- engines/titanic/core/view_item.cpp | 3 ++- engines/titanic/messages/messages.h | 30 +++++++++++++++++++++++++++++ engines/titanic/messages/mouse_messages.h | 32 +++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 1 deletion(-) diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index 485062db27..cc8ba49ba9 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -210,7 +210,8 @@ bool CViewItem::mouseChange(const CMouseMsg *msg, bool flag) { return true; } - // TODO + if (CMouseMsg::isSupportedBy(gameObjects[idx])) + result = true; } return result; diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 54581a7b07..317cde52c6 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -94,6 +94,10 @@ public: CEditControlMsg() : _field4(0), _field8(0), _field18(0), _field1C(0), _field20(0) {} + static bool isSupportedBy(const CTreeItem *item) { + return dynamic_cast(item) != nullptr; + } + virtual bool perform(CTreeItem *treeItem) const { CEditControlMsg *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); @@ -114,6 +118,10 @@ public: CLightsMsg() : CMessage(), _field4(0), _field8(0), _fieldC(0), _field10(0) {} + static bool isSupportedBy(const CTreeItem *item) { + return dynamic_cast(item) != nullptr; + } + virtual bool perform(CTreeItem *treeItem) const { CLightsMsg *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); @@ -136,6 +144,10 @@ public: CIsHookedOnMsg() : CMessage(), _field4(0), _field8(0), _field18(0), _field1C(0), _field20(0) {} + static bool isSupportedBy(const CTreeItem *item) { + return dynamic_cast(item) != nullptr; + } + virtual bool perform(CTreeItem *treeItem) const { CIsHookedOnMsg *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); @@ -153,6 +165,10 @@ public: CLASSDEF CSubAcceptCCarryMsg() : _value1(0), _value2(0), _value3(0) {} + static bool isSupportedBy(const CTreeItem *item) { + return dynamic_cast(item) != nullptr; + } + virtual bool perform(CTreeItem *treeItem) const { CSubAcceptCCarryMsg *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); @@ -170,6 +186,10 @@ public: CLASSDEF CTransportMsg() : _value1(0), _value2(0) {} + static bool isSupportedBy(const CTreeItem *item) { + return dynamic_cast(item) != nullptr; + } + virtual bool perform(CTreeItem *treeItem) const { CTransportMsg *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); @@ -180,6 +200,8 @@ public: class NAME: public CMessage { \ public: NAME() : CMessage() {} \ CLASSDEF \ + static bool isSupportedBy(const CTreeItem *item) { \ + return dynamic_cast(item) != nullptr; } \ virtual bool handleMessage(const NAME &msg) { return false; } \ virtual bool perform(CTreeItem *treeItem) const { \ NAME *dest = dynamic_cast(treeItem); \ @@ -191,6 +213,8 @@ public: NAME() : CMessage(), _##N1(V1) {} \ NAME(F1 N1) : CMessage(), _##N1(N1) {} \ CLASSDEF \ + static bool isSupportedBy(const CTreeItem *item) { \ + return dynamic_cast(item) != nullptr; } \ virtual bool handleMessage(const NAME &msg) { return false; } \ virtual bool perform(CTreeItem *treeItem) { \ NAME *dest = dynamic_cast(treeItem); \ @@ -202,6 +226,8 @@ public: NAME() : CMessage(), _##N1(V1), _##N2(V2) {} \ NAME(F1 N1, F2 N2) : CMessage(), _##N1(N1), _##N2(N2) {} \ CLASSDEF \ + static bool isSupportedBy(const CTreeItem *item) { \ + return dynamic_cast(item) != nullptr; } \ virtual bool handleMessage(const NAME &msg) { return false; } \ virtual bool perform(CTreeItem *treeItem) { \ NAME *dest = dynamic_cast(treeItem); \ @@ -213,6 +239,8 @@ public: NAME() : CMessage(), _##N1(V1), _##N2(V2), _##N3(V3) {} \ NAME(F1 N1, F2 N2, F3 N3) : CMessage(), _##N1(N1), _##N2(N2), _##N3(N3) {} \ CLASSDEF \ + static bool isSupportedBy(const CTreeItem *item) { \ + return dynamic_cast(item) != nullptr; } \ virtual bool handleMessage(const NAME &msg) { return false; } \ virtual bool perform(CTreeItem *treeItem) { \ NAME *dest = dynamic_cast(treeItem); \ @@ -224,6 +252,8 @@ public: NAME() : CMessage(), _##N1(V1), _##N2(V2), _##N3(V3), _##N4(V4) {} \ NAME(F1 N1, F2 N2, F3 N3, F4 N4) : CMessage(), _##N1(N1), _##N2(N2), _##N3(N3), _##N4(N4) {} \ CLASSDEF \ + static bool isSupportedBy(const CTreeItem *item) { \ + return dynamic_cast(item) != nullptr; } \ virtual bool handleMessage(const NAME &msg) { return false; } \ virtual bool perform(CTreeItem *treeItem) { \ NAME *dest = dynamic_cast(treeItem); \ diff --git a/engines/titanic/messages/mouse_messages.h b/engines/titanic/messages/mouse_messages.h index fff392e465..84d7b8f61c 100644 --- a/engines/titanic/messages/mouse_messages.h +++ b/engines/titanic/messages/mouse_messages.h @@ -36,6 +36,9 @@ public: Common::Point _mousePos; public: CLASSDEF + static bool isSupportedBy(const CTreeItem *item) { + return dynamic_cast(item) != nullptr; + } CMouseMsg() : _buttons(0) {} CMouseMsg(const Common::Point &pt, int buttons) : _mousePos(pt), _buttons(buttons) {} @@ -48,6 +51,9 @@ public: CMouseMoveMsg() : CMouseMsg() {} CMouseMoveMsg(const Common::Point &pt, int buttons) : CMouseMsg(pt, buttons) {} + static bool isSupportedBy(const CTreeItem *item) { + return dynamic_cast(item) != nullptr; + } virtual bool handleMessage(const CMouseMoveMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { CMouseMoveMsg *dest = dynamic_cast(treeItem); @@ -62,6 +68,10 @@ public: CLASSDEF CMouseButtonMsg() : CMouseMsg(), _field10(0) {} CMouseButtonMsg(const Common::Point &pt, int buttons) : CMouseMsg(pt, buttons) {} + + static bool isSupportedBy(const CTreeItem *item) { + return dynamic_cast(item) != nullptr; + } }; MSGTARGET(CMouseButtonDownMsg); @@ -71,6 +81,9 @@ public: CMouseButtonDownMsg() : CMouseButtonMsg() {} CMouseButtonDownMsg(const Common::Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} + static bool isSupportedBy(const CTreeItem *item) { + return dynamic_cast(item) != nullptr; + } virtual bool handleMessage(const CMouseButtonDownMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { CMouseButtonDownMsg *dest = dynamic_cast(treeItem); @@ -85,6 +98,9 @@ public: CMouseButtonUpMsg() : CMouseButtonMsg() {} CMouseButtonUpMsg(const Common::Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} + static bool isSupportedBy(const CTreeItem *item) { + return dynamic_cast(item) != nullptr; + } virtual bool handleMessage(const CMouseButtonUpMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { CMouseButtonUpMsg *dest = dynamic_cast(treeItem); @@ -99,6 +115,9 @@ public: CMouseButtonDoubleClickMsg() : CMouseButtonMsg() {} CMouseButtonDoubleClickMsg(const Common::Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} + static bool isSupportedBy(const CTreeItem *item) { + return dynamic_cast(item) != nullptr; + } virtual bool handleMessage(const CMouseButtonDoubleClickMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { CMouseButtonDoubleClickMsg *dest = dynamic_cast(treeItem); @@ -111,6 +130,10 @@ public: CLASSDEF CMouseDragMsg() : CMouseMsg() {} CMouseDragMsg(const Common::Point &pt) : CMouseMsg(pt, 0) {} + + static bool isSupportedBy(const CTreeItem *item) { + return dynamic_cast(item) != nullptr; + } }; class CMouseDragMoveMsg : public CMouseDragMsg { @@ -119,6 +142,9 @@ public: CMouseDragMoveMsg() : CMouseDragMsg() {} CMouseDragMoveMsg(const Common::Point &pt) : CMouseDragMsg(pt) {} + static bool isSupportedBy(const CTreeItem *item) { + return dynamic_cast(item) != nullptr; + } virtual bool handleMessage(const CMouseDragMoveMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { CMouseDragMoveMsg *dest = dynamic_cast(treeItem); @@ -137,6 +163,9 @@ public: CMouseDragStartMsg(const Common::Point &pt) : CMouseDragMsg(pt), _dragItem(nullptr), _field14(0) {} + static bool isSupportedBy(const CTreeItem *item) { + return dynamic_cast(item) != nullptr; + } virtual bool handleMessage(const CMouseDragStartMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { CMouseDragStartMsg *dest = dynamic_cast(treeItem); @@ -154,6 +183,9 @@ public: CMouseDragEndMsg(const Common::Point &pt, CTreeItem *dragItem = nullptr) : CMouseDragMsg(pt), _dragItem(dragItem) {} + static bool isSupportedBy(const CTreeItem *item) { + return dynamic_cast(item) != nullptr; + } virtual bool handleMessage(const CMouseDragEndMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { CMouseDragEndMsg *dest = dynamic_cast(treeItem); -- cgit v1.2.3 From dbd8ab0f1c11f1e749c74fe70e5fc2496332a1c5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 19 Mar 2016 20:56:29 -0400 Subject: TITANIC: Implement view change logic --- engines/titanic/core/link_item.cpp | 20 +++++++++------- engines/titanic/core/link_item.h | 9 +++++++- engines/titanic/core/movie_clip.cpp | 16 ++++++++++--- engines/titanic/core/movie_clip.h | 4 +++- engines/titanic/core/room_item.h | 5 ++++ engines/titanic/core/view_item.cpp | 25 ++++++++++++++++---- engines/titanic/core/view_item.h | 4 ++-- engines/titanic/debugger.cpp | 8 ++++--- engines/titanic/events.cpp | 21 +++++++++++++++++ engines/titanic/events.h | 7 ++++++ engines/titanic/game_manager.cpp | 4 ++-- engines/titanic/game_manager.h | 9 ++++++-- engines/titanic/game_state.cpp | 36 +++++++++++++++++++++++++++-- engines/titanic/game_state.h | 15 ++++++++++-- engines/titanic/pet_control/pet_control.cpp | 4 ++-- engines/titanic/sound/sound.cpp | 4 ++++ engines/titanic/sound/sound.h | 6 +++++ 17 files changed, 165 insertions(+), 32 deletions(-) diff --git a/engines/titanic/core/link_item.cpp b/engines/titanic/core/link_item.cpp index 8d077d0423..02b4215cfa 100644 --- a/engines/titanic/core/link_item.cpp +++ b/engines/titanic/core/link_item.cpp @@ -51,10 +51,10 @@ void CLinkItem::save(SimpleFile *file, int indent) const { file->writeNumberLine(_viewNumber, indent + 1); file->writeQuotedLine("Hotspot", indent + 1); - file->writeNumberLine(_hotspot.left, indent + 2); - file->writeNumberLine(_hotspot.top, indent + 2); - file->writeNumberLine(_hotspot.right, indent + 2); - file->writeNumberLine(_hotspot.bottom, indent + 2); + file->writeNumberLine(_bounds.left, indent + 2); + file->writeNumberLine(_bounds.top, indent + 2); + file->writeNumberLine(_bounds.right, indent + 2); + file->writeNumberLine(_bounds.bottom, indent + 2); CNamedItem::save(file, indent); } @@ -78,10 +78,10 @@ void CLinkItem::load(SimpleFile *file) { _viewNumber = file->readNumber(); file->readBuffer(); - _hotspot.left = file->readNumber(); - _hotspot.top = file->readNumber(); - _hotspot.right = file->readNumber(); - _hotspot.bottom = file->readNumber(); + _bounds.left = file->readNumber(); + _bounds.top = file->readNumber(); + _bounds.right = file->readNumber(); + _bounds.bottom = file->readNumber(); break; default: @@ -130,4 +130,8 @@ CRoomItem *CLinkItem::getDestRoom() const { return getDestNode()->findRoom(); } +CMovieClip *CLinkItem::getClip() const { + return findRoom()->findClip(getName()); +} + } // End of namespace Titanic diff --git a/engines/titanic/core/link_item.h b/engines/titanic/core/link_item.h index 55219c08cc..733a4c9bdd 100644 --- a/engines/titanic/core/link_item.h +++ b/engines/titanic/core/link_item.h @@ -24,6 +24,7 @@ #define TITANIC_LINK_ITEM_H #include "titanic/core/named_item.h" +#include "titanic/core/movie_clip.h" namespace Titanic { @@ -44,7 +45,8 @@ protected: int _viewNumber; int _field30; int _field34; - Common::Rect _hotspot; +public: + Common::Rect _bounds; public: CLASSDEF CLinkItem(); @@ -79,6 +81,11 @@ public: * Get the destination view for the link item */ virtual CRoomItem *getDestRoom() const; + + /** + * Get the movie clip, if any, that's used when the link is used + */ + CMovieClip *getClip() const; }; } // End of namespace Titanic diff --git a/engines/titanic/core/movie_clip.cpp b/engines/titanic/core/movie_clip.cpp index fec09f6542..9a787e2aa9 100644 --- a/engines/titanic/core/movie_clip.cpp +++ b/engines/titanic/core/movie_clip.cpp @@ -30,7 +30,7 @@ CMovieClip::CMovieClip() { void CMovieClip::save(SimpleFile *file, int indent) const { file->writeNumberLine(2, indent); file->writeQuotedLine("Clip", indent); - file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_name, indent); file->writeNumberLine(_field18, indent); file->writeNumberLine(_field1C, indent); @@ -42,7 +42,7 @@ void CMovieClip::load(SimpleFile *file) { switch (val) { case 1: - _string1 = file->readString(); + _name = file->readString(); _field18 = file->readNumber(); _field1C = file->readNumber(); _field20 = file->readNumber(); @@ -54,7 +54,7 @@ void CMovieClip::load(SimpleFile *file) { case 2: file->readString(); - _string1 = file->readString(); + _name = file->readString(); _field18 = file->readNumber(); _field1C = file->readNumber(); break; @@ -66,4 +66,14 @@ void CMovieClip::load(SimpleFile *file) { ListItem::load(file); } +CMovieClip *CMovieClipList::findByName(const Common::String &name) const { + for (const_iterator i = begin(); i != end(); ++i) { + CMovieClip *clip = *i; + if (clip->_name == name) + return clip; + } + + return nullptr; +} + } // End of namespace Titanic diff --git a/engines/titanic/core/movie_clip.h b/engines/titanic/core/movie_clip.h index cd6125d438..0abda9453f 100644 --- a/engines/titanic/core/movie_clip.h +++ b/engines/titanic/core/movie_clip.h @@ -32,7 +32,6 @@ namespace Titanic { */ class CMovieClip : public ListItem { private: - CString _string1; int _field18; int _field1C; int _field20; @@ -42,6 +41,8 @@ private: int _field30; CString _string2; CString _string3; +public: + CString _name; public: CLASSDEF CMovieClip(); @@ -62,6 +63,7 @@ public: */ class CMovieClipList: public List { public: + CMovieClip *findByName(const Common::String &name) const; }; } // End of namespace Titanic diff --git a/engines/titanic/core/room_item.h b/engines/titanic/core/room_item.h index 2235f6a5d2..a42ffab32e 100644 --- a/engines/titanic/core/room_item.h +++ b/engines/titanic/core/room_item.h @@ -54,6 +54,11 @@ public: * Load the data for the class from file */ virtual void load(SimpleFile *file); + + /** + * Return a movie clip for the room by name + */ + CMovieClip *findClip(const CString &name) { return _clipList.findByName(name); } }; } // End of namespace Titanic diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index cc8ba49ba9..a80f25bcc1 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -162,17 +162,34 @@ void CViewItem::enterView(CViewItem *newView) { bool CViewItem::handleEvent(CMouseButtonDownMsg &msg) { if (msg._buttons & MB_LEFT) { - mouseChange(&msg, true); + if (!handleMouseMsg(&msg, true)) { + CGameManager *gm = getGameManager(); + if (gm->test54()) { + findNode()->findRoom(); + + CLinkItem *linkItem = dynamic_cast( + findChildInstanceOf(CLinkItem::_type)); + while (linkItem) { + if (linkItem->_bounds.contains(msg._mousePos)) { + gm->_gameState.triggerLink(linkItem); + return true; + } + + linkItem = dynamic_cast( + findNextInstanceOf(CLinkItem::_type, linkItem)); + } + } + } // TODO } return true; } -bool CViewItem::mouseChange(const CMouseMsg *msg, bool flag) { +bool CViewItem::handleMouseMsg(const CMouseMsg *msg, bool flag) { const CMouseButtonUpMsg *upMsg = dynamic_cast(msg); if (msg->isButtonUpMsg()) { - mouseButtonUp(upMsg); + handleButtonUpMsg(upMsg); return true; } @@ -217,7 +234,7 @@ bool CViewItem::mouseChange(const CMouseMsg *msg, bool flag) { return result; } -void CViewItem::mouseButtonUp(const CMouseButtonUpMsg *msg) { +void CViewItem::handleButtonUpMsg(const CMouseButtonUpMsg *msg) { CTreeItem *&target = _buttonUpTargets[msg->_buttons >> 1]; if (target) { diff --git a/engines/titanic/core/view_item.h b/engines/titanic/core/view_item.h index 9994ec6625..b1de0bb305 100644 --- a/engines/titanic/core/view_item.h +++ b/engines/titanic/core/view_item.h @@ -38,12 +38,12 @@ private: /** * Called to handle mouse messagaes on the view */ - bool mouseChange(const CMouseMsg *msg, bool flag); + bool handleMouseMsg(const CMouseMsg *msg, bool flag); /** * Handles mouse button up messages */ - void mouseButtonUp(const CMouseButtonUpMsg *msg); + void handleButtonUpMsg(const CMouseButtonUpMsg *msg); protected: int _field24; double _field28; diff --git a/engines/titanic/debugger.cpp b/engines/titanic/debugger.cpp index 7af86fc71d..87ce07d189 100644 --- a/engines/titanic/debugger.cpp +++ b/engines/titanic/debugger.cpp @@ -160,10 +160,12 @@ bool Debugger::cmdRoom(int argc, const char **argv) { else { CViewItem *viewItem = findView(nodeItem, argv[3]); - if (!viewItem) + if (!viewItem) { debugPrintf("Could not find view - %s\n", argv[3]); - else { - debugPrintf("Found view. TODO: Jump to it\n"); + } else { + // Change to the specified view + g_vm->_window->_gameManager->_gameState.changeView(viewItem, nullptr); + return false; } } } diff --git a/engines/titanic/events.cpp b/engines/titanic/events.cpp index 09ec3e5872..346b43c02b 100644 --- a/engines/titanic/events.cpp +++ b/engines/titanic/events.cpp @@ -66,6 +66,9 @@ void Events::pollEvents() { case Common::EVENT_KEYDOWN: keyDown(event.kbd); break; + case Common::EVENT_KEYUP: + keyUp(event.kbd); + break; default: break; } @@ -177,6 +180,8 @@ void Events::charPress(char c) { } void Events::keyDown(Common::KeyState keyState) { + handleKbdSpecial(keyState); + if (keyState.keycode == Common::KEYCODE_d && (keyState.flags & Common::KBD_CTRL)) { // Attach to the debugger _vm->_debugger->attach(); @@ -184,4 +189,20 @@ void Events::keyDown(Common::KeyState keyState) { } } +void Events::keyUp(Common::KeyState keyState) { + handleKbdSpecial(keyState); +} + +void Events::handleKbdSpecial(Common::KeyState keyState) { + if (keyState.flags & Common::KBD_CTRL) + _specialButtons |= MK_CONTROL; + else + _specialButtons &= ~MK_CONTROL; + + if (keyState.flags & Common::KBD_SHIFT) + _specialButtons |= MK_SHIFT; + else + _specialButtons &= ~MK_SHIFT; +} + } // End of namespace Titanic diff --git a/engines/titanic/events.h b/engines/titanic/events.h index dc1781fae1..fe2c75166d 100644 --- a/engines/titanic/events.h +++ b/engines/titanic/events.h @@ -67,6 +67,8 @@ private: void rightButtonDoubleClick(); void charPress(char c); void keyDown(Common::KeyState keyState); + void keyUp(Common::KeyState keyState); + void handleKbdSpecial(Common::KeyState keyState); public: Events(TitanicEngine *vm); ~Events() {} @@ -91,6 +93,11 @@ public: * Get the elapsed playtime */ uint32 getTicksCount() const; + + /** + * Return whether a given special key is currently pressed + */ + bool isSpecialPressed(SpecialButtons btn) const { return _specialButtons; } }; } // End of namespace Titanic diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index 1177ca8abd..4a45fa52f9 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -139,8 +139,8 @@ void CGameManager::fn2() { warning("TODO"); } -void CGameManager::fn10(void *param1, CRoomItem *oldRoom, CRoomItem *newRoom) { - warning("TODO: CGameManager::fn10"); +void CGameManager::playClip(CMovieClip *clip, CRoomItem *oldRoom, CRoomItem *newRoom) { + warning("TODO: CGameManager::playClip"); } void CGameManager::update() { diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index 3e33e7a928..38edc6e1a4 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -78,7 +78,6 @@ public: class CGameManager { private: - CSound _sound; CTrueTalkManager _trueTalkManager; CGameManagerList _list; int _field30; @@ -98,6 +97,7 @@ public: CInputTranslator _inputTranslator; CTreeItem *_dragItem; CMusicRoom _musicRoom; + CSound _sound; public: CGameManager(CProjectItem *project, CGameView *gameView); ~CGameManager(); @@ -151,7 +151,10 @@ public: void fn2(); - void fn10(void *param1, CRoomItem *oldRoom, CRoomItem *newRoom); + /** + * Plays a movie clip + */ + void playClip(CMovieClip *clip, CRoomItem *oldRoom, CRoomItem *newRoom); /** * Updates the state of the manager @@ -162,6 +165,8 @@ public: * Called when the view changes */ void viewChange(); + + bool test54() const { return !_field54; } }; } // End of namespace Titanic diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index ad91a5a948..f10f945f93 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -97,7 +97,39 @@ void CGameState::enterView() { _gameManager->_gameView->setView(newView); CRoomItem *oldRoom = oldView->findNode()->findRoom(); CRoomItem *newRoom = newView->findNode()->findRoom(); - _gameManager->fn10(_list._field14, oldRoom, newRoom); + _gameManager->playClip(_list._movieClip, oldRoom, newRoom); } -} // End of namespace Titanic z +void CGameState::triggerLink(CLinkItem *link) { + changeView(link->getDestView(), link->getClip()); +} + +void CGameState::changeView(CViewItem *newView, CMovieClip *clip) { + // Signal the old view that it's being left + CViewItem *oldView = _gameLocation.getView(); + oldView->leaveView(newView); + + // If Shift key is pressed, skip showing the transition clip + if (g_vm->_events->isSpecialPressed(MK_SHIFT)) + clip = nullptr; + + if (_mode == GSMODE_2) { + _list._view = newView; + _list._movieClip = clip; + } else { + oldView->preEnterView(newView); + _gameManager->_gameView->setView(newView); + CRoomItem *oldRoom = newView->findNode()->findRoom(); + CRoomItem *newRoom = newView->findNode()->findRoom(); + + // If a transition clip is defined, play it + if (clip) + _gameManager->playClip(clip, oldRoom, newRoom); + + // Final view change handling + _gameManager->_sound.viewChanged(newView, newRoom != oldRoom); + oldView->enterView(newView); + } +} + +} // End of namespace Titanic diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h index 19a59f8424..b9d25e9662 100644 --- a/engines/titanic/game_state.h +++ b/engines/titanic/game_state.h @@ -24,6 +24,7 @@ #define TITANIC_GAME_STATE_H #include "titanic/core/list.h" +#include "titanic/core/link_item.h" #include "titanic/simple_file.h" #include "titanic/game_location.h" @@ -36,9 +37,9 @@ enum GameStateMode { GSMODE_0 = 0, GSMODE_1 = 1, GSMODE_2 = 2, GSMODE_3 = 3, GSM class CGameStateList : public List { public: CViewItem *_view; - void *_field14; + CMovieClip *_movieClip; public: - CGameStateList() : List(), _view(nullptr), _field14(nullptr) {} + CGameStateList() : List(), _view(nullptr), _movieClip(nullptr) {} }; class CGameState { @@ -90,6 +91,16 @@ public: * Enters a new view */ void enterView(); + + /** + * Triggers a link item in a view + */ + void triggerLink(CLinkItem *link); + + /** + * Changes the current view + */ + void changeView(CViewItem *newView, CMovieClip *clip); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index a61773d319..f5498887e3 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -38,9 +38,9 @@ void CPetControl::save(SimpleFile *file, int indent) const { void CPetControl::load(SimpleFile *file) { int val = file->readNumber(); - bool valid = isValid(); + isValid(); - if (!valid) { + if (!val) { _fieldBC = file->readNumber(); _string1 = file->readString(); _string2 = file->readString(); diff --git a/engines/titanic/sound/sound.cpp b/engines/titanic/sound/sound.cpp index 062e43debc..54c14508cf 100644 --- a/engines/titanic/sound/sound.cpp +++ b/engines/titanic/sound/sound.cpp @@ -43,4 +43,8 @@ void CSound::preLoad() { _gameManager->_musicRoom.preLoad(); } +void CSound::viewChanged(CViewItem *newView, bool isNewRoom) { + warning("CSound::viewChanged"); +} + } // End of namespace Titanic z diff --git a/engines/titanic/sound/sound.h b/engines/titanic/sound/sound.h index fce29eb625..0bfd3f29b1 100644 --- a/engines/titanic/sound/sound.h +++ b/engines/titanic/sound/sound.h @@ -25,6 +25,7 @@ #include "titanic/simple_file.h" #include "titanic/sound/sound_manager.h" +#include "titanic/core/view_item.h" namespace Titanic { @@ -66,6 +67,11 @@ public: * Called when a game has finished being saved */ void postSave() { _soundManager.postSave(); } + + /** + * Called when the view has been changed + */ + void viewChanged(CViewItem *newView, bool isNewRoom); }; } // End of namespace Titanic -- cgit v1.2.3 From c6b239bdac7c193bc4d0fe8cfc6fbb610d1ca1ca Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 19 Mar 2016 22:43:02 -0400 Subject: TITANIC: Implemented CGameManager::update --- engines/titanic/core/saveable_object.cpp | 2 + engines/titanic/game_location.cpp | 2 +- engines/titanic/game_manager.cpp | 75 ++++++++++++++++++++++++- engines/titanic/game_manager.h | 27 ++++++++- engines/titanic/game_state.cpp | 24 +++++++- engines/titanic/game_state.h | 7 +++ engines/titanic/game_view.cpp | 2 +- engines/titanic/game_view.h | 4 +- engines/titanic/messages/messages.h | 1 + engines/titanic/module.mk | 1 + engines/titanic/mouse_cursor.cpp | 4 ++ engines/titanic/mouse_cursor.h | 5 ++ engines/titanic/screen_manager.cpp | 18 +++--- engines/titanic/screen_manager.h | 25 +++------ engines/titanic/sound/sound.cpp | 4 +- engines/titanic/sound/sound.h | 2 +- engines/titanic/text_cursor.cpp | 37 ++++++++++++ engines/titanic/text_cursor.h | 41 ++++++++++++++ engines/titanic/true_talk/true_talk_manager.cpp | 8 +++ engines/titanic/true_talk/true_talk_manager.h | 4 ++ 20 files changed, 254 insertions(+), 39 deletions(-) create mode 100644 engines/titanic/text_cursor.cpp create mode 100644 engines/titanic/text_cursor.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 5fbe88878f..2c4eea5f3c 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -785,6 +785,7 @@ DEFFN(CEnterRoomMsg); DEFFN(CEnterViewMsg); DEFFN(CEjectCylinderMsg) DEFFN(CErasePhonographCylinderMsg) +DEFFN(CFrameMsg) DEFFN(CFreshenCookieMsg) DEFFN(CGetChevClassBits) DEFFN(CGetChevClassNum) @@ -1361,6 +1362,7 @@ void CSaveableObject::initClassList() { ADDFN(CEnterViewMsg, CMessage); ADDFN(CEjectCylinderMsg, CMessage); ADDFN(CErasePhonographCylinderMsg, CMessage); + ADDFN(CFrameMsg, CMessage); ADDFN(CFreshenCookieMsg, CMessage); ADDFN(CGetChevClassBits, CMessage); ADDFN(CGetChevClassNum, CMessage); diff --git a/engines/titanic/game_location.cpp b/engines/titanic/game_location.cpp index 2a01bbf248..23c2ae2598 100644 --- a/engines/titanic/game_location.cpp +++ b/engines/titanic/game_location.cpp @@ -112,4 +112,4 @@ CRoomItem *CGameLocation::getRoom() { return !view ? nullptr : view->findRoom(); } -} // End of namespace Titanic z +} // End of namespace Titanic diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index 4a45fa52f9..1c480e5d4d 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -26,6 +26,7 @@ #include "titanic/screen_manager.h" #include "titanic/core/project_item.h" #include "titanic/messages/messages.h" +#include "titanic/pet_control/pet_control.h" namespace Titanic { @@ -44,6 +45,10 @@ void CGameManagerList::postSave() { (*i)->postSave(); } +void CGameManagerList::update(uint ticks) { + warning("TODO: CGameManagerList::update"); +} + /*------------------------------------------------------------------------*/ void CGameManagerListItem::postLoad(uint ticks, CProjectItem *project) { @@ -64,7 +69,7 @@ CGameManager::CGameManager(CProjectItem *project, CGameView *gameView): _project(project), _gameView(gameView), _trueTalkManager(this), _inputHandler(this), _inputTranslator(&_inputHandler), _gameState(this), _sound(this), _musicRoom(this), - _field30(0), _field34(0), _field4C(0), + _field30(0), _soundMaker(nullptr), _field4C(0), _dragItem(nullptr), _field54(0), _lastDiskTicksCount(0), _tickCount2(0) { _videoSurface1 = nullptr; @@ -85,7 +90,7 @@ void CGameManager::load(SimpleFile *file) { void CGameManager::preLoad() { updateDiskTicksCount(); _list.destroyContents(); - _field34 = 0; + _soundMaker = nullptr; _trueTalkManager.preLoad(); _sound.preLoad(); @@ -144,7 +149,49 @@ void CGameManager::playClip(CMovieClip *clip, CRoomItem *oldRoom, CRoomItem *new } void CGameManager::update() { - warning("TODO: CGameManager::update"); + handleMovies(); + frameMessage(getRoom()); + _list.update(g_vm->_events->getTicksCount()); + _trueTalkManager.update1(); + _trueTalkManager.update2(); + CScreenManager::_screenManagerPtr->_mouseCursor->update(); + + CViewItem *view = getView(); + if (view) { + // Expand the game manager's bounds to encompass all the view's items + for (CTreeItem *item = view; item; item = item->scan(view)) { + Common::Rect r = item->getBounds(); + if (!r.isEmpty()) + _bounds.extend(r); + } + + // Also include the PET control in the bounds + if (_project) { + CPetControl *pet = _project->getPetControl(); + if (pet) + _bounds.extend(pet->getBounds()); + } + + // And the text cursor + CScreenManager *screenManager = CScreenManager::_screenManagerPtr; + CTextCursor *textCursor = screenManager->_textCursor; + if (textCursor->_active) + _bounds.extend(textCursor->getBounds()); + + // Set the surface bounds + screenManager->setSurfaceBounds(0, _bounds); + + if (!_bounds.isEmpty()) { + _gameView->proc4(_bounds); + _bounds = Common::Rect(); + } + + _gameState.checkForViewChange(); + } +} + +void CGameManager::handleMovies() { + warning("TODO: CGameManager::handleMovies"); } void CGameManager::updateDiskTicksCount() { @@ -165,4 +212,26 @@ void CGameManager::viewChange() { initBounds(); } +CRoomItem *CGameManager::getRoom() { + return _gameState._gameLocation.getRoom(); +} + +void CGameManager::frameMessage(CRoomItem *room) { + if (room) { + // Signal the next frame + CFrameMsg frameMsg(g_vm->_events->getTicksCount()); + frameMsg.execute(room, nullptr, MSGFLAG_SCAN); + + if (!_soundMaker) { + // Check for a sound maker in the room + _soundMaker = dynamic_cast( + _project->findByName("zBackgroundSoundMaker")); + } + + // If there's a sound maker, dispatch the event to it as well + if (_soundMaker) + frameMsg.execute(_soundMaker); + } +} + } // End of namespace Titanic diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index 38edc6e1a4..f63b571ded 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -30,6 +30,7 @@ #include "titanic/simple_file.h" #include "titanic/video_surface.h" #include "titanic/true_talk/true_talk_manager.h" +#include "titanic/sound/background_sound_maker.h" #include "titanic/sound/music_room.h" #include "titanic/sound/sound.h" @@ -74,6 +75,11 @@ public: * Called when a game has finished being saved */ void postSave(); + + /** + * Handles an update + */ + void update(uint ticks); }; class CGameManager { @@ -81,13 +87,28 @@ private: CTrueTalkManager _trueTalkManager; CGameManagerList _list; int _field30; - int _field34; + CBackgroundSoundMaker *_soundMaker; CVideoSurface *_videoSurface1; int _field4C; int _field54; CVideoSurface *_videoSurface2; uint _lastDiskTicksCount; uint _tickCount2; +private: + /** + * Return the current room + */ + CRoomItem *getRoom(); + + /** + * Generates a message for the next game frame + */ + void frameMessage(CRoomItem *room); + + /** + * Handles any ongoing movie playback + */ + void handleMovies(); public: CProjectItem *_project; CGameView *_gameView; @@ -167,6 +188,10 @@ public: void viewChange(); bool test54() const { return !_field54; } + + void inc54() { ++_field54; } + + void dec54() { --_field54; } }; } // End of namespace Titanic diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index f10f945f93..f906ff66d3 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -27,6 +27,13 @@ namespace Titanic { +bool CGameStateList::isViewChanging() const { + warning("TODO: CGameStateList::isViewChanging"); + return false; +} + +/*------------------------------------------------------------------------*/ + CGameState::CGameState(CGameManager *gameManager) : _gameManager(gameManager), _gameLocation(this), _field8(0), _fieldC(0), _mode(GSMODE_0), _field14(0), _field18(0), @@ -98,6 +105,13 @@ void CGameState::enterView() { CRoomItem *oldRoom = oldView->findNode()->findRoom(); CRoomItem *newRoom = newView->findNode()->findRoom(); _gameManager->playClip(_list._movieClip, oldRoom, newRoom); + + _gameManager->_sound.preEnterView(newView, newRoom != oldRoom); + _gameManager->dec54(); + oldView->enterView(newView); + + _list._view = nullptr; + _list._movieClip = nullptr; } void CGameState::triggerLink(CLinkItem *link) { @@ -127,9 +141,17 @@ void CGameState::changeView(CViewItem *newView, CMovieClip *clip) { _gameManager->playClip(clip, oldRoom, newRoom); // Final view change handling - _gameManager->_sound.viewChanged(newView, newRoom != oldRoom); + _gameManager->_sound.preEnterView(newView, newRoom != oldRoom); oldView->enterView(newView); } } +void CGameState::checkForViewChange() { + if (_mode == GSMODE_2 && _list.isViewChanging()) { + setMode(GSMODE_1); + if (_list._view) + enterView(); + } +} + } // End of namespace Titanic diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h index b9d25e9662..37bb603317 100644 --- a/engines/titanic/game_state.h +++ b/engines/titanic/game_state.h @@ -40,6 +40,8 @@ public: CMovieClip *_movieClip; public: CGameStateList() : List(), _view(nullptr), _movieClip(nullptr) {} + + bool isViewChanging() const; }; class CGameState { @@ -101,6 +103,11 @@ public: * Changes the current view */ void changeView(CViewItem *newView, CMovieClip *clip); + + /** + * Check for whether it's time to change the active view + */ + void checkForViewChange(); }; } // End of namespace Titanic diff --git a/engines/titanic/game_view.cpp b/engines/titanic/game_view.cpp index bf901bb704..86ad072f61 100644 --- a/engines/titanic/game_view.cpp +++ b/engines/titanic/game_view.cpp @@ -67,7 +67,7 @@ void CSTGameView::setView(CViewItem *view) { _gameWindow->setActiveView(view); } -void CSTGameView::proc4() { +void CSTGameView::proc4(const Common::Rect &bounds) { _gameWindow->fn2(); } diff --git a/engines/titanic/game_view.h b/engines/titanic/game_view.h index 9ede9d6c36..be4d934a33 100644 --- a/engines/titanic/game_view.h +++ b/engines/titanic/game_view.h @@ -57,7 +57,7 @@ public: */ virtual void setView(CViewItem *item) = 0; - virtual void proc4() = 0; + virtual void proc4(const Common::Rect &bounds) = 0; /** * Creates a surface from a specified resource @@ -76,7 +76,7 @@ public: */ virtual void setView(CViewItem *item); - virtual void proc4(); + virtual void proc4(const Common::Rect &bounds); }; } // End of namespace Titanic diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 317cde52c6..ccea453a26 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -298,6 +298,7 @@ MESSAGE2(CEnterNodeMsg, CNodeItem *, oldNode, nullptr, CNodeItem *, newNode, nul MESSAGE2(CEnterRoomMsg, CRoomItem *, oldRoom, nullptr, CRoomItem *, newRoom, nullptr); MESSAGE2(CEnterViewMsg, CViewItem *, oldView, nullptr, CViewItem *, newView, nullptr); MESSAGE0(CErasePhonographCylinderMsg); +MESSAGE1(CFrameMsg, uint, ticks, 0); MESSAGE2(CFreshenCookieMsg, int, value1, 0, int, value2, 0); MESSAGE1(CGetChevClassBits, int, value, 0); MESSAGE1(CGetChevClassNum, int, value, 0); diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index af5c89c072..f62ef96d0b 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -20,6 +20,7 @@ MODULE_OBJS := \ screen_manager.o \ simple_file.o \ string.o \ + text_cursor.o \ titanic.o \ video_surface.o \ carry/auditory_centre.o \ diff --git a/engines/titanic/mouse_cursor.cpp b/engines/titanic/mouse_cursor.cpp index ee252ccf63..578bf9981f 100644 --- a/engines/titanic/mouse_cursor.cpp +++ b/engines/titanic/mouse_cursor.cpp @@ -37,4 +37,8 @@ void CMouseCursor::setCursorId(int id) { warning("CMouseCursor::setCursorId"); } +void CMouseCursor::update() { + warning("CMouseCursor::update"); +} + } // End of namespace Titanic diff --git a/engines/titanic/mouse_cursor.h b/engines/titanic/mouse_cursor.h index ecbee8569c..c6df65d096 100644 --- a/engines/titanic/mouse_cursor.h +++ b/engines/titanic/mouse_cursor.h @@ -32,6 +32,11 @@ public: void show(); void hide(); void setCursorId(int id); + + /** + * Updates the mouse cursor + */ + void update(); }; diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp index 0c3ab6f556..59a322e919 100644 --- a/engines/titanic/screen_manager.cpp +++ b/engines/titanic/screen_manager.cpp @@ -25,15 +25,6 @@ namespace Titanic { -CScreenManagerRec::CScreenManagerRec() { - _field0 = 0; - _field4 = 0; - _field8 = 0; - _fieldC = 0; -} - -/*------------------------------------------------------------------------*/ - CScreenManager *CScreenManager::_screenManagerPtr; CScreenManager *CScreenManager::_currentScreenManagerPtr; @@ -71,6 +62,11 @@ CScreenManager *CScreenManager::setCurrent() { return _currentScreenManagerPtr; } +void CScreenManager::setSurfaceBounds(int surfaceNum, const Common::Rect &r) { + if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) + _backSurfaces[surfaceNum]._bounds = r; +} + /*------------------------------------------------------------------------*/ OSScreenManager::OSScreenManager(TitanicEngine *vm): CScreenManager(vm), @@ -115,7 +111,7 @@ CVideoSurface *OSScreenManager::getSurface(int surfaceNum) const { if (surfaceNum == -1) return _frontRenderSurface; else if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) - return _backSurfaces[surfaceNum]; + return _backSurfaces[surfaceNum]._surface; else return nullptr; } @@ -164,7 +160,7 @@ void OSScreenManager::destroyFrontAndBackBuffers() { _frontRenderSurface = nullptr; for (uint idx = 0; idx < _backSurfaces.size(); ++idx) - delete _backSurfaces[idx]; + delete _backSurfaces[idx]._surface; _backSurfaces.clear(); } diff --git a/engines/titanic/screen_manager.h b/engines/titanic/screen_manager.h index 1be2de9a8c..a8b7ee4bd6 100644 --- a/engines/titanic/screen_manager.h +++ b/engines/titanic/screen_manager.h @@ -29,6 +29,7 @@ #include "titanic/font.h" #include "titanic/input_handler.h" #include "titanic/mouse_cursor.h" +#include "titanic/text_cursor.h" #include "titanic/video_surface.h" #include "titanic/core/resource_key.h" @@ -36,20 +37,11 @@ namespace Titanic { class TitanicEngine; -class CSurface { -}; - -class CScreenManagerRec { -public: - int _field0; - int _field4; - int _field8; - int _fieldC; -public: - CScreenManagerRec(); -}; - class CScreenManager { + struct VideoSurfaceEntry { + CVideoSurface *_surface; + Common::Rect _bounds; + }; protected: TitanicEngine *_vm; public: @@ -61,11 +53,10 @@ public: */ static CScreenManager *setCurrent(); public: - Common::Array _backSurfaces; + Common::Array _backSurfaces; CVideoSurface *_frontRenderSurface; - CScreenManagerRec _entries[2]; CMouseCursor *_mouseCursor; - void *_textCursor; + CTextCursor *_textCursor; CInputHandler *_inputHandler; int _fontNumber; public: @@ -118,6 +109,8 @@ public: virtual void proc25() = 0; virtual void showCursor() = 0; virtual void proc27() = 0; + + void setSurfaceBounds(int surfaceNum, const Common::Rect &r); }; class OSScreenManager: CScreenManager { diff --git a/engines/titanic/sound/sound.cpp b/engines/titanic/sound/sound.cpp index 54c14508cf..14dba2e152 100644 --- a/engines/titanic/sound/sound.cpp +++ b/engines/titanic/sound/sound.cpp @@ -43,8 +43,8 @@ void CSound::preLoad() { _gameManager->_musicRoom.preLoad(); } -void CSound::viewChanged(CViewItem *newView, bool isNewRoom) { - warning("CSound::viewChanged"); +void CSound::preEnterView(CViewItem *newView, bool isNewRoom) { + warning("CSound::preEnterView"); } } // End of namespace Titanic z diff --git a/engines/titanic/sound/sound.h b/engines/titanic/sound/sound.h index 0bfd3f29b1..4c0dab5dd5 100644 --- a/engines/titanic/sound/sound.h +++ b/engines/titanic/sound/sound.h @@ -71,7 +71,7 @@ public: /** * Called when the view has been changed */ - void viewChanged(CViewItem *newView, bool isNewRoom); + void preEnterView(CViewItem *newView, bool isNewRoom); }; } // End of namespace Titanic diff --git a/engines/titanic/text_cursor.cpp b/engines/titanic/text_cursor.cpp new file mode 100644 index 0000000000..e591dc38ed --- /dev/null +++ b/engines/titanic/text_cursor.cpp @@ -0,0 +1,37 @@ +/* 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/rect.h" +#include "common/textconsole.h" +#include "titanic/text_cursor.h" + +namespace Titanic { + +CTextCursor::CTextCursor() : _active(false) { +} + +Common::Rect CTextCursor::getBounds() { + warning("CTextCursor::getBounds"); + return Common::Rect(); +} + +} // End of namespace Titanic diff --git a/engines/titanic/text_cursor.h b/engines/titanic/text_cursor.h new file mode 100644 index 0000000000..1b03abdd6a --- /dev/null +++ b/engines/titanic/text_cursor.h @@ -0,0 +1,41 @@ +/* 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. + * + */ + +#ifndef TITANIC_TEXT_CURSOR_H +#define TITANIC_TEXT_CURSOR_H + +#include "common/scummsys.h" + +namespace Titanic { + +class CTextCursor { +public: + bool _active; +public: + CTextCursor(); + + Common::Rect getBounds(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TEXT_CURSOR_H */ diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 3d4a8ecc9d..d13356b42c 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -183,4 +183,12 @@ void CTrueTalkManager::viewChange() { warning("CTrueTalkManager::viewChange"); } +void CTrueTalkManager::update1() { + warning("CTrueTalkManager::update1"); +} + +void CTrueTalkManager::update2() { + warning("CTrueTalkManager::update2"); +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index 4c74ac2bc5..6724baaa34 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -106,6 +106,10 @@ public: * Returns the scripts for the manager */ TTScripts &getScripts() { return _scripts; } + + void update1(); + + void update2(); }; } // End of namespace Titanic -- cgit v1.2.3 From 8b5ad45f4a2881d5f72b03855c2d8c1c0f63d70d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 19 Mar 2016 23:02:41 -0400 Subject: TITANIC: Minor fixes executing game manager update --- engines/titanic/core/view_item.cpp | 2 +- engines/titanic/game_manager.cpp | 2 +- engines/titanic/game_manager.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index a80f25bcc1..c48166698d 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -31,7 +31,7 @@ namespace Titanic { CViewItem::CViewItem() : CNamedItem() { - Common::fill(&_buttonUpTargets[0], &_buttonUpTargets[3], nullptr); + Common::fill(&_buttonUpTargets[0], &_buttonUpTargets[4], nullptr); _field24 = 0; _field28 = 0.0; _viewNumber = 0; diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index 1c480e5d4d..675323198e 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -175,7 +175,7 @@ void CGameManager::update() { // And the text cursor CScreenManager *screenManager = CScreenManager::_screenManagerPtr; CTextCursor *textCursor = screenManager->_textCursor; - if (textCursor->_active) + if (textCursor && textCursor->_active) _bounds.extend(textCursor->getBounds()); // Set the surface bounds diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index f63b571ded..f18696bf5c 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -178,7 +178,7 @@ public: void playClip(CMovieClip *clip, CRoomItem *oldRoom, CRoomItem *newRoom); /** - * Updates the state of the manager + * Main frame update method for the game */ void update(); -- cgit v1.2.3 From ea54e6244e75c609e6886ba210f80fb22c479d3f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 20 Mar 2016 00:01:40 -0400 Subject: TITANIC: Fixes/renames for files manager --- engines/titanic/files_manager.cpp | 14 +++++++++++--- engines/titanic/files_manager.h | 12 ++++++++++-- engines/titanic/game_manager.cpp | 3 ++- engines/titanic/game_view.cpp | 4 ++-- engines/titanic/game_view.h | 7 +++++-- engines/titanic/input_handler.cpp | 2 +- engines/titanic/main_game_window.cpp | 7 ++++--- engines/titanic/main_game_window.h | 5 ++++- engines/titanic/screen_manager.cpp | 25 +++++++++++++++++++++---- engines/titanic/screen_manager.h | 4 ++-- 10 files changed, 62 insertions(+), 21 deletions(-) diff --git a/engines/titanic/files_manager.cpp b/engines/titanic/files_manager.cpp index 47da8e53ba..7ff0b51af8 100644 --- a/engines/titanic/files_manager.cpp +++ b/engines/titanic/files_manager.cpp @@ -27,7 +27,7 @@ namespace Titanic { CFilesManager::CFilesManager() : _gameManager(nullptr), - _assetsPath("Assets"), _field0(0), _field14(0), + _assetsPath("Assets"), _field0(0), _drive(-1), _field18(0), _field1C(0), _field3C(0) { } @@ -65,12 +65,20 @@ bool CFilesManager::scanForFile(const CString &name) { return fileExists(fname); } -void CFilesManager::fn1() { - warning("TODO: CFilesManager::fn1"); +void CFilesManager::loadDrive() { + assert(_drive == -1); + resetView(); } void CFilesManager::debug(CScreenManager *screenManager) { warning("TODO: CFilesManager::debug"); } +void CFilesManager::resetView() { + if (_gameManager) { + _gameManager->_gameState.setMode(GSMODE_1); + _gameManager->initBounds(); + } +} + } // End of namespace Titanic diff --git a/engines/titanic/files_manager.h b/engines/titanic/files_manager.h index a767056bdf..ab92151055 100644 --- a/engines/titanic/files_manager.h +++ b/engines/titanic/files_manager.h @@ -40,7 +40,7 @@ private: CString _string1; CString _string2; int _field0; - int _field14; + int _drive; int _field18; int _field1C; int _field3C; @@ -65,9 +65,17 @@ public: */ bool scanForFile(const CString &name); - void fn1(); + /** + * Handles displaying a load drive view if necessary + */ + void loadDrive(); void debug(CScreenManager *screenManager); + + /** + * Resets the view being displayed + */ + void resetView(); }; } // End of namespace Titanic diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index 675323198e..49a881d8e2 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -181,8 +181,9 @@ void CGameManager::update() { // Set the surface bounds screenManager->setSurfaceBounds(0, _bounds); + // Handle redrawing the view if (!_bounds.isEmpty()) { - _gameView->proc4(_bounds); + _gameView->draw(_bounds); _bounds = Common::Rect(); } diff --git a/engines/titanic/game_view.cpp b/engines/titanic/game_view.cpp index 86ad072f61..d04c3e1cfc 100644 --- a/engines/titanic/game_view.cpp +++ b/engines/titanic/game_view.cpp @@ -67,8 +67,8 @@ void CSTGameView::setView(CViewItem *view) { _gameWindow->setActiveView(view); } -void CSTGameView::proc4(const Common::Rect &bounds) { - _gameWindow->fn2(); +void CSTGameView::draw(const Common::Rect &bounds) { + _gameWindow->draw(); } } // End of namespace Titanic diff --git a/engines/titanic/game_view.h b/engines/titanic/game_view.h index be4d934a33..a3e1fe7720 100644 --- a/engines/titanic/game_view.h +++ b/engines/titanic/game_view.h @@ -57,7 +57,7 @@ public: */ virtual void setView(CViewItem *item) = 0; - virtual void proc4(const Common::Rect &bounds) = 0; + virtual void draw(const Common::Rect &bounds) = 0; /** * Creates a surface from a specified resource @@ -76,7 +76,10 @@ public: */ virtual void setView(CViewItem *item); - virtual void proc4(const Common::Rect &bounds); + /** + * Handles drawing the view + */ + virtual void draw(const Common::Rect &bounds); }; } // End of namespace Titanic diff --git a/engines/titanic/input_handler.cpp b/engines/titanic/input_handler.cpp index 5d50c00377..c710374d05 100644 --- a/engines/titanic/input_handler.cpp +++ b/engines/titanic/input_handler.cpp @@ -53,7 +53,7 @@ void CInputHandler::handleMessage(const CMessage &msg, bool respectLock) { if (_gameManager->_gameState._mode == GSMODE_1) { processMessage(&msg); } else if (!msg.isMouseMsg()) { - g_vm->_filesManager.fn1(); + g_vm->_filesManager.loadDrive(); } } } diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 2c148c8c2e..6a6a46ea65 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -55,7 +55,6 @@ void CMainGameWindow::applicationStarting() { // Set the video mode CScreenManager *screenManager = CScreenManager::setCurrent(); screenManager->setMode(640, 480, 16, 1, true); - _inputAllowed = true; // TODO: Remove initial background and palette @@ -67,6 +66,8 @@ void CMainGameWindow::applicationStarting() { // Load either a new game or selected existing save _project->loadGame(saveSlot); + _inputAllowed = true; + _gameManager->_gameState.setMode(GSMODE_1); // TODO: Cursor/image @@ -109,7 +110,7 @@ void CMainGameWindow::setActiveView(CViewItem *viewItem) { } } -void CMainGameWindow::fn2() { +void CMainGameWindow::draw() { if (_gameManager) { if (_gameView->_surface) { CViewItem *view = _gameManager->getView(); @@ -128,7 +129,7 @@ void CMainGameWindow::fn2() { warning("TODO: Stuff"); case GSMODE_5: - g_vm->_filesManager.fn1(); + g_vm->_filesManager.debug(scrManager); break; default: diff --git a/engines/titanic/main_game_window.h b/engines/titanic/main_game_window.h index 6a72dbf45e..8f6fb81228 100644 --- a/engines/titanic/main_game_window.h +++ b/engines/titanic/main_game_window.h @@ -74,7 +74,10 @@ public: */ void setActiveView(CViewItem *viewItem); - void fn2(); + /** + * Main draw method for the window + */ + void draw(); /** * Called by the event handler when a mouse event has been generated diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp index 59a322e919..fe15d9aec0 100644 --- a/engines/titanic/screen_manager.cpp +++ b/engines/titanic/screen_manager.cpp @@ -51,7 +51,7 @@ void CScreenManager::setWindowHandle(int v) { } bool CScreenManager::resetWindowHandle(int v) { - proc27(); + hideCursor(); return true; } @@ -79,6 +79,8 @@ OSScreenManager::OSScreenManager(TitanicEngine *vm): CScreenManager(vm), OSScreenManager::~OSScreenManager() { destroyFrontAndBackBuffers(); + delete _mouseCursor; + delete _textCursor; } void OSScreenManager::setMode(int width, int height, int bpp, uint numBackSurfaces, bool flag2) { @@ -152,8 +154,14 @@ CVideoSurface *OSScreenManager::createSurface(const CResourceKey &key) { void OSScreenManager::proc23() {} void OSScreenManager::proc24() {} void OSScreenManager::proc25() {} -void OSScreenManager::showCursor() {} -void OSScreenManager::proc27() {} + +void OSScreenManager::showCursor() { + +} + +void OSScreenManager::hideCursor() { + +} void OSScreenManager::destroyFrontAndBackBuffers() { delete _frontRenderSurface; @@ -165,7 +173,16 @@ void OSScreenManager::destroyFrontAndBackBuffers() { } void OSScreenManager::loadCursors() { - // TODO + if (_mouseCursor) { + hideCursor(); + delete _mouseCursor; + } + _mouseCursor = new CMouseCursor(); + showCursor(); + + if (!_textCursor) { + _textCursor = new CTextCursor(); + } } } // End of namespace Titanic diff --git a/engines/titanic/screen_manager.h b/engines/titanic/screen_manager.h index a8b7ee4bd6..a5fa562bc8 100644 --- a/engines/titanic/screen_manager.h +++ b/engines/titanic/screen_manager.h @@ -108,7 +108,7 @@ public: virtual void proc24() = 0; virtual void proc25() = 0; virtual void showCursor() = 0; - virtual void proc27() = 0; + virtual void hideCursor() = 0; void setSurfaceBounds(int surfaceNum, const Common::Rect &r); }; @@ -177,7 +177,7 @@ public: virtual void proc24(); virtual void proc25(); virtual void showCursor(); - virtual void proc27(); + virtual void hideCursor(); }; } // End of namespace Titanic -- cgit v1.2.3 From 6ebb0312ffa87316e816c4ebc31e17564450d48e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 20 Mar 2016 17:07:23 -0400 Subject: TITANIC: Refactor out DirectDrawSurface to it's own class --- engines/titanic/direct_draw.cpp | 37 +------- engines/titanic/direct_draw.h | 35 +------ engines/titanic/direct_draw_surface.cpp | 87 +++++++++++++++++ engines/titanic/direct_draw_surface.h | 110 ++++++++++++++++++++++ engines/titanic/module.mk | 1 + engines/titanic/pet_control/pet_control_sub12.cpp | 1 + engines/titanic/video_surface.cpp | 6 +- engines/titanic/video_surface.h | 2 +- 8 files changed, 207 insertions(+), 72 deletions(-) create mode 100644 engines/titanic/direct_draw_surface.cpp create mode 100644 engines/titanic/direct_draw_surface.h diff --git a/engines/titanic/direct_draw.cpp b/engines/titanic/direct_draw.cpp index 551be5b87e..79ca968f8d 100644 --- a/engines/titanic/direct_draw.cpp +++ b/engines/titanic/direct_draw.cpp @@ -48,9 +48,7 @@ void DirectDraw::diagnostics() { DirectDrawSurface *DirectDraw::createSurfaceFromDesc(const DDSurfaceDesc &desc) { DirectDrawSurface *surface = new DirectDrawSurface(); - - Graphics::PixelFormat pixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); - surface->create(desc._w, desc._h, pixelFormat); + surface->create(desc._w, desc._h); return surface; } @@ -95,11 +93,9 @@ void DirectDrawManager::initFullScreen() { _directDraw._bpp, 0); _mainSurface = new DirectDrawSurface(); - _mainSurface->create(_directDraw._width, _directDraw._height, - Graphics::PixelFormat::createFormatCLUT8()); + _mainSurface->create(_directDraw._width, _directDraw._height); _backSurfaces[0] = new DirectDrawSurface(); - _backSurfaces[0]->create(_directDraw._width, _directDraw._height, - Graphics::PixelFormat::createFormatCLUT8()); + _backSurfaces[0]->create(_directDraw._width, _directDraw._height); } DirectDrawSurface *DirectDrawManager::createSurface(int w, int h, int surfaceNum) { @@ -110,31 +106,4 @@ DirectDrawSurface *DirectDrawManager::createSurface(int w, int h, int surfaceNum return _directDraw.createSurfaceFromDesc(DDSurfaceDesc(w, h)); } -/*------------------------------------------------------------------------*/ - -Graphics::Surface *DirectDrawSurface::lock(const Common::Rect *bounds, int flags) { - assert(w != 0 && h != 0); - return this; -} - -void DirectDrawSurface::unlock() { - assert(w != 0 && h != 0); -} - -void DirectDrawSurface::fill(const Common::Rect *bounds, uint32 color) { - Common::Rect tempBounds; - - if (bounds) { - // Bounds are provided, clip them to the bounds of this surface - tempBounds = *bounds; - tempBounds.clip(Common::Rect(0, 0, this->w, this->h)); - } else { - // No bounds provided, so use the entire surface - tempBounds = Common::Rect(0, 0, this->w, this->h); - } - - // Fill the area - fillRect(tempBounds, color); -} - } // End of namespace Titanic diff --git a/engines/titanic/direct_draw.h b/engines/titanic/direct_draw.h index 5ec0f3d5c7..cf21c98095 100644 --- a/engines/titanic/direct_draw.h +++ b/engines/titanic/direct_draw.h @@ -25,45 +25,12 @@ #include "common/scummsys.h" #include "common/array.h" -#include "graphics/surface.h" +#include "titanic/direct_draw_surface.h" namespace Titanic { class TitanicEngine; -struct DDSurfaceDesc { - int _w; - int _h; - int _flags; - int _caps; - - DDSurfaceDesc(int w, int h) : _w(w), _h(h), _flags(0x1006), _caps(64) {} -}; - -class DirectDrawSurface : public Graphics::Surface { -public: - /** - * Return the size of the surface in ytes - */ - int getSize() const { return pitch * h; } - - /** - * Lock the surface for access - */ - Graphics::Surface *lock(const Common::Rect *bounds, int flags); - - /** - * Unlocks the surface at the end of direct accesses - */ - void unlock(); - - /** - * Fills an area of the surfae with the specified color. If no bounds are passed, - * then the entire surface is filled - */ - void fill(const Common::Rect *bounds, uint32 color); -}; - class DirectDraw { private: TitanicEngine *_vm; diff --git a/engines/titanic/direct_draw_surface.cpp b/engines/titanic/direct_draw_surface.cpp new file mode 100644 index 0000000000..6ce6f2411a --- /dev/null +++ b/engines/titanic/direct_draw_surface.cpp @@ -0,0 +1,87 @@ +/* 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/rect.h" +#include "titanic/direct_draw_surface.h" + +namespace Titanic { + +DirectDrawSurface::DirectDrawSurface() : _surface(nullptr), + _disposeAfterUse(DisposeAfterUse::YES) { +} + +DirectDrawSurface::~DirectDrawSurface() { + free(); +} + +void DirectDrawSurface::create(Graphics::ManagedSurface *surface) { + free(); + _surface = surface; + _disposeAfterUse = DisposeAfterUse::NO; +} + +void DirectDrawSurface::create(int w, int h) { + Graphics::PixelFormat pixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); + _surface = new Graphics::ManagedSurface(w, h, pixelFormat); + _disposeAfterUse = DisposeAfterUse::YES; +} + +void DirectDrawSurface::free() { + if (_disposeAfterUse == DisposeAfterUse::YES) + delete _surface; + _surface = nullptr; + _disposeAfterUse = DisposeAfterUse::NO; +} + +Graphics::ManagedSurface *DirectDrawSurface::lock(const Common::Rect *bounds, int flags) { + assert(!_surface->empty()); + return _surface; +} + +void DirectDrawSurface::unlock() { + assert(_surface->w != 0 && _surface->h != 0); +} + +void DirectDrawSurface::fill(const Common::Rect *bounds, uint32 color) { + Common::Rect tempBounds; + + if (bounds) { + // Bounds are provided, clip them to the bounds of this surface + tempBounds = *bounds; + tempBounds.clip(Common::Rect(0, 0, _surface->w, _surface->h)); + } else { + // No bounds provided, so use the entire surface + tempBounds = Common::Rect(0, 0, _surface->w, _surface->h); + } + + // Fill the area + _surface->fillRect(tempBounds, color); +} + +void DirectDrawSurface::blitFast(const Common::Point &destPos, DirectDrawSurface *srcSurface, Common::Rect *bounds) { + if (bounds) + _surface->blitFrom(*srcSurface->_surface, *bounds, destPos); + else + _surface->blitFrom(*srcSurface->_surface, destPos); +} + +} // End of namespace Titanic diff --git a/engines/titanic/direct_draw_surface.h b/engines/titanic/direct_draw_surface.h new file mode 100644 index 0000000000..14988583f0 --- /dev/null +++ b/engines/titanic/direct_draw_surface.h @@ -0,0 +1,110 @@ +/* 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. + * + */ + +#ifndef TITANIC_DIRECT_DRAW_SURFACE_H +#define TITANIC_DIRECT_DRAW_SURFACE_H + +#include "common/scummsys.h" +#include "common/array.h" +#include "graphics/managed_surface.h" + +namespace Titanic { + +class TitanicEngine; + +struct DDSurfaceDesc { + int _w; + int _h; + int _flags; + int _caps; + + DDSurfaceDesc(int w, int h) : _w(w), _h(h), _flags(0x1006), _caps(64) {} +}; + +class DirectDrawSurface { +private: + Graphics::ManagedSurface *_surface; + DisposeAfterUse::Flag _disposeAfterUse; +public: + DirectDrawSurface(); + ~DirectDrawSurface(); + + /** + * Create a surface + */ + void create(int w, int h); + + /** + * Create a surface based on a passed surface + */ + void create(Graphics::ManagedSurface *surface); + + /** + * Frees the surface + */ + void free(); + + /** + * Return the size of the surface in ytes + */ + int getSize() const { return _surface->pitch * _surface->h; } + + /** + * Return the surface width + */ + int getWidth() const { return _surface->w; } + + /** + * Return the surface width + */ + int getHeight() const { return _surface->h; } + + /** + * Return the surface pitch + */ + int getPitch() const { return _surface->pitch; } + + /** + * Lock the surface for access + */ + Graphics::ManagedSurface *lock(const Common::Rect *bounds, int flags); + + /** + * Unlocks the surface at the end of direct accesses + */ + void unlock(); + + /** + * Fills an area of the surfae with the specified color. If no bounds are passed, + * then the entire surface is filled + */ + void fill(const Common::Rect *bounds, uint32 color); + + /** + * Copy data from a source surfcae into this one + */ + void blitFast(const Common::Point &destPos, DirectDrawSurface *srcSurface, Common::Rect *bounds); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DIRECT_DRAW_SURFACE_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index f62ef96d0b..285a1c8157 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -4,6 +4,7 @@ MODULE_OBJS := \ debugger.o \ detection.o \ direct_draw.o \ + direct_draw_surface.o \ events.o \ files_manager.o \ font.o \ diff --git a/engines/titanic/pet_control/pet_control_sub12.cpp b/engines/titanic/pet_control/pet_control_sub12.cpp index 616d6920ae..5daf826ae6 100644 --- a/engines/titanic/pet_control/pet_control_sub12.cpp +++ b/engines/titanic/pet_control/pet_control_sub12.cpp @@ -67,6 +67,7 @@ void CPetControlSub12::load(SimpleFile *file, int param) { _field70 = file->readNumber(); _field74 = file->readNumber(); + warning("TODO: CPetControlSub12::load %d,%d", var1, var2); assert(_array.size() >= count); for (uint idx = 0; idx < count; ++idx) { _array[idx]._string1 = file->readString(); diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp index 08ba64ac75..503fd6bfc7 100644 --- a/engines/titanic/video_surface.cpp +++ b/engines/titanic/video_surface.cpp @@ -123,17 +123,17 @@ bool OSVideoSurface::hasSurface() { int OSVideoSurface::getWidth() const { assert(_ddSurface); - return _ddSurface->w; + return _ddSurface->getWidth(); } int OSVideoSurface::getHeight() const { assert(_ddSurface); - return _ddSurface->h; + return _ddSurface->getHeight(); } int OSVideoSurface::getPitch() const { assert(_ddSurface); - return _ddSurface->pitch; + return _ddSurface->getPitch(); } void OSVideoSurface::resize(int width, int height) { diff --git a/engines/titanic/video_surface.h b/engines/titanic/video_surface.h index 47caffdcaf..7efd8b5c37 100644 --- a/engines/titanic/video_surface.h +++ b/engines/titanic/video_surface.h @@ -45,7 +45,7 @@ protected: CScreenManager *_screenManager; CResourceKey _resourceKey; DirectDrawSurface *_ddSurface; - Graphics::Surface *_rawSurface; + Graphics::ManagedSurface *_rawSurface; void *_field34; bool _pendingLoad; int _field40; -- cgit v1.2.3 From fbc46ed5b41633c1a8dc6e54591fe4dd028dbc04 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 20 Mar 2016 17:29:58 -0400 Subject: TITANIC: Starting on frame rendering --- engines/titanic/game_view.cpp | 11 +++++++++++ engines/titanic/game_view.h | 2 ++ engines/titanic/main_game_window.cpp | 26 ++++++++++++++++++++++++-- engines/titanic/main_game_window.h | 9 +++++++++ engines/titanic/pet_control/pet_control.cpp | 4 ++++ engines/titanic/pet_control/pet_control.h | 2 ++ engines/titanic/screen_manager.cpp | 5 ++++- engines/titanic/screen_manager.h | 23 ++++++++++++++++++++--- 8 files changed, 76 insertions(+), 6 deletions(-) diff --git a/engines/titanic/game_view.cpp b/engines/titanic/game_view.cpp index d04c3e1cfc..88ad095f7b 100644 --- a/engines/titanic/game_view.cpp +++ b/engines/titanic/game_view.cpp @@ -57,6 +57,17 @@ void CGameView::createSurface(const CResourceKey &key) { _surface->_field3C = true; } +void CGameView::draw1() { + CScreenManager::setCurrent(); + Common::Rect rect1 = _gameManager->_bounds; + Common::Rect rect2(0, 0, 600, 340); + rect2.translate(20, 10); + + + + warning("TODO: CGameView_Draw1"); +} + /*------------------------------------------------------------------------*/ CSTGameView::CSTGameView(CMainGameWindow *gameWindow) : diff --git a/engines/titanic/game_view.h b/engines/titanic/game_view.h index a3e1fe7720..14412032dc 100644 --- a/engines/titanic/game_view.h +++ b/engines/titanic/game_view.h @@ -63,6 +63,8 @@ public: * Creates a surface from a specified resource */ void createSurface(const CResourceKey &key); + + void draw1(); }; class CSTGameView: public CGameView { diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 6a6a46ea65..c282787ade 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -25,6 +25,7 @@ #include "titanic/game_manager.h" #include "titanic/game_view.h" #include "titanic/messages/messages.h" +#include "titanic/pet_control/pet_control.h" namespace Titanic { @@ -125,8 +126,12 @@ void CMainGameWindow::draw() { case GSMODE_1: case GSMODE_2: if (_gameManager->_gameState._field18) - warning("TODO: Field18_fn1(this)"); - warning("TODO: Stuff"); + drawPet(scrManager); + + draw1(); + draw2(scrManager); + scrManager->drawCursors(); + break; case GSMODE_5: g_vm->_filesManager.debug(scrManager); @@ -138,6 +143,23 @@ void CMainGameWindow::draw() { } } +void CMainGameWindow::drawPet(CScreenManager *screenManager) { + if (_gameView && _gameView->_surface) { + CPetControl *petControl = _gameManager->_project->getPetControl(); + if (petControl) + petControl->proc26(); + } +} + +void CMainGameWindow::draw1() { + if (_gameView->_surface) + _gameView->draw1(); +} + +void CMainGameWindow::draw2(CScreenManager *screenManager) { + +} + void CMainGameWindow::mouseChanged() { if (_gameManager->_gameState._mode != GSMODE_5) _gameManager->update(); diff --git a/engines/titanic/main_game_window.h b/engines/titanic/main_game_window.h index 8f6fb81228..549637b5dd 100644 --- a/engines/titanic/main_game_window.h +++ b/engines/titanic/main_game_window.h @@ -49,6 +49,15 @@ private: * to use */ int selectSavegame(); + + /** + * Used for drawing the PET fullscreen? maybe + */ + void drawPet(CScreenManager *screenManager); + + void draw1(); + + void draw2(CScreenManager *screenManager); public: CGameView *_gameView; CGameManager *_gameManager; diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index f5498887e3..5886ce4169 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -80,6 +80,10 @@ void CPetControl::saveSubObjects(SimpleFile *file, int indent) const { _sub8.save(file, indent); } +void CPetControl::proc26() { + warning("TODO: CPetControl::proc26"); +} + void CPetControl::postLoad() { warning("TODO: CPetControl::postLoad"); } diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index f1e4bb2a10..df529aed6a 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -78,6 +78,8 @@ public: */ virtual void load(SimpleFile *file); + virtual void proc26(); + /** * Called after loading a game has finished */ diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp index fe15d9aec0..f87ad66b9a 100644 --- a/engines/titanic/screen_manager.cpp +++ b/engines/titanic/screen_manager.cpp @@ -105,7 +105,10 @@ void OSScreenManager::setMode(int width, int height, int bpp, uint numBackSurfac loadCursors(); } -void OSScreenManager::proc5() {} +void OSScreenManager::drawCursors() { + warning("OSScreenManager::drawCursors"); +} + void OSScreenManager::proc6() {} void OSScreenManager::proc7() {} diff --git a/engines/titanic/screen_manager.h b/engines/titanic/screen_manager.h index a5fa562bc8..8fe51c57b0 100644 --- a/engines/titanic/screen_manager.h +++ b/engines/titanic/screen_manager.h @@ -68,8 +68,17 @@ public: virtual void setWindowHandle(int v); virtual bool resetWindowHandle(int v); + + /** + * Sets the video mode + */ virtual void setMode(int width, int height, int bpp, uint numBackSurfaces, bool flag2) = 0; - virtual void proc5() = 0; + + /** + * Handles drawing the cursors + */ + virtual void drawCursors() = 0; + virtual void proc6() = 0; virtual void proc7() = 0; virtual CVideoSurface *getSurface(int surfaceNum) const = 0; @@ -136,8 +145,16 @@ public: OSScreenManager(TitanicEngine *vm); virtual ~OSScreenManager(); - virtual void setMode(int width, int height, int bpp, uint numBackSurfaces, bool flag2); - virtual void proc5(); + /** + * Sets the video mode + */ + virtual void setMode(int width, int height, int bpp, uint numBackSurfaces, bool flag2) = 0; + + /** + * Handles drawing the cursors + */ + virtual void drawCursors(); + virtual void proc6(); virtual void proc7(); virtual CVideoSurface *getSurface(int surfaceNum) const; -- cgit v1.2.3 From 9a66bc2e9e3638af940053ac58df36b489b3e345 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 20 Mar 2016 20:47:25 -0400 Subject: TITANIC: More graphics code, clipBounds method --- engines/titanic/direct_draw_surface.cpp | 8 +++- engines/titanic/direct_draw_surface.h | 7 +++- engines/titanic/game_view.cpp | 2 +- engines/titanic/screen_manager.h | 2 +- engines/titanic/video_surface.cpp | 72 ++++++++++++++++++++++++++++++++- engines/titanic/video_surface.h | 13 +++++- graphics/managed_surface.cpp | 2 +- 7 files changed, 98 insertions(+), 8 deletions(-) diff --git a/engines/titanic/direct_draw_surface.cpp b/engines/titanic/direct_draw_surface.cpp index 6ce6f2411a..cf7639cf1b 100644 --- a/engines/titanic/direct_draw_surface.cpp +++ b/engines/titanic/direct_draw_surface.cpp @@ -77,7 +77,13 @@ void DirectDrawSurface::fill(const Common::Rect *bounds, uint32 color) { _surface->fillRect(tempBounds, color); } -void DirectDrawSurface::blitFast(const Common::Point &destPos, DirectDrawSurface *srcSurface, Common::Rect *bounds) { +void DirectDrawSurface::blit(const Common::Rect &destRect, DirectDrawSurface *srcSurface, Common::Rect &srcRect) { + assert(srcSurface); + if (!destRect.isEmpty()) + _surface->transBlitFrom(*srcSurface->_surface, srcRect, destRect, (uint)-1); +} + +void DirectDrawSurface::blit(const Common::Point &destPos, DirectDrawSurface *srcSurface, Common::Rect *bounds) { if (bounds) _surface->blitFrom(*srcSurface->_surface, *bounds, destPos); else diff --git a/engines/titanic/direct_draw_surface.h b/engines/titanic/direct_draw_surface.h index 14988583f0..9a93316f7d 100644 --- a/engines/titanic/direct_draw_surface.h +++ b/engines/titanic/direct_draw_surface.h @@ -102,7 +102,12 @@ public: /** * Copy data from a source surfcae into this one */ - void blitFast(const Common::Point &destPos, DirectDrawSurface *srcSurface, Common::Rect *bounds); + void blit(const Common::Rect &destRect, DirectDrawSurface *srcSurface, Common::Rect &srcRect); + + /** + * Copy data from a source surfcae into this one + */ + void blit(const Common::Point &destPos, DirectDrawSurface *srcSurface, Common::Rect *bounds); }; } // End of namespace Titanic diff --git a/engines/titanic/game_view.cpp b/engines/titanic/game_view.cpp index 88ad095f7b..ecdeb85f9a 100644 --- a/engines/titanic/game_view.cpp +++ b/engines/titanic/game_view.cpp @@ -54,7 +54,7 @@ void CGameView::createSurface(const CResourceKey &key) { // Create a fresh surface CScreenManager::setCurrent(); _surface = CScreenManager::_currentScreenManagerPtr->createSurface(key); - _surface->_field3C = true; + _surface->_blitFlag = true; } void CGameView::draw1() { diff --git a/engines/titanic/screen_manager.h b/engines/titanic/screen_manager.h index 8fe51c57b0..ae3424d9fa 100644 --- a/engines/titanic/screen_manager.h +++ b/engines/titanic/screen_manager.h @@ -148,7 +148,7 @@ public: /** * Sets the video mode */ - virtual void setMode(int width, int height, int bpp, uint numBackSurfaces, bool flag2) = 0; + virtual void setMode(int width, int height, int bpp, uint numBackSurfaces, bool flag2); /** * Handles drawing the cursors diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp index 503fd6bfc7..b38a8624ea 100644 --- a/engines/titanic/video_surface.cpp +++ b/engines/titanic/video_surface.cpp @@ -30,8 +30,8 @@ int CVideoSurface::_videoSurfaceCounter = 0; CVideoSurface::CVideoSurface(CScreenManager *screenManager) : _screenManager(screenManager), _rawSurface(nullptr), - _field34(nullptr), _pendingLoad(false), _field3C(false), _field40(0), - _field44(4), _field48(0), _field50(1) { + _field34(nullptr), _pendingLoad(false), _blitFlag(false), + _field40(0), _field44(4), _field48(0), _field50(1) { _videoSurfaceNum = _videoSurfaceCounter++; } @@ -46,6 +46,74 @@ void CVideoSurface::setSurface(CScreenManager *screenManager, DirectDrawSurface _ddSurface = surface; } +void CVideoSurface::blitFrom(const Common::Rect &srcRect, const Common::Rect &destRect, CVideoSurface *srcSurface) { + // TODO: Cases when _blitFlag is false + assert(_blitFlag); + error("TODO"); +} + +void CVideoSurface::clipBounds(Common::Rect &srcRect, Common::Rect &destRect, + CVideoSurface *srcSurface, Common::Rect *subRect, Common::Point *pt) { + if (pt) { + srcRect.left = pt->x; + srcRect.top = pt->y; + } else { + srcRect.left = srcRect.top = 0; + } + + if (subRect) { + destRect.right = destRect.left + subRect->width(); + destRect.bottom = destRect.top + subRect->height(); + srcRect = *subRect; + } else { + srcRect.right = srcRect.left + srcSurface->getWidth(); + srcRect.bottom = srcRect.top + srcSurface->getHeight(); + srcRect = Common::Rect(0, 0, srcSurface->getWidth(), srcSurface->getHeight()); + } + + // Clip destination rect to be on-screen + if (destRect.left < 0) { + srcRect.left -= destRect.left; + destRect.left = 0; + } + if (destRect.top < 0) { + srcRect.top -= destRect.top; + destRect.top = 0; + } + if (destRect.right > getWidth()) { + srcRect.right += getWidth() - destRect.right; + destRect.right = getWidth(); + } + if (destRect.bottom > getHeight()) { + srcRect.bottom += getHeight() - destRect.bottom; + destRect.bottom = getHeight(); + } + + // Clip source rect to be within the source surface + if (srcRect.left < 0) { + destRect.left -= srcRect.left; + srcRect.left = 0; + } + if (srcRect.top < 0) { + destRect.top -= srcRect.top; + srcRect.top = 0; + } + if (srcRect.right > srcSurface->getWidth()) { + destRect.right += srcSurface->getWidth() - srcRect.right; + srcRect.right = srcSurface->getWidth(); + } + if (srcRect.bottom > srcSurface->getHeight()) { + destRect.bottom += srcSurface->getHeight() - srcRect.bottom; + srcRect.bottom = srcSurface->getHeight(); + } + + // Validate that the resulting rects are valid + if (destRect.left >= destRect.right || destRect.top >= destRect.bottom + || srcRect.left >= srcRect.right || srcRect.top >= srcRect.bottom) + error("Invalid rect"); +} + + /*------------------------------------------------------------------------*/ OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, DirectDrawSurface *surface) : diff --git a/engines/titanic/video_surface.h b/engines/titanic/video_surface.h index 7efd8b5c37..88ab2e4d45 100644 --- a/engines/titanic/video_surface.h +++ b/engines/titanic/video_surface.h @@ -39,6 +39,12 @@ class CTargaDecode; class CVideoSurface : public ListItem { friend class CJPEGDecode; friend class CTargaDecode; +private: + /** + * Calculates blitting bounds + */ + void clipBounds(Common::Rect &destRect, Common::Rect &srcRect, + CVideoSurface *srcSurface, Common::Rect *bounds2, Common::Point *pt); protected: static int _videoSurfaceCounter; protected: @@ -55,7 +61,7 @@ protected: int _field50; int _lockCount; public: - bool _field3C; + bool _blitFlag; public: CVideoSurface(CScreenManager *screenManager); virtual ~CVideoSurface(); @@ -141,6 +147,11 @@ public: * Frees the underlying surface */ virtual int freeSurface() { return 0; } + + /** + * Blit from another surface + */ + void blitFrom(const Common::Rect &srcRect, const Common::Rect &destRect, CVideoSurface *srcSurface); }; class OSVideoSurface : public CVideoSurface { diff --git a/graphics/managed_surface.cpp b/graphics/managed_surface.cpp index e493ab9f4e..f3d8813f2e 100644 --- a/graphics/managed_surface.cpp +++ b/graphics/managed_surface.cpp @@ -48,7 +48,7 @@ ManagedSurface::ManagedSurface(int width, int height) : ManagedSurface::ManagedSurface(int width, int height, const Graphics::PixelFormat &pixelFormat) : w(_innerSurface.w), h(_innerSurface.h), pitch(_innerSurface.pitch), format(_innerSurface.format), _disposeAfterUse(DisposeAfterUse::NO), _owner(nullptr) { - create(width, height, format); + create(width, height, pixelFormat); } ManagedSurface::ManagedSurface(ManagedSurface &surf, const Common::Rect &bounds) : -- cgit v1.2.3 From 217360d0c5a0b8289c16b22fc46782c475fcc9f5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 21 Mar 2016 20:53:49 -0400 Subject: TITANIC: Add new derived Rect and Point classes --- engines/titanic/carry/brain.h | 2 +- engines/titanic/carry/bridge_piece.h | 2 +- engines/titanic/carry/carry.h | 4 +-- engines/titanic/core/drop_target.h | 2 +- engines/titanic/core/game_object.cpp | 4 +-- engines/titanic/core/game_object.h | 6 ++-- engines/titanic/core/link_item.h | 2 +- engines/titanic/core/room_item.h | 4 +-- engines/titanic/core/tree_item.h | 2 +- engines/titanic/direct_draw_surface.cpp | 14 ++++---- engines/titanic/direct_draw_surface.h | 9 +++--- engines/titanic/events.cpp | 2 +- engines/titanic/game/cdrom.h | 2 +- engines/titanic/game/end_game_credits.h | 2 +- engines/titanic/game/placeholder/lemon_on_bar.h | 2 +- engines/titanic/game/placeholder/tv_on_bar.h | 2 +- engines/titanic/game/sauce_dispensor.h | 4 +-- engines/titanic/game/ship_setting.h | 2 +- engines/titanic/game/transport/lift_indicator.h | 2 +- engines/titanic/game_manager.cpp | 6 ++-- engines/titanic/game_manager.h | 2 +- engines/titanic/game_state.cpp | 8 ++--- engines/titanic/game_state.h | 6 ++-- engines/titanic/game_view.cpp | 8 ++--- engines/titanic/game_view.h | 9 ++++-- engines/titanic/gfx/move_object_button.h | 2 +- engines/titanic/gfx/slider_button.h | 2 +- engines/titanic/gfx/toggle_switch.h | 2 +- engines/titanic/input_handler.cpp | 4 +-- engines/titanic/input_handler.h | 8 ++--- engines/titanic/input_translator.cpp | 20 ++++++------ engines/titanic/input_translator.h | 20 ++++++------ engines/titanic/main_game_window.cpp | 12 +++---- engines/titanic/main_game_window.h | 10 ++++-- engines/titanic/messages/mouse_messages.h | 24 +++++++------- engines/titanic/module.mk | 2 ++ engines/titanic/movie.cpp | 28 ++++++++++++++++ engines/titanic/movie.h | 36 +++++++++++++++++++++ engines/titanic/npcs/mobile.h | 2 +- engines/titanic/pet_control/pet_val.cpp | 2 +- engines/titanic/pet_control/pet_val.h | 2 +- engines/titanic/pet_control/pet_val_base.cpp | 4 +-- engines/titanic/pet_control/pet_val_base.h | 2 +- engines/titanic/rect.cpp | 27 ++++++++++++++++ engines/titanic/rect.h | 43 +++++++++++++++++++++++++ engines/titanic/screen_manager.cpp | 4 +-- engines/titanic/screen_manager.h | 8 ++--- engines/titanic/simple_file.cpp | 16 ++++----- engines/titanic/simple_file.h | 10 +++--- engines/titanic/text_cursor.cpp | 5 ++- engines/titanic/text_cursor.h | 3 +- engines/titanic/video_surface.cpp | 8 ++--- engines/titanic/video_surface.h | 7 ++-- 53 files changed, 284 insertions(+), 137 deletions(-) create mode 100644 engines/titanic/movie.cpp create mode 100644 engines/titanic/movie.h create mode 100644 engines/titanic/rect.cpp create mode 100644 engines/titanic/rect.h diff --git a/engines/titanic/carry/brain.h b/engines/titanic/carry/brain.h index 8cfd491cea..14f9b632a0 100644 --- a/engines/titanic/carry/brain.h +++ b/engines/titanic/carry/brain.h @@ -29,7 +29,7 @@ namespace Titanic { class CBrain : public CCarry { private: - Common::Point _pos1; + Point _pos1; int _field134; int _field138; public: diff --git a/engines/titanic/carry/bridge_piece.h b/engines/titanic/carry/bridge_piece.h index b96015a2a9..a641eb4574 100644 --- a/engines/titanic/carry/bridge_piece.h +++ b/engines/titanic/carry/bridge_piece.h @@ -30,7 +30,7 @@ namespace Titanic { class CBridgePiece : public CCarry { private: CString _string6; - Common::Point _pos3; + Point _pos3; int _field140; public: CLASSDEF diff --git a/engines/titanic/carry/carry.h b/engines/titanic/carry/carry.h index 6b3ae2323e..309b8a8eb8 100644 --- a/engines/titanic/carry/carry.h +++ b/engines/titanic/carry/carry.h @@ -30,13 +30,13 @@ namespace Titanic { class CCarry : public CGameObject { private: CString _string1; - Common::Point _pos1; + Point _pos1; CString _string2; int _fieldDC; int _fieldE0; CString _string3; CString _string4; - Common::Point _pos2; + Point _pos2; int _field100; int _field104; int _field108; diff --git a/engines/titanic/core/drop_target.h b/engines/titanic/core/drop_target.h index 22cb057bb7..6c1cdcfe38 100644 --- a/engines/titanic/core/drop_target.h +++ b/engines/titanic/core/drop_target.h @@ -29,7 +29,7 @@ namespace Titanic { class CDropTarget : public CGameObject { private: - Common::Point _pos1; + Point _pos1; int _fieldC4; CString _string1; int _fieldD4; diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 884873ec0e..06f2ce78af 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -26,7 +26,7 @@ namespace Titanic { CGameObject::CGameObject(): CNamedItem() { - _bounds = Common::Rect(0, 0, 15, 15); + _bounds = Rect(0, 0, 15, 15); _field34 = 0; _field38 = 0; _field3C = 0; @@ -122,7 +122,7 @@ void CGameObject::fn2() { error("TODO"); } -bool CGameObject::checkPoint(const Common::Point &pt, int v0, int v1) { +bool CGameObject::checkPoint(const Point &pt, int v0, int v1) { warning("TODO: CGameObject::checkPoint"); return false; } diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 693f334608..809f7b8d20 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -23,7 +23,7 @@ #ifndef TITANIC_GAME_OBJECT_H #define TITANIC_GAME_OBJECT_H -#include "common/rect.h" +#include "titanic/rect.h" #include "titanic/core/movie_clip.h" #include "titanic/core/named_item.h" @@ -31,7 +31,7 @@ namespace Titanic { class CGameObject : public CNamedItem { protected: - Common::Rect _bounds; + Rect _bounds; double _field34; double _field38; double _field3C; @@ -75,7 +75,7 @@ public: void fn2(); - bool checkPoint(const Common::Point &pt, int v0, int v1); + bool checkPoint(const Point &pt, int v0, int v1); }; } // End of namespace Titanic diff --git a/engines/titanic/core/link_item.h b/engines/titanic/core/link_item.h index 733a4c9bdd..bbeef2c11c 100644 --- a/engines/titanic/core/link_item.h +++ b/engines/titanic/core/link_item.h @@ -46,7 +46,7 @@ protected: int _field30; int _field34; public: - Common::Rect _bounds; + Rect _bounds; public: CLASSDEF CLinkItem(); diff --git a/engines/titanic/core/room_item.h b/engines/titanic/core/room_item.h index a42ffab32e..7248b4aac3 100644 --- a/engines/titanic/core/room_item.h +++ b/engines/titanic/core/room_item.h @@ -23,7 +23,7 @@ #ifndef TITANIC_ROOM_ITEM_H #define TITANIC_ROOM_ITEM_H -#include "common/rect.h" +#include "titanic/rect.h" #include "titanic/core/list.h" #include "titanic/core/movie_clip.h" #include "titanic/core/named_item.h" @@ -33,7 +33,7 @@ namespace Titanic { class CRoomItem : public CNamedItem { public: - Common::Rect _roomRect; + Rect _roomRect; CMovieClipList _clipList; int _roomNumber; CResourceKey _transitionMovieKey; diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index a4156d6ad1..5669784cd7 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -122,7 +122,7 @@ public: /** * Gets the bounds occupied by the item */ - virtual Common::Rect getBounds() { return Common::Rect(); } + virtual Rect getBounds() { return Rect(); } /** * Called when the view changes diff --git a/engines/titanic/direct_draw_surface.cpp b/engines/titanic/direct_draw_surface.cpp index cf7639cf1b..4e7311a6a7 100644 --- a/engines/titanic/direct_draw_surface.cpp +++ b/engines/titanic/direct_draw_surface.cpp @@ -52,7 +52,7 @@ void DirectDrawSurface::free() { _disposeAfterUse = DisposeAfterUse::NO; } -Graphics::ManagedSurface *DirectDrawSurface::lock(const Common::Rect *bounds, int flags) { +Graphics::ManagedSurface *DirectDrawSurface::lock(const Rect *bounds, int flags) { assert(!_surface->empty()); return _surface; } @@ -61,29 +61,29 @@ void DirectDrawSurface::unlock() { assert(_surface->w != 0 && _surface->h != 0); } -void DirectDrawSurface::fill(const Common::Rect *bounds, uint32 color) { - Common::Rect tempBounds; +void DirectDrawSurface::fill(const Rect *bounds, uint32 color) { + Rect tempBounds; if (bounds) { // Bounds are provided, clip them to the bounds of this surface tempBounds = *bounds; - tempBounds.clip(Common::Rect(0, 0, _surface->w, _surface->h)); + tempBounds.clip(Rect(0, 0, _surface->w, _surface->h)); } else { // No bounds provided, so use the entire surface - tempBounds = Common::Rect(0, 0, _surface->w, _surface->h); + tempBounds = Rect(0, 0, _surface->w, _surface->h); } // Fill the area _surface->fillRect(tempBounds, color); } -void DirectDrawSurface::blit(const Common::Rect &destRect, DirectDrawSurface *srcSurface, Common::Rect &srcRect) { +void DirectDrawSurface::blit(const Rect &destRect, DirectDrawSurface *srcSurface, Rect &srcRect) { assert(srcSurface); if (!destRect.isEmpty()) _surface->transBlitFrom(*srcSurface->_surface, srcRect, destRect, (uint)-1); } -void DirectDrawSurface::blit(const Common::Point &destPos, DirectDrawSurface *srcSurface, Common::Rect *bounds) { +void DirectDrawSurface::blit(const Point &destPos, DirectDrawSurface *srcSurface, Rect *bounds) { if (bounds) _surface->blitFrom(*srcSurface->_surface, *bounds, destPos); else diff --git a/engines/titanic/direct_draw_surface.h b/engines/titanic/direct_draw_surface.h index 9a93316f7d..dfcdccb48c 100644 --- a/engines/titanic/direct_draw_surface.h +++ b/engines/titanic/direct_draw_surface.h @@ -26,6 +26,7 @@ #include "common/scummsys.h" #include "common/array.h" #include "graphics/managed_surface.h" +#include "titanic/rect.h" namespace Titanic { @@ -86,7 +87,7 @@ public: /** * Lock the surface for access */ - Graphics::ManagedSurface *lock(const Common::Rect *bounds, int flags); + Graphics::ManagedSurface *lock(const Rect *bounds, int flags); /** * Unlocks the surface at the end of direct accesses @@ -97,17 +98,17 @@ public: * Fills an area of the surfae with the specified color. If no bounds are passed, * then the entire surface is filled */ - void fill(const Common::Rect *bounds, uint32 color); + void fill(const Rect *bounds, uint32 color); /** * Copy data from a source surfcae into this one */ - void blit(const Common::Rect &destRect, DirectDrawSurface *srcSurface, Common::Rect &srcRect); + void blit(const Rect &destRect, DirectDrawSurface *srcSurface, Rect &srcRect); /** * Copy data from a source surfcae into this one */ - void blit(const Common::Point &destPos, DirectDrawSurface *srcSurface, Common::Rect *bounds); + void blit(const Point &destPos, DirectDrawSurface *srcSurface, Rect *bounds); }; } // End of namespace Titanic diff --git a/engines/titanic/events.cpp b/engines/titanic/events.cpp index 346b43c02b..6fae102ccc 100644 --- a/engines/titanic/events.cpp +++ b/engines/titanic/events.cpp @@ -103,7 +103,7 @@ uint32 Events::getTicksCount() const { } #define HANDLE_MESSAGE(method) if (_vm->_window->_inputAllowed) { \ - _vm->_window->_gameManager->_inputTranslator.leftButtonDown(_specialButtons, _mousePos); \ + _vm->_window->_gameManager->_inputTranslator.leftButtonDown(_specialButtons, Point(_mousePos.x, _mousePos.y)); \ _vm->_window->mouseChanged(); \ } diff --git a/engines/titanic/game/cdrom.h b/engines/titanic/game/cdrom.h index f810056e4f..c1280f6712 100644 --- a/engines/titanic/game/cdrom.h +++ b/engines/titanic/game/cdrom.h @@ -29,7 +29,7 @@ namespace Titanic { class CCDROM : public CGameObject { private: - Common::Point _pos1; + Point _pos1; public: CLASSDEF CCDROM(); diff --git a/engines/titanic/game/end_game_credits.h b/engines/titanic/game/end_game_credits.h index 68e86c6220..ab14f2680b 100644 --- a/engines/titanic/game/end_game_credits.h +++ b/engines/titanic/game/end_game_credits.h @@ -30,7 +30,7 @@ namespace Titanic { class CEndGameCredits : public CGameObject { private: int _fieldBC; - Common::Point _pos1; + Point _pos1; public: CLASSDEF CEndGameCredits(); diff --git a/engines/titanic/game/placeholder/lemon_on_bar.h b/engines/titanic/game/placeholder/lemon_on_bar.h index c88698fcab..18559b0350 100644 --- a/engines/titanic/game/placeholder/lemon_on_bar.h +++ b/engines/titanic/game/placeholder/lemon_on_bar.h @@ -29,7 +29,7 @@ namespace Titanic { class CLemonOnBar : public CPlaceHolder { private: - Common::Point _pos1; + Point _pos1; public: CLASSDEF diff --git a/engines/titanic/game/placeholder/tv_on_bar.h b/engines/titanic/game/placeholder/tv_on_bar.h index 3358cd6fec..3af59deb5b 100644 --- a/engines/titanic/game/placeholder/tv_on_bar.h +++ b/engines/titanic/game/placeholder/tv_on_bar.h @@ -29,7 +29,7 @@ namespace Titanic { class CTVOnBar : public CPlaceHolder { private: - Common::Point _pos1; + Point _pos1; public: CLASSDEF diff --git a/engines/titanic/game/sauce_dispensor.h b/engines/titanic/game/sauce_dispensor.h index 6969adb326..8a5cc96eca 100644 --- a/engines/titanic/game/sauce_dispensor.h +++ b/engines/titanic/game/sauce_dispensor.h @@ -32,8 +32,8 @@ public: CString _string3; int _fieldEC; int _fieldF0; - Common::Point _pos1; - Common::Point _pos2; + Point _pos1; + Point _pos2; int _field104; int _field108; public: diff --git a/engines/titanic/game/ship_setting.h b/engines/titanic/game/ship_setting.h index cbf4e9f61a..2525224a28 100644 --- a/engines/titanic/game/ship_setting.h +++ b/engines/titanic/game/ship_setting.h @@ -31,7 +31,7 @@ namespace Titanic { class CShipSetting : public CBackground, CEnterRoomMsgTarget { private: CString _string3; - Common::Point _pos1; + Point _pos1; CString _string4; CString _string5; protected: diff --git a/engines/titanic/game/transport/lift_indicator.h b/engines/titanic/game/transport/lift_indicator.h index 161f032480..80f8b0d05b 100644 --- a/engines/titanic/game/transport/lift_indicator.h +++ b/engines/titanic/game/transport/lift_indicator.h @@ -31,7 +31,7 @@ namespace Titanic { class CLiftindicator : public CLift { private: int _fieldFC; - Common::Point _pos2; + Point _pos2; int _field108; int _field10C; protected: diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index 49a881d8e2..a80e871e49 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -137,7 +137,7 @@ void CGameManager::postSave() { } void CGameManager::initBounds() { - _bounds = Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + _bounds = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); } void CGameManager::fn2() { @@ -160,7 +160,7 @@ void CGameManager::update() { if (view) { // Expand the game manager's bounds to encompass all the view's items for (CTreeItem *item = view; item; item = item->scan(view)) { - Common::Rect r = item->getBounds(); + Rect r = item->getBounds(); if (!r.isEmpty()) _bounds.extend(r); } @@ -184,7 +184,7 @@ void CGameManager::update() { // Handle redrawing the view if (!_bounds.isEmpty()) { _gameView->draw(_bounds); - _bounds = Common::Rect(); + _bounds = Rect(); } _gameState.checkForViewChange(); diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index f18696bf5c..51e1c3dd8f 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -113,7 +113,7 @@ public: CProjectItem *_project; CGameView *_gameView; CGameState _gameState; - Common::Rect _bounds; + Rect _bounds; CInputHandler _inputHandler; CInputTranslator _inputTranslator; CTreeItem *_dragItem; diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index f906ff66d3..2885b3ad0c 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -36,13 +36,13 @@ bool CGameStateList::isViewChanging() const { CGameState::CGameState(CGameManager *gameManager) : _gameManager(gameManager), _gameLocation(this), - _field8(0), _fieldC(0), _mode(GSMODE_0), _field14(0), _field18(0), + _field8(0), _fieldC(0), _mode(GSMODE_0), _field14(0), _petActive(false), _field1C(0), _field20(0), _field24(0), _nodeChangeCtr(0), _nodeEnterTicks(0), _field38(0) { } void CGameState::save(SimpleFile *file) const { - file->writeNumber(_field18); + file->writeNumber(_petActive); file->writeNumber(_field8); file->writeNumber(_fieldC); file->writeNumber(_field14); @@ -53,7 +53,7 @@ void CGameState::save(SimpleFile *file) const { } void CGameState::load(SimpleFile *file) { - _field18 = file->readNumber(); + _petActive = file->readNumber() != 0; _field8 = file->readNumber(); _fieldC = file->readNumber(); _field14 = file->readNumber(); @@ -87,7 +87,7 @@ void CGameState::setMode(GameStateMode newMode) { _mode = newMode; } -void CGameState::setMousePos(const Common::Point &pt) { +void CGameState::setMousePos(const Point &pt) { _mousePos = pt; } diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h index 37bb603317..49bcbcdd97 100644 --- a/engines/titanic/game_state.h +++ b/engines/titanic/game_state.h @@ -53,13 +53,13 @@ public: int _fieldC; GameStateMode _mode; int _field14; - int _field18; + bool _petActive; int _field1C; int _field20; int _field24; uint _nodeChangeCtr; uint32 _nodeEnterTicks; - Common::Point _mousePos; + Point _mousePos; int _field38; public: CGameState(CGameManager *gameManager); @@ -82,7 +82,7 @@ public: /** * Sets the current mouse position */ - void setMousePos(const Common::Point &pt); + void setMousePos(const Point &pt); /** * Called by the PET when a new node is entered diff --git a/engines/titanic/game_view.cpp b/engines/titanic/game_view.cpp index ecdeb85f9a..505e489ee8 100644 --- a/engines/titanic/game_view.cpp +++ b/engines/titanic/game_view.cpp @@ -57,10 +57,10 @@ void CGameView::createSurface(const CResourceKey &key) { _surface->_blitFlag = true; } -void CGameView::draw1() { +void CGameView::drawView() { CScreenManager::setCurrent(); - Common::Rect rect1 = _gameManager->_bounds; - Common::Rect rect2(0, 0, 600, 340); + Rect rect1 = _gameManager->_bounds; + Rect rect2(0, 0, 600, 340); rect2.translate(20, 10); @@ -78,7 +78,7 @@ void CSTGameView::setView(CViewItem *view) { _gameWindow->setActiveView(view); } -void CSTGameView::draw(const Common::Rect &bounds) { +void CSTGameView::draw(const Rect &bounds) { _gameWindow->draw(); } diff --git a/engines/titanic/game_view.h b/engines/titanic/game_view.h index 14412032dc..c1d1a001d3 100644 --- a/engines/titanic/game_view.h +++ b/engines/titanic/game_view.h @@ -57,14 +57,17 @@ public: */ virtual void setView(CViewItem *item) = 0; - virtual void draw(const Common::Rect &bounds) = 0; + virtual void draw(const Rect &bounds) = 0; /** * Creates a surface from a specified resource */ void createSurface(const CResourceKey &key); - void draw1(); + /** + * Draws the background of a view + */ + void drawView(); }; class CSTGameView: public CGameView { @@ -81,7 +84,7 @@ public: /** * Handles drawing the view */ - virtual void draw(const Common::Rect &bounds); + virtual void draw(const Rect &bounds); }; } // End of namespace Titanic diff --git a/engines/titanic/gfx/move_object_button.h b/engines/titanic/gfx/move_object_button.h index 70df8f6a7f..3873db6f4e 100644 --- a/engines/titanic/gfx/move_object_button.h +++ b/engines/titanic/gfx/move_object_button.h @@ -29,7 +29,7 @@ namespace Titanic { class CMoveObjectButton : public CSTButton { private: - Common::Point _pos1; + Point _pos1; int _field11C; public: CLASSDEF diff --git a/engines/titanic/gfx/slider_button.h b/engines/titanic/gfx/slider_button.h index afb96dbd70..2fdf448d09 100644 --- a/engines/titanic/gfx/slider_button.h +++ b/engines/titanic/gfx/slider_button.h @@ -32,7 +32,7 @@ private: int _field114; int _field118; int _field11C; - Common::Point _pos1; + Point _pos1; public: CLASSDEF CSliderButton(); diff --git a/engines/titanic/gfx/toggle_switch.h b/engines/titanic/gfx/toggle_switch.h index 9b4fc4219b..cc369f6281 100644 --- a/engines/titanic/gfx/toggle_switch.h +++ b/engines/titanic/gfx/toggle_switch.h @@ -30,7 +30,7 @@ namespace Titanic { class CToggleSwitch : public CGameObject { private: int _fieldBC; - Common::Point _pos1; + Point _pos1; public: CLASSDEF CToggleSwitch(); diff --git a/engines/titanic/input_handler.cpp b/engines/titanic/input_handler.cpp index c710374d05..110bddfd90 100644 --- a/engines/titanic/input_handler.cpp +++ b/engines/titanic/input_handler.cpp @@ -101,7 +101,7 @@ void CInputHandler::processMessage(const CMessage *msg) { // Save where the drag movement started from _dragStartPos = _mousePos; } else { - Common::Point delta = mouseMsg->_mousePos - _dragStartPos; + Point delta = mouseMsg->_mousePos - _dragStartPos; int distance = (int)sqrt(double(delta.x * delta.x + delta.y * delta.y)); if (distance > 4) { @@ -134,7 +134,7 @@ void CInputHandler::dispatchMessage(const CMessage *msg) { } } -void CInputHandler::dragEnd(const Common::Point &mousePos, CTreeItem *dragItem) { +void CInputHandler::dragEnd(const Point &mousePos, CTreeItem *dragItem) { warning("TODO CInputHandler::dragEnd"); } diff --git a/engines/titanic/input_handler.h b/engines/titanic/input_handler.h index ad1ba86215..a81874f0c5 100644 --- a/engines/titanic/input_handler.h +++ b/engines/titanic/input_handler.h @@ -23,7 +23,7 @@ #ifndef TITANIC_INPUT_HANDLER_H #define TITANIC_INPUT_HANDLER_H -#include "common/rect.h" +#include "titanic/rect.h" #include "titanic/input_translator.h" #include "titanic/core/tree_item.h" @@ -46,15 +46,15 @@ private: /** * Called when a drag operation has ended */ - void dragEnd(const Common::Point &mousePos, CTreeItem *dragItem); + void dragEnd(const Point &mousePos, CTreeItem *dragItem); public: CGameManager *_gameManager; CInputTranslator *_inputTranslator; bool _dragging; bool _buttonDown; CTreeItem *_dragItem; - Common::Point _dragStartPos; - Common::Point _mousePos; + Point _dragStartPos; + Point _mousePos; int _lockCount; int _field24; public: diff --git a/engines/titanic/input_translator.cpp b/engines/titanic/input_translator.cpp index bd33f20a70..ceb2be87f6 100644 --- a/engines/titanic/input_translator.cpp +++ b/engines/titanic/input_translator.cpp @@ -44,52 +44,52 @@ int CInputTranslator::getButtons(int special) const { return buttons; } -void CInputTranslator::mouseMove(int special, const Common::Point &pt) { +void CInputTranslator::mouseMove(int special, const Point &pt) { CMouseMoveMsg msg(pt, getButtons(special)); _inputHandler->handleMessage(msg); } -void CInputTranslator::leftButtonDown(int special, const Common::Point &pt) { +void CInputTranslator::leftButtonDown(int special, const Point &pt) { CMouseButtonDownMsg msg(pt, getButtons(special)); _inputHandler->handleMessage(msg); } -void CInputTranslator::leftButtonUp(int special, const Common::Point &pt) { +void CInputTranslator::leftButtonUp(int special, const Point &pt) { CMouseButtonUpMsg msg(pt, getButtons(special)); _inputHandler->handleMessage(msg); } -void CInputTranslator::leftButtonDoubleClick(int special, const Common::Point &pt) { +void CInputTranslator::leftButtonDoubleClick(int special, const Point &pt) { CMouseButtonDoubleClickMsg msg(pt, getButtons(special)); _inputHandler->handleMessage(msg); } -void CInputTranslator::middleButtonDown(int special, const Common::Point &pt) { +void CInputTranslator::middleButtonDown(int special, const Point &pt) { CMouseButtonDownMsg msg(pt, getButtons(special)); _inputHandler->handleMessage(msg); } -void CInputTranslator::middleButtonUp(int special, const Common::Point &pt) { +void CInputTranslator::middleButtonUp(int special, const Point &pt) { CMouseButtonUpMsg msg(pt, getButtons(special)); _inputHandler->handleMessage(msg); } -void CInputTranslator::middleButtonDoubleClick(int special, const Common::Point &pt) { +void CInputTranslator::middleButtonDoubleClick(int special, const Point &pt) { CMouseButtonDoubleClickMsg msg(pt, getButtons(special)); _inputHandler->handleMessage(msg); } -void CInputTranslator::rightButtonDown(int special, const Common::Point &pt) { +void CInputTranslator::rightButtonDown(int special, const Point &pt) { CMouseButtonDownMsg msg(pt, getButtons(special)); _inputHandler->handleMessage(msg); } -void CInputTranslator::rightButtonUp(int special, const Common::Point &pt) { +void CInputTranslator::rightButtonUp(int special, const Point &pt) { CMouseButtonUpMsg msg(pt, getButtons(special)); _inputHandler->handleMessage(msg); } -void CInputTranslator::rightButtonDoubleClick(int special, const Common::Point &pt) { +void CInputTranslator::rightButtonDoubleClick(int special, const Point &pt) { CMouseButtonDoubleClickMsg msg(pt, getButtons(special)); _inputHandler->handleMessage(msg); } diff --git a/engines/titanic/input_translator.h b/engines/titanic/input_translator.h index 2748ca4951..ad4f2d9d0a 100644 --- a/engines/titanic/input_translator.h +++ b/engines/titanic/input_translator.h @@ -40,16 +40,16 @@ public: public: CInputTranslator(CInputHandler *inputHandler); - void mouseMove(int special, const Common::Point &pt); - void leftButtonDown(int special, const Common::Point &pt); - void leftButtonUp(int special, const Common::Point &pt); - void leftButtonDoubleClick(int special, const Common::Point &pt); - void middleButtonDown(int special, const Common::Point &pt); - void middleButtonUp(int special, const Common::Point &pt); - void middleButtonDoubleClick(int special, const Common::Point &pt); - void rightButtonDown(int special, const Common::Point &pt); - void rightButtonUp(int special, const Common::Point &pt); - void rightButtonDoubleClick(int special, const Common::Point &pt); + void mouseMove(int special, const Point &pt); + void leftButtonDown(int special, const Point &pt); + void leftButtonUp(int special, const Point &pt); + void leftButtonDoubleClick(int special, const Point &pt); + void middleButtonDown(int special, const Point &pt); + void middleButtonUp(int special, const Point &pt); + void middleButtonDoubleClick(int special, const Point &pt); + void rightButtonDown(int special, const Point &pt); + void rightButtonUp(int special, const Point &pt); + void rightButtonDoubleClick(int special, const Point &pt); }; } // End of namespace Titanic diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index c282787ade..839c2fc684 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -125,11 +125,11 @@ void CMainGameWindow::draw() { switch (_gameManager->_gameState._mode) { case GSMODE_1: case GSMODE_2: - if (_gameManager->_gameState._field18) + if (_gameManager->_gameState._petActive) drawPet(scrManager); - draw1(); - draw2(scrManager); + drawView(); + drawViewContents(scrManager); scrManager->drawCursors(); break; @@ -151,12 +151,12 @@ void CMainGameWindow::drawPet(CScreenManager *screenManager) { } } -void CMainGameWindow::draw1() { +void CMainGameWindow::drawView() { if (_gameView->_surface) - _gameView->draw1(); + _gameView->drawView(); } -void CMainGameWindow::draw2(CScreenManager *screenManager) { +void CMainGameWindow::drawViewContents(CScreenManager *screenManager) { } diff --git a/engines/titanic/main_game_window.h b/engines/titanic/main_game_window.h index 549637b5dd..42517f5a08 100644 --- a/engines/titanic/main_game_window.h +++ b/engines/titanic/main_game_window.h @@ -55,9 +55,15 @@ private: */ void drawPet(CScreenManager *screenManager); - void draw1(); + /** + * Draws the background for the view + */ + void drawView(); - void draw2(CScreenManager *screenManager); + /** + * Draws all the items within the view + */ + void drawViewContents(CScreenManager *screenManager); public: CGameView *_gameView; CGameManager *_gameManager; diff --git a/engines/titanic/messages/mouse_messages.h b/engines/titanic/messages/mouse_messages.h index 84d7b8f61c..77343fa6cd 100644 --- a/engines/titanic/messages/mouse_messages.h +++ b/engines/titanic/messages/mouse_messages.h @@ -23,7 +23,7 @@ #ifndef TITANIC_MOUSE_MESSAGES_H #define TITANIC_MOUSE_MESSAGES_H -#include "common/rect.h" +#include "titanic/rect.h" #include "titanic/messages/messages.h" namespace Titanic { @@ -33,14 +33,14 @@ enum MouseButton { MB_LEFT = 1, MB_MIDDLE = 2, MB_RIGHT = 4 }; class CMouseMsg : public CMessage { public: int _buttons; - Common::Point _mousePos; + Point _mousePos; public: CLASSDEF static bool isSupportedBy(const CTreeItem *item) { return dynamic_cast(item) != nullptr; } CMouseMsg() : _buttons(0) {} - CMouseMsg(const Common::Point &pt, int buttons) : + CMouseMsg(const Point &pt, int buttons) : _mousePos(pt), _buttons(buttons) {} }; @@ -49,7 +49,7 @@ class CMouseMoveMsg : public CMouseMsg { public: CLASSDEF CMouseMoveMsg() : CMouseMsg() {} - CMouseMoveMsg(const Common::Point &pt, int buttons) : CMouseMsg(pt, buttons) {} + CMouseMoveMsg(const Point &pt, int buttons) : CMouseMsg(pt, buttons) {} static bool isSupportedBy(const CTreeItem *item) { return dynamic_cast(item) != nullptr; @@ -67,7 +67,7 @@ public: public: CLASSDEF CMouseButtonMsg() : CMouseMsg(), _field10(0) {} - CMouseButtonMsg(const Common::Point &pt, int buttons) : CMouseMsg(pt, buttons) {} + CMouseButtonMsg(const Point &pt, int buttons) : CMouseMsg(pt, buttons) {} static bool isSupportedBy(const CTreeItem *item) { return dynamic_cast(item) != nullptr; @@ -79,7 +79,7 @@ class CMouseButtonDownMsg : public CMouseButtonMsg { public: CLASSDEF CMouseButtonDownMsg() : CMouseButtonMsg() {} - CMouseButtonDownMsg(const Common::Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} + CMouseButtonDownMsg(const Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} static bool isSupportedBy(const CTreeItem *item) { return dynamic_cast(item) != nullptr; @@ -96,7 +96,7 @@ class CMouseButtonUpMsg : public CMouseButtonMsg { public: CLASSDEF CMouseButtonUpMsg() : CMouseButtonMsg() {} - CMouseButtonUpMsg(const Common::Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} + CMouseButtonUpMsg(const Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} static bool isSupportedBy(const CTreeItem *item) { return dynamic_cast(item) != nullptr; @@ -113,7 +113,7 @@ class CMouseButtonDoubleClickMsg : public CMouseButtonMsg { public: CLASSDEF CMouseButtonDoubleClickMsg() : CMouseButtonMsg() {} - CMouseButtonDoubleClickMsg(const Common::Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} + CMouseButtonDoubleClickMsg(const Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} static bool isSupportedBy(const CTreeItem *item) { return dynamic_cast(item) != nullptr; @@ -129,7 +129,7 @@ class CMouseDragMsg : public CMouseMsg { public: CLASSDEF CMouseDragMsg() : CMouseMsg() {} - CMouseDragMsg(const Common::Point &pt) : CMouseMsg(pt, 0) {} + CMouseDragMsg(const Point &pt) : CMouseMsg(pt, 0) {} static bool isSupportedBy(const CTreeItem *item) { return dynamic_cast(item) != nullptr; @@ -140,7 +140,7 @@ class CMouseDragMoveMsg : public CMouseDragMsg { public: CLASSDEF CMouseDragMoveMsg() : CMouseDragMsg() {} - CMouseDragMoveMsg(const Common::Point &pt) : CMouseDragMsg(pt) {} + CMouseDragMoveMsg(const Point &pt) : CMouseDragMsg(pt) {} static bool isSupportedBy(const CTreeItem *item) { return dynamic_cast(item) != nullptr; @@ -160,7 +160,7 @@ public: public: CLASSDEF CMouseDragStartMsg() : CMouseDragMsg(), _dragItem(nullptr), _field14(0) {} - CMouseDragStartMsg(const Common::Point &pt) : CMouseDragMsg(pt), + CMouseDragStartMsg(const Point &pt) : CMouseDragMsg(pt), _dragItem(nullptr), _field14(0) {} static bool isSupportedBy(const CTreeItem *item) { @@ -180,7 +180,7 @@ public: public: CLASSDEF CMouseDragEndMsg() : CMouseDragMsg(), _dragItem(nullptr) {} - CMouseDragEndMsg(const Common::Point &pt, CTreeItem *dragItem = nullptr) : + CMouseDragEndMsg(const Point &pt, CTreeItem *dragItem = nullptr) : CMouseDragMsg(pt), _dragItem(dragItem) {} static bool isSupportedBy(const CTreeItem *item) { diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 285a1c8157..afd8453d88 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -18,6 +18,8 @@ MODULE_OBJS := \ input_translator.o \ main_game_window.o \ mouse_cursor.o \ + movie.o \ + rect.o \ screen_manager.o \ simple_file.o \ string.o \ diff --git a/engines/titanic/movie.cpp b/engines/titanic/movie.cpp new file mode 100644 index 0000000000..1eaeac638d --- /dev/null +++ b/engines/titanic/movie.cpp @@ -0,0 +1,28 @@ +/* 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 "titanic/movie.h" + +namespace Titanic { + + +} // End of namespace Titanic diff --git a/engines/titanic/movie.h b/engines/titanic/movie.h new file mode 100644 index 0000000000..a213b7b891 --- /dev/null +++ b/engines/titanic/movie.h @@ -0,0 +1,36 @@ +/* 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. + * + */ + +#ifndef TITANIC_MOVIE_H +#define TITANIC_MOVIE_H + +#include "titanic/core/list.h" + +namespace Titanic { + +class CMovie : public ListItem { +public: +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MOVIE_H */ diff --git a/engines/titanic/npcs/mobile.h b/engines/titanic/npcs/mobile.h index 512bb9fe9f..4979d54fc3 100644 --- a/engines/titanic/npcs/mobile.h +++ b/engines/titanic/npcs/mobile.h @@ -29,7 +29,7 @@ namespace Titanic { class CMobile : public CCharacter { private: - Common::Point _pos1; + Point _pos1; int _fieldDC; public: CLASSDEF diff --git a/engines/titanic/pet_control/pet_val.cpp b/engines/titanic/pet_control/pet_val.cpp index 96b82f1632..5bc237572e 100644 --- a/engines/titanic/pet_control/pet_val.cpp +++ b/engines/titanic/pet_control/pet_val.cpp @@ -41,7 +41,7 @@ void CPetVal::proc4() { error("TODO"); } -void CPetVal::proc5(Common::Rect *rect) { +void CPetVal::proc5(Rect *rect) { error("TODO"); } diff --git a/engines/titanic/pet_control/pet_val.h b/engines/titanic/pet_control/pet_val.h index bd1fb9e55c..0e909d485b 100644 --- a/engines/titanic/pet_control/pet_val.h +++ b/engines/titanic/pet_control/pet_val.h @@ -40,7 +40,7 @@ public: virtual void proc3(); virtual void proc4(); - virtual void proc5(Common::Rect *linkItem); + virtual void proc5(Rect *linkItem); virtual int proc16(); }; diff --git a/engines/titanic/pet_control/pet_val_base.cpp b/engines/titanic/pet_control/pet_val_base.cpp index c798c37971..9a23854450 100644 --- a/engines/titanic/pet_control/pet_val_base.cpp +++ b/engines/titanic/pet_control/pet_val_base.cpp @@ -28,9 +28,9 @@ namespace Titanic { CPetValBase::CPetValBase() : _field4(0), _field8(0), _fieldC(0), _field10(0), _field14(0) {} -void CPetValBase::proc5(Common::Rect *rect) { +void CPetValBase::proc5(Rect *rect) { if (rect) - *rect = Common::Rect(); + *rect = Rect(); } int CPetValBase::proc6() { diff --git a/engines/titanic/pet_control/pet_val_base.h b/engines/titanic/pet_control/pet_val_base.h index c4ff66568d..637e95f22d 100644 --- a/engines/titanic/pet_control/pet_val_base.h +++ b/engines/titanic/pet_control/pet_val_base.h @@ -44,7 +44,7 @@ public: virtual void proc3() {} virtual void proc4() {} - virtual void proc5(Common::Rect *rect); + virtual void proc5(Rect *rect); virtual int proc6(); virtual int proc7(); diff --git a/engines/titanic/rect.cpp b/engines/titanic/rect.cpp new file mode 100644 index 0000000000..deb896fb47 --- /dev/null +++ b/engines/titanic/rect.cpp @@ -0,0 +1,27 @@ +/* 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 "titanic/rect.h" + +namespace Titanic { + +} // End of namespace Titanic diff --git a/engines/titanic/rect.h b/engines/titanic/rect.h new file mode 100644 index 0000000000..ffd251b4bb --- /dev/null +++ b/engines/titanic/rect.h @@ -0,0 +1,43 @@ +/* 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. + * + */ + +#ifndef TITANIC_RECT_H +#define TITANIC_RECT_H + +#include "common/rect.h" + +namespace Titanic { + +typedef Common::Point Point; + +class Rect : public Common::Rect { +public: + Rect() : Common::Rect() {} + Rect(int16 w, int16 h) : Common::Rect(w, h) {} + Rect(int16 x1, int16 y1, int16 x2, int16 y2) : Common::Rect(x1, y1, x2, y2) {} + + operator const Point() { return Point(left, top); } +}; + +} // End of namespace Titanic + +#endif /* TITANIC_RECT_H */ diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp index f87ad66b9a..942bb4179f 100644 --- a/engines/titanic/screen_manager.cpp +++ b/engines/titanic/screen_manager.cpp @@ -62,7 +62,7 @@ CScreenManager *CScreenManager::setCurrent() { return _currentScreenManagerPtr; } -void CScreenManager::setSurfaceBounds(int surfaceNum, const Common::Rect &r) { +void CScreenManager::setSurfaceBounds(int surfaceNum, const Rect &r) { if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) _backSurfaces[surfaceNum]._bounds = r; } @@ -133,7 +133,7 @@ void OSScreenManager::getFont() {} void OSScreenManager::proc18() {} void OSScreenManager::proc19() {} -void OSScreenManager::clearSurface(int surfaceNum, Common::Rect *bounds) { +void OSScreenManager::clearSurface(int surfaceNum, Rect *bounds) { if (surfaceNum == -1) _directDrawManager._mainSurface->fill(bounds, 0); else if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) diff --git a/engines/titanic/screen_manager.h b/engines/titanic/screen_manager.h index ae3424d9fa..023aa8ea55 100644 --- a/engines/titanic/screen_manager.h +++ b/engines/titanic/screen_manager.h @@ -40,7 +40,7 @@ class TitanicEngine; class CScreenManager { struct VideoSurfaceEntry { CVideoSurface *_surface; - Common::Rect _bounds; + Rect _bounds; }; protected: TitanicEngine *_vm; @@ -97,7 +97,7 @@ public: /** * Clear a portion of a specified surface */ - virtual void clearSurface(int surfaceNum, Common::Rect *_bounds) = 0; + virtual void clearSurface(int surfaceNum, Rect *_bounds) = 0; /** * Resize the passed surface @@ -119,7 +119,7 @@ public: virtual void showCursor() = 0; virtual void hideCursor() = 0; - void setSurfaceBounds(int surfaceNum, const Common::Rect &r); + void setSurfaceBounds(int surfaceNum, const Rect &r); }; class OSScreenManager: CScreenManager { @@ -173,7 +173,7 @@ public: /** * Clear a portion of the screen surface */ - virtual void clearSurface(int surfaceNum, Common::Rect *bounds); + virtual void clearSurface(int surfaceNum, Rect *bounds); /** * Resize the passed surface diff --git a/engines/titanic/simple_file.cpp b/engines/titanic/simple_file.cpp index c975a27b28..3cd0ef7ecc 100644 --- a/engines/titanic/simple_file.cpp +++ b/engines/titanic/simple_file.cpp @@ -194,16 +194,16 @@ double SimpleFile::readFloat() { return floatValue; } -Common::Point SimpleFile::readPoint() { - Common::Point pt; +Point SimpleFile::readPoint() { + Point pt; pt.x = readNumber(); pt.y = readNumber(); return pt; } -Common::Rect SimpleFile::readRect() { - Common::Rect r; +Rect SimpleFile::readRect() { + Rect r; r.left = readNumber(); r.top = readNumber(); r.right = readNumber(); @@ -296,16 +296,16 @@ void SimpleFile::writeFloatLine(double val, int indent) { write("\n", 1); } -void SimpleFile::writePoint(const Common::Point &pt, int indent) { +void SimpleFile::writePoint(const Point &pt, int indent) { writeIndent(indent); writeNumber(pt.x); writeNumber(pt.y); write("\n", 1); } -void SimpleFile::writeRect(const Common::Rect &r, int indent) { - writePoint(Common::Point(r.left, r.top), indent); - writePoint(Common::Point(r.right, r.bottom), indent); +void SimpleFile::writeRect(const Rect &r, int indent) { + writePoint(Point(r.left, r.top), indent); + writePoint(Point(r.right, r.bottom), indent); } void SimpleFile::writeIndent(uint indent) { diff --git a/engines/titanic/simple_file.h b/engines/titanic/simple_file.h index 815896fc7e..0568092b4e 100644 --- a/engines/titanic/simple_file.h +++ b/engines/titanic/simple_file.h @@ -24,7 +24,7 @@ #define TITANIC_SIMPLE_FILE_H #include "common/file.h" -#include "common/rect.h" +#include "titanic/rect.h" #include "common/savefile.h" #include "common/stream.h" #include "common/zlib.h" @@ -104,12 +104,12 @@ public: /** * Read in a point */ - Common::Point readPoint(); + Point readPoint(); /** * Read in a rect */ - Common::Rect readRect(); + Rect readRect(); /** * Read a string and copy it into an optionally passed buffer @@ -159,12 +159,12 @@ public: /** * Write out a point line */ - void writePoint(const Common::Point &pt, int indent); + void writePoint(const Point &pt, int indent); /** * Write out a rect line */ - void writeRect(const Common::Rect &r, int indent); + void writeRect(const Rect &r, int indent); /** * Write out a number of tabs to form an indent in the output diff --git a/engines/titanic/text_cursor.cpp b/engines/titanic/text_cursor.cpp index e591dc38ed..ae1f842adb 100644 --- a/engines/titanic/text_cursor.cpp +++ b/engines/titanic/text_cursor.cpp @@ -20,7 +20,6 @@ * */ -#include "common/rect.h" #include "common/textconsole.h" #include "titanic/text_cursor.h" @@ -29,9 +28,9 @@ namespace Titanic { CTextCursor::CTextCursor() : _active(false) { } -Common::Rect CTextCursor::getBounds() { +Rect CTextCursor::getBounds() { warning("CTextCursor::getBounds"); - return Common::Rect(); + return Rect(); } } // End of namespace Titanic diff --git a/engines/titanic/text_cursor.h b/engines/titanic/text_cursor.h index 1b03abdd6a..4b6be8f1c4 100644 --- a/engines/titanic/text_cursor.h +++ b/engines/titanic/text_cursor.h @@ -24,6 +24,7 @@ #define TITANIC_TEXT_CURSOR_H #include "common/scummsys.h" +#include "titanic/rect.h" namespace Titanic { @@ -33,7 +34,7 @@ public: public: CTextCursor(); - Common::Rect getBounds(); + Rect getBounds(); }; } // End of namespace Titanic diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp index b38a8624ea..17e8f0ab46 100644 --- a/engines/titanic/video_surface.cpp +++ b/engines/titanic/video_surface.cpp @@ -46,14 +46,14 @@ void CVideoSurface::setSurface(CScreenManager *screenManager, DirectDrawSurface _ddSurface = surface; } -void CVideoSurface::blitFrom(const Common::Rect &srcRect, const Common::Rect &destRect, CVideoSurface *srcSurface) { +void CVideoSurface::blitFrom(const Rect &srcRect, const Rect &destRect, CVideoSurface *srcSurface) { // TODO: Cases when _blitFlag is false assert(_blitFlag); error("TODO"); } -void CVideoSurface::clipBounds(Common::Rect &srcRect, Common::Rect &destRect, - CVideoSurface *srcSurface, Common::Rect *subRect, Common::Point *pt) { +void CVideoSurface::clipBounds(Rect &srcRect, Rect &destRect, + CVideoSurface *srcSurface, Rect *subRect, Point *pt) { if (pt) { srcRect.left = pt->x; srcRect.top = pt->y; @@ -68,7 +68,7 @@ void CVideoSurface::clipBounds(Common::Rect &srcRect, Common::Rect &destRect, } else { srcRect.right = srcRect.left + srcSurface->getWidth(); srcRect.bottom = srcRect.top + srcSurface->getHeight(); - srcRect = Common::Rect(0, 0, srcSurface->getWidth(), srcSurface->getHeight()); + srcRect = Rect(0, 0, srcSurface->getWidth(), srcSurface->getHeight()); } // Clip destination rect to be on-screen diff --git a/engines/titanic/video_surface.h b/engines/titanic/video_surface.h index 88ab2e4d45..3538b1dd89 100644 --- a/engines/titanic/video_surface.h +++ b/engines/titanic/video_surface.h @@ -27,6 +27,7 @@ #include "common/array.h" #include "titanic/font.h" #include "titanic/direct_draw.h" +#include "titanic/rect.h" #include "titanic/core/list.h" #include "titanic/core/resource_key.h" @@ -43,8 +44,8 @@ private: /** * Calculates blitting bounds */ - void clipBounds(Common::Rect &destRect, Common::Rect &srcRect, - CVideoSurface *srcSurface, Common::Rect *bounds2, Common::Point *pt); + void clipBounds(Rect &destRect, Rect &srcRect, + CVideoSurface *srcSurface, Rect *bounds2, Point *pt); protected: static int _videoSurfaceCounter; protected: @@ -151,7 +152,7 @@ public: /** * Blit from another surface */ - void blitFrom(const Common::Rect &srcRect, const Common::Rect &destRect, CVideoSurface *srcSurface); + void blitFrom(const Rect &srcRect, const Rect &destRect, CVideoSurface *srcSurface); }; class OSVideoSurface : public CVideoSurface { -- cgit v1.2.3 From 1e6a32001088d790be2b1f909f90d55bb688ad6d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 21 Mar 2016 21:51:29 -0400 Subject: TITANIC: Implementing view draw code --- engines/titanic/events.cpp | 2 +- engines/titanic/game_view.cpp | 11 +++++++---- engines/titanic/rect.cpp | 17 ++++++++++++++++ engines/titanic/rect.h | 18 +++++++++++++++++ engines/titanic/screen_manager.cpp | 40 +++++++++++++++++++++++++++++++++++++- engines/titanic/screen_manager.h | 16 +++++++++++++-- engines/titanic/titanic.cpp | 3 +++ engines/titanic/titanic.h | 2 ++ engines/titanic/video_surface.cpp | 35 ++++++++++++++++++++++++++------- engines/titanic/video_surface.h | 10 +++++++--- 10 files changed, 136 insertions(+), 18 deletions(-) diff --git a/engines/titanic/events.cpp b/engines/titanic/events.cpp index 6fae102ccc..1f8ccce0dd 100644 --- a/engines/titanic/events.cpp +++ b/engines/titanic/events.cpp @@ -90,7 +90,7 @@ bool Events::checkForNextFrameCounter() { _vm->_debugger->onFrame(); // Display the frame - //_vm->_screen->update(); + _vm->_screen->update(); return true; } diff --git a/engines/titanic/game_view.cpp b/engines/titanic/game_view.cpp index 505e489ee8..d780b8b38e 100644 --- a/engines/titanic/game_view.cpp +++ b/engines/titanic/game_view.cpp @@ -59,13 +59,16 @@ void CGameView::createSurface(const CResourceKey &key) { void CGameView::drawView() { CScreenManager::setCurrent(); - Rect rect1 = _gameManager->_bounds; + Rect srcRect = _gameManager->_bounds; + Rect rect2(0, 0, 600, 340); rect2.translate(20, 10); + srcRect.combine2(rect2); + srcRect.translate(-20, -10); + Common::Point destPos(srcRect.left, srcRect.top); - - - warning("TODO: CGameView_Draw1"); + CScreenManager::_currentScreenManagerPtr->blitFrom(0, _surface, + &destPos, &srcRect); } /*------------------------------------------------------------------------*/ diff --git a/engines/titanic/rect.cpp b/engines/titanic/rect.cpp index deb896fb47..4642b3422c 100644 --- a/engines/titanic/rect.cpp +++ b/engines/titanic/rect.cpp @@ -24,4 +24,21 @@ namespace Titanic { +void Rect::combine1(const Rect &r) { + if (isEmpty() || r.isEmpty()) + return; + + Common::Rect::extend(r); +} + +void Rect::combine2(const Rect &r) { + if (!isEmpty()) { + if (r.isEmpty()) { + clear(); + } else { + Common::Rect::extend(r); + } + } +} + } // End of namespace Titanic diff --git a/engines/titanic/rect.h b/engines/titanic/rect.h index ffd251b4bb..b70550a607 100644 --- a/engines/titanic/rect.h +++ b/engines/titanic/rect.h @@ -35,7 +35,25 @@ public: Rect(int16 w, int16 h) : Common::Rect(w, h) {} Rect(int16 x1, int16 y1, int16 x2, int16 y2) : Common::Rect(x1, y1, x2, y2) {} + /** + * Returns the top/left corner of the rect as a point + */ operator const Point() { return Point(left, top); } + + /** + * Clear the rect + */ + void clear() { left = top = right = bottom = 0; } + + /** + * Combine another rect into this one + */ + void combine1(const Rect &r); + + /** + * Combine another rect into this one + */ + void combine2(const Rect &r); }; } // End of namespace Titanic diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp index 942bb4179f..4f9fbc2215 100644 --- a/engines/titanic/screen_manager.cpp +++ b/engines/titanic/screen_manager.cpp @@ -123,7 +123,45 @@ CVideoSurface *OSScreenManager::getSurface(int surfaceNum) const { void OSScreenManager::proc9() {} void OSScreenManager::proc10() {} -void OSScreenManager::proc11() {} + +void OSScreenManager::blitFrom(int surfaceNum, CVideoSurface *src, + const Point *destPos, const Rect *srcRect) { + // Get the dest surface + CVideoSurface *destSurface = _frontRenderSurface; + if (surfaceNum < -1) + return; + if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) + destSurface = _backSurfaces[surfaceNum]._surface; + if (!destSurface->hasSurface()) + return; + + Point destPoint = destPos ? *destPos : Point(0, 0); + Rect srcBounds = srcRect ? *srcRect : Rect(0, 0, src->getWidth(), src->getHeight()); + Rect *bounds = &srcBounds; + Rect rect2; + + if (surfaceNum >= 0 && !_backSurfaces[surfaceNum]._bounds.isEmpty()) { + // Perform clipping to the bounds of the back surface + rect2 = srcBounds; + rect2.translate(-srcBounds.left, -srcBounds.top); + rect2.translate(destPoint.x, destPoint.y); + rect2.combine2(_backSurfaces[surfaceNum]._bounds); + + rect2.translate(-destPoint.x, -destPoint.y); + rect2.translate(srcBounds.left, srcBounds.top); + + if (rect2.isEmpty()) + return; + + destPoint.x += rect2.left - srcBounds.left; + destPoint.y += rect2.top - srcBounds.top; + bounds = &rect2; + } + + if (!bounds->isEmpty()) + destSurface->blitFrom(destPoint, src, bounds); +} + void OSScreenManager::proc12() {} void OSScreenManager::proc13() {} void OSScreenManager::proc14() {} diff --git a/engines/titanic/screen_manager.h b/engines/titanic/screen_manager.h index 023aa8ea55..dc5a04236f 100644 --- a/engines/titanic/screen_manager.h +++ b/engines/titanic/screen_manager.h @@ -84,7 +84,13 @@ public: virtual CVideoSurface *getSurface(int surfaceNum) const = 0; virtual void proc9() = 0; virtual void proc10() = 0; - virtual void proc11() = 0; + + /** + * Blits a surface onto one of the screen surfaces + */ + virtual void blitFrom(int surfaceNum, CVideoSurface *src, const Point *destPos = nullptr, + const Rect *srcRect = nullptr) = 0; + virtual void proc12() = 0; virtual void proc13() = 0; virtual void proc14() = 0; @@ -160,7 +166,13 @@ public: virtual CVideoSurface *getSurface(int surfaceNum) const; virtual void proc9(); virtual void proc10(); - virtual void proc11(); + + /** + * Blits a surface onto one of the screen surfaces + */ + virtual void blitFrom(int surfaceNum, CVideoSurface *src, const Point *destPos, + const Rect *srcRect = nullptr); + virtual void proc12(); virtual void proc13(); virtual void proc14(); diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index f29e776791..3c31731346 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -50,12 +50,14 @@ TitanicEngine::TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDe _debugger = nullptr; _events = nullptr; _window = nullptr; + _screen = nullptr; _screenManager = nullptr; } TitanicEngine::~TitanicEngine() { delete _debugger; delete _events; + delete _screen; delete _window; delete _screenManager; CSaveableObject::freeClassList(); @@ -85,6 +87,7 @@ void TitanicEngine::initialize() { _debugger = new Debugger(this); _events = new Events(this); + _screen = new Graphics::Screen(); _screenManager = new OSScreenManager(this); _window = new CMainGameWindow(this); _window->applicationStarting(); diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index 8ed353f413..94ba316836 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -29,6 +29,7 @@ #include "common/serializer.h" #include "engines/advancedDetector.h" #include "engines/engine.h" +#include "graphics/screen.h" #include "titanic/debugger.h" #include "titanic/events.h" #include "titanic/files_manager.h" @@ -96,6 +97,7 @@ public: CFilesManager _filesManager; Debugger *_debugger; Events *_events; + Graphics::Screen *_screen; OSScreenManager *_screenManager; CMainGameWindow *_window; Common::RandomSource _randomSource; diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp index 17e8f0ab46..ab5bf7d39c 100644 --- a/engines/titanic/video_surface.cpp +++ b/engines/titanic/video_surface.cpp @@ -29,8 +29,8 @@ namespace Titanic { int CVideoSurface::_videoSurfaceCounter = 0; CVideoSurface::CVideoSurface(CScreenManager *screenManager) : - _screenManager(screenManager), _rawSurface(nullptr), - _field34(nullptr), _pendingLoad(false), _blitFlag(false), + _screenManager(screenManager), _rawSurface(nullptr), _field34(nullptr), + _pendingLoad(false), _blitStyleFlag(false), _blitFlag(false), _field40(0), _field44(4), _field48(0), _field50(1) { _videoSurfaceNum = _videoSurfaceCounter++; } @@ -46,14 +46,20 @@ void CVideoSurface::setSurface(CScreenManager *screenManager, DirectDrawSurface _ddSurface = surface; } -void CVideoSurface::blitFrom(const Rect &srcRect, const Rect &destRect, CVideoSurface *srcSurface) { - // TODO: Cases when _blitFlag is false - assert(_blitFlag); - error("TODO"); +void CVideoSurface::blitFrom(const Point &destPos, CVideoSurface *src, const Rect *srcRect) { + if (loadIfReady() && src->loadIfReady() && _ddSurface && src->_ddSurface) { + Rect srcBounds, destBounds; + clipBounds(srcBounds, destBounds, src, srcRect, &destPos); + + if (_blitStyleFlag) + blitRect2(srcBounds, destBounds, src); + else + blitRect1(srcBounds, destBounds, src); + } } void CVideoSurface::clipBounds(Rect &srcRect, Rect &destRect, - CVideoSurface *srcSurface, Rect *subRect, Point *pt) { + CVideoSurface *srcSurface, const Rect *subRect, const Point *pt) { if (pt) { srcRect.left = pt->x; srcRect.top = pt->y; @@ -113,6 +119,21 @@ void CVideoSurface::clipBounds(Rect &srcRect, Rect &destRect, error("Invalid rect"); } +void CVideoSurface::blitRect1(const Rect &srcRect, const Rect &destRect, CVideoSurface *src) { + src->lock(); + lock(); + + // TODO: Do it like the original does it + this->_rawSurface->blitFrom(*src->_rawSurface, srcRect, Point(destRect.left, destRect.top)); + + src->unlock(); + unlock(); +} + +void CVideoSurface::blitRect2(const Rect &srcRect, const Rect &destRect, CVideoSurface *src) { + // TODO: Do it like the original does it + blitRect1(srcRect, destRect, src); +} /*------------------------------------------------------------------------*/ diff --git a/engines/titanic/video_surface.h b/engines/titanic/video_surface.h index 3538b1dd89..39431f1fae 100644 --- a/engines/titanic/video_surface.h +++ b/engines/titanic/video_surface.h @@ -44,8 +44,11 @@ private: /** * Calculates blitting bounds */ - void clipBounds(Rect &destRect, Rect &srcRect, - CVideoSurface *srcSurface, Rect *bounds2, Point *pt); + void clipBounds(Rect &srcRect, Rect &destRect, + CVideoSurface *srcSurface, const Rect *subRect, const Point *pt); + + void blitRect1(const Rect &srcRect, const Rect &destRect, CVideoSurface *src); + void blitRect2(const Rect &srcRect, const Rect &destRect, CVideoSurface *src); protected: static int _videoSurfaceCounter; protected: @@ -63,6 +66,7 @@ protected: int _lockCount; public: bool _blitFlag; + bool _blitStyleFlag; public: CVideoSurface(CScreenManager *screenManager); virtual ~CVideoSurface(); @@ -152,7 +156,7 @@ public: /** * Blit from another surface */ - void blitFrom(const Rect &srcRect, const Rect &destRect, CVideoSurface *srcSurface); + void blitFrom(const Point &destPos, CVideoSurface *src, const Rect *srcRect = nullptr); }; class OSVideoSurface : public CVideoSurface { -- cgit v1.2.3 From 6a118677ed76a9a4dc1f4eb38c19b99e1b3a2e60 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 21 Mar 2016 22:05:08 -0400 Subject: TITANIC: Fix initialization of screen manager surfaces --- engines/titanic/direct_draw.cpp | 2 +- engines/titanic/screen_manager.cpp | 5 +++-- engines/titanic/video_surface.cpp | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/engines/titanic/direct_draw.cpp b/engines/titanic/direct_draw.cpp index 79ca968f8d..1c19911068 100644 --- a/engines/titanic/direct_draw.cpp +++ b/engines/titanic/direct_draw.cpp @@ -93,7 +93,7 @@ void DirectDrawManager::initFullScreen() { _directDraw._bpp, 0); _mainSurface = new DirectDrawSurface(); - _mainSurface->create(_directDraw._width, _directDraw._height); + _mainSurface->create(g_vm->_screen); _backSurfaces[0] = new DirectDrawSurface(); _backSurfaces[0]->create(_directDraw._width, _directDraw._height); } diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp index 4f9fbc2215..4d37b4578b 100644 --- a/engines/titanic/screen_manager.cpp +++ b/engines/titanic/screen_manager.cpp @@ -90,9 +90,10 @@ void OSScreenManager::setMode(int width, int height, int bpp, uint numBackSurfac _frontRenderSurface = new OSVideoSurface(this, nullptr); _frontRenderSurface->setSurface(this, _directDrawManager._mainSurface); + _backSurfaces.resize(numBackSurfaces); for (uint idx = 0; idx < numBackSurfaces; ++idx) { - OSVideoSurface videoSurface(this, nullptr); - videoSurface.setSurface(this, _directDrawManager._backSurfaces[idx]); + _backSurfaces[idx]._surface = new OSVideoSurface(this, nullptr); + _backSurfaces[idx]._surface->setSurface(this, _directDrawManager._backSurfaces[idx]); } // Load fonts diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp index ab5bf7d39c..e833e1c1c7 100644 --- a/engines/titanic/video_surface.cpp +++ b/engines/titanic/video_surface.cpp @@ -124,8 +124,9 @@ void CVideoSurface::blitRect1(const Rect &srcRect, const Rect &destRect, CVideoS lock(); // TODO: Do it like the original does it - this->_rawSurface->blitFrom(*src->_rawSurface, srcRect, Point(destRect.left, destRect.top)); - +// this->_rawSurface->blitFrom(*src->_rawSurface, srcRect, Point(destRect.left, destRect.top)); + this->_rawSurface->blitFrom(*src->_rawSurface); + src->unlock(); unlock(); } -- cgit v1.2.3 From b7746eff425dde0fac89684281541a609ca8e294 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 21 Mar 2016 22:44:55 -0400 Subject: TITANIC: Implement method for rendering view contents --- engines/titanic/core/game_object.cpp | 4 ++++ engines/titanic/core/game_object.h | 5 +++++ engines/titanic/core/node_item.cpp | 10 +++++----- engines/titanic/core/node_item.h | 4 +--- engines/titanic/core/room_item.cpp | 12 ++++++++++++ engines/titanic/core/room_item.h | 5 +++++ engines/titanic/core/tree_item.h | 6 ++++++ engines/titanic/main_game_window.cpp | 25 +++++++++++++++++++++++++ 8 files changed, 63 insertions(+), 8 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 06f2ce78af..db1e9ef3d6 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -127,4 +127,8 @@ bool CGameObject::checkPoint(const Point &pt, int v0, int v1) { return false; } +void CGameObject::draw(CScreenManager *screenManager) { + warning("TODO: CGameObject::draw"); +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 809f7b8d20..675339e926 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -73,6 +73,11 @@ public: */ virtual void load(SimpleFile *file); + /** + * Allows the item to draw itself + */ + virtual void draw(CScreenManager *screenManager); + void fn2(); bool checkPoint(const Point &pt, int v0, int v1); diff --git a/engines/titanic/core/node_item.cpp b/engines/titanic/core/node_item.cpp index 22c9b9b37f..6b7d6452cb 100644 --- a/engines/titanic/core/node_item.cpp +++ b/engines/titanic/core/node_item.cpp @@ -24,14 +24,14 @@ namespace Titanic { -CNodeItem::CNodeItem() : CNamedItem(), _field24(0), _field28(0), _nodeNumber(0) { +CNodeItem::CNodeItem() : CNamedItem(), _nodeNumber(0) { } void CNodeItem::save(SimpleFile *file, int indent) const { file->writeNumberLine(0, indent); file->writeQuotedLine("N", indent); - file->writeNumberLine(_field24, indent + 1); - file->writeNumberLine(_field28, indent + 1); + file->writeNumberLine(_nodePos.x, indent + 1); + file->writeNumberLine(_nodePos.y, indent + 1); file->writeQuotedLine("N", indent); file->writeNumberLine(_nodeNumber, indent + 1); @@ -42,8 +42,8 @@ void CNodeItem::save(SimpleFile *file, int indent) const { void CNodeItem::load(SimpleFile *file) { file->readNumber(); file->readBuffer(); - _field24 = file->readNumber(); - _field28 = file->readNumber(); + _nodePos.x = file->readNumber(); + _nodePos.y = file->readNumber(); file->readBuffer(); _nodeNumber = file->readNumber(); diff --git a/engines/titanic/core/node_item.h b/engines/titanic/core/node_item.h index 4f0391ae88..32db1c1401 100644 --- a/engines/titanic/core/node_item.h +++ b/engines/titanic/core/node_item.h @@ -28,11 +28,9 @@ namespace Titanic { class CNodeItem : public CNamedItem { -protected: - int _field24; - int _field28; public: int _nodeNumber; + Point _nodePos; public: CLASSDEF CNodeItem(); diff --git a/engines/titanic/core/room_item.cpp b/engines/titanic/core/room_item.cpp index b0cefcaf74..7a6dfd968a 100644 --- a/engines/titanic/core/room_item.cpp +++ b/engines/titanic/core/room_item.cpp @@ -103,4 +103,16 @@ void CRoomItem::loading() { // TODO } +void CRoomItem::calcNodePosition(const Point &nodePos, double &xVal, double &yVal) const { + xVal = yVal = 0.0; + + if (_roomDimensionX >= 0.0 && _roomDimensionY >= 0.0) { + xVal = _roomRect.width() / _roomDimensionX; + yVal = _roomRect.height() / _roomDimensionY; + + xVal = (nodePos.x - _roomRect.left) / xVal; + yVal = (nodePos.y - _roomRect.top) / yVal; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/core/room_item.h b/engines/titanic/core/room_item.h index 7248b4aac3..9e7f553407 100644 --- a/engines/titanic/core/room_item.h +++ b/engines/titanic/core/room_item.h @@ -59,6 +59,11 @@ public: * Return a movie clip for the room by name */ CMovieClip *findClip(const CString &name) { return _clipList.findByName(name); } + + /** + * Calculates the positioning of a node within the overall room + */ + void calcNodePosition(const Point &nodePos, double &xVal, double &yVal) const; }; } // End of namespace Titanic diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index 5669784cd7..e870ad1dc3 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -31,6 +31,7 @@ class CGameManager; class CDontSaveFileItem; class CNamedItem; class CProjectItem; +class CScreenManager; class CTreeItem: public CMessageTarget { private: @@ -119,6 +120,11 @@ public: */ virtual int compareTo(const CString &name, int maxLen) const { return false; } + /** + * Allows the item to draw itself + */ + virtual void draw(CScreenManager *screenManager) {} + /** * Gets the bounds occupied by the item */ diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 839c2fc684..6fa240dcec 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -157,7 +157,32 @@ void CMainGameWindow::drawView() { } void CMainGameWindow::drawViewContents(CScreenManager *screenManager) { + // Get a reference to the reference, validating that it's present + if (!screenManager) + return; + CViewItem *view = _gameManager->getView(); + if (!view) + return; + CNodeItem *node = view->findNode(); + if (!node) + return; + CRoomItem *room = node->findRoom(); + if (!room) + return; + + double xVal = 0.0, yVal = 0.0; + room->calcNodePosition(node->_nodePos, xVal, yVal); + + // Iterate through drawing all the items in the scene except any item + // that's currently being dragged + for (CTreeItem *treeItem = view; treeItem; treeItem = treeItem->scan(view)) { + if (treeItem != _gameManager->_dragItem) + treeItem->draw(screenManager); + } + // Finally draw the drag item if there is one + if (_gameManager->_dragItem) + _gameManager->_dragItem->draw(screenManager); } void CMainGameWindow::mouseChanged() { -- cgit v1.2.3 From 5cec3b3bd80f6f6ac601ba81175316f6e0d145e2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 22 Mar 2016 07:44:45 -0400 Subject: TITANIC: Implement object image loading and drawing --- engines/titanic/core/game_object.cpp | 129 +++++++++++++++++++++++++++++++++-- engines/titanic/core/game_object.h | 42 +++++++++++- engines/titanic/core/resource_key.h | 2 + engines/titanic/files_manager.cpp | 4 ++ engines/titanic/files_manager.h | 2 + engines/titanic/game_manager.cpp | 7 ++ engines/titanic/game_manager.h | 6 ++ 7 files changed, 182 insertions(+), 10 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index db1e9ef3d6..acd34decfc 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -20,11 +20,18 @@ * */ +#include "titanic/files_manager.h" +#include "titanic/game_manager.h" +#include "titanic/screen_manager.h" +#include "titanic/titanic.h" +#include "titanic/video_surface.h" #include "titanic/core/game_object.h" #include "titanic/core/resource_key.h" namespace Titanic { +void *CGameObject::_v1 = nullptr; + CGameObject::CGameObject(): CNamedItem() { _bounds = Rect(0, 0, 15, 15); _field34 = 0; @@ -41,14 +48,14 @@ CGameObject::CGameObject(): CNamedItem() { _field60 = 0; _cursorId = 1; _field78 = 0; - _field8C = -1; + _frameNumber = -1; _field90 = 0; _field94 = 0; _field98 = 0; _field9C = 0; _fieldA0 = 0; _fieldA4 = 0; - _fieldA8 = nullptr; + _surface = nullptr; _fieldB8 = 0; } @@ -66,7 +73,7 @@ void CGameObject::load(SimpleFile *file) { switch (val) { case 7: _clipList2.load(file); - _field8C = file->readNumber(); + _frameNumber = file->readNumber(); // Deliberate fall-through case 6: @@ -86,7 +93,7 @@ void CGameObject::load(SimpleFile *file) { // Deliberate fall-through case 2: - _string = file->readString(); + _resource = file->readString(); // Deliberate fall-through case 1: @@ -104,10 +111,10 @@ void CGameObject::load(SimpleFile *file) { _field58 = file->readNumber(); resourceKey.load(file); - _fieldA8 = nullptr; + _surface = nullptr; val = file->readNumber(); if (val) { - _string = resourceKey.getString(); + _resource = resourceKey.getString(); } break; @@ -128,7 +135,115 @@ bool CGameObject::checkPoint(const Point &pt, int v0, int v1) { } void CGameObject::draw(CScreenManager *screenManager) { - warning("TODO: CGameObject::draw"); + if (!_field5C) + return; + if (_v1) { + error("TODO: Block in CGameObject::draw"); + } + + if (_field40) { + if (_field90) { + if (_bounds.intersects(getGameManager()->_bounds)) + warning("TODO: _field90(screenManager);"); + } + } else { + if (!_surface) { + if (!_resource.empty()) { + loadResource(_resource); + _resource = ""; + } + } + + if (_surface) { + _bounds.right = _surface->getWidth(); + _bounds.bottom = _surface->getHeight(); + + if (!_bounds.right || !_bounds.bottom) + return; + + if (_frameNumber >= 0) { + loadFrame(_frameNumber); + _frameNumber = -1; + } + + if (!_clipList2.empty()) + processClipList2(); + + if (_bounds.intersects(getGameManager()->_bounds)) { + if (_surface) { + Point destPos(_bounds.left, _bounds.top); + screenManager->blitFrom(0, _surface, &destPos); + } + + if (_field90) + warning("TODO: sub_415f80(screenManager);"); + } + } + } +} + +void CGameObject::loadResource(const CString &name) { + switch (name.imageTypeSuffix()) { + case FILETYPE_IMAGE: + loadImage(name); + break; + case FILETYPE_MOVIE: + loadMovie(name); + break; + } +} + +void CGameObject::loadMovie(const CString &name, bool pendingFlag) { + warning("TODO: CGameObject::loadMovie"); +} + +void CGameObject::loadImage(const CString &name, bool pendingFlag) { + // Get a refernce to the game and screen managers + CGameManager *gameManager = getGameManager(); + CScreenManager *screenManager; + + if (gameManager && (screenManager = CScreenManager::setCurrent()) != nullptr) { + // Destroy the object's surface if it already had one + if (_surface) { + delete _surface; + _surface = nullptr; + } + + g_vm->_filesManager.fn5(name); + + if (!name.empty()) { + _surface = new OSVideoSurface(screenManager, CResourceKey(name), pendingFlag); + } + + if (_surface && !pendingFlag) { + _bounds.right = _surface->getWidth(); + _bounds.bottom = _surface->getHeight(); + } + + // Mark the object's area as dirty, so that on the next frame rendering + // this object will be redrawn + makeDirty(); + } + + _field78 = 0; +} + +void CGameObject::loadFrame(int frameNumber) { + warning("CGameObject::loadFrame"); +} + +void CGameObject::processClipList2() { + warning("CGameObject::processClipList2"); +} + +void CGameObject::makeDirty(const Rect &r) { + CGameManager *gameManager = getGameManager(); + if (gameManager) + gameManager->extendBounds(r); +} + +void CGameObject::makeDirty() { + makeDirty(_bounds); } } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 675339e926..b327671b6b 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -29,7 +29,43 @@ namespace Titanic { +class CVideoSurface; + class CGameObject : public CNamedItem { +public: + static void *_v1; +private: + /** + * Load a visual resource for the object + */ + void loadResource(const CString &name); + + /** + * Loads a movie + */ + void loadMovie(const CString &name, bool pendingFlag = true); + + /** + * Loads an image + */ + void loadImage(const CString &name, bool pendingFlag = true); + + /** + * Loads a frame + */ + void loadFrame(int frameNumber); + + void processClipList2(); + + /** + * Marks the area in the passed rect as dirty, and requiring re-rendering + */ + void makeDirty(const Rect &r); + + /** + * Marks the area occupied by the object as dirty, requiring re-rendering + */ + void makeDirty(); protected: Rect _bounds; double _field34; @@ -46,15 +82,15 @@ protected: CMovieClipList _clipList1; int _field78; CMovieClipList _clipList2; - int _field8C; + int _frameNumber; int _field90; int _field94; int _field98; int _field9C; int _fieldA0; int _fieldA4; - void *_fieldA8; - CString _string; + CVideoSurface *_surface; + CString _resource; int _fieldB8; public: int _field60; diff --git a/engines/titanic/core/resource_key.h b/engines/titanic/core/resource_key.h index dc4c791cea..ab49cb8b12 100644 --- a/engines/titanic/core/resource_key.h +++ b/engines/titanic/core/resource_key.h @@ -36,6 +36,8 @@ private: void setValue(const CString &name); public: CLASSDEF + CResourceKey() {} + CResourceKey(const CString &name) { setValue(name); } /** * Save the data for the class to file diff --git a/engines/titanic/files_manager.cpp b/engines/titanic/files_manager.cpp index 7ff0b51af8..f56c9c5e45 100644 --- a/engines/titanic/files_manager.cpp +++ b/engines/titanic/files_manager.cpp @@ -81,4 +81,8 @@ void CFilesManager::resetView() { } } +void CFilesManager::fn5(const CString &name) { + warning("TODO: CFilesManager::fn5"); +} + } // End of namespace Titanic diff --git a/engines/titanic/files_manager.h b/engines/titanic/files_manager.h index ab92151055..0785bfc3c0 100644 --- a/engines/titanic/files_manager.h +++ b/engines/titanic/files_manager.h @@ -76,6 +76,8 @@ public: * Resets the view being displayed */ void resetView(); + + void fn5(const CString &name); }; } // End of namespace Titanic diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index a80e871e49..a3c241c1dc 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -235,4 +235,11 @@ void CGameManager::frameMessage(CRoomItem *room) { } } +void CGameManager::extendBounds(const Rect &r) { + if (_bounds.isEmpty()) + _bounds = r; + else + _bounds.combine1(r); +} + } // End of namespace Titanic diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index 51e1c3dd8f..610c438cfa 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -192,6 +192,12 @@ public: void inc54() { ++_field54; } void dec54() { --_field54; } + + /** + * Extends the bounds of the currently affected game display area + * to include the passed rect + */ + void extendBounds(const Rect &r); }; } // End of namespace Titanic -- cgit v1.2.3 From 46e554b981fce68e62e1573881fce1a0fcfed806 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 21 Mar 2016 20:12:10 -0400 Subject: GRAPHICS: Set parameterless Screen constructor to use screen format --- graphics/screen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphics/screen.cpp b/graphics/screen.cpp index 4169c98035..ccf651f536 100644 --- a/graphics/screen.cpp +++ b/graphics/screen.cpp @@ -28,7 +28,7 @@ namespace Graphics { Screen::Screen(): ManagedSurface() { - create(g_system->getWidth(), g_system->getHeight()); + create(g_system->getWidth(), g_system->getHeight(), g_system->getScreenFormat()); } Screen::Screen(int width, int height): ManagedSurface() { -- cgit v1.2.3 From 06bd62fed403684afe00c018647cb4febeeddcce Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 22 Mar 2016 21:54:26 -0400 Subject: TITANIC: First scene starting to be displayed --- engines/titanic/core/game_object.cpp | 2 +- engines/titanic/direct_draw_surface.cpp | 1 + engines/titanic/game_manager.cpp | 2 +- engines/titanic/game_view.cpp | 4 ++-- engines/titanic/main_game_window.cpp | 6 +++--- engines/titanic/screen_manager.cpp | 11 +++++++---- engines/titanic/screen_manager.h | 24 +++++++++++++++++------- engines/titanic/titanic.cpp | 2 +- 8 files changed, 33 insertions(+), 19 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index acd34decfc..8f2b333990 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -172,7 +172,7 @@ void CGameObject::draw(CScreenManager *screenManager) { if (_bounds.intersects(getGameManager()->_bounds)) { if (_surface) { Point destPos(_bounds.left, _bounds.top); - screenManager->blitFrom(0, _surface, &destPos); + screenManager->blitFrom(SURFACE_BACKBUFFER, _surface, &destPos); } if (_field90) diff --git a/engines/titanic/direct_draw_surface.cpp b/engines/titanic/direct_draw_surface.cpp index 4e7311a6a7..b432245333 100644 --- a/engines/titanic/direct_draw_surface.cpp +++ b/engines/titanic/direct_draw_surface.cpp @@ -64,6 +64,7 @@ void DirectDrawSurface::unlock() { void DirectDrawSurface::fill(const Rect *bounds, uint32 color) { Rect tempBounds; + assert(_surface); if (bounds) { // Bounds are provided, clip them to the bounds of this surface tempBounds = *bounds; diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index a3c241c1dc..d0c1ad5f8a 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -179,7 +179,7 @@ void CGameManager::update() { _bounds.extend(textCursor->getBounds()); // Set the surface bounds - screenManager->setSurfaceBounds(0, _bounds); + screenManager->setSurfaceBounds(SURFACE_BACKBUFFER, _bounds); // Handle redrawing the view if (!_bounds.isEmpty()) { diff --git a/engines/titanic/game_view.cpp b/engines/titanic/game_view.cpp index d780b8b38e..e93e8f0768 100644 --- a/engines/titanic/game_view.cpp +++ b/engines/titanic/game_view.cpp @@ -67,8 +67,8 @@ void CGameView::drawView() { srcRect.translate(-20, -10); Common::Point destPos(srcRect.left, srcRect.top); - CScreenManager::_currentScreenManagerPtr->blitFrom(0, _surface, - &destPos, &srcRect); + CScreenManager::_currentScreenManagerPtr->blitFrom(SURFACE_BACKBUFFER, + _surface, &destPos, &srcRect); } /*------------------------------------------------------------------------*/ diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 6fa240dcec..e1efae84df 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -55,7 +55,7 @@ void CMainGameWindow::applicationStarting() { // Set the video mode CScreenManager *screenManager = CScreenManager::setCurrent(); - screenManager->setMode(640, 480, 16, 1, true); + screenManager->setMode(640, 480, 16, 0, true); // TODO: Remove initial background and palette @@ -120,7 +120,7 @@ void CMainGameWindow::draw() { } CScreenManager *scrManager = CScreenManager::setCurrent(); - scrManager->clearSurface(0, &_gameManager->_bounds); + scrManager->clearSurface(SURFACE_BACKBUFFER, &_gameManager->_bounds); switch (_gameManager->_gameState._mode) { case GSMODE_1: @@ -129,7 +129,7 @@ void CMainGameWindow::draw() { drawPet(scrManager); drawView(); - drawViewContents(scrManager); +// drawViewContents(scrManager); scrManager->drawCursors(); break; diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp index 4d37b4578b..f13ecdd8fc 100644 --- a/engines/titanic/screen_manager.cpp +++ b/engines/titanic/screen_manager.cpp @@ -21,6 +21,7 @@ */ #include "titanic/screen_manager.h" +#include "titanic/titanic.h" #include "titanic/video_surface.h" namespace Titanic { @@ -62,7 +63,7 @@ CScreenManager *CScreenManager::setCurrent() { return _currentScreenManagerPtr; } -void CScreenManager::setSurfaceBounds(int surfaceNum, const Rect &r) { +void CScreenManager::setSurfaceBounds(SurfaceNum surfaceNum, const Rect &r) { if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) _backSurfaces[surfaceNum]._bounds = r; } @@ -84,9 +85,11 @@ OSScreenManager::~OSScreenManager() { } void OSScreenManager::setMode(int width, int height, int bpp, uint numBackSurfaces, bool flag2) { + assert(bpp == 16); destroyFrontAndBackBuffers(); _directDrawManager.initVideo(width, height, bpp, numBackSurfaces); + _vm->_screen->create(width, height, g_system->getScreenFormat()); _frontRenderSurface = new OSVideoSurface(this, nullptr); _frontRenderSurface->setSurface(this, _directDrawManager._mainSurface); @@ -113,7 +116,7 @@ void OSScreenManager::drawCursors() { void OSScreenManager::proc6() {} void OSScreenManager::proc7() {} -CVideoSurface *OSScreenManager::getSurface(int surfaceNum) const { +CVideoSurface *OSScreenManager::getSurface(SurfaceNum surfaceNum) const { if (surfaceNum == -1) return _frontRenderSurface; else if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) @@ -125,7 +128,7 @@ CVideoSurface *OSScreenManager::getSurface(int surfaceNum) const { void OSScreenManager::proc9() {} void OSScreenManager::proc10() {} -void OSScreenManager::blitFrom(int surfaceNum, CVideoSurface *src, +void OSScreenManager::blitFrom(SurfaceNum surfaceNum, CVideoSurface *src, const Point *destPos, const Rect *srcRect) { // Get the dest surface CVideoSurface *destSurface = _frontRenderSurface; @@ -172,7 +175,7 @@ void OSScreenManager::getFont() {} void OSScreenManager::proc18() {} void OSScreenManager::proc19() {} -void OSScreenManager::clearSurface(int surfaceNum, Rect *bounds) { +void OSScreenManager::clearSurface(SurfaceNum surfaceNum, Rect *bounds) { if (surfaceNum == -1) _directDrawManager._mainSurface->fill(bounds, 0); else if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) diff --git a/engines/titanic/screen_manager.h b/engines/titanic/screen_manager.h index dc5a04236f..1b926fc3c6 100644 --- a/engines/titanic/screen_manager.h +++ b/engines/titanic/screen_manager.h @@ -35,6 +35,16 @@ namespace Titanic { +/** + * The original used page flipping with one primary and one back buffer. + * Since we don't need that in ScummVM, the back buffer number below is + * remapped to the primary surface + */ +enum SurfaceNum { + SURFACE_PRIMARY = -1, + SURFACE_BACKBUFFER = -1 +}; + class TitanicEngine; class CScreenManager { @@ -81,14 +91,14 @@ public: virtual void proc6() = 0; virtual void proc7() = 0; - virtual CVideoSurface *getSurface(int surfaceNum) const = 0; + virtual CVideoSurface *getSurface(SurfaceNum surfaceNum) const = 0; virtual void proc9() = 0; virtual void proc10() = 0; /** * Blits a surface onto one of the screen surfaces */ - virtual void blitFrom(int surfaceNum, CVideoSurface *src, const Point *destPos = nullptr, + virtual void blitFrom(SurfaceNum surfaceNum, CVideoSurface *src, const Point *destPos = nullptr, const Rect *srcRect = nullptr) = 0; virtual void proc12() = 0; @@ -103,7 +113,7 @@ public: /** * Clear a portion of a specified surface */ - virtual void clearSurface(int surfaceNum, Rect *_bounds) = 0; + virtual void clearSurface(SurfaceNum surfaceNum, Rect *_bounds) = 0; /** * Resize the passed surface @@ -125,7 +135,7 @@ public: virtual void showCursor() = 0; virtual void hideCursor() = 0; - void setSurfaceBounds(int surfaceNum, const Rect &r); + void setSurfaceBounds(SurfaceNum surfaceNum, const Rect &r); }; class OSScreenManager: CScreenManager { @@ -163,14 +173,14 @@ public: virtual void proc6(); virtual void proc7(); - virtual CVideoSurface *getSurface(int surfaceNum) const; + virtual CVideoSurface *getSurface(SurfaceNum surfaceNum) const; virtual void proc9(); virtual void proc10(); /** * Blits a surface onto one of the screen surfaces */ - virtual void blitFrom(int surfaceNum, CVideoSurface *src, const Point *destPos, + virtual void blitFrom(SurfaceNum surfaceNum, CVideoSurface *src, const Point *destPos, const Rect *srcRect = nullptr); virtual void proc12(); @@ -185,7 +195,7 @@ public: /** * Clear a portion of the screen surface */ - virtual void clearSurface(int surfaceNum, Rect *bounds); + virtual void clearSurface(SurfaceNum surfaceNum, Rect *bounds); /** * Resize the passed surface diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index 3c31731346..4d43199184 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -87,7 +87,7 @@ void TitanicEngine::initialize() { _debugger = new Debugger(this); _events = new Events(this); - _screen = new Graphics::Screen(); + _screen = new Graphics::Screen(0, 0); _screenManager = new OSScreenManager(this); _window = new CMainGameWindow(this); _window->applicationStarting(); -- cgit v1.2.3 From bfcf006bbbec047c973f2008711e005ffb40acff Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 22 Mar 2016 22:36:49 -0400 Subject: TITANIC: Fixes for correct positioning of view background --- engines/titanic/game_manager.cpp | 2 +- engines/titanic/game_view.cpp | 9 ++++++--- engines/titanic/rect.cpp | 6 +++--- engines/titanic/rect.h | 6 +++--- engines/titanic/screen_manager.cpp | 2 +- engines/titanic/video_surface.cpp | 15 ++++++++------- engines/titanic/video_surface.h | 4 ++-- 7 files changed, 24 insertions(+), 20 deletions(-) diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index d0c1ad5f8a..23cb26e146 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -239,7 +239,7 @@ void CGameManager::extendBounds(const Rect &r) { if (_bounds.isEmpty()) _bounds = r; else - _bounds.combine1(r); + _bounds.combine(r); } } // End of namespace Titanic diff --git a/engines/titanic/game_view.cpp b/engines/titanic/game_view.cpp index e93e8f0768..22da0c46bf 100644 --- a/engines/titanic/game_view.cpp +++ b/engines/titanic/game_view.cpp @@ -27,6 +27,9 @@ namespace Titanic { +#define VIEW_OFFSET_X 20 +#define VIEW_OFFSET_Y 10 + CGameView::CGameView() : _gameManager(nullptr), _surface(nullptr) { } @@ -62,10 +65,10 @@ void CGameView::drawView() { Rect srcRect = _gameManager->_bounds; Rect rect2(0, 0, 600, 340); - rect2.translate(20, 10); - srcRect.combine2(rect2); - srcRect.translate(-20, -10); + rect2.translate(VIEW_OFFSET_X, VIEW_OFFSET_Y); + srcRect.constrain(rect2); Common::Point destPos(srcRect.left, srcRect.top); + srcRect.translate(-VIEW_OFFSET_X, -VIEW_OFFSET_Y); CScreenManager::_currentScreenManagerPtr->blitFrom(SURFACE_BACKBUFFER, _surface, &destPos, &srcRect); diff --git a/engines/titanic/rect.cpp b/engines/titanic/rect.cpp index 4642b3422c..228a2ae4d4 100644 --- a/engines/titanic/rect.cpp +++ b/engines/titanic/rect.cpp @@ -24,19 +24,19 @@ namespace Titanic { -void Rect::combine1(const Rect &r) { +void Rect::combine(const Rect &r) { if (isEmpty() || r.isEmpty()) return; Common::Rect::extend(r); } -void Rect::combine2(const Rect &r) { +void Rect::constrain(const Rect &r) { if (!isEmpty()) { if (r.isEmpty()) { clear(); } else { - Common::Rect::extend(r); + Common::Rect::clip(r); } } } diff --git a/engines/titanic/rect.h b/engines/titanic/rect.h index b70550a607..1661711870 100644 --- a/engines/titanic/rect.h +++ b/engines/titanic/rect.h @@ -48,12 +48,12 @@ public: /** * Combine another rect into this one */ - void combine1(const Rect &r); + void combine(const Rect &r); /** - * Combine another rect into this one + * Constrains/clips to the intersection area of the given rect */ - void combine2(const Rect &r); + void constrain(const Rect &r); }; } // End of namespace Titanic diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp index f13ecdd8fc..11063be2b6 100644 --- a/engines/titanic/screen_manager.cpp +++ b/engines/titanic/screen_manager.cpp @@ -149,7 +149,7 @@ void OSScreenManager::blitFrom(SurfaceNum surfaceNum, CVideoSurface *src, rect2 = srcBounds; rect2.translate(-srcBounds.left, -srcBounds.top); rect2.translate(destPoint.x, destPoint.y); - rect2.combine2(_backSurfaces[surfaceNum]._bounds); + rect2.constrain(_backSurfaces[surfaceNum]._bounds); rect2.translate(-destPoint.x, -destPoint.y); rect2.translate(srcBounds.left, srcBounds.top); diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp index e833e1c1c7..0b935292b1 100644 --- a/engines/titanic/video_surface.cpp +++ b/engines/titanic/video_surface.cpp @@ -59,12 +59,14 @@ void CVideoSurface::blitFrom(const Point &destPos, CVideoSurface *src, const Rec } void CVideoSurface::clipBounds(Rect &srcRect, Rect &destRect, - CVideoSurface *srcSurface, const Rect *subRect, const Point *pt) { - if (pt) { - srcRect.left = pt->x; - srcRect.top = pt->y; + CVideoSurface *srcSurface, const Rect *subRect, const Point *destPos) { + // Figure out initial source rect and dest rect, based on whether + // specific subRect and/or destPos have been passed + if (destPos) { + destRect.left = destPos->x; + destRect.top = destPos->y; } else { - srcRect.left = srcRect.top = 0; + destRect.left = destRect.top = 0; } if (subRect) { @@ -124,8 +126,7 @@ void CVideoSurface::blitRect1(const Rect &srcRect, const Rect &destRect, CVideoS lock(); // TODO: Do it like the original does it -// this->_rawSurface->blitFrom(*src->_rawSurface, srcRect, Point(destRect.left, destRect.top)); - this->_rawSurface->blitFrom(*src->_rawSurface); + _rawSurface->blitFrom(*src->_rawSurface, srcRect, Point(destRect.left, destRect.top)); src->unlock(); unlock(); diff --git a/engines/titanic/video_surface.h b/engines/titanic/video_surface.h index 39431f1fae..d89d3201c2 100644 --- a/engines/titanic/video_surface.h +++ b/engines/titanic/video_surface.h @@ -44,8 +44,8 @@ private: /** * Calculates blitting bounds */ - void clipBounds(Rect &srcRect, Rect &destRect, - CVideoSurface *srcSurface, const Rect *subRect, const Point *pt); + void clipBounds(Rect &srcRect, Rect &destRect, CVideoSurface *srcSurface, + const Rect *subRect = nullptr, const Point *destPos = nullptr); void blitRect1(const Rect &srcRect, const Rect &destRect, CVideoSurface *src); void blitRect2(const Rect &srcRect, const Rect &destRect, CVideoSurface *src); -- cgit v1.2.3 From 42208769f7ac199f2b436164795f5ea7ac03fed4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 22 Mar 2016 22:39:37 -0400 Subject: TITANIC: Enable drawing of view contents --- engines/titanic/main_game_window.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index e1efae84df..0b0bb92921 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -129,7 +129,7 @@ void CMainGameWindow::draw() { drawPet(scrManager); drawView(); -// drawViewContents(scrManager); + drawViewContents(scrManager); scrManager->drawCursors(); break; -- cgit v1.2.3 From 7d2d624908e9265be108d650a161a378add9d40d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 23 Mar 2016 20:51:42 -0400 Subject: TITANIC: More view event handling, beginnings of mouse cursor loading --- engines/titanic/core/game_object.cpp | 4 +- engines/titanic/core/game_object.h | 3 +- engines/titanic/core/link_item.cpp | 14 +++---- engines/titanic/core/link_item.h | 3 +- engines/titanic/core/saveable_object.cpp | 4 +- engines/titanic/core/view_item.cpp | 44 +++++++++++++++++++-- engines/titanic/core/view_item.h | 6 ++- engines/titanic/files_manager.cpp | 4 ++ engines/titanic/files_manager.h | 2 + engines/titanic/input_translator.cpp | 6 +-- engines/titanic/messages/messages.cpp | 2 +- engines/titanic/messages/mouse_messages.h | 14 +++---- engines/titanic/mouse_cursor.cpp | 65 ++++++++++++++++++++++++++++--- engines/titanic/mouse_cursor.h | 54 ++++++++++++++++++++++++- engines/titanic/movie.cpp | 64 ++++++++++++++++++++++++++++++ engines/titanic/movie.h | 41 +++++++++++++++++++ engines/titanic/screen_manager.cpp | 2 +- engines/titanic/video_surface.cpp | 2 +- engines/titanic/video_surface.h | 4 +- 19 files changed, 301 insertions(+), 37 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 8f2b333990..e4ad4ccaea 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -46,7 +46,7 @@ CGameObject::CGameObject(): CNamedItem() { _field58 = 0; _field5C = 1; _field60 = 0; - _cursorId = 1; + _cursorId = CURSOR_1; _field78 = 0; _frameNumber = -1; _field90 = 0; @@ -77,7 +77,7 @@ void CGameObject::load(SimpleFile *file) { // Deliberate fall-through case 6: - val = _cursorId = file->readNumber(); + _cursorId = (CursorId)file->readNumber(); // Deliberate fall-through case 5: diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index b327671b6b..66aa9c400c 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -23,6 +23,7 @@ #ifndef TITANIC_GAME_OBJECT_H #define TITANIC_GAME_OBJECT_H +#include "titanic/mouse_cursor.h" #include "titanic/rect.h" #include "titanic/core/movie_clip.h" #include "titanic/core/named_item.h" @@ -94,7 +95,7 @@ protected: int _fieldB8; public: int _field60; - int _cursorId; + CursorId _cursorId; public: CLASSDEF CGameObject(); diff --git a/engines/titanic/core/link_item.cpp b/engines/titanic/core/link_item.cpp index 02b4215cfa..5ca64b1c59 100644 --- a/engines/titanic/core/link_item.cpp +++ b/engines/titanic/core/link_item.cpp @@ -32,7 +32,7 @@ CLinkItem::CLinkItem() : CNamedItem() { _nodeNumber = -1; _viewNumber = -1; _field30 = 0; - _field34 = 1; + _cursorId = CURSOR_1; _name = "Link"; } @@ -44,7 +44,7 @@ CString CLinkItem::formName() { void CLinkItem::save(SimpleFile *file, int indent) const { file->writeNumberLine(2, indent); file->writeQuotedLine("L", indent); - file->writeNumberLine(_field34, indent + 1); + file->writeNumberLine(_cursorId, indent + 1); file->writeNumberLine(_field30, indent + 1); file->writeNumberLine(_roomNumber, indent + 1); file->writeNumberLine(_nodeNumber, indent + 1); @@ -65,7 +65,7 @@ void CLinkItem::load(SimpleFile *file) { switch (val) { case 2: - _field34 = file->readNumber(); + _cursorId = (CursorId)file->readNumber(); // Deliberate fall-through case 1: @@ -93,16 +93,16 @@ void CLinkItem::load(SimpleFile *file) { if (val < 2) { switch (_field30) { case 2: - _field34 = 2; + _cursorId = CURSOR_2; break; case 3: - _field34 = 3; + _cursorId = CURSOR_3; break; case 5: - _field34 = 7; + _cursorId = CURSOR_7; break; default: - _field34 = 4; + _cursorId = CURSOR_4; break; } } diff --git a/engines/titanic/core/link_item.h b/engines/titanic/core/link_item.h index bbeef2c11c..83b2ce4f06 100644 --- a/engines/titanic/core/link_item.h +++ b/engines/titanic/core/link_item.h @@ -23,6 +23,7 @@ #ifndef TITANIC_LINK_ITEM_H #define TITANIC_LINK_ITEM_H +#include "titanic/mouse_cursor.h" #include "titanic/core/named_item.h" #include "titanic/core/movie_clip.h" @@ -44,9 +45,9 @@ protected: int _nodeNumber; int _viewNumber; int _field30; - int _field34; public: Rect _bounds; + CursorId _cursorId; public: CLASSDEF CLinkItem(); diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 2c4eea5f3c..1f7448f655 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -818,7 +818,7 @@ DEFFN(CMouseMoveMsg) DEFFN(CMouseButtonMsg) DEFFN(CMouseButtonDownMsg) DEFFN(CMouseButtonUpMsg) -DEFFN(CMouseButtonDoubleClickMsg) +DEFFN(CMouseDoubleClickMsg) DEFFN(CMouseDragMsg) DEFFN(CMouseDragStartMsg) DEFFN(CMouseDragMoveMsg) @@ -1395,7 +1395,7 @@ void CSaveableObject::initClassList() { ADDFN(CMouseButtonMsg, CMouseMsg); ADDFN(CMouseButtonDownMsg, CMouseButtonMsg); ADDFN(CMouseButtonUpMsg, CMouseButtonMsg); - ADDFN(CMouseButtonDoubleClickMsg, CMouseButtonMsg); + ADDFN(CMouseDoubleClickMsg, CMouseButtonMsg); ADDFN(CMouseDragMsg, CMouseMsg); ADDFN(CMouseDragStartMsg, CMouseDragMsg); ADDFN(CMouseDragMoveMsg, CMouseDragMsg); diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index c48166698d..1b9a1dd1a6 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -180,7 +180,45 @@ bool CViewItem::handleEvent(CMouseButtonDownMsg &msg) { } } } - // TODO + } + + return true; +} + +bool CViewItem::handleEvent(CMouseButtonUpMsg &msg) { + if (msg._buttons & MB_LEFT) + handleMouseMsg(&msg, false); + + return true; +} + +bool CViewItem::handleEvent(CMouseDoubleClickMsg &msg) { + if (msg._buttons & MB_LEFT) + handleMouseMsg(&msg, false); + + return true; +} + +bool CViewItem::handleEvent(CMouseMoveMsg &msg) { + CScreenManager *screenManager = CScreenManager::_screenManagerPtr; + + if (handleMouseMsg(&msg, true)) { + screenManager->_mouseCursor->setCursor(CURSOR_1); + } else { + // Iterate through each link item, and if any is highlighted, + // change the mouse cursor to the designated cursor for the item + CLinkItem *linkItem = dynamic_cast(getFirstChild()); + while (linkItem) { + if (linkItem->_bounds.contains(msg._mousePos)) { + screenManager->_mouseCursor->setCursor(linkItem->_cursorId); + return true; + } + + linkItem = dynamic_cast(linkItem->getNextSibling()); + } + + if (!handleMouseMsg(&msg, false)) + screenManager->_mouseCursor->setCursor(CURSOR_1); } return true; @@ -212,8 +250,8 @@ bool CViewItem::handleMouseMsg(const CMouseMsg *msg, bool flag) { return false; for (int idx = (int)gameObjects.size() - 1; idx >= 0; ++idx) { - if (gameObjects[idx]->_cursorId != 12) { - CScreenManager::_screenManagerPtr->_mouseCursor->setCursorId(gameObjects[idx]->_cursorId); + if (gameObjects[idx]->_cursorId != CURSOR_12) { + CScreenManager::_screenManagerPtr->_mouseCursor->setCursor(gameObjects[idx]->_cursorId); break; } } diff --git a/engines/titanic/core/view_item.h b/engines/titanic/core/view_item.h index b1de0bb305..bc66122314 100644 --- a/engines/titanic/core/view_item.h +++ b/engines/titanic/core/view_item.h @@ -29,7 +29,8 @@ namespace Titanic { -class CViewItem : public CNamedItem { //, CMouseButtonDownMsgTarget { +class CViewItem : public CNamedItem, CMouseButtonDownMsgTarget, + CMouseButtonUpMsgTarget, CMouseMoveMsgTarget, CMouseDoubleClickMsgTarget { private: CTreeItem *_buttonUpTargets[4]; private: @@ -52,6 +53,9 @@ protected: int _field54; protected: virtual bool handleEvent(CMouseButtonDownMsg &msg); + virtual bool handleEvent(CMouseButtonUpMsg &msg); + virtual bool handleEvent(CMouseMoveMsg &msg); + virtual bool handleEvent(CMouseDoubleClickMsg &msg); public: int _viewNumber; public: diff --git a/engines/titanic/files_manager.cpp b/engines/titanic/files_manager.cpp index f56c9c5e45..5db75cd67c 100644 --- a/engines/titanic/files_manager.cpp +++ b/engines/titanic/files_manager.cpp @@ -81,6 +81,10 @@ void CFilesManager::resetView() { } } +void CFilesManager::fn4(const CString &name) { + warning("TODO: CFilesManager::fn4"); +} + void CFilesManager::fn5(const CString &name) { warning("TODO: CFilesManager::fn5"); } diff --git a/engines/titanic/files_manager.h b/engines/titanic/files_manager.h index 0785bfc3c0..74895d7877 100644 --- a/engines/titanic/files_manager.h +++ b/engines/titanic/files_manager.h @@ -77,6 +77,8 @@ public: */ void resetView(); + void fn4(const CString &name); + void fn5(const CString &name); }; diff --git a/engines/titanic/input_translator.cpp b/engines/titanic/input_translator.cpp index ceb2be87f6..2251c2fe7a 100644 --- a/engines/titanic/input_translator.cpp +++ b/engines/titanic/input_translator.cpp @@ -60,7 +60,7 @@ void CInputTranslator::leftButtonUp(int special, const Point &pt) { } void CInputTranslator::leftButtonDoubleClick(int special, const Point &pt) { - CMouseButtonDoubleClickMsg msg(pt, getButtons(special)); + CMouseDoubleClickMsg msg(pt, getButtons(special)); _inputHandler->handleMessage(msg); } @@ -75,7 +75,7 @@ void CInputTranslator::middleButtonUp(int special, const Point &pt) { } void CInputTranslator::middleButtonDoubleClick(int special, const Point &pt) { - CMouseButtonDoubleClickMsg msg(pt, getButtons(special)); + CMouseDoubleClickMsg msg(pt, getButtons(special)); _inputHandler->handleMessage(msg); } @@ -90,7 +90,7 @@ void CInputTranslator::rightButtonUp(int special, const Point &pt) { } void CInputTranslator::rightButtonDoubleClick(int special, const Point &pt) { - CMouseButtonDoubleClickMsg msg(pt, getButtons(special)); + CMouseDoubleClickMsg msg(pt, getButtons(special)); _inputHandler->handleMessage(msg); } diff --git a/engines/titanic/messages/messages.cpp b/engines/titanic/messages/messages.cpp index b44748d899..9202305353 100644 --- a/engines/titanic/messages/messages.cpp +++ b/engines/titanic/messages/messages.cpp @@ -84,7 +84,7 @@ bool CMessage::isMouseMoveMsg() const { } bool CMessage::isDoubleClickMsg() const { - return dynamic_cast(this) != nullptr; + return dynamic_cast(this) != nullptr; } bool CMessage::isEnterRoomMsg() const { diff --git a/engines/titanic/messages/mouse_messages.h b/engines/titanic/messages/mouse_messages.h index 77343fa6cd..6e2a74a046 100644 --- a/engines/titanic/messages/mouse_messages.h +++ b/engines/titanic/messages/mouse_messages.h @@ -108,19 +108,19 @@ public: } }; -MSGTARGET(CMouseButtonDoubleClickMsg); -class CMouseButtonDoubleClickMsg : public CMouseButtonMsg { +MSGTARGET(CMouseDoubleClickMsg); +class CMouseDoubleClickMsg : public CMouseButtonMsg { public: CLASSDEF - CMouseButtonDoubleClickMsg() : CMouseButtonMsg() {} - CMouseButtonDoubleClickMsg(const Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} + CMouseDoubleClickMsg() : CMouseButtonMsg() {} + CMouseDoubleClickMsg(const Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; + return dynamic_cast(item) != nullptr; } - virtual bool handleMessage(const CMouseButtonDoubleClickMsg &msg) { return false; } + virtual bool handleMessage(const CMouseDoubleClickMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { - CMouseButtonDoubleClickMsg *dest = dynamic_cast(treeItem); + CMouseDoubleClickMsg *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } }; diff --git a/engines/titanic/mouse_cursor.cpp b/engines/titanic/mouse_cursor.cpp index 578bf9981f..54c9ce8fbd 100644 --- a/engines/titanic/mouse_cursor.cpp +++ b/engines/titanic/mouse_cursor.cpp @@ -20,25 +20,80 @@ * */ +#include "graphics/cursorman.h" #include "common/textconsole.h" #include "titanic/mouse_cursor.h" +#include "titanic/movie.h" +#include "titanic/screen_manager.h" +#include "titanic/titanic.h" +#include "titanic/video_surface.h" +#include "titanic/core/resource_key.h" namespace Titanic { +static const int CURSOR_DATA[NUM_CURSORS][4] = { + { 1, 136, 19, 18 }, + { 2, 139, 1, 1 }, + { 3, 140, 32, 1 }, + { 4, 137, 13, 0 }, + { 5, 145, 13, 0 }, + { 6, 144, 13, 22 }, + { 7, 137, 14, 0 }, + { 8, 148, 22, 40 }, + { 9, 136, 19, 18 }, + { 10, 143, 11, 11 }, + { 11, 146, 11, 11 }, + { 12, 136, 19, 18 }, + { 13, 136, 19, 25 }, + { 14, 136, 13, 22 }, + { 15, 138, 20, 28 } +}; + +CMouseCursor::CMouseCursor(CScreenManager *screenManager) : + _screenManager(screenManager), _cursorId(CURSOR_1) { + loadCursorImages(); +} + +CMouseCursor::~CMouseCursor() { + for (int idx = 0; idx < NUM_CURSORS; ++idx) + delete _cursors[idx]._videoSurface; +} + +void CMouseCursor::loadCursorImages() { + const CString name("ycursors.avi"); + const CResourceKey key(name); + g_vm->_filesManager.fn4(name); + + // Iterate through each cursor + for (int idx = 0; idx < NUM_CURSORS; ++idx) { + assert(CURSOR_DATA[idx][0] == (idx + 1)); + _cursors[idx]._centroid = Common::Point(CURSOR_DATA[idx][2], + CURSOR_DATA[idx][3]); + + CVideoSurface *surface = _screenManager->createSurface(64, 64); + _cursors[idx]._videoSurface = surface; + + OSMovie movie(key, surface); + movie.setFrame(idx); + _cursors[idx]._ptrUnknown = movie.proc21(); + surface->set40(_cursors[idx]._ptrUnknown); + } +} + void CMouseCursor::show() { - warning("CMouseCursor::show"); + CursorMan.showMouse(true); } void CMouseCursor::hide() { - warning("CMouseCursor::hide"); + CursorMan.showMouse(false); } -void CMouseCursor::setCursorId(int id) { - warning("CMouseCursor::setCursorId"); +void CMouseCursor::setCursor(CursorId cursorId) { + warning("CMouseCursor::setCursor"); } void CMouseCursor::update() { - warning("CMouseCursor::update"); + // No implementation needed } } // End of namespace Titanic diff --git a/engines/titanic/mouse_cursor.h b/engines/titanic/mouse_cursor.h index c6df65d096..507f4ecc17 100644 --- a/engines/titanic/mouse_cursor.h +++ b/engines/titanic/mouse_cursor.h @@ -24,14 +24,66 @@ #define TITANIC_MOUSE_CURSOR_H #include "common/scummsys.h" +#include "common/rect.h" namespace Titanic { +#define NUM_CURSORS 15 + +enum CursorId { + CURSOR_1 = 1, + CURSOR_2 = 3, + CURSOR_3 = 3, + CURSOR_4 = 4, + CURSOR_5 = 5, + CURSOR_6 = 6, + CURSOR_7 = 7, + CURSOR_8 = 8, + CURSOR_9 = 9, + CURSOR_10 = 10, + CURSOR_11 = 11, + CURSOR_12 = 12, + CURSOR_13 = 13, + CURSOR_14 = 14, + CURSOR_15 = 15 +}; + +class CScreenManager; +class CVideoSurface; + class CMouseCursor { + struct CursorEntry { + CVideoSurface *_videoSurface; + void *_ptrUnknown; + Common::Point _centroid; + }; +private: + CScreenManager *_screenManager; + CursorId _cursorId; + CursorEntry _cursors[NUM_CURSORS]; + + /** + * Load the images for each cursor + */ + void loadCursorImages(); public: + CMouseCursor(CScreenManager *screenManager); + ~CMouseCursor(); + + /** + * Make the mouse cursor visible + */ void show(); + + /** + * Hide the mouse cursor + */ void hide(); - void setCursorId(int id); + + /** + * Set the cursor + */ + void setCursor(CursorId cursorId); /** * Updates the mouse cursor diff --git a/engines/titanic/movie.cpp b/engines/titanic/movie.cpp index 1eaeac638d..a41f0f4bc7 100644 --- a/engines/titanic/movie.cpp +++ b/engines/titanic/movie.cpp @@ -24,5 +24,69 @@ namespace Titanic { +OSMovie::OSMovie(const CResourceKey &name, CVideoSurface *surface) { + +} + +void OSMovie::proc8() { + warning("TODO: OSMovie::proc8"); +} + +void OSMovie::proc9() { + warning("TODO: OSMovie::proc9"); +} + +void OSMovie::proc10() { + warning("TODO: OSMovie::proc10"); +} + +void OSMovie::proc11() { + warning("TODO: OSMovie::proc11"); +} + +void OSMovie::proc12() { + warning("TODO: OSMovie::proc12"); +} + +void OSMovie::proc13() { + warning("TODO: OSMovie::proc13"); +} + +void OSMovie::proc14() { + warning("TODO: OSMovie::proc14"); +} + +void OSMovie::proc15() { + warning("TODO: OSMovie::proc15"); +} + +void OSMovie::proc16() { + warning("TODO: OSMovie::proc16"); +} + +void OSMovie::proc17() { + warning("TODO: OSMovie::proc17"); +} + +void OSMovie::proc18() { + warning("TODO: OSMovie::proc18"); +} + +void OSMovie::proc19() { + warning("TODO: OSMovie::proc19"); +} + +void OSMovie::proc20() { + warning("TODO: OSMovie::proc20"); +} + +void *OSMovie::proc21() { + warning("TODO: OSMovie::proc21"); + return nullptr; +} + +void OSMovie::setFrame(uint frameNumber) { + +} } // End of namespace Titanic diff --git a/engines/titanic/movie.h b/engines/titanic/movie.h index a213b7b891..1430e249e5 100644 --- a/engines/titanic/movie.h +++ b/engines/titanic/movie.h @@ -24,11 +24,52 @@ #define TITANIC_MOVIE_H #include "titanic/core/list.h" +#include "titanic/core/resource_key.h" +#include "titanic/video_surface.h" namespace Titanic { class CMovie : public ListItem { public: + virtual void proc8() = 0; + virtual void proc9() = 0; + virtual void proc10() = 0; + virtual void proc11() = 0; + virtual void proc12() = 0; + virtual void proc13() = 0; + virtual void proc14() = 0; + virtual void proc15() = 0; + virtual void proc16() = 0; + virtual void proc17() = 0; + virtual void proc18() = 0; + virtual void proc19() = 0; + virtual void proc20() = 0; + virtual void *proc21() = 0; +}; + +class OSMovie : public CMovie { +public: + OSMovie(const CResourceKey &name, CVideoSurface *surface); + + virtual void proc8(); + virtual void proc9(); + virtual void proc10(); + virtual void proc11(); + virtual void proc12(); + virtual void proc13(); + virtual void proc14(); + virtual void proc15(); + virtual void proc16(); + virtual void proc17(); + virtual void proc18(); + virtual void proc19(); + virtual void proc20(); + virtual void *proc21(); + + /** + * Set the current frame number + */ + void setFrame(uint frameNumber); }; } // End of namespace Titanic diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp index 11063be2b6..5e38eca2d8 100644 --- a/engines/titanic/screen_manager.cpp +++ b/engines/titanic/screen_manager.cpp @@ -222,7 +222,7 @@ void OSScreenManager::loadCursors() { hideCursor(); delete _mouseCursor; } - _mouseCursor = new CMouseCursor(); + _mouseCursor = new CMouseCursor(this); showCursor(); if (!_textCursor) { diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp index 0b935292b1..ef8d7a872f 100644 --- a/engines/titanic/video_surface.cpp +++ b/engines/titanic/video_surface.cpp @@ -31,7 +31,7 @@ int CVideoSurface::_videoSurfaceCounter = 0; CVideoSurface::CVideoSurface(CScreenManager *screenManager) : _screenManager(screenManager), _rawSurface(nullptr), _field34(nullptr), _pendingLoad(false), _blitStyleFlag(false), _blitFlag(false), - _field40(0), _field44(4), _field48(0), _field50(1) { + _field40(nullptr), _field44(4), _field48(0), _field50(1) { _videoSurfaceNum = _videoSurfaceCounter++; } diff --git a/engines/titanic/video_surface.h b/engines/titanic/video_surface.h index d89d3201c2..8d0b312ef0 100644 --- a/engines/titanic/video_surface.h +++ b/engines/titanic/video_surface.h @@ -58,7 +58,7 @@ protected: Graphics::ManagedSurface *_rawSurface; void *_field34; bool _pendingLoad; - int _field40; + void *_field40; int _field44; int _field48; int _videoSurfaceNum; @@ -157,6 +157,8 @@ public: * Blit from another surface */ void blitFrom(const Point &destPos, CVideoSurface *src, const Rect *srcRect = nullptr); + + void set40(void *v) { _field40 = v; } }; class OSVideoSurface : public CVideoSurface { -- cgit v1.2.3 From 2f532c086d5cd466a54763fc4fee14d0940e0abb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 23 Mar 2016 21:41:36 -0400 Subject: TITANIC: Unsuccessful initial attempt to load ycursors.avi file Unfortunately, whilst the cursors video plays fine in standard video players, the ScummVM AVIDecoder can't seem to handle it. So for now I've left the decode in place but commented out, and I'm setting up a dummy cursor --- engines/titanic/mouse_cursor.cpp | 18 ++++++++++++++++-- engines/titanic/movie.cpp | 11 ++++++++--- engines/titanic/movie.h | 4 ++++ engines/titanic/video_surface.cpp | 6 ++++++ engines/titanic/video_surface.h | 7 +++++++ 5 files changed, 41 insertions(+), 5 deletions(-) diff --git a/engines/titanic/mouse_cursor.cpp b/engines/titanic/mouse_cursor.cpp index 54c9ce8fbd..3acd871396 100644 --- a/engines/titanic/mouse_cursor.cpp +++ b/engines/titanic/mouse_cursor.cpp @@ -50,8 +50,9 @@ static const int CURSOR_DATA[NUM_CURSORS][4] = { }; CMouseCursor::CMouseCursor(CScreenManager *screenManager) : - _screenManager(screenManager), _cursorId(CURSOR_1) { + _screenManager(screenManager), _cursorId(CURSOR_15) { loadCursorImages(); + setCursor(CURSOR_1); } CMouseCursor::~CMouseCursor() { @@ -89,7 +90,20 @@ void CMouseCursor::hide() { } void CMouseCursor::setCursor(CursorId cursorId) { - warning("CMouseCursor::setCursor"); + if (cursorId != _cursorId) { + CursorEntry &ce = _cursors[cursorId - 1]; + CVideoSurface &surface = *ce._videoSurface; + surface.lock(); + + // ***DEBUG*** Dummy cursor + Common::fill(surface.getPixels(), surface.getPixels() + 128, 0x5555); + + CursorMan.replaceCursor(surface.getPixels(), surface.getWidth(), surface.getHeight(), + ce._centroid.x, ce._centroid.y, 0, false, &g_vm->_screen->format); + surface.unlock(); + + _cursorId = cursorId; + } } void CMouseCursor::update() { diff --git a/engines/titanic/movie.cpp b/engines/titanic/movie.cpp index a41f0f4bc7..d7a54d316d 100644 --- a/engines/titanic/movie.cpp +++ b/engines/titanic/movie.cpp @@ -24,8 +24,8 @@ namespace Titanic { -OSMovie::OSMovie(const CResourceKey &name, CVideoSurface *surface) { - +OSMovie::OSMovie(const CResourceKey &name, CVideoSurface *surface) : _videoSurface(surface) { +// _aviDecoder.loadFile(name.getString()); } void OSMovie::proc8() { @@ -86,7 +86,12 @@ void *OSMovie::proc21() { } void OSMovie::setFrame(uint frameNumber) { - + /* + _aviDecoder.seekToFrame(frameNumber); + const Graphics::Surface *s = _aviDecoder.decodeNextFrame(); + + _videoSurface->blitFrom(Common::Point(0, 0), s); + */ } } // End of namespace Titanic diff --git a/engines/titanic/movie.h b/engines/titanic/movie.h index 1430e249e5..5285508e78 100644 --- a/engines/titanic/movie.h +++ b/engines/titanic/movie.h @@ -23,6 +23,7 @@ #ifndef TITANIC_MOVIE_H #define TITANIC_MOVIE_H +#include "video/avi_decoder.h" #include "titanic/core/list.h" #include "titanic/core/resource_key.h" #include "titanic/video_surface.h" @@ -48,6 +49,9 @@ public: }; class OSMovie : public CMovie { +private: + Video::AVIDecoder _aviDecoder; + CVideoSurface *_videoSurface; public: OSMovie(const CResourceKey &name, CVideoSurface *surface); diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp index ef8d7a872f..5cab6d1511 100644 --- a/engines/titanic/video_surface.cpp +++ b/engines/titanic/video_surface.cpp @@ -58,6 +58,12 @@ void CVideoSurface::blitFrom(const Point &destPos, CVideoSurface *src, const Rec } } +void CVideoSurface::blitFrom(const Point &destPos, const Graphics::Surface *src) { + lock(); + _rawSurface->blitFrom(*src, destPos); + unlock(); +} + void CVideoSurface::clipBounds(Rect &srcRect, Rect &destRect, CVideoSurface *srcSurface, const Rect *subRect, const Point *destPos) { // Figure out initial source rect and dest rect, based on whether diff --git a/engines/titanic/video_surface.h b/engines/titanic/video_surface.h index 8d0b312ef0..c6ecf1a5df 100644 --- a/engines/titanic/video_surface.h +++ b/engines/titanic/video_surface.h @@ -158,7 +158,14 @@ public: */ void blitFrom(const Point &destPos, CVideoSurface *src, const Rect *srcRect = nullptr); + /** + * Blit from another surface + */ + void blitFrom(const Point &destPos, const Graphics::Surface *src); + void set40(void *v) { _field40 = v; } + + uint16 *getPixels() { return (uint16 *)_rawSurface->getPixels(); } }; class OSVideoSurface : public CVideoSurface { -- cgit v1.2.3 From 66e198d665a8aacd1724848a40e6533f3d5cfebc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 24 Mar 2016 07:49:59 -0400 Subject: TITANIC: Cleanup and fixes for message hierarchy --- engines/titanic/core/view_item.cpp | 14 ++-- engines/titanic/core/view_item.h | 12 ++-- engines/titanic/game/arboretum_gate.cpp | 14 ++-- engines/titanic/game/arboretum_gate.h | 14 ++-- engines/titanic/game/auto_animate.cpp | 2 +- engines/titanic/game/auto_animate.h | 2 +- engines/titanic/game/bar_bell.cpp | 2 +- engines/titanic/game/bar_bell.h | 2 +- engines/titanic/game/bomb.cpp | 2 +- engines/titanic/game/bomb.h | 2 +- engines/titanic/game/chicken_cooler.cpp | 2 +- engines/titanic/game/chicken_cooler.h | 2 +- engines/titanic/game/doorbot_elevator_handler.cpp | 2 +- engines/titanic/game/doorbot_elevator_handler.h | 2 +- engines/titanic/game/end_sequence_control.cpp | 2 +- engines/titanic/game/end_sequence_control.h | 2 +- engines/titanic/game/fan_noises.cpp | 2 +- engines/titanic/game/fan_noises.h | 2 +- engines/titanic/game/get_lift_eye2.cpp | 2 +- engines/titanic/game/get_lift_eye2.h | 2 +- engines/titanic/game/gondolier/gondolier_mixer.cpp | 2 +- engines/titanic/game/gondolier/gondolier_mixer.h | 2 +- engines/titanic/game/light.cpp | 2 +- engines/titanic/game/light.h | 2 +- engines/titanic/game/light_switch.cpp | 2 +- engines/titanic/game/light_switch.h | 2 +- engines/titanic/game/long_stick_dispenser.cpp | 2 +- engines/titanic/game/long_stick_dispenser.h | 2 +- .../titanic/game/parrot/player_meets_parrot.cpp | 2 +- engines/titanic/game/parrot/player_meets_parrot.h | 2 +- engines/titanic/game/pet/pet_monitor.cpp | 2 +- engines/titanic/game/pet/pet_monitor.h | 2 +- engines/titanic/game/pet/pet_position.cpp | 2 +- engines/titanic/game/pet/pet_position.h | 2 +- engines/titanic/game/pet/pet_transport.cpp | 2 +- engines/titanic/game/pet/pet_transport.h | 2 +- engines/titanic/game/phonograph.cpp | 2 +- engines/titanic/game/phonograph.h | 2 +- engines/titanic/game/sgt/sgt_state_room.cpp | 2 +- engines/titanic/game/sgt/sgt_state_room.h | 2 +- engines/titanic/game/ship_setting.cpp | 2 +- engines/titanic/game/ship_setting.h | 2 +- engines/titanic/game/transport/lift.cpp | 2 +- engines/titanic/game/transport/lift.h | 2 +- engines/titanic/game/transport/lift_indicator.h | 2 +- engines/titanic/game/transport/pellerator.cpp | 2 +- engines/titanic/game/transport/pellerator.h | 2 +- engines/titanic/game/up_lighter.cpp | 2 +- engines/titanic/game/up_lighter.h | 2 +- engines/titanic/game/volume_control.cpp | 2 +- engines/titanic/game/volume_control.h | 2 +- engines/titanic/input_handler.cpp | 6 +- engines/titanic/input_handler.h | 6 +- engines/titanic/messages/bilge_dispensor_event.cpp | 2 +- engines/titanic/messages/bilge_dispensor_event.h | 2 +- engines/titanic/messages/messages.cpp | 4 +- engines/titanic/messages/messages.h | 81 +++++++++------------- engines/titanic/messages/mouse_messages.h | 44 ++++++------ engines/titanic/moves/enter_bridge.cpp | 2 +- engines/titanic/moves/enter_bridge.h | 2 +- engines/titanic/npcs/barbot.cpp | 2 +- engines/titanic/npcs/barbot.h | 2 +- engines/titanic/npcs/liftbot.cpp | 2 +- engines/titanic/npcs/liftbot.h | 2 +- engines/titanic/sound/auto_music_player.cpp | 2 +- engines/titanic/sound/auto_music_player.h | 2 +- engines/titanic/sound/music_player.cpp | 2 +- engines/titanic/sound/music_player.h | 2 +- engines/titanic/sound/node_auto_sound_player.cpp | 2 +- engines/titanic/sound/node_auto_sound_player.h | 2 +- .../titanic/sound/restricted_auto_music_player.cpp | 2 +- .../titanic/sound/restricted_auto_music_player.h | 2 +- engines/titanic/sound/room_auto_sound_player.cpp | 2 +- engines/titanic/sound/room_auto_sound_player.h | 2 +- .../sound/room_trigger_auto_music_player.cpp | 2 +- .../titanic/sound/room_trigger_auto_music_player.h | 2 +- engines/titanic/sound/titania_speech.cpp | 2 +- engines/titanic/sound/titania_speech.h | 2 +- 78 files changed, 160 insertions(+), 173 deletions(-) diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index 1b9a1dd1a6..414cf302c0 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -160,7 +160,7 @@ void CViewItem::enterView(CViewItem *newView) { } } -bool CViewItem::handleEvent(CMouseButtonDownMsg &msg) { +bool CViewItem::handleMessage(CMouseButtonDownMsg &msg) { if (msg._buttons & MB_LEFT) { if (!handleMouseMsg(&msg, true)) { CGameManager *gm = getGameManager(); @@ -185,21 +185,21 @@ bool CViewItem::handleEvent(CMouseButtonDownMsg &msg) { return true; } -bool CViewItem::handleEvent(CMouseButtonUpMsg &msg) { +bool CViewItem::handleMessage(CMouseButtonUpMsg &msg) { if (msg._buttons & MB_LEFT) handleMouseMsg(&msg, false); return true; } -bool CViewItem::handleEvent(CMouseDoubleClickMsg &msg) { +bool CViewItem::handleMessage(CMouseDoubleClickMsg &msg) { if (msg._buttons & MB_LEFT) handleMouseMsg(&msg, false); return true; } -bool CViewItem::handleEvent(CMouseMoveMsg &msg) { +bool CViewItem::handleMessage(CMouseMoveMsg &msg) { CScreenManager *screenManager = CScreenManager::_screenManagerPtr; if (handleMouseMsg(&msg, true)) { @@ -224,8 +224,8 @@ bool CViewItem::handleEvent(CMouseMoveMsg &msg) { return true; } -bool CViewItem::handleMouseMsg(const CMouseMsg *msg, bool flag) { - const CMouseButtonUpMsg *upMsg = dynamic_cast(msg); +bool CViewItem::handleMouseMsg(CMouseMsg *msg, bool flag) { + CMouseButtonUpMsg *upMsg = dynamic_cast(msg); if (msg->isButtonUpMsg()) { handleButtonUpMsg(upMsg); return true; @@ -272,7 +272,7 @@ bool CViewItem::handleMouseMsg(const CMouseMsg *msg, bool flag) { return result; } -void CViewItem::handleButtonUpMsg(const CMouseButtonUpMsg *msg) { +void CViewItem::handleButtonUpMsg(CMouseButtonUpMsg *msg) { CTreeItem *&target = _buttonUpTargets[msg->_buttons >> 1]; if (target) { diff --git a/engines/titanic/core/view_item.h b/engines/titanic/core/view_item.h index bc66122314..3b071e53a5 100644 --- a/engines/titanic/core/view_item.h +++ b/engines/titanic/core/view_item.h @@ -39,12 +39,12 @@ private: /** * Called to handle mouse messagaes on the view */ - bool handleMouseMsg(const CMouseMsg *msg, bool flag); + bool handleMouseMsg(CMouseMsg *msg, bool flag); /** * Handles mouse button up messages */ - void handleButtonUpMsg(const CMouseButtonUpMsg *msg); + void handleButtonUpMsg(CMouseButtonUpMsg *msg); protected: int _field24; double _field28; @@ -52,10 +52,10 @@ protected: int _field50; int _field54; protected: - virtual bool handleEvent(CMouseButtonDownMsg &msg); - virtual bool handleEvent(CMouseButtonUpMsg &msg); - virtual bool handleEvent(CMouseMoveMsg &msg); - virtual bool handleEvent(CMouseDoubleClickMsg &msg); + virtual bool handleMessage(CMouseButtonDownMsg &msg); + virtual bool handleMessage(CMouseButtonUpMsg &msg); + virtual bool handleMessage(CMouseMoveMsg &msg); + virtual bool handleMessage(CMouseDoubleClickMsg &msg); public: int _viewNumber; public: diff --git a/engines/titanic/game/arboretum_gate.cpp b/engines/titanic/game/arboretum_gate.cpp index a892e65fc8..6770430cdc 100644 --- a/engines/titanic/game/arboretum_gate.cpp +++ b/engines/titanic/game/arboretum_gate.cpp @@ -133,17 +133,17 @@ void CArboretumGate::load(SimpleFile *file) { CBackground::load(file); } -bool CArboretumGate::handleEvent(CActMsg &msg) { return false; } -bool CArboretumGate::handleEvent(CLeaveViewMsg &msg) { return false; } -bool CArboretumGate::handleEvent(CTurnOff &msg) { return false; } -bool CArboretumGate::handleEvent(CMouseButtonDownMsg &msg) { return false; } +bool CArboretumGate::handleMessage(CActMsg &msg) { return false; } +bool CArboretumGate::handleMessage(CLeaveViewMsg &msg) { return false; } +bool CArboretumGate::handleMessage(CTurnOff &msg) { return false; } +bool CArboretumGate::handleMessage(CMouseButtonDownMsg &msg) { return false; } -bool CArboretumGate::handleEvent(CEnterViewMsg &msg) { +bool CArboretumGate::handleMessage(CEnterViewMsg &msg) { warning("CArboretumGate::handleEvent"); return false; } -bool CArboretumGate::handleEvent(CTurnOn &msg) { return false; } -bool CArboretumGate::handleEvent(CMovieEndMsg &msg) { return false; } +bool CArboretumGate::handleMessage(CTurnOn &msg) { return false; } +bool CArboretumGate::handleMessage(CMovieEndMsg &msg) { return false; } } // End of namespace Titanic diff --git a/engines/titanic/game/arboretum_gate.h b/engines/titanic/game/arboretum_gate.h index 7432799460..34569a0fc0 100644 --- a/engines/titanic/game/arboretum_gate.h +++ b/engines/titanic/game/arboretum_gate.h @@ -69,13 +69,13 @@ private: int _field150; CString _string2; protected: - virtual bool handleEvent(CActMsg &msg); - virtual bool handleEvent(CLeaveViewMsg &msg); - virtual bool handleEvent(CTurnOff &msg); - virtual bool handleEvent(CMouseButtonDownMsg &msg); - virtual bool handleEvent(CEnterViewMsg &msg); - virtual bool handleEvent(CTurnOn &msg); - virtual bool handleEvent(CMovieEndMsg &msg); + virtual bool handleMessage(CActMsg &msg); + virtual bool handleMessage(CLeaveViewMsg &msg); + virtual bool handleMessage(CTurnOff &msg); + virtual bool handleMessage(CMouseButtonDownMsg &msg); + virtual bool handleMessage(CEnterViewMsg &msg); + virtual bool handleMessage(CTurnOn &msg); + virtual bool handleMessage(CMovieEndMsg &msg); public: CLASSDEF CArboretumGate(); diff --git a/engines/titanic/game/auto_animate.cpp b/engines/titanic/game/auto_animate.cpp index 958200f4cc..2a3f3719e6 100644 --- a/engines/titanic/game/auto_animate.cpp +++ b/engines/titanic/game/auto_animate.cpp @@ -40,7 +40,7 @@ void CAutoAnimate::load(SimpleFile *file) { CBackground::load(file); } -bool CAutoAnimate::handleEvent(CEnterViewMsg &msg) { +bool CAutoAnimate::handleMessage(CEnterViewMsg &msg) { warning("CAutoAnimate::handleEvent"); return true; } diff --git a/engines/titanic/game/auto_animate.h b/engines/titanic/game/auto_animate.h index 56e40a470c..6fb85117ee 100644 --- a/engines/titanic/game/auto_animate.h +++ b/engines/titanic/game/auto_animate.h @@ -34,7 +34,7 @@ private: int _fieldE4; int _fieldE8; protected: - virtual bool handleEvent(CEnterViewMsg &msg); + virtual bool handleMessage(CEnterViewMsg &msg); public: CLASSDEF CAutoAnimate() : CBackground(), _fieldE0(1), _fieldE4(1), _fieldE8(0) {} diff --git a/engines/titanic/game/bar_bell.cpp b/engines/titanic/game/bar_bell.cpp index 1ac7568b0f..84a4d04b49 100644 --- a/engines/titanic/game/bar_bell.cpp +++ b/engines/titanic/game/bar_bell.cpp @@ -50,7 +50,7 @@ void CBarBell::load(SimpleFile *file) { CGameObject::load(file); } -bool CBarBell::handleEvent(CEnterRoomMsg &msg) { +bool CBarBell::handleMessage(CEnterRoomMsg &msg) { _fieldBC = 0; return true; } diff --git a/engines/titanic/game/bar_bell.h b/engines/titanic/game/bar_bell.h index 111b0ac267..30d71955ec 100644 --- a/engines/titanic/game/bar_bell.h +++ b/engines/titanic/game/bar_bell.h @@ -36,7 +36,7 @@ public: int _fieldC8; int _fieldCC; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CBarBell(); diff --git a/engines/titanic/game/bomb.cpp b/engines/titanic/game/bomb.cpp index a8bf15ec33..390ac2cd4e 100644 --- a/engines/titanic/game/bomb.cpp +++ b/engines/titanic/game/bomb.cpp @@ -70,7 +70,7 @@ void CBomb::load(SimpleFile *file) { CBackground::load(file); } -bool CBomb::handleEvent(CEnterRoomMsg &msg) { +bool CBomb::handleMessage(CEnterRoomMsg &msg) { _fieldE8 = 12; _fieldEC = 9; _fieldF0 = 0; diff --git a/engines/titanic/game/bomb.h b/engines/titanic/game/bomb.h index 9cbdf84081..8e9dcdf826 100644 --- a/engines/titanic/game/bomb.h +++ b/engines/titanic/game/bomb.h @@ -41,7 +41,7 @@ private: int _startingTicks; int _field104; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CBomb(); diff --git a/engines/titanic/game/chicken_cooler.cpp b/engines/titanic/game/chicken_cooler.cpp index 4ece0d6d05..ff7aae7323 100644 --- a/engines/titanic/game/chicken_cooler.cpp +++ b/engines/titanic/game/chicken_cooler.cpp @@ -40,7 +40,7 @@ void CChickenCooler::load(SimpleFile *file) { CGameObject::load(file); } -bool CChickenCooler::handleEvent(CEnterRoomMsg &msg) { +bool CChickenCooler::handleMessage(CEnterRoomMsg &msg) { warning("CChickenCoolor::handlEvent"); return true; } diff --git a/engines/titanic/game/chicken_cooler.h b/engines/titanic/game/chicken_cooler.h index 210183a474..176c8c9c4d 100644 --- a/engines/titanic/game/chicken_cooler.h +++ b/engines/titanic/game/chicken_cooler.h @@ -33,7 +33,7 @@ private: int _fieldBC; int _fieldC0; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CChickenCooler() : CGameObject(), _fieldBC(0), _fieldC0(0) {} diff --git a/engines/titanic/game/doorbot_elevator_handler.cpp b/engines/titanic/game/doorbot_elevator_handler.cpp index 718a464bf3..257b663246 100644 --- a/engines/titanic/game/doorbot_elevator_handler.cpp +++ b/engines/titanic/game/doorbot_elevator_handler.cpp @@ -40,7 +40,7 @@ void CDoorbotElevatorHandler::load(SimpleFile *file) { CGameObject::load(file); } -bool CDoorbotElevatorHandler::handleEvent(CEnterNodeMsg &msg) { +bool CDoorbotElevatorHandler::handleMessage(CEnterNodeMsg &msg) { warning("CDoorbotElevatorHandler::handleEvent"); return true; } diff --git a/engines/titanic/game/doorbot_elevator_handler.h b/engines/titanic/game/doorbot_elevator_handler.h index 04f3a75b18..d6c5be94d6 100644 --- a/engines/titanic/game/doorbot_elevator_handler.h +++ b/engines/titanic/game/doorbot_elevator_handler.h @@ -33,7 +33,7 @@ private: static int _v1; int _value; protected: - virtual bool handleEvent(CEnterNodeMsg &msg); + virtual bool handleMessage(CEnterNodeMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/end_sequence_control.cpp b/engines/titanic/game/end_sequence_control.cpp index c3f5a2a007..41bbc9d93c 100644 --- a/engines/titanic/game/end_sequence_control.cpp +++ b/engines/titanic/game/end_sequence_control.cpp @@ -34,7 +34,7 @@ void CEndSequenceControl::load(SimpleFile *file) { CGameObject::load(file); } -bool CEndSequenceControl::handleEvent(CEnterRoomMsg &msg) { +bool CEndSequenceControl::handleMessage(CEnterRoomMsg &msg) { warning("TODO: CEndSequenceControl::handleEvent"); return true; } diff --git a/engines/titanic/game/end_sequence_control.h b/engines/titanic/game/end_sequence_control.h index d0ddd9c920..5eb36943ea 100644 --- a/engines/titanic/game/end_sequence_control.h +++ b/engines/titanic/game/end_sequence_control.h @@ -30,7 +30,7 @@ namespace Titanic { class CEndSequenceControl : public CGameObject, CEnterRoomMsgTarget { protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/fan_noises.cpp b/engines/titanic/game/fan_noises.cpp index 7ec55c46f9..d7dd4e28b3 100644 --- a/engines/titanic/game/fan_noises.cpp +++ b/engines/titanic/game/fan_noises.cpp @@ -55,7 +55,7 @@ void CFanNoises::load(SimpleFile *file) { CGameObject::load(file); } -bool CFanNoises::handleEvent(CEnterRoomMsg &msg) { +bool CFanNoises::handleMessage(CEnterRoomMsg &msg) { warning("CFanNoises::handleEvent"); return true; } diff --git a/engines/titanic/game/fan_noises.h b/engines/titanic/game/fan_noises.h index 835d853d09..6daf8020c5 100644 --- a/engines/titanic/game/fan_noises.h +++ b/engines/titanic/game/fan_noises.h @@ -38,7 +38,7 @@ private: int _fieldD0; int _fieldD4; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CFanNoises(); diff --git a/engines/titanic/game/get_lift_eye2.cpp b/engines/titanic/game/get_lift_eye2.cpp index 7894c5ef58..5f3fac315d 100644 --- a/engines/titanic/game/get_lift_eye2.cpp +++ b/engines/titanic/game/get_lift_eye2.cpp @@ -46,7 +46,7 @@ void CGetLiftEye2::load(SimpleFile *file) { CGameObject::load(file); } -bool CGetLiftEye2::handleEvent(CEnterRoomMsg &msg) { +bool CGetLiftEye2::handleMessage(CEnterRoomMsg &msg) { warning("CGetLiftEye2::handleEvent"); return true; } diff --git a/engines/titanic/game/get_lift_eye2.h b/engines/titanic/game/get_lift_eye2.h index 5803ad03bd..8ce181f3c6 100644 --- a/engines/titanic/game/get_lift_eye2.h +++ b/engines/titanic/game/get_lift_eye2.h @@ -31,7 +31,7 @@ class CGetLiftEye2 : public CGameObject, CEnterRoomMsgTarget { private: static CString *_v1; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF static void init(); diff --git a/engines/titanic/game/gondolier/gondolier_mixer.cpp b/engines/titanic/game/gondolier/gondolier_mixer.cpp index 3d0a0e1f19..2bd3313d47 100644 --- a/engines/titanic/game/gondolier/gondolier_mixer.cpp +++ b/engines/titanic/game/gondolier/gondolier_mixer.cpp @@ -57,7 +57,7 @@ void CGondolierMixer::load(SimpleFile *file) { CGondolierBase::load(file); } -bool CGondolierMixer::handleEvent(CEnterRoomMsg &msg) { +bool CGondolierMixer::handleMessage(CEnterRoomMsg &msg) { CRoomItem *parentRoom = dynamic_cast(getParent()); if (parentRoom == msg._newRoom) msg.execute(parentRoom); diff --git a/engines/titanic/game/gondolier/gondolier_mixer.h b/engines/titanic/game/gondolier/gondolier_mixer.h index 1288290d6f..dd7288352b 100644 --- a/engines/titanic/game/gondolier/gondolier_mixer.h +++ b/engines/titanic/game/gondolier/gondolier_mixer.h @@ -38,7 +38,7 @@ private: CString _string2; int _fieldE4; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CGondolierMixer(); diff --git a/engines/titanic/game/light.cpp b/engines/titanic/game/light.cpp index 856e6a463f..c0b7df300f 100644 --- a/engines/titanic/game/light.cpp +++ b/engines/titanic/game/light.cpp @@ -57,7 +57,7 @@ void CLight::load(SimpleFile *file) { CBackground::load(file); } -bool CLight::handleEvent(CEnterRoomMsg &msg) { +bool CLight::handleMessage(CEnterRoomMsg &msg) { warning("CLight::handleEvent"); return true; } diff --git a/engines/titanic/game/light.h b/engines/titanic/game/light.h index 42e7224a72..66d60bedf7 100644 --- a/engines/titanic/game/light.h +++ b/engines/titanic/game/light.h @@ -39,7 +39,7 @@ private: int _fieldF8; int _fieldFC; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CLight(); diff --git a/engines/titanic/game/light_switch.cpp b/engines/titanic/game/light_switch.cpp index b857bfb159..0e68dda0dc 100644 --- a/engines/titanic/game/light_switch.cpp +++ b/engines/titanic/game/light_switch.cpp @@ -50,7 +50,7 @@ void CLightSwitch::load(SimpleFile *file) { CBackground::load(file); } -bool CLightSwitch::handleEvent(CEnterRoomMsg &msg) { +bool CLightSwitch::handleMessage(CEnterRoomMsg &msg) { warning("CLightSwitch::handleEvent"); return true; } diff --git a/engines/titanic/game/light_switch.h b/engines/titanic/game/light_switch.h index 1cda539dd0..2c43edd5b9 100644 --- a/engines/titanic/game/light_switch.h +++ b/engines/titanic/game/light_switch.h @@ -36,7 +36,7 @@ private: int _fieldE4; int _fieldE8; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CLightSwitch(); diff --git a/engines/titanic/game/long_stick_dispenser.cpp b/engines/titanic/game/long_stick_dispenser.cpp index 5d7df1df12..9511d7b017 100644 --- a/engines/titanic/game/long_stick_dispenser.cpp +++ b/engines/titanic/game/long_stick_dispenser.cpp @@ -42,7 +42,7 @@ void CLongStickDispenser::load(SimpleFile *file) { CGameObject::load(file); } -bool CLongStickDispenser::handleEvent(CEnterRoomMsg &msg) { +bool CLongStickDispenser::handleMessage(CEnterRoomMsg &msg) { _fieldC0 = 0; _fieldC4 = 1; return true; diff --git a/engines/titanic/game/long_stick_dispenser.h b/engines/titanic/game/long_stick_dispenser.h index 14785a785b..5e43bfa62f 100644 --- a/engines/titanic/game/long_stick_dispenser.h +++ b/engines/titanic/game/long_stick_dispenser.h @@ -34,7 +34,7 @@ private: int _fieldC0; int _fieldC4; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CLongStickDispenser() : CGameObject(), _fieldBC(0), diff --git a/engines/titanic/game/parrot/player_meets_parrot.cpp b/engines/titanic/game/parrot/player_meets_parrot.cpp index adb2dc5d36..16c8f480dd 100644 --- a/engines/titanic/game/parrot/player_meets_parrot.cpp +++ b/engines/titanic/game/parrot/player_meets_parrot.cpp @@ -34,7 +34,7 @@ void CPlayerMeetsParrot::load(SimpleFile *file) { CGameObject::load(file); } -bool CPlayerMeetsParrot::handleEvent(CEnterRoomMsg &msg) { +bool CPlayerMeetsParrot::handleMessage(CEnterRoomMsg &msg) { warning("CPlayerMeetsParrot::handleEvent"); return true; } diff --git a/engines/titanic/game/parrot/player_meets_parrot.h b/engines/titanic/game/parrot/player_meets_parrot.h index 9b8138f124..960b679fd4 100644 --- a/engines/titanic/game/parrot/player_meets_parrot.h +++ b/engines/titanic/game/parrot/player_meets_parrot.h @@ -30,7 +30,7 @@ namespace Titanic { class CPlayerMeetsParrot : public CGameObject, CEnterRoomMsgTarget { protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/pet/pet_monitor.cpp b/engines/titanic/game/pet/pet_monitor.cpp index 44d24f264e..afe0836e65 100644 --- a/engines/titanic/game/pet/pet_monitor.cpp +++ b/engines/titanic/game/pet/pet_monitor.cpp @@ -34,7 +34,7 @@ void CPETMonitor::load(SimpleFile *file) { CGameObject::load(file); } -bool CPETMonitor::handleEvent(CEnterRoomMsg &msg) { +bool CPETMonitor::handleMessage(CEnterRoomMsg &msg) { warning("CPETMonitor::handleEvent"); return true; } diff --git a/engines/titanic/game/pet/pet_monitor.h b/engines/titanic/game/pet/pet_monitor.h index 1d66a58d29..f8a35292fa 100644 --- a/engines/titanic/game/pet/pet_monitor.h +++ b/engines/titanic/game/pet/pet_monitor.h @@ -30,7 +30,7 @@ namespace Titanic { class CPETMonitor : public CGameObject, CEnterRoomMsgTarget { protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/pet/pet_position.cpp b/engines/titanic/game/pet/pet_position.cpp index b25111f62c..e1dab2218f 100644 --- a/engines/titanic/game/pet/pet_position.cpp +++ b/engines/titanic/game/pet/pet_position.cpp @@ -34,7 +34,7 @@ void CPETPosition::load(SimpleFile *file) { CGameObject::load(file); } -bool CPETPosition::handleEvent(CEnterRoomMsg &msg) { +bool CPETPosition::handleMessage(CEnterRoomMsg &msg) { warning("CPETPosition::handleEvent"); return true; } diff --git a/engines/titanic/game/pet/pet_position.h b/engines/titanic/game/pet/pet_position.h index 8a0623932b..fe28a13777 100644 --- a/engines/titanic/game/pet/pet_position.h +++ b/engines/titanic/game/pet/pet_position.h @@ -30,7 +30,7 @@ namespace Titanic { class CPETPosition : public CGameObject, CEnterRoomMsgTarget { protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/pet/pet_transport.cpp b/engines/titanic/game/pet/pet_transport.cpp index a88b703b10..36685676ac 100644 --- a/engines/titanic/game/pet/pet_transport.cpp +++ b/engines/titanic/game/pet/pet_transport.cpp @@ -34,7 +34,7 @@ void CPETTransport::load(SimpleFile *file) { CGameObject::load(file); } -bool CPETTransport::handleEvent(CEnterRoomMsg &msg) { +bool CPETTransport::handleMessage(CEnterRoomMsg &msg) { warning("CPETTransport::handleEvent"); return true; } diff --git a/engines/titanic/game/pet/pet_transport.h b/engines/titanic/game/pet/pet_transport.h index 3dc856d5b2..e43cbef849 100644 --- a/engines/titanic/game/pet/pet_transport.h +++ b/engines/titanic/game/pet/pet_transport.h @@ -30,7 +30,7 @@ namespace Titanic { class CPETTransport : public CGameObject, CEnterRoomMsgTarget { protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/phonograph.cpp b/engines/titanic/game/phonograph.cpp index f7a696e549..749bf33b24 100644 --- a/engines/titanic/game/phonograph.cpp +++ b/engines/titanic/game/phonograph.cpp @@ -55,7 +55,7 @@ void CPhonograph::load(SimpleFile *file) { CMusicPlayer::load(file); } -bool CPhonograph::handleEvent(CEnterRoomMsg &msg) { +bool CPhonograph::handleMessage(CEnterRoomMsg &msg) { warning("CPhonograph::handleEvent"); return true; } diff --git a/engines/titanic/game/phonograph.h b/engines/titanic/game/phonograph.h index 6efe10bab2..102edd2ace 100644 --- a/engines/titanic/game/phonograph.h +++ b/engines/titanic/game/phonograph.h @@ -38,7 +38,7 @@ protected: int _fieldF0; int _fieldF4; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CPhonograph(); diff --git a/engines/titanic/game/sgt/sgt_state_room.cpp b/engines/titanic/game/sgt/sgt_state_room.cpp index cf735dd6d0..9baae69afb 100644 --- a/engines/titanic/game/sgt/sgt_state_room.cpp +++ b/engines/titanic/game/sgt/sgt_state_room.cpp @@ -90,7 +90,7 @@ void CSGTStateRoom::load(SimpleFile *file) { CBackground::load(file); } -bool CSGTStateRoom::handleEvent(CEnterRoomMsg &msg) { +bool CSGTStateRoom::handleMessage(CEnterRoomMsg &msg) { warning("CSGTStateRoom::handleEvent"); return true; } diff --git a/engines/titanic/game/sgt/sgt_state_room.h b/engines/titanic/game/sgt/sgt_state_room.h index 4ec1617875..a730473580 100644 --- a/engines/titanic/game/sgt/sgt_state_room.h +++ b/engines/titanic/game/sgt/sgt_state_room.h @@ -55,7 +55,7 @@ private: int _fieldEC; int _fieldF0; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CSGTStateRoom(); diff --git a/engines/titanic/game/ship_setting.cpp b/engines/titanic/game/ship_setting.cpp index 6d12e59c81..1da27923c5 100644 --- a/engines/titanic/game/ship_setting.cpp +++ b/engines/titanic/game/ship_setting.cpp @@ -48,7 +48,7 @@ void CShipSetting::load(SimpleFile *file) { CBackground::load(file); } -bool CShipSetting::handleEvent(CEnterRoomMsg &msg) { +bool CShipSetting::handleMessage(CEnterRoomMsg &msg) { warning("CShipSetting::handleEvent"); return true; } diff --git a/engines/titanic/game/ship_setting.h b/engines/titanic/game/ship_setting.h index 2525224a28..6ea38be052 100644 --- a/engines/titanic/game/ship_setting.h +++ b/engines/titanic/game/ship_setting.h @@ -35,7 +35,7 @@ private: CString _string4; CString _string5; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CShipSetting(); diff --git a/engines/titanic/game/transport/lift.cpp b/engines/titanic/game/transport/lift.cpp index edf69fe31a..a795a15a16 100644 --- a/engines/titanic/game/transport/lift.cpp +++ b/engines/titanic/game/transport/lift.cpp @@ -57,7 +57,7 @@ void CLift::load(SimpleFile *file) { CTransport::load(file); } -bool CLift::handleEvent(CEnterRoomMsg &msg) { +bool CLift::handleMessage(CEnterRoomMsg &msg) { warning("CLift::handleEvent"); return true; } diff --git a/engines/titanic/game/transport/lift.h b/engines/titanic/game/transport/lift.h index 439e65bb30..4f628231e8 100644 --- a/engines/titanic/game/transport/lift.h +++ b/engines/titanic/game/transport/lift.h @@ -39,7 +39,7 @@ private: int _fieldF8; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CLift() : CTransport(), _fieldF8(1) {} diff --git a/engines/titanic/game/transport/lift_indicator.h b/engines/titanic/game/transport/lift_indicator.h index 80f8b0d05b..7cc5585d3b 100644 --- a/engines/titanic/game/transport/lift_indicator.h +++ b/engines/titanic/game/transport/lift_indicator.h @@ -35,7 +35,7 @@ private: int _field108; int _field10C; protected: - virtual bool handleEvent(CEnterRoomMsg &msg) { return true; } + virtual bool handleMessage(CEnterRoomMsg &msg) { return true; } public: CLASSDEF CLiftindicator(); diff --git a/engines/titanic/game/transport/pellerator.cpp b/engines/titanic/game/transport/pellerator.cpp index 16f42772c3..eca1037128 100644 --- a/engines/titanic/game/transport/pellerator.cpp +++ b/engines/titanic/game/transport/pellerator.cpp @@ -43,7 +43,7 @@ void CPellerator::load(SimpleFile *file) { CTransport::load(file); } -bool CPellerator::handleEvent(CEnterRoomMsg &msg) { +bool CPellerator::handleMessage(CEnterRoomMsg &msg) { warning("CPellerator::handleEvent"); return true; } diff --git a/engines/titanic/game/transport/pellerator.h b/engines/titanic/game/transport/pellerator.h index c997373382..03e45751b2 100644 --- a/engines/titanic/game/transport/pellerator.h +++ b/engines/titanic/game/transport/pellerator.h @@ -33,7 +33,7 @@ private: static int _v1; static int _v2; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/up_lighter.cpp b/engines/titanic/game/up_lighter.cpp index 817b179e3e..819dc9435a 100644 --- a/engines/titanic/game/up_lighter.cpp +++ b/engines/titanic/game/up_lighter.cpp @@ -48,7 +48,7 @@ void CUpLighter::load(SimpleFile *file) { CDropTarget::load(file); } -bool CUpLighter::handleEvent(CEnterRoomMsg &msg) { +bool CUpLighter::handleMessage(CEnterRoomMsg &msg) { warning("CUpLighter::handleEvent"); return true; } diff --git a/engines/titanic/game/up_lighter.h b/engines/titanic/game/up_lighter.h index 6c722ddc2a..add941f325 100644 --- a/engines/titanic/game/up_lighter.h +++ b/engines/titanic/game/up_lighter.h @@ -35,7 +35,7 @@ private: int _field120; int _field124; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CUpLighter(); diff --git a/engines/titanic/game/volume_control.cpp b/engines/titanic/game/volume_control.cpp index 801dfd1b60..bb58deebce 100644 --- a/engines/titanic/game/volume_control.cpp +++ b/engines/titanic/game/volume_control.cpp @@ -45,7 +45,7 @@ void CVolumeControl::load(SimpleFile *file) { CGameObject::load(file); } -bool CVolumeControl::handleEvent(CEnterNodeMsg &msg) { +bool CVolumeControl::handleMessage(CEnterNodeMsg &msg) { warning("CVolumeControl::handleEvent"); return true; } diff --git a/engines/titanic/game/volume_control.h b/engines/titanic/game/volume_control.h index f3f6a75278..5586c9cb45 100644 --- a/engines/titanic/game/volume_control.h +++ b/engines/titanic/game/volume_control.h @@ -34,7 +34,7 @@ private: CString _string1; int _fieldCC; protected: - virtual bool handleEvent(CEnterNodeMsg &msg); + virtual bool handleMessage(CEnterNodeMsg &msg); public: CLASSDEF CVolumeControl(); diff --git a/engines/titanic/input_handler.cpp b/engines/titanic/input_handler.cpp index 110bddfd90..2eb4427a46 100644 --- a/engines/titanic/input_handler.cpp +++ b/engines/titanic/input_handler.cpp @@ -48,7 +48,7 @@ void CInputHandler::decLockCount() { } } -void CInputHandler::handleMessage(const CMessage &msg, bool respectLock) { +void CInputHandler::handleMessage(CMessage &msg, bool respectLock) { if (!respectLock || _lockCount <= 0) { if (_gameManager->_gameState._mode == GSMODE_1) { processMessage(&msg); @@ -58,7 +58,7 @@ void CInputHandler::handleMessage(const CMessage &msg, bool respectLock) { } } -void CInputHandler::processMessage(const CMessage *msg) { +void CInputHandler::processMessage(CMessage *msg) { const CMouseMsg *mouseMsg = dynamic_cast(msg); _field24 = 0; dispatchMessage(msg); @@ -126,7 +126,7 @@ void CInputHandler::processMessage(const CMessage *msg) { } } -void CInputHandler::dispatchMessage(const CMessage *msg) { +void CInputHandler::dispatchMessage(CMessage *msg) { CPetControl *pet = _gameManager->_project->getPetControl(); if (!pet || !msg->execute(pet, nullptr, MSGFLAG_BREAK_IF_HANDLED)) { CViewItem *view = _gameManager->getView(); diff --git a/engines/titanic/input_handler.h b/engines/titanic/input_handler.h index a81874f0c5..7495082ddf 100644 --- a/engines/titanic/input_handler.h +++ b/engines/titanic/input_handler.h @@ -36,12 +36,12 @@ private: /** * Process and dispatch a passed message */ - void processMessage(const CMessage *msg); + void processMessage(CMessage *msg); /** * Dispatches a message to the project */ - void dispatchMessage(const CMessage *msg); + void dispatchMessage(CMessage *msg); /** * Called when a drag operation has ended @@ -75,7 +75,7 @@ public: /** * Handles a genereated mouse message */ - void handleMessage(const CMessage &msg, bool respectLock = true); + void handleMessage(CMessage &msg, bool respectLock = true); }; } // End of namespace Titanic diff --git a/engines/titanic/messages/bilge_dispensor_event.cpp b/engines/titanic/messages/bilge_dispensor_event.cpp index c20fe10992..e17494c5e2 100644 --- a/engines/titanic/messages/bilge_dispensor_event.cpp +++ b/engines/titanic/messages/bilge_dispensor_event.cpp @@ -34,7 +34,7 @@ void CBilgeDispensorEvent::load(SimpleFile *file) { CAutoSoundEvent::load(file); } -bool CBilgeDispensorEvent::handleEvent(CEnterRoomMsg &msg) { +bool CBilgeDispensorEvent::handleMessage(CEnterRoomMsg &msg) { _value1 = 0; return true; } diff --git a/engines/titanic/messages/bilge_dispensor_event.h b/engines/titanic/messages/bilge_dispensor_event.h index 9f91b61ef9..de8705f604 100644 --- a/engines/titanic/messages/bilge_dispensor_event.h +++ b/engines/titanic/messages/bilge_dispensor_event.h @@ -30,7 +30,7 @@ namespace Titanic { class CBilgeDispensorEvent : public CAutoSoundEvent { protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/messages/messages.cpp b/engines/titanic/messages/messages.cpp index 9202305353..28b8856578 100644 --- a/engines/titanic/messages/messages.cpp +++ b/engines/titanic/messages/messages.cpp @@ -39,7 +39,7 @@ void CMessage::load(SimpleFile *file) { CSaveableObject::load(file); } -bool CMessage::execute(CTreeItem *target, const ClassDef *classDef, int flags) const { +bool CMessage::execute(CTreeItem *target, const ClassDef *classDef, int flags) { // If no target was specified, then there's nothing to do if (!target) return false; @@ -51,7 +51,7 @@ bool CMessage::execute(CTreeItem *target, const ClassDef *classDef, int flags) c if (flags & MSGFLAG_SCAN) nextItem = item->scan(target); - if (!(flags & MSGFLAG_CLASS_DEF) || item->isInstanceOf(classDef)) { + if (!classDef || item->isInstanceOf(classDef)) { bool handled = perform(item); if (handled) { diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index ccea453a26..c945ad7736 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -35,7 +35,7 @@ enum MessageFlag { }; #define MSGTARGET(NAME) class NAME; class NAME##Target { public: \ - virtual bool handleEvent(NAME &msg) = 0; } + virtual bool handleMessage(NAME &msg) = 0; } class CGameObject; class CRoomItem; @@ -47,10 +47,14 @@ public: CLASSDEF CMessage(); + /** + * Executes the message, passing it on to the designated target, + * and optionally it's children + */ bool execute(CTreeItem *target, const ClassDef *classDef = nullptr, - int flags = MSGFLAG_SCAN | MSGFLAG_BREAK_IF_HANDLED) const; + int flags = MSGFLAG_SCAN | MSGFLAG_BREAK_IF_HANDLED); - virtual bool perform(CTreeItem *treeItem) const { return false; } + virtual bool perform(CTreeItem *treeItem) { return false; } /** * Save the data for the class to file @@ -80,8 +84,6 @@ public: MSGTARGET(CEditControlMsg); class CEditControlMsg : public CMessage { -protected: - virtual bool handleMessage(const CEditControlMsg &msg) { return false; } public: int _field4; int _field8; @@ -95,19 +97,17 @@ public: _field1C(0), _field20(0) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; + return dynamic_cast(item) != nullptr; } - virtual bool perform(CTreeItem *treeItem) const { - CEditControlMsg *dest = dynamic_cast(treeItem); + virtual bool perform(CTreeItem *treeItem) { + CEditControlMsgTarget *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } }; MSGTARGET(CLightsMsg); class CLightsMsg : public CMessage { -protected: - virtual bool handleMessage(const CLightsMsg &msg) { return false; } public: int _field4; int _field8; @@ -119,19 +119,16 @@ public: _fieldC(0), _field10(0) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; + return dynamic_cast(item) != nullptr; } - - virtual bool perform(CTreeItem *treeItem) const { - CLightsMsg *dest = dynamic_cast(treeItem); + virtual bool perform(CTreeItem *treeItem) { + CLightsMsgTarget *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } }; MSGTARGET(CIsHookedOnMsg); class CIsHookedOnMsg : public CMessage { -protected: - virtual bool handleMessage(const CIsHookedOnMsg &msg) { return false; } public: int _field4; int _field8; @@ -145,19 +142,16 @@ public: _field18(0), _field1C(0), _field20(0) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; + return dynamic_cast(item) != nullptr; } - - virtual bool perform(CTreeItem *treeItem) const { - CIsHookedOnMsg *dest = dynamic_cast(treeItem); + virtual bool perform(CTreeItem *treeItem) { + CIsHookedOnMsgTarget *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } }; MSGTARGET(CSubAcceptCCarryMsg); class CSubAcceptCCarryMsg : public CMessage { -protected: - virtual bool handleMessage(const CSubAcceptCCarryMsg &msg) { return false; } public: CString _string1; int _value1, _value2, _value3; @@ -166,19 +160,16 @@ public: CSubAcceptCCarryMsg() : _value1(0), _value2(0), _value3(0) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; + return dynamic_cast(item) != nullptr; } - - virtual bool perform(CTreeItem *treeItem) const { - CSubAcceptCCarryMsg *dest = dynamic_cast(treeItem); + virtual bool perform(CTreeItem *treeItem) { + CSubAcceptCCarryMsgTarget *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } }; MSGTARGET(CTransportMsg); class CTransportMsg : public CMessage { -protected: - virtual bool handleMessage(const CTransportMsg &msg) { return false; } public: CString _string; int _value1, _value2; @@ -187,11 +178,10 @@ public: CTransportMsg() : _value1(0), _value2(0) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; + return dynamic_cast(item) != nullptr; } - - virtual bool perform(CTreeItem *treeItem) const { - CTransportMsg *dest = dynamic_cast(treeItem); + virtual bool perform(CTreeItem *treeItem) { + CTransportMsgTarget *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } }; @@ -201,10 +191,9 @@ public: public: NAME() : CMessage() {} \ CLASSDEF \ static bool isSupportedBy(const CTreeItem *item) { \ - return dynamic_cast(item) != nullptr; } \ - virtual bool handleMessage(const NAME &msg) { return false; } \ - virtual bool perform(CTreeItem *treeItem) const { \ - NAME *dest = dynamic_cast(treeItem); \ + return dynamic_cast(item) != nullptr; } \ + virtual bool perform(CTreeItem *treeItem) { \ + NAME##Target *dest = dynamic_cast(treeItem); \ return dest != nullptr && dest->handleMessage(*this); \ } } #define MESSAGE1(NAME, F1, N1, V1) MSGTARGET(NAME); \ @@ -214,10 +203,9 @@ public: NAME(F1 N1) : CMessage(), _##N1(N1) {} \ CLASSDEF \ static bool isSupportedBy(const CTreeItem *item) { \ - return dynamic_cast(item) != nullptr; } \ - virtual bool handleMessage(const NAME &msg) { return false; } \ + return dynamic_cast(item) != nullptr; } \ virtual bool perform(CTreeItem *treeItem) { \ - NAME *dest = dynamic_cast(treeItem); \ + NAME##Target *dest = dynamic_cast(treeItem); \ return dest != nullptr && dest->handleMessage(*this); \ } } #define MESSAGE2(NAME, F1, N1, V1, F2, N2, V2) MSGTARGET(NAME); \ @@ -227,10 +215,9 @@ public: NAME(F1 N1, F2 N2) : CMessage(), _##N1(N1), _##N2(N2) {} \ CLASSDEF \ static bool isSupportedBy(const CTreeItem *item) { \ - return dynamic_cast(item) != nullptr; } \ - virtual bool handleMessage(const NAME &msg) { return false; } \ + return dynamic_cast(item) != nullptr; } \ virtual bool perform(CTreeItem *treeItem) { \ - NAME *dest = dynamic_cast(treeItem); \ + NAME##Target *dest = dynamic_cast(treeItem); \ return dest != nullptr && dest->handleMessage(*this); \ } } #define MESSAGE3(NAME, F1, N1, V1, F2, N2, V2, F3, N3, V3) MSGTARGET(NAME); \ @@ -240,10 +227,9 @@ public: NAME(F1 N1, F2 N2, F3 N3) : CMessage(), _##N1(N1), _##N2(N2), _##N3(N3) {} \ CLASSDEF \ static bool isSupportedBy(const CTreeItem *item) { \ - return dynamic_cast(item) != nullptr; } \ - virtual bool handleMessage(const NAME &msg) { return false; } \ + return dynamic_cast(item) != nullptr; } \ virtual bool perform(CTreeItem *treeItem) { \ - NAME *dest = dynamic_cast(treeItem); \ + NAME##Target *dest = dynamic_cast(treeItem); \ return dest != nullptr && dest->handleMessage(*this); \ } } #define MESSAGE4(NAME, F1, N1, V1, F2, N2, V2, F3, N3, V3, F4, N4, V4) MSGTARGET(NAME); \ @@ -253,10 +239,9 @@ public: NAME(F1 N1, F2 N2, F3 N3, F4 N4) : CMessage(), _##N1(N1), _##N2(N2), _##N3(N3), _##N4(N4) {} \ CLASSDEF \ static bool isSupportedBy(const CTreeItem *item) { \ - return dynamic_cast(item) != nullptr; } \ - virtual bool handleMessage(const NAME &msg) { return false; } \ + return dynamic_cast(item) != nullptr; } \ virtual bool perform(CTreeItem *treeItem) { \ - NAME *dest = dynamic_cast(treeItem); \ + NAME##Target *dest = dynamic_cast(treeItem); \ return dest != nullptr && dest->handleMessage(*this); \ } } diff --git a/engines/titanic/messages/mouse_messages.h b/engines/titanic/messages/mouse_messages.h index 6e2a74a046..7fe7ef960f 100644 --- a/engines/titanic/messages/mouse_messages.h +++ b/engines/titanic/messages/mouse_messages.h @@ -30,6 +30,7 @@ namespace Titanic { enum MouseButton { MB_LEFT = 1, MB_MIDDLE = 2, MB_RIGHT = 4 }; +MSGTARGET(CMouseMsg); class CMouseMsg : public CMessage { public: int _buttons; @@ -39,6 +40,11 @@ public: static bool isSupportedBy(const CTreeItem *item) { return dynamic_cast(item) != nullptr; } + virtual bool perform(CTreeItem *treeItem) { + CMouseMsgTarget *dest = dynamic_cast(treeItem); + return dest != nullptr && dest->handleMessage(*this); + } + CMouseMsg() : _buttons(0) {} CMouseMsg(const Point &pt, int buttons) : _mousePos(pt), _buttons(buttons) {} @@ -52,15 +58,15 @@ public: CMouseMoveMsg(const Point &pt, int buttons) : CMouseMsg(pt, buttons) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; + return dynamic_cast(item) != nullptr; } - virtual bool handleMessage(const CMouseMoveMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { - CMouseMoveMsg *dest = dynamic_cast(treeItem); + CMouseMoveMsgTarget *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } }; +MSGTARGET(CMouseButtonMsg); class CMouseButtonMsg : public CMouseMsg { public: int _field10; @@ -70,7 +76,7 @@ public: CMouseButtonMsg(const Point &pt, int buttons) : CMouseMsg(pt, buttons) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; + return dynamic_cast(item) != nullptr; } }; @@ -82,11 +88,10 @@ public: CMouseButtonDownMsg(const Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; + return dynamic_cast(item) != nullptr; } - virtual bool handleMessage(const CMouseButtonDownMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { - CMouseButtonDownMsg *dest = dynamic_cast(treeItem); + CMouseButtonDownMsgTarget *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } }; @@ -101,9 +106,8 @@ public: static bool isSupportedBy(const CTreeItem *item) { return dynamic_cast(item) != nullptr; } - virtual bool handleMessage(const CMouseButtonUpMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { - CMouseButtonUpMsg *dest = dynamic_cast(treeItem); + CMouseButtonUpMsgTarget *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } }; @@ -116,15 +120,15 @@ public: CMouseDoubleClickMsg(const Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; + return dynamic_cast(item) != nullptr; } - virtual bool handleMessage(const CMouseDoubleClickMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { - CMouseDoubleClickMsg *dest = dynamic_cast(treeItem); + CMouseDoubleClickMsgTarget *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } }; +MSGTARGET(CMouseDragMsg); class CMouseDragMsg : public CMouseMsg { public: CLASSDEF @@ -136,6 +140,7 @@ public: } }; +MSGTARGET(CMouseDragMoveMsg); class CMouseDragMoveMsg : public CMouseDragMsg { public: CLASSDEF @@ -143,11 +148,10 @@ public: CMouseDragMoveMsg(const Point &pt) : CMouseDragMsg(pt) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; + return dynamic_cast(item) != nullptr; } - virtual bool handleMessage(const CMouseDragMoveMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { - CMouseDragMoveMsg *dest = dynamic_cast(treeItem); + CMouseDragMoveMsgTarget *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } }; @@ -164,11 +168,10 @@ public: _dragItem(nullptr), _field14(0) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; + return dynamic_cast(item) != nullptr; } - virtual bool handleMessage(const CMouseDragStartMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { - CMouseDragStartMsg *dest = dynamic_cast(treeItem); + CMouseDragStartMsgTarget *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } }; @@ -184,11 +187,10 @@ public: CMouseDragMsg(pt), _dragItem(dragItem) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; + return dynamic_cast(item) != nullptr; } - virtual bool handleMessage(const CMouseDragEndMsg &msg) { return false; } virtual bool perform(CTreeItem *treeItem) { - CMouseDragEndMsg *dest = dynamic_cast(treeItem); + CMouseDragEndMsgTarget *dest = dynamic_cast(treeItem); return dest != nullptr && dest->handleMessage(*this); } }; diff --git a/engines/titanic/moves/enter_bridge.cpp b/engines/titanic/moves/enter_bridge.cpp index 359cfcb48f..8916fa90e7 100644 --- a/engines/titanic/moves/enter_bridge.cpp +++ b/engines/titanic/moves/enter_bridge.cpp @@ -36,7 +36,7 @@ void CEnterBridge::load(SimpleFile *file) { CGameObject::load(file); } -bool CEnterBridge::handleEvent(CEnterRoomMsg &msg) { +bool CEnterBridge::handleMessage(CEnterRoomMsg &msg) { warning("CEnterBridge::handlEvent"); return true; } diff --git a/engines/titanic/moves/enter_bridge.h b/engines/titanic/moves/enter_bridge.h index 39343ef904..9f7a64cf73 100644 --- a/engines/titanic/moves/enter_bridge.h +++ b/engines/titanic/moves/enter_bridge.h @@ -32,7 +32,7 @@ class CEnterBridge : public CGameObject, CEnterRoomMsgTarget { private: int _value; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CEnterBridge() : CGameObject(), _value(1) {} diff --git a/engines/titanic/npcs/barbot.cpp b/engines/titanic/npcs/barbot.cpp index 907d3c0c71..e487dc1ecb 100644 --- a/engines/titanic/npcs/barbot.cpp +++ b/engines/titanic/npcs/barbot.cpp @@ -233,7 +233,7 @@ void CBarbot::load(SimpleFile *file) { CTrueTalkNPC::load(file); } -bool CBarbot::handleEvent(CEnterRoomMsg &msg) { +bool CBarbot::handleMessage(CEnterRoomMsg &msg) { warning("TODO: Barbot::CEnterRoomMsg"); return true; } diff --git a/engines/titanic/npcs/barbot.h b/engines/titanic/npcs/barbot.h index 442578ef6c..d407ef74c8 100644 --- a/engines/titanic/npcs/barbot.h +++ b/engines/titanic/npcs/barbot.h @@ -174,7 +174,7 @@ private: int _field33C; int _field340; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CBarbot(); diff --git a/engines/titanic/npcs/liftbot.cpp b/engines/titanic/npcs/liftbot.cpp index dfc0a4f0ad..a412d43ff1 100644 --- a/engines/titanic/npcs/liftbot.cpp +++ b/engines/titanic/npcs/liftbot.cpp @@ -48,7 +48,7 @@ void CLiftBot::load(SimpleFile *file) { CTrueTalkNPC::load(file); } -bool CLiftBot::handleEvent(CEnterRoomMsg &msg) { +bool CLiftBot::handleMessage(CEnterRoomMsg &msg) { warning("CLiftBot::handleEvent"); return true; } diff --git a/engines/titanic/npcs/liftbot.h b/engines/titanic/npcs/liftbot.h index 3a41bf3a96..373147bdb7 100644 --- a/engines/titanic/npcs/liftbot.h +++ b/engines/titanic/npcs/liftbot.h @@ -35,7 +35,7 @@ private: private: int _field108; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CLiftBot(); diff --git a/engines/titanic/sound/auto_music_player.cpp b/engines/titanic/sound/auto_music_player.cpp index 638cac8c26..5981a707bd 100644 --- a/engines/titanic/sound/auto_music_player.cpp +++ b/engines/titanic/sound/auto_music_player.cpp @@ -41,7 +41,7 @@ void CAutoMusicPlayer::load(SimpleFile *file) { CAutoMusicPlayerBase::load(file); } -bool CAutoMusicPlayer::handleEvent(CEnterRoomMsg &msg) { +bool CAutoMusicPlayer::handleMessage(CEnterRoomMsg &msg) { if (!_fieldCC) { warning("TODO"); } diff --git a/engines/titanic/sound/auto_music_player.h b/engines/titanic/sound/auto_music_player.h index d2f42ac5c5..bcf4126264 100644 --- a/engines/titanic/sound/auto_music_player.h +++ b/engines/titanic/sound/auto_music_player.h @@ -32,7 +32,7 @@ class CAutoMusicPlayer : public CAutoMusicPlayerBase, CEnterRoomMsgTarget { private: CString _string2; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CAutoMusicPlayer(); diff --git a/engines/titanic/sound/music_player.cpp b/engines/titanic/sound/music_player.cpp index 25f73b0dc5..eaad635dd3 100644 --- a/engines/titanic/sound/music_player.cpp +++ b/engines/titanic/sound/music_player.cpp @@ -44,7 +44,7 @@ void CMusicPlayer::load(SimpleFile *file) { CGameObject::load(file); } -bool CMusicPlayer::handleEvent(CEnterRoomMsg &msg) { +bool CMusicPlayer::handleMessage(CEnterRoomMsg &msg) { warning("TODO: CMusicPlayer::handleEvent"); return true; } diff --git a/engines/titanic/sound/music_player.h b/engines/titanic/sound/music_player.h index 96a6968c6d..6b8bc83b05 100644 --- a/engines/titanic/sound/music_player.h +++ b/engines/titanic/sound/music_player.h @@ -35,7 +35,7 @@ protected: int _fieldCC; int _fieldD0; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CMusicPlayer() : CGameObject(), diff --git a/engines/titanic/sound/node_auto_sound_player.cpp b/engines/titanic/sound/node_auto_sound_player.cpp index 0ef6c8d2ac..5af8ca25d3 100644 --- a/engines/titanic/sound/node_auto_sound_player.cpp +++ b/engines/titanic/sound/node_auto_sound_player.cpp @@ -36,7 +36,7 @@ void CNodeAutoSoundPlayer::load(SimpleFile *file) { CAutoSoundPlayer::load(file); } -bool CNodeAutoSoundPlayer::handleEvent(CEnterNodeMsg &msg) { +bool CNodeAutoSoundPlayer::handleMessage(CEnterNodeMsg &msg) { warning("CNodeAutoSoundPlayer::handleEvent"); return true; } diff --git a/engines/titanic/sound/node_auto_sound_player.h b/engines/titanic/sound/node_auto_sound_player.h index 258aa47eea..acc766abec 100644 --- a/engines/titanic/sound/node_auto_sound_player.h +++ b/engines/titanic/sound/node_auto_sound_player.h @@ -32,7 +32,7 @@ class CNodeAutoSoundPlayer : public CAutoSoundPlayer, CEnterNodeMsgTarget { private: int _fieldEC; protected: - virtual bool handleEvent(CEnterNodeMsg &msg); + virtual bool handleMessage(CEnterNodeMsg &msg); public: CLASSDEF CNodeAutoSoundPlayer() : CAutoSoundPlayer(), _fieldEC(1) {} diff --git a/engines/titanic/sound/restricted_auto_music_player.cpp b/engines/titanic/sound/restricted_auto_music_player.cpp index 2ee8f2d082..7b5ba707c2 100644 --- a/engines/titanic/sound/restricted_auto_music_player.cpp +++ b/engines/titanic/sound/restricted_auto_music_player.cpp @@ -44,7 +44,7 @@ void CRestrictedAutoMusicPlayer::load(SimpleFile *file) { CAutoMusicPlayer::load(file); } -bool CRestrictedAutoMusicPlayer::handleEvent(CEnterRoomMsg &msg) { +bool CRestrictedAutoMusicPlayer::handleMessage(CEnterRoomMsg &msg) { warning("CRestrictedAutoMusicPlayer::handleEvent"); return true; } diff --git a/engines/titanic/sound/restricted_auto_music_player.h b/engines/titanic/sound/restricted_auto_music_player.h index efb3dc2892..3553d1c63b 100644 --- a/engines/titanic/sound/restricted_auto_music_player.h +++ b/engines/titanic/sound/restricted_auto_music_player.h @@ -35,7 +35,7 @@ private: CString _string5; CString _string6; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/sound/room_auto_sound_player.cpp b/engines/titanic/sound/room_auto_sound_player.cpp index 549f27be63..c24ef2a211 100644 --- a/engines/titanic/sound/room_auto_sound_player.cpp +++ b/engines/titanic/sound/room_auto_sound_player.cpp @@ -34,7 +34,7 @@ void CRoomAutoSoundPlayer::load(SimpleFile *file) { CAutoSoundPlayer::load(file); } -bool CRoomAutoSoundPlayer::handleEvent(CEnterRoomMsg &msg) { +bool CRoomAutoSoundPlayer::handleMessage(CEnterRoomMsg &msg) { warning("CRoomAutoSoundPlayer::handleEvent"); return true; } diff --git a/engines/titanic/sound/room_auto_sound_player.h b/engines/titanic/sound/room_auto_sound_player.h index a3ec35cb04..82d23a79c3 100644 --- a/engines/titanic/sound/room_auto_sound_player.h +++ b/engines/titanic/sound/room_auto_sound_player.h @@ -30,7 +30,7 @@ namespace Titanic { class CRoomAutoSoundPlayer : public CAutoSoundPlayer, CEnterRoomMsgTarget { protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/sound/room_trigger_auto_music_player.cpp b/engines/titanic/sound/room_trigger_auto_music_player.cpp index 3c0ac0536b..5ec35c3903 100644 --- a/engines/titanic/sound/room_trigger_auto_music_player.cpp +++ b/engines/titanic/sound/room_trigger_auto_music_player.cpp @@ -34,7 +34,7 @@ void CRoomTriggerAutoMusicPlayer::load(SimpleFile *file) { CTriggerAutoMusicPlayer::load(file); } -bool CRoomTriggerAutoMusicPlayer::handleEvent(CEnterRoomMsg &msg) { +bool CRoomTriggerAutoMusicPlayer::handleMessage(CEnterRoomMsg &msg) { warning("CRoomTriggerAutoMusicPlayer::handleEvent"); return true; } diff --git a/engines/titanic/sound/room_trigger_auto_music_player.h b/engines/titanic/sound/room_trigger_auto_music_player.h index 9a478a0a08..4ce4bae7fa 100644 --- a/engines/titanic/sound/room_trigger_auto_music_player.h +++ b/engines/titanic/sound/room_trigger_auto_music_player.h @@ -30,7 +30,7 @@ namespace Titanic { class CRoomTriggerAutoMusicPlayer : public CTriggerAutoMusicPlayer, CEnterRoomMsgTarget { protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/sound/titania_speech.cpp b/engines/titanic/sound/titania_speech.cpp index 16a88e40ec..c530a9ac70 100644 --- a/engines/titanic/sound/titania_speech.cpp +++ b/engines/titanic/sound/titania_speech.cpp @@ -40,7 +40,7 @@ void CTitaniaSpeech::load(SimpleFile *file) { CGameObject::load(file); } -bool CTitaniaSpeech::handleEvent(CEnterRoomMsg &msg) { +bool CTitaniaSpeech::handleMessage(CEnterRoomMsg &msg) { warning("CTitaniaSpeech::handleEvent"); return true; } diff --git a/engines/titanic/sound/titania_speech.h b/engines/titanic/sound/titania_speech.h index 09a8495fef..b894eeead1 100644 --- a/engines/titanic/sound/titania_speech.h +++ b/engines/titanic/sound/titania_speech.h @@ -32,7 +32,7 @@ class CTitaniaSpeech : public CGameObject { private: int _value1, _value2; protected: - virtual bool handleEvent(CEnterRoomMsg &msg); + virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CTitaniaSpeech() : CGameObject(), _value1(1), _value2(0) {} -- cgit v1.2.3 From d9cc2908f8a9a7fa2d196c82571d32b5ef20ad9b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 24 Mar 2016 12:51:44 -0400 Subject: TITANIC: Make all use of message targets public inheritance --- engines/titanic/core/view_item.h | 7 +++++-- engines/titanic/game/arboretum_gate.h | 12 ++++++++---- engines/titanic/game/bar_bell.h | 3 ++- engines/titanic/game/bomb.h | 3 ++- engines/titanic/game/chicken_cooler.h | 3 ++- engines/titanic/game/doorbot_elevator_handler.h | 3 ++- engines/titanic/game/end_sequence_control.h | 3 ++- engines/titanic/game/fan_noises.h | 3 ++- engines/titanic/game/get_lift_eye2.h | 3 ++- engines/titanic/game/gondolier/gondolier_mixer.h | 3 ++- engines/titanic/game/light.h | 3 ++- engines/titanic/game/light_switch.h | 3 ++- engines/titanic/game/parrot/player_meets_parrot.h | 3 ++- engines/titanic/game/pet/pet_monitor.h | 3 ++- engines/titanic/game/pet/pet_position.h | 3 ++- engines/titanic/game/pet/pet_transport.h | 3 ++- engines/titanic/game/sgt/sgt_state_room.h | 3 ++- engines/titanic/game/ship_setting.h | 3 ++- engines/titanic/game/transport/lift.h | 3 ++- engines/titanic/game/transport/pellerator.h | 3 ++- engines/titanic/game/up_lighter.h | 3 ++- engines/titanic/moves/enter_bridge.h | 3 ++- engines/titanic/npcs/barbot.h | 3 ++- engines/titanic/npcs/liftbot.h | 3 ++- engines/titanic/sound/auto_music_player.h | 3 ++- engines/titanic/sound/music_player.h | 3 ++- engines/titanic/sound/node_auto_sound_player.h | 3 ++- engines/titanic/sound/room_auto_sound_player.h | 3 ++- 28 files changed, 65 insertions(+), 32 deletions(-) diff --git a/engines/titanic/core/view_item.h b/engines/titanic/core/view_item.h index 3b071e53a5..fc4089f924 100644 --- a/engines/titanic/core/view_item.h +++ b/engines/titanic/core/view_item.h @@ -29,8 +29,11 @@ namespace Titanic { -class CViewItem : public CNamedItem, CMouseButtonDownMsgTarget, - CMouseButtonUpMsgTarget, CMouseMoveMsgTarget, CMouseDoubleClickMsgTarget { +class CViewItem : public CNamedItem, + public CMouseButtonDownMsgTarget, + public CMouseButtonUpMsgTarget, + public CMouseMoveMsgTarget, + public CMouseDoubleClickMsgTarget { private: CTreeItem *_buttonUpTargets[4]; private: diff --git a/engines/titanic/game/arboretum_gate.h b/engines/titanic/game/arboretum_gate.h index 34569a0fc0..a176e93ed9 100644 --- a/engines/titanic/game/arboretum_gate.h +++ b/engines/titanic/game/arboretum_gate.h @@ -29,10 +29,14 @@ namespace Titanic { -class CArboretumGate : public CBackground, public CActMsgTarget, - public CLeaveViewMsgTarget, public CTurnOffTarget, - public CMouseButtonDownMsgTarget, public CEnterViewMsgTarget, - public CTurnOnTarget, public CMovieEndMsgTarget { +class CArboretumGate : public CBackground, + public CActMsgTarget, + public CLeaveViewMsgTarget, + public CTurnOffTarget, + public CMouseButtonDownMsgTarget, + public CEnterViewMsgTarget, + public CTurnOnTarget, + public CMovieEndMsgTarget { private: static int _v1; static int _v2; diff --git a/engines/titanic/game/bar_bell.h b/engines/titanic/game/bar_bell.h index 30d71955ec..865e446cc5 100644 --- a/engines/titanic/game/bar_bell.h +++ b/engines/titanic/game/bar_bell.h @@ -28,7 +28,8 @@ namespace Titanic { -class CBarBell : public CGameObject, CEnterRoomMsgTarget { +class CBarBell : public CGameObject, + public CEnterRoomMsgTarget { public: int _fieldBC; int _fieldC0; diff --git a/engines/titanic/game/bomb.h b/engines/titanic/game/bomb.h index 8e9dcdf826..9f33189d56 100644 --- a/engines/titanic/game/bomb.h +++ b/engines/titanic/game/bomb.h @@ -28,7 +28,8 @@ namespace Titanic { -class CBomb : public CBackground, CEnterRoomMsgTarget { +class CBomb : public CBackground, + public CEnterRoomMsgTarget { private: int _fieldE0; int _fieldE4; diff --git a/engines/titanic/game/chicken_cooler.h b/engines/titanic/game/chicken_cooler.h index 176c8c9c4d..6f57cddb9c 100644 --- a/engines/titanic/game/chicken_cooler.h +++ b/engines/titanic/game/chicken_cooler.h @@ -28,7 +28,8 @@ namespace Titanic { -class CChickenCooler : public CGameObject, CEnterRoomMsgTarget { +class CChickenCooler : public CGameObject, + public CEnterRoomMsgTarget { private: int _fieldBC; int _fieldC0; diff --git a/engines/titanic/game/doorbot_elevator_handler.h b/engines/titanic/game/doorbot_elevator_handler.h index d6c5be94d6..bd33747239 100644 --- a/engines/titanic/game/doorbot_elevator_handler.h +++ b/engines/titanic/game/doorbot_elevator_handler.h @@ -28,7 +28,8 @@ namespace Titanic { -class CDoorbotElevatorHandler : public CGameObject, CEnterNodeMsgTarget { +class CDoorbotElevatorHandler : public CGameObject, + public CEnterNodeMsgTarget { private: static int _v1; int _value; diff --git a/engines/titanic/game/end_sequence_control.h b/engines/titanic/game/end_sequence_control.h index 5eb36943ea..87eaf17c0e 100644 --- a/engines/titanic/game/end_sequence_control.h +++ b/engines/titanic/game/end_sequence_control.h @@ -28,7 +28,8 @@ namespace Titanic { -class CEndSequenceControl : public CGameObject, CEnterRoomMsgTarget { +class CEndSequenceControl : public CGameObject, + public CEnterRoomMsgTarget { protected: virtual bool handleMessage(CEnterRoomMsg &msg); public: diff --git a/engines/titanic/game/fan_noises.h b/engines/titanic/game/fan_noises.h index 6daf8020c5..495ac39f8e 100644 --- a/engines/titanic/game/fan_noises.h +++ b/engines/titanic/game/fan_noises.h @@ -28,7 +28,8 @@ namespace Titanic { -class CFanNoises : public CGameObject, CEnterRoomMsgTarget { +class CFanNoises : public CGameObject, + public CEnterRoomMsgTarget { private: int _fieldBC; int _fieldC0; diff --git a/engines/titanic/game/get_lift_eye2.h b/engines/titanic/game/get_lift_eye2.h index 8ce181f3c6..7ca0b4d32e 100644 --- a/engines/titanic/game/get_lift_eye2.h +++ b/engines/titanic/game/get_lift_eye2.h @@ -27,7 +27,8 @@ #include "titanic/messages/messages.h" namespace Titanic { -class CGetLiftEye2 : public CGameObject, CEnterRoomMsgTarget { +class CGetLiftEye2 : public CGameObject, + public CEnterRoomMsgTarget { private: static CString *_v1; protected: diff --git a/engines/titanic/game/gondolier/gondolier_mixer.h b/engines/titanic/game/gondolier/gondolier_mixer.h index dd7288352b..c6ea840ea6 100644 --- a/engines/titanic/game/gondolier/gondolier_mixer.h +++ b/engines/titanic/game/gondolier/gondolier_mixer.h @@ -28,7 +28,8 @@ namespace Titanic { -class CGondolierMixer : public CGondolierBase, CEnterRoomMsgTarget { +class CGondolierMixer : public CGondolierBase, + public CEnterRoomMsgTarget { private: int _fieldBC; int _fieldC0; diff --git a/engines/titanic/game/light.h b/engines/titanic/game/light.h index 66d60bedf7..a2e562c573 100644 --- a/engines/titanic/game/light.h +++ b/engines/titanic/game/light.h @@ -28,7 +28,8 @@ namespace Titanic { -class CLight : public CBackground, CEnterRoomMsgTarget { +class CLight : public CBackground, + public CEnterRoomMsgTarget { private: int _fieldE0; int _fieldE4; diff --git a/engines/titanic/game/light_switch.h b/engines/titanic/game/light_switch.h index 2c43edd5b9..3e44590390 100644 --- a/engines/titanic/game/light_switch.h +++ b/engines/titanic/game/light_switch.h @@ -28,7 +28,8 @@ namespace Titanic { -class CLightSwitch : public CBackground, CEnterRoomMsgTarget { +class CLightSwitch : public CBackground, + public CEnterRoomMsgTarget { public: static int _v1; private: diff --git a/engines/titanic/game/parrot/player_meets_parrot.h b/engines/titanic/game/parrot/player_meets_parrot.h index 960b679fd4..9e47a0a932 100644 --- a/engines/titanic/game/parrot/player_meets_parrot.h +++ b/engines/titanic/game/parrot/player_meets_parrot.h @@ -28,7 +28,8 @@ namespace Titanic { -class CPlayerMeetsParrot : public CGameObject, CEnterRoomMsgTarget { +class CPlayerMeetsParrot : public CGameObject, + public CEnterRoomMsgTarget { protected: virtual bool handleMessage(CEnterRoomMsg &msg); public: diff --git a/engines/titanic/game/pet/pet_monitor.h b/engines/titanic/game/pet/pet_monitor.h index f8a35292fa..5cf14f38cb 100644 --- a/engines/titanic/game/pet/pet_monitor.h +++ b/engines/titanic/game/pet/pet_monitor.h @@ -28,7 +28,8 @@ namespace Titanic { -class CPETMonitor : public CGameObject, CEnterRoomMsgTarget { +class CPETMonitor : public CGameObject, + public CEnterRoomMsgTarget { protected: virtual bool handleMessage(CEnterRoomMsg &msg); public: diff --git a/engines/titanic/game/pet/pet_position.h b/engines/titanic/game/pet/pet_position.h index fe28a13777..820df41c50 100644 --- a/engines/titanic/game/pet/pet_position.h +++ b/engines/titanic/game/pet/pet_position.h @@ -28,7 +28,8 @@ namespace Titanic { -class CPETPosition : public CGameObject, CEnterRoomMsgTarget { +class CPETPosition : public CGameObject, + public CEnterRoomMsgTarget { protected: virtual bool handleMessage(CEnterRoomMsg &msg); public: diff --git a/engines/titanic/game/pet/pet_transport.h b/engines/titanic/game/pet/pet_transport.h index e43cbef849..8dd3f3aac5 100644 --- a/engines/titanic/game/pet/pet_transport.h +++ b/engines/titanic/game/pet/pet_transport.h @@ -28,7 +28,8 @@ namespace Titanic { -class CPETTransport : public CGameObject, CEnterRoomMsgTarget { +class CPETTransport : public CGameObject, + public CEnterRoomMsgTarget { protected: virtual bool handleMessage(CEnterRoomMsg &msg); public: diff --git a/engines/titanic/game/sgt/sgt_state_room.h b/engines/titanic/game/sgt/sgt_state_room.h index a730473580..6e53ad39da 100644 --- a/engines/titanic/game/sgt/sgt_state_room.h +++ b/engines/titanic/game/sgt/sgt_state_room.h @@ -45,7 +45,8 @@ struct CSGTStateRoomStatics { int _v14; }; -class CSGTStateRoom : public CBackground, CEnterRoomMsgTarget { +class CSGTStateRoom : public CBackground, + public CEnterRoomMsgTarget { private: static CSGTStateRoomStatics *_statics; private: diff --git a/engines/titanic/game/ship_setting.h b/engines/titanic/game/ship_setting.h index 6ea38be052..878feba8ba 100644 --- a/engines/titanic/game/ship_setting.h +++ b/engines/titanic/game/ship_setting.h @@ -28,7 +28,8 @@ namespace Titanic { -class CShipSetting : public CBackground, CEnterRoomMsgTarget { +class CShipSetting : public CBackground, + public CEnterRoomMsgTarget { private: CString _string3; Point _pos1; diff --git a/engines/titanic/game/transport/lift.h b/engines/titanic/game/transport/lift.h index 4f628231e8..c2a18df4dd 100644 --- a/engines/titanic/game/transport/lift.h +++ b/engines/titanic/game/transport/lift.h @@ -28,7 +28,8 @@ namespace Titanic { -class CLift : public CTransport, CEnterRoomMsgTarget { +class CLift : public CTransport, + public CEnterRoomMsgTarget { private: static int _v1; static int _v2; diff --git a/engines/titanic/game/transport/pellerator.h b/engines/titanic/game/transport/pellerator.h index 03e45751b2..b97d17ff88 100644 --- a/engines/titanic/game/transport/pellerator.h +++ b/engines/titanic/game/transport/pellerator.h @@ -28,7 +28,8 @@ namespace Titanic { -class CPellerator : public CTransport, CEnterRoomMsgTarget { +class CPellerator : public CTransport, + public CEnterRoomMsgTarget { private: static int _v1; static int _v2; diff --git a/engines/titanic/game/up_lighter.h b/engines/titanic/game/up_lighter.h index add941f325..589e279d6b 100644 --- a/engines/titanic/game/up_lighter.h +++ b/engines/titanic/game/up_lighter.h @@ -28,7 +28,8 @@ namespace Titanic { -class CUpLighter : public CDropTarget, CEnterRoomMsgTarget { +class CUpLighter : public CDropTarget, + public CEnterRoomMsgTarget { private: int _field118; int _field11C; diff --git a/engines/titanic/moves/enter_bridge.h b/engines/titanic/moves/enter_bridge.h index 9f7a64cf73..743960d30e 100644 --- a/engines/titanic/moves/enter_bridge.h +++ b/engines/titanic/moves/enter_bridge.h @@ -28,7 +28,8 @@ namespace Titanic { -class CEnterBridge : public CGameObject, CEnterRoomMsgTarget { +class CEnterBridge : public CGameObject, + public CEnterRoomMsgTarget { private: int _value; protected: diff --git a/engines/titanic/npcs/barbot.h b/engines/titanic/npcs/barbot.h index d407ef74c8..0cad69a758 100644 --- a/engines/titanic/npcs/barbot.h +++ b/engines/titanic/npcs/barbot.h @@ -28,7 +28,8 @@ namespace Titanic { -class CBarbot : public CTrueTalkNPC, CEnterRoomMsgTarget { +class CBarbot : public CTrueTalkNPC, + public CEnterRoomMsgTarget { private: static int _v0; private: diff --git a/engines/titanic/npcs/liftbot.h b/engines/titanic/npcs/liftbot.h index 373147bdb7..03867cc6f3 100644 --- a/engines/titanic/npcs/liftbot.h +++ b/engines/titanic/npcs/liftbot.h @@ -28,7 +28,8 @@ namespace Titanic { -class CLiftBot : public CTrueTalkNPC, CEnterRoomMsgTarget { +class CLiftBot : public CTrueTalkNPC, + public CEnterRoomMsgTarget { private: static int _v1; static int _v2; diff --git a/engines/titanic/sound/auto_music_player.h b/engines/titanic/sound/auto_music_player.h index bcf4126264..da8a386cb1 100644 --- a/engines/titanic/sound/auto_music_player.h +++ b/engines/titanic/sound/auto_music_player.h @@ -28,7 +28,8 @@ namespace Titanic { -class CAutoMusicPlayer : public CAutoMusicPlayerBase, CEnterRoomMsgTarget { +class CAutoMusicPlayer : public CAutoMusicPlayerBase, + public CEnterRoomMsgTarget { private: CString _string2; protected: diff --git a/engines/titanic/sound/music_player.h b/engines/titanic/sound/music_player.h index 6b8bc83b05..4cc510c42f 100644 --- a/engines/titanic/sound/music_player.h +++ b/engines/titanic/sound/music_player.h @@ -28,7 +28,8 @@ namespace Titanic { -class CMusicPlayer : public CGameObject, CEnterRoomMsgTarget { +class CMusicPlayer : public CGameObject, + public CEnterRoomMsgTarget { protected: int _fieldBC; CString _string1; diff --git a/engines/titanic/sound/node_auto_sound_player.h b/engines/titanic/sound/node_auto_sound_player.h index acc766abec..fee4d3dae3 100644 --- a/engines/titanic/sound/node_auto_sound_player.h +++ b/engines/titanic/sound/node_auto_sound_player.h @@ -28,7 +28,8 @@ namespace Titanic { -class CNodeAutoSoundPlayer : public CAutoSoundPlayer, CEnterNodeMsgTarget { +class CNodeAutoSoundPlayer : public CAutoSoundPlayer, + public CEnterNodeMsgTarget { private: int _fieldEC; protected: diff --git a/engines/titanic/sound/room_auto_sound_player.h b/engines/titanic/sound/room_auto_sound_player.h index 82d23a79c3..c72aff1763 100644 --- a/engines/titanic/sound/room_auto_sound_player.h +++ b/engines/titanic/sound/room_auto_sound_player.h @@ -28,7 +28,8 @@ namespace Titanic { -class CRoomAutoSoundPlayer : public CAutoSoundPlayer, CEnterRoomMsgTarget { +class CRoomAutoSoundPlayer : public CAutoSoundPlayer, + public CEnterRoomMsgTarget { protected: virtual bool handleMessage(CEnterRoomMsg &msg); public: -- cgit v1.2.3 From 83c6ebb46668841310cae3766b57c391f459b05f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 24 Mar 2016 12:58:00 -0400 Subject: TITANIC: Fix view message handling --- engines/titanic/core/view_item.cpp | 3 +-- engines/titanic/events.cpp | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index 414cf302c0..8b6586f7f9 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -232,8 +232,7 @@ bool CViewItem::handleMouseMsg(CMouseMsg *msg, bool flag) { } Common::Array gameObjects; - CTreeItem *treeItem = scan(this); - while (treeItem) { + for (CTreeItem *treeItem = scan(this); treeItem; treeItem = treeItem->scan(this)) { CGameObject *gameObject = dynamic_cast(treeItem); if (gameObject) { if (gameObject->checkPoint(msg->_mousePos, 0, 1) && diff --git a/engines/titanic/events.cpp b/engines/titanic/events.cpp index 1f8ccce0dd..5202d7cb9c 100644 --- a/engines/titanic/events.cpp +++ b/engines/titanic/events.cpp @@ -102,8 +102,8 @@ uint32 Events::getTicksCount() const { return g_system->getMillis(); } -#define HANDLE_MESSAGE(method) if (_vm->_window->_inputAllowed) { \ - _vm->_window->_gameManager->_inputTranslator.leftButtonDown(_specialButtons, Point(_mousePos.x, _mousePos.y)); \ +#define HANDLE_MESSAGE(METHOD) if (_vm->_window->_inputAllowed) { \ + _vm->_window->_gameManager->_inputTranslator.METHOD(_specialButtons, Point(_mousePos.x, _mousePos.y)); \ _vm->_window->mouseChanged(); \ } -- cgit v1.2.3 From 71c0ad236e4a5f9c957c936a6084e4c519e626c7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 24 Mar 2016 13:16:21 -0400 Subject: TITANIC: Implement CGameObject::stopMovie --- engines/titanic/core/game_object.cpp | 5 +++-- engines/titanic/core/game_object.h | 5 ++++- engines/titanic/game_location.cpp | 4 ++-- engines/titanic/movie.cpp | 2 +- engines/titanic/movie.h | 7 ++++--- engines/titanic/video_surface.cpp | 11 ++++++++--- engines/titanic/video_surface.h | 15 ++++++++++++++- 7 files changed, 36 insertions(+), 13 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index e4ad4ccaea..810e4396cb 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -125,8 +125,9 @@ void CGameObject::load(SimpleFile *file) { CNamedItem::load(file); } -void CGameObject::fn2() { - error("TODO"); +void CGameObject::stopMovie() { + if (_surface) + _surface->stopMovie(); } bool CGameObject::checkPoint(const Point &pt, int v0, int v1) { diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 66aa9c400c..9d24f8eac1 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -115,7 +115,10 @@ public: */ virtual void draw(CScreenManager *screenManager); - void fn2(); + /** + * Stops any movie currently playing for the object + */ + void stopMovie(); bool checkPoint(const Point &pt, int v0, int v1); }; diff --git a/engines/titanic/game_location.cpp b/engines/titanic/game_location.cpp index 23c2ae2598..3a1d0c9e48 100644 --- a/engines/titanic/game_location.cpp +++ b/engines/titanic/game_location.cpp @@ -52,11 +52,11 @@ void CGameLocation::load(SimpleFile *file) { void CGameLocation::setView(CViewItem *view) { if (_view) { - for (CTreeItem *treeItem = view; treeItem; + for (CTreeItem *treeItem = _view; treeItem; treeItem = treeItem->scan(_view)) { CGameObject *obj = dynamic_cast(treeItem); if (obj) - obj->fn2(); + obj->stopMovie(); } } diff --git a/engines/titanic/movie.cpp b/engines/titanic/movie.cpp index d7a54d316d..04d57239e1 100644 --- a/engines/titanic/movie.cpp +++ b/engines/titanic/movie.cpp @@ -48,7 +48,7 @@ void OSMovie::proc12() { warning("TODO: OSMovie::proc12"); } -void OSMovie::proc13() { +void OSMovie::stop() { warning("TODO: OSMovie::proc13"); } diff --git a/engines/titanic/movie.h b/engines/titanic/movie.h index 5285508e78..7752fd8cc3 100644 --- a/engines/titanic/movie.h +++ b/engines/titanic/movie.h @@ -26,10 +26,11 @@ #include "video/avi_decoder.h" #include "titanic/core/list.h" #include "titanic/core/resource_key.h" -#include "titanic/video_surface.h" namespace Titanic { +class CVideoSurface; + class CMovie : public ListItem { public: virtual void proc8() = 0; @@ -37,7 +38,7 @@ public: virtual void proc10() = 0; virtual void proc11() = 0; virtual void proc12() = 0; - virtual void proc13() = 0; + virtual void stop() = 0; virtual void proc14() = 0; virtual void proc15() = 0; virtual void proc16() = 0; @@ -60,7 +61,7 @@ public: virtual void proc10(); virtual void proc11(); virtual void proc12(); - virtual void proc13(); + virtual void stop(); virtual void proc14(); virtual void proc15(); virtual void proc16(); diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp index 5cab6d1511..864eb6ba29 100644 --- a/engines/titanic/video_surface.cpp +++ b/engines/titanic/video_surface.cpp @@ -29,7 +29,7 @@ namespace Titanic { int CVideoSurface::_videoSurfaceCounter = 0; CVideoSurface::CVideoSurface(CScreenManager *screenManager) : - _screenManager(screenManager), _rawSurface(nullptr), _field34(nullptr), + _screenManager(screenManager), _rawSurface(nullptr), _movie(nullptr), _pendingLoad(false), _blitStyleFlag(false), _blitFlag(false), _field40(nullptr), _field44(4), _field48(0), _field50(1) { _videoSurfaceNum = _videoSurfaceCounter++; @@ -299,6 +299,11 @@ void OSVideoSurface::shiftColors() { unlock(); } +void OSVideoSurface::stopMovie() { + if (_movie) + _movie->stop(); +} + bool OSVideoSurface::loadIfReady() { _videoSurfaceNum = _videoSurfaceCounter; @@ -318,8 +323,8 @@ int OSVideoSurface::freeSurface() { return 0; int surfaceSize = _ddSurface->getSize(); - delete _field34; - _field34 = nullptr; + delete _movie; + _movie = nullptr; delete _ddSurface; _ddSurface = nullptr; diff --git a/engines/titanic/video_surface.h b/engines/titanic/video_surface.h index c6ecf1a5df..dd150abdad 100644 --- a/engines/titanic/video_surface.h +++ b/engines/titanic/video_surface.h @@ -27,6 +27,7 @@ #include "common/array.h" #include "titanic/font.h" #include "titanic/direct_draw.h" +#include "titanic/movie.h" #include "titanic/rect.h" #include "titanic/core/list.h" #include "titanic/core/resource_key.h" @@ -56,7 +57,7 @@ protected: CResourceKey _resourceKey; DirectDrawSurface *_ddSurface; Graphics::ManagedSurface *_rawSurface; - void *_field34; + CMovie *_movie; bool _pendingLoad; void *_field40; int _field44; @@ -138,6 +139,11 @@ public: */ virtual void shiftColors() = 0; + /** + * Stops any movie currently attached to the surface + */ + virtual void stopMovie() = 0; + /** * Loads the surface's resource if there's one pending */ @@ -153,6 +159,8 @@ public: */ virtual int freeSurface() { return 0; } + + /** * Blit from another surface */ @@ -235,6 +243,11 @@ public: */ virtual void shiftColors(); + /** + * Stops any movie currently attached to the surface + */ + virtual void stopMovie(); + /** * Loads the surface's resource if there's one pending */ -- cgit v1.2.3 From bbc810e909cd3403593be447cfa39db8b7bcefd1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 24 Mar 2016 13:19:29 -0400 Subject: TITANIC: Fix crash when looking at television --- engines/titanic/core/view_item.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index 8b6586f7f9..b0e30f5072 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -146,7 +146,8 @@ void CViewItem::enterView(CViewItem *newView) { CPetControl *petControl = nullptr; if (newRoom != nullptr) { petControl = newRoom->getRoot()->getPetControl(); - petControl->enterNode(newNode); + if (petControl) + petControl->enterNode(newNode); } if (newRoom != oldRoom) { -- cgit v1.2.3 From fd78a874ccfdbc652241dc4402f6ca96ca188170 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 24 Mar 2016 13:27:04 -0400 Subject: TITANIC: Added current location display to debugger room command --- engines/titanic/debugger.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/engines/titanic/debugger.cpp b/engines/titanic/debugger.cpp index 87ce07d189..3bd2d0f134 100644 --- a/engines/titanic/debugger.cpp +++ b/engines/titanic/debugger.cpp @@ -99,8 +99,15 @@ CViewItem *Debugger::findView(CNodeItem *node, const char *name) { } void Debugger::listRooms() { - CTreeItem *root = g_vm->_window->_gameManager->_project; - + CGameManager &gm = *g_vm->_window->_gameManager; + CTreeItem *root = gm._project; + CViewItem *view = gm._gameState._gameLocation.getView(); + CNodeItem *node = gm._gameState._gameLocation.getNode(); + CRoomItem *room = gm._gameState._gameLocation.getRoom(); + debugPrintf("Current location: %s, %s, %s\n", room->getName().c_str(), + node->getName().c_str(), view->getName().c_str()); + + debugPrintf("Available rooms:\n"); for (CTreeItem *treeItem = root; treeItem; treeItem = treeItem->scan(root)) { CRoomItem *roomItem = dynamic_cast(treeItem); if (roomItem) -- cgit v1.2.3 From c948e8812ebb619f22adb7794da6dcfb6d5d6b9e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 24 Mar 2016 21:02:25 -0400 Subject: TITANIC: Support methods needed by CTelevision --- engines/titanic/core/game_object.cpp | 37 +++++++++++++++++++- engines/titanic/core/game_object.h | 4 +++ engines/titanic/core/saveable_object.cpp | 10 ++++++ engines/titanic/core/tree_item.cpp | 29 ++++++++++++++++ engines/titanic/core/tree_item.h | 22 ++++++++++++ engines/titanic/game/television.cpp | 52 +++++++++++++++++++++++++++++ engines/titanic/game/television.h | 31 ++++++++++++++++- engines/titanic/game_manager.cpp | 4 --- engines/titanic/game_manager.h | 18 +++++++--- engines/titanic/messages/messages.cpp | 12 +++++++ engines/titanic/messages/messages.h | 7 ++++ engines/titanic/messages/pet_messages.h | 19 +++++++++++ engines/titanic/movie.cpp | 19 +++++------ engines/titanic/movie.h | 14 ++++---- engines/titanic/pet_control/pet_control.cpp | 5 +++ engines/titanic/pet_control/pet_control.h | 5 +++ engines/titanic/sound/sound.cpp | 17 ++++++++++ engines/titanic/sound/sound.h | 4 +++ engines/titanic/sound/sound_manager.cpp | 3 +- engines/titanic/sound/sound_manager.h | 4 +-- engines/titanic/video_surface.cpp | 5 +++ engines/titanic/video_surface.h | 10 ++++++ 22 files changed, 299 insertions(+), 32 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 810e4396cb..a1fde3f74e 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -230,7 +230,13 @@ void CGameObject::loadImage(const CString &name, bool pendingFlag) { } void CGameObject::loadFrame(int frameNumber) { - warning("CGameObject::loadFrame"); + if (frameNumber != -1 && !_resource.empty()) + loadResource(_resource); + + if (_surface) + _surface->setMovieFrame(frameNumber); + + makeDirty(); } void CGameObject::processClipList2() { @@ -247,4 +253,33 @@ void CGameObject::makeDirty() { makeDirty(_bounds); } +bool CGameObject::soundFn1(int val) { + if (val != 0 && val != -1) { + CGameManager *gameManager = getGameManager(); + if (gameManager) + return gameManager->_sound.fn1(val); + } + + return false; +} + +void CGameObject::soundFn2(int val, int val2) { + if (val != 0 && val != -1) { + CGameManager *gameManager = getGameManager(); + if (gameManager) { + if (val2) + gameManager->_sound.fn3(val, 0, val2); + else + gameManager->_sound.fn2(val); + } + } +} + +void CGameObject::set5C(int val) { + if (val != _field5C) { + _field5C = val; + makeDirty(); + } +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 9d24f8eac1..88ea8414ed 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -93,6 +93,10 @@ protected: CVideoSurface *_surface; CString _resource; int _fieldB8; +protected: + bool soundFn1(int val); + void soundFn2(int val, int val2); + void set5C(int val); public: int _field60; CursorId _cursorId; diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 1f7448f655..f7c715fd66 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -850,6 +850,11 @@ DEFFN(CPETSetStarDestinationMsg) DEFFN(CPETStarFieldLockMsg) DEFFN(CPETStereoFieldOnOffMsg) DEFFN(CPETTargetMsg) +DEFFN(CPETUpMsg) +DEFFN(CPETDownMsg) +DEFFN(CPETLeftMsg) +DEFFN(CPETRightMsg) +DEFFN(CPETActivateMsg) DEFFN(CPanningAwayFromParrotMsg) DEFFN(CParrotSpeakMsg) DEFFN(CParrotTriesChickenMsg) @@ -1427,6 +1432,11 @@ void CSaveableObject::initClassList() { ADDFN(CPETStarFieldLockMsg, CMessage); ADDFN(CPETStereoFieldOnOffMsg, CMessage); ADDFN(CPETTargetMsg, CMessage); + ADDFN(CPETUpMsg, CPETTargetMsg); + ADDFN(CPETDownMsg, CPETTargetMsg); + ADDFN(CPETLeftMsg, CPETTargetMsg); + ADDFN(CPETRightMsg, CPETTargetMsg); + ADDFN(CPETActivateMsg, CPETTargetMsg); ADDFN(CPanningAwayFromParrotMsg, CMessage); ADDFN(CParrotSpeakMsg, CMessage); ADDFN(CParrotTriesChickenMsg, CMessage); diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index a1dcce1abe..2c985bf34e 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -31,6 +31,8 @@ #include "titanic/core/project_item.h" #include "titanic/core/view_item.h" #include "titanic/core/room_item.h" +#include "titanic/pet_control/pet_control.h" +#include "titanic/game_manager.h" namespace Titanic { @@ -255,4 +257,31 @@ CNamedItem *CTreeItem::findByName(const CString &name, int maxLen) { return nullptr; } +int CTreeItem::compareRoomNameTo(const CString &name) { + CRoomItem *room = getGameManager()->getRoom(); + return room->getName().compareToIgnoreCase(name); +} + +void CTreeItem::clearPet() const { + CPetControl *petControl = getPetControl(); + if (petControl) + petControl->clear(); +} + +CPetControl *CTreeItem::getPetControl() const { + return dynamic_cast(getDontSaveChild(CPetControl::_type)); +} + +CTreeItem *CTreeItem::getDontSaveChild(ClassDef *classDef) const { + CProjectItem *root = getRoot(); + if (!root) + return nullptr; + + CDontSaveFileItem *dontSave = root->getDontSaveFileItem(); + if (!dontSave) + return nullptr; + + return dontSave->findChildInstanceOf(classDef); +} + } // End of namespace Titanic diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index e870ad1dc3..a6c09b8126 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -30,6 +30,7 @@ namespace Titanic { class CGameManager; class CDontSaveFileItem; class CNamedItem; +class CPetControl; class CProjectItem; class CScreenManager; @@ -220,6 +221,27 @@ public: * Finds a tree item by name */ CNamedItem *findByName(const CString &name, int maxLen = 0); + + /** + * Compare the name of the parent room to the item to a passed string + */ + int compareRoomNameTo(const CString &name); + + /** + * Clear the PET display + */ + void clearPet() const; + + /** + * Returns the PET control + */ + CPetControl *getPetControl() const; + + /** + * Returns a child of the Dont Save area of the project of the given class + */ + CTreeItem *getDontSaveChild(ClassDef *classDef) const; + }; } // End of namespace Titanic diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp index 4c6b38ad32..102049abbf 100644 --- a/engines/titanic/game/television.cpp +++ b/engines/titanic/game/television.cpp @@ -69,4 +69,56 @@ void CTelevision::load(SimpleFile *file) { CBackground::load(file); } +bool CTelevision::handleMessage(CLeaveViewMsg &msg) { + return true; +} + +bool CTelevision::handleMessage(CChangeSeasonMsg &msg) { + return true; +} + +bool CTelevision::handleMessage(CEnterViewMsg &msg) { + return true; +} + +bool CTelevision::handleMessage(CPETUpMsg &msg) { + return true; +} + +bool CTelevision::handleMessage(CPETDownMsg &msg) { + return true; +} + +bool CTelevision::handleMessage(CStatusChangeMsg &msg) { + return true; +} + +bool CTelevision::handleMessage(CActMsg &msg) { + return true; +} + +bool CTelevision::handleMessage(CPETActivateMsg &msg) { + return true; +} + +bool CTelevision::handleMessage(CMovieEndMsg &msg) { + return true; +} + +bool CTelevision::handleMessage(CShipSettingMsg &msg) { + return true; +} + +bool CTelevision::handleMessage(CTurnOff &msg) { + return true; +} + +bool CTelevision::handleMessage(CTurnOn &msg) { + return true; +} + +bool CTelevision::handleMessage(CLightsMsg &msg) { + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/television.h b/engines/titanic/game/television.h index d64c253d90..04c201e681 100644 --- a/engines/titanic/game/television.h +++ b/engines/titanic/game/television.h @@ -24,10 +24,25 @@ #define TITANIC_TELEVISION_H #include "titanic/core/background.h" +#include "titanic/messages/messages.h" +#include "titanic/messages/pet_messages.h" namespace Titanic { -class CTelevision : public CBackground { +class CTelevision : public CBackground, + public CLeaveViewMsgTarget, + public CChangeSeasonMsgTarget, + public CEnterViewMsgTarget, + public CPETUpMsgTarget, + public CPETDownMsgTarget, + public CStatusChangeMsgTarget, + public CActMsgTarget, + public CPETActivateMsgTarget, + public CMovieEndMsgTarget, + public CShipSettingMsgTarget, + public CTurnOffTarget, + public CTurnOnTarget, + public CLightsMsgTarget { private: static int _v1; static int _v2; @@ -41,6 +56,20 @@ private: int _fieldE8; int _fieldEC; int _fieldF0; +protected: + virtual bool handleMessage(CLeaveViewMsg &msg); + virtual bool handleMessage(CChangeSeasonMsg &msg); + virtual bool handleMessage(CEnterViewMsg &msg); + virtual bool handleMessage(CPETUpMsg &msg); + virtual bool handleMessage(CPETDownMsg &msg); + virtual bool handleMessage(CStatusChangeMsg &msg); + virtual bool handleMessage(CActMsg &msg); + virtual bool handleMessage(CPETActivateMsg &msg); + virtual bool handleMessage(CMovieEndMsg &msg); + virtual bool handleMessage(CShipSettingMsg &msg); + virtual bool handleMessage(CTurnOff &msg); + virtual bool handleMessage(CTurnOn &msg); + virtual bool handleMessage(CLightsMsg &msg); public: CLASSDEF CTelevision(); diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index 23cb26e146..d5547a3ab7 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -213,10 +213,6 @@ void CGameManager::viewChange() { initBounds(); } -CRoomItem *CGameManager::getRoom() { - return _gameState._gameLocation.getRoom(); -} - void CGameManager::frameMessage(CRoomItem *room) { if (room) { // Signal the next frame diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index 610c438cfa..6ad0843e96 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -95,11 +95,6 @@ private: uint _lastDiskTicksCount; uint _tickCount2; private: - /** - * Return the current room - */ - CRoomItem *getRoom(); - /** * Generates a message for the next game frame */ @@ -153,8 +148,21 @@ public: */ void updateDiskTicksCount(); + /** + * Gets the current view + */ CViewItem *getView() { return _gameState._gameLocation.getView(); } + /** + * Gets the current room node + */ + CNodeItem *getNode() { return _gameState._gameLocation.getNode(); } + + /** + * Gets the current room + */ + CRoomItem *getRoom() { return _gameState._gameLocation.getRoom(); } + /** * Lock the input handler */ diff --git a/engines/titanic/messages/messages.cpp b/engines/titanic/messages/messages.cpp index 28b8856578..1c3d406b1b 100644 --- a/engines/titanic/messages/messages.cpp +++ b/engines/titanic/messages/messages.cpp @@ -24,6 +24,7 @@ #include "titanic/messages/mouse_messages.h" #include "titanic/core/game_object.h" #include "titanic/core/tree_item.h" +#include "titanic/titanic.h" namespace Titanic { @@ -67,6 +68,17 @@ bool CMessage::execute(CTreeItem *target, const ClassDef *classDef, int flags) { return result; } +bool CMessage::execute(const CString &target, const ClassDef *classDef, int flags) { + // Scan for the target by name + CProjectItem *project = g_vm->_window->_project; + for (CTreeItem *treeItem = project; treeItem; treeItem = treeItem->scan(project)) { + if (treeItem->getName().compareToIgnoreCase(target)) + return execute(treeItem, classDef, flags); + } + + return false; +} + bool CMessage::isMouseMsg() const { return dynamic_cast(this) != nullptr; } diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index c945ad7736..b7a7cd6e7b 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -54,6 +54,13 @@ public: bool execute(CTreeItem *target, const ClassDef *classDef = nullptr, int flags = MSGFLAG_SCAN | MSGFLAG_BREAK_IF_HANDLED); + /** + * Executes the message, passing it on to the designated target, + * and optionally it's children + */ + bool execute(const CString &target, const ClassDef *classDef = nullptr, + int flags = MSGFLAG_SCAN | MSGFLAG_BREAK_IF_HANDLED); + virtual bool perform(CTreeItem *treeItem) { return false; } /** diff --git a/engines/titanic/messages/pet_messages.h b/engines/titanic/messages/pet_messages.h index ac9c3ccc75..caca53dfee 100644 --- a/engines/titanic/messages/pet_messages.h +++ b/engines/titanic/messages/pet_messages.h @@ -42,6 +42,25 @@ MESSAGE1(CPETStarFieldLockMsg, int, value, 0); MESSAGE0(CPETStereoFieldOnOffMsg); MESSAGE2(CPETTargetMsg, CString, strValue, "", int, numValue, -1); +#define PET_MESSAGE(NAME) MSGTARGET(NAME); \ + class NAME: public CPETTargetMsg { \ + public: \ + NAME() : CPETTargetMsg() {} \ + NAME(const CString &name, int num) : CPETTargetMsg(name, num) {} \ + CLASSDEF \ + static bool isSupportedBy(const CTreeItem *item) { \ + return dynamic_cast(item) != nullptr; } \ + virtual bool perform(CTreeItem *treeItem) { \ + NAME##Target *dest = dynamic_cast(treeItem); \ + return dest != nullptr && dest->handleMessage(*this); \ + } } + +PET_MESSAGE(CPETDownMsg); +PET_MESSAGE(CPETUpMsg); +PET_MESSAGE(CPETLeftMsg); +PET_MESSAGE(CPETRightMsg); +PET_MESSAGE(CPETActivateMsg); + } // End of namespace Titanic #endif /* TITANIC_PET_MESSAGES_H */ diff --git a/engines/titanic/movie.cpp b/engines/titanic/movie.cpp index 04d57239e1..58da09e61f 100644 --- a/engines/titanic/movie.cpp +++ b/engines/titanic/movie.cpp @@ -56,8 +56,14 @@ void OSMovie::proc14() { warning("TODO: OSMovie::proc14"); } -void OSMovie::proc15() { - warning("TODO: OSMovie::proc15"); +void OSMovie::setFrame(uint frameNumber) { + warning("TODO: OSMovie::setFrame"); + /* + _aviDecoder.seekToFrame(frameNumber); + const Graphics::Surface *s = _aviDecoder.decodeNextFrame(); + + _videoSurface->blitFrom(Common::Point(0, 0), s); + */ } void OSMovie::proc16() { @@ -85,13 +91,4 @@ void *OSMovie::proc21() { return nullptr; } -void OSMovie::setFrame(uint frameNumber) { - /* - _aviDecoder.seekToFrame(frameNumber); - const Graphics::Surface *s = _aviDecoder.decodeNextFrame(); - - _videoSurface->blitFrom(Common::Point(0, 0), s); - */ -} - } // End of namespace Titanic diff --git a/engines/titanic/movie.h b/engines/titanic/movie.h index 7752fd8cc3..4409712809 100644 --- a/engines/titanic/movie.h +++ b/engines/titanic/movie.h @@ -40,7 +40,7 @@ public: virtual void proc12() = 0; virtual void stop() = 0; virtual void proc14() = 0; - virtual void proc15() = 0; + virtual void setFrame(uint frameNumber) = 0; virtual void proc16() = 0; virtual void proc17() = 0; virtual void proc18() = 0; @@ -63,18 +63,18 @@ public: virtual void proc12(); virtual void stop(); virtual void proc14(); - virtual void proc15(); + + /** + * Set the current frame number + */ + virtual void setFrame(uint frameNumber); + virtual void proc16(); virtual void proc17(); virtual void proc18(); virtual void proc19(); virtual void proc20(); virtual void *proc21(); - - /** - * Set the current frame number - */ - void setFrame(uint frameNumber); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 5886ce4169..097c72d586 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -97,4 +97,9 @@ void CPetControl::enterRoom(CRoomItem *room) { _sub3.enterRoom(room); } +void CPetControl::clear() { + _field1394 = 0; + _string2.clear(); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index df529aed6a..e2b31bea4a 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -94,6 +94,11 @@ public: * Called when a new room is entered */ void enterRoom(CRoomItem *room); + + /** + * Called to clear the PET display + */ + void clear(); }; } // End of namespace Titanic diff --git a/engines/titanic/sound/sound.cpp b/engines/titanic/sound/sound.cpp index 14dba2e152..b3b783d4c6 100644 --- a/engines/titanic/sound/sound.cpp +++ b/engines/titanic/sound/sound.cpp @@ -47,4 +47,21 @@ void CSound::preEnterView(CViewItem *newView, bool isNewRoom) { warning("CSound::preEnterView"); } +bool CSound::fn1(int val) { + if (val == 0 || val == -1) { + if (!_soundManager.proc14()) + return true; + } + + return false; +} + +void CSound::fn2(int val) { + warning("TODO: CSound::fn3"); +} + +void CSound::fn3(int val, int val2, int val3) { + warning("TODO: CSound::fn3"); +} + } // End of namespace Titanic z diff --git a/engines/titanic/sound/sound.h b/engines/titanic/sound/sound.h index 4c0dab5dd5..fe115f7237 100644 --- a/engines/titanic/sound/sound.h +++ b/engines/titanic/sound/sound.h @@ -72,6 +72,10 @@ public: * Called when the view has been changed */ void preEnterView(CViewItem *newView, bool isNewRoom); + + bool fn1(int val); + void fn2(int val); + void fn3(int val, int val2, int val3); }; } // End of namespace Titanic diff --git a/engines/titanic/sound/sound_manager.cpp b/engines/titanic/sound/sound_manager.cpp index 143dd8385f..f575411c82 100644 --- a/engines/titanic/sound/sound_manager.cpp +++ b/engines/titanic/sound/sound_manager.cpp @@ -81,8 +81,9 @@ void QSoundManager::proc13() { warning("TODO"); } -void QSoundManager::proc14() { +bool QSoundManager::proc14() { warning("TODO"); + return false; } int QSoundManager::proc15() { diff --git a/engines/titanic/sound/sound_manager.h b/engines/titanic/sound/sound_manager.h index 99513aefe8..29fbb5ad11 100644 --- a/engines/titanic/sound/sound_manager.h +++ b/engines/titanic/sound/sound_manager.h @@ -48,7 +48,7 @@ public: virtual void proc11() = 0; virtual void proc12() {} virtual void proc13() {} - virtual void proc14() = 0; + virtual bool proc14() = 0; virtual int proc15() const { return 0; } virtual int proc16() const { return 0; } virtual void WaveMixPump() {} @@ -111,7 +111,7 @@ public: virtual void proc11(); virtual void proc12(); virtual void proc13(); - virtual void proc14(); + virtual bool proc14(); virtual int proc15(); virtual int proc16(); virtual void WaveMixPump(); diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp index 864eb6ba29..7a4aba565f 100644 --- a/engines/titanic/video_surface.cpp +++ b/engines/titanic/video_surface.cpp @@ -304,6 +304,11 @@ void OSVideoSurface::stopMovie() { _movie->stop(); } +void OSVideoSurface::setMovieFrame(uint frameNumber) { + if (loadIfReady() && _movie) + _movie->setFrame(frameNumber); +} + bool OSVideoSurface::loadIfReady() { _videoSurfaceNum = _videoSurfaceCounter; diff --git a/engines/titanic/video_surface.h b/engines/titanic/video_surface.h index dd150abdad..f3459b456f 100644 --- a/engines/titanic/video_surface.h +++ b/engines/titanic/video_surface.h @@ -144,6 +144,11 @@ public: */ virtual void stopMovie() = 0; + /** + * Sets the movie to the specified frame number + */ + virtual void setMovieFrame(uint frameNumber) = 0; + /** * Loads the surface's resource if there's one pending */ @@ -248,6 +253,11 @@ public: */ virtual void stopMovie(); + /** + * Sets the movie to the specified frame number + */ + virtual void setMovieFrame(uint frameNumber); + /** * Loads the surface's resource if there's one pending */ -- cgit v1.2.3 From f0a6cf38cff8e79a579454af5bf22d264de3d7f7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 24 Mar 2016 21:12:30 -0400 Subject: TITANIC: Implement television CLeaveViewMsg handler --- engines/titanic/core/game_object.h | 10 +++++----- engines/titanic/game/television.cpp | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 88ea8414ed..1ccbb7d85f 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -51,11 +51,6 @@ private: */ void loadImage(const CString &name, bool pendingFlag = true); - /** - * Loads a frame - */ - void loadFrame(int frameNumber); - void processClipList2(); /** @@ -94,6 +89,11 @@ protected: CString _resource; int _fieldB8; protected: + /** + * Loads a frame + */ + void loadFrame(int frameNumber); + bool soundFn1(int val); void soundFn2(int val, int val2); void set5C(int val); diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp index 102049abbf..08f29df7f9 100644 --- a/engines/titanic/game/television.cpp +++ b/engines/titanic/game/television.cpp @@ -70,6 +70,22 @@ void CTelevision::load(SimpleFile *file) { } bool CTelevision::handleMessage(CLeaveViewMsg &msg) { + clearPet(); + if (_fieldE8) { + if (soundFn1(_fieldF0)) + soundFn2(_fieldF0, 0); + + loadFrame(622); + stopMovie(); + set5C(0); + _fieldE8 = 0; + + if (compareRoomNameTo("CSGState")) { + CVisibleMsg visibleMsg(1, 0); + visibleMsg.execute("Tellypic"); + } + } + return true; } -- cgit v1.2.3 From 02b46202bec88eb21b322fb9480de9eb8965dd01 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 24 Mar 2016 22:09:49 -0400 Subject: TITANIC: Implementing more CTelevision message handlers --- engines/titanic/core/game_object.cpp | 28 +++++++++-- engines/titanic/core/game_object.h | 9 +++- engines/titanic/game/television.cpp | 74 ++++++++++++++++++++++++++--- engines/titanic/game/television.h | 2 +- engines/titanic/messages/messages.h | 2 +- engines/titanic/messages/pet_messages.h | 2 +- engines/titanic/pet_control/pet_control.cpp | 13 +++++ engines/titanic/pet_control/pet_control.h | 6 +++ 8 files changed, 122 insertions(+), 14 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index a1fde3f74e..a442f09937 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -27,6 +27,7 @@ #include "titanic/video_surface.h" #include "titanic/core/game_object.h" #include "titanic/core/resource_key.h" +#include "titanic/pet_control/pet_control.h" namespace Titanic { @@ -44,7 +45,7 @@ CGameObject::CGameObject(): CNamedItem() { _field50 = 0; _field54 = 0; _field58 = 0; - _field5C = 1; + _field5C = true; _field60 = 0; _cursorId = CURSOR_1; _field78 = 0; @@ -105,7 +106,7 @@ void CGameObject::load(SimpleFile *file) { _field48 = file->readNumber(); _field4C = file->readNumber(); _fieldB8 = file->readNumber(); - _field5C = file->readNumber(); + _field5C = file->readNumber() != 0; _field50 = file->readNumber(); _field54 = file->readNumber(); _field58 = file->readNumber(); @@ -275,11 +276,32 @@ void CGameObject::soundFn2(int val, int val2) { } } -void CGameObject::set5C(int val) { +void CGameObject::set5C(bool val) { if (val != _field5C) { _field5C = val; makeDirty(); } } +bool CGameObject::petFn1(int val) { + CPetControl *pet = getPetControl(); + return pet ? pet->fn1(val) : true; +} + +void CGameObject::petFn2(int val) { + CPetControl *pet = getPetControl(); + if (pet) + pet->fn2(val); +} + +void CGameObject::petFn3(int val) { + CPetControl *pet = getPetControl(); + if (pet) + pet->fn3(val); +} + +void CGameObject::fn1(int val1, int val2, int val3) { + warning("TODO: CGameObject::fn1"); +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 1ccbb7d85f..46ec502c56 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -74,7 +74,7 @@ protected: int _field50; int _field54; int _field58; - int _field5C; + bool _field5C; CMovieClipList _clipList1; int _field78; CMovieClipList _clipList2; @@ -96,7 +96,10 @@ protected: bool soundFn1(int val); void soundFn2(int val, int val2); - void set5C(int val); + void set5C(bool val); + bool petFn1(int val); + void petFn2(int val); + void petFn3(int val); public: int _field60; CursorId _cursorId; @@ -125,6 +128,8 @@ public: void stopMovie(); bool checkPoint(const Point &pt, int v0, int v1); + + void fn1(int val1, int val2, int val3); }; } // End of namespace Titanic diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp index 08f29df7f9..e7a1b8dbb4 100644 --- a/engines/titanic/game/television.cpp +++ b/engines/titanic/game/television.cpp @@ -32,7 +32,7 @@ int CTelevision::_v5; int CTelevision::_v6; CTelevision::CTelevision() : CBackground(), _fieldE0(1), - _fieldE4(7), _fieldE8(0), _fieldEC(0), _fieldF0(0) { + _fieldE4(7), _isOn(false), _fieldEC(0), _fieldF0(0) { } void CTelevision::save(SimpleFile *file, int indent) const { @@ -41,7 +41,7 @@ void CTelevision::save(SimpleFile *file, int indent) const { file->writeNumberLine(_v1, indent); file->writeNumberLine(_fieldE4, indent); file->writeNumberLine(_v2, indent); - file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_isOn, indent); file->writeNumberLine(_v3, indent); file->writeNumberLine(_fieldEC, indent); file->writeNumberLine(_v4, indent); @@ -58,7 +58,7 @@ void CTelevision::load(SimpleFile *file) { _v1 = file->readNumber(); _fieldE4 = file->readNumber(); _v2 = file->readNumber(); - _fieldE8 = file->readNumber(); + _isOn = file->readNumber() != 0; _v3 = file->readNumber(); _fieldEC = file->readNumber(); _v4 = file->readNumber(); @@ -71,14 +71,14 @@ void CTelevision::load(SimpleFile *file) { bool CTelevision::handleMessage(CLeaveViewMsg &msg) { clearPet(); - if (_fieldE8) { + if (_isOn) { if (soundFn1(_fieldF0)) soundFn2(_fieldF0, 0); loadFrame(622); stopMovie(); set5C(0); - _fieldE8 = 0; + _isOn = false; if (compareRoomNameTo("CSGState")) { CVisibleMsg visibleMsg(1, 0); @@ -90,26 +90,88 @@ bool CTelevision::handleMessage(CLeaveViewMsg &msg) { } bool CTelevision::handleMessage(CChangeSeasonMsg &msg) { + if (msg._season.compareTo("Autumn")) { + _v1 = 545; + _v3 = 0; + } else if (msg._season.compareTo("Winter")) { + _v1 = 503; + _v3 = 0; + } else if (msg._season.compareTo("Spring")) { + _v1 = 517; + _v3 = 0; + } else if (msg._season.compareTo("Winter")) { + _v1 = 531; + _v3 = 0; + } + return true; } bool CTelevision::handleMessage(CEnterViewMsg &msg) { + petFn1(2); + petFn2(2); + petFn3(0); + set5C(0); + _fieldE0 = 1; + return true; } +static const int FRAMES1[9] = { 0, 0, 56, 112, 168, 224, 280, 336, 392 }; +static const int FRAMES2[8] = { 0, 55, 111, 167, 223, 279, 335, 391 }; + bool CTelevision::handleMessage(CPETUpMsg &msg) { + if (msg._name == "Television" && _isOn) { + if (soundFn1(_fieldF0)) + soundFn2(_fieldF0, 0); + + _fieldE0 = _fieldE0 % _fieldE4 + 1; + stopMovie(); + fn1(FRAMES1[_fieldE0], FRAMES2[_fieldE0], 4); + } + return true; } bool CTelevision::handleMessage(CPETDownMsg &msg) { - return true; + if (msg._name == "Television" && _isOn) { + if (soundFn1(_fieldF0)) + soundFn2(_fieldF0, 0); + if (--_fieldE0 < 1) + _fieldE0 += _fieldE4; + + _fieldE0 = _fieldE0 % _fieldE4 + 1; + stopMovie(); + fn1(FRAMES1[_fieldE0], FRAMES2[_fieldE0], 4); + } + + return true; } bool CTelevision::handleMessage(CStatusChangeMsg &msg) { + if (_isOn) { + stopMovie(); + // TODO: + } + warning("TODO"); + return true; } bool CTelevision::handleMessage(CActMsg &msg) { + if (msg._action == "TurnTVOnOff") { + _isOn = !_isOn; + if (_isOn) { + set5C(true); + CStatusChangeMsg changeMsg; + changeMsg.execute(this); + } else { + // TODO: Should 5C be a boolean? + set5C(_isOn); + stopMovie(); + } + } + return true; } diff --git a/engines/titanic/game/television.h b/engines/titanic/game/television.h index 04c201e681..ed41606c57 100644 --- a/engines/titanic/game/television.h +++ b/engines/titanic/game/television.h @@ -53,7 +53,7 @@ private: private: int _fieldE0; int _fieldE4; - int _fieldE8; + bool _isOn; int _fieldEC; int _fieldF0; protected: diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index b7a7cd6e7b..493152b299 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -252,7 +252,7 @@ public: return dest != nullptr && dest->handleMessage(*this); \ } } -MESSAGE1(CActMsg, CString, value, ""); +MESSAGE1(CActMsg, CString, action, ""); MESSAGE1(CActivationmsg, CString, value, ""); MESSAGE1(CAddHeadPieceMsg, CString, value, "NULL"); MESSAGE1(CAnimateMaitreDMsg, int, value, 0); diff --git a/engines/titanic/messages/pet_messages.h b/engines/titanic/messages/pet_messages.h index caca53dfee..7e39056742 100644 --- a/engines/titanic/messages/pet_messages.h +++ b/engines/titanic/messages/pet_messages.h @@ -40,7 +40,7 @@ MESSAGE0(CPETReceiveMsg); MESSAGE0(CPETSetStarDestinationMsg); MESSAGE1(CPETStarFieldLockMsg, int, value, 0); MESSAGE0(CPETStereoFieldOnOffMsg); -MESSAGE2(CPETTargetMsg, CString, strValue, "", int, numValue, -1); +MESSAGE2(CPETTargetMsg, CString, name, "", int, numValue, -1); #define PET_MESSAGE(NAME) MSGTARGET(NAME); \ class NAME: public CPETTargetMsg { \ diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 097c72d586..920e6b24d9 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -102,4 +102,17 @@ void CPetControl::clear() { _string2.clear(); } +bool CPetControl::fn1(int val) { + warning("TODO: CPetControl::fn1"); + return false; +} + +void CPetControl::fn2(int val) { + warning("TODO: CPetControl::fn2"); +} + +void CPetControl::fn3(int val) { + warning("TODO: CPetControl::fn3"); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index e2b31bea4a..1beded2453 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -99,6 +99,12 @@ public: * Called to clear the PET display */ void clear(); + + bool fn1(int val); + + void fn2(int val); + + void fn3(int val); }; } // End of namespace Titanic -- cgit v1.2.3 From 0b37ac18693c7f51212f250b8a9990071a1dda2b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 24 Mar 2016 22:40:07 -0400 Subject: TITANIC: Implementing more CTelevision message handlers --- engines/titanic/game/television.cpp | 52 ++++++++++++++++++++++++++--- engines/titanic/game/television.h | 4 ++- engines/titanic/messages/messages.h | 4 +-- engines/titanic/pet_control/pet_control.cpp | 4 +++ engines/titanic/pet_control/pet_control.h | 2 ++ engines/titanic/titanic.cpp | 3 ++ 6 files changed, 62 insertions(+), 7 deletions(-) diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp index e7a1b8dbb4..cb59647cc1 100644 --- a/engines/titanic/game/television.cpp +++ b/engines/titanic/game/television.cpp @@ -21,11 +21,12 @@ */ #include "titanic/game/television.h" +#include "titanic/pet_control/pet_control.h" namespace Titanic { int CTelevision::_v1; -int CTelevision::_v2; +bool CTelevision::_turnOn; int CTelevision::_v3; int CTelevision::_v4; int CTelevision::_v5; @@ -35,12 +36,24 @@ CTelevision::CTelevision() : CBackground(), _fieldE0(1), _fieldE4(7), _isOn(false), _fieldEC(0), _fieldF0(0) { } +void CTelevision::init() { + _v1 = 531; + _turnOn = true; + _v3 = 0; + _v4 = 27; + _v5 = 1; + _v6 = 1; +} + +void CTelevision::deinit() { +} + void CTelevision::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); file->writeNumberLine(_v1, indent); file->writeNumberLine(_fieldE4, indent); - file->writeNumberLine(_v2, indent); + file->writeNumberLine(_turnOn, indent); file->writeNumberLine(_isOn, indent); file->writeNumberLine(_v3, indent); file->writeNumberLine(_fieldEC, indent); @@ -57,7 +70,7 @@ void CTelevision::load(SimpleFile *file) { _fieldE0 = file->readNumber(); _v1 = file->readNumber(); _fieldE4 = file->readNumber(); - _v2 = file->readNumber(); + _turnOn = file->readNumber() != 0; _isOn = file->readNumber() != 0; _v3 = file->readNumber(); _fieldEC = file->readNumber(); @@ -81,7 +94,7 @@ bool CTelevision::handleMessage(CLeaveViewMsg &msg) { _isOn = false; if (compareRoomNameTo("CSGState")) { - CVisibleMsg visibleMsg(1, 0); + CVisibleMsg visibleMsg(true); visibleMsg.execute("Tellypic"); } } @@ -176,26 +189,57 @@ bool CTelevision::handleMessage(CActMsg &msg) { } bool CTelevision::handleMessage(CPETActivateMsg &msg) { + if (msg._name == "Television") { + CVisibleMsg visibleMsg(_isOn); + _isOn = !_isOn; + + if (_isOn) { + set5C(true); + fn1(0, 55, 0); + _fieldE0 = 1; + } else { + stopMovie(); + if (soundFn1(_fieldF0)) + soundFn2(_fieldF0, 0); + + set5C(false); + } + + if (compareRoomNameTo("SGTState")) + visibleMsg.execute("Tellypic"); + } + return true; } bool CTelevision::handleMessage(CMovieEndMsg &msg) { + warning("TODO: CMovieEndMsg"); return true; } bool CTelevision::handleMessage(CShipSettingMsg &msg) { + _v4 = msg._value; return true; } bool CTelevision::handleMessage(CTurnOff &msg) { + _turnOn = false; return true; } bool CTelevision::handleMessage(CTurnOn &msg) { + _turnOn = true; return true; } bool CTelevision::handleMessage(CLightsMsg &msg) { + CPetControl *pet = getPetControl(); + if (pet) + pet->fn4(); + + if (msg._field8 || !_turnOn) + _turnOn = true; + return true; } diff --git a/engines/titanic/game/television.h b/engines/titanic/game/television.h index ed41606c57..3b44f80c1a 100644 --- a/engines/titanic/game/television.h +++ b/engines/titanic/game/television.h @@ -45,7 +45,7 @@ class CTelevision : public CBackground, public CLightsMsgTarget { private: static int _v1; - static int _v2; + static bool _turnOn; static int _v3; static int _v4; static int _v5; @@ -73,6 +73,8 @@ protected: public: CLASSDEF CTelevision(); + static void init(); + static void deinit(); /** * Save the data for the class to file diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 493152b299..77d53f21a6 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -369,7 +369,7 @@ MESSAGE1(CSetChevRoomBits, int, value, 0); MESSAGE0(CSetMusicControlsMsg); MESSAGE2(CSetVarMsg, CString, varName, "", int, value, 0); MESSAGE2(CSetVolumeMsg, int, value1, 70, int, value2, 0); -MESSAGE2(CShipSettingMsg, CString, strValue, "", int, numValue, 0); +MESSAGE2(CShipSettingMsg, int, value, 0, CString, name, ""); MESSAGE1(CShowTextMsg, CString, value, "NO TEXT INCLUDED!!!"); MESSAGE2(CSignalObject, CString, strValue, "", int, numValue, 0); MESSAGE2(CSpeechFallsFromTreeMsg, int, value1, 0, int, value2, 0); @@ -405,7 +405,7 @@ MESSAGE1(CUse, int, value, 0); MESSAGE1(CUseWithCharMsg, int, value, 0); MESSAGE1(CUseWithOtherMsg, int, value, 0); MESSAGE1(CVirtualKeyCharMsg, int, value, 0); -MESSAGE2(CVisibleMsg, int, value1, 1, int, value2, 0); +MESSAGE1(CVisibleMsg, bool, visible, true); } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 920e6b24d9..f3e78a2212 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -115,4 +115,8 @@ void CPetControl::fn3(int val) { warning("TODO: CPetControl::fn3"); } +void CPetControl::fn4() { + warning("TODO: CPetControl::fn4"); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 1beded2453..b0762736fb 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -105,6 +105,8 @@ public: void fn2(int val); void fn3(int val); + + void fn4(); }; } // End of namespace Titanic diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index 4d43199184..82d0997744 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -33,6 +33,7 @@ #include "titanic/carry/hose.h" #include "titanic/core/saveable_object.h" #include "titanic/game/get_lift_eye2.h" +#include "titanic/game/television.h" #include "titanic/game/parrot/parrot_lobby_object.h" #include "titanic/game/sgt/sgt_navigation.h" #include "titanic/game/sgt/sgt_state_room.h" @@ -84,6 +85,7 @@ void TitanicEngine::initialize() { CSGTStateRoom::init(); CExitPellerator::init(); CEnterExitSecClassMiniLift::init(); + CTelevision::init(); _debugger = new Debugger(this); _events = new Events(this); @@ -101,6 +103,7 @@ void TitanicEngine::deinitialize() { CSGTStateRoom::deinit(); CExitPellerator::deinit(); CEnterExitSecClassMiniLift::deinit(); + CTelevision::deinit(); } Common::Error TitanicEngine::run() { -- cgit v1.2.3 From 73204984098c96ecc28a1367a5da9613e7103a35 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 25 Mar 2016 00:01:15 -0400 Subject: TITANIC: Implementing more CTelevision code, CGameState movie list --- engines/titanic/core/game_object.cpp | 16 ++++++++++++++++ engines/titanic/core/game_object.h | 5 +++++ engines/titanic/core/list.h | 12 ++++++++++++ engines/titanic/game/television.cpp | 2 +- engines/titanic/game_state.cpp | 36 +++++++++++++++++++++++++----------- engines/titanic/game_state.h | 18 ++++++++++++++---- engines/titanic/movie.cpp | 9 ++++++++- engines/titanic/movie.h | 10 ++++++++-- engines/titanic/titanic.h | 2 ++ engines/titanic/video_surface.cpp | 5 +++++ engines/titanic/video_surface.h | 6 +++++- 11 files changed, 101 insertions(+), 20 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index a442f09937..a215633932 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -304,4 +304,20 @@ void CGameObject::fn1(int val1, int val2, int val3) { warning("TODO: CGameObject::fn1"); } +void CGameObject::changeStatus(int newStatus) { + if (_frameNumber == -1 && !_resource.empty()) { + loadResource(_resource); + _resource.clear(); + } + + CVideoSurface *surface = (newStatus & 4) ? _surface : nullptr; + if (_surface) { + _surface->proc32(newStatus, surface); + + if (newStatus & 0x10) { + getGameManager()->_gameState.addMovie(_surface->_movie); + } + } +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 46ec502c56..2f56f599a0 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -130,6 +130,11 @@ public: bool checkPoint(const Point &pt, int v0, int v1); void fn1(int val1, int val2, int val3); + + /** + * Change the object's status + */ + void changeStatus(int newStatus); }; } // End of namespace Titanic diff --git a/engines/titanic/core/list.h b/engines/titanic/core/list.h index e3623c15b4..63bd6227b9 100644 --- a/engines/titanic/core/list.h +++ b/engines/titanic/core/list.h @@ -71,6 +71,8 @@ public: template class List : public CSaveableObject, public Common::List { public: + virtual ~List() { destroyContents(); } + /** * Save the data for the class to file */ @@ -145,6 +147,16 @@ public: Common::List::push_back(item); return item; } + + bool contains(const T *item) const { + for (Common::List::const_iterator i = Common::List::begin(); + i != Common::List::end(); ++i) { + if (*i == item) + return true; + } + + return false; + } }; } // End of namespace Titanic diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp index cb59647cc1..8149b8d017 100644 --- a/engines/titanic/game/television.cpp +++ b/engines/titanic/game/television.cpp @@ -164,7 +164,7 @@ bool CTelevision::handleMessage(CPETDownMsg &msg) { bool CTelevision::handleMessage(CStatusChangeMsg &msg) { if (_isOn) { stopMovie(); - // TODO: + changeStatus(1); } warning("TODO"); diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index 2885b3ad0c..d191d982b0 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -27,9 +27,18 @@ namespace Titanic { -bool CGameStateList::isViewChanging() const { - warning("TODO: CGameStateList::isViewChanging"); - return false; +bool CGameStateMovieList::clear() { + for (iterator i = begin(); i != end(); ) { + CMovieListItem *listItem = *i; + ++i; + + if (!g_vm->_movieList.contains(listItem->_item)) { + remove(listItem); + delete listItem; + } + } + + return size() > 0; } /*------------------------------------------------------------------------*/ @@ -98,20 +107,20 @@ void CGameState::enterNode() { void CGameState::enterView() { CViewItem *oldView = _gameLocation.getView(); - CViewItem *newView = _list._view; + CViewItem *newView = _movieList._view; oldView->preEnterView(newView); _gameManager->_gameView->setView(newView); CRoomItem *oldRoom = oldView->findNode()->findRoom(); CRoomItem *newRoom = newView->findNode()->findRoom(); - _gameManager->playClip(_list._movieClip, oldRoom, newRoom); + _gameManager->playClip(_movieList._movieClip, oldRoom, newRoom); _gameManager->_sound.preEnterView(newView, newRoom != oldRoom); _gameManager->dec54(); oldView->enterView(newView); - _list._view = nullptr; - _list._movieClip = nullptr; + _movieList._view = nullptr; + _movieList._movieClip = nullptr; } void CGameState::triggerLink(CLinkItem *link) { @@ -128,8 +137,8 @@ void CGameState::changeView(CViewItem *newView, CMovieClip *clip) { clip = nullptr; if (_mode == GSMODE_2) { - _list._view = newView; - _list._movieClip = clip; + _movieList._view = newView; + _movieList._movieClip = clip; } else { oldView->preEnterView(newView); _gameManager->_gameView->setView(newView); @@ -147,11 +156,16 @@ void CGameState::changeView(CViewItem *newView, CMovieClip *clip) { } void CGameState::checkForViewChange() { - if (_mode == GSMODE_2 && _list.isViewChanging()) { + if (_mode == GSMODE_2 && _movieList.clear()) { setMode(GSMODE_1); - if (_list._view) + if (_movieList._view) enterView(); } } +void CGameState::addMovie(CMovie *movie) { + _movieList.push_back(new CMovieListItem(movie)); + setMode(GSMODE_2); +} + } // End of namespace Titanic diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h index 49bcbcdd97..49180aa38c 100644 --- a/engines/titanic/game_state.h +++ b/engines/titanic/game_state.h @@ -27,6 +27,7 @@ #include "titanic/core/link_item.h" #include "titanic/simple_file.h" #include "titanic/game_location.h" +#include "titanic/movie.h" namespace Titanic { @@ -34,21 +35,25 @@ class CGameManager; enum GameStateMode { GSMODE_0 = 0, GSMODE_1 = 1, GSMODE_2 = 2, GSMODE_3 = 3, GSMODE_4 = 4, GSMODE_5 = 5 }; -class CGameStateList : public List { +PTR_LIST_ITEM(CMovie); +class CGameStateMovieList : public List { public: CViewItem *_view; CMovieClip *_movieClip; public: - CGameStateList() : List(), _view(nullptr), _movieClip(nullptr) {} + CGameStateMovieList() : List(), _view(nullptr), _movieClip(nullptr) {} - bool isViewChanging() const; + /** + * Clear the movie list + */ + bool clear(); }; class CGameState { public: CGameManager *_gameManager; CGameLocation _gameLocation; - CGameStateList _list; + CGameStateMovieList _movieList; int _field8; int _fieldC; GameStateMode _mode; @@ -108,6 +113,11 @@ public: * Check for whether it's time to change the active view */ void checkForViewChange(); + + /** + * Adds a movie to the movie list + */ + void addMovie(CMovie *movie); }; } // End of namespace Titanic diff --git a/engines/titanic/movie.cpp b/engines/titanic/movie.cpp index 58da09e61f..09c02a7964 100644 --- a/engines/titanic/movie.cpp +++ b/engines/titanic/movie.cpp @@ -21,6 +21,7 @@ */ #include "titanic/movie.h" +#include "titanic/titanic.h" namespace Titanic { @@ -28,7 +29,7 @@ OSMovie::OSMovie(const CResourceKey &name, CVideoSurface *surface) : _videoSurfa // _aviDecoder.loadFile(name.getString()); } -void OSMovie::proc8() { +void OSMovie::proc8(int v1, CVideoSurface *surface) { warning("TODO: OSMovie::proc8"); } @@ -91,4 +92,10 @@ void *OSMovie::proc21() { return nullptr; } +bool OSMovie::isInGlobalList() const { + return g_vm->_movieList.contains(this); +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Titanic diff --git a/engines/titanic/movie.h b/engines/titanic/movie.h index 4409712809..4a5777aa03 100644 --- a/engines/titanic/movie.h +++ b/engines/titanic/movie.h @@ -33,7 +33,7 @@ class CVideoSurface; class CMovie : public ListItem { public: - virtual void proc8() = 0; + virtual void proc8(int v1, CVideoSurface *surface) = 0; virtual void proc9() = 0; virtual void proc10() = 0; virtual void proc11() = 0; @@ -56,7 +56,7 @@ private: public: OSMovie(const CResourceKey &name, CVideoSurface *surface); - virtual void proc8(); + virtual void proc8(int v1, CVideoSurface *surface); virtual void proc9(); virtual void proc10(); virtual void proc11(); @@ -75,6 +75,12 @@ public: virtual void proc19(); virtual void proc20(); virtual void *proc21(); + + bool isInGlobalList() const; +}; + +class CGlobalMovies : public List { +public: }; } // End of namespace Titanic diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index 94ba316836..512dfc39ad 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -33,6 +33,7 @@ #include "titanic/debugger.h" #include "titanic/events.h" #include "titanic/files_manager.h" +#include "titanic/movie.h" #include "titanic/screen_manager.h" #include "titanic/main_game_window.h" @@ -101,6 +102,7 @@ public: OSScreenManager *_screenManager; CMainGameWindow *_window; Common::RandomSource _randomSource; + CGlobalMovies _movieList; public: TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc); virtual ~TitanicEngine(); diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp index 7a4aba565f..e8f0e03136 100644 --- a/engines/titanic/video_surface.cpp +++ b/engines/titanic/video_surface.cpp @@ -299,6 +299,11 @@ void OSVideoSurface::shiftColors() { unlock(); } +void OSVideoSurface::proc32(int v1, CVideoSurface *surface) { + if (loadIfReady() && _movie) + _movie->proc8(v1, surface); +} + void OSVideoSurface::stopMovie() { if (_movie) _movie->stop(); diff --git a/engines/titanic/video_surface.h b/engines/titanic/video_surface.h index f3459b456f..b2390fb358 100644 --- a/engines/titanic/video_surface.h +++ b/engines/titanic/video_surface.h @@ -57,7 +57,6 @@ protected: CResourceKey _resourceKey; DirectDrawSurface *_ddSurface; Graphics::ManagedSurface *_rawSurface; - CMovie *_movie; bool _pendingLoad; void *_field40; int _field44; @@ -66,6 +65,7 @@ protected: int _field50; int _lockCount; public: + CMovie *_movie; bool _blitFlag; bool _blitStyleFlag; public: @@ -139,6 +139,8 @@ public: */ virtual void shiftColors() = 0; + virtual void proc32(int v1, CVideoSurface *surface) = 0; + /** * Stops any movie currently attached to the surface */ @@ -248,6 +250,8 @@ public: */ virtual void shiftColors(); + virtual void proc32(int v1, CVideoSurface *surface); + /** * Stops any movie currently attached to the surface */ -- cgit v1.2.3 From 448cc158c7569e56f692294b97f4fc7a7ffc5baa Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 28 Mar 2016 18:38:17 -0400 Subject: TITANIC: Fleshed out CStartAction class --- engines/titanic/game/start_action.cpp | 21 +++++++++++++++++---- engines/titanic/game/start_action.h | 12 +++++++++--- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/engines/titanic/game/start_action.cpp b/engines/titanic/game/start_action.cpp index 9bafd01282..05ceb9d0b0 100644 --- a/engines/titanic/game/start_action.cpp +++ b/engines/titanic/game/start_action.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/start_action.h" +#include "titanic/messages/messages.h" namespace Titanic { @@ -29,18 +30,30 @@ CStartAction::CStartAction() : CBackground() { void CStartAction::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); - file->writeQuotedLine(_string3, indent); - file->writeQuotedLine(_string4, indent); + file->writeQuotedLine(_msgTarget, indent); + file->writeQuotedLine(_msgAction, indent); CBackground::save(file, indent); } void CStartAction::load(SimpleFile *file) { file->readNumber(); - _string3 = file->readString(); - _string4 = file->readString(); + _msgTarget = file->readString(); + _msgAction = file->readString(); CBackground::load(file); } +bool CStartAction::handleMessage(CMouseButtonDownMsg &msg) { + // Dispatch the desired action to the desired target + CActMsg actMsg(_msgAction); + actMsg.execute(_msgTarget); + + return true; +} + +bool CStartAction::handleMessage(CMouseButtonUpMsg &msg) { + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/start_action.h b/engines/titanic/game/start_action.h index fc7a2ea514..2b19e77fe2 100644 --- a/engines/titanic/game/start_action.h +++ b/engines/titanic/game/start_action.h @@ -24,13 +24,19 @@ #define TITANIC_START_ACTION_H #include "titanic/core/background.h" +#include "titanic/messages/mouse_messages.h" namespace Titanic { -class CStartAction : public CBackground { +class CStartAction : public CBackground, + public CMouseButtonDownMsgTarget, + public CMouseButtonUpMsgTarget { protected: - CString _string3; - CString _string4; + CString _msgTarget; + CString _msgAction; +protected: + virtual bool handleMessage(CMouseButtonDownMsg &msg); + virtual bool handleMessage(CMouseButtonUpMsg &msg); public: CLASSDEF CStartAction(); -- cgit v1.2.3 From 447eb31a6c6abebcd72ff07bd5539aa17db86057 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 28 Mar 2016 18:46:41 -0400 Subject: TITANIC: Fleshed out CDeadArea class --- engines/titanic/game/dead_area.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/engines/titanic/game/dead_area.h b/engines/titanic/game/dead_area.h index 4abcd58dd9..c696c841c2 100644 --- a/engines/titanic/game/dead_area.h +++ b/engines/titanic/game/dead_area.h @@ -24,10 +24,19 @@ #define TITANIC_DEAD_AREA_H #include "titanic/core/game_object.h" +#include "titanic/messages/mouse_messages.h" namespace Titanic { -class CDeadArea : public CGameObject { +/** + * Implements a non-responsive screen area + */ +class CDeadArea : public CGameObject, + public CMouseButtonDownMsgTarget, + public CMouseButtonUpMsgTarget { +protected: + virtual bool handleMessage(CMouseButtonDownMsg &msg) { return true; } + virtual bool handleMessage(CMouseButtonUpMsg &msg) { return true; } public: CLASSDEF CDeadArea(); -- cgit v1.2.3 From 471737a41a4f75a65ed0f7e49f6b30e361232bae Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 28 Mar 2016 22:25:15 -0400 Subject: TITANIC: Implemented CCDROM and various support stuff --- engines/titanic/core/background.cpp | 12 +++++++++ engines/titanic/core/background.h | 10 +++++++- engines/titanic/core/game_object.cpp | 38 ++++++++++++++++++++++------ engines/titanic/core/game_object.h | 28 ++++++++++++++++++--- engines/titanic/core/saveable_object.cpp | 2 ++ engines/titanic/core/tree_item.cpp | 5 ++++ engines/titanic/core/tree_item.h | 5 ++++ engines/titanic/game/cdrom.cpp | 42 +++++++++++++++++++++++++++++-- engines/titanic/game/cdrom.h | 15 +++++++++-- engines/titanic/game/cdrom_tray.cpp | 6 ++--- engines/titanic/game/cdrom_tray.h | 4 +-- engines/titanic/game/television.cpp | 12 ++++----- engines/titanic/messages/messages.h | 1 + engines/titanic/messages/mouse_messages.h | 6 ++--- 14 files changed, 155 insertions(+), 31 deletions(-) diff --git a/engines/titanic/core/background.cpp b/engines/titanic/core/background.cpp index 63aaf30ae0..ea3bdb01a8 100644 --- a/engines/titanic/core/background.cpp +++ b/engines/titanic/core/background.cpp @@ -49,4 +49,16 @@ void CBackground::load(SimpleFile *file) { CGameObject::load(file); } +bool CBackground::handleMessage(CStatusChangeMsg &msg) { + error("TODO: CBackground::handleMessage"); +} + +bool CBackground::handleMessage(CSetFrameMsg &msg) { + error("TODO: CBackground::handleMessage"); +} + +bool CBackground::handleMessage(CVisibleMsg &msg) { + error("TODO: CBackground::handleMessage"); +} + } // End of namespace Titanic diff --git a/engines/titanic/core/background.h b/engines/titanic/core/background.h index 4ce5651fc4..bd8f94987e 100644 --- a/engines/titanic/core/background.h +++ b/engines/titanic/core/background.h @@ -24,16 +24,24 @@ #define TITANIC_BACKGROUND_H #include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CBackground : public CGameObject { +class CBackground : public CGameObject, + public CStatusChangeMsgTarget, + public CSetFrameMsgTarget, + public CVisibleMsgTarget { protected: int _fieldBC; int _fieldC0; CString _string1; CString _string2; int _fieldDC; +protected: + virtual bool handleMessage(CStatusChangeMsg &msg); + virtual bool handleMessage(CSetFrameMsg &msg); + virtual bool handleMessage(CVisibleMsg &msg); public: CLASSDEF CBackground(); diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index a215633932..834364591d 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -45,7 +45,7 @@ CGameObject::CGameObject(): CNamedItem() { _field50 = 0; _field54 = 0; _field58 = 0; - _field5C = true; + _visible = true; _field60 = 0; _cursorId = CURSOR_1; _field78 = 0; @@ -54,8 +54,6 @@ CGameObject::CGameObject(): CNamedItem() { _field94 = 0; _field98 = 0; _field9C = 0; - _fieldA0 = 0; - _fieldA4 = 0; _surface = nullptr; _fieldB8 = 0; } @@ -106,7 +104,7 @@ void CGameObject::load(SimpleFile *file) { _field48 = file->readNumber(); _field4C = file->readNumber(); _fieldB8 = file->readNumber(); - _field5C = file->readNumber() != 0; + _visible = file->readNumber() != 0; _field50 = file->readNumber(); _field54 = file->readNumber(); _field58 = file->readNumber(); @@ -137,7 +135,7 @@ bool CGameObject::checkPoint(const Point &pt, int v0, int v1) { } void CGameObject::draw(CScreenManager *screenManager) { - if (!_field5C) + if (!_visible) return; if (_v1) { error("TODO: Block in CGameObject::draw"); @@ -276,9 +274,9 @@ void CGameObject::soundFn2(int val, int val2) { } } -void CGameObject::set5C(bool val) { - if (val != _field5C) { - _field5C = val; +void CGameObject::setVisible(bool val) { + if (val != _visible) { + _visible = val; makeDirty(); } } @@ -320,4 +318,28 @@ void CGameObject::changeStatus(int newStatus) { } } +void CGameObject::savePosition() { + _savedPos = _bounds; +} + +void CGameObject::resetPosition() { + setPosition(_savedPos); +} + +void CGameObject::setPosition(const Common::Point &newPos) { + makeDirty(); + _bounds.moveTo(newPos); + makeDirty(); +} + +bool CGameObject::checkStartDragging(CMouseDragStartMsg *msg) { + if (_visible && checkPoint(msg->_mousePos, msg->_field14, 1)) { + savePosition(); + msg->_dragItem = this; + return true; + } else { + return false; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 2f56f599a0..ced8663ed3 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -31,6 +31,7 @@ namespace Titanic { class CVideoSurface; +class CMouseDragStartMsg; class CGameObject : public CNamedItem { public: @@ -74,7 +75,7 @@ protected: int _field50; int _field54; int _field58; - bool _field5C; + bool _visible; CMovieClipList _clipList1; int _field78; CMovieClipList _clipList2; @@ -83,8 +84,7 @@ protected: int _field94; int _field98; int _field9C; - int _fieldA0; - int _fieldA4; + Common::Point _savedPos; CVideoSurface *_surface; CString _resource; int _fieldB8; @@ -94,9 +94,24 @@ protected: */ void loadFrame(int frameNumber); + /** + * Saves the current position the object is located at + */ + void savePosition(); + + /** + * Resets the object back to the previously saved starting position + */ + void resetPosition(); + + /** + * Check for starting to drag the object + */ + bool checkStartDragging(CMouseDragStartMsg *msg); + bool soundFn1(int val); void soundFn2(int val, int val2); - void set5C(bool val); + void setVisible(bool val); bool petFn1(int val); void petFn2(int val); void petFn3(int val); @@ -135,6 +150,11 @@ public: * Change the object's status */ void changeStatus(int newStatus); + + /** + * Set the position of the object + */ + void setPosition(const Common::Point &newPos); }; } // End of namespace Titanic diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index f7c715fd66..022a72b33a 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -897,6 +897,7 @@ DEFFN(CSetChevLiftBits) DEFFN(CSetChevPanelBitMsg) DEFFN(CSetChevPanelButtonsMsg) DEFFN(CSetChevRoomBits) +DEFFN(CSetFrameMsg); DEFFN(CSetMusicControlsMsg) DEFFN(CSetVarMsg) DEFFN(CSetVolumeMsg) @@ -1479,6 +1480,7 @@ void CSaveableObject::initClassList() { ADDFN(CSetChevPanelBitMsg, CMessage); ADDFN(CSetChevPanelButtonsMsg, CMessage); ADDFN(CSetChevRoomBits, CMessage); + ADDFN(CSetFrameMsg, CMessage); ADDFN(CSetMusicControlsMsg, CMessage); ADDFN(CSetVarMsg, CMessage); ADDFN(CSetVolumeMsg, CMessage); diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index 2c985bf34e..081c5806b6 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -284,4 +284,9 @@ CTreeItem *CTreeItem::getDontSaveChild(ClassDef *classDef) const { return dontSave->findChildInstanceOf(classDef); } +CRoomItem *CTreeItem::getRoom() const { + CGameManager *gameManager = getGameManager(); + return gameManager ? gameManager->getRoom() : nullptr; +} + } // End of namespace Titanic diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index a6c09b8126..f5e28f1056 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -33,6 +33,7 @@ class CNamedItem; class CPetControl; class CProjectItem; class CScreenManager; +class CRoomItem; class CTreeItem: public CMessageTarget { private: @@ -242,6 +243,10 @@ public: */ CTreeItem *getDontSaveChild(ClassDef *classDef) const; + /** + * Return the current room + */ + CRoomItem *getRoom() const; }; } // End of namespace Titanic diff --git a/engines/titanic/game/cdrom.cpp b/engines/titanic/game/cdrom.cpp index 40e8ed05d8..d4e4eac4d1 100644 --- a/engines/titanic/game/cdrom.cpp +++ b/engines/titanic/game/cdrom.cpp @@ -21,6 +21,8 @@ */ #include "titanic/game/cdrom.h" +#include "titanic/core/room_item.h" +#include "titanic/game/cdrom_tray.h" namespace Titanic { @@ -29,14 +31,50 @@ CCDROM::CCDROM() : CGameObject() { void CCDROM::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); - file->writePoint(_pos1, indent); + file->writePoint(_tempPos, indent); CGameObject::save(file, indent); } void CCDROM::load(SimpleFile *file) { file->readNumber(); - _pos1 = file->readPoint(); + _tempPos = file->readPoint(); CGameObject::load(file); } +bool CCDROM::handleMessage(CMouseDragStartMsg &msg) { + if (checkStartDragging(&msg)) { + _tempPos = msg._mousePos - _bounds; + setPosition(msg._mousePos - _tempPos); + return true; + } else { + return false; + } +} + +bool CCDROM::handleMessage(CMouseDragEndMsg &msg) { + if (msg._dropTarget && msg._dropTarget->getName() == "newComputer") { + CCDROMTray *newTray = dynamic_cast(getRoom()->findByName("newTray")); + + if (newTray->_state && newTray->_string1 == "None") { + CActMsg actMsg(getName()); + actMsg.execute(newTray); + } + } + + resetPosition(); + return true; +} + +bool CCDROM::handleMessage(CMouseDragMoveMsg &msg) { + setPosition(msg._mousePos - _tempPos); + return true; +} + +bool CCDROM::handleMessage(CActMsg &msg) { + if (msg._action == "Ejected") + setVisible(true); + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/cdrom.h b/engines/titanic/game/cdrom.h index c1280f6712..61bada0b74 100644 --- a/engines/titanic/game/cdrom.h +++ b/engines/titanic/game/cdrom.h @@ -24,12 +24,23 @@ #define TITANIC_CDROM_H #include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" +#include "titanic/messages/mouse_messages.h" namespace Titanic { -class CCDROM : public CGameObject { +class CCDROM : public CGameObject, + public CMouseDragStartMsgTarget, + public CMouseDragEndMsgTarget, + public CMouseDragMoveMsgTarget, + public CActMsgTarget { private: - Point _pos1; + Point _tempPos; +protected: + virtual bool handleMessage(CMouseDragStartMsg &msg); + virtual bool handleMessage(CMouseDragEndMsg &msg); + virtual bool handleMessage(CMouseDragMoveMsg &msg); + virtual bool handleMessage(CActMsg &msg); public: CLASSDEF CCDROM(); diff --git a/engines/titanic/game/cdrom_tray.cpp b/engines/titanic/game/cdrom_tray.cpp index 32eea0648b..fcb65fd42d 100644 --- a/engines/titanic/game/cdrom_tray.cpp +++ b/engines/titanic/game/cdrom_tray.cpp @@ -24,12 +24,12 @@ namespace Titanic { -CCDROMTray::CCDROMTray() : CGameObject(), _fieldBC(0) { +CCDROMTray::CCDROMTray() : CGameObject(), _state(0) { } void CCDROMTray::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_state, indent); file->writeQuotedLine(_string1, indent); CGameObject::save(file, indent); @@ -37,7 +37,7 @@ void CCDROMTray::save(SimpleFile *file, int indent) const { void CCDROMTray::load(SimpleFile *file) { file->readNumber(); - _fieldBC = file->readNumber(); + _state = file->readNumber(); _string1 = file->readString(); CGameObject::load(file); diff --git a/engines/titanic/game/cdrom_tray.h b/engines/titanic/game/cdrom_tray.h index 85d26c5a1d..b5c4b375fe 100644 --- a/engines/titanic/game/cdrom_tray.h +++ b/engines/titanic/game/cdrom_tray.h @@ -28,8 +28,8 @@ namespace Titanic { class CCDROMTray : public CGameObject { -private: - int _fieldBC; +public: + int _state; CString _string1; public: CLASSDEF diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp index 8149b8d017..ffec1bcdb8 100644 --- a/engines/titanic/game/television.cpp +++ b/engines/titanic/game/television.cpp @@ -90,7 +90,7 @@ bool CTelevision::handleMessage(CLeaveViewMsg &msg) { loadFrame(622); stopMovie(); - set5C(0); + setVisible(0); _isOn = false; if (compareRoomNameTo("CSGState")) { @@ -124,7 +124,7 @@ bool CTelevision::handleMessage(CEnterViewMsg &msg) { petFn1(2); petFn2(2); petFn3(0); - set5C(0); + setVisible(0); _fieldE0 = 1; return true; @@ -175,12 +175,12 @@ bool CTelevision::handleMessage(CActMsg &msg) { if (msg._action == "TurnTVOnOff") { _isOn = !_isOn; if (_isOn) { - set5C(true); + setVisible(true); CStatusChangeMsg changeMsg; changeMsg.execute(this); } else { // TODO: Should 5C be a boolean? - set5C(_isOn); + setVisible(_isOn); stopMovie(); } } @@ -194,7 +194,7 @@ bool CTelevision::handleMessage(CPETActivateMsg &msg) { _isOn = !_isOn; if (_isOn) { - set5C(true); + setVisible(true); fn1(0, 55, 0); _fieldE0 = 1; } else { @@ -202,7 +202,7 @@ bool CTelevision::handleMessage(CPETActivateMsg &msg) { if (soundFn1(_fieldF0)) soundFn2(_fieldF0, 0); - set5C(false); + setVisible(false); } if (compareRoomNameTo("SGTState")) diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 77d53f21a6..99df239eda 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -366,6 +366,7 @@ MESSAGE1(CSetChevLiftBits, int, value, 0); MESSAGE2(CSetChevPanelBitMsg, int, value1, 0, int, value2, 0); MESSAGE1(CSetChevPanelButtonsMsg, int, value, 0); MESSAGE1(CSetChevRoomBits, int, value, 0); +MESSAGE1(CSetFrameMsg, int, frameNumber, 0); MESSAGE0(CSetMusicControlsMsg); MESSAGE2(CSetVarMsg, CString, varName, "", int, value, 0); MESSAGE2(CSetVolumeMsg, int, value1, 70, int, value2, 0); diff --git a/engines/titanic/messages/mouse_messages.h b/engines/titanic/messages/mouse_messages.h index 7fe7ef960f..41943818e2 100644 --- a/engines/titanic/messages/mouse_messages.h +++ b/engines/titanic/messages/mouse_messages.h @@ -179,12 +179,12 @@ public: MSGTARGET(CMouseDragEndMsg); class CMouseDragEndMsg : public CMouseDragMsg { public: - CTreeItem *_dragItem; + CTreeItem *_dropTarget; public: CLASSDEF - CMouseDragEndMsg() : CMouseDragMsg(), _dragItem(nullptr) {} + CMouseDragEndMsg() : CMouseDragMsg(), _dropTarget(nullptr) {} CMouseDragEndMsg(const Point &pt, CTreeItem *dragItem = nullptr) : - CMouseDragMsg(pt), _dragItem(dragItem) {} + CMouseDragMsg(pt), _dropTarget(dragItem) {} static bool isSupportedBy(const CTreeItem *item) { return dynamic_cast(item) != nullptr; -- cgit v1.2.3 From d810e626ae70554bbc994393811b5b8a13cfeeb0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 28 Mar 2016 22:48:44 -0400 Subject: TITANIC: Implemented CGameObject::checkPoint --- engines/titanic/core/game_object.cpp | 26 +++++++++++++++++++++++--- engines/titanic/core/game_object.h | 6 +++++- engines/titanic/video_surface.cpp | 19 +++++++++++++++++++ engines/titanic/video_surface.h | 15 +++++++++++++++ 4 files changed, 62 insertions(+), 4 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 834364591d..ac02f62fb5 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -129,9 +129,29 @@ void CGameObject::stopMovie() { _surface->stopMovie(); } -bool CGameObject::checkPoint(const Point &pt, int v0, int v1) { - warning("TODO: CGameObject::checkPoint"); - return false; +bool CGameObject::checkPoint(const Point &pt, bool ignore40, bool visibleOnly) { + if ((!_visible && visibleOnly) || !_bounds.contains(pt)) + return false; + + if (ignore40 || _field40) + return true; + + if (!_surface) { + if (_frameNumber == -1) + return true; + loadFrame(_frameNumber); + if (!_surface) + return true; + } + + Common::Point pixelPos = pt - _bounds; + if (_surface->_blitStyleFlag) { + pixelPos.y = ((_bounds.height() - _bounds.top) / 2) * 2 - pixelPos.y; + } + + uint transColor = _surface->getTransparencyColor(); + uint pixel = _surface->getPixel(pixelPos); + return pixel != transColor; } void CGameObject::draw(CScreenManager *screenManager) { diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index ced8663ed3..dccef71cfe 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -142,7 +142,11 @@ public: */ void stopMovie(); - bool checkPoint(const Point &pt, int v0, int v1); + /** + * Checks the passed point is validly in the object, + * with extra checking of object flags status + */ + bool checkPoint(const Point &pt, bool ignore40 = false, bool visibleOnly = false); void fn1(int val1, int val2, int val3); diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp index e8f0e03136..1708504a80 100644 --- a/engines/titanic/video_surface.cpp +++ b/engines/titanic/video_surface.cpp @@ -143,6 +143,11 @@ void CVideoSurface::blitRect2(const Rect &srcRect, const Rect &destRect, CVideoS blitRect1(srcRect, destRect, src); } +uint16 CVideoSurface::getTransparencyColor() const { + // TODO: Do like the original + return 0xF81F; +} + /*------------------------------------------------------------------------*/ OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, DirectDrawSurface *surface) : @@ -276,6 +281,20 @@ bool OSVideoSurface::load() { } } +uint16 OSVideoSurface::getPixel(const Common::Point &pt) { + if (!loadIfReady()) + return 0; + + if (pt.x >= 0 && pt.y >= 0 && pt.x < getWidth() && pt.y < getHeight()) { + lock(); + uint16 pixel = *(uint16 *)_rawSurface->getBasePtr(pt.x, pt.y); + unlock(); + return pixel; + } else { + return getTransparencyColor(); + } +} + void OSVideoSurface::shiftColors() { if (!loadIfReady()) return; diff --git a/engines/titanic/video_surface.h b/engines/titanic/video_surface.h index b2390fb358..6090861404 100644 --- a/engines/titanic/video_surface.h +++ b/engines/titanic/video_surface.h @@ -134,6 +134,11 @@ public: virtual int proc26() = 0; + /** + * Gets the pixel at the specified position within the surface + */ + virtual uint16 getPixel(const Common::Point &pt) = 0; + /** * Shifts the colors of the surface.. maybe greys it out? */ @@ -181,6 +186,11 @@ public: void set40(void *v) { _field40 = v; } uint16 *getPixels() { return (uint16 *)_rawSurface->getPixels(); } + + /** + * Returns the transparent color + */ + uint16 getTransparencyColor() const; }; class OSVideoSurface : public CVideoSurface { @@ -245,6 +255,11 @@ public: virtual int proc26(); + /** + * Gets the pixel at the specified position within the surface + */ + virtual uint16 getPixel(const Common::Point &pt); + /** * Shifts the colors of the surface.. maybe greys it out? */ -- cgit v1.2.3 From d183a7b4f98b2b0d1c51e80c40bf16e61b0f604e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 29 Mar 2016 07:35:56 -0400 Subject: TITANIC: Fix initial loading of game object images --- engines/titanic/video_surface.cpp | 18 ++++++++++++------ engines/titanic/video_surface.h | 12 ++++++------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp index 1708504a80..8a723cce07 100644 --- a/engines/titanic/video_surface.cpp +++ b/engines/titanic/video_surface.cpp @@ -223,18 +223,24 @@ bool OSVideoSurface::hasSurface() { return _ddSurface != nullptr; } -int OSVideoSurface::getWidth() const { - assert(_ddSurface); +int OSVideoSurface::getWidth() { + if (!loadIfReady()) + error("Could not load resource"); + return _ddSurface->getWidth(); } -int OSVideoSurface::getHeight() const { - assert(_ddSurface); +int OSVideoSurface::getHeight() { + if (!loadIfReady()) + error("Could not load resource"); + return _ddSurface->getHeight(); } -int OSVideoSurface::getPitch() const { - assert(_ddSurface); +int OSVideoSurface::getPitch() { + if (!loadIfReady()) + error("Could not load resource"); + return _ddSurface->getPitch(); } diff --git a/engines/titanic/video_surface.h b/engines/titanic/video_surface.h index 6090861404..ad8cb34277 100644 --- a/engines/titanic/video_surface.h +++ b/engines/titanic/video_surface.h @@ -115,17 +115,17 @@ public: /** * Returns the width of the surface */ - virtual int getWidth() const = 0; + virtual int getWidth() = 0; /** * Returns the height of the surface */ - virtual int getHeight() const = 0; + virtual int getHeight() = 0; /** * Returns the pitch of the surface in bytes */ - virtual int getPitch() const = 0; + virtual int getPitch() = 0; /** * Reiszes the surface @@ -236,17 +236,17 @@ public: /** * Returns the width of the surface */ - virtual int getWidth() const; + virtual int getWidth(); /** * Returns the height of the surface */ - virtual int getHeight() const; + virtual int getHeight(); /** * Returns the pitch of the surface in bytes */ - virtual int getPitch() const; + virtual int getPitch(); /** * Reiszes the surface -- cgit v1.2.3 From f64657b44d80a7ec7c19d058ea9d13666cc1c690 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 29 Mar 2016 20:35:12 -0400 Subject: TITANIC: Fix handling of transparency --- engines/titanic/game/television.h | 1 - engines/titanic/video_surface.cpp | 56 ++++++++++++++++++--------------------- engines/titanic/video_surface.h | 12 ++++++--- 3 files changed, 35 insertions(+), 34 deletions(-) diff --git a/engines/titanic/game/television.h b/engines/titanic/game/television.h index 3b44f80c1a..c6c920b74c 100644 --- a/engines/titanic/game/television.h +++ b/engines/titanic/game/television.h @@ -35,7 +35,6 @@ class CTelevision : public CBackground, public CEnterViewMsgTarget, public CPETUpMsgTarget, public CPETDownMsgTarget, - public CStatusChangeMsgTarget, public CActMsgTarget, public CPETActivateMsgTarget, public CMovieEndMsgTarget, diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp index 8a723cce07..6cbea17c40 100644 --- a/engines/titanic/video_surface.cpp +++ b/engines/titanic/video_surface.cpp @@ -132,7 +132,8 @@ void CVideoSurface::blitRect1(const Rect &srcRect, const Rect &destRect, CVideoS lock(); // TODO: Do it like the original does it - _rawSurface->blitFrom(*src->_rawSurface, srcRect, Point(destRect.left, destRect.top)); + _rawSurface->transBlitFrom(*src->_rawSurface, srcRect, destRect, + getTransparencyColor()); src->unlock(); unlock(); @@ -143,9 +144,11 @@ void CVideoSurface::blitRect2(const Rect &srcRect, const Rect &destRect, CVideoS blitRect1(srcRect, destRect, src); } -uint16 CVideoSurface::getTransparencyColor() const { - // TODO: Do like the original - return 0xF81F; +uint CVideoSurface::getTransparencyColor() { + uint32 val = -(getPixelDepth() - 2); + val &= 0xFFFF8400; + val += 0xF81F; + return val; } /*------------------------------------------------------------------------*/ @@ -181,7 +184,7 @@ void OSVideoSurface::loadTarga(const CResourceKey &key) { CTargaDecode decoder; decoder.decode(*this, key.getString()); - if (proc26() == 2) + if (getPixelDepth() == 2) shiftColors(); _resourceKey = key; @@ -193,7 +196,7 @@ void OSVideoSurface::loadJPEG(const CResourceKey &key) { CJPEGDecode decoder; decoder.decode(*this, key.getString()); - if (proc26() == 2) + if (getPixelDepth() == 2) shiftColors(); _resourceKey = key; @@ -213,10 +216,11 @@ bool OSVideoSurface::lock() { } void OSVideoSurface::unlock() { - if (_rawSurface) - _ddSurface->unlock(); - _rawSurface = nullptr; - --_lockCount; + if (!--_lockCount) { + if (_rawSurface) + _ddSurface->unlock(); + _rawSurface = nullptr; + } } bool OSVideoSurface::hasSurface() { @@ -252,12 +256,19 @@ void OSVideoSurface::resize(int width, int height) { _videoSurfaceCounter += _ddSurface->getSize(); } -int OSVideoSurface::proc26() { +int OSVideoSurface::getPixelDepth() { if (!loadIfReady()) assert(0); - warning("TODO"); - return 0; + lock(); + + int result = _rawSurface->format.bytesPerPixel; + if (result == 1) + // Paletted 8-bit images don't store the color directly in the pixels + result = 0; + + unlock(); + return result; } bool OSVideoSurface::load() { @@ -305,23 +316,8 @@ void OSVideoSurface::shiftColors() { if (!loadIfReady()) return; - if (!lock()) - assert(0); - - int width = getWidth(); - int height = getHeight(); - int pitch = getPitch(); - uint16 *pixels = (uint16 *)_rawSurface->getPixels(); - uint16 *p; - int x, y; - - for (y = 0; y < height; ++y, pixels += pitch) { - for (x = 0, p = pixels; x < width; ++x, ++p) { - *p = ((*p & 0xFFE0) * 2) | (*p & 0x1F); - } - } - - unlock(); + // Currently no further processing is needed, since for ScummVM, + // we already convert 16-bit surfaces as soon as they're loaded } void OSVideoSurface::proc32(int v1, CVideoSurface *surface) { diff --git a/engines/titanic/video_surface.h b/engines/titanic/video_surface.h index ad8cb34277..5a5ee5d48a 100644 --- a/engines/titanic/video_surface.h +++ b/engines/titanic/video_surface.h @@ -132,7 +132,10 @@ public: */ virtual void resize(int width, int height) = 0; - virtual int proc26() = 0; + /** + * Returns the number of bytes per pixel in the surface + */ + virtual int getPixelDepth() = 0; /** * Gets the pixel at the specified position within the surface @@ -190,7 +193,7 @@ public: /** * Returns the transparent color */ - uint16 getTransparencyColor() const; + uint getTransparencyColor(); }; class OSVideoSurface : public CVideoSurface { @@ -253,7 +256,10 @@ public: */ virtual void resize(int width, int height); - virtual int proc26(); + /** + * Returns the number of bytes per pixel in the surface + */ + virtual int getPixelDepth(); /** * Gets the pixel at the specified position within the surface -- cgit v1.2.3 From 8bb9679be0877f728628609f218832bea3c103d4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 29 Mar 2016 21:03:34 -0400 Subject: TITANIC: Renaming for PET inventory section --- engines/titanic/module.mk | 4 +- engines/titanic/pet_control/pet_control.h | 4 +- engines/titanic/pet_control/pet_control_sub1.h | 6 +- engines/titanic/pet_control/pet_control_sub2.h | 4 +- engines/titanic/pet_control/pet_control_sub3.h | 4 +- engines/titanic/pet_control/pet_control_sub4.cpp | 42 -------- engines/titanic/pet_control/pet_control_sub4.h | 59 ----------- engines/titanic/pet_control/pet_control_sub5.h | 6 +- engines/titanic/pet_control/pet_control_sub6.h | 4 +- engines/titanic/pet_control/pet_control_sub7.h | 4 +- engines/titanic/pet_control/pet_control_sub8.h | 4 +- .../titanic/pet_control/pet_control_sub_base.cpp | 60 ------------ engines/titanic/pet_control/pet_control_sub_base.h | 109 --------------------- .../titanic/pet_control/pet_inventory_section.cpp | 42 ++++++++ .../titanic/pet_control/pet_inventory_section.h | 59 +++++++++++ engines/titanic/pet_control/pet_section.cpp | 60 ++++++++++++ engines/titanic/pet_control/pet_section.h | 109 +++++++++++++++++++++ 17 files changed, 290 insertions(+), 290 deletions(-) delete mode 100644 engines/titanic/pet_control/pet_control_sub4.cpp delete mode 100644 engines/titanic/pet_control/pet_control_sub4.h delete mode 100644 engines/titanic/pet_control/pet_control_sub_base.cpp delete mode 100644 engines/titanic/pet_control/pet_control_sub_base.h create mode 100644 engines/titanic/pet_control/pet_inventory_section.cpp create mode 100644 engines/titanic/pet_control/pet_inventory_section.h create mode 100644 engines/titanic/pet_control/pet_section.cpp create mode 100644 engines/titanic/pet_control/pet_section.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index afd8453d88..914df8cdb0 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -382,11 +382,11 @@ MODULE_OBJS := \ pet_control/pet_control.o \ pet_control/pet_control_list_item.o \ pet_control/pet_control_list_item2.o \ - pet_control/pet_control_sub_base.o \ + pet_control/pet_section.o \ pet_control/pet_control_sub1.o \ pet_control/pet_control_sub2.o \ pet_control/pet_control_sub3.o \ - pet_control/pet_control_sub4.o \ + pet_control/pet_inventory_section.o \ pet_control/pet_control_sub5.o \ pet_control/pet_control_sub6.o \ pet_control/pet_control_sub7.o \ diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index b0762736fb..e4ea16ef46 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -29,7 +29,7 @@ #include "titanic/pet_control/pet_control_sub1.h" #include "titanic/pet_control/pet_control_sub2.h" #include "titanic/pet_control/pet_control_sub3.h" -#include "titanic/pet_control/pet_control_sub4.h" +#include "titanic/pet_control/pet_inventory_section.h" #include "titanic/pet_control/pet_control_sub5.h" #include "titanic/pet_control/pet_control_sub6.h" #include "titanic/pet_control/pet_control_sub7.h" @@ -46,7 +46,7 @@ private: CPetControlSub1 _sub1; CPetControlSub2 _sub2; CPetControlSub3 _sub3; - CPetControlSub4 _sub4; + CPetInventorySection _sub4; CPetControlSub5 _sub5; CPetControlSub6 _sub6; CPetControlSub7 _sub7; diff --git a/engines/titanic/pet_control/pet_control_sub1.h b/engines/titanic/pet_control/pet_control_sub1.h index 5d0edb6c9f..8812581f80 100644 --- a/engines/titanic/pet_control/pet_control_sub1.h +++ b/engines/titanic/pet_control/pet_control_sub1.h @@ -23,13 +23,13 @@ #ifndef TITANIC_PET_CONTROL_SUB1_H #define TITANIC_PET_CONTROL_SUB1_H -#include "titanic/pet_control/pet_control_sub_base.h" +#include "titanic/pet_control/pet_section.h" #include "titanic/pet_control/pet_control_sub12.h" #include "titanic/pet_control/pet_val.h" namespace Titanic { -class CPetControlSub1 : public CPetControlSubBase { +class CPetControlSub1 : public CPetSection { private: CPetVal _val1; CPetVal _val2; @@ -38,7 +38,7 @@ private: CPetVal _val4; CPetVal _val5; CPetVal _val6; - CPetControlSubData _field14C; + int _field14C; CPetVal _val7; CPetVal _val8; CPetVal _val9; diff --git a/engines/titanic/pet_control/pet_control_sub2.h b/engines/titanic/pet_control/pet_control_sub2.h index d32b30aea0..a3eb834b74 100644 --- a/engines/titanic/pet_control/pet_control_sub2.h +++ b/engines/titanic/pet_control/pet_control_sub2.h @@ -23,14 +23,14 @@ #ifndef TITANIC_PET_CONTROL_SUB2_H #define TITANIC_PET_CONTROL_SUB2_H -#include "titanic/pet_control/pet_control_sub_base.h" +#include "titanic/pet_control/pet_section.h" #include "titanic/pet_control/pet_control_sub11.h" #include "titanic/pet_control/pet_control_sub12.h" #include "titanic/pet_control/pet_control_list_item2.h" namespace Titanic { -class CPetControlSub2 : public CPetControlSubBase { +class CPetControlSub2 : public CPetSection { private: CPetControlSub11 _sub11; CPetControlListItem2 _listItem; diff --git a/engines/titanic/pet_control/pet_control_sub3.h b/engines/titanic/pet_control/pet_control_sub3.h index aa53db5e00..4143697d6d 100644 --- a/engines/titanic/pet_control/pet_control_sub3.h +++ b/engines/titanic/pet_control/pet_control_sub3.h @@ -23,14 +23,14 @@ #ifndef TITANIC_PET_CONTROL_SUB3_H #define TITANIC_PET_CONTROL_SUB3_H -#include "titanic/pet_control/pet_control_sub_base.h" +#include "titanic/pet_control/pet_section.h" #include "titanic/pet_control/pet_control_sub10.h" #include "titanic/pet_control/pet_control_sub12.h" #include "titanic/pet_control/pet_val.h" namespace Titanic { -class CPetControlSub3 : public CPetControlSubBase { +class CPetControlSub3 : public CPetSection { private: CPetControlSub10 _sub10; CPetVal _val1; diff --git a/engines/titanic/pet_control/pet_control_sub4.cpp b/engines/titanic/pet_control/pet_control_sub4.cpp deleted file mode 100644 index 041bf50fa6..0000000000 --- a/engines/titanic/pet_control/pet_control_sub4.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* 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 "titanic/pet_control/pet_control_sub4.h" - -namespace Titanic { - -CPetControlSub4::CPetControlSub4() : _field28C(0), - _field290(0), _field294(0), _field298(0) { - for (int idx = 0; idx < 46; ++idx) { - _valArray1[idx] = _valArray2[idx] = 0; - } -} - -void CPetControlSub4::save(SimpleFile *file, int indent) const { - -} - -void CPetControlSub4::load(SimpleFile *file, int param) { - _field298 = file->readNumber(); -} - -} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub4.h b/engines/titanic/pet_control/pet_control_sub4.h deleted file mode 100644 index 18dbd7c1ae..0000000000 --- a/engines/titanic/pet_control/pet_control_sub4.h +++ /dev/null @@ -1,59 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_CONTROL_SUB4_H -#define TITANIC_PET_CONTROL_SUB4_H - -#include "titanic/simple_file.h" -#include "titanic/pet_control/pet_control_sub_base.h" -#include "titanic/pet_control/pet_control_sub10.h" -#include "titanic/pet_control/pet_control_sub12.h" - -namespace Titanic { - -class CPetControlSub4 : public CPetControlSubBase { -private: - CPetControlSub12 _sub12; - CPetControlSub10 _sub10; - int _valArray1[46]; - int _valArray2[46]; - int _field28C; - int _field290; - int _field294; - int _field298; -public: - CPetControlSub4(); - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file, int param); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_SUB4_H */ diff --git a/engines/titanic/pet_control/pet_control_sub5.h b/engines/titanic/pet_control/pet_control_sub5.h index 5ef1b26312..1da1822a6a 100644 --- a/engines/titanic/pet_control/pet_control_sub5.h +++ b/engines/titanic/pet_control/pet_control_sub5.h @@ -23,13 +23,13 @@ #ifndef TITANIC_PET_CONTROL_SUB5_H #define TITANIC_PET_CONTROL_SUB5_H -#include "titanic/pet_control/pet_control_sub_base.h" +#include "titanic/pet_control/pet_section.h" #include "titanic/pet_control/pet_control_sub12.h" #include "titanic/pet_control/pet_val.h" namespace Titanic { -class CPetControlSub5 : public CPetControlSubBase { +class CPetControlSub5 : public CPetSection { private: CPetVal _val1; CPetVal _val2; @@ -39,7 +39,7 @@ private: int _field9C; int _fieldA0; CPetVal _valArray1[6]; - CPetControlSubData _field17C; + int _field17C; int _field18C; CPetControlSub12 _sub12; int _field20C; diff --git a/engines/titanic/pet_control/pet_control_sub6.h b/engines/titanic/pet_control/pet_control_sub6.h index 420da0c7ae..208d6f2b6d 100644 --- a/engines/titanic/pet_control/pet_control_sub6.h +++ b/engines/titanic/pet_control/pet_control_sub6.h @@ -23,13 +23,13 @@ #ifndef TITANIC_PET_CONTROL_SUB6_H #define TITANIC_PET_CONTROL_SUB6_H -#include "titanic/pet_control/pet_control_sub_base.h" +#include "titanic/pet_control/pet_section.h" #include "titanic/pet_control/pet_control_sub10.h" #include "titanic/pet_control/pet_control_sub12.h" namespace Titanic { -class CPetControlSub6 : public CPetControlSubBase { +class CPetControlSub6 : public CPetSection { private: CPetControlSub10 _sub10; CPetControlSub10 _sub12; diff --git a/engines/titanic/pet_control/pet_control_sub7.h b/engines/titanic/pet_control/pet_control_sub7.h index f4a1decf12..fba7d2d6bf 100644 --- a/engines/titanic/pet_control/pet_control_sub7.h +++ b/engines/titanic/pet_control/pet_control_sub7.h @@ -23,12 +23,12 @@ #ifndef TITANIC_PET_CONTROL_SUB7_H #define TITANIC_PET_CONTROL_SUB7_H -#include "titanic/pet_control/pet_control_sub_base.h" +#include "titanic/pet_control/pet_section.h" #include "titanic/pet_control/pet_control_sub12.h" namespace Titanic { -class CPetControlSub7 : public CPetControlSubBase { +class CPetControlSub7 : public CPetSection { private: CPetControlSub12 _sub1; CPetControlSub12 _sub2; diff --git a/engines/titanic/pet_control/pet_control_sub8.h b/engines/titanic/pet_control/pet_control_sub8.h index 115e6d508f..a3d9fab3b9 100644 --- a/engines/titanic/pet_control/pet_control_sub8.h +++ b/engines/titanic/pet_control/pet_control_sub8.h @@ -23,12 +23,12 @@ #ifndef TITANIC_PET_CONTROL_SUB8_H #define TITANIC_PET_CONTROL_SUB8_H -#include "titanic/pet_control/pet_control_sub_base.h" +#include "titanic/pet_control/pet_section.h" #include "titanic/pet_control/pet_val.h" namespace Titanic { -class CPetControlSub8 : public CPetControlSubBase { +class CPetControlSub8 : public CPetSection { private: static int _indexes[6]; diff --git a/engines/titanic/pet_control/pet_control_sub_base.cpp b/engines/titanic/pet_control/pet_control_sub_base.cpp deleted file mode 100644 index 05a3425b5f..0000000000 --- a/engines/titanic/pet_control/pet_control_sub_base.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* 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/textconsole.h" -#include "titanic/pet_control/pet_control_sub_base.h" - -namespace Titanic { - -void CPetControlSubBase::proc4() { - error("TODO"); -} - -void CPetControlSubBase::proc16() { - error("TODO"); -} - -void CPetControlSubBase::proc25() { - error("TODO"); -} - -void CPetControlSubBase::proc27() { - error("TODO"); -} - -void CPetControlSubBase::proc28() { - error("TODO"); -} - -void CPetControlSubBase::proc29() { - error("TODO"); -} - -void CPetControlSubBase::proc30() { - error("TODO"); -} - -void CPetControlSubBase::proc31() { - error("TODO"); -} - -} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub_base.h b/engines/titanic/pet_control/pet_control_sub_base.h deleted file mode 100644 index f95e1a98f5..0000000000 --- a/engines/titanic/pet_control/pet_control_sub_base.h +++ /dev/null @@ -1,109 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_CONTROL_SUB_BASE_H -#define TITANIC_PET_CONTROL_SUB_BASE_H - -#include "titanic/simple_file.h" -#include "titanic/core/room_item.h" - -namespace Titanic { - -struct CPetControlSubData { - int _field0; - int _field4; - int _field8; - int _fieldC; - - CPetControlSubData() : _field0(0), _field4(0), - _field8(0), _fieldC(0) {} -}; - -class CPetControlSubBase { -protected: - int _field4; -public: - CPetControlSubBase() : _field4(0) {} - virtual ~CPetControlSubBase() {} - - virtual int proc1() { return 0; } - virtual int proc2() { return 0; } - virtual void proc3() {} - virtual void proc4(); - virtual void proc5() {} - virtual int proc6() { return 0; } - virtual int proc7() { return 0; } - virtual int proc8() { return 0; } - virtual int proc9() { return 0; } - virtual int proc10() { return 0; } - virtual int proc11() { return 0; } - virtual int proc12() { return 0; } - virtual int proc13() { return 0; } - virtual int proc14() { return 0; } - virtual int proc15() { return 0; } - virtual void proc16(); - - /** - * Returns true if the object is in a valid state - */ - virtual bool isValid() const { return false; } - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file, int param) {} - - virtual void proc19() {} - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const {} - - virtual void proc21() {} - virtual void proc22() {} - virtual void proc23() {} - - /** - * Called when a new room is entered - */ - virtual void enterRoom(CRoomItem *room) {} - - virtual void proc25(); - virtual int proc26() { return 0; } - virtual void proc27(); - virtual void proc28(); - virtual void proc29(); - virtual void proc30(); - virtual void proc31(); - virtual void proc32() {} - virtual void proc33() {} - virtual void proc34() {} - virtual void proc35() {} - virtual void proc36() {} - virtual void proc37() {} - virtual void proc38() {} -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_SUB_BASE_H */ diff --git a/engines/titanic/pet_control/pet_inventory_section.cpp b/engines/titanic/pet_control/pet_inventory_section.cpp new file mode 100644 index 0000000000..d859576399 --- /dev/null +++ b/engines/titanic/pet_control/pet_inventory_section.cpp @@ -0,0 +1,42 @@ +/* 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 "titanic/pet_control/pet_inventory_section.h" + +namespace Titanic { + +CPetInventorySection::CPetInventorySection() : CPetSection(), + _field28C(0), _field290(0), _field294(0), _field298(0) { + for (int idx = 0; idx < 46; ++idx) { + _valArray1[idx] = _valArray2[idx] = 0; + } +} + +void CPetInventorySection::save(SimpleFile *file, int indent) const { + file->writeNumberLine(_field298, indent); +} + +void CPetInventorySection::load(SimpleFile *file, int param) { + _field298 = file->readNumber(); +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory_section.h b/engines/titanic/pet_control/pet_inventory_section.h new file mode 100644 index 0000000000..4adad469a7 --- /dev/null +++ b/engines/titanic/pet_control/pet_inventory_section.h @@ -0,0 +1,59 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_INVENTORY_SECTION_H +#define TITANIC_PET_INVENTORY_SECTION_H + +#include "titanic/simple_file.h" +#include "titanic/pet_control/pet_section.h" +#include "titanic/pet_control/pet_control_sub10.h" +#include "titanic/pet_control/pet_control_sub12.h" + +namespace Titanic { + +class CPetInventorySection : public CPetSection { +private: + CPetControlSub12 _sub12; + CPetControlSub10 _sub10; + int _valArray1[46]; + int _valArray2[46]; + int _field28C; + int _field290; + int _field294; + int _field298; +public: + CPetInventorySection(); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file, int param); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_INVENTORY_SECTION_H */ diff --git a/engines/titanic/pet_control/pet_section.cpp b/engines/titanic/pet_control/pet_section.cpp new file mode 100644 index 0000000000..321f1fb94f --- /dev/null +++ b/engines/titanic/pet_control/pet_section.cpp @@ -0,0 +1,60 @@ +/* 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/textconsole.h" +#include "titanic/pet_control/pet_section.h" + +namespace Titanic { + +void CPetSection::proc4() { + error("TODO"); +} + +void CPetSection::proc16() { + error("TODO"); +} + +void CPetSection::proc25() { + error("TODO"); +} + +void CPetSection::proc27() { + error("TODO"); +} + +void CPetSection::proc28() { + error("TODO"); +} + +void CPetSection::proc29() { + error("TODO"); +} + +void CPetSection::proc30() { + error("TODO"); +} + +void CPetSection::proc31() { + error("TODO"); +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h new file mode 100644 index 0000000000..d3006f5ad6 --- /dev/null +++ b/engines/titanic/pet_control/pet_section.h @@ -0,0 +1,109 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_SECTION_H +#define TITANIC_PET_SECTION_H + +#include "titanic/simple_file.h" +#include "titanic/core/room_item.h" + +namespace Titanic { + +struct CPetSectionSubData { + int _field0; + int _field4; + int _field8; + int _fieldC; + + CPetSectionSubData() : _field0(0), _field4(0), _field8(0), + _fieldC(0) {} +}; + +class CPetSection { +protected: + int _field4; +public: + CPetSection() : _field4(0) {} + virtual ~CPetSection() {} + + virtual int proc1() { return 0; } + virtual int proc2() { return 0; } + virtual void proc3() {} + virtual void proc4(); + virtual void proc5() {} + virtual int proc6() { return 0; } + virtual int proc7() { return 0; } + virtual int proc8() { return 0; } + virtual int proc9() { return 0; } + virtual int proc10() { return 0; } + virtual int proc11() { return 0; } + virtual int proc12() { return 0; } + virtual int proc13() { return 0; } + virtual int proc14() { return 0; } + virtual int proc15() { return 0; } + virtual void proc16(); + + /** + * Returns true if the object is in a valid state + */ + virtual bool isValid() const { return false; } + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file, int param) {} + + virtual void proc19() {} + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const {} + + virtual void proc21() {} + virtual void proc22() {} + virtual void proc23() {} + + /** + * Called when a new room is entered + */ + virtual void enterRoom(CRoomItem *room) {} + + virtual void proc25(); + virtual int proc26() { return 0; } + virtual void proc27(); + virtual void proc28(); + virtual void proc29(); + virtual void proc30(); + virtual void proc31(); + virtual void proc32() {} + virtual void proc33() {} + virtual void proc34() {} + virtual void proc35() {} + virtual void proc36() {} + virtual void proc37() {} + virtual void proc38() {} +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_SECTION_H */ -- cgit v1.2.3 From 8a45f47c2e1e483b5a17b2d4abe22473eaf1e143 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 29 Mar 2016 21:19:12 -0400 Subject: TITANIC: More renamings of PET sections --- engines/titanic/module.mk | 6 +- engines/titanic/pet_control/pet_control.cpp | 24 ++++---- engines/titanic/pet_control/pet_control.h | 14 ++--- engines/titanic/pet_control/pet_control_sub1.cpp | 42 ------------- engines/titanic/pet_control/pet_control_sub1.h | 69 ---------------------- engines/titanic/pet_control/pet_control_sub2.cpp | 59 ------------------ engines/titanic/pet_control/pet_control_sub2.h | 69 ---------------------- engines/titanic/pet_control/pet_control_sub3.cpp | 27 --------- engines/titanic/pet_control/pet_control_sub3.h | 55 ----------------- .../pet_control/pet_conversation_section.cpp | 43 ++++++++++++++ .../titanic/pet_control/pet_conversation_section.h | 69 ++++++++++++++++++++++ engines/titanic/pet_control/pet_remote_section.cpp | 27 +++++++++ engines/titanic/pet_control/pet_remote_section.h | 55 +++++++++++++++++ engines/titanic/pet_control/pet_rooms_section.cpp | 59 ++++++++++++++++++ engines/titanic/pet_control/pet_rooms_section.h | 69 ++++++++++++++++++++++ 15 files changed, 344 insertions(+), 343 deletions(-) delete mode 100644 engines/titanic/pet_control/pet_control_sub1.cpp delete mode 100644 engines/titanic/pet_control/pet_control_sub1.h delete mode 100644 engines/titanic/pet_control/pet_control_sub2.cpp delete mode 100644 engines/titanic/pet_control/pet_control_sub2.h delete mode 100644 engines/titanic/pet_control/pet_control_sub3.cpp delete mode 100644 engines/titanic/pet_control/pet_control_sub3.h create mode 100644 engines/titanic/pet_control/pet_conversation_section.cpp create mode 100644 engines/titanic/pet_control/pet_conversation_section.h create mode 100644 engines/titanic/pet_control/pet_remote_section.cpp create mode 100644 engines/titanic/pet_control/pet_remote_section.h create mode 100644 engines/titanic/pet_control/pet_rooms_section.cpp create mode 100644 engines/titanic/pet_control/pet_rooms_section.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 914df8cdb0..3e018a25c5 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -382,10 +382,10 @@ MODULE_OBJS := \ pet_control/pet_control.o \ pet_control/pet_control_list_item.o \ pet_control/pet_control_list_item2.o \ + pet_control/pet_conversation_section.o \ pet_control/pet_section.o \ - pet_control/pet_control_sub1.o \ - pet_control/pet_control_sub2.o \ - pet_control/pet_control_sub3.o \ + pet_control/pet_rooms_section.o \ + pet_control/pet_remote_section.o \ pet_control/pet_inventory_section.o \ pet_control/pet_control_sub5.o \ pet_control/pet_control_sub6.o \ diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index f3e78a2212..7ef4c1494b 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -52,17 +52,17 @@ void CPetControl::load(SimpleFile *file) { } bool CPetControl::isValid() const { - return _sub1.isValid() && _sub2.isValid() - && _sub3.isValid() && _sub4.isValid() + return _convSection.isValid() && _roomsSection.isValid() + && _remoteSection.isValid() && _invSection.isValid() && _sub5.isValid() && _sub6.isValid() && _sub7.isValid() && _sub8.isValid(); } void CPetControl::loadSubObjects(SimpleFile *file, int param) { - _sub1.load(file, param); - _sub2.load(file, param); - _sub3.load(file, param); - _sub4.load(file, param); + _convSection.load(file, param); + _roomsSection.load(file, param); + _remoteSection.load(file, param); + _invSection.load(file, param); _sub5.load(file, param); _sub6.load(file, param); _sub7.load(file, param); @@ -70,10 +70,10 @@ void CPetControl::loadSubObjects(SimpleFile *file, int param) { } void CPetControl::saveSubObjects(SimpleFile *file, int indent) const { - _sub1.save(file, indent); - _sub2.save(file, indent); - _sub3.save(file, indent); - _sub4.save(file, indent); + _convSection.save(file, indent); + _roomsSection.save(file, indent); + _remoteSection.save(file, indent); + _invSection.save(file, indent); _sub5.save(file, indent); _sub6.save(file, indent); _sub7.save(file, indent); @@ -93,8 +93,8 @@ void CPetControl::enterNode(CNodeItem *node) { } void CPetControl::enterRoom(CRoomItem *room) { - _sub2.enterRoom(room); - _sub3.enterRoom(room); + _roomsSection.enterRoom(room); + _remoteSection.enterRoom(room); } void CPetControl::clear() { diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index e4ea16ef46..d6fc9d01a2 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -26,10 +26,10 @@ #include "titanic/core/game_object.h" #include "titanic/core/node_item.h" #include "titanic/core/room_item.h" -#include "titanic/pet_control/pet_control_sub1.h" -#include "titanic/pet_control/pet_control_sub2.h" -#include "titanic/pet_control/pet_control_sub3.h" +#include "titanic/pet_control/pet_conversation_section.h" #include "titanic/pet_control/pet_inventory_section.h" +#include "titanic/pet_control/pet_remote_section.h" +#include "titanic/pet_control/pet_rooms_section.h" #include "titanic/pet_control/pet_control_sub5.h" #include "titanic/pet_control/pet_control_sub6.h" #include "titanic/pet_control/pet_control_sub7.h" @@ -43,10 +43,10 @@ private: int _fieldC0; int _fieldC4; int _fieldC8; - CPetControlSub1 _sub1; - CPetControlSub2 _sub2; - CPetControlSub3 _sub3; - CPetInventorySection _sub4; + CPetConversationSection _convSection; + CPetInventorySection _invSection; + CPetRemoteSection _remoteSection; + CPetRoomsSection _roomsSection; CPetControlSub5 _sub5; CPetControlSub6 _sub6; CPetControlSub7 _sub7; diff --git a/engines/titanic/pet_control/pet_control_sub1.cpp b/engines/titanic/pet_control/pet_control_sub1.cpp deleted file mode 100644 index 0daae0637d..0000000000 --- a/engines/titanic/pet_control/pet_control_sub1.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* 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 "titanic/pet_control/pet_control_sub1.h" - -namespace Titanic { - -CPetControlSub1::CPetControlSub1() : _field414(0), _field418(0) { -} - -void CPetControlSub1::save(SimpleFile *file, int indent) const { - -} - -void CPetControlSub1::load(SimpleFile *file, int param) { - _sub2.load(file, param); - _sub1.load(file, param); - - for (int idx = 0; idx < 3; ++idx) - _valArray3[idx] = file->readNumber(); -} - -} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub1.h b/engines/titanic/pet_control/pet_control_sub1.h deleted file mode 100644 index 8812581f80..0000000000 --- a/engines/titanic/pet_control/pet_control_sub1.h +++ /dev/null @@ -1,69 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_CONTROL_SUB1_H -#define TITANIC_PET_CONTROL_SUB1_H - -#include "titanic/pet_control/pet_section.h" -#include "titanic/pet_control/pet_control_sub12.h" -#include "titanic/pet_control/pet_val.h" - -namespace Titanic { - -class CPetControlSub1 : public CPetSection { -private: - CPetVal _val1; - CPetVal _val2; - CPetVal _val3; - CPetVal _valArray1[3]; - CPetVal _val4; - CPetVal _val5; - CPetVal _val6; - int _field14C; - CPetVal _val7; - CPetVal _val8; - CPetVal _val9; - CPetVal _valArray2[9]; - int _field30C; - CPetControlSub12 _sub1; - CPetControlSub12 _sub2; - int _valArray3[3]; - int _field414; - int _field418; - CString _string1; -public: - CPetControlSub1(); - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file, int param); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_SUB1_H */ diff --git a/engines/titanic/pet_control/pet_control_sub2.cpp b/engines/titanic/pet_control/pet_control_sub2.cpp deleted file mode 100644 index 2e8b35e2f0..0000000000 --- a/engines/titanic/pet_control/pet_control_sub2.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* 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 "titanic/pet_control/pet_control_sub2.h" - -namespace Titanic { - -CPetControlSub2::CPetControlSub2() : - _field100(0), _field104(0), _field108(0), _field10C(0), - _field110(0), _field114(0), _field118(0), _field11C(0), - _field1C0(0), _field1C4(0), _field1C8(0), _field1CC(0), - _field1D0(0), _field1D4(0) { -} - -void CPetControlSub2::save(SimpleFile *file, int indent) const { - -} - -void CPetControlSub2::load(SimpleFile *file, int param) { - if (!param) { - int count = file->readNumber(); - - for (int idx = 0; idx < count; ++idx) { - int v1 = file->readNumber(); - int v2 = file->readNumber(); - warning("TODO: CPetControlSub2::load - %d,%d", v1, v2); - } - - _listItem.setField34(file->readNumber()); - file->readNumber(); - _field1C0 = file->readNumber(); - _field1C4 = file->readNumber(); - _field1C8 = file->readNumber(); - _field1CC = file->readNumber(); - _field1D0 = file->readNumber(); - _field1D4 = file->readNumber(); - } -} - -} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub2.h b/engines/titanic/pet_control/pet_control_sub2.h deleted file mode 100644 index a3eb834b74..0000000000 --- a/engines/titanic/pet_control/pet_control_sub2.h +++ /dev/null @@ -1,69 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_CONTROL_SUB2_H -#define TITANIC_PET_CONTROL_SUB2_H - -#include "titanic/pet_control/pet_section.h" -#include "titanic/pet_control/pet_control_sub11.h" -#include "titanic/pet_control/pet_control_sub12.h" -#include "titanic/pet_control/pet_control_list_item2.h" - -namespace Titanic { - -class CPetControlSub2 : public CPetSection { -private: - CPetControlSub11 _sub11; - CPetControlListItem2 _listItem; - int _field100; - int _field104; - int _field108; - int _field10C; - int _field110; - int _field114; - int _field118; - int _field11C; - CPetVal _val1; - CPetControlSub12 _sub12; - int _field1C0; - int _field1C4; - int _field1C8; - int _field1CC; - int _field1D0; - int _field1D4; -public: - CPetControlSub2(); - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file, int param); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_SUB2_H */ diff --git a/engines/titanic/pet_control/pet_control_sub3.cpp b/engines/titanic/pet_control/pet_control_sub3.cpp deleted file mode 100644 index d134b1bbc3..0000000000 --- a/engines/titanic/pet_control/pet_control_sub3.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* 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 "titanic/pet_control/pet_control_sub3.h" - -namespace Titanic { - -} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub3.h b/engines/titanic/pet_control/pet_control_sub3.h deleted file mode 100644 index 4143697d6d..0000000000 --- a/engines/titanic/pet_control/pet_control_sub3.h +++ /dev/null @@ -1,55 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_CONTROL_SUB3_H -#define TITANIC_PET_CONTROL_SUB3_H - -#include "titanic/pet_control/pet_section.h" -#include "titanic/pet_control/pet_control_sub10.h" -#include "titanic/pet_control/pet_control_sub12.h" -#include "titanic/pet_control/pet_val.h" - -namespace Titanic { - -class CPetControlSub3 : public CPetSection { -private: - CPetControlSub10 _sub10; - CPetVal _val1; - CPetVal _val2; - CPetVal _val3; - CPetVal _val4; - CPetVal _val5; - CPetVal _val6; - CPetVal _val7; - CPetVal _val8; - CPetVal _val9; - CPetVal _val10; - CPetVal _val11; - CPetControlSub12 _sub12; -public: - - -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_SUB3_H */ diff --git a/engines/titanic/pet_control/pet_conversation_section.cpp b/engines/titanic/pet_control/pet_conversation_section.cpp new file mode 100644 index 0000000000..890a03dac6 --- /dev/null +++ b/engines/titanic/pet_control/pet_conversation_section.cpp @@ -0,0 +1,43 @@ +/* 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 "titanic/pet_control/pet_conversation_section.h" + +namespace Titanic { + +CPetConversationSection::CPetConversationSection() : CPetSection(), + _field414(0), _field418(0) { +} + +void CPetConversationSection::save(SimpleFile *file, int indent) const { + +} + +void CPetConversationSection::load(SimpleFile *file, int param) { + _sub2.load(file, param); + _sub1.load(file, param); + + for (int idx = 0; idx < 3; ++idx) + _valArray3[idx] = file->readNumber(); +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_conversation_section.h b/engines/titanic/pet_control/pet_conversation_section.h new file mode 100644 index 0000000000..c9f4547a20 --- /dev/null +++ b/engines/titanic/pet_control/pet_conversation_section.h @@ -0,0 +1,69 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONVERSATION_SECTION_H +#define TITANIC_PET_CONVERSATION_SECTION_H + +#include "titanic/pet_control/pet_section.h" +#include "titanic/pet_control/pet_control_sub12.h" +#include "titanic/pet_control/pet_val.h" + +namespace Titanic { + +class CPetConversationSection : public CPetSection { +private: + CPetVal _val1; + CPetVal _val2; + CPetVal _val3; + CPetVal _valArray1[3]; + CPetVal _val4; + CPetVal _val5; + CPetVal _val6; + int _field14C; + CPetVal _val7; + CPetVal _val8; + CPetVal _val9; + CPetVal _valArray2[9]; + int _field30C; + CPetControlSub12 _sub1; + CPetControlSub12 _sub2; + int _valArray3[3]; + int _field414; + int _field418; + CString _string1; +public: + CPetConversationSection(); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file, int param); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONVERSATION_SECTION_H */ diff --git a/engines/titanic/pet_control/pet_remote_section.cpp b/engines/titanic/pet_control/pet_remote_section.cpp new file mode 100644 index 0000000000..7cdde01252 --- /dev/null +++ b/engines/titanic/pet_control/pet_remote_section.cpp @@ -0,0 +1,27 @@ +/* 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 "titanic/pet_control/pet_remote_section.h" + +namespace Titanic { + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_remote_section.h b/engines/titanic/pet_control/pet_remote_section.h new file mode 100644 index 0000000000..e3b543c3fa --- /dev/null +++ b/engines/titanic/pet_control/pet_remote_section.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_REMOTE_SECTION_H +#define TITANIC_PET_REMOTE_SECTION_H + +#include "titanic/pet_control/pet_section.h" +#include "titanic/pet_control/pet_control_sub10.h" +#include "titanic/pet_control/pet_control_sub12.h" +#include "titanic/pet_control/pet_val.h" + +namespace Titanic { + +class CPetRemoteSection : public CPetSection { +private: + CPetControlSub10 _sub10; + CPetVal _val1; + CPetVal _val2; + CPetVal _val3; + CPetVal _val4; + CPetVal _val5; + CPetVal _val6; + CPetVal _val7; + CPetVal _val8; + CPetVal _val9; + CPetVal _val10; + CPetVal _val11; + CPetControlSub12 _sub12; +public: + + +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_REMOTE_SECTION_H */ diff --git a/engines/titanic/pet_control/pet_rooms_section.cpp b/engines/titanic/pet_control/pet_rooms_section.cpp new file mode 100644 index 0000000000..b866fb349d --- /dev/null +++ b/engines/titanic/pet_control/pet_rooms_section.cpp @@ -0,0 +1,59 @@ +/* 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 "titanic/pet_control/pet_rooms_section.h" + +namespace Titanic { + +CPetRoomsSection::CPetRoomsSection() : + _field100(0), _field104(0), _field108(0), _field10C(0), + _field110(0), _field114(0), _field118(0), _field11C(0), + _field1C0(0), _field1C4(0), _field1C8(0), _field1CC(0), + _field1D0(0), _field1D4(0) { +} + +void CPetRoomsSection::save(SimpleFile *file, int indent) const { + +} + +void CPetRoomsSection::load(SimpleFile *file, int param) { + if (!param) { + int count = file->readNumber(); + + for (int idx = 0; idx < count; ++idx) { + int v1 = file->readNumber(); + int v2 = file->readNumber(); + warning("TODO: CPetRoomsSection::load - %d,%d", v1, v2); + } + + _listItem.setField34(file->readNumber()); + file->readNumber(); + _field1C0 = file->readNumber(); + _field1C4 = file->readNumber(); + _field1C8 = file->readNumber(); + _field1CC = file->readNumber(); + _field1D0 = file->readNumber(); + _field1D4 = file->readNumber(); + } +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms_section.h b/engines/titanic/pet_control/pet_rooms_section.h new file mode 100644 index 0000000000..54996fa950 --- /dev/null +++ b/engines/titanic/pet_control/pet_rooms_section.h @@ -0,0 +1,69 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_ROOMS_SECTION_H +#define TITANIC_PET_ROOMS_SECTION_H + +#include "titanic/pet_control/pet_section.h" +#include "titanic/pet_control/pet_control_sub11.h" +#include "titanic/pet_control/pet_control_sub12.h" +#include "titanic/pet_control/pet_control_list_item2.h" + +namespace Titanic { + +class CPetRoomsSection : public CPetSection { +private: + CPetControlSub11 _sub11; + CPetControlListItem2 _listItem; + int _field100; + int _field104; + int _field108; + int _field10C; + int _field110; + int _field114; + int _field118; + int _field11C; + CPetVal _val1; + CPetControlSub12 _sub12; + int _field1C0; + int _field1C4; + int _field1C8; + int _field1CC; + int _field1D0; + int _field1D4; +public: + CPetRoomsSection(); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file, int param); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_ROOMS_SECTION_H */ -- cgit v1.2.3 From e0602c4851ab42763cc66858fed8d05496040498 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 29 Mar 2016 21:57:09 -0400 Subject: TITANIC: More PET renaming, implemented setArea --- engines/titanic/core/game_object.h | 20 +++--- engines/titanic/module.mk | 6 +- engines/titanic/pet_control/pet_control.cpp | 77 ++++++++++++++++++++++-- engines/titanic/pet_control/pet_control.h | 18 ++++-- engines/titanic/pet_control/pet_control_sub6.cpp | 27 --------- engines/titanic/pet_control/pet_control_sub6.h | 42 ------------- engines/titanic/pet_control/pet_control_sub8.cpp | 4 ++ engines/titanic/pet_control/pet_control_sub8.h | 1 + engines/titanic/pet_control/pet_save_section.cpp | 27 +++++++++ engines/titanic/pet_control/pet_save_section.h | 42 +++++++++++++ engines/titanic/pet_control/pet_section.h | 17 +++++- 11 files changed, 188 insertions(+), 93 deletions(-) delete mode 100644 engines/titanic/pet_control/pet_control_sub6.cpp delete mode 100644 engines/titanic/pet_control/pet_control_sub6.h create mode 100644 engines/titanic/pet_control/pet_save_section.cpp create mode 100644 engines/titanic/pet_control/pet_save_section.h diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index dccef71cfe..9a07cd1c98 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -53,16 +53,6 @@ private: void loadImage(const CString &name, bool pendingFlag = true); void processClipList2(); - - /** - * Marks the area in the passed rect as dirty, and requiring re-rendering - */ - void makeDirty(const Rect &r); - - /** - * Marks the area occupied by the object as dirty, requiring re-rendering - */ - void makeDirty(); protected: Rect _bounds; double _field34; @@ -109,6 +99,16 @@ protected: */ bool checkStartDragging(CMouseDragStartMsg *msg); + /** + * Marks the area in the passed rect as dirty, and requiring re-rendering + */ + void makeDirty(const Rect &r); + + /** + * Marks the area occupied by the object as dirty, requiring re-rendering + */ + void makeDirty(); + bool soundFn1(int val); void soundFn2(int val, int val2); void setVisible(bool val); diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 3e018a25c5..a72e80d408 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -383,12 +383,12 @@ MODULE_OBJS := \ pet_control/pet_control_list_item.o \ pet_control/pet_control_list_item2.o \ pet_control/pet_conversation_section.o \ - pet_control/pet_section.o \ + pet_control/pet_inventory_section.o \ pet_control/pet_rooms_section.o \ pet_control/pet_remote_section.o \ - pet_control/pet_inventory_section.o \ + pet_control/pet_save_section.o \ + pet_control/pet_section.o \ pet_control/pet_control_sub5.o \ - pet_control/pet_control_sub6.o \ pet_control/pet_control_sub7.o \ pet_control/pet_control_sub8.o \ pet_control/pet_control_sub10.o \ diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 7ef4c1494b..63a1da450b 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -28,7 +28,7 @@ namespace Titanic { void CPetControl::save(SimpleFile *file, int indent) const { file->writeNumberLine(0, indent); - file->writeNumberLine(_fieldBC, indent); + file->writeNumberLine(_currentArea, indent); file->writeQuotedLine(_string1, indent); file->writeQuotedLine(_string2, indent); @@ -41,7 +41,7 @@ void CPetControl::load(SimpleFile *file) { isValid(); if (!val) { - _fieldBC = file->readNumber(); + _currentArea = (PetArea)file->readNumber(); _string1 = file->readString(); _string2 = file->readString(); @@ -54,7 +54,7 @@ void CPetControl::load(SimpleFile *file) { bool CPetControl::isValid() const { return _convSection.isValid() && _roomsSection.isValid() && _remoteSection.isValid() && _invSection.isValid() - && _sub5.isValid() && _sub6.isValid() + && _sub5.isValid() && _saveSection.isValid() && _sub7.isValid() && _sub8.isValid(); } @@ -64,7 +64,7 @@ void CPetControl::loadSubObjects(SimpleFile *file, int param) { _remoteSection.load(file, param); _invSection.load(file, param); _sub5.load(file, param); - _sub6.load(file, param); + _saveSection.load(file, param); _sub7.load(file, param); _sub8.load(file, param); } @@ -75,7 +75,7 @@ void CPetControl::saveSubObjects(SimpleFile *file, int indent) const { _remoteSection.save(file, indent); _invSection.save(file, indent); _sub5.save(file, indent); - _sub6.save(file, indent); + _saveSection.save(file, indent); _sub7.save(file, indent); _sub8.save(file, indent); } @@ -119,4 +119,71 @@ void CPetControl::fn4() { warning("TODO: CPetControl::fn4"); } +PetArea CPetControl::setArea(PetArea newArea) { + if (newArea == _currentArea || !canChangeArea()) + return _currentArea; + + // Signal the currently active area that it's being left + switch (_currentArea) { + case PET_INVENTORY: + _invSection.leave(); + break; + case PET_CONVERSATION: + _convSection.leave(); + break; + case PET_REMOTE: + _remoteSection.leave(); + break; + case PET_ROOMS: + _roomsSection.leave(); + break; + case PET_SAVE: + _saveSection.leave(); + break; + case PET_5: + _sub5.leave(); + break; + case PET_6: + _sub7.leave(); + break; + default: + break; + } + + // Change the current area + PetArea oldArea = _currentArea; + _sub8.setArea(newArea); + _currentArea = newArea; + + // Signal to the new view that it's been activated + switch (newArea) { + case PET_INVENTORY: + _invSection.enter(oldArea); + + break; + case PET_CONVERSATION: + _convSection.enter(oldArea); + break; + case PET_REMOTE: + _remoteSection.enter(oldArea); + break; + case PET_ROOMS: + _roomsSection.enter(oldArea); + break; + case PET_SAVE: + _saveSection.enter(oldArea); + break; + case PET_5: + _sub5.enter(oldArea); + break; + case PET_6: + _sub7.enter(oldArea); + break; + default: + break; + } + + makeDirty(); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index d6fc9d01a2..ce40eba177 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -30,8 +30,8 @@ #include "titanic/pet_control/pet_inventory_section.h" #include "titanic/pet_control/pet_remote_section.h" #include "titanic/pet_control/pet_rooms_section.h" +#include "titanic/pet_control/pet_save_section.h" #include "titanic/pet_control/pet_control_sub5.h" -#include "titanic/pet_control/pet_control_sub6.h" #include "titanic/pet_control/pet_control_sub7.h" #include "titanic/pet_control/pet_control_sub8.h" @@ -39,16 +39,16 @@ namespace Titanic { class CPetControl : public CGameObject { private: - int _fieldBC; + PetArea _currentArea; int _fieldC0; - int _fieldC4; + int _locked; int _fieldC8; CPetConversationSection _convSection; CPetInventorySection _invSection; CPetRemoteSection _remoteSection; CPetRoomsSection _roomsSection; + CPetSaveSection _saveSection; CPetControlSub5 _sub5; - CPetControlSub6 _sub6; CPetControlSub7 _sub7; CPetControlSub8 _sub8; int _field1384; @@ -107,6 +107,16 @@ public: void fn3(int val); void fn4(); + + /** + * Sets the currently viewed area within the PET + */ + PetArea setArea(PetArea newSection); + + /** + * Returns true if the current area can be changed + */ + bool canChangeArea() const { return _locked == 0; } }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub6.cpp b/engines/titanic/pet_control/pet_control_sub6.cpp deleted file mode 100644 index d017e81d9e..0000000000 --- a/engines/titanic/pet_control/pet_control_sub6.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* 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 "titanic/pet_control/pet_control_sub6.h" - -namespace Titanic { - -} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub6.h b/engines/titanic/pet_control/pet_control_sub6.h deleted file mode 100644 index 208d6f2b6d..0000000000 --- a/engines/titanic/pet_control/pet_control_sub6.h +++ /dev/null @@ -1,42 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_CONTROL_SUB6_H -#define TITANIC_PET_CONTROL_SUB6_H - -#include "titanic/pet_control/pet_section.h" -#include "titanic/pet_control/pet_control_sub10.h" -#include "titanic/pet_control/pet_control_sub12.h" - -namespace Titanic { - -class CPetControlSub6 : public CPetSection { -private: - CPetControlSub10 _sub10; - CPetControlSub10 _sub12; -public: - -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_SUB6_H */ diff --git a/engines/titanic/pet_control/pet_control_sub8.cpp b/engines/titanic/pet_control/pet_control_sub8.cpp index 18c68c7ddb..bc577e3cdf 100644 --- a/engines/titanic/pet_control/pet_control_sub8.cpp +++ b/engines/titanic/pet_control/pet_control_sub8.cpp @@ -33,4 +33,8 @@ CPetControlSub8::CPetControlSub8() { _indexes[INDEXES[idx]] = idx; } +void CPetControlSub8::setArea(PetArea newArea) { + warning("TODO: CPetControlSub8::setArea"); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub8.h b/engines/titanic/pet_control/pet_control_sub8.h index a3d9fab3b9..20d260d13b 100644 --- a/engines/titanic/pet_control/pet_control_sub8.h +++ b/engines/titanic/pet_control/pet_control_sub8.h @@ -42,6 +42,7 @@ private: public: CPetControlSub8(); + void setArea(PetArea newArea); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_save_section.cpp b/engines/titanic/pet_control/pet_save_section.cpp new file mode 100644 index 0000000000..e513dd3013 --- /dev/null +++ b/engines/titanic/pet_control/pet_save_section.cpp @@ -0,0 +1,27 @@ +/* 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 "titanic/pet_control/pet_save_section.h" + +namespace Titanic { + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_save_section.h b/engines/titanic/pet_control/pet_save_section.h new file mode 100644 index 0000000000..fb9004f47d --- /dev/null +++ b/engines/titanic/pet_control/pet_save_section.h @@ -0,0 +1,42 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_SAVE_SECTION_H +#define TITANIC_PET_SAVE_SECTION_H + +#include "titanic/pet_control/pet_section.h" +#include "titanic/pet_control/pet_control_sub10.h" +#include "titanic/pet_control/pet_control_sub12.h" + +namespace Titanic { + +class CPetSaveSection : public CPetSection { +private: + CPetControlSub10 _sub10; + CPetControlSub10 _sub12; +public: + +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_SAVE_SECTION_H */ diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index d3006f5ad6..ceada29709 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -28,6 +28,11 @@ namespace Titanic { +enum PetArea { + PET_INVENTORY = 0, PET_CONVERSATION = 1, PET_REMOTE = 2, + PET_ROOMS = 3, PET_SAVE = 4, PET_5 = 5, PET_6 = 6 +}; + struct CPetSectionSubData { int _field0; int _field4; @@ -79,8 +84,16 @@ public: */ virtual void save(SimpleFile *file, int indent) const {} - virtual void proc21() {} - virtual void proc22() {} + /** + * Called when a section is switched to + */ + virtual void enter(PetArea oldArea) {} + + /** + * Called when a section is being left, to switch to another area + */ + virtual void leave() {} + virtual void proc23() {} /** -- cgit v1.2.3 From a1e959b4986914bd42bdbd4587cdfc2bd57ca3a0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 29 Mar 2016 22:21:55 -0400 Subject: TITANIC: Fix PET post-loading --- engines/titanic/core/tree_item.cpp | 2 +- engines/titanic/pet_control/pet_control.cpp | 33 +++++++++++++++++++++++------ engines/titanic/pet_control/pet_control.h | 19 +++++++++++++---- engines/titanic/pet_control/pet_section.h | 5 ++++- 4 files changed, 47 insertions(+), 12 deletions(-) diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index 081c5806b6..61fcf97183 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -188,7 +188,7 @@ void CTreeItem::setParent(CTreeItem *newParent) { } void CTreeItem::addSibling(CTreeItem *item) { - _priorSibling = item->_nextSibling; + _priorSibling = item; _nextSibling = item->_nextSibling; _parent = item->_parent; diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 63a1da450b..db053ca517 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -21,6 +21,7 @@ */ #include "titanic/pet_control/pet_control.h" +#include "titanic/core/project_item.h" #include "titanic/game_manager.h" #include "titanic/game_state.h" @@ -32,7 +33,7 @@ void CPetControl::save(SimpleFile *file, int indent) const { file->writeQuotedLine(_string1, indent); file->writeQuotedLine(_string2, indent); - saveSubObjects(file, indent); + saveAreas(file, indent); CGameObject::save(file, indent); } @@ -45,7 +46,7 @@ void CPetControl::load(SimpleFile *file) { _string1 = file->readString(); _string2 = file->readString(); - loadSubObjects(file, 0); + loadAreas(file, 0); } CGameObject::load(file); @@ -58,7 +59,7 @@ bool CPetControl::isValid() const { && _sub7.isValid() && _sub8.isValid(); } -void CPetControl::loadSubObjects(SimpleFile *file, int param) { +void CPetControl::loadAreas(SimpleFile *file, int param) { _convSection.load(file, param); _roomsSection.load(file, param); _remoteSection.load(file, param); @@ -69,7 +70,7 @@ void CPetControl::loadSubObjects(SimpleFile *file, int param) { _sub8.load(file, param); } -void CPetControl::saveSubObjects(SimpleFile *file, int indent) const { +void CPetControl::saveAreas(SimpleFile *file, int indent) const { _convSection.save(file, indent); _roomsSection.save(file, indent); _remoteSection.save(file, indent); @@ -85,7 +86,26 @@ void CPetControl::proc26() { } void CPetControl::postLoad() { - warning("TODO: CPetControl::postLoad"); + CProjectItem *root = getRoot(); + + if (!_string1.empty() && root) + _treeItem1 = root->findByName(_string1); + if (!_string2.empty() && root) + _treeItem2 = root->findByName(_string2); + + setArea(_currentArea); + loaded(); +} + +void CPetControl::loaded() { + _convSection.postLoad(); + _roomsSection.postLoad(); + _remoteSection.postLoad(); + _invSection.postLoad(); + _sub5.postLoad(); + _saveSection.postLoad(); + _sub7.postLoad(); + _sub8.postLoad(); } void CPetControl::enterNode(CNodeItem *node) { @@ -98,7 +118,7 @@ void CPetControl::enterRoom(CRoomItem *room) { } void CPetControl::clear() { - _field1394 = 0; + _treeItem2 = nullptr; _string2.clear(); } @@ -184,6 +204,7 @@ PetArea CPetControl::setArea(PetArea newArea) { } makeDirty(); + return newArea; } } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index ce40eba177..02a59fdd3a 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -51,9 +51,9 @@ private: CPetControlSub5 _sub5; CPetControlSub7 _sub7; CPetControlSub8 _sub8; - int _field1384; + CTreeItem *_treeItem1; CString _string1; - int _field1394; + CTreeItem *_treeItem2; CString _string2; int _field13A4; private: @@ -62,9 +62,20 @@ private: */ bool isValid() const; - void loadSubObjects(SimpleFile *file, int param); + /** + * Loads data for the individual areas + */ + void loadAreas(SimpleFile *file, int param); - void saveSubObjects(SimpleFile *file, int indent) const; + /** + * Saves data for the individual areas + */ + void saveAreas(SimpleFile *file, int indent) const; + + /** + * Called at the end of the post game-load handling + */ + void loaded(); public: CLASSDEF diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index ceada29709..4a1335281b 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -77,7 +77,10 @@ public: */ virtual void load(SimpleFile *file, int param) {} - virtual void proc19() {} + /** + * Called after a game has been loaded + */ + virtual void postLoad() {} /** * Save the data for the class to file -- cgit v1.2.3 From fe79317bdefe9594561cf45afe2ad476b1ac06ff Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 29 Mar 2016 22:57:22 -0400 Subject: TITANIC: Beginnings of PET drawing --- engines/titanic/core/game_object.cpp | 15 +++-- engines/titanic/core/game_object.h | 9 ++- engines/titanic/game/television.cpp | 2 +- engines/titanic/main_game_window.cpp | 2 +- engines/titanic/pet_control/pet_control.cpp | 86 +++++++++++++++++++++--- engines/titanic/pet_control/pet_control.h | 8 ++- engines/titanic/pet_control/pet_control_sub8.cpp | 4 ++ engines/titanic/pet_control/pet_control_sub8.h | 2 + engines/titanic/pet_control/pet_section.h | 10 +-- 9 files changed, 111 insertions(+), 27 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index ac02f62fb5..1cdc6cde92 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -301,21 +301,16 @@ void CGameObject::setVisible(bool val) { } } -bool CGameObject::petFn1(int val) { - CPetControl *pet = getPetControl(); - return pet ? pet->fn1(val) : true; -} - void CGameObject::petFn2(int val) { CPetControl *pet = getPetControl(); if (pet) pet->fn2(val); } -void CGameObject::petFn3(int val) { +void CGameObject::petFn3(CTreeItem *item) { CPetControl *pet = getPetControl(); if (pet) - pet->fn3(val); + pet->fn3(item); } void CGameObject::fn1(int val1, int val2, int val3) { @@ -362,4 +357,10 @@ bool CGameObject::checkStartDragging(CMouseDragStartMsg *msg) { } } +void CGameObject::setPetArea(PetArea newArea) const { + CPetControl *pet = getPetControl(); + if (pet) + pet->setArea(newArea); +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 9a07cd1c98..3f12123d1b 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -27,6 +27,7 @@ #include "titanic/rect.h" #include "titanic/core/movie_clip.h" #include "titanic/core/named_item.h" +#include "titanic/pet_control/pet_section.h" namespace Titanic { @@ -109,12 +110,16 @@ protected: */ void makeDirty(); + /** + * Sets a new area in the PET + */ + void setPetArea(PetArea newArea) const; + bool soundFn1(int val); void soundFn2(int val, int val2); void setVisible(bool val); - bool petFn1(int val); void petFn2(int val); - void petFn3(int val); + void petFn3(CTreeItem *item); public: int _field60; CursorId _cursorId; diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp index ffec1bcdb8..c11d446fe4 100644 --- a/engines/titanic/game/television.cpp +++ b/engines/titanic/game/television.cpp @@ -121,7 +121,7 @@ bool CTelevision::handleMessage(CChangeSeasonMsg &msg) { } bool CTelevision::handleMessage(CEnterViewMsg &msg) { - petFn1(2); + setPetArea(PET_REMOTE); petFn2(2); petFn3(0); setVisible(0); diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 0b0bb92921..6abe83bd3f 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -147,7 +147,7 @@ void CMainGameWindow::drawPet(CScreenManager *screenManager) { if (_gameView && _gameView->_surface) { CPetControl *petControl = _gameManager->_project->getPetControl(); if (petControl) - petControl->proc26(); + petControl->draw(screenManager); } } diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index db053ca517..9f24b4b040 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -81,8 +81,46 @@ void CPetControl::saveAreas(SimpleFile *file, int indent) const { _sub8.save(file, indent); } -void CPetControl::proc26() { - warning("TODO: CPetControl::proc26"); +void CPetControl::draw(CScreenManager *screenManager) { + CGameManager *gameManager = getGameManager(); + Rect bounds = _oldBounds; + bounds.constrain(gameManager->_bounds); + + if (!bounds.isEmpty()) { + if (_fieldC8 >= 0) { + _invSection.proc5(_fieldC8); + _fieldC8 = -1; + } + + _sub8.drawFrame(screenManager); + + // Draw the specific area that's currently active + switch (_currentArea) { + case PET_INVENTORY: + _invSection.draw(screenManager); + break; + case PET_CONVERSATION: + _convSection.draw(screenManager); + break; + case PET_REMOTE: + _remoteSection.draw(screenManager); + break; + case PET_ROOMS: + _roomsSection.draw(screenManager); + break; + case PET_SAVE: + _saveSection.draw(screenManager); + break; + case PET_5: + _sub5.draw(screenManager); + break; + case PET_6: + _sub7.draw(screenManager); + break; + default: + break; + } + } } void CPetControl::postLoad() { @@ -127,14 +165,6 @@ bool CPetControl::fn1(int val) { return false; } -void CPetControl::fn2(int val) { - warning("TODO: CPetControl::fn2"); -} - -void CPetControl::fn3(int val) { - warning("TODO: CPetControl::fn3"); -} - void CPetControl::fn4() { warning("TODO: CPetControl::fn4"); } @@ -207,4 +237,40 @@ PetArea CPetControl::setArea(PetArea newArea) { return newArea; } +void CPetControl::fn2(int val) { + switch (_currentArea) { + case PET_INVENTORY: + _invSection.proc38(val); + break; + case PET_CONVERSATION: + _convSection.proc38(val); + break; + case PET_REMOTE: + _remoteSection.proc38(val); + break; + case PET_ROOMS: + _roomsSection.proc38(val); + break; + case PET_SAVE: + _saveSection.proc38(val); + break; + case PET_5: + _sub5.proc38(val); + break; + case PET_6: + _sub7.proc38(val); + break; + default: + break; + } +} + +void CPetControl::fn3(CTreeItem *item) { + _treeItem2 = item; + if (item) + _string2 = item->getName(); + else + _string2.clear(); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 02a59fdd3a..fa21d4bf01 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -56,6 +56,7 @@ private: CTreeItem *_treeItem2; CString _string2; int _field13A4; + Rect _oldBounds; private: /** * Returns true if the control is in a valid state @@ -89,7 +90,10 @@ public: */ virtual void load(SimpleFile *file); - virtual void proc26(); + /** + * Allows the item to draw itself + */ + virtual void draw(CScreenManager *screenManager); /** * Called after loading a game has finished @@ -115,7 +119,7 @@ public: void fn2(int val); - void fn3(int val); + void fn3(CTreeItem *item); void fn4(); diff --git a/engines/titanic/pet_control/pet_control_sub8.cpp b/engines/titanic/pet_control/pet_control_sub8.cpp index bc577e3cdf..7d54b87b06 100644 --- a/engines/titanic/pet_control/pet_control_sub8.cpp +++ b/engines/titanic/pet_control/pet_control_sub8.cpp @@ -37,4 +37,8 @@ void CPetControlSub8::setArea(PetArea newArea) { warning("TODO: CPetControlSub8::setArea"); } +void CPetControlSub8::drawFrame(CScreenManager *screenManager) { + warning("TODO: CPetControlSub8::drawFrame"); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub8.h b/engines/titanic/pet_control/pet_control_sub8.h index 20d260d13b..716a026eaf 100644 --- a/engines/titanic/pet_control/pet_control_sub8.h +++ b/engines/titanic/pet_control/pet_control_sub8.h @@ -43,6 +43,8 @@ public: CPetControlSub8(); void setArea(PetArea newArea); + + void drawFrame(CScreenManager *screenManager); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 4a1335281b..12e462640c 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -24,7 +24,6 @@ #define TITANIC_PET_SECTION_H #include "titanic/simple_file.h" -#include "titanic/core/room_item.h" namespace Titanic { @@ -33,6 +32,9 @@ enum PetArea { PET_ROOMS = 3, PET_SAVE = 4, PET_5 = 5, PET_6 = 6 }; +class CScreenManager; +class CRoomItem; + struct CPetSectionSubData { int _field0; int _field4; @@ -52,9 +54,9 @@ public: virtual int proc1() { return 0; } virtual int proc2() { return 0; } - virtual void proc3() {} + virtual void draw(CScreenManager *screenManager) {} virtual void proc4(); - virtual void proc5() {} + virtual void proc5(int val) {} virtual int proc6() { return 0; } virtual int proc7() { return 0; } virtual int proc8() { return 0; } @@ -117,7 +119,7 @@ public: virtual void proc35() {} virtual void proc36() {} virtual void proc37() {} - virtual void proc38() {} + virtual void proc38(int val) {} }; } // End of namespace Titanic -- cgit v1.2.3 From fee937c6ef5a47d3fdb3dd33af16fee1928c2691 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 29 Mar 2016 23:08:37 -0400 Subject: TITANIC: Debugger command to turn PET on or off --- engines/titanic/debugger.cpp | 32 +++++++++++++++++++++++++++++--- engines/titanic/debugger.h | 5 +++++ 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/engines/titanic/debugger.cpp b/engines/titanic/debugger.cpp index 3bd2d0f134..84f961e607 100644 --- a/engines/titanic/debugger.cpp +++ b/engines/titanic/debugger.cpp @@ -27,9 +27,10 @@ namespace Titanic { Debugger::Debugger(TitanicEngine *vm) : GUI::Debugger(), _vm(vm) { - registerCmd("continue", WRAP_METHOD(Debugger, cmdExit)); - registerCmd("dump", WRAP_METHOD(Debugger, cmdDump)); - registerCmd("room", WRAP_METHOD(Debugger, cmdRoom)); + registerCmd("continue", WRAP_METHOD(Debugger, cmdExit)); + registerCmd("dump", WRAP_METHOD(Debugger, cmdDump)); + registerCmd("room", WRAP_METHOD(Debugger, cmdRoom)); + registerCmd("pet", WRAP_METHOD(Debugger, cmdPET)); } int Debugger::strToInt(const char *s) { @@ -181,4 +182,29 @@ bool Debugger::cmdRoom(int argc, const char **argv) { return true; } +bool Debugger::cmdPET(int argc, const char **argv) { + CGameManager &gameManager = *g_vm->_window->_gameManager; + CGameState &gameState = gameManager._gameState; + + if (argc == 2) { + CString s(argv[1]); + s.toLowercase(); + + if (s == "on") { + gameState._petActive = true; + gameManager.update(); + debugPrintf("PET is now on\n"); + return true; + } else if (s == "off") { + gameState._petActive = false; + gameManager.update(); + debugPrintf("PET is now off\n"); + return true; + } + } + + debugPrintf("%s [on | off]\n", argv[0]); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/debugger.h b/engines/titanic/debugger.h index 2f3bb91a46..29e82d699f 100644 --- a/engines/titanic/debugger.h +++ b/engines/titanic/debugger.h @@ -79,6 +79,11 @@ private: * List room details, or jump to a specific view */ bool cmdRoom(int argc, const char **argv); + + /** + * Turn the PET on or off + */ + bool cmdPET(int argc, const char **argv); protected: TitanicEngine *_vm; public: -- cgit v1.2.3 From 08a801b1128d63e5c2cedee218a6dce7d6f04f28 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 30 Mar 2016 20:11:02 -0400 Subject: TITANIC: Flesh out the CPETElement class --- engines/titanic/core/game_object.cpp | 12 ++++ engines/titanic/core/game_object.h | 17 +++-- engines/titanic/game/pet/pet_val_base.h | 10 +-- engines/titanic/module.mk | 2 +- engines/titanic/movie.cpp | 15 ++-- engines/titanic/movie.h | 8 +-- engines/titanic/pet_control/pet_element.cpp | 100 ++++++++++++++++++++++++++ engines/titanic/pet_control/pet_element.h | 104 +++++++++++++++++++++++++++ engines/titanic/pet_control/pet_val.cpp | 8 +-- engines/titanic/pet_control/pet_val.h | 6 +- engines/titanic/pet_control/pet_val_base.cpp | 76 -------------------- engines/titanic/pet_control/pet_val_base.h | 67 ----------------- 12 files changed, 253 insertions(+), 172 deletions(-) create mode 100644 engines/titanic/pet_control/pet_element.cpp create mode 100644 engines/titanic/pet_control/pet_element.h delete mode 100644 engines/titanic/pet_control/pet_val_base.cpp delete mode 100644 engines/titanic/pet_control/pet_val_base.h diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 1cdc6cde92..759c853759 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -363,4 +363,16 @@ void CGameObject::setPetArea(PetArea newArea) const { pet->setArea(newArea); } +bool CGameObject::hasActiveMovie() const { + if (_surface && _surface->_movie) + return _surface->_movie->isActive(); + return false; +} + +int CGameObject::getMovie19() const { + if (_surface && _surface->_movie) + return _surface->_movie->proc19(); + return _field78; +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 3f12123d1b..68ddf9745d 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -80,11 +80,6 @@ protected: CString _resource; int _fieldB8; protected: - /** - * Loads a frame - */ - void loadFrame(int frameNumber); - /** * Saves the current position the object is located at */ @@ -164,6 +159,18 @@ public: * Set the position of the object */ void setPosition(const Common::Point &newPos); + + /** + * Returns true if the object has a currently active movie + */ + bool hasActiveMovie() const; + + int getMovie19() const; + + /** + * Loads a frame + */ + void loadFrame(int frameNumber); }; } // End of namespace Titanic diff --git a/engines/titanic/game/pet/pet_val_base.h b/engines/titanic/game/pet/pet_val_base.h index 310b0675b1..cdb2808108 100644 --- a/engines/titanic/game/pet/pet_val_base.h +++ b/engines/titanic/game/pet/pet_val_base.h @@ -20,12 +20,12 @@ * */ -#ifndef TITANIC_PET_VAL_BASE_H -#define TITANIC_PET_VAL_BASE_H +#ifndef TITANIC_pet_element_H +#define TITANIC_pet_element_H namespace Titanic { -class CPetValBase { +class CPetElement { protected: int _field4; int _field8; @@ -33,7 +33,7 @@ protected: int _field10; int _field14; public: - CPetValBase(); + CPetElement(); virtual void proc1() {} virtual void proc2() {} @@ -58,4 +58,4 @@ public: } // End of namespace Titanic -#endif /* TITANIC_PET_VAL_BASE_H */ +#endif /* TITANIC_pet_element_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index a72e80d408..d0e4164ab2 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -383,6 +383,7 @@ MODULE_OBJS := \ pet_control/pet_control_list_item.o \ pet_control/pet_control_list_item2.o \ pet_control/pet_conversation_section.o \ + pet_control/pet_element.o \ pet_control/pet_inventory_section.o \ pet_control/pet_rooms_section.o \ pet_control/pet_remote_section.o \ @@ -394,7 +395,6 @@ MODULE_OBJS := \ pet_control/pet_control_sub10.o \ pet_control/pet_control_sub11.o \ pet_control/pet_control_sub12.o \ - pet_control/pet_val_base.o \ pet_control/pet_val.o \ sound/auto_music_player.o \ sound/auto_music_player_base.o \ diff --git a/engines/titanic/movie.cpp b/engines/titanic/movie.cpp index 09c02a7964..28284f9a78 100644 --- a/engines/titanic/movie.cpp +++ b/engines/titanic/movie.cpp @@ -25,6 +25,12 @@ namespace Titanic { +bool CMovie::isActive() const { + return g_vm->_movieList.contains(this); +} + +/*------------------------------------------------------------------------*/ + OSMovie::OSMovie(const CResourceKey &name, CVideoSurface *surface) : _videoSurface(surface) { // _aviDecoder.loadFile(name.getString()); } @@ -79,8 +85,9 @@ void OSMovie::proc18() { warning("TODO: OSMovie::proc18"); } -void OSMovie::proc19() { +int OSMovie::proc19() { warning("TODO: OSMovie::proc19"); + return 0; } void OSMovie::proc20() { @@ -92,10 +99,4 @@ void *OSMovie::proc21() { return nullptr; } -bool OSMovie::isInGlobalList() const { - return g_vm->_movieList.contains(this); -} - -/*------------------------------------------------------------------------*/ - } // End of namespace Titanic diff --git a/engines/titanic/movie.h b/engines/titanic/movie.h index 4a5777aa03..ea0b1ea5e0 100644 --- a/engines/titanic/movie.h +++ b/engines/titanic/movie.h @@ -44,9 +44,11 @@ public: virtual void proc16() = 0; virtual void proc17() = 0; virtual void proc18() = 0; - virtual void proc19() = 0; + virtual int proc19() = 0; virtual void proc20() = 0; virtual void *proc21() = 0; + + bool isActive() const; }; class OSMovie : public CMovie { @@ -72,11 +74,9 @@ public: virtual void proc16(); virtual void proc17(); virtual void proc18(); - virtual void proc19(); + virtual int proc19(); virtual void proc20(); virtual void *proc21(); - - bool isInGlobalList() const; }; class CGlobalMovies : public List { diff --git a/engines/titanic/pet_control/pet_element.cpp b/engines/titanic/pet_control/pet_element.cpp new file mode 100644 index 0000000000..39d8fea7d9 --- /dev/null +++ b/engines/titanic/pet_control/pet_element.cpp @@ -0,0 +1,100 @@ +/* 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/textconsole.h" +#include "titanic/pet_control/pet_element.h" +#include "titanic/core/game_object.h" + +namespace Titanic { + +CPetElement::CPetElement() : _mode(MODE_0) {} + +void CPetElement::getBounds(Rect *rect) { + if (rect) + *rect = Rect(); +} + +bool CPetElement::proc6(const Common::Point &pt) { + bool result = _bounds.contains(pt); + if (result) + setMode(MODE_1); + return result; +} + +bool CPetElement::proc7(const Common::Point &pt) { + bool result = _bounds.contains(pt); + if (result) + setMode(MODE_0); + return result; +} + +bool CPetElement::contains1(const Common::Point &pt) const { + return _bounds.contains(pt); +} + +int CPetElement::proc9(const Common::Point &pt) { + bool result = _bounds.contains(pt); + if (result) + setMode(MODE_2); + return result; +} + +bool CPetElement::contains2(const Common::Point &pt) const { + return _bounds.contains(pt); +} + +void CPetElement::proc11(int val1, int val2) const { + CGameObject *gameObject = getObject(); + + if (gameObject) + gameObject->fn1(val1, val2, 0); +} + +void CPetElement::changeStatus(int newStatus) const { + CGameObject *gameObject = getObject(); + + if (gameObject) + gameObject->changeStatus(newStatus); +} + +bool CPetElement::hasActiveMovie() const { + CGameObject *gameObject = getObject(); + return gameObject ? gameObject->hasActiveMovie() : false; +} + +void CPetElement::loadFrame(int frameNumber) { + CGameObject *gameObject = getObject(); + if (gameObject) + gameObject->loadFrame(frameNumber); +} + +int CPetElement::proc15() { + CGameObject *gameObject = getObject(); + return gameObject ? gameObject->getMovie19() : 0; +} + +void CPetElement::setMode(PetElementMode newMode) { + if (newMode >= MODE_0 && newMode <= MODE_2) + changeMode(newMode); +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_element.h b/engines/titanic/pet_control/pet_element.h new file mode 100644 index 0000000000..66f57c44b4 --- /dev/null +++ b/engines/titanic/pet_control/pet_element.h @@ -0,0 +1,104 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_ELEMENT_H +#define TITANIC_PET_ELEMENT_H + +#include "titanic/simple_file.h" +#include "titanic/core/link_item.h" + +namespace Titanic { + +enum PetElementMode { MODE_0 = 0, MODE_1 = 1, MODE_2 = 2 }; + +class CGameObject; + +class CPetElement { +protected: + Common::Rect _bounds; + PetElementMode _mode; +public: + CPetElement(); + virtual ~CPetElement() {} + + virtual void proc1() {} + virtual void proc2() {} + + /** + * Draw the item + */ + virtual void draw() {} + + virtual void proc4() {} + + /** + * Get the bounds for the element + */ + virtual void getBounds(Rect *rect); + + virtual bool proc6(const Common::Point &pt); + virtual bool proc7(const Common::Point &pt); + + /** + * Returns whether the passed point falls inside the item + */ + virtual bool contains1(const Common::Point &pt) const; + + virtual int proc9(const Common::Point &pt); + + /** + * Returns whether the passed point falls inside the item + */ + virtual bool contains2(const Common::Point &pt) const; + + virtual void proc11(int val1, int val2) const; + + /** + * Change the status of the associated object + */ + virtual void changeStatus(int newStatus) const; + + /** + * Returns true if the object associated with the item has an active movie + */ + virtual bool hasActiveMovie() const; + + /** + * Loads a frame + */ + virtual void loadFrame(int frameNumber); + + virtual int proc15(); + + /** + * Get the game object associated with this item + */ + virtual CGameObject *getObject() const { return nullptr; } + + virtual void changeMode(PetElementMode newMode) { _mode = newMode; } + + void setMode(PetElementMode mode); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_ELEMENT_H */ diff --git a/engines/titanic/pet_control/pet_val.cpp b/engines/titanic/pet_control/pet_val.cpp index 5bc237572e..754bda5b7d 100644 --- a/engines/titanic/pet_control/pet_val.cpp +++ b/engines/titanic/pet_control/pet_val.cpp @@ -46,12 +46,12 @@ void CPetVal::proc5(Rect *rect) { } int CPetVal::proc16() { - switch (_field14) { - case 0: + switch (_mode) { + case MODE_0: return _field18; - case 1: + case MODE_1: return _field1C; - case 2: + case MODE_2: return _field20; default: return 0; diff --git a/engines/titanic/pet_control/pet_val.h b/engines/titanic/pet_control/pet_val.h index 0e909d485b..6d19ddb961 100644 --- a/engines/titanic/pet_control/pet_val.h +++ b/engines/titanic/pet_control/pet_val.h @@ -23,17 +23,17 @@ #ifndef TITANIC_PET_VAL_H #define TITANIC_PET_VAL_H -#include "titanic/pet_control/pet_val_base.h" +#include "titanic/pet_control/pet_element.h" namespace Titanic { -class CPetVal: public CPetValBase { +class CPetVal: public CPetElement { protected: int _field18; int _field1C; int _field20; public: - CPetVal() : CPetValBase(), _field18(0), _field1C(0), _field20(0) {} + CPetVal() : CPetElement(), _field18(0), _field1C(0), _field20(0) {} virtual void proc1(); virtual void proc2(); diff --git a/engines/titanic/pet_control/pet_val_base.cpp b/engines/titanic/pet_control/pet_val_base.cpp deleted file mode 100644 index 9a23854450..0000000000 --- a/engines/titanic/pet_control/pet_val_base.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* 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/textconsole.h" -#include "titanic/pet_control/pet_val_base.h" - -namespace Titanic { - -CPetValBase::CPetValBase() : _field4(0), _field8(0), _fieldC(0), - _field10(0), _field14(0) {} - -void CPetValBase::proc5(Rect *rect) { - if (rect) - *rect = Rect(); -} - -int CPetValBase::proc6() { - error("TODO"); -} - -int CPetValBase::proc7() { - error("TODO"); -} - -void CPetValBase::proc8() { - error("TODO"); -} - -int CPetValBase::proc9() { - error("TODO"); -} - -void CPetValBase::proc10() { - error("TODO"); -} - -void CPetValBase::proc11() { - error("TODO"); -} - -void CPetValBase::proc12() { - error("TODO"); -} - -void CPetValBase::proc13() { - error("TODO"); -} - -void CPetValBase::proc14() { - error("TODO"); -} - -void CPetValBase::proc15() { - error("TODO"); -} - -} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_val_base.h b/engines/titanic/pet_control/pet_val_base.h deleted file mode 100644 index 637e95f22d..0000000000 --- a/engines/titanic/pet_control/pet_val_base.h +++ /dev/null @@ -1,67 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_VAL_BASE_H -#define TITANIC_PET_VAL_BASE_H - -#include "titanic/simple_file.h" -#include "titanic/core/link_item.h" - -namespace Titanic { - -class CPetValBase { -protected: - int _field4; - int _field8; - int _fieldC; - int _field10; - int _field14; -public: - CPetValBase(); - virtual ~CPetValBase() {} - - virtual void proc1() {} - virtual void proc2() {} - virtual void proc3() {} - virtual void proc4() {} - - virtual void proc5(Rect *rect); - - virtual int proc6(); - virtual int proc7(); - virtual void proc8(); - virtual int proc9(); - virtual void proc10(); - virtual void proc11(); - virtual void proc12(); - virtual void proc13(); - virtual void proc14(); - virtual void proc15(); - - virtual int proc16() { return 0; } - - virtual void proc17(int v) { _field14 = v; } -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_VAL_BASE_H */ -- cgit v1.2.3 From 348b2d4b4bf9c6e8c6ca134ce7968eb9e9521a9c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 30 Mar 2016 21:01:51 -0400 Subject: TITANIC: Fleshing out CPetVal --- engines/titanic/core/game_object.cpp | 4 +++ engines/titanic/core/game_object.h | 1 + engines/titanic/movie.cpp | 12 +++++++ engines/titanic/movie.h | 7 ++++ engines/titanic/pet_control/pet_control.cpp | 32 ++++++++++++++++++ engines/titanic/pet_control/pet_control.h | 19 ++++++++++- engines/titanic/pet_control/pet_element.h | 11 +++++-- engines/titanic/pet_control/pet_val.cpp | 43 +++++++++++++++++++------ engines/titanic/pet_control/pet_val.h | 26 +++++++++++---- engines/titanic/simple_file.cpp | 1 + engines/titanic/true_talk/true_talk_manager.cpp | 1 - engines/titanic/video_surface.cpp | 11 +++++++ engines/titanic/video_surface.h | 2 ++ 13 files changed, 150 insertions(+), 20 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 759c853759..bb1541c275 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -375,4 +375,8 @@ int CGameObject::getMovie19() const { return _field78; } +int CGameObject::getSurface45() const { + return _surface ? _surface->proc45() : 0; +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 68ddf9745d..bacb73074d 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -166,6 +166,7 @@ public: bool hasActiveMovie() const; int getMovie19() const; + int getSurface45() const; /** * Loads a frame diff --git a/engines/titanic/movie.cpp b/engines/titanic/movie.cpp index 28284f9a78..193b2cad33 100644 --- a/engines/titanic/movie.cpp +++ b/engines/titanic/movie.cpp @@ -25,10 +25,22 @@ namespace Titanic { +CMovie::CMovie() : ListItem(), _state(0), _field10(0) { +} + bool CMovie::isActive() const { return g_vm->_movieList.contains(this); } +bool CMovie::get10() { + if (_field10) { + _field10 = 0; + return true; + } else { + return false; + } +} + /*------------------------------------------------------------------------*/ OSMovie::OSMovie(const CResourceKey &name, CVideoSurface *surface) : _videoSurface(surface) { diff --git a/engines/titanic/movie.h b/engines/titanic/movie.h index ea0b1ea5e0..3529409fa5 100644 --- a/engines/titanic/movie.h +++ b/engines/titanic/movie.h @@ -32,7 +32,12 @@ namespace Titanic { class CVideoSurface; class CMovie : public ListItem { +protected: + int _state; + int _field10; public: + CMovie(); + virtual void proc8(int v1, CVideoSurface *surface) = 0; virtual void proc9() = 0; virtual void proc10() = 0; @@ -49,6 +54,8 @@ public: virtual void *proc21() = 0; bool isActive() const; + + bool get10(); }; class OSMovie : public CMovie { diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 9f24b4b040..ad1d0b6d2b 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -27,6 +27,11 @@ namespace Titanic { +CPetControl::CPetControl() : CGameObject(), + _currentArea(PET_CONVERSATION), _fieldC0(0), _locked(0), _fieldC8(0), + _treeItem1(nullptr), _treeItem2(nullptr), _hiddenRoom(nullptr) { +} + void CPetControl::save(SimpleFile *file, int indent) const { file->writeNumberLine(0, indent); file->writeNumberLine(_currentArea, indent); @@ -273,4 +278,31 @@ void CPetControl::fn3(CTreeItem *item) { _string2.clear(); } +CRoomItem *CPetControl::getHiddenRoom() { + if (!_hiddenRoom) + _hiddenRoom = getHiddenRoom(); + + return _hiddenRoom; +} + +CGameObject *CPetControl::findItemInRoom(CRoomItem *room, + const CString &name) const { + if (!room) + return nullptr; + + for (CTreeItem *treeItem = room->getFirstChild(); treeItem; + treeItem = treeItem->scan(room)) { + if (!treeItem->getName().compareTo(name)) { + return dynamic_cast(treeItem); + } + } + + return nullptr; +} + +CGameObject *CPetControl::getHiddenObject(const CString &name) { + CRoomItem *room = getHiddenRoom(); + return room ? findItemInRoom(room, name) : nullptr; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index fa21d4bf01..1bb2088e27 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -55,7 +55,7 @@ private: CString _string1; CTreeItem *_treeItem2; CString _string2; - int _field13A4; + CRoomItem *_hiddenRoom; Rect _oldBounds; private: /** @@ -77,8 +77,19 @@ private: * Called at the end of the post game-load handling */ void loaded(); + + /** + * Scan the specified room for an item by name + */ + CGameObject *findItemInRoom(CRoomItem *room, const CString &name) const; + + /** + * Returns a reference to the special hidden room container + */ + CRoomItem *getHiddenRoom(); public: CLASSDEF + CPetControl(); /** * Save the data for the class to file @@ -132,6 +143,12 @@ public: * Returns true if the current area can be changed */ bool canChangeArea() const { return _locked == 0; } + + /** + * Returns a game object used by the PET by name from within the + * special hidden room container + */ + CGameObject *getHiddenObject(const CString &name); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_element.h b/engines/titanic/pet_control/pet_element.h index 66f57c44b4..19a94c2e2f 100644 --- a/engines/titanic/pet_control/pet_element.h +++ b/engines/titanic/pet_control/pet_element.h @@ -24,6 +24,7 @@ #define TITANIC_PET_ELEMENT_H #include "titanic/simple_file.h" +#include "titanic/string.h" #include "titanic/core/link_item.h" namespace Titanic { @@ -31,16 +32,22 @@ namespace Titanic { enum PetElementMode { MODE_0 = 0, MODE_1 = 1, MODE_2 = 2 }; class CGameObject; +class CPetControl; class CPetElement { protected: - Common::Rect _bounds; + Rect _bounds; PetElementMode _mode; public: CPetElement(); virtual ~CPetElement() {} - virtual void proc1() {} + /** + * Load an object into the element + */ + virtual void loadObject(PetElementMode mode, const CString &name, + CPetControl *petControl) {} + virtual void proc2() {} /** diff --git a/engines/titanic/pet_control/pet_val.cpp b/engines/titanic/pet_control/pet_val.cpp index 754bda5b7d..cc48dc3e3a 100644 --- a/engines/titanic/pet_control/pet_val.cpp +++ b/engines/titanic/pet_control/pet_val.cpp @@ -21,12 +21,27 @@ */ #include "common/textconsole.h" +#include "titanic/core/game_object.h" #include "titanic/pet_control/pet_val.h" +#include "titanic/pet_control/pet_control.h" namespace Titanic { -void CPetVal::proc1() { - error("TODO"); +void CPetVal::loadObject(PetElementMode mode, const CString &name, + CPetControl *petControl) { + switch (mode) { + case MODE_0: + _object0 = petControl->getHiddenObject(name); + break; + case MODE_1: + _object1 = petControl->getHiddenObject(name); + break; + case MODE_2: + _object2 = petControl->getHiddenObject(name); + break; + default: + break; + } } void CPetVal::proc2() { @@ -41,20 +56,30 @@ void CPetVal::proc4() { error("TODO"); } -void CPetVal::proc5(Rect *rect) { - error("TODO"); + +void CPetVal::getBounds(Rect *rect) { + if (rect) { + CGameObject *obj = getObject(); + if (!obj) + obj = _object0; + + if (obj && obj->getSurface45()) + *rect = _bounds; + else + rect->clear(); + } } -int CPetVal::proc16() { +CGameObject *CPetVal::getObject() const { switch (_mode) { case MODE_0: - return _field18; + return _object0; case MODE_1: - return _field1C; + return _object1; case MODE_2: - return _field20; + return _object2; default: - return 0; + return nullptr; } } diff --git a/engines/titanic/pet_control/pet_val.h b/engines/titanic/pet_control/pet_val.h index 6d19ddb961..90e8cfa88a 100644 --- a/engines/titanic/pet_control/pet_val.h +++ b/engines/titanic/pet_control/pet_val.h @@ -29,20 +29,32 @@ namespace Titanic { class CPetVal: public CPetElement { protected: - int _field18; - int _field1C; - int _field20; + CGameObject *_object0; + CGameObject *_object1; + CGameObject *_object2; public: - CPetVal() : CPetElement(), _field18(0), _field1C(0), _field20(0) {} + CPetVal() : CPetElement(), _object0(nullptr), _object1(nullptr), + _object2(nullptr) {} + + /** + * Load an object into the element + */ + virtual void loadObject(PetElementMode mode, const CString &name, + CPetControl *petControl); - virtual void proc1(); virtual void proc2(); virtual void proc3(); virtual void proc4(); - virtual void proc5(Rect *linkItem); + /** + * Get the bounds for the element + */ + virtual void getBounds(Rect *rect); - virtual int proc16(); + /** + * Get the game object associated with this item + */ + virtual CGameObject *getObject() const; }; } // End of namespace Titanic diff --git a/engines/titanic/simple_file.cpp b/engines/titanic/simple_file.cpp index 3cd0ef7ecc..acf02e8df1 100644 --- a/engines/titanic/simple_file.cpp +++ b/engines/titanic/simple_file.cpp @@ -28,6 +28,7 @@ namespace Titanic { bool File::open(const Common::String &name) { if (!Common::File::open(name)) error("Could not open file - %s", name.c_str()); + return true; } /*------------------------------------------------------------------------*/ diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index d13356b42c..6f42346e3f 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -66,7 +66,6 @@ void CTrueTalkManager::load(SimpleFile *file) { int ident1 = file->readNumber(); int ident2 = file->readNumber(); - int v = 0; if (ident1 != MKTAG_BE('U', 'R', 'A', 'H')) { while (ident2 != MKTAG_BE('A', 'K', 'E', 'R')) { diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp index 6cbea17c40..520193f376 100644 --- a/engines/titanic/video_surface.cpp +++ b/engines/titanic/video_surface.cpp @@ -151,6 +151,17 @@ uint CVideoSurface::getTransparencyColor() { return val; } +bool CVideoSurface::proc45() { + if (_field50) { + _field50 = 0; + return true; + } else if (_movie) { + return _movie->get10(); + } else { + return false; + } +} + /*------------------------------------------------------------------------*/ OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, DirectDrawSurface *surface) : diff --git a/engines/titanic/video_surface.h b/engines/titanic/video_surface.h index 5a5ee5d48a..de181581eb 100644 --- a/engines/titanic/video_surface.h +++ b/engines/titanic/video_surface.h @@ -169,6 +169,8 @@ public: */ virtual bool load() = 0; + virtual bool proc45(); + /** * Frees the underlying surface */ -- cgit v1.2.3 From 948fb5bcca3a8d8594fd9e1f5470dac0448f74a9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 30 Mar 2016 21:43:07 -0400 Subject: TITANIC: Implement CPetVal drawing --- engines/titanic/core/game_object.cpp | 16 ++++++++++++++++ engines/titanic/core/game_object.h | 5 +++++ engines/titanic/pet_control/pet_element.h | 9 ++++++--- engines/titanic/pet_control/pet_val.cpp | 14 +++++++++----- engines/titanic/pet_control/pet_val.h | 12 ++++++++++-- 5 files changed, 46 insertions(+), 10 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index bb1541c275..ee7e071423 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -202,6 +202,22 @@ void CGameObject::draw(CScreenManager *screenManager) { } } +void CGameObject::draw(CScreenManager *screenManager, const Common::Point &destPos) { + if (!_surface && !_resource.empty()) { + loadResource(_resource); + _resource.clear(); + } + + if (_surface) { + int xSize = _surface->getWidth(); + int ySize = _surface->getHeight(); + + if (xSize > 0 && ySize > 0) { + screenManager->blitFrom(SURFACE_BACKBUFFER, _surface, &destPos); + } + } +} + void CGameObject::loadResource(const CString &name) { switch (name.imageTypeSuffix()) { case FILETYPE_IMAGE: diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index bacb73074d..b221a7ed23 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -137,6 +137,11 @@ public: */ virtual void draw(CScreenManager *screenManager); + /** + * Allows the item to draw itself + */ + virtual void draw(CScreenManager *screenManager, const Common::Point &destPos); + /** * Stops any movie currently playing for the object */ diff --git a/engines/titanic/pet_control/pet_element.h b/engines/titanic/pet_control/pet_element.h index 19a94c2e2f..330fbf21fa 100644 --- a/engines/titanic/pet_control/pet_element.h +++ b/engines/titanic/pet_control/pet_element.h @@ -53,9 +53,12 @@ public: /** * Draw the item */ - virtual void draw() {} - - virtual void proc4() {} + virtual void draw(CScreenManager *screenManager) {} + + /** + * Draw the item + */ + virtual void draw(CScreenManager *screenManager, const Common::Point &destPos) {} /** * Get the bounds for the element diff --git a/engines/titanic/pet_control/pet_val.cpp b/engines/titanic/pet_control/pet_val.cpp index cc48dc3e3a..096b2846a0 100644 --- a/engines/titanic/pet_control/pet_val.cpp +++ b/engines/titanic/pet_control/pet_val.cpp @@ -48,14 +48,18 @@ void CPetVal::proc2() { error("TODO"); } -void CPetVal::proc3() { - error("TODO"); +void CPetVal::draw(CScreenManager *screenManager) { + draw(screenManager, Common::Point(_bounds.left, _bounds.top)); } -void CPetVal::proc4() { - error("TODO"); -} +void CPetVal::draw(CScreenManager *screenManager, const Common::Point &destPos) { + CGameObject *obj = getObject(); + if (!obj) + obj = _object0; + if (obj) + obj->draw(screenManager, destPos); +} void CPetVal::getBounds(Rect *rect) { if (rect) { diff --git a/engines/titanic/pet_control/pet_val.h b/engines/titanic/pet_control/pet_val.h index 90e8cfa88a..90b7a2ec96 100644 --- a/engines/titanic/pet_control/pet_val.h +++ b/engines/titanic/pet_control/pet_val.h @@ -43,8 +43,16 @@ public: CPetControl *petControl); virtual void proc2(); - virtual void proc3(); - virtual void proc4(); + + /** + * Draw the item + */ + virtual void draw(CScreenManager *screenManager); + + /** + * Draw the item + */ + virtual void draw(CScreenManager *screenManager, const Common::Point &destPos); /** * Get the bounds for the element -- cgit v1.2.3 From c33bdcc09ff9949dec9330fc245bb8f97546875a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 30 Mar 2016 23:55:15 -0400 Subject: TITANIC: Fleshing out CPetFrame --- engines/titanic/module.mk | 2 +- engines/titanic/pet_control/pet_control.cpp | 24 +++--- engines/titanic/pet_control/pet_control.h | 6 +- engines/titanic/pet_control/pet_control_sub8.cpp | 44 ---------- engines/titanic/pet_control/pet_control_sub8.h | 52 ------------ engines/titanic/pet_control/pet_element.h | 19 ++++- engines/titanic/pet_control/pet_frame.cpp | 104 +++++++++++++++++++++++ engines/titanic/pet_control/pet_frame.h | 83 ++++++++++++++++++ engines/titanic/pet_control/pet_section.h | 23 +++-- 9 files changed, 239 insertions(+), 118 deletions(-) delete mode 100644 engines/titanic/pet_control/pet_control_sub8.cpp delete mode 100644 engines/titanic/pet_control/pet_control_sub8.h create mode 100644 engines/titanic/pet_control/pet_frame.cpp create mode 100644 engines/titanic/pet_control/pet_frame.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index d0e4164ab2..cc3c186288 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -384,6 +384,7 @@ MODULE_OBJS := \ pet_control/pet_control_list_item2.o \ pet_control/pet_conversation_section.o \ pet_control/pet_element.o \ + pet_control/pet_frame.o \ pet_control/pet_inventory_section.o \ pet_control/pet_rooms_section.o \ pet_control/pet_remote_section.o \ @@ -391,7 +392,6 @@ MODULE_OBJS := \ pet_control/pet_section.o \ pet_control/pet_control_sub5.o \ pet_control/pet_control_sub7.o \ - pet_control/pet_control_sub8.o \ pet_control/pet_control_sub10.o \ pet_control/pet_control_sub11.o \ pet_control/pet_control_sub12.o \ diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index ad1d0b6d2b..4fe0c1d255 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -57,11 +57,15 @@ void CPetControl::load(SimpleFile *file) { CGameObject::load(file); } -bool CPetControl::isValid() const { - return _convSection.isValid() && _roomsSection.isValid() - && _remoteSection.isValid() && _invSection.isValid() - && _sub5.isValid() && _saveSection.isValid() - && _sub7.isValid() && _sub8.isValid(); +bool CPetControl::isValid() { + return _convSection.isValid(this) && + _roomsSection.isValid(this) && + _remoteSection.isValid(this) && + _invSection.isValid(this) && + _sub5.isValid(this) && + _saveSection.isValid(this) && + _sub7.isValid(this) && + _frame.isValid(this); } void CPetControl::loadAreas(SimpleFile *file, int param) { @@ -72,7 +76,7 @@ void CPetControl::loadAreas(SimpleFile *file, int param) { _sub5.load(file, param); _saveSection.load(file, param); _sub7.load(file, param); - _sub8.load(file, param); + _frame.load(file, param); } void CPetControl::saveAreas(SimpleFile *file, int indent) const { @@ -83,7 +87,7 @@ void CPetControl::saveAreas(SimpleFile *file, int indent) const { _sub5.save(file, indent); _saveSection.save(file, indent); _sub7.save(file, indent); - _sub8.save(file, indent); + _frame.save(file, indent); } void CPetControl::draw(CScreenManager *screenManager) { @@ -97,7 +101,7 @@ void CPetControl::draw(CScreenManager *screenManager) { _fieldC8 = -1; } - _sub8.drawFrame(screenManager); + _frame.drawFrame(screenManager); // Draw the specific area that's currently active switch (_currentArea) { @@ -148,7 +152,7 @@ void CPetControl::loaded() { _sub5.postLoad(); _saveSection.postLoad(); _sub7.postLoad(); - _sub8.postLoad(); + _frame.postLoad(); } void CPetControl::enterNode(CNodeItem *node) { @@ -207,7 +211,7 @@ PetArea CPetControl::setArea(PetArea newArea) { // Change the current area PetArea oldArea = _currentArea; - _sub8.setArea(newArea); + _frame.setArea(newArea); _currentArea = newArea; // Signal to the new view that it's been activated diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 1bb2088e27..4f101caaf5 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -27,13 +27,13 @@ #include "titanic/core/node_item.h" #include "titanic/core/room_item.h" #include "titanic/pet_control/pet_conversation_section.h" +#include "titanic/pet_control/pet_frame.h" #include "titanic/pet_control/pet_inventory_section.h" #include "titanic/pet_control/pet_remote_section.h" #include "titanic/pet_control/pet_rooms_section.h" #include "titanic/pet_control/pet_save_section.h" #include "titanic/pet_control/pet_control_sub5.h" #include "titanic/pet_control/pet_control_sub7.h" -#include "titanic/pet_control/pet_control_sub8.h" namespace Titanic { @@ -50,7 +50,7 @@ private: CPetSaveSection _saveSection; CPetControlSub5 _sub5; CPetControlSub7 _sub7; - CPetControlSub8 _sub8; + CPetFrame _frame; CTreeItem *_treeItem1; CString _string1; CTreeItem *_treeItem2; @@ -61,7 +61,7 @@ private: /** * Returns true if the control is in a valid state */ - bool isValid() const; + bool isValid(); /** * Loads data for the individual areas diff --git a/engines/titanic/pet_control/pet_control_sub8.cpp b/engines/titanic/pet_control/pet_control_sub8.cpp deleted file mode 100644 index 7d54b87b06..0000000000 --- a/engines/titanic/pet_control/pet_control_sub8.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* 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 "titanic/pet_control/pet_control_sub8.h" - -namespace Titanic { - -static const int INDEXES[6] = { 1, 0, 2, 3, 4, 5 }; - -int CPetControlSub8::_indexes[6]; - -CPetControlSub8::CPetControlSub8() { - for (int idx = 0; idx < 6; ++idx) - _indexes[INDEXES[idx]] = idx; -} - -void CPetControlSub8::setArea(PetArea newArea) { - warning("TODO: CPetControlSub8::setArea"); -} - -void CPetControlSub8::drawFrame(CScreenManager *screenManager) { - warning("TODO: CPetControlSub8::drawFrame"); -} - -} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub8.h b/engines/titanic/pet_control/pet_control_sub8.h deleted file mode 100644 index 716a026eaf..0000000000 --- a/engines/titanic/pet_control/pet_control_sub8.h +++ /dev/null @@ -1,52 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_CONTROL_SUB8_H -#define TITANIC_PET_CONTROL_SUB8_H - -#include "titanic/pet_control/pet_section.h" -#include "titanic/pet_control/pet_val.h" - -namespace Titanic { - -class CPetControlSub8 : public CPetSection { -private: - static int _indexes[6]; - - CPetVal _valArray1[6]; - CPetVal _valArray2[6]; - CPetVal _val1; - CPetVal _val2; - CPetVal _val3; - CPetVal _val4; - CPetVal _valArray3[7]; -public: - CPetControlSub8(); - - void setArea(PetArea newArea); - - void drawFrame(CScreenManager *screenManager); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_SUB8_H */ diff --git a/engines/titanic/pet_control/pet_element.h b/engines/titanic/pet_control/pet_element.h index 330fbf21fa..e5ab8d3fdd 100644 --- a/engines/titanic/pet_control/pet_element.h +++ b/engines/titanic/pet_control/pet_element.h @@ -43,12 +43,15 @@ public: virtual ~CPetElement() {} /** - * Load an object into the element + * Sets up the element */ - virtual void loadObject(PetElementMode mode, const CString &name, + virtual void setup(PetElementMode mode, const CString &name, CPetControl *petControl) {} - virtual void proc2() {} + /** + * Sets up the element + */ + virtual void setup() {} /** * Draw the item @@ -107,6 +110,16 @@ public: virtual void changeMode(PetElementMode newMode) { _mode = newMode; } void setMode(PetElementMode mode); + + /** + * Set the bounds for the element + */ + void setBounds(const Rect &r) { _bounds = r; } + + /** + * Translate the position of the element + */ + void translate(int deltaX, int deltaY) { _bounds.translate(deltaX, deltaY); } }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_frame.cpp b/engines/titanic/pet_control/pet_frame.cpp new file mode 100644 index 0000000000..e94bc6c848 --- /dev/null +++ b/engines/titanic/pet_control/pet_frame.cpp @@ -0,0 +1,104 @@ +/* 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 "titanic/pet_control/pet_frame.h" + +namespace Titanic { + +static const int INDEXES[6] = { 1, 0, 2, 3, 4, 5 }; + +int CPetFrame::_indexes[6]; + +CPetFrame::CPetFrame() { + for (int idx = 0; idx < 6; ++idx) + _indexes[INDEXES[idx]] = idx; +} + +bool CPetFrame::setup(CPetControl *petControl) { + if (setPetControl(petControl)) + return setup(); + return false; +} + +bool CPetFrame::setup() { + if (_petControl) { + // TODO + } + + return true; +} + +bool CPetFrame::isValid(CPetControl *petControl) { + bool result = setPetControl(petControl); + if (result) { + _modeButtons[_indexes[0]].setMode(MODE_0); + _modeButtons[_indexes[4]].setMode(MODE_1); + } + + return result; +} + +void CPetFrame::postLoad() { + setup(); +} + +bool CPetFrame::setPetControl(CPetControl *petControl) { + if (petControl) { + _petControl = petControl; + + // Set the bounds of the individual elements + _background.setBounds(Rect(20, 350, 620, 480)); + _modeBackground.setBounds(Rect(590, 365, 611, 467)); + + Rect r(35, 373, 91, 429); + for (int idx = 0, xp = 0; xp < 490; ++idx, xp += 70) { + _indent[idx].setBounds(r); + _indent[idx].translate(xp, 0); + } + + r = Rect(590, 365, 606, 381); + const int YLIST[] = { 7, 27, 45, 66, 84 }; + for (int idx = 0; idx < 5; ++idx) { + _modeButtons[idx].setBounds(r); + _modeButtons[idx].translate(0, YLIST[idx]); + } + _modeButtons[_indexes[0]].setMode(MODE_1); + + const int XLIST[] = { 73, 54, 85, 109, 38, 71 }; + for (int idx = 0; idx < 6; ++idx) { + _titles[idx].setBounds(Rect(0, 0, 110, 11)); + _titles[idx].translate(XLIST[idx], 471); + } + } + + return true; +} + +void CPetFrame::setArea(PetArea newArea) { + warning("TODO: CPetFrame::setArea"); +} + +void CPetFrame::drawFrame(CScreenManager *screenManager) { + warning("TODO: CPetFrame::drawFrame"); +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_frame.h b/engines/titanic/pet_control/pet_frame.h new file mode 100644 index 0000000000..53adf1ba07 --- /dev/null +++ b/engines/titanic/pet_control/pet_frame.h @@ -0,0 +1,83 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_FRAME_H +#define TITANIC_PET_FRAME_H + +#include "titanic/pet_control/pet_section.h" +#include "titanic/pet_control/pet_val.h" + +namespace Titanic { + +class CPetFrame : public CPetSection { +private: + static int _indexes[6]; + + CPetVal _modeButtons[6]; + CPetVal _titles[6]; + CPetVal _modeBackground; + CPetVal _val2; + CPetVal _val3; + CPetVal _background; + CPetVal _indent[7]; +private: + /** + * Called to set the owning PET instance and set some initial state + */ + bool setPetControl(CPetControl *petControl); +public: + CPetFrame(); + + /** + * Sets up the section + */ + virtual bool setup(CPetControl *petControl); + + /** + * Sets up the section + */ + virtual bool setup(); + + /** + * Returns true if the object is in a valid state + */ + virtual bool isValid(CPetControl *petControl); + + /** + * Called after a game has been loaded + */ + virtual void postLoad(); + + /** + * Called when the current PET area changes + */ + void setArea(PetArea newArea); + + /** + * Draws the PET frame + */ + void drawFrame(CScreenManager *screenManager); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_FRAME_H */ diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 12e462640c..77535662a6 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -32,6 +32,7 @@ enum PetArea { PET_ROOMS = 3, PET_SAVE = 4, PET_5 = 5, PET_6 = 6 }; +class CPetControl; class CScreenManager; class CRoomItem; @@ -47,14 +48,26 @@ struct CPetSectionSubData { class CPetSection { protected: - int _field4; + CPetControl *_petControl; public: - CPetSection() : _field4(0) {} + CPetSection() : _petControl(nullptr) {} virtual ~CPetSection() {} - virtual int proc1() { return 0; } - virtual int proc2() { return 0; } + /** + * Sets up the section + */ + virtual bool setup(CPetControl *petControl) { return false; } + + /** + * Sets up the section + */ + virtual bool setup() { return false; } + + /** + * Draw the section + */ virtual void draw(CScreenManager *screenManager) {} + virtual void proc4(); virtual void proc5(int val) {} virtual int proc6() { return 0; } @@ -72,7 +85,7 @@ public: /** * Returns true if the object is in a valid state */ - virtual bool isValid() const { return false; } + virtual bool isValid(CPetControl *petControl) { return false; } /** * Load the data for the class from file -- cgit v1.2.3 From 39ef1e3edb03d0ea6ae47649951c308b646992ad Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 31 Mar 2016 07:58:41 -0400 Subject: TITANIC: Renamed CPetVal to CPetGraphic --- engines/titanic/module.mk | 2 +- .../titanic/pet_control/pet_control_list_item.h | 4 +- engines/titanic/pet_control/pet_control_sub10.h | 6 +- engines/titanic/pet_control/pet_control_sub5.h | 12 +-- .../titanic/pet_control/pet_conversation_section.h | 24 +++--- engines/titanic/pet_control/pet_frame.h | 16 ++-- engines/titanic/pet_control/pet_graphic.cpp | 90 ++++++++++++++++++++++ engines/titanic/pet_control/pet_graphic.h | 70 +++++++++++++++++ engines/titanic/pet_control/pet_remote_section.h | 24 +++--- engines/titanic/pet_control/pet_rooms_section.h | 2 +- engines/titanic/pet_control/pet_val.cpp | 90 ---------------------- engines/titanic/pet_control/pet_val.h | 70 ----------------- 12 files changed, 205 insertions(+), 205 deletions(-) create mode 100644 engines/titanic/pet_control/pet_graphic.cpp create mode 100644 engines/titanic/pet_control/pet_graphic.h delete mode 100644 engines/titanic/pet_control/pet_val.cpp delete mode 100644 engines/titanic/pet_control/pet_val.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index cc3c186288..4eebf04aaf 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -385,6 +385,7 @@ MODULE_OBJS := \ pet_control/pet_conversation_section.o \ pet_control/pet_element.o \ pet_control/pet_frame.o \ + pet_control/pet_graphic.o \ pet_control/pet_inventory_section.o \ pet_control/pet_rooms_section.o \ pet_control/pet_remote_section.o \ @@ -395,7 +396,6 @@ MODULE_OBJS := \ pet_control/pet_control_sub10.o \ pet_control/pet_control_sub11.o \ pet_control/pet_control_sub12.o \ - pet_control/pet_val.o \ sound/auto_music_player.o \ sound/auto_music_player_base.o \ sound/auto_sound_player.o \ diff --git a/engines/titanic/pet_control/pet_control_list_item.h b/engines/titanic/pet_control/pet_control_list_item.h index 64808c0309..e8210714c1 100644 --- a/engines/titanic/pet_control/pet_control_list_item.h +++ b/engines/titanic/pet_control/pet_control_list_item.h @@ -24,13 +24,13 @@ #define TITANIC_PET_CONTROL_LIST_ITEM_H #include "titanic/core/list.h" -#include "titanic/pet_control/pet_val.h" +#include "titanic/pet_control/pet_graphic.h" namespace Titanic { class CPetControlListItem : public ListItem { protected: - CPetVal _val; + CPetGraphic _val; int _field30; public: CPetControlListItem() : _field30(0) {} diff --git a/engines/titanic/pet_control/pet_control_sub10.h b/engines/titanic/pet_control/pet_control_sub10.h index f8534d7089..a6f863cb15 100644 --- a/engines/titanic/pet_control/pet_control_sub10.h +++ b/engines/titanic/pet_control/pet_control_sub10.h @@ -37,9 +37,9 @@ protected: int _field1C; int _field20; int _field24; - CPetVal _val1; - CPetVal _val2; - CPetVal _val3; + CPetGraphic _val1; + CPetGraphic _val2; + CPetGraphic _val3; public: CPetControlSub10(); diff --git a/engines/titanic/pet_control/pet_control_sub5.h b/engines/titanic/pet_control/pet_control_sub5.h index 1da1822a6a..f82a1eb3f1 100644 --- a/engines/titanic/pet_control/pet_control_sub5.h +++ b/engines/titanic/pet_control/pet_control_sub5.h @@ -25,20 +25,20 @@ #include "titanic/pet_control/pet_section.h" #include "titanic/pet_control/pet_control_sub12.h" -#include "titanic/pet_control/pet_val.h" +#include "titanic/pet_control/pet_graphic.h" namespace Titanic { class CPetControlSub5 : public CPetSection { private: - CPetVal _val1; - CPetVal _val2; - CPetVal _val3; - CPetVal _val4; + CPetGraphic _val1; + CPetGraphic _val2; + CPetGraphic _val3; + CPetGraphic _val4; int _field98; int _field9C; int _fieldA0; - CPetVal _valArray1[6]; + CPetGraphic _valArray1[6]; int _field17C; int _field18C; CPetControlSub12 _sub12; diff --git a/engines/titanic/pet_control/pet_conversation_section.h b/engines/titanic/pet_control/pet_conversation_section.h index c9f4547a20..15d57e7272 100644 --- a/engines/titanic/pet_control/pet_conversation_section.h +++ b/engines/titanic/pet_control/pet_conversation_section.h @@ -25,24 +25,24 @@ #include "titanic/pet_control/pet_section.h" #include "titanic/pet_control/pet_control_sub12.h" -#include "titanic/pet_control/pet_val.h" +#include "titanic/pet_control/pet_graphic.h" namespace Titanic { class CPetConversationSection : public CPetSection { private: - CPetVal _val1; - CPetVal _val2; - CPetVal _val3; - CPetVal _valArray1[3]; - CPetVal _val4; - CPetVal _val5; - CPetVal _val6; + CPetGraphic _val1; + CPetGraphic _val2; + CPetGraphic _val3; + CPetGraphic _valArray1[3]; + CPetGraphic _val4; + CPetGraphic _val5; + CPetGraphic _val6; int _field14C; - CPetVal _val7; - CPetVal _val8; - CPetVal _val9; - CPetVal _valArray2[9]; + CPetGraphic _val7; + CPetGraphic _val8; + CPetGraphic _val9; + CPetGraphic _valArray2[9]; int _field30C; CPetControlSub12 _sub1; CPetControlSub12 _sub2; diff --git a/engines/titanic/pet_control/pet_frame.h b/engines/titanic/pet_control/pet_frame.h index 53adf1ba07..e307a73901 100644 --- a/engines/titanic/pet_control/pet_frame.h +++ b/engines/titanic/pet_control/pet_frame.h @@ -24,7 +24,7 @@ #define TITANIC_PET_FRAME_H #include "titanic/pet_control/pet_section.h" -#include "titanic/pet_control/pet_val.h" +#include "titanic/pet_control/pet_graphic.h" namespace Titanic { @@ -32,13 +32,13 @@ class CPetFrame : public CPetSection { private: static int _indexes[6]; - CPetVal _modeButtons[6]; - CPetVal _titles[6]; - CPetVal _modeBackground; - CPetVal _val2; - CPetVal _val3; - CPetVal _background; - CPetVal _indent[7]; + CPetGraphic _modeButtons[6]; + CPetGraphic _titles[6]; + CPetGraphic _modeBackground; + CPetGraphic _val2; + CPetGraphic _val3; + CPetGraphic _background; + CPetGraphic _indent[7]; private: /** * Called to set the owning PET instance and set some initial state diff --git a/engines/titanic/pet_control/pet_graphic.cpp b/engines/titanic/pet_control/pet_graphic.cpp new file mode 100644 index 0000000000..c9fd5f5af1 --- /dev/null +++ b/engines/titanic/pet_control/pet_graphic.cpp @@ -0,0 +1,90 @@ +/* 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/textconsole.h" +#include "titanic/core/game_object.h" +#include "titanic/pet_control/pet_graphic.h" +#include "titanic/pet_control/pet_control.h" + +namespace Titanic { + +void CPetGraphic::loadObject(PetElementMode mode, const CString &name, + CPetControl *petControl) { + switch (mode) { + case MODE_0: + _object0 = petControl->getHiddenObject(name); + break; + case MODE_1: + _object1 = petControl->getHiddenObject(name); + break; + case MODE_2: + _object2 = petControl->getHiddenObject(name); + break; + default: + break; + } +} + +void CPetGraphic::proc2() { + error("TODO"); +} + +void CPetGraphic::draw(CScreenManager *screenManager) { + draw(screenManager, Common::Point(_bounds.left, _bounds.top)); +} + +void CPetGraphic::draw(CScreenManager *screenManager, const Common::Point &destPos) { + CGameObject *obj = getObject(); + if (!obj) + obj = _object0; + + if (obj) + obj->draw(screenManager, destPos); +} + +void CPetGraphic::getBounds(Rect *rect) { + if (rect) { + CGameObject *obj = getObject(); + if (!obj) + obj = _object0; + + if (obj && obj->getSurface45()) + *rect = _bounds; + else + rect->clear(); + } +} + +CGameObject *CPetGraphic::getObject() const { + switch (_mode) { + case MODE_0: + return _object0; + case MODE_1: + return _object1; + case MODE_2: + return _object2; + default: + return nullptr; + } +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_graphic.h b/engines/titanic/pet_control/pet_graphic.h new file mode 100644 index 0000000000..8b9c495205 --- /dev/null +++ b/engines/titanic/pet_control/pet_graphic.h @@ -0,0 +1,70 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_GRAPHIC_H +#define TITANIC_PET_GRAPHIC_H + +#include "titanic/pet_control/pet_element.h" + +namespace Titanic { + +class CPetGraphic: public CPetElement { +protected: + CGameObject *_object0; + CGameObject *_object1; + CGameObject *_object2; +public: + CPetGraphic() : CPetElement(), _object0(nullptr), _object1(nullptr), + _object2(nullptr) {} + + /** + * Load an object into the element + */ + virtual void loadObject(PetElementMode mode, const CString &name, + CPetControl *petControl); + + virtual void proc2(); + + /** + * Draw the item + */ + virtual void draw(CScreenManager *screenManager); + + /** + * Draw the item + */ + virtual void draw(CScreenManager *screenManager, const Common::Point &destPos); + + /** + * Get the bounds for the element + */ + virtual void getBounds(Rect *rect); + + /** + * Get the game object associated with this item + */ + virtual CGameObject *getObject() const; +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_GRAPHIC_H */ diff --git a/engines/titanic/pet_control/pet_remote_section.h b/engines/titanic/pet_control/pet_remote_section.h index e3b543c3fa..6a3d1cd429 100644 --- a/engines/titanic/pet_control/pet_remote_section.h +++ b/engines/titanic/pet_control/pet_remote_section.h @@ -26,24 +26,24 @@ #include "titanic/pet_control/pet_section.h" #include "titanic/pet_control/pet_control_sub10.h" #include "titanic/pet_control/pet_control_sub12.h" -#include "titanic/pet_control/pet_val.h" +#include "titanic/pet_control/pet_graphic.h" namespace Titanic { class CPetRemoteSection : public CPetSection { private: CPetControlSub10 _sub10; - CPetVal _val1; - CPetVal _val2; - CPetVal _val3; - CPetVal _val4; - CPetVal _val5; - CPetVal _val6; - CPetVal _val7; - CPetVal _val8; - CPetVal _val9; - CPetVal _val10; - CPetVal _val11; + CPetGraphic _val1; + CPetGraphic _val2; + CPetGraphic _val3; + CPetGraphic _val4; + CPetGraphic _val5; + CPetGraphic _val6; + CPetGraphic _val7; + CPetGraphic _val8; + CPetGraphic _val9; + CPetGraphic _val10; + CPetGraphic _val11; CPetControlSub12 _sub12; public: diff --git a/engines/titanic/pet_control/pet_rooms_section.h b/engines/titanic/pet_control/pet_rooms_section.h index 54996fa950..fc26c340cf 100644 --- a/engines/titanic/pet_control/pet_rooms_section.h +++ b/engines/titanic/pet_control/pet_rooms_section.h @@ -42,7 +42,7 @@ private: int _field114; int _field118; int _field11C; - CPetVal _val1; + CPetGraphic _val1; CPetControlSub12 _sub12; int _field1C0; int _field1C4; diff --git a/engines/titanic/pet_control/pet_val.cpp b/engines/titanic/pet_control/pet_val.cpp deleted file mode 100644 index 096b2846a0..0000000000 --- a/engines/titanic/pet_control/pet_val.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* 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/textconsole.h" -#include "titanic/core/game_object.h" -#include "titanic/pet_control/pet_val.h" -#include "titanic/pet_control/pet_control.h" - -namespace Titanic { - -void CPetVal::loadObject(PetElementMode mode, const CString &name, - CPetControl *petControl) { - switch (mode) { - case MODE_0: - _object0 = petControl->getHiddenObject(name); - break; - case MODE_1: - _object1 = petControl->getHiddenObject(name); - break; - case MODE_2: - _object2 = petControl->getHiddenObject(name); - break; - default: - break; - } -} - -void CPetVal::proc2() { - error("TODO"); -} - -void CPetVal::draw(CScreenManager *screenManager) { - draw(screenManager, Common::Point(_bounds.left, _bounds.top)); -} - -void CPetVal::draw(CScreenManager *screenManager, const Common::Point &destPos) { - CGameObject *obj = getObject(); - if (!obj) - obj = _object0; - - if (obj) - obj->draw(screenManager, destPos); -} - -void CPetVal::getBounds(Rect *rect) { - if (rect) { - CGameObject *obj = getObject(); - if (!obj) - obj = _object0; - - if (obj && obj->getSurface45()) - *rect = _bounds; - else - rect->clear(); - } -} - -CGameObject *CPetVal::getObject() const { - switch (_mode) { - case MODE_0: - return _object0; - case MODE_1: - return _object1; - case MODE_2: - return _object2; - default: - return nullptr; - } -} - -} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_val.h b/engines/titanic/pet_control/pet_val.h deleted file mode 100644 index 90b7a2ec96..0000000000 --- a/engines/titanic/pet_control/pet_val.h +++ /dev/null @@ -1,70 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_VAL_H -#define TITANIC_PET_VAL_H - -#include "titanic/pet_control/pet_element.h" - -namespace Titanic { - -class CPetVal: public CPetElement { -protected: - CGameObject *_object0; - CGameObject *_object1; - CGameObject *_object2; -public: - CPetVal() : CPetElement(), _object0(nullptr), _object1(nullptr), - _object2(nullptr) {} - - /** - * Load an object into the element - */ - virtual void loadObject(PetElementMode mode, const CString &name, - CPetControl *petControl); - - virtual void proc2(); - - /** - * Draw the item - */ - virtual void draw(CScreenManager *screenManager); - - /** - * Draw the item - */ - virtual void draw(CScreenManager *screenManager, const Common::Point &destPos); - - /** - * Get the bounds for the element - */ - virtual void getBounds(Rect *rect); - - /** - * Get the game object associated with this item - */ - virtual CGameObject *getObject() const; -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_VAL_H */ -- cgit v1.2.3 From 6a1b452e163a5ebdf77e4753fc647e390a48b4fb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 31 Mar 2016 12:49:10 -0400 Subject: TITANIC: Work on implementing CDROM Tray class --- engines/titanic/game/cdrom_tray.cpp | 15 +++++++++++++++ engines/titanic/game/cdrom_tray.h | 10 +++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/engines/titanic/game/cdrom_tray.cpp b/engines/titanic/game/cdrom_tray.cpp index fcb65fd42d..7265332c02 100644 --- a/engines/titanic/game/cdrom_tray.cpp +++ b/engines/titanic/game/cdrom_tray.cpp @@ -43,4 +43,19 @@ void CCDROMTray::load(SimpleFile *file) { CGameObject::load(file); } +bool CCDROMTray::handleMessage(CActMsg &msg) { + // TODO + return true; +} + +bool CCDROMTray::handleMessage(CMovieEndMsg &msg) { + // TODO + return true; +} + +bool CCDROMTray::handleMessage(CStatusChangeMsg &msg) { + // TODO + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/cdrom_tray.h b/engines/titanic/game/cdrom_tray.h index b5c4b375fe..b1893c548e 100644 --- a/engines/titanic/game/cdrom_tray.h +++ b/engines/titanic/game/cdrom_tray.h @@ -24,13 +24,21 @@ #define TITANIC_CDROM_TRAY_H #include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CCDROMTray : public CGameObject { +class CCDROMTray : public CGameObject, + public CActMsgTarget, + public CMovieEndMsgTarget, + public CStatusChangeMsgTarget { public: int _state; CString _string1; +protected: + virtual bool handleMessage(CActMsg &msg); + virtual bool handleMessage(CMovieEndMsg &msg); + virtual bool handleMessage(CStatusChangeMsg &msg); public: CLASSDEF CCDROMTray(); -- cgit v1.2.3 From 5c902685fc2f3f97ee3fd9250480801ac849bf02 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 31 Mar 2016 13:05:17 -0400 Subject: TITANIC: Rename CPetGraphic to CPetGfxElement to avoid naming clash --- engines/titanic/module.mk | 2 +- .../titanic/pet_control/pet_control_list_item.h | 4 +- engines/titanic/pet_control/pet_control_sub10.h | 6 +- engines/titanic/pet_control/pet_control_sub5.h | 12 +-- .../titanic/pet_control/pet_conversation_section.h | 24 +++--- engines/titanic/pet_control/pet_frame.h | 16 ++-- engines/titanic/pet_control/pet_gfx_element.cpp | 90 ++++++++++++++++++++++ engines/titanic/pet_control/pet_gfx_element.h | 70 +++++++++++++++++ engines/titanic/pet_control/pet_graphic.cpp | 90 ---------------------- engines/titanic/pet_control/pet_graphic.h | 70 ----------------- engines/titanic/pet_control/pet_remote_section.h | 24 +++--- engines/titanic/pet_control/pet_rooms_section.h | 2 +- 12 files changed, 205 insertions(+), 205 deletions(-) create mode 100644 engines/titanic/pet_control/pet_gfx_element.cpp create mode 100644 engines/titanic/pet_control/pet_gfx_element.h delete mode 100644 engines/titanic/pet_control/pet_graphic.cpp delete mode 100644 engines/titanic/pet_control/pet_graphic.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 4eebf04aaf..9f9257db75 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -385,7 +385,7 @@ MODULE_OBJS := \ pet_control/pet_conversation_section.o \ pet_control/pet_element.o \ pet_control/pet_frame.o \ - pet_control/pet_graphic.o \ + pet_control/pet_gfx_element.o \ pet_control/pet_inventory_section.o \ pet_control/pet_rooms_section.o \ pet_control/pet_remote_section.o \ diff --git a/engines/titanic/pet_control/pet_control_list_item.h b/engines/titanic/pet_control/pet_control_list_item.h index e8210714c1..caa9a0d6b1 100644 --- a/engines/titanic/pet_control/pet_control_list_item.h +++ b/engines/titanic/pet_control/pet_control_list_item.h @@ -24,13 +24,13 @@ #define TITANIC_PET_CONTROL_LIST_ITEM_H #include "titanic/core/list.h" -#include "titanic/pet_control/pet_graphic.h" +#include "titanic/pet_control/pet_gfx_element.h" namespace Titanic { class CPetControlListItem : public ListItem { protected: - CPetGraphic _val; + CPetGfxElement _val; int _field30; public: CPetControlListItem() : _field30(0) {} diff --git a/engines/titanic/pet_control/pet_control_sub10.h b/engines/titanic/pet_control/pet_control_sub10.h index a6f863cb15..e31937865b 100644 --- a/engines/titanic/pet_control/pet_control_sub10.h +++ b/engines/titanic/pet_control/pet_control_sub10.h @@ -37,9 +37,9 @@ protected: int _field1C; int _field20; int _field24; - CPetGraphic _val1; - CPetGraphic _val2; - CPetGraphic _val3; + CPetGfxElement _val1; + CPetGfxElement _val2; + CPetGfxElement _val3; public: CPetControlSub10(); diff --git a/engines/titanic/pet_control/pet_control_sub5.h b/engines/titanic/pet_control/pet_control_sub5.h index f82a1eb3f1..088ba6fd27 100644 --- a/engines/titanic/pet_control/pet_control_sub5.h +++ b/engines/titanic/pet_control/pet_control_sub5.h @@ -25,20 +25,20 @@ #include "titanic/pet_control/pet_section.h" #include "titanic/pet_control/pet_control_sub12.h" -#include "titanic/pet_control/pet_graphic.h" +#include "titanic/pet_control/pet_gfx_element.h" namespace Titanic { class CPetControlSub5 : public CPetSection { private: - CPetGraphic _val1; - CPetGraphic _val2; - CPetGraphic _val3; - CPetGraphic _val4; + CPetGfxElement _val1; + CPetGfxElement _val2; + CPetGfxElement _val3; + CPetGfxElement _val4; int _field98; int _field9C; int _fieldA0; - CPetGraphic _valArray1[6]; + CPetGfxElement _valArray1[6]; int _field17C; int _field18C; CPetControlSub12 _sub12; diff --git a/engines/titanic/pet_control/pet_conversation_section.h b/engines/titanic/pet_control/pet_conversation_section.h index 15d57e7272..863a0d99e2 100644 --- a/engines/titanic/pet_control/pet_conversation_section.h +++ b/engines/titanic/pet_control/pet_conversation_section.h @@ -25,24 +25,24 @@ #include "titanic/pet_control/pet_section.h" #include "titanic/pet_control/pet_control_sub12.h" -#include "titanic/pet_control/pet_graphic.h" +#include "titanic/pet_control/pet_gfx_element.h" namespace Titanic { class CPetConversationSection : public CPetSection { private: - CPetGraphic _val1; - CPetGraphic _val2; - CPetGraphic _val3; - CPetGraphic _valArray1[3]; - CPetGraphic _val4; - CPetGraphic _val5; - CPetGraphic _val6; + CPetGfxElement _val1; + CPetGfxElement _val2; + CPetGfxElement _val3; + CPetGfxElement _valArray1[3]; + CPetGfxElement _val4; + CPetGfxElement _val5; + CPetGfxElement _val6; int _field14C; - CPetGraphic _val7; - CPetGraphic _val8; - CPetGraphic _val9; - CPetGraphic _valArray2[9]; + CPetGfxElement _val7; + CPetGfxElement _val8; + CPetGfxElement _val9; + CPetGfxElement _valArray2[9]; int _field30C; CPetControlSub12 _sub1; CPetControlSub12 _sub2; diff --git a/engines/titanic/pet_control/pet_frame.h b/engines/titanic/pet_control/pet_frame.h index e307a73901..83543ef87c 100644 --- a/engines/titanic/pet_control/pet_frame.h +++ b/engines/titanic/pet_control/pet_frame.h @@ -24,7 +24,7 @@ #define TITANIC_PET_FRAME_H #include "titanic/pet_control/pet_section.h" -#include "titanic/pet_control/pet_graphic.h" +#include "titanic/pet_control/pet_gfx_element.h" namespace Titanic { @@ -32,13 +32,13 @@ class CPetFrame : public CPetSection { private: static int _indexes[6]; - CPetGraphic _modeButtons[6]; - CPetGraphic _titles[6]; - CPetGraphic _modeBackground; - CPetGraphic _val2; - CPetGraphic _val3; - CPetGraphic _background; - CPetGraphic _indent[7]; + CPetGfxElement _modeButtons[6]; + CPetGfxElement _titles[6]; + CPetGfxElement _modeBackground; + CPetGfxElement _val2; + CPetGfxElement _val3; + CPetGfxElement _background; + CPetGfxElement _indent[7]; private: /** * Called to set the owning PET instance and set some initial state diff --git a/engines/titanic/pet_control/pet_gfx_element.cpp b/engines/titanic/pet_control/pet_gfx_element.cpp new file mode 100644 index 0000000000..bec54b9c28 --- /dev/null +++ b/engines/titanic/pet_control/pet_gfx_element.cpp @@ -0,0 +1,90 @@ +/* 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/textconsole.h" +#include "titanic/core/game_object.h" +#include "titanic/pet_control/pet_element.h" +#include "titanic/pet_control/pet_control.h" + +namespace Titanic { + +void CPetGfxElement::setup(PetElementMode mode, const CString &name, + CPetControl *petControl) { + switch (mode) { + case MODE_0: + _object0 = petControl->getHiddenObject(name); + break; + case MODE_1: + _object1 = petControl->getHiddenObject(name); + break; + case MODE_2: + _object2 = petControl->getHiddenObject(name); + break; + default: + break; + } +} + +void CPetGfxElement::setup() { + error("TODO"); +} + +void CPetGfxElement::draw(CScreenManager *screenManager) { + draw(screenManager, Common::Point(_bounds.left, _bounds.top)); +} + +void CPetGfxElement::draw(CScreenManager *screenManager, const Common::Point &destPos) { + CGameObject *obj = getObject(); + if (!obj) + obj = _object0; + + if (obj) + obj->draw(screenManager, destPos); +} + +void CPetGfxElement::getBounds(Rect *rect) { + if (rect) { + CGameObject *obj = getObject(); + if (!obj) + obj = _object0; + + if (obj && obj->getSurface45()) + *rect = _bounds; + else + rect->clear(); + } +} + +CGameObject *CPetGfxElement::getObject() const { + switch (_mode) { + case MODE_0: + return _object0; + case MODE_1: + return _object1; + case MODE_2: + return _object2; + default: + return nullptr; + } +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_gfx_element.h b/engines/titanic/pet_control/pet_gfx_element.h new file mode 100644 index 0000000000..47720cf81a --- /dev/null +++ b/engines/titanic/pet_control/pet_gfx_element.h @@ -0,0 +1,70 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_GFX_ELEMENT_H +#define TITANIC_PET_GFX_ELEMENT_H + +#include "titanic/pet_control/pet_element.h" + +namespace Titanic { + +class CPetGfxElement: public CPetElement { +protected: + CGameObject *_object0; + CGameObject *_object1; + CGameObject *_object2; +public: + CPetGfxElement() : CPetElement(), _object0(nullptr), _object1(nullptr), + _object2(nullptr) {} + + /** + * Load an object into the element + */ + virtual void setup(PetElementMode mode, const CString &name, + CPetControl *petControl); + + virtual void setup(); + + /** + * Draw the item + */ + virtual void draw(CScreenManager *screenManager); + + /** + * Draw the item + */ + virtual void draw(CScreenManager *screenManager, const Common::Point &destPos); + + /** + * Get the bounds for the element + */ + virtual void getBounds(Rect *rect); + + /** + * Get the game object associated with this item + */ + virtual CGameObject *getObject() const; +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_GFX_ELEMENT_H */ diff --git a/engines/titanic/pet_control/pet_graphic.cpp b/engines/titanic/pet_control/pet_graphic.cpp deleted file mode 100644 index c9fd5f5af1..0000000000 --- a/engines/titanic/pet_control/pet_graphic.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* 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/textconsole.h" -#include "titanic/core/game_object.h" -#include "titanic/pet_control/pet_graphic.h" -#include "titanic/pet_control/pet_control.h" - -namespace Titanic { - -void CPetGraphic::loadObject(PetElementMode mode, const CString &name, - CPetControl *petControl) { - switch (mode) { - case MODE_0: - _object0 = petControl->getHiddenObject(name); - break; - case MODE_1: - _object1 = petControl->getHiddenObject(name); - break; - case MODE_2: - _object2 = petControl->getHiddenObject(name); - break; - default: - break; - } -} - -void CPetGraphic::proc2() { - error("TODO"); -} - -void CPetGraphic::draw(CScreenManager *screenManager) { - draw(screenManager, Common::Point(_bounds.left, _bounds.top)); -} - -void CPetGraphic::draw(CScreenManager *screenManager, const Common::Point &destPos) { - CGameObject *obj = getObject(); - if (!obj) - obj = _object0; - - if (obj) - obj->draw(screenManager, destPos); -} - -void CPetGraphic::getBounds(Rect *rect) { - if (rect) { - CGameObject *obj = getObject(); - if (!obj) - obj = _object0; - - if (obj && obj->getSurface45()) - *rect = _bounds; - else - rect->clear(); - } -} - -CGameObject *CPetGraphic::getObject() const { - switch (_mode) { - case MODE_0: - return _object0; - case MODE_1: - return _object1; - case MODE_2: - return _object2; - default: - return nullptr; - } -} - -} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_graphic.h b/engines/titanic/pet_control/pet_graphic.h deleted file mode 100644 index 8b9c495205..0000000000 --- a/engines/titanic/pet_control/pet_graphic.h +++ /dev/null @@ -1,70 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_GRAPHIC_H -#define TITANIC_PET_GRAPHIC_H - -#include "titanic/pet_control/pet_element.h" - -namespace Titanic { - -class CPetGraphic: public CPetElement { -protected: - CGameObject *_object0; - CGameObject *_object1; - CGameObject *_object2; -public: - CPetGraphic() : CPetElement(), _object0(nullptr), _object1(nullptr), - _object2(nullptr) {} - - /** - * Load an object into the element - */ - virtual void loadObject(PetElementMode mode, const CString &name, - CPetControl *petControl); - - virtual void proc2(); - - /** - * Draw the item - */ - virtual void draw(CScreenManager *screenManager); - - /** - * Draw the item - */ - virtual void draw(CScreenManager *screenManager, const Common::Point &destPos); - - /** - * Get the bounds for the element - */ - virtual void getBounds(Rect *rect); - - /** - * Get the game object associated with this item - */ - virtual CGameObject *getObject() const; -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_GRAPHIC_H */ diff --git a/engines/titanic/pet_control/pet_remote_section.h b/engines/titanic/pet_control/pet_remote_section.h index 6a3d1cd429..562579dc50 100644 --- a/engines/titanic/pet_control/pet_remote_section.h +++ b/engines/titanic/pet_control/pet_remote_section.h @@ -26,24 +26,24 @@ #include "titanic/pet_control/pet_section.h" #include "titanic/pet_control/pet_control_sub10.h" #include "titanic/pet_control/pet_control_sub12.h" -#include "titanic/pet_control/pet_graphic.h" +#include "titanic/pet_control/pet_gfx_element.h" namespace Titanic { class CPetRemoteSection : public CPetSection { private: CPetControlSub10 _sub10; - CPetGraphic _val1; - CPetGraphic _val2; - CPetGraphic _val3; - CPetGraphic _val4; - CPetGraphic _val5; - CPetGraphic _val6; - CPetGraphic _val7; - CPetGraphic _val8; - CPetGraphic _val9; - CPetGraphic _val10; - CPetGraphic _val11; + CPetGfxElement _val1; + CPetGfxElement _val2; + CPetGfxElement _val3; + CPetGfxElement _val4; + CPetGfxElement _val5; + CPetGfxElement _val6; + CPetGfxElement _val7; + CPetGfxElement _val8; + CPetGfxElement _val9; + CPetGfxElement _val10; + CPetGfxElement _val11; CPetControlSub12 _sub12; public: diff --git a/engines/titanic/pet_control/pet_rooms_section.h b/engines/titanic/pet_control/pet_rooms_section.h index fc26c340cf..66c6e8cc0a 100644 --- a/engines/titanic/pet_control/pet_rooms_section.h +++ b/engines/titanic/pet_control/pet_rooms_section.h @@ -42,7 +42,7 @@ private: int _field114; int _field118; int _field11C; - CPetGraphic _val1; + CPetGfxElement _val1; CPetControlSub12 _sub12; int _field1C0; int _field1C4; -- cgit v1.2.3 From d94b1dc7bb68ee1641edcbbd31fd40ef7e5dc442 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 31 Mar 2016 19:55:45 -0400 Subject: TITANIC: Implemented CPetGfxElement setup method --- engines/titanic/core/tree_item.cpp | 10 ++++++++++ engines/titanic/core/tree_item.h | 3 +++ engines/titanic/pet_control/pet_element.h | 2 +- engines/titanic/pet_control/pet_gfx_element.cpp | 19 +++++++++++++++++-- engines/titanic/pet_control/pet_gfx_element.h | 7 +++++-- engines/titanic/string.cpp | 6 ++++++ engines/titanic/string.h | 2 ++ 7 files changed, 44 insertions(+), 5 deletions(-) diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index 61fcf97183..55deee07df 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -289,4 +289,14 @@ CRoomItem *CTreeItem::getRoom() const { return gameManager ? gameManager->getRoom() : nullptr; } +int CTreeItem::getState8() const { + CGameManager *gameManager = getGameManager(); + return gameManager ? gameManager->_gameState._field8 : 3; +} + +int CTreeItem::getStateC() const { + CGameManager *gameManager = getGameManager(); + return gameManager ? gameManager->_gameState._fieldC : 3; +} + } // End of namespace Titanic diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index f5e28f1056..d710fcf0b8 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -247,6 +247,9 @@ public: * Return the current room */ CRoomItem *getRoom() const; + + int getState8() const; + int getStateC() const; }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_element.h b/engines/titanic/pet_control/pet_element.h index e5ab8d3fdd..c6b0054ca6 100644 --- a/engines/titanic/pet_control/pet_element.h +++ b/engines/titanic/pet_control/pet_element.h @@ -51,7 +51,7 @@ public: /** * Sets up the element */ - virtual void setup() {} + virtual void setup(int val, const CString &name, CPetControl *petControl) {} /** * Draw the item diff --git a/engines/titanic/pet_control/pet_gfx_element.cpp b/engines/titanic/pet_control/pet_gfx_element.cpp index bec54b9c28..5f2f05e6c3 100644 --- a/engines/titanic/pet_control/pet_gfx_element.cpp +++ b/engines/titanic/pet_control/pet_gfx_element.cpp @@ -44,8 +44,23 @@ void CPetGfxElement::setup(PetElementMode mode, const CString &name, } } -void CPetGfxElement::setup() { - error("TODO"); +void CPetGfxElement::setup(const CString &name, CPetControl *petControl) { + if (!petControl) + return; + + CString numString(3); + int state8 = petControl->getState8(); + + if (state8 >= 1 && state8 <= 3) { + numString = CString(state8); + } else if (state8 == 4) { + int stateC = petControl->getStateC(); + if (stateC == 1) + numString = CString(stateC); + } + + CString resName = numString + name; + setup(resName, petControl); } void CPetGfxElement::draw(CScreenManager *screenManager) { diff --git a/engines/titanic/pet_control/pet_gfx_element.h b/engines/titanic/pet_control/pet_gfx_element.h index 47720cf81a..b0bf6e4abe 100644 --- a/engines/titanic/pet_control/pet_gfx_element.h +++ b/engines/titanic/pet_control/pet_gfx_element.h @@ -37,12 +37,15 @@ public: _object2(nullptr) {} /** - * Load an object into the element + * Setup the element */ virtual void setup(PetElementMode mode, const CString &name, CPetControl *petControl); - virtual void setup(); + /** + * Setup the element + */ + virtual void setup(const CString &name, CPetControl *petControl); /** * Draw the item diff --git a/engines/titanic/string.cpp b/engines/titanic/string.cpp index 5831b7dc3a..f29d2c7938 100644 --- a/engines/titanic/string.cpp +++ b/engines/titanic/string.cpp @@ -25,6 +25,12 @@ namespace Titanic { +CString::CString(char c, uint32 len) : Common::String() { + ensureCapacity(len, false); + for (uint idx = 0; idx < len; ++idx) + (*this) += c; +} + CString CString::left(uint count) const { return (count > size()) ? CString() : CString(c_str(), c_str() + count); } diff --git a/engines/titanic/string.h b/engines/titanic/string.h index 08b5649dc9..0c0c64e0be 100644 --- a/engines/titanic/string.h +++ b/engines/titanic/string.h @@ -44,7 +44,9 @@ public: CString(const char *str, uint32 len) : Common::String(str, len) {} CString(const char *beginP, const char *endP) : Common::String(beginP, endP) {} CString(const String &str) : Common::String(str) {} + CString(char c, uint32 len); explicit CString(char c) : Common::String(c) {} + explicit CString(int val) : Common::String(Common::String::format("%d", val)) {} /** * Returns the left n characters of the string -- cgit v1.2.3 From 24a2fc7e853d826f184bcd977e69a0d906f327a7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 31 Mar 2016 20:27:28 -0400 Subject: TITANIC: Implement CPetFrame setup and drawing code --- engines/titanic/pet_control/pet_control.h | 3 ++- engines/titanic/pet_control/pet_frame.cpp | 27 +++++++++++++++++++++++-- engines/titanic/pet_control/pet_gfx_element.cpp | 4 ++-- engines/titanic/pet_control/pet_gfx_element.h | 2 +- engines/titanic/pet_control/pet_section.h | 5 ++++- engines/titanic/string.cpp | 6 ++++++ engines/titanic/string.h | 2 +- 7 files changed, 41 insertions(+), 8 deletions(-) diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 4f101caaf5..4fcfe6e7a4 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -39,7 +39,6 @@ namespace Titanic { class CPetControl : public CGameObject { private: - PetArea _currentArea; int _fieldC0; int _locked; int _fieldC8; @@ -87,6 +86,8 @@ private: * Returns a reference to the special hidden room container */ CRoomItem *getHiddenRoom(); +public: + PetArea _currentArea; public: CLASSDEF CPetControl(); diff --git a/engines/titanic/pet_control/pet_frame.cpp b/engines/titanic/pet_control/pet_frame.cpp index e94bc6c848..48a05cdd11 100644 --- a/engines/titanic/pet_control/pet_frame.cpp +++ b/engines/titanic/pet_control/pet_frame.cpp @@ -21,6 +21,7 @@ */ #include "titanic/pet_control/pet_frame.h" +#include "titanic/pet_control/pet_control.h" namespace Titanic { @@ -41,7 +42,23 @@ bool CPetFrame::setup(CPetControl *petControl) { bool CPetFrame::setup() { if (_petControl) { - // TODO + _background.setup("PetBackground", _petControl, MODE_0); + _modeBackground.setup("PetModeBackground", _petControl, MODE_0); + + for (int idx = 0; idx < 5; ++idx) { + CString resName = Common::String::format("PetMode%d", idx); + _modeButtons[idx].setup(resName, _petControl, MODE_0); + } + + for (int idx = 0; idx < 6; ++idx) { + CString resName = Common::String::format("3Pettitle%d", idx); + _titles[idx].setup(resName, _petControl, MODE_0); + } + + for (int idx = 0; idx < 7; ++idx) { + CString resName = Common::String::format("PetIndent%d", idx); + _titles[idx].setup(resName, _petControl, MODE_0); + } } return true; @@ -98,7 +115,13 @@ void CPetFrame::setArea(PetArea newArea) { } void CPetFrame::drawFrame(CScreenManager *screenManager) { - warning("TODO: CPetFrame::drawFrame"); + _background.draw(screenManager); + _modeBackground.draw(screenManager); + + for (int idx = 0; idx < 5; ++idx) + _modeButtons[idx].draw(screenManager); + + _titles[_petControl->_currentArea].draw(screenManager); } } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_gfx_element.cpp b/engines/titanic/pet_control/pet_gfx_element.cpp index 5f2f05e6c3..616db72377 100644 --- a/engines/titanic/pet_control/pet_gfx_element.cpp +++ b/engines/titanic/pet_control/pet_gfx_element.cpp @@ -44,7 +44,7 @@ void CPetGfxElement::setup(PetElementMode mode, const CString &name, } } -void CPetGfxElement::setup(const CString &name, CPetControl *petControl) { +void CPetGfxElement::setup(const CString &name, CPetControl *petControl, PetElementMode mode) { if (!petControl) return; @@ -60,7 +60,7 @@ void CPetGfxElement::setup(const CString &name, CPetControl *petControl) { } CString resName = numString + name; - setup(resName, petControl); + setup(mode, resName, petControl); } void CPetGfxElement::draw(CScreenManager *screenManager) { diff --git a/engines/titanic/pet_control/pet_gfx_element.h b/engines/titanic/pet_control/pet_gfx_element.h index b0bf6e4abe..a4c39c6d24 100644 --- a/engines/titanic/pet_control/pet_gfx_element.h +++ b/engines/titanic/pet_control/pet_gfx_element.h @@ -45,7 +45,7 @@ public: /** * Setup the element */ - virtual void setup(const CString &name, CPetControl *petControl); + virtual void setup(const CString &name, CPetControl *petControl, PetElementMode mode); /** * Draw the item diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 77535662a6..2612d64a19 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -85,7 +85,10 @@ public: /** * Returns true if the object is in a valid state */ - virtual bool isValid(CPetControl *petControl) { return false; } + virtual bool isValid(CPetControl *petControl) { + // TODO: Switch back to false after implementing all sections + return true; + } /** * Load the data for the class from file diff --git a/engines/titanic/string.cpp b/engines/titanic/string.cpp index f29d2c7938..6b43e7992b 100644 --- a/engines/titanic/string.cpp +++ b/engines/titanic/string.cpp @@ -31,6 +31,12 @@ CString::CString(char c, uint32 len) : Common::String() { (*this) += c; } +CString::CString(int val) : Common::String() { + char buffer[16]; + itoa(val, buffer, 10); + *this += buffer; +} + CString CString::left(uint count) const { return (count > size()) ? CString() : CString(c_str(), c_str() + count); } diff --git a/engines/titanic/string.h b/engines/titanic/string.h index 0c0c64e0be..c41130369b 100644 --- a/engines/titanic/string.h +++ b/engines/titanic/string.h @@ -46,7 +46,7 @@ public: CString(const String &str) : Common::String(str) {} CString(char c, uint32 len); explicit CString(char c) : Common::String(c) {} - explicit CString(int val) : Common::String(Common::String::format("%d", val)) {} + explicit CString(int val); /** * Returns the left n characters of the string -- cgit v1.2.3 From 3149cd1a341f6001922e6bddce1a376db1fea49c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 31 Mar 2016 20:53:41 -0400 Subject: TITANIC: Implement CTreeItem::getHiddenRoom --- engines/titanic/core/tree_item.cpp | 5 +++++ engines/titanic/core/tree_item.h | 5 +++++ engines/titanic/pet_control/pet_control.cpp | 2 +- engines/titanic/pet_control/pet_control.h | 10 +++++----- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index 55deee07df..e7b61dc853 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -289,6 +289,11 @@ CRoomItem *CTreeItem::getRoom() const { return gameManager ? gameManager->getRoom() : nullptr; } +CRoomItem *CTreeItem::getHiddenRoom() const { + CProjectItem *root = getRoot(); + return root ? root->findHiddenRoom() : nullptr; +} + int CTreeItem::getState8() const { CGameManager *gameManager = getGameManager(); return gameManager ? gameManager->_gameState._field8 : 3; diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index d710fcf0b8..9710a255d0 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -248,6 +248,11 @@ public: */ CRoomItem *getRoom() const; + /** + * Returns the special hidden room container + */ + CRoomItem *getHiddenRoom() const; + int getState8() const; int getStateC() const; }; diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 4fe0c1d255..8376f4ac2c 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -284,7 +284,7 @@ void CPetControl::fn3(CTreeItem *item) { CRoomItem *CPetControl::getHiddenRoom() { if (!_hiddenRoom) - _hiddenRoom = getHiddenRoom(); + _hiddenRoom = CTreeItem::getHiddenRoom(); return _hiddenRoom; } diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 4fcfe6e7a4..ea7c6845f3 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -81,11 +81,6 @@ private: * Scan the specified room for an item by name */ CGameObject *findItemInRoom(CRoomItem *room, const CString &name) const; - - /** - * Returns a reference to the special hidden room container - */ - CRoomItem *getHiddenRoom(); public: PetArea _currentArea; public: @@ -150,6 +145,11 @@ public: * special hidden room container */ CGameObject *getHiddenObject(const CString &name); + + /** + * Returns a reference to the special hidden room container + */ + CRoomItem *getHiddenRoom(); }; } // End of namespace Titanic -- cgit v1.2.3 From 7d819f71f7d9fdd794b12ac55bd2177f12069c1b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 31 Mar 2016 21:40:36 -0400 Subject: TITANIC: PET frame is now showing --- engines/titanic/pet_control/pet_control.cpp | 123 +++++++++++++-------- engines/titanic/pet_control/pet_control.h | 22 +++- engines/titanic/pet_control/pet_control_sub5.cpp | 5 + engines/titanic/pet_control/pet_control_sub5.h | 5 + engines/titanic/pet_control/pet_control_sub7.cpp | 5 + engines/titanic/pet_control/pet_control_sub7.h | 5 +- .../pet_control/pet_conversation_section.cpp | 5 + .../titanic/pet_control/pet_conversation_section.h | 5 + engines/titanic/pet_control/pet_frame.h | 4 + .../titanic/pet_control/pet_inventory_section.cpp | 5 + .../titanic/pet_control/pet_inventory_section.h | 5 + engines/titanic/pet_control/pet_remote_section.cpp | 5 + engines/titanic/pet_control/pet_remote_section.h | 6 +- engines/titanic/pet_control/pet_rooms_section.cpp | 6 + engines/titanic/pet_control/pet_rooms_section.h | 5 + engines/titanic/pet_control/pet_save_section.cpp | 5 + engines/titanic/pet_control/pet_save_section.h | 5 +- engines/titanic/pet_control/pet_section.cpp | 4 - engines/titanic/pet_control/pet_section.h | 11 +- 19 files changed, 172 insertions(+), 64 deletions(-) diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 8376f4ac2c..6df688ef75 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -29,7 +29,8 @@ namespace Titanic { CPetControl::CPetControl() : CGameObject(), _currentArea(PET_CONVERSATION), _fieldC0(0), _locked(0), _fieldC8(0), - _treeItem1(nullptr), _treeItem2(nullptr), _hiddenRoom(nullptr) { + _treeItem1(nullptr), _treeItem2(nullptr), _hiddenRoom(nullptr), + _drawBounds(20, 350, 620, 480) { } void CPetControl::save(SimpleFile *file, int indent) const { @@ -58,46 +59,46 @@ void CPetControl::load(SimpleFile *file) { } bool CPetControl::isValid() { - return _convSection.isValid(this) && - _roomsSection.isValid(this) && - _remoteSection.isValid(this) && - _invSection.isValid(this) && + return _conversations.isValid(this) && + _rooms.isValid(this) && + _remote.isValid(this) && + _inventory.isValid(this) && _sub5.isValid(this) && - _saveSection.isValid(this) && + _saves.isValid(this) && _sub7.isValid(this) && _frame.isValid(this); } void CPetControl::loadAreas(SimpleFile *file, int param) { - _convSection.load(file, param); - _roomsSection.load(file, param); - _remoteSection.load(file, param); - _invSection.load(file, param); + _conversations.load(file, param); + _rooms.load(file, param); + _remote.load(file, param); + _inventory.load(file, param); _sub5.load(file, param); - _saveSection.load(file, param); + _saves.load(file, param); _sub7.load(file, param); _frame.load(file, param); } void CPetControl::saveAreas(SimpleFile *file, int indent) const { - _convSection.save(file, indent); - _roomsSection.save(file, indent); - _remoteSection.save(file, indent); - _invSection.save(file, indent); + _conversations.save(file, indent); + _rooms.save(file, indent); + _remote.save(file, indent); + _inventory.save(file, indent); _sub5.save(file, indent); - _saveSection.save(file, indent); + _saves.save(file, indent); _sub7.save(file, indent); _frame.save(file, indent); } void CPetControl::draw(CScreenManager *screenManager) { CGameManager *gameManager = getGameManager(); - Rect bounds = _oldBounds; + Rect bounds = _drawBounds; bounds.constrain(gameManager->_bounds); if (!bounds.isEmpty()) { if (_fieldC8 >= 0) { - _invSection.proc5(_fieldC8); + _inventory.proc5(_fieldC8); _fieldC8 = -1; } @@ -106,19 +107,19 @@ void CPetControl::draw(CScreenManager *screenManager) { // Draw the specific area that's currently active switch (_currentArea) { case PET_INVENTORY: - _invSection.draw(screenManager); + _inventory.draw(screenManager); break; case PET_CONVERSATION: - _convSection.draw(screenManager); + _conversations.draw(screenManager); break; case PET_REMOTE: - _remoteSection.draw(screenManager); + _remote.draw(screenManager); break; case PET_ROOMS: - _roomsSection.draw(screenManager); + _rooms.draw(screenManager); break; case PET_SAVE: - _saveSection.draw(screenManager); + _saves.draw(screenManager); break; case PET_5: _sub5.draw(screenManager); @@ -132,6 +133,34 @@ void CPetControl::draw(CScreenManager *screenManager) { } } +Rect CPetControl::getBounds() { + switch (_currentArea) { + case PET_INVENTORY: + return _inventory.getBounds(); + break; + case PET_CONVERSATION: + return _conversations.getBounds(); + break; + case PET_REMOTE: + return _remote.getBounds(); + break; + case PET_ROOMS: + return _rooms.getBounds(); + break; + case PET_SAVE: + return _saves.getBounds(); + break; + case PET_5: + return _sub5.getBounds(); + break; + case PET_6: + return _sub7.getBounds(); + break; + default: + break; + } +} + void CPetControl::postLoad() { CProjectItem *root = getRoot(); @@ -145,12 +174,12 @@ void CPetControl::postLoad() { } void CPetControl::loaded() { - _convSection.postLoad(); - _roomsSection.postLoad(); - _remoteSection.postLoad(); - _invSection.postLoad(); + _conversations.postLoad(); + _rooms.postLoad(); + _remote.postLoad(); + _inventory.postLoad(); _sub5.postLoad(); - _saveSection.postLoad(); + _saves.postLoad(); _sub7.postLoad(); _frame.postLoad(); } @@ -160,8 +189,8 @@ void CPetControl::enterNode(CNodeItem *node) { } void CPetControl::enterRoom(CRoomItem *room) { - _roomsSection.enterRoom(room); - _remoteSection.enterRoom(room); + _rooms.enterRoom(room); + _remote.enterRoom(room); } void CPetControl::clear() { @@ -185,19 +214,19 @@ PetArea CPetControl::setArea(PetArea newArea) { // Signal the currently active area that it's being left switch (_currentArea) { case PET_INVENTORY: - _invSection.leave(); + _inventory.leave(); break; case PET_CONVERSATION: - _convSection.leave(); + _conversations.leave(); break; case PET_REMOTE: - _remoteSection.leave(); + _remote.leave(); break; case PET_ROOMS: - _roomsSection.leave(); + _rooms.leave(); break; case PET_SAVE: - _saveSection.leave(); + _saves.leave(); break; case PET_5: _sub5.leave(); @@ -217,20 +246,20 @@ PetArea CPetControl::setArea(PetArea newArea) { // Signal to the new view that it's been activated switch (newArea) { case PET_INVENTORY: - _invSection.enter(oldArea); + _inventory.enter(oldArea); break; case PET_CONVERSATION: - _convSection.enter(oldArea); + _conversations.enter(oldArea); break; case PET_REMOTE: - _remoteSection.enter(oldArea); + _remote.enter(oldArea); break; case PET_ROOMS: - _roomsSection.enter(oldArea); + _rooms.enter(oldArea); break; case PET_SAVE: - _saveSection.enter(oldArea); + _saves.enter(oldArea); break; case PET_5: _sub5.enter(oldArea); @@ -249,19 +278,19 @@ PetArea CPetControl::setArea(PetArea newArea) { void CPetControl::fn2(int val) { switch (_currentArea) { case PET_INVENTORY: - _invSection.proc38(val); + _inventory.proc38(val); break; case PET_CONVERSATION: - _convSection.proc38(val); + _conversations.proc38(val); break; case PET_REMOTE: - _remoteSection.proc38(val); + _remote.proc38(val); break; case PET_ROOMS: - _roomsSection.proc38(val); + _rooms.proc38(val); break; case PET_SAVE: - _saveSection.proc38(val); + _saves.proc38(val); break; case PET_5: _sub5.proc38(val); @@ -309,4 +338,8 @@ CGameObject *CPetControl::getHiddenObject(const CString &name) { return room ? findItemInRoom(room, name) : nullptr; } +bool CPetControl::containsPt(const Common::Point &pt) const { + return _drawBounds.contains(pt); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index ea7c6845f3..24ab78a963 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -42,11 +42,11 @@ private: int _fieldC0; int _locked; int _fieldC8; - CPetConversationSection _convSection; - CPetInventorySection _invSection; - CPetRemoteSection _remoteSection; - CPetRoomsSection _roomsSection; - CPetSaveSection _saveSection; + CPetConversationSection _conversations; + CPetInventorySection _inventory; + CPetRemoteSection _remote; + CPetRoomsSection _rooms; + CPetSaveSection _saves; CPetControlSub5 _sub5; CPetControlSub7 _sub7; CPetFrame _frame; @@ -55,7 +55,7 @@ private: CTreeItem *_treeItem2; CString _string2; CRoomItem *_hiddenRoom; - Rect _oldBounds; + Rect _drawBounds; private: /** * Returns true if the control is in a valid state @@ -81,6 +81,11 @@ private: * Scan the specified room for an item by name */ CGameObject *findItemInRoom(CRoomItem *room, const CString &name) const; + + /** + * Returns true if the draw bounds contains the specified point + */ + bool containsPt(const Common::Point &pt) const; public: PetArea _currentArea; public: @@ -102,6 +107,11 @@ public: */ virtual void draw(CScreenManager *screenManager); + /** + * Gets the bounds occupied by the item + */ + virtual Rect getBounds(); + /** * Called after loading a game has finished */ diff --git a/engines/titanic/pet_control/pet_control_sub5.cpp b/engines/titanic/pet_control/pet_control_sub5.cpp index 6a9b92e7b2..0b43853704 100644 --- a/engines/titanic/pet_control/pet_control_sub5.cpp +++ b/engines/titanic/pet_control/pet_control_sub5.cpp @@ -40,4 +40,9 @@ void CPetControlSub5::load(SimpleFile *file, int param) { } } +bool CPetControlSub5::isValid(CPetControl *petControl) { + // TODO + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub5.h b/engines/titanic/pet_control/pet_control_sub5.h index 088ba6fd27..4997bf195d 100644 --- a/engines/titanic/pet_control/pet_control_sub5.h +++ b/engines/titanic/pet_control/pet_control_sub5.h @@ -56,6 +56,11 @@ public: * Load the data for the class from file */ virtual void load(SimpleFile *file, int param); + + /** + * Returns true if the object is in a valid state + */ + virtual bool isValid(CPetControl *petControl); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub7.cpp b/engines/titanic/pet_control/pet_control_sub7.cpp index f57454da67..5b033220c7 100644 --- a/engines/titanic/pet_control/pet_control_sub7.cpp +++ b/engines/titanic/pet_control/pet_control_sub7.cpp @@ -24,4 +24,9 @@ namespace Titanic { +bool CPetControlSub7::isValid(CPetControl *petControl) { + // TODO + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub7.h b/engines/titanic/pet_control/pet_control_sub7.h index fba7d2d6bf..5ad0ba793e 100644 --- a/engines/titanic/pet_control/pet_control_sub7.h +++ b/engines/titanic/pet_control/pet_control_sub7.h @@ -33,7 +33,10 @@ private: CPetControlSub12 _sub1; CPetControlSub12 _sub2; public: - + /** + * Returns true if the object is in a valid state + */ + virtual bool isValid(CPetControl *petControl); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_conversation_section.cpp b/engines/titanic/pet_control/pet_conversation_section.cpp index 890a03dac6..166c8ecc47 100644 --- a/engines/titanic/pet_control/pet_conversation_section.cpp +++ b/engines/titanic/pet_control/pet_conversation_section.cpp @@ -40,4 +40,9 @@ void CPetConversationSection::load(SimpleFile *file, int param) { _valArray3[idx] = file->readNumber(); } +bool CPetConversationSection::isValid(CPetControl *petControl) { + // TODO + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_conversation_section.h b/engines/titanic/pet_control/pet_conversation_section.h index 863a0d99e2..55492ceb1a 100644 --- a/engines/titanic/pet_control/pet_conversation_section.h +++ b/engines/titanic/pet_control/pet_conversation_section.h @@ -62,6 +62,11 @@ public: * Load the data for the class from file */ virtual void load(SimpleFile *file, int param); + + /** + * Returns true if the object is in a valid state + */ + virtual bool isValid(CPetControl *petControl); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_frame.h b/engines/titanic/pet_control/pet_frame.h index 83543ef87c..2bf9f2ace4 100644 --- a/engines/titanic/pet_control/pet_frame.h +++ b/engines/titanic/pet_control/pet_frame.h @@ -28,6 +28,10 @@ namespace Titanic { +/** + * This implements the frame and background for the PET display. + * This includes the area buttons and title + */ class CPetFrame : public CPetSection { private: static int _indexes[6]; diff --git a/engines/titanic/pet_control/pet_inventory_section.cpp b/engines/titanic/pet_control/pet_inventory_section.cpp index d859576399..675d6033c9 100644 --- a/engines/titanic/pet_control/pet_inventory_section.cpp +++ b/engines/titanic/pet_control/pet_inventory_section.cpp @@ -39,4 +39,9 @@ void CPetInventorySection::load(SimpleFile *file, int param) { _field298 = file->readNumber(); } +bool CPetInventorySection::isValid(CPetControl *petControl) { + // TODO + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory_section.h b/engines/titanic/pet_control/pet_inventory_section.h index 4adad469a7..4d36e2fba9 100644 --- a/engines/titanic/pet_control/pet_inventory_section.h +++ b/engines/titanic/pet_control/pet_inventory_section.h @@ -52,6 +52,11 @@ public: * Load the data for the class from file */ virtual void load(SimpleFile *file, int param); + + /** + * Returns true if the object is in a valid state + */ + virtual bool isValid(CPetControl *petControl); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_remote_section.cpp b/engines/titanic/pet_control/pet_remote_section.cpp index 7cdde01252..37720848cc 100644 --- a/engines/titanic/pet_control/pet_remote_section.cpp +++ b/engines/titanic/pet_control/pet_remote_section.cpp @@ -24,4 +24,9 @@ namespace Titanic { +bool CPetRemoteSection::isValid(CPetControl *petControl) { + // TODO + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_remote_section.h b/engines/titanic/pet_control/pet_remote_section.h index 562579dc50..f3063bdd16 100644 --- a/engines/titanic/pet_control/pet_remote_section.h +++ b/engines/titanic/pet_control/pet_remote_section.h @@ -46,8 +46,10 @@ private: CPetGfxElement _val11; CPetControlSub12 _sub12; public: - - + /** + * Returns true if the object is in a valid state + */ + virtual bool isValid(CPetControl *petControl); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms_section.cpp b/engines/titanic/pet_control/pet_rooms_section.cpp index b866fb349d..d0d098580a 100644 --- a/engines/titanic/pet_control/pet_rooms_section.cpp +++ b/engines/titanic/pet_control/pet_rooms_section.cpp @@ -56,4 +56,10 @@ void CPetRoomsSection::load(SimpleFile *file, int param) { } } +bool CPetRoomsSection::isValid(CPetControl *petControl) { + // TODO + return true; +} + + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms_section.h b/engines/titanic/pet_control/pet_rooms_section.h index 66c6e8cc0a..a4bcefe09c 100644 --- a/engines/titanic/pet_control/pet_rooms_section.h +++ b/engines/titanic/pet_control/pet_rooms_section.h @@ -62,6 +62,11 @@ public: * Load the data for the class from file */ virtual void load(SimpleFile *file, int param); + + /** + * Returns true if the object is in a valid state + */ + virtual bool isValid(CPetControl *petControl); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_save_section.cpp b/engines/titanic/pet_control/pet_save_section.cpp index e513dd3013..8d24fed42c 100644 --- a/engines/titanic/pet_control/pet_save_section.cpp +++ b/engines/titanic/pet_control/pet_save_section.cpp @@ -24,4 +24,9 @@ namespace Titanic { +bool CPetSaveSection::isValid(CPetControl *petControl) { + // TODO + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_save_section.h b/engines/titanic/pet_control/pet_save_section.h index fb9004f47d..502338263f 100644 --- a/engines/titanic/pet_control/pet_save_section.h +++ b/engines/titanic/pet_control/pet_save_section.h @@ -34,7 +34,10 @@ private: CPetControlSub10 _sub10; CPetControlSub10 _sub12; public: - + /** + * Returns true if the object is in a valid state + */ + virtual bool isValid(CPetControl *petControl); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_section.cpp b/engines/titanic/pet_control/pet_section.cpp index 321f1fb94f..d531b5d0d7 100644 --- a/engines/titanic/pet_control/pet_section.cpp +++ b/engines/titanic/pet_control/pet_section.cpp @@ -25,10 +25,6 @@ namespace Titanic { -void CPetSection::proc4() { - error("TODO"); -} - void CPetSection::proc16() { error("TODO"); } diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 2612d64a19..b08e4d6869 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -68,7 +68,11 @@ public: */ virtual void draw(CScreenManager *screenManager) {} - virtual void proc4(); + /** + * Get the bounds for the section + */ + virtual Rect getBounds() { return Rect(); } + virtual void proc5(int val) {} virtual int proc6() { return 0; } virtual int proc7() { return 0; } @@ -85,10 +89,7 @@ public: /** * Returns true if the object is in a valid state */ - virtual bool isValid(CPetControl *petControl) { - // TODO: Switch back to false after implementing all sections - return true; - } + virtual bool isValid(CPetControl *petControl) { return false; } /** * Load the data for the class from file -- cgit v1.2.3 From 5923ee5001af91d1ca9294b1fead56ec04ece7df Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 31 Mar 2016 22:31:13 -0400 Subject: TITANIC: Implement CPetFrame::setArea --- engines/titanic/files_manager.cpp | 2 +- engines/titanic/game_state.cpp | 4 ++-- engines/titanic/game_state.h | 2 +- engines/titanic/input_handler.cpp | 2 +- engines/titanic/main_game_window.cpp | 4 ++-- engines/titanic/pet_control/pet_element.cpp | 8 ++++---- engines/titanic/pet_control/pet_element.h | 2 +- engines/titanic/pet_control/pet_frame.cpp | 27 ++++++++++++++++--------- engines/titanic/pet_control/pet_frame.h | 5 +++++ engines/titanic/pet_control/pet_gfx_element.cpp | 8 ++++---- 10 files changed, 38 insertions(+), 26 deletions(-) diff --git a/engines/titanic/files_manager.cpp b/engines/titanic/files_manager.cpp index 5db75cd67c..617b71b06a 100644 --- a/engines/titanic/files_manager.cpp +++ b/engines/titanic/files_manager.cpp @@ -76,7 +76,7 @@ void CFilesManager::debug(CScreenManager *screenManager) { void CFilesManager::resetView() { if (_gameManager) { - _gameManager->_gameState.setMode(GSMODE_1); + _gameManager->_gameState.setMode(GSMODE_SELECTED); _gameManager->initBounds(); } } diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index d191d982b0..cef8ed9abb 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -45,7 +45,7 @@ bool CGameStateMovieList::clear() { CGameState::CGameState(CGameManager *gameManager) : _gameManager(gameManager), _gameLocation(this), - _field8(0), _fieldC(0), _mode(GSMODE_0), _field14(0), _petActive(false), + _field8(0), _fieldC(0), _mode(GSMODE_UNSELECTED), _field14(0), _petActive(false), _field1C(0), _field20(0), _field24(0), _nodeChangeCtr(0), _nodeEnterTicks(0), _field38(0) { } @@ -157,7 +157,7 @@ void CGameState::changeView(CViewItem *newView, CMovieClip *clip) { void CGameState::checkForViewChange() { if (_mode == GSMODE_2 && _movieList.clear()) { - setMode(GSMODE_1); + setMode(GSMODE_SELECTED); if (_movieList._view) enterView(); } diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h index 49180aa38c..ec6ef44422 100644 --- a/engines/titanic/game_state.h +++ b/engines/titanic/game_state.h @@ -33,7 +33,7 @@ namespace Titanic { class CGameManager; -enum GameStateMode { GSMODE_0 = 0, GSMODE_1 = 1, GSMODE_2 = 2, GSMODE_3 = 3, GSMODE_4 = 4, GSMODE_5 = 5 }; +enum GameStateMode { GSMODE_UNSELECTED = 0, GSMODE_SELECTED = 1, GSMODE_2 = 2, GSMODE_3 = 3, GSMODE_4 = 4, GSMODE_5 = 5 }; PTR_LIST_ITEM(CMovie); class CGameStateMovieList : public List { diff --git a/engines/titanic/input_handler.cpp b/engines/titanic/input_handler.cpp index 2eb4427a46..8323531a1f 100644 --- a/engines/titanic/input_handler.cpp +++ b/engines/titanic/input_handler.cpp @@ -50,7 +50,7 @@ void CInputHandler::decLockCount() { void CInputHandler::handleMessage(CMessage &msg, bool respectLock) { if (!respectLock || _lockCount <= 0) { - if (_gameManager->_gameState._mode == GSMODE_1) { + if (_gameManager->_gameState._mode == GSMODE_SELECTED) { processMessage(&msg); } else if (!msg.isMouseMsg()) { g_vm->_filesManager.loadDrive(); diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 6abe83bd3f..5b8cba341a 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -68,7 +68,7 @@ void CMainGameWindow::applicationStarting() { // Load either a new game or selected existing save _project->loadGame(saveSlot); _inputAllowed = true; - _gameManager->_gameState.setMode(GSMODE_1); + _gameManager->_gameState.setMode(GSMODE_SELECTED); // TODO: Cursor/image @@ -123,7 +123,7 @@ void CMainGameWindow::draw() { scrManager->clearSurface(SURFACE_BACKBUFFER, &_gameManager->_bounds); switch (_gameManager->_gameState._mode) { - case GSMODE_1: + case GSMODE_SELECTED: case GSMODE_2: if (_gameManager->_gameState._petActive) drawPet(scrManager); diff --git a/engines/titanic/pet_control/pet_element.cpp b/engines/titanic/pet_control/pet_element.cpp index 39d8fea7d9..a4c5b271a0 100644 --- a/engines/titanic/pet_control/pet_element.cpp +++ b/engines/titanic/pet_control/pet_element.cpp @@ -26,7 +26,7 @@ namespace Titanic { -CPetElement::CPetElement() : _mode(MODE_0) {} +CPetElement::CPetElement() : _mode(MODE_UNSELECTED) {} void CPetElement::getBounds(Rect *rect) { if (rect) @@ -36,14 +36,14 @@ void CPetElement::getBounds(Rect *rect) { bool CPetElement::proc6(const Common::Point &pt) { bool result = _bounds.contains(pt); if (result) - setMode(MODE_1); + setMode(MODE_SELECTED); return result; } bool CPetElement::proc7(const Common::Point &pt) { bool result = _bounds.contains(pt); if (result) - setMode(MODE_0); + setMode(MODE_UNSELECTED); return result; } @@ -93,7 +93,7 @@ int CPetElement::proc15() { } void CPetElement::setMode(PetElementMode newMode) { - if (newMode >= MODE_0 && newMode <= MODE_2) + if (newMode >= MODE_UNSELECTED && newMode <= MODE_2) changeMode(newMode); } diff --git a/engines/titanic/pet_control/pet_element.h b/engines/titanic/pet_control/pet_element.h index c6b0054ca6..fdb8ca5e56 100644 --- a/engines/titanic/pet_control/pet_element.h +++ b/engines/titanic/pet_control/pet_element.h @@ -29,7 +29,7 @@ namespace Titanic { -enum PetElementMode { MODE_0 = 0, MODE_1 = 1, MODE_2 = 2 }; +enum PetElementMode { MODE_UNSELECTED = 0, MODE_SELECTED = 1, MODE_2 = 2 }; class CGameObject; class CPetControl; diff --git a/engines/titanic/pet_control/pet_frame.cpp b/engines/titanic/pet_control/pet_frame.cpp index 48a05cdd11..def6bca8e1 100644 --- a/engines/titanic/pet_control/pet_frame.cpp +++ b/engines/titanic/pet_control/pet_frame.cpp @@ -42,22 +42,22 @@ bool CPetFrame::setup(CPetControl *petControl) { bool CPetFrame::setup() { if (_petControl) { - _background.setup("PetBackground", _petControl, MODE_0); - _modeBackground.setup("PetModeBackground", _petControl, MODE_0); + _background.setup("PetBackground", _petControl, MODE_UNSELECTED); + _modeBackground.setup("PetModeBackground", _petControl, MODE_UNSELECTED); for (int idx = 0; idx < 5; ++idx) { CString resName = Common::String::format("PetMode%d", idx); - _modeButtons[idx].setup(resName, _petControl, MODE_0); + _modeButtons[idx].setup(resName, _petControl, MODE_UNSELECTED); } for (int idx = 0; idx < 6; ++idx) { CString resName = Common::String::format("3Pettitle%d", idx); - _titles[idx].setup(resName, _petControl, MODE_0); + _titles[idx].setup(resName, _petControl, MODE_UNSELECTED); } for (int idx = 0; idx < 7; ++idx) { CString resName = Common::String::format("PetIndent%d", idx); - _titles[idx].setup(resName, _petControl, MODE_0); + _indent[idx].setup(resName, _petControl, MODE_UNSELECTED); } } @@ -67,8 +67,8 @@ bool CPetFrame::setup() { bool CPetFrame::isValid(CPetControl *petControl) { bool result = setPetControl(petControl); if (result) { - _modeButtons[_indexes[0]].setMode(MODE_0); - _modeButtons[_indexes[4]].setMode(MODE_1); + _modeButtons[_indexes[0]].setMode(MODE_UNSELECTED); + _modeButtons[_indexes[4]].setMode(MODE_SELECTED); } return result; @@ -98,12 +98,12 @@ bool CPetFrame::setPetControl(CPetControl *petControl) { _modeButtons[idx].setBounds(r); _modeButtons[idx].translate(0, YLIST[idx]); } - _modeButtons[_indexes[0]].setMode(MODE_1); + _modeButtons[_indexes[0]].setMode(MODE_SELECTED); const int XLIST[] = { 73, 54, 85, 109, 38, 71 }; for (int idx = 0; idx < 6; ++idx) { _titles[idx].setBounds(Rect(0, 0, 110, 11)); - _titles[idx].translate(XLIST[idx], 471); + _titles[idx].translate(600 - XLIST[idx], 471); } } @@ -111,7 +111,14 @@ bool CPetFrame::setPetControl(CPetControl *petControl) { } void CPetFrame::setArea(PetArea newArea) { - warning("TODO: CPetFrame::setArea"); + resetArea(); + if (newArea < PET_6) + _modeButtons[_indexes[newArea]].setMode(MODE_SELECTED); +} + +void CPetFrame::resetArea() { + for (int idx = 0; idx < 6; ++idx) + _modeButtons[idx].setMode(MODE_UNSELECTED); } void CPetFrame::drawFrame(CScreenManager *screenManager) { diff --git a/engines/titanic/pet_control/pet_frame.h b/engines/titanic/pet_control/pet_frame.h index 2bf9f2ace4..683f629db6 100644 --- a/engines/titanic/pet_control/pet_frame.h +++ b/engines/titanic/pet_control/pet_frame.h @@ -76,6 +76,11 @@ public: */ void setArea(PetArea newArea); + /** + * Reset the currently selected area + */ + void resetArea(); + /** * Draws the PET frame */ diff --git a/engines/titanic/pet_control/pet_gfx_element.cpp b/engines/titanic/pet_control/pet_gfx_element.cpp index 616db72377..7f249f0c2d 100644 --- a/engines/titanic/pet_control/pet_gfx_element.cpp +++ b/engines/titanic/pet_control/pet_gfx_element.cpp @@ -30,10 +30,10 @@ namespace Titanic { void CPetGfxElement::setup(PetElementMode mode, const CString &name, CPetControl *petControl) { switch (mode) { - case MODE_0: + case MODE_UNSELECTED: _object0 = petControl->getHiddenObject(name); break; - case MODE_1: + case MODE_SELECTED: _object1 = petControl->getHiddenObject(name); break; case MODE_2: @@ -91,9 +91,9 @@ void CPetGfxElement::getBounds(Rect *rect) { CGameObject *CPetGfxElement::getObject() const { switch (_mode) { - case MODE_0: + case MODE_UNSELECTED: return _object0; - case MODE_1: + case MODE_SELECTED: return _object1; case MODE_2: return _object2; -- cgit v1.2.3 From 18fabbb2d40ce9456d4673c0b7c602f50458b583 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 31 Mar 2016 23:25:19 -0400 Subject: TITANIC: Beginnings of PET event handling code --- engines/titanic/core/saveable_object.cpp | 2 + engines/titanic/messages/messages.h | 141 ++++++++++++++++------------ engines/titanic/pet_control/pet_control.cpp | 99 ++++++++++++++++++- engines/titanic/pet_control/pet_control.h | 25 ++++- engines/titanic/pet_control/pet_section.h | 8 +- 5 files changed, 212 insertions(+), 63 deletions(-) diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 022a72b33a..c77bd2bfc3 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -920,6 +920,7 @@ DEFFN(CTakeHeadPieceMsg) DEFFN(CTextInputMsg) DEFFN(CTimeDilationMsg) DEFFN(CTimeMsg) +DEFFN(CTimerMsg) DEFFN(CTitleSequenceEndedMsg) DEFFN(CTransitMsg) DEFFN(CTransportMsg) @@ -1503,6 +1504,7 @@ void CSaveableObject::initClassList() { ADDFN(CTextInputMsg, CMessage); ADDFN(CTimeDilationMsg, CMessage); ADDFN(CTimeMsg, CMessage); + ADDFN(CTimerMsg, CTimeMsg); ADDFN(CTitleSequenceEndedMsg, CMessage); ADDFN(CTransitMsg, CMessage); ADDFN(CTransportMsg, CMessage); diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 99df239eda..b78fac481c 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -23,6 +23,7 @@ #ifndef TITANIC_MESSAGES_H #define TITANIC_MESSAGES_H +#include "common/keyboard.h" #include "titanic/core/saveable_object.h" #include "titanic/core/tree_item.h" @@ -37,6 +38,65 @@ enum MessageFlag { #define MSGTARGET(NAME) class NAME; class NAME##Target { public: \ virtual bool handleMessage(NAME &msg) = 0; } +#define MESSAGE0(NAME) MSGTARGET(NAME); \ + class NAME: public CMessage { \ + public: NAME() : CMessage() {} \ + CLASSDEF \ + static bool isSupportedBy(const CTreeItem *item) { \ + return dynamic_cast(item) != nullptr; } \ + virtual bool perform(CTreeItem *treeItem) { \ + NAME##Target *dest = dynamic_cast(treeItem); \ + return dest != nullptr && dest->handleMessage(*this); \ + } } +#define MESSAGE1(NAME, F1, N1, V1) MSGTARGET(NAME); \ + class NAME: public CMessage { \ + public: F1 _##N1; \ + NAME() : CMessage(), _##N1(V1) {} \ + NAME(F1 N1) : CMessage(), _##N1(N1) {} \ + CLASSDEF \ + static bool isSupportedBy(const CTreeItem *item) { \ + return dynamic_cast(item) != nullptr; } \ + virtual bool perform(CTreeItem *treeItem) { \ + NAME##Target *dest = dynamic_cast(treeItem); \ + return dest != nullptr && dest->handleMessage(*this); \ + } } +#define MESSAGE2(NAME, F1, N1, V1, F2, N2, V2) MSGTARGET(NAME); \ + class NAME: public CMessage { \ + public: F1 _##N1; F2 _##N2; \ + NAME() : CMessage(), _##N1(V1), _##N2(V2) {} \ + NAME(F1 N1, F2 N2) : CMessage(), _##N1(N1), _##N2(N2) {} \ + CLASSDEF \ + static bool isSupportedBy(const CTreeItem *item) { \ + return dynamic_cast(item) != nullptr; } \ + virtual bool perform(CTreeItem *treeItem) { \ + NAME##Target *dest = dynamic_cast(treeItem); \ + return dest != nullptr && dest->handleMessage(*this); \ + } } +#define MESSAGE3(NAME, F1, N1, V1, F2, N2, V2, F3, N3, V3) MSGTARGET(NAME); \ + class NAME: public CMessage { \ + public: F1 _##N1; F2 _##N2; F3 _##N3; \ + NAME() : CMessage(), _##N1(V1), _##N2(V2), _##N3(V3) {} \ + NAME(F1 N1, F2 N2, F3 N3) : CMessage(), _##N1(N1), _##N2(N2), _##N3(N3) {} \ + CLASSDEF \ + static bool isSupportedBy(const CTreeItem *item) { \ + return dynamic_cast(item) != nullptr; } \ + virtual bool perform(CTreeItem *treeItem) { \ + NAME##Target *dest = dynamic_cast(treeItem); \ + return dest != nullptr && dest->handleMessage(*this); \ + } } +#define MESSAGE4(NAME, F1, N1, V1, F2, N2, V2, F3, N3, V3, F4, N4, V4) MSGTARGET(NAME); \ + class NAME: public CMessage { \ + public: F1 _##N1; F2 _##N2; F3 _##N3; F4 _##N4; \ + NAME() : CMessage(), _##N1(V1), _##N2(V2), _##N3(V3), _##N4(V4) {} \ + NAME(F1 N1, F2 N2, F3 N3, F4 N4) : CMessage(), _##N1(N1), _##N2(N2), _##N3(N3), _##N4(N4) {} \ + CLASSDEF \ + static bool isSupportedBy(const CTreeItem *item) { \ + return dynamic_cast(item) != nullptr; } \ + virtual bool perform(CTreeItem *treeItem) { \ + NAME##Target *dest = dynamic_cast(treeItem); \ + return dest != nullptr && dest->handleMessage(*this); \ + } } + class CGameObject; class CRoomItem; class CNodeItem; @@ -193,64 +253,26 @@ public: } }; -#define MESSAGE0(NAME) MSGTARGET(NAME); \ - class NAME: public CMessage { \ - public: NAME() : CMessage() {} \ - CLASSDEF \ - static bool isSupportedBy(const CTreeItem *item) { \ - return dynamic_cast(item) != nullptr; } \ - virtual bool perform(CTreeItem *treeItem) { \ - NAME##Target *dest = dynamic_cast(treeItem); \ - return dest != nullptr && dest->handleMessage(*this); \ - } } -#define MESSAGE1(NAME, F1, N1, V1) MSGTARGET(NAME); \ - class NAME: public CMessage { \ - public: F1 _##N1; \ - NAME() : CMessage(), _##N1(V1) {} \ - NAME(F1 N1) : CMessage(), _##N1(N1) {} \ - CLASSDEF \ - static bool isSupportedBy(const CTreeItem *item) { \ - return dynamic_cast(item) != nullptr; } \ - virtual bool perform(CTreeItem *treeItem) { \ - NAME##Target *dest = dynamic_cast(treeItem); \ - return dest != nullptr && dest->handleMessage(*this); \ - } } -#define MESSAGE2(NAME, F1, N1, V1, F2, N2, V2) MSGTARGET(NAME); \ - class NAME: public CMessage { \ - public: F1 _##N1; F2 _##N2; \ - NAME() : CMessage(), _##N1(V1), _##N2(V2) {} \ - NAME(F1 N1, F2 N2) : CMessage(), _##N1(N1), _##N2(N2) {} \ - CLASSDEF \ - static bool isSupportedBy(const CTreeItem *item) { \ - return dynamic_cast(item) != nullptr; } \ - virtual bool perform(CTreeItem *treeItem) { \ - NAME##Target *dest = dynamic_cast(treeItem); \ - return dest != nullptr && dest->handleMessage(*this); \ - } } -#define MESSAGE3(NAME, F1, N1, V1, F2, N2, V2, F3, N3, V3) MSGTARGET(NAME); \ - class NAME: public CMessage { \ - public: F1 _##N1; F2 _##N2; F3 _##N3; \ - NAME() : CMessage(), _##N1(V1), _##N2(V2), _##N3(V3) {} \ - NAME(F1 N1, F2 N2, F3 N3) : CMessage(), _##N1(N1), _##N2(N2), _##N3(N3) {} \ - CLASSDEF \ - static bool isSupportedBy(const CTreeItem *item) { \ - return dynamic_cast(item) != nullptr; } \ - virtual bool perform(CTreeItem *treeItem) { \ - NAME##Target *dest = dynamic_cast(treeItem); \ - return dest != nullptr && dest->handleMessage(*this); \ - } } -#define MESSAGE4(NAME, F1, N1, V1, F2, N2, V2, F3, N3, V3, F4, N4, V4) MSGTARGET(NAME); \ - class NAME: public CMessage { \ - public: F1 _##N1; F2 _##N2; F3 _##N3; F4 _##N4; \ - NAME() : CMessage(), _##N1(V1), _##N2(V2), _##N3(V3), _##N4(V4) {} \ - NAME(F1 N1, F2 N2, F3 N3, F4 N4) : CMessage(), _##N1(N1), _##N2(N2), _##N3(N3), _##N4(N4) {} \ - CLASSDEF \ - static bool isSupportedBy(const CTreeItem *item) { \ - return dynamic_cast(item) != nullptr; } \ - virtual bool perform(CTreeItem *treeItem) { \ - NAME##Target *dest = dynamic_cast(treeItem); \ - return dest != nullptr && dest->handleMessage(*this); \ - } } +MESSAGE1(CTimeMsg, int, value, 0); + +MSGTARGET(CTimerMsg); +class CTimerMsg : public CTimeMsg { +public: + int _field8; + int _fieldC; + CString _string1; +public: + CLASSDEF + CTimerMsg() : CTimeMsg(), _field8(0), _fieldC(0) {} + + static bool isSupportedBy(const CTreeItem *item) { + return dynamic_cast(item) != nullptr; + } + virtual bool perform(CTreeItem *treeItem) { + CTimerMsgTarget *dest = dynamic_cast(treeItem); + return dest != nullptr && dest->handleMessage(*this); + } +}; MESSAGE1(CActMsg, CString, action, ""); MESSAGE1(CActivationmsg, CString, value, ""); @@ -387,7 +409,6 @@ MESSAGE1(CSummonBotQuerryMsg, CString, value, ""); MESSAGE1(CTakeHeadPieceMsg, CString, value, ""); MESSAGE2(CTextInputMsg, CString, value1, "", CString, value2, ""); MESSAGE1(CTimeDilationMsg, int, value, 0); -MESSAGE1(CTimeMsg, int, value, 0); MESSAGE0(CTitleSequenceEndedMsg); MESSAGE0(CTransitMsg); MESSAGE1(CTriggerAutoMusicPlayerMsg, int, value, 0); @@ -405,7 +426,7 @@ MESSAGE0(CTurnOn); MESSAGE1(CUse, int, value, 0); MESSAGE1(CUseWithCharMsg, int, value, 0); MESSAGE1(CUseWithOtherMsg, int, value, 0); -MESSAGE1(CVirtualKeyCharMsg, int, value, 0); +MESSAGE1(CVirtualKeyCharMsg, Common::KeyState, keyState, Common::KeyState()); MESSAGE1(CVisibleMsg, bool, visible, true); } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 6df688ef75..9d2622ffb6 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -157,7 +157,7 @@ Rect CPetControl::getBounds() { return _sub7.getBounds(); break; default: - break; + return Rect(); } } @@ -342,4 +342,101 @@ bool CPetControl::containsPt(const Common::Point &pt) const { return _drawBounds.contains(pt); } +bool CPetControl::getC0() const { + return _fieldC0 > 0; +} + +bool CPetControl::handleMessage(CMouseButtonDownMsg &msg) { + return true; +} + +bool CPetControl::handleMessage(CMouseDragStartMsg &msg) { + return true; +} + +bool CPetControl::handleMessage(CMouseDragMoveMsg &msg) { + return true; +} + +bool CPetControl::handleMessage(CMouseDragEndMsg &msg) { + return true; +} + +bool CPetControl::handleMessage(CMouseButtonUpMsg &msg) { + return true; +} + +bool CPetControl::handleMessage(CMouseDoubleClickMsg &msg) { + return true; +} + +bool CPetControl::handleMessage(CKeyCharMsg &msg) { + return true; +} + +bool CPetControl::handleMessage(CVirtualKeyCharMsg &msg) { + if (getC0()) + return false; + + bool result = false; + switch (_currentArea) { + case PET_INVENTORY: + result = _inventory.handleMessage(msg); + break; + case PET_CONVERSATION: + result = _conversations.handleMessage(msg); + break; + case PET_REMOTE: + result = _remote.handleMessage(msg); + break; + case PET_ROOMS: + result = _rooms.handleMessage(msg); + break; + case PET_SAVE: + result = _saves.handleMessage(msg); + break; + case PET_5: + result = _sub5.handleMessage(msg); + break; + case PET_6: + result = _sub7.handleMessage(msg); + break; + default: + break; + } + + if (!result) { + switch (msg._keyState.keycode) { + case Common::KEYCODE_F1: + result = true; + setArea(PET_INVENTORY); + break; + case Common::KEYCODE_F2: + result = true; + setArea(PET_CONVERSATION); + break; + case Common::KEYCODE_F3: + result = true; + setArea(PET_REMOTE); + break; + case Common::KEYCODE_F4: + result = true; + setArea(PET_ROOMS); + break; + case Common::KEYCODE_F5: + result = true; + setArea(PET_SAVE); + break; + default: + break; + } + } + + return result; +} + +bool CPetControl::handleMessage(CTimerMsg &msg) { + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 24ab78a963..be3b4a6118 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -26,6 +26,8 @@ #include "titanic/core/game_object.h" #include "titanic/core/node_item.h" #include "titanic/core/room_item.h" +#include "titanic/messages/messages.h" +#include "titanic/messages/mouse_messages.h" #include "titanic/pet_control/pet_conversation_section.h" #include "titanic/pet_control/pet_frame.h" #include "titanic/pet_control/pet_inventory_section.h" @@ -37,7 +39,16 @@ namespace Titanic { -class CPetControl : public CGameObject { +class CPetControl : public CGameObject, + public CMouseButtonDownMsgTarget, + public CMouseDragStartMsgTarget, + public CMouseDragMoveMsgTarget, + public CMouseDragEndMsgTarget, + public CMouseButtonUpMsgTarget, + public CMouseDoubleClickMsgTarget, + public CKeyCharMsgTarget, + public CVirtualKeyCharMsgTarget, + public CTimerMsgTarget { private: int _fieldC0; int _locked; @@ -86,6 +97,18 @@ private: * Returns true if the draw bounds contains the specified point */ bool containsPt(const Common::Point &pt) const; + + bool getC0() const; +protected: + bool handleMessage(CMouseButtonDownMsg &msg); + bool handleMessage(CMouseDragStartMsg &msg); + bool handleMessage(CMouseDragMoveMsg &msg); + bool handleMessage(CMouseDragEndMsg &msg); + bool handleMessage(CMouseButtonUpMsg &msg); + bool handleMessage(CMouseDoubleClickMsg &msg); + bool handleMessage(CKeyCharMsg &msg); + bool handleMessage(CVirtualKeyCharMsg &msg); + bool handleMessage(CTimerMsg &msg); public: PetArea _currentArea; public: diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index b08e4d6869..f81e8d0aa9 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -23,6 +23,7 @@ #ifndef TITANIC_PET_SECTION_H #define TITANIC_PET_SECTION_H +#include "titanic/messages/messages.h" #include "titanic/simple_file.h" namespace Titanic { @@ -81,7 +82,12 @@ public: virtual int proc10() { return 0; } virtual int proc11() { return 0; } virtual int proc12() { return 0; } - virtual int proc13() { return 0; } + + /** + * Handles special keypresses + */ + virtual bool handleMessage(CVirtualKeyCharMsg &msg) { return false; } + virtual int proc14() { return 0; } virtual int proc15() { return 0; } virtual void proc16(); -- cgit v1.2.3 From 43f183c207023c4398548ae385c9f3cbf853d9a9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 31 Mar 2016 23:40:30 -0400 Subject: TITANIC: Implement keyboard event handling --- engines/titanic/events.cpp | 3 +++ engines/titanic/input_translator.cpp | 12 ++++++++++++ engines/titanic/input_translator.h | 2 ++ 3 files changed, 17 insertions(+) diff --git a/engines/titanic/events.cpp b/engines/titanic/events.cpp index 5202d7cb9c..038bc8b83b 100644 --- a/engines/titanic/events.cpp +++ b/engines/titanic/events.cpp @@ -187,6 +187,9 @@ void Events::keyDown(Common::KeyState keyState) { _vm->_debugger->attach(); _vm->_debugger->onFrame(); } + + if (_vm->_window->_inputAllowed) + _vm->_window->_gameManager->_inputTranslator.keyDown(keyState); } void Events::keyUp(Common::KeyState keyState) { diff --git a/engines/titanic/input_translator.cpp b/engines/titanic/input_translator.cpp index 2251c2fe7a..9769076a1d 100644 --- a/engines/titanic/input_translator.cpp +++ b/engines/titanic/input_translator.cpp @@ -94,4 +94,16 @@ void CInputTranslator::rightButtonDoubleClick(int special, const Point &pt) { _inputHandler->handleMessage(msg); } +void CInputTranslator::keyDown(const Common::KeyState &keyState) { + if (keyState.keycode >= Common::KEYCODE_F1 && keyState.keycode <= Common::KEYCODE_F5) { + CVirtualKeyCharMsg msg(keyState); + _inputHandler->handleMessage(msg); + } + + if (keyState.ascii >= 32 && keyState.ascii <= 127) { + CKeyCharMsg msg(keyState.ascii); + _inputHandler->handleMessage(msg); + } +} + } // End of namespace Titanic diff --git a/engines/titanic/input_translator.h b/engines/titanic/input_translator.h index ad4f2d9d0a..7ca2a78699 100644 --- a/engines/titanic/input_translator.h +++ b/engines/titanic/input_translator.h @@ -23,6 +23,7 @@ #ifndef TITANIC_INPUT_TRANSLATOR_H #define TITANIC_INPUT_TRANSLATOR_H +#include "common/keyboard.h" #include "titanic/messages/mouse_messages.h" namespace Titanic { @@ -50,6 +51,7 @@ public: void rightButtonDown(int special, const Point &pt); void rightButtonUp(int special, const Point &pt); void rightButtonDoubleClick(int special, const Point &pt); + void keyDown(const Common::KeyState &keyState); }; } // End of namespace Titanic -- cgit v1.2.3 From 883e198eb3c5e54c2c3bc9b01f65f3420840873f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 1 Apr 2016 08:32:30 -0400 Subject: TITANIC: Implement PET CMouseButtonDownMsg handling --- engines/titanic/pet_control/pet_control.cpp | 39 +++++++++++++++++++++++++++-- engines/titanic/pet_control/pet_control.h | 4 +-- engines/titanic/pet_control/pet_element.cpp | 4 +-- engines/titanic/pet_control/pet_element.h | 3 ++- engines/titanic/pet_control/pet_section.h | 5 ++-- 5 files changed, 46 insertions(+), 9 deletions(-) diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 9d2622ffb6..f316cff8e6 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -208,7 +208,7 @@ void CPetControl::fn4() { } PetArea CPetControl::setArea(PetArea newArea) { - if (newArea == _currentArea || !canChangeArea()) + if (newArea == _currentArea || !isUnlocked()) return _currentArea; // Signal the currently active area that it's being left @@ -347,7 +347,42 @@ bool CPetControl::getC0() const { } bool CPetControl::handleMessage(CMouseButtonDownMsg &msg) { - return true; + if (!containsPt(msg._mousePos) || getC0()) + return false; + + bool result = false; + if (isUnlocked()) + result = _frame.handleMessage(msg); + + if (!result) { + switch (_currentArea) { + case PET_INVENTORY: + result = _inventory.handleMessage(msg); + break; + case PET_CONVERSATION: + result = _conversations.handleMessage(msg); + break; + case PET_REMOTE: + result = _remote.handleMessage(msg); + break; + case PET_ROOMS: + result = _rooms.handleMessage(msg); + break; + case PET_SAVE: + result = _saves.handleMessage(msg); + break; + case PET_5: + result = _sub5.handleMessage(msg); + break; + case PET_6: + result = _sub7.handleMessage(msg); + break; + default: + break; + } + } + + makeDirty(); } bool CPetControl::handleMessage(CMouseDragStartMsg &msg) { diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index be3b4a6118..26b358322b 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -169,9 +169,9 @@ public: PetArea setArea(PetArea newSection); /** - * Returns true if the current area can be changed + * Returns true if the PET is currently unlocked */ - bool canChangeArea() const { return _locked == 0; } + bool isUnlocked() const { return _locked == 0; } /** * Returns a game object used by the PET by name from within the diff --git a/engines/titanic/pet_control/pet_element.cpp b/engines/titanic/pet_control/pet_element.cpp index a4c5b271a0..423c79af8b 100644 --- a/engines/titanic/pet_control/pet_element.cpp +++ b/engines/titanic/pet_control/pet_element.cpp @@ -40,8 +40,8 @@ bool CPetElement::proc6(const Common::Point &pt) { return result; } -bool CPetElement::proc7(const Common::Point &pt) { - bool result = _bounds.contains(pt); +bool CPetElement::handleMessage(CMouseButtonDownMsg &msg) { + bool result = _bounds.contains(msg._mousePos); if (result) setMode(MODE_UNSELECTED); return result; diff --git a/engines/titanic/pet_control/pet_element.h b/engines/titanic/pet_control/pet_element.h index fdb8ca5e56..13f209cefa 100644 --- a/engines/titanic/pet_control/pet_element.h +++ b/engines/titanic/pet_control/pet_element.h @@ -26,6 +26,7 @@ #include "titanic/simple_file.h" #include "titanic/string.h" #include "titanic/core/link_item.h" +#include "titanic/messages/mouse_messages.h" namespace Titanic { @@ -69,7 +70,7 @@ public: virtual void getBounds(Rect *rect); virtual bool proc6(const Common::Point &pt); - virtual bool proc7(const Common::Point &pt); + virtual bool handleMessage(CMouseButtonDownMsg &msg); /** * Returns whether the passed point falls inside the item diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index f81e8d0aa9..1355a54f22 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -23,7 +23,7 @@ #ifndef TITANIC_PET_SECTION_H #define TITANIC_PET_SECTION_H -#include "titanic/messages/messages.h" +#include "titanic/messages/mouse_messages.h" #include "titanic/simple_file.h" namespace Titanic { @@ -75,7 +75,8 @@ public: virtual Rect getBounds() { return Rect(); } virtual void proc5(int val) {} - virtual int proc6() { return 0; } + + virtual bool handleMessage(CMouseButtonDownMsg &msg) { return false; } virtual int proc7() { return 0; } virtual int proc8() { return 0; } virtual int proc9() { return 0; } -- cgit v1.2.3 From 9affb67a3c83ead5ed4e3be2ea4d369a9c61d6f3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 1 Apr 2016 13:40:20 -0400 Subject: TITANIC: Implement PET message handlers --- engines/titanic/pet_control/pet_control.cpp | 186 ++++++++++++++++++++++++++-- engines/titanic/pet_control/pet_control.h | 1 + engines/titanic/pet_control/pet_section.h | 18 +-- 3 files changed, 187 insertions(+), 18 deletions(-) diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index f316cff8e6..2faefb3b21 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -28,9 +28,10 @@ namespace Titanic { CPetControl::CPetControl() : CGameObject(), - _currentArea(PET_CONVERSATION), _fieldC0(0), _locked(0), _fieldC8(0), - _treeItem1(nullptr), _treeItem2(nullptr), _hiddenRoom(nullptr), - _drawBounds(20, 350, 620, 480) { + _currentArea(PET_CONVERSATION), _fieldC0(0), _locked(0), _fieldC8(0), + _treeItem1(nullptr), _treeItem2(nullptr), _hiddenRoom(nullptr), + _drawBounds(20, 350, 620, 480) { + _timers[0] = _timers[1] = nullptr; } void CPetControl::save(SimpleFile *file, int indent) const { @@ -383,30 +384,196 @@ bool CPetControl::handleMessage(CMouseButtonDownMsg &msg) { } makeDirty(); + return result; } bool CPetControl::handleMessage(CMouseDragStartMsg &msg) { - return true; + if (!containsPt(msg._mousePos) || getC0()) + return false; + + switch (_currentArea) { + case PET_INVENTORY: + return _inventory.handleMessage(msg); + break; + case PET_CONVERSATION: + return _conversations.handleMessage(msg); + break; + case PET_REMOTE: + return _remote.handleMessage(msg); + break; + case PET_ROOMS: + return _rooms.handleMessage(msg); + break; + case PET_SAVE: + return _saves.handleMessage(msg); + break; + case PET_5: + return _sub5.handleMessage(msg); + break; + case PET_6: + return _sub7.handleMessage(msg); + break; + default: + return false; + } } bool CPetControl::handleMessage(CMouseDragMoveMsg &msg) { - return true; + switch (_currentArea) { + case PET_INVENTORY: + return _inventory.handleMessage(msg); + break; + case PET_CONVERSATION: + return _conversations.handleMessage(msg); + break; + case PET_REMOTE: + return _remote.handleMessage(msg); + break; + case PET_ROOMS: + return _rooms.handleMessage(msg); + break; + case PET_SAVE: + return _saves.handleMessage(msg); + break; + case PET_5: + return _sub5.handleMessage(msg); + break; + case PET_6: + return _sub7.handleMessage(msg); + break; + default: + return false; + } } bool CPetControl::handleMessage(CMouseDragEndMsg &msg) { - return true; + switch (_currentArea) { + case PET_INVENTORY: + return _inventory.handleMessage(msg); + break; + case PET_CONVERSATION: + return _conversations.handleMessage(msg); + break; + case PET_REMOTE: + return _remote.handleMessage(msg); + break; + case PET_ROOMS: + return _rooms.handleMessage(msg); + break; + case PET_SAVE: + return _saves.handleMessage(msg); + break; + case PET_5: + return _sub5.handleMessage(msg); + break; + case PET_6: + return _sub7.handleMessage(msg); + break; + default: + return false; + } } bool CPetControl::handleMessage(CMouseButtonUpMsg &msg) { - return true; + if (!containsPt(msg._mousePos) || getC0()) + return false; + + bool result = false; + if (isUnlocked()) + result = _frame.handleMessage(msg); + + if (!result) { + switch (_currentArea) { + case PET_INVENTORY: + result = _inventory.handleMessage(msg); + break; + case PET_CONVERSATION: + result = _conversations.handleMessage(msg); + break; + case PET_REMOTE: + result = _remote.handleMessage(msg); + break; + case PET_ROOMS: + result = _rooms.handleMessage(msg); + break; + case PET_SAVE: + result = _saves.handleMessage(msg); + break; + case PET_5: + result = _sub5.handleMessage(msg); + break; + case PET_6: + result = _sub7.handleMessage(msg); + break; + default: + break; + } + } + + makeDirty(); + return result; } bool CPetControl::handleMessage(CMouseDoubleClickMsg &msg) { - return true; + if (!containsPt(msg._mousePos) || getC0()) + return false; + + switch (_currentArea) { + case PET_INVENTORY: + return _inventory.handleMessage(msg); + break; + case PET_CONVERSATION: + return _conversations.handleMessage(msg); + break; + case PET_REMOTE: + return _remote.handleMessage(msg); + break; + case PET_ROOMS: + return _rooms.handleMessage(msg); + break; + case PET_SAVE: + return _saves.handleMessage(msg); + break; + case PET_5: + return _sub5.handleMessage(msg); + break; + case PET_6: + return _sub7.handleMessage(msg); + break; + default: + return false; + } } bool CPetControl::handleMessage(CKeyCharMsg &msg) { - return true; + if (getC0()) + return false; + + switch (_currentArea) { + case PET_INVENTORY: + return _inventory.handleMessage(msg); + break; + case PET_CONVERSATION: + return _conversations.handleMessage(msg); + break; + case PET_REMOTE: + return _remote.handleMessage(msg); + break; + case PET_ROOMS: + return _rooms.handleMessage(msg); + break; + case PET_SAVE: + return _saves.handleMessage(msg); + break; + case PET_5: + return _sub5.handleMessage(msg); + break; + case PET_6: + return _sub7.handleMessage(msg); + break; + default: + return false; + } } bool CPetControl::handleMessage(CVirtualKeyCharMsg &msg) { @@ -471,6 +638,7 @@ bool CPetControl::handleMessage(CVirtualKeyCharMsg &msg) { } bool CPetControl::handleMessage(CTimerMsg &msg) { + warning("TODO: CPetControl::CTimerMsg"); return true; } diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 26b358322b..285d4f0ba9 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -67,6 +67,7 @@ private: CString _string2; CRoomItem *_hiddenRoom; Rect _drawBounds; + void *_timers[2]; private: /** * Returns true if the control is in a valid state diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 1355a54f22..352e22420a 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -76,17 +76,17 @@ public: virtual void proc5(int val) {} - virtual bool handleMessage(CMouseButtonDownMsg &msg) { return false; } - virtual int proc7() { return 0; } - virtual int proc8() { return 0; } - virtual int proc9() { return 0; } - virtual int proc10() { return 0; } - virtual int proc11() { return 0; } - virtual int proc12() { return 0; } - /** - * Handles special keypresses + * Following are handlers for the various messages that the PET can + * pass onto the currently active section/area */ + virtual bool handleMessage(CMouseButtonDownMsg &msg) { return false; } + virtual bool handleMessage(CMouseDragStartMsg &msg) { return false; } + virtual bool handleMessage(CMouseDragMoveMsg &msg) { return false; } + virtual bool handleMessage(CMouseDragEndMsg &msg) { return false; } + virtual bool handleMessage(CMouseButtonUpMsg &msg) { return false; } + virtual bool handleMessage(CMouseDoubleClickMsg &msg) { return false; } + virtual bool handleMessage(CKeyCharMsg &msg) { return false; } virtual bool handleMessage(CVirtualKeyCharMsg &msg) { return false; } virtual int proc14() { return 0; } -- cgit v1.2.3 From 52905fdea9223713cbca6775e94dc7c64745f560 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 1 Apr 2016 18:51:18 -0400 Subject: TITANIC: Simplify the area switches used in PET control methods --- engines/titanic/pet_control/pet_control.cpp | 350 ++-------------------------- engines/titanic/pet_control/pet_control.h | 1 + 2 files changed, 22 insertions(+), 329 deletions(-) diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 2faefb3b21..1ea9977e9a 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -32,6 +32,13 @@ CPetControl::CPetControl() : CGameObject(), _treeItem1(nullptr), _treeItem2(nullptr), _hiddenRoom(nullptr), _drawBounds(20, 350, 620, 480) { _timers[0] = _timers[1] = nullptr; + _sections[PET_INVENTORY] = &_inventory; + _sections[PET_CONVERSATION] = &_conversations; + _sections[PET_REMOTE] = &_remote; + _sections[PET_ROOMS] = &_rooms; + _sections[PET_SAVE] = &_saves; + _sections[PET_5] = &_sub5; + _sections[PET_6] = &_sub7; } void CPetControl::save(SimpleFile *file, int indent) const { @@ -106,60 +113,12 @@ void CPetControl::draw(CScreenManager *screenManager) { _frame.drawFrame(screenManager); // Draw the specific area that's currently active - switch (_currentArea) { - case PET_INVENTORY: - _inventory.draw(screenManager); - break; - case PET_CONVERSATION: - _conversations.draw(screenManager); - break; - case PET_REMOTE: - _remote.draw(screenManager); - break; - case PET_ROOMS: - _rooms.draw(screenManager); - break; - case PET_SAVE: - _saves.draw(screenManager); - break; - case PET_5: - _sub5.draw(screenManager); - break; - case PET_6: - _sub7.draw(screenManager); - break; - default: - break; - } + _sections[_currentArea]->draw(screenManager); } } Rect CPetControl::getBounds() { - switch (_currentArea) { - case PET_INVENTORY: - return _inventory.getBounds(); - break; - case PET_CONVERSATION: - return _conversations.getBounds(); - break; - case PET_REMOTE: - return _remote.getBounds(); - break; - case PET_ROOMS: - return _rooms.getBounds(); - break; - case PET_SAVE: - return _saves.getBounds(); - break; - case PET_5: - return _sub5.getBounds(); - break; - case PET_6: - return _sub7.getBounds(); - break; - default: - return Rect(); - } + return _sections[_currentArea]->getBounds(); } void CPetControl::postLoad() { @@ -213,31 +172,7 @@ PetArea CPetControl::setArea(PetArea newArea) { return _currentArea; // Signal the currently active area that it's being left - switch (_currentArea) { - case PET_INVENTORY: - _inventory.leave(); - break; - case PET_CONVERSATION: - _conversations.leave(); - break; - case PET_REMOTE: - _remote.leave(); - break; - case PET_ROOMS: - _rooms.leave(); - break; - case PET_SAVE: - _saves.leave(); - break; - case PET_5: - _sub5.leave(); - break; - case PET_6: - _sub7.leave(); - break; - default: - break; - } + _sections[_currentArea]->leave(); // Change the current area PetArea oldArea = _currentArea; @@ -245,63 +180,14 @@ PetArea CPetControl::setArea(PetArea newArea) { _currentArea = newArea; // Signal to the new view that it's been activated - switch (newArea) { - case PET_INVENTORY: - _inventory.enter(oldArea); - - break; - case PET_CONVERSATION: - _conversations.enter(oldArea); - break; - case PET_REMOTE: - _remote.enter(oldArea); - break; - case PET_ROOMS: - _rooms.enter(oldArea); - break; - case PET_SAVE: - _saves.enter(oldArea); - break; - case PET_5: - _sub5.enter(oldArea); - break; - case PET_6: - _sub7.enter(oldArea); - break; - default: - break; - } + _sections[_currentArea]->enter(oldArea); makeDirty(); return newArea; } void CPetControl::fn2(int val) { - switch (_currentArea) { - case PET_INVENTORY: - _inventory.proc38(val); - break; - case PET_CONVERSATION: - _conversations.proc38(val); - break; - case PET_REMOTE: - _remote.proc38(val); - break; - case PET_ROOMS: - _rooms.proc38(val); - break; - case PET_SAVE: - _saves.proc38(val); - break; - case PET_5: - _sub5.proc38(val); - break; - case PET_6: - _sub7.proc38(val); - break; - default: - break; - } + _sections[_currentArea]->proc38(val); } void CPetControl::fn3(CTreeItem *item) { @@ -356,31 +242,7 @@ bool CPetControl::handleMessage(CMouseButtonDownMsg &msg) { result = _frame.handleMessage(msg); if (!result) { - switch (_currentArea) { - case PET_INVENTORY: - result = _inventory.handleMessage(msg); - break; - case PET_CONVERSATION: - result = _conversations.handleMessage(msg); - break; - case PET_REMOTE: - result = _remote.handleMessage(msg); - break; - case PET_ROOMS: - result = _rooms.handleMessage(msg); - break; - case PET_SAVE: - result = _saves.handleMessage(msg); - break; - case PET_5: - result = _sub5.handleMessage(msg); - break; - case PET_6: - result = _sub7.handleMessage(msg); - break; - default: - break; - } + result = _sections[_currentArea]->handleMessage(msg); } makeDirty(); @@ -391,87 +253,15 @@ bool CPetControl::handleMessage(CMouseDragStartMsg &msg) { if (!containsPt(msg._mousePos) || getC0()) return false; - switch (_currentArea) { - case PET_INVENTORY: - return _inventory.handleMessage(msg); - break; - case PET_CONVERSATION: - return _conversations.handleMessage(msg); - break; - case PET_REMOTE: - return _remote.handleMessage(msg); - break; - case PET_ROOMS: - return _rooms.handleMessage(msg); - break; - case PET_SAVE: - return _saves.handleMessage(msg); - break; - case PET_5: - return _sub5.handleMessage(msg); - break; - case PET_6: - return _sub7.handleMessage(msg); - break; - default: - return false; - } + return _sections[_currentArea]->handleMessage(msg); } bool CPetControl::handleMessage(CMouseDragMoveMsg &msg) { - switch (_currentArea) { - case PET_INVENTORY: - return _inventory.handleMessage(msg); - break; - case PET_CONVERSATION: - return _conversations.handleMessage(msg); - break; - case PET_REMOTE: - return _remote.handleMessage(msg); - break; - case PET_ROOMS: - return _rooms.handleMessage(msg); - break; - case PET_SAVE: - return _saves.handleMessage(msg); - break; - case PET_5: - return _sub5.handleMessage(msg); - break; - case PET_6: - return _sub7.handleMessage(msg); - break; - default: - return false; - } + return _sections[_currentArea]->handleMessage(msg); } bool CPetControl::handleMessage(CMouseDragEndMsg &msg) { - switch (_currentArea) { - case PET_INVENTORY: - return _inventory.handleMessage(msg); - break; - case PET_CONVERSATION: - return _conversations.handleMessage(msg); - break; - case PET_REMOTE: - return _remote.handleMessage(msg); - break; - case PET_ROOMS: - return _rooms.handleMessage(msg); - break; - case PET_SAVE: - return _saves.handleMessage(msg); - break; - case PET_5: - return _sub5.handleMessage(msg); - break; - case PET_6: - return _sub7.handleMessage(msg); - break; - default: - return false; - } + return _sections[_currentArea]->handleMessage(msg); } bool CPetControl::handleMessage(CMouseButtonUpMsg &msg) { @@ -482,33 +272,8 @@ bool CPetControl::handleMessage(CMouseButtonUpMsg &msg) { if (isUnlocked()) result = _frame.handleMessage(msg); - if (!result) { - switch (_currentArea) { - case PET_INVENTORY: - result = _inventory.handleMessage(msg); - break; - case PET_CONVERSATION: - result = _conversations.handleMessage(msg); - break; - case PET_REMOTE: - result = _remote.handleMessage(msg); - break; - case PET_ROOMS: - result = _rooms.handleMessage(msg); - break; - case PET_SAVE: - result = _saves.handleMessage(msg); - break; - case PET_5: - result = _sub5.handleMessage(msg); - break; - case PET_6: - result = _sub7.handleMessage(msg); - break; - default: - break; - } - } + if (!result) + result = _sections[_currentArea]->handleMessage(msg); makeDirty(); return result; @@ -518,94 +283,21 @@ bool CPetControl::handleMessage(CMouseDoubleClickMsg &msg) { if (!containsPt(msg._mousePos) || getC0()) return false; - switch (_currentArea) { - case PET_INVENTORY: - return _inventory.handleMessage(msg); - break; - case PET_CONVERSATION: - return _conversations.handleMessage(msg); - break; - case PET_REMOTE: - return _remote.handleMessage(msg); - break; - case PET_ROOMS: - return _rooms.handleMessage(msg); - break; - case PET_SAVE: - return _saves.handleMessage(msg); - break; - case PET_5: - return _sub5.handleMessage(msg); - break; - case PET_6: - return _sub7.handleMessage(msg); - break; - default: - return false; - } + return _sections[_currentArea]->handleMessage(msg); } bool CPetControl::handleMessage(CKeyCharMsg &msg) { if (getC0()) return false; - switch (_currentArea) { - case PET_INVENTORY: - return _inventory.handleMessage(msg); - break; - case PET_CONVERSATION: - return _conversations.handleMessage(msg); - break; - case PET_REMOTE: - return _remote.handleMessage(msg); - break; - case PET_ROOMS: - return _rooms.handleMessage(msg); - break; - case PET_SAVE: - return _saves.handleMessage(msg); - break; - case PET_5: - return _sub5.handleMessage(msg); - break; - case PET_6: - return _sub7.handleMessage(msg); - break; - default: - return false; - } + return _sections[_currentArea]->handleMessage(msg); } bool CPetControl::handleMessage(CVirtualKeyCharMsg &msg) { if (getC0()) return false; - bool result = false; - switch (_currentArea) { - case PET_INVENTORY: - result = _inventory.handleMessage(msg); - break; - case PET_CONVERSATION: - result = _conversations.handleMessage(msg); - break; - case PET_REMOTE: - result = _remote.handleMessage(msg); - break; - case PET_ROOMS: - result = _rooms.handleMessage(msg); - break; - case PET_SAVE: - result = _saves.handleMessage(msg); - break; - case PET_5: - result = _sub5.handleMessage(msg); - break; - case PET_6: - result = _sub7.handleMessage(msg); - break; - default: - break; - } + bool result = _sections[_currentArea]->handleMessage(msg); if (!result) { switch (msg._keyState.keycode) { diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 285d4f0ba9..d966960ff0 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -53,6 +53,7 @@ private: int _fieldC0; int _locked; int _fieldC8; + CPetSection *_sections[7]; CPetConversationSection _conversations; CPetInventorySection _inventory; CPetRemoteSection _remote; -- cgit v1.2.3 From 08e8f105dcca1400120574f794d770c03198ef3a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 1 Apr 2016 19:01:53 -0400 Subject: TITANIC: Implement CPetFrame event handling --- engines/titanic/pet_control/pet_frame.cpp | 32 +++++++++++++++++++++---------- engines/titanic/pet_control/pet_frame.h | 7 +++++-- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/engines/titanic/pet_control/pet_frame.cpp b/engines/titanic/pet_control/pet_frame.cpp index def6bca8e1..3e464a0647 100644 --- a/engines/titanic/pet_control/pet_frame.cpp +++ b/engines/titanic/pet_control/pet_frame.cpp @@ -25,13 +25,12 @@ namespace Titanic { -static const int INDEXES[6] = { 1, 0, 2, 3, 4, 5 }; +static const PetArea PET_AREAS[6] = { + PET_CONVERSATION, PET_INVENTORY, PET_REMOTE, + PET_ROOMS, PET_SAVE, PET_5 +}; -int CPetFrame::_indexes[6]; - -CPetFrame::CPetFrame() { - for (int idx = 0; idx < 6; ++idx) - _indexes[INDEXES[idx]] = idx; +CPetFrame::CPetFrame() : CPetSection() { } bool CPetFrame::setup(CPetControl *petControl) { @@ -64,11 +63,24 @@ bool CPetFrame::setup() { return true; } +bool CPetFrame::handleMessage(CMouseButtonDownMsg &msg) { + for (int idx = 0; idx < 5; ++idx) { + if (_modeButtons[idx].handleMessage(msg)) { + _petControl->setArea(PET_AREAS[idx]); + resetArea(); + _modeButtons[idx].setMode(MODE_SELECTED); + return true; + } + } + + return false; +} + bool CPetFrame::isValid(CPetControl *petControl) { bool result = setPetControl(petControl); if (result) { - _modeButtons[_indexes[0]].setMode(MODE_UNSELECTED); - _modeButtons[_indexes[4]].setMode(MODE_SELECTED); + _modeButtons[PET_AREAS[0]].setMode(MODE_UNSELECTED); + _modeButtons[PET_AREAS[4]].setMode(MODE_SELECTED); } return result; @@ -98,7 +110,7 @@ bool CPetFrame::setPetControl(CPetControl *petControl) { _modeButtons[idx].setBounds(r); _modeButtons[idx].translate(0, YLIST[idx]); } - _modeButtons[_indexes[0]].setMode(MODE_SELECTED); + _modeButtons[PET_AREAS[0]].setMode(MODE_SELECTED); const int XLIST[] = { 73, 54, 85, 109, 38, 71 }; for (int idx = 0; idx < 6; ++idx) { @@ -113,7 +125,7 @@ bool CPetFrame::setPetControl(CPetControl *petControl) { void CPetFrame::setArea(PetArea newArea) { resetArea(); if (newArea < PET_6) - _modeButtons[_indexes[newArea]].setMode(MODE_SELECTED); + _modeButtons[PET_AREAS[newArea]].setMode(MODE_SELECTED); } void CPetFrame::resetArea() { diff --git a/engines/titanic/pet_control/pet_frame.h b/engines/titanic/pet_control/pet_frame.h index 683f629db6..5b90fd2aa3 100644 --- a/engines/titanic/pet_control/pet_frame.h +++ b/engines/titanic/pet_control/pet_frame.h @@ -34,8 +34,6 @@ namespace Titanic { */ class CPetFrame : public CPetSection { private: - static int _indexes[6]; - CPetGfxElement _modeButtons[6]; CPetGfxElement _titles[6]; CPetGfxElement _modeBackground; @@ -60,6 +58,11 @@ public: * Sets up the section */ virtual bool setup(); + + /** + * Handles mouse down messages + */ + virtual bool handleMessage(CMouseButtonDownMsg &msg); /** * Returns true if the object is in a valid state -- cgit v1.2.3 From 3f3f4d910d5185ff74396e989babd4fce27bfff5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 1 Apr 2016 19:42:53 -0400 Subject: TITANIC: Moved gfx/ pet classes into pet_control/ --- engines/titanic/core/saveable_object.cpp | 20 +++--- engines/titanic/gfx/icon_nav_butt.h | 2 +- engines/titanic/gfx/icon_nav_image.h | 2 +- engines/titanic/gfx/icon_nav_receive.h | 2 +- engines/titanic/gfx/icon_nav_send.h | 2 +- engines/titanic/gfx/pet_drag_chev.cpp | 37 ----------- engines/titanic/gfx/pet_drag_chev.h | 47 -------------- engines/titanic/gfx/pet_graphic.cpp | 37 ----------- engines/titanic/gfx/pet_graphic.h | 47 -------------- engines/titanic/gfx/pet_graphic2.cpp | 37 ----------- engines/titanic/gfx/pet_graphic2.h | 47 -------------- engines/titanic/gfx/pet_leaf.cpp | 37 ----------- engines/titanic/gfx/pet_leaf.h | 47 -------------- engines/titanic/gfx/pet_mode_off.cpp | 40 ------------ engines/titanic/gfx/pet_mode_off.h | 48 -------------- engines/titanic/gfx/pet_mode_on.cpp | 40 ------------ engines/titanic/gfx/pet_mode_on.h | 48 -------------- engines/titanic/gfx/pet_mode_panel.cpp | 40 ------------ engines/titanic/gfx/pet_mode_panel.h | 48 -------------- engines/titanic/gfx/pet_pannel1.cpp | 37 ----------- engines/titanic/gfx/pet_pannel1.h | 47 -------------- engines/titanic/gfx/pet_pannel2.cpp | 37 ----------- engines/titanic/gfx/pet_pannel2.h | 47 -------------- engines/titanic/gfx/pet_pannel3.cpp | 37 ----------- engines/titanic/gfx/pet_pannel3.h | 47 -------------- engines/titanic/gfx/sgt_selector.h | 2 +- engines/titanic/gfx/text_down.h | 2 +- engines/titanic/gfx/text_skrew.h | 2 +- engines/titanic/gfx/text_up.h | 2 +- engines/titanic/module.mk | 30 ++++----- engines/titanic/pet_control/pet_control.h | 18 +++--- .../pet_control/pet_conversation_section.cpp | 48 -------------- .../titanic/pet_control/pet_conversation_section.h | 74 ---------------------- engines/titanic/pet_control/pet_conversations.cpp | 48 ++++++++++++++ engines/titanic/pet_control/pet_conversations.h | 74 ++++++++++++++++++++++ engines/titanic/pet_control/pet_drag_chev.cpp | 37 +++++++++++ engines/titanic/pet_control/pet_drag_chev.h | 47 ++++++++++++++ engines/titanic/pet_control/pet_frame.h | 1 + engines/titanic/pet_control/pet_graphic.cpp | 37 +++++++++++ engines/titanic/pet_control/pet_graphic.h | 47 ++++++++++++++ engines/titanic/pet_control/pet_graphic2.cpp | 37 +++++++++++ engines/titanic/pet_control/pet_graphic2.h | 47 ++++++++++++++ engines/titanic/pet_control/pet_inventory.cpp | 47 ++++++++++++++ engines/titanic/pet_control/pet_inventory.h | 64 +++++++++++++++++++ .../titanic/pet_control/pet_inventory_section.cpp | 47 -------------- .../titanic/pet_control/pet_inventory_section.h | 64 ------------------- engines/titanic/pet_control/pet_leaf.cpp | 37 +++++++++++ engines/titanic/pet_control/pet_leaf.h | 47 ++++++++++++++ engines/titanic/pet_control/pet_mode_off.cpp | 40 ++++++++++++ engines/titanic/pet_control/pet_mode_off.h | 48 ++++++++++++++ engines/titanic/pet_control/pet_mode_on.cpp | 40 ++++++++++++ engines/titanic/pet_control/pet_mode_on.h | 48 ++++++++++++++ engines/titanic/pet_control/pet_mode_panel.cpp | 40 ++++++++++++ engines/titanic/pet_control/pet_mode_panel.h | 48 ++++++++++++++ engines/titanic/pet_control/pet_pannel1.cpp | 37 +++++++++++ engines/titanic/pet_control/pet_pannel1.h | 47 ++++++++++++++ engines/titanic/pet_control/pet_pannel2.cpp | 37 +++++++++++ engines/titanic/pet_control/pet_pannel2.h | 47 ++++++++++++++ engines/titanic/pet_control/pet_pannel3.cpp | 37 +++++++++++ engines/titanic/pet_control/pet_pannel3.h | 47 ++++++++++++++ engines/titanic/pet_control/pet_remote.cpp | 32 ++++++++++ engines/titanic/pet_control/pet_remote.h | 57 +++++++++++++++++ engines/titanic/pet_control/pet_remote_section.cpp | 32 ---------- engines/titanic/pet_control/pet_remote_section.h | 57 ----------------- engines/titanic/pet_control/pet_rooms.cpp | 65 +++++++++++++++++++ engines/titanic/pet_control/pet_rooms.h | 74 ++++++++++++++++++++++ engines/titanic/pet_control/pet_rooms_section.cpp | 65 ------------------- engines/titanic/pet_control/pet_rooms_section.h | 74 ---------------------- engines/titanic/pet_control/pet_save_section.cpp | 32 ---------- engines/titanic/pet_control/pet_save_section.h | 45 ------------- engines/titanic/pet_control/pet_saves.cpp | 32 ++++++++++ engines/titanic/pet_control/pet_saves.h | 45 +++++++++++++ 72 files changed, 1433 insertions(+), 1432 deletions(-) delete mode 100644 engines/titanic/gfx/pet_drag_chev.cpp delete mode 100644 engines/titanic/gfx/pet_drag_chev.h delete mode 100644 engines/titanic/gfx/pet_graphic.cpp delete mode 100644 engines/titanic/gfx/pet_graphic.h delete mode 100644 engines/titanic/gfx/pet_graphic2.cpp delete mode 100644 engines/titanic/gfx/pet_graphic2.h delete mode 100644 engines/titanic/gfx/pet_leaf.cpp delete mode 100644 engines/titanic/gfx/pet_leaf.h delete mode 100644 engines/titanic/gfx/pet_mode_off.cpp delete mode 100644 engines/titanic/gfx/pet_mode_off.h delete mode 100644 engines/titanic/gfx/pet_mode_on.cpp delete mode 100644 engines/titanic/gfx/pet_mode_on.h delete mode 100644 engines/titanic/gfx/pet_mode_panel.cpp delete mode 100644 engines/titanic/gfx/pet_mode_panel.h delete mode 100644 engines/titanic/gfx/pet_pannel1.cpp delete mode 100644 engines/titanic/gfx/pet_pannel1.h delete mode 100644 engines/titanic/gfx/pet_pannel2.cpp delete mode 100644 engines/titanic/gfx/pet_pannel2.h delete mode 100644 engines/titanic/gfx/pet_pannel3.cpp delete mode 100644 engines/titanic/gfx/pet_pannel3.h delete mode 100644 engines/titanic/pet_control/pet_conversation_section.cpp delete mode 100644 engines/titanic/pet_control/pet_conversation_section.h create mode 100644 engines/titanic/pet_control/pet_conversations.cpp create mode 100644 engines/titanic/pet_control/pet_conversations.h create mode 100644 engines/titanic/pet_control/pet_drag_chev.cpp create mode 100644 engines/titanic/pet_control/pet_drag_chev.h create mode 100644 engines/titanic/pet_control/pet_graphic.cpp create mode 100644 engines/titanic/pet_control/pet_graphic.h create mode 100644 engines/titanic/pet_control/pet_graphic2.cpp create mode 100644 engines/titanic/pet_control/pet_graphic2.h create mode 100644 engines/titanic/pet_control/pet_inventory.cpp create mode 100644 engines/titanic/pet_control/pet_inventory.h delete mode 100644 engines/titanic/pet_control/pet_inventory_section.cpp delete mode 100644 engines/titanic/pet_control/pet_inventory_section.h create mode 100644 engines/titanic/pet_control/pet_leaf.cpp create mode 100644 engines/titanic/pet_control/pet_leaf.h create mode 100644 engines/titanic/pet_control/pet_mode_off.cpp create mode 100644 engines/titanic/pet_control/pet_mode_off.h create mode 100644 engines/titanic/pet_control/pet_mode_on.cpp create mode 100644 engines/titanic/pet_control/pet_mode_on.h create mode 100644 engines/titanic/pet_control/pet_mode_panel.cpp create mode 100644 engines/titanic/pet_control/pet_mode_panel.h create mode 100644 engines/titanic/pet_control/pet_pannel1.cpp create mode 100644 engines/titanic/pet_control/pet_pannel1.h create mode 100644 engines/titanic/pet_control/pet_pannel2.cpp create mode 100644 engines/titanic/pet_control/pet_pannel2.h create mode 100644 engines/titanic/pet_control/pet_pannel3.cpp create mode 100644 engines/titanic/pet_control/pet_pannel3.h create mode 100644 engines/titanic/pet_control/pet_remote.cpp create mode 100644 engines/titanic/pet_control/pet_remote.h delete mode 100644 engines/titanic/pet_control/pet_remote_section.cpp delete mode 100644 engines/titanic/pet_control/pet_remote_section.h create mode 100644 engines/titanic/pet_control/pet_rooms.cpp create mode 100644 engines/titanic/pet_control/pet_rooms.h delete mode 100644 engines/titanic/pet_control/pet_rooms_section.cpp delete mode 100644 engines/titanic/pet_control/pet_rooms_section.h delete mode 100644 engines/titanic/pet_control/pet_save_section.cpp delete mode 100644 engines/titanic/pet_control/pet_save_section.h create mode 100644 engines/titanic/pet_control/pet_saves.cpp create mode 100644 engines/titanic/pet_control/pet_saves.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index c77bd2bfc3..1e359837a3 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -309,16 +309,6 @@ #include "titanic/gfx/music_switch_inversion.h" #include "titanic/gfx/music_switch_reverse.h" #include "titanic/gfx/music_voice_mute.h" -#include "titanic/gfx/pet_drag_chev.h" -#include "titanic/gfx/pet_graphic.h" -#include "titanic/gfx/pet_graphic2.h" -#include "titanic/gfx/pet_leaf.h" -#include "titanic/gfx/pet_mode_off.h" -#include "titanic/gfx/pet_mode_on.h" -#include "titanic/gfx/pet_mode_panel.h" -#include "titanic/gfx/pet_pannel1.h" -#include "titanic/gfx/pet_pannel2.h" -#include "titanic/gfx/pet_pannel3.h" #include "titanic/gfx/send_to_succ.h" #include "titanic/gfx/sgt_selector.h" #include "titanic/gfx/slider_button.h" @@ -382,6 +372,16 @@ #include "titanic/npcs/true_talk_npc.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/pet_control/pet_drag_chev.h" +#include "titanic/pet_control/pet_graphic.h" +#include "titanic/pet_control/pet_graphic2.h" +#include "titanic/pet_control/pet_leaf.h" +#include "titanic/pet_control/pet_mode_off.h" +#include "titanic/pet_control/pet_mode_on.h" +#include "titanic/pet_control/pet_mode_panel.h" +#include "titanic/pet_control/pet_pannel1.h" +#include "titanic/pet_control/pet_pannel2.h" +#include "titanic/pet_control/pet_pannel3.h" #include "titanic/sound/auto_music_player.h" #include "titanic/sound/auto_music_player_base.h" diff --git a/engines/titanic/gfx/icon_nav_butt.h b/engines/titanic/gfx/icon_nav_butt.h index 36d3eb0890..b2db4c7794 100644 --- a/engines/titanic/gfx/icon_nav_butt.h +++ b/engines/titanic/gfx/icon_nav_butt.h @@ -23,7 +23,7 @@ #ifndef TITANIC_ICON_NAV_BUTT_H #define TITANIC_ICON_NAV_BUTT_H -#include "titanic/gfx/pet_graphic.h" +#include "titanic/pet_control/pet_graphic.h" namespace Titanic { diff --git a/engines/titanic/gfx/icon_nav_image.h b/engines/titanic/gfx/icon_nav_image.h index 61febfd2a4..295ffe7d3b 100644 --- a/engines/titanic/gfx/icon_nav_image.h +++ b/engines/titanic/gfx/icon_nav_image.h @@ -23,7 +23,7 @@ #ifndef TITANIC_ICON_NAV_IMAGE_H #define TITANIC_ICON_NAV_IMAGE_H -#include "titanic/gfx/pet_graphic.h" +#include "titanic/pet_control/pet_graphic.h" namespace Titanic { diff --git a/engines/titanic/gfx/icon_nav_receive.h b/engines/titanic/gfx/icon_nav_receive.h index cce1df2279..36eed5376b 100644 --- a/engines/titanic/gfx/icon_nav_receive.h +++ b/engines/titanic/gfx/icon_nav_receive.h @@ -23,7 +23,7 @@ #ifndef TITANIC_ICON_NAV_RECEIVE_H #define TITANIC_ICON_NAV_RECEIVE_H -#include "titanic/gfx/pet_graphic.h" +#include "titanic/pet_control/pet_graphic.h" namespace Titanic { diff --git a/engines/titanic/gfx/icon_nav_send.h b/engines/titanic/gfx/icon_nav_send.h index 1ffb8e9e15..d25d0b9149 100644 --- a/engines/titanic/gfx/icon_nav_send.h +++ b/engines/titanic/gfx/icon_nav_send.h @@ -23,7 +23,7 @@ #ifndef TITANIC_ICON_NAV_SEND_H #define TITANIC_ICON_NAV_SEND_H -#include "titanic/gfx/pet_graphic.h" +#include "titanic/pet_control/pet_graphic.h" namespace Titanic { diff --git a/engines/titanic/gfx/pet_drag_chev.cpp b/engines/titanic/gfx/pet_drag_chev.cpp deleted file mode 100644 index 24b4666b3a..0000000000 --- a/engines/titanic/gfx/pet_drag_chev.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 "titanic/gfx/pet_drag_chev.h" - -namespace Titanic { - -void CPetDragChev::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - CPetGraphic2::save(file, indent); -} - -void CPetDragChev::load(SimpleFile *file) { - file->readNumber(); - CPetGraphic2::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/gfx/pet_drag_chev.h b/engines/titanic/gfx/pet_drag_chev.h deleted file mode 100644 index e82afd0a1b..0000000000 --- a/engines/titanic/gfx/pet_drag_chev.h +++ /dev/null @@ -1,47 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_DRAG_CHEV_H -#define TITANIC_PET_DRAG_CHEV_H - -#include "titanic/gfx/pet_graphic2.h" - -namespace Titanic { - -class CPetDragChev : public CPetGraphic2 { -public: - CLASSDEF - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_DRAG_CHEV_H */ diff --git a/engines/titanic/gfx/pet_graphic.cpp b/engines/titanic/gfx/pet_graphic.cpp deleted file mode 100644 index b625c1dfdb..0000000000 --- a/engines/titanic/gfx/pet_graphic.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 "titanic/gfx/pet_graphic.h" - -namespace Titanic { - -void CPetGraphic::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - CGameObject::save(file, indent); -} - -void CPetGraphic::load(SimpleFile *file) { - file->readNumber(); - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/gfx/pet_graphic.h b/engines/titanic/gfx/pet_graphic.h deleted file mode 100644 index 112d75a870..0000000000 --- a/engines/titanic/gfx/pet_graphic.h +++ /dev/null @@ -1,47 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_GRAPHIC_H -#define TITANIC_PET_GRAPHIC_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CPetGraphic : public CGameObject { -public: - CLASSDEF - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_GRAPHIC_H */ diff --git a/engines/titanic/gfx/pet_graphic2.cpp b/engines/titanic/gfx/pet_graphic2.cpp deleted file mode 100644 index 5588c72fba..0000000000 --- a/engines/titanic/gfx/pet_graphic2.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 "titanic/gfx/pet_graphic2.h" - -namespace Titanic { - -void CPetGraphic2::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - CGameObject::save(file, indent); -} - -void CPetGraphic2::load(SimpleFile *file) { - file->readNumber(); - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/gfx/pet_graphic2.h b/engines/titanic/gfx/pet_graphic2.h deleted file mode 100644 index d9bb514915..0000000000 --- a/engines/titanic/gfx/pet_graphic2.h +++ /dev/null @@ -1,47 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_GRAPHIC2_H -#define TITANIC_PET_GRAPHIC2_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CPetGraphic2 : public CGameObject { -public: - CLASSDEF - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_GRAPHIC2_H */ diff --git a/engines/titanic/gfx/pet_leaf.cpp b/engines/titanic/gfx/pet_leaf.cpp deleted file mode 100644 index adb6ccd144..0000000000 --- a/engines/titanic/gfx/pet_leaf.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 "titanic/gfx/pet_leaf.h" - -namespace Titanic { - -void PETLeaf::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - CGameObject::save(file, indent); -} - -void PETLeaf::load(SimpleFile *file) { - file->readNumber(); - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/gfx/pet_leaf.h b/engines/titanic/gfx/pet_leaf.h deleted file mode 100644 index 073374970c..0000000000 --- a/engines/titanic/gfx/pet_leaf.h +++ /dev/null @@ -1,47 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_LEAF_H -#define TITANIC_PET_LEAF_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class PETLeaf : public CGameObject { -public: - CLASSDEF - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_LEAF_H */ diff --git a/engines/titanic/gfx/pet_mode_off.cpp b/engines/titanic/gfx/pet_mode_off.cpp deleted file mode 100644 index d94ced085e..0000000000 --- a/engines/titanic/gfx/pet_mode_off.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* 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 "titanic/gfx/pet_mode_off.h" - -namespace Titanic { - -CPetModeOff::CPetModeOff() : CToggleSwitch() { -} - -void CPetModeOff::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - CToggleSwitch::save(file, indent); -} - -void CPetModeOff::load(SimpleFile *file) { - file->readNumber(); - CToggleSwitch::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/gfx/pet_mode_off.h b/engines/titanic/gfx/pet_mode_off.h deleted file mode 100644 index ea88255b93..0000000000 --- a/engines/titanic/gfx/pet_mode_off.h +++ /dev/null @@ -1,48 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_MODE_OFF_H -#define TITANIC_PET_MODE_OFF_H - -#include "titanic/gfx/toggle_switch.h" - -namespace Titanic { - -class CPetModeOff : public CToggleSwitch { -public: - CLASSDEF - CPetModeOff(); - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_MODE_OFF_H */ diff --git a/engines/titanic/gfx/pet_mode_on.cpp b/engines/titanic/gfx/pet_mode_on.cpp deleted file mode 100644 index 2de07455fa..0000000000 --- a/engines/titanic/gfx/pet_mode_on.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* 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 "titanic/gfx/pet_mode_on.h" - -namespace Titanic { - -CPetModeOn::CPetModeOn() : CToggleSwitch() { -} - -void CPetModeOn::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - CToggleSwitch::save(file, indent); -} - -void CPetModeOn::load(SimpleFile *file) { - file->readNumber(); - CToggleSwitch::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/gfx/pet_mode_on.h b/engines/titanic/gfx/pet_mode_on.h deleted file mode 100644 index 1434fb20db..0000000000 --- a/engines/titanic/gfx/pet_mode_on.h +++ /dev/null @@ -1,48 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_MODE_ON_H -#define TITANIC_PET_MODE_ON_H - -#include "titanic/gfx/toggle_switch.h" - -namespace Titanic { - -class CPetModeOn : public CToggleSwitch { -public: - CLASSDEF - CPetModeOn(); - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_MODE_ON_H */ diff --git a/engines/titanic/gfx/pet_mode_panel.cpp b/engines/titanic/gfx/pet_mode_panel.cpp deleted file mode 100644 index 050cb768df..0000000000 --- a/engines/titanic/gfx/pet_mode_panel.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* 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 "titanic/gfx/pet_mode_panel.h" - -namespace Titanic { - -CPetModePanel::CPetModePanel() : CToggleSwitch() { -} - -void CPetModePanel::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - CToggleSwitch::save(file, indent); -} - -void CPetModePanel::load(SimpleFile *file) { - file->readNumber(); - CToggleSwitch::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/gfx/pet_mode_panel.h b/engines/titanic/gfx/pet_mode_panel.h deleted file mode 100644 index ef68ca8b06..0000000000 --- a/engines/titanic/gfx/pet_mode_panel.h +++ /dev/null @@ -1,48 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_MODE_PANEL_H -#define TITANIC_PET_MODE_PANEL_H - -#include "titanic/gfx/toggle_switch.h" - -namespace Titanic { - -class CPetModePanel : public CToggleSwitch { -public: - CLASSDEF - CPetModePanel(); - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_MODE_PANEL_H */ diff --git a/engines/titanic/gfx/pet_pannel1.cpp b/engines/titanic/gfx/pet_pannel1.cpp deleted file mode 100644 index baa7558ea0..0000000000 --- a/engines/titanic/gfx/pet_pannel1.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 "titanic/gfx/pet_pannel1.h" - -namespace Titanic { - -void CPetPannel1::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - CPetGraphic::save(file, indent); -} - -void CPetPannel1::load(SimpleFile *file) { - file->readNumber(); - CPetGraphic::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/gfx/pet_pannel1.h b/engines/titanic/gfx/pet_pannel1.h deleted file mode 100644 index 9261af9077..0000000000 --- a/engines/titanic/gfx/pet_pannel1.h +++ /dev/null @@ -1,47 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_PANNEL1_H -#define TITANIC_PET_PANNEL1_H - -#include "titanic/gfx/pet_graphic.h" - -namespace Titanic { - -class CPetPannel1 : public CPetGraphic { -public: - CLASSDEF - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_PANNEL1_H */ diff --git a/engines/titanic/gfx/pet_pannel2.cpp b/engines/titanic/gfx/pet_pannel2.cpp deleted file mode 100644 index 7376fcc4c5..0000000000 --- a/engines/titanic/gfx/pet_pannel2.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 "titanic/gfx/pet_pannel2.h" - -namespace Titanic { - -void CPetPannel2::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - CPetGraphic::save(file, indent); -} - -void CPetPannel2::load(SimpleFile *file) { - file->readNumber(); - CPetGraphic::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/gfx/pet_pannel2.h b/engines/titanic/gfx/pet_pannel2.h deleted file mode 100644 index 561c0d74a2..0000000000 --- a/engines/titanic/gfx/pet_pannel2.h +++ /dev/null @@ -1,47 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_PANNEL2_H -#define TITANIC_PET_PANNEL2_H - -#include "titanic/gfx/pet_graphic.h" - -namespace Titanic { - -class CPetPannel2 : public CPetGraphic { -public: - CLASSDEF - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_PANNEL2_H */ diff --git a/engines/titanic/gfx/pet_pannel3.cpp b/engines/titanic/gfx/pet_pannel3.cpp deleted file mode 100644 index f4bd1fb0cc..0000000000 --- a/engines/titanic/gfx/pet_pannel3.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 "titanic/gfx/pet_pannel3.h" - -namespace Titanic { - -void CPetPannel3::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - CPetGraphic::save(file, indent); -} - -void CPetPannel3::load(SimpleFile *file) { - file->readNumber(); - CPetGraphic::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/gfx/pet_pannel3.h b/engines/titanic/gfx/pet_pannel3.h deleted file mode 100644 index 590818406a..0000000000 --- a/engines/titanic/gfx/pet_pannel3.h +++ /dev/null @@ -1,47 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_PANNEL3_H -#define TITANIC_PET_PANNEL3_H - -#include "titanic/gfx/pet_graphic.h" - -namespace Titanic { - -class CPetPannel3 : public CPetGraphic { -public: - CLASSDEF - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_PANNEL3_H */ diff --git a/engines/titanic/gfx/sgt_selector.h b/engines/titanic/gfx/sgt_selector.h index 678ee77b06..8ebd7ae255 100644 --- a/engines/titanic/gfx/sgt_selector.h +++ b/engines/titanic/gfx/sgt_selector.h @@ -23,7 +23,7 @@ #ifndef TITANIC_SGT_SELECTOR_H #define TITANIC_SGT_SELECTOR_H -#include "titanic/gfx/pet_graphic.h" +#include "titanic/pet_control/pet_graphic.h" namespace Titanic { diff --git a/engines/titanic/gfx/text_down.h b/engines/titanic/gfx/text_down.h index 6fc55bb647..189f795650 100644 --- a/engines/titanic/gfx/text_down.h +++ b/engines/titanic/gfx/text_down.h @@ -23,7 +23,7 @@ #ifndef TITANIC_TEXT_DOWN_H #define TITANIC_TEXT_DOWN_H -#include "titanic/gfx/pet_graphic.h" +#include "titanic/pet_control/pet_graphic.h" namespace Titanic { diff --git a/engines/titanic/gfx/text_skrew.h b/engines/titanic/gfx/text_skrew.h index 6d7e714963..aa6c375098 100644 --- a/engines/titanic/gfx/text_skrew.h +++ b/engines/titanic/gfx/text_skrew.h @@ -23,7 +23,7 @@ #ifndef TITANIC_TEXT_SKREW_H #define TITANIC_TEXT_SKREW_H -#include "titanic/gfx/pet_graphic.h" +#include "titanic/pet_control/pet_graphic.h" namespace Titanic { diff --git a/engines/titanic/gfx/text_up.h b/engines/titanic/gfx/text_up.h index 328aeee0ee..103f62159c 100644 --- a/engines/titanic/gfx/text_up.h +++ b/engines/titanic/gfx/text_up.h @@ -23,7 +23,7 @@ #ifndef TITANIC_TEXT_UP_H #define TITANIC_TEXT_UP_H -#include "titanic/gfx/pet_graphic.h" +#include "titanic/pet_control/pet_graphic.h" namespace Titanic { diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 9f9257db75..4ab5caf3cd 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -311,16 +311,6 @@ MODULE_OBJS := \ gfx/keybrd_butt.o \ gfx/move_object_button.o \ gfx/music_control.o \ - gfx/pet_drag_chev.o \ - gfx/pet_graphic2.o \ - gfx/pet_graphic.o \ - gfx/pet_leaf.o \ - gfx/pet_mode_off.o \ - gfx/pet_mode_on.o \ - gfx/pet_mode_panel.o \ - gfx/pet_pannel1.o \ - gfx/pet_pannel2.o \ - gfx/pet_pannel3.o \ gfx/send_to_succ.o \ gfx/sgt_selector.o \ gfx/slider_button.o \ @@ -382,20 +372,30 @@ MODULE_OBJS := \ pet_control/pet_control.o \ pet_control/pet_control_list_item.o \ pet_control/pet_control_list_item2.o \ - pet_control/pet_conversation_section.o \ + pet_control/pet_conversations.o \ pet_control/pet_element.o \ pet_control/pet_frame.o \ pet_control/pet_gfx_element.o \ - pet_control/pet_inventory_section.o \ - pet_control/pet_rooms_section.o \ - pet_control/pet_remote_section.o \ - pet_control/pet_save_section.o \ + pet_control/pet_inventory.o \ + pet_control/pet_rooms.o \ + pet_control/pet_remote.o \ + pet_control/pet_saves.o \ pet_control/pet_section.o \ pet_control/pet_control_sub5.o \ pet_control/pet_control_sub7.o \ pet_control/pet_control_sub10.o \ pet_control/pet_control_sub11.o \ pet_control/pet_control_sub12.o \ + pet_control/pet_drag_chev.o \ + pet_control/pet_graphic2.o \ + pet_control/pet_graphic.o \ + pet_control/pet_leaf.o \ + pet_control/pet_mode_off.o \ + pet_control/pet_mode_on.o \ + pet_control/pet_mode_panel.o \ + pet_control/pet_pannel1.o \ + pet_control/pet_pannel2.o \ + pet_control/pet_pannel3.o \ sound/auto_music_player.o \ sound/auto_music_player_base.o \ sound/auto_sound_player.o \ diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index d966960ff0..40c6b31044 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -28,12 +28,12 @@ #include "titanic/core/room_item.h" #include "titanic/messages/messages.h" #include "titanic/messages/mouse_messages.h" -#include "titanic/pet_control/pet_conversation_section.h" +#include "titanic/pet_control/pet_conversations.h" #include "titanic/pet_control/pet_frame.h" -#include "titanic/pet_control/pet_inventory_section.h" -#include "titanic/pet_control/pet_remote_section.h" -#include "titanic/pet_control/pet_rooms_section.h" -#include "titanic/pet_control/pet_save_section.h" +#include "titanic/pet_control/pet_inventory.h" +#include "titanic/pet_control/pet_remote.h" +#include "titanic/pet_control/pet_rooms.h" +#include "titanic/pet_control/pet_saves.h" #include "titanic/pet_control/pet_control_sub5.h" #include "titanic/pet_control/pet_control_sub7.h" @@ -54,11 +54,11 @@ private: int _locked; int _fieldC8; CPetSection *_sections[7]; - CPetConversationSection _conversations; - CPetInventorySection _inventory; - CPetRemoteSection _remote; + CPetConversations _conversations; + CPetInventory _inventory; + CPetRemote _remote; CPetRoomsSection _rooms; - CPetSaveSection _saves; + CPetSaves _saves; CPetControlSub5 _sub5; CPetControlSub7 _sub7; CPetFrame _frame; diff --git a/engines/titanic/pet_control/pet_conversation_section.cpp b/engines/titanic/pet_control/pet_conversation_section.cpp deleted file mode 100644 index 166c8ecc47..0000000000 --- a/engines/titanic/pet_control/pet_conversation_section.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* 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 "titanic/pet_control/pet_conversation_section.h" - -namespace Titanic { - -CPetConversationSection::CPetConversationSection() : CPetSection(), - _field414(0), _field418(0) { -} - -void CPetConversationSection::save(SimpleFile *file, int indent) const { - -} - -void CPetConversationSection::load(SimpleFile *file, int param) { - _sub2.load(file, param); - _sub1.load(file, param); - - for (int idx = 0; idx < 3; ++idx) - _valArray3[idx] = file->readNumber(); -} - -bool CPetConversationSection::isValid(CPetControl *petControl) { - // TODO - return true; -} - -} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_conversation_section.h b/engines/titanic/pet_control/pet_conversation_section.h deleted file mode 100644 index 55492ceb1a..0000000000 --- a/engines/titanic/pet_control/pet_conversation_section.h +++ /dev/null @@ -1,74 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_CONVERSATION_SECTION_H -#define TITANIC_PET_CONVERSATION_SECTION_H - -#include "titanic/pet_control/pet_section.h" -#include "titanic/pet_control/pet_control_sub12.h" -#include "titanic/pet_control/pet_gfx_element.h" - -namespace Titanic { - -class CPetConversationSection : public CPetSection { -private: - CPetGfxElement _val1; - CPetGfxElement _val2; - CPetGfxElement _val3; - CPetGfxElement _valArray1[3]; - CPetGfxElement _val4; - CPetGfxElement _val5; - CPetGfxElement _val6; - int _field14C; - CPetGfxElement _val7; - CPetGfxElement _val8; - CPetGfxElement _val9; - CPetGfxElement _valArray2[9]; - int _field30C; - CPetControlSub12 _sub1; - CPetControlSub12 _sub2; - int _valArray3[3]; - int _field414; - int _field418; - CString _string1; -public: - CPetConversationSection(); - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file, int param); - - /** - * Returns true if the object is in a valid state - */ - virtual bool isValid(CPetControl *petControl); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONVERSATION_SECTION_H */ diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp new file mode 100644 index 0000000000..a4936e5703 --- /dev/null +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -0,0 +1,48 @@ +/* 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 "titanic/pet_control/pet_conversations.h" + +namespace Titanic { + +CPetConversations::CPetConversations() : CPetSection(), + _field414(0), _field418(0) { +} + +void CPetConversations::save(SimpleFile *file, int indent) const { + +} + +void CPetConversations::load(SimpleFile *file, int param) { + _sub2.load(file, param); + _sub1.load(file, param); + + for (int idx = 0; idx < 3; ++idx) + _valArray3[idx] = file->readNumber(); +} + +bool CPetConversations::isValid(CPetControl *petControl) { + // TODO + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h new file mode 100644 index 0000000000..a511c3d991 --- /dev/null +++ b/engines/titanic/pet_control/pet_conversations.h @@ -0,0 +1,74 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_CONVERSATIONS_H +#define TITANIC_PET_CONVERSATIONS_H + +#include "titanic/pet_control/pet_section.h" +#include "titanic/pet_control/pet_control_sub12.h" +#include "titanic/pet_control/pet_gfx_element.h" + +namespace Titanic { + +class CPetConversations : public CPetSection { +private: + CPetGfxElement _val1; + CPetGfxElement _val2; + CPetGfxElement _val3; + CPetGfxElement _valArray1[3]; + CPetGfxElement _val4; + CPetGfxElement _val5; + CPetGfxElement _val6; + int _field14C; + CPetGfxElement _val7; + CPetGfxElement _val8; + CPetGfxElement _val9; + CPetGfxElement _valArray2[9]; + int _field30C; + CPetControlSub12 _sub1; + CPetControlSub12 _sub2; + int _valArray3[3]; + int _field414; + int _field418; + CString _string1; +public: + CPetConversations(); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file, int param); + + /** + * Returns true if the object is in a valid state + */ + virtual bool isValid(CPetControl *petControl); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_CONVERSATIONS_H */ diff --git a/engines/titanic/pet_control/pet_drag_chev.cpp b/engines/titanic/pet_control/pet_drag_chev.cpp new file mode 100644 index 0000000000..3c1569856e --- /dev/null +++ b/engines/titanic/pet_control/pet_drag_chev.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/pet_control/pet_drag_chev.h" + +namespace Titanic { + +void CPetDragChev::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CPetGraphic2::save(file, indent); +} + +void CPetDragChev::load(SimpleFile *file) { + file->readNumber(); + CPetGraphic2::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_drag_chev.h b/engines/titanic/pet_control/pet_drag_chev.h new file mode 100644 index 0000000000..92f3883711 --- /dev/null +++ b/engines/titanic/pet_control/pet_drag_chev.h @@ -0,0 +1,47 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_DRAG_CHEV_H +#define TITANIC_PET_DRAG_CHEV_H + +#include "titanic/pet_control/pet_graphic2.h" + +namespace Titanic { + +class CPetDragChev : public CPetGraphic2 { +public: + CLASSDEF + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_DRAG_CHEV_H */ diff --git a/engines/titanic/pet_control/pet_frame.h b/engines/titanic/pet_control/pet_frame.h index 5b90fd2aa3..f14e6eaddf 100644 --- a/engines/titanic/pet_control/pet_frame.h +++ b/engines/titanic/pet_control/pet_frame.h @@ -63,6 +63,7 @@ public: * Handles mouse down messages */ virtual bool handleMessage(CMouseButtonDownMsg &msg); + virtual bool handleMessage(CMouseButtonUpMsg &msg) { return false; } /** * Returns true if the object is in a valid state diff --git a/engines/titanic/pet_control/pet_graphic.cpp b/engines/titanic/pet_control/pet_graphic.cpp new file mode 100644 index 0000000000..3586c4de67 --- /dev/null +++ b/engines/titanic/pet_control/pet_graphic.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/pet_control/pet_graphic.h" + +namespace Titanic { + +void CPetGraphic::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPetGraphic::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_graphic.h b/engines/titanic/pet_control/pet_graphic.h new file mode 100644 index 0000000000..112d75a870 --- /dev/null +++ b/engines/titanic/pet_control/pet_graphic.h @@ -0,0 +1,47 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_GRAPHIC_H +#define TITANIC_PET_GRAPHIC_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPetGraphic : public CGameObject { +public: + CLASSDEF + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_GRAPHIC_H */ diff --git a/engines/titanic/pet_control/pet_graphic2.cpp b/engines/titanic/pet_control/pet_graphic2.cpp new file mode 100644 index 0000000000..d4871e8c78 --- /dev/null +++ b/engines/titanic/pet_control/pet_graphic2.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/pet_control/pet_graphic2.h" + +namespace Titanic { + +void CPetGraphic2::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPetGraphic2::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_graphic2.h b/engines/titanic/pet_control/pet_graphic2.h new file mode 100644 index 0000000000..d9bb514915 --- /dev/null +++ b/engines/titanic/pet_control/pet_graphic2.h @@ -0,0 +1,47 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_GRAPHIC2_H +#define TITANIC_PET_GRAPHIC2_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPetGraphic2 : public CGameObject { +public: + CLASSDEF + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_GRAPHIC2_H */ diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp new file mode 100644 index 0000000000..c0a93fa23b --- /dev/null +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -0,0 +1,47 @@ +/* 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 "titanic/pet_control/pet_inventory.h" + +namespace Titanic { + +CPetInventory::CPetInventory() : CPetSection(), + _field28C(0), _field290(0), _field294(0), _field298(0) { + for (int idx = 0; idx < 46; ++idx) { + _valArray1[idx] = _valArray2[idx] = 0; + } +} + +void CPetInventory::save(SimpleFile *file, int indent) const { + file->writeNumberLine(_field298, indent); +} + +void CPetInventory::load(SimpleFile *file, int param) { + _field298 = file->readNumber(); +} + +bool CPetInventory::isValid(CPetControl *petControl) { + // TODO + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h new file mode 100644 index 0000000000..ef295f1507 --- /dev/null +++ b/engines/titanic/pet_control/pet_inventory.h @@ -0,0 +1,64 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_INVENTORY_H +#define TITANIC_PET_INVENTORY_H + +#include "titanic/simple_file.h" +#include "titanic/pet_control/pet_section.h" +#include "titanic/pet_control/pet_control_sub10.h" +#include "titanic/pet_control/pet_control_sub12.h" + +namespace Titanic { + +class CPetInventory : public CPetSection { +private: + CPetControlSub12 _sub12; + CPetControlSub10 _sub10; + int _valArray1[46]; + int _valArray2[46]; + int _field28C; + int _field290; + int _field294; + int _field298; +public: + CPetInventory(); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file, int param); + + /** + * Returns true if the object is in a valid state + */ + virtual bool isValid(CPetControl *petControl); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_INVENTORY_H */ diff --git a/engines/titanic/pet_control/pet_inventory_section.cpp b/engines/titanic/pet_control/pet_inventory_section.cpp deleted file mode 100644 index 675d6033c9..0000000000 --- a/engines/titanic/pet_control/pet_inventory_section.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* 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 "titanic/pet_control/pet_inventory_section.h" - -namespace Titanic { - -CPetInventorySection::CPetInventorySection() : CPetSection(), - _field28C(0), _field290(0), _field294(0), _field298(0) { - for (int idx = 0; idx < 46; ++idx) { - _valArray1[idx] = _valArray2[idx] = 0; - } -} - -void CPetInventorySection::save(SimpleFile *file, int indent) const { - file->writeNumberLine(_field298, indent); -} - -void CPetInventorySection::load(SimpleFile *file, int param) { - _field298 = file->readNumber(); -} - -bool CPetInventorySection::isValid(CPetControl *petControl) { - // TODO - return true; -} - -} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory_section.h b/engines/titanic/pet_control/pet_inventory_section.h deleted file mode 100644 index 4d36e2fba9..0000000000 --- a/engines/titanic/pet_control/pet_inventory_section.h +++ /dev/null @@ -1,64 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_INVENTORY_SECTION_H -#define TITANIC_PET_INVENTORY_SECTION_H - -#include "titanic/simple_file.h" -#include "titanic/pet_control/pet_section.h" -#include "titanic/pet_control/pet_control_sub10.h" -#include "titanic/pet_control/pet_control_sub12.h" - -namespace Titanic { - -class CPetInventorySection : public CPetSection { -private: - CPetControlSub12 _sub12; - CPetControlSub10 _sub10; - int _valArray1[46]; - int _valArray2[46]; - int _field28C; - int _field290; - int _field294; - int _field298; -public: - CPetInventorySection(); - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file, int param); - - /** - * Returns true if the object is in a valid state - */ - virtual bool isValid(CPetControl *petControl); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_INVENTORY_SECTION_H */ diff --git a/engines/titanic/pet_control/pet_leaf.cpp b/engines/titanic/pet_control/pet_leaf.cpp new file mode 100644 index 0000000000..77b0d426a5 --- /dev/null +++ b/engines/titanic/pet_control/pet_leaf.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/pet_control/pet_leaf.h" + +namespace Titanic { + +void PETLeaf::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void PETLeaf::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_leaf.h b/engines/titanic/pet_control/pet_leaf.h new file mode 100644 index 0000000000..073374970c --- /dev/null +++ b/engines/titanic/pet_control/pet_leaf.h @@ -0,0 +1,47 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_LEAF_H +#define TITANIC_PET_LEAF_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class PETLeaf : public CGameObject { +public: + CLASSDEF + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_LEAF_H */ diff --git a/engines/titanic/pet_control/pet_mode_off.cpp b/engines/titanic/pet_control/pet_mode_off.cpp new file mode 100644 index 0000000000..f4eac74837 --- /dev/null +++ b/engines/titanic/pet_control/pet_mode_off.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/pet_control/pet_mode_off.h" + +namespace Titanic { + +CPetModeOff::CPetModeOff() : CToggleSwitch() { +} + +void CPetModeOff::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CToggleSwitch::save(file, indent); +} + +void CPetModeOff::load(SimpleFile *file) { + file->readNumber(); + CToggleSwitch::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_mode_off.h b/engines/titanic/pet_control/pet_mode_off.h new file mode 100644 index 0000000000..ea88255b93 --- /dev/null +++ b/engines/titanic/pet_control/pet_mode_off.h @@ -0,0 +1,48 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_MODE_OFF_H +#define TITANIC_PET_MODE_OFF_H + +#include "titanic/gfx/toggle_switch.h" + +namespace Titanic { + +class CPetModeOff : public CToggleSwitch { +public: + CLASSDEF + CPetModeOff(); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_MODE_OFF_H */ diff --git a/engines/titanic/pet_control/pet_mode_on.cpp b/engines/titanic/pet_control/pet_mode_on.cpp new file mode 100644 index 0000000000..8eb839f241 --- /dev/null +++ b/engines/titanic/pet_control/pet_mode_on.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/pet_control/pet_mode_on.h" + +namespace Titanic { + +CPetModeOn::CPetModeOn() : CToggleSwitch() { +} + +void CPetModeOn::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CToggleSwitch::save(file, indent); +} + +void CPetModeOn::load(SimpleFile *file) { + file->readNumber(); + CToggleSwitch::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_mode_on.h b/engines/titanic/pet_control/pet_mode_on.h new file mode 100644 index 0000000000..1434fb20db --- /dev/null +++ b/engines/titanic/pet_control/pet_mode_on.h @@ -0,0 +1,48 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_MODE_ON_H +#define TITANIC_PET_MODE_ON_H + +#include "titanic/gfx/toggle_switch.h" + +namespace Titanic { + +class CPetModeOn : public CToggleSwitch { +public: + CLASSDEF + CPetModeOn(); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_MODE_ON_H */ diff --git a/engines/titanic/pet_control/pet_mode_panel.cpp b/engines/titanic/pet_control/pet_mode_panel.cpp new file mode 100644 index 0000000000..1919d88fac --- /dev/null +++ b/engines/titanic/pet_control/pet_mode_panel.cpp @@ -0,0 +1,40 @@ +/* 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 "titanic/pet_control/pet_mode_panel.h" + +namespace Titanic { + +CPetModePanel::CPetModePanel() : CToggleSwitch() { +} + +void CPetModePanel::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CToggleSwitch::save(file, indent); +} + +void CPetModePanel::load(SimpleFile *file) { + file->readNumber(); + CToggleSwitch::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_mode_panel.h b/engines/titanic/pet_control/pet_mode_panel.h new file mode 100644 index 0000000000..ef68ca8b06 --- /dev/null +++ b/engines/titanic/pet_control/pet_mode_panel.h @@ -0,0 +1,48 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_MODE_PANEL_H +#define TITANIC_PET_MODE_PANEL_H + +#include "titanic/gfx/toggle_switch.h" + +namespace Titanic { + +class CPetModePanel : public CToggleSwitch { +public: + CLASSDEF + CPetModePanel(); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_MODE_PANEL_H */ diff --git a/engines/titanic/pet_control/pet_pannel1.cpp b/engines/titanic/pet_control/pet_pannel1.cpp new file mode 100644 index 0000000000..8245d7e90a --- /dev/null +++ b/engines/titanic/pet_control/pet_pannel1.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/pet_control/pet_pannel1.h" + +namespace Titanic { + +void CPetPannel1::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CPetGraphic::save(file, indent); +} + +void CPetPannel1::load(SimpleFile *file) { + file->readNumber(); + CPetGraphic::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_pannel1.h b/engines/titanic/pet_control/pet_pannel1.h new file mode 100644 index 0000000000..7a16d8c842 --- /dev/null +++ b/engines/titanic/pet_control/pet_pannel1.h @@ -0,0 +1,47 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_PANNEL1_H +#define TITANIC_PET_PANNEL1_H + +#include "titanic/pet_control/pet_graphic.h" + +namespace Titanic { + +class CPetPannel1 : public CPetGraphic { +public: + CLASSDEF + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_PANNEL1_H */ diff --git a/engines/titanic/pet_control/pet_pannel2.cpp b/engines/titanic/pet_control/pet_pannel2.cpp new file mode 100644 index 0000000000..a04f63fee8 --- /dev/null +++ b/engines/titanic/pet_control/pet_pannel2.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/pet_control/pet_pannel2.h" + +namespace Titanic { + +void CPetPannel2::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CPetGraphic::save(file, indent); +} + +void CPetPannel2::load(SimpleFile *file) { + file->readNumber(); + CPetGraphic::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_pannel2.h b/engines/titanic/pet_control/pet_pannel2.h new file mode 100644 index 0000000000..7296eab507 --- /dev/null +++ b/engines/titanic/pet_control/pet_pannel2.h @@ -0,0 +1,47 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_PANNEL2_H +#define TITANIC_PET_PANNEL2_H + +#include "titanic/pet_control/pet_graphic.h" + +namespace Titanic { + +class CPetPannel2 : public CPetGraphic { +public: + CLASSDEF + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_PANNEL2_H */ diff --git a/engines/titanic/pet_control/pet_pannel3.cpp b/engines/titanic/pet_control/pet_pannel3.cpp new file mode 100644 index 0000000000..5d0fd93d7b --- /dev/null +++ b/engines/titanic/pet_control/pet_pannel3.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/pet_control/pet_pannel3.h" + +namespace Titanic { + +void CPetPannel3::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CPetGraphic::save(file, indent); +} + +void CPetPannel3::load(SimpleFile *file) { + file->readNumber(); + CPetGraphic::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_pannel3.h b/engines/titanic/pet_control/pet_pannel3.h new file mode 100644 index 0000000000..2bdbf1fb31 --- /dev/null +++ b/engines/titanic/pet_control/pet_pannel3.h @@ -0,0 +1,47 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_PANNEL3_H +#define TITANIC_PET_PANNEL3_H + +#include "titanic/pet_control/pet_graphic.h" + +namespace Titanic { + +class CPetPannel3 : public CPetGraphic { +public: + CLASSDEF + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_PANNEL3_H */ diff --git a/engines/titanic/pet_control/pet_remote.cpp b/engines/titanic/pet_control/pet_remote.cpp new file mode 100644 index 0000000000..4463c31bee --- /dev/null +++ b/engines/titanic/pet_control/pet_remote.cpp @@ -0,0 +1,32 @@ +/* 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 "titanic/pet_control/pet_remote.h" + +namespace Titanic { + +bool CPetRemote::isValid(CPetControl *petControl) { + // TODO + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_remote.h b/engines/titanic/pet_control/pet_remote.h new file mode 100644 index 0000000000..410a5ff961 --- /dev/null +++ b/engines/titanic/pet_control/pet_remote.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_REMOTE_H +#define TITANIC_PET_REMOTE_H + +#include "titanic/pet_control/pet_section.h" +#include "titanic/pet_control/pet_control_sub10.h" +#include "titanic/pet_control/pet_control_sub12.h" +#include "titanic/pet_control/pet_gfx_element.h" + +namespace Titanic { + +class CPetRemote : public CPetSection { +private: + CPetControlSub10 _sub10; + CPetGfxElement _val1; + CPetGfxElement _val2; + CPetGfxElement _val3; + CPetGfxElement _val4; + CPetGfxElement _val5; + CPetGfxElement _val6; + CPetGfxElement _val7; + CPetGfxElement _val8; + CPetGfxElement _val9; + CPetGfxElement _val10; + CPetGfxElement _val11; + CPetControlSub12 _sub12; +public: + /** + * Returns true if the object is in a valid state + */ + virtual bool isValid(CPetControl *petControl); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_REMOTE_H */ diff --git a/engines/titanic/pet_control/pet_remote_section.cpp b/engines/titanic/pet_control/pet_remote_section.cpp deleted file mode 100644 index 37720848cc..0000000000 --- a/engines/titanic/pet_control/pet_remote_section.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 "titanic/pet_control/pet_remote_section.h" - -namespace Titanic { - -bool CPetRemoteSection::isValid(CPetControl *petControl) { - // TODO - return true; -} - -} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_remote_section.h b/engines/titanic/pet_control/pet_remote_section.h deleted file mode 100644 index f3063bdd16..0000000000 --- a/engines/titanic/pet_control/pet_remote_section.h +++ /dev/null @@ -1,57 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_REMOTE_SECTION_H -#define TITANIC_PET_REMOTE_SECTION_H - -#include "titanic/pet_control/pet_section.h" -#include "titanic/pet_control/pet_control_sub10.h" -#include "titanic/pet_control/pet_control_sub12.h" -#include "titanic/pet_control/pet_gfx_element.h" - -namespace Titanic { - -class CPetRemoteSection : public CPetSection { -private: - CPetControlSub10 _sub10; - CPetGfxElement _val1; - CPetGfxElement _val2; - CPetGfxElement _val3; - CPetGfxElement _val4; - CPetGfxElement _val5; - CPetGfxElement _val6; - CPetGfxElement _val7; - CPetGfxElement _val8; - CPetGfxElement _val9; - CPetGfxElement _val10; - CPetGfxElement _val11; - CPetControlSub12 _sub12; -public: - /** - * Returns true if the object is in a valid state - */ - virtual bool isValid(CPetControl *petControl); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_REMOTE_SECTION_H */ diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp new file mode 100644 index 0000000000..ea81dd8270 --- /dev/null +++ b/engines/titanic/pet_control/pet_rooms.cpp @@ -0,0 +1,65 @@ +/* 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 "titanic/pet_control/pet_rooms.h" + +namespace Titanic { + +CPetRoomsSection::CPetRoomsSection() : + _field100(0), _field104(0), _field108(0), _field10C(0), + _field110(0), _field114(0), _field118(0), _field11C(0), + _field1C0(0), _field1C4(0), _field1C8(0), _field1CC(0), + _field1D0(0), _field1D4(0) { +} + +void CPetRoomsSection::save(SimpleFile *file, int indent) const { + +} + +void CPetRoomsSection::load(SimpleFile *file, int param) { + if (!param) { + int count = file->readNumber(); + + for (int idx = 0; idx < count; ++idx) { + int v1 = file->readNumber(); + int v2 = file->readNumber(); + warning("TODO: CPetRoomsSection::load - %d,%d", v1, v2); + } + + _listItem.setField34(file->readNumber()); + file->readNumber(); + _field1C0 = file->readNumber(); + _field1C4 = file->readNumber(); + _field1C8 = file->readNumber(); + _field1CC = file->readNumber(); + _field1D0 = file->readNumber(); + _field1D4 = file->readNumber(); + } +} + +bool CPetRoomsSection::isValid(CPetControl *petControl) { + // TODO + return true; +} + + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms.h b/engines/titanic/pet_control/pet_rooms.h new file mode 100644 index 0000000000..a4bcefe09c --- /dev/null +++ b/engines/titanic/pet_control/pet_rooms.h @@ -0,0 +1,74 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_ROOMS_SECTION_H +#define TITANIC_PET_ROOMS_SECTION_H + +#include "titanic/pet_control/pet_section.h" +#include "titanic/pet_control/pet_control_sub11.h" +#include "titanic/pet_control/pet_control_sub12.h" +#include "titanic/pet_control/pet_control_list_item2.h" + +namespace Titanic { + +class CPetRoomsSection : public CPetSection { +private: + CPetControlSub11 _sub11; + CPetControlListItem2 _listItem; + int _field100; + int _field104; + int _field108; + int _field10C; + int _field110; + int _field114; + int _field118; + int _field11C; + CPetGfxElement _val1; + CPetControlSub12 _sub12; + int _field1C0; + int _field1C4; + int _field1C8; + int _field1CC; + int _field1D0; + int _field1D4; +public: + CPetRoomsSection(); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file, int param); + + /** + * Returns true if the object is in a valid state + */ + virtual bool isValid(CPetControl *petControl); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_ROOMS_SECTION_H */ diff --git a/engines/titanic/pet_control/pet_rooms_section.cpp b/engines/titanic/pet_control/pet_rooms_section.cpp deleted file mode 100644 index d0d098580a..0000000000 --- a/engines/titanic/pet_control/pet_rooms_section.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* 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 "titanic/pet_control/pet_rooms_section.h" - -namespace Titanic { - -CPetRoomsSection::CPetRoomsSection() : - _field100(0), _field104(0), _field108(0), _field10C(0), - _field110(0), _field114(0), _field118(0), _field11C(0), - _field1C0(0), _field1C4(0), _field1C8(0), _field1CC(0), - _field1D0(0), _field1D4(0) { -} - -void CPetRoomsSection::save(SimpleFile *file, int indent) const { - -} - -void CPetRoomsSection::load(SimpleFile *file, int param) { - if (!param) { - int count = file->readNumber(); - - for (int idx = 0; idx < count; ++idx) { - int v1 = file->readNumber(); - int v2 = file->readNumber(); - warning("TODO: CPetRoomsSection::load - %d,%d", v1, v2); - } - - _listItem.setField34(file->readNumber()); - file->readNumber(); - _field1C0 = file->readNumber(); - _field1C4 = file->readNumber(); - _field1C8 = file->readNumber(); - _field1CC = file->readNumber(); - _field1D0 = file->readNumber(); - _field1D4 = file->readNumber(); - } -} - -bool CPetRoomsSection::isValid(CPetControl *petControl) { - // TODO - return true; -} - - -} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms_section.h b/engines/titanic/pet_control/pet_rooms_section.h deleted file mode 100644 index a4bcefe09c..0000000000 --- a/engines/titanic/pet_control/pet_rooms_section.h +++ /dev/null @@ -1,74 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_ROOMS_SECTION_H -#define TITANIC_PET_ROOMS_SECTION_H - -#include "titanic/pet_control/pet_section.h" -#include "titanic/pet_control/pet_control_sub11.h" -#include "titanic/pet_control/pet_control_sub12.h" -#include "titanic/pet_control/pet_control_list_item2.h" - -namespace Titanic { - -class CPetRoomsSection : public CPetSection { -private: - CPetControlSub11 _sub11; - CPetControlListItem2 _listItem; - int _field100; - int _field104; - int _field108; - int _field10C; - int _field110; - int _field114; - int _field118; - int _field11C; - CPetGfxElement _val1; - CPetControlSub12 _sub12; - int _field1C0; - int _field1C4; - int _field1C8; - int _field1CC; - int _field1D0; - int _field1D4; -public: - CPetRoomsSection(); - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file, int param); - - /** - * Returns true if the object is in a valid state - */ - virtual bool isValid(CPetControl *petControl); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_ROOMS_SECTION_H */ diff --git a/engines/titanic/pet_control/pet_save_section.cpp b/engines/titanic/pet_control/pet_save_section.cpp deleted file mode 100644 index 8d24fed42c..0000000000 --- a/engines/titanic/pet_control/pet_save_section.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 "titanic/pet_control/pet_save_section.h" - -namespace Titanic { - -bool CPetSaveSection::isValid(CPetControl *petControl) { - // TODO - return true; -} - -} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_save_section.h b/engines/titanic/pet_control/pet_save_section.h deleted file mode 100644 index 502338263f..0000000000 --- a/engines/titanic/pet_control/pet_save_section.h +++ /dev/null @@ -1,45 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_SAVE_SECTION_H -#define TITANIC_PET_SAVE_SECTION_H - -#include "titanic/pet_control/pet_section.h" -#include "titanic/pet_control/pet_control_sub10.h" -#include "titanic/pet_control/pet_control_sub12.h" - -namespace Titanic { - -class CPetSaveSection : public CPetSection { -private: - CPetControlSub10 _sub10; - CPetControlSub10 _sub12; -public: - /** - * Returns true if the object is in a valid state - */ - virtual bool isValid(CPetControl *petControl); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_SAVE_SECTION_H */ diff --git a/engines/titanic/pet_control/pet_saves.cpp b/engines/titanic/pet_control/pet_saves.cpp new file mode 100644 index 0000000000..0a90cc257d --- /dev/null +++ b/engines/titanic/pet_control/pet_saves.cpp @@ -0,0 +1,32 @@ +/* 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 "titanic/pet_control/pet_saves.h" + +namespace Titanic { + +bool CPetSaves::isValid(CPetControl *petControl) { + // TODO + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_saves.h b/engines/titanic/pet_control/pet_saves.h new file mode 100644 index 0000000000..f11eef693d --- /dev/null +++ b/engines/titanic/pet_control/pet_saves.h @@ -0,0 +1,45 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_SAVES_H +#define TITANIC_PET_SAVES_H + +#include "titanic/pet_control/pet_section.h" +#include "titanic/pet_control/pet_control_sub10.h" +#include "titanic/pet_control/pet_control_sub12.h" + +namespace Titanic { + +class CPetSaves : public CPetSection { +private: + CPetControlSub10 _sub10; + CPetControlSub10 _sub12; +public: + /** + * Returns true if the object is in a valid state + */ + virtual bool isValid(CPetControl *petControl); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_SAVES_H */ -- cgit v1.2.3 From 845e25d118bc81bcea7e1c65a3ef0936ead6fbcf Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 1 Apr 2016 20:37:44 -0400 Subject: TITANIC: Added item strings --- engines/titanic/titanic.cpp | 142 ++++++++++++++++++++++++++++++++++++++++++++ engines/titanic/titanic.h | 11 +++- 2 files changed, 152 insertions(+), 1 deletion(-) diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index 82d0997744..ad91d7001b 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -76,6 +76,7 @@ void TitanicEngine::initialize() { DebugMan.addDebugChannel(kDebugGraphics, "graphics", "Graphics handling"); DebugMan.addDebugChannel(kDebugSound, "sound", "Sound and Music handling"); + setItemNames(); CSaveableObject::initClassList(); CEnterExitFirstClassState::init(); CGetLiftEye2::init(); @@ -118,4 +119,145 @@ Common::Error TitanicEngine::run() { return Common::kNoError; } +void TitanicEngine::setItemNames() { + // Names + _itemNames[0] = "LeftArmWith"; + _itemNames[1] = "LeftArmWithout"; + _itemNames[2] = "RightArmWith"; + _itemNames[3] = "RightArmWithout"; + _itemNames[4] = "BridgeRed"; + _itemNames[5] = "BridgeYellow"; + _itemNames[6] = "BridgeBlue"; + _itemNames[7] = "BridgeGreen"; + _itemNames[8] = "Parrot"; + _itemNames[9] = "CentralCore"; + _itemNames[10] = "BrainGreen"; + _itemNames[11] = "BrainYellow"; + _itemNames[12] = "BrainRed"; + _itemNames[13] = "BrainBlue"; + _itemNames[14] = "ChickenGreasy"; + _itemNames[15] = "ChickenPlain"; + _itemNames[16] = "ChickenPurple"; + _itemNames[17] = "ChickenRed"; + _itemNames[18] = "ChickenYellow"; + _itemNames[19] = "CrushedTV"; + _itemNames[20] = "Ear"; + _itemNames[21] = "Ear1"; + _itemNames[22] = "Eyeball"; + _itemNames[23] = "Eyeball1"; + _itemNames[24] = "Feather"; + _itemNames[25] = "Lemon"; + _itemNames[26] = "GlassEmpty"; + _itemNames[27] = "GlassPurple"; + _itemNames[28] = "GlassRed"; + _itemNames[29] = "GlassYellow"; + _itemNames[30] = "Hammer"; + _itemNames[31] = "Hose"; + _itemNames[32] = "HoseEnd"; + _itemNames[33] = "LiftHead"; + _itemNames[34] = "LongStick"; + _itemNames[35] = "Magazine"; + _itemNames[36] = "Mouth"; + _itemNames[37] = "MusicKey"; + _itemNames[38] = "Napkin"; + _itemNames[39] = "Nose"; + _itemNames[40] = "Perch"; + _itemNames[41] = "PhonoCylinder"; + _itemNames[42] = "PhonoCylinder1"; + _itemNames[43] = "PhonoCylinder2"; + _itemNames[44] = "PhonoCylinder3"; + _itemNames[45] = "Photo"; + + // Item long descriptions + _itemDescriptions[0] = "The Maitre d'Bot's left arm holding a key"; + _itemDescriptions[1] = "The Maitre d'Bot's left arm"; + _itemDescriptions[2] = "The Maitre d'Bot's right arm holding Titania's auditory center"; + _itemDescriptions[3] = "The Maitre d'Bot's right arm"; + _itemDescriptions[4] = "Red Fuse"; + _itemDescriptions[5] = "Yellow Fuse"; + _itemDescriptions[6] = "Blue Fuse"; + _itemDescriptions[7] = "Green Fuse"; + _itemDescriptions[8] = "The Parrot"; + _itemDescriptions[9] = "Titania's central intelligence core"; + _itemDescriptions[10] = "Titania's auditory center"; + _itemDescriptions[11] = "Titania's olfactory center"; + _itemDescriptions[12] = "Titania's speech center"; + _itemDescriptions[13] = "Titania's vision center"; + _itemDescriptions[14] = "rather greasy chicken"; + _itemDescriptions[15] = "very plain chicken"; + _itemDescriptions[16] = "chicken smeared with starling pur$e"; + _itemDescriptions[17] = "chicken covered with tomato sauce"; + _itemDescriptions[18] = "chicken coated in mustard sauce"; + _itemDescriptions[19] = "A crushed television set"; + _itemDescriptions[20] = "Titania's ear"; + _itemDescriptions[21] = "Titania's ear"; + _itemDescriptions[22] = "Titania's eye"; + _itemDescriptions[23] = "Titania's eye"; + _itemDescriptions[24] = "A parrot feather"; + _itemDescriptions[25] = "A nice fat juicy lemon"; + _itemDescriptions[26] = "An empty beer glass"; + _itemDescriptions[27] = "A beer glass containing pur$ed flock of starlings"; + _itemDescriptions[28] = "A beer glass containing tomato sauce"; + _itemDescriptions[29] = "A beer glass containing mustard sauce"; + _itemDescriptions[30] = "A hammer"; + _itemDescriptions[31] = "A hose"; + _itemDescriptions[32] = "The other end of a hose"; + _itemDescriptions[33] = "The LiftBot's head"; + _itemDescriptions[34] = "A rather long stick"; + _itemDescriptions[35] = "A magazine"; + _itemDescriptions[36] = "Titania's mouth"; + _itemDescriptions[37] = "A key"; + _itemDescriptions[38] = "A super-absorbent napkin"; + _itemDescriptions[39] = "Titania's nose"; + _itemDescriptions[40] = "A perch"; + _itemDescriptions[41] = "A phonograph cylinder"; + _itemDescriptions[42] = "A phonograph cylinder"; + _itemDescriptions[43] = "A phonograph cylinder"; + _itemDescriptions[44] = "A phonograph cylinder"; + _itemDescriptions[45] = "A photograph"; + + // Short descriptions.. maybe? + _itemShortDesc[0] = "MaitreD Left Arm"; + _itemShortDesc[1] = "MaitreD Right Arm"; + _itemShortDesc[2] = "OlfactoryCentre"; + _itemShortDesc[3] = "AuditoryCentre"; + _itemShortDesc[4] = "SpeechCentre"; + _itemShortDesc[5] = "VisionCentre"; + _itemShortDesc[6] = "CentralCore"; + _itemShortDesc[7] = "Perch"; + _itemShortDesc[8] = "SeasonBridge"; + _itemShortDesc[9] = "FanBridge"; + _itemShortDesc[10] = "BeamBridge"; + _itemShortDesc[11] = "ChickenBridge"; + _itemShortDesc[12] = "CarryParrot"; + _itemShortDesc[13] = "Chicken"; + _itemShortDesc[14] = "CrushedTV"; + _itemShortDesc[15] = "Feathers"; + _itemShortDesc[16] = "Lemon"; + _itemShortDesc[17] = "BeerGlass"; + _itemShortDesc[18] = "BigHammer"; + _itemShortDesc[19] = "Ear1"; + _itemShortDesc[20] = "Ear 2"; + _itemShortDesc[21] = "Eye1"; + _itemShortDesc[22] = "Eye2"; + _itemShortDesc[23] = "Mouth"; + _itemShortDesc[24] = "Nose"; + _itemShortDesc[25] = "NoseSpare"; + _itemShortDesc[26] = "Hose"; + _itemShortDesc[27] = "DeadHoseSpare"; + _itemShortDesc[28] = "HoseEnd"; + _itemShortDesc[29] = "DeadHoseEndSpare"; + _itemShortDesc[30] = "BrokenLiftbotHead"; + _itemShortDesc[31] = "LongStick"; + _itemShortDesc[32] = "Magazine"; + _itemShortDesc[33] = "Napkin"; + _itemShortDesc[34] = "Phonograph Cylinder"; + _itemShortDesc[35] = "Phonograph Cylinder 1"; + _itemShortDesc[36] = "Phonograph Cylinder 2"; + _itemShortDesc[37] = "Phonograph Cylinder 3"; + _itemShortDesc[38] = "Photograph"; + _itemShortDesc[39] = "Music System Key"; +} + + } // End of namespace Titanic diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index 512dfc39ad..fff8865f15 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -33,9 +33,10 @@ #include "titanic/debugger.h" #include "titanic/events.h" #include "titanic/files_manager.h" +#include "titanic/main_game_window.h" #include "titanic/movie.h" #include "titanic/screen_manager.h" -#include "titanic/main_game_window.h" +#include "titanic/string.h" /** * This is the namespace of the Titanic engine. @@ -86,6 +87,11 @@ private: * Handles game deinitialization */ void deinitialize(); + + /** + * Sets up the item names, short, and long descriptions + */ + void setItemNames(); protected: const TitanicGameDescription *_gameDescription; int _loadSaveSlot; @@ -103,6 +109,9 @@ public: CMainGameWindow *_window; Common::RandomSource _randomSource; CGlobalMovies _movieList; + CString _itemNames[46]; + CString _itemDescriptions[46]; + CString _itemShortDesc[40]; public: TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc); virtual ~TitanicEngine(); -- cgit v1.2.3 From 2c16d68f458517dd2494b6231c98b6632c4105e7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 1 Apr 2016 20:49:13 -0400 Subject: TITANIC: Simplified item strings setup --- engines/titanic/titanic.cpp | 182 ++++++++++++-------------------------------- 1 file changed, 47 insertions(+), 135 deletions(-) diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index ad91d7001b..9e24bbd4e9 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -120,143 +120,55 @@ Common::Error TitanicEngine::run() { } void TitanicEngine::setItemNames() { - // Names - _itemNames[0] = "LeftArmWith"; - _itemNames[1] = "LeftArmWithout"; - _itemNames[2] = "RightArmWith"; - _itemNames[3] = "RightArmWithout"; - _itemNames[4] = "BridgeRed"; - _itemNames[5] = "BridgeYellow"; - _itemNames[6] = "BridgeBlue"; - _itemNames[7] = "BridgeGreen"; - _itemNames[8] = "Parrot"; - _itemNames[9] = "CentralCore"; - _itemNames[10] = "BrainGreen"; - _itemNames[11] = "BrainYellow"; - _itemNames[12] = "BrainRed"; - _itemNames[13] = "BrainBlue"; - _itemNames[14] = "ChickenGreasy"; - _itemNames[15] = "ChickenPlain"; - _itemNames[16] = "ChickenPurple"; - _itemNames[17] = "ChickenRed"; - _itemNames[18] = "ChickenYellow"; - _itemNames[19] = "CrushedTV"; - _itemNames[20] = "Ear"; - _itemNames[21] = "Ear1"; - _itemNames[22] = "Eyeball"; - _itemNames[23] = "Eyeball1"; - _itemNames[24] = "Feather"; - _itemNames[25] = "Lemon"; - _itemNames[26] = "GlassEmpty"; - _itemNames[27] = "GlassPurple"; - _itemNames[28] = "GlassRed"; - _itemNames[29] = "GlassYellow"; - _itemNames[30] = "Hammer"; - _itemNames[31] = "Hose"; - _itemNames[32] = "HoseEnd"; - _itemNames[33] = "LiftHead"; - _itemNames[34] = "LongStick"; - _itemNames[35] = "Magazine"; - _itemNames[36] = "Mouth"; - _itemNames[37] = "MusicKey"; - _itemNames[38] = "Napkin"; - _itemNames[39] = "Nose"; - _itemNames[40] = "Perch"; - _itemNames[41] = "PhonoCylinder"; - _itemNames[42] = "PhonoCylinder1"; - _itemNames[43] = "PhonoCylinder2"; - _itemNames[44] = "PhonoCylinder3"; - _itemNames[45] = "Photo"; - - // Item long descriptions - _itemDescriptions[0] = "The Maitre d'Bot's left arm holding a key"; - _itemDescriptions[1] = "The Maitre d'Bot's left arm"; - _itemDescriptions[2] = "The Maitre d'Bot's right arm holding Titania's auditory center"; - _itemDescriptions[3] = "The Maitre d'Bot's right arm"; - _itemDescriptions[4] = "Red Fuse"; - _itemDescriptions[5] = "Yellow Fuse"; - _itemDescriptions[6] = "Blue Fuse"; - _itemDescriptions[7] = "Green Fuse"; - _itemDescriptions[8] = "The Parrot"; - _itemDescriptions[9] = "Titania's central intelligence core"; - _itemDescriptions[10] = "Titania's auditory center"; - _itemDescriptions[11] = "Titania's olfactory center"; - _itemDescriptions[12] = "Titania's speech center"; - _itemDescriptions[13] = "Titania's vision center"; - _itemDescriptions[14] = "rather greasy chicken"; - _itemDescriptions[15] = "very plain chicken"; - _itemDescriptions[16] = "chicken smeared with starling pur$e"; - _itemDescriptions[17] = "chicken covered with tomato sauce"; - _itemDescriptions[18] = "chicken coated in mustard sauce"; - _itemDescriptions[19] = "A crushed television set"; - _itemDescriptions[20] = "Titania's ear"; - _itemDescriptions[21] = "Titania's ear"; - _itemDescriptions[22] = "Titania's eye"; - _itemDescriptions[23] = "Titania's eye"; - _itemDescriptions[24] = "A parrot feather"; - _itemDescriptions[25] = "A nice fat juicy lemon"; - _itemDescriptions[26] = "An empty beer glass"; - _itemDescriptions[27] = "A beer glass containing pur$ed flock of starlings"; - _itemDescriptions[28] = "A beer glass containing tomato sauce"; - _itemDescriptions[29] = "A beer glass containing mustard sauce"; - _itemDescriptions[30] = "A hammer"; - _itemDescriptions[31] = "A hose"; - _itemDescriptions[32] = "The other end of a hose"; - _itemDescriptions[33] = "The LiftBot's head"; - _itemDescriptions[34] = "A rather long stick"; - _itemDescriptions[35] = "A magazine"; - _itemDescriptions[36] = "Titania's mouth"; - _itemDescriptions[37] = "A key"; - _itemDescriptions[38] = "A super-absorbent napkin"; - _itemDescriptions[39] = "Titania's nose"; - _itemDescriptions[40] = "A perch"; - _itemDescriptions[41] = "A phonograph cylinder"; - _itemDescriptions[42] = "A phonograph cylinder"; - _itemDescriptions[43] = "A phonograph cylinder"; - _itemDescriptions[44] = "A phonograph cylinder"; - _itemDescriptions[45] = "A photograph"; + static const char *const NAMES[46] = { + "LeftArmWith", "LeftArmWithout", "RightArmWith", "RightArmWithout", "BridgeRed", + "BridgeYellow", "BridgeBlue", "BridgeGreen", "Parrot", "CentralCore", "BrainGreen", + "BrainYellow", "BrainRed", "BrainBlue", "ChickenGreasy", "ChickenPlain", "ChickenPurple", + "ChickenRed", "ChickenYellow", "CrushedTV", "Ear", "Ear1", "Eyeball", "Eyeball1", + "Feather", "Lemon", "GlassEmpty", "GlassPurple", "GlassRed", "GlassYellow", "Hammer", + "Hose", "HoseEnd", "LiftHead", "LongStick", "Magazine", "Mouth", "MusicKey", "Napkin", + "Nose", "Perch", "PhonoCylinder", "PhonoCylinder1", "PhonoCylinder2", "PhonoCylinder3", + "Photo" + }; + for (uint idx = 0; idx < 46; ++idx) + _itemNames[idx] = NAMES[idx]; + + // Item descriptions + static const char *const DESCRIPTIONS[46] = { + "The Maitre d'Bot's left arm holding a key", "The Maitre d'Bot's left arm", + "The Maitre d'Bot's right arm holding Titania's auditory center", + "The Maitre d'Bot's right arm", "Red Fuse", "Yellow Fuse", "Blue Fuse", + "Green Fuse", "The Parrot", "Titania's central intelligence core", + "Titania's auditory center", "Titania's olfactory center", + "Titania's speech center", "Titania's vision center", "rather greasy chicken", + "very plain chicken", "chicken smeared with starling pur$e", + "chicken covered with tomato sauce", "chicken coated in mustard sauce", + "A crushed television set", "Titania's ear", "Titania's ear", "Titania's eye", + "Titania's eye", "A parrot feather", "A nice fat juicy lemon", + "An empty beer glass", "A beer glass containing pur$ed flock of starlings", + "A beer glass containing tomato sauce", "A beer glass containing mustard sauce", + "A hammer", "A hose", "The other end of a hose", "The LiftBot's head", + "A rather long stick", "A magazine", "Titania's mouth", "A key", + "A super-absorbent napkin", "Titania's nose", "A perch", "A phonograph cylinder", + "A phonograph cylinder", "A phonograph cylinder", "A phonograph cylinder", + "A photograph" + }; + for (uint idx = 0; idx < 46; ++idx) + _itemDescriptions[idx] = DESCRIPTIONS[idx]; // Short descriptions.. maybe? - _itemShortDesc[0] = "MaitreD Left Arm"; - _itemShortDesc[1] = "MaitreD Right Arm"; - _itemShortDesc[2] = "OlfactoryCentre"; - _itemShortDesc[3] = "AuditoryCentre"; - _itemShortDesc[4] = "SpeechCentre"; - _itemShortDesc[5] = "VisionCentre"; - _itemShortDesc[6] = "CentralCore"; - _itemShortDesc[7] = "Perch"; - _itemShortDesc[8] = "SeasonBridge"; - _itemShortDesc[9] = "FanBridge"; - _itemShortDesc[10] = "BeamBridge"; - _itemShortDesc[11] = "ChickenBridge"; - _itemShortDesc[12] = "CarryParrot"; - _itemShortDesc[13] = "Chicken"; - _itemShortDesc[14] = "CrushedTV"; - _itemShortDesc[15] = "Feathers"; - _itemShortDesc[16] = "Lemon"; - _itemShortDesc[17] = "BeerGlass"; - _itemShortDesc[18] = "BigHammer"; - _itemShortDesc[19] = "Ear1"; - _itemShortDesc[20] = "Ear 2"; - _itemShortDesc[21] = "Eye1"; - _itemShortDesc[22] = "Eye2"; - _itemShortDesc[23] = "Mouth"; - _itemShortDesc[24] = "Nose"; - _itemShortDesc[25] = "NoseSpare"; - _itemShortDesc[26] = "Hose"; - _itemShortDesc[27] = "DeadHoseSpare"; - _itemShortDesc[28] = "HoseEnd"; - _itemShortDesc[29] = "DeadHoseEndSpare"; - _itemShortDesc[30] = "BrokenLiftbotHead"; - _itemShortDesc[31] = "LongStick"; - _itemShortDesc[32] = "Magazine"; - _itemShortDesc[33] = "Napkin"; - _itemShortDesc[34] = "Phonograph Cylinder"; - _itemShortDesc[35] = "Phonograph Cylinder 1"; - _itemShortDesc[36] = "Phonograph Cylinder 2"; - _itemShortDesc[37] = "Phonograph Cylinder 3"; - _itemShortDesc[38] = "Photograph"; - _itemShortDesc[39] = "Music System Key"; + static const char *const SHORT_DESC[40] = { + "MaitreD Left Arm", "MaitreD Right Arm", "OlfactoryCentre", "AuditoryCentre", + "SpeechCentre", "VisionCentre", "CentralCore", "Perch", "SeasonBridge", + "FanBridge", "BeamBridge", "ChickenBridge", "CarryParrot", "Chicken", + "CrushedTV", "Feathers", "Lemon", "BeerGlass", "BigHammer", "Ear1", "Ear 2", + "Eye1", "Eye2", "Mouth", "Nose", "NoseSpare", "Hose", "DeadHoseSpare", + "HoseEnd", "DeadHoseEndSpare", "BrokenLiftbotHead", "LongStick", "Magazine", + "Napkin", "Phonograph Cylinder", "Phonograph Cylinder 1", "Phonograph Cylinder 2", + "Phonograph Cylinder 3", "Photograph", "Music System Key" + }; + for (uint idx = 0; idx < 40; ++idx) + _itemShortDesc[idx] = SHORT_DESC[idx]; } -- cgit v1.2.3 From 7ef899f18d17bebf0bec01a8455cd6e23b94268c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 1 Apr 2016 21:58:39 -0400 Subject: TITANIC: Implementing CPetInventory setup --- engines/titanic/pet_control/pet_control_sub10.cpp | 4 +- engines/titanic/pet_control/pet_control_sub10.h | 15 ++++++-- engines/titanic/pet_control/pet_control_sub12.cpp | 41 ++++++++++++++++---- engines/titanic/pet_control/pet_control_sub12.h | 22 +++++++++-- engines/titanic/pet_control/pet_inventory.cpp | 46 ++++++++++++++++++++++- engines/titanic/pet_control/pet_inventory.h | 22 ++++++++++- engines/titanic/titanic.cpp | 8 ++-- engines/titanic/titanic.h | 7 +++- 8 files changed, 138 insertions(+), 27 deletions(-) diff --git a/engines/titanic/pet_control/pet_control_sub10.cpp b/engines/titanic/pet_control/pet_control_sub10.cpp index 226ac4ec8b..59b9648fc1 100644 --- a/engines/titanic/pet_control/pet_control_sub10.cpp +++ b/engines/titanic/pet_control/pet_control_sub10.cpp @@ -33,8 +33,8 @@ void CPetControlSub10::proc8() { error("TODO"); } -void CPetControlSub10::proc9() { - error("TODO"); +void CPetControlSub10::setup() { + warning("TODO: CPetControlSub10::setup"); } void CPetControlSub10::proc10() { diff --git a/engines/titanic/pet_control/pet_control_sub10.h b/engines/titanic/pet_control/pet_control_sub10.h index e31937865b..625100a25f 100644 --- a/engines/titanic/pet_control/pet_control_sub10.h +++ b/engines/titanic/pet_control/pet_control_sub10.h @@ -37,16 +37,23 @@ protected: int _field1C; int _field20; int _field24; - CPetGfxElement _val1; - CPetGfxElement _val2; - CPetGfxElement _val3; + CPetGfxElement _selection; + CPetGfxElement _scrollLeft; + CPetGfxElement _scrollRight; public: CPetControlSub10(); virtual void proc8(); - virtual void proc9(); + + /** + * Set up the control + */ + virtual void setup(); + virtual void proc10(); virtual void proc11(); + + void set20(int val) { _field20 = val; } }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub12.cpp b/engines/titanic/pet_control/pet_control_sub12.cpp index 5daf826ae6..2bba6747b9 100644 --- a/engines/titanic/pet_control/pet_control_sub12.cpp +++ b/engines/titanic/pet_control/pet_control_sub12.cpp @@ -25,8 +25,7 @@ namespace Titanic { CPetControlSub12::CPetControlSub12(int count) : - _field18(0), _field1C(0), _field20(0), _field24(0), - _field28(0), _field30(-1), _field34(0), _field38(-1), + _field18(0), _field30(-1), _field34(0), _field38(-1), _field3C(0), _field40(0), _field44(0), _field48(0xff), _field4C(0xff), _field50(0xff), _field54(0), _field58(0), _field5C(200), _field60(0), _field64(0), _field68(0), @@ -46,15 +45,44 @@ void CPetControlSub12::freeArrays() { _array.clear(); } +void CPetControlSub12::setup() { + for (int idx = 0; idx < (int)_array.size(); ++idx) { + _array[idx]._string1.clear(); + setArrayStr2(idx, _field54, _field58, _field5C); + _array[idx]._string3.clear(); + } + + _field34 = 0; + _field18 = 0; +} + +void CPetControlSub12::setArrayStr2(uint idx, int val1, int val2, int val3) { + char buffer[6]; + if (!val1) + val1 = 1; + if (!val2) + val2 = 1; + if (!val3) + val3 = 1; + + buffer[0] = 27; + buffer[1] = val1; + buffer[2] = val2; + buffer[3] = val3; + buffer[4] = 27; + buffer[5] = '\0'; + _array[idx]._string2 = buffer; +} + void CPetControlSub12::load(SimpleFile *file, int param) { if (!param) { int var1 = file->readNumber(); int var2 = file->readNumber(); uint count = file->readNumber(); - _field1C = file->readNumber(); - _field20 = file->readNumber(); - _field24 = file->readNumber(); - _field28 = file->readNumber(); + _bounds.left = file->readNumber(); + _bounds.top = file->readNumber(); + _bounds.right = file->readNumber(); + _bounds.bottom = file->readNumber(); _field3C = file->readNumber(); _field40 = file->readNumber(); _field44 = file->readNumber(); @@ -77,5 +105,4 @@ void CPetControlSub12::load(SimpleFile *file, int param) { } } - } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub12.h b/engines/titanic/pet_control/pet_control_sub12.h index 5c0f0b397c..b5ff1b0663 100644 --- a/engines/titanic/pet_control/pet_control_sub12.h +++ b/engines/titanic/pet_control/pet_control_sub12.h @@ -37,10 +37,7 @@ private: Common::Array _array; CString _string1; int _field18; - int _field1C; - int _field20; - int _field24; - int _field28; + Rect _bounds; int _field30; int _field34; int _field38; @@ -65,10 +62,27 @@ private: void setupArrays(int count); void freeArrays(); + + void setArrayStr2(uint idx, int val1, int val2, int val3); public: CPetControlSub12(int count = 10); + /** + * Set up the control + */ + void setup(); + + /** + * Load the data for the control + */ void load(SimpleFile *file, int param); + + /** + * Set the bounds for the control + */ + void setBounds(const Rect &bounds) { _bounds = bounds; } + + void set70(int val) { _field70 = val; } }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index c0a93fa23b..0417092ea4 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -21,16 +21,58 @@ */ #include "titanic/pet_control/pet_inventory.h" +#include "titanic/pet_control/pet_control.h" +#include "titanic/titanic.h" namespace Titanic { CPetInventory::CPetInventory() : CPetSection(), _field28C(0), _field290(0), _field294(0), _field298(0) { - for (int idx = 0; idx < 46; ++idx) { - _valArray1[idx] = _valArray2[idx] = 0; + for (int idx = 0; idx < TOTAL_ITEMS; ++idx) { + _itemBackgrounds[idx] = _itemGlyphs[idx] = nullptr; } } +bool CPetInventory::setup(CPetControl *petControl) { + return setPetControl(petControl) && setup(); +} + +bool CPetInventory::setup() { + _sub10.setup(); + _sub12.setup(); + + // TODO + return true; +} + +bool CPetInventory::setPetControl(CPetControl *petControl) { + if (!petControl) + return false; + + _petControl = petControl; + _sub10.proc8(); + _sub10.set20(28); + + Rect tempRect(0, 0, 52, 52); + for (uint idx = 0; idx < TOTAL_ITEMS; ++idx) { + if (!g_vm->_itemNames[idx].empty()) { + CString name = "3Pet" + g_vm->_itemNames[idx]; + _itemBackgrounds[idx] = petControl->getHiddenObject(name); + } + + if (!g_vm->_itemObjects[idx].empty()) { + _itemGlyphs[idx] = petControl->getHiddenObject(g_vm->_itemObjects[idx]); + } + } + + tempRect = Rect(0, 0, 580, 15); + tempRect.translate(32, 445); + _sub12.setBounds(tempRect); + _sub12.set70(0); + + return true; +} + void CPetInventory::save(SimpleFile *file, int indent) const { file->writeNumberLine(_field298, indent); } diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h index ef295f1507..6f3fd62c78 100644 --- a/engines/titanic/pet_control/pet_inventory.h +++ b/engines/titanic/pet_control/pet_inventory.h @@ -30,19 +30,37 @@ namespace Titanic { +/** + * Handles displaying the player's inventory in the PET + */ class CPetInventory : public CPetSection { private: CPetControlSub12 _sub12; CPetControlSub10 _sub10; - int _valArray1[46]; - int _valArray2[46]; + CGameObject *_itemBackgrounds[46]; + CGameObject *_itemGlyphs[46]; int _field28C; int _field290; int _field294; int _field298; +private: + /** + * Handles initial setup + */ + bool setPetControl(CPetControl *petControl); public: CPetInventory(); + /** + * Sets up the section + */ + virtual bool setup(CPetControl *petControl); + + /** + * Sets up the section + */ + virtual bool setup(); + /** * Save the data for the class to file */ diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index 9e24bbd4e9..03d50f6153 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -120,7 +120,7 @@ Common::Error TitanicEngine::run() { } void TitanicEngine::setItemNames() { - static const char *const NAMES[46] = { + static const char *const NAMES[TOTAL_ITEMS] = { "LeftArmWith", "LeftArmWithout", "RightArmWith", "RightArmWithout", "BridgeRed", "BridgeYellow", "BridgeBlue", "BridgeGreen", "Parrot", "CentralCore", "BrainGreen", "BrainYellow", "BrainRed", "BrainBlue", "ChickenGreasy", "ChickenPlain", "ChickenPurple", @@ -130,11 +130,11 @@ void TitanicEngine::setItemNames() { "Nose", "Perch", "PhonoCylinder", "PhonoCylinder1", "PhonoCylinder2", "PhonoCylinder3", "Photo" }; - for (uint idx = 0; idx < 46; ++idx) + for (uint idx = 0; idx < TOTAL_ITEMS; ++idx) _itemNames[idx] = NAMES[idx]; // Item descriptions - static const char *const DESCRIPTIONS[46] = { + static const char *const DESCRIPTIONS[TOTAL_ITEMS] = { "The Maitre d'Bot's left arm holding a key", "The Maitre d'Bot's left arm", "The Maitre d'Bot's right arm holding Titania's auditory center", "The Maitre d'Bot's right arm", "Red Fuse", "Yellow Fuse", "Blue Fuse", @@ -153,7 +153,7 @@ void TitanicEngine::setItemNames() { "A phonograph cylinder", "A phonograph cylinder", "A phonograph cylinder", "A photograph" }; - for (uint idx = 0; idx < 46; ++idx) + for (uint idx = 0; idx < TOTAL_ITEMS; ++idx) _itemDescriptions[idx] = DESCRIPTIONS[idx]; // Short descriptions.. maybe? diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index fff8865f15..6b85211194 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -64,6 +64,8 @@ enum TitanicDebugChannels { #define ERROR_INTERMEDIATE 2 #define ERROR_DETAILED 3 +#define TOTAL_ITEMS 46 + struct TitanicGameDescription; class TitanicEngine; @@ -109,8 +111,9 @@ public: CMainGameWindow *_window; Common::RandomSource _randomSource; CGlobalMovies _movieList; - CString _itemNames[46]; - CString _itemDescriptions[46]; + CString _itemNames[TOTAL_ITEMS]; + CString _itemDescriptions[TOTAL_ITEMS]; + CString _itemObjects[TOTAL_ITEMS]; CString _itemShortDesc[40]; public: TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc); -- cgit v1.2.3 From 1b8ffff10e164d1fe7c03ef9a35aeb8f7ca3c5e5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 1 Apr 2016 22:17:37 -0400 Subject: TITANIC: Implement overall PET inventory draw method --- engines/titanic/pet_control/pet_control.cpp | 4 +++ engines/titanic/pet_control/pet_control.h | 5 +++ engines/titanic/pet_control/pet_control_sub10.cpp | 4 +++ engines/titanic/pet_control/pet_control_sub10.h | 6 ++++ engines/titanic/pet_control/pet_control_sub12.cpp | 4 +++ engines/titanic/pet_control/pet_control_sub12.h | 7 +++++ engines/titanic/pet_control/pet_frame.cpp | 6 ++++ engines/titanic/pet_control/pet_frame.h | 5 +++ engines/titanic/pet_control/pet_inventory.cpp | 37 +++++++++++++++-------- engines/titanic/pet_control/pet_inventory.h | 10 ++++++ 10 files changed, 75 insertions(+), 13 deletions(-) diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 1ea9977e9a..fbb9efc0f1 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -334,4 +334,8 @@ bool CPetControl::handleMessage(CTimerMsg &msg) { return true; } +void CPetControl::drawIndent(CScreenManager *screenManager, int indent) { + _frame.drawIndent(screenManager, indent); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 40c6b31044..6f5b7948e3 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -185,6 +185,11 @@ public: * Returns a reference to the special hidden room container */ CRoomItem *getHiddenRoom(); + + /** + * Draws the indent + */ + void drawIndent(CScreenManager *screenManager, int indent); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub10.cpp b/engines/titanic/pet_control/pet_control_sub10.cpp index 59b9648fc1..a50ad115c4 100644 --- a/engines/titanic/pet_control/pet_control_sub10.cpp +++ b/engines/titanic/pet_control/pet_control_sub10.cpp @@ -45,4 +45,8 @@ void CPetControlSub10::proc11() { error("TODO"); } +void CPetControlSub10::draw(CScreenManager *screenManager) { + warning("TODO: CPetControlSub10::draw"); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub10.h b/engines/titanic/pet_control/pet_control_sub10.h index 625100a25f..aabb59638e 100644 --- a/engines/titanic/pet_control/pet_control_sub10.h +++ b/engines/titanic/pet_control/pet_control_sub10.h @@ -26,6 +26,7 @@ #include "titanic/core/list.h" #include "titanic/pet_control/pet_control_sub10.h" #include "titanic/pet_control/pet_control_list_item.h" +#include "titanic/screen_manager.h" namespace Titanic { @@ -54,6 +55,11 @@ public: virtual void proc11(); void set20(int val) { _field20 = val; } + + /** + * Draw the control + */ + void draw(CScreenManager *screenManager); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub12.cpp b/engines/titanic/pet_control/pet_control_sub12.cpp index 2bba6747b9..44335f3b5a 100644 --- a/engines/titanic/pet_control/pet_control_sub12.cpp +++ b/engines/titanic/pet_control/pet_control_sub12.cpp @@ -105,4 +105,8 @@ void CPetControlSub12::load(SimpleFile *file, int param) { } } +void CPetControlSub12::draw(CScreenManager *screenManager) { + warning("TODO: CPetControlSub12::draw"); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub12.h b/engines/titanic/pet_control/pet_control_sub12.h index b5ff1b0663..a189bc2159 100644 --- a/engines/titanic/pet_control/pet_control_sub12.h +++ b/engines/titanic/pet_control/pet_control_sub12.h @@ -24,6 +24,7 @@ #define TITANIC_PET_CONTROL_SUB12_H #include "titanic/simple_file.h" +#include "titanic/screen_manager.h" namespace Titanic { @@ -83,6 +84,12 @@ public: void setBounds(const Rect &bounds) { _bounds = bounds; } void set70(int val) { _field70 = val; } + + /** + * Draw the control + */ + void draw(CScreenManager *screenManager); + }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_frame.cpp b/engines/titanic/pet_control/pet_frame.cpp index 3e464a0647..6e3ff4f62c 100644 --- a/engines/titanic/pet_control/pet_frame.cpp +++ b/engines/titanic/pet_control/pet_frame.cpp @@ -143,4 +143,10 @@ void CPetFrame::drawFrame(CScreenManager *screenManager) { _titles[_petControl->_currentArea].draw(screenManager); } +void CPetFrame::drawIndent(CScreenManager *screenManager, int indent) { + indent = CLIP(indent, 0, 7); + for (int idx = 0; idx < indent; ++indent) + _indent[idx].draw(screenManager); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_frame.h b/engines/titanic/pet_control/pet_frame.h index f14e6eaddf..f26a2bf48e 100644 --- a/engines/titanic/pet_control/pet_frame.h +++ b/engines/titanic/pet_control/pet_frame.h @@ -89,6 +89,11 @@ public: * Draws the PET frame */ void drawFrame(CScreenManager *screenManager); + + /** + * Draws the indent + */ + void drawIndent(CScreenManager *screenManager, int indent); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index 0417092ea4..6e0bb22dc5 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -45,6 +45,30 @@ bool CPetInventory::setup() { return true; } +void CPetInventory::draw(CScreenManager *screenManager) { + _petControl->drawIndent(screenManager, 7); + _sub10.draw(screenManager); + _sub12.draw(screenManager); +} + +Rect CPetInventory::getBounds() { + // TODO + return Rect(); +} + +void CPetInventory::save(SimpleFile *file, int indent) const { + file->writeNumberLine(_field298, indent); +} + +void CPetInventory::load(SimpleFile *file, int param) { + _field298 = file->readNumber(); +} + +bool CPetInventory::isValid(CPetControl *petControl) { + // TODO + return true; +} + bool CPetInventory::setPetControl(CPetControl *petControl) { if (!petControl) return false; @@ -69,20 +93,7 @@ bool CPetInventory::setPetControl(CPetControl *petControl) { tempRect.translate(32, 445); _sub12.setBounds(tempRect); _sub12.set70(0); - - return true; -} -void CPetInventory::save(SimpleFile *file, int indent) const { - file->writeNumberLine(_field298, indent); -} - -void CPetInventory::load(SimpleFile *file, int param) { - _field298 = file->readNumber(); -} - -bool CPetInventory::isValid(CPetControl *petControl) { - // TODO return true; } diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h index 6f3fd62c78..3f1d26d796 100644 --- a/engines/titanic/pet_control/pet_inventory.h +++ b/engines/titanic/pet_control/pet_inventory.h @@ -61,6 +61,16 @@ public: */ virtual bool setup(); + /** + * Draw the section + */ + virtual void draw(CScreenManager *screenManager); + + /** + * Get the bounds for the section + */ + virtual Rect getBounds(); + /** * Save the data for the class to file */ -- cgit v1.2.3 From 5795ec0c9712c48912842570ef4c2bf70f793c91 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 2 Apr 2016 08:52:07 -0400 Subject: TITANIC: Implemented ScreenManager fillRect --- engines/titanic/direct_draw_surface.cpp | 7 +++++ engines/titanic/direct_draw_surface.h | 5 ++++ engines/titanic/pet_control/pet_control_sub12.cpp | 6 ++++ engines/titanic/screen_manager.cpp | 34 +++++++++++++++++++++-- engines/titanic/screen_manager.h | 17 ++++++++++-- 5 files changed, 64 insertions(+), 5 deletions(-) diff --git a/engines/titanic/direct_draw_surface.cpp b/engines/titanic/direct_draw_surface.cpp index b432245333..05fe68a347 100644 --- a/engines/titanic/direct_draw_surface.cpp +++ b/engines/titanic/direct_draw_surface.cpp @@ -78,6 +78,13 @@ void DirectDrawSurface::fill(const Rect *bounds, uint32 color) { _surface->fillRect(tempBounds, color); } +void DirectDrawSurface::fillRect(Rect *rect, byte r, byte g, byte b) { + uint color = _surface->format.RGBToColor(r, g, b); + Rect tempRect = rect ? *rect : Rect(0, 0, getWidth(), getHeight()); + + _surface->fillRect(tempRect, color); +} + void DirectDrawSurface::blit(const Rect &destRect, DirectDrawSurface *srcSurface, Rect &srcRect) { assert(srcSurface); if (!destRect.isEmpty()) diff --git a/engines/titanic/direct_draw_surface.h b/engines/titanic/direct_draw_surface.h index dfcdccb48c..28ff6a8ae6 100644 --- a/engines/titanic/direct_draw_surface.h +++ b/engines/titanic/direct_draw_surface.h @@ -100,6 +100,11 @@ public: */ void fill(const Rect *bounds, uint32 color); + /** + * Fill an area with a specific color + */ + void fillRect(Rect *rect, byte r, byte g, byte b); + /** * Copy data from a source surfcae into this one */ diff --git a/engines/titanic/pet_control/pet_control_sub12.cpp b/engines/titanic/pet_control/pet_control_sub12.cpp index 44335f3b5a..79a53ecb8d 100644 --- a/engines/titanic/pet_control/pet_control_sub12.cpp +++ b/engines/titanic/pet_control/pet_control_sub12.cpp @@ -106,6 +106,12 @@ void CPetControlSub12::load(SimpleFile *file, int param) { } void CPetControlSub12::draw(CScreenManager *screenManager) { + Rect tempRect = _bounds; + + if (_field70) { + + } + warning("TODO: CPetControlSub12::draw"); } diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp index 5e38eca2d8..f74c97bafb 100644 --- a/engines/titanic/screen_manager.cpp +++ b/engines/titanic/screen_manager.cpp @@ -113,11 +113,20 @@ void OSScreenManager::drawCursors() { warning("OSScreenManager::drawCursors"); } +DirectDrawSurface *OSScreenManager::getDDSurface(SurfaceNum surfaceNum) { + if (surfaceNum == SURFACE_PRIMARY) + return _directDrawManager._mainSurface; + else if (surfaceNum < (int)_backSurfaces.size()) + return _directDrawManager._backSurfaces[surfaceNum]; + else + return nullptr; +} + void OSScreenManager::proc6() {} void OSScreenManager::proc7() {} CVideoSurface *OSScreenManager::getSurface(SurfaceNum surfaceNum) const { - if (surfaceNum == -1) + if (surfaceNum == SURFACE_PRIMARY) return _frontRenderSurface; else if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) return _backSurfaces[surfaceNum]._surface; @@ -126,7 +135,26 @@ CVideoSurface *OSScreenManager::getSurface(SurfaceNum surfaceNum) const { } void OSScreenManager::proc9() {} -void OSScreenManager::proc10() {} + +void OSScreenManager::fillRect(SurfaceNum surfaceNum, Rect *rect, byte r, byte g, byte b) { + DirectDrawSurface *surface = getDDSurface(surfaceNum); + if (!surface) + return; + + // If bounds are provided, clip and use them. Otherwise, use entire surface area + Rect surfaceRect(0, 0, surface->getWidth(), surface->getHeight()); + Rect tempRect; + + if (rect) { + tempRect = *rect; + tempRect.clip(surfaceRect); + } else { + tempRect = surfaceRect; + } + + if (tempRect.isValidRect()) + surface->fillRect(&tempRect, r, g, b); +} void OSScreenManager::blitFrom(SurfaceNum surfaceNum, CVideoSurface *src, const Point *destPos, const Rect *srcRect) { @@ -176,7 +204,7 @@ void OSScreenManager::proc18() {} void OSScreenManager::proc19() {} void OSScreenManager::clearSurface(SurfaceNum surfaceNum, Rect *bounds) { - if (surfaceNum == -1) + if (surfaceNum == SURFACE_PRIMARY) _directDrawManager._mainSurface->fill(bounds, 0); else if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) _directDrawManager._backSurfaces[surfaceNum]->fill(bounds, 0); diff --git a/engines/titanic/screen_manager.h b/engines/titanic/screen_manager.h index 1b926fc3c6..8ca17525a1 100644 --- a/engines/titanic/screen_manager.h +++ b/engines/titanic/screen_manager.h @@ -93,7 +93,11 @@ public: virtual void proc7() = 0; virtual CVideoSurface *getSurface(SurfaceNum surfaceNum) const = 0; virtual void proc9() = 0; - virtual void proc10() = 0; + + /** + * Fill an area with a specific color + */ + virtual void fillRect(SurfaceNum surfaceNum, Rect *rect, byte r, byte g, byte b) = 0; /** * Blits a surface onto one of the screen surfaces @@ -151,6 +155,11 @@ private: * Load game cursors */ void loadCursors(); + + /** + * Gets an underlying surface + */ + DirectDrawSurface *getDDSurface(SurfaceNum surfaceNum); public: int _field48; int _field4C; @@ -175,7 +184,11 @@ public: virtual void proc7(); virtual CVideoSurface *getSurface(SurfaceNum surfaceNum) const; virtual void proc9(); - virtual void proc10(); + + /** + * Fill an area with a specific color + */ + virtual void fillRect(SurfaceNum surfaceNum, Rect *rect, byte r, byte g, byte b); /** * Blits a surface onto one of the screen surfaces -- cgit v1.2.3 From 32f7fcc7a0a74bcb3ffeb6899bf209099f9b55d5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 2 Apr 2016 22:25:09 -0400 Subject: TITANIC: Further work on CPetControlSub12 drawing --- engines/titanic/font.cpp | 5 ++ engines/titanic/font.h | 10 ++++ engines/titanic/pet_control/pet_control_sub12.cpp | 57 ++++++++++++++++++----- engines/titanic/pet_control/pet_control_sub12.h | 24 ++++++---- engines/titanic/pet_control/pet_inventory.cpp | 2 +- engines/titanic/screen_manager.cpp | 6 ++- engines/titanic/screen_manager.h | 15 +++++- 7 files changed, 95 insertions(+), 24 deletions(-) diff --git a/engines/titanic/font.cpp b/engines/titanic/font.cpp index bb8f2e05e9..962d6659e0 100644 --- a/engines/titanic/font.cpp +++ b/engines/titanic/font.cpp @@ -20,6 +20,7 @@ * */ +#include "common/textconsole.h" #include "titanic/font.h" namespace Titanic { @@ -31,4 +32,8 @@ void STFont::load(int fontNumber) { // TODO } +void STFont::writeString(int maxWidth, const CString &text, int *v1, int *v2) { + warning("TODO: STFont::writeString"); +} + } // End of namespace Titanic diff --git a/engines/titanic/font.h b/engines/titanic/font.h index 2948505c92..db0698766c 100644 --- a/engines/titanic/font.h +++ b/engines/titanic/font.h @@ -24,6 +24,7 @@ #define TITANIC_FONT_H #include "common/scummsys.h" +#include "titanic/string.h" namespace Titanic { @@ -32,7 +33,16 @@ public: public: STFont(); + /** + * Load a specified font + */ void load(int fontNumber); + + /** + * Write out a string + * TODO: Verify this + */ + void writeString(int maxWidth, const CString &text, int *v1, int *v2); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub12.cpp b/engines/titanic/pet_control/pet_control_sub12.cpp index 79a53ecb8d..59097e33a7 100644 --- a/engines/titanic/pet_control/pet_control_sub12.cpp +++ b/engines/titanic/pet_control/pet_control_sub12.cpp @@ -25,11 +25,11 @@ namespace Titanic { CPetControlSub12::CPetControlSub12(int count) : - _field18(0), _field30(-1), _field34(0), _field38(-1), - _field3C(0), _field40(0), _field44(0), _field48(0xff), - _field4C(0xff), _field50(0xff), _field54(0), _field58(0), + _stringsMerged(false), _field30(-1), _lineCount(0), _field38(-1), + _field3C(0), _field40(0), _field44(0), _backR(0xff), + _backG(0xff), _backB(0xff), _field54(0), _field58(0), _field5C(200), _field60(0), _field64(0), _field68(0), - _field6C(0), _field70(1), _field74(0), _field78(0), + _field6C(0), _hasBorder(true), _field74(0), _field78(0), _field7C(0) { setupArrays(count); } @@ -52,8 +52,8 @@ void CPetControlSub12::setup() { _array[idx]._string3.clear(); } - _field34 = 0; - _field18 = 0; + _lineCount = 0; + _stringsMerged = false; } void CPetControlSub12::setArrayStr2(uint idx, int val1, int val2, int val3) { @@ -86,13 +86,13 @@ void CPetControlSub12::load(SimpleFile *file, int param) { _field3C = file->readNumber(); _field40 = file->readNumber(); _field44 = file->readNumber(); - _field48 = file->readNumber(); - _field4C = file->readNumber(); - _field50 = file->readNumber(); + _backR = file->readNumber(); + _backG = file->readNumber(); + _backB = file->readNumber(); _field54 = file->readNumber(); _field58 = file->readNumber(); _field5C = file->readNumber(); - _field70 = file->readNumber(); + _hasBorder = file->readNumber() != 0; _field74 = file->readNumber(); warning("TODO: CPetControlSub12::load %d,%d", var1, var2); @@ -108,11 +108,44 @@ void CPetControlSub12::load(SimpleFile *file, int param) { void CPetControlSub12::draw(CScreenManager *screenManager) { Rect tempRect = _bounds; - if (_field70) { - + if (_hasBorder) { + // Create border effect + // Top edge + tempRect.bottom = tempRect.top + 1; + screenManager->fillRect(SURFACE_BACKBUFFER, &tempRect, _backR, _backG, _backB); + + // Bottom edge + tempRect.top = _bounds.bottom - 1; + tempRect.bottom = _bounds.bottom; + screenManager->fillRect(SURFACE_BACKBUFFER, &tempRect, _backR, _backG, _backB); + + // Left edge + tempRect = _bounds; + tempRect.right = tempRect.left + 1; + screenManager->fillRect(SURFACE_BACKBUFFER, &tempRect, _backR, _backG, _backB); + + // Right edge + tempRect = _bounds; + tempRect.left = tempRect.right - 1; + screenManager->fillRect(SURFACE_BACKBUFFER, &tempRect, _backR, _backG, _backB); } warning("TODO: CPetControlSub12::draw"); } +void CPetControlSub12::mergeStrings() { + if (!_stringsMerged) { + _lines.clear(); + + for (int idx = 0; idx < _lineCount; ++idx) { + CString line = _array[idx]._string2 + _array[idx]._string3 + + _array[idx]._string1 + "\n"; + _lines += line; + + } + + _stringsMerged = true; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub12.h b/engines/titanic/pet_control/pet_control_sub12.h index a189bc2159..88faf3d074 100644 --- a/engines/titanic/pet_control/pet_control_sub12.h +++ b/engines/titanic/pet_control/pet_control_sub12.h @@ -36,18 +36,18 @@ class CPetControlSub12 { }; private: Common::Array _array; - CString _string1; - int _field18; + CString _lines; + bool _stringsMerged; Rect _bounds; int _field30; - int _field34; + int _lineCount; int _field38; int _field3C; int _field40; int _field44; - int _field48; - int _field4C; - int _field50; + int _backR; + int _backG; + int _backB; int _field54; int _field58; int _field5C; @@ -55,7 +55,7 @@ private: int _field64; int _field68; int _field6C; - int _field70; + bool _hasBorder; int _field74; int _field78; int _field7C; @@ -65,6 +65,11 @@ private: void freeArrays(); void setArrayStr2(uint idx, int val1, int val2, int val3); + + /** + * Merges the strings in the strings array + */ + void mergeStrings(); public: CPetControlSub12(int count = 10); @@ -83,7 +88,10 @@ public: */ void setBounds(const Rect &bounds) { _bounds = bounds; } - void set70(int val) { _field70 = val; } + /** + * Sets the flag for whether to draw a frame border around the control + */ + void setHasBorder(bool val) { _hasBorder = val; } /** * Draw the control diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index 6e0bb22dc5..66d093f513 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -92,7 +92,7 @@ bool CPetInventory::setPetControl(CPetControl *petControl) { tempRect = Rect(0, 0, 580, 15); tempRect.translate(32, 445); _sub12.setBounds(tempRect); - _sub12.set70(0); + _sub12.setHasBorder(false); return true; } diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp index f74c97bafb..99de75a6f4 100644 --- a/engines/titanic/screen_manager.cpp +++ b/engines/titanic/screen_manager.cpp @@ -198,7 +198,11 @@ void OSScreenManager::proc12() {} void OSScreenManager::proc13() {} void OSScreenManager::proc14() {} void OSScreenManager::proc15() {} -void OSScreenManager::proc16() {} + +void OSScreenManager::writeString(int maxWidth, const CString &text, int *v1, int *v2) { + _fonts[_fontNumber].writeString(maxWidth, text, v1, v2); +} + void OSScreenManager::getFont() {} void OSScreenManager::proc18() {} void OSScreenManager::proc19() {} diff --git a/engines/titanic/screen_manager.h b/engines/titanic/screen_manager.h index 8ca17525a1..e39151b85b 100644 --- a/engines/titanic/screen_manager.h +++ b/engines/titanic/screen_manager.h @@ -109,7 +109,13 @@ public: virtual void proc13() = 0; virtual void proc14() = 0; virtual void proc15() = 0; - virtual void proc16() = 0; + + + /** + * Write out a string + */ + virtual void writeString(int maxWidth, const CString &text, int *v1, int *v2) = 0; + virtual void getFont() = 0; virtual void proc18() = 0; virtual void proc19() = 0; @@ -200,7 +206,12 @@ public: virtual void proc13(); virtual void proc14(); virtual void proc15(); - virtual void proc16(); + + /** + * Write out a string + */ + virtual void writeString(int maxWidth, const CString &text, int *v1, int *v2); + virtual void getFont(); virtual void proc18(); virtual void proc19(); -- cgit v1.2.3 From 432153274385295a9a4eb01e56bfcc72cc5f202e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 3 Apr 2016 15:51:42 -0400 Subject: TITANIC: Working on font loading --- engines/titanic/files_manager.cpp | 18 ++++++++++++++++-- engines/titanic/files_manager.h | 9 +++++++++ engines/titanic/font.cpp | 33 ++++++++++++++++++++++++++++++++- engines/titanic/font.h | 14 ++++++++++++++ engines/titanic/string.cpp | 11 +++++++++++ engines/titanic/string.h | 5 +++++ 6 files changed, 87 insertions(+), 3 deletions(-) diff --git a/engines/titanic/files_manager.cpp b/engines/titanic/files_manager.cpp index 617b71b06a..10898909e2 100644 --- a/engines/titanic/files_manager.cpp +++ b/engines/titanic/files_manager.cpp @@ -27,8 +27,12 @@ namespace Titanic { CFilesManager::CFilesManager() : _gameManager(nullptr), - _assetsPath("Assets"), _field0(0), _drive(-1), - _field18(0), _field1C(0), _field3C(0) { + _assetsPath("Assets"), _exeResources(nullptr), _field0(0), + _drive(-1), _field18(0), _field1C(0), _field3C(0) { +} + +CFilesManager::~CFilesManager() { + delete _exeResources; } bool CFilesManager::fileExists(const CString &name) { @@ -89,4 +93,14 @@ void CFilesManager::fn5(const CString &name) { warning("TODO: CFilesManager::fn5"); } +Common::SeekableReadStream *CFilesManager::getResource(const CString &name, + const CString &area) { + if (!_exeResources) { + _exeResources = new Common::NEResources(); + _exeResources->loadFromEXE("st.exe"); + } + + return nullptr; +} + } // End of namespace Titanic diff --git a/engines/titanic/files_manager.h b/engines/titanic/files_manager.h index 74895d7877..6c6b54445d 100644 --- a/engines/titanic/files_manager.h +++ b/engines/titanic/files_manager.h @@ -23,6 +23,7 @@ #ifndef TITANIC_FILES_MANAGER_H #define TITANIC_FILES_MANAGER_H +#include "common/winexe_ne.h" #include "titanic/core/list.h" #include "titanic/screen_manager.h" @@ -36,6 +37,7 @@ class CFilesManagerList : public List { class CFilesManager { private: CGameManager *_gameManager; + Common::NEResources *_exeResources; CFilesManagerList _list; CString _string1; CString _string2; @@ -47,6 +49,7 @@ private: const CString _assetsPath; public: CFilesManager(); + ~CFilesManager(); /** * Sets the game manager @@ -80,6 +83,12 @@ public: void fn4(const CString &name); void fn5(const CString &name); + + /** + * Get a resource from the executable + */ + Common::SeekableReadStream *getResource(const CString &name, + const CString &area); }; } // End of namespace Titanic diff --git a/engines/titanic/font.cpp b/engines/titanic/font.cpp index 962d6659e0..fd6bd54401 100644 --- a/engines/titanic/font.cpp +++ b/engines/titanic/font.cpp @@ -22,14 +22,45 @@ #include "common/textconsole.h" #include "titanic/font.h" +#include "titanic/files_manager.h" +#include "titanic/titanic.h" namespace Titanic { STFont::STFont() { + _dataPtr = nullptr; + _dataSize = 0; + _field8 = 0; + _maxCharWidth = 0; + _field810 = 0; + _field814 = 0; + _field818 = 0; +} + +STFont::~STFont() { + delete[] _dataPtr; } void STFont::load(int fontNumber) { - // TODO + assert(!_dataPtr); + CString fontNumStr = CString::format("%d", fontNumber); + Common::SeekableReadStream *stream = g_vm->_filesManager.getResource( + fontNumStr, "STFont"); + if (!stream) + return; + + _field8 = stream->readUint32LE(); + _maxCharWidth = stream->readUint32LE(); + for (uint idx = 0; idx < 256; ++idx) + _chars[idx]._charWidth = stream->readUint32LE(); + for (uint idx = 0; idx < 256; ++idx) + _chars[idx]._offset = stream->readUint32LE(); + + _dataSize = stream->readUint32LE(); + _dataPtr = new byte[_dataSize]; + stream->read(_dataPtr, _dataSize); + + delete stream; } void STFont::writeString(int maxWidth, const CString &text, int *v1, int *v2) { diff --git a/engines/titanic/font.h b/engines/titanic/font.h index db0698766c..20b960277d 100644 --- a/engines/titanic/font.h +++ b/engines/titanic/font.h @@ -24,14 +24,28 @@ #define TITANIC_FONT_H #include "common/scummsys.h" +#include "common/array.h" #include "titanic/string.h" namespace Titanic { class STFont { + struct CharEntry { + uint _charWidth; + uint _offset; + }; public: + byte *_dataPtr; + size_t _dataSize; + int _field8; + int _maxCharWidth; + Common::Array _chars; + int _field810; + int _field814; + int _field818; public: STFont(); + ~STFont(); /** * Load a specified font diff --git a/engines/titanic/string.cpp b/engines/titanic/string.cpp index 6b43e7992b..b4af9206f6 100644 --- a/engines/titanic/string.cpp +++ b/engines/titanic/string.cpp @@ -108,4 +108,15 @@ ImageType CString::imageTypeSuffix() const { return IMAGETYPE_UNKNOWN; } +CString CString::format(const char *fmt, ...) { + String output; + + va_list va; + va_start(va, fmt); + output = String::vformat(fmt, va); + va_end(va); + + return output; +} + } // End of namespace Titanic diff --git a/engines/titanic/string.h b/engines/titanic/string.h index c41130369b..02775de067 100644 --- a/engines/titanic/string.h +++ b/engines/titanic/string.h @@ -94,6 +94,11 @@ public: int readInt() const { return atoi(c_str()); } + + /** + * Format a string + */ + static CString format(const char *fmt, ...); }; } // End of namespace Titanic -- cgit v1.2.3 From 1efbed540948edcbf3ac2c72c0984def044274cf Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 3 Apr 2016 16:16:35 -0400 Subject: TITANIC: Move most of the root classes into new support/ folder --- engines/titanic/core/file_item.h | 2 +- engines/titanic/core/game_object.cpp | 6 +- engines/titanic/core/game_object.h | 4 +- engines/titanic/core/link_item.h | 2 +- engines/titanic/core/list.h | 2 +- engines/titanic/core/project_item.h | 2 +- engines/titanic/core/resource_key.cpp | 2 +- engines/titanic/core/resource_key.h | 2 +- engines/titanic/core/room_item.h | 2 +- engines/titanic/core/saveable_object.h | 2 +- engines/titanic/core/view_item.cpp | 2 +- engines/titanic/direct_draw.cpp | 109 ------ engines/titanic/direct_draw.h | 105 ------ engines/titanic/direct_draw_surface.cpp | 101 ------ engines/titanic/direct_draw_surface.h | 121 ------- engines/titanic/files_manager.cpp | 106 ------ engines/titanic/files_manager.h | 96 ----- engines/titanic/font.cpp | 70 ---- engines/titanic/font.h | 64 ---- engines/titanic/game_location.h | 2 +- engines/titanic/game_manager.cpp | 2 +- engines/titanic/game_manager.h | 4 +- engines/titanic/game_state.cpp | 2 +- engines/titanic/game_state.h | 4 +- engines/titanic/game_view.cpp | 2 +- engines/titanic/game_view.h | 2 +- engines/titanic/image.cpp | 121 ------- engines/titanic/image.h | 82 ----- engines/titanic/image_decoders.cpp | 79 ----- engines/titanic/image_decoders.h | 52 --- engines/titanic/input_handler.cpp | 2 +- engines/titanic/input_handler.h | 2 +- engines/titanic/main_game_window.h | 2 +- engines/titanic/messages/mouse_messages.h | 2 +- engines/titanic/module.mk | 28 +- engines/titanic/mouse_cursor.cpp | 113 ------ engines/titanic/mouse_cursor.h | 97 ------ engines/titanic/movie.cpp | 114 ------ engines/titanic/movie.h | 95 ----- engines/titanic/pet_control/pet_control_sub10.h | 2 +- engines/titanic/pet_control/pet_control_sub12.h | 4 +- engines/titanic/pet_control/pet_element.h | 4 +- engines/titanic/pet_control/pet_inventory.h | 2 +- engines/titanic/pet_control/pet_section.h | 2 +- engines/titanic/rect.cpp | 44 --- engines/titanic/rect.h | 61 ---- engines/titanic/screen_manager.cpp | 265 -------------- engines/titanic/screen_manager.h | 248 ------------- engines/titanic/simple_file.cpp | 385 --------------------- engines/titanic/simple_file.h | 236 ------------- engines/titanic/sound/sound.h | 2 +- engines/titanic/sound/sound_manager.h | 2 +- engines/titanic/star_control/star_control.cpp | 2 +- .../titanic/star_control/star_control_sub11.cpp | 2 +- engines/titanic/star_control/star_control_sub11.h | 2 +- engines/titanic/star_control/star_control_sub12.h | 2 +- engines/titanic/star_control/star_control_sub13.h | 2 +- engines/titanic/star_control/star_control_sub14.h | 2 +- engines/titanic/star_control/star_control_sub15.h | 2 +- engines/titanic/star_control/star_control_sub3.h | 2 +- engines/titanic/star_control/star_control_sub8.h | 2 +- engines/titanic/string.cpp | 122 ------- engines/titanic/string.h | 106 ------ engines/titanic/support/direct_draw.cpp | 109 ++++++ engines/titanic/support/direct_draw.h | 105 ++++++ engines/titanic/support/direct_draw_surface.cpp | 100 ++++++ engines/titanic/support/direct_draw_surface.h | 121 +++++++ engines/titanic/support/files_manager.cpp | 106 ++++++ engines/titanic/support/files_manager.h | 96 +++++ engines/titanic/support/font.cpp | 70 ++++ engines/titanic/support/font.h | 64 ++++ engines/titanic/support/image.cpp | 121 +++++++ engines/titanic/support/image.h | 82 +++++ engines/titanic/support/image_decoders.cpp | 79 +++++ engines/titanic/support/image_decoders.h | 52 +++ engines/titanic/support/mouse_cursor.cpp | 113 ++++++ engines/titanic/support/mouse_cursor.h | 97 ++++++ engines/titanic/support/movie.cpp | 114 ++++++ engines/titanic/support/movie.h | 95 +++++ engines/titanic/support/rect.cpp | 44 +++ engines/titanic/support/rect.h | 61 ++++ engines/titanic/support/screen_manager.cpp | 265 ++++++++++++++ engines/titanic/support/screen_manager.h | 248 +++++++++++++ engines/titanic/support/simple_file.cpp | 385 +++++++++++++++++++++ engines/titanic/support/simple_file.h | 236 +++++++++++++ engines/titanic/support/string.cpp | 122 +++++++ engines/titanic/support/string.h | 106 ++++++ engines/titanic/support/text_cursor.cpp | 36 ++ engines/titanic/support/text_cursor.h | 42 +++ engines/titanic/support/video_surface.cpp | 376 ++++++++++++++++++++ engines/titanic/support/video_surface.h | 306 ++++++++++++++++ engines/titanic/text_cursor.cpp | 36 -- engines/titanic/text_cursor.h | 42 --- engines/titanic/titanic.h | 8 +- engines/titanic/true_talk/true_talk_manager.h | 2 +- engines/titanic/true_talk/tt_named_script.h | 2 +- engines/titanic/true_talk/tt_string.h | 2 +- engines/titanic/video_surface.cpp | 376 -------------------- engines/titanic/video_surface.h | 306 ---------------- 99 files changed, 3817 insertions(+), 3818 deletions(-) delete mode 100644 engines/titanic/direct_draw.cpp delete mode 100644 engines/titanic/direct_draw.h delete mode 100644 engines/titanic/direct_draw_surface.cpp delete mode 100644 engines/titanic/direct_draw_surface.h delete mode 100644 engines/titanic/files_manager.cpp delete mode 100644 engines/titanic/files_manager.h delete mode 100644 engines/titanic/font.cpp delete mode 100644 engines/titanic/font.h delete mode 100644 engines/titanic/image.cpp delete mode 100644 engines/titanic/image.h delete mode 100644 engines/titanic/image_decoders.cpp delete mode 100644 engines/titanic/image_decoders.h delete mode 100644 engines/titanic/mouse_cursor.cpp delete mode 100644 engines/titanic/mouse_cursor.h delete mode 100644 engines/titanic/movie.cpp delete mode 100644 engines/titanic/movie.h delete mode 100644 engines/titanic/rect.cpp delete mode 100644 engines/titanic/rect.h delete mode 100644 engines/titanic/screen_manager.cpp delete mode 100644 engines/titanic/screen_manager.h delete mode 100644 engines/titanic/simple_file.cpp delete mode 100644 engines/titanic/simple_file.h delete mode 100644 engines/titanic/string.cpp delete mode 100644 engines/titanic/string.h create mode 100644 engines/titanic/support/direct_draw.cpp create mode 100644 engines/titanic/support/direct_draw.h create mode 100644 engines/titanic/support/direct_draw_surface.cpp create mode 100644 engines/titanic/support/direct_draw_surface.h create mode 100644 engines/titanic/support/files_manager.cpp create mode 100644 engines/titanic/support/files_manager.h create mode 100644 engines/titanic/support/font.cpp create mode 100644 engines/titanic/support/font.h create mode 100644 engines/titanic/support/image.cpp create mode 100644 engines/titanic/support/image.h create mode 100644 engines/titanic/support/image_decoders.cpp create mode 100644 engines/titanic/support/image_decoders.h create mode 100644 engines/titanic/support/mouse_cursor.cpp create mode 100644 engines/titanic/support/mouse_cursor.h create mode 100644 engines/titanic/support/movie.cpp create mode 100644 engines/titanic/support/movie.h create mode 100644 engines/titanic/support/rect.cpp create mode 100644 engines/titanic/support/rect.h create mode 100644 engines/titanic/support/screen_manager.cpp create mode 100644 engines/titanic/support/screen_manager.h create mode 100644 engines/titanic/support/simple_file.cpp create mode 100644 engines/titanic/support/simple_file.h create mode 100644 engines/titanic/support/string.cpp create mode 100644 engines/titanic/support/string.h create mode 100644 engines/titanic/support/text_cursor.cpp create mode 100644 engines/titanic/support/text_cursor.h create mode 100644 engines/titanic/support/video_surface.cpp create mode 100644 engines/titanic/support/video_surface.h delete mode 100644 engines/titanic/text_cursor.cpp delete mode 100644 engines/titanic/text_cursor.h delete mode 100644 engines/titanic/video_surface.cpp delete mode 100644 engines/titanic/video_surface.h diff --git a/engines/titanic/core/file_item.h b/engines/titanic/core/file_item.h index 65dbf9d526..34ba0ae683 100644 --- a/engines/titanic/core/file_item.h +++ b/engines/titanic/core/file_item.h @@ -23,7 +23,7 @@ #ifndef TITANIC_FILE_ITEM_H #define TITANIC_FILE_ITEM_H -#include "titanic/string.h" +#include "titanic/support/string.h" #include "titanic/core/list.h" #include "titanic/core/tree_item.h" diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index ee7e071423..26b78247ba 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -20,11 +20,11 @@ * */ -#include "titanic/files_manager.h" +#include "titanic/support/files_manager.h" #include "titanic/game_manager.h" -#include "titanic/screen_manager.h" +#include "titanic/support/screen_manager.h" #include "titanic/titanic.h" -#include "titanic/video_surface.h" +#include "titanic/support/video_surface.h" #include "titanic/core/game_object.h" #include "titanic/core/resource_key.h" #include "titanic/pet_control/pet_control.h" diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index b221a7ed23..d8d3a0be64 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -23,8 +23,8 @@ #ifndef TITANIC_GAME_OBJECT_H #define TITANIC_GAME_OBJECT_H -#include "titanic/mouse_cursor.h" -#include "titanic/rect.h" +#include "titanic/support/mouse_cursor.h" +#include "titanic/support/rect.h" #include "titanic/core/movie_clip.h" #include "titanic/core/named_item.h" #include "titanic/pet_control/pet_section.h" diff --git a/engines/titanic/core/link_item.h b/engines/titanic/core/link_item.h index 83b2ce4f06..72829720d7 100644 --- a/engines/titanic/core/link_item.h +++ b/engines/titanic/core/link_item.h @@ -23,7 +23,7 @@ #ifndef TITANIC_LINK_ITEM_H #define TITANIC_LINK_ITEM_H -#include "titanic/mouse_cursor.h" +#include "titanic/support/mouse_cursor.h" #include "titanic/core/named_item.h" #include "titanic/core/movie_clip.h" diff --git a/engines/titanic/core/list.h b/engines/titanic/core/list.h index 63bd6227b9..1905c0ffa8 100644 --- a/engines/titanic/core/list.h +++ b/engines/titanic/core/list.h @@ -25,7 +25,7 @@ #include "common/scummsys.h" #include "common/list.h" -#include "titanic/simple_file.h" +#include "titanic/support/simple_file.h" #include "titanic/core/saveable_object.h" namespace Titanic { diff --git a/engines/titanic/core/project_item.h b/engines/titanic/core/project_item.h index ef7ccb65f9..0807460852 100644 --- a/engines/titanic/core/project_item.h +++ b/engines/titanic/core/project_item.h @@ -24,7 +24,7 @@ #define TITANIC_PROJECT_ITEM_H #include "common/scummsys.h" -#include "titanic/simple_file.h" +#include "titanic/support/simple_file.h" #include "titanic/core/dont_save_file_item.h" #include "titanic/core/file_item.h" #include "titanic/core/list.h" diff --git a/engines/titanic/core/resource_key.cpp b/engines/titanic/core/resource_key.cpp index 089df9856a..537dd432f0 100644 --- a/engines/titanic/core/resource_key.cpp +++ b/engines/titanic/core/resource_key.cpp @@ -22,7 +22,7 @@ #include "common/file.h" #include "titanic/titanic.h" -#include "titanic/simple_file.h" +#include "titanic/support/simple_file.h" #include "titanic/core/resource_key.h" namespace Titanic { diff --git a/engines/titanic/core/resource_key.h b/engines/titanic/core/resource_key.h index ab49cb8b12..8a6f86f193 100644 --- a/engines/titanic/core/resource_key.h +++ b/engines/titanic/core/resource_key.h @@ -23,7 +23,7 @@ #ifndef TITANIC_RESOURCE_KEY_H #define TITANIC_RESOURCE_KEY_H -#include "titanic/string.h" +#include "titanic/support/string.h" #include "titanic/core/saveable_object.h" namespace Titanic { diff --git a/engines/titanic/core/room_item.h b/engines/titanic/core/room_item.h index 9e7f553407..f14c3ae32b 100644 --- a/engines/titanic/core/room_item.h +++ b/engines/titanic/core/room_item.h @@ -23,7 +23,7 @@ #ifndef TITANIC_ROOM_ITEM_H #define TITANIC_ROOM_ITEM_H -#include "titanic/rect.h" +#include "titanic/support/rect.h" #include "titanic/core/list.h" #include "titanic/core/movie_clip.h" #include "titanic/core/named_item.h" diff --git a/engines/titanic/core/saveable_object.h b/engines/titanic/core/saveable_object.h index 5a6e4c999d..e067df2b99 100644 --- a/engines/titanic/core/saveable_object.h +++ b/engines/titanic/core/saveable_object.h @@ -27,7 +27,7 @@ #include "common/array.h" #include "common/hash-str.h" #include "common/list.h" -#include "titanic/simple_file.h" +#include "titanic/support/simple_file.h" namespace Titanic { diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index b0e30f5072..666d7e7105 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -21,7 +21,7 @@ */ #include "titanic/game_manager.h" -#include "titanic/screen_manager.h" +#include "titanic/support/screen_manager.h" #include "titanic/core/project_item.h" #include "titanic/core/room_item.h" #include "titanic/core/view_item.h" diff --git a/engines/titanic/direct_draw.cpp b/engines/titanic/direct_draw.cpp deleted file mode 100644 index 1c19911068..0000000000 --- a/engines/titanic/direct_draw.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* 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/debug.h" -#include "engines/util.h" -#include "graphics/pixelformat.h" -#include "titanic/titanic.h" -#include "titanic/direct_draw.h" - -namespace Titanic { - -DirectDraw::DirectDraw(TitanicEngine *vm) : _vm(vm), - _windowed(false), _fieldC(0), _width(0), _height(0), - _bpp(0), _numBackSurfaces(0), _field24(0) { -} - -void DirectDraw::setDisplayMode(int width, int height, int bpp, int refreshRate) { - debugC(ERROR_BASIC, kDebugGraphics, "DirectDraw::SetDisplayMode (%d x %d), %d bpp", - width, height, bpp); - assert(bpp == 16); - - Graphics::PixelFormat pixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); - initGraphics(width, height, true, &pixelFormat); -} - -void DirectDraw::diagnostics() { - debugC(ERROR_BASIC, kDebugGraphics, "Running DirectDraw Diagnostic..."); -} - -DirectDrawSurface *DirectDraw::createSurfaceFromDesc(const DDSurfaceDesc &desc) { - DirectDrawSurface *surface = new DirectDrawSurface(); - surface->create(desc._w, desc._h); - - return surface; -} - -/*------------------------------------------------------------------------*/ - -DirectDrawManager::DirectDrawManager(TitanicEngine *vm, bool windowed) : _directDraw(vm) { - _mainSurface = nullptr; - _backSurfaces[0] = _backSurfaces[1] = nullptr; - _directDraw._windowed = windowed; -} - -void DirectDrawManager::initVideo(int width, int height, int bpp, int numBackSurfaces) { - debugC(ERROR_BASIC, kDebugGraphics, "Initialising video surfaces"); - _directDraw._width = width; - _directDraw._numBackSurfaces = numBackSurfaces; - _directDraw._height = height; - _directDraw._bpp = bpp; - - if (_directDraw._windowed) { - initWindowed(); - } else { - initFullScreen(); - } -} - -void DirectDrawManager::setResolution() { - // TODO -} - -void DirectDrawManager::proc2() { - -} - -void DirectDrawManager::proc3() { - -} - -void DirectDrawManager::initFullScreen() { - debugC(ERROR_BASIC, kDebugGraphics, "Creating surfaces"); - _directDraw.setDisplayMode(_directDraw._width, _directDraw._height, - _directDraw._bpp, 0); - - _mainSurface = new DirectDrawSurface(); - _mainSurface->create(g_vm->_screen); - _backSurfaces[0] = new DirectDrawSurface(); - _backSurfaces[0]->create(_directDraw._width, _directDraw._height); -} - -DirectDrawSurface *DirectDrawManager::createSurface(int w, int h, int surfaceNum) { - if (surfaceNum) - return nullptr; - - assert(_mainSurface); - return _directDraw.createSurfaceFromDesc(DDSurfaceDesc(w, h)); -} - -} // End of namespace Titanic diff --git a/engines/titanic/direct_draw.h b/engines/titanic/direct_draw.h deleted file mode 100644 index cf21c98095..0000000000 --- a/engines/titanic/direct_draw.h +++ /dev/null @@ -1,105 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_DIRECT_DRAW_H -#define TITANIC_DIRECT_DRAW_H - -#include "common/scummsys.h" -#include "common/array.h" -#include "titanic/direct_draw_surface.h" - -namespace Titanic { - -class TitanicEngine; - -class DirectDraw { -private: - TitanicEngine *_vm; -public: - bool _windowed; - int _fieldC; - int _width; - int _height; - int _bpp; - int _numBackSurfaces; - int _field24; -public: - DirectDraw(TitanicEngine *vm); - - /** - * Sets a new display mode - */ - void setDisplayMode(int width, int height, int bpp, int refreshRate); - - /** - * Logs diagnostic information - */ - void diagnostics(); - - /** - * Create a surface from a passed description record - */ - DirectDrawSurface *createSurfaceFromDesc(const DDSurfaceDesc &desc); -}; - -class DirectDrawManager { -public: - DirectDraw _directDraw; - DirectDrawSurface *_mainSurface; - DirectDrawSurface *_backSurfaces[2]; -public: - DirectDrawManager(TitanicEngine *vm, bool windowed); - - /** - * Initializes video surfaces - * @param width Screen width - * @param height Screen height - * @param bpp Bits per pixel - * @param numBackSurfaces Number of back surfaces - */ - void initVideo(int width, int height, int bpp, int numBackSurfaces); - - void setResolution(); - - void proc2(); - - void proc3(); - - /** - * Initializes the surfaces in windowed mode - */ - void initWindowed() { initFullScreen(); } - - /** - * Initializes the surfaces for the screen - */ - void initFullScreen(); - - /** - * Create a surface - */ - DirectDrawSurface *createSurface(int w, int h, int surfaceNum); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_DIRECT_DRAW_H */ diff --git a/engines/titanic/direct_draw_surface.cpp b/engines/titanic/direct_draw_surface.cpp deleted file mode 100644 index 05fe68a347..0000000000 --- a/engines/titanic/direct_draw_surface.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* 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/rect.h" -#include "titanic/direct_draw_surface.h" - -namespace Titanic { - -DirectDrawSurface::DirectDrawSurface() : _surface(nullptr), - _disposeAfterUse(DisposeAfterUse::YES) { -} - -DirectDrawSurface::~DirectDrawSurface() { - free(); -} - -void DirectDrawSurface::create(Graphics::ManagedSurface *surface) { - free(); - _surface = surface; - _disposeAfterUse = DisposeAfterUse::NO; -} - -void DirectDrawSurface::create(int w, int h) { - Graphics::PixelFormat pixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); - _surface = new Graphics::ManagedSurface(w, h, pixelFormat); - _disposeAfterUse = DisposeAfterUse::YES; -} - -void DirectDrawSurface::free() { - if (_disposeAfterUse == DisposeAfterUse::YES) - delete _surface; - _surface = nullptr; - _disposeAfterUse = DisposeAfterUse::NO; -} - -Graphics::ManagedSurface *DirectDrawSurface::lock(const Rect *bounds, int flags) { - assert(!_surface->empty()); - return _surface; -} - -void DirectDrawSurface::unlock() { - assert(_surface->w != 0 && _surface->h != 0); -} - -void DirectDrawSurface::fill(const Rect *bounds, uint32 color) { - Rect tempBounds; - - assert(_surface); - if (bounds) { - // Bounds are provided, clip them to the bounds of this surface - tempBounds = *bounds; - tempBounds.clip(Rect(0, 0, _surface->w, _surface->h)); - } else { - // No bounds provided, so use the entire surface - tempBounds = Rect(0, 0, _surface->w, _surface->h); - } - - // Fill the area - _surface->fillRect(tempBounds, color); -} - -void DirectDrawSurface::fillRect(Rect *rect, byte r, byte g, byte b) { - uint color = _surface->format.RGBToColor(r, g, b); - Rect tempRect = rect ? *rect : Rect(0, 0, getWidth(), getHeight()); - - _surface->fillRect(tempRect, color); -} - -void DirectDrawSurface::blit(const Rect &destRect, DirectDrawSurface *srcSurface, Rect &srcRect) { - assert(srcSurface); - if (!destRect.isEmpty()) - _surface->transBlitFrom(*srcSurface->_surface, srcRect, destRect, (uint)-1); -} - -void DirectDrawSurface::blit(const Point &destPos, DirectDrawSurface *srcSurface, Rect *bounds) { - if (bounds) - _surface->blitFrom(*srcSurface->_surface, *bounds, destPos); - else - _surface->blitFrom(*srcSurface->_surface, destPos); -} - -} // End of namespace Titanic diff --git a/engines/titanic/direct_draw_surface.h b/engines/titanic/direct_draw_surface.h deleted file mode 100644 index 28ff6a8ae6..0000000000 --- a/engines/titanic/direct_draw_surface.h +++ /dev/null @@ -1,121 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_DIRECT_DRAW_SURFACE_H -#define TITANIC_DIRECT_DRAW_SURFACE_H - -#include "common/scummsys.h" -#include "common/array.h" -#include "graphics/managed_surface.h" -#include "titanic/rect.h" - -namespace Titanic { - -class TitanicEngine; - -struct DDSurfaceDesc { - int _w; - int _h; - int _flags; - int _caps; - - DDSurfaceDesc(int w, int h) : _w(w), _h(h), _flags(0x1006), _caps(64) {} -}; - -class DirectDrawSurface { -private: - Graphics::ManagedSurface *_surface; - DisposeAfterUse::Flag _disposeAfterUse; -public: - DirectDrawSurface(); - ~DirectDrawSurface(); - - /** - * Create a surface - */ - void create(int w, int h); - - /** - * Create a surface based on a passed surface - */ - void create(Graphics::ManagedSurface *surface); - - /** - * Frees the surface - */ - void free(); - - /** - * Return the size of the surface in ytes - */ - int getSize() const { return _surface->pitch * _surface->h; } - - /** - * Return the surface width - */ - int getWidth() const { return _surface->w; } - - /** - * Return the surface width - */ - int getHeight() const { return _surface->h; } - - /** - * Return the surface pitch - */ - int getPitch() const { return _surface->pitch; } - - /** - * Lock the surface for access - */ - Graphics::ManagedSurface *lock(const Rect *bounds, int flags); - - /** - * Unlocks the surface at the end of direct accesses - */ - void unlock(); - - /** - * Fills an area of the surfae with the specified color. If no bounds are passed, - * then the entire surface is filled - */ - void fill(const Rect *bounds, uint32 color); - - /** - * Fill an area with a specific color - */ - void fillRect(Rect *rect, byte r, byte g, byte b); - - /** - * Copy data from a source surfcae into this one - */ - void blit(const Rect &destRect, DirectDrawSurface *srcSurface, Rect &srcRect); - - /** - * Copy data from a source surfcae into this one - */ - void blit(const Point &destPos, DirectDrawSurface *srcSurface, Rect *bounds); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_DIRECT_DRAW_SURFACE_H */ diff --git a/engines/titanic/files_manager.cpp b/engines/titanic/files_manager.cpp deleted file mode 100644 index 10898909e2..0000000000 --- a/engines/titanic/files_manager.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* 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/file.h" -#include "titanic/files_manager.h" -#include "titanic/game_manager.h" - -namespace Titanic { - -CFilesManager::CFilesManager() : _gameManager(nullptr), - _assetsPath("Assets"), _exeResources(nullptr), _field0(0), - _drive(-1), _field18(0), _field1C(0), _field3C(0) { -} - -CFilesManager::~CFilesManager() { - delete _exeResources; -} - -bool CFilesManager::fileExists(const CString &name) { - Common::File f; - return f.exists(name); -} - -bool CFilesManager::scanForFile(const CString &name) { - if (name.empty()) - return false; - - CString filename = name; - filename.toLowercase(); - - if (filename[0] == 'y' || filename[0] == 'z') - return true; - else if (filename[0] < 'a' || filename[0] > 'c') - return false; - - CString fname = filename; - int idx = fname.indexOf('#'); - if (idx >= 0) { - fname = fname.left(idx); - fname += ".st"; - } - - if (_gameManager) - _gameManager->viewChange(); - - // The original had a bunch of code here handling determining - // which asset path, if any, the filename was present for, - // and storing the "active asset path" it was found on. - // This is redundant for ScummVM, which takes care of the paths - return fileExists(fname); -} - -void CFilesManager::loadDrive() { - assert(_drive == -1); - resetView(); -} - -void CFilesManager::debug(CScreenManager *screenManager) { - warning("TODO: CFilesManager::debug"); -} - -void CFilesManager::resetView() { - if (_gameManager) { - _gameManager->_gameState.setMode(GSMODE_SELECTED); - _gameManager->initBounds(); - } -} - -void CFilesManager::fn4(const CString &name) { - warning("TODO: CFilesManager::fn4"); -} - -void CFilesManager::fn5(const CString &name) { - warning("TODO: CFilesManager::fn5"); -} - -Common::SeekableReadStream *CFilesManager::getResource(const CString &name, - const CString &area) { - if (!_exeResources) { - _exeResources = new Common::NEResources(); - _exeResources->loadFromEXE("st.exe"); - } - - return nullptr; -} - -} // End of namespace Titanic diff --git a/engines/titanic/files_manager.h b/engines/titanic/files_manager.h deleted file mode 100644 index 6c6b54445d..0000000000 --- a/engines/titanic/files_manager.h +++ /dev/null @@ -1,96 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_FILES_MANAGER_H -#define TITANIC_FILES_MANAGER_H - -#include "common/winexe_ne.h" -#include "titanic/core/list.h" -#include "titanic/screen_manager.h" - -namespace Titanic { - -class CGameManager; - -class CFilesManagerList : public List { -}; - -class CFilesManager { -private: - CGameManager *_gameManager; - Common::NEResources *_exeResources; - CFilesManagerList _list; - CString _string1; - CString _string2; - int _field0; - int _drive; - int _field18; - int _field1C; - int _field3C; - const CString _assetsPath; -public: - CFilesManager(); - ~CFilesManager(); - - /** - * Sets the game manager - */ - void setGameManager(CGameManager *gameManager) { - _gameManager = gameManager; - } - - /** - * Returns true if a file of the given name exists - */ - static bool fileExists(const CString &name); - - /** - * Scans for a file with a matching name - */ - bool scanForFile(const CString &name); - - /** - * Handles displaying a load drive view if necessary - */ - void loadDrive(); - - void debug(CScreenManager *screenManager); - - /** - * Resets the view being displayed - */ - void resetView(); - - void fn4(const CString &name); - - void fn5(const CString &name); - - /** - * Get a resource from the executable - */ - Common::SeekableReadStream *getResource(const CString &name, - const CString &area); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_FILES_MANAGER_H */ diff --git a/engines/titanic/font.cpp b/engines/titanic/font.cpp deleted file mode 100644 index fd6bd54401..0000000000 --- a/engines/titanic/font.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* 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/textconsole.h" -#include "titanic/font.h" -#include "titanic/files_manager.h" -#include "titanic/titanic.h" - -namespace Titanic { - -STFont::STFont() { - _dataPtr = nullptr; - _dataSize = 0; - _field8 = 0; - _maxCharWidth = 0; - _field810 = 0; - _field814 = 0; - _field818 = 0; -} - -STFont::~STFont() { - delete[] _dataPtr; -} - -void STFont::load(int fontNumber) { - assert(!_dataPtr); - CString fontNumStr = CString::format("%d", fontNumber); - Common::SeekableReadStream *stream = g_vm->_filesManager.getResource( - fontNumStr, "STFont"); - if (!stream) - return; - - _field8 = stream->readUint32LE(); - _maxCharWidth = stream->readUint32LE(); - for (uint idx = 0; idx < 256; ++idx) - _chars[idx]._charWidth = stream->readUint32LE(); - for (uint idx = 0; idx < 256; ++idx) - _chars[idx]._offset = stream->readUint32LE(); - - _dataSize = stream->readUint32LE(); - _dataPtr = new byte[_dataSize]; - stream->read(_dataPtr, _dataSize); - - delete stream; -} - -void STFont::writeString(int maxWidth, const CString &text, int *v1, int *v2) { - warning("TODO: STFont::writeString"); -} - -} // End of namespace Titanic diff --git a/engines/titanic/font.h b/engines/titanic/font.h deleted file mode 100644 index 20b960277d..0000000000 --- a/engines/titanic/font.h +++ /dev/null @@ -1,64 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_FONT_H -#define TITANIC_FONT_H - -#include "common/scummsys.h" -#include "common/array.h" -#include "titanic/string.h" - -namespace Titanic { - -class STFont { - struct CharEntry { - uint _charWidth; - uint _offset; - }; -public: - byte *_dataPtr; - size_t _dataSize; - int _field8; - int _maxCharWidth; - Common::Array _chars; - int _field810; - int _field814; - int _field818; -public: - STFont(); - ~STFont(); - - /** - * Load a specified font - */ - void load(int fontNumber); - - /** - * Write out a string - * TODO: Verify this - */ - void writeString(int maxWidth, const CString &text, int *v1, int *v2); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_FONT_H */ diff --git a/engines/titanic/game_location.h b/engines/titanic/game_location.h index a64a82403b..f145d36340 100644 --- a/engines/titanic/game_location.h +++ b/engines/titanic/game_location.h @@ -23,7 +23,7 @@ #ifndef TITANIC_GAME_LOCATION_H #define TITANIC_GAME_LOCATION_H -#include "titanic/simple_file.h" +#include "titanic/support/simple_file.h" #include "titanic/core/node_item.h" #include "titanic/core/room_item.h" #include "titanic/core/view_item.h" diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index d5547a3ab7..b6eac3eb82 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -23,7 +23,7 @@ #include "titanic/titanic.h" #include "titanic/game_manager.h" #include "titanic/game_view.h" -#include "titanic/screen_manager.h" +#include "titanic/support/screen_manager.h" #include "titanic/core/project_item.h" #include "titanic/messages/messages.h" #include "titanic/pet_control/pet_control.h" diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index 6ad0843e96..b8f5d02463 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -27,8 +27,8 @@ #include "titanic/game_state.h" #include "titanic/input_handler.h" #include "titanic/input_translator.h" -#include "titanic/simple_file.h" -#include "titanic/video_surface.h" +#include "titanic/support/simple_file.h" +#include "titanic/support/video_surface.h" #include "titanic/true_talk/true_talk_manager.h" #include "titanic/sound/background_sound_maker.h" #include "titanic/sound/music_room.h" diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index cef8ed9abb..280c917139 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -23,7 +23,7 @@ #include "titanic/game_state.h" #include "titanic/titanic.h" #include "titanic/game_manager.h" -#include "titanic/screen_manager.h" +#include "titanic/support/screen_manager.h" namespace Titanic { diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h index ec6ef44422..5a53d217da 100644 --- a/engines/titanic/game_state.h +++ b/engines/titanic/game_state.h @@ -25,9 +25,9 @@ #include "titanic/core/list.h" #include "titanic/core/link_item.h" -#include "titanic/simple_file.h" +#include "titanic/support/simple_file.h" #include "titanic/game_location.h" -#include "titanic/movie.h" +#include "titanic/support/movie.h" namespace Titanic { diff --git a/engines/titanic/game_view.cpp b/engines/titanic/game_view.cpp index 22da0c46bf..2f0e74ac08 100644 --- a/engines/titanic/game_view.cpp +++ b/engines/titanic/game_view.cpp @@ -23,7 +23,7 @@ #include "titanic/game_view.h" #include "titanic/game_manager.h" #include "titanic/main_game_window.h" -#include "titanic/screen_manager.h" +#include "titanic/support/screen_manager.h" namespace Titanic { diff --git a/engines/titanic/game_view.h b/engines/titanic/game_view.h index c1d1a001d3..0bba5cfa86 100644 --- a/engines/titanic/game_view.h +++ b/engines/titanic/game_view.h @@ -25,7 +25,7 @@ #include "common/scummsys.h" #include "titanic/core/view_item.h" -#include "titanic/video_surface.h" +#include "titanic/support/video_surface.h" namespace Titanic { diff --git a/engines/titanic/image.cpp b/engines/titanic/image.cpp deleted file mode 100644 index 0a130419a1..0000000000 --- a/engines/titanic/image.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* 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/file.h" -#include "titanic/image.h" - -namespace Titanic { - -BITMAPINFOHEADER::BITMAPINFOHEADER() { - _biSize = 0; - _biWidth = 0; - _biHeight = 0; - _biPlanes = 0; - _biBitCount = 0; - _biCompression = 0; - _biSizeImage = 0; - _biXPelsPerMeter = 0; - _biYPelsPerMeter = 0; - _biClrUsed = 0; - _biClrImportant = 0; -} - -/*------------------------------------------------------------------------*/ - -RGBQuad::RGBQuad() : _rgbRed(0), _rgbGreen(0), _rgbBlue(0), _rgbReserved(0) {} - -/*------------------------------------------------------------------------*/ - -Image::Image() { - _bitmapInfo = nullptr; - _bits = nullptr; - _flag = true; - - set(16, 16); -} - -void Image::proc6() { - -} - -void Image::set(int width, int height) { - delete _bitmapInfo; - if (_flag && _bitmapInfo) - delete[] _bits; - - _bitmapInfo = new tagBITMAPINFO; - _bits = new byte[(width + 3) & 0xFFFC * height]; - - tagBITMAPINFO &bi = *_bitmapInfo; - bi._bmiHeader._biWidth = width; - bi._bmiHeader._biHeight = height; - bi._bmiHeader._biPlanes = 1; - bi._bmiHeader._biBitCount = 8; -} - -void Image::proc8() { - -} - -bool Image::loadResource(const Common::String &name) { - // This method is hardcoded for the Titanic splash screen resource - assert(name == "TITANIC"); - - Common::File f; - if (!f.open("ST.exe")) - return false; - - // The ST.exe executable has a bitmap called "TITANIC". Since we can't use - // the Windows FindResource function in ScummVM, this is hardcoded for now - f.seek(0x29B660); - uint size = f.readUint32LE(); - if (size != 40) - return false; - - loadBitmap(f); - - return true; -} - -void Image::proc10() { - -} - -void Image::draw() { - -} - -void Image::loadBitmap(Common::SeekableReadStream &s) { - _bitmapInfo->_bmiHeader._biWidth = s.readUint32LE(); - _bitmapInfo->_bmiHeader._biHeight = s.readUint32LE(); - _bitmapInfo->_bmiHeader._biPlanes = s.readUint16LE(); - _bitmapInfo->_bmiHeader._biBitCount = s.readUint16LE(); - _bitmapInfo->_bmiHeader._biCompression = s.readUint32LE(); - _bitmapInfo->_bmiHeader._biSizeImage = s.readUint32LE(); - _bitmapInfo->_bmiHeader._biXPelsPerMeter = s.readUint32LE(); - _bitmapInfo->_bmiHeader._biYPelsPerMeter = s.readUint32LE(); - _bitmapInfo->_bmiHeader._biClrUsed = s.readUint32LE(); - _bitmapInfo->_bmiHeader._biClrImportant = s.readUint32LE(); - -} - -} // End of namespace Titanic diff --git a/engines/titanic/image.h b/engines/titanic/image.h deleted file mode 100644 index 9030e81ad7..0000000000 --- a/engines/titanic/image.h +++ /dev/null @@ -1,82 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_IMAGE_H -#define TITANIC_IMAGE_H - -#include "common/scummsys.h" -#include "common/array.h" - -namespace Titanic { - -struct BITMAPINFOHEADER { - int _biSize; - int _biWidth; - int _biHeight; - int _biPlanes; - int _biBitCount; - int _biCompression; - int _biSizeImage; - int _biXPelsPerMeter; - int _biYPelsPerMeter; - int _biClrUsed; - int _biClrImportant; - - BITMAPINFOHEADER(); -}; - -struct RGBQuad { - byte _rgbRed; - byte _rgbGreen; - byte _rgbBlue; - byte _rgbReserved; - - RGBQuad(); -}; - -struct tagBITMAPINFO { - BITMAPINFOHEADER _bmiHeader; - RGBQuad _bmiColors[256]; -}; - -class Image { -private: - void loadBitmap(Common::SeekableReadStream &s); -public: - tagBITMAPINFO *_bitmapInfo; - byte *_bits; - bool _flag; -public: - Image(); - virtual ~Image() {} - - virtual void proc6(); - virtual void set(int width, int height); - virtual void proc8(); - virtual bool loadResource(const Common::String &name); - virtual void proc10(); - virtual void draw(); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_IMAGE_H */ diff --git a/engines/titanic/image_decoders.cpp b/engines/titanic/image_decoders.cpp deleted file mode 100644 index 721342ef6d..0000000000 --- a/engines/titanic/image_decoders.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* 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 "titanic/image_decoders.h" - -namespace Titanic { - -void CJPEGDecode::decode(OSVideoSurface &surface, const CString &name) { - // Open up the resource - StdCWadFile file; - file.open(name); - - // Use the ScucmmVM deoder to decode it - loadStream(*file.readStream()); - const Graphics::Surface *srcSurf = getSurface(); - - // Resize the surface if necessary - if (!surface.hasSurface() || surface.getWidth() != srcSurf->w - || surface.getHeight() != srcSurf->h) - surface.resize(srcSurf->w, srcSurf->h); - - // Convert the decoded surface to the correct pixel format, and then copy it over - surface.lock(); - Graphics::Surface *convertedSurface = srcSurf->convertTo(surface._rawSurface->format); - - Common::copy((byte *)convertedSurface->getPixels(), (byte *)convertedSurface->getPixels() + - surface.getPitch() * surface.getHeight(), (byte *)surface._rawSurface->getPixels()); - - delete convertedSurface; - surface.unlock(); -} - -/*------------------------------------------------------------------------*/ - -void CTargaDecode::decode(OSVideoSurface &surface, const CString &name) { - // Open up the resource - StdCWadFile file; - file.open(name); - - // Use the ScucmmVM deoder to decode it - loadStream(*file.readStream()); - const Graphics::Surface *srcSurf = getSurface(); - - // Resize the surface if necessary - if (!surface.hasSurface() || surface.getWidth() != srcSurf->w - || surface.getHeight() != srcSurf->h) - surface.resize(srcSurf->w, srcSurf->h); - - // Convert the decoded surface to the correct pixel format, and then copy it over - surface.lock(); - Graphics::Surface *convertedSurface = srcSurf->convertTo(surface._rawSurface->format); - - Common::copy((byte *)convertedSurface->getPixels(), (byte *)convertedSurface->getPixels() + - surface.getPitch() * surface.getHeight(), (byte *)surface._rawSurface->getPixels()); - - delete convertedSurface; - surface.unlock(); -} - -} // End of namespace Titanic diff --git a/engines/titanic/image_decoders.h b/engines/titanic/image_decoders.h deleted file mode 100644 index d72d6fee5d..0000000000 --- a/engines/titanic/image_decoders.h +++ /dev/null @@ -1,52 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_IMAGE_DECODERS_H -#define TITANIC_IMAGE_DECODERS_H - -#include "image/jpeg.h" -#include "image/tga.h" -#include "titanic/string.h" -#include "titanic/simple_file.h" -#include "titanic/video_surface.h" - -namespace Titanic { - -class CJPEGDecode : public Image::JPEGDecoder { -public: - /** - * Decode the image file onto the passed surface - */ - void decode(OSVideoSurface &surface, const CString &name); -}; - -class CTargaDecode : public Image::TGADecoder { -public: - /** - * Decode the image file onto the passed surface - */ - void decode(OSVideoSurface &surface, const CString &name); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_IMAGE_DECODERS_H */ diff --git a/engines/titanic/input_handler.cpp b/engines/titanic/input_handler.cpp index 8323531a1f..0657ebec94 100644 --- a/engines/titanic/input_handler.cpp +++ b/engines/titanic/input_handler.cpp @@ -22,7 +22,7 @@ #include "titanic/input_handler.h" #include "titanic/game_manager.h" -#include "titanic/screen_manager.h" +#include "titanic/support/screen_manager.h" #include "titanic/titanic.h" #include "titanic/pet_control/pet_control.h" diff --git a/engines/titanic/input_handler.h b/engines/titanic/input_handler.h index 7495082ddf..4e8966fdc4 100644 --- a/engines/titanic/input_handler.h +++ b/engines/titanic/input_handler.h @@ -23,7 +23,7 @@ #ifndef TITANIC_INPUT_HANDLER_H #define TITANIC_INPUT_HANDLER_H -#include "titanic/rect.h" +#include "titanic/support/rect.h" #include "titanic/input_translator.h" #include "titanic/core/tree_item.h" diff --git a/engines/titanic/main_game_window.h b/engines/titanic/main_game_window.h index 42517f5a08..78f01b9d79 100644 --- a/engines/titanic/main_game_window.h +++ b/engines/titanic/main_game_window.h @@ -27,7 +27,7 @@ #include "common/array.h" #include "titanic/game_manager.h" #include "titanic/game_view.h" -#include "titanic/image.h" +#include "titanic/support/image.h" #include "titanic/core/project_item.h" namespace Titanic { diff --git a/engines/titanic/messages/mouse_messages.h b/engines/titanic/messages/mouse_messages.h index 41943818e2..1bc77b6a87 100644 --- a/engines/titanic/messages/mouse_messages.h +++ b/engines/titanic/messages/mouse_messages.h @@ -23,7 +23,7 @@ #ifndef TITANIC_MOUSE_MESSAGES_H #define TITANIC_MOUSE_MESSAGES_H -#include "titanic/rect.h" +#include "titanic/support/rect.h" #include "titanic/messages/messages.h" namespace Titanic { diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 4ab5caf3cd..441de8c1f3 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -3,29 +3,15 @@ MODULE := engines/titanic MODULE_OBJS := \ debugger.o \ detection.o \ - direct_draw.o \ - direct_draw_surface.o \ events.o \ - files_manager.o \ - font.o \ game_location.o \ game_manager.o \ game_state.o \ game_view.o \ - image.o \ - image_decoders.o \ input_handler.o \ input_translator.o \ main_game_window.o \ - mouse_cursor.o \ - movie.o \ - rect.o \ - screen_manager.o \ - simple_file.o \ - string.o \ - text_cursor.o \ titanic.o \ - video_surface.o \ carry/auditory_centre.o \ carry/arm.o \ carry/bowl_ear.o \ @@ -436,6 +422,20 @@ MODULE_OBJS := \ star_control/star_control_sub13.o \ star_control/star_control_sub14.o \ star_control/star_control_sub15.o \ + support/direct_draw.o \ + support/direct_draw_surface.o \ + support/files_manager.o \ + support/font.o \ + support/image.o \ + support/image_decoders.o \ + support/mouse_cursor.o \ + support/movie.o \ + support/rect.o \ + support/screen_manager.o \ + support/simple_file.o \ + support/string.o \ + support/text_cursor.o \ + support/video_surface.o \ true_talk/barbot_script.o \ true_talk/bellbot_script.o \ true_talk/deskbot_script.o \ diff --git a/engines/titanic/mouse_cursor.cpp b/engines/titanic/mouse_cursor.cpp deleted file mode 100644 index 3acd871396..0000000000 --- a/engines/titanic/mouse_cursor.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* 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 "graphics/cursorman.h" -#include "common/textconsole.h" -#include "titanic/mouse_cursor.h" -#include "titanic/movie.h" -#include "titanic/screen_manager.h" -#include "titanic/titanic.h" -#include "titanic/video_surface.h" -#include "titanic/core/resource_key.h" - -namespace Titanic { - -static const int CURSOR_DATA[NUM_CURSORS][4] = { - { 1, 136, 19, 18 }, - { 2, 139, 1, 1 }, - { 3, 140, 32, 1 }, - { 4, 137, 13, 0 }, - { 5, 145, 13, 0 }, - { 6, 144, 13, 22 }, - { 7, 137, 14, 0 }, - { 8, 148, 22, 40 }, - { 9, 136, 19, 18 }, - { 10, 143, 11, 11 }, - { 11, 146, 11, 11 }, - { 12, 136, 19, 18 }, - { 13, 136, 19, 25 }, - { 14, 136, 13, 22 }, - { 15, 138, 20, 28 } -}; - -CMouseCursor::CMouseCursor(CScreenManager *screenManager) : - _screenManager(screenManager), _cursorId(CURSOR_15) { - loadCursorImages(); - setCursor(CURSOR_1); -} - -CMouseCursor::~CMouseCursor() { - for (int idx = 0; idx < NUM_CURSORS; ++idx) - delete _cursors[idx]._videoSurface; -} - -void CMouseCursor::loadCursorImages() { - const CString name("ycursors.avi"); - const CResourceKey key(name); - g_vm->_filesManager.fn4(name); - - // Iterate through each cursor - for (int idx = 0; idx < NUM_CURSORS; ++idx) { - assert(CURSOR_DATA[idx][0] == (idx + 1)); - _cursors[idx]._centroid = Common::Point(CURSOR_DATA[idx][2], - CURSOR_DATA[idx][3]); - - CVideoSurface *surface = _screenManager->createSurface(64, 64); - _cursors[idx]._videoSurface = surface; - - OSMovie movie(key, surface); - movie.setFrame(idx); - _cursors[idx]._ptrUnknown = movie.proc21(); - surface->set40(_cursors[idx]._ptrUnknown); - } -} - -void CMouseCursor::show() { - CursorMan.showMouse(true); -} - -void CMouseCursor::hide() { - CursorMan.showMouse(false); -} - -void CMouseCursor::setCursor(CursorId cursorId) { - if (cursorId != _cursorId) { - CursorEntry &ce = _cursors[cursorId - 1]; - CVideoSurface &surface = *ce._videoSurface; - surface.lock(); - - // ***DEBUG*** Dummy cursor - Common::fill(surface.getPixels(), surface.getPixels() + 128, 0x5555); - - CursorMan.replaceCursor(surface.getPixels(), surface.getWidth(), surface.getHeight(), - ce._centroid.x, ce._centroid.y, 0, false, &g_vm->_screen->format); - surface.unlock(); - - _cursorId = cursorId; - } -} - -void CMouseCursor::update() { - // No implementation needed -} - -} // End of namespace Titanic diff --git a/engines/titanic/mouse_cursor.h b/engines/titanic/mouse_cursor.h deleted file mode 100644 index 507f4ecc17..0000000000 --- a/engines/titanic/mouse_cursor.h +++ /dev/null @@ -1,97 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_MOUSE_CURSOR_H -#define TITANIC_MOUSE_CURSOR_H - -#include "common/scummsys.h" -#include "common/rect.h" - -namespace Titanic { - -#define NUM_CURSORS 15 - -enum CursorId { - CURSOR_1 = 1, - CURSOR_2 = 3, - CURSOR_3 = 3, - CURSOR_4 = 4, - CURSOR_5 = 5, - CURSOR_6 = 6, - CURSOR_7 = 7, - CURSOR_8 = 8, - CURSOR_9 = 9, - CURSOR_10 = 10, - CURSOR_11 = 11, - CURSOR_12 = 12, - CURSOR_13 = 13, - CURSOR_14 = 14, - CURSOR_15 = 15 -}; - -class CScreenManager; -class CVideoSurface; - -class CMouseCursor { - struct CursorEntry { - CVideoSurface *_videoSurface; - void *_ptrUnknown; - Common::Point _centroid; - }; -private: - CScreenManager *_screenManager; - CursorId _cursorId; - CursorEntry _cursors[NUM_CURSORS]; - - /** - * Load the images for each cursor - */ - void loadCursorImages(); -public: - CMouseCursor(CScreenManager *screenManager); - ~CMouseCursor(); - - /** - * Make the mouse cursor visible - */ - void show(); - - /** - * Hide the mouse cursor - */ - void hide(); - - /** - * Set the cursor - */ - void setCursor(CursorId cursorId); - - /** - * Updates the mouse cursor - */ - void update(); -}; - - -} // End of namespace Titanic - -#endif /* TITANIC_MOUSE_CURSOR_H */ diff --git a/engines/titanic/movie.cpp b/engines/titanic/movie.cpp deleted file mode 100644 index 193b2cad33..0000000000 --- a/engines/titanic/movie.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* 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 "titanic/movie.h" -#include "titanic/titanic.h" - -namespace Titanic { - -CMovie::CMovie() : ListItem(), _state(0), _field10(0) { -} - -bool CMovie::isActive() const { - return g_vm->_movieList.contains(this); -} - -bool CMovie::get10() { - if (_field10) { - _field10 = 0; - return true; - } else { - return false; - } -} - -/*------------------------------------------------------------------------*/ - -OSMovie::OSMovie(const CResourceKey &name, CVideoSurface *surface) : _videoSurface(surface) { -// _aviDecoder.loadFile(name.getString()); -} - -void OSMovie::proc8(int v1, CVideoSurface *surface) { - warning("TODO: OSMovie::proc8"); -} - -void OSMovie::proc9() { - warning("TODO: OSMovie::proc9"); -} - -void OSMovie::proc10() { - warning("TODO: OSMovie::proc10"); -} - -void OSMovie::proc11() { - warning("TODO: OSMovie::proc11"); -} - -void OSMovie::proc12() { - warning("TODO: OSMovie::proc12"); -} - -void OSMovie::stop() { - warning("TODO: OSMovie::proc13"); -} - -void OSMovie::proc14() { - warning("TODO: OSMovie::proc14"); -} - -void OSMovie::setFrame(uint frameNumber) { - warning("TODO: OSMovie::setFrame"); - /* - _aviDecoder.seekToFrame(frameNumber); - const Graphics::Surface *s = _aviDecoder.decodeNextFrame(); - - _videoSurface->blitFrom(Common::Point(0, 0), s); - */ -} - -void OSMovie::proc16() { - warning("TODO: OSMovie::proc16"); -} - -void OSMovie::proc17() { - warning("TODO: OSMovie::proc17"); -} - -void OSMovie::proc18() { - warning("TODO: OSMovie::proc18"); -} - -int OSMovie::proc19() { - warning("TODO: OSMovie::proc19"); - return 0; -} - -void OSMovie::proc20() { - warning("TODO: OSMovie::proc20"); -} - -void *OSMovie::proc21() { - warning("TODO: OSMovie::proc21"); - return nullptr; -} - -} // End of namespace Titanic diff --git a/engines/titanic/movie.h b/engines/titanic/movie.h deleted file mode 100644 index 3529409fa5..0000000000 --- a/engines/titanic/movie.h +++ /dev/null @@ -1,95 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_MOVIE_H -#define TITANIC_MOVIE_H - -#include "video/avi_decoder.h" -#include "titanic/core/list.h" -#include "titanic/core/resource_key.h" - -namespace Titanic { - -class CVideoSurface; - -class CMovie : public ListItem { -protected: - int _state; - int _field10; -public: - CMovie(); - - virtual void proc8(int v1, CVideoSurface *surface) = 0; - virtual void proc9() = 0; - virtual void proc10() = 0; - virtual void proc11() = 0; - virtual void proc12() = 0; - virtual void stop() = 0; - virtual void proc14() = 0; - virtual void setFrame(uint frameNumber) = 0; - virtual void proc16() = 0; - virtual void proc17() = 0; - virtual void proc18() = 0; - virtual int proc19() = 0; - virtual void proc20() = 0; - virtual void *proc21() = 0; - - bool isActive() const; - - bool get10(); -}; - -class OSMovie : public CMovie { -private: - Video::AVIDecoder _aviDecoder; - CVideoSurface *_videoSurface; -public: - OSMovie(const CResourceKey &name, CVideoSurface *surface); - - virtual void proc8(int v1, CVideoSurface *surface); - virtual void proc9(); - virtual void proc10(); - virtual void proc11(); - virtual void proc12(); - virtual void stop(); - virtual void proc14(); - - /** - * Set the current frame number - */ - virtual void setFrame(uint frameNumber); - - virtual void proc16(); - virtual void proc17(); - virtual void proc18(); - virtual int proc19(); - virtual void proc20(); - virtual void *proc21(); -}; - -class CGlobalMovies : public List { -public: -}; - -} // End of namespace Titanic - -#endif /* TITANIC_MOVIE_H */ diff --git a/engines/titanic/pet_control/pet_control_sub10.h b/engines/titanic/pet_control/pet_control_sub10.h index aabb59638e..ef8d02f95c 100644 --- a/engines/titanic/pet_control/pet_control_sub10.h +++ b/engines/titanic/pet_control/pet_control_sub10.h @@ -26,7 +26,7 @@ #include "titanic/core/list.h" #include "titanic/pet_control/pet_control_sub10.h" #include "titanic/pet_control/pet_control_list_item.h" -#include "titanic/screen_manager.h" +#include "titanic/support/screen_manager.h" namespace Titanic { diff --git a/engines/titanic/pet_control/pet_control_sub12.h b/engines/titanic/pet_control/pet_control_sub12.h index 88faf3d074..70010f0bd9 100644 --- a/engines/titanic/pet_control/pet_control_sub12.h +++ b/engines/titanic/pet_control/pet_control_sub12.h @@ -23,8 +23,8 @@ #ifndef TITANIC_PET_CONTROL_SUB12_H #define TITANIC_PET_CONTROL_SUB12_H -#include "titanic/simple_file.h" -#include "titanic/screen_manager.h" +#include "titanic/support/simple_file.h" +#include "titanic/support/screen_manager.h" namespace Titanic { diff --git a/engines/titanic/pet_control/pet_element.h b/engines/titanic/pet_control/pet_element.h index 13f209cefa..2d56b57c66 100644 --- a/engines/titanic/pet_control/pet_element.h +++ b/engines/titanic/pet_control/pet_element.h @@ -23,8 +23,8 @@ #ifndef TITANIC_PET_ELEMENT_H #define TITANIC_PET_ELEMENT_H -#include "titanic/simple_file.h" -#include "titanic/string.h" +#include "titanic/support/simple_file.h" +#include "titanic/support/string.h" #include "titanic/core/link_item.h" #include "titanic/messages/mouse_messages.h" diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h index 3f1d26d796..01f9ebb8d3 100644 --- a/engines/titanic/pet_control/pet_inventory.h +++ b/engines/titanic/pet_control/pet_inventory.h @@ -23,7 +23,7 @@ #ifndef TITANIC_PET_INVENTORY_H #define TITANIC_PET_INVENTORY_H -#include "titanic/simple_file.h" +#include "titanic/support/simple_file.h" #include "titanic/pet_control/pet_section.h" #include "titanic/pet_control/pet_control_sub10.h" #include "titanic/pet_control/pet_control_sub12.h" diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 352e22420a..169f0c0e20 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -24,7 +24,7 @@ #define TITANIC_PET_SECTION_H #include "titanic/messages/mouse_messages.h" -#include "titanic/simple_file.h" +#include "titanic/support/simple_file.h" namespace Titanic { diff --git a/engines/titanic/rect.cpp b/engines/titanic/rect.cpp deleted file mode 100644 index 228a2ae4d4..0000000000 --- a/engines/titanic/rect.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* 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 "titanic/rect.h" - -namespace Titanic { - -void Rect::combine(const Rect &r) { - if (isEmpty() || r.isEmpty()) - return; - - Common::Rect::extend(r); -} - -void Rect::constrain(const Rect &r) { - if (!isEmpty()) { - if (r.isEmpty()) { - clear(); - } else { - Common::Rect::clip(r); - } - } -} - -} // End of namespace Titanic diff --git a/engines/titanic/rect.h b/engines/titanic/rect.h deleted file mode 100644 index 1661711870..0000000000 --- a/engines/titanic/rect.h +++ /dev/null @@ -1,61 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_RECT_H -#define TITANIC_RECT_H - -#include "common/rect.h" - -namespace Titanic { - -typedef Common::Point Point; - -class Rect : public Common::Rect { -public: - Rect() : Common::Rect() {} - Rect(int16 w, int16 h) : Common::Rect(w, h) {} - Rect(int16 x1, int16 y1, int16 x2, int16 y2) : Common::Rect(x1, y1, x2, y2) {} - - /** - * Returns the top/left corner of the rect as a point - */ - operator const Point() { return Point(left, top); } - - /** - * Clear the rect - */ - void clear() { left = top = right = bottom = 0; } - - /** - * Combine another rect into this one - */ - void combine(const Rect &r); - - /** - * Constrains/clips to the intersection area of the given rect - */ - void constrain(const Rect &r); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_RECT_H */ diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp deleted file mode 100644 index 99de75a6f4..0000000000 --- a/engines/titanic/screen_manager.cpp +++ /dev/null @@ -1,265 +0,0 @@ -/* 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 "titanic/screen_manager.h" -#include "titanic/titanic.h" -#include "titanic/video_surface.h" - -namespace Titanic { - -CScreenManager *CScreenManager::_screenManagerPtr; -CScreenManager *CScreenManager::_currentScreenManagerPtr; - -CScreenManager::CScreenManager(TitanicEngine *vm): _vm(vm) { - _screenManagerPtr = nullptr; - _currentScreenManagerPtr = nullptr; - - _frontRenderSurface = nullptr; - _mouseCursor = nullptr; - _textCursor = nullptr; - _inputHandler = nullptr; - _fontNumber = 0; - // TODO: Further initialization - - _screenManagerPtr = this; -} - -CScreenManager::~CScreenManager() { - _screenManagerPtr = nullptr; -} - -void CScreenManager::setWindowHandle(int v) { - // Not needed -} - -bool CScreenManager::resetWindowHandle(int v) { - hideCursor(); - return true; -} - -CScreenManager *CScreenManager::setCurrent() { - if (!_currentScreenManagerPtr) - _currentScreenManagerPtr = _screenManagerPtr; - - return _currentScreenManagerPtr; -} - -void CScreenManager::setSurfaceBounds(SurfaceNum surfaceNum, const Rect &r) { - if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) - _backSurfaces[surfaceNum]._bounds = r; -} - -/*------------------------------------------------------------------------*/ - -OSScreenManager::OSScreenManager(TitanicEngine *vm): CScreenManager(vm), - _directDrawManager(vm, false) { - _field48 = 0; - _field4C = 0; - _field50 = 0; - _field54 = 0; -} - -OSScreenManager::~OSScreenManager() { - destroyFrontAndBackBuffers(); - delete _mouseCursor; - delete _textCursor; -} - -void OSScreenManager::setMode(int width, int height, int bpp, uint numBackSurfaces, bool flag2) { - assert(bpp == 16); - destroyFrontAndBackBuffers(); - _directDrawManager.initVideo(width, height, bpp, numBackSurfaces); - - _vm->_screen->create(width, height, g_system->getScreenFormat()); - _frontRenderSurface = new OSVideoSurface(this, nullptr); - _frontRenderSurface->setSurface(this, _directDrawManager._mainSurface); - - _backSurfaces.resize(numBackSurfaces); - for (uint idx = 0; idx < numBackSurfaces; ++idx) { - _backSurfaces[idx]._surface = new OSVideoSurface(this, nullptr); - _backSurfaces[idx]._surface->setSurface(this, _directDrawManager._backSurfaces[idx]); - } - - // Load fonts - _fonts[0].load(149); - _fonts[1].load(151); - _fonts[2].load(152); - _fonts[3].load(153); - - // Load the cursors - loadCursors(); -} - -void OSScreenManager::drawCursors() { - warning("OSScreenManager::drawCursors"); -} - -DirectDrawSurface *OSScreenManager::getDDSurface(SurfaceNum surfaceNum) { - if (surfaceNum == SURFACE_PRIMARY) - return _directDrawManager._mainSurface; - else if (surfaceNum < (int)_backSurfaces.size()) - return _directDrawManager._backSurfaces[surfaceNum]; - else - return nullptr; -} - -void OSScreenManager::proc6() {} -void OSScreenManager::proc7() {} - -CVideoSurface *OSScreenManager::getSurface(SurfaceNum surfaceNum) const { - if (surfaceNum == SURFACE_PRIMARY) - return _frontRenderSurface; - else if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) - return _backSurfaces[surfaceNum]._surface; - else - return nullptr; -} - -void OSScreenManager::proc9() {} - -void OSScreenManager::fillRect(SurfaceNum surfaceNum, Rect *rect, byte r, byte g, byte b) { - DirectDrawSurface *surface = getDDSurface(surfaceNum); - if (!surface) - return; - - // If bounds are provided, clip and use them. Otherwise, use entire surface area - Rect surfaceRect(0, 0, surface->getWidth(), surface->getHeight()); - Rect tempRect; - - if (rect) { - tempRect = *rect; - tempRect.clip(surfaceRect); - } else { - tempRect = surfaceRect; - } - - if (tempRect.isValidRect()) - surface->fillRect(&tempRect, r, g, b); -} - -void OSScreenManager::blitFrom(SurfaceNum surfaceNum, CVideoSurface *src, - const Point *destPos, const Rect *srcRect) { - // Get the dest surface - CVideoSurface *destSurface = _frontRenderSurface; - if (surfaceNum < -1) - return; - if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) - destSurface = _backSurfaces[surfaceNum]._surface; - if (!destSurface->hasSurface()) - return; - - Point destPoint = destPos ? *destPos : Point(0, 0); - Rect srcBounds = srcRect ? *srcRect : Rect(0, 0, src->getWidth(), src->getHeight()); - Rect *bounds = &srcBounds; - Rect rect2; - - if (surfaceNum >= 0 && !_backSurfaces[surfaceNum]._bounds.isEmpty()) { - // Perform clipping to the bounds of the back surface - rect2 = srcBounds; - rect2.translate(-srcBounds.left, -srcBounds.top); - rect2.translate(destPoint.x, destPoint.y); - rect2.constrain(_backSurfaces[surfaceNum]._bounds); - - rect2.translate(-destPoint.x, -destPoint.y); - rect2.translate(srcBounds.left, srcBounds.top); - - if (rect2.isEmpty()) - return; - - destPoint.x += rect2.left - srcBounds.left; - destPoint.y += rect2.top - srcBounds.top; - bounds = &rect2; - } - - if (!bounds->isEmpty()) - destSurface->blitFrom(destPoint, src, bounds); -} - -void OSScreenManager::proc12() {} -void OSScreenManager::proc13() {} -void OSScreenManager::proc14() {} -void OSScreenManager::proc15() {} - -void OSScreenManager::writeString(int maxWidth, const CString &text, int *v1, int *v2) { - _fonts[_fontNumber].writeString(maxWidth, text, v1, v2); -} - -void OSScreenManager::getFont() {} -void OSScreenManager::proc18() {} -void OSScreenManager::proc19() {} - -void OSScreenManager::clearSurface(SurfaceNum surfaceNum, Rect *bounds) { - if (surfaceNum == SURFACE_PRIMARY) - _directDrawManager._mainSurface->fill(bounds, 0); - else if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) - _directDrawManager._backSurfaces[surfaceNum]->fill(bounds, 0); -} - -void OSScreenManager::resizeSurface(CVideoSurface *surface, int width, int height) { - DirectDrawSurface *ddSurface = _directDrawManager.createSurface(width, height, 0); - surface->setSurface(this, ddSurface); -} - -CVideoSurface *OSScreenManager::createSurface(int w, int h) { - DirectDrawSurface *ddSurface = _directDrawManager.createSurface(w, h, 0); - return new OSVideoSurface(this, ddSurface); -} - -CVideoSurface *OSScreenManager::createSurface(const CResourceKey &key) { - return new OSVideoSurface(this, key); -} - -void OSScreenManager::proc23() {} -void OSScreenManager::proc24() {} -void OSScreenManager::proc25() {} - -void OSScreenManager::showCursor() { - -} - -void OSScreenManager::hideCursor() { - -} - -void OSScreenManager::destroyFrontAndBackBuffers() { - delete _frontRenderSurface; - _frontRenderSurface = nullptr; - - for (uint idx = 0; idx < _backSurfaces.size(); ++idx) - delete _backSurfaces[idx]._surface; - _backSurfaces.clear(); -} - -void OSScreenManager::loadCursors() { - if (_mouseCursor) { - hideCursor(); - delete _mouseCursor; - } - _mouseCursor = new CMouseCursor(this); - showCursor(); - - if (!_textCursor) { - _textCursor = new CTextCursor(); - } -} - -} // End of namespace Titanic diff --git a/engines/titanic/screen_manager.h b/engines/titanic/screen_manager.h deleted file mode 100644 index e39151b85b..0000000000 --- a/engines/titanic/screen_manager.h +++ /dev/null @@ -1,248 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_SCREEN_MANAGER_H -#define TITANIC_SCREEN_MANAGER_H - -#include "common/scummsys.h" -#include "common/array.h" -#include "titanic/direct_draw.h" -#include "titanic/font.h" -#include "titanic/input_handler.h" -#include "titanic/mouse_cursor.h" -#include "titanic/text_cursor.h" -#include "titanic/video_surface.h" -#include "titanic/core/resource_key.h" - -namespace Titanic { - -/** - * The original used page flipping with one primary and one back buffer. - * Since we don't need that in ScummVM, the back buffer number below is - * remapped to the primary surface - */ -enum SurfaceNum { - SURFACE_PRIMARY = -1, - SURFACE_BACKBUFFER = -1 -}; - -class TitanicEngine; - -class CScreenManager { - struct VideoSurfaceEntry { - CVideoSurface *_surface; - Rect _bounds; - }; -protected: - TitanicEngine *_vm; -public: - static CScreenManager *_screenManagerPtr; - static CScreenManager *_currentScreenManagerPtr; - - /** - * Set the current screen manager - */ - static CScreenManager *setCurrent(); -public: - Common::Array _backSurfaces; - CVideoSurface *_frontRenderSurface; - CMouseCursor *_mouseCursor; - CTextCursor *_textCursor; - CInputHandler *_inputHandler; - int _fontNumber; -public: - CScreenManager(TitanicEngine *vm); - virtual ~CScreenManager(); - - void fn1() {} - void fn2() {} - - virtual void setWindowHandle(int v); - virtual bool resetWindowHandle(int v); - - /** - * Sets the video mode - */ - virtual void setMode(int width, int height, int bpp, uint numBackSurfaces, bool flag2) = 0; - - /** - * Handles drawing the cursors - */ - virtual void drawCursors() = 0; - - virtual void proc6() = 0; - virtual void proc7() = 0; - virtual CVideoSurface *getSurface(SurfaceNum surfaceNum) const = 0; - virtual void proc9() = 0; - - /** - * Fill an area with a specific color - */ - virtual void fillRect(SurfaceNum surfaceNum, Rect *rect, byte r, byte g, byte b) = 0; - - /** - * Blits a surface onto one of the screen surfaces - */ - virtual void blitFrom(SurfaceNum surfaceNum, CVideoSurface *src, const Point *destPos = nullptr, - const Rect *srcRect = nullptr) = 0; - - virtual void proc12() = 0; - virtual void proc13() = 0; - virtual void proc14() = 0; - virtual void proc15() = 0; - - - /** - * Write out a string - */ - virtual void writeString(int maxWidth, const CString &text, int *v1, int *v2) = 0; - - virtual void getFont() = 0; - virtual void proc18() = 0; - virtual void proc19() = 0; - - /** - * Clear a portion of a specified surface - */ - virtual void clearSurface(SurfaceNum surfaceNum, Rect *_bounds) = 0; - - /** - * Resize the passed surface - */ - virtual void resizeSurface(CVideoSurface *surface, int width, int height) = 0; - - /** - * Creates a surface of a given size - */ - virtual CVideoSurface *createSurface(int w, int h) = 0; - - /** - * Creates a surface from a specified resource - */ - virtual CVideoSurface *createSurface(const CResourceKey &key) = 0; - - virtual void proc24() = 0; - virtual void proc25() = 0; - virtual void showCursor() = 0; - virtual void hideCursor() = 0; - - void setSurfaceBounds(SurfaceNum surfaceNum, const Rect &r); -}; - -class OSScreenManager: CScreenManager { -private: - DirectDrawManager _directDrawManager; - - /** - * Frees any surface buffers - */ - void destroyFrontAndBackBuffers(); - - /** - * Load game cursors - */ - void loadCursors(); - - /** - * Gets an underlying surface - */ - DirectDrawSurface *getDDSurface(SurfaceNum surfaceNum); -public: - int _field48; - int _field4C; - int _field50; - int _field54; - STFont _fonts[4]; -public: - OSScreenManager(TitanicEngine *vm); - virtual ~OSScreenManager(); - - /** - * Sets the video mode - */ - virtual void setMode(int width, int height, int bpp, uint numBackSurfaces, bool flag2); - - /** - * Handles drawing the cursors - */ - virtual void drawCursors(); - - virtual void proc6(); - virtual void proc7(); - virtual CVideoSurface *getSurface(SurfaceNum surfaceNum) const; - virtual void proc9(); - - /** - * Fill an area with a specific color - */ - virtual void fillRect(SurfaceNum surfaceNum, Rect *rect, byte r, byte g, byte b); - - /** - * Blits a surface onto one of the screen surfaces - */ - virtual void blitFrom(SurfaceNum surfaceNum, CVideoSurface *src, const Point *destPos, - const Rect *srcRect = nullptr); - - virtual void proc12(); - virtual void proc13(); - virtual void proc14(); - virtual void proc15(); - - /** - * Write out a string - */ - virtual void writeString(int maxWidth, const CString &text, int *v1, int *v2); - - virtual void getFont(); - virtual void proc18(); - virtual void proc19(); - - /** - * Clear a portion of the screen surface - */ - virtual void clearSurface(SurfaceNum surfaceNum, Rect *bounds); - - /** - * Resize the passed surface - */ - virtual void resizeSurface(CVideoSurface *surface, int width, int height); - - /** - * Creates a surface of a given size - */ - virtual CVideoSurface *createSurface(int w, int h); - - /** - * Creates a surface from a specified resource - */ - virtual CVideoSurface *createSurface(const CResourceKey &key); - - virtual void proc23(); - virtual void proc24(); - virtual void proc25(); - virtual void showCursor(); - virtual void hideCursor(); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_SCREEN_MANAGER_H */ diff --git a/engines/titanic/simple_file.cpp b/engines/titanic/simple_file.cpp deleted file mode 100644 index acf02e8df1..0000000000 --- a/engines/titanic/simple_file.cpp +++ /dev/null @@ -1,385 +0,0 @@ -/* 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/util.h" -#include "titanic/simple_file.h" - -namespace Titanic { - -bool File::open(const Common::String &name) { - if (!Common::File::open(name)) - error("Could not open file - %s", name.c_str()); - return true; -} - -/*------------------------------------------------------------------------*/ - -SimpleFile::SimpleFile(): _inStream(nullptr), _outStream(nullptr), _lineCount(1) { -} - -SimpleFile::~SimpleFile() { - close(); -} - -void SimpleFile::open(Common::SeekableReadStream *stream) { - close(); - _inStream = stream; -} - -void SimpleFile::open(Common::OutSaveFile *stream) { - close(); - _outStream = stream; -} - -void SimpleFile::close() { - if (_outStream) { - _outStream->finalize(); - delete _outStream; - _outStream = nullptr; - } - - if (_inStream) { - delete _inStream; - _inStream = nullptr; - } -} - -void SimpleFile::safeRead(void *dst, size_t count) { - if (unsafeRead(dst, count) != count) - error("Could not read %d bytes", (int)count); -} - -size_t SimpleFile::unsafeRead(void *dst, size_t count) { - assert(_inStream); - return _inStream->read(dst, count); -} - -size_t SimpleFile::write(const void *src, size_t count) { - assert(_outStream); - return _outStream->write(src, count); -} - -CString SimpleFile::readString() { - char c; - CString result; - bool backslashFlag = false; - - // First skip any spaces - do { - safeRead(&c, 1); - } while (Common::isSpace(c)); - - // Ensure we've found a starting quote for the string - if (c != '"') - error("Could not find starting quote"); - - bool endFlag = false; - while (!endFlag) { - // Read the next character - safeRead(&c, 1); - - if (backslashFlag) { - backslashFlag = false; - switch (c) { - case 'n': - result += '\n'; - break; - case 'r': - result += '\r'; - break; - case '\t': - result += '\t'; - break; - default: - result += c; - break; - } - } else { - switch (c) { - case '"': - endFlag = true; - break; - case '\\': - backslashFlag = true; - break; - default: - result += c; - break; - } - } - } - - // Return the string - return result; -} - -int SimpleFile::readNumber() { - char c; - int result = 0; - bool minusFlag = false; - - // First skip any spaces - do { - safeRead(&c, 1); - } while (Common::isSpace(c)); - - // Check for prefix sign - if (c == '+' || c == '-') { - minusFlag = c == '-'; - safeRead(&c, 1); - } - - // Read in the number - if (!Common::isDigit(c)) - error("Invalid number"); - - while (Common::isDigit(c)) { - result = result * 10 + (c - '0'); - safeRead(&c, 1); - } - - // Finally, if it's a minus value, then negate it - if (minusFlag) - result = -result; - - return result; -} - -double SimpleFile::readFloat() { - char c; - Common::String result; - - // First skip any spaces - do { - safeRead(&c, 1); - } while (Common::isSpace(c)); - - // Check for prefix sign - if (c == '+' || c == '-') { - result += c; - safeRead(&c, 1); - } - - // Read in the number - if (!Common::isDigit(c)) - error("Invalid number"); - - while (Common::isDigit(c) || c == '.') { - result += c; - safeRead(&c, 1); - } - - // Convert to a float and return it - float floatValue; - sscanf(result.c_str(), "%f", &floatValue); - - return floatValue; -} - -Point SimpleFile::readPoint() { - Point pt; - pt.x = readNumber(); - pt.y = readNumber(); - - return pt; -} - -Rect SimpleFile::readRect() { - Rect r; - r.left = readNumber(); - r.top = readNumber(); - r.right = readNumber(); - r.bottom = readNumber(); - - return r; -} - -void SimpleFile::readBuffer(char *buffer, size_t count) { - CString tempString = readString(); - if (buffer) { - strncpy(buffer, tempString.c_str(), count); - buffer[count - 1] = '\0'; - } -} - -void SimpleFile::writeLine(const CString &str) { - write(str.c_str(), str.size()); - write("\r\n", 2); -} - -void SimpleFile::writeString(const CString &str) { - if (str.empty()) - return; - - const char *msgP = str.c_str(); - char c; - - while ((c = *msgP++) != '\0') { - switch (c) { - case '\r': - write("\\r", 2); - break; - case '\n': - write("\\n", 2); - break; - case '\t': - write("\\t", 2); - break; - case '\"': - write("\\\"", 2); - break; - case '\\': - write("\\\\", 2); - break; - case '{': - write("\\{", 2); - break; - case '}': - write("\\}", 2); - break; - default: - write(&c, 1); - break; - } - } -} - -void SimpleFile::writeQuotedString(const CString &str) { - write("\"", 1); - writeString(str); - write("\" ", 2); -} - -void SimpleFile::writeQuotedLine(const CString &str, int indent) { - writeIndent(indent); - writeQuotedString(str); - write("\n", 1); -} - -void SimpleFile::writeNumber(int val) { - CString str = CString::format("%d ", val); - write(str.c_str(), str.size()); -} - -void SimpleFile::writeNumberLine(int val, int indent) { - writeIndent(indent); - writeNumber(val); - write("\n", 1); -} - -void SimpleFile::writeFloat(double val) { - Common::String valStr = Common::String::format("%f ", val); - write(valStr.c_str(), valStr.size()); -} - -void SimpleFile::writeFloatLine(double val, int indent) { - writeIndent(indent); - writeFloat(val); - write("\n", 1); -} - -void SimpleFile::writePoint(const Point &pt, int indent) { - writeIndent(indent); - writeNumber(pt.x); - writeNumber(pt.y); - write("\n", 1); -} - -void SimpleFile::writeRect(const Rect &r, int indent) { - writePoint(Point(r.left, r.top), indent); - writePoint(Point(r.right, r.bottom), indent); -} - -void SimpleFile::writeIndent(uint indent) { - for (uint idx = 0; idx < indent; ++idx) - write("\t", 1); -} - -bool SimpleFile::IsClassStart() { - char c; - - do { - safeRead(&c, 1); - } while (Common::isSpace(c)); - - assert(c == '{' || c == '}'); - return c == '{'; -} - -void SimpleFile::writeClassStart(const CString &classStr, int indent) { - write("\n", 1); - writeIndent(indent); - write("{\n", 2); - writeIndent(indent + 1); - writeQuotedString(classStr); - write("\n", 1); -} - -void SimpleFile::writeClassEnd(int indent) { - writeIndent(indent); - write("}\n", 2); -} - -/*------------------------------------------------------------------------*/ - -void StdCWadFile::open(const CString &name) { - File f; - - // Check for whether it is indeed a file/resource pair - int idx = name.indexOf('#'); - - if (idx < 0) { - // Nope, so open up file for standard reading - assert(!name.empty()); - f.open(name); - - SimpleFile::open(f.readStream(f.size())); - return; - } - - // Split up the name and resource, and get the resource index - CString filename = name.left(idx) + ".st"; - int extPos = name.lastIndexOf('.'); - CString resStr = name.mid(idx + 1, extPos - idx - 1); - int resIndex = resStr.readInt(); - - // Open up the index for access - f.open(filename); - int indexSize = f.readUint32LE() / 4; - assert(resIndex < indexSize); - - // Get the specific resource's offset, and size by also - // getting the offset of the following resource - f.seek(resIndex * 4); - uint resOffset = f.readUint32LE(); - uint nextOffset = (resIndex == (indexSize - 1)) ? f.size() : - f.readUint32LE(); - - // Read in the resource - f.seek(resOffset); - Common::SeekableReadStream *stream = f.readStream(nextOffset - resOffset); - SimpleFile::open(stream); - - f.close(); -} - -} // End of namespace Titanic diff --git a/engines/titanic/simple_file.h b/engines/titanic/simple_file.h deleted file mode 100644 index 0568092b4e..0000000000 --- a/engines/titanic/simple_file.h +++ /dev/null @@ -1,236 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_SIMPLE_FILE_H -#define TITANIC_SIMPLE_FILE_H - -#include "common/file.h" -#include "titanic/rect.h" -#include "common/savefile.h" -#include "common/stream.h" -#include "common/zlib.h" -#include "titanic/string.h" - -namespace Titanic { - -class Decompressor; -class DecompressorData; - -/** - * Simple ScummVM File descendent that throws a wobbly if - * the file it tries to open isn't present - */ -class File : public Common::File { -public: - virtual bool open(const Common::String &name); -}; - -/** - * This class implements basic reading and writing to files - */ -class SimpleFile { -protected: - Common::SeekableReadStream *_inStream; - Common::OutSaveFile *_outStream; - int _lineCount; -public: - SimpleFile(); - virtual ~SimpleFile(); - - /** - * Set up a stream for read access - */ - virtual void open(Common::SeekableReadStream *stream); - - /** - * Set up a stream for write access - */ - virtual void open(Common::OutSaveFile *stream); - - /** - * Close the file - */ - virtual void close(); - - /** - * Read from the file with validation - */ - virtual void safeRead(void *dst, size_t count); - - /** - * Read from the file - */ - virtual size_t unsafeRead(void *dst, size_t count); - - /** - * Write out data - */ - virtual size_t write(const void *src, size_t count); - - /** - * Read a string from the file - */ - CString readString(); - - /** - * Read a number from the file - */ - int readNumber(); - - /** - * Read a floating point number from the file - */ - double readFloat(); - - /** - * Read in a point - */ - Point readPoint(); - - /** - * Read in a rect - */ - Rect readRect(); - - /** - * Read a string and copy it into an optionally passed buffer - */ - void readBuffer(char *buffer = nullptr, size_t count = 0); - - /** - * Write a string line - */ - void writeLine(const CString &str); - - /** - * Write a string - */ - void writeString(const CString &str); - - /** - * Write a quoted string - */ - void writeQuotedString(const CString &str); - - /** - * Write a quoted string line - */ - void writeQuotedLine(const CString &str, int indent); - - /** - * Write a number to file - */ - void writeNumber(int val); - - /** - * Write a number line to file - */ - void writeNumberLine(int val, int indent); - - /** - * Write a floating point number - */ - void writeFloat(double val); - - /** - * Write a floating point number as a line - */ - void writeFloatLine(double val, int indent); - - /** - * Write out a point line - */ - void writePoint(const Point &pt, int indent); - - /** - * Write out a rect line - */ - void writeRect(const Rect &r, int indent); - - /** - * Write out a number of tabs to form an indent in the output - */ - void writeIndent(uint indent); - - /** - * Validates that the following non-space character is either - * an opening or closing squiggly bracket denoting a class - * definition start or end. Returns true if it's a class start - */ - bool IsClassStart(); - - /** - * Write the starting header for a class definition - */ - void writeClassStart(const CString &classStr, int indent); - - /** - * Write out the ending footer for a class definition - */ - void writeClassEnd(int indent); -}; - -/** - * Derived file that handles compressed files - */ -class CompressedFile : public SimpleFile { -public: - CompressedFile() : SimpleFile() {} - virtual ~CompressedFile() {} - - /** - * Set up a stream for read access - */ - virtual void open(Common::SeekableReadStream *stream) { - SimpleFile::open(Common::wrapCompressedReadStream(stream)); - } - - /** - * Set up a stream for write access - */ - virtual void open(Common::OutSaveFile *stream) { - SimpleFile::open(Common::wrapCompressedWriteStream(stream)); - } -}; - -/** - * Derived file that handles WAD archives containing multiple files - */ -class StdCWadFile : public SimpleFile { -public: - StdCWadFile() : SimpleFile() {} - virtual ~StdCWadFile() {} - - /** - * Open up the specified file - */ - void open(const CString &name); - - /** - * Return a reference to the read stream - */ - Common::SeekableReadStream *readStream() const { return _inStream; } -}; - -} // End of namespace Titanic - -#endif /* TITANIC_SIMPLE_FILE_H */ diff --git a/engines/titanic/sound/sound.h b/engines/titanic/sound/sound.h index fe115f7237..804263c59d 100644 --- a/engines/titanic/sound/sound.h +++ b/engines/titanic/sound/sound.h @@ -23,7 +23,7 @@ #ifndef TITANIC_SOUND_H #define TITANIC_SOUND_H -#include "titanic/simple_file.h" +#include "titanic/support/simple_file.h" #include "titanic/sound/sound_manager.h" #include "titanic/core/view_item.h" diff --git a/engines/titanic/sound/sound_manager.h b/engines/titanic/sound/sound_manager.h index 29fbb5ad11..f741f97f7b 100644 --- a/engines/titanic/sound/sound_manager.h +++ b/engines/titanic/sound/sound_manager.h @@ -23,7 +23,7 @@ #ifndef TITANIC_SOUND_MANAGER_H #define TITANIC_SOUND_MANAGER_H -#include "titanic/simple_file.h" +#include "titanic/support/simple_file.h" namespace Titanic { diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp index c8ee8c2d7b..446579855a 100644 --- a/engines/titanic/star_control/star_control.cpp +++ b/engines/titanic/star_control/star_control.cpp @@ -20,7 +20,7 @@ * */ -#include "titanic/screen_manager.h" +#include "titanic/support/screen_manager.h" #include "titanic/star_control/star_control.h" namespace Titanic { diff --git a/engines/titanic/star_control/star_control_sub11.cpp b/engines/titanic/star_control/star_control_sub11.cpp index 6c782933ae..f590ee61e6 100644 --- a/engines/titanic/star_control/star_control_sub11.cpp +++ b/engines/titanic/star_control/star_control_sub11.cpp @@ -20,7 +20,7 @@ * */ -#include "titanic/screen_manager.h" +#include "titanic/support/screen_manager.h" #include "titanic/star_control/star_control_sub11.h" namespace Titanic { diff --git a/engines/titanic/star_control/star_control_sub11.h b/engines/titanic/star_control/star_control_sub11.h index 6b6807049f..9cb9cbeb50 100644 --- a/engines/titanic/star_control/star_control_sub11.h +++ b/engines/titanic/star_control/star_control_sub11.h @@ -23,7 +23,7 @@ #ifndef TITANIC_STAR_CONTROL_SUB11_H #define TITANIC_STAR_CONTROL_SUB11_H -#include "titanic/simple_file.h" +#include "titanic/support/simple_file.h" #include "titanic/star_control/star_control_sub12.h" #include "titanic/star_control/star_control_sub13.h" #include "titanic/star_control/star_control_sub15.h" diff --git a/engines/titanic/star_control/star_control_sub12.h b/engines/titanic/star_control/star_control_sub12.h index 6bfc4158b4..586e138969 100644 --- a/engines/titanic/star_control/star_control_sub12.h +++ b/engines/titanic/star_control/star_control_sub12.h @@ -23,7 +23,7 @@ #ifndef TITANIC_STAR_CONTROL_SUB12_H #define TITANIC_STAR_CONTROL_SUB12_H -#include "titanic/simple_file.h" +#include "titanic/support/simple_file.h" #include "titanic/star_control/star_control_sub13.h" namespace Titanic { diff --git a/engines/titanic/star_control/star_control_sub13.h b/engines/titanic/star_control/star_control_sub13.h index 983fa1c9d4..1ec841ae2d 100644 --- a/engines/titanic/star_control/star_control_sub13.h +++ b/engines/titanic/star_control/star_control_sub13.h @@ -23,7 +23,7 @@ #ifndef TITANIC_STAR_CONTROL_SUB13_H #define TITANIC_STAR_CONTROL_SUB13_H -#include "titanic/simple_file.h" +#include "titanic/support/simple_file.h" #include "titanic/star_control/star_control_sub6.h" #include "titanic/star_control/star_control_sub14.h" diff --git a/engines/titanic/star_control/star_control_sub14.h b/engines/titanic/star_control/star_control_sub14.h index 63a58bf9c6..2d02d13d8c 100644 --- a/engines/titanic/star_control/star_control_sub14.h +++ b/engines/titanic/star_control/star_control_sub14.h @@ -23,7 +23,7 @@ #ifndef TITANIC_STAR_CONTROL_SUB14_H #define TITANIC_STAR_CONTROL_SUB14_H -#include "titanic/simple_file.h" +#include "titanic/support/simple_file.h" namespace Titanic { diff --git a/engines/titanic/star_control/star_control_sub15.h b/engines/titanic/star_control/star_control_sub15.h index 2151c5a622..0e0d2e41c0 100644 --- a/engines/titanic/star_control/star_control_sub15.h +++ b/engines/titanic/star_control/star_control_sub15.h @@ -23,7 +23,7 @@ #ifndef TITANIC_STAR_CONTROL_SUB15_H #define TITANIC_STAR_CONTROL_SUB15_H -#include "titanic/simple_file.h" +#include "titanic/support/simple_file.h" namespace Titanic { diff --git a/engines/titanic/star_control/star_control_sub3.h b/engines/titanic/star_control/star_control_sub3.h index d6d1c30eed..08d0835e1c 100644 --- a/engines/titanic/star_control/star_control_sub3.h +++ b/engines/titanic/star_control/star_control_sub3.h @@ -23,7 +23,7 @@ #ifndef TITANIC_STAR_CONTROL_SUB3_H #define TITANIC_STAR_CONTROL_SUB3_H -#include "titanic/simple_file.h" +#include "titanic/support/simple_file.h" #include "titanic/star_control/star_control_sub4.h" namespace Titanic { diff --git a/engines/titanic/star_control/star_control_sub8.h b/engines/titanic/star_control/star_control_sub8.h index da95f89af9..6dcd147da2 100644 --- a/engines/titanic/star_control/star_control_sub8.h +++ b/engines/titanic/star_control/star_control_sub8.h @@ -23,7 +23,7 @@ #ifndef TITANIC_STAR_CONTROL_SUB8_H #define TITANIC_STAR_CONTROL_SUB8_H -#include "titanic/simple_file.h" +#include "titanic/support/simple_file.h" namespace Titanic { diff --git a/engines/titanic/string.cpp b/engines/titanic/string.cpp deleted file mode 100644 index b4af9206f6..0000000000 --- a/engines/titanic/string.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* 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/algorithm.h" -#include "titanic/string.h" - -namespace Titanic { - -CString::CString(char c, uint32 len) : Common::String() { - ensureCapacity(len, false); - for (uint idx = 0; idx < len; ++idx) - (*this) += c; -} - -CString::CString(int val) : Common::String() { - char buffer[16]; - itoa(val, buffer, 10); - *this += buffer; -} - -CString CString::left(uint count) const { - return (count > size()) ? CString() : CString(c_str(), c_str() + count); -} - -CString CString::right(uint count) const { - uint strSize = size(); - return (count > strSize) ? CString() : - CString(c_str() + strSize - count, c_str() + strSize); -} - -CString CString::mid(uint start, uint count) const { - if (start >= size()) - return CString(); - else - return CString(c_str() + start, MIN(count, size() - start)); -} - -CString CString::mid(uint start) const { - uint strSize = size(); - assert(start <= strSize); - return mid(start, strSize - start); -} - -int CString::indexOf(char c) const { - const char *charP = strchr(c_str(), c); - return charP ? charP - c_str() : -1; -} - -int CString::lastIndexOf(char c) const { - const char *charP = strrchr(c_str(), c); - return charP ? charP - c_str() : -1; -} - -FileType CString::fileTypeSuffix() const { - CString ext = right(1); - if (ext == "0" || ext == "4") - return FILETYPE_IMAGE; - else if (ext == "1") - return FILETYPE_WAV; - else if (ext == "2" || ext == "3") - return FILETYPE_MOVIE; - - ext = right(3); - if (ext == "tga" || ext == "jpg") - return FILETYPE_IMAGE; - else if (ext == "wav") - return FILETYPE_WAV; - else if (ext == "avi" || ext == "mov") - return FILETYPE_MOVIE; - else if (ext == "dlg") - return FILETYPE_DLG; - else - return FILETYPE_UNKNOWN; -} - -ImageType CString::imageTypeSuffix() const { - CString ext = right(1); - if (ext == "0") - return IMAGETYPE_TARGA; - else if (ext == "4") - return IMAGETYPE_JPEG; - - ext = right(3); - if (ext == "tga") - return IMAGETYPE_TARGA; - else if (ext == "jpg") - return IMAGETYPE_JPEG; - else - return IMAGETYPE_UNKNOWN; -} - -CString CString::format(const char *fmt, ...) { - String output; - - va_list va; - va_start(va, fmt); - output = String::vformat(fmt, va); - va_end(va); - - return output; -} - -} // End of namespace Titanic diff --git a/engines/titanic/string.h b/engines/titanic/string.h deleted file mode 100644 index 02775de067..0000000000 --- a/engines/titanic/string.h +++ /dev/null @@ -1,106 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_STRING_H -#define TITANIC_STRING_H - -#include "common/scummsys.h" -#include "common/str.h" - -namespace Titanic { - -enum FileType { - FILETYPE_UNKNOWN = 0, FILETYPE_IMAGE = 1, FILETYPE_MOVIE = 2, - FILETYPE_WAV = 3, FILETYPE_DLG = 4 -}; - -enum ImageType { - IMAGETYPE_UNKNOWN = 0, IMAGETYPE_TARGA = 1, IMAGETYPE_JPEG = 2 -}; - -class CString : public Common::String { -public: - CString() : Common::String() {} - CString(const char *str) : Common::String(str) {} - CString(const char *str, uint32 len) : Common::String(str, len) {} - CString(const char *beginP, const char *endP) : Common::String(beginP, endP) {} - CString(const String &str) : Common::String(str) {} - CString(char c, uint32 len); - explicit CString(char c) : Common::String(c) {} - explicit CString(int val); - - /** - * Returns the left n characters of the string - */ - CString left(uint count) const; - - /** - * Returns the right n characters of the string - */ - CString right(uint count) const; - - /** - * Returns a substring from within the string - */ - CString mid(uint start, uint count) const; - - /** - * Returns a substring from within the string - */ - CString mid(uint start) const; - - /** - * Returns the index of the first occurance of a given character - */ - int indexOf(char c) const; - - /** - * Returns the index of the last occurance of a given character - */ - int lastIndexOf(char c) const; - - /** - * Returns the type of a filename based on it's extension - */ - FileType fileTypeSuffix() const; - - /** - * Returns the type of an image filename based on it's extension - */ - ImageType imageTypeSuffix() const; - - /** - * Parses the string as an integer and returns the value - */ - int readInt() const { - return atoi(c_str()); - } - - /** - * Format a string - */ - static CString format(const char *fmt, ...); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_STRING_H */ diff --git a/engines/titanic/support/direct_draw.cpp b/engines/titanic/support/direct_draw.cpp new file mode 100644 index 0000000000..5ddb25bec9 --- /dev/null +++ b/engines/titanic/support/direct_draw.cpp @@ -0,0 +1,109 @@ +/* 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/debug.h" +#include "engines/util.h" +#include "graphics/pixelformat.h" +#include "titanic/titanic.h" +#include "titanic/support/direct_draw.h" + +namespace Titanic { + +DirectDraw::DirectDraw(TitanicEngine *vm) : _vm(vm), + _windowed(false), _fieldC(0), _width(0), _height(0), + _bpp(0), _numBackSurfaces(0), _field24(0) { +} + +void DirectDraw::setDisplayMode(int width, int height, int bpp, int refreshRate) { + debugC(ERROR_BASIC, kDebugGraphics, "DirectDraw::SetDisplayMode (%d x %d), %d bpp", + width, height, bpp); + assert(bpp == 16); + + Graphics::PixelFormat pixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); + initGraphics(width, height, true, &pixelFormat); +} + +void DirectDraw::diagnostics() { + debugC(ERROR_BASIC, kDebugGraphics, "Running DirectDraw Diagnostic..."); +} + +DirectDrawSurface *DirectDraw::createSurfaceFromDesc(const DDSurfaceDesc &desc) { + DirectDrawSurface *surface = new DirectDrawSurface(); + surface->create(desc._w, desc._h); + + return surface; +} + +/*------------------------------------------------------------------------*/ + +DirectDrawManager::DirectDrawManager(TitanicEngine *vm, bool windowed) : _directDraw(vm) { + _mainSurface = nullptr; + _backSurfaces[0] = _backSurfaces[1] = nullptr; + _directDraw._windowed = windowed; +} + +void DirectDrawManager::initVideo(int width, int height, int bpp, int numBackSurfaces) { + debugC(ERROR_BASIC, kDebugGraphics, "Initialising video surfaces"); + _directDraw._width = width; + _directDraw._numBackSurfaces = numBackSurfaces; + _directDraw._height = height; + _directDraw._bpp = bpp; + + if (_directDraw._windowed) { + initWindowed(); + } else { + initFullScreen(); + } +} + +void DirectDrawManager::setResolution() { + // TODO +} + +void DirectDrawManager::proc2() { + +} + +void DirectDrawManager::proc3() { + +} + +void DirectDrawManager::initFullScreen() { + debugC(ERROR_BASIC, kDebugGraphics, "Creating surfaces"); + _directDraw.setDisplayMode(_directDraw._width, _directDraw._height, + _directDraw._bpp, 0); + + _mainSurface = new DirectDrawSurface(); + _mainSurface->create(g_vm->_screen); + _backSurfaces[0] = new DirectDrawSurface(); + _backSurfaces[0]->create(_directDraw._width, _directDraw._height); +} + +DirectDrawSurface *DirectDrawManager::createSurface(int w, int h, int surfaceNum) { + if (surfaceNum) + return nullptr; + + assert(_mainSurface); + return _directDraw.createSurfaceFromDesc(DDSurfaceDesc(w, h)); +} + +} // End of namespace Titanic diff --git a/engines/titanic/support/direct_draw.h b/engines/titanic/support/direct_draw.h new file mode 100644 index 0000000000..85c344c600 --- /dev/null +++ b/engines/titanic/support/direct_draw.h @@ -0,0 +1,105 @@ +/* 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. + * + */ + +#ifndef TITANIC_DIRECT_DRAW_H +#define TITANIC_DIRECT_DRAW_H + +#include "common/scummsys.h" +#include "common/array.h" +#include "titanic/support/direct_draw_surface.h" + +namespace Titanic { + +class TitanicEngine; + +class DirectDraw { +private: + TitanicEngine *_vm; +public: + bool _windowed; + int _fieldC; + int _width; + int _height; + int _bpp; + int _numBackSurfaces; + int _field24; +public: + DirectDraw(TitanicEngine *vm); + + /** + * Sets a new display mode + */ + void setDisplayMode(int width, int height, int bpp, int refreshRate); + + /** + * Logs diagnostic information + */ + void diagnostics(); + + /** + * Create a surface from a passed description record + */ + DirectDrawSurface *createSurfaceFromDesc(const DDSurfaceDesc &desc); +}; + +class DirectDrawManager { +public: + DirectDraw _directDraw; + DirectDrawSurface *_mainSurface; + DirectDrawSurface *_backSurfaces[2]; +public: + DirectDrawManager(TitanicEngine *vm, bool windowed); + + /** + * Initializes video surfaces + * @param width Screen width + * @param height Screen height + * @param bpp Bits per pixel + * @param numBackSurfaces Number of back surfaces + */ + void initVideo(int width, int height, int bpp, int numBackSurfaces); + + void setResolution(); + + void proc2(); + + void proc3(); + + /** + * Initializes the surfaces in windowed mode + */ + void initWindowed() { initFullScreen(); } + + /** + * Initializes the surfaces for the screen + */ + void initFullScreen(); + + /** + * Create a surface + */ + DirectDrawSurface *createSurface(int w, int h, int surfaceNum); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DIRECT_DRAW_H */ diff --git a/engines/titanic/support/direct_draw_surface.cpp b/engines/titanic/support/direct_draw_surface.cpp new file mode 100644 index 0000000000..9ebda15b0e --- /dev/null +++ b/engines/titanic/support/direct_draw_surface.cpp @@ -0,0 +1,100 @@ +/* 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 "titanic/support/direct_draw_surface.h" + +namespace Titanic { + +DirectDrawSurface::DirectDrawSurface() : _surface(nullptr), + _disposeAfterUse(DisposeAfterUse::YES) { +} + +DirectDrawSurface::~DirectDrawSurface() { + free(); +} + +void DirectDrawSurface::create(Graphics::ManagedSurface *surface) { + free(); + _surface = surface; + _disposeAfterUse = DisposeAfterUse::NO; +} + +void DirectDrawSurface::create(int w, int h) { + Graphics::PixelFormat pixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); + _surface = new Graphics::ManagedSurface(w, h, pixelFormat); + _disposeAfterUse = DisposeAfterUse::YES; +} + +void DirectDrawSurface::free() { + if (_disposeAfterUse == DisposeAfterUse::YES) + delete _surface; + _surface = nullptr; + _disposeAfterUse = DisposeAfterUse::NO; +} + +Graphics::ManagedSurface *DirectDrawSurface::lock(const Rect *bounds, int flags) { + assert(!_surface->empty()); + return _surface; +} + +void DirectDrawSurface::unlock() { + assert(_surface->w != 0 && _surface->h != 0); +} + +void DirectDrawSurface::fill(const Rect *bounds, uint32 color) { + Rect tempBounds; + + assert(_surface); + if (bounds) { + // Bounds are provided, clip them to the bounds of this surface + tempBounds = *bounds; + tempBounds.clip(Rect(0, 0, _surface->w, _surface->h)); + } else { + // No bounds provided, so use the entire surface + tempBounds = Rect(0, 0, _surface->w, _surface->h); + } + + // Fill the area + _surface->fillRect(tempBounds, color); +} + +void DirectDrawSurface::fillRect(Rect *rect, byte r, byte g, byte b) { + uint color = _surface->format.RGBToColor(r, g, b); + Rect tempRect = rect ? *rect : Rect(0, 0, getWidth(), getHeight()); + + _surface->fillRect(tempRect, color); +} + +void DirectDrawSurface::blit(const Rect &destRect, DirectDrawSurface *srcSurface, Rect &srcRect) { + assert(srcSurface); + if (!destRect.isEmpty()) + _surface->transBlitFrom(*srcSurface->_surface, srcRect, destRect, (uint)-1); +} + +void DirectDrawSurface::blit(const Point &destPos, DirectDrawSurface *srcSurface, Rect *bounds) { + if (bounds) + _surface->blitFrom(*srcSurface->_surface, *bounds, destPos); + else + _surface->blitFrom(*srcSurface->_surface, destPos); +} + +} // End of namespace Titanic diff --git a/engines/titanic/support/direct_draw_surface.h b/engines/titanic/support/direct_draw_surface.h new file mode 100644 index 0000000000..12848b125d --- /dev/null +++ b/engines/titanic/support/direct_draw_surface.h @@ -0,0 +1,121 @@ +/* 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. + * + */ + +#ifndef TITANIC_DIRECT_DRAW_SURFACE_H +#define TITANIC_DIRECT_DRAW_SURFACE_H + +#include "common/scummsys.h" +#include "common/array.h" +#include "graphics/managed_surface.h" +#include "titanic/support/rect.h" + +namespace Titanic { + +class TitanicEngine; + +struct DDSurfaceDesc { + int _w; + int _h; + int _flags; + int _caps; + + DDSurfaceDesc(int w, int h) : _w(w), _h(h), _flags(0x1006), _caps(64) {} +}; + +class DirectDrawSurface { +private: + Graphics::ManagedSurface *_surface; + DisposeAfterUse::Flag _disposeAfterUse; +public: + DirectDrawSurface(); + ~DirectDrawSurface(); + + /** + * Create a surface + */ + void create(int w, int h); + + /** + * Create a surface based on a passed surface + */ + void create(Graphics::ManagedSurface *surface); + + /** + * Frees the surface + */ + void free(); + + /** + * Return the size of the surface in ytes + */ + int getSize() const { return _surface->pitch * _surface->h; } + + /** + * Return the surface width + */ + int getWidth() const { return _surface->w; } + + /** + * Return the surface width + */ + int getHeight() const { return _surface->h; } + + /** + * Return the surface pitch + */ + int getPitch() const { return _surface->pitch; } + + /** + * Lock the surface for access + */ + Graphics::ManagedSurface *lock(const Rect *bounds, int flags); + + /** + * Unlocks the surface at the end of direct accesses + */ + void unlock(); + + /** + * Fills an area of the surfae with the specified color. If no bounds are passed, + * then the entire surface is filled + */ + void fill(const Rect *bounds, uint32 color); + + /** + * Fill an area with a specific color + */ + void fillRect(Rect *rect, byte r, byte g, byte b); + + /** + * Copy data from a source surfcae into this one + */ + void blit(const Rect &destRect, DirectDrawSurface *srcSurface, Rect &srcRect); + + /** + * Copy data from a source surfcae into this one + */ + void blit(const Point &destPos, DirectDrawSurface *srcSurface, Rect *bounds); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DIRECT_DRAW_SURFACE_H */ diff --git a/engines/titanic/support/files_manager.cpp b/engines/titanic/support/files_manager.cpp new file mode 100644 index 0000000000..179d77f24f --- /dev/null +++ b/engines/titanic/support/files_manager.cpp @@ -0,0 +1,106 @@ +/* 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/file.h" +#include "titanic/support/files_manager.h" +#include "titanic/game_manager.h" + +namespace Titanic { + +CFilesManager::CFilesManager() : _gameManager(nullptr), + _assetsPath("Assets"), _exeResources(nullptr), _field0(0), + _drive(-1), _field18(0), _field1C(0), _field3C(0) { +} + +CFilesManager::~CFilesManager() { + delete _exeResources; +} + +bool CFilesManager::fileExists(const CString &name) { + Common::File f; + return f.exists(name); +} + +bool CFilesManager::scanForFile(const CString &name) { + if (name.empty()) + return false; + + CString filename = name; + filename.toLowercase(); + + if (filename[0] == 'y' || filename[0] == 'z') + return true; + else if (filename[0] < 'a' || filename[0] > 'c') + return false; + + CString fname = filename; + int idx = fname.indexOf('#'); + if (idx >= 0) { + fname = fname.left(idx); + fname += ".st"; + } + + if (_gameManager) + _gameManager->viewChange(); + + // The original had a bunch of code here handling determining + // which asset path, if any, the filename was present for, + // and storing the "active asset path" it was found on. + // This is redundant for ScummVM, which takes care of the paths + return fileExists(fname); +} + +void CFilesManager::loadDrive() { + assert(_drive == -1); + resetView(); +} + +void CFilesManager::debug(CScreenManager *screenManager) { + warning("TODO: CFilesManager::debug"); +} + +void CFilesManager::resetView() { + if (_gameManager) { + _gameManager->_gameState.setMode(GSMODE_SELECTED); + _gameManager->initBounds(); + } +} + +void CFilesManager::fn4(const CString &name) { + warning("TODO: CFilesManager::fn4"); +} + +void CFilesManager::fn5(const CString &name) { + warning("TODO: CFilesManager::fn5"); +} + +Common::SeekableReadStream *CFilesManager::getResource(const CString &name, + const CString &area) { + if (!_exeResources) { + _exeResources = new Common::NEResources(); + _exeResources->loadFromEXE("st.exe"); + } + + return nullptr; +} + +} // End of namespace Titanic diff --git a/engines/titanic/support/files_manager.h b/engines/titanic/support/files_manager.h new file mode 100644 index 0000000000..7915149412 --- /dev/null +++ b/engines/titanic/support/files_manager.h @@ -0,0 +1,96 @@ +/* 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. + * + */ + +#ifndef TITANIC_FILES_MANAGER_H +#define TITANIC_FILES_MANAGER_H + +#include "common/winexe_ne.h" +#include "titanic/core/list.h" +#include "titanic/support/screen_manager.h" + +namespace Titanic { + +class CGameManager; + +class CFilesManagerList : public List { +}; + +class CFilesManager { +private: + CGameManager *_gameManager; + Common::NEResources *_exeResources; + CFilesManagerList _list; + CString _string1; + CString _string2; + int _field0; + int _drive; + int _field18; + int _field1C; + int _field3C; + const CString _assetsPath; +public: + CFilesManager(); + ~CFilesManager(); + + /** + * Sets the game manager + */ + void setGameManager(CGameManager *gameManager) { + _gameManager = gameManager; + } + + /** + * Returns true if a file of the given name exists + */ + static bool fileExists(const CString &name); + + /** + * Scans for a file with a matching name + */ + bool scanForFile(const CString &name); + + /** + * Handles displaying a load drive view if necessary + */ + void loadDrive(); + + void debug(CScreenManager *screenManager); + + /** + * Resets the view being displayed + */ + void resetView(); + + void fn4(const CString &name); + + void fn5(const CString &name); + + /** + * Get a resource from the executable + */ + Common::SeekableReadStream *getResource(const CString &name, + const CString &area); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_FILES_MANAGER_H */ diff --git a/engines/titanic/support/font.cpp b/engines/titanic/support/font.cpp new file mode 100644 index 0000000000..6862baf79f --- /dev/null +++ b/engines/titanic/support/font.cpp @@ -0,0 +1,70 @@ +/* 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/textconsole.h" +#include "titanic/support/font.h" +#include "titanic/support/files_manager.h" +#include "titanic/titanic.h" + +namespace Titanic { + +STFont::STFont() { + _dataPtr = nullptr; + _dataSize = 0; + _field8 = 0; + _maxCharWidth = 0; + _field810 = 0; + _field814 = 0; + _field818 = 0; +} + +STFont::~STFont() { + delete[] _dataPtr; +} + +void STFont::load(int fontNumber) { + assert(!_dataPtr); + CString fontNumStr = CString::format("%d", fontNumber); + Common::SeekableReadStream *stream = g_vm->_filesManager.getResource( + fontNumStr, "STFont"); + if (!stream) + return; + + _field8 = stream->readUint32LE(); + _maxCharWidth = stream->readUint32LE(); + for (uint idx = 0; idx < 256; ++idx) + _chars[idx]._charWidth = stream->readUint32LE(); + for (uint idx = 0; idx < 256; ++idx) + _chars[idx]._offset = stream->readUint32LE(); + + _dataSize = stream->readUint32LE(); + _dataPtr = new byte[_dataSize]; + stream->read(_dataPtr, _dataSize); + + delete stream; +} + +void STFont::writeString(int maxWidth, const CString &text, int *v1, int *v2) { + warning("TODO: STFont::writeString"); +} + +} // End of namespace Titanic diff --git a/engines/titanic/support/font.h b/engines/titanic/support/font.h new file mode 100644 index 0000000000..0fff5125df --- /dev/null +++ b/engines/titanic/support/font.h @@ -0,0 +1,64 @@ +/* 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. + * + */ + +#ifndef TITANIC_FONT_H +#define TITANIC_FONT_H + +#include "common/scummsys.h" +#include "common/array.h" +#include "titanic/support/string.h" + +namespace Titanic { + +class STFont { + struct CharEntry { + uint _charWidth; + uint _offset; + }; +public: + byte *_dataPtr; + size_t _dataSize; + int _field8; + int _maxCharWidth; + Common::Array _chars; + int _field810; + int _field814; + int _field818; +public: + STFont(); + ~STFont(); + + /** + * Load a specified font + */ + void load(int fontNumber); + + /** + * Write out a string + * TODO: Verify this + */ + void writeString(int maxWidth, const CString &text, int *v1, int *v2); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_FONT_H */ diff --git a/engines/titanic/support/image.cpp b/engines/titanic/support/image.cpp new file mode 100644 index 0000000000..cabdd64cf3 --- /dev/null +++ b/engines/titanic/support/image.cpp @@ -0,0 +1,121 @@ +/* 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/file.h" +#include "titanic/support/image.h" + +namespace Titanic { + +BITMAPINFOHEADER::BITMAPINFOHEADER() { + _biSize = 0; + _biWidth = 0; + _biHeight = 0; + _biPlanes = 0; + _biBitCount = 0; + _biCompression = 0; + _biSizeImage = 0; + _biXPelsPerMeter = 0; + _biYPelsPerMeter = 0; + _biClrUsed = 0; + _biClrImportant = 0; +} + +/*------------------------------------------------------------------------*/ + +RGBQuad::RGBQuad() : _rgbRed(0), _rgbGreen(0), _rgbBlue(0), _rgbReserved(0) {} + +/*------------------------------------------------------------------------*/ + +Image::Image() { + _bitmapInfo = nullptr; + _bits = nullptr; + _flag = true; + + set(16, 16); +} + +void Image::proc6() { + +} + +void Image::set(int width, int height) { + delete _bitmapInfo; + if (_flag && _bitmapInfo) + delete[] _bits; + + _bitmapInfo = new tagBITMAPINFO; + _bits = new byte[(width + 3) & 0xFFFC * height]; + + tagBITMAPINFO &bi = *_bitmapInfo; + bi._bmiHeader._biWidth = width; + bi._bmiHeader._biHeight = height; + bi._bmiHeader._biPlanes = 1; + bi._bmiHeader._biBitCount = 8; +} + +void Image::proc8() { + +} + +bool Image::loadResource(const Common::String &name) { + // This method is hardcoded for the Titanic splash screen resource + assert(name == "TITANIC"); + + Common::File f; + if (!f.open("ST.exe")) + return false; + + // The ST.exe executable has a bitmap called "TITANIC". Since we can't use + // the Windows FindResource function in ScummVM, this is hardcoded for now + f.seek(0x29B660); + uint size = f.readUint32LE(); + if (size != 40) + return false; + + loadBitmap(f); + + return true; +} + +void Image::proc10() { + +} + +void Image::draw() { + +} + +void Image::loadBitmap(Common::SeekableReadStream &s) { + _bitmapInfo->_bmiHeader._biWidth = s.readUint32LE(); + _bitmapInfo->_bmiHeader._biHeight = s.readUint32LE(); + _bitmapInfo->_bmiHeader._biPlanes = s.readUint16LE(); + _bitmapInfo->_bmiHeader._biBitCount = s.readUint16LE(); + _bitmapInfo->_bmiHeader._biCompression = s.readUint32LE(); + _bitmapInfo->_bmiHeader._biSizeImage = s.readUint32LE(); + _bitmapInfo->_bmiHeader._biXPelsPerMeter = s.readUint32LE(); + _bitmapInfo->_bmiHeader._biYPelsPerMeter = s.readUint32LE(); + _bitmapInfo->_bmiHeader._biClrUsed = s.readUint32LE(); + _bitmapInfo->_bmiHeader._biClrImportant = s.readUint32LE(); + +} + +} // End of namespace Titanic diff --git a/engines/titanic/support/image.h b/engines/titanic/support/image.h new file mode 100644 index 0000000000..9030e81ad7 --- /dev/null +++ b/engines/titanic/support/image.h @@ -0,0 +1,82 @@ +/* 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. + * + */ + +#ifndef TITANIC_IMAGE_H +#define TITANIC_IMAGE_H + +#include "common/scummsys.h" +#include "common/array.h" + +namespace Titanic { + +struct BITMAPINFOHEADER { + int _biSize; + int _biWidth; + int _biHeight; + int _biPlanes; + int _biBitCount; + int _biCompression; + int _biSizeImage; + int _biXPelsPerMeter; + int _biYPelsPerMeter; + int _biClrUsed; + int _biClrImportant; + + BITMAPINFOHEADER(); +}; + +struct RGBQuad { + byte _rgbRed; + byte _rgbGreen; + byte _rgbBlue; + byte _rgbReserved; + + RGBQuad(); +}; + +struct tagBITMAPINFO { + BITMAPINFOHEADER _bmiHeader; + RGBQuad _bmiColors[256]; +}; + +class Image { +private: + void loadBitmap(Common::SeekableReadStream &s); +public: + tagBITMAPINFO *_bitmapInfo; + byte *_bits; + bool _flag; +public: + Image(); + virtual ~Image() {} + + virtual void proc6(); + virtual void set(int width, int height); + virtual void proc8(); + virtual bool loadResource(const Common::String &name); + virtual void proc10(); + virtual void draw(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_IMAGE_H */ diff --git a/engines/titanic/support/image_decoders.cpp b/engines/titanic/support/image_decoders.cpp new file mode 100644 index 0000000000..9fe55eb02b --- /dev/null +++ b/engines/titanic/support/image_decoders.cpp @@ -0,0 +1,79 @@ +/* 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 "titanic/support/image_decoders.h" + +namespace Titanic { + +void CJPEGDecode::decode(OSVideoSurface &surface, const CString &name) { + // Open up the resource + StdCWadFile file; + file.open(name); + + // Use the ScucmmVM deoder to decode it + loadStream(*file.readStream()); + const Graphics::Surface *srcSurf = getSurface(); + + // Resize the surface if necessary + if (!surface.hasSurface() || surface.getWidth() != srcSurf->w + || surface.getHeight() != srcSurf->h) + surface.resize(srcSurf->w, srcSurf->h); + + // Convert the decoded surface to the correct pixel format, and then copy it over + surface.lock(); + Graphics::Surface *convertedSurface = srcSurf->convertTo(surface._rawSurface->format); + + Common::copy((byte *)convertedSurface->getPixels(), (byte *)convertedSurface->getPixels() + + surface.getPitch() * surface.getHeight(), (byte *)surface._rawSurface->getPixels()); + + delete convertedSurface; + surface.unlock(); +} + +/*------------------------------------------------------------------------*/ + +void CTargaDecode::decode(OSVideoSurface &surface, const CString &name) { + // Open up the resource + StdCWadFile file; + file.open(name); + + // Use the ScucmmVM deoder to decode it + loadStream(*file.readStream()); + const Graphics::Surface *srcSurf = getSurface(); + + // Resize the surface if necessary + if (!surface.hasSurface() || surface.getWidth() != srcSurf->w + || surface.getHeight() != srcSurf->h) + surface.resize(srcSurf->w, srcSurf->h); + + // Convert the decoded surface to the correct pixel format, and then copy it over + surface.lock(); + Graphics::Surface *convertedSurface = srcSurf->convertTo(surface._rawSurface->format); + + Common::copy((byte *)convertedSurface->getPixels(), (byte *)convertedSurface->getPixels() + + surface.getPitch() * surface.getHeight(), (byte *)surface._rawSurface->getPixels()); + + delete convertedSurface; + surface.unlock(); +} + +} // End of namespace Titanic diff --git a/engines/titanic/support/image_decoders.h b/engines/titanic/support/image_decoders.h new file mode 100644 index 0000000000..b824b786a7 --- /dev/null +++ b/engines/titanic/support/image_decoders.h @@ -0,0 +1,52 @@ +/* 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. + * + */ + +#ifndef TITANIC_IMAGE_DECODERS_H +#define TITANIC_IMAGE_DECODERS_H + +#include "image/jpeg.h" +#include "image/tga.h" +#include "titanic/support/string.h" +#include "titanic/support/simple_file.h" +#include "titanic/support/video_surface.h" + +namespace Titanic { + +class CJPEGDecode : public Image::JPEGDecoder { +public: + /** + * Decode the image file onto the passed surface + */ + void decode(OSVideoSurface &surface, const CString &name); +}; + +class CTargaDecode : public Image::TGADecoder { +public: + /** + * Decode the image file onto the passed surface + */ + void decode(OSVideoSurface &surface, const CString &name); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_IMAGE_DECODERS_H */ diff --git a/engines/titanic/support/mouse_cursor.cpp b/engines/titanic/support/mouse_cursor.cpp new file mode 100644 index 0000000000..dda16c3b93 --- /dev/null +++ b/engines/titanic/support/mouse_cursor.cpp @@ -0,0 +1,113 @@ +/* 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 "graphics/cursorman.h" +#include "common/textconsole.h" +#include "titanic/support/mouse_cursor.h" +#include "titanic/support/movie.h" +#include "titanic/support/screen_manager.h" +#include "titanic/titanic.h" +#include "titanic/support/video_surface.h" +#include "titanic/core/resource_key.h" + +namespace Titanic { + +static const int CURSOR_DATA[NUM_CURSORS][4] = { + { 1, 136, 19, 18 }, + { 2, 139, 1, 1 }, + { 3, 140, 32, 1 }, + { 4, 137, 13, 0 }, + { 5, 145, 13, 0 }, + { 6, 144, 13, 22 }, + { 7, 137, 14, 0 }, + { 8, 148, 22, 40 }, + { 9, 136, 19, 18 }, + { 10, 143, 11, 11 }, + { 11, 146, 11, 11 }, + { 12, 136, 19, 18 }, + { 13, 136, 19, 25 }, + { 14, 136, 13, 22 }, + { 15, 138, 20, 28 } +}; + +CMouseCursor::CMouseCursor(CScreenManager *screenManager) : + _screenManager(screenManager), _cursorId(CURSOR_15) { + loadCursorImages(); + setCursor(CURSOR_1); +} + +CMouseCursor::~CMouseCursor() { + for (int idx = 0; idx < NUM_CURSORS; ++idx) + delete _cursors[idx]._videoSurface; +} + +void CMouseCursor::loadCursorImages() { + const CString name("ycursors.avi"); + const CResourceKey key(name); + g_vm->_filesManager.fn4(name); + + // Iterate through each cursor + for (int idx = 0; idx < NUM_CURSORS; ++idx) { + assert(CURSOR_DATA[idx][0] == (idx + 1)); + _cursors[idx]._centroid = Common::Point(CURSOR_DATA[idx][2], + CURSOR_DATA[idx][3]); + + CVideoSurface *surface = _screenManager->createSurface(64, 64); + _cursors[idx]._videoSurface = surface; + + OSMovie movie(key, surface); + movie.setFrame(idx); + _cursors[idx]._ptrUnknown = movie.proc21(); + surface->set40(_cursors[idx]._ptrUnknown); + } +} + +void CMouseCursor::show() { + CursorMan.showMouse(true); +} + +void CMouseCursor::hide() { + CursorMan.showMouse(false); +} + +void CMouseCursor::setCursor(CursorId cursorId) { + if (cursorId != _cursorId) { + CursorEntry &ce = _cursors[cursorId - 1]; + CVideoSurface &surface = *ce._videoSurface; + surface.lock(); + + // ***DEBUG*** Dummy cursor + Common::fill(surface.getPixels(), surface.getPixels() + 128, 0x5555); + + CursorMan.replaceCursor(surface.getPixels(), surface.getWidth(), surface.getHeight(), + ce._centroid.x, ce._centroid.y, 0, false, &g_vm->_screen->format); + surface.unlock(); + + _cursorId = cursorId; + } +} + +void CMouseCursor::update() { + // No implementation needed +} + +} // End of namespace Titanic diff --git a/engines/titanic/support/mouse_cursor.h b/engines/titanic/support/mouse_cursor.h new file mode 100644 index 0000000000..507f4ecc17 --- /dev/null +++ b/engines/titanic/support/mouse_cursor.h @@ -0,0 +1,97 @@ +/* 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. + * + */ + +#ifndef TITANIC_MOUSE_CURSOR_H +#define TITANIC_MOUSE_CURSOR_H + +#include "common/scummsys.h" +#include "common/rect.h" + +namespace Titanic { + +#define NUM_CURSORS 15 + +enum CursorId { + CURSOR_1 = 1, + CURSOR_2 = 3, + CURSOR_3 = 3, + CURSOR_4 = 4, + CURSOR_5 = 5, + CURSOR_6 = 6, + CURSOR_7 = 7, + CURSOR_8 = 8, + CURSOR_9 = 9, + CURSOR_10 = 10, + CURSOR_11 = 11, + CURSOR_12 = 12, + CURSOR_13 = 13, + CURSOR_14 = 14, + CURSOR_15 = 15 +}; + +class CScreenManager; +class CVideoSurface; + +class CMouseCursor { + struct CursorEntry { + CVideoSurface *_videoSurface; + void *_ptrUnknown; + Common::Point _centroid; + }; +private: + CScreenManager *_screenManager; + CursorId _cursorId; + CursorEntry _cursors[NUM_CURSORS]; + + /** + * Load the images for each cursor + */ + void loadCursorImages(); +public: + CMouseCursor(CScreenManager *screenManager); + ~CMouseCursor(); + + /** + * Make the mouse cursor visible + */ + void show(); + + /** + * Hide the mouse cursor + */ + void hide(); + + /** + * Set the cursor + */ + void setCursor(CursorId cursorId); + + /** + * Updates the mouse cursor + */ + void update(); +}; + + +} // End of namespace Titanic + +#endif /* TITANIC_MOUSE_CURSOR_H */ diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp new file mode 100644 index 0000000000..ed5cffaac1 --- /dev/null +++ b/engines/titanic/support/movie.cpp @@ -0,0 +1,114 @@ +/* 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 "titanic/support/movie.h" +#include "titanic/titanic.h" + +namespace Titanic { + +CMovie::CMovie() : ListItem(), _state(0), _field10(0) { +} + +bool CMovie::isActive() const { + return g_vm->_movieList.contains(this); +} + +bool CMovie::get10() { + if (_field10) { + _field10 = 0; + return true; + } else { + return false; + } +} + +/*------------------------------------------------------------------------*/ + +OSMovie::OSMovie(const CResourceKey &name, CVideoSurface *surface) : _videoSurface(surface) { +// _aviDecoder.loadFile(name.getString()); +} + +void OSMovie::proc8(int v1, CVideoSurface *surface) { + warning("TODO: OSMovie::proc8"); +} + +void OSMovie::proc9() { + warning("TODO: OSMovie::proc9"); +} + +void OSMovie::proc10() { + warning("TODO: OSMovie::proc10"); +} + +void OSMovie::proc11() { + warning("TODO: OSMovie::proc11"); +} + +void OSMovie::proc12() { + warning("TODO: OSMovie::proc12"); +} + +void OSMovie::stop() { + warning("TODO: OSMovie::proc13"); +} + +void OSMovie::proc14() { + warning("TODO: OSMovie::proc14"); +} + +void OSMovie::setFrame(uint frameNumber) { + warning("TODO: OSMovie::setFrame"); + /* + _aviDecoder.seekToFrame(frameNumber); + const Graphics::Surface *s = _aviDecoder.decodeNextFrame(); + + _videoSurface->blitFrom(Common::Point(0, 0), s); + */ +} + +void OSMovie::proc16() { + warning("TODO: OSMovie::proc16"); +} + +void OSMovie::proc17() { + warning("TODO: OSMovie::proc17"); +} + +void OSMovie::proc18() { + warning("TODO: OSMovie::proc18"); +} + +int OSMovie::proc19() { + warning("TODO: OSMovie::proc19"); + return 0; +} + +void OSMovie::proc20() { + warning("TODO: OSMovie::proc20"); +} + +void *OSMovie::proc21() { + warning("TODO: OSMovie::proc21"); + return nullptr; +} + +} // End of namespace Titanic diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h new file mode 100644 index 0000000000..3529409fa5 --- /dev/null +++ b/engines/titanic/support/movie.h @@ -0,0 +1,95 @@ +/* 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. + * + */ + +#ifndef TITANIC_MOVIE_H +#define TITANIC_MOVIE_H + +#include "video/avi_decoder.h" +#include "titanic/core/list.h" +#include "titanic/core/resource_key.h" + +namespace Titanic { + +class CVideoSurface; + +class CMovie : public ListItem { +protected: + int _state; + int _field10; +public: + CMovie(); + + virtual void proc8(int v1, CVideoSurface *surface) = 0; + virtual void proc9() = 0; + virtual void proc10() = 0; + virtual void proc11() = 0; + virtual void proc12() = 0; + virtual void stop() = 0; + virtual void proc14() = 0; + virtual void setFrame(uint frameNumber) = 0; + virtual void proc16() = 0; + virtual void proc17() = 0; + virtual void proc18() = 0; + virtual int proc19() = 0; + virtual void proc20() = 0; + virtual void *proc21() = 0; + + bool isActive() const; + + bool get10(); +}; + +class OSMovie : public CMovie { +private: + Video::AVIDecoder _aviDecoder; + CVideoSurface *_videoSurface; +public: + OSMovie(const CResourceKey &name, CVideoSurface *surface); + + virtual void proc8(int v1, CVideoSurface *surface); + virtual void proc9(); + virtual void proc10(); + virtual void proc11(); + virtual void proc12(); + virtual void stop(); + virtual void proc14(); + + /** + * Set the current frame number + */ + virtual void setFrame(uint frameNumber); + + virtual void proc16(); + virtual void proc17(); + virtual void proc18(); + virtual int proc19(); + virtual void proc20(); + virtual void *proc21(); +}; + +class CGlobalMovies : public List { +public: +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MOVIE_H */ diff --git a/engines/titanic/support/rect.cpp b/engines/titanic/support/rect.cpp new file mode 100644 index 0000000000..5fce4402cb --- /dev/null +++ b/engines/titanic/support/rect.cpp @@ -0,0 +1,44 @@ +/* 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 "titanic/support/rect.h" + +namespace Titanic { + +void Rect::combine(const Rect &r) { + if (isEmpty() || r.isEmpty()) + return; + + Common::Rect::extend(r); +} + +void Rect::constrain(const Rect &r) { + if (!isEmpty()) { + if (r.isEmpty()) { + clear(); + } else { + Common::Rect::clip(r); + } + } +} + +} // End of namespace Titanic diff --git a/engines/titanic/support/rect.h b/engines/titanic/support/rect.h new file mode 100644 index 0000000000..1661711870 --- /dev/null +++ b/engines/titanic/support/rect.h @@ -0,0 +1,61 @@ +/* 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. + * + */ + +#ifndef TITANIC_RECT_H +#define TITANIC_RECT_H + +#include "common/rect.h" + +namespace Titanic { + +typedef Common::Point Point; + +class Rect : public Common::Rect { +public: + Rect() : Common::Rect() {} + Rect(int16 w, int16 h) : Common::Rect(w, h) {} + Rect(int16 x1, int16 y1, int16 x2, int16 y2) : Common::Rect(x1, y1, x2, y2) {} + + /** + * Returns the top/left corner of the rect as a point + */ + operator const Point() { return Point(left, top); } + + /** + * Clear the rect + */ + void clear() { left = top = right = bottom = 0; } + + /** + * Combine another rect into this one + */ + void combine(const Rect &r); + + /** + * Constrains/clips to the intersection area of the given rect + */ + void constrain(const Rect &r); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_RECT_H */ diff --git a/engines/titanic/support/screen_manager.cpp b/engines/titanic/support/screen_manager.cpp new file mode 100644 index 0000000000..05dfa66854 --- /dev/null +++ b/engines/titanic/support/screen_manager.cpp @@ -0,0 +1,265 @@ +/* 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 "titanic/support/screen_manager.h" +#include "titanic/titanic.h" +#include "titanic/support/video_surface.h" + +namespace Titanic { + +CScreenManager *CScreenManager::_screenManagerPtr; +CScreenManager *CScreenManager::_currentScreenManagerPtr; + +CScreenManager::CScreenManager(TitanicEngine *vm): _vm(vm) { + _screenManagerPtr = nullptr; + _currentScreenManagerPtr = nullptr; + + _frontRenderSurface = nullptr; + _mouseCursor = nullptr; + _textCursor = nullptr; + _inputHandler = nullptr; + _fontNumber = 0; + // TODO: Further initialization + + _screenManagerPtr = this; +} + +CScreenManager::~CScreenManager() { + _screenManagerPtr = nullptr; +} + +void CScreenManager::setWindowHandle(int v) { + // Not needed +} + +bool CScreenManager::resetWindowHandle(int v) { + hideCursor(); + return true; +} + +CScreenManager *CScreenManager::setCurrent() { + if (!_currentScreenManagerPtr) + _currentScreenManagerPtr = _screenManagerPtr; + + return _currentScreenManagerPtr; +} + +void CScreenManager::setSurfaceBounds(SurfaceNum surfaceNum, const Rect &r) { + if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) + _backSurfaces[surfaceNum]._bounds = r; +} + +/*------------------------------------------------------------------------*/ + +OSScreenManager::OSScreenManager(TitanicEngine *vm): CScreenManager(vm), + _directDrawManager(vm, false) { + _field48 = 0; + _field4C = 0; + _field50 = 0; + _field54 = 0; +} + +OSScreenManager::~OSScreenManager() { + destroyFrontAndBackBuffers(); + delete _mouseCursor; + delete _textCursor; +} + +void OSScreenManager::setMode(int width, int height, int bpp, uint numBackSurfaces, bool flag2) { + assert(bpp == 16); + destroyFrontAndBackBuffers(); + _directDrawManager.initVideo(width, height, bpp, numBackSurfaces); + + _vm->_screen->create(width, height, g_system->getScreenFormat()); + _frontRenderSurface = new OSVideoSurface(this, nullptr); + _frontRenderSurface->setSurface(this, _directDrawManager._mainSurface); + + _backSurfaces.resize(numBackSurfaces); + for (uint idx = 0; idx < numBackSurfaces; ++idx) { + _backSurfaces[idx]._surface = new OSVideoSurface(this, nullptr); + _backSurfaces[idx]._surface->setSurface(this, _directDrawManager._backSurfaces[idx]); + } + + // Load fonts + _fonts[0].load(149); + _fonts[1].load(151); + _fonts[2].load(152); + _fonts[3].load(153); + + // Load the cursors + loadCursors(); +} + +void OSScreenManager::drawCursors() { + warning("OSScreenManager::drawCursors"); +} + +DirectDrawSurface *OSScreenManager::getDDSurface(SurfaceNum surfaceNum) { + if (surfaceNum == SURFACE_PRIMARY) + return _directDrawManager._mainSurface; + else if (surfaceNum < (int)_backSurfaces.size()) + return _directDrawManager._backSurfaces[surfaceNum]; + else + return nullptr; +} + +void OSScreenManager::proc6() {} +void OSScreenManager::proc7() {} + +CVideoSurface *OSScreenManager::getSurface(SurfaceNum surfaceNum) const { + if (surfaceNum == SURFACE_PRIMARY) + return _frontRenderSurface; + else if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) + return _backSurfaces[surfaceNum]._surface; + else + return nullptr; +} + +void OSScreenManager::proc9() {} + +void OSScreenManager::fillRect(SurfaceNum surfaceNum, Rect *rect, byte r, byte g, byte b) { + DirectDrawSurface *surface = getDDSurface(surfaceNum); + if (!surface) + return; + + // If bounds are provided, clip and use them. Otherwise, use entire surface area + Rect surfaceRect(0, 0, surface->getWidth(), surface->getHeight()); + Rect tempRect; + + if (rect) { + tempRect = *rect; + tempRect.clip(surfaceRect); + } else { + tempRect = surfaceRect; + } + + if (tempRect.isValidRect()) + surface->fillRect(&tempRect, r, g, b); +} + +void OSScreenManager::blitFrom(SurfaceNum surfaceNum, CVideoSurface *src, + const Point *destPos, const Rect *srcRect) { + // Get the dest surface + CVideoSurface *destSurface = _frontRenderSurface; + if (surfaceNum < -1) + return; + if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) + destSurface = _backSurfaces[surfaceNum]._surface; + if (!destSurface->hasSurface()) + return; + + Point destPoint = destPos ? *destPos : Point(0, 0); + Rect srcBounds = srcRect ? *srcRect : Rect(0, 0, src->getWidth(), src->getHeight()); + Rect *bounds = &srcBounds; + Rect rect2; + + if (surfaceNum >= 0 && !_backSurfaces[surfaceNum]._bounds.isEmpty()) { + // Perform clipping to the bounds of the back surface + rect2 = srcBounds; + rect2.translate(-srcBounds.left, -srcBounds.top); + rect2.translate(destPoint.x, destPoint.y); + rect2.constrain(_backSurfaces[surfaceNum]._bounds); + + rect2.translate(-destPoint.x, -destPoint.y); + rect2.translate(srcBounds.left, srcBounds.top); + + if (rect2.isEmpty()) + return; + + destPoint.x += rect2.left - srcBounds.left; + destPoint.y += rect2.top - srcBounds.top; + bounds = &rect2; + } + + if (!bounds->isEmpty()) + destSurface->blitFrom(destPoint, src, bounds); +} + +void OSScreenManager::proc12() {} +void OSScreenManager::proc13() {} +void OSScreenManager::proc14() {} +void OSScreenManager::proc15() {} + +void OSScreenManager::writeString(int maxWidth, const CString &text, int *v1, int *v2) { + _fonts[_fontNumber].writeString(maxWidth, text, v1, v2); +} + +void OSScreenManager::getFont() {} +void OSScreenManager::proc18() {} +void OSScreenManager::proc19() {} + +void OSScreenManager::clearSurface(SurfaceNum surfaceNum, Rect *bounds) { + if (surfaceNum == SURFACE_PRIMARY) + _directDrawManager._mainSurface->fill(bounds, 0); + else if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) + _directDrawManager._backSurfaces[surfaceNum]->fill(bounds, 0); +} + +void OSScreenManager::resizeSurface(CVideoSurface *surface, int width, int height) { + DirectDrawSurface *ddSurface = _directDrawManager.createSurface(width, height, 0); + surface->setSurface(this, ddSurface); +} + +CVideoSurface *OSScreenManager::createSurface(int w, int h) { + DirectDrawSurface *ddSurface = _directDrawManager.createSurface(w, h, 0); + return new OSVideoSurface(this, ddSurface); +} + +CVideoSurface *OSScreenManager::createSurface(const CResourceKey &key) { + return new OSVideoSurface(this, key); +} + +void OSScreenManager::proc23() {} +void OSScreenManager::proc24() {} +void OSScreenManager::proc25() {} + +void OSScreenManager::showCursor() { + +} + +void OSScreenManager::hideCursor() { + +} + +void OSScreenManager::destroyFrontAndBackBuffers() { + delete _frontRenderSurface; + _frontRenderSurface = nullptr; + + for (uint idx = 0; idx < _backSurfaces.size(); ++idx) + delete _backSurfaces[idx]._surface; + _backSurfaces.clear(); +} + +void OSScreenManager::loadCursors() { + if (_mouseCursor) { + hideCursor(); + delete _mouseCursor; + } + _mouseCursor = new CMouseCursor(this); + showCursor(); + + if (!_textCursor) { + _textCursor = new CTextCursor(); + } +} + +} // End of namespace Titanic diff --git a/engines/titanic/support/screen_manager.h b/engines/titanic/support/screen_manager.h new file mode 100644 index 0000000000..affe2ec0c9 --- /dev/null +++ b/engines/titanic/support/screen_manager.h @@ -0,0 +1,248 @@ +/* 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. + * + */ + +#ifndef TITANIC_SCREEN_MANAGER_H +#define TITANIC_SCREEN_MANAGER_H + +#include "common/scummsys.h" +#include "common/array.h" +#include "titanic/support/direct_draw.h" +#include "titanic/support/font.h" +#include "titanic/input_handler.h" +#include "titanic/support/mouse_cursor.h" +#include "titanic/support/text_cursor.h" +#include "titanic/support/video_surface.h" +#include "titanic/core/resource_key.h" + +namespace Titanic { + +/** + * The original used page flipping with one primary and one back buffer. + * Since we don't need that in ScummVM, the back buffer number below is + * remapped to the primary surface + */ +enum SurfaceNum { + SURFACE_PRIMARY = -1, + SURFACE_BACKBUFFER = -1 +}; + +class TitanicEngine; + +class CScreenManager { + struct VideoSurfaceEntry { + CVideoSurface *_surface; + Rect _bounds; + }; +protected: + TitanicEngine *_vm; +public: + static CScreenManager *_screenManagerPtr; + static CScreenManager *_currentScreenManagerPtr; + + /** + * Set the current screen manager + */ + static CScreenManager *setCurrent(); +public: + Common::Array _backSurfaces; + CVideoSurface *_frontRenderSurface; + CMouseCursor *_mouseCursor; + CTextCursor *_textCursor; + CInputHandler *_inputHandler; + int _fontNumber; +public: + CScreenManager(TitanicEngine *vm); + virtual ~CScreenManager(); + + void fn1() {} + void fn2() {} + + virtual void setWindowHandle(int v); + virtual bool resetWindowHandle(int v); + + /** + * Sets the video mode + */ + virtual void setMode(int width, int height, int bpp, uint numBackSurfaces, bool flag2) = 0; + + /** + * Handles drawing the cursors + */ + virtual void drawCursors() = 0; + + virtual void proc6() = 0; + virtual void proc7() = 0; + virtual CVideoSurface *getSurface(SurfaceNum surfaceNum) const = 0; + virtual void proc9() = 0; + + /** + * Fill an area with a specific color + */ + virtual void fillRect(SurfaceNum surfaceNum, Rect *rect, byte r, byte g, byte b) = 0; + + /** + * Blits a surface onto one of the screen surfaces + */ + virtual void blitFrom(SurfaceNum surfaceNum, CVideoSurface *src, const Point *destPos = nullptr, + const Rect *srcRect = nullptr) = 0; + + virtual void proc12() = 0; + virtual void proc13() = 0; + virtual void proc14() = 0; + virtual void proc15() = 0; + + + /** + * Write out a string + */ + virtual void writeString(int maxWidth, const CString &text, int *v1, int *v2) = 0; + + virtual void getFont() = 0; + virtual void proc18() = 0; + virtual void proc19() = 0; + + /** + * Clear a portion of a specified surface + */ + virtual void clearSurface(SurfaceNum surfaceNum, Rect *_bounds) = 0; + + /** + * Resize the passed surface + */ + virtual void resizeSurface(CVideoSurface *surface, int width, int height) = 0; + + /** + * Creates a surface of a given size + */ + virtual CVideoSurface *createSurface(int w, int h) = 0; + + /** + * Creates a surface from a specified resource + */ + virtual CVideoSurface *createSurface(const CResourceKey &key) = 0; + + virtual void proc24() = 0; + virtual void proc25() = 0; + virtual void showCursor() = 0; + virtual void hideCursor() = 0; + + void setSurfaceBounds(SurfaceNum surfaceNum, const Rect &r); +}; + +class OSScreenManager: CScreenManager { +private: + DirectDrawManager _directDrawManager; + + /** + * Frees any surface buffers + */ + void destroyFrontAndBackBuffers(); + + /** + * Load game cursors + */ + void loadCursors(); + + /** + * Gets an underlying surface + */ + DirectDrawSurface *getDDSurface(SurfaceNum surfaceNum); +public: + int _field48; + int _field4C; + int _field50; + int _field54; + STFont _fonts[4]; +public: + OSScreenManager(TitanicEngine *vm); + virtual ~OSScreenManager(); + + /** + * Sets the video mode + */ + virtual void setMode(int width, int height, int bpp, uint numBackSurfaces, bool flag2); + + /** + * Handles drawing the cursors + */ + virtual void drawCursors(); + + virtual void proc6(); + virtual void proc7(); + virtual CVideoSurface *getSurface(SurfaceNum surfaceNum) const; + virtual void proc9(); + + /** + * Fill an area with a specific color + */ + virtual void fillRect(SurfaceNum surfaceNum, Rect *rect, byte r, byte g, byte b); + + /** + * Blits a surface onto one of the screen surfaces + */ + virtual void blitFrom(SurfaceNum surfaceNum, CVideoSurface *src, const Point *destPos, + const Rect *srcRect = nullptr); + + virtual void proc12(); + virtual void proc13(); + virtual void proc14(); + virtual void proc15(); + + /** + * Write out a string + */ + virtual void writeString(int maxWidth, const CString &text, int *v1, int *v2); + + virtual void getFont(); + virtual void proc18(); + virtual void proc19(); + + /** + * Clear a portion of the screen surface + */ + virtual void clearSurface(SurfaceNum surfaceNum, Rect *bounds); + + /** + * Resize the passed surface + */ + virtual void resizeSurface(CVideoSurface *surface, int width, int height); + + /** + * Creates a surface of a given size + */ + virtual CVideoSurface *createSurface(int w, int h); + + /** + * Creates a surface from a specified resource + */ + virtual CVideoSurface *createSurface(const CResourceKey &key); + + virtual void proc23(); + virtual void proc24(); + virtual void proc25(); + virtual void showCursor(); + virtual void hideCursor(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SCREEN_MANAGER_H */ diff --git a/engines/titanic/support/simple_file.cpp b/engines/titanic/support/simple_file.cpp new file mode 100644 index 0000000000..fccf6c5b4f --- /dev/null +++ b/engines/titanic/support/simple_file.cpp @@ -0,0 +1,385 @@ +/* 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/util.h" +#include "titanic/support/simple_file.h" + +namespace Titanic { + +bool File::open(const Common::String &name) { + if (!Common::File::open(name)) + error("Could not open file - %s", name.c_str()); + return true; +} + +/*------------------------------------------------------------------------*/ + +SimpleFile::SimpleFile(): _inStream(nullptr), _outStream(nullptr), _lineCount(1) { +} + +SimpleFile::~SimpleFile() { + close(); +} + +void SimpleFile::open(Common::SeekableReadStream *stream) { + close(); + _inStream = stream; +} + +void SimpleFile::open(Common::OutSaveFile *stream) { + close(); + _outStream = stream; +} + +void SimpleFile::close() { + if (_outStream) { + _outStream->finalize(); + delete _outStream; + _outStream = nullptr; + } + + if (_inStream) { + delete _inStream; + _inStream = nullptr; + } +} + +void SimpleFile::safeRead(void *dst, size_t count) { + if (unsafeRead(dst, count) != count) + error("Could not read %d bytes", (int)count); +} + +size_t SimpleFile::unsafeRead(void *dst, size_t count) { + assert(_inStream); + return _inStream->read(dst, count); +} + +size_t SimpleFile::write(const void *src, size_t count) { + assert(_outStream); + return _outStream->write(src, count); +} + +CString SimpleFile::readString() { + char c; + CString result; + bool backslashFlag = false; + + // First skip any spaces + do { + safeRead(&c, 1); + } while (Common::isSpace(c)); + + // Ensure we've found a starting quote for the string + if (c != '"') + error("Could not find starting quote"); + + bool endFlag = false; + while (!endFlag) { + // Read the next character + safeRead(&c, 1); + + if (backslashFlag) { + backslashFlag = false; + switch (c) { + case 'n': + result += '\n'; + break; + case 'r': + result += '\r'; + break; + case '\t': + result += '\t'; + break; + default: + result += c; + break; + } + } else { + switch (c) { + case '"': + endFlag = true; + break; + case '\\': + backslashFlag = true; + break; + default: + result += c; + break; + } + } + } + + // Return the string + return result; +} + +int SimpleFile::readNumber() { + char c; + int result = 0; + bool minusFlag = false; + + // First skip any spaces + do { + safeRead(&c, 1); + } while (Common::isSpace(c)); + + // Check for prefix sign + if (c == '+' || c == '-') { + minusFlag = c == '-'; + safeRead(&c, 1); + } + + // Read in the number + if (!Common::isDigit(c)) + error("Invalid number"); + + while (Common::isDigit(c)) { + result = result * 10 + (c - '0'); + safeRead(&c, 1); + } + + // Finally, if it's a minus value, then negate it + if (minusFlag) + result = -result; + + return result; +} + +double SimpleFile::readFloat() { + char c; + Common::String result; + + // First skip any spaces + do { + safeRead(&c, 1); + } while (Common::isSpace(c)); + + // Check for prefix sign + if (c == '+' || c == '-') { + result += c; + safeRead(&c, 1); + } + + // Read in the number + if (!Common::isDigit(c)) + error("Invalid number"); + + while (Common::isDigit(c) || c == '.') { + result += c; + safeRead(&c, 1); + } + + // Convert to a float and return it + float floatValue; + sscanf(result.c_str(), "%f", &floatValue); + + return floatValue; +} + +Point SimpleFile::readPoint() { + Point pt; + pt.x = readNumber(); + pt.y = readNumber(); + + return pt; +} + +Rect SimpleFile::readRect() { + Rect r; + r.left = readNumber(); + r.top = readNumber(); + r.right = readNumber(); + r.bottom = readNumber(); + + return r; +} + +void SimpleFile::readBuffer(char *buffer, size_t count) { + CString tempString = readString(); + if (buffer) { + strncpy(buffer, tempString.c_str(), count); + buffer[count - 1] = '\0'; + } +} + +void SimpleFile::writeLine(const CString &str) { + write(str.c_str(), str.size()); + write("\r\n", 2); +} + +void SimpleFile::writeString(const CString &str) { + if (str.empty()) + return; + + const char *msgP = str.c_str(); + char c; + + while ((c = *msgP++) != '\0') { + switch (c) { + case '\r': + write("\\r", 2); + break; + case '\n': + write("\\n", 2); + break; + case '\t': + write("\\t", 2); + break; + case '\"': + write("\\\"", 2); + break; + case '\\': + write("\\\\", 2); + break; + case '{': + write("\\{", 2); + break; + case '}': + write("\\}", 2); + break; + default: + write(&c, 1); + break; + } + } +} + +void SimpleFile::writeQuotedString(const CString &str) { + write("\"", 1); + writeString(str); + write("\" ", 2); +} + +void SimpleFile::writeQuotedLine(const CString &str, int indent) { + writeIndent(indent); + writeQuotedString(str); + write("\n", 1); +} + +void SimpleFile::writeNumber(int val) { + CString str = CString::format("%d ", val); + write(str.c_str(), str.size()); +} + +void SimpleFile::writeNumberLine(int val, int indent) { + writeIndent(indent); + writeNumber(val); + write("\n", 1); +} + +void SimpleFile::writeFloat(double val) { + Common::String valStr = Common::String::format("%f ", val); + write(valStr.c_str(), valStr.size()); +} + +void SimpleFile::writeFloatLine(double val, int indent) { + writeIndent(indent); + writeFloat(val); + write("\n", 1); +} + +void SimpleFile::writePoint(const Point &pt, int indent) { + writeIndent(indent); + writeNumber(pt.x); + writeNumber(pt.y); + write("\n", 1); +} + +void SimpleFile::writeRect(const Rect &r, int indent) { + writePoint(Point(r.left, r.top), indent); + writePoint(Point(r.right, r.bottom), indent); +} + +void SimpleFile::writeIndent(uint indent) { + for (uint idx = 0; idx < indent; ++idx) + write("\t", 1); +} + +bool SimpleFile::IsClassStart() { + char c; + + do { + safeRead(&c, 1); + } while (Common::isSpace(c)); + + assert(c == '{' || c == '}'); + return c == '{'; +} + +void SimpleFile::writeClassStart(const CString &classStr, int indent) { + write("\n", 1); + writeIndent(indent); + write("{\n", 2); + writeIndent(indent + 1); + writeQuotedString(classStr); + write("\n", 1); +} + +void SimpleFile::writeClassEnd(int indent) { + writeIndent(indent); + write("}\n", 2); +} + +/*------------------------------------------------------------------------*/ + +void StdCWadFile::open(const CString &name) { + File f; + + // Check for whether it is indeed a file/resource pair + int idx = name.indexOf('#'); + + if (idx < 0) { + // Nope, so open up file for standard reading + assert(!name.empty()); + f.open(name); + + SimpleFile::open(f.readStream(f.size())); + return; + } + + // Split up the name and resource, and get the resource index + CString filename = name.left(idx) + ".st"; + int extPos = name.lastIndexOf('.'); + CString resStr = name.mid(idx + 1, extPos - idx - 1); + int resIndex = resStr.readInt(); + + // Open up the index for access + f.open(filename); + int indexSize = f.readUint32LE() / 4; + assert(resIndex < indexSize); + + // Get the specific resource's offset, and size by also + // getting the offset of the following resource + f.seek(resIndex * 4); + uint resOffset = f.readUint32LE(); + uint nextOffset = (resIndex == (indexSize - 1)) ? f.size() : + f.readUint32LE(); + + // Read in the resource + f.seek(resOffset); + Common::SeekableReadStream *stream = f.readStream(nextOffset - resOffset); + SimpleFile::open(stream); + + f.close(); +} + +} // End of namespace Titanic diff --git a/engines/titanic/support/simple_file.h b/engines/titanic/support/simple_file.h new file mode 100644 index 0000000000..0ba7699088 --- /dev/null +++ b/engines/titanic/support/simple_file.h @@ -0,0 +1,236 @@ +/* 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. + * + */ + +#ifndef TITANIC_SIMPLE_FILE_H +#define TITANIC_SIMPLE_FILE_H + +#include "common/file.h" +#include "titanic/support/rect.h" +#include "common/savefile.h" +#include "common/stream.h" +#include "common/zlib.h" +#include "titanic/support/string.h" + +namespace Titanic { + +class Decompressor; +class DecompressorData; + +/** + * Simple ScummVM File descendent that throws a wobbly if + * the file it tries to open isn't present + */ +class File : public Common::File { +public: + virtual bool open(const Common::String &name); +}; + +/** + * This class implements basic reading and writing to files + */ +class SimpleFile { +protected: + Common::SeekableReadStream *_inStream; + Common::OutSaveFile *_outStream; + int _lineCount; +public: + SimpleFile(); + virtual ~SimpleFile(); + + /** + * Set up a stream for read access + */ + virtual void open(Common::SeekableReadStream *stream); + + /** + * Set up a stream for write access + */ + virtual void open(Common::OutSaveFile *stream); + + /** + * Close the file + */ + virtual void close(); + + /** + * Read from the file with validation + */ + virtual void safeRead(void *dst, size_t count); + + /** + * Read from the file + */ + virtual size_t unsafeRead(void *dst, size_t count); + + /** + * Write out data + */ + virtual size_t write(const void *src, size_t count); + + /** + * Read a string from the file + */ + CString readString(); + + /** + * Read a number from the file + */ + int readNumber(); + + /** + * Read a floating point number from the file + */ + double readFloat(); + + /** + * Read in a point + */ + Point readPoint(); + + /** + * Read in a rect + */ + Rect readRect(); + + /** + * Read a string and copy it into an optionally passed buffer + */ + void readBuffer(char *buffer = nullptr, size_t count = 0); + + /** + * Write a string line + */ + void writeLine(const CString &str); + + /** + * Write a string + */ + void writeString(const CString &str); + + /** + * Write a quoted string + */ + void writeQuotedString(const CString &str); + + /** + * Write a quoted string line + */ + void writeQuotedLine(const CString &str, int indent); + + /** + * Write a number to file + */ + void writeNumber(int val); + + /** + * Write a number line to file + */ + void writeNumberLine(int val, int indent); + + /** + * Write a floating point number + */ + void writeFloat(double val); + + /** + * Write a floating point number as a line + */ + void writeFloatLine(double val, int indent); + + /** + * Write out a point line + */ + void writePoint(const Point &pt, int indent); + + /** + * Write out a rect line + */ + void writeRect(const Rect &r, int indent); + + /** + * Write out a number of tabs to form an indent in the output + */ + void writeIndent(uint indent); + + /** + * Validates that the following non-space character is either + * an opening or closing squiggly bracket denoting a class + * definition start or end. Returns true if it's a class start + */ + bool IsClassStart(); + + /** + * Write the starting header for a class definition + */ + void writeClassStart(const CString &classStr, int indent); + + /** + * Write out the ending footer for a class definition + */ + void writeClassEnd(int indent); +}; + +/** + * Derived file that handles compressed files + */ +class CompressedFile : public SimpleFile { +public: + CompressedFile() : SimpleFile() {} + virtual ~CompressedFile() {} + + /** + * Set up a stream for read access + */ + virtual void open(Common::SeekableReadStream *stream) { + SimpleFile::open(Common::wrapCompressedReadStream(stream)); + } + + /** + * Set up a stream for write access + */ + virtual void open(Common::OutSaveFile *stream) { + SimpleFile::open(Common::wrapCompressedWriteStream(stream)); + } +}; + +/** + * Derived file that handles WAD archives containing multiple files + */ +class StdCWadFile : public SimpleFile { +public: + StdCWadFile() : SimpleFile() {} + virtual ~StdCWadFile() {} + + /** + * Open up the specified file + */ + void open(const CString &name); + + /** + * Return a reference to the read stream + */ + Common::SeekableReadStream *readStream() const { return _inStream; } +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SIMPLE_FILE_H */ diff --git a/engines/titanic/support/string.cpp b/engines/titanic/support/string.cpp new file mode 100644 index 0000000000..86dc0be0b0 --- /dev/null +++ b/engines/titanic/support/string.cpp @@ -0,0 +1,122 @@ +/* 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/algorithm.h" +#include "titanic/support/string.h" + +namespace Titanic { + +CString::CString(char c, uint32 len) : Common::String() { + ensureCapacity(len, false); + for (uint idx = 0; idx < len; ++idx) + (*this) += c; +} + +CString::CString(int val) : Common::String() { + char buffer[16]; + itoa(val, buffer, 10); + *this += buffer; +} + +CString CString::left(uint count) const { + return (count > size()) ? CString() : CString(c_str(), c_str() + count); +} + +CString CString::right(uint count) const { + uint strSize = size(); + return (count > strSize) ? CString() : + CString(c_str() + strSize - count, c_str() + strSize); +} + +CString CString::mid(uint start, uint count) const { + if (start >= size()) + return CString(); + else + return CString(c_str() + start, MIN(count, size() - start)); +} + +CString CString::mid(uint start) const { + uint strSize = size(); + assert(start <= strSize); + return mid(start, strSize - start); +} + +int CString::indexOf(char c) const { + const char *charP = strchr(c_str(), c); + return charP ? charP - c_str() : -1; +} + +int CString::lastIndexOf(char c) const { + const char *charP = strrchr(c_str(), c); + return charP ? charP - c_str() : -1; +} + +FileType CString::fileTypeSuffix() const { + CString ext = right(1); + if (ext == "0" || ext == "4") + return FILETYPE_IMAGE; + else if (ext == "1") + return FILETYPE_WAV; + else if (ext == "2" || ext == "3") + return FILETYPE_MOVIE; + + ext = right(3); + if (ext == "tga" || ext == "jpg") + return FILETYPE_IMAGE; + else if (ext == "wav") + return FILETYPE_WAV; + else if (ext == "avi" || ext == "mov") + return FILETYPE_MOVIE; + else if (ext == "dlg") + return FILETYPE_DLG; + else + return FILETYPE_UNKNOWN; +} + +ImageType CString::imageTypeSuffix() const { + CString ext = right(1); + if (ext == "0") + return IMAGETYPE_TARGA; + else if (ext == "4") + return IMAGETYPE_JPEG; + + ext = right(3); + if (ext == "tga") + return IMAGETYPE_TARGA; + else if (ext == "jpg") + return IMAGETYPE_JPEG; + else + return IMAGETYPE_UNKNOWN; +} + +CString CString::format(const char *fmt, ...) { + String output; + + va_list va; + va_start(va, fmt); + output = String::vformat(fmt, va); + va_end(va); + + return output; +} + +} // End of namespace Titanic diff --git a/engines/titanic/support/string.h b/engines/titanic/support/string.h new file mode 100644 index 0000000000..02775de067 --- /dev/null +++ b/engines/titanic/support/string.h @@ -0,0 +1,106 @@ +/* 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. + * + */ + +#ifndef TITANIC_STRING_H +#define TITANIC_STRING_H + +#include "common/scummsys.h" +#include "common/str.h" + +namespace Titanic { + +enum FileType { + FILETYPE_UNKNOWN = 0, FILETYPE_IMAGE = 1, FILETYPE_MOVIE = 2, + FILETYPE_WAV = 3, FILETYPE_DLG = 4 +}; + +enum ImageType { + IMAGETYPE_UNKNOWN = 0, IMAGETYPE_TARGA = 1, IMAGETYPE_JPEG = 2 +}; + +class CString : public Common::String { +public: + CString() : Common::String() {} + CString(const char *str) : Common::String(str) {} + CString(const char *str, uint32 len) : Common::String(str, len) {} + CString(const char *beginP, const char *endP) : Common::String(beginP, endP) {} + CString(const String &str) : Common::String(str) {} + CString(char c, uint32 len); + explicit CString(char c) : Common::String(c) {} + explicit CString(int val); + + /** + * Returns the left n characters of the string + */ + CString left(uint count) const; + + /** + * Returns the right n characters of the string + */ + CString right(uint count) const; + + /** + * Returns a substring from within the string + */ + CString mid(uint start, uint count) const; + + /** + * Returns a substring from within the string + */ + CString mid(uint start) const; + + /** + * Returns the index of the first occurance of a given character + */ + int indexOf(char c) const; + + /** + * Returns the index of the last occurance of a given character + */ + int lastIndexOf(char c) const; + + /** + * Returns the type of a filename based on it's extension + */ + FileType fileTypeSuffix() const; + + /** + * Returns the type of an image filename based on it's extension + */ + ImageType imageTypeSuffix() const; + + /** + * Parses the string as an integer and returns the value + */ + int readInt() const { + return atoi(c_str()); + } + + /** + * Format a string + */ + static CString format(const char *fmt, ...); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STRING_H */ diff --git a/engines/titanic/support/text_cursor.cpp b/engines/titanic/support/text_cursor.cpp new file mode 100644 index 0000000000..fd0c1d22dd --- /dev/null +++ b/engines/titanic/support/text_cursor.cpp @@ -0,0 +1,36 @@ +/* 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/textconsole.h" +#include "titanic/support/text_cursor.h" + +namespace Titanic { + +CTextCursor::CTextCursor() : _active(false) { +} + +Rect CTextCursor::getBounds() { + warning("CTextCursor::getBounds"); + return Rect(); +} + +} // End of namespace Titanic diff --git a/engines/titanic/support/text_cursor.h b/engines/titanic/support/text_cursor.h new file mode 100644 index 0000000000..b6480673eb --- /dev/null +++ b/engines/titanic/support/text_cursor.h @@ -0,0 +1,42 @@ +/* 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. + * + */ + +#ifndef TITANIC_TEXT_CURSOR_H +#define TITANIC_TEXT_CURSOR_H + +#include "common/scummsys.h" +#include "titanic/support/rect.h" + +namespace Titanic { + +class CTextCursor { +public: + bool _active; +public: + CTextCursor(); + + Rect getBounds(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TEXT_CURSOR_H */ diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp new file mode 100644 index 0000000000..6bba24de5f --- /dev/null +++ b/engines/titanic/support/video_surface.cpp @@ -0,0 +1,376 @@ +/* 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 "titanic/support/video_surface.h" +#include "titanic/support/image_decoders.h" +#include "titanic/support/screen_manager.h" + +namespace Titanic { + +int CVideoSurface::_videoSurfaceCounter = 0; + +CVideoSurface::CVideoSurface(CScreenManager *screenManager) : + _screenManager(screenManager), _rawSurface(nullptr), _movie(nullptr), + _pendingLoad(false), _blitStyleFlag(false), _blitFlag(false), + _field40(nullptr), _field44(4), _field48(0), _field50(1) { + _videoSurfaceNum = _videoSurfaceCounter++; +} + +CVideoSurface::~CVideoSurface() { + if (_ddSurface) + _videoSurfaceCounter -= freeSurface(); + --_videoSurfaceCounter; +} + +void CVideoSurface::setSurface(CScreenManager *screenManager, DirectDrawSurface *surface) { + _screenManager = screenManager; + _ddSurface = surface; +} + +void CVideoSurface::blitFrom(const Point &destPos, CVideoSurface *src, const Rect *srcRect) { + if (loadIfReady() && src->loadIfReady() && _ddSurface && src->_ddSurface) { + Rect srcBounds, destBounds; + clipBounds(srcBounds, destBounds, src, srcRect, &destPos); + + if (_blitStyleFlag) + blitRect2(srcBounds, destBounds, src); + else + blitRect1(srcBounds, destBounds, src); + } +} + +void CVideoSurface::blitFrom(const Point &destPos, const Graphics::Surface *src) { + lock(); + _rawSurface->blitFrom(*src, destPos); + unlock(); +} + +void CVideoSurface::clipBounds(Rect &srcRect, Rect &destRect, + CVideoSurface *srcSurface, const Rect *subRect, const Point *destPos) { + // Figure out initial source rect and dest rect, based on whether + // specific subRect and/or destPos have been passed + if (destPos) { + destRect.left = destPos->x; + destRect.top = destPos->y; + } else { + destRect.left = destRect.top = 0; + } + + if (subRect) { + destRect.right = destRect.left + subRect->width(); + destRect.bottom = destRect.top + subRect->height(); + srcRect = *subRect; + } else { + srcRect.right = srcRect.left + srcSurface->getWidth(); + srcRect.bottom = srcRect.top + srcSurface->getHeight(); + srcRect = Rect(0, 0, srcSurface->getWidth(), srcSurface->getHeight()); + } + + // Clip destination rect to be on-screen + if (destRect.left < 0) { + srcRect.left -= destRect.left; + destRect.left = 0; + } + if (destRect.top < 0) { + srcRect.top -= destRect.top; + destRect.top = 0; + } + if (destRect.right > getWidth()) { + srcRect.right += getWidth() - destRect.right; + destRect.right = getWidth(); + } + if (destRect.bottom > getHeight()) { + srcRect.bottom += getHeight() - destRect.bottom; + destRect.bottom = getHeight(); + } + + // Clip source rect to be within the source surface + if (srcRect.left < 0) { + destRect.left -= srcRect.left; + srcRect.left = 0; + } + if (srcRect.top < 0) { + destRect.top -= srcRect.top; + srcRect.top = 0; + } + if (srcRect.right > srcSurface->getWidth()) { + destRect.right += srcSurface->getWidth() - srcRect.right; + srcRect.right = srcSurface->getWidth(); + } + if (srcRect.bottom > srcSurface->getHeight()) { + destRect.bottom += srcSurface->getHeight() - srcRect.bottom; + srcRect.bottom = srcSurface->getHeight(); + } + + // Validate that the resulting rects are valid + if (destRect.left >= destRect.right || destRect.top >= destRect.bottom + || srcRect.left >= srcRect.right || srcRect.top >= srcRect.bottom) + error("Invalid rect"); +} + +void CVideoSurface::blitRect1(const Rect &srcRect, const Rect &destRect, CVideoSurface *src) { + src->lock(); + lock(); + + // TODO: Do it like the original does it + _rawSurface->transBlitFrom(*src->_rawSurface, srcRect, destRect, + getTransparencyColor()); + + src->unlock(); + unlock(); +} + +void CVideoSurface::blitRect2(const Rect &srcRect, const Rect &destRect, CVideoSurface *src) { + // TODO: Do it like the original does it + blitRect1(srcRect, destRect, src); +} + +uint CVideoSurface::getTransparencyColor() { + uint32 val = -(getPixelDepth() - 2); + val &= 0xFFFF8400; + val += 0xF81F; + return val; +} + +bool CVideoSurface::proc45() { + if (_field50) { + _field50 = 0; + return true; + } else if (_movie) { + return _movie->get10(); + } else { + return false; + } +} + +/*------------------------------------------------------------------------*/ + +OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, DirectDrawSurface *surface) : + CVideoSurface(screenManager) { + _ddSurface = surface; +} + +OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, const CResourceKey &key, bool pendingLoad) : + CVideoSurface(screenManager) { + _ddSurface = nullptr; + _pendingLoad = pendingLoad; + + if (_pendingLoad) { + loadResource(key); + } else { + _resourceKey = key; + load(); + } +} + +void OSVideoSurface::loadResource(const CResourceKey &key) { + _resourceKey = key; + _pendingLoad = true; + + if (hasSurface()) + load(); +} + +void OSVideoSurface::loadTarga(const CResourceKey &key) { + // Decode the image + CTargaDecode decoder; + decoder.decode(*this, key.getString()); + + if (getPixelDepth() == 2) + shiftColors(); + + _resourceKey = key; + +} + +void OSVideoSurface::loadJPEG(const CResourceKey &key) { + // Decode the image + CJPEGDecode decoder; + decoder.decode(*this, key.getString()); + + if (getPixelDepth() == 2) + shiftColors(); + + _resourceKey = key; +} + +void OSVideoSurface::loadMovie() { + warning("TODO"); +} + +bool OSVideoSurface::lock() { + if (!loadIfReady()) + return false; + + ++_lockCount; + _rawSurface = _ddSurface->lock(nullptr, 0); + return true; +} + +void OSVideoSurface::unlock() { + if (!--_lockCount) { + if (_rawSurface) + _ddSurface->unlock(); + _rawSurface = nullptr; + } +} + +bool OSVideoSurface::hasSurface() { + return _ddSurface != nullptr; +} + +int OSVideoSurface::getWidth() { + if (!loadIfReady()) + error("Could not load resource"); + + return _ddSurface->getWidth(); +} + +int OSVideoSurface::getHeight() { + if (!loadIfReady()) + error("Could not load resource"); + + return _ddSurface->getHeight(); +} + +int OSVideoSurface::getPitch() { + if (!loadIfReady()) + error("Could not load resource"); + + return _ddSurface->getPitch(); +} + +void OSVideoSurface::resize(int width, int height) { + freeSurface(); + + _screenManager->resizeSurface(this, width, height); + if (_ddSurface) + _videoSurfaceCounter += _ddSurface->getSize(); +} + +int OSVideoSurface::getPixelDepth() { + if (!loadIfReady()) + assert(0); + + lock(); + + int result = _rawSurface->format.bytesPerPixel; + if (result == 1) + // Paletted 8-bit images don't store the color directly in the pixels + result = 0; + + unlock(); + return result; +} + +bool OSVideoSurface::load() { + if (!_resourceKey.scanForFile()) + return false; + + switch (_resourceKey.fileTypeSuffix()) { + case FILETYPE_IMAGE: + switch (_resourceKey.imageTypeSuffix()) { + case IMAGETYPE_TARGA: + loadTarga(_resourceKey); + break; + case IMAGETYPE_JPEG: + loadJPEG(_resourceKey); + break; + default: + break; + } + return true; + + case FILETYPE_MOVIE: + loadMovie(); + return true; + + default: + return false; + } +} + +uint16 OSVideoSurface::getPixel(const Common::Point &pt) { + if (!loadIfReady()) + return 0; + + if (pt.x >= 0 && pt.y >= 0 && pt.x < getWidth() && pt.y < getHeight()) { + lock(); + uint16 pixel = *(uint16 *)_rawSurface->getBasePtr(pt.x, pt.y); + unlock(); + return pixel; + } else { + return getTransparencyColor(); + } +} + +void OSVideoSurface::shiftColors() { + if (!loadIfReady()) + return; + + // Currently no further processing is needed, since for ScummVM, + // we already convert 16-bit surfaces as soon as they're loaded +} + +void OSVideoSurface::proc32(int v1, CVideoSurface *surface) { + if (loadIfReady() && _movie) + _movie->proc8(v1, surface); +} + +void OSVideoSurface::stopMovie() { + if (_movie) + _movie->stop(); +} + +void OSVideoSurface::setMovieFrame(uint frameNumber) { + if (loadIfReady() && _movie) + _movie->setFrame(frameNumber); +} + +bool OSVideoSurface::loadIfReady() { + _videoSurfaceNum = _videoSurfaceCounter; + + if (hasSurface()) { + return true; + } else if (_pendingLoad) { + _field50 = 1; + load(); + return true; + } else { + return false; + } +} + +int OSVideoSurface::freeSurface() { + if (!_ddSurface) + return 0; + int surfaceSize = _ddSurface->getSize(); + + delete _movie; + _movie = nullptr; + delete _ddSurface; + _ddSurface = nullptr; + + return surfaceSize; +} + +} // End of namespace Titanic diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h new file mode 100644 index 0000000000..1de6a1dd34 --- /dev/null +++ b/engines/titanic/support/video_surface.h @@ -0,0 +1,306 @@ +/* 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. + * + */ + +#ifndef TITANIC_VIDEO_SURFACE_H +#define TITANIC_VIDEO_SURFACE_H + +#include "common/scummsys.h" +#include "common/array.h" +#include "titanic/support/font.h" +#include "titanic/support/direct_draw.h" +#include "titanic/support/movie.h" +#include "titanic/support/rect.h" +#include "titanic/core/list.h" +#include "titanic/core/resource_key.h" + +namespace Titanic { + +class CScreenManager; +class CJPEGDecode; +class CTargaDecode; + +class CVideoSurface : public ListItem { + friend class CJPEGDecode; + friend class CTargaDecode; +private: + /** + * Calculates blitting bounds + */ + void clipBounds(Rect &srcRect, Rect &destRect, CVideoSurface *srcSurface, + const Rect *subRect = nullptr, const Point *destPos = nullptr); + + void blitRect1(const Rect &srcRect, const Rect &destRect, CVideoSurface *src); + void blitRect2(const Rect &srcRect, const Rect &destRect, CVideoSurface *src); +protected: + static int _videoSurfaceCounter; +protected: + CScreenManager *_screenManager; + CResourceKey _resourceKey; + DirectDrawSurface *_ddSurface; + Graphics::ManagedSurface *_rawSurface; + bool _pendingLoad; + void *_field40; + int _field44; + int _field48; + int _videoSurfaceNum; + int _field50; + int _lockCount; +public: + CMovie *_movie; + bool _blitFlag; + bool _blitStyleFlag; +public: + CVideoSurface(CScreenManager *screenManager); + virtual ~CVideoSurface(); + + /** + * Set the underlying surface for this video surface + */ + void setSurface(CScreenManager *screenManager, DirectDrawSurface *surface); + + /** + * Load the surface with the passed resource + */ + virtual void loadResource(const CResourceKey &key) = 0; + + /** + * Loads a Targa image file specified by the resource key + */ + virtual void loadTarga(const CResourceKey &key) = 0; + + /** + * Loads a JPEG image file specified by the resource key + */ + virtual void loadJPEG(const CResourceKey &key) = 0; + + /** + * Loads a movie file specified by the resource key + */ + virtual void loadMovie() = 0; + + /** + * Lock the surface for direct access to the pixels + */ + virtual bool lock() = 0; + + /** + * Unlocks the surface after prior calls to lock() + */ + virtual void unlock() = 0; + + /** + * Returns true if an underlying raw surface has been set + */ + virtual bool hasSurface() = 0; + + /** + * Returns the width of the surface + */ + virtual int getWidth() = 0; + + /** + * Returns the height of the surface + */ + virtual int getHeight() = 0; + + /** + * Returns the pitch of the surface in bytes + */ + virtual int getPitch() = 0; + + /** + * Reiszes the surface + */ + virtual void resize(int width, int height) = 0; + + /** + * Returns the number of bytes per pixel in the surface + */ + virtual int getPixelDepth() = 0; + + /** + * Gets the pixel at the specified position within the surface + */ + virtual uint16 getPixel(const Common::Point &pt) = 0; + + /** + * Shifts the colors of the surface.. maybe greys it out? + */ + virtual void shiftColors() = 0; + + virtual void proc32(int v1, CVideoSurface *surface) = 0; + + /** + * Stops any movie currently attached to the surface + */ + virtual void stopMovie() = 0; + + /** + * Sets the movie to the specified frame number + */ + virtual void setMovieFrame(uint frameNumber) = 0; + + /** + * Loads the surface's resource if there's one pending + */ + virtual bool loadIfReady() = 0; + + /** + * Loads the surface data based on the currently set resource key + */ + virtual bool load() = 0; + + virtual bool proc45(); + + /** + * Frees the underlying surface + */ + virtual int freeSurface() { return 0; } + + + + /** + * Blit from another surface + */ + void blitFrom(const Point &destPos, CVideoSurface *src, const Rect *srcRect = nullptr); + + /** + * Blit from another surface + */ + void blitFrom(const Point &destPos, const Graphics::Surface *src); + + void set40(void *v) { _field40 = v; } + + uint16 *getPixels() { return (uint16 *)_rawSurface->getPixels(); } + + /** + * Returns the transparent color + */ + uint getTransparencyColor(); +}; + +class OSVideoSurface : public CVideoSurface { +public: + OSVideoSurface(CScreenManager *screenManager, DirectDrawSurface *surface); + OSVideoSurface(CScreenManager *screenManager, const CResourceKey &key, bool flag = false); + + /** + * Load the surface with the passed resource + */ + virtual void loadResource(const CResourceKey &key); + + /** + * Loads a Targa image file specified by the resource key + */ + virtual void loadTarga(const CResourceKey &key); + + /** + * Loads a JPEG image file specified by the resource key + */ + virtual void loadJPEG(const CResourceKey &key); + + /** + * Loads a movie file specified by the resource key + */ + virtual void loadMovie(); + + /** + * Lock the surface for direct access to the pixels + */ + virtual bool lock(); + + /** + * Unlocks the surface after prior calls to lock() + */ + virtual void unlock(); + + /** + * Returns true if an underlying raw surface has been set + */ + virtual bool hasSurface(); + + /** + * Returns the width of the surface + */ + virtual int getWidth(); + + /** + * Returns the height of the surface + */ + virtual int getHeight(); + + /** + * Returns the pitch of the surface in bytes + */ + virtual int getPitch(); + + /** + * Reiszes the surface + */ + virtual void resize(int width, int height); + + /** + * Returns the number of bytes per pixel in the surface + */ + virtual int getPixelDepth(); + + /** + * Gets the pixel at the specified position within the surface + */ + virtual uint16 getPixel(const Common::Point &pt); + + /** + * Shifts the colors of the surface.. maybe greys it out? + */ + virtual void shiftColors(); + + virtual void proc32(int v1, CVideoSurface *surface); + + /** + * Stops any movie currently attached to the surface + */ + virtual void stopMovie(); + + /** + * Sets the movie to the specified frame number + */ + virtual void setMovieFrame(uint frameNumber); + + /** + * Loads the surface's resource if there's one pending + */ + virtual bool loadIfReady(); + + /** + * Loads the surface data based on the currently set resource key + */ + virtual bool load(); + + /** + * Frees the underlying surface + */ + virtual int freeSurface(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_VIDEO_SURFACE_H */ diff --git a/engines/titanic/text_cursor.cpp b/engines/titanic/text_cursor.cpp deleted file mode 100644 index ae1f842adb..0000000000 --- a/engines/titanic/text_cursor.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* 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/textconsole.h" -#include "titanic/text_cursor.h" - -namespace Titanic { - -CTextCursor::CTextCursor() : _active(false) { -} - -Rect CTextCursor::getBounds() { - warning("CTextCursor::getBounds"); - return Rect(); -} - -} // End of namespace Titanic diff --git a/engines/titanic/text_cursor.h b/engines/titanic/text_cursor.h deleted file mode 100644 index 4b6be8f1c4..0000000000 --- a/engines/titanic/text_cursor.h +++ /dev/null @@ -1,42 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_TEXT_CURSOR_H -#define TITANIC_TEXT_CURSOR_H - -#include "common/scummsys.h" -#include "titanic/rect.h" - -namespace Titanic { - -class CTextCursor { -public: - bool _active; -public: - CTextCursor(); - - Rect getBounds(); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_TEXT_CURSOR_H */ diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index 6b85211194..a5549e463b 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -32,11 +32,11 @@ #include "graphics/screen.h" #include "titanic/debugger.h" #include "titanic/events.h" -#include "titanic/files_manager.h" +#include "titanic/support/files_manager.h" #include "titanic/main_game_window.h" -#include "titanic/movie.h" -#include "titanic/screen_manager.h" -#include "titanic/string.h" +#include "titanic/support/movie.h" +#include "titanic/support/screen_manager.h" +#include "titanic/support/string.h" /** * This is the namespace of the Titanic engine. diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index 6724baaa34..4cd892c3ba 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -23,7 +23,7 @@ #ifndef TITANIC_TRUE_TALK_MANAGER_H #define TITANIC_TRUE_TALK_MANAGER_H -#include "titanic/simple_file.h" +#include "titanic/support/simple_file.h" #include "titanic/true_talk/title_engine.h" #include "titanic/true_talk/tt_scripts.h" diff --git a/engines/titanic/true_talk/tt_named_script.h b/engines/titanic/true_talk/tt_named_script.h index 9186507e87..ec5c35c843 100644 --- a/engines/titanic/true_talk/tt_named_script.h +++ b/engines/titanic/true_talk/tt_named_script.h @@ -23,7 +23,7 @@ #ifndef TITANIC_TT_NAMED_SCRIPT_H #define TITANIC_TT_NAMED_SCRIPT_H -#include "titanic/simple_file.h" +#include "titanic/support/simple_file.h" #include "titanic/true_talk/tt_script_base.h" namespace Titanic { diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index cf940a4d32..60fdde0ff5 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -23,7 +23,7 @@ #ifndef TITANIC_TT_STRING_H #define TITANIC_TT_STRING_H -#include "titanic/string.h" +#include "titanic/support/string.h" namespace Titanic { diff --git a/engines/titanic/video_surface.cpp b/engines/titanic/video_surface.cpp deleted file mode 100644 index 520193f376..0000000000 --- a/engines/titanic/video_surface.cpp +++ /dev/null @@ -1,376 +0,0 @@ -/* 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 "titanic/video_surface.h" -#include "titanic/image_decoders.h" -#include "titanic/screen_manager.h" - -namespace Titanic { - -int CVideoSurface::_videoSurfaceCounter = 0; - -CVideoSurface::CVideoSurface(CScreenManager *screenManager) : - _screenManager(screenManager), _rawSurface(nullptr), _movie(nullptr), - _pendingLoad(false), _blitStyleFlag(false), _blitFlag(false), - _field40(nullptr), _field44(4), _field48(0), _field50(1) { - _videoSurfaceNum = _videoSurfaceCounter++; -} - -CVideoSurface::~CVideoSurface() { - if (_ddSurface) - _videoSurfaceCounter -= freeSurface(); - --_videoSurfaceCounter; -} - -void CVideoSurface::setSurface(CScreenManager *screenManager, DirectDrawSurface *surface) { - _screenManager = screenManager; - _ddSurface = surface; -} - -void CVideoSurface::blitFrom(const Point &destPos, CVideoSurface *src, const Rect *srcRect) { - if (loadIfReady() && src->loadIfReady() && _ddSurface && src->_ddSurface) { - Rect srcBounds, destBounds; - clipBounds(srcBounds, destBounds, src, srcRect, &destPos); - - if (_blitStyleFlag) - blitRect2(srcBounds, destBounds, src); - else - blitRect1(srcBounds, destBounds, src); - } -} - -void CVideoSurface::blitFrom(const Point &destPos, const Graphics::Surface *src) { - lock(); - _rawSurface->blitFrom(*src, destPos); - unlock(); -} - -void CVideoSurface::clipBounds(Rect &srcRect, Rect &destRect, - CVideoSurface *srcSurface, const Rect *subRect, const Point *destPos) { - // Figure out initial source rect and dest rect, based on whether - // specific subRect and/or destPos have been passed - if (destPos) { - destRect.left = destPos->x; - destRect.top = destPos->y; - } else { - destRect.left = destRect.top = 0; - } - - if (subRect) { - destRect.right = destRect.left + subRect->width(); - destRect.bottom = destRect.top + subRect->height(); - srcRect = *subRect; - } else { - srcRect.right = srcRect.left + srcSurface->getWidth(); - srcRect.bottom = srcRect.top + srcSurface->getHeight(); - srcRect = Rect(0, 0, srcSurface->getWidth(), srcSurface->getHeight()); - } - - // Clip destination rect to be on-screen - if (destRect.left < 0) { - srcRect.left -= destRect.left; - destRect.left = 0; - } - if (destRect.top < 0) { - srcRect.top -= destRect.top; - destRect.top = 0; - } - if (destRect.right > getWidth()) { - srcRect.right += getWidth() - destRect.right; - destRect.right = getWidth(); - } - if (destRect.bottom > getHeight()) { - srcRect.bottom += getHeight() - destRect.bottom; - destRect.bottom = getHeight(); - } - - // Clip source rect to be within the source surface - if (srcRect.left < 0) { - destRect.left -= srcRect.left; - srcRect.left = 0; - } - if (srcRect.top < 0) { - destRect.top -= srcRect.top; - srcRect.top = 0; - } - if (srcRect.right > srcSurface->getWidth()) { - destRect.right += srcSurface->getWidth() - srcRect.right; - srcRect.right = srcSurface->getWidth(); - } - if (srcRect.bottom > srcSurface->getHeight()) { - destRect.bottom += srcSurface->getHeight() - srcRect.bottom; - srcRect.bottom = srcSurface->getHeight(); - } - - // Validate that the resulting rects are valid - if (destRect.left >= destRect.right || destRect.top >= destRect.bottom - || srcRect.left >= srcRect.right || srcRect.top >= srcRect.bottom) - error("Invalid rect"); -} - -void CVideoSurface::blitRect1(const Rect &srcRect, const Rect &destRect, CVideoSurface *src) { - src->lock(); - lock(); - - // TODO: Do it like the original does it - _rawSurface->transBlitFrom(*src->_rawSurface, srcRect, destRect, - getTransparencyColor()); - - src->unlock(); - unlock(); -} - -void CVideoSurface::blitRect2(const Rect &srcRect, const Rect &destRect, CVideoSurface *src) { - // TODO: Do it like the original does it - blitRect1(srcRect, destRect, src); -} - -uint CVideoSurface::getTransparencyColor() { - uint32 val = -(getPixelDepth() - 2); - val &= 0xFFFF8400; - val += 0xF81F; - return val; -} - -bool CVideoSurface::proc45() { - if (_field50) { - _field50 = 0; - return true; - } else if (_movie) { - return _movie->get10(); - } else { - return false; - } -} - -/*------------------------------------------------------------------------*/ - -OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, DirectDrawSurface *surface) : - CVideoSurface(screenManager) { - _ddSurface = surface; -} - -OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, const CResourceKey &key, bool pendingLoad) : - CVideoSurface(screenManager) { - _ddSurface = nullptr; - _pendingLoad = pendingLoad; - - if (_pendingLoad) { - loadResource(key); - } else { - _resourceKey = key; - load(); - } -} - -void OSVideoSurface::loadResource(const CResourceKey &key) { - _resourceKey = key; - _pendingLoad = true; - - if (hasSurface()) - load(); -} - -void OSVideoSurface::loadTarga(const CResourceKey &key) { - // Decode the image - CTargaDecode decoder; - decoder.decode(*this, key.getString()); - - if (getPixelDepth() == 2) - shiftColors(); - - _resourceKey = key; - -} - -void OSVideoSurface::loadJPEG(const CResourceKey &key) { - // Decode the image - CJPEGDecode decoder; - decoder.decode(*this, key.getString()); - - if (getPixelDepth() == 2) - shiftColors(); - - _resourceKey = key; -} - -void OSVideoSurface::loadMovie() { - warning("TODO"); -} - -bool OSVideoSurface::lock() { - if (!loadIfReady()) - return false; - - ++_lockCount; - _rawSurface = _ddSurface->lock(nullptr, 0); - return true; -} - -void OSVideoSurface::unlock() { - if (!--_lockCount) { - if (_rawSurface) - _ddSurface->unlock(); - _rawSurface = nullptr; - } -} - -bool OSVideoSurface::hasSurface() { - return _ddSurface != nullptr; -} - -int OSVideoSurface::getWidth() { - if (!loadIfReady()) - error("Could not load resource"); - - return _ddSurface->getWidth(); -} - -int OSVideoSurface::getHeight() { - if (!loadIfReady()) - error("Could not load resource"); - - return _ddSurface->getHeight(); -} - -int OSVideoSurface::getPitch() { - if (!loadIfReady()) - error("Could not load resource"); - - return _ddSurface->getPitch(); -} - -void OSVideoSurface::resize(int width, int height) { - freeSurface(); - - _screenManager->resizeSurface(this, width, height); - if (_ddSurface) - _videoSurfaceCounter += _ddSurface->getSize(); -} - -int OSVideoSurface::getPixelDepth() { - if (!loadIfReady()) - assert(0); - - lock(); - - int result = _rawSurface->format.bytesPerPixel; - if (result == 1) - // Paletted 8-bit images don't store the color directly in the pixels - result = 0; - - unlock(); - return result; -} - -bool OSVideoSurface::load() { - if (!_resourceKey.scanForFile()) - return false; - - switch (_resourceKey.fileTypeSuffix()) { - case FILETYPE_IMAGE: - switch (_resourceKey.imageTypeSuffix()) { - case IMAGETYPE_TARGA: - loadTarga(_resourceKey); - break; - case IMAGETYPE_JPEG: - loadJPEG(_resourceKey); - break; - default: - break; - } - return true; - - case FILETYPE_MOVIE: - loadMovie(); - return true; - - default: - return false; - } -} - -uint16 OSVideoSurface::getPixel(const Common::Point &pt) { - if (!loadIfReady()) - return 0; - - if (pt.x >= 0 && pt.y >= 0 && pt.x < getWidth() && pt.y < getHeight()) { - lock(); - uint16 pixel = *(uint16 *)_rawSurface->getBasePtr(pt.x, pt.y); - unlock(); - return pixel; - } else { - return getTransparencyColor(); - } -} - -void OSVideoSurface::shiftColors() { - if (!loadIfReady()) - return; - - // Currently no further processing is needed, since for ScummVM, - // we already convert 16-bit surfaces as soon as they're loaded -} - -void OSVideoSurface::proc32(int v1, CVideoSurface *surface) { - if (loadIfReady() && _movie) - _movie->proc8(v1, surface); -} - -void OSVideoSurface::stopMovie() { - if (_movie) - _movie->stop(); -} - -void OSVideoSurface::setMovieFrame(uint frameNumber) { - if (loadIfReady() && _movie) - _movie->setFrame(frameNumber); -} - -bool OSVideoSurface::loadIfReady() { - _videoSurfaceNum = _videoSurfaceCounter; - - if (hasSurface()) { - return true; - } else if (_pendingLoad) { - _field50 = 1; - load(); - return true; - } else { - return false; - } -} - -int OSVideoSurface::freeSurface() { - if (!_ddSurface) - return 0; - int surfaceSize = _ddSurface->getSize(); - - delete _movie; - _movie = nullptr; - delete _ddSurface; - _ddSurface = nullptr; - - return surfaceSize; -} - -} // End of namespace Titanic diff --git a/engines/titanic/video_surface.h b/engines/titanic/video_surface.h deleted file mode 100644 index de181581eb..0000000000 --- a/engines/titanic/video_surface.h +++ /dev/null @@ -1,306 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_VIDEO_SURFACE_H -#define TITANIC_VIDEO_SURFACE_H - -#include "common/scummsys.h" -#include "common/array.h" -#include "titanic/font.h" -#include "titanic/direct_draw.h" -#include "titanic/movie.h" -#include "titanic/rect.h" -#include "titanic/core/list.h" -#include "titanic/core/resource_key.h" - -namespace Titanic { - -class CScreenManager; -class CJPEGDecode; -class CTargaDecode; - -class CVideoSurface : public ListItem { - friend class CJPEGDecode; - friend class CTargaDecode; -private: - /** - * Calculates blitting bounds - */ - void clipBounds(Rect &srcRect, Rect &destRect, CVideoSurface *srcSurface, - const Rect *subRect = nullptr, const Point *destPos = nullptr); - - void blitRect1(const Rect &srcRect, const Rect &destRect, CVideoSurface *src); - void blitRect2(const Rect &srcRect, const Rect &destRect, CVideoSurface *src); -protected: - static int _videoSurfaceCounter; -protected: - CScreenManager *_screenManager; - CResourceKey _resourceKey; - DirectDrawSurface *_ddSurface; - Graphics::ManagedSurface *_rawSurface; - bool _pendingLoad; - void *_field40; - int _field44; - int _field48; - int _videoSurfaceNum; - int _field50; - int _lockCount; -public: - CMovie *_movie; - bool _blitFlag; - bool _blitStyleFlag; -public: - CVideoSurface(CScreenManager *screenManager); - virtual ~CVideoSurface(); - - /** - * Set the underlying surface for this video surface - */ - void setSurface(CScreenManager *screenManager, DirectDrawSurface *surface); - - /** - * Load the surface with the passed resource - */ - virtual void loadResource(const CResourceKey &key) = 0; - - /** - * Loads a Targa image file specified by the resource key - */ - virtual void loadTarga(const CResourceKey &key) = 0; - - /** - * Loads a JPEG image file specified by the resource key - */ - virtual void loadJPEG(const CResourceKey &key) = 0; - - /** - * Loads a movie file specified by the resource key - */ - virtual void loadMovie() = 0; - - /** - * Lock the surface for direct access to the pixels - */ - virtual bool lock() = 0; - - /** - * Unlocks the surface after prior calls to lock() - */ - virtual void unlock() = 0; - - /** - * Returns true if an underlying raw surface has been set - */ - virtual bool hasSurface() = 0; - - /** - * Returns the width of the surface - */ - virtual int getWidth() = 0; - - /** - * Returns the height of the surface - */ - virtual int getHeight() = 0; - - /** - * Returns the pitch of the surface in bytes - */ - virtual int getPitch() = 0; - - /** - * Reiszes the surface - */ - virtual void resize(int width, int height) = 0; - - /** - * Returns the number of bytes per pixel in the surface - */ - virtual int getPixelDepth() = 0; - - /** - * Gets the pixel at the specified position within the surface - */ - virtual uint16 getPixel(const Common::Point &pt) = 0; - - /** - * Shifts the colors of the surface.. maybe greys it out? - */ - virtual void shiftColors() = 0; - - virtual void proc32(int v1, CVideoSurface *surface) = 0; - - /** - * Stops any movie currently attached to the surface - */ - virtual void stopMovie() = 0; - - /** - * Sets the movie to the specified frame number - */ - virtual void setMovieFrame(uint frameNumber) = 0; - - /** - * Loads the surface's resource if there's one pending - */ - virtual bool loadIfReady() = 0; - - /** - * Loads the surface data based on the currently set resource key - */ - virtual bool load() = 0; - - virtual bool proc45(); - - /** - * Frees the underlying surface - */ - virtual int freeSurface() { return 0; } - - - - /** - * Blit from another surface - */ - void blitFrom(const Point &destPos, CVideoSurface *src, const Rect *srcRect = nullptr); - - /** - * Blit from another surface - */ - void blitFrom(const Point &destPos, const Graphics::Surface *src); - - void set40(void *v) { _field40 = v; } - - uint16 *getPixels() { return (uint16 *)_rawSurface->getPixels(); } - - /** - * Returns the transparent color - */ - uint getTransparencyColor(); -}; - -class OSVideoSurface : public CVideoSurface { -public: - OSVideoSurface(CScreenManager *screenManager, DirectDrawSurface *surface); - OSVideoSurface(CScreenManager *screenManager, const CResourceKey &key, bool flag = false); - - /** - * Load the surface with the passed resource - */ - virtual void loadResource(const CResourceKey &key); - - /** - * Loads a Targa image file specified by the resource key - */ - virtual void loadTarga(const CResourceKey &key); - - /** - * Loads a JPEG image file specified by the resource key - */ - virtual void loadJPEG(const CResourceKey &key); - - /** - * Loads a movie file specified by the resource key - */ - virtual void loadMovie(); - - /** - * Lock the surface for direct access to the pixels - */ - virtual bool lock(); - - /** - * Unlocks the surface after prior calls to lock() - */ - virtual void unlock(); - - /** - * Returns true if an underlying raw surface has been set - */ - virtual bool hasSurface(); - - /** - * Returns the width of the surface - */ - virtual int getWidth(); - - /** - * Returns the height of the surface - */ - virtual int getHeight(); - - /** - * Returns the pitch of the surface in bytes - */ - virtual int getPitch(); - - /** - * Reiszes the surface - */ - virtual void resize(int width, int height); - - /** - * Returns the number of bytes per pixel in the surface - */ - virtual int getPixelDepth(); - - /** - * Gets the pixel at the specified position within the surface - */ - virtual uint16 getPixel(const Common::Point &pt); - - /** - * Shifts the colors of the surface.. maybe greys it out? - */ - virtual void shiftColors(); - - virtual void proc32(int v1, CVideoSurface *surface); - - /** - * Stops any movie currently attached to the surface - */ - virtual void stopMovie(); - - /** - * Sets the movie to the specified frame number - */ - virtual void setMovieFrame(uint frameNumber); - - /** - * Loads the surface's resource if there's one pending - */ - virtual bool loadIfReady(); - - /** - * Loads the surface data based on the currently set resource key - */ - virtual bool load(); - - /** - * Frees the underlying surface - */ - virtual int freeSurface(); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_VIDEO_SURFACE_H */ -- cgit v1.2.3 From 2699efd633334be7fade6e890c0a9b32edc08677 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 3 Apr 2016 17:44:08 -0400 Subject: TITANIC: Fix reading resources from game executable --- engines/titanic/support/files_manager.cpp | 8 ++++---- engines/titanic/support/files_manager.h | 8 ++++---- engines/titanic/support/font.cpp | 5 ++--- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/engines/titanic/support/files_manager.cpp b/engines/titanic/support/files_manager.cpp index 179d77f24f..6cd6bfb5f2 100644 --- a/engines/titanic/support/files_manager.cpp +++ b/engines/titanic/support/files_manager.cpp @@ -93,14 +93,14 @@ void CFilesManager::fn5(const CString &name) { warning("TODO: CFilesManager::fn5"); } -Common::SeekableReadStream *CFilesManager::getResource(const CString &name, - const CString &area) { +Common::SeekableReadStream *CFilesManager::getResource( + Common::WinResourceID area, Common::WinResourceID name) { if (!_exeResources) { - _exeResources = new Common::NEResources(); + _exeResources = new Common::PEResources(); _exeResources->loadFromEXE("st.exe"); } - return nullptr; + return _exeResources->getResource(area, name); } } // End of namespace Titanic diff --git a/engines/titanic/support/files_manager.h b/engines/titanic/support/files_manager.h index 7915149412..ae664698ac 100644 --- a/engines/titanic/support/files_manager.h +++ b/engines/titanic/support/files_manager.h @@ -23,7 +23,7 @@ #ifndef TITANIC_FILES_MANAGER_H #define TITANIC_FILES_MANAGER_H -#include "common/winexe_ne.h" +#include "common/winexe_pe.h" #include "titanic/core/list.h" #include "titanic/support/screen_manager.h" @@ -37,7 +37,7 @@ class CFilesManagerList : public List { class CFilesManager { private: CGameManager *_gameManager; - Common::NEResources *_exeResources; + Common::PEResources *_exeResources; CFilesManagerList _list; CString _string1; CString _string2; @@ -87,8 +87,8 @@ public: /** * Get a resource from the executable */ - Common::SeekableReadStream *getResource(const CString &name, - const CString &area); + Common::SeekableReadStream *getResource(Common::WinResourceID area, + Common::WinResourceID name); }; } // End of namespace Titanic diff --git a/engines/titanic/support/font.cpp b/engines/titanic/support/font.cpp index 6862baf79f..3b48e5e301 100644 --- a/engines/titanic/support/font.cpp +++ b/engines/titanic/support/font.cpp @@ -43,11 +43,10 @@ STFont::~STFont() { void STFont::load(int fontNumber) { assert(!_dataPtr); - CString fontNumStr = CString::format("%d", fontNumber); Common::SeekableReadStream *stream = g_vm->_filesManager.getResource( - fontNumStr, "STFont"); + Common::WinResourceID("STFONT"), fontNumber); if (!stream) - return; + error("Could not locate the specified font"); _field8 = stream->readUint32LE(); _maxCharWidth = stream->readUint32LE(); -- cgit v1.2.3 From ebdc773247fb1e6a41f58ee8336986dcdc8e75d6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 3 Apr 2016 18:10:25 -0400 Subject: TITANIC: Implement font loading --- engines/titanic/support/font.cpp | 22 ++++++++++++++++++++++ engines/titanic/support/font.h | 7 ++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/engines/titanic/support/font.cpp b/engines/titanic/support/font.cpp index 3b48e5e301..6636a84f22 100644 --- a/engines/titanic/support/font.cpp +++ b/engines/titanic/support/font.cpp @@ -66,4 +66,26 @@ void STFont::writeString(int maxWidth, const CString &text, int *v1, int *v2) { warning("TODO: STFont::writeString"); } +int STFont::stringWidth(const CString &text) const { + if (text.empty()) + return 0; + + const char *srcP = text.c_str(); + int total = 0; + char c; + while (c = *srcP++) { + if (c == 26) { + // Skip over command parameter bytes + srcP += 3; + } else if (c == 27) { + // Skip over command parameter bytes + srcP += 4; + } else if (c != '\n') { + total += _chars[c]._charWidth; + } + } + + return total; +} + } // End of namespace Titanic diff --git a/engines/titanic/support/font.h b/engines/titanic/support/font.h index 0fff5125df..c41f4dc1e0 100644 --- a/engines/titanic/support/font.h +++ b/engines/titanic/support/font.h @@ -39,7 +39,7 @@ public: size_t _dataSize; int _field8; int _maxCharWidth; - Common::Array _chars; + CharEntry _chars[256]; int _field810; int _field814; int _field818; @@ -52,6 +52,11 @@ public: */ void load(int fontNumber); + /** + * Return the width in pixels of the specified text + */ + int stringWidth(const CString &text) const; + /** * Write out a string * TODO: Verify this -- cgit v1.2.3 From 56b29987443075faba0495d84eeaf42b443d577f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 4 Apr 2016 00:07:50 -0400 Subject: TITANIC: Further work on STFont character drawing --- engines/titanic/support/font.cpp | 82 +++++++++++++++++++++++++++---- engines/titanic/support/font.h | 36 +++++++++++--- engines/titanic/support/video_surface.cpp | 5 ++ engines/titanic/support/video_surface.h | 10 +++- 4 files changed, 117 insertions(+), 16 deletions(-) diff --git a/engines/titanic/support/font.cpp b/engines/titanic/support/font.cpp index 6636a84f22..32652588c0 100644 --- a/engines/titanic/support/font.cpp +++ b/engines/titanic/support/font.cpp @@ -30,11 +30,9 @@ namespace Titanic { STFont::STFont() { _dataPtr = nullptr; _dataSize = 0; - _field8 = 0; - _maxCharWidth = 0; - _field810 = 0; - _field814 = 0; - _field818 = 0; + _fontHeight = 0; + _dataWidth = 0; + _fontR = _fontG = _fontB = 0; } STFont::~STFont() { @@ -48,10 +46,10 @@ void STFont::load(int fontNumber) { if (!stream) error("Could not locate the specified font"); - _field8 = stream->readUint32LE(); - _maxCharWidth = stream->readUint32LE(); + _fontHeight = stream->readUint32LE(); + _dataWidth = stream->readUint32LE(); for (uint idx = 0; idx < 256; ++idx) - _chars[idx]._charWidth = stream->readUint32LE(); + _chars[idx]._width = stream->readUint32LE(); for (uint idx = 0; idx < 256; ++idx) _chars[idx]._offset = stream->readUint32LE(); @@ -62,6 +60,16 @@ void STFont::load(int fontNumber) { delete stream; } +void STFont::setColor(byte r, byte g, byte b) { + _fontR = r; + _fontG = g; + _fontB = b; +} + +uint16 STFont::getColor() const { + return g_system->getScreenFormat().RGBToColor(_fontR, _fontG, _fontB); +} + void STFont::writeString(int maxWidth, const CString &text, int *v1, int *v2) { warning("TODO: STFont::writeString"); } @@ -81,11 +89,67 @@ int STFont::stringWidth(const CString &text) const { // Skip over command parameter bytes srcP += 4; } else if (c != '\n') { - total += _chars[c]._charWidth; + total += _chars[c]._width; } } return total; } +int STFont::writeChar(CVideoSurface *surface, unsigned char c, const Common::Point &pt, Rect *destRect, Rect *srcRect) { + if (c == 233) + c = '$'; + + Rect tempRect; + tempRect.left = _chars[c]._offset; + tempRect.right = _chars[c]._offset + _chars[c]._width; + tempRect.top = 0; + tempRect.bottom = _fontHeight; + Point destPos(pt.x + destRect->left, pt.y + destRect->top); + + if (srcRect->isEmpty()) + srcRect = destRect; + if (destPos.y > srcRect->bottom) + return -2; + + if ((destPos.y + tempRect.height()) > srcRect->bottom) { + tempRect.bottom += tempRect.top - destPos.y; + } + + if (destPos.y < srcRect->top) { + if ((tempRect.height() + destPos.y) < srcRect->top) + return -1; + + tempRect.top += srcRect->top - destPos.y; + destPos.y = srcRect->top; + } + + if (destPos.x < srcRect->left) { + if ((tempRect.width() + destPos.x) < srcRect->left) + return -3; + + tempRect.left += srcRect->left - destPos.x; + destPos.x = srcRect->left; + } else { + if ((tempRect.width() + destPos.x) > srcRect->right) { + if (destPos.x > srcRect->right) + return -4; + + tempRect.right += srcRect->left - destPos.x; + } + } + + copyRect(surface, destPos, tempRect); + return 0; +} + +void STFont::copyRect(CVideoSurface *surface, const Common::Point &pt, Rect &rect) { + if (surface->lock()) { + uint16 *lineP = surface->getBasePtr(pt.x, pt.y); + uint16 color = getColor(); + + surface->unlock(); + } +} + } // End of namespace Titanic diff --git a/engines/titanic/support/font.h b/engines/titanic/support/font.h index c41f4dc1e0..5ed0b5b7b4 100644 --- a/engines/titanic/support/font.h +++ b/engines/titanic/support/font.h @@ -25,24 +25,38 @@ #include "common/scummsys.h" #include "common/array.h" +#include "titanic/support/rect.h" #include "titanic/support/string.h" namespace Titanic { +class CVideoSurface; + class STFont { struct CharEntry { - uint _charWidth; + uint _width; uint _offset; }; +private: + /** + * Copys a rectangle representing a character in the font data to + * a given destination position in the surface + */ + void copyRect(CVideoSurface *surface, const Common::Point &destPos, + Rect &srcRect); + + /** + * Write a character + */ + int writeChar(CVideoSurface *surface, unsigned char c, + const Common::Point &pt, Rect *destRect, Rect *srcRect); public: byte *_dataPtr; size_t _dataSize; - int _field8; - int _maxCharWidth; + int _fontHeight; + uint _dataWidth; CharEntry _chars[256]; - int _field810; - int _field814; - int _field818; + byte _fontR, _fontG, _fontB; public: STFont(); ~STFont(); @@ -62,6 +76,16 @@ public: * TODO: Verify this */ void writeString(int maxWidth, const CString &text, int *v1, int *v2); + + /** + * Sets the font color + */ + void setColor(byte r, byte g, byte b); + + /** + * Gets the font color + */ + uint16 getColor() const; }; } // End of namespace Titanic diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index 6bba24de5f..ebe552a062 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -373,4 +373,9 @@ int OSVideoSurface::freeSurface() { return surfaceSize; } +uint16 *OSVideoSurface::getBasePtr(int x, int y) { + assert(_rawSurface); + return (uint16 *)_rawSurface->getBasePtr(x, y); +} + } // End of namespace Titanic diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index 1de6a1dd34..da53270122 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -176,7 +176,10 @@ public: */ virtual int freeSurface() { return 0; } - + /** + * Get a pointer into the underlying surface + */ + virtual uint16 *getBasePtr(int x, int y) = 0; /** * Blit from another surface @@ -299,6 +302,11 @@ public: * Frees the underlying surface */ virtual int freeSurface(); + + /** + * Get a pointer into the underlying surface + */ + virtual uint16 *getBasePtr(int x, int y); }; } // End of namespace Titanic -- cgit v1.2.3 From 3acf1116cd7eff2f98538f8457f724ac25b28df1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 4 Apr 2016 07:54:02 -0400 Subject: TITANIC: Implemented STFont::copyRect --- engines/titanic/support/font.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/engines/titanic/support/font.cpp b/engines/titanic/support/font.cpp index 32652588c0..55865e792c 100644 --- a/engines/titanic/support/font.cpp +++ b/engines/titanic/support/font.cpp @@ -148,6 +148,14 @@ void STFont::copyRect(CVideoSurface *surface, const Common::Point &pt, Rect &rec uint16 *lineP = surface->getBasePtr(pt.x, pt.y); uint16 color = getColor(); + for (int yp = rect.top; yp < rect.bottom; ++yp, lineP += surface->getPitch()) { + uint16 *destP = lineP; + for (int xp = rect.left; xp < rect.right; ++xp, ++destP) { + const byte *srcP = _dataPtr + yp * _dataWidth + xp; + //surface->changePixel(destP, color, *srcP >> 3, 1); + } + } + surface->unlock(); } } -- cgit v1.2.3 From 572301a33efc8c574d7ab2fc9b243050b2db1492 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 4 Apr 2016 18:15:02 -0400 Subject: TITANIC: Implement OSVideoSurface::setupMap --- engines/titanic/support/video_surface.cpp | 32 +++++++++++++++++++++++++++++++ engines/titanic/support/video_surface.h | 22 +++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index ebe552a062..a1b26386b3 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -182,6 +182,34 @@ OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, const CResourceKey } } +void OSVideoSurface::setupMap(byte map[0x400], byte val) { + byte *pBase = map; + int incr = 0; + + for (uint idx1 = 0; idx1 < 32; ++idx1, pBase += 32) { + for (uint idx2 = 0, base = 0; idx2 < 32; ++idx2, base += incr) { + int64 v = 0x84210843; + v *= base; + v = ((v >> 32) + base) >> 4; + v += (v >> 31); + pBase[idx2] = v; + + if (val != 0xff) { + v &= 0xff; + if (v != idx2) { + v = 0x80808081 * val * v * val; + v = (v >> 32) + incr; + incr = idx1; + + v >>= 7; + v += (v >> 31); + pBase[idx2] = v; + } + } + } + } +} + void OSVideoSurface::loadResource(const CResourceKey &key) { _resourceKey = key; _pendingLoad = true; @@ -323,6 +351,10 @@ uint16 OSVideoSurface::getPixel(const Common::Point &pt) { } } +void OSVideoSurface::changePixel(uint16 *pixelP, uint16 color, int val3, int val5) { + // TODO +} + void OSVideoSurface::shiftColors() { if (!loadIfReady()) return; diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index da53270122..e1ddde8013 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -142,6 +142,11 @@ public: */ virtual uint16 getPixel(const Common::Point &pt) = 0; + /** + * Change a pixel + */ + virtual void changePixel(uint16 *pixelP, uint16 color, int val3, int val5) = 0; + /** * Shifts the colors of the surface.. maybe greys it out? */ @@ -202,6 +207,18 @@ public: }; class OSVideoSurface : public CVideoSurface { +private: + static byte _map[0x400]; + + /** + * Setup the color mapping table + */ + static void setupMap(byte map[0x400], byte val); +public: + /** + * Setup statics + */ + static void setup() { setupMap(_map, 0xff); } public: OSVideoSurface(CScreenManager *screenManager, DirectDrawSurface *surface); OSVideoSurface(CScreenManager *screenManager, const CResourceKey &key, bool flag = false); @@ -271,6 +288,11 @@ public: */ virtual uint16 getPixel(const Common::Point &pt); + /** + * Change a pixel + */ + virtual void changePixel(uint16 *pixelP, uint16 color, int val3, int val5); + /** * Shifts the colors of the surface.. maybe greys it out? */ -- cgit v1.2.3 From 303f577c4f9b36cd78f5104a2971a27263fb051c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 4 Apr 2016 22:18:18 -0400 Subject: TITANIC: Hacked copy of AVIDecoder to handle ycursors.avi Mouse cursor is now somewhat correctly showing --- engines/titanic/module.mk | 1 + engines/titanic/support/avi_decoder.cpp | 946 ++++++++++++++++++++++++++++++++ engines/titanic/support/avi_decoder.h | 285 ++++++++++ engines/titanic/support/movie.cpp | 21 +- engines/titanic/support/movie.h | 6 +- 5 files changed, 1250 insertions(+), 9 deletions(-) create mode 100644 engines/titanic/support/avi_decoder.cpp create mode 100644 engines/titanic/support/avi_decoder.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 441de8c1f3..a29d3df10f 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -422,6 +422,7 @@ MODULE_OBJS := \ star_control/star_control_sub13.o \ star_control/star_control_sub14.o \ star_control/star_control_sub15.o \ + support/avi_decoder.o \ support/direct_draw.o \ support/direct_draw_surface.o \ support/files_manager.o \ diff --git a/engines/titanic/support/avi_decoder.cpp b/engines/titanic/support/avi_decoder.cpp new file mode 100644 index 0000000000..81d8a58b8d --- /dev/null +++ b/engines/titanic/support/avi_decoder.cpp @@ -0,0 +1,946 @@ +/* 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/stream.h" +#include "common/system.h" +#include "common/textconsole.h" + +#include "audio/audiostream.h" +#include "audio/mixer.h" + +#include "titanic/support/avi_decoder.h" + +// Audio Codecs +#include "audio/decoders/adpcm.h" +#include "audio/decoders/mp3.h" +#include "audio/decoders/raw.h" + +// Video Codecs +#include "image/codecs/codec.h" + +namespace Titanic { + +#define UNKNOWN_HEADER(a) error("Unknown header found -- \'%s\'", tag2str(a)) + +// IDs used throughout the AVI files +// that will be handled by this player +#define ID_RIFF MKTAG('R','I','F','F') +#define ID_AVI MKTAG('A','V','I',' ') +#define ID_LIST MKTAG('L','I','S','T') +#define ID_HDRL MKTAG('h','d','r','l') +#define ID_AVIH MKTAG('a','v','i','h') +#define ID_STRL MKTAG('s','t','r','l') +#define ID_STRH MKTAG('s','t','r','h') +#define ID_VIDS MKTAG('v','i','d','s') +#define ID_AUDS MKTAG('a','u','d','s') +#define ID_MIDS MKTAG('m','i','d','s') +#define ID_TXTS MKTAG('t','x','t','s') +#define ID_JUNK MKTAG('J','U','N','K') +#define ID_JUNQ MKTAG('J','U','N','Q') +#define ID_DMLH MKTAG('d','m','l','h') +#define ID_STRF MKTAG('s','t','r','f') +#define ID_MOVI MKTAG('m','o','v','i') +#define ID_REC MKTAG('r','e','c',' ') +#define ID_VEDT MKTAG('v','e','d','t') +#define ID_IDX1 MKTAG('i','d','x','1') +#define ID_STRD MKTAG('s','t','r','d') +#define ID_INFO MKTAG('I','N','F','O') +#define ID_ISFT MKTAG('I','S','F','T') +#define ID_DISP MKTAG('D','I','S','P') +#define ID_PRMI MKTAG('P','R','M','I') +#define ID_STRN MKTAG('s','t','r','n') + +// Stream Types +enum { + kStreamTypePaletteChange = MKTAG16('p', 'c'), + kStreamTypeAudio = MKTAG16('w', 'b') +}; + + +AVIDecoder::AVIDecoder(Audio::Mixer::SoundType soundType) : _frameRateOverride(0), _soundType(soundType) { + initCommon(); +} + +AVIDecoder::AVIDecoder(const Common::Rational &frameRateOverride, Audio::Mixer::SoundType soundType) + : _frameRateOverride(frameRateOverride), _soundType(soundType) { + initCommon(); +} + +AVIDecoder::~AVIDecoder() { + close(); +} + +AVIDecoder::AVIAudioTrack *AVIDecoder::createAudioTrack(AVIStreamHeader sHeader, PCMWaveFormat wvInfo) { + return new AVIAudioTrack(sHeader, wvInfo, _soundType); +} + +void AVIDecoder::initCommon() { + _decodedHeader = false; + _foundMovieList = false; + _movieListStart = 0; + _movieListEnd = 0; + _fileStream = 0; + memset(&_header, 0, sizeof(_header)); +} + +bool AVIDecoder::isSeekable() const { + // Only videos with an index can seek + // Anyone else who wants to seek is crazy. + return isVideoLoaded() && !_indexEntries.empty(); +} + +bool AVIDecoder::parseNextChunk() { + uint32 tag = _fileStream->readUint32BE(); + uint32 size = _fileStream->readUint32LE(); + + if (_fileStream->eos()) + return false; + + debug(3, "Decoding tag %s", tag2str(tag)); + + switch (tag) { + case ID_LIST: + handleList(size); + break; + case ID_AVIH: + _header.size = size; + _header.microSecondsPerFrame = _fileStream->readUint32LE(); + _header.maxBytesPerSecond = _fileStream->readUint32LE(); + _header.padding = _fileStream->readUint32LE(); + _header.flags = _fileStream->readUint32LE(); + _header.totalFrames = _fileStream->readUint32LE(); + _header.initialFrames = _fileStream->readUint32LE(); + _header.streams = _fileStream->readUint32LE(); + _header.bufferSize = _fileStream->readUint32LE(); + _header.width = _fileStream->readUint32LE(); + _header.height = _fileStream->readUint32LE(); + // Ignore 16 bytes of reserved data + _fileStream->skip(16); + break; + case ID_STRH: + handleStreamHeader(size); + break; + case ID_STRD: // Extra stream info, safe to ignore + case ID_VEDT: // Unknown, safe to ignore + case ID_JUNK: // Alignment bytes, should be ignored + case ID_JUNQ: // Same as JUNK, safe to ignore + case ID_ISFT: // Metadata, safe to ignore + case ID_DISP: // Metadata, should be safe to ignore + case ID_STRN: // Metadata, safe to ignore + case ID_DMLH: // OpenDML extension, contains an extra total frames field, safe to ignore + skipChunk(size); + break; + case ID_IDX1: + readOldIndex(size); + break; + case 0: + return false; + default: + error("Unknown tag \'%s\' found", tag2str(tag)); + } + + return true; +} + +void AVIDecoder::skipChunk(uint32 size) { + // Make sure we're aligned on a word boundary + _fileStream->skip(size + (size & 1)); +} + +void AVIDecoder::handleList(uint32 listSize) { + uint32 listType = _fileStream->readUint32BE(); + listSize -= 4; // Subtract away listType's 4 bytes + uint32 curPos = _fileStream->pos(); + + debug(0, "Found LIST of type %s", tag2str(listType)); + + switch (listType) { + case ID_MOVI: // Movie List + // We found the movie block + _foundMovieList = true; + _movieListStart = curPos; + _movieListEnd = _movieListStart + listSize + (listSize & 1); + _fileStream->skip(listSize); + return; + case ID_HDRL: // Header List + // Mark the header as decoded + _decodedHeader = true; + break; + case ID_INFO: // Metadata + case ID_PRMI: // Adobe Premiere metadata, safe to ignore + // Ignore metadata + _fileStream->skip(listSize); + return; + case ID_STRL: // Stream list + default: // (Just hope we can parse it!) + break; + } + + while ((_fileStream->pos() - curPos) < listSize) + parseNextChunk(); +} + +void AVIDecoder::handleStreamHeader(uint32 size) { + AVIStreamHeader sHeader; + sHeader.size = size; + sHeader.streamType = _fileStream->readUint32BE(); + + if (sHeader.streamType == ID_MIDS || sHeader.streamType == ID_TXTS) + error("Unhandled MIDI/Text stream"); + + sHeader.streamHandler = _fileStream->readUint32BE(); + sHeader.flags = _fileStream->readUint32LE(); + sHeader.priority = _fileStream->readUint16LE(); + sHeader.language = _fileStream->readUint16LE(); + sHeader.initialFrames = _fileStream->readUint32LE(); + sHeader.scale = _fileStream->readUint32LE(); + sHeader.rate = _fileStream->readUint32LE(); + sHeader.start = _fileStream->readUint32LE(); + sHeader.length = _fileStream->readUint32LE(); + sHeader.bufferSize = _fileStream->readUint32LE(); + sHeader.quality = _fileStream->readUint32LE(); + sHeader.sampleSize = _fileStream->readUint32LE(); + + _fileStream->skip(sHeader.size - 48); // Skip over the remainder of the chunk (frame) + + if (_fileStream->readUint32BE() != ID_STRF) + error("Could not find STRF tag"); + + uint32 strfSize = _fileStream->readUint32LE(); + uint32 startPos = _fileStream->pos(); + + if (sHeader.streamType == ID_VIDS) { + if (_frameRateOverride != 0) { + sHeader.rate = _frameRateOverride.getNumerator(); + sHeader.scale = _frameRateOverride.getDenominator(); + } + + BitmapInfoHeader bmInfo; + bmInfo.size = _fileStream->readUint32LE(); + bmInfo.width = _fileStream->readUint32LE(); + bmInfo.height = _fileStream->readUint32LE(); + bmInfo.planes = _fileStream->readUint16LE(); + bmInfo.bitCount = _fileStream->readUint16LE(); + bmInfo.compression = _fileStream->readUint32BE(); + bmInfo.sizeImage = _fileStream->readUint32LE(); + bmInfo.xPelsPerMeter = _fileStream->readUint32LE(); + bmInfo.yPelsPerMeter = _fileStream->readUint32LE(); + bmInfo.clrUsed = _fileStream->readUint32LE(); + bmInfo.clrImportant = _fileStream->readUint32LE(); + + if (bmInfo.clrUsed == 0) + bmInfo.clrUsed = 256; + + byte *initialPalette = 0; + + if (bmInfo.bitCount == 8) { + initialPalette = new byte[256 * 3]; + memset(initialPalette, 0, 256 * 3); + + byte *palette = initialPalette; + for (uint32 i = 0; i < bmInfo.clrUsed; i++) { + palette[i * 3 + 2] = _fileStream->readByte(); + palette[i * 3 + 1] = _fileStream->readByte(); + palette[i * 3] = _fileStream->readByte(); + _fileStream->readByte(); + } + } + + addTrack(new AVIVideoTrack(_header.totalFrames, sHeader, bmInfo, initialPalette)); + } else if (sHeader.streamType == ID_AUDS) { + PCMWaveFormat wvInfo; + wvInfo.tag = _fileStream->readUint16LE(); + wvInfo.channels = _fileStream->readUint16LE(); + wvInfo.samplesPerSec = _fileStream->readUint32LE(); + wvInfo.avgBytesPerSec = _fileStream->readUint32LE(); + wvInfo.blockAlign = _fileStream->readUint16LE(); + wvInfo.size = _fileStream->readUint16LE(); + + // AVI seems to treat the sampleSize as including the second + // channel as well, so divide for our sake. + if (wvInfo.channels == 2) + sHeader.sampleSize /= 2; + + AVIAudioTrack *track = createAudioTrack(sHeader, wvInfo); + track->createAudioStream(); + addTrack(track); + } + + // Ensure that we're at the end of the chunk + _fileStream->seek(startPos + strfSize); +} + +bool AVIDecoder::loadStream(Common::SeekableReadStream *stream) { + close(); + + uint32 riffTag = stream->readUint32BE(); + if (riffTag != ID_RIFF) { + warning("Failed to find RIFF header"); + return false; + } + + /* uint32 fileSize = */ stream->readUint32LE(); + uint32 riffType = stream->readUint32BE(); + + if (riffType != ID_AVI) { + warning("RIFF not an AVI file"); + return false; + } + + _fileStream = stream; + + // Go through all chunks in the file + while (parseNextChunk()) + ; + + if (!_decodedHeader) { + warning("Failed to parse AVI header"); + close(); + return false; + } + + if (!_foundMovieList) { + warning("Failed to find 'MOVI' list"); + close(); + return false; + } + + // Create the status entries + uint32 index = 0; + for (TrackListIterator it = getTrackListBegin(); it != getTrackListEnd(); it++, index++) { + TrackStatus status; + status.track = *it; + status.index = index; + status.chunkSearchOffset = _movieListStart; + + if ((*it)->getTrackType() == Track::kTrackTypeVideo) { + if (_videoTracks.size() == 0) + _videoTracks.push_back(status); + } else { + if (_audioTracks.size() == 0) + _audioTracks.push_back(status); + } + } + + if (_videoTracks.size() != 1) { + warning("Unhandled AVI video track count: %d", _videoTracks.size()); + close(); + return false; + } + + // Check if this is a special Duck Truemotion video + checkTruemotion1(); + + return true; +} + +void AVIDecoder::close() { + VideoDecoder::close(); + + delete _fileStream; + _fileStream = 0; + _decodedHeader = false; + _foundMovieList = false; + _movieListStart = 0; + _movieListEnd = 0; + + _indexEntries.clear(); + memset(&_header, 0, sizeof(_header)); + + _videoTracks.clear(); + _audioTracks.clear(); +} + +void AVIDecoder::readNextPacket() { + // Shouldn't get this unless called on a non-open video + if (_videoTracks.empty()) + return; + + // Get the video frame first + handleNextPacket(_videoTracks[0]); + + // Handle audio tracks next + for (uint32 i = 0; i < _audioTracks.size(); i++) + handleNextPacket(_audioTracks[i]); +} + +void AVIDecoder::handleNextPacket(TrackStatus &status) { + // If there's no more to search, bail out + if (status.chunkSearchOffset + 8 >= _movieListEnd) { + if (status.track->getTrackType() == Track::kTrackTypeVideo) { + // Horrible AVI video has a premature end + // Force the frame to be the last frame + debug(0, "Forcing end of AVI video"); + ((AVIVideoTrack *)status.track)->forceTrackEnd(); + } + + return; + } + + // See if audio needs to be buffered and break out if not + if (status.track->getTrackType() == Track::kTrackTypeAudio && !shouldQueueAudio(status)) + return; + + // Seek to where we shall start searching + _fileStream->seek(status.chunkSearchOffset); + + for (;;) { + // If there's no more to search, bail out + if ((uint32)_fileStream->pos() + 8 >= _movieListEnd) { + if (status.track->getTrackType() == Track::kTrackTypeVideo) { + // Horrible AVI video has a premature end + // Force the frame to be the last frame + debug(0, "Forcing end of AVI video"); + ((AVIVideoTrack *)status.track)->forceTrackEnd(); + } + + break; + } + + uint32 nextTag = _fileStream->readUint32BE(); + uint32 size = _fileStream->readUint32LE(); + + if (nextTag == ID_LIST) { + // A list of audio/video chunks + if (_fileStream->readUint32BE() != ID_REC) + error("Expected 'rec ' LIST"); + + continue; + } else if (nextTag == ID_JUNK || nextTag == ID_IDX1) { + skipChunk(size); + continue; + } + + // Only accept chunks for this stream + uint32 streamIndex = getStreamIndex(nextTag); + if (streamIndex != status.index) { + skipChunk(size); + continue; + } + + Common::SeekableReadStream *chunk = 0; + + if (size != 0) { + chunk = _fileStream->readStream(size); + _fileStream->skip(size & 1); + } + + if (status.track->getTrackType() == Track::kTrackTypeAudio) { + if (getStreamType(nextTag) != kStreamTypeAudio) + error("Invalid audio track tag '%s'", tag2str(nextTag)); + + assert(chunk); + ((AVIAudioTrack *)status.track)->queueSound(chunk); + + // Break out if we have enough audio + if (!shouldQueueAudio(status)) + break; + } else { + AVIVideoTrack *videoTrack = (AVIVideoTrack *)status.track; + + if (getStreamType(nextTag) == kStreamTypePaletteChange) { + // Palette Change + videoTrack->loadPaletteFromChunk(chunk); + } else { + // Otherwise, assume it's a compressed frame + videoTrack->decodeFrame(chunk); + break; + } + } + } + + // Start us off in this position next time + status.chunkSearchOffset = _fileStream->pos(); +} + +bool AVIDecoder::shouldQueueAudio(TrackStatus& status) { + // Sanity check: + if (status.track->getTrackType() != Track::kTrackTypeAudio) + return false; + + // If video is done, make sure that the rest of the audio is queued + // (I guess this is also really a sanity check) + AVIVideoTrack *videoTrack = (AVIVideoTrack *)_videoTracks[0].track; + if (videoTrack->endOfTrack()) + return true; + + // Being three frames ahead should be enough for any video. + return ((AVIAudioTrack *)status.track)->getCurChunk() < (uint32)(videoTrack->getCurFrame() + 3); +} + +bool AVIDecoder::rewind() { + if (!VideoDecoder::rewind()) + return false; + + for (uint32 i = 0; i < _videoTracks.size(); i++) + _videoTracks[i].chunkSearchOffset = _movieListStart; + + for (uint32 i = 0; i < _audioTracks.size(); i++) + _audioTracks[i].chunkSearchOffset = _movieListStart; + + return true; +} + +bool AVIDecoder::seekIntern(const Audio::Timestamp &time) { + // Can't seek beyond the end + if (time > getDuration()) + return false; + + // Get our video + AVIVideoTrack *videoTrack = (AVIVideoTrack *)_videoTracks[0].track; + uint32 videoIndex = _videoTracks[0].index; + + // If we seek directly to the end, just mark the tracks as over + if (time == getDuration()) { + videoTrack->setCurFrame(videoTrack->getFrameCount() - 1); + + for (TrackListIterator it = getTrackListBegin(); it != getTrackListEnd(); it++) + if ((*it)->getTrackType() == Track::kTrackTypeAudio) + ((AVIAudioTrack *)*it)->resetStream(); + + return true; + } + + // Get the frame we should be on at this time + uint frame = videoTrack->getFrameAtTime(time); + + // Reset any palette, if necessary + videoTrack->useInitialPalette(); + + int lastKeyFrame = -1; + int frameIndex = -1; + uint curFrame = 0; + + // Go through and figure out where we should be + // If there's a palette, we need to find the palette too + for (uint32 i = 0; i < _indexEntries.size(); i++) { + const OldIndex &index = _indexEntries[i]; + + // We don't care about RECs + if (index.id == ID_REC) + continue; + + // We're only looking at entries for this track + if (getStreamIndex(index.id) != videoIndex) + continue; + + uint16 streamType = getStreamType(index.id); + + if (streamType == kStreamTypePaletteChange) { + // We need to handle any palette change we see since there's no + // flag to tell if this is a "key" palette. + // Decode the palette + _fileStream->seek(_indexEntries[i].offset + 8); + Common::SeekableReadStream *chunk = 0; + + if (_indexEntries[i].size != 0) + chunk = _fileStream->readStream(_indexEntries[i].size); + + videoTrack->loadPaletteFromChunk(chunk); + } else { + // Check to see if this is a keyframe + // The first frame has to be a keyframe + if ((_indexEntries[i].flags & AVIIF_INDEX) || curFrame == 0) + lastKeyFrame = i; + + // Did we find the target frame? + if (frame == curFrame) { + frameIndex = i; + break; + } + + curFrame++; + } + } + + if (frameIndex < 0) // This shouldn't happen. + return false; + + // Update all the audio tracks + for (uint32 i = 0; i < _audioTracks.size(); i++) { + AVIAudioTrack *audioTrack = (AVIAudioTrack *)_audioTracks[i].track; + + // Recreate the audio stream + audioTrack->resetStream(); + + // Set the chunk index for the track + audioTrack->setCurChunk(frame); + + uint32 chunksFound = 0; + for (uint32 j = 0; j < _indexEntries.size(); j++) { + const OldIndex &index = _indexEntries[j]; + + // Continue ignoring RECs + if (index.id == ID_REC) + continue; + + if (getStreamIndex(index.id) == _audioTracks[i].index) { + if (chunksFound == frame) { + _fileStream->seek(index.offset + 8); + Common::SeekableReadStream *audioChunk = _fileStream->readStream(index.size); + audioTrack->queueSound(audioChunk); + _audioTracks[i].chunkSearchOffset = (j == _indexEntries.size() - 1) ? _movieListEnd : _indexEntries[j + 1].offset; + break; + } + + chunksFound++; + } + } + + // Skip any audio to bring us to the right time + audioTrack->skipAudio(time, videoTrack->getFrameTime(frame)); + } + + // Decode from keyFrame to curFrame - 1 + for (int i = lastKeyFrame; i < frameIndex; i++) { + if (_indexEntries[i].id == ID_REC) + continue; + + if (getStreamIndex(_indexEntries[i].id) != videoIndex) + continue; + + uint16 streamType = getStreamType(_indexEntries[i].id); + + // Ignore palettes, they were already handled + if (streamType == kStreamTypePaletteChange) + continue; + + // Frame, hopefully + _fileStream->seek(_indexEntries[i].offset + 8); + Common::SeekableReadStream *chunk = 0; + + if (_indexEntries[i].size != 0) + chunk = _fileStream->readStream(_indexEntries[i].size); + + videoTrack->decodeFrame(chunk); + } + + // Set the video track's frame + videoTrack->setCurFrame((int)frame - 1); + + // Set the video track's search offset to the right spot + _videoTracks[0].chunkSearchOffset = _indexEntries[frameIndex].offset; + return true; +} + +byte AVIDecoder::getStreamIndex(uint32 tag) const { + char string[3]; + WRITE_BE_UINT16(string, tag >> 16); + string[2] = 0; + return strtol(string, 0, 16); +} + +void AVIDecoder::readOldIndex(uint32 size) { + uint32 entryCount = size / 16; + + debug(0, "Old Index: %d entries", entryCount); + + if (entryCount == 0) + return; + + // Read the first index separately + OldIndex firstEntry; + firstEntry.id = _fileStream->readUint32BE(); + firstEntry.flags = _fileStream->readUint32LE(); + firstEntry.offset = _fileStream->readUint32LE(); + firstEntry.size = _fileStream->readUint32LE(); + + // Check if the offset is already absolute + // If it's absolute, the offset will equal the start of the movie list + bool isAbsolute = firstEntry.offset == _movieListStart; + + debug(1, "Old index is %s", isAbsolute ? "absolute" : "relative"); + + if (!isAbsolute) + firstEntry.offset += _movieListStart - 4; + + debug(0, "Index 0: Tag '%s', Offset = %d, Size = %d (Flags = %d)", tag2str(firstEntry.id), firstEntry.offset, firstEntry.size, firstEntry.flags); + _indexEntries.push_back(firstEntry); + + for (uint32 i = 1; i < entryCount; i++) { + OldIndex indexEntry; + indexEntry.id = _fileStream->readUint32BE(); + indexEntry.flags = _fileStream->readUint32LE(); + indexEntry.offset = _fileStream->readUint32LE(); + indexEntry.size = _fileStream->readUint32LE(); + + // Adjust to absolute, if necessary + if (!isAbsolute) + indexEntry.offset += _movieListStart - 4; + + _indexEntries.push_back(indexEntry); + debug(0, "Index %d: Tag '%s', Offset = %d, Size = %d (Flags = %d)", i, tag2str(indexEntry.id), indexEntry.offset, indexEntry.size, indexEntry.flags); + } +} + +void AVIDecoder::checkTruemotion1() { + // If we got here from loadStream(), we know the track is valid + assert(!_videoTracks.empty()); + + TrackStatus &status = _videoTracks[0]; + AVIVideoTrack *track = (AVIVideoTrack *)status.track; + + // Ignore non-truemotion tracks + if (!track->isTruemotion1()) + return; + + // Read the next video packet + handleNextPacket(status); + + const Graphics::Surface *frame = track->decodeNextFrame(); + if (!frame) { + rewind(); + return; + } + + // Fill in the width/height based on the frame's width/height + _header.width = frame->w; + _header.height = frame->h; + track->forceDimensions(frame->w, frame->h); + + // Rewind us back to the beginning + rewind(); +} + +Video::VideoDecoder::AudioTrack *AVIDecoder::getAudioTrack(int index) { + // AVI audio track indexes are relative to the first track + Track *track = getTrack(index); + + if (!track || track->getTrackType() != Track::kTrackTypeAudio) + return 0; + + return (AudioTrack *)track; +} + +AVIDecoder::AVIVideoTrack::AVIVideoTrack(int frameCount, const AVIStreamHeader &streamHeader, const BitmapInfoHeader &bitmapInfoHeader, byte *initialPalette) + : _frameCount(frameCount), _vidsHeader(streamHeader), _bmInfo(bitmapInfoHeader), _initialPalette(initialPalette) { + _videoCodec = createCodec(); + _lastFrame = 0; + _curFrame = -1; + + useInitialPalette(); +} + +AVIDecoder::AVIVideoTrack::~AVIVideoTrack() { + delete _videoCodec; + delete[] _initialPalette; +} + +void AVIDecoder::AVIVideoTrack::decodeFrame(Common::SeekableReadStream *stream) { + if (stream) { + if (_videoCodec) + _lastFrame = _videoCodec->decodeFrame(*stream); + } else { + // Empty frame + _lastFrame = 0; + } + + delete stream; + _curFrame++; +} + +Graphics::PixelFormat AVIDecoder::AVIVideoTrack::getPixelFormat() const { + if (_videoCodec) + return _videoCodec->getPixelFormat(); + + return Graphics::PixelFormat(); +} + +void AVIDecoder::AVIVideoTrack::loadPaletteFromChunk(Common::SeekableReadStream *chunk) { + assert(chunk); + byte firstEntry = chunk->readByte(); + uint16 numEntries = chunk->readByte(); + chunk->readUint16LE(); // Reserved + + // 0 entries means all colors are going to be changed + if (numEntries == 0) + numEntries = 256; + + for (uint16 i = firstEntry; i < numEntries + firstEntry; i++) { + _palette[i * 3] = chunk->readByte(); + _palette[i * 3 + 1] = chunk->readByte(); + _palette[i * 3 + 2] = chunk->readByte(); + chunk->readByte(); // Flags that don't serve us any purpose + } + + delete chunk; + _dirtyPalette = true; +} + +void AVIDecoder::AVIVideoTrack::useInitialPalette() { + _dirtyPalette = false; + + if (_initialPalette) { + memcpy(_palette, _initialPalette, sizeof(_palette)); + _dirtyPalette = true; + } +} + +bool AVIDecoder::AVIVideoTrack::isTruemotion1() const { + return _bmInfo.compression == MKTAG('D', 'U', 'C', 'K') || _bmInfo.compression == MKTAG('d', 'u', 'c', 'k'); +} + +void AVIDecoder::AVIVideoTrack::forceDimensions(uint16 width, uint16 height) { + _bmInfo.width = width; + _bmInfo.height = height; +} + +bool AVIDecoder::AVIVideoTrack::rewind() { + _curFrame = -1; + + useInitialPalette(); + + delete _videoCodec; + _videoCodec = createCodec(); + _lastFrame = 0; + return true; +} + +Image::Codec *AVIDecoder::AVIVideoTrack::createCodec() { + return Image::createBitmapCodec(_bmInfo.compression, _bmInfo.width, _bmInfo.height, _bmInfo.bitCount); +} + +void AVIDecoder::AVIVideoTrack::forceTrackEnd() { + _curFrame = _frameCount - 1; +} + +const byte *AVIDecoder::AVIVideoTrack::getPalette() const { + if (_videoCodec && _videoCodec->containsPalette()) + return _videoCodec->getPalette(); + + _dirtyPalette = false; + return _palette; +} + +bool AVIDecoder::AVIVideoTrack::hasDirtyPalette() const { + if (_videoCodec && _videoCodec->containsPalette()) + return _videoCodec->hasDirtyPalette(); + + return _dirtyPalette; +} + +bool AVIDecoder::AVIVideoTrack::canDither() const { + return _videoCodec && _videoCodec->canDither(Image::Codec::kDitherTypeVFW); +} + +void AVIDecoder::AVIVideoTrack::setDither(const byte *palette) { + assert(_videoCodec); + _videoCodec->setDither(Image::Codec::kDitherTypeVFW, palette); +} + +AVIDecoder::AVIAudioTrack::AVIAudioTrack(const AVIStreamHeader &streamHeader, const PCMWaveFormat &waveFormat, Audio::Mixer::SoundType soundType) + : _audsHeader(streamHeader), _wvInfo(waveFormat), _soundType(soundType), _audioStream(0), _packetStream(0), _curChunk(0) { +} + +AVIDecoder::AVIAudioTrack::~AVIAudioTrack() { + delete _audioStream; +} + +void AVIDecoder::AVIAudioTrack::queueSound(Common::SeekableReadStream *stream) { + if (_packetStream) + _packetStream->queuePacket(stream); + else + delete stream; + + _curChunk++; +} + +void AVIDecoder::AVIAudioTrack::skipAudio(const Audio::Timestamp &time, const Audio::Timestamp &frameTime) { + Audio::Timestamp timeDiff = time.convertToFramerate(_wvInfo.samplesPerSec) - frameTime.convertToFramerate(_wvInfo.samplesPerSec); + int skipFrames = timeDiff.totalNumberOfFrames(); + + if (skipFrames <= 0) + return; + + Audio::AudioStream *audioStream = getAudioStream(); + if (!audioStream) + return; + + if (audioStream->isStereo()) + skipFrames *= 2; + + int16 *tempBuffer = new int16[skipFrames]; + audioStream->readBuffer(tempBuffer, skipFrames); + delete[] tempBuffer; +} + +void AVIDecoder::AVIAudioTrack::resetStream() { + delete _audioStream; + createAudioStream(); + _curChunk = 0; +} + +bool AVIDecoder::AVIAudioTrack::rewind() { + resetStream(); + return true; +} + +void AVIDecoder::AVIAudioTrack::createAudioStream() { + _packetStream = 0; + + switch (_wvInfo.tag) { + case kWaveFormatPCM: { + byte flags = 0; + if (_audsHeader.sampleSize == 2) + flags |= Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN; + else + flags |= Audio::FLAG_UNSIGNED; + + if (_wvInfo.channels == 2) + flags |= Audio::FLAG_STEREO; + + _packetStream = Audio::makePacketizedRawStream(_wvInfo.samplesPerSec, flags); + break; + } + case kWaveFormatMSADPCM: + _packetStream = Audio::makePacketizedADPCMStream(Audio::kADPCMMS, _wvInfo.samplesPerSec, _wvInfo.channels, _wvInfo.blockAlign); + break; + case kWaveFormatMSIMAADPCM: + _packetStream = Audio::makePacketizedADPCMStream(Audio::kADPCMMSIma, _wvInfo.samplesPerSec, _wvInfo.channels, _wvInfo.blockAlign); + break; + case kWaveFormatDK3: + _packetStream = Audio::makePacketizedADPCMStream(Audio::kADPCMDK3, _wvInfo.samplesPerSec, _wvInfo.channels, _wvInfo.blockAlign); + break; + case kWaveFormatMP3: +#ifdef USE_MAD + _packetStream = Audio::makePacketizedMP3Stream(_wvInfo.channels, _wvInfo.samplesPerSec); +#else + warning("AVI MP3 stream found, but no libmad support compiled in"); +#endif + break; + case kWaveFormatNone: + break; + default: + warning("Unsupported AVI audio format %d", _wvInfo.tag); + break; + } + + if (_packetStream) + _audioStream = _packetStream; + else + _audioStream = Audio::makeNullAudioStream(); +} + +AVIDecoder::TrackStatus::TrackStatus() : track(0), chunkSearchOffset(0) { +} + +} // End of namespace Titanic diff --git a/engines/titanic/support/avi_decoder.h b/engines/titanic/support/avi_decoder.h new file mode 100644 index 0000000000..acc33cbc4d --- /dev/null +++ b/engines/titanic/support/avi_decoder.h @@ -0,0 +1,285 @@ +/* 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. + * + */ + +#ifndef TITANIC_AVI_DECODER_H +#define TITANIC_AVI_DECODER_H + +#include "common/array.h" +#include "common/rational.h" +#include "common/rect.h" +#include "common/str.h" + +#include "video/video_decoder.h" +#include "audio/mixer.h" + +namespace Audio { +class AudioStream; +class PacketizedAudioStream; +} + +namespace Common { +class SeekableReadStream; +} + +namespace Graphics { +struct PixelFormat; +} + +namespace Image { +class Codec; +} + +namespace Titanic { + +/** + * Modified AVI Decoder used by Titanic engine. + */ +class AVIDecoder : public Video::VideoDecoder { +public: + AVIDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType); + AVIDecoder(const Common::Rational &frameRateOverride, Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType); + virtual ~AVIDecoder(); + + bool loadStream(Common::SeekableReadStream *stream); + void close(); + uint16 getWidth() const { return _header.width; } + uint16 getHeight() const { return _header.height; } + + bool rewind(); + bool isRewindable() const { return true; } + bool isSeekable() const; + +protected: + // VideoDecoder API + void readNextPacket(); + bool seekIntern(const Audio::Timestamp &time); + bool supportsAudioTrackSwitching() const { return true; } + AudioTrack *getAudioTrack(int index); + + struct BitmapInfoHeader { + uint32 size; + uint32 width; + uint32 height; + uint16 planes; + uint16 bitCount; + uint32 compression; + uint32 sizeImage; + uint32 xPelsPerMeter; + uint32 yPelsPerMeter; + uint32 clrUsed; + uint32 clrImportant; + }; + + struct WaveFormat { + uint16 tag; + uint16 channels; + uint32 samplesPerSec; + uint32 avgBytesPerSec; + uint16 blockAlign; + }; + + struct PCMWaveFormat : public WaveFormat { + uint16 size; + }; + + struct WaveFormatEX : public WaveFormat { + uint16 bitsPerSample; + uint16 size; + }; + + struct OldIndex { + uint32 id; + uint32 flags; + uint32 offset; + uint32 size; + }; + + // Index Flags + enum IndexFlags { + AVIIF_INDEX = 0x10 + }; + + struct AVIHeader { + uint32 size; + uint32 microSecondsPerFrame; + uint32 maxBytesPerSecond; + uint32 padding; + uint32 flags; + uint32 totalFrames; + uint32 initialFrames; + uint32 streams; + uint32 bufferSize; + uint32 width; + uint32 height; + }; + + // Flags from the AVIHeader + enum AVIFlags { + AVIF_HASINDEX = 0x00000010, + AVIF_MUSTUSEINDEX = 0x00000020, + AVIF_ISINTERLEAVED = 0x00000100, + AVIF_TRUSTCKTYPE = 0x00000800, + AVIF_WASCAPTUREFILE = 0x00010000, + AVIF_WASCOPYRIGHTED = 0x00020000 + }; + + struct AVIStreamHeader { + uint32 size; + uint32 streamType; + uint32 streamHandler; + uint32 flags; + uint16 priority; + uint16 language; + uint32 initialFrames; + uint32 scale; + uint32 rate; + uint32 start; + uint32 length; + uint32 bufferSize; + uint32 quality; + uint32 sampleSize; + Common::Rect frame; + }; + + class AVIVideoTrack : public FixedRateVideoTrack { + public: + AVIVideoTrack(int frameCount, const AVIStreamHeader &streamHeader, const BitmapInfoHeader &bitmapInfoHeader, byte *initialPalette = 0); + ~AVIVideoTrack(); + + void decodeFrame(Common::SeekableReadStream *stream); + void forceTrackEnd(); + + uint16 getWidth() const { return _bmInfo.width; } + uint16 getHeight() const { return _bmInfo.height; } + Graphics::PixelFormat getPixelFormat() const; + int getCurFrame() const { return _curFrame; } + int getFrameCount() const { return _frameCount; } + const Graphics::Surface *decodeNextFrame() { return _lastFrame; } + + const byte *getPalette() const; + bool hasDirtyPalette() const; + void setCurFrame(int frame) { _curFrame = frame; } + void loadPaletteFromChunk(Common::SeekableReadStream *chunk); + void useInitialPalette(); + bool canDither() const; + void setDither(const byte *palette); + + bool isTruemotion1() const; + void forceDimensions(uint16 width, uint16 height); + + bool isRewindable() const { return true; } + bool rewind(); + + protected: + Common::Rational getFrameRate() const { return Common::Rational(_vidsHeader.rate, _vidsHeader.scale); } + + private: + AVIStreamHeader _vidsHeader; + BitmapInfoHeader _bmInfo; + byte _palette[3 * 256]; + byte *_initialPalette; + mutable bool _dirtyPalette; + int _frameCount, _curFrame; + + Image::Codec *_videoCodec; + const Graphics::Surface *_lastFrame; + Image::Codec *createCodec(); + }; + + class AVIAudioTrack : public AudioTrack { + public: + AVIAudioTrack(const AVIStreamHeader &streamHeader, const PCMWaveFormat &waveFormat, Audio::Mixer::SoundType soundType); + ~AVIAudioTrack(); + + virtual void createAudioStream(); + virtual void queueSound(Common::SeekableReadStream *stream); + Audio::Mixer::SoundType getSoundType() const { return _soundType; } + void skipAudio(const Audio::Timestamp &time, const Audio::Timestamp &frameTime); + virtual void resetStream(); + uint32 getCurChunk() const { return _curChunk; } + void setCurChunk(uint32 chunk) { _curChunk = chunk; } + + bool isRewindable() const { return true; } + bool rewind(); + + protected: + Audio::AudioStream *getAudioStream() const { return _audioStream; } + + // Audio Codecs + enum { + kWaveFormatNone = 0, + kWaveFormatPCM = 1, + kWaveFormatMSADPCM = 2, + kWaveFormatMSIMAADPCM = 17, + kWaveFormatMP3 = 85, + kWaveFormatDK3 = 98 // rogue format number + }; + + AVIStreamHeader _audsHeader; + PCMWaveFormat _wvInfo; + Audio::Mixer::SoundType _soundType; + Audio::AudioStream *_audioStream; + Audio::PacketizedAudioStream *_packetStream; + uint32 _curChunk; + }; + + struct TrackStatus { + TrackStatus(); + + Track *track; + uint32 index; + uint32 chunkSearchOffset; + }; + + AVIHeader _header; + + void readOldIndex(uint32 size); + Common::Array _indexEntries; + + Common::SeekableReadStream *_fileStream; + bool _decodedHeader; + bool _foundMovieList; + uint32 _movieListStart, _movieListEnd; + + Audio::Mixer::SoundType _soundType; + Common::Rational _frameRateOverride; + void initCommon(); + + bool parseNextChunk(); + void skipChunk(uint32 size); + void handleList(uint32 listSize); + void handleStreamHeader(uint32 size); + uint16 getStreamType(uint32 tag) const { return tag & 0xFFFF; } + byte getStreamIndex(uint32 tag) const; + void checkTruemotion1(); + + void handleNextPacket(TrackStatus& status); + bool shouldQueueAudio(TrackStatus& status); + Common::Array _videoTracks, _audioTracks; + +public: + virtual AVIAudioTrack *createAudioTrack(AVIStreamHeader sHeader, PCMWaveFormat wvInfo); +}; + +} // End of namespace Titanic + +#endif diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index ed5cffaac1..25909183dd 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -20,6 +20,8 @@ * */ +#include "image/codecs/cinepak.h" +#include "titanic/support/avi_decoder.h" #include "titanic/support/movie.h" #include "titanic/titanic.h" @@ -44,7 +46,13 @@ bool CMovie::get10() { /*------------------------------------------------------------------------*/ OSMovie::OSMovie(const CResourceKey &name, CVideoSurface *surface) : _videoSurface(surface) { -// _aviDecoder.loadFile(name.getString()); + _video = new AVIDecoder(); + if (!_video->loadFile(name.getString())) + error("Could not open video - %s", name.getString().c_str()); +} + +OSMovie::~OSMovie() { + delete _video; } void OSMovie::proc8(int v1, CVideoSurface *surface) { @@ -76,13 +84,12 @@ void OSMovie::proc14() { } void OSMovie::setFrame(uint frameNumber) { - warning("TODO: OSMovie::setFrame"); - /* - _aviDecoder.seekToFrame(frameNumber); - const Graphics::Surface *s = _aviDecoder.decodeNextFrame(); + _video->seekToFrame(frameNumber); + const Graphics::Surface *s = _video->decodeNextFrame(); + Graphics::Surface *surf = s->convertTo(g_system->getScreenFormat()); - _videoSurface->blitFrom(Common::Point(0, 0), s); - */ + _videoSurface->blitFrom(Common::Point(0, 0), surf); + delete surf; } void OSMovie::proc16() { diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index 3529409fa5..e84e283597 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -23,7 +23,7 @@ #ifndef TITANIC_MOVIE_H #define TITANIC_MOVIE_H -#include "video/avi_decoder.h" +#include "video/video_decoder.h" #include "titanic/core/list.h" #include "titanic/core/resource_key.h" @@ -37,6 +37,7 @@ protected: int _field10; public: CMovie(); + virtual ~CMovie() {} virtual void proc8(int v1, CVideoSurface *surface) = 0; virtual void proc9() = 0; @@ -60,10 +61,11 @@ public: class OSMovie : public CMovie { private: - Video::AVIDecoder _aviDecoder; + Video::VideoDecoder *_video; CVideoSurface *_videoSurface; public: OSMovie(const CResourceKey &name, CVideoSurface *surface); + virtual ~OSMovie(); virtual void proc8(int v1, CVideoSurface *surface); virtual void proc9(); -- cgit v1.2.3 From f65849084cc88d61168742b02553fb269a9f064e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 5 Apr 2016 13:01:53 -0400 Subject: TITANIC: Fix display of initial cursor --- engines/titanic/support/mouse_cursor.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/engines/titanic/support/mouse_cursor.cpp b/engines/titanic/support/mouse_cursor.cpp index dda16c3b93..6db3618003 100644 --- a/engines/titanic/support/mouse_cursor.cpp +++ b/engines/titanic/support/mouse_cursor.cpp @@ -95,9 +95,6 @@ void CMouseCursor::setCursor(CursorId cursorId) { CVideoSurface &surface = *ce._videoSurface; surface.lock(); - // ***DEBUG*** Dummy cursor - Common::fill(surface.getPixels(), surface.getPixels() + 128, 0x5555); - CursorMan.replaceCursor(surface.getPixels(), surface.getWidth(), surface.getHeight(), ce._centroid.x, ce._centroid.y, 0, false, &g_vm->_screen->format); surface.unlock(); -- cgit v1.2.3 From 6f8de06ddb210f71f611e2cfcee106832d100a78 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 5 Apr 2016 13:19:43 -0400 Subject: TITANIC: Fix loading of ycursors.avi video that contains mouse cursors The mouse ccursor is now working correctly in-game, and correctly changing when different areas of the view are highlighted --- engines/titanic/support/avi_decoder.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/titanic/support/avi_decoder.cpp b/engines/titanic/support/avi_decoder.cpp index 81d8a58b8d..578e3a94ea 100644 --- a/engines/titanic/support/avi_decoder.cpp +++ b/engines/titanic/support/avi_decoder.cpp @@ -265,7 +265,10 @@ void AVIDecoder::handleStreamHeader(uint32 size) { } } - addTrack(new AVIVideoTrack(_header.totalFrames, sHeader, bmInfo, initialPalette)); + // WORKAROUND: For Titanic engine, the ycursors.avi file has two video tracks, + // so we do an explicit check below to ignore any second video track + if (getFrameCount() == 0) + addTrack(new AVIVideoTrack(_header.totalFrames, sHeader, bmInfo, initialPalette)); } else if (sHeader.streamType == ID_AUDS) { PCMWaveFormat wvInfo; wvInfo.tag = _fileStream->readUint16LE(); -- cgit v1.2.3 From 4f46928444acb1da4e7cd31ac816ad6c9e7c265d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 5 Apr 2016 20:15:14 -0400 Subject: TITANIC: Fix loading of game object bounds --- engines/titanic/core/game_object.cpp | 2 +- engines/titanic/support/simple_file.cpp | 15 +++++++++++++++ engines/titanic/support/simple_file.h | 10 ++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 26b78247ba..510e455656 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -96,7 +96,7 @@ void CGameObject::load(SimpleFile *file) { // Deliberate fall-through case 1: - _bounds = file->readRect(); + _bounds = file->readBounds(); _field34 = file->readFloat(); _field38 = file->readFloat(); _field3C = file->readFloat(); diff --git a/engines/titanic/support/simple_file.cpp b/engines/titanic/support/simple_file.cpp index fccf6c5b4f..88d74a9f47 100644 --- a/engines/titanic/support/simple_file.cpp +++ b/engines/titanic/support/simple_file.cpp @@ -213,6 +213,16 @@ Rect SimpleFile::readRect() { return r; } +Rect SimpleFile::readBounds() { + Rect r; + r.left = readNumber(); + r.top = readNumber(); + r.setWidth(readNumber()); + r.setHeight(readNumber()); + + return r; +} + void SimpleFile::readBuffer(char *buffer, size_t count) { CString tempString = readString(); if (buffer) { @@ -309,6 +319,11 @@ void SimpleFile::writeRect(const Rect &r, int indent) { writePoint(Point(r.right, r.bottom), indent); } +void SimpleFile::writeBounds(const Rect &r, int indent) { + writePoint(Point(r.left, r.top), indent); + writePoint(Point(r.width(), r.height()), indent); +} + void SimpleFile::writeIndent(uint indent) { for (uint idx = 0; idx < indent; ++idx) write("\t", 1); diff --git a/engines/titanic/support/simple_file.h b/engines/titanic/support/simple_file.h index 0ba7699088..115e3805da 100644 --- a/engines/titanic/support/simple_file.h +++ b/engines/titanic/support/simple_file.h @@ -111,6 +111,11 @@ public: */ Rect readRect(); + /** + * Rect in a bounds + */ + Rect readBounds(); + /** * Read a string and copy it into an optionally passed buffer */ @@ -166,6 +171,11 @@ public: */ void writeRect(const Rect &r, int indent); + /** + * Write out a bounds line + */ + void writeBounds(const Rect &r, int indent); + /** * Write out a number of tabs to form an indent in the output */ -- cgit v1.2.3 From 4e3ae0cf5642e62885e19ada83f922dd2fb91e1c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 5 Apr 2016 20:44:20 -0400 Subject: TITANIC: Fix setting cursor when highlighting object --- engines/titanic/core/view_item.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index 666d7e7105..47cdabbb50 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -252,7 +252,7 @@ bool CViewItem::handleMouseMsg(CMouseMsg *msg, bool flag) { for (int idx = (int)gameObjects.size() - 1; idx >= 0; ++idx) { if (gameObjects[idx]->_cursorId != CURSOR_12) { CScreenManager::_screenManagerPtr->_mouseCursor->setCursor(gameObjects[idx]->_cursorId); - break; + return true; } } } -- cgit v1.2.3 From 19e4bca41c6ecc1f4f71f04d919af75bc14f2d58 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 5 Apr 2016 21:14:34 -0400 Subject: TITANIC: Set up cursors enum with better names --- engines/titanic/core/game_object.cpp | 2 +- engines/titanic/core/link_item.cpp | 10 +++++----- engines/titanic/core/view_item.cpp | 6 +++--- engines/titanic/support/mouse_cursor.cpp | 4 ++-- engines/titanic/support/mouse_cursor.h | 30 +++++++++++++++--------------- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 510e455656..d66fa58cb4 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -47,7 +47,7 @@ CGameObject::CGameObject(): CNamedItem() { _field58 = 0; _visible = true; _field60 = 0; - _cursorId = CURSOR_1; + _cursorId = CURSOR_ARROW; _field78 = 0; _frameNumber = -1; _field90 = 0; diff --git a/engines/titanic/core/link_item.cpp b/engines/titanic/core/link_item.cpp index 5ca64b1c59..285838b692 100644 --- a/engines/titanic/core/link_item.cpp +++ b/engines/titanic/core/link_item.cpp @@ -32,7 +32,7 @@ CLinkItem::CLinkItem() : CNamedItem() { _nodeNumber = -1; _viewNumber = -1; _field30 = 0; - _cursorId = CURSOR_1; + _cursorId = CURSOR_ARROW; _name = "Link"; } @@ -93,16 +93,16 @@ void CLinkItem::load(SimpleFile *file) { if (val < 2) { switch (_field30) { case 2: - _cursorId = CURSOR_2; + _cursorId = CURSOR_MOVE_LEFT; break; case 3: - _cursorId = CURSOR_3; + _cursorId = CURSOR_MOVE_RIGHT; break; case 5: - _cursorId = CURSOR_7; + _cursorId = CURSOR_MOVE_FORWARD; break; default: - _cursorId = CURSOR_4; + _cursorId = CURSOR_MOVE_FORWARD2; break; } } diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index 47cdabbb50..c5cd77874b 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -204,7 +204,7 @@ bool CViewItem::handleMessage(CMouseMoveMsg &msg) { CScreenManager *screenManager = CScreenManager::_screenManagerPtr; if (handleMouseMsg(&msg, true)) { - screenManager->_mouseCursor->setCursor(CURSOR_1); + screenManager->_mouseCursor->setCursor(CURSOR_ARROW); } else { // Iterate through each link item, and if any is highlighted, // change the mouse cursor to the designated cursor for the item @@ -219,7 +219,7 @@ bool CViewItem::handleMessage(CMouseMoveMsg &msg) { } if (!handleMouseMsg(&msg, false)) - screenManager->_mouseCursor->setCursor(CURSOR_1); + screenManager->_mouseCursor->setCursor(CURSOR_ARROW); } return true; @@ -250,7 +250,7 @@ bool CViewItem::handleMouseMsg(CMouseMsg *msg, bool flag) { return false; for (int idx = (int)gameObjects.size() - 1; idx >= 0; ++idx) { - if (gameObjects[idx]->_cursorId != CURSOR_12) { + if (gameObjects[idx]->_cursorId != CURSOR_ARROW2) { CScreenManager::_screenManagerPtr->_mouseCursor->setCursor(gameObjects[idx]->_cursorId); return true; } diff --git a/engines/titanic/support/mouse_cursor.cpp b/engines/titanic/support/mouse_cursor.cpp index 6db3618003..c4c57c6f07 100644 --- a/engines/titanic/support/mouse_cursor.cpp +++ b/engines/titanic/support/mouse_cursor.cpp @@ -50,9 +50,9 @@ static const int CURSOR_DATA[NUM_CURSORS][4] = { }; CMouseCursor::CMouseCursor(CScreenManager *screenManager) : - _screenManager(screenManager), _cursorId(CURSOR_15) { + _screenManager(screenManager), _cursorId(CURSOR_HOURGLASS) { loadCursorImages(); - setCursor(CURSOR_1); + setCursor(CURSOR_ARROW); } CMouseCursor::~CMouseCursor() { diff --git a/engines/titanic/support/mouse_cursor.h b/engines/titanic/support/mouse_cursor.h index 507f4ecc17..28e13a82c4 100644 --- a/engines/titanic/support/mouse_cursor.h +++ b/engines/titanic/support/mouse_cursor.h @@ -31,21 +31,21 @@ namespace Titanic { #define NUM_CURSORS 15 enum CursorId { - CURSOR_1 = 1, - CURSOR_2 = 3, - CURSOR_3 = 3, - CURSOR_4 = 4, - CURSOR_5 = 5, - CURSOR_6 = 6, - CURSOR_7 = 7, - CURSOR_8 = 8, - CURSOR_9 = 9, - CURSOR_10 = 10, - CURSOR_11 = 11, - CURSOR_12 = 12, - CURSOR_13 = 13, - CURSOR_14 = 14, - CURSOR_15 = 15 + CURSOR_ARROW = 1, + CURSOR_MOVE_LEFT = 2, + CURSOR_MOVE_RIGHT = 3, + CURSOR_MOVE_FORWARD = 4, + CURSOR_MOVE_UP = 5, + CURSOR_MOVE_DOWN1 = 6, + CURSOR_MOVE_FORWARD2 = 7, + CURSOR_HAND = 8, + CURSOR_STAR = 9, + CURSOR_INVALID = 10, + CURSOR_MAGNIFIER = 11, + CURSOR_ARROW2 = 12, + CURSOR_BACKWARDS = 13, + CURSOR_DOWN = 14, + CURSOR_HOURGLASS = 15 }; class CScreenManager; -- cgit v1.2.3 From cb2dc0c8c8ab5b73f1ea863105a514202513de35 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 5 Apr 2016 21:58:53 -0400 Subject: TITANIC: Implementing CSTButton --- engines/titanic/gfx/st_button.cpp | 51 ++++++++++++++++++++++++++++++--------- engines/titanic/gfx/st_button.h | 19 +++++++++++---- 2 files changed, 53 insertions(+), 17 deletions(-) diff --git a/engines/titanic/gfx/st_button.cpp b/engines/titanic/gfx/st_button.cpp index 44aa5cb7c5..0d17331477 100644 --- a/engines/titanic/gfx/st_button.cpp +++ b/engines/titanic/gfx/st_button.cpp @@ -25,39 +25,66 @@ namespace Titanic { CSTButton::CSTButton() : CBackground() { - _fieldE0 = 0; - _string3 = "NULL"; + _statusInc = 0; + _statusTarget = "NULL"; _fieldF0 = 0; - _fieldF4 = 0; + _newStatus = 0; _string4 = "NULL"; _string5 = "NULL"; - _field110 = 0; + _buttonFrame = 0; } void CSTButton::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldE0, indent); - file->writeQuotedLine(_string3, indent); + file->writeNumberLine(_statusInc, indent); + file->writeQuotedLine(_statusTarget, indent); file->writeNumberLine(_fieldF0, indent); - file->writeNumberLine(_fieldF4, indent); + file->writeNumberLine(_newStatus, indent); file->writeQuotedLine(_string4, indent); file->writeQuotedLine(_string5, indent); - file->writeNumberLine(_field110, indent); + file->writeNumberLine(_buttonFrame, indent); CBackground::save(file, indent); } void CSTButton::load(SimpleFile *file) { file->readNumber(); - _fieldE0 = file->readNumber(); - _string3 = file->readString(); + _statusInc = file->readNumber(); + _statusTarget = file->readString(); _fieldF0 = file->readNumber(); - _fieldF4 = file->readNumber(); + _newStatus = file->readNumber(); _string4 = file->readString(); _string5 = file->readString(); - _field110 = file->readNumber(); + _buttonFrame = file->readNumber() != 0; CBackground::load(file); } +bool CSTButton::handleMessage(CMouseButtonDownMsg &msg) { + changeStatus(0); + // TODO: Obj6c stuff + + return true; +} + +bool CSTButton::handleMessage(CMouseButtonUpMsg &msg) { + int value1 = _newStatus; + int value2 = _newStatus + _statusInc; + + CStatusChangeMsg statusMsg(value1, value2, 0); + _newStatus = value2; + statusMsg.execute(_statusTarget); + + if (statusMsg._value3) { + _newStatus -= _statusInc; + } + + return true; +} + +bool CSTButton::handleMessage(CEnterViewMsg &msg) { + loadFrame(_buttonFrame); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/gfx/st_button.h b/engines/titanic/gfx/st_button.h index e63d1c831c..3e2ebe07a8 100644 --- a/engines/titanic/gfx/st_button.h +++ b/engines/titanic/gfx/st_button.h @@ -24,18 +24,27 @@ #define TITANIC_ST_BUTTON_H #include "titanic/core/background.h" +#include "titanic/messages/mouse_messages.h" +#include "titanic/messages/messages.h" namespace Titanic { -class CSTButton : public CBackground { +class CSTButton : public CBackground, + public CMouseButtonDownMsgTarget, + public CMouseButtonUpMsgTarget, + public CEnterViewMsgTarget { private: - int _fieldE0; - CString _string3; + int _statusInc; + CString _statusTarget; int _fieldF0; - int _fieldF4; + int _newStatus; CString _string4; CString _string5; - int _field110; + int _buttonFrame; +protected: + virtual bool handleMessage(CMouseButtonDownMsg &msg); + virtual bool handleMessage(CMouseButtonUpMsg &msg); + virtual bool handleMessage(CEnterViewMsg &msg); public: CLASSDEF CSTButton(); -- cgit v1.2.3 From 08ed54f6c9fd72313e759d494a0b92cace2218e8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 6 Apr 2016 07:55:55 -0400 Subject: TITANIC: Beginnings of CProximity class --- engines/titanic/core/game_object.cpp | 14 ++++++++ engines/titanic/core/game_object.h | 4 +++ engines/titanic/game/television.cpp | 4 +-- engines/titanic/gfx/st_button.cpp | 18 +++++----- engines/titanic/gfx/st_button.h | 2 +- engines/titanic/messages/messages.h | 2 +- engines/titanic/module.mk | 1 + engines/titanic/support/proximity.cpp | 36 ++++++++++++++++++++ engines/titanic/support/proximity.h | 62 +++++++++++++++++++++++++++++++++++ 9 files changed, 129 insertions(+), 14 deletions(-) create mode 100644 engines/titanic/support/proximity.cpp create mode 100644 engines/titanic/support/proximity.h diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index d66fa58cb4..c855fd9030 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -395,4 +395,18 @@ int CGameObject::getSurface45() const { return _surface ? _surface->proc45() : 0; } +void CGameObject::calcProximity(const CString &name, int val2, int val3, int val4) { + CProximity prox; + prox._field8 = val2; + prox._fieldC = val3; + prox._field20 = val4; + calcProximity(name, prox); +} + +void CGameObject::calcProximity(const CString &name, CProximity &prox) { + if (prox._field28 == 2) { + // TODO + } +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index d8d3a0be64..495fc8a2c9 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -24,6 +24,7 @@ #define TITANIC_GAME_OBJECT_H #include "titanic/support/mouse_cursor.h" +#include "titanic/support/proximity.h" #include "titanic/support/rect.h" #include "titanic/core/movie_clip.h" #include "titanic/core/named_item.h" @@ -54,6 +55,7 @@ private: void loadImage(const CString &name, bool pendingFlag = true); void processClipList2(); + void calcProximity(const CString &name, CProximity &obj6C); protected: Rect _bounds; double _field34; @@ -177,6 +179,8 @@ public: * Loads a frame */ void loadFrame(int frameNumber); + + void calcProximity(const CString &name, int val2, int val3, int val4); }; } // End of namespace Titanic diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp index c11d446fe4..610a3f0596 100644 --- a/engines/titanic/game/television.cpp +++ b/engines/titanic/game/television.cpp @@ -164,9 +164,8 @@ bool CTelevision::handleMessage(CPETDownMsg &msg) { bool CTelevision::handleMessage(CStatusChangeMsg &msg) { if (_isOn) { stopMovie(); - changeStatus(1); + changeStatus(0); } - warning("TODO"); return true; } @@ -179,7 +178,6 @@ bool CTelevision::handleMessage(CActMsg &msg) { CStatusChangeMsg changeMsg; changeMsg.execute(this); } else { - // TODO: Should 5C be a boolean? setVisible(_isOn); stopMovie(); } diff --git a/engines/titanic/gfx/st_button.cpp b/engines/titanic/gfx/st_button.cpp index 0d17331477..387800430f 100644 --- a/engines/titanic/gfx/st_button.cpp +++ b/engines/titanic/gfx/st_button.cpp @@ -28,7 +28,7 @@ CSTButton::CSTButton() : CBackground() { _statusInc = 0; _statusTarget = "NULL"; _fieldF0 = 0; - _newStatus = 0; + _currentStatus = 0; _string4 = "NULL"; _string5 = "NULL"; _buttonFrame = 0; @@ -39,7 +39,7 @@ void CSTButton::save(SimpleFile *file, int indent) const { file->writeNumberLine(_statusInc, indent); file->writeQuotedLine(_statusTarget, indent); file->writeNumberLine(_fieldF0, indent); - file->writeNumberLine(_newStatus, indent); + file->writeNumberLine(_currentStatus, indent); file->writeQuotedLine(_string4, indent); file->writeQuotedLine(_string5, indent); file->writeNumberLine(_buttonFrame, indent); @@ -52,7 +52,7 @@ void CSTButton::load(SimpleFile *file) { _statusInc = file->readNumber(); _statusTarget = file->readString(); _fieldF0 = file->readNumber(); - _newStatus = file->readNumber(); + _currentStatus = file->readNumber(); _string4 = file->readString(); _string5 = file->readString(); _buttonFrame = file->readNumber() != 0; @@ -68,15 +68,15 @@ bool CSTButton::handleMessage(CMouseButtonDownMsg &msg) { } bool CSTButton::handleMessage(CMouseButtonUpMsg &msg) { - int value1 = _newStatus; - int value2 = _newStatus + _statusInc; + int oldStatus = _currentStatus; + int newStatus = _currentStatus + _statusInc; - CStatusChangeMsg statusMsg(value1, value2, 0); - _newStatus = value2; + CStatusChangeMsg statusMsg(oldStatus, newStatus, false); + _currentStatus = newStatus; statusMsg.execute(_statusTarget); - if (statusMsg._value3) { - _newStatus -= _statusInc; + if (!statusMsg._success) { + _currentStatus -= _statusInc; } return true; diff --git a/engines/titanic/gfx/st_button.h b/engines/titanic/gfx/st_button.h index 3e2ebe07a8..d613ad0eea 100644 --- a/engines/titanic/gfx/st_button.h +++ b/engines/titanic/gfx/st_button.h @@ -37,7 +37,7 @@ private: int _statusInc; CString _statusTarget; int _fieldF0; - int _newStatus; + int _currentStatus; CString _string4; CString _string5; int _buttonFrame; diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index b78fac481c..f4c16f5017 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -397,7 +397,7 @@ MESSAGE1(CShowTextMsg, CString, value, "NO TEXT INCLUDED!!!"); MESSAGE2(CSignalObject, CString, strValue, "", int, numValue, 0); MESSAGE2(CSpeechFallsFromTreeMsg, int, value1, 0, int, value2, 0); MESSAGE1(CStartMusicMsg, int, value, 0); -MESSAGE3(CStatusChangeMsg, int, value1, 0, int, value2, 0, int, value3, 0); +MESSAGE3(CStatusChangeMsg, int, oldStatus, 0, int, newStatus, 0, bool, success, false); MESSAGE1(CStopMusicMsg, int, value, 0); MESSAGE0(CSubDeliverCCarryMsg); MESSAGE0(CSubSendCCarryMsg); diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index a29d3df10f..80abc1a760 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -431,6 +431,7 @@ MODULE_OBJS := \ support/image_decoders.o \ support/mouse_cursor.o \ support/movie.o \ + support/proximity.o \ support/rect.o \ support/screen_manager.o \ support/simple_file.o \ diff --git a/engines/titanic/support/proximity.cpp b/engines/titanic/support/proximity.cpp new file mode 100644 index 0000000000..f7c90f7caf --- /dev/null +++ b/engines/titanic/support/proximity.cpp @@ -0,0 +1,36 @@ +/* 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 "titanic/support/proximity.h" + +namespace Titanic { + +CProximity::CProximity() : _field4(0), _field8(100), _fieldC(0), + _field10(-1), _field14(0), _field18(0), _field1C(0x3FF00000), + _field20(0), _field24(10), _field28(0), _field2C(0), + _field30(0x3F000000), _field34(0), _double1(0.0), _double2(0.0), + _double3(0.0), _field44(0), _field48(0), _field4C(0), + _field50(0), _field54(0), _field58(0), _field5C(0), + _field60(0), _field64(0), _field68(0) { +} + +} // End of namespace Titanic diff --git a/engines/titanic/support/proximity.h b/engines/titanic/support/proximity.h new file mode 100644 index 0000000000..69979eaeaf --- /dev/null +++ b/engines/titanic/support/proximity.h @@ -0,0 +1,62 @@ +/* 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. + * + */ + +#ifndef TITANIC_PROXIMITY_H +#define TITANIC_PROXIMITY_H + +namespace Titanic { + +class CProximity { +public: + int _field4; + int _field8; + int _fieldC; + int _field10; + int _field14; + int _field18; + int _field1C; + int _field20; + int _field24; + int _field28; + int _field2C; + int _field30; + int _field34; + double _double1; + double _double2; + double _double3; + int _field44; + int _field48; + int _field4C; + int _field50; + int _field54; + int _field58; + int _field5C; + int _field60; + int _field64; + int _field68; +public: + CProximity(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PROXIMITY_H */ -- cgit v1.2.3 From 71a278791a25d039c39a818f27d1106db1fa0e6e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 6 Apr 2016 19:02:09 -0400 Subject: TITANIC: Fix setting of buttons in mouse messages --- engines/titanic/input_translator.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/engines/titanic/input_translator.cpp b/engines/titanic/input_translator.cpp index 9769076a1d..499d0f6293 100644 --- a/engines/titanic/input_translator.cpp +++ b/engines/titanic/input_translator.cpp @@ -50,47 +50,47 @@ void CInputTranslator::mouseMove(int special, const Point &pt) { } void CInputTranslator::leftButtonDown(int special, const Point &pt) { - CMouseButtonDownMsg msg(pt, getButtons(special)); + CMouseButtonDownMsg msg(pt, MB_LEFT); _inputHandler->handleMessage(msg); } void CInputTranslator::leftButtonUp(int special, const Point &pt) { - CMouseButtonUpMsg msg(pt, getButtons(special)); + CMouseButtonUpMsg msg(pt, MB_LEFT); _inputHandler->handleMessage(msg); } void CInputTranslator::leftButtonDoubleClick(int special, const Point &pt) { - CMouseDoubleClickMsg msg(pt, getButtons(special)); + CMouseDoubleClickMsg msg(pt, MB_LEFT); _inputHandler->handleMessage(msg); } void CInputTranslator::middleButtonDown(int special, const Point &pt) { - CMouseButtonDownMsg msg(pt, getButtons(special)); + CMouseButtonDownMsg msg(pt, MB_MIDDLE); _inputHandler->handleMessage(msg); } void CInputTranslator::middleButtonUp(int special, const Point &pt) { - CMouseButtonUpMsg msg(pt, getButtons(special)); + CMouseButtonUpMsg msg(pt, MB_MIDDLE); _inputHandler->handleMessage(msg); } void CInputTranslator::middleButtonDoubleClick(int special, const Point &pt) { - CMouseDoubleClickMsg msg(pt, getButtons(special)); + CMouseDoubleClickMsg msg(pt, MB_MIDDLE); _inputHandler->handleMessage(msg); } void CInputTranslator::rightButtonDown(int special, const Point &pt) { - CMouseButtonDownMsg msg(pt, getButtons(special)); + CMouseButtonDownMsg msg(pt, MB_RIGHT); _inputHandler->handleMessage(msg); } void CInputTranslator::rightButtonUp(int special, const Point &pt) { - CMouseButtonUpMsg msg(pt, getButtons(special)); + CMouseButtonUpMsg msg(pt, MB_RIGHT); _inputHandler->handleMessage(msg); } void CInputTranslator::rightButtonDoubleClick(int special, const Point &pt) { - CMouseDoubleClickMsg msg(pt, getButtons(special)); + CMouseDoubleClickMsg msg(pt, MB_RIGHT); _inputHandler->handleMessage(msg); } -- cgit v1.2.3 From ac59f58c8a65e9e27a696da4536693c7d6ec6bc9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 6 Apr 2016 19:42:45 -0400 Subject: TITANIC: Implement CBackground message handlers --- engines/titanic/core/background.cpp | 14 +++++++++++--- engines/titanic/core/game_object.cpp | 14 +++++++++++++- engines/titanic/support/movie.cpp | 2 +- engines/titanic/support/movie.h | 4 ++-- engines/titanic/support/video_surface.cpp | 6 ++++++ engines/titanic/support/video_surface.h | 2 ++ 6 files changed, 35 insertions(+), 7 deletions(-) diff --git a/engines/titanic/core/background.cpp b/engines/titanic/core/background.cpp index ea3bdb01a8..cb8e26450f 100644 --- a/engines/titanic/core/background.cpp +++ b/engines/titanic/core/background.cpp @@ -50,15 +50,23 @@ void CBackground::load(SimpleFile *file) { } bool CBackground::handleMessage(CStatusChangeMsg &msg) { - error("TODO: CBackground::handleMessage"); + setVisible(true); + if (_fieldDC) { + fn1(_fieldBC, _fieldC0, 16); + } else { + fn1(_fieldBC, _fieldC0, 0); + } + return true; } bool CBackground::handleMessage(CSetFrameMsg &msg) { - error("TODO: CBackground::handleMessage"); + loadFrame(msg._frameNumber); + return true; } bool CBackground::handleMessage(CVisibleMsg &msg) { - error("TODO: CBackground::handleMessage"); + setVisible(msg._visible); + return true; } } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index c855fd9030..d2b1c29ed7 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -330,7 +330,19 @@ void CGameObject::petFn3(CTreeItem *item) { } void CGameObject::fn1(int val1, int val2, int val3) { - warning("TODO: CGameObject::fn1"); + _frameNumber = -1; + if (!_surface) { + if (!_resource.empty()) + loadResource(_resource); + _resource.clear(); + } + + if (_surface) { + _surface->proc34(val1, val2, val3, val3 != 0); + + if (val3 & 0x10) + getGameManager()->_gameState.addMovie(_surface->_movie); + } } void CGameObject::changeStatus(int newStatus) { diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index 25909183dd..846dc09d5c 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -59,7 +59,7 @@ void OSMovie::proc8(int v1, CVideoSurface *surface) { warning("TODO: OSMovie::proc8"); } -void OSMovie::proc9() { +void OSMovie::proc9(int v1, int v2, int v3, bool v4) { warning("TODO: OSMovie::proc9"); } diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index e84e283597..b5ae70de13 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -40,7 +40,7 @@ public: virtual ~CMovie() {} virtual void proc8(int v1, CVideoSurface *surface) = 0; - virtual void proc9() = 0; + virtual void proc9(int v1, int v2, int v3, bool v4) = 0; virtual void proc10() = 0; virtual void proc11() = 0; virtual void proc12() = 0; @@ -68,7 +68,7 @@ public: virtual ~OSMovie(); virtual void proc8(int v1, CVideoSurface *surface); - virtual void proc9(); + virtual void proc9(int v1, int v2, int v3, bool v4); virtual void proc10(); virtual void proc11(); virtual void proc12(); diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index a1b26386b3..1a0d48bebe 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -368,6 +368,12 @@ void OSVideoSurface::proc32(int v1, CVideoSurface *surface) { _movie->proc8(v1, surface); } +void OSVideoSurface::proc34(int v1, int v2, int v3, bool v4) { + if (loadIfReady() && _movie) { + _movie->proc9(v1, v2, v3, v4); + } +} + void OSVideoSurface::stopMovie() { if (_movie) _movie->stop(); diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index e1ddde8013..767306cae6 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -153,6 +153,7 @@ public: virtual void shiftColors() = 0; virtual void proc32(int v1, CVideoSurface *surface) = 0; + virtual void proc34(int v1, int v2, int v3, bool v4) = 0; /** * Stops any movie currently attached to the surface @@ -299,6 +300,7 @@ public: virtual void shiftColors(); virtual void proc32(int v1, CVideoSurface *surface); + virtual void proc34(int v1, int v2, int v3, bool v4); /** * Stops any movie currently attached to the surface -- cgit v1.2.3 From e728e901d02aca51858f91ac29b1a177e5e80a07 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 6 Apr 2016 20:32:18 -0400 Subject: TITANIC: Fix for showing link cursors in some screens --- engines/titanic/core/view_item.cpp | 13 ++++++++----- engines/titanic/support/mouse_cursor.h | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index c5cd77874b..098adc0c61 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -208,14 +208,15 @@ bool CViewItem::handleMessage(CMouseMoveMsg &msg) { } else { // Iterate through each link item, and if any is highlighted, // change the mouse cursor to the designated cursor for the item - CLinkItem *linkItem = dynamic_cast(getFirstChild()); - while (linkItem) { - if (linkItem->_bounds.contains(msg._mousePos)) { + CTreeItem *treeItem = getFirstChild(); + while (treeItem) { + CLinkItem *linkItem = dynamic_cast(treeItem); + if (linkItem && linkItem->_bounds.contains(msg._mousePos)) { screenManager->_mouseCursor->setCursor(linkItem->_cursorId); return true; } - linkItem = dynamic_cast(linkItem->getNextSibling()); + treeItem = treeItem->getNextSibling(); } if (!handleMouseMsg(&msg, false)) @@ -252,10 +253,12 @@ bool CViewItem::handleMouseMsg(CMouseMsg *msg, bool flag) { for (int idx = (int)gameObjects.size() - 1; idx >= 0; ++idx) { if (gameObjects[idx]->_cursorId != CURSOR_ARROW2) { CScreenManager::_screenManagerPtr->_mouseCursor->setCursor(gameObjects[idx]->_cursorId); - return true; + break; } } } + if (gameObjects.size() == 0) + return false; bool result = false; for (int idx = (int)gameObjects.size() - 1; idx >= 0; --idx) { diff --git a/engines/titanic/support/mouse_cursor.h b/engines/titanic/support/mouse_cursor.h index 28e13a82c4..831e207632 100644 --- a/engines/titanic/support/mouse_cursor.h +++ b/engines/titanic/support/mouse_cursor.h @@ -39,7 +39,7 @@ enum CursorId { CURSOR_MOVE_DOWN1 = 6, CURSOR_MOVE_FORWARD2 = 7, CURSOR_HAND = 8, - CURSOR_STAR = 9, + CURSOR_ACTIVATE = 9, CURSOR_INVALID = 10, CURSOR_MAGNIFIER = 11, CURSOR_ARROW2 = 12, -- cgit v1.2.3 From 51df4d98d3a066e092f34cf7968c436a3e430df2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 6 Apr 2016 22:17:26 -0400 Subject: TITANIC: In-progress converting message handling to be more like original I currently was using multiple inheritance to define the message classes that a class supports, but this caused problems when, for example, a class tested to see if an object supported CMouseMsg. The class in question supported several mouse messages, but a standard dynamic_cast returned nullptr for the class, since it didn't directly support it --- engines/titanic/core/background.cpp | 16 ++++++--- engines/titanic/core/background.h | 13 ++++--- engines/titanic/core/game_object.cpp | 3 ++ engines/titanic/core/game_object.h | 1 + engines/titanic/core/message_target.cpp | 15 ++++++++- engines/titanic/core/message_target.h | 43 +++++++++++++++++++++++- engines/titanic/core/named_item.cpp | 3 ++ engines/titanic/core/named_item.h | 1 + engines/titanic/core/tree_item.cpp | 3 ++ engines/titanic/core/tree_item.h | 1 + engines/titanic/core/view_item.cpp | 15 ++++++--- engines/titanic/core/view_item.h | 15 ++++----- engines/titanic/game/gondolier/gondolier_mixer.h | 3 +- engines/titanic/game/television.h | 14 +------- 14 files changed, 104 insertions(+), 42 deletions(-) diff --git a/engines/titanic/core/background.cpp b/engines/titanic/core/background.cpp index cb8e26450f..5859719026 100644 --- a/engines/titanic/core/background.cpp +++ b/engines/titanic/core/background.cpp @@ -24,6 +24,12 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CBackground, CGameObject) + ON_MESSAGE(StatusChangeMsg) + ON_MESSAGE(SetFrameMsg) + ON_MESSAGE(VisibleMsg) +END_MESSAGE_MAP() + CBackground::CBackground() : CGameObject(), _fieldBC(0), _fieldC0(0), _fieldDC(0) { } @@ -49,7 +55,7 @@ void CBackground::load(SimpleFile *file) { CGameObject::load(file); } -bool CBackground::handleMessage(CStatusChangeMsg &msg) { +bool CBackground::StatusChangeMsg(CStatusChangeMsg *msg) { setVisible(true); if (_fieldDC) { fn1(_fieldBC, _fieldC0, 16); @@ -59,13 +65,13 @@ bool CBackground::handleMessage(CStatusChangeMsg &msg) { return true; } -bool CBackground::handleMessage(CSetFrameMsg &msg) { - loadFrame(msg._frameNumber); +bool CBackground::SetFrameMsg(CSetFrameMsg *msg) { + loadFrame(msg->_frameNumber); return true; } -bool CBackground::handleMessage(CVisibleMsg &msg) { - setVisible(msg._visible); +bool CBackground::VisibleMsg(CVisibleMsg *msg) { + setVisible(msg->_visible); return true; } diff --git a/engines/titanic/core/background.h b/engines/titanic/core/background.h index bd8f94987e..91c34073cd 100644 --- a/engines/titanic/core/background.h +++ b/engines/titanic/core/background.h @@ -28,10 +28,7 @@ namespace Titanic { -class CBackground : public CGameObject, - public CStatusChangeMsgTarget, - public CSetFrameMsgTarget, - public CVisibleMsgTarget { +class CBackground : public CGameObject { protected: int _fieldBC; int _fieldC0; @@ -39,9 +36,11 @@ protected: CString _string2; int _fieldDC; protected: - virtual bool handleMessage(CStatusChangeMsg &msg); - virtual bool handleMessage(CSetFrameMsg &msg); - virtual bool handleMessage(CVisibleMsg &msg); + DECLARE_MESSAGE_MAP + + virtual bool StatusChangeMsg(CStatusChangeMsg *msg); + virtual bool SetFrameMsg(CSetFrameMsg *msg); + virtual bool VisibleMsg(CVisibleMsg *msg); public: CLASSDEF CBackground(); diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index d2b1c29ed7..2bac988b31 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -31,6 +31,9 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CGameObject, CNamedItem) +END_MESSAGE_MAP() + void *CGameObject::_v1 = nullptr; CGameObject::CGameObject(): CNamedItem() { diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 495fc8a2c9..7391a6b079 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -36,6 +36,7 @@ class CVideoSurface; class CMouseDragStartMsg; class CGameObject : public CNamedItem { + DECLARE_MESSAGE_MAP public: static void *_v1; private: diff --git a/engines/titanic/core/message_target.cpp b/engines/titanic/core/message_target.cpp index a7dd3a02a2..b99fa5c606 100644 --- a/engines/titanic/core/message_target.cpp +++ b/engines/titanic/core/message_target.cpp @@ -23,7 +23,20 @@ #include "titanic/core/message_target.h" namespace Titanic { - + +const MSGMAP *CMessageTarget::getMessageMap() const { + return getThisMessageMap(); +} + +const MSGMAP *CMessageTarget::getThisMessageMap() { + static const MSGMAP_ENTRY _messageEntries[] = { + { (PMSG)nullptr, nullptr } + }; + + static const MSGMAP messageMap = { nullptr, &_messageEntries[0] }; + return &messageMap; +} + void CMessageTarget::save(SimpleFile *file, int indent) const { file->writeNumberLine(0, indent); CSaveableObject::save(file, indent); diff --git a/engines/titanic/core/message_target.h b/engines/titanic/core/message_target.h index b099546852..0f43bcd2c5 100644 --- a/engines/titanic/core/message_target.h +++ b/engines/titanic/core/message_target.h @@ -27,7 +27,49 @@ namespace Titanic { +class CMessageTarget; +class CMessage; + +typedef bool (CMessageTarget::*PMSG)(CMessage *msg); + +struct MSGMAP_ENTRY { + PMSG _fn; + ClassDef *_class; +}; + +struct MSGMAP { + const MSGMAP *(* pFnGetBaseMap)(); + const MSGMAP_ENTRY *lpEntries; +}; + +#define DECLARE_MESSAGE_MAP \ +protected: \ + static const MSGMAP *getThisMessageMap(); \ + virtual const MSGMAP *getMessageMap() const; + +#define BEGIN_MESSAGE_MAP(theClass, baseClass) \ + const MSGMAP *theClass::getMessageMap() const \ + { return getThisMessageMap(); } \ + const MSGMAP *theClass::getThisMessageMap() \ + { \ + typedef theClass ThisClass; \ + typedef baseClass TheBaseClass; \ + typedef bool (theClass::*FNPTR)(CMessage *msg); \ + static const MSGMAP_ENTRY _messageEntries[] = { + +#define ON_MESSAGE(msgClass) \ + { static_cast((FNPTR)&ThisClass::msgClass), C##msgClass::_type }, + +#define END_MESSAGE_MAP() \ + { (PMSG)nullptr, nullptr } \ + }; \ + static const MSGMAP messageMap = \ + { &TheBaseClass::getThisMessageMap, &_messageEntries[0] }; \ + return &messageMap; \ + } + class CMessageTarget: public CSaveableObject { + DECLARE_MESSAGE_MAP public: CLASSDEF @@ -40,7 +82,6 @@ public: * Load the data for the class from file */ virtual void load(SimpleFile *file); - }; } // End of namespace Titanic diff --git a/engines/titanic/core/named_item.cpp b/engines/titanic/core/named_item.cpp index 02e75044aa..72d3fd9f42 100644 --- a/engines/titanic/core/named_item.cpp +++ b/engines/titanic/core/named_item.cpp @@ -27,6 +27,9 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CNamedItem, CTreeItem) +END_MESSAGE_MAP() + CString CNamedItem::dumpItem(int indent) const { CString result = CTreeItem::dumpItem(indent); result += " " + _name; diff --git a/engines/titanic/core/named_item.h b/engines/titanic/core/named_item.h index 6ee11e960e..9763e1b332 100644 --- a/engines/titanic/core/named_item.h +++ b/engines/titanic/core/named_item.h @@ -32,6 +32,7 @@ class CNodeItem; class CRoomItem; class CNamedItem: public CTreeItem { + DECLARE_MESSAGE_MAP public: CString _name; public: diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index e7b61dc853..80eac81e99 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -36,6 +36,9 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CTreeItem, CMessageTarget) +END_MESSAGE_MAP() + CTreeItem::CTreeItem() : _parent(nullptr), _firstChild(nullptr), _nextSibling(nullptr), _priorSibling(nullptr), _field14(0) { } diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index 9710a255d0..f5b1407fcd 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -36,6 +36,7 @@ class CScreenManager; class CRoomItem; class CTreeItem: public CMessageTarget { + DECLARE_MESSAGE_MAP private: CTreeItem *_parent; CTreeItem *_nextSibling; diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index 098adc0c61..26e0d86d27 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -30,6 +30,13 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CViewItem, CNamedItem) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(MouseButtonUpMsg) + ON_MESSAGE(MouseDoubleClickMsg) + ON_MESSAGE(MouseMoveMsg) +END_MESSAGE_MAP() + CViewItem::CViewItem() : CNamedItem() { Common::fill(&_buttonUpTargets[0], &_buttonUpTargets[4], nullptr); _field24 = 0; @@ -161,7 +168,7 @@ void CViewItem::enterView(CViewItem *newView) { } } -bool CViewItem::handleMessage(CMouseButtonDownMsg &msg) { +bool CViewItem::MouseButtonDownMsg(CMouseButtonDownMsg &msg) { if (msg._buttons & MB_LEFT) { if (!handleMouseMsg(&msg, true)) { CGameManager *gm = getGameManager(); @@ -186,21 +193,21 @@ bool CViewItem::handleMessage(CMouseButtonDownMsg &msg) { return true; } -bool CViewItem::handleMessage(CMouseButtonUpMsg &msg) { +bool CViewItem::MouseButtonUpMsg(CMouseButtonUpMsg &msg) { if (msg._buttons & MB_LEFT) handleMouseMsg(&msg, false); return true; } -bool CViewItem::handleMessage(CMouseDoubleClickMsg &msg) { +bool CViewItem::MouseDoubleClickMsg(CMouseDoubleClickMsg &msg) { if (msg._buttons & MB_LEFT) handleMouseMsg(&msg, false); return true; } -bool CViewItem::handleMessage(CMouseMoveMsg &msg) { +bool CViewItem::MouseMoveMsg(CMouseMoveMsg &msg) { CScreenManager *screenManager = CScreenManager::_screenManagerPtr; if (handleMouseMsg(&msg, true)) { diff --git a/engines/titanic/core/view_item.h b/engines/titanic/core/view_item.h index fc4089f924..f439929f5e 100644 --- a/engines/titanic/core/view_item.h +++ b/engines/titanic/core/view_item.h @@ -29,11 +29,8 @@ namespace Titanic { -class CViewItem : public CNamedItem, - public CMouseButtonDownMsgTarget, - public CMouseButtonUpMsgTarget, - public CMouseMoveMsgTarget, - public CMouseDoubleClickMsgTarget { +class CViewItem : public CNamedItem { + DECLARE_MESSAGE_MAP private: CTreeItem *_buttonUpTargets[4]; private: @@ -55,10 +52,10 @@ protected: int _field50; int _field54; protected: - virtual bool handleMessage(CMouseButtonDownMsg &msg); - virtual bool handleMessage(CMouseButtonUpMsg &msg); - virtual bool handleMessage(CMouseMoveMsg &msg); - virtual bool handleMessage(CMouseDoubleClickMsg &msg); + virtual bool MouseButtonDownMsg(CMouseButtonDownMsg &msg); + virtual bool MouseButtonUpMsg(CMouseButtonUpMsg &msg); + virtual bool MouseMoveMsg(CMouseMoveMsg &msg); + virtual bool MouseDoubleClickMsg(CMouseDoubleClickMsg &msg); public: int _viewNumber; public: diff --git a/engines/titanic/game/gondolier/gondolier_mixer.h b/engines/titanic/game/gondolier/gondolier_mixer.h index c6ea840ea6..1186393d04 100644 --- a/engines/titanic/game/gondolier/gondolier_mixer.h +++ b/engines/titanic/game/gondolier/gondolier_mixer.h @@ -28,8 +28,7 @@ namespace Titanic { -class CGondolierMixer : public CGondolierBase, - public CEnterRoomMsgTarget { +class CGondolierMixer : public CGondolierBase { private: int _fieldBC; int _fieldC0; diff --git a/engines/titanic/game/television.h b/engines/titanic/game/television.h index c6c920b74c..9fb33943c0 100644 --- a/engines/titanic/game/television.h +++ b/engines/titanic/game/television.h @@ -29,19 +29,7 @@ namespace Titanic { -class CTelevision : public CBackground, - public CLeaveViewMsgTarget, - public CChangeSeasonMsgTarget, - public CEnterViewMsgTarget, - public CPETUpMsgTarget, - public CPETDownMsgTarget, - public CActMsgTarget, - public CPETActivateMsgTarget, - public CMovieEndMsgTarget, - public CShipSettingMsgTarget, - public CTurnOffTarget, - public CTurnOnTarget, - public CLightsMsgTarget { +class CTelevision : public CBackground { private: static int _v1; static bool _turnOn; -- cgit v1.2.3 From 51dc36a9a52f95815b4b1109b080d070247bf247 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 6 Apr 2016 23:28:42 -0400 Subject: TITANIC: Furhter in-progress message handling conversion --- engines/titanic/core/tree_item.h | 2 + engines/titanic/core/view_item.cpp | 28 +++--- engines/titanic/core/view_item.h | 8 +- engines/titanic/game/arboretum_gate.cpp | 24 +++-- engines/titanic/game/arboretum_gate.h | 24 ++--- engines/titanic/game/bar_bell.h | 3 +- engines/titanic/game/bomb.h | 3 +- engines/titanic/game/cdrom.h | 6 +- engines/titanic/game/cdrom_tray.h | 5 +- engines/titanic/game/chicken_cooler.h | 3 +- engines/titanic/game/dead_area.h | 4 +- engines/titanic/game/doorbot_elevator_handler.h | 3 +- engines/titanic/game/end_sequence_control.h | 3 +- engines/titanic/game/fan_noises.h | 3 +- engines/titanic/game/get_lift_eye2.h | 3 +- engines/titanic/game/light.h | 3 +- engines/titanic/game/light_switch.h | 3 +- engines/titanic/game/parrot/player_meets_parrot.h | 3 +- engines/titanic/game/pet/pet_monitor.h | 3 +- engines/titanic/game/pet/pet_position.h | 3 +- engines/titanic/game/pet/pet_transport.h | 3 +- engines/titanic/game/sgt/sgt_state_room.h | 3 +- engines/titanic/game/ship_setting.h | 3 +- engines/titanic/game/start_action.h | 4 +- engines/titanic/game/transport/lift.h | 3 +- engines/titanic/game/transport/pellerator.h | 3 +- engines/titanic/game/up_lighter.h | 3 +- engines/titanic/game/volume_control.h | 2 +- engines/titanic/gfx/st_button.cpp | 12 ++- engines/titanic/gfx/st_button.h | 12 +-- engines/titanic/messages/messages.cpp | 28 ++++++ engines/titanic/messages/messages.h | 106 +++++++-------------- engines/titanic/messages/mouse_messages.h | 62 ++---------- engines/titanic/messages/pet_messages.h | 10 +- engines/titanic/moves/enter_bridge.h | 3 +- engines/titanic/npcs/barbot.h | 3 +- engines/titanic/npcs/liftbot.h | 3 +- engines/titanic/pet_control/pet_control.cpp | 60 +++++++----- engines/titanic/pet_control/pet_control.h | 30 +++--- engines/titanic/pet_control/pet_element.cpp | 4 +- engines/titanic/pet_control/pet_element.h | 2 +- engines/titanic/pet_control/pet_frame.cpp | 4 +- engines/titanic/pet_control/pet_frame.h | 4 +- engines/titanic/pet_control/pet_section.h | 16 ++-- engines/titanic/sound/auto_music_player.h | 3 +- engines/titanic/sound/music_player.h | 3 +- engines/titanic/sound/node_auto_sound_player.h | 3 +- engines/titanic/sound/room_auto_sound_player.h | 3 +- .../titanic/sound/room_trigger_auto_music_player.h | 2 +- 49 files changed, 230 insertions(+), 304 deletions(-) diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index f5b1407fcd..d34f963584 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -29,6 +29,7 @@ namespace Titanic { class CGameManager; class CDontSaveFileItem; +class CMessage; class CNamedItem; class CPetControl; class CProjectItem; @@ -36,6 +37,7 @@ class CScreenManager; class CRoomItem; class CTreeItem: public CMessageTarget { + friend class CMessage; DECLARE_MESSAGE_MAP private: CTreeItem *_parent; diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index 26e0d86d27..8120b3c671 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -168,9 +168,9 @@ void CViewItem::enterView(CViewItem *newView) { } } -bool CViewItem::MouseButtonDownMsg(CMouseButtonDownMsg &msg) { - if (msg._buttons & MB_LEFT) { - if (!handleMouseMsg(&msg, true)) { +bool CViewItem::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (msg->_buttons & MB_LEFT) { + if (!handleMouseMsg(msg, true)) { CGameManager *gm = getGameManager(); if (gm->test54()) { findNode()->findRoom(); @@ -178,7 +178,7 @@ bool CViewItem::MouseButtonDownMsg(CMouseButtonDownMsg &msg) { CLinkItem *linkItem = dynamic_cast( findChildInstanceOf(CLinkItem::_type)); while (linkItem) { - if (linkItem->_bounds.contains(msg._mousePos)) { + if (linkItem->_bounds.contains(msg->_mousePos)) { gm->_gameState.triggerLink(linkItem); return true; } @@ -193,24 +193,24 @@ bool CViewItem::MouseButtonDownMsg(CMouseButtonDownMsg &msg) { return true; } -bool CViewItem::MouseButtonUpMsg(CMouseButtonUpMsg &msg) { - if (msg._buttons & MB_LEFT) - handleMouseMsg(&msg, false); +bool CViewItem::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + if (msg->_buttons & MB_LEFT) + handleMouseMsg(msg, false); return true; } -bool CViewItem::MouseDoubleClickMsg(CMouseDoubleClickMsg &msg) { - if (msg._buttons & MB_LEFT) - handleMouseMsg(&msg, false); +bool CViewItem::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { + if (msg->_buttons & MB_LEFT) + handleMouseMsg(msg, false); return true; } -bool CViewItem::MouseMoveMsg(CMouseMoveMsg &msg) { +bool CViewItem::MouseMoveMsg(CMouseMoveMsg *msg) { CScreenManager *screenManager = CScreenManager::_screenManagerPtr; - if (handleMouseMsg(&msg, true)) { + if (handleMouseMsg(msg, true)) { screenManager->_mouseCursor->setCursor(CURSOR_ARROW); } else { // Iterate through each link item, and if any is highlighted, @@ -218,7 +218,7 @@ bool CViewItem::MouseMoveMsg(CMouseMoveMsg &msg) { CTreeItem *treeItem = getFirstChild(); while (treeItem) { CLinkItem *linkItem = dynamic_cast(treeItem); - if (linkItem && linkItem->_bounds.contains(msg._mousePos)) { + if (linkItem && linkItem->_bounds.contains(msg->_mousePos)) { screenManager->_mouseCursor->setCursor(linkItem->_cursorId); return true; } @@ -226,7 +226,7 @@ bool CViewItem::MouseMoveMsg(CMouseMoveMsg &msg) { treeItem = treeItem->getNextSibling(); } - if (!handleMouseMsg(&msg, false)) + if (!handleMouseMsg(msg, false)) screenManager->_mouseCursor->setCursor(CURSOR_ARROW); } diff --git a/engines/titanic/core/view_item.h b/engines/titanic/core/view_item.h index f439929f5e..95edc7a49a 100644 --- a/engines/titanic/core/view_item.h +++ b/engines/titanic/core/view_item.h @@ -52,10 +52,10 @@ protected: int _field50; int _field54; protected: - virtual bool MouseButtonDownMsg(CMouseButtonDownMsg &msg); - virtual bool MouseButtonUpMsg(CMouseButtonUpMsg &msg); - virtual bool MouseMoveMsg(CMouseMoveMsg &msg); - virtual bool MouseDoubleClickMsg(CMouseDoubleClickMsg &msg); + virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); + virtual bool MouseMoveMsg(CMouseMoveMsg *msg); + virtual bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg); public: int _viewNumber; public: diff --git a/engines/titanic/game/arboretum_gate.cpp b/engines/titanic/game/arboretum_gate.cpp index 6770430cdc..f3e3301136 100644 --- a/engines/titanic/game/arboretum_gate.cpp +++ b/engines/titanic/game/arboretum_gate.cpp @@ -24,6 +24,16 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CArboretumGate, CBackground) + ON_MESSAGE(ActMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(TurnOff) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(TurnOn) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + int CArboretumGate::_v1; int CArboretumGate::_v2; int CArboretumGate::_v3; @@ -133,17 +143,17 @@ void CArboretumGate::load(SimpleFile *file) { CBackground::load(file); } -bool CArboretumGate::handleMessage(CActMsg &msg) { return false; } -bool CArboretumGate::handleMessage(CLeaveViewMsg &msg) { return false; } -bool CArboretumGate::handleMessage(CTurnOff &msg) { return false; } -bool CArboretumGate::handleMessage(CMouseButtonDownMsg &msg) { return false; } +bool CArboretumGate::ActMsg(CActMsg *msg) { return false; } +bool CArboretumGate::LeaveViewMsg(CLeaveViewMsg *msg) { return false; } +bool CArboretumGate::TurnOff(CTurnOff *msg) { return false; } +bool CArboretumGate::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { return false; } -bool CArboretumGate::handleMessage(CEnterViewMsg &msg) { +bool CArboretumGate::EnterViewMsg(CEnterViewMsg *msg) { warning("CArboretumGate::handleEvent"); return false; } -bool CArboretumGate::handleMessage(CTurnOn &msg) { return false; } -bool CArboretumGate::handleMessage(CMovieEndMsg &msg) { return false; } +bool CArboretumGate::TurnOn(CTurnOn *msg) { return false; } +bool CArboretumGate::MovieEndMsg(CMovieEndMsg *msg) { return false; } } // End of namespace Titanic diff --git a/engines/titanic/game/arboretum_gate.h b/engines/titanic/game/arboretum_gate.h index a176e93ed9..9b0674fe75 100644 --- a/engines/titanic/game/arboretum_gate.h +++ b/engines/titanic/game/arboretum_gate.h @@ -29,14 +29,8 @@ namespace Titanic { -class CArboretumGate : public CBackground, - public CActMsgTarget, - public CLeaveViewMsgTarget, - public CTurnOffTarget, - public CMouseButtonDownMsgTarget, - public CEnterViewMsgTarget, - public CTurnOnTarget, - public CMovieEndMsgTarget { +class CArboretumGate : public CBackground { + DECLARE_MESSAGE_MAP private: static int _v1; static int _v2; @@ -73,13 +67,13 @@ private: int _field150; CString _string2; protected: - virtual bool handleMessage(CActMsg &msg); - virtual bool handleMessage(CLeaveViewMsg &msg); - virtual bool handleMessage(CTurnOff &msg); - virtual bool handleMessage(CMouseButtonDownMsg &msg); - virtual bool handleMessage(CEnterViewMsg &msg); - virtual bool handleMessage(CTurnOn &msg); - virtual bool handleMessage(CMovieEndMsg &msg); + virtual bool ActMsg(CActMsg *msg); + virtual bool LeaveViewMsg(CLeaveViewMsg *msg); + virtual bool TurnOff(CTurnOff *msg); + virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + virtual bool EnterViewMsg(CEnterViewMsg *msg); + virtual bool TurnOn(CTurnOn *msg); + virtual bool MovieEndMsg(CMovieEndMsg *msg); public: CLASSDEF CArboretumGate(); diff --git a/engines/titanic/game/bar_bell.h b/engines/titanic/game/bar_bell.h index 865e446cc5..2d8a36b61a 100644 --- a/engines/titanic/game/bar_bell.h +++ b/engines/titanic/game/bar_bell.h @@ -28,8 +28,7 @@ namespace Titanic { -class CBarBell : public CGameObject, - public CEnterRoomMsgTarget { +class CBarBell : public CGameObject { public: int _fieldBC; int _fieldC0; diff --git a/engines/titanic/game/bomb.h b/engines/titanic/game/bomb.h index 9f33189d56..bd3852ef17 100644 --- a/engines/titanic/game/bomb.h +++ b/engines/titanic/game/bomb.h @@ -28,8 +28,7 @@ namespace Titanic { -class CBomb : public CBackground, - public CEnterRoomMsgTarget { +class CBomb : public CBackground { private: int _fieldE0; int _fieldE4; diff --git a/engines/titanic/game/cdrom.h b/engines/titanic/game/cdrom.h index 61bada0b74..fa1c80335a 100644 --- a/engines/titanic/game/cdrom.h +++ b/engines/titanic/game/cdrom.h @@ -29,11 +29,7 @@ namespace Titanic { -class CCDROM : public CGameObject, - public CMouseDragStartMsgTarget, - public CMouseDragEndMsgTarget, - public CMouseDragMoveMsgTarget, - public CActMsgTarget { +class CCDROM : public CGameObject { private: Point _tempPos; protected: diff --git a/engines/titanic/game/cdrom_tray.h b/engines/titanic/game/cdrom_tray.h index b1893c548e..0833847530 100644 --- a/engines/titanic/game/cdrom_tray.h +++ b/engines/titanic/game/cdrom_tray.h @@ -28,10 +28,7 @@ namespace Titanic { -class CCDROMTray : public CGameObject, - public CActMsgTarget, - public CMovieEndMsgTarget, - public CStatusChangeMsgTarget { +class CCDROMTray : public CGameObject { public: int _state; CString _string1; diff --git a/engines/titanic/game/chicken_cooler.h b/engines/titanic/game/chicken_cooler.h index 6f57cddb9c..f15bba4983 100644 --- a/engines/titanic/game/chicken_cooler.h +++ b/engines/titanic/game/chicken_cooler.h @@ -28,8 +28,7 @@ namespace Titanic { -class CChickenCooler : public CGameObject, - public CEnterRoomMsgTarget { +class CChickenCooler : public CGameObject { private: int _fieldBC; int _fieldC0; diff --git a/engines/titanic/game/dead_area.h b/engines/titanic/game/dead_area.h index c696c841c2..6390475d4e 100644 --- a/engines/titanic/game/dead_area.h +++ b/engines/titanic/game/dead_area.h @@ -31,9 +31,7 @@ namespace Titanic { /** * Implements a non-responsive screen area */ -class CDeadArea : public CGameObject, - public CMouseButtonDownMsgTarget, - public CMouseButtonUpMsgTarget { +class CDeadArea : public CGameObject { protected: virtual bool handleMessage(CMouseButtonDownMsg &msg) { return true; } virtual bool handleMessage(CMouseButtonUpMsg &msg) { return true; } diff --git a/engines/titanic/game/doorbot_elevator_handler.h b/engines/titanic/game/doorbot_elevator_handler.h index bd33747239..351fb1f13b 100644 --- a/engines/titanic/game/doorbot_elevator_handler.h +++ b/engines/titanic/game/doorbot_elevator_handler.h @@ -28,8 +28,7 @@ namespace Titanic { -class CDoorbotElevatorHandler : public CGameObject, - public CEnterNodeMsgTarget { +class CDoorbotElevatorHandler : public CGameObject { private: static int _v1; int _value; diff --git a/engines/titanic/game/end_sequence_control.h b/engines/titanic/game/end_sequence_control.h index 87eaf17c0e..61165e3ba5 100644 --- a/engines/titanic/game/end_sequence_control.h +++ b/engines/titanic/game/end_sequence_control.h @@ -28,8 +28,7 @@ namespace Titanic { -class CEndSequenceControl : public CGameObject, - public CEnterRoomMsgTarget { +class CEndSequenceControl : public CGameObject { protected: virtual bool handleMessage(CEnterRoomMsg &msg); public: diff --git a/engines/titanic/game/fan_noises.h b/engines/titanic/game/fan_noises.h index 495ac39f8e..778891e6e1 100644 --- a/engines/titanic/game/fan_noises.h +++ b/engines/titanic/game/fan_noises.h @@ -28,8 +28,7 @@ namespace Titanic { -class CFanNoises : public CGameObject, - public CEnterRoomMsgTarget { +class CFanNoises : public CGameObject { private: int _fieldBC; int _fieldC0; diff --git a/engines/titanic/game/get_lift_eye2.h b/engines/titanic/game/get_lift_eye2.h index 7ca0b4d32e..f7195878e0 100644 --- a/engines/titanic/game/get_lift_eye2.h +++ b/engines/titanic/game/get_lift_eye2.h @@ -27,8 +27,7 @@ #include "titanic/messages/messages.h" namespace Titanic { -class CGetLiftEye2 : public CGameObject, - public CEnterRoomMsgTarget { +class CGetLiftEye2 : public CGameObject { private: static CString *_v1; protected: diff --git a/engines/titanic/game/light.h b/engines/titanic/game/light.h index a2e562c573..e419a3bcd6 100644 --- a/engines/titanic/game/light.h +++ b/engines/titanic/game/light.h @@ -28,8 +28,7 @@ namespace Titanic { -class CLight : public CBackground, - public CEnterRoomMsgTarget { +class CLight : public CBackground { private: int _fieldE0; int _fieldE4; diff --git a/engines/titanic/game/light_switch.h b/engines/titanic/game/light_switch.h index 3e44590390..f2132c9bdf 100644 --- a/engines/titanic/game/light_switch.h +++ b/engines/titanic/game/light_switch.h @@ -28,8 +28,7 @@ namespace Titanic { -class CLightSwitch : public CBackground, - public CEnterRoomMsgTarget { +class CLightSwitch : public CBackground { public: static int _v1; private: diff --git a/engines/titanic/game/parrot/player_meets_parrot.h b/engines/titanic/game/parrot/player_meets_parrot.h index 9e47a0a932..bc96cb84f7 100644 --- a/engines/titanic/game/parrot/player_meets_parrot.h +++ b/engines/titanic/game/parrot/player_meets_parrot.h @@ -28,8 +28,7 @@ namespace Titanic { -class CPlayerMeetsParrot : public CGameObject, - public CEnterRoomMsgTarget { +class CPlayerMeetsParrot : public CGameObject { protected: virtual bool handleMessage(CEnterRoomMsg &msg); public: diff --git a/engines/titanic/game/pet/pet_monitor.h b/engines/titanic/game/pet/pet_monitor.h index 5cf14f38cb..56116d8313 100644 --- a/engines/titanic/game/pet/pet_monitor.h +++ b/engines/titanic/game/pet/pet_monitor.h @@ -28,8 +28,7 @@ namespace Titanic { -class CPETMonitor : public CGameObject, - public CEnterRoomMsgTarget { +class CPETMonitor : public CGameObject { protected: virtual bool handleMessage(CEnterRoomMsg &msg); public: diff --git a/engines/titanic/game/pet/pet_position.h b/engines/titanic/game/pet/pet_position.h index 820df41c50..589f2b60b1 100644 --- a/engines/titanic/game/pet/pet_position.h +++ b/engines/titanic/game/pet/pet_position.h @@ -28,8 +28,7 @@ namespace Titanic { -class CPETPosition : public CGameObject, - public CEnterRoomMsgTarget { +class CPETPosition : public CGameObject { protected: virtual bool handleMessage(CEnterRoomMsg &msg); public: diff --git a/engines/titanic/game/pet/pet_transport.h b/engines/titanic/game/pet/pet_transport.h index 8dd3f3aac5..2c94bb6fe7 100644 --- a/engines/titanic/game/pet/pet_transport.h +++ b/engines/titanic/game/pet/pet_transport.h @@ -28,8 +28,7 @@ namespace Titanic { -class CPETTransport : public CGameObject, - public CEnterRoomMsgTarget { +class CPETTransport : public CGameObject { protected: virtual bool handleMessage(CEnterRoomMsg &msg); public: diff --git a/engines/titanic/game/sgt/sgt_state_room.h b/engines/titanic/game/sgt/sgt_state_room.h index 6e53ad39da..7ae961145f 100644 --- a/engines/titanic/game/sgt/sgt_state_room.h +++ b/engines/titanic/game/sgt/sgt_state_room.h @@ -45,8 +45,7 @@ struct CSGTStateRoomStatics { int _v14; }; -class CSGTStateRoom : public CBackground, - public CEnterRoomMsgTarget { +class CSGTStateRoom : public CBackground { private: static CSGTStateRoomStatics *_statics; private: diff --git a/engines/titanic/game/ship_setting.h b/engines/titanic/game/ship_setting.h index 878feba8ba..5b5ea68719 100644 --- a/engines/titanic/game/ship_setting.h +++ b/engines/titanic/game/ship_setting.h @@ -28,8 +28,7 @@ namespace Titanic { -class CShipSetting : public CBackground, - public CEnterRoomMsgTarget { +class CShipSetting : public CBackground { private: CString _string3; Point _pos1; diff --git a/engines/titanic/game/start_action.h b/engines/titanic/game/start_action.h index 2b19e77fe2..ebdc4abf25 100644 --- a/engines/titanic/game/start_action.h +++ b/engines/titanic/game/start_action.h @@ -28,9 +28,7 @@ namespace Titanic { -class CStartAction : public CBackground, - public CMouseButtonDownMsgTarget, - public CMouseButtonUpMsgTarget { +class CStartAction : public CBackground { protected: CString _msgTarget; CString _msgAction; diff --git a/engines/titanic/game/transport/lift.h b/engines/titanic/game/transport/lift.h index c2a18df4dd..dc324e10c0 100644 --- a/engines/titanic/game/transport/lift.h +++ b/engines/titanic/game/transport/lift.h @@ -28,8 +28,7 @@ namespace Titanic { -class CLift : public CTransport, - public CEnterRoomMsgTarget { +class CLift : public CTransport { private: static int _v1; static int _v2; diff --git a/engines/titanic/game/transport/pellerator.h b/engines/titanic/game/transport/pellerator.h index b97d17ff88..82809a0717 100644 --- a/engines/titanic/game/transport/pellerator.h +++ b/engines/titanic/game/transport/pellerator.h @@ -28,8 +28,7 @@ namespace Titanic { -class CPellerator : public CTransport, - public CEnterRoomMsgTarget { +class CPellerator : public CTransport { private: static int _v1; static int _v2; diff --git a/engines/titanic/game/up_lighter.h b/engines/titanic/game/up_lighter.h index 589e279d6b..27b1d7b8fd 100644 --- a/engines/titanic/game/up_lighter.h +++ b/engines/titanic/game/up_lighter.h @@ -28,8 +28,7 @@ namespace Titanic { -class CUpLighter : public CDropTarget, - public CEnterRoomMsgTarget { +class CUpLighter : public CDropTarget { private: int _field118; int _field11C; diff --git a/engines/titanic/game/volume_control.h b/engines/titanic/game/volume_control.h index 5586c9cb45..ae10d975e2 100644 --- a/engines/titanic/game/volume_control.h +++ b/engines/titanic/game/volume_control.h @@ -28,7 +28,7 @@ namespace Titanic { -class CVolumeControl : public CGameObject, CEnterNodeMsgTarget { +class CVolumeControl : public CGameObject { private: int _fieldBC; CString _string1; diff --git a/engines/titanic/gfx/st_button.cpp b/engines/titanic/gfx/st_button.cpp index 387800430f..154122ed60 100644 --- a/engines/titanic/gfx/st_button.cpp +++ b/engines/titanic/gfx/st_button.cpp @@ -24,6 +24,12 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CSTButton, CBackground) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(MouseButtonUpMsg) + ON_MESSAGE(EnterViewMsg) +END_MESSAGE_MAP() + CSTButton::CSTButton() : CBackground() { _statusInc = 0; _statusTarget = "NULL"; @@ -60,14 +66,14 @@ void CSTButton::load(SimpleFile *file) { CBackground::load(file); } -bool CSTButton::handleMessage(CMouseButtonDownMsg &msg) { +bool CSTButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { changeStatus(0); // TODO: Obj6c stuff return true; } -bool CSTButton::handleMessage(CMouseButtonUpMsg &msg) { +bool CSTButton::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { int oldStatus = _currentStatus; int newStatus = _currentStatus + _statusInc; @@ -82,7 +88,7 @@ bool CSTButton::handleMessage(CMouseButtonUpMsg &msg) { return true; } -bool CSTButton::handleMessage(CEnterViewMsg &msg) { +bool CSTButton::EnterViewMsg(CEnterViewMsg *msg) { loadFrame(_buttonFrame); return true; } diff --git a/engines/titanic/gfx/st_button.h b/engines/titanic/gfx/st_button.h index d613ad0eea..fd2b0fa401 100644 --- a/engines/titanic/gfx/st_button.h +++ b/engines/titanic/gfx/st_button.h @@ -29,10 +29,8 @@ namespace Titanic { -class CSTButton : public CBackground, - public CMouseButtonDownMsgTarget, - public CMouseButtonUpMsgTarget, - public CEnterViewMsgTarget { +class CSTButton : public CBackground { + DECLARE_MESSAGE_MAP private: int _statusInc; CString _statusTarget; @@ -42,9 +40,9 @@ private: CString _string5; int _buttonFrame; protected: - virtual bool handleMessage(CMouseButtonDownMsg &msg); - virtual bool handleMessage(CMouseButtonUpMsg &msg); - virtual bool handleMessage(CEnterViewMsg &msg); + virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); + virtual bool EnterViewMsg(CEnterViewMsg *msg); public: CLASSDEF CSTButton(); diff --git a/engines/titanic/messages/messages.cpp b/engines/titanic/messages/messages.cpp index 1c3d406b1b..9f46fef6ca 100644 --- a/engines/titanic/messages/messages.cpp +++ b/engines/titanic/messages/messages.cpp @@ -23,6 +23,7 @@ #include "titanic/messages/messages.h" #include "titanic/messages/mouse_messages.h" #include "titanic/core/game_object.h" +#include "titanic/core/message_target.h" #include "titanic/core/tree_item.h" #include "titanic/titanic.h" @@ -79,6 +80,33 @@ bool CMessage::execute(const CString &target, const ClassDef *classDef, int flag return false; } +const MSGMAP_ENTRY *CMessage::findMapEntry(const CTreeItem *treeItem, const ClassDef *classDef) { + // Iterate through the class and any parent classes + for (const MSGMAP *msgMap = treeItem->getMessageMap(); msgMap->pFnGetBaseMap; + msgMap = msgMap->pFnGetBaseMap()) { + // Iterate through the map entries for this class + for (const MSGMAP_ENTRY *entry = msgMap->lpEntries; + entry->_class != nullptr; ++entry) { + // Check if the class or any of it's ancesotrs is handled by this entry + for (const ClassDef *entryDef = entry->_class; entryDef; entryDef = entryDef->_parent) { + if (entryDef == classDef) + return entry; + } + } + } + + return nullptr; +} + +bool CMessage::perform(CTreeItem *treeItem) { + const MSGMAP_ENTRY *entry = findMapEntry(treeItem, getType()); + return entry && (*treeItem.*(entry->_fn))(this); +} + +bool CMessage::supports(const CTreeItem *treeItem, ClassDef *classDef) { + return findMapEntry(treeItem, classDef) != nullptr; +} + bool CMessage::isMouseMsg() const { return dynamic_cast(this) != nullptr; } diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index f4c16f5017..e566b5d661 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -35,67 +35,49 @@ enum MessageFlag { MSGFLAG_CLASS_DEF = 4 }; -#define MSGTARGET(NAME) class NAME; class NAME##Target { public: \ - virtual bool handleMessage(NAME &msg) = 0; } - -#define MESSAGE0(NAME) MSGTARGET(NAME); \ +#define MESSAGE0(NAME) \ class NAME: public CMessage { \ public: NAME() : CMessage() {} \ CLASSDEF \ static bool isSupportedBy(const CTreeItem *item) { \ - return dynamic_cast(item) != nullptr; } \ - virtual bool perform(CTreeItem *treeItem) { \ - NAME##Target *dest = dynamic_cast(treeItem); \ - return dest != nullptr && dest->handleMessage(*this); \ - } } -#define MESSAGE1(NAME, F1, N1, V1) MSGTARGET(NAME); \ + return supports(item, _type); } \ +} +#define MESSAGE1(NAME, F1, N1, V1) \ class NAME: public CMessage { \ public: F1 _##N1; \ NAME() : CMessage(), _##N1(V1) {} \ NAME(F1 N1) : CMessage(), _##N1(N1) {} \ CLASSDEF \ static bool isSupportedBy(const CTreeItem *item) { \ - return dynamic_cast(item) != nullptr; } \ - virtual bool perform(CTreeItem *treeItem) { \ - NAME##Target *dest = dynamic_cast(treeItem); \ - return dest != nullptr && dest->handleMessage(*this); \ - } } -#define MESSAGE2(NAME, F1, N1, V1, F2, N2, V2) MSGTARGET(NAME); \ + return supports(item, _type); } \ +} +#define MESSAGE2(NAME, F1, N1, V1, F2, N2, V2) \ class NAME: public CMessage { \ public: F1 _##N1; F2 _##N2; \ NAME() : CMessage(), _##N1(V1), _##N2(V2) {} \ NAME(F1 N1, F2 N2) : CMessage(), _##N1(N1), _##N2(N2) {} \ CLASSDEF \ static bool isSupportedBy(const CTreeItem *item) { \ - return dynamic_cast(item) != nullptr; } \ - virtual bool perform(CTreeItem *treeItem) { \ - NAME##Target *dest = dynamic_cast(treeItem); \ - return dest != nullptr && dest->handleMessage(*this); \ - } } -#define MESSAGE3(NAME, F1, N1, V1, F2, N2, V2, F3, N3, V3) MSGTARGET(NAME); \ + return supports(item, _type); } \ +} +#define MESSAGE3(NAME, F1, N1, V1, F2, N2, V2, F3, N3, V3) \ class NAME: public CMessage { \ public: F1 _##N1; F2 _##N2; F3 _##N3; \ NAME() : CMessage(), _##N1(V1), _##N2(V2), _##N3(V3) {} \ NAME(F1 N1, F2 N2, F3 N3) : CMessage(), _##N1(N1), _##N2(N2), _##N3(N3) {} \ CLASSDEF \ static bool isSupportedBy(const CTreeItem *item) { \ - return dynamic_cast(item) != nullptr; } \ - virtual bool perform(CTreeItem *treeItem) { \ - NAME##Target *dest = dynamic_cast(treeItem); \ - return dest != nullptr && dest->handleMessage(*this); \ - } } -#define MESSAGE4(NAME, F1, N1, V1, F2, N2, V2, F3, N3, V3, F4, N4, V4) MSGTARGET(NAME); \ + return supports(item, _type); } \ +} +#define MESSAGE4(NAME, F1, N1, V1, F2, N2, V2, F3, N3, V3, F4, N4, V4) \ class NAME: public CMessage { \ public: F1 _##N1; F2 _##N2; F3 _##N3; F4 _##N4; \ NAME() : CMessage(), _##N1(V1), _##N2(V2), _##N3(V3), _##N4(V4) {} \ NAME(F1 N1, F2 N2, F3 N3, F4 N4) : CMessage(), _##N1(N1), _##N2(N2), _##N3(N3), _##N4(N4) {} \ CLASSDEF \ static bool isSupportedBy(const CTreeItem *item) { \ - return dynamic_cast(item) != nullptr; } \ - virtual bool perform(CTreeItem *treeItem) { \ - NAME##Target *dest = dynamic_cast(treeItem); \ - return dest != nullptr && dest->handleMessage(*this); \ - } } + return supports(item, _type); } \ +} class CGameObject; class CRoomItem; @@ -103,6 +85,11 @@ class CNodeItem; class CViewItem; class CMessage : public CSaveableObject { +private: + /** + * Find a map entry that supports the given class + */ + static const MSGMAP_ENTRY *findMapEntry(const CTreeItem *treeItem, const ClassDef *classDef); public: CLASSDEF CMessage(); @@ -121,7 +108,15 @@ public: bool execute(const CString &target, const ClassDef *classDef = nullptr, int flags = MSGFLAG_SCAN | MSGFLAG_BREAK_IF_HANDLED); - virtual bool perform(CTreeItem *treeItem) { return false; } + /** + * Makes the passed item execute the message + */ + virtual bool perform(CTreeItem *treeItem); + + /** + * Returns true if the passed item supports the specified message class + */ + static bool supports(const CTreeItem *treeItem, ClassDef *classDef); /** * Save the data for the class to file @@ -149,7 +144,6 @@ public: virtual bool isLeaveViewMsg() const; }; -MSGTARGET(CEditControlMsg); class CEditControlMsg : public CMessage { public: int _field4; @@ -164,16 +158,10 @@ public: _field1C(0), _field20(0) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; - } - - virtual bool perform(CTreeItem *treeItem) { - CEditControlMsgTarget *dest = dynamic_cast(treeItem); - return dest != nullptr && dest->handleMessage(*this); + return CMessage::supports(item, _type); } }; -MSGTARGET(CLightsMsg); class CLightsMsg : public CMessage { public: int _field4; @@ -186,15 +174,10 @@ public: _fieldC(0), _field10(0) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; - } - virtual bool perform(CTreeItem *treeItem) { - CLightsMsgTarget *dest = dynamic_cast(treeItem); - return dest != nullptr && dest->handleMessage(*this); + return supports(item, _type); } }; -MSGTARGET(CIsHookedOnMsg); class CIsHookedOnMsg : public CMessage { public: int _field4; @@ -209,15 +192,10 @@ public: _field18(0), _field1C(0), _field20(0) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; - } - virtual bool perform(CTreeItem *treeItem) { - CIsHookedOnMsgTarget *dest = dynamic_cast(treeItem); - return dest != nullptr && dest->handleMessage(*this); + return supports(item, _type); } }; -MSGTARGET(CSubAcceptCCarryMsg); class CSubAcceptCCarryMsg : public CMessage { public: CString _string1; @@ -227,15 +205,10 @@ public: CSubAcceptCCarryMsg() : _value1(0), _value2(0), _value3(0) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; - } - virtual bool perform(CTreeItem *treeItem) { - CSubAcceptCCarryMsgTarget *dest = dynamic_cast(treeItem); - return dest != nullptr && dest->handleMessage(*this); + return supports(item, _type); } }; -MSGTARGET(CTransportMsg); class CTransportMsg : public CMessage { public: CString _string; @@ -245,17 +218,12 @@ public: CTransportMsg() : _value1(0), _value2(0) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; - } - virtual bool perform(CTreeItem *treeItem) { - CTransportMsgTarget *dest = dynamic_cast(treeItem); - return dest != nullptr && dest->handleMessage(*this); + return supports(item, _type); } }; MESSAGE1(CTimeMsg, int, value, 0); -MSGTARGET(CTimerMsg); class CTimerMsg : public CTimeMsg { public: int _field8; @@ -266,11 +234,7 @@ public: CTimerMsg() : CTimeMsg(), _field8(0), _fieldC(0) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; - } - virtual bool perform(CTreeItem *treeItem) { - CTimerMsgTarget *dest = dynamic_cast(treeItem); - return dest != nullptr && dest->handleMessage(*this); + return supports(item, _type); } }; diff --git a/engines/titanic/messages/mouse_messages.h b/engines/titanic/messages/mouse_messages.h index 1bc77b6a87..811fdf0ad0 100644 --- a/engines/titanic/messages/mouse_messages.h +++ b/engines/titanic/messages/mouse_messages.h @@ -30,7 +30,6 @@ namespace Titanic { enum MouseButton { MB_LEFT = 1, MB_MIDDLE = 2, MB_RIGHT = 4 }; -MSGTARGET(CMouseMsg); class CMouseMsg : public CMessage { public: int _buttons; @@ -38,11 +37,7 @@ public: public: CLASSDEF static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; - } - virtual bool perform(CTreeItem *treeItem) { - CMouseMsgTarget *dest = dynamic_cast(treeItem); - return dest != nullptr && dest->handleMessage(*this); + return supports(item, _type); } CMouseMsg() : _buttons(0) {} @@ -50,7 +45,6 @@ public: _mousePos(pt), _buttons(buttons) {} }; -MSGTARGET(CMouseMoveMsg); class CMouseMoveMsg : public CMouseMsg { public: CLASSDEF @@ -58,15 +52,10 @@ public: CMouseMoveMsg(const Point &pt, int buttons) : CMouseMsg(pt, buttons) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; - } - virtual bool perform(CTreeItem *treeItem) { - CMouseMoveMsgTarget *dest = dynamic_cast(treeItem); - return dest != nullptr && dest->handleMessage(*this); + return supports(item, _type); } }; -MSGTARGET(CMouseButtonMsg); class CMouseButtonMsg : public CMouseMsg { public: int _field10; @@ -76,11 +65,10 @@ public: CMouseButtonMsg(const Point &pt, int buttons) : CMouseMsg(pt, buttons) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; + return supports(item, _type); } }; -MSGTARGET(CMouseButtonDownMsg); class CMouseButtonDownMsg : public CMouseButtonMsg { public: CLASSDEF @@ -88,15 +76,10 @@ public: CMouseButtonDownMsg(const Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; - } - virtual bool perform(CTreeItem *treeItem) { - CMouseButtonDownMsgTarget *dest = dynamic_cast(treeItem); - return dest != nullptr && dest->handleMessage(*this); + return supports(item, _type); } }; -MSGTARGET(CMouseButtonUpMsg); class CMouseButtonUpMsg : public CMouseButtonMsg { public: CLASSDEF @@ -104,15 +87,10 @@ public: CMouseButtonUpMsg(const Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; - } - virtual bool perform(CTreeItem *treeItem) { - CMouseButtonUpMsgTarget *dest = dynamic_cast(treeItem); - return dest != nullptr && dest->handleMessage(*this); + return supports(item, _type); } }; -MSGTARGET(CMouseDoubleClickMsg); class CMouseDoubleClickMsg : public CMouseButtonMsg { public: CLASSDEF @@ -120,15 +98,10 @@ public: CMouseDoubleClickMsg(const Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; - } - virtual bool perform(CTreeItem *treeItem) { - CMouseDoubleClickMsgTarget *dest = dynamic_cast(treeItem); - return dest != nullptr && dest->handleMessage(*this); + return supports(item, _type); } }; -MSGTARGET(CMouseDragMsg); class CMouseDragMsg : public CMouseMsg { public: CLASSDEF @@ -136,11 +109,10 @@ public: CMouseDragMsg(const Point &pt) : CMouseMsg(pt, 0) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; + return supports(item, _type); } }; -MSGTARGET(CMouseDragMoveMsg); class CMouseDragMoveMsg : public CMouseDragMsg { public: CLASSDEF @@ -148,15 +120,10 @@ public: CMouseDragMoveMsg(const Point &pt) : CMouseDragMsg(pt) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; - } - virtual bool perform(CTreeItem *treeItem) { - CMouseDragMoveMsgTarget *dest = dynamic_cast(treeItem); - return dest != nullptr && dest->handleMessage(*this); + return supports(item, _type); } }; -MSGTARGET(CMouseDragStartMsg); class CMouseDragStartMsg : public CMouseDragMsg { public: CTreeItem *_dragItem; @@ -168,15 +135,10 @@ public: _dragItem(nullptr), _field14(0) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; - } - virtual bool perform(CTreeItem *treeItem) { - CMouseDragStartMsgTarget *dest = dynamic_cast(treeItem); - return dest != nullptr && dest->handleMessage(*this); + return supports(item, _type); } }; -MSGTARGET(CMouseDragEndMsg); class CMouseDragEndMsg : public CMouseDragMsg { public: CTreeItem *_dropTarget; @@ -187,11 +149,7 @@ public: CMouseDragMsg(pt), _dropTarget(dragItem) {} static bool isSupportedBy(const CTreeItem *item) { - return dynamic_cast(item) != nullptr; - } - virtual bool perform(CTreeItem *treeItem) { - CMouseDragEndMsgTarget *dest = dynamic_cast(treeItem); - return dest != nullptr && dest->handleMessage(*this); + return supports(item, _type); } }; diff --git a/engines/titanic/messages/pet_messages.h b/engines/titanic/messages/pet_messages.h index 7e39056742..f7d9c301a6 100644 --- a/engines/titanic/messages/pet_messages.h +++ b/engines/titanic/messages/pet_messages.h @@ -42,18 +42,16 @@ MESSAGE1(CPETStarFieldLockMsg, int, value, 0); MESSAGE0(CPETStereoFieldOnOffMsg); MESSAGE2(CPETTargetMsg, CString, name, "", int, numValue, -1); -#define PET_MESSAGE(NAME) MSGTARGET(NAME); \ +#define PET_MESSAGE(NAME) \ class NAME: public CPETTargetMsg { \ public: \ NAME() : CPETTargetMsg() {} \ NAME(const CString &name, int num) : CPETTargetMsg(name, num) {} \ CLASSDEF \ static bool isSupportedBy(const CTreeItem *item) { \ - return dynamic_cast(item) != nullptr; } \ - virtual bool perform(CTreeItem *treeItem) { \ - NAME##Target *dest = dynamic_cast(treeItem); \ - return dest != nullptr && dest->handleMessage(*this); \ - } } + return supports(item, _type); \ + } \ +} PET_MESSAGE(CPETDownMsg); PET_MESSAGE(CPETUpMsg); diff --git a/engines/titanic/moves/enter_bridge.h b/engines/titanic/moves/enter_bridge.h index 743960d30e..0920443e1d 100644 --- a/engines/titanic/moves/enter_bridge.h +++ b/engines/titanic/moves/enter_bridge.h @@ -28,8 +28,7 @@ namespace Titanic { -class CEnterBridge : public CGameObject, - public CEnterRoomMsgTarget { +class CEnterBridge : public CGameObject { private: int _value; protected: diff --git a/engines/titanic/npcs/barbot.h b/engines/titanic/npcs/barbot.h index 0cad69a758..158db10f7a 100644 --- a/engines/titanic/npcs/barbot.h +++ b/engines/titanic/npcs/barbot.h @@ -28,8 +28,7 @@ namespace Titanic { -class CBarbot : public CTrueTalkNPC, - public CEnterRoomMsgTarget { +class CBarbot : public CTrueTalkNPC { private: static int _v0; private: diff --git a/engines/titanic/npcs/liftbot.h b/engines/titanic/npcs/liftbot.h index 03867cc6f3..a984ea8ffb 100644 --- a/engines/titanic/npcs/liftbot.h +++ b/engines/titanic/npcs/liftbot.h @@ -28,8 +28,7 @@ namespace Titanic { -class CLiftBot : public CTrueTalkNPC, - public CEnterRoomMsgTarget { +class CLiftBot : public CTrueTalkNPC { private: static int _v1; static int _v2; diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index fbb9efc0f1..5bc3edc7a6 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -27,6 +27,18 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CPetControl, CGameObject) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(MouseDragStartMsg) + ON_MESSAGE(MouseDragMoveMsg) + ON_MESSAGE(MouseDragEndMsg) + ON_MESSAGE(MouseButtonUpMsg) + ON_MESSAGE(MouseDoubleClickMsg) + ON_MESSAGE(KeyCharMsg) + ON_MESSAGE(VirtualKeyCharMsg) + ON_MESSAGE(TimerMsg) +END_MESSAGE_MAP() + CPetControl::CPetControl() : CGameObject(), _currentArea(PET_CONVERSATION), _fieldC0(0), _locked(0), _fieldC8(0), _treeItem1(nullptr), _treeItem2(nullptr), _hiddenRoom(nullptr), @@ -233,74 +245,74 @@ bool CPetControl::getC0() const { return _fieldC0 > 0; } -bool CPetControl::handleMessage(CMouseButtonDownMsg &msg) { - if (!containsPt(msg._mousePos) || getC0()) +bool CPetControl::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (!containsPt(msg->_mousePos) || getC0()) return false; bool result = false; if (isUnlocked()) - result = _frame.handleMessage(msg); + result = _frame.MouseButtonDownMsg(msg); if (!result) { - result = _sections[_currentArea]->handleMessage(msg); + result = _sections[_currentArea]->MouseButtonDownMsg(msg); } makeDirty(); return result; } -bool CPetControl::handleMessage(CMouseDragStartMsg &msg) { - if (!containsPt(msg._mousePos) || getC0()) +bool CPetControl::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (!containsPt(msg->_mousePos) || getC0()) return false; - return _sections[_currentArea]->handleMessage(msg); + return _sections[_currentArea]->MouseDragStartMsg(msg); } -bool CPetControl::handleMessage(CMouseDragMoveMsg &msg) { - return _sections[_currentArea]->handleMessage(msg); +bool CPetControl::MouseDragMoveMsg(CMouseDragMoveMsg *msg) { + return _sections[_currentArea]->MouseDragMoveMsg(msg); } -bool CPetControl::handleMessage(CMouseDragEndMsg &msg) { - return _sections[_currentArea]->handleMessage(msg); +bool CPetControl::MouseDragEndMsg(CMouseDragEndMsg *msg) { + return _sections[_currentArea]->MouseDragEndMsg(msg); } -bool CPetControl::handleMessage(CMouseButtonUpMsg &msg) { - if (!containsPt(msg._mousePos) || getC0()) +bool CPetControl::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + if (!containsPt(msg->_mousePos) || getC0()) return false; bool result = false; if (isUnlocked()) - result = _frame.handleMessage(msg); + result = _frame.MouseButtonUpMsg(msg); if (!result) - result = _sections[_currentArea]->handleMessage(msg); + result = _sections[_currentArea]->MouseButtonUpMsg(msg); makeDirty(); return result; } -bool CPetControl::handleMessage(CMouseDoubleClickMsg &msg) { - if (!containsPt(msg._mousePos) || getC0()) +bool CPetControl::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { + if (!containsPt(msg->_mousePos) || getC0()) return false; - return _sections[_currentArea]->handleMessage(msg); + return _sections[_currentArea]->MouseDoubleClickMsg(msg); } -bool CPetControl::handleMessage(CKeyCharMsg &msg) { +bool CPetControl::KeyCharMsg(CKeyCharMsg *msg) { if (getC0()) return false; - return _sections[_currentArea]->handleMessage(msg); + return _sections[_currentArea]->KeyCharMsg(msg); } -bool CPetControl::handleMessage(CVirtualKeyCharMsg &msg) { +bool CPetControl::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { if (getC0()) return false; - bool result = _sections[_currentArea]->handleMessage(msg); + bool result = _sections[_currentArea]->VirtualKeyCharMsg(msg); if (!result) { - switch (msg._keyState.keycode) { + switch (msg->_keyState.keycode) { case Common::KEYCODE_F1: result = true; setArea(PET_INVENTORY); @@ -329,7 +341,7 @@ bool CPetControl::handleMessage(CVirtualKeyCharMsg &msg) { return result; } -bool CPetControl::handleMessage(CTimerMsg &msg) { +bool CPetControl::TimerMsg(CTimerMsg *msg) { warning("TODO: CPetControl::CTimerMsg"); return true; } diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 6f5b7948e3..172cec9bf7 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -39,16 +39,8 @@ namespace Titanic { -class CPetControl : public CGameObject, - public CMouseButtonDownMsgTarget, - public CMouseDragStartMsgTarget, - public CMouseDragMoveMsgTarget, - public CMouseDragEndMsgTarget, - public CMouseButtonUpMsgTarget, - public CMouseDoubleClickMsgTarget, - public CKeyCharMsgTarget, - public CVirtualKeyCharMsgTarget, - public CTimerMsgTarget { +class CPetControl : public CGameObject { + DECLARE_MESSAGE_MAP private: int _fieldC0; int _locked; @@ -102,15 +94,15 @@ private: bool getC0() const; protected: - bool handleMessage(CMouseButtonDownMsg &msg); - bool handleMessage(CMouseDragStartMsg &msg); - bool handleMessage(CMouseDragMoveMsg &msg); - bool handleMessage(CMouseDragEndMsg &msg); - bool handleMessage(CMouseButtonUpMsg &msg); - bool handleMessage(CMouseDoubleClickMsg &msg); - bool handleMessage(CKeyCharMsg &msg); - bool handleMessage(CVirtualKeyCharMsg &msg); - bool handleMessage(CTimerMsg &msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); + bool MouseDragMoveMsg(CMouseDragMoveMsg *msg); + bool MouseDragEndMsg(CMouseDragEndMsg *msg); + bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); + bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg); + bool KeyCharMsg(CKeyCharMsg *msg); + bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg); + bool TimerMsg(CTimerMsg *msg); public: PetArea _currentArea; public: diff --git a/engines/titanic/pet_control/pet_element.cpp b/engines/titanic/pet_control/pet_element.cpp index 423c79af8b..68c258c0fb 100644 --- a/engines/titanic/pet_control/pet_element.cpp +++ b/engines/titanic/pet_control/pet_element.cpp @@ -40,8 +40,8 @@ bool CPetElement::proc6(const Common::Point &pt) { return result; } -bool CPetElement::handleMessage(CMouseButtonDownMsg &msg) { - bool result = _bounds.contains(msg._mousePos); +bool CPetElement::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + bool result = _bounds.contains(msg->_mousePos); if (result) setMode(MODE_UNSELECTED); return result; diff --git a/engines/titanic/pet_control/pet_element.h b/engines/titanic/pet_control/pet_element.h index 2d56b57c66..a53715ddb9 100644 --- a/engines/titanic/pet_control/pet_element.h +++ b/engines/titanic/pet_control/pet_element.h @@ -70,7 +70,7 @@ public: virtual void getBounds(Rect *rect); virtual bool proc6(const Common::Point &pt); - virtual bool handleMessage(CMouseButtonDownMsg &msg); + virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); /** * Returns whether the passed point falls inside the item diff --git a/engines/titanic/pet_control/pet_frame.cpp b/engines/titanic/pet_control/pet_frame.cpp index 6e3ff4f62c..1859b0d39f 100644 --- a/engines/titanic/pet_control/pet_frame.cpp +++ b/engines/titanic/pet_control/pet_frame.cpp @@ -63,9 +63,9 @@ bool CPetFrame::setup() { return true; } -bool CPetFrame::handleMessage(CMouseButtonDownMsg &msg) { +bool CPetFrame::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { for (int idx = 0; idx < 5; ++idx) { - if (_modeButtons[idx].handleMessage(msg)) { + if (_modeButtons[idx].MouseButtonDownMsg(msg)) { _petControl->setArea(PET_AREAS[idx]); resetArea(); _modeButtons[idx].setMode(MODE_SELECTED); diff --git a/engines/titanic/pet_control/pet_frame.h b/engines/titanic/pet_control/pet_frame.h index f26a2bf48e..ec8bd1e1d8 100644 --- a/engines/titanic/pet_control/pet_frame.h +++ b/engines/titanic/pet_control/pet_frame.h @@ -62,8 +62,8 @@ public: /** * Handles mouse down messages */ - virtual bool handleMessage(CMouseButtonDownMsg &msg); - virtual bool handleMessage(CMouseButtonUpMsg &msg) { return false; } + virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg) { return false; } /** * Returns true if the object is in a valid state diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 169f0c0e20..e20c03c3d5 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -80,14 +80,14 @@ public: * Following are handlers for the various messages that the PET can * pass onto the currently active section/area */ - virtual bool handleMessage(CMouseButtonDownMsg &msg) { return false; } - virtual bool handleMessage(CMouseDragStartMsg &msg) { return false; } - virtual bool handleMessage(CMouseDragMoveMsg &msg) { return false; } - virtual bool handleMessage(CMouseDragEndMsg &msg) { return false; } - virtual bool handleMessage(CMouseButtonUpMsg &msg) { return false; } - virtual bool handleMessage(CMouseDoubleClickMsg &msg) { return false; } - virtual bool handleMessage(CKeyCharMsg &msg) { return false; } - virtual bool handleMessage(CVirtualKeyCharMsg &msg) { return false; } + virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg) { return false; } + virtual bool MouseDragStartMsg(CMouseDragStartMsg *msg) { return false; } + virtual bool MouseDragMoveMsg(CMouseDragMoveMsg *msg) { return false; } + virtual bool MouseDragEndMsg(CMouseDragEndMsg *msg) { return false; } + virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg) { return false; } + virtual bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { return false; } + virtual bool KeyCharMsg(CKeyCharMsg *msg) { return false; } + virtual bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { return false; } virtual int proc14() { return 0; } virtual int proc15() { return 0; } diff --git a/engines/titanic/sound/auto_music_player.h b/engines/titanic/sound/auto_music_player.h index da8a386cb1..0848439d49 100644 --- a/engines/titanic/sound/auto_music_player.h +++ b/engines/titanic/sound/auto_music_player.h @@ -28,8 +28,7 @@ namespace Titanic { -class CAutoMusicPlayer : public CAutoMusicPlayerBase, - public CEnterRoomMsgTarget { +class CAutoMusicPlayer : public CAutoMusicPlayerBase { private: CString _string2; protected: diff --git a/engines/titanic/sound/music_player.h b/engines/titanic/sound/music_player.h index 4cc510c42f..614fa375cd 100644 --- a/engines/titanic/sound/music_player.h +++ b/engines/titanic/sound/music_player.h @@ -28,8 +28,7 @@ namespace Titanic { -class CMusicPlayer : public CGameObject, - public CEnterRoomMsgTarget { +class CMusicPlayer : public CGameObject { protected: int _fieldBC; CString _string1; diff --git a/engines/titanic/sound/node_auto_sound_player.h b/engines/titanic/sound/node_auto_sound_player.h index fee4d3dae3..451b94688d 100644 --- a/engines/titanic/sound/node_auto_sound_player.h +++ b/engines/titanic/sound/node_auto_sound_player.h @@ -28,8 +28,7 @@ namespace Titanic { -class CNodeAutoSoundPlayer : public CAutoSoundPlayer, - public CEnterNodeMsgTarget { +class CNodeAutoSoundPlayer : public CAutoSoundPlayer { private: int _fieldEC; protected: diff --git a/engines/titanic/sound/room_auto_sound_player.h b/engines/titanic/sound/room_auto_sound_player.h index c72aff1763..70d3dfee88 100644 --- a/engines/titanic/sound/room_auto_sound_player.h +++ b/engines/titanic/sound/room_auto_sound_player.h @@ -28,8 +28,7 @@ namespace Titanic { -class CRoomAutoSoundPlayer : public CAutoSoundPlayer, - public CEnterRoomMsgTarget { +class CRoomAutoSoundPlayer : public CAutoSoundPlayer { protected: virtual bool handleMessage(CEnterRoomMsg &msg); public: diff --git a/engines/titanic/sound/room_trigger_auto_music_player.h b/engines/titanic/sound/room_trigger_auto_music_player.h index 4ce4bae7fa..c3e4d0f6a4 100644 --- a/engines/titanic/sound/room_trigger_auto_music_player.h +++ b/engines/titanic/sound/room_trigger_auto_music_player.h @@ -28,7 +28,7 @@ namespace Titanic { -class CRoomTriggerAutoMusicPlayer : public CTriggerAutoMusicPlayer, CEnterRoomMsgTarget { +class CRoomTriggerAutoMusicPlayer : public CTriggerAutoMusicPlayer { protected: virtual bool handleMessage(CEnterRoomMsg &msg); public: -- cgit v1.2.3 From 826dcf1f42fc1a5c5a4e7c34f395e51c6f5944df Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 6 Apr 2016 23:38:46 -0400 Subject: TITANIC: Fix class hierarchy in ClassDef structures --- engines/titanic/core/saveable_object.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 1e359837a3..9f0ac320e2 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -421,7 +421,8 @@ Common::List *CSaveableObject::_classDefs; #define DEFFN(T) ClassDef *T::_type; \ CSaveableObject *Function##T() { return new T(); } -#define ADDFN(CHILD, PARENT) CHILD::_type = new TypeTemplate(#CHILD, nullptr); \ +#define ADDFN(CHILD, PARENT) \ + CHILD::_type = new TypeTemplate(#CHILD, PARENT::_type); \ (*_classList)[#CHILD] = Function##CHILD DEFFN(CArm) @@ -1321,7 +1322,7 @@ void CSaveableObject::initClassList() { ADDFN(CSmallChevLeftOn, CToggleSwitch); ADDFN(CSmallChevRightOff, CToggleSwitch); ADDFN(CSmallChevRightOn, CToggleSwitch); - ADDFN(CStatusChangeButton, CSTButtonClass); + ADDFN(CStatusChangeButton, CSTButton); ADDFN(CSTButton, CBackground); ADDFN(CTextDown, CPetGraphic); ADDFN(CTextSkrew, CPetGraphic); -- cgit v1.2.3 From bc7a7deb775568cdbe205e3f8c4f5ebd03e34141 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 7 Apr 2016 00:06:18 -0400 Subject: TITANIC: Fix showing custom cursors when highlighting objects --- engines/titanic/core/view_item.cpp | 10 +++++++--- engines/titanic/support/mouse_cursor.cpp | 4 +++- engines/titanic/support/mouse_cursor.h | 6 ++++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index 8120b3c671..d747f06ac8 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -209,9 +209,13 @@ bool CViewItem::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { bool CViewItem::MouseMoveMsg(CMouseMoveMsg *msg) { CScreenManager *screenManager = CScreenManager::_screenManagerPtr; + uint changeCount = screenManager->_mouseCursor->getChangeCount(); if (handleMouseMsg(msg, true)) { - screenManager->_mouseCursor->setCursor(CURSOR_ARROW); + // If the cursor hasn't been set in the call to handleMouseMsg, + // then reset it back to the default arrow cursor + if (screenManager->_mouseCursor->getChangeCount() == changeCount) + screenManager->_mouseCursor->setCursor(CURSOR_ARROW); } else { // Iterate through each link item, and if any is highlighted, // change the mouse cursor to the designated cursor for the item @@ -226,7 +230,7 @@ bool CViewItem::MouseMoveMsg(CMouseMoveMsg *msg) { treeItem = treeItem->getNextSibling(); } - if (!handleMouseMsg(msg, false)) + if (!handleMouseMsg(msg, false) || (screenManager->_mouseCursor->getChangeCount() == changeCount)) screenManager->_mouseCursor->setCursor(CURSOR_ARROW); } @@ -244,7 +248,7 @@ bool CViewItem::handleMouseMsg(CMouseMsg *msg, bool flag) { for (CTreeItem *treeItem = scan(this); treeItem; treeItem = treeItem->scan(this)) { CGameObject *gameObject = dynamic_cast(treeItem); if (gameObject) { - if (gameObject->checkPoint(msg->_mousePos, 0, 1) && + if (gameObject->checkPoint(msg->_mousePos, false, true) && (!flag || !gameObject->_field60)) { if (gameObjects.size() < 256) gameObjects.push_back(gameObject); diff --git a/engines/titanic/support/mouse_cursor.cpp b/engines/titanic/support/mouse_cursor.cpp index c4c57c6f07..a2bd11657c 100644 --- a/engines/titanic/support/mouse_cursor.cpp +++ b/engines/titanic/support/mouse_cursor.cpp @@ -50,7 +50,7 @@ static const int CURSOR_DATA[NUM_CURSORS][4] = { }; CMouseCursor::CMouseCursor(CScreenManager *screenManager) : - _screenManager(screenManager), _cursorId(CURSOR_HOURGLASS) { + _screenManager(screenManager), _cursorId(CURSOR_HOURGLASS), _setCursorCount(0) { loadCursorImages(); setCursor(CURSOR_ARROW); } @@ -90,6 +90,8 @@ void CMouseCursor::hide() { } void CMouseCursor::setCursor(CursorId cursorId) { + ++_setCursorCount; + if (cursorId != _cursorId) { CursorEntry &ce = _cursors[cursorId - 1]; CVideoSurface &surface = *ce._videoSurface; diff --git a/engines/titanic/support/mouse_cursor.h b/engines/titanic/support/mouse_cursor.h index 831e207632..6e1e6f7c3e 100644 --- a/engines/titanic/support/mouse_cursor.h +++ b/engines/titanic/support/mouse_cursor.h @@ -61,6 +61,7 @@ private: CScreenManager *_screenManager; CursorId _cursorId; CursorEntry _cursors[NUM_CURSORS]; + uint _setCursorCount; /** * Load the images for each cursor @@ -89,6 +90,11 @@ public: * Updates the mouse cursor */ void update(); + + /** + * Returns the number of times the cursor has been set + */ + uint getChangeCount() const { return _setCursorCount; } }; -- cgit v1.2.3 From cdfd9f3703050a36e16455f4bf8c343b36dd4b39 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 7 Apr 2016 00:13:22 -0400 Subject: TITANIC: Fix message map for CTelevision --- engines/titanic/game/television.cpp | 62 +++++++++++++++++++++++-------------- engines/titanic/game/television.h | 27 ++++++++-------- 2 files changed, 53 insertions(+), 36 deletions(-) diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp index 610a3f0596..5585cfc429 100644 --- a/engines/titanic/game/television.cpp +++ b/engines/titanic/game/television.cpp @@ -25,6 +25,22 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CTelevision, CGameObject) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(ChangeSeasonMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(PETUpMsg) + ON_MESSAGE(PETDownMsg) + ON_MESSAGE(StatusChangeMsg) + ON_MESSAGE(ActMsg) + ON_MESSAGE(PETActivateMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(ShipSettingMsg) + ON_MESSAGE(TurnOff) + ON_MESSAGE(TurnOn) + ON_MESSAGE(LightsMsg) +END_MESSAGE_MAP() + int CTelevision::_v1; bool CTelevision::_turnOn; int CTelevision::_v3; @@ -82,7 +98,7 @@ void CTelevision::load(SimpleFile *file) { CBackground::load(file); } -bool CTelevision::handleMessage(CLeaveViewMsg &msg) { +bool CTelevision::LeaveViewMsg(CLeaveViewMsg *msg) { clearPet(); if (_isOn) { if (soundFn1(_fieldF0)) @@ -102,17 +118,17 @@ bool CTelevision::handleMessage(CLeaveViewMsg &msg) { return true; } -bool CTelevision::handleMessage(CChangeSeasonMsg &msg) { - if (msg._season.compareTo("Autumn")) { +bool CTelevision::ChangeSeasonMsg(CChangeSeasonMsg *msg) { + if (msg->_season.compareTo("Autumn")) { _v1 = 545; _v3 = 0; - } else if (msg._season.compareTo("Winter")) { + } else if (msg->_season.compareTo("Winter")) { _v1 = 503; _v3 = 0; - } else if (msg._season.compareTo("Spring")) { + } else if (msg->_season.compareTo("Spring")) { _v1 = 517; _v3 = 0; - } else if (msg._season.compareTo("Winter")) { + } else if (msg->_season.compareTo("Winter")) { _v1 = 531; _v3 = 0; } @@ -120,7 +136,7 @@ bool CTelevision::handleMessage(CChangeSeasonMsg &msg) { return true; } -bool CTelevision::handleMessage(CEnterViewMsg &msg) { +bool CTelevision::EnterViewMsg(CEnterViewMsg *msg) { setPetArea(PET_REMOTE); petFn2(2); petFn3(0); @@ -133,8 +149,8 @@ bool CTelevision::handleMessage(CEnterViewMsg &msg) { static const int FRAMES1[9] = { 0, 0, 56, 112, 168, 224, 280, 336, 392 }; static const int FRAMES2[8] = { 0, 55, 111, 167, 223, 279, 335, 391 }; -bool CTelevision::handleMessage(CPETUpMsg &msg) { - if (msg._name == "Television" && _isOn) { +bool CTelevision::PETUpMsg(CPETUpMsg *msg) { + if (msg->_name == "Television" && _isOn) { if (soundFn1(_fieldF0)) soundFn2(_fieldF0, 0); @@ -146,8 +162,8 @@ bool CTelevision::handleMessage(CPETUpMsg &msg) { return true; } -bool CTelevision::handleMessage(CPETDownMsg &msg) { - if (msg._name == "Television" && _isOn) { +bool CTelevision::PETDownMsg(CPETDownMsg *msg) { + if (msg->_name == "Television" && _isOn) { if (soundFn1(_fieldF0)) soundFn2(_fieldF0, 0); if (--_fieldE0 < 1) @@ -161,7 +177,7 @@ bool CTelevision::handleMessage(CPETDownMsg &msg) { return true; } -bool CTelevision::handleMessage(CStatusChangeMsg &msg) { +bool CTelevision::StatusChangeMsg(CStatusChangeMsg *msg) { if (_isOn) { stopMovie(); changeStatus(0); @@ -170,8 +186,8 @@ bool CTelevision::handleMessage(CStatusChangeMsg &msg) { return true; } -bool CTelevision::handleMessage(CActMsg &msg) { - if (msg._action == "TurnTVOnOff") { +bool CTelevision::ActMsg(CActMsg *msg) { + if (msg->_action == "TurnTVOnOff") { _isOn = !_isOn; if (_isOn) { setVisible(true); @@ -186,8 +202,8 @@ bool CTelevision::handleMessage(CActMsg &msg) { return true; } -bool CTelevision::handleMessage(CPETActivateMsg &msg) { - if (msg._name == "Television") { +bool CTelevision::PETActivateMsg(CPETActivateMsg *msg) { + if (msg->_name == "Television") { CVisibleMsg visibleMsg(_isOn); _isOn = !_isOn; @@ -210,32 +226,32 @@ bool CTelevision::handleMessage(CPETActivateMsg &msg) { return true; } -bool CTelevision::handleMessage(CMovieEndMsg &msg) { +bool CTelevision::MovieEndMsg(CMovieEndMsg *msg) { warning("TODO: CMovieEndMsg"); return true; } -bool CTelevision::handleMessage(CShipSettingMsg &msg) { - _v4 = msg._value; +bool CTelevision::ShipSettingMsg(CShipSettingMsg *msg) { + _v4 = msg->_value; return true; } -bool CTelevision::handleMessage(CTurnOff &msg) { +bool CTelevision::TurnOff(CTurnOff *msg) { _turnOn = false; return true; } -bool CTelevision::handleMessage(CTurnOn &msg) { +bool CTelevision::TurnOn(CTurnOn *msg) { _turnOn = true; return true; } -bool CTelevision::handleMessage(CLightsMsg &msg) { +bool CTelevision::LightsMsg(CLightsMsg *msg) { CPetControl *pet = getPetControl(); if (pet) pet->fn4(); - if (msg._field8 || !_turnOn) + if (msg->_field8 || !_turnOn) _turnOn = true; return true; diff --git a/engines/titanic/game/television.h b/engines/titanic/game/television.h index 9fb33943c0..54e86636d0 100644 --- a/engines/titanic/game/television.h +++ b/engines/titanic/game/television.h @@ -30,6 +30,7 @@ namespace Titanic { class CTelevision : public CBackground { + DECLARE_MESSAGE_MAP private: static int _v1; static bool _turnOn; @@ -44,19 +45,19 @@ private: int _fieldEC; int _fieldF0; protected: - virtual bool handleMessage(CLeaveViewMsg &msg); - virtual bool handleMessage(CChangeSeasonMsg &msg); - virtual bool handleMessage(CEnterViewMsg &msg); - virtual bool handleMessage(CPETUpMsg &msg); - virtual bool handleMessage(CPETDownMsg &msg); - virtual bool handleMessage(CStatusChangeMsg &msg); - virtual bool handleMessage(CActMsg &msg); - virtual bool handleMessage(CPETActivateMsg &msg); - virtual bool handleMessage(CMovieEndMsg &msg); - virtual bool handleMessage(CShipSettingMsg &msg); - virtual bool handleMessage(CTurnOff &msg); - virtual bool handleMessage(CTurnOn &msg); - virtual bool handleMessage(CLightsMsg &msg); + virtual bool LeaveViewMsg(CLeaveViewMsg *msg); + virtual bool ChangeSeasonMsg(CChangeSeasonMsg *msg); + virtual bool EnterViewMsg(CEnterViewMsg *msg); + virtual bool PETUpMsg(CPETUpMsg *msg); + virtual bool PETDownMsg(CPETDownMsg *msg); + virtual bool StatusChangeMsg(CStatusChangeMsg *msg); + virtual bool ActMsg(CActMsg *msg); + virtual bool PETActivateMsg(CPETActivateMsg *msg); + virtual bool MovieEndMsg(CMovieEndMsg *msg); + virtual bool ShipSettingMsg(CShipSettingMsg *msg); + virtual bool TurnOff(CTurnOff *msg); + virtual bool TurnOn(CTurnOn *msg); + virtual bool LightsMsg(CLightsMsg *msg); public: CLASSDEF CTelevision(); -- cgit v1.2.3 From 31934ac4ba62546d66e565e6caa0da0caa666d23 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 7 Apr 2016 19:14:25 -0400 Subject: TITANIC: Fleshed out CCDROMTray class --- engines/titanic/core/game_object.cpp | 6 +-- engines/titanic/core/game_object.h | 4 +- engines/titanic/game/cdrom.cpp | 2 +- engines/titanic/game/cdrom_tray.cpp | 74 ++++++++++++++++++++++++++++++++---- engines/titanic/game/cdrom_tray.h | 9 +++-- 5 files changed, 77 insertions(+), 18 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 2bac988b31..0570008a09 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -410,15 +410,15 @@ int CGameObject::getSurface45() const { return _surface ? _surface->proc45() : 0; } -void CGameObject::calcProximity(const CString &name, int val2, int val3, int val4) { +void CGameObject::soundProximity(const CString &name, int val2, int val3, int val4) { CProximity prox; prox._field8 = val2; prox._fieldC = val3; prox._field20 = val4; - calcProximity(name, prox); + soundProximity(name, prox); } -void CGameObject::calcProximity(const CString &name, CProximity &prox) { +void CGameObject::soundProximity(const CString &name, CProximity &prox) { if (prox._field28 == 2) { // TODO } diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 7391a6b079..72192425f4 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -56,7 +56,6 @@ private: void loadImage(const CString &name, bool pendingFlag = true); void processClipList2(); - void calcProximity(const CString &name, CProximity &obj6C); protected: Rect _bounds; double _field34; @@ -181,7 +180,8 @@ public: */ void loadFrame(int frameNumber); - void calcProximity(const CString &name, int val2, int val3, int val4); + void soundProximity(const CString &name, int val2, int val3, int val4); + void soundProximity(const CString &name, CProximity &obj6C); }; } // End of namespace Titanic diff --git a/engines/titanic/game/cdrom.cpp b/engines/titanic/game/cdrom.cpp index d4e4eac4d1..4f4089de73 100644 --- a/engines/titanic/game/cdrom.cpp +++ b/engines/titanic/game/cdrom.cpp @@ -55,7 +55,7 @@ bool CCDROM::handleMessage(CMouseDragEndMsg &msg) { if (msg._dropTarget && msg._dropTarget->getName() == "newComputer") { CCDROMTray *newTray = dynamic_cast(getRoom()->findByName("newTray")); - if (newTray->_state && newTray->_string1 == "None") { + if (newTray->_state && newTray->_insertedCD == "None") { CActMsg actMsg(getName()); actMsg.execute(newTray); } diff --git a/engines/titanic/game/cdrom_tray.cpp b/engines/titanic/game/cdrom_tray.cpp index 7265332c02..77ee539c57 100644 --- a/engines/titanic/game/cdrom_tray.cpp +++ b/engines/titanic/game/cdrom_tray.cpp @@ -20,17 +20,26 @@ * */ +#include "titanic/core/room_item.h" #include "titanic/game/cdrom_tray.h" +#include "titanic/messages/messages.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CCDROMTray, CGameObject) + ON_MESSAGE(ActMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(StatusChangeMsg) +END_MESSAGE_MAP() + + CCDROMTray::CCDROMTray() : CGameObject(), _state(0) { } void CCDROMTray::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); file->writeNumberLine(_state, indent); - file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_insertedCD, indent); CGameObject::save(file, indent); } @@ -38,23 +47,72 @@ void CCDROMTray::save(SimpleFile *file, int indent) const { void CCDROMTray::load(SimpleFile *file) { file->readNumber(); _state = file->readNumber(); - _string1 = file->readString(); + _insertedCD = file->readString(); CGameObject::load(file); } -bool CCDROMTray::handleMessage(CActMsg &msg) { - // TODO +bool CCDROMTray::ActMsg(CActMsg *msg) { + if (msg->_action == "ClickedOn") { + if (_state) { + if (_insertedCD == "None") { + fn1(55, 65, 0); + soundProximity("a#35.wav", 50, 0, 0); + _state = 0; + } else { + CTreeItem *treeItem = getRoom()->findByName(_insertedCD); + if (treeItem) { + CActMsg actMsg("Ejected"); + actMsg.execute(treeItem); + } + + _insertedCD = "None"; + loadFrame(52); + } + } else if (_insertedCD == "None") { + fn1(44, 54, 0); + soundProximity("a#34.wav", 50, 0, 0); + _state = 1; + } else if (_insertedCD == "newCD1" || _insertedCD == "newCD2") { + fn1(22, 32, 0); + soundProximity("a#34.wav", 50, 0, 0); + _state = 1; + } else if (_insertedCD == "newSTCD") { + fn1(0, 10, 0); + soundProximity("a#34.wav", 50, 0, 0); + _state = 1; + } + } else if (_state) { + if (msg->_action == "newCD1" || msg->_action == "newCD2") { + fn1(33, 43, 4); + soundProximity("a#35.wav", 50, 0, 0); + } else if (msg->_action == "newSTCD") { + fn1(11, 21, 4); + soundProximity("a#35.wav", 50, 0, 0); + } else { + return true; + } + + _insertedCD = msg->_action; + _state = 0; + } + return true; } -bool CCDROMTray::handleMessage(CMovieEndMsg &msg) { - // TODO +bool CCDROMTray::MovieEndMsg(CMovieEndMsg *msg) { + CTreeItem *treeItem = getRoom()->findByName("newScreen"); + + if (treeItem) { + CActMsg actMsg(_insertedCD); + actMsg.execute(treeItem); + } + return true; } -bool CCDROMTray::handleMessage(CStatusChangeMsg &msg) { - // TODO +bool CCDROMTray::StatusChangeMsg(CStatusChangeMsg *msg) { + msg->_success = _state; return true; } diff --git a/engines/titanic/game/cdrom_tray.h b/engines/titanic/game/cdrom_tray.h index 0833847530..728471c654 100644 --- a/engines/titanic/game/cdrom_tray.h +++ b/engines/titanic/game/cdrom_tray.h @@ -29,13 +29,14 @@ namespace Titanic { class CCDROMTray : public CGameObject { + DECLARE_MESSAGE_MAP public: int _state; - CString _string1; + CString _insertedCD; protected: - virtual bool handleMessage(CActMsg &msg); - virtual bool handleMessage(CMovieEndMsg &msg); - virtual bool handleMessage(CStatusChangeMsg &msg); + virtual bool ActMsg(CActMsg *msg); + virtual bool MovieEndMsg(CMovieEndMsg *msg); + virtual bool StatusChangeMsg(CStatusChangeMsg *msg); public: CLASSDEF CCDROMTray(); -- cgit v1.2.3 From 6fd32e6dc10e8b3332b0438c069a61f009185441 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 7 Apr 2016 19:50:16 -0400 Subject: TITANIC: Minor change to Cursor enum --- engines/titanic/core/view_item.cpp | 2 +- engines/titanic/support/mouse_cursor.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index d747f06ac8..3f6d5d5cff 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -262,7 +262,7 @@ bool CViewItem::handleMouseMsg(CMouseMsg *msg, bool flag) { return false; for (int idx = (int)gameObjects.size() - 1; idx >= 0; ++idx) { - if (gameObjects[idx]->_cursorId != CURSOR_ARROW2) { + if (gameObjects[idx]->_cursorId != CURSOR_IGNORE) { CScreenManager::_screenManagerPtr->_mouseCursor->setCursor(gameObjects[idx]->_cursorId); break; } diff --git a/engines/titanic/support/mouse_cursor.h b/engines/titanic/support/mouse_cursor.h index 6e1e6f7c3e..ac5da26382 100644 --- a/engines/titanic/support/mouse_cursor.h +++ b/engines/titanic/support/mouse_cursor.h @@ -42,7 +42,7 @@ enum CursorId { CURSOR_ACTIVATE = 9, CURSOR_INVALID = 10, CURSOR_MAGNIFIER = 11, - CURSOR_ARROW2 = 12, + CURSOR_IGNORE = 12, CURSOR_BACKWARDS = 13, CURSOR_DOWN = 14, CURSOR_HOURGLASS = 15 -- cgit v1.2.3 From 41c08d186adc91111e9beccfeef80efb3fcc0fd6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 7 Apr 2016 19:55:27 -0400 Subject: TITANIC: Implement CDeadArea messages --- engines/titanic/game/dead_area.cpp | 5 +++++ engines/titanic/game/dead_area.h | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/engines/titanic/game/dead_area.cpp b/engines/titanic/game/dead_area.cpp index 1692d6b8d1..5d5b2d06aa 100644 --- a/engines/titanic/game/dead_area.cpp +++ b/engines/titanic/game/dead_area.cpp @@ -24,6 +24,11 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CDeadArea, CGameObject) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(MouseButtonUpMsg) +END_MESSAGE_MAP() + CDeadArea::CDeadArea() : CGameObject() { } diff --git a/engines/titanic/game/dead_area.h b/engines/titanic/game/dead_area.h index 6390475d4e..9a9de3ad92 100644 --- a/engines/titanic/game/dead_area.h +++ b/engines/titanic/game/dead_area.h @@ -32,9 +32,10 @@ namespace Titanic { * Implements a non-responsive screen area */ class CDeadArea : public CGameObject { + DECLARE_MESSAGE_MAP protected: - virtual bool handleMessage(CMouseButtonDownMsg &msg) { return true; } - virtual bool handleMessage(CMouseButtonUpMsg &msg) { return true; } + virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg) { return true; } + virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg) { return true; } public: CLASSDEF CDeadArea(); -- cgit v1.2.3 From 9f1bab55972b8a6f88b83c2391c40a038ffb509d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 7 Apr 2016 22:03:35 -0400 Subject: TITANIC: Converting other message stubs to new format --- engines/titanic/core/background.h | 10 ++++---- engines/titanic/core/view_item.h | 9 ++++---- engines/titanic/game/arboretum_gate.h | 15 ++++++------ engines/titanic/game/auto_animate.cpp | 2 +- engines/titanic/game/auto_animate.h | 3 +-- engines/titanic/game/bar_bell.cpp | 2 +- engines/titanic/game/bar_bell.h | 3 +-- engines/titanic/game/bomb.cpp | 2 +- engines/titanic/game/bomb.h | 3 +-- engines/titanic/game/cdrom.cpp | 27 ++++++++++++++-------- engines/titanic/game/cdrom.h | 10 ++++---- engines/titanic/game/cdrom_tray.h | 7 +++--- engines/titanic/game/chicken_cooler.cpp | 2 +- engines/titanic/game/chicken_cooler.h | 3 +-- engines/titanic/game/dead_area.h | 5 ++-- engines/titanic/game/doorbot_elevator_handler.cpp | 2 +- engines/titanic/game/doorbot_elevator_handler.h | 3 +-- engines/titanic/game/end_sequence_control.cpp | 2 +- engines/titanic/game/end_sequence_control.h | 3 +-- engines/titanic/game/fan_noises.cpp | 2 +- engines/titanic/game/fan_noises.h | 3 +-- engines/titanic/game/get_lift_eye2.cpp | 2 +- engines/titanic/game/get_lift_eye2.h | 3 +-- engines/titanic/game/gondolier/gondolier_mixer.cpp | 6 ++--- engines/titanic/game/gondolier/gondolier_mixer.h | 3 +-- engines/titanic/game/light.cpp | 2 +- engines/titanic/game/light.h | 3 +-- engines/titanic/game/light_switch.cpp | 2 +- engines/titanic/game/light_switch.h | 3 +-- engines/titanic/game/long_stick_dispenser.cpp | 2 +- engines/titanic/game/long_stick_dispenser.h | 3 +-- .../titanic/game/parrot/player_meets_parrot.cpp | 2 +- engines/titanic/game/parrot/player_meets_parrot.h | 2 +- engines/titanic/game/pet/pet_monitor.cpp | 6 ++++- engines/titanic/game/pet/pet_monitor.h | 4 ++-- engines/titanic/game/pet/pet_position.cpp | 6 ++++- engines/titanic/game/pet/pet_position.h | 4 ++-- engines/titanic/game/pet/pet_transport.cpp | 6 ++++- engines/titanic/game/pet/pet_transport.h | 4 ++-- engines/titanic/game/phonograph.cpp | 2 +- engines/titanic/game/phonograph.h | 3 +-- engines/titanic/game/sgt/sgt_state_room.cpp | 6 ++++- engines/titanic/game/sgt/sgt_state_room.h | 4 ++-- engines/titanic/game/ship_setting.cpp | 2 +- engines/titanic/game/ship_setting.h | 3 +-- engines/titanic/game/start_action.cpp | 9 ++++++-- engines/titanic/game/start_action.h | 6 ++--- engines/titanic/game/television.h | 27 +++++++++++----------- engines/titanic/game/transport/lift.cpp | 6 ++++- engines/titanic/game/transport/lift.h | 4 ++-- engines/titanic/game/transport/lift_indicator.cpp | 4 ++++ engines/titanic/game/transport/lift_indicator.h | 4 ++-- engines/titanic/game/transport/pellerator.cpp | 6 ++++- engines/titanic/game/transport/pellerator.h | 4 ++-- engines/titanic/game/up_lighter.cpp | 2 +- engines/titanic/game/up_lighter.h | 3 +-- engines/titanic/game/volume_control.cpp | 2 +- engines/titanic/game/volume_control.h | 3 +-- engines/titanic/gfx/st_button.h | 7 +++--- engines/titanic/messages/bilge_dispensor_event.cpp | 2 +- engines/titanic/messages/bilge_dispensor_event.h | 3 +-- engines/titanic/moves/enter_bridge.cpp | 2 +- engines/titanic/moves/enter_bridge.h | 3 +-- engines/titanic/npcs/barbot.cpp | 2 +- engines/titanic/npcs/barbot.h | 3 +-- engines/titanic/npcs/liftbot.cpp | 2 +- engines/titanic/npcs/liftbot.h | 3 +-- engines/titanic/sound/auto_music_player.cpp | 2 +- engines/titanic/sound/auto_music_player.h | 3 +-- engines/titanic/sound/music_player.cpp | 2 +- engines/titanic/sound/music_player.h | 3 +-- engines/titanic/sound/node_auto_sound_player.cpp | 2 +- engines/titanic/sound/node_auto_sound_player.h | 3 +-- .../titanic/sound/restricted_auto_music_player.cpp | 2 +- .../titanic/sound/restricted_auto_music_player.h | 3 +-- engines/titanic/sound/room_auto_sound_player.cpp | 2 +- engines/titanic/sound/room_auto_sound_player.h | 3 +-- .../sound/room_trigger_auto_music_player.cpp | 2 +- .../titanic/sound/room_trigger_auto_music_player.h | 3 +-- engines/titanic/sound/titania_speech.cpp | 2 +- engines/titanic/sound/titania_speech.h | 3 +-- 81 files changed, 174 insertions(+), 169 deletions(-) diff --git a/engines/titanic/core/background.h b/engines/titanic/core/background.h index 91c34073cd..f4969d4454 100644 --- a/engines/titanic/core/background.h +++ b/engines/titanic/core/background.h @@ -29,18 +29,16 @@ namespace Titanic { class CBackground : public CGameObject { + DECLARE_MESSAGE_MAP + bool StatusChangeMsg(CStatusChangeMsg *msg); + bool SetFrameMsg(CSetFrameMsg *msg); + bool VisibleMsg(CVisibleMsg *msg); protected: int _fieldBC; int _fieldC0; CString _string1; CString _string2; int _fieldDC; -protected: - DECLARE_MESSAGE_MAP - - virtual bool StatusChangeMsg(CStatusChangeMsg *msg); - virtual bool SetFrameMsg(CSetFrameMsg *msg); - virtual bool VisibleMsg(CVisibleMsg *msg); public: CLASSDEF CBackground(); diff --git a/engines/titanic/core/view_item.h b/engines/titanic/core/view_item.h index 95edc7a49a..5abcf1d012 100644 --- a/engines/titanic/core/view_item.h +++ b/engines/titanic/core/view_item.h @@ -31,6 +31,10 @@ namespace Titanic { class CViewItem : public CNamedItem { DECLARE_MESSAGE_MAP + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); + bool MouseMoveMsg(CMouseMoveMsg *msg); + bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg); private: CTreeItem *_buttonUpTargets[4]; private: @@ -51,11 +55,6 @@ protected: CResourceKey _resourceKey; int _field50; int _field54; -protected: - virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); - virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); - virtual bool MouseMoveMsg(CMouseMoveMsg *msg); - virtual bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg); public: int _viewNumber; public: diff --git a/engines/titanic/game/arboretum_gate.h b/engines/titanic/game/arboretum_gate.h index 9b0674fe75..736f67bd7b 100644 --- a/engines/titanic/game/arboretum_gate.h +++ b/engines/titanic/game/arboretum_gate.h @@ -31,6 +31,13 @@ namespace Titanic { class CArboretumGate : public CBackground { DECLARE_MESSAGE_MAP + bool ActMsg(CActMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool TurnOff(CTurnOff *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool TurnOn(CTurnOn *msg); + bool MovieEndMsg(CMovieEndMsg *msg); private: static int _v1; static int _v2; @@ -66,14 +73,6 @@ private: int _field14C; int _field150; CString _string2; -protected: - virtual bool ActMsg(CActMsg *msg); - virtual bool LeaveViewMsg(CLeaveViewMsg *msg); - virtual bool TurnOff(CTurnOff *msg); - virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); - virtual bool EnterViewMsg(CEnterViewMsg *msg); - virtual bool TurnOn(CTurnOn *msg); - virtual bool MovieEndMsg(CMovieEndMsg *msg); public: CLASSDEF CArboretumGate(); diff --git a/engines/titanic/game/auto_animate.cpp b/engines/titanic/game/auto_animate.cpp index 2a3f3719e6..8bd332a550 100644 --- a/engines/titanic/game/auto_animate.cpp +++ b/engines/titanic/game/auto_animate.cpp @@ -40,7 +40,7 @@ void CAutoAnimate::load(SimpleFile *file) { CBackground::load(file); } -bool CAutoAnimate::handleMessage(CEnterViewMsg &msg) { +bool CAutoAnimate::EnterViewMsg(CEnterViewMsg *msg) { warning("CAutoAnimate::handleEvent"); return true; } diff --git a/engines/titanic/game/auto_animate.h b/engines/titanic/game/auto_animate.h index 6fb85117ee..7130d6a5cf 100644 --- a/engines/titanic/game/auto_animate.h +++ b/engines/titanic/game/auto_animate.h @@ -29,12 +29,11 @@ namespace Titanic { class CAutoAnimate : public CBackground { + bool EnterViewMsg(CEnterViewMsg *msg); private: int _fieldE0; int _fieldE4; int _fieldE8; -protected: - virtual bool handleMessage(CEnterViewMsg &msg); public: CLASSDEF CAutoAnimate() : CBackground(), _fieldE0(1), _fieldE4(1), _fieldE8(0) {} diff --git a/engines/titanic/game/bar_bell.cpp b/engines/titanic/game/bar_bell.cpp index 84a4d04b49..adb563cfde 100644 --- a/engines/titanic/game/bar_bell.cpp +++ b/engines/titanic/game/bar_bell.cpp @@ -50,7 +50,7 @@ void CBarBell::load(SimpleFile *file) { CGameObject::load(file); } -bool CBarBell::handleMessage(CEnterRoomMsg &msg) { +bool CBarBell::EnterRoomMsg(CEnterRoomMsg *msg) { _fieldBC = 0; return true; } diff --git a/engines/titanic/game/bar_bell.h b/engines/titanic/game/bar_bell.h index 2d8a36b61a..b17d8089bc 100644 --- a/engines/titanic/game/bar_bell.h +++ b/engines/titanic/game/bar_bell.h @@ -29,14 +29,13 @@ namespace Titanic { class CBarBell : public CGameObject { + bool EnterRoomMsg(CEnterRoomMsg *msg); public: int _fieldBC; int _fieldC0; int _fieldC4; int _fieldC8; int _fieldCC; -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CBarBell(); diff --git a/engines/titanic/game/bomb.cpp b/engines/titanic/game/bomb.cpp index 390ac2cd4e..a6086a2bca 100644 --- a/engines/titanic/game/bomb.cpp +++ b/engines/titanic/game/bomb.cpp @@ -70,7 +70,7 @@ void CBomb::load(SimpleFile *file) { CBackground::load(file); } -bool CBomb::handleMessage(CEnterRoomMsg &msg) { +bool CBomb::EnterRoomMsg(CEnterRoomMsg *msg) { _fieldE8 = 12; _fieldEC = 9; _fieldF0 = 0; diff --git a/engines/titanic/game/bomb.h b/engines/titanic/game/bomb.h index bd3852ef17..76799da323 100644 --- a/engines/titanic/game/bomb.h +++ b/engines/titanic/game/bomb.h @@ -29,6 +29,7 @@ namespace Titanic { class CBomb : public CBackground { + bool EnterRoomMsg(CEnterRoomMsg *msg); private: int _fieldE0; int _fieldE4; @@ -40,8 +41,6 @@ private: int _fieldFC; int _startingTicks; int _field104; -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CBomb(); diff --git a/engines/titanic/game/cdrom.cpp b/engines/titanic/game/cdrom.cpp index 4f4089de73..0d89319a86 100644 --- a/engines/titanic/game/cdrom.cpp +++ b/engines/titanic/game/cdrom.cpp @@ -26,6 +26,13 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CCDROM, CGameObject) + ON_MESSAGE(MouseDragStartMsg) + ON_MESSAGE(MouseDragEndMsg) + ON_MESSAGE(MouseDragMoveMsg) + ON_MESSAGE(ActMsg) +END_MESSAGE_MAP() + CCDROM::CCDROM() : CGameObject() { } @@ -41,18 +48,18 @@ void CCDROM::load(SimpleFile *file) { CGameObject::load(file); } -bool CCDROM::handleMessage(CMouseDragStartMsg &msg) { - if (checkStartDragging(&msg)) { - _tempPos = msg._mousePos - _bounds; - setPosition(msg._mousePos - _tempPos); +bool CCDROM::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (checkStartDragging(msg)) { + _tempPos = msg->_mousePos - _bounds; + setPosition(msg->_mousePos - _tempPos); return true; } else { return false; } } -bool CCDROM::handleMessage(CMouseDragEndMsg &msg) { - if (msg._dropTarget && msg._dropTarget->getName() == "newComputer") { +bool CCDROM::MouseDragEndMsg(CMouseDragEndMsg *msg) { + if (msg->_dropTarget && msg->_dropTarget->getName() == "newComputer") { CCDROMTray *newTray = dynamic_cast(getRoom()->findByName("newTray")); if (newTray->_state && newTray->_insertedCD == "None") { @@ -65,13 +72,13 @@ bool CCDROM::handleMessage(CMouseDragEndMsg &msg) { return true; } -bool CCDROM::handleMessage(CMouseDragMoveMsg &msg) { - setPosition(msg._mousePos - _tempPos); +bool CCDROM::MouseDragMoveMsg(CMouseDragMoveMsg *msg) { + setPosition(msg->_mousePos - _tempPos); return true; } -bool CCDROM::handleMessage(CActMsg &msg) { - if (msg._action == "Ejected") +bool CCDROM::ActMsg(CActMsg *msg) { + if (msg->_action == "Ejected") setVisible(true); return true; diff --git a/engines/titanic/game/cdrom.h b/engines/titanic/game/cdrom.h index fa1c80335a..44e1e82216 100644 --- a/engines/titanic/game/cdrom.h +++ b/engines/titanic/game/cdrom.h @@ -30,13 +30,13 @@ namespace Titanic { class CCDROM : public CGameObject { + DECLARE_MESSAGE_MAP + bool MouseDragStartMsg(CMouseDragStartMsg *msg); + bool MouseDragEndMsg(CMouseDragEndMsg *msg); + bool MouseDragMoveMsg(CMouseDragMoveMsg *msg); + bool ActMsg(CActMsg *msg); private: Point _tempPos; -protected: - virtual bool handleMessage(CMouseDragStartMsg &msg); - virtual bool handleMessage(CMouseDragEndMsg &msg); - virtual bool handleMessage(CMouseDragMoveMsg &msg); - virtual bool handleMessage(CActMsg &msg); public: CLASSDEF CCDROM(); diff --git a/engines/titanic/game/cdrom_tray.h b/engines/titanic/game/cdrom_tray.h index 728471c654..96faf64600 100644 --- a/engines/titanic/game/cdrom_tray.h +++ b/engines/titanic/game/cdrom_tray.h @@ -30,13 +30,12 @@ namespace Titanic { class CCDROMTray : public CGameObject { DECLARE_MESSAGE_MAP + bool ActMsg(CActMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool StatusChangeMsg(CStatusChangeMsg *msg); public: int _state; CString _insertedCD; -protected: - virtual bool ActMsg(CActMsg *msg); - virtual bool MovieEndMsg(CMovieEndMsg *msg); - virtual bool StatusChangeMsg(CStatusChangeMsg *msg); public: CLASSDEF CCDROMTray(); diff --git a/engines/titanic/game/chicken_cooler.cpp b/engines/titanic/game/chicken_cooler.cpp index ff7aae7323..aa39f041a4 100644 --- a/engines/titanic/game/chicken_cooler.cpp +++ b/engines/titanic/game/chicken_cooler.cpp @@ -40,7 +40,7 @@ void CChickenCooler::load(SimpleFile *file) { CGameObject::load(file); } -bool CChickenCooler::handleMessage(CEnterRoomMsg &msg) { +bool CChickenCooler::EnterRoomMsg(CEnterRoomMsg *msg) { warning("CChickenCoolor::handlEvent"); return true; } diff --git a/engines/titanic/game/chicken_cooler.h b/engines/titanic/game/chicken_cooler.h index f15bba4983..220dba081b 100644 --- a/engines/titanic/game/chicken_cooler.h +++ b/engines/titanic/game/chicken_cooler.h @@ -29,11 +29,10 @@ namespace Titanic { class CChickenCooler : public CGameObject { + bool EnterRoomMsg(CEnterRoomMsg *msg); private: int _fieldBC; int _fieldC0; -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CChickenCooler() : CGameObject(), _fieldBC(0), _fieldC0(0) {} diff --git a/engines/titanic/game/dead_area.h b/engines/titanic/game/dead_area.h index 9a9de3ad92..367308e5b5 100644 --- a/engines/titanic/game/dead_area.h +++ b/engines/titanic/game/dead_area.h @@ -33,9 +33,8 @@ namespace Titanic { */ class CDeadArea : public CGameObject { DECLARE_MESSAGE_MAP -protected: - virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg) { return true; } - virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg) { return true; } + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg) { return true; } + bool MouseButtonUpMsg(CMouseButtonUpMsg *msg) { return true; } public: CLASSDEF CDeadArea(); diff --git a/engines/titanic/game/doorbot_elevator_handler.cpp b/engines/titanic/game/doorbot_elevator_handler.cpp index 257b663246..ae1894da53 100644 --- a/engines/titanic/game/doorbot_elevator_handler.cpp +++ b/engines/titanic/game/doorbot_elevator_handler.cpp @@ -40,7 +40,7 @@ void CDoorbotElevatorHandler::load(SimpleFile *file) { CGameObject::load(file); } -bool CDoorbotElevatorHandler::handleMessage(CEnterNodeMsg &msg) { +bool CDoorbotElevatorHandler::EnterNodeMsg(CEnterNodeMsg *msg) { warning("CDoorbotElevatorHandler::handleEvent"); return true; } diff --git a/engines/titanic/game/doorbot_elevator_handler.h b/engines/titanic/game/doorbot_elevator_handler.h index 351fb1f13b..2bbfab906b 100644 --- a/engines/titanic/game/doorbot_elevator_handler.h +++ b/engines/titanic/game/doorbot_elevator_handler.h @@ -29,11 +29,10 @@ namespace Titanic { class CDoorbotElevatorHandler : public CGameObject { + bool EnterNodeMsg(CEnterNodeMsg *msg); private: static int _v1; int _value; -protected: - virtual bool handleMessage(CEnterNodeMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/end_sequence_control.cpp b/engines/titanic/game/end_sequence_control.cpp index 41bbc9d93c..2417214f16 100644 --- a/engines/titanic/game/end_sequence_control.cpp +++ b/engines/titanic/game/end_sequence_control.cpp @@ -34,7 +34,7 @@ void CEndSequenceControl::load(SimpleFile *file) { CGameObject::load(file); } -bool CEndSequenceControl::handleMessage(CEnterRoomMsg &msg) { +bool CEndSequenceControl::EnterRoomMsg(CEnterRoomMsg *msg) { warning("TODO: CEndSequenceControl::handleEvent"); return true; } diff --git a/engines/titanic/game/end_sequence_control.h b/engines/titanic/game/end_sequence_control.h index 61165e3ba5..64bafcbd0b 100644 --- a/engines/titanic/game/end_sequence_control.h +++ b/engines/titanic/game/end_sequence_control.h @@ -29,8 +29,7 @@ namespace Titanic { class CEndSequenceControl : public CGameObject { -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); + bool EnterRoomMsg(CEnterRoomMsg *msg); public: CLASSDEF diff --git a/engines/titanic/game/fan_noises.cpp b/engines/titanic/game/fan_noises.cpp index d7dd4e28b3..18a6ef76ce 100644 --- a/engines/titanic/game/fan_noises.cpp +++ b/engines/titanic/game/fan_noises.cpp @@ -55,7 +55,7 @@ void CFanNoises::load(SimpleFile *file) { CGameObject::load(file); } -bool CFanNoises::handleMessage(CEnterRoomMsg &msg) { +bool CFanNoises::EnterRoomMsg(CEnterRoomMsg *msg) { warning("CFanNoises::handleEvent"); return true; } diff --git a/engines/titanic/game/fan_noises.h b/engines/titanic/game/fan_noises.h index 778891e6e1..a78b3ca897 100644 --- a/engines/titanic/game/fan_noises.h +++ b/engines/titanic/game/fan_noises.h @@ -29,6 +29,7 @@ namespace Titanic { class CFanNoises : public CGameObject { + bool EnterRoomMsg(CEnterRoomMsg *msg); private: int _fieldBC; int _fieldC0; @@ -37,8 +38,6 @@ private: int _fieldCC; int _fieldD0; int _fieldD4; -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CFanNoises(); diff --git a/engines/titanic/game/get_lift_eye2.cpp b/engines/titanic/game/get_lift_eye2.cpp index 5f3fac315d..76e6d2aa64 100644 --- a/engines/titanic/game/get_lift_eye2.cpp +++ b/engines/titanic/game/get_lift_eye2.cpp @@ -46,7 +46,7 @@ void CGetLiftEye2::load(SimpleFile *file) { CGameObject::load(file); } -bool CGetLiftEye2::handleMessage(CEnterRoomMsg &msg) { +bool CGetLiftEye2::EnterRoomMsg(CEnterRoomMsg *msg) { warning("CGetLiftEye2::handleEvent"); return true; } diff --git a/engines/titanic/game/get_lift_eye2.h b/engines/titanic/game/get_lift_eye2.h index f7195878e0..16ccf83f2a 100644 --- a/engines/titanic/game/get_lift_eye2.h +++ b/engines/titanic/game/get_lift_eye2.h @@ -28,10 +28,9 @@ namespace Titanic { class CGetLiftEye2 : public CGameObject { + bool EnterRoomMsg(CEnterRoomMsg *msg); private: static CString *_v1; -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF static void init(); diff --git a/engines/titanic/game/gondolier/gondolier_mixer.cpp b/engines/titanic/game/gondolier/gondolier_mixer.cpp index 2bd3313d47..76bf2597d9 100644 --- a/engines/titanic/game/gondolier/gondolier_mixer.cpp +++ b/engines/titanic/game/gondolier/gondolier_mixer.cpp @@ -57,10 +57,10 @@ void CGondolierMixer::load(SimpleFile *file) { CGondolierBase::load(file); } -bool CGondolierMixer::handleMessage(CEnterRoomMsg &msg) { +bool CGondolierMixer::EnterRoomMsg(CEnterRoomMsg *msg) { CRoomItem *parentRoom = dynamic_cast(getParent()); - if (parentRoom == msg._newRoom) - msg.execute(parentRoom); + if (parentRoom == msg->_newRoom) + msg->execute(parentRoom); return true; } diff --git a/engines/titanic/game/gondolier/gondolier_mixer.h b/engines/titanic/game/gondolier/gondolier_mixer.h index 1186393d04..2202d24d5f 100644 --- a/engines/titanic/game/gondolier/gondolier_mixer.h +++ b/engines/titanic/game/gondolier/gondolier_mixer.h @@ -29,6 +29,7 @@ namespace Titanic { class CGondolierMixer : public CGondolierBase { + bool EnterRoomMsg(CEnterRoomMsg *msg); private: int _fieldBC; int _fieldC0; @@ -37,8 +38,6 @@ private: CString _string1; CString _string2; int _fieldE4; -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CGondolierMixer(); diff --git a/engines/titanic/game/light.cpp b/engines/titanic/game/light.cpp index c0b7df300f..6b5ff51f28 100644 --- a/engines/titanic/game/light.cpp +++ b/engines/titanic/game/light.cpp @@ -57,7 +57,7 @@ void CLight::load(SimpleFile *file) { CBackground::load(file); } -bool CLight::handleMessage(CEnterRoomMsg &msg) { +bool CLight::EnterRoomMsg(CEnterRoomMsg *msg) { warning("CLight::handleEvent"); return true; } diff --git a/engines/titanic/game/light.h b/engines/titanic/game/light.h index e419a3bcd6..625e256b5c 100644 --- a/engines/titanic/game/light.h +++ b/engines/titanic/game/light.h @@ -29,6 +29,7 @@ namespace Titanic { class CLight : public CBackground { + bool EnterRoomMsg(CEnterRoomMsg *msg); private: int _fieldE0; int _fieldE4; @@ -38,8 +39,6 @@ private: int _fieldF4; int _fieldF8; int _fieldFC; -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CLight(); diff --git a/engines/titanic/game/light_switch.cpp b/engines/titanic/game/light_switch.cpp index 0e68dda0dc..78a0548f41 100644 --- a/engines/titanic/game/light_switch.cpp +++ b/engines/titanic/game/light_switch.cpp @@ -50,7 +50,7 @@ void CLightSwitch::load(SimpleFile *file) { CBackground::load(file); } -bool CLightSwitch::handleMessage(CEnterRoomMsg &msg) { +bool CLightSwitch::EnterRoomMsg(CEnterRoomMsg *msg) { warning("CLightSwitch::handleEvent"); return true; } diff --git a/engines/titanic/game/light_switch.h b/engines/titanic/game/light_switch.h index f2132c9bdf..80adf81582 100644 --- a/engines/titanic/game/light_switch.h +++ b/engines/titanic/game/light_switch.h @@ -29,14 +29,13 @@ namespace Titanic { class CLightSwitch : public CBackground { + bool EnterRoomMsg(CEnterRoomMsg *msg); public: static int _v1; private: int _fieldE0; int _fieldE4; int _fieldE8; -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CLightSwitch(); diff --git a/engines/titanic/game/long_stick_dispenser.cpp b/engines/titanic/game/long_stick_dispenser.cpp index 9511d7b017..cf1109604f 100644 --- a/engines/titanic/game/long_stick_dispenser.cpp +++ b/engines/titanic/game/long_stick_dispenser.cpp @@ -42,7 +42,7 @@ void CLongStickDispenser::load(SimpleFile *file) { CGameObject::load(file); } -bool CLongStickDispenser::handleMessage(CEnterRoomMsg &msg) { +bool CLongStickDispenser::EnterRoomMsg(CEnterRoomMsg *msg) { _fieldC0 = 0; _fieldC4 = 1; return true; diff --git a/engines/titanic/game/long_stick_dispenser.h b/engines/titanic/game/long_stick_dispenser.h index 5e43bfa62f..bf5db20e1d 100644 --- a/engines/titanic/game/long_stick_dispenser.h +++ b/engines/titanic/game/long_stick_dispenser.h @@ -29,12 +29,11 @@ namespace Titanic { class CLongStickDispenser : public CGameObject { + bool EnterRoomMsg(CEnterRoomMsg *msg); private: int _fieldBC; int _fieldC0; int _fieldC4; -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CLongStickDispenser() : CGameObject(), _fieldBC(0), diff --git a/engines/titanic/game/parrot/player_meets_parrot.cpp b/engines/titanic/game/parrot/player_meets_parrot.cpp index 16c8f480dd..15dd29009a 100644 --- a/engines/titanic/game/parrot/player_meets_parrot.cpp +++ b/engines/titanic/game/parrot/player_meets_parrot.cpp @@ -34,7 +34,7 @@ void CPlayerMeetsParrot::load(SimpleFile *file) { CGameObject::load(file); } -bool CPlayerMeetsParrot::handleMessage(CEnterRoomMsg &msg) { +bool CPlayerMeetsParrot::EnterRoomMsg(CEnterRoomMsg *msg) { warning("CPlayerMeetsParrot::handleEvent"); return true; } diff --git a/engines/titanic/game/parrot/player_meets_parrot.h b/engines/titanic/game/parrot/player_meets_parrot.h index bc96cb84f7..53fa63a95c 100644 --- a/engines/titanic/game/parrot/player_meets_parrot.h +++ b/engines/titanic/game/parrot/player_meets_parrot.h @@ -30,7 +30,7 @@ namespace Titanic { class CPlayerMeetsParrot : public CGameObject { protected: - virtual bool handleMessage(CEnterRoomMsg &msg); + bool EnterRoomMsg(CEnterRoomMsg *msg); public: CLASSDEF diff --git a/engines/titanic/game/pet/pet_monitor.cpp b/engines/titanic/game/pet/pet_monitor.cpp index afe0836e65..ebbddd8587 100644 --- a/engines/titanic/game/pet/pet_monitor.cpp +++ b/engines/titanic/game/pet/pet_monitor.cpp @@ -24,6 +24,10 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CPETMonitor, CGameObject) + ON_MESSAGE(EnterRoomMsg) +END_MESSAGE_MAP() + void CPETMonitor::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CGameObject::save(file, indent); @@ -34,7 +38,7 @@ void CPETMonitor::load(SimpleFile *file) { CGameObject::load(file); } -bool CPETMonitor::handleMessage(CEnterRoomMsg &msg) { +bool CPETMonitor::EnterRoomMsg(CEnterRoomMsg *msg) { warning("CPETMonitor::handleEvent"); return true; } diff --git a/engines/titanic/game/pet/pet_monitor.h b/engines/titanic/game/pet/pet_monitor.h index 56116d8313..a53f360ed1 100644 --- a/engines/titanic/game/pet/pet_monitor.h +++ b/engines/titanic/game/pet/pet_monitor.h @@ -29,8 +29,8 @@ namespace Titanic { class CPETMonitor : public CGameObject { -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); + DECLARE_MESSAGE_MAP + bool EnterRoomMsg(CEnterRoomMsg *msg); public: CLASSDEF diff --git a/engines/titanic/game/pet/pet_position.cpp b/engines/titanic/game/pet/pet_position.cpp index e1dab2218f..66e8e36231 100644 --- a/engines/titanic/game/pet/pet_position.cpp +++ b/engines/titanic/game/pet/pet_position.cpp @@ -24,6 +24,10 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CPETPosition, CGameObject) + ON_MESSAGE(EnterRoomMsg) +END_MESSAGE_MAP() + void CPETPosition::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CGameObject::save(file, indent); @@ -34,7 +38,7 @@ void CPETPosition::load(SimpleFile *file) { CGameObject::load(file); } -bool CPETPosition::handleMessage(CEnterRoomMsg &msg) { +bool CPETPosition::EnterRoomMsg(CEnterRoomMsg *msg) { warning("CPETPosition::handleEvent"); return true; } diff --git a/engines/titanic/game/pet/pet_position.h b/engines/titanic/game/pet/pet_position.h index 589f2b60b1..f4f0fd5299 100644 --- a/engines/titanic/game/pet/pet_position.h +++ b/engines/titanic/game/pet/pet_position.h @@ -29,8 +29,8 @@ namespace Titanic { class CPETPosition : public CGameObject { -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); + DECLARE_MESSAGE_MAP + bool EnterRoomMsg(CEnterRoomMsg *msg); public: CLASSDEF diff --git a/engines/titanic/game/pet/pet_transport.cpp b/engines/titanic/game/pet/pet_transport.cpp index 36685676ac..bcbf319fd0 100644 --- a/engines/titanic/game/pet/pet_transport.cpp +++ b/engines/titanic/game/pet/pet_transport.cpp @@ -24,6 +24,10 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CPETTransport, CGameObject) + ON_MESSAGE(EnterRoomMsg) +END_MESSAGE_MAP() + void CPETTransport::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CGameObject::save(file, indent); @@ -34,7 +38,7 @@ void CPETTransport::load(SimpleFile *file) { CGameObject::load(file); } -bool CPETTransport::handleMessage(CEnterRoomMsg &msg) { +bool CPETTransport::EnterRoomMsg(CEnterRoomMsg *msg) { warning("CPETTransport::handleEvent"); return true; } diff --git a/engines/titanic/game/pet/pet_transport.h b/engines/titanic/game/pet/pet_transport.h index 2c94bb6fe7..052fd7bda0 100644 --- a/engines/titanic/game/pet/pet_transport.h +++ b/engines/titanic/game/pet/pet_transport.h @@ -29,8 +29,8 @@ namespace Titanic { class CPETTransport : public CGameObject { -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); + DECLARE_MESSAGE_MAP + virtual bool EnterRoomMsg(CEnterRoomMsg *msg); public: CLASSDEF diff --git a/engines/titanic/game/phonograph.cpp b/engines/titanic/game/phonograph.cpp index 749bf33b24..f086376651 100644 --- a/engines/titanic/game/phonograph.cpp +++ b/engines/titanic/game/phonograph.cpp @@ -55,7 +55,7 @@ void CPhonograph::load(SimpleFile *file) { CMusicPlayer::load(file); } -bool CPhonograph::handleMessage(CEnterRoomMsg &msg) { +bool CPhonograph::EnterRoomMsg(CEnterRoomMsg *msg) { warning("CPhonograph::handleEvent"); return true; } diff --git a/engines/titanic/game/phonograph.h b/engines/titanic/game/phonograph.h index 102edd2ace..c5f5a90c9c 100644 --- a/engines/titanic/game/phonograph.h +++ b/engines/titanic/game/phonograph.h @@ -29,6 +29,7 @@ namespace Titanic { class CPhonograph : public CMusicPlayer { + bool EnterRoomMsg(CEnterRoomMsg *msg); protected: CString _string2; int _fieldE0; @@ -37,8 +38,6 @@ protected: int _fieldEC; int _fieldF0; int _fieldF4; -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CPhonograph(); diff --git a/engines/titanic/game/sgt/sgt_state_room.cpp b/engines/titanic/game/sgt/sgt_state_room.cpp index 9baae69afb..1a68131589 100644 --- a/engines/titanic/game/sgt/sgt_state_room.cpp +++ b/engines/titanic/game/sgt/sgt_state_room.cpp @@ -24,6 +24,10 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CSGTStateRoom, CBackground) + ON_MESSAGE(EnterRoomMsg) +END_MESSAGE_MAP() + CSGTStateRoomStatics *CSGTStateRoom::_statics; void CSGTStateRoom::init() { @@ -90,7 +94,7 @@ void CSGTStateRoom::load(SimpleFile *file) { CBackground::load(file); } -bool CSGTStateRoom::handleMessage(CEnterRoomMsg &msg) { +bool CSGTStateRoom::EnterRoomMsg(CEnterRoomMsg *msg) { warning("CSGTStateRoom::handleEvent"); return true; } diff --git a/engines/titanic/game/sgt/sgt_state_room.h b/engines/titanic/game/sgt/sgt_state_room.h index 7ae961145f..7b2b5a81f0 100644 --- a/engines/titanic/game/sgt/sgt_state_room.h +++ b/engines/titanic/game/sgt/sgt_state_room.h @@ -46,6 +46,8 @@ struct CSGTStateRoomStatics { }; class CSGTStateRoom : public CBackground { + DECLARE_MESSAGE_MAP + bool EnterRoomMsg(CEnterRoomMsg *msg); private: static CSGTStateRoomStatics *_statics; private: @@ -54,8 +56,6 @@ private: int _fieldE8; int _fieldEC; int _fieldF0; -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CSGTStateRoom(); diff --git a/engines/titanic/game/ship_setting.cpp b/engines/titanic/game/ship_setting.cpp index 1da27923c5..037a199816 100644 --- a/engines/titanic/game/ship_setting.cpp +++ b/engines/titanic/game/ship_setting.cpp @@ -48,7 +48,7 @@ void CShipSetting::load(SimpleFile *file) { CBackground::load(file); } -bool CShipSetting::handleMessage(CEnterRoomMsg &msg) { +bool CShipSetting::EnterRoomMsg(CEnterRoomMsg *msg) { warning("CShipSetting::handleEvent"); return true; } diff --git a/engines/titanic/game/ship_setting.h b/engines/titanic/game/ship_setting.h index 5b5ea68719..9783e69461 100644 --- a/engines/titanic/game/ship_setting.h +++ b/engines/titanic/game/ship_setting.h @@ -29,13 +29,12 @@ namespace Titanic { class CShipSetting : public CBackground { + bool EnterRoomMsg(CEnterRoomMsg *msg); private: CString _string3; Point _pos1; CString _string4; CString _string5; -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CShipSetting(); diff --git a/engines/titanic/game/start_action.cpp b/engines/titanic/game/start_action.cpp index 05ceb9d0b0..e41b7df4bf 100644 --- a/engines/titanic/game/start_action.cpp +++ b/engines/titanic/game/start_action.cpp @@ -25,6 +25,11 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CStartAction, CBackground) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(MouseButtonUpMsg) +END_MESSAGE_MAP() + CStartAction::CStartAction() : CBackground() { } @@ -44,7 +49,7 @@ void CStartAction::load(SimpleFile *file) { CBackground::load(file); } -bool CStartAction::handleMessage(CMouseButtonDownMsg &msg) { +bool CStartAction::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { // Dispatch the desired action to the desired target CActMsg actMsg(_msgAction); actMsg.execute(_msgTarget); @@ -52,7 +57,7 @@ bool CStartAction::handleMessage(CMouseButtonDownMsg &msg) { return true; } -bool CStartAction::handleMessage(CMouseButtonUpMsg &msg) { +bool CStartAction::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { return true; } diff --git a/engines/titanic/game/start_action.h b/engines/titanic/game/start_action.h index ebdc4abf25..de3c488c14 100644 --- a/engines/titanic/game/start_action.h +++ b/engines/titanic/game/start_action.h @@ -29,12 +29,12 @@ namespace Titanic { class CStartAction : public CBackground { + DECLARE_MESSAGE_MAP + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); protected: CString _msgTarget; CString _msgAction; -protected: - virtual bool handleMessage(CMouseButtonDownMsg &msg); - virtual bool handleMessage(CMouseButtonUpMsg &msg); public: CLASSDEF CStartAction(); diff --git a/engines/titanic/game/television.h b/engines/titanic/game/television.h index 54e86636d0..4c16a320ab 100644 --- a/engines/titanic/game/television.h +++ b/engines/titanic/game/television.h @@ -31,6 +31,19 @@ namespace Titanic { class CTelevision : public CBackground { DECLARE_MESSAGE_MAP + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool ChangeSeasonMsg(CChangeSeasonMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool PETUpMsg(CPETUpMsg *msg); + bool PETDownMsg(CPETDownMsg *msg); + bool StatusChangeMsg(CStatusChangeMsg *msg); + bool ActMsg(CActMsg *msg); + bool PETActivateMsg(CPETActivateMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool ShipSettingMsg(CShipSettingMsg *msg); + bool TurnOff(CTurnOff *msg); + bool TurnOn(CTurnOn *msg); + bool LightsMsg(CLightsMsg *msg); private: static int _v1; static bool _turnOn; @@ -44,20 +57,6 @@ private: bool _isOn; int _fieldEC; int _fieldF0; -protected: - virtual bool LeaveViewMsg(CLeaveViewMsg *msg); - virtual bool ChangeSeasonMsg(CChangeSeasonMsg *msg); - virtual bool EnterViewMsg(CEnterViewMsg *msg); - virtual bool PETUpMsg(CPETUpMsg *msg); - virtual bool PETDownMsg(CPETDownMsg *msg); - virtual bool StatusChangeMsg(CStatusChangeMsg *msg); - virtual bool ActMsg(CActMsg *msg); - virtual bool PETActivateMsg(CPETActivateMsg *msg); - virtual bool MovieEndMsg(CMovieEndMsg *msg); - virtual bool ShipSettingMsg(CShipSettingMsg *msg); - virtual bool TurnOff(CTurnOff *msg); - virtual bool TurnOn(CTurnOn *msg); - virtual bool LightsMsg(CLightsMsg *msg); public: CLASSDEF CTelevision(); diff --git a/engines/titanic/game/transport/lift.cpp b/engines/titanic/game/transport/lift.cpp index a795a15a16..e978762528 100644 --- a/engines/titanic/game/transport/lift.cpp +++ b/engines/titanic/game/transport/lift.cpp @@ -24,6 +24,10 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CLift, CTransport) + ON_MESSAGE(EnterRoomMsg) +END_MESSAGE_MAP() + int CLift::_v1; int CLift::_v2; int CLift::_v3; @@ -57,7 +61,7 @@ void CLift::load(SimpleFile *file) { CTransport::load(file); } -bool CLift::handleMessage(CEnterRoomMsg &msg) { +bool CLift::EnterRoomMsg(CEnterRoomMsg *msg) { warning("CLift::handleEvent"); return true; } diff --git a/engines/titanic/game/transport/lift.h b/engines/titanic/game/transport/lift.h index dc324e10c0..161061c042 100644 --- a/engines/titanic/game/transport/lift.h +++ b/engines/titanic/game/transport/lift.h @@ -29,6 +29,8 @@ namespace Titanic { class CLift : public CTransport { + DECLARE_MESSAGE_MAP + bool EnterRoomMsg(CEnterRoomMsg *msg); private: static int _v1; static int _v2; @@ -38,8 +40,6 @@ private: static int _v6; int _fieldF8; -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CLift() : CTransport(), _fieldF8(1) {} diff --git a/engines/titanic/game/transport/lift_indicator.cpp b/engines/titanic/game/transport/lift_indicator.cpp index ebeaf55e2e..eb7f6bfa1c 100644 --- a/engines/titanic/game/transport/lift_indicator.cpp +++ b/engines/titanic/game/transport/lift_indicator.cpp @@ -24,6 +24,10 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CLiftindicator, CLift) + ON_MESSAGE(EnterRoomMsg) +END_MESSAGE_MAP() + CLiftindicator::CLiftindicator() : CLift(), _fieldFC(0), _field108(0), _field10C(0) { } diff --git a/engines/titanic/game/transport/lift_indicator.h b/engines/titanic/game/transport/lift_indicator.h index 7cc5585d3b..c73d1f46d4 100644 --- a/engines/titanic/game/transport/lift_indicator.h +++ b/engines/titanic/game/transport/lift_indicator.h @@ -29,13 +29,13 @@ namespace Titanic { class CLiftindicator : public CLift { + DECLARE_MESSAGE_MAP + bool EnterRoomMsg(CEnterRoomMsg *msg) { return true; } private: int _fieldFC; Point _pos2; int _field108; int _field10C; -protected: - virtual bool handleMessage(CEnterRoomMsg &msg) { return true; } public: CLASSDEF CLiftindicator(); diff --git a/engines/titanic/game/transport/pellerator.cpp b/engines/titanic/game/transport/pellerator.cpp index eca1037128..ed82aa9c3d 100644 --- a/engines/titanic/game/transport/pellerator.cpp +++ b/engines/titanic/game/transport/pellerator.cpp @@ -24,6 +24,10 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CPellerator, CTransport) + ON_MESSAGE(EnterRoomMsg) +END_MESSAGE_MAP() + int CPellerator::_v1; int CPellerator::_v2; @@ -43,7 +47,7 @@ void CPellerator::load(SimpleFile *file) { CTransport::load(file); } -bool CPellerator::handleMessage(CEnterRoomMsg &msg) { +bool CPellerator::EnterRoomMsg(CEnterRoomMsg *msg) { warning("CPellerator::handleEvent"); return true; } diff --git a/engines/titanic/game/transport/pellerator.h b/engines/titanic/game/transport/pellerator.h index 82809a0717..0539b5ceac 100644 --- a/engines/titanic/game/transport/pellerator.h +++ b/engines/titanic/game/transport/pellerator.h @@ -29,11 +29,11 @@ namespace Titanic { class CPellerator : public CTransport { + DECLARE_MESSAGE_MAP + bool EnterRoomMsg(CEnterRoomMsg *msg); private: static int _v1; static int _v2; -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/game/up_lighter.cpp b/engines/titanic/game/up_lighter.cpp index 819dc9435a..50cd1d426f 100644 --- a/engines/titanic/game/up_lighter.cpp +++ b/engines/titanic/game/up_lighter.cpp @@ -48,7 +48,7 @@ void CUpLighter::load(SimpleFile *file) { CDropTarget::load(file); } -bool CUpLighter::handleMessage(CEnterRoomMsg &msg) { +bool CUpLighter::EnterRoomMsg(CEnterRoomMsg *msg) { warning("CUpLighter::handleEvent"); return true; } diff --git a/engines/titanic/game/up_lighter.h b/engines/titanic/game/up_lighter.h index 27b1d7b8fd..a3f8b2a7f2 100644 --- a/engines/titanic/game/up_lighter.h +++ b/engines/titanic/game/up_lighter.h @@ -29,13 +29,12 @@ namespace Titanic { class CUpLighter : public CDropTarget { + bool EnterRoomMsg(CEnterRoomMsg *msg); private: int _field118; int _field11C; int _field120; int _field124; -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CUpLighter(); diff --git a/engines/titanic/game/volume_control.cpp b/engines/titanic/game/volume_control.cpp index bb58deebce..e9b66c769e 100644 --- a/engines/titanic/game/volume_control.cpp +++ b/engines/titanic/game/volume_control.cpp @@ -45,7 +45,7 @@ void CVolumeControl::load(SimpleFile *file) { CGameObject::load(file); } -bool CVolumeControl::handleMessage(CEnterNodeMsg &msg) { +bool CVolumeControl::EnterNodeMsg(CEnterNodeMsg *msg) { warning("CVolumeControl::handleEvent"); return true; } diff --git a/engines/titanic/game/volume_control.h b/engines/titanic/game/volume_control.h index ae10d975e2..cef5ac492f 100644 --- a/engines/titanic/game/volume_control.h +++ b/engines/titanic/game/volume_control.h @@ -29,12 +29,11 @@ namespace Titanic { class CVolumeControl : public CGameObject { + bool EnterNodeMsg(CEnterNodeMsg *msg); private: int _fieldBC; CString _string1; int _fieldCC; -protected: - virtual bool handleMessage(CEnterNodeMsg &msg); public: CLASSDEF CVolumeControl(); diff --git a/engines/titanic/gfx/st_button.h b/engines/titanic/gfx/st_button.h index fd2b0fa401..d3dd5c4e76 100644 --- a/engines/titanic/gfx/st_button.h +++ b/engines/titanic/gfx/st_button.h @@ -31,6 +31,9 @@ namespace Titanic { class CSTButton : public CBackground { DECLARE_MESSAGE_MAP + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); private: int _statusInc; CString _statusTarget; @@ -39,10 +42,6 @@ private: CString _string4; CString _string5; int _buttonFrame; -protected: - virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); - virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); - virtual bool EnterViewMsg(CEnterViewMsg *msg); public: CLASSDEF CSTButton(); diff --git a/engines/titanic/messages/bilge_dispensor_event.cpp b/engines/titanic/messages/bilge_dispensor_event.cpp index e17494c5e2..f0daa7aa5e 100644 --- a/engines/titanic/messages/bilge_dispensor_event.cpp +++ b/engines/titanic/messages/bilge_dispensor_event.cpp @@ -34,7 +34,7 @@ void CBilgeDispensorEvent::load(SimpleFile *file) { CAutoSoundEvent::load(file); } -bool CBilgeDispensorEvent::handleMessage(CEnterRoomMsg &msg) { +bool CBilgeDispensorEvent::EnterRoomMsg(CEnterRoomMsg *msg) { _value1 = 0; return true; } diff --git a/engines/titanic/messages/bilge_dispensor_event.h b/engines/titanic/messages/bilge_dispensor_event.h index de8705f604..df6e1127c1 100644 --- a/engines/titanic/messages/bilge_dispensor_event.h +++ b/engines/titanic/messages/bilge_dispensor_event.h @@ -29,8 +29,7 @@ namespace Titanic { class CBilgeDispensorEvent : public CAutoSoundEvent { -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); + bool EnterRoomMsg(CEnterRoomMsg *msg); public: CLASSDEF diff --git a/engines/titanic/moves/enter_bridge.cpp b/engines/titanic/moves/enter_bridge.cpp index 8916fa90e7..f5269348a9 100644 --- a/engines/titanic/moves/enter_bridge.cpp +++ b/engines/titanic/moves/enter_bridge.cpp @@ -36,7 +36,7 @@ void CEnterBridge::load(SimpleFile *file) { CGameObject::load(file); } -bool CEnterBridge::handleMessage(CEnterRoomMsg &msg) { +bool CEnterBridge::EnterRoomMsg(CEnterRoomMsg *msg) { warning("CEnterBridge::handlEvent"); return true; } diff --git a/engines/titanic/moves/enter_bridge.h b/engines/titanic/moves/enter_bridge.h index 0920443e1d..fee299adf0 100644 --- a/engines/titanic/moves/enter_bridge.h +++ b/engines/titanic/moves/enter_bridge.h @@ -29,10 +29,9 @@ namespace Titanic { class CEnterBridge : public CGameObject { + bool EnterRoomMsg(CEnterRoomMsg *msg); private: int _value; -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CEnterBridge() : CGameObject(), _value(1) {} diff --git a/engines/titanic/npcs/barbot.cpp b/engines/titanic/npcs/barbot.cpp index e487dc1ecb..8abf41d426 100644 --- a/engines/titanic/npcs/barbot.cpp +++ b/engines/titanic/npcs/barbot.cpp @@ -233,7 +233,7 @@ void CBarbot::load(SimpleFile *file) { CTrueTalkNPC::load(file); } -bool CBarbot::handleMessage(CEnterRoomMsg &msg) { +bool CBarbot::EnterRoomMsg(CEnterRoomMsg *msg) { warning("TODO: Barbot::CEnterRoomMsg"); return true; } diff --git a/engines/titanic/npcs/barbot.h b/engines/titanic/npcs/barbot.h index 158db10f7a..fa06f8f638 100644 --- a/engines/titanic/npcs/barbot.h +++ b/engines/titanic/npcs/barbot.h @@ -29,6 +29,7 @@ namespace Titanic { class CBarbot : public CTrueTalkNPC { + bool EnterRoomMsg(CEnterRoomMsg *msg); private: static int _v0; private: @@ -173,8 +174,6 @@ private: int _field338; int _field33C; int _field340; -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CBarbot(); diff --git a/engines/titanic/npcs/liftbot.cpp b/engines/titanic/npcs/liftbot.cpp index a412d43ff1..0125406d6a 100644 --- a/engines/titanic/npcs/liftbot.cpp +++ b/engines/titanic/npcs/liftbot.cpp @@ -48,7 +48,7 @@ void CLiftBot::load(SimpleFile *file) { CTrueTalkNPC::load(file); } -bool CLiftBot::handleMessage(CEnterRoomMsg &msg) { +bool CLiftBot::EnterRoomMsg(CEnterRoomMsg *msg) { warning("CLiftBot::handleEvent"); return true; } diff --git a/engines/titanic/npcs/liftbot.h b/engines/titanic/npcs/liftbot.h index a984ea8ffb..d0db94e95d 100644 --- a/engines/titanic/npcs/liftbot.h +++ b/engines/titanic/npcs/liftbot.h @@ -29,13 +29,12 @@ namespace Titanic { class CLiftBot : public CTrueTalkNPC { + bool EnterRoomMsg(CEnterRoomMsg *msg); private: static int _v1; static int _v2; private: int _field108; -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CLiftBot(); diff --git a/engines/titanic/sound/auto_music_player.cpp b/engines/titanic/sound/auto_music_player.cpp index 5981a707bd..309c57b1d5 100644 --- a/engines/titanic/sound/auto_music_player.cpp +++ b/engines/titanic/sound/auto_music_player.cpp @@ -41,7 +41,7 @@ void CAutoMusicPlayer::load(SimpleFile *file) { CAutoMusicPlayerBase::load(file); } -bool CAutoMusicPlayer::handleMessage(CEnterRoomMsg &msg) { +bool CAutoMusicPlayer::EnterRoomMsg(CEnterRoomMsg *msg) { if (!_fieldCC) { warning("TODO"); } diff --git a/engines/titanic/sound/auto_music_player.h b/engines/titanic/sound/auto_music_player.h index 0848439d49..063778c02a 100644 --- a/engines/titanic/sound/auto_music_player.h +++ b/engines/titanic/sound/auto_music_player.h @@ -29,10 +29,9 @@ namespace Titanic { class CAutoMusicPlayer : public CAutoMusicPlayerBase { + bool EnterRoomMsg(CEnterRoomMsg *msg); private: CString _string2; -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CAutoMusicPlayer(); diff --git a/engines/titanic/sound/music_player.cpp b/engines/titanic/sound/music_player.cpp index eaad635dd3..193527b3d8 100644 --- a/engines/titanic/sound/music_player.cpp +++ b/engines/titanic/sound/music_player.cpp @@ -44,7 +44,7 @@ void CMusicPlayer::load(SimpleFile *file) { CGameObject::load(file); } -bool CMusicPlayer::handleMessage(CEnterRoomMsg &msg) { +bool CMusicPlayer::EnterRoomMsg(CEnterRoomMsg *msg) { warning("TODO: CMusicPlayer::handleEvent"); return true; } diff --git a/engines/titanic/sound/music_player.h b/engines/titanic/sound/music_player.h index 614fa375cd..1b928fa652 100644 --- a/engines/titanic/sound/music_player.h +++ b/engines/titanic/sound/music_player.h @@ -29,13 +29,12 @@ namespace Titanic { class CMusicPlayer : public CGameObject { + bool EnterRoomMsg(CEnterRoomMsg *msg); protected: int _fieldBC; CString _string1; int _fieldCC; int _fieldD0; -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CMusicPlayer() : CGameObject(), diff --git a/engines/titanic/sound/node_auto_sound_player.cpp b/engines/titanic/sound/node_auto_sound_player.cpp index 5af8ca25d3..ee403bae20 100644 --- a/engines/titanic/sound/node_auto_sound_player.cpp +++ b/engines/titanic/sound/node_auto_sound_player.cpp @@ -36,7 +36,7 @@ void CNodeAutoSoundPlayer::load(SimpleFile *file) { CAutoSoundPlayer::load(file); } -bool CNodeAutoSoundPlayer::handleMessage(CEnterNodeMsg &msg) { +bool CNodeAutoSoundPlayer::EnterNodeMsg(CEnterNodeMsg *msg) { warning("CNodeAutoSoundPlayer::handleEvent"); return true; } diff --git a/engines/titanic/sound/node_auto_sound_player.h b/engines/titanic/sound/node_auto_sound_player.h index 451b94688d..2f961ddcd9 100644 --- a/engines/titanic/sound/node_auto_sound_player.h +++ b/engines/titanic/sound/node_auto_sound_player.h @@ -29,10 +29,9 @@ namespace Titanic { class CNodeAutoSoundPlayer : public CAutoSoundPlayer { + bool EnterNodeMsg(CEnterNodeMsg *msg); private: int _fieldEC; -protected: - virtual bool handleMessage(CEnterNodeMsg &msg); public: CLASSDEF CNodeAutoSoundPlayer() : CAutoSoundPlayer(), _fieldEC(1) {} diff --git a/engines/titanic/sound/restricted_auto_music_player.cpp b/engines/titanic/sound/restricted_auto_music_player.cpp index 7b5ba707c2..cd1b1930e7 100644 --- a/engines/titanic/sound/restricted_auto_music_player.cpp +++ b/engines/titanic/sound/restricted_auto_music_player.cpp @@ -44,7 +44,7 @@ void CRestrictedAutoMusicPlayer::load(SimpleFile *file) { CAutoMusicPlayer::load(file); } -bool CRestrictedAutoMusicPlayer::handleMessage(CEnterRoomMsg &msg) { +bool CRestrictedAutoMusicPlayer::EnterRoomMsg(CEnterRoomMsg *msg) { warning("CRestrictedAutoMusicPlayer::handleEvent"); return true; } diff --git a/engines/titanic/sound/restricted_auto_music_player.h b/engines/titanic/sound/restricted_auto_music_player.h index 3553d1c63b..b2882964aa 100644 --- a/engines/titanic/sound/restricted_auto_music_player.h +++ b/engines/titanic/sound/restricted_auto_music_player.h @@ -29,13 +29,12 @@ namespace Titanic { class CRestrictedAutoMusicPlayer : public CAutoMusicPlayer { + bool EnterRoomMsg(CEnterRoomMsg *msg); private: CString _string3; CString _string4; CString _string5; CString _string6; -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF diff --git a/engines/titanic/sound/room_auto_sound_player.cpp b/engines/titanic/sound/room_auto_sound_player.cpp index c24ef2a211..4393d411fc 100644 --- a/engines/titanic/sound/room_auto_sound_player.cpp +++ b/engines/titanic/sound/room_auto_sound_player.cpp @@ -34,7 +34,7 @@ void CRoomAutoSoundPlayer::load(SimpleFile *file) { CAutoSoundPlayer::load(file); } -bool CRoomAutoSoundPlayer::handleMessage(CEnterRoomMsg &msg) { +bool CRoomAutoSoundPlayer::EnterRoomMsg(CEnterRoomMsg *msg) { warning("CRoomAutoSoundPlayer::handleEvent"); return true; } diff --git a/engines/titanic/sound/room_auto_sound_player.h b/engines/titanic/sound/room_auto_sound_player.h index 70d3dfee88..c17d983ee1 100644 --- a/engines/titanic/sound/room_auto_sound_player.h +++ b/engines/titanic/sound/room_auto_sound_player.h @@ -29,8 +29,7 @@ namespace Titanic { class CRoomAutoSoundPlayer : public CAutoSoundPlayer { -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); + bool EnterRoomMsg(CEnterRoomMsg *msg); public: CLASSDEF diff --git a/engines/titanic/sound/room_trigger_auto_music_player.cpp b/engines/titanic/sound/room_trigger_auto_music_player.cpp index 5ec35c3903..8c20097927 100644 --- a/engines/titanic/sound/room_trigger_auto_music_player.cpp +++ b/engines/titanic/sound/room_trigger_auto_music_player.cpp @@ -34,7 +34,7 @@ void CRoomTriggerAutoMusicPlayer::load(SimpleFile *file) { CTriggerAutoMusicPlayer::load(file); } -bool CRoomTriggerAutoMusicPlayer::handleMessage(CEnterRoomMsg &msg) { +bool CRoomTriggerAutoMusicPlayer::EnterRoomMsg(CEnterRoomMsg *msg) { warning("CRoomTriggerAutoMusicPlayer::handleEvent"); return true; } diff --git a/engines/titanic/sound/room_trigger_auto_music_player.h b/engines/titanic/sound/room_trigger_auto_music_player.h index c3e4d0f6a4..26823ced38 100644 --- a/engines/titanic/sound/room_trigger_auto_music_player.h +++ b/engines/titanic/sound/room_trigger_auto_music_player.h @@ -29,8 +29,7 @@ namespace Titanic { class CRoomTriggerAutoMusicPlayer : public CTriggerAutoMusicPlayer { -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); + bool EnterRoomMsg(CEnterRoomMsg *msg); public: CLASSDEF diff --git a/engines/titanic/sound/titania_speech.cpp b/engines/titanic/sound/titania_speech.cpp index c530a9ac70..8c6062666d 100644 --- a/engines/titanic/sound/titania_speech.cpp +++ b/engines/titanic/sound/titania_speech.cpp @@ -40,7 +40,7 @@ void CTitaniaSpeech::load(SimpleFile *file) { CGameObject::load(file); } -bool CTitaniaSpeech::handleMessage(CEnterRoomMsg &msg) { +bool CTitaniaSpeech::EnterRoomMsg(CEnterRoomMsg *msg) { warning("CTitaniaSpeech::handleEvent"); return true; } diff --git a/engines/titanic/sound/titania_speech.h b/engines/titanic/sound/titania_speech.h index b894eeead1..78c4098d69 100644 --- a/engines/titanic/sound/titania_speech.h +++ b/engines/titanic/sound/titania_speech.h @@ -29,10 +29,9 @@ namespace Titanic { class CTitaniaSpeech : public CGameObject { + bool EnterRoomMsg(CEnterRoomMsg *msg); private: int _value1, _value2; -protected: - virtual bool handleMessage(CEnterRoomMsg &msg); public: CLASSDEF CTitaniaSpeech() : CGameObject(), _value1(1), _value2(0) {} -- cgit v1.2.3 From e7f2cb1ecbf2637db8dd7be3fe97d485a7c56bc8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 7 Apr 2016 23:39:26 -0400 Subject: TITANIC: Add CComputer messages, more view change logic --- engines/titanic/core/game_object.cpp | 73 ++++++++++++++++++++++++++++++ engines/titanic/core/game_object.h | 11 +++++ engines/titanic/core/link_item.cpp | 9 ++++ engines/titanic/core/link_item.h | 5 ++ engines/titanic/core/tree_item.h | 6 +++ engines/titanic/core/view_item.cpp | 11 +++++ engines/titanic/core/view_item.h | 6 +++ engines/titanic/game/computer.cpp | 73 ++++++++++++++++++++++++++++-- engines/titanic/game/computer.h | 10 ++-- engines/titanic/support/screen_manager.cpp | 2 +- 10 files changed, 198 insertions(+), 8 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 0570008a09..02a64dcad2 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -424,4 +424,77 @@ void CGameObject::soundProximity(const CString &name, CProximity &prox) { } } +void CGameObject::gotoView(const CString &viewName, const CString &clipName) { + CViewItem *newView = parseView(viewName); + CGameManager *gameManager = getGameManager(); + CViewItem *oldView = gameManager ? gameManager->getView() : newView; + if (!oldView || !newView) + return; + + CMovieClip *clip = nullptr; + if (clipName.empty()) { + CLinkItem *link = oldView->findLink(newView); + if (link) + clip = link->getClip(); + } else { + clip = oldView->findNode()->findRoom()->findClip(clipName); + } + + // Change the view + gameManager->_gameState.changeView(newView, clip); +} + +CViewItem *CGameObject::parseView(const CString &viewString) { + int firstIndex = viewString.indexOf('.'); + int lastIndex = viewString.lastIndexOf('.'); + CString roomName, nodeName, viewName; + + if (firstIndex == -1) { + roomName = viewString; + } else { + roomName = viewString.left(firstIndex); + + if (lastIndex > firstIndex) { + nodeName = viewString.mid(firstIndex + 1, lastIndex - firstIndex - 1); + viewName = viewString.mid(lastIndex + 1); + } else { + nodeName = viewString.mid(firstIndex + 1); + } + } + + CGameManager *gameManager = getGameManager(); + if (!gameManager) + return nullptr; + + CRoomItem *room = gameManager->getRoom(); + CProjectItem *project = room->getRoot(); + + // Ensure we have the specified room + if (project) { + if (room->getName() != roomName) { + // Scan for the correct room + for (room = project->findFirstRoom(); room && room->getName() != roomName; + room = project->findNextRoom(room)) ; + } + } + if (!room) + return nullptr; + + // Find the designated node within the room + CNodeItem *node = static_cast(room->findChildInstanceOf(CNodeItem::_type)); + while (node && node->getName() != nodeName) + node = static_cast(room->findNextInstanceOf(CNodeItem::_type, node)); + if (!node) + return nullptr; + + CViewItem *view = static_cast(node->findChildInstanceOf(CViewItem::_type)); + while (view && view->getName() != viewName) + view = static_cast(node->findNextInstanceOf(CViewItem::_type, view)); + if (!view) + return nullptr; + + // Find the view, so return it + return view; +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 72192425f4..2fc047e523 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -112,6 +112,17 @@ protected: */ void setPetArea(PetArea newArea) const; + /** + * Goto a new view + */ + void gotoView(const CString &viewName, const CString &clipName); + + /** + * Parses a view into it's components of room, node, and view, + * and locates the designated view + */ + CViewItem * parseView(const CString &viewString); + bool soundFn1(int val); void soundFn2(int val, int val2); void setVisible(bool val); diff --git a/engines/titanic/core/link_item.cpp b/engines/titanic/core/link_item.cpp index 285838b692..b172b9b4d0 100644 --- a/engines/titanic/core/link_item.cpp +++ b/engines/titanic/core/link_item.cpp @@ -108,6 +108,15 @@ void CLinkItem::load(SimpleFile *file) { } } +bool CLinkItem::connectsTo(CViewItem *destView) const { + CNodeItem *destNode = destView->findNode(); + CRoomItem *destRoom = destNode->findRoom(); + + return _viewNumber == destView->_viewNumber && + _nodeNumber == destNode->_nodeNumber && + _roomNumber == destRoom->_roomNumber; +} + void CLinkItem::setDestination(int roomNumber, int nodeNumber, int viewNumber, int v) { _roomNumber = roomNumber; diff --git a/engines/titanic/core/link_item.h b/engines/titanic/core/link_item.h index 72829720d7..25de74104b 100644 --- a/engines/titanic/core/link_item.h +++ b/engines/titanic/core/link_item.h @@ -62,6 +62,11 @@ public: */ virtual void load(SimpleFile *file); + /** + * Returns true if the given item connects to another specified view + */ + virtual bool connectsTo(CViewItem *destView) const; + /** * Set the destination for the link item */ diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index d34f963584..4de030f387 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -35,6 +35,7 @@ class CPetControl; class CProjectItem; class CScreenManager; class CRoomItem; +class CViewItem; class CTreeItem: public CMessageTarget { friend class CMessage; @@ -125,6 +126,11 @@ public: */ virtual int compareTo(const CString &name, int maxLen) const { return false; } + /** + * Returns true if the given item connects to another specified view + */ + virtual bool connectsTo(CViewItem *destView) const { return false; } + /** * Allows the item to draw itself */ diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index 3f6d5d5cff..b829ae5a70 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -168,6 +168,17 @@ void CViewItem::enterView(CViewItem *newView) { } } +CLinkItem *CViewItem::findLink(CViewItem *newView) { + for (CTreeItem *treeItem = getFirstChild(); treeItem; + treeItem = scan(treeItem)) { + CLinkItem *link = static_cast(treeItem); + if (link && link->connectsTo(newView)) + return link; + } + + return nullptr; +} + bool CViewItem::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { if (msg->_buttons & MB_LEFT) { if (!handleMouseMsg(msg, true)) { diff --git a/engines/titanic/core/view_item.h b/engines/titanic/core/view_item.h index 5abcf1d012..67b2113142 100644 --- a/engines/titanic/core/view_item.h +++ b/engines/titanic/core/view_item.h @@ -23,6 +23,7 @@ #ifndef TITANIC_VIEW_ITEM_H #define TITANIC_VIEW_ITEM_H +#include "titanic/core/link_item.h" #include "titanic/core/named_item.h" #include "titanic/core/resource_key.h" #include "titanic/messages/mouse_messages.h" @@ -90,6 +91,11 @@ public: * Called when a new view is being entered */ void enterView(CViewItem *newView); + + /** + * Finds a link which connects to another designated view + */ + CLinkItem *findLink(CViewItem *newView); }; } // End of namespace Titanic diff --git a/engines/titanic/game/computer.cpp b/engines/titanic/game/computer.cpp index a28292184e..2b0f7767fb 100644 --- a/engines/titanic/game/computer.cpp +++ b/engines/titanic/game/computer.cpp @@ -24,18 +24,83 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CComputer, CBackground) + ON_MESSAGE(ActMsg) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + void CComputer::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); - file->writeQuotedLine(_string3, indent); - file->writeNumberLine(_fieldEC, indent); + file->writeQuotedLine(_currentCD, indent); + file->writeNumberLine(_state, indent); CBackground::save(file, indent); } void CComputer::load(SimpleFile *file) { file->readNumber(); - _string3 = file->readString(); - _fieldEC = file->readNumber(); + _currentCD = file->readString(); + _state = file->readNumber(); CBackground::load(file); } +bool CComputer::ActMsg(CActMsg *msg) { + if (_state) { + soundProximity("a#35.wav", 100, 0, 0); + fn1(32, 42, 0); + + if (msg->_action == "CD1") + fn1(43, 49, 0); + else if (msg->_action == "CD2") + fn1(50, 79, 0); + else if (msg->_action == "STCD") + fn1(80, 90, 4); + + _currentCD = msg->_action; + _state = 0; + } + + return true; +} + +bool CComputer::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_currentCD == "None") { + if (_state) { + soundProximity("a#35.wav", 100, 0, 0); + fn1(11, 21, 0); + _state = 0; + } else { + soundProximity("a#34.wav", 100, 0, 0); + fn1(0, 10, 0); + _state = 1; + } + } else { + if (_state) { + loadFrame(11); + CActMsg actMsg("EjectCD"); + actMsg.execute(_currentCD); + _currentCD = "None"; + } else { + soundProximity("a#34.wav", 100, 0, 0); + fn1(21, 31, 0); + _state = 1; + } + } + + return true; +} + +bool CComputer::MovieEndMsg(CMovieEndMsg *msg) { + if (msg->_value2 == 90) { + soundProximity("a#32.wav", 100, 0, 0); + soundProximity("a#33.wav", 100, 0, 0); + soundProximity("a#31.wav", 100, 0, 0); + soundProximity("a#0.wav", 100, 0, 0); + + gotoView("Home.Node 4.E", "_TRACK,3,e-cu,4,E"); + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/computer.h b/engines/titanic/game/computer.h index 793fecc491..3db0ee1979 100644 --- a/engines/titanic/game/computer.h +++ b/engines/titanic/game/computer.h @@ -28,12 +28,16 @@ namespace Titanic { class CComputer : public CBackground { + DECLARE_MESSAGE_MAP + bool ActMsg(CActMsg *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); public: - CString _string3; - int _fieldEC; + CString _currentCD; + int _state; public: CLASSDEF - CComputer() : CBackground(), _string3("None"), _fieldEC(0) {} + CComputer() : CBackground(), _currentCD("None"), _state(0) {} /** * Save the data for the class to file diff --git a/engines/titanic/support/screen_manager.cpp b/engines/titanic/support/screen_manager.cpp index 05dfa66854..d2f2468c89 100644 --- a/engines/titanic/support/screen_manager.cpp +++ b/engines/titanic/support/screen_manager.cpp @@ -110,7 +110,7 @@ void OSScreenManager::setMode(int width, int height, int bpp, uint numBackSurfac } void OSScreenManager::drawCursors() { - warning("OSScreenManager::drawCursors"); + // Nothing needed here, since ScummVM handles cursor drawing } DirectDrawSurface *OSScreenManager::getDDSurface(SurfaceNum surfaceNum) { -- cgit v1.2.3 From b27d57c25bdbb4c4f69eaefc6ce7c79f03526abe Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 8 Apr 2016 18:42:18 -0400 Subject: TITANIC: Implemented CCDROMComputer --- engines/titanic/game/cdrom_computer.cpp | 47 ++++++++++++++++++++++++++------- engines/titanic/game/cdrom_computer.h | 8 +++--- 2 files changed, 41 insertions(+), 14 deletions(-) diff --git a/engines/titanic/game/cdrom_computer.cpp b/engines/titanic/game/cdrom_computer.cpp index e67e4fb1d8..a25706a198 100644 --- a/engines/titanic/game/cdrom_computer.cpp +++ b/engines/titanic/game/cdrom_computer.cpp @@ -21,31 +21,58 @@ */ #include "titanic/game/cdrom_computer.h" +#include "titanic/core/room_item.h" namespace Titanic { -CCDROMComputer::CCDROMComputer() : CGameObject(), - _fieldBC(0), _fieldC0(3), _fieldC4(55), _fieldC8(32) { +BEGIN_MESSAGE_MAP(CCDROMComputer, CGameObject) + ON_MESSAGE(MouseButtonDownMsg) +END_MESSAGE_MAP() + +CCDROMComputer::CCDROMComputer() : CGameObject(), + _clickRect(0, 3, 55, 32) { } void CCDROMComputer::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldBC, indent); - file->writeNumberLine(_fieldC0, indent); - file->writeNumberLine(_fieldC4, indent); - file->writeNumberLine(_fieldC8, indent); + file->writeNumberLine(_clickRect.left, indent); + file->writeNumberLine(_clickRect.top, indent); + file->writeNumberLine(_clickRect.right, indent); + file->writeNumberLine(_clickRect.bottom, indent); CGameObject::save(file, indent); } void CCDROMComputer::load(SimpleFile *file) { file->readNumber(); - _fieldBC = file->readNumber(); - _fieldC0 = file->readNumber(); - _fieldC4 = file->readNumber(); - _fieldC8 = file->readNumber(); + _clickRect.left = file->readNumber(); + _clickRect.top = file->readNumber(); + _clickRect.right = file->readNumber(); + _clickRect.bottom = file->readNumber(); CGameObject::load(file); } +bool CCDROMComputer::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + CTreeItem *tray = getRoom()->findByName("newTray"); + if (tray) { + CStatusChangeMsg statusMsg; + statusMsg.execute(tray); + + if (!statusMsg._success) { + // Check if the mouse is within the clickable area + Rect tempRect = _clickRect; + tempRect.translate(_bounds.left, _bounds.top); + + if (!tempRect.contains(msg->_mousePos)) + return true; + } + + CActMsg actMsg("ClickedOn"); + actMsg.execute(tray); + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/cdrom_computer.h b/engines/titanic/game/cdrom_computer.h index de070b007b..4ea2f4d568 100644 --- a/engines/titanic/game/cdrom_computer.h +++ b/engines/titanic/game/cdrom_computer.h @@ -24,15 +24,15 @@ #define TITANIC_CDROM_COMPUTER_H #include "titanic/core/game_object.h" +#include "titanic/messages/mouse_messages.h" namespace Titanic { class CCDROMComputer : public CGameObject { + DECLARE_MESSAGE_MAP + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); private: - int _fieldBC; - int _fieldC0; - int _fieldC4; - int _fieldC8; + Rect _clickRect; public: CLASSDEF CCDROMComputer(); -- cgit v1.2.3 From c5b73db7b9704a18c9c250f01c2eec8104b3713e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 8 Apr 2016 18:49:57 -0400 Subject: TITANIC: Implement onIdle method for regular game updates --- engines/titanic/events.cpp | 19 +++++++++++++++++++ engines/titanic/events.h | 5 +++++ 2 files changed, 24 insertions(+) diff --git a/engines/titanic/events.cpp b/engines/titanic/events.cpp index 038bc8b83b..d6f12f5c7d 100644 --- a/engines/titanic/events.cpp +++ b/engines/titanic/events.cpp @@ -86,6 +86,9 @@ bool Events::checkForNextFrameCounter() { ++_frameCounter; _priorFrameTime = milli; + // Handle any idle updates + onIdle(); + // Give time to the debugger _vm->_debugger->onFrame(); @@ -102,6 +105,22 @@ uint32 Events::getTicksCount() const { return g_system->getMillis(); } +void Events::onIdle() { + if (!_vm->_window->_inputAllowed) + return; + CGameManager *gameManager = _vm->_window->_gameManager; + if (!gameManager) + return; + + // Let the game manager perform any game updates + gameManager->update(); + + if (gameManager->_gameState._field20) { + // Game needs to shut down + _vm->quitGame(); + } +} + #define HANDLE_MESSAGE(METHOD) if (_vm->_window->_inputAllowed) { \ _vm->_window->_gameManager->_inputTranslator.METHOD(_specialButtons, Point(_mousePos.x, _mousePos.y)); \ _vm->_window->mouseChanged(); \ diff --git a/engines/titanic/events.h b/engines/titanic/events.h index fe2c75166d..f85a3d9272 100644 --- a/engines/titanic/events.h +++ b/engines/titanic/events.h @@ -55,6 +55,11 @@ private: */ bool checkForNextFrameCounter(); + /** + * Called to handle any regular updates the game requires + */ + void onIdle(); + void mouseMove(); void leftButtonDown(); void leftButtonUp(); -- cgit v1.2.3 From 63e2a01ecf2d5d5c56f657a87c48c761a88c5eb7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 8 Apr 2016 18:53:05 -0400 Subject: TITANIC: Rename field in CGameState --- engines/titanic/events.cpp | 2 +- engines/titanic/game_state.cpp | 2 +- engines/titanic/game_state.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/titanic/events.cpp b/engines/titanic/events.cpp index d6f12f5c7d..480cc91578 100644 --- a/engines/titanic/events.cpp +++ b/engines/titanic/events.cpp @@ -115,7 +115,7 @@ void Events::onIdle() { // Let the game manager perform any game updates gameManager->update(); - if (gameManager->_gameState._field20) { + if (gameManager->_gameState._quitGame) { // Game needs to shut down _vm->quitGame(); } diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index 280c917139..92a0e3dea6 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -46,7 +46,7 @@ bool CGameStateMovieList::clear() { CGameState::CGameState(CGameManager *gameManager) : _gameManager(gameManager), _gameLocation(this), _field8(0), _fieldC(0), _mode(GSMODE_UNSELECTED), _field14(0), _petActive(false), - _field1C(0), _field20(0), _field24(0), _nodeChangeCtr(0), + _field1C(0), _quitGame(false), _field24(0), _nodeChangeCtr(0), _nodeEnterTicks(0), _field38(0) { } diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h index 5a53d217da..5d4b686bf4 100644 --- a/engines/titanic/game_state.h +++ b/engines/titanic/game_state.h @@ -60,7 +60,7 @@ public: int _field14; bool _petActive; int _field1C; - int _field20; + bool _quitGame; int _field24; uint _nodeChangeCtr; uint32 _nodeEnterTicks; -- cgit v1.2.3 From e3d02532f7a64f194a802e29abef4b03eb6395b4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 8 Apr 2016 20:46:03 -0400 Subject: TITANIC: Implementing preliminary video playback code --- engines/titanic/game_manager.cpp | 13 ++++++-- engines/titanic/game_manager.h | 2 +- engines/titanic/game_state.cpp | 2 +- engines/titanic/support/movie.cpp | 59 +++++++++++++++++++++++++++++---- engines/titanic/support/movie.h | 25 +++++++++++--- engines/titanic/support/video_surface.h | 1 + engines/titanic/titanic.h | 2 +- 7 files changed, 87 insertions(+), 17 deletions(-) diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index b6eac3eb82..3e15bb0e2c 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -149,7 +149,7 @@ void CGameManager::playClip(CMovieClip *clip, CRoomItem *oldRoom, CRoomItem *new } void CGameManager::update() { - handleMovies(); + updateMovies(); frameMessage(getRoom()); _list.update(g_vm->_events->getTicksCount()); _trueTalkManager.update1(); @@ -191,8 +191,15 @@ void CGameManager::update() { } } -void CGameManager::handleMovies() { - warning("TODO: CGameManager::handleMovies"); +void CGameManager::updateMovies() { + // TODO: Make this more like the original, if I can figuring out + // what's it doing with temporary lists and the OSMovie methods + for (CMovieList::iterator i = g_vm->_activeMovies.begin(); + i != g_vm->_activeMovies.end(); ++i) { + + } + + } void CGameManager::updateDiskTicksCount() { diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index b8f5d02463..5004c777fe 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -103,7 +103,7 @@ private: /** * Handles any ongoing movie playback */ - void handleMovies(); + void updateMovies(); public: CProjectItem *_project; CGameView *_gameView; diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index 92a0e3dea6..fab7d1165b 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -32,7 +32,7 @@ bool CGameStateMovieList::clear() { CMovieListItem *listItem = *i; ++i; - if (!g_vm->_movieList.contains(listItem->_item)) { + if (!g_vm->_activeMovies.contains(listItem->_item)) { remove(listItem); delete listItem; } diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index 846dc09d5c..4fccc571ee 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -27,11 +27,11 @@ namespace Titanic { -CMovie::CMovie() : ListItem(), _state(0), _field10(0) { +CMovie::CMovie() : ListItem(), _state(MOVIE_STOPPED), _field10(0) { } bool CMovie::isActive() const { - return g_vm->_movieList.contains(this); + return g_vm->_activeMovies.contains(this); } bool CMovie::get10() { @@ -52,6 +52,7 @@ OSMovie::OSMovie(const CResourceKey &name, CVideoSurface *surface) : _videoSurfa } OSMovie::~OSMovie() { + g_vm->_activeMovies.remove(this); delete _video; } @@ -61,6 +62,10 @@ void OSMovie::proc8(int v1, CVideoSurface *surface) { void OSMovie::proc9(int v1, int v2, int v3, bool v4) { warning("TODO: OSMovie::proc9"); + //setFrame(v1); ? + _video->start(); + g_vm->_activeMovies.push_back(this); + _state = MOVIE_NONE; } void OSMovie::proc10() { @@ -85,11 +90,7 @@ void OSMovie::proc14() { void OSMovie::setFrame(uint frameNumber) { _video->seekToFrame(frameNumber); - const Graphics::Surface *s = _video->decodeNextFrame(); - Graphics::Surface *surf = s->convertTo(g_system->getScreenFormat()); - - _videoSurface->blitFrom(Common::Point(0, 0), surf); - delete surf; + decodeFrame(); } void OSMovie::proc16() { @@ -118,4 +119,48 @@ void *OSMovie::proc21() { return nullptr; } +MovieState OSMovie::getState() { + if (!_video) + _state = MOVIE_STOPPED; + return _state; +} + +void OSMovie::update() { + if (_state != MOVIE_STOPPED) { + if (_video->isPlaying()) { + if (_video->needsUpdate()) { + decodeFrame(); + _state = MOVIE_FRAME; + } else { + _state = MOVIE_NONE; + } + } else { + _state = MOVIE_STOPPED; + } + } +} + +void OSMovie::decodeFrame() { + const Graphics::Surface *frame = _video->decodeNextFrame(); + OSVideoSurface *videoSurface = static_cast(_videoSurface); + assert(videoSurface); + + videoSurface->lock(); + assert(videoSurface->_rawSurface); + + if (frame->format == videoSurface->_rawSurface->format) { + // Matching format, so we can copy straight from the video frame + videoSurface->_rawSurface->blitFrom(*frame); + } else { + // Different formats so we have to convert it first + Graphics::Surface *s = frame->convertTo(videoSurface->_rawSurface->format); + videoSurface->_rawSurface->blitFrom(*s); + + s->free(); + delete s; + } + + videoSurface->unlock(); +} + } // End of namespace Titanic diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index b5ae70de13..dfb0ca108a 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -29,11 +29,20 @@ namespace Titanic { +enum MovieState { + MOVIE_STOPPED = -1, MOVIE_NONE = 0, MOVIE_FINISHED = 1, MOVIE_FRAME = 2 +}; + class CVideoSurface; +class CMovie; + +class CMovieList : public List { +public: +}; class CMovie : public ListItem { protected: - int _state; + MovieState _state; int _field10; public: CMovie(); @@ -57,12 +66,20 @@ public: bool isActive() const; bool get10(); + + virtual MovieState getState() = 0; + virtual void update() = 0; }; class OSMovie : public CMovie { private: Video::VideoDecoder *_video; CVideoSurface *_videoSurface; + + /** + * Decodes the next frame + */ + void decodeFrame(); public: OSMovie(const CResourceKey &name, CVideoSurface *surface); virtual ~OSMovie(); @@ -86,10 +103,10 @@ public: virtual int proc19(); virtual void proc20(); virtual void *proc21(); -}; -class CGlobalMovies : public List { -public: + + virtual MovieState getState(); + virtual void update(); }; } // End of namespace Titanic diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index 767306cae6..d39dea627b 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -208,6 +208,7 @@ public: }; class OSVideoSurface : public CVideoSurface { + friend class OSMovie; private: static byte _map[0x400]; diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index a5549e463b..e83d7d9bdc 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -110,7 +110,7 @@ public: OSScreenManager *_screenManager; CMainGameWindow *_window; Common::RandomSource _randomSource; - CGlobalMovies _movieList; + CMovieList _activeMovies; CString _itemNames[TOTAL_ITEMS]; CString _itemDescriptions[TOTAL_ITEMS]; CString _itemObjects[TOTAL_ITEMS]; -- cgit v1.2.3 From 09a3ca07287b77d4abd5713b6c34548ebd8b84a8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 8 Apr 2016 23:01:02 -0400 Subject: TITANIC: Implement movie loading --- engines/titanic/core/game_object.cpp | 38 +++++++++++++++++++++++-------- engines/titanic/core/game_object.h | 2 +- engines/titanic/support/movie.cpp | 6 +++++ engines/titanic/support/video_surface.cpp | 22 +++++++++++++++--- engines/titanic/support/video_surface.h | 12 ++++++---- 5 files changed, 62 insertions(+), 18 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 02a64dcad2..d7c93b9524 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -20,14 +20,14 @@ * */ -#include "titanic/support/files_manager.h" -#include "titanic/game_manager.h" -#include "titanic/support/screen_manager.h" -#include "titanic/titanic.h" -#include "titanic/support/video_surface.h" #include "titanic/core/game_object.h" #include "titanic/core/resource_key.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/support/files_manager.h" +#include "titanic/support/screen_manager.h" +#include "titanic/support/video_surface.h" +#include "titanic/game_manager.h" +#include "titanic/titanic.h" namespace Titanic { @@ -51,7 +51,7 @@ CGameObject::CGameObject(): CNamedItem() { _visible = true; _field60 = 0; _cursorId = CURSOR_ARROW; - _field78 = 0; + _initialFrame = 0; _frameNumber = -1; _field90 = 0; _field94 = 0; @@ -222,7 +222,7 @@ void CGameObject::draw(CScreenManager *screenManager, const Common::Point &destP } void CGameObject::loadResource(const CString &name) { - switch (name.imageTypeSuffix()) { + switch (name.fileTypeSuffix()) { case FILETYPE_IMAGE: loadImage(name); break; @@ -233,7 +233,25 @@ void CGameObject::loadResource(const CString &name) { } void CGameObject::loadMovie(const CString &name, bool pendingFlag) { - warning("TODO: CGameObject::loadMovie"); + g_vm->_filesManager.fn5(name); + + // Create the surface if it doesn't already exist + if (!_surface) { + CGameManager *gameManager = getGameManager(); + _surface = new OSVideoSurface(CScreenManager::setCurrent(), nullptr); + } + + // Load the new movie resource + CResourceKey key(name); + _surface->loadResource(key); + + if (_surface->hasSurface() && !pendingFlag) { + _bounds.setWidth(_surface->getWidth()); + _bounds.setHeight(_surface->getHeight()); + } + + if (_initialFrame) + loadFrame(_initialFrame); } void CGameObject::loadImage(const CString &name, bool pendingFlag) { @@ -264,7 +282,7 @@ void CGameObject::loadImage(const CString &name, bool pendingFlag) { makeDirty(); } - _field78 = 0; + _initialFrame = 0; } void CGameObject::loadFrame(int frameNumber) { @@ -403,7 +421,7 @@ bool CGameObject::hasActiveMovie() const { int CGameObject::getMovie19() const { if (_surface && _surface->_movie) return _surface->_movie->proc19(); - return _field78; + return _initialFrame; } int CGameObject::getSurface45() const { diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 2fc047e523..3914c54226 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -70,7 +70,7 @@ protected: int _field58; bool _visible; CMovieClipList _clipList1; - int _field78; + int _initialFrame; CMovieClipList _clipList2; int _frameNumber; int _field90; diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index 4fccc571ee..d614ea7d9b 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -145,6 +145,11 @@ void OSMovie::decodeFrame() { OSVideoSurface *videoSurface = static_cast(_videoSurface); assert(videoSurface); + // If the video surface doesn't yet have an underlying surface, create it + if (!videoSurface->hasSurface()) + videoSurface->resize(frame->w, frame->h); + + // Lock access to the surface videoSurface->lock(); assert(videoSurface->_rawSurface); @@ -160,6 +165,7 @@ void OSMovie::decodeFrame() { delete s; } + // Unlock the surface videoSurface->unlock(); } diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index 1a0d48bebe..c7b437e1e7 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -241,8 +241,24 @@ void OSVideoSurface::loadJPEG(const CResourceKey &key) { _resourceKey = key; } -void OSVideoSurface::loadMovie() { - warning("TODO"); +void OSVideoSurface::loadMovie(const CResourceKey &key, bool destroyFlag) { + // Delete any prior movie + if (_movie) { + delete _movie; + _movie = nullptr; + } + + // Create the new movie and load the first frame to the video surface + _movie = new OSMovie(key, this); + _movie->setFrame(0); + + // If flagged to destroy, then immediately destroy movie instance + if (destroyFlag) { + delete _movie; + _movie = nullptr; + } + + _resourceKey = key; } bool OSVideoSurface::lock() { @@ -329,7 +345,7 @@ bool OSVideoSurface::load() { return true; case FILETYPE_MOVIE: - loadMovie(); + loadMovie(_resourceKey); return true; default: diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index d39dea627b..335215d1df 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -93,9 +93,11 @@ public: virtual void loadJPEG(const CResourceKey &key) = 0; /** - * Loads a movie file specified by the resource key + * Loads a movie file specified by the resource key. + * @param key Resource key for movie to load + * @param destroyFlag Immediately destroy movie after decoding first frame */ - virtual void loadMovie() = 0; + virtual void loadMovie(const CResourceKey &key, bool destroyFlag = false) = 0; /** * Lock the surface for direct access to the pixels @@ -241,9 +243,11 @@ public: virtual void loadJPEG(const CResourceKey &key); /** - * Loads a movie file specified by the resource key + * Loads a movie file specified by the resource key. + * @param key Resource key for movie to load + * @param destroyFlag Immediately destroy movie after decoding first frame */ - virtual void loadMovie(); + virtual void loadMovie(const CResourceKey &key, bool destroyFlag = false); /** * Lock the surface for direct access to the pixels -- cgit v1.2.3 From 3d166fb8a91a4d56bc1abac6f1e3899a0379cd31 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 9 Apr 2016 14:24:52 -0400 Subject: TITANIC: More implementation code for movie playback --- engines/titanic/core/game_object.cpp | 5 ++++- engines/titanic/game_manager.cpp | 31 ++++++++++++++++++++++++++++--- engines/titanic/game_manager.h | 5 +++++ engines/titanic/support/movie.cpp | 3 ++- engines/titanic/support/movie.h | 3 +++ 5 files changed, 42 insertions(+), 5 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index d7c93b9524..a7bbbd80cc 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -238,7 +238,7 @@ void CGameObject::loadMovie(const CString &name, bool pendingFlag) { // Create the surface if it doesn't already exist if (!_surface) { CGameManager *gameManager = getGameManager(); - _surface = new OSVideoSurface(CScreenManager::setCurrent(), nullptr); + _surface = new OSVideoSurface(gameManager->setScreenManager(), nullptr); } // Load the new movie resource @@ -359,6 +359,9 @@ void CGameObject::fn1(int val1, int val2, int val3) { } if (_surface) { + // TODO: Figure out where to do this legitimately + static_cast(_surface->_movie)->_gameObject = this; + _surface->proc34(val1, val2, val3, val3 != 0); if (val3 & 0x10) diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index 3e15bb0e2c..a4e3420702 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -195,11 +195,32 @@ void CGameManager::updateMovies() { // TODO: Make this more like the original, if I can figuring out // what's it doing with temporary lists and the OSMovie methods for (CMovieList::iterator i = g_vm->_activeMovies.begin(); - i != g_vm->_activeMovies.end(); ++i) { + i != g_vm->_activeMovies.end(); ) { + OSMovie *movie = static_cast(*i); + assert(movie && movie->_gameObject); + + movie->update(); + switch (movie->getState()) { + case MOVIE_FINISHED: { + CMovieEndMsg endMsg; + endMsg.execute(movie->_gameObject); + + i = g_vm->_activeMovies.erase(i); + continue; + } - } + case MOVIE_FRAME: { + CMovieFrameMsg frameMsg; + frameMsg.execute(movie->_gameObject); + break; + } - + default: + break; + } + + ++i; + } } void CGameManager::updateDiskTicksCount() { @@ -245,4 +266,8 @@ void CGameManager::extendBounds(const Rect &r) { _bounds.combine(r); } +CScreenManager *CGameManager::setScreenManager() const { + return CScreenManager::setCurrent(); +} + } // End of namespace Titanic diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index 5004c777fe..5a2787daf2 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -206,6 +206,11 @@ public: * to include the passed rect */ void extendBounds(const Rect &r); + + /** + * Set and return the current screen manager + */ + CScreenManager *setScreenManager() const; }; } // End of namespace Titanic diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index d614ea7d9b..f2c5643f78 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -45,7 +45,8 @@ bool CMovie::get10() { /*------------------------------------------------------------------------*/ -OSMovie::OSMovie(const CResourceKey &name, CVideoSurface *surface) : _videoSurface(surface) { +OSMovie::OSMovie(const CResourceKey &name, CVideoSurface *surface) : + _videoSurface(surface), _gameObject(nullptr) { _video = new AVIDecoder(); if (!_video->loadFile(name.getString())) error("Could not open video - %s", name.getString().c_str()); diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index dfb0ca108a..0772635908 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -35,6 +35,7 @@ enum MovieState { class CVideoSurface; class CMovie; +class CGameObject; class CMovieList : public List { public: @@ -80,6 +81,8 @@ private: * Decodes the next frame */ void decodeFrame(); +public: + CGameObject *_gameObject; public: OSMovie(const CResourceKey &name, CVideoSurface *surface); virtual ~OSMovie(); -- cgit v1.2.3 From 6405ba6ecbbec9a8e45e6093bcacf2cab7f3b94b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 9 Apr 2016 17:12:41 -0400 Subject: TITANIC: Starting to flesh out timers --- engines/titanic/game_manager.cpp | 49 +++-------------- engines/titanic/game_manager.h | 46 +--------------- engines/titanic/module.mk | 1 + engines/titanic/support/timer.cpp | 109 ++++++++++++++++++++++++++++++++++++++ engines/titanic/support/timer.h | 94 ++++++++++++++++++++++++++++++++ 5 files changed, 213 insertions(+), 86 deletions(-) create mode 100644 engines/titanic/support/timer.cpp create mode 100644 engines/titanic/support/timer.h diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index a4e3420702..56355dc58b 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -30,41 +30,6 @@ namespace Titanic { -void CGameManagerList::postLoad(uint ticks, CProjectItem *project) { - for (iterator i = begin(); i != end(); ++i) - (*i)->postLoad(ticks, project); -} - -void CGameManagerList::preSave() { - for (iterator i = begin(); i != end(); ++i) - (*i)->preSave(); -} - -void CGameManagerList::postSave() { - for (iterator i = begin(); i != end(); ++i) - (*i)->postSave(); -} - -void CGameManagerList::update(uint ticks) { - warning("TODO: CGameManagerList::update"); -} - -/*------------------------------------------------------------------------*/ - -void CGameManagerListItem::postLoad(uint ticks, CProjectItem *project) { - warning("TODO"); -} - -void CGameManagerListItem::preSave() { - warning("TODO: CGameManagerListItem::preSave"); -} - -void CGameManagerListItem::postSave() { - warning("TODO: CGameManagerListItem::postSave"); -} - -/*------------------------------------------------------------------------*/ - CGameManager::CGameManager(CProjectItem *project, CGameView *gameView): _project(project), _gameView(gameView), _trueTalkManager(this), _inputHandler(this), _inputTranslator(&_inputHandler), @@ -82,14 +47,14 @@ void CGameManager::load(SimpleFile *file) { file->readNumber(); _gameState.load(file); - _list.load(file); + _timers.load(file); _trueTalkManager.load(file); _sound.load(file); } void CGameManager::preLoad() { updateDiskTicksCount(); - _list.destroyContents(); + _timers.destroyContents(); _soundMaker = nullptr; _trueTalkManager.preLoad(); @@ -111,8 +76,8 @@ void CGameManager::postLoad(CProjectItem *project) { CLoadSuccessMsg msg(_lastDiskTicksCount - _tickCount2); msg.execute(project, nullptr, MSGFLAG_SCAN); - // Signal to any registered list items - _list.postLoad(_lastDiskTicksCount, _project); + // Signal to any registered timers + _timers.postLoad(_lastDiskTicksCount, _project); // Signal the true talk manager and sound _trueTalkManager.postLoad(); @@ -126,13 +91,13 @@ void CGameManager::preSave(CProjectItem *project) { msg.execute(project, nullptr, MSGFLAG_SCAN); // Notify sub-objects of the save - _list.preSave(); + _timers.preSave(); _trueTalkManager.preSave(); _sound.preSave(); } void CGameManager::postSave() { - _list.postSave(); + _timers.postSave(); _trueTalkManager.postSave(); } @@ -151,7 +116,7 @@ void CGameManager::playClip(CMovieClip *clip, CRoomItem *oldRoom, CRoomItem *new void CGameManager::update() { updateMovies(); frameMessage(getRoom()); - _list.update(g_vm->_events->getTicksCount()); + _timers.update(g_vm->_events->getTicksCount()); _trueTalkManager.update1(); _trueTalkManager.update2(); CScreenManager::_screenManagerPtr->_mouseCursor->update(); diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index 5a2787daf2..8b4c0be34e 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -28,6 +28,7 @@ #include "titanic/input_handler.h" #include "titanic/input_translator.h" #include "titanic/support/simple_file.h" +#include "titanic/support/timer.h" #include "titanic/support/video_surface.h" #include "titanic/true_talk/true_talk_manager.h" #include "titanic/sound/background_sound_maker.h" @@ -39,53 +40,10 @@ namespace Titanic { class CProjectItem; class CGameView; -class CGameManagerListItem : public ListItem { -private: - static int _v1; -public: - /** - * Called after loading a game has finished - */ - void postLoad(uint ticks, CProjectItem *project); - - /** - * Called when a game is about to be saved - */ - void preSave(); - - /** - * Called when a game has finished being saved - */ - void postSave(); -}; - -class CGameManagerList : public List { -public: - /** - * Called after loading a game has finished - */ - void postLoad(uint ticks, CProjectItem *project); - - /** - * Called when a game is about to be saved - */ - void preSave(); - - /** - * Called when a game has finished being saved - */ - void postSave(); - - /** - * Handles an update - */ - void update(uint ticks); -}; - class CGameManager { private: CTrueTalkManager _trueTalkManager; - CGameManagerList _list; + CTimerList _timers; int _field30; CBackgroundSoundMaker *_soundMaker; CVideoSurface *_videoSurface1; diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 80abc1a760..74dfbfbb7c 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -437,6 +437,7 @@ MODULE_OBJS := \ support/simple_file.o \ support/string.o \ support/text_cursor.o \ + support/timer.o \ support/video_surface.o \ true_talk/barbot_script.o \ true_talk/bellbot_script.o \ diff --git a/engines/titanic/support/timer.cpp b/engines/titanic/support/timer.cpp new file mode 100644 index 0000000000..6f99a67fd8 --- /dev/null +++ b/engines/titanic/support/timer.cpp @@ -0,0 +1,109 @@ +/* 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 "titanic/support/timer.h" +#include "titanic/core/project_item.h" + +namespace Titanic { + +void CTimerList::postLoad(uint ticks, CProjectItem *project) { + for (iterator i = begin(); i != end(); ++i) + (*i)->postLoad(ticks, project); +} + +void CTimerList::preSave() { + for (iterator i = begin(); i != end(); ++i) + (*i)->preSave(); +} + +void CTimerList::postSave() { + for (iterator i = begin(); i != end(); ++i) + (*i)->postSave(); +} + +void CTimerList::update(uint ticks) { + // Remove any items that are done + for (iterator i = begin(); i != end(); ) { + CTimer *item = *i; + if (item->_done) { + i = erase(i); + delete item; + } else { + ++i; + } + } + + // Handle updating the items + for (iterator i = begin(); i != end(); ) { + CTimer *item = *i; + if (!item->update(ticks)) { + ++i; + } else { + i = erase(i); + delete item; + } + } +} + +void CTimerList::stop(uint id) { + for (iterator i = begin(); i != end(); ++i) { + CTimer *item = *i; + if (item->_id == id) { + item->_done = true; + return; + } + } +} + +void CTimerList::set44(uint id, uint val) { + for (iterator i = begin(); i != end(); ++i) { + CTimer *item = *i; + if (item->_id == id) { + item->set44(val); + return; + } + } +} + +/*------------------------------------------------------------------------*/ + +CTimer::CTimer() : _id(0), _done(false), + _field44(0) { +} + +void CTimer::postLoad(uint ticks, CProjectItem *project) { + warning("TODO"); +} + +void CTimer::preSave() { + warning("TODO: CTimer::preSave"); +} + +void CTimer::postSave() { + warning("TODO: CTimer::postSave"); +} + +bool CTimer::update(uint ticks) { + return false; +} + +} // End of namespace Titanic diff --git a/engines/titanic/support/timer.h b/engines/titanic/support/timer.h new file mode 100644 index 0000000000..4d74bae34c --- /dev/null +++ b/engines/titanic/support/timer.h @@ -0,0 +1,94 @@ +/* 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. + * + */ + +#ifndef TITANIC_TIMER_H +#define TITANIC_TIMER_H + +#include "titanic/core/list.h" + +namespace Titanic { + +class CProjectItem; + +class CTimer : public ListItem { +private: + static int _v1; +public: + uint _id; + bool _done; + uint _field44; +public: + CTimer(); + + /** + * Called after loading a game has finished + */ + void postLoad(uint ticks, CProjectItem *project); + + /** + * Called when a game is about to be saved + */ + void preSave(); + + /** + * Called when a game has finished being saved + */ + void postSave(); + + bool update(uint ticks); + + void set44(uint val) { _field44 = val; } +}; + +class CTimerList : public List { +public: + /** + * Called after loading a game has finished + */ + void postLoad(uint ticks, CProjectItem *project); + + /** + * Called when a game is about to be saved + */ + void preSave(); + + /** + * Called when a game has finished being saved + */ + void postSave(); + + /** + * Handles an update + */ + void update(uint ticks); + + /** + * Remove an item with the given Id + */ + void stop(uint id); + + void set44(uint id, uint val); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TIMER_H */ -- cgit v1.2.3 From f7748622faa71729d12f3d0ec063417bdca60eb6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 9 Apr 2016 19:36:12 -0400 Subject: TITANIC: Further implementation of timers --- engines/titanic/core/saveable_object.cpp | 3 + engines/titanic/game_manager.cpp | 3 +- engines/titanic/game_manager.h | 16 ++- engines/titanic/messages/messages.h | 10 +- engines/titanic/module.mk | 2 +- engines/titanic/support/time_event_info.cpp | 206 ++++++++++++++++++++++++++++ engines/titanic/support/time_event_info.h | 134 ++++++++++++++++++ engines/titanic/support/timer.cpp | 109 --------------- engines/titanic/support/timer.h | 94 ------------- 9 files changed, 366 insertions(+), 211 deletions(-) create mode 100644 engines/titanic/support/time_event_info.cpp create mode 100644 engines/titanic/support/time_event_info.h delete mode 100644 engines/titanic/support/timer.cpp delete mode 100644 engines/titanic/support/timer.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 9f0ac320e2..4ef6a4a766 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -406,6 +406,7 @@ #include "titanic/sound/water_lapping_sounds.h" #include "titanic/star_control/star_control.h" +#include "titanic/support/time_event_info.h" namespace Titanic { @@ -1004,6 +1005,7 @@ DEFFN(CViewAutoSoundPlayer) DEFFN(CViewTogglesOtherMusic) DEFFN(CWaterLappingSounds) DEFFN(CStarControl) +DEFFN(CTimeEventInfo) void CSaveableObject::initClassList() { _classDefs = new Common::List(); @@ -1592,6 +1594,7 @@ void CSaveableObject::initClassList() { ADDFN(CViewTogglesOtherMusic, CEnterViewTogglesOtherMusic); ADDFN(CWaterLappingSounds, CRoomAutoSoundPlayer); ADDFN(CStarControl, CGameObject); + ADDFN(CTimeEventInfo, ListItem); } void CSaveableObject::freeClassList() { diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index 56355dc58b..31bb4278e1 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -37,6 +37,7 @@ CGameManager::CGameManager(CProjectItem *project, CGameView *gameView): _field30(0), _soundMaker(nullptr), _field4C(0), _dragItem(nullptr), _field54(0), _lastDiskTicksCount(0), _tickCount2(0) { + CTimeEventInfo::_nextId = 0; _videoSurface1 = nullptr; _videoSurface2 = CScreenManager::_screenManagerPtr->createSurface(600, 340); _project->setGameManager(this); @@ -91,7 +92,7 @@ void CGameManager::preSave(CProjectItem *project) { msg.execute(project, nullptr, MSGFLAG_SCAN); // Notify sub-objects of the save - _timers.preSave(); + _timers.preSave(_lastDiskTicksCount); _trueTalkManager.preSave(); _sound.preSave(); } diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index 8b4c0be34e..6e5782fb1d 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -28,7 +28,7 @@ #include "titanic/input_handler.h" #include "titanic/input_translator.h" #include "titanic/support/simple_file.h" -#include "titanic/support/timer.h" +#include "titanic/support/time_event_info.h" #include "titanic/support/video_surface.h" #include "titanic/true_talk/true_talk_manager.h" #include "titanic/sound/background_sound_maker.h" @@ -43,7 +43,7 @@ class CGameView; class CGameManager { private: CTrueTalkManager _trueTalkManager; - CTimerList _timers; + CTimeEventInfoList _timers; int _field30; CBackgroundSoundMaker *_soundMaker; CVideoSurface *_videoSurface1; @@ -169,6 +169,18 @@ public: * Set and return the current screen manager */ CScreenManager *setScreenManager() const; + + /** + * Adds a timer + */ + void addTimer(CTimeEventInfo *timer) { _timers.push_back(timer); } + + /** + * Stops a timer + */ + void stopTimer(uint id) { _timers.stop(id); } + + void setTimer44(uint id, uint val) { _timers.set44(id, val); } }; } // End of namespace Titanic diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index e566b5d661..82601e525f 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -222,16 +222,18 @@ public: } }; -MESSAGE1(CTimeMsg, int, value, 0); +MESSAGE1(CTimeMsg, uint, _ticks, 0); class CTimerMsg : public CTimeMsg { public: - int _field8; + uint _timerCtr; int _fieldC; - CString _string1; + CString _action; public: CLASSDEF - CTimerMsg() : CTimeMsg(), _field8(0), _fieldC(0) {} + CTimerMsg() : CTimeMsg(), _timerCtr(0), _fieldC(0) {} + CTimerMsg(uint ticks, uint timerCtr, int val2, const CString &action) : + CTimeMsg(ticks), _timerCtr(timerCtr), _fieldC(val2), _action(action) {} static bool isSupportedBy(const CTreeItem *item) { return supports(item, _type); diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 74dfbfbb7c..7a142eabb0 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -437,7 +437,7 @@ MODULE_OBJS := \ support/simple_file.o \ support/string.o \ support/text_cursor.o \ - support/timer.o \ + support/time_event_info.o \ support/video_surface.o \ true_talk/barbot_script.o \ true_talk/bellbot_script.o \ diff --git a/engines/titanic/support/time_event_info.cpp b/engines/titanic/support/time_event_info.cpp new file mode 100644 index 0000000000..c3312de7d7 --- /dev/null +++ b/engines/titanic/support/time_event_info.cpp @@ -0,0 +1,206 @@ +/* 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 "titanic/support/time_event_info.h" +#include "titanic/core/game_object.h" +#include "titanic/core/project_item.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +void CTimeEventInfoList::postLoad(uint ticks, CProjectItem *project) { + for (iterator i = begin(); i != end(); ++i) + (*i)->postLoad(ticks, project); +} + +void CTimeEventInfoList::preSave(uint ticks) { + for (iterator i = begin(); i != end(); ++i) + (*i)->preSave(ticks); +} + +void CTimeEventInfoList::postSave() { + for (iterator i = begin(); i != end(); ++i) + (*i)->postSave(); +} + +void CTimeEventInfoList::update(uint ticks) { + // Remove any items that are done + for (iterator i = begin(); i != end(); ) { + CTimeEventInfo *item = *i; + if (item->_done) { + i = erase(i); + delete item; + } else { + ++i; + } + } + + // Handle updating the items + for (iterator i = begin(); i != end(); ) { + CTimeEventInfo *item = *i; + if (!item->update(ticks)) { + ++i; + } else { + i = erase(i); + delete item; + } + } +} + +void CTimeEventInfoList::stop(uint id) { + for (iterator i = begin(); i != end(); ++i) { + CTimeEventInfo *item = *i; + if (item->_id == id) { + item->_done = true; + return; + } + } +} + +void CTimeEventInfoList::set44(uint id, uint val) { + for (iterator i = begin(); i != end(); ++i) { + CTimeEventInfo *item = *i; + if (item->_id == id) { + item->set44(val); + return; + } + } +} + +/*------------------------------------------------------------------------*/ + +uint CTimeEventInfo::_nextId; + +CTimeEventInfo::CTimeEventInfo() : ListItem(), _lockCounter(0), + _field14(0), _firstDuration(0), _duration(0), _target(nullptr), + _actionVal(0), _field2C(0), _field30(0), _timerCtr(0), + _lastTimerTicks(0), _field3C(0), _done(false), _field44(0) { + _id = _nextId++; +} + +CTimeEventInfo::CTimeEventInfo(uint ticks, uint f14, uint firstDuration, + uint duration, CTreeItem *target, int timerVal3, const CString &action) : + ListItem(), _lockCounter(0), _field14(f14), _firstDuration(firstDuration), + _duration(duration), _target(target), _field2C(0), _field30(0), + _timerCtr(0), _lastTimerTicks(ticks), _field3C(0), _done(false), + _field44(true) { + _id = _nextId++; +} + +void CTimeEventInfo::save(SimpleFile *file, int indent) const { + file->writeNumberLine(0, indent); + + CString targetName; + if (_target) + targetName = _target->getName(); + file->writeQuotedLine(targetName, indent); + file->writeNumberLine(_id, indent); + file->writeNumberLine(_field14, indent); + file->writeNumberLine(_firstDuration, indent); + file->writeNumberLine(_duration, indent); + file->writeNumberLine(_actionVal, indent); + file->writeQuotedLine(_action, indent); + file->writeNumberLine(_timerCtr, indent); + file->writeNumberLine(_field3C, indent); + file->writeNumberLine(_done, indent); + file->writeNumberLine(_field44, indent); +} + +void CTimeEventInfo::load(SimpleFile *file) { + lock(); + int val = file->readNumber(); + + if (!val) { + _targetName = file->readString(); + _id = file->readNumber(); + _field14 = file->readNumber(); + _firstDuration = file->readNumber(); + _duration = file->readNumber(); + _actionVal = file->readNumber(); + _action = file->readString(); + _timerCtr = file->readNumber(); + _field3C = file->readNumber(); + _done = file->readNumber() != 0; + _field44 = file->readNumber(); + _target = nullptr; + } +} + +void CTimeEventInfo::postLoad(uint ticks, CProjectItem *project) { + if (!_field44 || _targetName.empty()) + _done = true; + + // Get the timer's target + if (project) + _target = project->findByName(_targetName); + if (!_target) + _done = true; + + _lastTimerTicks = ticks + _field3C; + if (_id >= _nextId) + _nextId = _id + 1; + + unlock(); +} + +void CTimeEventInfo::preSave(uint ticks) { + _field3C = _lastTimerTicks - ticks; + lock(); +} + +void CTimeEventInfo::postSave() { + unlock(); +} + +bool CTimeEventInfo::update(uint ticks) { + if (_lockCounter) + return false; + + if (_timerCtr) { + if (ticks > (_lastTimerTicks + _duration)) { + ++_timerCtr; + _lastTimerTicks = ticks; + + if (_target) { + CTimerMsg timerMsg(ticks, _timerCtr, _actionVal, _action); + timerMsg.execute(_target); + } + } + } else { + if (ticks > (_lastTimerTicks + _firstDuration)) { + _timerCtr = 1; + _lastTimerTicks = ticks; + + if (_target) { + CTimerMsg timerMsg(ticks, _timerCtr, _actionVal, _action); + timerMsg.execute(_target); + } + + if (!_field14) + return true; + } + } + + return false; +} + +} // End of namespace Titanic diff --git a/engines/titanic/support/time_event_info.h b/engines/titanic/support/time_event_info.h new file mode 100644 index 0000000000..ee923f5fcb --- /dev/null +++ b/engines/titanic/support/time_event_info.h @@ -0,0 +1,134 @@ +/* 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. + * + */ + +#ifndef TITANIC_TIMER_H +#define TITANIC_TIMER_H + +#include "common/algorithm.h" +#include "titanic/core/list.h" + +namespace Titanic { + +class CTreeItem; +class CProjectItem; + +class CTimeEventInfo : public ListItem { +private: + /** + * Increments the counter + */ + void lock() { ++_lockCounter; } + + /** + * Called at the end of both post load and post save actions + */ + void unlock() { + _lockCounter = MAX(_lockCounter - 1, 0); + } +public: + static uint _nextId; +public: + int _lockCounter; + uint _id; + uint _field14; + uint _firstDuration; + uint _duration; + CTreeItem *_target; + uint _actionVal; + CString _action; + uint _field2C; + uint _field30; + uint _timerCtr; + uint _lastTimerTicks; + uint _field3C; + bool _done; + uint _field44; + CString _targetName; +public: + CLASSDEF + CTimeEventInfo(); + CTimeEventInfo(uint ticks, uint f14, uint firstDuration, uint duration, + CTreeItem *target, int timerVal3, const CString &action); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); + + /** + * Called after loading a game has finished + */ + void postLoad(uint ticks, CProjectItem *project); + + /** + * Called when a game is about to be saved + */ + void preSave(uint ticks); + + /** + * Called when a game has finished being saved + */ + void postSave(); + + bool update(uint ticks); + + void set44(uint val) { _field44 = val; } +}; + +class CTimeEventInfoList : public List { +public: + /** + * Called after loading a game has finished + */ + void postLoad(uint ticks, CProjectItem *project); + + /** + * Called when a game is about to be saved + */ + void preSave(uint ticks); + + /** + * Called when a game has finished being saved + */ + void postSave(); + + /** + * Handles an update + */ + void update(uint ticks); + + /** + * Remove an item with the given Id + */ + void stop(uint id); + + void set44(uint id, uint val); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TIMER_H */ diff --git a/engines/titanic/support/timer.cpp b/engines/titanic/support/timer.cpp deleted file mode 100644 index 6f99a67fd8..0000000000 --- a/engines/titanic/support/timer.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* 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 "titanic/support/timer.h" -#include "titanic/core/project_item.h" - -namespace Titanic { - -void CTimerList::postLoad(uint ticks, CProjectItem *project) { - for (iterator i = begin(); i != end(); ++i) - (*i)->postLoad(ticks, project); -} - -void CTimerList::preSave() { - for (iterator i = begin(); i != end(); ++i) - (*i)->preSave(); -} - -void CTimerList::postSave() { - for (iterator i = begin(); i != end(); ++i) - (*i)->postSave(); -} - -void CTimerList::update(uint ticks) { - // Remove any items that are done - for (iterator i = begin(); i != end(); ) { - CTimer *item = *i; - if (item->_done) { - i = erase(i); - delete item; - } else { - ++i; - } - } - - // Handle updating the items - for (iterator i = begin(); i != end(); ) { - CTimer *item = *i; - if (!item->update(ticks)) { - ++i; - } else { - i = erase(i); - delete item; - } - } -} - -void CTimerList::stop(uint id) { - for (iterator i = begin(); i != end(); ++i) { - CTimer *item = *i; - if (item->_id == id) { - item->_done = true; - return; - } - } -} - -void CTimerList::set44(uint id, uint val) { - for (iterator i = begin(); i != end(); ++i) { - CTimer *item = *i; - if (item->_id == id) { - item->set44(val); - return; - } - } -} - -/*------------------------------------------------------------------------*/ - -CTimer::CTimer() : _id(0), _done(false), - _field44(0) { -} - -void CTimer::postLoad(uint ticks, CProjectItem *project) { - warning("TODO"); -} - -void CTimer::preSave() { - warning("TODO: CTimer::preSave"); -} - -void CTimer::postSave() { - warning("TODO: CTimer::postSave"); -} - -bool CTimer::update(uint ticks) { - return false; -} - -} // End of namespace Titanic diff --git a/engines/titanic/support/timer.h b/engines/titanic/support/timer.h deleted file mode 100644 index 4d74bae34c..0000000000 --- a/engines/titanic/support/timer.h +++ /dev/null @@ -1,94 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_TIMER_H -#define TITANIC_TIMER_H - -#include "titanic/core/list.h" - -namespace Titanic { - -class CProjectItem; - -class CTimer : public ListItem { -private: - static int _v1; -public: - uint _id; - bool _done; - uint _field44; -public: - CTimer(); - - /** - * Called after loading a game has finished - */ - void postLoad(uint ticks, CProjectItem *project); - - /** - * Called when a game is about to be saved - */ - void preSave(); - - /** - * Called when a game has finished being saved - */ - void postSave(); - - bool update(uint ticks); - - void set44(uint val) { _field44 = val; } -}; - -class CTimerList : public List { -public: - /** - * Called after loading a game has finished - */ - void postLoad(uint ticks, CProjectItem *project); - - /** - * Called when a game is about to be saved - */ - void preSave(); - - /** - * Called when a game has finished being saved - */ - void postSave(); - - /** - * Handles an update - */ - void update(uint ticks); - - /** - * Remove an item with the given Id - */ - void stop(uint id); - - void set44(uint id, uint val); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_TIMER_H */ -- cgit v1.2.3 From c8eb5a7734bae63572384d3b3972d904525ce254 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 9 Apr 2016 21:00:26 -0400 Subject: TITANIC: Fix setting object bounds when drawing --- engines/titanic/core/game_object.cpp | 6 +++--- engines/titanic/true_talk/true_talk_manager.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index a7bbbd80cc..b2df9f6f54 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -178,10 +178,10 @@ void CGameObject::draw(CScreenManager *screenManager) { } if (_surface) { - _bounds.right = _surface->getWidth(); - _bounds.bottom = _surface->getHeight(); + _bounds.setWidth(_surface->getWidth()); + _bounds.setHeight(_surface->getHeight()); - if (!_bounds.right || !_bounds.bottom) + if (!_bounds.width() || !_bounds.height()) return; if (_frameNumber >= 0) { diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 6f42346e3f..68818dbbef 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -183,11 +183,11 @@ void CTrueTalkManager::viewChange() { } void CTrueTalkManager::update1() { - warning("CTrueTalkManager::update1"); + //warning("CTrueTalkManager::update1"); } void CTrueTalkManager::update2() { - warning("CTrueTalkManager::update2"); + //warning("CTrueTalkManager::update2"); } } // End of namespace Titanic -- cgit v1.2.3 From d5e346681f3019a2394eec23f566b347f82edcf6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 9 Apr 2016 21:45:13 -0400 Subject: TITANIC: Fix deleting movies --- engines/titanic/support/movie.cpp | 4 ++++ engines/titanic/support/movie.h | 2 +- engines/titanic/titanic.cpp | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index f2c5643f78..79e0a7bc9f 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -30,6 +30,10 @@ namespace Titanic { CMovie::CMovie() : ListItem(), _state(MOVIE_STOPPED), _field10(0) { } +CMovie::~CMovie() { + g_vm->_activeMovies.remove(this); +} + bool CMovie::isActive() const { return g_vm->_activeMovies.contains(this); } diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index 0772635908..08d2940fe4 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -47,7 +47,7 @@ protected: int _field10; public: CMovie(); - virtual ~CMovie() {} + virtual ~CMovie(); virtual void proc8(int v1, CVideoSurface *surface) = 0; virtual void proc9(int v1, int v2, int v3, bool v4) = 0; diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index 03d50f6153..8e079d5a60 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -62,6 +62,7 @@ TitanicEngine::~TitanicEngine() { delete _window; delete _screenManager; CSaveableObject::freeClassList(); + _activeMovies.clear(); } void TitanicEngine::initializePath(const Common::FSNode &gamePath) { -- cgit v1.2.3 From c9f322887c257c4a1c4eb54dfc4746bf0219a6e6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 10 Apr 2016 08:20:35 -0400 Subject: TITANIC: Fix CGameObject::changeStatus --- engines/titanic/core/game_object.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index b2df9f6f54..feeabdb5dc 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -360,7 +360,9 @@ void CGameObject::fn1(int val1, int val2, int val3) { if (_surface) { // TODO: Figure out where to do this legitimately - static_cast(_surface->_movie)->_gameObject = this; + OSMovie *movie = static_cast(_surface->_movie); + if (movie) + movie->_gameObject = this; _surface->proc34(val1, val2, val3, val3 != 0); @@ -370,7 +372,8 @@ void CGameObject::fn1(int val1, int val2, int val3) { } void CGameObject::changeStatus(int newStatus) { - if (_frameNumber == -1 && !_resource.empty()) { + _frameNumber = -1; + if (!_surface && !_resource.empty()) { loadResource(_resource); _resource.clear(); } -- cgit v1.2.3 From c96164dde01f6336615528d2a7c930c37c696be2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 10 Apr 2016 08:20:51 -0400 Subject: TITANIC: Cleanup of CSTButton --- engines/titanic/core/game_object.h | 2 +- engines/titanic/gfx/st_button.cpp | 8 ++++---- engines/titanic/gfx/st_button.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 3914c54226..108650958b 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -192,7 +192,7 @@ public: void loadFrame(int frameNumber); void soundProximity(const CString &name, int val2, int val3, int val4); - void soundProximity(const CString &name, CProximity &obj6C); + void soundProximity(const CString &name, CProximity &prox); }; } // End of namespace Titanic diff --git a/engines/titanic/gfx/st_button.cpp b/engines/titanic/gfx/st_button.cpp index 154122ed60..9a395813af 100644 --- a/engines/titanic/gfx/st_button.cpp +++ b/engines/titanic/gfx/st_button.cpp @@ -36,7 +36,7 @@ CSTButton::CSTButton() : CBackground() { _fieldF0 = 0; _currentStatus = 0; _string4 = "NULL"; - _string5 = "NULL"; + _soundName = "NULL"; _buttonFrame = 0; } @@ -47,7 +47,7 @@ void CSTButton::save(SimpleFile *file, int indent) const { file->writeNumberLine(_fieldF0, indent); file->writeNumberLine(_currentStatus, indent); file->writeQuotedLine(_string4, indent); - file->writeQuotedLine(_string5, indent); + file->writeQuotedLine(_soundName, indent); file->writeNumberLine(_buttonFrame, indent); CBackground::save(file, indent); @@ -60,7 +60,7 @@ void CSTButton::load(SimpleFile *file) { _fieldF0 = file->readNumber(); _currentStatus = file->readNumber(); _string4 = file->readString(); - _string5 = file->readString(); + _soundName = file->readString(); _buttonFrame = file->readNumber() != 0; CBackground::load(file); @@ -68,7 +68,7 @@ void CSTButton::load(SimpleFile *file) { bool CSTButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { changeStatus(0); - // TODO: Obj6c stuff + soundProximity(_soundName, 100, 0, 0); return true; } diff --git a/engines/titanic/gfx/st_button.h b/engines/titanic/gfx/st_button.h index d3dd5c4e76..e2f9aa3ea1 100644 --- a/engines/titanic/gfx/st_button.h +++ b/engines/titanic/gfx/st_button.h @@ -40,7 +40,7 @@ private: int _fieldF0; int _currentStatus; CString _string4; - CString _string5; + CString _soundName; int _buttonFrame; public: CLASSDEF -- cgit v1.2.3 From 78d03f9784d17f65b29e5b6836d23d8f494d3c7c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 10 Apr 2016 09:19:37 -0400 Subject: TITANIC: Television video is now playing --- engines/titanic/core/game_object.cpp | 9 +++++++-- engines/titanic/core/game_object.h | 2 ++ engines/titanic/support/movie.cpp | 10 +++++++--- engines/titanic/support/movie.h | 24 ++++++++++++++++++++---- engines/titanic/support/video_surface.cpp | 8 ++++---- engines/titanic/support/video_surface.h | 26 ++++++++++++++++++++++---- 6 files changed, 62 insertions(+), 17 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index feeabdb5dc..cdc2db68df 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -364,7 +364,7 @@ void CGameObject::fn1(int val1, int val2, int val3) { if (movie) movie->_gameObject = this; - _surface->proc34(val1, val2, val3, val3 != 0); + _surface->playMovie(val1, val2, val3, val3 != 0); if (val3 & 0x10) getGameManager()->_gameState.addMovie(_surface->_movie); @@ -380,8 +380,13 @@ void CGameObject::changeStatus(int newStatus) { CVideoSurface *surface = (newStatus & 4) ? _surface : nullptr; if (_surface) { - _surface->proc32(newStatus, surface); + _surface->playMovie(newStatus, surface); + // TODO: Figure out where to do this legitimately + OSMovie *movie = static_cast(_surface->_movie); + if (movie) + movie->_gameObject = this; + if (newStatus & 0x10) { getGameManager()->_gameState.addMovie(_surface->_movie); } diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 108650958b..0ea67a132b 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -34,8 +34,10 @@ namespace Titanic { class CVideoSurface; class CMouseDragStartMsg; +class OSMovie; class CGameObject : public CNamedItem { + friend class OSMovie; DECLARE_MESSAGE_MAP public: static void *_v1; diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index 79e0a7bc9f..7593c74e42 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -61,12 +61,13 @@ OSMovie::~OSMovie() { delete _video; } -void OSMovie::proc8(int v1, CVideoSurface *surface) { +void OSMovie::play(int v1, CVideoSurface *surface) { warning("TODO: OSMovie::proc8"); + play(0, 0, 0, 0); } -void OSMovie::proc9(int v1, int v2, int v3, bool v4) { - warning("TODO: OSMovie::proc9"); +void OSMovie::play(int v1, int v2, int v3, bool v4) { + warning("TODO: OSMovie::play properly"); //setFrame(v1); ? _video->start(); g_vm->_activeMovies.push_back(this); @@ -172,6 +173,9 @@ void OSMovie::decodeFrame() { // Unlock the surface videoSurface->unlock(); + + if (_gameObject) + _gameObject->makeDirty(); } } // End of namespace Titanic diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index 08d2940fe4..b488d26e39 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -49,8 +49,16 @@ public: CMovie(); virtual ~CMovie(); - virtual void proc8(int v1, CVideoSurface *surface) = 0; - virtual void proc9(int v1, int v2, int v3, bool v4) = 0; + /** + * Plays the movie + */ + virtual void play(int v1, CVideoSurface *surface) = 0; + + /** + * Plays the movie + */ + virtual void play(int v1, int v2, int v3, bool v4) = 0; + virtual void proc10() = 0; virtual void proc11() = 0; virtual void proc12() = 0; @@ -87,8 +95,16 @@ public: OSMovie(const CResourceKey &name, CVideoSurface *surface); virtual ~OSMovie(); - virtual void proc8(int v1, CVideoSurface *surface); - virtual void proc9(int v1, int v2, int v3, bool v4); + /** + * Plays the movie + */ + virtual void play(int v1, CVideoSurface *surface); + + /** + * Plays the movie + */ + virtual void play(int v1, int v2, int v3, bool v4); + virtual void proc10(); virtual void proc11(); virtual void proc12(); diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index c7b437e1e7..3fb513c5fc 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -379,14 +379,14 @@ void OSVideoSurface::shiftColors() { // we already convert 16-bit surfaces as soon as they're loaded } -void OSVideoSurface::proc32(int v1, CVideoSurface *surface) { +void OSVideoSurface::playMovie(int newStatus, CVideoSurface *surface) { if (loadIfReady() && _movie) - _movie->proc8(v1, surface); + _movie->play(newStatus, surface); } -void OSVideoSurface::proc34(int v1, int v2, int v3, bool v4) { +void OSVideoSurface::playMovie(int v1, int v2, int v3, bool v4) { if (loadIfReady() && _movie) { - _movie->proc9(v1, v2, v3, v4); + _movie->play(v1, v2, v3, v4); } } diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index 335215d1df..c4947ca766 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -154,8 +154,17 @@ public: */ virtual void shiftColors() = 0; - virtual void proc32(int v1, CVideoSurface *surface) = 0; - virtual void proc34(int v1, int v2, int v3, bool v4) = 0; + /** + * Plays a movie, loading it from the specified _resource + * if not already loaded + */ + virtual void playMovie(int newStatus, CVideoSurface *surface) = 0; + + /** + * Plays a movie, loading it from the specified _resource + * if not already loaded + */ + virtual void playMovie(int v1, int v2, int v3, bool v4) = 0; /** * Stops any movie currently attached to the surface @@ -304,8 +313,17 @@ public: */ virtual void shiftColors(); - virtual void proc32(int v1, CVideoSurface *surface); - virtual void proc34(int v1, int v2, int v3, bool v4); + /** + * Plays a movie, loading it from the specified _resource + * if not already loaded + */ + virtual void playMovie(int newStatus, CVideoSurface *surface); + + /** + * Plays a movie, loading it from the specified _resource + * if not already loaded + */ + virtual void playMovie(int v1, int v2, int v3, bool v4); /** * Stops any movie currently attached to the surface -- cgit v1.2.3 From 62b087adce4a0fdd0ff6a99ed5a9843ec0b722be Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 10 Apr 2016 10:20:06 -0400 Subject: TITANIC: Fleshing out CTelevision::MovieEndMsg --- engines/titanic/core/game_object.cpp | 8 +++++--- engines/titanic/core/game_object.h | 13 ++++++++++--- engines/titanic/game/cdrom_tray.cpp | 12 ++++++------ engines/titanic/game/computer.cpp | 16 ++++++++-------- engines/titanic/game/get_lift_eye2.h | 2 +- engines/titanic/game/television.cpp | 31 ++++++++++++++++++++++++++++++- engines/titanic/gfx/st_button.cpp | 2 +- engines/titanic/titanic.h | 5 +++++ 8 files changed, 66 insertions(+), 23 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index cdc2db68df..425c2274d7 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -439,18 +439,20 @@ int CGameObject::getSurface45() const { return _surface ? _surface->proc45() : 0; } -void CGameObject::soundProximity(const CString &name, int val2, int val3, int val4) { +bool CGameObject::playSound(const CString &name, int val2, int val3, int val4) { CProximity prox; prox._field8 = val2; prox._fieldC = val3; prox._field20 = val4; - soundProximity(name, prox); + return playSound(name, prox); } -void CGameObject::soundProximity(const CString &name, CProximity &prox) { +bool CGameObject::playSound(const CString &name, CProximity &prox) { if (prox._field28 == 2) { // TODO } + + return false; } void CGameObject::gotoView(const CString &viewName, const CString &clipName) { diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 0ea67a132b..6acaeff00f 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -130,6 +130,16 @@ protected: void setVisible(bool val); void petFn2(int val); void petFn3(CTreeItem *item); + + /** + * Plays a sound + */ + bool playSound(const CString &name, int val2, int val3, int val4); + + /** + * Plays a sound + */ + bool playSound(const CString &name, CProximity &prox); public: int _field60; CursorId _cursorId; @@ -192,9 +202,6 @@ public: * Loads a frame */ void loadFrame(int frameNumber); - - void soundProximity(const CString &name, int val2, int val3, int val4); - void soundProximity(const CString &name, CProximity &prox); }; } // End of namespace Titanic diff --git a/engines/titanic/game/cdrom_tray.cpp b/engines/titanic/game/cdrom_tray.cpp index 77ee539c57..5f576d1263 100644 --- a/engines/titanic/game/cdrom_tray.cpp +++ b/engines/titanic/game/cdrom_tray.cpp @@ -57,7 +57,7 @@ bool CCDROMTray::ActMsg(CActMsg *msg) { if (_state) { if (_insertedCD == "None") { fn1(55, 65, 0); - soundProximity("a#35.wav", 50, 0, 0); + playSound("a#35.wav", 50, 0, 0); _state = 0; } else { CTreeItem *treeItem = getRoom()->findByName(_insertedCD); @@ -71,24 +71,24 @@ bool CCDROMTray::ActMsg(CActMsg *msg) { } } else if (_insertedCD == "None") { fn1(44, 54, 0); - soundProximity("a#34.wav", 50, 0, 0); + playSound("a#34.wav", 50, 0, 0); _state = 1; } else if (_insertedCD == "newCD1" || _insertedCD == "newCD2") { fn1(22, 32, 0); - soundProximity("a#34.wav", 50, 0, 0); + playSound("a#34.wav", 50, 0, 0); _state = 1; } else if (_insertedCD == "newSTCD") { fn1(0, 10, 0); - soundProximity("a#34.wav", 50, 0, 0); + playSound("a#34.wav", 50, 0, 0); _state = 1; } } else if (_state) { if (msg->_action == "newCD1" || msg->_action == "newCD2") { fn1(33, 43, 4); - soundProximity("a#35.wav", 50, 0, 0); + playSound("a#35.wav", 50, 0, 0); } else if (msg->_action == "newSTCD") { fn1(11, 21, 4); - soundProximity("a#35.wav", 50, 0, 0); + playSound("a#35.wav", 50, 0, 0); } else { return true; } diff --git a/engines/titanic/game/computer.cpp b/engines/titanic/game/computer.cpp index 2b0f7767fb..95330f6448 100644 --- a/engines/titanic/game/computer.cpp +++ b/engines/titanic/game/computer.cpp @@ -46,7 +46,7 @@ void CComputer::load(SimpleFile *file) { bool CComputer::ActMsg(CActMsg *msg) { if (_state) { - soundProximity("a#35.wav", 100, 0, 0); + playSound("a#35.wav", 100, 0, 0); fn1(32, 42, 0); if (msg->_action == "CD1") @@ -66,11 +66,11 @@ bool CComputer::ActMsg(CActMsg *msg) { bool CComputer::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { if (_currentCD == "None") { if (_state) { - soundProximity("a#35.wav", 100, 0, 0); + playSound("a#35.wav", 100, 0, 0); fn1(11, 21, 0); _state = 0; } else { - soundProximity("a#34.wav", 100, 0, 0); + playSound("a#34.wav", 100, 0, 0); fn1(0, 10, 0); _state = 1; } @@ -81,7 +81,7 @@ bool CComputer::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { actMsg.execute(_currentCD); _currentCD = "None"; } else { - soundProximity("a#34.wav", 100, 0, 0); + playSound("a#34.wav", 100, 0, 0); fn1(21, 31, 0); _state = 1; } @@ -92,10 +92,10 @@ bool CComputer::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { bool CComputer::MovieEndMsg(CMovieEndMsg *msg) { if (msg->_value2 == 90) { - soundProximity("a#32.wav", 100, 0, 0); - soundProximity("a#33.wav", 100, 0, 0); - soundProximity("a#31.wav", 100, 0, 0); - soundProximity("a#0.wav", 100, 0, 0); + playSound("a#32.wav", 100, 0, 0); + playSound("a#33.wav", 100, 0, 0); + playSound("a#31.wav", 100, 0, 0); + playSound("a#0.wav", 100, 0, 0); gotoView("Home.Node 4.E", "_TRACK,3,e-cu,4,E"); } diff --git a/engines/titanic/game/get_lift_eye2.h b/engines/titanic/game/get_lift_eye2.h index 16ccf83f2a..d936559313 100644 --- a/engines/titanic/game/get_lift_eye2.h +++ b/engines/titanic/game/get_lift_eye2.h @@ -29,7 +29,7 @@ namespace Titanic { class CGetLiftEye2 : public CGameObject { bool EnterRoomMsg(CEnterRoomMsg *msg); -private: +public: static CString *_v1; public: CLASSDEF diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp index 5585cfc429..2ad84d3ff9 100644 --- a/engines/titanic/game/television.cpp +++ b/engines/titanic/game/television.cpp @@ -20,8 +20,10 @@ * */ +#include "titanic/titanic.h" #include "titanic/game/television.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/game/get_lift_eye2.h" namespace Titanic { @@ -227,7 +229,34 @@ bool CTelevision::PETActivateMsg(CPETActivateMsg *msg) { } bool CTelevision::MovieEndMsg(CMovieEndMsg *msg) { - warning("TODO: CMovieEndMsg"); + if (g_vm->getRandomNumber(6) == 0) { + CParrotSpeakMsg parrotMsg("Television", ""); + parrotMsg.execute("PerchedParrot"); + } + + if (_fieldE0 == 3 && compareRoomNameTo("SGTState") && !getState8()) { + playSound("z#47.wav", 100, 0, 0); + _fieldF0 = playSound("b#20.wav", 100, 0, 0); + CTreeItem *magazine = getRoot()->findByName("Magazine"); + + if (magazine) { + warning("TODO: CTelevision::MovieEndMsg"); + } + + loadFrame(561); + } else if (_fieldE0 == 2) { + loadFrame(_v1); + } else if (_fieldE0 == 4 && _v5) { + if (_turnOn) + loadFrame(502); + else + warning("There is currently nothing available for your viewing pleasure on this channel."); + } else if (_fieldE0 == 5 && *CGetLiftEye2::_v1 != "NULL") { + loadFrame(393 + _v4); + } else { + warning("There is currently nothing available for your viewing pleasure on this channel."); + } + return true; } diff --git a/engines/titanic/gfx/st_button.cpp b/engines/titanic/gfx/st_button.cpp index 9a395813af..827fb4a0d4 100644 --- a/engines/titanic/gfx/st_button.cpp +++ b/engines/titanic/gfx/st_button.cpp @@ -68,7 +68,7 @@ void CSTButton::load(SimpleFile *file) { bool CSTButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { changeStatus(0); - soundProximity(_soundName, 100, 0, 0); + playSound(_soundName, 100, 0, 0); return true; } diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index e83d7d9bdc..f83e728ca3 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -122,6 +122,11 @@ public: uint32 getFeatures() const; bool isDemo() const; Common::Language getLanguage() const; + + /** + * Gets a random number + */ + uint getRandomNumber(uint max) { return _randomSource.getRandomNumber(max); } }; extern TitanicEngine *g_vm; -- cgit v1.2.3 From 1ee3f334d39be6944e643c22cd376d5ae4ffaaf5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 10 Apr 2016 14:40:59 -0400 Subject: TITANIC: Change back to using original AVIDecoder --- engines/titanic/module.mk | 1 - engines/titanic/support/avi_decoder.cpp | 949 ------------------------------- engines/titanic/support/avi_decoder.h | 285 ---------- engines/titanic/support/mouse_cursor.cpp | 26 +- engines/titanic/support/movie.cpp | 16 +- engines/titanic/support/movie.h | 1 + 6 files changed, 36 insertions(+), 1242 deletions(-) delete mode 100644 engines/titanic/support/avi_decoder.cpp delete mode 100644 engines/titanic/support/avi_decoder.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 7a142eabb0..be9a46784c 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -422,7 +422,6 @@ MODULE_OBJS := \ star_control/star_control_sub13.o \ star_control/star_control_sub14.o \ star_control/star_control_sub15.o \ - support/avi_decoder.o \ support/direct_draw.o \ support/direct_draw_surface.o \ support/files_manager.o \ diff --git a/engines/titanic/support/avi_decoder.cpp b/engines/titanic/support/avi_decoder.cpp deleted file mode 100644 index 578e3a94ea..0000000000 --- a/engines/titanic/support/avi_decoder.cpp +++ /dev/null @@ -1,949 +0,0 @@ -/* 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/stream.h" -#include "common/system.h" -#include "common/textconsole.h" - -#include "audio/audiostream.h" -#include "audio/mixer.h" - -#include "titanic/support/avi_decoder.h" - -// Audio Codecs -#include "audio/decoders/adpcm.h" -#include "audio/decoders/mp3.h" -#include "audio/decoders/raw.h" - -// Video Codecs -#include "image/codecs/codec.h" - -namespace Titanic { - -#define UNKNOWN_HEADER(a) error("Unknown header found -- \'%s\'", tag2str(a)) - -// IDs used throughout the AVI files -// that will be handled by this player -#define ID_RIFF MKTAG('R','I','F','F') -#define ID_AVI MKTAG('A','V','I',' ') -#define ID_LIST MKTAG('L','I','S','T') -#define ID_HDRL MKTAG('h','d','r','l') -#define ID_AVIH MKTAG('a','v','i','h') -#define ID_STRL MKTAG('s','t','r','l') -#define ID_STRH MKTAG('s','t','r','h') -#define ID_VIDS MKTAG('v','i','d','s') -#define ID_AUDS MKTAG('a','u','d','s') -#define ID_MIDS MKTAG('m','i','d','s') -#define ID_TXTS MKTAG('t','x','t','s') -#define ID_JUNK MKTAG('J','U','N','K') -#define ID_JUNQ MKTAG('J','U','N','Q') -#define ID_DMLH MKTAG('d','m','l','h') -#define ID_STRF MKTAG('s','t','r','f') -#define ID_MOVI MKTAG('m','o','v','i') -#define ID_REC MKTAG('r','e','c',' ') -#define ID_VEDT MKTAG('v','e','d','t') -#define ID_IDX1 MKTAG('i','d','x','1') -#define ID_STRD MKTAG('s','t','r','d') -#define ID_INFO MKTAG('I','N','F','O') -#define ID_ISFT MKTAG('I','S','F','T') -#define ID_DISP MKTAG('D','I','S','P') -#define ID_PRMI MKTAG('P','R','M','I') -#define ID_STRN MKTAG('s','t','r','n') - -// Stream Types -enum { - kStreamTypePaletteChange = MKTAG16('p', 'c'), - kStreamTypeAudio = MKTAG16('w', 'b') -}; - - -AVIDecoder::AVIDecoder(Audio::Mixer::SoundType soundType) : _frameRateOverride(0), _soundType(soundType) { - initCommon(); -} - -AVIDecoder::AVIDecoder(const Common::Rational &frameRateOverride, Audio::Mixer::SoundType soundType) - : _frameRateOverride(frameRateOverride), _soundType(soundType) { - initCommon(); -} - -AVIDecoder::~AVIDecoder() { - close(); -} - -AVIDecoder::AVIAudioTrack *AVIDecoder::createAudioTrack(AVIStreamHeader sHeader, PCMWaveFormat wvInfo) { - return new AVIAudioTrack(sHeader, wvInfo, _soundType); -} - -void AVIDecoder::initCommon() { - _decodedHeader = false; - _foundMovieList = false; - _movieListStart = 0; - _movieListEnd = 0; - _fileStream = 0; - memset(&_header, 0, sizeof(_header)); -} - -bool AVIDecoder::isSeekable() const { - // Only videos with an index can seek - // Anyone else who wants to seek is crazy. - return isVideoLoaded() && !_indexEntries.empty(); -} - -bool AVIDecoder::parseNextChunk() { - uint32 tag = _fileStream->readUint32BE(); - uint32 size = _fileStream->readUint32LE(); - - if (_fileStream->eos()) - return false; - - debug(3, "Decoding tag %s", tag2str(tag)); - - switch (tag) { - case ID_LIST: - handleList(size); - break; - case ID_AVIH: - _header.size = size; - _header.microSecondsPerFrame = _fileStream->readUint32LE(); - _header.maxBytesPerSecond = _fileStream->readUint32LE(); - _header.padding = _fileStream->readUint32LE(); - _header.flags = _fileStream->readUint32LE(); - _header.totalFrames = _fileStream->readUint32LE(); - _header.initialFrames = _fileStream->readUint32LE(); - _header.streams = _fileStream->readUint32LE(); - _header.bufferSize = _fileStream->readUint32LE(); - _header.width = _fileStream->readUint32LE(); - _header.height = _fileStream->readUint32LE(); - // Ignore 16 bytes of reserved data - _fileStream->skip(16); - break; - case ID_STRH: - handleStreamHeader(size); - break; - case ID_STRD: // Extra stream info, safe to ignore - case ID_VEDT: // Unknown, safe to ignore - case ID_JUNK: // Alignment bytes, should be ignored - case ID_JUNQ: // Same as JUNK, safe to ignore - case ID_ISFT: // Metadata, safe to ignore - case ID_DISP: // Metadata, should be safe to ignore - case ID_STRN: // Metadata, safe to ignore - case ID_DMLH: // OpenDML extension, contains an extra total frames field, safe to ignore - skipChunk(size); - break; - case ID_IDX1: - readOldIndex(size); - break; - case 0: - return false; - default: - error("Unknown tag \'%s\' found", tag2str(tag)); - } - - return true; -} - -void AVIDecoder::skipChunk(uint32 size) { - // Make sure we're aligned on a word boundary - _fileStream->skip(size + (size & 1)); -} - -void AVIDecoder::handleList(uint32 listSize) { - uint32 listType = _fileStream->readUint32BE(); - listSize -= 4; // Subtract away listType's 4 bytes - uint32 curPos = _fileStream->pos(); - - debug(0, "Found LIST of type %s", tag2str(listType)); - - switch (listType) { - case ID_MOVI: // Movie List - // We found the movie block - _foundMovieList = true; - _movieListStart = curPos; - _movieListEnd = _movieListStart + listSize + (listSize & 1); - _fileStream->skip(listSize); - return; - case ID_HDRL: // Header List - // Mark the header as decoded - _decodedHeader = true; - break; - case ID_INFO: // Metadata - case ID_PRMI: // Adobe Premiere metadata, safe to ignore - // Ignore metadata - _fileStream->skip(listSize); - return; - case ID_STRL: // Stream list - default: // (Just hope we can parse it!) - break; - } - - while ((_fileStream->pos() - curPos) < listSize) - parseNextChunk(); -} - -void AVIDecoder::handleStreamHeader(uint32 size) { - AVIStreamHeader sHeader; - sHeader.size = size; - sHeader.streamType = _fileStream->readUint32BE(); - - if (sHeader.streamType == ID_MIDS || sHeader.streamType == ID_TXTS) - error("Unhandled MIDI/Text stream"); - - sHeader.streamHandler = _fileStream->readUint32BE(); - sHeader.flags = _fileStream->readUint32LE(); - sHeader.priority = _fileStream->readUint16LE(); - sHeader.language = _fileStream->readUint16LE(); - sHeader.initialFrames = _fileStream->readUint32LE(); - sHeader.scale = _fileStream->readUint32LE(); - sHeader.rate = _fileStream->readUint32LE(); - sHeader.start = _fileStream->readUint32LE(); - sHeader.length = _fileStream->readUint32LE(); - sHeader.bufferSize = _fileStream->readUint32LE(); - sHeader.quality = _fileStream->readUint32LE(); - sHeader.sampleSize = _fileStream->readUint32LE(); - - _fileStream->skip(sHeader.size - 48); // Skip over the remainder of the chunk (frame) - - if (_fileStream->readUint32BE() != ID_STRF) - error("Could not find STRF tag"); - - uint32 strfSize = _fileStream->readUint32LE(); - uint32 startPos = _fileStream->pos(); - - if (sHeader.streamType == ID_VIDS) { - if (_frameRateOverride != 0) { - sHeader.rate = _frameRateOverride.getNumerator(); - sHeader.scale = _frameRateOverride.getDenominator(); - } - - BitmapInfoHeader bmInfo; - bmInfo.size = _fileStream->readUint32LE(); - bmInfo.width = _fileStream->readUint32LE(); - bmInfo.height = _fileStream->readUint32LE(); - bmInfo.planes = _fileStream->readUint16LE(); - bmInfo.bitCount = _fileStream->readUint16LE(); - bmInfo.compression = _fileStream->readUint32BE(); - bmInfo.sizeImage = _fileStream->readUint32LE(); - bmInfo.xPelsPerMeter = _fileStream->readUint32LE(); - bmInfo.yPelsPerMeter = _fileStream->readUint32LE(); - bmInfo.clrUsed = _fileStream->readUint32LE(); - bmInfo.clrImportant = _fileStream->readUint32LE(); - - if (bmInfo.clrUsed == 0) - bmInfo.clrUsed = 256; - - byte *initialPalette = 0; - - if (bmInfo.bitCount == 8) { - initialPalette = new byte[256 * 3]; - memset(initialPalette, 0, 256 * 3); - - byte *palette = initialPalette; - for (uint32 i = 0; i < bmInfo.clrUsed; i++) { - palette[i * 3 + 2] = _fileStream->readByte(); - palette[i * 3 + 1] = _fileStream->readByte(); - palette[i * 3] = _fileStream->readByte(); - _fileStream->readByte(); - } - } - - // WORKAROUND: For Titanic engine, the ycursors.avi file has two video tracks, - // so we do an explicit check below to ignore any second video track - if (getFrameCount() == 0) - addTrack(new AVIVideoTrack(_header.totalFrames, sHeader, bmInfo, initialPalette)); - } else if (sHeader.streamType == ID_AUDS) { - PCMWaveFormat wvInfo; - wvInfo.tag = _fileStream->readUint16LE(); - wvInfo.channels = _fileStream->readUint16LE(); - wvInfo.samplesPerSec = _fileStream->readUint32LE(); - wvInfo.avgBytesPerSec = _fileStream->readUint32LE(); - wvInfo.blockAlign = _fileStream->readUint16LE(); - wvInfo.size = _fileStream->readUint16LE(); - - // AVI seems to treat the sampleSize as including the second - // channel as well, so divide for our sake. - if (wvInfo.channels == 2) - sHeader.sampleSize /= 2; - - AVIAudioTrack *track = createAudioTrack(sHeader, wvInfo); - track->createAudioStream(); - addTrack(track); - } - - // Ensure that we're at the end of the chunk - _fileStream->seek(startPos + strfSize); -} - -bool AVIDecoder::loadStream(Common::SeekableReadStream *stream) { - close(); - - uint32 riffTag = stream->readUint32BE(); - if (riffTag != ID_RIFF) { - warning("Failed to find RIFF header"); - return false; - } - - /* uint32 fileSize = */ stream->readUint32LE(); - uint32 riffType = stream->readUint32BE(); - - if (riffType != ID_AVI) { - warning("RIFF not an AVI file"); - return false; - } - - _fileStream = stream; - - // Go through all chunks in the file - while (parseNextChunk()) - ; - - if (!_decodedHeader) { - warning("Failed to parse AVI header"); - close(); - return false; - } - - if (!_foundMovieList) { - warning("Failed to find 'MOVI' list"); - close(); - return false; - } - - // Create the status entries - uint32 index = 0; - for (TrackListIterator it = getTrackListBegin(); it != getTrackListEnd(); it++, index++) { - TrackStatus status; - status.track = *it; - status.index = index; - status.chunkSearchOffset = _movieListStart; - - if ((*it)->getTrackType() == Track::kTrackTypeVideo) { - if (_videoTracks.size() == 0) - _videoTracks.push_back(status); - } else { - if (_audioTracks.size() == 0) - _audioTracks.push_back(status); - } - } - - if (_videoTracks.size() != 1) { - warning("Unhandled AVI video track count: %d", _videoTracks.size()); - close(); - return false; - } - - // Check if this is a special Duck Truemotion video - checkTruemotion1(); - - return true; -} - -void AVIDecoder::close() { - VideoDecoder::close(); - - delete _fileStream; - _fileStream = 0; - _decodedHeader = false; - _foundMovieList = false; - _movieListStart = 0; - _movieListEnd = 0; - - _indexEntries.clear(); - memset(&_header, 0, sizeof(_header)); - - _videoTracks.clear(); - _audioTracks.clear(); -} - -void AVIDecoder::readNextPacket() { - // Shouldn't get this unless called on a non-open video - if (_videoTracks.empty()) - return; - - // Get the video frame first - handleNextPacket(_videoTracks[0]); - - // Handle audio tracks next - for (uint32 i = 0; i < _audioTracks.size(); i++) - handleNextPacket(_audioTracks[i]); -} - -void AVIDecoder::handleNextPacket(TrackStatus &status) { - // If there's no more to search, bail out - if (status.chunkSearchOffset + 8 >= _movieListEnd) { - if (status.track->getTrackType() == Track::kTrackTypeVideo) { - // Horrible AVI video has a premature end - // Force the frame to be the last frame - debug(0, "Forcing end of AVI video"); - ((AVIVideoTrack *)status.track)->forceTrackEnd(); - } - - return; - } - - // See if audio needs to be buffered and break out if not - if (status.track->getTrackType() == Track::kTrackTypeAudio && !shouldQueueAudio(status)) - return; - - // Seek to where we shall start searching - _fileStream->seek(status.chunkSearchOffset); - - for (;;) { - // If there's no more to search, bail out - if ((uint32)_fileStream->pos() + 8 >= _movieListEnd) { - if (status.track->getTrackType() == Track::kTrackTypeVideo) { - // Horrible AVI video has a premature end - // Force the frame to be the last frame - debug(0, "Forcing end of AVI video"); - ((AVIVideoTrack *)status.track)->forceTrackEnd(); - } - - break; - } - - uint32 nextTag = _fileStream->readUint32BE(); - uint32 size = _fileStream->readUint32LE(); - - if (nextTag == ID_LIST) { - // A list of audio/video chunks - if (_fileStream->readUint32BE() != ID_REC) - error("Expected 'rec ' LIST"); - - continue; - } else if (nextTag == ID_JUNK || nextTag == ID_IDX1) { - skipChunk(size); - continue; - } - - // Only accept chunks for this stream - uint32 streamIndex = getStreamIndex(nextTag); - if (streamIndex != status.index) { - skipChunk(size); - continue; - } - - Common::SeekableReadStream *chunk = 0; - - if (size != 0) { - chunk = _fileStream->readStream(size); - _fileStream->skip(size & 1); - } - - if (status.track->getTrackType() == Track::kTrackTypeAudio) { - if (getStreamType(nextTag) != kStreamTypeAudio) - error("Invalid audio track tag '%s'", tag2str(nextTag)); - - assert(chunk); - ((AVIAudioTrack *)status.track)->queueSound(chunk); - - // Break out if we have enough audio - if (!shouldQueueAudio(status)) - break; - } else { - AVIVideoTrack *videoTrack = (AVIVideoTrack *)status.track; - - if (getStreamType(nextTag) == kStreamTypePaletteChange) { - // Palette Change - videoTrack->loadPaletteFromChunk(chunk); - } else { - // Otherwise, assume it's a compressed frame - videoTrack->decodeFrame(chunk); - break; - } - } - } - - // Start us off in this position next time - status.chunkSearchOffset = _fileStream->pos(); -} - -bool AVIDecoder::shouldQueueAudio(TrackStatus& status) { - // Sanity check: - if (status.track->getTrackType() != Track::kTrackTypeAudio) - return false; - - // If video is done, make sure that the rest of the audio is queued - // (I guess this is also really a sanity check) - AVIVideoTrack *videoTrack = (AVIVideoTrack *)_videoTracks[0].track; - if (videoTrack->endOfTrack()) - return true; - - // Being three frames ahead should be enough for any video. - return ((AVIAudioTrack *)status.track)->getCurChunk() < (uint32)(videoTrack->getCurFrame() + 3); -} - -bool AVIDecoder::rewind() { - if (!VideoDecoder::rewind()) - return false; - - for (uint32 i = 0; i < _videoTracks.size(); i++) - _videoTracks[i].chunkSearchOffset = _movieListStart; - - for (uint32 i = 0; i < _audioTracks.size(); i++) - _audioTracks[i].chunkSearchOffset = _movieListStart; - - return true; -} - -bool AVIDecoder::seekIntern(const Audio::Timestamp &time) { - // Can't seek beyond the end - if (time > getDuration()) - return false; - - // Get our video - AVIVideoTrack *videoTrack = (AVIVideoTrack *)_videoTracks[0].track; - uint32 videoIndex = _videoTracks[0].index; - - // If we seek directly to the end, just mark the tracks as over - if (time == getDuration()) { - videoTrack->setCurFrame(videoTrack->getFrameCount() - 1); - - for (TrackListIterator it = getTrackListBegin(); it != getTrackListEnd(); it++) - if ((*it)->getTrackType() == Track::kTrackTypeAudio) - ((AVIAudioTrack *)*it)->resetStream(); - - return true; - } - - // Get the frame we should be on at this time - uint frame = videoTrack->getFrameAtTime(time); - - // Reset any palette, if necessary - videoTrack->useInitialPalette(); - - int lastKeyFrame = -1; - int frameIndex = -1; - uint curFrame = 0; - - // Go through and figure out where we should be - // If there's a palette, we need to find the palette too - for (uint32 i = 0; i < _indexEntries.size(); i++) { - const OldIndex &index = _indexEntries[i]; - - // We don't care about RECs - if (index.id == ID_REC) - continue; - - // We're only looking at entries for this track - if (getStreamIndex(index.id) != videoIndex) - continue; - - uint16 streamType = getStreamType(index.id); - - if (streamType == kStreamTypePaletteChange) { - // We need to handle any palette change we see since there's no - // flag to tell if this is a "key" palette. - // Decode the palette - _fileStream->seek(_indexEntries[i].offset + 8); - Common::SeekableReadStream *chunk = 0; - - if (_indexEntries[i].size != 0) - chunk = _fileStream->readStream(_indexEntries[i].size); - - videoTrack->loadPaletteFromChunk(chunk); - } else { - // Check to see if this is a keyframe - // The first frame has to be a keyframe - if ((_indexEntries[i].flags & AVIIF_INDEX) || curFrame == 0) - lastKeyFrame = i; - - // Did we find the target frame? - if (frame == curFrame) { - frameIndex = i; - break; - } - - curFrame++; - } - } - - if (frameIndex < 0) // This shouldn't happen. - return false; - - // Update all the audio tracks - for (uint32 i = 0; i < _audioTracks.size(); i++) { - AVIAudioTrack *audioTrack = (AVIAudioTrack *)_audioTracks[i].track; - - // Recreate the audio stream - audioTrack->resetStream(); - - // Set the chunk index for the track - audioTrack->setCurChunk(frame); - - uint32 chunksFound = 0; - for (uint32 j = 0; j < _indexEntries.size(); j++) { - const OldIndex &index = _indexEntries[j]; - - // Continue ignoring RECs - if (index.id == ID_REC) - continue; - - if (getStreamIndex(index.id) == _audioTracks[i].index) { - if (chunksFound == frame) { - _fileStream->seek(index.offset + 8); - Common::SeekableReadStream *audioChunk = _fileStream->readStream(index.size); - audioTrack->queueSound(audioChunk); - _audioTracks[i].chunkSearchOffset = (j == _indexEntries.size() - 1) ? _movieListEnd : _indexEntries[j + 1].offset; - break; - } - - chunksFound++; - } - } - - // Skip any audio to bring us to the right time - audioTrack->skipAudio(time, videoTrack->getFrameTime(frame)); - } - - // Decode from keyFrame to curFrame - 1 - for (int i = lastKeyFrame; i < frameIndex; i++) { - if (_indexEntries[i].id == ID_REC) - continue; - - if (getStreamIndex(_indexEntries[i].id) != videoIndex) - continue; - - uint16 streamType = getStreamType(_indexEntries[i].id); - - // Ignore palettes, they were already handled - if (streamType == kStreamTypePaletteChange) - continue; - - // Frame, hopefully - _fileStream->seek(_indexEntries[i].offset + 8); - Common::SeekableReadStream *chunk = 0; - - if (_indexEntries[i].size != 0) - chunk = _fileStream->readStream(_indexEntries[i].size); - - videoTrack->decodeFrame(chunk); - } - - // Set the video track's frame - videoTrack->setCurFrame((int)frame - 1); - - // Set the video track's search offset to the right spot - _videoTracks[0].chunkSearchOffset = _indexEntries[frameIndex].offset; - return true; -} - -byte AVIDecoder::getStreamIndex(uint32 tag) const { - char string[3]; - WRITE_BE_UINT16(string, tag >> 16); - string[2] = 0; - return strtol(string, 0, 16); -} - -void AVIDecoder::readOldIndex(uint32 size) { - uint32 entryCount = size / 16; - - debug(0, "Old Index: %d entries", entryCount); - - if (entryCount == 0) - return; - - // Read the first index separately - OldIndex firstEntry; - firstEntry.id = _fileStream->readUint32BE(); - firstEntry.flags = _fileStream->readUint32LE(); - firstEntry.offset = _fileStream->readUint32LE(); - firstEntry.size = _fileStream->readUint32LE(); - - // Check if the offset is already absolute - // If it's absolute, the offset will equal the start of the movie list - bool isAbsolute = firstEntry.offset == _movieListStart; - - debug(1, "Old index is %s", isAbsolute ? "absolute" : "relative"); - - if (!isAbsolute) - firstEntry.offset += _movieListStart - 4; - - debug(0, "Index 0: Tag '%s', Offset = %d, Size = %d (Flags = %d)", tag2str(firstEntry.id), firstEntry.offset, firstEntry.size, firstEntry.flags); - _indexEntries.push_back(firstEntry); - - for (uint32 i = 1; i < entryCount; i++) { - OldIndex indexEntry; - indexEntry.id = _fileStream->readUint32BE(); - indexEntry.flags = _fileStream->readUint32LE(); - indexEntry.offset = _fileStream->readUint32LE(); - indexEntry.size = _fileStream->readUint32LE(); - - // Adjust to absolute, if necessary - if (!isAbsolute) - indexEntry.offset += _movieListStart - 4; - - _indexEntries.push_back(indexEntry); - debug(0, "Index %d: Tag '%s', Offset = %d, Size = %d (Flags = %d)", i, tag2str(indexEntry.id), indexEntry.offset, indexEntry.size, indexEntry.flags); - } -} - -void AVIDecoder::checkTruemotion1() { - // If we got here from loadStream(), we know the track is valid - assert(!_videoTracks.empty()); - - TrackStatus &status = _videoTracks[0]; - AVIVideoTrack *track = (AVIVideoTrack *)status.track; - - // Ignore non-truemotion tracks - if (!track->isTruemotion1()) - return; - - // Read the next video packet - handleNextPacket(status); - - const Graphics::Surface *frame = track->decodeNextFrame(); - if (!frame) { - rewind(); - return; - } - - // Fill in the width/height based on the frame's width/height - _header.width = frame->w; - _header.height = frame->h; - track->forceDimensions(frame->w, frame->h); - - // Rewind us back to the beginning - rewind(); -} - -Video::VideoDecoder::AudioTrack *AVIDecoder::getAudioTrack(int index) { - // AVI audio track indexes are relative to the first track - Track *track = getTrack(index); - - if (!track || track->getTrackType() != Track::kTrackTypeAudio) - return 0; - - return (AudioTrack *)track; -} - -AVIDecoder::AVIVideoTrack::AVIVideoTrack(int frameCount, const AVIStreamHeader &streamHeader, const BitmapInfoHeader &bitmapInfoHeader, byte *initialPalette) - : _frameCount(frameCount), _vidsHeader(streamHeader), _bmInfo(bitmapInfoHeader), _initialPalette(initialPalette) { - _videoCodec = createCodec(); - _lastFrame = 0; - _curFrame = -1; - - useInitialPalette(); -} - -AVIDecoder::AVIVideoTrack::~AVIVideoTrack() { - delete _videoCodec; - delete[] _initialPalette; -} - -void AVIDecoder::AVIVideoTrack::decodeFrame(Common::SeekableReadStream *stream) { - if (stream) { - if (_videoCodec) - _lastFrame = _videoCodec->decodeFrame(*stream); - } else { - // Empty frame - _lastFrame = 0; - } - - delete stream; - _curFrame++; -} - -Graphics::PixelFormat AVIDecoder::AVIVideoTrack::getPixelFormat() const { - if (_videoCodec) - return _videoCodec->getPixelFormat(); - - return Graphics::PixelFormat(); -} - -void AVIDecoder::AVIVideoTrack::loadPaletteFromChunk(Common::SeekableReadStream *chunk) { - assert(chunk); - byte firstEntry = chunk->readByte(); - uint16 numEntries = chunk->readByte(); - chunk->readUint16LE(); // Reserved - - // 0 entries means all colors are going to be changed - if (numEntries == 0) - numEntries = 256; - - for (uint16 i = firstEntry; i < numEntries + firstEntry; i++) { - _palette[i * 3] = chunk->readByte(); - _palette[i * 3 + 1] = chunk->readByte(); - _palette[i * 3 + 2] = chunk->readByte(); - chunk->readByte(); // Flags that don't serve us any purpose - } - - delete chunk; - _dirtyPalette = true; -} - -void AVIDecoder::AVIVideoTrack::useInitialPalette() { - _dirtyPalette = false; - - if (_initialPalette) { - memcpy(_palette, _initialPalette, sizeof(_palette)); - _dirtyPalette = true; - } -} - -bool AVIDecoder::AVIVideoTrack::isTruemotion1() const { - return _bmInfo.compression == MKTAG('D', 'U', 'C', 'K') || _bmInfo.compression == MKTAG('d', 'u', 'c', 'k'); -} - -void AVIDecoder::AVIVideoTrack::forceDimensions(uint16 width, uint16 height) { - _bmInfo.width = width; - _bmInfo.height = height; -} - -bool AVIDecoder::AVIVideoTrack::rewind() { - _curFrame = -1; - - useInitialPalette(); - - delete _videoCodec; - _videoCodec = createCodec(); - _lastFrame = 0; - return true; -} - -Image::Codec *AVIDecoder::AVIVideoTrack::createCodec() { - return Image::createBitmapCodec(_bmInfo.compression, _bmInfo.width, _bmInfo.height, _bmInfo.bitCount); -} - -void AVIDecoder::AVIVideoTrack::forceTrackEnd() { - _curFrame = _frameCount - 1; -} - -const byte *AVIDecoder::AVIVideoTrack::getPalette() const { - if (_videoCodec && _videoCodec->containsPalette()) - return _videoCodec->getPalette(); - - _dirtyPalette = false; - return _palette; -} - -bool AVIDecoder::AVIVideoTrack::hasDirtyPalette() const { - if (_videoCodec && _videoCodec->containsPalette()) - return _videoCodec->hasDirtyPalette(); - - return _dirtyPalette; -} - -bool AVIDecoder::AVIVideoTrack::canDither() const { - return _videoCodec && _videoCodec->canDither(Image::Codec::kDitherTypeVFW); -} - -void AVIDecoder::AVIVideoTrack::setDither(const byte *palette) { - assert(_videoCodec); - _videoCodec->setDither(Image::Codec::kDitherTypeVFW, palette); -} - -AVIDecoder::AVIAudioTrack::AVIAudioTrack(const AVIStreamHeader &streamHeader, const PCMWaveFormat &waveFormat, Audio::Mixer::SoundType soundType) - : _audsHeader(streamHeader), _wvInfo(waveFormat), _soundType(soundType), _audioStream(0), _packetStream(0), _curChunk(0) { -} - -AVIDecoder::AVIAudioTrack::~AVIAudioTrack() { - delete _audioStream; -} - -void AVIDecoder::AVIAudioTrack::queueSound(Common::SeekableReadStream *stream) { - if (_packetStream) - _packetStream->queuePacket(stream); - else - delete stream; - - _curChunk++; -} - -void AVIDecoder::AVIAudioTrack::skipAudio(const Audio::Timestamp &time, const Audio::Timestamp &frameTime) { - Audio::Timestamp timeDiff = time.convertToFramerate(_wvInfo.samplesPerSec) - frameTime.convertToFramerate(_wvInfo.samplesPerSec); - int skipFrames = timeDiff.totalNumberOfFrames(); - - if (skipFrames <= 0) - return; - - Audio::AudioStream *audioStream = getAudioStream(); - if (!audioStream) - return; - - if (audioStream->isStereo()) - skipFrames *= 2; - - int16 *tempBuffer = new int16[skipFrames]; - audioStream->readBuffer(tempBuffer, skipFrames); - delete[] tempBuffer; -} - -void AVIDecoder::AVIAudioTrack::resetStream() { - delete _audioStream; - createAudioStream(); - _curChunk = 0; -} - -bool AVIDecoder::AVIAudioTrack::rewind() { - resetStream(); - return true; -} - -void AVIDecoder::AVIAudioTrack::createAudioStream() { - _packetStream = 0; - - switch (_wvInfo.tag) { - case kWaveFormatPCM: { - byte flags = 0; - if (_audsHeader.sampleSize == 2) - flags |= Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN; - else - flags |= Audio::FLAG_UNSIGNED; - - if (_wvInfo.channels == 2) - flags |= Audio::FLAG_STEREO; - - _packetStream = Audio::makePacketizedRawStream(_wvInfo.samplesPerSec, flags); - break; - } - case kWaveFormatMSADPCM: - _packetStream = Audio::makePacketizedADPCMStream(Audio::kADPCMMS, _wvInfo.samplesPerSec, _wvInfo.channels, _wvInfo.blockAlign); - break; - case kWaveFormatMSIMAADPCM: - _packetStream = Audio::makePacketizedADPCMStream(Audio::kADPCMMSIma, _wvInfo.samplesPerSec, _wvInfo.channels, _wvInfo.blockAlign); - break; - case kWaveFormatDK3: - _packetStream = Audio::makePacketizedADPCMStream(Audio::kADPCMDK3, _wvInfo.samplesPerSec, _wvInfo.channels, _wvInfo.blockAlign); - break; - case kWaveFormatMP3: -#ifdef USE_MAD - _packetStream = Audio::makePacketizedMP3Stream(_wvInfo.channels, _wvInfo.samplesPerSec); -#else - warning("AVI MP3 stream found, but no libmad support compiled in"); -#endif - break; - case kWaveFormatNone: - break; - default: - warning("Unsupported AVI audio format %d", _wvInfo.tag); - break; - } - - if (_packetStream) - _audioStream = _packetStream; - else - _audioStream = Audio::makeNullAudioStream(); -} - -AVIDecoder::TrackStatus::TrackStatus() : track(0), chunkSearchOffset(0) { -} - -} // End of namespace Titanic diff --git a/engines/titanic/support/avi_decoder.h b/engines/titanic/support/avi_decoder.h deleted file mode 100644 index acc33cbc4d..0000000000 --- a/engines/titanic/support/avi_decoder.h +++ /dev/null @@ -1,285 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_AVI_DECODER_H -#define TITANIC_AVI_DECODER_H - -#include "common/array.h" -#include "common/rational.h" -#include "common/rect.h" -#include "common/str.h" - -#include "video/video_decoder.h" -#include "audio/mixer.h" - -namespace Audio { -class AudioStream; -class PacketizedAudioStream; -} - -namespace Common { -class SeekableReadStream; -} - -namespace Graphics { -struct PixelFormat; -} - -namespace Image { -class Codec; -} - -namespace Titanic { - -/** - * Modified AVI Decoder used by Titanic engine. - */ -class AVIDecoder : public Video::VideoDecoder { -public: - AVIDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType); - AVIDecoder(const Common::Rational &frameRateOverride, Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType); - virtual ~AVIDecoder(); - - bool loadStream(Common::SeekableReadStream *stream); - void close(); - uint16 getWidth() const { return _header.width; } - uint16 getHeight() const { return _header.height; } - - bool rewind(); - bool isRewindable() const { return true; } - bool isSeekable() const; - -protected: - // VideoDecoder API - void readNextPacket(); - bool seekIntern(const Audio::Timestamp &time); - bool supportsAudioTrackSwitching() const { return true; } - AudioTrack *getAudioTrack(int index); - - struct BitmapInfoHeader { - uint32 size; - uint32 width; - uint32 height; - uint16 planes; - uint16 bitCount; - uint32 compression; - uint32 sizeImage; - uint32 xPelsPerMeter; - uint32 yPelsPerMeter; - uint32 clrUsed; - uint32 clrImportant; - }; - - struct WaveFormat { - uint16 tag; - uint16 channels; - uint32 samplesPerSec; - uint32 avgBytesPerSec; - uint16 blockAlign; - }; - - struct PCMWaveFormat : public WaveFormat { - uint16 size; - }; - - struct WaveFormatEX : public WaveFormat { - uint16 bitsPerSample; - uint16 size; - }; - - struct OldIndex { - uint32 id; - uint32 flags; - uint32 offset; - uint32 size; - }; - - // Index Flags - enum IndexFlags { - AVIIF_INDEX = 0x10 - }; - - struct AVIHeader { - uint32 size; - uint32 microSecondsPerFrame; - uint32 maxBytesPerSecond; - uint32 padding; - uint32 flags; - uint32 totalFrames; - uint32 initialFrames; - uint32 streams; - uint32 bufferSize; - uint32 width; - uint32 height; - }; - - // Flags from the AVIHeader - enum AVIFlags { - AVIF_HASINDEX = 0x00000010, - AVIF_MUSTUSEINDEX = 0x00000020, - AVIF_ISINTERLEAVED = 0x00000100, - AVIF_TRUSTCKTYPE = 0x00000800, - AVIF_WASCAPTUREFILE = 0x00010000, - AVIF_WASCOPYRIGHTED = 0x00020000 - }; - - struct AVIStreamHeader { - uint32 size; - uint32 streamType; - uint32 streamHandler; - uint32 flags; - uint16 priority; - uint16 language; - uint32 initialFrames; - uint32 scale; - uint32 rate; - uint32 start; - uint32 length; - uint32 bufferSize; - uint32 quality; - uint32 sampleSize; - Common::Rect frame; - }; - - class AVIVideoTrack : public FixedRateVideoTrack { - public: - AVIVideoTrack(int frameCount, const AVIStreamHeader &streamHeader, const BitmapInfoHeader &bitmapInfoHeader, byte *initialPalette = 0); - ~AVIVideoTrack(); - - void decodeFrame(Common::SeekableReadStream *stream); - void forceTrackEnd(); - - uint16 getWidth() const { return _bmInfo.width; } - uint16 getHeight() const { return _bmInfo.height; } - Graphics::PixelFormat getPixelFormat() const; - int getCurFrame() const { return _curFrame; } - int getFrameCount() const { return _frameCount; } - const Graphics::Surface *decodeNextFrame() { return _lastFrame; } - - const byte *getPalette() const; - bool hasDirtyPalette() const; - void setCurFrame(int frame) { _curFrame = frame; } - void loadPaletteFromChunk(Common::SeekableReadStream *chunk); - void useInitialPalette(); - bool canDither() const; - void setDither(const byte *palette); - - bool isTruemotion1() const; - void forceDimensions(uint16 width, uint16 height); - - bool isRewindable() const { return true; } - bool rewind(); - - protected: - Common::Rational getFrameRate() const { return Common::Rational(_vidsHeader.rate, _vidsHeader.scale); } - - private: - AVIStreamHeader _vidsHeader; - BitmapInfoHeader _bmInfo; - byte _palette[3 * 256]; - byte *_initialPalette; - mutable bool _dirtyPalette; - int _frameCount, _curFrame; - - Image::Codec *_videoCodec; - const Graphics::Surface *_lastFrame; - Image::Codec *createCodec(); - }; - - class AVIAudioTrack : public AudioTrack { - public: - AVIAudioTrack(const AVIStreamHeader &streamHeader, const PCMWaveFormat &waveFormat, Audio::Mixer::SoundType soundType); - ~AVIAudioTrack(); - - virtual void createAudioStream(); - virtual void queueSound(Common::SeekableReadStream *stream); - Audio::Mixer::SoundType getSoundType() const { return _soundType; } - void skipAudio(const Audio::Timestamp &time, const Audio::Timestamp &frameTime); - virtual void resetStream(); - uint32 getCurChunk() const { return _curChunk; } - void setCurChunk(uint32 chunk) { _curChunk = chunk; } - - bool isRewindable() const { return true; } - bool rewind(); - - protected: - Audio::AudioStream *getAudioStream() const { return _audioStream; } - - // Audio Codecs - enum { - kWaveFormatNone = 0, - kWaveFormatPCM = 1, - kWaveFormatMSADPCM = 2, - kWaveFormatMSIMAADPCM = 17, - kWaveFormatMP3 = 85, - kWaveFormatDK3 = 98 // rogue format number - }; - - AVIStreamHeader _audsHeader; - PCMWaveFormat _wvInfo; - Audio::Mixer::SoundType _soundType; - Audio::AudioStream *_audioStream; - Audio::PacketizedAudioStream *_packetStream; - uint32 _curChunk; - }; - - struct TrackStatus { - TrackStatus(); - - Track *track; - uint32 index; - uint32 chunkSearchOffset; - }; - - AVIHeader _header; - - void readOldIndex(uint32 size); - Common::Array _indexEntries; - - Common::SeekableReadStream *_fileStream; - bool _decodedHeader; - bool _foundMovieList; - uint32 _movieListStart, _movieListEnd; - - Audio::Mixer::SoundType _soundType; - Common::Rational _frameRateOverride; - void initCommon(); - - bool parseNextChunk(); - void skipChunk(uint32 size); - void handleList(uint32 listSize); - void handleStreamHeader(uint32 size); - uint16 getStreamType(uint32 tag) const { return tag & 0xFFFF; } - byte getStreamIndex(uint32 tag) const; - void checkTruemotion1(); - - void handleNextPacket(TrackStatus& status); - bool shouldQueueAudio(TrackStatus& status); - Common::Array _videoTracks, _audioTracks; - -public: - virtual AVIAudioTrack *createAudioTrack(AVIStreamHeader sHeader, PCMWaveFormat wvInfo); -}; - -} // End of namespace Titanic - -#endif diff --git a/engines/titanic/support/mouse_cursor.cpp b/engines/titanic/support/mouse_cursor.cpp index a2bd11657c..6ddfecfd2a 100644 --- a/engines/titanic/support/mouse_cursor.cpp +++ b/engines/titanic/support/mouse_cursor.cpp @@ -20,8 +20,9 @@ * */ -#include "graphics/cursorman.h" +#include "common/memstream.h" #include "common/textconsole.h" +#include "graphics/cursorman.h" #include "titanic/support/mouse_cursor.h" #include "titanic/support/movie.h" #include "titanic/support/screen_manager.h" @@ -62,20 +63,39 @@ CMouseCursor::~CMouseCursor() { void CMouseCursor::loadCursorImages() { const CString name("ycursors.avi"); - const CResourceKey key(name); g_vm->_filesManager.fn4(name); + // WORKAROUND: We need to manipulate ycursors.avi file so it can be read + // by the ScummVM AVIDecoder, by removing the redundant second video track + Common::File f; + if (!f.open(name)) + error("Could not open cursors file"); + + // Read in the entire file + byte *movieData = (byte *)malloc(f.size()); + f.read(movieData, f.size()); + + if (READ_BE_UINT32(movieData + 254) == MKTAG('s', 't', 'r', 'h')) { + // Change the second video chunk to junk data so it gets ignored + WRITE_BE_UINT32(movieData + 254, MKTAG('J', 'U', 'N', 'K')); + WRITE_LE_UINT32(movieData + 258, 1128); + } + // Iterate through each cursor for (int idx = 0; idx < NUM_CURSORS; ++idx) { assert(CURSOR_DATA[idx][0] == (idx + 1)); _cursors[idx]._centroid = Common::Point(CURSOR_DATA[idx][2], CURSOR_DATA[idx][3]); + // Create the surface CVideoSurface *surface = _screenManager->createSurface(64, 64); _cursors[idx]._videoSurface = surface; - OSMovie movie(key, surface); + Common::SeekableReadStream *stream = new Common::MemoryReadStream( + movieData, f.size(), DisposeAfterUse::NO); + OSMovie movie(stream, surface); movie.setFrame(idx); + _cursors[idx]._ptrUnknown = movie.proc21(); surface->set40(_cursors[idx]._ptrUnknown); } diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index 7593c74e42..6599093226 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -20,8 +20,7 @@ * */ -#include "image/codecs/cinepak.h" -#include "titanic/support/avi_decoder.h" +#include "video/avi_decoder.h" #include "titanic/support/movie.h" #include "titanic/titanic.h" @@ -51,11 +50,18 @@ bool CMovie::get10() { OSMovie::OSMovie(const CResourceKey &name, CVideoSurface *surface) : _videoSurface(surface), _gameObject(nullptr) { - _video = new AVIDecoder(); + _video = new Video::AVIDecoder(); if (!_video->loadFile(name.getString())) error("Could not open video - %s", name.getString().c_str()); } +OSMovie::OSMovie(Common::SeekableReadStream *stream, CVideoSurface *surface) : + _videoSurface(surface), _gameObject(nullptr) { + _video = new Video::AVIDecoder(); + if (!_video->loadStream(stream)) + error("Could not parse movie stream"); +} + OSMovie::~OSMovie() { g_vm->_activeMovies.remove(this); delete _video; @@ -134,7 +140,9 @@ MovieState OSMovie::getState() { void OSMovie::update() { if (_state != MOVIE_STOPPED) { if (_video->isPlaying()) { - if (_video->needsUpdate()) { + if (_video->endOfVideo()) { + _state = MOVIE_FINISHED; + } else if (_video->needsUpdate()) { decodeFrame(); _state = MOVIE_FRAME; } else { diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index b488d26e39..2751f2d814 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -93,6 +93,7 @@ public: CGameObject *_gameObject; public: OSMovie(const CResourceKey &name, CVideoSurface *surface); + OSMovie(Common::SeekableReadStream *stream, CVideoSurface *surface); virtual ~OSMovie(); /** -- cgit v1.2.3 From 9db15f6967c8f559e34824213707ed76b45d666e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 10 Apr 2016 14:46:59 -0400 Subject: TITANIC: Allow television video to play multiple times --- engines/titanic/support/movie.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index 6599093226..dd0792caa4 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -75,6 +75,7 @@ void OSMovie::play(int v1, CVideoSurface *surface) { void OSMovie::play(int v1, int v2, int v3, bool v4) { warning("TODO: OSMovie::play properly"); //setFrame(v1); ? + _video->seek(0); _video->start(); g_vm->_activeMovies.push_back(this); _state = MOVIE_NONE; -- cgit v1.2.3 From 8e5f7a9453deff3436fc937292a0ff825acd7454 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 10 Apr 2016 15:01:39 -0400 Subject: TITANIC: Fix stopping movies --- engines/titanic/main_game_window.cpp | 2 +- engines/titanic/support/movie.cpp | 3 ++- engines/titanic/support/movie.h | 10 ++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 5b8cba341a..a524529492 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -113,7 +113,7 @@ void CMainGameWindow::setActiveView(CViewItem *viewItem) { void CMainGameWindow::draw() { if (_gameManager) { - if (_gameView->_surface) { + if (!_gameView->_surface) { CViewItem *view = _gameManager->getView(); if (view) setActiveView(view); diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index dd0792caa4..0627da8c4f 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -94,7 +94,8 @@ void OSMovie::proc12() { } void OSMovie::stop() { - warning("TODO: OSMovie::proc13"); + _video->stop(); + _state = MOVIE_STOPPED; } void OSMovie::proc14() { diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index 2751f2d814..d88c7b0be9 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -62,7 +62,12 @@ public: virtual void proc10() = 0; virtual void proc11() = 0; virtual void proc12() = 0; + + /** + * Stops the movie + */ virtual void stop() = 0; + virtual void proc14() = 0; virtual void setFrame(uint frameNumber) = 0; virtual void proc16() = 0; @@ -109,7 +114,12 @@ public: virtual void proc10(); virtual void proc11(); virtual void proc12(); + + /** + * Stops the movie + */ virtual void stop(); + virtual void proc14(); /** -- cgit v1.2.3 From 91336a86115f600e626c333441aa1369b435ab92 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 10 Apr 2016 15:39:20 -0400 Subject: TITANIC: Implement playing a range of frames within movie --- engines/titanic/core/background.cpp | 4 ++-- engines/titanic/core/game_object.cpp | 12 ++++++------ engines/titanic/core/game_object.h | 17 ++++++++++------- engines/titanic/game/cdrom_tray.cpp | 12 ++++++------ engines/titanic/game/computer.cpp | 14 +++++++------- engines/titanic/game/television.cpp | 12 ++++++------ engines/titanic/gfx/st_button.cpp | 2 +- engines/titanic/pet_control/pet_element.cpp | 8 ++++---- engines/titanic/pet_control/pet_element.h | 5 ++++- engines/titanic/support/movie.cpp | 21 ++++++++++++--------- engines/titanic/support/movie.h | 9 +++++---- engines/titanic/support/video_surface.cpp | 8 ++++---- engines/titanic/support/video_surface.h | 8 ++++---- 13 files changed, 71 insertions(+), 61 deletions(-) diff --git a/engines/titanic/core/background.cpp b/engines/titanic/core/background.cpp index 5859719026..52ff4c4ac2 100644 --- a/engines/titanic/core/background.cpp +++ b/engines/titanic/core/background.cpp @@ -58,9 +58,9 @@ void CBackground::load(SimpleFile *file) { bool CBackground::StatusChangeMsg(CStatusChangeMsg *msg) { setVisible(true); if (_fieldDC) { - fn1(_fieldBC, _fieldC0, 16); + playMovie(_fieldBC, _fieldC0, 16); } else { - fn1(_fieldBC, _fieldC0, 0); + playMovie(_fieldBC, _fieldC0, 0); } return true; } diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 425c2274d7..a798c4db98 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -350,7 +350,7 @@ void CGameObject::petFn3(CTreeItem *item) { pet->fn3(item); } -void CGameObject::fn1(int val1, int val2, int val3) { +void CGameObject::playMovie(uint startFrame, uint endFrame, int val3) { _frameNumber = -1; if (!_surface) { if (!_resource.empty()) @@ -364,30 +364,30 @@ void CGameObject::fn1(int val1, int val2, int val3) { if (movie) movie->_gameObject = this; - _surface->playMovie(val1, val2, val3, val3 != 0); + _surface->playMovie(startFrame, endFrame, val3, val3 != 0); if (val3 & 0x10) getGameManager()->_gameState.addMovie(_surface->_movie); } } -void CGameObject::changeStatus(int newStatus) { +void CGameObject::playMovie(uint flags) { _frameNumber = -1; if (!_surface && !_resource.empty()) { loadResource(_resource); _resource.clear(); } - CVideoSurface *surface = (newStatus & 4) ? _surface : nullptr; + CVideoSurface *surface = (flags & 4) ? _surface : nullptr; if (_surface) { - _surface->playMovie(newStatus, surface); + _surface->playMovie(flags, surface); // TODO: Figure out where to do this legitimately OSMovie *movie = static_cast(_surface->_movie); if (movie) movie->_gameObject = this; - if (newStatus & 0x10) { + if (flags & 0x10) { getGameManager()->_gameState.addMovie(_surface->_movie); } } diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 6acaeff00f..ab1833934b 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -178,13 +178,6 @@ public: */ bool checkPoint(const Point &pt, bool ignore40 = false, bool visibleOnly = false); - void fn1(int val1, int val2, int val3); - - /** - * Change the object's status - */ - void changeStatus(int newStatus); - /** * Set the position of the object */ @@ -202,6 +195,16 @@ public: * Loads a frame */ void loadFrame(int frameNumber); + + /** + * Change the object's status + */ + void playMovie(uint flags); + + /** + * Play the movie specified in _resource + */ + void playMovie(uint startFrame, uint endFrame, int val3); }; } // End of namespace Titanic diff --git a/engines/titanic/game/cdrom_tray.cpp b/engines/titanic/game/cdrom_tray.cpp index 5f576d1263..1b2d6baf07 100644 --- a/engines/titanic/game/cdrom_tray.cpp +++ b/engines/titanic/game/cdrom_tray.cpp @@ -56,7 +56,7 @@ bool CCDROMTray::ActMsg(CActMsg *msg) { if (msg->_action == "ClickedOn") { if (_state) { if (_insertedCD == "None") { - fn1(55, 65, 0); + playMovie(55, 65, 0); playSound("a#35.wav", 50, 0, 0); _state = 0; } else { @@ -70,24 +70,24 @@ bool CCDROMTray::ActMsg(CActMsg *msg) { loadFrame(52); } } else if (_insertedCD == "None") { - fn1(44, 54, 0); + playMovie(44, 54, 0); playSound("a#34.wav", 50, 0, 0); _state = 1; } else if (_insertedCD == "newCD1" || _insertedCD == "newCD2") { - fn1(22, 32, 0); + playMovie(22, 32, 0); playSound("a#34.wav", 50, 0, 0); _state = 1; } else if (_insertedCD == "newSTCD") { - fn1(0, 10, 0); + playMovie(0, 10, 0); playSound("a#34.wav", 50, 0, 0); _state = 1; } } else if (_state) { if (msg->_action == "newCD1" || msg->_action == "newCD2") { - fn1(33, 43, 4); + playMovie(33, 43, 4); playSound("a#35.wav", 50, 0, 0); } else if (msg->_action == "newSTCD") { - fn1(11, 21, 4); + playMovie(11, 21, 4); playSound("a#35.wav", 50, 0, 0); } else { return true; diff --git a/engines/titanic/game/computer.cpp b/engines/titanic/game/computer.cpp index 95330f6448..d2a2cc1935 100644 --- a/engines/titanic/game/computer.cpp +++ b/engines/titanic/game/computer.cpp @@ -47,14 +47,14 @@ void CComputer::load(SimpleFile *file) { bool CComputer::ActMsg(CActMsg *msg) { if (_state) { playSound("a#35.wav", 100, 0, 0); - fn1(32, 42, 0); + playMovie(32, 42, 0); if (msg->_action == "CD1") - fn1(43, 49, 0); + playMovie(43, 49, 0); else if (msg->_action == "CD2") - fn1(50, 79, 0); + playMovie(50, 79, 0); else if (msg->_action == "STCD") - fn1(80, 90, 4); + playMovie(80, 90, 4); _currentCD = msg->_action; _state = 0; @@ -67,11 +67,11 @@ bool CComputer::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { if (_currentCD == "None") { if (_state) { playSound("a#35.wav", 100, 0, 0); - fn1(11, 21, 0); + playMovie(11, 21, 0); _state = 0; } else { playSound("a#34.wav", 100, 0, 0); - fn1(0, 10, 0); + playMovie(0, 10, 0); _state = 1; } } else { @@ -82,7 +82,7 @@ bool CComputer::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { _currentCD = "None"; } else { playSound("a#34.wav", 100, 0, 0); - fn1(21, 31, 0); + playMovie(21, 31, 0); _state = 1; } } diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp index 2ad84d3ff9..6e1f5ca54c 100644 --- a/engines/titanic/game/television.cpp +++ b/engines/titanic/game/television.cpp @@ -148,8 +148,8 @@ bool CTelevision::EnterViewMsg(CEnterViewMsg *msg) { return true; } -static const int FRAMES1[9] = { 0, 0, 56, 112, 168, 224, 280, 336, 392 }; -static const int FRAMES2[8] = { 0, 55, 111, 167, 223, 279, 335, 391 }; +static const int START_FRAMES[9] = { 0, 0, 56, 112, 168, 224, 280, 336, 392 }; +static const int END_FRAMES[8] = { 0, 55, 111, 167, 223, 279, 335, 391 }; bool CTelevision::PETUpMsg(CPETUpMsg *msg) { if (msg->_name == "Television" && _isOn) { @@ -158,7 +158,7 @@ bool CTelevision::PETUpMsg(CPETUpMsg *msg) { _fieldE0 = _fieldE0 % _fieldE4 + 1; stopMovie(); - fn1(FRAMES1[_fieldE0], FRAMES2[_fieldE0], 4); + playMovie(START_FRAMES[_fieldE0], END_FRAMES[_fieldE0], 4); } return true; @@ -173,7 +173,7 @@ bool CTelevision::PETDownMsg(CPETDownMsg *msg) { _fieldE0 = _fieldE0 % _fieldE4 + 1; stopMovie(); - fn1(FRAMES1[_fieldE0], FRAMES2[_fieldE0], 4); + playMovie(START_FRAMES[_fieldE0], END_FRAMES[_fieldE0], 4); } return true; @@ -182,7 +182,7 @@ bool CTelevision::PETDownMsg(CPETDownMsg *msg) { bool CTelevision::StatusChangeMsg(CStatusChangeMsg *msg) { if (_isOn) { stopMovie(); - changeStatus(0); + playMovie(0); } return true; @@ -211,7 +211,7 @@ bool CTelevision::PETActivateMsg(CPETActivateMsg *msg) { if (_isOn) { setVisible(true); - fn1(0, 55, 0); + playMovie(0, 55, 0); _fieldE0 = 1; } else { stopMovie(); diff --git a/engines/titanic/gfx/st_button.cpp b/engines/titanic/gfx/st_button.cpp index 827fb4a0d4..b45d990c31 100644 --- a/engines/titanic/gfx/st_button.cpp +++ b/engines/titanic/gfx/st_button.cpp @@ -67,7 +67,7 @@ void CSTButton::load(SimpleFile *file) { } bool CSTButton::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { - changeStatus(0); + playMovie(0); playSound(_soundName, 100, 0, 0); return true; diff --git a/engines/titanic/pet_control/pet_element.cpp b/engines/titanic/pet_control/pet_element.cpp index 68c258c0fb..625415fb62 100644 --- a/engines/titanic/pet_control/pet_element.cpp +++ b/engines/titanic/pet_control/pet_element.cpp @@ -62,18 +62,18 @@ bool CPetElement::contains2(const Common::Point &pt) const { return _bounds.contains(pt); } -void CPetElement::proc11(int val1, int val2) const { +void CPetElement::playMovie(uint startFrame, uint endFrame) const { CGameObject *gameObject = getObject(); if (gameObject) - gameObject->fn1(val1, val2, 0); + gameObject->playMovie(startFrame, endFrame, 0); } -void CPetElement::changeStatus(int newStatus) const { +void CPetElement::changeStatus(int val) const { CGameObject *gameObject = getObject(); if (gameObject) - gameObject->changeStatus(newStatus); + gameObject->playMovie(val); } bool CPetElement::hasActiveMovie() const { diff --git a/engines/titanic/pet_control/pet_element.h b/engines/titanic/pet_control/pet_element.h index a53715ddb9..de9f552ec8 100644 --- a/engines/titanic/pet_control/pet_element.h +++ b/engines/titanic/pet_control/pet_element.h @@ -84,7 +84,10 @@ public: */ virtual bool contains2(const Common::Point &pt) const; - virtual void proc11(int val1, int val2) const; + /** + * Plays back a range of frames in the loaded video file for the element + */ + virtual void playMovie(uint startFrame, uint endFrame) const; /** * Change the status of the associated object diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index 0627da8c4f..6f66bec7a7 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -49,14 +49,14 @@ bool CMovie::get10() { /*------------------------------------------------------------------------*/ OSMovie::OSMovie(const CResourceKey &name, CVideoSurface *surface) : - _videoSurface(surface), _gameObject(nullptr) { + _videoSurface(surface), _gameObject(nullptr), _endFrame(-1) { _video = new Video::AVIDecoder(); if (!_video->loadFile(name.getString())) error("Could not open video - %s", name.getString().c_str()); } OSMovie::OSMovie(Common::SeekableReadStream *stream, CVideoSurface *surface) : - _videoSurface(surface), _gameObject(nullptr) { + _videoSurface(surface), _gameObject(nullptr), _endFrame(-1) { _video = new Video::AVIDecoder(); if (!_video->loadStream(stream)) error("Could not parse movie stream"); @@ -67,16 +67,18 @@ OSMovie::~OSMovie() { delete _video; } -void OSMovie::play(int v1, CVideoSurface *surface) { - warning("TODO: OSMovie::proc8"); - play(0, 0, 0, 0); +void OSMovie::play(uint flags, CVideoSurface *surface) { + uint endFrame = _video->getFrameCount(); + play(0, endFrame, 0, 0); } -void OSMovie::play(int v1, int v2, int v3, bool v4) { +void OSMovie::play(uint startFrame, uint endFrame, int v3, bool v4) { warning("TODO: OSMovie::play properly"); - //setFrame(v1); ? - _video->seek(0); + _video->start(); + _video->seekToFrame(startFrame); + _endFrame = endFrame; + g_vm->_activeMovies.push_back(this); _state = MOVIE_NONE; } @@ -142,7 +144,8 @@ MovieState OSMovie::getState() { void OSMovie::update() { if (_state != MOVIE_STOPPED) { if (_video->isPlaying()) { - if (_video->endOfVideo()) { + if (_video->getCurFrame() >= _endFrame) { + _video->stop(); _state = MOVIE_FINISHED; } else if (_video->needsUpdate()) { decodeFrame(); diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index d88c7b0be9..a871af6fc7 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -52,12 +52,12 @@ public: /** * Plays the movie */ - virtual void play(int v1, CVideoSurface *surface) = 0; + virtual void play(uint flags, CVideoSurface *surface) = 0; /** * Plays the movie */ - virtual void play(int v1, int v2, int v3, bool v4) = 0; + virtual void play(uint startFrame, uint endFrame, int v3, bool v4) = 0; virtual void proc10() = 0; virtual void proc11() = 0; @@ -89,6 +89,7 @@ class OSMovie : public CMovie { private: Video::VideoDecoder *_video; CVideoSurface *_videoSurface; + int _endFrame; /** * Decodes the next frame @@ -104,12 +105,12 @@ public: /** * Plays the movie */ - virtual void play(int v1, CVideoSurface *surface); + virtual void play(uint flags, CVideoSurface *surface); /** * Plays the movie */ - virtual void play(int v1, int v2, int v3, bool v4); + virtual void play(uint startFrame, uint endFrame, int v3, bool v4); virtual void proc10(); virtual void proc11(); diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index 3fb513c5fc..089b216347 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -379,14 +379,14 @@ void OSVideoSurface::shiftColors() { // we already convert 16-bit surfaces as soon as they're loaded } -void OSVideoSurface::playMovie(int newStatus, CVideoSurface *surface) { +void OSVideoSurface::playMovie(uint flags, CVideoSurface *surface) { if (loadIfReady() && _movie) - _movie->play(newStatus, surface); + _movie->play(flags, surface); } -void OSVideoSurface::playMovie(int v1, int v2, int v3, bool v4) { +void OSVideoSurface::playMovie(uint startFrame, uint endFrame, int v3, bool v4) { if (loadIfReady() && _movie) { - _movie->play(v1, v2, v3, v4); + _movie->play(startFrame, endFrame, v3, v4); } } diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index c4947ca766..2ec2c9ddba 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -158,13 +158,13 @@ public: * Plays a movie, loading it from the specified _resource * if not already loaded */ - virtual void playMovie(int newStatus, CVideoSurface *surface) = 0; + virtual void playMovie(uint flags, CVideoSurface *surface) = 0; /** * Plays a movie, loading it from the specified _resource * if not already loaded */ - virtual void playMovie(int v1, int v2, int v3, bool v4) = 0; + virtual void playMovie(uint startFrame, uint endFrame, int v3, bool v4) = 0; /** * Stops any movie currently attached to the surface @@ -317,13 +317,13 @@ public: * Plays a movie, loading it from the specified _resource * if not already loaded */ - virtual void playMovie(int newStatus, CVideoSurface *surface); + virtual void playMovie(uint flags, CVideoSurface *surface); /** * Plays a movie, loading it from the specified _resource * if not already loaded */ - virtual void playMovie(int v1, int v2, int v3, bool v4); + virtual void playMovie(uint startFrame, uint endFrame, int v3, bool v4); /** * Stops any movie currently attached to the surface -- cgit v1.2.3 From cf785a19e3dbe52eb71b253a5dcdcd7ba77b47ca Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 10 Apr 2016 17:09:22 -0400 Subject: TITANIC: Implement drag&drop dropping --- engines/titanic/input_handler.cpp | 38 +++++++++++++++++++++++---- engines/titanic/input_handler.h | 2 +- engines/titanic/pet_control/pet_control.h | 14 ++++++++++ engines/titanic/pet_control/pet_inventory.cpp | 5 ++++ engines/titanic/pet_control/pet_inventory.h | 5 ++++ engines/titanic/pet_control/pet_section.h | 7 ++++- 6 files changed, 64 insertions(+), 7 deletions(-) diff --git a/engines/titanic/input_handler.cpp b/engines/titanic/input_handler.cpp index 0657ebec94..082bdd080e 100644 --- a/engines/titanic/input_handler.cpp +++ b/engines/titanic/input_handler.cpp @@ -88,8 +88,8 @@ void CInputHandler::processMessage(CMessage *msg) { } else { if (mouseMsg->isButtonUpMsg() && _dragItem) { // Mouse drag ended - dragEnd(_mousePos, _dragItem); - CMouseDragEndMsg endMsg(_mousePos, _dragItem); + CTreeItem *target = dragEnd(_mousePos, _dragItem); + CMouseDragEndMsg endMsg(_mousePos, target); endMsg.execute(_dragItem); } @@ -134,8 +134,36 @@ void CInputHandler::dispatchMessage(CMessage *msg) { } } -void CInputHandler::dragEnd(const Point &mousePos, CTreeItem *dragItem) { - warning("TODO CInputHandler::dragEnd"); +CTreeItem *CInputHandler::dragEnd(const Point &pt, CTreeItem *dragItem) { + CViewItem *view = _gameManager->getView(); + if (!view) + return nullptr; + + // Scan through the view items to find the item being dropped on + CTreeItem *target = nullptr; + for (CTreeItem *treeItem = view->scan(view); treeItem; treeItem = treeItem->scan(view)) { + CGameObject *gameObject = static_cast(treeItem); + if (gameObject && gameObject != dragItem) { + if (gameObject->checkPoint(pt)) + target = gameObject; + } + } + + if (target) { + // Check if the cursor is on the PET. If so, pass to the PET + // to see what specific element the drag ended on + CProjectItem *project = view->getRoot(); + if (project) { + CPetControl *petControl = project->getPetControl(); + if (petControl && petControl->contains(pt)) { + target = petControl->dragEnd(pt); + if (!target) + target = petControl; + } + } + } + + return target; } -} // End of namespace Titanic z +} // End of namespace Titanic diff --git a/engines/titanic/input_handler.h b/engines/titanic/input_handler.h index 4e8966fdc4..05838e88c0 100644 --- a/engines/titanic/input_handler.h +++ b/engines/titanic/input_handler.h @@ -46,7 +46,7 @@ private: /** * Called when a drag operation has ended */ - void dragEnd(const Point &mousePos, CTreeItem *dragItem); + CTreeItem *dragEnd(const Point &pt, CTreeItem *dragItem); public: CGameManager *_gameManager; CInputTranslator *_inputTranslator; diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 172cec9bf7..39bc5fb41b 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -182,6 +182,20 @@ public: * Draws the indent */ void drawIndent(CScreenManager *screenManager, int indent); + + /** + * Returns true if the point is within the PET's draw bounds + */ + bool contains(const Point &pt) const { + return _drawBounds.contains(pt); + } + + /** + * Handles drag ends within the PET + */ + CTreeItem *dragEnd(const Point &pt) const { + return _currentArea == PET_INVENTORY ? _inventory.dragEnd(pt) : nullptr; + } }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index 66d093f513..79923bdb41 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -64,6 +64,11 @@ void CPetInventory::load(SimpleFile *file, int param) { _field298 = file->readNumber(); } +CTreeItem *CPetInventory::dragEnd(const Point &pt) const { + warning("TODO: CPetInventory::dragEnd"); + return nullptr; +} + bool CPetInventory::isValid(CPetControl *petControl) { // TODO return true; diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h index 01f9ebb8d3..a0a9304fd6 100644 --- a/engines/titanic/pet_control/pet_inventory.h +++ b/engines/titanic/pet_control/pet_inventory.h @@ -81,6 +81,11 @@ public: */ virtual void load(SimpleFile *file, int param); + /** + * Returns item a drag-drop operation has dropped on, if any + */ + virtual CTreeItem *dragEnd(const Point &pt) const; + /** * Returns true if the object is in a valid state */ diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index e20c03c3d5..bc24737b1d 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -90,7 +90,12 @@ public: virtual bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { return false; } virtual int proc14() { return 0; } - virtual int proc15() { return 0; } + + /** + * Returns item a drag-drop operation has dropped on, if any + */ + virtual CTreeItem *dragEnd(const Point &pt) const { return nullptr; } + virtual void proc16(); /** -- cgit v1.2.3 From ad6ea25c99654b93c712a64fe322dce42e7fd0e8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 11 Apr 2016 18:13:36 -0400 Subject: TITANIC: Added CCarry message handler stubs --- engines/titanic/carry/carry.cpp | 63 +++++++++++++++++++++++++++++++++++++++++ engines/titanic/carry/carry.h | 15 ++++++++++ 2 files changed, 78 insertions(+) diff --git a/engines/titanic/carry/carry.cpp b/engines/titanic/carry/carry.cpp index 74544896dd..b075444cd7 100644 --- a/engines/titanic/carry/carry.cpp +++ b/engines/titanic/carry/carry.cpp @@ -24,6 +24,21 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CCarry, CGameObject) + ON_MESSAGE(MouseDragStartMsg) + ON_MESSAGE(MouseDragMoveMsg) + ON_MESSAGE(MouseDragEndMsg) + ON_MESSAGE(UseWithCharMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(UseWithOtherMsg) + ON_MESSAGE(VisibleMsg) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(RemoveFromGameMsg) + ON_MESSAGE(MoveToStartPosMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(PassOnDragStartMsg) +END_MESSAGE_MAP() + CCarry::CCarry() : CGameObject(), _fieldDC(0), _fieldE0(1), _field100(0), _field104(0), _field108(0), _field10C(0), _field110(0), _field120(0), _field124(0), _field128(0), @@ -77,4 +92,52 @@ void CCarry::load(SimpleFile *file) { CGameObject::load(file); } +bool CCarry::MouseDragStartMsg(CMouseDragStartMsg *msg) { + return true; +} + +bool CCarry::MouseDragMoveMsg(CMouseDragMoveMsg *msg) { + return true; +} + +bool CCarry::MouseDragEndMsg(CMouseDragEndMsg *msg) { + return true; +} + +bool CCarry::UseWithCharMsg(CUseWithCharMsg *msg) { + return true; +} + +bool CCarry::LeaveViewMsg(CLeaveViewMsg *msg) { + return true; +} + +bool CCarry::UseWithOtherMsg(CUseWithOtherMsg *msg) { + return true; +} + +bool CCarry::VisibleMsg(CVisibleMsg *msg) { + return true; +} + +bool CCarry::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + return true; +} + +bool CCarry::RemoveFromGameMsg(CRemoveFromGameMsg *msg) { + return true; +} + +bool CCarry::MoveToStartPosMsg(CMoveToStartPosMsg *msg) { + return true; +} + +bool CCarry::EnterViewMsg(CEnterViewMsg *msg) { + return true; +} + +bool CCarry::PassOnDragStartMsg(CPassOnDragStartMsg *msg) { + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/carry/carry.h b/engines/titanic/carry/carry.h index 309b8a8eb8..9788b25602 100644 --- a/engines/titanic/carry/carry.h +++ b/engines/titanic/carry/carry.h @@ -24,10 +24,25 @@ #define TITANIC_CARRY_H #include "titanic/core/game_object.h" +#include "titanic/messages/messages.h" +#include "titanic/messages/mouse_messages.h" namespace Titanic { class CCarry : public CGameObject { + DECLARE_MESSAGE_MAP + bool MouseDragStartMsg(CMouseDragStartMsg *msg); + bool MouseDragMoveMsg(CMouseDragMoveMsg *msg); + bool MouseDragEndMsg(CMouseDragEndMsg *msg); + bool UseWithCharMsg(CUseWithCharMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool UseWithOtherMsg(CUseWithOtherMsg *msg); + bool VisibleMsg(CVisibleMsg *msg); + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool RemoveFromGameMsg(CRemoveFromGameMsg *msg); + bool MoveToStartPosMsg(CMoveToStartPosMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool PassOnDragStartMsg(CPassOnDragStartMsg *msg); private: CString _string1; Point _pos1; -- cgit v1.2.3 From 7e1f802abdab1442bd49f1c398c0aab6d81d452b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 11 Apr 2016 18:53:40 -0400 Subject: TITANIC: CCarry drag & move msg handlers --- engines/titanic/carry/carry.cpp | 26 +++++++++++++++++++++++--- engines/titanic/carry/carry.h | 2 +- engines/titanic/core/game_object.cpp | 4 ++++ engines/titanic/core/game_object.h | 5 +++++ engines/titanic/input_handler.cpp | 6 +++--- engines/titanic/input_handler.h | 2 +- engines/titanic/messages/messages.h | 1 - engines/titanic/messages/mouse_messages.h | 19 ++++++++++++++++--- engines/titanic/pet_control/pet_control.h | 2 +- engines/titanic/pet_control/pet_inventory.cpp | 2 +- engines/titanic/pet_control/pet_inventory.h | 2 +- engines/titanic/pet_control/pet_section.h | 2 +- 12 files changed, 57 insertions(+), 16 deletions(-) diff --git a/engines/titanic/carry/carry.cpp b/engines/titanic/carry/carry.cpp index b075444cd7..eefb13f462 100644 --- a/engines/titanic/carry/carry.cpp +++ b/engines/titanic/carry/carry.cpp @@ -57,7 +57,7 @@ void CCarry::save(SimpleFile *file, int indent) const { file->writeNumberLine(_fieldE0, indent); file->writeQuotedLine(_string3, indent); file->writeQuotedLine(_string4, indent); - file->writePoint(_pos2, indent); + file->writePoint(_tempPos, indent); file->writeNumberLine(_field104, indent); file->writeNumberLine(_field108, indent); file->writeNumberLine(_field10C, indent); @@ -79,7 +79,7 @@ void CCarry::load(SimpleFile *file) { _fieldE0 = file->readNumber(); _string3 = file->readString(); _string4 = file->readString(); - _pos2 = file->readPoint(); + _tempPos = file->readPoint(); _field104 = file->readNumber(); _field108 = file->readNumber(); _field10C = file->readNumber(); @@ -93,14 +93,34 @@ void CCarry::load(SimpleFile *file) { } bool CCarry::MouseDragStartMsg(CMouseDragStartMsg *msg) { - return true; + CString name = getName(); + + if (_fieldE0) { + if (_visible) { + CShowTextMsg textMsg("You can't get this."); + textMsg.execute("PET"); + } + } else { + if (checkStartDragging(msg)) { + CPassOnDragStartMsg startMsg(msg->_mousePos); + startMsg.execute(this); + return true; + } + } + + return false; } bool CCarry::MouseDragMoveMsg(CMouseDragMoveMsg *msg) { + setPosition(msg->_mousePos - _tempPos); return true; } bool CCarry::MouseDragEndMsg(CMouseDragEndMsg *msg) { + if (msg->_dropTarget) { + // TODO + } + return true; } diff --git a/engines/titanic/carry/carry.h b/engines/titanic/carry/carry.h index 9788b25602..b98a7bedea 100644 --- a/engines/titanic/carry/carry.h +++ b/engines/titanic/carry/carry.h @@ -51,7 +51,7 @@ private: int _fieldE0; CString _string3; CString _string4; - Point _pos2; + Point _tempPos; int _field100; int _field104; int _field108; diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index a798c4db98..c179ed8b50 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -221,6 +221,10 @@ void CGameObject::draw(CScreenManager *screenManager, const Common::Point &destP } } +bool CGameObject::isPet() const { + return isInstanceOf(CPetControl::_type); +} + void CGameObject::loadResource(const CString &name) { switch (name.fileTypeSuffix()) { case FILETYPE_IMAGE: diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index ab1833934b..a8d8513587 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -167,6 +167,11 @@ public: */ virtual void draw(CScreenManager *screenManager, const Common::Point &destPos); + /** + * Returns true if the item is the PET control + */ + virtual bool isPet() const; + /** * Stops any movie currently playing for the object */ diff --git a/engines/titanic/input_handler.cpp b/engines/titanic/input_handler.cpp index 082bdd080e..3d3541b1dd 100644 --- a/engines/titanic/input_handler.cpp +++ b/engines/titanic/input_handler.cpp @@ -88,7 +88,7 @@ void CInputHandler::processMessage(CMessage *msg) { } else { if (mouseMsg->isButtonUpMsg() && _dragItem) { // Mouse drag ended - CTreeItem *target = dragEnd(_mousePos, _dragItem); + CGameObject *target = dragEnd(_mousePos, _dragItem); CMouseDragEndMsg endMsg(_mousePos, target); endMsg.execute(_dragItem); } @@ -134,13 +134,13 @@ void CInputHandler::dispatchMessage(CMessage *msg) { } } -CTreeItem *CInputHandler::dragEnd(const Point &pt, CTreeItem *dragItem) { +CGameObject *CInputHandler::dragEnd(const Point &pt, CTreeItem *dragItem) { CViewItem *view = _gameManager->getView(); if (!view) return nullptr; // Scan through the view items to find the item being dropped on - CTreeItem *target = nullptr; + CGameObject *target = nullptr; for (CTreeItem *treeItem = view->scan(view); treeItem; treeItem = treeItem->scan(view)) { CGameObject *gameObject = static_cast(treeItem); if (gameObject && gameObject != dragItem) { diff --git a/engines/titanic/input_handler.h b/engines/titanic/input_handler.h index 05838e88c0..2d62127a11 100644 --- a/engines/titanic/input_handler.h +++ b/engines/titanic/input_handler.h @@ -46,7 +46,7 @@ private: /** * Called when a drag operation has ended */ - CTreeItem *dragEnd(const Point &pt, CTreeItem *dragItem); + CGameObject *dragEnd(const Point &pt, CTreeItem *dragItem); public: CGameManager *_gameManager; CInputTranslator *_inputTranslator; diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 82601e525f..e74c26fd97 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -319,7 +319,6 @@ MESSAGE0(COpeningCreditsMsg); MESSAGE1(CPanningAwayFromParrotMsg, int, value, 0); MESSAGE2(CParrotSpeakMsg, CString, value1, "", CString, value2, ""); MESSAGE2(CParrotTriesChickenMsg, int, value1, 0, int, value2, 0); -MESSAGE4(CPassOnDragStartMsg, int, value1, 0, int, value2, 0, int, value3, 0, int, value4, 0); MESSAGE1(CPhonographPlayMsg, int, value, 0); MESSAGE0(CPhonographReadyToPlayMsg); MESSAGE1(CPhonographRecordMsg, int, value, 0); diff --git a/engines/titanic/messages/mouse_messages.h b/engines/titanic/messages/mouse_messages.h index 811fdf0ad0..705247a2dc 100644 --- a/engines/titanic/messages/mouse_messages.h +++ b/engines/titanic/messages/mouse_messages.h @@ -139,14 +139,27 @@ public: } }; +class CPassOnDragStartMsg : public CMessage { +public: + Point _mousePos; +public: + CLASSDEF + CPassOnDragStartMsg() : CMessage() {} + CPassOnDragStartMsg(const Point &pt) : CMessage(), _mousePos(pt) {} + + static bool isSupportedBy(const CTreeItem *item) { + return supports(item, _type); + } +}; + class CMouseDragEndMsg : public CMouseDragMsg { public: - CTreeItem *_dropTarget; + CGameObject *_dropTarget; public: CLASSDEF CMouseDragEndMsg() : CMouseDragMsg(), _dropTarget(nullptr) {} - CMouseDragEndMsg(const Point &pt, CTreeItem *dragItem = nullptr) : - CMouseDragMsg(pt), _dropTarget(dragItem) {} + CMouseDragEndMsg(const Point &pt, CGameObject *dropTarget = nullptr) : + CMouseDragMsg(pt), _dropTarget(dropTarget) {} static bool isSupportedBy(const CTreeItem *item) { return supports(item, _type); diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 39bc5fb41b..f357c29378 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -193,7 +193,7 @@ public: /** * Handles drag ends within the PET */ - CTreeItem *dragEnd(const Point &pt) const { + CGameObject *dragEnd(const Point &pt) const { return _currentArea == PET_INVENTORY ? _inventory.dragEnd(pt) : nullptr; } }; diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index 79923bdb41..1104b653b6 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -64,7 +64,7 @@ void CPetInventory::load(SimpleFile *file, int param) { _field298 = file->readNumber(); } -CTreeItem *CPetInventory::dragEnd(const Point &pt) const { +CGameObject *CPetInventory::dragEnd(const Point &pt) const { warning("TODO: CPetInventory::dragEnd"); return nullptr; } diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h index a0a9304fd6..16dfd227f1 100644 --- a/engines/titanic/pet_control/pet_inventory.h +++ b/engines/titanic/pet_control/pet_inventory.h @@ -84,7 +84,7 @@ public: /** * Returns item a drag-drop operation has dropped on, if any */ - virtual CTreeItem *dragEnd(const Point &pt) const; + virtual CGameObject *dragEnd(const Point &pt) const; /** * Returns true if the object is in a valid state diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index bc24737b1d..93a9145411 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -94,7 +94,7 @@ public: /** * Returns item a drag-drop operation has dropped on, if any */ - virtual CTreeItem *dragEnd(const Point &pt) const { return nullptr; } + virtual CGameObject *dragEnd(const Point &pt) const { return nullptr; } virtual void proc16(); -- cgit v1.2.3 From 54b055bcf58e8cbcf472ea6838f3ed7ecf377e37 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 11 Apr 2016 19:40:36 -0400 Subject: TITANIC: Implementing CCarry drag end handler --- engines/titanic/carry/carry.cpp | 29 ++++++++++++++++++++++++++++- engines/titanic/carry/carry.h | 5 +++++ engines/titanic/core/saveable_object.cpp | 4 ++-- engines/titanic/messages/messages.h | 8 +++++--- 4 files changed, 40 insertions(+), 6 deletions(-) diff --git a/engines/titanic/carry/carry.cpp b/engines/titanic/carry/carry.cpp index eefb13f462..dbb7189781 100644 --- a/engines/titanic/carry/carry.cpp +++ b/engines/titanic/carry/carry.cpp @@ -21,6 +21,8 @@ */ #include "titanic/carry/carry.h" +#include "titanic/messages/messages.h" +#include "titanic/npcs/character.h" namespace Titanic { @@ -118,9 +120,30 @@ bool CCarry::MouseDragMoveMsg(CMouseDragMoveMsg *msg) { bool CCarry::MouseDragEndMsg(CMouseDragEndMsg *msg) { if (msg->_dropTarget) { - // TODO + if (msg->_dropTarget->isPet()) { + dropOnPet(); + return true; + } + + CCharacter *npc = static_cast(msg->_dropTarget); + if (npc) { + CUseWithCharMsg charMsg(npc); + charMsg.execute(this, nullptr, 0); + return true; + } + + CDropObjectMsg dropMsg(this); + if (dropMsg.execute(msg->_dropTarget)) + return true; + + // Fall back on a use with other message + CUseWithOtherMsg otherMsg(msg->_dropTarget); + if (otherMsg.execute(this, nullptr, 0)) + return true; } + // TODO + return true; } @@ -160,4 +183,8 @@ bool CCarry::PassOnDragStartMsg(CPassOnDragStartMsg *msg) { return true; } +void CCarry::dropOnPet() { + warning("TODO: dropOnPet"); +} + } // End of namespace Titanic diff --git a/engines/titanic/carry/carry.h b/engines/titanic/carry/carry.h index b98a7bedea..33e3ac369d 100644 --- a/engines/titanic/carry/carry.h +++ b/engines/titanic/carry/carry.h @@ -61,6 +61,11 @@ private: int _field120; int _field124; int _field128; +protected: + /** + * Called when an item is dropped onto the PET + */ + void dropOnPet(); public: CLASSDEF CCarry(); diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 4ef6a4a766..5b0453732b 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -778,7 +778,7 @@ DEFFN(CDonNavHelmet) DEFFN(CDoorAutoSoundEvent) DEFFN(CDoorbotNeededInElevatorMsg) DEFFN(CDoorbotNeededInHomeMsg) -DEFFN(CDropobjectMsg) +DEFFN(CDropObjectMsg) DEFFN(CDropZoneGotObjectMsg) DEFFN(CDropZoneLostObjectMsg) DEFFN(CEditControlMsg) @@ -1363,7 +1363,7 @@ void CSaveableObject::initClassList() { ADDFN(CDoorAutoSoundEvent, CAutoSoundEvent); ADDFN(CDoorbotNeededInElevatorMsg, CMessage); ADDFN(CDoorbotNeededInHomeMsg, CMessage); - ADDFN(CDropobjectMsg, CMessage); + ADDFN(CDropObjectMsg, CMessage); ADDFN(CDropZoneGotObjectMsg, CMessage); ADDFN(CDropZoneLostObjectMsg, CMessage); ADDFN(CEditControlMsg, CMessage); diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index e74c26fd97..474565a69c 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -79,6 +79,8 @@ enum MessageFlag { return supports(item, _type); } \ } +class CCarry; +class CCharacter; class CGameObject; class CRoomItem; class CNodeItem; @@ -267,7 +269,7 @@ MESSAGE0(CDoffNavHelmet); MESSAGE0(CDonNavHelmet); MESSAGE1(CDoorbotNeededInElevatorMsg, int, value, 0); MESSAGE0(CDoorbotNeededInHomeMsg); -MESSAGE1(CDropobjectMsg, int, value, 0); +MESSAGE1(CDropObjectMsg, CCarry *, item, nullptr); MESSAGE1(CDropZoneGotObjectMsg, int, value, 0); MESSAGE1(CDropZoneLostObjectMsg, int, value, 0); MESSAGE1(CEjectCylinderMsg, int, value, 0); @@ -389,8 +391,8 @@ MESSAGE3(CTrueTalkTriggerActionMsg, int, value1, 0, int, value2, 0, int, value3, MESSAGE0(CTurnOff); MESSAGE0(CTurnOn); MESSAGE1(CUse, int, value, 0); -MESSAGE1(CUseWithCharMsg, int, value, 0); -MESSAGE1(CUseWithOtherMsg, int, value, 0); +MESSAGE1(CUseWithCharMsg, CCharacter *, character, nullptr); +MESSAGE1(CUseWithOtherMsg, CGameObject *, other, 0); MESSAGE1(CVirtualKeyCharMsg, Common::KeyState, keyState, Common::KeyState()); MESSAGE1(CVisibleMsg, bool, visible, true); -- cgit v1.2.3 From 7ac4f7c3aa26831f771418472472735cf73bade9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 11 Apr 2016 20:08:49 -0400 Subject: TITANIC: Implementing CComputerScreen messages --- engines/titanic/core/game_object.cpp | 8 +++++++ engines/titanic/core/game_object.h | 5 +++++ engines/titanic/game/cdrom.cpp | 1 + engines/titanic/game/computer_screen.cpp | 38 ++++++++++++++++++++++++++++++++ engines/titanic/game/computer_screen.h | 5 +++++ 5 files changed, 57 insertions(+) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index c179ed8b50..7e731bdbe7 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -459,6 +459,14 @@ bool CGameObject::playSound(const CString &name, CProximity &prox) { return false; } +int CGameObject::addTimer(int endVal, uint firstDuration, uint duration) { + CTimeEventInfo *timer = new CTimeEventInfo(g_vm->_events->getTicksCount(), + duration != 0, firstDuration, duration, this, endVal, CString()); + + getGameManager()->addTimer(timer); + return timer->_id; +} + void CGameObject::gotoView(const CString &viewName, const CString &clipName) { CViewItem *newView = parseView(viewName); CGameManager *gameManager = getGameManager(); diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index a8d8513587..bc1020d03f 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -140,6 +140,11 @@ protected: * Plays a sound */ bool playSound(const CString &name, CProximity &prox); + + /** + * Adds a timer + */ + int addTimer(int endVal, uint firstDuration, uint duration); public: int _field60; CursorId _cursorId; diff --git a/engines/titanic/game/cdrom.cpp b/engines/titanic/game/cdrom.cpp index 0d89319a86..0fd7eb5dbd 100644 --- a/engines/titanic/game/cdrom.cpp +++ b/engines/titanic/game/cdrom.cpp @@ -65,6 +65,7 @@ bool CCDROM::MouseDragEndMsg(CMouseDragEndMsg *msg) { if (newTray->_state && newTray->_insertedCD == "None") { CActMsg actMsg(getName()); actMsg.execute(newTray); + setVisible(false); } } diff --git a/engines/titanic/game/computer_screen.cpp b/engines/titanic/game/computer_screen.cpp index 04de5e50d8..f0fab26b61 100644 --- a/engines/titanic/game/computer_screen.cpp +++ b/engines/titanic/game/computer_screen.cpp @@ -24,6 +24,13 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CComputerScreen, CGameObject) + ON_MESSAGE(ActMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(TimerMsg) +END_MESSAGE_MAP() + CComputerScreen::CComputerScreen() : CGameObject() { } @@ -37,4 +44,35 @@ void CComputerScreen::load(SimpleFile *file) { CGameObject::load(file); } +bool CComputerScreen::ActMsg(CActMsg *msg) { + if (msg->_action == "newCD1" || msg->_action == "newCD2") { + playMovie(27, 53, 16); + playMovie(19, 26, 16); + } else if (msg->_action == "newSTCD") { + playMovie(0, 18, 20); + } + + return true; +} + +bool CComputerScreen::MovieEndMsg(CMovieEndMsg *msg) { + playSound("z#47.wav", 100, 0, 0); + addTimer(0, 3000, 0); + + for (int idx = 0; idx < 10; ++idx) + playMovie(0, 18, 0); + return true; +} + +bool CComputerScreen::EnterViewMsg(CEnterViewMsg *msg) { + loadFrame(26); + return true; +} + +bool CComputerScreen::TimerMsg(CTimerMsg *msg) { + // TODO + warning("TODO: CComputerScreen::TimerMsg"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/computer_screen.h b/engines/titanic/game/computer_screen.h index aa47482207..fa02ef5e1a 100644 --- a/engines/titanic/game/computer_screen.h +++ b/engines/titanic/game/computer_screen.h @@ -28,6 +28,11 @@ namespace Titanic { class CComputerScreen : public CGameObject { + DECLARE_MESSAGE_MAP + bool ActMsg(CActMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool TimerMsg(CTimerMsg *msg); public: CLASSDEF CComputerScreen(); -- cgit v1.2.3 From 36d60d7476b62aef07914325adb6f9fd7b30132f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 11 Apr 2016 22:59:58 -0400 Subject: TITANIC: Added remainder of CCarry msg handlers --- engines/titanic/carry/carry.cpp | 84 +++++++++++++++++++++++++------ engines/titanic/carry/carry.h | 12 ++--- engines/titanic/core/game_object.cpp | 20 +++++++- engines/titanic/core/game_object.h | 17 ++++++- engines/titanic/events.cpp | 8 +++ engines/titanic/events.h | 5 ++ engines/titanic/game_state.cpp | 4 -- engines/titanic/game_state.h | 7 ++- engines/titanic/messages/messages.h | 14 +----- engines/titanic/messages/mouse_messages.h | 5 +- 10 files changed, 134 insertions(+), 42 deletions(-) diff --git a/engines/titanic/carry/carry.cpp b/engines/titanic/carry/carry.cpp index dbb7189781..cc12fd1a72 100644 --- a/engines/titanic/carry/carry.cpp +++ b/engines/titanic/carry/carry.cpp @@ -23,6 +23,7 @@ #include "titanic/carry/carry.h" #include "titanic/messages/messages.h" #include "titanic/npcs/character.h" +#include "titanic/npcs/succubus.h" namespace Titanic { @@ -43,9 +44,9 @@ END_MESSAGE_MAP() CCarry::CCarry() : CGameObject(), _fieldDC(0), _fieldE0(1), _field100(0), _field104(0), _field108(0), _field10C(0), - _field110(0), _field120(0), _field124(0), _field128(0), + _itemFrame(0), _enterFrame(0), _enterFrameSet(false), _visibleFrame(0), _string1("None"), - _string2("NULL"), + _fullViewName("NULL"), _string3("That doesn't seem to do anything."), _string4("It doesn't seem to want this.") { } @@ -53,8 +54,8 @@ CCarry::CCarry() : CGameObject(), _fieldDC(0), _fieldE0(1), void CCarry::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); file->writeQuotedLine(_string1, indent); - file->writePoint(_pos1, indent); - file->writeQuotedLine(_string2, indent); + file->writePoint(_origPos, indent); + file->writeQuotedLine(_fullViewName, indent); file->writeNumberLine(_fieldDC, indent); file->writeNumberLine(_fieldE0, indent); file->writeQuotedLine(_string3, indent); @@ -63,11 +64,11 @@ void CCarry::save(SimpleFile *file, int indent) const { file->writeNumberLine(_field104, indent); file->writeNumberLine(_field108, indent); file->writeNumberLine(_field10C, indent); - file->writeNumberLine(_field110, indent); + file->writeNumberLine(_itemFrame, indent); file->writeQuotedLine(_string5, indent); - file->writeNumberLine(_field120, indent); - file->writeNumberLine(_field124, indent); - file->writeNumberLine(_field128, indent); + file->writeNumberLine(_enterFrame, indent); + file->writeNumberLine(_enterFrameSet, indent); + file->writeNumberLine(_visibleFrame, indent); CGameObject::save(file, indent); } @@ -75,8 +76,8 @@ void CCarry::save(SimpleFile *file, int indent) const { void CCarry::load(SimpleFile *file) { file->readNumber(); _string1 = file->readString(); - _pos1 = file->readPoint(); - _string2 = file->readString(); + _origPos = file->readPoint(); + _fullViewName = file->readString(); _fieldDC = file->readNumber(); _fieldE0 = file->readNumber(); _string3 = file->readString(); @@ -85,11 +86,11 @@ void CCarry::load(SimpleFile *file) { _field104 = file->readNumber(); _field108 = file->readNumber(); _field10C = file->readNumber(); - _field110 = file->readNumber(); + _itemFrame = file->readNumber(); _string5 = file->readString(); - _field120 = file->readNumber(); - _field124 = file->readNumber(); - _field128 = file->readNumber(); + _enterFrame = file->readNumber(); + _enterFrameSet = file->readNumber(); + _visibleFrame = file->readNumber(); CGameObject::load(file); } @@ -142,12 +143,30 @@ bool CCarry::MouseDragEndMsg(CMouseDragEndMsg *msg) { return true; } - // TODO + CString viewName = getViewFullName(); + if (viewName.empty() || msg->_mousePos.y >= 360) { + sleep(250); + dropOnPet(); + } else { + setPosition(_origPos); + loadFrame(_itemFrame); + } return true; } bool CCarry::UseWithCharMsg(CUseWithCharMsg *msg) { + CSuccUBus *succubus = static_cast(msg->_character); + if (succubus) { + CSubAcceptCCarryMsg carryMsg; + carryMsg._item = this; + carryMsg.execute(succubus); + } else { + CShowTextMsg textMsg(_string4); + textMsg.execute("PET"); + dropOnPet(); + } + return true; } @@ -156,10 +175,25 @@ bool CCarry::LeaveViewMsg(CLeaveViewMsg *msg) { } bool CCarry::UseWithOtherMsg(CUseWithOtherMsg *msg) { + CShowTextMsg textMsg(_string3); + textMsg.execute("PET"); + + _fullViewName = getViewFullName(); + if (_fullViewName.empty() || _bounds.top >= 360) { + sleep(250); + dropOnPet(); + } else { + setPosition(_origPos); + } + return true; } bool CCarry::VisibleMsg(CVisibleMsg *msg) { + setVisible(msg->_visible); + if (msg->_visible && _visibleFrame != -1) + loadFrame(_visibleFrame); + return true; } @@ -168,18 +202,38 @@ bool CCarry::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { } bool CCarry::RemoveFromGameMsg(CRemoveFromGameMsg *msg) { + setPosition(Point(0, 0)); + setVisible(false); + return true; } bool CCarry::MoveToStartPosMsg(CMoveToStartPosMsg *msg) { + setPosition(_origPos); return true; } bool CCarry::EnterViewMsg(CEnterViewMsg *msg) { + if (!_enterFrameSet) { + loadFrame(_enterFrame); + _enterFrameSet = true; + } + return true; } bool CCarry::PassOnDragStartMsg(CPassOnDragStartMsg *msg) { + if (_visibleFrame != -1) + loadFrame(_visibleFrame); + + if (msg->_value3) { + _tempPos.x = _bounds.width() / 2; + _tempPos.y = _bounds.height() / 2; + } else { + _tempPos = msg->_mousePos - _bounds; + } + + setPosition(_tempPos - getMousePos()); return true; } diff --git a/engines/titanic/carry/carry.h b/engines/titanic/carry/carry.h index 33e3ac369d..e292eb2897 100644 --- a/engines/titanic/carry/carry.h +++ b/engines/titanic/carry/carry.h @@ -45,8 +45,8 @@ class CCarry : public CGameObject { bool PassOnDragStartMsg(CPassOnDragStartMsg *msg); private: CString _string1; - Point _pos1; - CString _string2; + Point _origPos; + CString _fullViewName; int _fieldDC; int _fieldE0; CString _string3; @@ -56,11 +56,11 @@ private: int _field104; int _field108; int _field10C; - int _field110; + int _itemFrame; CString _string5; - int _field120; - int _field124; - int _field128; + int _enterFrame; + bool _enterFrameSet; + int _visibleFrame; protected: /** * Called when an item is dropped onto the PET diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 7e731bdbe7..0bd246d529 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -405,7 +405,7 @@ void CGameObject::resetPosition() { setPosition(_savedPos); } -void CGameObject::setPosition(const Common::Point &newPos) { +void CGameObject::setPosition(const Point &newPos) { makeDirty(); _bounds.moveTo(newPos); makeDirty(); @@ -540,4 +540,22 @@ CViewItem *CGameObject::parseView(const CString &viewString) { return view; } +CString CGameObject::getViewFullName() const { + CGameManager *gameManager = getGameManager(); + CViewItem *view = gameManager->getView(); + CNodeItem *node = view->findNode(); + CRoomItem *room = node->findRoom(); + + return CString::format("%s.%s.%s", room->getName().c_str(), + node->getName().c_str(), view->getName().c_str()); +} + +void CGameObject::sleep(uint milli) { + g_vm->_events->sleep(milli); +} + +Point CGameObject::getMousePos() const { + return getGameManager()->_gameState.getMousePos(); +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index bc1020d03f..9e84a453c7 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -145,6 +145,16 @@ protected: * Adds a timer */ int addTimer(int endVal, uint firstDuration, uint duration); + + /** + * Causes the game to sleep for the specified time + */ + void sleep(uint milli); + + /** + * Get the current mouse cursor position + */ + Point getMousePos() const; public: int _field60; CursorId _cursorId; @@ -191,7 +201,7 @@ public: /** * Set the position of the object */ - void setPosition(const Common::Point &newPos); + void setPosition(const Point &newPos); /** * Returns true if the object has a currently active movie @@ -215,6 +225,11 @@ public: * Play the movie specified in _resource */ void playMovie(uint startFrame, uint endFrame, int val3); + + /** + * Return the current view/node/room as a single string + */ + CString getViewFullName() const; }; } // End of namespace Titanic diff --git a/engines/titanic/events.cpp b/engines/titanic/events.cpp index 480cc91578..590107336c 100644 --- a/engines/titanic/events.cpp +++ b/engines/titanic/events.cpp @@ -227,4 +227,12 @@ void Events::handleKbdSpecial(Common::KeyState keyState) { _specialButtons &= ~MK_SHIFT; } +void Events::sleep(uint time) { + uint32 delayEnd = g_system->getMillis() + time; + + while (!_vm->shouldQuit() && g_system->getMillis() < delayEnd) { + pollEventsAndWait(); + } +} + } // End of namespace Titanic diff --git a/engines/titanic/events.h b/engines/titanic/events.h index f85a3d9272..4cbba178ad 100644 --- a/engines/titanic/events.h +++ b/engines/titanic/events.h @@ -103,6 +103,11 @@ public: * Return whether a given special key is currently pressed */ bool isSpecialPressed(SpecialButtons btn) const { return _specialButtons; } + + /** + * Sleep for a specified period of time + */ + void sleep(uint time); }; } // End of namespace Titanic diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index fab7d1165b..7c59aaf5c1 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -96,10 +96,6 @@ void CGameState::setMode(GameStateMode newMode) { _mode = newMode; } -void CGameState::setMousePos(const Point &pt) { - _mousePos = pt; -} - void CGameState::enterNode() { ++_nodeChangeCtr; _nodeEnterTicks = g_vm->_events->getTicksCount(); diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h index 5d4b686bf4..0fe8e6ad14 100644 --- a/engines/titanic/game_state.h +++ b/engines/titanic/game_state.h @@ -87,7 +87,12 @@ public: /** * Sets the current mouse position */ - void setMousePos(const Point &pt); + void setMousePos(const Point &pt) { _mousePos = pt; } + + /** + * Gets the current mouse position + */ + Point getMousePos() const { return _mousePos; } /** * Called by the PET when a new node is entered diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 474565a69c..ab3078dd56 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -198,19 +198,6 @@ public: } }; -class CSubAcceptCCarryMsg : public CMessage { -public: - CString _string1; - int _value1, _value2, _value3; -public: - CLASSDEF - CSubAcceptCCarryMsg() : _value1(0), _value2(0), _value3(0) {} - - static bool isSupportedBy(const CTreeItem *item) { - return supports(item, _type); - } -}; - class CTransportMsg : public CMessage { public: CString _string; @@ -366,6 +353,7 @@ MESSAGE2(CSpeechFallsFromTreeMsg, int, value1, 0, int, value2, 0); MESSAGE1(CStartMusicMsg, int, value, 0); MESSAGE3(CStatusChangeMsg, int, oldStatus, 0, int, newStatus, 0, bool, success, false); MESSAGE1(CStopMusicMsg, int, value, 0); +MESSAGE4(CSubAcceptCCarryMsg, CString, string1, "", int, value1, 0, int, value2, 0, CCarry *, item, nullptr); MESSAGE0(CSubDeliverCCarryMsg); MESSAGE0(CSubSendCCarryMsg); MESSAGE0(CSUBTransition); diff --git a/engines/titanic/messages/mouse_messages.h b/engines/titanic/messages/mouse_messages.h index 705247a2dc..ce02e1df73 100644 --- a/engines/titanic/messages/mouse_messages.h +++ b/engines/titanic/messages/mouse_messages.h @@ -142,10 +142,13 @@ public: class CPassOnDragStartMsg : public CMessage { public: Point _mousePos; + int _value3; + int _value4; public: CLASSDEF CPassOnDragStartMsg() : CMessage() {} - CPassOnDragStartMsg(const Point &pt) : CMessage(), _mousePos(pt) {} + CPassOnDragStartMsg(const Point &pt, int v3 = 0, int v4 = 0) : + CMessage(), _mousePos(pt), _value3(v3), _value4(v4) {} static bool isSupportedBy(const CTreeItem *item) { return supports(item, _type); -- cgit v1.2.3 From c096bfa5d89f43e68fffbe390e73bad08e4f1745 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 13 Apr 2016 13:24:41 -0400 Subject: TITANIC: Implementing CArm message handlers --- engines/titanic/carry/arm.cpp | 96 ++++++++++++++++++++++++++++---- engines/titanic/carry/arm.h | 16 ++++-- engines/titanic/carry/carry.cpp | 4 +- engines/titanic/carry/carry.h | 12 ++-- engines/titanic/core/game_object.cpp | 4 ++ engines/titanic/core/game_object.h | 12 +++- engines/titanic/core/saveable_object.cpp | 2 + engines/titanic/messages/messages.h | 1 + 8 files changed, 125 insertions(+), 22 deletions(-) diff --git a/engines/titanic/carry/arm.cpp b/engines/titanic/carry/arm.cpp index fdf73e93f3..f2c7d5233f 100644 --- a/engines/titanic/carry/arm.cpp +++ b/engines/titanic/carry/arm.cpp @@ -24,10 +24,20 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CArm, CCarry) + ON_MESSAGE(PuzzleSolvedMsg) + ON_MESSAGE(TranslateObjectMsg) + ON_MESSAGE(UseWithOtherMsg) + ON_MESSAGE(MouseDragStartMsg) + ON_MESSAGE(MaitreDHappyMsg) + ON_MESSAGE(PETGainedObjectMsg) + ON_MESSAGE(MouseDragMoveMsg) +END_MESSAGE_MAP() + CArm::CArm() : CCarry(), _string6("Key"), _field138(0), _field13C(0), _field140(0), _field144(0), - _field148(0), _field158(0), _field15C(220), _field160(208), - _field164(409), _field168(350), _field16C(3), _field170(0) { + _field148(0), _field158(0), _armRect(220, 208, 409, 350), + _field16C(3), _field170(0) { } void CArm::save(SimpleFile *file, int indent) const { @@ -41,10 +51,10 @@ void CArm::save(SimpleFile *file, int indent) const { file->writeQuotedLine(_string7, indent); file->writeNumberLine(_field158, indent); - file->writeNumberLine(_field15C, indent); - file->writeNumberLine(_field160, indent); - file->writeNumberLine(_field164, indent); - file->writeNumberLine(_field168, indent); + file->writeNumberLine(_armRect.left, indent); + file->writeNumberLine(_armRect.top, indent); + file->writeNumberLine(_armRect.right, indent); + file->writeNumberLine(_armRect.bottom, indent); file->writeNumberLine(_field16C, indent); file->writeNumberLine(_field170, indent); @@ -62,14 +72,80 @@ void CArm::load(SimpleFile *file) { _string7 = file->readString(); _field158 = file->readNumber(); - _field15C = file->readNumber(); - _field160 = file->readNumber(); - _field164 = file->readNumber(); - _field168 = file->readNumber(); + _armRect.left = file->readNumber(); + _armRect.top = file->readNumber(); + _armRect.right = file->readNumber(); + _armRect.bottom = file->readNumber(); _field16C = file->readNumber(); _field170 = file->readNumber(); CCarry::load(file); } +bool CArm::PuzzleSolvedMsg(CPuzzleSolvedMsg *msg) { + _field138 = 0; + _fieldE0 = 1; + + CString name = getName(); + if (name == "Arm1") { + CActMsg actMsg("LoseArm"); + actMsg.execute("MaitreD"); + CPuzzleSolvedMsg solvedMsg; + solvedMsg.execute("AuditoryCentre"); + } else if (name == "Arm2") { + CPuzzleSolvedMsg solvedMsg; + solvedMsg.execute("Key"); + } + + return true; +} + +bool CArm::TranslateObjectMsg(CTranslateObjectMsg *msg) { + Point newPos(_bounds.left - msg->_delta.x, _bounds.top - msg->_delta.y); + setPosition(newPos); + return true; +} + +bool CArm::UseWithOtherMsg(CUseWithOtherMsg *msg) { + return true; +} + +bool CArm::MouseDragStartMsg(CMouseDragStartMsg *msg) { + return true; +} + +bool CArm::MaitreDHappyMsg(CMaitreDHappyMsg *msg) { + // TODO + return true; +} + +bool CArm::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { + if (_field158) { + if (_string6 == "Key" || _string6 == "AuditoryCentre") { + CCarry *child = static_cast(getFirstChild()); + if (child) { + _visibleFrame = _field170; + loadFrame(_visibleFrame); + child->setVisible(true); + child->dropOnPet(); + } + + _string6 = "None"; + } + } + + return true; +} + +bool CArm::MouseDragMoveMsg(CMouseDragMoveMsg *msg) { + setPosition(msg->_mousePos - _tempPos); + + if (_string6 != "None" && compareViewNameTo("FrozenArboretum.Node 5.S")) { + loadFrame(_armRect.contains(msg->_mousePos) ? + _field16C : _visibleFrame); + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/carry/arm.h b/engines/titanic/carry/arm.h index 1f93009d04..60f597e71f 100644 --- a/engines/titanic/carry/arm.h +++ b/engines/titanic/carry/arm.h @@ -24,10 +24,21 @@ #define TITANIC_ARM_H #include "titanic/carry/carry.h" +#include "titanic/messages/messages.h" +#include "titanic/messages/mouse_messages.h" +#include "titanic/messages/pet_messages.h" namespace Titanic { class CArm : public CCarry { + DECLARE_MESSAGE_MAP + bool PuzzleSolvedMsg(CPuzzleSolvedMsg *msg); + bool TranslateObjectMsg(CTranslateObjectMsg *msg); + bool UseWithOtherMsg(CUseWithOtherMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); + bool MaitreDHappyMsg(CMaitreDHappyMsg *msg); + bool PETGainedObjectMsg(CPETGainedObjectMsg *msg); + bool MouseDragMoveMsg(CMouseDragMoveMsg *msg); private: CString _string6; int _field138; @@ -37,10 +48,7 @@ private: int _field148; CString _string7; int _field158; - int _field15C; - int _field160; - int _field164; - int _field168; + Rect _armRect; int _field16C; int _field170; public: diff --git a/engines/titanic/carry/carry.cpp b/engines/titanic/carry/carry.cpp index cc12fd1a72..9968c523ee 100644 --- a/engines/titanic/carry/carry.cpp +++ b/engines/titanic/carry/carry.cpp @@ -43,8 +43,8 @@ BEGIN_MESSAGE_MAP(CCarry, CGameObject) END_MESSAGE_MAP() CCarry::CCarry() : CGameObject(), _fieldDC(0), _fieldE0(1), - _field100(0), _field104(0), _field108(0), _field10C(0), - _itemFrame(0), _enterFrame(0), _enterFrameSet(false), _visibleFrame(0), + _field100(0), _field104(0), _field108(0), _field10C(0), + _itemFrame(0), _enterFrame(0), _enterFrameSet(false), _visibleFrame(0), _string1("None"), _fullViewName("NULL"), _string3("That doesn't seem to do anything."), diff --git a/engines/titanic/carry/carry.h b/engines/titanic/carry/carry.h index e292eb2897..b14ba05934 100644 --- a/engines/titanic/carry/carry.h +++ b/engines/titanic/carry/carry.h @@ -43,7 +43,7 @@ class CCarry : public CGameObject { bool MoveToStartPosMsg(CMoveToStartPosMsg *msg); bool EnterViewMsg(CEnterViewMsg *msg); bool PassOnDragStartMsg(CPassOnDragStartMsg *msg); -private: +protected: CString _string1; Point _origPos; CString _fullViewName; @@ -62,10 +62,7 @@ private: bool _enterFrameSet; int _visibleFrame; protected: - /** - * Called when an item is dropped onto the PET - */ - void dropOnPet(); + public: CLASSDEF CCarry(); @@ -79,6 +76,11 @@ public: * Load the data for the class from file */ virtual void load(SimpleFile *file); + + /** + * Called to drop an item into the PET + */ + void dropOnPet(); }; } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 0bd246d529..4628ccccf2 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -558,4 +558,8 @@ Point CGameObject::getMousePos() const { return getGameManager()->_gameState.getMousePos(); } +bool CGameObject::compareViewNameTo(const CString &name) const { + return getViewFullName().compareToIgnoreCase(name); +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 9e84a453c7..658c8449fb 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -127,7 +127,6 @@ protected: bool soundFn1(int val); void soundFn2(int val, int val2); - void setVisible(bool val); void petFn2(int val); void petFn3(CTreeItem *item); @@ -155,6 +154,12 @@ protected: * Get the current mouse cursor position */ Point getMousePos() const; + + /* + * Compares the current view's name in a Room.Node.View tuplet + * string form to the passed string + */ + bool compareViewNameTo(const CString &name) const; public: int _field60; CursorId _cursorId; @@ -230,6 +235,11 @@ public: * Return the current view/node/room as a single string */ CString getViewFullName() const; + + /** + * Sets whether the object is visible + */ + void setVisible(bool val); }; } // End of namespace Titanic diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 5b0453732b..2eacbba4a0 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -925,6 +925,7 @@ DEFFN(CTimeMsg) DEFFN(CTimerMsg) DEFFN(CTitleSequenceEndedMsg) DEFFN(CTransitMsg) +DEFFN(CTranslateObjectMsg) DEFFN(CTransportMsg) DEFFN(CTriggerAutoMusicPlayerMsg) DEFFN(CTriggerNPCEvent) @@ -1510,6 +1511,7 @@ void CSaveableObject::initClassList() { ADDFN(CTimerMsg, CTimeMsg); ADDFN(CTitleSequenceEndedMsg, CMessage); ADDFN(CTransitMsg, CMessage); + ADDFN(CTranslateObjectMsg, CMessage); ADDFN(CTransportMsg, CMessage); ADDFN(CTriggerAutoMusicPlayerMsg, CMessage); ADDFN(CTriggerNPCEvent, CMessage); diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index ab3078dd56..6d0df5ba90 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -366,6 +366,7 @@ MESSAGE2(CTextInputMsg, CString, value1, "", CString, value2, ""); MESSAGE1(CTimeDilationMsg, int, value, 0); MESSAGE0(CTitleSequenceEndedMsg); MESSAGE0(CTransitMsg); +MESSAGE1(CTranslateObjectMsg, Point, delta, Point()); MESSAGE1(CTriggerAutoMusicPlayerMsg, int, value, 0); MESSAGE1(CTriggerNPCEvent, int, value, 0); MESSAGE4(CTrueTalkGetAnimSetMsg, int, value1, 0, int, value2, 0, int, value3, 0, int, value4, 0); -- cgit v1.2.3 From 5cd3dd0d69dead3ca795468716353f9d7d4da7a8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 13 Apr 2016 17:37:14 -0400 Subject: TITANIC: Adding CCarry descendent msg handlers --- engines/titanic/carry/phonograph_cylinder.cpp | 35 ++++++++++++++++++++ engines/titanic/carry/phonograph_cylinder.h | 6 ++++ engines/titanic/carry/photograph.cpp | 47 +++++++++++++++++++++++++++ engines/titanic/carry/photograph.h | 8 +++++ engines/titanic/carry/plug_in.cpp | 28 ++++++++++++++++ engines/titanic/carry/plug_in.h | 2 ++ engines/titanic/carry/sweets.cpp | 8 +++++ engines/titanic/carry/sweets.h | 3 ++ 8 files changed, 137 insertions(+) diff --git a/engines/titanic/carry/phonograph_cylinder.cpp b/engines/titanic/carry/phonograph_cylinder.cpp index fb58c3214f..18e646d2bb 100644 --- a/engines/titanic/carry/phonograph_cylinder.cpp +++ b/engines/titanic/carry/phonograph_cylinder.cpp @@ -21,9 +21,18 @@ */ #include "titanic/carry/phonograph_cylinder.h" +#include "titanic/game/phonograph.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CPhonographCylinder, CCarry) + ON_MESSAGE(UseWithOtherMsg) + ON_MESSAGE(QueryCylinderMsg) + ON_MESSAGE(RecordOntoCylinderMsg) + ON_MESSAGE(SetMusicControlsMsg) + ON_MESSAGE(ErasePhonographCylinderMsg) +END_MESSAGE_MAP() + CPhonographCylinder::CPhonographCylinder() : CCarry(), _field138(0), _field13C(0), _field140(0), _field144(0), _field148(0), _field14C(0), _field150(0), _field154(0), @@ -86,4 +95,30 @@ void CPhonographCylinder::load(SimpleFile *file) { CCarry::load(file); } +bool CPhonographCylinder::UseWithOtherMsg(CUseWithOtherMsg *msg) { + CPhonograph *phonograph = static_cast(msg->_other); + if (phonograph) { + CSetVarMsg varMsg("m_RecordStatus", 1); + return true; + } else { + return CCarry::UseWithOtherMsg(msg); + } +} + +bool CPhonographCylinder::QueryCylinderMsg(CQueryCylinderMsg *msg) { + msg->_ +} + +bool CPhonographCylinder::RecordOntoCylinderMsg(CRecordOntoCylinderMsg *msg) { + +} + +bool CPhonographCylinder::SetMusicControlsMsg(CSetMusicControlsMsg *msg) { + +} + +bool CPhonographCylinder::ErasePhonographCylinderMsg(CErasePhonographCylinderMsg *msg) { + +} + } // End of namespace Titanic diff --git a/engines/titanic/carry/phonograph_cylinder.h b/engines/titanic/carry/phonograph_cylinder.h index 271ede54b0..08db4b214a 100644 --- a/engines/titanic/carry/phonograph_cylinder.h +++ b/engines/titanic/carry/phonograph_cylinder.h @@ -28,6 +28,12 @@ namespace Titanic { class CPhonographCylinder : public CCarry { + DECLARE_MESSAGE_MAP + bool UseWithOtherMsg(CUseWithOtherMsg *msg); + bool QueryCylinderMsg(CQueryCylinderMsg *msg); + bool RecordOntoCylinderMsg(CRecordOntoCylinderMsg *msg); + bool SetMusicControlsMsg(CSetMusicControlsMsg *msg); + bool ErasePhonographCylinderMsg(CErasePhonographCylinderMsg *msg); private: CString _string6; int _field138; diff --git a/engines/titanic/carry/photograph.cpp b/engines/titanic/carry/photograph.cpp index 92549b3ce5..a7c5d8d095 100644 --- a/engines/titanic/carry/photograph.cpp +++ b/engines/titanic/carry/photograph.cpp @@ -21,9 +21,17 @@ */ #include "titanic/carry/photograph.h" +#include "titanic/core/room_item.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CPhotograph, CCarry) + ON_MESSAGE(MouseDragStartMsg) + ON_MESSAGE(MouseDragEndMsg) + ON_MESSAGE(PETGainedObjectMsg) + ON_MESSAGE(ActMsg) +END_MESSAGE_MAP() + int CPhotograph::_v1; CPhotograph::CPhotograph() : CCarry(), _field12C(0), _field130(0) { @@ -47,4 +55,43 @@ void CPhotograph::load(SimpleFile *file) { CCarry::load(file); } +bool CPhotograph::MouseDragEndMsg(CMouseDragEndMsg *msg) { + _v1 = 0; + CGameObject *target = msg->_dropTarget; + + if (target && target->getName() != "NavigationComputer") { + warning("TODO: CPhotograph::MouseDragEndMsg"); + } else { + return CCarry::MouseDragEndMsg(msg); + } +} + +bool CPhotograph::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (checkPoint(msg->_mousePos, true, true)) { + _v1 = true; + CActMsg actMsg("PlayerPicksUpPhoto"); + actMsg.execute("Doorbot"); + } + + return CCarry::MouseDragStartMsg(msg); +} + +bool CPhotograph::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { + if (getRoom()->getName() == "Home") { + CActMsg actMsg("PlayerPutsPhotoInPET"); + actMsg.execute("Doorbot"); + } + + return true; +} + +bool CPhotograph::ActMsg(CActMsg *msg) { + if (msg->_action == "BecomeGettable") { + _fieldE0 = 1; + _cursorId = CURSOR_HAND; + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/carry/photograph.h b/engines/titanic/carry/photograph.h index 4141280a6b..b7ce488d09 100644 --- a/engines/titanic/carry/photograph.h +++ b/engines/titanic/carry/photograph.h @@ -24,10 +24,18 @@ #define TITANIC_PHOTOGRAPH_H #include "titanic/carry/carry.h" +#include "titanic/messages/messages.h" +#include "titanic/messages/mouse_messages.h" +#include "titanic/messages/pet_messages.h" namespace Titanic { class CPhotograph : public CCarry { + DECLARE_MESSAGE_MAP + bool MouseDragEndMsg(CMouseDragEndMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); + bool PETGainedObjectMsg(CPETGainedObjectMsg *msg); + bool ActMsg(CActMsg *msg); private: static int _v1; private: diff --git a/engines/titanic/carry/plug_in.cpp b/engines/titanic/carry/plug_in.cpp index ff8d9b158f..e4fe54dd27 100644 --- a/engines/titanic/carry/plug_in.cpp +++ b/engines/titanic/carry/plug_in.cpp @@ -24,6 +24,10 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CPlugIn, CCarry) + ON_MESSAGE(UseWithOtherMsg) +END_MESSAGE_MAP() + CPlugIn::CPlugIn() : CCarry(), _field12C(0) { } @@ -37,4 +41,28 @@ void CPlugIn::load(SimpleFile *file) { CCarry::load(file); } +bool CPlugIn::UseWithOtherMsg(CUseWithOtherMsg *msg) { + CGameObject *other = msg->_other; + CString otherName = other->getName(); + + if (otherName == "PET") { + return CCarry::UseWithOtherMsg(msg); + } else if (otherName == "DatasideTransporter") { + CString name = getName(); + if (name == "DatasideTransporter") { + // TODO + if (name != "SendYourself") { + // TODO + } + } else { + // TODO + } + } else { + CShowTextMsg textMsg("This item is incorrectly calibrated."); + textMsg.execute("PET"); + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/carry/plug_in.h b/engines/titanic/carry/plug_in.h index 89a483278d..f48a74bd2b 100644 --- a/engines/titanic/carry/plug_in.h +++ b/engines/titanic/carry/plug_in.h @@ -28,6 +28,8 @@ namespace Titanic { class CPlugIn : public CCarry { + DECLARE_MESSAGE_MAP + bool UseWithOtherMsg(CUseWithOtherMsg *msg); private: int _field12C; public: diff --git a/engines/titanic/carry/sweets.cpp b/engines/titanic/carry/sweets.cpp index faf3ad9dea..71295a3441 100644 --- a/engines/titanic/carry/sweets.cpp +++ b/engines/titanic/carry/sweets.cpp @@ -24,6 +24,10 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CSweets, CCarry) + ON_MESSAGE(MouseButtonUpMsg) +END_MESSAGE_MAP() + CSweets::CSweets() : CCarry() { } @@ -37,4 +41,8 @@ void CSweets::load(SimpleFile *file) { CCarry::load(file); } +bool CSweets::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/carry/sweets.h b/engines/titanic/carry/sweets.h index a18a1fbeeb..7fc0787f76 100644 --- a/engines/titanic/carry/sweets.h +++ b/engines/titanic/carry/sweets.h @@ -24,10 +24,13 @@ #define TITANIC_SWEETS_H #include "titanic/carry/carry.h" +#include "titanic/messages/mouse_messages.h" namespace Titanic { class CSweets : public CCarry { + DECLARE_MESSAGE_MAP + bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); public: CLASSDEF CSweets(); -- cgit v1.2.3 From fdbb1868e4838248cc69302046c04700635beb55 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 13 Apr 2016 20:40:40 -0400 Subject: TITANIC: Implemented CPhonographCylinder msg handlers --- engines/titanic/carry/phonograph_cylinder.cpp | 152 +++++++++++++++++--------- engines/titanic/carry/phonograph_cylinder.h | 42 +++---- engines/titanic/carry/photograph.cpp | 1 + engines/titanic/core/tree_item.cpp | 5 + engines/titanic/core/tree_item.h | 6 + engines/titanic/messages/messages.h | 4 +- 6 files changed, 137 insertions(+), 73 deletions(-) diff --git a/engines/titanic/carry/phonograph_cylinder.cpp b/engines/titanic/carry/phonograph_cylinder.cpp index 18e646d2bb..e2a7a99927 100644 --- a/engines/titanic/carry/phonograph_cylinder.cpp +++ b/engines/titanic/carry/phonograph_cylinder.cpp @@ -34,63 +34,66 @@ BEGIN_MESSAGE_MAP(CPhonographCylinder, CCarry) END_MESSAGE_MAP() CPhonographCylinder::CPhonographCylinder() : CCarry(), - _field138(0), _field13C(0), _field140(0), _field144(0), - _field148(0), _field14C(0), _field150(0), _field154(0), - _field158(0), _field15C(0), _field160(0), _field164(0), - _field168(0), _field16C(0), _field170(0), _field174(0), - _field178(0), _field17C(0), _field180(0), _field184(0) { + _bellsMuteControl(false), _bellsPitchControl(false), + _bellsSpeedControl(false), _bellsDirectionControl(false), + _bellsInversionControl(false), _snakeMuteControl(false), + _snakeSpeedControl(false), _snakePitchControl(false), + _snakeInversionControl(false), _snakeDirectionControl(false), + _pianoMuteControl(false), _pianoSpeedControl(false), + _pianoPitchControl(false), _pianoInversionControl(false), + _pianoDirectionControl(false), _bassMuteControl(false), + _bassSpeedControl(false), _bassPitchControl(false), + _bassInversionControl(false) { } void CPhonographCylinder::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); - file->writeQuotedLine(_string6, indent); - file->writeNumberLine(_field138, indent); - file->writeNumberLine(_field13C, indent); - file->writeNumberLine(_field140, indent); - file->writeNumberLine(_field144, indent); - file->writeNumberLine(_field148, indent); - file->writeNumberLine(_field14C, indent); - file->writeNumberLine(_field150, indent); - file->writeNumberLine(_field154, indent); - file->writeNumberLine(_field158, indent); - file->writeNumberLine(_field15C, indent); - file->writeNumberLine(_field160, indent); - file->writeNumberLine(_field164, indent); - file->writeNumberLine(_field168, indent); - file->writeNumberLine(_field16C, indent); - file->writeNumberLine(_field170, indent); - file->writeNumberLine(_field174, indent); - file->writeNumberLine(_field178, indent); - file->writeNumberLine(_field17C, indent); - file->writeNumberLine(_field180, indent); - file->writeNumberLine(_field184, indent); + file->writeQuotedLine(_itemName, indent); + file->writeNumberLine(_bellsMuteControl, indent); + file->writeNumberLine(_bellsPitchControl, indent); + file->writeNumberLine(_bellsSpeedControl, indent); + file->writeNumberLine(_bellsDirectionControl, indent); + file->writeNumberLine(_bellsInversionControl, indent); + file->writeNumberLine(_snakeMuteControl, indent); + file->writeNumberLine(_snakeSpeedControl, indent); + file->writeNumberLine(_snakePitchControl, indent); + file->writeNumberLine(_snakeInversionControl, indent); + file->writeNumberLine(_snakeDirectionControl, indent); + file->writeNumberLine(_pianoMuteControl, indent); + file->writeNumberLine(_pianoSpeedControl, indent); + file->writeNumberLine(_pianoPitchControl, indent); + file->writeNumberLine(_pianoInversionControl, indent); + file->writeNumberLine(_pianoDirectionControl, indent); + file->writeNumberLine(_bassMuteControl, indent); + file->writeNumberLine(_bassSpeedControl, indent); + file->writeNumberLine(_bassPitchControl, indent); + file->writeNumberLine(_bassInversionControl, indent); CCarry::save(file, indent); } void CPhonographCylinder::load(SimpleFile *file) { file->readNumber(); - _string6 = file->readString(); - _field138 = file->readNumber(); - _field13C = file->readNumber(); - _field140 = file->readNumber(); - _field144 = file->readNumber(); - _field148 = file->readNumber(); - _field14C = file->readNumber(); - _field150 = file->readNumber(); - _field154 = file->readNumber(); - _field158 = file->readNumber(); - _field15C = file->readNumber(); - _field160 = file->readNumber(); - _field164 = file->readNumber(); - _field168 = file->readNumber(); - _field16C = file->readNumber(); - _field170 = file->readNumber(); - _field174 = file->readNumber(); - _field178 = file->readNumber(); - _field17C = file->readNumber(); - _field180 = file->readNumber(); - _field184 = file->readNumber(); + _itemName = file->readString(); + _bellsMuteControl = file->readNumber(); + _bellsPitchControl = file->readNumber(); + _bellsSpeedControl = file->readNumber(); + _bellsDirectionControl = file->readNumber(); + _bellsInversionControl = file->readNumber(); + _snakeMuteControl = file->readNumber(); + _snakeSpeedControl = file->readNumber(); + _snakePitchControl = file->readNumber(); + _snakeInversionControl = file->readNumber(); + _snakeDirectionControl = file->readNumber(); + _pianoMuteControl = file->readNumber(); + _pianoSpeedControl = file->readNumber(); + _pianoPitchControl = file->readNumber(); + _pianoInversionControl = file->readNumber(); + _pianoDirectionControl = file->readNumber(); + _bassMuteControl = file->readNumber(); + _bassSpeedControl = file->readNumber(); + _bassPitchControl = file->readNumber(); + _bassInversionControl = file->readNumber(); CCarry::load(file); } @@ -106,19 +109,68 @@ bool CPhonographCylinder::UseWithOtherMsg(CUseWithOtherMsg *msg) { } bool CPhonographCylinder::QueryCylinderMsg(CQueryCylinderMsg *msg) { - msg->_ + msg->_name = _itemName; + return true; } bool CPhonographCylinder::RecordOntoCylinderMsg(CRecordOntoCylinderMsg *msg) { - + _itemName = "STMusic"; + + CQueryMusicControlSettingMsg queryMsg; + queryMsg.execute("Bells Mute Control"); + _bellsMuteControl = queryMsg._value; + queryMsg.execute("Bells Pitch Control"); + _bellsPitchControl = queryMsg._value; + queryMsg.execute("Bells Speed Control"); + _bellsSpeedControl = queryMsg._value; + queryMsg.execute("Bells Direction Control"); + _bellsDirectionControl = queryMsg._value; + queryMsg.execute("Bells Inversion Control"); + _bellsInversionControl = queryMsg._value; + queryMsg.execute("Snake Mute Control"); + _snakeMuteControl = queryMsg._value; + queryMsg.execute("Snake Speed Control"); + _snakeSpeedControl = queryMsg._value; + queryMsg.execute("Snake Pitch Control"); + _snakePitchControl = queryMsg._value; + queryMsg.execute("Snake Inversion Control"); + _snakeInversionControl = queryMsg._value; + queryMsg.execute("Snake Direction Control"); + _snakeDirectionControl = queryMsg._value; + queryMsg.execute("Piano Mute Control"); + _pianoMuteControl = queryMsg._value; + queryMsg.execute("Piano Speed Control"); + _pianoSpeedControl = queryMsg._value; + queryMsg.execute("Piano Pitch Control"); + _pianoPitchControl = queryMsg._value; + queryMsg.execute("Piano Inversion Control"); + _pianoInversionControl = queryMsg._value; + queryMsg.execute("Piano Direction Control"); + _pianoDirectionControl = queryMsg._value; + queryMsg.execute("Bass Mute Control"); + _bassMuteControl = queryMsg._value; + queryMsg.execute("Bass Speed Control"); + _bassSpeedControl = queryMsg._value; + queryMsg.execute("Bass Pitch Control"); + _bassPitchControl = queryMsg._value; + queryMsg.execute("Bass Inversion Control"); + _bassInversionControl = queryMsg._value; + + return true; } bool CPhonographCylinder::SetMusicControlsMsg(CSetMusicControlsMsg *msg) { + if (_itemName.left(7) == "STMusic") { + //todo + warning("TODO"); + } + return true; } bool CPhonographCylinder::ErasePhonographCylinderMsg(CErasePhonographCylinderMsg *msg) { - + _itemName.clear(); + return true; } } // End of namespace Titanic diff --git a/engines/titanic/carry/phonograph_cylinder.h b/engines/titanic/carry/phonograph_cylinder.h index 08db4b214a..8c4ca6489e 100644 --- a/engines/titanic/carry/phonograph_cylinder.h +++ b/engines/titanic/carry/phonograph_cylinder.h @@ -35,27 +35,27 @@ class CPhonographCylinder : public CCarry { bool SetMusicControlsMsg(CSetMusicControlsMsg *msg); bool ErasePhonographCylinderMsg(CErasePhonographCylinderMsg *msg); private: - CString _string6; - int _field138; - int _field13C; - int _field140; - int _field144; - int _field148; - int _field14C; - int _field150; - int _field154; - int _field158; - int _field15C; - int _field160; - int _field164; - int _field168; - int _field16C; - int _field170; - int _field174; - int _field178; - int _field17C; - int _field180; - int _field184; + CString _itemName; + bool _bellsMuteControl; + bool _bellsPitchControl; + bool _bellsSpeedControl; + bool _bellsDirectionControl; + bool _bellsInversionControl; + bool _snakeMuteControl; + bool _snakeSpeedControl; + bool _snakePitchControl; + bool _snakeInversionControl; + bool _snakeDirectionControl; + bool _pianoMuteControl; + bool _pianoSpeedControl; + bool _pianoPitchControl; + bool _pianoInversionControl; + bool _pianoDirectionControl; + bool _bassMuteControl; + bool _bassSpeedControl; + bool _bassPitchControl; + bool _bassInversionControl; + bool _bassDirectionControl; public: CLASSDEF CPhonographCylinder(); diff --git a/engines/titanic/carry/photograph.cpp b/engines/titanic/carry/photograph.cpp index a7c5d8d095..7f76f394bd 100644 --- a/engines/titanic/carry/photograph.cpp +++ b/engines/titanic/carry/photograph.cpp @@ -61,6 +61,7 @@ bool CPhotograph::MouseDragEndMsg(CMouseDragEndMsg *msg) { if (target && target->getName() != "NavigationComputer") { warning("TODO: CPhotograph::MouseDragEndMsg"); + return true; } else { return CCarry::MouseDragEndMsg(msg); } diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index 80eac81e99..d86e9b2f58 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -297,6 +297,11 @@ CRoomItem *CTreeItem::getHiddenRoom() const { return root ? root->findHiddenRoom() : nullptr; } +CMusicRoom *CTreeItem::getMusicRoom() const { + CGameManager *gameManager = getGameManager(); + return gameManager ? &gameManager->_musicRoom : nullptr; +} + int CTreeItem::getState8() const { CGameManager *gameManager = getGameManager(); return gameManager ? gameManager->_gameState._field8 : 3; diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index 4de030f387..c44825f566 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -30,6 +30,7 @@ namespace Titanic { class CGameManager; class CDontSaveFileItem; class CMessage; +class CMusicRoom; class CNamedItem; class CPetControl; class CProjectItem; @@ -262,6 +263,11 @@ public: */ CRoomItem *getHiddenRoom() const; + /** + * Returns the music room instance from the game manager + */ + CMusicRoom *getMusicRoom() const; + int getState8() const; int getStateC() const; }; diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 6d0df5ba90..96749b7ab0 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -321,8 +321,8 @@ MESSAGE1(CPutBotBackInHisBoxMsg, int, value, 0); MESSAGE1(CPutParrotBackMsg, int, value, 0); MESSAGE0(CPuzzleSolvedMsg); MESSAGE3(CQueryCylinderHolderMsg, int, value1, 0, int, value2, 0, int, value3, 0); -MESSAGE3(CQueryCylinderMsg, int, value1, 0, int, value2, 0, int, value3, 0); -MESSAGE3(CQueryCylinderNameMsg, int, value1, 0, int, value2, 0, int, value3, 0); +MESSAGE1(CQueryCylinderMsg, CString, name, ""); +MESSAGE1(CQueryCylinderNameMsg, CString, name, ""); MESSAGE3(CQueryCylinderTypeMsg, int, value1, 0, int, value2, 0, int, value3, 0); MESSAGE1(CQueryMusicControlSettingMsg, int, value, 0); MESSAGE1(CQueryPhonographState, int, value, 0); -- cgit v1.2.3 From 18a38c84e9ddeeb063621c290b8be6dce72daaf1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 13 Apr 2016 22:45:32 -0400 Subject: TITANIC: Implementing CCarry classes msg handlers --- engines/titanic/carry/chicken.h | 2 +- engines/titanic/carry/napkin.cpp | 21 +++++++++++++++++++++ engines/titanic/carry/napkin.h | 3 +++ engines/titanic/carry/note.cpp | 8 ++++++++ engines/titanic/carry/note.h | 3 +++ engines/titanic/carry/parcel.cpp | 3 +++ engines/titanic/carry/parcel.h | 1 + engines/titanic/core/game_object.cpp | 6 ++++++ engines/titanic/core/game_object.h | 5 +++++ engines/titanic/pet_control/pet_control.cpp | 4 ++++ engines/titanic/pet_control/pet_control.h | 5 +++++ engines/titanic/pet_control/pet_section.cpp | 2 +- engines/titanic/pet_control/pet_section.h | 5 ++++- 13 files changed, 65 insertions(+), 3 deletions(-) diff --git a/engines/titanic/carry/chicken.h b/engines/titanic/carry/chicken.h index a81c27c7e1..bbc46f8464 100644 --- a/engines/titanic/carry/chicken.h +++ b/engines/titanic/carry/chicken.h @@ -30,7 +30,7 @@ namespace Titanic { class CChicken : public CCarry { private: static int _v1; -private: +public: int _field12C; CString _string6; int _field13C; diff --git a/engines/titanic/carry/napkin.cpp b/engines/titanic/carry/napkin.cpp index 48d03819ee..c998c132fc 100644 --- a/engines/titanic/carry/napkin.cpp +++ b/engines/titanic/carry/napkin.cpp @@ -21,9 +21,14 @@ */ #include "titanic/carry/napkin.h" +#include "titanic/carry/chicken.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CNapkin, CCarry) + ON_MESSAGE(UseWithOtherMsg) +END_MESSAGE_MAP() + CNapkin::CNapkin() : CCarry() { } @@ -37,4 +42,20 @@ void CNapkin::load(SimpleFile *file) { CCarry::load(file); } +bool CNapkin::UseWithOtherMsg(CUseWithOtherMsg *msg) { + CChicken *chicken = static_cast(msg->_other); + if (chicken) { + if (chicken->_string6 == "None" || chicken->_field12C) { + CActMsg actMsg("Clean"); + actMsg.execute("Chicken"); + } else { + petDisplayMsg("The Chicken is already quite clean enough, thank you."); + } + } + + dropOnPet(); + return CCarry::UseWithOtherMsg(msg); +} + + } // End of namespace Titanic diff --git a/engines/titanic/carry/napkin.h b/engines/titanic/carry/napkin.h index 144189be5c..ac14b70efa 100644 --- a/engines/titanic/carry/napkin.h +++ b/engines/titanic/carry/napkin.h @@ -24,10 +24,13 @@ #define TITANIC_NAPKIN_H #include "titanic/carry/carry.h" +#include "titanic/messages/messages.h" namespace Titanic { class CNapkin : public CCarry { + DECLARE_MESSAGE_MAP + bool UseWithOtherMsg(CUseWithOtherMsg *msg); public: CLASSDEF CNapkin(); diff --git a/engines/titanic/carry/note.cpp b/engines/titanic/carry/note.cpp index e8400126ac..78286d71bd 100644 --- a/engines/titanic/carry/note.cpp +++ b/engines/titanic/carry/note.cpp @@ -24,6 +24,10 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CNote, CCarry) + ON_MESSAGE(MouseDoubleClickMsg) +END_MESSAGE_MAP() + CNote::CNote() : CCarry(), _field138(1) { } @@ -43,4 +47,8 @@ void CNote::load(SimpleFile *file) { CCarry::load(file); } +bool CNote::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/carry/note.h b/engines/titanic/carry/note.h index b96e2cf855..22a95b0bd3 100644 --- a/engines/titanic/carry/note.h +++ b/engines/titanic/carry/note.h @@ -24,10 +24,13 @@ #define TITANIC_NOTE_H #include "titanic/carry/carry.h" +#include "titanic/messages/messages.h" namespace Titanic { class CNote : public CCarry { + DECLARE_MESSAGE_MAP + bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg); private: CString _string6; int _field138; diff --git a/engines/titanic/carry/parcel.cpp b/engines/titanic/carry/parcel.cpp index b450d887c5..275c982d63 100644 --- a/engines/titanic/carry/parcel.cpp +++ b/engines/titanic/carry/parcel.cpp @@ -24,6 +24,9 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CParcel, CCarry) +END_MESSAGE_MAP() + CParcel::CParcel() : CCarry() { } diff --git a/engines/titanic/carry/parcel.h b/engines/titanic/carry/parcel.h index 59f3ed9d6c..cb36bed23d 100644 --- a/engines/titanic/carry/parcel.h +++ b/engines/titanic/carry/parcel.h @@ -28,6 +28,7 @@ namespace Titanic { class CParcel : public CCarry { + DECLARE_MESSAGE_MAP public: CLASSDEF CParcel(); diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 4628ccccf2..0a541bfb4d 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -562,4 +562,10 @@ bool CGameObject::compareViewNameTo(const CString &name) const { return getViewFullName().compareToIgnoreCase(name); } +void CGameObject::petDisplayMsg(const CString &msg) const { + CPetControl *pet = getPetControl(); + if (pet) + pet->displayMessage(msg); +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 658c8449fb..09a00e30bb 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -160,6 +160,11 @@ protected: * string form to the passed string */ bool compareViewNameTo(const CString &name) const; + + /** + * Display a message in the PET + */ + void petDisplayMsg(const CString &msg) const; public: int _field60; CursorId _cursorId; diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 5bc3edc7a6..a5885502f0 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -350,4 +350,8 @@ void CPetControl::drawIndent(CScreenManager *screenManager, int indent) { _frame.drawIndent(screenManager, indent); } +void CPetControl::displayMessage(const CString &msg) { + error("TODO: CPetControl::displayMessage"); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index f357c29378..401f5de3b9 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -196,6 +196,11 @@ public: CGameObject *dragEnd(const Point &pt) const { return _currentArea == PET_INVENTORY ? _inventory.dragEnd(pt) : nullptr; } + + /** + * Display a message + */ + void displayMessage(const CString &msg); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_section.cpp b/engines/titanic/pet_control/pet_section.cpp index d531b5d0d7..349fa40fcf 100644 --- a/engines/titanic/pet_control/pet_section.cpp +++ b/engines/titanic/pet_control/pet_section.cpp @@ -25,7 +25,7 @@ namespace Titanic { -void CPetSection::proc16() { +void CPetSection::displayMessage(const CString &msg) { error("TODO"); } diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 93a9145411..43ae623b37 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -96,7 +96,10 @@ public: */ virtual CGameObject *dragEnd(const Point &pt) const { return nullptr; } - virtual void proc16(); + /** + * Display a message + */ + virtual void displayMessage(const CString &msg); /** * Returns true if the object is in a valid state -- cgit v1.2.3 From 57d75d19cfc0801211b3d22c292f1585c8ca1c5a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 13 Apr 2016 22:54:34 -0400 Subject: TITANIC: Add CMagazine msg handler stubs --- engines/titanic/carry/magazine.cpp | 27 +++++++++++++++++++++++++++ engines/titanic/carry/magazine.h | 7 +++++++ 2 files changed, 34 insertions(+) diff --git a/engines/titanic/carry/magazine.cpp b/engines/titanic/carry/magazine.cpp index efb68c1256..20e0b16f5e 100644 --- a/engines/titanic/carry/magazine.cpp +++ b/engines/titanic/carry/magazine.cpp @@ -24,6 +24,13 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CMagazine, CCarry) + ON_MESSAGE(UseWithCharMsg) + ON_MESSAGE(MouseDoubleClickMsg) + ON_MESSAGE(VisibleMsg) + ON_MESSAGE(UseWithOtherMsg) +END_MESSAGE_MAP() + CMagazine::CMagazine() : CCarry() { } @@ -43,4 +50,24 @@ void CMagazine::load(SimpleFile *file) { CCarry::load(file); } +bool CMagazine::UseWithCharMsg(CUseWithCharMsg *msg) { + // todo + return true; +} + +bool CMagazine::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { + // todo + return true; +} + +bool CMagazine::VisibleMsg(CVisibleMsg *msg) { + // todo + return true; +} + +bool CMagazine::UseWithOtherMsg(CUseWithOtherMsg *msg) { + // todo + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/carry/magazine.h b/engines/titanic/carry/magazine.h index 7621599038..16ef4bb2b0 100644 --- a/engines/titanic/carry/magazine.h +++ b/engines/titanic/carry/magazine.h @@ -24,10 +24,17 @@ #define TITANIC_MAGAZINE_H #include "titanic/carry/carry.h" +#include "titanic/messages/messages.h" +#include "titanic/messages/mouse_messages.h" namespace Titanic { class CMagazine : public CCarry { + DECLARE_MESSAGE_MAP + bool UseWithCharMsg(CUseWithCharMsg *msg); + bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg); + bool VisibleMsg(CVisibleMsg *msg); + bool UseWithOtherMsg(CUseWithOtherMsg *msg); private: int _field12C; int _field130; -- cgit v1.2.3 From a6d03a15c9b305afab75d5b89b9c818249031ec7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 14 Apr 2016 07:51:23 -0400 Subject: TITANIC: More CMagazine message handlers --- engines/titanic/carry/magazine.cpp | 30 +++++++++++++++++++++++++----- engines/titanic/npcs/deskbot.h | 2 +- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/engines/titanic/carry/magazine.cpp b/engines/titanic/carry/magazine.cpp index 20e0b16f5e..ac74da8c71 100644 --- a/engines/titanic/carry/magazine.cpp +++ b/engines/titanic/carry/magazine.cpp @@ -21,6 +21,7 @@ */ #include "titanic/carry/magazine.h" +#include "titanic/npcs/deskbot.h" namespace Titanic { @@ -51,22 +52,41 @@ void CMagazine::load(SimpleFile *file) { } bool CMagazine::UseWithCharMsg(CUseWithCharMsg *msg) { - // todo - return true; + CDeskbot *deskbot = static_cast(msg->_character); + if (deskbot) { + if (deskbot->_field108) { + setVisible(false); + setPosition(Point(1000, 1000)); + CActMsg actMsg("2ndClassUpgrade"); + actMsg.execute("Deskbot"); + } + + return true; + } else { + return CCarry::UseWithCharMsg(msg); + } } bool CMagazine::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { - // todo return true; } bool CMagazine::VisibleMsg(CVisibleMsg *msg) { - // todo + setVisible(msg->_visible); return true; } bool CMagazine::UseWithOtherMsg(CUseWithOtherMsg *msg) { - // todo + if (msg->_other->getName() == "SwitchOnDeskbot") { + // TODO: other _field108 if + if (false) { + setVisible(false); + setPosition(Point(1000, 1000)); + CActMsg actMsg("2ndClassUpgrade"); + actMsg.execute("Deskbot"); + } + } + return true; } diff --git a/engines/titanic/npcs/deskbot.h b/engines/titanic/npcs/deskbot.h index cb977e416d..50c3e3fb46 100644 --- a/engines/titanic/npcs/deskbot.h +++ b/engines/titanic/npcs/deskbot.h @@ -31,7 +31,7 @@ class CDeskbot : public CTrueTalkNPC { private: static int _v1; static int _v2; -private: +public: int _field108; int _field10C; public: -- cgit v1.2.3 From a5e90526355a421d23175bd0ac25f7c2bc0d3276 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 14 Apr 2016 18:32:03 -0400 Subject: TITANIC: More CArm message handlers --- engines/titanic/carry/arm.cpp | 68 ++++++++++++++++++++++----- engines/titanic/carry/arm.h | 5 +- engines/titanic/carry/phonograph_cylinder.cpp | 2 + engines/titanic/messages/messages.h | 19 +------- 4 files changed, 60 insertions(+), 34 deletions(-) diff --git a/engines/titanic/carry/arm.cpp b/engines/titanic/carry/arm.cpp index f2c7d5233f..0098c6f4c6 100644 --- a/engines/titanic/carry/arm.cpp +++ b/engines/titanic/carry/arm.cpp @@ -21,6 +21,7 @@ */ #include "titanic/carry/arm.h" +#include "titanic/messages/messages.h" namespace Titanic { @@ -35,19 +36,18 @@ BEGIN_MESSAGE_MAP(CArm, CCarry) END_MESSAGE_MAP() CArm::CArm() : CCarry(), _string6("Key"), - _field138(0), _field13C(0), _field140(0), _field144(0), - _field148(0), _field158(0), _armRect(220, 208, 409, 350), - _field16C(3), _field170(0) { + _field138(0), _field158(0), _field16C(3), _field170(0), + _armRect(220, 208, 409, 350) { } void CArm::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); file->writeQuotedLine(_string6, indent); file->writeNumberLine(_field138, indent); - file->writeNumberLine(_field13C, indent); - file->writeNumberLine(_field140, indent); - file->writeNumberLine(_field144, indent); - file->writeNumberLine(_field148, indent); + file->writeNumberLine(_hookedRect.left, indent); + file->writeNumberLine(_hookedRect.top, indent); + file->writeNumberLine(_hookedRect.right, indent); + file->writeNumberLine(_hookedRect.bottom, indent); file->writeQuotedLine(_string7, indent); file->writeNumberLine(_field158, indent); @@ -65,10 +65,10 @@ void CArm::load(SimpleFile *file) { file->readNumber(); _string6 = file->readString(); _field138 = file->readNumber(); - _field13C = file->readNumber(); - _field140 = file->readNumber(); - _field144 = file->readNumber(); - _field148 = file->readNumber(); + _hookedRect.left = file->readNumber(); + _hookedRect.top = file->readNumber(); + _hookedRect.right = file->readNumber(); + _hookedRect.bottom = file->readNumber(); _string7 = file->readString(); _field158 = file->readNumber(); @@ -107,14 +107,58 @@ bool CArm::TranslateObjectMsg(CTranslateObjectMsg *msg) { } bool CArm::UseWithOtherMsg(CUseWithOtherMsg *msg) { + if (_string6 != "None") { + CShowTextMsg textMsg("The arm is already holding something."); + textMsg.execute("PET"); + return false; + } else if (msg->_other->getName() == "GondolierLeftLever") { + CIsHookedOnMsg hookedMsg(_hookedRect, 0, getName()); + hookedMsg._rect.translate(_bounds.left, _bounds.top); + hookedMsg.execute("GondolierLeftLever"); + + if (hookedMsg._result) { + _string7 = "GondolierLeftLever"; + } else { + dropOnPet(); + } + } else if (msg->_other->getName() == "GondolierRightLever") { + CIsHookedOnMsg hookedMsg(_hookedRect, 0, getName()); + hookedMsg._rect.translate(_bounds.left, _bounds.top); + hookedMsg.execute("GondolierRightLever"); + + if (hookedMsg._result) { + _string7 = "GondolierRightLever"; + } else { + dropOnPet(); + } + } + return true; } bool CArm::MouseDragStartMsg(CMouseDragStartMsg *msg) { - return true; + if (!_fieldE0) { + CShowTextMsg textMsg("You can't get this."); + textMsg.execute("PET"); + } else if (checkStartDragging(msg)) { + _tempPos = msg->_mousePos - _bounds; + setPosition(msg->_mousePos - _tempPos); + + if (!_string7.empty()) { + CActMsg actMsg("Unhook"); + actMsg.execute(_string7); + _string7.clear(); + } + + loadFrame(_visibleFrame); + return true; + } + + return false; } bool CArm::MaitreDHappyMsg(CMaitreDHappyMsg *msg) { + // TODO return true; } diff --git a/engines/titanic/carry/arm.h b/engines/titanic/carry/arm.h index 60f597e71f..f19943de51 100644 --- a/engines/titanic/carry/arm.h +++ b/engines/titanic/carry/arm.h @@ -42,10 +42,7 @@ class CArm : public CCarry { private: CString _string6; int _field138; - int _field13C; - int _field140; - int _field144; - int _field148; + Rect _hookedRect; CString _string7; int _field158; Rect _armRect; diff --git a/engines/titanic/carry/phonograph_cylinder.cpp b/engines/titanic/carry/phonograph_cylinder.cpp index e2a7a99927..d7b9fe6c96 100644 --- a/engines/titanic/carry/phonograph_cylinder.cpp +++ b/engines/titanic/carry/phonograph_cylinder.cpp @@ -68,6 +68,7 @@ void CPhonographCylinder::save(SimpleFile *file, int indent) const { file->writeNumberLine(_bassSpeedControl, indent); file->writeNumberLine(_bassPitchControl, indent); file->writeNumberLine(_bassInversionControl, indent); + file->writeNumberLine(_bassDirectionControl, indent); CCarry::save(file, indent); } @@ -94,6 +95,7 @@ void CPhonographCylinder::load(SimpleFile *file) { _bassSpeedControl = file->readNumber(); _bassPitchControl = file->readNumber(); _bassInversionControl = file->readNumber(); + _bassDirectionControl = file->readNumber(); CCarry::load(file); } diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 96749b7ab0..4c26ec5b33 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -180,24 +180,6 @@ public: } }; -class CIsHookedOnMsg : public CMessage { -public: - int _field4; - int _field8; - CString _string1; - int _field18; - int _field1C; - int _field20; -public: - CLASSDEF - CIsHookedOnMsg() : CMessage(), _field4(0), _field8(0), - _field18(0), _field1C(0), _field20(0) {} - - static bool isSupportedBy(const CTreeItem *item) { - return supports(item, _type); - } -}; - class CTransportMsg : public CMessage { public: CString _string; @@ -281,6 +263,7 @@ MESSAGE1(CGetChevRoomNum, int, value, 0); MESSAGE2(CHoseConnectedMsg, int, value1, 1, int, value2, 0); MESSAGE0(CInitializeAnimMsg); MESSAGE1(CIsEarBowlPuzzleDone, int, value, 0); +MESSAGE3(CIsHookedOnMsg, Rect, rect, Rect(), bool, result, false, CString, string1, ""); MESSAGE1(CIsParrotPresentMsg, int, value, 0); MESSAGE1(CKeyCharMsg, int, value, 32); MESSAGE2(CLeaveNodeMsg, CNodeItem *, oldNode, nullptr, CNodeItem *, newNode, nullptr); -- cgit v1.2.3 From 1babcc10cfce1458ac07c8e1027c321962cf8f09 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 14 Apr 2016 18:42:57 -0400 Subject: TITANIC: Implemented PET methods for iterating sub-objects --- engines/titanic/pet_control/pet_control.cpp | 11 +++++++++++ engines/titanic/pet_control/pet_control.h | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index a5885502f0..c7dc8d2c21 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -354,4 +354,15 @@ void CPetControl::displayMessage(const CString &msg) { error("TODO: CPetControl::displayMessage"); } +CGameObject *CPetControl::getFirstObject() const { + return static_cast(getFirstChild()); +} + +CGameObject *CPetControl::getNextObject(CGameObject *prior) const { + if (!prior || prior->getParent() != this) + return nullptr; + + return static_cast(prior->getNextSibling()); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 401f5de3b9..c22f555c31 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -201,6 +201,17 @@ public: * Display a message */ void displayMessage(const CString &msg); + + /** + * Get the first game object stored in the PET + */ + CGameObject *getFirstObject() const; + + /** + * Get the next game object stored in the PET following + * the passed game object + */ + CGameObject *getNextObject(CGameObject *prior) const; }; } // End of namespace Titanic -- cgit v1.2.3 From f77a8a63cde7b40dd6fb4dfc23f11cc654c7e9a5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 14 Apr 2016 20:02:52 -0400 Subject: TITANIC: Implemented CGameObject::find --- engines/titanic/core/game_object.cpp | 58 ++++++++++++++++++++++++++++++ engines/titanic/core/game_object.h | 23 ++++++++++++ engines/titanic/core/mail_man.cpp | 50 ++++++++++++++++++++++++++ engines/titanic/core/mail_man.h | 61 ++++++++++++++++++++++++++++++++ engines/titanic/core/saveable_object.cpp | 6 ++-- engines/titanic/core/tree_item.cpp | 5 +++ engines/titanic/core/tree_item.h | 6 ++++ engines/titanic/game/mail_man.cpp | 39 -------------------- engines/titanic/game/mail_man.h | 50 -------------------------- engines/titanic/module.mk | 2 +- 10 files changed, 207 insertions(+), 93 deletions(-) create mode 100644 engines/titanic/core/mail_man.cpp create mode 100644 engines/titanic/core/mail_man.h delete mode 100644 engines/titanic/game/mail_man.cpp delete mode 100644 engines/titanic/game/mail_man.h diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 0a541bfb4d..ba8ab42c68 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -21,7 +21,9 @@ */ #include "titanic/core/game_object.h" +#include "titanic/core/mail_man.h" #include "titanic/core/resource_key.h" +#include "titanic/core/room_item.h" #include "titanic/pet_control/pet_control.h" #include "titanic/support/files_manager.h" #include "titanic/support/screen_manager.h" @@ -568,4 +570,60 @@ void CGameObject::petDisplayMsg(const CString &msg) const { pet->displayMessage(msg); } +CGameObject *CGameObject::getMailManFirstObject() const { + CMailMan *mailMan = getMailMan(); + return mailMan ? mailMan->getFirstObject() : nullptr; +} + +CGameObject *CGameObject::getMailManNextObject(CGameObject *prior) const { + CMailMan *mailMan = getMailMan(); + return mailMan ? mailMan->getNextObject(prior) : nullptr; +} + +CGameObject *CGameObject::findRoomObject(const CString &name) const { + return static_cast(findRoom()->findByName(name)); +} + +Found CGameObject::find(const CString &name, CGameObject **item, int findAreas) { + CGameObject *go; + *item = nullptr; + + // Scan under PET if flagged + if (findAreas & FIND_PET) { + for (go = getPetControl()->getFirstObject(); go; go = getPetControl()->getNextObject(go)) { + if (go->getName() == name) { + *item = go; + return FOUND_PET; + } + } + } + + if (findAreas & FIND_MAILMAN) { + for (go = getMailManFirstObject(); go; go = getMailManNextObject(go)) { + if (go->getName() == name) { + *item = go; + return FOUND_MAILMAN; + } + } + } + + if (findAreas & FIND_GLOBAL) { + go = static_cast(getRoot()->findByName(name)); + if (go) { + *item = go; + return FOUND_GLOBAL; + } + } + + if (findAreas & FIND_ROOM) { + go = findRoomObject(name); + if (go) { + *item = go; + return FOUND_ROOM; + } + } + + return FOUND_NONE; +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 09a00e30bb..86687309e7 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -32,6 +32,9 @@ namespace Titanic { +enum Find { FIND_GLOBAL = 1, FIND_ROOM = 2, FIND_PET = 4, FIND_MAILMAN = 8 }; +enum Found { FOUND_NONE = 0, FOUND_GLOBAL = 1, FOUND_ROOM = 2, FOUND_PET = 3, FOUND_MAILMAN = 4 }; + class CVideoSurface; class CMouseDragStartMsg; class OSMovie; @@ -165,6 +168,26 @@ protected: * Display a message in the PET */ void petDisplayMsg(const CString &msg) const; + + /** + * Gets the first object under the system MailMan + */ + CGameObject *getMailManFirstObject() const; + + /** + * Gets the next object under the system MailMan + */ + CGameObject *getMailManNextObject(CGameObject *prior) const; + + /** + * Finds an object by name within the object's room + */ + CGameObject *findRoomObject(const CString &name) const; + + /** + * Finds an item in various system areas + */ + Found find(const CString &name, CGameObject **item, int findAreas); public: int _field60; CursorId _cursorId; diff --git a/engines/titanic/core/mail_man.cpp b/engines/titanic/core/mail_man.cpp new file mode 100644 index 0000000000..cb959245b5 --- /dev/null +++ b/engines/titanic/core/mail_man.cpp @@ -0,0 +1,50 @@ +/* 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 "titanic/core/mail_man.h" + +namespace Titanic { + +void CMailMan::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + file->writeNumberLine(_value, indent); + CGameObject::save(file, indent); +} + +void CMailMan::load(SimpleFile *file) { + file->readNumber(); + _value = file->readNumber(); + CGameObject::load(file); +} + +CGameObject *CMailMan::getFirstObject() const { + return static_cast(getFirstChild()); +} + +CGameObject *CMailMan::getNextObject(CGameObject *prior) const { + if (!prior || prior->getParent() != this) + return nullptr; + + return static_cast(prior->getNextSibling()); +} + +} // End of namespace Titanic diff --git a/engines/titanic/core/mail_man.h b/engines/titanic/core/mail_man.h new file mode 100644 index 0000000000..d1c84e2264 --- /dev/null +++ b/engines/titanic/core/mail_man.h @@ -0,0 +1,61 @@ +/* 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. + * + */ + +#ifndef TITANIC_MAIL_MAN_H +#define TITANIC_MAIL_MAN_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CMailMan : public CGameObject { +public: + int _value; +public: + CLASSDEF + CMailMan() : CGameObject(), _value(1) {} + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); + + /** + * Get the first game object stored in the PET + */ + CGameObject *getFirstObject() const; + + /** + * Get the next game object stored in the PET following + * the passed game object + */ + CGameObject *getNextObject(CGameObject *prior) const; +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MAIL_MAN_H */ diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 2eacbba4a0..4a57959b57 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -68,6 +68,7 @@ #include "titanic/core/game_object_desc_item.h" #include "titanic/core/link_item.h" #include "titanic/core/list.h" +#include "titanic/core/mail_man.h" #include "titanic/core/message_target.h" #include "titanic/core/movie_clip.h" #include "titanic/core/multi_drop_target.h" @@ -156,7 +157,6 @@ #include "titanic/game/light_switch.h" #include "titanic/game/little_lift_button.h" #include "titanic/game/long_stick_dispenser.h" -#include "titanic/game/mail_man.h" #include "titanic/game/missiveomat.h" #include "titanic/game/missiveomat_button.h" #include "titanic/game/movie_tester.h" @@ -475,6 +475,7 @@ DEFFN(CGameObject) DEFFN(CGameObjectDescItem) DEFFN(CLinkItem) DEFFN(ListItem) +DEFFN(CMailMan) DEFFN(CMessageTarget) DEFFN(CMovieClip) DEFFN(CMultiDropTarget) @@ -565,7 +566,6 @@ DEFFN(CLight) DEFFN(CLightSwitch) DEFFN(CLittleLiftButton) DEFFN(CLongStickDispenser) -DEFFN(CMailMan) DEFFN(CMissiveOMat) DEFFN(CMissiveOMatButton) DEFFN(CMovieTester) @@ -1061,6 +1061,7 @@ void CSaveableObject::initClassList() { ADDFN(CLinkItem, CNamedItem); ADDFN(ListItem, CSaveableObject); ADDFN(CMessageTarget, CSaveableObject); + ADDFN(CMailMan, CGameObject); ADDFN(CMovieClip, ListItem); ADDFN(CMultiDropTarget, CDropTarget); ADDFN(CNamedItem, CTreeItem); @@ -1151,7 +1152,6 @@ void CSaveableObject::initClassList() { ADDFN(CLightSwitch, CBackground); ADDFN(CLittleLiftButton, CBackground); ADDFN(CLongStickDispenser, CGameObject); - ADDFN(CMailMan, CGameObject); ADDFN(CMissiveOMat, CGameObject); ADDFN(CMissiveOMatButton, CEditControl); ADDFN(CMovieTester, CGameObject); diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index d86e9b2f58..03bf0e764e 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -26,6 +26,7 @@ #include "titanic/core/game_object.h" #include "titanic/core/game_object_desc_item.h" #include "titanic/core/link_item.h" +#include "titanic/core/mail_man.h" #include "titanic/core/named_item.h" #include "titanic/core/node_item.h" #include "titanic/core/project_item.h" @@ -275,6 +276,10 @@ CPetControl *CTreeItem::getPetControl() const { return dynamic_cast(getDontSaveChild(CPetControl::_type)); } +CMailMan *CTreeItem::getMailMan() const { + return dynamic_cast(getDontSaveChild(CMailMan::_type)); +} + CTreeItem *CTreeItem::getDontSaveChild(ClassDef *classDef) const { CProjectItem *root = getRoot(); if (!root) diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index c44825f566..2f4ebc39f1 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -29,6 +29,7 @@ namespace Titanic { class CGameManager; class CDontSaveFileItem; +class CMailMan; class CMessage; class CMusicRoom; class CNamedItem; @@ -248,6 +249,11 @@ public: */ CPetControl *getPetControl() const; + /** + * Returns the MailMan + */ + CMailMan *getMailMan() const; + /** * Returns a child of the Dont Save area of the project of the given class */ diff --git a/engines/titanic/game/mail_man.cpp b/engines/titanic/game/mail_man.cpp deleted file mode 100644 index 9096fc55d1..0000000000 --- a/engines/titanic/game/mail_man.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* 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 "titanic/game/mail_man.h" - -namespace Titanic { - -void CMailMan::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - file->writeNumberLine(_value, indent); - CGameObject::save(file, indent); -} - -void CMailMan::load(SimpleFile *file) { - file->readNumber(); - _value = file->readNumber(); - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/mail_man.h b/engines/titanic/game/mail_man.h deleted file mode 100644 index a75d75a865..0000000000 --- a/engines/titanic/game/mail_man.h +++ /dev/null @@ -1,50 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_MAIL_MAN_H -#define TITANIC_MAIL_MAN_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CMailMan : public CGameObject { -public: - int _value; -public: - CLASSDEF - CMailMan() : CGameObject(), _value(1) {} - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_MAIL_MAN_H */ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index be9a46784c..8f3126b052 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -60,6 +60,7 @@ MODULE_OBJS := \ core/game_object_desc_item.o \ core/link_item.o \ core/list.o \ + core/mail_man.o \ core/message_target.o \ core/movie_clip.o \ core/multi_drop_target.o \ @@ -150,7 +151,6 @@ MODULE_OBJS := \ game/light_switch.o \ game/little_lift_button.o \ game/long_stick_dispenser.o \ - game/mail_man.o \ game/missiveomat.o \ game/missiveomat_button.o \ game/movie_tester.o \ -- cgit v1.2.3 From 7ddd5d1a8b97bda75e4eece9c91ff3286e3c3eca Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 14 Apr 2016 20:21:40 -0400 Subject: TITANIC: Finished CArm msg handlers, stubs for adding to inventory --- engines/titanic/carry/arm.cpp | 20 +++++++++++++++++++- engines/titanic/carry/carry.cpp | 7 +++++++ engines/titanic/carry/carry.h | 5 ++++- engines/titanic/pet_control/pet_control.cpp | 4 ++++ engines/titanic/pet_control/pet_control.h | 5 +++++ engines/titanic/pet_control/pet_inventory.cpp | 4 ++++ engines/titanic/pet_control/pet_inventory.h | 5 +++++ 7 files changed, 48 insertions(+), 2 deletions(-) diff --git a/engines/titanic/carry/arm.cpp b/engines/titanic/carry/arm.cpp index 0098c6f4c6..b6e125aa10 100644 --- a/engines/titanic/carry/arm.cpp +++ b/engines/titanic/carry/arm.cpp @@ -158,8 +158,26 @@ bool CArm::MouseDragStartMsg(CMouseDragStartMsg *msg) { } bool CArm::MaitreDHappyMsg(CMaitreDHappyMsg *msg) { + CGameObject *petItem; + if (find(getName(), &petItem, FIND_PET)) { + if (!_field158) + playSound("z#47.wav", 100, 0, 0); + if (_string6 == "Key" || _string6 == "AuditoryCentre") { + CGameObject *child = static_cast(getFirstChild()); + if (child) { + child->setVisible(true); + dropOnPet(); + } - // TODO + _visibleFrame = _field170; + loadFrame(_visibleFrame); + _string6 = "None"; + addToInventory(); + } + } + + _field158 = 1; + _fieldE0 = 1; return true; } diff --git a/engines/titanic/carry/carry.cpp b/engines/titanic/carry/carry.cpp index 9968c523ee..1bb81fb4cb 100644 --- a/engines/titanic/carry/carry.cpp +++ b/engines/titanic/carry/carry.cpp @@ -24,6 +24,7 @@ #include "titanic/messages/messages.h" #include "titanic/npcs/character.h" #include "titanic/npcs/succubus.h" +#include "titanic/pet_control/pet_control.h" namespace Titanic { @@ -241,4 +242,10 @@ void CCarry::dropOnPet() { warning("TODO: dropOnPet"); } +void CCarry::addToInventory() { + CPetControl *pet = getPetControl(); + if (pet) + pet->addToInventory(this); +} + } // End of namespace Titanic diff --git a/engines/titanic/carry/carry.h b/engines/titanic/carry/carry.h index b14ba05934..9fd7679463 100644 --- a/engines/titanic/carry/carry.h +++ b/engines/titanic/carry/carry.h @@ -62,7 +62,10 @@ protected: bool _enterFrameSet; int _visibleFrame; protected: - + /** + * Add the item to the PET inventory + */ + void addToInventory(); public: CLASSDEF CCarry(); diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index c7dc8d2c21..2f119be5d3 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -365,4 +365,8 @@ CGameObject *CPetControl::getNextObject(CGameObject *prior) const { return static_cast(prior->getNextSibling()); } +void CPetControl::addToInventory(CCarry *item) { + _inventory.addItem(item); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index c22f555c31..73dc69b0ab 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -212,6 +212,11 @@ public: * the passed game object */ CGameObject *getNextObject(CGameObject *prior) const; + + /** + * Adds an item to the PET inventory + */ + void addToInventory(CCarry *item); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index 1104b653b6..a073a376de 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -102,4 +102,8 @@ bool CPetInventory::setPetControl(CPetControl *petControl) { return true; } +void CPetInventory::addItem(CCarry *item) { + warning("TODO: CPetInventory::addItem"); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h index 16dfd227f1..3700854b8e 100644 --- a/engines/titanic/pet_control/pet_inventory.h +++ b/engines/titanic/pet_control/pet_inventory.h @@ -90,6 +90,11 @@ public: * Returns true if the object is in a valid state */ virtual bool isValid(CPetControl *petControl); + + /** + * Add an item to the inventory + */ + void addItem(CCarry *item); }; } // End of namespace Titanic -- cgit v1.2.3 From 2dcda26eb1253d884d6a921a3f2ead76021b9bc4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 14 Apr 2016 22:31:33 -0400 Subject: TITANIC: Implement CBridgePiece message handlers --- engines/titanic/carry/brain.cpp | 86 +++++++++++++++++++++++++++++ engines/titanic/carry/brain.h | 9 +++ engines/titanic/carry/bridge_piece.cpp | 47 ++++++++++++++++ engines/titanic/carry/bridge_piece.h | 3 + engines/titanic/core/game_object.cpp | 18 ++++++ engines/titanic/core/game_object.h | 11 ++++ engines/titanic/game/ship_setting.h | 2 +- engines/titanic/game_state.h | 2 + engines/titanic/messages/messages.h | 2 +- engines/titanic/pet_control/pet_control.cpp | 8 +++ engines/titanic/pet_control/pet_control.h | 5 ++ 11 files changed, 191 insertions(+), 2 deletions(-) diff --git a/engines/titanic/carry/brain.cpp b/engines/titanic/carry/brain.cpp index 0d1cdf7518..acc29b3f0e 100644 --- a/engines/titanic/carry/brain.cpp +++ b/engines/titanic/carry/brain.cpp @@ -21,9 +21,18 @@ */ #include "titanic/carry/brain.h" +#include "titanic/game/brain_slot.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CBrain, CCarry) + ON_MESSAGE(UseWithOtherMsg) + ON_MESSAGE(VisibleMsg) + ON_MESSAGE(MouseDragStartMsg) + ON_MESSAGE(PassOnDragStartMsg) + ON_MESSAGE(PETGainedObjectMsg) +END_MESSAGE_MAP() + CBrain::CBrain() : CCarry(), _field134(0), _field138(0) { } @@ -45,4 +54,81 @@ void CBrain::load(SimpleFile *file) { CCarry::load(file); } +bool CBrain::UseWithOtherMsg(CUseWithOtherMsg *msg) { + CBrainSlot *slot = static_cast(msg->_other); + if (slot) { + if (slot->getName() == "CentralCore") { + setVisible(false); + moveToHiddenRoom(); + CAddHeadPieceMsg headpieceMsg(getName()); + headpieceMsg.execute("CentralCoreSlot"); + } + else if (!slot->_value1 && slot->getName() == "CentralCoreSlot") { + setVisible(false); + moveToHiddenRoom(); + CAddHeadPieceMsg headpieceMsg(getName()); + headpieceMsg.execute(msg->_other); + playSound("z#116.wav", 100, 0, 0); + setPosition(Point(0, 0)); + setVisible(false); + _field134 = 1; + } + + return true; + } + else { + return CCarry::UseWithOtherMsg(msg); + } +} + +bool CBrain::VisibleMsg(CVisibleMsg *msg) { + setVisible(msg->_visible); + return true; +} + +bool CBrain::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (!checkStartDragging(msg)) + return false; + + if (_field134) { + CTakeHeadPieceMsg headpieceMsg(getName()); + headpieceMsg.execute("TitaniaControl"); + + _field134 = 0; + setVisible(true); + moveToView(); + + setPosition(Point(msg->_mousePos.x - _bounds.width() / 2, + msg->_mousePos.y - _bounds.height() / 2)); + } + + return CCarry::MouseDragStartMsg(msg); +} + +bool CBrain::PassOnDragStartMsg(CPassOnDragStartMsg *msg) { + if (_field134) { + CTakeHeadPieceMsg headpieceMsg(getName()); + headpieceMsg.execute("TitaniaControl"); + _field134 = 0; + + setVisible(true); + moveToView(); + setPosition(Point(msg->_mousePos.x - _bounds.width() / 2, + msg->_mousePos.y - _bounds.height() / 2)); + } + + return CCarry::PassOnDragStartMsg(msg); +} + +bool CBrain::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { + if (!_field138) { + if (getName() == "Perch") { + incState38(); + _field138 = 1; + } + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/carry/brain.h b/engines/titanic/carry/brain.h index 14f9b632a0..3e24f5215b 100644 --- a/engines/titanic/carry/brain.h +++ b/engines/titanic/carry/brain.h @@ -24,10 +24,19 @@ #define TITANIC_BRAIN_H #include "titanic/carry/carry.h" +#include "titanic/messages/messages.h" +#include "titanic/messages/mouse_messages.h" +#include "titanic/messages/pet_messages.h" namespace Titanic { class CBrain : public CCarry { + DECLARE_MESSAGE_MAP + bool UseWithOtherMsg(CUseWithOtherMsg *msg); + bool VisibleMsg(CVisibleMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); + bool PassOnDragStartMsg(CPassOnDragStartMsg *msg); + bool PETGainedObjectMsg(CPETGainedObjectMsg *msg); private: Point _pos1; int _field134; diff --git a/engines/titanic/carry/bridge_piece.cpp b/engines/titanic/carry/bridge_piece.cpp index e93d3c455a..0ed8ae6a9a 100644 --- a/engines/titanic/carry/bridge_piece.cpp +++ b/engines/titanic/carry/bridge_piece.cpp @@ -21,9 +21,15 @@ */ #include "titanic/carry/bridge_piece.h" +#include "titanic/game/ship_setting.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CBridgePiece, CCarry) + ON_MESSAGE(UseWithOtherMsg) + ON_MESSAGE(PassOnDragStartMsg) +END_MESSAGE_MAP() + CBridgePiece::CBridgePiece() : CCarry(), _field140(0) { } @@ -45,4 +51,45 @@ void CBridgePiece::load(SimpleFile *file) { CCarry::load(file); } +bool CBridgePiece::UseWithOtherMsg(CUseWithOtherMsg *msg) { + CShipSetting *shipSetting = static_cast(msg->_other); + if (!shipSetting) { + return CCarry::UseWithOtherMsg(msg); + } else if (shipSetting->_string4 == "NULL") { + dropOnPet(); + return true; + } else { + setVisible(false); + playSound("z#54.wav", 100, 0, 0); + setPosition(shipSetting->_pos1); + shipSetting->_string4 = getName(); + moveToHiddenRoom(); + + CAddHeadPieceMsg headpieceMsg(shipSetting->getName() == _string6 ? + "Enable" : "Disable"); + CSetFrameMsg frameMsg; + + CString name = getName(); + if (name == "ChickenBridge") { + frameMsg._frameNumber = 1; + } else if (name == "FanBridge") { + frameMsg._frameNumber = 2; + } else if (name == "SeasonBridge") { + frameMsg._frameNumber = 3; + } else if (name == "BeamBridge") { + frameMsg._frameNumber = 0; + } + + frameMsg.execute(shipSetting); + headpieceMsg.execute(shipSetting); + return true; + } +} + +bool CBridgePiece::PassOnDragStartMsg(CPassOnDragStartMsg *msg) { + setVisible(true); + moveToView(); + return CCarry::PassOnDragStartMsg(msg); +} + } // End of namespace Titanic diff --git a/engines/titanic/carry/bridge_piece.h b/engines/titanic/carry/bridge_piece.h index a641eb4574..5041cbc049 100644 --- a/engines/titanic/carry/bridge_piece.h +++ b/engines/titanic/carry/bridge_piece.h @@ -28,6 +28,9 @@ namespace Titanic { class CBridgePiece : public CCarry { + DECLARE_MESSAGE_MAP + bool UseWithOtherMsg(CUseWithOtherMsg *msg); + bool PassOnDragStartMsg(CPassOnDragStartMsg *msg); private: CString _string6; Point _pos3; diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index ba8ab42c68..e0ca5ff6b9 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -626,4 +626,22 @@ Found CGameObject::find(const CString &name, CGameObject **item, int findAreas) return FOUND_NONE; } +void CGameObject::moveToHiddenRoom() { + CPetControl *pet = getPetControl(); + if (pet) { + makeDirty(); + pet->moveToHiddenRoom(this); + } +} + +void CGameObject::moveToView() { + CViewItem *view = getGameManager()->getView(); + detach(); + view->addUnder(this); +} + +void CGameObject::incState38() { + getGameManager()->_gameState.inc38(); +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 86687309e7..3848222436 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -132,6 +132,7 @@ protected: void soundFn2(int val, int val2); void petFn2(int val); void petFn3(CTreeItem *item); + void incState38(); /** * Plays a sound @@ -188,6 +189,16 @@ protected: * Finds an item in various system areas */ Found find(const CString &name, CGameObject **item, int findAreas); + + /** + * Moves the item from it's original position to be under the hidden room + */ + void moveToHiddenRoom(); + + /** + * Moves the item from it's original position to be under the current view + */ + void moveToView(); public: int _field60; CursorId _cursorId; diff --git a/engines/titanic/game/ship_setting.h b/engines/titanic/game/ship_setting.h index 9783e69461..acc06d171f 100644 --- a/engines/titanic/game/ship_setting.h +++ b/engines/titanic/game/ship_setting.h @@ -30,7 +30,7 @@ namespace Titanic { class CShipSetting : public CBackground { bool EnterRoomMsg(CEnterRoomMsg *msg); -private: +public: CString _string3; Point _pos1; CString _string4; diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h index 0fe8e6ad14..1176b2f6f2 100644 --- a/engines/titanic/game_state.h +++ b/engines/titanic/game_state.h @@ -123,6 +123,8 @@ public: * Adds a movie to the movie list */ void addMovie(CMovie *movie); + + void inc38() { ++_field38; } }; } // End of namespace Titanic diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 4c26ec5b33..f1b782b9a1 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -344,7 +344,7 @@ MESSAGE0(CSubTurnOffMsg); MESSAGE0(CSubTurnOnMsg); MESSAGE2(CSummonBotMsg, CString, strValue, "", int, numValue, 0); MESSAGE1(CSummonBotQuerryMsg, CString, value, ""); -MESSAGE1(CTakeHeadPieceMsg, CString, value, ""); +MESSAGE1(CTakeHeadPieceMsg, CString, value, "NULL"); MESSAGE2(CTextInputMsg, CString, value1, "", CString, value2, ""); MESSAGE1(CTimeDilationMsg, int, value, 0); MESSAGE0(CTitleSequenceEndedMsg); diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 2f119be5d3..a955b085cc 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -369,4 +369,12 @@ void CPetControl::addToInventory(CCarry *item) { _inventory.addItem(item); } +void CPetControl::moveToHiddenRoom(CTreeItem *item) { + CRoomItem *room = getHiddenRoom(); + if (room) { + item->detach(); + room->addUnder(item); + } +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 73dc69b0ab..88a738f2d8 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -217,6 +217,11 @@ public: * Adds an item to the PET inventory */ void addToInventory(CCarry *item); + + /** + * Moves a tree item from it's original position to be under the hidden room + */ + void moveToHiddenRoom(CTreeItem *item); }; } // End of namespace Titanic -- cgit v1.2.3 From 95c885f877ac1fa243479d113b59e6f83a360c71 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 15 Apr 2016 08:01:39 -0400 Subject: TITANIC: Implementing CCarryParrot msg handlers --- engines/titanic/carry/carry_parrot.cpp | 91 +++++++++++++++++++++++++++++++++ engines/titanic/carry/carry_parrot.h | 13 +++++ engines/titanic/core/game_object.cpp | 4 ++ engines/titanic/core/game_object.h | 3 ++ engines/titanic/core/tree_item.cpp | 7 +++ engines/titanic/core/tree_item.h | 5 ++ engines/titanic/messages/messages.h | 2 +- engines/titanic/npcs/parrot.h | 2 +- engines/titanic/sound/sound.h | 1 + engines/titanic/sound/sound_manager.cpp | 2 +- engines/titanic/sound/sound_manager.h | 4 +- 11 files changed, 129 insertions(+), 5 deletions(-) diff --git a/engines/titanic/carry/carry_parrot.cpp b/engines/titanic/carry/carry_parrot.cpp index 80c833261c..1081980121 100644 --- a/engines/titanic/carry/carry_parrot.cpp +++ b/engines/titanic/carry/carry_parrot.cpp @@ -21,9 +21,23 @@ */ #include "titanic/carry/carry_parrot.h" +#include "titanic/game/cage.h" +#include "titanic/npcs/parrot.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CCarryParrot, CCarry) + ON_MESSAGE(PETGainedObjectMsg) + ON_MESSAGE(TimerMsg) + ON_MESSAGE(IsParrotPresentMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(MouseDragEndMsg) + ON_MESSAGE(PassOnDragStartMsg) + ON_MESSAGE(PreEnterViewMsg) + ON_MESSAGE(UseWithCharMsg) + ON_MESSAGE(ActMsg) +END_MESSAGE_MAP() + CCarryParrot::CCarryParrot() : CCarry(), _string6("PerchedParrot"), _field138(0), _field13C(0), _field140(0), _field144(10), _field148(25), _field14C(0), _field150(8) { @@ -49,4 +63,81 @@ void CCarryParrot::load(SimpleFile *file) { CCarry::load(file); } +bool CCarryParrot::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { + CParrot::_v4 = 4; + CActMsg actMsg("Shut"); + actMsg.execute("ParrotCage"); + + return true; +} + +bool CCarryParrot::TimerMsg(CTimerMsg *msg) { + if (CParrot::_v4 == 1 || CParrot::_v4 == 4) { + if (++_field13C >= 30) { + CActMsg actMsg("FreeParrot"); + actMsg.execute(this); + } + } + + return true; +} + +bool CCarryParrot::IsParrotPresentMsg(CIsParrotPresentMsg *msg) { + msg->_value = true; + return true; +} + +bool CCarryParrot::LeaveViewMsg(CLeaveViewMsg *msg) { + if (_visible) { + setVisible(false); + _fieldE0 = 0; + CParrot::_v4 = 2; + } + + return true; +} + +bool CCarryParrot::MouseDragEndMsg(CMouseDragEndMsg *msg) { + stopMovie(); + + if (msg->_mousePos.y >= 360) { + dropOnPet(); + return true; + } + + if (compareViewNameTo("ParrotLobby.Node 1.N")) { + if (msg->_mousePos.x >= 75 && msg->_mousePos.x <= 565 && + !CParrot::_v2 && !CCage::_v2) { + setVisible(false); + // TODO + } else { + // TODO + } + } else { + // TODO + } + + return true; +} + +bool CCarryParrot::PassOnDragStartMsg(CPassOnDragStartMsg *msg) { + // TODO + return true; +} + +bool CCarryParrot::PreEnterViewMsg(CPreEnterViewMsg *msg) { + // TODO + return true; +} + +bool CCarryParrot::UseWithCharMsg(CUseWithCharMsg *msg) { + // TODO + return true; +} + +bool CCarryParrot::ActMsg(CActMsg *msg) { + // TODO + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/carry/carry_parrot.h b/engines/titanic/carry/carry_parrot.h index a2b17004ac..fc1bbba255 100644 --- a/engines/titanic/carry/carry_parrot.h +++ b/engines/titanic/carry/carry_parrot.h @@ -24,10 +24,23 @@ #define TITANIC_CARRY_PARROT_H #include "titanic/carry/carry.h" +#include "titanic/messages/messages.h" +#include "titanic/messages/mouse_messages.h" +#include "titanic/messages/pet_messages.h" namespace Titanic { class CCarryParrot : public CCarry { + DECLARE_MESSAGE_MAP + bool PETGainedObjectMsg(CPETGainedObjectMsg *msg); + bool TimerMsg(CTimerMsg *msg); + bool IsParrotPresentMsg(CIsParrotPresentMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool MouseDragEndMsg(CMouseDragEndMsg *msg); + bool PassOnDragStartMsg(CPassOnDragStartMsg *msg); + bool PreEnterViewMsg(CPreEnterViewMsg *msg); + bool UseWithCharMsg(CUseWithCharMsg *msg); + bool ActMsg(CActMsg *msg); private: CString _string6; int _field138; diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index e0ca5ff6b9..362dbfe0c8 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -445,6 +445,10 @@ int CGameObject::getSurface45() const { return _surface ? _surface->proc45() : 0; } +void CGameObject::sound8(bool flag) const { + getGameManager()->_sound.managerProc8(flag ? 3 : 0); +} + bool CGameObject::playSound(const CString &name, int val2, int val3, int val4) { CProximity prox; prox._field8 = val2; diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 3848222436..653230a74f 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -254,6 +254,7 @@ public: int getMovie19() const; int getSurface45() const; + void sound8(bool flag) const; /** * Loads a frame @@ -279,6 +280,8 @@ public: * Sets whether the object is visible */ void setVisible(bool val); + + }; } // End of namespace Titanic diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index 03bf0e764e..abd6f6c51b 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -201,6 +201,13 @@ void CTreeItem::addSibling(CTreeItem *item) { item->_nextSibling = this; } +void CTreeItem::moveUnder(CTreeItem *newParent) { + if (newParent) { + detach(); + addUnder(newParent); + } +} + void CTreeItem::destroyAll() { destroyOthers(); detach(); diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index 2f4ebc39f1..151addee2e 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -214,6 +214,11 @@ public: */ void addSibling(CTreeItem *item); + /** + * Moves the tree item to be under another parent + */ + void moveUnder(CTreeItem *newParent); + /** * Destroys both the item as well as any of it's children */ diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index f1b782b9a1..76469a85e5 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -264,7 +264,7 @@ MESSAGE2(CHoseConnectedMsg, int, value1, 1, int, value2, 0); MESSAGE0(CInitializeAnimMsg); MESSAGE1(CIsEarBowlPuzzleDone, int, value, 0); MESSAGE3(CIsHookedOnMsg, Rect, rect, Rect(), bool, result, false, CString, string1, ""); -MESSAGE1(CIsParrotPresentMsg, int, value, 0); +MESSAGE1(CIsParrotPresentMsg, bool, value, false); MESSAGE1(CKeyCharMsg, int, value, 32); MESSAGE2(CLeaveNodeMsg, CNodeItem *, oldNode, nullptr, CNodeItem *, newNode, nullptr); MESSAGE2(CLeaveRoomMsg, CRoomItem *, oldRoom, nullptr, CRoomItem *, newRoom, nullptr); diff --git a/engines/titanic/npcs/parrot.h b/engines/titanic/npcs/parrot.h index b69c8723d3..0019437ce0 100644 --- a/engines/titanic/npcs/parrot.h +++ b/engines/titanic/npcs/parrot.h @@ -28,7 +28,7 @@ namespace Titanic { class CParrot : public CTrueTalkNPC { -private: +public: static int _v1; static int _v2; static int _v3; diff --git a/engines/titanic/sound/sound.h b/engines/titanic/sound/sound.h index 804263c59d..07300264af 100644 --- a/engines/titanic/sound/sound.h +++ b/engines/titanic/sound/sound.h @@ -76,6 +76,7 @@ public: bool fn1(int val); void fn2(int val); void fn3(int val, int val2, int val3); + void managerProc8(int v) { _soundManager.proc8(v); } }; } // End of namespace Titanic diff --git a/engines/titanic/sound/sound_manager.cpp b/engines/titanic/sound/sound_manager.cpp index f575411c82..9b78a9e5b6 100644 --- a/engines/titanic/sound/sound_manager.cpp +++ b/engines/titanic/sound/sound_manager.cpp @@ -57,7 +57,7 @@ void QSoundManager::proc7() { warning("TODO"); } -void QSoundManager::proc8() { +void QSoundManager::proc8(int v) { warning("TODO"); } diff --git a/engines/titanic/sound/sound_manager.h b/engines/titanic/sound/sound_manager.h index f741f97f7b..d37db60e28 100644 --- a/engines/titanic/sound/sound_manager.h +++ b/engines/titanic/sound/sound_manager.h @@ -42,7 +42,7 @@ public: virtual int proc5() const { return 0; } virtual void proc6() = 0; virtual void proc7() = 0; - virtual void proc8() = 0; + virtual void proc8(int v) = 0; virtual void proc9() {} virtual void proc10() = 0; virtual void proc11() = 0; @@ -105,7 +105,7 @@ public: virtual int proc5(); virtual void proc6(); virtual void proc7(); - virtual void proc8(); + virtual void proc8(int v); virtual void proc9(); virtual void proc10(); virtual void proc11(); -- cgit v1.2.3 From bc716fda4b11b69eecfc0931afd3b12ef0afb589 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 15 Apr 2016 22:30:50 -0400 Subject: TITANIC: Implemented CCarryParrot msg handlers and support methods --- engines/titanic/carry/carry_parrot.cpp | 116 +++++++++++++++++++++--- engines/titanic/carry/carry_parrot.h | 4 +- engines/titanic/core/game_object.cpp | 52 +++++++++++ engines/titanic/core/game_object.h | 27 ++++++ engines/titanic/core/movie_clip.cpp | 12 +-- engines/titanic/core/movie_clip.h | 4 +- engines/titanic/game_manager.h | 5 + engines/titanic/pet_control/pet_control.cpp | 39 ++++---- engines/titanic/pet_control/pet_control.h | 18 +++- engines/titanic/pet_control/pet_inventory.cpp | 4 + engines/titanic/pet_control/pet_inventory.h | 5 + engines/titanic/true_talk/true_talk_manager.cpp | 5 + engines/titanic/true_talk/true_talk_manager.h | 3 + 13 files changed, 252 insertions(+), 42 deletions(-) diff --git a/engines/titanic/carry/carry_parrot.cpp b/engines/titanic/carry/carry_parrot.cpp index 1081980121..4b2b637fa1 100644 --- a/engines/titanic/carry/carry_parrot.cpp +++ b/engines/titanic/carry/carry_parrot.cpp @@ -21,8 +21,12 @@ */ #include "titanic/carry/carry_parrot.h" +#include "titanic/core/project_item.h" +#include "titanic/core/room_item.h" #include "titanic/game/cage.h" #include "titanic/npcs/parrot.h" +#include "titanic/npcs/succubus.h" +#include "titanic/pet_control/pet_control.h" namespace Titanic { @@ -39,14 +43,14 @@ BEGIN_MESSAGE_MAP(CCarryParrot, CCarry) END_MESSAGE_MAP() CCarryParrot::CCarryParrot() : CCarry(), _string6("PerchedParrot"), - _field138(0), _field13C(0), _field140(0), _field144(10), + _timerId(0), _field13C(0), _field140(false), _field144(10), _field148(25), _field14C(0), _field150(8) { } void CCarryParrot::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); file->writeQuotedLine(_string6, indent); - file->writeNumberLine(_field138, indent); + file->writeNumberLine(_timerId, indent); file->writeNumberLine(_field13C, indent); file->writeNumberLine(_field140, indent); @@ -56,7 +60,7 @@ void CCarryParrot::save(SimpleFile *file, int indent) const { void CCarryParrot::load(SimpleFile *file) { file->readNumber(); _string6 = file->readString(); - _field138 = file->readNumber(); + _timerId = file->readNumber(); _field13C = file->readNumber(); _field140 = file->readNumber(); @@ -109,34 +113,124 @@ bool CCarryParrot::MouseDragEndMsg(CMouseDragEndMsg *msg) { if (msg->_mousePos.x >= 75 && msg->_mousePos.x <= 565 && !CParrot::_v2 && !CCage::_v2) { setVisible(false); - // TODO + _fieldE0 = 0; + CTreeItem *perchedParrot = findUnder(getRoot(), "PerchedParrot"); + detach(); + addUnder(perchedParrot); + sound8(true); + + CPutParrotBackMsg backMsg(msg->_mousePos.x); + backMsg.execute(perchedParrot); } else { - // TODO + setVisible(false); + _fieldE0 = 0; + CParrot::_v4 = 2; + playSound("z#475.wav", 100, 0, 0); + sound8(true); + moveUnder(findRoom()); + + CActMsg actMsg("Shut"); + actMsg.execute("ParrotCage"); } } else { - // TODO + CCharacter *character = static_cast(msg->_dropTarget); + if (character) { + CUseWithCharMsg charMsg(character); + charMsg.execute(this, nullptr, 0); + } else { + setVisible(false); + _fieldE0 = 0; + playSound("z#475.wav", 100, 0, 0); + sound8(true); + moveUnder(findRoom()); + } } return true; } bool CCarryParrot::PassOnDragStartMsg(CPassOnDragStartMsg *msg) { - // TODO + if (CParrot::_v4 != 3) { + moveToView(); + setPosition(Point(0, 0)); + setVisible(true); + playClip("Pick Up", 2); + playClip("Flapping", 1); + + stopTimer(_timerId); + _timerId = addTimer(1000, 1000); + + _field13C = 0; + CParrot::_v4 = 1; + msg->_value3 = 1; + + return CCarry::PassOnDragStartMsg(msg); + } + + CTreeItem *treeItem = getRoot()->findByName(_string6); + if (treeItem) + trueTalkFn1(treeItem, 0x446BF, 0); + + _fieldE0 = 0; + playSound("z#475.wav", 100, 0, 0); + moveUnder(findRoom()); + msg->_value4 = 1; + return true; } bool CCarryParrot::PreEnterViewMsg(CPreEnterViewMsg *msg) { - // TODO + loadSurface(); + CCarryParrot *parrot = static_cast(getRoot()->findByName("CarryParrot")); + if (parrot) + parrot->_fieldE0 = 0; + return true; } bool CCarryParrot::UseWithCharMsg(CUseWithCharMsg *msg) { - // TODO - return true; + CSuccUBus *succubus = static_cast(msg->_character); + if (succubus) + CParrot::_v4 = 3; + + return CCarry::UseWithCharMsg(msg); } bool CCarryParrot::ActMsg(CActMsg *msg) { - // TODO + if (msg->_action == "FreeParrot" && (CParrot::_v4 == 4 || CParrot::_v4 == 1)) { + CTreeItem *treeItem = getRoot()->findByName(_string6); + if (treeItem) + trueTalkFn1(treeItem, 0x446BF, 0); + + setVisible(false); + _fieldE0 = 0; + + if (CParrot::_v4 == 4) { + CActMsg actMsg("Shut"); + actMsg.execute("ParrotCage"); + } else { + playSound("z#475.wav", 100, 0, 0); + + if (!_field140) { + CCarry *feathers = static_cast(getRoot()->findByName("Feathers")); + if (feathers) { + feathers->setVisible(true); + feathers->dropOnPet(); + } + + _field140 = true; + } + + getPetControl()->removeFromInventory(this); + getPetControl()->setC8(true); + moveUnder(getRoom()); + } + + CParrot::_v4 = 2; + stopTimer(_timerId); + _timerId = 0; + } + return true; } diff --git a/engines/titanic/carry/carry_parrot.h b/engines/titanic/carry/carry_parrot.h index fc1bbba255..1c5cc2e890 100644 --- a/engines/titanic/carry/carry_parrot.h +++ b/engines/titanic/carry/carry_parrot.h @@ -43,9 +43,9 @@ class CCarryParrot : public CCarry { bool ActMsg(CActMsg *msg); private: CString _string6; - int _field138; + int _timerId; int _field13C; - int _field140; + bool _field140; int _field144; int _field148; int _field14C; diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 362dbfe0c8..016903b95c 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -377,6 +377,13 @@ void CGameObject::playMovie(uint startFrame, uint endFrame, int val3) { } } +void CGameObject::playClip(const CString &name, uint flags) { + _frameNumber = -1; + CMovieClip *clip = _clipList1.findByName(name); + if (clip) + playMovie(clip->_startFrame, clip->_endFrame, flags); +} + void CGameObject::playMovie(uint flags) { _frameNumber = -1; if (!_surface && !_resource.empty()) { @@ -473,6 +480,18 @@ int CGameObject::addTimer(int endVal, uint firstDuration, uint duration) { return timer->_id; } +int CGameObject::addTimer(uint firstDuration, uint duration) { + CTimeEventInfo *timer = new CTimeEventInfo(g_vm->_events->getTicksCount(), + duration != 0, firstDuration, duration, this, 0, CString()); + + getGameManager()->addTimer(timer); + return timer->_id; +} + +void CGameObject::stopTimer(int id) { + getGameManager()->stopTimer(id); +} + void CGameObject::gotoView(const CString &viewName, const CString &clipName) { CViewItem *newView = parseView(viewName); CGameManager *gameManager = getGameManager(); @@ -588,6 +607,20 @@ CGameObject *CGameObject::findRoomObject(const CString &name) const { return static_cast(findRoom()->findByName(name)); } +CGameObject *CGameObject::findUnder(CTreeItem *parent, const CString &name) { + if (!parent) + return nullptr; + + for (CTreeItem *treeItem = parent->getFirstChild(); treeItem; + treeItem = treeItem->scan(parent)) { + if (!treeItem->getName().compareTo(name)) { + return dynamic_cast(treeItem); + } + } + + return nullptr; +} + Found CGameObject::find(const CString &name, CGameObject **item, int findAreas) { CGameObject *go; *item = nullptr; @@ -648,4 +681,23 @@ void CGameObject::incState38() { getGameManager()->_gameState.inc38(); } +void CGameObject::trueTalkFn1(CTreeItem *item, int val2, int val3) { + CGameManager *gameManager = getGameManager(); + if (gameManager) { + CTrueTalkManager *talkManager = gameManager->getTalkManager(); + if (talkManager) + talkManager->fn1(item, val2, val3); + } +} + +void CGameObject::loadSurface() { + if (!_surface && !_resource.empty()) { + loadResource(_resource); + _resource.clear(); + } + + if (_surface) + _surface->loadIfReady(); +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 653230a74f..6047203c9e 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -149,6 +149,16 @@ protected: */ int addTimer(int endVal, uint firstDuration, uint duration); + /** + * Adds a timer + */ + int addTimer(uint firstDuration, uint duration); + + /** + * Stops a timer + */ + void stopTimer(int id); + /** * Causes the game to sleep for the specified time */ @@ -190,6 +200,11 @@ protected: */ Found find(const CString &name, CGameObject **item, int findAreas); + /** + * Scan the specified room for an item by name + */ + static CGameObject *findUnder(CTreeItem *parent, const CString &name); + /** * Moves the item from it's original position to be under the hidden room */ @@ -199,6 +214,13 @@ protected: * Moves the item from it's original position to be under the current view */ void moveToView(); + + void trueTalkFn1(CTreeItem *item, int val2, int val3); + + /** + * Load the surface + */ + void loadSurface(); public: int _field60; CursorId _cursorId; @@ -271,6 +293,11 @@ public: */ void playMovie(uint startFrame, uint endFrame, int val3); + /** + * Play an arbitrary clip + */ + void playClip(const CString &name, uint flags); + /** * Return the current view/node/room as a single string */ diff --git a/engines/titanic/core/movie_clip.cpp b/engines/titanic/core/movie_clip.cpp index 9a787e2aa9..fdf329ac13 100644 --- a/engines/titanic/core/movie_clip.cpp +++ b/engines/titanic/core/movie_clip.cpp @@ -31,8 +31,8 @@ void CMovieClip::save(SimpleFile *file, int indent) const { file->writeNumberLine(2, indent); file->writeQuotedLine("Clip", indent); file->writeQuotedLine(_name, indent); - file->writeNumberLine(_field18, indent); - file->writeNumberLine(_field1C, indent); + file->writeNumberLine(_startFrame, indent); + file->writeNumberLine(_endFrame, indent); ListItem::save(file, indent); } @@ -43,8 +43,8 @@ void CMovieClip::load(SimpleFile *file) { switch (val) { case 1: _name = file->readString(); - _field18 = file->readNumber(); - _field1C = file->readNumber(); + _startFrame = file->readNumber(); + _endFrame = file->readNumber(); _field20 = file->readNumber(); _field24 = file->readNumber(); _field28 = file->readNumber(); @@ -55,8 +55,8 @@ void CMovieClip::load(SimpleFile *file) { case 2: file->readString(); _name = file->readString(); - _field18 = file->readNumber(); - _field1C = file->readNumber(); + _startFrame = file->readNumber(); + _endFrame = file->readNumber(); break; default: diff --git a/engines/titanic/core/movie_clip.h b/engines/titanic/core/movie_clip.h index 0abda9453f..7eccc47bea 100644 --- a/engines/titanic/core/movie_clip.h +++ b/engines/titanic/core/movie_clip.h @@ -32,8 +32,6 @@ namespace Titanic { */ class CMovieClip : public ListItem { private: - int _field18; - int _field1C; int _field20; int _field24; int _field28; @@ -43,6 +41,8 @@ private: CString _string3; public: CString _name; + int _startFrame; + int _endFrame; public: CLASSDEF CMovieClip(); diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index 6e5782fb1d..102cc40316 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -181,6 +181,11 @@ public: void stopTimer(uint id) { _timers.stop(id); } void setTimer44(uint id, uint val) { _timers.set44(id, val); } + + /** + * Return the true talk manager + */ + CTrueTalkManager *getTalkManager() { return &_trueTalkManager; } }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index a955b085cc..bb320f29f4 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -21,7 +21,9 @@ */ #include "titanic/pet_control/pet_control.h" +#include "titanic/carry/carry.h" #include "titanic/core/project_item.h" +#include "titanic/messages/pet_messages.h" #include "titanic/game_manager.h" #include "titanic/game_state.h" @@ -217,24 +219,9 @@ CRoomItem *CPetControl::getHiddenRoom() { return _hiddenRoom; } -CGameObject *CPetControl::findItemInRoom(CRoomItem *room, - const CString &name) const { - if (!room) - return nullptr; - - for (CTreeItem *treeItem = room->getFirstChild(); treeItem; - treeItem = treeItem->scan(room)) { - if (!treeItem->getName().compareTo(name)) { - return dynamic_cast(treeItem); - } - } - - return nullptr; -} - CGameObject *CPetControl::getHiddenObject(const CString &name) { CRoomItem *room = getHiddenRoom(); - return room ? findItemInRoom(room, name) : nullptr; + return room ? findUnder(room, name) : nullptr; } bool CPetControl::containsPt(const Common::Point &pt) const { @@ -369,6 +356,26 @@ void CPetControl::addToInventory(CCarry *item) { _inventory.addItem(item); } +void CPetControl::removeFromInventory(CCarry *item, CTreeItem *newParent, + bool refreshUI, bool sendMsg) { + if (item && newParent) { + item->detach(); + item->addUnder(newParent); + + if (refreshUI) + _inventory.itemRemoved(item); + if (sendMsg) { + CPETLostObjectMsg lostMsg; + lostMsg.execute(item); + } + } +} + +void CPetControl::removeFromInventory(CCarry *item, bool refreshUI, bool sendMsg) { + CViewItem *view = getGameManager()->getView(); + removeFromInventory(item, view, refreshUI, sendMsg); +} + void CPetControl::moveToHiddenRoom(CTreeItem *item) { CRoomItem *room = getHiddenRoom(); if (room) { diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 88a738f2d8..27b0a2ba6f 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -82,11 +82,6 @@ private: */ void loaded(); - /** - * Scan the specified room for an item by name - */ - CGameObject *findItemInRoom(CRoomItem *room, const CString &name) const; - /** * Returns true if the draw bounds contains the specified point */ @@ -218,10 +213,23 @@ public: */ void addToInventory(CCarry *item); + /** + * Remove an item from the inventory + */ + void removeFromInventory(CCarry *item, CTreeItem *newParent, + bool refreshUI = true, bool sendMsg = true); + + /** + * Remove an item from the inventory + */ + void removeFromInventory(CCarry *item, bool refreshUI = true, bool sendMsg = true); + /** * Moves a tree item from it's original position to be under the hidden room */ void moveToHiddenRoom(CTreeItem *item); + + void setC8(int val) { _fieldC8 = val; } }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index a073a376de..6ea844a3d7 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -106,4 +106,8 @@ void CPetInventory::addItem(CCarry *item) { warning("TODO: CPetInventory::addItem"); } +void CPetInventory::itemRemoved(CCarry *item) { + warning("TODO: CPetInventory::itemRemoved"); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h index 3700854b8e..8f40200dfa 100644 --- a/engines/titanic/pet_control/pet_inventory.h +++ b/engines/titanic/pet_control/pet_inventory.h @@ -95,6 +95,11 @@ public: * Add an item to the inventory */ void addItem(CCarry *item); + + /** + * Called when an item has been removed from the PET + */ + void itemRemoved(CCarry *item); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 68818dbbef..03f8ac5b3e 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -21,6 +21,7 @@ */ #include "titanic/true_talk/true_talk_manager.h" +#include "titanic/core/tree_item.h" #define MKTAG_BE(a3,a2,a1,a0) ((uint32)((a3) | ((a2) << 8) | ((a1) << 16) | ((a0) << 24))) @@ -190,4 +191,8 @@ void CTrueTalkManager::update2() { //warning("CTrueTalkManager::update2"); } +void CTrueTalkManager::fn1(CTreeItem *item, int val2, int val3) { + warning("CTrueTalkManager::fn1"); +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index 4cd892c3ba..2e366a6a35 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -30,6 +30,7 @@ namespace Titanic { class CGameManager; +class CTreeItem; class CTrueTalkManager { private: @@ -110,6 +111,8 @@ public: void update1(); void update2(); + + void fn1(CTreeItem *item, int val2, int val3); }; } // End of namespace Titanic -- cgit v1.2.3 From ee2a70f466057eaebfc05118374d3def81eca6f3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 16 Apr 2016 12:41:18 -0400 Subject: TITANIC: Implemented CChicken message handlers --- engines/titanic/carry/chicken.cpp | 176 +++++++++++++++++++++++++++++++++++- engines/titanic/carry/chicken.h | 15 ++- engines/titanic/messages/messages.h | 2 +- 3 files changed, 188 insertions(+), 5 deletions(-) diff --git a/engines/titanic/carry/chicken.cpp b/engines/titanic/carry/chicken.cpp index 52f3c25cef..50fcb8f500 100644 --- a/engines/titanic/carry/chicken.cpp +++ b/engines/titanic/carry/chicken.cpp @@ -21,13 +21,28 @@ */ #include "titanic/carry/chicken.h" +#include "titanic/game/sauce_dispensor.h" +#include "titanic/npcs/succubus.h" +#include "titanic/pet_control/pet_control.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CChicken, CCarry) + ON_MESSAGE(UseWithCharMsg) + ON_MESSAGE(ActMsg) + ON_MESSAGE(VisibleMsg) + ON_MESSAGE(TimerMsg) + ON_MESSAGE(PETGainedObjectMsg) + ON_MESSAGE(ParrotTriesChickenMsg) + ON_MESSAGE(MouseDragEndMsg) + ON_MESSAGE(PETObjectStateMsg) + ON_MESSAGE(PETLostObjectMsg) +END_MESSAGE_MAP() + int CChicken::_v1; CChicken::CChicken() : CCarry(), _string6("None"), - _field12C(1), _field13C(0), _field140(0) { + _field12C(1), _field13C(0), _timerId(0) { } void CChicken::save(SimpleFile *file, int indent) const { @@ -36,7 +51,7 @@ void CChicken::save(SimpleFile *file, int indent) const { file->writeQuotedLine(_string6, indent); file->writeNumberLine(_v1, indent); file->writeNumberLine(_field13C, indent); - file->writeNumberLine(_field140, indent); + file->writeNumberLine(_timerId, indent); CCarry::save(file, indent); } @@ -47,9 +62,164 @@ void CChicken::load(SimpleFile *file) { _string6 = file->readString(); _v1 = file->readNumber(); _field13C = file->readNumber(); - _field140 = file->readNumber(); + _timerId = file->readNumber(); CCarry::load(file); } +bool CChicken::UseWithOtherMsg(CUseWithOtherMsg *msg) { + if (msg->_other->getName() == "Napkin") { + if (_field12C || _string6 == "None") { + CActMsg actMsg("Clean"); + actMsg.execute(this); + dropOnPet(); + } else { + CShowTextMsg textMsg("The chicken is already clean."); + textMsg.execute("PET"); + } + + dropOnPet(); + } else { + CSauceDispensor *dispensor = static_cast(msg->_other); + if (!dispensor || _string6 == "None") { + return CCarry::UseWithOtherMsg(msg); + } else { + setVisible(false); + CUse use(this); + use.execute(msg->_other); + } + } + + return true; +} + +bool CChicken::UseWithCharMsg(CUseWithCharMsg *msg) { + CSuccUBus *succubus = static_cast(msg->_character); + if (succubus) { + setPosition(Point(330, 300)); + CSubAcceptCCarryMsg acceptMsg; + acceptMsg._item = this; + acceptMsg.execute(succubus); + } else { + dropOnPet(); + } + + return true; +} + +bool CChicken::ActMsg(CActMsg *msg) { + if (msg->_action == "GoToPET") { + setVisible(true); + dropOnPet(); + } else if (msg->_action == "Tomato") { + _string6 = "Tomato"; + loadFrame(4); + _visibleFrame = 4; + } else if (msg->_action == "Mustard") { + _string6 = "Mustard"; + loadFrame(5); + _visibleFrame = 5; + } else if (msg->_action == "Bird") { + _string6 = "Bird"; + loadFrame(2); + _visibleFrame = 2; + } else if (msg->_action == "None") { + setVisible(false); + } else if (msg->_action == "Clean") { + _string6 = "None"; + loadFrame(3); + _field12C = 0; + _visibleFrame = 3; + } + else if (msg->_action == "Dispense Chicken") { + _string6 = "None"; + _field13C = 0; + _field12C = 1; + loadFrame(1); + _visibleFrame = 1; + _v1 = 120; + } else if (msg->_action == "Hot") { + _v1 = 120; + } else if (msg->_action == "Eaten") { + setVisible(false); + moveToHiddenRoom(); + _field13C = 1; + } + + return true; +} + +bool CChicken::VisibleMsg(CVisibleMsg *msg) { + setVisible(msg->_visible); + if (msg->_visible) + loadFrame(_visibleFrame); + + return true; +} + +bool CChicken::TimerMsg(CTimerMsg *msg) { + CGameObject *obj = getMailManFirstObject(); + while (obj && obj->getName() != "Chicken") + obj = getMailManNextObject(obj); + + bool flag = false; + if (obj) { + flag = _v1; + } else if (_v1 > 0) { + --_v1; + flag = _v1; + } + + if (flag) { + addToInventory(); + stopTimer(_timerId); + } + + return true; +} + +bool CChicken::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { + stopTimer(_timerId); + _timerId = addTimer(1000, 1000); + return true; +} + +bool CChicken::ParrotTriesChickenMsg(CParrotTriesChickenMsg *msg) { + if (_v1 > 0) + msg->_value1 = 1; + + if (_string6 == "Tomato") { + msg->_value2 = 1; + } else if (_string6 == "Mustard") { + msg->_value2 = 2; + } else if (_string6 == "Bird") { + msg->_value2 = 3; + } + + return true; +} + +bool CChicken::MouseDragEndMsg(CMouseDragEndMsg *msg) { + if (_field13C) + return true; + else + return CCarry::MouseDragEndMsg(msg); +} + +bool CChicken::PETObjectStateMsg(CPETObjectStateMsg *msg) { + if (_v1 > 0) + msg->_value = 2; + + return true; +} + +bool CChicken::PETLostObjectMsg(CPETLostObjectMsg *msg) { + if (compareViewNameTo("ParrotLobby.Node 1.N")) { + CActMsg actMsg("StartChickenDrag"); + actMsg.execute("PerchedParrot"); + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/carry/chicken.h b/engines/titanic/carry/chicken.h index bbc46f8464..946c102c48 100644 --- a/engines/titanic/carry/chicken.h +++ b/engines/titanic/carry/chicken.h @@ -24,17 +24,30 @@ #define TITANIC_CHICKEN_H #include "titanic/carry/carry.h" +#include "titanic/messages/messages.h" +#include "titanic/messages/pet_messages.h" namespace Titanic { class CChicken : public CCarry { + DECLARE_MESSAGE_MAP + bool UseWithOtherMsg(CUseWithOtherMsg *msg); + bool UseWithCharMsg(CUseWithCharMsg *msg); + bool ActMsg(CActMsg *msg); + bool VisibleMsg(CVisibleMsg *msg); + bool TimerMsg(CTimerMsg *msg); + bool PETGainedObjectMsg(CPETGainedObjectMsg *msg); + bool ParrotTriesChickenMsg(CParrotTriesChickenMsg *msg); + bool MouseDragEndMsg(CMouseDragEndMsg *msg); + bool PETObjectStateMsg(CPETObjectStateMsg *msg); + bool PETLostObjectMsg(CPETLostObjectMsg *msg); private: static int _v1; public: int _field12C; CString _string6; int _field13C; - int _field140; + int _timerId; public: CLASSDEF CChicken(); diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 76469a85e5..649b20b779 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -362,7 +362,7 @@ MESSAGE0(CTrueTalkSelfQueueAnimSetMsg); MESSAGE3(CTrueTalkTriggerActionMsg, int, value1, 0, int, value2, 0, int, value3, 0); MESSAGE0(CTurnOff); MESSAGE0(CTurnOn); -MESSAGE1(CUse, int, value, 0); +MESSAGE1(CUse, CCarry *, item, nullptr); MESSAGE1(CUseWithCharMsg, CCharacter *, character, nullptr); MESSAGE1(CUseWithOtherMsg, CGameObject *, other, 0); MESSAGE1(CVirtualKeyCharMsg, Common::KeyState, keyState, Common::KeyState()); -- cgit v1.2.3 From 6a4e7c3d731fba108b1da34413f60a3490529291 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 16 Apr 2016 13:11:17 -0400 Subject: TITANIC: Implement CCrushedTV message handlers --- engines/titanic/carry/crushed_tv.cpp | 40 ++++++++++++++++++++++++++++++++++++ engines/titanic/carry/crushed_tv.h | 6 ++++++ engines/titanic/core/game_object.cpp | 20 ++++++++++++++++++ engines/titanic/core/game_object.h | 7 ++++++- 4 files changed, 72 insertions(+), 1 deletion(-) diff --git a/engines/titanic/carry/crushed_tv.cpp b/engines/titanic/carry/crushed_tv.cpp index a0a7ee7a43..5abc8fac98 100644 --- a/engines/titanic/carry/crushed_tv.cpp +++ b/engines/titanic/carry/crushed_tv.cpp @@ -21,9 +21,16 @@ */ #include "titanic/carry/crushed_tv.h" +#include "titanic/npcs/character.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CCrushedTV, CCarry) + ON_MESSAGE(ActMsg) + ON_MESSAGE(UseWithCharMsg) + ON_MESSAGE(MouseDragStartMsg) +END_MESSAGE_MAP() + CCrushedTV::CCrushedTV() : CCarry() { } @@ -37,4 +44,37 @@ void CCrushedTV::load(SimpleFile *file) { CCarry::load(file); } +bool CCrushedTV::ActMsg(CActMsg *msg) { + if (msg->_action == "SmashTV") { + setVisible(true); + _fieldE0 = 1; + } + + return true; +} + +bool CCrushedTV::UseWithCharMsg(CUseWithCharMsg *msg) { + if (msg->_character->getName() == "Barbot" && msg->_character->_visible) { + setVisible(false); + CActMsg actMsg("CrushedTV"); + actMsg.execute(msg->_character); + return true; + } else { + return CCarry::UseWithCharMsg(msg); + } +} + +bool CCrushedTV::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (!checkStartDragging(msg)) { + return false; + } else if (compareViewNameTo("BottomOfWell.Node 7.N")) { + changeView("BottomOfWell.Node 12.N", ""); + CActMsg actMsg("TelevisionTaken"); + actMsg.execute("BOWTelevisionMonitor"); + } + + return CCarry::MouseDragStartMsg(msg); +} + + } // End of namespace Titanic diff --git a/engines/titanic/carry/crushed_tv.h b/engines/titanic/carry/crushed_tv.h index b2bfd7580e..3e7753499d 100644 --- a/engines/titanic/carry/crushed_tv.h +++ b/engines/titanic/carry/crushed_tv.h @@ -24,10 +24,16 @@ #define TITANIC_CRUSHED_TV_H #include "titanic/carry/carry.h" +#include "titanic/messages/messages.h" +#include "titanic/messages/mouse_messages.h" namespace Titanic { class CCrushedTV : public CCarry { + DECLARE_MESSAGE_MAP + bool ActMsg(CActMsg *msg); + bool UseWithCharMsg(CUseWithCharMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); public: CLASSDEF CCrushedTV(); diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 016903b95c..7549797ca9 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -700,4 +700,24 @@ void CGameObject::loadSurface() { _surface->loadIfReady(); } +bool CGameObject::changeView(const CString &viewName, const CString &clipName) { + CViewItem *newView = parseView(viewName); + CGameManager *gameManager = getGameManager(); + CViewItem *oldView = gameManager->getView(); + + if (!oldView || !newView) + return false; + + CMovieClip *clip = nullptr; + if (!clipName.empty()) { + clip = oldView->findNode()->findRoom()->findClip(clipName); + } else { + CLinkItem *link = oldView->findLink(newView); + if (link) + clip = link->getClip(); + } + + gameManager->_gameState.changeView(newView, clip); +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 6047203c9e..db1ed90b54 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -73,7 +73,6 @@ protected: int _field50; int _field54; int _field58; - bool _visible; CMovieClipList _clipList1; int _initialFrame; CMovieClipList _clipList2; @@ -221,9 +220,15 @@ protected: * Load the surface */ void loadSurface(); + + /** + * Change the view + */ + bool changeView(const CString &viewName, const CString &clipName); public: int _field60; CursorId _cursorId; + bool _visible; public: CLASSDEF CGameObject(); -- cgit v1.2.3 From fb5565679bf701293a73abfd03b76515f7bcb8ab Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 16 Apr 2016 13:15:33 -0400 Subject: TITANIC: Added CFeathers message map --- engines/titanic/carry/feathers.cpp | 3 +++ engines/titanic/carry/feathers.h | 1 + 2 files changed, 4 insertions(+) diff --git a/engines/titanic/carry/feathers.cpp b/engines/titanic/carry/feathers.cpp index c03b73859b..a738d74249 100644 --- a/engines/titanic/carry/feathers.cpp +++ b/engines/titanic/carry/feathers.cpp @@ -24,6 +24,9 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CFeathers, CCarry) +END_MESSAGE_MAP() + CFeathers::CFeathers() : CCarry() { } diff --git a/engines/titanic/carry/feathers.h b/engines/titanic/carry/feathers.h index 106e9a0620..f90de11abd 100644 --- a/engines/titanic/carry/feathers.h +++ b/engines/titanic/carry/feathers.h @@ -28,6 +28,7 @@ namespace Titanic { class CFeathers : public CCarry { + DECLARE_MESSAGE_MAP public: CLASSDEF CFeathers(); -- cgit v1.2.3 From daaa458d64df42f113b7badd65cdfaf0da0504ff Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 16 Apr 2016 18:42:29 -0400 Subject: TITANIC: Restructuring PET list classes, beginning of inventory --- engines/titanic/carry/arm.cpp | 10 +-- engines/titanic/carry/bridge_piece.cpp | 2 +- engines/titanic/carry/carry.cpp | 18 ++-- engines/titanic/carry/carry.h | 8 +- engines/titanic/carry/carry_parrot.cpp | 4 +- engines/titanic/carry/chicken.cpp | 10 +-- engines/titanic/carry/napkin.cpp | 2 +- engines/titanic/core/game_object.h | 10 +-- engines/titanic/module.mk | 4 +- engines/titanic/pet_control/pet_control.cpp | 29 ++++++- engines/titanic/pet_control/pet_control.h | 2 + .../titanic/pet_control/pet_control_list_item.cpp | 27 ------ .../titanic/pet_control/pet_control_list_item.h | 42 ---------- .../titanic/pet_control/pet_control_list_item2.h | 4 +- engines/titanic/pet_control/pet_control_sub10.cpp | 52 ------------ engines/titanic/pet_control/pet_control_sub10.h | 67 --------------- engines/titanic/pet_control/pet_control_sub11.h | 4 +- engines/titanic/pet_control/pet_inventory.cpp | 28 ++++++- engines/titanic/pet_control/pet_inventory.h | 16 +++- .../titanic/pet_control/pet_inventory_glyphs.cpp | 68 +++++++++++++++ engines/titanic/pet_control/pet_inventory_glyphs.h | 97 ++++++++++++++++++++++ engines/titanic/pet_control/pet_remote.h | 7 +- engines/titanic/pet_control/pet_saves.h | 9 +- 23 files changed, 282 insertions(+), 238 deletions(-) delete mode 100644 engines/titanic/pet_control/pet_control_list_item.cpp delete mode 100644 engines/titanic/pet_control/pet_control_list_item.h delete mode 100644 engines/titanic/pet_control/pet_control_sub10.cpp delete mode 100644 engines/titanic/pet_control/pet_control_sub10.h create mode 100644 engines/titanic/pet_control/pet_inventory_glyphs.cpp create mode 100644 engines/titanic/pet_control/pet_inventory_glyphs.h diff --git a/engines/titanic/carry/arm.cpp b/engines/titanic/carry/arm.cpp index b6e125aa10..c39812fd26 100644 --- a/engines/titanic/carry/arm.cpp +++ b/engines/titanic/carry/arm.cpp @@ -119,7 +119,7 @@ bool CArm::UseWithOtherMsg(CUseWithOtherMsg *msg) { if (hookedMsg._result) { _string7 = "GondolierLeftLever"; } else { - dropOnPet(); + addToInventory(); } } else if (msg->_other->getName() == "GondolierRightLever") { CIsHookedOnMsg hookedMsg(_hookedRect, 0, getName()); @@ -129,7 +129,7 @@ bool CArm::UseWithOtherMsg(CUseWithOtherMsg *msg) { if (hookedMsg._result) { _string7 = "GondolierRightLever"; } else { - dropOnPet(); + addToInventory(); } } @@ -166,13 +166,13 @@ bool CArm::MaitreDHappyMsg(CMaitreDHappyMsg *msg) { CGameObject *child = static_cast(getFirstChild()); if (child) { child->setVisible(true); - dropOnPet(); + addToInventory(); } _visibleFrame = _field170; loadFrame(_visibleFrame); _string6 = "None"; - addToInventory(); + invFn3(); } } @@ -189,7 +189,7 @@ bool CArm::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { _visibleFrame = _field170; loadFrame(_visibleFrame); child->setVisible(true); - child->dropOnPet(); + child->addToInventory(); } _string6 = "None"; diff --git a/engines/titanic/carry/bridge_piece.cpp b/engines/titanic/carry/bridge_piece.cpp index 0ed8ae6a9a..4fafac26b5 100644 --- a/engines/titanic/carry/bridge_piece.cpp +++ b/engines/titanic/carry/bridge_piece.cpp @@ -56,7 +56,7 @@ bool CBridgePiece::UseWithOtherMsg(CUseWithOtherMsg *msg) { if (!shipSetting) { return CCarry::UseWithOtherMsg(msg); } else if (shipSetting->_string4 == "NULL") { - dropOnPet(); + addToInventory(); return true; } else { setVisible(false); diff --git a/engines/titanic/carry/carry.cpp b/engines/titanic/carry/carry.cpp index 1bb81fb4cb..31d0ff02d2 100644 --- a/engines/titanic/carry/carry.cpp +++ b/engines/titanic/carry/carry.cpp @@ -123,7 +123,7 @@ bool CCarry::MouseDragMoveMsg(CMouseDragMoveMsg *msg) { bool CCarry::MouseDragEndMsg(CMouseDragEndMsg *msg) { if (msg->_dropTarget) { if (msg->_dropTarget->isPet()) { - dropOnPet(); + addToInventory(); return true; } @@ -147,7 +147,7 @@ bool CCarry::MouseDragEndMsg(CMouseDragEndMsg *msg) { CString viewName = getViewFullName(); if (viewName.empty() || msg->_mousePos.y >= 360) { sleep(250); - dropOnPet(); + addToInventory(); } else { setPosition(_origPos); loadFrame(_itemFrame); @@ -165,7 +165,7 @@ bool CCarry::UseWithCharMsg(CUseWithCharMsg *msg) { } else { CShowTextMsg textMsg(_string4); textMsg.execute("PET"); - dropOnPet(); + addToInventory(); } return true; @@ -182,7 +182,7 @@ bool CCarry::UseWithOtherMsg(CUseWithOtherMsg *msg) { _fullViewName = getViewFullName(); if (_fullViewName.empty() || _bounds.top >= 360) { sleep(250); - dropOnPet(); + addToInventory(); } else { setPosition(_origPos); } @@ -238,14 +238,16 @@ bool CCarry::PassOnDragStartMsg(CPassOnDragStartMsg *msg) { return true; } -void CCarry::dropOnPet() { - warning("TODO: dropOnPet"); -} - void CCarry::addToInventory() { CPetControl *pet = getPetControl(); if (pet) pet->addToInventory(this); } +void CCarry::invFn3() { + CPetControl *pet = getPetControl(); + if (pet) + pet->invFn3(this); +} + } // End of namespace Titanic diff --git a/engines/titanic/carry/carry.h b/engines/titanic/carry/carry.h index 9fd7679463..2370556607 100644 --- a/engines/titanic/carry/carry.h +++ b/engines/titanic/carry/carry.h @@ -63,9 +63,9 @@ protected: int _visibleFrame; protected: /** - * Add the item to the PET inventory + * */ - void addToInventory(); + void invFn3(); public: CLASSDEF CCarry(); @@ -81,9 +81,9 @@ public: virtual void load(SimpleFile *file); /** - * Called to drop an item into the PET + * Add the item to the inventory */ - void dropOnPet(); + void addToInventory(); }; } // End of namespace Titanic diff --git a/engines/titanic/carry/carry_parrot.cpp b/engines/titanic/carry/carry_parrot.cpp index 4b2b637fa1..598393bb08 100644 --- a/engines/titanic/carry/carry_parrot.cpp +++ b/engines/titanic/carry/carry_parrot.cpp @@ -105,7 +105,7 @@ bool CCarryParrot::MouseDragEndMsg(CMouseDragEndMsg *msg) { stopMovie(); if (msg->_mousePos.y >= 360) { - dropOnPet(); + addToInventory(); return true; } @@ -215,7 +215,7 @@ bool CCarryParrot::ActMsg(CActMsg *msg) { CCarry *feathers = static_cast(getRoot()->findByName("Feathers")); if (feathers) { feathers->setVisible(true); - feathers->dropOnPet(); + feathers->addToInventory(); } _field140 = true; diff --git a/engines/titanic/carry/chicken.cpp b/engines/titanic/carry/chicken.cpp index 50fcb8f500..74b42aafcd 100644 --- a/engines/titanic/carry/chicken.cpp +++ b/engines/titanic/carry/chicken.cpp @@ -72,13 +72,13 @@ bool CChicken::UseWithOtherMsg(CUseWithOtherMsg *msg) { if (_field12C || _string6 == "None") { CActMsg actMsg("Clean"); actMsg.execute(this); - dropOnPet(); + addToInventory(); } else { CShowTextMsg textMsg("The chicken is already clean."); textMsg.execute("PET"); } - dropOnPet(); + addToInventory(); } else { CSauceDispensor *dispensor = static_cast(msg->_other); if (!dispensor || _string6 == "None") { @@ -101,7 +101,7 @@ bool CChicken::UseWithCharMsg(CUseWithCharMsg *msg) { acceptMsg._item = this; acceptMsg.execute(succubus); } else { - dropOnPet(); + addToInventory(); } return true; @@ -110,7 +110,7 @@ bool CChicken::UseWithCharMsg(CUseWithCharMsg *msg) { bool CChicken::ActMsg(CActMsg *msg) { if (msg->_action == "GoToPET") { setVisible(true); - dropOnPet(); + addToInventory(); } else if (msg->_action == "Tomato") { _string6 = "Tomato"; loadFrame(4); @@ -171,7 +171,7 @@ bool CChicken::TimerMsg(CTimerMsg *msg) { } if (flag) { - addToInventory(); + invFn3(); stopTimer(_timerId); } diff --git a/engines/titanic/carry/napkin.cpp b/engines/titanic/carry/napkin.cpp index c998c132fc..a8ceaad5ba 100644 --- a/engines/titanic/carry/napkin.cpp +++ b/engines/titanic/carry/napkin.cpp @@ -53,7 +53,7 @@ bool CNapkin::UseWithOtherMsg(CUseWithOtherMsg *msg) { } } - dropOnPet(); + addToInventory(); return CCarry::UseWithOtherMsg(msg); } diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index db1ed90b54..430f70521e 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -204,11 +204,6 @@ protected: */ static CGameObject *findUnder(CTreeItem *parent, const CString &name); - /** - * Moves the item from it's original position to be under the hidden room - */ - void moveToHiddenRoom(); - /** * Moves the item from it's original position to be under the current view */ @@ -313,7 +308,10 @@ public: */ void setVisible(bool val); - + /** + * Moves the item from it's original position to be under the hidden room + */ + void moveToHiddenRoom(); }; } // End of namespace Titanic diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 8f3126b052..da642f9a3a 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -356,25 +356,25 @@ MODULE_OBJS := \ npcs/titania.o \ npcs/true_talk_npc.o \ pet_control/pet_control.o \ - pet_control/pet_control_list_item.o \ pet_control/pet_control_list_item2.o \ pet_control/pet_conversations.o \ pet_control/pet_element.o \ pet_control/pet_frame.o \ pet_control/pet_gfx_element.o \ pet_control/pet_inventory.o \ + pet_control/pet_inventory_glyphs.o \ pet_control/pet_rooms.o \ pet_control/pet_remote.o \ pet_control/pet_saves.o \ pet_control/pet_section.o \ pet_control/pet_control_sub5.o \ pet_control/pet_control_sub7.o \ - pet_control/pet_control_sub10.o \ pet_control/pet_control_sub11.o \ pet_control/pet_control_sub12.o \ pet_control/pet_drag_chev.o \ pet_control/pet_graphic2.o \ pet_control/pet_graphic.o \ + pet_control/pet_glyphs.o \ pet_control/pet_leaf.o \ pet_control/pet_mode_off.o \ pet_control/pet_mode_on.o \ diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index bb320f29f4..b9f1359746 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -353,7 +353,30 @@ CGameObject *CPetControl::getNextObject(CGameObject *prior) const { } void CPetControl::addToInventory(CCarry *item) { - _inventory.addItem(item); + item->detach(); + + if (item->getName() == "CarryParcel") { + CCarry *child = static_cast(getLastChild()); + if (child) + child->detach(); + + item->moveToHiddenRoom(); + if (!child) + return; + + item = child; + } + + item->addUnder(this); + _inventory.itemsChanged(); + + setArea(PET_INVENTORY); + if (_currentArea != PET_INVENTORY) + _inventory.couldntShowInventory(item); + + makeDirty(); + CPETGainedObjectMsg msg; + msg.execute(item); } void CPetControl::removeFromInventory(CCarry *item, CTreeItem *newParent, @@ -376,6 +399,10 @@ void CPetControl::removeFromInventory(CCarry *item, bool refreshUI, bool sendMsg removeFromInventory(item, view, refreshUI, sendMsg); } +void CPetControl::invFn3(CCarry *item) { + _inventory.fn3(item); +} + void CPetControl::moveToHiddenRoom(CTreeItem *item) { CRoomItem *room = getHiddenRoom(); if (room) { diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 27b0a2ba6f..4192d9ebf4 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -224,6 +224,8 @@ public: */ void removeFromInventory(CCarry *item, bool refreshUI = true, bool sendMsg = true); + void invFn3(CCarry *item); + /** * Moves a tree item from it's original position to be under the hidden room */ diff --git a/engines/titanic/pet_control/pet_control_list_item.cpp b/engines/titanic/pet_control/pet_control_list_item.cpp deleted file mode 100644 index ea678754f5..0000000000 --- a/engines/titanic/pet_control/pet_control_list_item.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* 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 "titanic/pet_control/pet_control_list_item.h" - -namespace Titanic { - -} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_list_item.h b/engines/titanic/pet_control/pet_control_list_item.h deleted file mode 100644 index caa9a0d6b1..0000000000 --- a/engines/titanic/pet_control/pet_control_list_item.h +++ /dev/null @@ -1,42 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_CONTROL_LIST_ITEM_H -#define TITANIC_PET_CONTROL_LIST_ITEM_H - -#include "titanic/core/list.h" -#include "titanic/pet_control/pet_gfx_element.h" - -namespace Titanic { - -class CPetControlListItem : public ListItem { -protected: - CPetGfxElement _val; - int _field30; -public: - CPetControlListItem() : _field30(0) {} - -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_LIST_ITEM_H */ diff --git a/engines/titanic/pet_control/pet_control_list_item2.h b/engines/titanic/pet_control/pet_control_list_item2.h index a7f28fa12d..70feb30432 100644 --- a/engines/titanic/pet_control/pet_control_list_item2.h +++ b/engines/titanic/pet_control/pet_control_list_item2.h @@ -23,11 +23,11 @@ #ifndef TITANIC_PET_CONTROL_LIST_ITEM2_H #define TITANIC_PET_CONTROL_LIST_ITEM2_H -#include "titanic/pet_control/pet_control_list_item.h" +#include "titanic/pet_control/pet_glyphs.h" namespace Titanic { -class CPetControlListItem2 : public CPetControlListItem { +class CPetControlListItem2 : public CPetGlyph { protected: int _field34; int _field38; diff --git a/engines/titanic/pet_control/pet_control_sub10.cpp b/engines/titanic/pet_control/pet_control_sub10.cpp deleted file mode 100644 index a50ad115c4..0000000000 --- a/engines/titanic/pet_control/pet_control_sub10.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* 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/textconsole.h" -#include "titanic/pet_control/pet_control_sub10.h" - -namespace Titanic { - -CPetControlSub10::CPetControlSub10() : _field10(0), _field14(7), - _field18(-1), _field1C(-1), _field20(0), _field24(0) { -} - -void CPetControlSub10::proc8() { - error("TODO"); -} - -void CPetControlSub10::setup() { - warning("TODO: CPetControlSub10::setup"); -} - -void CPetControlSub10::proc10() { - error("TODO"); -} - -void CPetControlSub10::proc11() { - error("TODO"); -} - -void CPetControlSub10::draw(CScreenManager *screenManager) { - warning("TODO: CPetControlSub10::draw"); -} - -} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub10.h b/engines/titanic/pet_control/pet_control_sub10.h deleted file mode 100644 index ef8d02f95c..0000000000 --- a/engines/titanic/pet_control/pet_control_sub10.h +++ /dev/null @@ -1,67 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_CONTROL_SUB10_H -#define TITANIC_PET_CONTROL_SUB10_H - -#include "titanic/core/list.h" -#include "titanic/pet_control/pet_control_sub10.h" -#include "titanic/pet_control/pet_control_list_item.h" -#include "titanic/support/screen_manager.h" - -namespace Titanic { - -class CPetControlSub10 : public List { -protected: - int _field10; - int _field14; - int _field18; - int _field1C; - int _field20; - int _field24; - CPetGfxElement _selection; - CPetGfxElement _scrollLeft; - CPetGfxElement _scrollRight; -public: - CPetControlSub10(); - - virtual void proc8(); - - /** - * Set up the control - */ - virtual void setup(); - - virtual void proc10(); - virtual void proc11(); - - void set20(int val) { _field20 = val; } - - /** - * Draw the control - */ - void draw(CScreenManager *screenManager); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_SUB10_H */ diff --git a/engines/titanic/pet_control/pet_control_sub11.h b/engines/titanic/pet_control/pet_control_sub11.h index ebad13bff5..e3f8c3d493 100644 --- a/engines/titanic/pet_control/pet_control_sub11.h +++ b/engines/titanic/pet_control/pet_control_sub11.h @@ -23,11 +23,11 @@ #ifndef TITANIC_PET_CONTROL_SUB11_H #define TITANIC_PET_CONTROL_SUB11_H -#include "titanic/pet_control/pet_control_sub10.h" +#include "titanic/pet_control/pet_glyphs.h" namespace Titanic { -class CPetControlSub11 : public CPetControlSub10 { +class CPetControlSub11 : public CPetGlyphs { public: }; diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index 6ea844a3d7..89eb692a7e 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -38,7 +38,7 @@ bool CPetInventory::setup(CPetControl *petControl) { } bool CPetInventory::setup() { - _sub10.setup(); + _items.setup(); _sub12.setup(); // TODO @@ -47,7 +47,7 @@ bool CPetInventory::setup() { void CPetInventory::draw(CScreenManager *screenManager) { _petControl->drawIndent(screenManager, 7); - _sub10.draw(screenManager); + _items.draw(screenManager); _sub12.draw(screenManager); } @@ -79,8 +79,8 @@ bool CPetInventory::setPetControl(CPetControl *petControl) { return false; _petControl = petControl; - _sub10.proc8(); - _sub10.set20(28); + _items.proc8(); + _items.set20(28); Rect tempRect(0, 0, 52, 52); for (uint idx = 0; idx < TOTAL_ITEMS; ++idx) { @@ -103,6 +103,10 @@ bool CPetInventory::setPetControl(CPetControl *petControl) { } void CPetInventory::addItem(CCarry *item) { + if (item) { + CPetCarry glyphItem(item, 2); + + } warning("TODO: CPetInventory::addItem"); } @@ -110,4 +114,20 @@ void CPetInventory::itemRemoved(CCarry *item) { warning("TODO: CPetInventory::itemRemoved"); } +void CPetInventory::fn3(CCarry *item) { + warning("TODO: CPetInventory::fn3"); +} + +void CPetInventory::itemsChanged() { + _items.clear(); + + //CGameObject *item = static_cast(_petControl->getFirstObject()); + + +} + +void CPetInventory::couldntShowInventory(CCarry *item) { + +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h index 8f40200dfa..4a08c1c0b2 100644 --- a/engines/titanic/pet_control/pet_inventory.h +++ b/engines/titanic/pet_control/pet_inventory.h @@ -25,7 +25,7 @@ #include "titanic/support/simple_file.h" #include "titanic/pet_control/pet_section.h" -#include "titanic/pet_control/pet_control_sub10.h" +#include "titanic/pet_control/pet_inventory_glyphs.h" #include "titanic/pet_control/pet_control_sub12.h" namespace Titanic { @@ -36,7 +36,7 @@ namespace Titanic { class CPetInventory : public CPetSection { private: CPetControlSub12 _sub12; - CPetControlSub10 _sub10; + CPetInventoryGlyphs _items; CGameObject *_itemBackgrounds[46]; CGameObject *_itemGlyphs[46]; int _field28C; @@ -100,6 +100,18 @@ public: * Called when an item has been removed from the PET */ void itemRemoved(CCarry *item); + + void fn3(CCarry *item); + + /** + * Called when the items under the PET have changed + */ + void itemsChanged(); + + /** + * Called when the inventory can't be shown after adding an item + */ + void couldntShowInventory(CCarry *item); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory_glyphs.cpp b/engines/titanic/pet_control/pet_inventory_glyphs.cpp new file mode 100644 index 0000000000..6fc58ff2ad --- /dev/null +++ b/engines/titanic/pet_control/pet_inventory_glyphs.cpp @@ -0,0 +1,68 @@ +/* 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/textconsole.h" +#include "titanic/pet_control/pet_inventory_glyphs.h" + +namespace Titanic { + +CPetInventoryGlyphs::CPetInventoryGlyphs() : _field10(0), _field14(7), + _field18(-1), _field1C(-1), _field20(0), _field24(0) { +} + +void CPetInventoryGlyphs::proc8() { + error("TODO"); +} + +void CPetInventoryGlyphs::setup() { + warning("TODO: CPetInventoryGlyphs::setup"); +} + +void CPetInventoryGlyphs::proc10() { + error("TODO"); +} + +void CPetInventoryGlyphs::proc11() { + error("TODO"); +} + +void CPetInventoryGlyphs::draw(CScreenManager *screenManager) { + warning("TODO: CPetInventoryGlyphs::draw"); +} + +void CPetInventoryGlyphs::addItem(CPetCarry *item) { + + + warning("TODO"); +} + +void CPetInventoryGlyphs::clear() { + fn1(-1); + destroyContents(); + _field10 = 0; +} + +void CPetInventoryGlyphs::fn1(int val) { + warning("TODO: CPetInventoryGlyphs::fn1"); +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory_glyphs.h b/engines/titanic/pet_control/pet_inventory_glyphs.h new file mode 100644 index 0000000000..f8d4d7f2fa --- /dev/null +++ b/engines/titanic/pet_control/pet_inventory_glyphs.h @@ -0,0 +1,97 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_INVENTORY_GLYPHS_H +#define TITANIC_PET_INVENTORY_GLYPHS_H + +#include "titanic/pet_control/pet_glyphs.h" +#include "titanic/support/screen_manager.h" + +namespace Titanic { + +class CPetInventoryGlyph : public CPetGlyph { +public: + CCarry *_item; + int _field34; + int _field38; + int _field3C; + int _field40; +public: + CPetInventoryGlyph(CCarry *item, int val) : _item(item), + _field34(val), _field38(0), _field3C(0), _field40(0) {} +}; + +class CPetCarry { +public: + int _val; + CCarry *_item; +public: + CPetCarry(CCarry *item, int val) : _item(item), _val(val) {} +}; + +class CPetInventoryGlyphs : public CPetGlyphs { +private: + void fn1(int val); +protected: + int _field10; + int _field14; + int _field18; + int _field1C; + int _field20; + int _field24; + CPetGfxElement _selection; + CPetGfxElement _scrollLeft; + CPetGfxElement _scrollRight; +public: + CPetInventoryGlyphs(); + + virtual void proc8(); + + /** + * Set up the control + */ + virtual void setup(); + + virtual void proc10(); + virtual void proc11(); + + void set20(int val) { _field20 = val; } + + /** + * Draw the control + */ + void draw(CScreenManager *screenManager); + + /** + * Add a new item to the list + */ + void addItem(CPetCarry *item); + + /** + * Clears the glyph list + */ + void clear(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_INVENTORY_GLYPHS_H */ diff --git a/engines/titanic/pet_control/pet_remote.h b/engines/titanic/pet_control/pet_remote.h index 410a5ff961..953f012e67 100644 --- a/engines/titanic/pet_control/pet_remote.h +++ b/engines/titanic/pet_control/pet_remote.h @@ -24,15 +24,18 @@ #define TITANIC_PET_REMOTE_H #include "titanic/pet_control/pet_section.h" -#include "titanic/pet_control/pet_control_sub10.h" +#include "titanic/pet_control/pet_glyphs.h" #include "titanic/pet_control/pet_control_sub12.h" #include "titanic/pet_control/pet_gfx_element.h" namespace Titanic { +class CPetRemoteGlyphs : public CPetGlyphs { +}; + class CPetRemote : public CPetSection { private: - CPetControlSub10 _sub10; + CPetRemoteGlyphs _items; CPetGfxElement _val1; CPetGfxElement _val2; CPetGfxElement _val3; diff --git a/engines/titanic/pet_control/pet_saves.h b/engines/titanic/pet_control/pet_saves.h index f11eef693d..d100e8f702 100644 --- a/engines/titanic/pet_control/pet_saves.h +++ b/engines/titanic/pet_control/pet_saves.h @@ -24,15 +24,18 @@ #define TITANIC_PET_SAVES_H #include "titanic/pet_control/pet_section.h" -#include "titanic/pet_control/pet_control_sub10.h" +#include "titanic/pet_control/pet_glyphs.h" #include "titanic/pet_control/pet_control_sub12.h" namespace Titanic { +class CPetSaveGlyphs : public CPetGlyphs { +}; + class CPetSaves : public CPetSection { private: - CPetControlSub10 _sub10; - CPetControlSub10 _sub12; + CPetSaveGlyphs _sub10; + CPetSaveGlyphs _sub12; public: /** * Returns true if the object is in a valid state -- cgit v1.2.3 From 066dd4f5cd1b0f5408cd0da5ef9050a738edc4b0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 16 Apr 2016 22:58:37 -0400 Subject: TITANIC: Implementing PET inventory population --- engines/titanic/core/game_object.cpp | 5 +- engines/titanic/core/game_object.h | 13 +- engines/titanic/pet_control/pet_control_sub11.h | 2 +- engines/titanic/pet_control/pet_element.cpp | 4 +- engines/titanic/pet_control/pet_element.h | 5 +- engines/titanic/pet_control/pet_glyphs.cpp | 82 +++++++++++ engines/titanic/pet_control/pet_glyphs.h | 152 +++++++++++++++++++++ engines/titanic/pet_control/pet_inventory.cpp | 11 +- .../titanic/pet_control/pet_inventory_glyphs.cpp | 116 ++++++++++++---- engines/titanic/pet_control/pet_inventory_glyphs.h | 59 +++----- engines/titanic/pet_control/pet_remote.h | 2 +- engines/titanic/pet_control/pet_saves.h | 2 +- engines/titanic/support/movie.cpp | 6 +- engines/titanic/support/movie.h | 14 +- engines/titanic/titanic.cpp | 6 +- engines/titanic/titanic.h | 2 +- 16 files changed, 398 insertions(+), 83 deletions(-) create mode 100644 engines/titanic/pet_control/pet_glyphs.cpp create mode 100644 engines/titanic/pet_control/pet_glyphs.h diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 7549797ca9..d2af519fcd 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -442,9 +442,9 @@ bool CGameObject::hasActiveMovie() const { return false; } -int CGameObject::getMovie19() const { +int CGameObject::getMovieFrame() const { if (_surface && _surface->_movie) - return _surface->_movie->proc19(); + return _surface->_movie->getFrame(); return _initialFrame; } @@ -718,6 +718,7 @@ bool CGameObject::changeView(const CString &viewName, const CString &clipName) { } gameManager->_gameState.changeView(newView, clip); + return true; } } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 430f70521e..b987606a4c 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -274,7 +274,11 @@ public: */ bool hasActiveMovie() const; - int getMovie19() const; + /** + * Get the current movie frame + */ + int getMovieFrame() const; + int getSurface45() const; void sound8(bool flag) const; @@ -311,7 +315,12 @@ public: /** * Moves the item from it's original position to be under the hidden room */ - void moveToHiddenRoom(); + void moveToHiddenRoom(); + + /** + * Returns the object's frame number + */ + int getFrameNumber() const { return _frameNumber; } }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub11.h b/engines/titanic/pet_control/pet_control_sub11.h index e3f8c3d493..eeeb8bf2c8 100644 --- a/engines/titanic/pet_control/pet_control_sub11.h +++ b/engines/titanic/pet_control/pet_control_sub11.h @@ -27,7 +27,7 @@ namespace Titanic { -class CPetControlSub11 : public CPetGlyphs { +class CPetControlSub11 : public CPetGlyphs { public: }; diff --git a/engines/titanic/pet_control/pet_element.cpp b/engines/titanic/pet_control/pet_element.cpp index 625415fb62..48c853cfc8 100644 --- a/engines/titanic/pet_control/pet_element.cpp +++ b/engines/titanic/pet_control/pet_element.cpp @@ -87,9 +87,9 @@ void CPetElement::loadFrame(int frameNumber) { gameObject->loadFrame(frameNumber); } -int CPetElement::proc15() { +int CPetElement::getFrame() { CGameObject *gameObject = getObject(); - return gameObject ? gameObject->getMovie19() : 0; + return gameObject ? gameObject->getMovieFrame() : 0; } void CPetElement::setMode(PetElementMode newMode) { diff --git a/engines/titanic/pet_control/pet_element.h b/engines/titanic/pet_control/pet_element.h index de9f552ec8..d4ca580349 100644 --- a/engines/titanic/pet_control/pet_element.h +++ b/engines/titanic/pet_control/pet_element.h @@ -104,7 +104,10 @@ public: */ virtual void loadFrame(int frameNumber); - virtual int proc15(); + /** + * Get the current frame + */ + virtual int getFrame(); /** * Get the game object associated with this item diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp new file mode 100644 index 0000000000..057025c03d --- /dev/null +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -0,0 +1,82 @@ +/* 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 "titanic/pet_control/pet_glyphs.h" + +namespace Titanic { + +void CPetGlyph::setOwner(CPetControl *petControl, CPetGlyphs *owner) { + _element.setBounds(Rect(0, 0, 52, 50)); + _owner = owner; +} + +void CPetGlyph::translateDraw(CScreenManager *screenManager, int deltaX, int deltaY) { + _element.translate(deltaX, deltaY); + _element.draw(screenManager); + _element.translate(-deltaX, -deltaY); +} + +void CPetGlyph::proc14() { + warning("TODO: CPetGlyph::proc14"); +} + +bool CPetGlyph::translateContains(const Point &delta, const Point &pt) { + translate(delta); + bool result = _element.contains2(pt); + translateBack(delta); + + return result; +} + +/*------------------------------------------------------------------------*/ + +void CPetGlyphs::clear() { + fn1(-1); + destroyContents(); + _field10 = 0; +} + +void CPetGlyphs::proc8() { + error("TODO"); +} + +void CPetGlyphs::setup() { + warning("TODO: CPetGlyphs::setup"); +} + +void CPetGlyphs::proc10() { + error("TODO"); +} + +void CPetGlyphs::proc11() { + error("TODO"); +} + +void CPetGlyphs::draw(CScreenManager *screenManager) { + warning("TODO: CPetGlyphs::draw"); +} + +void CPetGlyphs::fn1(int val) { + warning("TODO: CPetGlyphs::fn1"); +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h new file mode 100644 index 0000000000..796b165e92 --- /dev/null +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -0,0 +1,152 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_GLYPHS_H +#define TITANIC_PET_GLYPHS_H + +#include "titanic/core/list.h" +#include "titanic/pet_control/pet_gfx_element.h" +#include "titanic/support/rect.h" + +namespace Titanic { + +class CPetGlyphs; + +class CPetGlyph : public ListItem { +public: + CPetGfxElement _element; + CPetGlyphs *_owner; +public: + CPetGlyph() : ListItem(), _owner(nullptr) {} + + /** + * Translate the glyph's position + */ + void translate(const Point &pt) { _element.translate(pt.x, pt.y); } + + /** + * Translate the glyph's position back + */ + void translateBack(const Point &pt) { _element.translate(-pt.x, -pt.y); } + + /** + * Set the glyph + */ + virtual void setOwner(CPetControl *petControl, CPetGlyphs *owner); + + virtual int proc9() { return 0; } + + virtual void proc10() {} + virtual void proc11() {} + + /** + * Draw the glyph at a translated position without permanently + * changing the position + */ + virtual void translateDraw(CScreenManager *screenManager, int deltaX, int deltaY); + + virtual void proc13() {} + + virtual void proc14(); + + /** + * Get the bounds for the glyph + */ + virtual Rect getBounds() { return Rect(); } + + virtual int proc16() { return 0; } + virtual int proc17() { return 0; } + virtual int proc18() { return 0; } + virtual int proc19() { return 0; } + virtual int proc20() { return 0; } + virtual int proc21() { return 0; } + virtual int proc22() { return 0; } + virtual int proc23() { return 0; } + virtual int proc24() { return 0; } + virtual void proc25() {} + virtual void proc26() {} + virtual void proc27() {} + virtual void proc28() {} + virtual int proc29() { return 0; } + + /** + * Returns true if the glyph's bounds, shifted by a given delta, + * will contain the specified point + */ + virtual bool translateContains(const Point &delta, const Point &pt); + + virtual void proc31() {} + virtual void proc32() {} + + virtual int proc33() { return 1; } + virtual int proc34() { return 1; } + virtual int proc35() { return 0; } + virtual void proc36() {} + virtual int proc37() { return 0; } + virtual int proc38() { return 1; } +}; + +class CPetGlyphs : public List { +protected: + int _field10; + int _field14; + int _field18; + int _field1C; + int _field20; + int _field24; + CPetGfxElement _selection; + CPetGfxElement _scrollLeft; + CPetGfxElement _scrollRight; +protected: + void fn1(int val); +public: + CPetGlyphs::CPetGlyphs() : _field10(0), _field14(7), + _field18(-1), _field1C(-1), _field20(0), _field24(0) { + } + + /** + * Clears the glyph list + */ + void clear(); + + + virtual void proc8(); + + /** + * Set up the control + */ + virtual void setup(); + + virtual void proc10(); + virtual void proc11(); + + void set20(int val) { _field20 = val; } + + /** + * Draw the control + */ + void draw(CScreenManager *screenManager); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_GLYPHS_H */ diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index 89eb692a7e..f143e24ecb 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -22,6 +22,7 @@ #include "titanic/pet_control/pet_inventory.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/carry/carry.h" #include "titanic/titanic.h" namespace Titanic { @@ -121,9 +122,15 @@ void CPetInventory::fn3(CCarry *item) { void CPetInventory::itemsChanged() { _items.clear(); - //CGameObject *item = static_cast(_petControl->getFirstObject()); - + CGameObject *item = _petControl->getFirstObject(); + while (item) { + CPetInventoryGlyph *glyph = new CPetInventoryGlyph(); + glyph->setOwner(_petControl, &_items); + glyph->setItem(item, _field290); + _items.push_back(glyph); + item = _petControl->getNextObject(item); + } } void CPetInventory::couldntShowInventory(CCarry *item) { diff --git a/engines/titanic/pet_control/pet_inventory_glyphs.cpp b/engines/titanic/pet_control/pet_inventory_glyphs.cpp index 6fc58ff2ad..2614306891 100644 --- a/engines/titanic/pet_control/pet_inventory_glyphs.cpp +++ b/engines/titanic/pet_control/pet_inventory_glyphs.cpp @@ -22,47 +22,117 @@ #include "common/textconsole.h" #include "titanic/pet_control/pet_inventory_glyphs.h" +#include "titanic/titanic.h" namespace Titanic { -CPetInventoryGlyphs::CPetInventoryGlyphs() : _field10(0), _field14(7), - _field18(-1), _field1C(-1), _field20(0), _field24(0) { -} +const uint ITEM_MODES[40] = { + 0, 2, 11, 10, 12, 13, 9, 40, 7, 6, + 4, 5, 8, 15, 19, 24, 25, 26, 30, 20, + 21, 22, 23, 36, 39, 39, 31, 31, 32, 32, + 33, 34, 35, 38, 41, 42, 43, 44, 45, 37 +}; -void CPetInventoryGlyphs::proc8() { - error("TODO"); -} +void CPetInventoryGlyph::setItem(CGameObject *item, int val) { + _item = item; -void CPetInventoryGlyphs::setup() { - warning("TODO: CPetInventoryGlyphs::setup"); + if (_owner && item) { + int v1 = populateItem(item, val); + _field3C = static_cast(_owner)->fn1(v1); + warning("TODO: CPetInventoryGlyph::setItem"); + } } -void CPetInventoryGlyphs::proc10() { - error("TODO"); -} +int CPetInventoryGlyph::populateItem(CGameObject *item, int val) { + // Scan the master item names list + CString itemName = item->getName(); + int itemIndex = -1; + for (int idx = 0; idx < 40 && itemIndex == -1; ++idx) { + if (itemName == g_vm->_itemIds[idx]) + itemIndex = idx; + } + if (itemIndex == -1) + return -1; -void CPetInventoryGlyphs::proc11() { - error("TODO"); -} + switch (ITEM_MODES[itemIndex]) { + case 0: + switch (subMode(item, val)) { + case 0: + case 1: + return 0; + case 2: + case 3: + return 1; + default: + return 0; + } + + case 2: + switch (subMode(item, val)) { + case 0: + return 2; + default: + return 3; + } + break; + + case 15: + switch (subMode(item, val)) { + case 0: + case 1: + return 14; + case 2: + return 16; + case 3: + return 15; + case 4: + return 17; + case 5: + return 18; + default: + return 15; + } + break; -void CPetInventoryGlyphs::draw(CScreenManager *screenManager) { - warning("TODO: CPetInventoryGlyphs::draw"); + case 26: + switch (subMode(item, val)) { + case 0: + return 26; + case 1: + return 29; + case 2: + return 28; + case 3: + return 27; + default: + return 26; + } + break; + + default: + return ITEM_MODES[itemIndex]; + } } -void CPetInventoryGlyphs::addItem(CPetCarry *item) { +int CPetInventoryGlyph::subMode(CGameObject *item, int val) { + int frameNum = item->getFrameNumber(); + int movieFrame = item->getMovieFrame(); + if (val && frameNum != -1 && frameNum != movieFrame) + item->loadFrame(frameNum); - warning("TODO"); + return frameNum; } -void CPetInventoryGlyphs::clear() { - fn1(-1); - destroyContents(); - _field10 = 0; +/*------------------------------------------------------------------------*/ + +void CPetInventoryGlyphs::addItem(CPetCarry *item) { + } -void CPetInventoryGlyphs::fn1(int val) { +int CPetInventoryGlyphs::fn1(int val) { warning("TODO: CPetInventoryGlyphs::fn1"); + return 0; } } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory_glyphs.h b/engines/titanic/pet_control/pet_inventory_glyphs.h index f8d4d7f2fa..8c483ea60c 100644 --- a/engines/titanic/pet_control/pet_inventory_glyphs.h +++ b/engines/titanic/pet_control/pet_inventory_glyphs.h @@ -23,21 +23,35 @@ #ifndef TITANIC_PET_INVENTORY_GLYPHS_H #define TITANIC_PET_INVENTORY_GLYPHS_H +#include "titanic/carry/carry.h" #include "titanic/pet_control/pet_glyphs.h" #include "titanic/support/screen_manager.h" namespace Titanic { class CPetInventoryGlyph : public CPetGlyph { +private: + /** + * Populate the details for an item + */ + int populateItem(CGameObject *item, int val); + + int subMode(CGameObject *item, int val); public: - CCarry *_item; + CGameObject *_item; int _field34; - int _field38; int _field3C; int _field40; public: + CPetInventoryGlyph() : _item(nullptr), _field34(0), + _field3C(0), _field40(0) {} CPetInventoryGlyph(CCarry *item, int val) : _item(item), - _field34(val), _field38(0), _field3C(0), _field40(0) {} + _field34(val), _field3C(0), _field40(0) {} + + /** + * Set the inventory item + */ + void setItem(CGameObject *item, int val); }; class CPetCarry { @@ -48,48 +62,15 @@ public: CPetCarry(CCarry *item, int val) : _item(item), _val(val) {} }; -class CPetInventoryGlyphs : public CPetGlyphs { +class CPetInventoryGlyphs : public CPetGlyphs { + friend class CPetInventoryGlyph; private: - void fn1(int val); -protected: - int _field10; - int _field14; - int _field18; - int _field1C; - int _field20; - int _field24; - CPetGfxElement _selection; - CPetGfxElement _scrollLeft; - CPetGfxElement _scrollRight; + int fn1(int val); public: - CPetInventoryGlyphs(); - - virtual void proc8(); - - /** - * Set up the control - */ - virtual void setup(); - - virtual void proc10(); - virtual void proc11(); - - void set20(int val) { _field20 = val; } - - /** - * Draw the control - */ - void draw(CScreenManager *screenManager); - /** * Add a new item to the list */ void addItem(CPetCarry *item); - - /** - * Clears the glyph list - */ - void clear(); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_remote.h b/engines/titanic/pet_control/pet_remote.h index 953f012e67..85cff3fe4f 100644 --- a/engines/titanic/pet_control/pet_remote.h +++ b/engines/titanic/pet_control/pet_remote.h @@ -30,7 +30,7 @@ namespace Titanic { -class CPetRemoteGlyphs : public CPetGlyphs { +class CPetRemoteGlyphs : public CPetGlyphs { }; class CPetRemote : public CPetSection { diff --git a/engines/titanic/pet_control/pet_saves.h b/engines/titanic/pet_control/pet_saves.h index d100e8f702..8366ab6dda 100644 --- a/engines/titanic/pet_control/pet_saves.h +++ b/engines/titanic/pet_control/pet_saves.h @@ -29,7 +29,7 @@ namespace Titanic { -class CPetSaveGlyphs : public CPetGlyphs { +class CPetSaveGlyphs : public CPetGlyphs { }; class CPetSaves : public CPetSection { diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index 6f66bec7a7..3ae2636404 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -121,9 +121,9 @@ void OSMovie::proc18() { warning("TODO: OSMovie::proc18"); } -int OSMovie::proc19() { - warning("TODO: OSMovie::proc19"); - return 0; +int OSMovie::getFrame() { + assert(_video); + return _video->getCurFrame(); } void OSMovie::proc20() { diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index a871af6fc7..644f582d64 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -73,7 +73,12 @@ public: virtual void proc16() = 0; virtual void proc17() = 0; virtual void proc18() = 0; - virtual int proc19() = 0; + + /** + * Get the current movie frame + */ + virtual int getFrame() = 0; + virtual void proc20() = 0; virtual void *proc21() = 0; @@ -131,7 +136,12 @@ public: virtual void proc16(); virtual void proc17(); virtual void proc18(); - virtual int proc19(); + + /** + * Get the current movie frame + */ + virtual int getFrame(); + virtual void proc20(); virtual void *proc21(); diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index 8e079d5a60..3660ce18ea 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -157,8 +157,8 @@ void TitanicEngine::setItemNames() { for (uint idx = 0; idx < TOTAL_ITEMS; ++idx) _itemDescriptions[idx] = DESCRIPTIONS[idx]; - // Short descriptions.. maybe? - static const char *const SHORT_DESC[40] = { + // Item identifiers + static const char *const ITEM_IDS[40] = { "MaitreD Left Arm", "MaitreD Right Arm", "OlfactoryCentre", "AuditoryCentre", "SpeechCentre", "VisionCentre", "CentralCore", "Perch", "SeasonBridge", "FanBridge", "BeamBridge", "ChickenBridge", "CarryParrot", "Chicken", @@ -169,7 +169,7 @@ void TitanicEngine::setItemNames() { "Phonograph Cylinder 3", "Photograph", "Music System Key" }; for (uint idx = 0; idx < 40; ++idx) - _itemShortDesc[idx] = SHORT_DESC[idx]; + _itemIds[idx] = ITEM_IDS[idx]; } diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index f83e728ca3..f639a9c672 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -114,7 +114,7 @@ public: CString _itemNames[TOTAL_ITEMS]; CString _itemDescriptions[TOTAL_ITEMS]; CString _itemObjects[TOTAL_ITEMS]; - CString _itemShortDesc[40]; + CString _itemIds[40]; public: TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc); virtual ~TitanicEngine(); -- cgit v1.2.3 From d971edf02ea8074b71be852fdcee48e095ff49a9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 16 Apr 2016 23:16:30 -0400 Subject: TITANIC: Stubs for selecting highlighted PET glyph --- engines/titanic/pet_control/pet_control.cpp | 4 ++-- engines/titanic/pet_control/pet_glyphs.cpp | 10 +++++++--- engines/titanic/pet_control/pet_glyphs.h | 10 +++++++++- engines/titanic/pet_control/pet_inventory.cpp | 13 ++++++++++++- engines/titanic/pet_control/pet_inventory.h | 7 ++++++- 5 files changed, 36 insertions(+), 8 deletions(-) diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index b9f1359746..25ab972df9 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -371,8 +371,8 @@ void CPetControl::addToInventory(CCarry *item) { _inventory.itemsChanged(); setArea(PET_INVENTORY); - if (_currentArea != PET_INVENTORY) - _inventory.couldntShowInventory(item); + if (_currentArea == PET_INVENTORY) + _inventory.highlightItem(item); makeDirty(); CPETGainedObjectMsg msg; diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index 057025c03d..41ac4ae5e1 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -50,7 +50,7 @@ bool CPetGlyph::translateContains(const Point &delta, const Point &pt) { /*------------------------------------------------------------------------*/ void CPetGlyphs::clear() { - fn1(-1); + changeHighlight(-1); destroyContents(); _field10 = 0; } @@ -75,8 +75,12 @@ void CPetGlyphs::draw(CScreenManager *screenManager) { warning("TODO: CPetGlyphs::draw"); } -void CPetGlyphs::fn1(int val) { - warning("TODO: CPetGlyphs::fn1"); +void CPetGlyphs::changeHighlight(int index) { + warning("TODO: CPetGlyphs::changeHighlight"); +} + +void CPetGlyphs::highlight(int index) { + warning("TODO: CPetGlyphs::highlight"); } } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index 796b165e92..a34276661d 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -117,7 +117,10 @@ protected: CPetGfxElement _scrollLeft; CPetGfxElement _scrollRight; protected: - void fn1(int val); + /** + * Change the currently selected glyph + */ + void changeHighlight(int index); public: CPetGlyphs::CPetGlyphs() : _field10(0), _field14(7), _field18(-1), _field1C(-1), _field20(0), _field24(0) { @@ -145,6 +148,11 @@ public: * Draw the control */ void draw(CScreenManager *screenManager); + + /** + * Highlight a specific glyph + */ + void highlight(int index); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index f143e24ecb..e765db60ea 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -133,8 +133,19 @@ void CPetInventory::itemsChanged() { } } -void CPetInventory::couldntShowInventory(CCarry *item) { +void CPetInventory::highlightItem(CGameObject *item) { + int itemIndex = getItemIndex(item); + _items.highlight(itemIndex); +} + +int CPetInventory::getItemIndex(CGameObject *item) const { + int index = 0; + for (CGameObject *obj = _petControl->getFirstObject(); obj && obj != item; + ++index, obj = _petControl->getNextObject(obj)) { + } + return index; } + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h index 4a08c1c0b2..f228840857 100644 --- a/engines/titanic/pet_control/pet_inventory.h +++ b/engines/titanic/pet_control/pet_inventory.h @@ -48,6 +48,11 @@ private: * Handles initial setup */ bool setPetControl(CPetControl *petControl); + + /** + * Get the index of an item added to the PET + */ + int getItemIndex(CGameObject *item) const; public: CPetInventory(); @@ -111,7 +116,7 @@ public: /** * Called when the inventory can't be shown after adding an item */ - void couldntShowInventory(CCarry *item); + void highlightItem(CGameObject *item); }; } // End of namespace Titanic -- cgit v1.2.3 From 22248ccbf20535d9c14da2e376ae7ff3c9b4081b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 17 Apr 2016 15:02:01 -0400 Subject: TITANIC: Implement glyphs drawing --- engines/titanic/pet_control/pet_glyphs.cpp | 76 ++++++++++++++++++++++++++++-- engines/titanic/pet_control/pet_glyphs.h | 38 +++++++++++---- 2 files changed, 101 insertions(+), 13 deletions(-) diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index 41ac4ae5e1..fc3fcc593a 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -29,10 +29,10 @@ void CPetGlyph::setOwner(CPetControl *petControl, CPetGlyphs *owner) { _owner = owner; } -void CPetGlyph::translateDraw(CScreenManager *screenManager, int deltaX, int deltaY) { - _element.translate(deltaX, deltaY); +void CPetGlyph::drawAt(CScreenManager *screenManager, int x, int y) { + _element.translate(x, y); _element.draw(screenManager); - _element.translate(-deltaX, -deltaY); + _element.translate(-x, -y); } void CPetGlyph::proc14() { @@ -49,10 +49,14 @@ bool CPetGlyph::translateContains(const Point &delta, const Point &pt) { /*------------------------------------------------------------------------*/ +CPetGlyphs::CPetGlyphs() : _firstVisibleIndex(0), _numVisibleGlyphs(7), + _highlightIndex(-1), _field1C(-1), _field20(0), _field24(0) { +} + void CPetGlyphs::clear() { changeHighlight(-1); destroyContents(); - _field10 = 0; + _firstVisibleIndex = 0; } void CPetGlyphs::proc8() { @@ -72,7 +76,51 @@ void CPetGlyphs::proc11() { } void CPetGlyphs::draw(CScreenManager *screenManager) { - warning("TODO: CPetGlyphs::draw"); + if (_highlightIndex != -1) { + int index = getHighlightedIndex(_highlightIndex); + if (index != -1) { + Point tempPoint; + Point pt = getPosition(index); + pt -= Point(12, 13); + _selection.translate(pt.x, pt.y); + _selection.draw(screenManager); + _selection.translate(-pt.x, -pt.y); + } + } + + // Iterate through displaying glyphs on the screen + int listSize = size(); + for (int index = 0; index < _numVisibleGlyphs; ++index) { + int itemIndex = getItemIndex(index); + + if (itemIndex >= 0 && itemIndex < listSize) { + Point pt = getPosition(itemIndex); + CPetGlyph *glyph = getGlyph(itemIndex); + + if (glyph) { + // TODO: Comparison with highlighted index, and a redundant push? + glyph->drawAt(screenManager, pt.x, pt.y); + } + } + } + + // Draw scrolling arrows if more than a screen's worth of items are showing + if (listSize > _numVisibleGlyphs || _field20 != 16) { + _scrollLeft.draw(screenManager); + _scrollRight.draw(screenManager); + } + + // Handle secondary highlight + if (_highlightIndex != -1) { + CPetGlyph *glyph = getGlyph(_highlightIndex); + if (glyph) + glyph->drawHighlight(); + } +} + +Point CPetGlyphs::getPosition(int index) { + Point tempPoint(37 + index * 58, 375); + return tempPoint; } void CPetGlyphs::changeHighlight(int index) { @@ -83,4 +131,22 @@ void CPetGlyphs::highlight(int index) { warning("TODO: CPetGlyphs::highlight"); } +int CPetGlyphs::getHighlightedIndex(int index) { + int idx = index - _firstVisibleIndex; + return (idx >= 0 && idx < _numVisibleGlyphs) ? idx : -1; +} + +int CPetGlyphs::getItemIndex(int index) { + return _firstVisibleIndex + index; +} + +CPetGlyph *CPetGlyphs::getGlyph(int index) { + for (iterator i = begin(); i != end(); ++i) { + if (index-- == 0) + return *i; + } + + return nullptr; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index a34276661d..6160c454a1 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -62,9 +62,12 @@ public: * Draw the glyph at a translated position without permanently * changing the position */ - virtual void translateDraw(CScreenManager *screenManager, int deltaX, int deltaY); + virtual void drawAt(CScreenManager *screenManager, int x, int y); - virtual void proc13() {} + /** + * Handles any secondary drawing of a glyph as highlighted + */ + virtual void drawHighlight() {} virtual void proc14(); @@ -106,10 +109,31 @@ public: }; class CPetGlyphs : public List { +private: + /** + * Get a position for the glyph + */ + Point getPosition(int index); + + /** + * Returns the on-screen index for the highlight to be shown at + */ + int getHighlightedIndex(int index); + + /** + * Returns the index of a glyph given the visible on-screen glyph number + */ + int getItemIndex(int index); + + /** + * Return a specified glyph + */ + CPetGlyph *getGlyph(int index); protected: - int _field10; - int _field14; - int _field18; + int _firstVisibleIndex; + int _totalGlyphs; + int _numVisibleGlyphs; + int _highlightIndex; int _field1C; int _field20; int _field24; @@ -122,9 +146,7 @@ protected: */ void changeHighlight(int index); public: - CPetGlyphs::CPetGlyphs() : _field10(0), _field14(7), - _field18(-1), _field1C(-1), _field20(0), _field24(0) { - } + CPetGlyphs(); /** * Clears the glyph list -- cgit v1.2.3 From a11e677494d7cb3c6b8ed2c56095873d46a00ab8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 17 Apr 2016 15:24:35 -0400 Subject: TITANIC: Added item debugger command --- engines/titanic/debugger.cpp | 48 ++++++++++++++++++++++++++++++++++++++++++++ engines/titanic/debugger.h | 5 +++++ 2 files changed, 53 insertions(+) diff --git a/engines/titanic/debugger.cpp b/engines/titanic/debugger.cpp index 84f961e607..f525f4f3b9 100644 --- a/engines/titanic/debugger.cpp +++ b/engines/titanic/debugger.cpp @@ -23,6 +23,7 @@ #include "titanic/debugger.h" #include "titanic/titanic.h" #include "titanic/core/tree_item.h" +#include "titanic/pet_control/pet_control.h" namespace Titanic { @@ -31,6 +32,7 @@ Debugger::Debugger(TitanicEngine *vm) : GUI::Debugger(), _vm(vm) { registerCmd("dump", WRAP_METHOD(Debugger, cmdDump)); registerCmd("room", WRAP_METHOD(Debugger, cmdRoom)); registerCmd("pet", WRAP_METHOD(Debugger, cmdPET)); + registerCmd("item", WRAP_METHOD(Debugger, cmdItem)); } int Debugger::strToInt(const char *s) { @@ -207,4 +209,50 @@ bool Debugger::cmdPET(int argc, const char **argv) { return true; } +bool Debugger::cmdItem(int argc, const char **argv) { + if (argc == 1) { + // No parameters, so list the available items + debugPrintf("item [ [ add ]]\n"); + for (int idx = 0; idx < 40; ++idx) + debugPrintf("%s\n", g_vm->_itemIds[idx].c_str()); + } else { + // Ensure the specified name is a valid inventory item + int itemIndex; + for (itemIndex = 0; itemIndex < 40; ++itemIndex) { + if (g_vm->_itemIds[itemIndex] == argv[1]) + break; + } + if (itemIndex == 40) { + debugPrintf("Could not find item with that name\n"); + return true; + } + + // Get the item + CCarry *item = static_cast( + g_vm->_window->_project->findByName(argv[1])); + assert(item); + + if (argc == 2) { + // List it's details + CTreeItem *treeItem = item; + CString fullName; + while ((treeItem = treeItem->getParent()) != nullptr) { + if (!treeItem->getName().empty()) + fullName = treeItem->getName() + "." + fullName; + } + + debugPrintf("Current location: %s\n", fullName.c_str()); + } else if (CString(argv[2]) == "add") { + CPetControl *pet = item->getPetControl(); + pet->_visible = true; + item->addToInventory(); + return false; + } else { + debugPrintf("Unknown command\n"); + } + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/debugger.h b/engines/titanic/debugger.h index 29e82d699f..5edb7cb324 100644 --- a/engines/titanic/debugger.h +++ b/engines/titanic/debugger.h @@ -84,6 +84,11 @@ private: * Turn the PET on or off */ bool cmdPET(int argc, const char **argv); + + /** + * Item handling + */ + bool cmdItem(int argc, const char **argv); protected: TitanicEngine *_vm; public: -- cgit v1.2.3 From 46a30255b0e5a7f5dad4fd032388d31a69208b62 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 17 Apr 2016 21:08:42 -0400 Subject: TITANIC: Seperate PET classes setup and reset methods --- engines/titanic/carry/arm.cpp | 2 +- engines/titanic/carry/carry.cpp | 8 +++--- engines/titanic/carry/carry.h | 2 +- engines/titanic/carry/chicken.cpp | 2 +- engines/titanic/core/tree_item.cpp | 2 +- engines/titanic/debugger.cpp | 2 ++ engines/titanic/pet_control/pet_control.cpp | 16 +++++++++-- engines/titanic/pet_control/pet_control.h | 10 ++++++- engines/titanic/pet_control/pet_element.h | 6 ++--- engines/titanic/pet_control/pet_frame.cpp | 16 +++++------ engines/titanic/pet_control/pet_frame.h | 2 +- engines/titanic/pet_control/pet_gfx_element.cpp | 2 +- engines/titanic/pet_control/pet_gfx_element.h | 4 +-- engines/titanic/pet_control/pet_glyphs.cpp | 12 ++++++--- engines/titanic/pet_control/pet_glyphs.h | 31 +++++++++++++++++++--- engines/titanic/pet_control/pet_inventory.cpp | 24 ++++++++--------- engines/titanic/pet_control/pet_inventory.h | 8 +++--- .../titanic/pet_control/pet_inventory_glyphs.cpp | 31 +++++++++++++++++++++- engines/titanic/pet_control/pet_inventory_glyphs.h | 15 +++++++---- engines/titanic/pet_control/pet_section.h | 4 +-- 20 files changed, 142 insertions(+), 57 deletions(-) diff --git a/engines/titanic/carry/arm.cpp b/engines/titanic/carry/arm.cpp index c39812fd26..d662b43f76 100644 --- a/engines/titanic/carry/arm.cpp +++ b/engines/titanic/carry/arm.cpp @@ -172,7 +172,7 @@ bool CArm::MaitreDHappyMsg(CMaitreDHappyMsg *msg) { _visibleFrame = _field170; loadFrame(_visibleFrame); _string6 = "None"; - invFn3(); + invChange(); } } diff --git a/engines/titanic/carry/carry.cpp b/engines/titanic/carry/carry.cpp index 31d0ff02d2..cb87b94c90 100644 --- a/engines/titanic/carry/carry.cpp +++ b/engines/titanic/carry/carry.cpp @@ -240,14 +240,16 @@ bool CCarry::PassOnDragStartMsg(CPassOnDragStartMsg *msg) { void CCarry::addToInventory() { CPetControl *pet = getPetControl(); - if (pet) + if (pet) { + makeDirty(); pet->addToInventory(this); + } } -void CCarry::invFn3() { +void CCarry::invChange() { CPetControl *pet = getPetControl(); if (pet) - pet->invFn3(this); + pet->invChange(this); } } // End of namespace Titanic diff --git a/engines/titanic/carry/carry.h b/engines/titanic/carry/carry.h index 2370556607..ba782fda7e 100644 --- a/engines/titanic/carry/carry.h +++ b/engines/titanic/carry/carry.h @@ -65,7 +65,7 @@ protected: /** * */ - void invFn3(); + void invChange(); public: CLASSDEF CCarry(); diff --git a/engines/titanic/carry/chicken.cpp b/engines/titanic/carry/chicken.cpp index 74b42aafcd..8483a3fb29 100644 --- a/engines/titanic/carry/chicken.cpp +++ b/engines/titanic/carry/chicken.cpp @@ -171,7 +171,7 @@ bool CChicken::TimerMsg(CTimerMsg *msg) { } if (flag) { - invFn3(); + invChange(); stopTimer(_timerId); } diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index abd6f6c51b..039d597ece 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -280,7 +280,7 @@ void CTreeItem::clearPet() const { } CPetControl *CTreeItem::getPetControl() const { - return dynamic_cast(getDontSaveChild(CPetControl::_type)); + return static_cast(getDontSaveChild(CPetControl::_type)); } CMailMan *CTreeItem::getMailMan() const { diff --git a/engines/titanic/debugger.cpp b/engines/titanic/debugger.cpp index f525f4f3b9..d643a87a4b 100644 --- a/engines/titanic/debugger.cpp +++ b/engines/titanic/debugger.cpp @@ -244,6 +244,8 @@ bool Debugger::cmdItem(int argc, const char **argv) { debugPrintf("Current location: %s\n", fullName.c_str()); } else if (CString(argv[2]) == "add") { CPetControl *pet = item->getPetControl(); + assert(pet); + pet->_visible = true; item->addToInventory(); return false; diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 25ab972df9..31f95d1a88 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -45,6 +45,7 @@ CPetControl::CPetControl() : CGameObject(), _currentArea(PET_CONVERSATION), _fieldC0(0), _locked(0), _fieldC8(0), _treeItem1(nullptr), _treeItem2(nullptr), _hiddenRoom(nullptr), _drawBounds(20, 350, 620, 480) { + setup(); _timers[0] = _timers[1] = nullptr; _sections[PET_INVENTORY] = &_inventory; _sections[PET_CONVERSATION] = &_conversations; @@ -80,6 +81,17 @@ void CPetControl::load(SimpleFile *file) { CGameObject::load(file); } +void CPetControl::setup() { + warning("TODO: CPetControl::setup"); + _rooms.setup(this); + _remote.setup(this); + _inventory.setup(this); + _sub5.setup(this); + _saves.setup(this); + _sub7.setup(this); + _frame.setup(this); +} + bool CPetControl::isValid() { return _conversations.isValid(this) && _rooms.isValid(this) && @@ -399,8 +411,8 @@ void CPetControl::removeFromInventory(CCarry *item, bool refreshUI, bool sendMsg removeFromInventory(item, view, refreshUI, sendMsg); } -void CPetControl::invFn3(CCarry *item) { - _inventory.fn3(item); +void CPetControl::invChange(CCarry *item) { + _inventory.change(item); } void CPetControl::moveToHiddenRoom(CTreeItem *item) { diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 4192d9ebf4..1e98e3f5d8 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -124,6 +124,11 @@ public: */ virtual Rect getBounds(); + /** + * Setups the sections within the PET + */ + void setup(); + /** * Called after loading a game has finished */ @@ -224,7 +229,10 @@ public: */ void removeFromInventory(CCarry *item, bool refreshUI = true, bool sendMsg = true); - void invFn3(CCarry *item); + /** + * Called when the status of an item in the inventory has changed + */ + void invChange(CCarry *item); /** * Moves a tree item from it's original position to be under the hidden room diff --git a/engines/titanic/pet_control/pet_element.h b/engines/titanic/pet_control/pet_element.h index d4ca580349..a8f5000155 100644 --- a/engines/titanic/pet_control/pet_element.h +++ b/engines/titanic/pet_control/pet_element.h @@ -50,10 +50,10 @@ public: CPetControl *petControl) {} /** - * Sets up the element + * Reset the element */ - virtual void setup(int val, const CString &name, CPetControl *petControl) {} - + virtual void reset(const CString &name, CPetControl *petControl, PetElementMode mode) {} + /** * Draw the item */ diff --git a/engines/titanic/pet_control/pet_frame.cpp b/engines/titanic/pet_control/pet_frame.cpp index 1859b0d39f..25d67fb661 100644 --- a/engines/titanic/pet_control/pet_frame.cpp +++ b/engines/titanic/pet_control/pet_frame.cpp @@ -35,28 +35,28 @@ CPetFrame::CPetFrame() : CPetSection() { bool CPetFrame::setup(CPetControl *petControl) { if (setPetControl(petControl)) - return setup(); + return reset(); return false; } -bool CPetFrame::setup() { +bool CPetFrame::reset() { if (_petControl) { - _background.setup("PetBackground", _petControl, MODE_UNSELECTED); - _modeBackground.setup("PetModeBackground", _petControl, MODE_UNSELECTED); + _background.reset("PetBackground", _petControl, MODE_UNSELECTED); + _modeBackground.reset("PetModeBackground", _petControl, MODE_UNSELECTED); for (int idx = 0; idx < 5; ++idx) { CString resName = Common::String::format("PetMode%d", idx); - _modeButtons[idx].setup(resName, _petControl, MODE_UNSELECTED); + _modeButtons[idx].reset(resName, _petControl, MODE_UNSELECTED); } for (int idx = 0; idx < 6; ++idx) { CString resName = Common::String::format("3Pettitle%d", idx); - _titles[idx].setup(resName, _petControl, MODE_UNSELECTED); + _titles[idx].reset(resName, _petControl, MODE_UNSELECTED); } for (int idx = 0; idx < 7; ++idx) { CString resName = Common::String::format("PetIndent%d", idx); - _indent[idx].setup(resName, _petControl, MODE_UNSELECTED); + _indent[idx].reset(resName, _petControl, MODE_UNSELECTED); } } @@ -87,7 +87,7 @@ bool CPetFrame::isValid(CPetControl *petControl) { } void CPetFrame::postLoad() { - setup(); + reset(); } bool CPetFrame::setPetControl(CPetControl *petControl) { diff --git a/engines/titanic/pet_control/pet_frame.h b/engines/titanic/pet_control/pet_frame.h index ec8bd1e1d8..0bc872a33d 100644 --- a/engines/titanic/pet_control/pet_frame.h +++ b/engines/titanic/pet_control/pet_frame.h @@ -57,7 +57,7 @@ public: /** * Sets up the section */ - virtual bool setup(); + virtual bool reset(); /** * Handles mouse down messages diff --git a/engines/titanic/pet_control/pet_gfx_element.cpp b/engines/titanic/pet_control/pet_gfx_element.cpp index 7f249f0c2d..fbe9e6db53 100644 --- a/engines/titanic/pet_control/pet_gfx_element.cpp +++ b/engines/titanic/pet_control/pet_gfx_element.cpp @@ -44,7 +44,7 @@ void CPetGfxElement::setup(PetElementMode mode, const CString &name, } } -void CPetGfxElement::setup(const CString &name, CPetControl *petControl, PetElementMode mode) { +void CPetGfxElement::reset(const CString &name, CPetControl *petControl, PetElementMode mode) { if (!petControl) return; diff --git a/engines/titanic/pet_control/pet_gfx_element.h b/engines/titanic/pet_control/pet_gfx_element.h index a4c39c6d24..bc9150e04c 100644 --- a/engines/titanic/pet_control/pet_gfx_element.h +++ b/engines/titanic/pet_control/pet_gfx_element.h @@ -43,9 +43,9 @@ public: CPetControl *petControl); /** - * Setup the element + * Reset the element */ - virtual void setup(const CString &name, CPetControl *petControl, PetElementMode mode); + virtual void reset(const CString &name, CPetControl *petControl, PetElementMode mode); /** * Draw the item diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index fc3fcc593a..a9a15c5ac2 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -53,18 +53,24 @@ CPetGlyphs::CPetGlyphs() : _firstVisibleIndex(0), _numVisibleGlyphs(7), _highlightIndex(-1), _field1C(-1), _field20(0), _field24(0) { } +void CPetGlyphs::setNumVisible(int total) { + if (total > 0) + _numVisibleGlyphs = total; +} + void CPetGlyphs::clear() { changeHighlight(-1); destroyContents(); _firstVisibleIndex = 0; } -void CPetGlyphs::proc8() { +void CPetGlyphs::setup(int numVisible, CPetSection *owner) { error("TODO"); } -void CPetGlyphs::setup() { - warning("TODO: CPetGlyphs::setup"); +void CPetGlyphs::reset() { + + warning("TODO: CPetGlyphs::reset"); } void CPetGlyphs::proc10() { diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index 6160c454a1..fceca4d27e 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -30,6 +30,19 @@ namespace Titanic { class CPetGlyphs; +class CPetSection; + +enum GlyphActionMode { ACTION_REMOVE = 0, ACTION_REMOVED = 1, ACTION_CHANGE = 2 }; + +class CGlyphAction { +protected: + GlyphActionMode _mode; +public: + CGlyphAction() : _mode(ACTION_REMOVED) {} + CGlyphAction(GlyphActionMode mode) : _mode(mode) {} + + GlyphActionMode getMode() const { return _mode; } +}; class CPetGlyph : public ListItem { public: @@ -105,7 +118,11 @@ public: virtual int proc35() { return 0; } virtual void proc36() {} virtual int proc37() { return 0; } - virtual int proc38() { return 1; } + + /** + * Does a processing action on the glyph + */ + virtual bool doAction(CGlyphAction *action) { return true; } }; class CPetGlyphs : public List { @@ -148,18 +165,26 @@ protected: public: CPetGlyphs(); + /** + * Set the number of visible glyphs + */ + void setNumVisible(int total); + /** * Clears the glyph list */ void clear(); - virtual void proc8(); + /** + * The visual dimensions for the control and it's components + */ + virtual void setup(int numVisible, CPetSection *owner); /** * Set up the control */ - virtual void setup(); + virtual void reset(); virtual void proc10(); virtual void proc11(); diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index e765db60ea..ff333ed79c 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -35,11 +35,11 @@ CPetInventory::CPetInventory() : CPetSection(), } bool CPetInventory::setup(CPetControl *petControl) { - return setPetControl(petControl) && setup(); + return setPetControl(petControl) && reset(); } -bool CPetInventory::setup() { - _items.setup(); +bool CPetInventory::reset() { + _items.reset(); _sub12.setup(); // TODO @@ -80,7 +80,7 @@ bool CPetInventory::setPetControl(CPetControl *petControl) { return false; _petControl = petControl; - _items.proc8(); + _items.setup(7, this); _items.set20(28); Rect tempRect(0, 0, 52, 52); @@ -103,20 +103,18 @@ bool CPetInventory::setPetControl(CPetControl *petControl) { return true; } -void CPetInventory::addItem(CCarry *item) { +void CPetInventory::change(CCarry *item) { if (item) { - CPetCarry glyphItem(item, 2); - + CInventoryGlyphAction action(item, ACTION_CHANGE); + _items.change(&action); } - warning("TODO: CPetInventory::addItem"); } void CPetInventory::itemRemoved(CCarry *item) { - warning("TODO: CPetInventory::itemRemoved"); -} - -void CPetInventory::fn3(CCarry *item) { - warning("TODO: CPetInventory::fn3"); + if (item) { + CInventoryGlyphAction action(item, ACTION_REMOVED); + _items.change(&action); + } } void CPetInventory::itemsChanged() { diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h index f228840857..e192bf8a92 100644 --- a/engines/titanic/pet_control/pet_inventory.h +++ b/engines/titanic/pet_control/pet_inventory.h @@ -64,7 +64,7 @@ public: /** * Sets up the section */ - virtual bool setup(); + virtual bool reset(); /** * Draw the section @@ -97,17 +97,15 @@ public: virtual bool isValid(CPetControl *petControl); /** - * Add an item to the inventory + * */ - void addItem(CCarry *item); + void change(CCarry *item); /** * Called when an item has been removed from the PET */ void itemRemoved(CCarry *item); - void fn3(CCarry *item); - /** * Called when the items under the PET have changed */ diff --git a/engines/titanic/pet_control/pet_inventory_glyphs.cpp b/engines/titanic/pet_control/pet_inventory_glyphs.cpp index 2614306891..a26919965b 100644 --- a/engines/titanic/pet_control/pet_inventory_glyphs.cpp +++ b/engines/titanic/pet_control/pet_inventory_glyphs.cpp @@ -124,10 +124,39 @@ int CPetInventoryGlyph::subMode(CGameObject *item, int val) { return frameNum; } +bool CPetInventoryGlyph::doAction(CGlyphAction *action) { + CInventoryGlyphAction *invAction = static_cast(action); + CPetInventoryGlyphs *owner = static_cast(_owner); + if (!invAction) + return false; + + switch (invAction->getMode()) { + case ACTION_REMOVED: + if (invAction->_item == _item) { + _item = nullptr; + _field3C = 0; + _field34 = 0; + } + break; + + case ACTION_REMOVE: + if (_item == invAction->_item && _owner) { + int v = populateItem(_item, 0); + _field3C = owner->fn1(v); + } + } + + return true; +} + /*------------------------------------------------------------------------*/ -void CPetInventoryGlyphs::addItem(CPetCarry *item) { +bool CPetInventoryGlyphs::change(CInventoryGlyphAction *action) { + for (iterator i = begin(); i != end(); ++i) { + (*i)->doAction(action); + } + return true; } int CPetInventoryGlyphs::fn1(int val) { diff --git a/engines/titanic/pet_control/pet_inventory_glyphs.h b/engines/titanic/pet_control/pet_inventory_glyphs.h index 8c483ea60c..633aee16ac 100644 --- a/engines/titanic/pet_control/pet_inventory_glyphs.h +++ b/engines/titanic/pet_control/pet_inventory_glyphs.h @@ -52,14 +52,19 @@ public: * Set the inventory item */ void setItem(CGameObject *item, int val); + + /** + * Does a processing action on the glyph + */ + virtual bool doAction(CGlyphAction *action); }; -class CPetCarry { +class CInventoryGlyphAction : public CGlyphAction { public: - int _val; CCarry *_item; public: - CPetCarry(CCarry *item, int val) : _item(item), _val(val) {} + CInventoryGlyphAction(CCarry *item, GlyphActionMode mode) : + CGlyphAction(mode), _item(item) {} }; class CPetInventoryGlyphs : public CPetGlyphs { @@ -68,9 +73,9 @@ private: int fn1(int val); public: /** - * Add a new item to the list + * */ - void addItem(CPetCarry *item); + bool change(CInventoryGlyphAction *item); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 43ae623b37..606aac182d 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -60,9 +60,9 @@ public: virtual bool setup(CPetControl *petControl) { return false; } /** - * Sets up the section + * Reset the section */ - virtual bool setup() { return false; } + virtual bool reset() { return false; } /** * Draw the section -- cgit v1.2.3 From 11cde7b4138906c050efef73ce011777d6298cfb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 17 Apr 2016 21:54:29 -0400 Subject: TITANIC: Implement CPetGlyphs setup --- engines/titanic/pet_control/pet_glyphs.cpp | 13 +++++++++++-- engines/titanic/pet_control/pet_glyphs.h | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index a9a15c5ac2..196424121f 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -50,7 +50,7 @@ bool CPetGlyph::translateContains(const Point &delta, const Point &pt) { /*------------------------------------------------------------------------*/ CPetGlyphs::CPetGlyphs() : _firstVisibleIndex(0), _numVisibleGlyphs(7), - _highlightIndex(-1), _field1C(-1), _field20(0), _field24(0) { + _highlightIndex(-1), _field1C(-1), _field20(0), _owner(nullptr) { } void CPetGlyphs::setNumVisible(int total) { @@ -65,7 +65,16 @@ void CPetGlyphs::clear() { } void CPetGlyphs::setup(int numVisible, CPetSection *owner) { - error("TODO"); + setNumVisible(numVisible); + _owner = owner; + _selection.setBounds(Rect(0, 0, 76, 76)); + + int buttonsLeft = numVisible * 7 * 5 + 21; + + _scrollLeft.setBounds(Rect(0, 0, 31, 15)); + _scrollLeft.translate(buttonsLeft, 373); + _scrollRight.setBounds(Rect(0, 0, 31, 15)); + _scrollRight.translate(buttonsLeft, 413); } void CPetGlyphs::reset() { diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index fceca4d27e..88b6e40956 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -153,7 +153,7 @@ protected: int _highlightIndex; int _field1C; int _field20; - int _field24; + CPetSection *_owner; CPetGfxElement _selection; CPetGfxElement _scrollLeft; CPetGfxElement _scrollRight; -- cgit v1.2.3 From fc33bc4182056864b479e4abd0387deab0670ec6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 17 Apr 2016 22:00:14 -0400 Subject: TITANIC: Fix showing PET immediately when turned on via debugger --- engines/titanic/debugger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/titanic/debugger.cpp b/engines/titanic/debugger.cpp index d643a87a4b..e532a9b0f4 100644 --- a/engines/titanic/debugger.cpp +++ b/engines/titanic/debugger.cpp @@ -194,7 +194,7 @@ bool Debugger::cmdPET(int argc, const char **argv) { if (s == "on") { gameState._petActive = true; - gameManager.update(); + gameManager.initBounds(); debugPrintf("PET is now on\n"); return true; } else if (s == "off") { -- cgit v1.2.3 From ca68e85f3791aa35e5ccc0f3d6cc33a9f71f7f48 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 17 Apr 2016 22:05:44 -0400 Subject: TITANIC: Fix to partially display PET inventory --- engines/titanic/pet_control/pet_frame.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/titanic/pet_control/pet_frame.cpp b/engines/titanic/pet_control/pet_frame.cpp index 25d67fb661..ec604a2b5c 100644 --- a/engines/titanic/pet_control/pet_frame.cpp +++ b/engines/titanic/pet_control/pet_frame.cpp @@ -145,7 +145,7 @@ void CPetFrame::drawFrame(CScreenManager *screenManager) { void CPetFrame::drawIndent(CScreenManager *screenManager, int indent) { indent = CLIP(indent, 0, 7); - for (int idx = 0; idx < indent; ++indent) + for (int idx = 0; idx < indent; ++idx) _indent[idx].draw(screenManager); } -- cgit v1.2.3 From b6e093d668e9e782cc6a08a787d48c857cf53430 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 17 Apr 2016 22:30:18 -0400 Subject: TITANIC: Fix drawing glyph squares in PET inventory tab --- engines/titanic/pet_control/pet_control.cpp | 4 ++-- engines/titanic/pet_control/pet_control.h | 4 ++-- engines/titanic/pet_control/pet_frame.cpp | 24 +++++++++++++----------- engines/titanic/pet_control/pet_frame.h | 4 ++-- engines/titanic/pet_control/pet_glyphs.cpp | 2 +- engines/titanic/pet_control/pet_glyphs.h | 2 ++ engines/titanic/pet_control/pet_inventory.cpp | 2 +- 7 files changed, 23 insertions(+), 19 deletions(-) diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 31f95d1a88..fed17d5b4b 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -345,8 +345,8 @@ bool CPetControl::TimerMsg(CTimerMsg *msg) { return true; } -void CPetControl::drawIndent(CScreenManager *screenManager, int indent) { - _frame.drawIndent(screenManager, indent); +void CPetControl::drawSquares(CScreenManager *screenManager, int count) { + _frame.drawSquares(screenManager, count); } void CPetControl::displayMessage(const CString &msg) { diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 1e98e3f5d8..3726fc355f 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -179,9 +179,9 @@ public: CRoomItem *getHiddenRoom(); /** - * Draws the indent + * Draws squares for showing glyphs inside */ - void drawIndent(CScreenManager *screenManager, int indent); + void drawSquares(CScreenManager *screenManager, int count); /** * Returns true if the point is within the PET's draw bounds diff --git a/engines/titanic/pet_control/pet_frame.cpp b/engines/titanic/pet_control/pet_frame.cpp index ec604a2b5c..3269b9f837 100644 --- a/engines/titanic/pet_control/pet_frame.cpp +++ b/engines/titanic/pet_control/pet_frame.cpp @@ -54,9 +54,9 @@ bool CPetFrame::reset() { _titles[idx].reset(resName, _petControl, MODE_UNSELECTED); } - for (int idx = 0; idx < 7; ++idx) { - CString resName = Common::String::format("PetIndent%d", idx); - _indent[idx].reset(resName, _petControl, MODE_UNSELECTED); + for (int idx = 0; idx < TOTAL_GLYPHS; ++idx) { + CString resName = Common::String::format("PetIndent%d", idx + 1); + _squares[idx].reset(resName, _petControl, MODE_UNSELECTED); } } @@ -97,13 +97,15 @@ bool CPetFrame::setPetControl(CPetControl *petControl) { // Set the bounds of the individual elements _background.setBounds(Rect(20, 350, 620, 480)); _modeBackground.setBounds(Rect(590, 365, 611, 467)); - + + // Squares used for holding glyphs in various tabs Rect r(35, 373, 91, 429); - for (int idx = 0, xp = 0; xp < 490; ++idx, xp += 70) { - _indent[idx].setBounds(r); - _indent[idx].translate(xp, 0); + for (int idx = 0, xp = 0; idx < TOTAL_GLYPHS; ++idx, xp += 70) { + _squares[idx].setBounds(r); + _squares[idx].translate(xp, 0); } + // Draw the mode buttons vertically on the right edge of the PET r = Rect(590, 365, 606, 381); const int YLIST[] = { 7, 27, 45, 66, 84 }; for (int idx = 0; idx < 5; ++idx) { @@ -143,10 +145,10 @@ void CPetFrame::drawFrame(CScreenManager *screenManager) { _titles[_petControl->_currentArea].draw(screenManager); } -void CPetFrame::drawIndent(CScreenManager *screenManager, int indent) { - indent = CLIP(indent, 0, 7); - for (int idx = 0; idx < indent; ++idx) - _indent[idx].draw(screenManager); +void CPetFrame::drawSquares(CScreenManager *screenManager, int count) { + count = CLIP(count, 0, TOTAL_GLYPHS); + for (int idx = 0; idx < count; ++idx) + _squares[idx].draw(screenManager); } } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_frame.h b/engines/titanic/pet_control/pet_frame.h index 0bc872a33d..d8924e83d3 100644 --- a/engines/titanic/pet_control/pet_frame.h +++ b/engines/titanic/pet_control/pet_frame.h @@ -40,7 +40,7 @@ private: CPetGfxElement _val2; CPetGfxElement _val3; CPetGfxElement _background; - CPetGfxElement _indent[7]; + CPetGfxElement _squares[7]; private: /** * Called to set the owning PET instance and set some initial state @@ -93,7 +93,7 @@ public: /** * Draws the indent */ - void drawIndent(CScreenManager *screenManager, int indent); + void drawSquares(CScreenManager *screenManager, int count); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index 196424121f..e38efdddbe 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -49,7 +49,7 @@ bool CPetGlyph::translateContains(const Point &delta, const Point &pt) { /*------------------------------------------------------------------------*/ -CPetGlyphs::CPetGlyphs() : _firstVisibleIndex(0), _numVisibleGlyphs(7), +CPetGlyphs::CPetGlyphs() : _firstVisibleIndex(0), _numVisibleGlyphs(TOTAL_GLYPHS), _highlightIndex(-1), _field1C(-1), _field20(0), _owner(nullptr) { } diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index 88b6e40956..54abe9d72e 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -29,6 +29,8 @@ namespace Titanic { +#define TOTAL_GLYPHS 7 + class CPetGlyphs; class CPetSection; diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index ff333ed79c..5dd2078bd2 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -47,7 +47,7 @@ bool CPetInventory::reset() { } void CPetInventory::draw(CScreenManager *screenManager) { - _petControl->drawIndent(screenManager, 7); + _petControl->drawSquares(screenManager, 7); _items.draw(screenManager); _sub12.draw(screenManager); } -- cgit v1.2.3 From 456287945099266e624dd2802a567579c4d355ea Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 17 Apr 2016 23:02:15 -0400 Subject: TITANIC: Fix highlighting selected PET area button --- engines/titanic/pet_control/pet_frame.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/titanic/pet_control/pet_frame.cpp b/engines/titanic/pet_control/pet_frame.cpp index 3269b9f837..f243054bfb 100644 --- a/engines/titanic/pet_control/pet_frame.cpp +++ b/engines/titanic/pet_control/pet_frame.cpp @@ -45,12 +45,12 @@ bool CPetFrame::reset() { _modeBackground.reset("PetModeBackground", _petControl, MODE_UNSELECTED); for (int idx = 0; idx < 5; ++idx) { - CString resName = Common::String::format("PetMode%d", idx); - _modeButtons[idx].reset(resName, _petControl, MODE_UNSELECTED); + CString resName = Common::String::format("PetMode%d", idx + 1); + _modeButtons[idx].reset(resName, _petControl, MODE_SELECTED); } for (int idx = 0; idx < 6; ++idx) { - CString resName = Common::String::format("3Pettitle%d", idx); + CString resName = Common::String::format("3Pettitle%d", idx + 1); _titles[idx].reset(resName, _petControl, MODE_UNSELECTED); } @@ -110,7 +110,7 @@ bool CPetFrame::setPetControl(CPetControl *petControl) { const int YLIST[] = { 7, 27, 45, 66, 84 }; for (int idx = 0; idx < 5; ++idx) { _modeButtons[idx].setBounds(r); - _modeButtons[idx].translate(0, YLIST[idx]); + _modeButtons[idx].translate(4, YLIST[idx]); } _modeButtons[PET_AREAS[0]].setMode(MODE_SELECTED); -- cgit v1.2.3 From 5316951ba6e4403a388e49a1e23fc7858d1c3980 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 17 Apr 2016 23:09:06 -0400 Subject: TITANIC: Fix item debugger command to immediately show PET inventory --- engines/titanic/debugger.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/engines/titanic/debugger.cpp b/engines/titanic/debugger.cpp index e532a9b0f4..e02f1c8f64 100644 --- a/engines/titanic/debugger.cpp +++ b/engines/titanic/debugger.cpp @@ -210,6 +210,9 @@ bool Debugger::cmdPET(int argc, const char **argv) { } bool Debugger::cmdItem(int argc, const char **argv) { + CGameManager &gameManager = *g_vm->_window->_gameManager; + CGameState &gameState = gameManager._gameState; + if (argc == 1) { // No parameters, so list the available items debugPrintf("item [ [ add ]]\n"); @@ -243,11 +246,11 @@ bool Debugger::cmdItem(int argc, const char **argv) { debugPrintf("Current location: %s\n", fullName.c_str()); } else if (CString(argv[2]) == "add") { - CPetControl *pet = item->getPetControl(); - assert(pet); - - pet->_visible = true; + // Ensure the PET is active and add the item to the inventory + gameState._petActive = true; + gameManager.initBounds(); item->addToInventory(); + return false; } else { debugPrintf("Unknown command\n"); -- cgit v1.2.3 From 47024115941c125452bb787758091686c91fc4fb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 18 Apr 2016 11:36:39 -0400 Subject: TITANIC: Further cleanup of pet element setups --- engines/titanic/pet_control/pet_glyphs.cpp | 18 +++++++++-- engines/titanic/pet_control/pet_glyphs.h | 19 +++++++++-- engines/titanic/pet_control/pet_inventory.cpp | 37 +++++++++++++++++++++- engines/titanic/pet_control/pet_inventory.h | 6 ++++ .../titanic/pet_control/pet_inventory_glyphs.cpp | 14 ++++---- engines/titanic/pet_control/pet_inventory_glyphs.h | 10 +++--- engines/titanic/pet_control/pet_section.cpp | 4 --- engines/titanic/pet_control/pet_section.h | 6 ++-- 8 files changed, 90 insertions(+), 24 deletions(-) diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index e38efdddbe..2bf73d909c 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -21,10 +21,11 @@ */ #include "titanic/pet_control/pet_glyphs.h" +#include "titanic/pet_control/pet_section.h" namespace Titanic { -void CPetGlyph::setOwner(CPetControl *petControl, CPetGlyphs *owner) { +void CPetGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { _element.setBounds(Rect(0, 0, 52, 50)); _owner = owner; } @@ -47,6 +48,10 @@ bool CPetGlyph::translateContains(const Point &delta, const Point &pt) { return result; } +CPetSection *CPetGlyph::getPetSection() const { + return _owner ? _owner->getOwner() : nullptr; +} + /*------------------------------------------------------------------------*/ CPetGlyphs::CPetGlyphs() : _firstVisibleIndex(0), _numVisibleGlyphs(TOTAL_GLYPHS), @@ -78,8 +83,17 @@ void CPetGlyphs::setup(int numVisible, CPetSection *owner) { } void CPetGlyphs::reset() { + if (_owner && _owner->_petControl) { + CPetControl *pet = _owner->_petControl; + + _scrollLeft.reset("PetScrollLeft", pet, MODE_UNSELECTED); + _scrollRight.reset("PetScrollRight", pet, MODE_UNSELECTED); + _selection.reset("PetSelection", pet, MODE_UNSELECTED); - warning("TODO: CPetGlyphs::reset"); + for (iterator i = begin(); i != end(); ++i) { + (*i)->reset(); + } + } } void CPetGlyphs::proc10() { diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index 54abe9d72e..c9962bdb2a 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -47,6 +47,11 @@ public: }; class CPetGlyph : public ListItem { +protected: + /** + * Get the overall pet section owner + */ + CPetSection *getPetSection() const; public: CPetGfxElement _element; CPetGlyphs *_owner; @@ -64,11 +69,14 @@ public: void translateBack(const Point &pt) { _element.translate(-pt.x, -pt.y); } /** - * Set the glyph + * Setup the glyph */ - virtual void setOwner(CPetControl *petControl, CPetGlyphs *owner); + virtual void setup(CPetControl *petControl, CPetGlyphs *owner); - virtual int proc9() { return 0; } + /** + * Reset the glyph + */ + virtual bool reset() { return false; } virtual void proc10() {} virtual void proc11() {} @@ -202,6 +210,11 @@ public: * Highlight a specific glyph */ void highlight(int index); + + /** + * Get the owning section for the glyphs + */ + CPetSection *getOwner() const { return _owner; } }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index 5dd2078bd2..2d11bc11b3 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -123,7 +123,7 @@ void CPetInventory::itemsChanged() { CGameObject *item = _petControl->getFirstObject(); while (item) { CPetInventoryGlyph *glyph = new CPetInventoryGlyph(); - glyph->setOwner(_petControl, &_items); + glyph->setup(_petControl, &_items); glyph->setItem(item, _field290); _items.push_back(glyph); @@ -145,5 +145,40 @@ int CPetInventory::getItemIndex(CGameObject *item) const { return index; } +CGameObject *CPetInventory::getImage(int index) { + if (index >= 0 && index < 46) { + int offset = index - 20; + int bits; + switch (offset) { + case 0: + bits = 4; + break; + case 1: + bits = 8; + break; + case 2: + bits = 1; + break; + case 23: + bits = 2; + break; + case 36: + bits = 32; + break; + case 39: + bits = 16; + break; + default: + break; + } + + if (!(bits & _field298)) { + _field298 = bits | _field298; + return _itemGlyphs[index]; + } + } + + return nullptr; +} } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h index e192bf8a92..fca9dede14 100644 --- a/engines/titanic/pet_control/pet_inventory.h +++ b/engines/titanic/pet_control/pet_inventory.h @@ -96,6 +96,10 @@ public: */ virtual bool isValid(CPetControl *petControl); + virtual CGameObject *getBackground(int index) const { + return (index >= 0 && index < 46) ? _itemBackgrounds[index] : nullptr; + } + /** * */ @@ -115,6 +119,8 @@ public: * Called when the inventory can't be shown after adding an item */ void highlightItem(CGameObject *item); + + CGameObject *getImage(int index); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory_glyphs.cpp b/engines/titanic/pet_control/pet_inventory_glyphs.cpp index a26919965b..6ce130f22d 100644 --- a/engines/titanic/pet_control/pet_inventory_glyphs.cpp +++ b/engines/titanic/pet_control/pet_inventory_glyphs.cpp @@ -22,6 +22,7 @@ #include "common/textconsole.h" #include "titanic/pet_control/pet_inventory_glyphs.h" +#include "titanic/pet_control/pet_inventory.h" #include "titanic/titanic.h" namespace Titanic { @@ -38,8 +39,8 @@ void CPetInventoryGlyph::setItem(CGameObject *item, int val) { if (_owner && item) { int v1 = populateItem(item, val); - _field3C = static_cast(_owner)->fn1(v1); - warning("TODO: CPetInventoryGlyph::setItem"); + _background = static_cast(_owner)->getBackground(v1); + _image = static_cast(getPetSection())->getImage(v1); } } @@ -134,7 +135,7 @@ bool CPetInventoryGlyph::doAction(CGlyphAction *action) { case ACTION_REMOVED: if (invAction->_item == _item) { _item = nullptr; - _field3C = 0; + _background = nullptr; _field34 = 0; } break; @@ -142,7 +143,7 @@ bool CPetInventoryGlyph::doAction(CGlyphAction *action) { case ACTION_REMOVE: if (_item == invAction->_item && _owner) { int v = populateItem(_item, 0); - _field3C = owner->fn1(v); + _background = owner->getBackground(v); } } @@ -159,9 +160,8 @@ bool CPetInventoryGlyphs::change(CInventoryGlyphAction *action) { return true; } -int CPetInventoryGlyphs::fn1(int val) { - warning("TODO: CPetInventoryGlyphs::fn1"); - return 0; +CGameObject *CPetInventoryGlyphs::getBackground(int index) { + return _owner ? _owner->getBackground(index) : nullptr; } } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory_glyphs.h b/engines/titanic/pet_control/pet_inventory_glyphs.h index 633aee16ac..190bce77ac 100644 --- a/engines/titanic/pet_control/pet_inventory_glyphs.h +++ b/engines/titanic/pet_control/pet_inventory_glyphs.h @@ -40,13 +40,13 @@ private: public: CGameObject *_item; int _field34; - int _field3C; - int _field40; + CGameObject *_background; + CGameObject *_image; public: CPetInventoryGlyph() : _item(nullptr), _field34(0), - _field3C(0), _field40(0) {} + _background(nullptr), _image(nullptr) {} CPetInventoryGlyph(CCarry *item, int val) : _item(item), - _field34(val), _field3C(0), _field40(0) {} + _field34(val), _background(nullptr), _image(nullptr) {} /** * Set the inventory item @@ -70,7 +70,7 @@ public: class CPetInventoryGlyphs : public CPetGlyphs { friend class CPetInventoryGlyph; private: - int fn1(int val); + CGameObject *getBackground(int index); public: /** * diff --git a/engines/titanic/pet_control/pet_section.cpp b/engines/titanic/pet_control/pet_section.cpp index 349fa40fcf..f913ac6b50 100644 --- a/engines/titanic/pet_control/pet_section.cpp +++ b/engines/titanic/pet_control/pet_section.cpp @@ -49,8 +49,4 @@ void CPetSection::proc30() { error("TODO"); } -void CPetSection::proc31() { - error("TODO"); -} - } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 606aac182d..07b935a318 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -48,7 +48,7 @@ struct CPetSectionSubData { }; class CPetSection { -protected: +public: CPetControl *_petControl; public: CPetSection() : _petControl(nullptr) {} @@ -144,7 +144,9 @@ public: virtual void proc28(); virtual void proc29(); virtual void proc30(); - virtual void proc31(); + + virtual CGameObject *getBackground(int index) const { return nullptr; } + virtual void proc32() {} virtual void proc33() {} virtual void proc34() {} -- cgit v1.2.3 From 42206332d0d7474dfead288c643ef4980c739773 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 18 Apr 2016 17:25:58 -0400 Subject: TITANIC: Adding new class stubs for PET Real Life btns & elements --- engines/titanic/module.mk | 8 +- engines/titanic/pet_control/pet_control.cpp | 14 +-- engines/titanic/pet_control/pet_control.h | 4 +- engines/titanic/pet_control/pet_frame.cpp | 2 +- engines/titanic/pet_control/pet_load.cpp | 28 ++++++ engines/titanic/pet_control/pet_load.h | 35 +++++++ engines/titanic/pet_control/pet_load_save.cpp | 28 ++++++ engines/titanic/pet_control/pet_load_save.h | 39 ++++++++ engines/titanic/pet_control/pet_quit.cpp | 28 ++++++ engines/titanic/pet_control/pet_quit.h | 41 ++++++++ engines/titanic/pet_control/pet_real_life.cpp | 57 +++++++++++ engines/titanic/pet_control/pet_real_life.h | 135 ++++++++++++++++++++++++++ engines/titanic/pet_control/pet_save.cpp | 27 ++++++ engines/titanic/pet_control/pet_save.h | 35 +++++++ engines/titanic/pet_control/pet_saves.cpp | 32 ------ engines/titanic/pet_control/pet_saves.h | 48 --------- engines/titanic/pet_control/pet_section.h | 2 +- engines/titanic/pet_control/pet_slider.cpp | 89 +++++++++++++++++ engines/titanic/pet_control/pet_slider.h | 85 ++++++++++++++++ engines/titanic/pet_control/pet_sound.cpp | 29 ++++++ engines/titanic/pet_control/pet_sound.h | 41 ++++++++ 21 files changed, 715 insertions(+), 92 deletions(-) create mode 100644 engines/titanic/pet_control/pet_load.cpp create mode 100644 engines/titanic/pet_control/pet_load.h create mode 100644 engines/titanic/pet_control/pet_load_save.cpp create mode 100644 engines/titanic/pet_control/pet_load_save.h create mode 100644 engines/titanic/pet_control/pet_quit.cpp create mode 100644 engines/titanic/pet_control/pet_quit.h create mode 100644 engines/titanic/pet_control/pet_real_life.cpp create mode 100644 engines/titanic/pet_control/pet_real_life.h create mode 100644 engines/titanic/pet_control/pet_save.cpp create mode 100644 engines/titanic/pet_control/pet_save.h delete mode 100644 engines/titanic/pet_control/pet_saves.cpp delete mode 100644 engines/titanic/pet_control/pet_saves.h create mode 100644 engines/titanic/pet_control/pet_slider.cpp create mode 100644 engines/titanic/pet_control/pet_slider.h create mode 100644 engines/titanic/pet_control/pet_sound.cpp create mode 100644 engines/titanic/pet_control/pet_sound.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index da642f9a3a..fc2b4ef7fc 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -365,7 +365,7 @@ MODULE_OBJS := \ pet_control/pet_inventory_glyphs.o \ pet_control/pet_rooms.o \ pet_control/pet_remote.o \ - pet_control/pet_saves.o \ + pet_control/pet_real_life.o \ pet_control/pet_section.o \ pet_control/pet_control_sub5.o \ pet_control/pet_control_sub7.o \ @@ -376,12 +376,18 @@ MODULE_OBJS := \ pet_control/pet_graphic.o \ pet_control/pet_glyphs.o \ pet_control/pet_leaf.o \ + pet_control/pet_load.o \ + pet_control/pet_load_save.o \ pet_control/pet_mode_off.o \ pet_control/pet_mode_on.o \ pet_control/pet_mode_panel.o \ pet_control/pet_pannel1.o \ pet_control/pet_pannel2.o \ pet_control/pet_pannel3.o \ + pet_control/pet_quit.o \ + pet_control/pet_save.o \ + pet_control/pet_slider.o \ + pet_control/pet_sound.o \ sound/auto_music_player.o \ sound/auto_music_player_base.o \ sound/auto_sound_player.o \ diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index fed17d5b4b..0bba2c2330 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -51,7 +51,7 @@ CPetControl::CPetControl() : CGameObject(), _sections[PET_CONVERSATION] = &_conversations; _sections[PET_REMOTE] = &_remote; _sections[PET_ROOMS] = &_rooms; - _sections[PET_SAVE] = &_saves; + _sections[PET_REAL_LIFE] = &_realLife; _sections[PET_5] = &_sub5; _sections[PET_6] = &_sub7; } @@ -87,7 +87,7 @@ void CPetControl::setup() { _remote.setup(this); _inventory.setup(this); _sub5.setup(this); - _saves.setup(this); + _realLife.setup(this); _sub7.setup(this); _frame.setup(this); } @@ -98,7 +98,7 @@ bool CPetControl::isValid() { _remote.isValid(this) && _inventory.isValid(this) && _sub5.isValid(this) && - _saves.isValid(this) && + _realLife.isValid(this) && _sub7.isValid(this) && _frame.isValid(this); } @@ -109,7 +109,7 @@ void CPetControl::loadAreas(SimpleFile *file, int param) { _remote.load(file, param); _inventory.load(file, param); _sub5.load(file, param); - _saves.load(file, param); + _realLife.load(file, param); _sub7.load(file, param); _frame.load(file, param); } @@ -120,7 +120,7 @@ void CPetControl::saveAreas(SimpleFile *file, int indent) const { _remote.save(file, indent); _inventory.save(file, indent); _sub5.save(file, indent); - _saves.save(file, indent); + _realLife.save(file, indent); _sub7.save(file, indent); _frame.save(file, indent); } @@ -165,7 +165,7 @@ void CPetControl::loaded() { _remote.postLoad(); _inventory.postLoad(); _sub5.postLoad(); - _saves.postLoad(); + _realLife.postLoad(); _sub7.postLoad(); _frame.postLoad(); } @@ -330,7 +330,7 @@ bool CPetControl::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { break; case Common::KEYCODE_F5: result = true; - setArea(PET_SAVE); + setArea(PET_REAL_LIFE); break; default: break; diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 3726fc355f..e7ec993ba9 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -31,9 +31,9 @@ #include "titanic/pet_control/pet_conversations.h" #include "titanic/pet_control/pet_frame.h" #include "titanic/pet_control/pet_inventory.h" +#include "titanic/pet_control/pet_real_life.h" #include "titanic/pet_control/pet_remote.h" #include "titanic/pet_control/pet_rooms.h" -#include "titanic/pet_control/pet_saves.h" #include "titanic/pet_control/pet_control_sub5.h" #include "titanic/pet_control/pet_control_sub7.h" @@ -50,7 +50,7 @@ private: CPetInventory _inventory; CPetRemote _remote; CPetRoomsSection _rooms; - CPetSaves _saves; + CPetRealLife _realLife; CPetControlSub5 _sub5; CPetControlSub7 _sub7; CPetFrame _frame; diff --git a/engines/titanic/pet_control/pet_frame.cpp b/engines/titanic/pet_control/pet_frame.cpp index f243054bfb..a9f45fa746 100644 --- a/engines/titanic/pet_control/pet_frame.cpp +++ b/engines/titanic/pet_control/pet_frame.cpp @@ -27,7 +27,7 @@ namespace Titanic { static const PetArea PET_AREAS[6] = { PET_CONVERSATION, PET_INVENTORY, PET_REMOTE, - PET_ROOMS, PET_SAVE, PET_5 + PET_ROOMS, PET_REAL_LIFE, PET_5 }; CPetFrame::CPetFrame() : CPetSection() { diff --git a/engines/titanic/pet_control/pet_load.cpp b/engines/titanic/pet_control/pet_load.cpp new file mode 100644 index 0000000000..1008425604 --- /dev/null +++ b/engines/titanic/pet_control/pet_load.cpp @@ -0,0 +1,28 @@ +/* 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 "titanic/pet_control/pet_load.h" + +namespace Titanic { + + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_load.h b/engines/titanic/pet_control/pet_load.h new file mode 100644 index 0000000000..297cb97c54 --- /dev/null +++ b/engines/titanic/pet_control/pet_load.h @@ -0,0 +1,35 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_LOAD_H +#define TITANIC_PET_LOAD_H + +#include "titanic/pet_control/pet_load_save.h" + +namespace Titanic { + +class CPetLoad : public CPetLoadSave { +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_LOAD_H */ diff --git a/engines/titanic/pet_control/pet_load_save.cpp b/engines/titanic/pet_control/pet_load_save.cpp new file mode 100644 index 0000000000..7660b717c6 --- /dev/null +++ b/engines/titanic/pet_control/pet_load_save.cpp @@ -0,0 +1,28 @@ +/* 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 "titanic/pet_control/pet_load_save.h" + +namespace Titanic { + + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_load_save.h b/engines/titanic/pet_control/pet_load_save.h new file mode 100644 index 0000000000..780fd75af0 --- /dev/null +++ b/engines/titanic/pet_control/pet_load_save.h @@ -0,0 +1,39 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_LOAD_SAVE_H +#define TITANIC_PET_LOAD_SAVE_H + +#include "titanic/pet_control/pet_glyphs.h" + +namespace Titanic { + +class CPetLoadSave : public CPetGlyph { +protected: + CPetGfxElement _element1; + CPetGfxElement _element2; +public: +}; + +} // End of namespace Titanic + +#endif diff --git a/engines/titanic/pet_control/pet_quit.cpp b/engines/titanic/pet_control/pet_quit.cpp new file mode 100644 index 0000000000..da757f5ba4 --- /dev/null +++ b/engines/titanic/pet_control/pet_quit.cpp @@ -0,0 +1,28 @@ +/* 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 "titanic/pet_control/pet_quit.h" + +namespace Titanic { + + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_quit.h b/engines/titanic/pet_control/pet_quit.h new file mode 100644 index 0000000000..28b4b87c43 --- /dev/null +++ b/engines/titanic/pet_control/pet_quit.h @@ -0,0 +1,41 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_QUIT_H +#define TITANIC_PET_QUIT_H + +#include "titanic/pet_control/pet_gfx_element.h" +#include "titanic/pet_control/pet_glyphs.h" +#include "titanic/pet_control/pet_control_sub12.h" + +namespace Titanic { + +class CPetQuit : public CPetGlyph { +private: + CPetControlSub12 _sub12; + CPetGfxElement _element; +public: +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_QUIT_H */ diff --git a/engines/titanic/pet_control/pet_real_life.cpp b/engines/titanic/pet_control/pet_real_life.cpp new file mode 100644 index 0000000000..3ec3317bb8 --- /dev/null +++ b/engines/titanic/pet_control/pet_real_life.cpp @@ -0,0 +1,57 @@ +/* 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 "titanic/pet_control/pet_real_life.h" +#include "titanic/pet_control/pet_control.h" + +namespace Titanic { + +bool CPetRealLife::setup(CPetControl *petControl) { + if (petControl && setupControl(petControl)) + return reset(); + return false; +} + +bool CPetRealLife::reset() { + return true; +} + +void CPetRealLife::draw(CScreenManager *screenManager) { + _petControl->drawSquares(screenManager, 4); + _glyphs.draw(screenManager); + _sub12.draw(screenManager); +} + +bool CPetRealLife::setupControl(CPetControl *petControl) { + if (petControl) { + + } + + return true; +} + +bool CPetRealLife::isValid(CPetControl *petControl) { + setupControl(petControl); + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_real_life.h b/engines/titanic/pet_control/pet_real_life.h new file mode 100644 index 0000000000..57d0b317ba --- /dev/null +++ b/engines/titanic/pet_control/pet_real_life.h @@ -0,0 +1,135 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_REAL_LIFE_H +#define TITANIC_PET_REAL_LIFE_H + +#include "titanic/pet_control/pet_section.h" +#include "titanic/pet_control/pet_glyphs.h" +#include "titanic/pet_control/pet_control_sub12.h" + +namespace Titanic { + +class CPetSaveGlyphs : public CPetGlyphs { +}; + +class CPetRealLife : public CPetSection { +private: + CPetGlyphs _glyphs; + CPetSaveGlyphs _sub12; +private: + /** + * Does setup + */ + bool setupControl(CPetControl *petControl); +public: + virtual ~CPetRealLife() {} + + /** + * Sets up the section + */ + virtual bool setup(CPetControl *petControl); + + /** + * Reset the section + */ + virtual bool reset(); + + /** + * Draw the section + */ + virtual void draw(CScreenManager *screenManager); + + /** + * Get the bounds for the section + */ + virtual Rect getBounds() { return Rect(); } + + virtual void proc5(int val) {} + + /** + * Following are handlers for the various messages that the PET can + * pass onto the currently active section/area + */ + virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg) { return false; } + virtual bool MouseDragStartMsg(CMouseDragStartMsg *msg) { return false; } + virtual bool MouseDragMoveMsg(CMouseDragMoveMsg *msg) { return false; } + virtual bool MouseDragEndMsg(CMouseDragEndMsg *msg) { return false; } + virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg) { return false; } + virtual bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { return false; } + virtual bool KeyCharMsg(CKeyCharMsg *msg) { return false; } + virtual bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { return false; } + + virtual int proc14() { return 0; } + + /** + * Returns item a drag-drop operation has dropped on, if any + */ + virtual CGameObject *dragEnd(const Point &pt) const { return nullptr; } + + /** + * Display a message + */ + virtual void displayMessage(const CString &msg) {} + + /** + * Returns true if the object is in a valid state + */ + virtual bool isValid(CPetControl *petControl); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file, int param) {} + + /** + * Called after a game has been loaded + */ + virtual void postLoad() {} + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const {} + + /** + * Called when a section is switched to + */ + virtual void enter(PetArea oldArea) {} + + /** + * Called when a section is being left, to switch to another area + */ + virtual void leave() {} + + virtual void proc23() {} + + /** + * Called when a new room is entered + */ + virtual void enterRoom(CRoomItem *room) {} + +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_REAL_LIFE_H */ diff --git a/engines/titanic/pet_control/pet_save.cpp b/engines/titanic/pet_control/pet_save.cpp new file mode 100644 index 0000000000..d8835e1920 --- /dev/null +++ b/engines/titanic/pet_control/pet_save.cpp @@ -0,0 +1,27 @@ +/* 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 "titanic/pet_control/pet_save.h" + +namespace Titanic { + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_save.h b/engines/titanic/pet_control/pet_save.h new file mode 100644 index 0000000000..21e59cbf96 --- /dev/null +++ b/engines/titanic/pet_control/pet_save.h @@ -0,0 +1,35 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_SAVE_H +#define TITANIC_PET_SAVE_H + +#include "titanic/pet_control/pet_load_save.h" + +namespace Titanic { + +class CPetSave : public CPetLoadSave { +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_SAVE_H */ diff --git a/engines/titanic/pet_control/pet_saves.cpp b/engines/titanic/pet_control/pet_saves.cpp deleted file mode 100644 index 0a90cc257d..0000000000 --- a/engines/titanic/pet_control/pet_saves.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 "titanic/pet_control/pet_saves.h" - -namespace Titanic { - -bool CPetSaves::isValid(CPetControl *petControl) { - // TODO - return true; -} - -} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_saves.h b/engines/titanic/pet_control/pet_saves.h deleted file mode 100644 index 8366ab6dda..0000000000 --- a/engines/titanic/pet_control/pet_saves.h +++ /dev/null @@ -1,48 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_SAVES_H -#define TITANIC_PET_SAVES_H - -#include "titanic/pet_control/pet_section.h" -#include "titanic/pet_control/pet_glyphs.h" -#include "titanic/pet_control/pet_control_sub12.h" - -namespace Titanic { - -class CPetSaveGlyphs : public CPetGlyphs { -}; - -class CPetSaves : public CPetSection { -private: - CPetSaveGlyphs _sub10; - CPetSaveGlyphs _sub12; -public: - /** - * Returns true if the object is in a valid state - */ - virtual bool isValid(CPetControl *petControl); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_SAVES_H */ diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 07b935a318..728fb49467 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -30,7 +30,7 @@ namespace Titanic { enum PetArea { PET_INVENTORY = 0, PET_CONVERSATION = 1, PET_REMOTE = 2, - PET_ROOMS = 3, PET_SAVE = 4, PET_5 = 5, PET_6 = 6 + PET_ROOMS = 3, PET_REAL_LIFE = 4, PET_5 = 5, PET_6 = 6 }; class CPetControl; diff --git a/engines/titanic/pet_control/pet_slider.cpp b/engines/titanic/pet_control/pet_slider.cpp new file mode 100644 index 0000000000..dad78d6a1e --- /dev/null +++ b/engines/titanic/pet_control/pet_slider.cpp @@ -0,0 +1,89 @@ +/* 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 "titanic/pet_control/pet_slider.h" + +namespace Titanic { + +CPetSlider::CPetSlider() { + _field4 = 0; + _field8 = 0; + _field1C = 0; + _field20 = 0; + _field24 = 0; + _field28 = 0; + _field2C = 0; + _field30 = 0; + _field34 = 0; +} + +void CPetSlider::initBounds(Rect *rect) { + if (rect) + *rect = _bounds2; + _bounds2.clear(); +} + +void CPetSlider::proc8() { + +} + +void CPetSlider::proc9() { + +} + +void CPetSlider::proc10() { + +} + +void CPetSlider::proc11() { + +} + +void CPetSlider::proc12() { + +} + +void CPetSlider::proc13() { + +} + +void CPetSlider::proc14() { + +} + +void CPetSlider::proc15() { + +} + +void CPetSlider::proc16() { + +} + +void CPetSlider::proc17() { + +} + +void CPetSlider::proc18() { + +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_slider.h b/engines/titanic/pet_control/pet_slider.h new file mode 100644 index 0000000000..acad55c4ae --- /dev/null +++ b/engines/titanic/pet_control/pet_slider.h @@ -0,0 +1,85 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_SLIDER_H +#define TITANIC_PET_SLIDER_H + +#include "titanic/support/rect.h" + +namespace Titanic { + +class CPetSlider { +private: + int _field4; + int _field8; + Rect _bounds; + int _field1C; + int _field20; + int _field24; + int _field28; + int _field2C; + int _field30; + int _field34; + Rect _bounds2; +public: + CPetSlider(); + + virtual void proc1() {} + virtual void proc2() {} + virtual void proc3() {} + virtual void proc4() {} + virtual void proc5() {} + virtual void proc6() {} + + /** + * Reset the bounds of the slider + */ + virtual void initBounds(Rect *rect); + + virtual void proc8(); + virtual void proc9(); + virtual void proc10(); + virtual void proc11(); + virtual void proc12(); + virtual void proc13(); + virtual void proc14(); + virtual void proc15(); + virtual void proc16(); + virtual void proc17(); + virtual void proc18(); + + /** + * Returns true if the passed point falls within the slider's bounds + */ + bool contains(const Point &pt) const { return _bounds.contains(pt); } +}; + +class CPetSoundSlider : public CPetSlider { +public: + +public: + +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_SLIDER_H */ diff --git a/engines/titanic/pet_control/pet_sound.cpp b/engines/titanic/pet_control/pet_sound.cpp new file mode 100644 index 0000000000..b236b1ab3d --- /dev/null +++ b/engines/titanic/pet_control/pet_sound.cpp @@ -0,0 +1,29 @@ +/* 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 "titanic/pet_control/pet_real_life.h" +#include "titanic/pet_control/pet_control.h" + +namespace Titanic { + + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_sound.h b/engines/titanic/pet_control/pet_sound.h new file mode 100644 index 0000000000..7607f95c62 --- /dev/null +++ b/engines/titanic/pet_control/pet_sound.h @@ -0,0 +1,41 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_SOUND_H +#define TITANIC_PET_SOUND_H + +#include "titanic/pet_control/pet_glyphs.h" +#include "titanic/pet_control/pet_gfx_element.h" +#include "titanic/pet_control/pet_control_sub12.h" + +namespace Titanic { + +class CPetQuit : public CPetGlyph { +private: + CPetControlSub12 _sub12; + CPetGfxElement _element; +public: +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_SOUND_H */ -- cgit v1.2.3 From 225af470883f7e8e90ea18faf6b26b29342accb9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 18 Apr 2016 22:52:11 -0400 Subject: TITANIC: Beginnings of PET RealLife Quit button --- engines/titanic/pet_control/pet_control_sub12.cpp | 8 +++++++ engines/titanic/pet_control/pet_control_sub12.h | 1 + engines/titanic/pet_control/pet_gfx_element.h | 2 +- engines/titanic/pet_control/pet_glyphs.cpp | 14 ++++++++++++ engines/titanic/pet_control/pet_glyphs.h | 15 +++++++++++++ engines/titanic/pet_control/pet_quit.cpp | 26 +++++++++++++++++++++++ engines/titanic/pet_control/pet_quit.h | 9 ++++++++ engines/titanic/pet_control/pet_section.h | 5 +++++ 8 files changed, 79 insertions(+), 1 deletion(-) diff --git a/engines/titanic/pet_control/pet_control_sub12.cpp b/engines/titanic/pet_control/pet_control_sub12.cpp index 59097e33a7..cc8d6ada10 100644 --- a/engines/titanic/pet_control/pet_control_sub12.cpp +++ b/engines/titanic/pet_control/pet_control_sub12.cpp @@ -148,4 +148,12 @@ void CPetControlSub12::mergeStrings() { } } +void CPetControlSub12::resize(uint count) { + if (!count || _array.size() == count) + return; + _array.clear(); + _array.resize(count); +} + + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub12.h b/engines/titanic/pet_control/pet_control_sub12.h index 70010f0bd9..a5296ea62e 100644 --- a/engines/titanic/pet_control/pet_control_sub12.h +++ b/engines/titanic/pet_control/pet_control_sub12.h @@ -98,6 +98,7 @@ public: */ void draw(CScreenManager *screenManager); + void resize(uint count); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_gfx_element.h b/engines/titanic/pet_control/pet_gfx_element.h index bc9150e04c..5bfeca1716 100644 --- a/engines/titanic/pet_control/pet_gfx_element.h +++ b/engines/titanic/pet_control/pet_gfx_element.h @@ -28,7 +28,7 @@ namespace Titanic { class CPetGfxElement: public CPetElement { -protected: +public: CGameObject *_object0; CGameObject *_object1; CGameObject *_object2; diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index 2bf73d909c..b121a17288 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -52,6 +52,16 @@ CPetSection *CPetGlyph::getPetSection() const { return _owner ? _owner->getOwner() : nullptr; } +CPetControl *CPetGlyph::getPetControl() const { + return _owner ? _owner->getPetControl() : nullptr; +} + +void CPetGlyph::setName(const CString &name, CPetControl *petControl) { + Rect r(0, 0, 52, 52); + _element.setBounds(r); + _element.reset(name, petControl, MODE_UNSELECTED); +} + /*------------------------------------------------------------------------*/ CPetGlyphs::CPetGlyphs() : _firstVisibleIndex(0), _numVisibleGlyphs(TOTAL_GLYPHS), @@ -178,4 +188,8 @@ CPetGlyph *CPetGlyphs::getGlyph(int index) { return nullptr; } +CPetControl *CPetGlyphs::getPetControl() const { + return _owner ? _owner->getPetControl() : nullptr; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index c9962bdb2a..2360bfa13d 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -68,6 +68,16 @@ public: */ void translateBack(const Point &pt) { _element.translate(-pt.x, -pt.y); } + /** + * Get the PET control + */ + CPetControl *getPetControl() const; + + /** + * Sets new name and default bounds for glyph + */ + void setName(const CString &name, CPetControl *petControl); + /** * Setup the glyph */ @@ -215,6 +225,11 @@ public: * Get the owning section for the glyphs */ CPetSection *getOwner() const { return _owner; } + + /** + * Get the PET control + */ + CPetControl *getPetControl() const; }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_quit.cpp b/engines/titanic/pet_control/pet_quit.cpp index da757f5ba4..a68452dfd6 100644 --- a/engines/titanic/pet_control/pet_quit.cpp +++ b/engines/titanic/pet_control/pet_quit.cpp @@ -21,8 +21,34 @@ */ #include "titanic/pet_control/pet_quit.h" +#include "titanic/pet_control/pet_real_life.h" +#include "titanic/support/rect.h" namespace Titanic { +void CPetQuit::setup(CPetControl *petControl, CPetGlyphs *owner) { + CPetGlyph::setup(petControl, owner); + Rect tempRect(0, 0, 280, 16); + tempRect.moveTo(32, 407); + _sub12.setBounds(tempRect); + _sub12.resize(3); + _sub12.setHasBorder(true); + _sub12.setup(); + + Rect elementRect(0, 0, 496, 388); + elementRect.moveTo(496, 388); + _element.setBounds(elementRect); +} + +bool CPetQuit::reset() { + CPetControl *pet = getPetControl(); + if (!pet) + return false; + + setName("PetExit", pet); + // TODO + + return true; +} } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_quit.h b/engines/titanic/pet_control/pet_quit.h index 28b4b87c43..6c54abb626 100644 --- a/engines/titanic/pet_control/pet_quit.h +++ b/engines/titanic/pet_control/pet_quit.h @@ -34,6 +34,15 @@ private: CPetControlSub12 _sub12; CPetGfxElement _element; public: + /** + * Setup the glyph + */ + virtual void setup(CPetControl *petControl, CPetGlyphs *owner); + + /** + * Reset the glyph + */ + virtual bool reset(); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 728fb49467..122781341f 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -154,6 +154,11 @@ public: virtual void proc36() {} virtual void proc37() {} virtual void proc38(int val) {} + + /** + * Get the PET control + */ + CPetControl *getPetControl() const { return _petControl; } }; } // End of namespace Titanic -- cgit v1.2.3 From 79c10ee30a5b4c8e41dc12806f432df88ff9af6f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 18 Apr 2016 23:13:19 -0400 Subject: TITANIC: Rename CPetControlSub12 to CPetText --- engines/titanic/module.mk | 4 +- engines/titanic/pet_control/pet_control_sub12.cpp | 159 -------------------- engines/titanic/pet_control/pet_control_sub12.h | 106 -------------- engines/titanic/pet_control/pet_control_sub5.h | 4 +- engines/titanic/pet_control/pet_control_sub7.h | 6 +- engines/titanic/pet_control/pet_conversations.cpp | 4 +- engines/titanic/pet_control/pet_conversations.h | 6 +- engines/titanic/pet_control/pet_inventory.cpp | 8 +- engines/titanic/pet_control/pet_inventory.h | 4 +- engines/titanic/pet_control/pet_quit.cpp | 8 +- engines/titanic/pet_control/pet_quit.h | 4 +- engines/titanic/pet_control/pet_real_life.cpp | 2 +- engines/titanic/pet_control/pet_real_life.h | 4 +- engines/titanic/pet_control/pet_remote.h | 4 +- engines/titanic/pet_control/pet_rooms.h | 4 +- engines/titanic/pet_control/pet_sound.h | 2 +- engines/titanic/pet_control/pet_text.cpp | 167 ++++++++++++++++++++++ engines/titanic/pet_control/pet_text.h | 116 +++++++++++++++ 18 files changed, 315 insertions(+), 297 deletions(-) delete mode 100644 engines/titanic/pet_control/pet_control_sub12.cpp delete mode 100644 engines/titanic/pet_control/pet_control_sub12.h create mode 100644 engines/titanic/pet_control/pet_text.cpp create mode 100644 engines/titanic/pet_control/pet_text.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index fc2b4ef7fc..65afebab9a 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -370,7 +370,6 @@ MODULE_OBJS := \ pet_control/pet_control_sub5.o \ pet_control/pet_control_sub7.o \ pet_control/pet_control_sub11.o \ - pet_control/pet_control_sub12.o \ pet_control/pet_drag_chev.o \ pet_control/pet_graphic2.o \ pet_control/pet_graphic.o \ @@ -388,6 +387,7 @@ MODULE_OBJS := \ pet_control/pet_save.o \ pet_control/pet_slider.o \ pet_control/pet_sound.o \ + pet_control/pet_text.o \ sound/auto_music_player.o \ sound/auto_music_player_base.o \ sound/auto_sound_player.o \ @@ -424,7 +424,7 @@ MODULE_OBJS := \ star_control/star_control_sub9.o \ star_control/star_control_sub10.o \ star_control/star_control_sub11.o \ - star_control/star_control_sub12.o \ + star_control/star_control_text.o \ star_control/star_control_sub13.o \ star_control/star_control_sub14.o \ star_control/star_control_sub15.o \ diff --git a/engines/titanic/pet_control/pet_control_sub12.cpp b/engines/titanic/pet_control/pet_control_sub12.cpp deleted file mode 100644 index cc8d6ada10..0000000000 --- a/engines/titanic/pet_control/pet_control_sub12.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/* 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(0), you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation(0), 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(0), 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(0), if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "titanic/pet_control/pet_control_sub12.h" - -namespace Titanic { - -CPetControlSub12::CPetControlSub12(int count) : - _stringsMerged(false), _field30(-1), _lineCount(0), _field38(-1), - _field3C(0), _field40(0), _field44(0), _backR(0xff), - _backG(0xff), _backB(0xff), _field54(0), _field58(0), - _field5C(200), _field60(0), _field64(0), _field68(0), - _field6C(0), _hasBorder(true), _field74(0), _field78(0), - _field7C(0) { - setupArrays(count); -} - -void CPetControlSub12::setupArrays(int count) { - freeArrays(); - if (count < 10 || count > 60) - count = 10; - _array.resize(count); -} - -void CPetControlSub12::freeArrays() { - _array.clear(); -} - -void CPetControlSub12::setup() { - for (int idx = 0; idx < (int)_array.size(); ++idx) { - _array[idx]._string1.clear(); - setArrayStr2(idx, _field54, _field58, _field5C); - _array[idx]._string3.clear(); - } - - _lineCount = 0; - _stringsMerged = false; -} - -void CPetControlSub12::setArrayStr2(uint idx, int val1, int val2, int val3) { - char buffer[6]; - if (!val1) - val1 = 1; - if (!val2) - val2 = 1; - if (!val3) - val3 = 1; - - buffer[0] = 27; - buffer[1] = val1; - buffer[2] = val2; - buffer[3] = val3; - buffer[4] = 27; - buffer[5] = '\0'; - _array[idx]._string2 = buffer; -} - -void CPetControlSub12::load(SimpleFile *file, int param) { - if (!param) { - int var1 = file->readNumber(); - int var2 = file->readNumber(); - uint count = file->readNumber(); - _bounds.left = file->readNumber(); - _bounds.top = file->readNumber(); - _bounds.right = file->readNumber(); - _bounds.bottom = file->readNumber(); - _field3C = file->readNumber(); - _field40 = file->readNumber(); - _field44 = file->readNumber(); - _backR = file->readNumber(); - _backG = file->readNumber(); - _backB = file->readNumber(); - _field54 = file->readNumber(); - _field58 = file->readNumber(); - _field5C = file->readNumber(); - _hasBorder = file->readNumber() != 0; - _field74 = file->readNumber(); - - warning("TODO: CPetControlSub12::load %d,%d", var1, var2); - assert(_array.size() >= count); - for (uint idx = 0; idx < count; ++idx) { - _array[idx]._string1 = file->readString(); - _array[idx]._string2 = file->readString(); - _array[idx]._string3 = file->readString(); - } - } -} - -void CPetControlSub12::draw(CScreenManager *screenManager) { - Rect tempRect = _bounds; - - if (_hasBorder) { - // Create border effect - // Top edge - tempRect.bottom = tempRect.top + 1; - screenManager->fillRect(SURFACE_BACKBUFFER, &tempRect, _backR, _backG, _backB); - - // Bottom edge - tempRect.top = _bounds.bottom - 1; - tempRect.bottom = _bounds.bottom; - screenManager->fillRect(SURFACE_BACKBUFFER, &tempRect, _backR, _backG, _backB); - - // Left edge - tempRect = _bounds; - tempRect.right = tempRect.left + 1; - screenManager->fillRect(SURFACE_BACKBUFFER, &tempRect, _backR, _backG, _backB); - - // Right edge - tempRect = _bounds; - tempRect.left = tempRect.right - 1; - screenManager->fillRect(SURFACE_BACKBUFFER, &tempRect, _backR, _backG, _backB); - } - - warning("TODO: CPetControlSub12::draw"); -} - -void CPetControlSub12::mergeStrings() { - if (!_stringsMerged) { - _lines.clear(); - - for (int idx = 0; idx < _lineCount; ++idx) { - CString line = _array[idx]._string2 + _array[idx]._string3 + - _array[idx]._string1 + "\n"; - _lines += line; - - } - - _stringsMerged = true; - } -} - -void CPetControlSub12::resize(uint count) { - if (!count || _array.size() == count) - return; - _array.clear(); - _array.resize(count); -} - - -} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub12.h b/engines/titanic/pet_control/pet_control_sub12.h deleted file mode 100644 index a5296ea62e..0000000000 --- a/engines/titanic/pet_control/pet_control_sub12.h +++ /dev/null @@ -1,106 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_CONTROL_SUB12_H -#define TITANIC_PET_CONTROL_SUB12_H - -#include "titanic/support/simple_file.h" -#include "titanic/support/screen_manager.h" - -namespace Titanic { - -class CPetControlSub12 { - struct ArrayEntry { - CString _string1; - CString _string2; - CString _string3; - }; -private: - Common::Array _array; - CString _lines; - bool _stringsMerged; - Rect _bounds; - int _field30; - int _lineCount; - int _field38; - int _field3C; - int _field40; - int _field44; - int _backR; - int _backG; - int _backB; - int _field54; - int _field58; - int _field5C; - int _field60; - int _field64; - int _field68; - int _field6C; - bool _hasBorder; - int _field74; - int _field78; - int _field7C; -private: - void setupArrays(int count); - - void freeArrays(); - - void setArrayStr2(uint idx, int val1, int val2, int val3); - - /** - * Merges the strings in the strings array - */ - void mergeStrings(); -public: - CPetControlSub12(int count = 10); - - /** - * Set up the control - */ - void setup(); - - /** - * Load the data for the control - */ - void load(SimpleFile *file, int param); - - /** - * Set the bounds for the control - */ - void setBounds(const Rect &bounds) { _bounds = bounds; } - - /** - * Sets the flag for whether to draw a frame border around the control - */ - void setHasBorder(bool val) { _hasBorder = val; } - - /** - * Draw the control - */ - void draw(CScreenManager *screenManager); - - void resize(uint count); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_SUB12_H */ diff --git a/engines/titanic/pet_control/pet_control_sub5.h b/engines/titanic/pet_control/pet_control_sub5.h index 4997bf195d..560803d938 100644 --- a/engines/titanic/pet_control/pet_control_sub5.h +++ b/engines/titanic/pet_control/pet_control_sub5.h @@ -24,7 +24,7 @@ #define TITANIC_PET_CONTROL_SUB5_H #include "titanic/pet_control/pet_section.h" -#include "titanic/pet_control/pet_control_sub12.h" +#include "titanic/pet_control/pet_text.h" #include "titanic/pet_control/pet_gfx_element.h" namespace Titanic { @@ -41,7 +41,7 @@ private: CPetGfxElement _valArray1[6]; int _field17C; int _field18C; - CPetControlSub12 _sub12; + CPetText _text; int _field20C; int _field210; public: diff --git a/engines/titanic/pet_control/pet_control_sub7.h b/engines/titanic/pet_control/pet_control_sub7.h index 5ad0ba793e..367ce840fc 100644 --- a/engines/titanic/pet_control/pet_control_sub7.h +++ b/engines/titanic/pet_control/pet_control_sub7.h @@ -24,14 +24,14 @@ #define TITANIC_PET_CONTROL_SUB7_H #include "titanic/pet_control/pet_section.h" -#include "titanic/pet_control/pet_control_sub12.h" +#include "titanic/pet_control/pet_text.h" namespace Titanic { class CPetControlSub7 : public CPetSection { private: - CPetControlSub12 _sub1; - CPetControlSub12 _sub2; + CPetText _text1; + CPetText _text2; public: /** * Returns true if the object is in a valid state diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index a4936e5703..2fbee9ed6e 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -33,8 +33,8 @@ void CPetConversations::save(SimpleFile *file, int indent) const { } void CPetConversations::load(SimpleFile *file, int param) { - _sub2.load(file, param); - _sub1.load(file, param); + _text2.load(file, param); + _text1.load(file, param); for (int idx = 0; idx < 3; ++idx) _valArray3[idx] = file->readNumber(); diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index a511c3d991..a79a513037 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -24,7 +24,7 @@ #define TITANIC_PET_CONVERSATIONS_H #include "titanic/pet_control/pet_section.h" -#include "titanic/pet_control/pet_control_sub12.h" +#include "titanic/pet_control/pet_text.h" #include "titanic/pet_control/pet_gfx_element.h" namespace Titanic { @@ -44,8 +44,8 @@ private: CPetGfxElement _val9; CPetGfxElement _valArray2[9]; int _field30C; - CPetControlSub12 _sub1; - CPetControlSub12 _sub2; + CPetText _text1; + CPetText _text2; int _valArray3[3]; int _field414; int _field418; diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index 2d11bc11b3..9a3ee83be2 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -40,7 +40,7 @@ bool CPetInventory::setup(CPetControl *petControl) { bool CPetInventory::reset() { _items.reset(); - _sub12.setup(); + _text.setup(); // TODO return true; @@ -49,7 +49,7 @@ bool CPetInventory::reset() { void CPetInventory::draw(CScreenManager *screenManager) { _petControl->drawSquares(screenManager, 7); _items.draw(screenManager); - _sub12.draw(screenManager); + _text.draw(screenManager); } Rect CPetInventory::getBounds() { @@ -97,8 +97,8 @@ bool CPetInventory::setPetControl(CPetControl *petControl) { tempRect = Rect(0, 0, 580, 15); tempRect.translate(32, 445); - _sub12.setBounds(tempRect); - _sub12.setHasBorder(false); + _text.setBounds(tempRect); + _text.setHasBorder(false); return true; } diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h index fca9dede14..32cb47edf5 100644 --- a/engines/titanic/pet_control/pet_inventory.h +++ b/engines/titanic/pet_control/pet_inventory.h @@ -26,7 +26,7 @@ #include "titanic/support/simple_file.h" #include "titanic/pet_control/pet_section.h" #include "titanic/pet_control/pet_inventory_glyphs.h" -#include "titanic/pet_control/pet_control_sub12.h" +#include "titanic/pet_control/pet_text.h" namespace Titanic { @@ -35,7 +35,7 @@ namespace Titanic { */ class CPetInventory : public CPetSection { private: - CPetControlSub12 _sub12; + CPetText _text; CPetInventoryGlyphs _items; CGameObject *_itemBackgrounds[46]; CGameObject *_itemGlyphs[46]; diff --git a/engines/titanic/pet_control/pet_quit.cpp b/engines/titanic/pet_control/pet_quit.cpp index a68452dfd6..912789e7c0 100644 --- a/engines/titanic/pet_control/pet_quit.cpp +++ b/engines/titanic/pet_control/pet_quit.cpp @@ -30,10 +30,10 @@ void CPetQuit::setup(CPetControl *petControl, CPetGlyphs *owner) { CPetGlyph::setup(petControl, owner); Rect tempRect(0, 0, 280, 16); tempRect.moveTo(32, 407); - _sub12.setBounds(tempRect); - _sub12.resize(3); - _sub12.setHasBorder(true); - _sub12.setup(); + _text.setBounds(tempRect); + _text.resize(3); + _text.setHasBorder(true); + _text.setup(); Rect elementRect(0, 0, 496, 388); elementRect.moveTo(496, 388); diff --git a/engines/titanic/pet_control/pet_quit.h b/engines/titanic/pet_control/pet_quit.h index 6c54abb626..c7843e239f 100644 --- a/engines/titanic/pet_control/pet_quit.h +++ b/engines/titanic/pet_control/pet_quit.h @@ -25,13 +25,13 @@ #include "titanic/pet_control/pet_gfx_element.h" #include "titanic/pet_control/pet_glyphs.h" -#include "titanic/pet_control/pet_control_sub12.h" +#include "titanic/pet_control/pet_text.h" namespace Titanic { class CPetQuit : public CPetGlyph { private: - CPetControlSub12 _sub12; + CPetText _text; CPetGfxElement _element; public: /** diff --git a/engines/titanic/pet_control/pet_real_life.cpp b/engines/titanic/pet_control/pet_real_life.cpp index 3ec3317bb8..0c7c4bd51f 100644 --- a/engines/titanic/pet_control/pet_real_life.cpp +++ b/engines/titanic/pet_control/pet_real_life.cpp @@ -38,7 +38,7 @@ bool CPetRealLife::reset() { void CPetRealLife::draw(CScreenManager *screenManager) { _petControl->drawSquares(screenManager, 4); _glyphs.draw(screenManager); - _sub12.draw(screenManager); + _text.draw(screenManager); } bool CPetRealLife::setupControl(CPetControl *petControl) { diff --git a/engines/titanic/pet_control/pet_real_life.h b/engines/titanic/pet_control/pet_real_life.h index 57d0b317ba..6281735e33 100644 --- a/engines/titanic/pet_control/pet_real_life.h +++ b/engines/titanic/pet_control/pet_real_life.h @@ -25,7 +25,7 @@ #include "titanic/pet_control/pet_section.h" #include "titanic/pet_control/pet_glyphs.h" -#include "titanic/pet_control/pet_control_sub12.h" +#include "titanic/pet_control/pet_text.h" namespace Titanic { @@ -35,7 +35,7 @@ class CPetSaveGlyphs : public CPetGlyphs { class CPetRealLife : public CPetSection { private: CPetGlyphs _glyphs; - CPetSaveGlyphs _sub12; + CPetText _text; private: /** * Does setup diff --git a/engines/titanic/pet_control/pet_remote.h b/engines/titanic/pet_control/pet_remote.h index 85cff3fe4f..70f6c3262c 100644 --- a/engines/titanic/pet_control/pet_remote.h +++ b/engines/titanic/pet_control/pet_remote.h @@ -25,7 +25,7 @@ #include "titanic/pet_control/pet_section.h" #include "titanic/pet_control/pet_glyphs.h" -#include "titanic/pet_control/pet_control_sub12.h" +#include "titanic/pet_control/pet_text.h" #include "titanic/pet_control/pet_gfx_element.h" namespace Titanic { @@ -47,7 +47,7 @@ private: CPetGfxElement _val9; CPetGfxElement _val10; CPetGfxElement _val11; - CPetControlSub12 _sub12; + CPetText _text; public: /** * Returns true if the object is in a valid state diff --git a/engines/titanic/pet_control/pet_rooms.h b/engines/titanic/pet_control/pet_rooms.h index a4bcefe09c..1e68873f93 100644 --- a/engines/titanic/pet_control/pet_rooms.h +++ b/engines/titanic/pet_control/pet_rooms.h @@ -25,7 +25,7 @@ #include "titanic/pet_control/pet_section.h" #include "titanic/pet_control/pet_control_sub11.h" -#include "titanic/pet_control/pet_control_sub12.h" +#include "titanic/pet_control/pet_text.h" #include "titanic/pet_control/pet_control_list_item2.h" namespace Titanic { @@ -43,7 +43,7 @@ private: int _field118; int _field11C; CPetGfxElement _val1; - CPetControlSub12 _sub12; + CPetText _text; int _field1C0; int _field1C4; int _field1C8; diff --git a/engines/titanic/pet_control/pet_sound.h b/engines/titanic/pet_control/pet_sound.h index 7607f95c62..d0a0fe19ae 100644 --- a/engines/titanic/pet_control/pet_sound.h +++ b/engines/titanic/pet_control/pet_sound.h @@ -25,7 +25,7 @@ #include "titanic/pet_control/pet_glyphs.h" #include "titanic/pet_control/pet_gfx_element.h" -#include "titanic/pet_control/pet_control_sub12.h" +#include "titanic/pet_control/pet_text.h" namespace Titanic { diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp new file mode 100644 index 0000000000..ed297a8c69 --- /dev/null +++ b/engines/titanic/pet_control/pet_text.cpp @@ -0,0 +1,167 @@ +/* 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(0), you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation(0), 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(0), 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(0), if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/pet_control/pet_text.h" + +namespace Titanic { + +CPetText::CPetText(uint count) : + _stringsMerged(false), _field30(-1), _lineCount(0), _field38(-1), + _field3C(0), _field40(0), _field44(0), _backR(0xff), + _backG(0xff), _backB(0xff), _field54(0), _field58(0), + _field5C(200), _field60(0), _field64(0), _field68(0), + _field6C(0), _hasBorder(true), _field74(0), _field78(0), + _field7C(0) { + setupArrays(count); +} + +void CPetText::setupArrays(int count) { + freeArrays(); + if (count < 10 || count > 60) + count = 10; + _array.resize(count); +} + +void CPetText::freeArrays() { + _array.clear(); +} + +void CPetText::setup() { + for (int idx = 0; idx < (int)_array.size(); ++idx) { + _array[idx]._string1.clear(); + setArrayStr2(idx, _field54, _field58, _field5C); + _array[idx]._string3.clear(); + } + + _lineCount = 0; + _stringsMerged = false; +} + +void CPetText::setArrayStr2(uint idx, int val1, int val2, int val3) { + char buffer[6]; + if (!val1) + val1 = 1; + if (!val2) + val2 = 1; + if (!val3) + val3 = 1; + + buffer[0] = 27; + buffer[1] = val1; + buffer[2] = val2; + buffer[3] = val3; + buffer[4] = 27; + buffer[5] = '\0'; + _array[idx]._string2 = buffer; +} + +void CPetText::load(SimpleFile *file, int param) { + if (!param) { + int var1 = file->readNumber(); + int var2 = file->readNumber(); + uint count = file->readNumber(); + _bounds.left = file->readNumber(); + _bounds.top = file->readNumber(); + _bounds.right = file->readNumber(); + _bounds.bottom = file->readNumber(); + _field3C = file->readNumber(); + _field40 = file->readNumber(); + _field44 = file->readNumber(); + _backR = file->readNumber(); + _backG = file->readNumber(); + _backB = file->readNumber(); + _field54 = file->readNumber(); + _field58 = file->readNumber(); + _field5C = file->readNumber(); + _hasBorder = file->readNumber() != 0; + _field74 = file->readNumber(); + + warning("TODO: CPetText::load %d,%d", var1, var2); + assert(_array.size() >= count); + for (uint idx = 0; idx < count; ++idx) { + _array[idx]._string1 = file->readString(); + _array[idx]._string2 = file->readString(); + _array[idx]._string3 = file->readString(); + } + } +} + +void CPetText::draw(CScreenManager *screenManager) { + Rect tempRect = _bounds; + + if (_hasBorder) { + // Create border effect + // Top edge + tempRect.bottom = tempRect.top + 1; + screenManager->fillRect(SURFACE_BACKBUFFER, &tempRect, _backR, _backG, _backB); + + // Bottom edge + tempRect.top = _bounds.bottom - 1; + tempRect.bottom = _bounds.bottom; + screenManager->fillRect(SURFACE_BACKBUFFER, &tempRect, _backR, _backG, _backB); + + // Left edge + tempRect = _bounds; + tempRect.right = tempRect.left + 1; + screenManager->fillRect(SURFACE_BACKBUFFER, &tempRect, _backR, _backG, _backB); + + // Right edge + tempRect = _bounds; + tempRect.left = tempRect.right - 1; + screenManager->fillRect(SURFACE_BACKBUFFER, &tempRect, _backR, _backG, _backB); + } + + warning("TODO: CPetText::draw"); +} + +void CPetText::mergeStrings() { + if (!_stringsMerged) { + _lines.clear(); + + for (int idx = 0; idx < _lineCount; ++idx) { + CString line = _array[idx]._string2 + _array[idx]._string3 + + _array[idx]._string1 + "\n"; + _lines += line; + + } + + _stringsMerged = true; + } +} + +void CPetText::resize(uint count) { + if (!count || _array.size() == count) + return; + _array.clear(); + _array.resize(count); +} + +void CPetText::setText(const CString &str) { + setup(); + changeText(str); +} + +void CPetText::changeText(const CString &str) { + warning("TODO: CPetText::changeText"); +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h new file mode 100644 index 0000000000..2cd45c68c2 --- /dev/null +++ b/engines/titanic/pet_control/pet_text.h @@ -0,0 +1,116 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_TEXT_H +#define TITANIC_PET_TEXT_H + +#include "titanic/support/simple_file.h" +#include "titanic/support/screen_manager.h" + +namespace Titanic { + +class CPetText { + struct ArrayEntry { + CString _string1; + CString _string2; + CString _string3; + }; +private: + Common::Array _array; + CString _lines; + bool _stringsMerged; + Rect _bounds; + int _field30; + int _lineCount; + int _field38; + int _field3C; + int _field40; + int _field44; + int _backR; + int _backG; + int _backB; + int _field54; + int _field58; + int _field5C; + int _field60; + int _field64; + int _field68; + int _field6C; + bool _hasBorder; + int _field74; + int _field78; + int _field7C; +private: + void setupArrays(int count); + + void freeArrays(); + + void setArrayStr2(uint idx, int val1, int val2, int val3); + + /** + * Merges the strings in the strings array + */ + void mergeStrings(); + + /** + * Change the text + */ + void changeText(const CString &str); +public: + CPetText(uint count = 10); + + /** + * Set up the control + */ + void setup(); + + /** + * Load the data for the control + */ + void load(SimpleFile *file, int param); + + /** + * Set the bounds for the control + */ + void setBounds(const Rect &bounds) { _bounds = bounds; } + + /** + * Sets the flag for whether to draw a frame border around the control + */ + void setHasBorder(bool val) { _hasBorder = val; } + + /** + * Draw the control + */ + void draw(CScreenManager *screenManager); + + void resize(uint count); + + /** + * Set the text + */ + void setText(const CString &str); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_TEXT_H */ -- cgit v1.2.3 From 9317035ab7736818afa65deda34a9f4f47cc4590 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 19 Apr 2016 12:46:03 -0400 Subject: TITANIC: Fix accidental rename in Makefile --- engines/titanic/module.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 65afebab9a..3a47bedc67 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -424,7 +424,7 @@ MODULE_OBJS := \ star_control/star_control_sub9.o \ star_control/star_control_sub10.o \ star_control/star_control_sub11.o \ - star_control/star_control_text.o \ + star_control/star_control_sub12.o \ star_control/star_control_sub13.o \ star_control/star_control_sub14.o \ star_control/star_control_sub15.o \ -- cgit v1.2.3 From c74b975081b844f90c9d43230a31005934593ff4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 19 Apr 2016 13:13:32 -0400 Subject: TITANIC: Implement CPetSection data table methods --- engines/titanic/pet_control/pet_quit.cpp | 2 ++ engines/titanic/pet_control/pet_section.cpp | 30 +++++++++++++++++++++++++++++ engines/titanic/pet_control/pet_section.h | 3 +++ 3 files changed, 35 insertions(+) diff --git a/engines/titanic/pet_control/pet_quit.cpp b/engines/titanic/pet_control/pet_quit.cpp index 912789e7c0..c31db26f54 100644 --- a/engines/titanic/pet_control/pet_quit.cpp +++ b/engines/titanic/pet_control/pet_quit.cpp @@ -46,6 +46,8 @@ bool CPetQuit::reset() { return false; setName("PetExit", pet); + uint v = getPetSection()->getDataIndex(0); + // TODO return true; diff --git a/engines/titanic/pet_control/pet_section.cpp b/engines/titanic/pet_control/pet_section.cpp index f913ac6b50..3d26fc444a 100644 --- a/engines/titanic/pet_control/pet_section.cpp +++ b/engines/titanic/pet_control/pet_section.cpp @@ -22,9 +22,22 @@ #include "common/textconsole.h" #include "titanic/pet_control/pet_section.h" +#include "titanic/pet_control/pet_control.h" namespace Titanic { +static const uint ARRAY1[6] = { + 0xA7C0DB, 0x9CFFFE, 0x73AEFF, 0xA7C0DB, 0x9CFFFE, 0 +}; + +static const uint ARRAY2[6] = { + 0x10101, 0x1013C, 0xC80101, 0x10101, 0x800101, 0 +}; + +static const uint ARRAY3[5] = { + 0x10101, 0x1013C, 0xC80101, 0x10101, 0x800101 +}; + void CPetSection::displayMessage(const CString &msg) { error("TODO"); } @@ -49,4 +62,21 @@ void CPetSection::proc30() { error("TODO"); } +uint CPetSection::getDataIndex(int index) { + return getDataTable()[index]; +} + +const uint *CPetSection::getDataTable(int index) { + if (index == -1) { + CPetControl *pet = getPetControl(); + index = pet ? pet->getState8() : 3; + } + + switch (index) { + case 1: return ARRAY1; + case 2: return ARRAY2; + default: return ARRAY3; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 122781341f..40a3151304 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -159,6 +159,9 @@ public: * Get the PET control */ CPetControl *getPetControl() const { return _petControl; } + + uint getDataIndex(int index); + const uint *getDataTable(int index = -1); }; } // End of namespace Titanic -- cgit v1.2.3 From 5e16f0b6b3da1e06bb3bc25c65f6e10536760291 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 19 Apr 2016 13:23:30 -0400 Subject: TITANIC: Implement CPetQuit reset method --- engines/titanic/pet_control/pet_quit.cpp | 8 ++++++-- engines/titanic/pet_control/pet_quit.h | 2 +- engines/titanic/pet_control/pet_text.cpp | 4 ++++ engines/titanic/pet_control/pet_text.h | 2 ++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/engines/titanic/pet_control/pet_quit.cpp b/engines/titanic/pet_control/pet_quit.cpp index c31db26f54..c489fd9d5b 100644 --- a/engines/titanic/pet_control/pet_quit.cpp +++ b/engines/titanic/pet_control/pet_quit.cpp @@ -46,9 +46,13 @@ bool CPetQuit::reset() { return false; setName("PetExit", pet); - uint v = getPetSection()->getDataIndex(0); - // TODO + uint col = getPetSection()->getDataIndex(0); + _text.setText("Are you sure you want to quit?"); + _text.setColor(0, col); + + _btnYes.reset("PetQuitOut", pet, MODE_UNSELECTED); + _btnYes.reset("PetQuitIn", pet, MODE_SELECTED); return true; } diff --git a/engines/titanic/pet_control/pet_quit.h b/engines/titanic/pet_control/pet_quit.h index c7843e239f..e1551dcb36 100644 --- a/engines/titanic/pet_control/pet_quit.h +++ b/engines/titanic/pet_control/pet_quit.h @@ -32,7 +32,7 @@ namespace Titanic { class CPetQuit : public CPetGlyph { private: CPetText _text; - CPetGfxElement _element; + CPetGfxElement _btnYes; public: /** * Setup the glyph diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index ed297a8c69..cda637a4ba 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -164,4 +164,8 @@ void CPetText::changeText(const CString &str) { warning("TODO: CPetText::changeText"); } +void CPetText::setColor(int val1, int val2) { + warning("CPetText::setColor"); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h index 2cd45c68c2..d43345cfe8 100644 --- a/engines/titanic/pet_control/pet_text.h +++ b/engines/titanic/pet_control/pet_text.h @@ -109,6 +109,8 @@ public: * Set the text */ void setText(const CString &str); + + void setColor(int val1, int val2); }; } // End of namespace Titanic -- cgit v1.2.3 From a6e76530b248c6ad61aac0fc4496e126ca6cd77b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 19 Apr 2016 21:23:52 -0400 Subject: TITANIC: Implement RealLife tab setup --- engines/titanic/pet_control/pet_element.cpp | 8 ++++---- engines/titanic/pet_control/pet_element.h | 10 +++++----- engines/titanic/pet_control/pet_glyphs.cpp | 12 ++++++------ engines/titanic/pet_control/pet_glyphs.h | 22 +++++++++++++--------- engines/titanic/pet_control/pet_inventory.cpp | 2 +- engines/titanic/pet_control/pet_quit.cpp | 27 +++++++++++++++++++++++++++ engines/titanic/pet_control/pet_quit.h | 14 ++++++++++++++ engines/titanic/pet_control/pet_real_life.cpp | 23 +++++++++++++++++++++++ engines/titanic/pet_control/pet_real_life.h | 5 +++++ engines/titanic/pet_control/pet_sound.h | 4 +--- 10 files changed, 99 insertions(+), 28 deletions(-) diff --git a/engines/titanic/pet_control/pet_element.cpp b/engines/titanic/pet_control/pet_element.cpp index 48c853cfc8..032e7fc7a0 100644 --- a/engines/titanic/pet_control/pet_element.cpp +++ b/engines/titanic/pet_control/pet_element.cpp @@ -33,7 +33,7 @@ void CPetElement::getBounds(Rect *rect) { *rect = Rect(); } -bool CPetElement::proc6(const Common::Point &pt) { +bool CPetElement::proc6(const Point &pt) { bool result = _bounds.contains(pt); if (result) setMode(MODE_SELECTED); @@ -47,18 +47,18 @@ bool CPetElement::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { return result; } -bool CPetElement::contains1(const Common::Point &pt) const { +bool CPetElement::contains1(const Point &pt) const { return _bounds.contains(pt); } -int CPetElement::proc9(const Common::Point &pt) { +int CPetElement::proc9(const Point &pt) { bool result = _bounds.contains(pt); if (result) setMode(MODE_2); return result; } -bool CPetElement::contains2(const Common::Point &pt) const { +bool CPetElement::contains2(const Point &pt) const { return _bounds.contains(pt); } diff --git a/engines/titanic/pet_control/pet_element.h b/engines/titanic/pet_control/pet_element.h index a8f5000155..8aec1fbcf6 100644 --- a/engines/titanic/pet_control/pet_element.h +++ b/engines/titanic/pet_control/pet_element.h @@ -62,27 +62,27 @@ public: /** * Draw the item */ - virtual void draw(CScreenManager *screenManager, const Common::Point &destPos) {} + virtual void draw(CScreenManager *screenManager, const Point &destPos) {} /** * Get the bounds for the element */ virtual void getBounds(Rect *rect); - virtual bool proc6(const Common::Point &pt); + virtual bool proc6(const Point &pt); virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); /** * Returns whether the passed point falls inside the item */ - virtual bool contains1(const Common::Point &pt) const; + virtual bool contains1(const Point &pt) const; - virtual int proc9(const Common::Point &pt); + virtual int proc9(const Point &pt); /** * Returns whether the passed point falls inside the item */ - virtual bool contains2(const Common::Point &pt) const; + virtual bool contains2(const Point &pt) const; /** * Plays back a range of frames in the loaded video file for the element diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index b121a17288..9e588bfed9 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -30,17 +30,17 @@ void CPetGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { _owner = owner; } -void CPetGlyph::drawAt(CScreenManager *screenManager, int x, int y) { - _element.translate(x, y); +void CPetGlyph::drawAt(CScreenManager *screenManager, const Point &pt) { + _element.translate(pt.x, pt.y); _element.draw(screenManager); - _element.translate(-x, -y); + _element.translate(-pt.x, -pt.y); } void CPetGlyph::proc14() { warning("TODO: CPetGlyph::proc14"); } -bool CPetGlyph::translateContains(const Point &delta, const Point &pt) { +bool CPetGlyph::contains(const Point &delta, const Point &pt) { translate(delta); bool result = _element.contains2(pt); translateBack(delta); @@ -138,7 +138,7 @@ void CPetGlyphs::draw(CScreenManager *screenManager) { if (glyph) { // TODO: Comparison with highlighted index, and a redundant push? - glyph->drawAt(screenManager, pt.x, pt.y); + glyph->drawAt(screenManager, pt); } } } @@ -153,7 +153,7 @@ void CPetGlyphs::draw(CScreenManager *screenManager) { if (_highlightIndex != -1) { CPetGlyph *glyph = getGlyph(_highlightIndex); if (glyph) - glyph->drawHighlight(); + glyph->draw2(screenManager); } } diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index 2360bfa13d..48351c9e44 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -33,6 +33,7 @@ namespace Titanic { class CPetGlyphs; class CPetSection; +class CPetText; enum GlyphActionMode { ACTION_REMOVE = 0, ACTION_REMOVED = 1, ACTION_CHANGE = 2 }; @@ -92,15 +93,14 @@ public: virtual void proc11() {} /** - * Draw the glyph at a translated position without permanently - * changing the position + * Draw the glyph at a specified position */ - virtual void drawAt(CScreenManager *screenManager, int x, int y); + virtual void drawAt(CScreenManager *screenManager, const Point &pt); /** - * Handles any secondary drawing of a glyph as highlighted + * Handles any secondary drawing of the glyph */ - virtual void drawHighlight() {} + virtual void draw2(CScreenManager *screenManager) {} virtual void proc14(); @@ -113,7 +113,7 @@ public: virtual int proc17() { return 0; } virtual int proc18() { return 0; } virtual int proc19() { return 0; } - virtual int proc20() { return 0; } + virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg) { return false; } virtual int proc21() { return 0; } virtual int proc22() { return 0; } virtual int proc23() { return 0; } @@ -125,12 +125,16 @@ public: virtual int proc29() { return 0; } /** - * Returns true if the glyph's bounds, shifted by a given delta, + * Returns true if the glyph's bounds, shifted to a given position, * will contain the specified point */ - virtual bool translateContains(const Point &delta, const Point &pt); + virtual bool contains(const Point &delta, const Point &pt); + + /** + * Returns the tooltip text for when the glyph is selected + */ + virtual void getTooltip(CPetText *text) {} - virtual void proc31() {} virtual void proc32() {} virtual int proc33() { return 1; } diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index 9a3ee83be2..063f019655 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -148,7 +148,7 @@ int CPetInventory::getItemIndex(CGameObject *item) const { CGameObject *CPetInventory::getImage(int index) { if (index >= 0 && index < 46) { int offset = index - 20; - int bits; + int bits = 0; switch (offset) { case 0: bits = 4; diff --git a/engines/titanic/pet_control/pet_quit.cpp b/engines/titanic/pet_control/pet_quit.cpp index c489fd9d5b..562a63f80c 100644 --- a/engines/titanic/pet_control/pet_quit.cpp +++ b/engines/titanic/pet_control/pet_quit.cpp @@ -21,8 +21,10 @@ */ #include "titanic/pet_control/pet_quit.h" +#include "titanic/pet_control/pet_control.h" #include "titanic/pet_control/pet_real_life.h" #include "titanic/support/rect.h" +#include "titanic/game_manager.h" namespace Titanic { @@ -57,4 +59,29 @@ bool CPetQuit::reset() { return true; } +void CPetQuit::draw2(CScreenManager *screenManager) { + _text.draw(screenManager); + _btnYes.draw(screenManager); +} + +bool CPetQuit::proc16(const Point &pt) { + return !_btnYes.proc6(pt); +} + +bool CPetQuit::mouseButtonDownMsg(CMouseButtonDownMsg *msg) { + CPetControl *pet = getPetControl(); + if (_btnYes.MouseButtonDownMsg(msg) && pet) { + CGameManager *gameManager = pet->getGameManager(); + if (gameManager) + gameManager->_gameState._quitGame = true; + return true; + } else { + return false; + } +} + +void CPetQuit::getTooltip(CPetText *text) { + text->setText("Quit the game."); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_quit.h b/engines/titanic/pet_control/pet_quit.h index e1551dcb36..ca207f616a 100644 --- a/engines/titanic/pet_control/pet_quit.h +++ b/engines/titanic/pet_control/pet_quit.h @@ -43,6 +43,20 @@ public: * Reset the glyph */ virtual bool reset(); + + /** + * Handles any secondary drawing of the glyph + */ + virtual void draw2(CScreenManager *screenManager); + + virtual bool proc16(const Point &pt); + + virtual bool mouseButtonDownMsg(CMouseButtonDownMsg *msg); + + /** + * Returns the tooltip text for when the glyph is selected + */ + virtual void getTooltip(CPetText *text); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_real_life.cpp b/engines/titanic/pet_control/pet_real_life.cpp index 0c7c4bd51f..8d439e9cc1 100644 --- a/engines/titanic/pet_control/pet_real_life.cpp +++ b/engines/titanic/pet_control/pet_real_life.cpp @@ -22,6 +22,10 @@ #include "titanic/pet_control/pet_real_life.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/pet_control/pet_load.h" +#include "titanic/pet_control/pet_save.h" +#include "titanic/pet_control/pet_sound.h" +#include "titanic/pet_control/pet_quit.h" namespace Titanic { @@ -43,15 +47,34 @@ void CPetRealLife::draw(CScreenManager *screenManager) { bool CPetRealLife::setupControl(CPetControl *petControl) { if (petControl) { + _petControl = petControl; + _glyphs.setup(4, this); + _glyphs.set20(6); + addButton(new CPetLoad()); + addButton(new CPetSave()); + addButton(new CPetSound()); + addButton(new CPetQuit()); + + Rect textRect(0, 0, 32, 436); + textRect.moveTo(32, 436); + _text.setBounds(textRect); + _text.setHasBorder(false); + _text.setup(); } return true; } +void CPetRealLife::addButton(CPetGlyph *glyph) { + +} + bool CPetRealLife::isValid(CPetControl *petControl) { setupControl(petControl); return true; } + + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_real_life.h b/engines/titanic/pet_control/pet_real_life.h index 6281735e33..c4c597c45f 100644 --- a/engines/titanic/pet_control/pet_real_life.h +++ b/engines/titanic/pet_control/pet_real_life.h @@ -41,6 +41,11 @@ private: * Does setup */ bool setupControl(CPetControl *petControl); + + /** + * Adds one of the four button glyphs for display + */ + void addButton(CPetGlyph *glyph); public: virtual ~CPetRealLife() {} diff --git a/engines/titanic/pet_control/pet_sound.h b/engines/titanic/pet_control/pet_sound.h index d0a0fe19ae..fcd8e9a1d9 100644 --- a/engines/titanic/pet_control/pet_sound.h +++ b/engines/titanic/pet_control/pet_sound.h @@ -29,10 +29,8 @@ namespace Titanic { -class CPetQuit : public CPetGlyph { +class CPetSound : public CPetGlyph { private: - CPetControlSub12 _sub12; - CPetGfxElement _element; public: }; -- cgit v1.2.3 From a8f8e4b69eab768f38d5cd73ceecce03bd096a4d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 19 Apr 2016 22:00:47 -0400 Subject: TITANIC: Clarified UI color methods & tables --- engines/titanic/pet_control/pet_glyphs.cpp | 3 ++- engines/titanic/pet_control/pet_glyphs.h | 2 +- engines/titanic/pet_control/pet_quit.cpp | 6 ++++-- engines/titanic/pet_control/pet_quit.h | 2 +- engines/titanic/pet_control/pet_real_life.cpp | 10 +++++++++- engines/titanic/pet_control/pet_section.cpp | 24 +++++++++++------------ engines/titanic/pet_control/pet_section.h | 12 ++++++++++-- engines/titanic/pet_control/pet_text.cpp | 28 ++++++++++++++++----------- engines/titanic/pet_control/pet_text.h | 16 +++++++++++---- 9 files changed, 68 insertions(+), 35 deletions(-) diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index 9e588bfed9..4669a1f1ec 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -25,9 +25,10 @@ namespace Titanic { -void CPetGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { +bool CPetGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { _element.setBounds(Rect(0, 0, 52, 50)); _owner = owner; + return true; } void CPetGlyph::drawAt(CScreenManager *screenManager, const Point &pt) { diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index 48351c9e44..adc7ceb5e8 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -82,7 +82,7 @@ public: /** * Setup the glyph */ - virtual void setup(CPetControl *petControl, CPetGlyphs *owner); + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); /** * Reset the glyph diff --git a/engines/titanic/pet_control/pet_quit.cpp b/engines/titanic/pet_control/pet_quit.cpp index 562a63f80c..c3d6e4e40d 100644 --- a/engines/titanic/pet_control/pet_quit.cpp +++ b/engines/titanic/pet_control/pet_quit.cpp @@ -28,7 +28,7 @@ namespace Titanic { -void CPetQuit::setup(CPetControl *petControl, CPetGlyphs *owner) { +bool CPetQuit::setup(CPetControl *petControl, CPetGlyphs *owner) { CPetGlyph::setup(petControl, owner); Rect tempRect(0, 0, 280, 16); tempRect.moveTo(32, 407); @@ -40,6 +40,8 @@ void CPetQuit::setup(CPetControl *petControl, CPetGlyphs *owner) { Rect elementRect(0, 0, 496, 388); elementRect.moveTo(496, 388); _element.setBounds(elementRect); + + return true; } bool CPetQuit::reset() { @@ -49,7 +51,7 @@ bool CPetQuit::reset() { setName("PetExit", pet); - uint col = getPetSection()->getDataIndex(0); + uint col = getPetSection()->getColor(0); _text.setText("Are you sure you want to quit?"); _text.setColor(0, col); diff --git a/engines/titanic/pet_control/pet_quit.h b/engines/titanic/pet_control/pet_quit.h index ca207f616a..213ed450d4 100644 --- a/engines/titanic/pet_control/pet_quit.h +++ b/engines/titanic/pet_control/pet_quit.h @@ -37,7 +37,7 @@ public: /** * Setup the glyph */ - virtual void setup(CPetControl *petControl, CPetGlyphs *owner); + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); /** * Reset the glyph diff --git a/engines/titanic/pet_control/pet_real_life.cpp b/engines/titanic/pet_control/pet_real_life.cpp index 8d439e9cc1..38b7125ed3 100644 --- a/engines/titanic/pet_control/pet_real_life.cpp +++ b/engines/titanic/pet_control/pet_real_life.cpp @@ -36,6 +36,11 @@ bool CPetRealLife::setup(CPetControl *petControl) { } bool CPetRealLife::reset() { + _glyphs.reset(); + uint col = getColor(0); + _text.setColor(col); + _text.setColor(0, col); + return true; } @@ -67,7 +72,10 @@ bool CPetRealLife::setupControl(CPetControl *petControl) { } void CPetRealLife::addButton(CPetGlyph *glyph) { - + if (glyph) { + if (glyph->setup(_petControl, &_glyphs)) + _glyphs.push_back(glyph); + } } bool CPetRealLife::isValid(CPetControl *petControl) { diff --git a/engines/titanic/pet_control/pet_section.cpp b/engines/titanic/pet_control/pet_section.cpp index 3d26fc444a..a41118bf76 100644 --- a/engines/titanic/pet_control/pet_section.cpp +++ b/engines/titanic/pet_control/pet_section.cpp @@ -26,15 +26,15 @@ namespace Titanic { -static const uint ARRAY1[6] = { +static const uint PALETTE1[6] = { 0xA7C0DB, 0x9CFFFE, 0x73AEFF, 0xA7C0DB, 0x9CFFFE, 0 }; -static const uint ARRAY2[6] = { +static const uint PALETTE2[6] = { 0x10101, 0x1013C, 0xC80101, 0x10101, 0x800101, 0 }; -static const uint ARRAY3[5] = { +static const uint PALETTE3[5] = { 0x10101, 0x1013C, 0xC80101, 0x10101, 0x800101 }; @@ -62,20 +62,20 @@ void CPetSection::proc30() { error("TODO"); } -uint CPetSection::getDataIndex(int index) { - return getDataTable()[index]; +uint CPetSection::getColor(uint index) { + return getColorTable()[index]; } -const uint *CPetSection::getDataTable(int index) { - if (index == -1) { +const uint *CPetSection::getColorTable(int tableNum) { + if (tableNum == -1) { CPetControl *pet = getPetControl(); - index = pet ? pet->getState8() : 3; + tableNum = pet ? pet->getState8() : 3; } - switch (index) { - case 1: return ARRAY1; - case 2: return ARRAY2; - default: return ARRAY3; + switch (tableNum) { + case 1: return PALETTE1; + case 2: return PALETTE2; + default: return PALETTE3; } } diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 40a3151304..6cc1c10333 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -160,8 +160,16 @@ public: */ CPetControl *getPetControl() const { return _petControl; } - uint getDataIndex(int index); - const uint *getDataTable(int index = -1); + /** + * Get a specified color in the currently active UI color table + */ + uint getColor(uint index); + + /** + * Get one of the game's three UI color tables. If the default + * tableNum of -1 is used, the table is taken from the game state + */ + const uint *getColorTable(int tableNum = -1); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index cda637a4ba..af00473050 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -25,12 +25,12 @@ namespace Titanic { CPetText::CPetText(uint count) : - _stringsMerged(false), _field30(-1), _lineCount(0), _field38(-1), - _field3C(0), _field40(0), _field44(0), _backR(0xff), - _backG(0xff), _backB(0xff), _field54(0), _field58(0), - _field5C(200), _field60(0), _field64(0), _field68(0), - _field6C(0), _hasBorder(true), _field74(0), _field78(0), - _field7C(0) { + _stringsMerged(false), _field30(-1), _lineCount(0), + _field38(-1), _field3C(0), _field40(0), _field44(0), + _backR(0xff), _backG(0xff), _backB(0xff), + _textR(0), _textG(0), _textB(200), + _field60(0), _field64(0), _field68(0), _field6C(0), + _hasBorder(true), _field74(0), _field78(0), _field7C(0) { setupArrays(count); } @@ -48,7 +48,7 @@ void CPetText::freeArrays() { void CPetText::setup() { for (int idx = 0; idx < (int)_array.size(); ++idx) { _array[idx]._string1.clear(); - setArrayStr2(idx, _field54, _field58, _field5C); + setArrayStr2(idx, _textR, _textG, _textB); _array[idx]._string3.clear(); } @@ -89,9 +89,9 @@ void CPetText::load(SimpleFile *file, int param) { _backR = file->readNumber(); _backG = file->readNumber(); _backB = file->readNumber(); - _field54 = file->readNumber(); - _field58 = file->readNumber(); - _field5C = file->readNumber(); + _textR = file->readNumber(); + _textG = file->readNumber(); + _textB = file->readNumber(); _hasBorder = file->readNumber() != 0; _field74 = file->readNumber(); @@ -164,8 +164,14 @@ void CPetText::changeText(const CString &str) { warning("TODO: CPetText::changeText"); } -void CPetText::setColor(int val1, int val2) { +void CPetText::setColor(int val1, uint col) { warning("CPetText::setColor"); } +void CPetText::setColor(uint col) { + _textR = col & 0xff; + _textG = (col >> 8) & 0xff; + _textB = (col >> 16) & 0xff; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h index d43345cfe8..55416fdc7d 100644 --- a/engines/titanic/pet_control/pet_text.h +++ b/engines/titanic/pet_control/pet_text.h @@ -48,9 +48,9 @@ private: int _backR; int _backG; int _backB; - int _field54; - int _field58; - int _field5C; + int _textR; + int _textG; + int _textB; int _field60; int _field64; int _field68; @@ -110,7 +110,15 @@ public: */ void setText(const CString &str); - void setColor(int val1, int val2); + /** + * Set text color + */ + void setColor(int val1, uint col); + + /** + * Set text color + */ + void setColor(uint col); }; } // End of namespace Titanic -- cgit v1.2.3 From b398a5001bb128c5e53d6ac5426b926de6b73893 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 21 Apr 2016 22:13:44 -0400 Subject: TITANIC: Implementing CPetLoad and CPetSave --- engines/titanic/core/game_object.h | 10 +- engines/titanic/pet_control/pet_element.cpp | 2 +- engines/titanic/pet_control/pet_element.h | 9 +- engines/titanic/pet_control/pet_glyphs.h | 33 +++++- engines/titanic/pet_control/pet_load.cpp | 21 ++++ engines/titanic/pet_control/pet_load.h | 31 ++++++ engines/titanic/pet_control/pet_load_save.cpp | 155 ++++++++++++++++++++++++++ engines/titanic/pet_control/pet_load_save.h | 86 +++++++++++++- engines/titanic/pet_control/pet_quit.cpp | 4 +- engines/titanic/pet_control/pet_quit.h | 6 +- engines/titanic/pet_control/pet_save.cpp | 30 +++++ engines/titanic/pet_control/pet_save.h | 35 ++++++ engines/titanic/pet_control/pet_text.cpp | 5 + engines/titanic/pet_control/pet_text.h | 2 + 14 files changed, 413 insertions(+), 16 deletions(-) diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index b987606a4c..94c3e5418d 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -106,11 +106,6 @@ protected: */ void makeDirty(const Rect &r); - /** - * Marks the area occupied by the object as dirty, requiring re-rendering - */ - void makeDirty(); - /** * Sets a new area in the PET */ @@ -321,6 +316,11 @@ public: * Returns the object's frame number */ int getFrameNumber() const { return _frameNumber; } + + /** + * Marks the area occupied by the object as dirty, requiring re-rendering + */ + void makeDirty(); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_element.cpp b/engines/titanic/pet_control/pet_element.cpp index 032e7fc7a0..db6b122c94 100644 --- a/engines/titanic/pet_control/pet_element.cpp +++ b/engines/titanic/pet_control/pet_element.cpp @@ -33,7 +33,7 @@ void CPetElement::getBounds(Rect *rect) { *rect = Rect(); } -bool CPetElement::proc6(const Point &pt) { +bool CPetElement::highlightBounds(const Point &pt) { bool result = _bounds.contains(pt); if (result) setMode(MODE_SELECTED); diff --git a/engines/titanic/pet_control/pet_element.h b/engines/titanic/pet_control/pet_element.h index 8aec1fbcf6..7ee28368b2 100644 --- a/engines/titanic/pet_control/pet_element.h +++ b/engines/titanic/pet_control/pet_element.h @@ -69,7 +69,14 @@ public: */ virtual void getBounds(Rect *rect); - virtual bool proc6(const Point &pt); + /** + * Highlights the element if the cursor is on it + */ + virtual bool highlightBounds(const Point &pt); + + /** + * Handles processing mouse button messages + */ virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); /** diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index adc7ceb5e8..9d2f283af4 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -23,6 +23,7 @@ #ifndef TITANIC_PET_GLYPHS_H #define TITANIC_PET_GLYPHS_H +#include "common/keyboard.h" #include "titanic/core/list.h" #include "titanic/pet_control/pet_gfx_element.h" #include "titanic/support/rect.h" @@ -109,17 +110,41 @@ public: */ virtual Rect getBounds() { return Rect(); } - virtual int proc16() { return 0; } + /** + * Checks and updates any highlight of the glyph or any contextual + * information it displays + */ + virtual bool checkHighlight(const Point &pt) { return false; } + virtual int proc17() { return 0; } virtual int proc18() { return 0; } virtual int proc19() { return 0; } + + /** + * Handles mouse button messages + */ virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg) { return false; } + virtual int proc21() { return 0; } virtual int proc22() { return 0; } - virtual int proc23() { return 0; } + + /** + * Handles keypresses when the glyph is focused + */ + virtual bool KeyCharMsg(Common::KeyCode key) { return false; } + virtual int proc24() { return 0; } - virtual void proc25() {} - virtual void proc26() {} + + /** + * Unhighlight any currently highlighted element + */ + virtual void unhighlightCurrent() {} + + /** + * Highlight any currently highlighted element + */ + virtual void highlightCurrent() {} + virtual void proc27() {} virtual void proc28() {} virtual int proc29() { return 0; } diff --git a/engines/titanic/pet_control/pet_load.cpp b/engines/titanic/pet_control/pet_load.cpp index 1008425604..f4be690bd2 100644 --- a/engines/titanic/pet_control/pet_load.cpp +++ b/engines/titanic/pet_control/pet_load.cpp @@ -21,8 +21,29 @@ */ #include "titanic/pet_control/pet_load.h" +#include "titanic/pet_control/pet_control.h" namespace Titanic { +bool CPetLoad::reset() { + CPetLoadSave::reset(); + + CPetControl *pet = getPetControl(); + if (pet) { + setName("PetLoad", pet); + _btnLoadSave.reset("PetLoadOut", pet, MODE_UNSELECTED); + _btnLoadSave.reset("PetLoadIn", pet, MODE_SELECTED); + } + + return true; +} + +void CPetLoad::getTooltip(CPetText *text) { + text->setText("Load the game."); +} + +void CPetLoad::execute() { + warning("TODO: CPetLoad::execute"); +} } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_load.h b/engines/titanic/pet_control/pet_load.h index 297cb97c54..093fca0977 100644 --- a/engines/titanic/pet_control/pet_load.h +++ b/engines/titanic/pet_control/pet_load.h @@ -28,6 +28,37 @@ namespace Titanic { class CPetLoad : public CPetLoadSave { +public: + /** + * Reset the glyph + */ + virtual bool reset(); + + /** + * Highlight any currently highlighted element + */ + virtual void highlightCurrent() { resetSlots(); } + + /** + * Returns the tooltip text for when the glyph is selected + */ + virtual void getTooltip(CPetText *text); + + /** + * Highlights a save slot + */ + virtual void highlightSave(int index) {} + + /** + * Unhighlight a save slot + */ + virtual void unhighlightSave(int index) {} + + /** + * Executes the loading or saving + */ + virtual void execute(); + }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_load_save.cpp b/engines/titanic/pet_control/pet_load_save.cpp index 7660b717c6..4ebe9d03b0 100644 --- a/engines/titanic/pet_control/pet_load_save.cpp +++ b/engines/titanic/pet_control/pet_load_save.cpp @@ -21,8 +21,163 @@ */ #include "titanic/pet_control/pet_load_save.h" +#include "titanic/pet_control/pet_control.h" +#include "titanic/core/project_item.h" namespace Titanic { +int CPetLoadSave::_savegameSlotNum; + +bool CPetLoadSave::setup(CPetControl *petControl, CPetGlyphs *owner) { + CPetGlyph::setup(petControl, owner); + _savegameSlotNum = -1; + + for (int idx = 0; idx < SAVEGAME_SLOTS_COUNT; ++idx) { + Rect slotRect = getSlotBounds(idx); + _slotNames[idx].setBounds(slotRect); + _slotNames[idx].resize(3); + _slotNames[idx].set30(22); + _slotNames[idx].setHasBorder(false); + _slotNames[idx].setup(); + } + + Rect r1(0, 0, 68, 52); + r1.moveTo(496, 388); + _btnLoadSave.setBounds(r1); + + Rect r2(0, 0, 168, 78); + r2.moveTo(309, 377); + _gutter.setBounds(r2); + return true; +} + +bool CPetLoadSave::reset() { + highlightChange(); + + CPetControl *pet = getPetControl(); + if (pet) { + _gutter.reset("PetSaveGutter", pet, MODE_UNSELECTED); + } + + return true; +} + +void CPetLoadSave::draw2(CScreenManager *screenManager) { + _gutter.draw(screenManager); + + for (int idx = 0; idx < SAVEGAME_SLOTS_COUNT; ++idx) + _slotNames[idx].draw(screenManager); + + _btnLoadSave.draw(screenManager); +} + +bool CPetLoadSave::checkHighlight(const Point &pt) { + if (_btnLoadSave.highlightBounds(pt)) + return true; + + checkSlotsHighlight(pt); + return false; +} + +bool CPetLoadSave::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_btnLoadSave.MouseButtonDownMsg(msg)) { + execute(); + resetSlots(); + return true; + } else { + return false; + } +} + +bool CPetLoadSave::KeyCharMsg(Common::KeyCode key) { + switch (key) { + case Common::KEYCODE_TAB: + case Common::KEYCODE_DOWN: + case Common::KEYCODE_KP2: + if (_savegameSlotNum != -1) { + highlightSlot((_savegameSlotNum + 1) % 5); + getPetControl()->makeDirty(); + } + return true; + + case Common::KEYCODE_UP: + case Common::KEYCODE_KP8: + if (_savegameSlotNum != -1) { + int slotNum = --_savegameSlotNum; + highlightSlot((slotNum == -1) ? SAVEGAME_SLOTS_COUNT - 1 : slotNum); + getPetControl()->makeDirty(); + } + return true; + + case Common::KEYCODE_RETURN: + case Common::KEYCODE_KP_ENTER: + execute(); + return true; + + default: + return false; + } +} + +Rect CPetLoadSave::getSlotBounds(int index) { + return Rect(323, 376 + index * 16, 473, 392 + index * 16); +} + +void CPetLoadSave::resetSlots() { + CPetControl *pet = getPetControl(); + CProjectItem *project = pet ? pet->getRoot() : nullptr; + + for (int idx = 0; idx < SAVEGAME_SLOTS_COUNT; ++idx) { + _slotNames[idx].setText("Empty"); + + if (project) { + warning("TODO: Get savegame name"); + } + } + + highlightSlot(_savegameSlotNum); +} + +void CPetLoadSave::highlightSlot(int index) { + unhighlightSave(_savegameSlotNum); + _savegameSlotNum = index; + highlightChange(); + highlightSave(_savegameSlotNum); +} + +void CPetLoadSave::highlightChange() { + CPetSection *section = getPetSection(); + + uint col = section ? section->getColor(3) : 0; + for (int idx = 0; idx < SAVEGAME_SLOTS_COUNT; ++idx) + _slotNames[idx].setColor(col); + + // TODO: Unknown if check + if (true) { + col = section ? section->getColor(4) : 0; + _slotNames[_savegameSlotNum].setColor(0, col); + } +} + +bool CPetLoadSave::checkSlotsHighlight(const Point &pt) { + for (int idx = 0; idx < SAVEGAME_SLOTS_COUNT; ++idx) { + if (isSlotHighlighted(idx, pt)) { + highlightSlot(idx); + return true; + } + } + + return false; +} + +bool CPetLoadSave::isSlotHighlighted(int index, const Point &pt) { + Rect r = getSlotBounds(index); + if (r.contains(pt)) { + highlightSlot(index); + return true; + } else { + return false; + } +} } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_load_save.h b/engines/titanic/pet_control/pet_load_save.h index 780fd75af0..ef7e54a3f2 100644 --- a/engines/titanic/pet_control/pet_load_save.h +++ b/engines/titanic/pet_control/pet_load_save.h @@ -24,14 +24,96 @@ #define TITANIC_PET_LOAD_SAVE_H #include "titanic/pet_control/pet_glyphs.h" +#include "titanic/pet_control/pet_text.h" namespace Titanic { +#define SAVEGAME_SLOTS_COUNT 5 + class CPetLoadSave : public CPetGlyph { +private: + /** + * Get the rect area for a given savegame name will be displayed in + */ + Rect getSlotBounds(int index); + + /** + * Highlight one of the slots + */ + void highlightSlot(int index); + + /** + * Called when savegame slot highlight changes or the view is reset + */ + void highlightChange(); + + /** + * Check for whether a slot is under the passed point + */ + bool checkSlotsHighlight(const Point &pt); + + /** + * Checks if a point is within a given saveame slot + */ + bool isSlotHighlighted(int index, const Point &pt); +protected: + CPetText _slotNames[SAVEGAME_SLOTS_COUNT]; + CPetGfxElement _btnLoadSave; + CPetGfxElement _gutter; + static int _savegameSlotNum; protected: - CPetGfxElement _element1; - CPetGfxElement _element2; + /** + * Reset the slot names list + */ + void resetSlots(); public: + /** + * Setup the glyph + */ + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); + + /** + * Reset the glyph + */ + virtual bool reset(); + + /** + * Handles any secondary drawing of the glyph + */ + virtual void draw2(CScreenManager *screenManager); + + /** + * Checks and updates any highlight of the glyph or any contextual + * information it displays + */ + virtual bool checkHighlight(const Point &pt); + + /** + * Handles mouse button messages + */ + virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + + /** + * Handles keypresses when the glyph is focused + */ + virtual bool KeyCharMsg(Common::KeyCode key); + + virtual void resetSaves() { resetSlots(); } + + /** + * Highlights a save slot + */ + virtual void highlightSave(int index) = 0; + + /** + * Unhighlight a save slot + */ + virtual void unhighlightSave(int index) = 0; + + /** + * Executes the loading or saving + */ + virtual void execute() = 0; }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_quit.cpp b/engines/titanic/pet_control/pet_quit.cpp index c3d6e4e40d..be7257f209 100644 --- a/engines/titanic/pet_control/pet_quit.cpp +++ b/engines/titanic/pet_control/pet_quit.cpp @@ -66,8 +66,8 @@ void CPetQuit::draw2(CScreenManager *screenManager) { _btnYes.draw(screenManager); } -bool CPetQuit::proc16(const Point &pt) { - return !_btnYes.proc6(pt); +bool CPetQuit::checkHighlight(const Point &pt) { + return !_btnYes.highlightBounds(pt); } bool CPetQuit::mouseButtonDownMsg(CMouseButtonDownMsg *msg) { diff --git a/engines/titanic/pet_control/pet_quit.h b/engines/titanic/pet_control/pet_quit.h index 213ed450d4..cfe3e6fb76 100644 --- a/engines/titanic/pet_control/pet_quit.h +++ b/engines/titanic/pet_control/pet_quit.h @@ -49,7 +49,11 @@ public: */ virtual void draw2(CScreenManager *screenManager); - virtual bool proc16(const Point &pt); + /** + * Checks and updates any highlight of the glyph or any contextual + * information it displays + */ + virtual bool checkHighlight(const Point &pt); virtual bool mouseButtonDownMsg(CMouseButtonDownMsg *msg); diff --git a/engines/titanic/pet_control/pet_save.cpp b/engines/titanic/pet_control/pet_save.cpp index d8835e1920..a2e458b52a 100644 --- a/engines/titanic/pet_control/pet_save.cpp +++ b/engines/titanic/pet_control/pet_save.cpp @@ -21,7 +21,37 @@ */ #include "titanic/pet_control/pet_save.h" +#include "titanic/pet_control/pet_control.h" namespace Titanic { +bool CPetSave::reset() { + CPetLoadSave::reset(); + + CPetControl *pet = getPetControl(); + if (pet) { + setName("PetSave", pet); + _btnLoadSave.reset("PetSaveOut", pet, MODE_UNSELECTED); + _btnLoadSave.reset("PetSaveIn", pet, MODE_SELECTED); + } + + return true; +} + +void CPetSave::getTooltip(CPetText *text) { + text->setText("Save the game."); +} + +void CPetSave::highlightSave(int index) { + warning("TODO: CPetSave::highlightSave"); +} + +void CPetSave::unhighlightSave(int index) { + warning("TODO: CPetSave::unhighlightSave"); +} + +void CPetSave::execute() { + warning("TODO: CPetSave::execute"); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_save.h b/engines/titanic/pet_control/pet_save.h index 21e59cbf96..006b2cd95a 100644 --- a/engines/titanic/pet_control/pet_save.h +++ b/engines/titanic/pet_control/pet_save.h @@ -28,6 +28,41 @@ namespace Titanic { class CPetSave : public CPetLoadSave { +public: + /** + * Reset the glyph + */ + virtual bool reset(); + + /** + * Unhighlight any currently highlighted element + */ + virtual void unhighlightCurrent() { unhighlightSave(_savegameSlotNum); } + + /** + * Highlight any currently highlighted element + */ + virtual void highlightCurrent() { highlightSave(_savegameSlotNum); } + + /** + * Returns the tooltip text for when the glyph is selected + */ + virtual void getTooltip(CPetText *text); + + /** + * Highlights a save slot + */ + virtual void highlightSave(int index); + + /** + * Unhighlight a save slot + */ + virtual void unhighlightSave(int index); + + /** + * Executes the loading or saving + */ + virtual void execute(); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index af00473050..faa25d05ad 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -174,4 +174,9 @@ void CPetText::setColor(uint col) { _textB = (col >> 16) & 0xff; } +void CPetText::set30(int val) { + if (val >= -1 && val < 257) + _field30 = val; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h index 55416fdc7d..17707117e5 100644 --- a/engines/titanic/pet_control/pet_text.h +++ b/engines/titanic/pet_control/pet_text.h @@ -119,6 +119,8 @@ public: * Set text color */ void setColor(uint col); + + void set30(int val); }; } // End of namespace Titanic -- cgit v1.2.3 From 282ed45c77e81f1a5d2f0663c516d455dd7a8032 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 21 Apr 2016 22:45:37 -0400 Subject: TITANIC: Beginnings of CPetSound --- engines/titanic/pet_control/pet_slider.h | 8 +++++++- engines/titanic/pet_control/pet_sound.cpp | 31 ++++++++++++++++++++++++++++++- engines/titanic/pet_control/pet_sound.h | 20 ++++++++++++++++++++ 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/engines/titanic/pet_control/pet_slider.h b/engines/titanic/pet_control/pet_slider.h index acad55c4ae..b3ba60fd41 100644 --- a/engines/titanic/pet_control/pet_slider.h +++ b/engines/titanic/pet_control/pet_slider.h @@ -24,6 +24,7 @@ #define TITANIC_PET_SLIDER_H #include "titanic/support/rect.h" +#include "titanic/support/string.h" namespace Titanic { @@ -46,7 +47,12 @@ public: virtual void proc1() {} virtual void proc2() {} virtual void proc3() {} - virtual void proc4() {} + + /** + * Reset the slider + */ + virtual void reset(const CString &name) {} + virtual void proc5() {} virtual void proc6() {} diff --git a/engines/titanic/pet_control/pet_sound.cpp b/engines/titanic/pet_control/pet_sound.cpp index b236b1ab3d..6c6c2ead64 100644 --- a/engines/titanic/pet_control/pet_sound.cpp +++ b/engines/titanic/pet_control/pet_sound.cpp @@ -20,10 +20,39 @@ * */ -#include "titanic/pet_control/pet_real_life.h" +#include "titanic/pet_control/pet_sound.h" #include "titanic/pet_control/pet_control.h" namespace Titanic { +CPetSound::CPetSound() : CPetGlyph(), _field198(0), _field19C(0) { +} + +bool CPetSound::setup(CPetControl *petControl, CPetGlyphs *owner) { + CPetGlyph::setup(petControl, owner); + // TODO + + return true; +} + +bool CPetSound::reset() { + CPetControl *pet = getPetControl(); + if (pet) { + setName("PetSound", pet); + _element.reset("PetVolChannels", pet, MODE_UNSELECTED); + _slider1.reset("PetVolSlug"); + _slider2.reset("PetVolSlug"); + _slider3.reset("PetVolSlug"); + _slider4.reset("PetVolSlug"); + + CPetSection *section = getPetSection(); + uint col = section->getColor(0); + for (int idx = 0; idx < 4; ++idx) + _text[idx].setColor(0, col); + } + + return false; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_sound.h b/engines/titanic/pet_control/pet_sound.h index fcd8e9a1d9..e52cccabf8 100644 --- a/engines/titanic/pet_control/pet_sound.h +++ b/engines/titanic/pet_control/pet_sound.h @@ -26,12 +26,32 @@ #include "titanic/pet_control/pet_glyphs.h" #include "titanic/pet_control/pet_gfx_element.h" #include "titanic/pet_control/pet_text.h" +#include "titanic/pet_control/pet_slider.h" namespace Titanic { class CPetSound : public CPetGlyph { private: + CPetGfxElement _element; + CPetSlider _slider1; + CPetSlider _slider2; + CPetSlider _slider3; + CPetSlider _slider4; + CPetText _text[4]; + int _field198; + int _field19C; public: + CPetSound(); + + /** + * Setup the glyph + */ + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); + + /** + * Reset the glyph + */ + virtual bool reset(); }; } // End of namespace Titanic -- cgit v1.2.3 From e4bc0b260155009918efa736f4f859571ebd671e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 21 Apr 2016 23:08:29 -0400 Subject: TITANIC: Fix horizontal placement of PET glyphs --- engines/titanic/pet_control/pet_glyphs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index 4669a1f1ec..af4679fa97 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -159,7 +159,7 @@ void CPetGlyphs::draw(CScreenManager *screenManager) { } Point CPetGlyphs::getPosition(int index) { - Point tempPoint(37 + index * 58, 375); + Point tempPoint(37 + index * 70, 375); return tempPoint; } -- cgit v1.2.3 From 48e9387f2dacc09fff656d8c493a048c520a5c13 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 21 Apr 2016 23:11:08 -0400 Subject: TITANIC: Fix placement of PET glyphs scroll buttons --- engines/titanic/pet_control/pet_glyphs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index af4679fa97..eedd94dff3 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -85,7 +85,7 @@ void CPetGlyphs::setup(int numVisible, CPetSection *owner) { _owner = owner; _selection.setBounds(Rect(0, 0, 76, 76)); - int buttonsLeft = numVisible * 7 * 5 + 21; + int buttonsLeft = numVisible * 70 + 21; _scrollLeft.setBounds(Rect(0, 0, 31, 15)); _scrollLeft.translate(buttonsLeft, 373); -- cgit v1.2.3 From a719b0585fed6bcbce48e924d65cca5d9ff80bf8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 22 Apr 2016 13:16:44 -0400 Subject: TITANIC: Beginnings of slider logic --- engines/titanic/pet_control/pet_slider.cpp | 15 ++++++++++++ engines/titanic/pet_control/pet_slider.h | 39 +++++++++++++++++++++++++++--- 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/engines/titanic/pet_control/pet_slider.cpp b/engines/titanic/pet_control/pet_slider.cpp index dad78d6a1e..4abf0227a1 100644 --- a/engines/titanic/pet_control/pet_slider.cpp +++ b/engines/titanic/pet_control/pet_slider.cpp @@ -21,6 +21,7 @@ */ #include "titanic/pet_control/pet_slider.h" +#include "titanic/pet_control/pet_control.h" namespace Titanic { @@ -86,4 +87,18 @@ void CPetSlider::proc18() { } +/*------------------------------------------------------------------------*/ + +void CPetSoundSlider::setupBackground(const CString &name, CPetControl *petControl) { + if (petControl) { + _background = petControl->getHiddenObject(name); + } +} + +void CPetSoundSlider::setupThumb(const CString &name, CPetControl *petControl) { + if (petControl) { + _thumb = petControl->getHiddenObject(name); + } +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_slider.h b/engines/titanic/pet_control/pet_slider.h index b3ba60fd41..a30697a023 100644 --- a/engines/titanic/pet_control/pet_slider.h +++ b/engines/titanic/pet_control/pet_slider.h @@ -25,9 +25,12 @@ #include "titanic/support/rect.h" #include "titanic/support/string.h" +#include "titanic/core/game_object.h" namespace Titanic { +class CPetControl; + class CPetSlider { private: int _field4; @@ -44,9 +47,25 @@ private: public: CPetSlider(); - virtual void proc1() {} - virtual void proc2() {} - virtual void proc3() {} + /** + * Setup the background + */ + virtual void setupBackground(const CString &name, CPetControl *petControl) {} + + /** + * Setup the thumb + */ + virtual void setupThumb(const CString &name, CPetControl *petControl) {} + + /** + * Setup the background + */ + virtual void setupBackground(const CString &name, CTreeItem *treeItem) {} + + /** + * Setup the thumb + */ + virtual void setupThumb(const CString &name, CTreeItem *treeItem) {} /** * Reset the slider @@ -81,9 +100,21 @@ public: class CPetSoundSlider : public CPetSlider { public: - + CGameObject *_background; + CGameObject *_thumb; public: + CPetSoundSlider() : CPetSlider(), _background(nullptr), + _thumb(0) {} + /** + * Setup the background + */ + virtual void setupBackground(const CString &name, CPetControl *petControl); + + /** + * Setup the thumb + */ + virtual void setupThumb(const CString &name, CPetControl *petControl); }; } // End of namespace Titanic -- cgit v1.2.3 From 4915f8900aff374b2a71545e788cb95d9da7138a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 22 Apr 2016 21:43:12 -0400 Subject: TITANIC: Implement more slider functions --- engines/titanic/pet_control/pet_slider.cpp | 181 +++++++++++++++++++++++++---- engines/titanic/pet_control/pet_slider.h | 120 ++++++++++++++----- 2 files changed, 253 insertions(+), 48 deletions(-) diff --git a/engines/titanic/pet_control/pet_slider.cpp b/engines/titanic/pet_control/pet_slider.cpp index 4abf0227a1..bb43cf5741 100644 --- a/engines/titanic/pet_control/pet_slider.cpp +++ b/engines/titanic/pet_control/pet_slider.cpp @@ -26,29 +26,31 @@ namespace Titanic { CPetSlider::CPetSlider() { - _field4 = 0; - _field8 = 0; - _field1C = 0; - _field20 = 0; - _field24 = 0; - _field28 = 0; - _field2C = 0; - _field30 = 0; - _field34 = 0; + _flags = 0; + _thumbWidth = 0; + _thumbHeight = 0; + _sliderOffset = 0; + _thumbFocused = false; } -void CPetSlider::initBounds(Rect *rect) { - if (rect) - *rect = _bounds2; - _bounds2.clear(); +Rect CPetSlider::clearDirtyArea() { + Rect result = _dirtyArea; + _dirtyArea.clear(); + return result; } -void CPetSlider::proc8() { - +bool CPetSlider::checkThumb(const Point &pt) { + _thumbFocused = thumbContains(pt); + if (_thumbFocused) + return true; + else + return containsPt(pt); } -void CPetSlider::proc9() { - +bool CPetSlider::resetThumbFocus() { + bool result = _thumbFocused; + _thumbFocused = false; + return result; } void CPetSlider::proc10() { @@ -59,8 +61,15 @@ void CPetSlider::proc11() { } -void CPetSlider::proc12() { +bool CPetSlider::proc12(const Point &pt) { + if (thumbContains(pt)) + return true; + if (!containsPt(pt)) + return false; + int newOffset = calcSliderOffset(pt); + setSliderOffset(newOffset); + return true; } void CPetSlider::proc13() { @@ -71,20 +80,99 @@ void CPetSlider::proc14() { } -void CPetSlider::proc15() { +bool CPetSlider::contains(const Point &pt) const { + return thumbContains(pt) || containsPt(pt); +} + +double CPetSlider::getOffsetPixels() const { + int maxVal = 0, minVal = 0; + if (_flags & ORIENTATION_HORIZONTAL) { + maxVal = _slidingRect.right; + minVal = _slidingRect.left; + } + if (_flags & ORIENTATION_VERTICAL) { + maxVal = _slidingRect.bottom; + minVal = _slidingRect.top; + } + + if (minVal == maxVal) + return 0.0; + + return _sliderOffset / (maxVal - minVal); } -void CPetSlider::proc16() { +void CPetSlider::setSliderOffset(double offset) { + if (_flags & ORIENTATION_HORIZONTAL) + _sliderOffset = offset * (_slidingRect.right - _slidingRect.left); + if (_flags & ORIENTATION_VERTICAL) + _sliderOffset = offset * (_slidingRect.bottom - _slidingRect.top); } -void CPetSlider::proc17() { +void CPetSlider::setOffsetPixels(int offset) { + // Add the slider's old position to the dirty area + Rect tempRect = getThumbRect(); + _dirtyArea.combine(tempRect); + + // Set the new offset + _sliderOffset = offset; + // Add the thumb's new location to the dirty area + tempRect = getThumbRect(); + _dirtyArea.combine(tempRect); } -void CPetSlider::proc18() { +Point CPetSlider::getBackgroundDrawPos() { + return Point(_bounds.left, _bounds.top); +} +Point CPetSlider::getThumbDrawPos() { + Point thumbPos = getThumbCentroidPos(); + thumbPos -= Point(_thumbWidth / 2, _thumbHeight / 2); + return thumbPos; +} + +Point CPetSlider::getThumbCentroidPos() const { + Point pt; + + if (_flags & ORIENTATION_HORIZONTAL) { + pt = Point(_slidingRect.left + _sliderOffset, + _slidingRect.top + _slidingRect.height() / 2); + } + + if (_flags & ORIENTATION_VERTICAL) { + pt = Point(_slidingRect.left + _slidingRect.width() / 2, + _slidingRect.top + _sliderOffset); + } + + return pt; +} + +bool CPetSlider::thumbContains(const Point &pt) const { + return getThumbRect().contains(pt); +} + +Rect CPetSlider::getThumbRect() const { + Rect thumbRect(0, 0, _thumbWidth, _thumbHeight); + Point centroid = getThumbCentroidPos(); + thumbRect.moveTo(centroid.x - _thumbWidth / 2, centroid.y - _thumbHeight / 2); + + return thumbRect; +} + +int CPetSlider::calcSliderOffset(const Point &pt) const { + int result = 0; + + if (_flags & ORIENTATION_HORIZONTAL) { + result = CLIP(pt.x, _slidingRect.left, _slidingRect.right) - _slidingRect.left; + } + + if (_flags & ORIENTATION_VERTICAL) { + result = CLIP(pt.y, _slidingRect.top, _slidingRect.bottom) - _slidingRect.top; + } + + return result; } /*------------------------------------------------------------------------*/ @@ -101,4 +189,53 @@ void CPetSoundSlider::setupThumb(const CString &name, CPetControl *petControl) { } } +void CPetSoundSlider::setupBackground2(const CString &name, CPetControl *petControl) { + if (petControl) { + CString numStr = "3"; + int mode = petControl->getState8(); + if (mode <= 3) { + numStr = CString(mode); + } else if (mode == 4) { + mode = petControl->getStateC(); + if (mode == 1) { + numStr = CString(mode); + } + } + + CString fullName = numStr + name; + setupBackground(fullName, petControl); + } +} + +void CPetSoundSlider::setupThumb2(const CString &name, CPetControl *petControl) { + if (petControl) { + CString numStr = "3"; + int mode = petControl->getState8(); + if (mode <= 3) { + numStr = CString(mode); + } + else if (mode == 4) { + mode = petControl->getStateC(); + if (mode == 1) { + numStr = CString(mode); + } + } + + CString fullName = numStr + name; + setupThumb(fullName, petControl); + } +} + +void CPetSoundSlider::draw(CScreenManager *screenManager) { + if (_background) { + Point pt = getBackgroundDrawPos(); + _background->draw(screenManager, pt); + } + + if (_thumb) { + Point pt = getThumbDrawPos(); + _thumb->draw(screenManager, pt); + } +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_slider.h b/engines/titanic/pet_control/pet_slider.h index a30697a023..a8ef3cbf36 100644 --- a/engines/titanic/pet_control/pet_slider.h +++ b/engines/titanic/pet_control/pet_slider.h @@ -29,21 +29,55 @@ namespace Titanic { +enum SliderOrientation { ORIENTATION_HORIZONTAL = 1, ORIENTATION_VERTICAL = 2 }; + class CPetControl; class CPetSlider { private: - int _field4; - int _field8; + int _flags; Rect _bounds; - int _field1C; - int _field20; - int _field24; - int _field28; - int _field2C; - int _field30; - int _field34; - Rect _bounds2; + Rect _slidingRect; + int _thumbWidth; + int _thumbHeight; + int _sliderOffset; + bool _thumbFocused; + Rect _dirtyArea; +private: + /** + * Center the center position of the slider's thumb + */ + Point getThumbCentroidPos() const; + + /** + * Returns true if the passed point is within the thumb + */ + bool thumbContains(const Point &pt) const; + + /** + * Gets the area the slider's thumbnail covers + */ + Rect getThumbRect() const; + + /** + * Calculates the slider offset at the specificed position + */ + int calcSliderOffset(const Point &pt) const; +protected: + /** + * Get the position to draw the background at + */ + Point getBackgroundDrawPos(); + + /** + * Get the position to draw the slider thumbnail at + */ + Point getThumbDrawPos(); + + /** + * Returns true if the passed point falls within the slider's bounds + */ + bool containsPt(const Point &pt) const { return _bounds.contains(pt); } public: CPetSlider(); @@ -60,42 +94,61 @@ public: /** * Setup the background */ - virtual void setupBackground(const CString &name, CTreeItem *treeItem) {} + virtual void setupBackground2(const CString &name, CPetControl *petControl) {} /** * Setup the thumb */ - virtual void setupThumb(const CString &name, CTreeItem *treeItem) {} + virtual void setupThumb2(const CString &name, CPetControl *petControl) {} /** * Reset the slider */ virtual void reset(const CString &name) {} - virtual void proc5() {} - virtual void proc6() {} - /** - * Reset the bounds of the slider + * Draw the slider + */ + virtual void draw(CScreenManager *screenManager) {} + + /** + * Reset the dirty area */ - virtual void initBounds(Rect *rect); + virtual Rect clearDirtyArea(); - virtual void proc8(); - virtual void proc9(); + /** + * Checks whether the slider is highlighted + */ + virtual bool checkThumb(const Point &pt); + + /** + * Resets the thumb focused flag + */ + virtual bool resetThumbFocus(); + virtual void proc10(); virtual void proc11(); - virtual void proc12(); + virtual bool proc12(const Point &pt); virtual void proc13(); virtual void proc14(); - virtual void proc15(); - virtual void proc16(); - virtual void proc17(); - virtual void proc18(); + + + virtual bool contains(const Point &pt) const; /** - * Returns true if the passed point falls within the slider's bounds + * Returns the slider offset in pixels + */ + virtual double getOffsetPixels() const; + + /** + * Sets the slider offset + */ + virtual void setSliderOffset(double offset); + + /** + * Set a new slider offset in pixels */ - bool contains(const Point &pt) const { return _bounds.contains(pt); } + virtual void setOffsetPixels(int offset); }; class CPetSoundSlider : public CPetSlider { @@ -115,6 +168,21 @@ public: * Setup the thumb */ virtual void setupThumb(const CString &name, CPetControl *petControl); + + /** + * Setup the background + */ + virtual void setupBackground2(const CString &name, CPetControl *petControl); + + /** + * Setup the thumb + */ + virtual void setupThumb2(const CString &name, CPetControl *petControl); + + /** + * Draw the slider + */ + virtual void draw(CScreenManager *screenManager); }; } // End of namespace Titanic -- cgit v1.2.3 From f79ebfa3e26cc748ef495a96da8acb9e005b3324 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 22 Apr 2016 22:32:28 -0400 Subject: TITANIC: Added PET Sound tab setup --- engines/titanic/pet_control/pet_element.h | 5 +++ engines/titanic/pet_control/pet_slider.cpp | 41 ++++++++---------- engines/titanic/pet_control/pet_slider.h | 41 +++++++++++++++--- engines/titanic/pet_control/pet_sound.cpp | 67 ++++++++++++++++++++++++++---- engines/titanic/pet_control/pet_sound.h | 13 +++--- 5 files changed, 126 insertions(+), 41 deletions(-) diff --git a/engines/titanic/pet_control/pet_element.h b/engines/titanic/pet_control/pet_element.h index 7ee28368b2..17e5881a2b 100644 --- a/engines/titanic/pet_control/pet_element.h +++ b/engines/titanic/pet_control/pet_element.h @@ -134,6 +134,11 @@ public: * Translate the position of the element */ void translate(int deltaX, int deltaY) { _bounds.translate(deltaX, deltaY); } + + /** + * Translate the position of the element + */ + void translate(const Point &delta) { _bounds.translate(delta.x, delta.y); } }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_slider.cpp b/engines/titanic/pet_control/pet_slider.cpp index bb43cf5741..3e579a4b33 100644 --- a/engines/titanic/pet_control/pet_slider.cpp +++ b/engines/titanic/pet_control/pet_slider.cpp @@ -26,7 +26,7 @@ namespace Titanic { CPetSlider::CPetSlider() { - _flags = 0; + _orientation = 0; _thumbWidth = 0; _thumbHeight = 0; _sliderOffset = 0; @@ -53,12 +53,9 @@ bool CPetSlider::resetThumbFocus() { return result; } -void CPetSlider::proc10() { - -} - -void CPetSlider::proc11() { - +void CPetSlider::proc10(const Point &pt) { + int newOffset = calcSliderOffset(pt); + setOffsetPixels(newOffset); } bool CPetSlider::proc12(const Point &pt) { @@ -68,30 +65,22 @@ bool CPetSlider::proc12(const Point &pt) { return false; int newOffset = calcSliderOffset(pt); - setSliderOffset(newOffset); + setOffsetPixels(newOffset); return true; } -void CPetSlider::proc13() { - -} - -void CPetSlider::proc14() { - -} - bool CPetSlider::contains(const Point &pt) const { return thumbContains(pt) || containsPt(pt); } double CPetSlider::getOffsetPixels() const { int maxVal = 0, minVal = 0; - if (_flags & ORIENTATION_HORIZONTAL) { + if (_orientation & ORIENTATION_HORIZONTAL) { maxVal = _slidingRect.right; minVal = _slidingRect.left; } - if (_flags & ORIENTATION_VERTICAL) { + if (_orientation & ORIENTATION_VERTICAL) { maxVal = _slidingRect.bottom; minVal = _slidingRect.top; } @@ -103,10 +92,10 @@ double CPetSlider::getOffsetPixels() const { } void CPetSlider::setSliderOffset(double offset) { - if (_flags & ORIENTATION_HORIZONTAL) + if (_orientation & ORIENTATION_HORIZONTAL) _sliderOffset = offset * (_slidingRect.right - _slidingRect.left); - if (_flags & ORIENTATION_VERTICAL) + if (_orientation & ORIENTATION_VERTICAL) _sliderOffset = offset * (_slidingRect.bottom - _slidingRect.top); } @@ -136,12 +125,12 @@ Point CPetSlider::getThumbDrawPos() { Point CPetSlider::getThumbCentroidPos() const { Point pt; - if (_flags & ORIENTATION_HORIZONTAL) { + if (_orientation & ORIENTATION_HORIZONTAL) { pt = Point(_slidingRect.left + _sliderOffset, _slidingRect.top + _slidingRect.height() / 2); } - if (_flags & ORIENTATION_VERTICAL) { + if (_orientation & ORIENTATION_VERTICAL) { pt = Point(_slidingRect.left + _slidingRect.width() / 2, _slidingRect.top + _sliderOffset); } @@ -164,17 +153,21 @@ Rect CPetSlider::getThumbRect() const { int CPetSlider::calcSliderOffset(const Point &pt) const { int result = 0; - if (_flags & ORIENTATION_HORIZONTAL) { + if (_orientation & ORIENTATION_HORIZONTAL) { result = CLIP(pt.x, _slidingRect.left, _slidingRect.right) - _slidingRect.left; } - if (_flags & ORIENTATION_VERTICAL) { + if (_orientation & ORIENTATION_VERTICAL) { result = CLIP(pt.y, _slidingRect.top, _slidingRect.bottom) - _slidingRect.top; } return result; } +void CPetSlider::setOrientation(SliderOrientation orientation) { + _orientation |= orientation; +} + /*------------------------------------------------------------------------*/ void CPetSoundSlider::setupBackground(const CString &name, CPetControl *petControl) { diff --git a/engines/titanic/pet_control/pet_slider.h b/engines/titanic/pet_control/pet_slider.h index a8ef3cbf36..7a61741143 100644 --- a/engines/titanic/pet_control/pet_slider.h +++ b/engines/titanic/pet_control/pet_slider.h @@ -35,7 +35,7 @@ class CPetControl; class CPetSlider { private: - int _flags; + int _orientation; Rect _bounds; Rect _slidingRect; int _thumbWidth; @@ -126,11 +126,11 @@ public: */ virtual bool resetThumbFocus(); - virtual void proc10(); - virtual void proc11(); + virtual void proc10(const Point &pt); + virtual bool proc11() { return true; } virtual bool proc12(const Point &pt); - virtual void proc13(); - virtual void proc14(); + virtual bool proc13() { return false; } + virtual bool proc14() { return false; } virtual bool contains(const Point &pt) const; @@ -149,6 +149,37 @@ public: * Set a new slider offset in pixels */ virtual void setOffsetPixels(int offset); + + /** + * Enables a given orientation + */ + void setOrientation(SliderOrientation orientation); + + /** + * Set the bounds for the slider + */ + void setBounds(const Rect &r) { _bounds = r; } + + /** + * Set the sliding bounds for the slider + */ + void setSlidingBounds(const Rect &r) { _slidingRect = r; } + + /** + * Set the size of the slider thumb + */ + void setThumbSize(const Point &pt) { + _thumbWidth = pt.x; + _thumbHeight = pt.y; + } + + /** + * Move the slider + */ + void translate(const Point &pt) { + _bounds.translate(pt.x, pt.y); + _slidingRect.translate(pt.x, pt.y); + } }; class CPetSoundSlider : public CPetSlider { diff --git a/engines/titanic/pet_control/pet_sound.cpp b/engines/titanic/pet_control/pet_sound.cpp index 6c6c2ead64..75dff34db5 100644 --- a/engines/titanic/pet_control/pet_sound.cpp +++ b/engines/titanic/pet_control/pet_sound.cpp @@ -30,7 +30,58 @@ CPetSound::CPetSound() : CPetGlyph(), _field198(0), _field19C(0) { bool CPetSound::setup(CPetControl *petControl, CPetGlyphs *owner) { CPetGlyph::setup(petControl, owner); - // TODO + + _masterVolume.setOrientation(ORIENTATION_HORIZONTAL); + _masterVolume.setBounds(Rect(17, 0, 147, 15)); + _masterVolume.setSlidingBounds(Rect(35, 5, 127, 11)); + _masterVolume.setThumbSize(Point(25, 15)); + _masterVolume.translate(Point(415, 376)); + + _musicVolume.setOrientation(ORIENTATION_HORIZONTAL); + _musicVolume.setBounds(Rect(17, 20, 147, 35)); + _musicVolume.setSlidingBounds(Rect(35, 25, 127, 31)); + _musicVolume.setThumbSize(Point(25, 15)); + _musicVolume.translate(Point(415, 376)); + + _parrotVolume.setOrientation(ORIENTATION_HORIZONTAL); + _parrotVolume.setBounds(Rect(17, 40, 147, 55)); + _parrotVolume.setSlidingBounds(Rect(35, 45, 127, 51)); + _parrotVolume.setThumbSize(Point(25, 15)); + _parrotVolume.translate(Point(415, 376)); + + _parrotVolume.setOrientation(ORIENTATION_HORIZONTAL); + _parrotVolume.setBounds(Rect(17, 60, 147, 75)); + _parrotVolume.setSlidingBounds(Rect(35, 65, 127, 71)); + _parrotVolume.setThumbSize(Point(25, 15)); + _parrotVolume.translate(Point(415, 376)); + + _element.setBounds(Rect(0, 0, 165, 77)); + _element.translate(Point(415, 376)); + + Rect rect(0, 0, 88, 16); + rect.translate(320, 376); + _textMasterVolume.setBounds(rect); + _textMasterVolume.resize(3); + _textMasterVolume.setHasBorder(false); + _textMasterVolume.setText("Master volume"); + + rect.translate(0, 20); + _textMusicVolume.setBounds(rect); + _textMusicVolume.resize(3); + _textMusicVolume.setHasBorder(false); + _textMusicVolume.setText("Music volume"); + + rect.translate(0, 20); + _textParrotVolume.setBounds(rect); + _textParrotVolume.resize(3); + _textParrotVolume.setHasBorder(false); + _textParrotVolume.setText("Parrot volume"); + + rect.translate(0, 20); + _textSpeechVolume.setBounds(rect); + _textSpeechVolume.resize(3); + _textSpeechVolume.setHasBorder(false); + _textSpeechVolume.setText("Speech volume"); return true; } @@ -40,15 +91,17 @@ bool CPetSound::reset() { if (pet) { setName("PetSound", pet); _element.reset("PetVolChannels", pet, MODE_UNSELECTED); - _slider1.reset("PetVolSlug"); - _slider2.reset("PetVolSlug"); - _slider3.reset("PetVolSlug"); - _slider4.reset("PetVolSlug"); + _musicVolume.reset("PetVolSlug"); + _masterVolume.reset("PetVolSlug"); + _parrotVolume.reset("PetVolSlug"); + _speechVolume.reset("PetVolSlug"); CPetSection *section = getPetSection(); uint col = section->getColor(0); - for (int idx = 0; idx < 4; ++idx) - _text[idx].setColor(0, col); + _textMusicVolume.setColor(0, col); + _textMasterVolume.setColor(0, col); + _textParrotVolume.setColor(0, col); + _textSpeechVolume.setColor(0, col); } return false; diff --git a/engines/titanic/pet_control/pet_sound.h b/engines/titanic/pet_control/pet_sound.h index e52cccabf8..de6c637bd2 100644 --- a/engines/titanic/pet_control/pet_sound.h +++ b/engines/titanic/pet_control/pet_sound.h @@ -33,11 +33,14 @@ namespace Titanic { class CPetSound : public CPetGlyph { private: CPetGfxElement _element; - CPetSlider _slider1; - CPetSlider _slider2; - CPetSlider _slider3; - CPetSlider _slider4; - CPetText _text[4]; + CPetSlider _masterVolume; + CPetSlider _musicVolume; + CPetSlider _parrotVolume; + CPetSlider _speechVolume; + CPetText _textMasterVolume; + CPetText _textMusicVolume; + CPetText _textParrotVolume; + CPetText _textSpeechVolume; int _field198; int _field19C; public: -- cgit v1.2.3 From 990f7b87c1b328b0cb2b663d37f4a1de50edf56c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 23 Apr 2016 10:26:15 -0400 Subject: TITANIC: Sort out PET enter and leave methods --- engines/titanic/messages/messages.h | 2 +- engines/titanic/pet_control/pet_glyphs.cpp | 211 +++++++++++++++++++++++++- engines/titanic/pet_control/pet_glyphs.h | 124 +++++++++++++-- engines/titanic/pet_control/pet_inventory.cpp | 31 +++- engines/titanic/pet_control/pet_inventory.h | 16 ++ engines/titanic/pet_control/pet_real_life.cpp | 51 ++++++- engines/titanic/pet_control/pet_real_life.h | 28 ++-- engines/titanic/pet_control/pet_section.h | 8 +- engines/titanic/pet_control/pet_sound.cpp | 13 ++ engines/titanic/pet_control/pet_sound.h | 5 + 10 files changed, 441 insertions(+), 48 deletions(-) diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 649b20b779..ae66af1780 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -265,7 +265,7 @@ MESSAGE0(CInitializeAnimMsg); MESSAGE1(CIsEarBowlPuzzleDone, int, value, 0); MESSAGE3(CIsHookedOnMsg, Rect, rect, Rect(), bool, result, false, CString, string1, ""); MESSAGE1(CIsParrotPresentMsg, bool, value, false); -MESSAGE1(CKeyCharMsg, int, value, 32); +MESSAGE1(CKeyCharMsg, int, key, 32); MESSAGE2(CLeaveNodeMsg, CNodeItem *, oldNode, nullptr, CNodeItem *, newNode, nullptr); MESSAGE2(CLeaveRoomMsg, CRoomItem *, oldRoom, nullptr, CRoomItem *, newRoom, nullptr); MESSAGE2(CLeaveViewMsg, CViewItem *, oldView, nullptr, CViewItem *, newView, nullptr); diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index eedd94dff3..1ab7d7ee1b 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -22,6 +22,7 @@ #include "titanic/pet_control/pet_glyphs.h" #include "titanic/pet_control/pet_section.h" +#include "titanic/pet_control/pet_control.h" namespace Titanic { @@ -37,7 +38,7 @@ void CPetGlyph::drawAt(CScreenManager *screenManager, const Point &pt) { _element.translate(-pt.x, -pt.y); } -void CPetGlyph::proc14() { +void CPetGlyph::proc14(const Point &pt) { warning("TODO: CPetGlyph::proc14"); } @@ -66,7 +67,8 @@ void CPetGlyph::setName(const CString &name, CPetControl *petControl) { /*------------------------------------------------------------------------*/ CPetGlyphs::CPetGlyphs() : _firstVisibleIndex(0), _numVisibleGlyphs(TOTAL_GLYPHS), - _highlightIndex(-1), _field1C(-1), _field20(0), _owner(nullptr) { + _highlightIndex(-1), _field1C(-1), _field20(0), + _field94(nullptr), _owner(nullptr) { } void CPetGlyphs::setNumVisible(int total) { @@ -107,12 +109,24 @@ void CPetGlyphs::reset() { } } -void CPetGlyphs::proc10() { - error("TODO"); +bool CPetGlyphs::enter() { + if (_highlightIndex != -1) { + CPetGlyph *glyph = getGlyph(_highlightIndex); + if (glyph && glyph->enter()) + return true; + } + + return false; } -void CPetGlyphs::proc11() { - error("TODO"); +bool CPetGlyphs::leave() { + if (_highlightIndex != -1) { + CPetGlyph *glyph = getGlyph(_highlightIndex); + if (glyph && glyph->leave()) + return true; + } + + return false; } void CPetGlyphs::draw(CScreenManager *screenManager) { @@ -163,6 +177,11 @@ Point CPetGlyphs::getPosition(int index) { return tempPoint; } +Rect CPetGlyphs::getRect(int index) { + Point pt = getPosition(index); + return Rect(pt.x, pt.y, pt.x + 52, pt.y + 52); +} + void CPetGlyphs::changeHighlight(int index) { warning("TODO: CPetGlyphs::changeHighlight"); } @@ -193,4 +212,184 @@ CPetControl *CPetGlyphs::getPetControl() const { return _owner ? _owner->getPetControl() : nullptr; } +void CPetGlyphs::setFirstVisible(int index) { + if (index != _firstVisibleIndex) { + _firstVisibleIndex = index; + + if ((_field20 & 8) && _highlightIndex != -1) { + CPetGlyph *glyph = getGlyph(_highlightIndex); + + if (glyph) { + int idx = getHighlightedIndex(_highlightIndex); + if (idx != -1) { + Point tempPt = getPosition(idx); + glyph->proc27(tempPt, true); + } + } + } + } +} + +void CPetGlyphs::scrollLeft() { + if (_firstVisibleIndex > 0) { + setFirstVisible(_firstVisibleIndex - 1); + if (_highlightIndex != -1) { + int index = getHighlightedIndex(_highlightIndex); + if (index == -1) + changeHighlight(_highlightIndex - 1); + } + + makePetDirty(); + } +} + +void CPetGlyphs::scrollRight() { + int count = size(); + int right = count - _numVisibleGlyphs; + + if (_firstVisibleIndex < right) { + setFirstVisible(_firstVisibleIndex + 1); + if (_highlightIndex != -1) { + int index = getHighlightedIndex(_highlightIndex); + if (index == -1) + changeHighlight(_highlightIndex + 1); + } + + makePetDirty(); + } +} + +void CPetGlyphs::makePetDirty() { + if (_owner && _owner->_petControl) + _owner->_petControl->makeDirty(); +} + +bool CPetGlyphs::mouseButtonDown(const Point &pt) { + if (_scrollLeft.contains2(pt)) { + scrollLeft(); + return true; + } + + if (_scrollRight.contains2(pt)) { + scrollRight(); + return true; + } + + for (int idx = 0; idx < _numVisibleGlyphs; ++idx) { + Rect glyphRect = getRect(idx); + if (glyphRect.contains(pt)) { + int index = getItemIndex(idx); + CPetGlyph *glyph = getGlyph(index); + if (glyph) { + if (index == _highlightIndex) { + glyph->proc28(glyphRect); + glyph->proc14(pt); + return true; + } else { + changeHighlight(index); + makePetDirty(); + return true; + } + } + } + } + + if (_highlightIndex != -1) { + CPetGlyph *glyph = getGlyph(_highlightIndex); + + if (glyph) { + if (glyph->checkHighlight(pt)) + return true; + + if (!(_field20 & 2)) { + changeHighlight(-1); + makePetDirty(); + } + } + } + + return false; +} + +bool CPetGlyphs::mouseButtonUp(const Point &pt) { + if (_highlightIndex >= 0) { + CPetGlyph *glyph = getGlyph(_highlightIndex); + if (glyph) { + if (glyph->MouseButtonMsg(pt)) + return true; + } + } + + return false; +} + +bool CPetGlyphs::mouseDragStart(CMouseDragStartMsg *msg) { + if (!(_field20 & 1) && _highlightIndex >= 0) { + CPetGlyph *glyph = getGlyph(_highlightIndex); + int index = getHighlightedIndex(_highlightIndex); + Rect glyphRect = getRect(index); + + if (glyphRect.contains(msg->_mousePos)) + return glyph->proc29(glyphRect); + else + return glyph->MouseDragStartMsg(msg); + } + + return false; +} + +bool CPetGlyphs::mouseDragMove(CMouseDragMoveMsg *msg) { + if (_field94) { + error("TODO"); + } else { + return false; + } +} + +bool CPetGlyphs::mouseDragEnd(CMouseDragEndMsg *msg) { + if (_field94) { + error("TODO"); + } else { + return false; + } +} + +bool CPetGlyphs::keyCharMsg(int key) { + if (_highlightIndex >= 0) { + CPetGlyph *glyph = getGlyph(_highlightIndex); + + if (glyph && glyph->KeyCharMsg(key)) + return true; + } + + return false; +} + +bool CPetGlyphs::virtualKeyCharMsg(int key) { + bool handled = false; + warning("TODO: CPetGlyphs::virtualKeyCharMsg"); + + if (!handled && _highlightIndex >= 0) { + CPetGlyph *glyph = getGlyph(_highlightIndex); + if (glyph && glyph->VirtualKeyCharMsg(key)) + handled = true; + } + + return handled; +} + +bool CPetGlyphs::enterHighlighted() { + if (_highlightIndex >= 0) + return getGlyph(_highlightIndex)->enterHighlighted(); + else + return false; +} + +bool CPetGlyphs::leaveHighlighted() { + if (_highlightIndex >= 0) + return getGlyph(_highlightIndex)->leaveHighlighted(); + else + return false; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index 9d2f283af4..496654762e 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -90,8 +90,15 @@ public: */ virtual bool reset() { return false; } - virtual void proc10() {} - virtual void proc11() {} + /** + * Called when the PET area is entered + */ + virtual bool enter() { return false; } + + /** + * Called when the PET area is left + */ + virtual bool leave() { return false; } /** * Draw the glyph at a specified position @@ -103,7 +110,7 @@ public: */ virtual void draw2(CScreenManager *screenManager) {} - virtual void proc14(); + virtual void proc14(const Point &pt); /** * Get the bounds for the glyph @@ -116,14 +123,14 @@ public: */ virtual bool checkHighlight(const Point &pt) { return false; } - virtual int proc17() { return 0; } + virtual bool MouseDragStartMsg(const CMouseDragStartMsg *msg) { return false; } virtual int proc18() { return 0; } virtual int proc19() { return 0; } /** * Handles mouse button messages */ - virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg) { return false; } + virtual bool MouseButtonMsg(const Point &pt) { return false; } virtual int proc21() { return 0; } virtual int proc22() { return 0; } @@ -131,9 +138,9 @@ public: /** * Handles keypresses when the glyph is focused */ - virtual bool KeyCharMsg(Common::KeyCode key) { return false; } + virtual bool KeyCharMsg(int key) { return false; } - virtual int proc24() { return 0; } + virtual bool VirtualKeyCharMsg(int key) { return false; } /** * Unhighlight any currently highlighted element @@ -145,9 +152,9 @@ public: */ virtual void highlightCurrent() {} - virtual void proc27() {} - virtual void proc28() {} - virtual int proc29() { return 0; } + virtual void proc27(const Point &pt, bool flag) {} + virtual void proc28(const Point &pt) {} + virtual int proc29(const Point &pt) { return 0; } /** * Returns true if the glyph's bounds, shifted to a given position, @@ -164,8 +171,17 @@ public: virtual int proc33() { return 1; } virtual int proc34() { return 1; } - virtual int proc35() { return 0; } - virtual void proc36() {} + + /** + * Called on a highlighted item when PET area is entered + */ + virtual bool enterHighlighted() { return false; } + + /** + * Called on a highlighted item when PET area is left + */ + virtual bool leaveHighlighted() { return false; } + virtual int proc37() { return 0; } /** @@ -181,6 +197,11 @@ private: */ Point getPosition(int index); + /** + * Get a rect for the glyph + */ + Rect getRect(int index); + /** * Returns the on-screen index for the highlight to be shown at */ @@ -195,6 +216,26 @@ private: * Return a specified glyph */ CPetGlyph *getGlyph(int index); + + /** + * Scrolls the glyphs to the left + */ + void scrollLeft(); + + /** + * Scrolls the glyphs to the right + */ + void scrollRight(); + + /** + * Set the first visible glyph index + */ + void setFirstVisible(int index); + + /** + * Make the PET dirty + */ + void makePetDirty(); protected: int _firstVisibleIndex; int _totalGlyphs; @@ -202,6 +243,7 @@ protected: int _highlightIndex; int _field1C; int _field20; + void *_field94; CPetSection *_owner; CPetGfxElement _selection; CPetGfxElement _scrollLeft; @@ -235,8 +277,15 @@ public: */ virtual void reset(); - virtual void proc10(); - virtual void proc11(); + /** + * Called when PET area is entered + */ + virtual bool enter(); + + /** + * Called when PET area is left + */ + virtual bool leave(); void set20(int val) { _field20 = val; } @@ -259,6 +308,53 @@ public: * Get the PET control */ CPetControl *getPetControl() const; + + /** + * Mouse button down message + */ + bool mouseButtonDown(const Point &pt); + + /** + * Mouse button up message + */ + bool mouseButtonUp(const Point &pt); + + /** + * Mouse drag start messagge + */ + bool mouseDragStart(CMouseDragStartMsg *msg); + + /** + * Mouse drag move message + */ + bool mouseDragMove(CMouseDragMoveMsg *msg); + + /** + * Mouse drag end message + */ + bool mouseDragEnd(CMouseDragEndMsg *msg); + + /** + * Key character message + */ + bool keyCharMsg(int key); + + /** + * Virtual key message + */ + bool virtualKeyCharMsg(int key); + + /** + * When the PET section is entered, passes onto the highlighted + * glyph, if any + */ + bool enterHighlighted(); + + /** + * When the PET section is left, passes onto the highlighted + * glyph, if any + */ + bool leaveHighlighted(); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index 063f019655..b27b664ab9 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -57,22 +57,37 @@ Rect CPetInventory::getBounds() { return Rect(); } -void CPetInventory::save(SimpleFile *file, int indent) const { - file->writeNumberLine(_field298, indent); +CGameObject *CPetInventory::dragEnd(const Point &pt) const { + warning("TODO: CPetInventory::dragEnd"); + return nullptr; +} + +bool CPetInventory::isValid(CPetControl *petControl) { + setPetControl(petControl); + return true; } void CPetInventory::load(SimpleFile *file, int param) { _field298 = file->readNumber(); } -CGameObject *CPetInventory::dragEnd(const Point &pt) const { - warning("TODO: CPetInventory::dragEnd"); - return nullptr; +void CPetInventory::postLoad() { + reset(); + _field290 = 1; + itemsChanged(); + _field290 = 0; } -bool CPetInventory::isValid(CPetControl *petControl) { - // TODO - return true; +void CPetInventory::save(SimpleFile *file, int indent) const { + file->writeNumberLine(_field298, indent); +} + +void CPetInventory::enter(PetArea oldArea) { + _items.enter(); +} + +void CPetInventory::leave() { + _items.leave(); } bool CPetInventory::setPetControl(CPetControl *petControl) { diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h index 32cb47edf5..ed1b679c63 100644 --- a/engines/titanic/pet_control/pet_inventory.h +++ b/engines/titanic/pet_control/pet_inventory.h @@ -91,11 +91,27 @@ public: */ virtual CGameObject *dragEnd(const Point &pt) const; + /** * Returns true if the object is in a valid state */ virtual bool isValid(CPetControl *petControl); + /** + * Called after a game has been loaded + */ + virtual void postLoad(); + + /** + * Called when a section is switched to + */ + virtual void enter(PetArea oldArea); + + /** + * Called when a section is being left, to switch to another area + */ + virtual void leave(); + virtual CGameObject *getBackground(int index) const { return (index >= 0 && index < 46) ? _itemBackgrounds[index] : nullptr; } diff --git a/engines/titanic/pet_control/pet_real_life.cpp b/engines/titanic/pet_control/pet_real_life.cpp index 38b7125ed3..ec1ea2c727 100644 --- a/engines/titanic/pet_control/pet_real_life.cpp +++ b/engines/titanic/pet_control/pet_real_life.cpp @@ -50,6 +50,52 @@ void CPetRealLife::draw(CScreenManager *screenManager) { _text.draw(screenManager); } +bool CPetRealLife::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + return _glyphs.mouseButtonDown(msg->_mousePos); +} + +bool CPetRealLife::MouseDragStartMsg(CMouseDragStartMsg *msg) { + return _glyphs.mouseDragStart(msg); +} + +bool CPetRealLife::MouseDragMoveMsg(CMouseDragMoveMsg *msg) { + return _glyphs.mouseDragMove(msg); +} + +bool CPetRealLife::MouseDragEndMsg(CMouseDragEndMsg *msg) { + return _glyphs.mouseDragEnd(msg); +} + +bool CPetRealLife::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + return _glyphs.mouseButtonUp(msg->_mousePos); +} + +bool CPetRealLife::KeyCharMsg(CKeyCharMsg *msg) { + _glyphs.keyCharMsg(msg->_key); + return true; +} + +bool CPetRealLife::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { + return _glyphs.virtualKeyCharMsg(msg->_keyState.keycode); +} + +void CPetRealLife::postLoad() { + reset(); +} + +bool CPetRealLife::isValid(CPetControl *petControl) { + setupControl(petControl); + return true; +} + +void CPetRealLife::enter(PetArea oldArea) { + _glyphs.enterHighlighted(); +} + +void CPetRealLife::leave() { + _glyphs.leaveHighlighted(); +} + bool CPetRealLife::setupControl(CPetControl *petControl) { if (petControl) { _petControl = petControl; @@ -78,11 +124,6 @@ void CPetRealLife::addButton(CPetGlyph *glyph) { } } -bool CPetRealLife::isValid(CPetControl *petControl) { - setupControl(petControl); - return true; -} - } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_real_life.h b/engines/titanic/pet_control/pet_real_life.h index c4c597c45f..b00c7c14c3 100644 --- a/engines/titanic/pet_control/pet_real_life.h +++ b/engines/titanic/pet_control/pet_real_life.h @@ -75,14 +75,13 @@ public: * Following are handlers for the various messages that the PET can * pass onto the currently active section/area */ - virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg) { return false; } - virtual bool MouseDragStartMsg(CMouseDragStartMsg *msg) { return false; } - virtual bool MouseDragMoveMsg(CMouseDragMoveMsg *msg) { return false; } - virtual bool MouseDragEndMsg(CMouseDragEndMsg *msg) { return false; } - virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg) { return false; } - virtual bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { return false; } - virtual bool KeyCharMsg(CKeyCharMsg *msg) { return false; } - virtual bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { return false; } + virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + virtual bool MouseDragStartMsg(CMouseDragStartMsg *msg); + virtual bool MouseDragMoveMsg(CMouseDragMoveMsg *msg); + virtual bool MouseDragEndMsg(CMouseDragEndMsg *msg); + virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); + virtual bool KeyCharMsg(CKeyCharMsg *msg); + virtual bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg); virtual int proc14() { return 0; } @@ -109,7 +108,7 @@ public: /** * Called after a game has been loaded */ - virtual void postLoad() {} + virtual void postLoad(); /** * Save the data for the class to file @@ -119,20 +118,23 @@ public: /** * Called when a section is switched to */ - virtual void enter(PetArea oldArea) {} + virtual void enter(PetArea oldArea); /** * Called when a section is being left, to switch to another area */ - virtual void leave() {} - - virtual void proc23() {} + virtual void leave(); /** * Called when a new room is entered */ virtual void enterRoom(CRoomItem *room) {} + /** + * Get a reference to the tooltip text associated with the section + */ + virtual CPetText *getText() { return &_text; } + }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 6cc1c10333..0911fd44f1 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -34,6 +34,7 @@ enum PetArea { }; class CPetControl; +class CPetText; class CScreenManager; class CRoomItem; @@ -139,7 +140,12 @@ public: virtual void enterRoom(CRoomItem *room) {} virtual void proc25(); - virtual int proc26() { return 0; } + + /** + * Get a reference to the tooltip text associated with the section + */ + virtual CPetText *getText() { return nullptr; } + virtual void proc27(); virtual void proc28(); virtual void proc29(); diff --git a/engines/titanic/pet_control/pet_sound.cpp b/engines/titanic/pet_control/pet_sound.cpp index 75dff34db5..d4c6fb376c 100644 --- a/engines/titanic/pet_control/pet_sound.cpp +++ b/engines/titanic/pet_control/pet_sound.cpp @@ -107,5 +107,18 @@ bool CPetSound::reset() { return false; } +void CPetSound::draw2(CScreenManager *screenManager) { + _element.draw(screenManager); + + _musicVolume.draw(screenManager); + _masterVolume.draw(screenManager); + _parrotVolume.draw(screenManager); + _speechVolume.draw(screenManager); + + _textMusicVolume.draw(screenManager); + _textMasterVolume.draw(screenManager); + _textParrotVolume.draw(screenManager); + _textSpeechVolume.draw(screenManager); +} } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_sound.h b/engines/titanic/pet_control/pet_sound.h index de6c637bd2..55e1f8a45c 100644 --- a/engines/titanic/pet_control/pet_sound.h +++ b/engines/titanic/pet_control/pet_sound.h @@ -55,6 +55,11 @@ public: * Reset the glyph */ virtual bool reset(); + + /** + * Handles any secondary drawing of the glyph + */ + virtual void draw2(CScreenManager *screenManager); }; } // End of namespace Titanic -- cgit v1.2.3 From 58e1a807f3c7c9e0342ef1edd964d6d13de57dc3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 23 Apr 2016 11:16:33 -0400 Subject: TITANIC: Clean up on element highlighting --- engines/titanic/pet_control/pet_glyphs.cpp | 38 ++++++++++++++++++++++----- engines/titanic/pet_control/pet_glyphs.h | 4 +-- engines/titanic/pet_control/pet_inventory.cpp | 4 +++ engines/titanic/pet_control/pet_inventory.h | 4 +-- 4 files changed, 39 insertions(+), 11 deletions(-) diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index 1ab7d7ee1b..7144378548 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -38,7 +38,7 @@ void CPetGlyph::drawAt(CScreenManager *screenManager, const Point &pt) { _element.translate(-pt.x, -pt.y); } -void CPetGlyph::proc14(const Point &pt) { +void CPetGlyph::proc14() { warning("TODO: CPetGlyph::proc14"); } @@ -183,7 +183,34 @@ Rect CPetGlyphs::getRect(int index) { } void CPetGlyphs::changeHighlight(int index) { - warning("TODO: CPetGlyphs::changeHighlight"); + if (index == _highlightIndex) + return; + + if (_highlightIndex >= 0 && (_field20 & 4)) { + CPetGlyph *glyph = getGlyph(_highlightIndex); + if (glyph) + glyph->unhighlightCurrent(); + } + + _highlightIndex = index; + if (index >= 0) { + CPetGlyph *glyph = getGlyph(_highlightIndex); + + if (glyph) { + if (_field20 & 4) { + Point pt; + int idx = getHighlightedIndex(_highlightIndex); + if (idx >= 0) + pt = getPosition(idx); + + glyph->highlightCurrent(pt); + } + + glyph->proc14(); + } + } else if (_owner) { + _owner->proc28(); + } } void CPetGlyphs::highlight(int index) { @@ -281,11 +308,10 @@ bool CPetGlyphs::mouseButtonDown(const Point &pt) { int index = getItemIndex(idx); CPetGlyph *glyph = getGlyph(index); if (glyph) { - if (index == _highlightIndex) { - glyph->proc28(glyphRect); - glyph->proc14(pt); + if (glyph->checkHighlight(pt)) return true; - } else { + + if (!(_field20 & 2)) { changeHighlight(index); makePetDirty(); return true; diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index 496654762e..24d0a0840b 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -110,7 +110,7 @@ public: */ virtual void draw2(CScreenManager *screenManager) {} - virtual void proc14(const Point &pt); + virtual void proc14(); /** * Get the bounds for the glyph @@ -150,7 +150,7 @@ public: /** * Highlight any currently highlighted element */ - virtual void highlightCurrent() {} + virtual void highlightCurrent(const Point &pt) {} virtual void proc27(const Point &pt, bool flag) {} virtual void proc28(const Point &pt) {} diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index b27b664ab9..621bf2df0d 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -90,6 +90,10 @@ void CPetInventory::leave() { _items.leave(); } +CGameObject *CPetInventory::getBackground(int index) const { + return (index >= 0 && index < 46) ? _itemBackgrounds[index] : nullptr; +} + bool CPetInventory::setPetControl(CPetControl *petControl) { if (!petControl) return false; diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h index ed1b679c63..969e253676 100644 --- a/engines/titanic/pet_control/pet_inventory.h +++ b/engines/titanic/pet_control/pet_inventory.h @@ -112,9 +112,7 @@ public: */ virtual void leave(); - virtual CGameObject *getBackground(int index) const { - return (index >= 0 && index < 46) ? _itemBackgrounds[index] : nullptr; - } + virtual CGameObject *getBackground(int index) const; /** * -- cgit v1.2.3 From 631d979fb3c213a2de8bf32a72236ab76e3ad1d8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 23 Apr 2016 11:29:26 -0400 Subject: TITANIC: Fix mouse presses on PET glyphs --- engines/titanic/pet_control/pet_glyphs.cpp | 11 ++++++----- engines/titanic/pet_control/pet_quit.cpp | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index 7144378548..632c8a38a1 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -308,14 +308,15 @@ bool CPetGlyphs::mouseButtonDown(const Point &pt) { int index = getItemIndex(idx); CPetGlyph *glyph = getGlyph(index); if (glyph) { - if (glyph->checkHighlight(pt)) - return true; - - if (!(_field20 & 2)) { + if (_highlightIndex == index) { + glyph->proc28(glyphRect); + glyph->proc14(); + } else { changeHighlight(index); makePetDirty(); - return true; } + + return true; } } } diff --git a/engines/titanic/pet_control/pet_quit.cpp b/engines/titanic/pet_control/pet_quit.cpp index be7257f209..2f515a3235 100644 --- a/engines/titanic/pet_control/pet_quit.cpp +++ b/engines/titanic/pet_control/pet_quit.cpp @@ -37,9 +37,9 @@ bool CPetQuit::setup(CPetControl *petControl, CPetGlyphs *owner) { _text.setHasBorder(true); _text.setup(); - Rect elementRect(0, 0, 496, 388); - elementRect.moveTo(496, 388); - _element.setBounds(elementRect); + Rect btnRect(0, 0, 496, 388); + btnRect.moveTo(496, 388); + _btnYes.setBounds(btnRect); return true; } -- cgit v1.2.3 From d11a95068c2566564e0372bad0ad5c656af79298 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 23 Apr 2016 16:46:17 -0400 Subject: TITANIC: Standardizing PET mouse button methods, quit is now working --- engines/titanic/pet_control/pet_element.cpp | 4 ++-- engines/titanic/pet_control/pet_element.h | 2 +- engines/titanic/pet_control/pet_frame.cpp | 2 +- engines/titanic/pet_control/pet_glyphs.cpp | 16 ++++++++-------- engines/titanic/pet_control/pet_glyphs.h | 18 +++++++++--------- engines/titanic/pet_control/pet_load_save.cpp | 2 +- engines/titanic/pet_control/pet_quit.cpp | 4 ++-- engines/titanic/pet_control/pet_quit.h | 7 +++++-- engines/titanic/pet_control/pet_real_life.cpp | 14 +++++++------- 9 files changed, 36 insertions(+), 33 deletions(-) diff --git a/engines/titanic/pet_control/pet_element.cpp b/engines/titanic/pet_control/pet_element.cpp index db6b122c94..3e9c991d1d 100644 --- a/engines/titanic/pet_control/pet_element.cpp +++ b/engines/titanic/pet_control/pet_element.cpp @@ -40,8 +40,8 @@ bool CPetElement::highlightBounds(const Point &pt) { return result; } -bool CPetElement::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { - bool result = _bounds.contains(msg->_mousePos); +bool CPetElement::MouseButtonDownMsg(const Point &pt) { + bool result = _bounds.contains(pt); if (result) setMode(MODE_UNSELECTED); return result; diff --git a/engines/titanic/pet_control/pet_element.h b/engines/titanic/pet_control/pet_element.h index 17e5881a2b..effc575974 100644 --- a/engines/titanic/pet_control/pet_element.h +++ b/engines/titanic/pet_control/pet_element.h @@ -77,7 +77,7 @@ public: /** * Handles processing mouse button messages */ - virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + virtual bool MouseButtonDownMsg(const Point &pt); /** * Returns whether the passed point falls inside the item diff --git a/engines/titanic/pet_control/pet_frame.cpp b/engines/titanic/pet_control/pet_frame.cpp index a9f45fa746..827874fffc 100644 --- a/engines/titanic/pet_control/pet_frame.cpp +++ b/engines/titanic/pet_control/pet_frame.cpp @@ -65,7 +65,7 @@ bool CPetFrame::reset() { bool CPetFrame::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { for (int idx = 0; idx < 5; ++idx) { - if (_modeButtons[idx].MouseButtonDownMsg(msg)) { + if (_modeButtons[idx].MouseButtonDownMsg(msg->_mousePos)) { _petControl->setArea(PET_AREAS[idx]); resetArea(); _modeButtons[idx].setMode(MODE_SELECTED); diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index 632c8a38a1..20f864d456 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -291,7 +291,7 @@ void CPetGlyphs::makePetDirty() { _owner->_petControl->makeDirty(); } -bool CPetGlyphs::mouseButtonDown(const Point &pt) { +bool CPetGlyphs::MouseButtonDownMsg(const Point &pt) { if (_scrollLeft.contains2(pt)) { scrollLeft(); return true; @@ -338,11 +338,11 @@ bool CPetGlyphs::mouseButtonDown(const Point &pt) { return false; } -bool CPetGlyphs::mouseButtonUp(const Point &pt) { +bool CPetGlyphs::MouseButtonUpMsg(const Point &pt) { if (_highlightIndex >= 0) { CPetGlyph *glyph = getGlyph(_highlightIndex); if (glyph) { - if (glyph->MouseButtonMsg(pt)) + if (glyph->MouseButtonUpMsg(pt)) return true; } } @@ -350,7 +350,7 @@ bool CPetGlyphs::mouseButtonUp(const Point &pt) { return false; } -bool CPetGlyphs::mouseDragStart(CMouseDragStartMsg *msg) { +bool CPetGlyphs::MouseDragStartMsg(CMouseDragStartMsg *msg) { if (!(_field20 & 1) && _highlightIndex >= 0) { CPetGlyph *glyph = getGlyph(_highlightIndex); int index = getHighlightedIndex(_highlightIndex); @@ -365,7 +365,7 @@ bool CPetGlyphs::mouseDragStart(CMouseDragStartMsg *msg) { return false; } -bool CPetGlyphs::mouseDragMove(CMouseDragMoveMsg *msg) { +bool CPetGlyphs::MouseDragMoveMsg(CMouseDragMoveMsg *msg) { if (_field94) { error("TODO"); } else { @@ -373,7 +373,7 @@ bool CPetGlyphs::mouseDragMove(CMouseDragMoveMsg *msg) { } } -bool CPetGlyphs::mouseDragEnd(CMouseDragEndMsg *msg) { +bool CPetGlyphs::MouseDragEndMsg(CMouseDragEndMsg *msg) { if (_field94) { error("TODO"); } else { @@ -381,7 +381,7 @@ bool CPetGlyphs::mouseDragEnd(CMouseDragEndMsg *msg) { } } -bool CPetGlyphs::keyCharMsg(int key) { +bool CPetGlyphs::KeyCharMsg(int key) { if (_highlightIndex >= 0) { CPetGlyph *glyph = getGlyph(_highlightIndex); @@ -392,7 +392,7 @@ bool CPetGlyphs::keyCharMsg(int key) { return false; } -bool CPetGlyphs::virtualKeyCharMsg(int key) { +bool CPetGlyphs::VirtualKeyCharMsg(int key) { bool handled = false; warning("TODO: CPetGlyphs::virtualKeyCharMsg"); diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index 24d0a0840b..80c2153a1a 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -128,9 +128,9 @@ public: virtual int proc19() { return 0; } /** - * Handles mouse button messages + * Handles mouse button up messages */ - virtual bool MouseButtonMsg(const Point &pt) { return false; } + virtual bool MouseButtonUpMsg(const Point &pt) { return false; } virtual int proc21() { return 0; } virtual int proc22() { return 0; } @@ -312,37 +312,37 @@ public: /** * Mouse button down message */ - bool mouseButtonDown(const Point &pt); + bool MouseButtonDownMsg(const Point &pt); /** * Mouse button up message */ - bool mouseButtonUp(const Point &pt); + bool MouseButtonUpMsg(const Point &pt); /** * Mouse drag start messagge */ - bool mouseDragStart(CMouseDragStartMsg *msg); + bool MouseDragStartMsg(CMouseDragStartMsg *msg); /** * Mouse drag move message */ - bool mouseDragMove(CMouseDragMoveMsg *msg); + bool MouseDragMoveMsg(CMouseDragMoveMsg *msg); /** * Mouse drag end message */ - bool mouseDragEnd(CMouseDragEndMsg *msg); + bool MouseDragEndMsg(CMouseDragEndMsg *msg); /** * Key character message */ - bool keyCharMsg(int key); + bool KeyCharMsg(int key); /** * Virtual key message */ - bool virtualKeyCharMsg(int key); + bool VirtualKeyCharMsg(int key); /** * When the PET section is entered, passes onto the highlighted diff --git a/engines/titanic/pet_control/pet_load_save.cpp b/engines/titanic/pet_control/pet_load_save.cpp index 4ebe9d03b0..f777f122fe 100644 --- a/engines/titanic/pet_control/pet_load_save.cpp +++ b/engines/titanic/pet_control/pet_load_save.cpp @@ -80,7 +80,7 @@ bool CPetLoadSave::checkHighlight(const Point &pt) { } bool CPetLoadSave::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { - if (_btnLoadSave.MouseButtonDownMsg(msg)) { + if (_btnLoadSave.MouseButtonDownMsg(msg->_mousePos)) { execute(); resetSlots(); return true; diff --git a/engines/titanic/pet_control/pet_quit.cpp b/engines/titanic/pet_control/pet_quit.cpp index 2f515a3235..e6c354a129 100644 --- a/engines/titanic/pet_control/pet_quit.cpp +++ b/engines/titanic/pet_control/pet_quit.cpp @@ -70,9 +70,9 @@ bool CPetQuit::checkHighlight(const Point &pt) { return !_btnYes.highlightBounds(pt); } -bool CPetQuit::mouseButtonDownMsg(CMouseButtonDownMsg *msg) { +bool CPetQuit::MouseButtonUpMsg(const Point &pt) { CPetControl *pet = getPetControl(); - if (_btnYes.MouseButtonDownMsg(msg) && pet) { + if (_btnYes.MouseButtonDownMsg(pt) && pet) { CGameManager *gameManager = pet->getGameManager(); if (gameManager) gameManager->_gameState._quitGame = true; diff --git a/engines/titanic/pet_control/pet_quit.h b/engines/titanic/pet_control/pet_quit.h index cfe3e6fb76..72b93c152f 100644 --- a/engines/titanic/pet_control/pet_quit.h +++ b/engines/titanic/pet_control/pet_quit.h @@ -55,8 +55,11 @@ public: */ virtual bool checkHighlight(const Point &pt); - virtual bool mouseButtonDownMsg(CMouseButtonDownMsg *msg); - + /** + * Handles mouse button up messages + */ + virtual bool MouseButtonUpMsg(const Point &pt); + /** * Returns the tooltip text for when the glyph is selected */ diff --git a/engines/titanic/pet_control/pet_real_life.cpp b/engines/titanic/pet_control/pet_real_life.cpp index ec1ea2c727..59702046ba 100644 --- a/engines/titanic/pet_control/pet_real_life.cpp +++ b/engines/titanic/pet_control/pet_real_life.cpp @@ -51,32 +51,32 @@ void CPetRealLife::draw(CScreenManager *screenManager) { } bool CPetRealLife::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { - return _glyphs.mouseButtonDown(msg->_mousePos); + return _glyphs.MouseButtonDownMsg(msg->_mousePos); } bool CPetRealLife::MouseDragStartMsg(CMouseDragStartMsg *msg) { - return _glyphs.mouseDragStart(msg); + return _glyphs.MouseDragStartMsg(msg); } bool CPetRealLife::MouseDragMoveMsg(CMouseDragMoveMsg *msg) { - return _glyphs.mouseDragMove(msg); + return _glyphs.MouseDragMoveMsg(msg); } bool CPetRealLife::MouseDragEndMsg(CMouseDragEndMsg *msg) { - return _glyphs.mouseDragEnd(msg); + return _glyphs.MouseDragEndMsg(msg); } bool CPetRealLife::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { - return _glyphs.mouseButtonUp(msg->_mousePos); + return _glyphs.MouseButtonUpMsg(msg->_mousePos); } bool CPetRealLife::KeyCharMsg(CKeyCharMsg *msg) { - _glyphs.keyCharMsg(msg->_key); + _glyphs.KeyCharMsg(msg->_key); return true; } bool CPetRealLife::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { - return _glyphs.virtualKeyCharMsg(msg->_keyState.keycode); + return _glyphs.VirtualKeyCharMsg(msg->_keyState.keycode); } void CPetRealLife::postLoad() { -- cgit v1.2.3 From fc3f2952b097cd0d465efe0216b11602c5ab0191 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 23 Apr 2016 17:02:22 -0400 Subject: TITANIC: Define Glyph flags enum --- engines/titanic/pet_control/pet_glyphs.cpp | 14 +++++++------- engines/titanic/pet_control/pet_glyphs.h | 6 ++++-- engines/titanic/pet_control/pet_inventory.cpp | 2 +- engines/titanic/pet_control/pet_quit.cpp | 2 +- engines/titanic/pet_control/pet_real_life.cpp | 2 +- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index 20f864d456..6c5454844a 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -67,7 +67,7 @@ void CPetGlyph::setName(const CString &name, CPetControl *petControl) { /*------------------------------------------------------------------------*/ CPetGlyphs::CPetGlyphs() : _firstVisibleIndex(0), _numVisibleGlyphs(TOTAL_GLYPHS), - _highlightIndex(-1), _field1C(-1), _field20(0), + _highlightIndex(-1), _field1C(-1), _flags(0), _field94(nullptr), _owner(nullptr) { } @@ -159,7 +159,7 @@ void CPetGlyphs::draw(CScreenManager *screenManager) { } // Draw scrolling arrows if more than a screen's worth of items are showing - if (listSize > _numVisibleGlyphs || _field20 != 16) { + if (listSize > _numVisibleGlyphs || (_flags & GFLAG_16)) { _scrollLeft.draw(screenManager); _scrollRight.draw(screenManager); } @@ -186,7 +186,7 @@ void CPetGlyphs::changeHighlight(int index) { if (index == _highlightIndex) return; - if (_highlightIndex >= 0 && (_field20 & 4)) { + if (_highlightIndex >= 0 && (_flags & GFLAG_4)) { CPetGlyph *glyph = getGlyph(_highlightIndex); if (glyph) glyph->unhighlightCurrent(); @@ -197,7 +197,7 @@ void CPetGlyphs::changeHighlight(int index) { CPetGlyph *glyph = getGlyph(_highlightIndex); if (glyph) { - if (_field20 & 4) { + if (_flags & GFLAG_4) { Point pt; int idx = getHighlightedIndex(_highlightIndex); if (idx >= 0) @@ -243,7 +243,7 @@ void CPetGlyphs::setFirstVisible(int index) { if (index != _firstVisibleIndex) { _firstVisibleIndex = index; - if ((_field20 & 8) && _highlightIndex != -1) { + if ((_flags & GFLAG_8) && _highlightIndex != -1) { CPetGlyph *glyph = getGlyph(_highlightIndex); if (glyph) { @@ -328,7 +328,7 @@ bool CPetGlyphs::MouseButtonDownMsg(const Point &pt) { if (glyph->checkHighlight(pt)) return true; - if (!(_field20 & 2)) { + if (!(_flags & GFLAG_2)) { changeHighlight(-1); makePetDirty(); } @@ -351,7 +351,7 @@ bool CPetGlyphs::MouseButtonUpMsg(const Point &pt) { } bool CPetGlyphs::MouseDragStartMsg(CMouseDragStartMsg *msg) { - if (!(_field20 & 1) && _highlightIndex >= 0) { + if (!(_flags & GFLAG_1) && _highlightIndex >= 0) { CPetGlyph *glyph = getGlyph(_highlightIndex); int index = getHighlightedIndex(_highlightIndex); Rect glyphRect = getRect(index); diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index 80c2153a1a..c7966e5e6a 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -38,6 +38,8 @@ class CPetText; enum GlyphActionMode { ACTION_REMOVE = 0, ACTION_REMOVED = 1, ACTION_CHANGE = 2 }; +enum GlyphFlag { GFLAG_1 = 1, GFLAG_2 = 2, GFLAG_4 = 4, GFLAG_8 = 8, GFLAG_16 = 16 }; + class CGlyphAction { protected: GlyphActionMode _mode; @@ -242,7 +244,7 @@ protected: int _numVisibleGlyphs; int _highlightIndex; int _field1C; - int _field20; + int _flags; void *_field94; CPetSection *_owner; CPetGfxElement _selection; @@ -287,7 +289,7 @@ public: */ virtual bool leave(); - void set20(int val) { _field20 = val; } + void setFlags(int flags) { _flags = flags; } /** * Draw the control diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index 621bf2df0d..c7c6dfdf7c 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -100,7 +100,7 @@ bool CPetInventory::setPetControl(CPetControl *petControl) { _petControl = petControl; _items.setup(7, this); - _items.set20(28); + _items.setFlags(28); Rect tempRect(0, 0, 52, 52); for (uint idx = 0; idx < TOTAL_ITEMS; ++idx) { diff --git a/engines/titanic/pet_control/pet_quit.cpp b/engines/titanic/pet_control/pet_quit.cpp index e6c354a129..c191e30ceb 100644 --- a/engines/titanic/pet_control/pet_quit.cpp +++ b/engines/titanic/pet_control/pet_quit.cpp @@ -62,7 +62,7 @@ bool CPetQuit::reset() { } void CPetQuit::draw2(CScreenManager *screenManager) { - _text.draw(screenManager); +// _text.draw(screenManager); _btnYes.draw(screenManager); } diff --git a/engines/titanic/pet_control/pet_real_life.cpp b/engines/titanic/pet_control/pet_real_life.cpp index 59702046ba..27a5c22b01 100644 --- a/engines/titanic/pet_control/pet_real_life.cpp +++ b/engines/titanic/pet_control/pet_real_life.cpp @@ -100,7 +100,7 @@ bool CPetRealLife::setupControl(CPetControl *petControl) { if (petControl) { _petControl = petControl; _glyphs.setup(4, this); - _glyphs.set20(6); + _glyphs.setFlags(6); addButton(new CPetLoad()); addButton(new CPetSave()); -- cgit v1.2.3 From a8d4e827d23110e978319a2a6d7f036d16c7f66a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 23 Apr 2016 17:13:07 -0400 Subject: TITANIC: Correct coordinates in CPetQuit setup --- engines/titanic/pet_control/pet_quit.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/engines/titanic/pet_control/pet_quit.cpp b/engines/titanic/pet_control/pet_quit.cpp index c191e30ceb..7dcaba895c 100644 --- a/engines/titanic/pet_control/pet_quit.cpp +++ b/engines/titanic/pet_control/pet_quit.cpp @@ -30,14 +30,15 @@ namespace Titanic { bool CPetQuit::setup(CPetControl *petControl, CPetGlyphs *owner) { CPetGlyph::setup(petControl, owner); + Rect tempRect(0, 0, 280, 16); - tempRect.moveTo(32, 407); + tempRect.moveTo(322, 407); _text.setBounds(tempRect); _text.resize(3); _text.setHasBorder(true); _text.setup(); - Rect btnRect(0, 0, 496, 388); + Rect btnRect(0, 0, 68, 52); btnRect.moveTo(496, 388); _btnYes.setBounds(btnRect); @@ -62,7 +63,7 @@ bool CPetQuit::reset() { } void CPetQuit::draw2(CScreenManager *screenManager) { -// _text.draw(screenManager); + _text.draw(screenManager); _btnYes.draw(screenManager); } -- cgit v1.2.3 From f6f68e547d39957fc4678859a95cbec839cc41e4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 23 Apr 2016 19:03:55 -0400 Subject: TITANIC: Implement changing sound slider percentages --- engines/titanic/pet_control/pet_control.cpp | 8 +++ engines/titanic/pet_control/pet_control.h | 5 ++ engines/titanic/pet_control/pet_slider.cpp | 12 +++++ engines/titanic/pet_control/pet_slider.h | 5 ++ engines/titanic/pet_control/pet_sound.cpp | 77 +++++++++++++++++++++++++++++ engines/titanic/pet_control/pet_sound.h | 11 +++++ engines/titanic/sound/sound.h | 1 + engines/titanic/sound/sound_manager.cpp | 4 +- engines/titanic/sound/sound_manager.h | 16 +++--- 9 files changed, 129 insertions(+), 10 deletions(-) diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 0bba2c2330..145543fb07 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -423,4 +423,12 @@ void CPetControl::moveToHiddenRoom(CTreeItem *item) { } } +void CPetControl::playSound(int soundNum) { + CTreeItem *player = getHiddenObject("PETSoundPlayer"); + if (player) { + CPETPlaySoundMsg playMsg(soundNum); + playMsg.execute(player); + } +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index e7ec993ba9..e4f0710b76 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -240,6 +240,11 @@ public: void moveToHiddenRoom(CTreeItem *item); void setC8(int val) { _fieldC8 = val; } + + /** + * Play a sound + */ + void playSound(int soundNum); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_slider.cpp b/engines/titanic/pet_control/pet_slider.cpp index 3e579a4b33..1bbad969a2 100644 --- a/engines/titanic/pet_control/pet_slider.cpp +++ b/engines/titanic/pet_control/pet_slider.cpp @@ -168,6 +168,18 @@ void CPetSlider::setOrientation(SliderOrientation orientation) { _orientation |= orientation; } +void CPetSlider::stepPosition(int direction) { + double val = getOffsetPixels(); + + if (direction == -1) { + val = MAX(val - 0.1, 0.0); + } else if (direction == 1) { + val = MIN(val + 0.1, 1.0); + } + + setSliderOffset(val); +} + /*------------------------------------------------------------------------*/ void CPetSoundSlider::setupBackground(const CString &name, CPetControl *petControl) { diff --git a/engines/titanic/pet_control/pet_slider.h b/engines/titanic/pet_control/pet_slider.h index 7a61741143..58b2aa68cc 100644 --- a/engines/titanic/pet_control/pet_slider.h +++ b/engines/titanic/pet_control/pet_slider.h @@ -180,6 +180,11 @@ public: _bounds.translate(pt.x, pt.y); _slidingRect.translate(pt.x, pt.y); } + + /** + * Change the current position of a slider by a step amount + */ + void stepPosition(int direction); }; class CPetSoundSlider : public CPetSlider { diff --git a/engines/titanic/pet_control/pet_sound.cpp b/engines/titanic/pet_control/pet_sound.cpp index d4c6fb376c..2305f42a8f 100644 --- a/engines/titanic/pet_control/pet_sound.cpp +++ b/engines/titanic/pet_control/pet_sound.cpp @@ -22,6 +22,7 @@ #include "titanic/pet_control/pet_sound.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/game_manager.h" namespace Titanic { @@ -121,4 +122,80 @@ void CPetSound::draw2(CScreenManager *screenManager) { _textSpeechVolume.draw(screenManager); } +bool CPetSound::checkHighlight(const Point &pt) { + if (_musicVolume.checkThumb(pt) || _masterVolume.checkThumb(pt) || + _speechVolume.checkThumb(pt)) + return true; + + if (_parrotVolume.checkThumb(pt)) { + CPetControl *pet = getPetControl(); + if (pet) + pet->playSound(2); + + return true; + } + + Rect rectLeft(0, 0, 10, 11); + Rect rectRight(0, 0, 10, 11); + rectLeft.translate(415, 379); + rectRight.translate(567, 378); + + CPetSlider *sliders[4] = { &_masterVolume, &_musicVolume, &_parrotVolume, &_speechVolume }; + for (int idx = 0; idx < 4; ++idx) { + CPetSlider *slider = sliders[idx]; + bool isLeft = rectLeft.contains(pt); + bool isRight = rectRight.contains(pt); + int offset; + + if (isLeft) { + slider->stepPosition(-1); + offset = slider->getOffsetPixels(); + } else if (isRight) { + slider->stepPosition(1); + offset = slider->getOffsetPixels(); + } + + if (isLeft || isRight) { + sliderChanged(offset, idx); + return true; + } + + // Move to next slider row + rectLeft.translate(0, 20); + rectRight.translate(0, 20); + } + + return false; +} + +void CPetSound::sliderChanged(double offset, int sliderNum) { + CPetControl *pet = getPetControl(); + if (!pet) + return; + + CGameManager *gameManager = pet->getGameManager(); + if (!gameManager) + return; + + QSoundManager &soundManager = gameManager->_sound._soundManager; + double percent = offset * 100.0; + + switch (sliderNum) { + case 0: + soundManager.setMasterPercent(percent); + break; + case 1: + soundManager.setMusicPercent(percent); + break; + case 2: + soundManager.setParrotPercent(percent); + break; + case 3: + soundManager.setSpeechPercent(percent); + break; + default: + break; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_sound.h b/engines/titanic/pet_control/pet_sound.h index 55e1f8a45c..36b6a8bb33 100644 --- a/engines/titanic/pet_control/pet_sound.h +++ b/engines/titanic/pet_control/pet_sound.h @@ -43,6 +43,11 @@ private: CPetText _textSpeechVolume; int _field198; int _field19C; +private: + /** + * Called when a slider has changed + */ + void sliderChanged(double offset, int sliderNum); public: CPetSound(); @@ -60,6 +65,12 @@ public: * Handles any secondary drawing of the glyph */ virtual void draw2(CScreenManager *screenManager); + + /** + * Checks and updates any highlight of the glyph or any contextual + * information it displays + */ + virtual bool checkHighlight(const Point &pt); }; } // End of namespace Titanic diff --git a/engines/titanic/sound/sound.h b/engines/titanic/sound/sound.h index 07300264af..488d4deb5e 100644 --- a/engines/titanic/sound/sound.h +++ b/engines/titanic/sound/sound.h @@ -34,6 +34,7 @@ class CGameManager; class CSound { private: CGameManager *_gameManager; +public: QSoundManager _soundManager; public: CSound(CGameManager *owner); diff --git a/engines/titanic/sound/sound_manager.cpp b/engines/titanic/sound/sound_manager.cpp index 9b78a9e5b6..53e5a3dfe0 100644 --- a/engines/titanic/sound/sound_manager.cpp +++ b/engines/titanic/sound/sound_manager.cpp @@ -24,8 +24,8 @@ namespace Titanic { -SoundManager::SoundManager() : _field4(0), _field8(0), - _fieldC(0), _field10(0), _field14(1) { +SoundManager::SoundManager() : _musicPercent(75.0), _speechPercent(75.0), + _masterPercent(75.0), _parrotPercent(75.0), _field14(1) { } /*------------------------------------------------------------------------*/ diff --git a/engines/titanic/sound/sound_manager.h b/engines/titanic/sound/sound_manager.h index d37db60e28..68843dd1f2 100644 --- a/engines/titanic/sound/sound_manager.h +++ b/engines/titanic/sound/sound_manager.h @@ -29,10 +29,10 @@ namespace Titanic { class SoundManager { protected: - int _field4; - int _field8; - int _fieldC; - int _field10; + double _musicPercent; + double _speechPercent; + double _masterPercent; + double _parrotPercent; int _field14; public: SoundManager(); @@ -53,10 +53,10 @@ public: virtual int proc16() const { return 0; } virtual void WaveMixPump() {} virtual int proc18() const { return 0; } - virtual void proc19(int v) { _field4 = v; } - virtual void proc20(int v) { _field8 = v; } - virtual void proc21(int v) { _fieldC = v; } - virtual void proc22(int v) { _field10 = v; } + virtual void setMusicPercent(double percent) { _musicPercent = percent; } + virtual void setSpeechPercent(double percent) { _speechPercent = percent; } + virtual void setMasterPercent(double percent) { _masterPercent = percent; } + virtual void setParrotPercent(double percent) { _parrotPercent = percent; } /** * Called when a game is about to be loaded -- cgit v1.2.3 From 2b1e045b5c57f1bae61bd3ffbd05577062f6f34c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 23 Apr 2016 20:30:02 -0400 Subject: TITANIC: Implemented remainder of CPetSound methods --- engines/titanic/pet_control/pet_glyphs.cpp | 21 ++++++-- engines/titanic/pet_control/pet_glyphs.h | 30 +++++++++-- engines/titanic/pet_control/pet_slider.cpp | 5 +- engines/titanic/pet_control/pet_slider.h | 18 +++++-- engines/titanic/pet_control/pet_sound.cpp | 82 +++++++++++++++++++++++++++++- engines/titanic/pet_control/pet_sound.h | 36 ++++++++++++- 6 files changed, 175 insertions(+), 17 deletions(-) diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index 6c5454844a..fd4828ab40 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -68,7 +68,7 @@ void CPetGlyph::setName(const CString &name, CPetControl *petControl) { CPetGlyphs::CPetGlyphs() : _firstVisibleIndex(0), _numVisibleGlyphs(TOTAL_GLYPHS), _highlightIndex(-1), _field1C(-1), _flags(0), - _field94(nullptr), _owner(nullptr) { + _dragGlyph(nullptr), _owner(nullptr) { } void CPetGlyphs::setNumVisible(int total) { @@ -366,16 +366,16 @@ bool CPetGlyphs::MouseDragStartMsg(CMouseDragStartMsg *msg) { } bool CPetGlyphs::MouseDragMoveMsg(CMouseDragMoveMsg *msg) { - if (_field94) { - error("TODO"); + if (_dragGlyph) { + return _dragGlyph->MouseDragMoveMsg(msg); } else { return false; } } bool CPetGlyphs::MouseDragEndMsg(CMouseDragEndMsg *msg) { - if (_field94) { - error("TODO"); + if (_dragGlyph) { + return _dragGlyph->MouseDragEndMsg(msg); } else { return false; } @@ -419,4 +419,15 @@ bool CPetGlyphs::leaveHighlighted() { return false; } +void CPetGlyphs::startDragging(CPetGlyph *glyph, CMouseDragStartMsg *msg) { + if (glyph) { + _dragGlyph = glyph; + msg->_dragItem = getPetControl(); + } +} + +void CPetGlyphs::endDragging() { + _dragGlyph = nullptr; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index c7966e5e6a..e4f4b1f59a 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -25,6 +25,7 @@ #include "common/keyboard.h" #include "titanic/core/list.h" +#include "titanic/messages/mouse_messages.h" #include "titanic/pet_control/pet_gfx_element.h" #include "titanic/support/rect.h" @@ -125,9 +126,20 @@ public: */ virtual bool checkHighlight(const Point &pt) { return false; } - virtual bool MouseDragStartMsg(const CMouseDragStartMsg *msg) { return false; } - virtual int proc18() { return 0; } - virtual int proc19() { return 0; } + /** + * Called when mouse drag starts + */ + virtual bool MouseDragStartMsg(CMouseDragStartMsg *msg) { return false; } + + /** + * Called during mouse drags + */ + virtual bool MouseDragMoveMsg(CMouseDragMoveMsg *msg) { return false; } + + /** + * Called when mouse drag ends + */ + virtual bool MouseDragEndMsg(CMouseDragEndMsg *msg) { return false; } /** * Handles mouse button up messages @@ -245,7 +257,7 @@ protected: int _highlightIndex; int _field1C; int _flags; - void *_field94; + CPetGlyph *_dragGlyph; CPetSection *_owner; CPetGfxElement _selection; CPetGfxElement _scrollLeft; @@ -357,6 +369,16 @@ public: * glyph, if any */ bool leaveHighlighted(); + + /** + * Called when a dragging operation starts + */ + void startDragging(CPetGlyph *glyph, CMouseDragStartMsg *msg); + + /** + * Called when a dragging operation ends + */ + void endDragging(); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_slider.cpp b/engines/titanic/pet_control/pet_slider.cpp index 1bbad969a2..e8f31a70d2 100644 --- a/engines/titanic/pet_control/pet_slider.cpp +++ b/engines/titanic/pet_control/pet_slider.cpp @@ -53,12 +53,13 @@ bool CPetSlider::resetThumbFocus() { return result; } -void CPetSlider::proc10(const Point &pt) { +bool CPetSlider::MouseDragMoveMsg(const Point &pt) { int newOffset = calcSliderOffset(pt); setOffsetPixels(newOffset); + return true; } -bool CPetSlider::proc12(const Point &pt) { +bool CPetSlider::MouseButtonUpMsg(const Point &pt) { if (thumbContains(pt)) return true; if (!containsPt(pt)) diff --git a/engines/titanic/pet_control/pet_slider.h b/engines/titanic/pet_control/pet_slider.h index 58b2aa68cc..93390a5d59 100644 --- a/engines/titanic/pet_control/pet_slider.h +++ b/engines/titanic/pet_control/pet_slider.h @@ -126,9 +126,21 @@ public: */ virtual bool resetThumbFocus(); - virtual void proc10(const Point &pt); - virtual bool proc11() { return true; } - virtual bool proc12(const Point &pt); + /** + * Handles dragging the slider + */ + virtual bool MouseDragMoveMsg(const Point &pt); + + /** + * Called when a slider drag ends + */ + virtual bool MouseDragEndMsg(const Point &pt) { return true; } + + /** + * Handles mouse button up messaes + */ + virtual bool MouseButtonUpMsg(const Point &pt); + virtual bool proc13() { return false; } virtual bool proc14() { return false; } diff --git a/engines/titanic/pet_control/pet_sound.cpp b/engines/titanic/pet_control/pet_sound.cpp index 2305f42a8f..736b966974 100644 --- a/engines/titanic/pet_control/pet_sound.cpp +++ b/engines/titanic/pet_control/pet_sound.cpp @@ -22,11 +22,12 @@ #include "titanic/pet_control/pet_sound.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/pet_control/pet_real_life.h" #include "titanic/game_manager.h" namespace Titanic { -CPetSound::CPetSound() : CPetGlyph(), _field198(0), _field19C(0) { +CPetSound::CPetSound() : CPetGlyph(), _draggingSlider(nullptr), _draggingSliderNum(0) { } bool CPetSound::setup(CPetControl *petControl, CPetGlyphs *owner) { @@ -198,4 +199,83 @@ void CPetSound::sliderChanged(double offset, int sliderNum) { } } +bool CPetSound::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (_musicVolume.resetThumbFocus()) { + _draggingSlider = &_musicVolume; + getOwner()->startDragging(this, msg); + _draggingSliderNum = 0; + return true; + } else if (_masterVolume.resetThumbFocus()) { + _draggingSlider = &_masterVolume; + getOwner()->startDragging(this, msg); + _draggingSliderNum = 1; + return true; + } else if (_parrotVolume.resetThumbFocus()) { + _draggingSlider = &_parrotVolume; + getOwner()->startDragging(this, msg); + _draggingSliderNum = 2; + return true; + } else if (_speechVolume.resetThumbFocus()) { + _draggingSlider = &_speechVolume; + getOwner()->startDragging(this, msg); + _draggingSliderNum = 3; + return true; + } + + _draggingSlider = nullptr; + return false; +} + +bool CPetSound::MouseDragMoveMsg(CMouseDragMoveMsg *msg) { + if (!_draggingSlider) + return false; + + if (_draggingSlider->MouseDragMoveMsg(msg->_mousePos)) { + double offset = _draggingSlider->getOffsetPixels(); + sliderChanged(offset, _draggingSliderNum); + getPetControl()->makeDirty(); + return true; + } + + return false; +} + +bool CPetSound::MouseDragEndMsg(CMouseDragEndMsg *msg) { + if (!_draggingSlider) + return false; + + _draggingSlider->MouseDragEndMsg(msg->_mousePos); + getOwner()->endDragging(); + + return false; +} + +bool CPetSound::MouseButtonUpMsg(const Point &pt) { + int sliderNum = 0; + CPetSlider *slider = nullptr; + + if (_musicVolume.MouseButtonUpMsg(pt)) { + sliderNum = 0; + slider = &_musicVolume; + } else if (_masterVolume.MouseButtonUpMsg(pt)) { + sliderNum = 1; + slider = &_masterVolume; + } else if (_parrotVolume.MouseButtonUpMsg(pt)) { + sliderNum = 2; + slider = &_parrotVolume; + } else if (_speechVolume.MouseButtonUpMsg(pt)) { + sliderNum = 3; + slider = &_speechVolume; + } else { + return false; + } + + double offset = slider->getOffsetPixels(); + sliderChanged(offset, sliderNum); +} + +void CPetSound::getTooltip(CPetText *text) { + text->setText("Change the volume settings."); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_sound.h b/engines/titanic/pet_control/pet_sound.h index 36b6a8bb33..3727780c4b 100644 --- a/engines/titanic/pet_control/pet_sound.h +++ b/engines/titanic/pet_control/pet_sound.h @@ -30,6 +30,8 @@ namespace Titanic { +class CPetRealLife; + class CPetSound : public CPetGlyph { private: CPetGfxElement _element; @@ -41,8 +43,8 @@ private: CPetText _textMusicVolume; CPetText _textParrotVolume; CPetText _textSpeechVolume; - int _field198; - int _field19C; + CPetSlider *_draggingSlider; + int _draggingSliderNum; private: /** * Called when a slider has changed @@ -71,6 +73,36 @@ public: * information it displays */ virtual bool checkHighlight(const Point &pt); + + /** + * Called when mouse drag starts + */ + virtual bool MouseDragStartMsg(CMouseDragStartMsg *msg); + + /** + * Called during mouse drags + */ + virtual bool MouseDragMoveMsg(CMouseDragMoveMsg *msg); + + /** + * Called when mouse drag ends + */ + virtual bool MouseDragEndMsg(CMouseDragEndMsg *msg); + + /** + * Handles mouse button up messages + */ + virtual bool MouseButtonUpMsg(const Point &pt); + + /** + * Returns the tooltip text for when the glyph is selected + */ + virtual void getTooltip(CPetText *text); + + /** + * Get the parent RealLife area + */ + CPetGlyphs *getOwner() { return _owner; } }; } // End of namespace Titanic -- cgit v1.2.3 From 730895a9ea4a5f1c2032cb552d9221ad22fb8e5f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 23 Apr 2016 20:59:07 -0400 Subject: TITANIC: Cleaning up CPetLoad & CPetSave methods --- engines/titanic/pet_control/pet_glyphs.cpp | 6 ++---- engines/titanic/pet_control/pet_glyphs.h | 4 ++-- engines/titanic/pet_control/pet_load.h | 1 - engines/titanic/pet_control/pet_save.h | 13 +++++++++++++ 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index fd4828ab40..914ddbbe0b 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -412,11 +412,9 @@ bool CPetGlyphs::enterHighlighted() { return false; } -bool CPetGlyphs::leaveHighlighted() { +void CPetGlyphs::leaveHighlighted() { if (_highlightIndex >= 0) - return getGlyph(_highlightIndex)->leaveHighlighted(); - else - return false; + getGlyph(_highlightIndex)->leaveHighlighted(); } void CPetGlyphs::startDragging(CPetGlyph *glyph, CMouseDragStartMsg *msg) { diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index e4f4b1f59a..883c7992a3 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -194,7 +194,7 @@ public: /** * Called on a highlighted item when PET area is left */ - virtual bool leaveHighlighted() { return false; } + virtual void leaveHighlighted() {} virtual int proc37() { return 0; } @@ -368,7 +368,7 @@ public: * When the PET section is left, passes onto the highlighted * glyph, if any */ - bool leaveHighlighted(); + void leaveHighlighted(); /** * Called when a dragging operation starts diff --git a/engines/titanic/pet_control/pet_load.h b/engines/titanic/pet_control/pet_load.h index 093fca0977..f87cd8afb2 100644 --- a/engines/titanic/pet_control/pet_load.h +++ b/engines/titanic/pet_control/pet_load.h @@ -58,7 +58,6 @@ public: * Executes the loading or saving */ virtual void execute(); - }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_save.h b/engines/titanic/pet_control/pet_save.h index 006b2cd95a..106d499d96 100644 --- a/engines/titanic/pet_control/pet_save.h +++ b/engines/titanic/pet_control/pet_save.h @@ -49,6 +49,19 @@ public: */ virtual void getTooltip(CPetText *text); + /** + * Called on a highlighted item when PET area is entered + */ + virtual bool enterHighlighted() { + highlightSave(_savegameSlotNum); + return true; + } + + /** + * Called on a highlighted item when PET area is left + */ + virtual void leaveHighlighted() { unhighlightSave(_savegameSlotNum); } + /** * Highlights a save slot */ -- cgit v1.2.3 From 73258800cf10f94cee5a9745649f8c5dbb67109c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 23 Apr 2016 22:31:22 -0400 Subject: TITANIC: Beginnings of CPetRooms --- engines/titanic/module.mk | 3 +- engines/titanic/pet_control/pet_control.h | 2 +- .../titanic/pet_control/pet_control_list_item2.cpp | 37 ------- .../titanic/pet_control/pet_control_list_item2.h | 51 --------- engines/titanic/pet_control/pet_control_sub11.cpp | 27 ----- engines/titanic/pet_control/pet_control_sub11.h | 36 ------- engines/titanic/pet_control/pet_rooms.cpp | 114 +++++++++++++++++++-- engines/titanic/pet_control/pet_rooms.h | 100 ++++++++++++++---- engines/titanic/pet_control/pet_rooms_glyphs.cpp | 41 ++++++++ engines/titanic/pet_control/pet_rooms_glyphs.h | 56 ++++++++++ 10 files changed, 281 insertions(+), 186 deletions(-) delete mode 100644 engines/titanic/pet_control/pet_control_list_item2.cpp delete mode 100644 engines/titanic/pet_control/pet_control_list_item2.h delete mode 100644 engines/titanic/pet_control/pet_control_sub11.cpp delete mode 100644 engines/titanic/pet_control/pet_control_sub11.h create mode 100644 engines/titanic/pet_control/pet_rooms_glyphs.cpp create mode 100644 engines/titanic/pet_control/pet_rooms_glyphs.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 3a47bedc67..6875e9032d 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -356,7 +356,6 @@ MODULE_OBJS := \ npcs/titania.o \ npcs/true_talk_npc.o \ pet_control/pet_control.o \ - pet_control/pet_control_list_item2.o \ pet_control/pet_conversations.o \ pet_control/pet_element.o \ pet_control/pet_frame.o \ @@ -364,12 +363,12 @@ MODULE_OBJS := \ pet_control/pet_inventory.o \ pet_control/pet_inventory_glyphs.o \ pet_control/pet_rooms.o \ + pet_control/pet_rooms_glyphs.o \ pet_control/pet_remote.o \ pet_control/pet_real_life.o \ pet_control/pet_section.o \ pet_control/pet_control_sub5.o \ pet_control/pet_control_sub7.o \ - pet_control/pet_control_sub11.o \ pet_control/pet_drag_chev.o \ pet_control/pet_graphic2.o \ pet_control/pet_graphic.o \ diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index e4f0710b76..baad471b8d 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -49,7 +49,7 @@ private: CPetConversations _conversations; CPetInventory _inventory; CPetRemote _remote; - CPetRoomsSection _rooms; + CPetRooms _rooms; CPetRealLife _realLife; CPetControlSub5 _sub5; CPetControlSub7 _sub7; diff --git a/engines/titanic/pet_control/pet_control_list_item2.cpp b/engines/titanic/pet_control/pet_control_list_item2.cpp deleted file mode 100644 index 82b59929d2..0000000000 --- a/engines/titanic/pet_control/pet_control_list_item2.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 "titanic/pet_control/pet_control_list_item2.h" - -namespace Titanic { - -CPetControlListItem2::CPetControlListItem2() : - _field34(0), _field38(0), _field3C(0), _field40(0), - _field44(0), _field48(0), _field4C(0), _field50(0), - _field54(0), _field58(0), _field5C(0) { -} - -void CPetControlListItem2::setField34(int val) { - _field34 = val; -} - -} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_list_item2.h b/engines/titanic/pet_control/pet_control_list_item2.h deleted file mode 100644 index 70feb30432..0000000000 --- a/engines/titanic/pet_control/pet_control_list_item2.h +++ /dev/null @@ -1,51 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_CONTROL_LIST_ITEM2_H -#define TITANIC_PET_CONTROL_LIST_ITEM2_H - -#include "titanic/pet_control/pet_glyphs.h" - -namespace Titanic { - -class CPetControlListItem2 : public CPetGlyph { -protected: - int _field34; - int _field38; - int _field3C; - int _field40; - int _field44; - int _field48; - int _field4C; - int _field50; - int _field54; - int _field58; - int _field5C; -public: - CPetControlListItem2(); - - void setField34(int val); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_LIST_ITEM2_H */ diff --git a/engines/titanic/pet_control/pet_control_sub11.cpp b/engines/titanic/pet_control/pet_control_sub11.cpp deleted file mode 100644 index 5148d1267a..0000000000 --- a/engines/titanic/pet_control/pet_control_sub11.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* 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 "titanic/pet_control/pet_control_sub11.h" - -namespace Titanic { - -} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub11.h b/engines/titanic/pet_control/pet_control_sub11.h deleted file mode 100644 index eeeb8bf2c8..0000000000 --- a/engines/titanic/pet_control/pet_control_sub11.h +++ /dev/null @@ -1,36 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_CONTROL_SUB11_H -#define TITANIC_PET_CONTROL_SUB11_H - -#include "titanic/pet_control/pet_glyphs.h" - -namespace Titanic { - -class CPetControlSub11 : public CPetGlyphs { -public: -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_SUB11_H */ diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp index ea81dd8270..9a55af2ba9 100644 --- a/engines/titanic/pet_control/pet_rooms.cpp +++ b/engines/titanic/pet_control/pet_rooms.cpp @@ -21,21 +21,66 @@ */ #include "titanic/pet_control/pet_rooms.h" +#include "titanic/pet_control/pet_control.h" namespace Titanic { -CPetRoomsSection::CPetRoomsSection() : - _field100(0), _field104(0), _field108(0), _field10C(0), - _field110(0), _field114(0), _field118(0), _field11C(0), - _field1C0(0), _field1C4(0), _field1C8(0), _field1CC(0), - _field1D0(0), _field1D4(0) { +CPetRooms::CPetRooms() : + _chevLeftOnDim(nullptr), _chevLeftOffDim(nullptr), + _chevRightOnDim(nullptr), _chevRightOffDim(nullptr), + _chevLeftOnLit(nullptr), _chevLeftOffLit(nullptr), + _chevRightOnLit(nullptr), _chevRightOffLit(nullptr), + _field1C0(0), _field1C4(0), _field1C8(0), _field1CC(0), + _field1D0(0), _field1D4(0) { } -void CPetRoomsSection::save(SimpleFile *file, int indent) const { +bool CPetRooms::setup(CPetControl *petControl) { + if (petControl && setupControl(petControl)) + return reset(); + return false; +} + +bool CPetRooms::reset() { + return true; +} + +void CPetRooms::draw(CScreenManager *screenManager) { + +} + +bool CPetRooms::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + return true; +} + +bool CPetRooms::MouseDragStartMsg(CMouseDragStartMsg *msg) { + return true; +} + +bool CPetRooms::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + return true; +} + +bool CPetRooms::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { + return true; +} + +bool CPetRooms::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { + return true; +} + +int CPetRooms::proc14() { + return 0; +} +void CPetRooms::displayMessage(const CString &msg) { + +} + +bool CPetRooms::isValid(CPetControl *petControl) { + return true; } -void CPetRoomsSection::load(SimpleFile *file, int param) { +void CPetRooms::load(SimpleFile *file, int param) { if (!param) { int count = file->readNumber(); @@ -45,7 +90,7 @@ void CPetRoomsSection::load(SimpleFile *file, int param) { warning("TODO: CPetRoomsSection::load - %d,%d", v1, v2); } - _listItem.setField34(file->readNumber()); + _glyphItem.set34(file->readNumber()); file->readNumber(); _field1C0 = file->readNumber(); _field1C4 = file->readNumber(); @@ -56,10 +101,57 @@ void CPetRoomsSection::load(SimpleFile *file, int param) { } } -bool CPetRoomsSection::isValid(CPetControl *petControl) { - // TODO - return true; +void CPetRooms::postLoad() { + +} + +void CPetRooms::save(SimpleFile *file, int indent) const { + +} + +void CPetRooms::enter(PetArea oldArea) { + } +void CPetRooms::enterRoom(CRoomItem *room) { + +} + +CPetText *CPetRooms::getText() { + return &_text; +} + +CGameObject *CPetRooms::getBackground(int index) { + return nullptr; +} + +bool CPetRooms::setupControl(CPetControl *petControl) { + _petControl = petControl; + if (!petControl) + return false; + + Rect rect1(0, 0, 470, 15); + rect1.moveTo(32, 445); + _text.setBounds(rect1); + _text.setHasBorder(false); + + Rect rect2(0, 0, 81, 81); + rect2.moveTo(374, 494); + _element.setBounds(rect2); + + _chevLeftOnDim = petControl->getHiddenObject("3PetChevLeftOnDim"); + _chevLeftOffDim = petControl->getHiddenObject("3PetChevLeftOffDim"); + _chevRightOnDim = petControl->getHiddenObject("3PetChevRightOnDim"); + _chevRightOffDim = petControl->getHiddenObject("3PetChevRightOffDim"); + _chevLeftOnLit = petControl->getHiddenObject("3PetChevLeftOnLit"); + _chevLeftOffLit = petControl->getHiddenObject("3PetChevLeftOffLit"); + _chevRightOnLit = petControl->getHiddenObject("3PetChevRightOnLit"); + _chevRightOffLit = petControl->getHiddenObject("3PetChevRightOffLit"); + + _glyphs.setup(6, this); + _glyphs.setFlags(GFLAG_16); + _glyphItem.setup(petControl, &_glyphs); + _glyphItem.set38(1); +} } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms.h b/engines/titanic/pet_control/pet_rooms.h index 1e68873f93..0974fee026 100644 --- a/engines/titanic/pet_control/pet_rooms.h +++ b/engines/titanic/pet_control/pet_rooms.h @@ -20,29 +20,28 @@ * */ -#ifndef TITANIC_PET_ROOMS_SECTION_H -#define TITANIC_PET_ROOMS_SECTION_H +#ifndef TITANIC_PET_ROOMS_H +#define TITANIC_PET_ROOMS_H #include "titanic/pet_control/pet_section.h" -#include "titanic/pet_control/pet_control_sub11.h" #include "titanic/pet_control/pet_text.h" -#include "titanic/pet_control/pet_control_list_item2.h" +#include "titanic/pet_control/pet_rooms_glyphs.h" namespace Titanic { -class CPetRoomsSection : public CPetSection { +class CPetRooms : public CPetSection { private: - CPetControlSub11 _sub11; - CPetControlListItem2 _listItem; - int _field100; - int _field104; - int _field108; - int _field10C; - int _field110; - int _field114; - int _field118; - int _field11C; - CPetGfxElement _val1; + CPetRoomsGlyphs _glyphs; + CPetRoomsGlyph _glyphItem; + CGameObject *_chevLeftOnDim; + CGameObject *_chevLeftOffDim; + CGameObject *_chevRightOnDim; + CGameObject *_chevRightOffDim; + CGameObject *_chevLeftOnLit; + CGameObject *_chevLeftOffLit; + CGameObject *_chevRightOnLit; + CGameObject *_chevRightOffLit; + CPetGfxElement _element; CPetText _text; int _field1C0; int _field1C4; @@ -50,23 +49,82 @@ private: int _field1CC; int _field1D0; int _field1D4; +private: + /** + * Setup the control + */ + bool setupControl(CPetControl *petControl); public: - CPetRoomsSection(); + CPetRooms(); /** - * Save the data for the class to file + * Sets up the section */ - virtual void save(SimpleFile *file, int indent) const; + virtual bool setup(CPetControl *petControl); + + /** + * Reset the section + */ + virtual bool reset(); /** - * Load the data for the class from file + * Draw the section */ - virtual void load(SimpleFile *file, int param); + virtual void draw(CScreenManager *screenManager); + + /** + * Following are handlers for the various messages that the PET can + * pass onto the currently active section/area + */ + virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + virtual bool MouseDragStartMsg(CMouseDragStartMsg *msg); + virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); + virtual bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg); + virtual bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg); + + virtual int proc14(); + + /** + * Display a message + */ + virtual void displayMessage(const CString &msg); /** * Returns true if the object is in a valid state */ virtual bool isValid(CPetControl *petControl); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file, int param); + + /** + * Called after a game has been loaded + */ + virtual void postLoad(); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Called when a section is switched to + */ + virtual void enter(PetArea oldArea); + + /** + * Called when a new room is entered + */ + virtual void enterRoom(CRoomItem *room); + + /** + * Get a reference to the tooltip text associated with the section + */ + virtual CPetText *getText(); + + virtual CGameObject *getBackground(int index); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.cpp b/engines/titanic/pet_control/pet_rooms_glyphs.cpp new file mode 100644 index 0000000000..c853273873 --- /dev/null +++ b/engines/titanic/pet_control/pet_rooms_glyphs.cpp @@ -0,0 +1,41 @@ +/* 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 "titanic/pet_control/pet_rooms_glyphs.h" + +namespace Titanic { + +CPetRoomsGlyph::CPetRoomsGlyph() : CPetGlyph(), + _field34(0), _field38(0), _field3C(0), _field40(0), + _field44(0), _field48(0), _field4C(0), _field50(0), + _field54(0), _field58(0), _field5C(0) { +} + +void CPetRoomsGlyph::set34(int val) { + _field34 = val; +} + +void CPetRoomsGlyph::set38(int val) { + _field38 = val; +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.h b/engines/titanic/pet_control/pet_rooms_glyphs.h new file mode 100644 index 0000000000..ee79917b57 --- /dev/null +++ b/engines/titanic/pet_control/pet_rooms_glyphs.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_ROOMS_GLYPHS_H +#define TITANIC_PET_ROOMS_GLYPHS_H + +#include "titanic/pet_control/pet_glyphs.h" + +namespace Titanic { + +class CPetRoomsGlyph : public CPetGlyph { +protected: + int _field34; + int _field38; + int _field3C; + int _field40; + int _field44; + int _field48; + int _field4C; + int _field50; + int _field54; + int _field58; + int _field5C; +public: + CPetRoomsGlyph(); + + void set34(int val); + + void set38(int val); +}; + +class CPetRoomsGlyphs : public CPetGlyphs { +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_ROOMS_GLYPHS_H */ -- cgit v1.2.3 From 4180e85bc0da500c347a3c5076ec7e6921e8daff Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 23 Apr 2016 23:30:17 -0400 Subject: TITANIC: Beginnings of PET Rooms glyph --- engines/titanic/pet_control/pet_glyphs.cpp | 8 ++-- engines/titanic/pet_control/pet_glyphs.h | 7 +++- engines/titanic/pet_control/pet_rooms_glyphs.cpp | 51 ++++++++++++++++++++++-- engines/titanic/pet_control/pet_rooms_glyphs.h | 37 +++++++++++++---- engines/titanic/pet_control/pet_sound.h | 5 --- 5 files changed, 86 insertions(+), 22 deletions(-) diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index 914ddbbe0b..8ed8fcf47c 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -32,7 +32,7 @@ bool CPetGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { return true; } -void CPetGlyph::drawAt(CScreenManager *screenManager, const Point &pt) { +void CPetGlyph::drawAt(CScreenManager *screenManager, const Point &pt, bool isHighlighted) { _element.translate(pt.x, pt.y); _element.draw(screenManager); _element.translate(-pt.x, -pt.y); @@ -151,10 +151,8 @@ void CPetGlyphs::draw(CScreenManager *screenManager) { Point pt = getPosition(itemIndex); CPetGlyph *glyph = getGlyph(itemIndex); - if (glyph) { - // TODO: Comparison with highlighted index, and a redundant push? - glyph->drawAt(screenManager, pt); - } + if (glyph) + glyph->drawAt(screenManager, pt, index == _highlightIndex); } } diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index 883c7992a3..9216a42c74 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -73,6 +73,11 @@ public: */ void translateBack(const Point &pt) { _element.translate(-pt.x, -pt.y); } + /** + * Get the parent RealLife area + */ + CPetGlyphs *getOwner() { return _owner; } + /** * Get the PET control */ @@ -106,7 +111,7 @@ public: /** * Draw the glyph at a specified position */ - virtual void drawAt(CScreenManager *screenManager, const Point &pt); + virtual void drawAt(CScreenManager *screenManager, const Point &pt, bool isHighlighted); /** * Handles any secondary drawing of the glyph diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.cpp b/engines/titanic/pet_control/pet_rooms_glyphs.cpp index c853273873..6c032e7daf 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.cpp +++ b/engines/titanic/pet_control/pet_rooms_glyphs.cpp @@ -21,13 +21,15 @@ */ #include "titanic/pet_control/pet_rooms_glyphs.h" +#include "titanic/pet_control/pet_section.h" +#include "titanic/support/screen_manager.h" namespace Titanic { CPetRoomsGlyph::CPetRoomsGlyph() : CPetGlyph(), - _field34(0), _field38(0), _field3C(0), _field40(0), - _field44(0), _field48(0), _field4C(0), _field50(0), - _field54(0), _field58(0), _field5C(0) { + _field34(0), _field38(0), _field3C(0), + _field40(nullptr), _field44(nullptr), _field48(nullptr), _field4C(nullptr), + _field50(nullptr), _field54(nullptr), _field58(nullptr), _field5C(nullptr) { } void CPetRoomsGlyph::set34(int val) { @@ -38,4 +40,47 @@ void CPetRoomsGlyph::set38(int val) { _field38 = val; } +bool CPetRoomsGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { + if (!CPetGlyph::setup(petControl, owner)) + return false; + + CPetSection *section = owner->getOwner(); + _field40 = section->getBackground(9); + _field44 = section->getBackground(12); + _field50 = section->getBackground(13); + _field54 = section->getBackground(10); + _field48 = section->getBackground(11); + _field4C = section->getBackground(14); + _field58 = section->getBackground(15); + _field5C = _field58; + return true; +} + +void CPetRoomsGlyph::drawAt(CScreenManager *screenManager, const Point &pt) { + // Clear background + Rect rect(pt.x, pt.y, pt.x + 52, pt.y + 52); + screenManager->fillRect(SURFACE_BACKBUFFER, &rect, 0, 0, 0); + + warning("TODO: CPetRoomsGlyph::drawAt"); +} + +void CPetRoomsGlyph::proc28(const Point &pt) { + +} +int CPetRoomsGlyph::proc29(const Point &pt) { + return 0; +} + +void CPetRoomsGlyph::proc32() { + +} + +int CPetRoomsGlyph::proc33() { + return 1; +} + +void CPetRoomsGlyph::proc39() { + +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.h b/engines/titanic/pet_control/pet_rooms_glyphs.h index ee79917b57..80c3d36ad8 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.h +++ b/engines/titanic/pet_control/pet_rooms_glyphs.h @@ -32,20 +32,41 @@ protected: int _field34; int _field38; int _field3C; - int _field40; - int _field44; - int _field48; - int _field4C; - int _field50; - int _field54; - int _field58; - int _field5C; + CGameObject *_field40; + CGameObject *_field44; + CGameObject *_field48; + CGameObject *_field4C; + CGameObject *_field50; + CGameObject *_field54; + CGameObject *_field58; + CGameObject *_field5C; public: CPetRoomsGlyph(); void set34(int val); void set38(int val); + + /** + * Setup the glyph + */ + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); + + /** + * Draw the glyph at a specified position + */ + virtual void drawAt(CScreenManager *screenManager, const Point &pt); + + /** + * Handles any secondary drawing of the glyph + */ + virtual void draw2(CScreenManager *screenManager) {} + + virtual void proc28(const Point &pt); + virtual int proc29(const Point &pt); + virtual void proc32(); + virtual int proc33(); + virtual void proc39(); }; class CPetRoomsGlyphs : public CPetGlyphs { diff --git a/engines/titanic/pet_control/pet_sound.h b/engines/titanic/pet_control/pet_sound.h index 3727780c4b..267bd03309 100644 --- a/engines/titanic/pet_control/pet_sound.h +++ b/engines/titanic/pet_control/pet_sound.h @@ -98,11 +98,6 @@ public: * Returns the tooltip text for when the glyph is selected */ virtual void getTooltip(CPetText *text); - - /** - * Get the parent RealLife area - */ - CPetGlyphs *getOwner() { return _owner; } }; } // End of namespace Titanic -- cgit v1.2.3 From af06188baedf10247893c6f964462c74eac5f446 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 Apr 2016 08:15:51 -0400 Subject: TITANIC: Implementing CPetRooms methods --- engines/titanic/pet_control/pet_control.cpp | 5 ++ engines/titanic/pet_control/pet_control.h | 5 ++ engines/titanic/pet_control/pet_glyphs.cpp | 14 ++++- engines/titanic/pet_control/pet_glyphs.h | 14 ++++- engines/titanic/pet_control/pet_rooms.cpp | 71 ++++++++++++++++++++---- engines/titanic/pet_control/pet_rooms.h | 18 +++++- engines/titanic/pet_control/pet_rooms_glyphs.cpp | 3 +- engines/titanic/pet_control/pet_rooms_glyphs.h | 6 +- engines/titanic/pet_control/pet_section.h | 2 +- engines/titanic/pet_control/pet_sound.cpp | 1 + 10 files changed, 120 insertions(+), 19 deletions(-) diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 145543fb07..98887f60d2 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -431,4 +431,9 @@ void CPetControl::playSound(int soundNum) { } } +CString CPetControl::getRoomName() const { + CRoomItem *room = getRoom(); + return room ? room->getName() : CString(); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index baad471b8d..78cfb61864 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -245,6 +245,11 @@ public: * Play a sound */ void playSound(int soundNum); + + /** + * Get the room name + */ + CString getRoomName() const; }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index 8ed8fcf47c..8f8d8ba331 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -307,7 +307,7 @@ bool CPetGlyphs::MouseButtonDownMsg(const Point &pt) { CPetGlyph *glyph = getGlyph(index); if (glyph) { if (_highlightIndex == index) { - glyph->proc28(glyphRect); + glyph->MouseButtonDownMsg(glyphRect); glyph->proc14(); } else { changeHighlight(index); @@ -426,4 +426,16 @@ void CPetGlyphs::endDragging() { _dragGlyph = nullptr; } +bool CPetGlyphs::highlighted14() { + if (_highlightIndex != -1) { + CPetGlyph *pet = getGlyph(_highlightIndex); + if (pet) { + pet->proc14(); + return true; + } + } + + return false; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index 9216a42c74..cefcd5cae9 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -172,7 +172,12 @@ public: virtual void highlightCurrent(const Point &pt) {} virtual void proc27(const Point &pt, bool flag) {} - virtual void proc28(const Point &pt) {} + + /** + * Handles mouse button down messages + */ + virtual void MouseButtonDownMsg(const Point &pt) {} + virtual int proc29(const Point &pt) { return 0; } /** @@ -384,6 +389,13 @@ public: * Called when a dragging operation ends */ void endDragging(); + + /** + * Reset the highlight + */ + void resetHighlight() { changeHighlight(-1); } + + bool highlighted14(); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp index 9a55af2ba9..60ce398eb4 100644 --- a/engines/titanic/pet_control/pet_rooms.cpp +++ b/engines/titanic/pet_control/pet_rooms.cpp @@ -41,43 +41,71 @@ bool CPetRooms::setup(CPetControl *petControl) { } bool CPetRooms::reset() { + if (_petControl) { + _plinth.reset("PetChevPlinth", _petControl, MODE_UNSELECTED); + _glyphs.reset(); + + uint col = getColor(0); + _text.setColor(col); + _text.setColor(0, col); + } + return true; } void CPetRooms::draw(CScreenManager *screenManager) { - + _petControl->drawSquares(screenManager, 6); + _plinth.draw(screenManager); + _glyphItem.drawAt(screenManager, getGlyphPos()); + _text.draw(screenManager); } bool CPetRooms::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_glyphs.MouseButtonDownMsg(msg->_mousePos)) + return true; + + if (!_glyphItem.contains(getGlyphPos(), msg->_mousePos)) + return false; + + _glyphItem.MouseButtonDownMsg(msg->_mousePos); return true; } bool CPetRooms::MouseDragStartMsg(CMouseDragStartMsg *msg) { + if (_glyphs.MouseDragStartMsg(msg)) + return true; + + if (!_glyphItem.contains(getGlyphPos(), msg->_mousePos)) + return false; + + _glyphItem.proc29(msg->_mousePos); return true; } bool CPetRooms::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { - return true; + return false; } bool CPetRooms::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { - return true; + return !_glyphs.MouseButtonDownMsg(msg->_mousePos); } bool CPetRooms::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { - return true; + return _glyphs.VirtualKeyCharMsg(msg->_keyState.keycode); } -int CPetRooms::proc14() { - return 0; +bool CPetRooms::proc14(void *v1) { + warning("TODO: proc14"); + return false; } void CPetRooms::displayMessage(const CString &msg) { - + _glyphs.resetHighlight(); + CPetSection::displayMessage(msg); } bool CPetRooms::isValid(CPetControl *petControl) { - return true; + return setupControl(petControl); } void CPetRooms::load(SimpleFile *file, int param) { @@ -102,15 +130,16 @@ void CPetRooms::load(SimpleFile *file, int param) { } void CPetRooms::postLoad() { - + reset(); } void CPetRooms::save(SimpleFile *file, int indent) const { - + warning("TODO: CPetRooms::save"); } void CPetRooms::enter(PetArea oldArea) { - + if (!_glyphs.highlighted14()) + _text.setText(""); } void CPetRooms::enterRoom(CRoomItem *room) { @@ -137,7 +166,7 @@ bool CPetRooms::setupControl(CPetControl *petControl) { Rect rect2(0, 0, 81, 81); rect2.moveTo(374, 494); - _element.setBounds(rect2); + _plinth.setBounds(rect2); _chevLeftOnDim = petControl->getHiddenObject("3PetChevLeftOnDim"); _chevLeftOffDim = petControl->getHiddenObject("3PetChevLeftOffDim"); @@ -152,6 +181,24 @@ bool CPetRooms::setupControl(CPetControl *petControl) { _glyphs.setFlags(GFLAG_16); _glyphItem.setup(petControl, &_glyphs); _glyphItem.set38(1); + return true; +} + +void CPetRooms::resetHighlight() { + _glyphItem.set34(fn1()); + _glyphs.resetHighlight(); + _glyphItem.proc14(); + areaChanged(PET_ROOMS); +} + +int CPetRooms::fn1() { + warning("TODO: CPetRooms::fn1"); + return 0; +} + +void CPetRooms::areaChanged(PetArea area) { + if (_petControl && _petControl->_currentArea == area) + _petControl->makeDirty(); } } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms.h b/engines/titanic/pet_control/pet_rooms.h index 0974fee026..4c153d7fad 100644 --- a/engines/titanic/pet_control/pet_rooms.h +++ b/engines/titanic/pet_control/pet_rooms.h @@ -41,7 +41,7 @@ private: CGameObject *_chevLeftOffLit; CGameObject *_chevRightOnLit; CGameObject *_chevRightOffLit; - CPetGfxElement _element; + CPetGfxElement _plinth; CPetText _text; int _field1C0; int _field1C4; @@ -54,6 +54,20 @@ private: * Setup the control */ bool setupControl(CPetControl *petControl); + + /** + * Returns the glyth position + */ + Point getGlyphPos() const { return Point(509, 388); } + + /** + * Reset the highlight + */ + void resetHighlight(); + + int fn1(); + + void areaChanged(PetArea area); public: CPetRooms(); @@ -82,7 +96,7 @@ public: virtual bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg); virtual bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg); - virtual int proc14(); + virtual bool proc14(void *v1); /** * Display a message diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.cpp b/engines/titanic/pet_control/pet_rooms_glyphs.cpp index 6c032e7daf..d127c412f9 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.cpp +++ b/engines/titanic/pet_control/pet_rooms_glyphs.cpp @@ -64,9 +64,10 @@ void CPetRoomsGlyph::drawAt(CScreenManager *screenManager, const Point &pt) { warning("TODO: CPetRoomsGlyph::drawAt"); } -void CPetRoomsGlyph::proc28(const Point &pt) { +void CPetRoomsGlyph::MouseButtonDownMsg(const Point &pt) { } + int CPetRoomsGlyph::proc29(const Point &pt) { return 0; } diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.h b/engines/titanic/pet_control/pet_rooms_glyphs.h index 80c3d36ad8..2832438fc9 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.h +++ b/engines/titanic/pet_control/pet_rooms_glyphs.h @@ -62,7 +62,11 @@ public: */ virtual void draw2(CScreenManager *screenManager) {} - virtual void proc28(const Point &pt); + /** + * Handles mouse button down messages + */ + virtual void MouseButtonDownMsg(const Point &pt); + virtual int proc29(const Point &pt); virtual void proc32(); virtual int proc33(); diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 0911fd44f1..720e5323cf 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -90,7 +90,7 @@ public: virtual bool KeyCharMsg(CKeyCharMsg *msg) { return false; } virtual bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { return false; } - virtual int proc14() { return 0; } + virtual bool proc14(void *v1) { return false; } /** * Returns item a drag-drop operation has dropped on, if any diff --git a/engines/titanic/pet_control/pet_sound.cpp b/engines/titanic/pet_control/pet_sound.cpp index 736b966974..72e991aa3d 100644 --- a/engines/titanic/pet_control/pet_sound.cpp +++ b/engines/titanic/pet_control/pet_sound.cpp @@ -272,6 +272,7 @@ bool CPetSound::MouseButtonUpMsg(const Point &pt) { double offset = slider->getOffsetPixels(); sliderChanged(offset, sliderNum); + return true; } void CPetSound::getTooltip(CPetText *text) { -- cgit v1.2.3 From a88c0b09994562d4576e7dd08db8ad2fe3326f53 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 Apr 2016 10:37:34 -0400 Subject: TITANIC: Starting to flesh out CPetText drawing --- engines/titanic/pet_control/pet_load_save.cpp | 2 +- engines/titanic/pet_control/pet_text.cpp | 58 +++++++++++++++++++++++---- engines/titanic/pet_control/pet_text.h | 15 +++++-- engines/titanic/support/screen_manager.h | 8 ++++ 4 files changed, 70 insertions(+), 13 deletions(-) diff --git a/engines/titanic/pet_control/pet_load_save.cpp b/engines/titanic/pet_control/pet_load_save.cpp index f777f122fe..9d185a3742 100644 --- a/engines/titanic/pet_control/pet_load_save.cpp +++ b/engines/titanic/pet_control/pet_load_save.cpp @@ -36,7 +36,7 @@ bool CPetLoadSave::setup(CPetControl *petControl, CPetGlyphs *owner) { Rect slotRect = getSlotBounds(idx); _slotNames[idx].setBounds(slotRect); _slotNames[idx].resize(3); - _slotNames[idx].set30(22); + _slotNames[idx].setMaxCharsPerLine(22); _slotNames[idx].setHasBorder(false); _slotNames[idx].setup(); } diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index faa25d05ad..ca65b23ee1 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -25,11 +25,11 @@ namespace Titanic { CPetText::CPetText(uint count) : - _stringsMerged(false), _field30(-1), _lineCount(0), - _field38(-1), _field3C(0), _field40(0), _field44(0), + _stringsMerged(false), _maxCharsPerLine(-1), _lineCount(0), + _fontNumber1(-1), _field3C(0), _field40(0), _field44(0), _backR(0xff), _backG(0xff), _backB(0xff), _textR(0), _textG(0), _textB(200), - _field60(0), _field64(0), _field68(0), _field6C(0), + _fontNumber2(0), _field64(0), _field68(0), _field6C(0), _hasBorder(true), _field74(0), _field78(0), _field7C(0) { setupArrays(count); } @@ -130,7 +130,16 @@ void CPetText::draw(CScreenManager *screenManager) { screenManager->fillRect(SURFACE_BACKBUFFER, &tempRect, _backR, _backG, _backB); } - warning("TODO: CPetText::draw"); + draw2(screenManager); + + tempRect = _bounds; + tempRect.grow(-2); + screenManager->setFontNumber(_fontNumber2); + +// int var14 = 0; +// screenManager->writeLines(0, &var14, _field74, ) + warning("TODO: CPetText_Draw"); + screenManager->setFontNumber(_fontNumber1); } void CPetText::mergeStrings() { @@ -161,7 +170,22 @@ void CPetText::setText(const CString &str) { } void CPetText::changeText(const CString &str) { - warning("TODO: CPetText::changeText"); + int lineSize = _array[_lineCount]._string1.size(); + int strSize = str.size(); + + if (_maxCharsPerLine == -1) { + // No limit on horizontal characters, so append string to current line + _array[_lineCount]._string1 += str; + } else if ((lineSize + strSize) <= _maxCharsPerLine) { + // New string fits into line, so add it on + _array[_lineCount]._string1 += str; + } else { + // Only add part of the str up to the maximum allowed limit for line + _array[_lineCount]._string1 += str.left(_maxCharsPerLine - lineSize); + } + + updateStr3(_lineCount); + _stringsMerged = false; } void CPetText::setColor(int val1, uint col) { @@ -174,9 +198,27 @@ void CPetText::setColor(uint col) { _textB = (col >> 16) & 0xff; } -void CPetText::set30(int val) { - if (val >= -1 && val < 257) - _field30 = val; +void CPetText::setMaxCharsPerLine(int maxChars) { + if (maxChars >= -1 && maxChars < 257) + _maxCharsPerLine = maxChars; +} + +void CPetText::updateStr3(int lineNum) { + if (_field64 > 0 && _field68 > 0) { + char line[5]; + line[0] = line[3] = 26; + line[1] = _field64; + line[2] = _field68; + line[4] = '\0'; + _array[lineNum]._string3 = CString(line); + + _stringsMerged = false; + _field64 = _field68 = 0; + } +} + +void CPetText::draw2(CScreenManager *screenManager) { + } } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h index 17707117e5..9fd057a652 100644 --- a/engines/titanic/pet_control/pet_text.h +++ b/engines/titanic/pet_control/pet_text.h @@ -39,9 +39,9 @@ private: CString _lines; bool _stringsMerged; Rect _bounds; - int _field30; + int _maxCharsPerLine; int _lineCount; - int _field38; + int _fontNumber1; int _field3C; int _field40; int _field44; @@ -51,7 +51,7 @@ private: int _textR; int _textG; int _textB; - int _field60; + int _fontNumber2; int _field64; int _field68; int _field6C; @@ -75,6 +75,10 @@ private: * Change the text */ void changeText(const CString &str); + + void updateStr3(int lineNum); + + void draw2(CScreenManager *screenManager); public: CPetText(uint count = 10); @@ -120,7 +124,10 @@ public: */ void setColor(uint col); - void set30(int val); + /** + * Sets the maximum number of characters per line + */ + void setMaxCharsPerLine(int maxChars); }; } // End of namespace Titanic diff --git a/engines/titanic/support/screen_manager.h b/engines/titanic/support/screen_manager.h index affe2ec0c9..d0580d4957 100644 --- a/engines/titanic/support/screen_manager.h +++ b/engines/titanic/support/screen_manager.h @@ -145,7 +145,15 @@ public: virtual void showCursor() = 0; virtual void hideCursor() = 0; + /** + * Set drawing bounds for a specified surface + */ void setSurfaceBounds(SurfaceNum surfaceNum, const Rect &r); + + /** + * Set the current font number + */ + void setFontNumber(int fontNumber) { _fontNumber = fontNumber; } }; class OSScreenManager: CScreenManager { -- cgit v1.2.3 From c75de59a28c94e364a38af39057af720ba8465d4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 Apr 2016 17:16:32 -0400 Subject: TITANIC: Implementing font text bounds calculations --- engines/titanic/support/font.cpp | 67 +++++++++++++++++++++++++++++- engines/titanic/support/font.h | 20 +++++++-- engines/titanic/support/screen_manager.cpp | 14 +++++-- engines/titanic/support/screen_manager.h | 39 +++++++++++++---- 4 files changed, 123 insertions(+), 17 deletions(-) diff --git a/engines/titanic/support/font.cpp b/engines/titanic/support/font.cpp index 55865e792c..f5d28ea9ca 100644 --- a/engines/titanic/support/font.cpp +++ b/engines/titanic/support/font.cpp @@ -70,8 +70,39 @@ uint16 STFont::getColor() const { return g_system->getScreenFormat().RGBToColor(_fontR, _fontG, _fontB); } -void STFont::writeString(int maxWidth, const CString &text, int *v1, int *v2) { - warning("TODO: STFont::writeString"); +int STFont::getTextBounds(const CString &str, int maxWidth, Point *sizeOut) const { + Point textSize; + + // Reset output dimensions if provided + if (sizeOut) + *sizeOut = Point(0, 0); + + if (_fontHeight == 0 || !_dataPtr) + // No font, so return immediately + return 0; + + // Loop through the characters of the string + if (!str.empty()) { + for (const char *strP = str.c_str(); *strP; ++strP) { + if (*strP == 26) { + strP += 3; + } else if (*strP == 27) { + strP += 4; + } else { + if (*strP == ' ') { + // Check fo rline wrapping + checkLineWrap(textSize, maxWidth, strP); + } + + extendBounds(textSize, *strP, maxWidth); + } + } + } + + if (sizeOut) + *sizeOut = textSize; + + return textSize.y + _fontHeight; } int STFont::stringWidth(const CString &text) const { @@ -160,4 +191,36 @@ void STFont::copyRect(CVideoSurface *surface, const Common::Point &pt, Rect &rec } } +void STFont::extendBounds(Point &textSize, byte c, int maxWidth) const { + textSize.x += _chars[c]._width; + + if (textSize.x == '\n' || textSize.x > maxWidth) { + textSize.x = 0; + textSize.y += _fontHeight; + } +} + +void STFont::checkLineWrap(Point &textSize, int maxWidth, const char *&str) const { + bool flag = false; + int totalWidth = 0; + for (const char *srcPtr = str; *srcPtr; ++srcPtr) { + if (*srcPtr == ' ' && flag) + break; + + if (*srcPtr == 26) + srcPtr += 3; + else if (*srcPtr == 27) + srcPtr += 4; + else + totalWidth += _chars[*srcPtr]._width; + } + + if ((textSize.x + totalWidth) >= maxWidth && totalWidth < maxWidth) { + // Word wrap + textSize.x = 0; + textSize.y += _fontHeight; + ++str; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/support/font.h b/engines/titanic/support/font.h index 5ed0b5b7b4..e1c63e6544 100644 --- a/engines/titanic/support/font.h +++ b/engines/titanic/support/font.h @@ -50,6 +50,17 @@ private: */ int writeChar(CVideoSurface *surface, unsigned char c, const Common::Point &pt, Rect *destRect, Rect *srcRect); + + /** + * Extends a passed text area by the space required for + * the given character + */ + void extendBounds(Point &textSize, byte c, int maxWidth) const; + + /** + * Called at spacing between words, checks for line wrapping + */ + void checkLineWrap(Point &textSize, int maxWidth, const char *&str) const; public: byte *_dataPtr; size_t _dataSize; @@ -72,10 +83,13 @@ public: int stringWidth(const CString &text) const; /** - * Write out a string - * TODO: Verify this + * Get the text area a string will fit into + * @param str String + * @param maxWidth Maximum width in pixels + * @param sizeOut Optional pointer to output size (width, height) + * @returns Required height */ - void writeString(int maxWidth, const CString &text, int *v1, int *v2); + int getTextBounds(const CString &str, int maxWidth, Point *sizeOut) const; /** * Sets the font color diff --git a/engines/titanic/support/screen_manager.cpp b/engines/titanic/support/screen_manager.cpp index d2f2468c89..f772bc6f7e 100644 --- a/engines/titanic/support/screen_manager.cpp +++ b/engines/titanic/support/screen_manager.cpp @@ -199,12 +199,18 @@ void OSScreenManager::proc13() {} void OSScreenManager::proc14() {} void OSScreenManager::proc15() {} -void OSScreenManager::writeString(int maxWidth, const CString &text, int *v1, int *v2) { - _fonts[_fontNumber].writeString(maxWidth, text, v1, v2); +int OSScreenManager::getTextBounds(const CString &str, int maxWidth, Point *sizeOut) const { + return _fonts[_fontNumber].getTextBounds(str, maxWidth, sizeOut); +} + +int OSScreenManager::getFontHeight() const { + return _fonts[_fontNumber]._fontHeight; +} + +int OSScreenManager::stringWidth(const CString &str) { + return _fonts[_fontNumber].stringWidth(str); } -void OSScreenManager::getFont() {} -void OSScreenManager::proc18() {} void OSScreenManager::proc19() {} void OSScreenManager::clearSurface(SurfaceNum surfaceNum, Rect *bounds) { diff --git a/engines/titanic/support/screen_manager.h b/engines/titanic/support/screen_manager.h index d0580d4957..baba662564 100644 --- a/engines/titanic/support/screen_manager.h +++ b/engines/titanic/support/screen_manager.h @@ -110,14 +110,25 @@ public: virtual void proc14() = 0; virtual void proc15() = 0; + /** + * Get the text area a string will fit into + * @param str String + * @param maxWidth Maximum width in pixels + * @param sizeOut Optional pointer to output size + * @returns Required height + */ + virtual int getTextBounds(const CString &str, int maxWidth, Point *sizeOut = nullptr) const = 0; + + /** + * Get the current font height + */ + virtual int getFontHeight() const = 0; /** - * Write out a string + * Returns the width of a given string in pixels */ - virtual void writeString(int maxWidth, const CString &text, int *v1, int *v2) = 0; + virtual int stringWidth(const CString &str) = 0; - virtual void getFont() = 0; - virtual void proc18() = 0; virtual void proc19() = 0; /** @@ -216,12 +227,24 @@ public: virtual void proc15(); /** - * Write out a string + * Get the text area a string will fit into + * @param str String + * @param maxWidth Maximum width in pixels + * @param sizeOut Optional pointer to output size + * @returns Required height + */ + virtual int getTextBounds(const CString &str, int maxWidth, Point *sizeOut = nullptr) const; + + /** + * Get the current font height + */ + virtual int getFontHeight() const; + + /** + * Returns the width of a given string in pixels */ - virtual void writeString(int maxWidth, const CString &text, int *v1, int *v2); + virtual int stringWidth(const CString &str); - virtual void getFont(); - virtual void proc18(); virtual void proc19(); /** -- cgit v1.2.3 From 36faf0890fec6bab90531ade42c0eb924b31b64a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 Apr 2016 22:22:12 -0400 Subject: TITANIC: Minor work towards text display --- engines/titanic/pet_control/pet_text.cpp | 9 +++++++-- engines/titanic/pet_control/pet_text.h | 5 ++++- engines/titanic/support/font.cpp | 10 +++++++--- engines/titanic/support/font.h | 5 +++++ engines/titanic/support/screen_manager.cpp | 11 ++++++++++- engines/titanic/support/screen_manager.h | 14 +++++++++++--- 6 files changed, 44 insertions(+), 10 deletions(-) diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index ca65b23ee1..35f5f8d8de 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -130,7 +130,7 @@ void CPetText::draw(CScreenManager *screenManager) { screenManager->fillRect(SURFACE_BACKBUFFER, &tempRect, _backR, _backG, _backB); } - draw2(screenManager); + getTextHeight(screenManager); tempRect = _bounds; tempRect.grow(-2); @@ -217,8 +217,13 @@ void CPetText::updateStr3(int lineNum) { } } -void CPetText::draw2(CScreenManager *screenManager) { +int CPetText::getTextHeight(CScreenManager *screenManager) { + mergeStrings(); + int oldFontNumber = screenManager->setFontNumber(_fontNumber2); + int textHeight = screenManager->getTextBounds(_lines, _bounds.width()); + screenManager->setFontNumber(oldFontNumber); + return textHeight; } } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h index 9fd057a652..24c4e949b6 100644 --- a/engines/titanic/pet_control/pet_text.h +++ b/engines/titanic/pet_control/pet_text.h @@ -78,7 +78,10 @@ private: void updateStr3(int lineNum); - void draw2(CScreenManager *screenManager); + /** + * Get the required height to draw the text + */ + int getTextHeight(CScreenManager *screenManager); public: CPetText(uint count = 10); diff --git a/engines/titanic/support/font.cpp b/engines/titanic/support/font.cpp index f5d28ea9ca..e903abaf97 100644 --- a/engines/titanic/support/font.cpp +++ b/engines/titanic/support/font.cpp @@ -127,7 +127,11 @@ int STFont::stringWidth(const CString &text) const { return total; } -int STFont::writeChar(CVideoSurface *surface, unsigned char c, const Common::Point &pt, Rect *destRect, Rect *srcRect) { +int STFont::writeString(CVideoSurface *surface, const Point &pt, const CString &str) { + return 0; +} + +int STFont::writeChar(CVideoSurface *surface, unsigned char c, const Point &pt, Rect *destRect, Rect *srcRect) { if (c == 233) c = '$'; @@ -174,7 +178,7 @@ int STFont::writeChar(CVideoSurface *surface, unsigned char c, const Common::Poi return 0; } -void STFont::copyRect(CVideoSurface *surface, const Common::Point &pt, Rect &rect) { +void STFont::copyRect(CVideoSurface *surface, const Point &pt, Rect &rect) { if (surface->lock()) { uint16 *lineP = surface->getBasePtr(pt.x, pt.y); uint16 color = getColor(); @@ -203,7 +207,7 @@ void STFont::extendBounds(Point &textSize, byte c, int maxWidth) const { void STFont::checkLineWrap(Point &textSize, int maxWidth, const char *&str) const { bool flag = false; int totalWidth = 0; - for (const char *srcPtr = str; *srcPtr; ++srcPtr) { + for (const char *srcPtr = str; *srcPtr && *srcPtr != ' '; ++srcPtr) { if (*srcPtr == ' ' && flag) break; diff --git a/engines/titanic/support/font.h b/engines/titanic/support/font.h index e1c63e6544..4bb1b2e6d6 100644 --- a/engines/titanic/support/font.h +++ b/engines/titanic/support/font.h @@ -82,6 +82,11 @@ public: */ int stringWidth(const CString &text) const; + /** + * Write a string to the specified surface + */ + int writeString(CVideoSurface *surface, const Point &pt, const CString &str); + /** * Get the text area a string will fit into * @param str String diff --git a/engines/titanic/support/screen_manager.cpp b/engines/titanic/support/screen_manager.cpp index f772bc6f7e..b467c8593d 100644 --- a/engines/titanic/support/screen_manager.cpp +++ b/engines/titanic/support/screen_manager.cpp @@ -68,6 +68,12 @@ void CScreenManager::setSurfaceBounds(SurfaceNum surfaceNum, const Rect &r) { _backSurfaces[surfaceNum]._bounds = r; } +int CScreenManager::setFontNumber(int fontNumber) { + int oldFontNumber = _fontNumber; + _fontNumber = fontNumber; + return oldFontNumber; +} + /*------------------------------------------------------------------------*/ OSScreenManager::OSScreenManager(TitanicEngine *vm): CScreenManager(vm), @@ -197,7 +203,10 @@ void OSScreenManager::blitFrom(SurfaceNum surfaceNum, CVideoSurface *src, void OSScreenManager::proc12() {} void OSScreenManager::proc13() {} void OSScreenManager::proc14() {} -void OSScreenManager::proc15() {} + +void OSScreenManager::setFontColor(byte r, byte g, byte b) { + _fonts[_fontNumber].setColor(r, g, b); +} int OSScreenManager::getTextBounds(const CString &str, int maxWidth, Point *sizeOut) const { return _fonts[_fontNumber].getTextBounds(str, maxWidth, sizeOut); diff --git a/engines/titanic/support/screen_manager.h b/engines/titanic/support/screen_manager.h index baba662564..b1e949ad58 100644 --- a/engines/titanic/support/screen_manager.h +++ b/engines/titanic/support/screen_manager.h @@ -108,7 +108,11 @@ public: virtual void proc12() = 0; virtual void proc13() = 0; virtual void proc14() = 0; - virtual void proc15() = 0; + + /** + * Set the font color + */ + virtual void setFontColor(byte r, byte g, byte b) = 0; /** * Get the text area a string will fit into @@ -164,7 +168,7 @@ public: /** * Set the current font number */ - void setFontNumber(int fontNumber) { _fontNumber = fontNumber; } + int setFontNumber(int fontNumber); }; class OSScreenManager: CScreenManager { @@ -224,7 +228,11 @@ public: virtual void proc12(); virtual void proc13(); virtual void proc14(); - virtual void proc15(); + + /** + * Set the font color + */ + virtual void setFontColor(byte r, byte g, byte b); /** * Get the text area a string will fit into -- cgit v1.2.3 From 1512545f28c805fd4083be746220f77b72463130 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 25 Apr 2016 20:38:23 -0400 Subject: TITANIC: Resolve color handling code in CPetText --- engines/titanic/pet_control/pet_load_save.cpp | 2 +- engines/titanic/pet_control/pet_quit.cpp | 2 +- engines/titanic/pet_control/pet_real_life.cpp | 2 +- engines/titanic/pet_control/pet_rooms.cpp | 2 +- engines/titanic/pet_control/pet_sound.cpp | 8 ++--- engines/titanic/pet_control/pet_text.cpp | 42 +++++++++++++-------------- engines/titanic/pet_control/pet_text.h | 15 ++++++---- engines/titanic/support/font.cpp | 10 +++---- engines/titanic/support/font.h | 2 ++ 9 files changed, 45 insertions(+), 40 deletions(-) diff --git a/engines/titanic/pet_control/pet_load_save.cpp b/engines/titanic/pet_control/pet_load_save.cpp index 9d185a3742..5bfa1d635a 100644 --- a/engines/titanic/pet_control/pet_load_save.cpp +++ b/engines/titanic/pet_control/pet_load_save.cpp @@ -155,7 +155,7 @@ void CPetLoadSave::highlightChange() { // TODO: Unknown if check if (true) { col = section ? section->getColor(4) : 0; - _slotNames[_savegameSlotNum].setColor(0, col); + _slotNames[_savegameSlotNum].setLineColor(0, col); } } diff --git a/engines/titanic/pet_control/pet_quit.cpp b/engines/titanic/pet_control/pet_quit.cpp index 7dcaba895c..b92a362dd3 100644 --- a/engines/titanic/pet_control/pet_quit.cpp +++ b/engines/titanic/pet_control/pet_quit.cpp @@ -54,7 +54,7 @@ bool CPetQuit::reset() { uint col = getPetSection()->getColor(0); _text.setText("Are you sure you want to quit?"); - _text.setColor(0, col); + _text.setLineColor(0, col); _btnYes.reset("PetQuitOut", pet, MODE_UNSELECTED); _btnYes.reset("PetQuitIn", pet, MODE_SELECTED); diff --git a/engines/titanic/pet_control/pet_real_life.cpp b/engines/titanic/pet_control/pet_real_life.cpp index 27a5c22b01..9d469626aa 100644 --- a/engines/titanic/pet_control/pet_real_life.cpp +++ b/engines/titanic/pet_control/pet_real_life.cpp @@ -39,7 +39,7 @@ bool CPetRealLife::reset() { _glyphs.reset(); uint col = getColor(0); _text.setColor(col); - _text.setColor(0, col); + _text.setLineColor(0, col); return true; } diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp index 60ce398eb4..ee63f41ca6 100644 --- a/engines/titanic/pet_control/pet_rooms.cpp +++ b/engines/titanic/pet_control/pet_rooms.cpp @@ -47,7 +47,7 @@ bool CPetRooms::reset() { uint col = getColor(0); _text.setColor(col); - _text.setColor(0, col); + _text.setLineColor(0, col); } return true; diff --git a/engines/titanic/pet_control/pet_sound.cpp b/engines/titanic/pet_control/pet_sound.cpp index 72e991aa3d..9fb3a07322 100644 --- a/engines/titanic/pet_control/pet_sound.cpp +++ b/engines/titanic/pet_control/pet_sound.cpp @@ -100,10 +100,10 @@ bool CPetSound::reset() { CPetSection *section = getPetSection(); uint col = section->getColor(0); - _textMusicVolume.setColor(0, col); - _textMasterVolume.setColor(0, col); - _textParrotVolume.setColor(0, col); - _textSpeechVolume.setColor(0, col); + _textMusicVolume.setLineColor(0, col); + _textMasterVolume.setLineColor(0, col); + _textParrotVolume.setLineColor(0, col); + _textSpeechVolume.setLineColor(0, col); } return false; diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index 35f5f8d8de..324a63389c 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -48,7 +48,7 @@ void CPetText::freeArrays() { void CPetText::setup() { for (int idx = 0; idx < (int)_array.size(); ++idx) { _array[idx]._string1.clear(); - setArrayStr2(idx, _textR, _textG, _textB); + setLineColor(idx, _textR, _textG, _textB); _array[idx]._string3.clear(); } @@ -56,22 +56,26 @@ void CPetText::setup() { _stringsMerged = false; } -void CPetText::setArrayStr2(uint idx, int val1, int val2, int val3) { +void CPetText::setLineColor(uint lineNum, uint col) { + setLineColor(lineNum, col & 0xff, (col >> 16) & 0xff, (col >> 8) & 0xff); +} + +void CPetText::setLineColor(uint lineNum, byte r, byte g, byte b) { char buffer[6]; - if (!val1) - val1 = 1; - if (!val2) - val2 = 1; - if (!val3) - val3 = 1; - - buffer[0] = 27; - buffer[1] = val1; - buffer[2] = val2; - buffer[3] = val3; - buffer[4] = 27; + if (!r) + r = 1; + if (!g) + g = 1; + if (!b) + b = 1; + + buffer[0] = TEXTCMD_SET_COLOR; + buffer[1] = r; + buffer[2] = g; + buffer[3] = b; + buffer[4] = TEXTCMD_SET_COLOR; buffer[5] = '\0'; - _array[idx]._string2 = buffer; + _array[lineNum]._rgb = buffer; } void CPetText::load(SimpleFile *file, int param) { @@ -99,7 +103,7 @@ void CPetText::load(SimpleFile *file, int param) { assert(_array.size() >= count); for (uint idx = 0; idx < count; ++idx) { _array[idx]._string1 = file->readString(); - _array[idx]._string2 = file->readString(); + _array[idx]._rgb = file->readString(); _array[idx]._string3 = file->readString(); } } @@ -147,7 +151,7 @@ void CPetText::mergeStrings() { _lines.clear(); for (int idx = 0; idx < _lineCount; ++idx) { - CString line = _array[idx]._string2 + _array[idx]._string3 + + CString line = _array[idx]._rgb + _array[idx]._string3 + _array[idx]._string1 + "\n"; _lines += line; @@ -188,10 +192,6 @@ void CPetText::changeText(const CString &str) { _stringsMerged = false; } -void CPetText::setColor(int val1, uint col) { - warning("CPetText::setColor"); -} - void CPetText::setColor(uint col) { _textR = col & 0xff; _textG = (col >> 8) & 0xff; diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h index 24c4e949b6..2213c631d6 100644 --- a/engines/titanic/pet_control/pet_text.h +++ b/engines/titanic/pet_control/pet_text.h @@ -31,7 +31,7 @@ namespace Titanic { class CPetText { struct ArrayEntry { CString _string1; - CString _string2; + CString _rgb; CString _string3; }; private: @@ -64,8 +64,6 @@ private: void freeArrays(); - void setArrayStr2(uint idx, int val1, int val2, int val3); - /** * Merges the strings in the strings array */ @@ -120,12 +118,17 @@ public: /** * Set text color */ - void setColor(int val1, uint col); + void setColor(uint col); /** - * Set text color + * Set the color for a line */ - void setColor(uint col); + void setLineColor(uint lineNum, byte r, byte g, byte b); + + /** + * Set the color for a line + */ + void setLineColor(uint lineNum, uint col); /** * Sets the maximum number of characters per line diff --git a/engines/titanic/support/font.cpp b/engines/titanic/support/font.cpp index e903abaf97..819eaadb33 100644 --- a/engines/titanic/support/font.cpp +++ b/engines/titanic/support/font.cpp @@ -84,9 +84,9 @@ int STFont::getTextBounds(const CString &str, int maxWidth, Point *sizeOut) cons // Loop through the characters of the string if (!str.empty()) { for (const char *strP = str.c_str(); *strP; ++strP) { - if (*strP == 26) { + if (*strP == TEXTCMD_26) { strP += 3; - } else if (*strP == 27) { + } else if (*strP == TEXTCMD_SET_COLOR) { strP += 4; } else { if (*strP == ' ') { @@ -116,7 +116,7 @@ int STFont::stringWidth(const CString &text) const { if (c == 26) { // Skip over command parameter bytes srcP += 3; - } else if (c == 27) { + } else if (c == TEXTCMD_SET_COLOR) { // Skip over command parameter bytes srcP += 4; } else if (c != '\n') { @@ -211,9 +211,9 @@ void STFont::checkLineWrap(Point &textSize, int maxWidth, const char *&str) cons if (*srcPtr == ' ' && flag) break; - if (*srcPtr == 26) + if (*srcPtr == TEXTCMD_26) srcPtr += 3; - else if (*srcPtr == 27) + else if (*srcPtr == TEXTCMD_SET_COLOR) srcPtr += 4; else totalWidth += _chars[*srcPtr]._width; diff --git a/engines/titanic/support/font.h b/engines/titanic/support/font.h index 4bb1b2e6d6..087680e933 100644 --- a/engines/titanic/support/font.h +++ b/engines/titanic/support/font.h @@ -30,6 +30,8 @@ namespace Titanic { +enum TextCommand { TEXTCMD_26 = 26, TEXTCMD_SET_COLOR = 27 }; + class CVideoSurface; class STFont { -- cgit v1.2.3 From 02bb9510aa3ae99d063e21a6e4c63479b9320d3f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 25 Apr 2016 22:42:29 -0400 Subject: TITANIC: Implemented CPetConversations setup --- engines/titanic/pet_control/pet_conversations.cpp | 45 ++++++++++++++++++++++- engines/titanic/pet_control/pet_conversations.h | 9 ++++- engines/titanic/pet_control/pet_text.cpp | 37 +++++++++++++++---- engines/titanic/pet_control/pet_text.h | 17 ++++++++- 4 files changed, 95 insertions(+), 13 deletions(-) diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index 2fbee9ed6e..3afd5ee380 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -34,14 +34,55 @@ void CPetConversations::save(SimpleFile *file, int indent) const { void CPetConversations::load(SimpleFile *file, int param) { _text2.load(file, param); - _text1.load(file, param); + _log.load(file, param); for (int idx = 0; idx < 3; ++idx) _valArray3[idx] = file->readNumber(); } bool CPetConversations::isValid(CPetControl *petControl) { - // TODO + return setupControl(petControl); +} + +bool CPetConversations::setupControl(CPetControl *petControl) { + if (petControl) { + _petControl = petControl; + + _val3.setBounds(Rect(0, 0, 21, 130)); + _val3.translate(20, 350); + + const Rect rect1(0, 0, 22, 36); + _gfxList[0].setBounds(rect1); + _gfxList[0].translate(20, 359); + _gfxList[1].setBounds(rect1); + _gfxList[1].translate(20, 397); + _gfxList[2].setBounds(rect1); + _gfxList[2].translate(20, 434); + + const Rect rect2(0, 0, 11, 24); + _val1.setBounds(rect2); + _val1.translate(87, 374); + _val2.setBounds(rect2); + _val2.translate(87, 421); + + const Rect rect3(0, 0, 39, 39); + _val7.setBounds(rect3); + _val7.translate(546, 372); + _val8.setBounds(rect3); + _val8.translate(546, 418); + + _val6.setBounds(Rect(0, 0, 37, 70)); + _val6.translate(46, 374); + _val9.setBounds(Rect(0, 0, 435, 3)); + _val9.translate(102, 441); + + const Rect rect4(0, 0, 33, 66); + for (int idx = 0; idx < 9; ++idx) { + _valArray2[idx].setBounds(rect4); + _valArray2[idx].translate(48, 376); + } + } + return true; } diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index a79a513037..89dbc5eb96 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -34,7 +34,7 @@ private: CPetGfxElement _val1; CPetGfxElement _val2; CPetGfxElement _val3; - CPetGfxElement _valArray1[3]; + CPetGfxElement _gfxList[3]; CPetGfxElement _val4; CPetGfxElement _val5; CPetGfxElement _val6; @@ -44,12 +44,17 @@ private: CPetGfxElement _val9; CPetGfxElement _valArray2[9]; int _field30C; - CPetText _text1; + CPetText _log; CPetText _text2; int _valArray3[3]; int _field414; int _field418; CString _string1; +private: + /** + * Sets up the control + */ + bool setupControl(CPetControl *petControl); public: CPetConversations(); diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index 324a63389c..2e3a184739 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -47,7 +47,7 @@ void CPetText::freeArrays() { void CPetText::setup() { for (int idx = 0; idx < (int)_array.size(); ++idx) { - _array[idx]._string1.clear(); + _array[idx]._line.clear(); setLineColor(idx, _textR, _textG, _textB); _array[idx]._string3.clear(); } @@ -102,7 +102,7 @@ void CPetText::load(SimpleFile *file, int param) { warning("TODO: CPetText::load %d,%d", var1, var2); assert(_array.size() >= count); for (uint idx = 0; idx < count; ++idx) { - _array[idx]._string1 = file->readString(); + _array[idx]._line = file->readString(); _array[idx]._rgb = file->readString(); _array[idx]._string3 = file->readString(); } @@ -152,7 +152,7 @@ void CPetText::mergeStrings() { for (int idx = 0; idx < _lineCount; ++idx) { CString line = _array[idx]._rgb + _array[idx]._string3 + - _array[idx]._string1 + "\n"; + _array[idx]._line + "\n"; _lines += line; } @@ -168,24 +168,32 @@ void CPetText::resize(uint count) { _array.resize(count); } +CString CPetText::getText() const { + CString result = ""; + for (uint idx = 0; idx < _lineCount; ++idx) + result += _array[idx]._line; + + return result; +} + void CPetText::setText(const CString &str) { setup(); changeText(str); } void CPetText::changeText(const CString &str) { - int lineSize = _array[_lineCount]._string1.size(); + int lineSize = _array[_lineCount]._line.size(); int strSize = str.size(); if (_maxCharsPerLine == -1) { // No limit on horizontal characters, so append string to current line - _array[_lineCount]._string1 += str; + _array[_lineCount]._line += str; } else if ((lineSize + strSize) <= _maxCharsPerLine) { // New string fits into line, so add it on - _array[_lineCount]._string1 += str; + _array[_lineCount]._line += str; } else { // Only add part of the str up to the maximum allowed limit for line - _array[_lineCount]._string1 += str.left(_maxCharsPerLine - lineSize); + _array[_lineCount]._line += str.left(_maxCharsPerLine - lineSize); } updateStr3(_lineCount); @@ -198,6 +206,12 @@ void CPetText::setColor(uint col) { _textB = (col >> 16) & 0xff; } +void CPetText::setColor(byte r, byte g, byte b) { + _textR = r; + _textG = g; + _textB = b; +} + void CPetText::setMaxCharsPerLine(int maxChars) { if (maxChars >= -1 && maxChars < 257) _maxCharsPerLine = maxChars; @@ -206,7 +220,7 @@ void CPetText::setMaxCharsPerLine(int maxChars) { void CPetText::updateStr3(int lineNum) { if (_field64 > 0 && _field68 > 0) { char line[5]; - line[0] = line[3] = 26; + line[0] = line[3] = TEXTCMD_26; line[1] = _field64; line[2] = _field68; line[4] = '\0'; @@ -226,4 +240,11 @@ int CPetText::getTextHeight(CScreenManager *screenManager) { return textHeight; } +void CPetText::deleteLastChar() { + if (!_array[_lineCount]._line.empty()) { + _array[_lineCount]._line.deleteLastChar(); + _stringsMerged = false; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h index 2213c631d6..73e85401c3 100644 --- a/engines/titanic/pet_control/pet_text.h +++ b/engines/titanic/pet_control/pet_text.h @@ -30,7 +30,7 @@ namespace Titanic { class CPetText { struct ArrayEntry { - CString _string1; + CString _line; CString _rgb; CString _string3; }; @@ -110,6 +110,11 @@ public: void resize(uint count); + /** + * Returns the text from all the lines as a single string + */ + CString getText() const; + /** * Set the text */ @@ -120,6 +125,11 @@ public: */ void setColor(uint col); + /** + * Set text color + */ + void setColor(byte r, byte g, byte b); + /** * Set the color for a line */ @@ -134,6 +144,11 @@ public: * Sets the maximum number of characters per line */ void setMaxCharsPerLine(int maxChars); + + /** + * Delete the last character from the last line + */ + void deleteLastChar(); }; } // End of namespace Titanic -- cgit v1.2.3 From b114c768cd592462794d4fa2a397473cf146656c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 25 Apr 2016 22:52:49 -0400 Subject: TITANIC: Adding more CPetText support methods --- engines/titanic/pet_control/pet_text.cpp | 7 ++++++- engines/titanic/pet_control/pet_text.h | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index 2e3a184739..7f5a5eaed9 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -170,7 +170,7 @@ void CPetText::resize(uint count) { CString CPetText::getText() const { CString result = ""; - for (uint idx = 0; idx < _lineCount; ++idx) + for (int idx = 0; idx < _lineCount; ++idx) result += _array[idx]._line; return result; @@ -247,4 +247,9 @@ void CPetText::deleteLastChar() { } } +void CPetText::setNPC(int val1, int npcId) { + _field64 = val1; + _field68 = npcId; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h index 73e85401c3..35d48974dd 100644 --- a/engines/titanic/pet_control/pet_text.h +++ b/engines/titanic/pet_control/pet_text.h @@ -149,6 +149,13 @@ public: * Delete the last character from the last line */ void deleteLastChar(); + + void setNPC(int val1, int npcId); + + /** + * Get the font + */ + int getFontNumber() const { return _fontNumber1; } }; } // End of namespace Titanic -- cgit v1.2.3 From 34c32e38e2659406e3556f752fcada8491860e92 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 26 Apr 2016 22:18:21 -0400 Subject: TITANIC: More font logic, beginnings of text cursor --- engines/titanic/game_manager.cpp | 2 +- engines/titanic/pet_control/pet_text.cpp | 7 ++-- engines/titanic/pet_control/pet_text.h | 3 +- engines/titanic/support/font.cpp | 59 +++++++++++++++++++++++++++--- engines/titanic/support/font.h | 6 ++- engines/titanic/support/screen_manager.cpp | 13 ++++++- engines/titanic/support/screen_manager.h | 24 +++++++++++- engines/titanic/support/text_cursor.cpp | 12 ++++-- engines/titanic/support/text_cursor.h | 54 ++++++++++++++++++++++++++- 9 files changed, 157 insertions(+), 23 deletions(-) diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index 31bb4278e1..a82488e44e 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -142,7 +142,7 @@ void CGameManager::update() { CScreenManager *screenManager = CScreenManager::_screenManagerPtr; CTextCursor *textCursor = screenManager->_textCursor; if (textCursor && textCursor->_active) - _bounds.extend(textCursor->getBounds()); + _bounds.extend(textCursor->getCursorBounds()); // Set the surface bounds screenManager->setSurfaceBounds(SURFACE_BACKBUFFER, _bounds); diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index 7f5a5eaed9..77019d7f2d 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -30,7 +30,7 @@ CPetText::CPetText(uint count) : _backR(0xff), _backG(0xff), _backB(0xff), _textR(0), _textG(0), _textB(200), _fontNumber2(0), _field64(0), _field68(0), _field6C(0), - _hasBorder(true), _field74(0), _field78(0), _field7C(0) { + _hasBorder(true), _field74(0), _textCursor(nullptr), _field7C(0) { setupArrays(count); } @@ -140,9 +140,8 @@ void CPetText::draw(CScreenManager *screenManager) { tempRect.grow(-2); screenManager->setFontNumber(_fontNumber2); -// int var14 = 0; -// screenManager->writeLines(0, &var14, _field74, ) - warning("TODO: CPetText_Draw"); + screenManager->writeString(0, tempRect, _field74, _lines, _textCursor); + screenManager->setFontNumber(_fontNumber1); } diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h index 35d48974dd..6ce1903166 100644 --- a/engines/titanic/pet_control/pet_text.h +++ b/engines/titanic/pet_control/pet_text.h @@ -25,6 +25,7 @@ #include "titanic/support/simple_file.h" #include "titanic/support/screen_manager.h" +#include "titanic/support/text_cursor.h" namespace Titanic { @@ -57,7 +58,7 @@ private: int _field6C; bool _hasBorder; int _field74; - int _field78; + CTextCursor *_textCursor; int _field7C; private: void setupArrays(int count); diff --git a/engines/titanic/support/font.cpp b/engines/titanic/support/font.cpp index 819eaadb33..c6fd871e78 100644 --- a/engines/titanic/support/font.cpp +++ b/engines/titanic/support/font.cpp @@ -127,11 +127,60 @@ int STFont::stringWidth(const CString &text) const { return total; } -int STFont::writeString(CVideoSurface *surface, const Point &pt, const CString &str) { - return 0; +int STFont::writeString(CVideoSurface *surface, const Rect &rect1, const Rect &destRect, + int val1, const CString &str, CTextCursor *textCursor) { + if (!_fontHeight || !_dataPtr) + return -1; + + Point textSize; + Rect destBounds = destRect; + destBounds.constrain(rect1); + if (destBounds.isEmpty()) + return -1; + + const char *endP = nullptr; + const char *strEndP = str.c_str() + str.size() - 1; + for (const char *srcP = str.c_str(); *srcP; ++srcP) { + if (*srcP == TEXTCMD_26) { + srcP += 3; + } else if (*srcP == TEXTCMD_SET_COLOR) { + // Change the color used for characters + byte r = *++srcP; + byte g = *++srcP; + byte b = *++srcP; + ++srcP; + setColor(r, g, b); + } else { + if (*srcP == ' ') { + // Check fo rline wrapping + checkLineWrap(textSize, rect1.width(), srcP); + if (!*srcP) + return endP - str.c_str(); + } + + if (*srcP != '\n') { + int result = writeChar(surface, *srcP, textSize, rect1, &destBounds); + if (result == -2) + return endP - str.c_str(); + else if (!result) + endP = srcP; + } + + if (srcP < strEndP) + extendBounds(textSize, *srcP, rect1.width()); + } + } + + if (textCursor && textCursor->get54() == -2) { + Point cursorPos(rect1.left + textSize.x, rect1.top + textSize.y); + textCursor->setPos(cursorPos); + } + + return endP - str.c_str(); } -int STFont::writeChar(CVideoSurface *surface, unsigned char c, const Point &pt, Rect *destRect, Rect *srcRect) { +int STFont::writeChar(CVideoSurface *surface, unsigned char c, const Point &pt, + const Rect &destRect, const Rect *srcRect) { if (c == 233) c = '$'; @@ -140,10 +189,10 @@ int STFont::writeChar(CVideoSurface *surface, unsigned char c, const Point &pt, tempRect.right = _chars[c]._offset + _chars[c]._width; tempRect.top = 0; tempRect.bottom = _fontHeight; - Point destPos(pt.x + destRect->left, pt.y + destRect->top); + Point destPos(pt.x + destRect.left, pt.y + destRect.top); if (srcRect->isEmpty()) - srcRect = destRect; + srcRect = &destRect; if (destPos.y > srcRect->bottom) return -2; diff --git a/engines/titanic/support/font.h b/engines/titanic/support/font.h index 087680e933..f2d7c471d9 100644 --- a/engines/titanic/support/font.h +++ b/engines/titanic/support/font.h @@ -27,6 +27,7 @@ #include "common/array.h" #include "titanic/support/rect.h" #include "titanic/support/string.h" +#include "titanic/support/text_cursor.h" namespace Titanic { @@ -51,7 +52,7 @@ private: * Write a character */ int writeChar(CVideoSurface *surface, unsigned char c, - const Common::Point &pt, Rect *destRect, Rect *srcRect); + const Common::Point &pt, const Rect &destRect, const Rect *srcRect); /** * Extends a passed text area by the space required for @@ -87,7 +88,8 @@ public: /** * Write a string to the specified surface */ - int writeString(CVideoSurface *surface, const Point &pt, const CString &str); + int writeString(CVideoSurface *surface, const Rect &rect1, const Rect &destRect, + int val1, const CString &str, CTextCursor *textCursor); /** * Get the text area a string will fit into diff --git a/engines/titanic/support/screen_manager.cpp b/engines/titanic/support/screen_manager.cpp index b467c8593d..3005bdd446 100644 --- a/engines/titanic/support/screen_manager.cpp +++ b/engines/titanic/support/screen_manager.cpp @@ -201,7 +201,16 @@ void OSScreenManager::blitFrom(SurfaceNum surfaceNum, CVideoSurface *src, } void OSScreenManager::proc12() {} -void OSScreenManager::proc13() {} + +int OSScreenManager::writeString(int surfaceNum, const Rect &destRect, + int val1, const CString &str, CTextCursor *textCursor) { + if (_backSurfaces.empty()) + return -1; + + return _fonts[_fontNumber].writeString(_backSurfaces[surfaceNum]._surface, + destRect, _backSurfaces[surfaceNum]._bounds, val1, str, textCursor); +} + void OSScreenManager::proc14() {} void OSScreenManager::setFontColor(byte r, byte g, byte b) { @@ -273,7 +282,7 @@ void OSScreenManager::loadCursors() { showCursor(); if (!_textCursor) { - _textCursor = new CTextCursor(); + _textCursor = new CTextCursor(this); } } diff --git a/engines/titanic/support/screen_manager.h b/engines/titanic/support/screen_manager.h index b1e949ad58..7fe60d20b7 100644 --- a/engines/titanic/support/screen_manager.h +++ b/engines/titanic/support/screen_manager.h @@ -106,7 +106,17 @@ public: const Rect *srcRect = nullptr) = 0; virtual void proc12() = 0; - virtual void proc13() = 0; + + /** + * Write a string + * @param surfaceNum Destination surface + * @param destRect Bounds within dest surface + * @param str Line or lines to write + * @param textCursor Optional text cursor pointer + */ + virtual int writeString(int surfaceNum, const Rect &destRect, int val1, + const CString &str, CTextCursor *textCursor) = 0; + virtual void proc14() = 0; /** @@ -226,7 +236,17 @@ public: const Rect *srcRect = nullptr); virtual void proc12(); - virtual void proc13(); + + /** + * Write a string + * @param surfaceNum Destination surface + * @param destRect Bounds within dest surface + * @param str Line or lines to write + * @param textCursor Optional text cursor pointer + */ + virtual int writeString(int surfaceNum, const Rect &destRect, + int val1, const CString &str, CTextCursor *textCursor); + virtual void proc14(); /** diff --git a/engines/titanic/support/text_cursor.cpp b/engines/titanic/support/text_cursor.cpp index fd0c1d22dd..2f2ee8af8c 100644 --- a/engines/titanic/support/text_cursor.cpp +++ b/engines/titanic/support/text_cursor.cpp @@ -22,15 +22,19 @@ #include "common/textconsole.h" #include "titanic/support/text_cursor.h" +#include "titanic/support/screen_manager.h" namespace Titanic { -CTextCursor::CTextCursor() : _active(false) { +CTextCursor::CTextCursor(CScreenManager *screenManager) : + _screenManager(screenManager), _priorTicks(300), _active(false), + _field24(0), _size(2, 10), _field38(0), _field3C(0), + _field44(0), _field48(0), _field4C(0), _field54(-1) { + screenManager->createSurface(10, 10); } -Rect CTextCursor::getBounds() { - warning("CTextCursor::getBounds"); - return Rect(); +CTextCursor::~CTextCursor() { + delete _surface; } } // End of namespace Titanic diff --git a/engines/titanic/support/text_cursor.h b/engines/titanic/support/text_cursor.h index b6480673eb..d9dbce0988 100644 --- a/engines/titanic/support/text_cursor.h +++ b/engines/titanic/support/text_cursor.h @@ -28,13 +28,63 @@ namespace Titanic { +class CScreenManager; +class CVideoSurface; + class CTextCursor { +private: + CScreenManager *_screenManager; + Point _pos; + Rect _bounds; + uint _priorTicks; + int _field24; + Point _size; + int _field38; + int _field3C; + int _field44; + int _field48; + int _field4C; + CVideoSurface *_surface; + int _field54; public: bool _active; public: - CTextCursor(); + CTextCursor(CScreenManager *screenManager); + ~CTextCursor(); + + /** + * Sets the position of the cursor + */ + void setPos(const Point &pt) { _pos = pt; } + + /** + * Sets the size of the cursor + */ + void setSize(const Point &size) { _size = size; } + + /** + * Returns the bounds for the cursor + */ + Rect getCursorBounds() const { + return Rect(_pos.x, _pos.y, _pos.x + _size.x, _pos.y + _size.y); + } + + /** + * Set bounds + */ + void setBounds(const Rect &r) { _bounds = r; } + + /** + * Clear the bounds + */ + void clearBounds() { _bounds.clear(); } + + /** + * Set the prior ticks + */ + void setTicks(uint ticks) { _priorTicks = ticks; } - Rect getBounds(); + int get54() const { return _field54; } }; } // End of namespace Titanic -- cgit v1.2.3 From d6b104d5a3e4ad7baebee8504ed60537a35a429e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 26 Apr 2016 22:32:49 -0400 Subject: TITANIC: Further work on CTextCursor fields --- engines/titanic/support/text_cursor.cpp | 4 ++-- engines/titanic/support/text_cursor.h | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/engines/titanic/support/text_cursor.cpp b/engines/titanic/support/text_cursor.cpp index 2f2ee8af8c..7e69a2239a 100644 --- a/engines/titanic/support/text_cursor.cpp +++ b/engines/titanic/support/text_cursor.cpp @@ -28,8 +28,8 @@ namespace Titanic { CTextCursor::CTextCursor(CScreenManager *screenManager) : _screenManager(screenManager), _priorTicks(300), _active(false), - _field24(0), _size(2, 10), _field38(0), _field3C(0), - _field44(0), _field48(0), _field4C(0), _field54(-1) { + _field24(0), _size(2, 10), _field44(0), _field48(0), _field4C(0), + _field54(-1) { screenManager->createSurface(10, 10); } diff --git a/engines/titanic/support/text_cursor.h b/engines/titanic/support/text_cursor.h index d9dbce0988..c9fcfa35dd 100644 --- a/engines/titanic/support/text_cursor.h +++ b/engines/titanic/support/text_cursor.h @@ -39,8 +39,7 @@ private: uint _priorTicks; int _field24; Point _size; - int _field38; - int _field3C; + Point _screenTopLeft; int _field44; int _field48; int _field4C; @@ -84,6 +83,11 @@ public: */ void setTicks(uint ticks) { _priorTicks = ticks; } + /** + * Returns whether the text cursor is active + */ + bool isActive() const { return _active; } + int get54() const { return _field54; } }; -- cgit v1.2.3 From a2f933a80e5e830cdbcbb530f334c41725ee87b2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 27 Apr 2016 19:50:48 -0400 Subject: TITANIC: Minor fleshing out on font drawing --- engines/titanic/support/font.cpp | 9 +++++---- engines/titanic/support/font.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/engines/titanic/support/font.cpp b/engines/titanic/support/font.cpp index c6fd871e78..d1c947f01e 100644 --- a/engines/titanic/support/font.cpp +++ b/engines/titanic/support/font.cpp @@ -128,11 +128,11 @@ int STFont::stringWidth(const CString &text) const { } int STFont::writeString(CVideoSurface *surface, const Rect &rect1, const Rect &destRect, - int val1, const CString &str, CTextCursor *textCursor) { + int yOffset, const CString &str, CTextCursor *textCursor) { if (!_fontHeight || !_dataPtr) return -1; - Point textSize; + Point textSize(0, -yOffset); Rect destBounds = destRect; destBounds.constrain(rect1); if (destBounds.isEmpty()) @@ -171,7 +171,7 @@ int STFont::writeString(CVideoSurface *surface, const Rect &rect1, const Rect &d } } - if (textCursor && textCursor->get54() == -2) { + if (textCursor && textCursor->getMode() == -2) { Point cursorPos(rect1.left + textSize.x, rect1.top + textSize.y); textCursor->setPos(cursorPos); } @@ -236,7 +236,8 @@ void STFont::copyRect(CVideoSurface *surface, const Point &pt, Rect &rect) { uint16 *destP = lineP; for (int xp = rect.left; xp < rect.right; ++xp, ++destP) { const byte *srcP = _dataPtr + yp * _dataWidth + xp; - //surface->changePixel(destP, color, *srcP >> 3, 1); + if (*srcP >> 3) + *destP = color; } } diff --git a/engines/titanic/support/font.h b/engines/titanic/support/font.h index f2d7c471d9..75c91f3d36 100644 --- a/engines/titanic/support/font.h +++ b/engines/titanic/support/font.h @@ -89,7 +89,7 @@ public: * Write a string to the specified surface */ int writeString(CVideoSurface *surface, const Rect &rect1, const Rect &destRect, - int val1, const CString &str, CTextCursor *textCursor); + int yOffset, const CString &str, CTextCursor *textCursor); /** * Get the text area a string will fit into -- cgit v1.2.3 From 74e40be66e231a8eada9bc045828e17f044a7c55 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 27 Apr 2016 19:50:58 -0400 Subject: TITANIC: Implementing text cursor drawing --- engines/titanic/support/screen_manager.cpp | 2 -- engines/titanic/support/screen_manager.h | 15 ++++++-- engines/titanic/support/text_cursor.cpp | 56 ++++++++++++++++++++++++++++-- engines/titanic/support/text_cursor.h | 49 +++++++++++++++++++------- engines/titanic/support/video_surface.h | 2 +- 5 files changed, 104 insertions(+), 20 deletions(-) diff --git a/engines/titanic/support/screen_manager.cpp b/engines/titanic/support/screen_manager.cpp index 3005bdd446..0c9d3ab4e0 100644 --- a/engines/titanic/support/screen_manager.cpp +++ b/engines/titanic/support/screen_manager.cpp @@ -140,8 +140,6 @@ CVideoSurface *OSScreenManager::getSurface(SurfaceNum surfaceNum) const { return nullptr; } -void OSScreenManager::proc9() {} - void OSScreenManager::fillRect(SurfaceNum surfaceNum, Rect *rect, byte r, byte g, byte b) { DirectDrawSurface *surface = getDDSurface(surfaceNum); if (!surface) diff --git a/engines/titanic/support/screen_manager.h b/engines/titanic/support/screen_manager.h index 7fe60d20b7..b963fcd3d6 100644 --- a/engines/titanic/support/screen_manager.h +++ b/engines/titanic/support/screen_manager.h @@ -92,7 +92,11 @@ public: virtual void proc6() = 0; virtual void proc7() = 0; virtual CVideoSurface *getSurface(SurfaceNum surfaceNum) const = 0; - virtual void proc9() = 0; + + /** + * Return the front render surface + */ + virtual CVideoSurface *getFrontRenderSurface() const = 0; /** * Fill an area with a specific color @@ -222,7 +226,14 @@ public: virtual void proc6(); virtual void proc7(); virtual CVideoSurface *getSurface(SurfaceNum surfaceNum) const; - virtual void proc9(); + + /** + * Return the front render surface + */ + virtual CVideoSurface *getFrontRenderSurface() const { + return _frontRenderSurface; + } + /** * Fill an area with a specific color diff --git a/engines/titanic/support/text_cursor.cpp b/engines/titanic/support/text_cursor.cpp index 7e69a2239a..c3d2f20f84 100644 --- a/engines/titanic/support/text_cursor.cpp +++ b/engines/titanic/support/text_cursor.cpp @@ -23,13 +23,15 @@ #include "common/textconsole.h" #include "titanic/support/text_cursor.h" #include "titanic/support/screen_manager.h" +#include "titanic/titanic.h" namespace Titanic { CTextCursor::CTextCursor(CScreenManager *screenManager) : - _screenManager(screenManager), _priorTicks(300), _active(false), - _field24(0), _size(2, 10), _field44(0), _field48(0), _field4C(0), - _field54(-1) { + _screenManager(screenManager), _active(false), _blinkVisible(false), + _backRenderSurface(nullptr), _frontRenderSurface(nullptr), + _blinkDelay(300), _size(2, 10), _priorBlinkTime(0), + _cursorR(0), _cursorG(0), _cursorB(0), _mode(-1) { screenManager->createSurface(10, 10); } @@ -37,4 +39,52 @@ CTextCursor::~CTextCursor() { delete _surface; } +void CTextCursor::setColor(byte r, byte g, byte b) { + _cursorR = r; + _cursorG = g; + _cursorB = b; +} + +void CTextCursor::show() { + _backRenderSurface = _screenManager->getSurface(SURFACE_BACKBUFFER); + _frontRenderSurface = _screenManager->getFrontRenderSurface(); + _active = true; + _priorBlinkTime = g_vm->_events->getTicksCount(); +} + +void CTextCursor::hide() { + _active = false; +} + +void CTextCursor::draw() { + if (!_active) + return; + + // Handle updating whether the blinking cursor is visible or not + uint newTicks = g_vm->_events->getTicksCount(); + while (newTicks > (_priorBlinkTime + _blinkDelay)) { + _priorBlinkTime += _blinkDelay; + _blinkVisible = !_blinkVisible; + } + + if (_blinkVisible) { + Rect cursorRect = getCursorBounds(); + _surface->blitFrom(Common::Point(0, 0), _backRenderSurface, &cursorRect); + + if (!_screenBounds.isEmpty()) + // Limit the cursor rect to only within designated screen area + cursorRect.constrain(_screenBounds); + + if (!cursorRect.isEmpty()) { + // Draw cursor onto the screen + _backRenderSurface->_ddSurface->fillRect(&cursorRect, + _cursorR, _cursorG, _cursorB); + } + } + + if (_active && _blinkVisible) { + _screenManager->blitFrom(SURFACE_BACKBUFFER, _surface, &_pos); + } +} + } // End of namespace Titanic diff --git a/engines/titanic/support/text_cursor.h b/engines/titanic/support/text_cursor.h index c9fcfa35dd..d8c6ac0653 100644 --- a/engines/titanic/support/text_cursor.h +++ b/engines/titanic/support/text_cursor.h @@ -34,17 +34,20 @@ class CVideoSurface; class CTextCursor { private: CScreenManager *_screenManager; + CVideoSurface *_backRenderSurface; + CVideoSurface *_frontRenderSurface; Point _pos; - Rect _bounds; - uint _priorTicks; - int _field24; + Rect _screenBounds; + uint _blinkDelay; + bool _blinkVisible; Point _size; Point _screenTopLeft; - int _field44; - int _field48; - int _field4C; + uint _priorBlinkTime; + byte _cursorR; + byte _cursorG; + byte _cursorB; CVideoSurface *_surface; - int _field54; + int _mode; public: bool _active; public: @@ -71,24 +74,46 @@ public: /** * Set bounds */ - void setBounds(const Rect &r) { _bounds = r; } + void setBounds(const Rect &r) { _screenBounds = r; } /** * Clear the bounds */ - void clearBounds() { _bounds.clear(); } + void clearBounds() { _screenBounds.clear(); } /** - * Set the prior ticks + * Set the blinking rate */ - void setTicks(uint ticks) { _priorTicks = ticks; } + void setBlinkRate(uint ticks) { _blinkDelay = ticks; } + + /** + * Set the cursor color + */ + void setColor(byte r, byte g, byte b); /** * Returns whether the text cursor is active */ bool isActive() const { return _active; } - int get54() const { return _field54; } + int getMode() const { return _mode; } + + void setMode(int mode) { _mode = mode; } + + /** + * Show the text cursor + */ + void show(); + + /** + * Hide the text cursor + */ + void hide(); + + /** + * Update and draw the cursor if necessary + */ + void draw(); }; } // End of namespace Titanic diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index 2ec2c9ddba..d7061895a5 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -55,7 +55,6 @@ protected: protected: CScreenManager *_screenManager; CResourceKey _resourceKey; - DirectDrawSurface *_ddSurface; Graphics::ManagedSurface *_rawSurface; bool _pendingLoad; void *_field40; @@ -66,6 +65,7 @@ protected: int _lockCount; public: CMovie *_movie; + DirectDrawSurface *_ddSurface; bool _blitFlag; bool _blitStyleFlag; public: -- cgit v1.2.3 From 2675580208561c8c8bd9d6908a202006ddf195b7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 27 Apr 2016 20:11:40 -0400 Subject: TITANIC: Fix crashes in PET and text cursor --- engines/titanic/pet_control/pet_load_save.cpp | 3 +-- engines/titanic/support/text_cursor.cpp | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/engines/titanic/pet_control/pet_load_save.cpp b/engines/titanic/pet_control/pet_load_save.cpp index 5bfa1d635a..811fd12089 100644 --- a/engines/titanic/pet_control/pet_load_save.cpp +++ b/engines/titanic/pet_control/pet_load_save.cpp @@ -152,8 +152,7 @@ void CPetLoadSave::highlightChange() { for (int idx = 0; idx < SAVEGAME_SLOTS_COUNT; ++idx) _slotNames[idx].setColor(col); - // TODO: Unknown if check - if (true) { + if (_savegameSlotNum != -1) { col = section ? section->getColor(4) : 0; _slotNames[_savegameSlotNum].setLineColor(0, col); } diff --git a/engines/titanic/support/text_cursor.cpp b/engines/titanic/support/text_cursor.cpp index c3d2f20f84..dc78d5350d 100644 --- a/engines/titanic/support/text_cursor.cpp +++ b/engines/titanic/support/text_cursor.cpp @@ -32,7 +32,7 @@ CTextCursor::CTextCursor(CScreenManager *screenManager) : _backRenderSurface(nullptr), _frontRenderSurface(nullptr), _blinkDelay(300), _size(2, 10), _priorBlinkTime(0), _cursorR(0), _cursorG(0), _cursorB(0), _mode(-1) { - screenManager->createSurface(10, 10); + _surface = screenManager->createSurface(10, 10); } CTextCursor::~CTextCursor() { -- cgit v1.2.3 From a8835043f54daf54a2c03ccdb02f125a62a7ddcd Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 27 Apr 2016 21:01:12 -0400 Subject: TITANIC: PET Text is now partially showing --- engines/titanic/pet_control/pet_text.cpp | 5 ++--- engines/titanic/support/screen_manager.cpp | 18 ++++++++++++++---- engines/titanic/support/screen_manager.h | 12 ++++++++---- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index 77019d7f2d..3a10ab4c87 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -140,7 +140,7 @@ void CPetText::draw(CScreenManager *screenManager) { tempRect.grow(-2); screenManager->setFontNumber(_fontNumber2); - screenManager->writeString(0, tempRect, _field74, _lines, _textCursor); + screenManager->writeString(SURFACE_BACKBUFFER, tempRect, _field74, _lines, _textCursor); screenManager->setFontNumber(_fontNumber1); } @@ -149,11 +149,10 @@ void CPetText::mergeStrings() { if (!_stringsMerged) { _lines.clear(); - for (int idx = 0; idx < _lineCount; ++idx) { + for (int idx = 0; idx <= _lineCount; ++idx) { CString line = _array[idx]._rgb + _array[idx]._string3 + _array[idx]._line + "\n"; _lines += line; - } _stringsMerged = true; diff --git a/engines/titanic/support/screen_manager.cpp b/engines/titanic/support/screen_manager.cpp index 0c9d3ab4e0..1a43d78dd0 100644 --- a/engines/titanic/support/screen_manager.cpp +++ b/engines/titanic/support/screen_manager.cpp @@ -201,12 +201,22 @@ void OSScreenManager::blitFrom(SurfaceNum surfaceNum, CVideoSurface *src, void OSScreenManager::proc12() {} int OSScreenManager::writeString(int surfaceNum, const Rect &destRect, - int val1, const CString &str, CTextCursor *textCursor) { - if (_backSurfaces.empty()) + int yOffset, const CString &str, CTextCursor *textCursor) { + CVideoSurface *surface; + Rect bounds; + + if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) { + surface = _backSurfaces[surfaceNum]._surface; + bounds = _backSurfaces[surfaceNum]._bounds; + } else if (surfaceNum == -1) { + surface = _frontRenderSurface; + bounds = Rect(0, 0, surface->getWidth(), surface->getHeight()); + } else { return -1; + } - return _fonts[_fontNumber].writeString(_backSurfaces[surfaceNum]._surface, - destRect, _backSurfaces[surfaceNum]._bounds, val1, str, textCursor); + return _fonts[_fontNumber].writeString(surface, destRect, bounds, + yOffset, str, textCursor); } void OSScreenManager::proc14() {} diff --git a/engines/titanic/support/screen_manager.h b/engines/titanic/support/screen_manager.h index b963fcd3d6..2e80869085 100644 --- a/engines/titanic/support/screen_manager.h +++ b/engines/titanic/support/screen_manager.h @@ -115,12 +115,14 @@ public: * Write a string * @param surfaceNum Destination surface * @param destRect Bounds within dest surface + * @param yOffset Y offset for drawing, to allow for parts of + * the text to be scrolled off-screen * @param str Line or lines to write * @param textCursor Optional text cursor pointer */ - virtual int writeString(int surfaceNum, const Rect &destRect, int val1, - const CString &str, CTextCursor *textCursor) = 0; - + virtual int writeString(int surfaceNum, const Rect &destRect, + int yOffset, const CString &str, CTextCursor *textCursor) = 0; + virtual void proc14() = 0; /** @@ -252,11 +254,13 @@ public: * Write a string * @param surfaceNum Destination surface * @param destRect Bounds within dest surface + * @param yOffset Y offset for drawing, to allow for parts of + * the text to be scrolled off-screen * @param str Line or lines to write * @param textCursor Optional text cursor pointer */ virtual int writeString(int surfaceNum, const Rect &destRect, - int val1, const CString &str, CTextCursor *textCursor); + int yOffset, const CString &str, CTextCursor *textCursor); virtual void proc14(); -- cgit v1.2.3 From e4b231b39dfb0247afa61ac8afb40be863b9f08c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 27 Apr 2016 21:24:12 -0400 Subject: TITANIC: Fix vertical drawing of text --- engines/titanic/support/font.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/titanic/support/font.cpp b/engines/titanic/support/font.cpp index d1c947f01e..ca9a7ed4b2 100644 --- a/engines/titanic/support/font.cpp +++ b/engines/titanic/support/font.cpp @@ -232,11 +232,11 @@ void STFont::copyRect(CVideoSurface *surface, const Point &pt, Rect &rect) { uint16 *lineP = surface->getBasePtr(pt.x, pt.y); uint16 color = getColor(); - for (int yp = rect.top; yp < rect.bottom; ++yp, lineP += surface->getPitch()) { + for (int yp = rect.top; yp < rect.bottom; ++yp, lineP += surface->getWidth()) { uint16 *destP = lineP; for (int xp = rect.left; xp < rect.right; ++xp, ++destP) { const byte *srcP = _dataPtr + yp * _dataWidth + xp; - if (*srcP >> 3) + if (!(*srcP >> 3)) *destP = color; } } -- cgit v1.2.3 From 001a2ac15e5c8722ba283e7380d6dc9ce11e51b0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 27 Apr 2016 23:02:00 -0400 Subject: TITANIC: Implement surface changePixel method --- engines/titanic/support/direct_draw_surface.h | 5 +++++ engines/titanic/support/font.cpp | 3 +-- engines/titanic/support/video_surface.cpp | 24 ++++++++++++++++++++++-- engines/titanic/support/video_surface.h | 4 ++-- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/engines/titanic/support/direct_draw_surface.h b/engines/titanic/support/direct_draw_surface.h index 12848b125d..af19e369d2 100644 --- a/engines/titanic/support/direct_draw_surface.h +++ b/engines/titanic/support/direct_draw_surface.h @@ -84,6 +84,11 @@ public: */ int getPitch() const { return _surface->pitch; } + /** + * Return the surface's format + */ + const Graphics::PixelFormat &getFormat() { return _surface->format; } + /** * Lock the surface for access */ diff --git a/engines/titanic/support/font.cpp b/engines/titanic/support/font.cpp index ca9a7ed4b2..3d5705ac5a 100644 --- a/engines/titanic/support/font.cpp +++ b/engines/titanic/support/font.cpp @@ -236,8 +236,7 @@ void STFont::copyRect(CVideoSurface *surface, const Point &pt, Rect &rect) { uint16 *destP = lineP; for (int xp = rect.left; xp < rect.right; ++xp, ++destP) { const byte *srcP = _dataPtr + yp * _dataWidth + xp; - if (!(*srcP >> 3)) - *destP = color; + surface->changePixel(destP, &color, *srcP >> 3, true); } } diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index 089b216347..fe694786e4 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -164,6 +164,8 @@ bool CVideoSurface::proc45() { /*------------------------------------------------------------------------*/ +byte OSVideoSurface::_map[0x400]; + OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, DirectDrawSurface *surface) : CVideoSurface(screenManager) { _ddSurface = surface; @@ -367,8 +369,26 @@ uint16 OSVideoSurface::getPixel(const Common::Point &pt) { } } -void OSVideoSurface::changePixel(uint16 *pixelP, uint16 color, int val3, int val5) { - // TODO +void OSVideoSurface::changePixel(uint16 *pixelP, uint16 *color, byte srcVal, bool remapFlag) { + assert(getPixelDepth() == 2); + const Graphics::PixelFormat &format = _ddSurface->getFormat(); + + // Get the color + byte r, g, b; + format.colorToRGB(*color, r, g, b); + if (remapFlag) { + r = _map[0x3e0 - srcVal * 32 + (r >> 2)] << 2; + g = _map[0x3e0 - srcVal * 32 + (g >> 2)] << 2; + b = _map[0x3e0 - srcVal * 32 + (b >> 2)] << 2; + } + + byte r2, g2, b2; + format.colorToRGB(*pixelP, r2, g2, b2); + r2 = _map[srcVal * 32 + (r2 >> 2)] << 2; + g2 = _map[srcVal * 32 + (g2 >> 2)] << 2; + b2 = _map[srcVal * 32 + (b2 >> 2)] << 2; + + *pixelP = format.RGBToColor(r + r2, g + g2, b + b2); } void OSVideoSurface::shiftColors() { diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index d7061895a5..60315a6477 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -147,7 +147,7 @@ public: /** * Change a pixel */ - virtual void changePixel(uint16 *pixelP, uint16 color, int val3, int val5) = 0; + virtual void changePixel(uint16 *pixelP, uint16 *color, byte srcVal, bool remapFlag = true) = 0; /** * Shifts the colors of the surface.. maybe greys it out? @@ -306,7 +306,7 @@ public: /** * Change a pixel */ - virtual void changePixel(uint16 *pixelP, uint16 color, int val3, int val5); + virtual void changePixel(uint16 *pixelP, uint16 *color, byte srcVal, bool remapFlag = true); /** * Shifts the colors of the surface.. maybe greys it out? -- cgit v1.2.3 From 75fdd1504de98c7c6937344877685bfef6514344 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 27 Apr 2016 23:15:10 -0400 Subject: TITANIC: Call method to initialize OSVideoSurface _map array --- engines/titanic/titanic.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index 3660ce18ea..932189067f 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -88,6 +88,7 @@ void TitanicEngine::initialize() { CExitPellerator::init(); CEnterExitSecClassMiniLift::init(); CTelevision::init(); + OSVideoSurface::setup(); _debugger = new Debugger(this); _events = new Events(this); -- cgit v1.2.3 From e778ac8bcd6c2e0a026c813614c884e5044110c3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 28 Apr 2016 18:19:47 -0400 Subject: TITANIC: FIx confusion between mouse down & up messages in CPETElement hierarchy --- engines/titanic/pet_control/pet_element.cpp | 4 ++-- engines/titanic/pet_control/pet_element.h | 8 ++++---- engines/titanic/pet_control/pet_frame.cpp | 2 +- engines/titanic/pet_control/pet_load_save.cpp | 4 ++-- engines/titanic/pet_control/pet_quit.cpp | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/engines/titanic/pet_control/pet_element.cpp b/engines/titanic/pet_control/pet_element.cpp index 3e9c991d1d..616877e15e 100644 --- a/engines/titanic/pet_control/pet_element.cpp +++ b/engines/titanic/pet_control/pet_element.cpp @@ -33,14 +33,14 @@ void CPetElement::getBounds(Rect *rect) { *rect = Rect(); } -bool CPetElement::highlightBounds(const Point &pt) { +bool CPetElement::MouseButtonDownMsg(const Point &pt) { bool result = _bounds.contains(pt); if (result) setMode(MODE_SELECTED); return result; } -bool CPetElement::MouseButtonDownMsg(const Point &pt) { +bool CPetElement::MouseButtonUpMsg(const Point &pt) { bool result = _bounds.contains(pt); if (result) setMode(MODE_UNSELECTED); diff --git a/engines/titanic/pet_control/pet_element.h b/engines/titanic/pet_control/pet_element.h index effc575974..4e35ee9a24 100644 --- a/engines/titanic/pet_control/pet_element.h +++ b/engines/titanic/pet_control/pet_element.h @@ -70,14 +70,14 @@ public: virtual void getBounds(Rect *rect); /** - * Highlights the element if the cursor is on it + * Handles processing mouse button down messages */ - virtual bool highlightBounds(const Point &pt); + virtual bool MouseButtonDownMsg(const Point &pt); /** - * Handles processing mouse button messages + * Handles processing mouse button up messages */ - virtual bool MouseButtonDownMsg(const Point &pt); + virtual bool MouseButtonUpMsg(const Point &pt); /** * Returns whether the passed point falls inside the item diff --git a/engines/titanic/pet_control/pet_frame.cpp b/engines/titanic/pet_control/pet_frame.cpp index 827874fffc..ac4b3344c7 100644 --- a/engines/titanic/pet_control/pet_frame.cpp +++ b/engines/titanic/pet_control/pet_frame.cpp @@ -65,7 +65,7 @@ bool CPetFrame::reset() { bool CPetFrame::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { for (int idx = 0; idx < 5; ++idx) { - if (_modeButtons[idx].MouseButtonDownMsg(msg->_mousePos)) { + if (_modeButtons[idx].MouseButtonUpMsg(msg->_mousePos)) { _petControl->setArea(PET_AREAS[idx]); resetArea(); _modeButtons[idx].setMode(MODE_SELECTED); diff --git a/engines/titanic/pet_control/pet_load_save.cpp b/engines/titanic/pet_control/pet_load_save.cpp index 811fd12089..b8cb3dae46 100644 --- a/engines/titanic/pet_control/pet_load_save.cpp +++ b/engines/titanic/pet_control/pet_load_save.cpp @@ -72,7 +72,7 @@ void CPetLoadSave::draw2(CScreenManager *screenManager) { } bool CPetLoadSave::checkHighlight(const Point &pt) { - if (_btnLoadSave.highlightBounds(pt)) + if (_btnLoadSave.MouseButtonDownMsg(pt)) return true; checkSlotsHighlight(pt); @@ -80,7 +80,7 @@ bool CPetLoadSave::checkHighlight(const Point &pt) { } bool CPetLoadSave::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { - if (_btnLoadSave.MouseButtonDownMsg(msg->_mousePos)) { + if (_btnLoadSave.MouseButtonUpMsg(msg->_mousePos)) { execute(); resetSlots(); return true; diff --git a/engines/titanic/pet_control/pet_quit.cpp b/engines/titanic/pet_control/pet_quit.cpp index b92a362dd3..dff3ea3ca8 100644 --- a/engines/titanic/pet_control/pet_quit.cpp +++ b/engines/titanic/pet_control/pet_quit.cpp @@ -68,12 +68,12 @@ void CPetQuit::draw2(CScreenManager *screenManager) { } bool CPetQuit::checkHighlight(const Point &pt) { - return !_btnYes.highlightBounds(pt); + return !_btnYes.MouseButtonDownMsg(pt); } bool CPetQuit::MouseButtonUpMsg(const Point &pt) { CPetControl *pet = getPetControl(); - if (_btnYes.MouseButtonDownMsg(pt) && pet) { + if (_btnYes.MouseButtonUpMsg(pt) && pet) { CGameManager *gameManager = pet->getGameManager(); if (gameManager) gameManager->_gameState._quitGame = true; -- cgit v1.2.3 From b324d2ea6cd422bafd846642ed54620abe7e32ea Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 28 Apr 2016 18:33:01 -0400 Subject: TITANIC: FIx confusion between mouse down & up messages in CPetGlyph hierarchy --- engines/titanic/pet_control/pet_glyphs.cpp | 2 +- engines/titanic/pet_control/pet_glyphs.h | 9 ++++----- engines/titanic/pet_control/pet_load_save.cpp | 2 +- engines/titanic/pet_control/pet_load_save.h | 5 ++--- engines/titanic/pet_control/pet_quit.cpp | 2 +- engines/titanic/pet_control/pet_quit.h | 5 ++--- engines/titanic/pet_control/pet_rooms_glyphs.cpp | 2 +- engines/titanic/pet_control/pet_rooms_glyphs.h | 4 ++-- engines/titanic/pet_control/pet_sound.cpp | 2 +- engines/titanic/pet_control/pet_sound.h | 5 ++--- 10 files changed, 17 insertions(+), 21 deletions(-) diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index 8f8d8ba331..ed879f286b 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -323,7 +323,7 @@ bool CPetGlyphs::MouseButtonDownMsg(const Point &pt) { CPetGlyph *glyph = getGlyph(_highlightIndex); if (glyph) { - if (glyph->checkHighlight(pt)) + if (glyph->MouseButtonDownMsg(pt)) return true; if (!(_flags & GFLAG_2)) { diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index cefcd5cae9..792050166c 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -126,10 +126,9 @@ public: virtual Rect getBounds() { return Rect(); } /** - * Checks and updates any highlight of the glyph or any contextual - * information it displays + * Called for mouse button down messages */ - virtual bool checkHighlight(const Point &pt) { return false; } + virtual bool MouseButtonDownMsg(const Point &pt) { return false; } /** * Called when mouse drag starts @@ -174,9 +173,9 @@ public: virtual void proc27(const Point &pt, bool flag) {} /** - * Handles mouse button down messages + * */ - virtual void MouseButtonDownMsg(const Point &pt) {} + virtual void proc28(const Point &pt) {} virtual int proc29(const Point &pt) { return 0; } diff --git a/engines/titanic/pet_control/pet_load_save.cpp b/engines/titanic/pet_control/pet_load_save.cpp index b8cb3dae46..0ae9f3fe77 100644 --- a/engines/titanic/pet_control/pet_load_save.cpp +++ b/engines/titanic/pet_control/pet_load_save.cpp @@ -71,7 +71,7 @@ void CPetLoadSave::draw2(CScreenManager *screenManager) { _btnLoadSave.draw(screenManager); } -bool CPetLoadSave::checkHighlight(const Point &pt) { +bool CPetLoadSave::MouseButtonDownMsg(const Point &pt) { if (_btnLoadSave.MouseButtonDownMsg(pt)) return true; diff --git a/engines/titanic/pet_control/pet_load_save.h b/engines/titanic/pet_control/pet_load_save.h index ef7e54a3f2..8f8634dfdf 100644 --- a/engines/titanic/pet_control/pet_load_save.h +++ b/engines/titanic/pet_control/pet_load_save.h @@ -83,10 +83,9 @@ public: virtual void draw2(CScreenManager *screenManager); /** - * Checks and updates any highlight of the glyph or any contextual - * information it displays + * Called for mouse button down messages */ - virtual bool checkHighlight(const Point &pt); + virtual bool MouseButtonDownMsg(const Point &pt); /** * Handles mouse button messages diff --git a/engines/titanic/pet_control/pet_quit.cpp b/engines/titanic/pet_control/pet_quit.cpp index dff3ea3ca8..6959160afa 100644 --- a/engines/titanic/pet_control/pet_quit.cpp +++ b/engines/titanic/pet_control/pet_quit.cpp @@ -67,7 +67,7 @@ void CPetQuit::draw2(CScreenManager *screenManager) { _btnYes.draw(screenManager); } -bool CPetQuit::checkHighlight(const Point &pt) { +bool CPetQuit::MouseButtonDownMsg(const Point &pt) { return !_btnYes.MouseButtonDownMsg(pt); } diff --git a/engines/titanic/pet_control/pet_quit.h b/engines/titanic/pet_control/pet_quit.h index 72b93c152f..7d22690ff8 100644 --- a/engines/titanic/pet_control/pet_quit.h +++ b/engines/titanic/pet_control/pet_quit.h @@ -50,10 +50,9 @@ public: virtual void draw2(CScreenManager *screenManager); /** - * Checks and updates any highlight of the glyph or any contextual - * information it displays + * Called for mouse button down messages */ - virtual bool checkHighlight(const Point &pt); + virtual bool MouseButtonDownMsg(const Point &pt); /** * Handles mouse button up messages diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.cpp b/engines/titanic/pet_control/pet_rooms_glyphs.cpp index d127c412f9..c45e0389ce 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.cpp +++ b/engines/titanic/pet_control/pet_rooms_glyphs.cpp @@ -64,7 +64,7 @@ void CPetRoomsGlyph::drawAt(CScreenManager *screenManager, const Point &pt) { warning("TODO: CPetRoomsGlyph::drawAt"); } -void CPetRoomsGlyph::MouseButtonDownMsg(const Point &pt) { +void CPetRoomsGlyph::proc28(const Point &pt) { } diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.h b/engines/titanic/pet_control/pet_rooms_glyphs.h index 2832438fc9..d08be131c8 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.h +++ b/engines/titanic/pet_control/pet_rooms_glyphs.h @@ -63,9 +63,9 @@ public: virtual void draw2(CScreenManager *screenManager) {} /** - * Handles mouse button down messages + * */ - virtual void MouseButtonDownMsg(const Point &pt); + virtual void proc28(const Point &pt); virtual int proc29(const Point &pt); virtual void proc32(); diff --git a/engines/titanic/pet_control/pet_sound.cpp b/engines/titanic/pet_control/pet_sound.cpp index 9fb3a07322..4d2bf37831 100644 --- a/engines/titanic/pet_control/pet_sound.cpp +++ b/engines/titanic/pet_control/pet_sound.cpp @@ -123,7 +123,7 @@ void CPetSound::draw2(CScreenManager *screenManager) { _textSpeechVolume.draw(screenManager); } -bool CPetSound::checkHighlight(const Point &pt) { +bool CPetSound::MouseButtonDownMsg(const Point &pt) { if (_musicVolume.checkThumb(pt) || _masterVolume.checkThumb(pt) || _speechVolume.checkThumb(pt)) return true; diff --git a/engines/titanic/pet_control/pet_sound.h b/engines/titanic/pet_control/pet_sound.h index 267bd03309..c4b663ad44 100644 --- a/engines/titanic/pet_control/pet_sound.h +++ b/engines/titanic/pet_control/pet_sound.h @@ -69,10 +69,9 @@ public: virtual void draw2(CScreenManager *screenManager); /** - * Checks and updates any highlight of the glyph or any contextual - * information it displays + * Called for mouse button down messages */ - virtual bool checkHighlight(const Point &pt); + virtual bool MouseButtonDownMsg(const Point &pt); /** * Called when mouse drag starts -- cgit v1.2.3 From b7ad513b0f0c99bc670546dbb3483e93d59652ee Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 28 Apr 2016 19:10:18 -0400 Subject: TITANIC: Implement PET Text scrolling --- engines/titanic/pet_control/pet_conversations.cpp | 29 ++++++++++++++++--- engines/titanic/pet_control/pet_conversations.h | 20 +++++++++++-- engines/titanic/pet_control/pet_text.cpp | 35 +++++++++++++++++++++-- engines/titanic/pet_control/pet_text.h | 22 +++++++++++++- 4 files changed, 96 insertions(+), 10 deletions(-) diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index 3afd5ee380..d2c891efb8 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -21,6 +21,7 @@ */ #include "titanic/pet_control/pet_conversations.h" +#include "titanic/pet_control/pet_control.h" namespace Titanic { @@ -44,6 +45,14 @@ bool CPetConversations::isValid(CPetControl *petControl) { return setupControl(petControl); } +bool CPetConversations::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + return + _scrollUp.MouseButtonDownMsg(msg->_mousePos) || + _scrollDown.MouseButtonDownMsg(msg->_mousePos) || + _val7.MouseButtonDownMsg(msg->_mousePos) || + _val8.MouseButtonDownMsg(msg->_mousePos); +} + bool CPetConversations::setupControl(CPetControl *petControl) { if (petControl) { _petControl = petControl; @@ -60,10 +69,10 @@ bool CPetConversations::setupControl(CPetControl *petControl) { _gfxList[2].translate(20, 434); const Rect rect2(0, 0, 11, 24); - _val1.setBounds(rect2); - _val1.translate(87, 374); - _val2.setBounds(rect2); - _val2.translate(87, 421); + _scrollUp.setBounds(rect2); + _scrollUp.translate(87, 374); + _scrollDown.setBounds(rect2); + _scrollDown.translate(87, 421); const Rect rect3(0, 0, 39, 39); _val7.setBounds(rect3); @@ -86,4 +95,16 @@ bool CPetConversations::setupControl(CPetControl *petControl) { return true; } +void CPetConversations::scrollDown() { + _log.scrollDown(CScreenManager::_screenManagerPtr); + if (_petControl) + _petControl->makeDirty(); +} + +void CPetConversations::scrollUp() { + _log.scrollUp(CScreenManager::_screenManagerPtr); + if (_petControl) + _petControl->makeDirty(); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index 89dbc5eb96..8a3ca886a5 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -31,8 +31,8 @@ namespace Titanic { class CPetConversations : public CPetSection { private: - CPetGfxElement _val1; - CPetGfxElement _val2; + CPetGfxElement _scrollUp; + CPetGfxElement _scrollDown; CPetGfxElement _val3; CPetGfxElement _gfxList[3]; CPetGfxElement _val4; @@ -55,6 +55,16 @@ private: * Sets up the control */ bool setupControl(CPetControl *petControl); + + /** + * Scroll down the conversation log + */ + void scrollDown(); + + /** + * Scroll up the conversation log + */ + void scrollUp(); public: CPetConversations(); @@ -72,6 +82,12 @@ public: * Returns true if the object is in a valid state */ virtual bool isValid(CPetControl *petControl); + + /** + * Following are handlers for the various messages that the PET can + * pass onto the currently active section/area + */ + virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index 3a10ab4c87..9a895de36b 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -30,7 +30,7 @@ CPetText::CPetText(uint count) : _backR(0xff), _backG(0xff), _backB(0xff), _textR(0), _textG(0), _textB(200), _fontNumber2(0), _field64(0), _field68(0), _field6C(0), - _hasBorder(true), _field74(0), _textCursor(nullptr), _field7C(0) { + _hasBorder(true), _scrollTop(0), _textCursor(nullptr), _field7C(0) { setupArrays(count); } @@ -97,7 +97,7 @@ void CPetText::load(SimpleFile *file, int param) { _textG = file->readNumber(); _textB = file->readNumber(); _hasBorder = file->readNumber() != 0; - _field74 = file->readNumber(); + _scrollTop = file->readNumber(); warning("TODO: CPetText::load %d,%d", var1, var2); assert(_array.size() >= count); @@ -140,7 +140,7 @@ void CPetText::draw(CScreenManager *screenManager) { tempRect.grow(-2); screenManager->setFontNumber(_fontNumber2); - screenManager->writeString(SURFACE_BACKBUFFER, tempRect, _field74, _lines, _textCursor); + screenManager->writeString(SURFACE_BACKBUFFER, tempRect, _scrollTop, _lines, _textCursor); screenManager->setFontNumber(_fontNumber1); } @@ -250,4 +250,33 @@ void CPetText::setNPC(int val1, int npcId) { _field68 = npcId; } +void CPetText::scrollUp(CScreenManager *screenManager) { + int oldFontNumber = screenManager->setFontNumber(_fontNumber2); + _scrollTop -= screenManager->getFontHeight(); + constrainScrollUp(screenManager); + screenManager->setFontNumber(oldFontNumber); +} + +void CPetText::scrollDown(CScreenManager *screenManager) { + int oldFontNumber = screenManager->setFontNumber(_fontNumber2); + _scrollTop += screenManager->getFontHeight(); + constrainScrollDown(screenManager); + screenManager->setFontNumber(oldFontNumber); +} + +void CPetText::constrainScrollUp(CScreenManager *screenManager) { + if (_scrollTop < 0) + _scrollTop = 0; +} + +void CPetText::constrainScrollDown(CScreenManager *screenManager) { + // Figure out the maximum scroll amount allowed + int maxScroll = _bounds.height() - getTextHeight(screenManager) - 4; + if (maxScroll < 0) + maxScroll = 0; + + if (_scrollTop > maxScroll) + _scrollTop = maxScroll; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h index 6ce1903166..36d098f141 100644 --- a/engines/titanic/pet_control/pet_text.h +++ b/engines/titanic/pet_control/pet_text.h @@ -57,7 +57,7 @@ private: int _field68; int _field6C; bool _hasBorder; - int _field74; + int _scrollTop; CTextCursor *_textCursor; int _field7C; private: @@ -81,6 +81,16 @@ private: * Get the required height to draw the text */ int getTextHeight(CScreenManager *screenManager); + + /** + * Ensures the Y scrolling for the text is in the valid range + */ + void constrainScrollUp(CScreenManager *screenManager); + + /** + * Ensures the Y scrolling for the text is in the valid range + */ + void constrainScrollDown(CScreenManager *screenManager); public: CPetText(uint count = 10); @@ -157,6 +167,16 @@ public: * Get the font */ int getFontNumber() const { return _fontNumber1; } + + /** + * Scroll the text up + */ + void scrollUp(CScreenManager *screenManager); + + /** + * Scroll the text down + */ + void scrollDown(CScreenManager *screenManager); }; } // End of namespace Titanic -- cgit v1.2.3 From de7329619612514e8fd3e9ba1f3e6d7389fd199d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 28 Apr 2016 19:43:55 -0400 Subject: TITANIC: Implement PET Text scrollToBottom, beginnings of addLine --- engines/titanic/pet_control/pet_conversations.cpp | 61 ++++++++++++++++++++--- engines/titanic/pet_control/pet_conversations.h | 26 ++++++++-- engines/titanic/pet_control/pet_text.cpp | 17 +++++++ engines/titanic/pet_control/pet_text.h | 15 ++++++ 4 files changed, 107 insertions(+), 12 deletions(-) diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index d2c891efb8..c884d181d3 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -49,8 +49,35 @@ bool CPetConversations::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { return _scrollUp.MouseButtonDownMsg(msg->_mousePos) || _scrollDown.MouseButtonDownMsg(msg->_mousePos) || - _val7.MouseButtonDownMsg(msg->_mousePos) || - _val8.MouseButtonDownMsg(msg->_mousePos); + _doorBot.MouseButtonDownMsg(msg->_mousePos) || + _bellBot.MouseButtonDownMsg(msg->_mousePos); +} + +bool CPetConversations::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + if (_scrollUp.MouseButtonUpMsg(msg->_mousePos) || + _scrollDown.MouseButtonUpMsg(msg->_mousePos)) + return true; + + if (_doorBot.MouseButtonUpMsg(msg->_mousePos)) { + switch (canSummonNPC("DoorBot")) { + case SUMMON_CANT: + break; + case SUMMON_CAN: + summonNPC("DoorBot"); + return true; + default: + break; + } + + // Scroll to the bottom of the log + scrollToBottom(); + } + + if (_bellBot.MouseButtonUpMsg(msg->_mousePos)) { + // TODO + } + + return false; } bool CPetConversations::setupControl(CPetControl *petControl) { @@ -75,10 +102,10 @@ bool CPetConversations::setupControl(CPetControl *petControl) { _scrollDown.translate(87, 421); const Rect rect3(0, 0, 39, 39); - _val7.setBounds(rect3); - _val7.translate(546, 372); - _val8.setBounds(rect3); - _val8.translate(546, 418); + _doorBot.setBounds(rect3); + _doorBot.translate(546, 372); + _bellBot.setBounds(rect3); + _bellBot.translate(546, 418); _val6.setBounds(Rect(0, 0, 37, 70)); _val6.translate(46, 374); @@ -95,16 +122,34 @@ bool CPetConversations::setupControl(CPetControl *petControl) { return true; } +void CPetConversations::scrollUp() { + _log.scrollUp(CScreenManager::_screenManagerPtr); + if (_petControl) + _petControl->makeDirty(); + _field414 = true; +} + void CPetConversations::scrollDown() { _log.scrollDown(CScreenManager::_screenManagerPtr); if (_petControl) _petControl->makeDirty(); + _field414 = true; } -void CPetConversations::scrollUp() { - _log.scrollUp(CScreenManager::_screenManagerPtr); +void CPetConversations::scrollToBottom() { + _log.scrollToBottom(CScreenManager::_screenManagerPtr); if (_petControl) _petControl->makeDirty(); + _field414 = true; +} + +SummonResult CPetConversations::canSummonNPC(const CString &name) { + warning("TODO: canSummonNPC"); + return SUMMON_ABORT; +} + +void CPetConversations::summonNPC(const CString &name) { + warning("TODO: summonNPC"); } } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index 8a3ca886a5..d04e9834d1 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -29,6 +29,8 @@ namespace Titanic { +enum SummonResult { SUMMON_CANT = 0, SUMMON_CAN = 1, SUMMON_ABORT = 2 }; + class CPetConversations : public CPetSection { private: CPetGfxElement _scrollUp; @@ -39,8 +41,8 @@ private: CPetGfxElement _val5; CPetGfxElement _val6; int _field14C; - CPetGfxElement _val7; - CPetGfxElement _val8; + CPetGfxElement _doorBot; + CPetGfxElement _bellBot; CPetGfxElement _val9; CPetGfxElement _valArray2[9]; int _field30C; @@ -56,15 +58,30 @@ private: */ bool setupControl(CPetControl *petControl); + /** + * Scroll up the conversation log + */ + void scrollUp(); + /** * Scroll down the conversation log */ void scrollDown(); /** - * Scroll up the conversation log + * Scroll to the bottom of the conversation log */ - void scrollUp(); + void scrollToBottom(); + + /** + * Check whether an NPC can be summoned + */ + SummonResult canSummonNPC(const CString &name); + + /** + * Summon an NPC + */ + void summonNPC(const CString &name); public: CPetConversations(); @@ -88,6 +105,7 @@ public: * pass onto the currently active section/area */ virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index 9a895de36b..67910dc18c 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -264,6 +264,13 @@ void CPetText::scrollDown(CScreenManager *screenManager) { screenManager->setFontNumber(oldFontNumber); } +void CPetText::scrollToBottom(CScreenManager *screenManager) { + int oldFontNumber = screenManager->setFontNumber(_fontNumber2); + _scrollTop = _bounds.height(); + constrainScrollDown(screenManager); + screenManager->setFontNumber(oldFontNumber); +} + void CPetText::constrainScrollUp(CScreenManager *screenManager) { if (_scrollTop < 0) _scrollTop = 0; @@ -279,4 +286,14 @@ void CPetText::constrainScrollDown(CScreenManager *screenManager) { _scrollTop = maxScroll; } +void CPetText::addLine(const CString &str, uint color) { + addLine(str, color & 0xff, (color >> 8) & 0xff, + (color >> 16) & 0xff); +} + +void CPetText::addLine(const CString &str, byte r, byte g, byte b) { + warning("TODO: CPetText::addLine"); +} + + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h index 36d098f141..6000dd6d0b 100644 --- a/engines/titanic/pet_control/pet_text.h +++ b/engines/titanic/pet_control/pet_text.h @@ -177,6 +177,21 @@ public: * Scroll the text down */ void scrollDown(CScreenManager *screenManager); + + /** + * Scroll to the bottom of the text + */ + void scrollToBottom(CScreenManager *screenManager); + + /** + * Add a line to the text + */ + void addLine(const CString &str, uint color); + + /** + * Add a line to the text + */ + void addLine(const CString &str, byte r, byte g, byte b); }; } // End of namespace Titanic -- cgit v1.2.3 From ff72fc594bae10cd4ac5083d0cf2ca6c412d0f9f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 28 Apr 2016 20:30:13 -0400 Subject: TITANIC: Implement PET Conversations mouse up, and text addLine --- engines/titanic/pet_control/pet_conversations.cpp | 17 ++++++++++++++++- engines/titanic/pet_control/pet_text.cpp | 16 ++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index c884d181d3..d5f4da41c6 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -61,6 +61,7 @@ bool CPetConversations::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { if (_doorBot.MouseButtonUpMsg(msg->_mousePos)) { switch (canSummonNPC("DoorBot")) { case SUMMON_CANT: + _log.addLine("Sadly, it is not possible to summon the DoorBot from this location.", getColor(1)); break; case SUMMON_CAN: summonNPC("DoorBot"); @@ -71,10 +72,24 @@ bool CPetConversations::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { // Scroll to the bottom of the log scrollToBottom(); + return true; } if (_bellBot.MouseButtonUpMsg(msg->_mousePos)) { - // TODO + switch (canSummonNPC("BellBot")) { + case SUMMON_CANT: + _log.addLine("Sadly, it is not possible to summon the BellBot from this location.", getColor(1)); + break; + case SUMMON_CAN: + summonNPC("BellBot"); + return true; + default: + break; + } + + // Scroll to the bottom of the log + scrollToBottom(); + return true; } return false; diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index 67910dc18c..c31d4fd851 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -292,8 +292,20 @@ void CPetText::addLine(const CString &str, uint color) { } void CPetText::addLine(const CString &str, byte r, byte g, byte b) { - warning("TODO: CPetText::addLine"); -} + if (_lineCount == ((int)_array.size() - 1)) { + // Lines array is full + if (_array.size() > 1) { + // Delete the oldest line, and add a new entry at the end + _array.remove_at(0); + _array.resize(_array.size() + 1); + } + + --_lineCount; + } + setLineColor(_lineCount, r, g, b); + changeText(str); + ++_lineCount; +} } // End of namespace Titanic -- cgit v1.2.3 From 4fd482e41813f32359eb91a2b62867605af0382c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 28 Apr 2016 21:07:41 -0400 Subject: TITANIC: Implement checks for whether NPCs can be summoned --- engines/titanic/core/saveable_object.cpp | 4 +-- engines/titanic/messages/messages.h | 2 +- engines/titanic/pet_control/pet_control.cpp | 40 +++++++++++++++++++++++ engines/titanic/pet_control/pet_control.h | 12 +++++++ engines/titanic/pet_control/pet_conversations.cpp | 5 ++- engines/titanic/pet_control/pet_conversations.h | 4 +-- 6 files changed, 58 insertions(+), 9 deletions(-) diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 4a57959b57..00a48ea435 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -917,7 +917,7 @@ DEFFN(CSUBTransition) DEFFN(CSubTurnOffMsg) DEFFN(CSubTurnOnMsg) DEFFN(CSummonBotMsg) -DEFFN(CSummonBotQuerryMsg) +DEFFN(CSummonBotQueryMsg) DEFFN(CTakeHeadPieceMsg) DEFFN(CTextInputMsg) DEFFN(CTimeDilationMsg) @@ -1503,7 +1503,7 @@ void CSaveableObject::initClassList() { ADDFN(CSubTurnOffMsg, CMessage); ADDFN(CSubTurnOnMsg, CMessage); ADDFN(CSummonBotMsg, CMessage); - ADDFN(CSummonBotQuerryMsg, CMessage); + ADDFN(CSummonBotQueryMsg, CMessage); ADDFN(CTakeHeadPieceMsg, CMessage); ADDFN(CTextInputMsg, CMessage); ADDFN(CTimeDilationMsg, CMessage); diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index ae66af1780..3af65c29da 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -343,7 +343,7 @@ MESSAGE0(CSUBTransition); MESSAGE0(CSubTurnOffMsg); MESSAGE0(CSubTurnOnMsg); MESSAGE2(CSummonBotMsg, CString, strValue, "", int, numValue, 0); -MESSAGE1(CSummonBotQuerryMsg, CString, value, ""); +MESSAGE1(CSummonBotQueryMsg, CString, npcName, ""); MESSAGE1(CTakeHeadPieceMsg, CString, value, "NULL"); MESSAGE2(CTextInputMsg, CString, value1, "", CString, value2, ""); MESSAGE1(CTimeDilationMsg, int, value, 0); diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 98887f60d2..e9a8e79b8b 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -23,6 +23,7 @@ #include "titanic/pet_control/pet_control.h" #include "titanic/carry/carry.h" #include "titanic/core/project_item.h" +#include "titanic/messages/messages.h" #include "titanic/messages/pet_messages.h" #include "titanic/game_manager.h" #include "titanic/game_state.h" @@ -436,4 +437,43 @@ CString CPetControl::getRoomName() const { return room ? room->getName() : CString(); } +int CPetControl::canSummonNPC(const CString &name) { + // If player is the very same view as the NPC, then it's already present + if (isNPCInView(name)) + return SUMMON_CAN; + + // Get the room + CGameManager *gameManager = getGameManager(); + if (!gameManager) + return SUMMON_CANT; + CRoomItem *room = gameManager->getRoom(); + if (!room) + return SUMMON_CANT; + + // Query current room to see whether the bot can be summoned to it + CSummonBotQueryMsg queryMsg(name); + return queryMsg.execute(room) ? SUMMON_CAN : SUMMON_CANT; +} + +bool CPetControl::isNPCInView(const CString &name) const { + CGameManager *gameManager = getGameManager(); + if (!gameManager) + return false; + CViewItem *view = gameManager->getView(); + if (!view) + return false; + + // Iterate to find NPC + for (CTreeItem *child = view->getFirstChild(); child; child = child->scan(view)) { + CGameObject *gameObject = static_cast(child); + if (gameObject) { + if (!gameObject->getName().compareToIgnoreCase(name)) + return true; + } + } + + return false; +} + + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 78cfb61864..4cde477704 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -39,6 +39,8 @@ namespace Titanic { +enum SummonResult { SUMMON_CANT = 0, SUMMON_PRESENT = 1, SUMMON_CAN = 2 }; + class CPetControl : public CGameObject { DECLARE_MESSAGE_MAP private: @@ -88,6 +90,11 @@ private: bool containsPt(const Common::Point &pt) const; bool getC0() const; + + /** + * Checks whether a designated NPC in present in the current view + */ + bool isNPCInView(const CString &name) const; protected: bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); bool MouseDragStartMsg(CMouseDragStartMsg *msg); @@ -250,6 +257,11 @@ public: * Get the room name */ CString getRoomName() const; + + /** + * Check whether an NPC can be summoned + */ + int canSummonNPC(const CString &name); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index d5f4da41c6..1012403727 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -158,9 +158,8 @@ void CPetConversations::scrollToBottom() { _field414 = true; } -SummonResult CPetConversations::canSummonNPC(const CString &name) { - warning("TODO: canSummonNPC"); - return SUMMON_ABORT; +int CPetConversations::canSummonNPC(const CString &name) { + return _petControl ? _petControl->canSummonNPC(name) : SUMMON_CANT; } void CPetConversations::summonNPC(const CString &name) { diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index d04e9834d1..3f396c828a 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -29,8 +29,6 @@ namespace Titanic { -enum SummonResult { SUMMON_CANT = 0, SUMMON_CAN = 1, SUMMON_ABORT = 2 }; - class CPetConversations : public CPetSection { private: CPetGfxElement _scrollUp; @@ -76,7 +74,7 @@ private: /** * Check whether an NPC can be summoned */ - SummonResult canSummonNPC(const CString &name); + int canSummonNPC(const CString &name); /** * Summon an NPC -- cgit v1.2.3 From 23f5691b97cb53fd45ef411f051b7f10f0523a24 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 28 Apr 2016 21:34:22 -0400 Subject: TITANIC: Implement summoning NPCs --- engines/titanic/core/tree_item.cpp | 4 ++-- engines/titanic/core/tree_item.h | 6 +++++- engines/titanic/game/television.cpp | 2 +- engines/titanic/game_state.cpp | 10 +++++----- engines/titanic/game_state.h | 2 +- engines/titanic/pet_control/pet_control.cpp | 11 +++++++++++ engines/titanic/pet_control/pet_control.h | 5 +++++ engines/titanic/pet_control/pet_conversations.cpp | 8 +++++++- engines/titanic/pet_control/pet_gfx_element.cpp | 8 ++++---- engines/titanic/pet_control/pet_section.cpp | 2 +- engines/titanic/pet_control/pet_slider.cpp | 7 +++---- 11 files changed, 45 insertions(+), 20 deletions(-) diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index 039d597ece..8dd3da054d 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -314,9 +314,9 @@ CMusicRoom *CTreeItem::getMusicRoom() const { return gameManager ? &gameManager->_musicRoom : nullptr; } -int CTreeItem::getState8() const { +int CTreeItem::getPassengerClass() const { CGameManager *gameManager = getGameManager(); - return gameManager ? gameManager->_gameState._field8 : 3; + return gameManager ? gameManager->_gameState._passengerClass : 3; } int CTreeItem::getStateC() const { diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index 151addee2e..1dcaee552d 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -279,7 +279,11 @@ public: */ CMusicRoom *getMusicRoom() const; - int getState8() const; + /** + * Return the player's passenger class + */ + int getPassengerClass() const; + int getStateC() const; }; diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp index 6e1f5ca54c..888400960d 100644 --- a/engines/titanic/game/television.cpp +++ b/engines/titanic/game/television.cpp @@ -234,7 +234,7 @@ bool CTelevision::MovieEndMsg(CMovieEndMsg *msg) { parrotMsg.execute("PerchedParrot"); } - if (_fieldE0 == 3 && compareRoomNameTo("SGTState") && !getState8()) { + if (_fieldE0 == 3 && compareRoomNameTo("SGTState") && !getPassengerClass()) { playSound("z#47.wav", 100, 0, 0); _fieldF0 = playSound("b#20.wav", 100, 0, 0); CTreeItem *magazine = getRoot()->findByName("Magazine"); diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index 7c59aaf5c1..2c751c0aa1 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -45,14 +45,14 @@ bool CGameStateMovieList::clear() { CGameState::CGameState(CGameManager *gameManager) : _gameManager(gameManager), _gameLocation(this), - _field8(0), _fieldC(0), _mode(GSMODE_UNSELECTED), _field14(0), _petActive(false), - _field1C(0), _quitGame(false), _field24(0), _nodeChangeCtr(0), - _nodeEnterTicks(0), _field38(0) { + _passengerClass(0), _fieldC(0), _mode(GSMODE_UNSELECTED), + _field14(0), _petActive(false), _field1C(0), _quitGame(false), + _field24(0), _nodeChangeCtr(0), _nodeEnterTicks(0), _field38(0) { } void CGameState::save(SimpleFile *file) const { file->writeNumber(_petActive); - file->writeNumber(_field8); + file->writeNumber(_passengerClass); file->writeNumber(_fieldC); file->writeNumber(_field14); file->writeNumber(_field24); @@ -63,7 +63,7 @@ void CGameState::save(SimpleFile *file) const { void CGameState::load(SimpleFile *file) { _petActive = file->readNumber() != 0; - _field8 = file->readNumber(); + _passengerClass = file->readNumber(); _fieldC = file->readNumber(); _field14 = file->readNumber(); _field24 = file->readNumber(); diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h index 1176b2f6f2..ff39dc6752 100644 --- a/engines/titanic/game_state.h +++ b/engines/titanic/game_state.h @@ -54,7 +54,7 @@ public: CGameManager *_gameManager; CGameLocation _gameLocation; CGameStateMovieList _movieList; - int _field8; + int _passengerClass; int _fieldC; GameStateMode _mode; int _field14; diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index e9a8e79b8b..89ea9e956a 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -475,5 +475,16 @@ bool CPetControl::isNPCInView(const CString &name) const { return false; } +void CPetControl::summonNPC(const CString &name, int val) { + CGameManager *gameManager = getGameManager(); + if (gameManager) { + CRoomItem *room = gameManager->getRoom(); + + if (room) { + CSummonBotMsg summonMsg(name, val); + summonMsg.execute(room); + } + } +} } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 4cde477704..bd896575ce 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -262,6 +262,11 @@ public: * Check whether an NPC can be summoned */ int canSummonNPC(const CString &name); + + /** + * Summon an NPC to the player + */ + void summonNPC(const CString &name, int val); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index 1012403727..3872d840fd 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -163,7 +163,13 @@ int CPetConversations::canSummonNPC(const CString &name) { } void CPetConversations::summonNPC(const CString &name) { - warning("TODO: summonNPC"); + if (_petControl) { + if (_petControl->getPassengerClass() >= 4) { + _petControl->displayMessage("Sorry, you must be at least 3rd class before you can summon for help."); + } else { + _petControl->summonNPC(name, 0); + } + } } } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_gfx_element.cpp b/engines/titanic/pet_control/pet_gfx_element.cpp index fbe9e6db53..491930f46f 100644 --- a/engines/titanic/pet_control/pet_gfx_element.cpp +++ b/engines/titanic/pet_control/pet_gfx_element.cpp @@ -49,11 +49,11 @@ void CPetGfxElement::reset(const CString &name, CPetControl *petControl, PetElem return; CString numString(3); - int state8 = petControl->getState8(); + int classNum = petControl->getPassengerClass(); - if (state8 >= 1 && state8 <= 3) { - numString = CString(state8); - } else if (state8 == 4) { + if (classNum >= 1 && classNum <= 3) { + numString = CString(classNum); + } else if (classNum == 4) { int stateC = petControl->getStateC(); if (stateC == 1) numString = CString(stateC); diff --git a/engines/titanic/pet_control/pet_section.cpp b/engines/titanic/pet_control/pet_section.cpp index a41118bf76..afdbc9fdd8 100644 --- a/engines/titanic/pet_control/pet_section.cpp +++ b/engines/titanic/pet_control/pet_section.cpp @@ -69,7 +69,7 @@ uint CPetSection::getColor(uint index) { const uint *CPetSection::getColorTable(int tableNum) { if (tableNum == -1) { CPetControl *pet = getPetControl(); - tableNum = pet ? pet->getState8() : 3; + tableNum = pet ? pet->getPassengerClass() : 3; } switch (tableNum) { diff --git a/engines/titanic/pet_control/pet_slider.cpp b/engines/titanic/pet_control/pet_slider.cpp index e8f31a70d2..82b02af3fb 100644 --- a/engines/titanic/pet_control/pet_slider.cpp +++ b/engines/titanic/pet_control/pet_slider.cpp @@ -198,7 +198,7 @@ void CPetSoundSlider::setupThumb(const CString &name, CPetControl *petControl) { void CPetSoundSlider::setupBackground2(const CString &name, CPetControl *petControl) { if (petControl) { CString numStr = "3"; - int mode = petControl->getState8(); + int mode = petControl->getPassengerClass(); if (mode <= 3) { numStr = CString(mode); } else if (mode == 4) { @@ -216,11 +216,10 @@ void CPetSoundSlider::setupBackground2(const CString &name, CPetControl *petCont void CPetSoundSlider::setupThumb2(const CString &name, CPetControl *petControl) { if (petControl) { CString numStr = "3"; - int mode = petControl->getState8(); + int mode = petControl->getPassengerClass(); if (mode <= 3) { numStr = CString(mode); - } - else if (mode == 4) { + } else if (mode == 4) { mode = petControl->getStateC(); if (mode == 1) { numStr = CString(mode); -- cgit v1.2.3 From 487f2cef0f0be9bae3b815623b4dceb02e466ce0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 28 Apr 2016 22:12:16 -0400 Subject: TITANIC: Handle Conversations double click, PET Text key handling --- engines/titanic/pet_control/pet_conversations.cpp | 5 +++++ engines/titanic/pet_control/pet_conversations.h | 1 + engines/titanic/pet_control/pet_element.cpp | 2 +- engines/titanic/pet_control/pet_element.h | 4 ++-- engines/titanic/pet_control/pet_text.cpp | 25 ++++++++++++++++++++--- engines/titanic/pet_control/pet_text.h | 12 +++++++++-- 6 files changed, 41 insertions(+), 8 deletions(-) diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index 3872d840fd..850fec1668 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -95,6 +95,11 @@ bool CPetConversations::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { return false; } +bool CPetConversations::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { + return _scrollDown.MouseDoubleClickMsg(msg->_mousePos) + || _scrollUp.MouseDoubleClickMsg(msg->_mousePos); +} + bool CPetConversations::setupControl(CPetControl *petControl) { if (petControl) { _petControl = petControl; diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index 3f396c828a..9b312729fa 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -104,6 +104,7 @@ public: */ virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); + virtual bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_element.cpp b/engines/titanic/pet_control/pet_element.cpp index 616877e15e..bc1b8de44d 100644 --- a/engines/titanic/pet_control/pet_element.cpp +++ b/engines/titanic/pet_control/pet_element.cpp @@ -47,7 +47,7 @@ bool CPetElement::MouseButtonUpMsg(const Point &pt) { return result; } -bool CPetElement::contains1(const Point &pt) const { +bool CPetElement::MouseDoubleClickMsg(const Point &pt) const { return _bounds.contains(pt); } diff --git a/engines/titanic/pet_control/pet_element.h b/engines/titanic/pet_control/pet_element.h index 4e35ee9a24..38f5f539f2 100644 --- a/engines/titanic/pet_control/pet_element.h +++ b/engines/titanic/pet_control/pet_element.h @@ -80,9 +80,9 @@ public: virtual bool MouseButtonUpMsg(const Point &pt); /** - * Returns whether the passed point falls inside the item + * Handles processing mouse button double click messages */ - virtual bool contains1(const Point &pt) const; + virtual bool MouseDoubleClickMsg(const Point &pt) const; virtual int proc9(const Point &pt); diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index c31d4fd851..2ea10994e6 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -176,10 +176,10 @@ CString CPetText::getText() const { void CPetText::setText(const CString &str) { setup(); - changeText(str); + appendText(str); } -void CPetText::changeText(const CString &str) { +void CPetText::appendText(const CString &str) { int lineSize = _array[_lineCount]._line.size(); int strSize = str.size(); @@ -304,8 +304,27 @@ void CPetText::addLine(const CString &str, byte r, byte g, byte b) { } setLineColor(_lineCount, r, g, b); - changeText(str); + appendText(str); ++_lineCount; } +bool CPetText::handleKey(const Common::KeyState &keyState) { + switch (keyState.keycode) { + case Common::KEYCODE_BACKSPACE: + deleteLastChar(); + break; + + case Common::KEYCODE_RETURN: + case Common::KEYCODE_KP_ENTER: + return true; + + default: + if (keyState.ascii >= 32 && keyState.ascii <= 127) + appendText(CString(keyState.ascii, 1)); + break; + } + + return false; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h index 6000dd6d0b..4bb699d58e 100644 --- a/engines/titanic/pet_control/pet_text.h +++ b/engines/titanic/pet_control/pet_text.h @@ -23,6 +23,7 @@ #ifndef TITANIC_PET_TEXT_H #define TITANIC_PET_TEXT_H +#include "common/keyboard.h" #include "titanic/support/simple_file.h" #include "titanic/support/screen_manager.h" #include "titanic/support/text_cursor.h" @@ -71,9 +72,9 @@ private: void mergeStrings(); /** - * Change the text + * Append text to the current text line */ - void changeText(const CString &str); + void appendText(const CString &str); void updateStr3(int lineNum); @@ -192,6 +193,13 @@ public: * Add a line to the text */ void addLine(const CString &str, byte r, byte g, byte b); + + /** + * Handles character processing to add or remove characters to + * the current text line + * @returns True if the Enter key was pressed + */ + bool handleKey(const Common::KeyState &keyState); }; } // End of namespace Titanic -- cgit v1.2.3 From b117bae55a52efdfd0e7593e4e3038d22101d8bc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 29 Apr 2016 07:54:54 -0400 Subject: TITANIC: Implemented conversations text input entry --- engines/titanic/pet_control/pet_control.cpp | 10 +-- engines/titanic/pet_control/pet_control.h | 4 +- engines/titanic/pet_control/pet_conversations.cpp | 99 +++++++++++++++++++++-- engines/titanic/pet_control/pet_conversations.h | 31 ++++++- engines/titanic/pet_control/pet_text.cpp | 47 +++++++++-- engines/titanic/pet_control/pet_text.h | 22 ++++- 6 files changed, 191 insertions(+), 22 deletions(-) diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 89ea9e956a..997d35b681 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -44,7 +44,7 @@ END_MESSAGE_MAP() CPetControl::CPetControl() : CGameObject(), _currentArea(PET_CONVERSATION), _fieldC0(0), _locked(0), _fieldC8(0), - _treeItem1(nullptr), _treeItem2(nullptr), _hiddenRoom(nullptr), + _activeNPC(nullptr), _treeItem2(nullptr), _hiddenRoom(nullptr), _drawBounds(20, 350, 620, 480) { setup(); _timers[0] = _timers[1] = nullptr; @@ -60,7 +60,7 @@ CPetControl::CPetControl() : CGameObject(), void CPetControl::save(SimpleFile *file, int indent) const { file->writeNumberLine(0, indent); file->writeNumberLine(_currentArea, indent); - file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_activeNPCName, indent); file->writeQuotedLine(_string2, indent); saveAreas(file, indent); @@ -73,7 +73,7 @@ void CPetControl::load(SimpleFile *file) { if (!val) { _currentArea = (PetArea)file->readNumber(); - _string1 = file->readString(); + _activeNPCName = file->readString(); _string2 = file->readString(); loadAreas(file, 0); @@ -151,8 +151,8 @@ Rect CPetControl::getBounds() { void CPetControl::postLoad() { CProjectItem *root = getRoot(); - if (!_string1.empty() && root) - _treeItem1 = root->findByName(_string1); + if (!_activeNPCName.empty() && root) + _activeNPC = root->findByName(_activeNPCName); if (!_string2.empty() && root) _treeItem2 = root->findByName(_string2); diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index bd896575ce..7e720b7b10 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -56,8 +56,7 @@ private: CPetControlSub5 _sub5; CPetControlSub7 _sub7; CPetFrame _frame; - CTreeItem *_treeItem1; - CString _string1; + CString _activeNPCName; CTreeItem *_treeItem2; CString _string2; CRoomItem *_hiddenRoom; @@ -107,6 +106,7 @@ protected: bool TimerMsg(CTimerMsg *msg); public: PetArea _currentArea; + CTreeItem *_activeNPC; public: CLASSDEF CPetControl(); diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index 850fec1668..d7fe68ef88 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -26,7 +26,7 @@ namespace Titanic { CPetConversations::CPetConversations() : CPetSection(), - _field414(0), _field418(0) { + _logScrolled(false), _field418(0) { } void CPetConversations::save(SimpleFile *file, int indent) const { @@ -34,7 +34,7 @@ void CPetConversations::save(SimpleFile *file, int indent) const { } void CPetConversations::load(SimpleFile *file, int param) { - _text2.load(file, param); + _textInput.load(file, param); _log.load(file, param); for (int idx = 0; idx < 3; ++idx) @@ -100,6 +100,16 @@ bool CPetConversations::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { || _scrollUp.MouseDoubleClickMsg(msg->_mousePos); } +bool CPetConversations::KeyCharMsg(CKeyCharMsg *msg) { + Common::KeyState keyState; + keyState.ascii = msg->_key; + return handleKey(keyState); +} + +bool CPetConversations::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { + return handleKey(msg->_keyState); +} + bool CPetConversations::setupControl(CPetControl *petControl) { if (petControl) { _petControl = petControl; @@ -146,21 +156,42 @@ void CPetConversations::scrollUp() { _log.scrollUp(CScreenManager::_screenManagerPtr); if (_petControl) _petControl->makeDirty(); - _field414 = true; + _logScrolled = true; } void CPetConversations::scrollDown() { _log.scrollDown(CScreenManager::_screenManagerPtr); if (_petControl) _petControl->makeDirty(); - _field414 = true; + _logScrolled = true; +} + +void CPetConversations::scrollUpPage() { + _log.scrollUpPage(CScreenManager::_screenManagerPtr); + if (_petControl) + _petControl->makeDirty(); + _logScrolled = true; +} + +void CPetConversations::scrollDownPage() { + _log.scrollDownPage(CScreenManager::_screenManagerPtr); + if (_petControl) + _petControl->makeDirty(); + _logScrolled = true; +} + +void CPetConversations::scrollToTop() { + _log.scrollToTop(CScreenManager::_screenManagerPtr); + if (_petControl) + _petControl->makeDirty(); + _logScrolled = true; } void CPetConversations::scrollToBottom() { _log.scrollToBottom(CScreenManager::_screenManagerPtr); if (_petControl) _petControl->makeDirty(); - _field414 = true; + _logScrolled = true; } int CPetConversations::canSummonNPC(const CString &name) { @@ -177,4 +208,62 @@ void CPetConversations::summonNPC(const CString &name) { } } +bool CPetConversations::handleKey(const Common::KeyState &keyState) { + switch (keyState.keycode) { + case Common::KEYCODE_UP: + case Common::KEYCODE_KP8: + scrollUp(); + break; + case Common::KEYCODE_DOWN: + case Common::KEYCODE_KP2: + scrollDown(); + break; + case Common::KEYCODE_PAGEUP: + case Common::KEYCODE_KP9: + scrollUpPage(); + break; + case Common::KEYCODE_PAGEDOWN: + case Common::KEYCODE_KP3: + scrollDownPage(); + break; + case Common::KEYCODE_HOME: + case Common::KEYCODE_KP7: + scrollToTop(); + break; + case Common::KEYCODE_END: + case Common::KEYCODE_KP1: + scrollToBottom(); + break; + case Common::KEYCODE_BACKSPACE: + // Erase key in text input + _textInput.handleKey((char)Common::KEYCODE_BACKSPACE); + case Common::KEYCODE_RETURN: + case Common::KEYCODE_KP_ENTER: + // Text line finished + textLineEntered(_textInput.getText()); + return true; + default: + if (keyState.ascii >= 32 && keyState.ascii) + _textInput.handleKey(keyState.ascii); + return true; + } + + return false; +} + +void CPetConversations::textLineEntered(const CString &textLine) { + if (textLine.empty() || !_petControl) + return; + + if (_petControl->_activeNPC) { + warning("TODO: textLineEntered"); + } else { + _log.addLine("There is no one here to talk to", getColor(1)); + } + + // Clear input line and scroll log down to end to show response + _textInput.setup(); + scrollToBottom(); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index 9b312729fa..f7541eda46 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -45,9 +45,9 @@ private: CPetGfxElement _valArray2[9]; int _field30C; CPetText _log; - CPetText _text2; + CPetText _textInput; int _valArray3[3]; - int _field414; + bool _logScrolled; int _field418; CString _string1; private: @@ -66,6 +66,21 @@ private: */ void scrollDown(); + /** + * Scroll up one page in the conversation log + */ + void scrollUpPage(); + + /** + * Scroll down one page in the conversation log + */ + void scrollDownPage(); + + /** + * Scroll to the top of the conversation log + */ + void scrollToTop(); + /** * Scroll to the bottom of the conversation log */ @@ -80,6 +95,16 @@ private: * Summon an NPC */ void summonNPC(const CString &name); + + /** + * Handle a keypress + */ + bool handleKey(const Common::KeyState &keyState); + + /** + * Handles an entered text line + */ + void textLineEntered(const CString &textLine); public: CPetConversations(); @@ -105,6 +130,8 @@ public: virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); virtual bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg); + virtual bool KeyCharMsg(CKeyCharMsg *msg); + virtual bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index 2ea10994e6..a092255d7c 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -264,6 +264,24 @@ void CPetText::scrollDown(CScreenManager *screenManager) { screenManager->setFontNumber(oldFontNumber); } +void CPetText::scrollUpPage(CScreenManager *screenManager) { + int oldFontNumber = screenManager->setFontNumber(_fontNumber2); + _scrollTop -= getPageHeight(screenManager); + constrainScrollUp(screenManager); + screenManager->setFontNumber(oldFontNumber); +} + +void CPetText::scrollDownPage(CScreenManager *screenManager) { + int oldFontNumber = screenManager->setFontNumber(_fontNumber2); + _scrollTop += getPageHeight(screenManager); + constrainScrollDown(screenManager); + screenManager->setFontNumber(oldFontNumber); +} + +void CPetText::scrollToTop(CScreenManager *screenManager) { + _scrollTop = 0; +} + void CPetText::scrollToBottom(CScreenManager *screenManager) { int oldFontNumber = screenManager->setFontNumber(_fontNumber2); _scrollTop = _bounds.height(); @@ -286,6 +304,22 @@ void CPetText::constrainScrollDown(CScreenManager *screenManager) { _scrollTop = maxScroll; } +int CPetText::getPageHeight(CScreenManager *screenManager) { + int textHeight = _bounds.height(); + int oldFontNumber = screenManager->setFontNumber(_fontNumber2); + int fontHeight = screenManager->getFontHeight(); + screenManager->setFontNumber(oldFontNumber); + + if (fontHeight) { + int lines = textHeight / fontHeight; + if (lines > 1) + --lines; + return lines * fontHeight; + } else { + return 0; + } +} + void CPetText::addLine(const CString &str, uint color) { addLine(str, color & 0xff, (color >> 8) & 0xff, (color >> 16) & 0xff); @@ -308,19 +342,18 @@ void CPetText::addLine(const CString &str, byte r, byte g, byte b) { ++_lineCount; } -bool CPetText::handleKey(const Common::KeyState &keyState) { - switch (keyState.keycode) { - case Common::KEYCODE_BACKSPACE: +bool CPetText::handleKey(char c) { + switch (c) { + case (char)Common::KEYCODE_BACKSPACE: deleteLastChar(); break; - case Common::KEYCODE_RETURN: - case Common::KEYCODE_KP_ENTER: + case (char)Common::KEYCODE_RETURN: return true; default: - if (keyState.ascii >= 32 && keyState.ascii <= 127) - appendText(CString(keyState.ascii, 1)); + if (c >= 32 && c <= 127) + appendText(CString(c, 1)); break; } diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h index 4bb699d58e..00eab10146 100644 --- a/engines/titanic/pet_control/pet_text.h +++ b/engines/titanic/pet_control/pet_text.h @@ -92,6 +92,11 @@ private: * Ensures the Y scrolling for the text is in the valid range */ void constrainScrollDown(CScreenManager *screenManager); + + /** + * Get the page height for paging up and down + */ + int getPageHeight(CScreenManager *screenManager); public: CPetText(uint count = 10); @@ -179,6 +184,21 @@ public: */ void scrollDown(CScreenManager *screenManager); + /** + * Scroll the text up one page + */ + void scrollUpPage(CScreenManager *screenManager); + + /** + * Scroll the text down one page + */ + void scrollDownPage(CScreenManager *screenManager); + + /** + * Scroll to the top of the text + */ + void scrollToTop(CScreenManager *screenManager); + /** * Scroll to the bottom of the text */ @@ -199,7 +219,7 @@ public: * the current text line * @returns True if the Enter key was pressed */ - bool handleKey(const Common::KeyState &keyState); + bool handleKey(char c); }; } // End of namespace Titanic -- cgit v1.2.3 From 6fa57389a2711a83103ebde63779743f7ac2b96d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 29 Apr 2016 08:06:04 -0400 Subject: TITANIC: Finished PET Conversations input line processing --- engines/titanic/messages/messages.h | 2 +- engines/titanic/pet_control/pet_conversations.cpp | 8 +++++++- engines/titanic/pet_control/pet_text.cpp | 4 ++++ engines/titanic/pet_control/pet_text.h | 5 +++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 3af65c29da..4c8ccaf43a 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -345,7 +345,7 @@ MESSAGE0(CSubTurnOnMsg); MESSAGE2(CSummonBotMsg, CString, strValue, "", int, numValue, 0); MESSAGE1(CSummonBotQueryMsg, CString, npcName, ""); MESSAGE1(CTakeHeadPieceMsg, CString, value, "NULL"); -MESSAGE2(CTextInputMsg, CString, value1, "", CString, value2, ""); +MESSAGE2(CTextInputMsg, CString, input, "", CString, response, ""); MESSAGE1(CTimeDilationMsg, int, value, 0); MESSAGE0(CTitleSequenceEndedMsg); MESSAGE0(CTransitMsg); diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index d7fe68ef88..ae5bbd6e24 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -256,7 +256,13 @@ void CPetConversations::textLineEntered(const CString &textLine) { return; if (_petControl->_activeNPC) { - warning("TODO: textLineEntered"); + _log.addLine("- " + textLine, getColor(0)); + + CTextInputMsg inputMsg(textLine, ""); + inputMsg.execute(_petControl->_activeNPC); + + if (!inputMsg._response.empty()) + _log.addLine(inputMsg._response); } else { _log.addLine("There is no one here to talk to", getColor(1)); } diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index a092255d7c..349e419513 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -320,6 +320,10 @@ int CPetText::getPageHeight(CScreenManager *screenManager) { } } +void CPetText::addLine(const CString &str) { + addLine(str, _textR, _textG, _textB); +} + void CPetText::addLine(const CString &str, uint color) { addLine(str, color & 0xff, (color >> 8) & 0xff, (color >> 16) & 0xff); diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h index 00eab10146..a3d136a2d4 100644 --- a/engines/titanic/pet_control/pet_text.h +++ b/engines/titanic/pet_control/pet_text.h @@ -204,6 +204,11 @@ public: */ void scrollToBottom(CScreenManager *screenManager); + /** + * Add a line to the text + */ + void addLine(const CString &str); + /** * Add a line to the text */ -- cgit v1.2.3 From 5d087a8fcd709550ec14fc6b01acf045f8d6614b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 29 Apr 2016 18:19:03 -0400 Subject: TITANIC: Implement PET Conversations & Text saving --- engines/titanic/pet_control/pet_conversations.cpp | 45 +++++++++++++++++------ engines/titanic/pet_control/pet_conversations.h | 39 +++++++++++++++----- engines/titanic/pet_control/pet_text.cpp | 32 ++++++++++++++-- engines/titanic/pet_control/pet_text.h | 5 +++ 4 files changed, 95 insertions(+), 26 deletions(-) diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index ae5bbd6e24..d21380c28f 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -29,18 +29,6 @@ CPetConversations::CPetConversations() : CPetSection(), _logScrolled(false), _field418(0) { } -void CPetConversations::save(SimpleFile *file, int indent) const { - -} - -void CPetConversations::load(SimpleFile *file, int param) { - _textInput.load(file, param); - _log.load(file, param); - - for (int idx = 0; idx < 3; ++idx) - _valArray3[idx] = file->readNumber(); -} - bool CPetConversations::isValid(CPetControl *petControl) { return setupControl(petControl); } @@ -110,6 +98,39 @@ bool CPetConversations::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { return handleKey(msg->_keyState); } +void CPetConversations::displayMessage(const CString &msg) { + _log.addLine(msg, getColor(1)); + scrollToBottom(); +} + +void CPetConversations::load(SimpleFile *file, int param) { + _textInput.load(file, param); + _log.load(file, param); + + for (int idx = 0; idx < 3; ++idx) + _valArray3[idx] = file->readNumber(); +} + +void CPetConversations::postLoad() { + reset(); +} + +void CPetConversations::save(SimpleFile *file, int indent) const { + _textInput.save(file, indent); + _log.save(file, indent); + + for (int idx = 0; idx < 3; ++idx) + file->writeNumberLine(_valArray3[idx], indent); +} + +void CPetConversations::enter(PetArea oldArea) { + +} + +void CPetConversations::leave() { + +} + bool CPetConversations::setupControl(CPetControl *petControl) { if (petControl) { _petControl = petControl; diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index f7541eda46..9247b44a42 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -108,16 +108,6 @@ private: public: CPetConversations(); - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file, int param); - /** * Returns true if the object is in a valid state */ @@ -132,6 +122,35 @@ public: virtual bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg); virtual bool KeyCharMsg(CKeyCharMsg *msg); virtual bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg); + + /** + * Display a message + */ + virtual void displayMessage(const CString &msg); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file, int param); + + /** + * Called after a game has been loaded + */ + virtual void postLoad(); + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Called when a section is switched to + */ + virtual void enter(PetArea oldArea); + + /** + * Called when a section is being left, to switch to another area + */ + virtual void leave(); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index 349e419513..87a6868d92 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -83,10 +83,7 @@ void CPetText::load(SimpleFile *file, int param) { int var1 = file->readNumber(); int var2 = file->readNumber(); uint count = file->readNumber(); - _bounds.left = file->readNumber(); - _bounds.top = file->readNumber(); - _bounds.right = file->readNumber(); - _bounds.bottom = file->readNumber(); + _bounds = file->readRect(); _field3C = file->readNumber(); _field40 = file->readNumber(); _field44 = file->readNumber(); @@ -109,6 +106,33 @@ void CPetText::load(SimpleFile *file, int param) { } } +void CPetText::save(SimpleFile *file, int indent) const { + int numLines = _lineCount + 1; + + file->writeNumberLine(_array.size(), indent); + file->writeNumberLine(_maxCharsPerLine, indent); + file->writeNumberLine(numLines, indent); + + file->writeRect(_bounds, indent); + file->writeNumberLine(_field3C, indent); + file->writeNumberLine(_field40, indent); + file->writeNumberLine(_field44, indent); + file->writeNumberLine(_backR, indent); + file->writeNumberLine(_backG, indent); + file->writeNumberLine(_backB, indent); + file->writeNumberLine(_textR, indent); + file->writeNumberLine(_textG, indent); + file->writeNumberLine(_textB, indent); + file->writeNumberLine(_hasBorder, indent); + file->writeNumberLine(_scrollTop, indent); + + for (int idx = 0; idx < numLines; ++idx) { + file->writeQuotedLine(_array[idx]._line, indent); + file->writeQuotedLine(_array[idx]._rgb, indent); + file->writeQuotedLine(_array[idx]._string3, indent); + } +} + void CPetText::draw(CScreenManager *screenManager) { Rect tempRect = _bounds; diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h index a3d136a2d4..dd1547bff4 100644 --- a/engines/titanic/pet_control/pet_text.h +++ b/engines/titanic/pet_control/pet_text.h @@ -110,6 +110,11 @@ public: */ void load(SimpleFile *file, int param); + /** + * Save the data for the control + */ + void save(SimpleFile *file, int indent) const; + /** * Set the bounds for the control */ -- cgit v1.2.3 From 6ec129d188a2b5b86dba6540b38a959bbf8b2491 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 29 Apr 2016 19:29:28 -0400 Subject: TITANIC: Added PET Conversations enter, PET Timers, and Text Cursor show --- engines/titanic/pet_control/pet_control.cpp | 20 ++++++++++++++++++-- engines/titanic/pet_control/pet_control.h | 19 ++++++++++++++++++- engines/titanic/pet_control/pet_conversations.cpp | 8 ++++++++ engines/titanic/pet_control/pet_conversations.h | 5 +++++ engines/titanic/pet_control/pet_section.cpp | 7 +++++-- engines/titanic/pet_control/pet_section.h | 2 +- engines/titanic/pet_control/pet_text.cpp | 14 ++++++++++++++ engines/titanic/pet_control/pet_text.h | 6 ++++++ 8 files changed, 75 insertions(+), 6 deletions(-) diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 997d35b681..d67ce543fe 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -46,8 +46,6 @@ CPetControl::CPetControl() : CGameObject(), _currentArea(PET_CONVERSATION), _fieldC0(0), _locked(0), _fieldC8(0), _activeNPC(nullptr), _treeItem2(nullptr), _hiddenRoom(nullptr), _drawBounds(20, 350, 620, 480) { - setup(); - _timers[0] = _timers[1] = nullptr; _sections[PET_INVENTORY] = &_inventory; _sections[PET_CONVERSATION] = &_conversations; _sections[PET_REMOTE] = &_remote; @@ -487,4 +485,22 @@ void CPetControl::summonNPC(const CString &name, int val) { } } +void CPetControl::startPetTimer(uint timerIndex, uint firstDuration, uint duration, void *target) { + stopPetTimer(timerIndex); + _timers[timerIndex]._id = (timerIndex, firstDuration, duration); + _timers[timerIndex]._target = target; + setTimer44(_timers[timerIndex]._id, 0); +} + +void CPetControl::stopPetTimer(uint timerIndex) { + if (_timers[timerIndex]._target) { + stopTimer(_timers[timerIndex]._id); + _timers[timerIndex]._target = nullptr; + } +} + +void CPetControl::setTimer44(int id, int val) { + getGameManager()->setTimer44(id, val); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 7e720b7b10..5fbd8a0107 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -43,6 +43,11 @@ enum SummonResult { SUMMON_CANT = 0, SUMMON_PRESENT = 1, SUMMON_CAN = 2 }; class CPetControl : public CGameObject { DECLARE_MESSAGE_MAP + struct PetEventInfo { + int _id; + void *_target; + PetEventInfo() : _id(0), _target(nullptr) {} + }; private: int _fieldC0; int _locked; @@ -61,7 +66,7 @@ private: CString _string2; CRoomItem *_hiddenRoom; Rect _drawBounds; - void *_timers[2]; + PetEventInfo _timers[2]; private: /** * Returns true if the control is in a valid state @@ -94,6 +99,8 @@ private: * Checks whether a designated NPC in present in the current view */ bool isNPCInView(const CString &name) const; + + void setTimer44(int id, int val); protected: bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); bool MouseDragStartMsg(CMouseDragStartMsg *msg); @@ -267,6 +274,16 @@ public: * Summon an NPC to the player */ void summonNPC(const CString &name, int val); + + /** + * Start a timer + */ + void startPetTimer(uint timerIndex, uint firstDuration, uint duration, void *target); + + /** + * Stop a timer + */ + void stopPetTimer(uint timerIndex); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index d21380c28f..960b325bc0 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -124,7 +124,11 @@ void CPetConversations::save(SimpleFile *file, int indent) const { } void CPetConversations::enter(PetArea oldArea) { + if (_petControl && _petControl->_activeNPC) + // Start a timer for the NPC + addNPCTimer(); + _textInput.showCursor(-2); } void CPetConversations::leave() { @@ -229,6 +233,10 @@ void CPetConversations::summonNPC(const CString &name) { } } +void CPetConversations::addNPCTimer() { + _petControl->startPetTimer(1, 1000, 1000, this); +} + bool CPetConversations::handleKey(const Common::KeyState &keyState) { switch (keyState.keycode) { case Common::KEYCODE_UP: diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index 9247b44a42..ca85e14583 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -96,6 +96,11 @@ private: */ void summonNPC(const CString &name); + /** + * Adds an NPC timer + */ + void addNPCTimer(); + /** * Handle a keypress */ diff --git a/engines/titanic/pet_control/pet_section.cpp b/engines/titanic/pet_control/pet_section.cpp index afdbc9fdd8..213c93e78d 100644 --- a/engines/titanic/pet_control/pet_section.cpp +++ b/engines/titanic/pet_control/pet_section.cpp @@ -46,8 +46,11 @@ void CPetSection::proc25() { error("TODO"); } -void CPetSection::proc27() { - error("TODO"); +void CPetSection::proc27(int duration) { + if (duration > 0) + _petControl->startPetTimer(0, duration, 0, this); + else + proc28(); } void CPetSection::proc28() { diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 720e5323cf..d582f38f0d 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -146,7 +146,7 @@ public: */ virtual CPetText *getText() { return nullptr; } - virtual void proc27(); + virtual void proc27(int duration); virtual void proc28(); virtual void proc29(); virtual void proc30(); diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index 87a6868d92..7e5f329632 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -388,4 +388,18 @@ bool CPetText::handleKey(char c) { return false; } +void CPetText::showCursor(int mode) { + CScreenManager *screenManager = CScreenManager::setCurrent(); + _textCursor = screenManager->_textCursor; + if (_textCursor) { + _textCursor->setPos(Point(0, 0)); + _textCursor->setSize(Point(2, 10)); + _textCursor->setColor(0, 0, 0); + _textCursor->setBlinkRate(300); + _textCursor->setMode(mode); + _textCursor->setBounds(_bounds); + _textCursor->show(); + } +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h index dd1547bff4..2b68b743c2 100644 --- a/engines/titanic/pet_control/pet_text.h +++ b/engines/titanic/pet_control/pet_text.h @@ -230,6 +230,12 @@ public: * @returns True if the Enter key was pressed */ bool handleKey(char c); + + /** + * Attaches the current system cursor to the text control, + * and give it suitable defaults + */ + void showCursor(int mode); }; } // End of namespace Titanic -- cgit v1.2.3 From d6b84cd9e16ac584c5b57b1b94e1d071c30060ce Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 29 Apr 2016 19:34:36 -0400 Subject: TITANIC: Added PET Conversations leave and Text Cursor hide --- engines/titanic/pet_control/pet_conversations.cpp | 12 +++++++++--- engines/titanic/pet_control/pet_conversations.h | 9 +++++++-- engines/titanic/pet_control/pet_text.cpp | 8 ++++++++ engines/titanic/pet_control/pet_text.h | 5 +++++ 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index 960b325bc0..7596e65961 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -126,13 +126,15 @@ void CPetConversations::save(SimpleFile *file, int indent) const { void CPetConversations::enter(PetArea oldArea) { if (_petControl && _petControl->_activeNPC) // Start a timer for the NPC - addNPCTimer(); + startNPCTimer(); + // Show the text cursor _textInput.showCursor(-2); } void CPetConversations::leave() { - + _textInput.hideCursor(); + stopNPCTimer(); } bool CPetConversations::setupControl(CPetControl *petControl) { @@ -233,10 +235,14 @@ void CPetConversations::summonNPC(const CString &name) { } } -void CPetConversations::addNPCTimer() { +void CPetConversations::startNPCTimer() { _petControl->startPetTimer(1, 1000, 1000, this); } +void CPetConversations::stopNPCTimer() { + _petControl->stopPetTimer(1); +} + bool CPetConversations::handleKey(const Common::KeyState &keyState) { switch (keyState.keycode) { case Common::KEYCODE_UP: diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index ca85e14583..c7fb207615 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -97,9 +97,14 @@ private: void summonNPC(const CString &name); /** - * Adds an NPC timer + * Starts the NPC timer */ - void addNPCTimer(); + void startNPCTimer(); + + /** + * Stops the NPC timer + */ + void stopNPCTimer(); /** * Handle a keypress diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index 7e5f329632..6f870faa32 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -402,4 +402,12 @@ void CPetText::showCursor(int mode) { } } +void CPetText::hideCursor() { + if (_textCursor) { + _textCursor->setMode(-1); + _textCursor->hide(); + _textCursor = nullptr; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h index 2b68b743c2..9b914dcbc1 100644 --- a/engines/titanic/pet_control/pet_text.h +++ b/engines/titanic/pet_control/pet_text.h @@ -236,6 +236,11 @@ public: * and give it suitable defaults */ void showCursor(int mode); + + /** + * Removes the cursor attached to the text + */ + void hideCursor(); }; } // End of namespace Titanic -- cgit v1.2.3 From e47494a4894301cf4034c6aad4abd65f45b38eca Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 29 Apr 2016 20:02:20 -0400 Subject: TITANIC: Implement TrueTalk script retrieval --- engines/titanic/pet_control/pet_conversations.cpp | 21 +++++++++++++++++++++ engines/titanic/pet_control/pet_conversations.h | 13 ++++++++++++- engines/titanic/true_talk/true_talk_manager.cpp | 23 +++++++++++++++++++++++ engines/titanic/true_talk/true_talk_manager.h | 5 +++++ 4 files changed, 61 insertions(+), 1 deletion(-) diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index 7596e65961..988df5de33 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -22,6 +22,7 @@ #include "titanic/pet_control/pet_conversations.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/game_manager.h" namespace Titanic { @@ -243,6 +244,19 @@ void CPetConversations::stopNPCTimer() { _petControl->stopPetTimer(1); } +TTNamedScript *CPetConversations::getNPCScript(const CString &name) const { + if (name.empty() || !_petControl) + return nullptr; + CGameManager *gameManager = _petControl->getGameManager(); + if (!gameManager) + return nullptr; + CTrueTalkManager *trueTalk = gameManager->getTalkManager(); + if (!trueTalk) + return nullptr; + + return trueTalk->getTalker(name); +} + bool CPetConversations::handleKey(const Common::KeyState &keyState) { switch (keyState.keycode) { case Common::KEYCODE_UP: @@ -307,4 +321,11 @@ void CPetConversations::textLineEntered(const CString &textLine) { scrollToBottom(); } +CString CPetConversations::getActiveNPCName() const { + if (_petControl && _petControl->_activeNPC) + return _petControl->_activeNPC->getName(); + else + return CString(); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index c7fb207615..c3eefa9e69 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -26,6 +26,7 @@ #include "titanic/pet_control/pet_section.h" #include "titanic/pet_control/pet_text.h" #include "titanic/pet_control/pet_gfx_element.h" +#include "titanic/true_talk/true_talk_manager.h" namespace Titanic { @@ -49,7 +50,7 @@ private: int _valArray3[3]; bool _logScrolled; int _field418; - CString _string1; + CString _npcName; private: /** * Sets up the control @@ -106,6 +107,11 @@ private: */ void stopNPCTimer(); + /** + * Get the TrueTalk script associated with a given NPC + */ + TTNamedScript *getNPCScript(const CString &name) const; + /** * Handle a keypress */ @@ -115,6 +121,11 @@ private: * Handles an entered text line */ void textLineEntered(const CString &textLine); + + /** + * Returns the name of the currently active NPC, if any + */ + CString getActiveNPCName() const; public: CPetConversations(); diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 03f8ac5b3e..b97b51931c 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -195,4 +195,27 @@ void CTrueTalkManager::fn1(CTreeItem *item, int val2, int val3) { warning("CTrueTalkManager::fn1"); } +TTNamedScript *CTrueTalkManager::getTalker(const CString &name) { + if (name.contains("Doorbot")) + return _scripts.getNamedScript(104); + else if (name.contains("DeskBot")) + return _scripts.getNamedScript(103); + else if (name.contains("LiftBot")) + return _scripts.getNamedScript(105); + else if (name.contains("Parrot")) + return _scripts.getNamedScript(107); + else if (name.contains("BarBot")) + return _scripts.getNamedScript(100); + else if (name.contains("ChatterBot")) + return _scripts.getNamedScript(102); + else if (name.contains("BellBot")) + return _scripts.getNamedScript(101); + else if (name.contains("MaitreD")) + return _scripts.getNamedScript(112); + else if (name.contains("Succubus") || name.contains("Sub")) + return _scripts.getNamedScript(111); + + return nullptr; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index 2e366a6a35..9da1c06242 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -113,6 +113,11 @@ public: void update2(); void fn1(CTreeItem *item, int val2, int val3); + + /** + * Return a TrueTalk talker/script + */ + TTNamedScript *getTalker(const CString &name); }; } // End of namespace Titanic -- cgit v1.2.3 From 7af7838b863893b1a67dfc3a7d82fe0febff8b07 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 29 Apr 2016 20:25:19 -0400 Subject: TITANIC: Implement PET Conversations displayNPC --- engines/titanic/pet_control/pet_conversations.cpp | 42 +++++++++++++++++++++++ engines/titanic/pet_control/pet_conversations.h | 7 +++- engines/titanic/pet_control/pet_section.h | 6 +++- 3 files changed, 53 insertions(+), 2 deletions(-) diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index 988df5de33..8f0450c4c5 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -138,6 +138,48 @@ void CPetConversations::leave() { stopNPCTimer(); } +void CPetConversations::displayNPC(CGameObject *npc) { + if (npc) { + displayMessage(CString()); + CString msg = "Talking to "; + CString name = npc->getName(); + int id = 1; + + if (name.contains("Doorbot")) { + msg += "the DoorBot"; + } else if (name.contains("DeskBot")) { + id = 2; + msg += "the DeskBot"; + } else if (name.contains("LiftBot")) { + id = 3; + msg += "a LiftBot"; + } else if (name.contains("Parrot")) { + id = 4; + msg += "the Parrot"; + } else if (name.contains("BarBot")) { + id = 5; + msg += "the BarBot"; + } else if (name.contains("ChatterBot")) { + id = 6; + msg += "a ChatterBot"; + } else if (name.contains("BellBot")) { + id = 7; + msg += "the BellBot"; + } else if (name.contains("Maitre")) { + id = 8; + msg += "the Maitre d'Bot"; + } else if (name.contains("Succubus") || name.contains("Sub")) { + id = 9; + msg += "a Succ-U-Bus"; + } else { + msg += "Unknown"; + } + + _log.setNPC(1, id); + displayMessage(msg); + } +} + bool CPetConversations::setupControl(CPetControl *petControl) { if (petControl) { _petControl = petControl; diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index c3eefa9e69..ad993ec3b2 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -171,7 +171,12 @@ public: /** * Called when a section is being left, to switch to another area */ - virtual void leave(); + virtual void leave(); + + /** + * Display a title for an NPC + */ + virtual void displayNPC(CGameObject *npc); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index d582f38f0d..995feee27b 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -153,7 +153,11 @@ public: virtual CGameObject *getBackground(int index) const { return nullptr; } - virtual void proc32() {} + /** + * Display a title for an NPC + */ + virtual void displayNPC(CGameObject *npc); + virtual void proc33() {} virtual void proc34() {} virtual void proc35() {} -- cgit v1.2.3 From 6de4295cc3e691a7d3806cd27be525037eb173fc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 29 Apr 2016 20:52:11 -0400 Subject: TITANIC: Identifiied Pet Section showCursor & hideCursor methods --- engines/titanic/pet_control/pet_conversations.cpp | 24 +++++++++++++++-------- engines/titanic/pet_control/pet_conversations.h | 14 +++++++++++-- engines/titanic/pet_control/pet_section.h | 15 +++++++++++--- 3 files changed, 40 insertions(+), 13 deletions(-) diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index 8f0450c4c5..677635391c 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -27,7 +27,7 @@ namespace Titanic { CPetConversations::CPetConversations() : CPetSection(), - _logScrolled(false), _field418(0) { + _logChanged(false), _field418(0) { } bool CPetConversations::isValid(CPetControl *petControl) { @@ -138,7 +138,7 @@ void CPetConversations::leave() { stopNPCTimer(); } -void CPetConversations::displayNPC(CGameObject *npc) { +void CPetConversations::displayNPCName(CGameObject *npc) { if (npc) { displayMessage(CString()); CString msg = "Talking to "; @@ -180,6 +180,14 @@ void CPetConversations::displayNPC(CGameObject *npc) { } } +void CPetConversations::showCursor() { + _textInput.showCursor(-2); +} + +void CPetConversations::hideCursor() { + _textInput.hideCursor(); +} + bool CPetConversations::setupControl(CPetControl *petControl) { if (petControl) { _petControl = petControl; @@ -226,42 +234,42 @@ void CPetConversations::scrollUp() { _log.scrollUp(CScreenManager::_screenManagerPtr); if (_petControl) _petControl->makeDirty(); - _logScrolled = true; + _logChanged = true; } void CPetConversations::scrollDown() { _log.scrollDown(CScreenManager::_screenManagerPtr); if (_petControl) _petControl->makeDirty(); - _logScrolled = true; + _logChanged = true; } void CPetConversations::scrollUpPage() { _log.scrollUpPage(CScreenManager::_screenManagerPtr); if (_petControl) _petControl->makeDirty(); - _logScrolled = true; + _logChanged = true; } void CPetConversations::scrollDownPage() { _log.scrollDownPage(CScreenManager::_screenManagerPtr); if (_petControl) _petControl->makeDirty(); - _logScrolled = true; + _logChanged = true; } void CPetConversations::scrollToTop() { _log.scrollToTop(CScreenManager::_screenManagerPtr); if (_petControl) _petControl->makeDirty(); - _logScrolled = true; + _logChanged = true; } void CPetConversations::scrollToBottom() { _log.scrollToBottom(CScreenManager::_screenManagerPtr); if (_petControl) _petControl->makeDirty(); - _logScrolled = true; + _logChanged = true; } int CPetConversations::canSummonNPC(const CString &name) { diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index ad993ec3b2..79f6b59bdc 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -48,7 +48,7 @@ private: CPetText _log; CPetText _textInput; int _valArray3[3]; - bool _logScrolled; + bool _logChanged; int _field418; CString _npcName; private: @@ -176,7 +176,17 @@ public: /** * Display a title for an NPC */ - virtual void displayNPC(CGameObject *npc); + virtual void displayNPCName(CGameObject *npc); + + /** + * Show the text cursor + */ + virtual void showCursor(); + + /** + * Hide the text cursor + */ + virtual void hideCursor(); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 995feee27b..692c8b9100 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -156,13 +156,22 @@ public: /** * Display a title for an NPC */ - virtual void displayNPC(CGameObject *npc); + virtual void displayNPCName(CGameObject *npc) {} virtual void proc33() {} virtual void proc34() {} virtual void proc35() {} - virtual void proc36() {} - virtual void proc37() {} + + /** + * Show the text cursor + */ + virtual void showCursor() {} + + /** + * Hide the text cursor + */ + virtual void hideCursor() {} + virtual void proc38(int val) {} /** -- cgit v1.2.3 From 44d95d8e51562d40e5049e9c1c110e6ef9ace83e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 29 Apr 2016 21:21:42 -0400 Subject: TITANIC: Simplify video surface shading palette --- engines/titanic/support/video_surface.cpp | 23 +++++++++++------------ engines/titanic/support/video_surface.h | 8 ++++---- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index fe694786e4..6ce473172b 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -164,7 +164,7 @@ bool CVideoSurface::proc45() { /*------------------------------------------------------------------------*/ -byte OSVideoSurface::_map[0x400]; +byte OSVideoSurface::_palette[32][32]; OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, DirectDrawSurface *surface) : CVideoSurface(screenManager) { @@ -184,17 +184,16 @@ OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, const CResourceKey } } -void OSVideoSurface::setupMap(byte map[0x400], byte val) { - byte *pBase = map; +void OSVideoSurface::setupPalette(byte palette[32][32], byte val) { int incr = 0; - for (uint idx1 = 0; idx1 < 32; ++idx1, pBase += 32) { + for (uint idx1 = 0; idx1 < 32; ++idx1) { for (uint idx2 = 0, base = 0; idx2 < 32; ++idx2, base += incr) { int64 v = 0x84210843; v *= base; v = ((v >> 32) + base) >> 4; v += (v >> 31); - pBase[idx2] = v; + palette[idx1][idx2] = v; if (val != 0xff) { v &= 0xff; @@ -205,7 +204,7 @@ void OSVideoSurface::setupMap(byte map[0x400], byte val) { v >>= 7; v += (v >> 31); - pBase[idx2] = v; + palette[idx1][idx2] = v; } } } @@ -377,16 +376,16 @@ void OSVideoSurface::changePixel(uint16 *pixelP, uint16 *color, byte srcVal, boo byte r, g, b; format.colorToRGB(*color, r, g, b); if (remapFlag) { - r = _map[0x3e0 - srcVal * 32 + (r >> 2)] << 2; - g = _map[0x3e0 - srcVal * 32 + (g >> 2)] << 2; - b = _map[0x3e0 - srcVal * 32 + (b >> 2)] << 2; + r = _palette[31 - srcVal][r >> 2] << 2; + g = _palette[31 - srcVal][g >> 2] << 2; + b = _palette[31 - srcVal][b >> 2] << 2; } byte r2, g2, b2; format.colorToRGB(*pixelP, r2, g2, b2); - r2 = _map[srcVal * 32 + (r2 >> 2)] << 2; - g2 = _map[srcVal * 32 + (g2 >> 2)] << 2; - b2 = _map[srcVal * 32 + (b2 >> 2)] << 2; + r2 = _palette[srcVal][r2 >> 2] << 2; + g2 = _palette[srcVal][g2 >> 2] << 2; + b2 = _palette[srcVal][b2 >> 2] << 2; *pixelP = format.RGBToColor(r + r2, g + g2, b + b2); } diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index 60315a6477..bf2a1a18f9 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -221,17 +221,17 @@ public: class OSVideoSurface : public CVideoSurface { friend class OSMovie; private: - static byte _map[0x400]; + static byte _palette[32][32]; /** - * Setup the color mapping table + * Setup the shading palettes */ - static void setupMap(byte map[0x400], byte val); + static void setupPalette(byte palette[32][32], byte val); public: /** * Setup statics */ - static void setup() { setupMap(_map, 0xff); } + static void setup() { setupPalette(_palette, 0xff); } public: OSVideoSurface(CScreenManager *screenManager, DirectDrawSurface *surface); OSVideoSurface(CScreenManager *screenManager, const CResourceKey &key, bool flag = false); -- cgit v1.2.3 From 9205f22a43e6e5ae9a63012fe3ad545150a90b34 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 29 Apr 2016 23:22:42 -0400 Subject: TITANIC: Fix generation of shading palettes --- engines/titanic/support/video_surface.cpp | 38 ++++++++++++------------------- engines/titanic/support/video_surface.h | 8 +++++-- 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index 6ce473172b..cdf9e228a7 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -164,7 +164,8 @@ bool CVideoSurface::proc45() { /*------------------------------------------------------------------------*/ -byte OSVideoSurface::_palette[32][32]; +byte OSVideoSurface::_palette1[32][32]; +byte OSVideoSurface::_palette2[32][32]; OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, DirectDrawSurface *surface) : CVideoSurface(screenManager) { @@ -185,27 +186,18 @@ OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, const CResourceKey } void OSVideoSurface::setupPalette(byte palette[32][32], byte val) { - int incr = 0; - for (uint idx1 = 0; idx1 < 32; ++idx1) { - for (uint idx2 = 0, base = 0; idx2 < 32; ++idx2, base += incr) { + for (uint idx2 = 0, base = 0; idx2 < 32; ++idx2, base += idx1) { int64 v = 0x84210843; v *= base; - v = ((v >> 32) + base) >> 4; - v += (v >> 31); + uint v2 = (v >> 36); + v = ((v2 >> 31) + v2) & 0xff; palette[idx1][idx2] = v; - if (val != 0xff) { - v &= 0xff; - if (v != idx2) { - v = 0x80808081 * val * v * val; - v = (v >> 32) + incr; - incr = idx1; - - v >>= 7; - v += (v >> 31); - palette[idx1][idx2] = v; - } + if (val != 0xff && v != idx2) { + v = 0x80808081 * v * val; + v2 = v >> 39; + palette[idx1][idx2] = (v2 >> 31) + v2; } } } @@ -376,16 +368,16 @@ void OSVideoSurface::changePixel(uint16 *pixelP, uint16 *color, byte srcVal, boo byte r, g, b; format.colorToRGB(*color, r, g, b); if (remapFlag) { - r = _palette[31 - srcVal][r >> 2] << 2; - g = _palette[31 - srcVal][g >> 2] << 2; - b = _palette[31 - srcVal][b >> 2] << 2; + r = _palette1[31 - srcVal][r >> 2] << 2; + g = _palette1[31 - srcVal][g >> 2] << 2; + b = _palette1[31 - srcVal][b >> 2] << 2; } byte r2, g2, b2; format.colorToRGB(*pixelP, r2, g2, b2); - r2 = _palette[srcVal][r2 >> 2] << 2; - g2 = _palette[srcVal][g2 >> 2] << 2; - b2 = _palette[srcVal][b2 >> 2] << 2; + r2 = _palette1[srcVal][r2 >> 2] << 2; + g2 = _palette1[srcVal][g2 >> 2] << 2; + b2 = _palette1[srcVal][b2 >> 2] << 2; *pixelP = format.RGBToColor(r + r2, g + g2, b + b2); } diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index bf2a1a18f9..7521a53b4b 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -221,7 +221,8 @@ public: class OSVideoSurface : public CVideoSurface { friend class OSMovie; private: - static byte _palette[32][32]; + static byte _palette1[32][32]; + static byte _palette2[32][32]; /** * Setup the shading palettes @@ -231,7 +232,10 @@ public: /** * Setup statics */ - static void setup() { setupPalette(_palette, 0xff); } + static void setup() { + setupPalette(_palette1, 0xff); + setupPalette(_palette2, 0xe0); + } public: OSVideoSurface(CScreenManager *screenManager, DirectDrawSurface *surface); OSVideoSurface(CScreenManager *screenManager, const CResourceKey &key, bool flag = false); -- cgit v1.2.3 From e55f634686e06ef9bfca9655b7eca5e2d74b4757 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Apr 2016 07:15:31 -0400 Subject: TITANIC: Fix palette usage in changePixel --- engines/titanic/support/video_surface.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index cdf9e228a7..e5a1e3a998 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -362,24 +362,25 @@ uint16 OSVideoSurface::getPixel(const Common::Point &pt) { void OSVideoSurface::changePixel(uint16 *pixelP, uint16 *color, byte srcVal, bool remapFlag) { assert(getPixelDepth() == 2); - const Graphics::PixelFormat &format = _ddSurface->getFormat(); - + const Graphics::PixelFormat &destFormat = _ddSurface->getFormat(); + const Graphics::PixelFormat srcFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); + // Get the color byte r, g, b; - format.colorToRGB(*color, r, g, b); + srcFormat.colorToRGB(*color, r, g, b); if (remapFlag) { - r = _palette1[31 - srcVal][r >> 2] << 2; - g = _palette1[31 - srcVal][g >> 2] << 2; - b = _palette1[31 - srcVal][b >> 2] << 2; + r = _palette1[31 - srcVal][r >> 3] << 3; + g = _palette1[31 - srcVal][g >> 3] << 3; + b = _palette1[31 - srcVal][b >> 3] << 3; } byte r2, g2, b2; - format.colorToRGB(*pixelP, r2, g2, b2); - r2 = _palette1[srcVal][r2 >> 2] << 2; - g2 = _palette1[srcVal][g2 >> 2] << 2; - b2 = _palette1[srcVal][b2 >> 2] << 2; + destFormat.colorToRGB(*pixelP, r2, g2, b2); + r2 = _palette1[srcVal][r2 >> 3] << 3; + g2 = _palette1[srcVal][g2 >> 3] << 3; + b2 = _palette1[srcVal][b2 >> 3] << 3; - *pixelP = format.RGBToColor(r + r2, g + g2, b + b2); + *pixelP = destFormat.RGBToColor(r + r2, g + g2, b + b2); } void OSVideoSurface::shiftColors() { -- cgit v1.2.3 From 210468fae9a51fabe276e8b8485145037dfcb683 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Apr 2016 07:19:16 -0400 Subject: TITANIC: Minor palette cleanup, remove border from PET Quit view text --- engines/titanic/pet_control/pet_quit.cpp | 2 +- engines/titanic/support/video_surface.cpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/engines/titanic/pet_control/pet_quit.cpp b/engines/titanic/pet_control/pet_quit.cpp index 6959160afa..218ed89812 100644 --- a/engines/titanic/pet_control/pet_quit.cpp +++ b/engines/titanic/pet_control/pet_quit.cpp @@ -35,7 +35,7 @@ bool CPetQuit::setup(CPetControl *petControl, CPetGlyphs *owner) { tempRect.moveTo(322, 407); _text.setBounds(tempRect); _text.resize(3); - _text.setHasBorder(true); + _text.setHasBorder(false); _text.setup(); Rect btnRect(0, 0, 68, 52); diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index e5a1e3a998..e6b2fa7958 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -192,12 +192,12 @@ void OSVideoSurface::setupPalette(byte palette[32][32], byte val) { v *= base; uint v2 = (v >> 36); v = ((v2 >> 31) + v2) & 0xff; - palette[idx1][idx2] = v; + palette[idx1][idx2] = v << 3; if (val != 0xff && v != idx2) { v = 0x80808081 * v * val; v2 = v >> 39; - palette[idx1][idx2] = (v2 >> 31) + v2; + palette[idx1][idx2] = ((v2 >> 31) + v2) << 3; } } } @@ -369,16 +369,16 @@ void OSVideoSurface::changePixel(uint16 *pixelP, uint16 *color, byte srcVal, boo byte r, g, b; srcFormat.colorToRGB(*color, r, g, b); if (remapFlag) { - r = _palette1[31 - srcVal][r >> 3] << 3; - g = _palette1[31 - srcVal][g >> 3] << 3; - b = _palette1[31 - srcVal][b >> 3] << 3; + r = _palette1[31 - srcVal][r >> 3]; + g = _palette1[31 - srcVal][g >> 3]; + b = _palette1[31 - srcVal][b >> 3]; } byte r2, g2, b2; destFormat.colorToRGB(*pixelP, r2, g2, b2); - r2 = _palette1[srcVal][r2 >> 3] << 3; - g2 = _palette1[srcVal][g2 >> 3] << 3; - b2 = _palette1[srcVal][b2 >> 3] << 3; + r2 = _palette1[srcVal][r2 >> 3]; + g2 = _palette1[srcVal][g2 >> 3]; + b2 = _palette1[srcVal][b2 >> 3]; *pixelP = destFormat.RGBToColor(r + r2, g + g2, b + b2); } -- cgit v1.2.3 From 287a9f6ef2ceb1cac4fef74832b3fdee9987ecf1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Apr 2016 07:35:04 -0400 Subject: TITANIC: Implement display of tooltips in RealLife --- engines/titanic/pet_control/pet_glyphs.cpp | 17 ++++++++++++----- engines/titanic/pet_control/pet_glyphs.h | 5 ++++- engines/titanic/pet_control/pet_real_life.cpp | 2 +- engines/titanic/pet_control/pet_rooms.cpp | 2 +- engines/titanic/pet_control/pet_section.cpp | 6 ++++-- 5 files changed, 22 insertions(+), 10 deletions(-) diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index ed879f286b..96e61c9d48 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -38,8 +38,15 @@ void CPetGlyph::drawAt(CScreenManager *screenManager, const Point &pt, bool isHi _element.translate(-pt.x, -pt.y); } -void CPetGlyph::proc14() { - warning("TODO: CPetGlyph::proc14"); +void CPetGlyph::updateTooltip() { + CPetText *petText = getPetSection()->getText(); + if (petText) { + petText->setColor(getPetSection()->getColor(0)); + getTooltip(petText); + + if (_owner) + getPetSection()->proc29(); + } } bool CPetGlyph::contains(const Point &delta, const Point &pt) { @@ -204,7 +211,7 @@ void CPetGlyphs::changeHighlight(int index) { glyph->highlightCurrent(pt); } - glyph->proc14(); + glyph->updateTooltip(); } } else if (_owner) { _owner->proc28(); @@ -308,7 +315,7 @@ bool CPetGlyphs::MouseButtonDownMsg(const Point &pt) { if (glyph) { if (_highlightIndex == index) { glyph->MouseButtonDownMsg(glyphRect); - glyph->proc14(); + glyph->updateTooltip(); } else { changeHighlight(index); makePetDirty(); @@ -430,7 +437,7 @@ bool CPetGlyphs::highlighted14() { if (_highlightIndex != -1) { CPetGlyph *pet = getGlyph(_highlightIndex); if (pet) { - pet->proc14(); + pet->updateTooltip(); return true; } } diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index 792050166c..12f66870c6 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -118,7 +118,10 @@ public: */ virtual void draw2(CScreenManager *screenManager) {} - virtual void proc14(); + /** + * Updates the tooltip being shown for the glyph + */ + virtual void updateTooltip(); /** * Get the bounds for the glyph diff --git a/engines/titanic/pet_control/pet_real_life.cpp b/engines/titanic/pet_control/pet_real_life.cpp index 9d469626aa..72e350cd33 100644 --- a/engines/titanic/pet_control/pet_real_life.cpp +++ b/engines/titanic/pet_control/pet_real_life.cpp @@ -107,7 +107,7 @@ bool CPetRealLife::setupControl(CPetControl *petControl) { addButton(new CPetSound()); addButton(new CPetQuit()); - Rect textRect(0, 0, 32, 436); + Rect textRect(0, 0, 276, 30); textRect.moveTo(32, 436); _text.setBounds(textRect); _text.setHasBorder(false); diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp index ee63f41ca6..71fa01ee77 100644 --- a/engines/titanic/pet_control/pet_rooms.cpp +++ b/engines/titanic/pet_control/pet_rooms.cpp @@ -187,7 +187,7 @@ bool CPetRooms::setupControl(CPetControl *petControl) { void CPetRooms::resetHighlight() { _glyphItem.set34(fn1()); _glyphs.resetHighlight(); - _glyphItem.proc14(); + _glyphItem.updateTooltip(); areaChanged(PET_ROOMS); } diff --git a/engines/titanic/pet_control/pet_section.cpp b/engines/titanic/pet_control/pet_section.cpp index 213c93e78d..8cd9207316 100644 --- a/engines/titanic/pet_control/pet_section.cpp +++ b/engines/titanic/pet_control/pet_section.cpp @@ -54,11 +54,13 @@ void CPetSection::proc27(int duration) { } void CPetSection::proc28() { - error("TODO"); + CPetText *text = getText(); + if (text) + text->setup(); } void CPetSection::proc29() { - error("TODO"); + _petControl->stopPetTimer(0); } void CPetSection::proc30() { -- cgit v1.2.3 From 01989265aa6abd68f2aa5d799d867886c8ed3799 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Apr 2016 08:29:11 -0400 Subject: TITANIC: PET Conversations now partly rendering --- engines/titanic/pet_control/pet_conversations.cpp | 129 +++++++++++++++++++--- engines/titanic/pet_control/pet_conversations.h | 35 ++++-- engines/titanic/pet_control/pet_gfx_element.h | 3 +- 3 files changed, 144 insertions(+), 23 deletions(-) diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index 677635391c..bf26898891 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -27,7 +27,106 @@ namespace Titanic { CPetConversations::CPetConversations() : CPetSection(), - _logChanged(false), _field418(0) { + _logChanged(false), _field418(0), _npcNum(-1), + _rect1(22, 352, 598, 478) { + Rect logRect(85, 18, 513, 87); + logRect.translate(20, 350); + _log.setBounds(logRect); + _log.resize(50); + _log.setHasBorder(false); + _log.setColor(getColor(2)); + _log.setup(); + _log.addLine("Welcome to your PET v1.0a"); + + Rect inputRect(85, 95, 513, 135); + inputRect.translate(20, 350); + _textInput.setBounds(inputRect); + _textInput.setHasBorder(false); + _textInput.resize(2); + _textInput.setMaxCharsPerLine(74); + _textInput.setColor(getColor(0)); + _textInput.setup(); + + _valArray3[0] = _valArray3[1] = _valArray3[2] = 0; +} + +bool CPetConversations::setup(CPetControl *petControl) { + if (petControl && setupControl(petControl)) + return reset(); + return false; +} + +bool CPetConversations::reset() { + _dials[0].setup(MODE_UNSELECTED, "3PetDial1", _petControl); + _dials[1].setup(MODE_UNSELECTED, "3PetDial2", _petControl); + _dials[2].setup(MODE_UNSELECTED, "3PetDial3", _petControl); + + _dialBackground.reset("PetDialBack", _petControl); + _scrollUp.reset("PetScrollUp", _petControl); + _scrollDown.reset("PetScrollDown", _petControl); + + _doorBot.reset("PetCallDoorOut", _petControl, MODE_UNSELECTED); + _doorBot.reset("PetCallDoorIn", _petControl, MODE_SELECTED); + _bellBot.reset("PetCallBellOut", _petControl, MODE_UNSELECTED); + _doorBot.reset("PetCallBellIn", _petControl, MODE_SELECTED); + + _indent.reset("PetSmallCharacterIndent", _petControl); + _splitter.reset("PetSplitter", _petControl); + + _npcIcons[0].setup(MODE_UNSELECTED, "3PetSmlDoorbot", _petControl); + _npcIcons[1].setup(MODE_UNSELECTED, "3PetSmlDeskbot", _petControl); + _npcIcons[2].setup(MODE_UNSELECTED, "3PetSmlLiftbot", _petControl); + _npcIcons[3].setup(MODE_UNSELECTED, "3PetSmlParrot", _petControl); + _npcIcons[4].setup(MODE_UNSELECTED, "3PetSmlBarbot", _petControl); + _npcIcons[5].setup(MODE_UNSELECTED, "3PetSmlChatterbot", _petControl); + _npcIcons[6].setup(MODE_UNSELECTED, "3PetSmlBellbot", _petControl); + _npcIcons[7].setup(MODE_UNSELECTED, "3PetSmlMaitreD", _petControl); + _npcIcons[8].setup(MODE_UNSELECTED, "3PetSmlSuccubus", _petControl); + + if (_petControl->getPassengerClass() == 1) { + uint col = getColor(0); + _textInput.setColor(col); + _textInput.setLineColor(0, col); + + warning("TODO: Setup log shaded palette?"); + + _log.setColor(getColor(2)); + } + + return true; +} + +void CPetConversations::draw(CScreenManager *screenManager) { + _dialBackground.draw(screenManager); + _splitter.draw(screenManager); + _dials[0].draw(screenManager); + _dials[1].draw(screenManager); + _dials[2].draw(screenManager); + + _indent.draw(screenManager); + _doorBot.draw(screenManager); + _bellBot.draw(screenManager); + _scrollUp.draw(screenManager); + _scrollDown.draw(screenManager); + _log.draw(screenManager); + _textInput.draw(screenManager); + + if (_logChanged) { + int fontNumber = _log.getFontNumber(); + if (fontNumber >= 0) { + warning("TODO conversation draw"); + } + + _logChanged = false; + } + + if (_npcNum >= 0) + _npcIcons[_npcNum].draw(screenManager); +} + +Rect CPetConversations::getBounds() { + // TODO + return Rect(); } bool CPetConversations::isValid(CPetControl *petControl) { @@ -192,16 +291,16 @@ bool CPetConversations::setupControl(CPetControl *petControl) { if (petControl) { _petControl = petControl; - _val3.setBounds(Rect(0, 0, 21, 130)); - _val3.translate(20, 350); + _dialBackground.setBounds(Rect(0, 0, 21, 130)); + _dialBackground.translate(20, 350); const Rect rect1(0, 0, 22, 36); - _gfxList[0].setBounds(rect1); - _gfxList[0].translate(20, 359); - _gfxList[1].setBounds(rect1); - _gfxList[1].translate(20, 397); - _gfxList[2].setBounds(rect1); - _gfxList[2].translate(20, 434); + _dials[0].setBounds(rect1); + _dials[0].translate(20, 359); + _dials[1].setBounds(rect1); + _dials[1].translate(20, 397); + _dials[2].setBounds(rect1); + _dials[2].translate(20, 434); const Rect rect2(0, 0, 11, 24); _scrollUp.setBounds(rect2); @@ -215,15 +314,15 @@ bool CPetConversations::setupControl(CPetControl *petControl) { _bellBot.setBounds(rect3); _bellBot.translate(546, 418); - _val6.setBounds(Rect(0, 0, 37, 70)); - _val6.translate(46, 374); - _val9.setBounds(Rect(0, 0, 435, 3)); - _val9.translate(102, 441); + _indent.setBounds(Rect(0, 0, 37, 70)); + _indent.translate(46, 374); + _splitter.setBounds(Rect(0, 0, 435, 3)); + _splitter.translate(102, 441); const Rect rect4(0, 0, 33, 66); for (int idx = 0; idx < 9; ++idx) { - _valArray2[idx].setBounds(rect4); - _valArray2[idx].translate(48, 376); + _npcIcons[idx].setBounds(rect4); + _npcIcons[idx].translate(48, 376); } } diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index 79f6b59bdc..1bc59419f1 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -34,17 +34,17 @@ class CPetConversations : public CPetSection { private: CPetGfxElement _scrollUp; CPetGfxElement _scrollDown; - CPetGfxElement _val3; - CPetGfxElement _gfxList[3]; + CPetGfxElement _dialBackground; + CPetGfxElement _dials[3]; CPetGfxElement _val4; CPetGfxElement _val5; - CPetGfxElement _val6; - int _field14C; + CPetGfxElement _indent; + Rect _rect1; CPetGfxElement _doorBot; CPetGfxElement _bellBot; - CPetGfxElement _val9; - CPetGfxElement _valArray2[9]; - int _field30C; + CPetGfxElement _splitter; + CPetGfxElement _npcIcons[9]; + int _npcNum; CPetText _log; CPetText _textInput; int _valArray3[3]; @@ -128,7 +128,28 @@ private: CString getActiveNPCName() const; public: CPetConversations(); + virtual ~CPetConversations() {} + /** + * Sets up the section + */ + virtual bool setup(CPetControl *petControl); + + /** + * Reset the section + */ + virtual bool reset(); + + /** + * Draw the section + */ + virtual void draw(CScreenManager *screenManager); + + /** + * Get the bounds for the section + */ + virtual Rect getBounds(); + /** * Returns true if the object is in a valid state */ diff --git a/engines/titanic/pet_control/pet_gfx_element.h b/engines/titanic/pet_control/pet_gfx_element.h index 5bfeca1716..f33058f786 100644 --- a/engines/titanic/pet_control/pet_gfx_element.h +++ b/engines/titanic/pet_control/pet_gfx_element.h @@ -45,7 +45,8 @@ public: /** * Reset the element */ - virtual void reset(const CString &name, CPetControl *petControl, PetElementMode mode); + virtual void reset(const CString &name, CPetControl *petControl, + PetElementMode mode = MODE_UNSELECTED); /** * Draw the item -- cgit v1.2.3 From b11033800d1455bd4c35af1126bd4f0cf6b2fb77 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Apr 2016 14:55:15 -0400 Subject: TITANIC: Implementing PET support widgets --- engines/titanic/core/game_object.cpp | 9 +++++++ engines/titanic/core/game_object.h | 5 ++++ engines/titanic/pet_control/pet_control.cpp | 12 +++++++-- engines/titanic/pet_control/pet_control.h | 12 ++++++--- engines/titanic/pet_control/pet_drag_chev.cpp | 37 +++++++++++++++++++++++++++ engines/titanic/pet_control/pet_drag_chev.h | 5 ++++ engines/titanic/pet_control/pet_graphic.cpp | 3 +++ engines/titanic/pet_control/pet_graphic.h | 1 + engines/titanic/pet_control/pet_graphic2.cpp | 3 +++ engines/titanic/pet_control/pet_graphic2.h | 1 + engines/titanic/pet_control/pet_section.h | 5 +++- 11 files changed, 86 insertions(+), 7 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index d2af519fcd..6d9f60d306 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -721,4 +721,13 @@ bool CGameObject::changeView(const CString &viewName, const CString &clipName) { return true; } +void CGameObject::dragMove(const Point &pt) { + if (_surface) { + _bounds.setWidth(_surface->getWidth()); + _bounds.setHeight(_surface->getHeight()); + } + + setPosition(Point(pt.x - _bounds.width() / 2, pt.y - _bounds.height() / 2)); +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 94c3e5418d..847d6cd484 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -215,6 +215,11 @@ protected: * Change the view */ bool changeView(const CString &viewName, const CString &clipName); + + /** + * Support function for drag moving + */ + void dragMove(const Point &pt); public: int _field60; CursorId _cursorId; diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index d67ce543fe..6be026167a 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -348,8 +348,16 @@ void CPetControl::drawSquares(CScreenManager *screenManager, int count) { _frame.drawSquares(screenManager, count); } -void CPetControl::displayMessage(const CString &msg) { - error("TODO: CPetControl::displayMessage"); +CGameObject *CPetControl::dragEnd(const Point &pt) const { + return _currentArea == PET_INVENTORY ? _inventory.dragEnd(pt) : nullptr; +} + +bool CPetControl::checkDragEnd(CGameObject *item) const { + return _sections[_currentArea]->checkDragEnd(item); +} + +void CPetControl::displayMessage(const CString &msg) const { + _sections[_currentArea]->displayMessage(msg); } CGameObject *CPetControl::getFirstObject() const { diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 5fbd8a0107..b4c460e8bb 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -207,14 +207,17 @@ public: /** * Handles drag ends within the PET */ - CGameObject *dragEnd(const Point &pt) const { - return _currentArea == PET_INVENTORY ? _inventory.dragEnd(pt) : nullptr; - } + CGameObject *dragEnd(const Point &pt) const; + + /** + * Handles checking when a drag-drop operation ends + */ + bool checkDragEnd(CGameObject *item) const; /** * Display a message */ - void displayMessage(const CString &msg); + void displayMessage(const CString &msg) const; /** * Get the first game object stored in the PET @@ -284,6 +287,7 @@ public: * Stop a timer */ void stopPetTimer(uint timerIndex); + }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_drag_chev.cpp b/engines/titanic/pet_control/pet_drag_chev.cpp index 3c1569856e..32acf72795 100644 --- a/engines/titanic/pet_control/pet_drag_chev.cpp +++ b/engines/titanic/pet_control/pet_drag_chev.cpp @@ -21,9 +21,16 @@ */ #include "titanic/pet_control/pet_drag_chev.h" +#include "titanic/pet_control/pet_control.h" +#include "titanic/messages/messages.h" +#include "titanic/npcs/succubus.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CPetDragChev, CPetGraphic2) + +END_MESSAGE_MAP() + void CPetDragChev::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CPetGraphic2::save(file, indent); @@ -34,4 +41,34 @@ void CPetDragChev::load(SimpleFile *file) { CPetGraphic2::load(file); } +bool CPetDragChev::MouseDragStartMsg(CMouseDragStartMsg *msg) { + getName(); + return checkStartDragging(msg); +} + +bool CPetDragChev::MouseDragMoveMsg(CMouseDragMoveMsg *msg) { + dragMove(msg->_mousePos); + return true; +} + +bool CPetDragChev::MouseDragEndMsg(CMouseDragEndMsg *msg) { + if (msg->_dropTarget) { + CSuccUBus *succubus = static_cast(msg->_dropTarget); + + if (succubus) { + CSetChevRoomBits msg(_field54); + msg.execute(succubus); + } else { + CPetControl *petControl = getPetControl(); + if (petControl && petControl->contains(msg->_mousePos) + && msg->_mousePos.x < 528) { + if (petControl->checkDragEnd(this)) + moveToHiddenRoom(); + } + } + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_drag_chev.h b/engines/titanic/pet_control/pet_drag_chev.h index 92f3883711..4e671ceff2 100644 --- a/engines/titanic/pet_control/pet_drag_chev.h +++ b/engines/titanic/pet_control/pet_drag_chev.h @@ -28,6 +28,11 @@ namespace Titanic { class CPetDragChev : public CPetGraphic2 { + DECLARE_MESSAGE_MAP +protected: + bool MouseDragStartMsg(CMouseDragStartMsg *msg); + bool MouseDragMoveMsg(CMouseDragMoveMsg *msg); + bool MouseDragEndMsg(CMouseDragEndMsg *msg); public: CLASSDEF diff --git a/engines/titanic/pet_control/pet_graphic.cpp b/engines/titanic/pet_control/pet_graphic.cpp index 3586c4de67..797c560ab0 100644 --- a/engines/titanic/pet_control/pet_graphic.cpp +++ b/engines/titanic/pet_control/pet_graphic.cpp @@ -24,6 +24,9 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CPetGraphic, CGameObject) +END_MESSAGE_MAP() + void CPetGraphic::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/pet_control/pet_graphic.h b/engines/titanic/pet_control/pet_graphic.h index 112d75a870..d49d0d4a1a 100644 --- a/engines/titanic/pet_control/pet_graphic.h +++ b/engines/titanic/pet_control/pet_graphic.h @@ -28,6 +28,7 @@ namespace Titanic { class CPetGraphic : public CGameObject { + DECLARE_MESSAGE_MAP public: CLASSDEF diff --git a/engines/titanic/pet_control/pet_graphic2.cpp b/engines/titanic/pet_control/pet_graphic2.cpp index d4871e8c78..ef898194e8 100644 --- a/engines/titanic/pet_control/pet_graphic2.cpp +++ b/engines/titanic/pet_control/pet_graphic2.cpp @@ -24,6 +24,9 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CPetGraphic2, CGameObject) +END_MESSAGE_MAP() + void CPetGraphic2::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/pet_control/pet_graphic2.h b/engines/titanic/pet_control/pet_graphic2.h index d9bb514915..d10dd102a0 100644 --- a/engines/titanic/pet_control/pet_graphic2.h +++ b/engines/titanic/pet_control/pet_graphic2.h @@ -28,6 +28,7 @@ namespace Titanic { class CPetGraphic2 : public CGameObject { + DECLARE_MESSAGE_MAP public: CLASSDEF diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 692c8b9100..faefb994cc 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -90,7 +90,10 @@ public: virtual bool KeyCharMsg(CKeyCharMsg *msg) { return false; } virtual bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { return false; } - virtual bool proc14(void *v1) { return false; } + /** + * Check whether a drag drop can occur + */ + virtual bool checkDragEnd(CGameObject *item) { return false; } /** * Returns item a drag-drop operation has dropped on, if any -- cgit v1.2.3 From d46d3f7b0dc6f3b401860f6274ebbf04710f06ca Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Apr 2016 15:14:14 -0400 Subject: TITANIC: Implementing more PET support widgets --- engines/titanic/pet_control/pet_mode_off.cpp | 3 +++ engines/titanic/pet_control/pet_mode_off.h | 1 + engines/titanic/pet_control/pet_mode_on.cpp | 3 +++ engines/titanic/pet_control/pet_mode_on.h | 1 + engines/titanic/pet_control/pet_mode_panel.cpp | 3 +++ engines/titanic/pet_control/pet_mode_panel.h | 1 + engines/titanic/pet_control/pet_pannel1.cpp | 3 +++ engines/titanic/pet_control/pet_pannel1.h | 1 + engines/titanic/pet_control/pet_pannel2.cpp | 3 +++ engines/titanic/pet_control/pet_pannel2.h | 1 + engines/titanic/pet_control/pet_pannel3.cpp | 3 +++ engines/titanic/pet_control/pet_pannel3.h | 1 + 12 files changed, 24 insertions(+) diff --git a/engines/titanic/pet_control/pet_mode_off.cpp b/engines/titanic/pet_control/pet_mode_off.cpp index f4eac74837..3d3eb376c8 100644 --- a/engines/titanic/pet_control/pet_mode_off.cpp +++ b/engines/titanic/pet_control/pet_mode_off.cpp @@ -24,6 +24,9 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CPetModeOff, CToggleSwitch) +END_MESSAGE_MAP() + CPetModeOff::CPetModeOff() : CToggleSwitch() { } diff --git a/engines/titanic/pet_control/pet_mode_off.h b/engines/titanic/pet_control/pet_mode_off.h index ea88255b93..a84ed30480 100644 --- a/engines/titanic/pet_control/pet_mode_off.h +++ b/engines/titanic/pet_control/pet_mode_off.h @@ -28,6 +28,7 @@ namespace Titanic { class CPetModeOff : public CToggleSwitch { + DECLARE_MESSAGE_MAP public: CLASSDEF CPetModeOff(); diff --git a/engines/titanic/pet_control/pet_mode_on.cpp b/engines/titanic/pet_control/pet_mode_on.cpp index 8eb839f241..bde318bfcf 100644 --- a/engines/titanic/pet_control/pet_mode_on.cpp +++ b/engines/titanic/pet_control/pet_mode_on.cpp @@ -24,6 +24,9 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CPetModeOn, CToggleSwitch) +END_MESSAGE_MAP() + CPetModeOn::CPetModeOn() : CToggleSwitch() { } diff --git a/engines/titanic/pet_control/pet_mode_on.h b/engines/titanic/pet_control/pet_mode_on.h index 1434fb20db..76e0c92607 100644 --- a/engines/titanic/pet_control/pet_mode_on.h +++ b/engines/titanic/pet_control/pet_mode_on.h @@ -28,6 +28,7 @@ namespace Titanic { class CPetModeOn : public CToggleSwitch { + DECLARE_MESSAGE_MAP public: CLASSDEF CPetModeOn(); diff --git a/engines/titanic/pet_control/pet_mode_panel.cpp b/engines/titanic/pet_control/pet_mode_panel.cpp index 1919d88fac..1890f9a30a 100644 --- a/engines/titanic/pet_control/pet_mode_panel.cpp +++ b/engines/titanic/pet_control/pet_mode_panel.cpp @@ -24,6 +24,9 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CPetModePanel, CToggleSwitch) +END_MESSAGE_MAP() + CPetModePanel::CPetModePanel() : CToggleSwitch() { } diff --git a/engines/titanic/pet_control/pet_mode_panel.h b/engines/titanic/pet_control/pet_mode_panel.h index ef68ca8b06..b55f38a6ff 100644 --- a/engines/titanic/pet_control/pet_mode_panel.h +++ b/engines/titanic/pet_control/pet_mode_panel.h @@ -28,6 +28,7 @@ namespace Titanic { class CPetModePanel : public CToggleSwitch { + DECLARE_MESSAGE_MAP public: CLASSDEF CPetModePanel(); diff --git a/engines/titanic/pet_control/pet_pannel1.cpp b/engines/titanic/pet_control/pet_pannel1.cpp index 8245d7e90a..01e2b930dd 100644 --- a/engines/titanic/pet_control/pet_pannel1.cpp +++ b/engines/titanic/pet_control/pet_pannel1.cpp @@ -24,6 +24,9 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CPetPannel1, CPetGraphic) +END_MESSAGE_MAP() + void CPetPannel1::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CPetGraphic::save(file, indent); diff --git a/engines/titanic/pet_control/pet_pannel1.h b/engines/titanic/pet_control/pet_pannel1.h index 7a16d8c842..4e145363d4 100644 --- a/engines/titanic/pet_control/pet_pannel1.h +++ b/engines/titanic/pet_control/pet_pannel1.h @@ -28,6 +28,7 @@ namespace Titanic { class CPetPannel1 : public CPetGraphic { + DECLARE_MESSAGE_MAP public: CLASSDEF diff --git a/engines/titanic/pet_control/pet_pannel2.cpp b/engines/titanic/pet_control/pet_pannel2.cpp index a04f63fee8..e55468d492 100644 --- a/engines/titanic/pet_control/pet_pannel2.cpp +++ b/engines/titanic/pet_control/pet_pannel2.cpp @@ -24,6 +24,9 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CPetPannel2, CPetGraphic) +END_MESSAGE_MAP() + void CPetPannel2::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CPetGraphic::save(file, indent); diff --git a/engines/titanic/pet_control/pet_pannel2.h b/engines/titanic/pet_control/pet_pannel2.h index 7296eab507..b32e10e0db 100644 --- a/engines/titanic/pet_control/pet_pannel2.h +++ b/engines/titanic/pet_control/pet_pannel2.h @@ -28,6 +28,7 @@ namespace Titanic { class CPetPannel2 : public CPetGraphic { + DECLARE_MESSAGE_MAP public: CLASSDEF diff --git a/engines/titanic/pet_control/pet_pannel3.cpp b/engines/titanic/pet_control/pet_pannel3.cpp index 5d0fd93d7b..ea623a33a8 100644 --- a/engines/titanic/pet_control/pet_pannel3.cpp +++ b/engines/titanic/pet_control/pet_pannel3.cpp @@ -24,6 +24,9 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CPetPannel3, CPetGraphic) +END_MESSAGE_MAP() + void CPetPannel3::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CPetGraphic::save(file, indent); diff --git a/engines/titanic/pet_control/pet_pannel3.h b/engines/titanic/pet_control/pet_pannel3.h index 2bdbf1fb31..f80456f006 100644 --- a/engines/titanic/pet_control/pet_pannel3.h +++ b/engines/titanic/pet_control/pet_pannel3.h @@ -28,6 +28,7 @@ namespace Titanic { class CPetPannel3 : public CPetGraphic { + DECLARE_MESSAGE_MAP public: CLASSDEF -- cgit v1.2.3 From b013d10d8f44e9f611ff205304f451e4e35ee14e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Apr 2016 16:52:42 -0400 Subject: TITANIC: Implementing PET Nav Helmet section --- engines/titanic/module.mk | 2 +- engines/titanic/pet_control/pet_control.cpp | 12 +- engines/titanic/pet_control/pet_control.h | 4 +- engines/titanic/pet_control/pet_control_sub5.cpp | 48 ------- engines/titanic/pet_control/pet_control_sub5.h | 68 ---------- engines/titanic/pet_control/pet_frame.cpp | 2 +- engines/titanic/pet_control/pet_nav_helmet.cpp | 156 +++++++++++++++++++++++ engines/titanic/pet_control/pet_nav_helmet.h | 105 +++++++++++++++ engines/titanic/pet_control/pet_section.h | 2 +- 9 files changed, 272 insertions(+), 127 deletions(-) delete mode 100644 engines/titanic/pet_control/pet_control_sub5.cpp delete mode 100644 engines/titanic/pet_control/pet_control_sub5.h create mode 100644 engines/titanic/pet_control/pet_nav_helmet.cpp create mode 100644 engines/titanic/pet_control/pet_nav_helmet.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 6875e9032d..80041d80af 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -362,12 +362,12 @@ MODULE_OBJS := \ pet_control/pet_gfx_element.o \ pet_control/pet_inventory.o \ pet_control/pet_inventory_glyphs.o \ + pet_control/pet_nav_helmet.o \ pet_control/pet_rooms.o \ pet_control/pet_rooms_glyphs.o \ pet_control/pet_remote.o \ pet_control/pet_real_life.o \ pet_control/pet_section.o \ - pet_control/pet_control_sub5.o \ pet_control/pet_control_sub7.o \ pet_control/pet_drag_chev.o \ pet_control/pet_graphic2.o \ diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 6be026167a..7a5fc90828 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -51,7 +51,7 @@ CPetControl::CPetControl() : CGameObject(), _sections[PET_REMOTE] = &_remote; _sections[PET_ROOMS] = &_rooms; _sections[PET_REAL_LIFE] = &_realLife; - _sections[PET_5] = &_sub5; + _sections[PET_NAV_HELMET] = &_navHelmet; _sections[PET_6] = &_sub7; } @@ -85,7 +85,7 @@ void CPetControl::setup() { _rooms.setup(this); _remote.setup(this); _inventory.setup(this); - _sub5.setup(this); + _navHelmet.setup(this); _realLife.setup(this); _sub7.setup(this); _frame.setup(this); @@ -96,7 +96,7 @@ bool CPetControl::isValid() { _rooms.isValid(this) && _remote.isValid(this) && _inventory.isValid(this) && - _sub5.isValid(this) && + _navHelmet.isValid(this) && _realLife.isValid(this) && _sub7.isValid(this) && _frame.isValid(this); @@ -107,7 +107,7 @@ void CPetControl::loadAreas(SimpleFile *file, int param) { _rooms.load(file, param); _remote.load(file, param); _inventory.load(file, param); - _sub5.load(file, param); + _navHelmet.load(file, param); _realLife.load(file, param); _sub7.load(file, param); _frame.load(file, param); @@ -118,7 +118,7 @@ void CPetControl::saveAreas(SimpleFile *file, int indent) const { _rooms.save(file, indent); _remote.save(file, indent); _inventory.save(file, indent); - _sub5.save(file, indent); + _navHelmet.save(file, indent); _realLife.save(file, indent); _sub7.save(file, indent); _frame.save(file, indent); @@ -163,7 +163,7 @@ void CPetControl::loaded() { _rooms.postLoad(); _remote.postLoad(); _inventory.postLoad(); - _sub5.postLoad(); + _navHelmet.postLoad(); _realLife.postLoad(); _sub7.postLoad(); _frame.postLoad(); diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index b4c460e8bb..96c46a6845 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -31,10 +31,10 @@ #include "titanic/pet_control/pet_conversations.h" #include "titanic/pet_control/pet_frame.h" #include "titanic/pet_control/pet_inventory.h" +#include "titanic/pet_control/pet_nav_helmet.h" #include "titanic/pet_control/pet_real_life.h" #include "titanic/pet_control/pet_remote.h" #include "titanic/pet_control/pet_rooms.h" -#include "titanic/pet_control/pet_control_sub5.h" #include "titanic/pet_control/pet_control_sub7.h" namespace Titanic { @@ -55,10 +55,10 @@ private: CPetSection *_sections[7]; CPetConversations _conversations; CPetInventory _inventory; + CPetNavHelmet _navHelmet; CPetRemote _remote; CPetRooms _rooms; CPetRealLife _realLife; - CPetControlSub5 _sub5; CPetControlSub7 _sub7; CPetFrame _frame; CString _activeNPCName; diff --git a/engines/titanic/pet_control/pet_control_sub5.cpp b/engines/titanic/pet_control/pet_control_sub5.cpp deleted file mode 100644 index 0b43853704..0000000000 --- a/engines/titanic/pet_control/pet_control_sub5.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* 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 "titanic/pet_control/pet_control_sub5.h" - -namespace Titanic { - -CPetControlSub5::CPetControlSub5() : - _field98(0), _field9C(0), _fieldA0(0), - _field18C(0), _field20C(0), _field210(0) { -} - -void CPetControlSub5::save(SimpleFile *file, int indent) const { - -} - -void CPetControlSub5::load(SimpleFile *file, int param) { - if (!param) { - _field20C = file->readNumber(); - _field210 = file->readNumber(); - } -} - -bool CPetControlSub5::isValid(CPetControl *petControl) { - // TODO - return true; -} - -} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub5.h b/engines/titanic/pet_control/pet_control_sub5.h deleted file mode 100644 index 560803d938..0000000000 --- a/engines/titanic/pet_control/pet_control_sub5.h +++ /dev/null @@ -1,68 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_CONTROL_SUB5_H -#define TITANIC_PET_CONTROL_SUB5_H - -#include "titanic/pet_control/pet_section.h" -#include "titanic/pet_control/pet_text.h" -#include "titanic/pet_control/pet_gfx_element.h" - -namespace Titanic { - -class CPetControlSub5 : public CPetSection { -private: - CPetGfxElement _val1; - CPetGfxElement _val2; - CPetGfxElement _val3; - CPetGfxElement _val4; - int _field98; - int _field9C; - int _fieldA0; - CPetGfxElement _valArray1[6]; - int _field17C; - int _field18C; - CPetText _text; - int _field20C; - int _field210; -public: - CPetControlSub5(); - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file, int param); - - /** - * Returns true if the object is in a valid state - */ - virtual bool isValid(CPetControl *petControl); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_SUB5_H */ diff --git a/engines/titanic/pet_control/pet_frame.cpp b/engines/titanic/pet_control/pet_frame.cpp index ac4b3344c7..dd2be96cd9 100644 --- a/engines/titanic/pet_control/pet_frame.cpp +++ b/engines/titanic/pet_control/pet_frame.cpp @@ -27,7 +27,7 @@ namespace Titanic { static const PetArea PET_AREAS[6] = { PET_CONVERSATION, PET_INVENTORY, PET_REMOTE, - PET_ROOMS, PET_REAL_LIFE, PET_5 + PET_ROOMS, PET_REAL_LIFE, PET_NAV_HELMET }; CPetFrame::CPetFrame() : CPetSection() { diff --git a/engines/titanic/pet_control/pet_nav_helmet.cpp b/engines/titanic/pet_control/pet_nav_helmet.cpp new file mode 100644 index 0000000000..13f1989b64 --- /dev/null +++ b/engines/titanic/pet_control/pet_nav_helmet.cpp @@ -0,0 +1,156 @@ +/* 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 "titanic/pet_control/pet_nav_helmet.h" +#include "titanic/pet_control/pet_control.h" + +namespace Titanic { + +CPetNavHelmet::CPetNavHelmet() : + _field98(0), _field9C(0), _fieldA0(0), _field18C(0), + _field20C(1), _field210(0), _rect1(22, 352, 598, 478) { +} + +bool CPetNavHelmet::setup(CPetControl *petControl) { + if (petControl && setupControl(petControl)) + return reset(); + return false; +} + +bool CPetNavHelmet::reset() { + if (_petControl) { + _val1.setup(MODE_UNSELECTED, "3PetStarField", _petControl); + _val2.setup(MODE_UNSELECTED, "HomePhotoOnOff", _petControl); + _val3.setup(MODE_UNSELECTED, "3PetSetDestin", _petControl); + _val3.setup(MODE_SELECTED, "3PetSetDestin1", _petControl); + _val4.setup(MODE_UNSELECTED, "3PetStarCtrl", _petControl); + + _leds[0].setup(MODE_UNSELECTED, "LEDOff1", _petControl); + _leds[1].setup(MODE_UNSELECTED, "LEDOn1", _petControl); + _leds[2].setup(MODE_UNSELECTED, "LEDOff2", _petControl); + _leds[3].setup(MODE_UNSELECTED, "LEDOn2", _petControl); + _leds[4].setup(MODE_UNSELECTED, "LEDOff3", _petControl); + _leds[5].setup(MODE_UNSELECTED, "LEDOn3", _petControl); + + uint col = getColor(0); + _text.setColor(col); + _text.setLineColor(0, col); + } + + return true; +} + +void CPetNavHelmet::draw(CScreenManager *screenManager) { + _petControl->drawSquares(screenManager, 2); + + if (_field20C) { + _val2.draw(screenManager); + } else { + _val4.draw(screenManager); + } + + _val3.draw(screenManager); + drawButton(_field98, 0, screenManager); + drawButton(_field9C, 2, screenManager); + drawButton(_fieldA0, 4, screenManager); + _text.draw(screenManager); +} + +bool CPetNavHelmet::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + return false; +} + +bool CPetNavHelmet::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + return false; +} + +bool CPetNavHelmet::isValid(CPetControl *petControl) { + return setupControl(petControl); +} + +void CPetNavHelmet::load(SimpleFile *file, int param) { + if (!param) { + _field20C = file->readNumber(); + _field210 = file->readNumber(); + } +} + +void CPetNavHelmet::postLoad() { + reset(); +} + +void CPetNavHelmet::save(SimpleFile *file, int indent) const { + file->writeNumberLine(_field20C, indent); + file->writeNumberLine(_field210, indent); +} + +bool CPetNavHelmet::setupControl(CPetControl *petControl) { + if (petControl) { + _petControl = petControl; + + Rect r(0, 0, 64, 64); + r.translate(_rect1.left, _rect1.top); + + _val1.setBounds(r); + _val1.translate(15, 23); + _val2.setBounds(r); + _val2.translate(85, 23); + _val4.setBounds(r); + _val4.translate(85, 23); + + r = Rect(0, 0, 34, 34); + r.translate(468, 396); + _leds[0].setBounds(r); + _leds[1].setBounds(r); + + r.translate(36, 0); + _leds[2].setBounds(r); + _leds[3].setBounds(r); + + r.translate(36, 0); + _leds[4].setBounds(r); + _leds[5].setBounds(r); + + r = Rect(0, 0, 157, 51); + r.translate(224, 33); + r.translate(20, 350); + _val3.setBounds(r); + + r = Rect(0, 0, 580, 15); + r.translate(32, 445); + _text.setBounds(r); + _text.setHasBorder(false); + } + + return true; +} + +void CPetNavHelmet::drawButton(int offset, int index, CScreenManager *screenManager) { + if (_field18C < 4 && (offset / 3) == 1) + --offset; + if (offset == 2) + offset = 1; + + _leds[index + offset].draw(screenManager); +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_nav_helmet.h b/engines/titanic/pet_control/pet_nav_helmet.h new file mode 100644 index 0000000000..f47520d548 --- /dev/null +++ b/engines/titanic/pet_control/pet_nav_helmet.h @@ -0,0 +1,105 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_NAV_HELMET_H +#define TITANIC_PET_NAV_HELMET_H + +#include "titanic/pet_control/pet_section.h" +#include "titanic/pet_control/pet_text.h" +#include "titanic/pet_control/pet_gfx_element.h" + +namespace Titanic { + +class CPetNavHelmet : public CPetSection { +private: + CPetGfxElement _val1; + CPetGfxElement _val2; + CPetGfxElement _val3; + CPetGfxElement _val4; + int _field98; + int _field9C; + int _fieldA0; + CPetGfxElement _leds[6]; + Rect _rect1; + int _field18C; + CPetText _text; + int _field20C; + int _field210; +private: + /** + * Setup the control + */ + bool setupControl(CPetControl *petControl); + + /** + * Draw a button + */ + void drawButton(int offset, int index, CScreenManager *screenManager); +public: + CPetNavHelmet(); + + /** + * Sets up the section + */ + virtual bool setup(CPetControl *petControl); + + /** + * Reset the section + */ + virtual bool reset(); + + /** + * Draw the section + */ + virtual void draw(CScreenManager *screenManager); + + /** + * Following are handlers for the various messages that the PET can + * pass onto the currently active section/area + */ + virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); + + /** + * Returns true if the object is in a valid state + */ + virtual bool isValid(CPetControl *petControl); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file, int param); + + /** + * Called after a game has been loaded + */ + virtual void postLoad(); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_NAV_HELMET_H */ diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index faefb994cc..81485ec44c 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -30,7 +30,7 @@ namespace Titanic { enum PetArea { PET_INVENTORY = 0, PET_CONVERSATION = 1, PET_REMOTE = 2, - PET_ROOMS = 3, PET_REAL_LIFE = 4, PET_5 = 5, PET_6 = 6 + PET_ROOMS = 3, PET_REAL_LIFE = 4, PET_NAV_HELMET = 5, PET_6 = 6 }; class CPetControl; -- cgit v1.2.3 From ecb14e9bc235df216fdcb8426688b455043f2ad0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Apr 2016 17:16:22 -0400 Subject: TITANIC: Implement more NavHelmet section --- engines/titanic/pet_control/pet_control.h | 2 +- engines/titanic/pet_control/pet_nav_helmet.cpp | 46 ++++++++++++++++++++------ engines/titanic/pet_control/pet_nav_helmet.h | 4 +-- 3 files changed, 39 insertions(+), 13 deletions(-) diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 96c46a6845..7ebdbbdfa2 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -62,7 +62,6 @@ private: CPetControlSub7 _sub7; CPetFrame _frame; CString _activeNPCName; - CTreeItem *_treeItem2; CString _string2; CRoomItem *_hiddenRoom; Rect _drawBounds; @@ -114,6 +113,7 @@ protected: public: PetArea _currentArea; CTreeItem *_activeNPC; + CTreeItem *_treeItem2; public: CLASSDEF CPetControl(); diff --git a/engines/titanic/pet_control/pet_nav_helmet.cpp b/engines/titanic/pet_control/pet_nav_helmet.cpp index 13f1989b64..7697df40f6 100644 --- a/engines/titanic/pet_control/pet_nav_helmet.cpp +++ b/engines/titanic/pet_control/pet_nav_helmet.cpp @@ -22,12 +22,13 @@ #include "titanic/pet_control/pet_nav_helmet.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/messages/pet_messages.h" namespace Titanic { CPetNavHelmet::CPetNavHelmet() : _field98(0), _field9C(0), _fieldA0(0), _field18C(0), - _field20C(1), _field210(0), _rect1(22, 352, 598, 478) { + _photoOn(true), _field210(0), _rect1(22, 352, 598, 478) { } bool CPetNavHelmet::setup(CPetControl *petControl) { @@ -40,8 +41,8 @@ bool CPetNavHelmet::reset() { if (_petControl) { _val1.setup(MODE_UNSELECTED, "3PetStarField", _petControl); _val2.setup(MODE_UNSELECTED, "HomePhotoOnOff", _petControl); - _val3.setup(MODE_UNSELECTED, "3PetSetDestin", _petControl); - _val3.setup(MODE_SELECTED, "3PetSetDestin1", _petControl); + _setDestination.setup(MODE_UNSELECTED, "3PetSetDestin", _petControl); + _setDestination.setup(MODE_SELECTED, "3PetSetDestin1", _petControl); _val4.setup(MODE_UNSELECTED, "3PetStarCtrl", _petControl); _leds[0].setup(MODE_UNSELECTED, "LEDOff1", _petControl); @@ -62,13 +63,13 @@ bool CPetNavHelmet::reset() { void CPetNavHelmet::draw(CScreenManager *screenManager) { _petControl->drawSquares(screenManager, 2); - if (_field20C) { + if (_photoOn) { _val2.draw(screenManager); } else { _val4.draw(screenManager); } - _val3.draw(screenManager); + _setDestination.draw(screenManager); drawButton(_field98, 0, screenManager); drawButton(_field9C, 2, screenManager); drawButton(_fieldA0, 4, screenManager); @@ -76,11 +77,36 @@ void CPetNavHelmet::draw(CScreenManager *screenManager) { } bool CPetNavHelmet::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { - return false; + if (!_petControl->_treeItem2) + return false; + + if (_val1.MouseButtonDownMsg(msg->_mousePos)) { + CPETHelmetOnOffMsg helmetMsg; + helmetMsg.execute(_petControl->_treeItem2); + } else if (_val2.MouseButtonDownMsg(msg->_mousePos)) { + if (_field210) { + _photoOn = !_photoOn; + CPETPhotoOnOffMsg photoMsg; + photoMsg.execute(_petControl->_treeItem2); + } else { + _petControl->displayMessage("Please supply Galactic reference material."); + } + } else if (_setDestination.MouseButtonDownMsg(msg->_mousePos)) { + warning("TODO: CPetNavHelmet::MouseButtonDownMsg"); + } + + return true; } bool CPetNavHelmet::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { - return false; + if (!_petControl->_treeItem2 || !_setDestination.MouseButtonUpMsg(msg->_mousePos)) + return false; + + if (_petControl) { + warning("TODO: CPetNavHelmet::MouseButtonUpMsg"); + } + + return true; } bool CPetNavHelmet::isValid(CPetControl *petControl) { @@ -89,7 +115,7 @@ bool CPetNavHelmet::isValid(CPetControl *petControl) { void CPetNavHelmet::load(SimpleFile *file, int param) { if (!param) { - _field20C = file->readNumber(); + _photoOn = file->readNumber(); _field210 = file->readNumber(); } } @@ -99,7 +125,7 @@ void CPetNavHelmet::postLoad() { } void CPetNavHelmet::save(SimpleFile *file, int indent) const { - file->writeNumberLine(_field20C, indent); + file->writeNumberLine(_photoOn, indent); file->writeNumberLine(_field210, indent); } @@ -133,7 +159,7 @@ bool CPetNavHelmet::setupControl(CPetControl *petControl) { r = Rect(0, 0, 157, 51); r.translate(224, 33); r.translate(20, 350); - _val3.setBounds(r); + _setDestination.setBounds(r); r = Rect(0, 0, 580, 15); r.translate(32, 445); diff --git a/engines/titanic/pet_control/pet_nav_helmet.h b/engines/titanic/pet_control/pet_nav_helmet.h index f47520d548..09504a1b27 100644 --- a/engines/titanic/pet_control/pet_nav_helmet.h +++ b/engines/titanic/pet_control/pet_nav_helmet.h @@ -33,7 +33,7 @@ class CPetNavHelmet : public CPetSection { private: CPetGfxElement _val1; CPetGfxElement _val2; - CPetGfxElement _val3; + CPetGfxElement _setDestination; CPetGfxElement _val4; int _field98; int _field9C; @@ -42,7 +42,7 @@ private: Rect _rect1; int _field18C; CPetText _text; - int _field20C; + bool _photoOn; int _field210; private: /** -- cgit v1.2.3 From a15e299a06c8049cf4332ea2bf4b77ad0bd845e1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Apr 2016 17:50:19 -0400 Subject: TITANIC: Implement messages PET section --- engines/titanic/module.mk | 2 +- engines/titanic/pet_control/pet_control.cpp | 12 +-- engines/titanic/pet_control/pet_control.h | 4 +- engines/titanic/pet_control/pet_control_sub7.cpp | 32 -------- engines/titanic/pet_control/pet_control_sub7.h | 44 ----------- engines/titanic/pet_control/pet_frame.cpp | 2 +- engines/titanic/pet_control/pet_message.cpp | 57 ++++++++++++++ engines/titanic/pet_control/pet_message.h | 96 ++++++++++++++++++++++++ engines/titanic/pet_control/pet_section.h | 2 +- 9 files changed, 164 insertions(+), 87 deletions(-) delete mode 100644 engines/titanic/pet_control/pet_control_sub7.cpp delete mode 100644 engines/titanic/pet_control/pet_control_sub7.h create mode 100644 engines/titanic/pet_control/pet_message.cpp create mode 100644 engines/titanic/pet_control/pet_message.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 80041d80af..a9d758b57f 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -362,13 +362,13 @@ MODULE_OBJS := \ pet_control/pet_gfx_element.o \ pet_control/pet_inventory.o \ pet_control/pet_inventory_glyphs.o \ + pet_control/pet_message.o \ pet_control/pet_nav_helmet.o \ pet_control/pet_rooms.o \ pet_control/pet_rooms_glyphs.o \ pet_control/pet_remote.o \ pet_control/pet_real_life.o \ pet_control/pet_section.o \ - pet_control/pet_control_sub7.o \ pet_control/pet_drag_chev.o \ pet_control/pet_graphic2.o \ pet_control/pet_graphic.o \ diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 7a5fc90828..2bd8864998 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -52,7 +52,7 @@ CPetControl::CPetControl() : CGameObject(), _sections[PET_ROOMS] = &_rooms; _sections[PET_REAL_LIFE] = &_realLife; _sections[PET_NAV_HELMET] = &_navHelmet; - _sections[PET_6] = &_sub7; + _sections[PET_MESSAGE] = &_message; } void CPetControl::save(SimpleFile *file, int indent) const { @@ -87,7 +87,7 @@ void CPetControl::setup() { _inventory.setup(this); _navHelmet.setup(this); _realLife.setup(this); - _sub7.setup(this); + _message.setup(this); _frame.setup(this); } @@ -98,7 +98,7 @@ bool CPetControl::isValid() { _inventory.isValid(this) && _navHelmet.isValid(this) && _realLife.isValid(this) && - _sub7.isValid(this) && + _message.isValid(this) && _frame.isValid(this); } @@ -109,7 +109,7 @@ void CPetControl::loadAreas(SimpleFile *file, int param) { _inventory.load(file, param); _navHelmet.load(file, param); _realLife.load(file, param); - _sub7.load(file, param); + _message.load(file, param); _frame.load(file, param); } @@ -120,7 +120,7 @@ void CPetControl::saveAreas(SimpleFile *file, int indent) const { _inventory.save(file, indent); _navHelmet.save(file, indent); _realLife.save(file, indent); - _sub7.save(file, indent); + _message.save(file, indent); _frame.save(file, indent); } @@ -165,7 +165,7 @@ void CPetControl::loaded() { _inventory.postLoad(); _navHelmet.postLoad(); _realLife.postLoad(); - _sub7.postLoad(); + _message.postLoad(); _frame.postLoad(); } diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 7ebdbbdfa2..2c706397ea 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -31,11 +31,11 @@ #include "titanic/pet_control/pet_conversations.h" #include "titanic/pet_control/pet_frame.h" #include "titanic/pet_control/pet_inventory.h" +#include "titanic/pet_control/pet_message.h" #include "titanic/pet_control/pet_nav_helmet.h" #include "titanic/pet_control/pet_real_life.h" #include "titanic/pet_control/pet_remote.h" #include "titanic/pet_control/pet_rooms.h" -#include "titanic/pet_control/pet_control_sub7.h" namespace Titanic { @@ -59,7 +59,7 @@ private: CPetRemote _remote; CPetRooms _rooms; CPetRealLife _realLife; - CPetControlSub7 _sub7; + CPetMessage _message; CPetFrame _frame; CString _activeNPCName; CString _string2; diff --git a/engines/titanic/pet_control/pet_control_sub7.cpp b/engines/titanic/pet_control/pet_control_sub7.cpp deleted file mode 100644 index 5b033220c7..0000000000 --- a/engines/titanic/pet_control/pet_control_sub7.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 "titanic/pet_control/pet_control_sub7.h" - -namespace Titanic { - -bool CPetControlSub7::isValid(CPetControl *petControl) { - // TODO - return true; -} - -} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control_sub7.h b/engines/titanic/pet_control/pet_control_sub7.h deleted file mode 100644 index 367ce840fc..0000000000 --- a/engines/titanic/pet_control/pet_control_sub7.h +++ /dev/null @@ -1,44 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_CONTROL_SUB7_H -#define TITANIC_PET_CONTROL_SUB7_H - -#include "titanic/pet_control/pet_section.h" -#include "titanic/pet_control/pet_text.h" - -namespace Titanic { - -class CPetControlSub7 : public CPetSection { -private: - CPetText _text1; - CPetText _text2; -public: - /** - * Returns true if the object is in a valid state - */ - virtual bool isValid(CPetControl *petControl); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_CONTROL_SUB7_H */ diff --git a/engines/titanic/pet_control/pet_frame.cpp b/engines/titanic/pet_control/pet_frame.cpp index dd2be96cd9..4c3c518962 100644 --- a/engines/titanic/pet_control/pet_frame.cpp +++ b/engines/titanic/pet_control/pet_frame.cpp @@ -126,7 +126,7 @@ bool CPetFrame::setPetControl(CPetControl *petControl) { void CPetFrame::setArea(PetArea newArea) { resetArea(); - if (newArea < PET_6) + if (newArea < PET_MESSAGE) _modeButtons[PET_AREAS[newArea]].setMode(MODE_SELECTED); } diff --git a/engines/titanic/pet_control/pet_message.cpp b/engines/titanic/pet_control/pet_message.cpp new file mode 100644 index 0000000000..783c9019e2 --- /dev/null +++ b/engines/titanic/pet_control/pet_message.cpp @@ -0,0 +1,57 @@ +/* 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 "titanic/pet_control/pet_message.h" + +namespace Titanic { + +CPetMessage::CPetMessage() { + Rect rect1(0, 0, 580, 70); + rect1.translate(32, 368); + _message.setBounds(rect1); + _message.resize(50); + _message.setHasBorder(false); + + Rect rect2(0, 0, 580, 15); + rect2.translate(32, 445); + _tooltip.setBounds(rect2); + _tooltip.setHasBorder(false); +} + +bool CPetMessage::setup(CPetControl *petControl) { + if (petControl && setupControl(petControl)) + return reset(); + return false; +} + +void CPetMessage::draw(CScreenManager *screenManager) { + _message.draw(screenManager); + _tooltip.draw(screenManager); +} + +bool CPetMessage::setupControl(CPetControl *petControl) { + if (petControl) + _petControl = petControl; + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_message.h b/engines/titanic/pet_control/pet_message.h new file mode 100644 index 0000000000..1ad031da65 --- /dev/null +++ b/engines/titanic/pet_control/pet_message.h @@ -0,0 +1,96 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_MESSAGE_H +#define TITANIC_PET_MESSAGE_H + +#include "titanic/pet_control/pet_section.h" +#include "titanic/pet_control/pet_text.h" + +namespace Titanic { + +class CPetMessage : public CPetSection { +private: + CPetText _message; + CPetText _tooltip; +private: + /** + * Setup the control + */ + bool setupControl(CPetControl *petControl); +public: + CPetMessage(); + + /** + * Sets up the section + */ + virtual bool setup(CPetControl *petControl); + + /** + * Reset the section + */ + virtual bool reset() { return true; } + + /** + * Draw the section + */ + virtual void draw(CScreenManager *screenManager); + + /** + * Following are handlers for the various messages that the PET can + * pass onto the currently active section/area + */ + virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg) { return false; } + virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg) { return false; } + + /** + * Returns true if the object is in a valid state + */ + virtual bool isValid(CPetControl *petControl) { + return setupControl(petControl); + } + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file, int param) {} + + /** + * Called after a game has been loaded + */ + virtual void postLoad() { reset(); } + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const {} + + /** + * Get a reference to the tooltip text associated with the section + */ + virtual CPetText *getText() { return &_tooltip; } + +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_MESSAGE_H */ diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 81485ec44c..0d7ede6230 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -30,7 +30,7 @@ namespace Titanic { enum PetArea { PET_INVENTORY = 0, PET_CONVERSATION = 1, PET_REMOTE = 2, - PET_ROOMS = 3, PET_REAL_LIFE = 4, PET_NAV_HELMET = 5, PET_6 = 6 + PET_ROOMS = 3, PET_REAL_LIFE = 4, PET_NAV_HELMET = 5, PET_MESSAGE = 6 }; class CPetControl; -- cgit v1.2.3 From 65dbc2a26505e79c51351eda10195e8425460a87 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Apr 2016 18:27:55 -0400 Subject: TITANIC: Resolve Pet Text fontNumber fields, getting npc nums --- engines/titanic/pet_control/pet_conversations.cpp | 8 ++-- engines/titanic/pet_control/pet_text.cpp | 47 +++++++++++++++++------ engines/titanic/pet_control/pet_text.h | 10 +++-- 3 files changed, 47 insertions(+), 18 deletions(-) diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index bf26898891..090952dbe2 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -112,9 +112,11 @@ void CPetConversations::draw(CScreenManager *screenManager) { _textInput.draw(screenManager); if (_logChanged) { - int fontNumber = _log.getFontNumber(); - if (fontNumber >= 0) { - warning("TODO conversation draw"); + int startIndex = _log.getLinesStart(); + if (startIndex >= 0) { + int npcNum = _log.getNPCNum(1, startIndex); + if (npcNum > 0 && npcNum < 10) + _npcNum = npcNum; } _logChanged = false; diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index 6f870faa32..a1cc75cb42 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -26,10 +26,10 @@ namespace Titanic { CPetText::CPetText(uint count) : _stringsMerged(false), _maxCharsPerLine(-1), _lineCount(0), - _fontNumber1(-1), _field3C(0), _field40(0), _field44(0), + _linesStart(-1), _field3C(0), _field40(0), _field44(0), _backR(0xff), _backG(0xff), _backB(0xff), _textR(0), _textG(0), _textB(200), - _fontNumber2(0), _field64(0), _field68(0), _field6C(0), + _fontNumber(0), _field64(0), _field68(0), _field6C(0), _hasBorder(true), _scrollTop(0), _textCursor(nullptr), _field7C(0) { setupArrays(count); } @@ -162,11 +162,11 @@ void CPetText::draw(CScreenManager *screenManager) { tempRect = _bounds; tempRect.grow(-2); - screenManager->setFontNumber(_fontNumber2); + int oldFontNumber = screenManager->setFontNumber(_fontNumber); screenManager->writeString(SURFACE_BACKBUFFER, tempRect, _scrollTop, _lines, _textCursor); - screenManager->setFontNumber(_fontNumber1); + screenManager->setFontNumber(oldFontNumber); } void CPetText::mergeStrings() { @@ -255,7 +255,7 @@ void CPetText::updateStr3(int lineNum) { int CPetText::getTextHeight(CScreenManager *screenManager) { mergeStrings(); - int oldFontNumber = screenManager->setFontNumber(_fontNumber2); + int oldFontNumber = screenManager->setFontNumber(_fontNumber); int textHeight = screenManager->getTextBounds(_lines, _bounds.width()); screenManager->setFontNumber(oldFontNumber); @@ -275,28 +275,28 @@ void CPetText::setNPC(int val1, int npcId) { } void CPetText::scrollUp(CScreenManager *screenManager) { - int oldFontNumber = screenManager->setFontNumber(_fontNumber2); + int oldFontNumber = screenManager->setFontNumber(_fontNumber); _scrollTop -= screenManager->getFontHeight(); constrainScrollUp(screenManager); screenManager->setFontNumber(oldFontNumber); } void CPetText::scrollDown(CScreenManager *screenManager) { - int oldFontNumber = screenManager->setFontNumber(_fontNumber2); + int oldFontNumber = screenManager->setFontNumber(_fontNumber); _scrollTop += screenManager->getFontHeight(); constrainScrollDown(screenManager); screenManager->setFontNumber(oldFontNumber); } void CPetText::scrollUpPage(CScreenManager *screenManager) { - int oldFontNumber = screenManager->setFontNumber(_fontNumber2); + int oldFontNumber = screenManager->setFontNumber(_fontNumber); _scrollTop -= getPageHeight(screenManager); constrainScrollUp(screenManager); screenManager->setFontNumber(oldFontNumber); } void CPetText::scrollDownPage(CScreenManager *screenManager) { - int oldFontNumber = screenManager->setFontNumber(_fontNumber2); + int oldFontNumber = screenManager->setFontNumber(_fontNumber); _scrollTop += getPageHeight(screenManager); constrainScrollDown(screenManager); screenManager->setFontNumber(oldFontNumber); @@ -307,7 +307,7 @@ void CPetText::scrollToTop(CScreenManager *screenManager) { } void CPetText::scrollToBottom(CScreenManager *screenManager) { - int oldFontNumber = screenManager->setFontNumber(_fontNumber2); + int oldFontNumber = screenManager->setFontNumber(_fontNumber); _scrollTop = _bounds.height(); constrainScrollDown(screenManager); screenManager->setFontNumber(oldFontNumber); @@ -330,7 +330,7 @@ void CPetText::constrainScrollDown(CScreenManager *screenManager) { int CPetText::getPageHeight(CScreenManager *screenManager) { int textHeight = _bounds.height(); - int oldFontNumber = screenManager->setFontNumber(_fontNumber2); + int oldFontNumber = screenManager->setFontNumber(_fontNumber); int fontHeight = screenManager->getFontHeight(); screenManager->setFontNumber(oldFontNumber); @@ -410,4 +410,29 @@ void CPetText::hideCursor() { } } +int CPetText::getNPCNum(uint npcId, uint startIndex) { + if (!_stringsMerged) { + mergeStrings(); + if (!_stringsMerged) + return -1; + } + + int size = _lines.size(); + if (startIndex < 5 || startIndex >= size) + return -1; + + // Loop through string + for (const char *strP = _lines.c_str(); size >= 5; ++strP, --size) { + if (*strP == 26) { + byte id = *(strP - 2); + if (id == npcId) + return *(strP - 1); + } else if (*strP == 27) { + strP += 4; + } + } + + return - 1; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h index 9b914dcbc1..adbd1401ea 100644 --- a/engines/titanic/pet_control/pet_text.h +++ b/engines/titanic/pet_control/pet_text.h @@ -43,7 +43,7 @@ private: Rect _bounds; int _maxCharsPerLine; int _lineCount; - int _fontNumber1; + int _linesStart; int _field3C; int _field40; int _field44; @@ -53,7 +53,7 @@ private: int _textR; int _textG; int _textB; - int _fontNumber2; + int _fontNumber; int _field64; int _field68; int _field6C; @@ -175,9 +175,9 @@ public: void setNPC(int val1, int npcId); /** - * Get the font + * Get the index into _lines where on-screen text starts */ - int getFontNumber() const { return _fontNumber1; } + int getLinesStart() const { return _linesStart; } /** * Scroll the text up @@ -241,6 +241,8 @@ public: * Removes the cursor attached to the text */ void hideCursor(); + + int getNPCNum(uint npcId, uint startIndex); }; } // End of namespace Titanic -- cgit v1.2.3 From 2fb692321165ec5831877fcb60408dd45610f7bb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Apr 2016 19:47:49 -0400 Subject: TITANIC: Implement PET Text color remapping --- engines/titanic/pet_control/pet_conversations.cpp | 11 +++++++++- engines/titanic/pet_control/pet_conversations.h | 5 +++++ engines/titanic/pet_control/pet_text.cpp | 25 +++++++++++++++++++++++ engines/titanic/pet_control/pet_text.h | 10 +++++++++ 4 files changed, 50 insertions(+), 1 deletion(-) diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index 090952dbe2..76d293208b 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -88,7 +88,11 @@ bool CPetConversations::reset() { _textInput.setColor(col); _textInput.setLineColor(0, col); - warning("TODO: Setup log shaded palette?"); + // Replace the log colors with new 1st class ones + uint colors1[5], colors2[5]; + copyColors(2, colors1); + copyColors(1, colors2); + _log.remapColors(5, colors1, colors2); _log.setColor(getColor(2)); } @@ -479,4 +483,9 @@ CString CPetConversations::getActiveNPCName() const { return CString(); } +void CPetConversations::copyColors(uint tableNum, uint colors[5]) { + const uint *src = getColorTable(tableNum); + Common::copy(src, src + 5, colors); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index 1bc59419f1..57c7fbd9b2 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -126,6 +126,11 @@ private: * Returns the name of the currently active NPC, if any */ CString getActiveNPCName() const; + + /** + * Create a color table + */ + void copyColors(uint tableNum, uint colors[5]); public: CPetConversations(); virtual ~CPetConversations() {} diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index a1cc75cb42..1065e6f825 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -234,6 +234,31 @@ void CPetText::setColor(byte r, byte g, byte b) { _textB = b; } +void CPetText::remapColors(uint count, uint *srcColors, uint *destColors) { + if (_lineCount >= 0) { + int lineNum = 0; + int index1 = 0; + + for (int lineNum = 0; lineNum <= _lineCount; ++lineNum) { + // Get the rgb values + uint r = _array[lineNum]._rgb[1]; + uint g = _array[lineNum]._rgb[2]; + uint b = _array[lineNum]._rgb[3]; + uint color = r | (g << 8) | (b << 16); + + for (uint index = 0; index < count; ++index) { + if (color == srcColors[index]) { + // Found a match, so replace the color + setLineColor(lineNum, destColors[lineNum]); + break; + } + } + } + } + + _stringsMerged = false; +} + void CPetText::setMaxCharsPerLine(int maxChars) { if (maxChars >= -1 && maxChars < 257) _maxCharsPerLine = maxChars; diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h index adbd1401ea..930bf3da8b 100644 --- a/engines/titanic/pet_control/pet_text.h +++ b/engines/titanic/pet_control/pet_text.h @@ -242,7 +242,17 @@ public: */ void hideCursor(); + /** + * Get an NPC Number embedded within on-screen text. + * Used by the PET log to encode which NPC spoke + */ int getNPCNum(uint npcId, uint startIndex); + + /** + * Replaces any occurances of line colors that appear in the + * first list with the entry at the same index in the dest list + */ + void remapColors(uint count, uint *srcColors, uint *destColors); }; } // End of namespace Titanic -- cgit v1.2.3 From 2a107eb540d2058ee105b8a362d9288c1e463bfe Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Apr 2016 20:13:34 -0400 Subject: TITANIC: Simplify PET Element getBounds methods --- engines/titanic/pet_control/pet_conversations.cpp | 7 +++++-- engines/titanic/pet_control/pet_element.cpp | 5 ++--- engines/titanic/pet_control/pet_element.h | 2 +- engines/titanic/pet_control/pet_gfx_element.cpp | 18 ++++++++---------- engines/titanic/pet_control/pet_gfx_element.h | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index 76d293208b..bffcb6ddd2 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -131,8 +131,11 @@ void CPetConversations::draw(CScreenManager *screenManager) { } Rect CPetConversations::getBounds() { - // TODO - return Rect(); + Rect rect = _dials[0].getBounds(); + rect.combine(_dials[1].getBounds()); + rect.combine(_dials[2].getBounds()); + + return rect; } bool CPetConversations::isValid(CPetControl *petControl) { diff --git a/engines/titanic/pet_control/pet_element.cpp b/engines/titanic/pet_control/pet_element.cpp index bc1b8de44d..da37b35246 100644 --- a/engines/titanic/pet_control/pet_element.cpp +++ b/engines/titanic/pet_control/pet_element.cpp @@ -28,9 +28,8 @@ namespace Titanic { CPetElement::CPetElement() : _mode(MODE_UNSELECTED) {} -void CPetElement::getBounds(Rect *rect) { - if (rect) - *rect = Rect(); +Rect CPetElement::getBounds() const { + return Rect(); } bool CPetElement::MouseButtonDownMsg(const Point &pt) { diff --git a/engines/titanic/pet_control/pet_element.h b/engines/titanic/pet_control/pet_element.h index 38f5f539f2..578f306dff 100644 --- a/engines/titanic/pet_control/pet_element.h +++ b/engines/titanic/pet_control/pet_element.h @@ -67,7 +67,7 @@ public: /** * Get the bounds for the element */ - virtual void getBounds(Rect *rect); + virtual Rect getBounds() const; /** * Handles processing mouse button down messages diff --git a/engines/titanic/pet_control/pet_gfx_element.cpp b/engines/titanic/pet_control/pet_gfx_element.cpp index 491930f46f..2686bd9ace 100644 --- a/engines/titanic/pet_control/pet_gfx_element.cpp +++ b/engines/titanic/pet_control/pet_gfx_element.cpp @@ -76,17 +76,15 @@ void CPetGfxElement::draw(CScreenManager *screenManager, const Common::Point &de obj->draw(screenManager, destPos); } -void CPetGfxElement::getBounds(Rect *rect) { - if (rect) { - CGameObject *obj = getObject(); - if (!obj) - obj = _object0; +Rect CPetGfxElement::getBounds() const { + CGameObject *obj = getObject(); + if (!obj) + obj = _object0; - if (obj && obj->getSurface45()) - *rect = _bounds; - else - rect->clear(); - } + if (obj && obj->getSurface45()) + return _bounds; + else + return Rect(); } CGameObject *CPetGfxElement::getObject() const { diff --git a/engines/titanic/pet_control/pet_gfx_element.h b/engines/titanic/pet_control/pet_gfx_element.h index f33058f786..91d9b9ccb2 100644 --- a/engines/titanic/pet_control/pet_gfx_element.h +++ b/engines/titanic/pet_control/pet_gfx_element.h @@ -61,7 +61,7 @@ public: /** * Get the bounds for the element */ - virtual void getBounds(Rect *rect); + virtual Rect getBounds() const; /** * Get the game object associated with this item -- cgit v1.2.3 From 6691dfa408b05d2cb01fb879bc1b2466bf757738 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Apr 2016 22:14:22 -0400 Subject: TITANIC: Implement PET Conversations dial logic --- engines/titanic/pet_control/pet_conversations.cpp | 61 +++++++++++++++++++++-- engines/titanic/pet_control/pet_conversations.h | 19 ++++++- engines/titanic/pet_control/pet_section.cpp | 7 ++- engines/titanic/pet_control/pet_section.h | 2 +- engines/titanic/true_talk/tt_named_script.cpp | 2 +- engines/titanic/true_talk/tt_named_script.h | 7 ++- 6 files changed, 89 insertions(+), 9 deletions(-) diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index bffcb6ddd2..a62de341a0 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -47,7 +47,7 @@ CPetConversations::CPetConversations() : CPetSection(), _textInput.setColor(getColor(0)); _textInput.setup(); - _valArray3[0] = _valArray3[1] = _valArray3[2] = 0; + _npcLevels[0] = _npcLevels[1] = _npcLevels[2] = 0; } bool CPetConversations::setup(CPetControl *petControl) { @@ -217,7 +217,7 @@ void CPetConversations::load(SimpleFile *file, int param) { _log.load(file, param); for (int idx = 0; idx < 3; ++idx) - _valArray3[idx] = file->readNumber(); + _npcLevels[idx] = file->readNumber(); } void CPetConversations::postLoad() { @@ -229,7 +229,7 @@ void CPetConversations::save(SimpleFile *file, int indent) const { _log.save(file, indent); for (int idx = 0; idx < 3; ++idx) - file->writeNumberLine(_valArray3[idx], indent); + file->writeNumberLine(_npcLevels[idx], indent); } void CPetConversations::enter(PetArea oldArea) { @@ -246,6 +246,19 @@ void CPetConversations::leave() { stopNPCTimer(); } +void CPetConversations::proc25(int val) { + if (val == 1) { + proc25(val); + } else { + CString name = _field418 ? _npcName : getActiveNPCName(); + + for (int idx = 0; idx < 3; ++idx) { + if (!_dials[idx].hasActiveMovie()) + updateDial(idx, name); + } + } +} + void CPetConversations::displayNPCName(CGameObject *npc) { if (npc) { displayMessage(CString()); @@ -491,4 +504,46 @@ void CPetConversations::copyColors(uint tableNum, uint colors[5]) { Common::copy(src, src + 5, colors); } +void CPetConversations::updateDial(uint dialNum, const CString &npcName) { + TTNamedScript *script = getNPCScript(npcName); + uint newLevel = getDialLevel(dialNum, script); + npcDialChange(dialNum, _npcLevels[dialNum], newLevel); + _npcLevels[dialNum] = newLevel; +} + +uint CPetConversations::getDialLevel(uint dialNum, TTNamedScript *script, int v) { + bool flag = v != 0; + + if (!script) + return 0; + else + return MAX(script->getDialLevel(dialNum), 15); +} + +void CPetConversations::npcDialChange(uint dialNum, int oldLevel, int newLevel) { + const uint range1[2] = { 0, 21 }; + const uint range2[2] = { 22, 43 }; + + if (newLevel != oldLevel) { + uint src = range1[0], dest = range1[1]; + if (oldLevel < newLevel) { + src = range2[0]; + dest = range2[1]; + } + + int64 val1 = (oldLevel * dest) + (100 - oldLevel) * src; + val1 *= 0x51EB851F; + val1 >>= 37; + uint startFrame = val1 + (val1 >> 31); + + int64 val2 = (newLevel * dest) + (100 - newLevel) * src; + val2 *= 0x51EB851F; + val2 >>= 37; + uint endFrame = val2 + (val2 >> 31); + + if (startFrame != endFrame) + _dials[dialNum].playMovie(startFrame, endFrame); + } +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index 57c7fbd9b2..6e8ffbee41 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -47,7 +47,7 @@ private: int _npcNum; CPetText _log; CPetText _textInput; - int _valArray3[3]; + uint _npcLevels[3]; bool _logChanged; int _field418; CString _npcName; @@ -131,6 +131,21 @@ private: * Create a color table */ void copyColors(uint tableNum, uint colors[5]); + + /** + * Updates one of the dials with data from a given NPC + */ + void updateDial(uint dialNum, const CString &npcName); + + /** + * Get a dial level + */ + uint getDialLevel(uint dialNum, TTNamedScript *script, int v = 1); + + /** + * Called when the dial for an NPC is being changed + */ + void npcDialChange(uint dialNum, int oldLevel, int newLevel); public: CPetConversations(); virtual ~CPetConversations() {} @@ -199,6 +214,8 @@ public: */ virtual void leave(); + virtual void proc25(int val); + /** * Display a title for an NPC */ diff --git a/engines/titanic/pet_control/pet_section.cpp b/engines/titanic/pet_control/pet_section.cpp index 8cd9207316..7f0a0005e5 100644 --- a/engines/titanic/pet_control/pet_section.cpp +++ b/engines/titanic/pet_control/pet_section.cpp @@ -42,8 +42,11 @@ void CPetSection::displayMessage(const CString &msg) { error("TODO"); } -void CPetSection::proc25() { - error("TODO"); +void CPetSection::proc25(int val) { + if (!val) { + proc28(); + _petControl->makeDirty(); + } } void CPetSection::proc27(int duration) { diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 0d7ede6230..2a70b1dabb 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -142,7 +142,7 @@ public: */ virtual void enterRoom(CRoomItem *room) {} - virtual void proc25(); + virtual void proc25(int val); /** * Get a reference to the tooltip text associated with the section diff --git a/engines/titanic/true_talk/tt_named_script.cpp b/engines/titanic/true_talk/tt_named_script.cpp index 7f4bb5b201..9d253206e2 100644 --- a/engines/titanic/true_talk/tt_named_script.cpp +++ b/engines/titanic/true_talk/tt_named_script.cpp @@ -218,7 +218,7 @@ int TTNamedScript::proc34() { return 0; } -int TTNamedScript::proc35(int v1, int v2) { +int TTNamedScript::getDialLevel(uint dialNum, bool flag) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/tt_named_script.h b/engines/titanic/true_talk/tt_named_script.h index ec5c35c843..8174f64c53 100644 --- a/engines/titanic/true_talk/tt_named_script.h +++ b/engines/titanic/true_talk/tt_named_script.h @@ -103,7 +103,12 @@ public: virtual void proc32(); virtual void proc33(int v1, int v2); virtual int proc34(); - virtual int proc35(int v1, int v2); + + /** + * Get the NPC's dial level + */ + virtual int getDialLevel(uint dialNum, bool flag = true); + virtual int proc36() const; virtual int proc37() const; -- cgit v1.2.3 From 9d8208bd465a8f42ceb00418d29e9ca55a4d193f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Apr 2016 22:29:07 -0400 Subject: TITANIC: Miscellaneous PET Conversations methods --- engines/titanic/pet_control/pet_conversations.cpp | 28 ++++++++++++++++++++--- engines/titanic/pet_control/pet_conversations.h | 15 ++++++++++-- engines/titanic/pet_control/pet_section.h | 4 +++- 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index a62de341a0..c8d17e830d 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -216,7 +216,7 @@ void CPetConversations::load(SimpleFile *file, int param) { _textInput.load(file, param); _log.load(file, param); - for (int idx = 0; idx < 3; ++idx) + for (int idx = 0; idx < TOTAL_DIALS; ++idx) _npcLevels[idx] = file->readNumber(); } @@ -228,7 +228,7 @@ void CPetConversations::save(SimpleFile *file, int indent) const { _textInput.save(file, indent); _log.save(file, indent); - for (int idx = 0; idx < 3; ++idx) + for (int idx = 0; idx < TOTAL_DIALS; ++idx) file->writeNumberLine(_npcLevels[idx], indent); } @@ -252,7 +252,7 @@ void CPetConversations::proc25(int val) { } else { CString name = _field418 ? _npcName : getActiveNPCName(); - for (int idx = 0; idx < 3; ++idx) { + for (int idx = 0; idx < TOTAL_DIALS; ++idx) { if (!_dials[idx].hasActiveMovie()) updateDial(idx, name); } @@ -301,6 +301,17 @@ void CPetConversations::displayNPCName(CGameObject *npc) { } } +void CPetConversations::proc34(const CString &name) { + _field418 = 0; + resetDials(name); + startNPCTimer(); +} + +void CPetConversations::proc35() { + stopNPCTimer(); + resetDials("0"); +} + void CPetConversations::showCursor() { _textInput.showCursor(-2); } @@ -546,4 +557,15 @@ void CPetConversations::npcDialChange(uint dialNum, int oldLevel, int newLevel) } } +void CPetConversations::resetDials(const CString &name) { + TTNamedScript *script = getNPCScript(name); + + for (int idx = 0; idx < TOTAL_DIALS; ++idx) { + uint oldLevel = _npcLevels[idx]; + uint newLevel = getDialLevel(idx, script); + npcDialChange(idx, oldLevel, newLevel); + _npcLevels[idx] = newLevel; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index 6e8ffbee41..ec3cdd64cb 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -30,12 +30,15 @@ namespace Titanic { +#define TOTAL_DIALS 3 + class CPetConversations : public CPetSection { private: CPetGfxElement _scrollUp; CPetGfxElement _scrollDown; CPetGfxElement _dialBackground; - CPetGfxElement _dials[3]; + CPetGfxElement _dials[TOTAL_DIALS]; + uint _npcLevels[TOTAL_DIALS]; CPetGfxElement _val4; CPetGfxElement _val5; CPetGfxElement _indent; @@ -47,7 +50,6 @@ private: int _npcNum; CPetText _log; CPetText _textInput; - uint _npcLevels[3]; bool _logChanged; int _field418; CString _npcName; @@ -146,6 +148,11 @@ private: * Called when the dial for an NPC is being changed */ void npcDialChange(uint dialNum, int oldLevel, int newLevel); + + /** + * Reset the dials with those for a given NPC + */ + void resetDials(const CString &name); public: CPetConversations(); virtual ~CPetConversations() {} @@ -221,6 +228,10 @@ public: */ virtual void displayNPCName(CGameObject *npc); + virtual void proc34(const CString &name); + + virtual void proc35() {} + /** * Show the text cursor */ diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 2a70b1dabb..296479d025 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -162,7 +162,9 @@ public: virtual void displayNPCName(CGameObject *npc) {} virtual void proc33() {} - virtual void proc34() {} + + virtual void proc34(const CString &name) {} + virtual void proc35() {} /** -- cgit v1.2.3 From ce2a9c6f1ba75eedc917deffb79b2531a3d41645 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Apr 2016 22:56:48 -0400 Subject: TITANIC: Minor fleshing out of PET Conversations and Inventory --- engines/titanic/pet_control/pet_conversations.cpp | 2 +- engines/titanic/pet_control/pet_conversations.h | 2 +- engines/titanic/pet_control/pet_drag_chev.cpp | 4 ++-- engines/titanic/pet_control/pet_inventory.cpp | 18 +++++++++++++++--- engines/titanic/pet_control/pet_inventory.h | 9 +++++++-- 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index c8d17e830d..d4298dada1 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -528,7 +528,7 @@ uint CPetConversations::getDialLevel(uint dialNum, TTNamedScript *script, int v) if (!script) return 0; else - return MAX(script->getDialLevel(dialNum), 15); + return MAX(script->getDialLevel(dialNum, flag), 15); } void CPetConversations::npcDialChange(uint dialNum, int oldLevel, int newLevel) { diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index ec3cdd64cb..9ddc610058 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -230,7 +230,7 @@ public: virtual void proc34(const CString &name); - virtual void proc35() {} + virtual void proc35(); /** * Show the text cursor diff --git a/engines/titanic/pet_control/pet_drag_chev.cpp b/engines/titanic/pet_control/pet_drag_chev.cpp index 32acf72795..645804118d 100644 --- a/engines/titanic/pet_control/pet_drag_chev.cpp +++ b/engines/titanic/pet_control/pet_drag_chev.cpp @@ -56,8 +56,8 @@ bool CPetDragChev::MouseDragEndMsg(CMouseDragEndMsg *msg) { CSuccUBus *succubus = static_cast(msg->_dropTarget); if (succubus) { - CSetChevRoomBits msg(_field54); - msg.execute(succubus); + CSetChevRoomBits chevMsg(_field54); + chevMsg.execute(succubus); } else { CPetControl *petControl = getPetControl(); if (petControl && petControl->contains(msg->_mousePos) diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index c7c6dfdf7c..1ea78062d5 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -28,7 +28,7 @@ namespace Titanic { CPetInventory::CPetInventory() : CPetSection(), - _field28C(0), _field290(0), _field294(0), _field298(0) { + _movie(nullptr), _field290(false), _field294(0), _field298(0) { for (int idx = 0; idx < TOTAL_ITEMS; ++idx) { _itemBackgrounds[idx] = _itemGlyphs[idx] = nullptr; } @@ -53,8 +53,7 @@ void CPetInventory::draw(CScreenManager *screenManager) { } Rect CPetInventory::getBounds() { - // TODO - return Rect(); + return _movie ? _movie->getBounds() : Rect(); } CGameObject *CPetInventory::dragEnd(const Point &pt) const { @@ -200,4 +199,17 @@ CGameObject *CPetInventory::getImage(int index) { return nullptr; } +void CPetInventory::setMovie(CGameObject *movie, int flag) { + if (_movie) + _movie->stopMovie(); + _movie = movie; + + if (_movie) { + if (flag) + _movie->playMovie(0, 14, 1); + else + _movie->playMovie(0); + } +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h index 969e253676..70bcc12f85 100644 --- a/engines/titanic/pet_control/pet_inventory.h +++ b/engines/titanic/pet_control/pet_inventory.h @@ -39,8 +39,8 @@ private: CPetInventoryGlyphs _items; CGameObject *_itemBackgrounds[46]; CGameObject *_itemGlyphs[46]; - int _field28C; - int _field290; + CGameObject *_movie; + bool _field290; int _field294; int _field298; private: @@ -53,6 +53,11 @@ private: * Get the index of an item added to the PET */ int getItemIndex(CGameObject *item) const; + + /** + * Set the animated inventory item movie + */ + void setMovie(CGameObject *movie, int flag); public: CPetInventory(); -- cgit v1.2.3 From ad02fa76e0bbb81f28610a100aa988f082067c71 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Apr 2016 23:27:48 -0400 Subject: TITANIC: Implement PET Rooms glyphs saving logic --- engines/titanic/pet_control/pet_glyphs.h | 2 +- engines/titanic/pet_control/pet_rooms.cpp | 9 ++++++++- engines/titanic/pet_control/pet_rooms_glyphs.cpp | 14 ++++++++++++-- engines/titanic/pet_control/pet_rooms_glyphs.h | 10 +++++++++- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index 12f66870c6..0163f39a7e 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -193,7 +193,7 @@ public: */ virtual void getTooltip(CPetText *text) {} - virtual void proc32() {} + virtual void save2(SimpleFile *file, int indent) {} virtual int proc33() { return 1; } virtual int proc34() { return 1; } diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp index 71fa01ee77..0a403e66d6 100644 --- a/engines/titanic/pet_control/pet_rooms.cpp +++ b/engines/titanic/pet_control/pet_rooms.cpp @@ -134,7 +134,14 @@ void CPetRooms::postLoad() { } void CPetRooms::save(SimpleFile *file, int indent) const { - warning("TODO: CPetRooms::save"); + _glyphs.save(file, indent); + _glyphItem.save2(file, indent); + file->writeNumberLine(_field1C0, indent); + file->writeNumberLine(_field1C4, indent); + file->writeNumberLine(_field1C8, indent); + file->writeNumberLine(_field1CC, indent); + file->writeNumberLine(_field1D0, indent); + file->writeNumberLine(_field1D4, indent); } void CPetRooms::enter(PetArea oldArea) { diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.cpp b/engines/titanic/pet_control/pet_rooms_glyphs.cpp index c45e0389ce..6b762d890b 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.cpp +++ b/engines/titanic/pet_control/pet_rooms_glyphs.cpp @@ -72,8 +72,9 @@ int CPetRoomsGlyph::proc29(const Point &pt) { return 0; } -void CPetRoomsGlyph::proc32() { - +void CPetRoomsGlyph::save2(SimpleFile *file, int indent) const { + file->writeNumberLine(_field34, indent); + file->writeNumberLine(_field3C, indent); } int CPetRoomsGlyph::proc33() { @@ -84,4 +85,13 @@ void CPetRoomsGlyph::proc39() { } +/*------------------------------------------------------------------------*/ + +void CPetRoomsGlyphs::save(SimpleFile *file, int indent) const { + file->writeNumberLine(size(), indent); + + for (const_iterator i = begin(); i != end(); ++i) + (*i)->save2(file, indent); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.h b/engines/titanic/pet_control/pet_rooms_glyphs.h index d08be131c8..2e8ede2287 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.h +++ b/engines/titanic/pet_control/pet_rooms_glyphs.h @@ -68,12 +68,20 @@ public: virtual void proc28(const Point &pt); virtual int proc29(const Point &pt); - virtual void proc32(); + + virtual void save2(SimpleFile *file, int indent) const; + virtual int proc33(); + virtual void proc39(); }; class CPetRoomsGlyphs : public CPetGlyphs { +public: + /** + * Save the list + */ + void save(SimpleFile *file, int indent) const; }; } // End of namespace Titanic -- cgit v1.2.3 From 6b97394ebd577326c8818cfa02b08c119beab8c0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 1 May 2016 09:24:42 -0400 Subject: TITANIC: Fully implement PET Rooms loading/saving --- engines/titanic/pet_control/pet_glyphs.cpp | 14 ++++++++++++++ engines/titanic/pet_control/pet_glyphs.h | 12 +++++++++++- engines/titanic/pet_control/pet_rooms.cpp | 20 ++++++++++++++++---- engines/titanic/pet_control/pet_rooms.h | 5 +++++ engines/titanic/pet_control/pet_rooms_glyphs.cpp | 12 +++++------- engines/titanic/pet_control/pet_rooms_glyphs.h | 10 +++++++--- 6 files changed, 58 insertions(+), 15 deletions(-) diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index 96e61c9d48..d1cb384729 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -222,6 +222,10 @@ void CPetGlyphs::highlight(int index) { warning("TODO: CPetGlyphs::highlight"); } +void CPetGlyphs::highlight(const CPetGlyph *glyph) { + highlight(indexOf(glyph)); +} + int CPetGlyphs::getHighlightedIndex(int index) { int idx = index - _firstVisibleIndex; return (idx >= 0 && idx < _numVisibleGlyphs) ? idx : -1; @@ -445,4 +449,14 @@ bool CPetGlyphs::highlighted14() { return false; } +int CPetGlyphs::indexOf(const CPetGlyph *glyph) const { + int index = 0; + for (const_iterator i = begin(); i != end(); ++i, ++index) { + if (*i == glyph) + return index; + } + + return -1; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index 0163f39a7e..2aa80db41b 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -321,10 +321,15 @@ public: void draw(CScreenManager *screenManager); /** - * Highlight a specific glyph + * Highlight a specific glyph by indexe */ void highlight(int index); + /** + * Highlight a specific glyph + */ + void highlight(const CPetGlyph *glyph); + /** * Get the owning section for the glyphs */ @@ -398,6 +403,11 @@ public: void resetHighlight() { changeHighlight(-1); } bool highlighted14(); + + /** + * Returns the index of the specified glyph in the lsit + */ + int indexOf(const CPetGlyph *glyph) const; }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp index 0a403e66d6..7c2b9fb569 100644 --- a/engines/titanic/pet_control/pet_rooms.cpp +++ b/engines/titanic/pet_control/pet_rooms.cpp @@ -113,9 +113,8 @@ void CPetRooms::load(SimpleFile *file, int param) { int count = file->readNumber(); for (int idx = 0; idx < count; ++idx) { - int v1 = file->readNumber(); - int v2 = file->readNumber(); - warning("TODO: CPetRoomsSection::load - %d,%d", v1, v2); + CPetRoomsGlyph *glyph = addGlyph(file->readNumber(), false); + glyph->set3C(file->readNumber()); } _glyphItem.set34(file->readNumber()); @@ -134,7 +133,7 @@ void CPetRooms::postLoad() { } void CPetRooms::save(SimpleFile *file, int indent) const { - _glyphs.save(file, indent); + _glyphs.save2(file, indent); _glyphItem.save2(file, indent); file->writeNumberLine(_field1C0, indent); file->writeNumberLine(_field1C4, indent); @@ -208,4 +207,17 @@ void CPetRooms::areaChanged(PetArea area) { _petControl->makeDirty(); } +CPetRoomsGlyph *CPetRooms::addGlyph(int val, bool highlight) { + CPetRoomsGlyph *glyph = new CPetRoomsGlyph(val); + if (!glyph->setup(_petControl, &_glyphs)) { + delete glyph; + return nullptr; + } else { + _glyphs.push_back(glyph); + if (highlight) + _glyphs.highlight(glyph); + } +} + + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms.h b/engines/titanic/pet_control/pet_rooms.h index 4c153d7fad..a0fd3e92cb 100644 --- a/engines/titanic/pet_control/pet_rooms.h +++ b/engines/titanic/pet_control/pet_rooms.h @@ -68,6 +68,11 @@ private: int fn1(); void areaChanged(PetArea area); + + /** + * Adds a glyph to the list + */ + CPetRoomsGlyph *addGlyph(int val, bool highlight); public: CPetRooms(); diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.cpp b/engines/titanic/pet_control/pet_rooms_glyphs.cpp index 6b762d890b..57c6e8568c 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.cpp +++ b/engines/titanic/pet_control/pet_rooms_glyphs.cpp @@ -32,12 +32,10 @@ CPetRoomsGlyph::CPetRoomsGlyph() : CPetGlyph(), _field50(nullptr), _field54(nullptr), _field58(nullptr), _field5C(nullptr) { } -void CPetRoomsGlyph::set34(int val) { - _field34 = val; -} - -void CPetRoomsGlyph::set38(int val) { - _field38 = val; +CPetRoomsGlyph::CPetRoomsGlyph(int val) : CPetGlyph(), + _field34(val), _field38(0), _field3C(0), + _field40(nullptr), _field44(nullptr), _field48(nullptr), _field4C(nullptr), + _field50(nullptr), _field54(nullptr), _field58(nullptr), _field5C(nullptr) { } bool CPetRoomsGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { @@ -87,7 +85,7 @@ void CPetRoomsGlyph::proc39() { /*------------------------------------------------------------------------*/ -void CPetRoomsGlyphs::save(SimpleFile *file, int indent) const { +void CPetRoomsGlyphs::save2(SimpleFile *file, int indent) const { file->writeNumberLine(size(), indent); for (const_iterator i = begin(); i != end(); ++i) diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.h b/engines/titanic/pet_control/pet_rooms_glyphs.h index 2e8ede2287..3f37bdb55d 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.h +++ b/engines/titanic/pet_control/pet_rooms_glyphs.h @@ -42,10 +42,13 @@ protected: CGameObject *_field5C; public: CPetRoomsGlyph(); + CPetRoomsGlyph(int val); - void set34(int val); + void set34(int val) { _field34 = val; } - void set38(int val); + void set38(int val) { _field38 = val; } + + void set3C(int val) { _field3C = val; } /** * Setup the glyph @@ -77,11 +80,12 @@ public: }; class CPetRoomsGlyphs : public CPetGlyphs { +private: public: /** * Save the list */ - void save(SimpleFile *file, int indent) const; + void save2(SimpleFile *file, int indent) const; }; } // End of namespace Titanic -- cgit v1.2.3 From 21f98fff46e48e79d3e977d4f20edf90022a825a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 1 May 2016 09:46:25 -0400 Subject: TITANIC: Fix cursor and entering text in PET Conversations area --- engines/titanic/input_translator.cpp | 2 +- engines/titanic/pet_control/pet_conversations.cpp | 15 +++++---------- engines/titanic/pet_control/pet_text.cpp | 2 +- engines/titanic/support/screen_manager.cpp | 4 +++- engines/titanic/support/text_cursor.cpp | 6 ++---- 5 files changed, 12 insertions(+), 17 deletions(-) diff --git a/engines/titanic/input_translator.cpp b/engines/titanic/input_translator.cpp index 499d0f6293..571b6dfa14 100644 --- a/engines/titanic/input_translator.cpp +++ b/engines/titanic/input_translator.cpp @@ -100,7 +100,7 @@ void CInputTranslator::keyDown(const Common::KeyState &keyState) { _inputHandler->handleMessage(msg); } - if (keyState.ascii >= 32 && keyState.ascii <= 127) { + if (keyState.ascii <= 127) { CKeyCharMsg msg(keyState.ascii); _inputHandler->handleMessage(msg); } diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index d4298dada1..eb2f9716b6 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -465,17 +465,12 @@ bool CPetConversations::handleKey(const Common::KeyState &keyState) { case Common::KEYCODE_KP1: scrollToBottom(); break; - case Common::KEYCODE_BACKSPACE: - // Erase key in text input - _textInput.handleKey((char)Common::KEYCODE_BACKSPACE); - case Common::KEYCODE_RETURN: - case Common::KEYCODE_KP_ENTER: - // Text line finished - textLineEntered(_textInput.getText()); - return true; default: - if (keyState.ascii >= 32 && keyState.ascii) - _textInput.handleKey(keyState.ascii); + if (keyState.ascii > 0 && keyState.ascii) { + if (_textInput.handleKey(keyState.ascii)) + // Text line finished, so process line + textLineEntered(_textInput.getText()); + } return true; } diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index 1065e6f825..1d2740249f 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -192,7 +192,7 @@ void CPetText::resize(uint count) { CString CPetText::getText() const { CString result = ""; - for (int idx = 0; idx < _lineCount; ++idx) + for (int idx = 0; idx <= _lineCount; ++idx) result += _array[idx]._line; return result; diff --git a/engines/titanic/support/screen_manager.cpp b/engines/titanic/support/screen_manager.cpp index 1a43d78dd0..b0e249d7b3 100644 --- a/engines/titanic/support/screen_manager.cpp +++ b/engines/titanic/support/screen_manager.cpp @@ -116,7 +116,9 @@ void OSScreenManager::setMode(int width, int height, int bpp, uint numBackSurfac } void OSScreenManager::drawCursors() { - // Nothing needed here, since ScummVM handles cursor drawing + // The original did both text and mouse cursor drawing here. + // For ScummVM, we only need to worry about the text cursor + _textCursor->draw(); } DirectDrawSurface *OSScreenManager::getDDSurface(SurfaceNum surfaceNum) { diff --git a/engines/titanic/support/text_cursor.cpp b/engines/titanic/support/text_cursor.cpp index dc78d5350d..ad3fe4ed26 100644 --- a/engines/titanic/support/text_cursor.cpp +++ b/engines/titanic/support/text_cursor.cpp @@ -80,10 +80,8 @@ void CTextCursor::draw() { _backRenderSurface->_ddSurface->fillRect(&cursorRect, _cursorR, _cursorG, _cursorB); } - } - - if (_active && _blinkVisible) { - _screenManager->blitFrom(SURFACE_BACKBUFFER, _surface, &_pos); + + //_screenManager->blitFrom(SURFACE_BACKBUFFER, _surface, &_pos); } } -- cgit v1.2.3 From f01b8e9c45e3349c84346f270c17610b0e5350b0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 1 May 2016 13:56:42 -0400 Subject: TITANIC: Fix multi-line text writing --- engines/titanic/pet_control/pet_text.cpp | 6 +++--- engines/titanic/support/font.cpp | 28 ++++++++++++++-------------- engines/titanic/support/font.h | 11 +++++++++-- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index 1d2740249f..a4e00424fe 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -267,7 +267,7 @@ void CPetText::setMaxCharsPerLine(int maxChars) { void CPetText::updateStr3(int lineNum) { if (_field64 > 0 && _field68 > 0) { char line[5]; - line[0] = line[3] = TEXTCMD_26; + line[0] = line[3] = TEXTCMD_NPC; line[1] = _field64; line[2] = _field68; line[4] = '\0'; @@ -333,7 +333,7 @@ void CPetText::scrollToTop(CScreenManager *screenManager) { void CPetText::scrollToBottom(CScreenManager *screenManager) { int oldFontNumber = screenManager->setFontNumber(_fontNumber); - _scrollTop = _bounds.height(); + _scrollTop = getTextHeight(screenManager); constrainScrollDown(screenManager); screenManager->setFontNumber(oldFontNumber); } @@ -345,7 +345,7 @@ void CPetText::constrainScrollUp(CScreenManager *screenManager) { void CPetText::constrainScrollDown(CScreenManager *screenManager) { // Figure out the maximum scroll amount allowed - int maxScroll = _bounds.height() - getTextHeight(screenManager) - 4; + int maxScroll = getTextHeight(screenManager) - _bounds.height() - 4; if (maxScroll < 0) maxScroll = 0; diff --git a/engines/titanic/support/font.cpp b/engines/titanic/support/font.cpp index 3d5705ac5a..cc93bbb3c2 100644 --- a/engines/titanic/support/font.cpp +++ b/engines/titanic/support/font.cpp @@ -84,7 +84,7 @@ int STFont::getTextBounds(const CString &str, int maxWidth, Point *sizeOut) cons // Loop through the characters of the string if (!str.empty()) { for (const char *strP = str.c_str(); *strP; ++strP) { - if (*strP == TEXTCMD_26) { + if (*strP == TEXTCMD_NPC) { strP += 3; } else if (*strP == TEXTCMD_SET_COLOR) { strP += 4; @@ -141,7 +141,7 @@ int STFont::writeString(CVideoSurface *surface, const Rect &rect1, const Rect &d const char *endP = nullptr; const char *strEndP = str.c_str() + str.size() - 1; for (const char *srcP = str.c_str(); *srcP; ++srcP) { - if (*srcP == TEXTCMD_26) { + if (*srcP == TEXTCMD_NPC) { srcP += 3; } else if (*srcP == TEXTCMD_SET_COLOR) { // Change the color used for characters @@ -159,10 +159,10 @@ int STFont::writeString(CVideoSurface *surface, const Rect &rect1, const Rect &d } if (*srcP != '\n') { - int result = writeChar(surface, *srcP, textSize, rect1, &destBounds); - if (result == -2) + WriteCharacterResult result = writeChar(surface, *srcP, textSize, rect1, &destBounds); + if (result == WC_OUTSIDE_BOTTOM) return endP - str.c_str(); - else if (!result) + else if (result == WC_IN_BOUNDS) endP = srcP; } @@ -176,10 +176,10 @@ int STFont::writeString(CVideoSurface *surface, const Rect &rect1, const Rect &d textCursor->setPos(cursorPos); } - return endP - str.c_str(); + return endP ? endP - str.c_str() : 0; } -int STFont::writeChar(CVideoSurface *surface, unsigned char c, const Point &pt, +WriteCharacterResult STFont::writeChar(CVideoSurface *surface, unsigned char c, const Point &pt, const Rect &destRect, const Rect *srcRect) { if (c == 233) c = '$'; @@ -194,7 +194,7 @@ int STFont::writeChar(CVideoSurface *surface, unsigned char c, const Point &pt, if (srcRect->isEmpty()) srcRect = &destRect; if (destPos.y > srcRect->bottom) - return -2; + return WC_OUTSIDE_BOTTOM; if ((destPos.y + tempRect.height()) > srcRect->bottom) { tempRect.bottom += tempRect.top - destPos.y; @@ -202,7 +202,7 @@ int STFont::writeChar(CVideoSurface *surface, unsigned char c, const Point &pt, if (destPos.y < srcRect->top) { if ((tempRect.height() + destPos.y) < srcRect->top) - return -1; + return WC_OUTSIDE_TOP; tempRect.top += srcRect->top - destPos.y; destPos.y = srcRect->top; @@ -210,21 +210,21 @@ int STFont::writeChar(CVideoSurface *surface, unsigned char c, const Point &pt, if (destPos.x < srcRect->left) { if ((tempRect.width() + destPos.x) < srcRect->left) - return -3; + return WC_OUTSIDE_LEFT; tempRect.left += srcRect->left - destPos.x; destPos.x = srcRect->left; } else { if ((tempRect.width() + destPos.x) > srcRect->right) { if (destPos.x > srcRect->right) - return -4; + return WC_OUTSIDE_RIGHT; tempRect.right += srcRect->left - destPos.x; } } copyRect(surface, destPos, tempRect); - return 0; + return WC_IN_BOUNDS; } void STFont::copyRect(CVideoSurface *surface, const Point &pt, Rect &rect) { @@ -247,7 +247,7 @@ void STFont::copyRect(CVideoSurface *surface, const Point &pt, Rect &rect) { void STFont::extendBounds(Point &textSize, byte c, int maxWidth) const { textSize.x += _chars[c]._width; - if (textSize.x == '\n' || textSize.x > maxWidth) { + if (c == '\n' || textSize.x > maxWidth) { textSize.x = 0; textSize.y += _fontHeight; } @@ -260,7 +260,7 @@ void STFont::checkLineWrap(Point &textSize, int maxWidth, const char *&str) cons if (*srcPtr == ' ' && flag) break; - if (*srcPtr == TEXTCMD_26) + if (*srcPtr == TEXTCMD_NPC) srcPtr += 3; else if (*srcPtr == TEXTCMD_SET_COLOR) srcPtr += 4; diff --git a/engines/titanic/support/font.h b/engines/titanic/support/font.h index 75c91f3d36..591fb4661c 100644 --- a/engines/titanic/support/font.h +++ b/engines/titanic/support/font.h @@ -31,7 +31,12 @@ namespace Titanic { -enum TextCommand { TEXTCMD_26 = 26, TEXTCMD_SET_COLOR = 27 }; +enum TextCommand { TEXTCMD_NPC = 26, TEXTCMD_SET_COLOR = 27 }; + +enum WriteCharacterResult { + WC_IN_BOUNDS = 0, WC_OUTSIDE_TOP = -1, WC_OUTSIDE_BOTTOM = -2, + WC_OUTSIDE_LEFT = -3, WC_OUTSIDE_RIGHT = -4 +}; class CVideoSurface; @@ -51,7 +56,7 @@ private: /** * Write a character */ - int writeChar(CVideoSurface *surface, unsigned char c, + WriteCharacterResult writeChar(CVideoSurface *surface, unsigned char c, const Common::Point &pt, const Rect &destRect, const Rect *srcRect); /** @@ -87,6 +92,8 @@ public: /** * Write a string to the specified surface + * @returns The index of the last character that was visible + * with the drawing area */ int writeString(CVideoSurface *surface, const Rect &rect1, const Rect &destRect, int yOffset, const CString &str, CTextCursor *textCursor); -- cgit v1.2.3 From 6c2949ba2388ef949ee4148fcf0ee424a90fe4f0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 1 May 2016 15:03:03 -0400 Subject: TITANIC: Fix PET Conversations scroll buttons --- engines/titanic/pet_control/pet_conversations.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index eb2f9716b6..810434074a 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -143,9 +143,15 @@ bool CPetConversations::isValid(CPetControl *petControl) { } bool CPetConversations::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_scrollDown.MouseButtonDownMsg(msg->_mousePos)) { + scrollDown(); + return true; + } else if (_scrollUp.MouseButtonDownMsg(msg->_mousePos)) { + scrollUp(); + return true; + } + return - _scrollUp.MouseButtonDownMsg(msg->_mousePos) || - _scrollDown.MouseButtonDownMsg(msg->_mousePos) || _doorBot.MouseButtonDownMsg(msg->_mousePos) || _bellBot.MouseButtonDownMsg(msg->_mousePos); } -- cgit v1.2.3 From 93f88cc668f15a4c2b411c99b3f07e2f03bee50a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 1 May 2016 15:05:21 -0400 Subject: TITANIC: Fix PET Conversations doorbot/bellbot icons --- engines/titanic/pet_control/pet_conversations.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index 810434074a..9b7b27799f 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -68,7 +68,7 @@ bool CPetConversations::reset() { _doorBot.reset("PetCallDoorOut", _petControl, MODE_UNSELECTED); _doorBot.reset("PetCallDoorIn", _petControl, MODE_SELECTED); _bellBot.reset("PetCallBellOut", _petControl, MODE_UNSELECTED); - _doorBot.reset("PetCallBellIn", _petControl, MODE_SELECTED); + _bellBot.reset("PetCallBellIn", _petControl, MODE_SELECTED); _indent.reset("PetSmallCharacterIndent", _petControl); _splitter.reset("PetSplitter", _petControl); -- cgit v1.2.3 From 8a6a5ad5c10b682bef145b414ebed386aa7df842 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 1 May 2016 19:09:21 -0400 Subject: TITANIC: In progress implementation of PET Remote --- engines/titanic/pet_control/pet_remote.cpp | 194 ++++++++++++++++++++++++++++ engines/titanic/pet_control/pet_remote.h | 95 ++++++++++++-- engines/titanic/pet_control/pet_rooms.cpp | 7 +- engines/titanic/pet_control/pet_rooms.h | 7 +- engines/titanic/pet_control/pet_section.cpp | 4 - engines/titanic/pet_control/pet_section.h | 7 +- engines/titanic/titanic.cpp | 16 +++ engines/titanic/titanic.h | 7 + 8 files changed, 315 insertions(+), 22 deletions(-) diff --git a/engines/titanic/pet_control/pet_remote.cpp b/engines/titanic/pet_control/pet_remote.cpp index 4463c31bee..1aef2bc511 100644 --- a/engines/titanic/pet_control/pet_remote.cpp +++ b/engines/titanic/pet_control/pet_remote.cpp @@ -21,12 +21,206 @@ */ #include "titanic/pet_control/pet_remote.h" +#include "titanic/pet_control/pet_control.h" +#include "titanic/game_manager.h" +#include "titanic/titanic.h" namespace Titanic { +CPetRemote::CPetRemote() : CPetSection() { +} + +bool CPetRemote::setup(CPetControl *petControl) { + if (petControl && setupControl(petControl)) + return reset(); + return false; +} + +bool CPetRemote::reset() { + if (_petControl) { + _onOff.reset("PetSwitchOn", _petControl, MODE_SELECTED); + _onOff.reset("PetSwitchOff", _petControl, MODE_UNSELECTED); + + _up.reset("PetUp", _petControl, MODE_UNSELECTED); + _down.reset("PetDown", _petControl, MODE_UNSELECTED); + + _left.reset("PetLeftUp", _petControl, MODE_SELECTED); + _left.reset("PetLeft", _petControl, MODE_UNSELECTED); + _right.reset("PetRightUp", _petControl, MODE_SELECTED); + _right.reset("PetRight", _petControl, MODE_UNSELECTED); + _top.reset("PetTopUp", _petControl, MODE_SELECTED); + _top.reset("PetTop", _petControl, MODE_UNSELECTED); + _bottom.reset("PetBottomUp", _petControl, MODE_SELECTED); + _bottom.reset("PetBottom", _petControl, MODE_UNSELECTED); + _action.reset("PetActionUp", _petControl, MODE_SELECTED); + _action.reset("PetAction", _petControl, MODE_UNSELECTED); + + _send.reset("PetActSend0", _petControl, MODE_UNSELECTED); + _send.reset("PetActSend1", _petControl, MODE_SELECTED); + _receive.reset("PetActReceive0", _petControl, MODE_UNSELECTED); + _receive.reset("PetActReceive1", _petControl, MODE_SELECTED); + _call.reset("PetActCall0", _petControl, MODE_UNSELECTED); + _call.reset("PetActCall1", _petControl, MODE_SELECTED); + + _items.reset(); + uint col = getColor(0); + _text.setColor(col); + _text.setLineColor(0, col); + } + + return true; +} + +void CPetRemote::draw(CScreenManager *screenManager) { + _petControl->drawSquares(screenManager, 6); + _items.draw(screenManager); + _text.draw(screenManager); +} + +bool CPetRemote::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + return _items.MouseButtonDownMsg(msg->_mousePos); +} + +bool CPetRemote::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + return _items.MouseButtonUpMsg(msg->_mousePos); +} + +bool CPetRemote::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { + return _items.MouseButtonDownMsg(msg->_mousePos); +} + +bool CPetRemote::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { + return _items.VirtualKeyCharMsg(msg->_keyState.keycode); +} + bool CPetRemote::isValid(CPetControl *petControl) { + return setupControl(petControl); +} + +void CPetRemote::postLoad() { + reset(); + CRoomItem *room = getRoom(); + if (room) + enterRoom(room); +} + +void CPetRemote::enter(PetArea oldArea) { + if (_items.highlighted14()) + _text.setText(CString()); +} + +void CPetRemote::enterRoom(CRoomItem *room) { // TODO +} + +CPetText *CPetRemote::getText() { + return &_text; +} + +CPetElement *CPetRemote::getElement(uint id) { + switch (id) { + case 0: + return &_onOff; + case 1: + return &_up; + case 2: + return &_down; + case 3: + return &_left; + case 4: + return &_right; + case 5: + return &_top; + case 6: + return &_bottom; + case 7: + return &_action; + case 16: + return &_send; + case 17: + return &_receive; + case 18: + return &_call; + default: + return nullptr; + } +} + +void CPetRemote::proc38(int val) { + int highlightIndex = getHighlightIndex(val); + if (highlightIndex != -1) + _items.highlight(highlightIndex); +} + +bool CPetRemote::setupControl(CPetControl *petControl) { + _petControl = petControl; + if (!petControl) + return false; + + _onOff.setBounds(Rect(0, 0, 15, 43)); + _onOff.translate(519, 381); + _up.setBounds(Rect(0, 0, 21, 24)); + _up.translate(551, 381); + _down.setBounds(Rect(0, 0, 21, 24)); + _down.translate(551, 402); + _left.setBounds(Rect(0, 0, 22, 21)); + _left.translate(518, 393); + _right.setBounds(Rect(0, 0, 21, 21)); + _right.translate(560, 393); + _top.setBounds(Rect(0, 0, 21, 22)); + _top.translate(539, 371); + _bottom.setBounds(Rect(0, 0, 21, 22)); + _bottom.translate(539, 414); + _action.setBounds(Rect(0, 0, 21, 21)); + _action.translate(539, 393); + _send.setBounds(Rect(0, 0, 62, 38)); + _send.translate(503, 373); + _receive.setBounds(Rect(0, 0, 62, 38)); + _receive.translate(503, 420); + _call.setBounds(Rect(0, 0, 62, 38)); + _call.translate(503, 383); + + Rect rect(0, 0, 580, 15); + rect.moveTo(32, 445); + _text.setBounds(rect); + _text.setHasBorder(false); + + _items.setup(6, this); + _items.setFlags(19); return true; } +CRoomItem *CPetRemote::getRoom() const { + if (_petControl) { + CGameManager *gameManager = _petControl->getGameManager(); + if (gameManager) + return gameManager->getRoom(); + } + + return nullptr; +} + +int CPetRemote::getHighlightIndex(int val) { + CRoomItem *room = getRoom(); + if (!room) + return -1; + + int roomIndex = roomIndexOf(room->getName()); + if (roomIndex == -1) + return -1; + + // TODO: more + + return -1; +} + +int CPetRemote::roomIndexOf(const CString &name) { + for (int idx = 0; idx < TOTAL_ROOMS; ++idx) { + if (g_vm->_roomNames[idx] == name) + return idx; + } + + return -1; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_remote.h b/engines/titanic/pet_control/pet_remote.h index 70f6c3262c..5db7e7f912 100644 --- a/engines/titanic/pet_control/pet_remote.h +++ b/engines/titanic/pet_control/pet_remote.h @@ -36,23 +36,96 @@ class CPetRemoteGlyphs : public CPetGlyphs { class CPetRemote : public CPetSection { private: CPetRemoteGlyphs _items; - CPetGfxElement _val1; - CPetGfxElement _val2; - CPetGfxElement _val3; - CPetGfxElement _val4; - CPetGfxElement _val5; - CPetGfxElement _val6; - CPetGfxElement _val7; - CPetGfxElement _val8; - CPetGfxElement _val9; - CPetGfxElement _val10; - CPetGfxElement _val11; + CPetGfxElement _onOff; + CPetGfxElement _up; + CPetGfxElement _down; + CPetGfxElement _left; + CPetGfxElement _right; + CPetGfxElement _top; + CPetGfxElement _bottom; + CPetGfxElement _action; + CPetGfxElement _send; + CPetGfxElement _receive; + CPetGfxElement _call; CPetText _text; +private: + /** + * Setup the control + */ + bool setupControl(CPetControl *petControl); + + /** + * Get the current room + */ + CRoomItem *getRoom() const; + + /** + * Return a highlight index + */ + int getHighlightIndex(int val); + + /** + * Return the index of a room name in the master room names list + */ + int roomIndexOf(const CString &name); public: + CPetRemote(); + + /** + * Sets up the section + */ + virtual bool setup(CPetControl *petControl); + + /** + * Reset the section + */ + virtual bool reset(); + + /** + * Draw the section + */ + virtual void draw(CScreenManager *screenManager); + + /** + * Following are handlers for the various messages that the PET can + * pass onto the currently active section/area + */ + virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); + virtual bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg); + virtual bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg); + /** * Returns true if the object is in a valid state */ virtual bool isValid(CPetControl *petControl); + + /** + * Called after a game has been loaded + */ + virtual void postLoad(); + + /** + * Called when a section is switched to + */ + virtual void enter(PetArea oldArea); + + /** + * Called when a new room is entered + */ + virtual void enterRoom(CRoomItem *room); + + /** + * Get a reference to the tooltip text associated with the section + */ + virtual CPetText *getText(); + + /** + * Get an element from the section by a designated Id + */ + virtual CPetElement *getElement(uint id); + + virtual void proc38(int val); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp index 7c2b9fb569..e474e35eac 100644 --- a/engines/titanic/pet_control/pet_rooms.cpp +++ b/engines/titanic/pet_control/pet_rooms.cpp @@ -94,8 +94,8 @@ bool CPetRooms::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { return _glyphs.VirtualKeyCharMsg(msg->_keyState.keycode); } -bool CPetRooms::proc14(void *v1) { - warning("TODO: proc14"); +bool CPetRooms::checkDragEnd(CGameObject *item) { + warning("TODO: CPetRooms::checkDragEnd"); return false; } @@ -171,8 +171,8 @@ bool CPetRooms::setupControl(CPetControl *petControl) { _text.setHasBorder(false); Rect rect2(0, 0, 81, 81); - rect2.moveTo(374, 494); _plinth.setBounds(rect2); + _plinth.translate(494, 374); _chevLeftOnDim = petControl->getHiddenObject("3PetChevLeftOnDim"); _chevLeftOffDim = petControl->getHiddenObject("3PetChevLeftOffDim"); @@ -219,5 +219,4 @@ CPetRoomsGlyph *CPetRooms::addGlyph(int val, bool highlight) { } } - } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms.h b/engines/titanic/pet_control/pet_rooms.h index a0fd3e92cb..522a1e2399 100644 --- a/engines/titanic/pet_control/pet_rooms.h +++ b/engines/titanic/pet_control/pet_rooms.h @@ -101,8 +101,11 @@ public: virtual bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg); virtual bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg); - virtual bool proc14(void *v1); - + /** + * Check whether a drag drop can occur + */ + virtual bool checkDragEnd(CGameObject *item); + /** * Display a message */ diff --git a/engines/titanic/pet_control/pet_section.cpp b/engines/titanic/pet_control/pet_section.cpp index 7f0a0005e5..116fd94ddb 100644 --- a/engines/titanic/pet_control/pet_section.cpp +++ b/engines/titanic/pet_control/pet_section.cpp @@ -66,10 +66,6 @@ void CPetSection::proc29() { _petControl->stopPetTimer(0); } -void CPetSection::proc30() { - error("TODO"); -} - uint CPetSection::getColor(uint index) { return getColorTable()[index]; } diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 296479d025..52890fc79a 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -34,6 +34,7 @@ enum PetArea { }; class CPetControl; +class CPetElement; class CPetText; class CScreenManager; class CRoomItem; @@ -152,7 +153,11 @@ public: virtual void proc27(int duration); virtual void proc28(); virtual void proc29(); - virtual void proc30(); + + /** + * Get an element from the section by a designated Id + */ + virtual CPetElement *getElement(uint id) { return nullptr; } virtual CGameObject *getBackground(int index) const { return nullptr; } diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index 932189067f..f1d24a0a1e 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -78,6 +78,7 @@ void TitanicEngine::initialize() { DebugMan.addDebugChannel(kDebugSound, "sound", "Sound and Music handling"); setItemNames(); + setRoomNames(); CSaveableObject::initClassList(); CEnterExitFirstClassState::init(); CGetLiftEye2::init(); @@ -173,5 +174,20 @@ void TitanicEngine::setItemNames() { _itemIds[idx] = ITEM_IDS[idx]; } +void TitanicEngine::setRoomNames() { + static const char *const ROOM_NAMES[TOTAL_ROOMS] = { + "1stClassLobby", "1stClassRestaurant", "1stClassState", + "2ndClassLobby", "secClassState", "Arboretum", "FrozenArboretum", + "Bar", "BilgeRoom", "BilgeRoomWith", "BottomOfWell", "Bridge", + "CreatorsChamber", "CreatorsChamberOn", "Dome", "Home", "Lift", + "EmbLobby", "MoonEmbLobby", "MusicRoomLobby", "MusicRoom", + "ParrotLobby", "Pellerator", "PromenadeDeck", "SculptureChamber", + "SecClassLittleLift", "ServiceElevator", "SGTLeisure", "SGTLittleLift", + "SgtLobby", "SGTState", "Titania", "TopOfWell", "PlayersRoom" + }; + + for (uint idx = 0; idx < TOTAL_ROOMS; ++idx) + _roomNames[idx] = ROOM_NAMES[idx]; +} } // End of namespace Titanic diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index f639a9c672..a5cf0ff9b8 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -65,6 +65,7 @@ enum TitanicDebugChannels { #define ERROR_DETAILED 3 #define TOTAL_ITEMS 46 +#define TOTAL_ROOMS 34 struct TitanicGameDescription; class TitanicEngine; @@ -94,6 +95,11 @@ private: * Sets up the item names, short, and long descriptions */ void setItemNames(); + + /** + * Sets up the list of room names + */ + void setRoomNames(); protected: const TitanicGameDescription *_gameDescription; int _loadSaveSlot; @@ -115,6 +121,7 @@ public: CString _itemDescriptions[TOTAL_ITEMS]; CString _itemObjects[TOTAL_ITEMS]; CString _itemIds[40]; + CString _roomNames[TOTAL_ROOMS]; public: TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc); virtual ~TitanicEngine(); -- cgit v1.2.3 From c3dadcfe3b9d62eb19970b200e941f138f8abf1b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 1 May 2016 22:33:54 -0400 Subject: TITANIC: Beginnings of PET Remote glyph classes --- engines/titanic/module.mk | 5 +- engines/titanic/pet_control/pet_control.cpp | 8 +- engines/titanic/pet_control/pet_control.h | 2 +- engines/titanic/pet_control/pet_glyphs.h | 5 + engines/titanic/pet_control/pet_nav_helmet.cpp | 8 +- engines/titanic/pet_control/pet_remote.cpp | 133 +++++++++++++++++++++- engines/titanic/pet_control/pet_remote.h | 33 +++++- engines/titanic/pet_control/pet_remote_glyphs.cpp | 83 ++++++++++++++ engines/titanic/pet_control/pet_remote_glyphs.h | 108 ++++++++++++++++++ 9 files changed, 367 insertions(+), 18 deletions(-) create mode 100644 engines/titanic/pet_control/pet_remote_glyphs.cpp create mode 100644 engines/titanic/pet_control/pet_remote_glyphs.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index a9d758b57f..ae0c563f24 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -364,10 +364,11 @@ MODULE_OBJS := \ pet_control/pet_inventory_glyphs.o \ pet_control/pet_message.o \ pet_control/pet_nav_helmet.o \ + pet_control/pet_real_life.o \ + pet_control/pet_remote.o \ + pet_control/pet_remote_glyphs.o \ pet_control/pet_rooms.o \ pet_control/pet_rooms_glyphs.o \ - pet_control/pet_remote.o \ - pet_control/pet_real_life.o \ pet_control/pet_section.o \ pet_control/pet_drag_chev.o \ pet_control/pet_graphic2.o \ diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 2bd8864998..c115cb5979 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -44,7 +44,7 @@ END_MESSAGE_MAP() CPetControl::CPetControl() : CGameObject(), _currentArea(PET_CONVERSATION), _fieldC0(0), _locked(0), _fieldC8(0), - _activeNPC(nullptr), _treeItem2(nullptr), _hiddenRoom(nullptr), + _activeNPC(nullptr), _remoteTarget(nullptr), _hiddenRoom(nullptr), _drawBounds(20, 350, 620, 480) { _sections[PET_INVENTORY] = &_inventory; _sections[PET_CONVERSATION] = &_conversations; @@ -152,7 +152,7 @@ void CPetControl::postLoad() { if (!_activeNPCName.empty() && root) _activeNPC = root->findByName(_activeNPCName); if (!_string2.empty() && root) - _treeItem2 = root->findByName(_string2); + _remoteTarget = root->findByName(_string2); setArea(_currentArea); loaded(); @@ -179,7 +179,7 @@ void CPetControl::enterRoom(CRoomItem *room) { } void CPetControl::clear() { - _treeItem2 = nullptr; + _remoteTarget = nullptr; _string2.clear(); } @@ -216,7 +216,7 @@ void CPetControl::fn2(int val) { } void CPetControl::fn3(CTreeItem *item) { - _treeItem2 = item; + _remoteTarget = item; if (item) _string2 = item->getName(); else diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 2c706397ea..7763dd91dc 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -113,7 +113,7 @@ protected: public: PetArea _currentArea; CTreeItem *_activeNPC; - CTreeItem *_treeItem2; + CTreeItem *_remoteTarget; public: CLASSDEF CPetControl(); diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index 2aa80db41b..5dc5013a9b 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -408,6 +408,11 @@ public: * Returns the index of the specified glyph in the lsit */ int indexOf(const CPetGlyph *glyph) const; + + /** + * Resets the scrolling of the glyphs list back to the start + */ + void scrollToStart() { _firstVisibleIndex = 0; } }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_nav_helmet.cpp b/engines/titanic/pet_control/pet_nav_helmet.cpp index 7697df40f6..b995786b97 100644 --- a/engines/titanic/pet_control/pet_nav_helmet.cpp +++ b/engines/titanic/pet_control/pet_nav_helmet.cpp @@ -77,17 +77,17 @@ void CPetNavHelmet::draw(CScreenManager *screenManager) { } bool CPetNavHelmet::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { - if (!_petControl->_treeItem2) + if (!_petControl->_remoteTarget) return false; if (_val1.MouseButtonDownMsg(msg->_mousePos)) { CPETHelmetOnOffMsg helmetMsg; - helmetMsg.execute(_petControl->_treeItem2); + helmetMsg.execute(_petControl->_remoteTarget); } else if (_val2.MouseButtonDownMsg(msg->_mousePos)) { if (_field210) { _photoOn = !_photoOn; CPETPhotoOnOffMsg photoMsg; - photoMsg.execute(_petControl->_treeItem2); + photoMsg.execute(_petControl->_remoteTarget); } else { _petControl->displayMessage("Please supply Galactic reference material."); } @@ -99,7 +99,7 @@ bool CPetNavHelmet::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { } bool CPetNavHelmet::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { - if (!_petControl->_treeItem2 || !_setDestination.MouseButtonUpMsg(msg->_mousePos)) + if (!_petControl->_remoteTarget || !_setDestination.MouseButtonUpMsg(msg->_mousePos)) return false; if (_petControl) { diff --git a/engines/titanic/pet_control/pet_remote.cpp b/engines/titanic/pet_control/pet_remote.cpp index 1aef2bc511..fb9178b13b 100644 --- a/engines/titanic/pet_control/pet_remote.cpp +++ b/engines/titanic/pet_control/pet_remote.cpp @@ -21,12 +21,53 @@ */ #include "titanic/pet_control/pet_remote.h" +#include "titanic/pet_control/pet_remote_glyphs.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/messages/pet_messages.h" #include "titanic/game_manager.h" #include "titanic/titanic.h" namespace Titanic { +static const byte REMOTE_DATA[] = { + 0x00, 0x02, + GLYPH_SUMMON_ELEVATOR, 0x10, + 0x01, 0x02, 0x01, 0x10, + 0x02, 0x03, 0x02, 0x04, 0x10, + 0x03, 0x02, + GLYPH_SUMMON_ELEVATOR, 0x10, + 0x04, 0x02, 0x02, 0x10, + 0x05, 0x02, 0x01, 0x10, + 0x06, 0x02, 0x01, 0x10, + 0x07, 0x03, 0x02, 0x01, 0x10, + 0x08, 0x01, 0x10, + 0x09, 0x01, 0x10, + 0x0A, 0x02, GLYPH_SUMMON_ELEVATOR, 0x10, + 0x0B, 0x01, 0x11, + 0x0C, 0x01, 0x10, + 0x0D, 0x01, 0x10, + 0x0E, 0x00, + 0x0F, 0x01, 0x02, + 0x10, 0x03, 0x12, 0x14, 0x13, + 0x11, 0x01, 0x10, + 0x12, 0x00, + 0x13, 0x02, 0x01, 0x10, + 0x14, 0x00, + 0x15, 0x02, 0x10, 0x02, + 0x16, 0x00, + 0x17, 0x02, 0x01, 0x10, + 0x18, 0x01, 0x10, + 0x19, 0x00, + 0x1A, 0x00, + 0x1B, 0x00, + 0x1C, 0x00, + 0x1D, 0x02, GLYPH_SUMMON_ELEVATOR, 0x10, + 0x1E, 0x0C, 0x05, 0x06, 0x07, 0x08, 0x03, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x1F, 0x01, 0x10, + 0x20, 0x02, GLYPH_SUMMON_ELEVATOR, 0x01, + 0x21, 0x00 +}; + CPetRemote::CPetRemote() : CPetSection() { } @@ -117,7 +158,7 @@ CPetText *CPetRemote::getText() { return &_text; } -CPetElement *CPetRemote::getElement(uint id) { +CPetGfxElement *CPetRemote::getElement(uint id) { switch (id) { case 0: return &_onOff; @@ -209,7 +250,14 @@ int CPetRemote::getHighlightIndex(int val) { if (roomIndex == -1) return -1; - // TODO: more + Common::Array remoteData; + getRemoteData(roomIndex, remoteData); + + // Loop through the data for the room + for (uint idx = 0; idx < remoteData.size(); ++idx) { + if (remoteData[idx + 1] == val) + return idx; + } return -1; } @@ -223,4 +271,85 @@ int CPetRemote::roomIndexOf(const CString &name) { return -1; } +void CPetRemote::getRemoteData(int roomIndex, Common::Array &indexes) { + const byte *p = &REMOTE_DATA[0]; + for (int idx = 0; idx < TOTAL_ROOMS; ++idx) { + if (*p == roomIndex) { + for (int idx = 0; idx < *p; ++idx) + indexes.push_back(p[idx + 1]); + return; + } + + p += *(p + 1) + 2; + } +} + +bool CPetRemote::loadGlyphs(const Common::Array &indexes) { + for (uint idx = 0; idx < indexes.size(); ++idx) { + if (!loadGlyph(indexes[idx])) + return false; + } + + return true; +} + +bool CPetRemote::loadGlyph(int glyphIndex) { + CPetRemoteGlyph *glyph = nullptr; + + switch (glyphIndex) { + case GLYPH_SUMMON_ELEVATOR: + glyph = new CSummonElevatorGlyph(); + break; + + default: + break; + } + + if (glyph) { + if (glyph->setup(_petControl, &_items)) { + _items.push_back(glyph); + return true; + } + } + + return false; +} + +void CPetRemote::generateMessage(RemoteMessage msgNum, const CString &name, int num) { + switch (msgNum) { + case RMSG_LEFT: { + CPETLeftMsg msg(name, num); + msg.execute(_petControl->_remoteTarget); + break; + } + + case RMSG_RIGHT: { + CPETRightMsg msg(name, num); + msg.execute(_petControl->_remoteTarget); + break; + } + + case RMSG_UP: { + CPETUpMsg msg(name, num); + msg.execute(_petControl->_remoteTarget); + break; + } + + case RMSG_DOWN: { + CPETDownMsg msg(name, num); + msg.execute(_petControl->_remoteTarget); + break; + } + + case RMSG_ACTIVATE: { + CPETActivateMsg msg(name, num); + msg.execute(_petControl->_remoteTarget); + break; + } + + default: + break; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_remote.h b/engines/titanic/pet_control/pet_remote.h index 5db7e7f912..6982c93aef 100644 --- a/engines/titanic/pet_control/pet_remote.h +++ b/engines/titanic/pet_control/pet_remote.h @@ -23,16 +23,14 @@ #ifndef TITANIC_PET_REMOTE_H #define TITANIC_PET_REMOTE_H +#include "common/array.h" #include "titanic/pet_control/pet_section.h" #include "titanic/pet_control/pet_glyphs.h" +#include "titanic/pet_control/pet_remote_glyphs.h" #include "titanic/pet_control/pet_text.h" -#include "titanic/pet_control/pet_gfx_element.h" namespace Titanic { -class CPetRemoteGlyphs : public CPetGlyphs { -}; - class CPetRemote : public CPetSection { private: CPetRemoteGlyphs _items; @@ -68,6 +66,26 @@ private: * Return the index of a room name in the master room names list */ int roomIndexOf(const CString &name); + + /** + * Return a list of remote action glyph indexes for a given room + */ + void getRemoteData(int roomIndex, Common::Array &indexes); + + /** + * Clear the list of rooms glyphs + */ + void clearGlyphs() { _items.clear(); } + + /** + * Load the room glyphs + */ + bool loadGlyphs(const Common::Array &indexes); + + /** + * Load a single room glyph + */ + bool loadGlyph(int glyphIndex); public: CPetRemote(); @@ -123,9 +141,14 @@ public: /** * Get an element from the section by a designated Id */ - virtual CPetElement *getElement(uint id); + virtual CPetGfxElement *getElement(uint id); virtual void proc38(int val); + + /** + * Generates a PET message + */ + void generateMessage(RemoteMessage msgNum, const CString &name, int num); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_remote_glyphs.cpp b/engines/titanic/pet_control/pet_remote_glyphs.cpp new file mode 100644 index 0000000000..76ab3839b7 --- /dev/null +++ b/engines/titanic/pet_control/pet_remote_glyphs.cpp @@ -0,0 +1,83 @@ +/* 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 "titanic/pet_control/pet_remote_glyphs.h" +#include "titanic/pet_control/pet_remote.h" + +namespace Titanic { + +CPetRemote *CPetRemoteGlyphs::getOwner() const { + return static_cast(_owner); +} + +void CPetRemoteGlyphs::generateMessage(RemoteMessage msgNum, const CString &name, int num) { + getOwner()->generateMessage(msgNum, name, num); +} + +/*------------------------------------------------------------------------*/ + +void CPetRemoteGlyph::setDefaults(const CString &name, CPetControl *petControl) { + _gfxElement->setBounds(Rect(0, 0, 52, 52)); + _gfxElement->setup(MODE_UNSELECTED, name, petControl); +} + +CPetRemoteGlyphs *CPetRemoteGlyph::getOwner() const { + return static_cast(_owner); +} + +CPetGfxElement *CPetRemoteGlyph::getElement(uint id) const { + CPetRemote *remote = static_cast(_owner->getOwner()); + return remote->getElement(id); +} + +/*------------------------------------------------------------------------*/ + +bool CSummonElevatorGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { + setDefaults("3PetLift", petControl); + if (owner) + _gfxElement = getElement(18); + return true; +} + +void CSummonElevatorGlyph::draw2(CScreenManager *screenManager) { + if (_gfxElement) + _gfxElement->draw(screenManager); +} + +bool CSummonElevatorGlyph::MouseButtonDownMsg(const Point &pt) { + return _gfxElement && _gfxElement->MouseButtonDownMsg(pt); +} + +bool CSummonElevatorGlyph::MouseButtonUpMsg(const Point &pt) { + if (_gfxElement && _gfxElement->MouseButtonUpMsg(pt)) { + getOwner()->generateMessage(RMSG_ACTIVATE, "Lift"); + return true; + } + + return false; +} + +void CSummonElevatorGlyph::getTooltip(CPetText *text) { + text->setText("Summon Elevator"); +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_remote_glyphs.h b/engines/titanic/pet_control/pet_remote_glyphs.h new file mode 100644 index 0000000000..56a2e2cf51 --- /dev/null +++ b/engines/titanic/pet_control/pet_remote_glyphs.h @@ -0,0 +1,108 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_REMOTE_GLYPHS_H +#define TITANIC_PET_REMOTE_GLYPHS_H + +#include "titanic/pet_control/pet_glyphs.h" +#include "titanic/pet_control/pet_gfx_element.h" + +namespace Titanic { + +enum RemoteGlyph { + GLYPH_SUMMON_ELEVATOR = 0 +}; + +enum RemoteMessage { + RMSG_LEFT = 0, RMSG_RIGHT = 1, RMSG_UP = 2, RMSG_DOWN = 3, RMSG_ACTIVATE = 4 +}; + +class CPetRemote; + +class CPetRemoteGlyphs : public CPetGlyphs { +public: + /** + * Returns the owning CPetRemote + */ + CPetRemote *getOwner() const; + + /** + * Generates a PET message + */ + void generateMessage(RemoteMessage msgNum, const CString &name, int num = -1); +}; + +class CPetRemoteGlyph : public CPetGlyph { +protected: + CPetGfxElement *_gfxElement; +protected: + CPetRemoteGlyph() : CPetGlyph(), _gfxElement(nullptr) {} + + /** + * Set defaults for the glyph + */ + void setDefaults(const CString &name, CPetControl *petControl); + + /** + * Get the owner + */ + CPetRemoteGlyphs *getOwner() const; + + /** + * Get an element by id from the parent Remote section + */ + CPetGfxElement *getElement(uint id) const; +}; + +class CSummonElevatorGlyph : public CPetRemoteGlyph { +public: + CSummonElevatorGlyph() : CPetRemoteGlyph() {} + + /** + * Setup the glyph + */ + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); + + /** + * Handles any secondary drawing of the glyph + */ + virtual void draw2(CScreenManager *screenManager); + + /** + * Called for mouse button down messages + */ + virtual bool MouseButtonDownMsg(const Point &pt); + + /** + * Handles mouse button up messages + */ + virtual bool MouseButtonUpMsg(const Point &pt); + + /** + * Returns the tooltip text for when the glyph is selected + */ + virtual void getTooltip(CPetText *text); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_REMOTE_GLYPHS_H */ -- cgit v1.2.3 From efaa86bee4f0183365309056d43b3aa3801f3ddf Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 1 May 2016 23:48:22 -0400 Subject: TITANIC: Implement Television Control glyph --- engines/titanic/pet_control/pet_element.cpp | 7 ++ engines/titanic/pet_control/pet_element.h | 5 ++ engines/titanic/pet_control/pet_remote.cpp | 82 ++++++++++++++--------- engines/titanic/pet_control/pet_remote_glyphs.cpp | 71 ++++++++++++++++++-- engines/titanic/pet_control/pet_remote_glyphs.h | 58 +++++++++++++++- engines/titanic/pet_control/pet_rooms.cpp | 2 + 6 files changed, 183 insertions(+), 42 deletions(-) diff --git a/engines/titanic/pet_control/pet_element.cpp b/engines/titanic/pet_control/pet_element.cpp index da37b35246..0827b331df 100644 --- a/engines/titanic/pet_control/pet_element.cpp +++ b/engines/titanic/pet_control/pet_element.cpp @@ -96,4 +96,11 @@ void CPetElement::setMode(PetElementMode newMode) { changeMode(newMode); } +void CPetElement::setSelected(bool flag) { + if (flag) + changeMode(MODE_SELECTED); + else + changeMode(MODE_UNSELECTED); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_element.h b/engines/titanic/pet_control/pet_element.h index 578f306dff..e1edcac217 100644 --- a/engines/titanic/pet_control/pet_element.h +++ b/engines/titanic/pet_control/pet_element.h @@ -125,6 +125,11 @@ public: void setMode(PetElementMode mode); + /** + * Set whether the element is selected + */ + void setSelected(bool flag); + /** * Set the bounds for the element */ diff --git a/engines/titanic/pet_control/pet_remote.cpp b/engines/titanic/pet_control/pet_remote.cpp index fb9178b13b..9149ed851e 100644 --- a/engines/titanic/pet_control/pet_remote.cpp +++ b/engines/titanic/pet_control/pet_remote.cpp @@ -32,40 +32,52 @@ namespace Titanic { static const byte REMOTE_DATA[] = { 0x00, 0x02, GLYPH_SUMMON_ELEVATOR, 0x10, - 0x01, 0x02, 0x01, 0x10, - 0x02, 0x03, 0x02, 0x04, 0x10, + 0x01, 0x02, + GLYPH_SUMMON_PELLERATOR, 0x10, + 0x02, 0x03, + GLYPH_TELEVISION_CONTROL, 0x04, 0x10, 0x03, 0x02, GLYPH_SUMMON_ELEVATOR, 0x10, - 0x04, 0x02, 0x02, 0x10, - 0x05, 0x02, 0x01, 0x10, - 0x06, 0x02, 0x01, 0x10, - 0x07, 0x03, 0x02, 0x01, 0x10, - 0x08, 0x01, 0x10, - 0x09, 0x01, 0x10, - 0x0A, 0x02, GLYPH_SUMMON_ELEVATOR, 0x10, - 0x0B, 0x01, 0x11, - 0x0C, 0x01, 0x10, - 0x0D, 0x01, 0x10, - 0x0E, 0x00, - 0x0F, 0x01, 0x02, - 0x10, 0x03, 0x12, 0x14, 0x13, - 0x11, 0x01, 0x10, - 0x12, 0x00, - 0x13, 0x02, 0x01, 0x10, - 0x14, 0x00, - 0x15, 0x02, 0x10, 0x02, - 0x16, 0x00, - 0x17, 0x02, 0x01, 0x10, - 0x18, 0x01, 0x10, - 0x19, 0x00, - 0x1A, 0x00, - 0x1B, 0x00, - 0x1C, 0x00, - 0x1D, 0x02, GLYPH_SUMMON_ELEVATOR, 0x10, - 0x1E, 0x0C, 0x05, 0x06, 0x07, 0x08, 0x03, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x1F, 0x01, 0x10, - 0x20, 0x02, GLYPH_SUMMON_ELEVATOR, 0x01, - 0x21, 0x00 + 0x04, 0x02, + GLYPH_TELEVISION_CONTROL, 0x10, + 0x05, 0x02, + GLYPH_SUMMON_PELLERATOR, 0x10, + 0x06, 0x02, + GLYPH_SUMMON_PELLERATOR, 0x10, + 0x07, 0x03, + GLYPH_TELEVISION_CONTROL, GLYPH_SUMMON_PELLERATOR, 0x10, + 0x08, 0x01, 0x10, + 0x09, 0x01, 0x10, + 0x0A, 0x02, GLYPH_SUMMON_ELEVATOR, 0x10, + 0x0B, 0x01, 0x11, + 0x0C, 0x01, 0x10, + 0x0D, 0x01, 0x10, + 0x0E, 0x00, + 0x0F, 0x01, + GLYPH_TELEVISION_CONTROL, + 0x10, 0x03, 0x12, 0x14, 0x13, + 0x11, 0x01, 0x10, + 0x12, 0x00, + 0x13, 0x02, + GLYPH_SUMMON_PELLERATOR, 0x10, + 0x14, 0x00, + 0x15, 0x02, + 0x10, GLYPH_TELEVISION_CONTROL, + 0x16, 0x00, + 0x17, 0x02, + GLYPH_SUMMON_PELLERATOR, 0x10, + 0x18, 0x01, 0x10, + 0x19, 0x00, + 0x1A, 0x00, + 0x1B, 0x00, + 0x1C, 0x00, + 0x1D, 0x02, GLYPH_SUMMON_ELEVATOR, 0x10, + 0x1E, 0x0C, + 0x05, 0x06, 0x07, 0x08, 0x03, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x1F, 0x01, 0x10, + 0x20, 0x02, + GLYPH_SUMMON_ELEVATOR, GLYPH_SUMMON_PELLERATOR, + 0x21, 0x00 }; CPetRemote::CPetRemote() : CPetSection() { @@ -301,6 +313,12 @@ bool CPetRemote::loadGlyph(int glyphIndex) { glyph = new CSummonElevatorGlyph(); break; + case GLYPH_SUMMON_PELLERATOR: + glyph = new CSummonPelleratorGlyph(); + break; + + case GLYPH_TELEVISION_CONTROL: + default: break; } diff --git a/engines/titanic/pet_control/pet_remote_glyphs.cpp b/engines/titanic/pet_control/pet_remote_glyphs.cpp index 76ab3839b7..9db3b66c3d 100644 --- a/engines/titanic/pet_control/pet_remote_glyphs.cpp +++ b/engines/titanic/pet_control/pet_remote_glyphs.cpp @@ -51,23 +51,24 @@ CPetGfxElement *CPetRemoteGlyph::getElement(uint id) const { /*------------------------------------------------------------------------*/ -bool CSummonElevatorGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { - setDefaults("3PetLift", petControl); +bool CBasicRemoteGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { + CPetRemoteGlyph::setup(petControl, owner); + setDefaults(_gfxName, petControl); if (owner) _gfxElement = getElement(18); return true; } -void CSummonElevatorGlyph::draw2(CScreenManager *screenManager) { +void CBasicRemoteGlyph::draw2(CScreenManager *screenManager) { if (_gfxElement) _gfxElement->draw(screenManager); } -bool CSummonElevatorGlyph::MouseButtonDownMsg(const Point &pt) { +bool CBasicRemoteGlyph::MouseButtonDownMsg(const Point &pt) { return _gfxElement && _gfxElement->MouseButtonDownMsg(pt); } -bool CSummonElevatorGlyph::MouseButtonUpMsg(const Point &pt) { +bool CBasicRemoteGlyph::MouseButtonUpMsg(const Point &pt) { if (_gfxElement && _gfxElement->MouseButtonUpMsg(pt)) { getOwner()->generateMessage(RMSG_ACTIVATE, "Lift"); return true; @@ -76,8 +77,64 @@ bool CSummonElevatorGlyph::MouseButtonUpMsg(const Point &pt) { return false; } -void CSummonElevatorGlyph::getTooltip(CPetText *text) { - text->setText("Summon Elevator"); +void CBasicRemoteGlyph::getTooltip(CPetText *text) { + text->setText(_tooltip); +} + +/*------------------------------------------------------------------------*/ + +bool CTelevisionControlGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { + CPetRemoteGlyph::setup(petControl, owner); + setDefaults("3PetTV", petControl); + if (owner) { + _up = getElement(1); + _down = getElement(2); + _onOff = getElement(4); + } + + return true; +} + +void CTelevisionControlGlyph::draw2(CScreenManager *screenManager) { + _onOff->setSelected(_flag); + _onOff->draw(screenManager); + _up->draw(screenManager); + _down->draw(screenManager); +} + +bool CTelevisionControlGlyph::MouseButtonDownMsg(const Point &pt) { + if (_onOff && _onOff->MouseButtonDownMsg(pt)) + return true; + if (_up && _up->MouseButtonDownMsg(pt)) + return true; + if (_down && _down->MouseButtonDownMsg(pt)) + return true; + + return false; +} + +bool CTelevisionControlGlyph::MouseButtonUpMsg(const Point &pt) { + if (_onOff && _onOff->MouseButtonUpMsg(pt)) { + _flag = !_flag; + getOwner()->generateMessage(RMSG_ACTIVATE, "Television"); + return true; + } + + if (_up && _up->MouseButtonUpMsg(pt)) { + getOwner()->generateMessage(RMSG_UP, "Television"); + return true; + } + + if (_down && _down->MouseButtonUpMsg(pt)) { + getOwner()->generateMessage(RMSG_DOWN, "Television"); + return true; + } + + return false; +} + +void CTelevisionControlGlyph::getTooltip(CPetText *text) { + text->setText("Television control"); } } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_remote_glyphs.h b/engines/titanic/pet_control/pet_remote_glyphs.h index 56a2e2cf51..1a4ee28f12 100644 --- a/engines/titanic/pet_control/pet_remote_glyphs.h +++ b/engines/titanic/pet_control/pet_remote_glyphs.h @@ -29,7 +29,8 @@ namespace Titanic { enum RemoteGlyph { - GLYPH_SUMMON_ELEVATOR = 0 + GLYPH_SUMMON_ELEVATOR = 0, GLYPH_SUMMON_PELLERATOR = 1, + GLYPH_TELEVISION_CONTROL = 2 }; enum RemoteMessage { @@ -73,9 +74,13 @@ protected: CPetGfxElement *getElement(uint id) const; }; -class CSummonElevatorGlyph : public CPetRemoteGlyph { +class CBasicRemoteGlyph : public CPetRemoteGlyph { +private: + CString _gfxName, _tooltip, _msgString; public: - CSummonElevatorGlyph() : CPetRemoteGlyph() {} + CBasicRemoteGlyph(const CString &gfxName, const CString &tooltip, + const CString &msgString) : CPetRemoteGlyph(), + _gfxName(gfxName), _tooltip(tooltip), _msgString(msgString) {} /** * Setup the glyph @@ -103,6 +108,53 @@ public: virtual void getTooltip(CPetText *text); }; +class CSummonElevatorGlyph : public CBasicRemoteGlyph { +public: + CSummonElevatorGlyph() : CBasicRemoteGlyph( + "3PetLift", "Summon Elevator", "Lift") {} +}; + +class CSummonPelleratorGlyph : public CBasicRemoteGlyph { +public: + CSummonPelleratorGlyph() : CBasicRemoteGlyph( + "3PetPellerator", "Summon Pellerator", "Pellerator") {} +}; + +class CTelevisionControlGlyph : public CPetRemoteGlyph { +private: + bool _flag; + CPetGfxElement *_up, *_down, *_onOff; +public: + CTelevisionControlGlyph() : CPetRemoteGlyph(), _flag(false), + _up(nullptr), _down(nullptr), _onOff(nullptr) {} + + /** + * Setup the glyph + */ + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); + + /** + * Handles any secondary drawing of the glyph + */ + virtual void draw2(CScreenManager *screenManager); + + /** + * Called for mouse button down messages + */ + virtual bool MouseButtonDownMsg(const Point &pt); + + /** + * Handles mouse button up messages + */ + virtual bool MouseButtonUpMsg(const Point &pt); + + /** + * Returns the tooltip text for when the glyph is selected + */ + virtual void getTooltip(CPetText *text); +}; + + } // End of namespace Titanic #endif /* TITANIC_PET_REMOTE_GLYPHS_H */ diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp index e474e35eac..acf9acfe24 100644 --- a/engines/titanic/pet_control/pet_rooms.cpp +++ b/engines/titanic/pet_control/pet_rooms.cpp @@ -216,6 +216,8 @@ CPetRoomsGlyph *CPetRooms::addGlyph(int val, bool highlight) { _glyphs.push_back(glyph); if (highlight) _glyphs.highlight(glyph); + + return glyph; } } -- cgit v1.2.3 From 947d9e344c2e51c7ad8e4fe1f78fb131cafc921a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 2 May 2016 08:32:25 -0400 Subject: TITANIC: Implement toggle remote glyph base class --- engines/titanic/pet_control/pet_remote_glyphs.cpp | 26 ++++++++++++++++ engines/titanic/pet_control/pet_remote_glyphs.h | 37 +++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/engines/titanic/pet_control/pet_remote_glyphs.cpp b/engines/titanic/pet_control/pet_remote_glyphs.cpp index 9db3b66c3d..85c4fb8889 100644 --- a/engines/titanic/pet_control/pet_remote_glyphs.cpp +++ b/engines/titanic/pet_control/pet_remote_glyphs.cpp @@ -83,6 +83,20 @@ void CBasicRemoteGlyph::getTooltip(CPetText *text) { /*------------------------------------------------------------------------*/ +bool CToggleRemoteGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { + CPetGlyph::setup(petControl, owner); + if (owner) + _gfxElement = getElement(0); + return true; +} + +void CToggleRemoteGlyph::draw2(CScreenManager *screenManager) { + _gfxElement->setMode(_flag ? MODE_SELECTED : MODE_UNSELECTED); + _gfxElement->draw(screenManager); +} + +/*------------------------------------------------------------------------*/ + bool CTelevisionControlGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { CPetRemoteGlyph::setup(petControl, owner); setDefaults("3PetTV", petControl); @@ -137,4 +151,16 @@ void CTelevisionControlGlyph::getTooltip(CPetText *text) { text->setText("Television control"); } +/*------------------------------------------------------------------------*/ + +bool CEntertainmentDeviceGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { + CPetRemoteGlyph::setup(petControl, owner); + if (owner) { + _gfxElement2 = getElement(1); + _gfxElement3 = getElement(2); + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_remote_glyphs.h b/engines/titanic/pet_control/pet_remote_glyphs.h index 1a4ee28f12..8a9cb88e99 100644 --- a/engines/titanic/pet_control/pet_remote_glyphs.h +++ b/engines/titanic/pet_control/pet_remote_glyphs.h @@ -108,6 +108,29 @@ public: virtual void getTooltip(CPetText *text); }; +class CToggleRemoteGlyph : public CPetRemoteGlyph { +protected: + CPetGfxElement *_gfxElement; + bool _flag; +public: + CToggleRemoteGlyph() : CPetRemoteGlyph(), _gfxElement(nullptr), _flag(false) {} + + /** + * Setup the glyph + */ + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); + + /** + * Handles any secondary drawing of the glyph + */ + virtual void draw2(CScreenManager *screenManager); + + /** + * Called for mouse button down messages + */ + virtual bool MouseButtonDownMsg(const Point &pt); +}; + class CSummonElevatorGlyph : public CBasicRemoteGlyph { public: CSummonElevatorGlyph() : CBasicRemoteGlyph( @@ -154,6 +177,20 @@ public: virtual void getTooltip(CPetText *text); }; +class CEntertainmentDeviceGlyph : public CToggleRemoteGlyph { +public: + int _field3C; + CPetGfxElement *_gfxElement2, *_gfxElement3; +public: + CEntertainmentDeviceGlyph() : CToggleRemoteGlyph(), + _field3C(0), _gfxElement2(nullptr), _gfxElement3(nullptr) {} + + /** + * Setup the glyph + */ + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); + +}; } // End of namespace Titanic -- cgit v1.2.3 From 9a6ad7d1e012a5cb1a4ca955b0f738f12c0a7874 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 2 May 2016 19:23:29 -0400 Subject: TITANIC: Implemented remote entertainment device glyph --- engines/titanic/game_manager.cpp | 9 +++ engines/titanic/game_manager.h | 6 ++ engines/titanic/pet_control/pet_control.cpp | 5 ++ engines/titanic/pet_control/pet_control.h | 5 ++ engines/titanic/pet_control/pet_remote.cpp | 8 ++- engines/titanic/pet_control/pet_remote_glyphs.cpp | 73 +++++++++++++++++++++++ engines/titanic/pet_control/pet_remote_glyphs.h | 34 +++++++++-- 7 files changed, 134 insertions(+), 6 deletions(-) diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index a82488e44e..0d1714a3a6 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -236,4 +236,13 @@ CScreenManager *CGameManager::setScreenManager() const { return CScreenManager::setCurrent(); } +CString CGameManager::getFullViewName() { + CViewItem *view = getView(); + CNodeItem *node = view->findNode(); + CRoomItem *room = node->findRoom(); + + return CString::format("%s.%s.%s", room->getName().c_str(), + node->getName().c_str(), view->getName().c_str()); +} + } // End of namespace Titanic diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index 102cc40316..e52426592b 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -186,6 +186,12 @@ public: * Return the true talk manager */ CTrueTalkManager *getTalkManager() { return &_trueTalkManager; } + + /** + * Return the full Id of the current view in a + * room.node.view tuplet form + */ + CString getFullViewName(); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index c115cb5979..8571b5ea65 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -511,4 +511,9 @@ void CPetControl::setTimer44(int id, int val) { getGameManager()->setTimer44(id, val); } +CString CPetControl::getFullViewName() { + CGameManager *gameManager = getGameManager(); + return gameManager ? gameManager->getFullViewName() : CString(); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 7763dd91dc..23b4f61721 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -288,6 +288,11 @@ public: */ void stopPetTimer(uint timerIndex); + /** + * Return the full Id of the current view in a + * room.node.view tuplet form + */ + CString getFullViewName(); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_remote.cpp b/engines/titanic/pet_control/pet_remote.cpp index 9149ed851e..fd2d5e1dc3 100644 --- a/engines/titanic/pet_control/pet_remote.cpp +++ b/engines/titanic/pet_control/pet_remote.cpp @@ -73,7 +73,7 @@ static const byte REMOTE_DATA[] = { 0x1C, 0x00, 0x1D, 0x02, GLYPH_SUMMON_ELEVATOR, 0x10, 0x1E, 0x0C, - 0x05, 0x06, 0x07, 0x08, 0x03, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x05, 0x06, 0x07, 0x08, GLYPH_ENTERTAINMENT_DEVICE, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x1F, 0x01, 0x10, 0x20, 0x02, GLYPH_SUMMON_ELEVATOR, GLYPH_SUMMON_PELLERATOR, @@ -318,6 +318,12 @@ bool CPetRemote::loadGlyph(int glyphIndex) { break; case GLYPH_TELEVISION_CONTROL: + glyph = new CTelevisionControlGlyph(); + break; + + case GLYPH_ENTERTAINMENT_DEVICE: + glyph = new CEntertainmentDeviceGlyph(); + break; default: break; diff --git a/engines/titanic/pet_control/pet_remote_glyphs.cpp b/engines/titanic/pet_control/pet_remote_glyphs.cpp index 85c4fb8889..e0334fef31 100644 --- a/engines/titanic/pet_control/pet_remote_glyphs.cpp +++ b/engines/titanic/pet_control/pet_remote_glyphs.cpp @@ -22,6 +22,8 @@ #include "titanic/pet_control/pet_remote_glyphs.h" #include "titanic/pet_control/pet_remote.h" +#include "titanic/pet_control/pet_control.h" +#include "titanic/messages/pet_messages.h" namespace Titanic { @@ -95,6 +97,25 @@ void CToggleRemoteGlyph::draw2(CScreenManager *screenManager) { _gfxElement->draw(screenManager); } +bool CToggleRemoteGlyph::elementMouseButtonDownMsg(const Point &pt) { + return _gfxElement->MouseButtonDownMsg(pt); +} + +bool CToggleRemoteGlyph::elementMouseButtonUpMsg(const Point &pt) { + if (!_gfxElement->MouseButtonUpMsg(pt)) + return false; + + CTreeItem *target = getPetControl()->_remoteTarget; + if (target) { + CPETActivateMsg msg("SGTSelector", -1); + msg.execute(target); + _flag = !_flag; + _gfxElement->setMode(_flag ? MODE_SELECTED : MODE_UNSELECTED); + } + + return true; +} + /*------------------------------------------------------------------------*/ bool CTelevisionControlGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { @@ -163,4 +184,56 @@ bool CEntertainmentDeviceGlyph::setup(CPetControl *petControl, CPetGlyphs *owner return true; } +void CEntertainmentDeviceGlyph::draw2(CScreenManager *screenManager) { + CString viewName = getPetControl()->getFullViewName(); + if (viewName == "SGTState.Node 1.S") { + _gfxElement->setSelected(_flag); + _gfxElement->draw(screenManager); + } else if (viewName == "SGTState.Node 4.E") { + _gfxElement->setSelected(_flag2); + _gfxElement->draw(screenManager); + _gfxElement2->draw(screenManager); + _gfxElement3->draw(screenManager); + } +} + +bool CEntertainmentDeviceGlyph::MouseButtonDownMsg(const Point &pt) { + CString viewName = getPetControl()->getFullViewName(); + if (viewName == "SGTState.Node 1.S") { + return elementMouseButtonDownMsg(pt); + } else if (viewName == "SGTState.Node 4.E") { + return _gfxElement->MouseButtonDownMsg(pt) + || _gfxElement2->MouseButtonDownMsg(pt) + || _gfxElement3->MouseButtonDownMsg(pt); + } + + return false; +} + +bool CEntertainmentDeviceGlyph::MouseButtonUpMsg(const Point &pt) { + CString viewName = getPetControl()->getFullViewName(); + if (viewName == "SGTState.Node 1.S") { + return elementMouseButtonUpMsg(pt); + } else if (viewName == "SGTState.Node 4.E") { + if (_gfxElement->MouseButtonUpMsg(pt)) { + _flag2 = !_flag2; + getOwner()->generateMessage(RMSG_ACTIVATE, "Television"); + return true; + } else if (_gfxElement2->MouseButtonUpMsg(pt)) { + getOwner()->generateMessage(RMSG_UP, "Television"); + return true; + } + else if (_gfxElement3->MouseButtonUpMsg(pt)) { + getOwner()->generateMessage(RMSG_DOWN, "Television"); + return true; + } + } + + return false; +} + +void CEntertainmentDeviceGlyph::getTooltip(CPetText *text) { + text->setText("Operate visual entertainment device"); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_remote_glyphs.h b/engines/titanic/pet_control/pet_remote_glyphs.h index 8a9cb88e99..e8f0c8d8c7 100644 --- a/engines/titanic/pet_control/pet_remote_glyphs.h +++ b/engines/titanic/pet_control/pet_remote_glyphs.h @@ -30,7 +30,7 @@ namespace Titanic { enum RemoteGlyph { GLYPH_SUMMON_ELEVATOR = 0, GLYPH_SUMMON_PELLERATOR = 1, - GLYPH_TELEVISION_CONTROL = 2 + GLYPH_TELEVISION_CONTROL = 2, GLYPH_ENTERTAINMENT_DEVICE = 3 }; enum RemoteMessage { @@ -126,9 +126,14 @@ public: virtual void draw2(CScreenManager *screenManager); /** - * Called for mouse button down messages + * Called for mouse button down messages to the default element */ - virtual bool MouseButtonDownMsg(const Point &pt); + bool elementMouseButtonDownMsg(const Point &pt); + + /** + * Called for mouse button up messages to the default element + */ + bool elementMouseButtonUpMsg(const Point &pt); }; class CSummonElevatorGlyph : public CBasicRemoteGlyph { @@ -179,17 +184,36 @@ public: class CEntertainmentDeviceGlyph : public CToggleRemoteGlyph { public: - int _field3C; + bool _flag2; CPetGfxElement *_gfxElement2, *_gfxElement3; public: CEntertainmentDeviceGlyph() : CToggleRemoteGlyph(), - _field3C(0), _gfxElement2(nullptr), _gfxElement3(nullptr) {} + _flag2(false), _gfxElement2(nullptr), _gfxElement3(nullptr) {} /** * Setup the glyph */ virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); + /** + * Handles any secondary drawing of the glyph + */ + virtual void draw2(CScreenManager *screenManager); + + /** + * Called for mouse button down messages + */ + virtual bool MouseButtonDownMsg(const Point &pt); + + /** + * Handles mouse button up messages + */ + virtual bool MouseButtonUpMsg(const Point &pt); + + /** + * Returns the tooltip text for when the glyph is selected + */ + virtual void getTooltip(CPetText *text); }; } // End of namespace Titanic -- cgit v1.2.3 From ab769eee0c99f262052b7a15295a74053943a372 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 2 May 2016 20:18:47 -0400 Subject: TITANIC: Implement Operate Lights glyph --- engines/titanic/pet_control/pet_remote.cpp | 16 ++++--- engines/titanic/pet_control/pet_remote.h | 2 +- engines/titanic/pet_control/pet_remote_glyphs.cpp | 55 +++++++++++++++++++++++ engines/titanic/pet_control/pet_remote_glyphs.h | 37 ++++++++++++++- 4 files changed, 102 insertions(+), 8 deletions(-) diff --git a/engines/titanic/pet_control/pet_remote.cpp b/engines/titanic/pet_control/pet_remote.cpp index fd2d5e1dc3..1ed0251f24 100644 --- a/engines/titanic/pet_control/pet_remote.cpp +++ b/engines/titanic/pet_control/pet_remote.cpp @@ -35,7 +35,7 @@ static const byte REMOTE_DATA[] = { 0x01, 0x02, GLYPH_SUMMON_PELLERATOR, 0x10, 0x02, 0x03, - GLYPH_TELEVISION_CONTROL, 0x04, 0x10, + GLYPH_TELEVISION_CONTROL, GLYPH_OPERATE_LIGHTS, 0x10, 0x03, 0x02, GLYPH_SUMMON_ELEVATOR, 0x10, 0x04, 0x02, @@ -200,7 +200,7 @@ CPetGfxElement *CPetRemote::getElement(uint id) { } void CPetRemote::proc38(int val) { - int highlightIndex = getHighlightIndex(val); + int highlightIndex = getHighlightIndex((RemoteGlyph)val); if (highlightIndex != -1) _items.highlight(highlightIndex); } @@ -253,7 +253,7 @@ CRoomItem *CPetRemote::getRoom() const { return nullptr; } -int CPetRemote::getHighlightIndex(int val) { +int CPetRemote::getHighlightIndex(RemoteGlyph val) { CRoomItem *room = getRoom(); if (!room) return -1; @@ -267,7 +267,7 @@ int CPetRemote::getHighlightIndex(int val) { // Loop through the data for the room for (uint idx = 0; idx < remoteData.size(); ++idx) { - if (remoteData[idx + 1] == val) + if ((RemoteGlyph)remoteData[idx + 1] == val) return idx; } @@ -287,8 +287,8 @@ void CPetRemote::getRemoteData(int roomIndex, Common::Array &indexes) { const byte *p = &REMOTE_DATA[0]; for (int idx = 0; idx < TOTAL_ROOMS; ++idx) { if (*p == roomIndex) { - for (int idx = 0; idx < *p; ++idx) - indexes.push_back(p[idx + 1]); + for (int ctr = 0; ctr < *p; ++ctr) + indexes.push_back(p[ctr + 1]); return; } @@ -325,6 +325,10 @@ bool CPetRemote::loadGlyph(int glyphIndex) { glyph = new CEntertainmentDeviceGlyph(); break; + case GLYPH_OPERATE_LIGHTS: + glyph = new COperateLightsGlyph(); + break; + default: break; } diff --git a/engines/titanic/pet_control/pet_remote.h b/engines/titanic/pet_control/pet_remote.h index 6982c93aef..8703abd099 100644 --- a/engines/titanic/pet_control/pet_remote.h +++ b/engines/titanic/pet_control/pet_remote.h @@ -60,7 +60,7 @@ private: /** * Return a highlight index */ - int getHighlightIndex(int val); + int getHighlightIndex(RemoteGlyph val); /** * Return the index of a room name in the master room names list diff --git a/engines/titanic/pet_control/pet_remote_glyphs.cpp b/engines/titanic/pet_control/pet_remote_glyphs.cpp index e0334fef31..c1d86d6703 100644 --- a/engines/titanic/pet_control/pet_remote_glyphs.cpp +++ b/engines/titanic/pet_control/pet_remote_glyphs.cpp @@ -236,4 +236,59 @@ void CEntertainmentDeviceGlyph::getTooltip(CPetText *text) { text->setText("Operate visual entertainment device"); } +/*------------------------------------------------------------------------*/ + + +bool COperateLightsGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { + CPetRemoteGlyph::setup(petControl, owner); + setDefaults("3PetLights", petControl); + + if (owner) { + _left = getElement(3); + _right = getElement(4); + _up = getElement(5); + _down = getElement(6); + _activate = getElement(7); + } + + return true; +} + +void COperateLightsGlyph::draw2(CScreenManager *screenManager) { + _left->draw(screenManager); + _right->draw(screenManager); + _up->draw(screenManager); + _down->draw(screenManager); + _activate->draw(screenManager); +} + +bool COperateLightsGlyph::MouseButtonDownMsg(const Point &pt) { + if (_left->MouseButtonDownMsg(pt) + || _right->MouseButtonDownMsg(pt) + || _up->MouseButtonDownMsg(pt) + || _down->MouseButtonDownMsg(pt) + || _activate->MouseButtonDownMsg(pt)) + return true; + return true; +} + +bool COperateLightsGlyph::MouseButtonUpMsg(const Point &pt) { + if (_left && _left->MouseButtonUpMsg(pt)) + getOwner()->generateMessage(RMSG_LEFT, "Light"); + else if (_right && _right->MouseButtonUpMsg(pt)) + getOwner()->generateMessage(RMSG_RIGHT, "Light"); + else if (_up && _up->MouseButtonUpMsg(pt)) + getOwner()->generateMessage(RMSG_UP, "Light"); + else if (_down && _down->MouseButtonUpMsg(pt)) + getOwner()->generateMessage(RMSG_DOWN, "Light"); + else + getOwner()->generateMessage(RMSG_ACTIVATE, "Light"); + + return true; +} + +void COperateLightsGlyph::getTooltip(CPetText *text) { + text->setText("Operate the lights"); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_remote_glyphs.h b/engines/titanic/pet_control/pet_remote_glyphs.h index e8f0c8d8c7..39f9164979 100644 --- a/engines/titanic/pet_control/pet_remote_glyphs.h +++ b/engines/titanic/pet_control/pet_remote_glyphs.h @@ -30,7 +30,8 @@ namespace Titanic { enum RemoteGlyph { GLYPH_SUMMON_ELEVATOR = 0, GLYPH_SUMMON_PELLERATOR = 1, - GLYPH_TELEVISION_CONTROL = 2, GLYPH_ENTERTAINMENT_DEVICE = 3 + GLYPH_TELEVISION_CONTROL = 2, GLYPH_ENTERTAINMENT_DEVICE = 3, + GLYPH_OPERATE_LIGHTS = 4 }; enum RemoteMessage { @@ -216,6 +217,40 @@ public: virtual void getTooltip(CPetText *text); }; + +class COperateLightsGlyph : public CPetRemoteGlyph { +public: + CPetGfxElement *_left, *_right, *_up, *_down, *_activate; +public: + COperateLightsGlyph() : CPetRemoteGlyph(), _left(nullptr), _right(nullptr), + _up(nullptr), _down(nullptr), _activate(nullptr) {} + + /** + * Setup the glyph + */ + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); + + /** + * Handles any secondary drawing of the glyph + */ + virtual void draw2(CScreenManager *screenManager); + + /** + * Called for mouse button down messages + */ + virtual bool MouseButtonDownMsg(const Point &pt); + + /** + * Handles mouse button up messages + */ + virtual bool MouseButtonUpMsg(const Point &pt); + + /** + * Returns the tooltip text for when the glyph is selected + */ + virtual void getTooltip(CPetText *text); +}; + } // End of namespace Titanic #endif /* TITANIC_PET_REMOTE_GLYPHS_H */ -- cgit v1.2.3 From 00cb975f158d82f80bcad3e025aeaedc8a5cd7d9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 2 May 2016 20:30:28 -0400 Subject: TITANIC: Implement Deploy Floral Enhancement glyph --- engines/titanic/pet_control/pet_remote.cpp | 4 ++++ engines/titanic/pet_control/pet_remote_glyphs.cpp | 14 ++++++++++- engines/titanic/pet_control/pet_remote_glyphs.h | 29 ++++++++++++++++++++++- 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/engines/titanic/pet_control/pet_remote.cpp b/engines/titanic/pet_control/pet_remote.cpp index 1ed0251f24..6ba6e558c3 100644 --- a/engines/titanic/pet_control/pet_remote.cpp +++ b/engines/titanic/pet_control/pet_remote.cpp @@ -329,6 +329,10 @@ bool CPetRemote::loadGlyph(int glyphIndex) { glyph = new COperateLightsGlyph(); break; + case GLYPH_DEPLOY_FLORAL: + glyph = new CDeployFloralGlyph(); + break; + default: break; } diff --git a/engines/titanic/pet_control/pet_remote_glyphs.cpp b/engines/titanic/pet_control/pet_remote_glyphs.cpp index c1d86d6703..edf1dce80f 100644 --- a/engines/titanic/pet_control/pet_remote_glyphs.cpp +++ b/engines/titanic/pet_control/pet_remote_glyphs.cpp @@ -238,7 +238,6 @@ void CEntertainmentDeviceGlyph::getTooltip(CPetText *text) { /*------------------------------------------------------------------------*/ - bool COperateLightsGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { CPetRemoteGlyph::setup(petControl, owner); setDefaults("3PetLights", petControl); @@ -291,4 +290,17 @@ void COperateLightsGlyph::getTooltip(CPetText *text) { text->setText("Operate the lights"); } +/*------------------------------------------------------------------------*/ + +bool CDeployFloralGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { + CToggleRemoteGlyph::setup(petControl, owner); + setDefaults("3PetVase", petControl); + return true; +} + +void CDeployFloralGlyph::getTooltip(CPetText *text) { + text->setText("Deploy floral enhancement"); +} + + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_remote_glyphs.h b/engines/titanic/pet_control/pet_remote_glyphs.h index 39f9164979..de56787bd0 100644 --- a/engines/titanic/pet_control/pet_remote_glyphs.h +++ b/engines/titanic/pet_control/pet_remote_glyphs.h @@ -31,7 +31,7 @@ namespace Titanic { enum RemoteGlyph { GLYPH_SUMMON_ELEVATOR = 0, GLYPH_SUMMON_PELLERATOR = 1, GLYPH_TELEVISION_CONTROL = 2, GLYPH_ENTERTAINMENT_DEVICE = 3, - GLYPH_OPERATE_LIGHTS = 4 + GLYPH_OPERATE_LIGHTS = 4, GLYPH_DEPLOY_FLORAL = 5 }; enum RemoteMessage { @@ -251,6 +251,33 @@ public: virtual void getTooltip(CPetText *text); }; +class CDeployFloralGlyph : public CToggleRemoteGlyph { +public: + /** + * Setup the glyph + */ + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); + + /** + * Called for mouse button down messages + */ + virtual bool MouseButtonDownMsg(const Point &pt) { + return elementMouseButtonDownMsg(pt); + } + + /** + * Handles mouse button up messages + */ + virtual bool MouseButtonUpMsg(const Point &pt) { + return elementMouseButtonUpMsg(pt); + } + + /** + * Returns the tooltip text for when the glyph is selected + */ + virtual void getTooltip(CPetText *text); +}; + } // End of namespace Titanic #endif /* TITANIC_PET_REMOTE_GLYPHS_H */ -- cgit v1.2.3 From 82a1f6f0aa0afd414e3de677ab49e7ea1c15f226 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 2 May 2016 20:34:21 -0400 Subject: TITANIC: Implement Deploy Relaxation Device glyph --- engines/titanic/pet_control/pet_remote.cpp | 7 +++++- engines/titanic/pet_control/pet_remote_glyphs.cpp | 12 +++++++++ engines/titanic/pet_control/pet_remote_glyphs.h | 30 ++++++++++++++++++++++- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/engines/titanic/pet_control/pet_remote.cpp b/engines/titanic/pet_control/pet_remote.cpp index 6ba6e558c3..dbb912277d 100644 --- a/engines/titanic/pet_control/pet_remote.cpp +++ b/engines/titanic/pet_control/pet_remote.cpp @@ -73,7 +73,8 @@ static const byte REMOTE_DATA[] = { 0x1C, 0x00, 0x1D, 0x02, GLYPH_SUMMON_ELEVATOR, 0x10, 0x1E, 0x0C, - 0x05, 0x06, 0x07, 0x08, GLYPH_ENTERTAINMENT_DEVICE, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + GLYPH_DEPLOY_FLORAL, GLYPH_DEPLOY_RELAXATION, 0x07, 0x08, + GLYPH_ENTERTAINMENT_DEVICE, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x1F, 0x01, 0x10, 0x20, 0x02, GLYPH_SUMMON_ELEVATOR, GLYPH_SUMMON_PELLERATOR, @@ -333,6 +334,10 @@ bool CPetRemote::loadGlyph(int glyphIndex) { glyph = new CDeployFloralGlyph(); break; + case GLYPH_DEPLOY_RELAXATION: + glyph = new CDeployRelaxationGlyph(); + break; + default: break; } diff --git a/engines/titanic/pet_control/pet_remote_glyphs.cpp b/engines/titanic/pet_control/pet_remote_glyphs.cpp index edf1dce80f..a41f6431a6 100644 --- a/engines/titanic/pet_control/pet_remote_glyphs.cpp +++ b/engines/titanic/pet_control/pet_remote_glyphs.cpp @@ -303,4 +303,16 @@ void CDeployFloralGlyph::getTooltip(CPetText *text) { } +/*------------------------------------------------------------------------*/ + +bool CDeployRelaxationGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { + CToggleRemoteGlyph::setup(petControl, owner); + setDefaults("3PetBedfoot", petControl); + return true; +} + +void CDeployRelaxationGlyph::getTooltip(CPetText *text) { + text->setText("Deploy fully recumbent relaxation device"); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_remote_glyphs.h b/engines/titanic/pet_control/pet_remote_glyphs.h index de56787bd0..09c626414c 100644 --- a/engines/titanic/pet_control/pet_remote_glyphs.h +++ b/engines/titanic/pet_control/pet_remote_glyphs.h @@ -31,7 +31,8 @@ namespace Titanic { enum RemoteGlyph { GLYPH_SUMMON_ELEVATOR = 0, GLYPH_SUMMON_PELLERATOR = 1, GLYPH_TELEVISION_CONTROL = 2, GLYPH_ENTERTAINMENT_DEVICE = 3, - GLYPH_OPERATE_LIGHTS = 4, GLYPH_DEPLOY_FLORAL = 5 + GLYPH_OPERATE_LIGHTS = 4, GLYPH_DEPLOY_FLORAL = 5, + GLYPH_DEPLOY_RELAXATION = 6 }; enum RemoteMessage { @@ -278,6 +279,33 @@ public: virtual void getTooltip(CPetText *text); }; +class CDeployRelaxationGlyph : public CToggleRemoteGlyph { +public: + /** + * Setup the glyph + */ + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); + + /** + * Called for mouse button down messages + */ + virtual bool MouseButtonDownMsg(const Point &pt) { + return elementMouseButtonDownMsg(pt); + } + + /** + * Handles mouse button up messages + */ + virtual bool MouseButtonUpMsg(const Point &pt) { + return elementMouseButtonUpMsg(pt); + } + + /** + * Returns the tooltip text for when the glyph is selected + */ + virtual void getTooltip(CPetText *text); +}; + } // End of namespace Titanic #endif /* TITANIC_PET_REMOTE_GLYPHS_H */ -- cgit v1.2.3 From dd9a4f4b5b5b55fa41129568ff8ad4c9329e6759 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 2 May 2016 20:44:33 -0400 Subject: TITANIC: Implement Deploy Comfort Device glyph --- engines/titanic/pet_control/pet_remote.cpp | 7 +++- engines/titanic/pet_control/pet_remote_glyphs.cpp | 22 +++++++++--- engines/titanic/pet_control/pet_remote_glyphs.h | 41 +++++++++++++++++++---- 3 files changed, 57 insertions(+), 13 deletions(-) diff --git a/engines/titanic/pet_control/pet_remote.cpp b/engines/titanic/pet_control/pet_remote.cpp index dbb912277d..9277f81610 100644 --- a/engines/titanic/pet_control/pet_remote.cpp +++ b/engines/titanic/pet_control/pet_remote.cpp @@ -73,7 +73,8 @@ static const byte REMOTE_DATA[] = { 0x1C, 0x00, 0x1D, 0x02, GLYPH_SUMMON_ELEVATOR, 0x10, 0x1E, 0x0C, - GLYPH_DEPLOY_FLORAL, GLYPH_DEPLOY_RELAXATION, 0x07, 0x08, + GLYPH_DEPLOY_FLORAL, GLYPH_DEPLOY_RELAXATION, GLYPH_DEPLOY_COMFORT, + 0x08, GLYPH_ENTERTAINMENT_DEVICE, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x1F, 0x01, 0x10, 0x20, 0x02, @@ -338,6 +339,10 @@ bool CPetRemote::loadGlyph(int glyphIndex) { glyph = new CDeployRelaxationGlyph(); break; + case GLYPH_DEPLOY_COMFORT: + glyph = new CDeployComfortGlyph(); + break; + default: break; } diff --git a/engines/titanic/pet_control/pet_remote_glyphs.cpp b/engines/titanic/pet_control/pet_remote_glyphs.cpp index a41f6431a6..9ca69869fb 100644 --- a/engines/titanic/pet_control/pet_remote_glyphs.cpp +++ b/engines/titanic/pet_control/pet_remote_glyphs.cpp @@ -97,17 +97,17 @@ void CToggleRemoteGlyph::draw2(CScreenManager *screenManager) { _gfxElement->draw(screenManager); } -bool CToggleRemoteGlyph::elementMouseButtonDownMsg(const Point &pt) { +bool CToggleRemoteGlyph::elementMouseButtonDownMsg(const Point &pt, int petNum) { return _gfxElement->MouseButtonDownMsg(pt); } -bool CToggleRemoteGlyph::elementMouseButtonUpMsg(const Point &pt) { +bool CToggleRemoteGlyph::elementMouseButtonUpMsg(const Point &pt, int petNum) { if (!_gfxElement->MouseButtonUpMsg(pt)) return false; CTreeItem *target = getPetControl()->_remoteTarget; if (target) { - CPETActivateMsg msg("SGTSelector", -1); + CPETActivateMsg msg("SGTSelector", petNum); msg.execute(target); _flag = !_flag; _gfxElement->setMode(_flag ? MODE_SELECTED : MODE_UNSELECTED); @@ -200,7 +200,7 @@ void CEntertainmentDeviceGlyph::draw2(CScreenManager *screenManager) { bool CEntertainmentDeviceGlyph::MouseButtonDownMsg(const Point &pt) { CString viewName = getPetControl()->getFullViewName(); if (viewName == "SGTState.Node 1.S") { - return elementMouseButtonDownMsg(pt); + return elementMouseButtonDownMsg(pt, 4); } else if (viewName == "SGTState.Node 4.E") { return _gfxElement->MouseButtonDownMsg(pt) || _gfxElement2->MouseButtonDownMsg(pt) @@ -213,7 +213,7 @@ bool CEntertainmentDeviceGlyph::MouseButtonDownMsg(const Point &pt) { bool CEntertainmentDeviceGlyph::MouseButtonUpMsg(const Point &pt) { CString viewName = getPetControl()->getFullViewName(); if (viewName == "SGTState.Node 1.S") { - return elementMouseButtonUpMsg(pt); + return elementMouseButtonUpMsg(pt, 4); } else if (viewName == "SGTState.Node 4.E") { if (_gfxElement->MouseButtonUpMsg(pt)) { _flag2 = !_flag2; @@ -315,4 +315,16 @@ void CDeployRelaxationGlyph::getTooltip(CPetText *text) { text->setText("Deploy fully recumbent relaxation device"); } +/*------------------------------------------------------------------------*/ + +bool CDeployComfortGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { + CToggleRemoteGlyph::setup(petControl, owner); + setDefaults("3PetToilet", petControl); + return true; +} + +void CDeployComfortGlyph::getTooltip(CPetText *text) { + text->setText("Deploy comfort workstation"); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_remote_glyphs.h b/engines/titanic/pet_control/pet_remote_glyphs.h index 09c626414c..eb235bc957 100644 --- a/engines/titanic/pet_control/pet_remote_glyphs.h +++ b/engines/titanic/pet_control/pet_remote_glyphs.h @@ -32,7 +32,7 @@ enum RemoteGlyph { GLYPH_SUMMON_ELEVATOR = 0, GLYPH_SUMMON_PELLERATOR = 1, GLYPH_TELEVISION_CONTROL = 2, GLYPH_ENTERTAINMENT_DEVICE = 3, GLYPH_OPERATE_LIGHTS = 4, GLYPH_DEPLOY_FLORAL = 5, - GLYPH_DEPLOY_RELAXATION = 6 + GLYPH_DEPLOY_RELAXATION = 6, GLYPH_DEPLOY_COMFORT = 7 }; enum RemoteMessage { @@ -130,12 +130,12 @@ public: /** * Called for mouse button down messages to the default element */ - bool elementMouseButtonDownMsg(const Point &pt); + bool elementMouseButtonDownMsg(const Point &pt, int petNum); /** * Called for mouse button up messages to the default element */ - bool elementMouseButtonUpMsg(const Point &pt); + bool elementMouseButtonUpMsg(const Point &pt, int petNum); }; class CSummonElevatorGlyph : public CBasicRemoteGlyph { @@ -263,14 +263,14 @@ public: * Called for mouse button down messages */ virtual bool MouseButtonDownMsg(const Point &pt) { - return elementMouseButtonDownMsg(pt); + return elementMouseButtonDownMsg(pt, 0); } /** * Handles mouse button up messages */ virtual bool MouseButtonUpMsg(const Point &pt) { - return elementMouseButtonUpMsg(pt); + return elementMouseButtonUpMsg(pt, 0); } /** @@ -280,6 +280,33 @@ public: }; class CDeployRelaxationGlyph : public CToggleRemoteGlyph { +public: + /** + * Setup the glyph + */ + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); + + /** + * Called for mouse button down messages + */ + virtual bool MouseButtonDownMsg(const Point &pt) { + return elementMouseButtonDownMsg(pt, 1); + } + + /** + * Handles mouse button up messages + */ + virtual bool MouseButtonUpMsg(const Point &pt) { + return elementMouseButtonUpMsg(pt, 1); + } + + /** + * Returns the tooltip text for when the glyph is selected + */ + virtual void getTooltip(CPetText *text); +}; + +class CDeployComfortGlyph : public CToggleRemoteGlyph { public: /** * Setup the glyph @@ -290,14 +317,14 @@ public: * Called for mouse button down messages */ virtual bool MouseButtonDownMsg(const Point &pt) { - return elementMouseButtonDownMsg(pt); + return elementMouseButtonDownMsg(pt, 2); } /** * Handles mouse button up messages */ virtual bool MouseButtonUpMsg(const Point &pt) { - return elementMouseButtonUpMsg(pt); + return elementMouseButtonUpMsg(pt, 2); } /** -- cgit v1.2.3 From 8551f08d0d006b0a2be483420e8920be501d1d55 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 2 May 2016 21:48:45 -0400 Subject: TITANIC: Implemented more PET Remote glyph classes --- engines/titanic/pet_control/pet_remote.cpp | 95 ++++++-- engines/titanic/pet_control/pet_remote_glyphs.cpp | 148 +++++++++++- engines/titanic/pet_control/pet_remote_glyphs.h | 262 +++++++++++++++++++++- 3 files changed, 475 insertions(+), 30 deletions(-) diff --git a/engines/titanic/pet_control/pet_remote.cpp b/engines/titanic/pet_control/pet_remote.cpp index 9277f81610..6dc7a1a12f 100644 --- a/engines/titanic/pet_control/pet_remote.cpp +++ b/engines/titanic/pet_control/pet_remote.cpp @@ -31,52 +31,63 @@ namespace Titanic { static const byte REMOTE_DATA[] = { 0x00, 0x02, - GLYPH_SUMMON_ELEVATOR, 0x10, + GLYPH_SUMMON_ELEVATOR, GLYPH_SUCCUBUS_DELIVERY, 0x01, 0x02, - GLYPH_SUMMON_PELLERATOR, 0x10, + GLYPH_SUMMON_PELLERATOR, GLYPH_SUCCUBUS_DELIVERY, 0x02, 0x03, - GLYPH_TELEVISION_CONTROL, GLYPH_OPERATE_LIGHTS, 0x10, + GLYPH_TELEVISION_CONTROL, GLYPH_OPERATE_LIGHTS, GLYPH_SUCCUBUS_DELIVERY, 0x03, 0x02, - GLYPH_SUMMON_ELEVATOR, 0x10, + GLYPH_SUMMON_ELEVATOR, GLYPH_SUCCUBUS_DELIVERY, 0x04, 0x02, - GLYPH_TELEVISION_CONTROL, 0x10, + GLYPH_TELEVISION_CONTROL, GLYPH_SUCCUBUS_DELIVERY, 0x05, 0x02, - GLYPH_SUMMON_PELLERATOR, 0x10, + GLYPH_SUMMON_PELLERATOR, GLYPH_SUCCUBUS_DELIVERY, 0x06, 0x02, - GLYPH_SUMMON_PELLERATOR, 0x10, + GLYPH_SUMMON_PELLERATOR, GLYPH_SUCCUBUS_DELIVERY, 0x07, 0x03, - GLYPH_TELEVISION_CONTROL, GLYPH_SUMMON_PELLERATOR, 0x10, - 0x08, 0x01, 0x10, - 0x09, 0x01, 0x10, - 0x0A, 0x02, GLYPH_SUMMON_ELEVATOR, 0x10, + GLYPH_TELEVISION_CONTROL, GLYPH_SUMMON_PELLERATOR, GLYPH_SUCCUBUS_DELIVERY, + 0x08, 0x01, + GLYPH_SUCCUBUS_DELIVERY, + 0x09, 0x01, + GLYPH_SUCCUBUS_DELIVERY, + 0x0A, 0x02, GLYPH_SUMMON_ELEVATOR, GLYPH_SUCCUBUS_DELIVERY, 0x0B, 0x01, 0x11, - 0x0C, 0x01, 0x10, - 0x0D, 0x01, 0x10, + 0x0C, 0x01, + GLYPH_SUCCUBUS_DELIVERY, + 0x0D, 0x01, + GLYPH_SUCCUBUS_DELIVERY, 0x0E, 0x00, 0x0F, 0x01, GLYPH_TELEVISION_CONTROL, 0x10, 0x03, 0x12, 0x14, 0x13, - 0x11, 0x01, 0x10, + 0x11, 0x01, + GLYPH_SUCCUBUS_DELIVERY, 0x12, 0x00, 0x13, 0x02, - GLYPH_SUMMON_PELLERATOR, 0x10, + GLYPH_SUMMON_PELLERATOR, GLYPH_SUCCUBUS_DELIVERY, 0x14, 0x00, 0x15, 0x02, 0x10, GLYPH_TELEVISION_CONTROL, 0x16, 0x00, 0x17, 0x02, - GLYPH_SUMMON_PELLERATOR, 0x10, - 0x18, 0x01, 0x10, + GLYPH_SUMMON_PELLERATOR, GLYPH_SUCCUBUS_DELIVERY, + 0x18, 0x01, + GLYPH_SUCCUBUS_DELIVERY, 0x19, 0x00, 0x1A, 0x00, 0x1B, 0x00, 0x1C, 0x00, - 0x1D, 0x02, GLYPH_SUMMON_ELEVATOR, 0x10, + 0x1D, 0x02, + GLYPH_SUMMON_ELEVATOR, GLYPH_SUCCUBUS_DELIVERY, 0x1E, 0x0C, - GLYPH_DEPLOY_FLORAL, GLYPH_DEPLOY_RELAXATION, GLYPH_DEPLOY_COMFORT, - 0x08, - GLYPH_ENTERTAINMENT_DEVICE, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x1F, 0x01, 0x10, + GLYPH_DEPLOY_FLORAL, GLYPH_DEPLOY_FULLY_RELAXATION, GLYPH_DEPLOY_COMFORT, + GLYPH_DEPLOY_MINOR_STORAGE, GLYPH_ENTERTAINMENT_DEVICE, + GLYPH_DEPLOY_MAJOR_RELAXATION, GLYPH_INFLATE_RELAXATION, + GLYPH_DEPLOY_MAINTENANCE, GLYPH_DEPLOY_WORK_SURFACE, + GLYPH_DEPLOY_MINOR_RELAXATION, GLYPH_DEPLOY_SINK, + GLYPH_DEPLOY_MAJOR_STORAGE, + 0x1F, 0x01, + GLYPH_SUCCUBUS_DELIVERY, 0x20, 0x02, GLYPH_SUMMON_ELEVATOR, GLYPH_SUMMON_PELLERATOR, 0x21, 0x00 @@ -335,14 +346,50 @@ bool CPetRemote::loadGlyph(int glyphIndex) { glyph = new CDeployFloralGlyph(); break; - case GLYPH_DEPLOY_RELAXATION: - glyph = new CDeployRelaxationGlyph(); + case GLYPH_DEPLOY_FULLY_RELAXATION: + glyph = new CDeployFullyRelaxationGlyph(); break; case GLYPH_DEPLOY_COMFORT: glyph = new CDeployComfortGlyph(); break; + case GLYPH_DEPLOY_MINOR_STORAGE: + glyph = new CDeployMinorStorageGlyph(); + break; + + case GLYPH_DEPLOY_MAJOR_RELAXATION: + glyph = new CDeployMajorRelaxationGlyph(); + break; + + case GLYPH_INFLATE_RELAXATION: + glyph = new CInflateRelaxationGlyph(); + break; + + case GLYPH_DEPLOY_MAINTENANCE: + glyph = new CDeployMaintenanceGlyph(); + break; + + case GLYPH_DEPLOY_WORK_SURFACE: + glyph = new CDeployWorkSurfaceGlyph(); + break; + + case GLYPH_DEPLOY_MINOR_RELAXATION: + glyph = new CDeployMinorRelaxationGlyph(); + break; + + case GLYPH_DEPLOY_SINK: + glyph = new CDeploySinkGlyph(); + break; + + case GLYPH_DEPLOY_MAJOR_STORAGE: + glyph = new CDeployMajorStorageGlyph(); + break; + + case GLYPH_SUCCUBUS_DELIVERY: + glyph = new CSuccubusDeliveryGlyph(); + break; + default: break; } diff --git a/engines/titanic/pet_control/pet_remote_glyphs.cpp b/engines/titanic/pet_control/pet_remote_glyphs.cpp index 9ca69869fb..460907a99c 100644 --- a/engines/titanic/pet_control/pet_remote_glyphs.cpp +++ b/engines/titanic/pet_control/pet_remote_glyphs.cpp @@ -305,13 +305,13 @@ void CDeployFloralGlyph::getTooltip(CPetText *text) { /*------------------------------------------------------------------------*/ -bool CDeployRelaxationGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { +bool CDeployFullyRelaxationGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { CToggleRemoteGlyph::setup(petControl, owner); setDefaults("3PetBedfoot", petControl); return true; } -void CDeployRelaxationGlyph::getTooltip(CPetText *text) { +void CDeployFullyRelaxationGlyph::getTooltip(CPetText *text) { text->setText("Deploy fully recumbent relaxation device"); } @@ -327,4 +327,148 @@ void CDeployComfortGlyph::getTooltip(CPetText *text) { text->setText("Deploy comfort workstation"); } +/*------------------------------------------------------------------------*/ + +bool CDeployMinorStorageGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { + CToggleRemoteGlyph::setup(petControl, owner); + setDefaults("3PetDraw", petControl); + return true; +} + +void CDeployMinorStorageGlyph::getTooltip(CPetText *text) { + text->setText("Deploy minor horizontally mobile storage compartment"); +} + +/*------------------------------------------------------------------------*/ + +bool CDeployMajorRelaxationGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { + CToggleRemoteGlyph::setup(petControl, owner); + setDefaults("3PetArmChair", petControl); + return true; +} + +void CDeployMajorRelaxationGlyph::getTooltip(CPetText *text) { + text->setText("Deploy major semi-recumbent relaxation device"); +} + +/*------------------------------------------------------------------------*/ + +bool CInflateRelaxationGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { + CToggleRemoteGlyph::setup(petControl, owner); + setDefaults("3PetBedhead", petControl); + return true; +} + +void CInflateRelaxationGlyph::getTooltip(CPetText *text) { + text->setText("Inflate fully recumbent relaxation device "); +} + +/*------------------------------------------------------------------------*/ + +bool CDeployMaintenanceGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { + CToggleRemoteGlyph::setup(petControl, owner); + setDefaults("3PetWashstand", petControl); + return true; +} + +void CDeployMaintenanceGlyph::getTooltip(CPetText *text) { + text->setText("Deploy personal maintenance hub"); +} + +/*------------------------------------------------------------------------*/ + +bool CDeployWorkSurfaceGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { + CToggleRemoteGlyph::setup(petControl, owner); + setDefaults("3PetTable", petControl); + return true; +} + +void CDeployWorkSurfaceGlyph::getTooltip(CPetText *text) { + text->setText("Deploy executive horizontal worksurface"); +} + +/*------------------------------------------------------------------------*/ + +bool CDeployMinorRelaxationGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { + CToggleRemoteGlyph::setup(petControl, owner); + setDefaults("3PetDeskchair", petControl); + return true; +} + +void CDeployMinorRelaxationGlyph::getTooltip(CPetText *text) { + text->setText("Deploy minor semi-recumbent relaxation device"); +} + +/*------------------------------------------------------------------------*/ + +bool CDeploySinkGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { + CToggleRemoteGlyph::setup(petControl, owner); + setDefaults("3PetDeskchair", petControl); + return true; +} + +void CDeploySinkGlyph::getTooltip(CPetText *text) { + text->setText("Deploy aqueous cleansing receptacle"); +} + +/*------------------------------------------------------------------------*/ + +bool CDeployMajorStorageGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { + CToggleRemoteGlyph::setup(petControl, owner); + setDefaults("3PetChest", petControl); + return true; +} + +void CDeployMajorStorageGlyph::getTooltip(CPetText *text) { + text->setText("Deploy major horizontally mobile storage compartment"); +} + +/*------------------------------------------------------------------------*/ + +bool CSuccubusDeliveryGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { + CPetRemoteGlyph::setup(petControl, owner); + setDefaults("3PetSuccubus", petControl); + + if (owner) { + _gfxElement1 = getElement(16); + _gfxElement2 = getElement(17); + } + + return true; +} + +void CSuccubusDeliveryGlyph::draw2(CScreenManager *screenManager) { + _gfxElement1->draw(screenManager); + _gfxElement2->draw(screenManager); +} + +bool CSuccubusDeliveryGlyph::MouseButtonDownMsg(const Point &pt) { + return _gfxElement1->MouseButtonDownMsg(pt) + || _gfxElement2->MouseButtonDownMsg(pt); +} + +bool CSuccubusDeliveryGlyph::MouseButtonUpMsg(const Point &pt) { + CTreeItem *target = getPetControl()->_remoteTarget; + + if (_gfxElement1 && _gfxElement1->MouseButtonUpMsg(pt)) { + if (target) { + CPETDeliverMsg msg; + msg.execute(target); + } + } else if (_gfxElement2 && _gfxElement2->MouseButtonUpMsg(pt)) { + if (target) { + CPETReceiveMsg msg; + msg.execute(target); + } + } else { + return false; + } + + return true; +} + +void CSuccubusDeliveryGlyph::getTooltip(CPetText *text) { + text->setText("Succ-U-Bus delivery system control"); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_remote_glyphs.h b/engines/titanic/pet_control/pet_remote_glyphs.h index eb235bc957..0043ea97d8 100644 --- a/engines/titanic/pet_control/pet_remote_glyphs.h +++ b/engines/titanic/pet_control/pet_remote_glyphs.h @@ -32,7 +32,12 @@ enum RemoteGlyph { GLYPH_SUMMON_ELEVATOR = 0, GLYPH_SUMMON_PELLERATOR = 1, GLYPH_TELEVISION_CONTROL = 2, GLYPH_ENTERTAINMENT_DEVICE = 3, GLYPH_OPERATE_LIGHTS = 4, GLYPH_DEPLOY_FLORAL = 5, - GLYPH_DEPLOY_RELAXATION = 6, GLYPH_DEPLOY_COMFORT = 7 + GLYPH_DEPLOY_FULLY_RELAXATION = 6, GLYPH_DEPLOY_COMFORT = 7, + GLYPH_DEPLOY_MINOR_STORAGE = 8, GLYPH_DEPLOY_MAJOR_RELAXATION = 9, + GLYPH_INFLATE_RELAXATION = 10, GLYPH_DEPLOY_MAINTENANCE = 11, + GLYPH_DEPLOY_WORK_SURFACE = 12, GLYPH_DEPLOY_MINOR_RELAXATION = 13, + GLYPH_DEPLOY_SINK = 14, GLYPH_DEPLOY_MAJOR_STORAGE = 15, + GLYPH_SUCCUBUS_DELIVERY = 16 }; enum RemoteMessage { @@ -279,7 +284,7 @@ public: virtual void getTooltip(CPetText *text); }; -class CDeployRelaxationGlyph : public CToggleRemoteGlyph { +class CDeployFullyRelaxationGlyph : public CToggleRemoteGlyph { public: /** * Setup the glyph @@ -307,6 +312,114 @@ public: }; class CDeployComfortGlyph : public CToggleRemoteGlyph { +public: + /** + * Setup the glyph + */ + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); + + /** + * Called for mouse button down messages + */ + virtual bool MouseButtonDownMsg(const Point &pt) { + return elementMouseButtonDownMsg(pt, 2); + } + + /** + * Handles mouse button up messages + */ + virtual bool MouseButtonUpMsg(const Point &pt) { + return elementMouseButtonUpMsg(pt, 2); + } + + /** + * Returns the tooltip text for when the glyph is selected + */ + virtual void getTooltip(CPetText *text); +}; + +class CDeployMinorStorageGlyph : public CToggleRemoteGlyph { +public: + /** + * Setup the glyph + */ + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); + + /** + * Called for mouse button down messages + */ + virtual bool MouseButtonDownMsg(const Point &pt) { + return elementMouseButtonDownMsg(pt, 3); + } + + /** + * Handles mouse button up messages + */ + virtual bool MouseButtonUpMsg(const Point &pt) { + return elementMouseButtonUpMsg(pt, 3); + } + + /** + * Returns the tooltip text for when the glyph is selected + */ + virtual void getTooltip(CPetText *text); +}; + +class CDeployMajorRelaxationGlyph : public CToggleRemoteGlyph { +public: + /** + * Setup the glyph + */ + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); + + /** + * Called for mouse button down messages + */ + virtual bool MouseButtonDownMsg(const Point &pt) { + return elementMouseButtonDownMsg(pt, 5); + } + + /** + * Handles mouse button up messages + */ + virtual bool MouseButtonUpMsg(const Point &pt) { + return elementMouseButtonUpMsg(pt, 5); + } + + /** + * Returns the tooltip text for when the glyph is selected + */ + virtual void getTooltip(CPetText *text); +}; + +class CInflateRelaxationGlyph : public CToggleRemoteGlyph { +public: + /** + * Setup the glyph + */ + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); + + /** + * Called for mouse button down messages + */ + virtual bool MouseButtonDownMsg(const Point &pt) { + return elementMouseButtonDownMsg(pt, 6); + } + + /** + * Handles mouse button up messages + */ + virtual bool MouseButtonUpMsg(const Point &pt) { + return elementMouseButtonUpMsg(pt, 6); + } + + /** + * Returns the tooltip text for when the glyph is selected + */ + virtual void getTooltip(CPetText *text); +}; + +class CDeployMaintenanceGlyph : public CToggleRemoteGlyph { public: /** * Setup the glyph @@ -317,14 +430,14 @@ public: * Called for mouse button down messages */ virtual bool MouseButtonDownMsg(const Point &pt) { - return elementMouseButtonDownMsg(pt, 2); + return elementMouseButtonDownMsg(pt, 7); } /** * Handles mouse button up messages */ virtual bool MouseButtonUpMsg(const Point &pt) { - return elementMouseButtonUpMsg(pt, 2); + return elementMouseButtonUpMsg(pt, 7); } /** @@ -333,6 +446,147 @@ public: virtual void getTooltip(CPetText *text); }; +class CDeployWorkSurfaceGlyph : public CToggleRemoteGlyph { +public: + /** + * Setup the glyph + */ + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); + + /** + * Called for mouse button down messages + */ + virtual bool MouseButtonDownMsg(const Point &pt) { + return elementMouseButtonDownMsg(pt, 8); + } + + /** + * Handles mouse button up messages + */ + virtual bool MouseButtonUpMsg(const Point &pt) { + return elementMouseButtonUpMsg(pt, 8); + } + + /** + * Returns the tooltip text for when the glyph is selected + */ + virtual void getTooltip(CPetText *text); +}; + +class CDeployMinorRelaxationGlyph : public CToggleRemoteGlyph { +public: + /** + * Setup the glyph + */ + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); + + /** + * Called for mouse button down messages + */ + virtual bool MouseButtonDownMsg(const Point &pt) { + return elementMouseButtonDownMsg(pt, 9); + } + + /** + * Handles mouse button up messages + */ + virtual bool MouseButtonUpMsg(const Point &pt) { + return elementMouseButtonUpMsg(pt, 9); + } + + /** + * Returns the tooltip text for when the glyph is selected + */ + virtual void getTooltip(CPetText *text); +}; + +class CDeploySinkGlyph : public CToggleRemoteGlyph { +public: + /** + * Setup the glyph + */ + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); + + /** + * Called for mouse button down messages + */ + virtual bool MouseButtonDownMsg(const Point &pt) { + return elementMouseButtonDownMsg(pt, 10); + } + + /** + * Handles mouse button up messages + */ + virtual bool MouseButtonUpMsg(const Point &pt) { + return elementMouseButtonUpMsg(pt, 10); + } + + /** + * Returns the tooltip text for when the glyph is selected + */ + virtual void getTooltip(CPetText *text); +}; + +class CDeployMajorStorageGlyph : public CToggleRemoteGlyph { +public: + /** + * Setup the glyph + */ + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); + + /** + * Called for mouse button down messages + */ + virtual bool MouseButtonDownMsg(const Point &pt) { + return elementMouseButtonDownMsg(pt, 11); + } + + /** + * Handles mouse button up messages + */ + virtual bool MouseButtonUpMsg(const Point &pt) { + return elementMouseButtonUpMsg(pt, 11); + } + + /** + * Returns the tooltip text for when the glyph is selected + */ + virtual void getTooltip(CPetText *text); +}; + +class CSuccubusDeliveryGlyph : public CPetRemoteGlyph { +private: + CPetGfxElement *_gfxElement1, *_gfxElement2; +public: + CSuccubusDeliveryGlyph() : CPetRemoteGlyph(), + _gfxElement1(nullptr), _gfxElement2(nullptr) {} + + /** + * Setup the glyph + */ + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); + + /** + * Handles any secondary drawing of the glyph + */ + virtual void draw2(CScreenManager *screenManager); + + /** + * Called for mouse button down messages + */ + virtual bool MouseButtonDownMsg(const Point &pt); + + /** + * Handles mouse button up messages + */ + virtual bool MouseButtonUpMsg(const Point &pt); + + /** + * Returns the tooltip text for when the glyph is selected + */ + virtual void getTooltip(CPetText *text); +}; + } // End of namespace Titanic #endif /* TITANIC_PET_REMOTE_GLYPHS_H */ -- cgit v1.2.3 From 6166c33734efdeabca0fa9d3eeda34389af6b79b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 2 May 2016 22:23:21 -0400 Subject: TITANIC: Implemented more PET Remote glyph classes --- engines/titanic/messages/messages.h | 14 +--- engines/titanic/pet_control/pet_remote.cpp | 14 +++- engines/titanic/pet_control/pet_remote_glyphs.cpp | 94 +++++++++++++++++++++++ engines/titanic/pet_control/pet_remote_glyphs.h | 80 ++++++++++++++++++- 4 files changed, 186 insertions(+), 16 deletions(-) diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 4c8ccaf43a..d64972c40d 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -180,19 +180,6 @@ public: } }; -class CTransportMsg : public CMessage { -public: - CString _string; - int _value1, _value2; -public: - CLASSDEF - CTransportMsg() : _value1(0), _value2(0) {} - - static bool isSupportedBy(const CTreeItem *item) { - return supports(item, _type); - } -}; - MESSAGE1(CTimeMsg, uint, _ticks, 0); class CTimerMsg : public CTimeMsg { @@ -350,6 +337,7 @@ MESSAGE1(CTimeDilationMsg, int, value, 0); MESSAGE0(CTitleSequenceEndedMsg); MESSAGE0(CTransitMsg); MESSAGE1(CTranslateObjectMsg, Point, delta, Point()); +MESSAGE3(CTransportMsg, CString, roomName, "", int, value1, 0, int, value2, 0); MESSAGE1(CTriggerAutoMusicPlayerMsg, int, value, 0); MESSAGE1(CTriggerNPCEvent, int, value, 0); MESSAGE4(CTrueTalkGetAnimSetMsg, int, value1, 0, int, value2, 0, int, value3, 0, int, value4, 0); diff --git a/engines/titanic/pet_control/pet_remote.cpp b/engines/titanic/pet_control/pet_remote.cpp index 6dc7a1a12f..f2062aff25 100644 --- a/engines/titanic/pet_control/pet_remote.cpp +++ b/engines/titanic/pet_control/pet_remote.cpp @@ -51,7 +51,8 @@ static const byte REMOTE_DATA[] = { 0x09, 0x01, GLYPH_SUCCUBUS_DELIVERY, 0x0A, 0x02, GLYPH_SUMMON_ELEVATOR, GLYPH_SUCCUBUS_DELIVERY, - 0x0B, 0x01, 0x11, + 0x0B, 0x01, + GLYPH_NAVIGATION_CONTROLLER, 0x0C, 0x01, GLYPH_SUCCUBUS_DELIVERY, 0x0D, 0x01, @@ -59,7 +60,8 @@ static const byte REMOTE_DATA[] = { 0x0E, 0x00, 0x0F, 0x01, GLYPH_TELEVISION_CONTROL, - 0x10, 0x03, 0x12, 0x14, 0x13, + 0x10, 0x03, + GLYPH_BOTTOM_OF_WELL, 0x14, 0x13, 0x11, 0x01, GLYPH_SUCCUBUS_DELIVERY, 0x12, 0x00, @@ -390,6 +392,14 @@ bool CPetRemote::loadGlyph(int glyphIndex) { glyph = new CSuccubusDeliveryGlyph(); break; + case GLYPH_NAVIGATION_CONTROLLER: + glyph = new CNavigationControllerGlyph(); + break; + + case GLYPH_BOTTOM_OF_WELL: + glyph = new CBottomOfWellGlyph(); + break; + default: break; } diff --git a/engines/titanic/pet_control/pet_remote_glyphs.cpp b/engines/titanic/pet_control/pet_remote_glyphs.cpp index 460907a99c..00ddf421cf 100644 --- a/engines/titanic/pet_control/pet_remote_glyphs.cpp +++ b/engines/titanic/pet_control/pet_remote_glyphs.cpp @@ -24,6 +24,7 @@ #include "titanic/pet_control/pet_remote.h" #include "titanic/pet_control/pet_control.h" #include "titanic/messages/pet_messages.h" +#include "titanic/titanic.h" namespace Titanic { @@ -118,6 +119,47 @@ bool CToggleRemoteGlyph::elementMouseButtonUpMsg(const Point &pt, int petNum) { /*------------------------------------------------------------------------*/ +bool CRemoteGotoGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { + CPetRemoteGlyph::setup(petControl, owner); + + if (owner) + _gfxElement = getElement(7); + + return true; +} + +void CRemoteGotoGlyph::draw2(CScreenManager *screenManager) { + if (_gfxElement) + _gfxElement->draw(screenManager); +} + +bool CRemoteGotoGlyph::MouseButtonDownMsg(const Point &pt) { + return _gfxElement && _gfxElement->MouseButtonDownMsg(pt); +} + +bool CRemoteGotoGlyph::MouseButtonUpMsg(const Point &pt) { + if (!_gfxElement || !_gfxElement->MouseButtonUpMsg(pt)) + return false; + + CPetControl *petControl = getPetControl(); + if (petControl) { + CGameManager *gameManager = petControl->getGameManager(); + + if (gameManager) { + CRoomItem *room = gameManager->getRoom(); + + if (room) { + CTransportMsg msg(g_vm->_roomNames[_roomIndex], 1, 0); + msg.execute(room); + } + } + } + + return true; +} + +/*------------------------------------------------------------------------*/ + bool CTelevisionControlGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { CPetRemoteGlyph::setup(petControl, owner); setDefaults("3PetTV", petControl); @@ -471,4 +513,56 @@ void CSuccubusDeliveryGlyph::getTooltip(CPetText *text) { text->setText("Succ-U-Bus delivery system control"); } +/*------------------------------------------------------------------------*/ + +bool CNavigationControllerGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { + CPetRemoteGlyph::setup(petControl, owner); + setDefaults("3PetStarField", petControl); + + if (owner) + _gfxElement = getElement(0); + + return true; +} + +void CNavigationControllerGlyph::draw2(CScreenManager *screenManager) { + _gfxElement->setMode(_flag ? MODE_SELECTED : MODE_UNSELECTED); + _gfxElement->draw(screenManager); +} + +bool CNavigationControllerGlyph::MouseButtonDownMsg(const Point &pt) { + return _gfxElement->MouseButtonDownMsg(pt); +} + +bool CNavigationControllerGlyph::MouseButtonUpMsg(const Point &pt) { + if (!_gfxElement->MouseButtonUpMsg(pt)) + return false; + + _flag = !_flag; + CTreeItem *target = getPetControl()->_remoteTarget; + if (target) { + CPETHelmetOnOffMsg msg; + msg.execute(target); + } + + return true; +} + +void CNavigationControllerGlyph::getTooltip(CPetText *text) { + text->setText("Navigation controller"); +} + +/*------------------------------------------------------------------------*/ + +bool CBottomOfWellGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { + CPetRemoteGlyph::setup(petControl, owner); + setDefaults("3PetBotOfWell", petControl); + + return true; +} + +void CBottomOfWellGlyph::getTooltip(CPetText *text) { + text->setText("Go to the Bottom of the Well"); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_remote_glyphs.h b/engines/titanic/pet_control/pet_remote_glyphs.h index 0043ea97d8..e6dfc115c0 100644 --- a/engines/titanic/pet_control/pet_remote_glyphs.h +++ b/engines/titanic/pet_control/pet_remote_glyphs.h @@ -37,7 +37,8 @@ enum RemoteGlyph { GLYPH_INFLATE_RELAXATION = 10, GLYPH_DEPLOY_MAINTENANCE = 11, GLYPH_DEPLOY_WORK_SURFACE = 12, GLYPH_DEPLOY_MINOR_RELAXATION = 13, GLYPH_DEPLOY_SINK = 14, GLYPH_DEPLOY_MAJOR_STORAGE = 15, - GLYPH_SUCCUBUS_DELIVERY = 16 + GLYPH_SUCCUBUS_DELIVERY = 16, GLYPH_NAVIGATION_CONTROLLER = 17, + GLYPH_BOTTOM_OF_WELL = 18 }; enum RemoteMessage { @@ -143,6 +144,34 @@ public: bool elementMouseButtonUpMsg(const Point &pt, int petNum); }; +class CRemoteGotoGlyph : public CPetRemoteGlyph { +protected: + int _roomIndex; + CPetGfxElement *_gfxElement; +public: + CRemoteGotoGlyph() : CPetRemoteGlyph(), _gfxElement(nullptr), _roomIndex(21) {} + + /** + * Setup the glyph + */ + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); + + /** + * Handles any secondary drawing of the glyph + */ + virtual void draw2(CScreenManager *screenManager); + + /** + * Called for mouse button down messages + */ + virtual bool MouseButtonDownMsg(const Point &pt); + + /** + * Handles mouse button up messages + */ + virtual bool MouseButtonUpMsg(const Point &pt); +}; + class CSummonElevatorGlyph : public CBasicRemoteGlyph { public: CSummonElevatorGlyph() : CBasicRemoteGlyph( @@ -587,6 +616,55 @@ public: virtual void getTooltip(CPetText *text); }; +class CNavigationControllerGlyph : public CPetRemoteGlyph { +private: + bool _flag; + CPetGfxElement *_gfxElement; +public: + CNavigationControllerGlyph() : CPetRemoteGlyph(), + _flag(false), _gfxElement(nullptr) {} + + /** + * Setup the glyph + */ + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); + + /** + * Handles any secondary drawing of the glyph + */ + virtual void draw2(CScreenManager *screenManager); + + /** + * Called for mouse button down messages + */ + virtual bool MouseButtonDownMsg(const Point &pt); + + /** + * Handles mouse button up messages + */ + virtual bool MouseButtonUpMsg(const Point &pt); + + /** + * Returns the tooltip text for when the glyph is selected + */ + virtual void getTooltip(CPetText *text); +}; + +class CBottomOfWellGlyph : public CRemoteGotoGlyph { +public: + CBottomOfWellGlyph() : CRemoteGotoGlyph() {} + + /** + * Setup the glyph + */ + virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); + + /** + * Returns the tooltip text for when the glyph is selected + */ + virtual void getTooltip(CPetText *text); +}; + } // End of namespace Titanic #endif /* TITANIC_PET_REMOTE_GLYPHS_H */ -- cgit v1.2.3 From 77feb9d8c888444a89132113c282ee3c7766f7f1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 2 May 2016 22:50:08 -0400 Subject: TITANIC: Implement remaining PET Remote glyphs --- engines/titanic/pet_control/pet_remote.cpp | 35 ++++++++++-- engines/titanic/pet_control/pet_remote_glyphs.cpp | 16 ++---- engines/titanic/pet_control/pet_remote_glyphs.h | 67 +++++++++++++++++++---- 3 files changed, 92 insertions(+), 26 deletions(-) diff --git a/engines/titanic/pet_control/pet_remote.cpp b/engines/titanic/pet_control/pet_remote.cpp index f2062aff25..aac0dc8146 100644 --- a/engines/titanic/pet_control/pet_remote.cpp +++ b/engines/titanic/pet_control/pet_remote.cpp @@ -61,7 +61,7 @@ static const byte REMOTE_DATA[] = { 0x0F, 0x01, GLYPH_TELEVISION_CONTROL, 0x10, 0x03, - GLYPH_BOTTOM_OF_WELL, 0x14, 0x13, + GLYPH_GOTO_BOTTOM_OF_WELL, GLYPH_GOTO_STATEROOM, GLYPH_GOTO_TOP_OF_WELL, 0x11, 0x01, GLYPH_SUCCUBUS_DELIVERY, 0x12, 0x00, @@ -69,7 +69,7 @@ static const byte REMOTE_DATA[] = { GLYPH_SUMMON_PELLERATOR, GLYPH_SUCCUBUS_DELIVERY, 0x14, 0x00, 0x15, 0x02, - 0x10, GLYPH_TELEVISION_CONTROL, + GLYPH_SUCCUBUS_DELIVERY, GLYPH_TELEVISION_CONTROL, 0x16, 0x00, 0x17, 0x02, GLYPH_SUMMON_PELLERATOR, GLYPH_SUCCUBUS_DELIVERY, @@ -396,8 +396,35 @@ bool CPetRemote::loadGlyph(int glyphIndex) { glyph = new CNavigationControllerGlyph(); break; - case GLYPH_BOTTOM_OF_WELL: - glyph = new CBottomOfWellGlyph(); + case GLYPH_GOTO_BOTTOM_OF_WELL: + glyph = new CGotoBottomOfWellGlyph(); + break; + + case GLYPH_GOTO_TOP_OF_WELL: + glyph = new CGotoTopOfWellGlyph(); + break; + + case GLYPH_GOTO_STATEROOM: + glyph = new CGotoStateroomGlyph(); + break; + + case GLYPH_GOTO_BAR: + glyph = new CGotoBarGlyph(); + + case GLYPH_GOTO_PROMENADE: + glyph = new CGotoPromenadeDeckGlyph(); + break; + + case GLYPH_GOTO_ARBORETUM: + glyph = new CGotoArboretumGlyph(); + break; + + case GLYPH_GOTO_MUSIC_ROOM: + glyph = new CGotoMusicRoomGlyph(); + break; + + case GLYPH_GOTO_RESTAURANT: + glyph = new CGotoRestaurantGlyph(); break; default: diff --git a/engines/titanic/pet_control/pet_remote_glyphs.cpp b/engines/titanic/pet_control/pet_remote_glyphs.cpp index 00ddf421cf..e42e0825b0 100644 --- a/engines/titanic/pet_control/pet_remote_glyphs.cpp +++ b/engines/titanic/pet_control/pet_remote_glyphs.cpp @@ -121,6 +121,7 @@ bool CToggleRemoteGlyph::elementMouseButtonUpMsg(const Point &pt, int petNum) { bool CRemoteGotoGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { CPetRemoteGlyph::setup(petControl, owner); + setDefaults(_gfxName, petControl); if (owner) _gfxElement = getElement(7); @@ -158,6 +159,10 @@ bool CRemoteGotoGlyph::MouseButtonUpMsg(const Point &pt) { return true; } +void CRemoteGotoGlyph::getTooltip(CPetText *text) { + text->setText(_tooltip); +} + /*------------------------------------------------------------------------*/ bool CTelevisionControlGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { @@ -554,15 +559,4 @@ void CNavigationControllerGlyph::getTooltip(CPetText *text) { /*------------------------------------------------------------------------*/ -bool CBottomOfWellGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { - CPetRemoteGlyph::setup(petControl, owner); - setDefaults("3PetBotOfWell", petControl); - - return true; -} - -void CBottomOfWellGlyph::getTooltip(CPetText *text) { - text->setText("Go to the Bottom of the Well"); -} - } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_remote_glyphs.h b/engines/titanic/pet_control/pet_remote_glyphs.h index e6dfc115c0..d3541d6a94 100644 --- a/engines/titanic/pet_control/pet_remote_glyphs.h +++ b/engines/titanic/pet_control/pet_remote_glyphs.h @@ -38,7 +38,10 @@ enum RemoteGlyph { GLYPH_DEPLOY_WORK_SURFACE = 12, GLYPH_DEPLOY_MINOR_RELAXATION = 13, GLYPH_DEPLOY_SINK = 14, GLYPH_DEPLOY_MAJOR_STORAGE = 15, GLYPH_SUCCUBUS_DELIVERY = 16, GLYPH_NAVIGATION_CONTROLLER = 17, - GLYPH_BOTTOM_OF_WELL = 18 + GLYPH_GOTO_BOTTOM_OF_WELL = 18, GLYPH_GOTO_TOP_OF_WELL = 19, + GLYPH_GOTO_STATEROOM = 20, GLYPH_GOTO_BAR = 21, + GLYPH_GOTO_PROMENADE = 22, GLYPH_GOTO_ARBORETUM = 23, + GLYPH_GOTO_MUSIC_ROOM = 24, GLYPH_GOTO_RESTAURANT = 25 }; enum RemoteMessage { @@ -148,8 +151,12 @@ class CRemoteGotoGlyph : public CPetRemoteGlyph { protected: int _roomIndex; CPetGfxElement *_gfxElement; + CString _gfxName, _tooltip; public: CRemoteGotoGlyph() : CPetRemoteGlyph(), _gfxElement(nullptr), _roomIndex(21) {} + CRemoteGotoGlyph(const CString &gfxName, const CString &tooltip) : + CPetRemoteGlyph(), _gfxElement(nullptr), _roomIndex(21), + _gfxName(gfxName), _tooltip(tooltip) {} /** * Setup the glyph @@ -170,6 +177,11 @@ public: * Handles mouse button up messages */ virtual bool MouseButtonUpMsg(const Point &pt); + + /** + * Returns the tooltip text for when the glyph is selected + */ + virtual void getTooltip(CPetText *text); }; class CSummonElevatorGlyph : public CBasicRemoteGlyph { @@ -650,19 +662,52 @@ public: virtual void getTooltip(CPetText *text); }; -class CBottomOfWellGlyph : public CRemoteGotoGlyph { +class CGotoBottomOfWellGlyph : public CRemoteGotoGlyph { public: - CBottomOfWellGlyph() : CRemoteGotoGlyph() {} + CGotoBottomOfWellGlyph() : CRemoteGotoGlyph("3PetBotOfWell", + "Go to the Bottom of the Well") {} +}; - /** - * Setup the glyph - */ - virtual bool setup(CPetControl *petControl, CPetGlyphs *owner); +class CGotoTopOfWellGlyph : public CRemoteGotoGlyph { +public: + CGotoTopOfWellGlyph() : CRemoteGotoGlyph("3PetTopOfWell", + "Go to the Top of the Well") {} +}; - /** - * Returns the tooltip text for when the glyph is selected - */ - virtual void getTooltip(CPetText *text); +class CGotoStateroomGlyph : public CRemoteGotoGlyph { +public: + CGotoStateroomGlyph() : CRemoteGotoGlyph("3PetRoom", + "Go to your stateroom") {} +}; + +class CGotoBarGlyph : public CRemoteGotoGlyph { +public: + CGotoBarGlyph() : CRemoteGotoGlyph("3PetBar", + "Go to the Bar") {} +}; + +class CGotoPromenadeDeckGlyph : public CRemoteGotoGlyph { +public: + CGotoPromenadeDeckGlyph() : CRemoteGotoGlyph("3PetPromDeck", + "Go to the Promenade Deck") {} +}; + +class CGotoArboretumGlyph : public CRemoteGotoGlyph { +public: + CGotoArboretumGlyph() : CRemoteGotoGlyph("3PetArboretum", + "Go to the Arboretum") {} +}; + +class CGotoMusicRoomGlyph : public CRemoteGotoGlyph { +public: + CGotoMusicRoomGlyph() : CRemoteGotoGlyph("3PetMusicRoom", + "Go to the Music Room") {} +}; + +class CGotoRestaurantGlyph : public CRemoteGotoGlyph { +public: + CGotoRestaurantGlyph() : CRemoteGotoGlyph("3Pet1stClassRest", + "Go to the First Class Restaurant") {} }; } // End of namespace Titanic -- cgit v1.2.3 From 9ca8e2a9285708d03cd64fbfe7f28c97edb145b2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 3 May 2016 19:42:08 -0400 Subject: TITANIC: Implement CMovieClip methods --- engines/titanic/core/game_object.cpp | 7 +++++++ engines/titanic/core/game_object.h | 12 ++++++++++++ engines/titanic/core/movie_clip.cpp | 28 +++++++++++++++++++++++++++- engines/titanic/core/movie_clip.h | 16 ++++++++++++++++ 4 files changed, 62 insertions(+), 1 deletion(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 6d9f60d306..5e601f97b3 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -730,4 +730,11 @@ void CGameObject::dragMove(const Point &pt) { setPosition(Point(pt.x - _bounds.width() / 2, pt.y - _bounds.height() / 2)); } +bool CGameObject::clipExistsByStart(const CString &name, int startFrame) const { + return _clipList1.existsByStart(name, startFrame); +} + +bool CGameObject::clipExistsByEnd(const CString &name, int endFrame) const { + return _clipList1.existsByEnd(name, endFrame); +} } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 847d6cd484..5264d0c8e6 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -326,6 +326,18 @@ public: * Marks the area occupied by the object as dirty, requiring re-rendering */ void makeDirty(); + + /** + * Returns true if a clip exists in the list with a given name + * and starting frame number + */ + bool clipExistsByStart(const CString &name, int startFrame = 0) const; + + /** + * Returns true if a clip exists in the list with a given name + * and ending frame number + */ + bool clipExistsByEnd(const CString &name, int endFrame = 0) const; }; } // End of namespace Titanic diff --git a/engines/titanic/core/movie_clip.cpp b/engines/titanic/core/movie_clip.cpp index fdf329ac13..a0a6386df8 100644 --- a/engines/titanic/core/movie_clip.cpp +++ b/engines/titanic/core/movie_clip.cpp @@ -24,7 +24,13 @@ namespace Titanic { -CMovieClip::CMovieClip() { +CMovieClip::CMovieClip(): ListItem(), _startFrame(0), _endFrame(0), + _field20(0), _field24(0), _field28(0), _field2C(0), _field30(0) { +} + +CMovieClip::CMovieClip(const CString &name, int startFrame, int endFrame): + ListItem(), _name(name), _startFrame(startFrame), _endFrame(endFrame), + _field20(0), _field24(0), _field28(0), _field2C(0), _field30(0) { } void CMovieClip::save(SimpleFile *file, int indent) const { @@ -76,4 +82,24 @@ CMovieClip *CMovieClipList::findByName(const Common::String &name) const { return nullptr; } +bool CMovieClipList::existsByStart(const CString &name, int startFrame) const { + for (const_iterator i = begin(); i != end(); ++i) { + CMovieClip *clip = *i; + if (clip->_startFrame == startFrame && clip->_name == name) + return true; + } + + return false; +} + +bool CMovieClipList::existsByEnd(const CString &name, int endFrame) const { + for (const_iterator i = begin(); i != end(); ++i) { + CMovieClip *clip = *i; + if (clip->_endFrame == endFrame && clip->_name == name) + return true; + } + + return false; +} + } // End of namespace Titanic diff --git a/engines/titanic/core/movie_clip.h b/engines/titanic/core/movie_clip.h index 7eccc47bea..9ee88fd7a7 100644 --- a/engines/titanic/core/movie_clip.h +++ b/engines/titanic/core/movie_clip.h @@ -46,6 +46,7 @@ public: public: CLASSDEF CMovieClip(); + CMovieClip(const CString &name, int startFrame, int endFrame); /** * Save the data for the class to file @@ -63,7 +64,22 @@ public: */ class CMovieClipList: public List { public: + /** + * Finds and returns a movie clip in the list by name + */ CMovieClip *findByName(const Common::String &name) const; + + /** + * Returns true if a clip exists in the list with a given name + * and starting frame number + */ + bool existsByStart(const CString &name, int startFrame = 0) const; + + /** + * Returns true if a clip exists in the list with a given name + * and starting frame number + */ + bool existsByEnd(const CString &name, int endFrame = 0) const; }; } // End of namespace Titanic -- cgit v1.2.3 From 4963c9f50b53cbd663c18387d8606ad4623cca34 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 4 May 2016 07:03:13 -0400 Subject: TITANIC: Implement CMovieEvent & CMovieRangeInfo --- engines/titanic/core/game_object.cpp | 12 +++++ engines/titanic/core/game_object.h | 5 +++ engines/titanic/core/movie_clip.cpp | 31 ++++++++----- engines/titanic/core/movie_clip.h | 17 ++++--- engines/titanic/module.mk | 2 + engines/titanic/support/movie.cpp | 2 +- engines/titanic/support/movie.h | 4 +- engines/titanic/support/movie_event.cpp | 61 +++++++++++++++++++++++++ engines/titanic/support/movie_event.h | 58 ++++++++++++++++++++++++ engines/titanic/support/movie_range_info.cpp | 67 ++++++++++++++++++++++++++++ engines/titanic/support/movie_range_info.h | 64 ++++++++++++++++++++++++++ engines/titanic/support/video_surface.cpp | 6 +++ engines/titanic/support/video_surface.h | 4 ++ 13 files changed, 313 insertions(+), 20 deletions(-) create mode 100644 engines/titanic/support/movie_event.cpp create mode 100644 engines/titanic/support/movie_event.h create mode 100644 engines/titanic/support/movie_range_info.cpp create mode 100644 engines/titanic/support/movie_range_info.h diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 5e601f97b3..e6b51f7c12 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -737,4 +737,16 @@ bool CGameObject::clipExistsByStart(const CString &name, int startFrame) const { bool CGameObject::clipExistsByEnd(const CString &name, int endFrame) const { return _clipList1.existsByEnd(name, endFrame); } + +void CGameObject::checkPlayMovie(const CString &name, int flags) { + if (!_surface && !_resource.empty()) + loadResource(_resource); + + if (_surface ) { + _surface->proc35(name, flags, (flags & CLIPFLAG_4) ? this : nullptr); + if (flags & CLIPFLAG_PLAY) + getGameManager()->_gameState.addMovie(_surface->_movie); + } +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 5264d0c8e6..7c40c5f027 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -338,6 +338,11 @@ public: * and ending frame number */ bool clipExistsByEnd(const CString &name, int endFrame = 0) const; + + /** + * Checks and plays a pending clip + */ + void checkPlayMovie(const CString &name, int flags); }; } // End of namespace Titanic diff --git a/engines/titanic/core/movie_clip.cpp b/engines/titanic/core/movie_clip.cpp index a0a6386df8..9e5df67bd7 100644 --- a/engines/titanic/core/movie_clip.cpp +++ b/engines/titanic/core/movie_clip.cpp @@ -21,16 +21,15 @@ */ #include "titanic/core/movie_clip.h" +#include "titanic/core/game_object.h" namespace Titanic { -CMovieClip::CMovieClip(): ListItem(), _startFrame(0), _endFrame(0), - _field20(0), _field24(0), _field28(0), _field2C(0), _field30(0) { +CMovieClip::CMovieClip(): ListItem(), _startFrame(0), _endFrame(0) { } CMovieClip::CMovieClip(const CString &name, int startFrame, int endFrame): - ListItem(), _name(name), _startFrame(startFrame), _endFrame(endFrame), - _field20(0), _field24(0), _field28(0), _field2C(0), _field30(0) { + ListItem(), _name(name), _startFrame(startFrame), _endFrame(endFrame) { } void CMovieClip::save(SimpleFile *file, int indent) const { @@ -48,14 +47,8 @@ void CMovieClip::load(SimpleFile *file) { switch (val) { case 1: - _name = file->readString(); - _startFrame = file->readNumber(); - _endFrame = file->readNumber(); - _field20 = file->readNumber(); - _field24 = file->readNumber(); - _field28 = file->readNumber(); - _field2C = file->readNumber(); - _field30 = file->readNumber(); + // This should never be used + assert(0); break; case 2: @@ -72,6 +65,20 @@ void CMovieClip::load(SimpleFile *file) { ListItem::load(file); } +void CMovieClip::process(CGameObject *owner) { + int flags = 0; + if (_endFrame) + flags |= CLIPFLAG_HAS_END_FRAME; + if (_startFrame) + flags |= CLIPFLAG_HAS_START_FRAME; + + warning("TODO: CMovieClip::process"); + + owner->checkPlayMovie(_name, flags); + + +} + CMovieClip *CMovieClipList::findByName(const Common::String &name) const { for (const_iterator i = begin(); i != end(); ++i) { CMovieClip *clip = *i; diff --git a/engines/titanic/core/movie_clip.h b/engines/titanic/core/movie_clip.h index 9ee88fd7a7..6486259c3b 100644 --- a/engines/titanic/core/movie_clip.h +++ b/engines/titanic/core/movie_clip.h @@ -27,16 +27,21 @@ namespace Titanic { +enum ClipFlag { + CLIPFLAG_HAS_END_FRAME = 1, + CLIPFLAG_4 = 4, + CLIPFLAG_HAS_START_FRAME = 8, + CLIPFLAG_PLAY = 0x10 +}; + +class CGameObject; + /** * Movie clip */ class CMovieClip : public ListItem { private: - int _field20; - int _field24; - int _field28; - int _field2C; - int _field30; + Common::List _items; CString _string2; CString _string3; public: @@ -57,6 +62,8 @@ public: * Load the data for the class from file */ virtual void load(SimpleFile *file); + + void process(CGameObject *owner); }; /** diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index ae0c563f24..f570311add 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -436,6 +436,8 @@ MODULE_OBJS := \ support/image_decoders.o \ support/mouse_cursor.o \ support/movie.o \ + support/movie_event.o \ + support/movie_range_info.o \ support/proximity.o \ support/rect.o \ support/screen_manager.o \ diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index 3ae2636404..1c94cab250 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -91,7 +91,7 @@ void OSMovie::proc11() { warning("TODO: OSMovie::proc11"); } -void OSMovie::proc12() { +void OSMovie::proc12(const CString &name, int flags, CGameObject *obj) { warning("TODO: OSMovie::proc12"); } diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index 644f582d64..20de84afa5 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -61,7 +61,7 @@ public: virtual void proc10() = 0; virtual void proc11() = 0; - virtual void proc12() = 0; + virtual void proc12(const CString &name, int flags, CGameObject *obj) = 0; /** * Stops the movie @@ -119,7 +119,7 @@ public: virtual void proc10(); virtual void proc11(); - virtual void proc12(); + virtual void proc12(const CString &name, int flags, CGameObject *obj); /** * Stops the movie diff --git a/engines/titanic/support/movie_event.cpp b/engines/titanic/support/movie_event.cpp new file mode 100644 index 0000000000..b3e788e6fc --- /dev/null +++ b/engines/titanic/support/movie_event.cpp @@ -0,0 +1,61 @@ +/* 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 "titanic/support/movie_event.h" + +namespace Titanic { + +CMovieEvent::CMovieEvent() : ListItem(), _fieldC(0), _field10(0), + _field14(0), _field1C(0) { +} + +CMovieEvent::CMovieEvent(const CMovieEvent *src) { + _fieldC = src->_fieldC; + _field10 = src->_field10; + _field14 = src->_field14; + _field18 = src->_field18; + _field1C = src->_field1C; +} + +void CMovieEvent::save(SimpleFile *file, int indent) const { + file->writeNumberLine(0, indent); + file->writeNumberLine(_fieldC, indent + 1); + file->writeNumberLine(_field10, indent + 1); + file->writeNumberLine(_field14, indent + 1); + file->writeNumberLine(_field1C, indent + 1); + + ListItem::save(file, indent); +} + +void CMovieEvent::load(SimpleFile *file) { + int val = file->readNumber(); + if (!val) { + _fieldC = file->readNumber(); + _field10 = file->readNumber(); + _field14 = file->readNumber(); + _field1C = file->readNumber(); + } + + ListItem::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/support/movie_event.h b/engines/titanic/support/movie_event.h new file mode 100644 index 0000000000..5c62220919 --- /dev/null +++ b/engines/titanic/support/movie_event.h @@ -0,0 +1,58 @@ +/* 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. + * + */ + +#ifndef TITANIC_MOVIE_EVENT_H +#define TITANIC_MOVIE_EVENT_H + +#include "titanic/core/list.h" + +namespace Titanic { + +class CMovieEvent : public ListItem { +public: + int _fieldC; + int _field10; + int _field14; + int _field18; + int _field1C; +public: + CMovieEvent(); + CMovieEvent(const CMovieEvent *src); + virtual ~CMovieEvent() {} + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +class CMovieEventList : public List { +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MOVIE_EVENT_H */ diff --git a/engines/titanic/support/movie_range_info.cpp b/engines/titanic/support/movie_range_info.cpp new file mode 100644 index 0000000000..6242673c10 --- /dev/null +++ b/engines/titanic/support/movie_range_info.cpp @@ -0,0 +1,67 @@ +/* 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 "titanic/support/movie_range_info.h" + +namespace Titanic { + +CMovieRangeInfo::CMovieRangeInfo() : ListItem(), _fieldC(0), + _field10(0), _field14(0), _field18(0), _field1C(0) { +} + +CMovieRangeInfo::CMovieRangeInfo(const CMovieRangeInfo *src) : ListItem() { + _fieldC = src->_fieldC; + _field10 = src->_field10; + _field14 = src->_field14; + _field18 = src->_field18; + _field1C = src->_field1C; + + // Duplicate the events list + for (CMovieEventList::const_iterator i = _events.begin(); + i != _events.end(); ++i) { + _events.push_back(new CMovieEvent(*i)); + } +} + +void CMovieRangeInfo::save(SimpleFile *file, int indent) const { + file->writeNumberLine(0, indent); + file->writeNumberLine(_fieldC, indent + 1); + file->writeNumberLine(_field10, indent + 1); + file->writeNumberLine(_field14, indent + 1); + file->writeNumberLine(_field1C, indent + 1); + file->writeNumberLine(_field18, indent + 1); + _events.save(file, indent + 1); +} + +void CMovieRangeInfo::load(SimpleFile *file) { + int val = file->readNumber(); + if (!val) { + _fieldC = file->readNumber(); + _field10 = file->readNumber(); + _field14 = file->readNumber(); + _field1C = file->readNumber(); + _field18 = file->readNumber(); + _events.load(file); + } +} + +} // End of namespace Titanic diff --git a/engines/titanic/support/movie_range_info.h b/engines/titanic/support/movie_range_info.h new file mode 100644 index 0000000000..e751e303db --- /dev/null +++ b/engines/titanic/support/movie_range_info.h @@ -0,0 +1,64 @@ +/* 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. + * + */ + +#ifndef TITANIC_MOVIE_RANGE_INFO_H +#define TITANIC_MOVIE_RANGE_INFO_H + +#include "video/video_decoder.h" +#include "titanic/core/list.h" +#include "titanic/core/resource_key.h" +#include "titanic/support/movie_event.h" + +namespace Titanic { + +class CMovieRangeInfo : public ListItem { +public: + int _fieldC; + int _field10; + int _field14; + int _field18; + int _field1C; + CMovieEventList _events; +public: + CMovieRangeInfo(); + CMovieRangeInfo(const CMovieRangeInfo *src); + virtual ~CMovieRangeInfo() {} + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); + + /** + * Adds an event to the events list + */ + void add(CMovieEvent *movieEvent) { _events.push_back(movieEvent); } +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MOVIE_RANGE_INFO_H */ diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index e6b2fa7958..813138da4a 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -402,6 +402,12 @@ void OSVideoSurface::playMovie(uint startFrame, uint endFrame, int v3, bool v4) } } +void OSVideoSurface::proc35(const CString &name, int flags, CGameObject *owner) { + if (loadIfReady() && _movie) { + _movie->proc12(name, flags, owner); + } +} + void OSVideoSurface::stopMovie() { if (_movie) _movie->stop(); diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index 7521a53b4b..aee28be730 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -166,6 +166,8 @@ public: */ virtual void playMovie(uint startFrame, uint endFrame, int v3, bool v4) = 0; + virtual void proc35(const CString &name, int flags, CGameObject *owner) = 0; + /** * Stops any movie currently attached to the surface */ @@ -329,6 +331,8 @@ public: */ virtual void playMovie(uint startFrame, uint endFrame, int v3, bool v4); + virtual void proc35(const CString &name, int flags, CGameObject *owner); + /** * Stops any movie currently attached to the surface */ -- cgit v1.2.3 From b79ed60a8eca775613ec0b36d345dd8fcb4e5f08 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 4 May 2016 20:30:52 -0400 Subject: TITANIC: Added loadSound, support methods, and CSoundItem class --- engines/titanic/core/game_object.cpp | 13 +++++-- engines/titanic/core/game_object.h | 5 +++ engines/titanic/sound/sound.cpp | 59 +++++++++++++++++++++++++++++++ engines/titanic/sound/sound.h | 38 ++++++++++++++++++++ engines/titanic/sound/sound_manager.cpp | 6 ++-- engines/titanic/sound/sound_manager.h | 20 ++++++++--- engines/titanic/support/files_manager.cpp | 4 +-- engines/titanic/support/files_manager.h | 5 ++- 8 files changed, 138 insertions(+), 12 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index e6b51f7c12..d1991a4baa 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -239,7 +239,7 @@ void CGameObject::loadResource(const CString &name) { } void CGameObject::loadMovie(const CString &name, bool pendingFlag) { - g_vm->_filesManager.fn5(name); + g_vm->_filesManager.preload(name); // Create the surface if it doesn't already exist if (!_surface) { @@ -272,7 +272,7 @@ void CGameObject::loadImage(const CString &name, bool pendingFlag) { _surface = nullptr; } - g_vm->_filesManager.fn5(name); + g_vm->_filesManager.preload(name); if (!name.empty()) { _surface = new OSVideoSurface(screenManager, CResourceKey(name), pendingFlag); @@ -749,4 +749,13 @@ void CGameObject::checkPlayMovie(const CString &name, int flags) { } } +void CGameObject::loadSound(const CString &name) { + CGameManager *gameManager = getGameManager(); + if (gameManager) { + g_vm->_filesManager.preload(name); + if (!name.empty()) + gameManager->_sound.loadSound(name); + } +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 7c40c5f027..5bcba778f4 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -220,6 +220,11 @@ protected: * Support function for drag moving */ void dragMove(const Point &pt); + + /** + * Load a sound + */ + void loadSound(const CString &name); public: int _field60; CursorId _cursorId; diff --git a/engines/titanic/sound/sound.cpp b/engines/titanic/sound/sound.cpp index b3b783d4c6..68fb3aeeb6 100644 --- a/engines/titanic/sound/sound.cpp +++ b/engines/titanic/sound/sound.cpp @@ -64,4 +64,63 @@ void CSound::fn3(int val, int val2, int val3) { warning("TODO: CSound::fn3"); } +uint CSound::loadSound(const CString &name) { + checkSounds(); + + // Check whether an entry for the given name is already active + for (CSoundItemList::iterator i = _sounds.begin(); i != _sounds.end(); ++i) { + CSoundItem *soundItem = *i; + if (soundItem->_name == name) { + // Found it, so move it to the front of the list and return + _sounds.remove(soundItem); + _sounds.push_front(soundItem); + return soundItem->_soundHandle; + } + } + + // Create new sound item + CSoundItem *soundItem = new CSoundItem(name); + soundItem->_soundHandle = _soundManager.loadSound(name); + + if (!soundItem->_soundHandle) { + // Could load sound, so destroy new item and return + delete soundItem; + return 0; + } + + // Add the item to the list of sounds + _sounds.push_front(soundItem); + + // If there are more than 10 sounds loaded, remove the last one, + // which is the least recently used of all of them + if (_sounds.size() > 10) + removeOldest(); + + return soundItem->_soundHandle; +} + +void CSound::checkSounds() { + for (CSoundItemList::iterator i = _sounds.begin(); i != _sounds.end(); ++i) { + CSoundItem *soundItem = *i; + if (soundItem->_field24 && soundItem->_field28) { + if (_soundManager.isActive(soundItem->_soundHandle)) { + _sounds.remove(soundItem); + delete soundItem; + } + } + } +} + +void CSound::removeOldest() { + for (CSoundItemList::iterator i = _sounds.reverse_begin(); + i != _sounds.end(); --i) { + CSoundItem *soundItem = *i; + if (soundItem->_field28 && !_soundManager.isActive(soundItem->_soundHandle)) { + _sounds.remove(soundItem); + delete soundItem; + break; + } + } +} + } // End of namespace Titanic z diff --git a/engines/titanic/sound/sound.h b/engines/titanic/sound/sound.h index 488d4deb5e..19a8edfc21 100644 --- a/engines/titanic/sound/sound.h +++ b/engines/titanic/sound/sound.h @@ -25,15 +25,46 @@ #include "titanic/support/simple_file.h" #include "titanic/sound/sound_manager.h" +#include "titanic/core/list.h" #include "titanic/core/view_item.h" namespace Titanic { class CGameManager; +class CSoundItem : public ListItem { +public: + CString _name; + uint _soundHandle; + int _field1C; + int _field20; + int _field24; + int _field28; +public: + CSoundItem() : ListItem(), _soundHandle(0), _field1C(0), + _field20(0), _field24(0), _field28(0) {} + CSoundItem(const CString &name) : ListItem(), _name(name), + _soundHandle(0), _field1C(0), _field20(0), _field24(0), _field28(0) {} +}; + +class CSoundItemList : public List { +}; + class CSound { private: CGameManager *_gameManager; + CSoundItemList _sounds; +private: + /** + * Check whether any sounds are done and can be be removed + */ + void checkSounds(); + + /** + * Removes the oldest sound from the sounds list that isn't + * currently playing + */ + void removeOldest(); public: QSoundManager _soundManager; public: @@ -74,6 +105,13 @@ public: */ void preEnterView(CViewItem *newView, bool isNewRoom); + /** + * Load a sound + * @param name Name of sound resource + * @returns Sound handle Id + */ + uint loadSound(const CString &name); + bool fn1(int val); void fn2(int val); void fn3(int val, int val2, int val3); diff --git a/engines/titanic/sound/sound_manager.cpp b/engines/titanic/sound/sound_manager.cpp index 53e5a3dfe0..5c26527e09 100644 --- a/engines/titanic/sound/sound_manager.cpp +++ b/engines/titanic/sound/sound_manager.cpp @@ -34,7 +34,7 @@ QSoundManager::QSoundManager() : _field18(0), _field1C(0) { Common::fill(&_field4A0[0], &_field4A0[16], 0); } -int QSoundManager::proc3() { +uint QSoundManager::loadSound(const CString &name) { warning("TODO"); return 0; } @@ -86,9 +86,9 @@ bool QSoundManager::proc14() { return false; } -int QSoundManager::proc15() { +bool QSoundManager::isActive(uint handle) const { warning("TODO"); - return 0; + return false; } int QSoundManager::proc16() { diff --git a/engines/titanic/sound/sound_manager.h b/engines/titanic/sound/sound_manager.h index 68843dd1f2..84d9aeb5bd 100644 --- a/engines/titanic/sound/sound_manager.h +++ b/engines/titanic/sound/sound_manager.h @@ -37,7 +37,13 @@ protected: public: SoundManager(); - virtual int proc3() const { return 0; } + /** + * Loads a sound + * @param name Name of sound resource + * @returns Loaded sound handle + */ + virtual uint loadSound(const CString &name) { return 0; } + virtual int proc4() const { return 0; } virtual int proc5() const { return 0; } virtual void proc6() = 0; @@ -49,7 +55,7 @@ public: virtual void proc12() {} virtual void proc13() {} virtual bool proc14() = 0; - virtual int proc15() const { return 0; } + virtual bool isActive(uint handle) const { return false; } virtual int proc16() const { return 0; } virtual void WaveMixPump() {} virtual int proc18() const { return 0; } @@ -100,7 +106,13 @@ public: public: QSoundManager(); - virtual int proc3(); + /** + * Loads a sound + * @param name Name of sound resource + * @returns Loaded sound handle + */ + virtual uint loadSound(const CString &name); + virtual int proc4(); virtual int proc5(); virtual void proc6(); @@ -112,7 +124,7 @@ public: virtual void proc12(); virtual void proc13(); virtual bool proc14(); - virtual int proc15(); + virtual bool isActive(uint handle) const; virtual int proc16(); virtual void WaveMixPump(); virtual int proc18() const; diff --git a/engines/titanic/support/files_manager.cpp b/engines/titanic/support/files_manager.cpp index 6cd6bfb5f2..8e70387a5f 100644 --- a/engines/titanic/support/files_manager.cpp +++ b/engines/titanic/support/files_manager.cpp @@ -89,8 +89,8 @@ void CFilesManager::fn4(const CString &name) { warning("TODO: CFilesManager::fn4"); } -void CFilesManager::fn5(const CString &name) { - warning("TODO: CFilesManager::fn5"); +void CFilesManager::preload(const CString &name) { + // We don't currently do any preloading of resources } Common::SeekableReadStream *CFilesManager::getResource( diff --git a/engines/titanic/support/files_manager.h b/engines/titanic/support/files_manager.h index ae664698ac..185670c764 100644 --- a/engines/titanic/support/files_manager.h +++ b/engines/titanic/support/files_manager.h @@ -82,7 +82,10 @@ public: void fn4(const CString &name); - void fn5(const CString &name); + /** + * Preloads and caches a file for access shortly + */ + void preload(const CString &name); /** * Get a resource from the executable -- cgit v1.2.3 From 6948a44ac41f3da70b0cd675e7e9eb96117c54fa Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 4 May 2016 22:02:03 -0400 Subject: TITANIC: Implemented stopSound --- engines/titanic/core/game_object.cpp | 48 ++++++++++++++--------------- engines/titanic/core/game_object.h | 20 +++++++----- engines/titanic/game/television.cpp | 24 +++++++-------- engines/titanic/game/television.h | 2 +- engines/titanic/module.mk | 1 + engines/titanic/sound/sound.cpp | 4 +-- engines/titanic/sound/sound.h | 6 ++-- engines/titanic/sound/sound_manager.cpp | 4 +-- engines/titanic/sound/sound_manager.h | 8 ++--- engines/titanic/sound/wave_file.cpp | 27 +++++++++++++++++ engines/titanic/sound/wave_file.h | 54 +++++++++++++++++++++++++++++++++ 11 files changed, 142 insertions(+), 56 deletions(-) create mode 100644 engines/titanic/sound/wave_file.cpp create mode 100644 engines/titanic/sound/wave_file.h diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index d1991a4baa..1d5c974db5 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -325,18 +325,6 @@ bool CGameObject::soundFn1(int val) { return false; } -void CGameObject::soundFn2(int val, int val2) { - if (val != 0 && val != -1) { - CGameManager *gameManager = getGameManager(); - if (gameManager) { - if (val2) - gameManager->_sound.fn3(val, 0, val2); - else - gameManager->_sound.fn2(val); - } - } -} - void CGameObject::setVisible(bool val) { if (val != _visible) { _visible = val; @@ -456,7 +444,16 @@ void CGameObject::sound8(bool flag) const { getGameManager()->_sound.managerProc8(flag ? 3 : 0); } -bool CGameObject::playSound(const CString &name, int val2, int val3, int val4) { +void CGameObject::loadSound(const CString &name) { + CGameManager *gameManager = getGameManager(); + if (gameManager) { + g_vm->_filesManager.preload(name); + if (!name.empty()) + gameManager->_sound.loadSound(name); + } +} + +int CGameObject::playSound(const CString &name, int val2, int val3, int val4) { CProximity prox; prox._field8 = val2; prox._fieldC = val3; @@ -464,12 +461,24 @@ bool CGameObject::playSound(const CString &name, int val2, int val3, int val4) { return playSound(name, prox); } -bool CGameObject::playSound(const CString &name, CProximity &prox) { +int CGameObject::playSound(const CString &name, CProximity &prox) { if (prox._field28 == 2) { // TODO } - return false; + return 0; +} + +void CGameObject::stopSound(int handle, int val2) { + if (handle != 0 && handle != -1) { + CGameManager *gameManager = getGameManager(); + if (gameManager) { + if (val2) + gameManager->_sound.fn3(handle, 0, val2); + else + gameManager->_sound.fn2(handle); + } + } } int CGameObject::addTimer(int endVal, uint firstDuration, uint duration) { @@ -749,13 +758,4 @@ void CGameObject::checkPlayMovie(const CString &name, int flags) { } } -void CGameObject::loadSound(const CString &name) { - CGameManager *gameManager = getGameManager(); - if (gameManager) { - g_vm->_filesManager.preload(name); - if (!name.empty()) - gameManager->_sound.loadSound(name); - } -} - } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 5bcba778f4..01fe503005 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -123,20 +123,29 @@ protected: CViewItem * parseView(const CString &viewString); bool soundFn1(int val); - void soundFn2(int val, int val2); void petFn2(int val); void petFn3(CTreeItem *item); void incState38(); + /** + * Load a sound + */ + void loadSound(const CString &name); + /** * Plays a sound */ - bool playSound(const CString &name, int val2, int val3, int val4); + int playSound(const CString &name, int val2, int val3, int val4); /** * Plays a sound */ - bool playSound(const CString &name, CProximity &prox); + int playSound(const CString &name, CProximity &prox); + + /** + * Stop a sound + */ + void stopSound(int handle, int val2); /** * Adds a timer @@ -220,11 +229,6 @@ protected: * Support function for drag moving */ void dragMove(const Point &pt); - - /** - * Load a sound - */ - void loadSound(const CString &name); public: int _field60; CursorId _cursorId; diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp index 888400960d..280f7f25d6 100644 --- a/engines/titanic/game/television.cpp +++ b/engines/titanic/game/television.cpp @@ -51,7 +51,7 @@ int CTelevision::_v5; int CTelevision::_v6; CTelevision::CTelevision() : CBackground(), _fieldE0(1), - _fieldE4(7), _isOn(false), _fieldEC(0), _fieldF0(0) { + _fieldE4(7), _isOn(false), _fieldEC(0), _soundHandle(0) { } void CTelevision::init() { @@ -76,7 +76,7 @@ void CTelevision::save(SimpleFile *file, int indent) const { file->writeNumberLine(_v3, indent); file->writeNumberLine(_fieldEC, indent); file->writeNumberLine(_v4, indent); - file->writeNumberLine(_fieldF0, indent); + file->writeNumberLine(_soundHandle, indent); file->writeNumberLine(_v5, indent); file->writeNumberLine(_v6, indent); @@ -93,7 +93,7 @@ void CTelevision::load(SimpleFile *file) { _v3 = file->readNumber(); _fieldEC = file->readNumber(); _v4 = file->readNumber(); - _fieldF0 = file->readNumber(); + _soundHandle = file->readNumber(); _v5 = file->readNumber(); _v6 = file->readNumber(); @@ -103,8 +103,8 @@ void CTelevision::load(SimpleFile *file) { bool CTelevision::LeaveViewMsg(CLeaveViewMsg *msg) { clearPet(); if (_isOn) { - if (soundFn1(_fieldF0)) - soundFn2(_fieldF0, 0); + if (soundFn1(_soundHandle)) + stopSound(_soundHandle, 0); loadFrame(622); stopMovie(); @@ -153,8 +153,8 @@ static const int END_FRAMES[8] = { 0, 55, 111, 167, 223, 279, 335, 391 }; bool CTelevision::PETUpMsg(CPETUpMsg *msg) { if (msg->_name == "Television" && _isOn) { - if (soundFn1(_fieldF0)) - soundFn2(_fieldF0, 0); + if (soundFn1(_soundHandle)) + stopSound(_soundHandle, 0); _fieldE0 = _fieldE0 % _fieldE4 + 1; stopMovie(); @@ -166,8 +166,8 @@ bool CTelevision::PETUpMsg(CPETUpMsg *msg) { bool CTelevision::PETDownMsg(CPETDownMsg *msg) { if (msg->_name == "Television" && _isOn) { - if (soundFn1(_fieldF0)) - soundFn2(_fieldF0, 0); + if (soundFn1(_soundHandle)) + stopSound(_soundHandle, 0); if (--_fieldE0 < 1) _fieldE0 += _fieldE4; @@ -215,8 +215,8 @@ bool CTelevision::PETActivateMsg(CPETActivateMsg *msg) { _fieldE0 = 1; } else { stopMovie(); - if (soundFn1(_fieldF0)) - soundFn2(_fieldF0, 0); + if (soundFn1(_soundHandle)) + stopSound(_soundHandle, 0); setVisible(false); } @@ -236,7 +236,7 @@ bool CTelevision::MovieEndMsg(CMovieEndMsg *msg) { if (_fieldE0 == 3 && compareRoomNameTo("SGTState") && !getPassengerClass()) { playSound("z#47.wav", 100, 0, 0); - _fieldF0 = playSound("b#20.wav", 100, 0, 0); + _soundHandle = playSound("b#20.wav", 100, 0, 0); CTreeItem *magazine = getRoot()->findByName("Magazine"); if (magazine) { diff --git a/engines/titanic/game/television.h b/engines/titanic/game/television.h index 4c16a320ab..64202c7917 100644 --- a/engines/titanic/game/television.h +++ b/engines/titanic/game/television.h @@ -56,7 +56,7 @@ private: int _fieldE4; bool _isOn; int _fieldEC; - int _fieldF0; + int _soundHandle; public: CLASSDEF CTelevision(); diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index f570311add..778226dfa2 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -412,6 +412,7 @@ MODULE_OBJS := \ sound/view_auto_sound_player.o \ sound/view_toggles_other_music.o \ sound/water_lapping_sounds.o \ + sound/wave_file.o \ star_control/star_control.o \ star_control/star_control_sub1.o \ star_control/star_control_sub2.o \ diff --git a/engines/titanic/sound/sound.cpp b/engines/titanic/sound/sound.cpp index 68fb3aeeb6..3e4f154c35 100644 --- a/engines/titanic/sound/sound.cpp +++ b/engines/titanic/sound/sound.cpp @@ -56,11 +56,11 @@ bool CSound::fn1(int val) { return false; } -void CSound::fn2(int val) { +void CSound::fn2(int handle) { warning("TODO: CSound::fn3"); } -void CSound::fn3(int val, int val2, int val3) { +void CSound::fn3(int handle, int val2, int val3) { warning("TODO: CSound::fn3"); } diff --git a/engines/titanic/sound/sound.h b/engines/titanic/sound/sound.h index 19a8edfc21..dfbee0a9dd 100644 --- a/engines/titanic/sound/sound.h +++ b/engines/titanic/sound/sound.h @@ -35,7 +35,7 @@ class CGameManager; class CSoundItem : public ListItem { public: CString _name; - uint _soundHandle; + int _soundHandle; int _field1C; int _field20; int _field24; @@ -113,8 +113,8 @@ public: uint loadSound(const CString &name); bool fn1(int val); - void fn2(int val); - void fn3(int val, int val2, int val3); + void fn2(int handle); + void fn3(int handle, int val2, int val3); void managerProc8(int v) { _soundManager.proc8(v); } }; diff --git a/engines/titanic/sound/sound_manager.cpp b/engines/titanic/sound/sound_manager.cpp index 5c26527e09..fa1e5fb166 100644 --- a/engines/titanic/sound/sound_manager.cpp +++ b/engines/titanic/sound/sound_manager.cpp @@ -34,7 +34,7 @@ QSoundManager::QSoundManager() : _field18(0), _field1C(0) { Common::fill(&_field4A0[0], &_field4A0[16], 0); } -uint QSoundManager::loadSound(const CString &name) { +int QSoundManager::loadSound(const CString &name) { warning("TODO"); return 0; } @@ -86,7 +86,7 @@ bool QSoundManager::proc14() { return false; } -bool QSoundManager::isActive(uint handle) const { +bool QSoundManager::isActive(int handle) const { warning("TODO"); return false; } diff --git a/engines/titanic/sound/sound_manager.h b/engines/titanic/sound/sound_manager.h index 84d9aeb5bd..e9fd1faf0a 100644 --- a/engines/titanic/sound/sound_manager.h +++ b/engines/titanic/sound/sound_manager.h @@ -42,7 +42,7 @@ public: * @param name Name of sound resource * @returns Loaded sound handle */ - virtual uint loadSound(const CString &name) { return 0; } + virtual int loadSound(const CString &name) { return 0; } virtual int proc4() const { return 0; } virtual int proc5() const { return 0; } @@ -55,7 +55,7 @@ public: virtual void proc12() {} virtual void proc13() {} virtual bool proc14() = 0; - virtual bool isActive(uint handle) const { return false; } + virtual bool isActive(int handle) const { return false; } virtual int proc16() const { return 0; } virtual void WaveMixPump() {} virtual int proc18() const { return 0; } @@ -111,7 +111,7 @@ public: * @param name Name of sound resource * @returns Loaded sound handle */ - virtual uint loadSound(const CString &name); + virtual int loadSound(const CString &name); virtual int proc4(); virtual int proc5(); @@ -124,7 +124,7 @@ public: virtual void proc12(); virtual void proc13(); virtual bool proc14(); - virtual bool isActive(uint handle) const; + virtual bool isActive(int handle) const; virtual int proc16(); virtual void WaveMixPump(); virtual int proc18() const; diff --git a/engines/titanic/sound/wave_file.cpp b/engines/titanic/sound/wave_file.cpp new file mode 100644 index 0000000000..288f5f525d --- /dev/null +++ b/engines/titanic/sound/wave_file.cpp @@ -0,0 +1,27 @@ +/* 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 "titanic/sound/wave_file.h" + +namespace Titanic { + +} // End of namespace Titanic z diff --git a/engines/titanic/sound/wave_file.h b/engines/titanic/sound/wave_file.h new file mode 100644 index 0000000000..0bb836ef74 --- /dev/null +++ b/engines/titanic/sound/wave_file.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_WAVE_FILE_H +#define TITANIC_WAVE_FILE_H + +#include "titanic/support/simple_file.h" + +namespace Titanic { + +class CSoundManager; + +class WaveFile { +public: + int _field0; + int _field4; + int _field8; + uint _handle; + CSoundManager *_owner; + int _field14; + int _field18; + int _field1C; + int _field20; + int _field24; + int _field28; + int _field2C; +public: + WaveFile() : _field0(2), _field4(0), _field8(0), _handle(0), + _owner(nullptr), _field14(1), _field18(0), _field1C(0), + _field20(0), _field24(0), _field28(0), _field2C(-1) {} +}; + +} // End of namespace Titanic + +#endif /* TITANIC_WAVE_FILE_H */ -- cgit v1.2.3 From f5a82bae97badd29822627029c82a09e8dfb9ed6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 4 May 2016 22:29:47 -0400 Subject: TITANIC: Implemented sound & true talk call methods in CGameObject --- engines/titanic/core/game_object.cpp | 18 +++++++++++++++--- engines/titanic/core/game_object.h | 7 ++++++- engines/titanic/true_talk/true_talk_manager.cpp | 3 ++- engines/titanic/true_talk/true_talk_manager.h | 2 +- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 1d5c974db5..3406de6902 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -315,16 +315,24 @@ void CGameObject::makeDirty() { makeDirty(_bounds); } -bool CGameObject::soundFn1(int val) { - if (val != 0 && val != -1) { +bool CGameObject::soundFn1(int handle) { + if (handle != 0 && handle != -1) { CGameManager *gameManager = getGameManager(); if (gameManager) - return gameManager->_sound.fn1(val); + return gameManager->_sound.fn1(handle); } return false; } +void CGameObject::soundFn3(int handle, int val2, int val3) { + if (handle != 0 && handle != -1) { + CGameManager *gameManager = getGameManager(); + if (gameManager) + return gameManager->_sound.fn3(handle, val2, val3); + } +} + void CGameObject::setVisible(bool val) { if (val != _visible) { _visible = val; @@ -690,6 +698,10 @@ void CGameObject::incState38() { getGameManager()->_gameState.inc38(); } +void CGameObject::trueTalkFn1(const CString &name, int val2, int val3) { + trueTalkFn1(getRoot()->findByName(name), val2, val3); +} + void CGameObject::trueTalkFn1(CTreeItem *item, int val2, int val3) { CGameManager *gameManager = getGameManager(); if (gameManager) { diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 01fe503005..8a56945d13 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -122,7 +122,6 @@ protected: */ CViewItem * parseView(const CString &viewString); - bool soundFn1(int val); void petFn2(int val); void petFn3(CTreeItem *item); void incState38(); @@ -147,6 +146,10 @@ protected: */ void stopSound(int handle, int val2); + bool soundFn1(int handle); + + void soundFn3(int handle, int val2, int val3); + /** * Adds a timer */ @@ -213,6 +216,8 @@ protected: */ void moveToView(); + void trueTalkFn1(const CString &name, int val2, int val3); + void trueTalkFn1(CTreeItem *item, int val2, int val3); /** diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index b97b51931c..827cda99ec 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -22,6 +22,7 @@ #include "titanic/true_talk/true_talk_manager.h" #include "titanic/core/tree_item.h" +#include "titanic/game_manager.h" #define MKTAG_BE(a3,a2,a1,a0) ((uint32)((a3) | ((a2) << 8) | ((a1) << 16) | ((a0) << 24))) @@ -191,7 +192,7 @@ void CTrueTalkManager::update2() { //warning("CTrueTalkManager::update2"); } -void CTrueTalkManager::fn1(CTreeItem *item, int val2, int val3) { +void CTrueTalkManager::fn1(CTreeItem *npc, int val2, int val3) { warning("CTrueTalkManager::fn1"); } diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index 9da1c06242..8d2ea65667 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -112,7 +112,7 @@ public: void update2(); - void fn1(CTreeItem *item, int val2, int val3); + void fn1(CTreeItem *npc, int val2, int val3); /** * Return a TrueTalk talker/script -- cgit v1.2.3 From 07cbf78fe119058b196127827638ab0d8bc71b7e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 4 May 2016 22:47:57 -0400 Subject: TITANIC: Implemented CTrueTalkManager getNpcScript --- engines/titanic/carry/carry_parrot.cpp | 12 ++++++------ engines/titanic/core/game_object.cpp | 7 ++++--- engines/titanic/core/game_object.h | 2 +- engines/titanic/true_talk/true_talk_manager.cpp | 14 +++++++++++++- engines/titanic/true_talk/true_talk_manager.h | 14 +++++++++++++- 5 files changed, 37 insertions(+), 12 deletions(-) diff --git a/engines/titanic/carry/carry_parrot.cpp b/engines/titanic/carry/carry_parrot.cpp index 598393bb08..6bf536ea7a 100644 --- a/engines/titanic/carry/carry_parrot.cpp +++ b/engines/titanic/carry/carry_parrot.cpp @@ -167,9 +167,9 @@ bool CCarryParrot::PassOnDragStartMsg(CPassOnDragStartMsg *msg) { return CCarry::PassOnDragStartMsg(msg); } - CTreeItem *treeItem = getRoot()->findByName(_string6); - if (treeItem) - trueTalkFn1(treeItem, 0x446BF, 0); + CGameObject *npc = static_cast(getRoot()->findByName(_string6)); + if (npc) + trueTalkFn1(npc, 0x446BF, 0); _fieldE0 = 0; playSound("z#475.wav", 100, 0, 0); @@ -198,9 +198,9 @@ bool CCarryParrot::UseWithCharMsg(CUseWithCharMsg *msg) { bool CCarryParrot::ActMsg(CActMsg *msg) { if (msg->_action == "FreeParrot" && (CParrot::_v4 == 4 || CParrot::_v4 == 1)) { - CTreeItem *treeItem = getRoot()->findByName(_string6); - if (treeItem) - trueTalkFn1(treeItem, 0x446BF, 0); + CGameObject *npc = static_cast(getRoot()->findByName(_string6)); + if (npc) + trueTalkFn1(npc, 0x446BF, 0); setVisible(false); _fieldE0 = 0; diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 3406de6902..1b76ec1960 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -699,15 +699,16 @@ void CGameObject::incState38() { } void CGameObject::trueTalkFn1(const CString &name, int val2, int val3) { - trueTalkFn1(getRoot()->findByName(name), val2, val3); + CGameObject *npc = static_cast(getRoot()->findByName(name)); + trueTalkFn1(npc, val2, val3); } -void CGameObject::trueTalkFn1(CTreeItem *item, int val2, int val3) { +void CGameObject::trueTalkFn1(CGameObject *npc, int val2, int val3) { CGameManager *gameManager = getGameManager(); if (gameManager) { CTrueTalkManager *talkManager = gameManager->getTalkManager(); if (talkManager) - talkManager->fn1(item, val2, val3); + talkManager->fn1(npc, val2, val3); } } diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 8a56945d13..40492676b0 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -218,7 +218,7 @@ protected: void trueTalkFn1(const CString &name, int val2, int val3); - void trueTalkFn1(CTreeItem *item, int val2, int val3); + void trueTalkFn1(CGameObject *npc, int val2, int val3); /** * Load the surface diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 827cda99ec..a07f7fa242 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -192,7 +192,7 @@ void CTrueTalkManager::update2() { //warning("CTrueTalkManager::update2"); } -void CTrueTalkManager::fn1(CTreeItem *npc, int val2, int val3) { +void CTrueTalkManager::fn1(CGameObject *npc, int val2, int val3) { warning("CTrueTalkManager::fn1"); } @@ -219,4 +219,16 @@ TTNamedScript *CTrueTalkManager::getTalker(const CString &name) { return nullptr; } +TTNamedScript *CTrueTalkManager::getNpcScript(CGameObject *npc) { + CString npcName = npc->getName(); + TTNamedScript *script = getTalker(npcName); + + if (!script) { + // Fall back on the default NPC script + script = _scripts.getNamedScript(101); + } + + return script; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index 8d2ea65667..5d5f67958d 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -31,6 +31,7 @@ namespace Titanic { class CGameManager; class CTreeItem; +class CGameObject; class CTrueTalkManager { private: @@ -48,9 +49,20 @@ private: */ static void saveStatics(SimpleFile *file); + /** + * Loads an NPC from file + */ void loadNPC(SimpleFile *file, int charId); + /** + * Saves the specified NPC to file + */ void saveNPC(SimpleFile *file, int charId) const; + + /** + * Gets the script associated with an NPC game object + */ + TTNamedScript *getNpcScript(CGameObject *npc); public: static int _v1; static int _v2; @@ -112,7 +124,7 @@ public: void update2(); - void fn1(CTreeItem *npc, int val2, int val3); + void fn1(CGameObject *npc, int val2, int val3); /** * Return a TrueTalk talker/script -- cgit v1.2.3 From 308926ba87c76dc3151c4ae3428a71656cdbdad2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 4 May 2016 23:17:08 -0400 Subject: TITANIC: Implementing getting TrueTalk room scripts --- engines/titanic/core/room_item.cpp | 55 +++++++++++++++++++++++++ engines/titanic/core/room_item.h | 5 +++ engines/titanic/true_talk/true_talk_manager.cpp | 21 +++++++++- engines/titanic/true_talk/true_talk_manager.h | 9 +++- 4 files changed, 86 insertions(+), 4 deletions(-) diff --git a/engines/titanic/core/room_item.cpp b/engines/titanic/core/room_item.cpp index 7a6dfd968a..6dab983087 100644 --- a/engines/titanic/core/room_item.cpp +++ b/engines/titanic/core/room_item.cpp @@ -115,4 +115,59 @@ void CRoomItem::calcNodePosition(const Point &nodePos, double &xVal, double &yVa } } +int CRoomItem::getScriptId() const { + CString name = getName(); + if (name == "1stClassLobby") + return 130; + else if (name == "1stClassRestaurant") + return 132; + else if (name == "1stClassState") + return 131; + else if (name == "2ndClassLobby") + return 128; + else if (name == "Bar") + return 112; + else if (name == "BottomOfWell") + return 108; + else if (name == "Bridge") + return 121; + else if (name == "Dome") + return 122; + else if (name == "Home") + return 100; + else if (name == "Lift") + return 103; + else if (name == "MusicRoom") + return 117; + else if (name == "MusicRoomLobby") + return 118; + else if (name == "ParrotLobby") + return 111; + else if (name == "Pellerator") + return 104; + else if (name == "PromenadeDeck") + return 114; + else if (name == "SculptureChamber") + return 116; + else if (name == "secClassState") + return 129; + else if (name == "ServiceElevator") + return 102; + else if (name == "SGTLeisure") + return 125; + else if (name == "SGTLittleLift") + return 105; + else if (name == "SgtLobby") + return 124; + else if (name == "SGTState") + return 126; + else if (name == "Titania") + return 123; + else if (name == "TopOfWell") + return 107; + + // TODO + return 0; +} + } // End of namespace Titanic diff --git a/engines/titanic/core/room_item.h b/engines/titanic/core/room_item.h index f14c3ae32b..519accd79c 100644 --- a/engines/titanic/core/room_item.h +++ b/engines/titanic/core/room_item.h @@ -64,6 +64,11 @@ public: * Calculates the positioning of a node within the overall room */ void calcNodePosition(const Point &nodePos, double &xVal, double &yVal) const; + + /** + * Get the TrueTalk script Id associated with the room + */ + int getScriptId() const; }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index a07f7fa242..805ebd368d 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -196,7 +196,7 @@ void CTrueTalkManager::fn1(CGameObject *npc, int val2, int val3) { warning("CTrueTalkManager::fn1"); } -TTNamedScript *CTrueTalkManager::getTalker(const CString &name) { +TTNamedScript *CTrueTalkManager::getTalker(const CString &name) const { if (name.contains("Doorbot")) return _scripts.getNamedScript(104); else if (name.contains("DeskBot")) @@ -219,7 +219,7 @@ TTNamedScript *CTrueTalkManager::getTalker(const CString &name) { return nullptr; } -TTNamedScript *CTrueTalkManager::getNpcScript(CGameObject *npc) { +TTNamedScript *CTrueTalkManager::getNpcScript(CGameObject *npc) const { CString npcName = npc->getName(); TTNamedScript *script = getTalker(npcName); @@ -231,4 +231,21 @@ TTNamedScript *CTrueTalkManager::getNpcScript(CGameObject *npc) { return script; } +TTUnnamedScript *CTrueTalkManager::getRoomScript() const { + CRoomItem *room = _gameManager->getRoom(); + TTUnnamedScript *script = nullptr; + if (room) { + int scriptId = room->getScriptId(); + if (scriptId) + script = _scripts.getUnnamedScript(scriptId); + } + + if (!script) { + // Fall back on the default Room script + script = _scripts.getUnnamedScript(110); + } + + return script; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index 5d5f67958d..ae740cb9f1 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -62,7 +62,12 @@ private: /** * Gets the script associated with an NPC game object */ - TTNamedScript *getNpcScript(CGameObject *npc); + TTNamedScript *getNpcScript(CGameObject *npc) const; + + /** + * Gets the script associated with the current room + */ + TTUnnamedScript *getRoomScript() const; public: static int _v1; static int _v2; @@ -129,7 +134,7 @@ public: /** * Return a TrueTalk talker/script */ - TTNamedScript *getTalker(const CString &name); + TTNamedScript *getTalker(const CString &name) const; }; } // End of namespace Titanic -- cgit v1.2.3 From f75b46792579291e79c17a5e52c863d12eced949 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 5 May 2016 07:32:30 -0400 Subject: TITANIC: Finished CRoomItem getScriptId --- engines/titanic/core/room_item.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/engines/titanic/core/room_item.cpp b/engines/titanic/core/room_item.cpp index 6dab983087..c5815795ae 100644 --- a/engines/titanic/core/room_item.cpp +++ b/engines/titanic/core/room_item.cpp @@ -165,8 +165,15 @@ int CRoomItem::getScriptId() const { return 123; else if (name == "TopOfWell") return 107; + else if (name == "EmbLobby" || name == "MoonEmbLobby") + return 110; + else if (name == "CreatorsChamber" || name == "CreatorsChamberOn") + return 113; + else if (name == "Arboretum" || name == "FrozenArboretum") + return 115; + else if (name == "BilgeRoom" || name == "BilgeRoomWith") + return 101; - // TODO return 0; } -- cgit v1.2.3 From d712875c02c6e82734f6ba9ea56f8206c51a22fe Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 5 May 2016 07:49:46 -0400 Subject: TITANIC: Renamed TT unnamed script classes to room scripts --- engines/titanic/core/room_item.cpp | 2 +- engines/titanic/module.mk | 2 +- engines/titanic/true_talk/true_talk_manager.cpp | 8 ++-- engines/titanic/true_talk/true_talk_manager.h | 2 +- engines/titanic/true_talk/tt_room_script.cpp | 64 +++++++++++++++++++++++++ engines/titanic/true_talk/tt_room_script.h | 62 ++++++++++++++++++++++++ engines/titanic/true_talk/tt_scripts.cpp | 28 +++++------ engines/titanic/true_talk/tt_scripts.h | 24 +++++----- engines/titanic/true_talk/tt_unnamed_script.cpp | 64 ------------------------- engines/titanic/true_talk/tt_unnamed_script.h | 62 ------------------------ 10 files changed, 159 insertions(+), 159 deletions(-) create mode 100644 engines/titanic/true_talk/tt_room_script.cpp create mode 100644 engines/titanic/true_talk/tt_room_script.h delete mode 100644 engines/titanic/true_talk/tt_unnamed_script.cpp delete mode 100644 engines/titanic/true_talk/tt_unnamed_script.h diff --git a/engines/titanic/core/room_item.cpp b/engines/titanic/core/room_item.cpp index c5815795ae..b1c9aeeb10 100644 --- a/engines/titanic/core/room_item.cpp +++ b/engines/titanic/core/room_item.cpp @@ -100,7 +100,7 @@ void CRoomItem::load(SimpleFile *file) { } void CRoomItem::loading() { - // TODO + warning("TODO: CRoomItem::loading"); } void CRoomItem::calcNodePosition(const Point &nodePos, double &xVal, double &yVal) const { diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 778226dfa2..a1529317fd 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -458,7 +458,7 @@ MODULE_OBJS := \ true_talk/title_engine.o \ true_talk/true_talk_manager.o \ true_talk/tt_script_base.o \ - true_talk/tt_unnamed_script.o \ + true_talk/tt_room_script.o \ true_talk/tt_named_script.o \ true_talk/tt_scripts.o \ true_talk/tt_string.o diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 805ebd368d..c9343d1f39 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -231,18 +231,18 @@ TTNamedScript *CTrueTalkManager::getNpcScript(CGameObject *npc) const { return script; } -TTUnnamedScript *CTrueTalkManager::getRoomScript() const { +TTRoomScript *CTrueTalkManager::getRoomScript() const { CRoomItem *room = _gameManager->getRoom(); - TTUnnamedScript *script = nullptr; + TTRoomScript *script = nullptr; if (room) { int scriptId = room->getScriptId(); if (scriptId) - script = _scripts.getUnnamedScript(scriptId); + script = _scripts.getRoomScript(scriptId); } if (!script) { // Fall back on the default Room script - script = _scripts.getUnnamedScript(110); + script = _scripts.getRoomScript(110); } return script; diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index ae740cb9f1..991bf1608f 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -67,7 +67,7 @@ private: /** * Gets the script associated with the current room */ - TTUnnamedScript *getRoomScript() const; + TTRoomScript *getRoomScript() const; public: static int _v1; static int _v2; diff --git a/engines/titanic/true_talk/tt_room_script.cpp b/engines/titanic/true_talk/tt_room_script.cpp new file mode 100644 index 0000000000..1c37a39bf0 --- /dev/null +++ b/engines/titanic/true_talk/tt_room_script.cpp @@ -0,0 +1,64 @@ +/* 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/textconsole.h" +#include "titanic/true_talk/tt_room_script.h" + +namespace Titanic { + +TTRoomScriptBase::TTRoomScriptBase(int scriptId, + const char *charClass, const char *charName, + int v3, int v4, int v5, int v6, int v2, int v7) : _scriptId(scriptId), + TTScriptBase(3, charClass, v2, charName, v3, v4, v5, v6, v7) { +} + +/*------------------------------------------------------------------------*/ + +TTRoomScript::TTRoomScript(int scriptId) : + TTRoomScriptBase(scriptId, "", "", 0, -1, -1, -1, 0, 0) { +} + +void TTRoomScript::proc6() { + warning("TODO"); +} + +void TTRoomScript::proc7() { + warning("TODO"); +} + +void TTRoomScript::proc8() { + warning("TODO"); +} + +void TTRoomScript::proc9() { + warning("TODO"); +} + +void TTRoomScript::proc10() { + warning("TODO"); +} + +void TTRoomScript::proc11() { + warning("TODO"); +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_room_script.h b/engines/titanic/true_talk/tt_room_script.h new file mode 100644 index 0000000000..ed17b29e9c --- /dev/null +++ b/engines/titanic/true_talk/tt_room_script.h @@ -0,0 +1,62 @@ +/* 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. + * + */ + +#ifndef TITANIC_TT_ROOM_SCRIPT_H +#define TITANIC_TT_ROOM_SCRIPT_H + +#include "titanic/true_talk/tt_script_base.h" + +namespace Titanic { + +class TTRoomScriptBase : public TTScriptBase { +public: + int _scriptId; +public: + TTRoomScriptBase(int scriptId, const char *charClass, const char *charName, + int v3, int v4, int v5, int v6, int v2, int v7); + + virtual void proc6() = 0; + virtual void proc7() = 0; + virtual void proc8() = 0; + virtual void proc9() = 0; + virtual void proc10() = 0; + virtual void proc11() = 0; +}; + + +class TTRoomScript : public TTRoomScriptBase { +private: + int _field54; +public: + TTRoomScript(int scriptId); + + virtual void proc6(); + virtual void proc7(); + virtual void proc8(); + virtual void proc9(); + virtual void proc10(); + virtual void proc11(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_ROOM_SCRIPT_H */ diff --git a/engines/titanic/true_talk/tt_scripts.cpp b/engines/titanic/true_talk/tt_scripts.cpp index 8e34ec5d2b..9bfa31af8b 100644 --- a/engines/titanic/true_talk/tt_scripts.cpp +++ b/engines/titanic/true_talk/tt_scripts.cpp @@ -45,9 +45,9 @@ TTNamedScript *TTNamedScriptList::findById(int charId) const { /*------------------------------------------------------------------------*/ -TTUnnamedScript *TTUnnamedScriptList::findById(int scriptId) const { - for (TTUnnamedScriptList::const_iterator i = begin(); i != end(); ++i) { - const TTUnnamedScriptListItem *item = *i; +TTRoomScript *TTRoomScriptList::findById(int scriptId) const { + for (TTRoomScriptList::const_iterator i = begin(); i != end(); ++i) { + const TTRoomScriptListItem *item = *i; if (item->_item->_scriptId == scriptId) return item->_item; } @@ -59,11 +59,11 @@ TTUnnamedScript *TTUnnamedScriptList::findById(int scriptId) const { TTScripts::TTScripts(CTitleEngine *titleEngine) : _titleEngine(titleEngine), _field24(0), _field28(0) { - // Load unnamed scripts + // Load room scripts for (int scriptNum = 100; scriptNum < 133; ++scriptNum) - addScript(new TTUnnamedScript(scriptNum)); + addScript(new TTRoomScript(scriptNum)); - // Load named scripts + // Load npc scripts addScript(new DoorbotScript(104, "Doorbot", 0, "Fentible", 11, 1, -1, -1, -1, 0), 100); addScript(new BellbotScript(101, "Bellbot", 0, "Krage", 8, 1), 110); addScript(new LiftbotScript(105, "LiftBot", 0, "Nobby", 11, 1, -1, -1, -1, 0), 103); @@ -77,19 +77,19 @@ TTScripts::TTScripts(CTitleEngine *titleEngine) : void TTScripts::addScript(TTNamedScript *script, int scriptId) { script->proc13(); - // Find the unnamed script this is associated with - TTUnnamedScript *unnamedScript = getUnnamedScript(scriptId); - assert(unnamedScript); + // Find the room script this is associated with + TTRoomScript *roomScript = getRoomScript(scriptId); + assert(roomScript); - _namedScripts.push_back(new TTNamedScriptListItem(script, unnamedScript)); + _namedScripts.push_back(new TTNamedScriptListItem(script, roomScript)); } -void TTScripts::addScript(TTUnnamedScript *script) { - _unnamedScripts.push_back(new TTUnnamedScriptListItem(script)); +void TTScripts::addScript(TTRoomScript *script) { + _roomScripts.push_back(new TTRoomScriptListItem(script)); } -TTUnnamedScript *TTScripts::getUnnamedScript(int scriptId) const { - return _unnamedScripts.findById(scriptId); +TTRoomScript *TTScripts::getRoomScript(int scriptId) const { + return _roomScripts.findById(scriptId); } TTNamedScript *TTScripts::getNamedScript(int charId) const { diff --git a/engines/titanic/true_talk/tt_scripts.h b/engines/titanic/true_talk/tt_scripts.h index 5934eb3625..00638a03d5 100644 --- a/engines/titanic/true_talk/tt_scripts.h +++ b/engines/titanic/true_talk/tt_scripts.h @@ -25,7 +25,7 @@ #include "titanic/core/list.h" #include "titanic/true_talk/tt_named_script.h" -#include "titanic/true_talk/tt_unnamed_script.h" +#include "titanic/true_talk/tt_room_script.h" namespace Titanic { @@ -34,30 +34,30 @@ class CTitleEngine; class TTNamedScriptListItem : public ListItem { public: TTNamedScript *_script; - TTUnnamedScript *_unnamedScript; + TTRoomScript *_roomScript; public: - TTNamedScriptListItem() : _script(nullptr), _unnamedScript(nullptr) {} - TTNamedScriptListItem(TTNamedScript *script, TTUnnamedScript *unnamedScript) : - _script(script), _unnamedScript(unnamedScript) {} + TTNamedScriptListItem() : _script(nullptr), _roomScript(nullptr) {} + TTNamedScriptListItem(TTNamedScript *script, TTRoomScript *roomScript) : + _script(script), _roomScript(roomScript) {} virtual ~TTNamedScriptListItem() { delete _script; } }; -PTR_LIST_ITEM(TTUnnamedScript); +PTR_LIST_ITEM(TTRoomScript); class TTNamedScriptList : public List { public: TTNamedScript *findById(int charId) const; }; -class TTUnnamedScriptList : public List { +class TTRoomScriptList : public List { public: - TTUnnamedScript *findById(int scriptId) const; + TTRoomScript *findById(int scriptId) const; }; class TTScripts { private: TTNamedScriptList _namedScripts; - TTUnnamedScriptList _unnamedScripts; + TTRoomScriptList _roomScripts; CTitleEngine *_titleEngine; int _field24; int _field28; @@ -70,14 +70,14 @@ private: /** * Add an unnamed script to the unnamed scripts list */ - void addScript(TTUnnamedScript *script); + void addScript(TTRoomScript *script); public: TTScripts(CTitleEngine *titleEngine); /** - * Return a pointer to the specified script + * Return a pointer to the specified room script */ - TTUnnamedScript *getUnnamedScript(int scriptId) const; + TTRoomScript *getRoomScript(int scriptId) const; /** * Return a pointer to the specified named character script diff --git a/engines/titanic/true_talk/tt_unnamed_script.cpp b/engines/titanic/true_talk/tt_unnamed_script.cpp deleted file mode 100644 index 8c91290fba..0000000000 --- a/engines/titanic/true_talk/tt_unnamed_script.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* 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/textconsole.h" -#include "titanic/true_talk/tt_unnamed_script.h" - -namespace Titanic { - -TTUnnamedScriptBase::TTUnnamedScriptBase(int scriptId, - const char *charClass, const char *charName, - int v3, int v4, int v5, int v6, int v2, int v7) : _scriptId(scriptId), - TTScriptBase(3, charClass, v2, charName, v3, v4, v5, v6, v7) { -} - -/*------------------------------------------------------------------------*/ - -TTUnnamedScript::TTUnnamedScript(int scriptId) : - TTUnnamedScriptBase(scriptId, "", "", 0, -1, -1, -1, 0, 0) { -} - -void TTUnnamedScript::proc6() { - warning("TODO"); -} - -void TTUnnamedScript::proc7() { - warning("TODO"); -} - -void TTUnnamedScript::proc8() { - warning("TODO"); -} - -void TTUnnamedScript::proc9() { - warning("TODO"); -} - -void TTUnnamedScript::proc10() { - warning("TODO"); -} - -void TTUnnamedScript::proc11() { - warning("TODO"); -} - -} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_unnamed_script.h b/engines/titanic/true_talk/tt_unnamed_script.h deleted file mode 100644 index eeba200193..0000000000 --- a/engines/titanic/true_talk/tt_unnamed_script.h +++ /dev/null @@ -1,62 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_TT_UNNAMED_SCRIPT_H -#define TITANIC_TT_UNNAMED_SCRIPT_H - -#include "titanic/true_talk/tt_script_base.h" - -namespace Titanic { - -class TTUnnamedScriptBase : public TTScriptBase { -public: - int _scriptId; -public: - TTUnnamedScriptBase(int scriptId, const char *charClass, const char *charName, - int v3, int v4, int v5, int v6, int v2, int v7); - - virtual void proc6() = 0; - virtual void proc7() = 0; - virtual void proc8() = 0; - virtual void proc9() = 0; - virtual void proc10() = 0; - virtual void proc11() = 0; -}; - - -class TTUnnamedScript : public TTUnnamedScriptBase { -private: - int _field54; -public: - TTUnnamedScript(int scriptId); - - virtual void proc6(); - virtual void proc7(); - virtual void proc8(); - virtual void proc9(); - virtual void proc10(); - virtual void proc11(); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_TT_UNNAMED_SCRIPT_H */ -- cgit v1.2.3 From d463be89fac3af6f33ef3c5179594e86cd806f83 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 5 May 2016 12:55:52 -0400 Subject: TITANIC: Finished CComputerScreen TimerMsg --- engines/titanic/core/game_object.cpp | 8 ++++ engines/titanic/core/game_object.h | 9 ++++- engines/titanic/core/saveable_object.cpp | 2 + engines/titanic/game/computer_screen.cpp | 66 +++++++++++++++++++++++++++++++- engines/titanic/messages/messages.h | 7 ++-- 5 files changed, 85 insertions(+), 7 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 1b76ec1960..6f70742d79 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -380,6 +380,14 @@ void CGameObject::playClip(const CString &name, uint flags) { playMovie(clip->_startFrame, clip->_endFrame, flags); } +void CGameObject::playClip(uint startFrame, uint endFrame) { + CMovieClip *clip = new CMovieClip("", startFrame, endFrame); + CGameManager *gameManager = getGameManager(); + CRoomItem *room = gameManager->getRoom(); + + gameManager->playClip(clip, room, room); +} + void CGameObject::playMovie(uint flags) { _frameNumber = -1; if (!_surface && !_resource.empty()) { diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 40492676b0..98973b38c3 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -134,7 +134,7 @@ protected: /** * Plays a sound */ - int playSound(const CString &name, int val2, int val3, int val4); + int playSound(const CString &name, int val2 = 100, int val3 = 0, int val4 = 0); /** * Plays a sound @@ -144,7 +144,7 @@ protected: /** * Stop a sound */ - void stopSound(int handle, int val2); + void stopSound(int handle, int val2 = 0); bool soundFn1(int handle); @@ -316,6 +316,11 @@ public: */ void playClip(const CString &name, uint flags); + /** + * Play a clip + */ + void playClip(uint startFrame, uint endFrame); + /** * Return the current view/node/room as a single string */ diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 00a48ea435..4b24f3e37e 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -759,6 +759,7 @@ DEFFN(CBilgeDispensorEvent) DEFFN(CBodyInBilgeRoomMsg) DEFFN(CBowlStateChange) DEFFN(CCarryObjectArrivedMsg) +DEFFN(CChangeMusicMsg) DEFFN(CChangeSeasonMsg) DEFFN(CCheckAllPossibleCodes) DEFFN(CCheckChevCode) @@ -1345,6 +1346,7 @@ void CSaveableObject::initClassList() { ADDFN(CBodyInBilgeRoomMsg, CMessage); ADDFN(CBowlStateChange, CMessage); ADDFN(CCarryObjectArrivedMsg, CMessage); + ADDFN(CChangeMusicMsg, CMessage); ADDFN(CChangeSeasonMsg, CMessage); ADDFN(CCheckAllPossibleCodes, CMessage); ADDFN(CCheckChevCode, CMessage); diff --git a/engines/titanic/game/computer_screen.cpp b/engines/titanic/game/computer_screen.cpp index f0fab26b61..8879136103 100644 --- a/engines/titanic/game/computer_screen.cpp +++ b/engines/titanic/game/computer_screen.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/computer_screen.h" +#include "titanic/messages/messages.h" namespace Titanic { @@ -70,8 +71,69 @@ bool CComputerScreen::EnterViewMsg(CEnterViewMsg *msg) { } bool CComputerScreen::TimerMsg(CTimerMsg *msg) { - // TODO - warning("TODO: CComputerScreen::TimerMsg"); + int handle; + + switch (msg->_val3) { + case 0: + loadSound("a#32.wav"); + loadSound("a#31.wav"); + loadSound("a#33.wav"); + loadSound("a#30.wav"); + loadSound("a#29.wav"); + playSound("a#25.wav"); + addTimer(1, 2000, 0); + break; + + case 1: + playSound("a#32.wav"); + playSound("a#31.wav"); + addTimer(2, 2000, 0); + break; + + case 2: { + CChangeMusicMsg musicMsg(CString(), 1); + musicMsg.execute("HomeMusicPlayer"); + playSound("a#33.wav"); + playSound("a#31.wav"); + changeView("Home.Node 4.E", ""); + playClip(51, 150); + playSound("a#31.wav"); + playClip(151, 200); + + handle = playSound("a#27.wav"); + playClip(200, 306); + playSound("a#30.wav"); + stopSound(handle, 0); + + playClip(306, 338); + handle = playSound("a#28.wav"); + playClip(338, 392); + playSound("a#29.wav"); + stopSound(handle); + + playSound("y#662.wav"); + soundFn3(handle, 10, 2); + playClip(392, 450); + trueTalkFn1("Doorbot", 0x3611A, 0); + sleep(8000); + + playClip(450, 492); + trueTalkFn1("DOorbot", 0x36121, 0); + playClip(492, 522); + soundFn3(handle, 30, 2); + + playClip(523, 540); + soundFn3(handle, 0, 1); + + playClip(541, 551); + stopSound(handle); + break; + } + + default: + break; + } + return true; } diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index d64972c40d..b3ca1effd9 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -185,13 +185,13 @@ MESSAGE1(CTimeMsg, uint, _ticks, 0); class CTimerMsg : public CTimeMsg { public: uint _timerCtr; - int _fieldC; + int _val3; CString _action; public: CLASSDEF - CTimerMsg() : CTimeMsg(), _timerCtr(0), _fieldC(0) {} + CTimerMsg() : CTimeMsg(), _timerCtr(0), _val3(0) {} CTimerMsg(uint ticks, uint timerCtr, int val2, const CString &action) : - CTimeMsg(ticks), _timerCtr(timerCtr), _fieldC(val2), _action(action) {} + CTimeMsg(ticks), _timerCtr(timerCtr), _val3(val2), _action(action) {} static bool isSupportedBy(const CTreeItem *item) { return supports(item, _type); @@ -207,6 +207,7 @@ MESSAGE0(CArmPickedUpFromTableMsg); MESSAGE0(CBodyInBilgeRoomMsg); MESSAGE1(CBowlStateChange, int, value, 0); MESSAGE2(CCarryObjectArrivedMsg, CString, strValue, "", int, numValue, 0); +MESSAGE2(CChangeMusicMsg, CString, strValue, "", int, numValue, 0); MESSAGE1(CChangeSeasonMsg, CString, season, "Summer"); MESSAGE0(CCheckAllPossibleCodes); MESSAGE2(CCheckChevCode, int, value1, 0, int, value2, 0); -- cgit v1.2.3 From b1290d6dd93f2f442bb9649685a9fa713b14821d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 5 May 2016 19:11:28 -0400 Subject: TITANIC: Cleanup & renames for starting conversations --- engines/titanic/carry/carry_parrot.cpp | 8 ++++---- engines/titanic/core/game_object.cpp | 11 ++++++----- engines/titanic/core/game_object.h | 11 +++++++++-- engines/titanic/game/computer_screen.cpp | 4 ++-- engines/titanic/true_talk/true_talk_manager.cpp | 7 ++++--- engines/titanic/true_talk/true_talk_manager.h | 10 +++++++--- 6 files changed, 32 insertions(+), 19 deletions(-) diff --git a/engines/titanic/carry/carry_parrot.cpp b/engines/titanic/carry/carry_parrot.cpp index 6bf536ea7a..aa75688fab 100644 --- a/engines/titanic/carry/carry_parrot.cpp +++ b/engines/titanic/carry/carry_parrot.cpp @@ -167,9 +167,9 @@ bool CCarryParrot::PassOnDragStartMsg(CPassOnDragStartMsg *msg) { return CCarry::PassOnDragStartMsg(msg); } - CGameObject *npc = static_cast(getRoot()->findByName(_string6)); + CTrueTalkNPC *npc = static_cast(getRoot()->findByName(_string6)); if (npc) - trueTalkFn1(npc, 0x446BF, 0); + startTalking(npc, 0x446BF, 0); _fieldE0 = 0; playSound("z#475.wav", 100, 0, 0); @@ -198,9 +198,9 @@ bool CCarryParrot::UseWithCharMsg(CUseWithCharMsg *msg) { bool CCarryParrot::ActMsg(CActMsg *msg) { if (msg->_action == "FreeParrot" && (CParrot::_v4 == 4 || CParrot::_v4 == 1)) { - CGameObject *npc = static_cast(getRoot()->findByName(_string6)); + CTrueTalkNPC *npc = static_cast(getRoot()->findByName(_string6)); if (npc) - trueTalkFn1(npc, 0x446BF, 0); + startTalking(npc, 0x446BF, 0); setVisible(false); _fieldE0 = 0; diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 6f70742d79..ff7e2288f8 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -24,6 +24,7 @@ #include "titanic/core/mail_man.h" #include "titanic/core/resource_key.h" #include "titanic/core/room_item.h" +#include "titanic/npcs/true_talk_npc.h" #include "titanic/pet_control/pet_control.h" #include "titanic/support/files_manager.h" #include "titanic/support/screen_manager.h" @@ -706,17 +707,17 @@ void CGameObject::incState38() { getGameManager()->_gameState.inc38(); } -void CGameObject::trueTalkFn1(const CString &name, int val2, int val3) { - CGameObject *npc = static_cast(getRoot()->findByName(name)); - trueTalkFn1(npc, val2, val3); +void CGameObject::startTalking(const CString &npcName, int val2, int val3) { + CTrueTalkNPC *npc = static_cast(getRoot()->findByName(npcName)); + startTalking(npc, val2, val3); } -void CGameObject::trueTalkFn1(CGameObject *npc, int val2, int val3) { +void CGameObject::startTalking(CTrueTalkNPC *npc, int val2, int val3) { CGameManager *gameManager = getGameManager(); if (gameManager) { CTrueTalkManager *talkManager = gameManager->getTalkManager(); if (talkManager) - talkManager->fn1(npc, val2, val3); + talkManager->start(npc, val2, val3); } } diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 98973b38c3..97d3ca45eb 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -37,6 +37,7 @@ enum Found { FOUND_NONE = 0, FOUND_GLOBAL = 1, FOUND_ROOM = 2, FOUND_PET = 3, FO class CVideoSurface; class CMouseDragStartMsg; +class CTrueTalkNPC; class OSMovie; class CGameObject : public CNamedItem { @@ -216,9 +217,15 @@ protected: */ void moveToView(); - void trueTalkFn1(const CString &name, int val2, int val3); + /** + * Start a conversation with the NPC + */ + void startTalking(const CString &name, int val2, int val3); - void trueTalkFn1(CGameObject *npc, int val2, int val3); + /** + * Start a conversation with the NPC + */ + void startTalking(CTrueTalkNPC *npc, int val2, int val3); /** * Load the surface diff --git a/engines/titanic/game/computer_screen.cpp b/engines/titanic/game/computer_screen.cpp index 8879136103..846858be0e 100644 --- a/engines/titanic/game/computer_screen.cpp +++ b/engines/titanic/game/computer_screen.cpp @@ -114,11 +114,11 @@ bool CComputerScreen::TimerMsg(CTimerMsg *msg) { playSound("y#662.wav"); soundFn3(handle, 10, 2); playClip(392, 450); - trueTalkFn1("Doorbot", 0x3611A, 0); + startTalking("Doorbot", 0x3611A, 0); sleep(8000); playClip(450, 492); - trueTalkFn1("DOorbot", 0x36121, 0); + startTalking("Doorbot", 0x36121, 0); playClip(492, 522); soundFn3(handle, 30, 2); diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index c9343d1f39..6abce89148 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -22,6 +22,7 @@ #include "titanic/true_talk/true_talk_manager.h" #include "titanic/core/tree_item.h" +#include "titanic/npcs/true_talk_npc.h" #include "titanic/game_manager.h" #define MKTAG_BE(a3,a2,a1,a0) ((uint32)((a3) | ((a2) << 8) | ((a1) << 16) | ((a0) << 24))) @@ -41,7 +42,7 @@ bool CTrueTalkManager::_v10; int CTrueTalkManager::_v11[41]; CTrueTalkManager::CTrueTalkManager(CGameManager *owner) : - _gameManager(owner), _scripts(&_titleEngine) { + _gameManager(owner), _scripts(&_titleEngine), _currentCharId(0) { } void CTrueTalkManager::save(SimpleFile *file) const { @@ -192,7 +193,7 @@ void CTrueTalkManager::update2() { //warning("CTrueTalkManager::update2"); } -void CTrueTalkManager::fn1(CGameObject *npc, int val2, int val3) { +void CTrueTalkManager::start(CTrueTalkNPC *npc, int val2, int val3) { warning("CTrueTalkManager::fn1"); } @@ -219,7 +220,7 @@ TTNamedScript *CTrueTalkManager::getTalker(const CString &name) const { return nullptr; } -TTNamedScript *CTrueTalkManager::getNpcScript(CGameObject *npc) const { +TTNamedScript *CTrueTalkManager::getNpcScript(CTrueTalkNPC *npc) const { CString npcName = npc->getName(); TTNamedScript *script = getTalker(npcName); diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index 991bf1608f..5507cf2a4c 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -31,13 +31,14 @@ namespace Titanic { class CGameManager; class CTreeItem; -class CGameObject; +class CTrueTalkNPC; class CTrueTalkManager { private: CGameManager *_gameManager; CTitleEngine _titleEngine; TTScripts _scripts; + int _currentCharId; private: /** * Loads the statics for the class @@ -62,7 +63,7 @@ private: /** * Gets the script associated with an NPC game object */ - TTNamedScript *getNpcScript(CGameObject *npc) const; + TTNamedScript *getNpcScript(CTrueTalkNPC *npc) const; /** * Gets the script associated with the current room @@ -129,7 +130,10 @@ public: void update2(); - void fn1(CGameObject *npc, int val2, int val3); + /** + * Start a TrueTalk conversation + */ + void start(CTrueTalkNPC *npc, int val2, int val3); /** * Return a TrueTalk talker/script -- cgit v1.2.3 From 03a8cbaf98fb44dcd4c915f4d8577adaef6b0d7a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 5 May 2016 20:28:32 -0400 Subject: TITANIC: Implemented TT manager loadAssets, beginnings of CDialogueFile --- engines/titanic/game_manager.cpp | 2 +- engines/titanic/messages/messages.h | 2 +- engines/titanic/module.mk | 1 + engines/titanic/true_talk/dialogue_file.cpp | 51 +++++++++++++++++++++++ engines/titanic/true_talk/dialogue_file.h | 55 +++++++++++++++++++++++++ engines/titanic/true_talk/true_talk_manager.cpp | 37 ++++++++++++++--- engines/titanic/true_talk/true_talk_manager.h | 19 ++++++--- 7 files changed, 154 insertions(+), 13 deletions(-) create mode 100644 engines/titanic/true_talk/dialogue_file.cpp create mode 100644 engines/titanic/true_talk/dialogue_file.h diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index 0d1714a3a6..bfd6984a73 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -199,7 +199,7 @@ void CGameManager::viewChange() { _videoSurface1 = nullptr; _videoSurface2 = CScreenManager::_screenManagerPtr->createSurface(600, 340); - _trueTalkManager.viewChange(); + _trueTalkManager.clear(); for (CTreeItem *treeItem = _project; treeItem; treeItem = treeItem->scan(_project)) treeItem->viewChange(); diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index b3ca1effd9..fb3169cc71 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -342,7 +342,7 @@ MESSAGE3(CTransportMsg, CString, roomName, "", int, value1, 0, int, value2, 0); MESSAGE1(CTriggerAutoMusicPlayerMsg, int, value, 0); MESSAGE1(CTriggerNPCEvent, int, value, 0); MESSAGE4(CTrueTalkGetAnimSetMsg, int, value1, 0, int, value2, 0, int, value3, 0, int, value4, 0); -MESSAGE2(CTrueTalkGetAssetDetailsMsg, CString, strValue, "", int, numValue, 0); +MESSAGE2(CTrueTalkGetAssetDetailsMsg, CString, filename, "", int, numValue, 0); MESSAGE2(CTrueTalkGetStateValueMsg, int, value1, 0, int, value2, -1000); MESSAGE2(CTrueTalkNotifySpeechEndedMsg, int, value1, 0, int, value2, 0); MESSAGE3(CTrueTalkNotifySpeechStartedMsg, int, value1, 0, int, value2, 0, int, value, 0); diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index a1529317fd..0f301b93ff 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -450,6 +450,7 @@ MODULE_OBJS := \ true_talk/barbot_script.o \ true_talk/bellbot_script.o \ true_talk/deskbot_script.o \ + true_talk/dialogue_file.o \ true_talk/doorbot_script.o \ true_talk/liftbot_script.o \ true_talk/maitred_script.o \ diff --git a/engines/titanic/true_talk/dialogue_file.cpp b/engines/titanic/true_talk/dialogue_file.cpp new file mode 100644 index 0000000000..341d973f36 --- /dev/null +++ b/engines/titanic/true_talk/dialogue_file.cpp @@ -0,0 +1,51 @@ +/* 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 "titanic/true_talk/dialogue_file.h" + +namespace Titanic { + +CDialogueFile::CDialogueFile(const CString &filename, uint count) { + if (!_file.open(filename)) + error("Could not locate dialogue file - %s", filename.c_str()); + + _data1.resize(count); + + _file.readUint32LE(); // Skip over file Id + _entries.resize(_file.readUint32LE()); + + // Read in the entries + for (uint idx = 0; idx < _entries.size(); ++idx) { + _entries[idx].v1 = _file.readUint32LE(); + _entries[idx].v2 = _file.readUint32LE(); + } +} + +CDialogueFile::~CDialogueFile() { + clear(); +} + +void CDialogueFile::clear() { + _file.close(); +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/dialogue_file.h b/engines/titanic/true_talk/dialogue_file.h new file mode 100644 index 0000000000..00bacacbd2 --- /dev/null +++ b/engines/titanic/true_talk/dialogue_file.h @@ -0,0 +1,55 @@ +/* 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. + * + */ + +#ifndef TITANIC_DIALOGUE_FILE_H +#define TITANIC_DIALOGUE_FILE_H + +#include "common/file.h" +#include "titanic/support/string.h" + +namespace Titanic { + +class CDialogueFile { + struct CDialogueFileEntry { + uint v1; + uint v2; + }; + struct EntryRec { + uint v1, v2, v3, v4, v5; + }; +private: + Common::File _file; + Common::Array _entries; + Common::Array _data1; +public: + CDialogueFile(const CString &filename, uint count); + ~CDialogueFile(); + + /** + * Clear the loaded data + */ + void clear(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TITLE_ENGINE_H */ diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 6abce89148..2e43266b65 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -42,7 +42,12 @@ bool CTrueTalkManager::_v10; int CTrueTalkManager::_v11[41]; CTrueTalkManager::CTrueTalkManager(CGameManager *owner) : - _gameManager(owner), _scripts(&_titleEngine), _currentCharId(0) { + _gameManager(owner), _scripts(&_titleEngine), _currentCharId(0), + _dialogueFile(nullptr), _field14(0) { +} + +CTrueTalkManager::~CTrueTalkManager() { + clear(); } void CTrueTalkManager::save(SimpleFile *file) const { @@ -127,6 +132,12 @@ void CTrueTalkManager::saveStatics(SimpleFile *file) { file->writeNumber(_v11[idx]); } +void CTrueTalkManager::clear() { + delete _dialogueFile; + _dialogueFile = nullptr; + _currentCharId = 0; +} + void CTrueTalkManager::setFlags(int index, int val) { switch (index) { case 1: @@ -181,10 +192,6 @@ void CTrueTalkManager::preLoad() { warning("TODO: CTrueTalkManager::preLoad"); } -void CTrueTalkManager::viewChange() { - warning("CTrueTalkManager::viewChange"); -} - void CTrueTalkManager::update1() { //warning("CTrueTalkManager::update1"); } @@ -194,7 +201,7 @@ void CTrueTalkManager::update2() { } void CTrueTalkManager::start(CTrueTalkNPC *npc, int val2, int val3) { - warning("CTrueTalkManager::fn1"); + } TTNamedScript *CTrueTalkManager::getTalker(const CString &name) const { @@ -249,4 +256,22 @@ TTRoomScript *CTrueTalkManager::getRoomScript() const { return script; } +void CTrueTalkManager::loadAssets(CTrueTalkNPC *npc, int charId) { + // If assets for the character are already loaded, simply exit + if (_currentCharId == charId) + return; + + // Clear any previously loaded data + clear(); + + // Signal the NPC to get the asset details + CTrueTalkGetAssetDetailsMsg detailsMsg; + detailsMsg.execute(npc); + + if (!detailsMsg._filename.empty()) { + _dialogueFile = new CDialogueFile(detailsMsg._filename, 20); + _field14 = detailsMsg._numValue + 1; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index 5507cf2a4c..a7258c587f 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -24,6 +24,7 @@ #define TITANIC_TRUE_TALK_MANAGER_H #include "titanic/support/simple_file.h" +#include "titanic/true_talk/dialogue_file.h" #include "titanic/true_talk/title_engine.h" #include "titanic/true_talk/tt_scripts.h" @@ -39,6 +40,8 @@ private: CTitleEngine _titleEngine; TTScripts _scripts; int _currentCharId; + CDialogueFile *_dialogueFile; + int _field14; private: /** * Loads the statics for the class @@ -69,6 +72,11 @@ private: * Gets the script associated with the current room */ TTRoomScript *getRoomScript() const; + + /** + * Loads assets for the current character, if it's changed + */ + void loadAssets(CTrueTalkNPC *npc, int charId); public: static int _v1; static int _v2; @@ -85,6 +93,7 @@ public: static void setFlags(int index, int val); public: CTrueTalkManager(CGameManager *owner); + ~CTrueTalkManager(); /** * Save the data for the class to file @@ -96,6 +105,11 @@ public: */ void load(SimpleFile *file); + /** + * Clear the manager + */ + void clear(); + /** * Called when a game is about to be loaded */ @@ -116,11 +130,6 @@ public: */ void postSave() {} - /** - * Called when the view changes - */ - void viewChange(); - /** * Returns the scripts for the manager */ -- cgit v1.2.3 From ab86c09a2f4c8ea315824bb95c58b5f33728e115 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 5 May 2016 23:20:54 -0400 Subject: TITANIC: Beginnings of STtitleEngine class --- engines/titanic/module.mk | 4 +- engines/titanic/true_talk/title_engine.cpp | 50 +++++++++++++++++ engines/titanic/true_talk/title_engine.h | 74 +++++++++++++++++++++++++ engines/titanic/true_talk/title_engine_sub.cpp | 32 +++++++++++ engines/titanic/true_talk/title_engine_sub.h | 37 +++++++++++++ engines/titanic/true_talk/true_talk_manager.cpp | 12 ++++ engines/titanic/true_talk/true_talk_manager.h | 3 +- engines/titanic/true_talk/tt_title_script.cpp | 28 ++++++++++ engines/titanic/true_talk/tt_title_script.h | 37 +++++++++++++ 9 files changed, 275 insertions(+), 2 deletions(-) create mode 100644 engines/titanic/true_talk/title_engine_sub.cpp create mode 100644 engines/titanic/true_talk/title_engine_sub.h create mode 100644 engines/titanic/true_talk/tt_title_script.cpp create mode 100644 engines/titanic/true_talk/tt_title_script.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 0f301b93ff..10698cfc3b 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -457,12 +457,14 @@ MODULE_OBJS := \ true_talk/parrot_script.o \ true_talk/succubus_script.o \ true_talk/title_engine.o \ + true_talk/title_engine_sub.o \ true_talk/true_talk_manager.o \ true_talk/tt_script_base.o \ true_talk/tt_room_script.o \ true_talk/tt_named_script.o \ true_talk/tt_scripts.o \ - true_talk/tt_string.o + true_talk/tt_string.o \ + true_talk/tt_title_script.o # This module can be built as a plugin ifeq ($(ENABLE_TITANIC), DYNAMIC_PLUGIN) diff --git a/engines/titanic/true_talk/title_engine.cpp b/engines/titanic/true_talk/title_engine.cpp index 1369af6a5c..adc74feff8 100644 --- a/engines/titanic/true_talk/title_engine.cpp +++ b/engines/titanic/true_talk/title_engine.cpp @@ -24,4 +24,54 @@ namespace Titanic { +CTitleEngine::CTitleEngine() : _script(nullptr), _sub(nullptr) { +} + +CTitleEngine::~CTitleEngine() { + delete _script; + delete _sub; +} + +void CTitleEngine::setup(int val1, int val2) { + +} + + +/*------------------------------------------------------------------------*/ + +STtitleEngine::STtitleEngine(): CTitleEngine(), _field58(0) { +} + +STtitleEngine::~STtitleEngine() { + delete _stream; +} + +void STtitleEngine::reset() { + _field58 = 0; + _array.clear(); +} + +void STtitleEngine::setup(int val1, int val2) { + CTitleEngine::setup(val1, 3); +} + +int STtitleEngine::proc2(int val1, int val2) { + // TODO + return 0; +} + +void STtitleEngine::dump(int val1, int val2) { + // TODO +} + +void STtitleEngine::open(const CString &name) { + _stream = _resources.getResource(Common::WinResourceID("Text"), + name); +} + +void STtitleEngine::close() { + delete _stream; + _stream = nullptr; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/title_engine.h b/engines/titanic/true_talk/title_engine.h index c854704cdc..71b0947012 100644 --- a/engines/titanic/true_talk/title_engine.h +++ b/engines/titanic/true_talk/title_engine.h @@ -23,9 +23,83 @@ #ifndef TITANIC_TITLE_ENGINE_H #define TITANIC_TITLE_ENGINE_H +#include "common/stream.h" +#include "common/winexe_pe.h" +#include "titanic/support/string.h" +#include "titanic/true_talk/title_engine_sub.h" +#include "titanic/true_talk/tt_script_base.h" + namespace Titanic { class CTitleEngine { +protected: + CTitleEngineSub *_sub; + TTScriptBase *_script; +public: + CTitleEngine(); + ~CTitleEngine(); + + /** + * Setup the engine + */ + virtual void setup(int val1, int val2 = 0); + + virtual int proc2(int val1, int val2) { return 2; } + + virtual int proc4(int unused) const = 0; + virtual int proc5(int64 unused) const = 0; + virtual int proc6(int64 unused) const = 0; + virtual int proc7(int64 unused) const = 0; + virtual int proc8() const = 0; + + /** + * Open a designated file + */ + virtual void open(const CString &name) = 0; + + /** + * Close the file + */ + virtual void close() = 0; +}; + +class STtitleEngine : public CTitleEngine { +private: + Common::PEResources _resources; + Common::SeekableReadStream *_stream; + int _field58; + Common::Array _array; + Common::Array _data; +public: + STtitleEngine(); + ~STtitleEngine(); + + void reset(); + + /** + * Setup the engine + */ + virtual void setup(int val1, int val2 = 0); + + virtual int proc2(int val1, int val2); + + virtual void dump(int val1, int val2); + + virtual int proc4(int unused) const { return 0; } + virtual int proc5(int64 unused) const { return 0; } + virtual int proc6(int64 unused) const { return 0; } + virtual int proc7(int64 unused) const { return 0; } + virtual int proc8() const { return 0; } + + /** + * Open a designated file + */ + virtual void open(const CString &name); + + /** + * Close the file + */ + virtual void close(); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/title_engine_sub.cpp b/engines/titanic/true_talk/title_engine_sub.cpp new file mode 100644 index 0000000000..f7e1f28d1d --- /dev/null +++ b/engines/titanic/true_talk/title_engine_sub.cpp @@ -0,0 +1,32 @@ +/* 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 "titanic/true_talk/title_engine_sub.h" + +namespace Titanic { + +/*------------------------------------------------------------------------*/ + +CTitleEngineSub::CTitleEngineSub(CTitleEngine *owner, int val1, int val2) { +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/title_engine_sub.h b/engines/titanic/true_talk/title_engine_sub.h new file mode 100644 index 0000000000..050f041bf2 --- /dev/null +++ b/engines/titanic/true_talk/title_engine_sub.h @@ -0,0 +1,37 @@ +/* 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. + * + */ + +#ifndef TITANIC_TITLE_ENGINE_SUB_H +#define TITANIC_TITLE_ENGINE_SUB_H + +namespace Titanic { + +class CTitleEngine; + +class CTitleEngineSub { +public: + CTitleEngineSub(CTitleEngine *owner, int val1, int val2); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TITLE_ENGINE_SUB_H */ diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 2e43266b65..091e3f8e48 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -40,6 +40,7 @@ bool CTrueTalkManager::_v8; int CTrueTalkManager::_v9; bool CTrueTalkManager::_v10; int CTrueTalkManager::_v11[41]; +CTrueTalkNPC *CTrueTalkManager::_currentNPC; CTrueTalkManager::CTrueTalkManager(CGameManager *owner) : _gameManager(owner), _scripts(&_titleEngine), _currentCharId(0), @@ -201,7 +202,18 @@ void CTrueTalkManager::update2() { } void CTrueTalkManager::start(CTrueTalkNPC *npc, int val2, int val3) { + TTNamedScript *npcScript = getNpcScript(npc); + TTRoomScript *roomScript = getRoomScript(); + _titleEngine.reset(); + uint charId = npcScript->charId(); + loadAssets(npc, charId); + + _currentNPC = npc; + warning("TODO: CTrueTalkManager::start"); + _currentNPC = nullptr; + + //TODO: More } TTNamedScript *CTrueTalkManager::getTalker(const CString &name) const { diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index a7258c587f..d2bba4b4ba 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -37,7 +37,7 @@ class CTrueTalkNPC; class CTrueTalkManager { private: CGameManager *_gameManager; - CTitleEngine _titleEngine; + STtitleEngine _titleEngine; TTScripts _scripts; int _currentCharId; CDialogueFile *_dialogueFile; @@ -89,6 +89,7 @@ public: static int _v9; static bool _v10; static int _v11[41]; + static CTrueTalkNPC *_currentNPC; static void setFlags(int index, int val); public: diff --git a/engines/titanic/true_talk/tt_title_script.cpp b/engines/titanic/true_talk/tt_title_script.cpp new file mode 100644 index 0000000000..048199ad62 --- /dev/null +++ b/engines/titanic/true_talk/tt_title_script.cpp @@ -0,0 +1,28 @@ +/* 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 "titanic/true_talk/tt_title_script.h" + +namespace Titanic { + + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_title_script.h b/engines/titanic/true_talk/tt_title_script.h new file mode 100644 index 0000000000..0c36e832a9 --- /dev/null +++ b/engines/titanic/true_talk/tt_title_script.h @@ -0,0 +1,37 @@ +/* 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. + * + */ + +#ifndef TITANIC_TT_TITLE_SCRIPT_H +#define TITANIC_TT_TITLE_SCRIPT_H + +#include "titanic/true_talk/tt_script_base.h" + +namespace Titanic { + +class TTTitleScript : public TTScriptBase { +public: + +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_TITLE_SCRIPT_H */ -- cgit v1.2.3 From 4d22064997b286fdf6eb179c710f2bd0ae539943 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 5 May 2016 23:33:26 -0400 Subject: TITANIC: Beginnings of script handler --- engines/titanic/module.mk | 2 +- engines/titanic/true_talk/script_handler.cpp | 37 ++++++++++++++++++++ engines/titanic/true_talk/script_handler.h | 47 ++++++++++++++++++++++++++ engines/titanic/true_talk/title_engine.cpp | 4 +-- engines/titanic/true_talk/title_engine.h | 4 +-- engines/titanic/true_talk/title_engine_sub.cpp | 32 ------------------ engines/titanic/true_talk/title_engine_sub.h | 37 -------------------- 7 files changed, 89 insertions(+), 74 deletions(-) create mode 100644 engines/titanic/true_talk/script_handler.cpp create mode 100644 engines/titanic/true_talk/script_handler.h delete mode 100644 engines/titanic/true_talk/title_engine_sub.cpp delete mode 100644 engines/titanic/true_talk/title_engine_sub.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 10698cfc3b..df8f0534f4 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -457,7 +457,7 @@ MODULE_OBJS := \ true_talk/parrot_script.o \ true_talk/succubus_script.o \ true_talk/title_engine.o \ - true_talk/title_engine_sub.o \ + true_talk/script_handler.o \ true_talk/true_talk_manager.o \ true_talk/tt_script_base.o \ true_talk/tt_room_script.o \ diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp new file mode 100644 index 0000000000..de101214bf --- /dev/null +++ b/engines/titanic/true_talk/script_handler.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/true_talk/script_handler.h" + +namespace Titanic { + +/*------------------------------------------------------------------------*/ + +CScriptHandler::CScriptHandler(CTitleEngine *owner, int val1, int val2) { +} + +void CScriptHandler::setup(TTNamedScript *npcScript, TTRoomScript *roomScript, uint charId) { + +} + + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h new file mode 100644 index 0000000000..69c1c9486a --- /dev/null +++ b/engines/titanic/true_talk/script_handler.h @@ -0,0 +1,47 @@ +/* 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. + * + */ + +#ifndef TITANIC_SCRIPT_HANDLER_H +#define TITANIC_SCRIPT_HANDLER_H + +#include "titanic/true_talk/tt_named_script.h" +#include "titanic/true_talk/tt_room_script.h" + +namespace Titanic { + +class CTitleEngine; + +class CScriptHandler { +private: + CTitleEngine *_owner; +public: + CScriptHandler(CTitleEngine *owner, int val1, int val2); + + /** + * Set the character and room + */ + void setup(TTNamedScript *npcScript, TTRoomScript *roomScript, uint charId); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SCRIPT_HANDLER_H */ diff --git a/engines/titanic/true_talk/title_engine.cpp b/engines/titanic/true_talk/title_engine.cpp index adc74feff8..d5015b430c 100644 --- a/engines/titanic/true_talk/title_engine.cpp +++ b/engines/titanic/true_talk/title_engine.cpp @@ -24,12 +24,12 @@ namespace Titanic { -CTitleEngine::CTitleEngine() : _script(nullptr), _sub(nullptr) { +CTitleEngine::CTitleEngine() : _script(nullptr), _handler(nullptr) { } CTitleEngine::~CTitleEngine() { delete _script; - delete _sub; + delete _handler; } void CTitleEngine::setup(int val1, int val2) { diff --git a/engines/titanic/true_talk/title_engine.h b/engines/titanic/true_talk/title_engine.h index 71b0947012..8d32067616 100644 --- a/engines/titanic/true_talk/title_engine.h +++ b/engines/titanic/true_talk/title_engine.h @@ -26,14 +26,14 @@ #include "common/stream.h" #include "common/winexe_pe.h" #include "titanic/support/string.h" -#include "titanic/true_talk/title_engine_sub.h" +#include "titanic/true_talk/script_handler.h" #include "titanic/true_talk/tt_script_base.h" namespace Titanic { class CTitleEngine { protected: - CTitleEngineSub *_sub; + CScriptHandler *_handler; TTScriptBase *_script; public: CTitleEngine(); diff --git a/engines/titanic/true_talk/title_engine_sub.cpp b/engines/titanic/true_talk/title_engine_sub.cpp deleted file mode 100644 index f7e1f28d1d..0000000000 --- a/engines/titanic/true_talk/title_engine_sub.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 "titanic/true_talk/title_engine_sub.h" - -namespace Titanic { - -/*------------------------------------------------------------------------*/ - -CTitleEngineSub::CTitleEngineSub(CTitleEngine *owner, int val1, int val2) { -} - -} // End of namespace Titanic diff --git a/engines/titanic/true_talk/title_engine_sub.h b/engines/titanic/true_talk/title_engine_sub.h deleted file mode 100644 index 050f041bf2..0000000000 --- a/engines/titanic/true_talk/title_engine_sub.h +++ /dev/null @@ -1,37 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_TITLE_ENGINE_SUB_H -#define TITANIC_TITLE_ENGINE_SUB_H - -namespace Titanic { - -class CTitleEngine; - -class CTitleEngineSub { -public: - CTitleEngineSub(CTitleEngine *owner, int val1, int val2); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_TITLE_ENGINE_SUB_H */ -- cgit v1.2.3 From 2a2eaebdc294a7958260ed40d48fef25e1396355 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 6 May 2016 18:26:44 -0400 Subject: TITANIC: Implemented CCharacter message handlers --- engines/titanic/npcs/character.cpp | 29 +++++++++++++++++++++++++++++ engines/titanic/npcs/character.h | 4 ++++ 2 files changed, 33 insertions(+) diff --git a/engines/titanic/npcs/character.cpp b/engines/titanic/npcs/character.cpp index b8112ce56b..df905d98b3 100644 --- a/engines/titanic/npcs/character.cpp +++ b/engines/titanic/npcs/character.cpp @@ -24,6 +24,12 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CCharacter, CGameObject) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(TurnOn) + ON_MESSAGE(TurnOff) +END_MESSAGE_MAP() + CCharacter::CCharacter() : CGameObject(), _fieldBC(0), _fieldC0(0), _fieldC4(1) { } @@ -47,4 +53,27 @@ void CCharacter::load(SimpleFile *file) { CGameObject::load(file); } +bool CCharacter::LeaveViewMsg(CLeaveViewMsg *msg) { + CTurnOff offMsg; + offMsg.execute(this); + + return true; +} + +bool CCharacter::TurnOn(CTurnOn *msg) { + if (!_fieldC4) + _fieldC4 = 1; + + return true; +} + +bool CCharacter::TurnOff(CTurnOff *msg) { + CString charName = getName(); + if (charName == "Deskbot" || charName == "Barbot" || charName == "SuccUBus") { + _fieldC4 = 0; + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/npcs/character.h b/engines/titanic/npcs/character.h index 2fb83e9288..c0cc8ff65f 100644 --- a/engines/titanic/npcs/character.h +++ b/engines/titanic/npcs/character.h @@ -28,6 +28,10 @@ namespace Titanic { class CCharacter : public CGameObject { + DECLARE_MESSAGE_MAP + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool TurnOn(CTurnOn *msg); + bool TurnOff(CTurnOff *msg); protected: int _fieldBC; int _fieldC0; -- cgit v1.2.3 From 82299474029d0568c3de0bcbcc485ad9e14cf7dd Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 6 May 2016 20:00:00 -0400 Subject: TITANIC: In progress message handlers for CTrueTalkNPC --- engines/titanic/npcs/parrot.cpp | 12 +-- engines/titanic/npcs/true_talk_npc.cpp | 141 ++++++++++++++++++++++++++++++--- engines/titanic/npcs/true_talk_npc.h | 28 ++++++- 3 files changed, 160 insertions(+), 21 deletions(-) diff --git a/engines/titanic/npcs/parrot.cpp b/engines/titanic/npcs/parrot.cpp index c350079f76..a4cfa0872b 100644 --- a/engines/titanic/npcs/parrot.cpp +++ b/engines/titanic/npcs/parrot.cpp @@ -88,15 +88,15 @@ CParrot::CParrot() : CTrueTalkNPC() { _field1E8 = 0; _field1EC = 30; - _string1 = "z454.dlg"; - _fieldD4 = 0x13880; + _assetName = "z454.dlg"; + _assetNumber = 0x13880; } void CParrot::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldD4, indent); + file->writeNumberLine(_assetNumber, indent); - file->writeQuotedLine(_string1, indent); + file->writeQuotedLine(_assetName, indent); file->writeNumberLine(_field108, indent); file->writeNumberLine(_v1, indent); file->writeNumberLine(_v2, indent); @@ -118,9 +118,9 @@ void CParrot::save(SimpleFile *file, int indent) const { void CParrot::load(SimpleFile *file) { file->readNumber(); - _fieldD4 = file->readNumber(); + _assetNumber = file->readNumber(); - _string1 = file->readString(); + _assetName = file->readString(); _field108 = file->readNumber(); _v1 = file->readNumber(); _v2 = file->readNumber(); diff --git a/engines/titanic/npcs/true_talk_npc.cpp b/engines/titanic/npcs/true_talk_npc.cpp index 924ea5657c..72b3cf2537 100644 --- a/engines/titanic/npcs/true_talk_npc.cpp +++ b/engines/titanic/npcs/true_talk_npc.cpp @@ -21,25 +21,39 @@ */ #include "titanic/npcs/true_talk_npc.h" +#include "titanic/core/view_item.h" +#include "titanic/titanic.h" namespace Titanic { -CTrueTalkNPC::CTrueTalkNPC() : _string1("z451.dlg"), - _fieldD4(0x11170), _fieldE4(0), _fieldE8(0), _fieldEC(0), _fieldF0(0), - _fieldF4(0), _fieldF8(0), _fieldFC(0), _field100(0), _field104(0) { +BEGIN_MESSAGE_MAP(CTrueTalkNPC, CCharacter) + ON_MESSAGE(TextInputMsg) + ON_MESSAGE(TrueTalkGetAssetDetailsMsg) + ON_MESSAGE(DismissBotMsg) + ON_MESSAGE(TrueTalkNotifySpeechStartedMsg) + ON_MESSAGE(TrueTalkNotifySpeechEndedMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(NPCQueueIdleAnimMsg) + ON_MESSAGE(TimerMsg) + ON_MESSAGE(NPCPlayAnimationMsg) +END_MESSAGE_MAP() + +CTrueTalkNPC::CTrueTalkNPC() : _assetName("z451.dlg"), + _assetNumber(0x11170), _fieldE4(0), _npcFlags(0), _fieldEC(0), _fieldF0(0), + _fieldF4(0), _fieldF8(0), _speechTimerId(0), _field100(0), _field104(0) { } void CTrueTalkNPC::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldD4, indent); - file->writeQuotedLine(_string1, indent); + file->writeNumberLine(_assetNumber, indent); + file->writeQuotedLine(_assetName, indent); file->writeNumberLine(_fieldE4, indent); - file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_npcFlags, indent); file->writeNumberLine(_fieldEC, indent); file->writeNumberLine(_fieldF0, indent); file->writeNumberLine(_fieldF4, indent); file->writeNumberLine(_fieldF8, indent); - file->writeNumberLine(_fieldFC, indent); + file->writeNumberLine(_speechTimerId, indent); file->writeNumberLine(_field100, indent); file->writeNumberLine(_field104, indent); @@ -48,19 +62,124 @@ void CTrueTalkNPC::save(SimpleFile *file, int indent) const { void CTrueTalkNPC::load(SimpleFile *file) { file->readNumber(); - _fieldD4 = file->readNumber(); - _string1 = file->readString(); + _assetNumber = file->readNumber(); + _assetName = file->readString(); _fieldE4 = file->readNumber(); - _fieldE8 = file->readNumber(); + _npcFlags = file->readNumber(); _fieldEC = file->readNumber(); _fieldF0 = file->readNumber(); _fieldF4 = file->readNumber(); _fieldF8 = file->readNumber(); - _fieldFC = file->readNumber(); + _speechTimerId = file->readNumber(); _field100 = file->readNumber(); _field104 = file->readNumber(); CCharacter::load(file); } +bool CTrueTalkNPC::TextInputMsg(CTextInputMsg *msg) { + processInput(msg, _field104 ? findView() : nullptr); + return true; +} + +bool CTrueTalkNPC::TrueTalkGetAssetDetailsMsg(CTrueTalkGetAssetDetailsMsg *msg) { + msg->_filename = _assetName; + msg->_numValue = _assetNumber; + return true; +} + +bool CTrueTalkNPC::DismissBotMsg(CDismissBotMsg *msg) { + performAction(1, 0); + return true; +} + +bool CTrueTalkNPC::TrueTalkNotifySpeechStartedMsg(CTrueTalkNotifySpeechStartedMsg *msg) { + _npcFlags |= NPCFLAG_SPEAKING; + ++_field100; + + if (!(_npcFlags & NPCFLAG_8)) { + if (_speechTimerId) + stopTimer(_speechTimerId); + + _fieldEC = msg->_value1; + _fieldF0 = g_vm->_events->getTicksCount(); + + if (hasActiveMovie() || (_npcFlags & NPCFLAG_2)) { + _npcFlags &= ~NPCFLAG_2; + stopMovie(); + + CNPCPlayTalkingAnimationMsg msg1(_fieldEC, 0, 0); + msg1.execute(this); + + if (msg1._value3) { + CNPCPlayAnimationMsg msg2(msg1._value3, msg1._value1); + msg2.execute(this); + } + } + } + + return true; +} + +bool CTrueTalkNPC::TrueTalkNotifySpeechEndedMsg(CTrueTalkNotifySpeechEndedMsg *msg) { + _npcFlags &= ~NPCFLAG_SPEAKING; + --_field100; + _fieldEC = 0; + + if (!(_npcFlags & NPCFLAG_8)) { + CNPCPlayTalkingAnimationMsg msg1(0, 2, 0); + msg1.execute(this); + CNPCQueueIdleAnimMsg msg2; + msg2.execute(this); + } + + return true; +} + +bool CTrueTalkNPC::MovieEndMsg(CMovieEndMsg *msg) { + if (_npcFlags & NPCFLAG_2) { + _npcFlags &= ~NPCFLAG_2; + CNPCQueueIdleAnimMsg idleMsg; + idleMsg.execute(this); + return true; + } else if (!(_npcFlags & NPCFLAG_SPEAKING)) { + return false; + } + + int diff = g_vm->_events->getTicksCount() - _fieldF0; + int ticks = MAX((int)_fieldEC - diff, 0); + CNPCPlayTalkingAnimationMsg msg1(ticks, ticks > 1000 ? 2 : 1, 0); + msg1.execute(this); + + if (msg1._value3) { + CNPCPlayAnimationMsg msg2(msg1._value3, msg1._value1); + msg2.execute(this); + } + + return true; +} + +bool CTrueTalkNPC::NPCQueueIdleAnimMsg(CNPCQueueIdleAnimMsg *msg) { + // TODO + return false; +} + +bool CTrueTalkNPC::TimerMsg(CTimerMsg *msg) { + // TODO + return false; +} + +bool CTrueTalkNPC::NPCPlayAnimationMsg(CNPCPlayAnimationMsg *msg) { + // TODO + return false; +} + +void CTrueTalkNPC::processInput(CTextInputMsg *msg, CViewItem *view) { + // TODO +} + +void CTrueTalkNPC::performAction(int val1, int val2) { + // TODO +} + } // End of namespace Titanic diff --git a/engines/titanic/npcs/true_talk_npc.h b/engines/titanic/npcs/true_talk_npc.h index 9546f18e0c..74bf044a57 100644 --- a/engines/titanic/npcs/true_talk_npc.h +++ b/engines/titanic/npcs/true_talk_npc.h @@ -24,22 +24,42 @@ #define TITANIC_TRUE_TALK_NPC_H #include "titanic/npcs/character.h" +#include "titanic/messages/messages.h" namespace Titanic { +enum NpcFlag { + NPCFLAG_SPEAKING = 1, NPCFLAG_2 = 2, NPCFLAG_4 = 4, NPCFLAG_8 = 8 +}; + +class CViewItem; + class CTrueTalkNPC : public CCharacter { + DECLARE_MESSAGE_MAP + bool TextInputMsg(CTextInputMsg *msg); + bool TrueTalkGetAssetDetailsMsg(CTrueTalkGetAssetDetailsMsg *msg); + bool DismissBotMsg(CDismissBotMsg *msg); + bool TrueTalkNotifySpeechStartedMsg(CTrueTalkNotifySpeechStartedMsg *msg); + bool TrueTalkNotifySpeechEndedMsg(CTrueTalkNotifySpeechEndedMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool NPCQueueIdleAnimMsg(CNPCQueueIdleAnimMsg *msg); + bool TimerMsg(CTimerMsg *msg); + bool NPCPlayAnimationMsg(CNPCPlayAnimationMsg *msg); protected: - int _fieldD4; - CString _string1; + int _assetNumber; + CString _assetName; int _fieldE4; - int _fieldE8; + uint _npcFlags; int _fieldEC; int _fieldF0; int _fieldF4; int _fieldF8; - int _fieldFC; + int _speechTimerId; int _field100; int _field104; +protected: + void processInput(CTextInputMsg *msg, CViewItem *view); + void performAction(int val1, int val2); public: CLASSDEF CTrueTalkNPC(); -- cgit v1.2.3 From 7396781cd44c2ec340308e5ad9de9cefc0ef3eeb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 6 May 2016 20:53:50 -0400 Subject: TITANIC: Implemented more CTrueTalkNPC message handlers --- engines/titanic/messages/messages.h | 6 +++--- engines/titanic/npcs/true_talk_npc.cpp | 37 ++++++++++++++++++++++++++++------ engines/titanic/npcs/true_talk_npc.h | 5 +++++ 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index fb3169cc71..f9589ce76a 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -269,9 +269,9 @@ MESSAGE2(CMovieFrameMsg, int, value1, 0, int, value2, 0); MESSAGE0(CMusicHasStartedMsg); MESSAGE0(CMusicHasStoppedMsg); MESSAGE0(CMusicSettingChangedMsg); -MESSAGE2(CNPCPlayAnimationMsg, int, value1, 0, int, value2, 0); -MESSAGE1(CNPCPlayIdleAnimationMsg, int, value, 0); -MESSAGE3(CNPCPlayTalkingAnimationMsg, int, value1, 0, int, value2, 0, int, value3, 0); +MESSAGE2(CNPCPlayAnimationMsg, void *, data, 0, int, value2, 0); +MESSAGE1(CNPCPlayIdleAnimationMsg, void *, value, 0); +MESSAGE3(CNPCPlayTalkingAnimationMsg, int, value1, 0, int, value2, 0, void *, value3, nullptr); MESSAGE0(CNPCQueueIdleAnimMsg); MESSAGE1(CNutPuzzleMsg, CString, value, ""); MESSAGE1(COnSummonBotMsg, int, value, 0); diff --git a/engines/titanic/npcs/true_talk_npc.cpp b/engines/titanic/npcs/true_talk_npc.cpp index 72b3cf2537..183c189f8a 100644 --- a/engines/titanic/npcs/true_talk_npc.cpp +++ b/engines/titanic/npcs/true_talk_npc.cpp @@ -160,18 +160,35 @@ bool CTrueTalkNPC::MovieEndMsg(CMovieEndMsg *msg) { } bool CTrueTalkNPC::NPCQueueIdleAnimMsg(CNPCQueueIdleAnimMsg *msg) { - // TODO - return false; + int rndVal = g_vm->getRandomNumber(_fieldF8 - 1) - (_fieldF8 / 2); + _speechTimerId = startAnimTimer("NPCIdleAnim", _fieldF4 + rndVal, 0); + + return true; } bool CTrueTalkNPC::TimerMsg(CTimerMsg *msg) { - // TODO - return false; + if (_npcFlags & NPCFLAG_4) { + if (_field100 > 0) + return false; + + CNPCPlayIdleAnimationMsg idleMsg; + if (idleMsg.execute(this)) { + if (idleMsg._value) { + CNPCPlayAnimationMsg animMsg(idleMsg._value, 0); + animMsg.execute(this); + } + + _npcFlags &= ~NPCFLAG_2; + } + } + + _speechTimerId = 0; + return true; } bool CTrueTalkNPC::NPCPlayAnimationMsg(CNPCPlayAnimationMsg *msg) { - // TODO - return false; + warning("CTrueTalkNPC::NPCPlayAnimationMsg"); + return true; } void CTrueTalkNPC::processInput(CTextInputMsg *msg, CViewItem *view) { @@ -182,4 +199,12 @@ void CTrueTalkNPC::performAction(int val1, int val2) { // TODO } +int CTrueTalkNPC::startAnimTimer(const CString &action, uint firstDuration, uint duration) { + CTimeEventInfo *timer = new CTimeEventInfo(g_vm->_events->getTicksCount(), + duration > 0, firstDuration, duration, this, 0, action); + getGameManager()->addTimer(timer); + + return timer->_id; +} + } // End of namespace Titanic diff --git a/engines/titanic/npcs/true_talk_npc.h b/engines/titanic/npcs/true_talk_npc.h index 74bf044a57..ad436a5582 100644 --- a/engines/titanic/npcs/true_talk_npc.h +++ b/engines/titanic/npcs/true_talk_npc.h @@ -60,6 +60,11 @@ protected: protected: void processInput(CTextInputMsg *msg, CViewItem *view); void performAction(int val1, int val2); + + /** + * Start an animation timer + */ + int startAnimTimer(const CString &action, uint firstDuration, uint duration); public: CLASSDEF CTrueTalkNPC(); -- cgit v1.2.3 From 1e42f6ffed4c1d187863b548c708b42d611aab0e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 6 May 2016 21:27:50 -0400 Subject: TITANIC: Beginnings of input line processing --- engines/titanic/messages/messages.h | 2 +- engines/titanic/npcs/true_talk_npc.cpp | 4 +++- engines/titanic/true_talk/script_handler.cpp | 6 +++++- engines/titanic/true_talk/script_handler.h | 4 ++++ engines/titanic/true_talk/title_engine.cpp | 4 ++-- engines/titanic/true_talk/title_engine.h | 3 ++- engines/titanic/true_talk/true_talk_manager.cpp | 22 ++++++++++++++++++++++ engines/titanic/true_talk/true_talk_manager.h | 9 +++++++++ engines/titanic/true_talk/tt_string.h | 1 + 9 files changed, 49 insertions(+), 6 deletions(-) diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index f9589ce76a..aeb82d5448 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -269,7 +269,7 @@ MESSAGE2(CMovieFrameMsg, int, value1, 0, int, value2, 0); MESSAGE0(CMusicHasStartedMsg); MESSAGE0(CMusicHasStoppedMsg); MESSAGE0(CMusicSettingChangedMsg); -MESSAGE2(CNPCPlayAnimationMsg, void *, data, 0, int, value2, 0); +MESSAGE2(CNPCPlayAnimationMsg, void *, data, nullptr, int, value2, 0); MESSAGE1(CNPCPlayIdleAnimationMsg, void *, value, 0); MESSAGE3(CNPCPlayTalkingAnimationMsg, int, value1, 0, int, value2, 0, void *, value3, nullptr); MESSAGE0(CNPCQueueIdleAnimMsg); diff --git a/engines/titanic/npcs/true_talk_npc.cpp b/engines/titanic/npcs/true_talk_npc.cpp index 183c189f8a..bc562efac4 100644 --- a/engines/titanic/npcs/true_talk_npc.cpp +++ b/engines/titanic/npcs/true_talk_npc.cpp @@ -192,7 +192,9 @@ bool CTrueTalkNPC::NPCPlayAnimationMsg(CNPCPlayAnimationMsg *msg) { } void CTrueTalkNPC::processInput(CTextInputMsg *msg, CViewItem *view) { - // TODO + CTrueTalkManager *talkManager = getGameManager()->getTalkManager(); + if (talkManager) + talkManager->processInput(this, msg, view); } void CTrueTalkNPC::performAction(int val1, int val2) { diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index de101214bf..eb7979e1e5 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -30,8 +30,12 @@ CScriptHandler::CScriptHandler(CTitleEngine *owner, int val1, int val2) { } void CScriptHandler::setup(TTNamedScript *npcScript, TTRoomScript *roomScript, uint charId) { - + // TODO } +void CScriptHandler::processInput(TTNamedScript *npcScript, TTRoomScript *roomScript, + const TTString &line) { + // TODO +} } // End of namespace Titanic diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index 69c1c9486a..1959468ed0 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -25,6 +25,7 @@ #include "titanic/true_talk/tt_named_script.h" #include "titanic/true_talk/tt_room_script.h" +#include "titanic/true_talk/tt_string.h" namespace Titanic { @@ -40,6 +41,9 @@ public: * Set the character and room */ void setup(TTNamedScript *npcScript, TTRoomScript *roomScript, uint charId); + + void processInput(TTNamedScript *npcScript, TTRoomScript *roomScript, + const TTString &line); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/title_engine.cpp b/engines/titanic/true_talk/title_engine.cpp index d5015b430c..528c4b12b0 100644 --- a/engines/titanic/true_talk/title_engine.cpp +++ b/engines/titanic/true_talk/title_engine.cpp @@ -24,12 +24,12 @@ namespace Titanic { -CTitleEngine::CTitleEngine() : _script(nullptr), _handler(nullptr) { +CTitleEngine::CTitleEngine() : _script(nullptr), _scriptHandler(nullptr) { } CTitleEngine::~CTitleEngine() { delete _script; - delete _handler; + delete _scriptHandler; } void CTitleEngine::setup(int val1, int val2) { diff --git a/engines/titanic/true_talk/title_engine.h b/engines/titanic/true_talk/title_engine.h index 8d32067616..e9bc6249eb 100644 --- a/engines/titanic/true_talk/title_engine.h +++ b/engines/titanic/true_talk/title_engine.h @@ -33,8 +33,9 @@ namespace Titanic { class CTitleEngine { protected: - CScriptHandler *_handler; TTScriptBase *_script; +public: + CScriptHandler *_scriptHandler; public: CTitleEngine(); ~CTitleEngine(); diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 091e3f8e48..dc93bf438b 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -286,4 +286,26 @@ void CTrueTalkManager::loadAssets(CTrueTalkNPC *npc, int charId) { } } +void CTrueTalkManager::processInput(CTrueTalkNPC *npc, CTextInputMsg *msg, CViewItem *view) { + TTNamedScript *npcScript = getNpcScript(npc); + TTRoomScript *roomScript = getRoomScript(); + _titleEngine.reset(); + + if (npcScript && roomScript) { + _currentNPC = npc; + _titleEngine._scriptHandler->processInput(npcScript, roomScript, + TTString(msg->_input)); + _currentNPC = nullptr; + + loadAssets(npc, npcScript->charId()); + setView(npcScript, roomScript, view); + } + + _currentNPC = nullptr; +} + +void CTrueTalkManager::setView(TTNamedScript *npcScript, TTRoomScript *roomScript, CViewItem *view) { + warning("TODO: CTrueTalkManager::setView"); +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index d2bba4b4ba..3c24ade6cb 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -23,6 +23,7 @@ #ifndef TITANIC_TRUE_TALK_MANAGER_H #define TITANIC_TRUE_TALK_MANAGER_H +#include "titanic/messages/messages.h" #include "titanic/support/simple_file.h" #include "titanic/true_talk/dialogue_file.h" #include "titanic/true_talk/title_engine.h" @@ -32,6 +33,7 @@ namespace Titanic { class CGameManager; class CTreeItem; +class CViewItem; class CTrueTalkNPC; class CTrueTalkManager { @@ -77,6 +79,8 @@ private: * Loads assets for the current character, if it's changed */ void loadAssets(CTrueTalkNPC *npc, int charId); + + void setView(TTNamedScript *npcScript, TTRoomScript *roomScript, CViewItem *view); public: static int _v1; static int _v2; @@ -149,6 +153,11 @@ public: * Return a TrueTalk talker/script */ TTNamedScript *getTalker(const CString &name) const; + + /** + * Process player's input + */ + void processInput(CTrueTalkNPC *npc, CTextInputMsg *msg, CViewItem *view); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index 60fdde0ff5..d593553f5c 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -33,6 +33,7 @@ public: public: TTString() : CString(), _status(0) {} TTString(const char *str) : CString(str), _status(0) {} + TTString(const CString &str) : CString(str), _status(0) {} virtual ~TTString() {} bool isValid() const { return !_status; } -- cgit v1.2.3 From b138134192bda77a4c1c941e194dc9d353aae256 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 6 May 2016 21:40:34 -0400 Subject: TITANIC: Finished CTrueTalkManager start method --- engines/titanic/carry/carry_parrot.cpp | 4 ++-- engines/titanic/core/game_object.cpp | 8 ++++---- engines/titanic/core/game_object.h | 4 ++-- engines/titanic/game/computer_screen.cpp | 4 ++-- engines/titanic/true_talk/true_talk_manager.cpp | 6 +++--- engines/titanic/true_talk/true_talk_manager.h | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/engines/titanic/carry/carry_parrot.cpp b/engines/titanic/carry/carry_parrot.cpp index aa75688fab..d164e2ee46 100644 --- a/engines/titanic/carry/carry_parrot.cpp +++ b/engines/titanic/carry/carry_parrot.cpp @@ -169,7 +169,7 @@ bool CCarryParrot::PassOnDragStartMsg(CPassOnDragStartMsg *msg) { CTrueTalkNPC *npc = static_cast(getRoot()->findByName(_string6)); if (npc) - startTalking(npc, 0x446BF, 0); + startTalking(npc, 0x446BF); _fieldE0 = 0; playSound("z#475.wav", 100, 0, 0); @@ -200,7 +200,7 @@ bool CCarryParrot::ActMsg(CActMsg *msg) { if (msg->_action == "FreeParrot" && (CParrot::_v4 == 4 || CParrot::_v4 == 1)) { CTrueTalkNPC *npc = static_cast(getRoot()->findByName(_string6)); if (npc) - startTalking(npc, 0x446BF, 0); + startTalking(npc, 0x446BF); setVisible(false); _fieldE0 = 0; diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index ff7e2288f8..7cfcd338f6 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -707,17 +707,17 @@ void CGameObject::incState38() { getGameManager()->_gameState.inc38(); } -void CGameObject::startTalking(const CString &npcName, int val2, int val3) { +void CGameObject::startTalking(const CString &npcName, uint id, CViewItem *view) { CTrueTalkNPC *npc = static_cast(getRoot()->findByName(npcName)); - startTalking(npc, val2, val3); + startTalking(npc, id, view); } -void CGameObject::startTalking(CTrueTalkNPC *npc, int val2, int val3) { +void CGameObject::startTalking(CTrueTalkNPC *npc, uint id, CViewItem *view) { CGameManager *gameManager = getGameManager(); if (gameManager) { CTrueTalkManager *talkManager = gameManager->getTalkManager(); if (talkManager) - talkManager->start(npc, val2, val3); + talkManager->start(npc, id, view); } } diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 97d3ca45eb..4d2dca6860 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -220,12 +220,12 @@ protected: /** * Start a conversation with the NPC */ - void startTalking(const CString &name, int val2, int val3); + void startTalking(const CString &name, uint id, CViewItem *view = nullptr); /** * Start a conversation with the NPC */ - void startTalking(CTrueTalkNPC *npc, int val2, int val3); + void startTalking(CTrueTalkNPC *npc, uint id, CViewItem *view = nullptr); /** * Load the surface diff --git a/engines/titanic/game/computer_screen.cpp b/engines/titanic/game/computer_screen.cpp index 846858be0e..9d15ea903f 100644 --- a/engines/titanic/game/computer_screen.cpp +++ b/engines/titanic/game/computer_screen.cpp @@ -114,11 +114,11 @@ bool CComputerScreen::TimerMsg(CTimerMsg *msg) { playSound("y#662.wav"); soundFn3(handle, 10, 2); playClip(392, 450); - startTalking("Doorbot", 0x3611A, 0); + startTalking("Doorbot", 0x3611A); sleep(8000); playClip(450, 492); - startTalking("Doorbot", 0x36121, 0); + startTalking("Doorbot", 0x36121); playClip(492, 522); soundFn3(handle, 30, 2); diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index dc93bf438b..58d92539a5 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -201,7 +201,7 @@ void CTrueTalkManager::update2() { //warning("CTrueTalkManager::update2"); } -void CTrueTalkManager::start(CTrueTalkNPC *npc, int val2, int val3) { +void CTrueTalkManager::start(CTrueTalkNPC *npc, uint id, CViewItem *view) { TTNamedScript *npcScript = getNpcScript(npc); TTRoomScript *roomScript = getRoomScript(); @@ -210,10 +210,10 @@ void CTrueTalkManager::start(CTrueTalkNPC *npc, int val2, int val3) { loadAssets(npc, charId); _currentNPC = npc; - warning("TODO: CTrueTalkManager::start"); + _titleEngine._scriptHandler->setup(npcScript, roomScript, charId); _currentNPC = nullptr; - //TODO: More + setView(npcScript, roomScript, view); } TTNamedScript *CTrueTalkManager::getTalker(const CString &name) const { diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index 3c24ade6cb..c3c25a33e7 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -147,7 +147,7 @@ public: /** * Start a TrueTalk conversation */ - void start(CTrueTalkNPC *npc, int val2, int val3); + void start(CTrueTalkNPC *npc, uint id, CViewItem *view); /** * Return a TrueTalk talker/script -- cgit v1.2.3 From 695549585e4fb0578d6add32ac20d19be2c59a0b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 6 May 2016 23:15:56 -0400 Subject: TITANIC: Implemented CDialogueFile addToCache --- engines/titanic/true_talk/dialogue_file.cpp | 45 +++++++++++++++++++++++++---- engines/titanic/true_talk/dialogue_file.h | 32 ++++++++++++++------ 2 files changed, 63 insertions(+), 14 deletions(-) diff --git a/engines/titanic/true_talk/dialogue_file.cpp b/engines/titanic/true_talk/dialogue_file.cpp index 341d973f36..b52bf2a885 100644 --- a/engines/titanic/true_talk/dialogue_file.cpp +++ b/engines/titanic/true_talk/dialogue_file.cpp @@ -24,20 +24,25 @@ namespace Titanic { +void DialogueFileIndexEntry::load(Common::SeekableReadStream &s) { + _v1 = s.readUint32LE(); + _offset = s.readUint32LE(); +} + +/*------------------------------------------------------------------------*/ + CDialogueFile::CDialogueFile(const CString &filename, uint count) { if (!_file.open(filename)) error("Could not locate dialogue file - %s", filename.c_str()); - _data1.resize(count); + _cache.resize(count); _file.readUint32LE(); // Skip over file Id _entries.resize(_file.readUint32LE()); // Read in the entries - for (uint idx = 0; idx < _entries.size(); ++idx) { - _entries[idx].v1 = _file.readUint32LE(); - _entries[idx].v2 = _file.readUint32LE(); - } + for (uint idx = 0; idx < _entries.size(); ++idx) + _entries[idx].load(_file); } CDialogueFile::~CDialogueFile() { @@ -48,4 +53,34 @@ void CDialogueFile::clear() { _file.close(); } +DialogueFileCacheEntry *CDialogueFile::addToCache(int index) { + if (_entries.size() == 0 || index < 0 || index >= (int)_entries.size() + || !_entries[index]._v1) + return nullptr; + + // Scan cache for a free slot + uint cacheIndex = 0; + while (cacheIndex < _cache.size() && !_cache[cacheIndex]._active) + ++cacheIndex; + if (cacheIndex == _cache.size()) + return nullptr; + + DialogueFileIndexEntry &entry = _entries[index]; + DialogueFileCacheEntry &cacheEntry = _cache[cacheIndex]; + + cacheEntry._active = true; + cacheEntry._offset = entry._offset; + cacheEntry.v3 = 0; + cacheEntry._entryPtr = &entry; + + // Figure out the size of the entry + if (index == ((int)_entries.size() - 1)) { + cacheEntry._size = _file.size() - entry._offset; + } else { + cacheEntry._size = _entries[index + 1]._offset - entry._offset; + } + + return &cacheEntry; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/dialogue_file.h b/engines/titanic/true_talk/dialogue_file.h index 00bacacbd2..8d40045686 100644 --- a/engines/titanic/true_talk/dialogue_file.h +++ b/engines/titanic/true_talk/dialogue_file.h @@ -28,18 +28,27 @@ namespace Titanic { +struct DialogueFileIndexEntry { + uint _v1, _offset; + + DialogueFileIndexEntry() : _v1(0), _offset(0) {} + void load(Common::SeekableReadStream &s); +}; + +struct DialogueFileCacheEntry { + bool _active; + uint _offset, v3, _size; + DialogueFileIndexEntry *_entryPtr; + + DialogueFileCacheEntry() : _active(false), _offset(0), _size(0), + v3(0), _entryPtr(nullptr) {} +}; + class CDialogueFile { - struct CDialogueFileEntry { - uint v1; - uint v2; - }; - struct EntryRec { - uint v1, v2, v3, v4, v5; - }; private: Common::File _file; - Common::Array _entries; - Common::Array _data1; + Common::Array _entries; + Common::Array _cache; public: CDialogueFile(const CString &filename, uint count); ~CDialogueFile(); @@ -48,6 +57,11 @@ public: * Clear the loaded data */ void clear(); + + /** + * Add a dialogue file entry to the active cache + */ + DialogueFileCacheEntry *addToCache(int index); }; } // End of namespace Titanic -- cgit v1.2.3 From 09002173031558ccda8c05ef4cc1df329d1da6eb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 6 May 2016 23:44:58 -0400 Subject: TITANIC: Implement CDialogueFile read --- engines/titanic/true_talk/dialogue_file.cpp | 19 +++++++++++++++-- engines/titanic/true_talk/dialogue_file.h | 32 +++++++++++++++++++++++++---- 2 files changed, 45 insertions(+), 6 deletions(-) diff --git a/engines/titanic/true_talk/dialogue_file.cpp b/engines/titanic/true_talk/dialogue_file.cpp index b52bf2a885..1d1d789188 100644 --- a/engines/titanic/true_talk/dialogue_file.cpp +++ b/engines/titanic/true_talk/dialogue_file.cpp @@ -55,7 +55,7 @@ void CDialogueFile::clear() { DialogueFileCacheEntry *CDialogueFile::addToCache(int index) { if (_entries.size() == 0 || index < 0 || index >= (int)_entries.size() - || !_entries[index]._v1) + || _cache.empty()) return nullptr; // Scan cache for a free slot @@ -70,7 +70,7 @@ DialogueFileCacheEntry *CDialogueFile::addToCache(int index) { cacheEntry._active = true; cacheEntry._offset = entry._offset; - cacheEntry.v3 = 0; + cacheEntry._bytesRead = 0; cacheEntry._entryPtr = &entry; // Figure out the size of the entry @@ -80,7 +80,22 @@ DialogueFileCacheEntry *CDialogueFile::addToCache(int index) { cacheEntry._size = _entries[index + 1]._offset - entry._offset; } + // Return a pointer to the loaded entry return &cacheEntry; } +bool CDialogueFile::read(DialogueFileCacheEntry *cacheEntry, byte *buffer, size_t bytesToRead) { + // Sanity checks that a valid record is passed, and the size can be read + if (!cacheEntry || !cacheEntry->_active || !bytesToRead + || (cacheEntry->_bytesRead + bytesToRead) > cacheEntry->_size) + return false; + + // Move to the correct position in the file + _file.seek(cacheEntry->_offset + cacheEntry->_bytesRead); + bool result = _file.read(buffer, bytesToRead) == bytesToRead; + cacheEntry->_bytesRead += bytesToRead; + + return result; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/dialogue_file.h b/engines/titanic/true_talk/dialogue_file.h index 8d40045686..5db91d9c4c 100644 --- a/engines/titanic/true_talk/dialogue_file.h +++ b/engines/titanic/true_talk/dialogue_file.h @@ -37,11 +37,16 @@ struct DialogueFileIndexEntry { struct DialogueFileCacheEntry { bool _active; - uint _offset, v3, _size; + uint _offset, _bytesRead, _size; DialogueFileIndexEntry *_entryPtr; - DialogueFileCacheEntry() : _active(false), _offset(0), _size(0), - v3(0), _entryPtr(nullptr) {} + DialogueFileCacheEntry() : _active(false), _offset(0), + _bytesRead(0), _size(0), _entryPtr(nullptr) {} + + /** + * Return the size of a cache entry + */ + int size() const { return _active ? _size : 0; } }; class CDialogueFile { @@ -49,6 +54,11 @@ private: Common::File _file; Common::Array _entries; Common::Array _cache; +private: + /** + * Add a dialogue file entry to the active cache + */ + DialogueFileCacheEntry *addToCache(int index); public: CDialogueFile(const CString &filename, uint count); ~CDialogueFile(); @@ -61,7 +71,21 @@ public: /** * Add a dialogue file entry to the active cache */ - DialogueFileCacheEntry *addToCache(int index); + DialogueFileCacheEntry *addToCacheDouble(int index) { + return addToCache(index * 2); + } + + /** + * Add a dialogue file entry to the active cache + */ + DialogueFileCacheEntry *addToCacheDouble1(int index) { + return addToCache(index * 2 + 1); + } + + /** + * Read data for a resource + */ + bool read(DialogueFileCacheEntry *cacheEntry, byte *buffer, size_t bytesToRead); }; } // End of namespace Titanic -- cgit v1.2.3 From 0692d261eeea7dd9260e00dc6bc43dda963a41d4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 7 May 2016 10:49:56 -0400 Subject: TITANIC: Implement reading dialogue string --- engines/titanic/true_talk/dialogue_file.cpp | 42 +++++++++++-------- engines/titanic/true_talk/dialogue_file.h | 33 ++++++++------- engines/titanic/true_talk/title_engine.cpp | 2 +- engines/titanic/true_talk/title_engine.h | 3 +- engines/titanic/true_talk/true_talk_manager.cpp | 55 ++++++++++++++++++++++--- engines/titanic/true_talk/true_talk_manager.h | 9 +++- 6 files changed, 103 insertions(+), 41 deletions(-) diff --git a/engines/titanic/true_talk/dialogue_file.cpp b/engines/titanic/true_talk/dialogue_file.cpp index 1d1d789188..34eb164779 100644 --- a/engines/titanic/true_talk/dialogue_file.cpp +++ b/engines/titanic/true_talk/dialogue_file.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void DialogueFileIndexEntry::load(Common::SeekableReadStream &s) { +void DialogueIndexEntry::load(Common::SeekableReadStream &s) { _v1 = s.readUint32LE(); _offset = s.readUint32LE(); } @@ -38,11 +38,11 @@ CDialogueFile::CDialogueFile(const CString &filename, uint count) { _cache.resize(count); _file.readUint32LE(); // Skip over file Id - _entries.resize(_file.readUint32LE()); + _index.resize(_file.readUint32LE()); // Read in the entries - for (uint idx = 0; idx < _entries.size(); ++idx) - _entries[idx].load(_file); + for (uint idx = 0; idx < _index.size(); ++idx) + _index[idx].load(_file); } CDialogueFile::~CDialogueFile() { @@ -53,8 +53,8 @@ void CDialogueFile::clear() { _file.close(); } -DialogueFileCacheEntry *CDialogueFile::addToCache(int index) { - if (_entries.size() == 0 || index < 0 || index >= (int)_entries.size() +DialogueResource *CDialogueFile::addToCache(int index) { + if (_index.size() == 0 || index < 0 || index >= (int)_index.size() || _cache.empty()) return nullptr; @@ -65,26 +65,34 @@ DialogueFileCacheEntry *CDialogueFile::addToCache(int index) { if (cacheIndex == _cache.size()) return nullptr; - DialogueFileIndexEntry &entry = _entries[index]; - DialogueFileCacheEntry &cacheEntry = _cache[cacheIndex]; + DialogueIndexEntry &indexEntry = _index[index]; + DialogueResource &res = _cache[cacheIndex]; - cacheEntry._active = true; - cacheEntry._offset = entry._offset; - cacheEntry._bytesRead = 0; - cacheEntry._entryPtr = &entry; + res._active = true; + res._offset = indexEntry._offset; + res._bytesRead = 0; + res._entryPtr = &indexEntry; // Figure out the size of the entry - if (index == ((int)_entries.size() - 1)) { - cacheEntry._size = _file.size() - entry._offset; + if (index == ((int)_index.size() - 1)) { + res._size = _file.size() - indexEntry._offset; } else { - cacheEntry._size = _entries[index + 1]._offset - entry._offset; + res._size = _index[index + 1]._offset - indexEntry._offset; } // Return a pointer to the loaded entry - return &cacheEntry; + return &res; } -bool CDialogueFile::read(DialogueFileCacheEntry *cacheEntry, byte *buffer, size_t bytesToRead) { +bool CDialogueFile::closeEntry(DialogueResource *cacheEntry) { + if (!cacheEntry || !cacheEntry->_active) + return false; + + cacheEntry->_active = false; + return true; +} + +bool CDialogueFile::read(DialogueResource *cacheEntry, byte *buffer, size_t bytesToRead) { // Sanity checks that a valid record is passed, and the size can be read if (!cacheEntry || !cacheEntry->_active || !bytesToRead || (cacheEntry->_bytesRead + bytesToRead) > cacheEntry->_size) diff --git a/engines/titanic/true_talk/dialogue_file.h b/engines/titanic/true_talk/dialogue_file.h index 5db91d9c4c..299d01daa8 100644 --- a/engines/titanic/true_talk/dialogue_file.h +++ b/engines/titanic/true_talk/dialogue_file.h @@ -28,37 +28,37 @@ namespace Titanic { -struct DialogueFileIndexEntry { +struct DialogueIndexEntry { uint _v1, _offset; - DialogueFileIndexEntry() : _v1(0), _offset(0) {} + DialogueIndexEntry() : _v1(0), _offset(0) {} void load(Common::SeekableReadStream &s); }; -struct DialogueFileCacheEntry { +struct DialogueResource { bool _active; uint _offset, _bytesRead, _size; - DialogueFileIndexEntry *_entryPtr; + DialogueIndexEntry *_entryPtr; - DialogueFileCacheEntry() : _active(false), _offset(0), + DialogueResource() : _active(false), _offset(0), _bytesRead(0), _size(0), _entryPtr(nullptr) {} /** * Return the size of a cache entry */ - int size() const { return _active ? _size : 0; } + size_t size() const { return _active ? _size : 0; } }; class CDialogueFile { private: Common::File _file; - Common::Array _entries; - Common::Array _cache; + Common::Array _index; + Common::Array _cache; private: /** * Add a dialogue file entry to the active cache */ - DialogueFileCacheEntry *addToCache(int index); + DialogueResource *addToCache(int index); public: CDialogueFile(const CString &filename, uint count); ~CDialogueFile(); @@ -69,23 +69,28 @@ public: void clear(); /** - * Add a dialogue file entry to the active cache + * Sets up a text entry within the dialogue file for access */ - DialogueFileCacheEntry *addToCacheDouble(int index) { + DialogueResource *openTextEntry(int index) { return addToCache(index * 2); } /** - * Add a dialogue file entry to the active cache + * Sets up a wave (sound) entry within the dialogue file for access */ - DialogueFileCacheEntry *addToCacheDouble1(int index) { + DialogueResource *openWaveEntry(int index) { return addToCache(index * 2 + 1); } + /** + * Removes an entry from the cache + */ + bool closeEntry(DialogueResource *cacheEntry); + /** * Read data for a resource */ - bool read(DialogueFileCacheEntry *cacheEntry, byte *buffer, size_t bytesToRead); + bool read(DialogueResource *cacheEntry, byte *buffer, size_t bytesToRead); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/title_engine.cpp b/engines/titanic/true_talk/title_engine.cpp index 528c4b12b0..5b8e8d9ef9 100644 --- a/engines/titanic/true_talk/title_engine.cpp +++ b/engines/titanic/true_talk/title_engine.cpp @@ -48,7 +48,7 @@ STtitleEngine::~STtitleEngine() { void STtitleEngine::reset() { _field58 = 0; - _array.clear(); + _indexes.clear(); } void STtitleEngine::setup(int val1, int val2) { diff --git a/engines/titanic/true_talk/title_engine.h b/engines/titanic/true_talk/title_engine.h index e9bc6249eb..ab541ec6f8 100644 --- a/engines/titanic/true_talk/title_engine.h +++ b/engines/titanic/true_talk/title_engine.h @@ -69,7 +69,8 @@ private: Common::PEResources _resources; Common::SeekableReadStream *_stream; int _field58; - Common::Array _array; +public: + Common::Array _indexes; Common::Array _data; public: STtitleEngine(); diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 58d92539a5..6552a5db5c 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -44,7 +44,7 @@ CTrueTalkNPC *CTrueTalkManager::_currentNPC; CTrueTalkManager::CTrueTalkManager(CGameManager *owner) : _gameManager(owner), _scripts(&_titleEngine), _currentCharId(0), - _dialogueFile(nullptr), _field14(0) { + _dialogueFile(nullptr), _dialogueIndex(0) { } CTrueTalkManager::~CTrueTalkManager() { @@ -213,7 +213,7 @@ void CTrueTalkManager::start(CTrueTalkNPC *npc, uint id, CViewItem *view) { _titleEngine._scriptHandler->setup(npcScript, roomScript, charId); _currentNPC = nullptr; - setView(npcScript, roomScript, view); + setDialogue(npcScript, roomScript, view); } TTNamedScript *CTrueTalkManager::getTalker(const CString &name) const { @@ -282,7 +282,7 @@ void CTrueTalkManager::loadAssets(CTrueTalkNPC *npc, int charId) { if (!detailsMsg._filename.empty()) { _dialogueFile = new CDialogueFile(detailsMsg._filename, 20); - _field14 = detailsMsg._numValue + 1; + _dialogueIndex = detailsMsg._numValue + 1; } } @@ -298,14 +298,57 @@ void CTrueTalkManager::processInput(CTrueTalkNPC *npc, CTextInputMsg *msg, CView _currentNPC = nullptr; loadAssets(npc, npcScript->charId()); - setView(npcScript, roomScript, view); + setDialogue(npcScript, roomScript, view); } _currentNPC = nullptr; } -void CTrueTalkManager::setView(TTNamedScript *npcScript, TTRoomScript *roomScript, CViewItem *view) { - warning("TODO: CTrueTalkManager::setView"); +void CTrueTalkManager::setDialogue(TTNamedScript *npcScript, TTRoomScript *roomScript, CViewItem *view) { + warning("TODO: CTrueTalkManager::setDialogue"); +} + +#define STRING_BUFFER_SIZE 2048 + +CString CTrueTalkManager::readDialogueString() { + byte buffer[STRING_BUFFER_SIZE]; + CString result; + + for (uint idx = 0; idx < _titleEngine._indexes.size(); ++idx) { + if (idx != 0) + result += " "; + + // Open a text entry from the dialogue file for access + DialogueResource *textRes = _dialogueFile->openTextEntry( + _titleEngine._indexes[idx] - _dialogueIndex); + if (!textRes) + continue; + + size_t entrySize = textRes->size(); + byte *tempBuffer = (entrySize < STRING_BUFFER_SIZE) ? buffer : + new byte[entrySize + 1]; + + _dialogueFile->read(textRes, tempBuffer, entrySize); + buffer[entrySize] = '\0'; + + // Close the resource + _dialogueFile->closeEntry(textRes); + + // Strip off any non-printable characters + for (byte *p = buffer; *p != '\0'; ++p) { + if (*p < 32 || *p > 127) + *p = ' '; + } + + // Add string to result + result += CString((const char *)buffer); + + // Free buffer if one was allocated + if (entrySize >= STRING_BUFFER_SIZE) + delete[] tempBuffer; + } + + return result; } } // End of namespace Titanic diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index c3c25a33e7..3843483e5a 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -43,7 +43,7 @@ private: TTScripts _scripts; int _currentCharId; CDialogueFile *_dialogueFile; - int _field14; + int _dialogueIndex; private: /** * Loads the statics for the class @@ -80,7 +80,12 @@ private: */ void loadAssets(CTrueTalkNPC *npc, int charId); - void setView(TTNamedScript *npcScript, TTRoomScript *roomScript, CViewItem *view); + void setDialogue(TTNamedScript *npcScript, TTRoomScript *roomScript, CViewItem *view); + + /** + * Read in a string from the resource + */ + CString readDialogueString(); public: static int _v1; static int _v2; -- cgit v1.2.3 From 339df8657e883ba62bd5c4c474ab920dfa3d19c8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 7 May 2016 16:50:39 -0400 Subject: TITANIC: Implement CTrueTalkManager triggerNPC --- engines/titanic/core/game_object.cpp | 6 +-- engines/titanic/core/game_object.h | 2 +- engines/titanic/messages/messages.h | 2 +- engines/titanic/sound/sound.cpp | 10 ++++ engines/titanic/sound/sound.h | 5 ++ engines/titanic/true_talk/script_handler.cpp | 2 +- engines/titanic/true_talk/script_handler.h | 2 +- engines/titanic/true_talk/true_talk_manager.cpp | 69 ++++++++++++++++++++++--- engines/titanic/true_talk/true_talk_manager.h | 38 ++++++++++++-- 9 files changed, 119 insertions(+), 17 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 7cfcd338f6..b27b461b48 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -353,7 +353,7 @@ void CGameObject::petFn3(CTreeItem *item) { pet->fn3(item); } -void CGameObject::playMovie(uint startFrame, uint endFrame, int val3) { +void CGameObject::playMovie(uint startFrame, uint endFrame, uint flags) { _frameNumber = -1; if (!_surface) { if (!_resource.empty()) @@ -367,9 +367,9 @@ void CGameObject::playMovie(uint startFrame, uint endFrame, int val3) { if (movie) movie->_gameObject = this; - _surface->playMovie(startFrame, endFrame, val3, val3 != 0); + _surface->playMovie(startFrame, endFrame, flags, flags != 0); - if (val3 & 0x10) + if (flags & 0x10) getGameManager()->_gameState.addMovie(_surface->_movie); } } diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 4d2dca6860..87cc2baa7e 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -316,7 +316,7 @@ public: /** * Play the movie specified in _resource */ - void playMovie(uint startFrame, uint endFrame, int val3); + void playMovie(uint startFrame, uint endFrame, uint flags); /** * Play an arbitrary clip diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index aeb82d5448..561120de34 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -341,7 +341,7 @@ MESSAGE1(CTranslateObjectMsg, Point, delta, Point()); MESSAGE3(CTransportMsg, CString, roomName, "", int, value1, 0, int, value2, 0); MESSAGE1(CTriggerAutoMusicPlayerMsg, int, value, 0); MESSAGE1(CTriggerNPCEvent, int, value, 0); -MESSAGE4(CTrueTalkGetAnimSetMsg, int, value1, 0, int, value2, 0, int, value3, 0, int, value4, 0); +MESSAGE4(CTrueTalkGetAnimSetMsg, int, value1, 0, uint, index, 0, uint, startFrame, 0, uint, endFrame, 0); MESSAGE2(CTrueTalkGetAssetDetailsMsg, CString, filename, "", int, numValue, 0); MESSAGE2(CTrueTalkGetStateValueMsg, int, value1, 0, int, value2, -1000); MESSAGE2(CTrueTalkNotifySpeechEndedMsg, int, value1, 0, int, value2, 0); diff --git a/engines/titanic/sound/sound.cpp b/engines/titanic/sound/sound.cpp index 3e4f154c35..cf7689d937 100644 --- a/engines/titanic/sound/sound.cpp +++ b/engines/titanic/sound/sound.cpp @@ -25,6 +25,11 @@ namespace Titanic { +int CSoundItem::fn1() { + // TODO + return 0; +} + CSound::CSound(CGameManager *owner) : _gameManager(owner) { } @@ -123,4 +128,9 @@ void CSound::removeOldest() { } } +CSoundItem *CSound::getTrueTalkSound(CDialogueFile *dialogueFile, int index) { + warning("TODO: CSound::getTrueTalkSound"); + return nullptr; +} + } // End of namespace Titanic z diff --git a/engines/titanic/sound/sound.h b/engines/titanic/sound/sound.h index dfbee0a9dd..33996de1ca 100644 --- a/engines/titanic/sound/sound.h +++ b/engines/titanic/sound/sound.h @@ -27,6 +27,7 @@ #include "titanic/sound/sound_manager.h" #include "titanic/core/list.h" #include "titanic/core/view_item.h" +#include "titanic/true_talk/dialogue_file.h" namespace Titanic { @@ -45,6 +46,8 @@ public: _field20(0), _field24(0), _field28(0) {} CSoundItem(const CString &name) : ListItem(), _name(name), _soundHandle(0), _field1C(0), _field20(0), _field24(0), _field28(0) {} + + int fn1(); }; class CSoundItemList : public List { @@ -116,6 +119,8 @@ public: void fn2(int handle); void fn3(int handle, int val2, int val3); void managerProc8(int v) { _soundManager.proc8(v); } + + CSoundItem *getTrueTalkSound(CDialogueFile *dialogueFile, int index); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index eb7979e1e5..a46a03301c 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -29,7 +29,7 @@ namespace Titanic { CScriptHandler::CScriptHandler(CTitleEngine *owner, int val1, int val2) { } -void CScriptHandler::setup(TTNamedScript *npcScript, TTRoomScript *roomScript, uint charId) { +void CScriptHandler::setup(TTRoomScript *roomScript, TTNamedScript *npcScript, uint charId) { // TODO } diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index 1959468ed0..8d5c78dbc3 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -40,7 +40,7 @@ public: /** * Set the character and room */ - void setup(TTNamedScript *npcScript, TTRoomScript *roomScript, uint charId); + void setup(TTRoomScript *roomScript, TTNamedScript *npcScript, uint charId); void processInput(TTNamedScript *npcScript, TTRoomScript *roomScript, const TTString &line); diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 6552a5db5c..9e7fb773e5 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -44,7 +44,7 @@ CTrueTalkNPC *CTrueTalkManager::_currentNPC; CTrueTalkManager::CTrueTalkManager(CGameManager *owner) : _gameManager(owner), _scripts(&_titleEngine), _currentCharId(0), - _dialogueFile(nullptr), _dialogueIndex(0) { + _dialogueFile(nullptr), _dialogueId(0) { } CTrueTalkManager::~CTrueTalkManager() { @@ -210,10 +210,10 @@ void CTrueTalkManager::start(CTrueTalkNPC *npc, uint id, CViewItem *view) { loadAssets(npc, charId); _currentNPC = npc; - _titleEngine._scriptHandler->setup(npcScript, roomScript, charId); + _titleEngine._scriptHandler->setup(roomScript, npcScript, charId); _currentNPC = nullptr; - setDialogue(npcScript, roomScript, view); + setDialogue(npc, roomScript, view); } TTNamedScript *CTrueTalkManager::getTalker(const CString &name) const { @@ -282,7 +282,7 @@ void CTrueTalkManager::loadAssets(CTrueTalkNPC *npc, int charId) { if (!detailsMsg._filename.empty()) { _dialogueFile = new CDialogueFile(detailsMsg._filename, 20); - _dialogueIndex = detailsMsg._numValue + 1; + _dialogueId = detailsMsg._numValue + 1; } } @@ -298,13 +298,25 @@ void CTrueTalkManager::processInput(CTrueTalkNPC *npc, CTextInputMsg *msg, CView _currentNPC = nullptr; loadAssets(npc, npcScript->charId()); - setDialogue(npcScript, roomScript, view); + setDialogue(npc, roomScript, view); } _currentNPC = nullptr; } -void CTrueTalkManager::setDialogue(TTNamedScript *npcScript, TTRoomScript *roomScript, CViewItem *view) { +void CTrueTalkManager::setDialogue(CTrueTalkNPC *npc, TTRoomScript *roomScript, CViewItem *view) { + // Get the dialog text + CString dialogStr = readDialogueString(); + if (dialogStr.empty()) + return; + + TTTalker *talker = new TTTalker(this, npc); + _talkers.push_back(talker); + + bool isParrot = npc->getName() == "parrot"; + + + warning("TODO: CTrueTalkManager::setDialogue"); } @@ -320,7 +332,7 @@ CString CTrueTalkManager::readDialogueString() { // Open a text entry from the dialogue file for access DialogueResource *textRes = _dialogueFile->openTextEntry( - _titleEngine._indexes[idx] - _dialogueIndex); + _titleEngine._indexes[idx] - _dialogueId); if (!textRes) continue; @@ -351,4 +363,47 @@ CString CTrueTalkManager::readDialogueString() { return result; } +int CTrueTalkManager::readDialogSound() { + _field18 = 0; + + for (uint idx = 0; idx < _titleEngine._indexes.size(); ++idx) { + CSoundItem *soundItem = _gameManager->_sound.getTrueTalkSound( + _dialogueFile, _titleEngine._indexes[idx] - _dialogueId); + if (soundItem) { + _field18 = soundItem->fn1(); + } + } + + return _field18; +} + +void CTrueTalkManager::triggerNPC(CTrueTalkNPC *npc) { + CTrueTalkSelfQueueAnimSetMsg queueSetMsg; + if (queueSetMsg.execute(npc)) { + if (_field18 > 300) { + CTrueTalkQueueUpAnimSetMsg upMsg(_field18); + upMsg.execute(npc); + } + } else { + CTrueTalkGetAnimSetMsg getAnimMsg; + if (_field18 > 300) { + do { + getAnimMsg.execute(npc); + if (!getAnimMsg._endFrame) + break; + + npc->playMovie(getAnimMsg._startFrame, getAnimMsg._endFrame, 0); + getAnimMsg._endFrame = 0; + + uint numFrames = getAnimMsg._endFrame - getAnimMsg._startFrame; + int64 val = (numFrames * 1000) * 0x88888889; + uint diff = (val >> (32 + 5)) - 500; + _field18 += diff; + + getAnimMsg._index++; + } while (_field18 > 0); + } + } +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index 3843483e5a..c11c34f326 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -34,8 +34,28 @@ namespace Titanic { class CGameManager; class CTreeItem; class CViewItem; +class CTrueTalkManager; class CTrueTalkNPC; +class TTTalker : public ListItem { +public: + CTrueTalkManager *_owner; + CTrueTalkNPC *_npc; + CString _string1; + int _field20; + int _field24; + int _field28; +public: + TTTalker() : _owner(nullptr), _npc(nullptr), + _field20(0), _field24(0), _field28(0) {} + TTTalker(CTrueTalkManager *owner, CTrueTalkNPC *npc) : + _owner(owner), _npc(npc), _field20(0), _field24(0), _field28(0) {} + +}; + +class TTTalkerList : public List { +}; + class CTrueTalkManager { private: CGameManager *_gameManager; @@ -43,7 +63,9 @@ private: TTScripts _scripts; int _currentCharId; CDialogueFile *_dialogueFile; - int _dialogueIndex; + int _dialogueId; + int _field18; + TTTalkerList _talkers; private: /** * Loads the statics for the class @@ -80,12 +102,22 @@ private: */ void loadAssets(CTrueTalkNPC *npc, int charId); - void setDialogue(TTNamedScript *npcScript, TTRoomScript *roomScript, CViewItem *view); + void setDialogue(CTrueTalkNPC *npc, TTRoomScript *roomScript, CViewItem *view); /** - * Read in a string from the resource + * Read in text from the dialogue file */ CString readDialogueString(); + + /** + * Read in the sound from the dialogue file + */ + int readDialogSound(); + + /** + * Triggers animation for the NPC + */ + void triggerNPC(CTrueTalkNPC *npc); public: static int _v1; static int _v2; -- cgit v1.2.3 From b480a2f53e3a48a0e741f86e59cc141f8325c958 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 7 May 2016 18:41:13 -0400 Subject: TITANIC: Implementing TTTalker --- engines/titanic/messages/messages.h | 2 +- engines/titanic/module.mk | 1 + engines/titanic/npcs/true_talk_npc.cpp | 14 +++---- engines/titanic/npcs/true_talk_npc.h | 3 +- engines/titanic/pet_control/pet_text.cpp | 5 +-- engines/titanic/true_talk/true_talk_manager.cpp | 20 +++++---- engines/titanic/true_talk/true_talk_manager.h | 22 ++-------- engines/titanic/true_talk/tt_talker.cpp | 35 ++++++++++++++++ engines/titanic/true_talk/tt_talker.h | 56 +++++++++++++++++++++++++ 9 files changed, 119 insertions(+), 39 deletions(-) create mode 100644 engines/titanic/true_talk/tt_talker.cpp create mode 100644 engines/titanic/true_talk/tt_talker.h diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 561120de34..ad5c4bc485 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -345,7 +345,7 @@ MESSAGE4(CTrueTalkGetAnimSetMsg, int, value1, 0, uint, index, 0, uint, startFram MESSAGE2(CTrueTalkGetAssetDetailsMsg, CString, filename, "", int, numValue, 0); MESSAGE2(CTrueTalkGetStateValueMsg, int, value1, 0, int, value2, -1000); MESSAGE2(CTrueTalkNotifySpeechEndedMsg, int, value1, 0, int, value2, 0); -MESSAGE3(CTrueTalkNotifySpeechStartedMsg, int, value1, 0, int, value2, 0, int, value, 0); +MESSAGE3(CTrueTalkNotifySpeechStartedMsg, uint, soundId, 0, uint, dialogueId, 0, int, value, 0); MESSAGE1(CTrueTalkQueueUpAnimSetMsg, int, value, 0); MESSAGE0(CTrueTalkSelfQueueAnimSetMsg); MESSAGE3(CTrueTalkTriggerActionMsg, int, value1, 0, int, value2, 0, int, value3, 0); diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index df8f0534f4..aaccb77445 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -464,6 +464,7 @@ MODULE_OBJS := \ true_talk/tt_named_script.o \ true_talk/tt_scripts.o \ true_talk/tt_string.o \ + true_talk/tt_talker.o \ true_talk/tt_title_script.o # This module can be built as a plugin diff --git a/engines/titanic/npcs/true_talk_npc.cpp b/engines/titanic/npcs/true_talk_npc.cpp index bc562efac4..297de59178 100644 --- a/engines/titanic/npcs/true_talk_npc.cpp +++ b/engines/titanic/npcs/true_talk_npc.cpp @@ -39,7 +39,7 @@ BEGIN_MESSAGE_MAP(CTrueTalkNPC, CCharacter) END_MESSAGE_MAP() CTrueTalkNPC::CTrueTalkNPC() : _assetName("z451.dlg"), - _assetNumber(0x11170), _fieldE4(0), _npcFlags(0), _fieldEC(0), _fieldF0(0), + _assetNumber(0x11170), _fieldE4(0), _npcFlags(0), _soundId(0), _fieldF0(0), _fieldF4(0), _fieldF8(0), _speechTimerId(0), _field100(0), _field104(0) { } @@ -49,7 +49,7 @@ void CTrueTalkNPC::save(SimpleFile *file, int indent) const { file->writeQuotedLine(_assetName, indent); file->writeNumberLine(_fieldE4, indent); file->writeNumberLine(_npcFlags, indent); - file->writeNumberLine(_fieldEC, indent); + file->writeNumberLine(_soundId, indent); file->writeNumberLine(_fieldF0, indent); file->writeNumberLine(_fieldF4, indent); file->writeNumberLine(_fieldF8, indent); @@ -66,7 +66,7 @@ void CTrueTalkNPC::load(SimpleFile *file) { _assetName = file->readString(); _fieldE4 = file->readNumber(); _npcFlags = file->readNumber(); - _fieldEC = file->readNumber(); + _soundId = file->readNumber(); _fieldF0 = file->readNumber(); _fieldF4 = file->readNumber(); _fieldF8 = file->readNumber(); @@ -101,14 +101,14 @@ bool CTrueTalkNPC::TrueTalkNotifySpeechStartedMsg(CTrueTalkNotifySpeechStartedMs if (_speechTimerId) stopTimer(_speechTimerId); - _fieldEC = msg->_value1; + _soundId = msg->_soundId; _fieldF0 = g_vm->_events->getTicksCount(); if (hasActiveMovie() || (_npcFlags & NPCFLAG_2)) { _npcFlags &= ~NPCFLAG_2; stopMovie(); - CNPCPlayTalkingAnimationMsg msg1(_fieldEC, 0, 0); + CNPCPlayTalkingAnimationMsg msg1(_soundId, 0, 0); msg1.execute(this); if (msg1._value3) { @@ -124,7 +124,7 @@ bool CTrueTalkNPC::TrueTalkNotifySpeechStartedMsg(CTrueTalkNotifySpeechStartedMs bool CTrueTalkNPC::TrueTalkNotifySpeechEndedMsg(CTrueTalkNotifySpeechEndedMsg *msg) { _npcFlags &= ~NPCFLAG_SPEAKING; --_field100; - _fieldEC = 0; + _soundId = 0; if (!(_npcFlags & NPCFLAG_8)) { CNPCPlayTalkingAnimationMsg msg1(0, 2, 0); @@ -147,7 +147,7 @@ bool CTrueTalkNPC::MovieEndMsg(CMovieEndMsg *msg) { } int diff = g_vm->_events->getTicksCount() - _fieldF0; - int ticks = MAX((int)_fieldEC - diff, 0); + int ticks = MAX((int)_soundId - diff, 0); CNPCPlayTalkingAnimationMsg msg1(ticks, ticks > 1000 ? 2 : 1, 0); msg1.execute(this); diff --git a/engines/titanic/npcs/true_talk_npc.h b/engines/titanic/npcs/true_talk_npc.h index ad436a5582..8277b55e45 100644 --- a/engines/titanic/npcs/true_talk_npc.h +++ b/engines/titanic/npcs/true_talk_npc.h @@ -25,6 +25,7 @@ #include "titanic/npcs/character.h" #include "titanic/messages/messages.h" +#include "titanic/true_talk/tt_talker.h" namespace Titanic { @@ -50,7 +51,7 @@ protected: CString _assetName; int _fieldE4; uint _npcFlags; - int _fieldEC; + uint _soundId; int _fieldF0; int _fieldF4; int _fieldF8; diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index a4e00424fe..e6b90c127c 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -236,9 +236,6 @@ void CPetText::setColor(byte r, byte g, byte b) { void CPetText::remapColors(uint count, uint *srcColors, uint *destColors) { if (_lineCount >= 0) { - int lineNum = 0; - int index1 = 0; - for (int lineNum = 0; lineNum <= _lineCount; ++lineNum) { // Get the rgb values uint r = _array[lineNum]._rgb[1]; @@ -442,7 +439,7 @@ int CPetText::getNPCNum(uint npcId, uint startIndex) { return -1; } - int size = _lines.size(); + uint size = _lines.size(); if (startIndex < 5 || startIndex >= size) return -1; diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 9e7fb773e5..2f7828bc52 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -42,6 +42,8 @@ bool CTrueTalkManager::_v10; int CTrueTalkManager::_v11[41]; CTrueTalkNPC *CTrueTalkManager::_currentNPC; +/*------------------------------------------------------------------------*/ + CTrueTalkManager::CTrueTalkManager(CGameManager *owner) : _gameManager(owner), _scripts(&_titleEngine), _currentCharId(0), _dialogueFile(nullptr), _dialogueId(0) { @@ -306,18 +308,18 @@ void CTrueTalkManager::processInput(CTrueTalkNPC *npc, CTextInputMsg *msg, CView void CTrueTalkManager::setDialogue(CTrueTalkNPC *npc, TTRoomScript *roomScript, CViewItem *view) { // Get the dialog text - CString dialogStr = readDialogueString(); - if (dialogStr.empty()) + CString dialogueStr = readDialogueString(); + if (dialogueStr.empty()) return; + int soundId = readDialogSound(); TTTalker *talker = new TTTalker(this, npc); _talkers.push_back(talker); - bool isParrot = npc->getName() == "parrot"; - - - - warning("TODO: CTrueTalkManager::setDialogue"); + bool isParrot = npc->getName().contains("parrot"); + triggerNPC(npc); + setTalker(talker, roomScript, view, isParrot); + talker->speechStarted(dialogueStr, _titleEngine._indexes[0], soundId); } #define STRING_BUFFER_SIZE 2048 @@ -406,4 +408,8 @@ void CTrueTalkManager::triggerNPC(CTrueTalkNPC *npc) { } } +void CTrueTalkManager::setTalker(TTTalker *talker, TTRoomScript *roomScript, CViewItem *view, bool isParrot) { + warning("TODO: CTrueTalkManager::setTalker"); +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index c11c34f326..1f6bf1641d 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -28,6 +28,7 @@ #include "titanic/true_talk/dialogue_file.h" #include "titanic/true_talk/title_engine.h" #include "titanic/true_talk/tt_scripts.h" +#include "titanic/true_talk/tt_talker.h" namespace Titanic { @@ -37,25 +38,6 @@ class CViewItem; class CTrueTalkManager; class CTrueTalkNPC; -class TTTalker : public ListItem { -public: - CTrueTalkManager *_owner; - CTrueTalkNPC *_npc; - CString _string1; - int _field20; - int _field24; - int _field28; -public: - TTTalker() : _owner(nullptr), _npc(nullptr), - _field20(0), _field24(0), _field28(0) {} - TTTalker(CTrueTalkManager *owner, CTrueTalkNPC *npc) : - _owner(owner), _npc(npc), _field20(0), _field24(0), _field28(0) {} - -}; - -class TTTalkerList : public List { -}; - class CTrueTalkManager { private: CGameManager *_gameManager; @@ -118,6 +100,8 @@ private: * Triggers animation for the NPC */ void triggerNPC(CTrueTalkNPC *npc); + + void setTalker(TTTalker *talker, TTRoomScript *roomScript, CViewItem *view, bool isParrot); public: static int _v1; static int _v2; diff --git a/engines/titanic/true_talk/tt_talker.cpp b/engines/titanic/true_talk/tt_talker.cpp new file mode 100644 index 0000000000..3e86fdf597 --- /dev/null +++ b/engines/titanic/true_talk/tt_talker.cpp @@ -0,0 +1,35 @@ +/* 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 "titanic/true_talk/tt_talker.h" +#include "titanic/messages/messages.h" + +namespace Titanic { + +void TTTalker::speechStarted(const CString &dialogueStr, uint dialogueId, uint soundId) { + _dialogueId = dialogueId; + + CTrueTalkNotifySpeechStartedMsg msg(soundId, dialogueId, 0); + msg.execute(_npc, nullptr, MSGFLAG_BREAK_IF_HANDLED); +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_talker.h b/engines/titanic/true_talk/tt_talker.h new file mode 100644 index 0000000000..792c84c505 --- /dev/null +++ b/engines/titanic/true_talk/tt_talker.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_TT_TALKER_H +#define TITANIC_TT_TALKER_H + +#include "titanic/core/list.h" +#include "titanic/npcs/true_talk_npc.h" +#include "titanic/support/string.h" + +namespace Titanic { + +class CTrueTalkManager; + +class TTTalker : public ListItem { +public: + CTrueTalkManager *_owner; + CTrueTalkNPC *_npc; + CString _string1; + int _dialogueId; + int _field24; + int _field28; +public: + TTTalker() : _owner(nullptr), _npc(nullptr), + _dialogueId(0), _field24(0), _field28(0) {} + TTTalker(CTrueTalkManager *owner, CTrueTalkNPC *npc) : + _owner(owner), _npc(npc), _dialogueId(0), _field24(0), _field28(0) {} + + void speechStarted(const CString &dialogueStr, uint dialogueId, uint soundId); +}; + +class TTTalkerList : public List { +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_TALKER_H */ -- cgit v1.2.3 From babdf0aa036a62e098be2e0aef7082e315afbf62 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 7 May 2016 20:52:36 -0400 Subject: TITANIC: Setting up of title engine and title script --- engines/titanic/true_talk/script_handler.cpp | 5 ++++- engines/titanic/true_talk/script_handler.h | 2 +- engines/titanic/true_talk/title_engine.cpp | 4 ++-- engines/titanic/true_talk/title_engine.h | 1 + engines/titanic/true_talk/true_talk_manager.cpp | 2 +- engines/titanic/true_talk/tt_title_script.cpp | 3 +++ engines/titanic/true_talk/tt_title_script.h | 8 +++++++- 7 files changed, 19 insertions(+), 6 deletions(-) diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index a46a03301c..83d181275a 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -33,8 +33,11 @@ void CScriptHandler::setup(TTRoomScript *roomScript, TTNamedScript *npcScript, u // TODO } -void CScriptHandler::processInput(TTNamedScript *npcScript, TTRoomScript *roomScript, +void CScriptHandler::processInput(TTRoomScript *roomScript, TTNamedScript *npcScript, const TTString &line) { + if (!roomScript || line.empty()) + return; + // TODO } diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index 8d5c78dbc3..1206afe48e 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -42,7 +42,7 @@ public: */ void setup(TTRoomScript *roomScript, TTNamedScript *npcScript, uint charId); - void processInput(TTNamedScript *npcScript, TTRoomScript *roomScript, + void processInput(TTRoomScript *roomScript, TTNamedScript *npcScript, const TTString &line); }; diff --git a/engines/titanic/true_talk/title_engine.cpp b/engines/titanic/true_talk/title_engine.cpp index 5b8e8d9ef9..3908ea0986 100644 --- a/engines/titanic/true_talk/title_engine.cpp +++ b/engines/titanic/true_talk/title_engine.cpp @@ -33,10 +33,10 @@ CTitleEngine::~CTitleEngine() { } void CTitleEngine::setup(int val1, int val2) { - + _script = new TTTitleScript(); + _scriptHandler = new CScriptHandler(this, val1, val2); } - /*------------------------------------------------------------------------*/ STtitleEngine::STtitleEngine(): CTitleEngine(), _field58(0) { diff --git a/engines/titanic/true_talk/title_engine.h b/engines/titanic/true_talk/title_engine.h index ab541ec6f8..389e376516 100644 --- a/engines/titanic/true_talk/title_engine.h +++ b/engines/titanic/true_talk/title_engine.h @@ -28,6 +28,7 @@ #include "titanic/support/string.h" #include "titanic/true_talk/script_handler.h" #include "titanic/true_talk/tt_script_base.h" +#include "titanic/true_talk/tt_title_script.h" namespace Titanic { diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 2f7828bc52..fefa2fa824 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -295,7 +295,7 @@ void CTrueTalkManager::processInput(CTrueTalkNPC *npc, CTextInputMsg *msg, CView if (npcScript && roomScript) { _currentNPC = npc; - _titleEngine._scriptHandler->processInput(npcScript, roomScript, + _titleEngine._scriptHandler->processInput(roomScript, npcScript, TTString(msg->_input)); _currentNPC = nullptr; diff --git a/engines/titanic/true_talk/tt_title_script.cpp b/engines/titanic/true_talk/tt_title_script.cpp index 048199ad62..af784e3352 100644 --- a/engines/titanic/true_talk/tt_title_script.cpp +++ b/engines/titanic/true_talk/tt_title_script.cpp @@ -24,5 +24,8 @@ namespace Titanic { +TTTitleScript::TTTitleScript() : TTScriptBase(1, "", 0, "", 0, -1, -1, -1, 0), + _field50(0), _field5C(-1), _field60(0) { +} } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_title_script.h b/engines/titanic/true_talk/tt_title_script.h index 0c36e832a9..7876ba8a71 100644 --- a/engines/titanic/true_talk/tt_title_script.h +++ b/engines/titanic/true_talk/tt_title_script.h @@ -24,12 +24,18 @@ #define TITANIC_TT_TITLE_SCRIPT_H #include "titanic/true_talk/tt_script_base.h" +#include "titanic/true_talk/tt_string.h" namespace Titanic { class TTTitleScript : public TTScriptBase { +private: + int _field50; + TTString _string1; + int _field5C; + int _field60; public: - + TTTitleScript(); }; } // End of namespace Titanic -- cgit v1.2.3 From e85b171db811d1dac22c2411299b2ce0da7effeb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 7 May 2016 21:54:34 -0400 Subject: TITANIC: Adding CTrueTalkManager support methods --- engines/titanic/game_manager.cpp | 3 ++- engines/titanic/messages/messages.h | 4 +-- engines/titanic/true_talk/true_talk_manager.cpp | 36 ++++++++++++++++++++++--- engines/titanic/true_talk/true_talk_manager.h | 15 ++++++++++- engines/titanic/true_talk/tt_talker.h | 6 ++--- 5 files changed, 54 insertions(+), 10 deletions(-) diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index bfd6984a73..1ce9436685 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -100,6 +100,7 @@ void CGameManager::preSave(CProjectItem *project) { void CGameManager::postSave() { _timers.postSave(); _trueTalkManager.postSave(); + _sound.postSave(); } void CGameManager::initBounds() { @@ -118,7 +119,7 @@ void CGameManager::update() { updateMovies(); frameMessage(getRoom()); _timers.update(g_vm->_events->getTicksCount()); - _trueTalkManager.update1(); + _trueTalkManager.removeCompleted(); _trueTalkManager.update2(); CScreenManager::_screenManagerPtr->_mouseCursor->update(); diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index ad5c4bc485..f592434152 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -343,12 +343,12 @@ MESSAGE1(CTriggerAutoMusicPlayerMsg, int, value, 0); MESSAGE1(CTriggerNPCEvent, int, value, 0); MESSAGE4(CTrueTalkGetAnimSetMsg, int, value1, 0, uint, index, 0, uint, startFrame, 0, uint, endFrame, 0); MESSAGE2(CTrueTalkGetAssetDetailsMsg, CString, filename, "", int, numValue, 0); -MESSAGE2(CTrueTalkGetStateValueMsg, int, value1, 0, int, value2, -1000); +MESSAGE2(CTrueTalkGetStateValueMsg, int, stateNum, 0, int, stateVal, -1000); MESSAGE2(CTrueTalkNotifySpeechEndedMsg, int, value1, 0, int, value2, 0); MESSAGE3(CTrueTalkNotifySpeechStartedMsg, uint, soundId, 0, uint, dialogueId, 0, int, value, 0); MESSAGE1(CTrueTalkQueueUpAnimSetMsg, int, value, 0); MESSAGE0(CTrueTalkSelfQueueAnimSetMsg); -MESSAGE3(CTrueTalkTriggerActionMsg, int, value1, 0, int, value2, 0, int, value3, 0); +MESSAGE3(CTrueTalkTriggerActionMsg, int, action, 0, int, param1, 0, int, param2, 0); MESSAGE0(CTurnOff); MESSAGE0(CTurnOn); MESSAGE1(CUse, CCarry *, item, nullptr); diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index fefa2fa824..2bbac3b0f8 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -192,11 +192,23 @@ void CTrueTalkManager::saveNPC(SimpleFile *file, int charId) const { } void CTrueTalkManager::preLoad() { - warning("TODO: CTrueTalkManager::preLoad"); + // Delete any previous talkers + for (TTTalkerList::iterator i = _talkers.begin(); i != _talkers.end(); ++i) + delete *i; + _talkers.clear(); } -void CTrueTalkManager::update1() { - //warning("CTrueTalkManager::update1"); +void CTrueTalkManager::removeCompleted() { + for (TTTalkerList::iterator i = _talkers.begin(); i != _talkers.end(); ) { + TTTalker *talker = *i; + + if (talker->_done) { + i = _talkers.erase(i); + delete talker; + } else { + ++i; + } + } } void CTrueTalkManager::update2() { @@ -412,4 +424,22 @@ void CTrueTalkManager::setTalker(TTTalker *talker, TTRoomScript *roomScript, CVi warning("TODO: CTrueTalkManager::setTalker"); } +int CTrueTalkManager::getStateVal(int stateNum) { + if (!_currentNPC) + return -1000; + + CTrueTalkGetStateValueMsg msg(stateNum, -1000); + msg.execute(_currentNPC); + return msg._stateVal; +} + +bool CTrueTalkManager::triggerAction(int action, int param) { + if (!_currentNPC) + return false; + + CTrueTalkTriggerActionMsg msg(action, param, 0); + msg.execute(_currentNPC); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index 1f6bf1641d..a7933be47f 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -117,6 +117,16 @@ public: static CTrueTalkNPC *_currentNPC; static void setFlags(int index, int val); +public: + /** + * Get a specified state value from the currently set NPC + */ + static int getStateVal(int stateNum); + + /** + * Trigger an NPC action + */ + static bool triggerAction(int action, int param); public: CTrueTalkManager(CGameManager *owner); ~CTrueTalkManager(); @@ -161,7 +171,10 @@ public: */ TTScripts &getScripts() { return _scripts; } - void update1(); + /** + * Remove any completed talkers + */ + void removeCompleted(); void update2(); diff --git a/engines/titanic/true_talk/tt_talker.h b/engines/titanic/true_talk/tt_talker.h index 792c84c505..622bcc67d1 100644 --- a/engines/titanic/true_talk/tt_talker.h +++ b/engines/titanic/true_talk/tt_talker.h @@ -38,12 +38,12 @@ public: CString _string1; int _dialogueId; int _field24; - int _field28; + int _done; public: TTTalker() : _owner(nullptr), _npc(nullptr), - _dialogueId(0), _field24(0), _field28(0) {} + _dialogueId(0), _field24(0), _done(0) {} TTTalker(CTrueTalkManager *owner, CTrueTalkNPC *npc) : - _owner(owner), _npc(npc), _dialogueId(0), _field24(0), _field28(0) {} + _owner(owner), _npc(npc), _dialogueId(0), _field24(0), _done(0) {} void speechStarted(const CString &dialogueStr, uint dialogueId, uint soundId); }; -- cgit v1.2.3 From 0cbd9f5063715a35196c40d0e92a21e73b9f15e2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 7 May 2016 22:24:46 -0400 Subject: TITANIC: Changing TTNamed* classes to TTNpc* --- engines/titanic/module.mk | 2 +- engines/titanic/pet_control/pet_conversations.cpp | 8 +- engines/titanic/pet_control/pet_conversations.h | 4 +- engines/titanic/true_talk/barbot_script.h | 6 +- engines/titanic/true_talk/bellbot_script.cpp | 2 +- engines/titanic/true_talk/bellbot_script.h | 4 +- engines/titanic/true_talk/deskbot_script.cpp | 2 +- engines/titanic/true_talk/deskbot_script.h | 4 +- engines/titanic/true_talk/doorbot_script.h | 8 +- engines/titanic/true_talk/liftbot_script.h | 6 +- engines/titanic/true_talk/maitred_script.cpp | 2 +- engines/titanic/true_talk/maitred_script.h | 4 +- engines/titanic/true_talk/parrot_script.h | 6 +- engines/titanic/true_talk/script_handler.cpp | 4 +- engines/titanic/true_talk/script_handler.h | 6 +- engines/titanic/true_talk/succubus_script.h | 6 +- engines/titanic/true_talk/true_talk_manager.cpp | 14 +- engines/titanic/true_talk/true_talk_manager.h | 4 +- engines/titanic/true_talk/tt_named_script.cpp | 240 ---------------------- engines/titanic/true_talk/tt_named_script.h | 120 ----------- engines/titanic/true_talk/tt_npc_script.cpp | 240 ++++++++++++++++++++++ engines/titanic/true_talk/tt_npc_script.h | 120 +++++++++++ engines/titanic/true_talk/tt_scripts.cpp | 16 +- engines/titanic/true_talk/tt_scripts.h | 24 +-- 24 files changed, 426 insertions(+), 426 deletions(-) delete mode 100644 engines/titanic/true_talk/tt_named_script.cpp delete mode 100644 engines/titanic/true_talk/tt_named_script.h create mode 100644 engines/titanic/true_talk/tt_npc_script.cpp create mode 100644 engines/titanic/true_talk/tt_npc_script.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index aaccb77445..a0f0efb7b0 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -461,7 +461,7 @@ MODULE_OBJS := \ true_talk/true_talk_manager.o \ true_talk/tt_script_base.o \ true_talk/tt_room_script.o \ - true_talk/tt_named_script.o \ + true_talk/tt_npc_script.o \ true_talk/tt_scripts.o \ true_talk/tt_string.o \ true_talk/tt_talker.o \ diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index 9b7b27799f..d2efdcf2e4 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -432,7 +432,7 @@ void CPetConversations::stopNPCTimer() { _petControl->stopPetTimer(1); } -TTNamedScript *CPetConversations::getNPCScript(const CString &name) const { +TTNpcScript *CPetConversations::getNPCScript(const CString &name) const { if (name.empty() || !_petControl) return nullptr; CGameManager *gameManager = _petControl->getGameManager(); @@ -517,13 +517,13 @@ void CPetConversations::copyColors(uint tableNum, uint colors[5]) { } void CPetConversations::updateDial(uint dialNum, const CString &npcName) { - TTNamedScript *script = getNPCScript(npcName); + TTNpcScript *script = getNPCScript(npcName); uint newLevel = getDialLevel(dialNum, script); npcDialChange(dialNum, _npcLevels[dialNum], newLevel); _npcLevels[dialNum] = newLevel; } -uint CPetConversations::getDialLevel(uint dialNum, TTNamedScript *script, int v) { +uint CPetConversations::getDialLevel(uint dialNum, TTNpcScript *script, int v) { bool flag = v != 0; if (!script) @@ -559,7 +559,7 @@ void CPetConversations::npcDialChange(uint dialNum, int oldLevel, int newLevel) } void CPetConversations::resetDials(const CString &name) { - TTNamedScript *script = getNPCScript(name); + TTNpcScript *script = getNPCScript(name); for (int idx = 0; idx < TOTAL_DIALS; ++idx) { uint oldLevel = _npcLevels[idx]; diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index 9ddc610058..4073360a37 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -112,7 +112,7 @@ private: /** * Get the TrueTalk script associated with a given NPC */ - TTNamedScript *getNPCScript(const CString &name) const; + TTNpcScript *getNPCScript(const CString &name) const; /** * Handle a keypress @@ -142,7 +142,7 @@ private: /** * Get a dial level */ - uint getDialLevel(uint dialNum, TTNamedScript *script, int v = 1); + uint getDialLevel(uint dialNum, TTNpcScript *script, int v = 1); /** * Called when the dial for an NPC is being changed diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index 2ea86f0803..18886c299b 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -23,15 +23,15 @@ #ifndef TITANIC_BARBOT_SCRIPT_H #define TITANIC_BARBOT_SCRIPT_H -#include "titanic/true_talk/tt_named_script.h" +#include "titanic/true_talk/tt_npc_script.h" namespace Titanic { -class BarbotScript : public TTNamedScript { +class BarbotScript : public TTNpcScript { public: BarbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : - TTNamedScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} + TTNpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} virtual int proc6() const; virtual void proc7(int v1, int v2); diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 52d8a19145..2042ca9bab 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -28,7 +28,7 @@ namespace Titanic { BellbotScript::BellbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2) : - TTNamedScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0), + TTNpcScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0), _field2D0(0), _field2D4(0), _field2D8(0), _field2DC(0) { CTrueTalkManager::setFlags(25, 0); CTrueTalkManager::setFlags(24, 0); diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index cc71c263b1..ff9f849d09 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -23,11 +23,11 @@ #ifndef TITANIC_BELLBOT_SCRIPT_H #define TITANIC_BELLBOT_SCRIPT_H -#include "titanic/true_talk/tt_named_script.h" +#include "titanic/true_talk/tt_npc_script.h" namespace Titanic { -class BellbotScript : public TTNamedScript { +class BellbotScript : public TTNpcScript { private: int _array[150]; int _field2D0; diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index f17c04145e..5844664a4a 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -28,7 +28,7 @@ namespace Titanic { DeskbotScript::DeskbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2) : - TTNamedScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0) { + TTNpcScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0) { CTrueTalkManager::setFlags(18, 0); CTrueTalkManager::setFlags(19, 0); CTrueTalkManager::setFlags(20, 0); diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index dcab218e97..d001f56075 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -23,11 +23,11 @@ #ifndef TITANIC_DESKBOT_SCRIPT_H #define TITANIC_DESKBOT_SCRIPT_H -#include "titanic/true_talk/tt_named_script.h" +#include "titanic/true_talk/tt_npc_script.h" namespace Titanic { -class DeskbotScript : public TTNamedScript { +class DeskbotScript : public TTNpcScript { public: DeskbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 37722d4862..b52c802f23 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -23,17 +23,17 @@ #ifndef TITANIC_DOORBOT_SCRIPT_H #define TITANIC_DOORBOT_SCRIPT_H -#include "titanic/true_talk/tt_named_script.h" +#include "titanic/true_talk/tt_npc_script.h" namespace Titanic { -class DoorbotScript : public TTNamedScript { +class DoorbotScript : public TTNpcScript { private: int _array[148]; public: DoorbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : - TTNamedScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} + TTNpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} virtual int proc6() const; virtual void proc7(int v1, int v2); @@ -55,4 +55,4 @@ public: } // End of namespace Titanic -#endif /* TITANIC_TT_CHARACTER1_H */ +#endif /* TITANIC_DOORBOT_SCRIPT_H */ diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index 8564bb53ef..a6c3ed878b 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -23,15 +23,15 @@ #ifndef TITANIC_LIFTBOT_SCRIPT_H #define TITANIC_LIFTBOT_SCRIPT_H -#include "titanic/true_talk/tt_named_script.h" +#include "titanic/true_talk/tt_npc_script.h" namespace Titanic { -class LiftbotScript : public TTNamedScript { +class LiftbotScript : public TTNpcScript { public: LiftbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : - TTNamedScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} + TTNpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} virtual int proc6() const; virtual void proc7(int v1, int v2); diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index b88dfc611e..47ae96ccd8 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -28,7 +28,7 @@ namespace Titanic { MaitreDScript::MaitreDScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2) : - TTNamedScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0) { + TTNpcScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0) { CTrueTalkManager::setFlags(9, 1); CTrueTalkManager::setFlags(10, 0); CTrueTalkManager::setFlags(11, 0); diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index a5fbb72c82..7aaddf971d 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -23,11 +23,11 @@ #ifndef TITANIC_MAITRED_SCRIPT_H #define TITANIC_MAITRED_SCRIPT_H -#include "titanic/true_talk/tt_named_script.h" +#include "titanic/true_talk/tt_npc_script.h" namespace Titanic { -class MaitreDScript : public TTNamedScript { +class MaitreDScript : public TTNpcScript { public: MaitreDScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); diff --git a/engines/titanic/true_talk/parrot_script.h b/engines/titanic/true_talk/parrot_script.h index ac0b08c982..354f3061b3 100644 --- a/engines/titanic/true_talk/parrot_script.h +++ b/engines/titanic/true_talk/parrot_script.h @@ -23,15 +23,15 @@ #ifndef TITANIC_PARROT_SCRIPT_H #define TITANIC_PARROT_SCRIPT_H -#include "titanic/true_talk/tt_named_script.h" +#include "titanic/true_talk/tt_npc_script.h" namespace Titanic { -class ParrotScript : public TTNamedScript { +class ParrotScript : public TTNpcScript { public: ParrotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : - TTNamedScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} + TTNpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} virtual int proc6() const; virtual void proc7(int v1, int v2); diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index 83d181275a..ef5814c3f2 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -29,11 +29,11 @@ namespace Titanic { CScriptHandler::CScriptHandler(CTitleEngine *owner, int val1, int val2) { } -void CScriptHandler::setup(TTRoomScript *roomScript, TTNamedScript *npcScript, uint charId) { +void CScriptHandler::setup(TTRoomScript *roomScript, TTNpcScript *npcScript, uint charId) { // TODO } -void CScriptHandler::processInput(TTRoomScript *roomScript, TTNamedScript *npcScript, +void CScriptHandler::processInput(TTRoomScript *roomScript, TTNpcScript *npcScript, const TTString &line) { if (!roomScript || line.empty()) return; diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index 1206afe48e..6a1e0dc0f1 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -23,7 +23,7 @@ #ifndef TITANIC_SCRIPT_HANDLER_H #define TITANIC_SCRIPT_HANDLER_H -#include "titanic/true_talk/tt_named_script.h" +#include "titanic/true_talk/tt_npc_script.h" #include "titanic/true_talk/tt_room_script.h" #include "titanic/true_talk/tt_string.h" @@ -40,9 +40,9 @@ public: /** * Set the character and room */ - void setup(TTRoomScript *roomScript, TTNamedScript *npcScript, uint charId); + void setup(TTRoomScript *roomScript, TTNpcScript *npcScript, uint charId); - void processInput(TTRoomScript *roomScript, TTNamedScript *npcScript, + void processInput(TTRoomScript *roomScript, TTNpcScript *npcScript, const TTString &line); }; diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h index 2131775fa5..0aba07ecd0 100644 --- a/engines/titanic/true_talk/succubus_script.h +++ b/engines/titanic/true_talk/succubus_script.h @@ -23,17 +23,17 @@ #ifndef TITANIC_SUCCUBUS_SCRIPT_H #define TITANIC_SUCCUBUS_SCRIPT_H -#include "titanic/true_talk/tt_named_script.h" +#include "titanic/true_talk/tt_npc_script.h" namespace Titanic { -class SuccUBusScript : public TTNamedScript { +class SuccUBusScript : public TTNpcScript { private: int _field2D0; public: SuccUBusScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : - TTNamedScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7), + TTNpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7), _field2D0(0) {} virtual int proc6() const; diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 2bbac3b0f8..d4674233dc 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -177,13 +177,13 @@ void CTrueTalkManager::setFlags(int index, int val) { } void CTrueTalkManager::loadNPC(SimpleFile *file, int charId) { - TTNamedScript *script = _scripts.getNamedScript(charId); + TTNpcScript *script = _scripts.getNamedScript(charId); if (script) script->load(file); } void CTrueTalkManager::saveNPC(SimpleFile *file, int charId) const { - TTNamedScript *script = _scripts.getNamedScript(charId); + TTNpcScript *script = _scripts.getNamedScript(charId); if (script) { script->save(file); file->writeNumber(MKTAG_BE('U', 'R', 'A', 'H')); @@ -216,7 +216,7 @@ void CTrueTalkManager::update2() { } void CTrueTalkManager::start(CTrueTalkNPC *npc, uint id, CViewItem *view) { - TTNamedScript *npcScript = getNpcScript(npc); + TTNpcScript *npcScript = getNpcScript(npc); TTRoomScript *roomScript = getRoomScript(); _titleEngine.reset(); @@ -230,7 +230,7 @@ void CTrueTalkManager::start(CTrueTalkNPC *npc, uint id, CViewItem *view) { setDialogue(npc, roomScript, view); } -TTNamedScript *CTrueTalkManager::getTalker(const CString &name) const { +TTNpcScript *CTrueTalkManager::getTalker(const CString &name) const { if (name.contains("Doorbot")) return _scripts.getNamedScript(104); else if (name.contains("DeskBot")) @@ -253,9 +253,9 @@ TTNamedScript *CTrueTalkManager::getTalker(const CString &name) const { return nullptr; } -TTNamedScript *CTrueTalkManager::getNpcScript(CTrueTalkNPC *npc) const { +TTNpcScript *CTrueTalkManager::getNpcScript(CTrueTalkNPC *npc) const { CString npcName = npc->getName(); - TTNamedScript *script = getTalker(npcName); + TTNpcScript *script = getTalker(npcName); if (!script) { // Fall back on the default NPC script @@ -301,7 +301,7 @@ void CTrueTalkManager::loadAssets(CTrueTalkNPC *npc, int charId) { } void CTrueTalkManager::processInput(CTrueTalkNPC *npc, CTextInputMsg *msg, CViewItem *view) { - TTNamedScript *npcScript = getNpcScript(npc); + TTNpcScript *npcScript = getNpcScript(npc); TTRoomScript *roomScript = getRoomScript(); _titleEngine.reset(); diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index a7933be47f..071291964e 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -72,7 +72,7 @@ private: /** * Gets the script associated with an NPC game object */ - TTNamedScript *getNpcScript(CTrueTalkNPC *npc) const; + TTNpcScript *getNpcScript(CTrueTalkNPC *npc) const; /** * Gets the script associated with the current room @@ -186,7 +186,7 @@ public: /** * Return a TrueTalk talker/script */ - TTNamedScript *getTalker(const CString &name) const; + TTNpcScript *getTalker(const CString &name) const; /** * Process player's input diff --git a/engines/titanic/true_talk/tt_named_script.cpp b/engines/titanic/true_talk/tt_named_script.cpp deleted file mode 100644 index 9d253206e2..0000000000 --- a/engines/titanic/true_talk/tt_named_script.cpp +++ /dev/null @@ -1,240 +0,0 @@ -/* 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/textconsole.h" -#include "titanic/true_talk/tt_named_script.h" -#include "titanic/true_talk/true_talk_manager.h" - -namespace Titanic { - -TTNamedScriptBase::TTNamedScriptBase(int charId, const char *charClass, int v2, - const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : - TTScriptBase(0, charClass, v2, charName, v3, v4, v5, v6, v7), - _charId(charId), _field54(0), _val2(val2) { -} - -/*------------------------------------------------------------------------*/ - -TTNamedScript::TTNamedScript(int charId, const char *charClass, int v2, - const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : - TTNamedScriptBase(charId, charClass, v2, charName, v3, val2, v4, v5, v6, v7), - _subPtr(nullptr), _field60(0), _field64(0), _field68(0), - _field6C(0), _field70(0), _field74(0), _field78(0), - _field7C(0), _field80(0) { - CTrueTalkManager::_v2 = 0; - Common::fill(&_array[0], &_array[147], 0); - - if (!CTrueTalkManager::_v10) { - Common::fill(&CTrueTalkManager::_v11[0], &CTrueTalkManager::_v11[41], 0); - CTrueTalkManager::_v10 = true; - } - - resetFlags(); -} - -void TTNamedScript::resetFlags() { - Common::fill(&_array[26], &_array[146], 0); -} - -void TTNamedScript::randomizeFlags() { - warning("TODO"); -} - -void TTNamedScript::proc4(int v) { - warning("TODO"); -} - -int TTNamedScript::proc6() const { - return 1; -} - -void TTNamedScript::proc7(int v1, int v2) { - warning("TODO"); -} - -int TTNamedScript::proc8() const { - return 0; -} - -int TTNamedScript::proc9() const { - return 2; -} - -int TTNamedScript::proc10() const { - return 2; -} - -int TTNamedScript::proc11() const { - return 2; -} - -int TTNamedScript::proc12() const { - return 1; -} - -bool TTNamedScript::proc13() const { - warning("TODO"); - return true; -} - -void TTNamedScript::proc14(int v) { - warning("TODO"); -} - -int TTNamedScript::proc15() const { - return 0; -} - -bool TTNamedScript::proc16() const { - return true; -} - -bool TTNamedScript::proc17() const { - return true; -} - -bool TTNamedScript::proc18() const { - return true; -} - -void TTNamedScript::proc19(int v) { - warning("TODO"); -} - -void TTNamedScript::proc20(int v) { - warning("TODO"); -} - -int TTNamedScript::proc21(int v) { - return v; -} - -int TTNamedScript::proc22() const { - return 0; -} - -int TTNamedScript::proc23() const { - return 0; -} - -int TTNamedScript::proc25() const { - return 0; -} - -void TTNamedScript::proc26() { -} - -void TTNamedScript::save(SimpleFile *file) { - file->writeNumber(charId()); - saveBody(file); - - file->writeNumber(4); - file->writeNumber(_field70); - file->writeNumber(_field74); - file->writeNumber(_field78); - file->writeNumber(_field7C); - - file->writeNumber(10); - for (int idx = 0; idx < 10; ++idx) - file->writeNumber(_array[idx]); -} - -void TTNamedScript::load(SimpleFile *file) { - loadBody(file); - - int count = file->readNumber(); - _field70 = file->readNumber(); - _field74 = file->readNumber(); - _field78 = file->readNumber(); - _field7C = file->readNumber(); - - for (int idx = count; idx > 4; --idx) - file->readNumber(); - - count = file->readNumber(); - for (int idx = 0; idx < count; ++idx) { - int v = file->readNumber(); - if (idx < 10) - _array[idx] = v; - } -} - -void TTNamedScript::saveBody(SimpleFile *file) { - int v = proc31(); - file->writeNumber(v); - - if (v > 0 && _subPtr) { - warning("TODO"); - } -} - -void TTNamedScript::loadBody(SimpleFile *file) { - int count = file->readNumber(); - preLoad(); - - for (int index = 0; index < count; index += 2) { - int v = file->readNumber(); - - if (_subPtr) { - error("TODO - %d", v); - } - } -} - -int TTNamedScript::proc31() { - warning("TODO"); - return 0; -} - -void TTNamedScript::proc32() { - warning("TODO"); -} - -void TTNamedScript::proc33(int v1, int v2) { - warning("TODO"); -} - -int TTNamedScript::proc34() { - warning("TODO"); - return 0; -} - -int TTNamedScript::getDialLevel(uint dialNum, bool flag) { - warning("TODO"); - return 0; -} - -int TTNamedScript::proc36() const { - return 0; -} - -int TTNamedScript::proc37() const { - return 0; -} - -void TTNamedScript::preLoad() { - if (_subPtr) { - error("TODO"); - } -} - -} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_named_script.h b/engines/titanic/true_talk/tt_named_script.h deleted file mode 100644 index 8174f64c53..0000000000 --- a/engines/titanic/true_talk/tt_named_script.h +++ /dev/null @@ -1,120 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_TT_NAMED_SCRIPT_H -#define TITANIC_TT_NAMED_SCRIPT_H - -#include "titanic/support/simple_file.h" -#include "titanic/true_talk/tt_script_base.h" - -namespace Titanic { - - -class TTNamedScriptBase : public TTScriptBase { -protected: - int _field54; - int _val2; -public: - int _charId; -public: - TTNamedScriptBase(int charId, const char *charClass, int v2, - const char *charName, int v3, int val2, int v4, - int v5, int v6, int v7); - - virtual int proc6() const = 0; - virtual void proc7(int v1, int v2) = 0; - virtual int proc8() const = 0; - virtual int proc9() const = 0; - virtual int proc10() const = 0; - virtual int proc11() const = 0; - virtual int proc12() const = 0; - - int charId() const { return _charId; } -}; - -class TTNamedScript : public TTNamedScriptBase { -protected: - byte *_subPtr; - int _field60; - int _field64; - int _field68; - int _field6C; - int _field70; - int _field74; - int _field78; - int _field7C; - int _field80; - int _array[147]; -protected: - void resetFlags(); - - void randomizeFlags(); -public: - TTNamedScript(int charId, const char *charClass, int v2, - const char *charName, int v3, int val2, int v4, - int v5, int v6, int v7); - - virtual void proc4(int v); - virtual int proc6() const; - virtual void proc7(int v1, int v2); - virtual int proc8() const; - virtual int proc9() const; - virtual int proc10() const; - virtual int proc11() const; - virtual int proc12() const; - virtual bool proc13() const; - virtual void proc14(int v); - virtual int proc15() const; - virtual bool proc16() const; - virtual bool proc17() const; - virtual bool proc18() const; - virtual void proc19(int v); - virtual void proc20(int v); - virtual int proc21(int v); - virtual int proc22() const; - virtual int proc23() const; - virtual void proc24() = 0; - virtual int proc25() const; - virtual void proc26(); - virtual void save(SimpleFile *file); - virtual void load(SimpleFile *file); - virtual void saveBody(SimpleFile *file); - virtual void loadBody(SimpleFile *file); - virtual int proc31(); - virtual void proc32(); - virtual void proc33(int v1, int v2); - virtual int proc34(); - - /** - * Get the NPC's dial level - */ - virtual int getDialLevel(uint dialNum, bool flag = true); - - virtual int proc36() const; - virtual int proc37() const; - - void preLoad(); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_TT_CHARACTER1_H */ diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp new file mode 100644 index 0000000000..dfe8ac0ada --- /dev/null +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -0,0 +1,240 @@ +/* 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/textconsole.h" +#include "titanic/true_talk/tt_npc_script.h" +#include "titanic/true_talk/true_talk_manager.h" + +namespace Titanic { + +TTNpcScriptBase::TTNpcScriptBase(int charId, const char *charClass, int v2, + const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : + TTScriptBase(0, charClass, v2, charName, v3, v4, v5, v6, v7), + _charId(charId), _field54(0), _val2(val2) { +} + +/*------------------------------------------------------------------------*/ + +TTNpcScript::TTNpcScript(int charId, const char *charClass, int v2, + const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : + TTNpcScriptBase(charId, charClass, v2, charName, v3, val2, v4, v5, v6, v7), + _subPtr(nullptr), _field60(0), _field64(0), _field68(0), + _field6C(0), _field70(0), _field74(0), _field78(0), + _field7C(0), _field80(0) { + CTrueTalkManager::_v2 = 0; + Common::fill(&_array[0], &_array[147], 0); + + if (!CTrueTalkManager::_v10) { + Common::fill(&CTrueTalkManager::_v11[0], &CTrueTalkManager::_v11[41], 0); + CTrueTalkManager::_v10 = true; + } + + resetFlags(); +} + +void TTNpcScript::resetFlags() { + Common::fill(&_array[26], &_array[146], 0); +} + +void TTNpcScript::randomizeFlags() { + warning("TODO"); +} + +void TTNpcScript::proc4(int v) { + warning("TODO"); +} + +int TTNpcScript::proc6() const { + return 1; +} + +void TTNpcScript::proc7(int v1, int v2) { + warning("TODO"); +} + +int TTNpcScript::proc8() const { + return 0; +} + +int TTNpcScript::proc9() const { + return 2; +} + +int TTNpcScript::proc10() const { + return 2; +} + +int TTNpcScript::proc11() const { + return 2; +} + +int TTNpcScript::proc12() const { + return 1; +} + +bool TTNpcScript::proc13() const { + warning("TODO"); + return true; +} + +void TTNpcScript::proc14(int v) { + warning("TODO"); +} + +int TTNpcScript::proc15() const { + return 0; +} + +bool TTNpcScript::proc16() const { + return true; +} + +bool TTNpcScript::proc17() const { + return true; +} + +bool TTNpcScript::proc18() const { + return true; +} + +void TTNpcScript::proc19(int v) { + warning("TODO"); +} + +void TTNpcScript::proc20(int v) { + warning("TODO"); +} + +int TTNpcScript::proc21(int v) { + return v; +} + +int TTNpcScript::proc22() const { + return 0; +} + +int TTNpcScript::proc23() const { + return 0; +} + +int TTNpcScript::proc25() const { + return 0; +} + +void TTNpcScript::proc26() { +} + +void TTNpcScript::save(SimpleFile *file) { + file->writeNumber(charId()); + saveBody(file); + + file->writeNumber(4); + file->writeNumber(_field70); + file->writeNumber(_field74); + file->writeNumber(_field78); + file->writeNumber(_field7C); + + file->writeNumber(10); + for (int idx = 0; idx < 10; ++idx) + file->writeNumber(_array[idx]); +} + +void TTNpcScript::load(SimpleFile *file) { + loadBody(file); + + int count = file->readNumber(); + _field70 = file->readNumber(); + _field74 = file->readNumber(); + _field78 = file->readNumber(); + _field7C = file->readNumber(); + + for (int idx = count; idx > 4; --idx) + file->readNumber(); + + count = file->readNumber(); + for (int idx = 0; idx < count; ++idx) { + int v = file->readNumber(); + if (idx < 10) + _array[idx] = v; + } +} + +void TTNpcScript::saveBody(SimpleFile *file) { + int v = proc31(); + file->writeNumber(v); + + if (v > 0 && _subPtr) { + warning("TODO"); + } +} + +void TTNpcScript::loadBody(SimpleFile *file) { + int count = file->readNumber(); + preLoad(); + + for (int index = 0; index < count; index += 2) { + int v = file->readNumber(); + + if (_subPtr) { + error("TODO - %d", v); + } + } +} + +int TTNpcScript::proc31() { + warning("TODO"); + return 0; +} + +void TTNpcScript::proc32() { + warning("TODO"); +} + +void TTNpcScript::proc33(int v1, int v2) { + warning("TODO"); +} + +int TTNpcScript::proc34() { + warning("TODO"); + return 0; +} + +int TTNpcScript::getDialLevel(uint dialNum, bool flag) { + warning("TODO"); + return 0; +} + +int TTNpcScript::proc36() const { + return 0; +} + +int TTNpcScript::proc37() const { + return 0; +} + +void TTNpcScript::preLoad() { + if (_subPtr) { + error("TODO"); + } +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h new file mode 100644 index 0000000000..2f0370107e --- /dev/null +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -0,0 +1,120 @@ +/* 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. + * + */ + +#ifndef TITANIC_TT_NPC_SCRIPT_H +#define TITANIC_TT_NPC_SCRIPT_H + +#include "titanic/support/simple_file.h" +#include "titanic/true_talk/tt_script_base.h" + +namespace Titanic { + + +class TTNpcScriptBase : public TTScriptBase { +protected: + int _field54; + int _val2; +public: + int _charId; +public: + TTNpcScriptBase(int charId, const char *charClass, int v2, + const char *charName, int v3, int val2, int v4, + int v5, int v6, int v7); + + virtual int proc6() const = 0; + virtual void proc7(int v1, int v2) = 0; + virtual int proc8() const = 0; + virtual int proc9() const = 0; + virtual int proc10() const = 0; + virtual int proc11() const = 0; + virtual int proc12() const = 0; + + int charId() const { return _charId; } +}; + +class TTNpcScript : public TTNpcScriptBase { +protected: + byte *_subPtr; + int _field60; + int _field64; + int _field68; + int _field6C; + int _field70; + int _field74; + int _field78; + int _field7C; + int _field80; + int _array[147]; +protected: + void resetFlags(); + + void randomizeFlags(); +public: + TTNpcScript(int charId, const char *charClass, int v2, + const char *charName, int v3, int val2, int v4, + int v5, int v6, int v7); + + virtual void proc4(int v); + virtual int proc6() const; + virtual void proc7(int v1, int v2); + virtual int proc8() const; + virtual int proc9() const; + virtual int proc10() const; + virtual int proc11() const; + virtual int proc12() const; + virtual bool proc13() const; + virtual void proc14(int v); + virtual int proc15() const; + virtual bool proc16() const; + virtual bool proc17() const; + virtual bool proc18() const; + virtual void proc19(int v); + virtual void proc20(int v); + virtual int proc21(int v); + virtual int proc22() const; + virtual int proc23() const; + virtual void proc24() = 0; + virtual int proc25() const; + virtual void proc26(); + virtual void save(SimpleFile *file); + virtual void load(SimpleFile *file); + virtual void saveBody(SimpleFile *file); + virtual void loadBody(SimpleFile *file); + virtual int proc31(); + virtual void proc32(); + virtual void proc33(int v1, int v2); + virtual int proc34(); + + /** + * Get the NPC's dial level + */ + virtual int getDialLevel(uint dialNum, bool flag = true); + + virtual int proc36() const; + virtual int proc37() const; + + void preLoad(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_NPC_SCRIPT_H */ diff --git a/engines/titanic/true_talk/tt_scripts.cpp b/engines/titanic/true_talk/tt_scripts.cpp index 9bfa31af8b..bfcfabe059 100644 --- a/engines/titanic/true_talk/tt_scripts.cpp +++ b/engines/titanic/true_talk/tt_scripts.cpp @@ -33,11 +33,11 @@ namespace Titanic { -TTNamedScript *TTNamedScriptList::findById(int charId) const { - for (TTNamedScriptList::const_iterator i = begin(); i != end(); ++i) { - const TTNamedScriptListItem *item = *i; - if (item->_script->_charId == charId) - return item->_script; +TTNpcScript *TTNpcScriptList::findById(int charId) const { + for (TTNpcScriptList::const_iterator i = begin(); i != end(); ++i) { + const TTNpcScriptListItem *item = *i; + if (item->_npcScript->_charId == charId) + return item->_npcScript; } return nullptr; @@ -74,14 +74,14 @@ TTScripts::TTScripts(CTitleEngine *titleEngine) : addScript(new SuccUBusScript(111, "Succubus", 0, "Shorbert", 9, 1, -1, -1, -1, 0), 110); } -void TTScripts::addScript(TTNamedScript *script, int scriptId) { +void TTScripts::addScript(TTNpcScript *script, int scriptId) { script->proc13(); // Find the room script this is associated with TTRoomScript *roomScript = getRoomScript(scriptId); assert(roomScript); - _namedScripts.push_back(new TTNamedScriptListItem(script, roomScript)); + _namedScripts.push_back(new TTNpcScriptListItem(script, roomScript)); } void TTScripts::addScript(TTRoomScript *script) { @@ -92,7 +92,7 @@ TTRoomScript *TTScripts::getRoomScript(int scriptId) const { return _roomScripts.findById(scriptId); } -TTNamedScript *TTScripts::getNamedScript(int charId) const { +TTNpcScript *TTScripts::getNamedScript(int charId) const { return _namedScripts.findById(charId); } diff --git a/engines/titanic/true_talk/tt_scripts.h b/engines/titanic/true_talk/tt_scripts.h index 00638a03d5..7ee7263140 100644 --- a/engines/titanic/true_talk/tt_scripts.h +++ b/engines/titanic/true_talk/tt_scripts.h @@ -24,29 +24,29 @@ #define TITANIC_TT_SCRIPTS_H #include "titanic/core/list.h" -#include "titanic/true_talk/tt_named_script.h" +#include "titanic/true_talk/tt_npc_script.h" #include "titanic/true_talk/tt_room_script.h" namespace Titanic { class CTitleEngine; -class TTNamedScriptListItem : public ListItem { +class TTNpcScriptListItem : public ListItem { public: - TTNamedScript *_script; + TTNpcScript *_npcScript; TTRoomScript *_roomScript; public: - TTNamedScriptListItem() : _script(nullptr), _roomScript(nullptr) {} - TTNamedScriptListItem(TTNamedScript *script, TTRoomScript *roomScript) : - _script(script), _roomScript(roomScript) {} - virtual ~TTNamedScriptListItem() { delete _script; } + TTNpcScriptListItem() : _npcScript(nullptr), _roomScript(nullptr) {} + TTNpcScriptListItem(TTNpcScript *script, TTRoomScript *roomScript) : + _npcScript(script), _roomScript(roomScript) {} + virtual ~TTNpcScriptListItem() { delete _npcScript; } }; PTR_LIST_ITEM(TTRoomScript); -class TTNamedScriptList : public List { +class TTNpcScriptList : public List { public: - TTNamedScript *findById(int charId) const; + TTNpcScript *findById(int charId) const; }; class TTRoomScriptList : public List { @@ -56,7 +56,7 @@ public: class TTScripts { private: - TTNamedScriptList _namedScripts; + TTNpcScriptList _namedScripts; TTRoomScriptList _roomScripts; CTitleEngine *_titleEngine; int _field24; @@ -65,7 +65,7 @@ private: /** * Add a named script to the named scripts list */ - void addScript(TTNamedScript *script, int charId); + void addScript(TTNpcScript *script, int charId); /** * Add an unnamed script to the unnamed scripts list @@ -82,7 +82,7 @@ public: /** * Return a pointer to the specified named character script */ - TTNamedScript *getNamedScript(int charId) const; + TTNpcScript *getNamedScript(int charId) const; }; } // End of namespace Titanic -- cgit v1.2.3 From bac4ced73d53949408a4b1231c42d75eab8ee44c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 7 May 2016 22:45:52 -0400 Subject: TITANIC: Further renaming of named scripts to npc scripts --- engines/titanic/true_talk/true_talk_manager.cpp | 24 ++++++++++++------------ engines/titanic/true_talk/tt_scripts.cpp | 6 +++--- engines/titanic/true_talk/tt_scripts.h | 6 +++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index d4674233dc..4b1dab0046 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -177,13 +177,13 @@ void CTrueTalkManager::setFlags(int index, int val) { } void CTrueTalkManager::loadNPC(SimpleFile *file, int charId) { - TTNpcScript *script = _scripts.getNamedScript(charId); + TTNpcScript *script = _scripts.getNpcScript(charId); if (script) script->load(file); } void CTrueTalkManager::saveNPC(SimpleFile *file, int charId) const { - TTNpcScript *script = _scripts.getNamedScript(charId); + TTNpcScript *script = _scripts.getNpcScript(charId); if (script) { script->save(file); file->writeNumber(MKTAG_BE('U', 'R', 'A', 'H')); @@ -232,23 +232,23 @@ void CTrueTalkManager::start(CTrueTalkNPC *npc, uint id, CViewItem *view) { TTNpcScript *CTrueTalkManager::getTalker(const CString &name) const { if (name.contains("Doorbot")) - return _scripts.getNamedScript(104); + return _scripts.getNpcScript(104); else if (name.contains("DeskBot")) - return _scripts.getNamedScript(103); + return _scripts.getNpcScript(103); else if (name.contains("LiftBot")) - return _scripts.getNamedScript(105); + return _scripts.getNpcScript(105); else if (name.contains("Parrot")) - return _scripts.getNamedScript(107); + return _scripts.getNpcScript(107); else if (name.contains("BarBot")) - return _scripts.getNamedScript(100); + return _scripts.getNpcScript(100); else if (name.contains("ChatterBot")) - return _scripts.getNamedScript(102); + return _scripts.getNpcScript(102); else if (name.contains("BellBot")) - return _scripts.getNamedScript(101); + return _scripts.getNpcScript(101); else if (name.contains("MaitreD")) - return _scripts.getNamedScript(112); + return _scripts.getNpcScript(112); else if (name.contains("Succubus") || name.contains("Sub")) - return _scripts.getNamedScript(111); + return _scripts.getNpcScript(111); return nullptr; } @@ -259,7 +259,7 @@ TTNpcScript *CTrueTalkManager::getNpcScript(CTrueTalkNPC *npc) const { if (!script) { // Fall back on the default NPC script - script = _scripts.getNamedScript(101); + script = _scripts.getNpcScript(101); } return script; diff --git a/engines/titanic/true_talk/tt_scripts.cpp b/engines/titanic/true_talk/tt_scripts.cpp index bfcfabe059..96daf76827 100644 --- a/engines/titanic/true_talk/tt_scripts.cpp +++ b/engines/titanic/true_talk/tt_scripts.cpp @@ -81,7 +81,7 @@ void TTScripts::addScript(TTNpcScript *script, int scriptId) { TTRoomScript *roomScript = getRoomScript(scriptId); assert(roomScript); - _namedScripts.push_back(new TTNpcScriptListItem(script, roomScript)); + _npcScripts.push_back(new TTNpcScriptListItem(script, roomScript)); } void TTScripts::addScript(TTRoomScript *script) { @@ -92,8 +92,8 @@ TTRoomScript *TTScripts::getRoomScript(int scriptId) const { return _roomScripts.findById(scriptId); } -TTNpcScript *TTScripts::getNamedScript(int charId) const { - return _namedScripts.findById(charId); +TTNpcScript *TTScripts::getNpcScript(int charId) const { + return _npcScripts.findById(charId); } } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_scripts.h b/engines/titanic/true_talk/tt_scripts.h index 7ee7263140..8dd2e9305d 100644 --- a/engines/titanic/true_talk/tt_scripts.h +++ b/engines/titanic/true_talk/tt_scripts.h @@ -56,7 +56,7 @@ public: class TTScripts { private: - TTNpcScriptList _namedScripts; + TTNpcScriptList _npcScripts; TTRoomScriptList _roomScripts; CTitleEngine *_titleEngine; int _field24; @@ -80,9 +80,9 @@ public: TTRoomScript *getRoomScript(int scriptId) const; /** - * Return a pointer to the specified named character script + * Return a pointer to the specified character script */ - TTNpcScript *getNamedScript(int charId) const; + TTNpcScript *getNpcScript(int charId) const; }; } // End of namespace Titanic -- cgit v1.2.3 From f706ef374958923c8936e51bf544a01f51ab2066 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 7 May 2016 23:35:11 -0400 Subject: TITANIC: Fleshing out room item and PetText loading code --- engines/titanic/core/room_item.cpp | 12 +++++++++--- engines/titanic/core/room_item.h | 7 +++++-- engines/titanic/pet_control/pet_text.cpp | 8 +++++--- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/engines/titanic/core/room_item.cpp b/engines/titanic/core/room_item.cpp index b1c9aeeb10..6143849661 100644 --- a/engines/titanic/core/room_item.cpp +++ b/engines/titanic/core/room_item.cpp @@ -78,7 +78,7 @@ void CRoomItem::load(SimpleFile *file) { file->readBuffer(); _clipList.load(file); - loading(); + postLoad(); // Deliberate fall-through case 0: @@ -99,8 +99,14 @@ void CRoomItem::load(SimpleFile *file) { CNamedItem::load(file); } -void CRoomItem::loading() { - warning("TODO: CRoomItem::loading"); +void CRoomItem::postLoad() { + if (!_exitMovieKey.exists().empty()) + return; + + CString name = _transitionMovieKey.exists(); + if (name.right(7) == "nav.avi") { + _exitMovieKey = CResourceKey(name.left(name.size() - 7) + "exit.avi"); + } } void CRoomItem::calcNodePosition(const Point &nodePos, double &xVal, double &yVal) const { diff --git a/engines/titanic/core/room_item.h b/engines/titanic/core/room_item.h index 519accd79c..e3ba71c0ae 100644 --- a/engines/titanic/core/room_item.h +++ b/engines/titanic/core/room_item.h @@ -32,6 +32,11 @@ namespace Titanic { class CRoomItem : public CNamedItem { +private: + /** + * Handles post-load processing + */ + void postLoad(); public: Rect _roomRect; CMovieClipList _clipList; @@ -39,8 +44,6 @@ public: CResourceKey _transitionMovieKey; CResourceKey _exitMovieKey; double _roomDimensionX, _roomDimensionY; - - void loading(); public: CLASSDEF CRoomItem(); diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index e6b90c127c..a8d9ba6eb5 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -80,8 +80,8 @@ void CPetText::setLineColor(uint lineNum, byte r, byte g, byte b) { void CPetText::load(SimpleFile *file, int param) { if (!param) { - int var1 = file->readNumber(); - int var2 = file->readNumber(); + uint numLines = file->readNumber(); + uint charsPerLine = file->readNumber(); uint count = file->readNumber(); _bounds = file->readRect(); _field3C = file->readNumber(); @@ -96,7 +96,9 @@ void CPetText::load(SimpleFile *file, int param) { _hasBorder = file->readNumber() != 0; _scrollTop = file->readNumber(); - warning("TODO: CPetText::load %d,%d", var1, var2); + resize(numLines); + setMaxCharsPerLine(charsPerLine); + assert(_array.size() >= count); for (uint idx = 0; idx < count; ++idx) { _array[idx]._line = file->readString(); -- cgit v1.2.3 From 74935b371fa94637f5592e402110c3b41cd0b3c4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 8 May 2016 10:59:03 -0400 Subject: TITANIC: Implementing scriptChanged methods --- engines/titanic/game_manager.cpp | 4 ---- engines/titanic/game_manager.h | 2 -- engines/titanic/true_talk/script_handler.cpp | 8 ++++++-- engines/titanic/true_talk/script_handler.h | 14 +++++++++++++- engines/titanic/true_talk/true_talk_manager.cpp | 2 +- engines/titanic/true_talk/tt_npc_script.cpp | 4 ---- engines/titanic/true_talk/tt_npc_script.h | 16 ++++++++++++++-- engines/titanic/true_talk/tt_room_script.cpp | 6 ++++-- engines/titanic/true_talk/tt_room_script.h | 21 +++++++++++++++++++-- 9 files changed, 57 insertions(+), 20 deletions(-) diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index 1ce9436685..fd2f553b8e 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -107,10 +107,6 @@ void CGameManager::initBounds() { _bounds = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); } -void CGameManager::fn2() { - warning("TODO"); -} - void CGameManager::playClip(CMovieClip *clip, CRoomItem *oldRoom, CRoomItem *newRoom) { warning("TODO: CGameManager::playClip"); } diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index e52426592b..c4e6bc6ec8 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -136,8 +136,6 @@ public: */ void initBounds(); - void fn2(); - /** * Plays a movie clip */ diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index ef5814c3f2..e902d0c874 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -29,8 +29,12 @@ namespace Titanic { CScriptHandler::CScriptHandler(CTitleEngine *owner, int val1, int val2) { } -void CScriptHandler::setup(TTRoomScript *roomScript, TTNpcScript *npcScript, uint charId) { - // TODO +int CScriptHandler::scriptChanged(TTRoomScript *roomScript, TTNpcScript *npcScript, uint dialogueId) { + if (!npcScript || !roomScript) { + ++_inputCtr; + return 5; + } + } void CScriptHandler::processInput(TTRoomScript *roomScript, TTNpcScript *npcScript, diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index 6a1e0dc0f1..868a2c3eaa 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -34,13 +34,25 @@ class CTitleEngine; class CScriptHandler { private: CTitleEngine *_owner; + TTScriptBase *_script; + int _field8; + int _fieldC; + int _field10; + int _field14; + int _field18; + int _inputCtr; + int _field20; + int _field24; + int _field28; + int _field2C; + int _field30; public: CScriptHandler(CTitleEngine *owner, int val1, int val2); /** * Set the character and room */ - void setup(TTRoomScript *roomScript, TTNpcScript *npcScript, uint charId); + int scriptChanged(TTRoomScript *roomScript, TTNpcScript *npcScript, uint dialogueId); void processInput(TTRoomScript *roomScript, TTNpcScript *npcScript, const TTString &line); diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 4b1dab0046..0b841aca00 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -224,7 +224,7 @@ void CTrueTalkManager::start(CTrueTalkNPC *npc, uint id, CViewItem *view) { loadAssets(npc, charId); _currentNPC = npc; - _titleEngine._scriptHandler->setup(roomScript, npcScript, charId); + _titleEngine._scriptHandler->scriptChanged(roomScript, npcScript, id); _currentNPC = nullptr; setDialogue(npc, roomScript, view); diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index dfe8ac0ada..40a50be030 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -79,10 +79,6 @@ int TTNpcScript::proc9() const { return 2; } -int TTNpcScript::proc10() const { - return 2; -} - int TTNpcScript::proc11() const { return 2; } diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 2f0370107e..c11dc6d0b8 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -44,7 +44,12 @@ public: virtual void proc7(int v1, int v2) = 0; virtual int proc8() const = 0; virtual int proc9() const = 0; - virtual int proc10() const = 0; + + /** + * Called when the script/id changes + */ + virtual int scriptChanged(TTScriptBase *roomScript, uint id) = 0; + virtual int proc11() const = 0; virtual int proc12() const = 0; @@ -78,7 +83,14 @@ public: virtual void proc7(int v1, int v2); virtual int proc8() const; virtual int proc9() const; - virtual int proc10() const; + + /** + * Called when the script/id changes + */ + virtual int scriptChanged(TTScriptBase *roomScript, uint id) { + return 2; + } + virtual int proc11() const; virtual int proc12() const; virtual bool proc13() const; diff --git a/engines/titanic/true_talk/tt_room_script.cpp b/engines/titanic/true_talk/tt_room_script.cpp index 1c37a39bf0..37fba1f1a9 100644 --- a/engines/titanic/true_talk/tt_room_script.cpp +++ b/engines/titanic/true_talk/tt_room_script.cpp @@ -53,8 +53,10 @@ void TTRoomScript::proc9() { warning("TODO"); } -void TTRoomScript::proc10() { - warning("TODO"); +int TTRoomScript::scriptChanged(TTScriptBase *npcScript, int id) { + if (id == 1) + _field54 = 1; + return 1; } void TTRoomScript::proc11() { diff --git a/engines/titanic/true_talk/tt_room_script.h b/engines/titanic/true_talk/tt_room_script.h index ed17b29e9c..f64570995c 100644 --- a/engines/titanic/true_talk/tt_room_script.h +++ b/engines/titanic/true_talk/tt_room_script.h @@ -38,7 +38,12 @@ public: virtual void proc7() = 0; virtual void proc8() = 0; virtual void proc9() = 0; - virtual void proc10() = 0; + + /** + * Called when the script changes + */ + virtual int scriptChanged(TTScriptBase *npcScript, int id) = 0; + virtual void proc11() = 0; }; @@ -53,8 +58,20 @@ public: virtual void proc7(); virtual void proc8(); virtual void proc9(); - virtual void proc10(); + + /** + * Called when the script changes + */ + virtual int scriptChanged(TTScriptBase *npcScript, int id); + virtual void proc11(); + + /** + * Called with the new script and id + */ + int notifyScript(TTScriptBase *npcScript, int id) { + return scriptChanged(npcScript, id); + } }; } // End of namespace Titanic -- cgit v1.2.3 From c4375b134a57e3217d24e146592560f1ba9342d7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 8 May 2016 12:09:32 -0400 Subject: TITANIC: Beginnings of STVocab class, CScriptHandler constructor --- engines/titanic/module.mk | 2 ++ engines/titanic/support/file_reader.cpp | 29 ++++++++++++++++ engines/titanic/support/file_reader.h | 38 +++++++++++++++++++++ engines/titanic/titanic.h | 2 ++ engines/titanic/true_talk/script_handler.cpp | 7 +++- engines/titanic/true_talk/script_handler.h | 6 ++-- engines/titanic/true_talk/st_vocab.cpp | 37 ++++++++++++++++++++ engines/titanic/true_talk/st_vocab.h | 50 ++++++++++++++++++++++++++++ engines/titanic/true_talk/title_engine.h | 3 +- 9 files changed, 169 insertions(+), 5 deletions(-) create mode 100644 engines/titanic/support/file_reader.cpp create mode 100644 engines/titanic/support/file_reader.h create mode 100644 engines/titanic/true_talk/st_vocab.cpp create mode 100644 engines/titanic/true_talk/st_vocab.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index a0f0efb7b0..d808f77928 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -431,6 +431,7 @@ MODULE_OBJS := \ star_control/star_control_sub15.o \ support/direct_draw.o \ support/direct_draw_surface.o \ + support/file_reader.o \ support/files_manager.o \ support/font.o \ support/image.o \ @@ -458,6 +459,7 @@ MODULE_OBJS := \ true_talk/succubus_script.o \ true_talk/title_engine.o \ true_talk/script_handler.o \ + true_talk/st_vocab.o \ true_talk/true_talk_manager.o \ true_talk/tt_script_base.o \ true_talk/tt_room_script.o \ diff --git a/engines/titanic/support/file_reader.cpp b/engines/titanic/support/file_reader.cpp new file mode 100644 index 0000000000..c332d9995c --- /dev/null +++ b/engines/titanic/support/file_reader.cpp @@ -0,0 +1,29 @@ +/* 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 "titanic/support/file_reader.h" + +namespace Titanic { + + + +} // End of namespace Titanic diff --git a/engines/titanic/support/file_reader.h b/engines/titanic/support/file_reader.h new file mode 100644 index 0000000000..7e9eb1ac20 --- /dev/null +++ b/engines/titanic/support/file_reader.h @@ -0,0 +1,38 @@ +/* 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. + * + */ + +#ifndef TITANIC_FILE_READER_H +#define TITANIC_FILE_READER_H + +#include "common/file.h" + +namespace Titanic { + +class CFileReader { +public: + Common::File _file; +public: +}; + +} // End of namespace Titanic + +#endif /* TITANIC_FILE_READER_H */ diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index a5cf0ff9b8..b773bec332 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -34,6 +34,7 @@ #include "titanic/events.h" #include "titanic/support/files_manager.h" #include "titanic/main_game_window.h" +#include "titanic/support/file_reader.h" #include "titanic/support/movie.h" #include "titanic/support/screen_manager.h" #include "titanic/support/string.h" @@ -116,6 +117,7 @@ public: OSScreenManager *_screenManager; CMainGameWindow *_window; Common::RandomSource _randomSource; + CFileReader _fileReader; CMovieList _activeMovies; CString _itemNames[TOTAL_ITEMS]; CString _itemDescriptions[TOTAL_ITEMS]; diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index e902d0c874..beb5bee996 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -21,12 +21,17 @@ */ #include "titanic/true_talk/script_handler.h" +#include "titanic/titanic.h" namespace Titanic { /*------------------------------------------------------------------------*/ -CScriptHandler::CScriptHandler(CTitleEngine *owner, int val1, int val2) { +CScriptHandler::CScriptHandler(CTitleEngine *owner, int val1, int val2) : + _owner(owner), _script(owner->_script), _reader(g_vm->_fileReader), + _vocab(val2), _field10(0), _field14(0), _field18(0), _inputCtr(0), + _field20(0), _field24(0), _field28(0), _field2C(0), _field30(0) { + } int CScriptHandler::scriptChanged(TTRoomScript *roomScript, TTNpcScript *npcScript, uint dialogueId) { diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index 868a2c3eaa..fba1e41a2e 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -26,6 +26,8 @@ #include "titanic/true_talk/tt_npc_script.h" #include "titanic/true_talk/tt_room_script.h" #include "titanic/true_talk/tt_string.h" +#include "titanic/true_talk/st_vocab.h" +#include "titanic/support/file_reader.h" namespace Titanic { @@ -35,8 +37,8 @@ class CScriptHandler { private: CTitleEngine *_owner; TTScriptBase *_script; - int _field8; - int _fieldC; + CFileReader &_reader; + STVocab _vocab; int _field10; int _field14; int _field18; diff --git a/engines/titanic/true_talk/st_vocab.cpp b/engines/titanic/true_talk/st_vocab.cpp new file mode 100644 index 0000000000..ed41a4a61b --- /dev/null +++ b/engines/titanic/true_talk/st_vocab.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/true_talk/st_vocab.h" + +namespace Titanic { + +STVocab::STVocab(int val): _field0(0), _field4(0), _field8(0), + _fieldC(0), _field10(0), _field18(val) { + _field14 = load("STvocab.txt"); +} + +int STVocab::load(const CString &name) { + // TODO + return 0; +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/st_vocab.h b/engines/titanic/true_talk/st_vocab.h new file mode 100644 index 0000000000..2b4ebb8d72 --- /dev/null +++ b/engines/titanic/true_talk/st_vocab.h @@ -0,0 +1,50 @@ +/* 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. + * + */ + +#ifndef TITANIC_ST_VOCAB_H +#define TITANIC_ST_VOCAB_H + +#include "titanic/support/string.h" + +namespace Titanic { + +class STVocab { +private: + int _field0; + int _field4; + int _field8; + int _fieldC; + int _field10; + int _field14; + int _field18; +private: + /** + * Load the vocab data + */ + int load(const CString &name); +public: + STVocab(int val); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ST_VOCAB_H */ diff --git a/engines/titanic/true_talk/title_engine.h b/engines/titanic/true_talk/title_engine.h index 389e376516..12a02e2b81 100644 --- a/engines/titanic/true_talk/title_engine.h +++ b/engines/titanic/true_talk/title_engine.h @@ -33,10 +33,9 @@ namespace Titanic { class CTitleEngine { -protected: - TTScriptBase *_script; public: CScriptHandler *_scriptHandler; + TTScriptBase *_script; public: CTitleEngine(); ~CTitleEngine(); -- cgit v1.2.3 From 71179e376363c1c59b9c7819bfbe89196c7bbc23 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 8 May 2016 14:37:18 -0400 Subject: TITANIC: More script handler setup --- engines/titanic/support/file_reader.cpp | 4 ++++ engines/titanic/support/file_reader.h | 2 ++ engines/titanic/titanic.cpp | 2 ++ engines/titanic/titanic.h | 3 +++ engines/titanic/true_talk/script_handler.cpp | 17 ++++++++++---- engines/titanic/true_talk/script_handler.h | 33 +++++++++++++++++++++++++--- engines/titanic/true_talk/tt_npc_script.h | 13 ++++++++--- engines/titanic/true_talk/tt_room_script.cpp | 5 +++-- engines/titanic/true_talk/tt_room_script.h | 6 ++--- engines/titanic/true_talk/tt_script_base.h | 4 ++++ 10 files changed, 74 insertions(+), 15 deletions(-) diff --git a/engines/titanic/support/file_reader.cpp b/engines/titanic/support/file_reader.cpp index c332d9995c..308d748704 100644 --- a/engines/titanic/support/file_reader.cpp +++ b/engines/titanic/support/file_reader.cpp @@ -24,6 +24,10 @@ namespace Titanic { +void CFileReader::reset() { + _file.close(); + _field18 = 0; +} } // End of namespace Titanic diff --git a/engines/titanic/support/file_reader.h b/engines/titanic/support/file_reader.h index 7e9eb1ac20..23ab0a6fce 100644 --- a/engines/titanic/support/file_reader.h +++ b/engines/titanic/support/file_reader.h @@ -30,7 +30,9 @@ namespace Titanic { class CFileReader { public: Common::File _file; + int _field18; public: + void reset(); }; } // End of namespace Titanic diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index f1d24a0a1e..e70a208552 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -53,6 +53,8 @@ TitanicEngine::TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDe _window = nullptr; _screen = nullptr; _screenManager = nullptr; + _scriptHandler = nullptr; + _script = nullptr; } TitanicEngine::~TitanicEngine() { diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index b773bec332..653ace534b 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -38,6 +38,7 @@ #include "titanic/support/movie.h" #include "titanic/support/screen_manager.h" #include "titanic/support/string.h" +#include "titanic/true_talk/tt_script_base.h" /** * This is the namespace of the Titanic engine. @@ -117,6 +118,8 @@ public: OSScreenManager *_screenManager; CMainGameWindow *_window; Common::RandomSource _randomSource; + CScriptHandler *_scriptHandler; + TTScriptBase *_script; CFileReader _fileReader; CMovieList _activeMovies; CString _itemNames[TOTAL_ITEMS]; diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index beb5bee996..bd98aad15f 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -29,17 +29,26 @@ namespace Titanic { CScriptHandler::CScriptHandler(CTitleEngine *owner, int val1, int val2) : _owner(owner), _script(owner->_script), _reader(g_vm->_fileReader), - _vocab(val2), _field10(0), _field14(0), _field18(0), _inputCtr(0), + _vocab(val2), _sub1(), _sub2(this), _field10(0), _inputCtr(0), _field20(0), _field24(0), _field28(0), _field2C(0), _field30(0) { - + g_vm->_scriptHandler = this; + g_vm->_script = _script; } -int CScriptHandler::scriptChanged(TTRoomScript *roomScript, TTNpcScript *npcScript, uint dialogueId) { +ScriptChangedResult CScriptHandler::scriptChanged(TTRoomScript *roomScript, TTNpcScript *npcScript, uint dialogueId) { if (!npcScript || !roomScript) { ++_inputCtr; - return 5; + return SCR_5; } + ScriptChangedResult result = roomScript->notifyScript(npcScript, dialogueId); + if (result == SCR_1) + result = npcScript->notifyScript(roomScript, dialogueId); + + if (result != SCR_3 && result != SCR_4) + return result; + + error("TODO: CScriptHandler::scriptChanged"); } void CScriptHandler::processInput(TTRoomScript *roomScript, TTNpcScript *npcScript, diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index fba1e41a2e..16dff1bf36 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -32,6 +32,33 @@ namespace Titanic { class CTitleEngine; +class CScriptHandler; + +class CScriptHandlerSub1 { +public: + int _field0; + int _field4; + int _field8; + int _fieldC; + int _field10; +public: + CScriptHandlerSub1() : _field0(0), _field4(0), _field8(0), + _fieldC(0), _field10(0) {} +}; + +class CScriptHandlerSub2 { +public: + CScriptHandler *_owner; + int _field4; + int _field8; + int _fieldC; + int _field10; + int _field14; + int _field18; +public: + CScriptHandlerSub2(CScriptHandler *owner) : _owner(owner), _field4(0), _field8(0), + _fieldC(0), _field10(0), _field14(0), _field18(0) {} +}; class CScriptHandler { private: @@ -40,8 +67,8 @@ private: CFileReader &_reader; STVocab _vocab; int _field10; - int _field14; - int _field18; + CScriptHandlerSub1 _sub1; + CScriptHandlerSub2 _sub2; int _inputCtr; int _field20; int _field24; @@ -54,7 +81,7 @@ public: /** * Set the character and room */ - int scriptChanged(TTRoomScript *roomScript, TTNpcScript *npcScript, uint dialogueId); + ScriptChangedResult scriptChanged(TTRoomScript *roomScript, TTNpcScript *npcScript, uint dialogueId); void processInput(TTRoomScript *roomScript, TTNpcScript *npcScript, const TTString &line); diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index c11dc6d0b8..f3df956850 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -48,7 +48,7 @@ public: /** * Called when the script/id changes */ - virtual int scriptChanged(TTScriptBase *roomScript, uint id) = 0; + virtual ScriptChangedResult scriptChanged(TTScriptBase *roomScript, uint id) = 0; virtual int proc11() const = 0; virtual int proc12() const = 0; @@ -87,8 +87,8 @@ public: /** * Called when the script/id changes */ - virtual int scriptChanged(TTScriptBase *roomScript, uint id) { - return 2; + virtual ScriptChangedResult scriptChanged(TTScriptBase *roomScript, uint id) { + return SCR_2; } virtual int proc11() const; @@ -125,6 +125,13 @@ public: virtual int proc37() const; void preLoad(); + + /** + * Called with the script and id changes + */ + ScriptChangedResult notifyScript(TTScriptBase *npcScript, int id) { + return scriptChanged(npcScript, id); + } }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_room_script.cpp b/engines/titanic/true_talk/tt_room_script.cpp index 37fba1f1a9..2ade0495cf 100644 --- a/engines/titanic/true_talk/tt_room_script.cpp +++ b/engines/titanic/true_talk/tt_room_script.cpp @@ -53,10 +53,11 @@ void TTRoomScript::proc9() { warning("TODO"); } -int TTRoomScript::scriptChanged(TTScriptBase *npcScript, int id) { +ScriptChangedResult TTRoomScript::scriptChanged(TTScriptBase *npcScript, int id) { if (id == 1) _field54 = 1; - return 1; + + return SCR_1; } void TTRoomScript::proc11() { diff --git a/engines/titanic/true_talk/tt_room_script.h b/engines/titanic/true_talk/tt_room_script.h index f64570995c..30133b24da 100644 --- a/engines/titanic/true_talk/tt_room_script.h +++ b/engines/titanic/true_talk/tt_room_script.h @@ -42,7 +42,7 @@ public: /** * Called when the script changes */ - virtual int scriptChanged(TTScriptBase *npcScript, int id) = 0; + virtual ScriptChangedResult scriptChanged(TTScriptBase *npcScript, int id) = 0; virtual void proc11() = 0; }; @@ -62,14 +62,14 @@ public: /** * Called when the script changes */ - virtual int scriptChanged(TTScriptBase *npcScript, int id); + virtual ScriptChangedResult scriptChanged(TTScriptBase *npcScript, int id); virtual void proc11(); /** * Called with the new script and id */ - int notifyScript(TTScriptBase *npcScript, int id) { + ScriptChangedResult notifyScript(TTScriptBase *npcScript, int id) { return scriptChanged(npcScript, id); } }; diff --git a/engines/titanic/true_talk/tt_script_base.h b/engines/titanic/true_talk/tt_script_base.h index 4021a0b738..fe999ab290 100644 --- a/engines/titanic/true_talk/tt_script_base.h +++ b/engines/titanic/true_talk/tt_script_base.h @@ -27,6 +27,10 @@ namespace Titanic { +enum ScriptChangedResult { + SCR_1 = 1, SCR_2 = 2, SCR_3 = 3, SCR_4 = 4, SCR_5 = 5 +}; + class TTScriptBase { private: void reset(); -- cgit v1.2.3 From 9ce6391a94db959f3dde54ed3d0153e000aa3d5a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 8 May 2016 20:57:03 -0400 Subject: TITANIC: Beginnings of TTWord hierarchy --- engines/titanic/module.mk | 3 +- engines/titanic/support/file_reader.cpp | 9 ++- engines/titanic/support/file_reader.h | 13 +++- engines/titanic/support/simple_file.cpp | 23 ++++++++ engines/titanic/support/simple_file.h | 13 ++++ engines/titanic/true_talk/script_handler.cpp | 6 +- engines/titanic/true_talk/script_handler.h | 5 ++ engines/titanic/true_talk/st_vocab.cpp | 20 ++++++- engines/titanic/true_talk/st_vocab.h | 4 +- engines/titanic/true_talk/title_engine.cpp | 15 +++-- engines/titanic/true_talk/title_engine.h | 21 +++---- engines/titanic/true_talk/tt_string.cpp | 38 ++++++++++++ engines/titanic/true_talk/tt_string.h | 39 +++++++++--- engines/titanic/true_talk/tt_word.cpp | 75 ++++++++++++++++++++++++ engines/titanic/true_talk/tt_word.h | 88 ++++++++++++++++++++++++++++ 15 files changed, 333 insertions(+), 39 deletions(-) create mode 100644 engines/titanic/true_talk/tt_word.cpp create mode 100644 engines/titanic/true_talk/tt_word.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index d808f77928..a3d60e7fdb 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -467,7 +467,8 @@ MODULE_OBJS := \ true_talk/tt_scripts.o \ true_talk/tt_string.o \ true_talk/tt_talker.o \ - true_talk/tt_title_script.o + true_talk/tt_title_script.o \ + true_talk/tt_word.o # This module can be built as a plugin ifeq ($(ENABLE_TITANIC), DYNAMIC_PLUGIN) diff --git a/engines/titanic/support/file_reader.cpp b/engines/titanic/support/file_reader.cpp index 308d748704..f31d72bda5 100644 --- a/engines/titanic/support/file_reader.cpp +++ b/engines/titanic/support/file_reader.cpp @@ -24,10 +24,13 @@ namespace Titanic { -void CFileReader::reset() { - _file.close(); - _field18 = 0; +CFileReader::CFileReader() : _owner(nullptr), _field4(0), _field8(0), + _fieldC(0), _field10(0), _field14(0), _field18(0) { } +void CFileReader::reset(CScriptHandler *owner, int val1, int val2) { + _owner = owner; + _field18 = val2; +} } // End of namespace Titanic diff --git a/engines/titanic/support/file_reader.h b/engines/titanic/support/file_reader.h index 23ab0a6fce..7d00ebd80d 100644 --- a/engines/titanic/support/file_reader.h +++ b/engines/titanic/support/file_reader.h @@ -27,12 +27,21 @@ namespace Titanic { +class CScriptHandler; + class CFileReader { public: - Common::File _file; + CScriptHandler *_owner; + int _field4; + int _field8; + int _fieldC; + int _field10; + int _field14; int _field18; public: - void reset(); + CFileReader(); + + void reset(CScriptHandler *owner, int val1, int val2); }; } // End of namespace Titanic diff --git a/engines/titanic/support/simple_file.cpp b/engines/titanic/support/simple_file.cpp index 88d74a9f47..b7f666a1ef 100644 --- a/engines/titanic/support/simple_file.cpp +++ b/engines/titanic/support/simple_file.cpp @@ -354,6 +354,29 @@ void SimpleFile::writeClassEnd(int indent) { write("}\n", 2); } +bool SimpleFile::scanf(const char *format, ...) { + va_list va; + va_start(va, format); + char c; + + CString formatStr(format); + while (!formatStr.empty()) { + if (formatStr.hasPrefix(" ")) { + formatStr.deleteChar(0); + safeRead(&c, 1); + + if (!Common::isSpace(c)) + return false; + } else if (formatStr.hasPrefix("%d")) { + formatStr = CString(formatStr.c_str() + 2); + int *param = (int *)va_arg(va, int *); + *param = readNumber(); + } + } + + va_end(va); +} + /*------------------------------------------------------------------------*/ void StdCWadFile::open(const CString &name) { diff --git a/engines/titanic/support/simple_file.h b/engines/titanic/support/simple_file.h index 115e3805da..431df016ad 100644 --- a/engines/titanic/support/simple_file.h +++ b/engines/titanic/support/simple_file.h @@ -121,6 +121,11 @@ public: */ void readBuffer(char *buffer = nullptr, size_t count = 0); + /** + * Scan in values from the file + */ + bool scanf(const char *format, ...); + /** * Write a string line */ @@ -197,6 +202,14 @@ public: * Write out the ending footer for a class definition */ void writeClassEnd(int indent); + + /** + * Return true if the stream has finished being read + */ + bool eos() const { + assert(_inStream); + return _inStream->eos(); + } }; /** diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index bd98aad15f..09110a3f19 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -53,10 +53,14 @@ ScriptChangedResult CScriptHandler::scriptChanged(TTRoomScript *roomScript, TTNp void CScriptHandler::processInput(TTRoomScript *roomScript, TTNpcScript *npcScript, const TTString &line) { - if (!roomScript || line.empty()) + if (!roomScript || !line.isValid()) return; // TODO } +SimpleFile *CScriptHandler::openResource(const CString &name) { + return _owner->open(name); +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index 16dff1bf36..38da259021 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -85,6 +85,11 @@ public: void processInput(TTRoomScript *roomScript, TTNpcScript *npcScript, const TTString &line); + + /** + * Open a resource for access + */ + SimpleFile *openResource(const CString &name); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/st_vocab.cpp b/engines/titanic/true_talk/st_vocab.cpp index ed41a4a61b..b725101214 100644 --- a/engines/titanic/true_talk/st_vocab.cpp +++ b/engines/titanic/true_talk/st_vocab.cpp @@ -20,18 +20,32 @@ * */ +#include "common/file.h" #include "titanic/true_talk/st_vocab.h" +#include "titanic/titanic.h" namespace Titanic { -STVocab::STVocab(int val): _field0(0), _field4(0), _field8(0), +STVocab::STVocab(int val): _field0(0), _field4(0), _vocab(nullptr), _fieldC(0), _field10(0), _field18(val) { _field14 = load("STvocab.txt"); } int STVocab::load(const CString &name) { - // TODO - return 0; + SimpleFile *file = g_vm->_fileReader._owner->openResource(name); + int result = 0; + + while (!file->eos()) { + int mode = file->readNumber(); + + switch (mode) { + case 0: + break; + } + } + + delete file; + return result; } } // End of namespace Titanic diff --git a/engines/titanic/true_talk/st_vocab.h b/engines/titanic/true_talk/st_vocab.h index 2b4ebb8d72..090dc74237 100644 --- a/engines/titanic/true_talk/st_vocab.h +++ b/engines/titanic/true_talk/st_vocab.h @@ -24,6 +24,8 @@ #define TITANIC_ST_VOCAB_H #include "titanic/support/string.h" +#include "titanic/true_talk/tt_string.h" +#include "titanic/true_talk/tt_word.h" namespace Titanic { @@ -31,7 +33,7 @@ class STVocab { private: int _field0; int _field4; - int _field8; + TTString *_vocab; int _fieldC; int _field10; int _field14; diff --git a/engines/titanic/true_talk/title_engine.cpp b/engines/titanic/true_talk/title_engine.cpp index 3908ea0986..24cc4216ee 100644 --- a/engines/titanic/true_talk/title_engine.cpp +++ b/engines/titanic/true_talk/title_engine.cpp @@ -64,14 +64,13 @@ void STtitleEngine::dump(int val1, int val2) { // TODO } -void STtitleEngine::open(const CString &name) { - _stream = _resources.getResource(Common::WinResourceID("Text"), - name); -} - -void STtitleEngine::close() { - delete _stream; - _stream = nullptr; +SimpleFile *STtitleEngine::open(const CString &name) { + Common::SeekableReadStream *stream = _resources.getResource( + Common::WinResourceID("Text"), name); + + SimpleFile *file = new SimpleFile(); + file->open(stream); + return file; } } // End of namespace Titanic diff --git a/engines/titanic/true_talk/title_engine.h b/engines/titanic/true_talk/title_engine.h index 12a02e2b81..fda35ac7bf 100644 --- a/engines/titanic/true_talk/title_engine.h +++ b/engines/titanic/true_talk/title_engine.h @@ -32,6 +32,13 @@ namespace Titanic { +class CTitleEngine; + +class CTitleStream : public SimpleFile { +public: + CTitleStream() : SimpleFile() {} +}; + class CTitleEngine { public: CScriptHandler *_scriptHandler; @@ -56,12 +63,7 @@ public: /** * Open a designated file */ - virtual void open(const CString &name) = 0; - - /** - * Close the file - */ - virtual void close() = 0; + virtual SimpleFile *open(const CString &name) = 0; }; class STtitleEngine : public CTitleEngine { @@ -96,12 +98,7 @@ public: /** * Open a designated file */ - virtual void open(const CString &name); - - /** - * Close the file - */ - virtual void close(); + virtual SimpleFile *open(const CString &name); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_string.cpp b/engines/titanic/true_talk/tt_string.cpp index f9ae5d6e11..ffe6509e07 100644 --- a/engines/titanic/true_talk/tt_string.cpp +++ b/engines/titanic/true_talk/tt_string.cpp @@ -24,4 +24,42 @@ namespace Titanic { +TTString::TTString() : _status(SS_VALID) { + _data = new TTStringData(); +} + +TTString::TTString(const char *str) : _status(SS_VALID) { + _data = new TTStringData(str); +} + +TTString::TTString(const CString &str) { + if (_status != SS_VALID) { + _status = SS_5; + _data = nullptr; + } else { + _status = SS_VALID; + _data = new TTStringData(str); + } +} + +TTString::TTString(TTString &str) { + if (_status != SS_VALID) { + _status = SS_5; + _data = nullptr; + } else { + _status = SS_VALID; + _data = str._data; + _data->_referenceCount++; + } +} + +TTString::~TTString() { + if (--_data->_referenceCount == 0) + delete _data; +} + +bool TTString::isValid() const { + return _status == SS_VALID; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index d593553f5c..947007f1ff 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -27,18 +27,41 @@ namespace Titanic { -class TTString: public CString { +class TTStringData { +private: + CString _string; public: - int _status; + int _referenceCount; public: - TTString() : CString(), _status(0) {} - TTString(const char *str) : CString(str), _status(0) {} - TTString(const CString &str) : CString(str), _status(0) {} - virtual ~TTString() {} + TTStringData() : _referenceCount(1) {} + TTStringData(const char *str) : _string(str), _referenceCount(1) {} + TTStringData(const CString &str) : _string(str), _referenceCount(1) {} +}; + +enum TTStringStatus { SS_VALID = 0, SS_5 = 5, SS_7 = 7 }; + +class TTString { +private: + TTStringData *_data; + TTStringStatus _status; +public: + TTString(); + TTString(const char *str); + TTString(const CString &str); + TTString(TTString &str); + virtual ~TTString(); + + /** + * Returns true if the string is valid + */ + bool isValid() const; - bool isValid() const { return !_status; } + /** + * Get the status of the string + */ + TTStringStatus getStatus() const { return _status; } }; } // End of namespace Titanic -#endif /* TITANIC_TT_OBJ8_H */ +#endif /* TITANIC_TT_STRING_H */ diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp new file mode 100644 index 0000000000..4405f72555 --- /dev/null +++ b/engines/titanic/true_talk/tt_word.cpp @@ -0,0 +1,75 @@ +/* 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 "titanic/true_talk/tt_word.h" + +namespace Titanic { + +TTWord::TTWord(TTString &str, int val1, int val2) : _string(str), + _field18(val1), _field1C(val2), _fieldC(0), _field10(0), + _field20(0), _field24(0), _field28(0) { + _status = str.getStatus() == SS_VALID ? SS_VALID : SS_5; +} + +/*------------------------------------------------------------------------*/ + +void TTWord::readSyn(SimpleFile *file) { +} + +/*------------------------------------------------------------------------*/ + +TTWord1::TTWord1(TTString &str, int val1, int val2, int val3) : + TTWord(str, val1, val2), _field2C(val3) { +} + +/*------------------------------------------------------------------------*/ + +TTWord2::TTWord2(TTString &str, int val1, int val2, int val3, int val4) : + TTWord1(str, val1, val2, val3), _field30(val4) { +} + +/*------------------------------------------------------------------------*/ + +TTWord3::TTWord3(TTString &str, int val1, int val2, int val3, int val4, int val5, int val6) : + TTWord1(str, val1, val2, val4), _field34(val3), _field30(val5), _field3C(val6), + _field38(0) { +} + +/*------------------------------------------------------------------------*/ + +TTWord4::TTWord4(TTString &str, int val1, int val2, int val3, int val4) : + TTWord1(str, val1, val2, val3) { + if (val4 >= 0 && val4 <= 9) { + _field30 = val4; + } else { + _field30 = 0; + _status = SS_5; + } +} + +/*------------------------------------------------------------------------*/ + +TTWord5::TTWord5(TTString &str, int val1, int val2, int val3, int val4) : + TTWord1(str, val1, val2, val3), _field30(val4) { +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h new file mode 100644 index 0000000000..d8b34ed04e --- /dev/null +++ b/engines/titanic/true_talk/tt_word.h @@ -0,0 +1,88 @@ +/* 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. + * + */ + +#ifndef TITANIC_TT_WORD_H +#define TITANIC_TT_WORD_H + +#include "titanic/support/simple_file.h" +#include "titanic/true_talk/tt_string.h" + +namespace Titanic { + +class TTWord { +protected: + TTString _string; + int _fieldC; + int _field10; + TTStringStatus _status; + int _field18; + int _field1C; + int _field20; + int _field24; + int _field28; +public: + TTWord(TTString &str, int val1, int val2); + + void readSyn(SimpleFile *file); +}; + +class TTWord1 : public TTWord { +protected: + int _field2C; +public: + TTWord1(TTString &str, int val1, int val2, int val3); +}; + +class TTWord2 : public TTWord1 { +protected: + int _field30; +public: + TTWord2(TTString &str, int val1, int val2, int val3, int val4); +}; + +class TTWord3 : public TTWord1 { +protected: + int _field30; + int _field34; + int _field38; + int _field3C; +public: + TTWord3(TTString &str, int val1, int val2, int val3, int val4, int val5, int val6); +}; + +class TTWord4 : public TTWord1 { +protected: + int _field30; +public: + TTWord4(TTString &str, int val1, int val2, int val3, int val4); +}; + +class TTWord5 : public TTWord1 { +protected: + int _field30; +public: + TTWord5(TTString &str, int val1, int val2, int val3, int val4); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_WORD_H */ -- cgit v1.2.3 From bb8f95ba9d08d9e660b22240a59486166011bd0b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 8 May 2016 23:07:53 -0400 Subject: TITANIC: Implementing vocab load --- engines/titanic/support/simple_file.cpp | 15 ++++++++ engines/titanic/support/simple_file.h | 5 +++ engines/titanic/true_talk/st_vocab.cpp | 66 +++++++++++++++++++++++++++++++-- engines/titanic/true_talk/st_vocab.h | 2 +- engines/titanic/true_talk/tt_word.cpp | 28 +++++++++++++- engines/titanic/true_talk/tt_word.h | 27 +++++++++++++- 6 files changed, 135 insertions(+), 8 deletions(-) diff --git a/engines/titanic/support/simple_file.cpp b/engines/titanic/support/simple_file.cpp index b7f666a1ef..18a75864a8 100644 --- a/engines/titanic/support/simple_file.cpp +++ b/engines/titanic/support/simple_file.cpp @@ -78,6 +78,12 @@ size_t SimpleFile::write(const void *src, size_t count) { return _outStream->write(src, count); } +byte SimpleFile::readByte() { + byte b; + safeRead(&b, 1); + return b; +} + CString SimpleFile::readString() { char c; CString result; @@ -368,13 +374,22 @@ bool SimpleFile::scanf(const char *format, ...) { if (!Common::isSpace(c)) return false; } else if (formatStr.hasPrefix("%d")) { + // Read in a number formatStr = CString(formatStr.c_str() + 2); int *param = (int *)va_arg(va, int *); *param = readNumber(); + } else if (formatStr.hasPrefix("%s")) { + // Read in text until the next space + formatStr = CString(formatStr.c_str() + 2); + CString *str = (CString *)va_arg(va, CString *); + str->clear(); + while (!eos() && (c = readByte()) != ' ') + *str += c; } } va_end(va); + return !eos(); } /*------------------------------------------------------------------------*/ diff --git a/engines/titanic/support/simple_file.h b/engines/titanic/support/simple_file.h index 431df016ad..db453c46c7 100644 --- a/engines/titanic/support/simple_file.h +++ b/engines/titanic/support/simple_file.h @@ -86,6 +86,11 @@ public: */ virtual size_t write(const void *src, size_t count); + /** + * Read a byte + */ + byte readByte(); + /** * Read a string from the file */ diff --git a/engines/titanic/true_talk/st_vocab.cpp b/engines/titanic/true_talk/st_vocab.cpp index b725101214..3850c64de2 100644 --- a/engines/titanic/true_talk/st_vocab.cpp +++ b/engines/titanic/true_talk/st_vocab.cpp @@ -26,7 +26,7 @@ namespace Titanic { -STVocab::STVocab(int val): _field0(0), _field4(0), _vocab(nullptr), +STVocab::STVocab(int val): _field0(0), _field4(0), _word(nullptr), _fieldC(0), _field10(0), _field18(val) { _field14 = load("STvocab.txt"); } @@ -34,12 +34,70 @@ STVocab::STVocab(int val): _field0(0), _field4(0), _vocab(nullptr), int STVocab::load(const CString &name) { SimpleFile *file = g_vm->_fileReader._owner->openResource(name); int result = 0; + int param = -1; + int mode = 0; + bool skipFlag; - while (!file->eos()) { - int mode = file->readNumber(); + while (!result && !file->eos()) { + skipFlag = false; + int param = file->readNumber(); + TTString space(" "); switch (mode) { - case 0: + case 0: { + if (_word) + result = _word->readSyn(file); + skipFlag = true; + break; + } + + case 1: { + TTWord2 *word = new TTWord2(space, 0, 0, 0, 0); + result = word->load(file); + _word = word; + break; + } + + case 2: { + TTWord3 *word = new TTWord3(space, 0, 0, 0, 0, 0, 0); + result = word->load(file); + _word = word; + break; + } + + case 3: + case 9: { + TTWord1 *word = new TTWord1(space, 0, 0, 0); + result = word->load(file, &mode); + _word = word; + break; + } + + case 4: + case 5: + case 7: { + TTWord *word = new TTWord(space, 0, 0); + result = word->load(file, &mode); + _word = word; + break; + } + + case 8: { + TTWord4 *word = new TTWord4(space, 0, 0, 0, 0); + result = word->load(file); + _word = word; + break; + } + + case 6: { + TTWord5 *word = new TTWord5(space, 0, 0, 0, 0); + result = word->load(file); + _word = word; + break; + } + + default: + result = 4; break; } } diff --git a/engines/titanic/true_talk/st_vocab.h b/engines/titanic/true_talk/st_vocab.h index 090dc74237..cc25150981 100644 --- a/engines/titanic/true_talk/st_vocab.h +++ b/engines/titanic/true_talk/st_vocab.h @@ -33,7 +33,7 @@ class STVocab { private: int _field0; int _field4; - TTString *_vocab; + TTWord *_word; int _fieldC; int _field10; int _field14; diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index 4405f72555..a37b049d6e 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -30,9 +30,13 @@ TTWord::TTWord(TTString &str, int val1, int val2) : _string(str), _status = str.getStatus() == SS_VALID ? SS_VALID : SS_5; } -/*------------------------------------------------------------------------*/ +int TTWord::readSyn(SimpleFile *file) { + return 0; +} -void TTWord::readSyn(SimpleFile *file) { +int TTWord::load(SimpleFile *file, int *mode) { + // TODO + return 0; } /*------------------------------------------------------------------------*/ @@ -47,6 +51,11 @@ TTWord2::TTWord2(TTString &str, int val1, int val2, int val3, int val4) : TTWord1(str, val1, val2, val3), _field30(val4) { } +int TTWord2::load(SimpleFile *file) { + // TODO + return 0; +} + /*------------------------------------------------------------------------*/ TTWord3::TTWord3(TTString &str, int val1, int val2, int val3, int val4, int val5, int val6) : @@ -54,6 +63,11 @@ TTWord3::TTWord3(TTString &str, int val1, int val2, int val3, int val4, int val5 _field38(0) { } +int TTWord3::load(SimpleFile *file) { + // TODO + return 0; +} + /*------------------------------------------------------------------------*/ TTWord4::TTWord4(TTString &str, int val1, int val2, int val3, int val4) : @@ -66,10 +80,20 @@ TTWord4::TTWord4(TTString &str, int val1, int val2, int val3, int val4) : } } +int TTWord4::load(SimpleFile *file) { + // TODO + return 0; +} + /*------------------------------------------------------------------------*/ TTWord5::TTWord5(TTString &str, int val1, int val2, int val3, int val4) : TTWord1(str, val1, val2, val3), _field30(val4) { } +int TTWord5::load(SimpleFile *file) { + // TODO + return 0; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index d8b34ed04e..1a8b7368f5 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -42,7 +42,12 @@ protected: public: TTWord(TTString &str, int val1, int val2); - void readSyn(SimpleFile *file); + int readSyn(SimpleFile *file); + + /** + * Load the word + */ + int load(SimpleFile *file, int *mode); }; class TTWord1 : public TTWord { @@ -57,6 +62,11 @@ protected: int _field30; public: TTWord2(TTString &str, int val1, int val2, int val3, int val4); + + /** + * Load the word + */ + int load(SimpleFile *file); }; class TTWord3 : public TTWord1 { @@ -67,6 +77,11 @@ protected: int _field3C; public: TTWord3(TTString &str, int val1, int val2, int val3, int val4, int val5, int val6); + + /** + * Load the word + */ + int load(SimpleFile *file); }; class TTWord4 : public TTWord1 { @@ -74,6 +89,11 @@ protected: int _field30; public: TTWord4(TTString &str, int val1, int val2, int val3, int val4); + + /** + * Load the word + */ + int load(SimpleFile *file); }; class TTWord5 : public TTWord1 { @@ -81,6 +101,11 @@ protected: int _field30; public: TTWord5(TTString &str, int val1, int val2, int val3, int val4); + + /** + * Load the word + */ + int load(SimpleFile *file); }; } // End of namespace Titanic -- cgit v1.2.3 From 88dcfebebc183a11729e8dca8768e3a9251533eb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 9 May 2016 08:34:06 -0400 Subject: TITANIC: Implementing vocab word loading --- engines/titanic/true_talk/st_vocab.cpp | 4 +- engines/titanic/true_talk/tt_string.h | 8 ++-- engines/titanic/true_talk/tt_word.cpp | 67 ++++++++++++++++++++++++++++------ engines/titanic/true_talk/tt_word.h | 11 ++++-- 4 files changed, 70 insertions(+), 20 deletions(-) diff --git a/engines/titanic/true_talk/st_vocab.cpp b/engines/titanic/true_talk/st_vocab.cpp index 3850c64de2..578ffe569a 100644 --- a/engines/titanic/true_talk/st_vocab.cpp +++ b/engines/titanic/true_talk/st_vocab.cpp @@ -68,7 +68,7 @@ int STVocab::load(const CString &name) { case 3: case 9: { TTWord1 *word = new TTWord1(space, 0, 0, 0); - result = word->load(file, &mode); + result = word->load(file, mode); _word = word; break; } @@ -77,7 +77,7 @@ int STVocab::load(const CString &name) { case 5: case 7: { TTWord *word = new TTWord(space, 0, 0); - result = word->load(file, &mode); + result = word->load(file, mode); _word = word; break; } diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index 947007f1ff..bc7278cce7 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -27,12 +27,10 @@ namespace Titanic { -class TTStringData { -private: +struct TTStringData { CString _string; -public: int _referenceCount; -public: + TTStringData() : _referenceCount(1) {} TTStringData(const char *str) : _string(str), _referenceCount(1) {} TTStringData(const CString &str) : _string(str), _referenceCount(1) {} @@ -60,6 +58,8 @@ public: * Get the status of the string */ TTStringStatus getStatus() const { return _status; } + + operator const char *() const { return _data->_string.c_str(); } }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index a37b049d6e..0bc3611589 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -24,8 +24,8 @@ namespace Titanic { -TTWord::TTWord(TTString &str, int val1, int val2) : _string(str), - _field18(val1), _field1C(val2), _fieldC(0), _field10(0), +TTWord::TTWord(TTString &str, int mode, int val2) : _string(str), + _wordMode(mode), _field1C(val2), _fieldC(0), _field10(0), _field20(0), _field24(0), _field28(0) { _status = str.getStatus() == SS_VALID ? SS_VALID : SS_5; } @@ -34,9 +34,32 @@ int TTWord::readSyn(SimpleFile *file) { return 0; } -int TTWord::load(SimpleFile *file, int *mode) { - // TODO - return 0; +int TTWord::load(SimpleFile *file, int mode) { + CString str1, str2; + int val; + + if (file->scanf("%d %s %s", &val, &str1, &str2)) { + _string = TTString(str1); + _field1C = val; + _field20 = readNumber(str2.c_str()); + _wordMode = mode; + return 0; + } else { + return 3; + } +} + +uint TTWord::readNumber(const char *str) { + uint numValue = *str; + if (*str == '0') { + numValue = MKTAG('Z', 'Z', 'Z', '['); + } else { + ++str; + for (int idx = 0; idx < 3; ++idx, ++str) + numValue = (numValue << 8) + *str; + } + + return numValue; } /*------------------------------------------------------------------------*/ @@ -52,8 +75,14 @@ TTWord2::TTWord2(TTString &str, int val1, int val2, int val3, int val4) : } int TTWord2::load(SimpleFile *file) { - // TODO - return 0; + int val; + + if (TTWord::load(file, 1) && file->scanf("%d", &val)) { + _field30 = val; + return 0; + } else { + return 8; + } } /*------------------------------------------------------------------------*/ @@ -81,8 +110,14 @@ TTWord4::TTWord4(TTString &str, int val1, int val2, int val3, int val4) : } int TTWord4::load(SimpleFile *file) { - // TODO - return 0; + int val; + + if (TTWord::load(file, 1) && file->scanf("%d", &val)) { + _field30 = val; + return 0; + } else { + return 8; + } } /*------------------------------------------------------------------------*/ @@ -92,8 +127,18 @@ TTWord5::TTWord5(TTString &str, int val1, int val2, int val3, int val4) : } int TTWord5::load(SimpleFile *file) { - // TODO - return 0; + int val; + + if (TTWord::load(file, 1) && file->scanf("%d", &val)) { + if (val >= 0 && val <= 12) { + _field30 = val; + return 0; + } else { + return 5; + } + } else { + return 8; + } } } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index 1a8b7368f5..7018d6e7e6 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -34,20 +34,25 @@ protected: int _fieldC; int _field10; TTStringStatus _status; - int _field18; + int _wordMode; int _field1C; int _field20; int _field24; int _field28; +protected: + /** + * Read in a number + */ + uint readNumber(const char *str); public: - TTWord(TTString &str, int val1, int val2); + TTWord(TTString &str, int mode, int val2); int readSyn(SimpleFile *file); /** * Load the word */ - int load(SimpleFile *file, int *mode); + int load(SimpleFile *file, int mode); }; class TTWord1 : public TTWord { -- cgit v1.2.3 From b7e4ed8744c815b687ce0e4b89df2d204dd28a2a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 9 May 2016 18:33:18 -0400 Subject: TITANIC: Further fleshing out of vocab loading --- engines/titanic/true_talk/st_vocab.cpp | 4 +--- engines/titanic/true_talk/tt_word.cpp | 13 +++++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/engines/titanic/true_talk/st_vocab.cpp b/engines/titanic/true_talk/st_vocab.cpp index 578ffe569a..2a3beff3d6 100644 --- a/engines/titanic/true_talk/st_vocab.cpp +++ b/engines/titanic/true_talk/st_vocab.cpp @@ -34,13 +34,11 @@ STVocab::STVocab(int val): _field0(0), _field4(0), _word(nullptr), int STVocab::load(const CString &name) { SimpleFile *file = g_vm->_fileReader._owner->openResource(name); int result = 0; - int param = -1; - int mode = 0; bool skipFlag; while (!result && !file->eos()) { skipFlag = false; - int param = file->readNumber(); + int mode = file->readNumber(); TTString space(" "); switch (mode) { diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index 0bc3611589..3d0aae5f67 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -93,8 +93,17 @@ TTWord3::TTWord3(TTString &str, int val1, int val2, int val3, int val4, int val5 } int TTWord3::load(SimpleFile *file) { - // TODO - return 0; + CString str; + int val1, val2; + + if (!TTWord::load(file, 2) && file->scanf("%d %d %d", &str, &val1, &val2)) { + _field34 = readNumber(str.c_str()); + _field30 = val1; + _field3C = val2; + return 0; + } else { + return 3; + } } /*------------------------------------------------------------------------*/ -- cgit v1.2.3 From 45f84a9da592fbc76156801c634d60615ace67a2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 9 May 2016 19:18:03 -0400 Subject: TITANIC: Fix script handler initialization --- engines/titanic/true_talk/script_handler.cpp | 8 +++++++- engines/titanic/true_talk/script_handler.h | 3 ++- engines/titanic/true_talk/true_talk_manager.cpp | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index 09110a3f19..67ce8be61f 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -29,10 +29,16 @@ namespace Titanic { CScriptHandler::CScriptHandler(CTitleEngine *owner, int val1, int val2) : _owner(owner), _script(owner->_script), _reader(g_vm->_fileReader), - _vocab(val2), _sub1(), _sub2(this), _field10(0), _inputCtr(0), + _sub1(), _sub2(this), _field10(0), _inputCtr(0), _field20(0), _field24(0), _field28(0), _field2C(0), _field30(0) { g_vm->_scriptHandler = this; g_vm->_script = _script; + g_vm->_fileReader.reset(this, val1, val2); + _vocab = new STVocab(val2); +} + +CScriptHandler::~CScriptHandler() { + delete _vocab; } ScriptChangedResult CScriptHandler::scriptChanged(TTRoomScript *roomScript, TTNpcScript *npcScript, uint dialogueId) { diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index 38da259021..58d58d6d27 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -64,8 +64,8 @@ class CScriptHandler { private: CTitleEngine *_owner; TTScriptBase *_script; + STVocab *_vocab; CFileReader &_reader; - STVocab _vocab; int _field10; CScriptHandlerSub1 _sub1; CScriptHandlerSub2 _sub2; @@ -77,6 +77,7 @@ private: int _field30; public: CScriptHandler(CTitleEngine *owner, int val1, int val2); + ~CScriptHandler(); /** * Set the character and room diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 0b841aca00..4892259341 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -47,6 +47,8 @@ CTrueTalkNPC *CTrueTalkManager::_currentNPC; CTrueTalkManager::CTrueTalkManager(CGameManager *owner) : _gameManager(owner), _scripts(&_titleEngine), _currentCharId(0), _dialogueFile(nullptr), _dialogueId(0) { + _titleEngine.setup(3, 3); + _currentNPC = nullptr; } CTrueTalkManager::~CTrueTalkManager() { -- cgit v1.2.3 From 3822d46341d111ccf29d0dbea4bd7223f546e51b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 9 May 2016 19:39:19 -0400 Subject: TITANIC: FIx initializing file reader to read EXE resources --- engines/titanic/true_talk/st_vocab.cpp | 2 +- engines/titanic/true_talk/title_engine.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/engines/titanic/true_talk/st_vocab.cpp b/engines/titanic/true_talk/st_vocab.cpp index 2a3beff3d6..ff45dff592 100644 --- a/engines/titanic/true_talk/st_vocab.cpp +++ b/engines/titanic/true_talk/st_vocab.cpp @@ -28,7 +28,7 @@ namespace Titanic { STVocab::STVocab(int val): _field0(0), _field4(0), _word(nullptr), _fieldC(0), _field10(0), _field18(val) { - _field14 = load("STvocab.txt"); + _field14 = load("STVOCAB.TXT"); } int STVocab::load(const CString &name) { diff --git a/engines/titanic/true_talk/title_engine.cpp b/engines/titanic/true_talk/title_engine.cpp index 24cc4216ee..d4462c5bcd 100644 --- a/engines/titanic/true_talk/title_engine.cpp +++ b/engines/titanic/true_talk/title_engine.cpp @@ -40,6 +40,7 @@ void CTitleEngine::setup(int val1, int val2) { /*------------------------------------------------------------------------*/ STtitleEngine::STtitleEngine(): CTitleEngine(), _field58(0) { + _resources.loadFromEXE("ST.exe"); } STtitleEngine::~STtitleEngine() { @@ -66,8 +67,9 @@ void STtitleEngine::dump(int val1, int val2) { SimpleFile *STtitleEngine::open(const CString &name) { Common::SeekableReadStream *stream = _resources.getResource( - Common::WinResourceID("Text"), name); - + Common::WinResourceID("TEXT"), name); + assert(stream); + SimpleFile *file = new SimpleFile(); file->open(stream); return file; -- cgit v1.2.3 From b99fa6ba8c7f4a5407ff59812e5e6023c8a3301c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 9 May 2016 20:42:55 -0400 Subject: TITANIC: Fix to SimpleFile scanf --- engines/titanic/support/simple_file.cpp | 15 +++++++++++++-- engines/titanic/true_talk/tt_string.cpp | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/engines/titanic/support/simple_file.cpp b/engines/titanic/support/simple_file.cpp index 18a75864a8..85f42aeeb5 100644 --- a/engines/titanic/support/simple_file.cpp +++ b/engines/titanic/support/simple_file.cpp @@ -368,23 +368,34 @@ bool SimpleFile::scanf(const char *format, ...) { CString formatStr(format); while (!formatStr.empty()) { if (formatStr.hasPrefix(" ")) { + // Skip over whitespaces formatStr.deleteChar(0); - safeRead(&c, 1); + safeRead(&c, 1); if (!Common::isSpace(c)) return false; + + while (Common::isSpace(c)) + safeRead(&c, 1); + _inStream->skip(-1); } else if (formatStr.hasPrefix("%d")) { // Read in a number formatStr = CString(formatStr.c_str() + 2); int *param = (int *)va_arg(va, int *); *param = readNumber(); + + if (!eos()) + _inStream->skip(-1); } else if (formatStr.hasPrefix("%s")) { // Read in text until the next space formatStr = CString(formatStr.c_str() + 2); CString *str = (CString *)va_arg(va, CString *); str->clear(); - while (!eos() && (c = readByte()) != ' ') + while (!eos() && !Common::isSpace(c = readByte())) *str += c; + + if (!eos()) + _inStream->skip(-1); } } diff --git a/engines/titanic/true_talk/tt_string.cpp b/engines/titanic/true_talk/tt_string.cpp index ffe6509e07..2308afa75d 100644 --- a/engines/titanic/true_talk/tt_string.cpp +++ b/engines/titanic/true_talk/tt_string.cpp @@ -54,7 +54,7 @@ TTString::TTString(TTString &str) { } TTString::~TTString() { - if (--_data->_referenceCount == 0) + if (_data && --_data->_referenceCount == 0) delete _data; } -- cgit v1.2.3 From 0820c3ffaee211270ab75a14cd1d42047354aa34 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 9 May 2016 21:03:21 -0400 Subject: TITANIC: Refactor CTitleEngine to use CFilesManager for PE resources --- engines/titanic/core/game_object.cpp | 6 +++--- engines/titanic/core/resource_key.cpp | 2 +- engines/titanic/game_manager.cpp | 2 +- engines/titanic/input_handler.cpp | 2 +- engines/titanic/main_game_window.cpp | 2 +- engines/titanic/support/files_manager.cpp | 16 +++++----------- engines/titanic/support/files_manager.h | 2 +- engines/titanic/support/font.cpp | 2 +- engines/titanic/support/mouse_cursor.cpp | 2 +- engines/titanic/titanic.cpp | 3 +++ engines/titanic/titanic.h | 2 +- engines/titanic/true_talk/title_engine.cpp | 4 ++-- engines/titanic/true_talk/title_engine.h | 1 - 13 files changed, 21 insertions(+), 25 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index b27b461b48..5a214871c6 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -240,7 +240,7 @@ void CGameObject::loadResource(const CString &name) { } void CGameObject::loadMovie(const CString &name, bool pendingFlag) { - g_vm->_filesManager.preload(name); + g_vm->_filesManager->preload(name); // Create the surface if it doesn't already exist if (!_surface) { @@ -273,7 +273,7 @@ void CGameObject::loadImage(const CString &name, bool pendingFlag) { _surface = nullptr; } - g_vm->_filesManager.preload(name); + g_vm->_filesManager->preload(name); if (!name.empty()) { _surface = new OSVideoSurface(screenManager, CResourceKey(name), pendingFlag); @@ -464,7 +464,7 @@ void CGameObject::sound8(bool flag) const { void CGameObject::loadSound(const CString &name) { CGameManager *gameManager = getGameManager(); if (gameManager) { - g_vm->_filesManager.preload(name); + g_vm->_filesManager->preload(name); if (!name.empty()) gameManager->_sound.loadSound(name); } diff --git a/engines/titanic/core/resource_key.cpp b/engines/titanic/core/resource_key.cpp index 537dd432f0..a6a06153de 100644 --- a/engines/titanic/core/resource_key.cpp +++ b/engines/titanic/core/resource_key.cpp @@ -75,7 +75,7 @@ CString CResourceKey::exists() const { } bool CResourceKey::scanForFile() const { - return g_vm->_filesManager.scanForFile(_value); + return g_vm->_filesManager->scanForFile(_value); } FileType CResourceKey::fileTypeSuffix() const { diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index fd2f553b8e..d0400a4b21 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -41,7 +41,7 @@ CGameManager::CGameManager(CProjectItem *project, CGameView *gameView): _videoSurface1 = nullptr; _videoSurface2 = CScreenManager::_screenManagerPtr->createSurface(600, 340); _project->setGameManager(this); - g_vm->_filesManager.setGameManager(this); + g_vm->_filesManager->setGameManager(this); } void CGameManager::load(SimpleFile *file) { diff --git a/engines/titanic/input_handler.cpp b/engines/titanic/input_handler.cpp index 3d3541b1dd..289e707bb0 100644 --- a/engines/titanic/input_handler.cpp +++ b/engines/titanic/input_handler.cpp @@ -53,7 +53,7 @@ void CInputHandler::handleMessage(CMessage &msg, bool respectLock) { if (_gameManager->_gameState._mode == GSMODE_SELECTED) { processMessage(&msg); } else if (!msg.isMouseMsg()) { - g_vm->_filesManager.loadDrive(); + g_vm->_filesManager->loadDrive(); } } } diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index a524529492..73ce375881 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -134,7 +134,7 @@ void CMainGameWindow::draw() { break; case GSMODE_5: - g_vm->_filesManager.debug(scrManager); + g_vm->_filesManager->debug(scrManager); break; default: diff --git a/engines/titanic/support/files_manager.cpp b/engines/titanic/support/files_manager.cpp index 8e70387a5f..eb2f95e92e 100644 --- a/engines/titanic/support/files_manager.cpp +++ b/engines/titanic/support/files_manager.cpp @@ -26,13 +26,12 @@ namespace Titanic { -CFilesManager::CFilesManager() : _gameManager(nullptr), - _assetsPath("Assets"), _exeResources(nullptr), _field0(0), - _drive(-1), _field18(0), _field1C(0), _field3C(0) { +CFilesManager::CFilesManager() : _gameManager(nullptr), _assetsPath("Assets"), + _field0(0), _drive(-1), _field18(0), _field1C(0), _field3C(0) { + _exeResources.loadFromEXE("st.exe"); } CFilesManager::~CFilesManager() { - delete _exeResources; } bool CFilesManager::fileExists(const CString &name) { @@ -94,13 +93,8 @@ void CFilesManager::preload(const CString &name) { } Common::SeekableReadStream *CFilesManager::getResource( - Common::WinResourceID area, Common::WinResourceID name) { - if (!_exeResources) { - _exeResources = new Common::PEResources(); - _exeResources->loadFromEXE("st.exe"); - } - - return _exeResources->getResource(area, name); + Common::WinResourceID area, Common::WinResourceID name) { + return _exeResources.getResource(area, name); } } // End of namespace Titanic diff --git a/engines/titanic/support/files_manager.h b/engines/titanic/support/files_manager.h index 185670c764..6be6a13166 100644 --- a/engines/titanic/support/files_manager.h +++ b/engines/titanic/support/files_manager.h @@ -37,7 +37,7 @@ class CFilesManagerList : public List { class CFilesManager { private: CGameManager *_gameManager; - Common::PEResources *_exeResources; + Common::PEResources _exeResources; CFilesManagerList _list; CString _string1; CString _string2; diff --git a/engines/titanic/support/font.cpp b/engines/titanic/support/font.cpp index cc93bbb3c2..916f02097b 100644 --- a/engines/titanic/support/font.cpp +++ b/engines/titanic/support/font.cpp @@ -41,7 +41,7 @@ STFont::~STFont() { void STFont::load(int fontNumber) { assert(!_dataPtr); - Common::SeekableReadStream *stream = g_vm->_filesManager.getResource( + Common::SeekableReadStream *stream = g_vm->_filesManager->getResource( Common::WinResourceID("STFONT"), fontNumber); if (!stream) error("Could not locate the specified font"); diff --git a/engines/titanic/support/mouse_cursor.cpp b/engines/titanic/support/mouse_cursor.cpp index 6ddfecfd2a..6ebf4f2164 100644 --- a/engines/titanic/support/mouse_cursor.cpp +++ b/engines/titanic/support/mouse_cursor.cpp @@ -63,7 +63,7 @@ CMouseCursor::~CMouseCursor() { void CMouseCursor::loadCursorImages() { const CString name("ycursors.avi"); - g_vm->_filesManager.fn4(name); + g_vm->_filesManager->fn4(name); // WORKAROUND: We need to manipulate ycursors.avi file so it can be read // by the ScummVM AVIDecoder, by removing the redundant second video track diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index e70a208552..c2c1f18f54 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -50,6 +50,7 @@ TitanicEngine::TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDe g_vm = this; _debugger = nullptr; _events = nullptr; + _filesManager = nullptr; _window = nullptr; _screen = nullptr; _screenManager = nullptr; @@ -63,6 +64,7 @@ TitanicEngine::~TitanicEngine() { delete _screen; delete _window; delete _screenManager; + delete _filesManager; CSaveableObject::freeClassList(); _activeMovies.clear(); } @@ -95,6 +97,7 @@ void TitanicEngine::initialize() { _debugger = new Debugger(this); _events = new Events(this); + _filesManager = new CFilesManager(); _screen = new Graphics::Screen(0, 0); _screenManager = new OSScreenManager(this); _window = new CMainGameWindow(this); diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index 653ace534b..71e8fcdf2c 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -111,9 +111,9 @@ protected: virtual Common::Error run(); virtual bool hasFeature(EngineFeature f) const; public: - CFilesManager _filesManager; Debugger *_debugger; Events *_events; + CFilesManager *_filesManager; Graphics::Screen *_screen; OSScreenManager *_screenManager; CMainGameWindow *_window; diff --git a/engines/titanic/true_talk/title_engine.cpp b/engines/titanic/true_talk/title_engine.cpp index d4462c5bcd..511ee0a8f7 100644 --- a/engines/titanic/true_talk/title_engine.cpp +++ b/engines/titanic/true_talk/title_engine.cpp @@ -21,6 +21,7 @@ */ #include "titanic/true_talk/title_engine.h" +#include "titanic/titanic.h" namespace Titanic { @@ -40,7 +41,6 @@ void CTitleEngine::setup(int val1, int val2) { /*------------------------------------------------------------------------*/ STtitleEngine::STtitleEngine(): CTitleEngine(), _field58(0) { - _resources.loadFromEXE("ST.exe"); } STtitleEngine::~STtitleEngine() { @@ -66,7 +66,7 @@ void STtitleEngine::dump(int val1, int val2) { } SimpleFile *STtitleEngine::open(const CString &name) { - Common::SeekableReadStream *stream = _resources.getResource( + Common::SeekableReadStream *stream = g_vm->_filesManager->getResource( Common::WinResourceID("TEXT"), name); assert(stream); diff --git a/engines/titanic/true_talk/title_engine.h b/engines/titanic/true_talk/title_engine.h index fda35ac7bf..87491bf7b6 100644 --- a/engines/titanic/true_talk/title_engine.h +++ b/engines/titanic/true_talk/title_engine.h @@ -68,7 +68,6 @@ public: class STtitleEngine : public CTitleEngine { private: - Common::PEResources _resources; Common::SeekableReadStream *_stream; int _field58; public: -- cgit v1.2.3 From 5bb05084fda4e1ce63bd29815ed0676adb1645ed Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 9 May 2016 21:44:10 -0400 Subject: TITANIC: Fixes for TTString constructors --- engines/titanic/true_talk/tt_string.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/engines/titanic/true_talk/tt_string.cpp b/engines/titanic/true_talk/tt_string.cpp index 2308afa75d..a41f0ced5f 100644 --- a/engines/titanic/true_talk/tt_string.cpp +++ b/engines/titanic/true_talk/tt_string.cpp @@ -33,17 +33,12 @@ TTString::TTString(const char *str) : _status(SS_VALID) { } TTString::TTString(const CString &str) { - if (_status != SS_VALID) { - _status = SS_5; - _data = nullptr; - } else { - _status = SS_VALID; - _data = new TTStringData(str); - } + _status = SS_VALID; + _data = new TTStringData(str); } TTString::TTString(TTString &str) { - if (_status != SS_VALID) { + if (str._status != SS_VALID) { _status = SS_5; _data = nullptr; } else { -- cgit v1.2.3 From 0f96471077d2c5a278fb1594e874e43029afff08 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 9 May 2016 22:02:32 -0400 Subject: TITANIC: Add copy operators for TTString --- engines/titanic/true_talk/tt_string.cpp | 22 ++++++++++++++++++++++ engines/titanic/true_talk/tt_string.h | 3 +++ engines/titanic/true_talk/tt_word.cpp | 2 +- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/engines/titanic/true_talk/tt_string.cpp b/engines/titanic/true_talk/tt_string.cpp index a41f0ced5f..189873daf0 100644 --- a/engines/titanic/true_talk/tt_string.cpp +++ b/engines/titanic/true_talk/tt_string.cpp @@ -53,6 +53,28 @@ TTString::~TTString() { delete _data; } +void TTString::operator=(const TTString &str) { + // Delete old string reference, if any + if (_data && --_data->_referenceCount == 0) + delete _data; + + // Copy source string data + _status = str._status; + _data = str._data; + if (_data) + _data->_referenceCount++; +} + +void TTString::operator=(const CString &str) { + // Delete old string reference, if any + if (_data && --_data->_referenceCount == 0) + delete _data; + + // Create new string data + _data = new TTStringData(str); + _status = SS_VALID; +} + bool TTString::isValid() const { return _status == SS_VALID; } diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index bc7278cce7..250f902068 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -49,6 +49,9 @@ public: TTString(TTString &str); virtual ~TTString(); + void operator=(const TTString &str); + void operator=(const CString &str); + /** * Returns true if the string is valid */ diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index 3d0aae5f67..7d7cb2d0c2 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -39,7 +39,7 @@ int TTWord::load(SimpleFile *file, int mode) { int val; if (file->scanf("%d %s %s", &val, &str1, &str2)) { - _string = TTString(str1); + _string = str1; _field1C = val; _field20 = readNumber(str2.c_str()); _wordMode = mode; -- cgit v1.2.3 From a223309934452ca6652112060aac9bd7272d4ddb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 9 May 2016 22:33:10 -0400 Subject: TITANIC: Changed casing on TTword classes to exactly match original --- engines/titanic/true_talk/st_vocab.cpp | 12 +++++----- engines/titanic/true_talk/st_vocab.h | 2 +- engines/titanic/true_talk/tt_word.cpp | 44 +++++++++++++++++----------------- engines/titanic/true_talk/tt_word.h | 24 +++++++++---------- 4 files changed, 41 insertions(+), 41 deletions(-) diff --git a/engines/titanic/true_talk/st_vocab.cpp b/engines/titanic/true_talk/st_vocab.cpp index ff45dff592..1b03474292 100644 --- a/engines/titanic/true_talk/st_vocab.cpp +++ b/engines/titanic/true_talk/st_vocab.cpp @@ -50,14 +50,14 @@ int STVocab::load(const CString &name) { } case 1: { - TTWord2 *word = new TTWord2(space, 0, 0, 0, 0); + TTword2 *word = new TTword2(space, 0, 0, 0, 0); result = word->load(file); _word = word; break; } case 2: { - TTWord3 *word = new TTWord3(space, 0, 0, 0, 0, 0, 0); + TTword3 *word = new TTword3(space, 0, 0, 0, 0, 0, 0); result = word->load(file); _word = word; break; @@ -65,7 +65,7 @@ int STVocab::load(const CString &name) { case 3: case 9: { - TTWord1 *word = new TTWord1(space, 0, 0, 0); + TTword1 *word = new TTword1(space, 0, 0, 0); result = word->load(file, mode); _word = word; break; @@ -74,21 +74,21 @@ int STVocab::load(const CString &name) { case 4: case 5: case 7: { - TTWord *word = new TTWord(space, 0, 0); + TTword *word = new TTword(space, 0, 0); result = word->load(file, mode); _word = word; break; } case 8: { - TTWord4 *word = new TTWord4(space, 0, 0, 0, 0); + TTword4 *word = new TTword4(space, 0, 0, 0, 0); result = word->load(file); _word = word; break; } case 6: { - TTWord5 *word = new TTWord5(space, 0, 0, 0, 0); + TTword5 *word = new TTword5(space, 0, 0, 0, 0); result = word->load(file); _word = word; break; diff --git a/engines/titanic/true_talk/st_vocab.h b/engines/titanic/true_talk/st_vocab.h index cc25150981..c44c4ddda0 100644 --- a/engines/titanic/true_talk/st_vocab.h +++ b/engines/titanic/true_talk/st_vocab.h @@ -33,7 +33,7 @@ class STVocab { private: int _field0; int _field4; - TTWord *_word; + TTword *_word; int _fieldC; int _field10; int _field14; diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index 7d7cb2d0c2..62f924af6e 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -24,17 +24,17 @@ namespace Titanic { -TTWord::TTWord(TTString &str, int mode, int val2) : _string(str), +TTword::TTword(TTString &str, int mode, int val2) : _string(str), _wordMode(mode), _field1C(val2), _fieldC(0), _field10(0), _field20(0), _field24(0), _field28(0) { _status = str.getStatus() == SS_VALID ? SS_VALID : SS_5; } -int TTWord::readSyn(SimpleFile *file) { +int TTword::readSyn(SimpleFile *file) { return 0; } -int TTWord::load(SimpleFile *file, int mode) { +int TTword::load(SimpleFile *file, int mode) { CString str1, str2; int val; @@ -49,7 +49,7 @@ int TTWord::load(SimpleFile *file, int mode) { } } -uint TTWord::readNumber(const char *str) { +uint TTword::readNumber(const char *str) { uint numValue = *str; if (*str == '0') { numValue = MKTAG('Z', 'Z', 'Z', '['); @@ -64,20 +64,20 @@ uint TTWord::readNumber(const char *str) { /*------------------------------------------------------------------------*/ -TTWord1::TTWord1(TTString &str, int val1, int val2, int val3) : - TTWord(str, val1, val2), _field2C(val3) { +TTword1::TTword1(TTString &str, int val1, int val2, int val3) : + TTword(str, val1, val2), _field2C(val3) { } /*------------------------------------------------------------------------*/ -TTWord2::TTWord2(TTString &str, int val1, int val2, int val3, int val4) : - TTWord1(str, val1, val2, val3), _field30(val4) { +TTword2::TTword2(TTString &str, int val1, int val2, int val3, int val4) : + TTword1(str, val1, val2, val3), _field30(val4) { } -int TTWord2::load(SimpleFile *file) { +int TTword2::load(SimpleFile *file) { int val; - if (TTWord::load(file, 1) && file->scanf("%d", &val)) { + if (TTword::load(file, 1) && file->scanf("%d", &val)) { _field30 = val; return 0; } else { @@ -87,16 +87,16 @@ int TTWord2::load(SimpleFile *file) { /*------------------------------------------------------------------------*/ -TTWord3::TTWord3(TTString &str, int val1, int val2, int val3, int val4, int val5, int val6) : - TTWord1(str, val1, val2, val4), _field34(val3), _field30(val5), _field3C(val6), +TTword3::TTword3(TTString &str, int val1, int val2, int val3, int val4, int val5, int val6) : + TTword1(str, val1, val2, val4), _field34(val3), _field30(val5), _field3C(val6), _field38(0) { } -int TTWord3::load(SimpleFile *file) { +int TTword3::load(SimpleFile *file) { CString str; int val1, val2; - if (!TTWord::load(file, 2) && file->scanf("%d %d %d", &str, &val1, &val2)) { + if (!TTword::load(file, 2) && file->scanf("%d %d %d", &str, &val1, &val2)) { _field34 = readNumber(str.c_str()); _field30 = val1; _field3C = val2; @@ -108,8 +108,8 @@ int TTWord3::load(SimpleFile *file) { /*------------------------------------------------------------------------*/ -TTWord4::TTWord4(TTString &str, int val1, int val2, int val3, int val4) : - TTWord1(str, val1, val2, val3) { +TTword4::TTword4(TTString &str, int val1, int val2, int val3, int val4) : + TTword1(str, val1, val2, val3) { if (val4 >= 0 && val4 <= 9) { _field30 = val4; } else { @@ -118,10 +118,10 @@ TTWord4::TTWord4(TTString &str, int val1, int val2, int val3, int val4) : } } -int TTWord4::load(SimpleFile *file) { +int TTword4::load(SimpleFile *file) { int val; - if (TTWord::load(file, 1) && file->scanf("%d", &val)) { + if (TTword::load(file, 1) && file->scanf("%d", &val)) { _field30 = val; return 0; } else { @@ -131,14 +131,14 @@ int TTWord4::load(SimpleFile *file) { /*------------------------------------------------------------------------*/ -TTWord5::TTWord5(TTString &str, int val1, int val2, int val3, int val4) : - TTWord1(str, val1, val2, val3), _field30(val4) { +TTword5::TTword5(TTString &str, int val1, int val2, int val3, int val4) : + TTword1(str, val1, val2, val3), _field30(val4) { } -int TTWord5::load(SimpleFile *file) { +int TTword5::load(SimpleFile *file) { int val; - if (TTWord::load(file, 1) && file->scanf("%d", &val)) { + if (TTword::load(file, 1) && file->scanf("%d", &val)) { if (val >= 0 && val <= 12) { _field30 = val; return 0; diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index 7018d6e7e6..a24099c2ab 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -28,7 +28,7 @@ namespace Titanic { -class TTWord { +class TTword { protected: TTString _string; int _fieldC; @@ -45,7 +45,7 @@ protected: */ uint readNumber(const char *str); public: - TTWord(TTString &str, int mode, int val2); + TTword(TTString &str, int mode, int val2); int readSyn(SimpleFile *file); @@ -55,18 +55,18 @@ public: int load(SimpleFile *file, int mode); }; -class TTWord1 : public TTWord { +class TTword1 : public TTword { protected: int _field2C; public: - TTWord1(TTString &str, int val1, int val2, int val3); + TTword1(TTString &str, int val1, int val2, int val3); }; -class TTWord2 : public TTWord1 { +class TTword2 : public TTword1 { protected: int _field30; public: - TTWord2(TTString &str, int val1, int val2, int val3, int val4); + TTword2(TTString &str, int val1, int val2, int val3, int val4); /** * Load the word @@ -74,14 +74,14 @@ public: int load(SimpleFile *file); }; -class TTWord3 : public TTWord1 { +class TTword3 : public TTword1 { protected: int _field30; int _field34; int _field38; int _field3C; public: - TTWord3(TTString &str, int val1, int val2, int val3, int val4, int val5, int val6); + TTword3(TTString &str, int val1, int val2, int val3, int val4, int val5, int val6); /** * Load the word @@ -89,11 +89,11 @@ public: int load(SimpleFile *file); }; -class TTWord4 : public TTWord1 { +class TTword4 : public TTword1 { protected: int _field30; public: - TTWord4(TTString &str, int val1, int val2, int val3, int val4); + TTword4(TTString &str, int val1, int val2, int val3, int val4); /** * Load the word @@ -101,11 +101,11 @@ public: int load(SimpleFile *file); }; -class TTWord5 : public TTWord1 { +class TTword5 : public TTword1 { protected: int _field30; public: - TTWord5(TTString &str, int val1, int val2, int val3, int val4); + TTword5(TTString &str, int val1, int val2, int val3, int val4); /** * Load the word -- cgit v1.2.3 From 3a464e8770606d75ec7a641eac207b58c95303c1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 10 May 2016 20:51:21 -0400 Subject: TITANIC: Added new TTstringNode and TTsynonymNode classes --- engines/titanic/module.mk | 1 + engines/titanic/support/file_reader.h | 2 + engines/titanic/true_talk/tt_string.cpp | 4 ++ engines/titanic/true_talk/tt_string.h | 1 + engines/titanic/true_talk/tt_string_node.cpp | 74 ++++++++++++++++++++++++++++ engines/titanic/true_talk/tt_string_node.h | 65 ++++++++++++++++++++++++ engines/titanic/true_talk/tt_word.cpp | 32 +++++++++++- engines/titanic/true_talk/tt_word.h | 8 ++- 8 files changed, 185 insertions(+), 2 deletions(-) create mode 100644 engines/titanic/true_talk/tt_string_node.cpp create mode 100644 engines/titanic/true_talk/tt_string_node.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index a3d60e7fdb..23354b40f6 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -466,6 +466,7 @@ MODULE_OBJS := \ true_talk/tt_npc_script.o \ true_talk/tt_scripts.o \ true_talk/tt_string.o \ + true_talk/tt_string_node.o \ true_talk/tt_talker.o \ true_talk/tt_title_script.o \ true_talk/tt_word.o diff --git a/engines/titanic/support/file_reader.h b/engines/titanic/support/file_reader.h index 7d00ebd80d..42ab43c294 100644 --- a/engines/titanic/support/file_reader.h +++ b/engines/titanic/support/file_reader.h @@ -42,6 +42,8 @@ public: CFileReader(); void reset(CScriptHandler *owner, int val1, int val2); + + bool is18Equals(int val) const { return _field18 == val; } }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_string.cpp b/engines/titanic/true_talk/tt_string.cpp index 189873daf0..78ef8222ab 100644 --- a/engines/titanic/true_talk/tt_string.cpp +++ b/engines/titanic/true_talk/tt_string.cpp @@ -66,6 +66,10 @@ void TTString::operator=(const TTString &str) { } void TTString::operator=(const CString &str) { + operator=(str.c_str()); +} + +void TTString::operator=(const char *str) { // Delete old string reference, if any if (_data && --_data->_referenceCount == 0) delete _data; diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index 250f902068..c7c88ff2a8 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -51,6 +51,7 @@ public: void operator=(const TTString &str); void operator=(const CString &str); + void operator=(const char *str); /** * Returns true if the string is valid diff --git a/engines/titanic/true_talk/tt_string_node.cpp b/engines/titanic/true_talk/tt_string_node.cpp new file mode 100644 index 0000000000..b1e2a642e4 --- /dev/null +++ b/engines/titanic/true_talk/tt_string_node.cpp @@ -0,0 +1,74 @@ +/* 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/textconsole.h" +#include "titanic/true_talk/tt_string_node.h" + +namespace Titanic { + +TTstringNode::TTstringNode() : _pPrior(nullptr), _pNext(nullptr), + _field14(0), _mode(0), _field1C(0) { +} + +void TTstringNode::initialize(int mode) { + _mode = mode; + _field14 = 0; + + if (_string.isValid()) { + _field1C = 0; + } else { + _field1C = 11; + warning("TTstringNode::initialize has bad subobj"); + } +} + +void TTstringNode::addNode(TTstringNode *newNode) { + TTstringNode *tail = getTail(); + tail->_pNext = newNode; + newNode->_pPrior = this; +} + +TTstringNode *TTstringNode::getTail() const { + if (_pNext == nullptr) + return nullptr; + + TTstringNode *node = _pNext; + while (node->_pNext) + node = node->_pNext; + + return node; +} + +/*------------------------------------------------------------------------*/ + +TTsynonymNode::TTsynonymNode() : TTstringNode() { +} + +TTsynonymNode::TTsynonymNode(int mode, const char *str, int val2) : + TTstringNode() { + _string = str; + initialize(mode); + _field14 = val2; +} + + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_string_node.h b/engines/titanic/true_talk/tt_string_node.h new file mode 100644 index 0000000000..e588ea4883 --- /dev/null +++ b/engines/titanic/true_talk/tt_string_node.h @@ -0,0 +1,65 @@ +/* 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. + * + */ + +#ifndef TITANIC_TT_STRING_NODE_H +#define TITANIC_TT_STRING_NODE_H + +#include "titanic/true_talk/tt_string.h" + +namespace Titanic { + +class TTstringNode { +private: + /** + * Returns the final node at the end of the linked list of nodes + */ + TTstringNode *getTail() const; +protected: + /** + * Initializes state for the node + */ + void initialize(int mode); +public: + TTstringNode *_pPrior; + TTstringNode *_pNext; + TTString _string; + int _field14; + int _mode; + int _field1C; +public: + TTstringNode(); + + /** + * Links the passed node to this node as a linked list + */ + void addNode(TTstringNode *newNode); +}; + +class TTsynonymNode : public TTstringNode { +public: + TTsynonymNode(); + TTsynonymNode(int mode, const char *str, int val2); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_STRING_NODE_H */ diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index 62f924af6e..de987c281f 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -21,16 +21,38 @@ */ #include "titanic/true_talk/tt_word.h" +#include "titanic/true_talk/tt_string_node.h" +#include "titanic/titanic.h" namespace Titanic { TTword::TTword(TTString &str, int mode, int val2) : _string(str), - _wordMode(mode), _field1C(val2), _fieldC(0), _field10(0), + _wordMode(mode), _field1C(val2), _fieldC(0), _synP(nullptr), _field20(0), _field24(0), _field28(0) { _status = str.getStatus() == SS_VALID ? SS_VALID : SS_5; } int TTword::readSyn(SimpleFile *file) { + CString str; + int mode, val1; + + if (!file->scanf("%s %d %d", &str, &mode, &val1)) + return 8; + if (!testFileHandle(file)) + return 5; + + // Create new synanym node + TTsynonymNode *synNode = new TTsynonymNode(mode, str.c_str(), val1); + + if (_synP) { + // A synonym already exists, so add new one as a tail + // at the end of the linked list of synonyms + _synP->addNode(synNode); + } else { + // Very first synonym, so set it + _synP = synNode; + } + return 0; } @@ -62,6 +84,14 @@ uint TTword::readNumber(const char *str) { return numValue; } +bool TTword::testFileHandle(SimpleFile *file) const { + if (g_vm->_fileReader.is18Equals(3)) + return true; + + // TODO: Figure out why original compares passed file handle against specific values + return true; +} + /*------------------------------------------------------------------------*/ TTword1::TTword1(TTString &str, int val1, int val2, int val3) : diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index a24099c2ab..0d6564a925 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -25,6 +25,7 @@ #include "titanic/support/simple_file.h" #include "titanic/true_talk/tt_string.h" +#include "titanic/true_talk/tt_string_node.h" namespace Titanic { @@ -32,7 +33,7 @@ class TTword { protected: TTString _string; int _fieldC; - int _field10; + TTsynonymNode *_synP; TTStringStatus _status; int _wordMode; int _field1C; @@ -44,9 +45,14 @@ protected: * Read in a number */ uint readNumber(const char *str); + + bool testFileHandle(SimpleFile *file) const; public: TTword(TTString &str, int mode, int val2); + /** + * Read in a synonym for the given word + */ int readSyn(SimpleFile *file); /** -- cgit v1.2.3 From 33ef893b04bc218a6149b3ff5b6782655767e60f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 10 May 2016 21:27:46 -0400 Subject: TITANIC: Implemented vocab findWord --- engines/titanic/true_talk/st_vocab.cpp | 38 +++++++++++++++++++++++++++++++++- engines/titanic/true_talk/st_vocab.h | 12 ++++++++++- engines/titanic/true_talk/tt_string.h | 3 ++- engines/titanic/true_talk/tt_word.cpp | 7 ++++++- engines/titanic/true_talk/tt_word.h | 8 ++++++- 5 files changed, 63 insertions(+), 5 deletions(-) diff --git a/engines/titanic/true_talk/st_vocab.cpp b/engines/titanic/true_talk/st_vocab.cpp index 1b03474292..b5223a0ae5 100644 --- a/engines/titanic/true_talk/st_vocab.cpp +++ b/engines/titanic/true_talk/st_vocab.cpp @@ -26,7 +26,7 @@ namespace Titanic { -STVocab::STVocab(int val): _field0(0), _field4(0), _word(nullptr), +STVocab::STVocab(int val): _vocab(nullptr), _field4(0), _word(nullptr), _fieldC(0), _field10(0), _field18(val) { _field14 = load("STVOCAB.TXT"); } @@ -98,10 +98,46 @@ int STVocab::load(const CString &name) { result = 4; break; } + + if (!skipFlag && _word) { + if (result) { + // Something wrong occurred, so delete word + delete _word; + _word = nullptr; + } else { + // Add the word to the master vocab list + addWord(_word); + } + } } + // Close resource and return result delete file; return result; } +void STVocab::addWord(TTword *word) { + // TODO +} + +TTword *STVocab::findWord(const TTString &str) { + TTsynonymNode *tempNode = new TTsynonymNode(); + bool flag = false; + TTword *word = _vocab; + + while (!flag) { + if (_field18 != 3 || strcmp(word->c_str(), str)) { + if (word->fn1(str, tempNode, _field18)) + word = word->_pNext; + else + flag = true; + } else { + flag = true; + } + } + + delete tempNode; + return word; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/st_vocab.h b/engines/titanic/true_talk/st_vocab.h index c44c4ddda0..19fe0b24a6 100644 --- a/engines/titanic/true_talk/st_vocab.h +++ b/engines/titanic/true_talk/st_vocab.h @@ -31,7 +31,7 @@ namespace Titanic { class STVocab { private: - int _field0; + TTword *_vocab; int _field4; TTword *_word; int _fieldC; @@ -43,6 +43,16 @@ private: * Load the vocab data */ int load(const CString &name); + + /** + * Adds a specified word to the vocab list + */ + void addWord(TTword *word); + + /** + * Scans the vocab list for an existing word match + */ + TTword *findWord(const TTString &str); public: STVocab(int val); }; diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index c7c88ff2a8..7d231b123a 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -63,7 +63,8 @@ public: */ TTStringStatus getStatus() const { return _status; } - operator const char *() const { return _data->_string.c_str(); } + const char *c_str() const { return _data->_string.c_str(); } + operator const char *() const { return c_str(); } }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index de987c281f..263b519edd 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -27,7 +27,7 @@ namespace Titanic { TTword::TTword(TTString &str, int mode, int val2) : _string(str), - _wordMode(mode), _field1C(val2), _fieldC(0), _synP(nullptr), + _wordMode(mode), _field1C(val2), _pNext(nullptr), _synP(nullptr), _field20(0), _field24(0), _field28(0) { _status = str.getStatus() == SS_VALID ? SS_VALID : SS_5; } @@ -92,6 +92,11 @@ bool TTword::testFileHandle(SimpleFile *file) const { return true; } +TTword *TTword::fn1(const TTString &str, TTsynonymNode *node, int val) { + // TODO + return nullptr; +} + /*------------------------------------------------------------------------*/ TTword1::TTword1(TTString &str, int val1, int val2, int val3) : diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index 0d6564a925..589dcf7bbe 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -32,7 +32,6 @@ namespace Titanic { class TTword { protected: TTString _string; - int _fieldC; TTsynonymNode *_synP; TTStringStatus _status; int _wordMode; @@ -47,6 +46,8 @@ protected: uint readNumber(const char *str); bool testFileHandle(SimpleFile *file) const; +public: + TTword *_pNext; public: TTword(TTString &str, int mode, int val2); @@ -59,6 +60,11 @@ public: * Load the word */ int load(SimpleFile *file, int mode); + + TTword *fn1(const TTString &str, TTsynonymNode *node, int val); + + const char *c_str() const { return _string.c_str(); } + operator const char *() const { return c_str(); } }; class TTword1 : public TTword { -- cgit v1.2.3 From 1045fda846dd607546b7f4914850771397fbebb8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 10 May 2016 22:58:28 -0400 Subject: TITANIC: Variation TTstringNode initialize method --- engines/titanic/true_talk/tt_string_node.cpp | 37 ++++++++++++++++++++++++++++ engines/titanic/true_talk/tt_string_node.h | 16 ++++++++++++ 2 files changed, 53 insertions(+) diff --git a/engines/titanic/true_talk/tt_string_node.cpp b/engines/titanic/true_talk/tt_string_node.cpp index b1e2a642e4..da805fa9f1 100644 --- a/engines/titanic/true_talk/tt_string_node.cpp +++ b/engines/titanic/true_talk/tt_string_node.cpp @@ -29,6 +29,10 @@ TTstringNode::TTstringNode() : _pPrior(nullptr), _pNext(nullptr), _field14(0), _mode(0), _field1C(0) { } +TTstringNode::~TTstringNode() { + detach(); +} + void TTstringNode::initialize(int mode) { _mode = mode; _field14 = 0; @@ -41,12 +45,34 @@ void TTstringNode::initialize(int mode) { } } +void TTstringNode::initialize(TTstringNode *oldNode) { + _mode = oldNode->_mode; + _field14 = oldNode->_field14; + + if (_string.isValid()) { + _field1C = 0; + } else { + _field1C = 11; + warning("TTstringNode::initialize has bad subobj"); + } + + delete oldNode; +} + void TTstringNode::addNode(TTstringNode *newNode) { TTstringNode *tail = getTail(); tail->_pNext = newNode; newNode->_pPrior = this; } +void TTstringNode::detach() { + if (_pPrior) + _pPrior->_pNext = _pNext; + + if (_pNext) + _pNext->_pPrior = _pPrior; +} + TTstringNode *TTstringNode::getTail() const { if (_pNext == nullptr) return nullptr; @@ -58,6 +84,17 @@ TTstringNode *TTstringNode::getTail() const { return node; } +TTstringNode *TTstringNode::scan(TTstringNode *start, const TTString &str, int mode) { + for (; start; start = start->_pNext) { + if (start->_mode == mode || (mode == 3 && start->_mode < 3)) { + if (!strcmp(start->_string.c_str(), str.c_str())) + start; + } + } + + return nullptr; +} + /*------------------------------------------------------------------------*/ TTsynonymNode::TTsynonymNode() : TTstringNode() { diff --git a/engines/titanic/true_talk/tt_string_node.h b/engines/titanic/true_talk/tt_string_node.h index e588ea4883..41ce6c5aad 100644 --- a/engines/titanic/true_talk/tt_string_node.h +++ b/engines/titanic/true_talk/tt_string_node.h @@ -38,6 +38,11 @@ protected: * Initializes state for the node */ void initialize(int mode); + + /** + * Initializes state for the node + */ + void initialize(TTstringNode *oldNode); public: TTstringNode *_pPrior; TTstringNode *_pNext; @@ -47,11 +52,22 @@ public: int _field1C; public: TTstringNode(); + virtual ~TTstringNode(); /** * Links the passed node to this node as a linked list */ void addNode(TTstringNode *newNode); + + /** + * Detaches a node from any predecessor and/or successor + */ + void detach(); + + /** + * Scan for a node with a given string + */ + static TTstringNode *scan(TTstringNode *start, const TTString &str, int mode); }; class TTsynonymNode : public TTstringNode { -- cgit v1.2.3 From fa626a8bc981b9a3009996787c3007193eab1147 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 11 May 2016 00:11:12 -0400 Subject: TITANIC: Implemented TTsynonymNode copy --- engines/titanic/true_talk/tt_string_node.cpp | 44 +++++++++++++++++++++------- engines/titanic/true_talk/tt_string_node.h | 3 ++ 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/engines/titanic/true_talk/tt_string_node.cpp b/engines/titanic/true_talk/tt_string_node.cpp index da805fa9f1..db7c846a53 100644 --- a/engines/titanic/true_talk/tt_string_node.cpp +++ b/engines/titanic/true_talk/tt_string_node.cpp @@ -59,6 +59,17 @@ void TTstringNode::initialize(TTstringNode *oldNode) { delete oldNode; } +TTstringNode *TTstringNode::scan(TTstringNode *start, const TTString &str, int mode) { + for (; start; start = start->_pNext) { + if (start->_mode == mode || (mode == 3 && start->_mode < 3)) { + if (!strcmp(start->_string.c_str(), str.c_str())) + start; + } + } + + return nullptr; +} + void TTstringNode::addNode(TTstringNode *newNode) { TTstringNode *tail = getTail(); tail->_pNext = newNode; @@ -84,22 +95,17 @@ TTstringNode *TTstringNode::getTail() const { return node; } -TTstringNode *TTstringNode::scan(TTstringNode *start, const TTString &str, int mode) { - for (; start; start = start->_pNext) { - if (start->_mode == mode || (mode == 3 && start->_mode < 3)) { - if (!strcmp(start->_string.c_str(), str.c_str())) - start; - } - } - - return nullptr; -} - /*------------------------------------------------------------------------*/ TTsynonymNode::TTsynonymNode() : TTstringNode() { } +TTsynonymNode::TTsynonymNode(const TTsynonymNode *src) { + _string = src->_string; + initialize(src->_mode); + _field14 = src->_field14; +} + TTsynonymNode::TTsynonymNode(int mode, const char *str, int val2) : TTstringNode() { _string = str; @@ -107,5 +113,21 @@ TTsynonymNode::TTsynonymNode(int mode, const char *str, int val2) : _field14 = val2; } +TTsynonymNode *TTsynonymNode::copy(TTsynonymNode *src) { + if (src->_field1C) { + _field1C = 5; + return this; + } else { + _field1C = 0; + if (src == this) + return this; + + _string = src->_string; + TTsynonymNode *newNode = new TTsynonymNode(src); + initialize(newNode); + + return this; + } +} } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_string_node.h b/engines/titanic/true_talk/tt_string_node.h index 41ce6c5aad..7b96fbf9b5 100644 --- a/engines/titanic/true_talk/tt_string_node.h +++ b/engines/titanic/true_talk/tt_string_node.h @@ -73,7 +73,10 @@ public: class TTsynonymNode : public TTstringNode { public: TTsynonymNode(); + TTsynonymNode(const TTsynonymNode *src); TTsynonymNode(int mode, const char *str, int val2); + + TTsynonymNode *copy(TTsynonymNode *src); }; } // End of namespace Titanic -- cgit v1.2.3 From e86ce94441a032de3707eb7576060d9281a3fec0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 11 May 2016 07:04:08 -0400 Subject: TITANIC: Implement TTword scanCopy --- engines/titanic/true_talk/st_vocab.cpp | 2 +- engines/titanic/true_talk/tt_string_node.cpp | 4 ++-- engines/titanic/true_talk/tt_string_node.h | 4 ++-- engines/titanic/true_talk/tt_word.cpp | 12 ++++++++++-- engines/titanic/true_talk/tt_word.h | 2 +- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/engines/titanic/true_talk/st_vocab.cpp b/engines/titanic/true_talk/st_vocab.cpp index b5223a0ae5..bf4d366d60 100644 --- a/engines/titanic/true_talk/st_vocab.cpp +++ b/engines/titanic/true_talk/st_vocab.cpp @@ -127,7 +127,7 @@ TTword *STVocab::findWord(const TTString &str) { while (!flag) { if (_field18 != 3 || strcmp(word->c_str(), str)) { - if (word->fn1(str, tempNode, _field18)) + if (word->scanCopy(str, tempNode, _field18)) word = word->_pNext; else flag = true; diff --git a/engines/titanic/true_talk/tt_string_node.cpp b/engines/titanic/true_talk/tt_string_node.cpp index db7c846a53..b3d3707ee5 100644 --- a/engines/titanic/true_talk/tt_string_node.cpp +++ b/engines/titanic/true_talk/tt_string_node.cpp @@ -100,7 +100,7 @@ TTstringNode *TTstringNode::getTail() const { TTsynonymNode::TTsynonymNode() : TTstringNode() { } -TTsynonymNode::TTsynonymNode(const TTsynonymNode *src) { +TTsynonymNode::TTsynonymNode(const TTstringNode *src) { _string = src->_string; initialize(src->_mode); _field14 = src->_field14; @@ -113,7 +113,7 @@ TTsynonymNode::TTsynonymNode(int mode, const char *str, int val2) : _field14 = val2; } -TTsynonymNode *TTsynonymNode::copy(TTsynonymNode *src) { +TTsynonymNode *TTsynonymNode::copy(TTstringNode *src) { if (src->_field1C) { _field1C = 5; return this; diff --git a/engines/titanic/true_talk/tt_string_node.h b/engines/titanic/true_talk/tt_string_node.h index 7b96fbf9b5..f836889f43 100644 --- a/engines/titanic/true_talk/tt_string_node.h +++ b/engines/titanic/true_talk/tt_string_node.h @@ -73,10 +73,10 @@ public: class TTsynonymNode : public TTstringNode { public: TTsynonymNode(); - TTsynonymNode(const TTsynonymNode *src); + TTsynonymNode(const TTstringNode *src); TTsynonymNode(int mode, const char *str, int val2); - TTsynonymNode *copy(TTsynonymNode *src); + TTsynonymNode *copy(TTstringNode *src); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index 263b519edd..7f4b5a8dde 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -92,8 +92,16 @@ bool TTword::testFileHandle(SimpleFile *file) const { return true; } -TTword *TTword::fn1(const TTString &str, TTsynonymNode *node, int val) { - // TODO +TTword *TTword::scanCopy(const TTString &str, TTsynonymNode *node, int mode) { + if (_synP) { + TTstringNode *strNode = _synP->scan(_synP, str, mode); + if (strNode) { + node->copy(strNode); + node->_pPrior = nullptr; + node->_pNext = nullptr; + } + } + return nullptr; } diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index 589dcf7bbe..277f180d6c 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -61,7 +61,7 @@ public: */ int load(SimpleFile *file, int mode); - TTword *fn1(const TTString &str, TTsynonymNode *node, int val); + TTword *scanCopy(const TTString &str, TTsynonymNode *node, int mode); const char *c_str() const { return _string.c_str(); } operator const char *() const { return c_str(); } -- cgit v1.2.3 From b8c41050211c6b5c25a9e02a767a54b8e1ef55d7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 11 May 2016 07:23:08 -0400 Subject: TITANIC: Implemented STVocab addWord --- engines/titanic/true_talk/st_vocab.cpp | 26 +++++++++++++++++++++++--- engines/titanic/true_talk/st_vocab.h | 4 ++-- engines/titanic/true_talk/tt_word.cpp | 7 +++++++ engines/titanic/true_talk/tt_word.h | 9 +++++++-- 4 files changed, 39 insertions(+), 7 deletions(-) diff --git a/engines/titanic/true_talk/st_vocab.cpp b/engines/titanic/true_talk/st_vocab.cpp index bf4d366d60..5135f6466e 100644 --- a/engines/titanic/true_talk/st_vocab.cpp +++ b/engines/titanic/true_talk/st_vocab.cpp @@ -26,7 +26,7 @@ namespace Titanic { -STVocab::STVocab(int val): _vocab(nullptr), _field4(0), _word(nullptr), +STVocab::STVocab(int val): _pHead(nullptr), _pTail(nullptr), _word(nullptr), _fieldC(0), _field10(0), _field18(val) { _field14 = load("STVOCAB.TXT"); } @@ -117,13 +117,33 @@ int STVocab::load(const CString &name) { } void STVocab::addWord(TTword *word) { - // TODO + TTword *existingWord = findWord(word->_string); + + if (existingWord) { + if (word->_synP) { + // Move over the synonym + existingWord->appendNode(word->_synP); + word->_synP = nullptr; + } + + _word = nullptr; + if (word) + delete word; + } else if (_pTail) { + _pTail->_pNext = word; + _pTail = word; + } else { + if (!_pHead) + _pHead = word; + + _pTail = word; + } } TTword *STVocab::findWord(const TTString &str) { TTsynonymNode *tempNode = new TTsynonymNode(); bool flag = false; - TTword *word = _vocab; + TTword *word = _pHead; while (!flag) { if (_field18 != 3 || strcmp(word->c_str(), str)) { diff --git a/engines/titanic/true_talk/st_vocab.h b/engines/titanic/true_talk/st_vocab.h index 19fe0b24a6..68ce86b7cf 100644 --- a/engines/titanic/true_talk/st_vocab.h +++ b/engines/titanic/true_talk/st_vocab.h @@ -31,8 +31,8 @@ namespace Titanic { class STVocab { private: - TTword *_vocab; - int _field4; + TTword *_pHead; + TTword *_pTail; TTword *_word; int _fieldC; int _field10; diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index 7f4b5a8dde..7fc5263c88 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -56,6 +56,13 @@ int TTword::readSyn(SimpleFile *file) { return 0; } +void TTword::appendNode(TTsynonymNode *node) { + if (_synP) + _synP->addNode(node); + else + _synP = node; +} + int TTword::load(SimpleFile *file, int mode) { CString str1, str2; int val; diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index 277f180d6c..a535cac834 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -31,8 +31,6 @@ namespace Titanic { class TTword { protected: - TTString _string; - TTsynonymNode *_synP; TTStringStatus _status; int _wordMode; int _field1C; @@ -48,6 +46,8 @@ protected: bool testFileHandle(SimpleFile *file) const; public: TTword *_pNext; + TTsynonymNode *_synP; + TTString _string; public: TTword(TTString &str, int mode, int val2); @@ -56,6 +56,11 @@ public: */ int readSyn(SimpleFile *file); + /** + * Either sets the first synonym for a word, or adds it to an existing one + */ + void appendNode(TTsynonymNode *node); + /** * Load the word */ -- cgit v1.2.3 From b8a7a98c544eeae453b0b62cffdac7a59f43b737 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 11 May 2016 07:32:46 -0400 Subject: TITANIC: Bugfixes for vocab loading --- engines/titanic/true_talk/st_vocab.cpp | 2 +- engines/titanic/true_talk/tt_string_node.cpp | 4 ++-- engines/titanic/true_talk/tt_string_node.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/titanic/true_talk/st_vocab.cpp b/engines/titanic/true_talk/st_vocab.cpp index 5135f6466e..a4f5cd851d 100644 --- a/engines/titanic/true_talk/st_vocab.cpp +++ b/engines/titanic/true_talk/st_vocab.cpp @@ -145,7 +145,7 @@ TTword *STVocab::findWord(const TTString &str) { bool flag = false; TTword *word = _pHead; - while (!flag) { + while (word && !flag) { if (_field18 != 3 || strcmp(word->c_str(), str)) { if (word->scanCopy(str, tempNode, _field18)) word = word->_pNext; diff --git a/engines/titanic/true_talk/tt_string_node.cpp b/engines/titanic/true_talk/tt_string_node.cpp index b3d3707ee5..95b6465137 100644 --- a/engines/titanic/true_talk/tt_string_node.cpp +++ b/engines/titanic/true_talk/tt_string_node.cpp @@ -84,9 +84,9 @@ void TTstringNode::detach() { _pNext->_pPrior = _pPrior; } -TTstringNode *TTstringNode::getTail() const { +TTstringNode *TTstringNode::getTail() { if (_pNext == nullptr) - return nullptr; + return this; TTstringNode *node = _pNext; while (node->_pNext) diff --git a/engines/titanic/true_talk/tt_string_node.h b/engines/titanic/true_talk/tt_string_node.h index f836889f43..2c6a4e148d 100644 --- a/engines/titanic/true_talk/tt_string_node.h +++ b/engines/titanic/true_talk/tt_string_node.h @@ -32,7 +32,7 @@ private: /** * Returns the final node at the end of the linked list of nodes */ - TTstringNode *getTail() const; + TTstringNode *getTail(); protected: /** * Initializes state for the node -- cgit v1.2.3 From 17de345191ab9fde2ed1469c5e325347313decdf Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 11 May 2016 13:15:23 -0400 Subject: TITANIC: Fix conditional checks in TTword classes load methods --- engines/titanic/true_talk/tt_word.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index 7fc5263c88..3fa5381684 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -127,7 +127,7 @@ TTword2::TTword2(TTString &str, int val1, int val2, int val3, int val4) : int TTword2::load(SimpleFile *file) { int val; - if (TTword::load(file, 1) && file->scanf("%d", &val)) { + if (!TTword::load(file, 1) && file->scanf("%d", &val)) { _field30 = val; return 0; } else { @@ -171,7 +171,7 @@ TTword4::TTword4(TTString &str, int val1, int val2, int val3, int val4) : int TTword4::load(SimpleFile *file) { int val; - if (TTword::load(file, 1) && file->scanf("%d", &val)) { + if (!TTword::load(file, 1) && file->scanf("%d", &val)) { _field30 = val; return 0; } else { @@ -188,7 +188,7 @@ TTword5::TTword5(TTString &str, int val1, int val2, int val3, int val4) : int TTword5::load(SimpleFile *file) { int val; - if (TTword::load(file, 1) && file->scanf("%d", &val)) { + if (!TTword::load(file, 1) && file->scanf("%d", &val)) { if (val >= 0 && val <= 12) { _field30 = val; return 0; -- cgit v1.2.3 From a27d49a43ccc699751b049e0631209c214ef71de Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 11 May 2016 13:33:42 -0400 Subject: TITANIC: Fix finding existing words in STVocab findWord --- engines/titanic/true_talk/st_vocab.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/titanic/true_talk/st_vocab.cpp b/engines/titanic/true_talk/st_vocab.cpp index a4f5cd851d..138af06854 100644 --- a/engines/titanic/true_talk/st_vocab.cpp +++ b/engines/titanic/true_talk/st_vocab.cpp @@ -148,9 +148,9 @@ TTword *STVocab::findWord(const TTString &str) { while (word && !flag) { if (_field18 != 3 || strcmp(word->c_str(), str)) { if (word->scanCopy(str, tempNode, _field18)) - word = word->_pNext; - else flag = true; + else + word = word->_pNext; } else { flag = true; } -- cgit v1.2.3 From 9c8d4f234b3eb8f825b51a225466228c3cf0c727 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 11 May 2016 18:54:28 -0400 Subject: TITANIC: Split TTsynonymNode into it's own file, and rename to TTsynonym --- engines/titanic/module.mk | 1 + engines/titanic/true_talk/st_vocab.cpp | 2 +- engines/titanic/true_talk/tt_string_node.cpp | 46 ------------------ engines/titanic/true_talk/tt_string_node.h | 14 ------ engines/titanic/true_talk/tt_synonym.cpp | 71 ++++++++++++++++++++++++++++ engines/titanic/true_talk/tt_synonym.h | 47 ++++++++++++++++++ engines/titanic/true_talk/tt_word.cpp | 8 ++-- engines/titanic/true_talk/tt_word.h | 8 ++-- 8 files changed, 128 insertions(+), 69 deletions(-) create mode 100644 engines/titanic/true_talk/tt_synonym.cpp create mode 100644 engines/titanic/true_talk/tt_synonym.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 23354b40f6..42103e77da 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -467,6 +467,7 @@ MODULE_OBJS := \ true_talk/tt_scripts.o \ true_talk/tt_string.o \ true_talk/tt_string_node.o \ + true_talk/tt_synonym.o \ true_talk/tt_talker.o \ true_talk/tt_title_script.o \ true_talk/tt_word.o diff --git a/engines/titanic/true_talk/st_vocab.cpp b/engines/titanic/true_talk/st_vocab.cpp index 138af06854..084393bf87 100644 --- a/engines/titanic/true_talk/st_vocab.cpp +++ b/engines/titanic/true_talk/st_vocab.cpp @@ -141,7 +141,7 @@ void STVocab::addWord(TTword *word) { } TTword *STVocab::findWord(const TTString &str) { - TTsynonymNode *tempNode = new TTsynonymNode(); + TTsynonym *tempNode = new TTsynonym(); bool flag = false; TTword *word = _pHead; diff --git a/engines/titanic/true_talk/tt_string_node.cpp b/engines/titanic/true_talk/tt_string_node.cpp index 95b6465137..cf01ac6063 100644 --- a/engines/titanic/true_talk/tt_string_node.cpp +++ b/engines/titanic/true_talk/tt_string_node.cpp @@ -59,17 +59,6 @@ void TTstringNode::initialize(TTstringNode *oldNode) { delete oldNode; } -TTstringNode *TTstringNode::scan(TTstringNode *start, const TTString &str, int mode) { - for (; start; start = start->_pNext) { - if (start->_mode == mode || (mode == 3 && start->_mode < 3)) { - if (!strcmp(start->_string.c_str(), str.c_str())) - start; - } - } - - return nullptr; -} - void TTstringNode::addNode(TTstringNode *newNode) { TTstringNode *tail = getTail(); tail->_pNext = newNode; @@ -95,39 +84,4 @@ TTstringNode *TTstringNode::getTail() { return node; } -/*------------------------------------------------------------------------*/ - -TTsynonymNode::TTsynonymNode() : TTstringNode() { -} - -TTsynonymNode::TTsynonymNode(const TTstringNode *src) { - _string = src->_string; - initialize(src->_mode); - _field14 = src->_field14; -} - -TTsynonymNode::TTsynonymNode(int mode, const char *str, int val2) : - TTstringNode() { - _string = str; - initialize(mode); - _field14 = val2; -} - -TTsynonymNode *TTsynonymNode::copy(TTstringNode *src) { - if (src->_field1C) { - _field1C = 5; - return this; - } else { - _field1C = 0; - if (src == this) - return this; - - _string = src->_string; - TTsynonymNode *newNode = new TTsynonymNode(src); - initialize(newNode); - - return this; - } -} - } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_string_node.h b/engines/titanic/true_talk/tt_string_node.h index 2c6a4e148d..dddef8db0f 100644 --- a/engines/titanic/true_talk/tt_string_node.h +++ b/engines/titanic/true_talk/tt_string_node.h @@ -63,20 +63,6 @@ public: * Detaches a node from any predecessor and/or successor */ void detach(); - - /** - * Scan for a node with a given string - */ - static TTstringNode *scan(TTstringNode *start, const TTString &str, int mode); -}; - -class TTsynonymNode : public TTstringNode { -public: - TTsynonymNode(); - TTsynonymNode(const TTstringNode *src); - TTsynonymNode(int mode, const char *str, int val2); - - TTsynonymNode *copy(TTstringNode *src); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_synonym.cpp b/engines/titanic/true_talk/tt_synonym.cpp new file mode 100644 index 0000000000..5da124ab27 --- /dev/null +++ b/engines/titanic/true_talk/tt_synonym.cpp @@ -0,0 +1,71 @@ +/* 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 "titanic/true_talk/tt_synonym.h" + +namespace Titanic { + +TTsynonym::TTsynonym() : TTstringNode() { +} + +TTsynonym::TTsynonym(const TTstringNode *src) { + _string = src->_string; + initialize(src->_mode); + _field14 = src->_field14; +} + +TTsynonym::TTsynonym(int mode, const char *str, int val2) : + TTstringNode() { + _string = str; + initialize(mode); + _field14 = val2; +} + +TTsynonym *TTsynonym::findByName(TTsynonym *start, const TTString &str, int mode) { + for (; start; start = static_cast(start->_pNext)) { + if (start->_mode == mode || (mode == 3 && start->_mode < 3)) { + if (!strcmp(start->_string.c_str(), str.c_str())) + start; + } + } + + return nullptr; +} + +TTsynonym *TTsynonym::copy(TTstringNode *src) { + if (src->_field1C) { + _field1C = 5; + return this; + } else { + _field1C = 0; + if (src == this) + return this; + + _string = src->_string; + TTsynonym *newNode = new TTsynonym(src); + initialize(newNode); + + return this; + } +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_synonym.h b/engines/titanic/true_talk/tt_synonym.h new file mode 100644 index 0000000000..6a20ef37a4 --- /dev/null +++ b/engines/titanic/true_talk/tt_synonym.h @@ -0,0 +1,47 @@ +/* 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. + * + */ + +#ifndef TITANIC_TT_SYNONYM_H +#define TITANIC_TT_SYNONYM_H + +#include "titanic/true_talk/tt_string_node.h" + +namespace Titanic { + +class TTsynonym : public TTstringNode { +public: + TTsynonym(); + TTsynonym(const TTstringNode *src); + TTsynonym(int mode, const char *str, int val2); + + TTsynonym *copy(TTstringNode *src); + + /** + * Scan for a synonym with a given string + */ + static TTsynonym *findByName(TTsynonym *start, const TTString &str, int mode); + +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_SYNONYM_H */ diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index 3fa5381684..431a1d8767 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -42,7 +42,7 @@ int TTword::readSyn(SimpleFile *file) { return 5; // Create new synanym node - TTsynonymNode *synNode = new TTsynonymNode(mode, str.c_str(), val1); + TTsynonym *synNode = new TTsynonym(mode, str.c_str(), val1); if (_synP) { // A synonym already exists, so add new one as a tail @@ -56,7 +56,7 @@ int TTword::readSyn(SimpleFile *file) { return 0; } -void TTword::appendNode(TTsynonymNode *node) { +void TTword::appendNode(TTsynonym *node) { if (_synP) _synP->addNode(node); else @@ -99,9 +99,9 @@ bool TTword::testFileHandle(SimpleFile *file) const { return true; } -TTword *TTword::scanCopy(const TTString &str, TTsynonymNode *node, int mode) { +TTword *TTword::scanCopy(const TTString &str, TTsynonym *node, int mode) { if (_synP) { - TTstringNode *strNode = _synP->scan(_synP, str, mode); + TTstringNode *strNode = TTsynonym::findByName(_synP, str, mode); if (strNode) { node->copy(strNode); node->_pPrior = nullptr; diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index a535cac834..850b6957f8 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -25,7 +25,7 @@ #include "titanic/support/simple_file.h" #include "titanic/true_talk/tt_string.h" -#include "titanic/true_talk/tt_string_node.h" +#include "titanic/true_talk/tt_synonym.h" namespace Titanic { @@ -46,7 +46,7 @@ protected: bool testFileHandle(SimpleFile *file) const; public: TTword *_pNext; - TTsynonymNode *_synP; + TTsynonym *_synP; TTString _string; public: TTword(TTString &str, int mode, int val2); @@ -59,14 +59,14 @@ public: /** * Either sets the first synonym for a word, or adds it to an existing one */ - void appendNode(TTsynonymNode *node); + void appendNode(TTsynonym *node); /** * Load the word */ int load(SimpleFile *file, int mode); - TTword *scanCopy(const TTString &str, TTsynonymNode *node, int mode); + TTword *scanCopy(const TTString &str, TTsynonym *node, int mode); const char *c_str() const { return _string.c_str(); } operator const char *() const { return c_str(); } -- cgit v1.2.3 From 96a11a08bd4c59cc17a0d502e45c3c0480925c3f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 11 May 2016 19:13:46 -0400 Subject: TITANIC: Fix loading TTword3 vocab --- engines/titanic/true_talk/tt_word.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index 431a1d8767..067560bfa8 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -146,7 +146,7 @@ int TTword3::load(SimpleFile *file) { CString str; int val1, val2; - if (!TTword::load(file, 2) && file->scanf("%d %d %d", &str, &val1, &val2)) { + if (!TTword::load(file, 2) && file->scanf("%s %d %d", &str, &val1, &val2)) { _field34 = readNumber(str.c_str()); _field30 = val1; _field3C = val2; -- cgit v1.2.3 From 01320c06cbb6a25ee226c1037152d5348b73cd68 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 11 May 2016 21:06:14 -0400 Subject: TITANIC: Vocab list is now completely loading --- engines/titanic/support/simple_file.cpp | 16 ++++++++++++---- engines/titanic/support/simple_file.h | 7 ++++++- engines/titanic/true_talk/tt_word.cpp | 4 ++-- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/engines/titanic/support/simple_file.cpp b/engines/titanic/support/simple_file.cpp index 85f42aeeb5..80f5178298 100644 --- a/engines/titanic/support/simple_file.cpp +++ b/engines/titanic/support/simple_file.cpp @@ -368,16 +368,14 @@ bool SimpleFile::scanf(const char *format, ...) { CString formatStr(format); while (!formatStr.empty()) { if (formatStr.hasPrefix(" ")) { - // Skip over whitespaces formatStr.deleteChar(0); safeRead(&c, 1); if (!Common::isSpace(c)) return false; - while (Common::isSpace(c)) - safeRead(&c, 1); - _inStream->skip(-1); + // Skip over whitespaces + skipSpaces(); } else if (formatStr.hasPrefix("%d")) { // Read in a number formatStr = CString(formatStr.c_str() + 2); @@ -399,10 +397,20 @@ bool SimpleFile::scanf(const char *format, ...) { } } + skipSpaces(); va_end(va); return !eos(); } +void SimpleFile::skipSpaces() { + char c = ' '; + while (!eos() && Common::isSpace(c)) + safeRead(&c, 1); + + if (!eos()) + _inStream->skip(-1); +} + /*------------------------------------------------------------------------*/ void StdCWadFile::open(const CString &name) { diff --git a/engines/titanic/support/simple_file.h b/engines/titanic/support/simple_file.h index db453c46c7..2a4cfdbbc0 100644 --- a/engines/titanic/support/simple_file.h +++ b/engines/titanic/support/simple_file.h @@ -48,6 +48,11 @@ public: * This class implements basic reading and writing to files */ class SimpleFile { +private: + /** + * Skip over any pending spaces + */ + void skipSpaces(); protected: Common::SeekableReadStream *_inStream; Common::OutSaveFile *_outStream; @@ -213,7 +218,7 @@ public: */ bool eos() const { assert(_inStream); - return _inStream->eos(); + return _inStream->pos() >= _inStream->size(); } }; diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index 067560bfa8..143e1dfbd2 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -171,7 +171,7 @@ TTword4::TTword4(TTString &str, int val1, int val2, int val3, int val4) : int TTword4::load(SimpleFile *file) { int val; - if (!TTword::load(file, 1) && file->scanf("%d", &val)) { + if (!TTword::load(file, 8) && file->scanf("%d", &val)) { _field30 = val; return 0; } else { @@ -188,7 +188,7 @@ TTword5::TTword5(TTString &str, int val1, int val2, int val3, int val4) : int TTword5::load(SimpleFile *file) { int val; - if (!TTword::load(file, 1) && file->scanf("%d", &val)) { + if (!TTword::load(file, 6) && file->scanf("%d", &val)) { if (val >= 0 && val <= 12) { _field30 = val; return 0; -- cgit v1.2.3 From 7700923298da4002a5d0baf28913a46e7e0fcf59 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 11 May 2016 21:17:28 -0400 Subject: TITANIC: Change CFileReader to CExeResoucres --- engines/titanic/module.mk | 2 +- engines/titanic/support/exe_resources.cpp | 36 ++++++++++++++++++++ engines/titanic/support/exe_resources.h | 51 ++++++++++++++++++++++++++++ engines/titanic/support/file_reader.cpp | 36 -------------------- engines/titanic/support/file_reader.h | 51 ---------------------------- engines/titanic/titanic.h | 4 +-- engines/titanic/true_talk/script_handler.cpp | 4 +-- engines/titanic/true_talk/script_handler.h | 4 +-- engines/titanic/true_talk/st_vocab.cpp | 2 +- engines/titanic/true_talk/tt_word.cpp | 2 +- 10 files changed, 96 insertions(+), 96 deletions(-) create mode 100644 engines/titanic/support/exe_resources.cpp create mode 100644 engines/titanic/support/exe_resources.h delete mode 100644 engines/titanic/support/file_reader.cpp delete mode 100644 engines/titanic/support/file_reader.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 42103e77da..47da6d4230 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -431,7 +431,7 @@ MODULE_OBJS := \ star_control/star_control_sub15.o \ support/direct_draw.o \ support/direct_draw_surface.o \ - support/file_reader.o \ + support/exe_resources.o \ support/files_manager.o \ support/font.o \ support/image.o \ diff --git a/engines/titanic/support/exe_resources.cpp b/engines/titanic/support/exe_resources.cpp new file mode 100644 index 0000000000..91139dce3d --- /dev/null +++ b/engines/titanic/support/exe_resources.cpp @@ -0,0 +1,36 @@ +/* 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 "titanic/support/exe_resources.h" + +namespace Titanic { + +CExeResources::CExeResources() : _owner(nullptr), _field4(0), _field8(0), + _fieldC(0), _field10(0), _field14(0), _field18(0) { +} + +void CExeResources::reset(CScriptHandler *owner, int val1, int val2) { + _owner = owner; + _field18 = val2; +} + +} // End of namespace Titanic diff --git a/engines/titanic/support/exe_resources.h b/engines/titanic/support/exe_resources.h new file mode 100644 index 0000000000..48b48d4933 --- /dev/null +++ b/engines/titanic/support/exe_resources.h @@ -0,0 +1,51 @@ +/* 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. + * + */ + +#ifndef TITANIC_EXE_RESOURCES_H +#define TITANIC_EXE_RESOURCES_H + +#include "common/file.h" + +namespace Titanic { + +class CScriptHandler; + +class CExeResources { +public: + CScriptHandler *_owner; + int _field4; + int _field8; + int _fieldC; + int _field10; + int _field14; + int _field18; +public: + CExeResources(); + + void reset(CScriptHandler *owner, int val1, int val2); + + bool is18Equals(int val) const { return _field18 == val; } +}; + +} // End of namespace Titanic + +#endif /* TITANIC_EXE_RESOURCES_H */ diff --git a/engines/titanic/support/file_reader.cpp b/engines/titanic/support/file_reader.cpp deleted file mode 100644 index f31d72bda5..0000000000 --- a/engines/titanic/support/file_reader.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 "titanic/support/file_reader.h" - -namespace Titanic { - -CFileReader::CFileReader() : _owner(nullptr), _field4(0), _field8(0), - _fieldC(0), _field10(0), _field14(0), _field18(0) { -} - -void CFileReader::reset(CScriptHandler *owner, int val1, int val2) { - _owner = owner; - _field18 = val2; -} - -} // End of namespace Titanic diff --git a/engines/titanic/support/file_reader.h b/engines/titanic/support/file_reader.h deleted file mode 100644 index 42ab43c294..0000000000 --- a/engines/titanic/support/file_reader.h +++ /dev/null @@ -1,51 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_FILE_READER_H -#define TITANIC_FILE_READER_H - -#include "common/file.h" - -namespace Titanic { - -class CScriptHandler; - -class CFileReader { -public: - CScriptHandler *_owner; - int _field4; - int _field8; - int _fieldC; - int _field10; - int _field14; - int _field18; -public: - CFileReader(); - - void reset(CScriptHandler *owner, int val1, int val2); - - bool is18Equals(int val) const { return _field18 == val; } -}; - -} // End of namespace Titanic - -#endif /* TITANIC_FILE_READER_H */ diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index 71e8fcdf2c..78f19c5ba1 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -34,7 +34,7 @@ #include "titanic/events.h" #include "titanic/support/files_manager.h" #include "titanic/main_game_window.h" -#include "titanic/support/file_reader.h" +#include "titanic/support/exe_resources.h" #include "titanic/support/movie.h" #include "titanic/support/screen_manager.h" #include "titanic/support/string.h" @@ -120,7 +120,7 @@ public: Common::RandomSource _randomSource; CScriptHandler *_scriptHandler; TTScriptBase *_script; - CFileReader _fileReader; + CExeResources _exeResources; CMovieList _activeMovies; CString _itemNames[TOTAL_ITEMS]; CString _itemDescriptions[TOTAL_ITEMS]; diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index 67ce8be61f..d19c08aa0e 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -28,12 +28,12 @@ namespace Titanic { /*------------------------------------------------------------------------*/ CScriptHandler::CScriptHandler(CTitleEngine *owner, int val1, int val2) : - _owner(owner), _script(owner->_script), _reader(g_vm->_fileReader), + _owner(owner), _script(owner->_script), _resources(g_vm->_exeResources), _sub1(), _sub2(this), _field10(0), _inputCtr(0), _field20(0), _field24(0), _field28(0), _field2C(0), _field30(0) { g_vm->_scriptHandler = this; g_vm->_script = _script; - g_vm->_fileReader.reset(this, val1, val2); + g_vm->_exeResources.reset(this, val1, val2); _vocab = new STVocab(val2); } diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index 58d58d6d27..8449a72282 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -27,7 +27,7 @@ #include "titanic/true_talk/tt_room_script.h" #include "titanic/true_talk/tt_string.h" #include "titanic/true_talk/st_vocab.h" -#include "titanic/support/file_reader.h" +#include "titanic/support/exe_resources.h" namespace Titanic { @@ -65,7 +65,7 @@ private: CTitleEngine *_owner; TTScriptBase *_script; STVocab *_vocab; - CFileReader &_reader; + CExeResources &_resources; int _field10; CScriptHandlerSub1 _sub1; CScriptHandlerSub2 _sub2; diff --git a/engines/titanic/true_talk/st_vocab.cpp b/engines/titanic/true_talk/st_vocab.cpp index 084393bf87..df683c7ad7 100644 --- a/engines/titanic/true_talk/st_vocab.cpp +++ b/engines/titanic/true_talk/st_vocab.cpp @@ -32,7 +32,7 @@ STVocab::STVocab(int val): _pHead(nullptr), _pTail(nullptr), _word(nullptr), } int STVocab::load(const CString &name) { - SimpleFile *file = g_vm->_fileReader._owner->openResource(name); + SimpleFile *file = g_vm->_exeResources._owner->openResource(name); int result = 0; bool skipFlag; diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index 143e1dfbd2..53d4bd8078 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -92,7 +92,7 @@ uint TTword::readNumber(const char *str) { } bool TTword::testFileHandle(SimpleFile *file) const { - if (g_vm->_fileReader.is18Equals(3)) + if (g_vm->_exeResources.is18Equals(3)) return true; // TODO: Figure out why original compares passed file handle against specific values -- cgit v1.2.3 From 2f2397f7df053fb17badd93b15ea5270892232b2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 11 May 2016 21:36:45 -0400 Subject: TITANIC: Added STVocab destructor --- engines/titanic/true_talk/st_vocab.cpp | 8 ++++++++ engines/titanic/true_talk/st_vocab.h | 1 + engines/titanic/true_talk/tt_word.cpp | 8 ++++++++ engines/titanic/true_talk/tt_word.h | 5 +++++ 4 files changed, 22 insertions(+) diff --git a/engines/titanic/true_talk/st_vocab.cpp b/engines/titanic/true_talk/st_vocab.cpp index df683c7ad7..8ea2b53871 100644 --- a/engines/titanic/true_talk/st_vocab.cpp +++ b/engines/titanic/true_talk/st_vocab.cpp @@ -31,6 +31,14 @@ STVocab::STVocab(int val): _pHead(nullptr), _pTail(nullptr), _word(nullptr), _field14 = load("STVOCAB.TXT"); } +STVocab::~STVocab() { + if (_pHead) { + _pHead->deleteSiblings(); + delete _pHead; + _pHead = _pTail = nullptr; + } +} + int STVocab::load(const CString &name) { SimpleFile *file = g_vm->_exeResources._owner->openResource(name); int result = 0; diff --git a/engines/titanic/true_talk/st_vocab.h b/engines/titanic/true_talk/st_vocab.h index 68ce86b7cf..6a86825ef7 100644 --- a/engines/titanic/true_talk/st_vocab.h +++ b/engines/titanic/true_talk/st_vocab.h @@ -55,6 +55,7 @@ private: TTword *findWord(const TTString &str); public: STVocab(int val); + ~STVocab(); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index 53d4bd8078..b7309b2c63 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -32,6 +32,14 @@ TTword::TTword(TTString &str, int mode, int val2) : _string(str), _status = str.getStatus() == SS_VALID ? SS_VALID : SS_5; } +void TTword::deleteSiblings() { + while (_pNext) { + TTword *next = _pNext; + _pNext = next->_pNext; + delete next; + } +} + int TTword::readSyn(SimpleFile *file) { CString str; int mode, val1; diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index 850b6957f8..ad2ddeb987 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -51,6 +51,11 @@ public: public: TTword(TTString &str, int mode, int val2); + /** + * Delete any following words chained to the word + */ + void deleteSiblings(); + /** * Read in a synonym for the given word */ -- cgit v1.2.3 From 4410c75599def09cfbb181268f5a894f1aa11b44 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 11 May 2016 21:47:47 -0400 Subject: TITANIC: Rename STVocab to TTvocab to match original --- engines/titanic/module.mk | 2 +- engines/titanic/true_talk/script_handler.cpp | 2 +- engines/titanic/true_talk/script_handler.h | 4 +- engines/titanic/true_talk/st_vocab.cpp | 171 --------------------------- engines/titanic/true_talk/st_vocab.h | 63 ---------- engines/titanic/true_talk/tt_vocab.cpp | 171 +++++++++++++++++++++++++++ engines/titanic/true_talk/tt_vocab.h | 63 ++++++++++ 7 files changed, 238 insertions(+), 238 deletions(-) delete mode 100644 engines/titanic/true_talk/st_vocab.cpp delete mode 100644 engines/titanic/true_talk/st_vocab.h create mode 100644 engines/titanic/true_talk/tt_vocab.cpp create mode 100644 engines/titanic/true_talk/tt_vocab.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 47da6d4230..cac64a57c2 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -459,7 +459,6 @@ MODULE_OBJS := \ true_talk/succubus_script.o \ true_talk/title_engine.o \ true_talk/script_handler.o \ - true_talk/st_vocab.o \ true_talk/true_talk_manager.o \ true_talk/tt_script_base.o \ true_talk/tt_room_script.o \ @@ -470,6 +469,7 @@ MODULE_OBJS := \ true_talk/tt_synonym.o \ true_talk/tt_talker.o \ true_talk/tt_title_script.o \ + true_talk/tt_vocab.o \ true_talk/tt_word.o # This module can be built as a plugin diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index d19c08aa0e..d050c0492e 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -34,7 +34,7 @@ CScriptHandler::CScriptHandler(CTitleEngine *owner, int val1, int val2) : g_vm->_scriptHandler = this; g_vm->_script = _script; g_vm->_exeResources.reset(this, val1, val2); - _vocab = new STVocab(val2); + _vocab = new TTvocab(val2); } CScriptHandler::~CScriptHandler() { diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index 8449a72282..80532a7dda 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -26,7 +26,7 @@ #include "titanic/true_talk/tt_npc_script.h" #include "titanic/true_talk/tt_room_script.h" #include "titanic/true_talk/tt_string.h" -#include "titanic/true_talk/st_vocab.h" +#include "titanic/true_talk/tt_vocab.h" #include "titanic/support/exe_resources.h" namespace Titanic { @@ -64,7 +64,7 @@ class CScriptHandler { private: CTitleEngine *_owner; TTScriptBase *_script; - STVocab *_vocab; + TTvocab *_vocab; CExeResources &_resources; int _field10; CScriptHandlerSub1 _sub1; diff --git a/engines/titanic/true_talk/st_vocab.cpp b/engines/titanic/true_talk/st_vocab.cpp deleted file mode 100644 index 8ea2b53871..0000000000 --- a/engines/titanic/true_talk/st_vocab.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* 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/file.h" -#include "titanic/true_talk/st_vocab.h" -#include "titanic/titanic.h" - -namespace Titanic { - -STVocab::STVocab(int val): _pHead(nullptr), _pTail(nullptr), _word(nullptr), - _fieldC(0), _field10(0), _field18(val) { - _field14 = load("STVOCAB.TXT"); -} - -STVocab::~STVocab() { - if (_pHead) { - _pHead->deleteSiblings(); - delete _pHead; - _pHead = _pTail = nullptr; - } -} - -int STVocab::load(const CString &name) { - SimpleFile *file = g_vm->_exeResources._owner->openResource(name); - int result = 0; - bool skipFlag; - - while (!result && !file->eos()) { - skipFlag = false; - int mode = file->readNumber(); - TTString space(" "); - - switch (mode) { - case 0: { - if (_word) - result = _word->readSyn(file); - skipFlag = true; - break; - } - - case 1: { - TTword2 *word = new TTword2(space, 0, 0, 0, 0); - result = word->load(file); - _word = word; - break; - } - - case 2: { - TTword3 *word = new TTword3(space, 0, 0, 0, 0, 0, 0); - result = word->load(file); - _word = word; - break; - } - - case 3: - case 9: { - TTword1 *word = new TTword1(space, 0, 0, 0); - result = word->load(file, mode); - _word = word; - break; - } - - case 4: - case 5: - case 7: { - TTword *word = new TTword(space, 0, 0); - result = word->load(file, mode); - _word = word; - break; - } - - case 8: { - TTword4 *word = new TTword4(space, 0, 0, 0, 0); - result = word->load(file); - _word = word; - break; - } - - case 6: { - TTword5 *word = new TTword5(space, 0, 0, 0, 0); - result = word->load(file); - _word = word; - break; - } - - default: - result = 4; - break; - } - - if (!skipFlag && _word) { - if (result) { - // Something wrong occurred, so delete word - delete _word; - _word = nullptr; - } else { - // Add the word to the master vocab list - addWord(_word); - } - } - } - - // Close resource and return result - delete file; - return result; -} - -void STVocab::addWord(TTword *word) { - TTword *existingWord = findWord(word->_string); - - if (existingWord) { - if (word->_synP) { - // Move over the synonym - existingWord->appendNode(word->_synP); - word->_synP = nullptr; - } - - _word = nullptr; - if (word) - delete word; - } else if (_pTail) { - _pTail->_pNext = word; - _pTail = word; - } else { - if (!_pHead) - _pHead = word; - - _pTail = word; - } -} - -TTword *STVocab::findWord(const TTString &str) { - TTsynonym *tempNode = new TTsynonym(); - bool flag = false; - TTword *word = _pHead; - - while (word && !flag) { - if (_field18 != 3 || strcmp(word->c_str(), str)) { - if (word->scanCopy(str, tempNode, _field18)) - flag = true; - else - word = word->_pNext; - } else { - flag = true; - } - } - - delete tempNode; - return word; -} - -} // End of namespace Titanic diff --git a/engines/titanic/true_talk/st_vocab.h b/engines/titanic/true_talk/st_vocab.h deleted file mode 100644 index 6a86825ef7..0000000000 --- a/engines/titanic/true_talk/st_vocab.h +++ /dev/null @@ -1,63 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_ST_VOCAB_H -#define TITANIC_ST_VOCAB_H - -#include "titanic/support/string.h" -#include "titanic/true_talk/tt_string.h" -#include "titanic/true_talk/tt_word.h" - -namespace Titanic { - -class STVocab { -private: - TTword *_pHead; - TTword *_pTail; - TTword *_word; - int _fieldC; - int _field10; - int _field14; - int _field18; -private: - /** - * Load the vocab data - */ - int load(const CString &name); - - /** - * Adds a specified word to the vocab list - */ - void addWord(TTword *word); - - /** - * Scans the vocab list for an existing word match - */ - TTword *findWord(const TTString &str); -public: - STVocab(int val); - ~STVocab(); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_ST_VOCAB_H */ diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp new file mode 100644 index 0000000000..1bfd3dfde3 --- /dev/null +++ b/engines/titanic/true_talk/tt_vocab.cpp @@ -0,0 +1,171 @@ +/* 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/file.h" +#include "titanic/true_talk/tt_vocab.h" +#include "titanic/titanic.h" + +namespace Titanic { + +TTvocab::TTvocab(int val): _pHead(nullptr), _pTail(nullptr), _word(nullptr), + _fieldC(0), _field10(0), _field18(val) { + _field14 = load("STVOCAB.TXT"); +} + +TTvocab::~TTvocab() { + if (_pHead) { + _pHead->deleteSiblings(); + delete _pHead; + _pHead = _pTail = nullptr; + } +} + +int TTvocab::load(const CString &name) { + SimpleFile *file = g_vm->_exeResources._owner->openResource(name); + int result = 0; + bool skipFlag; + + while (!result && !file->eos()) { + skipFlag = false; + int mode = file->readNumber(); + TTString space(" "); + + switch (mode) { + case 0: { + if (_word) + result = _word->readSyn(file); + skipFlag = true; + break; + } + + case 1: { + TTword2 *word = new TTword2(space, 0, 0, 0, 0); + result = word->load(file); + _word = word; + break; + } + + case 2: { + TTword3 *word = new TTword3(space, 0, 0, 0, 0, 0, 0); + result = word->load(file); + _word = word; + break; + } + + case 3: + case 9: { + TTword1 *word = new TTword1(space, 0, 0, 0); + result = word->load(file, mode); + _word = word; + break; + } + + case 4: + case 5: + case 7: { + TTword *word = new TTword(space, 0, 0); + result = word->load(file, mode); + _word = word; + break; + } + + case 8: { + TTword4 *word = new TTword4(space, 0, 0, 0, 0); + result = word->load(file); + _word = word; + break; + } + + case 6: { + TTword5 *word = new TTword5(space, 0, 0, 0, 0); + result = word->load(file); + _word = word; + break; + } + + default: + result = 4; + break; + } + + if (!skipFlag && _word) { + if (result) { + // Something wrong occurred, so delete word + delete _word; + _word = nullptr; + } else { + // Add the word to the master vocab list + addWord(_word); + } + } + } + + // Close resource and return result + delete file; + return result; +} + +void TTvocab::addWord(TTword *word) { + TTword *existingWord = findWord(word->_string); + + if (existingWord) { + if (word->_synP) { + // Move over the synonym + existingWord->appendNode(word->_synP); + word->_synP = nullptr; + } + + _word = nullptr; + if (word) + delete word; + } else if (_pTail) { + _pTail->_pNext = word; + _pTail = word; + } else { + if (!_pHead) + _pHead = word; + + _pTail = word; + } +} + +TTword *TTvocab::findWord(const TTString &str) { + TTsynonym *tempNode = new TTsynonym(); + bool flag = false; + TTword *word = _pHead; + + while (word && !flag) { + if (_field18 != 3 || strcmp(word->c_str(), str)) { + if (word->scanCopy(str, tempNode, _field18)) + flag = true; + else + word = word->_pNext; + } else { + flag = true; + } + } + + delete tempNode; + return word; +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_vocab.h b/engines/titanic/true_talk/tt_vocab.h new file mode 100644 index 0000000000..d4dbda0029 --- /dev/null +++ b/engines/titanic/true_talk/tt_vocab.h @@ -0,0 +1,63 @@ +/* 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. + * + */ + +#ifndef TITANIC_ST_VOCAB_H +#define TITANIC_ST_VOCAB_H + +#include "titanic/support/string.h" +#include "titanic/true_talk/tt_string.h" +#include "titanic/true_talk/tt_word.h" + +namespace Titanic { + +class TTvocab { +private: + TTword *_pHead; + TTword *_pTail; + TTword *_word; + int _fieldC; + int _field10; + int _field14; + int _field18; +private: + /** + * Load the vocab data + */ + int load(const CString &name); + + /** + * Adds a specified word to the vocab list + */ + void addWord(TTword *word); + + /** + * Scans the vocab list for an existing word match + */ + TTword *findWord(const TTString &str); +public: + TTvocab(int val); + ~TTvocab(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ST_VOCAB_H */ -- cgit v1.2.3 From 7b71462046155e2927bd1f76634ea9b5bf45d381 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 12 May 2016 20:16:08 -0400 Subject: TITANIC: Implementing virtual methods for TTword --- engines/titanic/support/exe_resources.h | 2 ++ engines/titanic/true_talk/script_handler.h | 2 ++ engines/titanic/true_talk/tt_string.h | 12 ++++++++ engines/titanic/true_talk/tt_string_node.cpp | 6 ++-- engines/titanic/true_talk/tt_string_node.h | 3 +- engines/titanic/true_talk/tt_synonym.cpp | 6 ++-- engines/titanic/true_talk/tt_synonym.h | 5 +++- engines/titanic/true_talk/tt_vocab.cpp | 29 +++++++++++++++++++ engines/titanic/true_talk/tt_vocab.h | 2 ++ engines/titanic/true_talk/tt_word.cpp | 26 +++++++++++++++-- engines/titanic/true_talk/tt_word.h | 43 +++++++++++++++++++++++++++- 11 files changed, 125 insertions(+), 11 deletions(-) diff --git a/engines/titanic/support/exe_resources.h b/engines/titanic/support/exe_resources.h index 48b48d4933..bb760626d4 100644 --- a/engines/titanic/support/exe_resources.h +++ b/engines/titanic/support/exe_resources.h @@ -29,6 +29,8 @@ namespace Titanic { class CScriptHandler; +enum FileHandle { HANDLE_STDIN = 0, HANDLE_STDOUT = 1, HANDLE_STDERR = 2 }; + class CExeResources { public: CScriptHandler *_owner; diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index 80532a7dda..73ddb7bee4 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -91,6 +91,8 @@ public: * Open a resource for access */ SimpleFile *openResource(const CString &name); + + }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index 7d231b123a..9cb92cf330 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -63,8 +63,20 @@ public: */ TTStringStatus getStatus() const { return _status; } + /** + * Get a char * pointer to the string data + */ const char *c_str() const { return _data->_string.c_str(); } + + /** + * Automatic operator to convert to a const char * + */ operator const char *() const { return c_str(); } + + /** + * Get a character at a specified index + */ + char charAt(int index) const { return *(c_str() + index); } }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_string_node.cpp b/engines/titanic/true_talk/tt_string_node.cpp index cf01ac6063..d125d328e7 100644 --- a/engines/titanic/true_talk/tt_string_node.cpp +++ b/engines/titanic/true_talk/tt_string_node.cpp @@ -26,7 +26,7 @@ namespace Titanic { TTstringNode::TTstringNode() : _pPrior(nullptr), _pNext(nullptr), - _field14(0), _mode(0), _field1C(0) { + _file(HANDLE_STDIN), _mode(0), _field1C(0) { } TTstringNode::~TTstringNode() { @@ -35,7 +35,7 @@ TTstringNode::~TTstringNode() { void TTstringNode::initialize(int mode) { _mode = mode; - _field14 = 0; + _file = HANDLE_STDIN; if (_string.isValid()) { _field1C = 0; @@ -47,7 +47,7 @@ void TTstringNode::initialize(int mode) { void TTstringNode::initialize(TTstringNode *oldNode) { _mode = oldNode->_mode; - _field14 = oldNode->_field14; + _file = oldNode->_file; if (_string.isValid()) { _field1C = 0; diff --git a/engines/titanic/true_talk/tt_string_node.h b/engines/titanic/true_talk/tt_string_node.h index dddef8db0f..6994a0d1cd 100644 --- a/engines/titanic/true_talk/tt_string_node.h +++ b/engines/titanic/true_talk/tt_string_node.h @@ -24,6 +24,7 @@ #define TITANIC_TT_STRING_NODE_H #include "titanic/true_talk/tt_string.h" +#include "titanic/support/exe_resources.h" namespace Titanic { @@ -47,7 +48,7 @@ public: TTstringNode *_pPrior; TTstringNode *_pNext; TTString _string; - int _field14; + FileHandle _file; int _mode; int _field1C; public: diff --git a/engines/titanic/true_talk/tt_synonym.cpp b/engines/titanic/true_talk/tt_synonym.cpp index 5da124ab27..ea45f2e74a 100644 --- a/engines/titanic/true_talk/tt_synonym.cpp +++ b/engines/titanic/true_talk/tt_synonym.cpp @@ -30,14 +30,14 @@ TTsynonym::TTsynonym() : TTstringNode() { TTsynonym::TTsynonym(const TTstringNode *src) { _string = src->_string; initialize(src->_mode); - _field14 = src->_field14; + _file = src->_file; } -TTsynonym::TTsynonym(int mode, const char *str, int val2) : +TTsynonym::TTsynonym(int mode, const char *str, FileHandle file) : TTstringNode() { _string = str; initialize(mode); - _field14 = val2; + _file = file; } TTsynonym *TTsynonym::findByName(TTsynonym *start, const TTString &str, int mode) { diff --git a/engines/titanic/true_talk/tt_synonym.h b/engines/titanic/true_talk/tt_synonym.h index 6a20ef37a4..20f63ac0f6 100644 --- a/engines/titanic/true_talk/tt_synonym.h +++ b/engines/titanic/true_talk/tt_synonym.h @@ -31,8 +31,11 @@ class TTsynonym : public TTstringNode { public: TTsynonym(); TTsynonym(const TTstringNode *src); - TTsynonym(int mode, const char *str, int val2); + TTsynonym(int mode, const char *str, FileHandle file); + /** + * Copy the synonym + */ TTsynonym *copy(TTstringNode *src); /** diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp index 1bfd3dfde3..1499573f2e 100644 --- a/engines/titanic/true_talk/tt_vocab.cpp +++ b/engines/titanic/true_talk/tt_vocab.cpp @@ -168,4 +168,33 @@ TTword *TTvocab::findWord(const TTString &str) { return word; } +TTword *TTvocab::getPrimeWord(TTString &str, TTword **words) { + TTsynonym *synonym = new TTsynonym(); + char c = str.charAt(0); + TTword *vocabList = _pHead; + TTword *returnWord = nullptr; + + if (!Common::isDigit(c)) { + returnWord = new TTword(str, 3, 300); + } else if (!vocabList) { + // No vocab present. Should never happen + } else { + TTword *foundWord = nullptr; + while (!foundWord && vocabList) { + if (_field18 == 3 && !strcmp(str.c_str(), vocabList->c_str())) { + + } + } + + // TODO + + } + + if (words) + *words = vocabList; + delete synonym; + + return returnWord; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_vocab.h b/engines/titanic/true_talk/tt_vocab.h index d4dbda0029..b7e948680a 100644 --- a/engines/titanic/true_talk/tt_vocab.h +++ b/engines/titanic/true_talk/tt_vocab.h @@ -56,6 +56,8 @@ private: public: TTvocab(int val); ~TTvocab(); + + TTword *getPrimeWord(TTString &str, TTword **words); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index b7309b2c63..80fc611a38 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -32,6 +32,10 @@ TTword::TTword(TTString &str, int mode, int val2) : _string(str), _status = str.getStatus() == SS_VALID ? SS_VALID : SS_5; } +TTword::TTword(TTword *src) { + // TODO +} + void TTword::deleteSiblings() { while (_pNext) { TTword *next = _pNext; @@ -50,7 +54,7 @@ int TTword::readSyn(SimpleFile *file) { return 5; // Create new synanym node - TTsynonym *synNode = new TTsynonym(mode, str.c_str(), val1); + TTsynonym *synNode = new TTsynonym(mode, str.c_str(), (FileHandle)val1); if (_synP) { // A synonym already exists, so add new one as a tail @@ -99,7 +103,7 @@ uint TTword::readNumber(const char *str) { return numValue; } -bool TTword::testFileHandle(SimpleFile *file) const { +bool TTword::testFileHandle(FileHandle file) const { if (g_vm->_exeResources.is18Equals(3)) return true; @@ -120,6 +124,24 @@ TTword *TTword::scanCopy(const TTString &str, TTsynonym *node, int mode) { return nullptr; } +TTword *TTword::copy() { + return new TTword(this); +} + +FileHandle TTword::getSynFile() const { + return _synP ? _synP->_file : HANDLE_STDIN; +} + +bool TTword::checkSynFile(FileHandle file) const { + return _synP && _synP->_file == file; +} + +void TTword::setSynFile(FileHandle file) { + if (_synP && testFileHandle(file)) + _synP->_file = file; +} + + /*------------------------------------------------------------------------*/ TTword1::TTword1(TTString &str, int val1, int val2, int val3) : diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index ad2ddeb987..d1de4118f9 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -43,13 +43,15 @@ protected: */ uint readNumber(const char *str); - bool testFileHandle(SimpleFile *file) const; + bool testFileHandle(SimpleFile *file) const { return true; } + bool testFileHandle(FileHandle resHandle) const; public: TTword *_pNext; TTsynonym *_synP; TTString _string; public: TTword(TTString &str, int mode, int val2); + TTword(TTword *src); /** * Delete any following words chained to the word @@ -75,6 +77,45 @@ public: const char *c_str() const { return _string.c_str(); } operator const char *() const { return c_str(); } + + virtual TTword *copy(); + virtual int proc2() const { return 0; } + virtual int proc3() const { return -1; } + virtual void proc4() {} + virtual void proc5() {} + virtual int proc6() const { return 0; } + virtual int proc7() const { return 0; } + virtual int proc8() const { return 0; } + virtual int proc9() const { return 0; } + virtual int proc10() const { return 0; } + virtual void proc11() {} + virtual int proc12() const { return 0; } + virtual int proc13() const { return 0; } + virtual int proc14() const { return 0; } + virtual int proc15() const { return -1; } + virtual int proc16() const { return 0; } + virtual int proc17() const { return 0; } + virtual int proc18() const { return 0; } + virtual int proc19() const { return 0; } + virtual int proc20() const { return 0; } + + /** + * Returns the file associated with the word's first synonym + */ + virtual FileHandle getSynFile() const; + + /** + * Checks whether the file associated with the word's first + * synonym matches the specified file + */ + virtual bool checkSynFile(FileHandle file) const; + + /** + * Sets the file associated with a synonym + */ + virtual void setSynFile(FileHandle file); + + virtual int proc24() const { return 0; } }; class TTword1 : public TTword { -- cgit v1.2.3 From ae5cd8d8dda5b66a82d33b4164c06b3313522e10 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 12 May 2016 20:30:20 -0400 Subject: TITANIC: Fix TTstringNode pointers to TTsynonym --- engines/titanic/true_talk/tt_synonym.cpp | 4 ++-- engines/titanic/true_talk/tt_synonym.h | 4 ++-- engines/titanic/true_talk/tt_word.cpp | 2 +- engines/titanic/true_talk/tt_word.h | 4 ++++ 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/engines/titanic/true_talk/tt_synonym.cpp b/engines/titanic/true_talk/tt_synonym.cpp index ea45f2e74a..3ce3b12ee2 100644 --- a/engines/titanic/true_talk/tt_synonym.cpp +++ b/engines/titanic/true_talk/tt_synonym.cpp @@ -27,7 +27,7 @@ namespace Titanic { TTsynonym::TTsynonym() : TTstringNode() { } -TTsynonym::TTsynonym(const TTstringNode *src) { +TTsynonym::TTsynonym(const TTsynonym *src) { _string = src->_string; initialize(src->_mode); _file = src->_file; @@ -51,7 +51,7 @@ TTsynonym *TTsynonym::findByName(TTsynonym *start, const TTString &str, int mode return nullptr; } -TTsynonym *TTsynonym::copy(TTstringNode *src) { +TTsynonym *TTsynonym::copy(TTsynonym *src) { if (src->_field1C) { _field1C = 5; return this; diff --git a/engines/titanic/true_talk/tt_synonym.h b/engines/titanic/true_talk/tt_synonym.h index 20f63ac0f6..b661c166e0 100644 --- a/engines/titanic/true_talk/tt_synonym.h +++ b/engines/titanic/true_talk/tt_synonym.h @@ -30,13 +30,13 @@ namespace Titanic { class TTsynonym : public TTstringNode { public: TTsynonym(); - TTsynonym(const TTstringNode *src); + TTsynonym(const TTsynonym *src); TTsynonym(int mode, const char *str, FileHandle file); /** * Copy the synonym */ - TTsynonym *copy(TTstringNode *src); + TTsynonym *copy(TTsynonym *src); /** * Scan for a synonym with a given string diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index 80fc611a38..55de72b3d6 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -113,7 +113,7 @@ bool TTword::testFileHandle(FileHandle file) const { TTword *TTword::scanCopy(const TTString &str, TTsynonym *node, int mode) { if (_synP) { - TTstringNode *strNode = TTsynonym::findByName(_synP, str, mode); + TTsynonym *strNode = TTsynonym::findByName(_synP, str, mode); if (strNode) { node->copy(strNode); node->_pPrior = nullptr; diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index d1de4118f9..9bdb810ae6 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -78,7 +78,11 @@ public: const char *c_str() const { return _string.c_str(); } operator const char *() const { return c_str(); } + /** + * Creates a copy of the word + */ virtual TTword *copy(); + virtual int proc2() const { return 0; } virtual int proc3() const { return -1; } virtual void proc4() {} -- cgit v1.2.3 From 06876335cd027529b3719cdfc6d255b00a592b02 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 12 May 2016 20:51:32 -0400 Subject: TITANIC: Implement TTword copy --- engines/titanic/true_talk/tt_word.cpp | 34 +++++++++++++++++++++++++++++++++- engines/titanic/true_talk/tt_word.h | 5 +++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index 55de72b3d6..4d4f968efd 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -33,7 +33,39 @@ TTword::TTword(TTString &str, int mode, int val2) : _string(str), } TTword::TTword(TTword *src) { - // TODO + if (src->getStatus() != SS_VALID) { + _status = SS_5; + return; + } + + _string = src->_string; + _wordMode = src->_wordMode; + _field1C = src->_field1C; + _field20 = src->_field20; + _synP = nullptr; + + TTsynonym *priorSyn = nullptr; + for (TTsynonym *synP = _synP; synP && !_status;) { + TTsynonym *newSyn = new TTsynonym(synP); + if (!newSyn) { + _status = SS_7; + } else { + newSyn->_pPrior = priorSyn; + newSyn->_pNext = nullptr; + + if (priorSyn) { + priorSyn->_pNext = newSyn; + } else { + _synP = newSyn; + } + + priorSyn = newSyn; + } + } + + _pNext = src->_pNext; + _field24 = src->_field24; + _field28 = src->_field28; } void TTword::deleteSiblings() { diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index 9bdb810ae6..d9127514bb 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -78,6 +78,11 @@ public: const char *c_str() const { return _string.c_str(); } operator const char *() const { return c_str(); } + /** + * Return the status of the word + */ + TTStringStatus getStatus() const { return _status; } + /** * Creates a copy of the word */ -- cgit v1.2.3 From e8971dd106fa28fe1d4ef8e00ee34ec623a746c9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 12 May 2016 21:35:28 -0400 Subject: TITANIC: Rename CScriptHandlerSub2 to TTparser --- engines/titanic/module.mk | 1 + engines/titanic/true_talk/script_handler.cpp | 2 +- engines/titanic/true_talk/script_handler.h | 17 ++-------- engines/titanic/true_talk/tt_parser.cpp | 28 +++++++++++++++++ engines/titanic/true_talk/tt_parser.h | 46 ++++++++++++++++++++++++++++ 5 files changed, 78 insertions(+), 16 deletions(-) create mode 100644 engines/titanic/true_talk/tt_parser.cpp create mode 100644 engines/titanic/true_talk/tt_parser.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index cac64a57c2..51ebdbbebd 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -463,6 +463,7 @@ MODULE_OBJS := \ true_talk/tt_script_base.o \ true_talk/tt_room_script.o \ true_talk/tt_npc_script.o \ + true_talk/tt_parser.o \ true_talk/tt_scripts.o \ true_talk/tt_string.o \ true_talk/tt_string_node.o \ diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index d050c0492e..65ec60039c 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -29,7 +29,7 @@ namespace Titanic { CScriptHandler::CScriptHandler(CTitleEngine *owner, int val1, int val2) : _owner(owner), _script(owner->_script), _resources(g_vm->_exeResources), - _sub1(), _sub2(this), _field10(0), _inputCtr(0), + _sub1(), _parser(this), _field10(0), _inputCtr(0), _field20(0), _field24(0), _field28(0), _field2C(0), _field30(0) { g_vm->_scriptHandler = this; g_vm->_script = _script; diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index 73ddb7bee4..7692959e71 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -24,6 +24,7 @@ #define TITANIC_SCRIPT_HANDLER_H #include "titanic/true_talk/tt_npc_script.h" +#include "titanic/true_talk/tt_parser.h" #include "titanic/true_talk/tt_room_script.h" #include "titanic/true_talk/tt_string.h" #include "titanic/true_talk/tt_vocab.h" @@ -46,20 +47,6 @@ public: _fieldC(0), _field10(0) {} }; -class CScriptHandlerSub2 { -public: - CScriptHandler *_owner; - int _field4; - int _field8; - int _fieldC; - int _field10; - int _field14; - int _field18; -public: - CScriptHandlerSub2(CScriptHandler *owner) : _owner(owner), _field4(0), _field8(0), - _fieldC(0), _field10(0), _field14(0), _field18(0) {} -}; - class CScriptHandler { private: CTitleEngine *_owner; @@ -68,7 +55,7 @@ private: CExeResources &_resources; int _field10; CScriptHandlerSub1 _sub1; - CScriptHandlerSub2 _sub2; + TTparser _parser; int _inputCtr; int _field20; int _field24; diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp new file mode 100644 index 0000000000..ad40cbcad4 --- /dev/null +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -0,0 +1,28 @@ +/* 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 "titanic/true_talk/tt_parser.h" +#include "titanic/true_talk/script_handler.h" + +namespace Titanic { + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h new file mode 100644 index 0000000000..767406adb1 --- /dev/null +++ b/engines/titanic/true_talk/tt_parser.h @@ -0,0 +1,46 @@ +/* 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. + * + */ + +#ifndef TITANIC_TT_PARSER_H +#define TITANIC_TT_PARSER_H + +namespace Titanic { + +class CScriptHandler; + +class TTparser { +public: + CScriptHandler *_owner; + int _field4; + int _field8; + int _fieldC; + int _field10; + int _field14; + int _field18; +public: + TTparser(CScriptHandler *owner) : _owner(owner), _field4(0), _field8(0), + _fieldC(0), _field10(0), _field14(0), _field18(0) {} +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_PARSER_H */ -- cgit v1.2.3 From d649157c5b1afae1ff6a9a565575c1eddcc880fa Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 12 May 2016 23:27:21 -0400 Subject: TITANIC: Figured out original class names for TTword descendents --- engines/titanic/module.mk | 9 ++- engines/titanic/support/simple_file.cpp | 2 +- engines/titanic/true_talk/tt_action.cpp | 42 ++++++++++++++ engines/titanic/true_talk/tt_action.h | 44 ++++++++++++++ engines/titanic/true_talk/tt_adj.cpp | 48 ++++++++++++++++ engines/titanic/true_talk/tt_adj.h | 44 ++++++++++++++ engines/titanic/true_talk/tt_major_word.cpp | 32 +++++++++++ engines/titanic/true_talk/tt_major_word.h | 39 +++++++++++++ engines/titanic/true_talk/tt_picture.cpp | 46 +++++++++++++++ engines/titanic/true_talk/tt_picture.h | 47 +++++++++++++++ engines/titanic/true_talk/tt_pronoun.cpp | 46 +++++++++++++++ engines/titanic/true_talk/tt_pronoun.h | 44 ++++++++++++++ engines/titanic/true_talk/tt_vocab.cpp | 16 ++++-- engines/titanic/true_talk/tt_word.cpp | 89 ----------------------------- engines/titanic/true_talk/tt_word.h | 58 ------------------- 15 files changed, 451 insertions(+), 155 deletions(-) create mode 100644 engines/titanic/true_talk/tt_action.cpp create mode 100644 engines/titanic/true_talk/tt_action.h create mode 100644 engines/titanic/true_talk/tt_adj.cpp create mode 100644 engines/titanic/true_talk/tt_adj.h create mode 100644 engines/titanic/true_talk/tt_major_word.cpp create mode 100644 engines/titanic/true_talk/tt_major_word.h create mode 100644 engines/titanic/true_talk/tt_picture.cpp create mode 100644 engines/titanic/true_talk/tt_picture.h create mode 100644 engines/titanic/true_talk/tt_pronoun.cpp create mode 100644 engines/titanic/true_talk/tt_pronoun.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 51ebdbbebd..d52dc568ff 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -460,10 +460,15 @@ MODULE_OBJS := \ true_talk/title_engine.o \ true_talk/script_handler.o \ true_talk/true_talk_manager.o \ - true_talk/tt_script_base.o \ - true_talk/tt_room_script.o \ + true_talk/tt_action.o \ + true_talk/tt_adj.o \ + true_talk/tt_major_word.o \ true_talk/tt_npc_script.o \ true_talk/tt_parser.o \ + true_talk/tt_picture.o \ + true_talk/tt_pronoun.o \ + true_talk/tt_room_script.o \ + true_talk/tt_script_base.o \ true_talk/tt_scripts.o \ true_talk/tt_string.o \ true_talk/tt_string_node.o \ diff --git a/engines/titanic/support/simple_file.cpp b/engines/titanic/support/simple_file.cpp index 80f5178298..61d941b680 100644 --- a/engines/titanic/support/simple_file.cpp +++ b/engines/titanic/support/simple_file.cpp @@ -399,7 +399,7 @@ bool SimpleFile::scanf(const char *format, ...) { skipSpaces(); va_end(va); - return !eos(); + return true; } void SimpleFile::skipSpaces() { diff --git a/engines/titanic/true_talk/tt_action.cpp b/engines/titanic/true_talk/tt_action.cpp new file mode 100644 index 0000000000..3caca5d9b7 --- /dev/null +++ b/engines/titanic/true_talk/tt_action.cpp @@ -0,0 +1,42 @@ +/* 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 "titanic/true_talk/tt_action.h" + +namespace Titanic { + +TTaction::TTaction(TTString &str, int val1, int val2, int val3, int val4) : + TTmajorWord(str, val1, val2, val3), _field30(val4) { +} + +int TTaction::load(SimpleFile *file) { + int val; + + if (!TTword::load(file, 1) && file->scanf("%d", &val)) { + _field30 = val; + return 0; + } else { + return 8; + } +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_action.h b/engines/titanic/true_talk/tt_action.h new file mode 100644 index 0000000000..3c27067eb1 --- /dev/null +++ b/engines/titanic/true_talk/tt_action.h @@ -0,0 +1,44 @@ +/* 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. + * + */ + +#ifndef TITANIC_TT_ACTION_H +#define TITANIC_TT_ACTION_H + +#include "titanic/true_talk/tt_major_word.h" + +namespace Titanic { + +class TTaction : public TTmajorWord { +protected: + int _field30; +public: + TTaction(TTString &str, int val1, int val2, int val3, int val4); + + /** + * Load the word + */ + int load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_ACTION_H */ diff --git a/engines/titanic/true_talk/tt_adj.cpp b/engines/titanic/true_talk/tt_adj.cpp new file mode 100644 index 0000000000..8ee35e21fb --- /dev/null +++ b/engines/titanic/true_talk/tt_adj.cpp @@ -0,0 +1,48 @@ +/* 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 "titanic/true_talk/tt_adj.h" + +namespace Titanic { + +TTadj::TTadj(TTString &str, int val1, int val2, int val3, int val4) : + TTmajorWord(str, val1, val2, val3) { + if (val4 >= 0 && val4 <= 9) { + _field30 = val4; + } else { + _field30 = 0; + _status = SS_5; + } +} + +int TTadj::load(SimpleFile *file) { + int val; + + if (!TTword::load(file, 8) && file->scanf("%d", &val)) { + _field30 = val; + return 0; + } else { + return 8; + } +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_adj.h b/engines/titanic/true_talk/tt_adj.h new file mode 100644 index 0000000000..a0bb340980 --- /dev/null +++ b/engines/titanic/true_talk/tt_adj.h @@ -0,0 +1,44 @@ +/* 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. + * + */ + +#ifndef TITANIC_TT_ADJ_H +#define TITANIC_TT_ADJ_H + +#include "titanic/true_talk/tt_major_word.h" + +namespace Titanic { + +class TTadj : public TTmajorWord { +protected: + int _field30; +public: + TTadj(TTString &str, int val1, int val2, int val3, int val4); + + /** + * Load the word + */ + int load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_ADJ_H */ diff --git a/engines/titanic/true_talk/tt_major_word.cpp b/engines/titanic/true_talk/tt_major_word.cpp new file mode 100644 index 0000000000..6df761b8ec --- /dev/null +++ b/engines/titanic/true_talk/tt_major_word.cpp @@ -0,0 +1,32 @@ +/* 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 "titanic/true_talk/tt_major_word.h" + +namespace Titanic { + +TTmajorWord::TTmajorWord(TTString &str, int val1, int val2, int val3) : + TTword(str, val1, val2), _field2C(val3) { +} + + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_major_word.h b/engines/titanic/true_talk/tt_major_word.h new file mode 100644 index 0000000000..487c2a5f08 --- /dev/null +++ b/engines/titanic/true_talk/tt_major_word.h @@ -0,0 +1,39 @@ +/* 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. + * + */ + +#ifndef TITANIC_TT_MAJOR_WORD_H +#define TITANIC_TT_MAJOR_WORD_H + +#include "titanic/true_talk/tt_word.h" + +namespace Titanic { + +class TTmajorWord : public TTword { +protected: + int _field2C; +public: + TTmajorWord(TTString &str, int val1, int val2, int val3); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_MAJOR_WORD_H */ diff --git a/engines/titanic/true_talk/tt_picture.cpp b/engines/titanic/true_talk/tt_picture.cpp new file mode 100644 index 0000000000..21574df195 --- /dev/null +++ b/engines/titanic/true_talk/tt_picture.cpp @@ -0,0 +1,46 @@ +/* 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 "titanic/true_talk/tt_picture.h" + +namespace Titanic { + +TTpicture::TTpicture(TTString &str, int val1, int val2, int val3, int val4, int val5, int val6) : + TTmajorWord(str, val1, val2, val4), _field34(val3), _field30(val5), _field3C(val6), + _field38(0) { +} + +int TTpicture::load(SimpleFile *file) { + CString str; + int val1, val2; + + if (!TTword::load(file, 2) && file->scanf("%s %d %d", &str, &val1, &val2)) { + _field34 = readNumber(str.c_str()); + _field30 = val1; + _field3C = val2; + return 0; + } else { + return 3; + } +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_picture.h b/engines/titanic/true_talk/tt_picture.h new file mode 100644 index 0000000000..93f953635c --- /dev/null +++ b/engines/titanic/true_talk/tt_picture.h @@ -0,0 +1,47 @@ +/* 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. + * + */ + +#ifndef TITANIC_TT_PICTURE_H +#define TITANIC_TT_PICTURE_H + +#include "titanic/true_talk/tt_major_word.h" + +namespace Titanic { + +class TTpicture : public TTmajorWord { +protected: + int _field30; + int _field34; + int _field38; + int _field3C; +public: + TTpicture(TTString &str, int val1, int val2, int val3, int val4, int val5, int val6); + + /** + * Load the word + */ + int load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_PICTURE_H */ diff --git a/engines/titanic/true_talk/tt_pronoun.cpp b/engines/titanic/true_talk/tt_pronoun.cpp new file mode 100644 index 0000000000..b0e35270c5 --- /dev/null +++ b/engines/titanic/true_talk/tt_pronoun.cpp @@ -0,0 +1,46 @@ +/* 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 "titanic/true_talk/tt_pronoun.h" + +namespace Titanic { + +TTpronoun::TTpronoun(TTString &str, int val1, int val2, int val3, int val4) : + TTmajorWord(str, val1, val2, val3), _field30(val4) { +} + +int TTpronoun::load(SimpleFile *file) { + int val; + + if (!TTword::load(file, 6) && file->scanf("%d", &val)) { + if (val >= 0 && val <= 12) { + _field30 = val; + return 0; + } else { + return 5; + } + } else { + return 8; + } +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_pronoun.h b/engines/titanic/true_talk/tt_pronoun.h new file mode 100644 index 0000000000..991c0b39ce --- /dev/null +++ b/engines/titanic/true_talk/tt_pronoun.h @@ -0,0 +1,44 @@ +/* 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. + * + */ + +#ifndef TITANIC_TT_PRONOUN_H +#define TITANIC_TT_PRONOUN_H + +#include "titanic/true_talk/tt_major_word.h" + +namespace Titanic { + +class TTpronoun : public TTmajorWord { +protected: + int _field30; +public: + TTpronoun(TTString &str, int val1, int val2, int val3, int val4); + + /** + * Load the word + */ + int load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_WORD_H */ diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp index 1499573f2e..1826a43d08 100644 --- a/engines/titanic/true_talk/tt_vocab.cpp +++ b/engines/titanic/true_talk/tt_vocab.cpp @@ -22,6 +22,12 @@ #include "common/file.h" #include "titanic/true_talk/tt_vocab.h" +#include "titanic/true_talk/tt_adj.h" +#include "titanic/true_talk/tt_action.h" +#include "titanic/true_talk/tt_adj.h" +#include "titanic/true_talk/tt_major_word.h" +#include "titanic/true_talk/tt_picture.h" +#include "titanic/true_talk/tt_pronoun.h" #include "titanic/titanic.h" namespace Titanic { @@ -58,14 +64,14 @@ int TTvocab::load(const CString &name) { } case 1: { - TTword2 *word = new TTword2(space, 0, 0, 0, 0); + TTaction *word = new TTaction(space, 0, 0, 0, 0); result = word->load(file); _word = word; break; } case 2: { - TTword3 *word = new TTword3(space, 0, 0, 0, 0, 0, 0); + TTpicture *word = new TTpicture(space, 0, 0, 0, 0, 0, 0); result = word->load(file); _word = word; break; @@ -73,7 +79,7 @@ int TTvocab::load(const CString &name) { case 3: case 9: { - TTword1 *word = new TTword1(space, 0, 0, 0); + TTmajorWord *word = new TTmajorWord(space, 0, 0, 0); result = word->load(file, mode); _word = word; break; @@ -89,14 +95,14 @@ int TTvocab::load(const CString &name) { } case 8: { - TTword4 *word = new TTword4(space, 0, 0, 0, 0); + TTadj *word = new TTadj(space, 0, 0, 0, 0); result = word->load(file); _word = word; break; } case 6: { - TTword5 *word = new TTword5(space, 0, 0, 0, 0); + TTpronoun *word = new TTpronoun(space, 0, 0, 0, 0); result = word->load(file); _word = word; break; diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index 4d4f968efd..ea68b3433a 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -173,93 +173,4 @@ void TTword::setSynFile(FileHandle file) { _synP->_file = file; } - -/*------------------------------------------------------------------------*/ - -TTword1::TTword1(TTString &str, int val1, int val2, int val3) : - TTword(str, val1, val2), _field2C(val3) { -} - -/*------------------------------------------------------------------------*/ - -TTword2::TTword2(TTString &str, int val1, int val2, int val3, int val4) : - TTword1(str, val1, val2, val3), _field30(val4) { -} - -int TTword2::load(SimpleFile *file) { - int val; - - if (!TTword::load(file, 1) && file->scanf("%d", &val)) { - _field30 = val; - return 0; - } else { - return 8; - } -} - -/*------------------------------------------------------------------------*/ - -TTword3::TTword3(TTString &str, int val1, int val2, int val3, int val4, int val5, int val6) : - TTword1(str, val1, val2, val4), _field34(val3), _field30(val5), _field3C(val6), - _field38(0) { -} - -int TTword3::load(SimpleFile *file) { - CString str; - int val1, val2; - - if (!TTword::load(file, 2) && file->scanf("%s %d %d", &str, &val1, &val2)) { - _field34 = readNumber(str.c_str()); - _field30 = val1; - _field3C = val2; - return 0; - } else { - return 3; - } -} - -/*------------------------------------------------------------------------*/ - -TTword4::TTword4(TTString &str, int val1, int val2, int val3, int val4) : - TTword1(str, val1, val2, val3) { - if (val4 >= 0 && val4 <= 9) { - _field30 = val4; - } else { - _field30 = 0; - _status = SS_5; - } -} - -int TTword4::load(SimpleFile *file) { - int val; - - if (!TTword::load(file, 8) && file->scanf("%d", &val)) { - _field30 = val; - return 0; - } else { - return 8; - } -} - -/*------------------------------------------------------------------------*/ - -TTword5::TTword5(TTString &str, int val1, int val2, int val3, int val4) : - TTword1(str, val1, val2, val3), _field30(val4) { -} - -int TTword5::load(SimpleFile *file) { - int val; - - if (!TTword::load(file, 6) && file->scanf("%d", &val)) { - if (val >= 0 && val <= 12) { - _field30 = val; - return 0; - } else { - return 5; - } - } else { - return 8; - } -} - } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index d9127514bb..3d9001bd5d 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -127,64 +127,6 @@ public: virtual int proc24() const { return 0; } }; -class TTword1 : public TTword { -protected: - int _field2C; -public: - TTword1(TTString &str, int val1, int val2, int val3); -}; - -class TTword2 : public TTword1 { -protected: - int _field30; -public: - TTword2(TTString &str, int val1, int val2, int val3, int val4); - - /** - * Load the word - */ - int load(SimpleFile *file); -}; - -class TTword3 : public TTword1 { -protected: - int _field30; - int _field34; - int _field38; - int _field3C; -public: - TTword3(TTString &str, int val1, int val2, int val3, int val4, int val5, int val6); - - /** - * Load the word - */ - int load(SimpleFile *file); -}; - -class TTword4 : public TTword1 { -protected: - int _field30; -public: - TTword4(TTString &str, int val1, int val2, int val3, int val4); - - /** - * Load the word - */ - int load(SimpleFile *file); -}; - -class TTword5 : public TTword1 { -protected: - int _field30; -public: - TTword5(TTString &str, int val1, int val2, int val3, int val4); - - /** - * Load the word - */ - int load(SimpleFile *file); -}; - } // End of namespace Titanic #endif /* TITANIC_TT_WORD_H */ -- cgit v1.2.3 From f114ca6c26f4e77a40126b2ebd9c74c042e72875 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 12 May 2016 23:48:22 -0400 Subject: TITANIC: More TTword subclass constructors --- engines/titanic/true_talk/tt_action.cpp | 9 +++++++++ engines/titanic/true_talk/tt_action.h | 1 + engines/titanic/true_talk/tt_adj.cpp | 9 +++++++++ engines/titanic/true_talk/tt_adj.h | 1 + engines/titanic/true_talk/tt_major_word.cpp | 8 ++++++++ engines/titanic/true_talk/tt_major_word.h | 1 + engines/titanic/true_talk/tt_picture.cpp | 15 +++++++++++++++ engines/titanic/true_talk/tt_picture.h | 1 + engines/titanic/true_talk/tt_pronoun.cpp | 9 +++++++++ engines/titanic/true_talk/tt_pronoun.h | 1 + 10 files changed, 55 insertions(+) diff --git a/engines/titanic/true_talk/tt_action.cpp b/engines/titanic/true_talk/tt_action.cpp index 3caca5d9b7..5f552249e7 100644 --- a/engines/titanic/true_talk/tt_action.cpp +++ b/engines/titanic/true_talk/tt_action.cpp @@ -28,6 +28,15 @@ TTaction::TTaction(TTString &str, int val1, int val2, int val3, int val4) : TTmajorWord(str, val1, val2, val3), _field30(val4) { } +TTaction::TTaction(TTaction *src) : TTmajorWord(src) { + if (src->getStatus()) { + _field30 = 0; + _status = SS_5; + } else { + _field30 = src->_field30; + } +} + int TTaction::load(SimpleFile *file) { int val; diff --git a/engines/titanic/true_talk/tt_action.h b/engines/titanic/true_talk/tt_action.h index 3c27067eb1..821d16b6b0 100644 --- a/engines/titanic/true_talk/tt_action.h +++ b/engines/titanic/true_talk/tt_action.h @@ -32,6 +32,7 @@ protected: int _field30; public: TTaction(TTString &str, int val1, int val2, int val3, int val4); + TTaction(TTaction *src); /** * Load the word diff --git a/engines/titanic/true_talk/tt_adj.cpp b/engines/titanic/true_talk/tt_adj.cpp index 8ee35e21fb..64321b5b6b 100644 --- a/engines/titanic/true_talk/tt_adj.cpp +++ b/engines/titanic/true_talk/tt_adj.cpp @@ -34,6 +34,15 @@ TTadj::TTadj(TTString &str, int val1, int val2, int val3, int val4) : } } +TTadj::TTadj(TTadj *src) : TTmajorWord(src) { + if (src->getStatus()) { + _field30 = 0; + _status = SS_5; + } else { + _field30 = src->_field30; + } +} + int TTadj::load(SimpleFile *file) { int val; diff --git a/engines/titanic/true_talk/tt_adj.h b/engines/titanic/true_talk/tt_adj.h index a0bb340980..1c0306f5b4 100644 --- a/engines/titanic/true_talk/tt_adj.h +++ b/engines/titanic/true_talk/tt_adj.h @@ -32,6 +32,7 @@ protected: int _field30; public: TTadj(TTString &str, int val1, int val2, int val3, int val4); + TTadj(TTadj *src); /** * Load the word diff --git a/engines/titanic/true_talk/tt_major_word.cpp b/engines/titanic/true_talk/tt_major_word.cpp index 6df761b8ec..4af3ba1a68 100644 --- a/engines/titanic/true_talk/tt_major_word.cpp +++ b/engines/titanic/true_talk/tt_major_word.cpp @@ -28,5 +28,13 @@ TTmajorWord::TTmajorWord(TTString &str, int val1, int val2, int val3) : TTword(str, val1, val2), _field2C(val3) { } +TTmajorWord::TTmajorWord(TTmajorWord *src) : TTword(src) { + if (src->getStatus()) { + _field2C = 0; + _status = SS_5; + } else { + _field2C = src->_field2C; + } +} } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_major_word.h b/engines/titanic/true_talk/tt_major_word.h index 487c2a5f08..95ba6caa56 100644 --- a/engines/titanic/true_talk/tt_major_word.h +++ b/engines/titanic/true_talk/tt_major_word.h @@ -32,6 +32,7 @@ protected: int _field2C; public: TTmajorWord(TTString &str, int val1, int val2, int val3); + TTmajorWord(TTmajorWord *src); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_picture.cpp b/engines/titanic/true_talk/tt_picture.cpp index 21574df195..d1e58a57da 100644 --- a/engines/titanic/true_talk/tt_picture.cpp +++ b/engines/titanic/true_talk/tt_picture.cpp @@ -29,6 +29,21 @@ TTpicture::TTpicture(TTString &str, int val1, int val2, int val3, int val4, int _field38(0) { } +TTpicture::TTpicture(TTpicture *src) : TTmajorWord(src) { + if (getStatus()) { + _field34 = 0; + _field30 = 0; + _field38 = 0; + _field3C = 0; + _status = SS_5; + } else { + _field34 = src->_field34; + _field30 = src->_field30; + _field38 = src->_field38; + _field3C = src->_field3C; + } +} + int TTpicture::load(SimpleFile *file) { CString str; int val1, val2; diff --git a/engines/titanic/true_talk/tt_picture.h b/engines/titanic/true_talk/tt_picture.h index 93f953635c..938d342ee9 100644 --- a/engines/titanic/true_talk/tt_picture.h +++ b/engines/titanic/true_talk/tt_picture.h @@ -35,6 +35,7 @@ protected: int _field3C; public: TTpicture(TTString &str, int val1, int val2, int val3, int val4, int val5, int val6); + TTpicture(TTpicture *src); /** * Load the word diff --git a/engines/titanic/true_talk/tt_pronoun.cpp b/engines/titanic/true_talk/tt_pronoun.cpp index b0e35270c5..764489d127 100644 --- a/engines/titanic/true_talk/tt_pronoun.cpp +++ b/engines/titanic/true_talk/tt_pronoun.cpp @@ -28,6 +28,15 @@ TTpronoun::TTpronoun(TTString &str, int val1, int val2, int val3, int val4) : TTmajorWord(str, val1, val2, val3), _field30(val4) { } +TTpronoun::TTpronoun(TTpronoun *src) : TTmajorWord(src) { + if (src->getStatus()) { + _field30 = 0; + _status = SS_5; + } else { + _field30 = src->_field30; + } +} + int TTpronoun::load(SimpleFile *file) { int val; diff --git a/engines/titanic/true_talk/tt_pronoun.h b/engines/titanic/true_talk/tt_pronoun.h index 991c0b39ce..5f554a11a6 100644 --- a/engines/titanic/true_talk/tt_pronoun.h +++ b/engines/titanic/true_talk/tt_pronoun.h @@ -32,6 +32,7 @@ protected: int _field30; public: TTpronoun(TTString &str, int val1, int val2, int val3, int val4); + TTpronoun(TTpronoun *src); /** * Load the word -- cgit v1.2.3 From 2f9d7f228459db6877ea5afec01f00110d17931a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 13 May 2016 19:32:15 -0400 Subject: TITANIC: Added TTword subclass copy methods --- engines/titanic/true_talk/tt_action.cpp | 18 ++++++++++++++++++ engines/titanic/true_talk/tt_action.h | 7 +++++++ engines/titanic/true_talk/tt_adj.cpp | 18 ++++++++++++++++++ engines/titanic/true_talk/tt_adj.h | 7 +++++++ engines/titanic/true_talk/tt_major_word.cpp | 18 ++++++++++++++++++ engines/titanic/true_talk/tt_major_word.h | 7 +++++++ engines/titanic/true_talk/tt_picture.cpp | 18 ++++++++++++++++++ engines/titanic/true_talk/tt_picture.h | 7 +++++++ engines/titanic/true_talk/tt_pronoun.cpp | 18 ++++++++++++++++++ engines/titanic/true_talk/tt_pronoun.h | 7 +++++++ engines/titanic/true_talk/tt_string.h | 2 +- 11 files changed, 126 insertions(+), 1 deletion(-) diff --git a/engines/titanic/true_talk/tt_action.cpp b/engines/titanic/true_talk/tt_action.cpp index 5f552249e7..041f4a27a4 100644 --- a/engines/titanic/true_talk/tt_action.cpp +++ b/engines/titanic/true_talk/tt_action.cpp @@ -24,6 +24,8 @@ namespace Titanic { +bool TTaction::_staticFlag; + TTaction::TTaction(TTString &str, int val1, int val2, int val3, int val4) : TTmajorWord(str, val1, val2, val3), _field30(val4) { } @@ -48,4 +50,20 @@ int TTaction::load(SimpleFile *file) { } } +TTword *TTaction::copy() { + TTaction *returnWordP = new TTaction(this); + returnWordP->_status = _status; + if (!_status) { + _staticFlag = false; + return returnWordP; + } else if (_status == SS_13 && !_staticFlag) { + _staticFlag = true; + delete returnWordP; + return copy(); + } else { + delete returnWordP; + return nullptr; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_action.h b/engines/titanic/true_talk/tt_action.h index 821d16b6b0..0d0b69a733 100644 --- a/engines/titanic/true_talk/tt_action.h +++ b/engines/titanic/true_talk/tt_action.h @@ -28,6 +28,8 @@ namespace Titanic { class TTaction : public TTmajorWord { +private: + static bool _staticFlag; protected: int _field30; public: @@ -38,6 +40,11 @@ public: * Load the word */ int load(SimpleFile *file); + + /** + * Creates a copy of the word + */ + virtual TTword *copy(); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_adj.cpp b/engines/titanic/true_talk/tt_adj.cpp index 64321b5b6b..5b942131a3 100644 --- a/engines/titanic/true_talk/tt_adj.cpp +++ b/engines/titanic/true_talk/tt_adj.cpp @@ -24,6 +24,8 @@ namespace Titanic { +bool TTadj::_staticFlag; + TTadj::TTadj(TTString &str, int val1, int val2, int val3, int val4) : TTmajorWord(str, val1, val2, val3) { if (val4 >= 0 && val4 <= 9) { @@ -54,4 +56,20 @@ int TTadj::load(SimpleFile *file) { } } +TTword *TTadj::copy() { + TTadj *returnWordP = new TTadj(this); + returnWordP->_status = _status; + if (!_status) { + _staticFlag = false; + return returnWordP; + } else if (_status == SS_13 && !_staticFlag) { + _staticFlag = true; + delete returnWordP; + return copy(); + } else { + delete returnWordP; + return nullptr; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_adj.h b/engines/titanic/true_talk/tt_adj.h index 1c0306f5b4..02d09b56c4 100644 --- a/engines/titanic/true_talk/tt_adj.h +++ b/engines/titanic/true_talk/tt_adj.h @@ -28,6 +28,8 @@ namespace Titanic { class TTadj : public TTmajorWord { +private: + static bool _staticFlag; protected: int _field30; public: @@ -38,6 +40,11 @@ public: * Load the word */ int load(SimpleFile *file); + + /** + * Creates a copy of the word + */ + virtual TTword *copy(); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_major_word.cpp b/engines/titanic/true_talk/tt_major_word.cpp index 4af3ba1a68..b56a484aa0 100644 --- a/engines/titanic/true_talk/tt_major_word.cpp +++ b/engines/titanic/true_talk/tt_major_word.cpp @@ -24,6 +24,8 @@ namespace Titanic { +bool TTmajorWord::_staticFlag; + TTmajorWord::TTmajorWord(TTString &str, int val1, int val2, int val3) : TTword(str, val1, val2), _field2C(val3) { } @@ -37,4 +39,20 @@ TTmajorWord::TTmajorWord(TTmajorWord *src) : TTword(src) { } } +TTword *TTmajorWord::copy() { + TTmajorWord *returnWordP = new TTmajorWord(this); + returnWordP->_status = _status; + if (!_status) { + _staticFlag = false; + return returnWordP; + } else if (_status == SS_13 && !_staticFlag) { + _staticFlag = true; + delete returnWordP; + return copy(); + } else { + delete returnWordP; + return nullptr; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_major_word.h b/engines/titanic/true_talk/tt_major_word.h index 95ba6caa56..140419dda2 100644 --- a/engines/titanic/true_talk/tt_major_word.h +++ b/engines/titanic/true_talk/tt_major_word.h @@ -28,11 +28,18 @@ namespace Titanic { class TTmajorWord : public TTword { +private: + static bool _staticFlag; protected: int _field2C; public: TTmajorWord(TTString &str, int val1, int val2, int val3); TTmajorWord(TTmajorWord *src); + + /** + * Creates a copy of the word + */ + virtual TTword *copy(); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_picture.cpp b/engines/titanic/true_talk/tt_picture.cpp index d1e58a57da..2cc69a1fe8 100644 --- a/engines/titanic/true_talk/tt_picture.cpp +++ b/engines/titanic/true_talk/tt_picture.cpp @@ -24,6 +24,8 @@ namespace Titanic { +bool TTpicture::_staticFlag; + TTpicture::TTpicture(TTString &str, int val1, int val2, int val3, int val4, int val5, int val6) : TTmajorWord(str, val1, val2, val4), _field34(val3), _field30(val5), _field3C(val6), _field38(0) { @@ -58,4 +60,20 @@ int TTpicture::load(SimpleFile *file) { } } +TTword *TTpicture::copy() { + TTpicture *returnWordP = new TTpicture(this); + returnWordP->_status = _status; + if (!_status) { + _staticFlag = false; + return returnWordP; + } else if (_status == SS_13 && !_staticFlag) { + _staticFlag = true; + delete returnWordP; + return copy(); + } else { + delete returnWordP; + return nullptr; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_picture.h b/engines/titanic/true_talk/tt_picture.h index 938d342ee9..1910bc6911 100644 --- a/engines/titanic/true_talk/tt_picture.h +++ b/engines/titanic/true_talk/tt_picture.h @@ -28,6 +28,8 @@ namespace Titanic { class TTpicture : public TTmajorWord { +private: + static bool _staticFlag; protected: int _field30; int _field34; @@ -41,6 +43,11 @@ public: * Load the word */ int load(SimpleFile *file); + + /** + * Creates a copy of the word + */ + virtual TTword *copy(); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_pronoun.cpp b/engines/titanic/true_talk/tt_pronoun.cpp index 764489d127..120946bb59 100644 --- a/engines/titanic/true_talk/tt_pronoun.cpp +++ b/engines/titanic/true_talk/tt_pronoun.cpp @@ -24,6 +24,8 @@ namespace Titanic { +bool TTpronoun::_staticFlag; + TTpronoun::TTpronoun(TTString &str, int val1, int val2, int val3, int val4) : TTmajorWord(str, val1, val2, val3), _field30(val4) { } @@ -52,4 +54,20 @@ int TTpronoun::load(SimpleFile *file) { } } +TTword *TTpronoun::copy() { + TTpronoun *returnWordP = new TTpronoun(this); + returnWordP->_status = _status; + if (!_status) { + _staticFlag = false; + return returnWordP; + } else if (_status == SS_13 && !_staticFlag) { + _staticFlag = true; + delete returnWordP; + return copy(); + } else { + delete returnWordP; + return nullptr; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_pronoun.h b/engines/titanic/true_talk/tt_pronoun.h index 5f554a11a6..8f55a36f07 100644 --- a/engines/titanic/true_talk/tt_pronoun.h +++ b/engines/titanic/true_talk/tt_pronoun.h @@ -28,6 +28,8 @@ namespace Titanic { class TTpronoun : public TTmajorWord { +private: + static bool _staticFlag; protected: int _field30; public: @@ -38,6 +40,11 @@ public: * Load the word */ int load(SimpleFile *file); + + /** + * Creates a copy of the word + */ + virtual TTword *copy(); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index 9cb92cf330..a881c59ecb 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -36,7 +36,7 @@ struct TTStringData { TTStringData(const CString &str) : _string(str), _referenceCount(1) {} }; -enum TTStringStatus { SS_VALID = 0, SS_5 = 5, SS_7 = 7 }; +enum TTStringStatus { SS_VALID = 0, SS_5 = 5, SS_7 = 7, SS_8 = 8, SS_13 = 13 }; class TTString { private: -- cgit v1.2.3 From eb948946885bc128c01f5c09da0bbdba95d2c472 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 13 May 2016 20:50:47 -0400 Subject: TITANIC: Implement TTword hierarchy virtual methods --- engines/titanic/support/simple_file.cpp | 43 +++++++++++++-------- engines/titanic/support/simple_file.h | 31 ++++++++------- engines/titanic/true_talk/script_handler.cpp | 2 +- engines/titanic/true_talk/script_handler.h | 2 +- engines/titanic/true_talk/true_talk_manager.cpp | 2 +- engines/titanic/true_talk/tt_action.cpp | 2 +- engines/titanic/true_talk/tt_action.h | 4 +- engines/titanic/true_talk/tt_adj.cpp | 2 +- engines/titanic/true_talk/tt_adj.h | 15 +++++++- engines/titanic/true_talk/tt_major_word.cpp | 14 ++++++- engines/titanic/true_talk/tt_major_word.h | 9 ++++- engines/titanic/true_talk/tt_picture.cpp | 33 +++++++++++++--- engines/titanic/true_talk/tt_picture.h | 23 +++++++++++- engines/titanic/true_talk/tt_pronoun.cpp | 2 +- engines/titanic/true_talk/tt_pronoun.h | 11 +++++- engines/titanic/true_talk/tt_script_base.h | 2 +- engines/titanic/true_talk/tt_string.cpp | 31 ++++++++------- engines/titanic/true_talk/tt_string.h | 37 ++++++++++-------- engines/titanic/true_talk/tt_string_node.h | 2 +- engines/titanic/true_talk/tt_synonym.cpp | 27 ++++++++++++- engines/titanic/true_talk/tt_synonym.h | 7 +++- engines/titanic/true_talk/tt_title_script.h | 2 +- engines/titanic/true_talk/tt_vocab.cpp | 6 +-- engines/titanic/true_talk/tt_vocab.h | 4 +- engines/titanic/true_talk/tt_word.cpp | 4 +- engines/titanic/true_talk/tt_word.h | 50 ++++++++++++++++--------- 26 files changed, 263 insertions(+), 104 deletions(-) diff --git a/engines/titanic/support/simple_file.cpp b/engines/titanic/support/simple_file.cpp index 61d941b680..f4351f920f 100644 --- a/engines/titanic/support/simple_file.cpp +++ b/engines/titanic/support/simple_file.cpp @@ -73,7 +73,7 @@ size_t SimpleFile::unsafeRead(void *dst, size_t count) { return _inStream->read(dst, count); } -size_t SimpleFile::write(const void *src, size_t count) { +size_t SimpleFile::write(const void *src, size_t count) const { assert(_outStream); return _outStream->write(src, count); } @@ -237,12 +237,12 @@ void SimpleFile::readBuffer(char *buffer, size_t count) { } } -void SimpleFile::writeLine(const CString &str) { +void SimpleFile::writeLine(const CString &str) const { write(str.c_str(), str.size()); write("\r\n", 2); } -void SimpleFile::writeString(const CString &str) { +void SimpleFile::writeString(const CString &str) const { if (str.empty()) return; @@ -279,58 +279,69 @@ void SimpleFile::writeString(const CString &str) { } } -void SimpleFile::writeQuotedString(const CString &str) { +void SimpleFile::writeQuotedString(const CString &str) const { write("\"", 1); writeString(str); write("\" ", 2); } -void SimpleFile::writeQuotedLine(const CString &str, int indent) { +void SimpleFile::writeQuotedLine(const CString &str, int indent) const { writeIndent(indent); writeQuotedString(str); write("\n", 1); } -void SimpleFile::writeNumber(int val) { +void SimpleFile::writeNumber(int val) const { CString str = CString::format("%d ", val); write(str.c_str(), str.size()); } -void SimpleFile::writeNumberLine(int val, int indent) { +void SimpleFile::writeNumberLine(int val, int indent) const { writeIndent(indent); writeNumber(val); write("\n", 1); } -void SimpleFile::writeFloat(double val) { +void SimpleFile::writeFloat(double val) const { Common::String valStr = Common::String::format("%f ", val); write(valStr.c_str(), valStr.size()); } -void SimpleFile::writeFloatLine(double val, int indent) { +void SimpleFile::writeFloatLine(double val, int indent) const { writeIndent(indent); writeFloat(val); write("\n", 1); } -void SimpleFile::writePoint(const Point &pt, int indent) { +void SimpleFile::writePoint(const Point &pt, int indent) const { writeIndent(indent); writeNumber(pt.x); writeNumber(pt.y); write("\n", 1); } -void SimpleFile::writeRect(const Rect &r, int indent) { +void SimpleFile::writeRect(const Rect &r, int indent) const { writePoint(Point(r.left, r.top), indent); writePoint(Point(r.right, r.bottom), indent); } -void SimpleFile::writeBounds(const Rect &r, int indent) { +void SimpleFile::writeBounds(const Rect &r, int indent) const { writePoint(Point(r.left, r.top), indent); writePoint(Point(r.width(), r.height()), indent); } -void SimpleFile::writeIndent(uint indent) { +void SimpleFile::writeFormat(const char *format, ...) const { + // Convert the format specifier and params to a string + va_list va; + va_start(va, format); + CString line = CString::vformat(format, va); + va_end(va); + + // Write out the string + write(format, strlen(format)); +} + +void SimpleFile::writeIndent(uint indent) const { for (uint idx = 0; idx < indent; ++idx) write("\t", 1); } @@ -383,7 +394,7 @@ bool SimpleFile::scanf(const char *format, ...) { *param = readNumber(); if (!eos()) - _inStream->skip(-1); + _inStream->seek(-1, SEEK_CUR); } else if (formatStr.hasPrefix("%s")) { // Read in text until the next space formatStr = CString(formatStr.c_str() + 2); @@ -393,7 +404,7 @@ bool SimpleFile::scanf(const char *format, ...) { *str += c; if (!eos()) - _inStream->skip(-1); + _inStream->seek(-1, SEEK_CUR); } } @@ -408,7 +419,7 @@ void SimpleFile::skipSpaces() { safeRead(&c, 1); if (!eos()) - _inStream->skip(-1); + _inStream->seek(-1, SEEK_CUR); } /*------------------------------------------------------------------------*/ diff --git a/engines/titanic/support/simple_file.h b/engines/titanic/support/simple_file.h index 2a4cfdbbc0..cf89e5d72c 100644 --- a/engines/titanic/support/simple_file.h +++ b/engines/titanic/support/simple_file.h @@ -89,7 +89,7 @@ public: /** * Write out data */ - virtual size_t write(const void *src, size_t count); + virtual size_t write(const void *src, size_t count) const; /** * Read a byte @@ -139,62 +139,67 @@ public: /** * Write a string line */ - void writeLine(const CString &str); + void writeLine(const CString &str) const; /** * Write a string */ - void writeString(const CString &str); + void writeString(const CString &str) const; /** * Write a quoted string */ - void writeQuotedString(const CString &str); + void writeQuotedString(const CString &str) const; /** * Write a quoted string line */ - void writeQuotedLine(const CString &str, int indent); + void writeQuotedLine(const CString &str, int indent) const; /** * Write a number to file */ - void writeNumber(int val); + void writeNumber(int val) const; /** * Write a number line to file */ - void writeNumberLine(int val, int indent); + void writeNumberLine(int val, int indent) const; /** * Write a floating point number */ - void writeFloat(double val); + void writeFloat(double val) const; /** * Write a floating point number as a line */ - void writeFloatLine(double val, int indent); + void writeFloatLine(double val, int indent) const; /** * Write out a point line */ - void writePoint(const Point &pt, int indent); + void writePoint(const Point &pt, int indent)const; /** * Write out a rect line */ - void writeRect(const Rect &r, int indent); + void writeRect(const Rect &r, int indent) const; /** * Write out a bounds line */ - void writeBounds(const Rect &r, int indent); + void writeBounds(const Rect &r, int indent) const; + + /** + * Write out a string using a format specifier, just like fprintf + */ + void writeFormat(const char *format, ...) const; /** * Write out a number of tabs to form an indent in the output */ - void writeIndent(uint indent); + void writeIndent(uint indent) const; /** * Validates that the following non-space character is either diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index 65ec60039c..e923c377da 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -58,7 +58,7 @@ ScriptChangedResult CScriptHandler::scriptChanged(TTRoomScript *roomScript, TTNp } void CScriptHandler::processInput(TTRoomScript *roomScript, TTNpcScript *npcScript, - const TTString &line) { + const TTstring &line) { if (!roomScript || !line.isValid()) return; diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index 7692959e71..2da9371e7d 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -72,7 +72,7 @@ public: ScriptChangedResult scriptChanged(TTRoomScript *roomScript, TTNpcScript *npcScript, uint dialogueId); void processInput(TTRoomScript *roomScript, TTNpcScript *npcScript, - const TTString &line); + const TTstring &line); /** * Open a resource for access diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 4892259341..7743d81509 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -310,7 +310,7 @@ void CTrueTalkManager::processInput(CTrueTalkNPC *npc, CTextInputMsg *msg, CView if (npcScript && roomScript) { _currentNPC = npc; _titleEngine._scriptHandler->processInput(roomScript, npcScript, - TTString(msg->_input)); + TTstring(msg->_input)); _currentNPC = nullptr; loadAssets(npc, npcScript->charId()); diff --git a/engines/titanic/true_talk/tt_action.cpp b/engines/titanic/true_talk/tt_action.cpp index 041f4a27a4..39e31747ee 100644 --- a/engines/titanic/true_talk/tt_action.cpp +++ b/engines/titanic/true_talk/tt_action.cpp @@ -26,7 +26,7 @@ namespace Titanic { bool TTaction::_staticFlag; -TTaction::TTaction(TTString &str, int val1, int val2, int val3, int val4) : +TTaction::TTaction(TTstring &str, int val1, int val2, int val3, int val4) : TTmajorWord(str, val1, val2, val3), _field30(val4) { } diff --git a/engines/titanic/true_talk/tt_action.h b/engines/titanic/true_talk/tt_action.h index 0d0b69a733..822ba4a3a2 100644 --- a/engines/titanic/true_talk/tt_action.h +++ b/engines/titanic/true_talk/tt_action.h @@ -33,7 +33,7 @@ private: protected: int _field30; public: - TTaction(TTString &str, int val1, int val2, int val3, int val4); + TTaction(TTstring &str, int val1, int val2, int val3, int val4); TTaction(TTaction *src); /** @@ -45,6 +45,8 @@ public: * Creates a copy of the word */ virtual TTword *copy(); + + virtual bool proc12(int val) const { return _field30 == val; } }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_adj.cpp b/engines/titanic/true_talk/tt_adj.cpp index 5b942131a3..8f62bb8e0a 100644 --- a/engines/titanic/true_talk/tt_adj.cpp +++ b/engines/titanic/true_talk/tt_adj.cpp @@ -26,7 +26,7 @@ namespace Titanic { bool TTadj::_staticFlag; -TTadj::TTadj(TTString &str, int val1, int val2, int val3, int val4) : +TTadj::TTadj(TTstring &str, int val1, int val2, int val3, int val4) : TTmajorWord(str, val1, val2, val3) { if (val4 >= 0 && val4 <= 9) { _field30 = val4; diff --git a/engines/titanic/true_talk/tt_adj.h b/engines/titanic/true_talk/tt_adj.h index 02d09b56c4..301023ed5e 100644 --- a/engines/titanic/true_talk/tt_adj.h +++ b/engines/titanic/true_talk/tt_adj.h @@ -33,7 +33,7 @@ private: protected: int _field30; public: - TTadj(TTString &str, int val1, int val2, int val3, int val4); + TTadj(TTstring &str, int val1, int val2, int val3, int val4); TTadj(TTadj *src); /** @@ -45,6 +45,19 @@ public: * Creates a copy of the word */ virtual TTword *copy(); + + virtual bool proc14(int val) const { return _field30 == val; } + virtual int proc15() const { return _field30; } + virtual bool proc16() const { return _field30 >= 7; } + virtual bool proc17() const { return _field30 <= 3; } + virtual bool proc18() const { return _field30 > 3 && _field30 < 7; } + + /** + * Dumps data associated with the word to file + */ + virtual int save(SimpleFile *file) const { + return saveData(file, _field30); + } }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_major_word.cpp b/engines/titanic/true_talk/tt_major_word.cpp index b56a484aa0..68af628dbb 100644 --- a/engines/titanic/true_talk/tt_major_word.cpp +++ b/engines/titanic/true_talk/tt_major_word.cpp @@ -26,7 +26,7 @@ namespace Titanic { bool TTmajorWord::_staticFlag; -TTmajorWord::TTmajorWord(TTString &str, int val1, int val2, int val3) : +TTmajorWord::TTmajorWord(TTstring &str, int val1, int val2, int val3) : TTword(str, val1, val2), _field2C(val3) { } @@ -39,6 +39,18 @@ TTmajorWord::TTmajorWord(TTmajorWord *src) : TTword(src) { } } +int TTmajorWord::saveData(SimpleFile *file, int val) const { + int result = TTword::save(file); + if (!result) { + file->writeFormat("%1.0d", val); + file->writeFormat("%c", '\n'); + if (_synP) + result = _synP->save(file); + } + + return result; +} + TTword *TTmajorWord::copy() { TTmajorWord *returnWordP = new TTmajorWord(this); returnWordP->_status = _status; diff --git a/engines/titanic/true_talk/tt_major_word.h b/engines/titanic/true_talk/tt_major_word.h index 140419dda2..962fbaab6d 100644 --- a/engines/titanic/true_talk/tt_major_word.h +++ b/engines/titanic/true_talk/tt_major_word.h @@ -32,14 +32,21 @@ private: static bool _staticFlag; protected: int _field2C; +protected: + /** + * Dumps data for the word to a file + */ + int saveData(SimpleFile *file, int val) const; public: - TTmajorWord(TTString &str, int val1, int val2, int val3); + TTmajorWord(TTstring &str, int val1, int val2, int val3); TTmajorWord(TTmajorWord *src); /** * Creates a copy of the word */ virtual TTword *copy(); + + virtual bool proc2(int val) const { return _field2C == val; } }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_picture.cpp b/engines/titanic/true_talk/tt_picture.cpp index 2cc69a1fe8..6213cd557b 100644 --- a/engines/titanic/true_talk/tt_picture.cpp +++ b/engines/titanic/true_talk/tt_picture.cpp @@ -26,20 +26,20 @@ namespace Titanic { bool TTpicture::_staticFlag; -TTpicture::TTpicture(TTString &str, int val1, int val2, int val3, int val4, int val5, int val6) : - TTmajorWord(str, val1, val2, val4), _field34(val3), _field30(val5), _field3C(val6), +TTpicture::TTpicture(TTstring &str, int val1, int val2, int val3, int val4, int val5, int val6) : + TTmajorWord(str, val1, val2, val4), _tag(val3), _field30(val5), _field3C(val6), _field38(0) { } TTpicture::TTpicture(TTpicture *src) : TTmajorWord(src) { if (getStatus()) { - _field34 = 0; + _tag = 0; _field30 = 0; _field38 = 0; _field3C = 0; _status = SS_5; } else { - _field34 = src->_field34; + _tag = src->_tag; _field30 = src->_field30; _field38 = src->_field38; _field3C = src->_field3C; @@ -51,7 +51,7 @@ int TTpicture::load(SimpleFile *file) { int val1, val2; if (!TTword::load(file, 2) && file->scanf("%s %d %d", &str, &val1, &val2)) { - _field34 = readNumber(str.c_str()); + _tag = readNumber(str.c_str()); _field30 = val1; _field3C = val2; return 0; @@ -76,4 +76,27 @@ TTword *TTpicture::copy() { } } +bool TTpicture::checkTag() const { + return _tag == MKTAG('S', 'E', 'X', 'X') || + _tag == MKTAG('E', 'X', 'C', 'R') || + _tag == MKTAG('P', 'P', 'R', 'T') || + _tag == MKTAG('B', 'L', 'A', 'S'); +} + +bool TTpicture::compareTagTo(uint tag) const { + return _tag == tag; +} + +uint TTpicture::getTag() const { + return _tag; +} + +bool TTpicture::proc9(int val) const { + return _field3C == val; +} + +int TTpicture::proc10() const { + return _field3C; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_picture.h b/engines/titanic/true_talk/tt_picture.h index 1910bc6911..c4cc2c19d3 100644 --- a/engines/titanic/true_talk/tt_picture.h +++ b/engines/titanic/true_talk/tt_picture.h @@ -32,11 +32,11 @@ private: static bool _staticFlag; protected: int _field30; - int _field34; + uint _tag; int _field38; int _field3C; public: - TTpicture(TTString &str, int val1, int val2, int val3, int val4, int val5, int val6); + TTpicture(TTstring &str, int val1, int val2, int val3, int val4, int val5, int val6); TTpicture(TTpicture *src); /** @@ -48,6 +48,25 @@ public: * Creates a copy of the word */ virtual TTword *copy(); + + /** + * Checks whether the word's tag is a known type + */ + virtual bool checkTag() const; + + /** + * Compare the word's tag to a given tag value + */ + virtual bool compareTagTo(uint tag) const; + + /** + * Return the tag associated with the word + */ + virtual uint getTag() const; + + virtual bool proc9(int val) const; + virtual int proc10() const; + }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_pronoun.cpp b/engines/titanic/true_talk/tt_pronoun.cpp index 120946bb59..4b20b3341b 100644 --- a/engines/titanic/true_talk/tt_pronoun.cpp +++ b/engines/titanic/true_talk/tt_pronoun.cpp @@ -26,7 +26,7 @@ namespace Titanic { bool TTpronoun::_staticFlag; -TTpronoun::TTpronoun(TTString &str, int val1, int val2, int val3, int val4) : +TTpronoun::TTpronoun(TTstring &str, int val1, int val2, int val3, int val4) : TTmajorWord(str, val1, val2, val3), _field30(val4) { } diff --git a/engines/titanic/true_talk/tt_pronoun.h b/engines/titanic/true_talk/tt_pronoun.h index 8f55a36f07..6bb8113e15 100644 --- a/engines/titanic/true_talk/tt_pronoun.h +++ b/engines/titanic/true_talk/tt_pronoun.h @@ -33,7 +33,7 @@ private: protected: int _field30; public: - TTpronoun(TTString &str, int val1, int val2, int val3, int val4); + TTpronoun(TTstring &str, int val1, int val2, int val3, int val4); TTpronoun(TTpronoun *src); /** @@ -45,6 +45,15 @@ public: * Creates a copy of the word */ virtual TTword *copy(); + + virtual bool proc19(int val) const { return _field30 == val; } + + /** + * Dumps data associated with the word to file + */ + virtual int save(SimpleFile *file) const { + return saveData(file, _field30); + } }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_script_base.h b/engines/titanic/true_talk/tt_script_base.h index fe999ab290..dc0db2ceb8 100644 --- a/engines/titanic/true_talk/tt_script_base.h +++ b/engines/titanic/true_talk/tt_script_base.h @@ -38,7 +38,7 @@ protected: int _field4; int _field8; int _fieldC; - TTString _charName, _charClass; + TTstring _charName, _charClass; int _field20; int _field24; int _field28; diff --git a/engines/titanic/true_talk/tt_string.cpp b/engines/titanic/true_talk/tt_string.cpp index 78ef8222ab..7a39d7163f 100644 --- a/engines/titanic/true_talk/tt_string.cpp +++ b/engines/titanic/true_talk/tt_string.cpp @@ -21,23 +21,24 @@ */ #include "titanic/true_talk/tt_string.h" +#include "titanic/support/simple_file.h" namespace Titanic { -TTString::TTString() : _status(SS_VALID) { - _data = new TTStringData(); +TTstring::TTstring() : _status(SS_VALID) { + _data = new TTstringData(); } -TTString::TTString(const char *str) : _status(SS_VALID) { - _data = new TTStringData(str); +TTstring::TTstring(const char *str) : _status(SS_VALID) { + _data = new TTstringData(str); } -TTString::TTString(const CString &str) { +TTstring::TTstring(const CString &str) { _status = SS_VALID; - _data = new TTStringData(str); + _data = new TTstringData(str); } -TTString::TTString(TTString &str) { +TTstring::TTstring(TTstring &str) { if (str._status != SS_VALID) { _status = SS_5; _data = nullptr; @@ -48,12 +49,12 @@ TTString::TTString(TTString &str) { } } -TTString::~TTString() { +TTstring::~TTstring() { if (_data && --_data->_referenceCount == 0) delete _data; } -void TTString::operator=(const TTString &str) { +void TTstring::operator=(const TTstring &str) { // Delete old string reference, if any if (_data && --_data->_referenceCount == 0) delete _data; @@ -65,22 +66,26 @@ void TTString::operator=(const TTString &str) { _data->_referenceCount++; } -void TTString::operator=(const CString &str) { +void TTstring::operator=(const CString &str) { operator=(str.c_str()); } -void TTString::operator=(const char *str) { +void TTstring::operator=(const char *str) { // Delete old string reference, if any if (_data && --_data->_referenceCount == 0) delete _data; // Create new string data - _data = new TTStringData(str); + _data = new TTstringData(str); _status = SS_VALID; } -bool TTString::isValid() const { +bool TTstring::isValid() const { return _status == SS_VALID; } +void TTstring::save(SimpleFile *file) const { + file->writeFormat("%s", c_str()); +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index a881c59ecb..0256f1022f 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -27,29 +27,31 @@ namespace Titanic { -struct TTStringData { +class SimpleFile; + +struct TTstringData { CString _string; int _referenceCount; - TTStringData() : _referenceCount(1) {} - TTStringData(const char *str) : _string(str), _referenceCount(1) {} - TTStringData(const CString &str) : _string(str), _referenceCount(1) {} + TTstringData() : _referenceCount(1) {} + TTstringData(const char *str) : _string(str), _referenceCount(1) {} + TTstringData(const CString &str) : _string(str), _referenceCount(1) {} }; -enum TTStringStatus { SS_VALID = 0, SS_5 = 5, SS_7 = 7, SS_8 = 8, SS_13 = 13 }; +enum TTstringStatus { SS_VALID = 0, SS_5 = 5, SS_7 = 7, SS_8 = 8, SS_13 = 13 }; -class TTString { +class TTstring { private: - TTStringData *_data; - TTStringStatus _status; + TTstringData *_data; + TTstringStatus _status; public: - TTString(); - TTString(const char *str); - TTString(const CString &str); - TTString(TTString &str); - virtual ~TTString(); + TTstring(); + TTstring(const char *str); + TTstring(const CString &str); + TTstring(TTstring &str); + virtual ~TTstring(); - void operator=(const TTString &str); + void operator=(const TTstring &str); void operator=(const CString &str); void operator=(const char *str); @@ -61,7 +63,7 @@ public: /** * Get the status of the string */ - TTStringStatus getStatus() const { return _status; } + TTstringStatus getStatus() const { return _status; } /** * Get a char * pointer to the string data @@ -77,6 +79,11 @@ public: * Get a character at a specified index */ char charAt(int index) const { return *(c_str() + index); } + + /** + * Save the sring to a passed file + */ + void save(SimpleFile *file) const; }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_string_node.h b/engines/titanic/true_talk/tt_string_node.h index 6994a0d1cd..f9f73ce545 100644 --- a/engines/titanic/true_talk/tt_string_node.h +++ b/engines/titanic/true_talk/tt_string_node.h @@ -47,7 +47,7 @@ protected: public: TTstringNode *_pPrior; TTstringNode *_pNext; - TTString _string; + TTstring _string; FileHandle _file; int _mode; int _field1C; diff --git a/engines/titanic/true_talk/tt_synonym.cpp b/engines/titanic/true_talk/tt_synonym.cpp index 3ce3b12ee2..cac9f647cc 100644 --- a/engines/titanic/true_talk/tt_synonym.cpp +++ b/engines/titanic/true_talk/tt_synonym.cpp @@ -40,7 +40,7 @@ TTsynonym::TTsynonym(int mode, const char *str, FileHandle file) : _file = file; } -TTsynonym *TTsynonym::findByName(TTsynonym *start, const TTString &str, int mode) { +TTsynonym *TTsynonym::findByName(TTsynonym *start, const TTstring &str, int mode) { for (; start; start = static_cast(start->_pNext)) { if (start->_mode == mode || (mode == 3 && start->_mode < 3)) { if (!strcmp(start->_string.c_str(), str.c_str())) @@ -68,4 +68,29 @@ TTsynonym *TTsynonym::copy(TTsynonym *src) { } } +int TTsynonym::save(SimpleFile *file) { + for (TTstringNode *synP = this; synP; synP = synP->_pNext) { + file->writeFormat("%s", " 0 "); + synP->_string.save(file); + file->writeFormat("%c", ' '); + + if (synP->_mode) { + file->writeFormat("%1.0d", synP->_mode); + } else { + file->writeFormat("%c", '0'); + } + + file->writeFormat("%c", ' '); + + if (synP->_file) { + file->writeFormat("%2.0d", synP->_file); + } else { + file->writeFormat("%c", ' '); + } + file->writeFormat("%c", '\n'); + } + + return 0; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_synonym.h b/engines/titanic/true_talk/tt_synonym.h index b661c166e0..40f7ad3449 100644 --- a/engines/titanic/true_talk/tt_synonym.h +++ b/engines/titanic/true_talk/tt_synonym.h @@ -24,6 +24,7 @@ #define TITANIC_TT_SYNONYM_H #include "titanic/true_talk/tt_string_node.h" +#include "titanic/support/simple_file.h" namespace Titanic { @@ -41,8 +42,12 @@ public: /** * Scan for a synonym with a given string */ - static TTsynonym *findByName(TTsynonym *start, const TTString &str, int mode); + static TTsynonym *findByName(TTsynonym *start, const TTstring &str, int mode); + /** + * Save data for the synonym to file + */ + int save(SimpleFile *file); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_title_script.h b/engines/titanic/true_talk/tt_title_script.h index 7876ba8a71..a1efd11270 100644 --- a/engines/titanic/true_talk/tt_title_script.h +++ b/engines/titanic/true_talk/tt_title_script.h @@ -31,7 +31,7 @@ namespace Titanic { class TTTitleScript : public TTScriptBase { private: int _field50; - TTString _string1; + TTstring _string1; int _field5C; int _field60; public: diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp index 1826a43d08..3d2a9d98c8 100644 --- a/engines/titanic/true_talk/tt_vocab.cpp +++ b/engines/titanic/true_talk/tt_vocab.cpp @@ -53,7 +53,7 @@ int TTvocab::load(const CString &name) { while (!result && !file->eos()) { skipFlag = false; int mode = file->readNumber(); - TTString space(" "); + TTstring space(" "); switch (mode) { case 0: { @@ -154,7 +154,7 @@ void TTvocab::addWord(TTword *word) { } } -TTword *TTvocab::findWord(const TTString &str) { +TTword *TTvocab::findWord(const TTstring &str) { TTsynonym *tempNode = new TTsynonym(); bool flag = false; TTword *word = _pHead; @@ -174,7 +174,7 @@ TTword *TTvocab::findWord(const TTString &str) { return word; } -TTword *TTvocab::getPrimeWord(TTString &str, TTword **words) { +TTword *TTvocab::getPrimeWord(TTstring &str, TTword **words) { TTsynonym *synonym = new TTsynonym(); char c = str.charAt(0); TTword *vocabList = _pHead; diff --git a/engines/titanic/true_talk/tt_vocab.h b/engines/titanic/true_talk/tt_vocab.h index b7e948680a..804d8cbae3 100644 --- a/engines/titanic/true_talk/tt_vocab.h +++ b/engines/titanic/true_talk/tt_vocab.h @@ -52,12 +52,12 @@ private: /** * Scans the vocab list for an existing word match */ - TTword *findWord(const TTString &str); + TTword *findWord(const TTstring &str); public: TTvocab(int val); ~TTvocab(); - TTword *getPrimeWord(TTString &str, TTword **words); + TTword *getPrimeWord(TTstring &str, TTword **words); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index ea68b3433a..aa602d869c 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -26,7 +26,7 @@ namespace Titanic { -TTword::TTword(TTString &str, int mode, int val2) : _string(str), +TTword::TTword(TTstring &str, int mode, int val2) : _string(str), _wordMode(mode), _field1C(val2), _pNext(nullptr), _synP(nullptr), _field20(0), _field24(0), _field28(0) { _status = str.getStatus() == SS_VALID ? SS_VALID : SS_5; @@ -143,7 +143,7 @@ bool TTword::testFileHandle(FileHandle file) const { return true; } -TTword *TTword::scanCopy(const TTString &str, TTsynonym *node, int mode) { +TTword *TTword::scanCopy(const TTstring &str, TTsynonym *node, int mode) { if (_synP) { TTsynonym *strNode = TTsynonym::findByName(_synP, str, mode); if (strNode) { diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index 3d9001bd5d..f77f11ce75 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -31,7 +31,7 @@ namespace Titanic { class TTword { protected: - TTStringStatus _status; + TTstringStatus _status; int _wordMode; int _field1C; int _field20; @@ -48,9 +48,9 @@ protected: public: TTword *_pNext; TTsynonym *_synP; - TTString _string; + TTstring _string; public: - TTword(TTString &str, int mode, int val2); + TTword(TTstring &str, int mode, int val2); TTword(TTword *src); /** @@ -73,7 +73,7 @@ public: */ int load(SimpleFile *file, int mode); - TTword *scanCopy(const TTString &str, TTsynonym *node, int mode); + TTword *scanCopy(const TTstring &str, TTsynonym *node, int mode); const char *c_str() const { return _string.c_str(); } operator const char *() const { return c_str(); } @@ -81,31 +81,44 @@ public: /** * Return the status of the word */ - TTStringStatus getStatus() const { return _status; } + TTstringStatus getStatus() const { return _status; } /** * Creates a copy of the word */ virtual TTword *copy(); - virtual int proc2() const { return 0; } + virtual bool proc2(int val) const { return false; } virtual int proc3() const { return -1; } virtual void proc4() {} virtual void proc5() {} - virtual int proc6() const { return 0; } - virtual int proc7() const { return 0; } - virtual int proc8() const { return 0; } - virtual int proc9() const { return 0; } + + /** + * Checks whether the word's tag is a known type + */ + virtual bool checkTag() const { return false; } + + /** + * Compare the word's tag to a given tag value + */ + virtual bool compareTagTo(uint tag) const { return false; } + + /** + * Return the tag associated with the word + */ + virtual uint getTag() const { return 0; } + + virtual bool proc9(int val) const { return false; } virtual int proc10() const { return 0; } virtual void proc11() {} - virtual int proc12() const { return 0; } + virtual bool proc12(int val) const { return false; } virtual int proc13() const { return 0; } - virtual int proc14() const { return 0; } + virtual bool proc14(int val) const { return false; } virtual int proc15() const { return -1; } - virtual int proc16() const { return 0; } - virtual int proc17() const { return 0; } - virtual int proc18() const { return 0; } - virtual int proc19() const { return 0; } + virtual bool proc16() const { return false; } + virtual bool proc17() const { return false; } + virtual bool proc18() const { return false; } + virtual bool proc19(int val) const { return false; } virtual int proc20() const { return 0; } /** @@ -124,7 +137,10 @@ public: */ virtual void setSynFile(FileHandle file); - virtual int proc24() const { return 0; } + /** + * Dumps data associated with the word to file + */ + virtual int save(SimpleFile *file) const { return 0; } }; } // End of namespace Titanic -- cgit v1.2.3 From e5e0e22c56ed6dca6a3471b444720b76255025e0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 14 May 2016 00:12:47 -0400 Subject: TITANIC: Beginnings of TTinput class --- engines/titanic/module.mk | 1 + engines/titanic/pet_control/pet_conversations.cpp | 8 +-- engines/titanic/pet_control/pet_conversations.h | 4 +- engines/titanic/titanic.h | 2 +- engines/titanic/true_talk/barbot_script.h | 4 +- engines/titanic/true_talk/bellbot_script.cpp | 2 +- engines/titanic/true_talk/bellbot_script.h | 2 +- engines/titanic/true_talk/deskbot_script.cpp | 2 +- engines/titanic/true_talk/deskbot_script.h | 2 +- engines/titanic/true_talk/doorbot_script.h | 4 +- engines/titanic/true_talk/liftbot_script.h | 4 +- engines/titanic/true_talk/maitred_script.cpp | 2 +- engines/titanic/true_talk/maitred_script.h | 2 +- engines/titanic/true_talk/parrot_script.h | 4 +- engines/titanic/true_talk/script_handler.cpp | 14 ++++- engines/titanic/true_talk/script_handler.h | 7 ++- engines/titanic/true_talk/succubus_script.h | 4 +- engines/titanic/true_talk/title_engine.h | 6 +- engines/titanic/true_talk/true_talk_manager.cpp | 26 ++++---- engines/titanic/true_talk/true_talk_manager.h | 14 ++--- engines/titanic/true_talk/tt_input.cpp | 43 +++++++++++++ engines/titanic/true_talk/tt_input.h | 77 +++++++++++++++++++++++ engines/titanic/true_talk/tt_npc_script.cpp | 76 +++++++++++----------- engines/titanic/true_talk/tt_npc_script.h | 14 ++--- engines/titanic/true_talk/tt_parser.cpp | 5 ++ engines/titanic/true_talk/tt_parser.h | 7 +++ engines/titanic/true_talk/tt_room_script.cpp | 20 +++--- engines/titanic/true_talk/tt_room_script.h | 14 ++--- engines/titanic/true_talk/tt_script_base.cpp | 18 +++--- engines/titanic/true_talk/tt_script_base.h | 11 +++- engines/titanic/true_talk/tt_scripts.cpp | 30 ++++----- engines/titanic/true_talk/tt_scripts.h | 38 +++++------ engines/titanic/true_talk/tt_string.h | 2 +- engines/titanic/true_talk/tt_title_script.cpp | 2 +- engines/titanic/true_talk/tt_title_script.h | 2 +- 35 files changed, 313 insertions(+), 160 deletions(-) create mode 100644 engines/titanic/true_talk/tt_input.cpp create mode 100644 engines/titanic/true_talk/tt_input.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index d52dc568ff..f8fe8f50b1 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -462,6 +462,7 @@ MODULE_OBJS := \ true_talk/true_talk_manager.o \ true_talk/tt_action.o \ true_talk/tt_adj.o \ + true_talk/tt_input.o \ true_talk/tt_major_word.o \ true_talk/tt_npc_script.o \ true_talk/tt_parser.o \ diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index d2efdcf2e4..4e2d905960 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -432,7 +432,7 @@ void CPetConversations::stopNPCTimer() { _petControl->stopPetTimer(1); } -TTNpcScript *CPetConversations::getNPCScript(const CString &name) const { +TTnpcScript *CPetConversations::getNPCScript(const CString &name) const { if (name.empty() || !_petControl) return nullptr; CGameManager *gameManager = _petControl->getGameManager(); @@ -517,13 +517,13 @@ void CPetConversations::copyColors(uint tableNum, uint colors[5]) { } void CPetConversations::updateDial(uint dialNum, const CString &npcName) { - TTNpcScript *script = getNPCScript(npcName); + TTnpcScript *script = getNPCScript(npcName); uint newLevel = getDialLevel(dialNum, script); npcDialChange(dialNum, _npcLevels[dialNum], newLevel); _npcLevels[dialNum] = newLevel; } -uint CPetConversations::getDialLevel(uint dialNum, TTNpcScript *script, int v) { +uint CPetConversations::getDialLevel(uint dialNum, TTnpcScript *script, int v) { bool flag = v != 0; if (!script) @@ -559,7 +559,7 @@ void CPetConversations::npcDialChange(uint dialNum, int oldLevel, int newLevel) } void CPetConversations::resetDials(const CString &name) { - TTNpcScript *script = getNPCScript(name); + TTnpcScript *script = getNPCScript(name); for (int idx = 0; idx < TOTAL_DIALS; ++idx) { uint oldLevel = _npcLevels[idx]; diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index 4073360a37..b88ddfacd5 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -112,7 +112,7 @@ private: /** * Get the TrueTalk script associated with a given NPC */ - TTNpcScript *getNPCScript(const CString &name) const; + TTnpcScript *getNPCScript(const CString &name) const; /** * Handle a keypress @@ -142,7 +142,7 @@ private: /** * Get a dial level */ - uint getDialLevel(uint dialNum, TTNpcScript *script, int v = 1); + uint getDialLevel(uint dialNum, TTnpcScript *script, int v = 1); /** * Called when the dial for an NPC is being changed diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index 78f19c5ba1..c30ad36ac2 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -119,7 +119,7 @@ public: CMainGameWindow *_window; Common::RandomSource _randomSource; CScriptHandler *_scriptHandler; - TTScriptBase *_script; + TTscriptBase *_script; CExeResources _exeResources; CMovieList _activeMovies; CString _itemNames[TOTAL_ITEMS]; diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index 18886c299b..ac074e2b94 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -27,11 +27,11 @@ namespace Titanic { -class BarbotScript : public TTNpcScript { +class BarbotScript : public TTnpcScript { public: BarbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : - TTNpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} + TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} virtual int proc6() const; virtual void proc7(int v1, int v2); diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 2042ca9bab..ccd83d011f 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -28,7 +28,7 @@ namespace Titanic { BellbotScript::BellbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2) : - TTNpcScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0), + TTnpcScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0), _field2D0(0), _field2D4(0), _field2D8(0), _field2DC(0) { CTrueTalkManager::setFlags(25, 0); CTrueTalkManager::setFlags(24, 0); diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index ff9f849d09..d759583513 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -27,7 +27,7 @@ namespace Titanic { -class BellbotScript : public TTNpcScript { +class BellbotScript : public TTnpcScript { private: int _array[150]; int _field2D0; diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 5844664a4a..65a13b5ce1 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -28,7 +28,7 @@ namespace Titanic { DeskbotScript::DeskbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2) : - TTNpcScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0) { + TTnpcScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0) { CTrueTalkManager::setFlags(18, 0); CTrueTalkManager::setFlags(19, 0); CTrueTalkManager::setFlags(20, 0); diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index d001f56075..8db1a80a9c 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -27,7 +27,7 @@ namespace Titanic { -class DeskbotScript : public TTNpcScript { +class DeskbotScript : public TTnpcScript { public: DeskbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index b52c802f23..c812d3129a 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -27,13 +27,13 @@ namespace Titanic { -class DoorbotScript : public TTNpcScript { +class DoorbotScript : public TTnpcScript { private: int _array[148]; public: DoorbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : - TTNpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} + TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} virtual int proc6() const; virtual void proc7(int v1, int v2); diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index a6c3ed878b..7bb355a666 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -27,11 +27,11 @@ namespace Titanic { -class LiftbotScript : public TTNpcScript { +class LiftbotScript : public TTnpcScript { public: LiftbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : - TTNpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} + TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} virtual int proc6() const; virtual void proc7(int v1, int v2); diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index 47ae96ccd8..35f1efa68c 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -28,7 +28,7 @@ namespace Titanic { MaitreDScript::MaitreDScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2) : - TTNpcScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0) { + TTnpcScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0) { CTrueTalkManager::setFlags(9, 1); CTrueTalkManager::setFlags(10, 0); CTrueTalkManager::setFlags(11, 0); diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index 7aaddf971d..bd3e440ea9 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -27,7 +27,7 @@ namespace Titanic { -class MaitreDScript : public TTNpcScript { +class MaitreDScript : public TTnpcScript { public: MaitreDScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); diff --git a/engines/titanic/true_talk/parrot_script.h b/engines/titanic/true_talk/parrot_script.h index 354f3061b3..246ceb4234 100644 --- a/engines/titanic/true_talk/parrot_script.h +++ b/engines/titanic/true_talk/parrot_script.h @@ -27,11 +27,11 @@ namespace Titanic { -class ParrotScript : public TTNpcScript { +class ParrotScript : public TTnpcScript { public: ParrotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : - TTNpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} + TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} virtual int proc6() const; virtual void proc7(int v1, int v2); diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index e923c377da..041d4909f7 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -21,6 +21,7 @@ */ #include "titanic/true_talk/script_handler.h" +#include "titanic/true_talk/tt_input.h" #include "titanic/titanic.h" namespace Titanic { @@ -41,7 +42,7 @@ CScriptHandler::~CScriptHandler() { delete _vocab; } -ScriptChangedResult CScriptHandler::scriptChanged(TTRoomScript *roomScript, TTNpcScript *npcScript, uint dialogueId) { +ScriptChangedResult CScriptHandler::scriptChanged(TTroomScript *roomScript, TTnpcScript *npcScript, uint dialogueId) { if (!npcScript || !roomScript) { ++_inputCtr; return SCR_5; @@ -57,12 +58,19 @@ ScriptChangedResult CScriptHandler::scriptChanged(TTRoomScript *roomScript, TTNp error("TODO: CScriptHandler::scriptChanged"); } -void CScriptHandler::processInput(TTRoomScript *roomScript, TTNpcScript *npcScript, +int CScriptHandler::processInput(TTroomScript *roomScript, TTnpcScript *npcScript, const TTstring &line) { if (!roomScript || !line.isValid()) - return; + return SS_5; + TTinput *input = new TTinput(_inputCtr++, line, this, roomScript, npcScript); + _parser.processInput(input); + + warning("TODO: CScriptHandler::processInput"); + // TODO + delete input; + return SS_VALID; } SimpleFile *CScriptHandler::openResource(const CString &name) { diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index 2da9371e7d..86cc99cdf9 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -50,7 +50,7 @@ public: class CScriptHandler { private: CTitleEngine *_owner; - TTScriptBase *_script; + TTscriptBase *_script; TTvocab *_vocab; CExeResources &_resources; int _field10; @@ -69,9 +69,10 @@ public: /** * Set the character and room */ - ScriptChangedResult scriptChanged(TTRoomScript *roomScript, TTNpcScript *npcScript, uint dialogueId); + ScriptChangedResult scriptChanged(TTroomScript *roomScript, + TTnpcScript *npcScript, uint dialogueId); - void processInput(TTRoomScript *roomScript, TTNpcScript *npcScript, + int processInput(TTroomScript *roomScript, TTnpcScript *npcScript, const TTstring &line); /** diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h index 0aba07ecd0..6917d0a8b1 100644 --- a/engines/titanic/true_talk/succubus_script.h +++ b/engines/titanic/true_talk/succubus_script.h @@ -27,13 +27,13 @@ namespace Titanic { -class SuccUBusScript : public TTNpcScript { +class SuccUBusScript : public TTnpcScript { private: int _field2D0; public: SuccUBusScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : - TTNpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7), + TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7), _field2D0(0) {} virtual int proc6() const; diff --git a/engines/titanic/true_talk/title_engine.h b/engines/titanic/true_talk/title_engine.h index 87491bf7b6..10c32a7634 100644 --- a/engines/titanic/true_talk/title_engine.h +++ b/engines/titanic/true_talk/title_engine.h @@ -42,10 +42,10 @@ public: class CTitleEngine { public: CScriptHandler *_scriptHandler; - TTScriptBase *_script; + TTscriptBase *_script; public: CTitleEngine(); - ~CTitleEngine(); + virtual ~CTitleEngine(); /** * Setup the engine @@ -75,7 +75,7 @@ public: Common::Array _data; public: STtitleEngine(); - ~STtitleEngine(); + virtual ~STtitleEngine(); void reset(); diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 7743d81509..da3b207434 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -179,13 +179,13 @@ void CTrueTalkManager::setFlags(int index, int val) { } void CTrueTalkManager::loadNPC(SimpleFile *file, int charId) { - TTNpcScript *script = _scripts.getNpcScript(charId); + TTnpcScript *script = _scripts.getNpcScript(charId); if (script) script->load(file); } void CTrueTalkManager::saveNPC(SimpleFile *file, int charId) const { - TTNpcScript *script = _scripts.getNpcScript(charId); + TTnpcScript *script = _scripts.getNpcScript(charId); if (script) { script->save(file); file->writeNumber(MKTAG_BE('U', 'R', 'A', 'H')); @@ -218,8 +218,8 @@ void CTrueTalkManager::update2() { } void CTrueTalkManager::start(CTrueTalkNPC *npc, uint id, CViewItem *view) { - TTNpcScript *npcScript = getNpcScript(npc); - TTRoomScript *roomScript = getRoomScript(); + TTnpcScript *npcScript = getNpcScript(npc); + TTroomScript *roomScript = getRoomScript(); _titleEngine.reset(); uint charId = npcScript->charId(); @@ -232,7 +232,7 @@ void CTrueTalkManager::start(CTrueTalkNPC *npc, uint id, CViewItem *view) { setDialogue(npc, roomScript, view); } -TTNpcScript *CTrueTalkManager::getTalker(const CString &name) const { +TTnpcScript *CTrueTalkManager::getTalker(const CString &name) const { if (name.contains("Doorbot")) return _scripts.getNpcScript(104); else if (name.contains("DeskBot")) @@ -255,9 +255,9 @@ TTNpcScript *CTrueTalkManager::getTalker(const CString &name) const { return nullptr; } -TTNpcScript *CTrueTalkManager::getNpcScript(CTrueTalkNPC *npc) const { +TTnpcScript *CTrueTalkManager::getNpcScript(CTrueTalkNPC *npc) const { CString npcName = npc->getName(); - TTNpcScript *script = getTalker(npcName); + TTnpcScript *script = getTalker(npcName); if (!script) { // Fall back on the default NPC script @@ -267,9 +267,9 @@ TTNpcScript *CTrueTalkManager::getNpcScript(CTrueTalkNPC *npc) const { return script; } -TTRoomScript *CTrueTalkManager::getRoomScript() const { +TTroomScript *CTrueTalkManager::getRoomScript() const { CRoomItem *room = _gameManager->getRoom(); - TTRoomScript *script = nullptr; + TTroomScript *script = nullptr; if (room) { int scriptId = room->getScriptId(); if (scriptId) @@ -303,8 +303,8 @@ void CTrueTalkManager::loadAssets(CTrueTalkNPC *npc, int charId) { } void CTrueTalkManager::processInput(CTrueTalkNPC *npc, CTextInputMsg *msg, CViewItem *view) { - TTNpcScript *npcScript = getNpcScript(npc); - TTRoomScript *roomScript = getRoomScript(); + TTnpcScript *npcScript = getNpcScript(npc); + TTroomScript *roomScript = getRoomScript(); _titleEngine.reset(); if (npcScript && roomScript) { @@ -320,7 +320,7 @@ void CTrueTalkManager::processInput(CTrueTalkNPC *npc, CTextInputMsg *msg, CView _currentNPC = nullptr; } -void CTrueTalkManager::setDialogue(CTrueTalkNPC *npc, TTRoomScript *roomScript, CViewItem *view) { +void CTrueTalkManager::setDialogue(CTrueTalkNPC *npc, TTroomScript *roomScript, CViewItem *view) { // Get the dialog text CString dialogueStr = readDialogueString(); if (dialogueStr.empty()) @@ -422,7 +422,7 @@ void CTrueTalkManager::triggerNPC(CTrueTalkNPC *npc) { } } -void CTrueTalkManager::setTalker(TTTalker *talker, TTRoomScript *roomScript, CViewItem *view, bool isParrot) { +void CTrueTalkManager::setTalker(TTTalker *talker, TTroomScript *roomScript, CViewItem *view, bool isParrot) { warning("TODO: CTrueTalkManager::setTalker"); } diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index 071291964e..524f13e1f2 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -42,7 +42,7 @@ class CTrueTalkManager { private: CGameManager *_gameManager; STtitleEngine _titleEngine; - TTScripts _scripts; + TTscripts _scripts; int _currentCharId; CDialogueFile *_dialogueFile; int _dialogueId; @@ -72,19 +72,19 @@ private: /** * Gets the script associated with an NPC game object */ - TTNpcScript *getNpcScript(CTrueTalkNPC *npc) const; + TTnpcScript *getNpcScript(CTrueTalkNPC *npc) const; /** * Gets the script associated with the current room */ - TTRoomScript *getRoomScript() const; + TTroomScript *getRoomScript() const; /** * Loads assets for the current character, if it's changed */ void loadAssets(CTrueTalkNPC *npc, int charId); - void setDialogue(CTrueTalkNPC *npc, TTRoomScript *roomScript, CViewItem *view); + void setDialogue(CTrueTalkNPC *npc, TTroomScript *roomScript, CViewItem *view); /** * Read in text from the dialogue file @@ -101,7 +101,7 @@ private: */ void triggerNPC(CTrueTalkNPC *npc); - void setTalker(TTTalker *talker, TTRoomScript *roomScript, CViewItem *view, bool isParrot); + void setTalker(TTTalker *talker, TTroomScript *roomScript, CViewItem *view, bool isParrot); public: static int _v1; static int _v2; @@ -169,7 +169,7 @@ public: /** * Returns the scripts for the manager */ - TTScripts &getScripts() { return _scripts; } + TTscripts &getScripts() { return _scripts; } /** * Remove any completed talkers @@ -186,7 +186,7 @@ public: /** * Return a TrueTalk talker/script */ - TTNpcScript *getTalker(const CString &name) const; + TTnpcScript *getTalker(const CString &name) const; /** * Process player's input diff --git a/engines/titanic/true_talk/tt_input.cpp b/engines/titanic/true_talk/tt_input.cpp new file mode 100644 index 0000000000..20fe86319b --- /dev/null +++ b/engines/titanic/true_talk/tt_input.cpp @@ -0,0 +1,43 @@ +/* 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 "titanic/true_talk/tt_input.h" +#include "titanic/true_talk/script_handler.h" + +namespace Titanic { + +TTinputSubBase::TTinputSubBase() : _field0(0), _field4(0), _field8(0), + _fieldC(0), _field10(0), _field14(0), _field18(0), _field1C(0), + _field20(0), _field24(0) { +} + +/*------------------------------------------------------------------------*/ + +TTinput::TTinput(int inputCtr, const TTstring &line, CScriptHandler *owner, + TTroomScript *roomScript, TTnpcScript *npcScript) : + _owner(owner), _field2C(1), _inputCtr(inputCtr), _field34(0), + _field38(0), _line(line), _field4C(0), _roomScript(roomScript), + _npcScript(npcScript), _field58(0), _field5C(0) { + _status = _line.isValid() && _string2.isValid() ? SS_11: SS_VALID; +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_input.h b/engines/titanic/true_talk/tt_input.h new file mode 100644 index 0000000000..9cb4b72c23 --- /dev/null +++ b/engines/titanic/true_talk/tt_input.h @@ -0,0 +1,77 @@ +/* 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. + * + */ + +#ifndef TITANIC_TT_INPUT_H +#define TITANIC_TT_INPUT_H + +#include "titanic/true_talk/tt_npc_script.h" +#include "titanic/true_talk/tt_room_script.h" +#include "titanic/true_talk/tt_string.h" + +namespace Titanic { + +class CScriptHandler; + +class TTinputSubBase { +public: + int _field0; + int _field4; + int _field8; + int _fieldC; + int _field10; + int _field14; + int _field18; + int _field1C; + int _field20; + int _field24; +public: + TTinputSubBase(); +}; + +class TTinputSub : public TTinputSubBase { +public: +}; + +class TTinput { +private: + CScriptHandler *_owner; + TTinputSub _sub; + int _field2C; + int _inputCtr; + int _field34; + int _field38; + TTstring _line; + TTstring _string2; + int _field4C; + TTroomScript *_roomScript; + TTnpcScript *_npcScript; + int _field58; + int _field5C; + int _status; +public: + TTinput(int inputCtr, const TTstring &line, CScriptHandler *owner, + TTroomScript *roomScript, TTnpcScript *npcScript); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_INPUT_H */ diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 40a50be030..46b350da39 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -26,17 +26,17 @@ namespace Titanic { -TTNpcScriptBase::TTNpcScriptBase(int charId, const char *charClass, int v2, +TTnpcScriptBase::TTnpcScriptBase(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : - TTScriptBase(0, charClass, v2, charName, v3, v4, v5, v6, v7), + TTscriptBase(0, charClass, v2, charName, v3, v4, v5, v6, v7), _charId(charId), _field54(0), _val2(val2) { } /*------------------------------------------------------------------------*/ -TTNpcScript::TTNpcScript(int charId, const char *charClass, int v2, +TTnpcScript::TTnpcScript(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : - TTNpcScriptBase(charId, charClass, v2, charName, v3, val2, v4, v5, v6, v7), + TTnpcScriptBase(charId, charClass, v2, charName, v3, val2, v4, v5, v6, v7), _subPtr(nullptr), _field60(0), _field64(0), _field68(0), _field6C(0), _field70(0), _field74(0), _field78(0), _field7C(0), _field80(0) { @@ -51,95 +51,95 @@ TTNpcScript::TTNpcScript(int charId, const char *charClass, int v2, resetFlags(); } -void TTNpcScript::resetFlags() { +void TTnpcScript::resetFlags() { Common::fill(&_array[26], &_array[146], 0); } -void TTNpcScript::randomizeFlags() { +void TTnpcScript::randomizeFlags() { warning("TODO"); } -void TTNpcScript::proc4(int v) { +void TTnpcScript::proc4(int v) { warning("TODO"); } -int TTNpcScript::proc6() const { +int TTnpcScript::proc6() const { return 1; } -void TTNpcScript::proc7(int v1, int v2) { +void TTnpcScript::proc7(int v1, int v2) { warning("TODO"); } -int TTNpcScript::proc8() const { +int TTnpcScript::proc8() const { return 0; } -int TTNpcScript::proc9() const { +int TTnpcScript::proc9() const { return 2; } -int TTNpcScript::proc11() const { +int TTnpcScript::proc11() const { return 2; } -int TTNpcScript::proc12() const { +int TTnpcScript::proc12() const { return 1; } -bool TTNpcScript::proc13() const { +bool TTnpcScript::proc13() const { warning("TODO"); return true; } -void TTNpcScript::proc14(int v) { +void TTnpcScript::proc14(int v) { warning("TODO"); } -int TTNpcScript::proc15() const { +int TTnpcScript::proc15() const { return 0; } -bool TTNpcScript::proc16() const { +bool TTnpcScript::proc16() const { return true; } -bool TTNpcScript::proc17() const { +bool TTnpcScript::proc17() const { return true; } -bool TTNpcScript::proc18() const { +bool TTnpcScript::proc18() const { return true; } -void TTNpcScript::proc19(int v) { +void TTnpcScript::proc19(int v) { warning("TODO"); } -void TTNpcScript::proc20(int v) { +void TTnpcScript::proc20(int v) { warning("TODO"); } -int TTNpcScript::proc21(int v) { +int TTnpcScript::proc21(int v) { return v; } -int TTNpcScript::proc22() const { +int TTnpcScript::proc22() const { return 0; } -int TTNpcScript::proc23() const { +int TTnpcScript::proc23() const { return 0; } -int TTNpcScript::proc25() const { +int TTnpcScript::proc25() const { return 0; } -void TTNpcScript::proc26() { +void TTnpcScript::proc26() { } -void TTNpcScript::save(SimpleFile *file) { +void TTnpcScript::save(SimpleFile *file) { file->writeNumber(charId()); saveBody(file); @@ -154,7 +154,7 @@ void TTNpcScript::save(SimpleFile *file) { file->writeNumber(_array[idx]); } -void TTNpcScript::load(SimpleFile *file) { +void TTnpcScript::load(SimpleFile *file) { loadBody(file); int count = file->readNumber(); @@ -174,7 +174,7 @@ void TTNpcScript::load(SimpleFile *file) { } } -void TTNpcScript::saveBody(SimpleFile *file) { +void TTnpcScript::saveBody(SimpleFile *file) { int v = proc31(); file->writeNumber(v); @@ -183,7 +183,7 @@ void TTNpcScript::saveBody(SimpleFile *file) { } } -void TTNpcScript::loadBody(SimpleFile *file) { +void TTnpcScript::loadBody(SimpleFile *file) { int count = file->readNumber(); preLoad(); @@ -196,38 +196,38 @@ void TTNpcScript::loadBody(SimpleFile *file) { } } -int TTNpcScript::proc31() { +int TTnpcScript::proc31() { warning("TODO"); return 0; } -void TTNpcScript::proc32() { +void TTnpcScript::proc32() { warning("TODO"); } -void TTNpcScript::proc33(int v1, int v2) { +void TTnpcScript::proc33(int v1, int v2) { warning("TODO"); } -int TTNpcScript::proc34() { +int TTnpcScript::proc34() { warning("TODO"); return 0; } -int TTNpcScript::getDialLevel(uint dialNum, bool flag) { +int TTnpcScript::getDialLevel(uint dialNum, bool flag) { warning("TODO"); return 0; } -int TTNpcScript::proc36() const { +int TTnpcScript::proc36() const { return 0; } -int TTNpcScript::proc37() const { +int TTnpcScript::proc37() const { return 0; } -void TTNpcScript::preLoad() { +void TTnpcScript::preLoad() { if (_subPtr) { error("TODO"); } diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index f3df956850..58c1d346f5 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -29,14 +29,14 @@ namespace Titanic { -class TTNpcScriptBase : public TTScriptBase { +class TTnpcScriptBase : public TTscriptBase { protected: int _field54; int _val2; public: int _charId; public: - TTNpcScriptBase(int charId, const char *charClass, int v2, + TTnpcScriptBase(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7); @@ -48,7 +48,7 @@ public: /** * Called when the script/id changes */ - virtual ScriptChangedResult scriptChanged(TTScriptBase *roomScript, uint id) = 0; + virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id) = 0; virtual int proc11() const = 0; virtual int proc12() const = 0; @@ -56,7 +56,7 @@ public: int charId() const { return _charId; } }; -class TTNpcScript : public TTNpcScriptBase { +class TTnpcScript : public TTnpcScriptBase { protected: byte *_subPtr; int _field60; @@ -74,7 +74,7 @@ protected: void randomizeFlags(); public: - TTNpcScript(int charId, const char *charClass, int v2, + TTnpcScript(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7); @@ -87,7 +87,7 @@ public: /** * Called when the script/id changes */ - virtual ScriptChangedResult scriptChanged(TTScriptBase *roomScript, uint id) { + virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id) { return SCR_2; } @@ -129,7 +129,7 @@ public: /** * Called with the script and id changes */ - ScriptChangedResult notifyScript(TTScriptBase *npcScript, int id) { + ScriptChangedResult notifyScript(TTscriptBase *npcScript, int id) { return scriptChanged(npcScript, id); } }; diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index ad40cbcad4..5bae72ce33 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -22,7 +22,12 @@ #include "titanic/true_talk/tt_parser.h" #include "titanic/true_talk/script_handler.h" +#include "titanic/true_talk/tt_input.h" namespace Titanic { +void TTparser::processInput(TTinput *input) { + warning("TODO: TTparser::processInput"); +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index 767406adb1..89977067cb 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -23,6 +23,8 @@ #ifndef TITANIC_TT_PARSER_H #define TITANIC_TT_PARSER_H +#include "titanic/true_talk/tt_input.h" + namespace Titanic { class CScriptHandler; @@ -39,6 +41,11 @@ public: public: TTparser(CScriptHandler *owner) : _owner(owner), _field4(0), _field8(0), _fieldC(0), _field10(0), _field14(0), _field18(0) {} + + /** + * Gets passed a newly created input wrapper during conversation text processing + */ + void processInput(TTinput *input); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_room_script.cpp b/engines/titanic/true_talk/tt_room_script.cpp index 2ade0495cf..62f60f428c 100644 --- a/engines/titanic/true_talk/tt_room_script.cpp +++ b/engines/titanic/true_talk/tt_room_script.cpp @@ -25,42 +25,42 @@ namespace Titanic { -TTRoomScriptBase::TTRoomScriptBase(int scriptId, +TTroomScriptBase::TTroomScriptBase(int scriptId, const char *charClass, const char *charName, int v3, int v4, int v5, int v6, int v2, int v7) : _scriptId(scriptId), - TTScriptBase(3, charClass, v2, charName, v3, v4, v5, v6, v7) { + TTscriptBase(3, charClass, v2, charName, v3, v4, v5, v6, v7) { } /*------------------------------------------------------------------------*/ -TTRoomScript::TTRoomScript(int scriptId) : - TTRoomScriptBase(scriptId, "", "", 0, -1, -1, -1, 0, 0) { +TTroomScript::TTroomScript(int scriptId) : + TTroomScriptBase(scriptId, "", "", 0, -1, -1, -1, 0, 0) { } -void TTRoomScript::proc6() { +void TTroomScript::proc6() { warning("TODO"); } -void TTRoomScript::proc7() { +void TTroomScript::proc7() { warning("TODO"); } -void TTRoomScript::proc8() { +void TTroomScript::proc8() { warning("TODO"); } -void TTRoomScript::proc9() { +void TTroomScript::proc9() { warning("TODO"); } -ScriptChangedResult TTRoomScript::scriptChanged(TTScriptBase *npcScript, int id) { +ScriptChangedResult TTroomScript::scriptChanged(TTscriptBase *npcScript, int id) { if (id == 1) _field54 = 1; return SCR_1; } -void TTRoomScript::proc11() { +void TTroomScript::proc11() { warning("TODO"); } diff --git a/engines/titanic/true_talk/tt_room_script.h b/engines/titanic/true_talk/tt_room_script.h index 30133b24da..7f72573dec 100644 --- a/engines/titanic/true_talk/tt_room_script.h +++ b/engines/titanic/true_talk/tt_room_script.h @@ -27,11 +27,11 @@ namespace Titanic { -class TTRoomScriptBase : public TTScriptBase { +class TTroomScriptBase : public TTscriptBase { public: int _scriptId; public: - TTRoomScriptBase(int scriptId, const char *charClass, const char *charName, + TTroomScriptBase(int scriptId, const char *charClass, const char *charName, int v3, int v4, int v5, int v6, int v2, int v7); virtual void proc6() = 0; @@ -42,17 +42,17 @@ public: /** * Called when the script changes */ - virtual ScriptChangedResult scriptChanged(TTScriptBase *npcScript, int id) = 0; + virtual ScriptChangedResult scriptChanged(TTscriptBase *npcScript, int id) = 0; virtual void proc11() = 0; }; -class TTRoomScript : public TTRoomScriptBase { +class TTroomScript : public TTroomScriptBase { private: int _field54; public: - TTRoomScript(int scriptId); + TTroomScript(int scriptId); virtual void proc6(); virtual void proc7(); @@ -62,14 +62,14 @@ public: /** * Called when the script changes */ - virtual ScriptChangedResult scriptChanged(TTScriptBase *npcScript, int id); + virtual ScriptChangedResult scriptChanged(TTscriptBase *npcScript, int id); virtual void proc11(); /** * Called with the new script and id */ - ScriptChangedResult notifyScript(TTScriptBase *npcScript, int id) { + ScriptChangedResult notifyScript(TTscriptBase *npcScript, int id) { return scriptChanged(npcScript, id); } }; diff --git a/engines/titanic/true_talk/tt_script_base.cpp b/engines/titanic/true_talk/tt_script_base.cpp index 1430f031ce..e937f0ac64 100644 --- a/engines/titanic/true_talk/tt_script_base.cpp +++ b/engines/titanic/true_talk/tt_script_base.cpp @@ -25,7 +25,7 @@ namespace Titanic { -TTScriptBase::TTScriptBase(int v1, const char *charClass, int v2, +TTscriptBase::TTscriptBase(int v1, const char *charClass, int v2, const char *charName, int v3, int v4, int v5, int v6, int v7) : _charName(charName), _charClass(charClass), _field4(0), _field8(0), _fieldC(0), @@ -50,13 +50,13 @@ TTScriptBase::TTScriptBase(int v1, const char *charClass, int v2, reset(); } -bool TTScriptBase::areNamesValid() { +bool TTscriptBase::areNamesValid() { bool result = !_charName.isValid() && !_charClass.isValid(); _status = result ? 0 : 11; return result; } -void TTScriptBase::reset() { +void TTscriptBase::reset() { _field4 = 0; _field8 = 4; _fieldC = 0; @@ -73,19 +73,23 @@ void TTScriptBase::reset() { _field48 = 0; } -void TTScriptBase::proc2(int v) { +void TTscriptBase::processInput(TTinput *input) { + warning("TODO: TTscriptBase::processInput"); +} + +void TTscriptBase::proc2(int v) { warning("TODO"); } -void TTScriptBase::proc3(int v) { +void TTscriptBase::proc3(int v) { warning("TODO"); } -void TTScriptBase::proc4(int v) { +void TTscriptBase::proc4(int v) { warning("TODO"); } -void TTScriptBase::proc5() { +void TTscriptBase::proc5() { warning("TODO"); } diff --git a/engines/titanic/true_talk/tt_script_base.h b/engines/titanic/true_talk/tt_script_base.h index dc0db2ceb8..0aac1ed2e7 100644 --- a/engines/titanic/true_talk/tt_script_base.h +++ b/engines/titanic/true_talk/tt_script_base.h @@ -31,7 +31,9 @@ enum ScriptChangedResult { SCR_1 = 1, SCR_2 = 2, SCR_3 = 3, SCR_4 = 4, SCR_5 = 5 }; -class TTScriptBase { +class TTinput; + +class TTscriptBase { private: void reset(); protected: @@ -52,13 +54,18 @@ protected: int _field48; int _status; public: - TTScriptBase(int v1, const char *charClass, int v2, const char *charName, + TTscriptBase(int v1, const char *charClass, int v2, const char *charName, int v3, int v4, int v5, int v6, int v7); bool areNamesValid(); int getStatus() const { return _status; } + /** + * Gets passed a newly created input wrapper during conversation text processing + */ + void processInput(TTinput *input); + virtual void proc2(int v); virtual void proc3(int v); diff --git a/engines/titanic/true_talk/tt_scripts.cpp b/engines/titanic/true_talk/tt_scripts.cpp index 96daf76827..fbdf52fdc0 100644 --- a/engines/titanic/true_talk/tt_scripts.cpp +++ b/engines/titanic/true_talk/tt_scripts.cpp @@ -33,9 +33,9 @@ namespace Titanic { -TTNpcScript *TTNpcScriptList::findById(int charId) const { - for (TTNpcScriptList::const_iterator i = begin(); i != end(); ++i) { - const TTNpcScriptListItem *item = *i; +TTnpcScript *TTnpcScriptList::findById(int charId) const { + for (TTnpcScriptList::const_iterator i = begin(); i != end(); ++i) { + const TTnpcScriptListItem *item = *i; if (item->_npcScript->_charId == charId) return item->_npcScript; } @@ -45,9 +45,9 @@ TTNpcScript *TTNpcScriptList::findById(int charId) const { /*------------------------------------------------------------------------*/ -TTRoomScript *TTRoomScriptList::findById(int scriptId) const { - for (TTRoomScriptList::const_iterator i = begin(); i != end(); ++i) { - const TTRoomScriptListItem *item = *i; +TTroomScript *TTroomScriptList::findById(int scriptId) const { + for (TTroomScriptList::const_iterator i = begin(); i != end(); ++i) { + const TTroomScriptListItem *item = *i; if (item->_item->_scriptId == scriptId) return item->_item; } @@ -57,11 +57,11 @@ TTRoomScript *TTRoomScriptList::findById(int scriptId) const { /*------------------------------------------------------------------------*/ -TTScripts::TTScripts(CTitleEngine *titleEngine) : +TTscripts::TTscripts(CTitleEngine *titleEngine) : _titleEngine(titleEngine), _field24(0), _field28(0) { // Load room scripts for (int scriptNum = 100; scriptNum < 133; ++scriptNum) - addScript(new TTRoomScript(scriptNum)); + addScript(new TTroomScript(scriptNum)); // Load npc scripts addScript(new DoorbotScript(104, "Doorbot", 0, "Fentible", 11, 1, -1, -1, -1, 0), 100); @@ -74,25 +74,25 @@ TTScripts::TTScripts(CTitleEngine *titleEngine) : addScript(new SuccUBusScript(111, "Succubus", 0, "Shorbert", 9, 1, -1, -1, -1, 0), 110); } -void TTScripts::addScript(TTNpcScript *script, int scriptId) { +void TTscripts::addScript(TTnpcScript *script, int scriptId) { script->proc13(); // Find the room script this is associated with - TTRoomScript *roomScript = getRoomScript(scriptId); + TTroomScript *roomScript = getRoomScript(scriptId); assert(roomScript); - _npcScripts.push_back(new TTNpcScriptListItem(script, roomScript)); + _npcScripts.push_back(new TTnpcScriptListItem(script, roomScript)); } -void TTScripts::addScript(TTRoomScript *script) { - _roomScripts.push_back(new TTRoomScriptListItem(script)); +void TTscripts::addScript(TTroomScript *script) { + _roomScripts.push_back(new TTroomScriptListItem(script)); } -TTRoomScript *TTScripts::getRoomScript(int scriptId) const { +TTroomScript *TTscripts::getRoomScript(int scriptId) const { return _roomScripts.findById(scriptId); } -TTNpcScript *TTScripts::getNpcScript(int charId) const { +TTnpcScript *TTscripts::getNpcScript(int charId) const { return _npcScripts.findById(charId); } diff --git a/engines/titanic/true_talk/tt_scripts.h b/engines/titanic/true_talk/tt_scripts.h index 8dd2e9305d..afcc2c3aef 100644 --- a/engines/titanic/true_talk/tt_scripts.h +++ b/engines/titanic/true_talk/tt_scripts.h @@ -31,33 +31,33 @@ namespace Titanic { class CTitleEngine; -class TTNpcScriptListItem : public ListItem { +class TTnpcScriptListItem : public ListItem { public: - TTNpcScript *_npcScript; - TTRoomScript *_roomScript; + TTnpcScript *_npcScript; + TTroomScript *_roomScript; public: - TTNpcScriptListItem() : _npcScript(nullptr), _roomScript(nullptr) {} - TTNpcScriptListItem(TTNpcScript *script, TTRoomScript *roomScript) : + TTnpcScriptListItem() : _npcScript(nullptr), _roomScript(nullptr) {} + TTnpcScriptListItem(TTnpcScript *script, TTroomScript *roomScript) : _npcScript(script), _roomScript(roomScript) {} - virtual ~TTNpcScriptListItem() { delete _npcScript; } + virtual ~TTnpcScriptListItem() { delete _npcScript; } }; -PTR_LIST_ITEM(TTRoomScript); +PTR_LIST_ITEM(TTroomScript); -class TTNpcScriptList : public List { +class TTnpcScriptList : public List { public: - TTNpcScript *findById(int charId) const; + TTnpcScript *findById(int charId) const; }; -class TTRoomScriptList : public List { +class TTroomScriptList : public List { public: - TTRoomScript *findById(int scriptId) const; + TTroomScript *findById(int scriptId) const; }; -class TTScripts { +class TTscripts { private: - TTNpcScriptList _npcScripts; - TTRoomScriptList _roomScripts; + TTnpcScriptList _npcScripts; + TTroomScriptList _roomScripts; CTitleEngine *_titleEngine; int _field24; int _field28; @@ -65,24 +65,24 @@ private: /** * Add a named script to the named scripts list */ - void addScript(TTNpcScript *script, int charId); + void addScript(TTnpcScript *script, int charId); /** * Add an unnamed script to the unnamed scripts list */ - void addScript(TTRoomScript *script); + void addScript(TTroomScript *script); public: - TTScripts(CTitleEngine *titleEngine); + TTscripts(CTitleEngine *titleEngine); /** * Return a pointer to the specified room script */ - TTRoomScript *getRoomScript(int scriptId) const; + TTroomScript *getRoomScript(int scriptId) const; /** * Return a pointer to the specified character script */ - TTNpcScript *getNpcScript(int charId) const; + TTnpcScript *getNpcScript(int charId) const; }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index 0256f1022f..1a95b4e4be 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -38,7 +38,7 @@ struct TTstringData { TTstringData(const CString &str) : _string(str), _referenceCount(1) {} }; -enum TTstringStatus { SS_VALID = 0, SS_5 = 5, SS_7 = 7, SS_8 = 8, SS_13 = 13 }; +enum TTstringStatus { SS_VALID = 0, SS_5 = 5, SS_7 = 7, SS_8 = 8, SS_11 = 11, SS_13 = 13 }; class TTstring { private: diff --git a/engines/titanic/true_talk/tt_title_script.cpp b/engines/titanic/true_talk/tt_title_script.cpp index af784e3352..85b56d0e1e 100644 --- a/engines/titanic/true_talk/tt_title_script.cpp +++ b/engines/titanic/true_talk/tt_title_script.cpp @@ -24,7 +24,7 @@ namespace Titanic { -TTTitleScript::TTTitleScript() : TTScriptBase(1, "", 0, "", 0, -1, -1, -1, 0), +TTTitleScript::TTTitleScript() : TTscriptBase(1, "", 0, "", 0, -1, -1, -1, 0), _field50(0), _field5C(-1), _field60(0) { } diff --git a/engines/titanic/true_talk/tt_title_script.h b/engines/titanic/true_talk/tt_title_script.h index a1efd11270..f02e591c54 100644 --- a/engines/titanic/true_talk/tt_title_script.h +++ b/engines/titanic/true_talk/tt_title_script.h @@ -28,7 +28,7 @@ namespace Titanic { -class TTTitleScript : public TTScriptBase { +class TTTitleScript : public TTscriptBase { private: int _field50; TTstring _string1; -- cgit v1.2.3 From e862d80cd2f57b3eebdedb9f87c11fa3b5106e6a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 14 May 2016 09:22:52 -0400 Subject: TITANIC: Beginning of parser input line normalization --- engines/titanic/true_talk/script_handler.cpp | 2 ++ engines/titanic/true_talk/tt_input.h | 3 ++- engines/titanic/true_talk/tt_parser.cpp | 28 ++++++++++++++++++++++++- engines/titanic/true_talk/tt_parser.h | 10 +++++---- engines/titanic/true_talk/tt_script_base.cpp | 3 ++- engines/titanic/true_talk/tt_script_base.h | 2 +- engines/titanic/true_talk/tt_string.cpp | 31 ++++++++++++++++++++++++++++ engines/titanic/true_talk/tt_string.h | 11 ++++++++++ 8 files changed, 82 insertions(+), 8 deletions(-) diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index 041d4909f7..2e2a148e26 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -65,6 +65,8 @@ int CScriptHandler::processInput(TTroomScript *roomScript, TTnpcScript *npcScrip TTinput *input = new TTinput(_inputCtr++, line, this, roomScript, npcScript); _parser.processInput(input); + roomScript->processInput(input); + npcScript->processInput(input); warning("TODO: CScriptHandler::processInput"); diff --git a/engines/titanic/true_talk/tt_input.h b/engines/titanic/true_talk/tt_input.h index 9cb4b72c23..7e6fd92f12 100644 --- a/engines/titanic/true_talk/tt_input.h +++ b/engines/titanic/true_talk/tt_input.h @@ -59,7 +59,6 @@ private: int _inputCtr; int _field34; int _field38; - TTstring _line; TTstring _string2; int _field4C; TTroomScript *_roomScript; @@ -67,6 +66,8 @@ private: int _field58; int _field5C; int _status; +public: + TTstring _line; public: TTinput(int inputCtr, const TTstring &line, CScriptHandler *owner, TTroomScript *roomScript, TTnpcScript *npcScript); diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 5bae72ce33..a48fcaea0e 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -26,8 +26,34 @@ namespace Titanic { -void TTparser::processInput(TTinput *input) { +int TTparser::processInput(TTinput *input) { + _input = input; + if (normalize(input)) + return 0; + warning("TODO: TTparser::processInput"); + return 0; +} + +int TTparser::normalize(TTinput *input) { + TTstring *line = new TTstring(); + + for (const char *lineP = input->_line.c_str(); lineP; ++lineP) { + char c = *lineP; + if (Common::isLower(c)) { + (*line) += c; + } else if (Common::isSpace(c)) { + if (!line->empty() && line->lastChar() != ' ') + (*line) += ' '; + } else if (Common::isUpper(c)) { + (*line) += toupper(c); + } else if (Common::isDigit(c)) { + // TODO: num handling + } + // TODO other cases + } + + return 0; } } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index 89977067cb..7df82b0b5b 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -30,22 +30,24 @@ namespace Titanic { class CScriptHandler; class TTparser { +private: + int normalize(TTinput *input); public: CScriptHandler *_owner; int _field4; - int _field8; + TTinput *_input; int _fieldC; int _field10; int _field14; int _field18; public: - TTparser(CScriptHandler *owner) : _owner(owner), _field4(0), _field8(0), - _fieldC(0), _field10(0), _field14(0), _field18(0) {} + TTparser(CScriptHandler *owner) : _owner(owner), _field4(0), + _input(nullptr), _fieldC(0), _field10(0), _field14(0), _field18(0) {} /** * Gets passed a newly created input wrapper during conversation text processing */ - void processInput(TTinput *input); + int processInput(TTinput *input); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_script_base.cpp b/engines/titanic/true_talk/tt_script_base.cpp index e937f0ac64..88f06a493e 100644 --- a/engines/titanic/true_talk/tt_script_base.cpp +++ b/engines/titanic/true_talk/tt_script_base.cpp @@ -73,8 +73,9 @@ void TTscriptBase::reset() { _field48 = 0; } -void TTscriptBase::processInput(TTinput *input) { +int TTscriptBase::processInput(TTinput *input) { warning("TODO: TTscriptBase::processInput"); + return 0; } void TTscriptBase::proc2(int v) { diff --git a/engines/titanic/true_talk/tt_script_base.h b/engines/titanic/true_talk/tt_script_base.h index 0aac1ed2e7..12abb5ccda 100644 --- a/engines/titanic/true_talk/tt_script_base.h +++ b/engines/titanic/true_talk/tt_script_base.h @@ -64,7 +64,7 @@ public: /** * Gets passed a newly created input wrapper during conversation text processing */ - void processInput(TTinput *input); + int processInput(TTinput *input); virtual void proc2(int v); diff --git a/engines/titanic/true_talk/tt_string.cpp b/engines/titanic/true_talk/tt_string.cpp index 7a39d7163f..338b7b50ae 100644 --- a/engines/titanic/true_talk/tt_string.cpp +++ b/engines/titanic/true_talk/tt_string.cpp @@ -80,6 +80,37 @@ void TTstring::operator=(const char *str) { _status = SS_VALID; } +TTstring &TTstring::operator+=(const char *str) { + _data->_string += str; + return *this; +} + +TTstring &TTstring::operator+=(const TTstring &str) { + _data->_string += str; + return *this; +} + +TTstring &TTstring::operator+=(char c) { + _data->_string += c; + return *this; +} + +bool TTstring::empty() const { + return _data->_string.empty(); +} + +char TTstring::firstChar() const { + return _data->_string.firstChar(); +} + +char TTstring::lastChar() const { + return _data->_string.lastChar(); +} + +TTstring *TTstring::copy() const { + return new TTstring(c_str()); +} + bool TTstring::isValid() const { return _status == SS_VALID; } diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index 1a95b4e4be..8fe7127ac7 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -54,6 +54,17 @@ public: void operator=(const TTstring &str); void operator=(const CString &str); void operator=(const char *str); + TTstring &operator+=(const char *str); + TTstring &operator+=(const TTstring &str); + TTstring &operator+=(char c); + bool empty() const; + char firstChar() const; + char lastChar() const; + + /** + * Create a new copy of the string + */ + TTstring *copy() const; /** * Returns true if the string is valid -- cgit v1.2.3 From 68e230182c1f0524a536422bbb669788cf388782 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 14 May 2016 15:48:15 -0400 Subject: TITANIC: Implement TTparser normalize --- common/util.cpp | 7 ++ common/util.h | 11 +++ engines/titanic/true_talk/tt_input.cpp | 4 + engines/titanic/true_talk/tt_input.h | 2 + engines/titanic/true_talk/tt_parser.cpp | 132 +++++++++++++++++++++++++++++--- engines/titanic/true_talk/tt_parser.h | 14 ++++ engines/titanic/true_talk/tt_string.cpp | 8 ++ engines/titanic/true_talk/tt_string.h | 2 + 8 files changed, 171 insertions(+), 9 deletions(-) diff --git a/common/util.cpp b/common/util.cpp index 8e0a2fd61f..62a1baf6ac 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -28,6 +28,7 @@ #define FORBIDDEN_SYMBOL_EXCEPTION_isspace #define FORBIDDEN_SYMBOL_EXCEPTION_isupper #define FORBIDDEN_SYMBOL_EXCEPTION_isprint +#define FORBIDDEN_SYMBOL_EXCEPTION_ispunct #include "common/util.h" @@ -150,4 +151,10 @@ bool isPrint(int c) { ENSURE_ASCII_CHAR(c); return isprint((byte)c); } + +bool isPunct(int c) { + ENSURE_ASCII_CHAR(c); + return ispunct((byte)c); +} + } // End of namespace Common diff --git a/common/util.h b/common/util.h index f51aa00925..1f635f3654 100644 --- a/common/util.h +++ b/common/util.h @@ -177,6 +177,17 @@ bool isUpper(int c); * @return true if the character is printable, false otherwise. */ bool isPrint(int c); + + +/** + * Test whether the given character is a punctuation character, + * (i.e not alphanumeric. + * + * @param c the character to test + * @return true if the character is punctuation, false otherwise. + */ +bool isPunct(int c); + } // End of namespace Common #endif diff --git a/engines/titanic/true_talk/tt_input.cpp b/engines/titanic/true_talk/tt_input.cpp index 20fe86319b..5d480425bd 100644 --- a/engines/titanic/true_talk/tt_input.cpp +++ b/engines/titanic/true_talk/tt_input.cpp @@ -40,4 +40,8 @@ TTinput::TTinput(int inputCtr, const TTstring &line, CScriptHandler *owner, _status = _line.isValid() && _string2.isValid() ? SS_11: SS_VALID; } +void TTinput::set38(int val) { + _field38 = val; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_input.h b/engines/titanic/true_talk/tt_input.h index 7e6fd92f12..e4d91d7a58 100644 --- a/engines/titanic/true_talk/tt_input.h +++ b/engines/titanic/true_talk/tt_input.h @@ -71,6 +71,8 @@ public: public: TTinput(int inputCtr, const TTstring &line, CScriptHandler *owner, TTroomScript *roomScript, TTnpcScript *npcScript); + + void set38(int v); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index a48fcaea0e..2d958f8d7a 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -36,24 +36,138 @@ int TTparser::processInput(TTinput *input) { } int TTparser::normalize(TTinput *input) { - TTstring *line = new TTstring(); + TTstring *destLine = new TTstring(); + const TTstring &srcLine = input->_line; + int srcSize = srcLine.size(); + int savedIndex = 0; + int counter1 = 0; + int commandVal; - for (const char *lineP = input->_line.c_str(); lineP; ++lineP) { - char c = *lineP; + for (int index = 0; index < srcSize; ++index) { + char c = srcLine[index]; if (Common::isLower(c)) { - (*line) += c; + (*destLine) += c; } else if (Common::isSpace(c)) { - if (!line->empty() && line->lastChar() != ' ') - (*line) += ' '; + if (!destLine->empty() && destLine->lastChar() != ' ') + (*destLine) += ' '; } else if (Common::isUpper(c)) { - (*line) += toupper(c); + (*destLine) += toupper(c); } else if (Common::isDigit(c)) { - // TODO: num handling + if (c == '0' && isSpecialCommand(srcLine, index)) { + input->set38(10); + } else { + // Iterate through all the digits of the number + (*destLine) += c; + while (Common::isDigit(srcLine[index + 1])) + (*destLine) += srcLine[++index]; + } + } else if (Common::isPunct(c)) { + bool flag = false; + switch (c) { + case '!': + input->set38(3); + break; + + case '\'': + if (!normalizeQuotedString(srcLine, index, *destLine)) + flag = true; + break; + + case '.': + input->set38(1); + break; + + case ':': + commandVal = isSpecialCommand(srcLine, index); + if (commandVal) { + input->set38(commandVal); + index += 2; + } else { + flag = true; + } + break; + + case ';': + commandVal = isSpecialCommand(srcLine, index); + if (commandVal == 6) { + input->set38(7); + index += 2; + } else if (commandVal != 0) { + input->set38(commandVal); + index += 2; + } + break; + + case '<': + ++index; + commandVal = isSpecialCommand(srcLine, index); + if (commandVal == 6) { + input->set38(12); + } else { + --index; + flag = true; + } + break; + + case '>': + ++index; + commandVal = isSpecialCommand(srcLine, index); + if (commandVal == 6 || commandVal == 9) { + input->set38(11); + } else { + --index; + flag = true; + } + break; + + case '?': + input->set38(2); + break; + + default: + flag = true; + break; + } + + if (flag && (!savedIndex || (index - savedIndex) == 1)) + ++counter1; + + savedIndex = index; } - // TODO other cases } return 0; } +int TTparser::isSpecialCommand(const TTstring &str, int &index) { + if (str[index] != ':' && str[index] != ';') + return 0; + + if (str[index + 1] != '-') + return 0; + + index += 2; + switch (str[index]) { + case '(': + case '<': + return 8; + + case ')': + case '>': + return 6; + + case 'P': + case 'p': + return 9; + + default: + return 5; + } +} + +bool TTparser::normalizeQuotedString(const TTstring &srcLine, int srcIndex, TTstring &destLine) { + // TODO + return false; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index 7df82b0b5b..d05835dd4c 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -31,7 +31,21 @@ class CScriptHandler; class TTparser { private: + /** + * Normalizes a passed input, taking care of things like removing extra + * spaces and lowercasing everything + */ int normalize(TTinput *input); + + /** + * Submethod called by normalize to handle text following single quote chracters + */ + bool normalizeQuotedString(const TTstring &srcLine, int srcIndex, TTstring &destLine); + + /** + * Checks for what is likely special developer cheat codes + */ + static int isSpecialCommand(const TTstring &str, int &index); public: CScriptHandler *_owner; int _field4; diff --git a/engines/titanic/true_talk/tt_string.cpp b/engines/titanic/true_talk/tt_string.cpp index 338b7b50ae..5574cffb48 100644 --- a/engines/titanic/true_talk/tt_string.cpp +++ b/engines/titanic/true_talk/tt_string.cpp @@ -95,6 +95,10 @@ TTstring &TTstring::operator+=(char c) { return *this; } +const char &TTstring::operator[](uint index) { + return *(c_str() + index); +} + bool TTstring::empty() const { return _data->_string.empty(); } @@ -107,6 +111,10 @@ char TTstring::lastChar() const { return _data->_string.lastChar(); } +int TTstring::size() const { + return _data->_string.size(); +} + TTstring *TTstring::copy() const { return new TTstring(c_str()); } diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index 8fe7127ac7..3b2b6a2245 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -57,9 +57,11 @@ public: TTstring &operator+=(const char *str); TTstring &operator+=(const TTstring &str); TTstring &operator+=(char c); + const char &operator[](uint index); bool empty() const; char firstChar() const; char lastChar() const; + int size() const; /** * Create a new copy of the string -- cgit v1.2.3 From 1da409ca9891a46bed2a61fc07946165c670c4e6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 14 May 2016 15:58:00 -0400 Subject: TITANIC: Rename stub method to normalizeContraction --- engines/titanic/true_talk/tt_parser.cpp | 4 ++-- engines/titanic/true_talk/tt_parser.h | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 2d958f8d7a..0bb30a14b5 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -69,7 +69,7 @@ int TTparser::normalize(TTinput *input) { break; case '\'': - if (!normalizeQuotedString(srcLine, index, *destLine)) + if (!normalizeContraction(srcLine, index, *destLine)) flag = true; break; @@ -165,7 +165,7 @@ int TTparser::isSpecialCommand(const TTstring &str, int &index) { } } -bool TTparser::normalizeQuotedString(const TTstring &srcLine, int srcIndex, TTstring &destLine) { +bool TTparser::normalizeContraction(const TTstring &srcLine, int srcIndex, TTstring &destLine) { // TODO return false; } diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index d05835dd4c..3e31257c9d 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -38,9 +38,10 @@ private: int normalize(TTinput *input); /** - * Submethod called by normalize to handle text following single quote chracters + * Submethod called by normalize to handle expanding contacted word pairs + * like can't, should've, and so on. */ - bool normalizeQuotedString(const TTstring &srcLine, int srcIndex, TTstring &destLine); + bool normalizeContraction(const TTstring &srcLine, int srcIndex, TTstring &destLine); /** * Checks for what is likely special developer cheat codes -- cgit v1.2.3 From 69134c66cc700fef16b202354e491b9ab6d0b8c0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 14 May 2016 19:49:34 -0400 Subject: TITANIC: Implemented parser normalizeContraction --- engines/titanic/true_talk/tt_parser.cpp | 81 +++++++++++++++++++++++++++++++++ engines/titanic/true_talk/tt_string.cpp | 28 ------------ engines/titanic/true_talk/tt_string.h | 51 ++++++++++++++++++--- 3 files changed, 125 insertions(+), 35 deletions(-) diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 0bb30a14b5..5aa3576a0f 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -166,6 +166,87 @@ int TTparser::isSpecialCommand(const TTstring &str, int &index) { } bool TTparser::normalizeContraction(const TTstring &srcLine, int srcIndex, TTstring &destLine) { + int startIndex = srcIndex + 1; + switch (srcLine[startIndex]) { + case 'd': + srcIndex += 2; + if (srcLine.compareAt(srcIndex, " a ") || srcLine.compareAt(srcIndex, " the ")) { + destLine += " had"; + } else { + destLine += " would"; + } + + srcIndex = startIndex; + break; + + case 'l': + if (srcLine[srcIndex + 2] == 'l') { + // 'll ending + destLine += " will"; + srcIndex = startIndex; + } + break; + + case 'm': + // 'm ending + destLine += " am"; + srcIndex = startIndex; + break; + + case 'r': + // 're ending + if (srcLine[srcIndex + 2] == 'e') { + destLine += " are"; + srcIndex = startIndex; + } + break; + + case 's': + destLine += "s*"; + srcIndex = startIndex; + break; + + case 't': + if (srcLine[srcIndex - 1] == 'n' && srcIndex >= 3) { + if (srcLine[srcIndex - 3] == 'c' && srcLine[srcIndex - 2] == 'a' && + (srcIndex == 3 || srcLine[srcIndex - 4])) { + // can't -> can not + destLine += 'n'; + } else if (srcLine[srcIndex - 3] == 'w' && srcLine[srcIndex - 2] == 'o' && + (srcIndex == 3 || srcLine[srcIndex - 4])) { + // won't -> will not + destLine.deleteLastChar(); + destLine.deleteLastChar(); + destLine += "ill"; + } else if (srcLine[srcIndex - 3] == 'a' && srcLine[srcIndex - 2] == 'i' && + (srcIndex == 3 || srcLine[srcIndex - 4])) { + // ain't -> am not + destLine.deleteLastChar(); + destLine.deleteLastChar(); + destLine += "m"; + } else if (srcLine.hasSuffix(" sha") || + (srcIndex == 4 && srcLine.hasSuffix("sha"))) { + // shan't -> shall not + destLine.deleteLastChar(); + destLine += "ll"; + } + + destLine += " not"; + } + break; + + case 'v': + // 've ending + if (srcLine[startIndex + 2] == 'e') { + destLine += " have"; + srcIndex = startIndex; + } + break; + + default: + break; + } + // TODO return false; } diff --git a/engines/titanic/true_talk/tt_string.cpp b/engines/titanic/true_talk/tt_string.cpp index 5574cffb48..7a0078788d 100644 --- a/engines/titanic/true_talk/tt_string.cpp +++ b/engines/titanic/true_talk/tt_string.cpp @@ -95,34 +95,6 @@ TTstring &TTstring::operator+=(char c) { return *this; } -const char &TTstring::operator[](uint index) { - return *(c_str() + index); -} - -bool TTstring::empty() const { - return _data->_string.empty(); -} - -char TTstring::firstChar() const { - return _data->_string.firstChar(); -} - -char TTstring::lastChar() const { - return _data->_string.lastChar(); -} - -int TTstring::size() const { - return _data->_string.size(); -} - -TTstring *TTstring::copy() const { - return new TTstring(c_str()); -} - -bool TTstring::isValid() const { - return _status == SS_VALID; -} - void TTstring::save(SimpleFile *file) const { file->writeFormat("%s", c_str()); } diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index 3b2b6a2245..2009167b75 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -57,21 +57,51 @@ public: TTstring &operator+=(const char *str); TTstring &operator+=(const TTstring &str); TTstring &operator+=(char c); - const char &operator[](uint index); - bool empty() const; - char firstChar() const; - char lastChar() const; - int size() const; + + const char &operator[](uint index) { + return *(c_str() + index); + } + + bool empty() const { + return _data->_string.empty(); + } + + char firstChar() const { + return _data->_string.firstChar(); + } + + char lastChar() const { + return _data->_string.lastChar(); + } + + int size() const { + return _data->_string.size(); + } + + void deleteLastChar() { + _data->_string.deleteLastChar(); + } + + bool hasSuffix(const CString &str) const { + return _data->_string.hasSuffix(str); + } + bool hasSuffix(const char *str) const { + return _data->_string.hasSuffix(str); + } /** * Create a new copy of the string */ - TTstring *copy() const; + TTstring *copy() const { + return new TTstring(c_str()); + } /** * Returns true if the string is valid */ - bool isValid() const; + bool isValid() const { + return _status == SS_VALID; + } /** * Get the status of the string @@ -97,6 +127,13 @@ public: * Save the sring to a passed file */ void save(SimpleFile *file) const; + + /** + * Compare a substring within the string at the specified index + */ + bool compareAt(int index, const char *str) const { + return !strncmp(c_str() + index, str, strlen(str)); + } }; } // End of namespace Titanic -- cgit v1.2.3 From 76b61324de85c92302ed76b67a09c1c60c9b8470 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 14 May 2016 22:32:11 -0400 Subject: TITANIC: Renaming for normalized input line --- engines/titanic/true_talk/tt_input.cpp | 4 ++-- engines/titanic/true_talk/tt_input.h | 4 ++-- engines/titanic/true_talk/tt_parser.cpp | 13 ++++++++++++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/engines/titanic/true_talk/tt_input.cpp b/engines/titanic/true_talk/tt_input.cpp index 5d480425bd..102f86fc27 100644 --- a/engines/titanic/true_talk/tt_input.cpp +++ b/engines/titanic/true_talk/tt_input.cpp @@ -35,9 +35,9 @@ TTinputSubBase::TTinputSubBase() : _field0(0), _field4(0), _field8(0), TTinput::TTinput(int inputCtr, const TTstring &line, CScriptHandler *owner, TTroomScript *roomScript, TTnpcScript *npcScript) : _owner(owner), _field2C(1), _inputCtr(inputCtr), _field34(0), - _field38(0), _line(line), _field4C(0), _roomScript(roomScript), + _field38(0), _initialLine(line), _field4C(0), _roomScript(roomScript), _npcScript(npcScript), _field58(0), _field5C(0) { - _status = _line.isValid() && _string2.isValid() ? SS_11: SS_VALID; + _status = _initialLine.isValid() && _normalizedLine.isValid() ? SS_11: SS_VALID; } void TTinput::set38(int val) { diff --git a/engines/titanic/true_talk/tt_input.h b/engines/titanic/true_talk/tt_input.h index e4d91d7a58..e378e9b3ab 100644 --- a/engines/titanic/true_talk/tt_input.h +++ b/engines/titanic/true_talk/tt_input.h @@ -59,7 +59,6 @@ private: int _inputCtr; int _field34; int _field38; - TTstring _string2; int _field4C; TTroomScript *_roomScript; TTnpcScript *_npcScript; @@ -67,7 +66,8 @@ private: int _field5C; int _status; public: - TTstring _line; + TTstring _initialLine; + TTstring _normalizedLine; public: TTinput(int inputCtr, const TTstring &line, CScriptHandler *owner, TTroomScript *roomScript, TTnpcScript *npcScript); diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 5aa3576a0f..343d0aa7d1 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -37,7 +37,7 @@ int TTparser::processInput(TTinput *input) { int TTparser::normalize(TTinput *input) { TTstring *destLine = new TTstring(); - const TTstring &srcLine = input->_line; + const TTstring &srcLine = input->_initialLine; int srcSize = srcLine.size(); int savedIndex = 0; int counter1 = 0; @@ -136,6 +136,17 @@ int TTparser::normalize(TTinput *input) { } } + if (counter1 >= 4) + input->set38(4); + + // Remove any trailing spaces + while (destLine->hasSuffix(" ")) + destLine->deleteLastChar(); + + // Copy out the normalized line + input->_normalizedLine = *destLine; + delete destLine; + return 0; } -- cgit v1.2.3 From 2680caa5bde09e3ecc7a1c8ef6c345e2bc9a134b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 15 May 2016 18:43:33 -0400 Subject: DEVTOOLS: Creation of titanic.dat for holding static data --- devtools/create_titanic/create_titanic_dat.cpp | 205 +++++++ devtools/create_titanic/file.h | 213 +++++++ devtools/create_titanic/hash-str.h | 86 +++ devtools/create_titanic/hashmap.cpp | 109 ++++ devtools/create_titanic/hashmap.h | 637 ++++++++++++++++++++ devtools/create_titanic/module.mk | 15 + devtools/create_titanic/str.cpp | 786 +++++++++++++++++++++++++ devtools/create_titanic/str.h | 386 ++++++++++++ devtools/create_titanic/winexe.cpp | 83 +++ devtools/create_titanic/winexe.h | 70 +++ devtools/create_titanic/winexe_pe.cpp | 260 ++++++++ devtools/create_titanic/winexe_pe.h | 120 ++++ 12 files changed, 2970 insertions(+) create mode 100644 devtools/create_titanic/create_titanic_dat.cpp create mode 100644 devtools/create_titanic/file.h create mode 100644 devtools/create_titanic/hash-str.h create mode 100644 devtools/create_titanic/hashmap.cpp create mode 100644 devtools/create_titanic/hashmap.h create mode 100644 devtools/create_titanic/module.mk create mode 100644 devtools/create_titanic/str.cpp create mode 100644 devtools/create_titanic/str.h create mode 100644 devtools/create_titanic/winexe.cpp create mode 100644 devtools/create_titanic/winexe.h create mode 100644 devtools/create_titanic/winexe_pe.cpp create mode 100644 devtools/create_titanic/winexe_pe.h diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp new file mode 100644 index 0000000000..e41b125713 --- /dev/null +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -0,0 +1,205 @@ +/* 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. + * + */ + + // Disable symbol overrides so that we can use system headers. +#define FORBIDDEN_SYMBOL_ALLOW_ALL + +// HACK to allow building with the SDL backend on MinGW +// see bug #1800764 "TOOLS: MinGW tools building broken" +#ifdef main +#undef main +#endif // main + +#include +#include +#include +#include "common/language.h" +#include "common/rect.h" +#include "winexe_pe.h" +#include "file.h" + +/** + * Format of the access.dat file that will be created: + * 4 Bytes - Magic string 'SVTN' to identify valid data file + * 2 bytes - Version number + * + * Following is a series of index entries with the following fields: + * 4 bytes - offset in file of entry + * 4 bytes - size of entry in the file + * ASCIIZ - name of the resource + */ + +#define VERSION_NUMBER 1 + +Common::File inputFile, outputFile; +Common::PEResources res; +uint headerOffset = 6; +uint dataOffset = 0x200; +#define SEGMENT_OFFSET 0x401C00 + +void NORETURN_PRE error(const char *s, ...) { + printf("%s\n", s); + exit(1); +} + +void writeEntryHeader(const char *name, uint offset, uint size) { + assert(headerOffset < 0x200); + outputFile.seek(headerOffset); + outputFile.writeLong(offset); + outputFile.writeLong(size); + outputFile.writeString(name); + + headerOffset += 8 + strlen(name) + 1; +} + +void writeFinalEntryHeader() { + assert(headerOffset <= 0x1F8); + outputFile.seek(headerOffset); + outputFile.writeLong(0); + outputFile.writeLong(0); +} + +void writeStringArray(const char *name, uint offset, int count) { + outputFile.seek(dataOffset); + + inputFile.seek(offset); + uint *offsets = new uint[count]; + for (int idx = 0; idx < count; ++idx) + offsets[idx] = inputFile.readLong(); + + // Iterate through reading each string + for (int idx = 0; idx < count; ++idx) { + if (offsets[idx]) { + inputFile.seek(offsets[idx] - SEGMENT_OFFSET); + outputFile.writeString(inputFile); + } else { + outputFile.writeString(""); + } + } + + uint size = outputFile.size() - dataOffset; + writeEntryHeader(name, dataOffset, size); + dataOffset += size; + + delete[] offsets; +} + +Common::WinResourceID getResId(uint id) { + return Common::WinResourceID(id); +} + +Common::WinResourceID getResId(const char *id) { + if (!strcmp(id, "Bitmap")) + return Common::WinResourceID(2); + + return Common::WinResourceID(id); +} + +void writeResource(const char *name, Common::File *file) { + outputFile.seek(dataOffset); + outputFile.write(*file, file->size()); + + writeEntryHeader(name, dataOffset, file->size()); + dataOffset += file->size(); + delete file; +} + +void writeResource(const char *sectionStr, const uint32 resId) { + char nameBuffer[256]; + sprintf(nameBuffer, "%s/%d", sectionStr, resId); + + Common::File *file = res.getResource(getResId(sectionStr), resId); + assert(file); + writeResource(nameBuffer, file); +} + +void writeResource(const char *sectionStr, const char *resId) { + char nameBuffer[256]; + sprintf(nameBuffer, "%s/%s", sectionStr, resId); + + Common::File *file = res.getResource(getResId(sectionStr), + Common::WinResourceID(resId)); + assert(file); + writeResource(nameBuffer, file); +} + +void writeHeader() { + // Write out magic string + const char *MAGIC_STR = "SVTN"; + outputFile.write(MAGIC_STR, 4); + + // Write out version number + outputFile.writeWord(VERSION_NUMBER); +} + +void writeData() { + writeStringArray("TEXT/STRINGS1", 0x21B7C8, 376); + writeStringArray("TEXT/STRINGS2", 0x21BDB0, 218); + writeStringArray("TEXT/STRINGS3", 0x21C120, 1576); + writeStringArray("TEXT/STRINGS4", 0x21D9C8, 82); + + writeResource("Bitmap", "BACKDROP"); + writeResource("Bitmap", "EVILTWIN"); + writeResource("Bitmap", "RESTORED"); + writeResource("Bitmap", "RESTOREF"); + writeResource("Bitmap", "RESTOREU"); + writeResource("Bitmap", "STARTD"); + writeResource("Bitmap", "STARTF"); + writeResource("Bitmap", "STARTU"); + writeResource("Bitmap", "TITANIC"); + writeResource("Bitmap", 133); + writeResource("Bitmap", 164); + writeResource("Bitmap", 165); + + writeResource("STFONT", 149); + writeResource("STFONT", 151); + writeResource("STFONT", 152); + writeResource("STFONT", 153); + + writeResource("TEXT", "STVOCAB.TXT"); + writeResource("TEXT", "JRQUOTES.TXT"); + writeResource("TEXT", 155); +} + +int main(int argc, char *argv[]) { + if (argc != 3) { + printf("Format: %s ST.exe titanic.dat\n", argv[0]); + exit(0); + } + + if (!inputFile.open(argv[1])) { + error("Could not open input file"); + } + res.loadFromEXE(argv[1]); + + if (!outputFile.open(argv[2], Common::kFileWriteMode)) { + error("Could not open output file"); + } + + writeHeader(); + writeData(); + writeFinalEntryHeader(); + + inputFile.close(); + outputFile.close(); + return 0; +} diff --git a/devtools/create_titanic/file.h b/devtools/create_titanic/file.h new file mode 100644 index 0000000000..e8d49600e8 --- /dev/null +++ b/devtools/create_titanic/file.h @@ -0,0 +1,213 @@ +/* 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. + * + */ + +#ifndef __FILE_H__ +#define __FILE_H__ + +#include +#include + +#define FORBIDDEN_SYMBOL_ALLOW_ALL + +#include "common/scummsys.h" +#include "common/endian.h" +#include "common/algorithm.h" + +namespace Common { + +enum AccessMode { + kFileReadMode = 1, + kFileWriteMode = 2 +}; + +class File { +private: + ::FILE *_f; + const byte *_memPtr; + size_t _offset, _size; +public: + File() : _f(nullptr), _memPtr(nullptr), _offset(0), _size(0) {} + + bool open(const char *filename, AccessMode mode = kFileReadMode) { + _memPtr = nullptr; + _f = fopen(filename, (mode == kFileReadMode) ? "rb" : "wb+"); + return (_f != NULL); + } + bool open(const byte *data, uint size) { + close(); + _f = nullptr; + _memPtr = data; + _size = size; + return true; + } + + void close() { + if (_f) + fclose(_f); + _f = nullptr; + delete[] _memPtr; + _memPtr = nullptr; + } + int seek(int offset, int whence = SEEK_SET) { + if (_f) + return fseek(_f, offset, whence); + + switch (whence) { + case SEEK_SET: + _offset = offset; + break; + case SEEK_CUR: + _offset += offset; + break; + case SEEK_END: + _offset = _size + offset; + break; + default: + break; + } + + return _offset; + } + void skip(int offset) { + if (_f) + fseek(_f, offset, SEEK_CUR); + else + _offset += offset; + } + long read(void *buffer, size_t len) { + if (_f) + return fread(buffer, 1, len, _f); + + uint bytesToRead = CLIP(len, (size_t)0, _size - _offset); + memcpy(buffer, &_memPtr[_offset], bytesToRead); + _offset += bytesToRead; + return bytesToRead; + } + void write(const void *buffer, size_t len) { + assert(_f); + fwrite(buffer, 1, len, _f); + } + void write(File &src, size_t len) { + for (size_t idx = 0; idx < len; ++idx) + writeByte(src.readByte()); + } + byte readByte() { + byte v; + read(&v, sizeof(byte)); + return v; + } + uint16 readWord() { + uint16 v; + read(&v, sizeof(uint16)); + return FROM_LE_16(v); + } + uint readLong() { + uint v; + read(&v, sizeof(uint)); + return FROM_LE_32(v); + } + + uint readUint16BE() { + uint16 v; + read(&v, sizeof(uint16)); + return FROM_BE_16(v); + } + uint readUint16LE() { + uint16 v; + read(&v, sizeof(uint16)); + return FROM_LE_16(v); + } + uint readUint32BE() { + uint32 v; + read(&v, sizeof(uint32)); + return FROM_BE_32(v); + } + uint readUint32LE() { + uint32 v; + read(&v, sizeof(uint32)); + return FROM_LE_32(v); + } + + void writeByte(byte v) { + write(&v, sizeof(byte)); + } + void writeByte(byte v, int len) { + byte *b = new byte[len]; + memset(b, v, len); + write(b, len); + delete[] b; + } + void writeWord(uint16 v) { + uint16 vTemp = TO_LE_16(v); + write(&vTemp, sizeof(uint16)); + } + void writeLong(uint v) { + uint vTemp = TO_LE_32(v); + write(&vTemp, sizeof(uint)); + } + void writeString(const char *msg) { + if (!msg) { + writeByte(0); + } else { + do { + writeByte(*msg); + } while (*msg++); + } + } + void writeString(File &src) { + char c; + do { + c = src.readByte(); + writeByte(c); + } while (c); + } + uint pos() const { + if (_f) + return ftell(_f); + else + return _offset; + } + uint size() const { + if (_f) { + uint currentPos = pos(); + fseek(_f, 0, SEEK_END); + uint result = pos(); + fseek(_f, currentPos, SEEK_SET); + return result; + } else if (_memPtr) { + return _size; + } else { + return 0; + } + } + bool eof() const { + if (_f) + return feof(_f) != 0; + else if (_memPtr) + return _offset >= _size; + return false; + } +}; + +} + +#endif diff --git a/devtools/create_titanic/hash-str.h b/devtools/create_titanic/hash-str.h new file mode 100644 index 0000000000..b9f6d503f8 --- /dev/null +++ b/devtools/create_titanic/hash-str.h @@ -0,0 +1,86 @@ +/* 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. + * + */ + +#ifndef COMMON_HASH_STR_H +#define COMMON_HASH_STR_H + +#include "hashmap.h" +#include "str.h" + +namespace Common { + +uint hashit(const char *str); +uint hashit_lower(const char *str); // Generate a hash based on the lowercase version of the string +inline uint hashit(const String &str) { return hashit(str.c_str()); } +inline uint hashit_lower(const String &str) { return hashit_lower(str.c_str()); } + + +// FIXME: The following functors obviously are not consistently named + +struct CaseSensitiveString_EqualTo { + bool operator()(const String& x, const String& y) const { return x.equals(y); } +}; + +struct CaseSensitiveString_Hash { + uint operator()(const String& x) const { return hashit(x.c_str()); } +}; + + +struct IgnoreCase_EqualTo { + bool operator()(const String& x, const String& y) const { return x.equalsIgnoreCase(y); } +}; + +struct IgnoreCase_Hash { + uint operator()(const String& x) const { return hashit_lower(x.c_str()); } +}; + + + +// Specalization of the Hash functor for String objects. +// We do case sensitve hashing here, because that is what +// the default EqualTo is compatible with. If one wants to use +// case insensitve hashing, then only because one wants to use +// IgnoreCase_EqualTo, and then one has to specify a custom +// hash anyway. +template<> +struct Hash { + uint operator()(const String& s) const { + return hashit(s.c_str()); + } +}; + +template<> +struct Hash { + uint operator()(const char *s) const { + return hashit(s); + } +}; + +// String map -- by default case insensitive +typedef HashMap StringMap; + + + +} // End of namespace Common + + +#endif diff --git a/devtools/create_titanic/hashmap.cpp b/devtools/create_titanic/hashmap.cpp new file mode 100644 index 0000000000..99840993ce --- /dev/null +++ b/devtools/create_titanic/hashmap.cpp @@ -0,0 +1,109 @@ +/* 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. + * + */ + +// The hash map (associative array) implementation in this file is +// based on the PyDict implementation of CPython. The erase() method +// is based on example code in the Wikipedia article on Hash tables. + +#include "common/hashmap.h" + +namespace Common { + +// Hash function for strings, taken from CPython. +uint hashit(const char *p) { + uint hash = *p << 7; + byte c; + int size = 0; + while ((c = *p++)) { + hash = (1000003 * hash) ^ c; + size++; + } + return hash ^ size; +} + +// Like hashit, but converts every char to lowercase before hashing. +uint hashit_lower(const char *p) { + uint hash = tolower(*p) << 7; + byte c; + int size = 0; + while ((c = *p++)) { + hash = (1000003 * hash) ^ tolower(c); + size++; + } + return hash ^ size; +} + +#ifdef DEBUG_HASH_COLLISIONS +static double + g_collisions = 0, + g_dummyHits = 0, + g_lookups = 0, + g_collPerLook = 0, + g_capacity = 0, + g_size = 0; +static int g_max_capacity = 0, g_max_size = 0; +static int g_totalHashmaps = 0; +static int g_stats[4] = {0,0,0,0}; + +void updateHashCollisionStats(int collisions, int dummyHits, int lookups, int arrsize, int nele) { + g_collisions += collisions; + g_lookups += lookups; + g_dummyHits += dummyHits; + if (lookups) + g_collPerLook += (double)collisions / (double)lookups; + g_capacity += arrsize; + g_size += nele; + g_totalHashmaps++; + + if (3*nele <= 2*8) + g_stats[0]++; + if (3*nele <= 2*16) + g_stats[1]++; + if (3*nele <= 2*32) + g_stats[2]++; + if (3*nele <= 2*64) + g_stats[3]++; + + g_max_capacity = MAX(g_max_capacity, arrsize); + g_max_size = MAX(g_max_size, nele); + + debug("%d hashmaps: colls %.1f; dummies hit %.1f, lookups %.1f; ratio %.3f%%; size %f (max: %d); capacity %f (max: %d)", + g_totalHashmaps, + g_collisions / g_totalHashmaps, + g_dummyHits / g_totalHashmaps, + g_lookups / g_totalHashmaps, + 100 * g_collPerLook / g_totalHashmaps, + g_size / g_totalHashmaps, g_max_size, + g_capacity / g_totalHashmaps, g_max_capacity); + debug(" %d less than %d; %d less than %d; %d less than %d; %d less than %d", + g_stats[0], 2*8/3, + g_stats[1],2*16/3, + g_stats[2],2*32/3, + g_stats[3],2*64/3); + + // TODO: + // * Should record the maximal size of the map during its lifetime, not that at its death + // * Should do some statistics: how many maps are less than 2/3*8, 2/3*16, 2/3*32, ... +} +#endif + +} // End of namespace Common diff --git a/devtools/create_titanic/hashmap.h b/devtools/create_titanic/hashmap.h new file mode 100644 index 0000000000..d7ba100571 --- /dev/null +++ b/devtools/create_titanic/hashmap.h @@ -0,0 +1,637 @@ +/* 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. + * + */ + +// The hash map (associative array) implementation in this file is +// based on the PyDict implementation of CPython. + +#ifndef COMMON_HASHMAP_H +#define COMMON_HASHMAP_H + +/** + * @def DEBUG_HASH_COLLISIONS + * Enable the following #define if you want to check how many collisions the + * code produces (many collisions indicate either a bad hash function, or a + * hash table that is too small). + */ +//#define DEBUG_HASH_COLLISIONS + +/** + * @def USE_HASHMAP_MEMORY_POOL + * Enable the following define to let HashMaps use a memory pool for the + nodes they contain. * This increases memory usage, but also can improve + speed quite a bit. + */ +#define USE_HASHMAP_MEMORY_POOL + + +#include "common/func.h" + +#ifdef DEBUG_HASH_COLLISIONS +#include "common/debug.h" +#endif + +#ifdef USE_HASHMAP_MEMORY_POOL +#include "common/memorypool.h" +#endif + + + +namespace Common { + +// The sgi IRIX MIPSpro Compiler has difficulties with nested templates. +// This and the other __sgi conditionals below work around these problems. +// The Intel C++ Compiler suffers from the same problems. +#if (defined(__sgi) && !defined(__GNUC__)) || defined(__INTEL_COMPILER) +template class IteratorImpl; +#endif + + +/** + * HashMap maps objects of type Key to objects of type Val. + * For each used Key type, we need an "size_type hashit(Key,size_type)" function + * that computes a hash for the given Key object and returns it as an + * an integer from 0 to hashsize-1, and also an "equality functor". + * that returns true if if its two arguments are to be considered + * equal. Also, we assume that "=" works on Val objects for assignment. + * + * If aa is an HashMap, then space is allocated each time aa[key] is + * referenced, for a new key. If the object is const, then an assertion is + * triggered instead. Hence if you are not sure whether a key is contained in + * the map, use contains() first to check for its presence. + */ +template, class EqualFunc = EqualTo > +class HashMap { +public: + typedef uint size_type; + +private: + + typedef HashMap HM_t; + + struct Node { + const Key _key; + Val _value; + explicit Node(const Key &key) : _key(key), _value() {} + Node() : _key(), _value() {} + }; + + enum { + HASHMAP_PERTURB_SHIFT = 5, + HASHMAP_MIN_CAPACITY = 16, + + // The quotient of the next two constants controls how much the + // internal storage of the hashmap may fill up before being + // increased automatically. + // Note: the quotient of these two must be between and different + // from 0 and 1. + HASHMAP_LOADFACTOR_NUMERATOR = 2, + HASHMAP_LOADFACTOR_DENOMINATOR = 3, + + HASHMAP_MEMORYPOOL_SIZE = HASHMAP_MIN_CAPACITY * HASHMAP_LOADFACTOR_NUMERATOR / HASHMAP_LOADFACTOR_DENOMINATOR + }; + +#ifdef USE_HASHMAP_MEMORY_POOL + ObjectPool _nodePool; +#endif + + Node **_storage; ///< hashtable of size arrsize. + size_type _mask; ///< Capacity of the HashMap minus one; must be a power of two of minus one + size_type _size; + size_type _deleted; ///< Number of deleted elements (_dummyNodes) + + HashFunc _hash; + EqualFunc _equal; + + /** Default value, returned by the const getVal. */ + const Val _defaultVal; + + /** Dummy node, used as marker for erased objects. */ + #define HASHMAP_DUMMY_NODE ((Node *)1) + +#ifdef DEBUG_HASH_COLLISIONS + mutable int _collisions, _lookups, _dummyHits; +#endif + + Node *allocNode(const Key &key) { +#ifdef USE_HASHMAP_MEMORY_POOL + return new (_nodePool) Node(key); +#else + return new Node(key); +#endif + } + + void freeNode(Node *node) { + if (node && node != HASHMAP_DUMMY_NODE) +#ifdef USE_HASHMAP_MEMORY_POOL + _nodePool.deleteChunk(node); +#else + delete node; +#endif + } + + void assign(const HM_t &map); + size_type lookup(const Key &key) const; + size_type lookupAndCreateIfMissing(const Key &key); + void expandStorage(size_type newCapacity); + +#if !defined(__sgi) || defined(__GNUC__) + template friend class IteratorImpl; +#endif + + /** + * Simple HashMap iterator implementation. + */ + template + class IteratorImpl { + friend class HashMap; +#if (defined(__sgi) && !defined(__GNUC__)) || defined(__INTEL_COMPILER) + template friend class Common::IteratorImpl; +#else + template friend class IteratorImpl; +#endif + protected: + typedef const HashMap hashmap_t; + + size_type _idx; + hashmap_t *_hashmap; + + protected: + IteratorImpl(size_type idx, hashmap_t *hashmap) : _idx(idx), _hashmap(hashmap) {} + + NodeType *deref() const { + assert(_hashmap != 0); + assert(_idx <= _hashmap->_mask); + Node *node = _hashmap->_storage[_idx]; + assert(node != 0); + assert(node != HASHMAP_DUMMY_NODE); + return node; + } + + public: + IteratorImpl() : _idx(0), _hashmap(0) {} + template + IteratorImpl(const IteratorImpl &c) : _idx(c._idx), _hashmap(c._hashmap) {} + + NodeType &operator*() const { return *deref(); } + NodeType *operator->() const { return deref(); } + + bool operator==(const IteratorImpl &iter) const { return _idx == iter._idx && _hashmap == iter._hashmap; } + bool operator!=(const IteratorImpl &iter) const { return !(*this == iter); } + + IteratorImpl &operator++() { + assert(_hashmap); + do { + _idx++; + } while (_idx <= _hashmap->_mask && (_hashmap->_storage[_idx] == 0 || _hashmap->_storage[_idx] == HASHMAP_DUMMY_NODE)); + if (_idx > _hashmap->_mask) + _idx = (size_type)-1; + + return *this; + } + + IteratorImpl operator++(int) { + IteratorImpl old = *this; + operator ++(); + return old; + } + }; + +public: + typedef IteratorImpl iterator; + typedef IteratorImpl const_iterator; + + HashMap(); + HashMap(const HM_t &map); + ~HashMap(); + + HM_t &operator=(const HM_t &map) { + if (this == &map) + return *this; + + // Remove the previous content and ... + clear(); + delete[] _storage; + // ... copy the new stuff. + assign(map); + return *this; + } + + bool contains(const Key &key) const; + + Val &operator[](const Key &key); + const Val &operator[](const Key &key) const; + + Val &getVal(const Key &key); + const Val &getVal(const Key &key) const; + const Val &getVal(const Key &key, const Val &defaultVal) const; + void setVal(const Key &key, const Val &val); + + void clear(bool shrinkArray = 0); + + void erase(iterator entry); + void erase(const Key &key); + + size_type size() const { return _size; } + + iterator begin() { + // Find and return the first non-empty entry + for (size_type ctr = 0; ctr <= _mask; ++ctr) { + if (_storage[ctr] && _storage[ctr] != HASHMAP_DUMMY_NODE) + return iterator(ctr, this); + } + return end(); + } + iterator end() { + return iterator((size_type)-1, this); + } + + const_iterator begin() const { + // Find and return the first non-empty entry + for (size_type ctr = 0; ctr <= _mask; ++ctr) { + if (_storage[ctr] && _storage[ctr] != HASHMAP_DUMMY_NODE) + return const_iterator(ctr, this); + } + return end(); + } + const_iterator end() const { + return const_iterator((size_type)-1, this); + } + + iterator find(const Key &key) { + size_type ctr = lookup(key); + if (_storage[ctr]) + return iterator(ctr, this); + return end(); + } + + const_iterator find(const Key &key) const { + size_type ctr = lookup(key); + if (_storage[ctr]) + return const_iterator(ctr, this); + return end(); + } + + // TODO: insert() method? + + bool empty() const { + return (_size == 0); + } +}; + +//------------------------------------------------------- +// HashMap functions + +/** + * Base constructor, creates an empty hashmap. + */ +template +HashMap::HashMap() +// +// We have to skip _defaultVal() on PS2 to avoid gcc 3.2.2 ICE +// +#ifdef __PLAYSTATION2__ + { +#else + : _defaultVal() { +#endif + _mask = HASHMAP_MIN_CAPACITY - 1; + _storage = new Node *[HASHMAP_MIN_CAPACITY]; + assert(_storage != NULL); + memset(_storage, 0, HASHMAP_MIN_CAPACITY * sizeof(Node *)); + + _size = 0; + _deleted = 0; + +#ifdef DEBUG_HASH_COLLISIONS + _collisions = 0; + _lookups = 0; + _dummyHits = 0; +#endif +} + +/** + * Copy constructor, creates a full copy of the given hashmap. + * We must provide a custom copy constructor as we use pointers + * to heap buffers for the internal storage. + */ +template +HashMap::HashMap(const HM_t &map) : + _defaultVal() { +#ifdef DEBUG_HASH_COLLISIONS + _collisions = 0; + _lookups = 0; + _dummyHits = 0; +#endif + assign(map); +} + +/** + * Destructor, frees all used memory. + */ +template +HashMap::~HashMap() { + for (size_type ctr = 0; ctr <= _mask; ++ctr) + freeNode(_storage[ctr]); + + delete[] _storage; +#ifdef DEBUG_HASH_COLLISIONS + extern void updateHashCollisionStats(int, int, int, int, int); + updateHashCollisionStats(_collisions, _dummyHits, _lookups, _mask+1, _size); +#endif +} + +/** + * Internal method for assigning the content of another HashMap + * to this one. + * + * @note We do *not* deallocate the previous storage here -- the caller is + * responsible for doing that! + */ +template +void HashMap::assign(const HM_t &map) { + _mask = map._mask; + _storage = new Node *[_mask+1]; + assert(_storage != NULL); + memset(_storage, 0, (_mask+1) * sizeof(Node *)); + + // Simply clone the map given to us, one by one. + _size = 0; + _deleted = 0; + for (size_type ctr = 0; ctr <= _mask; ++ctr) { + if (map._storage[ctr] == HASHMAP_DUMMY_NODE) { + _storage[ctr] = HASHMAP_DUMMY_NODE; + _deleted++; + } else if (map._storage[ctr] != NULL) { + _storage[ctr] = allocNode(map._storage[ctr]->_key); + _storage[ctr]->_value = map._storage[ctr]->_value; + _size++; + } + } + // Perform a sanity check (to help track down hashmap corruption) + assert(_size == map._size); + assert(_deleted == map._deleted); +} + + +template +void HashMap::clear(bool shrinkArray) { + for (size_type ctr = 0; ctr <= _mask; ++ctr) { + freeNode(_storage[ctr]); + _storage[ctr] = NULL; + } + +#ifdef USE_HASHMAP_MEMORY_POOL + _nodePool.freeUnusedPages(); +#endif + + if (shrinkArray && _mask >= HASHMAP_MIN_CAPACITY) { + delete[] _storage; + + _mask = HASHMAP_MIN_CAPACITY; + _storage = new Node *[HASHMAP_MIN_CAPACITY]; + assert(_storage != NULL); + memset(_storage, 0, HASHMAP_MIN_CAPACITY * sizeof(Node *)); + } + + _size = 0; + _deleted = 0; +} + +template +void HashMap::expandStorage(size_type newCapacity) { + assert(newCapacity > _mask+1); + +#ifndef NDEBUG + const size_type old_size = _size; +#endif + const size_type old_mask = _mask; + Node **old_storage = _storage; + + // allocate a new array + _size = 0; + _deleted = 0; + _mask = newCapacity - 1; + _storage = new Node *[newCapacity]; + assert(_storage != NULL); + memset(_storage, 0, newCapacity * sizeof(Node *)); + + // rehash all the old elements + for (size_type ctr = 0; ctr <= old_mask; ++ctr) { + if (old_storage[ctr] == NULL || old_storage[ctr] == HASHMAP_DUMMY_NODE) + continue; + + // Insert the element from the old table into the new table. + // Since we know that no key exists twice in the old table, we + // can do this slightly better than by calling lookup, since we + // don't have to call _equal(). + const size_type hash = _hash(old_storage[ctr]->_key); + size_type idx = hash & _mask; + for (size_type perturb = hash; _storage[idx] != NULL && _storage[idx] != HASHMAP_DUMMY_NODE; perturb >>= HASHMAP_PERTURB_SHIFT) { + idx = (5 * idx + perturb + 1) & _mask; + } + + _storage[idx] = old_storage[ctr]; + _size++; + } + + // Perform a sanity check: Old number of elements should match the new one! + // This check will fail if some previous operation corrupted this hashmap. + assert(_size == old_size); + + delete[] old_storage; + + return; +} + +template +typename HashMap::size_type HashMap::lookup(const Key &key) const { + const size_type hash = _hash(key); + size_type ctr = hash & _mask; + for (size_type perturb = hash; ; perturb >>= HASHMAP_PERTURB_SHIFT) { + if (_storage[ctr] == NULL) + break; + if (_storage[ctr] == HASHMAP_DUMMY_NODE) { +#ifdef DEBUG_HASH_COLLISIONS + _dummyHits++; +#endif + } else if (_equal(_storage[ctr]->_key, key)) + break; + + ctr = (5 * ctr + perturb + 1) & _mask; + +#ifdef DEBUG_HASH_COLLISIONS + _collisions++; +#endif + } + +#ifdef DEBUG_HASH_COLLISIONS + _lookups++; + debug("collisions %d, dummies hit %d, lookups %d, ratio %f in HashMap %p; size %d num elements %d", + _collisions, _dummyHits, _lookups, ((double) _collisions / (double)_lookups), + (const void *)this, _mask+1, _size); +#endif + + return ctr; +} + +template +typename HashMap::size_type HashMap::lookupAndCreateIfMissing(const Key &key) { + const size_type hash = _hash(key); + size_type ctr = hash & _mask; + const size_type NONE_FOUND = _mask + 1; + size_type first_free = NONE_FOUND; + bool found = false; + for (size_type perturb = hash; ; perturb >>= HASHMAP_PERTURB_SHIFT) { + if (_storage[ctr] == NULL) + break; + if (_storage[ctr] == HASHMAP_DUMMY_NODE) { +#ifdef DEBUG_HASH_COLLISIONS + _dummyHits++; +#endif + if (first_free != _mask + 1) + first_free = ctr; + } else if (_equal(_storage[ctr]->_key, key)) { + found = true; + break; + } + + ctr = (5 * ctr + perturb + 1) & _mask; + +#ifdef DEBUG_HASH_COLLISIONS + _collisions++; +#endif + } + +#ifdef DEBUG_HASH_COLLISIONS + _lookups++; + debug("collisions %d, dummies hit %d, lookups %d, ratio %f in HashMap %p; size %d num elements %d", + _collisions, _dummyHits, _lookups, ((double) _collisions / (double)_lookups), + (const void *)this, _mask+1, _size); +#endif + + if (!found && first_free != _mask + 1) + ctr = first_free; + + if (!found) { + if (_storage[ctr]) + _deleted--; + _storage[ctr] = allocNode(key); + assert(_storage[ctr] != NULL); + _size++; + + // Keep the load factor below a certain threshold. + // Deleted nodes are also counted + size_type capacity = _mask + 1; + if ((_size + _deleted) * HASHMAP_LOADFACTOR_DENOMINATOR > + capacity * HASHMAP_LOADFACTOR_NUMERATOR) { + capacity = capacity < 500 ? (capacity * 4) : (capacity * 2); + expandStorage(capacity); + ctr = lookup(key); + assert(_storage[ctr] != NULL); + } + } + + return ctr; +} + + +template +bool HashMap::contains(const Key &key) const { + size_type ctr = lookup(key); + return (_storage[ctr] != NULL); +} + +template +Val &HashMap::operator[](const Key &key) { + return getVal(key); +} + +template +const Val &HashMap::operator[](const Key &key) const { + return getVal(key); +} + +template +Val &HashMap::getVal(const Key &key) { + size_type ctr = lookupAndCreateIfMissing(key); + assert(_storage[ctr] != NULL); + return _storage[ctr]->_value; +} + +template +const Val &HashMap::getVal(const Key &key) const { + return getVal(key, _defaultVal); +} + +template +const Val &HashMap::getVal(const Key &key, const Val &defaultVal) const { + size_type ctr = lookup(key); + if (_storage[ctr] != NULL) + return _storage[ctr]->_value; + else + return defaultVal; +} + +template +void HashMap::setVal(const Key &key, const Val &val) { + size_type ctr = lookupAndCreateIfMissing(key); + assert(_storage[ctr] != NULL); + _storage[ctr]->_value = val; +} + +template +void HashMap::erase(iterator entry) { + // Check whether we have a valid iterator + assert(entry._hashmap == this); + const size_type ctr = entry._idx; + assert(ctr <= _mask); + Node * const node = _storage[ctr]; + assert(node != NULL); + assert(node != HASHMAP_DUMMY_NODE); + + // If we remove a key, we replace it with a dummy node. + freeNode(node); + _storage[ctr] = HASHMAP_DUMMY_NODE; + _size--; + _deleted++; +} + +template +void HashMap::erase(const Key &key) { + + size_type ctr = lookup(key); + if (_storage[ctr] == NULL) + return; + + // If we remove a key, we replace it with a dummy node. + freeNode(_storage[ctr]); + _storage[ctr] = HASHMAP_DUMMY_NODE; + _size--; + _deleted++; + return; +} + +#undef HASHMAP_DUMMY_NODE + +} // End of namespace Common + +#endif diff --git a/devtools/create_titanic/module.mk b/devtools/create_titanic/module.mk new file mode 100644 index 0000000000..05a4130dad --- /dev/null +++ b/devtools/create_titanic/module.mk @@ -0,0 +1,15 @@ + +MODULE := devtools/create_titanic + +MODULE_OBJS := \ + create_titanic_dat.o \ + hashmap.o \ + str.o \ + winexe.o \ + winexe_pe.o + +# Set the name of the executable +TOOL_EXECUTABLE := create_titanic + +# Include common rules +include $(srcdir)/rules.mk diff --git a/devtools/create_titanic/str.cpp b/devtools/create_titanic/str.cpp new file mode 100644 index 0000000000..14a6e505ce --- /dev/null +++ b/devtools/create_titanic/str.cpp @@ -0,0 +1,786 @@ +/* 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/hash-str.h" +#include "common/list.h" +#include "common/memorypool.h" +#include "common/str.h" +#include "common/util.h" + +namespace Common { + +MemoryPool *g_refCountPool = 0; // FIXME: This is never freed right now + +static uint32 computeCapacity(uint32 len) { + // By default, for the capacity we use the next multiple of 32 + return ((len + 32 - 1) & ~0x1F); +} + +String::String(const char *str) : _size(0), _str(_storage) { + if (str == 0) { + _storage[0] = 0; + _size = 0; + } else + initWithCStr(str, strlen(str)); +} + +String::String(const char *str, uint32 len) : _size(0), _str(_storage) { + initWithCStr(str, len); +} + +String::String(const char *beginP, const char *endP) : _size(0), _str(_storage) { + assert(endP >= beginP); + initWithCStr(beginP, endP - beginP); +} + +void String::initWithCStr(const char *str, uint32 len) { + assert(str); + + // Init _storage member explicitly (ie. without calling its constructor) + // for GCC 2.95.x compatibility (see also tracker item #1602879). + _storage[0] = 0; + + _size = len; + + if (len >= _builtinCapacity) { + // Not enough internal storage, so allocate more + _extern._capacity = computeCapacity(len+1); + _extern._refCount = 0; + _str = new char[_extern._capacity]; + assert(_str != 0); + } + + // Copy the string into the storage area + memmove(_str, str, len); + _str[len] = 0; +} + +String::String(const String &str) + : _size(str._size) { + if (str.isStorageIntern()) { + // String in internal storage: just copy it + memcpy(_storage, str._storage, _builtinCapacity); + _str = _storage; + } else { + // String in external storage: use refcount mechanism + str.incRefCount(); + _extern._refCount = str._extern._refCount; + _extern._capacity = str._extern._capacity; + _str = str._str; + } + assert(_str != 0); +} + +String::String(char c) + : _size(0), _str(_storage) { + + _storage[0] = c; + _storage[1] = 0; + + _size = (c == 0) ? 0 : 1; +} + +String::~String() { + decRefCount(_extern._refCount); +} + +void String::makeUnique() { + ensureCapacity(_size, true); +} + +/** + * Ensure that enough storage is available to store at least new_size + * characters plus a null byte. In addition, if we currently share + * the storage with another string, unshare it, so that we can safely + * write to the storage. + */ +void String::ensureCapacity(uint32 new_size, bool keep_old) { + bool isShared; + uint32 curCapacity, newCapacity; + char *newStorage; + int *oldRefCount = _extern._refCount; + + if (isStorageIntern()) { + isShared = false; + curCapacity = _builtinCapacity; + } else { + isShared = (oldRefCount && *oldRefCount > 1); + curCapacity = _extern._capacity; + } + + // Special case: If there is enough space, and we do not share + // the storage, then there is nothing to do. + if (!isShared && new_size < curCapacity) + return; + + if (isShared && new_size < _builtinCapacity) { + // We share the storage, but there is enough internal storage: Use that. + newStorage = _storage; + newCapacity = _builtinCapacity; + } else { + // We need to allocate storage on the heap! + + // Compute a suitable new capacity limit + // If the current capacity is sufficient we use the same capacity + if (new_size < curCapacity) + newCapacity = curCapacity; + else + newCapacity = MAX(curCapacity * 2, computeCapacity(new_size+1)); + + // Allocate new storage + newStorage = new char[newCapacity]; + assert(newStorage); + } + + // Copy old data if needed, elsewise reset the new storage. + if (keep_old) { + assert(_size < newCapacity); + memcpy(newStorage, _str, _size + 1); + } else { + _size = 0; + newStorage[0] = 0; + } + + // Release hold on the old storage ... + decRefCount(oldRefCount); + + // ... in favor of the new storage + _str = newStorage; + + if (!isStorageIntern()) { + // Set the ref count & capacity if we use an external storage. + // It is important to do this *after* copying any old content, + // else we would override data that has not yet been copied! + _extern._refCount = 0; + _extern._capacity = newCapacity; + } +} + +void String::incRefCount() const { + assert(!isStorageIntern()); + if (_extern._refCount == 0) { + if (g_refCountPool == 0) { + g_refCountPool = new MemoryPool(sizeof(int)); + assert(g_refCountPool); + } + + _extern._refCount = (int *)g_refCountPool->allocChunk(); + *_extern._refCount = 2; + } else { + ++(*_extern._refCount); + } +} + +void String::decRefCount(int *oldRefCount) { + if (isStorageIntern()) + return; + + if (oldRefCount) { + --(*oldRefCount); + } + if (!oldRefCount || *oldRefCount <= 0) { + // The ref count reached zero, so we free the string storage + // and the ref count storage. + if (oldRefCount) { + assert(g_refCountPool); + g_refCountPool->freeChunk(oldRefCount); + } + delete[] _str; + + // Even though _str points to a freed memory block now, + // we do not change its value, because any code that calls + // decRefCount will have to do this afterwards anyway. + } +} + +String &String::operator=(const char *str) { + uint32 len = strlen(str); + ensureCapacity(len, false); + _size = len; + memmove(_str, str, len + 1); + return *this; +} + +String &String::operator=(const String &str) { + if (&str == this) + return *this; + + if (str.isStorageIntern()) { + decRefCount(_extern._refCount); + _size = str._size; + _str = _storage; + memcpy(_str, str._str, _size + 1); + } else { + str.incRefCount(); + decRefCount(_extern._refCount); + + _extern._refCount = str._extern._refCount; + _extern._capacity = str._extern._capacity; + _size = str._size; + _str = str._str; + } + + return *this; +} + +String &String::operator=(char c) { + decRefCount(_extern._refCount); + _str = _storage; + + _str[0] = c; + _str[1] = 0; + + _size = (c == 0) ? 0 : 1; + return *this; +} + +String &String::operator+=(const char *str) { + if (_str <= str && str <= _str + _size) + return operator+=(String(str)); + + int len = strlen(str); + if (len > 0) { + ensureCapacity(_size + len, true); + + memcpy(_str + _size, str, len + 1); + _size += len; + } + return *this; +} + +String &String::operator+=(const String &str) { + if (&str == this) + return operator+=(String(str)); + + int len = str._size; + if (len > 0) { + ensureCapacity(_size + len, true); + + memcpy(_str + _size, str._str, len + 1); + _size += len; + } + return *this; +} + +String &String::operator+=(char c) { + ensureCapacity(_size + 1, true); + + _str[_size++] = c; + _str[_size] = 0; + + return *this; +} + +bool String::hasPrefix(const String &x) const { + return hasPrefix(x.c_str()); +} + +bool String::hasPrefix(const char *x) const { + assert(x != 0); + // Compare x with the start of _str. + const char *y = c_str(); + while (*x && *x == *y) { + ++x; + ++y; + } + // It's a prefix, if and only if all letters in x are 'used up' before + // _str ends. + return *x == 0; +} + +bool String::hasSuffix(const String &x) const { + return hasSuffix(x.c_str()); +} + +bool String::hasSuffix(const char *x) const { + assert(x != 0); + // Compare x with the end of _str. + const uint32 x_size = strlen(x); + if (x_size > _size) + return false; + const char *y = c_str() + _size - x_size; + while (*x && *x == *y) { + ++x; + ++y; + } + // It's a suffix, if and only if all letters in x are 'used up' before + // _str ends. + return *x == 0; +} + +bool String::contains(const String &x) const { + return strstr(c_str(), x.c_str()) != NULL; +} + +bool String::contains(const char *x) const { + assert(x != 0); + return strstr(c_str(), x) != NULL; +} + +bool String::contains(char x) const { + return strchr(c_str(), x) != NULL; +} + +void String::deleteLastChar() { + if (_size > 0) + deleteChar(_size - 1); +} + +void String::deleteChar(uint32 p) { + assert(p < _size); + + makeUnique(); + while (p++ < _size) + _str[p - 1] = _str[p]; + _size--; +} + +void String::erase(uint32 p, uint32 len) { + assert(p < _size); + + makeUnique(); + // If len == npos or p + len is over the end, remove all the way to the end + if (len == npos || p + len >= _size) { + // Delete char at p as well. So _size = (p - 1) + 1 + _size = p; + // Null terminate + _str[_size] = 0; + return; + } + + for ( ; p + len <= _size; p++) { + _str[p] = _str[p + len]; + } + _size -= len; +} + +void String::clear() { + decRefCount(_extern._refCount); + + _size = 0; + _str = _storage; + _storage[0] = 0; +} + +void String::setChar(char c, uint32 p) { + assert(p < _size); + + makeUnique(); + _str[p] = c; +} + +void String::insertChar(char c, uint32 p) { + assert(p <= _size); + + ensureCapacity(_size + 1, true); + _size++; + for (uint32 i = _size; i > p; --i) + _str[i] = _str[i - 1]; + _str[p] = c; +} + +void String::toLowercase() { + makeUnique(); + for (uint32 i = 0; i < _size; ++i) + _str[i] = tolower(_str[i]); +} + +void String::toUppercase() { + makeUnique(); + for (uint32 i = 0; i < _size; ++i) + _str[i] = toupper(_str[i]); +} + +uint String::hash() const { + return hashit(c_str()); +} + +// static +String String::format(const char *fmt, ...) { + String output; + + va_list va; + va_start(va, fmt); + output = String::vformat(fmt, va); + va_end(va); + + return output; +} + +// static +String String::vformat(const char *fmt, va_list args) { + String output; + assert(output.isStorageIntern()); + + va_list va; + scumm_va_copy(va, args); + int len = vsnprintf(output._str, _builtinCapacity, fmt, va); + va_end(va); + + if (len == -1 || len == _builtinCapacity - 1) { + // MSVC and IRIX don't return the size the full string would take up. + // MSVC returns -1, IRIX returns the number of characters actually written, + // which is at the most the size of the buffer minus one, as the string is + // truncated to fit. + + // We assume MSVC failed to output the correct, null-terminated string + // if the return value is either -1 or size. + // For IRIX, because we lack a better mechanism, we assume failure + // if the return value equals size - 1. + // The downside to this is that whenever we try to format a string where the + // size is 1 below the built-in capacity, the size is needlessly increased. + + // Try increasing the size of the string until it fits. + int size = _builtinCapacity; + do { + size *= 2; + output.ensureCapacity(size - 1, false); + assert(!output.isStorageIntern()); + size = output._extern._capacity; + + scumm_va_copy(va, args); + len = vsnprintf(output._str, size, fmt, va); + va_end(va); + } while (len == -1 || len >= size - 1); + output._size = len; + } else if (len < (int)_builtinCapacity) { + // vsnprintf succeeded + output._size = len; + } else { + // vsnprintf didn't have enough space, so grow buffer + output.ensureCapacity(len, false); + scumm_va_copy(va, args); + int len2 = vsnprintf(output._str, len+1, fmt, va); + va_end(va); + assert(len == len2); + output._size = len2; + } + + return output; +} + + +#pragma mark - + +bool String::operator==(const String &x) const { + return equals(x); +} + +bool String::operator==(const char *x) const { + assert(x != 0); + return equals(x); +} + +bool String::operator!=(const String &x) const { + return !equals(x); +} + +bool String::operator !=(const char *x) const { + assert(x != 0); + return !equals(x); +} + +bool String::operator<(const String &x) const { + return compareTo(x) < 0; +} + +bool String::operator<=(const String &x) const { + return compareTo(x) <= 0; +} + +bool String::operator>(const String &x) const { + return compareTo(x) > 0; +} + +bool String::operator>=(const String &x) const { + return compareTo(x) >= 0; +} + +#pragma mark - + +bool operator==(const char* y, const String &x) { + return (x == y); +} + +bool operator!=(const char* y, const String &x) { + return x != y; +} + +#pragma mark - + +bool String::equals(const String &x) const { + return (0 == compareTo(x)); +} + +bool String::equals(const char *x) const { + assert(x != 0); + return (0 == compareTo(x)); +} + +bool String::equalsIgnoreCase(const String &x) const { + return (0 == compareToIgnoreCase(x)); +} + +bool String::equalsIgnoreCase(const char *x) const { + assert(x != 0); + return (0 == compareToIgnoreCase(x)); +} + +int String::compareTo(const String &x) const { + return compareTo(x.c_str()); +} + +int String::compareTo(const char *x) const { + assert(x != 0); + return strcmp(c_str(), x); +} + +int String::compareToIgnoreCase(const String &x) const { + return compareToIgnoreCase(x.c_str()); +} + +int String::compareToIgnoreCase(const char *x) const { + assert(x != 0); + return scumm_stricmp(c_str(), x); +} + +#pragma mark - + +String operator+(const String &x, const String &y) { + String temp(x); + temp += y; + return temp; +} + +String operator+(const char *x, const String &y) { + String temp(x); + temp += y; + return temp; +} + +String operator+(const String &x, const char *y) { + String temp(x); + temp += y; + return temp; +} + +String operator+(char x, const String &y) { + String temp(x); + temp += y; + return temp; +} + +String operator+(const String &x, char y) { + String temp(x); + temp += y; + return temp; +} + +String lastPathComponent(const String &path, const char sep) { + const char *str = path.c_str(); + const char *last = str + path.size(); + + // Skip over trailing slashes + while (last > str && *(last-1) == sep) + --last; + + // Path consisted of only slashes -> return empty string + if (last == str) + return String(); + + // Now scan the whole component + const char *first = last - 1; + while (first > str && *first != sep) + --first; + + if (*first == sep) + first++; + + return String(first, last); +} + +String normalizePath(const String &path, const char sep) { + if (path.empty()) + return path; + + const char *cur = path.c_str(); + String result; + + // If there is a leading slash, preserve that: + if (*cur == sep) { + result += sep; + // Skip over multiple leading slashes, so "//" equals "/" + while (*cur == sep) + ++cur; + } + + // Scan for path components till the end of the String + List comps; + while (*cur != 0) { + const char *start = cur; + + // Scan till the next path separator resp. the end of the string + while (*cur != sep && *cur != 0) + cur++; + + const String component(start, cur); + + if (component.empty() || component == ".") { + // Skip empty components and dot components + } else if (!comps.empty() && component == ".." && comps.back() != "..") { + // If stack is non-empty and top is not "..", remove top + comps.pop_back(); + } else { + // Add the component to the stack + comps.push_back(component); + } + + // Skip over separator chars + while (*cur == sep) + cur++; + } + + // Finally, assemble all components back into a path + while (!comps.empty()) { + result += comps.front(); + comps.pop_front(); + if (!comps.empty()) + result += sep; + } + + return result; +} + +size_t strlcpy(char *dst, const char *src, size_t size) { + // Our backup of the source's start, we need this + // to calculate the source's length. + const char * const srcStart = src; + + // In case a non-empty size was specified we + // copy over (size - 1) bytes at max. + if (size != 0) { + // Copy over (size - 1) bytes at max. + while (--size != 0) { + if ((*dst++ = *src) == 0) + break; + ++src; + } + + // In case the source string was longer than the + // destination, we need to add a terminating + // zero. + if (size == 0) + *dst = 0; + } + + // Move to the terminating zero of the source + // string, we need this to determine the length + // of the source string. + while (*src) + ++src; + + // Return the source string's length. + return src - srcStart; +} + +size_t strlcat(char *dst, const char *src, size_t size) { + // In case the destination buffer does not contain + // space for at least 1 character, we will just + // return the source string's length. + if (size == 0) + return strlen(src); + + // Our backup of the source's start, we need this + // to calculate the source's length. + const char * const srcStart = src; + + // Our backup of the destination's start, we need + // this to calculate the destination's length. + const char * const dstStart = dst; + + // Search the end of the destination, but do not + // move past the terminating zero. + while (size-- != 0 && *dst != 0) + ++dst; + + // Calculate the destination's length; + const size_t dstLength = dst - dstStart; + + // In case we reached the end of the destination + // buffer before we had a chance to append any + // characters we will just return the destination + // length plus the source string's length. + if (size == 0) + return dstLength + strlen(srcStart); + + // Copy over all of the source that fits + // the destination buffer. We also need + // to take the terminating zero we will + // add into consideration. + while (size-- != 0 && *src != 0) + *dst++ = *src++; + *dst = 0; + + // Move to the terminating zero of the source + // string, we need this to determine the length + // of the source string. + while (*src) + ++src; + + // Return the total length of the result string + return dstLength + (src - srcStart); +} + +} // End of namespace Common + +// Portable implementation of stricmp / strcasecmp / strcmpi. +// TODO: Rename this to Common::strcasecmp +int scumm_stricmp(const char *s1, const char *s2) { + byte l1, l2; + do { + // Don't use ++ inside tolower, in case the macro uses its + // arguments more than once. + l1 = (byte)*s1++; + l1 = tolower(l1); + l2 = (byte)*s2++; + l2 = tolower(l2); + } while (l1 == l2 && l1 != 0); + return l1 - l2; +} + +// Portable implementation of strnicmp / strncasecmp / strncmpi. +// TODO: Rename this to Common::strncasecmp +int scumm_strnicmp(const char *s1, const char *s2, uint n) { + byte l1, l2; + do { + if (n-- == 0) + return 0; // no difference found so far -> signal equality + + // Don't use ++ inside tolower, in case the macro uses its + // arguments more than once. + l1 = (byte)*s1++; + l1 = tolower(l1); + l2 = (byte)*s2++; + l2 = tolower(l2); + } while (l1 == l2 && l1 != 0); + return l1 - l2; +} diff --git a/devtools/create_titanic/str.h b/devtools/create_titanic/str.h new file mode 100644 index 0000000000..2f954dcfca --- /dev/null +++ b/devtools/create_titanic/str.h @@ -0,0 +1,386 @@ +/* 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. + * + */ + +#ifndef COMMON_STRING_H +#define COMMON_STRING_H + +#include "common/scummsys.h" + +#include + +namespace Common { + +/** + * Simple string class for ScummVM. Provides automatic storage managment, + * and overloads several operators in a 'natural' fashion, mimicking + * the std::string class. Even provides simple iterators. + * + * This class tries to avoid allocating lots of small blocks on the heap, + * since that is inefficient on several platforms supported by ScummVM. + * Instead, small strings are stored 'inside' the string object (i.e. on + * the stack, for stack allocated objects), and only for strings exceeding + * a certain length do we allocate a buffer on the heap. + * + * The presence of \0 characters in the string will cause undefined + * behavior in some operations. + */ +class String { +public: + static const uint32 npos = 0xFFFFFFFF; +protected: + /** + * The size of the internal storage. Increasing this means less heap + * allocations are needed, at the cost of more stack memory usage, + * and of course lots of wasted memory. Empirically, 90% or more of + * all String instances are less than 32 chars long. If a platform + * is very short on stack space, it would be possible to lower this. + * A value of 24 still seems acceptable, though considerably worse, + * while 16 seems to be the lowest you want to go... Anything lower + * than 8 makes no sense, since that's the size of member _extern + * (on 32 bit machines; 12 bytes on systems with 64bit pointers). + */ + static const uint32 _builtinCapacity = 32 - sizeof(uint32) - sizeof(char *); + + /** + * Length of the string. Stored to avoid having to call strlen + * a lot. Yes, we limit ourselves to strings shorter than 4GB -- + * on purpose :-). + */ + uint32 _size; + + /** + * Pointer to the actual string storage. Either points to _storage, + * or to a block allocated on the heap via malloc. + */ + char *_str; + + + union { + /** + * Internal string storage. + */ + char _storage[_builtinCapacity]; + /** + * External string storage data -- the refcounter, and the + * capacity of the string _str points to. + */ + struct { + mutable int *_refCount; + uint32 _capacity; + } _extern; + }; + + inline bool isStorageIntern() const { + return _str == _storage; + } + +public: + /** Construct a new empty string. */ + String() : _size(0), _str(_storage) { _storage[0] = 0; } + + /** Construct a new string from the given NULL-terminated C string. */ + String(const char *str); + + /** Construct a new string containing exactly len characters read from address str. */ + String(const char *str, uint32 len); + + /** Construct a new string containing the characters between beginP (including) and endP (excluding). */ + String(const char *beginP, const char *endP); + + /** Construct a copy of the given string. */ + String(const String &str); + + /** Construct a string consisting of the given character. */ + explicit String(char c); + + ~String(); + + String &operator=(const char *str); + String &operator=(const String &str); + String &operator=(char c); + String &operator+=(const char *str); + String &operator+=(const String &str); + String &operator+=(char c); + + bool operator==(const String &x) const; + bool operator==(const char *x) const; + bool operator!=(const String &x) const; + bool operator!=(const char *x) const; + + bool operator<(const String &x) const; + bool operator<=(const String &x) const; + bool operator>(const String &x) const; + bool operator>=(const String &x) const; + + bool equals(const String &x) const; + bool equalsIgnoreCase(const String &x) const; + int compareTo(const String &x) const; // strcmp clone + int compareToIgnoreCase(const String &x) const; // stricmp clone + + bool equals(const char *x) const; + bool equalsIgnoreCase(const char *x) const; + int compareTo(const char *x) const; // strcmp clone + int compareToIgnoreCase(const char *x) const; // stricmp clone + + bool hasSuffix(const String &x) const; + bool hasSuffix(const char *x) const; + + bool hasPrefix(const String &x) const; + bool hasPrefix(const char *x) const; + + bool contains(const String &x) const; + bool contains(const char *x) const; + bool contains(char x) const; + + inline const char *c_str() const { return _str; } + inline uint size() const { return _size; } + + inline bool empty() const { return (_size == 0); } + char firstChar() const { return (_size > 0) ? _str[0] : 0; } + char lastChar() const { return (_size > 0) ? _str[_size - 1] : 0; } + + char operator[](int idx) const { + assert(_str && idx >= 0 && idx < (int)_size); + return _str[idx]; + } + + /** Remove the last character from the string. */ + void deleteLastChar(); + + /** Remove the character at position p from the string. */ + void deleteChar(uint32 p); + + /** Remove all characters from position p to the p + len. If len = String::npos, removes all characters to the end */ + void erase(uint32 p, uint32 len = npos); + + /** Set character c at position p, replacing the previous character there. */ + void setChar(char c, uint32 p); + + /** Insert character c before position p. */ + void insertChar(char c, uint32 p); + + /** Clears the string, making it empty. */ + void clear(); + + /** Convert all characters in the string to lowercase. */ + void toLowercase(); + + /** Convert all characters in the string to uppercase. */ + void toUppercase(); + + /** + * Removes trailing and leading whitespaces. Uses isspace() to decide + * what is whitespace and what not. + */ + void trim(); + + uint hash() const; + + /** + * Print formatted data into a String object. Similar to sprintf, + * except that it stores the result in (variably sized) String + * instead of a fixed size buffer. + */ + static String format(const char *fmt, ...) GCC_PRINTF(1,2); + + /** + * Print formatted data into a String object. Similar to vsprintf, + * except that it stores the result in (variably sized) String + * instead of a fixed size buffer. + */ + static String vformat(const char *fmt, va_list args); + +public: + typedef char value_type; + /** + * Unsigned version of the underlying type. This can be used to cast + * individual string characters to bigger integer types without sign + * extension happening. + */ + typedef unsigned char unsigned_type; + typedef char * iterator; + typedef const char * const_iterator; + + iterator begin() { + // Since the user could potentially + // change the string via the returned + // iterator we have to assure we are + // pointing to a unique storage. + makeUnique(); + + return _str; + } + + iterator end() { + return begin() + size(); + } + + const_iterator begin() const { + return _str; + } + + const_iterator end() const { + return begin() + size(); + } + +protected: + void makeUnique(); + void ensureCapacity(uint32 new_size, bool keep_old); + void incRefCount() const; + void decRefCount(int *oldRefCount); + void initWithCStr(const char *str, uint32 len); +}; + +// Append two strings to form a new (temp) string +String operator+(const String &x, const String &y); + +String operator+(const char *x, const String &y); +String operator+(const String &x, const char *y); + +String operator+(const String &x, char y); +String operator+(char x, const String &y); + +// Some useful additional comparison operators for Strings +bool operator==(const char *x, const String &y); +bool operator!=(const char *x, const String &y); + +// Utility functions to remove leading and trailing whitespaces +extern char *ltrim(char *t); +extern char *rtrim(char *t); +extern char *trim(char *t); + + +/** + * Returns the last component of a given path. + * + * Examples: + * /foo/bar.txt would return 'bar.txt' + * /foo/bar/ would return 'bar' + * /foo/./bar// would return 'bar' + * + * @param path the path of which we want to know the last component + * @param sep character used to separate path components + * @return The last component of the path. + */ +String lastPathComponent(const String &path, const char sep); + +/** + * Normalize a given path to a canonical form. In particular: + * - trailing separators are removed: /foo/bar/ -> /foo/bar + * - double separators (= empty components) are removed: /foo//bar -> /foo/bar + * - dot components are removed: /foo/./bar -> /foo/bar + * + * @todo remove double dot components: /foo/baz/../bar -> /foo/bar + * + * @param path the path to normalize + * @param sep the separator token (usually '/' on Unix-style systems, or '\\' on Windows based stuff) + * @return the normalized path + */ +String normalizePath(const String &path, const char sep); + + +/** + * Simple DOS-style pattern matching function (understands * and ? like used in DOS). + * Taken from exult/files/listfiles.cc + * + * Token meaning: + * "*": any character, any amount of times. + * "?": any character, only once. + * "#": any decimal digit, only once. + * + * Example strings/patterns: + * String: monkey.s01 Pattern: monkey.s?? => true + * String: monkey.s101 Pattern: monkey.s?? => false + * String: monkey.s99 Pattern: monkey.s?1 => false + * String: monkey.s101 Pattern: monkey.s* => true + * String: monkey.s99 Pattern: monkey.s*1 => false + * String: monkey.s01 Pattern: monkey.s## => true + * String: monkey.s01 Pattern: monkey.### => false + * + * @param str Text to be matched against the given pattern. + * @param pat Glob pattern. + * @param ignoreCase Whether to ignore the case when doing pattern match + * @param pathMode Whether to use path mode, i.e., whether slashes must be matched explicitly. + * + * @return true if str matches the pattern, false otherwise. + */ +bool matchString(const char *str, const char *pat, bool ignoreCase = false, bool pathMode = false); + + +/** + * Take a 32 bit value and turn it into a four character string, where each of + * the four bytes is turned into one character. Most significant byte is printed + * first. + */ +String tag2string(uint32 tag); + +/** + * Copy up to size - 1 characters from src to dst and also zero terminate the + * result. Note that src must be a zero terminated string. + * + * In case size is zero this function just returns the length of the source + * string. + * + * @note This is modeled after OpenBSD's strlcpy. See the manpage here: + * http://www.openbsd.org/cgi-bin/man.cgi?query=strlcpy + * + * @param dst The destination buffer. + * @param src The source string. + * @param size The size of the destination buffer. + * @return The length of the (non-truncated) result, i.e. strlen(src). + */ +size_t strlcpy(char *dst, const char *src, size_t size); + +/** + * Append the string src to the string dst. Note that both src and dst must be + * zero terminated. The result will be zero terminated. At most + * "size - strlen(dst) - 1" bytes will be appended. + * + * In case the dst string does not contain a zero within the first "size" bytes + * the dst string will not be changed and size + strlen(src) is returned. + * + * @note This is modeled after OpenBSD's strlcat. See the manpage here: + * http://www.openbsd.org/cgi-bin/man.cgi?query=strlcat + * + * @param dst The string the source string should be appended to. + * @param src The source string. + * @param size The (total) size of the destination buffer. + * @return The length of the (non-truncated) result. That is + * strlen(dst) + strlen(src). In case strlen(dst) > size + * size + strlen(src) is returned. + */ +size_t strlcat(char *dst, const char *src, size_t size); + +/** + * Convenience wrapper for tag2string which "returns" a C string. + * Note: It is *NOT* safe to do anything with the return value other than directly + * copying or printing it. + */ +#define tag2str(x) Common::tag2string(x).c_str() + + +} // End of namespace Common + +extern int scumm_stricmp(const char *s1, const char *s2); +extern int scumm_strnicmp(const char *s1, const char *s2, uint n); + +#endif diff --git a/devtools/create_titanic/winexe.cpp b/devtools/create_titanic/winexe.cpp new file mode 100644 index 0000000000..c23bd84a89 --- /dev/null +++ b/devtools/create_titanic/winexe.cpp @@ -0,0 +1,83 @@ +/* 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. + * + */ + +#define FORBIDDEN_SYMBOL_ALLOW_ALL + +#include "str.h" +#include "winexe.h" + +namespace Common { + +WinResourceID &WinResourceID::operator=(const String &x) { + _name = x; + _idType = kIDTypeString; + return *this; +} + +WinResourceID &WinResourceID::operator=(uint32 x) { + _id = x; + _idType = kIDTypeNumerical; + return *this; +} + +bool WinResourceID::operator==(const String &x) const { + return _idType == kIDTypeString && _name.equalsIgnoreCase(x); +} + +bool WinResourceID::operator==(const uint32 &x) const { + return _idType == kIDTypeNumerical && _id == x; +} + +bool WinResourceID::operator==(const WinResourceID &x) const { + if (_idType != x._idType) + return false; + if (_idType == kIDTypeString) + return _name.equalsIgnoreCase(x._name); + if (_idType == kIDTypeNumerical) + return _id == x._id; + return true; +} + +String WinResourceID::getString() const { + if (_idType != kIDTypeString) + return ""; + + return _name; +} + +uint32 WinResourceID::getID() const { + if (_idType != kIDTypeNumerical) + return 0xffffffff; + + return _id; +} + +String WinResourceID::toString() const { + if (_idType == kIDTypeString) + return _name; + else if (_idType == kIDTypeNumerical) + return String::format("0x%08x", _id); + + return ""; +} + +} // End of namespace Common diff --git a/devtools/create_titanic/winexe.h b/devtools/create_titanic/winexe.h new file mode 100644 index 0000000000..da99c769be --- /dev/null +++ b/devtools/create_titanic/winexe.h @@ -0,0 +1,70 @@ +/* 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. + * + */ + +#ifndef COMMON_WINEXE_H +#define COMMON_WINEXE_H + +#include "hash-str.h" +#include "str.h" + +namespace Common { + +class WinResourceID { +public: + WinResourceID() { _idType = kIDTypeNull; } + WinResourceID(String x) { _idType = kIDTypeString; _name = x; } + WinResourceID(uint32 x) { _idType = kIDTypeNumerical; _id = x; } + + WinResourceID &operator=(const String &x); + WinResourceID &operator=(uint32 x); + + bool operator==(const String &x) const; + bool operator==(const uint32 &x) const; + bool operator==(const WinResourceID &x) const; + + String getString() const; + uint32 getID() const; + String toString() const; + +private: + /** An ID Type. */ + enum IDType { + kIDTypeNull, ///< No type set + kIDTypeNumerical, ///< A numerical ID. + kIDTypeString ///< A string ID. + } _idType; + + String _name; ///< The resource's string ID. + uint32 _id; ///< The resource's numerical ID. +}; + +struct WinResourceID_Hash { + uint operator()(const WinResourceID &id) const { return hashit(id.toString()); } +}; + +struct WinResourceID_EqualTo { + bool operator()(const WinResourceID &id1, const WinResourceID &id2) const { return id1 == id2; } +}; + +} // End of namespace Common + +#endif diff --git a/devtools/create_titanic/winexe_pe.cpp b/devtools/create_titanic/winexe_pe.cpp new file mode 100644 index 0000000000..16ad16ab63 --- /dev/null +++ b/devtools/create_titanic/winexe_pe.cpp @@ -0,0 +1,260 @@ +/* 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. + * + */ + +#define FORBIDDEN_SYMBOL_ALLOW_ALL + +#include "file.h" +#include "str.h" +#include "winexe_pe.h" +#include "common/array.h" +#include "common/endian.h" + +namespace Common { + +PEResources::PEResources() { + _exe = 0; +} + +PEResources::~PEResources() { + clear(); +} + +void PEResources::clear() { + _sections.clear(); + _resources.clear(); + delete _exe; _exe = 0; +} + +bool PEResources::loadFromEXE(const String &fileName) { + if (fileName.empty()) + return false; + + File *file = new File(); + + if (!file->open(fileName.c_str())) { + delete file; + return false; + } + + return loadFromEXE(file); +} + +bool PEResources::loadFromEXE(File *stream) { + clear(); + + if (!stream) + return false; + + if (stream->readUint16BE() != MKTAG16('M', 'Z')) + return false; + + stream->skip(58); + + uint32 peOffset = stream->readUint32LE(); + + if (!peOffset || peOffset >= (uint32)stream->size()) + return false; + + stream->seek(peOffset); + + if (stream->readUint32BE() != MKTAG('P','E',0,0)) + return false; + + stream->skip(2); + uint16 sectionCount = stream->readUint16LE(); + stream->skip(12); + uint16 optionalHeaderSize = stream->readUint16LE(); + stream->skip(optionalHeaderSize + 2); + + // Read in all the sections + for (uint16 i = 0; i < sectionCount; i++) { + char sectionName[9]; + stream->read(sectionName, 8); + sectionName[8] = 0; + + Section section; + stream->skip(4); + section.virtualAddress = stream->readUint32LE(); + section.size = stream->readUint32LE(); + section.offset = stream->readUint32LE(); + stream->skip(16); + + _sections[sectionName] = section; + } + + // Currently, we require loading a resource section + if (!_sections.contains(".rsrc")) { + clear(); + return false; + } + + _exe = stream; + + Section &resSection = _sections[".rsrc"]; + parseResourceLevel(resSection, resSection.offset, 0); + + return true; +} + +void PEResources::parseResourceLevel(Section §ion, uint32 offset, int level) { + _exe->seek(offset + 12); + + uint16 namedEntryCount = _exe->readUint16LE(); + uint16 intEntryCount = _exe->readUint16LE(); + + for (uint32 i = 0; i < (uint32)(namedEntryCount + intEntryCount); i++) { + uint32 value = _exe->readUint32LE(); + + WinResourceID id; + + if (value & 0x80000000) { + value &= 0x7fffffff; + + uint32 startPos = _exe->pos(); + _exe->seek(section.offset + (value & 0x7fffffff)); + + // Read in the name, truncating from unicode to ascii + String name; + uint16 nameLength = _exe->readUint16LE(); + while (nameLength--) + name += (char)(_exe->readUint16LE() & 0xff); + + _exe->seek(startPos); + + id = name; + } else { + id = value; + } + + uint32 nextOffset = _exe->readUint32LE(); + uint32 lastOffset = _exe->pos(); + + if (level == 0) + _curType = id; + else if (level == 1) + _curName = id; + else if (level == 2) + _curLang = id; + + if (level < 2) { + // Time to dive down further + parseResourceLevel(section, section.offset + (nextOffset & 0x7fffffff), level + 1); + } else { + _exe->seek(section.offset + nextOffset); + + Resource resource; + resource.offset = _exe->readUint32LE() + section.offset - section.virtualAddress; + resource.size = _exe->readUint32LE(); + + _resources[_curType][_curName][_curLang] = resource; + } + + _exe->seek(lastOffset); + } +} + +const Array PEResources::getTypeList() const { + Array array; + + if (!_exe) + return array; + + for (TypeMap::const_iterator it = _resources.begin(); it != _resources.end(); it++) + array.push_back(it->_key); + + return array; +} + +const Array PEResources::getNameList(const WinResourceID &type) const { + Array array; + + if (!_exe || !_resources.contains(type)) + return array; + + const NameMap &nameMap = _resources[type]; + + for (NameMap::const_iterator it = nameMap.begin(); it != nameMap.end(); it++) + array.push_back(it->_key); + + return array; +} + +const Array PEResources::getLangList(const WinResourceID &type, const WinResourceID &name) const { + Array array; + + if (!_exe || !_resources.contains(type)) + return array; + + const NameMap &nameMap = _resources[type]; + + if (!nameMap.contains(name)) + return array; + + const LangMap &langMap = nameMap[name]; + + for (LangMap::const_iterator it = langMap.begin(); it != langMap.end(); it++) + array.push_back(it->_key); + + return array; +} + +File *PEResources::getResource(const WinResourceID &type, const WinResourceID &name) { + Array langList = getLangList(type, name); + + if (langList.empty()) + return 0; + + const Resource &resource = _resources[type][name][langList[0]]; + byte *data = (byte *)malloc(resource.size); + _exe->seek(resource.offset); + _exe->read(data, resource.size); + + File *file = new File(); + file->open(data, resource.size); + return file; +} + +File *PEResources::getResource(const WinResourceID &type, const WinResourceID &name, const WinResourceID &lang) { + if (!_exe || !_resources.contains(type)) + return 0; + + const NameMap &nameMap = _resources[type]; + + if (!nameMap.contains(name)) + return 0; + + const LangMap &langMap = nameMap[name]; + + if (!langMap.contains(lang)) + return 0; + + const Resource &resource = langMap[lang]; + byte *data = (byte *)malloc(resource.size); + _exe->seek(resource.offset); + _exe->read(data, resource.size); + + File *file = new File(); + file->open(data, resource.size); + return file; +} + +} // End of namespace Common diff --git a/devtools/create_titanic/winexe_pe.h b/devtools/create_titanic/winexe_pe.h new file mode 100644 index 0000000000..49e29b7a56 --- /dev/null +++ b/devtools/create_titanic/winexe_pe.h @@ -0,0 +1,120 @@ +/* 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. + * + */ + +#ifndef COMMON_WINEXE_PE_H +#define COMMON_WINEXE_PE_H + +#include "file.h" +#include "hash-str.h" +#include "hashmap.h" +#include "str.h" +#include "winexe.h" + +namespace Common { + +template class Array; +class SeekableReadStream; + +/** The default Windows PE resources. */ +enum PEResourceType { + kPECursor = 0x01, + kPEBitmap = 0x02, + kPEIcon = 0x03, + kPEMenu = 0x04, + kPEDialog = 0x05, + kPEString = 0x06, + kPEFontDir = 0x07, + kPEFont = 0x08, + kPEAccelerator = 0x09, + kPERCData = 0x0A, + kPEMessageTable = 0x0B, + kPEGroupCursor = 0x0C, + kPEGroupIcon = 0x0E, + kPEVersion = 0x10, + kPEDlgInclude = 0x11, + kPEPlugPlay = 0x13, + kPEVXD = 0x14, + kPEAniCursor = 0x15, + kPEAniIcon = 0x16 +}; + +/** + * A class able to load resources from a Windows Portable Executable, such + * as cursors, bitmaps, and sounds. + */ +class PEResources { +public: + PEResources(); + ~PEResources(); + + /** Clear all information. */ + void clear(); + + /** Load from an EXE file. */ + bool loadFromEXE(const String &fileName); + + bool loadFromEXE(File *stream); + + /** Return a list of resource types. */ + const Array getTypeList() const; + + /** Return a list of names for a given type. */ + const Array getNameList(const WinResourceID &type) const; + + /** Return a list of languages for a given type and name. */ + const Array getLangList(const WinResourceID &type, const WinResourceID &name) const; + + /** Return a stream to the specified resource, taking the first language found (or 0 if non-existent). */ + File *getResource(const WinResourceID &type, const WinResourceID &name); + + /** Return a stream to the specified resource (or 0 if non-existent). */ + File *getResource(const WinResourceID &type, const WinResourceID &name, const WinResourceID &lang); + +private: + struct Section { + uint32 virtualAddress; + uint32 size; + uint32 offset; + }; + + HashMap _sections; + + File *_exe; + + void parseResourceLevel(Section §ion, uint32 offset, int level); + WinResourceID _curType, _curName, _curLang; + + struct Resource { + uint32 offset; + uint32 size; + }; + + typedef HashMap LangMap; + typedef HashMap NameMap; + typedef HashMap TypeMap; + + TypeMap _resources; +}; + +} // End of namespace Common + +#endif -- cgit v1.2.3 From 053ff7ab75e0ee1f18606dd6c7488c5cc0d31ae5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 15 May 2016 18:44:47 -0400 Subject: TITANIC: Change engine to use titanic.dat --- engines/titanic/support/files_manager.cpp | 38 ++++++++++++++++++++++++++---- engines/titanic/support/files_manager.h | 18 ++++++++++---- engines/titanic/support/font.cpp | 2 +- engines/titanic/true_talk/title_engine.cpp | 2 +- 4 files changed, 50 insertions(+), 10 deletions(-) diff --git a/engines/titanic/support/files_manager.cpp b/engines/titanic/support/files_manager.cpp index eb2f95e92e..c415731f16 100644 --- a/engines/titanic/support/files_manager.cpp +++ b/engines/titanic/support/files_manager.cpp @@ -28,10 +28,38 @@ namespace Titanic { CFilesManager::CFilesManager() : _gameManager(nullptr), _assetsPath("Assets"), _field0(0), _drive(-1), _field18(0), _field1C(0), _field3C(0) { - _exeResources.loadFromEXE("st.exe"); + loadResourceIndex(); } CFilesManager::~CFilesManager() { + _datFile.close(); +} + +void CFilesManager::loadResourceIndex() { + if (!_datFile.open("titanic.dat")) + error("Could not find titanic.dat data file"); + + uint headerId = _datFile.readUint32BE(); + uint version = _datFile.readUint16LE(); + if (headerId != MKTAG('S', 'V', 'T', 'N') || version < 1) + error("Invalid data file"); + + // Read in entries + uint offset, size; + char c; + Common::String resourceName; + for (;;) { + offset = _datFile.readUint32LE(); + size = _datFile.readUint32LE(); + if (size == 0) + break; + + Common::String resName; + while ((c = _datFile.readByte()) != '\0') + resName += c; + + _resources[resName] = ResourceEntry(offset, size); + } } bool CFilesManager::fileExists(const CString &name) { @@ -92,9 +120,11 @@ void CFilesManager::preload(const CString &name) { // We don't currently do any preloading of resources } -Common::SeekableReadStream *CFilesManager::getResource( - Common::WinResourceID area, Common::WinResourceID name) { - return _exeResources.getResource(area, name); +Common::SeekableReadStream *CFilesManager::getResource(const CString &str) { + ResourceEntry resEntry = _resources[str]; + _datFile.seek(resEntry._offset); + + return _datFile.readStream(resEntry._size); } } // End of namespace Titanic diff --git a/engines/titanic/support/files_manager.h b/engines/titanic/support/files_manager.h index 6be6a13166..ec0c7fc008 100644 --- a/engines/titanic/support/files_manager.h +++ b/engines/titanic/support/files_manager.h @@ -23,7 +23,7 @@ #ifndef TITANIC_FILES_MANAGER_H #define TITANIC_FILES_MANAGER_H -#include "common/winexe_pe.h" +#include "common/hashmap.h" #include "titanic/core/list.h" #include "titanic/support/screen_manager.h" @@ -35,9 +35,18 @@ class CFilesManagerList : public List { }; class CFilesManager { + struct ResourceEntry { + uint _offset; + uint _size; + + ResourceEntry() : _offset(0), _size(0) {} + ResourceEntry(uint offset, uint size) : _offset(offset), _size(size) {} + }; + typedef Common::HashMap ResourceHash; private: CGameManager *_gameManager; - Common::PEResources _exeResources; + Common::File _datFile; + ResourceHash _resources; CFilesManagerList _list; CString _string1; CString _string2; @@ -47,6 +56,8 @@ private: int _field1C; int _field3C; const CString _assetsPath; +private: + void loadResourceIndex(); public: CFilesManager(); ~CFilesManager(); @@ -90,8 +101,7 @@ public: /** * Get a resource from the executable */ - Common::SeekableReadStream *getResource(Common::WinResourceID area, - Common::WinResourceID name); + Common::SeekableReadStream *getResource(const CString &str); }; } // End of namespace Titanic diff --git a/engines/titanic/support/font.cpp b/engines/titanic/support/font.cpp index 916f02097b..c960e2fa9e 100644 --- a/engines/titanic/support/font.cpp +++ b/engines/titanic/support/font.cpp @@ -42,7 +42,7 @@ STFont::~STFont() { void STFont::load(int fontNumber) { assert(!_dataPtr); Common::SeekableReadStream *stream = g_vm->_filesManager->getResource( - Common::WinResourceID("STFONT"), fontNumber); + CString::format("STFONT/%d", fontNumber)); if (!stream) error("Could not locate the specified font"); diff --git a/engines/titanic/true_talk/title_engine.cpp b/engines/titanic/true_talk/title_engine.cpp index 511ee0a8f7..d5f465139e 100644 --- a/engines/titanic/true_talk/title_engine.cpp +++ b/engines/titanic/true_talk/title_engine.cpp @@ -67,7 +67,7 @@ void STtitleEngine::dump(int val1, int val2) { SimpleFile *STtitleEngine::open(const CString &name) { Common::SeekableReadStream *stream = g_vm->_filesManager->getResource( - Common::WinResourceID("TEXT"), name); + CString::format("TEXT/%s", name.c_str())); assert(stream); SimpleFile *file = new SimpleFile(); -- cgit v1.2.3 From b37da849c936cc1842969b150e84dd0ad145f576 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 15 May 2016 23:15:24 -0400 Subject: TITANIC: Implement TTparser searchAndReplace methods --- devtools/create_titanic/create_titanic_dat.cpp | 86 +++++++++++++++++++++++--- engines/titanic/support/string.h | 3 + engines/titanic/true_talk/tt_parser.cpp | 61 +++++++++++++++--- engines/titanic/true_talk/tt_parser.h | 22 ++++++- engines/titanic/true_talk/tt_string.h | 2 +- 5 files changed, 158 insertions(+), 16 deletions(-) diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index e41b125713..2f6050846a 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -49,20 +49,74 @@ */ #define VERSION_NUMBER 1 +#define HEADER_SIZE 0x280 Common::File inputFile, outputFile; Common::PEResources res; uint headerOffset = 6; -uint dataOffset = 0x200; +uint dataOffset = HEADER_SIZE; #define SEGMENT_OFFSET 0x401C00 +static const char *const ITEM_NAMES[46] = { + "LeftArmWith", "LeftArmWithout", "RightArmWith", "RightArmWithout", "BridgeRed", + "BridgeYellow", "BridgeBlue", "BridgeGreen", "Parrot", "CentralCore", "BrainGreen", + "BrainYellow", "BrainRed", "BrainBlue", "ChickenGreasy", "ChickenPlain", "ChickenPurple", + "ChickenRed", "ChickenYellow", "CrushedTV", "Ear", "Ear1", "Eyeball", "Eyeball1", + "Feather", "Lemon", "GlassEmpty", "GlassPurple", "GlassRed", "GlassYellow", "Hammer", + "Hose", "HoseEnd", "LiftHead", "LongStick", "Magazine", "Mouth", "MusicKey", "Napkin", + "Nose", "Perch", "PhonoCylinder", "PhonoCylinder1", "PhonoCylinder2", "PhonoCylinder3", + "Photo" +}; + +static const char *const ITEM_DESCRIPTIONS[46] = { + "The Maitre d'Bot's left arm holding a key", "The Maitre d'Bot's left arm", + "The Maitre d'Bot's right arm holding Titania's auditory center", + "The Maitre d'Bot's right arm", "Red Fuse", "Yellow Fuse", "Blue Fuse", + "Green Fuse", "The Parrot", "Titania's central intelligence core", + "Titania's auditory center", "Titania's olfactory center", + "Titania's speech center", "Titania's vision center", "rather greasy chicken", + "very plain chicken", "chicken smeared with starling pur$e", + "chicken covered with tomato sauce", "chicken coated in mustard sauce", + "A crushed television set", "Titania's ear", "Titania's ear", "Titania's eye", + "Titania's eye", "A parrot feather", "A nice fat juicy lemon", + "An empty beer glass", "A beer glass containing pur$ed flock of starlings", + "A beer glass containing tomato sauce", "A beer glass containing mustard sauce", + "A hammer", "A hose", "The other end of a hose", "The LiftBot's head", + "A rather long stick", "A magazine", "Titania's mouth", "A key", + "A super-absorbent napkin", "Titania's nose", "A perch", "A phonograph cylinder", + "A phonograph cylinder", "A phonograph cylinder", "A phonograph cylinder", + "A photograph" +}; + +static const char *const ITEM_IDS[40] = { + "MaitreD Left Arm", "MaitreD Right Arm", "OlfactoryCentre", "AuditoryCentre", + "SpeechCentre", "VisionCentre", "CentralCore", "Perch", "SeasonBridge", + "FanBridge", "BeamBridge", "ChickenBridge", "CarryParrot", "Chicken", + "CrushedTV", "Feathers", "Lemon", "BeerGlass", "BigHammer", "Ear1", "Ear 2", + "Eye1", "Eye2", "Mouth", "Nose", "NoseSpare", "Hose", "DeadHoseSpare", + "HoseEnd", "DeadHoseEndSpare", "BrokenLiftbotHead", "LongStick", "Magazine", + "Napkin", "Phonograph Cylinder", "Phonograph Cylinder 1", "Phonograph Cylinder 2", + "Phonograph Cylinder 3", "Photograph", "Music System Key" +}; + +static const char *const ROOM_NAMES[34] = { + "1stClassLobby", "1stClassRestaurant", "1stClassState", + "2ndClassLobby", "secClassState", "Arboretum", "FrozenArboretum", + "Bar", "BilgeRoom", "BilgeRoomWith", "BottomOfWell", "Bridge", + "CreatorsChamber", "CreatorsChamberOn", "Dome", "Home", "Lift", + "EmbLobby", "MoonEmbLobby", "MusicRoomLobby", "MusicRoom", + "ParrotLobby", "Pellerator", "PromenadeDeck", "SculptureChamber", + "SecClassLittleLift", "ServiceElevator", "SGTLeisure", "SGTLittleLift", + "SgtLobby", "SGTState", "Titania", "TopOfWell", "PlayersRoom" +}; + void NORETURN_PRE error(const char *s, ...) { printf("%s\n", s); exit(1); } void writeEntryHeader(const char *name, uint offset, uint size) { - assert(headerOffset < 0x200); + assert(headerOffset < HEADER_SIZE); outputFile.seek(headerOffset); outputFile.writeLong(offset); outputFile.writeLong(size); @@ -72,7 +126,7 @@ void writeEntryHeader(const char *name, uint offset, uint size) { } void writeFinalEntryHeader() { - assert(headerOffset <= 0x1F8); + assert(headerOffset <= (HEADER_SIZE - 8)); outputFile.seek(headerOffset); outputFile.writeLong(0); outputFile.writeLong(0); @@ -103,6 +157,19 @@ void writeStringArray(const char *name, uint offset, int count) { delete[] offsets; } +void writeStringArray(const char *name, const char *const *strings, int count) { + outputFile.seek(dataOffset); + + // Iterate through writing each string + for (int idx = 0; idx < count; ++idx) { + outputFile.writeString(strings[idx]); + } + + uint size = outputFile.size() - dataOffset; + writeEntryHeader(name, dataOffset, size); + dataOffset += size; +} + Common::WinResourceID getResId(uint id) { return Common::WinResourceID(id); } @@ -152,10 +219,15 @@ void writeHeader() { } void writeData() { - writeStringArray("TEXT/STRINGS1", 0x21B7C8, 376); - writeStringArray("TEXT/STRINGS2", 0x21BDB0, 218); - writeStringArray("TEXT/STRINGS3", 0x21C120, 1576); - writeStringArray("TEXT/STRINGS4", 0x21D9C8, 82); + writeStringArray("TEXT/ITEM_DESCRIPTIONS", ITEM_DESCRIPTIONS, 46); + writeStringArray("TEXT/ITEM_NAMES", ITEM_NAMES, 46); + writeStringArray("TEXT/ITEM_IDS", ITEM_IDS, 40); + writeStringArray("TEXT/ROOM_NAMES", ROOM_NAMES, 34); + + writeStringArray("TEXT/PHRASES", 0x21B7C8, 376); + writeStringArray("TEXT/REPLACEMENTS1", 0x21BDB0, 218); + writeStringArray("TEXT/REPLACEMENTS2", 0x21C120, 1576); + writeStringArray("TEXT/REPLACEMENTS3", 0x21D9C8, 82); writeResource("Bitmap", "BACKDROP"); writeResource("Bitmap", "EVILTWIN"); diff --git a/engines/titanic/support/string.h b/engines/titanic/support/string.h index 02775de067..fdaf92cfad 100644 --- a/engines/titanic/support/string.h +++ b/engines/titanic/support/string.h @@ -24,6 +24,7 @@ #define TITANIC_STRING_H #include "common/scummsys.h" +#include "common/array.h" #include "common/str.h" namespace Titanic { @@ -101,6 +102,8 @@ public: static CString format(const char *fmt, ...); }; +typedef Common::Array StringArray; + } // End of namespace Titanic #endif /* TITANIC_STRING_H */ diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 343d0aa7d1..d896923f2b 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -31,6 +31,8 @@ int TTparser::processInput(TTinput *input) { if (normalize(input)) return 0; + // Scan for and replace common slang and contractions with verbose versions + warning("TODO: TTparser::processInput"); return 0; } @@ -53,7 +55,7 @@ int TTparser::normalize(TTinput *input) { } else if (Common::isUpper(c)) { (*destLine) += toupper(c); } else if (Common::isDigit(c)) { - if (c == '0' && isSpecialCommand(srcLine, index)) { + if (c == '0' && isEmoticon(srcLine, index)) { input->set38(10); } else { // Iterate through all the digits of the number @@ -78,7 +80,7 @@ int TTparser::normalize(TTinput *input) { break; case ':': - commandVal = isSpecialCommand(srcLine, index); + commandVal = isEmoticon(srcLine, index); if (commandVal) { input->set38(commandVal); index += 2; @@ -88,7 +90,7 @@ int TTparser::normalize(TTinput *input) { break; case ';': - commandVal = isSpecialCommand(srcLine, index); + commandVal = isEmoticon(srcLine, index); if (commandVal == 6) { input->set38(7); index += 2; @@ -100,7 +102,7 @@ int TTparser::normalize(TTinput *input) { case '<': ++index; - commandVal = isSpecialCommand(srcLine, index); + commandVal = isEmoticon(srcLine, index); if (commandVal == 6) { input->set38(12); } else { @@ -111,7 +113,7 @@ int TTparser::normalize(TTinput *input) { case '>': ++index; - commandVal = isSpecialCommand(srcLine, index); + commandVal = isEmoticon(srcLine, index); if (commandVal == 6 || commandVal == 9) { input->set38(11); } else { @@ -150,7 +152,7 @@ int TTparser::normalize(TTinput *input) { return 0; } -int TTparser::isSpecialCommand(const TTstring &str, int &index) { +int TTparser::isEmoticon(const TTstring &str, int &index) { if (str[index] != ':' && str[index] != ';') return 0; @@ -258,8 +260,53 @@ bool TTparser::normalizeContraction(const TTstring &srcLine, int srcIndex, TTstr break; } - // TODO return false; } +void TTparser::searchAndReplace(TTstring &line, const StringArray &strings) { + int charIndex = 0; + while (charIndex >= 0) + charIndex = searchAndReplace(line, charIndex, strings); +} + +int TTparser::searchAndReplace(TTstring &line, int startIndex, const StringArray &strings) { + int lineSize = line.size(); + if (startIndex >= lineSize) + return -1; + + for (uint idx = 0; idx < strings.size(); idx += 2) { + const CString &origStr = strings[idx]; + const CString &replacementStr = strings[idx + 1]; + + if (!strncmp(line.c_str() + startIndex, origStr.c_str(), strings[idx].size())) { + // Ensure that that a space follows the match, or the end of string, + // so the end of the string doesn't match on parts of larger words + char c = line[startIndex + strings[idx].size()]; + if (c == ' ' || c == '\0') { + // Replace the text in the line with it's replacement + line = CString(line.c_str(), line.c_str() + startIndex) + replacementStr + + CString(line.c_str() + startIndex + origStr.size()); + + startIndex += replacementStr.size(); + break; + } + } + } + + // Skip to the end of the current word + while (startIndex < lineSize && line[startIndex] != ' ') + ++startIndex; + if (startIndex == lineSize) + return -1; + + // ..and all spaces following it until the start of the next word + while (startIndex < lineSize && line[startIndex] == ' ') + ++startIndex; + if (startIndex == lineSize) + return -1; + + // Return index of the start of the next word + return startIndex; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index 3e31257c9d..1eed38d515 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -46,7 +46,27 @@ private: /** * Checks for what is likely special developer cheat codes */ - static int isSpecialCommand(const TTstring &str, int &index); + static int isEmoticon(const TTstring &str, int &index); + + /** + * Checks if any word within a passed line has an entry in the list of replacements, + * and if found, replaces it with it's equivalent replacement string + * @param line Line to check + * @param strings List of strings to check for. Strings come in pairs, with the + * first being the string to match, and the second the replacement + */ + static void searchAndReplace(TTstring &line, const StringArray &strings); + + /** + * Checks the string starting at a given index for any word in the passed string array, + * and if found, replaces it in the line with it's replacement + * @param line Line to check + * @param startIndex Starting index in the start to check + * @param strings List of strings to check for. Strings come in pairs, with the + * first being the string to match, and the second the replacement + * @returns Index of the start of the following word + */ + static int searchAndReplace(TTstring &line, int startIndex, const StringArray &strings); public: CScriptHandler *_owner; int _field4; diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index 2009167b75..1b208cc26a 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -58,7 +58,7 @@ public: TTstring &operator+=(const TTstring &str); TTstring &operator+=(char c); - const char &operator[](uint index) { + const char &operator[](int index) { return *(c_str() + index); } -- cgit v1.2.3 From e1ba9672330802c458aebd7049e8ae3f4b23f9ca Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 16 May 2016 07:40:10 -0400 Subject: TITANIC: Moved other static arrays from Titanic engine to dat file --- engines/titanic/support/exe_resources.cpp | 3 +- engines/titanic/support/exe_resources.h | 2 - engines/titanic/titanic.cpp | 121 ++++++++++++++---------------- engines/titanic/titanic.h | 18 ++++- engines/titanic/true_talk/tt_parser.cpp | 12 +++ 5 files changed, 85 insertions(+), 71 deletions(-) diff --git a/engines/titanic/support/exe_resources.cpp b/engines/titanic/support/exe_resources.cpp index 91139dce3d..522e92f718 100644 --- a/engines/titanic/support/exe_resources.cpp +++ b/engines/titanic/support/exe_resources.cpp @@ -21,11 +21,12 @@ */ #include "titanic/support/exe_resources.h" +#include "titanic/titanic.h" namespace Titanic { CExeResources::CExeResources() : _owner(nullptr), _field4(0), _field8(0), - _fieldC(0), _field10(0), _field14(0), _field18(0) { + _fieldC(0), _field10(0), _field14(0), _field18(0) { } void CExeResources::reset(CScriptHandler *owner, int val1, int val2) { diff --git a/engines/titanic/support/exe_resources.h b/engines/titanic/support/exe_resources.h index bb760626d4..49e05aa56f 100644 --- a/engines/titanic/support/exe_resources.h +++ b/engines/titanic/support/exe_resources.h @@ -23,8 +23,6 @@ #ifndef TITANIC_EXE_RESOURCES_H #define TITANIC_EXE_RESOURCES_H -#include "common/file.h" - namespace Titanic { class CScriptHandler; diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index c2c1f18f54..38d536cab6 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -40,6 +40,7 @@ #include "titanic/moves/enter_exit_first_class_state.h" #include "titanic/moves/enter_exit_sec_class_mini_lift.h" #include "titanic/moves/exit_pellerator.h" +#include "titanic/support/simple_file.h" namespace Titanic { @@ -81,8 +82,6 @@ void TitanicEngine::initialize() { DebugMan.addDebugChannel(kDebugGraphics, "graphics", "Graphics handling"); DebugMan.addDebugChannel(kDebugSound, "sound", "Sound and Music handling"); - setItemNames(); - setRoomNames(); CSaveableObject::initClassList(); CEnterExitFirstClassState::init(); CGetLiftEye2::init(); @@ -101,6 +100,11 @@ void TitanicEngine::initialize() { _screen = new Graphics::Screen(0, 0); _screenManager = new OSScreenManager(this); _window = new CMainGameWindow(this); + + setItemNames(); + setRoomNames(); + setParserStrings(); + _window->applicationStarting(); } @@ -127,72 +131,61 @@ Common::Error TitanicEngine::run() { return Common::kNoError; } +static CString readString(Common::SeekableReadStream *s) { + CString result; + char c; + while ((c = s->readByte()) != '\0') + result += c; + + return result; +} + void TitanicEngine::setItemNames() { - static const char *const NAMES[TOTAL_ITEMS] = { - "LeftArmWith", "LeftArmWithout", "RightArmWith", "RightArmWithout", "BridgeRed", - "BridgeYellow", "BridgeBlue", "BridgeGreen", "Parrot", "CentralCore", "BrainGreen", - "BrainYellow", "BrainRed", "BrainBlue", "ChickenGreasy", "ChickenPlain", "ChickenPurple", - "ChickenRed", "ChickenYellow", "CrushedTV", "Ear", "Ear1", "Eyeball", "Eyeball1", - "Feather", "Lemon", "GlassEmpty", "GlassPurple", "GlassRed", "GlassYellow", "Hammer", - "Hose", "HoseEnd", "LiftHead", "LongStick", "Magazine", "Mouth", "MusicKey", "Napkin", - "Nose", "Perch", "PhonoCylinder", "PhonoCylinder1", "PhonoCylinder2", "PhonoCylinder3", - "Photo" - }; - for (uint idx = 0; idx < TOTAL_ITEMS; ++idx) - _itemNames[idx] = NAMES[idx]; - - // Item descriptions - static const char *const DESCRIPTIONS[TOTAL_ITEMS] = { - "The Maitre d'Bot's left arm holding a key", "The Maitre d'Bot's left arm", - "The Maitre d'Bot's right arm holding Titania's auditory center", - "The Maitre d'Bot's right arm", "Red Fuse", "Yellow Fuse", "Blue Fuse", - "Green Fuse", "The Parrot", "Titania's central intelligence core", - "Titania's auditory center", "Titania's olfactory center", - "Titania's speech center", "Titania's vision center", "rather greasy chicken", - "very plain chicken", "chicken smeared with starling pur$e", - "chicken covered with tomato sauce", "chicken coated in mustard sauce", - "A crushed television set", "Titania's ear", "Titania's ear", "Titania's eye", - "Titania's eye", "A parrot feather", "A nice fat juicy lemon", - "An empty beer glass", "A beer glass containing pur$ed flock of starlings", - "A beer glass containing tomato sauce", "A beer glass containing mustard sauce", - "A hammer", "A hose", "The other end of a hose", "The LiftBot's head", - "A rather long stick", "A magazine", "Titania's mouth", "A key", - "A super-absorbent napkin", "Titania's nose", "A perch", "A phonograph cylinder", - "A phonograph cylinder", "A phonograph cylinder", "A phonograph cylinder", - "A photograph" - }; - for (uint idx = 0; idx < TOTAL_ITEMS; ++idx) - _itemDescriptions[idx] = DESCRIPTIONS[idx]; - - // Item identifiers - static const char *const ITEM_IDS[40] = { - "MaitreD Left Arm", "MaitreD Right Arm", "OlfactoryCentre", "AuditoryCentre", - "SpeechCentre", "VisionCentre", "CentralCore", "Perch", "SeasonBridge", - "FanBridge", "BeamBridge", "ChickenBridge", "CarryParrot", "Chicken", - "CrushedTV", "Feathers", "Lemon", "BeerGlass", "BigHammer", "Ear1", "Ear 2", - "Eye1", "Eye2", "Mouth", "Nose", "NoseSpare", "Hose", "DeadHoseSpare", - "HoseEnd", "DeadHoseEndSpare", "BrokenLiftbotHead", "LongStick", "Magazine", - "Napkin", "Phonograph Cylinder", "Phonograph Cylinder 1", "Phonograph Cylinder 2", - "Phonograph Cylinder 3", "Photograph", "Music System Key" - }; - for (uint idx = 0; idx < 40; ++idx) - _itemIds[idx] = ITEM_IDS[idx]; + Common::SeekableReadStream *r; + r = g_vm->_filesManager->getResource("TEXT/ITEM_NAMES"); + while (r->pos() < r->size()) + _itemNames.push_back(readString(r)); + delete r; + + r = g_vm->_filesManager->getResource("TEXT/ITEM_DESCRIPTIONS"); + while (r->pos() < r->size()) + _itemNames.push_back(readString(r)); + delete r; + + r = g_vm->_filesManager->getResource("TEXT/ITEM_IDS"); + while (r->pos() < r->size()) + _itemIds.push_back(readString(r)); + delete r; } void TitanicEngine::setRoomNames() { - static const char *const ROOM_NAMES[TOTAL_ROOMS] = { - "1stClassLobby", "1stClassRestaurant", "1stClassState", - "2ndClassLobby", "secClassState", "Arboretum", "FrozenArboretum", - "Bar", "BilgeRoom", "BilgeRoomWith", "BottomOfWell", "Bridge", - "CreatorsChamber", "CreatorsChamberOn", "Dome", "Home", "Lift", - "EmbLobby", "MoonEmbLobby", "MusicRoomLobby", "MusicRoom", - "ParrotLobby", "Pellerator", "PromenadeDeck", "SculptureChamber", - "SecClassLittleLift", "ServiceElevator", "SGTLeisure", "SGTLittleLift", - "SgtLobby", "SGTState", "Titania", "TopOfWell", "PlayersRoom" - }; - - for (uint idx = 0; idx < TOTAL_ROOMS; ++idx) - _roomNames[idx] = ROOM_NAMES[idx]; + Common::SeekableReadStream *r = g_vm->_filesManager->getResource("TEXT/ROOM_NAMES"); + while (r->pos() < r->size()) + _roomNames.push_back(readString(r)); + delete r; +} + +void TitanicEngine::setParserStrings() { + Common::SeekableReadStream *r; + r = g_vm->_filesManager->getResource("TEXT/REPLACEMENTS1"); + while (r->pos() < r->size()) + _replacements1.push_back(readString(r)); + delete r; + + r = g_vm->_filesManager->getResource("TEXT/REPLACEMENTS2"); + while (r->pos() < r->size()) + _replacements2.push_back(readString(r)); + delete r; + + r = g_vm->_filesManager->getResource("TEXT/REPLACEMENTS3"); + while (r->pos() < r->size()) + _replacements3.push_back(readString(r)); + delete r; + + r = g_vm->_filesManager->getResource("TEXT/PHRASES"); + while (r->pos() < r->size()) + _phrases.push_back(readString(r)); + delete r; } } // End of namespace Titanic diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index c30ad36ac2..95d1abae04 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "common/random.h" +#include "common/str-array.h" #include "common/system.h" #include "common/serializer.h" #include "engines/advancedDetector.h" @@ -102,6 +103,11 @@ private: * Sets up the list of room names */ void setRoomNames(); + + /** + * Set the replacement strings and common phrases lists used by the praser + */ + void setParserStrings(); protected: const TitanicGameDescription *_gameDescription; int _loadSaveSlot; @@ -122,11 +128,15 @@ public: TTscriptBase *_script; CExeResources _exeResources; CMovieList _activeMovies; - CString _itemNames[TOTAL_ITEMS]; - CString _itemDescriptions[TOTAL_ITEMS]; + StringArray _itemNames; + StringArray _itemDescriptions; CString _itemObjects[TOTAL_ITEMS]; - CString _itemIds[40]; - CString _roomNames[TOTAL_ROOMS]; + StringArray _itemIds; + StringArray _roomNames; + StringArray _replacements1; + StringArray _replacements2; + StringArray _replacements3; + StringArray _phrases; public: TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc); virtual ~TitanicEngine(); diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index d896923f2b..4fdaf58671 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -23,6 +23,7 @@ #include "titanic/true_talk/tt_parser.h" #include "titanic/true_talk/script_handler.h" #include "titanic/true_talk/tt_input.h" +#include "titanic/titanic.h" namespace Titanic { @@ -32,6 +33,17 @@ int TTparser::processInput(TTinput *input) { return 0; // Scan for and replace common slang and contractions with verbose versions + searchAndReplace(input->_normalizedLine, g_vm->_replacements1); + searchAndReplace(input->_normalizedLine, g_vm->_replacements2); + + // Check entire normalized line against common phrases to replace + for (uint idx = 0; idx < g_vm->_phrases.size(); idx += 2) { + if (!g_vm->_phrases[idx].compareTo(input->_normalizedLine)) + input->_normalizedLine = g_vm->_phrases[idx + 1]; + } + + // Do a further search and replace of roman numerals to decimal + searchAndReplace(input->_normalizedLine, g_vm->_replacements3); warning("TODO: TTparser::processInput"); return 0; -- cgit v1.2.3 From e16239e21fb1893e700f1a11bbc251d9915c03a7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 16 May 2016 19:29:46 -0400 Subject: TITANIC: Implemented parser replaceNumbers sub-methods --- engines/titanic/titanic.h | 12 ++++++++++++ engines/titanic/true_talk/tt_parser.cpp | 34 +++++++++++++++++++++++++++++++++ engines/titanic/true_talk/tt_parser.h | 10 ++++++++++ 3 files changed, 56 insertions(+) diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index 95d1abae04..2b08f56f7d 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -82,6 +82,17 @@ struct TitanicSavegameHeader { int _totalFrames; }; +enum NumberFlag { NF_2 = 2, NF_8 = 8, NF_10 = 0x10 }; + +struct NumberEntry { + CString _text; + int _value; + int _flags; + NumberEntry(const CString &text, int value, int flags) : + _text(text), _value(value), _flags(flags) {} +}; +typedef Common::Array NumberArray; + class TitanicEngine : public Engine { private: /** @@ -137,6 +148,7 @@ public: StringArray _replacements2; StringArray _replacements3; StringArray _phrases; + NumberArray _numbers; public: TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc); virtual ~TitanicEngine(); diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 4fdaf58671..9aa6c2ef7a 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -321,4 +321,38 @@ int TTparser::searchAndReplace(TTstring &line, int startIndex, const StringArray return startIndex; } +bool TTparser::replaceNumbers(TTstring &line, int *startIndex) { + int lineSize = line.size(); + int index = *startIndex; + if (index < 0 || index >= lineSize) + return true; + + NumberArray &numbers = g_vm->_numbers; + NumberEntry *numEntry = nullptr; + + for (uint idx = 0; idx < numbers.size(); ++idx) { + NumberEntry &ne = numbers[idx]; + if (!strncmp(line.c_str() + index, ne._text.c_str(), ne._text.size())) { + if ((ne._flags & NF_10) || (index + ne._text.size()) >= lineSize || + line[index + ne._text.size()] == ' ') { + *startIndex += ne._text.size(); + numEntry = ≠ + break; + } + } + } + + if (!numEntry || !(numEntry->_flags & NF_10)) { + // Skip to end of current word + while (*startIndex < lineSize && !Common::isSpace(line[*startIndex])) + ++*startIndex; + } + + // Skip over following spaces until start of following word is reached + while (*startIndex < lineSize && Common::isSpace(line[*startIndex])) + ++*startIndex; + + return *startIndex < lineSize; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index 1eed38d515..22a2850516 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -67,6 +67,16 @@ private: * @returns Index of the start of the following word */ static int searchAndReplace(TTstring &line, int startIndex, const StringArray &strings); + + /** + * Checks the string starting at a given index for a number representation + * such as roman numericals, spelled out numbers, etc. and replaces it with + * a plain decimal representation. + * @param line Line to check + * @param startIndex Starting index in the start to check + * @returns True if end of line hasn't been reached yet + */ + static bool replaceNumbers(TTstring &line, int *startIndex); public: CScriptHandler *_owner; int _field4; -- cgit v1.2.3 From 3878f38d8c76f2289be1f53bbecf9cda95e43067 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 16 May 2016 19:59:09 -0400 Subject: TITANIC: Move replacement string arrays into TTparser, added NUMBERS array --- devtools/create_titanic/create_titanic_dat.cpp | 122 ++++++++++++++++++++++--- engines/titanic/support/simple_file.cpp | 11 +++ engines/titanic/support/simple_file.h | 5 + engines/titanic/titanic.cpp | 41 +-------- engines/titanic/titanic.h | 21 ----- engines/titanic/true_talk/tt_parser.cpp | 69 +++++++++++--- engines/titanic/true_talk/tt_parser.h | 32 ++++++- 7 files changed, 215 insertions(+), 86 deletions(-) diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index 2f6050846a..ca55f7c5cf 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -49,7 +49,7 @@ */ #define VERSION_NUMBER 1 -#define HEADER_SIZE 0x280 +#define HEADER_SIZE 0x290 Common::File inputFile, outputFile; Common::PEResources res; @@ -110,6 +110,90 @@ static const char *const ROOM_NAMES[34] = { "SgtLobby", "SGTState", "Titania", "TopOfWell", "PlayersRoom" }; +struct NumberEntry { + const char *_text; + int _value; + uint _flags; +}; + +const NumberEntry NUMBERS[76] = { + { "a", 1, 3 }, + { "and", 0, 1 }, + { "negative", 0, 10 }, + { "minus", 0, 10 }, + { "below zeor", 0, 8 }, + { "degrees below zero", 0, 8 }, + { "nil", 0, 2 }, + { "zero", 0, 2 }, + { "one", 1, 0x12 }, + { "two", 2, 0x12 }, + { "three", 3, 0x12 }, + { "four", 4, 0x12 }, + { "five", 5, 0x12 }, + { "six", 6, 0x12 }, + { "seven", 7, 0x12 }, + { "eight", 8, 0x12 }, + { "nine", 9, 0x12 }, + { "0", 0, 2 }, + { "1", 1, 2 }, + { "2", 2, 2 }, + { "3", 3, 2 }, + { "4", 4, 2 }, + { "5", 5, 2 }, + { "6", 6, 2 }, + { "7", 7, 2 }, + { "8", 8, 2 }, + { "9", 9, 2 }, + { "first", 1, 2 }, + { "second", 2, 2 }, + { "third", 3, 2 }, + { "fourth", 4, 2 }, + { "fifth", 5, 2 }, + { "sixth", 6, 2 }, + { "seventh", 7, 2 }, + { "eighth", 8, 2 }, + { "ninth", 9, 2 }, + { "ten", 10, 2 }, + { "eleven", 11, 2 }, + { "twelve", 12, 2 }, + { "thirteen", 13, 2 }, + { "fourteen", 14, 2 }, + { "fifteen", 15, 2 }, + { "sixteen", 16, 2 }, + { "seventeen", 17, 2 }, + { "eighteen", 18, 2 }, + { "nineteen", 19, 2 }, + { "tenth", 10, 2 }, + { "eleventh", 11, 2 }, + { "twelfth", 12, 2 }, + { "thirteenth", 13, 2 }, + { "fourteenth", 14, 2 }, + { "fifteenth", 15, 2 }, + { "sixteenth", 16, 2 }, + { "seventeenth", 17, 2 }, + { "eighteenth", 18, 2 }, + { "nineteenth", 19, 2 }, + { "twenty", 20, 0x12 }, + { "thirty", 30, 0x12 }, + { "forty", 40, 0x12 }, + { "fourty", 40, 0x12 }, + { "fifty", 50, 0x12 }, + { "sixty", 60, 0x12 }, + { "seventy", 70, 0x12 }, + { "eighty", 80, 0x12 }, + { "ninety", 90, 0x12 }, + { "twentieth", 20, 2 }, + { "thirtieth", 30, 2 }, + { "fortieth", 40, 2 }, + { "fiftieth", 50, 2 }, + { "sixtieth", 60, 2 }, + { "seventieth", 70, 2 }, + { "eightieth", 80, 2 }, + { "ninetieth", 90, 2 }, + { "hundred", 100, 4 }, + { "hundredth", 100, 6 } +}; + void NORETURN_PRE error(const char *s, ...) { printf("%s\n", s); exit(1); @@ -209,6 +293,21 @@ void writeResource(const char *sectionStr, const char *resId) { writeResource(nameBuffer, file); } +void writeNumbers() { + outputFile.seek(dataOffset); + + // Iterate through writing each string + for (int idx = 0; idx < 76; ++idx) { + outputFile.writeString(NUMBERS[idx]._text); + outputFile.writeLong(NUMBERS[idx]._value); + outputFile.writeLong(NUMBERS[idx]._flags); + } + + uint size = outputFile.size() - dataOffset; + writeEntryHeader("TEXT/NUMBERS", dataOffset, size); + dataOffset += size; +} + void writeHeader() { // Write out magic string const char *MAGIC_STR = "SVTN"; @@ -219,16 +318,6 @@ void writeHeader() { } void writeData() { - writeStringArray("TEXT/ITEM_DESCRIPTIONS", ITEM_DESCRIPTIONS, 46); - writeStringArray("TEXT/ITEM_NAMES", ITEM_NAMES, 46); - writeStringArray("TEXT/ITEM_IDS", ITEM_IDS, 40); - writeStringArray("TEXT/ROOM_NAMES", ROOM_NAMES, 34); - - writeStringArray("TEXT/PHRASES", 0x21B7C8, 376); - writeStringArray("TEXT/REPLACEMENTS1", 0x21BDB0, 218); - writeStringArray("TEXT/REPLACEMENTS2", 0x21C120, 1576); - writeStringArray("TEXT/REPLACEMENTS3", 0x21D9C8, 82); - writeResource("Bitmap", "BACKDROP"); writeResource("Bitmap", "EVILTWIN"); writeResource("Bitmap", "RESTORED"); @@ -250,6 +339,17 @@ void writeData() { writeResource("TEXT", "STVOCAB.TXT"); writeResource("TEXT", "JRQUOTES.TXT"); writeResource("TEXT", 155); + + writeStringArray("TEXT/ITEM_DESCRIPTIONS", ITEM_DESCRIPTIONS, 46); + writeStringArray("TEXT/ITEM_NAMES", ITEM_NAMES, 46); + writeStringArray("TEXT/ITEM_IDS", ITEM_IDS, 40); + writeStringArray("TEXT/ROOM_NAMES", ROOM_NAMES, 34); + + writeStringArray("TEXT/PHRASES", 0x21B7C8, 376); + writeStringArray("TEXT/REPLACEMENTS1", 0x21BDB0, 218); + writeStringArray("TEXT/REPLACEMENTS2", 0x21C120, 1576); + writeStringArray("TEXT/REPLACEMENTS3", 0x21D9C8, 82); + writeNumbers(); } int main(int argc, char *argv[]) { diff --git a/engines/titanic/support/simple_file.cpp b/engines/titanic/support/simple_file.cpp index f4351f920f..45b5c8a7cb 100644 --- a/engines/titanic/support/simple_file.cpp +++ b/engines/titanic/support/simple_file.cpp @@ -25,6 +25,17 @@ namespace Titanic { +CString readStringFromStream(Common::SeekableReadStream *s) { + CString result; + char c; + while ((c = s->readByte()) != '\0') + result += c; + + return result; +} + +/*------------------------------------------------------------------------*/ + bool File::open(const Common::String &name) { if (!Common::File::open(name)) error("Could not open file - %s", name.c_str()); diff --git a/engines/titanic/support/simple_file.h b/engines/titanic/support/simple_file.h index cf89e5d72c..bca96a631a 100644 --- a/engines/titanic/support/simple_file.h +++ b/engines/titanic/support/simple_file.h @@ -269,6 +269,11 @@ public: Common::SeekableReadStream *readStream() const { return _inStream; } }; +/** + * General purpose support method for reading an ASCIIZ string from a stream + */ +CString readStringFromStream(Common::SeekableReadStream *s); + } // End of namespace Titanic #endif /* TITANIC_SIMPLE_FILE_H */ diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index 38d536cab6..da9be20808 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -103,7 +103,6 @@ void TitanicEngine::initialize() { setItemNames(); setRoomNames(); - setParserStrings(); _window->applicationStarting(); } @@ -131,60 +130,28 @@ Common::Error TitanicEngine::run() { return Common::kNoError; } -static CString readString(Common::SeekableReadStream *s) { - CString result; - char c; - while ((c = s->readByte()) != '\0') - result += c; - - return result; -} - void TitanicEngine::setItemNames() { Common::SeekableReadStream *r; r = g_vm->_filesManager->getResource("TEXT/ITEM_NAMES"); while (r->pos() < r->size()) - _itemNames.push_back(readString(r)); + _itemNames.push_back(readStringFromStream(r)); delete r; r = g_vm->_filesManager->getResource("TEXT/ITEM_DESCRIPTIONS"); while (r->pos() < r->size()) - _itemNames.push_back(readString(r)); + _itemNames.push_back(readStringFromStream(r)); delete r; r = g_vm->_filesManager->getResource("TEXT/ITEM_IDS"); while (r->pos() < r->size()) - _itemIds.push_back(readString(r)); + _itemIds.push_back(readStringFromStream(r)); delete r; } void TitanicEngine::setRoomNames() { Common::SeekableReadStream *r = g_vm->_filesManager->getResource("TEXT/ROOM_NAMES"); while (r->pos() < r->size()) - _roomNames.push_back(readString(r)); - delete r; -} - -void TitanicEngine::setParserStrings() { - Common::SeekableReadStream *r; - r = g_vm->_filesManager->getResource("TEXT/REPLACEMENTS1"); - while (r->pos() < r->size()) - _replacements1.push_back(readString(r)); - delete r; - - r = g_vm->_filesManager->getResource("TEXT/REPLACEMENTS2"); - while (r->pos() < r->size()) - _replacements2.push_back(readString(r)); - delete r; - - r = g_vm->_filesManager->getResource("TEXT/REPLACEMENTS3"); - while (r->pos() < r->size()) - _replacements3.push_back(readString(r)); - delete r; - - r = g_vm->_filesManager->getResource("TEXT/PHRASES"); - while (r->pos() < r->size()) - _phrases.push_back(readString(r)); + _roomNames.push_back(readStringFromStream(r)); delete r; } diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index 2b08f56f7d..768f3348b7 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -82,17 +82,6 @@ struct TitanicSavegameHeader { int _totalFrames; }; -enum NumberFlag { NF_2 = 2, NF_8 = 8, NF_10 = 0x10 }; - -struct NumberEntry { - CString _text; - int _value; - int _flags; - NumberEntry(const CString &text, int value, int flags) : - _text(text), _value(value), _flags(flags) {} -}; -typedef Common::Array NumberArray; - class TitanicEngine : public Engine { private: /** @@ -114,11 +103,6 @@ private: * Sets up the list of room names */ void setRoomNames(); - - /** - * Set the replacement strings and common phrases lists used by the praser - */ - void setParserStrings(); protected: const TitanicGameDescription *_gameDescription; int _loadSaveSlot; @@ -144,11 +128,6 @@ public: CString _itemObjects[TOTAL_ITEMS]; StringArray _itemIds; StringArray _roomNames; - StringArray _replacements1; - StringArray _replacements2; - StringArray _replacements3; - StringArray _phrases; - NumberArray _numbers; public: TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc); virtual ~TitanicEngine(); diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 9aa6c2ef7a..24361f9e03 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -27,23 +27,62 @@ namespace Titanic { +TTparser::TTparser(CScriptHandler *owner) : _owner(owner), _field4(0), + _input(nullptr), _fieldC(0), _field10(0), _field14(0), _field18(0) { + loadArrays(); +} + +void TTparser::loadArrays() { + Common::SeekableReadStream *r; + r = g_vm->_filesManager->getResource("TEXT/REPLACEMENTS1"); + while (r->pos() < r->size()) + _replacements1.push_back(readStringFromStream(r)); + delete r; + + r = g_vm->_filesManager->getResource("TEXT/REPLACEMENTS2"); + while (r->pos() < r->size()) + _replacements2.push_back(readStringFromStream(r)); + delete r; + + r = g_vm->_filesManager->getResource("TEXT/REPLACEMENTS3"); + while (r->pos() < r->size()) + _replacements3.push_back(readStringFromStream(r)); + delete r; + + r = g_vm->_filesManager->getResource("TEXT/PHRASES"); + while (r->pos() < r->size()) + _phrases.push_back(readStringFromStream(r)); + delete r; + + r = g_vm->_filesManager->getResource("TEXT/NUMBERS"); + while (r->pos() < r->size()) { + NumberEntry ne; + ne._text = readStringFromStream(r); + ne._value = r->readSint32LE(); + ne._flags = r->readUint32LE(); + _numbers.push_back(ne); + } + delete r; + +} + int TTparser::processInput(TTinput *input) { _input = input; if (normalize(input)) return 0; // Scan for and replace common slang and contractions with verbose versions - searchAndReplace(input->_normalizedLine, g_vm->_replacements1); - searchAndReplace(input->_normalizedLine, g_vm->_replacements2); + searchAndReplace(input->_normalizedLine, _replacements1); + searchAndReplace(input->_normalizedLine, _replacements2); // Check entire normalized line against common phrases to replace - for (uint idx = 0; idx < g_vm->_phrases.size(); idx += 2) { - if (!g_vm->_phrases[idx].compareTo(input->_normalizedLine)) - input->_normalizedLine = g_vm->_phrases[idx + 1]; + for (uint idx = 0; idx < _phrases.size(); idx += 2) { + if (!_phrases[idx].compareTo(input->_normalizedLine)) + input->_normalizedLine = _phrases[idx + 1]; } // Do a further search and replace of roman numerals to decimal - searchAndReplace(input->_normalizedLine, g_vm->_replacements3); + searchAndReplace(input->_normalizedLine, _replacements3); warning("TODO: TTparser::processInput"); return 0; @@ -321,17 +360,18 @@ int TTparser::searchAndReplace(TTstring &line, int startIndex, const StringArray return startIndex; } -bool TTparser::replaceNumbers(TTstring &line, int *startIndex) { +const NumberEntry *TTparser::replaceNumbers(TTstring &line, int *startIndex) { int lineSize = line.size(); int index = *startIndex; - if (index < 0 || index >= lineSize) - return true; + if (index < 0 || index >= lineSize) { + *startIndex = -1; + return nullptr; + } - NumberArray &numbers = g_vm->_numbers; NumberEntry *numEntry = nullptr; - for (uint idx = 0; idx < numbers.size(); ++idx) { - NumberEntry &ne = numbers[idx]; + for (uint idx = 0; idx < _numbers.size(); ++idx) { + NumberEntry &ne = _numbers[idx]; if (!strncmp(line.c_str() + index, ne._text.c_str(), ne._text.size())) { if ((ne._flags & NF_10) || (index + ne._text.size()) >= lineSize || line[index + ne._text.size()] == ' ') { @@ -352,7 +392,10 @@ bool TTparser::replaceNumbers(TTstring &line, int *startIndex) { while (*startIndex < lineSize && Common::isSpace(line[*startIndex])) ++*startIndex; - return *startIndex < lineSize; + if (*startIndex >= lineSize) + *startIndex = -1; + + return numEntry; } } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index 22a2850516..7e4e97f1ff 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -24,13 +24,38 @@ #define TITANIC_TT_PARSER_H #include "titanic/true_talk/tt_input.h" +#include "titanic/true_talk/tt_string.h" namespace Titanic { +enum NumberFlag { NF_2 = 2, NF_8 = 8, NF_10 = 0x10 }; + class CScriptHandler; +struct NumberEntry { + CString _text; + int _value; + int _flags; + + NumberEntry() : _value(0), _flags(0) {} + NumberEntry(const CString &text, int value, int flags) : + _text(text), _value(value), _flags(flags) {} +}; +typedef Common::Array NumberArray; + class TTparser { private: + StringArray _replacements1; + StringArray _replacements2; + StringArray _replacements3; + StringArray _phrases; + NumberArray _numbers; +private: + /** + * Loads the various replacement string data arrays + */ + void loadArrays(); + /** * Normalizes a passed input, taking care of things like removing extra * spaces and lowercasing everything @@ -74,9 +99,9 @@ private: * a plain decimal representation. * @param line Line to check * @param startIndex Starting index in the start to check - * @returns True if end of line hasn't been reached yet + * @returns Pointer to matching number entry, if match occurred */ - static bool replaceNumbers(TTstring &line, int *startIndex); + const NumberEntry *replaceNumbers(TTstring &line, int *startIndex); public: CScriptHandler *_owner; int _field4; @@ -86,8 +111,7 @@ public: int _field14; int _field18; public: - TTparser(CScriptHandler *owner) : _owner(owner), _field4(0), - _input(nullptr), _fieldC(0), _field10(0), _field14(0), _field18(0) {} + TTparser(CScriptHandler *owner); /** * Gets passed a newly created input wrapper during conversation text processing -- cgit v1.2.3 From 361ac2cfe4c6e778ad5eeafac94bbc6927aeaf1b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 16 May 2016 23:13:24 -0400 Subject: TITANIC: Implemented secondary replaceNumbers method --- engines/titanic/true_talk/tt_parser.cpp | 54 +++++++++++++++++++++++++++++++-- engines/titanic/true_talk/tt_parser.h | 14 +++++++-- 2 files changed, 64 insertions(+), 4 deletions(-) diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 24361f9e03..9787d1cd98 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -360,7 +360,57 @@ int TTparser::searchAndReplace(TTstring &line, int startIndex, const StringArray return startIndex; } -const NumberEntry *TTparser::replaceNumbers(TTstring &line, int *startIndex) { +int TTparser::replaceNumbers(TTstring &line, int startIndex) { + int index = startIndex; + const NumberEntry *numEntry = replaceNumbers2(line, &index); + if (!numEntry || !(numEntry->_flags & NF_2)) + return index; + + bool flag1 = false, flag2 = false, flag3 = false; + int total = 0, factor = 0; + + do { + if (numEntry->_flags & NF_1) { + flag2 = true; + if (numEntry->_flags & NF_8) + flag1 = true; + + if (numEntry->_flags & NF_4) { + flag3 = true; + factor *= numEntry->_value; + } + + if (numEntry->_flags & NF_2) { + if (flag3) { + total += factor; + factor = 0; + } + + factor += numEntry->_value; + } + } + } while (replaceNumbers2(line, &index)); + + if (!flag2) + return index; + + if (index >= 0) { + if (line[index - 1] != ' ') + return index; + } + + total += factor; + CTrueTalkManager::_v1 = total; + if (flag1) + total = -total; + + CString numStr = CString::format("%d", total); + line = CString(line.c_str(), line.c_str() + startIndex) + numStr + + CString(line.c_str() + index); + return index; +} + +const NumberEntry *TTparser::replaceNumbers2(TTstring &line, int *startIndex) { int lineSize = line.size(); int index = *startIndex; if (index < 0 || index >= lineSize) { @@ -373,7 +423,7 @@ const NumberEntry *TTparser::replaceNumbers(TTstring &line, int *startIndex) { for (uint idx = 0; idx < _numbers.size(); ++idx) { NumberEntry &ne = _numbers[idx]; if (!strncmp(line.c_str() + index, ne._text.c_str(), ne._text.size())) { - if ((ne._flags & NF_10) || (index + ne._text.size()) >= lineSize || + if ((ne._flags & NF_10) || (index + (int)ne._text.size()) >= lineSize || line[index + ne._text.size()] == ' ') { *startIndex += ne._text.size(); numEntry = ≠ diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index 7e4e97f1ff..171c91d470 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -28,7 +28,7 @@ namespace Titanic { -enum NumberFlag { NF_2 = 2, NF_8 = 8, NF_10 = 0x10 }; +enum NumberFlag { NF_1 = 1, NF_2 = 2, NF_4 = 4, NF_8 = 8, NF_10 = 0x10 }; class CScriptHandler; @@ -93,6 +93,16 @@ private: */ static int searchAndReplace(TTstring &line, int startIndex, const StringArray &strings); + /** + * Checks the string starting at a given index for a number representation + * such as roman numericals, spelled out numbers, etc. and replaces it with + * a plain decimal representation. + * @param line Line to check + * @param startIndex Starting index in the start to check + * @returns Index of the start of the following word, or -1 if at end of line + */ + int replaceNumbers(TTstring &line, int startIndex); + /** * Checks the string starting at a given index for a number representation * such as roman numericals, spelled out numbers, etc. and replaces it with @@ -101,7 +111,7 @@ private: * @param startIndex Starting index in the start to check * @returns Pointer to matching number entry, if match occurred */ - const NumberEntry *replaceNumbers(TTstring &line, int *startIndex); + const NumberEntry *replaceNumbers2(TTstring &line, int *startIndex); public: CScriptHandler *_owner; int _field4; -- cgit v1.2.3 From a7c1b2fc6bb7d158f8a48664dd07b4d03f4dc1d5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 17 May 2016 07:19:13 -0400 Subject: TITANIC: Finished TTparser processInput --- engines/titanic/true_talk/tt_parser.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 9787d1cd98..46eb50daa1 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -84,7 +84,24 @@ int TTparser::processInput(TTinput *input) { // Do a further search and replace of roman numerals to decimal searchAndReplace(input->_normalizedLine, _replacements3); - warning("TODO: TTparser::processInput"); + // Replace any roman numerals, spelled out words, etc. with decimal numbers + CTrueTalkManager::_v1 = -1000; + int idx = 0; + do { + idx = replaceNumbers(input->_normalizedLine, idx); + } while (idx >= 0); + + if (CTrueTalkManager::_v1 == -1000 && !input->_normalizedLine.empty()) { + // Scan the text for any numeric digits + for (const char *strP = input->_normalizedLine.c_str(); *strP; ++strP) { + if (Common::isDigit(*strP)) { + // Found digit, so convert it and any following ones + CTrueTalkManager::_v1 = atoi(strP); + break; + } + } + } + return 0; } -- cgit v1.2.3 From 39b85d845b008613c0c5ce5eb614159362ab1797 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 17 May 2016 07:26:31 -0400 Subject: TITANIC: Changed parser & script processInput methods to preprocess --- engines/titanic/true_talk/script_handler.cpp | 6 +++--- engines/titanic/true_talk/tt_parser.cpp | 2 +- engines/titanic/true_talk/tt_parser.h | 5 +++-- engines/titanic/true_talk/tt_script_base.cpp | 4 ++-- engines/titanic/true_talk/tt_script_base.h | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index 2e2a148e26..0b600f9be0 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -64,9 +64,9 @@ int CScriptHandler::processInput(TTroomScript *roomScript, TTnpcScript *npcScrip return SS_5; TTinput *input = new TTinput(_inputCtr++, line, this, roomScript, npcScript); - _parser.processInput(input); - roomScript->processInput(input); - npcScript->processInput(input); + _parser.preprocess(input); + roomScript->preprocess(input); + npcScript->preprocess(input); warning("TODO: CScriptHandler::processInput"); diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 46eb50daa1..66cb57bcd4 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -66,7 +66,7 @@ void TTparser::loadArrays() { } -int TTparser::processInput(TTinput *input) { +int TTparser::preprocess(TTinput *input) { _input = input; if (normalize(input)) return 0; diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index 171c91d470..4dbc4d4c48 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -124,9 +124,10 @@ public: TTparser(CScriptHandler *owner); /** - * Gets passed a newly created input wrapper during conversation text processing + * Preprocesses the passed input text, to handle things like lowercasing + * all the words, and replcaing common slang with their full equivalents */ - int processInput(TTinput *input); + int preprocess(TTinput *input); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_script_base.cpp b/engines/titanic/true_talk/tt_script_base.cpp index 88f06a493e..0a14107974 100644 --- a/engines/titanic/true_talk/tt_script_base.cpp +++ b/engines/titanic/true_talk/tt_script_base.cpp @@ -73,8 +73,8 @@ void TTscriptBase::reset() { _field48 = 0; } -int TTscriptBase::processInput(TTinput *input) { - warning("TODO: TTscriptBase::processInput"); +int TTscriptBase::preprocess(TTinput *input) { + warning("TODO: TTscriptBase::preprocess"); return 0; } diff --git a/engines/titanic/true_talk/tt_script_base.h b/engines/titanic/true_talk/tt_script_base.h index 12abb5ccda..820d2691e4 100644 --- a/engines/titanic/true_talk/tt_script_base.h +++ b/engines/titanic/true_talk/tt_script_base.h @@ -64,7 +64,7 @@ public: /** * Gets passed a newly created input wrapper during conversation text processing */ - int processInput(TTinput *input); + int preprocess(TTinput *input); virtual void proc2(int v); -- cgit v1.2.3 From aead3a0083edd7ac5e1f748f422ee25695676a4a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 17 May 2016 13:52:11 -0400 Subject: TITANIC: Beginnings of TThist class --- engines/titanic/module.mk | 1 + engines/titanic/true_talk/tt_hist.cpp | 32 ++++++++++++++++++++ engines/titanic/true_talk/tt_hist.h | 45 ++++++++++++++++++++++++++++ engines/titanic/true_talk/tt_npc_script.h | 1 - engines/titanic/true_talk/tt_script_base.cpp | 10 ++++--- engines/titanic/true_talk/tt_script_base.h | 3 +- 6 files changed, 86 insertions(+), 6 deletions(-) create mode 100644 engines/titanic/true_talk/tt_hist.cpp create mode 100644 engines/titanic/true_talk/tt_hist.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index f8fe8f50b1..7972fa1c4f 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -462,6 +462,7 @@ MODULE_OBJS := \ true_talk/true_talk_manager.o \ true_talk/tt_action.o \ true_talk/tt_adj.o \ + true_talk/tt_hist.o \ true_talk/tt_input.o \ true_talk/tt_major_word.o \ true_talk/tt_npc_script.o \ diff --git a/engines/titanic/true_talk/tt_hist.cpp b/engines/titanic/true_talk/tt_hist.cpp new file mode 100644 index 0000000000..8c9aeb3684 --- /dev/null +++ b/engines/titanic/true_talk/tt_hist.cpp @@ -0,0 +1,32 @@ +/* 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 "titanic/true_talk/tt_hist.h" +#include "titanic/true_talk/tt_input.h" + +namespace Titanic { + +TThist::TThist(TTinput *input) { + // TODO +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_hist.h b/engines/titanic/true_talk/tt_hist.h new file mode 100644 index 0000000000..f910e6eb5a --- /dev/null +++ b/engines/titanic/true_talk/tt_hist.h @@ -0,0 +1,45 @@ +/* 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. + * + */ + +#ifndef TITANIC_TT_HIST_H +#define TITANIC_TT_HIST_H + +namespace Titanic { + +class TTinput; + +class TThist { +protected: + int _field0; + TTinput *_input; +public: + TThist(TTinput *input); +}; + +class TTscriptHist : public TThist { +public: + TTscriptHist(TTinput *input) : TThist(input) {} +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_HIST_H */ diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 58c1d346f5..29ab08f458 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -28,7 +28,6 @@ namespace Titanic { - class TTnpcScriptBase : public TTscriptBase { protected: int _field54; diff --git a/engines/titanic/true_talk/tt_script_base.cpp b/engines/titanic/true_talk/tt_script_base.cpp index 0a14107974..092e5bb6ea 100644 --- a/engines/titanic/true_talk/tt_script_base.cpp +++ b/engines/titanic/true_talk/tt_script_base.cpp @@ -28,7 +28,7 @@ namespace Titanic { TTscriptBase::TTscriptBase(int v1, const char *charClass, int v2, const char *charName, int v3, int v4, int v5, int v6, int v7) : _charName(charName), _charClass(charClass), - _field4(0), _field8(0), _fieldC(0), + _field4(0), _field8(0), _hist(nullptr), _field20(0), _field24(0), _field28(0), _field2C(0), _field30(0), _field34(0), _field38(0), _field3C(0), _field40(0), _field44(0), _field48(0), _status(0) { @@ -59,7 +59,7 @@ bool TTscriptBase::areNamesValid() { void TTscriptBase::reset() { _field4 = 0; _field8 = 4; - _fieldC = 0; + _hist = nullptr; _field20 = 0; _field24 = -1; _field28 = -1; @@ -74,8 +74,10 @@ void TTscriptBase::reset() { } int TTscriptBase::preprocess(TTinput *input) { - warning("TODO: TTscriptBase::preprocess"); - return 0; + delete _hist; + _hist = new TTscriptHist(input); + + return _hist ? SS_VALID : SS_7; } void TTscriptBase::proc2(int v) { diff --git a/engines/titanic/true_talk/tt_script_base.h b/engines/titanic/true_talk/tt_script_base.h index 820d2691e4..f55d06c799 100644 --- a/engines/titanic/true_talk/tt_script_base.h +++ b/engines/titanic/true_talk/tt_script_base.h @@ -24,6 +24,7 @@ #define TITANIC_TT_SCRIPT_BASE_H #include "titanic/true_talk/tt_string.h" +#include "titanic/true_talk/tt_hist.h" namespace Titanic { @@ -39,7 +40,7 @@ private: protected: int _field4; int _field8; - int _fieldC; + TThist *_hist; TTstring _charName, _charClass; int _field20; int _field24; -- cgit v1.2.3 From 5da19b674d3b9d24517a266e369728f3b5c2957a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 17 May 2016 17:54:59 -0400 Subject: TITANIC: Changed TTinput to TTsentence to match original --- engines/titanic/module.mk | 2 +- engines/titanic/true_talk/script_handler.cpp | 12 ++--- engines/titanic/true_talk/tt_hist.cpp | 4 +- engines/titanic/true_talk/tt_hist.h | 8 +-- engines/titanic/true_talk/tt_input.cpp | 47 ---------------- engines/titanic/true_talk/tt_input.h | 80 ---------------------------- engines/titanic/true_talk/tt_parser.cpp | 52 +++++++++--------- engines/titanic/true_talk/tt_parser.h | 8 +-- engines/titanic/true_talk/tt_script_base.cpp | 4 +- engines/titanic/true_talk/tt_script_base.h | 4 +- engines/titanic/true_talk/tt_sentence.cpp | 47 ++++++++++++++++ engines/titanic/true_talk/tt_sentence.h | 80 ++++++++++++++++++++++++++++ 12 files changed, 174 insertions(+), 174 deletions(-) delete mode 100644 engines/titanic/true_talk/tt_input.cpp delete mode 100644 engines/titanic/true_talk/tt_input.h create mode 100644 engines/titanic/true_talk/tt_sentence.cpp create mode 100644 engines/titanic/true_talk/tt_sentence.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 7972fa1c4f..9e10577758 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -463,7 +463,6 @@ MODULE_OBJS := \ true_talk/tt_action.o \ true_talk/tt_adj.o \ true_talk/tt_hist.o \ - true_talk/tt_input.o \ true_talk/tt_major_word.o \ true_talk/tt_npc_script.o \ true_talk/tt_parser.o \ @@ -472,6 +471,7 @@ MODULE_OBJS := \ true_talk/tt_room_script.o \ true_talk/tt_script_base.o \ true_talk/tt_scripts.o \ + true_talk/tt_sentence.o \ true_talk/tt_string.o \ true_talk/tt_string_node.o \ true_talk/tt_synonym.o \ diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index 0b600f9be0..ab5b97122d 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -21,7 +21,7 @@ */ #include "titanic/true_talk/script_handler.h" -#include "titanic/true_talk/tt_input.h" +#include "titanic/true_talk/tt_sentence.h" #include "titanic/titanic.h" namespace Titanic { @@ -63,15 +63,15 @@ int CScriptHandler::processInput(TTroomScript *roomScript, TTnpcScript *npcScrip if (!roomScript || !line.isValid()) return SS_5; - TTinput *input = new TTinput(_inputCtr++, line, this, roomScript, npcScript); - _parser.preprocess(input); - roomScript->preprocess(input); - npcScript->preprocess(input); + TTsentence *sentence = new TTsentence(_inputCtr++, line, this, roomScript, npcScript); + _parser.preprocess(sentence); + roomScript->preprocess(sentence); + npcScript->preprocess(sentence); warning("TODO: CScriptHandler::processInput"); // TODO - delete input; + delete sentence; return SS_VALID; } diff --git a/engines/titanic/true_talk/tt_hist.cpp b/engines/titanic/true_talk/tt_hist.cpp index 8c9aeb3684..e0f6cb88b6 100644 --- a/engines/titanic/true_talk/tt_hist.cpp +++ b/engines/titanic/true_talk/tt_hist.cpp @@ -21,11 +21,11 @@ */ #include "titanic/true_talk/tt_hist.h" -#include "titanic/true_talk/tt_input.h" +#include "titanic/true_talk/tt_sentence.h" namespace Titanic { -TThist::TThist(TTinput *input) { +TThist::TThist(TTsentence *sentence) { // TODO } diff --git a/engines/titanic/true_talk/tt_hist.h b/engines/titanic/true_talk/tt_hist.h index f910e6eb5a..7ba0032a4d 100644 --- a/engines/titanic/true_talk/tt_hist.h +++ b/engines/titanic/true_talk/tt_hist.h @@ -25,19 +25,19 @@ namespace Titanic { -class TTinput; +class TTsentence; class TThist { protected: int _field0; - TTinput *_input; + TTsentence *_input; public: - TThist(TTinput *input); + TThist(TTsentence *sentence); }; class TTscriptHist : public TThist { public: - TTscriptHist(TTinput *input) : TThist(input) {} + TTscriptHist(TTsentence *sentence) : TThist(sentence) {} }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_input.cpp b/engines/titanic/true_talk/tt_input.cpp deleted file mode 100644 index 102f86fc27..0000000000 --- a/engines/titanic/true_talk/tt_input.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* 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 "titanic/true_talk/tt_input.h" -#include "titanic/true_talk/script_handler.h" - -namespace Titanic { - -TTinputSubBase::TTinputSubBase() : _field0(0), _field4(0), _field8(0), - _fieldC(0), _field10(0), _field14(0), _field18(0), _field1C(0), - _field20(0), _field24(0) { -} - -/*------------------------------------------------------------------------*/ - -TTinput::TTinput(int inputCtr, const TTstring &line, CScriptHandler *owner, - TTroomScript *roomScript, TTnpcScript *npcScript) : - _owner(owner), _field2C(1), _inputCtr(inputCtr), _field34(0), - _field38(0), _initialLine(line), _field4C(0), _roomScript(roomScript), - _npcScript(npcScript), _field58(0), _field5C(0) { - _status = _initialLine.isValid() && _normalizedLine.isValid() ? SS_11: SS_VALID; -} - -void TTinput::set38(int val) { - _field38 = val; -} - -} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_input.h b/engines/titanic/true_talk/tt_input.h deleted file mode 100644 index e378e9b3ab..0000000000 --- a/engines/titanic/true_talk/tt_input.h +++ /dev/null @@ -1,80 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_TT_INPUT_H -#define TITANIC_TT_INPUT_H - -#include "titanic/true_talk/tt_npc_script.h" -#include "titanic/true_talk/tt_room_script.h" -#include "titanic/true_talk/tt_string.h" - -namespace Titanic { - -class CScriptHandler; - -class TTinputSubBase { -public: - int _field0; - int _field4; - int _field8; - int _fieldC; - int _field10; - int _field14; - int _field18; - int _field1C; - int _field20; - int _field24; -public: - TTinputSubBase(); -}; - -class TTinputSub : public TTinputSubBase { -public: -}; - -class TTinput { -private: - CScriptHandler *_owner; - TTinputSub _sub; - int _field2C; - int _inputCtr; - int _field34; - int _field38; - int _field4C; - TTroomScript *_roomScript; - TTnpcScript *_npcScript; - int _field58; - int _field5C; - int _status; -public: - TTstring _initialLine; - TTstring _normalizedLine; -public: - TTinput(int inputCtr, const TTstring &line, CScriptHandler *owner, - TTroomScript *roomScript, TTnpcScript *npcScript); - - void set38(int v); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_TT_INPUT_H */ diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 66cb57bcd4..a965c70394 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -22,13 +22,13 @@ #include "titanic/true_talk/tt_parser.h" #include "titanic/true_talk/script_handler.h" -#include "titanic/true_talk/tt_input.h" +#include "titanic/true_talk/tt_sentence.h" #include "titanic/titanic.h" namespace Titanic { TTparser::TTparser(CScriptHandler *owner) : _owner(owner), _field4(0), - _input(nullptr), _fieldC(0), _field10(0), _field14(0), _field18(0) { + _sentence(nullptr), _fieldC(0), _field10(0), _field14(0), _field18(0) { loadArrays(); } @@ -66,34 +66,34 @@ void TTparser::loadArrays() { } -int TTparser::preprocess(TTinput *input) { - _input = input; - if (normalize(input)) +int TTparser::preprocess(TTsentence *sentence) { + _sentence = sentence; + if (normalize(sentence)) return 0; // Scan for and replace common slang and contractions with verbose versions - searchAndReplace(input->_normalizedLine, _replacements1); - searchAndReplace(input->_normalizedLine, _replacements2); + searchAndReplace(sentence->_normalizedLine, _replacements1); + searchAndReplace(sentence->_normalizedLine, _replacements2); // Check entire normalized line against common phrases to replace for (uint idx = 0; idx < _phrases.size(); idx += 2) { - if (!_phrases[idx].compareTo(input->_normalizedLine)) - input->_normalizedLine = _phrases[idx + 1]; + if (!_phrases[idx].compareTo(sentence->_normalizedLine)) + sentence->_normalizedLine = _phrases[idx + 1]; } // Do a further search and replace of roman numerals to decimal - searchAndReplace(input->_normalizedLine, _replacements3); + searchAndReplace(sentence->_normalizedLine, _replacements3); // Replace any roman numerals, spelled out words, etc. with decimal numbers CTrueTalkManager::_v1 = -1000; int idx = 0; do { - idx = replaceNumbers(input->_normalizedLine, idx); + idx = replaceNumbers(sentence->_normalizedLine, idx); } while (idx >= 0); - if (CTrueTalkManager::_v1 == -1000 && !input->_normalizedLine.empty()) { + if (CTrueTalkManager::_v1 == -1000 && !sentence->_normalizedLine.empty()) { // Scan the text for any numeric digits - for (const char *strP = input->_normalizedLine.c_str(); *strP; ++strP) { + for (const char *strP = sentence->_normalizedLine.c_str(); *strP; ++strP) { if (Common::isDigit(*strP)) { // Found digit, so convert it and any following ones CTrueTalkManager::_v1 = atoi(strP); @@ -105,9 +105,9 @@ int TTparser::preprocess(TTinput *input) { return 0; } -int TTparser::normalize(TTinput *input) { +int TTparser::normalize(TTsentence *sentence) { TTstring *destLine = new TTstring(); - const TTstring &srcLine = input->_initialLine; + const TTstring &srcLine = sentence->_initialLine; int srcSize = srcLine.size(); int savedIndex = 0; int counter1 = 0; @@ -124,7 +124,7 @@ int TTparser::normalize(TTinput *input) { (*destLine) += toupper(c); } else if (Common::isDigit(c)) { if (c == '0' && isEmoticon(srcLine, index)) { - input->set38(10); + sentence->set38(10); } else { // Iterate through all the digits of the number (*destLine) += c; @@ -135,7 +135,7 @@ int TTparser::normalize(TTinput *input) { bool flag = false; switch (c) { case '!': - input->set38(3); + sentence->set38(3); break; case '\'': @@ -144,13 +144,13 @@ int TTparser::normalize(TTinput *input) { break; case '.': - input->set38(1); + sentence->set38(1); break; case ':': commandVal = isEmoticon(srcLine, index); if (commandVal) { - input->set38(commandVal); + sentence->set38(commandVal); index += 2; } else { flag = true; @@ -160,10 +160,10 @@ int TTparser::normalize(TTinput *input) { case ';': commandVal = isEmoticon(srcLine, index); if (commandVal == 6) { - input->set38(7); + sentence->set38(7); index += 2; } else if (commandVal != 0) { - input->set38(commandVal); + sentence->set38(commandVal); index += 2; } break; @@ -172,7 +172,7 @@ int TTparser::normalize(TTinput *input) { ++index; commandVal = isEmoticon(srcLine, index); if (commandVal == 6) { - input->set38(12); + sentence->set38(12); } else { --index; flag = true; @@ -183,7 +183,7 @@ int TTparser::normalize(TTinput *input) { ++index; commandVal = isEmoticon(srcLine, index); if (commandVal == 6 || commandVal == 9) { - input->set38(11); + sentence->set38(11); } else { --index; flag = true; @@ -191,7 +191,7 @@ int TTparser::normalize(TTinput *input) { break; case '?': - input->set38(2); + sentence->set38(2); break; default: @@ -207,14 +207,14 @@ int TTparser::normalize(TTinput *input) { } if (counter1 >= 4) - input->set38(4); + sentence->set38(4); // Remove any trailing spaces while (destLine->hasSuffix(" ")) destLine->deleteLastChar(); // Copy out the normalized line - input->_normalizedLine = *destLine; + sentence->_normalizedLine = *destLine; delete destLine; return 0; diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index 4dbc4d4c48..da63336783 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -23,7 +23,7 @@ #ifndef TITANIC_TT_PARSER_H #define TITANIC_TT_PARSER_H -#include "titanic/true_talk/tt_input.h" +#include "titanic/true_talk/tt_sentence.h" #include "titanic/true_talk/tt_string.h" namespace Titanic { @@ -60,7 +60,7 @@ private: * Normalizes a passed input, taking care of things like removing extra * spaces and lowercasing everything */ - int normalize(TTinput *input); + int normalize(TTsentence *sentence); /** * Submethod called by normalize to handle expanding contacted word pairs @@ -115,7 +115,7 @@ private: public: CScriptHandler *_owner; int _field4; - TTinput *_input; + TTsentence *_sentence; int _fieldC; int _field10; int _field14; @@ -127,7 +127,7 @@ public: * Preprocesses the passed input text, to handle things like lowercasing * all the words, and replcaing common slang with their full equivalents */ - int preprocess(TTinput *input); + int preprocess(TTsentence *sentence); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_script_base.cpp b/engines/titanic/true_talk/tt_script_base.cpp index 092e5bb6ea..16783dec0f 100644 --- a/engines/titanic/true_talk/tt_script_base.cpp +++ b/engines/titanic/true_talk/tt_script_base.cpp @@ -73,9 +73,9 @@ void TTscriptBase::reset() { _field48 = 0; } -int TTscriptBase::preprocess(TTinput *input) { +int TTscriptBase::preprocess(TTsentence *sentence) { delete _hist; - _hist = new TTscriptHist(input); + _hist = new TTscriptHist(sentence); return _hist ? SS_VALID : SS_7; } diff --git a/engines/titanic/true_talk/tt_script_base.h b/engines/titanic/true_talk/tt_script_base.h index f55d06c799..9bcb33467d 100644 --- a/engines/titanic/true_talk/tt_script_base.h +++ b/engines/titanic/true_talk/tt_script_base.h @@ -32,7 +32,7 @@ enum ScriptChangedResult { SCR_1 = 1, SCR_2 = 2, SCR_3 = 3, SCR_4 = 4, SCR_5 = 5 }; -class TTinput; +class TTsentence; class TTscriptBase { private: @@ -65,7 +65,7 @@ public: /** * Gets passed a newly created input wrapper during conversation text processing */ - int preprocess(TTinput *input); + int preprocess(TTsentence *sentence); virtual void proc2(int v); diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp new file mode 100644 index 0000000000..e5968bd35a --- /dev/null +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -0,0 +1,47 @@ +/* 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 "titanic/true_talk/tt_sentence.h" +#include "titanic/true_talk/script_handler.h" + +namespace Titanic { + +TTsentenceSubBase::TTsentenceSubBase() : _field0(0), _field4(0), _field8(0), + _fieldC(0), _field10(0), _field14(0), _field18(0), _field1C(0), + _field20(0), _field24(0) { +} + +/*------------------------------------------------------------------------*/ + +TTsentence::TTsentence(int inputCtr, const TTstring &line, CScriptHandler *owner, + TTroomScript *roomScript, TTnpcScript *npcScript) : + _owner(owner), _field2C(1), _inputCtr(inputCtr), _field34(0), + _field38(0), _initialLine(line), _field4C(0), _roomScript(roomScript), + _npcScript(npcScript), _field58(0), _field5C(0) { + _status = _initialLine.isValid() && _normalizedLine.isValid() ? SS_11: SS_VALID; +} + +void TTsentence::set38(int val) { + _field38 = val; +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h new file mode 100644 index 0000000000..94d7bfc8d9 --- /dev/null +++ b/engines/titanic/true_talk/tt_sentence.h @@ -0,0 +1,80 @@ +/* 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. + * + */ + +#ifndef TITANIC_TT_SENTENCE_H +#define TITANIC_TT_SENTENCE_H + +#include "titanic/true_talk/tt_npc_script.h" +#include "titanic/true_talk/tt_room_script.h" +#include "titanic/true_talk/tt_string.h" + +namespace Titanic { + +class CScriptHandler; + +class TTsentenceSubBase { +public: + int _field0; + int _field4; + int _field8; + int _fieldC; + int _field10; + int _field14; + int _field18; + int _field1C; + int _field20; + int _field24; +public: + TTsentenceSubBase(); +}; + +class TTsentenceSub : public TTsentenceSubBase { +public: +}; + +class TTsentence { +private: + CScriptHandler *_owner; + TTsentenceSub _sub; + int _field2C; + int _inputCtr; + int _field34; + int _field38; + int _field4C; + TTroomScript *_roomScript; + TTnpcScript *_npcScript; + int _field58; + int _field5C; + int _status; +public: + TTstring _initialLine; + TTstring _normalizedLine; +public: + TTsentence(int inputCtr, const TTstring &line, CScriptHandler *owner, + TTroomScript *roomScript, TTnpcScript *npcScript); + + void set38(int v); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_SENTENCE_H */ -- cgit v1.2.3 From 5b42ae357ebdf5fd2665351a41127fc76167beb5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 17 May 2016 22:25:59 -0400 Subject: TITANIC: Refactor TTstringNode to have a base TTnode class --- engines/titanic/module.mk | 2 + engines/titanic/true_talk/tt_hist.cpp | 8 +++- engines/titanic/true_talk/tt_hist.h | 4 +- engines/titanic/true_talk/tt_node.cpp | 60 ++++++++++++++++++++++++++ engines/titanic/true_talk/tt_node.h | 54 +++++++++++++++++++++++ engines/titanic/true_talk/tt_sentence.cpp | 9 ++++ engines/titanic/true_talk/tt_sentence.h | 6 +++ engines/titanic/true_talk/tt_sentence_node.cpp | 31 +++++++++++++ engines/titanic/true_talk/tt_sentence_node.h | 37 ++++++++++++++++ engines/titanic/true_talk/tt_string_node.cpp | 32 +------------- engines/titanic/true_talk/tt_string_node.h | 21 +-------- engines/titanic/true_talk/tt_synonym.cpp | 12 +++--- engines/titanic/true_talk/tt_synonym.h | 5 +++ engines/titanic/true_talk/tt_vocab.cpp | 28 ++++++------ engines/titanic/true_talk/tt_vocab.h | 4 +- engines/titanic/true_talk/tt_word.cpp | 22 +++++----- engines/titanic/true_talk/tt_word.h | 2 +- 17 files changed, 251 insertions(+), 86 deletions(-) create mode 100644 engines/titanic/true_talk/tt_node.cpp create mode 100644 engines/titanic/true_talk/tt_node.h create mode 100644 engines/titanic/true_talk/tt_sentence_node.cpp create mode 100644 engines/titanic/true_talk/tt_sentence_node.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 9e10577758..1568eb5a8c 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -464,6 +464,7 @@ MODULE_OBJS := \ true_talk/tt_adj.o \ true_talk/tt_hist.o \ true_talk/tt_major_word.o \ + true_talk/tt_node.o \ true_talk/tt_npc_script.o \ true_talk/tt_parser.o \ true_talk/tt_picture.o \ @@ -472,6 +473,7 @@ MODULE_OBJS := \ true_talk/tt_script_base.o \ true_talk/tt_scripts.o \ true_talk/tt_sentence.o \ + true_talk/tt_sentence_node.o \ true_talk/tt_string.o \ true_talk/tt_string_node.o \ true_talk/tt_synonym.o \ diff --git a/engines/titanic/true_talk/tt_hist.cpp b/engines/titanic/true_talk/tt_hist.cpp index e0f6cb88b6..fae9ae6286 100644 --- a/engines/titanic/true_talk/tt_hist.cpp +++ b/engines/titanic/true_talk/tt_hist.cpp @@ -25,8 +25,12 @@ namespace Titanic { -TThist::TThist(TTsentence *sentence) { - // TODO +TThist::TThist(TTsentence *sentence) : _status(0) { + _sentence = new TTsentence(sentence); +} + +TThist::~TThist() { + delete _sentence; } } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_hist.h b/engines/titanic/true_talk/tt_hist.h index 7ba0032a4d..f67a0387c5 100644 --- a/engines/titanic/true_talk/tt_hist.h +++ b/engines/titanic/true_talk/tt_hist.h @@ -30,9 +30,11 @@ class TTsentence; class TThist { protected: int _field0; - TTsentence *_input; + TTsentence *_sentence; + int _status; public: TThist(TTsentence *sentence); + virtual ~TThist(); }; class TTscriptHist : public TThist { diff --git a/engines/titanic/true_talk/tt_node.cpp b/engines/titanic/true_talk/tt_node.cpp new file mode 100644 index 0000000000..8b175a0906 --- /dev/null +++ b/engines/titanic/true_talk/tt_node.cpp @@ -0,0 +1,60 @@ +/* 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/textconsole.h" +#include "titanic/true_talk/tt_node.h" + +namespace Titanic { + +TTnode::TTnode() : _priorP(nullptr), _nextP(nullptr) { +} + +TTnode::~TTnode() { + detach(); +} + +void TTnode::addNode(TTnode *newNode) { + TTnode *tail = getTail(); + tail->_nextP = newNode; + newNode->_priorP = this; +} + +void TTnode::detach() { + if (_priorP) + _priorP->_nextP = _nextP; + + if (_nextP) + _nextP->_priorP = _priorP; +} + +TTnode *TTnode::getTail() { + if (_nextP == nullptr) + return this; + + TTnode *node = _nextP; + while (node->_nextP) + node = node->_nextP; + + return node; +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_node.h b/engines/titanic/true_talk/tt_node.h new file mode 100644 index 0000000000..668b909bd5 --- /dev/null +++ b/engines/titanic/true_talk/tt_node.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_TT_NODE_H +#define TITANIC_TT_NODE_H + +namespace Titanic { + +class TTnode { +public: + TTnode *_priorP; + TTnode *_nextP; +public: + TTnode(); + virtual ~TTnode(); + + /** + * Links the passed node to this node as a linked list + */ + void addNode(TTnode *newNode); + + /** + * Detaches a node from any predecessor and/or successor + */ + void detach(); + + /** + * Returns the final node at the end of the linked list of nodes + */ + TTnode *getTail(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_NODE_H */ diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index e5968bd35a..e39a627694 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -40,6 +40,15 @@ TTsentence::TTsentence(int inputCtr, const TTstring &line, CScriptHandler *owner _status = _initialLine.isValid() && _normalizedLine.isValid() ? SS_11: SS_VALID; } +TTsentence::TTsentence(const TTsentence *src) : _initialLine(src->_initialLine), + _normalizedLine(src->_normalizedLine) { + copyFrom(*src); +} + +void TTsentence::copyFrom(const TTsentence &src) { + +} + void TTsentence::set38(int val) { _field38 = val; } diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index 94d7bfc8d9..784177dd3a 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -65,12 +65,18 @@ private: int _field58; int _field5C; int _status; +private: + /** + * Copy sentence data from a given source + */ + void copyFrom(const TTsentence &src); public: TTstring _initialLine; TTstring _normalizedLine; public: TTsentence(int inputCtr, const TTstring &line, CScriptHandler *owner, TTroomScript *roomScript, TTnpcScript *npcScript); + TTsentence(const TTsentence *src); void set38(int v); }; diff --git a/engines/titanic/true_talk/tt_sentence_node.cpp b/engines/titanic/true_talk/tt_sentence_node.cpp new file mode 100644 index 0000000000..46a1412a2a --- /dev/null +++ b/engines/titanic/true_talk/tt_sentence_node.cpp @@ -0,0 +1,31 @@ +/* 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/textconsole.h" +#include "titanic/true_talk/tt_sentence_node.h" + +namespace Titanic { + +TTsentenceNode::TTsentenceNode() : TTnode() { +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_sentence_node.h b/engines/titanic/true_talk/tt_sentence_node.h new file mode 100644 index 0000000000..5d22454d82 --- /dev/null +++ b/engines/titanic/true_talk/tt_sentence_node.h @@ -0,0 +1,37 @@ +/* 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. + * + */ + +#ifndef TITANIC_TT_SENTENCE_NODE_H +#define TITANIC_TT_SENTENCE_NODE_H + +#include "titanic/true_talk/tt_node.h" + +namespace Titanic { + +class TTsentenceNode : public TTnode { +public: + TTsentenceNode(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_SENTENCE_NODE_H */ diff --git a/engines/titanic/true_talk/tt_string_node.cpp b/engines/titanic/true_talk/tt_string_node.cpp index d125d328e7..1c0b5b9a90 100644 --- a/engines/titanic/true_talk/tt_string_node.cpp +++ b/engines/titanic/true_talk/tt_string_node.cpp @@ -25,12 +25,7 @@ namespace Titanic { -TTstringNode::TTstringNode() : _pPrior(nullptr), _pNext(nullptr), - _file(HANDLE_STDIN), _mode(0), _field1C(0) { -} - -TTstringNode::~TTstringNode() { - detach(); +TTstringNode::TTstringNode() : TTnode() { } void TTstringNode::initialize(int mode) { @@ -59,29 +54,4 @@ void TTstringNode::initialize(TTstringNode *oldNode) { delete oldNode; } -void TTstringNode::addNode(TTstringNode *newNode) { - TTstringNode *tail = getTail(); - tail->_pNext = newNode; - newNode->_pPrior = this; -} - -void TTstringNode::detach() { - if (_pPrior) - _pPrior->_pNext = _pNext; - - if (_pNext) - _pNext->_pPrior = _pPrior; -} - -TTstringNode *TTstringNode::getTail() { - if (_pNext == nullptr) - return this; - - TTstringNode *node = _pNext; - while (node->_pNext) - node = node->_pNext; - - return node; -} - } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_string_node.h b/engines/titanic/true_talk/tt_string_node.h index f9f73ce545..31013a950e 100644 --- a/engines/titanic/true_talk/tt_string_node.h +++ b/engines/titanic/true_talk/tt_string_node.h @@ -23,17 +23,13 @@ #ifndef TITANIC_TT_STRING_NODE_H #define TITANIC_TT_STRING_NODE_H +#include "titanic/true_talk/tt_node.h" #include "titanic/true_talk/tt_string.h" #include "titanic/support/exe_resources.h" namespace Titanic { -class TTstringNode { -private: - /** - * Returns the final node at the end of the linked list of nodes - */ - TTstringNode *getTail(); +class TTstringNode : public TTnode { protected: /** * Initializes state for the node @@ -45,25 +41,12 @@ protected: */ void initialize(TTstringNode *oldNode); public: - TTstringNode *_pPrior; - TTstringNode *_pNext; TTstring _string; FileHandle _file; int _mode; int _field1C; public: TTstringNode(); - virtual ~TTstringNode(); - - /** - * Links the passed node to this node as a linked list - */ - void addNode(TTstringNode *newNode); - - /** - * Detaches a node from any predecessor and/or successor - */ - void detach(); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_synonym.cpp b/engines/titanic/true_talk/tt_synonym.cpp index cac9f647cc..0e5ae39e82 100644 --- a/engines/titanic/true_talk/tt_synonym.cpp +++ b/engines/titanic/true_talk/tt_synonym.cpp @@ -24,24 +24,26 @@ namespace Titanic { -TTsynonym::TTsynonym() : TTstringNode() { +TTsynonym::TTsynonym() : TTstringNode(), _file(HANDLE_STDIN), + _mode(0), _field1C(0) { } -TTsynonym::TTsynonym(const TTsynonym *src) { +TTsynonym::TTsynonym(const TTsynonym *src) : TTstringNode(), + _mode(0), _field1C(0) { _string = src->_string; initialize(src->_mode); _file = src->_file; } TTsynonym::TTsynonym(int mode, const char *str, FileHandle file) : - TTstringNode() { + TTstringNode(), _mode(0), _field1C(0) { _string = str; initialize(mode); _file = file; } TTsynonym *TTsynonym::findByName(TTsynonym *start, const TTstring &str, int mode) { - for (; start; start = static_cast(start->_pNext)) { + for (; start; start = static_cast(start->_nextP)) { if (start->_mode == mode || (mode == 3 && start->_mode < 3)) { if (!strcmp(start->_string.c_str(), str.c_str())) start; @@ -69,7 +71,7 @@ TTsynonym *TTsynonym::copy(TTsynonym *src) { } int TTsynonym::save(SimpleFile *file) { - for (TTstringNode *synP = this; synP; synP = synP->_pNext) { + for (TTstringNode *synP = this; synP; synP = static_cast(synP->_nextP)) { file->writeFormat("%s", " 0 "); synP->_string.save(file); file->writeFormat("%c", ' '); diff --git a/engines/titanic/true_talk/tt_synonym.h b/engines/titanic/true_talk/tt_synonym.h index 40f7ad3449..288e9809ff 100644 --- a/engines/titanic/true_talk/tt_synonym.h +++ b/engines/titanic/true_talk/tt_synonym.h @@ -29,6 +29,11 @@ namespace Titanic { class TTsynonym : public TTstringNode { +public: + TTstring _string; + FileHandle _file; + int _mode; + int _field1C; public: TTsynonym(); TTsynonym(const TTsynonym *src); diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp index 3d2a9d98c8..707cbafff4 100644 --- a/engines/titanic/true_talk/tt_vocab.cpp +++ b/engines/titanic/true_talk/tt_vocab.cpp @@ -32,16 +32,16 @@ namespace Titanic { -TTvocab::TTvocab(int val): _pHead(nullptr), _pTail(nullptr), _word(nullptr), +TTvocab::TTvocab(int val): _headP(nullptr), _tailP(nullptr), _word(nullptr), _fieldC(0), _field10(0), _field18(val) { _field14 = load("STVOCAB.TXT"); } TTvocab::~TTvocab() { - if (_pHead) { - _pHead->deleteSiblings(); - delete _pHead; - _pHead = _pTail = nullptr; + if (_headP) { + _headP->deleteSiblings(); + delete _headP; + _headP = _tailP = nullptr; } } @@ -143,28 +143,28 @@ void TTvocab::addWord(TTword *word) { _word = nullptr; if (word) delete word; - } else if (_pTail) { - _pTail->_pNext = word; - _pTail = word; + } else if (_tailP) { + _tailP->_nextP = word; + _tailP = word; } else { - if (!_pHead) - _pHead = word; + if (!_headP) + _headP = word; - _pTail = word; + _tailP = word; } } TTword *TTvocab::findWord(const TTstring &str) { TTsynonym *tempNode = new TTsynonym(); bool flag = false; - TTword *word = _pHead; + TTword *word = _headP; while (word && !flag) { if (_field18 != 3 || strcmp(word->c_str(), str)) { if (word->scanCopy(str, tempNode, _field18)) flag = true; else - word = word->_pNext; + word = word->_nextP; } else { flag = true; } @@ -177,7 +177,7 @@ TTword *TTvocab::findWord(const TTstring &str) { TTword *TTvocab::getPrimeWord(TTstring &str, TTword **words) { TTsynonym *synonym = new TTsynonym(); char c = str.charAt(0); - TTword *vocabList = _pHead; + TTword *vocabList = _headP; TTword *returnWord = nullptr; if (!Common::isDigit(c)) { diff --git a/engines/titanic/true_talk/tt_vocab.h b/engines/titanic/true_talk/tt_vocab.h index 804d8cbae3..40e9458cb7 100644 --- a/engines/titanic/true_talk/tt_vocab.h +++ b/engines/titanic/true_talk/tt_vocab.h @@ -31,8 +31,8 @@ namespace Titanic { class TTvocab { private: - TTword *_pHead; - TTword *_pTail; + TTword *_headP; + TTword *_tailP; TTword *_word; int _fieldC; int _field10; diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index aa602d869c..90c7cf1a9d 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -27,8 +27,8 @@ namespace Titanic { TTword::TTword(TTstring &str, int mode, int val2) : _string(str), - _wordMode(mode), _field1C(val2), _pNext(nullptr), _synP(nullptr), - _field20(0), _field24(0), _field28(0) { + _wordMode(mode), _field1C(val2), _field20(0), _field24(0), + _field28(0), _synP(nullptr), _nextP(nullptr) { _status = str.getStatus() == SS_VALID ? SS_VALID : SS_5; } @@ -50,11 +50,11 @@ TTword::TTword(TTword *src) { if (!newSyn) { _status = SS_7; } else { - newSyn->_pPrior = priorSyn; - newSyn->_pNext = nullptr; + newSyn->_priorP = priorSyn; + newSyn->_nextP = nullptr; if (priorSyn) { - priorSyn->_pNext = newSyn; + priorSyn->_nextP = newSyn; } else { _synP = newSyn; } @@ -63,15 +63,15 @@ TTword::TTword(TTword *src) { } } - _pNext = src->_pNext; + _nextP = src->_nextP; _field24 = src->_field24; _field28 = src->_field28; } void TTword::deleteSiblings() { - while (_pNext) { - TTword *next = _pNext; - _pNext = next->_pNext; + while (_nextP) { + TTword *next = _nextP; + _nextP = next->_nextP; delete next; } } @@ -148,8 +148,8 @@ TTword *TTword::scanCopy(const TTstring &str, TTsynonym *node, int mode) { TTsynonym *strNode = TTsynonym::findByName(_synP, str, mode); if (strNode) { node->copy(strNode); - node->_pPrior = nullptr; - node->_pNext = nullptr; + node->_priorP = nullptr; + node->_nextP = nullptr; } } diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index f77f11ce75..7e692ffeea 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -46,7 +46,7 @@ protected: bool testFileHandle(SimpleFile *file) const { return true; } bool testFileHandle(FileHandle resHandle) const; public: - TTword *_pNext; + TTword *_nextP; TTsynonym *_synP; TTstring _string; public: -- cgit v1.2.3 From c762308bff46ccb900fa68fc40e72e235c862d89 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 17 May 2016 22:36:33 -0400 Subject: TITANIC: Implement TTsentence copy --- engines/titanic/true_talk/tt_sentence.cpp | 30 +++++++++++++++++++++++++- engines/titanic/true_talk/tt_sentence.h | 5 ++++- engines/titanic/true_talk/tt_sentence_node.cpp | 5 ++++- engines/titanic/true_talk/tt_sentence_node.h | 3 +++ 4 files changed, 40 insertions(+), 3 deletions(-) diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index e39a627694..446d79ab82 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -35,7 +35,7 @@ TTsentenceSubBase::TTsentenceSubBase() : _field0(0), _field4(0), _field8(0), TTsentence::TTsentence(int inputCtr, const TTstring &line, CScriptHandler *owner, TTroomScript *roomScript, TTnpcScript *npcScript) : _owner(owner), _field2C(1), _inputCtr(inputCtr), _field34(0), - _field38(0), _initialLine(line), _field4C(0), _roomScript(roomScript), + _field38(0), _initialLine(line), _nodesP(nullptr), _roomScript(roomScript), _npcScript(npcScript), _field58(0), _field5C(0) { _status = _initialLine.isValid() && _normalizedLine.isValid() ? SS_11: SS_VALID; } @@ -46,7 +46,35 @@ TTsentence::TTsentence(const TTsentence *src) : _initialLine(src->_initialLine), } void TTsentence::copyFrom(const TTsentence &src) { + if (!src.getStatus()) + _status = SS_5; + else if (!src._initialLine.isValid() || !src._normalizedLine.isValid()) + _status = SS_11; + else + _status = SS_VALID; + _inputCtr = src._inputCtr; + _owner = src._owner; + _roomScript = src._roomScript; + _npcScript = src._npcScript; + _field58 = src._field58; + _field5C = src._field5C; + _field34 = src._field34; + _field38 = src._field38; + _field2C = src._field2C; + _nodesP = nullptr; + + if (src._nodesP) { + // Source has processed nodes, so duplicate them + for (TTsentenceNode *node = src._nodesP; node; + node = static_cast(node->_nextP)) { + TTsentenceNode *newNode = new TTsentenceNode(node->_val); + if (_nodesP) + _nodesP->addNode(newNode); + else + _nodesP = newNode; + } + } } void TTsentence::set38(int val) { diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index 784177dd3a..4980f2439c 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -25,6 +25,7 @@ #include "titanic/true_talk/tt_npc_script.h" #include "titanic/true_talk/tt_room_script.h" +#include "titanic/true_talk/tt_sentence_node.h" #include "titanic/true_talk/tt_string.h" namespace Titanic { @@ -59,7 +60,7 @@ private: int _inputCtr; int _field34; int _field38; - int _field4C; + TTsentenceNode *_nodesP; TTroomScript *_roomScript; TTnpcScript *_npcScript; int _field58; @@ -79,6 +80,8 @@ public: TTsentence(const TTsentence *src); void set38(int v); + + int getStatus() const { return _status; } }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_sentence_node.cpp b/engines/titanic/true_talk/tt_sentence_node.cpp index 46a1412a2a..2bec287b44 100644 --- a/engines/titanic/true_talk/tt_sentence_node.cpp +++ b/engines/titanic/true_talk/tt_sentence_node.cpp @@ -25,7 +25,10 @@ namespace Titanic { -TTsentenceNode::TTsentenceNode() : TTnode() { +TTsentenceNode::TTsentenceNode() : TTnode(), _val(0) { +} + +TTsentenceNode::TTsentenceNode(int val) : TTnode(), _val(val) { } } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_sentence_node.h b/engines/titanic/true_talk/tt_sentence_node.h index 5d22454d82..09d106cb71 100644 --- a/engines/titanic/true_talk/tt_sentence_node.h +++ b/engines/titanic/true_talk/tt_sentence_node.h @@ -28,8 +28,11 @@ namespace Titanic { class TTsentenceNode : public TTnode { +public: + int _val; public: TTsentenceNode(); + TTsentenceNode(int val); }; } // End of namespace Titanic -- cgit v1.2.3 From 89caddc217bc417128fbbdabc48a665acf338e03 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 17 May 2016 23:07:36 -0400 Subject: TITANIC: Beginning of TTparser findFrames --- engines/titanic/true_talk/script_handler.cpp | 14 +++++++++++++- engines/titanic/true_talk/tt_npc_script.cpp | 4 ---- engines/titanic/true_talk/tt_npc_script.h | 7 +++++-- engines/titanic/true_talk/tt_parser.cpp | 5 +++++ engines/titanic/true_talk/tt_parser.h | 2 ++ engines/titanic/true_talk/tt_room_script.cpp | 4 ---- engines/titanic/true_talk/tt_room_script.h | 7 +++++-- engines/titanic/true_talk/tt_sentence.cpp | 4 ---- engines/titanic/true_talk/tt_sentence.h | 3 ++- 9 files changed, 32 insertions(+), 18 deletions(-) diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index ab5b97122d..0bc50bd5f9 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -64,10 +64,22 @@ int CScriptHandler::processInput(TTroomScript *roomScript, TTnpcScript *npcScrip return SS_5; TTsentence *sentence = new TTsentence(_inputCtr++, line, this, roomScript, npcScript); - _parser.preprocess(sentence); + int result = _parser.preprocess(sentence); roomScript->preprocess(sentence); npcScript->preprocess(sentence); + int canProcess = 0; + if (result) { + sentence->set34(result); + if (roomScript->proc6(npcScript, sentence, result)) { + canProcess = npcScript->proc6(roomScript, sentence, result); + } + } + + if (canProcess == 0 || canProcess == 1) { + _parser.findFrames(sentence); + } + warning("TODO: CScriptHandler::processInput"); // TODO diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 46b350da39..0775d09c08 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -63,10 +63,6 @@ void TTnpcScript::proc4(int v) { warning("TODO"); } -int TTnpcScript::proc6() const { - return 1; -} - void TTnpcScript::proc7(int v1, int v2) { warning("TODO"); } diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 29ab08f458..2396943025 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -28,6 +28,9 @@ namespace Titanic { +class TTroomScript; +class TTsentence; + class TTnpcScriptBase : public TTscriptBase { protected: int _field54; @@ -39,7 +42,7 @@ public: const char *charName, int v3, int val2, int v4, int v5, int v6, int v7); - virtual int proc6() const = 0; + virtual int proc6(TTroomScript *roomScript, TTsentence *sentence, int val) const = 0; virtual void proc7(int v1, int v2) = 0; virtual int proc8() const = 0; virtual int proc9() const = 0; @@ -78,7 +81,7 @@ public: int v5, int v6, int v7); virtual void proc4(int v); - virtual int proc6() const; + virtual int proc6(TTroomScript *roomScript, TTsentence *sentence, int val) const { return 1; } virtual void proc7(int v1, int v2); virtual int proc8() const; virtual int proc9() const; diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index a965c70394..d2563d4c05 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -465,4 +465,9 @@ const NumberEntry *TTparser::replaceNumbers2(TTstring &line, int *startIndex) { return numEntry; } +int TTparser::findFrames(TTsentence *sentence) { + // TODO + return 0; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index da63336783..fcf39ea822 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -128,6 +128,8 @@ public: * all the words, and replcaing common slang with their full equivalents */ int preprocess(TTsentence *sentence); + + int findFrames(TTsentence *sentence); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_room_script.cpp b/engines/titanic/true_talk/tt_room_script.cpp index 62f60f428c..885021eb7f 100644 --- a/engines/titanic/true_talk/tt_room_script.cpp +++ b/engines/titanic/true_talk/tt_room_script.cpp @@ -37,10 +37,6 @@ TTroomScript::TTroomScript(int scriptId) : TTroomScriptBase(scriptId, "", "", 0, -1, -1, -1, 0, 0) { } -void TTroomScript::proc6() { - warning("TODO"); -} - void TTroomScript::proc7() { warning("TODO"); } diff --git a/engines/titanic/true_talk/tt_room_script.h b/engines/titanic/true_talk/tt_room_script.h index 7f72573dec..7fd43f3c79 100644 --- a/engines/titanic/true_talk/tt_room_script.h +++ b/engines/titanic/true_talk/tt_room_script.h @@ -27,6 +27,9 @@ namespace Titanic { +class TTnpcScript; +class TTsentence; + class TTroomScriptBase : public TTscriptBase { public: int _scriptId; @@ -34,7 +37,7 @@ public: TTroomScriptBase(int scriptId, const char *charClass, const char *charName, int v3, int v4, int v5, int v6, int v2, int v7); - virtual void proc6() = 0; + virtual int proc6(TTnpcScript *npcScript, TTsentence *sentence, int val) = 0; virtual void proc7() = 0; virtual void proc8() = 0; virtual void proc9() = 0; @@ -54,7 +57,7 @@ private: public: TTroomScript(int scriptId); - virtual void proc6(); + virtual int proc6(TTnpcScript *npcScript, TTsentence *sentence, int val) { return 1; } virtual void proc7(); virtual void proc8(); virtual void proc9(); diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index 446d79ab82..f7779eb8bb 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -77,8 +77,4 @@ void TTsentence::copyFrom(const TTsentence &src) { } } -void TTsentence::set38(int val) { - _field38 = val; -} - } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index 4980f2439c..450280b430 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -79,7 +79,8 @@ public: TTroomScript *roomScript, TTnpcScript *npcScript); TTsentence(const TTsentence *src); - void set38(int v); + void set34(int v) { _field34 = v; } + void set38(int v) { _field38 = v; } int getStatus() const { return _status; } }; -- cgit v1.2.3 From cca38c15e59da0115c06c844d892e9d94c4d53c1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 18 May 2016 07:52:29 -0400 Subject: TITANIC: Implemented TTstring tokenize --- engines/titanic/true_talk/tt_parser.cpp | 6 +++++- engines/titanic/true_talk/tt_parser.h | 2 +- engines/titanic/true_talk/tt_sentence.h | 2 +- engines/titanic/true_talk/tt_string.cpp | 19 +++++++++++++++++++ engines/titanic/true_talk/tt_string.h | 6 ++++++ 5 files changed, 32 insertions(+), 3 deletions(-) diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index d2563d4c05..9c955299cf 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -27,7 +27,7 @@ namespace Titanic { -TTparser::TTparser(CScriptHandler *owner) : _owner(owner), _field4(0), +TTparser::TTparser(CScriptHandler *owner) : _owner(owner), _sentenceSub(nullptr), _sentence(nullptr), _fieldC(0), _field10(0), _field14(0), _field18(0) { loadArrays(); } @@ -466,6 +466,10 @@ const NumberEntry *TTparser::replaceNumbers2(TTstring &line, int *startIndex) { } int TTparser::findFrames(TTsentence *sentence) { + static bool flag; + _sentenceSub = &sentence->_sub; + _sentence = sentence; + // TODO return 0; } diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index fcf39ea822..9ef84f93ad 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -114,7 +114,7 @@ private: const NumberEntry *replaceNumbers2(TTstring &line, int *startIndex); public: CScriptHandler *_owner; - int _field4; + TTsentenceSub *_sentenceSub; TTsentence *_sentence; int _fieldC; int _field10; diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index 450280b430..9f6d18ee06 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -55,7 +55,6 @@ public: class TTsentence { private: CScriptHandler *_owner; - TTsentenceSub _sub; int _field2C; int _inputCtr; int _field34; @@ -72,6 +71,7 @@ private: */ void copyFrom(const TTsentence &src); public: + TTsentenceSub _sub; TTstring _initialLine; TTstring _normalizedLine; public: diff --git a/engines/titanic/true_talk/tt_string.cpp b/engines/titanic/true_talk/tt_string.cpp index 7a0078788d..70d6fe3fcf 100644 --- a/engines/titanic/true_talk/tt_string.cpp +++ b/engines/titanic/true_talk/tt_string.cpp @@ -99,4 +99,23 @@ void TTstring::save(SimpleFile *file) const { file->writeFormat("%s", c_str()); } +TTstring TTstring::tokenize(const char *delim) { + const char *strP = _data->_string.c_str(); + const char *splitP = nullptr, *chP; + + for (const char *d = delim; d; ++d) { + chP = strchr(strP, *d); + if (chP && (splitP == nullptr || chP < splitP)) + splitP = chP; + } + + if (splitP) { + TTstring result(CString(strP, splitP)); + _data->_string = CString(splitP + 1); + return result; + } else { + return TTstring(); + } +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index 1b208cc26a..cae1a5dc2f 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -134,6 +134,12 @@ public: bool compareAt(int index, const char *str) const { return !strncmp(c_str() + index, str, strlen(str)); } + + /** + * Split off everything in the string until the first occurance + * of any specified delimiter character + */ + TTstring tokenize(const char *delim); }; } // End of namespace Titanic -- cgit v1.2.3 From d4c6538726b4a8425a62391aab5fddc9a2332d46 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 18 May 2016 13:49:44 -0400 Subject: TITANIC: Work on TTparser findFrames --- engines/titanic/true_talk/tt_parser.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 9c955299cf..1658a27b55 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -470,7 +470,21 @@ int TTparser::findFrames(TTsentence *sentence) { _sentenceSub = &sentence->_sub; _sentence = sentence; + TTstring *line = sentence->_normalizedLine.copy(); + TTstring wordString; + for (;;) { + // Keep stripping words off the start of the passed input + TTstring wordString = line->tokenize(" \n"); + if (wordString.empty()) + break; + + //TTword *word = nullptr; + //_owner->_vocab.fn1(wordString, &word); + } + + // TODO + delete line; return 0; } -- cgit v1.2.3 From defd50c9261366be392f91a1807e4b952ad5a28e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 18 May 2016 19:23:35 -0400 Subject: TITANIC: Added support methods for finding synonyms by name --- engines/titanic/true_talk/tt_node.cpp | 12 +++++++++++ engines/titanic/true_talk/tt_node.h | 5 +++++ engines/titanic/true_talk/tt_string.cpp | 4 ++++ engines/titanic/true_talk/tt_string.h | 1 + engines/titanic/true_talk/tt_string_node.cpp | 11 ++++++++++ engines/titanic/true_talk/tt_string_node.h | 5 +++++ engines/titanic/true_talk/tt_synonym.cpp | 26 +++++----------------- engines/titanic/true_talk/tt_synonym.h | 9 ++------ engines/titanic/true_talk/tt_vocab.cpp | 24 +++++++++++---------- engines/titanic/true_talk/tt_vocab.h | 2 +- engines/titanic/true_talk/tt_word.cpp | 32 +++++++++++++++++++--------- engines/titanic/true_talk/tt_word.h | 13 ++++++++++- 12 files changed, 93 insertions(+), 51 deletions(-) diff --git a/engines/titanic/true_talk/tt_node.cpp b/engines/titanic/true_talk/tt_node.cpp index 8b175a0906..22695ad379 100644 --- a/engines/titanic/true_talk/tt_node.cpp +++ b/engines/titanic/true_talk/tt_node.cpp @@ -46,6 +46,18 @@ void TTnode::detach() { _nextP->_priorP = _priorP; } +void TTnode::deleteSiblings() { + // Detach current node from prior one, if there is one + if (_priorP) + _priorP->_nextP = nullptr; + + // Iterate through the linked chain of nodes, deleting each in turn + for (TTnode *curP = _nextP, *nextP = nullptr; nextP; curP = nextP) { + nextP = curP->_nextP; + delete curP; + } +} + TTnode *TTnode::getTail() { if (_nextP == nullptr) return this; diff --git a/engines/titanic/true_talk/tt_node.h b/engines/titanic/true_talk/tt_node.h index 668b909bd5..f8d1bc6766 100644 --- a/engines/titanic/true_talk/tt_node.h +++ b/engines/titanic/true_talk/tt_node.h @@ -43,6 +43,11 @@ public: */ void detach(); + /** + * Delete any sibling chain attached to this node + */ + void deleteSiblings(); + /** * Returns the final node at the end of the linked list of nodes */ diff --git a/engines/titanic/true_talk/tt_string.cpp b/engines/titanic/true_talk/tt_string.cpp index 70d6fe3fcf..df93a5669c 100644 --- a/engines/titanic/true_talk/tt_string.cpp +++ b/engines/titanic/true_talk/tt_string.cpp @@ -95,6 +95,10 @@ TTstring &TTstring::operator+=(char c) { return *this; } +bool TTstring::operator==(const TTstring &str) { + return _data && str._data && _data->_string == str._data->_string; +} + void TTstring::save(SimpleFile *file) const { file->writeFormat("%s", c_str()); } diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index cae1a5dc2f..434c6fe829 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -57,6 +57,7 @@ public: TTstring &operator+=(const char *str); TTstring &operator+=(const TTstring &str); TTstring &operator+=(char c); + bool operator==(const TTstring &str); const char &operator[](int index) { return *(c_str() + index); diff --git a/engines/titanic/true_talk/tt_string_node.cpp b/engines/titanic/true_talk/tt_string_node.cpp index 1c0b5b9a90..2bb0c5a74b 100644 --- a/engines/titanic/true_talk/tt_string_node.cpp +++ b/engines/titanic/true_talk/tt_string_node.cpp @@ -54,4 +54,15 @@ void TTstringNode::initialize(TTstringNode *oldNode) { delete oldNode; } +TTstringNode *TTstringNode::findByName(const TTstring &str, int mode) { + for (TTstringNode *nodeP = this; nodeP; nodeP = static_cast(nodeP->_nextP)) { + if (nodeP->_mode == mode || (mode == 3 && nodeP->_mode < 3)) { + if (nodeP->_string == str) + return nodeP; + } + } + + return nullptr; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_string_node.h b/engines/titanic/true_talk/tt_string_node.h index 31013a950e..ced162b439 100644 --- a/engines/titanic/true_talk/tt_string_node.h +++ b/engines/titanic/true_talk/tt_string_node.h @@ -47,6 +47,11 @@ public: int _field1C; public: TTstringNode(); + + /** + * Find a string node in the linked chain by name + */ + TTstringNode *findByName(const TTstring &str, int mode); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_synonym.cpp b/engines/titanic/true_talk/tt_synonym.cpp index 0e5ae39e82..636b4438f1 100644 --- a/engines/titanic/true_talk/tt_synonym.cpp +++ b/engines/titanic/true_talk/tt_synonym.cpp @@ -42,32 +42,16 @@ TTsynonym::TTsynonym(int mode, const char *str, FileHandle file) : _file = file; } -TTsynonym *TTsynonym::findByName(TTsynonym *start, const TTstring &str, int mode) { - for (; start; start = static_cast(start->_nextP)) { - if (start->_mode == mode || (mode == 3 && start->_mode < 3)) { - if (!strcmp(start->_string.c_str(), str.c_str())) - start; - } - } - - return nullptr; -} - -TTsynonym *TTsynonym::copy(TTsynonym *src) { +TTsynonym *TTsynonym::copyFrom(const TTsynonym *src) { if (src->_field1C) { _field1C = 5; - return this; } else { _field1C = 0; - if (src == this) - return this; - - _string = src->_string; - TTsynonym *newNode = new TTsynonym(src); - initialize(newNode); - - return this; + if (src != this) + _string = src->_string; } + + return this; } int TTsynonym::save(SimpleFile *file) { diff --git a/engines/titanic/true_talk/tt_synonym.h b/engines/titanic/true_talk/tt_synonym.h index 288e9809ff..e95a6d4faa 100644 --- a/engines/titanic/true_talk/tt_synonym.h +++ b/engines/titanic/true_talk/tt_synonym.h @@ -40,14 +40,9 @@ public: TTsynonym(int mode, const char *str, FileHandle file); /** - * Copy the synonym + * Copies data from one synonym to another */ - TTsynonym *copy(TTsynonym *src); - - /** - * Scan for a synonym with a given string - */ - static TTsynonym *findByName(TTsynonym *start, const TTstring &str, int mode); + TTsynonym *copyFrom(const TTsynonym *src); /** * Save data for the synonym to file diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp index 707cbafff4..fe8b622d70 100644 --- a/engines/titanic/true_talk/tt_vocab.cpp +++ b/engines/titanic/true_talk/tt_vocab.cpp @@ -33,7 +33,7 @@ namespace Titanic { TTvocab::TTvocab(int val): _headP(nullptr), _tailP(nullptr), _word(nullptr), - _fieldC(0), _field10(0), _field18(val) { + _fieldC(0), _field10(0), _vocabMode(val) { _field14 = load("STVOCAB.TXT"); } @@ -160,8 +160,8 @@ TTword *TTvocab::findWord(const TTstring &str) { TTword *word = _headP; while (word && !flag) { - if (_field18 != 3 || strcmp(word->c_str(), str)) { - if (word->scanCopy(str, tempNode, _field18)) + if (_vocabMode != 3 || strcmp(word->c_str(), str)) { + if (word->findSynByName(str, tempNode, _vocabMode)) flag = true; else word = word->_nextP; @@ -177,18 +177,20 @@ TTword *TTvocab::findWord(const TTstring &str) { TTword *TTvocab::getPrimeWord(TTstring &str, TTword **words) { TTsynonym *synonym = new TTsynonym(); char c = str.charAt(0); - TTword *vocabList = _headP; TTword *returnWord = nullptr; if (!Common::isDigit(c)) { returnWord = new TTword(str, 3, 300); - } else if (!vocabList) { - // No vocab present. Should never happen } else { TTword *foundWord = nullptr; - while (!foundWord && vocabList) { - if (_field18 == 3 && !strcmp(str.c_str(), vocabList->c_str())) { - + for (TTword *vocabP = _headP; vocabP && !foundWord; vocabP = vocabP->_nextP) { + if (_vocabMode == 3 && !strcmp(str.c_str(), vocabP->c_str())) { + foundWord = vocabP->copy(); + foundWord->_nextP = nullptr; + foundWord->setSyn(nullptr); + } else { + vocabP->findSynByName(str, synonym, _vocabMode); + // TODO } } @@ -196,8 +198,8 @@ TTword *TTvocab::getPrimeWord(TTstring &str, TTword **words) { } - if (words) - *words = vocabList; +// if (words) +// *words = vocabList; delete synonym; return returnWord; diff --git a/engines/titanic/true_talk/tt_vocab.h b/engines/titanic/true_talk/tt_vocab.h index 40e9458cb7..c417c7bf36 100644 --- a/engines/titanic/true_talk/tt_vocab.h +++ b/engines/titanic/true_talk/tt_vocab.h @@ -37,7 +37,7 @@ private: int _fieldC; int _field10; int _field14; - int _field18; + int _vocabMode; private: /** * Load the vocab data diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index 90c7cf1a9d..a09af4ab34 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -100,6 +100,15 @@ int TTword::readSyn(SimpleFile *file) { return 0; } +void TTword::setSyn(TTsynonym *synP) { + if (_synP) { + _synP->deleteSiblings(); + delete _synP; + } + + _synP = synP; +} + void TTword::appendNode(TTsynonym *node) { if (_synP) _synP->addNode(node); @@ -143,17 +152,20 @@ bool TTword::testFileHandle(FileHandle file) const { return true; } -TTword *TTword::scanCopy(const TTstring &str, TTsynonym *node, int mode) { - if (_synP) { - TTsynonym *strNode = TTsynonym::findByName(_synP, str, mode); - if (strNode) { - node->copy(strNode); - node->_priorP = nullptr; - node->_nextP = nullptr; - } - } +bool TTword::findSynByName(const TTstring &str, TTsynonym *dest, int mode) const { + if (!_synP) + return false; + + const TTsynonym *synP = static_cast(_synP->findByName(str, mode)); + if (synP) { + dest->copyFrom(synP); + dest->_priorP = nullptr; + dest->_nextP = nullptr; - return nullptr; + return true; + } else { + return false; + } } TTword *TTword::copy() { diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index 7e692ffeea..885409ccb0 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -63,6 +63,11 @@ public: */ int readSyn(SimpleFile *file); + /** + * Set a new synonym for the word + */ + void setSyn(TTsynonym *synP); + /** * Either sets the first synonym for a word, or adds it to an existing one */ @@ -73,7 +78,13 @@ public: */ int load(SimpleFile *file, int mode); - TTword *scanCopy(const TTstring &str, TTsynonym *node, int mode); + /** + * Finds a synonym in the word by name, if one exists + * @param str Name to search for + * @param dest Destination synonym instance to copy match into + * @returns Returns true if a match was found + */ + bool findSynByName(const TTstring &str, TTsynonym *dest, int mode) const; const char *c_str() const { return _string.c_str(); } operator const char *() const { return c_str(); } -- cgit v1.2.3 From 2b9fcd2cdaa537d79310915a69c48fab0b4ae105 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 18 May 2016 19:59:42 -0400 Subject: TITANIC: Finished TTvocab getPrimeWord --- engines/titanic/true_talk/tt_vocab.cpp | 41 ++++++++++++++++++---------------- engines/titanic/true_talk/tt_vocab.h | 10 ++++++++- 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp index fe8b622d70..102ed2cbdd 100644 --- a/engines/titanic/true_talk/tt_vocab.cpp +++ b/engines/titanic/true_talk/tt_vocab.cpp @@ -174,35 +174,38 @@ TTword *TTvocab::findWord(const TTstring &str) { return word; } -TTword *TTvocab::getPrimeWord(TTstring &str, TTword **words) { - TTsynonym *synonym = new TTsynonym(); +TTword *TTvocab::getPrimeWord(TTstring &str, TTword **srcWord) const { + TTsynonym tempSyn; char c = str.charAt(0); - TTword *returnWord = nullptr; + TTword *newWord = nullptr; + TTword *vocabP; if (!Common::isDigit(c)) { - returnWord = new TTword(str, 3, 300); + vocabP = _headP; + newWord = new TTword(str, 3, 300); } else { - TTword *foundWord = nullptr; - for (TTword *vocabP = _headP; vocabP && !foundWord; vocabP = vocabP->_nextP) { + for (vocabP = _headP; vocabP && !newWord; vocabP = vocabP->_nextP) { if (_vocabMode == 3 && !strcmp(str.c_str(), vocabP->c_str())) { - foundWord = vocabP->copy(); - foundWord->_nextP = nullptr; - foundWord->setSyn(nullptr); - } else { - vocabP->findSynByName(str, synonym, _vocabMode); - // TODO + newWord = vocabP->copy(); + newWord->_nextP = nullptr; + newWord->setSyn(nullptr); + } else if (vocabP->findSynByName(str, &tempSyn, _vocabMode)) { + // Create a copy of the word and the found synonym + TTsynonym *newSyn = new TTsynonym(tempSyn); + newSyn->_nextP = newSyn->_priorP = nullptr; + newWord = vocabP->copy(); + newWord->_nextP = nullptr; + newWord->setSyn(newSyn); } } - - // TODO - } -// if (words) -// *words = vocabList; - delete synonym; + if (srcWord) + // Pass out the pointer to the original word + *srcWord = vocabP; - return returnWord; + // Return the new copy of the word + return newWord; } } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_vocab.h b/engines/titanic/true_talk/tt_vocab.h index c417c7bf36..e1dcfe6fe2 100644 --- a/engines/titanic/true_talk/tt_vocab.h +++ b/engines/titanic/true_talk/tt_vocab.h @@ -57,7 +57,15 @@ public: TTvocab(int val); ~TTvocab(); - TTword *getPrimeWord(TTstring &str, TTword **words); + /** + * Scans the vocab list for a word with a synonym matching the passed string. + * If found, creates a new word instance that only has the matching synonym + * linked to it. + * @param str Word text to scan for + * @param srcWord Optional pointer to store the original word match was found on + * @returns A new word instance if a match if found, or null if not + */ + TTword *getPrimeWord(TTstring &str, TTword **srcWord) const; }; } // End of namespace Titanic -- cgit v1.2.3 From f7b8a870659cf3aeb571d865506a08893b1acb58 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 18 May 2016 20:46:16 -0400 Subject: TITANIC: Added TTstring deletePrefix --- engines/titanic/true_talk/tt_string.cpp | 17 +++++++++++++++++ engines/titanic/true_talk/tt_string.h | 9 +++++++++ engines/titanic/true_talk/tt_vocab.cpp | 8 ++++++++ engines/titanic/true_talk/tt_vocab.h | 2 ++ 4 files changed, 36 insertions(+) diff --git a/engines/titanic/true_talk/tt_string.cpp b/engines/titanic/true_talk/tt_string.cpp index df93a5669c..76c109284a 100644 --- a/engines/titanic/true_talk/tt_string.cpp +++ b/engines/titanic/true_talk/tt_string.cpp @@ -122,4 +122,21 @@ TTstring TTstring::tokenize(const char *delim) { } } +int TTstring::deletePrefix(int count) { + int strSize = size(); + if (count > strSize) + count = strSize; + + if (_data->_referenceCount == 1) { + // No other references to this string, so we can just directly modify it + _data->_string = CString(_data->_string.c_str() + count); + } else { + // Detach string from current shared data, and create a new one with the substring + _data->_referenceCount--; + _data = new TTstringData(_data->_string.c_str() + count); + } + + return 1; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index 434c6fe829..42666432c5 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -90,6 +90,10 @@ public: return _data->_string.hasSuffix(str); } + bool contains(const char *s) const { + return _data->_string.contains(s); + } + /** * Create a new copy of the string */ @@ -141,6 +145,11 @@ public: * of any specified delimiter character */ TTstring tokenize(const char *delim); + + /** + * Delets a specififed number of characters from the start of the string + */ + int deletePrefix(int count); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp index 102ed2cbdd..458c0a10d7 100644 --- a/engines/titanic/true_talk/tt_vocab.cpp +++ b/engines/titanic/true_talk/tt_vocab.cpp @@ -208,4 +208,12 @@ TTword *TTvocab::getPrimeWord(TTstring &str, TTword **srcWord) const { return newWord; } +void TTvocab::fn1(TTstring &str) { + TTstring tempStr(str); + + if (tempStr.contains("pre")) { + + } +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_vocab.h b/engines/titanic/true_talk/tt_vocab.h index e1dcfe6fe2..0a3e826fe6 100644 --- a/engines/titanic/true_talk/tt_vocab.h +++ b/engines/titanic/true_talk/tt_vocab.h @@ -66,6 +66,8 @@ public: * @returns A new word instance if a match if found, or null if not */ TTword *getPrimeWord(TTstring &str, TTword **srcWord) const; + + void fn1(TTstring &str); }; } // End of namespace Titanic -- cgit v1.2.3 From 6fdaa608f1e78dac127acb38f634294d58b78415 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 18 May 2016 22:12:14 -0400 Subject: TITANIC: Start on vocab method for finding words with prefixes --- engines/titanic/true_talk/tt_string.h | 6 + engines/titanic/true_talk/tt_vocab.cpp | 467 +++++++++++++++++---------------- engines/titanic/true_talk/tt_vocab.h | 2 +- 3 files changed, 255 insertions(+), 220 deletions(-) diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index 42666432c5..3cc1e5ec40 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -83,6 +83,12 @@ public: _data->_string.deleteLastChar(); } + bool hasPrefix(const CString &str) const { + return _data->_string.hasPrefix(str); + } + bool hasPrefix(const const char *str) const { + return _data->_string.hasPrefix(str); + } bool hasSuffix(const CString &str) const { return _data->_string.hasSuffix(str); } diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp index 458c0a10d7..dfe894dcd1 100644 --- a/engines/titanic/true_talk/tt_vocab.cpp +++ b/engines/titanic/true_talk/tt_vocab.cpp @@ -1,219 +1,248 @@ -/* 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/file.h" -#include "titanic/true_talk/tt_vocab.h" -#include "titanic/true_talk/tt_adj.h" -#include "titanic/true_talk/tt_action.h" -#include "titanic/true_talk/tt_adj.h" -#include "titanic/true_talk/tt_major_word.h" -#include "titanic/true_talk/tt_picture.h" -#include "titanic/true_talk/tt_pronoun.h" -#include "titanic/titanic.h" - -namespace Titanic { - -TTvocab::TTvocab(int val): _headP(nullptr), _tailP(nullptr), _word(nullptr), - _fieldC(0), _field10(0), _vocabMode(val) { - _field14 = load("STVOCAB.TXT"); -} - -TTvocab::~TTvocab() { - if (_headP) { - _headP->deleteSiblings(); - delete _headP; - _headP = _tailP = nullptr; - } -} - -int TTvocab::load(const CString &name) { - SimpleFile *file = g_vm->_exeResources._owner->openResource(name); - int result = 0; - bool skipFlag; - - while (!result && !file->eos()) { - skipFlag = false; - int mode = file->readNumber(); - TTstring space(" "); - - switch (mode) { - case 0: { - if (_word) - result = _word->readSyn(file); - skipFlag = true; - break; - } - - case 1: { - TTaction *word = new TTaction(space, 0, 0, 0, 0); - result = word->load(file); - _word = word; - break; - } - - case 2: { - TTpicture *word = new TTpicture(space, 0, 0, 0, 0, 0, 0); - result = word->load(file); - _word = word; - break; - } - - case 3: - case 9: { - TTmajorWord *word = new TTmajorWord(space, 0, 0, 0); - result = word->load(file, mode); - _word = word; - break; - } - - case 4: - case 5: - case 7: { - TTword *word = new TTword(space, 0, 0); - result = word->load(file, mode); - _word = word; - break; - } - - case 8: { - TTadj *word = new TTadj(space, 0, 0, 0, 0); - result = word->load(file); - _word = word; - break; - } - - case 6: { - TTpronoun *word = new TTpronoun(space, 0, 0, 0, 0); - result = word->load(file); - _word = word; - break; - } - - default: - result = 4; - break; - } - - if (!skipFlag && _word) { - if (result) { - // Something wrong occurred, so delete word - delete _word; - _word = nullptr; - } else { - // Add the word to the master vocab list - addWord(_word); - } - } - } - - // Close resource and return result - delete file; - return result; -} - -void TTvocab::addWord(TTword *word) { - TTword *existingWord = findWord(word->_string); - - if (existingWord) { - if (word->_synP) { - // Move over the synonym - existingWord->appendNode(word->_synP); - word->_synP = nullptr; - } - - _word = nullptr; - if (word) - delete word; - } else if (_tailP) { - _tailP->_nextP = word; - _tailP = word; - } else { - if (!_headP) - _headP = word; - - _tailP = word; - } -} - -TTword *TTvocab::findWord(const TTstring &str) { - TTsynonym *tempNode = new TTsynonym(); - bool flag = false; - TTword *word = _headP; - - while (word && !flag) { - if (_vocabMode != 3 || strcmp(word->c_str(), str)) { - if (word->findSynByName(str, tempNode, _vocabMode)) - flag = true; - else - word = word->_nextP; - } else { - flag = true; - } - } - - delete tempNode; - return word; -} - -TTword *TTvocab::getPrimeWord(TTstring &str, TTword **srcWord) const { - TTsynonym tempSyn; - char c = str.charAt(0); - TTword *newWord = nullptr; - TTword *vocabP; - - if (!Common::isDigit(c)) { - vocabP = _headP; - newWord = new TTword(str, 3, 300); - } else { - for (vocabP = _headP; vocabP && !newWord; vocabP = vocabP->_nextP) { - if (_vocabMode == 3 && !strcmp(str.c_str(), vocabP->c_str())) { - newWord = vocabP->copy(); - newWord->_nextP = nullptr; - newWord->setSyn(nullptr); - } else if (vocabP->findSynByName(str, &tempSyn, _vocabMode)) { - // Create a copy of the word and the found synonym - TTsynonym *newSyn = new TTsynonym(tempSyn); - newSyn->_nextP = newSyn->_priorP = nullptr; - newWord = vocabP->copy(); - newWord->_nextP = nullptr; - newWord->setSyn(newSyn); - } - } - } - - if (srcWord) - // Pass out the pointer to the original word - *srcWord = vocabP; - - // Return the new copy of the word - return newWord; -} - -void TTvocab::fn1(TTstring &str) { - TTstring tempStr(str); - - if (tempStr.contains("pre")) { - - } -} - -} // End of namespace Titanic +/* 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/file.h" +#include "titanic/true_talk/tt_vocab.h" +#include "titanic/true_talk/tt_adj.h" +#include "titanic/true_talk/tt_action.h" +#include "titanic/true_talk/tt_adj.h" +#include "titanic/true_talk/tt_major_word.h" +#include "titanic/true_talk/tt_picture.h" +#include "titanic/true_talk/tt_pronoun.h" +#include "titanic/titanic.h" + +namespace Titanic { + +TTvocab::TTvocab(int val): _headP(nullptr), _tailP(nullptr), _word(nullptr), + _fieldC(0), _field10(0), _vocabMode(val) { + _field14 = load("STVOCAB.TXT"); +} + +TTvocab::~TTvocab() { + if (_headP) { + _headP->deleteSiblings(); + delete _headP; + _headP = _tailP = nullptr; + } +} + +int TTvocab::load(const CString &name) { + SimpleFile *file = g_vm->_exeResources._owner->openResource(name); + int result = 0; + bool skipFlag; + + while (!result && !file->eos()) { + skipFlag = false; + int mode = file->readNumber(); + TTstring space(" "); + + switch (mode) { + case 0: { + if (_word) + result = _word->readSyn(file); + skipFlag = true; + break; + } + + case 1: { + TTaction *word = new TTaction(space, 0, 0, 0, 0); + result = word->load(file); + _word = word; + break; + } + + case 2: { + TTpicture *word = new TTpicture(space, 0, 0, 0, 0, 0, 0); + result = word->load(file); + _word = word; + break; + } + + case 3: + case 9: { + TTmajorWord *word = new TTmajorWord(space, 0, 0, 0); + result = word->load(file, mode); + _word = word; + break; + } + + case 4: + case 5: + case 7: { + TTword *word = new TTword(space, 0, 0); + result = word->load(file, mode); + _word = word; + break; + } + + case 8: { + TTadj *word = new TTadj(space, 0, 0, 0, 0); + result = word->load(file); + _word = word; + break; + } + + case 6: { + TTpronoun *word = new TTpronoun(space, 0, 0, 0, 0); + result = word->load(file); + _word = word; + break; + } + + default: + result = 4; + break; + } + + if (!skipFlag && _word) { + if (result) { + // Something wrong occurred, so delete word + delete _word; + _word = nullptr; + } else { + // Add the word to the master vocab list + addWord(_word); + } + } + } + + // Close resource and return result + delete file; + return result; +} + +void TTvocab::addWord(TTword *word) { + TTword *existingWord = findWord(word->_string); + + if (existingWord) { + if (word->_synP) { + // Move over the synonym + existingWord->appendNode(word->_synP); + word->_synP = nullptr; + } + + _word = nullptr; + if (word) + delete word; + } else if (_tailP) { + _tailP->_nextP = word; + _tailP = word; + } else { + if (!_headP) + _headP = word; + + _tailP = word; + } +} + +TTword *TTvocab::findWord(const TTstring &str) { + TTsynonym *tempNode = new TTsynonym(); + bool flag = false; + TTword *word = _headP; + + while (word && !flag) { + if (_vocabMode != 3 || strcmp(word->c_str(), str)) { + if (word->findSynByName(str, tempNode, _vocabMode)) + flag = true; + else + word = word->_nextP; + } else { + flag = true; + } + } + + delete tempNode; + return word; +} + +TTword *TTvocab::getPrimeWord(TTstring &str, TTword **srcWord) const { + TTsynonym tempSyn; + char c = str.charAt(0); + TTword *newWord = nullptr; + TTword *vocabP; + + if (!Common::isDigit(c)) { + vocabP = _headP; + newWord = new TTword(str, 3, 300); + } else { + for (vocabP = _headP; vocabP && !newWord; vocabP = vocabP->_nextP) { + if (_vocabMode == 3 && !strcmp(str.c_str(), vocabP->c_str())) { + newWord = vocabP->copy(); + newWord->_nextP = nullptr; + newWord->setSyn(nullptr); + } else if (vocabP->findSynByName(str, &tempSyn, _vocabMode)) { + // Create a copy of the word and the found synonym + TTsynonym *newSyn = new TTsynonym(tempSyn); + newSyn->_nextP = newSyn->_priorP = nullptr; + newWord = vocabP->copy(); + newWord->_nextP = nullptr; + newWord->setSyn(newSyn); + } + } + } + + if (srcWord) + // Pass out the pointer to the original word + *srcWord = vocabP; + + // Return the new copy of the word + return newWord; +} + +void TTvocab::fn1(TTstring &str) { + TTstring tempStr(str); + TTword *word = nullptr; + int prefixLen = 0; + + if (tempStr.hasPrefix("pre")) { + prefixLen = 3; + } else if (tempStr.hasPrefix("re") || tempStr.hasPrefix("co")) { + prefixLen = 2; + } else if (tempStr.hasPrefix("inter") || tempStr.hasPrefix("multi")) { + prefixLen = 5; + } else if (tempStr.hasPrefix("over") || tempStr.hasPrefix("post") || tempStr.hasPrefix("self")) { + prefixLen = 4; + } + if (prefixLen) { + // Known prefix found, so scan for word without prefix + tempStr.deletePrefix(prefixLen); + word = getPrimeWord(tempStr); + if (word) + tempStr = str; + } else { + if (tempStr.hasPrefix("anti")) + prefixLen = 4; + else if (tempStr.hasPrefix("counter")) + prefixLen = 7; + + if (prefixLen) { + tempStr.deletePrefix(prefixLen); + word = getPrimeWord(tempStr); + if (word) + tempStr = str; + } + } + + // TODO +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_vocab.h b/engines/titanic/true_talk/tt_vocab.h index 0a3e826fe6..16515cee26 100644 --- a/engines/titanic/true_talk/tt_vocab.h +++ b/engines/titanic/true_talk/tt_vocab.h @@ -65,7 +65,7 @@ public: * @param srcWord Optional pointer to store the original word match was found on * @returns A new word instance if a match if found, or null if not */ - TTword *getPrimeWord(TTstring &str, TTword **srcWord) const; + TTword *getPrimeWord(TTstring &str, TTword **srcWord = nullptr) const; void fn1(TTstring &str); }; -- cgit v1.2.3 From 72add4230f881a8e2cb57475eda9692242f59611 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 18 May 2016 23:24:50 -0400 Subject: TITANIC: Finished TTvocab getPrefixedWord --- engines/titanic/true_talk/tt_parser.cpp | 2 +- engines/titanic/true_talk/tt_string.h | 2 +- engines/titanic/true_talk/tt_synonym.cpp | 5 +++ engines/titanic/true_talk/tt_synonym.h | 1 + engines/titanic/true_talk/tt_vocab.cpp | 57 ++++++++++++++++++++++++-------- engines/titanic/true_talk/tt_vocab.h | 8 ++++- engines/titanic/true_talk/tt_word.cpp | 14 ++++++++ engines/titanic/true_talk/tt_word.h | 14 +++++++- 8 files changed, 85 insertions(+), 18 deletions(-) diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 1658a27b55..efed166a6b 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -474,7 +474,7 @@ int TTparser::findFrames(TTsentence *sentence) { TTstring wordString; for (;;) { // Keep stripping words off the start of the passed input - TTstring wordString = line->tokenize(" \n"); + wordString = line->tokenize(" \n"); if (wordString.empty()) break; diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index 3cc1e5ec40..faf1d6dc71 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -86,7 +86,7 @@ public: bool hasPrefix(const CString &str) const { return _data->_string.hasPrefix(str); } - bool hasPrefix(const const char *str) const { + bool hasPrefix(const char *str) const { return _data->_string.hasPrefix(str); } bool hasSuffix(const CString &str) const { diff --git a/engines/titanic/true_talk/tt_synonym.cpp b/engines/titanic/true_talk/tt_synonym.cpp index 636b4438f1..0f56c5cb22 100644 --- a/engines/titanic/true_talk/tt_synonym.cpp +++ b/engines/titanic/true_talk/tt_synonym.cpp @@ -42,6 +42,11 @@ TTsynonym::TTsynonym(int mode, const char *str, FileHandle file) : _file = file; } +TTsynonym::TTsynonym(int mode, TTstring *str) : TTstringNode() { + _string = *str; + initialize(mode); +} + TTsynonym *TTsynonym::copyFrom(const TTsynonym *src) { if (src->_field1C) { _field1C = 5; diff --git a/engines/titanic/true_talk/tt_synonym.h b/engines/titanic/true_talk/tt_synonym.h index e95a6d4faa..d5dc2be09e 100644 --- a/engines/titanic/true_talk/tt_synonym.h +++ b/engines/titanic/true_talk/tt_synonym.h @@ -38,6 +38,7 @@ public: TTsynonym(); TTsynonym(const TTsynonym *src); TTsynonym(int mode, const char *str, FileHandle file); + TTsynonym(int mode, TTstring *str); /** * Copies data from one synonym to another diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp index dfe894dcd1..5145e4f1b9 100644 --- a/engines/titanic/true_talk/tt_vocab.cpp +++ b/engines/titanic/true_talk/tt_vocab.cpp @@ -208,7 +208,7 @@ TTword *TTvocab::getPrimeWord(TTstring &str, TTword **srcWord) const { return newWord; } -void TTvocab::fn1(TTstring &str) { +TTword *TTvocab::getPrefixedWord(TTstring &str) { TTstring tempStr(str); TTword *word = nullptr; int prefixLen = 0; @@ -221,28 +221,57 @@ void TTvocab::fn1(TTstring &str) { prefixLen = 5; } else if (tempStr.hasPrefix("over") || tempStr.hasPrefix("post") || tempStr.hasPrefix("self")) { prefixLen = 4; - } + } + if (prefixLen) { // Known prefix found, so scan for word without prefix tempStr.deletePrefix(prefixLen); word = getPrimeWord(tempStr); if (word) tempStr = str; - } else { - if (tempStr.hasPrefix("anti")) - prefixLen = 4; - else if (tempStr.hasPrefix("counter")) - prefixLen = 7; - - if (prefixLen) { - tempStr.deletePrefix(prefixLen); - word = getPrimeWord(tempStr); - if (word) - tempStr = str; + + } else if (tempStr.hasPrefix("anti") || tempStr.hasPrefix("counter")) { + prefixLen = tempStr[0] == 'a' ? 4 : 7; + + tempStr.deletePrefix(prefixLen); + word = getPrimeWord(tempStr); + if (!word) + tempStr = str; + else if (word->_wordMode == 8) { + delete word; + word = nullptr; } + + } else if (tempStr.hasPrefix("hyper") || tempStr.hasPrefix("super") || + tempStr.hasPrefix("ultra")) { + tempStr.deletePrefix(5); + word = getPrimeWord(tempStr); + + if (!word) + tempStr = str; + else if (word->_wordMode == 8) { + int val1 = word->proc15(); + int val2 = word->proc15(); + + if (val2 < 5) { + if (--val1 > 0) + word->unkFn1(val1); + } else if (++val1 < 11) { + word->unkFn1(val1); + } + } + } + + if (word) { + // Set the original word on either the found word or synonym + if (word->hasSynonyms()) + word->setSynStr(&str); + else + word->_string = str; } - // TODO + delete tempStr; + return word; } } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_vocab.h b/engines/titanic/true_talk/tt_vocab.h index 16515cee26..8b2a080ce9 100644 --- a/engines/titanic/true_talk/tt_vocab.h +++ b/engines/titanic/true_talk/tt_vocab.h @@ -67,7 +67,13 @@ public: */ TTword *getPrimeWord(TTstring &str, TTword **srcWord = nullptr) const; - void fn1(TTstring &str); + /** + * Checks the passed word for common prefixes, and checks for a word + * match for the word without the given prefix + * @param str Word to check + * @returns New word instance for found match, or nullptr otherwise + */ + TTword *getPrefixedWord(TTstring &str); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index a09af4ab34..bc029d001a 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -109,6 +109,16 @@ void TTword::setSyn(TTsynonym *synP) { _synP = synP; } +int TTword::setSynStr(TTstring *str) { + if (str->empty()) + return 4; + + TTstring *newStr = new TTstring(*str); + TTsynonym *newSyn = new TTsynonym(4, newStr); + setSyn(newSyn); + return 0; +} + void TTword::appendNode(TTsynonym *node) { if (_synP) _synP->addNode(node); @@ -172,6 +182,10 @@ TTword *TTword::copy() { return new TTword(this); } +void TTword::unkFn1(int val) { + // TODO: This method seems to reference a field beyond the size of TTword +} + FileHandle TTword::getSynFile() const { return _synP ? _synP->_file : HANDLE_STDIN; } diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index 885409ccb0..7f0f916677 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -32,7 +32,6 @@ namespace Titanic { class TTword { protected: TTstringStatus _status; - int _wordMode; int _field1C; int _field20; int _field24; @@ -49,6 +48,7 @@ public: TTword *_nextP; TTsynonym *_synP; TTstring _string; + int _wordMode; public: TTword(TTstring &str, int mode, int val2); TTword(TTword *src); @@ -68,6 +68,16 @@ public: */ void setSyn(TTsynonym *synP); + /** + * Set a new synonym string + */ + int setSynStr(TTstring *str); + + /** + * Returns true if synonyms have been set for the word + */ + bool hasSynonyms() const { return _synP != nullptr; } + /** * Either sets the first synonym for a word, or adds it to an existing one */ @@ -99,6 +109,8 @@ public: */ virtual TTword *copy(); + void unkFn1(int val); + virtual bool proc2(int val) const { return false; } virtual int proc3() const { return -1; } virtual void proc4() {} -- cgit v1.2.3 From fc05032feded6af51ac1c0b05488e4eea2c6e891 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 18 May 2016 23:58:52 -0400 Subject: TITANIC: Finished TTvocab getWord --- engines/titanic/true_talk/tt_vocab.cpp | 23 ++++++++++++++++++++++- engines/titanic/true_talk/tt_vocab.h | 24 ++++++++++++++++++++---- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp index 5145e4f1b9..5a52e75bb5 100644 --- a/engines/titanic/true_talk/tt_vocab.cpp +++ b/engines/titanic/true_talk/tt_vocab.cpp @@ -174,6 +174,22 @@ TTword *TTvocab::findWord(const TTstring &str) { return word; } +TTword *TTvocab::getWord(TTstring &str, TTword **srcWord) const { + TTword *word = getPrimeWord(str, srcWord); + + if (!word) { + TTstring tempStr(str); + if (tempStr.size() > 2) { + word = getPluralizedWord(tempStr); + + if (!word) + word = getPrefixedWord(tempStr); + } + } + + return word; +} + TTword *TTvocab::getPrimeWord(TTstring &str, TTword **srcWord) const { TTsynonym tempSyn; char c = str.charAt(0); @@ -208,7 +224,12 @@ TTword *TTvocab::getPrimeWord(TTstring &str, TTword **srcWord) const { return newWord; } -TTword *TTvocab::getPrefixedWord(TTstring &str) { +TTword *TTvocab::getPluralizedWord(TTstring &str) const { + // TODO + return nullptr; +} + +TTword *TTvocab::getPrefixedWord(TTstring &str) const { TTstring tempStr(str); TTword *word = nullptr; int prefixLen = 0; diff --git a/engines/titanic/true_talk/tt_vocab.h b/engines/titanic/true_talk/tt_vocab.h index 8b2a080ce9..7da0db3e20 100644 --- a/engines/titanic/true_talk/tt_vocab.h +++ b/engines/titanic/true_talk/tt_vocab.h @@ -53,9 +53,6 @@ private: * Scans the vocab list for an existing word match */ TTword *findWord(const TTstring &str); -public: - TTvocab(int val); - ~TTvocab(); /** * Scans the vocab list for a word with a synonym matching the passed string. @@ -67,13 +64,32 @@ public: */ TTword *getPrimeWord(TTstring &str, TTword **srcWord = nullptr) const; + /** + * Checks the passed word for common pluralization, and if present checks + * for a word match for the base singular word + * @param str Word to check + * @returns New word instance for found match, or nullptr otherwise + */ + TTword *getPluralizedWord(TTstring &str) const; + /** * Checks the passed word for common prefixes, and checks for a word * match for the word without the given prefix * @param str Word to check * @returns New word instance for found match, or nullptr otherwise */ - TTword *getPrefixedWord(TTstring &str); + TTword *getPrefixedWord(TTstring &str) const; +public: + TTvocab(int val); + ~TTvocab(); + + /** + * Gets a matching word from the vocab list given a passed string + * @param str Word text to scan for + * @param srcWord Optional pointer to store the original word match was found on + * @returns A new word instance if a match if found, or null if not + */ + TTword *getWord(TTstring &str, TTword **srcWord = nullptr) const; }; } // End of namespace Titanic -- cgit v1.2.3 From 6fa65bbf0a1a57e47f36a3dd9e1c7a90af2888f6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 19 May 2016 08:04:56 -0400 Subject: TITANIC: Add proper destruction of node chains --- engines/titanic/true_talk/tt_script_base.cpp | 11 +++++++++-- engines/titanic/true_talk/tt_script_base.h | 4 +++- engines/titanic/true_talk/tt_sentence.cpp | 21 ++++++++++++++++++++- engines/titanic/true_talk/tt_sentence.h | 8 +++++++- engines/titanic/true_talk/tt_word.cpp | 7 +++++++ engines/titanic/true_talk/tt_word.h | 1 + 6 files changed, 47 insertions(+), 5 deletions(-) diff --git a/engines/titanic/true_talk/tt_script_base.cpp b/engines/titanic/true_talk/tt_script_base.cpp index 16783dec0f..a8e0940471 100644 --- a/engines/titanic/true_talk/tt_script_base.cpp +++ b/engines/titanic/true_talk/tt_script_base.cpp @@ -28,7 +28,7 @@ namespace Titanic { TTscriptBase::TTscriptBase(int v1, const char *charClass, int v2, const char *charName, int v3, int v4, int v5, int v6, int v7) : _charName(charName), _charClass(charClass), - _field4(0), _field8(0), _hist(nullptr), + _nodesP(nullptr), _field8(0), _hist(nullptr), _field20(0), _field24(0), _field28(0), _field2C(0), _field30(0), _field34(0), _field38(0), _field3C(0), _field40(0), _field44(0), _field48(0), _status(0) { @@ -50,6 +50,13 @@ TTscriptBase::TTscriptBase(int v1, const char *charClass, int v2, reset(); } +TTscriptBase::~TTscriptBase() { + if (_nodesP) { + _nodesP->deleteSiblings(); + delete _nodesP; + } +} + bool TTscriptBase::areNamesValid() { bool result = !_charName.isValid() && !_charClass.isValid(); _status = result ? 0 : 11; @@ -57,7 +64,7 @@ bool TTscriptBase::areNamesValid() { } void TTscriptBase::reset() { - _field4 = 0; + _nodesP = nullptr; _field8 = 4; _hist = nullptr; _field20 = 0; diff --git a/engines/titanic/true_talk/tt_script_base.h b/engines/titanic/true_talk/tt_script_base.h index 9bcb33467d..ce83cd13c4 100644 --- a/engines/titanic/true_talk/tt_script_base.h +++ b/engines/titanic/true_talk/tt_script_base.h @@ -25,6 +25,7 @@ #include "titanic/true_talk/tt_string.h" #include "titanic/true_talk/tt_hist.h" +#include "titanic/true_talk/tt_node.h" namespace Titanic { @@ -38,7 +39,7 @@ class TTscriptBase { private: void reset(); protected: - int _field4; + TTnode *_nodesP; int _field8; TThist *_hist; TTstring _charName, _charClass; @@ -57,6 +58,7 @@ protected: public: TTscriptBase(int v1, const char *charClass, int v2, const char *charName, int v3, int v4, int v5, int v6, int v7); + virtual ~TTscriptBase(); bool areNamesValid(); diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index f7779eb8bb..2654a55d67 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -27,7 +27,17 @@ namespace Titanic { TTsentenceSubBase::TTsentenceSubBase() : _field0(0), _field4(0), _field8(0), _fieldC(0), _field10(0), _field14(0), _field18(0), _field1C(0), - _field20(0), _field24(0) { + _nextP(nullptr), _field24(0) { +} + +void TTsentenceSubBase::deleteSiblings() { + // Iterate through the linked chain of nodes, deleting each in turn + for (TTsentenceSubBase *curP = _nextP, *nextP = nullptr; nextP; curP = nextP) { + nextP = curP->_nextP; + delete curP; + } + + _nextP = nullptr; } /*------------------------------------------------------------------------*/ @@ -45,6 +55,15 @@ TTsentence::TTsentence(const TTsentence *src) : _initialLine(src->_initialLine), copyFrom(*src); } +TTsentence::~TTsentence() { + _sub.deleteSiblings(); + + if (_nodesP) { + _nodesP->deleteSiblings(); + delete _nodesP; + } +} + void TTsentence::copyFrom(const TTsentence &src) { if (!src.getStatus()) _status = SS_5; diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index 9f6d18ee06..042e0558ac 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -42,10 +42,15 @@ public: int _field14; int _field18; int _field1C; - int _field20; + TTsentenceSubBase *_nextP; int _field24; public: TTsentenceSubBase(); + + /** + * Delete any sibling chain attached to this node + */ + void deleteSiblings(); }; class TTsentenceSub : public TTsentenceSubBase { @@ -78,6 +83,7 @@ public: TTsentence(int inputCtr, const TTstring &line, CScriptHandler *owner, TTroomScript *roomScript, TTnpcScript *npcScript); TTsentence(const TTsentence *src); + ~TTsentence(); void set34(int v) { _field34 = v; } void set38(int v) { _field38 = v; } diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index bc029d001a..a4147a8662 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -68,6 +68,13 @@ TTword::TTword(TTword *src) { _field28 = src->_field28; } +TTword::~TTword() { + if (_synP) { + _synP->deleteSiblings(); + delete _synP; + } +} + void TTword::deleteSiblings() { while (_nextP) { TTword *next = _nextP; diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index 7f0f916677..ed32b35814 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -52,6 +52,7 @@ public: public: TTword(TTstring &str, int mode, int val2); TTword(TTword *src); + ~TTword(); /** * Delete any following words chained to the word -- cgit v1.2.3 From c858190c54ec3c0bb6f0f9b4a22b4cda1d893bbb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 19 May 2016 19:03:35 -0400 Subject: TITANIC: Beginnings of TTvocab getSuffixedWord --- engines/titanic/true_talk/tt_string.cpp | 18 ++++++++++++++++++ engines/titanic/true_talk/tt_string.h | 6 ++++++ engines/titanic/true_talk/tt_vocab.cpp | 29 +++++++++++++++++++++++++++-- engines/titanic/true_talk/tt_vocab.h | 6 +++--- 4 files changed, 54 insertions(+), 5 deletions(-) diff --git a/engines/titanic/true_talk/tt_string.cpp b/engines/titanic/true_talk/tt_string.cpp index 76c109284a..90a9aaa635 100644 --- a/engines/titanic/true_talk/tt_string.cpp +++ b/engines/titanic/true_talk/tt_string.cpp @@ -139,4 +139,22 @@ int TTstring::deletePrefix(int count) { return 1; } +int TTstring::deleteSuffix(int count) { + int strSize = size(); + if (count > strSize) + count = strSize; + + CString newStr(_data->_string.c_str(), _data->_string.c_str() + strSize - count); + if (_data->_referenceCount == 1) { + // No other references to this string, so we can just directly modify it + _data->_string = newStr; + } else { + // Detach string from current shared data, and create a new one with the substring + _data->_referenceCount--; + _data = new TTstringData(newStr); + } + + return 1; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index faf1d6dc71..600312431c 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -156,6 +156,12 @@ public: * Delets a specififed number of characters from the start of the string */ int deletePrefix(int count); + + /** + * Delets a specififed number of characters from the end of the string + */ + int deleteSuffix(int count); + }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp index 5a52e75bb5..073c7c2260 100644 --- a/engines/titanic/true_talk/tt_vocab.cpp +++ b/engines/titanic/true_talk/tt_vocab.cpp @@ -180,7 +180,7 @@ TTword *TTvocab::getWord(TTstring &str, TTword **srcWord) const { if (!word) { TTstring tempStr(str); if (tempStr.size() > 2) { - word = getPluralizedWord(tempStr); + word = getSuffixedWord(tempStr); if (!word) word = getPrefixedWord(tempStr); @@ -224,7 +224,32 @@ TTword *TTvocab::getPrimeWord(TTstring &str, TTword **srcWord) const { return newWord; } -TTword *TTvocab::getPluralizedWord(TTstring &str) const { +TTword *TTvocab::getSuffixedWord(TTstring &str) const { + TTstring tempStr(str); + TTword *word = nullptr; + + if (tempStr.hasSuffix("s")) { + tempStr.deleteSuffix(1); + word = getPrimeWord(tempStr); + + if (!word) { + if (!tempStr.hasSuffix("e")) { + tempStr = str; + } else { + tempStr.deleteLastChar(); + word = getPrimeWord(tempStr); + } + } + + } else if (tempStr.hasSuffix("ing")) { + tempStr.deleteSuffix(3); + word = getPrimeWord(tempStr); + + if (word) { + + } + } + // TODO return nullptr; } diff --git a/engines/titanic/true_talk/tt_vocab.h b/engines/titanic/true_talk/tt_vocab.h index 7da0db3e20..c84acbe741 100644 --- a/engines/titanic/true_talk/tt_vocab.h +++ b/engines/titanic/true_talk/tt_vocab.h @@ -65,12 +65,12 @@ private: TTword *getPrimeWord(TTstring &str, TTword **srcWord = nullptr) const; /** - * Checks the passed word for common pluralization, and if present checks - * for a word match for the base singular word + * Checks the passed word for common suffixes, like 's', 'ing', etc. and, if found, + * checks for a word match for the base word without the suffix. * @param str Word to check * @returns New word instance for found match, or nullptr otherwise */ - TTword *getPluralizedWord(TTstring &str) const; + TTword *getSuffixedWord(TTstring &str) const; /** * Checks the passed word for common prefixes, and checks for a word -- cgit v1.2.3 From 54669e7b7e6c3e3ebad32f2d36932d8345814d2c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 19 May 2016 20:49:39 -0400 Subject: TITANIC: Added an enum for TTword wordMode --- engines/titanic/true_talk/tt_action.cpp | 6 ++-- engines/titanic/true_talk/tt_action.h | 2 +- engines/titanic/true_talk/tt_adj.cpp | 6 ++-- engines/titanic/true_talk/tt_adj.h | 2 +- engines/titanic/true_talk/tt_major_word.cpp | 4 +-- engines/titanic/true_talk/tt_major_word.h | 2 +- engines/titanic/true_talk/tt_picture.cpp | 6 ++-- engines/titanic/true_talk/tt_picture.h | 2 +- engines/titanic/true_talk/tt_pronoun.cpp | 6 ++-- engines/titanic/true_talk/tt_pronoun.h | 2 +- engines/titanic/true_talk/tt_vocab.cpp | 50 ++++++++++++++++++++++++----- engines/titanic/true_talk/tt_word.cpp | 4 +-- engines/titanic/true_talk/tt_word.h | 11 +++++-- 13 files changed, 71 insertions(+), 32 deletions(-) diff --git a/engines/titanic/true_talk/tt_action.cpp b/engines/titanic/true_talk/tt_action.cpp index 39e31747ee..028da46c4e 100644 --- a/engines/titanic/true_talk/tt_action.cpp +++ b/engines/titanic/true_talk/tt_action.cpp @@ -26,8 +26,8 @@ namespace Titanic { bool TTaction::_staticFlag; -TTaction::TTaction(TTstring &str, int val1, int val2, int val3, int val4) : - TTmajorWord(str, val1, val2, val3), _field30(val4) { +TTaction::TTaction(TTstring &str, WordMode mode, int val2, int val3, int val4) : + TTmajorWord(str, mode, val2, val3), _field30(val4) { } TTaction::TTaction(TTaction *src) : TTmajorWord(src) { @@ -42,7 +42,7 @@ TTaction::TTaction(TTaction *src) : TTmajorWord(src) { int TTaction::load(SimpleFile *file) { int val; - if (!TTword::load(file, 1) && file->scanf("%d", &val)) { + if (!TTword::load(file, WMODE_1) && file->scanf("%d", &val)) { _field30 = val; return 0; } else { diff --git a/engines/titanic/true_talk/tt_action.h b/engines/titanic/true_talk/tt_action.h index 822ba4a3a2..b89d702614 100644 --- a/engines/titanic/true_talk/tt_action.h +++ b/engines/titanic/true_talk/tt_action.h @@ -33,7 +33,7 @@ private: protected: int _field30; public: - TTaction(TTstring &str, int val1, int val2, int val3, int val4); + TTaction(TTstring &str, WordMode mode, int val2, int val3, int val4); TTaction(TTaction *src); /** diff --git a/engines/titanic/true_talk/tt_adj.cpp b/engines/titanic/true_talk/tt_adj.cpp index 8f62bb8e0a..850692f69c 100644 --- a/engines/titanic/true_talk/tt_adj.cpp +++ b/engines/titanic/true_talk/tt_adj.cpp @@ -26,8 +26,8 @@ namespace Titanic { bool TTadj::_staticFlag; -TTadj::TTadj(TTstring &str, int val1, int val2, int val3, int val4) : - TTmajorWord(str, val1, val2, val3) { +TTadj::TTadj(TTstring &str, WordMode mode, int val2, int val3, int val4) : + TTmajorWord(str, mode, val2, val3) { if (val4 >= 0 && val4 <= 9) { _field30 = val4; } else { @@ -48,7 +48,7 @@ TTadj::TTadj(TTadj *src) : TTmajorWord(src) { int TTadj::load(SimpleFile *file) { int val; - if (!TTword::load(file, 8) && file->scanf("%d", &val)) { + if (!TTword::load(file, WMODE_8) && file->scanf("%d", &val)) { _field30 = val; return 0; } else { diff --git a/engines/titanic/true_talk/tt_adj.h b/engines/titanic/true_talk/tt_adj.h index 301023ed5e..f18d249a99 100644 --- a/engines/titanic/true_talk/tt_adj.h +++ b/engines/titanic/true_talk/tt_adj.h @@ -33,7 +33,7 @@ private: protected: int _field30; public: - TTadj(TTstring &str, int val1, int val2, int val3, int val4); + TTadj(TTstring &str, WordMode mode, int val2, int val3, int val4); TTadj(TTadj *src); /** diff --git a/engines/titanic/true_talk/tt_major_word.cpp b/engines/titanic/true_talk/tt_major_word.cpp index 68af628dbb..b81ada4de1 100644 --- a/engines/titanic/true_talk/tt_major_word.cpp +++ b/engines/titanic/true_talk/tt_major_word.cpp @@ -26,8 +26,8 @@ namespace Titanic { bool TTmajorWord::_staticFlag; -TTmajorWord::TTmajorWord(TTstring &str, int val1, int val2, int val3) : - TTword(str, val1, val2), _field2C(val3) { +TTmajorWord::TTmajorWord(TTstring &str, WordMode mode, int val2, int val3) : + TTword(str, mode, val2), _field2C(val3) { } TTmajorWord::TTmajorWord(TTmajorWord *src) : TTword(src) { diff --git a/engines/titanic/true_talk/tt_major_word.h b/engines/titanic/true_talk/tt_major_word.h index 962fbaab6d..55eb882c8e 100644 --- a/engines/titanic/true_talk/tt_major_word.h +++ b/engines/titanic/true_talk/tt_major_word.h @@ -38,7 +38,7 @@ protected: */ int saveData(SimpleFile *file, int val) const; public: - TTmajorWord(TTstring &str, int val1, int val2, int val3); + TTmajorWord(TTstring &str, WordMode mode, int val2, int val3); TTmajorWord(TTmajorWord *src); /** diff --git a/engines/titanic/true_talk/tt_picture.cpp b/engines/titanic/true_talk/tt_picture.cpp index 6213cd557b..aab9c5d7aa 100644 --- a/engines/titanic/true_talk/tt_picture.cpp +++ b/engines/titanic/true_talk/tt_picture.cpp @@ -26,8 +26,8 @@ namespace Titanic { bool TTpicture::_staticFlag; -TTpicture::TTpicture(TTstring &str, int val1, int val2, int val3, int val4, int val5, int val6) : - TTmajorWord(str, val1, val2, val4), _tag(val3), _field30(val5), _field3C(val6), +TTpicture::TTpicture(TTstring &str, WordMode mode, int val2, int val3, int val4, int val5, int val6) : + TTmajorWord(str, mode, val2, val4), _tag(val3), _field30(val5), _field3C(val6), _field38(0) { } @@ -50,7 +50,7 @@ int TTpicture::load(SimpleFile *file) { CString str; int val1, val2; - if (!TTword::load(file, 2) && file->scanf("%s %d %d", &str, &val1, &val2)) { + if (!TTword::load(file, WMODE_2) && file->scanf("%s %d %d", &str, &val1, &val2)) { _tag = readNumber(str.c_str()); _field30 = val1; _field3C = val2; diff --git a/engines/titanic/true_talk/tt_picture.h b/engines/titanic/true_talk/tt_picture.h index c4cc2c19d3..404d9c4b03 100644 --- a/engines/titanic/true_talk/tt_picture.h +++ b/engines/titanic/true_talk/tt_picture.h @@ -36,7 +36,7 @@ protected: int _field38; int _field3C; public: - TTpicture(TTstring &str, int val1, int val2, int val3, int val4, int val5, int val6); + TTpicture(TTstring &str, WordMode mode, int val2, int val3, int val4, int val5, int val6); TTpicture(TTpicture *src); /** diff --git a/engines/titanic/true_talk/tt_pronoun.cpp b/engines/titanic/true_talk/tt_pronoun.cpp index 4b20b3341b..68fcef02a3 100644 --- a/engines/titanic/true_talk/tt_pronoun.cpp +++ b/engines/titanic/true_talk/tt_pronoun.cpp @@ -26,8 +26,8 @@ namespace Titanic { bool TTpronoun::_staticFlag; -TTpronoun::TTpronoun(TTstring &str, int val1, int val2, int val3, int val4) : - TTmajorWord(str, val1, val2, val3), _field30(val4) { +TTpronoun::TTpronoun(TTstring &str, WordMode mode, int val2, int val3, int val4) : + TTmajorWord(str, mode, val2, val3), _field30(val4) { } TTpronoun::TTpronoun(TTpronoun *src) : TTmajorWord(src) { @@ -42,7 +42,7 @@ TTpronoun::TTpronoun(TTpronoun *src) : TTmajorWord(src) { int TTpronoun::load(SimpleFile *file) { int val; - if (!TTword::load(file, 6) && file->scanf("%d", &val)) { + if (!TTword::load(file, WMODE_6) && file->scanf("%d", &val)) { if (val >= 0 && val <= 12) { _field30 = val; return 0; diff --git a/engines/titanic/true_talk/tt_pronoun.h b/engines/titanic/true_talk/tt_pronoun.h index 6bb8113e15..5aa3e1e8fe 100644 --- a/engines/titanic/true_talk/tt_pronoun.h +++ b/engines/titanic/true_talk/tt_pronoun.h @@ -33,7 +33,7 @@ private: protected: int _field30; public: - TTpronoun(TTstring &str, int val1, int val2, int val3, int val4); + TTpronoun(TTstring &str, WordMode mode, int val2, int val3, int val4); TTpronoun(TTpronoun *src); /** diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp index 073c7c2260..b5276e1f85 100644 --- a/engines/titanic/true_talk/tt_vocab.cpp +++ b/engines/titanic/true_talk/tt_vocab.cpp @@ -52,7 +52,7 @@ int TTvocab::load(const CString &name) { while (!result && !file->eos()) { skipFlag = false; - int mode = file->readNumber(); + WordMode mode = (WordMode)file->readNumber(); TTstring space(" "); switch (mode) { @@ -64,14 +64,14 @@ int TTvocab::load(const CString &name) { } case 1: { - TTaction *word = new TTaction(space, 0, 0, 0, 0); + TTaction *word = new TTaction(space, WMODE_NONE, 0, 0, 0); result = word->load(file); _word = word; break; } case 2: { - TTpicture *word = new TTpicture(space, 0, 0, 0, 0, 0, 0); + TTpicture *word = new TTpicture(space, WMODE_NONE, 0, 0, 0, 0, 0); result = word->load(file); _word = word; break; @@ -79,7 +79,7 @@ int TTvocab::load(const CString &name) { case 3: case 9: { - TTmajorWord *word = new TTmajorWord(space, 0, 0, 0); + TTmajorWord *word = new TTmajorWord(space, WMODE_NONE, 0, 0); result = word->load(file, mode); _word = word; break; @@ -88,21 +88,21 @@ int TTvocab::load(const CString &name) { case 4: case 5: case 7: { - TTword *word = new TTword(space, 0, 0); + TTword *word = new TTword(space, WMODE_NONE, 0); result = word->load(file, mode); _word = word; break; } case 8: { - TTadj *word = new TTadj(space, 0, 0, 0, 0); + TTadj *word = new TTadj(space, WMODE_NONE, 0, 0, 0); result = word->load(file); _word = word; break; } case 6: { - TTpronoun *word = new TTpronoun(space, 0, 0, 0, 0); + TTpronoun *word = new TTpronoun(space, WMODE_NONE, 0, 0, 0); result = word->load(file); _word = word; break; @@ -198,7 +198,7 @@ TTword *TTvocab::getPrimeWord(TTstring &str, TTword **srcWord) const { if (!Common::isDigit(c)) { vocabP = _headP; - newWord = new TTword(str, 3, 300); + newWord = new TTword(str, WMODE_3, 300); } else { for (vocabP = _headP; vocabP && !newWord; vocabP = vocabP->_nextP) { if (_vocabMode == 3 && !strcmp(str.c_str(), vocabP->c_str())) { @@ -246,8 +246,42 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const { word = getPrimeWord(tempStr); if (word) { + if (word->_wordMode == 1) { + delete word; + word = nullptr; + } else { + delete word; + word = new TTadj(str, WMODE_8, 0, 0, 0); + } + } else { + tempStr += "e"; + word = getPrimeWord(tempStr); + + if (word) { + if (word->_wordMode != 1) { + delete word; + word = new TTadj(str, WMODE_8, 0, 0, 0); + } + } else { + tempStr.deleteSuffix(2); + word = getPrimeWord(tempStr); + if (word) { + if (word->_wordMode != 1) { + delete word; + word = new TTadj(str, WMODE_8, 0, 0, 0); + } + } else { + tempStr = str; + } + } } + + } else if (tempStr.hasSuffix("ed")) { + tempStr.deleteSuffix(1); + word = getPrimeWord(tempStr); + + // TODO } // TODO diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index a4147a8662..eebb161167 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -26,7 +26,7 @@ namespace Titanic { -TTword::TTword(TTstring &str, int mode, int val2) : _string(str), +TTword::TTword(TTstring &str, WordMode mode, int val2) : _string(str), _wordMode(mode), _field1C(val2), _field20(0), _field24(0), _field28(0), _synP(nullptr), _nextP(nullptr) { _status = str.getStatus() == SS_VALID ? SS_VALID : SS_5; @@ -133,7 +133,7 @@ void TTword::appendNode(TTsynonym *node) { _synP = node; } -int TTword::load(SimpleFile *file, int mode) { +int TTword::load(SimpleFile *file, WordMode mode) { CString str1, str2; int val; diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index ed32b35814..13a40b0262 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -29,6 +29,11 @@ namespace Titanic { +enum WordMode { + WMODE_NONE = 0, WMODE_1 = 1, WMODE_2 = 2, WMODE_3 = 3, + WMODE_6 = 6, WMODE_8 = 8 +}; + class TTword { protected: TTstringStatus _status; @@ -48,9 +53,9 @@ public: TTword *_nextP; TTsynonym *_synP; TTstring _string; - int _wordMode; + WordMode _wordMode; public: - TTword(TTstring &str, int mode, int val2); + TTword(TTstring &str, WordMode mode, int val2); TTword(TTword *src); ~TTword(); @@ -87,7 +92,7 @@ public: /** * Load the word */ - int load(SimpleFile *file, int mode); + int load(SimpleFile *file, WordMode mode); /** * Finds a synonym in the word by name, if one exists -- cgit v1.2.3 From c4084e731b60b97bbe0cdf5d6f61f1894b70f96c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 19 May 2016 22:51:25 -0400 Subject: TITANIC: Implemented TTvocab getSuffixedWord --- engines/titanic/true_talk/tt_action.cpp | 2 +- engines/titanic/true_talk/tt_action.h | 2 + engines/titanic/true_talk/tt_vocab.cpp | 199 +++++++++++++++++++++++++++++++- engines/titanic/true_talk/tt_word.h | 6 +- 4 files changed, 202 insertions(+), 7 deletions(-) diff --git a/engines/titanic/true_talk/tt_action.cpp b/engines/titanic/true_talk/tt_action.cpp index 028da46c4e..e0c7284b7a 100644 --- a/engines/titanic/true_talk/tt_action.cpp +++ b/engines/titanic/true_talk/tt_action.cpp @@ -42,7 +42,7 @@ TTaction::TTaction(TTaction *src) : TTmajorWord(src) { int TTaction::load(SimpleFile *file) { int val; - if (!TTword::load(file, WMODE_1) && file->scanf("%d", &val)) { + if (!TTword::load(file, WMODE_ACTION) && file->scanf("%d", &val)) { _field30 = val; return 0; } else { diff --git a/engines/titanic/true_talk/tt_action.h b/engines/titanic/true_talk/tt_action.h index b89d702614..1103da8dcb 100644 --- a/engines/titanic/true_talk/tt_action.h +++ b/engines/titanic/true_talk/tt_action.h @@ -41,6 +41,8 @@ public: */ int load(SimpleFile *file); + void setVal(int val) { _field30 = val; } + /** * Creates a copy of the word */ diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp index b5276e1f85..2e5a7cc794 100644 --- a/engines/titanic/true_talk/tt_vocab.cpp +++ b/engines/titanic/true_talk/tt_vocab.cpp @@ -280,12 +280,205 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const { } else if (tempStr.hasSuffix("ed")) { tempStr.deleteSuffix(1); word = getPrimeWord(tempStr); + + if (!word) { + tempStr.deleteSuffix(1); + word = getPrimeWord(tempStr); + } + + if (word) { + if (word->_wordMode == WMODE_ACTION) { + static_cast(word)->setVal(1); + } + } else { + tempStr = str; + } + + } else if (tempStr.hasSuffix("ly")) { + tempStr.deleteSuffix(2); + word = getPrimeWord(tempStr); + + if (word) { + delete word; + word = new TTword(str, WMODE_9, 0); + } else { + tempStr = str; + } + + } else if (tempStr.hasSuffix("er")) { + tempStr.deleteSuffix(1); + word = getPrimeWord(tempStr); + + if (word) { + if (word->_wordMode == WMODE_8) { + int val1 = word->proc15(); + int val2 = word->proc15(); + + if (val2 < 5) { + if (--val1 > 0) { + word->unkFn1(val1); + } + } else { + if (++val1 < 11) { + word->unkFn1(val1); + } + } + } + } else { + tempStr.deleteSuffix(1); + word = getPrimeWord(tempStr); + + if (word) { + if (word->_wordMode == WMODE_8) { + int val1 = word->proc15(); + int val2 = word->proc15(); + + if (val2 < 5) { + if (--val1 > 0) { + word->unkFn1(val1); + } + } else { + if (++val1 < 11) { + word->unkFn1(val1); + } + } + } + } else { + tempStr.deleteSuffix(1); + word = getPrimeWord(tempStr); + + if (word && word->_wordMode == WMODE_8) { + int val1 = word->proc15(); + int val2 = word->proc15(); + + if (val2 < 5) { + if (--val1 > 0) { + word->unkFn1(val1); + } + } else { + if (++val1 < 11) { + word->unkFn1(val1); + } + } + } + } + } + + } else if (tempStr.hasSuffix("est")) { + tempStr.deleteSuffix(2); + word = getPrimeWord(tempStr); + + if (word) { + if (word->_wordMode == WMODE_8) { + int val1 = word->proc15(); + int val2 = word->proc15(); + + if (val2 < 5) { + if (--val1 > 0) { + word->unkFn1(val1); + } + } else { + if (++val1 < 11) { + word->unkFn1(val1); + } + } + } + } else { + tempStr.deleteSuffix(1); + word = getPrimeWord(tempStr); + + if (word) { + if (word->_wordMode == WMODE_8) { + int val1 = word->proc15(); + int val2 = word->proc15(); + + if (val2 < 5) { + if (--val1 > 0) { + word->unkFn1(val1); + } + } else { + if (++val1 < 11) { + word->unkFn1(val1); + } + } + } + } else { + tempStr.deleteSuffix(1); + word = getPrimeWord(tempStr); + + if (word) { + int val1 = word->proc15(); + int val2 = word->proc15(); + + if (val2 < 5) { + if (--val1 > 0) { + word->unkFn1(val1); + } + } else { + if (++val1 < 11) { + word->unkFn1(val1); + } + } + } + } + } + + } else if (tempStr.hasSuffix("s*")) { + tempStr.deleteSuffix(2); + word = getPrimeWord(tempStr); + + if (word) { + if (word->_wordMode == WMODE_6 || word->_wordMode == WMODE_9) { + delete word; + TTstring isStr("is"); + word = getPrimeWord(isStr); + } else { + switch (word->_field1C) { + case 200: + if (word->proc10() == 2) { + delete word; + word = new TTpronoun(tempStr, WMODE_6, 601, 0, 5); + } else if (word->proc10() == 1) { + delete word; + word = new TTpronoun(tempStr, WMODE_6, 601, 0, 4); + } + break; + + case 201: + delete word; + word = new TTpronoun(tempStr, WMODE_6, 601, 0, 5); + break; + + case 202: + case 203: + if (word->proc10() == 2) { + delete word; + word = new TTpronoun(tempStr, WMODE_6, 601, 0, 5); + } else { + int val = word->proc10() == 1 ? 0 : 4; + delete word; + word = new TTpronoun(tempStr, WMODE_6, 601, 0, val); + } + break; - // TODO + case 204: + delete word; + word = new TTpronoun(tempStr, WMODE_6, 601, 0, 6); + break; + + default: + delete word; + word = new TTpronoun(tempStr, WMODE_6, 601, 0, 0); + break; + } + } + } } - // TODO - return nullptr; + if (word) + word->setSynStr(&str); + + return word; } TTword *TTvocab::getPrefixedWord(TTstring &str) const { diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index 13a40b0262..0823e3d2a8 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -30,14 +30,13 @@ namespace Titanic { enum WordMode { - WMODE_NONE = 0, WMODE_1 = 1, WMODE_2 = 2, WMODE_3 = 3, - WMODE_6 = 6, WMODE_8 = 8 + WMODE_NONE = 0, WMODE_ACTION = 1, WMODE_2 = 2, WMODE_3 = 3, + WMODE_6 = 6, WMODE_8 = 8, WMODE_9 = 9 }; class TTword { protected: TTstringStatus _status; - int _field1C; int _field20; int _field24; int _field28; @@ -54,6 +53,7 @@ public: TTsynonym *_synP; TTstring _string; WordMode _wordMode; + int _field1C; public: TTword(TTstring &str, WordMode mode, int val2); TTword(TTword *src); -- cgit v1.2.3 From bb459dd5a8219e9f096c8ea52372f07484c2bf19 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 19 May 2016 22:54:49 -0400 Subject: TITANIC: Changed setSynStr parameter type --- engines/titanic/true_talk/tt_vocab.cpp | 4 ++-- engines/titanic/true_talk/tt_word.cpp | 6 +++--- engines/titanic/true_talk/tt_word.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp index 2e5a7cc794..66497a5ada 100644 --- a/engines/titanic/true_talk/tt_vocab.cpp +++ b/engines/titanic/true_talk/tt_vocab.cpp @@ -476,7 +476,7 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const { } if (word) - word->setSynStr(&str); + word->setSynStr(str); return word; } @@ -538,7 +538,7 @@ TTword *TTvocab::getPrefixedWord(TTstring &str) const { if (word) { // Set the original word on either the found word or synonym if (word->hasSynonyms()) - word->setSynStr(&str); + word->setSynStr(str); else word->_string = str; } diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index eebb161167..bb9d63d691 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -116,11 +116,11 @@ void TTword::setSyn(TTsynonym *synP) { _synP = synP; } -int TTword::setSynStr(TTstring *str) { - if (str->empty()) +int TTword::setSynStr(TTstring &str) { + if (str.empty()) return 4; - TTstring *newStr = new TTstring(*str); + TTstring *newStr = new TTstring(str); TTsynonym *newSyn = new TTsynonym(4, newStr); setSyn(newSyn); return 0; diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index 0823e3d2a8..01482a97ea 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -77,7 +77,7 @@ public: /** * Set a new synonym string */ - int setSynStr(TTstring *str); + int setSynStr(TTstring &str); /** * Returns true if synonyms have been set for the word -- cgit v1.2.3 From 378c96736a4ce86d6812886f7c06a3c6484b9de9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 May 2016 07:12:32 -0400 Subject: TITANIC: Fields renaming --- engines/titanic/true_talk/script_handler.h | 3 ++- engines/titanic/true_talk/tt_parser.cpp | 11 +++++++++-- engines/titanic/true_talk/tt_sentence.cpp | 16 +++++++++++++++- engines/titanic/true_talk/tt_sentence.h | 8 ++++++++ engines/titanic/true_talk/tt_sentence_node.cpp | 4 ++-- engines/titanic/true_talk/tt_sentence_node.h | 5 +++-- engines/titanic/true_talk/tt_word.cpp | 6 +++--- engines/titanic/true_talk/tt_word.h | 2 +- 8 files changed, 43 insertions(+), 12 deletions(-) diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index 86cc99cdf9..891a40f527 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -51,7 +51,6 @@ class CScriptHandler { private: CTitleEngine *_owner; TTscriptBase *_script; - TTvocab *_vocab; CExeResources &_resources; int _field10; CScriptHandlerSub1 _sub1; @@ -62,6 +61,8 @@ private: int _field28; int _field2C; int _field30; +public: + TTvocab *_vocab; public: CScriptHandler(CTitleEngine *owner, int val1, int val2); ~CScriptHandler(); diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index efed166a6b..787e9767da 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -478,8 +478,15 @@ int TTparser::findFrames(TTsentence *sentence) { if (wordString.empty()) break; - //TTword *word = nullptr; - //_owner->_vocab.fn1(wordString, &word); + TTword *srcWord = nullptr; + TTword *word = _owner->_vocab->getWord(wordString, &word); + sentence->storeVocabHit(srcWord); + + if (word) { + // TODO + } else { + + } } diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index 2654a55d67..ca808884d7 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -87,7 +87,7 @@ void TTsentence::copyFrom(const TTsentence &src) { // Source has processed nodes, so duplicate them for (TTsentenceNode *node = src._nodesP; node; node = static_cast(node->_nextP)) { - TTsentenceNode *newNode = new TTsentenceNode(node->_val); + TTsentenceNode *newNode = new TTsentenceNode(node->_wordP); if (_nodesP) _nodesP->addNode(newNode); else @@ -96,4 +96,18 @@ void TTsentence::copyFrom(const TTsentence &src) { } } +int TTsentence::storeVocabHit(TTword *word) { + if (!word) + return 0; + + TTsentenceNode *node = new TTsentenceNode(word); + if (_nodesP) { + _nodesP->addNode(node); + } else { + _nodesP = node; + } + + return 0; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index 042e0558ac..998aad2500 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -31,6 +31,7 @@ namespace Titanic { class CScriptHandler; +class TTword; class TTsentenceSubBase { public: @@ -89,6 +90,13 @@ public: void set38(int v) { _field38 = v; } int getStatus() const { return _status; } + + /** + * Adds a found vocab word to the list of words representing + * the player's input + * @param word Word to node + */ + int storeVocabHit(TTword *word); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_sentence_node.cpp b/engines/titanic/true_talk/tt_sentence_node.cpp index 2bec287b44..33d7501c55 100644 --- a/engines/titanic/true_talk/tt_sentence_node.cpp +++ b/engines/titanic/true_talk/tt_sentence_node.cpp @@ -25,10 +25,10 @@ namespace Titanic { -TTsentenceNode::TTsentenceNode() : TTnode(), _val(0) { +TTsentenceNode::TTsentenceNode() : TTnode(), _wordP(nullptr) { } -TTsentenceNode::TTsentenceNode(int val) : TTnode(), _val(val) { +TTsentenceNode::TTsentenceNode(TTword *word) : TTnode(), _wordP(word) { } } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_sentence_node.h b/engines/titanic/true_talk/tt_sentence_node.h index 09d106cb71..18fa56fd57 100644 --- a/engines/titanic/true_talk/tt_sentence_node.h +++ b/engines/titanic/true_talk/tt_sentence_node.h @@ -24,15 +24,16 @@ #define TITANIC_TT_SENTENCE_NODE_H #include "titanic/true_talk/tt_node.h" +#include "titanic/true_talk/tt_word.h" namespace Titanic { class TTsentenceNode : public TTnode { public: - int _val; + TTword *_wordP; public: TTsentenceNode(); - TTsentenceNode(int val); + TTsentenceNode(TTword *word); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index bb9d63d691..c277b871a4 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -27,7 +27,7 @@ namespace Titanic { TTword::TTword(TTstring &str, WordMode mode, int val2) : _string(str), - _wordMode(mode), _field1C(val2), _field20(0), _field24(0), + _wordMode(mode), _field1C(val2), _tag(0), _field24(0), _field28(0), _synP(nullptr), _nextP(nullptr) { _status = str.getStatus() == SS_VALID ? SS_VALID : SS_5; } @@ -41,7 +41,7 @@ TTword::TTword(TTword *src) { _string = src->_string; _wordMode = src->_wordMode; _field1C = src->_field1C; - _field20 = src->_field20; + _tag = src->_tag; _synP = nullptr; TTsynonym *priorSyn = nullptr; @@ -140,7 +140,7 @@ int TTword::load(SimpleFile *file, WordMode mode) { if (file->scanf("%d %s %s", &val, &str1, &str2)) { _string = str1; _field1C = val; - _field20 = readNumber(str2.c_str()); + _tag = readNumber(str2.c_str()); _wordMode = mode; return 0; } else { diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index 01482a97ea..9574bc3b0c 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -37,7 +37,6 @@ enum WordMode { class TTword { protected: TTstringStatus _status; - int _field20; int _field24; int _field28; protected: @@ -54,6 +53,7 @@ public: TTstring _string; WordMode _wordMode; int _field1C; + uint _tag; public: TTword(TTstring &str, WordMode mode, int val2); TTword(TTword *src); -- cgit v1.2.3 From 4d3ca910b7ba193eb118852380c2727747ed9eb6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 May 2016 07:18:39 -0400 Subject: TITANIC: Added TTnode methods --- engines/titanic/true_talk/tt_node.cpp | 17 +++++++++++++++++ engines/titanic/true_talk/tt_node.h | 11 +++++++++++ 2 files changed, 28 insertions(+) diff --git a/engines/titanic/true_talk/tt_node.cpp b/engines/titanic/true_talk/tt_node.cpp index 22695ad379..c72dfd3e51 100644 --- a/engines/titanic/true_talk/tt_node.cpp +++ b/engines/titanic/true_talk/tt_node.cpp @@ -38,6 +38,12 @@ void TTnode::addNode(TTnode *newNode) { newNode->_priorP = this; } +void TTnode::addToHead(TTnode *newNode) { + TTnode *head = getHead(); + head->_priorP = newNode; + newNode->_nextP = head; +} + void TTnode::detach() { if (_priorP) _priorP->_nextP = _nextP; @@ -58,6 +64,17 @@ void TTnode::deleteSiblings() { } } +TTnode *TTnode::getHead() { + if (_priorP == nullptr) + return this; + + TTnode *node = _priorP; + while (node->_priorP) + node = node->_priorP; + + return node; +} + TTnode *TTnode::getTail() { if (_nextP == nullptr) return this; diff --git a/engines/titanic/true_talk/tt_node.h b/engines/titanic/true_talk/tt_node.h index f8d1bc6766..8faebae18f 100644 --- a/engines/titanic/true_talk/tt_node.h +++ b/engines/titanic/true_talk/tt_node.h @@ -38,6 +38,12 @@ public: */ void addNode(TTnode *newNode); + /** + * Adds a new node at the beginning of the linked list + */ + void addToHead(TTnode *newNode); + + /** * Detaches a node from any predecessor and/or successor */ @@ -48,6 +54,11 @@ public: */ void deleteSiblings(); + /** + * Returns the first node at the beginning of a linked list of nodes + */ + TTnode *getHead(); + /** * Returns the final node at the end of the linked list of nodes */ -- cgit v1.2.3 From 2d83f5b13104fd173d7272bec63cb76d42c2153e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 May 2016 07:48:01 -0400 Subject: TITANIC: Starting TTparser loadRequests --- engines/titanic/true_talk/tt_parser.cpp | 32 +++++++++++++++++++++++++++++++- engines/titanic/true_talk/tt_parser.h | 18 ++++++++++++++++++ engines/titanic/true_talk/tt_word.h | 3 ++- 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 787e9767da..0d7c75c240 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -23,15 +23,24 @@ #include "titanic/true_talk/tt_parser.h" #include "titanic/true_talk/script_handler.h" #include "titanic/true_talk/tt_sentence.h" +#include "titanic/true_talk/tt_word.h" #include "titanic/titanic.h" namespace Titanic { TTparser::TTparser(CScriptHandler *owner) : _owner(owner), _sentenceSub(nullptr), - _sentence(nullptr), _fieldC(0), _field10(0), _field14(0), _field18(0) { + _sentence(nullptr), _fieldC(0), _field10(0), _field14(0), _field18(0), + _nodesP(nullptr) { loadArrays(); } +TTparser::~TTparser() { + if (_nodesP) { + _nodesP->deleteSiblings(); + delete _nodesP; + } +} + void TTparser::loadArrays() { Common::SeekableReadStream *r; r = g_vm->_filesManager->getResource("TEXT/REPLACEMENTS1"); @@ -495,4 +504,25 @@ int TTparser::findFrames(TTsentence *sentence) { return 0; } +void TTparser::loadRequests(TTword *word) { + if (word->_tag != MKTAG('Z', 'Z', 'Z', 'T')) + addNode(word->_tag); + + switch (word->_wordMode) { + case WMODE_NONE: + break; + + case WMODE_ACTION: + break; + } + // TODO +} + +void TTparser::addNode(uint tag) { + TTparserNode *newNode = new TTparserNode(tag); + if (_nodesP) + _nodesP->addToHead(newNode); + _nodesP = newNode; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index 9ef84f93ad..96c54fb113 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -23,6 +23,7 @@ #ifndef TITANIC_TT_PARSER_H #define TITANIC_TT_PARSER_H +#include "titanic/true_talk/tt_node.h" #include "titanic/true_talk/tt_sentence.h" #include "titanic/true_talk/tt_string.h" @@ -43,6 +44,14 @@ struct NumberEntry { }; typedef Common::Array NumberArray; +class TTparserNode : public TTnode { +public: + uint _tag; +public: + TTparserNode() : TTnode(), _tag(0) {} + TTparserNode(uint tag) : TTnode(), _tag(tag) {} +}; + class TTparser { private: StringArray _replacements1; @@ -50,6 +59,7 @@ private: StringArray _replacements3; StringArray _phrases; NumberArray _numbers; + TTparserNode *_nodesP; private: /** * Loads the various replacement string data arrays @@ -112,6 +122,13 @@ private: * @returns Pointer to matching number entry, if match occurred */ const NumberEntry *replaceNumbers2(TTstring &line, int *startIndex); + + void loadRequests(TTword *word); + + /** + * Creates a new parser node, and adds it to the parser's list + */ + void addNode(uint tag); public: CScriptHandler *_owner; TTsentenceSub *_sentenceSub; @@ -122,6 +139,7 @@ public: int _field18; public: TTparser(CScriptHandler *owner); + ~TTparser(); /** * Preprocesses the passed input text, to handle things like lowercasing diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index 9574bc3b0c..333bfb5bfe 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -31,7 +31,8 @@ namespace Titanic { enum WordMode { WMODE_NONE = 0, WMODE_ACTION = 1, WMODE_2 = 2, WMODE_3 = 3, - WMODE_6 = 6, WMODE_8 = 8, WMODE_9 = 9 + WMODE_4 = 4, WMODE_5 = 5, WMODE_6 = 6, WMODE_7 = 7, + WMODE_8 = 8, WMODE_9 = 9 }; class TTword { -- cgit v1.2.3 From 1e35288fee100dd3ba5cac0a128cd2b6858381c1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 May 2016 20:51:57 -0400 Subject: TITANIC: Change TTnode addNode to addToTail --- engines/titanic/true_talk/tt_node.cpp | 2 +- engines/titanic/true_talk/tt_node.h | 9 ++++----- engines/titanic/true_talk/tt_sentence.cpp | 4 ++-- engines/titanic/true_talk/tt_word.cpp | 4 ++-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/engines/titanic/true_talk/tt_node.cpp b/engines/titanic/true_talk/tt_node.cpp index c72dfd3e51..cbbb1dd756 100644 --- a/engines/titanic/true_talk/tt_node.cpp +++ b/engines/titanic/true_talk/tt_node.cpp @@ -32,7 +32,7 @@ TTnode::~TTnode() { detach(); } -void TTnode::addNode(TTnode *newNode) { +void TTnode::addToTail(TTnode *newNode) { TTnode *tail = getTail(); tail->_nextP = newNode; newNode->_priorP = this; diff --git a/engines/titanic/true_talk/tt_node.h b/engines/titanic/true_talk/tt_node.h index 8faebae18f..36d44288fd 100644 --- a/engines/titanic/true_talk/tt_node.h +++ b/engines/titanic/true_talk/tt_node.h @@ -33,16 +33,15 @@ public: TTnode(); virtual ~TTnode(); - /** - * Links the passed node to this node as a linked list - */ - void addNode(TTnode *newNode); - /** * Adds a new node at the beginning of the linked list */ void addToHead(TTnode *newNode); + /** + * Links the passed node to this node as a linked list + */ + void addToTail(TTnode *newNode); /** * Detaches a node from any predecessor and/or successor diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index ca808884d7..67e1a977ce 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -89,7 +89,7 @@ void TTsentence::copyFrom(const TTsentence &src) { node = static_cast(node->_nextP)) { TTsentenceNode *newNode = new TTsentenceNode(node->_wordP); if (_nodesP) - _nodesP->addNode(newNode); + _nodesP->addToTail(newNode); else _nodesP = newNode; } @@ -102,7 +102,7 @@ int TTsentence::storeVocabHit(TTword *word) { TTsentenceNode *node = new TTsentenceNode(word); if (_nodesP) { - _nodesP->addNode(node); + _nodesP->addToTail(node); } else { _nodesP = node; } diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index c277b871a4..dc686b88b6 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -98,7 +98,7 @@ int TTword::readSyn(SimpleFile *file) { if (_synP) { // A synonym already exists, so add new one as a tail // at the end of the linked list of synonyms - _synP->addNode(synNode); + _synP->addToTail(synNode); } else { // Very first synonym, so set it _synP = synNode; @@ -128,7 +128,7 @@ int TTword::setSynStr(TTstring &str) { void TTword::appendNode(TTsynonym *node) { if (_synP) - _synP->addNode(node); + _synP->addToTail(node); else _synP = node; } -- cgit v1.2.3 From 49c9060bec57dbc90eff6f765bccd385f4985c61 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 20 May 2016 22:44:04 -0400 Subject: TITANIC: More implementation of TTparser loadRequests --- engines/titanic/true_talk/tt_action.h | 1 + engines/titanic/true_talk/tt_parser.cpp | 151 +++++++++++++++++++++++++++++- engines/titanic/true_talk/tt_parser.h | 7 +- engines/titanic/true_talk/tt_sentence.cpp | 12 +++ engines/titanic/true_talk/tt_sentence.h | 13 ++- engines/titanic/true_talk/tt_vocab.cpp | 2 +- engines/titanic/true_talk/tt_word.cpp | 12 +-- engines/titanic/true_talk/tt_word.h | 2 +- 8 files changed, 189 insertions(+), 11 deletions(-) diff --git a/engines/titanic/true_talk/tt_action.h b/engines/titanic/true_talk/tt_action.h index 1103da8dcb..213bdab8e4 100644 --- a/engines/titanic/true_talk/tt_action.h +++ b/engines/titanic/true_talk/tt_action.h @@ -42,6 +42,7 @@ public: int load(SimpleFile *file); void setVal(int val) { _field30 = val; } + int getVal() const { return _field30; } /** * Creates a copy of the word diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 0d7c75c240..b81d3cc3bc 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -22,6 +22,7 @@ #include "titanic/true_talk/tt_parser.h" #include "titanic/true_talk/script_handler.h" +#include "titanic/true_talk/tt_action.h" #include "titanic/true_talk/tt_sentence.h" #include "titanic/true_talk/tt_word.h" #include "titanic/titanic.h" @@ -504,7 +505,9 @@ int TTparser::findFrames(TTsentence *sentence) { return 0; } -void TTparser::loadRequests(TTword *word) { +int TTparser::loadRequests(TTword *word) { + int status = 0; + if (word->_tag != MKTAG('Z', 'Z', 'Z', 'T')) addNode(word->_tag); @@ -513,9 +516,127 @@ void TTparser::loadRequests(TTword *word) { break; case WMODE_ACTION: + if (word->_id != 0x70 && word->_id != 0x71) + addNode(1); + addNode(17); + + switch (word->_id) { + case 101: + case 110: + addNode(5); + addNode(4); + break; + + case 102: + addNode(4); + break; + + case 103: + case 111: + addNode(8); + addNode(7); + addNode(5); + addNode(4); + break; + + case 104: + case 107: + addNode(15); + addNode(5); + addNode(4); + break; + + case 106: + addNode(7); + addNode(4); + break; + + case 108: + addNode(5); + addNode(4); + addNode(23); + break; + + case 112: + case 113: + addNode(13); + addNode(5); + break; + + default: + break; + } + + if (_sentenceSub) { + if (_sentenceSub->get18() == 0 || _sentenceSub->get18() == 2) { + TTaction *action = static_cast(word); + _sentenceSub->set18(action->getVal()); + } + } + break; + + case WMODE_2: + if (word->checkTag() && _sentence->_field58 > 0) + _sentence->_field58--; + addNode(14); + break; + + case WMODE_3: + switch (word->_id) { + case 300: + addNode(14); + status = 1; + break; + + case 306: + addNode(23); + addNode(4); + break; + + case 307: + case 308: + addNode(23); + break; + + default: + break; + } + + if (status != 1) { + addToConceptList(word); + addNode(14); + } + break; + + case WMODE_4: + addNode(2); + status = 1; + break; + + case WMODE_5: + if (_sentence->check2C()) { + _sentenceSub->_field1C = 1; + _sentenceSub = _sentenceSub->addSibling(); + delete this; + } else { + addNode(23); + } + break; + + case WMODE_6: + status = fn2(word); + break; + + default: break; } // TODO + + return status; +} + +void TTparser::addToConceptList(TTword *word) { + // TODO } void TTparser::addNode(uint tag) { @@ -525,4 +646,32 @@ void TTparser::addNode(uint tag) { _nodesP = newNode; } +int TTparser::fn2(TTword *word) { + switch (word->_id) { + case 600: + addNode(13); + return 0; + + case 601: + addNode(12); + return 1; + + case 602: + case 607: + return checkReferent(static_cast(word)); + + case 608: + return 1; + + default: + return 0; + } + int checkReferent(TTpronoun *pronoun); +} + +int TTparser::checkReferent(TTpronoun *pronoun) { + // TODO + return 0; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index 96c54fb113..07af2dd59c 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -24,6 +24,7 @@ #define TITANIC_TT_PARSER_H #include "titanic/true_talk/tt_node.h" +#include "titanic/true_talk/tt_pronoun.h" #include "titanic/true_talk/tt_sentence.h" #include "titanic/true_talk/tt_string.h" @@ -123,12 +124,16 @@ private: */ const NumberEntry *replaceNumbers2(TTstring &line, int *startIndex); - void loadRequests(TTword *word); + int loadRequests(TTword *word); + void addToConceptList(TTword *word); + int fn2(TTword *word); + int checkReferent(TTpronoun *pronoun); /** * Creates a new parser node, and adds it to the parser's list */ void addNode(uint tag); + public: CScriptHandler *_owner; TTsentenceSub *_sentenceSub; diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index 67e1a977ce..c383bd3fc3 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -42,6 +42,18 @@ void TTsentenceSubBase::deleteSiblings() { /*------------------------------------------------------------------------*/ +TTsentenceSub *TTsentenceSub::addSibling() { + if (this == nullptr || _nextP != nullptr) + // This should never happen + return nullptr; + + TTsentenceSub *nextP = new TTsentenceSub(); + _nextP = nextP; + return nextP; +} + +/*------------------------------------------------------------------------*/ + TTsentence::TTsentence(int inputCtr, const TTstring &line, CScriptHandler *owner, TTroomScript *roomScript, TTnpcScript *npcScript) : _owner(owner), _field2C(1), _inputCtr(inputCtr), _field34(0), diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index 998aad2500..902ad102ce 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -52,10 +52,20 @@ public: * Delete any sibling chain attached to this node */ void deleteSiblings(); + + void set18(int val) { _field18 = val; } + int get18() const { return _field18; } + bool is24() const { return _field24 == 0; } }; class TTsentenceSub : public TTsentenceSubBase { public: + TTsentenceSub() : TTsentenceSubBase() {} + + /** + * Adds a new sibling instance + */ + TTsentenceSub *addSibling(); }; class TTsentence { @@ -68,7 +78,6 @@ private: TTsentenceNode *_nodesP; TTroomScript *_roomScript; TTnpcScript *_npcScript; - int _field58; int _field5C; int _status; private: @@ -80,6 +89,7 @@ public: TTsentenceSub _sub; TTstring _initialLine; TTstring _normalizedLine; + int _field58; public: TTsentence(int inputCtr, const TTstring &line, CScriptHandler *owner, TTroomScript *roomScript, TTnpcScript *npcScript); @@ -88,6 +98,7 @@ public: void set34(int v) { _field34 = v; } void set38(int v) { _field38 = v; } + bool check2C() const { return _field2C > 1 && _field2C <= 10; } int getStatus() const { return _status; } diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp index 66497a5ada..1ae7e1cdf1 100644 --- a/engines/titanic/true_talk/tt_vocab.cpp +++ b/engines/titanic/true_talk/tt_vocab.cpp @@ -433,7 +433,7 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const { TTstring isStr("is"); word = getPrimeWord(isStr); } else { - switch (word->_field1C) { + switch (word->_id) { case 200: if (word->proc10() == 2) { delete word; diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index dc686b88b6..a0cb5dfd94 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -26,8 +26,8 @@ namespace Titanic { -TTword::TTword(TTstring &str, WordMode mode, int val2) : _string(str), - _wordMode(mode), _field1C(val2), _tag(0), _field24(0), +TTword::TTword(TTstring &str, WordMode mode, int id) : _string(str), + _wordMode(mode), _id(id), _tag(0), _field24(0), _field28(0), _synP(nullptr), _nextP(nullptr) { _status = str.getStatus() == SS_VALID ? SS_VALID : SS_5; } @@ -40,7 +40,7 @@ TTword::TTword(TTword *src) { _string = src->_string; _wordMode = src->_wordMode; - _field1C = src->_field1C; + _id = src->_id; _tag = src->_tag; _synP = nullptr; @@ -135,11 +135,11 @@ void TTword::appendNode(TTsynonym *node) { int TTword::load(SimpleFile *file, WordMode mode) { CString str1, str2; - int val; + int id; - if (file->scanf("%d %s %s", &val, &str1, &str2)) { + if (file->scanf("%d %s %s", &id, &str1, &str2)) { _string = str1; - _field1C = val; + _id = id; _tag = readNumber(str2.c_str()); _wordMode = mode; return 0; diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index 333bfb5bfe..010aa66196 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -53,7 +53,7 @@ public: TTsynonym *_synP; TTstring _string; WordMode _wordMode; - int _field1C; + int _id; uint _tag; public: TTword(TTstring &str, WordMode mode, int val2); -- cgit v1.2.3 From dacfbe6a0e08325d4ddb46937c30a2905d2b79de Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 21 May 2016 09:02:04 -0400 Subject: TITANIC: Beginnings of TTconcept class --- engines/titanic/module.mk | 1 + engines/titanic/true_talk/tt_concept.cpp | 79 ++++++++++++++++++++++++++++++ engines/titanic/true_talk/tt_concept.h | 74 ++++++++++++++++++++++++++++ engines/titanic/true_talk/tt_script_base.h | 3 +- 4 files changed, 156 insertions(+), 1 deletion(-) create mode 100644 engines/titanic/true_talk/tt_concept.cpp create mode 100644 engines/titanic/true_talk/tt_concept.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 1568eb5a8c..b3d1444317 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -462,6 +462,7 @@ MODULE_OBJS := \ true_talk/true_talk_manager.o \ true_talk/tt_action.o \ true_talk/tt_adj.o \ + true_talk/tt_concept.o \ true_talk/tt_hist.o \ true_talk/tt_major_word.o \ true_talk/tt_node.o \ diff --git a/engines/titanic/true_talk/tt_concept.cpp b/engines/titanic/true_talk/tt_concept.cpp new file mode 100644 index 0000000000..af0a148ce4 --- /dev/null +++ b/engines/titanic/true_talk/tt_concept.cpp @@ -0,0 +1,79 @@ +/* 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 "titanic/true_talk/tt_concept.h" +#include "titanic/true_talk/tt_script_base.h" +#include "titanic/true_talk/tt_word.h" + +namespace Titanic { + +TTconcept::TTconcept() { +} + +TTconcept::TTconcept(TTscriptBase *script, ScriptType scriptType) : + _string1(" "), _string2(" "), _wordP(nullptr), _scriptP(nullptr) { + if (!script->getStatus()) { + setScriptType(scriptType); + _scriptP = script; + + if (scriptType == ST_UNKNOWN_SCRIPT && script->_field8 == 1) + _scriptType = ST_ROOM_SCRIPT; + } + + if (_status) + reset(); +} + +bool TTconcept::setStatus() { + if (_string1.isValid() && _string2.isValid()) { + _status = SS_VALID; + return true; + } else { + _status = SS_11; + return false; + } +} + +void TTconcept::setScriptType(ScriptType scriptType) { + _field0 = 0; + _field14 = 0; + _scriptType = scriptType; + _field1C = -1; + _field20 = 0; + _field2C = 0; + _field30 = 0; + _field34 = 0; + _field38 = 0; + _status = 0; +} + +void TTconcept::reset() { + delete _wordP; + _wordP = nullptr; + _scriptP = nullptr; + + int oldStatus = _status; + setScriptType(ST_UNKNOWN_SCRIPT); + _status = oldStatus; +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h new file mode 100644 index 0000000000..08b748e8c7 --- /dev/null +++ b/engines/titanic/true_talk/tt_concept.h @@ -0,0 +1,74 @@ +/* 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. + * + */ + +#ifndef TITANIC_TT_CONCEPT_H +#define TITANIC_TT_CONCEPT_H + +#include "titanic/true_talk/tt_string.h" + +namespace Titanic { + +enum ScriptType { ST_UNKNOWN_SCRIPT = 0, ST_ROOM_SCRIPT = 1, ST_NPC_SCRIPT = 2 }; + +class TTscriptBase; +class TTword; + +class TTconcept { +private: + int _field0; + TTscriptBase *_scriptP; + TTword *_wordP; + TTstring _string1; + int _field14; + ScriptType _scriptType; + int _field1C; + int _field20; + TTstring _string2; + int _field2C; + int _field30; + int _field34; + int _field38; + int _status; +private: + /** + * Sets the status of the concept + */ + bool setStatus(); + + /** + * Sets the script type and resets other fields + */ + void setScriptType(ScriptType scriptType); + + /** + * Resets the concept + */ + void reset(); +public: + TTconcept(); + TTconcept(TTscriptBase *script, ScriptType scriptType); + +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_CONCEPT_H */ diff --git a/engines/titanic/true_talk/tt_script_base.h b/engines/titanic/true_talk/tt_script_base.h index ce83cd13c4..2b748db93b 100644 --- a/engines/titanic/true_talk/tt_script_base.h +++ b/engines/titanic/true_talk/tt_script_base.h @@ -40,7 +40,6 @@ private: void reset(); protected: TTnode *_nodesP; - int _field8; TThist *_hist; TTstring _charName, _charClass; int _field20; @@ -55,6 +54,8 @@ protected: int _field44; int _field48; int _status; +public: + int _field8; public: TTscriptBase(int v1, const char *charClass, int v2, const char *charName, int v3, int v4, int v5, int v6, int v7); -- cgit v1.2.3 From 886b71048470986102ce2edf7baffc637134ac49 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 21 May 2016 16:23:52 -0400 Subject: TITANIC: Implemented TTparser checkReferent --- engines/titanic/true_talk/script_handler.h | 2 +- engines/titanic/true_talk/tt_concept.cpp | 23 +++++++++++++++++++- engines/titanic/true_talk/tt_concept.h | 10 +++++++-- engines/titanic/true_talk/tt_parser.cpp | 35 ++++++++++++++++++++++++++++-- engines/titanic/true_talk/tt_parser.h | 6 +++++ engines/titanic/true_talk/tt_pronoun.h | 2 ++ engines/titanic/true_talk/tt_sentence.h | 4 ++-- 7 files changed, 74 insertions(+), 8 deletions(-) diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index 891a40f527..cf5eac1642 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -50,7 +50,6 @@ public: class CScriptHandler { private: CTitleEngine *_owner; - TTscriptBase *_script; CExeResources &_resources; int _field10; CScriptHandlerSub1 _sub1; @@ -63,6 +62,7 @@ private: int _field30; public: TTvocab *_vocab; + TTscriptBase *_script; public: CScriptHandler(CTitleEngine *owner, int val1, int val2); ~CScriptHandler(); diff --git a/engines/titanic/true_talk/tt_concept.cpp b/engines/titanic/true_talk/tt_concept.cpp index af0a148ce4..bc2da4c936 100644 --- a/engines/titanic/true_talk/tt_concept.cpp +++ b/engines/titanic/true_talk/tt_concept.cpp @@ -43,6 +43,21 @@ TTconcept::TTconcept(TTscriptBase *script, ScriptType scriptType) : reset(); } +TTconcept::TTconcept(TTword *word, ScriptType scriptType) : + _string1(" "), _string2(" "), _wordP(nullptr), _scriptP(nullptr) { + + if (!word || !setStatus() || word->getStatus()) { + _status = SS_5; + } else { + _status = initializeWordRef(word); + if (!_status) + setScriptType(scriptType); + } + + if (_status) + reset(); +} + bool TTconcept::setStatus() { if (_string1.isValid() && _string2.isValid()) { _status = SS_VALID; @@ -54,7 +69,7 @@ bool TTconcept::setStatus() { } void TTconcept::setScriptType(ScriptType scriptType) { - _field0 = 0; + _nextP = nullptr; _field14 = 0; _scriptType = scriptType; _field1C = -1; @@ -66,6 +81,12 @@ void TTconcept::setScriptType(ScriptType scriptType) { _status = 0; } +int TTconcept::initializeWordRef(TTword *word) { + delete _wordP; + _wordP = word; + return 0; +} + void TTconcept::reset() { delete _wordP; _wordP = nullptr; diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index 08b748e8c7..787013e6c3 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -34,7 +34,6 @@ class TTword; class TTconcept { private: - int _field0; TTscriptBase *_scriptP; TTword *_wordP; TTstring _string1; @@ -59,14 +58,21 @@ private: */ void setScriptType(ScriptType scriptType); + /** + * Sets up the concept for a word reference + */ + int initializeWordRef(TTword *word); + /** * Resets the concept */ void reset(); +public: + TTconcept *_nextP; public: TTconcept(); TTconcept(TTscriptBase *script, ScriptType scriptType); - + TTconcept(TTword *word, ScriptType scriptType); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index b81d3cc3bc..9bc129b807 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -23,6 +23,7 @@ #include "titanic/true_talk/tt_parser.h" #include "titanic/true_talk/script_handler.h" #include "titanic/true_talk/tt_action.h" +#include "titanic/true_talk/tt_concept.h" #include "titanic/true_talk/tt_sentence.h" #include "titanic/true_talk/tt_word.h" #include "titanic/titanic.h" @@ -31,7 +32,7 @@ namespace Titanic { TTparser::TTparser(CScriptHandler *owner) : _owner(owner), _sentenceSub(nullptr), _sentence(nullptr), _fieldC(0), _field10(0), _field14(0), _field18(0), - _nodesP(nullptr) { + _nodesP(nullptr), _conceptP(nullptr) { loadArrays(); } @@ -646,6 +647,17 @@ void TTparser::addNode(uint tag) { _nodesP = newNode; } +int TTparser::addConcept(TTconcept *concept) { + if (!concept) + return SS_5; + + if (_conceptP) + concept->_nextP = _conceptP; + _conceptP = concept; + + return SS_VALID; +} + int TTparser::fn2(TTword *word) { switch (word->_id) { case 600: @@ -670,7 +682,26 @@ int TTparser::fn2(TTword *word) { } int TTparser::checkReferent(TTpronoun *pronoun) { - // TODO + TTconcept *concept; + + switch (pronoun->getVal()) { + case 0: + return 0; + + case 1: + concept = new TTconcept(_owner->_script, ST_ROOM_SCRIPT); + break; + + case 2: + concept = new TTconcept(_sentence->_npcScript, ST_NPC_SCRIPT); + break; + + default: + concept = new TTconcept(pronoun, (ScriptType)pronoun->getVal()); + break; + } + + addConcept(concept); return 0; } diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index 07af2dd59c..7ad87cc138 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -33,6 +33,7 @@ namespace Titanic { enum NumberFlag { NF_1 = 1, NF_2 = 2, NF_4 = 4, NF_8 = 8, NF_10 = 0x10 }; class CScriptHandler; +class TTconcept; struct NumberEntry { CString _text; @@ -61,6 +62,7 @@ private: StringArray _phrases; NumberArray _numbers; TTparserNode *_nodesP; + TTconcept *_conceptP; private: /** * Loads the various replacement string data arrays @@ -134,6 +136,10 @@ private: */ void addNode(uint tag); + /** + * Add a concept node + */ + int addConcept(TTconcept *concept); public: CScriptHandler *_owner; TTsentenceSub *_sentenceSub; diff --git a/engines/titanic/true_talk/tt_pronoun.h b/engines/titanic/true_talk/tt_pronoun.h index 5aa3e1e8fe..bd80852a8f 100644 --- a/engines/titanic/true_talk/tt_pronoun.h +++ b/engines/titanic/true_talk/tt_pronoun.h @@ -41,6 +41,8 @@ public: */ int load(SimpleFile *file); + int getVal() const { return _field30; } + /** * Creates a copy of the word */ diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index 902ad102ce..a75742181b 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -76,8 +76,6 @@ private: int _field34; int _field38; TTsentenceNode *_nodesP; - TTroomScript *_roomScript; - TTnpcScript *_npcScript; int _field5C; int _status; private: @@ -90,6 +88,8 @@ public: TTstring _initialLine; TTstring _normalizedLine; int _field58; + TTroomScript *_roomScript; + TTnpcScript *_npcScript; public: TTsentence(int inputCtr, const TTstring &line, CScriptHandler *owner, TTroomScript *roomScript, TTnpcScript *npcScript); -- cgit v1.2.3 From 8668b37ef583962d9684adb9913289a0b6e71a97 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 21 May 2016 16:47:42 -0400 Subject: TITANIC: Finished TTparser loadRequests --- engines/titanic/true_talk/tt_parser.cpp | 85 ++++++++++++++++++++++++++++++++- engines/titanic/true_talk/tt_sentence.h | 2 +- 2 files changed, 84 insertions(+), 3 deletions(-) diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 9bc129b807..52be9578f9 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -628,10 +628,92 @@ int TTparser::loadRequests(TTword *word) { status = fn2(word); break; + case WMODE_7: + switch (word->_id) { + case 700: + addNode(6); + addNode(5); + break; + case 701: + addNode(11); + break; + case 702: + status = 1; + break; + case 703: + addNode(9); + break; + case 704: + addNode(10); + break; + default: + break; + } + + case WMODE_8: + if (word->_id == 304) { + // Nothing + } else if (word->_id == 801) { + addNode(22); + } else { + if (word->proc16()) + _sentence->_field58++; + if (word->proc17()) + _sentence->_field58++; + } + break; + + case WMODE_9: + switch (word->_id) { + case 900: + case 901: + case 902: + case 904: + if (_sentence->_field2C == 9) { + _sentenceSub->_field1C = 1; + _sentenceSub = _sentenceSub->addSibling(); + addNode(1); + } + else { + addNode(23); + addNode(13); + addNode(1); + } + break; + + case 905: + case 907: + case 908: + case 909: + addNode(23); + break; + + case 906: + addNode(23); + status = 1; + break; + + case 910: + addNode(4); + addNode(24); + addNode(23); + addNode(14); + status = 1; + break; + + default: + break; + } + + if (word->_id == 906) { + addNode(14); + status = 1; + } + break; + default: break; } - // TODO return status; } @@ -678,7 +760,6 @@ int TTparser::fn2(TTword *word) { default: return 0; } - int checkReferent(TTpronoun *pronoun); } int TTparser::checkReferent(TTpronoun *pronoun) { diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index a75742181b..fb060c1a45 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -71,7 +71,6 @@ public: class TTsentence { private: CScriptHandler *_owner; - int _field2C; int _inputCtr; int _field34; int _field38; @@ -90,6 +89,7 @@ public: int _field58; TTroomScript *_roomScript; TTnpcScript *_npcScript; + int _field2C; public: TTsentence(int inputCtr, const TTstring &line, CScriptHandler *owner, TTroomScript *roomScript, TTnpcScript *npcScript); -- cgit v1.2.3 From 87201eed1fcbd399934751a08143f259708796dc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 21 May 2016 17:33:26 -0400 Subject: TITANIC: Added TTparser addToConceptList --- engines/titanic/true_talk/tt_parser.cpp | 8 +++++++- engines/titanic/true_talk/tt_parser.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 52be9578f9..2ee080d984 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -718,8 +718,14 @@ int TTparser::loadRequests(TTword *word) { return status; } -void TTparser::addToConceptList(TTword *word) { +int TTparser::considerRequests(TTword *word) { // TODO + return 0; +} + +void TTparser::addToConceptList(TTword *word) { + TTconcept *concept = new TTconcept(word, ST_UNKNOWN_SCRIPT); + addConcept(concept); } void TTparser::addNode(uint tag) { diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index 7ad87cc138..461bcc285d 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -127,6 +127,8 @@ private: const NumberEntry *replaceNumbers2(TTstring &line, int *startIndex); int loadRequests(TTword *word); + int considerRequests(TTword *word); + void addToConceptList(TTword *word); int fn2(TTword *word); int checkReferent(TTpronoun *pronoun); -- cgit v1.2.3 From 39a12288bb8343c25f244162a32e744a4fed9f6e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 21 May 2016 21:01:37 -0400 Subject: TITANIC: Start of considerRequests --- engines/titanic/true_talk/tt_parser.cpp | 75 ++++++++++++++++++++++++++++++- engines/titanic/true_talk/tt_parser.h | 4 ++ engines/titanic/true_talk/tt_sentence.cpp | 6 +-- engines/titanic/true_talk/tt_sentence.h | 3 +- 4 files changed, 83 insertions(+), 5 deletions(-) diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 2ee080d984..9316a907a6 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -719,8 +719,81 @@ int TTparser::loadRequests(TTword *word) { } int TTparser::considerRequests(TTword *word) { + if (_nodesP) + return 0; + + TTparserNode *nodeP = _nodesP; + TTconcept *concept = nullptr; + int status = 0; + bool flag = false; + + while (word) { + int ecx = 906; + int edx = 12; + + if (nodeP->_tag == MKTAG('C', 'O', 'M', 'E')) { + addNode(7); + addNode(5); + addNode(21); + + if (!_sentence->_field2C) + _sentence->_field2C = 15; + } else if (nodeP->_tag == MKTAG('C', 'U', 'R', 'S') || + nodeP->_tag == MKTAG('S', 'E', 'X', 'X')) { + if (_sentence->_field58 > 1) + _sentence->_field58--; + flag = true; + + } else if (nodeP->_tag == MKTAG('E', 'X', 'I', 'T')) { + addNode(8); + addNode(5); + addNode(21); + + if (!_sentence->_field2C) + _sentence->_field2C = 14; + + + } else if (nodeP->_tag < MKTAG('C', 'O', 'M', 'E')) { + if (_sentence->_field58 > 1) + _sentence->_field58--; + flag = true; + } else { + switch (nodeP->_tag) { + case CHECK_COMMAND_FORM: + if (_sentenceSub->_field4 && _sentence->_field2C == 1 && + !_sentenceSub->_conceptP) { + concept = new TTconcept(_sentence->_npcScript, ST_NPC_SCRIPT); + _sentenceSub->_conceptP = concept; + _sentenceSub->_field18 = 3; + } + + flag = true; + break; + + case 2: + if (!word->_wordMode) { + word->_wordMode = WMODE_2; + addToConceptList(word); + addNode(14); + } + + flag = true; + break; + + case 3: + // TODO + //flag = _sentenceSub + break; + + default: + break; + } + } + } + // TODO - return 0; + delete concept; + return status; } void TTparser::addToConceptList(TTword *word) { diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index 461bcc285d..6b490f8228 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -32,6 +32,10 @@ namespace Titanic { enum NumberFlag { NF_1 = 1, NF_2 = 2, NF_4 = 4, NF_8 = 8, NF_10 = 0x10 }; +enum ParserTag { + CHECK_COMMAND_FORM = 1 +}; + class CScriptHandler; class TTconcept; diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index c383bd3fc3..40e3bb09e2 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -25,9 +25,9 @@ namespace Titanic { -TTsentenceSubBase::TTsentenceSubBase() : _field0(0), _field4(0), _field8(0), - _fieldC(0), _field10(0), _field14(0), _field18(0), _field1C(0), - _nextP(nullptr), _field24(0) { +TTsentenceSubBase::TTsentenceSubBase() : _conceptP(nullptr), _field4(0), + _field8(0), _fieldC(0), _field10(0), _field14(0), _field18(0), + _field1C(0), _nextP(nullptr), _field24(0) { } void TTsentenceSubBase::deleteSiblings() { diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index fb060c1a45..e6d0d0c2b3 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -31,11 +31,12 @@ namespace Titanic { class CScriptHandler; +class TTconcept; class TTword; class TTsentenceSubBase { public: - int _field0; + TTconcept *_conceptP; int _field4; int _field8; int _fieldC; -- cgit v1.2.3 From 59796e03e4d2d366a3a6f4d00738fe9795b4fce3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 21 May 2016 21:33:35 -0400 Subject: TITANIC: Change WordMode to WordClass and flesh it out --- engines/titanic/true_talk/tt_action.cpp | 6 +- engines/titanic/true_talk/tt_action.h | 2 +- engines/titanic/true_talk/tt_adj.cpp | 6 +- engines/titanic/true_talk/tt_adj.h | 2 +- engines/titanic/true_talk/tt_major_word.cpp | 4 +- engines/titanic/true_talk/tt_major_word.h | 2 +- engines/titanic/true_talk/tt_parser.cpp | 26 ++++----- engines/titanic/true_talk/tt_picture.cpp | 6 +- engines/titanic/true_talk/tt_picture.h | 2 +- engines/titanic/true_talk/tt_pronoun.cpp | 6 +- engines/titanic/true_talk/tt_pronoun.h | 2 +- engines/titanic/true_talk/tt_vocab.cpp | 88 ++++++++++++++--------------- engines/titanic/true_talk/tt_word.cpp | 10 ++-- engines/titanic/true_talk/tt_word.h | 22 +++++--- 14 files changed, 96 insertions(+), 88 deletions(-) diff --git a/engines/titanic/true_talk/tt_action.cpp b/engines/titanic/true_talk/tt_action.cpp index e0c7284b7a..bb30e9c996 100644 --- a/engines/titanic/true_talk/tt_action.cpp +++ b/engines/titanic/true_talk/tt_action.cpp @@ -26,8 +26,8 @@ namespace Titanic { bool TTaction::_staticFlag; -TTaction::TTaction(TTstring &str, WordMode mode, int val2, int val3, int val4) : - TTmajorWord(str, mode, val2, val3), _field30(val4) { +TTaction::TTaction(TTstring &str, WordClass wordClass, int val2, int val3, int val4) : + TTmajorWord(str, wordClass, val2, val3), _field30(val4) { } TTaction::TTaction(TTaction *src) : TTmajorWord(src) { @@ -42,7 +42,7 @@ TTaction::TTaction(TTaction *src) : TTmajorWord(src) { int TTaction::load(SimpleFile *file) { int val; - if (!TTword::load(file, WMODE_ACTION) && file->scanf("%d", &val)) { + if (!TTword::load(file, WC_ACTION) && file->scanf("%d", &val)) { _field30 = val; return 0; } else { diff --git a/engines/titanic/true_talk/tt_action.h b/engines/titanic/true_talk/tt_action.h index 213bdab8e4..0bd104977d 100644 --- a/engines/titanic/true_talk/tt_action.h +++ b/engines/titanic/true_talk/tt_action.h @@ -33,7 +33,7 @@ private: protected: int _field30; public: - TTaction(TTstring &str, WordMode mode, int val2, int val3, int val4); + TTaction(TTstring &str, WordClass wordClass, int val2, int val3, int val4); TTaction(TTaction *src); /** diff --git a/engines/titanic/true_talk/tt_adj.cpp b/engines/titanic/true_talk/tt_adj.cpp index 850692f69c..5659ed2276 100644 --- a/engines/titanic/true_talk/tt_adj.cpp +++ b/engines/titanic/true_talk/tt_adj.cpp @@ -26,8 +26,8 @@ namespace Titanic { bool TTadj::_staticFlag; -TTadj::TTadj(TTstring &str, WordMode mode, int val2, int val3, int val4) : - TTmajorWord(str, mode, val2, val3) { +TTadj::TTadj(TTstring &str, WordClass wordClass, int val2, int val3, int val4) : + TTmajorWord(str, wordClass, val2, val3) { if (val4 >= 0 && val4 <= 9) { _field30 = val4; } else { @@ -48,7 +48,7 @@ TTadj::TTadj(TTadj *src) : TTmajorWord(src) { int TTadj::load(SimpleFile *file) { int val; - if (!TTword::load(file, WMODE_8) && file->scanf("%d", &val)) { + if (!TTword::load(file, WC_ADJECTIVE) && file->scanf("%d", &val)) { _field30 = val; return 0; } else { diff --git a/engines/titanic/true_talk/tt_adj.h b/engines/titanic/true_talk/tt_adj.h index f18d249a99..7dab02d3d1 100644 --- a/engines/titanic/true_talk/tt_adj.h +++ b/engines/titanic/true_talk/tt_adj.h @@ -33,7 +33,7 @@ private: protected: int _field30; public: - TTadj(TTstring &str, WordMode mode, int val2, int val3, int val4); + TTadj(TTstring &str, WordClass wordClass, int val2, int val3, int val4); TTadj(TTadj *src); /** diff --git a/engines/titanic/true_talk/tt_major_word.cpp b/engines/titanic/true_talk/tt_major_word.cpp index b81ada4de1..28b9434026 100644 --- a/engines/titanic/true_talk/tt_major_word.cpp +++ b/engines/titanic/true_talk/tt_major_word.cpp @@ -26,8 +26,8 @@ namespace Titanic { bool TTmajorWord::_staticFlag; -TTmajorWord::TTmajorWord(TTstring &str, WordMode mode, int val2, int val3) : - TTword(str, mode, val2), _field2C(val3) { +TTmajorWord::TTmajorWord(TTstring &str, WordClass wordClass, int val2, int val3) : + TTword(str, wordClass, val2), _field2C(val3) { } TTmajorWord::TTmajorWord(TTmajorWord *src) : TTword(src) { diff --git a/engines/titanic/true_talk/tt_major_word.h b/engines/titanic/true_talk/tt_major_word.h index 55eb882c8e..716ccf152f 100644 --- a/engines/titanic/true_talk/tt_major_word.h +++ b/engines/titanic/true_talk/tt_major_word.h @@ -38,7 +38,7 @@ protected: */ int saveData(SimpleFile *file, int val) const; public: - TTmajorWord(TTstring &str, WordMode mode, int val2, int val3); + TTmajorWord(TTstring &str, WordClass wordClass, int val2, int val3); TTmajorWord(TTmajorWord *src); /** diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 9316a907a6..1a2944d890 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -512,11 +512,11 @@ int TTparser::loadRequests(TTword *word) { if (word->_tag != MKTAG('Z', 'Z', 'Z', 'T')) addNode(word->_tag); - switch (word->_wordMode) { - case WMODE_NONE: + switch (word->_wordClass) { + case WC_UNKNOWN: break; - case WMODE_ACTION: + case WC_ACTION: if (word->_id != 0x70 && word->_id != 0x71) addNode(1); addNode(17); @@ -576,13 +576,13 @@ int TTparser::loadRequests(TTword *word) { } break; - case WMODE_2: + case WC_THING: if (word->checkTag() && _sentence->_field58 > 0) _sentence->_field58--; addNode(14); break; - case WMODE_3: + case WC_ABSTRACT: switch (word->_id) { case 300: addNode(14); @@ -609,12 +609,12 @@ int TTparser::loadRequests(TTword *word) { } break; - case WMODE_4: + case WC_ARTICLE: addNode(2); status = 1; break; - case WMODE_5: + case WC_CONJUNCTION: if (_sentence->check2C()) { _sentenceSub->_field1C = 1; _sentenceSub = _sentenceSub->addSibling(); @@ -624,11 +624,11 @@ int TTparser::loadRequests(TTword *word) { } break; - case WMODE_6: + case WC_PRONOUN: status = fn2(word); break; - case WMODE_7: + case WC_PREPOSITION: switch (word->_id) { case 700: addNode(6); @@ -650,7 +650,7 @@ int TTparser::loadRequests(TTword *word) { break; } - case WMODE_8: + case WC_ADJECTIVE: if (word->_id == 304) { // Nothing } else if (word->_id == 801) { @@ -663,7 +663,7 @@ int TTparser::loadRequests(TTword *word) { } break; - case WMODE_9: + case WC_ADVERB: switch (word->_id) { case 900: case 901: @@ -771,8 +771,8 @@ int TTparser::considerRequests(TTword *word) { break; case 2: - if (!word->_wordMode) { - word->_wordMode = WMODE_2; + if (!word->_wordClass) { + word->_wordClass = WC_THING; addToConceptList(word); addNode(14); } diff --git a/engines/titanic/true_talk/tt_picture.cpp b/engines/titanic/true_talk/tt_picture.cpp index aab9c5d7aa..59ff6c746b 100644 --- a/engines/titanic/true_talk/tt_picture.cpp +++ b/engines/titanic/true_talk/tt_picture.cpp @@ -26,8 +26,8 @@ namespace Titanic { bool TTpicture::_staticFlag; -TTpicture::TTpicture(TTstring &str, WordMode mode, int val2, int val3, int val4, int val5, int val6) : - TTmajorWord(str, mode, val2, val4), _tag(val3), _field30(val5), _field3C(val6), +TTpicture::TTpicture(TTstring &str, WordClass wordClass, int val2, int val3, int val4, int val5, int val6) : + TTmajorWord(str, wordClass, val2, val4), _tag(val3), _field30(val5), _field3C(val6), _field38(0) { } @@ -50,7 +50,7 @@ int TTpicture::load(SimpleFile *file) { CString str; int val1, val2; - if (!TTword::load(file, WMODE_2) && file->scanf("%s %d %d", &str, &val1, &val2)) { + if (!TTword::load(file, WC_THING) && file->scanf("%s %d %d", &str, &val1, &val2)) { _tag = readNumber(str.c_str()); _field30 = val1; _field3C = val2; diff --git a/engines/titanic/true_talk/tt_picture.h b/engines/titanic/true_talk/tt_picture.h index 404d9c4b03..71beefe19c 100644 --- a/engines/titanic/true_talk/tt_picture.h +++ b/engines/titanic/true_talk/tt_picture.h @@ -36,7 +36,7 @@ protected: int _field38; int _field3C; public: - TTpicture(TTstring &str, WordMode mode, int val2, int val3, int val4, int val5, int val6); + TTpicture(TTstring &str, WordClass wordClass, int val2, int val3, int val4, int val5, int val6); TTpicture(TTpicture *src); /** diff --git a/engines/titanic/true_talk/tt_pronoun.cpp b/engines/titanic/true_talk/tt_pronoun.cpp index 68fcef02a3..9b6692e60e 100644 --- a/engines/titanic/true_talk/tt_pronoun.cpp +++ b/engines/titanic/true_talk/tt_pronoun.cpp @@ -26,8 +26,8 @@ namespace Titanic { bool TTpronoun::_staticFlag; -TTpronoun::TTpronoun(TTstring &str, WordMode mode, int val2, int val3, int val4) : - TTmajorWord(str, mode, val2, val3), _field30(val4) { +TTpronoun::TTpronoun(TTstring &str, WordClass wordClass, int val2, int val3, int val4) : + TTmajorWord(str, wordClass, val2, val3), _field30(val4) { } TTpronoun::TTpronoun(TTpronoun *src) : TTmajorWord(src) { @@ -42,7 +42,7 @@ TTpronoun::TTpronoun(TTpronoun *src) : TTmajorWord(src) { int TTpronoun::load(SimpleFile *file) { int val; - if (!TTword::load(file, WMODE_6) && file->scanf("%d", &val)) { + if (!TTword::load(file, WC_PRONOUN) && file->scanf("%d", &val)) { if (val >= 0 && val <= 12) { _field30 = val; return 0; diff --git a/engines/titanic/true_talk/tt_pronoun.h b/engines/titanic/true_talk/tt_pronoun.h index bd80852a8f..0d9466c29c 100644 --- a/engines/titanic/true_talk/tt_pronoun.h +++ b/engines/titanic/true_talk/tt_pronoun.h @@ -33,7 +33,7 @@ private: protected: int _field30; public: - TTpronoun(TTstring &str, WordMode mode, int val2, int val3, int val4); + TTpronoun(TTstring &str, WordClass wordClass, int val2, int val3, int val4); TTpronoun(TTpronoun *src); /** diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp index 1ae7e1cdf1..eb3d52331f 100644 --- a/engines/titanic/true_talk/tt_vocab.cpp +++ b/engines/titanic/true_talk/tt_vocab.cpp @@ -52,57 +52,57 @@ int TTvocab::load(const CString &name) { while (!result && !file->eos()) { skipFlag = false; - WordMode mode = (WordMode)file->readNumber(); + WordClass wordClass = (WordClass)file->readNumber(); TTstring space(" "); - switch (mode) { - case 0: { + switch (wordClass) { + case WC_UNKNOWN: { if (_word) result = _word->readSyn(file); skipFlag = true; break; } - case 1: { - TTaction *word = new TTaction(space, WMODE_NONE, 0, 0, 0); + case WC_ACTION: { + TTaction *word = new TTaction(space, WC_UNKNOWN, 0, 0, 0); result = word->load(file); _word = word; break; } - case 2: { - TTpicture *word = new TTpicture(space, WMODE_NONE, 0, 0, 0, 0, 0); + case WC_THING: { + TTpicture *word = new TTpicture(space, WC_UNKNOWN, 0, 0, 0, 0, 0); result = word->load(file); _word = word; break; } - case 3: - case 9: { - TTmajorWord *word = new TTmajorWord(space, WMODE_NONE, 0, 0); - result = word->load(file, mode); + case WC_ABSTRACT: + case WC_ADVERB: { + TTmajorWord *word = new TTmajorWord(space, WC_UNKNOWN, 0, 0); + result = word->load(file, wordClass); _word = word; break; } - case 4: - case 5: - case 7: { - TTword *word = new TTword(space, WMODE_NONE, 0); - result = word->load(file, mode); + case WC_ARTICLE: + case WC_CONJUNCTION: + case WC_PREPOSITION: { + TTword *word = new TTword(space, WC_UNKNOWN, 0); + result = word->load(file, wordClass); _word = word; break; } - case 8: { - TTadj *word = new TTadj(space, WMODE_NONE, 0, 0, 0); + case WC_ADJECTIVE: { + TTadj *word = new TTadj(space, WC_UNKNOWN, 0, 0, 0); result = word->load(file); _word = word; break; } - case 6: { - TTpronoun *word = new TTpronoun(space, WMODE_NONE, 0, 0, 0); + case WC_PRONOUN: { + TTpronoun *word = new TTpronoun(space, WC_UNKNOWN, 0, 0, 0); result = word->load(file); _word = word; break; @@ -198,7 +198,7 @@ TTword *TTvocab::getPrimeWord(TTstring &str, TTword **srcWord) const { if (!Common::isDigit(c)) { vocabP = _headP; - newWord = new TTword(str, WMODE_3, 300); + newWord = new TTword(str, WC_ABSTRACT, 300); } else { for (vocabP = _headP; vocabP && !newWord; vocabP = vocabP->_nextP) { if (_vocabMode == 3 && !strcmp(str.c_str(), vocabP->c_str())) { @@ -246,30 +246,30 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const { word = getPrimeWord(tempStr); if (word) { - if (word->_wordMode == 1) { + if (word->_wordClass == 1) { delete word; word = nullptr; } else { delete word; - word = new TTadj(str, WMODE_8, 0, 0, 0); + word = new TTadj(str, WC_ADJECTIVE, 0, 0, 0); } } else { tempStr += "e"; word = getPrimeWord(tempStr); if (word) { - if (word->_wordMode != 1) { + if (word->_wordClass != 1) { delete word; - word = new TTadj(str, WMODE_8, 0, 0, 0); + word = new TTadj(str, WC_ADJECTIVE, 0, 0, 0); } } else { tempStr.deleteSuffix(2); word = getPrimeWord(tempStr); if (word) { - if (word->_wordMode != 1) { + if (word->_wordClass != 1) { delete word; - word = new TTadj(str, WMODE_8, 0, 0, 0); + word = new TTadj(str, WC_ADJECTIVE, 0, 0, 0); } } else { tempStr = str; @@ -287,7 +287,7 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const { } if (word) { - if (word->_wordMode == WMODE_ACTION) { + if (word->_wordClass == WC_ACTION) { static_cast(word)->setVal(1); } } else { @@ -300,7 +300,7 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const { if (word) { delete word; - word = new TTword(str, WMODE_9, 0); + word = new TTword(str, WC_ADVERB, 0); } else { tempStr = str; } @@ -310,7 +310,7 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const { word = getPrimeWord(tempStr); if (word) { - if (word->_wordMode == WMODE_8) { + if (word->_wordClass == WC_ADJECTIVE) { int val1 = word->proc15(); int val2 = word->proc15(); @@ -329,7 +329,7 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const { word = getPrimeWord(tempStr); if (word) { - if (word->_wordMode == WMODE_8) { + if (word->_wordClass == WC_ADJECTIVE) { int val1 = word->proc15(); int val2 = word->proc15(); @@ -347,7 +347,7 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const { tempStr.deleteSuffix(1); word = getPrimeWord(tempStr); - if (word && word->_wordMode == WMODE_8) { + if (word && word->_wordClass == WC_ADJECTIVE) { int val1 = word->proc15(); int val2 = word->proc15(); @@ -369,7 +369,7 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const { word = getPrimeWord(tempStr); if (word) { - if (word->_wordMode == WMODE_8) { + if (word->_wordClass == WC_ADJECTIVE) { int val1 = word->proc15(); int val2 = word->proc15(); @@ -388,7 +388,7 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const { word = getPrimeWord(tempStr); if (word) { - if (word->_wordMode == WMODE_8) { + if (word->_wordClass == WC_ADJECTIVE) { int val1 = word->proc15(); int val2 = word->proc15(); @@ -428,7 +428,7 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const { word = getPrimeWord(tempStr); if (word) { - if (word->_wordMode == WMODE_6 || word->_wordMode == WMODE_9) { + if (word->_wordClass == WC_PRONOUN || word->_wordClass == WC_ADVERB) { delete word; TTstring isStr("is"); word = getPrimeWord(isStr); @@ -437,38 +437,38 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const { case 200: if (word->proc10() == 2) { delete word; - word = new TTpronoun(tempStr, WMODE_6, 601, 0, 5); + word = new TTpronoun(tempStr, WC_PRONOUN, 601, 0, 5); } else if (word->proc10() == 1) { delete word; - word = new TTpronoun(tempStr, WMODE_6, 601, 0, 4); + word = new TTpronoun(tempStr, WC_PRONOUN, 601, 0, 4); } break; case 201: delete word; - word = new TTpronoun(tempStr, WMODE_6, 601, 0, 5); + word = new TTpronoun(tempStr, WC_PRONOUN, 601, 0, 5); break; case 202: case 203: if (word->proc10() == 2) { delete word; - word = new TTpronoun(tempStr, WMODE_6, 601, 0, 5); + word = new TTpronoun(tempStr, WC_PRONOUN, 601, 0, 5); } else { int val = word->proc10() == 1 ? 0 : 4; delete word; - word = new TTpronoun(tempStr, WMODE_6, 601, 0, val); + word = new TTpronoun(tempStr, WC_PRONOUN, 601, 0, val); } break; case 204: delete word; - word = new TTpronoun(tempStr, WMODE_6, 601, 0, 6); + word = new TTpronoun(tempStr, WC_PRONOUN, 601, 0, 6); break; default: delete word; - word = new TTpronoun(tempStr, WMODE_6, 601, 0, 0); + word = new TTpronoun(tempStr, WC_PRONOUN, 601, 0, 0); break; } } @@ -510,7 +510,7 @@ TTword *TTvocab::getPrefixedWord(TTstring &str) const { word = getPrimeWord(tempStr); if (!word) tempStr = str; - else if (word->_wordMode == 8) { + else if (word->_wordClass == 8) { delete word; word = nullptr; } @@ -522,7 +522,7 @@ TTword *TTvocab::getPrefixedWord(TTstring &str) const { if (!word) tempStr = str; - else if (word->_wordMode == 8) { + else if (word->_wordClass == 8) { int val1 = word->proc15(); int val2 = word->proc15(); diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index a0cb5dfd94..028ee81008 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -26,8 +26,8 @@ namespace Titanic { -TTword::TTword(TTstring &str, WordMode mode, int id) : _string(str), - _wordMode(mode), _id(id), _tag(0), _field24(0), +TTword::TTword(TTstring &str, WordClass wordClass, int id) : _string(str), + _wordClass(wordClass), _id(id), _tag(0), _field24(0), _field28(0), _synP(nullptr), _nextP(nullptr) { _status = str.getStatus() == SS_VALID ? SS_VALID : SS_5; } @@ -39,7 +39,7 @@ TTword::TTword(TTword *src) { } _string = src->_string; - _wordMode = src->_wordMode; + _wordClass = src->_wordClass; _id = src->_id; _tag = src->_tag; _synP = nullptr; @@ -133,7 +133,7 @@ void TTword::appendNode(TTsynonym *node) { _synP = node; } -int TTword::load(SimpleFile *file, WordMode mode) { +int TTword::load(SimpleFile *file, WordClass wordClass) { CString str1, str2; int id; @@ -141,7 +141,7 @@ int TTword::load(SimpleFile *file, WordMode mode) { _string = str1; _id = id; _tag = readNumber(str2.c_str()); - _wordMode = mode; + _wordClass = wordClass; return 0; } else { return 3; diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index 010aa66196..fa7f31ef75 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -29,10 +29,18 @@ namespace Titanic { -enum WordMode { - WMODE_NONE = 0, WMODE_ACTION = 1, WMODE_2 = 2, WMODE_3 = 3, - WMODE_4 = 4, WMODE_5 = 5, WMODE_6 = 6, WMODE_7 = 7, - WMODE_8 = 8, WMODE_9 = 9 +enum WordClass { + WC_UNKNOWN = 0, WC_ACTION = 1, WC_THING = 2, WC_ABSTRACT = 3, + WC_ARTICLE = 4, WC_CONJUNCTION = 5, WC_PRONOUN = 6, + WC_PREPOSITION = 7, WC_ADJECTIVE = 8, WC_ADVERB = 9, + WC_UNK_ACTION = 10, + WC_ATRANS = 11, // transfer possession, eg: give/take + WC_PTRANS = 12, // physical transfer, eg: go + WC_PROPEL = 13, // act of applying a force, eg: hit + WC_MTRANS = 14, // mental transfer, eg: see, hear + WC_BUILD = 15, WC_ATTEND = 16, WC_SPEAK = 17, WC_GRASP = 18, + WC_MOVE = 19, WC_INGEST = 20, WC_EXPEL = 21, WC_STRANS = 22, + WC_ISA = 23 }; class TTword { @@ -52,11 +60,11 @@ public: TTword *_nextP; TTsynonym *_synP; TTstring _string; - WordMode _wordMode; + WordClass _wordClass; int _id; uint _tag; public: - TTword(TTstring &str, WordMode mode, int val2); + TTword(TTstring &str, WordClass wordClass, int val2); TTword(TTword *src); ~TTword(); @@ -93,7 +101,7 @@ public: /** * Load the word */ - int load(SimpleFile *file, WordMode mode); + int load(SimpleFile *file, WordClass wordClass); /** * Finds a synonym in the word by name, if one exists -- cgit v1.2.3 From 006c98cfa425a99aff2e7fa9f2ae426fa8992f51 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 21 May 2016 22:03:48 -0400 Subject: TITANIC: Added ParserAction enum --- engines/titanic/true_talk/tt_parser.cpp | 28 ++++++++++++++++++++++++++-- engines/titanic/true_talk/tt_parser.h | 10 ++++++++-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 1a2944d890..9b56aef558 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -770,7 +770,7 @@ int TTparser::considerRequests(TTword *word) { flag = true; break; - case 2: + case EXPECT_THING: if (!word->_wordClass) { word->_wordClass = WC_THING; addToConceptList(word); @@ -780,11 +780,35 @@ int TTparser::considerRequests(TTword *word) { flag = true; break; - case 3: + case OBJECT_IS_TO: // TODO //flag = _sentenceSub break; + case SEEK_ACTOR: + case SEEK_OBJECT: + case SEEK_OBJECT_OVERRIDE: + case SEEK_TO: + case SEEK_FROM: + case SEEK_TO_OVERRIDE: + case SEEK_FROM_OVERRIDE: + case SEEK_LOCATION: + case SEEK_OWNERSHIP: + case SEEK_STATE: + case SEEK_MODIFIERS: + case SEEK_NEW_FRAME: + case SEEK_STATE_OBJECT: + case SET_ACTION: + case SET_COLOR: + case ACTOR_IS_TO: + case ACTOR_IS_FROM: + case ACTOR_IS_OBJECT: + case STATE_IDENTITY: + case WORD_TYPE_IS_SENTENCE_TYPE: + case COMPLEX_VERB: + // TODO + break; + default: break; } diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index 6b490f8228..aba034416c 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -32,8 +32,14 @@ namespace Titanic { enum NumberFlag { NF_1 = 1, NF_2 = 2, NF_4 = 4, NF_8 = 8, NF_10 = 0x10 }; -enum ParserTag { - CHECK_COMMAND_FORM = 1 +enum ParserAction { + NO_ACTION = 0, CHECK_COMMAND_FORM, EXPECT_THING, OBJECT_IS_TO, + SEEK_ACTOR, SEEK_OBJECT, SEEK_OBJECT_OVERRIDE, SEEK_TO, + SEEK_FROM, SEEK_TO_OVERRIDE, SEEK_FROM_OVERRIDE, SEEK_LOCATION, + SEEK_OWNERSHIP, SEEK_STATE, SEEK_MODIFIERS, SEEK_NEW_FRAME, + SEEK_STATE_OBJECT, SET_ACTION, SET_COLOR, ACTOR_IS_TO, + ACTOR_IS_FROM, ACTOR_IS_OBJECT, STATE_IDENTITY, + WORD_TYPE_IS_SENTENCE_TYPE, COMPLEX_VERB }; class CScriptHandler; -- cgit v1.2.3 From 46bb597ba21cb04b85f0b7010817fe329848b817 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 21 May 2016 23:57:32 -0400 Subject: TITANIC: New TTconcept constructor --- engines/titanic/true_talk/tt_concept.cpp | 31 +++++++++++++++++++++++++++++++ engines/titanic/true_talk/tt_concept.h | 17 +++++++++++++++++ engines/titanic/true_talk/tt_parser.cpp | 10 ++++++++-- engines/titanic/true_talk/tt_parser.h | 2 ++ engines/titanic/true_talk/tt_string.cpp | 4 ++++ engines/titanic/true_talk/tt_string.h | 1 + engines/titanic/true_talk/tt_word.cpp | 4 ++++ engines/titanic/true_talk/tt_word.h | 5 +++++ 8 files changed, 72 insertions(+), 2 deletions(-) diff --git a/engines/titanic/true_talk/tt_concept.cpp b/engines/titanic/true_talk/tt_concept.cpp index bc2da4c936..a9794cabe7 100644 --- a/engines/titanic/true_talk/tt_concept.cpp +++ b/engines/titanic/true_talk/tt_concept.cpp @@ -58,6 +58,28 @@ TTconcept::TTconcept(TTword *word, ScriptType scriptType) : reset(); } +TTconcept::TTconcept(const TTconcept &src) : + _string1(src._string1), _string2(src._string2), + _wordP(nullptr), _scriptP(nullptr) { + + if (src.getStatus()) { + _status = SS_5; + } else { + if (setStatus()) { + _status = SS_VALID; + _scriptP = src._scriptP; + + if (src._wordP) { + _status = initializeWordRef(src._wordP); + copyFrom(src); + } + } + } + + if (_status) + reset(); +} + bool TTconcept::setStatus() { if (_string1.isValid() && _string2.isValid()) { _status = SS_VALID; @@ -97,4 +119,13 @@ void TTconcept::reset() { _status = oldStatus; } +bool TTconcept::compareTo(const char *str) const { + return this != nullptr && _wordP != nullptr && + _wordP->compareTo(str); +} + +void TTconcept::copyFrom(const TTconcept &src) { + // TODO +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index 787013e6c3..8006e56240 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -67,12 +67,29 @@ private: * Resets the concept */ void reset(); + + /** + * Copy auxiliary data from the specified source concept + */ + void copyFrom(const TTconcept &src); public: TTconcept *_nextP; public: TTconcept(); TTconcept(TTscriptBase *script, ScriptType scriptType); TTconcept(TTword *word, ScriptType scriptType); + TTconcept(const TTconcept &src); + + /** + * Compares the name of the associated word, if any, + * to the passed string + */ + bool compareTo(const char *str) const; + + /** + * Return the status of the concept + */ + int getStatus() const { return _status; } }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 9b56aef558..3a49e291d0 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -781,11 +781,12 @@ int TTparser::considerRequests(TTword *word) { break; case OBJECT_IS_TO: - // TODO - //flag = _sentenceSub + flag = fn3(&_sentenceSub->_field8, 3); break; case SEEK_ACTOR: + + case SEEK_OBJECT: case SEEK_OBJECT_OVERRIDE: case SEEK_TO: @@ -865,6 +866,11 @@ int TTparser::fn2(TTword *word) { } } +bool TTparser::fn3(int *v, int v2) { + // TODO + return false; +} + int TTparser::checkReferent(TTpronoun *pronoun) { TTconcept *concept; diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index aba034416c..b73dd7655d 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -152,6 +152,8 @@ private: * Add a concept node */ int addConcept(TTconcept *concept); + + bool fn3(int *v, int v2); public: CScriptHandler *_owner; TTsentenceSub *_sentenceSub; diff --git a/engines/titanic/true_talk/tt_string.cpp b/engines/titanic/true_talk/tt_string.cpp index 90a9aaa635..1491937bd5 100644 --- a/engines/titanic/true_talk/tt_string.cpp +++ b/engines/titanic/true_talk/tt_string.cpp @@ -99,6 +99,10 @@ bool TTstring::operator==(const TTstring &str) { return _data && str._data && _data->_string == str._data->_string; } +bool TTstring::operator==(const char *str) { + return _data && _data->_string == str; +} + void TTstring::save(SimpleFile *file) const { file->writeFormat("%s", c_str()); } diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index 600312431c..435efa14b6 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -58,6 +58,7 @@ public: TTstring &operator+=(const TTstring &str); TTstring &operator+=(char c); bool operator==(const TTstring &str); + bool operator==(const char *str); const char &operator[](int index) { return *(c_str() + index); diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index 028ee81008..24221e12da 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -185,6 +185,10 @@ bool TTword::findSynByName(const TTstring &str, TTsynonym *dest, int mode) const } } +bool TTword::compareTo(const char *str) const { + return _string == str; +} + TTword *TTword::copy() { return new TTword(this); } diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index fa7f31ef75..f7550b4c0a 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -114,6 +114,11 @@ public: const char *c_str() const { return _string.c_str(); } operator const char *() const { return c_str(); } + /** + * Compares the word's text to a passed string + */ + bool compareTo(const char *str) const; + /** * Return the status of the word */ -- cgit v1.2.3 From 6d2f65c97fd4cd23efd3e6e5e0087bf167744d89 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 22 May 2016 07:57:36 -0400 Subject: TITANIC: New TTconcept constructor and copy methods --- engines/titanic/true_talk/script_handler.cpp | 5 +++++ engines/titanic/true_talk/script_handler.h | 5 ++++- engines/titanic/true_talk/tt_concept.cpp | 32 ++++++++++++++++++++++++---- engines/titanic/true_talk/tt_concept.h | 8 ++++--- engines/titanic/true_talk/tt_parser.cpp | 7 ++++++ engines/titanic/true_talk/tt_parser.h | 6 ++++++ engines/titanic/true_talk/tt_word.cpp | 17 +++++++++++++++ engines/titanic/true_talk/tt_word.h | 10 +++++++++ 8 files changed, 82 insertions(+), 8 deletions(-) diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index 0bc50bd5f9..a5f00868bc 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -22,6 +22,7 @@ #include "titanic/true_talk/script_handler.h" #include "titanic/true_talk/tt_sentence.h" +#include "titanic/true_talk/tt_parser.h" #include "titanic/titanic.h" namespace Titanic { @@ -91,4 +92,8 @@ SimpleFile *CScriptHandler::openResource(const CString &name) { return _owner->open(name); } +void CScriptHandler::setParserConcept(TTconcept *newConcept, TTconcept *oldConcept) { + _parser.conceptChanged(newConcept, oldConcept); +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index cf5eac1642..0183612210 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -81,7 +81,10 @@ public: */ SimpleFile *openResource(const CString &name); - + /** + * Called when concept data is copied from one to another + */ + void setParserConcept(TTconcept *newConcept, TTconcept *oldConcept); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_concept.cpp b/engines/titanic/true_talk/tt_concept.cpp index a9794cabe7..cab67c9621 100644 --- a/engines/titanic/true_talk/tt_concept.cpp +++ b/engines/titanic/true_talk/tt_concept.cpp @@ -23,6 +23,7 @@ #include "titanic/true_talk/tt_concept.h" #include "titanic/true_talk/tt_script_base.h" #include "titanic/true_talk/tt_word.h" +#include "titanic/titanic.h" namespace Titanic { @@ -58,7 +59,7 @@ TTconcept::TTconcept(TTword *word, ScriptType scriptType) : reset(); } -TTconcept::TTconcept(const TTconcept &src) : +TTconcept::TTconcept(TTconcept &src) : _string1(src._string1), _string2(src._string2), _wordP(nullptr), _scriptP(nullptr) { @@ -96,7 +97,7 @@ void TTconcept::setScriptType(ScriptType scriptType) { _scriptType = scriptType; _field1C = -1; _field20 = 0; - _field2C = 0; + _word2 = nullptr; _field30 = 0; _field34 = 0; _field38 = 0; @@ -124,8 +125,31 @@ bool TTconcept::compareTo(const char *str) const { _wordP->compareTo(str); } -void TTconcept::copyFrom(const TTconcept &src) { - // TODO +void TTconcept::copyFrom(TTconcept &src) { + _nextP = src._nextP; + _field14 = src._field14; + _scriptType = src._scriptType; + _field1C = src._field1C; + _field20 = src._field20; + + if (src._word2) { + _word2 = src._word2->copyWords(); + if (src._word2->getChainStatus()) + _status = 11; + } else { + _word2 = nullptr; + } + + _field30 = src._field30; + _field34 = src._field34; + + if (src._field38 == 1) { + g_vm->_exeResources._owner->setParserConcept(this, &src); + src.set38(1); + _field38 = 1; + } + + _status = src._status; } } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index 8006e56240..ba48e70369 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -42,7 +42,7 @@ private: int _field1C; int _field20; TTstring _string2; - int _field2C; + TTword *_word2; int _field30; int _field34; int _field38; @@ -71,14 +71,14 @@ private: /** * Copy auxiliary data from the specified source concept */ - void copyFrom(const TTconcept &src); + void copyFrom(TTconcept &src); public: TTconcept *_nextP; public: TTconcept(); TTconcept(TTscriptBase *script, ScriptType scriptType); TTconcept(TTword *word, ScriptType scriptType); - TTconcept(const TTconcept &src); + TTconcept(TTconcept &src); /** * Compares the name of the associated word, if any, @@ -90,6 +90,8 @@ public: * Return the status of the concept */ int getStatus() const { return _status; } + + void set38(int val) { _field38 = val; } }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 3a49e291d0..76c979a2a7 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -895,4 +895,11 @@ int TTparser::checkReferent(TTpronoun *pronoun) { return 0; } +void TTparser::conceptChanged(TTconcept *newConcept, TTconcept *oldConcept) { + if (!oldConcept && newConcept != _currentConceptP) + _currentConceptP = nullptr; + else if (oldConcept && oldConcept == _currentConceptP) + _currentConceptP = newConcept; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index b73dd7655d..84fa1aaa20 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -73,6 +73,7 @@ private: NumberArray _numbers; TTparserNode *_nodesP; TTconcept *_conceptP; + TTconcept *_currentConceptP; private: /** * Loads the various replacement string data arrays @@ -173,6 +174,11 @@ public: int preprocess(TTsentence *sentence); int findFrames(TTsentence *sentence); + + /** + * Called when a concept is copied from one to another + */ + void conceptChanged(TTconcept *newConcept, TTconcept *oldConcept); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index 24221e12da..c2ce2c1ef4 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -210,4 +210,21 @@ void TTword::setSynFile(FileHandle file) { _synP->_file = file; } +TTstringStatus TTword::getChainStatus() const { + for (const TTword *word = this; word; word = word->_nextP) { + if (word->getStatus()) + return word->getStatus(); + } + + return SS_VALID; +} + +TTword *TTword::copyWords() { + TTword *result = copy(); + for (TTword *word = result; word; word = word->_nextP) + word->_nextP = word->_nextP->copy(); + + return result; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index f7550b4c0a..5fa4953be7 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -124,6 +124,16 @@ public: */ TTstringStatus getStatus() const { return _status; } + /** + * Return the status of the entire word chain + */ + TTstringStatus getChainStatus() const; + + /** + * Copy the word and any attached to it + */ + TTword *copyWords(); + /** * Creates a copy of the word */ -- cgit v1.2.3 From 82614fedf3c2b9380530fdc4bc68d585d31aaedb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 22 May 2016 08:09:48 -0400 Subject: TITANIC: Making TTword constructors and copy methods const --- engines/titanic/true_talk/tt_action.cpp | 4 ++-- engines/titanic/true_talk/tt_action.h | 4 ++-- engines/titanic/true_talk/tt_adj.cpp | 4 ++-- engines/titanic/true_talk/tt_adj.h | 4 ++-- engines/titanic/true_talk/tt_major_word.cpp | 4 ++-- engines/titanic/true_talk/tt_major_word.h | 4 ++-- engines/titanic/true_talk/tt_picture.cpp | 4 ++-- engines/titanic/true_talk/tt_picture.h | 4 ++-- engines/titanic/true_talk/tt_pronoun.cpp | 4 ++-- engines/titanic/true_talk/tt_pronoun.h | 4 ++-- engines/titanic/true_talk/tt_word.cpp | 4 ++-- engines/titanic/true_talk/tt_word.h | 4 ++-- 12 files changed, 24 insertions(+), 24 deletions(-) diff --git a/engines/titanic/true_talk/tt_action.cpp b/engines/titanic/true_talk/tt_action.cpp index bb30e9c996..04135b550f 100644 --- a/engines/titanic/true_talk/tt_action.cpp +++ b/engines/titanic/true_talk/tt_action.cpp @@ -30,7 +30,7 @@ TTaction::TTaction(TTstring &str, WordClass wordClass, int val2, int val3, int v TTmajorWord(str, wordClass, val2, val3), _field30(val4) { } -TTaction::TTaction(TTaction *src) : TTmajorWord(src) { +TTaction::TTaction(const TTaction *src) : TTmajorWord(src) { if (src->getStatus()) { _field30 = 0; _status = SS_5; @@ -50,7 +50,7 @@ int TTaction::load(SimpleFile *file) { } } -TTword *TTaction::copy() { +TTword *TTaction::copy() const { TTaction *returnWordP = new TTaction(this); returnWordP->_status = _status; if (!_status) { diff --git a/engines/titanic/true_talk/tt_action.h b/engines/titanic/true_talk/tt_action.h index 0bd104977d..7b91b14743 100644 --- a/engines/titanic/true_talk/tt_action.h +++ b/engines/titanic/true_talk/tt_action.h @@ -34,7 +34,7 @@ protected: int _field30; public: TTaction(TTstring &str, WordClass wordClass, int val2, int val3, int val4); - TTaction(TTaction *src); + TTaction(const TTaction *src); /** * Load the word @@ -47,7 +47,7 @@ public: /** * Creates a copy of the word */ - virtual TTword *copy(); + virtual TTword *copy() const; virtual bool proc12(int val) const { return _field30 == val; } }; diff --git a/engines/titanic/true_talk/tt_adj.cpp b/engines/titanic/true_talk/tt_adj.cpp index 5659ed2276..1c16d5894c 100644 --- a/engines/titanic/true_talk/tt_adj.cpp +++ b/engines/titanic/true_talk/tt_adj.cpp @@ -36,7 +36,7 @@ TTadj::TTadj(TTstring &str, WordClass wordClass, int val2, int val3, int val4) : } } -TTadj::TTadj(TTadj *src) : TTmajorWord(src) { +TTadj::TTadj(const TTadj *src) : TTmajorWord(src) { if (src->getStatus()) { _field30 = 0; _status = SS_5; @@ -56,7 +56,7 @@ int TTadj::load(SimpleFile *file) { } } -TTword *TTadj::copy() { +TTword *TTadj::copy() const { TTadj *returnWordP = new TTadj(this); returnWordP->_status = _status; if (!_status) { diff --git a/engines/titanic/true_talk/tt_adj.h b/engines/titanic/true_talk/tt_adj.h index 7dab02d3d1..813cc8cfa0 100644 --- a/engines/titanic/true_talk/tt_adj.h +++ b/engines/titanic/true_talk/tt_adj.h @@ -34,7 +34,7 @@ protected: int _field30; public: TTadj(TTstring &str, WordClass wordClass, int val2, int val3, int val4); - TTadj(TTadj *src); + TTadj(const TTadj *src); /** * Load the word @@ -44,7 +44,7 @@ public: /** * Creates a copy of the word */ - virtual TTword *copy(); + virtual TTword *copy() const; virtual bool proc14(int val) const { return _field30 == val; } virtual int proc15() const { return _field30; } diff --git a/engines/titanic/true_talk/tt_major_word.cpp b/engines/titanic/true_talk/tt_major_word.cpp index 28b9434026..0085accceb 100644 --- a/engines/titanic/true_talk/tt_major_word.cpp +++ b/engines/titanic/true_talk/tt_major_word.cpp @@ -30,7 +30,7 @@ TTmajorWord::TTmajorWord(TTstring &str, WordClass wordClass, int val2, int val3) TTword(str, wordClass, val2), _field2C(val3) { } -TTmajorWord::TTmajorWord(TTmajorWord *src) : TTword(src) { +TTmajorWord::TTmajorWord(const TTmajorWord *src) : TTword(src) { if (src->getStatus()) { _field2C = 0; _status = SS_5; @@ -51,7 +51,7 @@ int TTmajorWord::saveData(SimpleFile *file, int val) const { return result; } -TTword *TTmajorWord::copy() { +TTword *TTmajorWord::copy() const { TTmajorWord *returnWordP = new TTmajorWord(this); returnWordP->_status = _status; if (!_status) { diff --git a/engines/titanic/true_talk/tt_major_word.h b/engines/titanic/true_talk/tt_major_word.h index 716ccf152f..d3d434e26d 100644 --- a/engines/titanic/true_talk/tt_major_word.h +++ b/engines/titanic/true_talk/tt_major_word.h @@ -39,12 +39,12 @@ protected: int saveData(SimpleFile *file, int val) const; public: TTmajorWord(TTstring &str, WordClass wordClass, int val2, int val3); - TTmajorWord(TTmajorWord *src); + TTmajorWord(const TTmajorWord *src); /** * Creates a copy of the word */ - virtual TTword *copy(); + virtual TTword *copy() const; virtual bool proc2(int val) const { return _field2C == val; } }; diff --git a/engines/titanic/true_talk/tt_picture.cpp b/engines/titanic/true_talk/tt_picture.cpp index 59ff6c746b..5c6444adb3 100644 --- a/engines/titanic/true_talk/tt_picture.cpp +++ b/engines/titanic/true_talk/tt_picture.cpp @@ -31,7 +31,7 @@ TTpicture::TTpicture(TTstring &str, WordClass wordClass, int val2, int val3, int _field38(0) { } -TTpicture::TTpicture(TTpicture *src) : TTmajorWord(src) { +TTpicture::TTpicture(const TTpicture *src) : TTmajorWord(src) { if (getStatus()) { _tag = 0; _field30 = 0; @@ -60,7 +60,7 @@ int TTpicture::load(SimpleFile *file) { } } -TTword *TTpicture::copy() { +TTword *TTpicture::copy() const { TTpicture *returnWordP = new TTpicture(this); returnWordP->_status = _status; if (!_status) { diff --git a/engines/titanic/true_talk/tt_picture.h b/engines/titanic/true_talk/tt_picture.h index 71beefe19c..9c7b2acfbf 100644 --- a/engines/titanic/true_talk/tt_picture.h +++ b/engines/titanic/true_talk/tt_picture.h @@ -37,7 +37,7 @@ protected: int _field3C; public: TTpicture(TTstring &str, WordClass wordClass, int val2, int val3, int val4, int val5, int val6); - TTpicture(TTpicture *src); + TTpicture(const TTpicture *src); /** * Load the word @@ -47,7 +47,7 @@ public: /** * Creates a copy of the word */ - virtual TTword *copy(); + virtual TTword *copy() const; /** * Checks whether the word's tag is a known type diff --git a/engines/titanic/true_talk/tt_pronoun.cpp b/engines/titanic/true_talk/tt_pronoun.cpp index 9b6692e60e..3ef48314e6 100644 --- a/engines/titanic/true_talk/tt_pronoun.cpp +++ b/engines/titanic/true_talk/tt_pronoun.cpp @@ -30,7 +30,7 @@ TTpronoun::TTpronoun(TTstring &str, WordClass wordClass, int val2, int val3, int TTmajorWord(str, wordClass, val2, val3), _field30(val4) { } -TTpronoun::TTpronoun(TTpronoun *src) : TTmajorWord(src) { +TTpronoun::TTpronoun(const TTpronoun *src) : TTmajorWord(src) { if (src->getStatus()) { _field30 = 0; _status = SS_5; @@ -54,7 +54,7 @@ int TTpronoun::load(SimpleFile *file) { } } -TTword *TTpronoun::copy() { +TTword *TTpronoun::copy() const { TTpronoun *returnWordP = new TTpronoun(this); returnWordP->_status = _status; if (!_status) { diff --git a/engines/titanic/true_talk/tt_pronoun.h b/engines/titanic/true_talk/tt_pronoun.h index 0d9466c29c..041ea1d5b8 100644 --- a/engines/titanic/true_talk/tt_pronoun.h +++ b/engines/titanic/true_talk/tt_pronoun.h @@ -34,7 +34,7 @@ protected: int _field30; public: TTpronoun(TTstring &str, WordClass wordClass, int val2, int val3, int val4); - TTpronoun(TTpronoun *src); + TTpronoun(const TTpronoun *src); /** * Load the word @@ -46,7 +46,7 @@ public: /** * Creates a copy of the word */ - virtual TTword *copy(); + virtual TTword *copy() const; virtual bool proc19(int val) const { return _field30 == val; } diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index c2ce2c1ef4..e799507d22 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -32,7 +32,7 @@ TTword::TTword(TTstring &str, WordClass wordClass, int id) : _string(str), _status = str.getStatus() == SS_VALID ? SS_VALID : SS_5; } -TTword::TTword(TTword *src) { +TTword::TTword(const TTword *src) { if (src->getStatus() != SS_VALID) { _status = SS_5; return; @@ -189,7 +189,7 @@ bool TTword::compareTo(const char *str) const { return _string == str; } -TTword *TTword::copy() { +TTword *TTword::copy() const { return new TTword(this); } diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index 5fa4953be7..f8239923d4 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -65,7 +65,7 @@ public: uint _tag; public: TTword(TTstring &str, WordClass wordClass, int val2); - TTword(TTword *src); + TTword(const TTword *src); ~TTword(); /** @@ -137,7 +137,7 @@ public: /** * Creates a copy of the word */ - virtual TTword *copy(); + virtual TTword *copy() const; void unkFn1(int val); -- cgit v1.2.3 From b862f95fe175f3938905e3357d8219cf27d62ae9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 22 May 2016 10:51:03 -0400 Subject: TITANIC: Added concept pointers to CScriptHandler --- engines/titanic/true_talk/script_handler.cpp | 18 ++++++++++++++++-- engines/titanic/true_talk/script_handler.h | 8 ++++---- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index a5f00868bc..470a1fc807 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -21,6 +21,7 @@ */ #include "titanic/true_talk/script_handler.h" +#include "titanic/true_talk/tt_concept.h" #include "titanic/true_talk/tt_sentence.h" #include "titanic/true_talk/tt_parser.h" #include "titanic/titanic.h" @@ -32,7 +33,8 @@ namespace Titanic { CScriptHandler::CScriptHandler(CTitleEngine *owner, int val1, int val2) : _owner(owner), _script(owner->_script), _resources(g_vm->_exeResources), _sub1(), _parser(this), _field10(0), _inputCtr(0), - _field20(0), _field24(0), _field28(0), _field2C(0), _field30(0) { + _concept1P(nullptr), _concept2P(nullptr), _concept3P(nullptr), + _concept4P(nullptr), _field30(0) { g_vm->_scriptHandler = this; g_vm->_script = _script; g_vm->_exeResources.reset(this, val1, val2); @@ -41,6 +43,10 @@ CScriptHandler::CScriptHandler(CTitleEngine *owner, int val1, int val2) : CScriptHandler::~CScriptHandler() { delete _vocab; + delete _concept1P; + delete _concept2P; + delete _concept3P; + delete _concept4P; } ScriptChangedResult CScriptHandler::scriptChanged(TTroomScript *roomScript, TTnpcScript *npcScript, uint dialogueId) { @@ -56,7 +62,15 @@ ScriptChangedResult CScriptHandler::scriptChanged(TTroomScript *roomScript, TTnp if (result != SCR_3 && result != SCR_4) return result; - error("TODO: CScriptHandler::scriptChanged"); + ++_inputCtr; + delete _concept1P; + delete _concept2P; + delete _concept3P; + delete _concept4P; + _concept1P = nullptr; + _concept2P = nullptr; + _concept3P = nullptr; + _concept4P = nullptr; } int CScriptHandler::processInput(TTroomScript *roomScript, TTnpcScript *npcScript, diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index 0183612210..62cf9d0ad4 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -55,10 +55,10 @@ private: CScriptHandlerSub1 _sub1; TTparser _parser; int _inputCtr; - int _field20; - int _field24; - int _field28; - int _field2C; + TTconcept *_concept1P; + TTconcept *_concept2P; + TTconcept *_concept3P; + TTconcept *_concept4P; int _field30; public: TTvocab *_vocab; -- cgit v1.2.3 From bcfebf8f0fb8b1af29c4c80ad00c67e7707bf9ce Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 22 May 2016 11:10:00 -0400 Subject: TITANIC: Added TTconcept destructor --- engines/titanic/true_talk/script_handler.cpp | 2 ++ engines/titanic/true_talk/tt_concept.cpp | 36 ++++++++++++++++++++-------- engines/titanic/true_talk/tt_concept.h | 7 +++--- 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index 470a1fc807..bfd7cdfdfc 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -71,6 +71,8 @@ ScriptChangedResult CScriptHandler::scriptChanged(TTroomScript *roomScript, TTnp _concept2P = nullptr; _concept3P = nullptr; _concept4P = nullptr; + + return result; } int CScriptHandler::processInput(TTroomScript *roomScript, TTnpcScript *npcScript, diff --git a/engines/titanic/true_talk/tt_concept.cpp b/engines/titanic/true_talk/tt_concept.cpp index cab67c9621..2b67c9a66a 100644 --- a/engines/titanic/true_talk/tt_concept.cpp +++ b/engines/titanic/true_talk/tt_concept.cpp @@ -27,7 +27,12 @@ namespace Titanic { -TTconcept::TTconcept() { +TTconcept::TTconcept() : _string1(" "), _string2(" "), + _scriptP(nullptr), _wordP(nullptr) { + if (setStatus()) + setScriptType(ST_UNKNOWN_SCRIPT); + else + reset(); } TTconcept::TTconcept(TTscriptBase *script, ScriptType scriptType) : @@ -81,6 +86,17 @@ TTconcept::TTconcept(TTconcept &src) : reset(); } +TTconcept::~TTconcept() { + if (_word2P) { + _word2P->deleteSiblings(); + delete _word2P; + } + delete _wordP; + + if (_flag) + g_vm->_exeResources._owner->setParserConcept(this, nullptr); +} + bool TTconcept::setStatus() { if (_string1.isValid() && _string2.isValid()) { _status = SS_VALID; @@ -97,10 +113,10 @@ void TTconcept::setScriptType(ScriptType scriptType) { _scriptType = scriptType; _field1C = -1; _field20 = 0; - _word2 = nullptr; + _word2P = nullptr; _field30 = 0; _field34 = 0; - _field38 = 0; + _flag = false; _status = 0; } @@ -132,21 +148,21 @@ void TTconcept::copyFrom(TTconcept &src) { _field1C = src._field1C; _field20 = src._field20; - if (src._word2) { - _word2 = src._word2->copyWords(); - if (src._word2->getChainStatus()) + if (src._word2P) { + _word2P = src._word2P->copyWords(); + if (src._word2P->getChainStatus()) _status = 11; } else { - _word2 = nullptr; + _word2P = nullptr; } _field30 = src._field30; _field34 = src._field34; - if (src._field38 == 1) { + if (src._flag) { g_vm->_exeResources._owner->setParserConcept(this, &src); - src.set38(1); - _field38 = 1; + src.setFlag(true); + _flag = true; } _status = src._status; diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index ba48e70369..d73fea7f8b 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -42,10 +42,10 @@ private: int _field1C; int _field20; TTstring _string2; - TTword *_word2; + TTword *_word2P; int _field30; int _field34; - int _field38; + bool _flag; int _status; private: /** @@ -79,6 +79,7 @@ public: TTconcept(TTscriptBase *script, ScriptType scriptType); TTconcept(TTword *word, ScriptType scriptType); TTconcept(TTconcept &src); + ~TTconcept(); /** * Compares the name of the associated word, if any, @@ -91,7 +92,7 @@ public: */ int getStatus() const { return _status; } - void set38(int val) { _field38 = val; } + void setFlag(bool val) { _flag = val; } }; } // End of namespace Titanic -- cgit v1.2.3 From 1ffb8ff92b9f9d1be7a3f93ad5df859f086f3d94 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 22 May 2016 11:26:01 -0400 Subject: TITANIC: Added TTconcept deleteSiblings --- engines/titanic/true_talk/tt_concept.cpp | 9 +++++++++ engines/titanic/true_talk/tt_concept.h | 5 +++++ engines/titanic/true_talk/tt_parser.cpp | 11 +++++++++-- engines/titanic/true_talk/tt_parser.h | 2 +- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/engines/titanic/true_talk/tt_concept.cpp b/engines/titanic/true_talk/tt_concept.cpp index 2b67c9a66a..59d53a91ae 100644 --- a/engines/titanic/true_talk/tt_concept.cpp +++ b/engines/titanic/true_talk/tt_concept.cpp @@ -97,6 +97,15 @@ TTconcept::~TTconcept() { g_vm->_exeResources._owner->setParserConcept(this, nullptr); } +void TTconcept::deleteSiblings() { + for (TTconcept *currP = _nextP, *nextP; currP; currP = nextP) { + nextP = currP->_nextP; + delete currP; + } + + _nextP = nullptr; +} + bool TTconcept::setStatus() { if (_string1.isValid() && _string2.isValid()) { _status = SS_VALID; diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index d73fea7f8b..d28ac57575 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -81,6 +81,11 @@ public: TTconcept(TTconcept &src); ~TTconcept(); + /** + * Destroys any attached sibling concepts to the given concept + */ + void deleteSiblings(); + /** * Compares the name of the associated word, if any, * to the passed string diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 76c979a2a7..7c3737b949 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -31,8 +31,8 @@ namespace Titanic { TTparser::TTparser(CScriptHandler *owner) : _owner(owner), _sentenceSub(nullptr), - _sentence(nullptr), _fieldC(0), _field10(0), _field14(0), _field18(0), - _nodesP(nullptr), _conceptP(nullptr) { + _sentence(nullptr), _fieldC(0), _field10(0), _field14(0), + _currentWordP(nullptr), _nodesP(nullptr), _conceptP(nullptr) { loadArrays(); } @@ -41,6 +41,13 @@ TTparser::~TTparser() { _nodesP->deleteSiblings(); delete _nodesP; } + + if (_conceptP) { + _conceptP->deleteSiblings(); + delete _conceptP; + } + + delete _currentWordP; } void TTparser::loadArrays() { diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index 84fa1aaa20..675bdd6345 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -162,7 +162,7 @@ public: int _fieldC; int _field10; int _field14; - int _field18; + TTword *_currentWordP; public: TTparser(CScriptHandler *owner); ~TTparser(); -- cgit v1.2.3 From 8c99ff510c2e8a7d4cde30dc6d8b3698fb998907 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 22 May 2016 13:54:29 -0400 Subject: TITANIC: Added TTconcept copyFrom method --- engines/titanic/true_talk/tt_concept.cpp | 29 +++++++++++++++++++++++++++-- engines/titanic/true_talk/tt_concept.h | 9 +++++++-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/engines/titanic/true_talk/tt_concept.cpp b/engines/titanic/true_talk/tt_concept.cpp index 59d53a91ae..8ecaf89289 100644 --- a/engines/titanic/true_talk/tt_concept.cpp +++ b/engines/titanic/true_talk/tt_concept.cpp @@ -77,7 +77,7 @@ TTconcept::TTconcept(TTconcept &src) : if (src._wordP) { _status = initializeWordRef(src._wordP); - copyFrom(src); + initialize(src); } } } @@ -150,7 +150,7 @@ bool TTconcept::compareTo(const char *str) const { _wordP->compareTo(str); } -void TTconcept::copyFrom(TTconcept &src) { +void TTconcept::initialize(TTconcept &src) { _nextP = src._nextP; _field14 = src._field14; _scriptType = src._scriptType; @@ -177,4 +177,29 @@ void TTconcept::copyFrom(TTconcept &src) { _status = src._status; } +void TTconcept::copyFrom(TTconcept *src) { + if (this != src) { + if (src->getStatus()) { + _status = SS_5; + } else { + _string1 = src->_string1; + _string2 = src->_string2; + + if (setStatus()) { + _scriptP = src->_scriptP; + if (src->_wordP) { + _status = initializeWordRef(src->_wordP); + initialize(*src); + } else { + _wordP = nullptr; + initialize(*src); + } + } + } + } + + if (_status) + reset(); +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index d28ac57575..ae956c14f1 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -69,9 +69,9 @@ private: void reset(); /** - * Copy auxiliary data from the specified source concept + * Initialize inner data for the concept from a given source concept */ - void copyFrom(TTconcept &src); + void initialize(TTconcept &src); public: TTconcept *_nextP; public: @@ -86,6 +86,11 @@ public: */ void deleteSiblings(); + /** + * Copies data from a source concept + */ + void copyFrom(TTconcept *src); + /** * Compares the name of the associated word, if any, * to the passed string -- cgit v1.2.3 From 6ab35972e87fd1ac6a2eab7a4a07683f2e844d76 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 22 May 2016 14:28:47 -0400 Subject: TITANIC: Implement TTconcept getText --- engines/titanic/true_talk/tt_concept.cpp | 25 ++++++++++++++++++++++++- engines/titanic/true_talk/tt_concept.h | 9 +++++++++ engines/titanic/true_talk/tt_parser.cpp | 4 ++-- engines/titanic/true_talk/tt_script_base.cpp | 8 ++++---- engines/titanic/true_talk/tt_script_base.h | 17 +++++++++++++++-- engines/titanic/true_talk/tt_word.h | 5 +++++ 6 files changed, 59 insertions(+), 9 deletions(-) diff --git a/engines/titanic/true_talk/tt_concept.cpp b/engines/titanic/true_talk/tt_concept.cpp index 8ecaf89289..f88722eb48 100644 --- a/engines/titanic/true_talk/tt_concept.cpp +++ b/engines/titanic/true_talk/tt_concept.cpp @@ -41,7 +41,7 @@ TTconcept::TTconcept(TTscriptBase *script, ScriptType scriptType) : setScriptType(scriptType); _scriptP = script; - if (scriptType == ST_UNKNOWN_SCRIPT && script->_field8 == 1) + if (scriptType == ST_UNKNOWN_SCRIPT && script->_id == 1) _scriptType = ST_ROOM_SCRIPT; } @@ -202,4 +202,27 @@ void TTconcept::copyFrom(TTconcept *src) { reset(); } +bool TTconcept::checkWordId1() const { + return (_wordP && (_wordP->_id == 200 || _wordP->_id == 201 || + _wordP->_id == 602 || _wordP->_id == 607)) || + (_scriptP && _scriptP->_id <= 2); +} + +bool TTconcept::checkWordId2() const { + return (_wordP && _wordP->_id == 204) || (_scriptP && _scriptP->getId() == 3); +} + +bool TTconcept::checkWordClass() const { + return !_scriptP && _wordP && (_wordP->_wordClass == WC_THING || _wordP->_wordClass == WC_PRONOUN); +} + +const TTstring TTconcept::getText() { + if (_scriptP) + return _scriptP->getText(); + else if (_wordP) + return _wordP->getText(); + else + return TTstring(); +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index ae956c14f1..a2e5fb2e2a 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -103,6 +103,15 @@ public: int getStatus() const { return _status; } void setFlag(bool val) { _flag = val; } + + bool checkWordId1() const; + bool checkWordId2() const; + bool checkWordClass() const; + + /** + * Return text assocaited with the concept's word or script + */ + const TTstring getText(); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 7c3737b949..cb12e04afb 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -735,8 +735,8 @@ int TTparser::considerRequests(TTword *word) { bool flag = false; while (word) { - int ecx = 906; - int edx = 12; + //int ecx = 906; + //int edx = 12; if (nodeP->_tag == MKTAG('C', 'O', 'M', 'E')) { addNode(7); diff --git a/engines/titanic/true_talk/tt_script_base.cpp b/engines/titanic/true_talk/tt_script_base.cpp index a8e0940471..85c329c330 100644 --- a/engines/titanic/true_talk/tt_script_base.cpp +++ b/engines/titanic/true_talk/tt_script_base.cpp @@ -25,16 +25,16 @@ namespace Titanic { -TTscriptBase::TTscriptBase(int v1, const char *charClass, int v2, +TTscriptBase::TTscriptBase(int scriptId, const char *charClass, int v2, const char *charName, int v3, int v4, int v5, int v6, int v7) : _charName(charName), _charClass(charClass), - _nodesP(nullptr), _field8(0), _hist(nullptr), + _nodesP(nullptr), _id(0), _hist(nullptr), _field20(0), _field24(0), _field28(0), _field2C(0), _field30(0), _field34(0), _field38(0), _field3C(0), _field40(0), _field44(0), _field48(0), _status(0) { if (!areNamesValid()) { if (!v7 || !getStatus()) { - _field8 = v1; + _id = scriptId; _field20 = v3; _field24 = v4; _field28 = v5; @@ -65,7 +65,7 @@ bool TTscriptBase::areNamesValid() { void TTscriptBase::reset() { _nodesP = nullptr; - _field8 = 4; + _id = 4; _hist = nullptr; _field20 = 0; _field24 = -1; diff --git a/engines/titanic/true_talk/tt_script_base.h b/engines/titanic/true_talk/tt_script_base.h index 2b748db93b..2ffbf60760 100644 --- a/engines/titanic/true_talk/tt_script_base.h +++ b/engines/titanic/true_talk/tt_script_base.h @@ -55,16 +55,29 @@ protected: int _field48; int _status; public: - int _field8; + int _id; public: - TTscriptBase(int v1, const char *charClass, int v2, const char *charName, + TTscriptBase(int scriptId, const char *charClass, int v2, const char *charName, int v3, int v4, int v5, int v6, int v7); virtual ~TTscriptBase(); bool areNamesValid(); + /** + * Return the Id of the script + */ + int getId() const { return _id; } + + /** + * Return the status + */ int getStatus() const { return _status; } + /** + * Return the script text + */ + const TTstring getText() { return _charClass; } + /** * Gets passed a newly created input wrapper during conversation text processing */ diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index f8239923d4..09d9f5e667 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -114,6 +114,11 @@ public: const char *c_str() const { return _string.c_str(); } operator const char *() const { return c_str(); } + /** + * Return the text of the word + */ + const TTstring getText() { return _string; } + /** * Compares the word's text to a passed string */ -- cgit v1.2.3 From c3055aeaf08601f8072de1c7d1922284bc3f933f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 22 May 2016 15:02:02 -0400 Subject: TITANIC: Added TTconcept setOwner --- engines/titanic/true_talk/tt_concept.cpp | 30 ++++++++++++++++++++++++++++++ engines/titanic/true_talk/tt_concept.h | 10 ++++++++++ 2 files changed, 40 insertions(+) diff --git a/engines/titanic/true_talk/tt_concept.cpp b/engines/titanic/true_talk/tt_concept.cpp index f88722eb48..8f428391bf 100644 --- a/engines/titanic/true_talk/tt_concept.cpp +++ b/engines/titanic/true_talk/tt_concept.cpp @@ -202,6 +202,36 @@ void TTconcept::copyFrom(TTconcept *src) { reset(); } +int TTconcept::setOwner(TTconcept *src) { + if (this) { + if (src->_wordP) { + TTword *newWord = src->_wordP->copy(); + return setOwner(newWord, 1); + } + } + + return 0; +} + +int TTconcept::setOwner(TTword *src, bool dontDup) { + TTword *word = dontDup ? src : src->copy(); + + if (word) { + if (!_word2P) { + _word2P = word; + } else { + // Add word to end of word list + TTword *tailP = _word2P; + while (tailP->_nextP) + tailP = tailP->_nextP; + + tailP->_nextP = word; + } + } + + return 0; +} + bool TTconcept::checkWordId1() const { return (_wordP && (_wordP->_id == 200 || _wordP->_id == 201 || _wordP->_id == 602 || _wordP->_id == 607)) || diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index a2e5fb2e2a..4b908ca2b2 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -97,6 +97,16 @@ public: */ bool compareTo(const char *str) const; + /** + * Set an owner for the concept + */ + int setOwner(TTconcept *src); + + /** + * Set an owner for the concept + */ + int setOwner(TTword *src, bool dontDup); + /** * Return the status of the concept */ -- cgit v1.2.3 From 76c84afdfe5cf020f74d724d8cc3bcf67b6d754d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 22 May 2016 15:22:36 -0400 Subject: TITANIC: Added TTconcept find methods --- engines/titanic/true_talk/tt_concept.cpp | 18 ++++++++++++++++++ engines/titanic/true_talk/tt_concept.h | 13 +++++++++++++ 2 files changed, 31 insertions(+) diff --git a/engines/titanic/true_talk/tt_concept.cpp b/engines/titanic/true_talk/tt_concept.cpp index 8f428391bf..6683c8e457 100644 --- a/engines/titanic/true_talk/tt_concept.cpp +++ b/engines/titanic/true_talk/tt_concept.cpp @@ -255,4 +255,22 @@ const TTstring TTconcept::getText() { return TTstring(); } +TTconcept *TTconcept::findByWordId(int id) { + for (TTconcept *conceptP = this; conceptP; conceptP = conceptP->_nextP) { + if (conceptP->_wordP && conceptP->_wordP->_id == id) + return conceptP; + } + + return nullptr; +} + +TTconcept *TTconcept::findByWordClass(WordClass wordClass) { + for (TTconcept *conceptP = this; conceptP; conceptP = conceptP->_nextP) { + if (conceptP->_wordP && conceptP->_wordP->_wordClass == wordClass) + return conceptP; + } + + return nullptr; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index 4b908ca2b2..eefe113533 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -24,6 +24,7 @@ #define TITANIC_TT_CONCEPT_H #include "titanic/true_talk/tt_string.h" +#include "titanic/true_talk/tt_word.h" namespace Titanic { @@ -114,6 +115,8 @@ public: void setFlag(bool val) { _flag = val; } + void set1C(int val) { _field1C = val; } + bool checkWordId1() const; bool checkWordId2() const; bool checkWordClass() const; @@ -122,6 +125,16 @@ public: * Return text assocaited with the concept's word or script */ const TTstring getText(); + + /** + * Find a word by Id + */ + TTconcept *findByWordId(int id); + + /** + * Find a word by it's class + */ + TTconcept *findByWordClass(WordClass wordClass); }; } // End of namespace Titanic -- cgit v1.2.3 From 73e2e8f429eea33e121d93dbc2c38b8be52709d8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 22 May 2016 15:44:50 -0400 Subject: TITANIC: Added TTconcept id methods --- engines/titanic/true_talk/tt_concept.cpp | 8 ++++++++ engines/titanic/true_talk/tt_concept.h | 10 ++++++++++ engines/titanic/true_talk/tt_pronoun.h | 4 +++- engines/titanic/true_talk/tt_word.h | 9 ++++++++- 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/engines/titanic/true_talk/tt_concept.cpp b/engines/titanic/true_talk/tt_concept.cpp index 6683c8e457..05e6401018 100644 --- a/engines/titanic/true_talk/tt_concept.cpp +++ b/engines/titanic/true_talk/tt_concept.cpp @@ -273,4 +273,12 @@ TTconcept *TTconcept::findByWordClass(WordClass wordClass) { return nullptr; } +bool TTconcept::isWordId(int id) const { + return this && _wordP && _wordP->_id == id; +} + +int TTconcept::getWordId() const { + return this && _wordP ? _wordP->_id : 0; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index eefe113533..112d864e19 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -135,6 +135,16 @@ public: * Find a word by it's class */ TTconcept *findByWordClass(WordClass wordClass); + + /** + * Returns true if the concept has a word with a given Id + */ + bool isWordId(int id) const; + + /** + * If a word is associated, return it's Id + */ + int getWordId() const; }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_pronoun.h b/engines/titanic/true_talk/tt_pronoun.h index 041ea1d5b8..ccc077152c 100644 --- a/engines/titanic/true_talk/tt_pronoun.h +++ b/engines/titanic/true_talk/tt_pronoun.h @@ -48,7 +48,9 @@ public: */ virtual TTword *copy() const; - virtual bool proc19(int val) const { return _field30 == val; } + virtual bool comparePronounTo(int val) const { + return _field30 == val; + } /** * Dumps data associated with the word to file diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index 09d9f5e667..05108817ce 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -124,6 +124,13 @@ public: */ bool compareTo(const char *str) const; + /** + * Compares the word's text to a passed string + */ + bool compareTo(TTstring *str) const { + return compareTo(str->c_str()); + } + /** * Return the status of the word */ @@ -176,7 +183,7 @@ public: virtual bool proc16() const { return false; } virtual bool proc17() const { return false; } virtual bool proc18() const { return false; } - virtual bool proc19(int val) const { return false; } + virtual bool comparePronounTo(int val) const { return false; } virtual int proc20() const { return 0; } /** -- cgit v1.2.3 From 938ec867fe6d172c4489bb28ab4a2609004459dc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 22 May 2016 15:51:35 -0400 Subject: TITANIC: Added TTword isClass method --- devtools/create_titanic/create_titanic_dat.cpp | 4 +++- engines/titanic/true_talk/tt_word.h | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index ca55f7c5cf..35157b07cf 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -49,7 +49,7 @@ */ #define VERSION_NUMBER 1 -#define HEADER_SIZE 0x290 +#define HEADER_SIZE 0x300 Common::File inputFile, outputFile; Common::PEResources res; @@ -349,6 +349,8 @@ void writeData() { writeStringArray("TEXT/REPLACEMENTS1", 0x21BDB0, 218); writeStringArray("TEXT/REPLACEMENTS2", 0x21C120, 1576); writeStringArray("TEXT/REPLACEMENTS3", 0x21D9C8, 82); + writeStringArray("TEXT/PRONOUNS", 0x22F718, 15); + writeNumbers(); } diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index 05108817ce..94edee329e 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -141,6 +141,11 @@ public: */ TTstringStatus getChainStatus() const; + /** + * Returns true if the word is of the specified class + */ + bool isClass(WordClass wordClass) const { return _wordClass == wordClass; } + /** * Copy the word and any attached to it */ -- cgit v1.2.3 From d537a25bd705d803d6fb0dc8202c8ef88460cd2c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 23 May 2016 21:37:48 -0400 Subject: TITANIC: Added TTsentenceSubBase setHandlerConcept --- engines/titanic/true_talk/script_handler.h | 10 ++--- engines/titanic/true_talk/tt_parser.cpp | 72 +++++++++++++++++------------- engines/titanic/true_talk/tt_parser.h | 10 ++++- engines/titanic/true_talk/tt_sentence.cpp | 63 ++++++++++++++++++++++++-- engines/titanic/true_talk/tt_sentence.h | 14 +++--- engines/titanic/true_talk/tt_vocab.cpp | 2 +- engines/titanic/true_talk/tt_vocab.h | 1 - 7 files changed, 123 insertions(+), 49 deletions(-) diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index 62cf9d0ad4..1c0824869c 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -53,16 +53,16 @@ private: CExeResources &_resources; int _field10; CScriptHandlerSub1 _sub1; - TTparser _parser; int _inputCtr; - TTconcept *_concept1P; - TTconcept *_concept2P; - TTconcept *_concept3P; - TTconcept *_concept4P; int _field30; public: + TTparser _parser; TTvocab *_vocab; TTscriptBase *_script; + TTconcept *_concept1P; + TTconcept *_concept2P; + TTconcept *_concept3P; + TTconcept *_concept4P; public: CScriptHandler(CTitleEngine *owner, int val1, int val2); ~CScriptHandler(); diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index cb12e04afb..02ecf0aedd 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -50,29 +50,21 @@ TTparser::~TTparser() { delete _currentWordP; } -void TTparser::loadArrays() { - Common::SeekableReadStream *r; - r = g_vm->_filesManager->getResource("TEXT/REPLACEMENTS1"); - while (r->pos() < r->size()) - _replacements1.push_back(readStringFromStream(r)); - delete r; - - r = g_vm->_filesManager->getResource("TEXT/REPLACEMENTS2"); +void TTparser::loadArray(StringArray &arr, const CString &name) { + Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); while (r->pos() < r->size()) - _replacements2.push_back(readStringFromStream(r)); - delete r; - - r = g_vm->_filesManager->getResource("TEXT/REPLACEMENTS3"); - while (r->pos() < r->size()) - _replacements3.push_back(readStringFromStream(r)); + arr.push_back(readStringFromStream(r)); delete r; +} - r = g_vm->_filesManager->getResource("TEXT/PHRASES"); - while (r->pos() < r->size()) - _phrases.push_back(readStringFromStream(r)); - delete r; +void TTparser::loadArrays() { + loadArray(_replacements1, "TEXT/REPLACEMENTS1"); + loadArray(_replacements2, "TEXT/REPLACEMENTS2"); + loadArray(_replacements3, "TEXT/REPLACEMENTS3"); + loadArray(_phrases, "TEXT/PHRASES"); + loadArray(_pronouns, "TEXT/PRONOUNS"); - r = g_vm->_filesManager->getResource("TEXT/NUMBERS"); + Common::SeekableReadStream *r = g_vm->_filesManager->getResource("TEXT/NUMBERS"); while (r->pos() < r->size()) { NumberEntry ne; ne._text = readStringFromStream(r); @@ -81,7 +73,6 @@ void TTparser::loadArrays() { _numbers.push_back(ne); } delete r; - } int TTparser::preprocess(TTsentence *sentence) { @@ -490,7 +481,8 @@ int TTparser::findFrames(TTsentence *sentence) { TTstring *line = sentence->_normalizedLine.copy(); TTstring wordString; - for (;;) { + int status = 0; + for (int ctr = 1; !status; ++ctr) { // Keep stripping words off the start of the passed input wordString = line->tokenize(" \n"); if (wordString.empty()) @@ -500,17 +492,23 @@ int TTparser::findFrames(TTsentence *sentence) { TTword *word = _owner->_vocab->getWord(wordString, &word); sentence->storeVocabHit(srcWord); - if (word) { - // TODO - } else { - + if (!word && ctr == 1) { + word = new TTword(wordString, WC_UNKNOWN, 0); } + + for (TTword *currP = word; currP && !status; currP = currP->_nextP) + status = processRequests(currP); + + word->deleteSiblings(); + delete word; } + if (!status) { + status = fn1(); + } - // TODO delete line; - return 0; + return status; } int TTparser::loadRequests(TTword *word) { @@ -767,10 +765,10 @@ int TTparser::considerRequests(TTword *word) { } else { switch (nodeP->_tag) { case CHECK_COMMAND_FORM: - if (_sentenceSub->_field4 && _sentence->_field2C == 1 && - !_sentenceSub->_conceptP) { + if (_sentenceSub->_concept1P && _sentence->_field2C == 1 && + !_sentenceSub->_concept0P) { concept = new TTconcept(_sentence->_npcScript, ST_NPC_SCRIPT); - _sentenceSub->_conceptP = concept; + _sentenceSub->_concept0P = concept; _sentenceSub->_field18 = 3; } @@ -788,7 +786,7 @@ int TTparser::considerRequests(TTword *word) { break; case OBJECT_IS_TO: - flag = fn3(&_sentenceSub->_field8, 3); + flag = fn3(&_sentenceSub->_concept2P, 3); break; case SEEK_ACTOR: @@ -828,6 +826,11 @@ int TTparser::considerRequests(TTword *word) { return status; } +int TTparser::processRequests(TTword *word) { + // TODO + return 0; +} + void TTparser::addToConceptList(TTword *word) { TTconcept *concept = new TTconcept(word, ST_UNKNOWN_SCRIPT); addConcept(concept); @@ -851,6 +854,11 @@ int TTparser::addConcept(TTconcept *concept) { return SS_VALID; } +int TTparser::fn1() { + // TODO + return 0; +} + int TTparser::fn2(TTword *word) { switch (word->_id) { case 600: @@ -873,7 +881,7 @@ int TTparser::fn2(TTword *word) { } } -bool TTparser::fn3(int *v, int v2) { +bool TTparser::fn3(TTconcept **v, int v2) { // TODO return false; } diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index 675bdd6345..a8bb906559 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -75,6 +75,11 @@ private: TTconcept *_conceptP; TTconcept *_currentConceptP; private: + /** + * Load the data for a given array resource + */ + void loadArray(StringArray &arr, const CString &name); + /** * Loads the various replacement string data arrays */ @@ -139,6 +144,7 @@ private: int loadRequests(TTword *word); int considerRequests(TTword *word); + int processRequests(TTword *word); void addToConceptList(TTword *word); int fn2(TTword *word); @@ -154,7 +160,8 @@ private: */ int addConcept(TTconcept *concept); - bool fn3(int *v, int v2); + int fn1(); + bool fn3(TTconcept **v, int v2); public: CScriptHandler *_owner; TTsentenceSub *_sentenceSub; @@ -163,6 +170,7 @@ public: int _field10; int _field14; TTword *_currentWordP; + StringArray _pronouns; public: TTparser(CScriptHandler *owner); ~TTparser(); diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index 40e3bb09e2..9558c546c3 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -21,13 +21,16 @@ */ #include "titanic/true_talk/tt_sentence.h" +#include "titanic/true_talk/tt_concept.h" #include "titanic/true_talk/script_handler.h" +#include "titanic/titanic.h" namespace Titanic { -TTsentenceSubBase::TTsentenceSubBase() : _conceptP(nullptr), _field4(0), - _field8(0), _fieldC(0), _field10(0), _field14(0), _field18(0), - _field1C(0), _nextP(nullptr), _field24(0) { +TTsentenceSubBase::TTsentenceSubBase() : _concept0P(nullptr), + _concept1P(nullptr), _concept2P(nullptr), _concept3P(nullptr), + _concept4P(nullptr), _concept5P(nullptr), _field18(0), + _field1C(0), _nextP(nullptr), _field24(0) { } void TTsentenceSubBase::deleteSiblings() { @@ -40,6 +43,60 @@ void TTsentenceSubBase::deleteSiblings() { _nextP = nullptr; } +TTconcept **TTsentenceSubBase::setConcept(int conceptIndex, TTconcept *src) { + TTconcept **conceptPP = nullptr; + switch (conceptIndex) { + case 1: + conceptPP = &_concept1P; + break; + case 2: + conceptPP = &_concept2P; + break; + case 3: + conceptPP = &_concept3P; + break; + case 4: + conceptPP = &_concept4P; + break; + case 5: + conceptPP = &_concept5P; + break; + default: + break; + } + + bool isPronoun = false; + StringArray &pronouns = g_vm->_scriptHandler->_parser._pronouns; + for (uint idx = 0; idx < pronouns.size() && !isPronoun; ++idx) { + isPronoun = pronouns[idx] == src->getText(); + } + + CScriptHandler &scrHandler = *g_vm->_exeResources._owner; + if (!isPronoun) { + switch (conceptIndex) { + case 0: + delete scrHandler._concept2P; + scrHandler._concept2P = new TTconcept(*src); + break; + + case 1: + delete scrHandler._concept4P; + scrHandler._concept4P = new TTconcept(*src); + break; + + case 2: + delete scrHandler._concept1P; + scrHandler._concept1P = new TTconcept(*src); + break; + + default: + break; + } + } + + return conceptPP; +} + /*------------------------------------------------------------------------*/ TTsentenceSub *TTsentenceSub::addSibling() { diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index e6d0d0c2b3..3a4fd6c685 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -36,12 +36,12 @@ class TTword; class TTsentenceSubBase { public: - TTconcept *_conceptP; - int _field4; - int _field8; - int _fieldC; - int _field10; - int _field14; + TTconcept *_concept0P; + TTconcept *_concept1P; + TTconcept *_concept2P; + TTconcept *_concept3P; + TTconcept *_concept4P; + TTconcept *_concept5P; int _field18; int _field1C; TTsentenceSubBase *_nextP; @@ -57,6 +57,8 @@ public: void set18(int val) { _field18 = val; } int get18() const { return _field18; } bool is24() const { return _field24 == 0; } + + TTconcept **setConcept(int conceptIndex, TTconcept *src); }; class TTsentenceSub : public TTsentenceSubBase { diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp index eb3d52331f..062b598609 100644 --- a/engines/titanic/true_talk/tt_vocab.cpp +++ b/engines/titanic/true_talk/tt_vocab.cpp @@ -34,7 +34,7 @@ namespace Titanic { TTvocab::TTvocab(int val): _headP(nullptr), _tailP(nullptr), _word(nullptr), _fieldC(0), _field10(0), _vocabMode(val) { - _field14 = load("STVOCAB.TXT"); + load("STVOCAB.TXT"); } TTvocab::~TTvocab() { diff --git a/engines/titanic/true_talk/tt_vocab.h b/engines/titanic/true_talk/tt_vocab.h index c84acbe741..fc7ee2e102 100644 --- a/engines/titanic/true_talk/tt_vocab.h +++ b/engines/titanic/true_talk/tt_vocab.h @@ -36,7 +36,6 @@ private: TTword *_word; int _fieldC; int _field10; - int _field14; int _vocabMode; private: /** -- cgit v1.2.3 From 2b6a6cffc0b1854734540170d8b91430b5cc2f97 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 23 May 2016 22:06:33 -0400 Subject: TITANIC: Implemented TTsentecneSubBase changeConcept --- engines/titanic/true_talk/tt_sentence.cpp | 15 +++++++++++++++ engines/titanic/true_talk/tt_sentence.h | 1 + engines/titanic/true_talk/tt_string.h | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index 9558c546c3..7b49df2560 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -97,6 +97,21 @@ TTconcept **TTsentenceSubBase::setConcept(int conceptIndex, TTconcept *src) { return conceptPP; } +int TTsentenceSubBase::changeConcept(int mode, TTconcept **conceptPP, int conceptIndex) { + TTconcept **newConceptPP = setConcept(conceptIndex, *conceptPP); + + if (mode == 0 || (mode == 1 && !*newConceptPP)) { + if (!*conceptPP) + return SS_5; + + delete *newConceptPP; + *newConceptPP = new TTconcept(**conceptPP); + return SS_VALID; + } else { + return SS_1; + } +} + /*------------------------------------------------------------------------*/ TTsentenceSub *TTsentenceSub::addSibling() { diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index 3a4fd6c685..e995884ec0 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -59,6 +59,7 @@ public: bool is24() const { return _field24 == 0; } TTconcept **setConcept(int conceptIndex, TTconcept *src); + int changeConcept(int mode, TTconcept **conceptPP, int conceptIndex); }; class TTsentenceSub : public TTsentenceSubBase { diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index 435efa14b6..060a48f5b6 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -38,7 +38,7 @@ struct TTstringData { TTstringData(const CString &str) : _string(str), _referenceCount(1) {} }; -enum TTstringStatus { SS_VALID = 0, SS_5 = 5, SS_7 = 7, SS_8 = 8, SS_11 = 11, SS_13 = 13 }; +enum TTstringStatus { SS_VALID = 0, SS_1 = 1, SS_5 = 5, SS_7 = 7, SS_8 = 8, SS_11 = 11, SS_13 = 13 }; class TTstring { private: -- cgit v1.2.3 From ae9a04bd414b45bbd8d3c00357432457a92230f9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 23 May 2016 22:40:20 -0400 Subject: TITANIC: Refactored TTsentenceSubBase to TTconceptNode --- engines/titanic/module.mk | 1 + engines/titanic/true_talk/tt_concept_node.cpp | 126 ++++++++++++++++++++++++++ engines/titanic/true_talk/tt_concept_node.h | 65 +++++++++++++ engines/titanic/true_talk/tt_parser.cpp | 28 +++--- engines/titanic/true_talk/tt_parser.h | 2 +- engines/titanic/true_talk/tt_sentence.cpp | 97 +------------------- engines/titanic/true_talk/tt_sentence.h | 39 ++------ 7 files changed, 218 insertions(+), 140 deletions(-) create mode 100644 engines/titanic/true_talk/tt_concept_node.cpp create mode 100644 engines/titanic/true_talk/tt_concept_node.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index b3d1444317..19e4aff31b 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -463,6 +463,7 @@ MODULE_OBJS := \ true_talk/tt_action.o \ true_talk/tt_adj.o \ true_talk/tt_concept.o \ + true_talk/tt_concept_node.o \ true_talk/tt_hist.o \ true_talk/tt_major_word.o \ true_talk/tt_node.o \ diff --git a/engines/titanic/true_talk/tt_concept_node.cpp b/engines/titanic/true_talk/tt_concept_node.cpp new file mode 100644 index 0000000000..9ad985746f --- /dev/null +++ b/engines/titanic/true_talk/tt_concept_node.cpp @@ -0,0 +1,126 @@ +/* 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 "titanic/true_talk/tt_concept_node.h" +#include "titanic/true_talk/script_handler.h" +#include "titanic/titanic.h" + +namespace Titanic { + +TTconceptNode::TTconceptNode() : _concept0P(nullptr), + _concept1P(nullptr), _concept2P(nullptr), _concept3P(nullptr), + _concept4P(nullptr), _concept5P(nullptr), _field18(0), + _field1C(0), _nextP(nullptr), _status(0) { +} + +TTconceptNode::TTconceptNode(const TTconceptNode &src) : _concept0P(nullptr), + _concept1P(nullptr), _concept2P(nullptr), _concept3P(nullptr), + _concept4P(nullptr), _concept5P(nullptr), _field18(0), + _field1C(0), _nextP(nullptr), _status(0) { + if (src._status) { + _status = SS_5; + } else { + // TODO + } +} + + +void TTconceptNode::deleteSiblings() { + // Iterate through the linked chain of nodes, deleting each in turn + for (TTconceptNode *curP = _nextP, *nextP = nullptr; nextP; curP = nextP) { + nextP = curP->_nextP; + delete curP; + } + + _nextP = nullptr; +} + +TTconcept **TTconceptNode::setConcept(int conceptIndex, TTconcept *src) { + TTconcept **conceptPP = nullptr; + switch (conceptIndex) { + case 1: + conceptPP = &_concept1P; + break; + case 2: + conceptPP = &_concept2P; + break; + case 3: + conceptPP = &_concept3P; + break; + case 4: + conceptPP = &_concept4P; + break; + case 5: + conceptPP = &_concept5P; + break; + default: + break; + } + + bool isPronoun = false; + StringArray &pronouns = g_vm->_scriptHandler->_parser._pronouns; + for (uint idx = 0; idx < pronouns.size() && !isPronoun; ++idx) { + isPronoun = pronouns[idx] == src->getText(); + } + + CScriptHandler &scrHandler = *g_vm->_exeResources._owner; + if (!isPronoun) { + switch (conceptIndex) { + case 0: + delete scrHandler._concept2P; + scrHandler._concept2P = new TTconcept(*src); + break; + + case 1: + delete scrHandler._concept4P; + scrHandler._concept4P = new TTconcept(*src); + break; + + case 2: + delete scrHandler._concept1P; + scrHandler._concept1P = new TTconcept(*src); + break; + + default: + break; + } + } + + return conceptPP; +} + +int TTconceptNode::changeConcept(int mode, TTconcept **conceptPP, int conceptIndex) { + TTconcept **newConceptPP = setConcept(conceptIndex, *conceptPP); + + if (mode == 0 || (mode == 1 && !*newConceptPP)) { + if (!*conceptPP) + return SS_5; + + delete *newConceptPP; + *newConceptPP = new TTconcept(**conceptPP); + return SS_VALID; + } else { + return SS_1; + } +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_concept_node.h b/engines/titanic/true_talk/tt_concept_node.h new file mode 100644 index 0000000000..8fc1371f7b --- /dev/null +++ b/engines/titanic/true_talk/tt_concept_node.h @@ -0,0 +1,65 @@ +/* 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. + * + */ + +#ifndef TITANIC_TT_CONCEPT_NODE_H +#define TITANIC_TT_CONCEPT_NODE_H + +#include "titanic/true_talk/tt_concept.h" + +namespace Titanic { + +class TTconceptNode { +public: + TTconcept *_concept0P; + TTconcept *_concept1P; + TTconcept *_concept2P; + TTconcept *_concept3P; + TTconcept *_concept4P; + TTconcept *_concept5P; + int _field18; + int _field1C; + TTconceptNode *_nextP; + int _status; +public: + TTconceptNode(); + TTconceptNode(const TTconceptNode &src); + + /** + * Delete any sibling chain attached to this node + */ + void deleteSiblings(); + + void set18(int val) { _field18 = val; } + int get18() const { return _field18; } + + /** + * Returns true if the node is valid + */ + bool isValid() const { return _status == SS_VALID; } + + TTconcept **setConcept(int conceptIndex, TTconcept *src); + int changeConcept(int mode, TTconcept **conceptPP, int conceptIndex); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_CONCEPT_NODE_H */ diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 02ecf0aedd..d02aec931a 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -30,7 +30,7 @@ namespace Titanic { -TTparser::TTparser(CScriptHandler *owner) : _owner(owner), _sentenceSub(nullptr), +TTparser::TTparser(CScriptHandler *owner) : _owner(owner), _sentenceConcept(nullptr), _sentence(nullptr), _fieldC(0), _field10(0), _field14(0), _currentWordP(nullptr), _nodesP(nullptr), _conceptP(nullptr) { loadArrays(); @@ -476,7 +476,7 @@ const NumberEntry *TTparser::replaceNumbers2(TTstring &line, int *startIndex) { int TTparser::findFrames(TTsentence *sentence) { static bool flag; - _sentenceSub = &sentence->_sub; + _sentenceConcept = &sentence->_sentenceConcept; _sentence = sentence; TTstring *line = sentence->_normalizedLine.copy(); @@ -573,10 +573,10 @@ int TTparser::loadRequests(TTword *word) { break; } - if (_sentenceSub) { - if (_sentenceSub->get18() == 0 || _sentenceSub->get18() == 2) { + if (_sentenceConcept) { + if (_sentenceConcept->get18() == 0 || _sentenceConcept->get18() == 2) { TTaction *action = static_cast(word); - _sentenceSub->set18(action->getVal()); + _sentenceConcept->set18(action->getVal()); } } break; @@ -621,8 +621,8 @@ int TTparser::loadRequests(TTword *word) { case WC_CONJUNCTION: if (_sentence->check2C()) { - _sentenceSub->_field1C = 1; - _sentenceSub = _sentenceSub->addSibling(); + _sentenceConcept->_field1C = 1; + _sentenceConcept = _sentenceConcept->addSibling(); delete this; } else { addNode(23); @@ -675,8 +675,8 @@ int TTparser::loadRequests(TTword *word) { case 902: case 904: if (_sentence->_field2C == 9) { - _sentenceSub->_field1C = 1; - _sentenceSub = _sentenceSub->addSibling(); + _sentenceConcept->_field1C = 1; + _sentenceConcept = _sentenceConcept->addSibling(); addNode(1); } else { @@ -765,11 +765,11 @@ int TTparser::considerRequests(TTword *word) { } else { switch (nodeP->_tag) { case CHECK_COMMAND_FORM: - if (_sentenceSub->_concept1P && _sentence->_field2C == 1 && - !_sentenceSub->_concept0P) { + if (_sentenceConcept->_concept1P && _sentence->_field2C == 1 && + !_sentenceConcept->_concept0P) { concept = new TTconcept(_sentence->_npcScript, ST_NPC_SCRIPT); - _sentenceSub->_concept0P = concept; - _sentenceSub->_field18 = 3; + _sentenceConcept->_concept0P = concept; + _sentenceConcept->_field18 = 3; } flag = true; @@ -786,7 +786,7 @@ int TTparser::considerRequests(TTword *word) { break; case OBJECT_IS_TO: - flag = fn3(&_sentenceSub->_concept2P, 3); + flag = fn3(&_sentenceConcept->_concept2P, 3); break; case SEEK_ACTOR: diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index a8bb906559..3e8c91c917 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -164,7 +164,7 @@ private: bool fn3(TTconcept **v, int v2); public: CScriptHandler *_owner; - TTsentenceSub *_sentenceSub; + TTsentenceConcept *_sentenceConcept; TTsentence *_sentence; int _fieldC; int _field10; diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index 7b49df2560..a78a4efa0e 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -27,99 +27,12 @@ namespace Titanic { -TTsentenceSubBase::TTsentenceSubBase() : _concept0P(nullptr), - _concept1P(nullptr), _concept2P(nullptr), _concept3P(nullptr), - _concept4P(nullptr), _concept5P(nullptr), _field18(0), - _field1C(0), _nextP(nullptr), _field24(0) { -} - -void TTsentenceSubBase::deleteSiblings() { - // Iterate through the linked chain of nodes, deleting each in turn - for (TTsentenceSubBase *curP = _nextP, *nextP = nullptr; nextP; curP = nextP) { - nextP = curP->_nextP; - delete curP; - } - - _nextP = nullptr; -} - -TTconcept **TTsentenceSubBase::setConcept(int conceptIndex, TTconcept *src) { - TTconcept **conceptPP = nullptr; - switch (conceptIndex) { - case 1: - conceptPP = &_concept1P; - break; - case 2: - conceptPP = &_concept2P; - break; - case 3: - conceptPP = &_concept3P; - break; - case 4: - conceptPP = &_concept4P; - break; - case 5: - conceptPP = &_concept5P; - break; - default: - break; - } - - bool isPronoun = false; - StringArray &pronouns = g_vm->_scriptHandler->_parser._pronouns; - for (uint idx = 0; idx < pronouns.size() && !isPronoun; ++idx) { - isPronoun = pronouns[idx] == src->getText(); - } - - CScriptHandler &scrHandler = *g_vm->_exeResources._owner; - if (!isPronoun) { - switch (conceptIndex) { - case 0: - delete scrHandler._concept2P; - scrHandler._concept2P = new TTconcept(*src); - break; - - case 1: - delete scrHandler._concept4P; - scrHandler._concept4P = new TTconcept(*src); - break; - - case 2: - delete scrHandler._concept1P; - scrHandler._concept1P = new TTconcept(*src); - break; - - default: - break; - } - } - - return conceptPP; -} - -int TTsentenceSubBase::changeConcept(int mode, TTconcept **conceptPP, int conceptIndex) { - TTconcept **newConceptPP = setConcept(conceptIndex, *conceptPP); - - if (mode == 0 || (mode == 1 && !*newConceptPP)) { - if (!*conceptPP) - return SS_5; - - delete *newConceptPP; - *newConceptPP = new TTconcept(**conceptPP); - return SS_VALID; - } else { - return SS_1; - } -} - -/*------------------------------------------------------------------------*/ - -TTsentenceSub *TTsentenceSub::addSibling() { +TTsentenceConcept *TTsentenceConcept::addSibling() { if (this == nullptr || _nextP != nullptr) // This should never happen return nullptr; - TTsentenceSub *nextP = new TTsentenceSub(); + TTsentenceConcept *nextP = new TTsentenceConcept(); _nextP = nextP; return nextP; } @@ -134,13 +47,13 @@ TTsentence::TTsentence(int inputCtr, const TTstring &line, CScriptHandler *owner _status = _initialLine.isValid() && _normalizedLine.isValid() ? SS_11: SS_VALID; } -TTsentence::TTsentence(const TTsentence *src) : _initialLine(src->_initialLine), - _normalizedLine(src->_normalizedLine) { +TTsentence::TTsentence(const TTsentence *src) : _sentenceConcept(src->_sentenceConcept), + _initialLine(src->_initialLine), _normalizedLine(src->_normalizedLine) { copyFrom(*src); } TTsentence::~TTsentence() { - _sub.deleteSiblings(); + _sentenceConcept.deleteSiblings(); if (_nodesP) { _nodesP->deleteSiblings(); diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index e995884ec0..6cee9705c4 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -23,6 +23,7 @@ #ifndef TITANIC_TT_SENTENCE_H #define TITANIC_TT_SENTENCE_H +#include "titanic/true_talk/tt_concept_node.h" #include "titanic/true_talk/tt_npc_script.h" #include "titanic/true_talk/tt_room_script.h" #include "titanic/true_talk/tt_sentence_node.h" @@ -31,45 +32,17 @@ namespace Titanic { class CScriptHandler; -class TTconcept; class TTword; -class TTsentenceSubBase { +class TTsentenceConcept : public TTconceptNode { public: - TTconcept *_concept0P; - TTconcept *_concept1P; - TTconcept *_concept2P; - TTconcept *_concept3P; - TTconcept *_concept4P; - TTconcept *_concept5P; - int _field18; - int _field1C; - TTsentenceSubBase *_nextP; - int _field24; -public: - TTsentenceSubBase(); - - /** - * Delete any sibling chain attached to this node - */ - void deleteSiblings(); - - void set18(int val) { _field18 = val; } - int get18() const { return _field18; } - bool is24() const { return _field24 == 0; } - - TTconcept **setConcept(int conceptIndex, TTconcept *src); - int changeConcept(int mode, TTconcept **conceptPP, int conceptIndex); -}; - -class TTsentenceSub : public TTsentenceSubBase { -public: - TTsentenceSub() : TTsentenceSubBase() {} + TTsentenceConcept() : TTconceptNode() {} + TTsentenceConcept(const TTsentenceConcept &src) : TTconceptNode(src) {} /** * Adds a new sibling instance */ - TTsentenceSub *addSibling(); + TTsentenceConcept *addSibling(); }; class TTsentence { @@ -87,7 +60,7 @@ private: */ void copyFrom(const TTsentence &src); public: - TTsentenceSub _sub; + TTsentenceConcept _sentenceConcept; TTstring _initialLine; TTstring _normalizedLine; int _field58; -- cgit v1.2.3 From 06b9131a6cd5f009147368746b9354378d9d5d18 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 24 May 2016 13:35:57 -0400 Subject: TITANIC: Added TTconcept copy constructor --- engines/titanic/true_talk/tt_concept.h | 5 +++++ engines/titanic/true_talk/tt_concept_node.cpp | 26 +++++++++++++++++--------- engines/titanic/true_talk/tt_concept_node.h | 13 +++++++------ 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index 112d864e19..8168d4ebe1 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -113,6 +113,11 @@ public: */ int getStatus() const { return _status; } + /** + * True true if the concept is valid + */ + bool isValid() const { return _status == SS_VALID; } + void setFlag(bool val) { _flag = val; } void set1C(int val) { _field1C = val; } diff --git a/engines/titanic/true_talk/tt_concept_node.cpp b/engines/titanic/true_talk/tt_concept_node.cpp index 9ad985746f..aca5718bca 100644 --- a/engines/titanic/true_talk/tt_concept_node.cpp +++ b/engines/titanic/true_talk/tt_concept_node.cpp @@ -26,20 +26,28 @@ namespace Titanic { -TTconceptNode::TTconceptNode() : _concept0P(nullptr), - _concept1P(nullptr), _concept2P(nullptr), _concept3P(nullptr), - _concept4P(nullptr), _concept5P(nullptr), _field18(0), - _field1C(0), _nextP(nullptr), _status(0) { +TTconceptNode::TTconceptNode() : _concept0P(_concepts[0]), _concept1P(_concepts[1]), + _concept2P(_concepts[2]), _concept3P(_concepts[3]), _concept4P(_concepts[4]), + _concept5P(_concepts[5]), _field18(0), _field1C(0), _nextP(nullptr), _status(0) { } -TTconceptNode::TTconceptNode(const TTconceptNode &src) : _concept0P(nullptr), - _concept1P(nullptr), _concept2P(nullptr), _concept3P(nullptr), - _concept4P(nullptr), _concept5P(nullptr), _field18(0), - _field1C(0), _nextP(nullptr), _status(0) { +TTconceptNode::TTconceptNode(const TTconceptNode &src) : _concept0P(_concepts[0]), _concept1P(_concepts[1]), + _concept2P(_concepts[2]), _concept3P(_concepts[3]), _concept4P(_concepts[4]), + _concept5P(_concepts[5]), _field18(0), _field1C(0), _nextP(nullptr), _status(0) { if (src._status) { _status = SS_5; } else { - // TODO + for (int idx = 0; idx < 6; ++idx) { + if (src._concepts[idx]) { + _concepts[idx] = new TTconcept(*src._concepts[idx]); + if (!_concepts[idx]->isValid()) + _status = SS_11; + } + } + + _field18 = src._field18; + _field1C = src._field1C; + _nextP = src._nextP; } } diff --git a/engines/titanic/true_talk/tt_concept_node.h b/engines/titanic/true_talk/tt_concept_node.h index 8fc1371f7b..af2fd42e7b 100644 --- a/engines/titanic/true_talk/tt_concept_node.h +++ b/engines/titanic/true_talk/tt_concept_node.h @@ -29,12 +29,13 @@ namespace Titanic { class TTconceptNode { public: - TTconcept *_concept0P; - TTconcept *_concept1P; - TTconcept *_concept2P; - TTconcept *_concept3P; - TTconcept *_concept4P; - TTconcept *_concept5P; + TTconcept *_concepts[6]; + TTconcept *&_concept0P; + TTconcept *&_concept1P; + TTconcept *&_concept2P; + TTconcept *&_concept3P; + TTconcept *&_concept4P; + TTconcept *&_concept5P; int _field18; int _field1C; TTconceptNode *_nextP; -- cgit v1.2.3 From 483929e70a74f86b250e8934a3880919e9bf3a02 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 24 May 2016 19:55:59 -0400 Subject: TITANIC: Added various TTparser & TTconcept support methods --- engines/titanic/true_talk/tt_concept.cpp | 5 +++ engines/titanic/true_talk/tt_concept.h | 8 ++++ engines/titanic/true_talk/tt_concept_node.cpp | 1 - engines/titanic/true_talk/tt_parser.cpp | 57 +++++++++++++++++++++++++++ engines/titanic/true_talk/tt_parser.h | 8 +++- 5 files changed, 77 insertions(+), 2 deletions(-) diff --git a/engines/titanic/true_talk/tt_concept.cpp b/engines/titanic/true_talk/tt_concept.cpp index 05e6401018..2c54f2fab6 100644 --- a/engines/titanic/true_talk/tt_concept.cpp +++ b/engines/titanic/true_talk/tt_concept.cpp @@ -242,6 +242,11 @@ bool TTconcept::checkWordId2() const { return (_wordP && _wordP->_id == 204) || (_scriptP && _scriptP->getId() == 3); } +bool TTconcept::checkWordId3() const { + return isWordClass(WC_ABSTRACT) || isWordClass(WC_ADJECTIVE) || + (isWordClass(WC_ADVERB) && getWordId() != 910); +} + bool TTconcept::checkWordClass() const { return !_scriptP && _wordP && (_wordP->_wordClass == WC_THING || _wordP->_wordClass == WC_PRONOUN); } diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index 8168d4ebe1..98a6ee6ea3 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -118,12 +118,20 @@ public: */ bool isValid() const { return _status == SS_VALID; } + /** + * Returns true if the word is of the specified class + */ + bool isWordClass(WordClass wordClass) const { + return _wordP && _wordP->isClass(wordClass); + } + void setFlag(bool val) { _flag = val; } void set1C(int val) { _field1C = val; } bool checkWordId1() const; bool checkWordId2() const; + bool checkWordId3() const; bool checkWordClass() const; /** diff --git a/engines/titanic/true_talk/tt_concept_node.cpp b/engines/titanic/true_talk/tt_concept_node.cpp index aca5718bca..956d87bb68 100644 --- a/engines/titanic/true_talk/tt_concept_node.cpp +++ b/engines/titanic/true_talk/tt_concept_node.cpp @@ -51,7 +51,6 @@ TTconceptNode::TTconceptNode(const TTconceptNode &src) : _concept0P(_concepts[0] } } - void TTconceptNode::deleteSiblings() { // Iterate through the linked chain of nodes, deleting each in turn for (TTconceptNode *curP = _nextP, *nextP = nullptr; nextP; curP = nextP) { diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index d02aec931a..7b9f4c4c1c 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -790,7 +790,13 @@ int TTparser::considerRequests(TTword *word) { break; case SEEK_ACTOR: + if (_sentenceConcept->_concept0P) { + } + else { + + } + break; case SEEK_OBJECT: case SEEK_OBJECT_OVERRIDE: @@ -854,6 +860,30 @@ int TTparser::addConcept(TTconcept *concept) { return SS_VALID; } +void TTparser::removeConcept(TTconcept *concept) { + // If no concept passed, exit immediately + if (!concept) + return; + + if (_conceptP == concept) { + // Concept specified is the ver ystart of the linked list, so reset head pointer + _conceptP = _conceptP->_nextP; + } else { + // Scan through the linked list, looking for the specific concept + for (TTconcept *currP = _conceptP; currP; currP = currP->_nextP) { + if (currP->_nextP == concept) { + // Found match, so unlink the next link from the chain + currP->_nextP = currP->_nextP->_nextP; + break; + } + } + } + + // FInally, delete the concept + concept->_nextP = nullptr; + delete concept; +} + int TTparser::fn1() { // TODO return 0; @@ -917,4 +947,31 @@ void TTparser::conceptChanged(TTconcept *newConcept, TTconcept *oldConcept) { _currentConceptP = newConcept; } +bool TTparser::checkConcept2(TTconcept *concept, int conceptMode) { + switch (conceptMode) { + case 3: + return concept->checkWordId2(); + + case 5: + return concept->checkWordClass(); + + case 8: + return concept->checkWordId1(); + + case 9: + if (!concept->checkWordId3() && _sentenceConcept->_concept2P) { + if (!_sentenceConcept->_concept2P->checkWordId2() || !concept->checkWordId2()) { + return _sentenceConcept->_concept2P->checkWordClass() && + concept->checkWordClass(); + } + } + break; + + default: + break; + } + + return false; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index 3e8c91c917..512acbec89 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -147,7 +147,6 @@ private: int processRequests(TTword *word); void addToConceptList(TTword *word); - int fn2(TTword *word); int checkReferent(TTpronoun *pronoun); /** @@ -160,8 +159,15 @@ private: */ int addConcept(TTconcept *concept); + /** + * Detaches a concept from the main concept list if prseent, then deletes it + */ + void removeConcept(TTconcept *concept); + int fn1(); + int fn2(TTword *word); bool fn3(TTconcept **v, int v2); + bool checkConcept2(TTconcept *concept, int conceptMode); public: CScriptHandler *_owner; TTsentenceConcept *_sentenceConcept; -- cgit v1.2.3 From 5576060aefbea46c8f3214005e8c791776c03b27 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 24 May 2016 20:34:10 -0400 Subject: TITANIC: Added TTparser filterConcepts --- engines/titanic/true_talk/tt_parser.cpp | 22 ++++++++++++++++++++++ engines/titanic/true_talk/tt_parser.h | 1 + 2 files changed, 23 insertions(+) diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 7b9f4c4c1c..013e5f1433 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -974,4 +974,26 @@ bool TTparser::checkConcept2(TTconcept *concept, int conceptMode) { return false; } +int TTparser::filterConcepts(int conceptMode, int conceptIndex) { + int result = 0; + + for (TTconcept *currP = _conceptP; currP && !result; currP = currP->_nextP) { + if (checkConcept2(currP, conceptMode)) { + TTconcept **ptrPP = _sentenceConcept->setConcept(conceptIndex, currP); + TTconcept *newConcept = new TTconcept(*currP); + *ptrPP = newConcept; + + if (newConcept->isValid()) { + removeConcept(currP); + (*ptrPP)->_nextP = nullptr; + result = 1; + } else { + result = -2; + } + } + } + + return result; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index 512acbec89..d7e67b2d51 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -168,6 +168,7 @@ private: int fn2(TTword *word); bool fn3(TTconcept **v, int v2); bool checkConcept2(TTconcept *concept, int conceptMode); + int filterConcepts(int conceptMode, int conceptIndex); public: CScriptHandler *_owner; TTsentenceConcept *_sentenceConcept; -- cgit v1.2.3 From 27417fa78d39e983b8a73947ddb476679d9ca953 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 24 May 2016 21:15:32 -0400 Subject: TITANIC: Added TTparser resetConcept --- engines/titanic/true_talk/tt_parser.cpp | 24 ++++++++++++++++++------ engines/titanic/true_talk/tt_parser.h | 2 +- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 013e5f1433..dd3389337a 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -786,7 +786,7 @@ int TTparser::considerRequests(TTword *word) { break; case OBJECT_IS_TO: - flag = fn3(&_sentenceConcept->_concept2P, 3); + flag = resetConcept(&_sentenceConcept->_concept2P, 3); break; case SEEK_ACTOR: @@ -814,7 +814,11 @@ int TTparser::considerRequests(TTword *word) { case SET_COLOR: case ACTOR_IS_TO: case ACTOR_IS_FROM: + case ACTOR_IS_OBJECT: + flag = resetConcept(&_sentenceConcept->_concept0P, 2); + break; + case STATE_IDENTITY: case WORD_TYPE_IS_SENTENCE_TYPE: case COMPLEX_VERB: @@ -911,11 +915,6 @@ int TTparser::fn2(TTword *word) { } } -bool TTparser::fn3(TTconcept **v, int v2) { - // TODO - return false; -} - int TTparser::checkReferent(TTpronoun *pronoun) { TTconcept *concept; @@ -996,4 +995,17 @@ int TTparser::filterConcepts(int conceptMode, int conceptIndex) { return result; } +bool TTparser::resetConcept(TTconcept **conceptPP, int conceptIndex) { + TTconcept **ptrPP = _sentenceConcept->setConcept(conceptIndex, nullptr); + + if (!*ptrPP) + return 0; + + int result = _sentenceConcept->changeConcept(1, conceptPP, conceptIndex); + if (*conceptPP) + _sentenceConcept->setConcept(conceptIndex, *conceptPP); + + return !result; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index d7e67b2d51..c8432c2fe9 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -166,9 +166,9 @@ private: int fn1(); int fn2(TTword *word); - bool fn3(TTconcept **v, int v2); bool checkConcept2(TTconcept *concept, int conceptMode); int filterConcepts(int conceptMode, int conceptIndex); + bool resetConcept(TTconcept **conceptPP, int conceptIndex); public: CScriptHandler *_owner; TTsentenceConcept *_sentenceConcept; -- cgit v1.2.3 From 986ab4b0d18e708fb74b9228bb7b21fd3695035d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 25 May 2016 21:00:36 -0400 Subject: TITANIC: Added TTsentence fn2 method --- engines/titanic/true_talk/tt_concept.h | 2 +- engines/titanic/true_talk/tt_concept_node.cpp | 18 +++++ engines/titanic/true_talk/tt_concept_node.h | 5 ++ engines/titanic/true_talk/tt_parser.cpp | 4 +- engines/titanic/true_talk/tt_parser.h | 2 +- engines/titanic/true_talk/tt_sentence.cpp | 111 ++++++++++++++++++++++++++ engines/titanic/true_talk/tt_sentence.h | 9 +++ engines/titanic/true_talk/tt_string.cpp | 4 +- engines/titanic/true_talk/tt_string.h | 4 +- 9 files changed, 151 insertions(+), 8 deletions(-) diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index 98a6ee6ea3..7fc56e7345 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -39,7 +39,6 @@ private: TTword *_wordP; TTstring _string1; int _field14; - ScriptType _scriptType; int _field1C; int _field20; TTstring _string2; @@ -75,6 +74,7 @@ private: void initialize(TTconcept &src); public: TTconcept *_nextP; + ScriptType _scriptType; public: TTconcept(); TTconcept(TTscriptBase *script, ScriptType scriptType); diff --git a/engines/titanic/true_talk/tt_concept_node.cpp b/engines/titanic/true_talk/tt_concept_node.cpp index 956d87bb68..a98200bce3 100644 --- a/engines/titanic/true_talk/tt_concept_node.cpp +++ b/engines/titanic/true_talk/tt_concept_node.cpp @@ -115,6 +115,24 @@ TTconcept **TTconceptNode::setConcept(int conceptIndex, TTconcept *src) { return conceptPP; } +int TTconceptNode::replaceConcept(int mode, int conceptIndex, TTconcept *concept) { + TTconcept **conceptPP = setConcept(conceptIndex, concept); + + if (mode == 0 || (mode == 1 && !*conceptPP)) { + if (!concept || !concept->isValid()) + return SS_5; + + if (mode == 0 && *conceptPP) { + delete *conceptPP; + } + + *conceptPP = new TTconcept(*concept); + return (*conceptPP)->isValid() ? SS_VALID : SS_11; + } else { + return SS_1; + } +} + int TTconceptNode::changeConcept(int mode, TTconcept **conceptPP, int conceptIndex) { TTconcept **newConceptPP = setConcept(conceptIndex, *conceptPP); diff --git a/engines/titanic/true_talk/tt_concept_node.h b/engines/titanic/true_talk/tt_concept_node.h index af2fd42e7b..5e49e37abe 100644 --- a/engines/titanic/true_talk/tt_concept_node.h +++ b/engines/titanic/true_talk/tt_concept_node.h @@ -58,7 +58,12 @@ public: bool isValid() const { return _status == SS_VALID; } TTconcept **setConcept(int conceptIndex, TTconcept *src); + int replaceConcept(int mode, int conceptIndex, TTconcept *concept); int changeConcept(int mode, TTconcept **conceptPP, int conceptIndex); + + int concept1WordId() const { + return _concept1P ? _concept1P->getWordId() : 0; + } }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index dd3389337a..c8bee25351 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -504,7 +504,7 @@ int TTparser::findFrames(TTsentence *sentence) { } if (!status) { - status = fn1(); + status = checkForAction(); } delete line; @@ -888,7 +888,7 @@ void TTparser::removeConcept(TTconcept *concept) { delete concept; } -int TTparser::fn1() { +int TTparser::checkForAction() { // TODO return 0; } diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index c8432c2fe9..5d431114ec 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -164,7 +164,7 @@ private: */ void removeConcept(TTconcept *concept); - int fn1(); + int checkForAction(); int fn2(TTword *word); bool checkConcept2(TTconcept *concept, int conceptMode); int filterConcepts(int conceptMode, int conceptIndex); diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index a78a4efa0e..d269f41b0c 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -107,4 +107,115 @@ int TTsentence::storeVocabHit(TTword *word) { return 0; } +bool TTsentence::fn2(int conceptIndex, const TTstring &str, TTconceptNode *conceptNode) { + if (!conceptNode) + conceptNode = &_sentenceConcept; + TTconcept *concept = getFrameSlot(conceptIndex, conceptNode); + + if (!concept) + return str == "isEmpty"; + + bool abortFlag = false; + switch (concept->_scriptType) { + case 1: + if (str == "thePlayer") + abortFlag = 1; + break; + + case 2: + if (str == "targetNpc") + abortFlag = 1; + break; + + case 3: + if (str == "otherNpc") + abortFlag = 1; + break; + + default: + break; + } + + TTstring conceptText = concept->getText(); + if (abortFlag || str == conceptText || concept->compareTo(str)) { + delete concept; + return true; + } + + if (conceptIndex == 1 && g_vm->_exeResources._owner->_concept4P) { + if (str == g_vm->_exeResources._owner->_concept4P->getText() && + conceptText == "do") + goto exit; + } + + if (g_vm->_exeResources._owner->_concept2P && (conceptIndex == 0 || + conceptIndex == 3 || conceptIndex == 4)) { + if (str == g_vm->_exeResources._owner->_concept2P->getText() && + (conceptText == "it" || conceptText == "he" || conceptText == "she" || + conceptText == "him" || conceptText == "her" || conceptText == "them" || + conceptText == "they")) + goto exit; + } + + if (g_vm->_exeResources._owner->_concept1P && (conceptIndex == 0 || + conceptIndex == 2 || conceptIndex == 3 || conceptIndex == 4 || conceptIndex == 5)) { + if (str == g_vm->_exeResources._owner->_concept2P->getText() && + (conceptText == "it" || conceptText == "that" || conceptText == "he" || + conceptText == "she" || conceptText == "him" || conceptText == "her" || + conceptText == "them" || conceptText == "they" || conceptText == "those" || + conceptText == "1" || conceptText == "thing")) + goto exit; + } + + if (g_vm->_exeResources._owner->_concept1P && (conceptIndex == 0 || conceptIndex == 2)) { + if (conceptText == "?" && str == g_vm->_exeResources._owner->_concept2P->getText()) { + delete concept; + concept = getFrameSlot(5, conceptNode); + conceptText = concept->getText(); + + if (conceptText == "it" || conceptText == "that" || conceptText == "he" || + conceptText == "she" || conceptText == "him" || conceptText == "her" || + conceptText == "them" || conceptText == "they" || conceptText == "those" || + conceptText == "1" || conceptText == "thing") + abortFlag = true; + } + } + +exit: + delete concept; + return abortFlag; +} + +bool TTsentence::fn4(int mode, int wordId, TTconcept *concept) { + if (!concept) + return false; + + switch (mode) { + case 1: + return _sentenceConcept._concept1P && _sentenceConcept._concept1P->getWordId() == wordId; + + case 5: + return _sentenceConcept._concept5P && _sentenceConcept._concept5P->getWordId() == wordId; + + default: + return false; + } +} + +TTconcept *TTsentence::getFrameSlot(int conceptIndex, TTconceptNode *conceptNode) { + TTconcept *newConcept = new TTconcept(); + + if (!conceptNode) + conceptNode = &_sentenceConcept; + TTconcept *concept = conceptNode->_concepts[conceptIndex]; + newConcept->copyFrom(concept); + + if (!newConcept->isValid()) { + delete newConcept; + newConcept = nullptr; + } + + return newConcept; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index 6cee9705c4..00f31b4f31 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -76,15 +76,24 @@ public: void set34(int v) { _field34 = v; } void set38(int v) { _field38 = v; } bool check2C() const { return _field2C > 1 && _field2C <= 10; } + int concept18(TTconceptNode *conceptNode) { + return conceptNode ? conceptNode->get18() : 0; + } + int get58() const { return _field58; } int getStatus() const { return _status; } + TTconcept *getFrameSlot(int conceptIndex, TTconceptNode *conceptNode); + /** * Adds a found vocab word to the list of words representing * the player's input * @param word Word to node */ int storeVocabHit(TTword *word); + + bool fn2(int conceptIndex, const TTstring &str, TTconceptNode *conceptNode); + bool fn4(int mode, int wordId, TTconcept *concept); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_string.cpp b/engines/titanic/true_talk/tt_string.cpp index 1491937bd5..589141303b 100644 --- a/engines/titanic/true_talk/tt_string.cpp +++ b/engines/titanic/true_talk/tt_string.cpp @@ -95,11 +95,11 @@ TTstring &TTstring::operator+=(char c) { return *this; } -bool TTstring::operator==(const TTstring &str) { +bool TTstring::operator==(const TTstring &str) const { return _data && str._data && _data->_string == str._data->_string; } -bool TTstring::operator==(const char *str) { +bool TTstring::operator==(const char *str) const { return _data && _data->_string == str; } diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index 060a48f5b6..b6ec859794 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -57,8 +57,8 @@ public: TTstring &operator+=(const char *str); TTstring &operator+=(const TTstring &str); TTstring &operator+=(char c); - bool operator==(const TTstring &str); - bool operator==(const char *str); + bool operator==(const TTstring &str) const; + bool operator==(const char *str) const; const char &operator[](int index) { return *(c_str() + index); -- cgit v1.2.3 From 1992afe4aa5ff8b02d38a0038fc390b6280ab358 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 25 May 2016 22:23:42 -0400 Subject: TITANIC: Added TTconceptNode createConcept --- engines/titanic/true_talk/tt_concept_node.cpp | 14 +++++++++++++ engines/titanic/true_talk/tt_concept_node.h | 4 ++++ engines/titanic/true_talk/tt_parser.cpp | 30 +++++++++++++++++++++++++-- engines/titanic/true_talk/tt_sentence.cpp | 12 +++++++++++ engines/titanic/true_talk/tt_sentence.h | 2 ++ 5 files changed, 60 insertions(+), 2 deletions(-) diff --git a/engines/titanic/true_talk/tt_concept_node.cpp b/engines/titanic/true_talk/tt_concept_node.cpp index a98200bce3..454ca59971 100644 --- a/engines/titanic/true_talk/tt_concept_node.cpp +++ b/engines/titanic/true_talk/tt_concept_node.cpp @@ -148,4 +148,18 @@ int TTconceptNode::changeConcept(int mode, TTconcept **conceptPP, int conceptInd } } +bool TTconceptNode::createConcept(int mode, int conceptIndex, TTword *word) { + TTconcept *newConcept = new TTconcept(word, ST_UNKNOWN_SCRIPT); + TTconcept **conceptPP = setConcept(conceptIndex, newConcept); + + if (mode == 0 || (mode == 1 && !*conceptPP)) { + delete *conceptPP; + *conceptPP = newConcept; + return false; + } else { + delete newConcept; + return true; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_concept_node.h b/engines/titanic/true_talk/tt_concept_node.h index 5e49e37abe..9a1c3a9912 100644 --- a/engines/titanic/true_talk/tt_concept_node.h +++ b/engines/titanic/true_talk/tt_concept_node.h @@ -60,10 +60,14 @@ public: TTconcept **setConcept(int conceptIndex, TTconcept *src); int replaceConcept(int mode, int conceptIndex, TTconcept *concept); int changeConcept(int mode, TTconcept **conceptPP, int conceptIndex); + bool createConcept(int mode, int conceptIndex, TTword *word); int concept1WordId() const { return _concept1P ? _concept1P->getWordId() : 0; } + int concept5WordId() const { + return _concept5P ? _concept5P->getWordId() : 0; + } }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index c8bee25351..3741ab7e5f 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -791,9 +791,14 @@ int TTparser::considerRequests(TTword *word) { case SEEK_ACTOR: if (_sentenceConcept->_concept0P) { + if (_sentenceConcept->_concept0P->compareTo("?") && + _sentenceConcept->_concept1P->isWordId(113) && + word->_wordClass == WC_THING) { + // TODO + } - } - else { + + } else { } break; @@ -804,12 +809,33 @@ int TTparser::considerRequests(TTword *word) { case SEEK_FROM: case SEEK_TO_OVERRIDE: case SEEK_FROM_OVERRIDE: + if (_sentenceConcept->_concept4P) { + delete _sentenceConcept->_concept4P; + _sentenceConcept->_concept4P = nullptr; + } + + addNode(8); + flag = true; + break; + case SEEK_LOCATION: case SEEK_OWNERSHIP: case SEEK_STATE: case SEEK_MODIFIERS: case SEEK_NEW_FRAME: case SEEK_STATE_OBJECT: + if (!_sentenceConcept->_concept5P) { + addToConceptList(word); + } else if (_sentenceConcept->concept5WordId() == 113 || + _sentenceConcept->concept5WordId() == 112) { + _sentenceConcept->createConcept(1, 2, word); + } else { + addToConceptList(word); + } + + flag = true; + break; + case SET_ACTION: case SET_COLOR: case ACTOR_IS_TO: diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index d269f41b0c..06ddb6b299 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -218,4 +218,16 @@ TTconcept *TTsentence::getFrameSlot(int conceptIndex, TTconceptNode *conceptNode return newConcept; } +int TTsentence::is18(int val, const TTconceptNode *node) const { + if (!node) + node = &_sentenceConcept; + return node->_field18 == val; +} + +int TTsentence::is1C(int val, const TTconceptNode *node) const { + if (!node) + node = &_sentenceConcept; + return node->_field1C == val; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index 00f31b4f31..83416cbd49 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -80,6 +80,8 @@ public: return conceptNode ? conceptNode->get18() : 0; } int get58() const { return _field58; } + int is18(int val, const TTconceptNode *node) const; + int is1C(int val, const TTconceptNode *node) const; int getStatus() const { return _status; } -- cgit v1.2.3 From f98ad3313499c8c6375f3216f5ae6ddb8faa3271 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 26 May 2016 20:37:11 -0400 Subject: TITANIC: In-progress TTparser checkForAction --- engines/titanic/true_talk/tt_parser.cpp | 82 ++++++++++++++++++++++++++++++++- engines/titanic/true_talk/tt_string.h | 2 +- engines/titanic/true_talk/tt_vocab.cpp | 4 +- engines/titanic/true_talk/tt_word.cpp | 8 ++-- engines/titanic/true_talk/tt_word.h | 11 +++-- 5 files changed, 96 insertions(+), 11 deletions(-) diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 3741ab7e5f..a0eb6a5e9a 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -915,8 +915,88 @@ void TTparser::removeConcept(TTconcept *concept) { } int TTparser::checkForAction() { + int status = SS_VALID; + bool flag = false; + bool actionFlag = false; + + if (_conceptP && _currentWordP) { + // Firstly we need to get the next word to process, and remove it from + // the list pointed to by _currentWordP + TTword *word = _currentWordP; + if (word->_nextP) { + // Chain of words, so we need to find the last word of the chain, + // and set the last-but-one's _nextP to nullptr to detach the last one + TTword *prior = nullptr; + for (word = word->_nextP; word->_nextP; word = word->_nextP) { + prior = word; + } + + if (prior) + prior->_nextP = nullptr; + } else { + // No chain, so singular word can simply be removed + _currentWordP = nullptr; + if (word->_id == 906 && _sentence->_field2C == 1) + _sentence->_field2C = 12; + } + + if (word->_text == "do" || word->_text == "doing" || word->_text == "does" || + word->_text == "done") { + TTstring doStr("do"); + TTaction *action = new TTaction(doStr, WC_ACTION, 112, 0, _sentenceConcept->get18()); + + if (!action->isValid()) { + status = SS_4; + } else { + // Have the new action replace the old word instance + delete word; + word = action; + actionFlag = true; + } + } + + addToConceptList(word); + delete word; + flag = true; + } + + // Handle any remaining words + TTword *reqWord = nullptr; + while (_currentWordP) { + if (considerRequests(_currentWordP) > 1) { + reqWord = _currentWordP; + } else { + // Delete the top of the word chain + TTword *wordP = _currentWordP; + _currentWordP = _currentWordP->_nextP; + delete wordP; + } + } + + if (flag && _conceptP) { + if (actionFlag && (!_sentenceConcept->_concept1P || _sentenceConcept->_concept1P->isWordId(113))) { + _sentenceConcept->replaceConcept(0, 1, _conceptP); + } else if (!_sentenceConcept->_concept5P) { + _sentenceConcept->replaceConcept(1, 5, _conceptP); + } else if (_sentenceConcept->_concept5P->isWordId(904)) { + _sentenceConcept->replaceConcept(0, 5, _conceptP); + } + + removeConcept(_conceptP); + } + + if (_sentence->fn2(3, TTstring("thePlayer"), _sentenceConcept) && !flag) { + if (_sentenceConcept->concept1WordId() == 101) { + _sentence->_field2C = 16; + } else if (_sentence->_field2C != 18 && _sentenceConcept->concept1WordId() == 102) { + if (_sentence->fn2(0, TTstring("targetNpc"), _sentenceConcept)) + _sentence->_field2C = 15; + } + } + + // TODO - return 0; + return status; } int TTparser::fn2(TTword *word) { diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index b6ec859794..3e8718df2a 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -38,7 +38,7 @@ struct TTstringData { TTstringData(const CString &str) : _string(str), _referenceCount(1) {} }; -enum TTstringStatus { SS_VALID = 0, SS_1 = 1, SS_5 = 5, SS_7 = 7, SS_8 = 8, SS_11 = 11, SS_13 = 13 }; +enum TTstringStatus { SS_VALID = 0, SS_1 = 1, SS_4 = 4, SS_5 = 5, SS_7 = 7, SS_8 = 8, SS_11 = 11, SS_13 = 13 }; class TTstring { private: diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp index 062b598609..350fc71d35 100644 --- a/engines/titanic/true_talk/tt_vocab.cpp +++ b/engines/titanic/true_talk/tt_vocab.cpp @@ -131,7 +131,7 @@ int TTvocab::load(const CString &name) { } void TTvocab::addWord(TTword *word) { - TTword *existingWord = findWord(word->_string); + TTword *existingWord = findWord(word->_text); if (existingWord) { if (word->_synP) { @@ -540,7 +540,7 @@ TTword *TTvocab::getPrefixedWord(TTstring &str) const { if (word->hasSynonyms()) word->setSynStr(str); else - word->_string = str; + word->_text = str; } delete tempStr; diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index e799507d22..1bf4783459 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -26,7 +26,7 @@ namespace Titanic { -TTword::TTword(TTstring &str, WordClass wordClass, int id) : _string(str), +TTword::TTword(TTstring &str, WordClass wordClass, int id) : _text(str), _wordClass(wordClass), _id(id), _tag(0), _field24(0), _field28(0), _synP(nullptr), _nextP(nullptr) { _status = str.getStatus() == SS_VALID ? SS_VALID : SS_5; @@ -38,7 +38,7 @@ TTword::TTword(const TTword *src) { return; } - _string = src->_string; + _text = src->_text; _wordClass = src->_wordClass; _id = src->_id; _tag = src->_tag; @@ -138,7 +138,7 @@ int TTword::load(SimpleFile *file, WordClass wordClass) { int id; if (file->scanf("%d %s %s", &id, &str1, &str2)) { - _string = str1; + _text = str1; _id = id; _tag = readNumber(str2.c_str()); _wordClass = wordClass; @@ -186,7 +186,7 @@ bool TTword::findSynByName(const TTstring &str, TTsynonym *dest, int mode) const } bool TTword::compareTo(const char *str) const { - return _string == str; + return _text == str; } TTword *TTword::copy() const { diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index 94edee329e..ef907964c9 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -59,7 +59,7 @@ protected: public: TTword *_nextP; TTsynonym *_synP; - TTstring _string; + TTstring _text; WordClass _wordClass; int _id; uint _tag; @@ -111,13 +111,13 @@ public: */ bool findSynByName(const TTstring &str, TTsynonym *dest, int mode) const; - const char *c_str() const { return _string.c_str(); } + const char *c_str() const { return _text.c_str(); } operator const char *() const { return c_str(); } /** * Return the text of the word */ - const TTstring getText() { return _string; } + const TTstring getText() { return _text; } /** * Compares the word's text to a passed string @@ -136,6 +136,11 @@ public: */ TTstringStatus getStatus() const { return _status; } + /** + * Returns true if the word is in a valid state + */ + bool isValid() const { return _status == SS_VALID; } + /** * Return the status of the entire word chain */ -- cgit v1.2.3 From 35f18390636c74c35af55426d6f48d9db59707bd Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 26 May 2016 20:59:50 -0400 Subject: TITANIC: More work on TTparser considerRequests --- engines/titanic/true_talk/tt_parser.cpp | 29 +++++++++++++++++++++++++++-- engines/titanic/true_talk/tt_sentence.cpp | 10 +++++----- engines/titanic/true_talk/tt_sentence.h | 2 +- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index a0eb6a5e9a..cc3ee2fa51 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -819,6 +819,11 @@ int TTparser::considerRequests(TTword *word) { break; case SEEK_LOCATION: + addNode(5); + _sentenceConcept->createConcept(0, 5, word); + flag = true; + break; + case SEEK_OWNERSHIP: case SEEK_STATE: case SEEK_MODIFIERS: @@ -837,15 +842,35 @@ int TTparser::considerRequests(TTword *word) { break; case SET_ACTION: - case SET_COLOR: + if (_sentence->fn4(1, 104, _sentenceConcept) || + _sentence->fn4(1, 107, _sentenceConcept)) { + concept = _sentenceConcept->_concept1P; + _sentenceConcept->_concept1P = nullptr; + addNode(15); + } + + if (_sentence->check2C() && word->_id == 113) + addNode(4); + + if (word->_wordClass == WC_ACTION) + _sentenceConcept->createConcept(0, 1, word); + + flag = true; + break; + case ACTOR_IS_TO: + _sentenceConcept->changeConcept(1, &_sentenceConcept->_concept0P, 3); + flag = true; + break; + case ACTOR_IS_FROM: + _sentenceConcept->changeConcept(1, &_sentenceConcept->_concept0P, 4); + break; case ACTOR_IS_OBJECT: flag = resetConcept(&_sentenceConcept->_concept0P, 2); break; - case STATE_IDENTITY: case WORD_TYPE_IS_SENTENCE_TYPE: case COMPLEX_VERB: // TODO diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index 06ddb6b299..d619c9e2f3 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -186,16 +186,16 @@ exit: return abortFlag; } -bool TTsentence::fn4(int mode, int wordId, TTconcept *concept) { - if (!concept) - return false; +bool TTsentence::fn4(int mode, int wordId, TTconceptNode *node) { + if (!node) + node = &_sentenceConcept; switch (mode) { case 1: - return _sentenceConcept._concept1P && _sentenceConcept._concept1P->getWordId() == wordId; + return node->_concept1P && node->_concept1P->getWordId() == wordId; case 5: - return _sentenceConcept._concept5P && _sentenceConcept._concept5P->getWordId() == wordId; + return node->_concept5P && node->_concept5P->getWordId() == wordId; default: return false; diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index 83416cbd49..d168d48a61 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -95,7 +95,7 @@ public: int storeVocabHit(TTword *word); bool fn2(int conceptIndex, const TTstring &str, TTconceptNode *conceptNode); - bool fn4(int mode, int wordId, TTconcept *concept); + bool fn4(int mode, int wordId, TTconceptNode *node); }; } // End of namespace Titanic -- cgit v1.2.3 From 63439a1c94d0279e6b00e8663d3ae554a3379b0f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 27 May 2016 06:36:38 -0400 Subject: TITANIC: Finished TTparser checkForAction --- engines/titanic/true_talk/tt_parser.cpp | 50 ++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index cc3ee2fa51..498c0cc015 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -1019,8 +1019,56 @@ int TTparser::checkForAction() { } } + if (_sentence->fn2(2, TTstring("thePlayer"), _sentenceConcept) && + _sentenceConcept->concept1WordId() == 101 && flag) + _sentence->_field2C = 17; + + if (!_sentenceConcept->_concept0P && !_sentenceConcept->_concept1P && + !_sentenceConcept->_concept2P && !_sentenceConcept->_concept5P && !flag) { + if (_conceptP) + filterConcepts(5, 2); + + if (!_sentenceConcept->_concept2P && _sentence->_field2C == 1) + _sentence->_field2C = 0; + } + + if (_sentence->_field58 < 5 && _sentence->_field2C == 1 && !flag) + _sentence->_field2C = 19; + + for (TTconceptNode *nodeP = &_sentence->_sentenceConcept; nodeP; nodeP = nodeP->_nextP) { + if (nodeP->_field18 == 0 && nodeP->_concept1P) { + nodeP->_field18 = _sentence->concept18(nodeP); + } else if (nodeP->_field18 == 4 && !_sentenceConcept->_concept0P) { + if (_sentenceConcept->_concept3P) { + _sentenceConcept->_concept0P = _sentenceConcept->_concept3P; + _sentenceConcept->_concept3P = nullptr; + } else if (_sentenceConcept->_concept2P) { + _sentenceConcept->_concept0P = _sentenceConcept->_concept2P; + _sentenceConcept->_concept2P = nullptr; + } + } + } + + if (_sentence->_field2C == 1 && _sentenceConcept->_concept5P && + _sentenceConcept->_concept2P) { + if (_sentence->fn4(1, 113, nullptr)) { + if (_sentence->fn2(2, TTstring("targetNpc"), nullptr)) { + _sentence->_field2C = 20; + } else if (_sentence->fn2(2, TTstring("thePlayer"), nullptr)) { + _sentence->_field2C = 21; + } else { + _sentence->_field2C = 22; + } + } + } else if (!_sentenceConcept->_concept0P && !_sentenceConcept->_concept1P && + !_sentenceConcept->_concept2P && !_sentenceConcept->_concept5P) { + if (_conceptP) + filterConcepts(5, 2); + + if (!_sentenceConcept->_concept2P && _sentence->_field2C == 1) + _sentence->_field2C = 0; + } - // TODO return status; } -- cgit v1.2.3 From 1fff06e97a2d29aa94c4a5a4ee3c08f310ece0d3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 27 May 2016 06:50:52 -0400 Subject: TITANIC: Added TTparser processRequests --- engines/titanic/true_talk/tt_parser.cpp | 40 +++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 498c0cc015..5a94196552 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -888,8 +888,44 @@ int TTparser::considerRequests(TTword *word) { } int TTparser::processRequests(TTword *word) { - // TODO - return 0; + int status = loadRequests(word); + switch (status) { + case 0: + status = considerRequests(word); + + // Iterate through the words + while (_currentWordP) { + considerRequests(_currentWordP); + TTword *nextP = _currentWordP->_nextP; + + delete _currentWordP; + _currentWordP = nextP; + } + break; + + case 1: { + TTword *newWord = new TTword(word); + newWord->_nextP = nullptr; + + // Add word to word chain + if (_currentWordP) { + // Add at end of existing chain + for (word = _currentWordP; word->_nextP; word = word->_nextP) + ; + word->_nextP = newWord; + } else { + // First word, so set as head + _currentWordP = newWord; + } + break; + } + + default: + warning("unexpected return from consider requests"); + break; + } + + return status; } void TTparser::addToConceptList(TTword *word) { -- cgit v1.2.3 From 409271778e35b5089330abd589e3304f6f25064a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 27 May 2016 07:41:05 -0400 Subject: TITANIC: Added TTparser removeNode --- engines/titanic/true_talk/tt_parser.cpp | 8 ++++++++ engines/titanic/true_talk/tt_parser.h | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 5a94196552..f2abe5eec0 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -975,6 +975,14 @@ void TTparser::removeConcept(TTconcept *concept) { delete concept; } +void TTparser::removeNode(TTparserNode *node) { + if (!node->_priorP) + // Node is the head of the chain, so reset parser's nodes pointer + _nodesP = static_cast(node->_nextP); + + delete node; +} + int TTparser::checkForAction() { int status = SS_VALID; bool flag = false; diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index 5d431114ec..95a3be42d4 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -164,6 +164,12 @@ private: */ void removeConcept(TTconcept *concept); + /** + * Detaches a node from the main node list + */ + void removeNode(TTparserNode *node); + + int checkForAction(); int fn2(TTword *word); bool checkConcept2(TTconcept *concept, int conceptMode); -- cgit v1.2.3 From de1bb1e95c1a6eec7b0b505d1e4d44bb1a6f5098 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 27 May 2016 12:50:15 -0400 Subject: TITANIC: In-progress TTparser processModifiers --- engines/titanic/true_talk/tt_concept.h | 2 +- engines/titanic/true_talk/tt_parser.cpp | 20 ++++++++++++++++++++ engines/titanic/true_talk/tt_parser.h | 1 + 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index 7fc56e7345..0a14482ba6 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -41,7 +41,6 @@ private: int _field14; int _field1C; int _field20; - TTstring _string2; TTword *_word2P; int _field30; int _field34; @@ -75,6 +74,7 @@ private: public: TTconcept *_nextP; ScriptType _scriptType; + TTstring _string2; public: TTconcept(); TTconcept(TTscriptBase *script, ScriptType scriptType); diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index f2abe5eec0..9b078b4fd4 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -1231,4 +1231,24 @@ bool TTparser::resetConcept(TTconcept **conceptPP, int conceptIndex) { return !result; } +int TTparser::processModifiers(int modifier, TTword *word) { + TTconcept *newConcept = new TTconcept(word, ST_UNKNOWN_SCRIPT); + + for (TTword *currP = _currentWordP; currP != word; currP = currP->_nextP) { + if ((modifier == 2 && currP->_wordClass == WC_ADJECTIVE) || + (modifier == 1 && currP->_wordClass == WC_ADVERB)) { + newConcept->_string2 += ' '; + newConcept->_string2 += _currentWordP->getText(); + } else if (word->_id == 113 && currP->_wordClass == WC_ADJECTIVE) { + addToConceptList(currP); + addNode(13); + } + + if (modifier == 2 || modifier == 3) { + // TODO + } + } + return 0; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index 95a3be42d4..7aa47fd12c 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -169,6 +169,7 @@ private: */ void removeNode(TTparserNode *node); + int processModifiers(int modifier, TTword *word); int checkForAction(); int fn2(TTword *word); -- cgit v1.2.3 From 5ffe93ad9b78d1354df62dff2bbbb743629c56f3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 27 May 2016 21:20:53 -0400 Subject: TITANIC: Finished TTparser processModifiers --- engines/titanic/true_talk/tt_concept.h | 6 +-- engines/titanic/true_talk/tt_parser.cpp | 66 ++++++++++++++++++++++++++++++++- 2 files changed, 67 insertions(+), 5 deletions(-) diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index 0a14482ba6..58646601a6 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -38,12 +38,9 @@ private: TTscriptBase *_scriptP; TTword *_wordP; TTstring _string1; - int _field14; int _field1C; - int _field20; TTword *_word2P; int _field30; - int _field34; bool _flag; int _status; private: @@ -74,6 +71,9 @@ private: public: TTconcept *_nextP; ScriptType _scriptType; + int _field14; + int _field20; + int _field34; TTstring _string2; public: TTconcept(); diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 9b078b4fd4..2cc9346019 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -1234,7 +1234,8 @@ bool TTparser::resetConcept(TTconcept **conceptPP, int conceptIndex) { int TTparser::processModifiers(int modifier, TTword *word) { TTconcept *newConcept = new TTconcept(word, ST_UNKNOWN_SCRIPT); - for (TTword *currP = _currentWordP; currP != word; currP = currP->_nextP) { + // Cycles through each word + for (TTword *currP = _currentWordP; currP != word; currP = _currentWordP) { if ((modifier == 2 && currP->_wordClass == WC_ADJECTIVE) || (modifier == 1 && currP->_wordClass == WC_ADVERB)) { newConcept->_string2 += ' '; @@ -1245,9 +1246,70 @@ int TTparser::processModifiers(int modifier, TTword *word) { } if (modifier == 2 || modifier == 3) { - // TODO + switch (_currentWordP->_id) { + case 94: + _currentConceptP->setOwner(newConcept); + if (_currentWordP) { + _currentWordP->deleteSiblings(); + delete _currentWordP; + _currentWordP = nullptr; + } + + delete newConcept; + newConcept = nullptr; + break; + + case 204: + newConcept->_field34 = 1; + if (_sentence->_field2C == 1) + _sentence->_field2C = 12; + newConcept->_field14 = 1; + break; + + case 300: + newConcept->set1C(atoi(_currentWordP->_text.c_str())); + break; + + case 400: + newConcept->_field14 = 2; + break; + + case 401: + newConcept->_field14 = 1; + break; + + case 601: + newConcept->setOwner(_currentWordP, false); + break; + + case 608: + if (_currentWordP->comparePronounTo(10)) { + newConcept->_field20 = 1; + } else if (_currentWordP->comparePronounTo(11)) { + newConcept->_field20 = 2; + } + + default: + break; + } + } + + if (_currentWordP) { + // Detaches word and deletes it + TTword *wordP = _currentWordP; + _currentWordP = wordP->_nextP; + + wordP->_nextP = nullptr; + delete wordP; } } + + if (newConcept) { + newConcept->setFlag(true); + _currentConceptP = newConcept; + addConcept(newConcept); + } + return 0; } -- cgit v1.2.3 From 8a3118912191736620580fd4ead9b19b15d3c3dd Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 28 May 2016 09:18:08 -0400 Subject: TITANIC: Adding more to TTparser considerRequests, and support methods --- engines/titanic/true_talk/tt_concept.h | 4 +- engines/titanic/true_talk/tt_parser.cpp | 66 +++++++++++++++++++++++++++++++ engines/titanic/true_talk/tt_sentence.cpp | 37 +++++++++++------ engines/titanic/true_talk/tt_sentence.h | 17 +++++++- 4 files changed, 108 insertions(+), 16 deletions(-) diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index 58646601a6..9d067ad947 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -35,8 +35,6 @@ class TTword; class TTconcept { private: - TTscriptBase *_scriptP; - TTword *_wordP; TTstring _string1; int _field1C; TTword *_word2P; @@ -70,6 +68,8 @@ private: void initialize(TTconcept &src); public: TTconcept *_nextP; + TTscriptBase *_scriptP; + TTword *_wordP; ScriptType _scriptType; int _field14; int _field20; diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 2cc9346019..748c19a718 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -731,6 +731,7 @@ int TTparser::considerRequests(TTword *word) { TTconcept *concept = nullptr; int status = 0; bool flag = false; + bool modifierFlag = false; while (word) { //int ecx = 906; @@ -827,6 +828,71 @@ int TTparser::considerRequests(TTword *word) { case SEEK_OWNERSHIP: case SEEK_STATE: case SEEK_MODIFIERS: + if (!modifierFlag) { + bool tempFlag = false; + + switch (word->_wordClass) { + case WC_ACTION: + status = processModifiers(1, word); + break; + case WC_THING: + status = processModifiers(2, word); + break; + case WC_ABSTRACT: + if (word->_id != 300) { + status = processModifiers(3, word); + } else if (!_conceptP->findByWordClass(WC_THING)) { + status = processModifiers(3, word); + } else { + word->_id = atoi(word->_text.c_str()); + } + break; + case WC_PRONOUN: + if (word->_id != 602) + addToConceptList(word); + break; + case WC_ADJECTIVE: { + TTconcept *concept = _conceptP->findByWordClass(WC_THING); + if (concept) { + concept->_string2 += ' '; + concept->_string2 += word->getText(); + } else { + status = processModifiers(8, word); + } + break; + } + case WC_ADVERB: + if (word->_id == 906) { + for (TTconcept *currP = _conceptP; currP; currP = currP->_nextP) { + if (_sentence->isFrameSlotClass(1, WC_ACTION) || + _sentence->isFrameSlotClass(1, WC_THING)) + currP->_field34 = 1; + } + } else { + TTconcept *conceptP = _conceptP->findByWordClass(WC_ACTION); + + if (conceptP) { + conceptP->_string2 += ' '; + conceptP->_string2 += word->getText(); + } else { + tempFlag = true; + } + } + break; + default: + addToConceptList(word); + status = 0; + break; + } + + if (tempFlag) + status = _sentenceConcept->createConcept(1, 5, word); + + modifierFlag = true; + flag = true; + } + break; + case SEEK_NEW_FRAME: case SEEK_STATE_OBJECT: if (!_sentenceConcept->_concept5P) { diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index d619c9e2f3..c777464f8d 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -107,10 +107,10 @@ int TTsentence::storeVocabHit(TTword *word) { return 0; } -bool TTsentence::fn2(int conceptIndex, const TTstring &str, TTconceptNode *conceptNode) { +bool TTsentence::fn2(int slotIndex, const TTstring &str, TTconceptNode *conceptNode) { if (!conceptNode) conceptNode = &_sentenceConcept; - TTconcept *concept = getFrameSlot(conceptIndex, conceptNode); + TTconcept *concept = getFrameSlot(slotIndex, conceptNode); if (!concept) return str == "isEmpty"; @@ -142,14 +142,14 @@ bool TTsentence::fn2(int conceptIndex, const TTstring &str, TTconceptNode *conce return true; } - if (conceptIndex == 1 && g_vm->_exeResources._owner->_concept4P) { + if (slotIndex == 1 && g_vm->_exeResources._owner->_concept4P) { if (str == g_vm->_exeResources._owner->_concept4P->getText() && conceptText == "do") goto exit; } - if (g_vm->_exeResources._owner->_concept2P && (conceptIndex == 0 || - conceptIndex == 3 || conceptIndex == 4)) { + if (g_vm->_exeResources._owner->_concept2P && (slotIndex == 0 || + slotIndex == 3 || slotIndex == 4)) { if (str == g_vm->_exeResources._owner->_concept2P->getText() && (conceptText == "it" || conceptText == "he" || conceptText == "she" || conceptText == "him" || conceptText == "her" || conceptText == "them" || @@ -157,8 +157,8 @@ bool TTsentence::fn2(int conceptIndex, const TTstring &str, TTconceptNode *conce goto exit; } - if (g_vm->_exeResources._owner->_concept1P && (conceptIndex == 0 || - conceptIndex == 2 || conceptIndex == 3 || conceptIndex == 4 || conceptIndex == 5)) { + if (g_vm->_exeResources._owner->_concept1P && (slotIndex == 0 || + slotIndex == 2 || slotIndex == 3 || slotIndex == 4 || slotIndex == 5)) { if (str == g_vm->_exeResources._owner->_concept2P->getText() && (conceptText == "it" || conceptText == "that" || conceptText == "he" || conceptText == "she" || conceptText == "him" || conceptText == "her" || @@ -167,7 +167,7 @@ bool TTsentence::fn2(int conceptIndex, const TTstring &str, TTconceptNode *conce goto exit; } - if (g_vm->_exeResources._owner->_concept1P && (conceptIndex == 0 || conceptIndex == 2)) { + if (g_vm->_exeResources._owner->_concept1P && (slotIndex == 0 || slotIndex == 2)) { if (conceptText == "?" && str == g_vm->_exeResources._owner->_concept2P->getText()) { delete concept; concept = getFrameSlot(5, conceptNode); @@ -202,12 +202,16 @@ bool TTsentence::fn4(int mode, int wordId, TTconceptNode *node) { } } -TTconcept *TTsentence::getFrameSlot(int conceptIndex, TTconceptNode *conceptNode) { - TTconcept *newConcept = new TTconcept(); - +TTconcept *TTsentence::getFrameEntry(int slotIndex, const TTconceptNode *conceptNode) const { if (!conceptNode) conceptNode = &_sentenceConcept; - TTconcept *concept = conceptNode->_concepts[conceptIndex]; + + return conceptNode->_concepts[slotIndex]; +} + +TTconcept *TTsentence::getFrameSlot(int slotIndex, const TTconceptNode *conceptNode) const { + TTconcept *newConcept = new TTconcept(); + TTconcept *concept = getFrameEntry(slotIndex, conceptNode); newConcept->copyFrom(concept); if (!newConcept->isValid()) { @@ -218,6 +222,15 @@ TTconcept *TTsentence::getFrameSlot(int conceptIndex, TTconceptNode *conceptNode return newConcept; } +bool TTsentence::isFrameSlotClass(int slotIndex, WordClass wordClass, const TTconceptNode *conceptNode) const { + TTconcept *concept = getFrameEntry(slotIndex, conceptNode); + if (concept && concept->_wordP) { + return concept->_wordP->isClass(wordClass); + } else { + return false; + } +} + int TTsentence::is18(int val, const TTconceptNode *node) const { if (!node) node = &_sentenceConcept; diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index d168d48a61..f51ca4bdda 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -85,7 +85,20 @@ public: int getStatus() const { return _status; } - TTconcept *getFrameSlot(int conceptIndex, TTconceptNode *conceptNode); + /** + * Gets a concept slot + */ + TTconcept *getFrameEntry(int slotIndex, const TTconceptNode *conceptNode = nullptr) const; + + /** + * Gets a conecpt slot and returns a duplicate of it + */ + TTconcept *getFrameSlot(int slotIndex, const TTconceptNode *conceptNode = nullptr) const; + + /** + * Returns true if the specified slot has an attached word with a given class + */ + bool isFrameSlotClass(int slotIndex, WordClass wordClass, const TTconceptNode *conceptNode = nullptr) const; /** * Adds a found vocab word to the list of words representing @@ -94,7 +107,7 @@ public: */ int storeVocabHit(TTword *word); - bool fn2(int conceptIndex, const TTstring &str, TTconceptNode *conceptNode); + bool fn2(int slotIndex, const TTstring &str, TTconceptNode *conceptNode); bool fn4(int mode, int wordId, TTconceptNode *node); }; -- cgit v1.2.3 From 23cd7fd2994c6438a37b243af432d5027ee6aeb8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 28 May 2016 11:03:04 -0400 Subject: TITANIC: Fleshing out TTparser considerRequests --- engines/titanic/true_talk/tt_concept.h | 2 +- engines/titanic/true_talk/tt_major_word.cpp | 2 +- engines/titanic/true_talk/tt_major_word.h | 2 +- engines/titanic/true_talk/tt_parser.cpp | 106 +++++++++++++++++++++++++++- engines/titanic/true_talk/tt_picture.cpp | 2 +- engines/titanic/true_talk/tt_picture.h | 2 +- engines/titanic/true_talk/tt_word.cpp | 2 +- engines/titanic/true_talk/tt_word.h | 2 +- 8 files changed, 110 insertions(+), 10 deletions(-) diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index 9d067ad947..835ff60a5f 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -78,7 +78,7 @@ public: public: TTconcept(); TTconcept(TTscriptBase *script, ScriptType scriptType); - TTconcept(TTword *word, ScriptType scriptType); + TTconcept(TTword *word, ScriptType scriptType = ST_UNKNOWN_SCRIPT); TTconcept(TTconcept &src); ~TTconcept(); diff --git a/engines/titanic/true_talk/tt_major_word.cpp b/engines/titanic/true_talk/tt_major_word.cpp index 0085accceb..18a56a40be 100644 --- a/engines/titanic/true_talk/tt_major_word.cpp +++ b/engines/titanic/true_talk/tt_major_word.cpp @@ -26,7 +26,7 @@ namespace Titanic { bool TTmajorWord::_staticFlag; -TTmajorWord::TTmajorWord(TTstring &str, WordClass wordClass, int val2, int val3) : +TTmajorWord::TTmajorWord(const TTstring &str, WordClass wordClass, int val2, int val3) : TTword(str, wordClass, val2), _field2C(val3) { } diff --git a/engines/titanic/true_talk/tt_major_word.h b/engines/titanic/true_talk/tt_major_word.h index d3d434e26d..c9a708abfb 100644 --- a/engines/titanic/true_talk/tt_major_word.h +++ b/engines/titanic/true_talk/tt_major_word.h @@ -38,7 +38,7 @@ protected: */ int saveData(SimpleFile *file, int val) const; public: - TTmajorWord(TTstring &str, WordClass wordClass, int val2, int val3); + TTmajorWord(const TTstring &str, WordClass wordClass, int val2, int val3); TTmajorWord(const TTmajorWord *src); /** diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 748c19a718..1d2680ecc7 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -24,6 +24,7 @@ #include "titanic/true_talk/script_handler.h" #include "titanic/true_talk/tt_action.h" #include "titanic/true_talk/tt_concept.h" +#include "titanic/true_talk/tt_picture.h" #include "titanic/true_talk/tt_sentence.h" #include "titanic/true_talk/tt_word.h" #include "titanic/titanic.h" @@ -732,11 +733,9 @@ int TTparser::considerRequests(TTword *word) { int status = 0; bool flag = false; bool modifierFlag = false; + int seekFlag = 0; while (word) { - //int ecx = 906; - //int edx = 12; - if (nodeP->_tag == MKTAG('C', 'O', 'M', 'E')) { addNode(7); addNode(5); @@ -894,6 +893,29 @@ int TTparser::considerRequests(TTword *word) { break; case SEEK_NEW_FRAME: + if (word->_wordClass == WC_ACTION && word->_id != 104 && word->_id != 107) { + if (concept && (_sentenceConcept->_concept5P || _sentenceConcept->_concept2P)) { + TTsentenceConcept *oldNode = _sentenceConcept; + oldNode->_field1C = 2; + _sentenceConcept = oldNode->addSibling(); + concept = nullptr; + + _sentenceConcept->_concept1P = oldNode->_concept1P; + _sentenceConcept->_concept5P = oldNode->_concept5P; + _sentenceConcept->_concept2P = oldNode->_concept2P; + + if (seekFlag) { + seekFlag = 0; + + _sentenceConcept->_field18 = oldNode->_field18; + oldNode->_field18 = seekFlag; + } + } + + flag = true; + } + break; + case SEEK_STATE_OBJECT: if (!_sentenceConcept->_concept5P) { addToConceptList(word); @@ -938,6 +960,84 @@ int TTparser::considerRequests(TTword *word) { break; case WORD_TYPE_IS_SENTENCE_TYPE: + if (_sentence->_field2C == 1 || _sentence->_field2C == 10) { + for (TTword *wordP = _currentWordP; wordP; wordP = wordP->_nextP) { + if (wordP->_id == 906) { + _sentence->_field2C = 12; + flag = true; + break; + } + } + + TTpicture *newPictP; + TTconcept *newConceptP; + switch (word->_id) { + case 108: + _sentence->_field2C = 8; + break; + case 113: + if (!_sentenceConcept->_concept3P) + _sentence->_field2C = 22; + break; + case 304: + _sentence->_field2C = 25; + break; + case 305: + _sentence->_field2C = 24; + break; + case 306: + _sentence->_field2C = 7; + break; + case 501: + _sentence->_field2C = 9; + break; + case 900: + _sentence->_field2C = 5; + break; + case 901: + _sentence->_field2C = 4; + break; + case 904: + _sentence->_field2C = 6; + break; + case 905: + _sentence->_field2C = 11; + break; + case 906: + _sentence->_field2C = 12; + break; + case 907: + _sentence->_field2C = 13; + break; + case 908: + _sentence->_field2C = 2; + if (!_sentenceConcept->_concept0P) { + newPictP = new TTpicture(TTstring("?"), WC_THING, 0, 0, 0, 0, 0); + newConceptP = new TTconcept(newPictP); + + _sentenceConcept->_concept0P = newConceptP; + delete newPictP; + addNode(4); + } + break; + case 909: + _sentence->_field2C = 3; + newPictP = new TTpicture(TTstring("?"), WC_THING, 0, 0, 0, 0, 0); + newConceptP = new TTconcept(newPictP); + + _sentenceConcept->_concept2P = newConceptP; + delete newPictP; + addNode(4); + break; + + default: + break; + } + } + + flag = true; + break; + case COMPLEX_VERB: // TODO break; diff --git a/engines/titanic/true_talk/tt_picture.cpp b/engines/titanic/true_talk/tt_picture.cpp index 5c6444adb3..4b04b8825b 100644 --- a/engines/titanic/true_talk/tt_picture.cpp +++ b/engines/titanic/true_talk/tt_picture.cpp @@ -26,7 +26,7 @@ namespace Titanic { bool TTpicture::_staticFlag; -TTpicture::TTpicture(TTstring &str, WordClass wordClass, int val2, int val3, int val4, int val5, int val6) : +TTpicture::TTpicture(const TTstring &str, WordClass wordClass, int val2, int val3, int val4, int val5, int val6) : TTmajorWord(str, wordClass, val2, val4), _tag(val3), _field30(val5), _field3C(val6), _field38(0) { } diff --git a/engines/titanic/true_talk/tt_picture.h b/engines/titanic/true_talk/tt_picture.h index 9c7b2acfbf..18cb88278f 100644 --- a/engines/titanic/true_talk/tt_picture.h +++ b/engines/titanic/true_talk/tt_picture.h @@ -36,7 +36,7 @@ protected: int _field38; int _field3C; public: - TTpicture(TTstring &str, WordClass wordClass, int val2, int val3, int val4, int val5, int val6); + TTpicture(const TTstring &str, WordClass wordClass, int val2, int val3, int val4, int val5, int val6); TTpicture(const TTpicture *src); /** diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index 1bf4783459..1dccd30a0b 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -26,7 +26,7 @@ namespace Titanic { -TTword::TTword(TTstring &str, WordClass wordClass, int id) : _text(str), +TTword::TTword(const TTstring &str, WordClass wordClass, int id) : _text(str), _wordClass(wordClass), _id(id), _tag(0), _field24(0), _field28(0), _synP(nullptr), _nextP(nullptr) { _status = str.getStatus() == SS_VALID ? SS_VALID : SS_5; diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index ef907964c9..537d1e923b 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -64,7 +64,7 @@ public: int _id; uint _tag; public: - TTword(TTstring &str, WordClass wordClass, int val2); + TTword(const TTstring &str, WordClass wordClass, int val2); TTword(const TTword *src); ~TTword(); -- cgit v1.2.3 From 079a734831983dd26db7a2ef1f06d380b2af12dc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 28 May 2016 11:55:45 -0400 Subject: TITANIC: Fleshing out TTparser considerRequests --- engines/titanic/true_talk/tt_action.cpp | 2 +- engines/titanic/true_talk/tt_action.h | 2 +- engines/titanic/true_talk/tt_parser.cpp | 77 ++++++++++++++++++++++++++++++--- 3 files changed, 74 insertions(+), 7 deletions(-) diff --git a/engines/titanic/true_talk/tt_action.cpp b/engines/titanic/true_talk/tt_action.cpp index 04135b550f..5bf91c71df 100644 --- a/engines/titanic/true_talk/tt_action.cpp +++ b/engines/titanic/true_talk/tt_action.cpp @@ -26,7 +26,7 @@ namespace Titanic { bool TTaction::_staticFlag; -TTaction::TTaction(TTstring &str, WordClass wordClass, int val2, int val3, int val4) : +TTaction::TTaction(const TTstring &str, WordClass wordClass, int val2, int val3, int val4) : TTmajorWord(str, wordClass, val2, val3), _field30(val4) { } diff --git a/engines/titanic/true_talk/tt_action.h b/engines/titanic/true_talk/tt_action.h index 7b91b14743..29e2bc4e4a 100644 --- a/engines/titanic/true_talk/tt_action.h +++ b/engines/titanic/true_talk/tt_action.h @@ -33,7 +33,7 @@ private: protected: int _field30; public: - TTaction(TTstring &str, WordClass wordClass, int val2, int val3, int val4); + TTaction(const TTstring &str, WordClass wordClass, int val2, int val3, int val4); TTaction(const TTaction *src); /** diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 1d2680ecc7..45e941c82e 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -733,7 +733,7 @@ int TTparser::considerRequests(TTword *word) { int status = 0; bool flag = false; bool modifierFlag = false; - int seekFlag = 0; + int seekVal = 0; while (word) { if (nodeP->_tag == MKTAG('C', 'O', 'M', 'E')) { @@ -804,10 +804,65 @@ int TTparser::considerRequests(TTword *word) { break; case SEEK_OBJECT: + case SEEK_OBJECT_OVERRIDE: + if ((word->_wordClass == WC_THING || word->_wordClass == WC_PRONOUN) && + _sentence->fn2(2, TTstring("thePlayer"), _sentenceConcept) && + !_sentenceConcept->_concept3P) { + _sentenceConcept->_concept3P = _sentenceConcept->_concept2P; + _sentenceConcept->_concept2P = nullptr; + + flag = filterConcepts(5, 2); + if (!flag) { + status = _sentenceConcept->createConcept(0, 2, word); + } + } + break; + case SEEK_TO: + if (!_sentenceConcept->_concept3P) { + if (!filterConcepts(8, 3)) + flag = filterConcepts(3, 3); + } else { + flag = true; + } + break; + case SEEK_FROM: + if (!_sentenceConcept->_concept4P) { + if (!filterConcepts(8, 4)) + flag = filterConcepts(3, 3); + } else { + flag = true; + } + break; + case SEEK_TO_OVERRIDE: + if (word->_wordClass == WC_ACTION) { + status = _sentenceConcept->createConcept(0, 1, word); + if (!status) { + seekVal = _sentenceConcept->_field18; + _sentenceConcept->_field18 = 4; + flag = true; + } + } else if (word->_id == 703) { + if (_sentenceConcept->_concept2P) { + delete _sentenceConcept->_concept2P; + _sentenceConcept->_concept2P = nullptr; + } + + if (_sentenceConcept->_concept4P || !_sentenceConcept->_concept0P) { + addNode(7); + } else { + _sentenceConcept->changeConcept(1, &_sentenceConcept->_concept0P, 4); + concept = nullptr; + addNode(7); + } + } else { + flag = true; + } + break; + case SEEK_FROM_OVERRIDE: if (_sentenceConcept->_concept4P) { delete _sentenceConcept->_concept4P; @@ -904,11 +959,11 @@ int TTparser::considerRequests(TTword *word) { _sentenceConcept->_concept5P = oldNode->_concept5P; _sentenceConcept->_concept2P = oldNode->_concept2P; - if (seekFlag) { - seekFlag = 0; + if (seekVal) { + seekVal = 0; _sentenceConcept->_field18 = oldNode->_field18; - oldNode->_field18 = seekFlag; + oldNode->_field18 = seekVal; } } @@ -1039,7 +1094,19 @@ int TTparser::considerRequests(TTword *word) { break; case COMPLEX_VERB: - // TODO + if (word->_wordClass == WC_ACTION) { + flag = true; + } else if (!_sentenceConcept->_concept1P) { + TTstring wordStr = word->getText(); + if (wordStr == "do" || wordStr == "doing" || wordStr == "does" || wordStr == "done") { + TTaction *verbP = new TTaction(TTstring("do"), WC_ACTION, 112, 0, + _sentenceConcept->get18()); + status = _sentenceConcept->createConcept(1, 1, verbP); + delete verbP; + } + + flag = true; + } break; default: -- cgit v1.2.3 From eaab1605e089ad4abda5b64d85a4d2efe86d5328 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 28 May 2016 13:10:32 -0400 Subject: TITANIC: Finished inner switch of TTparser considerRequests --- engines/titanic/true_talk/tt_concept.cpp | 10 ++++ engines/titanic/true_talk/tt_concept.h | 10 ++-- engines/titanic/true_talk/tt_parser.cpp | 80 +++++++++++++++++++++++++++++--- 3 files changed, 90 insertions(+), 10 deletions(-) diff --git a/engines/titanic/true_talk/tt_concept.cpp b/engines/titanic/true_talk/tt_concept.cpp index 2c54f2fab6..30ecce1c3b 100644 --- a/engines/titanic/true_talk/tt_concept.cpp +++ b/engines/titanic/true_talk/tt_concept.cpp @@ -150,6 +150,16 @@ bool TTconcept::compareTo(const char *str) const { _wordP->compareTo(str); } +bool TTconcept::compareTo(TTword *word) const { + if (_wordP && _wordP->compareTo(word->_text)) + return true; + + if (_scriptP && _scriptP->getId() == 1 && word->comparePronounTo(1)) + return true; + + return false; +} + void TTconcept::initialize(TTconcept &src) { _nextP = src._nextP; _field14 = src._field14; diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index 835ff60a5f..4584b514c7 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -93,11 +93,15 @@ public: void copyFrom(TTconcept *src); /** - * Compares the name of the associated word, if any, - * to the passed string + * Compares the name of the associated word, if any, to the passed string */ bool compareTo(const char *str) const; + /** + * Compares the concept to the specified word + */ + bool compareTo(TTword *word) const; + /** * Set an owner for the concept */ @@ -126,8 +130,8 @@ public: } void setFlag(bool val) { _flag = val; } - void set1C(int val) { _field1C = val; } + int get20() const { return _field20; } bool checkWordId1() const; bool checkWordId2() const; diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 45e941c82e..f949618be7 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -790,20 +790,58 @@ int TTparser::considerRequests(TTword *word) { break; case SEEK_ACTOR: - if (_sentenceConcept->_concept0P) { - if (_sentenceConcept->_concept0P->compareTo("?") && + if (!_sentenceConcept->_concept0P) { + flag = filterConcepts(5, 0); + } else if (_sentenceConcept->_concept0P->compareTo("?") && _sentenceConcept->_concept1P->isWordId(113) && word->_wordClass == WC_THING) { - // TODO - } - - + TTconcept *oldConcept = _sentenceConcept->_concept0P; + _sentenceConcept->_concept0P = nullptr; + flag = filterConcepts(5, 2); + if (flag) + delete oldConcept; } else { - + flag = true; } break; case SEEK_OBJECT: + if (_sentenceConcept->_concept2P && _sentenceConcept->_concept2P->compareTo(word)) { + flag = true; + } else if (!_sentenceConcept->_concept2P) { + if (filterConcepts(5, 2) && _sentenceConcept->_concept2P->checkWordId1()) + addNode(5); + } else if (word->_wordClass == WC_THING && _sentence->fn2(2, TTstring("?"), _sentenceConcept)) { + TTconcept *oldConcept = _sentenceConcept->_concept2P; + flag = filterConcepts(5, 2); + _sentenceConcept->_concept2P->_field20 = oldConcept->get20(); + if (flag) + delete oldConcept; + } else if (!_sentenceConcept->_concept3P && + (!_sentenceConcept->_concept1P || (_sentenceConcept->_concept1P->getWordId() && + _sentenceConcept->_concept1P->getWordId() == 112)) && + _sentenceConcept->_concept2P->checkWordId1() && + (word->_wordClass == WC_THING || word->_wordClass == WC_PRONOUN)) { + _sentenceConcept->changeConcept(0, &_sentenceConcept->_concept2P, 3); + + if (_conceptP && _conceptP->isWordId(word->_id)) { + status = _sentenceConcept->replaceConcept(0, 2, _conceptP); + removeConcept(_conceptP); + } else { + status = _sentenceConcept->createConcept(0, 2, word); + } + + if (!status && !_sentenceConcept->_concept4P && _sentenceConcept->_concept0P) { + TTconcept *oldConcept = _sentenceConcept->_concept2P; + flag = filterConcepts(5, 2); + _sentenceConcept->_concept2P->_field20 = oldConcept->get20(); + if (flag) + delete oldConcept; + } else { + flag = true; + } + } + break; case SEEK_OBJECT_OVERRIDE: if ((word->_wordClass == WC_THING || word->_wordClass == WC_PRONOUN) && @@ -880,7 +918,35 @@ int TTparser::considerRequests(TTword *word) { break; case SEEK_OWNERSHIP: + if (word->_id == 601) { + if (_conceptP->findByWordClass(WC_THING)) + status = _conceptP->setOwner(word, false); + + flag = true; + } + break; + case SEEK_STATE: + if (_sentenceConcept->_concept5P) { + if (_sentenceConcept->_concept5P->findByWordId(306) || + _sentenceConcept->_concept5P->findByWordId(904)) { + TTconcept *oldConcept = _sentenceConcept->_concept5P; + _sentenceConcept->_concept5P = nullptr; + flag = filterConcepts(9, 5); + if (flag) + delete oldConcept; + } else { + flag = true; + } + } else { + flag = filterConcepts(9, 5); + if (!flag && word->_wordClass == WC_ADVERB) { + status = _sentenceConcept->createConcept(1, 5, word); + flag = true; + } + } + break; + case SEEK_MODIFIERS: if (!modifierFlag) { bool tempFlag = false; -- cgit v1.2.3 From ef186e1a2e668b524f423ad7fbb44dc9d3fb3ea4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 28 May 2016 13:41:22 -0400 Subject: TITANIC: Convert outer tag comparisons to switch cases in TTparser considerRequests --- engines/titanic/true_talk/tt_parser.cpp | 731 ++++++++++++++++---------------- 1 file changed, 364 insertions(+), 367 deletions(-) diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index f949618be7..f397173ae8 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -736,448 +736,445 @@ int TTparser::considerRequests(TTword *word) { int seekVal = 0; while (word) { - if (nodeP->_tag == MKTAG('C', 'O', 'M', 'E')) { - addNode(7); - addNode(5); - addNode(21); + switch (nodeP->_tag) { + case CHECK_COMMAND_FORM: + if (_sentenceConcept->_concept1P && _sentence->_field2C == 1 && + !_sentenceConcept->_concept0P) { + concept = new TTconcept(_sentence->_npcScript, ST_NPC_SCRIPT); + _sentenceConcept->_concept0P = concept; + _sentenceConcept->_field18 = 3; + } - if (!_sentence->_field2C) - _sentence->_field2C = 15; - } else if (nodeP->_tag == MKTAG('C', 'U', 'R', 'S') || - nodeP->_tag == MKTAG('S', 'E', 'X', 'X')) { - if (_sentence->_field58 > 1) - _sentence->_field58--; flag = true; + break; - } else if (nodeP->_tag == MKTAG('E', 'X', 'I', 'T')) { - addNode(8); - addNode(5); - addNode(21); - - if (!_sentence->_field2C) - _sentence->_field2C = 14; - + case EXPECT_THING: + if (!word->_wordClass) { + word->_wordClass = WC_THING; + addToConceptList(word); + addNode(14); + } - } else if (nodeP->_tag < MKTAG('C', 'O', 'M', 'E')) { - if (_sentence->_field58 > 1) - _sentence->_field58--; flag = true; - } else { - switch (nodeP->_tag) { - case CHECK_COMMAND_FORM: - if (_sentenceConcept->_concept1P && _sentence->_field2C == 1 && - !_sentenceConcept->_concept0P) { - concept = new TTconcept(_sentence->_npcScript, ST_NPC_SCRIPT); - _sentenceConcept->_concept0P = concept; - _sentenceConcept->_field18 = 3; - } - - flag = true; - break; + break; - case EXPECT_THING: - if (!word->_wordClass) { - word->_wordClass = WC_THING; - addToConceptList(word); - addNode(14); - } + case OBJECT_IS_TO: + flag = resetConcept(&_sentenceConcept->_concept2P, 3); + break; + case SEEK_ACTOR: + if (!_sentenceConcept->_concept0P) { + flag = filterConcepts(5, 0); + } else if (_sentenceConcept->_concept0P->compareTo("?") && + _sentenceConcept->_concept1P->isWordId(113) && + word->_wordClass == WC_THING) { + TTconcept *oldConcept = _sentenceConcept->_concept0P; + _sentenceConcept->_concept0P = nullptr; + flag = filterConcepts(5, 2); + if (flag) + delete oldConcept; + } else { flag = true; - break; - - case OBJECT_IS_TO: - flag = resetConcept(&_sentenceConcept->_concept2P, 3); - break; + } + break; - case SEEK_ACTOR: - if (!_sentenceConcept->_concept0P) { - flag = filterConcepts(5, 0); - } else if (_sentenceConcept->_concept0P->compareTo("?") && - _sentenceConcept->_concept1P->isWordId(113) && - word->_wordClass == WC_THING) { - TTconcept *oldConcept = _sentenceConcept->_concept0P; - _sentenceConcept->_concept0P = nullptr; - flag = filterConcepts(5, 2); - if (flag) - delete oldConcept; + case SEEK_OBJECT: + if (_sentenceConcept->_concept2P && _sentenceConcept->_concept2P->compareTo(word)) { + flag = true; + } else if (!_sentenceConcept->_concept2P) { + if (filterConcepts(5, 2) && _sentenceConcept->_concept2P->checkWordId1()) + addNode(5); + } else if (word->_wordClass == WC_THING && _sentence->fn2(2, TTstring("?"), _sentenceConcept)) { + TTconcept *oldConcept = _sentenceConcept->_concept2P; + flag = filterConcepts(5, 2); + _sentenceConcept->_concept2P->_field20 = oldConcept->get20(); + if (flag) + delete oldConcept; + } else if (!_sentenceConcept->_concept3P && + (!_sentenceConcept->_concept1P || (_sentenceConcept->_concept1P->getWordId() && + _sentenceConcept->_concept1P->getWordId() == 112)) && + _sentenceConcept->_concept2P->checkWordId1() && + (word->_wordClass == WC_THING || word->_wordClass == WC_PRONOUN)) { + _sentenceConcept->changeConcept(0, &_sentenceConcept->_concept2P, 3); + + if (_conceptP && _conceptP->isWordId(word->_id)) { + status = _sentenceConcept->replaceConcept(0, 2, _conceptP); + removeConcept(_conceptP); } else { - flag = true; + status = _sentenceConcept->createConcept(0, 2, word); } - break; - - case SEEK_OBJECT: - if (_sentenceConcept->_concept2P && _sentenceConcept->_concept2P->compareTo(word)) { - flag = true; - } else if (!_sentenceConcept->_concept2P) { - if (filterConcepts(5, 2) && _sentenceConcept->_concept2P->checkWordId1()) - addNode(5); - } else if (word->_wordClass == WC_THING && _sentence->fn2(2, TTstring("?"), _sentenceConcept)) { + + if (!status && !_sentenceConcept->_concept4P && _sentenceConcept->_concept0P) { TTconcept *oldConcept = _sentenceConcept->_concept2P; flag = filterConcepts(5, 2); _sentenceConcept->_concept2P->_field20 = oldConcept->get20(); if (flag) delete oldConcept; - } else if (!_sentenceConcept->_concept3P && - (!_sentenceConcept->_concept1P || (_sentenceConcept->_concept1P->getWordId() && - _sentenceConcept->_concept1P->getWordId() == 112)) && - _sentenceConcept->_concept2P->checkWordId1() && - (word->_wordClass == WC_THING || word->_wordClass == WC_PRONOUN)) { - _sentenceConcept->changeConcept(0, &_sentenceConcept->_concept2P, 3); - - if (_conceptP && _conceptP->isWordId(word->_id)) { - status = _sentenceConcept->replaceConcept(0, 2, _conceptP); - removeConcept(_conceptP); - } else { - status = _sentenceConcept->createConcept(0, 2, word); - } - - if (!status && !_sentenceConcept->_concept4P && _sentenceConcept->_concept0P) { - TTconcept *oldConcept = _sentenceConcept->_concept2P; - flag = filterConcepts(5, 2); - _sentenceConcept->_concept2P->_field20 = oldConcept->get20(); - if (flag) - delete oldConcept; - } else { - flag = true; - } + } else { + flag = true; } - break; + } + break; - case SEEK_OBJECT_OVERRIDE: - if ((word->_wordClass == WC_THING || word->_wordClass == WC_PRONOUN) && - _sentence->fn2(2, TTstring("thePlayer"), _sentenceConcept) && - !_sentenceConcept->_concept3P) { - _sentenceConcept->_concept3P = _sentenceConcept->_concept2P; - _sentenceConcept->_concept2P = nullptr; + case SEEK_OBJECT_OVERRIDE: + if ((word->_wordClass == WC_THING || word->_wordClass == WC_PRONOUN) && + _sentence->fn2(2, TTstring("thePlayer"), _sentenceConcept) && + !_sentenceConcept->_concept3P) { + _sentenceConcept->_concept3P = _sentenceConcept->_concept2P; + _sentenceConcept->_concept2P = nullptr; - flag = filterConcepts(5, 2); - if (!flag) { - status = _sentenceConcept->createConcept(0, 2, word); - } + flag = filterConcepts(5, 2); + if (!flag) { + status = _sentenceConcept->createConcept(0, 2, word); } - break; + } + break; - case SEEK_TO: - if (!_sentenceConcept->_concept3P) { - if (!filterConcepts(8, 3)) - flag = filterConcepts(3, 3); - } else { - flag = true; - } - break; + case SEEK_TO: + if (!_sentenceConcept->_concept3P) { + if (!filterConcepts(8, 3)) + flag = filterConcepts(3, 3); + } else { + flag = true; + } + break; - case SEEK_FROM: - if (!_sentenceConcept->_concept4P) { - if (!filterConcepts(8, 4)) - flag = filterConcepts(3, 3); - } else { + case SEEK_FROM: + if (!_sentenceConcept->_concept4P) { + if (!filterConcepts(8, 4)) + flag = filterConcepts(3, 3); + } else { + flag = true; + } + break; + + case SEEK_TO_OVERRIDE: + if (word->_wordClass == WC_ACTION) { + status = _sentenceConcept->createConcept(0, 1, word); + if (!status) { + seekVal = _sentenceConcept->_field18; + _sentenceConcept->_field18 = 4; flag = true; } - break; - - case SEEK_TO_OVERRIDE: - if (word->_wordClass == WC_ACTION) { - status = _sentenceConcept->createConcept(0, 1, word); - if (!status) { - seekVal = _sentenceConcept->_field18; - _sentenceConcept->_field18 = 4; - flag = true; - } - } else if (word->_id == 703) { - if (_sentenceConcept->_concept2P) { - delete _sentenceConcept->_concept2P; - _sentenceConcept->_concept2P = nullptr; - } + } else if (word->_id == 703) { + if (_sentenceConcept->_concept2P) { + delete _sentenceConcept->_concept2P; + _sentenceConcept->_concept2P = nullptr; + } - if (_sentenceConcept->_concept4P || !_sentenceConcept->_concept0P) { - addNode(7); - } else { - _sentenceConcept->changeConcept(1, &_sentenceConcept->_concept0P, 4); - concept = nullptr; - addNode(7); - } + if (_sentenceConcept->_concept4P || !_sentenceConcept->_concept0P) { + addNode(7); } else { - flag = true; + _sentenceConcept->changeConcept(1, &_sentenceConcept->_concept0P, 4); + concept = nullptr; + addNode(7); } - break; + } else { + flag = true; + } + break; - case SEEK_FROM_OVERRIDE: - if (_sentenceConcept->_concept4P) { - delete _sentenceConcept->_concept4P; - _sentenceConcept->_concept4P = nullptr; - } + case SEEK_FROM_OVERRIDE: + if (_sentenceConcept->_concept4P) { + delete _sentenceConcept->_concept4P; + _sentenceConcept->_concept4P = nullptr; + } - addNode(8); - flag = true; - break; + addNode(8); + flag = true; + break; - case SEEK_LOCATION: - addNode(5); - _sentenceConcept->createConcept(0, 5, word); - flag = true; - break; + case SEEK_LOCATION: + addNode(5); + _sentenceConcept->createConcept(0, 5, word); + flag = true; + break; - case SEEK_OWNERSHIP: - if (word->_id == 601) { - if (_conceptP->findByWordClass(WC_THING)) - status = _conceptP->setOwner(word, false); + case SEEK_OWNERSHIP: + if (word->_id == 601) { + if (_conceptP->findByWordClass(WC_THING)) + status = _conceptP->setOwner(word, false); + flag = true; + } + break; + + case SEEK_STATE: + if (_sentenceConcept->_concept5P) { + if (_sentenceConcept->_concept5P->findByWordId(306) || + _sentenceConcept->_concept5P->findByWordId(904)) { + TTconcept *oldConcept = _sentenceConcept->_concept5P; + _sentenceConcept->_concept5P = nullptr; + flag = filterConcepts(9, 5); + if (flag) + delete oldConcept; + } else { flag = true; } - break; + } else { + flag = filterConcepts(9, 5); + if (!flag && word->_wordClass == WC_ADVERB) { + status = _sentenceConcept->createConcept(1, 5, word); + flag = true; + } + } + break; - case SEEK_STATE: - if (_sentenceConcept->_concept5P) { - if (_sentenceConcept->_concept5P->findByWordId(306) || - _sentenceConcept->_concept5P->findByWordId(904)) { - TTconcept *oldConcept = _sentenceConcept->_concept5P; - _sentenceConcept->_concept5P = nullptr; - flag = filterConcepts(9, 5); - if (flag) - delete oldConcept; + case SEEK_MODIFIERS: + if (!modifierFlag) { + bool tempFlag = false; + + switch (word->_wordClass) { + case WC_ACTION: + status = processModifiers(1, word); + break; + case WC_THING: + status = processModifiers(2, word); + break; + case WC_ABSTRACT: + if (word->_id != 300) { + status = processModifiers(3, word); + } else if (!_conceptP->findByWordClass(WC_THING)) { + status = processModifiers(3, word); } else { - flag = true; + word->_id = atoi(word->_text.c_str()); } - } else { - flag = filterConcepts(9, 5); - if (!flag && word->_wordClass == WC_ADVERB) { - status = _sentenceConcept->createConcept(1, 5, word); - flag = true; + break; + case WC_PRONOUN: + if (word->_id != 602) + addToConceptList(word); + break; + case WC_ADJECTIVE: { + TTconcept *conceptP = _conceptP->findByWordClass(WC_THING); + if (conceptP) { + conceptP->_string2 += ' '; + conceptP->_string2 += word->getText(); + } else { + status = processModifiers(8, word); } + break; } - break; - - case SEEK_MODIFIERS: - if (!modifierFlag) { - bool tempFlag = false; - - switch (word->_wordClass) { - case WC_ACTION: - status = processModifiers(1, word); - break; - case WC_THING: - status = processModifiers(2, word); - break; - case WC_ABSTRACT: - if (word->_id != 300) { - status = processModifiers(3, word); - } else if (!_conceptP->findByWordClass(WC_THING)) { - status = processModifiers(3, word); - } else { - word->_id = atoi(word->_text.c_str()); - } - break; - case WC_PRONOUN: - if (word->_id != 602) - addToConceptList(word); - break; - case WC_ADJECTIVE: { - TTconcept *concept = _conceptP->findByWordClass(WC_THING); - if (concept) { - concept->_string2 += ' '; - concept->_string2 += word->getText(); - } else { - status = processModifiers(8, word); + case WC_ADVERB: + if (word->_id == 906) { + for (TTconcept *currP = _conceptP; currP; currP = currP->_nextP) { + if (_sentence->isFrameSlotClass(1, WC_ACTION) || + _sentence->isFrameSlotClass(1, WC_THING)) + currP->_field34 = 1; } - break; - } - case WC_ADVERB: - if (word->_id == 906) { - for (TTconcept *currP = _conceptP; currP; currP = currP->_nextP) { - if (_sentence->isFrameSlotClass(1, WC_ACTION) || - _sentence->isFrameSlotClass(1, WC_THING)) - currP->_field34 = 1; - } + } else { + TTconcept *conceptP = _conceptP->findByWordClass(WC_ACTION); + + if (conceptP) { + conceptP->_string2 += ' '; + conceptP->_string2 += word->getText(); } else { - TTconcept *conceptP = _conceptP->findByWordClass(WC_ACTION); - - if (conceptP) { - conceptP->_string2 += ' '; - conceptP->_string2 += word->getText(); - } else { - tempFlag = true; - } + tempFlag = true; } - break; - default: - addToConceptList(word); - status = 0; - break; } + break; + default: + addToConceptList(word); + status = 0; + break; + } - if (tempFlag) - status = _sentenceConcept->createConcept(1, 5, word); + if (tempFlag) + status = _sentenceConcept->createConcept(1, 5, word); - modifierFlag = true; - flag = true; - } - break; + modifierFlag = true; + flag = true; + } + break; - case SEEK_NEW_FRAME: - if (word->_wordClass == WC_ACTION && word->_id != 104 && word->_id != 107) { - if (concept && (_sentenceConcept->_concept5P || _sentenceConcept->_concept2P)) { - TTsentenceConcept *oldNode = _sentenceConcept; - oldNode->_field1C = 2; - _sentenceConcept = oldNode->addSibling(); - concept = nullptr; + case SEEK_NEW_FRAME: + if (word->_wordClass == WC_ACTION && word->_id != 104 && word->_id != 107) { + if (concept && (_sentenceConcept->_concept5P || _sentenceConcept->_concept2P)) { + TTsentenceConcept *oldNode = _sentenceConcept; + oldNode->_field1C = 2; + _sentenceConcept = oldNode->addSibling(); + concept = nullptr; - _sentenceConcept->_concept1P = oldNode->_concept1P; - _sentenceConcept->_concept5P = oldNode->_concept5P; - _sentenceConcept->_concept2P = oldNode->_concept2P; + _sentenceConcept->_concept1P = oldNode->_concept1P; + _sentenceConcept->_concept5P = oldNode->_concept5P; + _sentenceConcept->_concept2P = oldNode->_concept2P; - if (seekVal) { - seekVal = 0; + if (seekVal) { + seekVal = 0; - _sentenceConcept->_field18 = oldNode->_field18; - oldNode->_field18 = seekVal; - } + _sentenceConcept->_field18 = oldNode->_field18; + oldNode->_field18 = seekVal; } - - flag = true; - } - break; - - case SEEK_STATE_OBJECT: - if (!_sentenceConcept->_concept5P) { - addToConceptList(word); - } else if (_sentenceConcept->concept5WordId() == 113 || - _sentenceConcept->concept5WordId() == 112) { - _sentenceConcept->createConcept(1, 2, word); - } else { - addToConceptList(word); } flag = true; - break; + } + break; - case SET_ACTION: - if (_sentence->fn4(1, 104, _sentenceConcept) || - _sentence->fn4(1, 107, _sentenceConcept)) { - concept = _sentenceConcept->_concept1P; - _sentenceConcept->_concept1P = nullptr; - addNode(15); - } + case SEEK_STATE_OBJECT: + if (!_sentenceConcept->_concept5P) { + addToConceptList(word); + } else if (_sentenceConcept->concept5WordId() == 113 || + _sentenceConcept->concept5WordId() == 112) { + _sentenceConcept->createConcept(1, 2, word); + } else { + addToConceptList(word); + } - if (_sentence->check2C() && word->_id == 113) - addNode(4); + flag = true; + break; - if (word->_wordClass == WC_ACTION) - _sentenceConcept->createConcept(0, 1, word); + case SET_ACTION: + if (_sentence->fn4(1, 104, _sentenceConcept) || + _sentence->fn4(1, 107, _sentenceConcept)) { + concept = _sentenceConcept->_concept1P; + _sentenceConcept->_concept1P = nullptr; + addNode(15); + } - flag = true; - break; + if (_sentence->check2C() && word->_id == 113) + addNode(4); - case ACTOR_IS_TO: - _sentenceConcept->changeConcept(1, &_sentenceConcept->_concept0P, 3); - flag = true; - break; + if (word->_wordClass == WC_ACTION) + _sentenceConcept->createConcept(0, 1, word); - case ACTOR_IS_FROM: - _sentenceConcept->changeConcept(1, &_sentenceConcept->_concept0P, 4); - break; + flag = true; + break; - case ACTOR_IS_OBJECT: - flag = resetConcept(&_sentenceConcept->_concept0P, 2); - break; + case ACTOR_IS_TO: + _sentenceConcept->changeConcept(1, &_sentenceConcept->_concept0P, 3); + flag = true; + break; - case WORD_TYPE_IS_SENTENCE_TYPE: - if (_sentence->_field2C == 1 || _sentence->_field2C == 10) { - for (TTword *wordP = _currentWordP; wordP; wordP = wordP->_nextP) { - if (wordP->_id == 906) { - _sentence->_field2C = 12; - flag = true; - break; - } - } + case ACTOR_IS_FROM: + _sentenceConcept->changeConcept(1, &_sentenceConcept->_concept0P, 4); + break; - TTpicture *newPictP; - TTconcept *newConceptP; - switch (word->_id) { - case 108: - _sentence->_field2C = 8; - break; - case 113: - if (!_sentenceConcept->_concept3P) - _sentence->_field2C = 22; - break; - case 304: - _sentence->_field2C = 25; - break; - case 305: - _sentence->_field2C = 24; - break; - case 306: - _sentence->_field2C = 7; - break; - case 501: - _sentence->_field2C = 9; - break; - case 900: - _sentence->_field2C = 5; - break; - case 901: - _sentence->_field2C = 4; - break; - case 904: - _sentence->_field2C = 6; - break; - case 905: - _sentence->_field2C = 11; - break; - case 906: + case ACTOR_IS_OBJECT: + flag = resetConcept(&_sentenceConcept->_concept0P, 2); + break; + + case WORD_TYPE_IS_SENTENCE_TYPE: + if (_sentence->_field2C == 1 || _sentence->_field2C == 10) { + for (TTword *wordP = _currentWordP; wordP; wordP = wordP->_nextP) { + if (wordP->_id == 906) { _sentence->_field2C = 12; + flag = true; break; - case 907: - _sentence->_field2C = 13; - break; - case 908: - _sentence->_field2C = 2; - if (!_sentenceConcept->_concept0P) { - newPictP = new TTpicture(TTstring("?"), WC_THING, 0, 0, 0, 0, 0); - newConceptP = new TTconcept(newPictP); - - _sentenceConcept->_concept0P = newConceptP; - delete newPictP; - addNode(4); - } - break; - case 909: - _sentence->_field2C = 3; + } + } + + TTpicture *newPictP; + TTconcept *newConceptP; + switch (word->_id) { + case 108: + _sentence->_field2C = 8; + break; + case 113: + if (!_sentenceConcept->_concept3P) + _sentence->_field2C = 22; + break; + case 304: + _sentence->_field2C = 25; + break; + case 305: + _sentence->_field2C = 24; + break; + case 306: + _sentence->_field2C = 7; + break; + case 501: + _sentence->_field2C = 9; + break; + case 900: + _sentence->_field2C = 5; + break; + case 901: + _sentence->_field2C = 4; + break; + case 904: + _sentence->_field2C = 6; + break; + case 905: + _sentence->_field2C = 11; + break; + case 906: + _sentence->_field2C = 12; + break; + case 907: + _sentence->_field2C = 13; + break; + case 908: + _sentence->_field2C = 2; + if (!_sentenceConcept->_concept0P) { newPictP = new TTpicture(TTstring("?"), WC_THING, 0, 0, 0, 0, 0); newConceptP = new TTconcept(newPictP); - - _sentenceConcept->_concept2P = newConceptP; + + _sentenceConcept->_concept0P = newConceptP; delete newPictP; addNode(4); - break; - - default: - break; } - } + break; + case 909: + _sentence->_field2C = 3; + newPictP = new TTpicture(TTstring("?"), WC_THING, 0, 0, 0, 0, 0); + newConceptP = new TTconcept(newPictP); + + _sentenceConcept->_concept2P = newConceptP; + delete newPictP; + addNode(4); + break; - flag = true; - break; + default: + break; + } + } - case COMPLEX_VERB: - if (word->_wordClass == WC_ACTION) { - flag = true; - } else if (!_sentenceConcept->_concept1P) { - TTstring wordStr = word->getText(); - if (wordStr == "do" || wordStr == "doing" || wordStr == "does" || wordStr == "done") { - TTaction *verbP = new TTaction(TTstring("do"), WC_ACTION, 112, 0, - _sentenceConcept->get18()); - status = _sentenceConcept->createConcept(1, 1, verbP); - delete verbP; - } + flag = true; + break; - flag = true; + case COMPLEX_VERB: + if (word->_wordClass == WC_ACTION) { + flag = true; + } else if (!_sentenceConcept->_concept1P) { + TTstring wordStr = word->getText(); + if (wordStr == "do" || wordStr == "doing" || wordStr == "does" || wordStr == "done") { + TTaction *verbP = new TTaction(TTstring("do"), WC_ACTION, 112, 0, + _sentenceConcept->get18()); + status = _sentenceConcept->createConcept(1, 1, verbP); + delete verbP; } - break; - default: - break; + flag = true; } + break; + + case MKTAG('C', 'O', 'M', 'E'): + addNode(7); + addNode(5); + addNode(21); + + if (!_sentence->_field2C) + _sentence->_field2C = 15; + break; + + case MKTAG('C', 'U', 'R', 'S'): + case MKTAG('S', 'E', 'X', 'X'): + if (_sentence->_field58 > 1) + _sentence->_field58--; + flag = true; + break; + + case MKTAG('E', 'X', 'I', 'T'): + addNode(8); + addNode(5); + addNode(21); + + if (!_sentence->_field2C) + _sentence->_field2C = 14; + break; + + default: + break; } } -- cgit v1.2.3 From a261041be74b42dd9877acd9968e53641fd62587 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 28 May 2016 14:33:45 -0400 Subject: TITANIC: Adding tag switches to TTparser considerRequests --- engines/titanic/true_talk/tt_concept.cpp | 9 +++++++ engines/titanic/true_talk/tt_concept.h | 2 ++ engines/titanic/true_talk/tt_parser.cpp | 42 ++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+) diff --git a/engines/titanic/true_talk/tt_concept.cpp b/engines/titanic/true_talk/tt_concept.cpp index 30ecce1c3b..c614e14dae 100644 --- a/engines/titanic/true_talk/tt_concept.cpp +++ b/engines/titanic/true_talk/tt_concept.cpp @@ -288,6 +288,15 @@ TTconcept *TTconcept::findByWordClass(WordClass wordClass) { return nullptr; } +TTconcept *TTconcept::findBy20(int val) { + for (TTconcept *conceptP = this; conceptP; conceptP = conceptP->_nextP) { + if (conceptP->_field20 == val) + return conceptP; + } + + return nullptr; +} + bool TTconcept::isWordId(int id) const { return this && _wordP && _wordP->_id == id; } diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index 4584b514c7..97cc70e41d 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -153,6 +153,8 @@ public: */ TTconcept *findByWordClass(WordClass wordClass); + TTconcept *findBy20(int val); + /** * Returns true if the concept has a word with a given Id */ diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index f397173ae8..664dcf7ced 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -1173,6 +1173,48 @@ int TTparser::considerRequests(TTword *word) { _sentence->_field2C = 14; break; + case MKTAG('F', 'A', 'R', 'R'): + if (_conceptP->findBy20(0)) + _conceptP->_field20 = 2; + break; + + case MKTAG('F', 'U', 'T', 'R'): + _sentenceConcept->_field18 = 3; + break; + + case MKTAG('G', 'O', 'G', 'O'): + addNode(7); + addNode(5); + addNode(21); + + if (_sentence->_field2C == 1) + _sentence->_field2C = 14; + + flag = true; + break; + + case MKTAG('H', 'E', 'L', 'P'): + if (_sentence->_field2C == 1) + _sentence->_field2C = 18; + + flag = true; + break; + + case MKTAG('L', 'O', 'C', 'F'): + status = _sentenceConcept->createConcept(1, 5, word); + if (!status) { + _sentenceConcept->_concept5P->_field20 = 2; + flag = true; + } + break; + + case MKTAG('T', 'E', 'A', 'C'): + if (_sentence->_field2C == 1) + _sentence->_field2C = 10; + + flag = true; + break; + default: break; } -- cgit v1.2.3 From fb6e94e8bbe6e5fa2656f3a134b015cf4e986364 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 28 May 2016 15:32:14 -0400 Subject: TITANIC: Remaining tag switch cases in TTparser considerRequests --- engines/titanic/true_talk/tt_parser.cpp | 63 +++++++++++++++++++++++++++++++-- engines/titanic/true_talk/tt_parser.h | 2 +- 2 files changed, 61 insertions(+), 4 deletions(-) diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 664dcf7ced..91bc82db70 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -763,6 +763,7 @@ int TTparser::considerRequests(TTword *word) { break; case SEEK_ACTOR: + case MKTAG('S', 'A', 'C', 'T'): if (!_sentenceConcept->_concept0P) { flag = filterConcepts(5, 0); } else if (_sentenceConcept->_concept0P->compareTo("?") && @@ -1202,10 +1203,59 @@ int TTparser::considerRequests(TTword *word) { case MKTAG('L', 'O', 'C', 'F'): status = _sentenceConcept->createConcept(1, 5, word); - if (!status) { + if (!status) _sentenceConcept->_concept5P->_field20 = 2; - flag = true; + + flag = true; + break; + + case MKTAG('L', 'O', 'C', 'N'): + status = _sentenceConcept->createConcept(1, 5, word); + if (!status) + _sentenceConcept->_concept5P->_field20 = 1; + + flag = true; + break; + + case MKTAG('N', 'E', 'A', 'R'): + if (_conceptP->findBy20(0)) { + _conceptP->_field20 = 1; + } else { + TTpicture *newPictP = new TTpicture(TTstring("?"), WC_THING, 0, 0, 0, 0, 0); + status = addToConceptList(newPictP); + _conceptP->_field20 = 1; + if (!status) + delete newPictP; } + + flag = true; + break; + + case MKTAG('P', 'A', 'S', 'T'): + _sentenceConcept->_field18 = 1; + flag = true; + break; + + case MKTAG('P', 'L', 'E', 'Z'): + if (_sentence->_field58 < 10) + _sentence->_field58++; + break; + + case MKTAG('P', 'R', 'E', 'Z'): + _sentenceConcept->_field18 = 2; + flag = true; + break; + + case MKTAG('S', 'A', 'A', 'O'): + addNode(5); + addNode(4); + flag = true; + break; + + case MKTAG('S', 'S', 'T', 'A'): + addNode(13); + addNode(5); + flag = true; break; case MKTAG('T', 'E', 'A', 'C'): @@ -1215,7 +1265,13 @@ int TTparser::considerRequests(TTword *word) { flag = true; break; + case MKTAG('V', 'O', 'B', 'J'): + status = _sentenceConcept->createConcept(1, 2, word); + flag = true; + break; + default: + flag = true; break; } } @@ -1266,9 +1322,10 @@ int TTparser::processRequests(TTword *word) { return status; } -void TTparser::addToConceptList(TTword *word) { +int TTparser::addToConceptList(TTword *word) { TTconcept *concept = new TTconcept(word, ST_UNKNOWN_SCRIPT); addConcept(concept); + return 0; } void TTparser::addNode(uint tag) { diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h index 7aa47fd12c..201de7eb0e 100644 --- a/engines/titanic/true_talk/tt_parser.h +++ b/engines/titanic/true_talk/tt_parser.h @@ -146,7 +146,7 @@ private: int considerRequests(TTword *word); int processRequests(TTword *word); - void addToConceptList(TTword *word); + int addToConceptList(TTword *word); int checkReferent(TTpronoun *pronoun); /** -- cgit v1.2.3 From 15843eb4c23c3d8ac88edd9b482fae09d4414582 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 28 May 2016 16:03:39 -0400 Subject: TITANIC: Remainder of TTparser considerRequests --- engines/titanic/true_talk/tt_parser.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 91bc82db70..3014ebaa07 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -725,17 +725,16 @@ int TTparser::loadRequests(TTword *word) { } int TTparser::considerRequests(TTword *word) { - if (_nodesP) + if (!_nodesP || !word) return 0; - - TTparserNode *nodeP = _nodesP; + TTconcept *concept = nullptr; int status = 0; bool flag = false; bool modifierFlag = false; int seekVal = 0; - while (word) { + for (TTparserNode *nodeP = _nodesP; nodeP; ) { switch (nodeP->_tag) { case CHECK_COMMAND_FORM: if (_sentenceConcept->_concept1P && _sentence->_field2C == 1 && @@ -1274,9 +1273,13 @@ int TTparser::considerRequests(TTword *word) { flag = true; break; } + + TTparserNode *nextP = static_cast(nodeP->_nextP); + if (flag) + delete nodeP; + nodeP = nextP; } - // TODO delete concept; return status; } -- cgit v1.2.3 From fa04a6fdf0271f74c45da180b3c6f1ac16bd3a98 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 28 May 2016 18:13:09 -0400 Subject: TITANIC: Added CTrueTalkManager playSpeech --- engines/titanic/core/view_item.cpp | 4 + engines/titanic/core/view_item.h | 2 + engines/titanic/sound/sound.cpp | 5 + engines/titanic/sound/sound.h | 7 ++ engines/titanic/support/proximity.cpp | 5 +- engines/titanic/support/proximity.h | 15 ++- engines/titanic/true_talk/true_talk_manager.cpp | 119 ++++++++++++++++++++++-- engines/titanic/true_talk/true_talk_manager.h | 9 +- engines/titanic/true_talk/tt_talker.cpp | 2 +- engines/titanic/true_talk/tt_talker.h | 8 +- 10 files changed, 156 insertions(+), 20 deletions(-) diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index b829ae5a70..07c01423e0 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -306,4 +306,8 @@ void CViewItem::handleButtonUpMsg(CMouseButtonUpMsg *msg) { } } +void CViewItem::fn1(double val1, double val2, double val3) { + warning("TODO: CViewItem::fn1"); +} + } // End of namespace Titanic diff --git a/engines/titanic/core/view_item.h b/engines/titanic/core/view_item.h index 67b2113142..d85117a0ec 100644 --- a/engines/titanic/core/view_item.h +++ b/engines/titanic/core/view_item.h @@ -96,6 +96,8 @@ public: * Finds a link which connects to another designated view */ CLinkItem *findLink(CViewItem *newView); + + void fn1(double val1, double val2, double val3); }; } // End of namespace Titanic diff --git a/engines/titanic/sound/sound.cpp b/engines/titanic/sound/sound.cpp index cf7689d937..dc8d0eeb21 100644 --- a/engines/titanic/sound/sound.cpp +++ b/engines/titanic/sound/sound.cpp @@ -69,6 +69,11 @@ void CSound::fn3(int handle, int val2, int val3) { warning("TODO: CSound::fn3"); } +int CSound::playSpeech(CDialogueFile *dialogueFile, int speechId, const CProximity &prox) { + warning("TODO: CSound::playSpeech"); + return 0; +} + uint CSound::loadSound(const CString &name) { checkSounds(); diff --git a/engines/titanic/sound/sound.h b/engines/titanic/sound/sound.h index 33996de1ca..f550493624 100644 --- a/engines/titanic/sound/sound.h +++ b/engines/titanic/sound/sound.h @@ -24,6 +24,7 @@ #define TITANIC_SOUND_H #include "titanic/support/simple_file.h" +#include "titanic/support/proximity.h" #include "titanic/sound/sound_manager.h" #include "titanic/core/list.h" #include "titanic/core/view_item.h" @@ -118,6 +119,12 @@ public: bool fn1(int val); void fn2(int handle); void fn3(int handle, int val2, int val3); + + /** + * Play a speech + */ + int playSpeech(CDialogueFile *dialogueFile, int speechId, const CProximity &prox); + void managerProc8(int v) { _soundManager.proc8(v); } CSoundItem *getTrueTalkSound(CDialogueFile *dialogueFile, int index); diff --git a/engines/titanic/support/proximity.cpp b/engines/titanic/support/proximity.cpp index f7c90f7caf..4a832b9217 100644 --- a/engines/titanic/support/proximity.cpp +++ b/engines/titanic/support/proximity.cpp @@ -21,16 +21,17 @@ */ #include "titanic/support/proximity.h" +#include "titanic/true_talk/tt_talker.h" namespace Titanic { CProximity::CProximity() : _field4(0), _field8(100), _fieldC(0), - _field10(-1), _field14(0), _field18(0), _field1C(0x3FF00000), + _speechHandle(-1), _field14(0), _field18(0), _field1C(0x3FF00000), _field20(0), _field24(10), _field28(0), _field2C(0), _field30(0x3F000000), _field34(0), _double1(0.0), _double2(0.0), _double3(0.0), _field44(0), _field48(0), _field4C(0), _field50(0), _field54(0), _field58(0), _field5C(0), - _field60(0), _field64(0), _field68(0) { + _field60(0), _method1(nullptr), _talker(nullptr), _field6C(0) { } } // End of namespace Titanic diff --git a/engines/titanic/support/proximity.h b/engines/titanic/support/proximity.h index 69979eaeaf..935e2e6b1c 100644 --- a/engines/titanic/support/proximity.h +++ b/engines/titanic/support/proximity.h @@ -23,21 +23,27 @@ #ifndef TITANIC_PROXIMITY_H #define TITANIC_PROXIMITY_H +#include "common/scummsys.h" + namespace Titanic { +typedef bool (*CProximityFn)(int val); + +class TTtalker; + class CProximity { public: int _field4; int _field8; int _fieldC; - int _field10; + int _speechHandle; int _field14; int _field18; int _field1C; int _field20; int _field24; int _field28; - int _field2C; + uint32 _field2C; int _field30; int _field34; double _double1; @@ -51,8 +57,9 @@ public: int _field58; int _field5C; int _field60; - int _field64; - int _field68; + CProximityFn _method1; + TTtalker *_talker; + int _field6C; public: CProximity(); }; diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index da3b207434..bff4ba60ba 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -24,6 +24,7 @@ #include "titanic/core/tree_item.h" #include "titanic/npcs/true_talk_npc.h" #include "titanic/game_manager.h" +#include "titanic/titanic.h" #define MKTAG_BE(a3,a2,a1,a0) ((uint32)((a3) | ((a2) << 8) | ((a1) << 16) | ((a0) << 24))) @@ -195,14 +196,14 @@ void CTrueTalkManager::saveNPC(SimpleFile *file, int charId) const { void CTrueTalkManager::preLoad() { // Delete any previous talkers - for (TTTalkerList::iterator i = _talkers.begin(); i != _talkers.end(); ++i) + for (TTtalkerList::iterator i = _talkers.begin(); i != _talkers.end(); ++i) delete *i; _talkers.clear(); } void CTrueTalkManager::removeCompleted() { - for (TTTalkerList::iterator i = _talkers.begin(); i != _talkers.end(); ) { - TTTalker *talker = *i; + for (TTtalkerList::iterator i = _talkers.begin(); i != _talkers.end(); ) { + TTtalker *talker = *i; if (talker->_done) { i = _talkers.erase(i); @@ -327,12 +328,12 @@ void CTrueTalkManager::setDialogue(CTrueTalkNPC *npc, TTroomScript *roomScript, return; int soundId = readDialogSound(); - TTTalker *talker = new TTTalker(this, npc); + TTtalker *talker = new TTtalker(this, npc); _talkers.push_back(talker); bool isParrot = npc->getName().contains("parrot"); triggerNPC(npc); - setTalker(talker, roomScript, view, isParrot); + playSpeech(talker, roomScript, view, isParrot); talker->speechStarted(dialogueStr, _titleEngine._indexes[0], soundId); } @@ -422,8 +423,107 @@ void CTrueTalkManager::triggerNPC(CTrueTalkNPC *npc) { } } -void CTrueTalkManager::setTalker(TTTalker *talker, TTroomScript *roomScript, CViewItem *view, bool isParrot) { - warning("TODO: CTrueTalkManager::setTalker"); +void CTrueTalkManager::playSpeech(TTtalker *talker, TTroomScript *roomScript, CViewItem *view, bool isParrot) { + uint milli, index; + switch (roomScript->_scriptId) { + case 101: + milli = 300; + index = 16; + break; + case 106: + case 107: + case 110: + case 114: + case 115: + case 122: + milli = 130; + index = 10; + break; + case 108: + case 109: + milli = 200; + index = 10; + break; + case 111: + case 116: + case 121: + milli = 80; + index = 12; + break; + case 112: + case 124: + case 128: + case 130: + milli = 80; + index = 4; + break; + case 132: + milli = 60; + index = 4; + break; + default: + milli = 0; + index = 4; + break; + } + + // Setup proximities + CProximity p1, p2, p3; + if (isParrot) { + p1._field24 = 3; + p2._field24 = 5; + p3._field24 = 4; + } else { + p1._field24 = 0; + p2._field24 = 1; + p3._field24 = 2; + } + + if (milli > 0) { + p3._field8 = (index * 3) / 2; + p3._field28 = 1; + p3._field2C = 0xC3070000; + p3._field30 = 0x3F800000; + p3._field34 = 0; + + p3._field8 = (index * 3) / 4; + p2._field28 = 0; + p2._field2C = 0x43070000; + p2._field30 = 0x3F800000; + p2._field34 = 0; + } + + _gameManager->_sound.managerProc8(p1._field24); + if (view) { + p1._field28 = 2; + view->fn1(p1._double1, p1._double2, p1._double3); + } + + for (uint idx = 0; idx < _titleEngine._indexes.size(); ++idx) { + uint id = _titleEngine._indexes[idx]; + if (id > 100000) + continue; + + if (idx == (_titleEngine._indexes.size() - 1)) { + // Final iteration of speech segments to play + p1._method1 = &proximityMethod1; + p1._talker = talker; + } + + // Start the + p1._speechHandle = _gameManager->_sound.playSpeech(_dialogueFile, id - _dialogueId, p1); + if (!milli) + continue; + + if (idx == 0) + g_vm->_events->sleep(milli); + + p3._speechHandle = _gameManager->_sound.playSpeech(_dialogueFile, id - _dialogueId, p3); + if (idx == 0) + g_vm->_events->sleep(milli); + + p2._speechHandle = _gameManager->_sound.playSpeech(_dialogueFile, id - _dialogueId, p2); + } } int CTrueTalkManager::getStateVal(int stateNum) { @@ -444,4 +544,9 @@ bool CTrueTalkManager::triggerAction(int action, int param) { return true; } +bool CTrueTalkManager::proximityMethod1(int val) { + // TODO + return false; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index 524f13e1f2..3467fe1cb5 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -47,7 +47,7 @@ private: CDialogueFile *_dialogueFile; int _dialogueId; int _field18; - TTTalkerList _talkers; + TTtalkerList _talkers; private: /** * Loads the statics for the class @@ -101,7 +101,12 @@ private: */ void triggerNPC(CTrueTalkNPC *npc); - void setTalker(TTTalker *talker, TTroomScript *roomScript, CViewItem *view, bool isParrot); + /** + * Plays speech specified by the manager's indexes array + */ + void playSpeech(TTtalker *talker, TTroomScript *roomScript, CViewItem *view, bool isParrot); + + static bool proximityMethod1(int val); public: static int _v1; static int _v2; diff --git a/engines/titanic/true_talk/tt_talker.cpp b/engines/titanic/true_talk/tt_talker.cpp index 3e86fdf597..1eb7fc8b2e 100644 --- a/engines/titanic/true_talk/tt_talker.cpp +++ b/engines/titanic/true_talk/tt_talker.cpp @@ -25,7 +25,7 @@ namespace Titanic { -void TTTalker::speechStarted(const CString &dialogueStr, uint dialogueId, uint soundId) { +void TTtalker::speechStarted(const CString &dialogueStr, uint dialogueId, uint soundId) { _dialogueId = dialogueId; CTrueTalkNotifySpeechStartedMsg msg(soundId, dialogueId, 0); diff --git a/engines/titanic/true_talk/tt_talker.h b/engines/titanic/true_talk/tt_talker.h index 622bcc67d1..9bb59fbe64 100644 --- a/engines/titanic/true_talk/tt_talker.h +++ b/engines/titanic/true_talk/tt_talker.h @@ -31,7 +31,7 @@ namespace Titanic { class CTrueTalkManager; -class TTTalker : public ListItem { +class TTtalker : public ListItem { public: CTrueTalkManager *_owner; CTrueTalkNPC *_npc; @@ -40,15 +40,15 @@ public: int _field24; int _done; public: - TTTalker() : _owner(nullptr), _npc(nullptr), + TTtalker() : _owner(nullptr), _npc(nullptr), _dialogueId(0), _field24(0), _done(0) {} - TTTalker(CTrueTalkManager *owner, CTrueTalkNPC *npc) : + TTtalker(CTrueTalkManager *owner, CTrueTalkNPC *npc) : _owner(owner), _npc(npc), _dialogueId(0), _field24(0), _done(0) {} void speechStarted(const CString &dialogueStr, uint dialogueId, uint soundId); }; -class TTTalkerList : public List { +class TTtalkerList : public List { }; } // End of namespace Titanic -- cgit v1.2.3 From 66a2500928dffba83622d274c37bf26ceda00caf Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 28 May 2016 18:37:20 -0400 Subject: TITANIC: Added CTurnOnObject message handlers --- engines/titanic/core/turn_on_object.cpp | 21 ++++++++++++++++++--- engines/titanic/core/turn_on_object.h | 5 ++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/engines/titanic/core/turn_on_object.cpp b/engines/titanic/core/turn_on_object.cpp index b4ed2b4525..a24843b3bb 100644 --- a/engines/titanic/core/turn_on_object.cpp +++ b/engines/titanic/core/turn_on_object.cpp @@ -24,21 +24,36 @@ namespace Titanic { -CTurnOnObject::CTurnOnObject() : CBackground(), _string3("NULL") { +BEGIN_MESSAGE_MAP(CTurnOnObject, CBackground) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(MouseButtonUpMsg) +END_MESSAGE_MAP() + +CTurnOnObject::CTurnOnObject() : CBackground(), _msgName("NULL") { } void CTurnOnObject::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); - file->writeQuotedLine(_string3, indent); + file->writeQuotedLine(_msgName, indent); CBackground::save(file, indent); } void CTurnOnObject::load(SimpleFile *file) { file->readNumber(); - _string3 = file->readString(); + _msgName = file->readString(); CBackground::load(file); } +bool CTurnOnObject::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + return true; +} + +bool CTurnOnObject::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + CTurnOn turnOn; + turnOn.execute(_msgName); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/core/turn_on_object.h b/engines/titanic/core/turn_on_object.h index d87e205983..3ac5a897f1 100644 --- a/engines/titanic/core/turn_on_object.h +++ b/engines/titanic/core/turn_on_object.h @@ -28,8 +28,11 @@ namespace Titanic { class CTurnOnObject : public CBackground { + DECLARE_MESSAGE_MAP + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); protected: - CString _string3; + CString _msgName; public: CLASSDEF CTurnOnObject(); -- cgit v1.2.3 From 1f4eca3d061d85cdc11a8e20834c14de082baedc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 28 May 2016 18:50:54 -0400 Subject: TITANIC: Message handler stubs for CDeskbot --- engines/titanic/npcs/deskbot.cpp | 69 ++++++++++++++++++++++++++++++++++++++++ engines/titanic/npcs/deskbot.h | 12 +++++++ 2 files changed, 81 insertions(+) diff --git a/engines/titanic/npcs/deskbot.cpp b/engines/titanic/npcs/deskbot.cpp index c4745ae8d6..e0e147fabf 100644 --- a/engines/titanic/npcs/deskbot.cpp +++ b/engines/titanic/npcs/deskbot.cpp @@ -24,6 +24,20 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CDeskbot, CTrueTalkNPC) + ON_MESSAGE(TurnOn) + ON_MESSAGE(EnterViewMsg) + ON_MESSAGE(ActMsg) + ON_MESSAGE(MovieEndMsg) + ON_MESSAGE(LeaveViewMsg) + ON_MESSAGE(TrueTalkTriggerActionMsg) + ON_MESSAGE(NPCPlayTalkingAnimationMsg) + ON_MESSAGE(NPCPlayIdleAnimationMsg) + ON_MESSAGE(TrueTalkNotifySpeechStartedMsg) + ON_MESSAGE(TrueTalkNotifySpeechEndedMsg) + ON_MESSAGE(TurnOff) +END_MESSAGE_MAP() + int CDeskbot::_v1; int CDeskbot::_v2; @@ -50,4 +64,59 @@ void CDeskbot::load(SimpleFile *file) { CTrueTalkNPC::load(file); } +bool CDeskbot::TurnOn(CTurnOn *msg) { + // TODO + return true; +} + +bool CDeskbot::EnterViewMsg(CEnterViewMsg *msg) { + // TODO + return true; +} + +bool CDeskbot::ActMsg(CActMsg *msg) { + // TODO + return true; +} + +bool CDeskbot::MovieEndMsg(CMovieEndMsg *msg) { + // TODO + return true; +} + +bool CDeskbot::LeaveViewMsg(CLeaveViewMsg *msg) { + // TODO + return true; +} + +bool CDeskbot::TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg) { + // TODO + return true; +} + +bool CDeskbot::NPCPlayTalkingAnimationMsg(CNPCPlayTalkingAnimationMsg *msg) { + // TODO + return true; +} + +bool CDeskbot::NPCPlayIdleAnimationMsg(CNPCPlayIdleAnimationMsg *msg) { + // TODO + return true; +} + +bool CDeskbot::TrueTalkNotifySpeechStartedMsg(CTrueTalkNotifySpeechStartedMsg *msg) { + // TODO + return true; +} + +bool CDeskbot::TrueTalkNotifySpeechEndedMsg(CTrueTalkNotifySpeechEndedMsg *msg) { + // TODO + return true; +} + +bool CDeskbot::TurnOff(CTurnOff *msg) { + // TODO + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/npcs/deskbot.h b/engines/titanic/npcs/deskbot.h index 50c3e3fb46..2711e9cc43 100644 --- a/engines/titanic/npcs/deskbot.h +++ b/engines/titanic/npcs/deskbot.h @@ -28,6 +28,18 @@ namespace Titanic { class CDeskbot : public CTrueTalkNPC { + DECLARE_MESSAGE_MAP + bool TurnOn(CTurnOn *msg); + bool EnterViewMsg(CEnterViewMsg *msg); + bool ActMsg(CActMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); + bool LeaveViewMsg(CLeaveViewMsg *msg); + bool TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg); + bool NPCPlayTalkingAnimationMsg(CNPCPlayTalkingAnimationMsg *msg); + bool NPCPlayIdleAnimationMsg(CNPCPlayIdleAnimationMsg *msg); + bool TrueTalkNotifySpeechStartedMsg(CTrueTalkNotifySpeechStartedMsg *msg); + bool TrueTalkNotifySpeechEndedMsg(CTrueTalkNotifySpeechEndedMsg *msg); + bool TurnOff(CTurnOff *msg); private: static int _v1; static int _v2; -- cgit v1.2.3 From a7ecc6d601f1beabd0f5538d5e1cd7d6e983d2b9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 28 May 2016 19:52:48 -0400 Subject: TITANIC: Adding CDeskbot message handlers --- engines/titanic/carry/magazine.cpp | 2 +- engines/titanic/core/game_object.cpp | 28 +++++++++++ engines/titanic/core/game_object.h | 17 +++++++ engines/titanic/npcs/deskbot.cpp | 90 ++++++++++++++++++++++++++++++---- engines/titanic/npcs/deskbot.h | 4 +- engines/titanic/npcs/true_talk_npc.cpp | 2 +- engines/titanic/npcs/true_talk_npc.h | 10 +++- 7 files changed, 138 insertions(+), 15 deletions(-) diff --git a/engines/titanic/carry/magazine.cpp b/engines/titanic/carry/magazine.cpp index ac74da8c71..68d898c399 100644 --- a/engines/titanic/carry/magazine.cpp +++ b/engines/titanic/carry/magazine.cpp @@ -54,7 +54,7 @@ void CMagazine::load(SimpleFile *file) { bool CMagazine::UseWithCharMsg(CUseWithCharMsg *msg) { CDeskbot *deskbot = static_cast(msg->_character); if (deskbot) { - if (deskbot->_field108) { + if (deskbot->_deskbotActive) { setVisible(false); setPosition(Point(1000, 1000)); CActMsg actMsg("2ndClassUpgrade"); diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 5a214871c6..f386c1eb51 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -707,6 +707,30 @@ void CGameObject::incState38() { getGameManager()->_gameState.inc38(); } +void CGameObject::inc54() { + getGameManager()->inc54(); +} + +void CGameObject::dec54() { + getGameManager()->dec54(); +} + +void CGameObject::lockMouse() { + CGameManager *gameMan = getGameManager(); + gameMan->lockInputHandler(); + + if (CScreenManager::_screenManagerPtr->_mouseCursor) + CScreenManager::_screenManagerPtr->_mouseCursor->hide(); +} + +void CGameObject::unlockMouse() { + if (CScreenManager::_screenManagerPtr->_mouseCursor) + CScreenManager::_screenManagerPtr->_mouseCursor->show(); + + CGameManager *gameMan = getGameManager(); + gameMan->unlockInputHandler(); +} + void CGameObject::startTalking(const CString &npcName, uint id, CViewItem *view) { CTrueTalkNPC *npc = static_cast(getRoot()->findByName(npcName)); startTalking(npc, id, view); @@ -721,6 +745,10 @@ void CGameObject::startTalking(CTrueTalkNPC *npc, uint id, CViewItem *view) { } } +void CGameObject::endTalking(CTrueTalkNPC *npc, uint id, CViewItem *view) { + warning("TODO: CGameObject::endTalking"); +} + void CGameObject::loadSurface() { if (!_surface && !_resource.empty()) { loadResource(_resource); diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 87cc2baa7e..10847c816c 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -126,6 +126,18 @@ protected: void petFn2(int val); void petFn3(CTreeItem *item); void incState38(); + void inc54(); + void dec54(); + + /** + * Locks/hides the mouse + */ + void lockMouse(); + + /** + * Unlocks/shows the mouse + */ + void unlockMouse(); /** * Load a sound @@ -227,6 +239,11 @@ protected: */ void startTalking(CTrueTalkNPC *npc, uint id, CViewItem *view = nullptr); + /** + * Stop a conversation with the NPC + */ + void endTalking(CTrueTalkNPC *npc, uint id, CViewItem *view = nullptr); + /** * Load the surface */ diff --git a/engines/titanic/npcs/deskbot.cpp b/engines/titanic/npcs/deskbot.cpp index e0e147fabf..dcd27466db 100644 --- a/engines/titanic/npcs/deskbot.cpp +++ b/engines/titanic/npcs/deskbot.cpp @@ -41,14 +41,14 @@ END_MESSAGE_MAP() int CDeskbot::_v1; int CDeskbot::_v2; -CDeskbot::CDeskbot() : CTrueTalkNPC(), _field108(0), _field10C(0) { +CDeskbot::CDeskbot() : CTrueTalkNPC(), _deskbotActive(false), _field10C(0) { } void CDeskbot::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); file->writeNumberLine(_v1, indent); file->writeNumberLine(_v2, indent); - file->writeNumberLine(_field108, indent); + file->writeNumberLine(_deskbotActive, indent); file->writeNumberLine(_field10C, indent); CTrueTalkNPC::save(file, indent); @@ -58,34 +58,99 @@ void CDeskbot::load(SimpleFile *file) { file->readNumber(); _v1 = file->readNumber(); _v2 = file->readNumber(); - _field108 = file->readNumber(); + _deskbotActive = file->readNumber(); _field10C = file->readNumber(); CTrueTalkNPC::load(file); } bool CDeskbot::TurnOn(CTurnOn *msg) { - // TODO + if (!_deskbotActive) { + setVisible(true); + playClip("BellRinging", 4); + playSound("b#69.wav"); + setPetArea(PET_CONVERSATION); + + _npcFlags |= NPCFLAG_20000; + _deskbotActive = true; + } + return true; } bool CDeskbot::EnterViewMsg(CEnterViewMsg *msg) { - // TODO + setVisible(false); + _deskbotActive = false; + _fieldC4 = 0; + loadFrame(625); + return true; } bool CDeskbot::ActMsg(CActMsg *msg) { - // TODO + if (msg->_action == "2ndClassUpgrade" && getPassengerClass() > 2) { + startTalking(this, 140, findView()); + } + return true; } bool CDeskbot::MovieEndMsg(CMovieEndMsg *msg) { - // TODO + bool flag = false; + if (_npcFlags & NPCFLAG_10000) { + if (_field10C) { + setPetArea(PET_ROOMS); + dec54(); + unlockMouse(); + playSound("z#47.wav", 100, 0, 0); + _field10C = false; + } + + _npcFlags &= ~NPCFLAG_10000; + flag = true; + } + + bool flag = false; + if (_npcFlags & NPCFLAG_40000) { + _deskbotActive = false; + _npcFlags &= ~(NPCFLAG_40000 | NPCFLAG_20000); + + if (_npcFlags & NPCFLAG_80000) { + CTurnOn turnOn; + turnOn.execute("EmbBellbotTrigger"); + unlockMouse(); + changeView("EmbLobby.Node 4.N", ""); + } else if (_npcFlags & NPCFLAG_100000) { + CTurnOn turnOn; + turnOn.execute("EmbDoorBotTrigger"); + unlockMouse(); + changeView("EmbLobby.Node 4.N", ""); + } + + _npcFlags &= ~(NPCFLAG_80000 | NPCFLAG_100000); + flag = true; + } + + if (_npcFlags & NPCFLAG_20000) { + _npcFlags &= ~(NPCFLAG_40000 | NPCFLAG_20000); + endTalking(this, 1, findView()); + + _npcFlags |= NPCFLAG_4; + flag = true; + } + + if (!flag) + CTrueTalkNPC::MovieEndMsg(msg); + return true; } bool CDeskbot::LeaveViewMsg(CLeaveViewMsg *msg) { - // TODO + if (_deskbotActive) { + CTurnOff turnOff; + turnOff.execute(this); + } + return true; } @@ -115,7 +180,14 @@ bool CDeskbot::TrueTalkNotifySpeechEndedMsg(CTrueTalkNotifySpeechEndedMsg *msg) } bool CDeskbot::TurnOff(CTurnOff *msg) { - // TODO + if (_deskbotActive) { + stopMovie(); + performAction(1, findView()); + + _npcFlags = (_npcFlags & ~(NPCFLAG_SPEAKING | NPCFLAG_2 | NPCFLAG_4)) | NPCFLAG_40000; + playClip("Closing", 0x14); + } + return true; } diff --git a/engines/titanic/npcs/deskbot.h b/engines/titanic/npcs/deskbot.h index 2711e9cc43..607255be57 100644 --- a/engines/titanic/npcs/deskbot.h +++ b/engines/titanic/npcs/deskbot.h @@ -44,8 +44,8 @@ private: static int _v1; static int _v2; public: - int _field108; - int _field10C; + bool _deskbotActive; + bool _field10C; public: CLASSDEF CDeskbot(); diff --git a/engines/titanic/npcs/true_talk_npc.cpp b/engines/titanic/npcs/true_talk_npc.cpp index 297de59178..ba2de20de9 100644 --- a/engines/titanic/npcs/true_talk_npc.cpp +++ b/engines/titanic/npcs/true_talk_npc.cpp @@ -197,7 +197,7 @@ void CTrueTalkNPC::processInput(CTextInputMsg *msg, CViewItem *view) { talkManager->processInput(this, msg, view); } -void CTrueTalkNPC::performAction(int val1, int val2) { +void CTrueTalkNPC::performAction(int actionNum, CViewItem *view) { // TODO } diff --git a/engines/titanic/npcs/true_talk_npc.h b/engines/titanic/npcs/true_talk_npc.h index 8277b55e45..a1303c3e5d 100644 --- a/engines/titanic/npcs/true_talk_npc.h +++ b/engines/titanic/npcs/true_talk_npc.h @@ -30,7 +30,9 @@ namespace Titanic { enum NpcFlag { - NPCFLAG_SPEAKING = 1, NPCFLAG_2 = 2, NPCFLAG_4 = 4, NPCFLAG_8 = 8 + NPCFLAG_SPEAKING = 1, NPCFLAG_2 = 2, NPCFLAG_4 = 4, NPCFLAG_8 = 8, + NPCFLAG_10000 = 0x10000, NPCFLAG_20000 = 0x20000, NPCFLAG_40000 = 0x40000, + NPCFLAG_80000 = 0x80000, NPCFLAG_100000 = 0x100000 }; class CViewItem; @@ -60,7 +62,11 @@ protected: int _field104; protected: void processInput(CTextInputMsg *msg, CViewItem *view); - void performAction(int val1, int val2); + + /** + * Perform an action + */ + void performAction(int actionNum, CViewItem *view = nullptr); /** * Start an animation timer -- cgit v1.2.3 From 421812f27c59e53e68dfbaa777284c74a8fb7938 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 28 May 2016 21:42:18 -0400 Subject: TITANIC: More implementing deskbot message handlers --- engines/titanic/core/tree_item.cpp | 18 ++++++++++++++++-- engines/titanic/core/tree_item.h | 10 +++++++++- engines/titanic/game_state.cpp | 6 +++--- engines/titanic/game_state.h | 2 +- engines/titanic/npcs/deskbot.cpp | 22 ++++++++++++++++++++-- engines/titanic/npcs/deskbot.h | 2 +- engines/titanic/pet_control/pet_gfx_element.cpp | 2 +- engines/titanic/pet_control/pet_slider.cpp | 4 ++-- 8 files changed, 53 insertions(+), 13 deletions(-) diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index 8dd3da054d..86a6b174a8 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -319,9 +319,23 @@ int CTreeItem::getPassengerClass() const { return gameManager ? gameManager->_gameState._passengerClass : 3; } -int CTreeItem::getStateC() const { +int CTreeItem::getPriorClass() const { CGameManager *gameManager = getGameManager(); - return gameManager ? gameManager->_gameState._fieldC : 3; + return gameManager ? gameManager->_gameState._priorClass : 3; +} + +void CTreeItem::setPassengerClass(int newClass) { + if (newClass >= 1 && newClass <= 4) { + // Change the passenger class + CGameManager *gameMan = getGameManager(); + gameMan->_gameState._priorClass = gameMan->_gameState._passengerClass; + gameMan->_gameState._passengerClass = newClass; + + // Setup the PET again, so the new class's PET background can take effect + CPetControl *petControl = getPetControl(); + if (petControl) + petControl->setup(); + } } } // End of namespace Titanic diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index 1dcaee552d..d893d6d9ce 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -284,7 +284,15 @@ public: */ int getPassengerClass() const; - int getStateC() const; + /** + * Return the player's previous passenger class + */ + int getPriorClass() const; + + /** + * Set's the player's passenger class + */ + void setPassengerClass(int newClass); }; } // End of namespace Titanic diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index 2c751c0aa1..c552c69831 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -45,7 +45,7 @@ bool CGameStateMovieList::clear() { CGameState::CGameState(CGameManager *gameManager) : _gameManager(gameManager), _gameLocation(this), - _passengerClass(0), _fieldC(0), _mode(GSMODE_UNSELECTED), + _passengerClass(0), _priorClass(0), _mode(GSMODE_UNSELECTED), _field14(0), _petActive(false), _field1C(0), _quitGame(false), _field24(0), _nodeChangeCtr(0), _nodeEnterTicks(0), _field38(0) { } @@ -53,7 +53,7 @@ CGameState::CGameState(CGameManager *gameManager) : void CGameState::save(SimpleFile *file) const { file->writeNumber(_petActive); file->writeNumber(_passengerClass); - file->writeNumber(_fieldC); + file->writeNumber(_priorClass); file->writeNumber(_field14); file->writeNumber(_field24); file->writeNumber(_field38); @@ -64,7 +64,7 @@ void CGameState::save(SimpleFile *file) const { void CGameState::load(SimpleFile *file) { _petActive = file->readNumber() != 0; _passengerClass = file->readNumber(); - _fieldC = file->readNumber(); + _priorClass = file->readNumber(); _field14 = file->readNumber(); _field24 = file->readNumber(); _field38 = file->readNumber(); diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h index ff39dc6752..65126120be 100644 --- a/engines/titanic/game_state.h +++ b/engines/titanic/game_state.h @@ -55,7 +55,7 @@ public: CGameLocation _gameLocation; CGameStateMovieList _movieList; int _passengerClass; - int _fieldC; + int _priorClass; GameStateMode _mode; int _field14; bool _petActive; diff --git a/engines/titanic/npcs/deskbot.cpp b/engines/titanic/npcs/deskbot.cpp index dcd27466db..548738d930 100644 --- a/engines/titanic/npcs/deskbot.cpp +++ b/engines/titanic/npcs/deskbot.cpp @@ -110,7 +110,6 @@ bool CDeskbot::MovieEndMsg(CMovieEndMsg *msg) { flag = true; } - bool flag = false; if (_npcFlags & NPCFLAG_40000) { _deskbotActive = false; _npcFlags &= ~(NPCFLAG_40000 | NPCFLAG_20000); @@ -155,7 +154,26 @@ bool CDeskbot::LeaveViewMsg(CLeaveViewMsg *msg) { } bool CDeskbot::TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg) { - // TODO + switch (msg->_action) { + case 19: + inc54(); + lockMouse(); + setPetArea(PET_CONVERSATION); + playClip("ReprogramPETInHand", 4); + _npcFlags |= NPCFLAG_10000; + _field10C = msg->_param1; + + switch (_field10C) { + case 1: + petDisplayMsg("You have been upgraded to 1st Class status. Enjoy hugely."); + + break; + case 2: + petDisplayMsg("You have been upgraded to 2nd Class status. Enjoy."); + break; + } + } + return true; } diff --git a/engines/titanic/npcs/deskbot.h b/engines/titanic/npcs/deskbot.h index 607255be57..8425f58f95 100644 --- a/engines/titanic/npcs/deskbot.h +++ b/engines/titanic/npcs/deskbot.h @@ -45,7 +45,7 @@ private: static int _v2; public: bool _deskbotActive; - bool _field10C; + int _field10C; public: CLASSDEF CDeskbot(); diff --git a/engines/titanic/pet_control/pet_gfx_element.cpp b/engines/titanic/pet_control/pet_gfx_element.cpp index 2686bd9ace..511fb5e4de 100644 --- a/engines/titanic/pet_control/pet_gfx_element.cpp +++ b/engines/titanic/pet_control/pet_gfx_element.cpp @@ -54,7 +54,7 @@ void CPetGfxElement::reset(const CString &name, CPetControl *petControl, PetElem if (classNum >= 1 && classNum <= 3) { numString = CString(classNum); } else if (classNum == 4) { - int stateC = petControl->getStateC(); + int stateC = petControl->getPriorClass(); if (stateC == 1) numString = CString(stateC); } diff --git a/engines/titanic/pet_control/pet_slider.cpp b/engines/titanic/pet_control/pet_slider.cpp index 82b02af3fb..67f324aee1 100644 --- a/engines/titanic/pet_control/pet_slider.cpp +++ b/engines/titanic/pet_control/pet_slider.cpp @@ -202,7 +202,7 @@ void CPetSoundSlider::setupBackground2(const CString &name, CPetControl *petCont if (mode <= 3) { numStr = CString(mode); } else if (mode == 4) { - mode = petControl->getStateC(); + mode = petControl->getPriorClass(); if (mode == 1) { numStr = CString(mode); } @@ -220,7 +220,7 @@ void CPetSoundSlider::setupThumb2(const CString &name, CPetControl *petControl) if (mode <= 3) { numStr = CString(mode); } else if (mode == 4) { - mode = petControl->getStateC(); + mode = petControl->getPriorClass(); if (mode == 1) { numStr = CString(mode); } -- cgit v1.2.3 From 063fd5c26a10a665e1cf1acb78696807d18dea8c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 28 May 2016 22:19:20 -0400 Subject: TITANIC: Reorganising methods to class they are in the original --- engines/titanic/core/game_object.cpp | 70 ++++++++++++ engines/titanic/core/game_object.h | 168 ++++++++++++++++++---------- engines/titanic/core/tree_item.cpp | 70 ------------ engines/titanic/core/tree_item.h | 55 --------- engines/titanic/pet_control/pet_control.cpp | 2 +- 5 files changed, 183 insertions(+), 182 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index f386c1eb51..00a7328443 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -613,6 +613,11 @@ bool CGameObject::compareViewNameTo(const CString &name) const { return getViewFullName().compareToIgnoreCase(name); } +int CGameObject::compareRoomNameTo(const CString &name) { + CRoomItem *room = getGameManager()->getRoom(); + return room->getName().compareToIgnoreCase(name); +} + void CGameObject::petDisplayMsg(const CString &msg) const { CPetControl *pet = getPetControl(); if (pet) @@ -808,4 +813,69 @@ void CGameObject::checkPlayMovie(const CString &name, int flags) { } } +void CGameObject::clearPet() const { + CPetControl *petControl = getPetControl(); + if (petControl) + petControl->clear(); +} + +CPetControl *CGameObject::getPetControl() const { + return static_cast(getDontSaveChild(CPetControl::_type)); +} + +CMailMan *CGameObject::getMailMan() const { + return dynamic_cast(getDontSaveChild(CMailMan::_type)); +} + +CTreeItem *CGameObject::getDontSaveChild(ClassDef *classDef) const { + CProjectItem *root = getRoot(); + if (!root) + return nullptr; + + CDontSaveFileItem *dontSave = root->getDontSaveFileItem(); + if (!dontSave) + return nullptr; + + return dontSave->findChildInstanceOf(classDef); +} + +CRoomItem *CGameObject::getRoom() const { + CGameManager *gameManager = getGameManager(); + return gameManager ? gameManager->getRoom() : nullptr; +} + +CRoomItem *CGameObject::getHiddenRoom() const { + CProjectItem *root = getRoot(); + return root ? root->findHiddenRoom() : nullptr; +} + +CMusicRoom *CGameObject::getMusicRoom() const { + CGameManager *gameManager = getGameManager(); + return gameManager ? &gameManager->_musicRoom : nullptr; +} + +int CGameObject::getPassengerClass() const { + CGameManager *gameManager = getGameManager(); + return gameManager ? gameManager->_gameState._passengerClass : 3; +} + +int CGameObject::getPriorClass() const { + CGameManager *gameManager = getGameManager(); + return gameManager ? gameManager->_gameState._priorClass : 3; +} + +void CGameObject::setPassengerClass(int newClass) { + if (newClass >= 1 && newClass <= 4) { + // Change the passenger class + CGameManager *gameMan = getGameManager(); + gameMan->_gameState._priorClass = gameMan->_gameState._passengerClass; + gameMan->_gameState._passengerClass = newClass; + + // Setup the PET again, so the new class's PET background can take effect + CPetControl *petControl = getPetControl(); + if (petControl) + petControl->setup(); + } +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 10847c816c..f389815a99 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -102,11 +102,6 @@ protected: */ bool checkStartDragging(CMouseDragStartMsg *msg); - /** - * Marks the area in the passed rect as dirty, and requiring re-rendering - */ - void makeDirty(const Rect &r); - /** * Sets a new area in the PET */ @@ -194,6 +189,11 @@ protected: */ bool compareViewNameTo(const CString &name) const; + /** + * Compare the name of the parent room to the item to a passed string + */ + int compareRoomNameTo(const CString &name); + /** * Display a message in the PET */ @@ -258,6 +258,80 @@ protected: * Support function for drag moving */ void dragMove(const Point &pt); + + /** + * Set the position of the object + */ + void setPosition(const Point &newPos); + + void sound8(bool flag) const; + + /** + * Play an arbitrary clip + */ + void playClip(const CString &name, uint flags); + + /** + * Play a clip + */ + void playClip(uint startFrame, uint endFrame); + + /** + * Return the current view/node/room as a single string + */ + CString getViewFullName() const; + + /** + * Returns true if a clip exists in the list with a given name + * and starting frame number + */ + bool clipExistsByStart(const CString &name, int startFrame = 0) const; + + /** + * Returns true if a clip exists in the list with a given name + * and ending frame number + */ + bool clipExistsByEnd(const CString &name, int endFrame = 0) const; + + /** + * Clear the PET display + */ + void clearPet() const; + + /** + * Returns the PET control + */ + CPetControl *getPetControl() const; + + /** + * Returns the MailMan + */ + CMailMan *getMailMan() const; + + /** + * Returns a child of the Dont Save area of the project of the given class + */ + CTreeItem *getDontSaveChild(ClassDef *classDef) const; + + /** + * Return the current room + */ + CRoomItem *getRoom() const; + + /** + * Returns the special hidden room container + */ + CRoomItem *getHiddenRoom() const; + + /** + * Returns the music room instance from the game manager + */ + CMusicRoom *getMusicRoom() const; + + /** + * Set's the player's passenger class + */ + void setPassengerClass(int newClass); public: int _field60; CursorId _cursorId; @@ -292,9 +366,14 @@ public: virtual bool isPet() const; /** - * Stops any movie currently playing for the object + * Play the movie specified in _resource */ - void stopMovie(); + void playMovie(uint startFrame, uint endFrame, uint flags); + + /** + * Moves the item from it's original position to be under the hidden room + */ + void moveToHiddenRoom(); /** * Checks the passed point is validly in the object, @@ -303,52 +382,49 @@ public: bool checkPoint(const Point &pt, bool ignore40 = false, bool visibleOnly = false); /** - * Set the position of the object + * Change the object's status */ - void setPosition(const Point &newPos); - + void playMovie(uint flags); + /** - * Returns true if the object has a currently active movie + * Checks and plays a pending clip */ - bool hasActiveMovie() const; + void checkPlayMovie(const CString &name, int flags); /** - * Get the current movie frame + * Returns true if the object has a currently active movie */ - int getMovieFrame() const; - - int getSurface45() const; - void sound8(bool flag) const; + bool hasActiveMovie() const; /** - * Loads a frame + * Stops any movie currently playing for the object */ - void loadFrame(int frameNumber); + void stopMovie(); /** - * Change the object's status + * Get the current movie frame */ - void playMovie(uint flags); - + int getMovieFrame() const; + /** - * Play the movie specified in _resource + * Returns the object's frame number */ - void playMovie(uint startFrame, uint endFrame, uint flags); + int getFrameNumber() const { return _frameNumber; } /** - * Play an arbitrary clip + * Loads a frame */ - void playClip(const CString &name, uint flags); + void loadFrame(int frameNumber); /** - * Play a clip + * Marks the area occupied by the object as dirty, requiring re-rendering */ - void playClip(uint startFrame, uint endFrame); + void makeDirty(); /** - * Return the current view/node/room as a single string + * Marks the area in the passed rect as dirty, and requiring re-rendering */ - CString getViewFullName() const; + void makeDirty(const Rect &r); /** * Sets whether the object is visible @@ -356,36 +432,16 @@ public: void setVisible(bool val); /** - * Moves the item from it's original position to be under the hidden room - */ - void moveToHiddenRoom(); - - /** - * Returns the object's frame number - */ - int getFrameNumber() const { return _frameNumber; } - - /** - * Marks the area occupied by the object as dirty, requiring re-rendering + * Return the player's passenger class */ - void makeDirty(); - - /** - * Returns true if a clip exists in the list with a given name - * and starting frame number - */ - bool clipExistsByStart(const CString &name, int startFrame = 0) const; - + int getPassengerClass() const; + /** - * Returns true if a clip exists in the list with a given name - * and ending frame number + * Return the player's previous passenger class */ - bool clipExistsByEnd(const CString &name, int endFrame = 0) const; + int getPriorClass() const; - /** - * Checks and plays a pending clip - */ - void checkPlayMovie(const CString &name, int flags); + int getSurface45() const; }; } // End of namespace Titanic diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index 86a6b174a8..9b5097040c 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -268,74 +268,4 @@ CNamedItem *CTreeItem::findByName(const CString &name, int maxLen) { return nullptr; } -int CTreeItem::compareRoomNameTo(const CString &name) { - CRoomItem *room = getGameManager()->getRoom(); - return room->getName().compareToIgnoreCase(name); -} - -void CTreeItem::clearPet() const { - CPetControl *petControl = getPetControl(); - if (petControl) - petControl->clear(); -} - -CPetControl *CTreeItem::getPetControl() const { - return static_cast(getDontSaveChild(CPetControl::_type)); -} - -CMailMan *CTreeItem::getMailMan() const { - return dynamic_cast(getDontSaveChild(CMailMan::_type)); -} - -CTreeItem *CTreeItem::getDontSaveChild(ClassDef *classDef) const { - CProjectItem *root = getRoot(); - if (!root) - return nullptr; - - CDontSaveFileItem *dontSave = root->getDontSaveFileItem(); - if (!dontSave) - return nullptr; - - return dontSave->findChildInstanceOf(classDef); -} - -CRoomItem *CTreeItem::getRoom() const { - CGameManager *gameManager = getGameManager(); - return gameManager ? gameManager->getRoom() : nullptr; -} - -CRoomItem *CTreeItem::getHiddenRoom() const { - CProjectItem *root = getRoot(); - return root ? root->findHiddenRoom() : nullptr; -} - -CMusicRoom *CTreeItem::getMusicRoom() const { - CGameManager *gameManager = getGameManager(); - return gameManager ? &gameManager->_musicRoom : nullptr; -} - -int CTreeItem::getPassengerClass() const { - CGameManager *gameManager = getGameManager(); - return gameManager ? gameManager->_gameState._passengerClass : 3; -} - -int CTreeItem::getPriorClass() const { - CGameManager *gameManager = getGameManager(); - return gameManager ? gameManager->_gameState._priorClass : 3; -} - -void CTreeItem::setPassengerClass(int newClass) { - if (newClass >= 1 && newClass <= 4) { - // Change the passenger class - CGameManager *gameMan = getGameManager(); - gameMan->_gameState._priorClass = gameMan->_gameState._passengerClass; - gameMan->_gameState._passengerClass = newClass; - - // Setup the PET again, so the new class's PET background can take effect - CPetControl *petControl = getPetControl(); - if (petControl) - petControl->setup(); - } -} - } // End of namespace Titanic diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index d893d6d9ce..fd7586b819 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -238,61 +238,6 @@ public: * Finds a tree item by name */ CNamedItem *findByName(const CString &name, int maxLen = 0); - - /** - * Compare the name of the parent room to the item to a passed string - */ - int compareRoomNameTo(const CString &name); - - /** - * Clear the PET display - */ - void clearPet() const; - - /** - * Returns the PET control - */ - CPetControl *getPetControl() const; - - /** - * Returns the MailMan - */ - CMailMan *getMailMan() const; - - /** - * Returns a child of the Dont Save area of the project of the given class - */ - CTreeItem *getDontSaveChild(ClassDef *classDef) const; - - /** - * Return the current room - */ - CRoomItem *getRoom() const; - - /** - * Returns the special hidden room container - */ - CRoomItem *getHiddenRoom() const; - - /** - * Returns the music room instance from the game manager - */ - CMusicRoom *getMusicRoom() const; - - /** - * Return the player's passenger class - */ - int getPassengerClass() const; - - /** - * Return the player's previous passenger class - */ - int getPriorClass() const; - - /** - * Set's the player's passenger class - */ - void setPassengerClass(int newClass); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 8571b5ea65..1fd6549f9b 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -225,7 +225,7 @@ void CPetControl::fn3(CTreeItem *item) { CRoomItem *CPetControl::getHiddenRoom() { if (!_hiddenRoom) - _hiddenRoom = CTreeItem::getHiddenRoom(); + _hiddenRoom = CGameObject::getHiddenRoom(); return _hiddenRoom; } -- cgit v1.2.3 From 703bb288c17e207f083e75facc750f5c8c30a09e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 28 May 2016 23:30:43 -0400 Subject: TITANIC: Finished Deskbot message handlers --- engines/titanic/core/game_object.cpp | 22 +++++ engines/titanic/core/game_object.h | 25 +++++- engines/titanic/core/tree_item.h | 7 +- engines/titanic/messages/messages.h | 8 +- engines/titanic/npcs/deskbot.cpp | 122 +++++++++++++++++++++++++--- engines/titanic/npcs/deskbot.h | 2 +- engines/titanic/npcs/true_talk_npc.cpp | 12 +-- engines/titanic/pet_control/pet_control.cpp | 8 ++ engines/titanic/pet_control/pet_control.h | 6 ++ engines/titanic/pet_control/pet_rooms.cpp | 9 ++ engines/titanic/pet_control/pet_rooms.h | 7 ++ 11 files changed, 196 insertions(+), 32 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 00a7328443..eaf1dfe9a8 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -26,6 +26,7 @@ #include "titanic/core/room_item.h" #include "titanic/npcs/true_talk_npc.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/star_control/star_control.h" #include "titanic/support/files_manager.h" #include "titanic/support/screen_manager.h" #include "titanic/support/video_surface.h" @@ -624,6 +625,10 @@ void CGameObject::petDisplayMsg(const CString &msg) const { pet->displayMessage(msg); } +void CGameObject::displayMessage(const CString &msg) const { + petDisplayMsg(msg); +} + CGameObject *CGameObject::getMailManFirstObject() const { CMailMan *mailMan = getMailMan(); return mailMan ? mailMan->getFirstObject() : nullptr; @@ -720,6 +725,12 @@ void CGameObject::dec54() { getGameManager()->dec54(); } +void CGameObject::petAddRoom(int roomNum) { + CPetControl *petControl = getPetControl(); + if (petControl) + petControl->addRoom(roomNum); +} + void CGameObject::lockMouse() { CGameManager *gameMan = getGameManager(); gameMan->lockInputHandler(); @@ -827,6 +838,17 @@ CMailMan *CGameObject::getMailMan() const { return dynamic_cast(getDontSaveChild(CMailMan::_type)); } +CStarControl *CGameObject::getStarControl() const { + CStarControl *starControl = static_cast(getDontSaveChild(CStarControl::_type)); + if (!starControl) { + CViewItem *view = getGameManager()->getView(); + if (view) + starControl = starControl = static_cast(view->findChildInstanceOf(CStarControl::_type)); + } + + return starControl; +} + CTreeItem *CGameObject::getDontSaveChild(ClassDef *classDef) const { CProjectItem *root = getRoot(); if (!root) diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index f389815a99..22c62a809d 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -35,9 +35,13 @@ namespace Titanic { enum Find { FIND_GLOBAL = 1, FIND_ROOM = 2, FIND_PET = 4, FIND_MAILMAN = 8 }; enum Found { FOUND_NONE = 0, FOUND_GLOBAL = 1, FOUND_ROOM = 2, FOUND_PET = 3, FOUND_MAILMAN = 4 }; -class CVideoSurface; +class CMailMan; +class CMusicRoom; +class CRoomItem; +class CStarControl; class CMouseDragStartMsg; class CTrueTalkNPC; +class CVideoSurface; class OSMovie; class CGameObject : public CNamedItem { @@ -124,6 +128,11 @@ protected: void inc54(); void dec54(); + /** + * Adds a room to the room list + */ + void petAddRoom(int roomNum); + /** * Locks/hides the mouse */ @@ -195,10 +204,15 @@ protected: int compareRoomNameTo(const CString &name); /** - * Display a message in the PET - */ + * Display a message in the PET + */ void petDisplayMsg(const CString &msg) const; + /** + * Display a message + */ + void displayMessage(const CString &msg) const; + /** * Gets the first object under the system MailMan */ @@ -308,6 +322,11 @@ protected: */ CMailMan *getMailMan() const; + /** + * Returns the star control + */ + CStarControl *getStarControl() const; + /** * Returns a child of the Dont Save area of the project of the given class */ diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index fd7586b819..c0d37d14d0 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -24,19 +24,14 @@ #define TITANIC_TREE_ITEM_H #include "titanic/core/message_target.h" +#include "titanic/support/simple_file.h" namespace Titanic { class CGameManager; -class CDontSaveFileItem; -class CMailMan; -class CMessage; -class CMusicRoom; class CNamedItem; -class CPetControl; class CProjectItem; class CScreenManager; -class CRoomItem; class CViewItem; class CTreeItem: public CMessageTarget { diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index f592434152..d456714179 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -269,9 +269,9 @@ MESSAGE2(CMovieFrameMsg, int, value1, 0, int, value2, 0); MESSAGE0(CMusicHasStartedMsg); MESSAGE0(CMusicHasStoppedMsg); MESSAGE0(CMusicSettingChangedMsg); -MESSAGE2(CNPCPlayAnimationMsg, void *, data, nullptr, int, value2, 0); -MESSAGE1(CNPCPlayIdleAnimationMsg, void *, value, 0); -MESSAGE3(CNPCPlayTalkingAnimationMsg, int, value1, 0, int, value2, 0, void *, value3, nullptr); +MESSAGE2(CNPCPlayAnimationMsg, const char *const *, names, nullptr, int, value2, 0); +MESSAGE1(CNPCPlayIdleAnimationMsg, const char *const *, names, 0); +MESSAGE3(CNPCPlayTalkingAnimationMsg, int, value1, 0, int, value2, 0, const char *const *, names, nullptr); MESSAGE0(CNPCQueueIdleAnimMsg); MESSAGE1(CNutPuzzleMsg, CString, value, ""); MESSAGE1(COnSummonBotMsg, int, value, 0); @@ -344,7 +344,7 @@ MESSAGE1(CTriggerNPCEvent, int, value, 0); MESSAGE4(CTrueTalkGetAnimSetMsg, int, value1, 0, uint, index, 0, uint, startFrame, 0, uint, endFrame, 0); MESSAGE2(CTrueTalkGetAssetDetailsMsg, CString, filename, "", int, numValue, 0); MESSAGE2(CTrueTalkGetStateValueMsg, int, stateNum, 0, int, stateVal, -1000); -MESSAGE2(CTrueTalkNotifySpeechEndedMsg, int, value1, 0, int, value2, 0); +MESSAGE2(CTrueTalkNotifySpeechEndedMsg, int, value1, 0, int, dialogueId, 0); MESSAGE3(CTrueTalkNotifySpeechStartedMsg, uint, soundId, 0, uint, dialogueId, 0, int, value, 0); MESSAGE1(CTrueTalkQueueUpAnimSetMsg, int, value, 0); MESSAGE0(CTrueTalkSelfQueueAnimSetMsg); diff --git a/engines/titanic/npcs/deskbot.cpp b/engines/titanic/npcs/deskbot.cpp index 548738d930..18c1e2a137 100644 --- a/engines/titanic/npcs/deskbot.cpp +++ b/engines/titanic/npcs/deskbot.cpp @@ -21,9 +21,20 @@ */ #include "titanic/npcs/deskbot.h" +#include "titanic/pet_control/pet_control.h" namespace Titanic { +static const char *const TALKING_NAMES[] = { + "NeutralTalking", "HandFidget1", "HandFidget2", "LookingAround", + "FriendlyTalking", "MoreRudeness", "HandUp", "TapFingers", + "WaveOn", "WaveArmsAround", "HandsOverEdge" +}; + +static const char *const IDLE_NAMES[] = { + "WaveOn", "HandFidget1", "HandFidget2", "TapFingers", "HandsOverEdge" +}; + BEGIN_MESSAGE_MAP(CDeskbot, CTrueTalkNPC) ON_MESSAGE(TurnOn) ON_MESSAGE(EnterViewMsg) @@ -41,7 +52,7 @@ END_MESSAGE_MAP() int CDeskbot::_v1; int CDeskbot::_v2; -CDeskbot::CDeskbot() : CTrueTalkNPC(), _deskbotActive(false), _field10C(0) { +CDeskbot::CDeskbot() : CTrueTalkNPC(), _deskbotActive(false), _classNum(0) { } void CDeskbot::save(SimpleFile *file, int indent) const { @@ -49,7 +60,7 @@ void CDeskbot::save(SimpleFile *file, int indent) const { file->writeNumberLine(_v1, indent); file->writeNumberLine(_v2, indent); file->writeNumberLine(_deskbotActive, indent); - file->writeNumberLine(_field10C, indent); + file->writeNumberLine(_classNum, indent); CTrueTalkNPC::save(file, indent); } @@ -59,7 +70,7 @@ void CDeskbot::load(SimpleFile *file) { _v1 = file->readNumber(); _v2 = file->readNumber(); _deskbotActive = file->readNumber(); - _field10C = file->readNumber(); + _classNum = file->readNumber(); CTrueTalkNPC::load(file); } @@ -98,12 +109,12 @@ bool CDeskbot::ActMsg(CActMsg *msg) { bool CDeskbot::MovieEndMsg(CMovieEndMsg *msg) { bool flag = false; if (_npcFlags & NPCFLAG_10000) { - if (_field10C) { + if (_classNum) { setPetArea(PET_ROOMS); dec54(); unlockMouse(); playSound("z#47.wav", 100, 0, 0); - _field10C = false; + _classNum = false; } _npcFlags &= ~NPCFLAG_10000; @@ -161,39 +172,126 @@ bool CDeskbot::TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg) { setPetArea(PET_CONVERSATION); playClip("ReprogramPETInHand", 4); _npcFlags |= NPCFLAG_10000; - _field10C = msg->_param1; + _classNum = msg->_param1; - switch (_field10C) { + switch (_classNum) { case 1: petDisplayMsg("You have been upgraded to 1st Class status. Enjoy hugely."); - + setPassengerClass(_classNum); + petAddRoom(_classNum); break; case 2: petDisplayMsg("You have been upgraded to 2nd Class status. Enjoy."); + setPassengerClass(_classNum); + petAddRoom(_classNum); + break; + case 3: + setPassengerClass(3); + petAddRoom(_classNum); + break; + default: break; } + + case 20: + if (getPassengerClass() == 1) { + CPetControl *petControl = getPetControl(); + if (petControl) + petControl->roomFn2(4); + } + break; + + case 21: + if (getPassengerClass() == 1) { + CPetControl *petControl = getPetControl(); + if (petControl) + petControl->roomFn2(3); + } + break; + + case 22: + if (getPassengerClass() == 1) { + CPetControl *petControl = getPetControl(); + if (petControl) + petControl->roomFn2(2); + } + break; + + case 23: + if (getPassengerClass() == 1) { + CPetControl *petControl = getPetControl(); + if (petControl) + petControl->roomFn2(1); + } + break; + + case 26: + _npcFlags |= NPCFLAG_80000; + CTurnOff turnOff; + turnOff.execute(this); + lockMouse(); + break; } return true; } bool CDeskbot::NPCPlayTalkingAnimationMsg(CNPCPlayTalkingAnimationMsg *msg) { - // TODO + if (msg->_value2 != 2) + msg->_names = TALKING_NAMES; + return true; } bool CDeskbot::NPCPlayIdleAnimationMsg(CNPCPlayIdleAnimationMsg *msg) { - // TODO + msg->_names = IDLE_NAMES; return true; } bool CDeskbot::TrueTalkNotifySpeechStartedMsg(CTrueTalkNotifySpeechStartedMsg *msg) { - // TODO + if (_npcFlags & NPCFLAG_40000) + return true; + + CTrueTalkNPC::TrueTalkNotifySpeechStartedMsg(msg); + switch (msg->_dialogueId) { + case 41684: + case 41686: + case 41787: + case 41788: + case 41789: + lockMouse(); + break; + default: + break; + } + return true; } bool CDeskbot::TrueTalkNotifySpeechEndedMsg(CTrueTalkNotifySpeechEndedMsg *msg) { - // TODO + if (_npcFlags & NPCFLAG_40000) + return true; + + CTurnOff turnOff; + CTrueTalkNPC::TrueTalkNotifySpeechEndedMsg(msg); + + switch (msg->_dialogueId) { + case 41684: + case 41787: + case 41788: + case 41789: + _npcFlags |= NPCFLAG_80000; + turnOff.execute(this); + + case 41686: + _npcFlags |= NPCFLAG_100000; + turnOff.execute(this); + break; + + default: + break; + } + return true; } diff --git a/engines/titanic/npcs/deskbot.h b/engines/titanic/npcs/deskbot.h index 8425f58f95..3e155f6788 100644 --- a/engines/titanic/npcs/deskbot.h +++ b/engines/titanic/npcs/deskbot.h @@ -45,7 +45,7 @@ private: static int _v2; public: bool _deskbotActive; - int _field10C; + int _classNum; public: CLASSDEF CDeskbot(); diff --git a/engines/titanic/npcs/true_talk_npc.cpp b/engines/titanic/npcs/true_talk_npc.cpp index ba2de20de9..32c6412fef 100644 --- a/engines/titanic/npcs/true_talk_npc.cpp +++ b/engines/titanic/npcs/true_talk_npc.cpp @@ -111,8 +111,8 @@ bool CTrueTalkNPC::TrueTalkNotifySpeechStartedMsg(CTrueTalkNotifySpeechStartedMs CNPCPlayTalkingAnimationMsg msg1(_soundId, 0, 0); msg1.execute(this); - if (msg1._value3) { - CNPCPlayAnimationMsg msg2(msg1._value3, msg1._value1); + if (msg1._names) { + CNPCPlayAnimationMsg msg2(msg1._names, msg1._value1); msg2.execute(this); } } @@ -151,8 +151,8 @@ bool CTrueTalkNPC::MovieEndMsg(CMovieEndMsg *msg) { CNPCPlayTalkingAnimationMsg msg1(ticks, ticks > 1000 ? 2 : 1, 0); msg1.execute(this); - if (msg1._value3) { - CNPCPlayAnimationMsg msg2(msg1._value3, msg1._value1); + if (msg1._names) { + CNPCPlayAnimationMsg msg2(msg1._names, msg1._value1); msg2.execute(this); } @@ -173,8 +173,8 @@ bool CTrueTalkNPC::TimerMsg(CTimerMsg *msg) { CNPCPlayIdleAnimationMsg idleMsg; if (idleMsg.execute(this)) { - if (idleMsg._value) { - CNPCPlayAnimationMsg animMsg(idleMsg._value, 0); + if (idleMsg._names) { + CNPCPlayAnimationMsg animMsg(idleMsg._names, 0); animMsg.execute(this); } diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 1fd6549f9b..92ec3d6b03 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -516,4 +516,12 @@ CString CPetControl::getFullViewName() { return gameManager ? gameManager->getFullViewName() : CString(); } +void CPetControl::addRoom(int roomNum) { + _rooms.addRoom(roomNum); +} + +int CPetControl::roomFn2(int val) { + return _rooms.fn2(val); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 23b4f61721..1eedc0382f 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -293,6 +293,12 @@ public: * room.node.view tuplet form */ CString getFullViewName(); + + /** + * Adds a room to the room list + */ + void addRoom(int roomNum); + int roomFn2(int val); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp index acf9acfe24..a14258ebbf 100644 --- a/engines/titanic/pet_control/pet_rooms.cpp +++ b/engines/titanic/pet_control/pet_rooms.cpp @@ -202,6 +202,11 @@ int CPetRooms::fn1() { return 0; } +int CPetRooms::fn2(int val) { + warning("TODO: CPetRooms::fn2"); + return 0; +} + void CPetRooms::areaChanged(PetArea area) { if (_petControl && _petControl->_currentArea == area) _petControl->makeDirty(); @@ -221,4 +226,8 @@ CPetRoomsGlyph *CPetRooms::addGlyph(int val, bool highlight) { } } +void CPetRooms::addRoom(int roomNum) { + warning("TODO: CPetRooms::addRoom"); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms.h b/engines/titanic/pet_control/pet_rooms.h index 522a1e2399..515c9fb10d 100644 --- a/engines/titanic/pet_control/pet_rooms.h +++ b/engines/titanic/pet_control/pet_rooms.h @@ -147,6 +147,13 @@ public: virtual CPetText *getText(); virtual CGameObject *getBackground(int index); + + /** + * Adds a room to the room list + */ + void addRoom(int roomNum); + + int fn2(int val); }; } // End of namespace Titanic -- cgit v1.2.3 From d0301bce6f932b34810110796fa86bc367ddf89f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 29 May 2016 09:03:31 -0400 Subject: TITANIC: Move unknown method from TTword to TTadj --- engines/titanic/true_talk/tt_adj.cpp | 19 ++++++++++++----- engines/titanic/true_talk/tt_adj.h | 16 ++++++++------- engines/titanic/true_talk/tt_vocab.cpp | 37 ++++++++++++++++++++-------------- engines/titanic/true_talk/tt_word.cpp | 4 ---- engines/titanic/true_talk/tt_word.h | 2 -- 5 files changed, 45 insertions(+), 33 deletions(-) diff --git a/engines/titanic/true_talk/tt_adj.cpp b/engines/titanic/true_talk/tt_adj.cpp index 1c16d5894c..a14784798f 100644 --- a/engines/titanic/true_talk/tt_adj.cpp +++ b/engines/titanic/true_talk/tt_adj.cpp @@ -29,19 +29,19 @@ bool TTadj::_staticFlag; TTadj::TTadj(TTstring &str, WordClass wordClass, int val2, int val3, int val4) : TTmajorWord(str, wordClass, val2, val3) { if (val4 >= 0 && val4 <= 9) { - _field30 = val4; + _val = val4; } else { - _field30 = 0; + _val = 0; _status = SS_5; } } TTadj::TTadj(const TTadj *src) : TTmajorWord(src) { if (src->getStatus()) { - _field30 = 0; + _val = 0; _status = SS_5; } else { - _field30 = src->_field30; + _val = src->_val; } } @@ -49,13 +49,22 @@ int TTadj::load(SimpleFile *file) { int val; if (!TTword::load(file, WC_ADJECTIVE) && file->scanf("%d", &val)) { - _field30 = val; + _val = val; return 0; } else { return 8; } } +int TTadj::adjFn1(int val) { + if (_val < 0 || _val > 9) { + return SS_4; + } else { + _val = val; + return SS_VALID; + } +} + TTword *TTadj::copy() const { TTadj *returnWordP = new TTadj(this); returnWordP->_status = _status; diff --git a/engines/titanic/true_talk/tt_adj.h b/engines/titanic/true_talk/tt_adj.h index 813cc8cfa0..1dec8a77d2 100644 --- a/engines/titanic/true_talk/tt_adj.h +++ b/engines/titanic/true_talk/tt_adj.h @@ -31,7 +31,7 @@ class TTadj : public TTmajorWord { private: static bool _staticFlag; protected: - int _field30; + int _val; public: TTadj(TTstring &str, WordClass wordClass, int val2, int val3, int val4); TTadj(const TTadj *src); @@ -41,22 +41,24 @@ public: */ int load(SimpleFile *file); + int adjFn1(int val); + /** * Creates a copy of the word */ virtual TTword *copy() const; - virtual bool proc14(int val) const { return _field30 == val; } - virtual int proc15() const { return _field30; } - virtual bool proc16() const { return _field30 >= 7; } - virtual bool proc17() const { return _field30 <= 3; } - virtual bool proc18() const { return _field30 > 3 && _field30 < 7; } + virtual bool proc14(int val) const { return _val == val; } + virtual int proc15() const { return _val; } + virtual bool proc16() const { return _val >= 7; } + virtual bool proc17() const { return _val <= 3; } + virtual bool proc18() const { return _val > 3 && _val < 7; } /** * Dumps data associated with the word to file */ virtual int save(SimpleFile *file) const { - return saveData(file, _field30); + return saveData(file, _val); } }; diff --git a/engines/titanic/true_talk/tt_vocab.cpp b/engines/titanic/true_talk/tt_vocab.cpp index 350fc71d35..08d6e9e1a7 100644 --- a/engines/titanic/true_talk/tt_vocab.cpp +++ b/engines/titanic/true_talk/tt_vocab.cpp @@ -311,16 +311,17 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const { if (word) { if (word->_wordClass == WC_ADJECTIVE) { + TTadj *adj = static_cast(word); int val1 = word->proc15(); int val2 = word->proc15(); if (val2 < 5) { if (--val1 > 0) { - word->unkFn1(val1); + adj->adjFn1(val1); } } else { if (++val1 < 11) { - word->unkFn1(val1); + adj->adjFn1(val1); } } } @@ -330,16 +331,17 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const { if (word) { if (word->_wordClass == WC_ADJECTIVE) { + TTadj *adj = static_cast(word); int val1 = word->proc15(); int val2 = word->proc15(); if (val2 < 5) { if (--val1 > 0) { - word->unkFn1(val1); + adj->adjFn1(val1); } } else { if (++val1 < 11) { - word->unkFn1(val1); + adj->adjFn1(val1); } } } @@ -348,16 +350,17 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const { word = getPrimeWord(tempStr); if (word && word->_wordClass == WC_ADJECTIVE) { + TTadj *adj = static_cast(word); int val1 = word->proc15(); int val2 = word->proc15(); if (val2 < 5) { if (--val1 > 0) { - word->unkFn1(val1); + adj->adjFn1(val1); } } else { if (++val1 < 11) { - word->unkFn1(val1); + adj->adjFn1(val1); } } } @@ -370,16 +373,17 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const { if (word) { if (word->_wordClass == WC_ADJECTIVE) { + TTadj *adj = static_cast(word); int val1 = word->proc15(); int val2 = word->proc15(); if (val2 < 5) { if (--val1 > 0) { - word->unkFn1(val1); + adj->adjFn1(val1); } } else { if (++val1 < 11) { - word->unkFn1(val1); + adj->adjFn1(val1); } } } @@ -389,16 +393,17 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const { if (word) { if (word->_wordClass == WC_ADJECTIVE) { + TTadj *adj = static_cast(word); int val1 = word->proc15(); int val2 = word->proc15(); if (val2 < 5) { if (--val1 > 0) { - word->unkFn1(val1); + adj->adjFn1(val1); } } else { if (++val1 < 11) { - word->unkFn1(val1); + adj->adjFn1(val1); } } } @@ -407,16 +412,17 @@ TTword *TTvocab::getSuffixedWord(TTstring &str) const { word = getPrimeWord(tempStr); if (word) { + TTadj *adj = static_cast(word); int val1 = word->proc15(); int val2 = word->proc15(); if (val2 < 5) { if (--val1 > 0) { - word->unkFn1(val1); + adj->adjFn1(val1); } } else { if (++val1 < 11) { - word->unkFn1(val1); + adj->adjFn1(val1); } } } @@ -522,15 +528,16 @@ TTword *TTvocab::getPrefixedWord(TTstring &str) const { if (!word) tempStr = str; - else if (word->_wordClass == 8) { + else if (word->_wordClass == WC_ADJECTIVE) { + TTadj *adj = static_cast(word); int val1 = word->proc15(); int val2 = word->proc15(); if (val2 < 5) { if (--val1 > 0) - word->unkFn1(val1); + adj->adjFn1(val1); } else if (++val1 < 11) { - word->unkFn1(val1); + adj->adjFn1(val1); } } } diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp index 1dccd30a0b..df6ee5c7bc 100644 --- a/engines/titanic/true_talk/tt_word.cpp +++ b/engines/titanic/true_talk/tt_word.cpp @@ -193,10 +193,6 @@ TTword *TTword::copy() const { return new TTword(this); } -void TTword::unkFn1(int val) { - // TODO: This method seems to reference a field beyond the size of TTword -} - FileHandle TTword::getSynFile() const { return _synP ? _synP->_file : HANDLE_STDIN; } diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index 537d1e923b..b16e6a50ce 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -161,8 +161,6 @@ public: */ virtual TTword *copy() const; - void unkFn1(int val); - virtual bool proc2(int val) const { return false; } virtual int proc3() const { return -1; } virtual void proc4() {} -- cgit v1.2.3 From b9ad4ff7277505054b0de88b78e0034a462a026b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 29 May 2016 09:33:03 -0400 Subject: TITANIC: Fix dispatching messages by target name --- engines/titanic/messages/messages.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/titanic/messages/messages.cpp b/engines/titanic/messages/messages.cpp index 9f46fef6ca..e25c22fc7e 100644 --- a/engines/titanic/messages/messages.cpp +++ b/engines/titanic/messages/messages.cpp @@ -73,7 +73,7 @@ bool CMessage::execute(const CString &target, const ClassDef *classDef, int flag // Scan for the target by name CProjectItem *project = g_vm->_window->_project; for (CTreeItem *treeItem = project; treeItem; treeItem = treeItem->scan(project)) { - if (treeItem->getName().compareToIgnoreCase(target)) + if (!treeItem->getName().compareToIgnoreCase(target)) return execute(treeItem, classDef, flags); } -- cgit v1.2.3 From 2f4cf6a26aab58f932c06806a952cbd047c02ed0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 29 May 2016 16:01:39 -0400 Subject: TITANIC: Beginnings of TTresponse class --- engines/titanic/module.mk | 1 + engines/titanic/true_talk/tt_response.cpp | 71 +++++++++++++++++++++++++++++++ engines/titanic/true_talk/tt_response.h | 54 +++++++++++++++++++++++ engines/titanic/true_talk/tt_word.h | 4 ++ 4 files changed, 130 insertions(+) create mode 100644 engines/titanic/true_talk/tt_response.cpp create mode 100644 engines/titanic/true_talk/tt_response.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 19e4aff31b..c97b30f7b0 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -471,6 +471,7 @@ MODULE_OBJS := \ true_talk/tt_parser.o \ true_talk/tt_picture.o \ true_talk/tt_pronoun.o \ + true_talk/tt_response.o \ true_talk/tt_room_script.o \ true_talk/tt_script_base.o \ true_talk/tt_scripts.o \ diff --git a/engines/titanic/true_talk/tt_response.cpp b/engines/titanic/true_talk/tt_response.cpp new file mode 100644 index 0000000000..8d580ec198 --- /dev/null +++ b/engines/titanic/true_talk/tt_response.cpp @@ -0,0 +1,71 @@ +/* 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 "titanic/true_talk/tt_response.h" + +namespace Titanic { + +TTresponse::TTresponse(const TTstring &src) : _field0(0), _text(src), + _fieldC(0), _nextP(nullptr), _linkP(nullptr) { +} + +TTresponse::TTresponse(int val1, int val2) : _field0(val2), _text(" "), + _fieldC(val1), _nextP(nullptr), _linkP(nullptr) { +} + +TTresponse::TTresponse(const TTresponse *src) : _field0(src->_field0), + _text(src->_text), _fieldC(src->_fieldC), _nextP(src->_nextP), + _linkP(src->_linkP) { +} + +TTresponse::~TTresponse() { + // Iterate through destroying any successive linked response items + TTresponse *nextP; + for (TTresponse *currP = _nextP; currP; currP = nextP) { + // Get the following response and detach it from the current one, + // so that when the current is destroyed, it will only destroy itself + nextP = currP->_nextP; + currP->_nextP = nullptr; + delete currP; + } +} + +TTresponse *TTresponse::copyChain() const { + TTresponse *returnResponseP = new TTresponse(this); + + for (TTresponse *srcP = _nextP, *destP = returnResponseP; + srcP; srcP = srcP->_nextP, destP = destP->_nextP) { + destP->_nextP = new TTresponse(*srcP); + } + + return returnResponseP; +} + +void TTresponse::addLink(TTresponse *item) { + TTresponse *currP = this; + while (currP->_linkP) + currP = currP->_linkP; + + currP->_linkP = item; +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_response.h b/engines/titanic/true_talk/tt_response.h new file mode 100644 index 0000000000..c4119763ea --- /dev/null +++ b/engines/titanic/true_talk/tt_response.h @@ -0,0 +1,54 @@ +/* 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. + * + */ + +#ifndef TITANIC_TT_RESPONSE_H +#define TITANIC_TT_RESPONSE_H + +#include "titanic/true_talk/tt_string.h" +namespace Titanic { + +class TTsentence; + +class TTresponse { +private: + int _field0; + TTstring _text; + int _fieldC; + TTresponse *_nextP; + TTresponse *_linkP; + + TTresponse *copyChain() const; +private: + /** + * + */ + void addLink(TTresponse *item); +public: + TTresponse(const TTstring &src); + TTresponse(int val1, int val2); + TTresponse(const TTresponse *src); + virtual ~TTresponse(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_RESPONSE_H */ diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index b16e6a50ce..349e9e9910 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -29,10 +29,14 @@ namespace Titanic { +/** + * Types of words + */ enum WordClass { WC_UNKNOWN = 0, WC_ACTION = 1, WC_THING = 2, WC_ABSTRACT = 3, WC_ARTICLE = 4, WC_CONJUNCTION = 5, WC_PRONOUN = 6, WC_PREPOSITION = 7, WC_ADJECTIVE = 8, WC_ADVERB = 9, + // TODO: These may not actually be part of this enum WC_UNK_ACTION = 10, WC_ATRANS = 11, // transfer possession, eg: give/take WC_PTRANS = 12, // physical transfer, eg: go -- cgit v1.2.3 From 4ee0ced047ddef1994879e23cb6a2bb160933c1c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 29 May 2016 20:56:31 -0400 Subject: TITANIC: Fleshing out TTscriptBase class --- engines/titanic/true_talk/title_engine.cpp | 11 +++-- engines/titanic/true_talk/title_engine.h | 12 ++++- engines/titanic/true_talk/tt_response.cpp | 8 ++-- engines/titanic/true_talk/tt_response.h | 21 ++++++--- engines/titanic/true_talk/tt_script_base.cpp | 70 ++++++++++++++++++++++------ engines/titanic/true_talk/tt_script_base.h | 48 +++++++++++++------ engines/titanic/true_talk/tt_string.h | 5 +- 7 files changed, 132 insertions(+), 43 deletions(-) diff --git a/engines/titanic/true_talk/title_engine.cpp b/engines/titanic/true_talk/title_engine.cpp index d5f465139e..4dd45ba335 100644 --- a/engines/titanic/true_talk/title_engine.cpp +++ b/engines/titanic/true_talk/title_engine.cpp @@ -40,7 +40,8 @@ void CTitleEngine::setup(int val1, int val2) { /*------------------------------------------------------------------------*/ -STtitleEngine::STtitleEngine(): CTitleEngine(), _field58(0) { +STtitleEngine::STtitleEngine(): CTitleEngine(), + _responseP(nullptr), _field58(0) { } STtitleEngine::~STtitleEngine() { @@ -56,8 +57,12 @@ void STtitleEngine::setup(int val1, int val2) { CTitleEngine::setup(val1, 3); } -int STtitleEngine::proc2(int val1, int val2) { - // TODO +int STtitleEngine::setResponse(TTscriptBase *script, TTresponse *response) { + _indexes.clear(); + for (TTresponse *respP = response; respP; respP = respP->getNext()) { + _indexes.push_back(respP->getDialogueId()); + } + return 0; } diff --git a/engines/titanic/true_talk/title_engine.h b/engines/titanic/true_talk/title_engine.h index 10c32a7634..afd2d3b92f 100644 --- a/engines/titanic/true_talk/title_engine.h +++ b/engines/titanic/true_talk/title_engine.h @@ -27,6 +27,7 @@ #include "common/winexe_pe.h" #include "titanic/support/string.h" #include "titanic/true_talk/script_handler.h" +#include "titanic/true_talk/tt_response.h" #include "titanic/true_talk/tt_script_base.h" #include "titanic/true_talk/tt_title_script.h" @@ -52,7 +53,10 @@ public: */ virtual void setup(int val1, int val2 = 0); - virtual int proc2(int val1, int val2) { return 2; } + /** + * Sets a conversation reponse + */ + virtual int setResponse(TTscriptBase *script, TTresponse *response) { return SS_4; } virtual int proc4(int unused) const = 0; virtual int proc5(int64 unused) const = 0; @@ -69,6 +73,7 @@ public: class STtitleEngine : public CTitleEngine { private: Common::SeekableReadStream *_stream; + TTresponse *_responseP; int _field58; public: Common::Array _indexes; @@ -84,7 +89,10 @@ public: */ virtual void setup(int val1, int val2 = 0); - virtual int proc2(int val1, int val2); + /** + * Sets a conversation reponse + */ + virtual int setResponse(TTscriptBase *script, TTresponse *response); virtual void dump(int val1, int val2); diff --git a/engines/titanic/true_talk/tt_response.cpp b/engines/titanic/true_talk/tt_response.cpp index 8d580ec198..f007f98f97 100644 --- a/engines/titanic/true_talk/tt_response.cpp +++ b/engines/titanic/true_talk/tt_response.cpp @@ -25,15 +25,15 @@ namespace Titanic { TTresponse::TTresponse(const TTstring &src) : _field0(0), _text(src), - _fieldC(0), _nextP(nullptr), _linkP(nullptr) { + _dialogueId(0), _nextP(nullptr), _linkP(nullptr) { } -TTresponse::TTresponse(int val1, int val2) : _field0(val2), _text(" "), - _fieldC(val1), _nextP(nullptr), _linkP(nullptr) { +TTresponse::TTresponse(int dialogueId, int val2) : _field0(val2), _text(" "), + _dialogueId(dialogueId), _nextP(nullptr), _linkP(nullptr) { } TTresponse::TTresponse(const TTresponse *src) : _field0(src->_field0), - _text(src->_text), _fieldC(src->_fieldC), _nextP(src->_nextP), + _text(src->_text), _dialogueId(src->_dialogueId), _nextP(src->_nextP), _linkP(src->_linkP) { } diff --git a/engines/titanic/true_talk/tt_response.h b/engines/titanic/true_talk/tt_response.h index c4119763ea..38f7ec70a8 100644 --- a/engines/titanic/true_talk/tt_response.h +++ b/engines/titanic/true_talk/tt_response.h @@ -32,21 +32,30 @@ class TTresponse { private: int _field0; TTstring _text; - int _fieldC; + int _dialogueId; TTresponse *_nextP; TTresponse *_linkP; TTresponse *copyChain() const; -private: - /** - * - */ - void addLink(TTresponse *item); public: TTresponse(const TTstring &src); TTresponse(int val1, int val2); TTresponse(const TTresponse *src); virtual ~TTresponse(); + + TTresponse *getLink() const { return _linkP; } + + void addLink(TTresponse *item); + + /** + * Get the dialogue Id for the response + */ + int getDialogueId() const { return _dialogueId; } + + /** + * Return the next response item, if present + */ + TTresponse *getNext() const { return _nextP; } }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_script_base.cpp b/engines/titanic/true_talk/tt_script_base.cpp index 85c329c330..25c0b781bd 100644 --- a/engines/titanic/true_talk/tt_script_base.cpp +++ b/engines/titanic/true_talk/tt_script_base.cpp @@ -27,12 +27,12 @@ namespace Titanic { TTscriptBase::TTscriptBase(int scriptId, const char *charClass, int v2, const char *charName, int v3, int v4, int v5, int v6, int v7) : - _charName(charName), _charClass(charClass), - _nodesP(nullptr), _id(0), _hist(nullptr), + _charName(charName), _charClass(charClass), _status(0), + _nodesP(nullptr), _id(0), _hist1P(nullptr), _field20(0), _field24(0), _field28(0), _field2C(0), - _field30(0), _field34(0), _field38(0), _field3C(0), - _field40(0), _field44(0), _field48(0), _status(0) { - if (!areNamesValid()) { + _field30(0), _field34(0), _hist2P(nullptr), _field3C(0), + _respHeadP(nullptr), _respTailP(nullptr), _responseP(nullptr) { + if (!isValid()) { if (!v7 || !getStatus()) { _id = scriptId; _field20 = v3; @@ -51,13 +51,19 @@ TTscriptBase::TTscriptBase(int scriptId, const char *charClass, int v2, } TTscriptBase::~TTscriptBase() { + deleteResponses(); + delete _responseP; + + delete _hist1P; + delete _hist2P; + if (_nodesP) { _nodesP->deleteSiblings(); delete _nodesP; } } -bool TTscriptBase::areNamesValid() { +bool TTscriptBase::isValid() { bool result = !_charName.isValid() && !_charClass.isValid(); _status = result ? 0 : 11; return result; @@ -66,25 +72,25 @@ bool TTscriptBase::areNamesValid() { void TTscriptBase::reset() { _nodesP = nullptr; _id = 4; - _hist = nullptr; + _hist1P = nullptr; _field20 = 0; _field24 = -1; _field28 = -1; _field2C = -1; _field30 = 0; _field34 = 0; - _field38 = 0; + _hist2P = nullptr; _field3C = 0; - _field40 = 0; - _field44 = 0; - _field48 = 0; + _respHeadP = nullptr; + _respTailP = nullptr; + _responseP = nullptr; } int TTscriptBase::preprocess(TTsentence *sentence) { - delete _hist; - _hist = new TTscriptHist(sentence); + delete _hist1P; + _hist1P = new TTscriptHist(sentence); - return _hist ? SS_VALID : SS_7; + return _hist1P ? SS_VALID : SS_7; } void TTscriptBase::proc2(int v) { @@ -103,4 +109,40 @@ void TTscriptBase::proc5() { warning("TODO"); } +void TTscriptBase::deleteResponses() { + while (_respTailP) { + _respHeadP = _respTailP; + _respTailP = _respHeadP->getLink(); + delete _respHeadP; + } +} + +void TTscriptBase::appendResponse(int val1, int *val2, int val3) { + if (!val2 || val1 <= *val2) { + if (_respHeadP) { + _respHeadP = new TTresponse(_respHeadP); + } else { + _respHeadP = new TTresponse(val3, 3); + if (_respTailP) + _respTailP->addLink(_respHeadP); + else + _respTailP = _respHeadP; + } + } +} + +void TTscriptBase::appendResponse(int val1, int *val2, const TTstring &str) { + if (!val2 || val1 <= *val2) { + if (_respHeadP) { + _respHeadP = new TTresponse(str); + } else { + _respHeadP = new TTresponse(str); + if (_respTailP) + _respTailP->addLink(_respHeadP); + else + _respTailP = _respHeadP; + } + } +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_script_base.h b/engines/titanic/true_talk/tt_script_base.h index 2ffbf60760..1baff891bb 100644 --- a/engines/titanic/true_talk/tt_script_base.h +++ b/engines/titanic/true_talk/tt_script_base.h @@ -26,6 +26,7 @@ #include "titanic/true_talk/tt_string.h" #include "titanic/true_talk/tt_hist.h" #include "titanic/true_talk/tt_node.h" +#include "titanic/true_talk/tt_response.h" namespace Titanic { @@ -40,7 +41,7 @@ private: void reset(); protected: TTnode *_nodesP; - TThist *_hist; + TThist *_hist1P; TTstring _charName, _charClass; int _field20; int _field24; @@ -48,12 +49,28 @@ protected: int _field2C; int _field30; int _field34; - int _field38; + TThist *_hist2P; int _field3C; - int _field40; - int _field44; - int _field48; + TTresponse *_respHeadP; + TTresponse *_respTailP; + TTresponse *_responseP; int _status; +protected: + /** + * Delete any responses set up for the script + */ + void deleteResponses(); + + /** + * Creates and appends a new response to the script + */ + void appendResponse(int val1, int *val2, int val3); + + void appendResponse(int val1, int *val2, const TTstring &str); + + void appendResponse2(int val1, int *val2, const TTstring &str) { + appendResponse(val1, val2, str); + } public: int _id; public: @@ -61,7 +78,19 @@ public: int v3, int v4, int v5, int v6, int v7); virtual ~TTscriptBase(); - bool areNamesValid(); + virtual void proc2(int v); + + virtual void proc3(int v); + + virtual void proc4(int v); + + virtual void proc5(); + + + /** + * Returns true if the script is in a valid state + */ + bool isValid(); /** * Return the Id of the script @@ -83,13 +112,6 @@ public: */ int preprocess(TTsentence *sentence); - virtual void proc2(int v); - - virtual void proc3(int v); - - virtual void proc4(int v); - - virtual void proc5(); }; diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index 3e8718df2a..12daa07a9d 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -38,7 +38,10 @@ struct TTstringData { TTstringData(const CString &str) : _string(str), _referenceCount(1) {} }; -enum TTstringStatus { SS_VALID = 0, SS_1 = 1, SS_4 = 4, SS_5 = 5, SS_7 = 7, SS_8 = 8, SS_11 = 11, SS_13 = 13 }; +enum TTstringStatus { + SS_VALID = 0, SS_1 = 1, SS_2 = 2, SS_3 = 3, SS_4 = 4, + SS_5 = 5, SS_7 = 7, SS_8 = 8, SS_11 = 11, SS_13 = 13 +}; class TTstring { private: -- cgit v1.2.3 From 9f6a3d36f7778c5e530c03063b856212b4805ab9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 29 May 2016 22:35:34 -0400 Subject: TITANIC: Further fleshing out of TTscriptBase --- engines/titanic/true_talk/script_handler.cpp | 4 ++++ engines/titanic/true_talk/script_handler.h | 5 +++++ engines/titanic/true_talk/tt_response.h | 7 ++++-- engines/titanic/true_talk/tt_script_base.cpp | 32 +++++++++++++++++----------- engines/titanic/true_talk/tt_script_base.h | 15 +++++++------ 5 files changed, 42 insertions(+), 21 deletions(-) diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index bfd7cdfdfc..b689aba031 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -112,4 +112,8 @@ void CScriptHandler::setParserConcept(TTconcept *newConcept, TTconcept *oldConce _parser.conceptChanged(newConcept, oldConcept); } +int CScriptHandler::setResponse(TTscriptBase *script, TTresponse *response) { + return _owner->setResponse(script, response); +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index 1c0824869c..10699f1157 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -85,6 +85,11 @@ public: * Called when concept data is copied from one to another */ void setParserConcept(TTconcept *newConcept, TTconcept *oldConcept); + + /** + * Sets a conversation reponse + */ + int setResponse(TTscriptBase *script, TTresponse *response); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_response.h b/engines/titanic/true_talk/tt_response.h index 38f7ec70a8..d39d18c193 100644 --- a/engines/titanic/true_talk/tt_response.h +++ b/engines/titanic/true_talk/tt_response.h @@ -35,14 +35,17 @@ private: int _dialogueId; TTresponse *_nextP; TTresponse *_linkP; - - TTresponse *copyChain() const; public: TTresponse(const TTstring &src); TTresponse(int val1, int val2); TTresponse(const TTresponse *src); virtual ~TTresponse(); + /** + * Makes a copy of the chain of responses + */ + TTresponse *copyChain() const; + TTresponse *getLink() const { return _linkP; } void addLink(TTresponse *item); diff --git a/engines/titanic/true_talk/tt_script_base.cpp b/engines/titanic/true_talk/tt_script_base.cpp index 25c0b781bd..218c86deb3 100644 --- a/engines/titanic/true_talk/tt_script_base.cpp +++ b/engines/titanic/true_talk/tt_script_base.cpp @@ -22,6 +22,7 @@ #include "common/textconsole.h" #include "titanic/true_talk/tt_script_base.h" +#include "titanic/titanic.h" namespace Titanic { @@ -31,7 +32,7 @@ TTscriptBase::TTscriptBase(int scriptId, const char *charClass, int v2, _nodesP(nullptr), _id(0), _hist1P(nullptr), _field20(0), _field24(0), _field28(0), _field2C(0), _field30(0), _field34(0), _hist2P(nullptr), _field3C(0), - _respHeadP(nullptr), _respTailP(nullptr), _responseP(nullptr) { + _respHeadP(nullptr), _respTailP(nullptr), _oldResponseP(nullptr) { if (!isValid()) { if (!v7 || !getStatus()) { _id = scriptId; @@ -52,7 +53,7 @@ TTscriptBase::TTscriptBase(int scriptId, const char *charClass, int v2, TTscriptBase::~TTscriptBase() { deleteResponses(); - delete _responseP; + delete _oldResponseP; delete _hist1P; delete _hist2P; @@ -83,7 +84,7 @@ void TTscriptBase::reset() { _field3C = 0; _respHeadP = nullptr; _respTailP = nullptr; - _responseP = nullptr; + _oldResponseP = nullptr; } int TTscriptBase::preprocess(TTsentence *sentence) { @@ -93,20 +94,27 @@ int TTscriptBase::preprocess(TTsentence *sentence) { return _hist1P ? SS_VALID : SS_7; } -void TTscriptBase::proc2(int v) { - warning("TODO"); +void TTscriptBase::addResponse(const TTstring &str) { + appendResponse2(-1, nullptr, str); } -void TTscriptBase::proc3(int v) { - warning("TODO"); +void TTscriptBase::addResponse(int val) { + appendResponse(-1, nullptr, val); } -void TTscriptBase::proc4(int v) { - warning("TODO"); -} +void TTscriptBase::applyResponse() { + delete _oldResponseP; + _oldResponseP = nullptr; + + if (_respHeadP) { + g_vm->_scriptHandler->setResponse(this, _respHeadP); + _oldResponseP = _respHeadP->copyChain(); + TTresponse *oldRespP = _respHeadP; + _respHeadP = _respHeadP->getLink(); + _respTailP = nullptr; -void TTscriptBase::proc5() { - warning("TODO"); + delete oldRespP; + } } void TTscriptBase::deleteResponses() { diff --git a/engines/titanic/true_talk/tt_script_base.h b/engines/titanic/true_talk/tt_script_base.h index 1baff891bb..8387d24dbd 100644 --- a/engines/titanic/true_talk/tt_script_base.h +++ b/engines/titanic/true_talk/tt_script_base.h @@ -53,7 +53,7 @@ protected: int _field3C; TTresponse *_respHeadP; TTresponse *_respTailP; - TTresponse *_responseP; + TTresponse *_oldResponseP; int _status; protected: /** @@ -78,14 +78,15 @@ public: int v3, int v4, int v5, int v6, int v7); virtual ~TTscriptBase(); - virtual void proc2(int v); + virtual void addResponse(const TTstring &str); - virtual void proc3(int v); - - virtual void proc4(int v); - - virtual void proc5(); + virtual void addResponse(int val); + /** + * Passes on the list of dialogue Ids stored in the response(s) + * to the title engine for later display in the PET + */ + virtual void applyResponse(); /** * Returns true if the script is in a valid state -- cgit v1.2.3 From 07c1b2b23d5e97d28707f4abf734fe1506da1999 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 30 May 2016 10:18:50 -0400 Subject: TITANIC: Fleshing out of CTrueTalkManager class --- engines/titanic/titanic.h | 1 + engines/titanic/true_talk/true_talk_manager.cpp | 50 ++++++++++++++++++++++--- engines/titanic/true_talk/true_talk_manager.h | 37 +++++++++++++++++- engines/titanic/true_talk/tt_npc_script.cpp | 7 ++++ engines/titanic/true_talk/tt_npc_script.h | 2 + engines/titanic/true_talk/tt_room_script.h | 2 +- 6 files changed, 91 insertions(+), 8 deletions(-) diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index 768f3348b7..4391796e51 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -121,6 +121,7 @@ public: Common::RandomSource _randomSource; CScriptHandler *_scriptHandler; TTscriptBase *_script; + CTrueTalkManager *_trueTalkManager; CExeResources _exeResources; CMovieList _activeMovies; StringArray _itemNames; diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index bff4ba60ba..76937dab4b 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -32,7 +32,7 @@ namespace Titanic { int CTrueTalkManager::_v1; int CTrueTalkManager::_v2; -int CTrueTalkManager::_v3; +int CTrueTalkManager::_passengerClass; bool CTrueTalkManager::_v4; bool CTrueTalkManager::_v5; int CTrueTalkManager::_v6; @@ -50,10 +50,12 @@ CTrueTalkManager::CTrueTalkManager(CGameManager *owner) : _dialogueFile(nullptr), _dialogueId(0) { _titleEngine.setup(3, 3); _currentNPC = nullptr; + g_vm->_trueTalkManager = this; } CTrueTalkManager::~CTrueTalkManager() { clear(); + g_vm->_trueTalkManager = nullptr; } void CTrueTalkManager::save(SimpleFile *file) const { @@ -100,7 +102,7 @@ void CTrueTalkManager::loadStatics(SimpleFile *file) { int count = file->readNumber(); _v1 = file->readNumber(); _v2 = file->readNumber(); - _v3 = file->readNumber(); + _passengerClass = file->readNumber(); _v4 = file->readNumber() != 0; _v5 = file->readNumber() != 0; _v6 = file->readNumber(); @@ -124,7 +126,7 @@ void CTrueTalkManager::saveStatics(SimpleFile *file) { file->writeNumber(10); file->writeNumber(_v1); file->writeNumber(_v2); - file->writeNumber(_v3); + file->writeNumber(_passengerClass); file->writeNumber(_v4 ? 1 : 0); file->writeNumber(_v5 ? 1 : 0); file->writeNumber(_v6); @@ -148,7 +150,7 @@ void CTrueTalkManager::setFlags(int index, int val) { switch (index) { case 1: if (val >= 1 && val <= 3) - _v3 = val; + _passengerClass = val; break; case 2: @@ -233,6 +235,14 @@ void CTrueTalkManager::start(CTrueTalkNPC *npc, uint id, CViewItem *view) { setDialogue(npc, roomScript, view); } +void CTrueTalkManager::start3(CTrueTalkNPC *npc, CViewItem *view) { + start(npc, 3, view); +} + +void CTrueTalkManager::start4(CTrueTalkNPC *npc, CViewItem *view) { + start(npc, 4, view); +} + TTnpcScript *CTrueTalkManager::getTalker(const CString &name) const { if (name.contains("Doorbot")) return _scripts.getNpcScript(104); @@ -285,6 +295,18 @@ TTroomScript *CTrueTalkManager::getRoomScript() const { return script; } +TTroomScript *CTrueTalkManager::getRoomScript(int roomId) const { + TTroomScript *script = nullptr; + if (roomId) + script = _scripts.getRoomScript(roomId); + + if (!script) + // Fall back on the default Room script + script = _scripts.getRoomScript(110); + + return script; +} + void CTrueTalkManager::loadAssets(CTrueTalkNPC *npc, int charId) { // If assets for the character are already loaded, simply exit if (_currentCharId == charId) @@ -526,7 +548,7 @@ void CTrueTalkManager::playSpeech(TTtalker *talker, TTroomScript *roomScript, CV } } -int CTrueTalkManager::getStateVal(int stateNum) { +int CTrueTalkManager::getStateValue(int stateNum) { if (!_currentNPC) return -1000; @@ -549,4 +571,22 @@ bool CTrueTalkManager::proximityMethod1(int val) { return false; } +CGameManager *CTrueTalkManager::getGameManager() const { + return _gameManager; +} + +CGameState *CTrueTalkManager::getGameState() const { + return _gameManager ? &_gameManager->_gameState : nullptr; +} + +int CTrueTalkManager::getPassengerClass() const { + CGameState *gameState = getGameState(); + return gameState ? gameState->_passengerClass : 4; +} + +int CTrueTalkManager::getState14() const { + CGameState *gameState = getGameState(); + return gameState ? gameState->_field14 : 0; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index 3467fe1cb5..89b9cfd7db 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -33,6 +33,7 @@ namespace Titanic { class CGameManager; +class CGameState; class CTreeItem; class CViewItem; class CTrueTalkManager; @@ -107,10 +108,27 @@ private: void playSpeech(TTtalker *talker, TTroomScript *roomScript, CViewItem *view, bool isParrot); static bool proximityMethod1(int val); + + /** + * Return the game manager + */ + CGameManager *getGameManager() const; + + /** + * Return the game state + */ + CGameState *getGameState() const; + + /** + * Get the player's passenger class + */ + int getPassengerClass() const; + + int getState14() const; public: static int _v1; static int _v2; - static int _v3; + static int _passengerClass; static bool _v4; static bool _v5; static int _v6; @@ -126,7 +144,7 @@ public: /** * Get a specified state value from the currently set NPC */ - static int getStateVal(int stateNum); + static int getStateValue(int stateNum); /** * Trigger an NPC action @@ -188,6 +206,16 @@ public: */ void start(CTrueTalkNPC *npc, uint id, CViewItem *view); + /** + * Start a TrueTalk conversation + */ + void start3(CTrueTalkNPC *npc, CViewItem *view); + + /** + * Start a TrueTalk conversation + */ + void start4(CTrueTalkNPC *npc, CViewItem *view); + /** * Return a TrueTalk talker/script */ @@ -197,6 +225,11 @@ public: * Process player's input */ void processInput(CTrueTalkNPC *npc, CTextInputMsg *msg, CViewItem *view); + + /** + * Gets the script associated with a specific room + */ + TTroomScript *getRoomScript(int roomId) const; }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 0775d09c08..2aa3b85726 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -23,6 +23,7 @@ #include "common/textconsole.h" #include "titanic/true_talk/tt_npc_script.h" #include "titanic/true_talk/true_talk_manager.h" +#include "titanic/titanic.h" namespace Titanic { @@ -229,4 +230,10 @@ void TTnpcScript::preLoad() { } } +int TTnpcScript::getRoom54(int roomId) { + TTroomScript *room = g_vm->_trueTalkManager->getRoomScript(roomId); + return room ? room->_field54 : 0; +} + + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 2396943025..2c6c6a007f 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -75,6 +75,8 @@ protected: void resetFlags(); void randomizeFlags(); + + static int getRoom54(int roomId); public: TTnpcScript(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, diff --git a/engines/titanic/true_talk/tt_room_script.h b/engines/titanic/true_talk/tt_room_script.h index 7fd43f3c79..63aedd260c 100644 --- a/engines/titanic/true_talk/tt_room_script.h +++ b/engines/titanic/true_talk/tt_room_script.h @@ -52,7 +52,7 @@ public: class TTroomScript : public TTroomScriptBase { -private: +public: int _field54; public: TTroomScript(int scriptId); -- cgit v1.2.3 From 3ad600439b7cfceae854a8a257a20c4a934634e2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 30 May 2016 10:58:39 -0400 Subject: TITANIC: Added TTnpcScript getValue --- engines/titanic/true_talk/true_talk_manager.cpp | 8 ++--- engines/titanic/true_talk/true_talk_manager.h | 16 ++++----- engines/titanic/true_talk/tt_npc_script.cpp | 48 +++++++++++++++++++++++++ engines/titanic/true_talk/tt_npc_script.h | 5 +++ 4 files changed, 65 insertions(+), 12 deletions(-) diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 76937dab4b..1c10953206 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -32,7 +32,7 @@ namespace Titanic { int CTrueTalkManager::_v1; int CTrueTalkManager::_v2; -int CTrueTalkManager::_passengerClass; +int CTrueTalkManager::_v3; bool CTrueTalkManager::_v4; bool CTrueTalkManager::_v5; int CTrueTalkManager::_v6; @@ -102,7 +102,7 @@ void CTrueTalkManager::loadStatics(SimpleFile *file) { int count = file->readNumber(); _v1 = file->readNumber(); _v2 = file->readNumber(); - _passengerClass = file->readNumber(); + _v3 = file->readNumber(); _v4 = file->readNumber() != 0; _v5 = file->readNumber() != 0; _v6 = file->readNumber(); @@ -126,7 +126,7 @@ void CTrueTalkManager::saveStatics(SimpleFile *file) { file->writeNumber(10); file->writeNumber(_v1); file->writeNumber(_v2); - file->writeNumber(_passengerClass); + file->writeNumber(_v3); file->writeNumber(_v4 ? 1 : 0); file->writeNumber(_v5 ? 1 : 0); file->writeNumber(_v6); @@ -150,7 +150,7 @@ void CTrueTalkManager::setFlags(int index, int val) { switch (index) { case 1: if (val >= 1 && val <= 3) - _passengerClass = val; + _v3 = val; break; case 2: diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index 89b9cfd7db..ef226f2364 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -118,17 +118,10 @@ private: * Return the game state */ CGameState *getGameState() const; - - /** - * Get the player's passenger class - */ - int getPassengerClass() const; - - int getState14() const; public: static int _v1; static int _v2; - static int _passengerClass; + static int _v3; static bool _v4; static bool _v5; static int _v6; @@ -230,6 +223,13 @@ public: * Gets the script associated with a specific room */ TTroomScript *getRoomScript(int roomId) const; + + /** + * Get the player's passenger class + */ + int getPassengerClass() const; + + int getState14() const; }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 2aa3b85726..7020794d1a 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -235,5 +235,53 @@ int TTnpcScript::getRoom54(int roomId) { return room ? room->_field54 : 0; } +int TTnpcScript::getValue(int testNum) { + switch (testNum) { + case 0: + return CTrueTalkManager::_v2; + + case 1: + if (g_vm->_trueTalkManager) + CTrueTalkManager::_v3 = g_vm->_trueTalkManager->getPassengerClass(); + return CTrueTalkManager::_v3; + + case 2: + return CTrueTalkManager::_v4; + + case 3: + return CTrueTalkManager::_v5 != 0; + + case 4: + if (g_vm->_trueTalkManager) { + switch (g_vm->_trueTalkManager->getState14()) { + case 1: + CTrueTalkManager::_v6 = 3; + break; + case 2: + CTrueTalkManager::_v6 = 0; + break; + case 3: + CTrueTalkManager::_v6 = 1; + break; + default: + CTrueTalkManager::_v6 = 2; + break; + } + } + return CTrueTalkManager::_v6; + + case 5: + return CTrueTalkManager::_v7; + + case 6: + return CTrueTalkManager::_v8 != 0; + + case 7: + return !!getRoom54(123); + + default: + return CTrueTalkManager::_v11[testNum]; + } +} } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 2c6c6a007f..833a958249 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -77,6 +77,11 @@ protected: void randomizeFlags(); static int getRoom54(int roomId); + + /** + * Perform test on various state values + */ + int getValue(int testNum); public: TTnpcScript(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, -- cgit v1.2.3 From d84fb55a24e36b2d829b89534a166b802a4b1fd7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 30 May 2016 19:15:47 -0400 Subject: TITANIC: Adding TTnpcScript dialogue Id handling --- engines/titanic/true_talk/barbot_script.cpp | 11 +-- engines/titanic/true_talk/barbot_script.h | 11 +-- engines/titanic/true_talk/bellbot_script.cpp | 11 +-- engines/titanic/true_talk/bellbot_script.h | 10 +-- engines/titanic/true_talk/deskbot_script.cpp | 27 +++++-- engines/titanic/true_talk/deskbot_script.h | 13 ++-- engines/titanic/true_talk/doorbot_script.cpp | 11 +-- engines/titanic/true_talk/doorbot_script.h | 10 +-- engines/titanic/true_talk/liftbot_script.cpp | 9 ++- engines/titanic/true_talk/liftbot_script.h | 8 +- engines/titanic/true_talk/maitred_script.cpp | 9 ++- engines/titanic/true_talk/maitred_script.h | 8 +- engines/titanic/true_talk/parrot_script.cpp | 5 +- engines/titanic/true_talk/parrot_script.h | 4 +- engines/titanic/true_talk/succubus_script.cpp | 7 +- engines/titanic/true_talk/succubus_script.h | 6 +- engines/titanic/true_talk/tt_npc_script.cpp | 104 ++++++++++++++++++++++++-- engines/titanic/true_talk/tt_npc_script.h | 35 +++++++-- 18 files changed, 217 insertions(+), 82 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index ab4fbb2384..2bb3a1876f 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -25,7 +25,7 @@ namespace Titanic { -int BarbotScript::proc6() const { +int BarbotScript::proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag) { warning("TODO"); return 2; } @@ -59,7 +59,7 @@ bool BarbotScript::proc18() const { return false; } -int BarbotScript::proc21(int v) { +int BarbotScript::proc21(int v1, int v2, int v3) { warning("TODO"); return 0; } @@ -74,8 +74,9 @@ int BarbotScript::proc23() const { return 0; } -void BarbotScript::proc24() { +const int *BarbotScript::getTablePtr(int id) { warning("TODO"); + return nullptr; } int BarbotScript::proc25() const { @@ -90,12 +91,12 @@ void BarbotScript::proc32() { warning("TODO"); } -int BarbotScript::proc36() const { +int BarbotScript::proc36(int tagId) const { warning("TODO"); return 0; } -int BarbotScript::proc37() const { +uint BarbotScript::translateId(uint id) const { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index ac074e2b94..a55c12bc71 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -33,22 +33,23 @@ public: const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} - virtual int proc6() const; + virtual int proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag); virtual void proc7(int v1, int v2); virtual int proc10() const; virtual int proc15() const; virtual bool proc16() const; virtual bool proc17() const; virtual bool proc18() const; - virtual int proc21(int v); + virtual int proc21(int v1, int v2, int v3); virtual int proc22() const; virtual int proc23() const; - virtual void proc24(); + virtual const int *getTablePtr(int id); virtual int proc25() const; virtual void proc26(); virtual void proc32(); - virtual int proc36() const; - virtual int proc37() const; + virtual int proc36(int val) const; + + virtual uint translateId(uint id) const; }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index ccd83d011f..794e67130f 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -40,7 +40,7 @@ BellbotScript::BellbotScript(int val1, const char *charClass, int v2, _array[1] = 0; } -int BellbotScript::proc6() const { +int BellbotScript::proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag) { warning("TODO"); return 2; } @@ -74,7 +74,7 @@ bool BellbotScript::proc18() const { return 0; } -int BellbotScript::proc21(int v) { +int BellbotScript::proc21(int v1, int v2, int v3) { warning("TODO"); return 0; } @@ -89,8 +89,9 @@ int BellbotScript::proc23() const { return 0; } -void BellbotScript::proc24() { +const int *BellbotScript::getTablePtr(int id) { warning("TODO"); + return nullptr; } int BellbotScript::proc25() const { @@ -101,12 +102,12 @@ int BellbotScript::proc25() const { void BellbotScript::proc26() { } -int BellbotScript::proc36() const { +int BellbotScript::proc36(int id) const { warning("TODO"); return 0; } -int BellbotScript::proc37() const { +uint BellbotScript::translateId(uint id) const { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index d759583513..d7fbab3a8f 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -38,21 +38,21 @@ public: BellbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); - virtual int proc6() const; + virtual int proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag); virtual void proc7(int v1, int v2); virtual int proc10() const; virtual int proc15() const; virtual bool proc16() const; virtual bool proc17() const; virtual bool proc18() const; - virtual int proc21(int v); + virtual int proc21(int v1, int v2, int v3); virtual int proc22() const; virtual int proc23() const; - virtual void proc24(); + virtual const int *getTablePtr(int id); virtual int proc25() const; virtual void proc26(); - virtual int proc36() const; - virtual int proc37() const; + virtual int proc36(int val) const; + virtual uint translateId(uint id) const; }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 65a13b5ce1..dbe2664e99 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -41,9 +41,21 @@ DeskbotScript::DeskbotScript(int val1, const char *charClass, int v2, _field74 = 0; } -int DeskbotScript::proc6() const { - warning("TODO"); - return 2; +int DeskbotScript::proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag) { + for (uint idx = 0; idx < _tags.size(); ++idx) { + const TTnpcScriptTag &scriptTag = _tags[idx]; + uint currTag = (idx == 0) ? MKTAG('P', 'K', 'U', 'P') : scriptTag._tag; + + if (currTag == tag) { + int valIndex = getRandomNumber(scriptTag.size()) - 1; + uint diagId = getDialogueId(scriptTag._values[valIndex]); + addResponse(diagId); + applyResponse(); + break; + } + } + + return SS_1; } void DeskbotScript::proc7(int v1, int v2) { @@ -75,7 +87,7 @@ bool DeskbotScript::proc18() const { return 0; } -int DeskbotScript::proc21(int v) { +int DeskbotScript::proc21(int v1, int v2, int v3) { warning("TODO"); return 0; } @@ -90,8 +102,9 @@ int DeskbotScript::proc23() const { return 0; } -void DeskbotScript::proc24() { +const int *DeskbotScript::getTablePtr(int id) { warning("TODO"); + return nullptr; } int DeskbotScript::proc25() const { @@ -102,12 +115,12 @@ int DeskbotScript::proc25() const { void DeskbotScript::proc26() { } -int DeskbotScript::proc36() const { +int DeskbotScript::proc36(int id) const { warning("TODO"); return 0; } -int DeskbotScript::proc37() const { +uint DeskbotScript::translateId(uint id) const { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index 8db1a80a9c..f2de881777 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -23,30 +23,33 @@ #ifndef TITANIC_DESKBOT_SCRIPT_H #define TITANIC_DESKBOT_SCRIPT_H +#include "common/array.h" #include "titanic/true_talk/tt_npc_script.h" namespace Titanic { class DeskbotScript : public TTnpcScript { +private: + Common::Array _tags; public: DeskbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); - virtual int proc6() const; + virtual int proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag); virtual void proc7(int v1, int v2); virtual int proc10() const; virtual int proc15() const; virtual bool proc16() const; virtual bool proc17() const; virtual bool proc18() const; - virtual int proc21(int v); + virtual int proc21(int v1, int v2, int v3); virtual int proc22() const; virtual int proc23() const; - virtual void proc24(); + virtual const int *getTablePtr(int id); virtual int proc25() const; virtual void proc26(); - virtual int proc36() const; - virtual int proc37() const; + virtual int proc36(int val) const; + virtual uint translateId(uint id) const; virtual void proc38(); virtual void proc39(); diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 43b9e46335..9d35f697f9 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -25,7 +25,7 @@ namespace Titanic { -int DoorbotScript::proc6() const { +int DoorbotScript::proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag) { warning("TODO"); return 2; } @@ -59,7 +59,7 @@ bool DoorbotScript::proc18() const { return 0; } -int DoorbotScript::proc21(int v) { +int DoorbotScript::proc21(int v1, int v2, int v3) { warning("TODO"); return 0; } @@ -74,8 +74,9 @@ int DoorbotScript::proc23() const { return 0; } -void DoorbotScript::proc24() { +const int *DoorbotScript::getTablePtr(int id) { warning("TODO"); + return nullptr; } int DoorbotScript::proc25() const { @@ -90,12 +91,12 @@ void DoorbotScript::proc32() { warning("TODO"); } -int DoorbotScript::proc36() const { +int DoorbotScript::proc36(int id) const { warning("TODO"); return 0; } -int DoorbotScript::proc37() const { +uint DoorbotScript::translateId(uint id) const { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index c812d3129a..82897b7bfc 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -35,22 +35,22 @@ public: const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} - virtual int proc6() const; + virtual int proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag); virtual void proc7(int v1, int v2); virtual int proc10() const; virtual int proc15() const; virtual bool proc16() const; virtual bool proc17() const; virtual bool proc18() const; - virtual int proc21(int v); + virtual int proc21(int v1, int v2, int v3); virtual int proc22() const; virtual int proc23() const; - virtual void proc24(); + virtual const int *getTablePtr(int id); virtual int proc25() const; virtual void proc26(); virtual void proc32(); - virtual int proc36() const; - virtual int proc37() const; + virtual int proc36(int val) const; + virtual uint translateId(uint id) const; }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index c30d226c89..b1577b3979 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -25,7 +25,7 @@ namespace Titanic { -int LiftbotScript::proc6() const { +int LiftbotScript::proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag) { warning("TODO"); return 2; } @@ -64,7 +64,7 @@ bool LiftbotScript::proc18() const { return 0; } -int LiftbotScript::proc21(int v) { +int LiftbotScript::proc21(int v1, int v2, int v3) { warning("TODO"); return 0; } @@ -79,8 +79,9 @@ int LiftbotScript::proc23() const { return 0; } -void LiftbotScript::proc24() { +const int *LiftbotScript::getTablePtr(int id) { warning("TODO"); + return nullptr; } int LiftbotScript::proc25() const { @@ -95,7 +96,7 @@ void LiftbotScript::proc32() { warning("TODO"); } -int LiftbotScript::proc37() const { +uint LiftbotScript::translateId(uint id) const { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index 7bb355a666..8c2ae3210c 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -33,7 +33,7 @@ public: const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} - virtual int proc6() const; + virtual int proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag); virtual void proc7(int v1, int v2); virtual int proc9() const; virtual int proc10() const; @@ -41,14 +41,14 @@ public: virtual bool proc16() const; virtual bool proc17() const; virtual bool proc18() const; - virtual int proc21(int v); + virtual int proc21(int v1, int v2, int v3); virtual int proc22() const; virtual int proc23() const; - virtual void proc24(); + virtual const int *getTablePtr(int id); virtual int proc25() const; virtual void proc26(); virtual void proc32(); - virtual int proc37() const; + virtual uint translateId(uint id) const; }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index 35f1efa68c..5581c6b605 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -39,7 +39,7 @@ MaitreDScript::MaitreDScript(int val1, const char *charClass, int v2, CTrueTalkManager::setFlags(16, 0); } -int MaitreDScript::proc6() const { +int MaitreDScript::proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag) { warning("TODO"); return 2; } @@ -68,7 +68,7 @@ bool MaitreDScript::proc18() const { return 0; } -int MaitreDScript::proc21(int v) { +int MaitreDScript::proc21(int v1, int v2, int v3) { warning("TODO"); return 0; } @@ -83,8 +83,9 @@ int MaitreDScript::proc23() const { return 0; } -void MaitreDScript::proc24() { +const int *MaitreDScript::getTablePtr(int id) { warning("TODO"); + return nullptr; } int MaitreDScript::proc25() const { @@ -95,7 +96,7 @@ int MaitreDScript::proc25() const { void MaitreDScript::proc26() { } -int MaitreDScript::proc37() const { +uint MaitreDScript::translateId(uint id) const { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index bd3e440ea9..14505ca616 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -32,19 +32,19 @@ public: MaitreDScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); - virtual int proc6() const; + virtual int proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag); virtual void proc7(int v1, int v2); virtual int proc10() const; virtual bool proc16() const; virtual bool proc17() const; virtual bool proc18() const; - virtual int proc21(int v); + virtual int proc21(int v1, int v2, int v3); virtual int proc22() const; virtual int proc23() const; - virtual void proc24(); + virtual const int *getTablePtr(int id); virtual int proc25() const; virtual void proc26(); - virtual int proc37() const; + virtual uint translateId(uint id) const; }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/parrot_script.cpp b/engines/titanic/true_talk/parrot_script.cpp index e97d32dd30..a6b37bfc57 100644 --- a/engines/titanic/true_talk/parrot_script.cpp +++ b/engines/titanic/true_talk/parrot_script.cpp @@ -25,7 +25,7 @@ namespace Titanic { -int ParrotScript::proc6() const { +int ParrotScript::proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag) { warning("TODO"); return 2; } @@ -54,8 +54,9 @@ int ParrotScript::proc23() const { return 0; } -void ParrotScript::proc24() { +const int *ParrotScript::getTablePtr(int id) { warning("TODO"); + return nullptr; } int ParrotScript::proc25() const { diff --git a/engines/titanic/true_talk/parrot_script.h b/engines/titanic/true_talk/parrot_script.h index 246ceb4234..0add5d9dfe 100644 --- a/engines/titanic/true_talk/parrot_script.h +++ b/engines/titanic/true_talk/parrot_script.h @@ -33,13 +33,13 @@ public: const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} - virtual int proc6() const; + virtual int proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag); virtual void proc7(int v1, int v2); virtual int proc10() const; virtual bool proc17() const; virtual bool proc18() const; virtual int proc23() const; - virtual void proc24(); + virtual const int *getTablePtr(int id); virtual int proc25() const; virtual void proc26(); }; diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp index 0c1f6700ee..436b779432 100644 --- a/engines/titanic/true_talk/succubus_script.cpp +++ b/engines/titanic/true_talk/succubus_script.cpp @@ -25,7 +25,7 @@ namespace Titanic { -int SuccUBusScript::proc6() const { +int SuccUBusScript::proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag) { warning("TODO"); return 2; } @@ -49,7 +49,7 @@ bool SuccUBusScript::proc18() const { return 0; } -int SuccUBusScript::proc21(int v) { +int SuccUBusScript::proc21(int v1, int v2, int v3) { warning("TODO"); return 0; } @@ -59,8 +59,9 @@ int SuccUBusScript::proc23() const { return 0; } -void SuccUBusScript::proc24() { +const int *SuccUBusScript::getTablePtr(int id) { warning("TODO"); + return nullptr; } int SuccUBusScript::proc25() const { diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h index 6917d0a8b1..8a078c2639 100644 --- a/engines/titanic/true_talk/succubus_script.h +++ b/engines/titanic/true_talk/succubus_script.h @@ -36,14 +36,14 @@ public: TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7), _field2D0(0) {} - virtual int proc6() const; + virtual int proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag); virtual void proc7(int v1, int v2); virtual int proc10() const; virtual bool proc17() const; virtual bool proc18() const; - virtual int proc21(int v); + virtual int proc21(int v1, int v2, int v3); virtual int proc23() const; - virtual void proc24(); + virtual const int *getTablePtr(int id); virtual int proc25() const; virtual void proc26(); }; diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 7020794d1a..bbd75a4854 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -27,6 +27,17 @@ namespace Titanic { +int TTnpcScriptTag::size() const { + for (int idx = 0; idx < 4; ++idx) { + if (_values[idx] == 0) + return idx; + } + + return 4; +} + +/*------------------------------------------------------------------------*/ + TTnpcScriptBase::TTnpcScriptBase(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTscriptBase(0, charClass, v2, charName, v3, v4, v5, v6, v7), @@ -40,9 +51,9 @@ TTnpcScript::TTnpcScript(int charId, const char *charClass, int v2, TTnpcScriptBase(charId, charClass, v2, charName, v3, val2, v4, v5, v6, v7), _subPtr(nullptr), _field60(0), _field64(0), _field68(0), _field6C(0), _field70(0), _field74(0), _field78(0), - _field7C(0), _field80(0) { + _field7C(0), _field80(0), _field2CC(false) { CTrueTalkManager::_v2 = 0; - Common::fill(&_array[0], &_array[147], 0); + Common::fill(&_array[0], &_array[146], 0); if (!CTrueTalkManager::_v10) { Common::fill(&CTrueTalkManager::_v11[0], &CTrueTalkManager::_v11[41], 0); @@ -53,7 +64,8 @@ TTnpcScript::TTnpcScript(int charId, const char *charClass, int v2, } void TTnpcScript::resetFlags() { - Common::fill(&_array[26], &_array[146], 0); + Common::fill(&_array[20], &_array[140], 0); + _field2CC = false; } void TTnpcScript::randomizeFlags() { @@ -109,16 +121,18 @@ bool TTnpcScript::proc18() const { return true; } -void TTnpcScript::proc19(int v) { +uint TTnpcScript::proc19(uint v) { warning("TODO"); + return 0; } void TTnpcScript::proc20(int v) { warning("TODO"); } -int TTnpcScript::proc21(int v) { - return v; +int TTnpcScript::proc21(int v1, int v2, int v3) { + // TODO + return v1; } int TTnpcScript::proc22() const { @@ -216,11 +230,11 @@ int TTnpcScript::getDialLevel(uint dialNum, bool flag) { return 0; } -int TTnpcScript::proc36() const { +int TTnpcScript::proc36(int id) const { return 0; } -int TTnpcScript::proc37() const { +uint TTnpcScript::translateId(uint id) const { return 0; } @@ -284,4 +298,78 @@ int TTnpcScript::getValue(int testNum) { } } +uint TTnpcScript::getRandomNumber(int max) const { + return 1 + g_vm->getRandomNumber(max - 1); +} + +uint TTnpcScript::getDialogueId(uint tagId) { + if (tagId < 200000) + return tagId; + + // Perform any script specific translation + uint origId = tagId; + if (tagId >= 290000 && tagId <= 290263) + tagId = translateId(tagId); + if (!tagId) + return 0; + + if (!_field2CC) { + _field2CC = true; + int val = translateByArray(tagId); + if (val > 0) { + if (proc36(val)) + return 4; + } + } + + uint oldTagId = tagId; + tagId = proc19(tagId); + if (tagId != oldTagId) + tagId = proc19(tagId); + + oldTagId = proc23(); + int v21 = proc21(origId, tagId, oldTagId); + if (!v21) + return 0; + + int idx = 0; + const int *tableP; + for (;;) { + tableP = getTablePtr(idx++); + if (!tableP) + return 0; + + if (*tableP == v21) + break; + } + uint newVal = tableP[oldTagId + 1]; + + idx = 0; + int *arrP = &_array[26]; + while (idx < 4 && arrP[idx]) + ++idx; + if (idx == 4) + return newVal; + + _array[26] = origId; + idx = 0; + arrP = &_array[30]; + while (idx < 4 && arrP[idx]) + ++idx; + if (idx == 4) + return newVal; + + arrP[idx] = newVal; + return newVal; +} + +int TTnpcScript::translateByArray(int id) { + for (uint idx = 1, arrIndex = 35; idx < 15; ++idx, arrIndex += 8) { + if (_array[idx - 1] == id && _array[idx] == 0) + return idx; + } + + return -1; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 833a958249..d52da2ed73 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -31,6 +31,16 @@ namespace Titanic { class TTroomScript; class TTsentence; +struct TTnpcScriptTag { + uint _tag; + uint _values[4]; + + /** + * Returns the size of the values list plus 1 + */ + int size() const; +}; + class TTnpcScriptBase : public TTscriptBase { protected: int _field54; @@ -59,6 +69,8 @@ public: }; class TTnpcScript : public TTnpcScriptBase { +private: + int translateByArray(int id); protected: byte *_subPtr; int _field60; @@ -70,7 +82,8 @@ protected: int _field78; int _field7C; int _field80; - int _array[147]; + int _array[146]; + bool _field2CC; protected: void resetFlags(); @@ -82,6 +95,16 @@ protected: * Perform test on various state values */ int getValue(int testNum); + + /** + * Gets a random number between 1 and a given max + */ + uint getRandomNumber(int max) const; + + /** + * Returns a dialogue Id by script tag value Id + */ + uint getDialogueId(uint tagId); public: TTnpcScript(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, @@ -108,12 +131,12 @@ public: virtual bool proc16() const; virtual bool proc17() const; virtual bool proc18() const; - virtual void proc19(int v); + virtual uint proc19(uint v); virtual void proc20(int v); - virtual int proc21(int v); + virtual int proc21(int v1, int v2, int v3); virtual int proc22() const; virtual int proc23() const; - virtual void proc24() = 0; + virtual const int *getTablePtr(int id) = 0; virtual int proc25() const; virtual void proc26(); virtual void save(SimpleFile *file); @@ -130,8 +153,8 @@ public: */ virtual int getDialLevel(uint dialNum, bool flag = true); - virtual int proc36() const; - virtual int proc37() const; + virtual int proc36(int val) const; + virtual uint translateId(uint id) const; void preLoad(); -- cgit v1.2.3 From ef3bd4e28609749b4ada71210dce079cd77dc2a4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 30 May 2016 22:35:45 -0400 Subject: DEVTOOLS: Adding Deskbot tags list --- devtools/create_titanic/create_titanic_dat.cpp | 2 + devtools/create_titanic/file.h | 2 + devtools/create_titanic/module.mk | 1 + devtools/create_titanic/script_tags.cpp | 191 +++++++++++++++++++++++++ devtools/create_titanic/script_tags.h | 32 +++++ 5 files changed, 228 insertions(+) create mode 100644 devtools/create_titanic/script_tags.cpp create mode 100644 devtools/create_titanic/script_tags.h diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index 35157b07cf..9b8e8caa58 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -36,6 +36,7 @@ #include "common/rect.h" #include "winexe_pe.h" #include "file.h" +#include "script_tags.h" /** * Format of the access.dat file that will be created: @@ -352,6 +353,7 @@ void writeData() { writeStringArray("TEXT/PRONOUNS", 0x22F718, 15); writeNumbers(); + writeAllScriptTags(); } int main(int argc, char *argv[]) { diff --git a/devtools/create_titanic/file.h b/devtools/create_titanic/file.h index e8d49600e8..4580e83b19 100644 --- a/devtools/create_titanic/file.h +++ b/devtools/create_titanic/file.h @@ -210,4 +210,6 @@ public: } +extern Common::File inputFile, outputFile; + #endif diff --git a/devtools/create_titanic/module.mk b/devtools/create_titanic/module.mk index 05a4130dad..f74f445c50 100644 --- a/devtools/create_titanic/module.mk +++ b/devtools/create_titanic/module.mk @@ -4,6 +4,7 @@ MODULE := devtools/create_titanic MODULE_OBJS := \ create_titanic_dat.o \ hashmap.o \ + script_tags.o \ str.o \ winexe.o \ winexe_pe.o diff --git a/devtools/create_titanic/script_tags.cpp b/devtools/create_titanic/script_tags.cpp new file mode 100644 index 0000000000..3ee94ab8e4 --- /dev/null +++ b/devtools/create_titanic/script_tags.cpp @@ -0,0 +1,191 @@ +/* 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. + * + */ + + // Disable symbol overrides so that we can use system headers. +#define FORBIDDEN_SYMBOL_ALLOW_ALL + +// HACK to allow building with the SDL backend on MinGW +// see bug #1800764 "TOOLS: MinGW tools building broken" +#ifdef main +#undef main +#endif // main + +#include "file.h" +#include "script_tags.h" + +static const int DESKBOT_TAGS[][5] = { + { MKTAG('P', 'K', 'U', 'P'), 240573, 0, 0, 0 }, + { MKTAG('S', 'E', 'X', '1'), 240573, 0, 0, 0 }, + { MKTAG('R', 'E', 'S', '1'), 240354, 0, 0, 0 }, + { MKTAG('R', 'E', 'S', '2'), 240547, 0, 0, 0 }, + { MKTAG('S', 'W', 'E', 'R'), 240578, 0, 0, 0 }, + { MKTAG('B', 'Y', 'Z', 'A'), 241173, 0, 0, 0 }, + { MKTAG('S', 'A', 'S', 'S'), 240986, 0, 0, 0 }, + { MKTAG('S', 'H', 'M', 'S'), 240453, 0, 0, 0 }, + { MKTAG('F', 'O', 'O', 'D'), 240849, 0, 0, 0 }, + { MKTAG('J', 'F', 'O', 'D'), 240849, 0, 0, 0 }, + + { MKTAG('C', 'H', 'S', 'E'), 240849, 0, 0, 0 }, + { MKTAG('A', 'C', 'T', 'R'), 240654, 0, 0, 0 }, + { MKTAG('A', 'C', 'T', 'S'), 240655, 0, 0, 0 }, + { MKTAG('M', 'U', 'S', 'I'), 240681, 240849, 0, 0 }, + { MKTAG('S', 'A', 'N', 'G'), 240681, 240657, 0, 0 }, + { MKTAG('S', 'O', 'A', 'P'), 240681, 0, 0, 0 }, + { MKTAG('T', 'V', 'S', 'H'), 240681, 0, 0, 0 }, + { MKTAG('A', 'R', 'T', 'I'), 240657, 0, 0, 0 }, + { MKTAG('A', 'U', 'T', 'H'), 240657, 0, 0, 0 }, + { MKTAG('C', 'O', 'M', 'D'), 240657, 240785, 0, 0 }, + + { MKTAG('C', 'O', 'O', 'K'), 240657, 0, 0, 0 }, + { MKTAG('C', 'O', 'P', 'S'), 240657, 0, 0, 0 }, + { MKTAG('H', 'E', 'R', 'O'), 240657, 0, 0, 0 }, + { MKTAG('H', 'O', 'S', 'T'), 240657, 0, 0, 0 }, + { MKTAG('P', 'T', 'I', 'C'), 240657, 0, 0, 0 }, + { MKTAG('S', 'C', 'I', 'T'), 240657, 0, 0, 0 }, + { MKTAG('E', 'A', 'R', 'T'), 240728, 0, 0, 0 }, + { MKTAG('P', 'L', 'A', 'N'), 240728, 0, 0, 0 }, + { MKTAG('F', 'I', 'L', 'M'), 240939, 0, 0, 0 }, + { MKTAG('F', 'I', 'S', 'H'), 240437, 0, 0, 0 }, + + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + + { MKTAG('H', 'H', 'G', 'Q'), 241065, 240453, 0, 0 }, + { MKTAG('L', 'I', 'Q', 'D'), 241167, 0, 0, 0 }, + { MKTAG('P', 'H', 'I', 'L'), 240607, 0, 0, 0 }, + { MKTAG('S', 'I', 'C', 'K'), 241170, 0, 0, 0 }, + { MKTAG('T', 'W', 'A', 'T'), 240975, 0, 0, 0 }, + { MKTAG('H', 'A', 'H', 'A'), 240785, 0, 0, 0 }, + { MKTAG('S', 'C', 'I', 'T'), 240968, 241617, 0, 0 }, + { MKTAG('S', 'C', 'I', 'E'), 240967, 241616, 0, 0 }, + { MKTAG('S', 'L', 'O', 'W'), 241614, 0, 0, 0 }, + { MKTAG('T', 'H', 'A', 'T'), 240760, 241615, 0, 0 }, + + { MKTAG('T', 'D', 'U', 'P'), 241161, 241618, 0, 0 }, + { MKTAG('T', 'I', 'T', 'A'), 241619, 0, 0, 0 }, + { MKTAG('C', 'S', 'P', 'Y'), 241620, 0, 0, 0 }, + { MKTAG('M', 'I', 'N', 'S'), 241621, 0, 0, 0 }, + { MKTAG('M', 'C', 'P', 'Y'), 241622, 0, 0, 0 }, + { MKTAG('D', 'N', 'C', 'E'), 241623, 0, 0, 0 }, + { MKTAG('N', 'A', 'U', 'T'), 241624, 0, 0, 0 }, + { MKTAG('A', 'D', 'V', 'T'), 240939, 241622, 0, 0 }, + { MKTAG('A', 'N', 'S', 'W'), 240453, 0, 0, 0 }, + { MKTAG('A', 'R', 'T', 'Y'), 240658, 0, 0, 0 }, + + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, + { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 } +}; + +void writeScriptTags(const char *name, const int *tags, uint count) { + outputFile.seek(dataOffset); + + for (int idx = 0; idx < count * 5; ++idx, ++tags) + outputFile.writeLong(*tags); + + writeEntryHeader(name, dataOffset, count * 5 * 4); + dataOffset += count * 5 * 4; +} + +void writeAllScriptTags() { + writeScriptTags("Tags/103", &DESKBOT_TAGS[0][0], 129); +} \ No newline at end of file diff --git a/devtools/create_titanic/script_tags.h b/devtools/create_titanic/script_tags.h new file mode 100644 index 0000000000..86cd1e6aed --- /dev/null +++ b/devtools/create_titanic/script_tags.h @@ -0,0 +1,32 @@ +/* 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. + * + */ + +#ifndef COMMON_SCRIPT_TAGS_H +#define COMMON_SCRIPT_TAGS_H + +#include "common/scummsys.h" + +extern void writeAllScriptTags(); +extern void writeEntryHeader(const char *name, uint offset, uint size); +extern uint dataOffset; + +#endif -- cgit v1.2.3 From cf0051caf719a5ee510973df31aa3b4e4bddc832 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 31 May 2016 18:36:45 -0400 Subject: DEVTOOLS: Completed tags list for Deskbot --- devtools/create_titanic/script_tags.cpp | 175 ++++++++++++++++---------------- 1 file changed, 87 insertions(+), 88 deletions(-) diff --git a/devtools/create_titanic/script_tags.cpp b/devtools/create_titanic/script_tags.cpp index 3ee94ab8e4..e5df5e6b87 100644 --- a/devtools/create_titanic/script_tags.cpp +++ b/devtools/create_titanic/script_tags.cpp @@ -32,7 +32,7 @@ #include "file.h" #include "script_tags.h" -static const int DESKBOT_TAGS[][5] = { +static const int DESKBOT_TAGS[128][5] = { { MKTAG('P', 'K', 'U', 'P'), 240573, 0, 0, 0 }, { MKTAG('S', 'E', 'X', '1'), 240573, 0, 0, 0 }, { MKTAG('R', 'E', 'S', '1'), 240354, 0, 0, 0 }, @@ -66,17 +66,6 @@ static const int DESKBOT_TAGS[][5] = { { MKTAG('F', 'I', 'L', 'M'), 240939, 0, 0, 0 }, { MKTAG('F', 'I', 'S', 'H'), 240437, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('H', 'H', 'G', 'Q'), 241065, 240453, 0, 0 }, { MKTAG('L', 'I', 'Q', 'D'), 241167, 0, 0, 0 }, { MKTAG('P', 'H', 'I', 'L'), 240607, 0, 0, 0 }, @@ -99,81 +88,91 @@ static const int DESKBOT_TAGS[][5] = { { MKTAG('A', 'N', 'S', 'W'), 240453, 0, 0, 0 }, { MKTAG('A', 'R', 'T', 'Y'), 240658, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 }, - { MKTAG('x', 'x', 'x', 'x'), 0, 0, 0, 0 } + { MKTAG('B', 'A', 'R', 'T'), 240491, 0, 0, 0 }, + { MKTAG('B', 'A', 'R', '3'), 240610, 0, 0, 0 }, + { MKTAG('B', 'A', 'R', 'K'), 240768, 0, 0, 0 }, + { MKTAG('B', 'A', 'R', 'U'), 240768, 0, 0, 0 }, + { MKTAG('B', 'E', 'L', '1'), 240940, 0, 0, 0 }, + { MKTAG('B', 'E', 'L', '2'), 240591, 0, 0, 0 }, + { MKTAG('B', 'E', 'L', '3'), 240775, 0, 0, 0 }, + { MKTAG('B', 'E', 'L', '4'), 240558, 0, 0, 0 }, + { MKTAG('B', 'E', 'L', '5'), 240336, 0, 0, 0 }, + { MKTAG('B', 'E', 'L', '6'), 240759, 240760, 0, 0 }, + + { MKTAG('B', 'E', 'L', '7'), 240726, 0, 0, 0 }, + { MKTAG('B', 'L', 'F', '1'), 241652, 0, 0, 0 }, + { MKTAG('B', 'L', 'F', '2'), 240939, 0, 0, 0 }, + { MKTAG('B', 'L', 'P', '1'), 240654, 0, 0, 0 }, + { MKTAG('B', 'L', 'P', '2'), 240654, 0, 0, 0 }, + { MKTAG('B', 'L', 'P', '3'), 240654, 0, 0, 0 }, + { MKTAG('B', 'L', 'P', '4'), 240655, 0, 0, 0 }, + { MKTAG('B', 'L', 'R', '1'), 240654, 0, 0, 0 }, + { MKTAG('B', 'L', 'R', '2'), 240655, 0, 0, 0 }, + { MKTAG('B', 'L', 'T', '1'), 240718, 0, 0, 0 }, + + { MKTAG('B', 'L', 'T', '2'), 240681, 0, 0, 0 }, + { MKTAG('B', 'L', 'T', '3'), 240655, 0, 0, 0 }, + { MKTAG('B', 'L', 'T', '4'), 240664, 0, 0, 0 }, + { MKTAG('B', 'T', 'T', '5'), 240681, 0, 0, 0 }, + { MKTAG('B', 'O', 'D', 'Y'), 240596, 0, 0, 0 }, + { MKTAG('B', 'O', 'Y', 'S'), 240654, 0, 0, 0 }, + { MKTAG('B', 'R', 'N', 'D'), 240939, 241622, 0, 0 }, + { MKTAG('C', 'L', 'U', 'B'), 241675, 240681, 241623, 0 }, + { MKTAG('C', 'M', 'N', 'T'), 240849, 0, 0, 0 }, + { MKTAG('C', 'R', 'I', 'M'), 241096, 240725, 240729, 0 }, + + { MKTAG('D', 'C', 'T', 'R'), 240725, 0, 0, 0 }, + { MKTAG('D', 'O', 'R', '2'), 241405, 241404, 241403, 241402 }, + { MKTAG('D', 'B', 'U', 'G'), 240922, 240931, 0, 0 }, + { MKTAG('F', 'A', 'M', 'E'), 240726, 0, 0, 0 }, + { MKTAG('F', 'A', 'S', 'H'), 241172, 0, 0, 0 }, + { MKTAG('F', 'A', 'U', 'N'), 240939, 0, 0, 0 }, + { MKTAG('F', 'L', 'O', 'R'), 240825, 0, 0, 0 }, + { MKTAG('F', 'U', 'L', 'N'), 240864, 241072, 0, 0 }, + { MKTAG('G', 'I', 'R', 'L'), 241144, 0, 0, 0 }, + { MKTAG('H', 'B', 'B', 'Y'), 241144, 0, 0, 0 }, + + { MKTAG('H', 'H', 'L', 'D'), 241144, 0, 0, 0 }, + { MKTAG('H', 'O', 'M', 'E'), 240844, 240626, 0, 0 }, + { MKTAG('I', 'S', 'H', 'E'), 240731, 0, 0, 0 }, + { MKTAG('J', 'N', 'A', 'M'), 240785, 240657, 0, 0 }, + { MKTAG('J', 'O', 'K', 'E'), 240785, 0, 0, 0 }, + { MKTAG('K', 'N', 'O', 'B'), 240657, 0, 0, 0 }, + { MKTAG('K', 'P', 'L', 'C'), 240844, 240626, 0, 0 }, + { MKTAG('L', 'I', 'F', '3'), 240722, 0, 0, 0 }, + { MKTAG('L', 'I', 'T', 'E'), 240785, 0, 0, 0 }, + { MKTAG('L', 'I', 'T', 'R'), 241404, 241405, 241403, 241406 }, + + { MKTAG('M', 'A', 'D', '1'), 241124, 240971, 241615, 0 }, + { MKTAG('M', 'A', 'D', '4'), 241341, 0, 0, 0 }, + { MKTAG('M', 'A', 'D', '6'), 240860, 241114, 0, 0 }, + { MKTAG('M', 'A', 'G', 'S'), 241404, 241405, 241403, 241407 }, + { MKTAG('M', 'L', 'T', 'Y'), 240718, 240719, 0, 0 }, + { MKTAG('N', 'I', 'K', 'E'), 241622, 0, 0, 0 }, + { MKTAG('N', 'I', 'K', 'N'), 240785, 0, 0, 0 }, + { MKTAG('N', 'P', 'L', 'C'), 240844, 240626, 0, 0 }, + { MKTAG('O', 'R', 'D', '1'), 240695, 0, 0, 0 }, + { MKTAG('O', 'R', 'D', '2'), 240744, 240650, 0, 0 }, + + { MKTAG('O', 'R', 'D', '3'), 240647, 0, 0, 0 }, + { MKTAG('O', 'R', 'D', '4'), 240647, 0, 0, 0 }, + { MKTAG('O', 'R', 'D', '5'), 241191, 0, 0, 0 }, + { MKTAG('P', 'G', 'R', 'P'), 240725, 0, 0, 0 }, + { MKTAG('P', 'L', 'A', 'C'), 240728, 0, 0, 0 }, + { MKTAG('R', 'C', 'K', 'T'), 241070, 241161, 0, 0 }, + { MKTAG('S', 'F', 'S', 'F'), 241172, 0, 0, 0 }, + { MKTAG('S', 'P', 'R', 'T'), 241172, 0, 0, 0 }, + { MKTAG('S', 'U', 'C', '1'), 240467, 0, 0, 0 }, + { MKTAG('T', 'E', 'A', 'M'), 241172, 0, 0, 0 }, + + { MKTAG('T', 'L', 'A', ' '), 240727, 240658, 0, 0 }, + { MKTAG('T', 'O', 'Y', 'S'), 240607, 240606, 0, 0 }, + { MKTAG('T', 'R', 'A', '2'), 240611, 0, 0, 0 }, + { MKTAG('T', 'R', 'A', '3'), 240611, 0, 0, 0 }, + { MKTAG('W', 'E', 'A', 'P'), 240939, 0, 0, 0 }, + { MKTAG('W', 'E', 'A', 'T'), 241093, 241094, 241095, 0 }, + { MKTAG('W', 'T', 'H', 'R'), 241093, 241094, 241095, 0 }, + { MKTAG('W', 'W', 'E', 'B'), 241172, 0, 0, 0 } }; void writeScriptTags(const char *name, const int *tags, uint count) { @@ -187,5 +186,5 @@ void writeScriptTags(const char *name, const int *tags, uint count) { } void writeAllScriptTags() { - writeScriptTags("Tags/103", &DESKBOT_TAGS[0][0], 129); + writeScriptTags("Tags/103", &DESKBOT_TAGS[0][0], 128); } \ No newline at end of file -- cgit v1.2.3 From ec33749157a18780b7df13733f23af831d4cb096 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 31 May 2016 20:52:16 -0400 Subject: DEVTOOLS: Add Bellbot script responses to create_titanic --- devtools/create_titanic/create_titanic_dat.cpp | 43 +++- devtools/create_titanic/module.mk | 2 +- devtools/create_titanic/script_responses.cpp | 323 +++++++++++++++++++++++++ devtools/create_titanic/script_responses.h | 32 +++ devtools/create_titanic/script_tags.cpp | 190 --------------- devtools/create_titanic/script_tags.h | 32 --- 6 files changed, 398 insertions(+), 224 deletions(-) create mode 100644 devtools/create_titanic/script_responses.cpp create mode 100644 devtools/create_titanic/script_responses.h delete mode 100644 devtools/create_titanic/script_tags.cpp delete mode 100644 devtools/create_titanic/script_tags.h diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index 9b8e8caa58..133bad577d 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -36,7 +36,7 @@ #include "common/rect.h" #include "winexe_pe.h" #include "file.h" -#include "script_tags.h" +#include "script_responses.h" /** * Format of the access.dat file that will be created: @@ -356,7 +356,48 @@ void writeData() { writeAllScriptTags(); } +// Support method used for translating IDA debugger's output for +// an NPC's chooseResponse method tag list to a format for inclusion +// in this tool's script_respones.cpp file +void createScriptResponses() { + Common::File inFile; + char line[80]; + char c[2]; + c[0] = c[1] = '\0'; + + inFile.open("d:\\temp\\bellbot.txt"); + printf("static const int xxxx_RESPONSES[][5] = {\n"); + + do { + strcpy(line, ""); + + while (!inFile.eof()) { + c[0] = inFile.readByte(); + if (c[0] == '\n') + c[0] = ' '; + else if (c[0] == '\r') + continue; + strcat(line, c); + if (inFile.eof() || strlen(line) == (5 * 9)) + break; + } + + int tag, v1, v2, v3, v4; + sscanf(line, "%x %x %x %x %x", &tag, &v1, &v2, &v3, &v4); + + printf("\t{ MKTAG('%c', '%c', '%c', '%c'), %d, %d, %d, %d },\n", + (tag >> 24) & 0xff, (tag >> 16) & 0xff, (tag >> 8) & 0xff, tag & 0xff, + v1, v2, v3, v4); + + } while (!inFile.eof()); + + printf("};\r\n"); + inFile.close(); +} + int main(int argc, char *argv[]) { + createScriptResponses(); + if (argc != 3) { printf("Format: %s ST.exe titanic.dat\n", argv[0]); exit(0); diff --git a/devtools/create_titanic/module.mk b/devtools/create_titanic/module.mk index f74f445c50..ef5b2a0bdf 100644 --- a/devtools/create_titanic/module.mk +++ b/devtools/create_titanic/module.mk @@ -4,7 +4,7 @@ MODULE := devtools/create_titanic MODULE_OBJS := \ create_titanic_dat.o \ hashmap.o \ - script_tags.o \ + script_responses.o \ str.o \ winexe.o \ winexe_pe.o diff --git a/devtools/create_titanic/script_responses.cpp b/devtools/create_titanic/script_responses.cpp new file mode 100644 index 0000000000..aa342396db --- /dev/null +++ b/devtools/create_titanic/script_responses.cpp @@ -0,0 +1,323 @@ +/* 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. + * + */ + + // Disable symbol overrides so that we can use system headers. +#define FORBIDDEN_SYMBOL_ALLOW_ALL + +// HACK to allow building with the SDL backend on MinGW +// see bug #1800764 "TOOLS: MinGW tools building broken" +#ifdef main +#undef main +#endif // main + +#include "file.h" +#include "script_responses.h" + +static const int DESKBOT_RESPONSES[128][5] = { + { MKTAG('P', 'K', 'U', 'P'), 240573, 0, 0, 0 }, + { MKTAG('S', 'E', 'X', '1'), 240573, 0, 0, 0 }, + { MKTAG('R', 'E', 'S', '1'), 240354, 0, 0, 0 }, + { MKTAG('R', 'E', 'S', '2'), 240547, 0, 0, 0 }, + { MKTAG('S', 'W', 'E', 'R'), 240578, 0, 0, 0 }, + { MKTAG('B', 'Y', 'Z', 'A'), 241173, 0, 0, 0 }, + { MKTAG('S', 'A', 'S', 'S'), 240986, 0, 0, 0 }, + { MKTAG('S', 'H', 'M', 'S'), 240453, 0, 0, 0 }, + { MKTAG('F', 'O', 'O', 'D'), 240849, 0, 0, 0 }, + { MKTAG('J', 'F', 'O', 'D'), 240849, 0, 0, 0 }, + + { MKTAG('C', 'H', 'S', 'E'), 240849, 0, 0, 0 }, + { MKTAG('A', 'C', 'T', 'R'), 240654, 0, 0, 0 }, + { MKTAG('A', 'C', 'T', 'S'), 240655, 0, 0, 0 }, + { MKTAG('M', 'U', 'S', 'I'), 240681, 240849, 0, 0 }, + { MKTAG('S', 'A', 'N', 'G'), 240681, 240657, 0, 0 }, + { MKTAG('S', 'O', 'A', 'P'), 240681, 0, 0, 0 }, + { MKTAG('T', 'V', 'S', 'H'), 240681, 0, 0, 0 }, + { MKTAG('A', 'R', 'T', 'I'), 240657, 0, 0, 0 }, + { MKTAG('A', 'U', 'T', 'H'), 240657, 0, 0, 0 }, + { MKTAG('C', 'O', 'M', 'D'), 240657, 240785, 0, 0 }, + + { MKTAG('C', 'O', 'O', 'K'), 240657, 0, 0, 0 }, + { MKTAG('C', 'O', 'P', 'S'), 240657, 0, 0, 0 }, + { MKTAG('H', 'E', 'R', 'O'), 240657, 0, 0, 0 }, + { MKTAG('H', 'O', 'S', 'T'), 240657, 0, 0, 0 }, + { MKTAG('P', 'T', 'I', 'C'), 240657, 0, 0, 0 }, + { MKTAG('S', 'C', 'I', 'T'), 240657, 0, 0, 0 }, + { MKTAG('E', 'A', 'R', 'T'), 240728, 0, 0, 0 }, + { MKTAG('P', 'L', 'A', 'N'), 240728, 0, 0, 0 }, + { MKTAG('F', 'I', 'L', 'M'), 240939, 0, 0, 0 }, + { MKTAG('F', 'I', 'S', 'H'), 240437, 0, 0, 0 }, + + { MKTAG('H', 'H', 'G', 'Q'), 241065, 240453, 0, 0 }, + { MKTAG('L', 'I', 'Q', 'D'), 241167, 0, 0, 0 }, + { MKTAG('P', 'H', 'I', 'L'), 240607, 0, 0, 0 }, + { MKTAG('S', 'I', 'C', 'K'), 241170, 0, 0, 0 }, + { MKTAG('T', 'W', 'A', 'T'), 240975, 0, 0, 0 }, + { MKTAG('H', 'A', 'H', 'A'), 240785, 0, 0, 0 }, + { MKTAG('S', 'C', 'I', 'T'), 240968, 241617, 0, 0 }, + { MKTAG('S', 'C', 'I', 'E'), 240967, 241616, 0, 0 }, + { MKTAG('S', 'L', 'O', 'W'), 241614, 0, 0, 0 }, + { MKTAG('T', 'H', 'A', 'T'), 240760, 241615, 0, 0 }, + + { MKTAG('T', 'D', 'U', 'P'), 241161, 241618, 0, 0 }, + { MKTAG('T', 'I', 'T', 'A'), 241619, 0, 0, 0 }, + { MKTAG('C', 'S', 'P', 'Y'), 241620, 0, 0, 0 }, + { MKTAG('M', 'I', 'N', 'S'), 241621, 0, 0, 0 }, + { MKTAG('M', 'C', 'P', 'Y'), 241622, 0, 0, 0 }, + { MKTAG('D', 'N', 'C', 'E'), 241623, 0, 0, 0 }, + { MKTAG('N', 'A', 'U', 'T'), 241624, 0, 0, 0 }, + { MKTAG('A', 'D', 'V', 'T'), 240939, 241622, 0, 0 }, + { MKTAG('A', 'N', 'S', 'W'), 240453, 0, 0, 0 }, + { MKTAG('A', 'R', 'T', 'Y'), 240658, 0, 0, 0 }, + + { MKTAG('B', 'A', 'R', 'T'), 240491, 0, 0, 0 }, + { MKTAG('B', 'A', 'R', '3'), 240610, 0, 0, 0 }, + { MKTAG('B', 'A', 'R', 'K'), 240768, 0, 0, 0 }, + { MKTAG('B', 'A', 'R', 'U'), 240768, 0, 0, 0 }, + { MKTAG('B', 'E', 'L', '1'), 240940, 0, 0, 0 }, + { MKTAG('B', 'E', 'L', '2'), 240591, 0, 0, 0 }, + { MKTAG('B', 'E', 'L', '3'), 240775, 0, 0, 0 }, + { MKTAG('B', 'E', 'L', '4'), 240558, 0, 0, 0 }, + { MKTAG('B', 'E', 'L', '5'), 240336, 0, 0, 0 }, + { MKTAG('B', 'E', 'L', '6'), 240759, 240760, 0, 0 }, + + { MKTAG('B', 'E', 'L', '7'), 240726, 0, 0, 0 }, + { MKTAG('B', 'L', 'F', '1'), 241652, 0, 0, 0 }, + { MKTAG('B', 'L', 'F', '2'), 240939, 0, 0, 0 }, + { MKTAG('B', 'L', 'P', '1'), 240654, 0, 0, 0 }, + { MKTAG('B', 'L', 'P', '2'), 240654, 0, 0, 0 }, + { MKTAG('B', 'L', 'P', '3'), 240654, 0, 0, 0 }, + { MKTAG('B', 'L', 'P', '4'), 240655, 0, 0, 0 }, + { MKTAG('B', 'L', 'R', '1'), 240654, 0, 0, 0 }, + { MKTAG('B', 'L', 'R', '2'), 240655, 0, 0, 0 }, + { MKTAG('B', 'L', 'T', '1'), 240718, 0, 0, 0 }, + + { MKTAG('B', 'L', 'T', '2'), 240681, 0, 0, 0 }, + { MKTAG('B', 'L', 'T', '3'), 240655, 0, 0, 0 }, + { MKTAG('B', 'L', 'T', '4'), 240664, 0, 0, 0 }, + { MKTAG('B', 'T', 'T', '5'), 240681, 0, 0, 0 }, + { MKTAG('B', 'O', 'D', 'Y'), 240596, 0, 0, 0 }, + { MKTAG('B', 'O', 'Y', 'S'), 240654, 0, 0, 0 }, + { MKTAG('B', 'R', 'N', 'D'), 240939, 241622, 0, 0 }, + { MKTAG('C', 'L', 'U', 'B'), 241675, 240681, 241623, 0 }, + { MKTAG('C', 'M', 'N', 'T'), 240849, 0, 0, 0 }, + { MKTAG('C', 'R', 'I', 'M'), 241096, 240725, 240729, 0 }, + + { MKTAG('D', 'C', 'T', 'R'), 240725, 0, 0, 0 }, + { MKTAG('D', 'O', 'R', '2'), 241405, 241404, 241403, 241402 }, + { MKTAG('D', 'B', 'U', 'G'), 240922, 240931, 0, 0 }, + { MKTAG('F', 'A', 'M', 'E'), 240726, 0, 0, 0 }, + { MKTAG('F', 'A', 'S', 'H'), 241172, 0, 0, 0 }, + { MKTAG('F', 'A', 'U', 'N'), 240939, 0, 0, 0 }, + { MKTAG('F', 'L', 'O', 'R'), 240825, 0, 0, 0 }, + { MKTAG('F', 'U', 'L', 'N'), 240864, 241072, 0, 0 }, + { MKTAG('G', 'I', 'R', 'L'), 241144, 0, 0, 0 }, + { MKTAG('H', 'B', 'B', 'Y'), 241144, 0, 0, 0 }, + + { MKTAG('H', 'H', 'L', 'D'), 241144, 0, 0, 0 }, + { MKTAG('H', 'O', 'M', 'E'), 240844, 240626, 0, 0 }, + { MKTAG('I', 'S', 'H', 'E'), 240731, 0, 0, 0 }, + { MKTAG('J', 'N', 'A', 'M'), 240785, 240657, 0, 0 }, + { MKTAG('J', 'O', 'K', 'E'), 240785, 0, 0, 0 }, + { MKTAG('K', 'N', 'O', 'B'), 240657, 0, 0, 0 }, + { MKTAG('K', 'P', 'L', 'C'), 240844, 240626, 0, 0 }, + { MKTAG('L', 'I', 'F', '3'), 240722, 0, 0, 0 }, + { MKTAG('L', 'I', 'T', 'E'), 240785, 0, 0, 0 }, + { MKTAG('L', 'I', 'T', 'R'), 241404, 241405, 241403, 241406 }, + + { MKTAG('M', 'A', 'D', '1'), 241124, 240971, 241615, 0 }, + { MKTAG('M', 'A', 'D', '4'), 241341, 0, 0, 0 }, + { MKTAG('M', 'A', 'D', '6'), 240860, 241114, 0, 0 }, + { MKTAG('M', 'A', 'G', 'S'), 241404, 241405, 241403, 241407 }, + { MKTAG('M', 'L', 'T', 'Y'), 240718, 240719, 0, 0 }, + { MKTAG('N', 'I', 'K', 'E'), 241622, 0, 0, 0 }, + { MKTAG('N', 'I', 'K', 'N'), 240785, 0, 0, 0 }, + { MKTAG('N', 'P', 'L', 'C'), 240844, 240626, 0, 0 }, + { MKTAG('O', 'R', 'D', '1'), 240695, 0, 0, 0 }, + { MKTAG('O', 'R', 'D', '2'), 240744, 240650, 0, 0 }, + + { MKTAG('O', 'R', 'D', '3'), 240647, 0, 0, 0 }, + { MKTAG('O', 'R', 'D', '4'), 240647, 0, 0, 0 }, + { MKTAG('O', 'R', 'D', '5'), 241191, 0, 0, 0 }, + { MKTAG('P', 'G', 'R', 'P'), 240725, 0, 0, 0 }, + { MKTAG('P', 'L', 'A', 'C'), 240728, 0, 0, 0 }, + { MKTAG('R', 'C', 'K', 'T'), 241070, 241161, 0, 0 }, + { MKTAG('S', 'F', 'S', 'F'), 241172, 0, 0, 0 }, + { MKTAG('S', 'P', 'R', 'T'), 241172, 0, 0, 0 }, + { MKTAG('S', 'U', 'C', '1'), 240467, 0, 0, 0 }, + { MKTAG('T', 'E', 'A', 'M'), 241172, 0, 0, 0 }, + + { MKTAG('T', 'L', 'A', ' '), 240727, 240658, 0, 0 }, + { MKTAG('T', 'O', 'Y', 'S'), 240607, 240606, 0, 0 }, + { MKTAG('T', 'R', 'A', '2'), 240611, 0, 0, 0 }, + { MKTAG('T', 'R', 'A', '3'), 240611, 0, 0, 0 }, + { MKTAG('W', 'E', 'A', 'P'), 240939, 0, 0, 0 }, + { MKTAG('W', 'E', 'A', 'T'), 241093, 241094, 241095, 0 }, + { MKTAG('W', 'T', 'H', 'R'), 241093, 241094, 241095, 0 }, + { MKTAG('W', 'W', 'E', 'B'), 241172, 0, 0, 0 } +}; + +static const int BELLBOT_RESPONSES[130][5] = { + { MKTAG('A', 'C', 'T', 'R'), 200505, 0, 0, 0 }, + { MKTAG('A', 'C', 'T', 'S'), 200505, 0, 0, 0 }, + { MKTAG('F', 'A', 'M', 'E'), 200532, 200585, 0, 0 }, + { MKTAG('A', 'D', 'V', 'T'), 200506, 0, 0, 0 }, + { MKTAG('L', 'I', 'Q', 'D'), 200507, 200527, 0, 0 }, + { MKTAG('F', 'A', 'U', 'N'), 200511, 0, 0, 0 }, + { MKTAG('H', 'B', 'B', 'Y'), 200514, 0, 0, 0 }, + { MKTAG('N', 'I', 'K', 'E'), 200514, 0, 0, 0 }, + { MKTAG('B', 'R', 'N', 'D'), 200514, 0, 0, 0 }, + { MKTAG('P', 'G', 'R', 'P'), 200514, 0, 0, 0 }, + { MKTAG('R', 'C', 'K', 'T'), 200514, 0, 0, 0 }, + { MKTAG('D', 'R', 'U', 'G'), 200528, 0, 0, 0 }, + { MKTAG('F', 'A', 'S', 'H'), 200533, 0, 0, 0 }, + { MKTAG('T', 'O', 'Y', 'S'), 200533, 0, 0, 0 }, + { MKTAG('F', 'O', 'O', 'D'), 202270, 0, 0, 0 }, + { MKTAG('J', 'F', 'O', 'D'), 202270, 0, 0, 0 }, + { MKTAG('A', 'R', 'T', 'I'), 200538, 0, 0, 0 }, + { MKTAG('A', 'R', 'T', 'Y'), 200538, 0, 0, 0 }, + { MKTAG('L', 'I', 'T', 'R'), 200538, 0, 0, 0 }, + { MKTAG('C', 'R', 'I', 'M'), 200538, 0, 0, 0 }, + { MKTAG('C', 'S', 'P', 'Y'), 200538, 0, 0, 0 }, + { MKTAG('W', 'E', 'A', 'T'), 200538, 0, 0, 0 }, + { MKTAG('M', 'U', 'S', 'I'), 200539, 0, 0, 0 }, + { MKTAG('S', 'O', 'N', 'G'), 200539, 0, 0, 0 }, + { MKTAG('F', 'I', 'L', 'M'), 200534, 0, 0, 0 }, + { MKTAG('B', 'L', 'F', '1'), 200535, 0, 0, 0 }, + { MKTAG('B', 'L', 'F', '2'), 200536, 0, 0, 0 }, + { MKTAG('M', 'A', 'G', 'S'), 200542, 0, 0, 0 }, + { MKTAG('P', 'H', 'I', 'L'), 200557, 0, 0, 0 }, + { MKTAG('P', 'L', 'A', 'N'), 200562, 0, 0, 0 }, + { MKTAG('E', 'A', 'R', 'T'), 200562, 202252, 0, 0 }, + { MKTAG('P', 'L', 'A', 'C'), 200562, 202252, 0, 0 }, + { MKTAG('F', 'L', 'O', 'R'), 200570, 0, 0, 0 }, + { MKTAG('P', 'T', 'I', 'C'), 200571, 0, 0, 0 }, + { MKTAG('B', 'L', 'P', '1'), 200577, 0, 0, 0 }, + { MKTAG('B', 'L', 'P', '2'), 200575, 0, 0, 0 }, + { MKTAG('B', 'L', 'P', '3'), 200576, 0, 0, 0 }, + { MKTAG('B', 'L', 'P', '4'), 200578, 0, 0, 0 }, + { MKTAG('K', 'N', 'O', 'B'), 200579, 0, 0, 0 }, + { MKTAG('B', 'L', 'R', '1'), 200580, 0, 0, 0 }, + { MKTAG('B', 'L', 'R', '2'), 200581, 0, 0, 0 }, + { MKTAG('S', 'E', 'X', '1'), 200582, 0, 0, 0 }, + { MKTAG('S', 'P', 'R', 'T'), 200584, 0, 0, 0 }, + { MKTAG('T', 'E', 'A', 'M'), 200584, 0, 0, 0 }, + { MKTAG('H', 'E', 'R', 'O'), 200585, 0, 0, 0 }, + { MKTAG('T', 'W', 'A', 'T'), 200588, 0, 0, 0 }, + { MKTAG('S', 'W', 'E', 'R'), 200590, 200336, 0, 0 }, + { MKTAG('T', 'R', 'A', '2'), 200594, 0, 0, 0 }, + { MKTAG('T', 'R', 'A', '3'), 200594, 0, 0, 0 }, + { MKTAG('T', 'V', 'S', 'H'), 200595, 0, 0, 0 }, + { MKTAG('S', 'O', 'A', 'P'), 200595, 0, 0, 0 }, + { MKTAG('C', 'O', 'M', 'D'), 200595, 0, 0, 0 }, + { MKTAG('C', 'O', 'O', 'K'), 200595, 0, 0, 0 }, + { MKTAG('C', 'O', 'P', 'S'), 200595, 0, 0, 0 }, + { MKTAG('D', 'C', 'T', 'R'), 200595, 0, 0, 0 }, + { MKTAG('S', 'F', 'S', 'F'), 200595, 0, 0, 0 }, + { MKTAG('H', 'O', 'S', 'T'), 200595, 0, 0, 0 }, + { MKTAG('B', 'L', 'T', '1'), 200596, 0, 0, 0 }, + { MKTAG('B', 'L', 'T', '2'), 200597, 0, 0, 0 }, + { MKTAG('B', 'L', 'T', '3'), 200598, 0, 0, 0 }, + { MKTAG('B', 'L', 'T', '4'), 200599, 0, 0, 0 }, + { MKTAG('B', 'L', 'T', '5'), 200600, 0, 0, 0 }, + { MKTAG('W', 'E', 'A', 'P'), 200601, 0, 0, 0 }, + { MKTAG('A', 'U', 'T', 'H'), 200605, 0, 0, 0 }, + { MKTAG('H', 'H', 'L', 'D'), 200536, 0, 0, 0 }, + { MKTAG('W', 'W', 'E', 'B'), 200608, 0, 0, 0 }, + { MKTAG('M', 'L', 'T', 'Y'), 200608, 0, 0, 0 }, + { MKTAG('P', 'K', 'U', 'P'), 200067, 0, 0, 0 }, + { MKTAG('S', 'U', 'C', '1'), 200067, 0, 0, 0 }, + { MKTAG('B', 'E', 'L', '1'), 200684, 0, 0, 0 }, + { MKTAG('B', 'E', 'L', '2'), 200887, 0, 0, 0 }, + { MKTAG('B', 'E', 'L', '3'), 200610, 0, 0, 0 }, + { MKTAG('B', 'E', 'L', '4'), 200015, 0, 0, 0 }, + { MKTAG('B', 'E', 'L', '5'), 200043, 0, 0, 0 }, + { MKTAG('B', 'E', 'L', '6'), 200333, 0, 0, 0 }, + { MKTAG('B', 'E', 'L', '7'), 200884, 0, 0, 0 }, + { MKTAG('H', 'H', 'G', 'Q'), 200516, 0, 0, 0 }, + { MKTAG('C', 'H', 'A', 'N'), 200961, 0, 0, 0 }, + { MKTAG('B', 'Y', 'Z', 'A'), 201271, 0, 0, 0 }, + { MKTAG('F', 'I', 'S', 'H'), 201242, 0, 0, 0 }, + { MKTAG('S', 'A', 'S', 'S'), 201256, 0, 0, 0 }, + { MKTAG('S', 'I', 'C', 'K'), 201704, 0, 0, 0 }, + { MKTAG('N', 'H', 'R', 'O'), 201704, 0, 0, 0 }, + { MKTAG('S', 'C', 'I', 'E'), 201675, 0, 0, 0 }, + { MKTAG('S', 'C', 'I', 'T'), 201676, 0, 0, 0 }, + { MKTAG('T', 'D', 'V', 'P'), 200490, 0, 0, 0 }, + { MKTAG('H', 'A', 'H', 'A'), 200950, 0, 0, 0 }, + { MKTAG('S', 'U', 'C', '1'), 200582, 0, 0, 0 }, + { MKTAG('T', 'L', 'A', ' '), 201243, 0, 0, 0 }, + { MKTAG('J', 'O', 'K', 'E'), 201244, 0, 0, 0 }, + { MKTAG('C', 'H', 'S', 'E'), 202270, 0, 0, 0 }, + { MKTAG('C', 'L', 'U', 'B'), 201654, 0, 0, 0 }, + { MKTAG('S', 'L', 'O', 'W'), 201877, 0, 0, 0 }, + { MKTAG('T', 'H', 'R', 'T'), 201238, 201269, 201982, 200336 }, + { MKTAG('A', 'N', 'S', 'W'), 200139, 0, 0, 0 }, + { MKTAG('B', 'A', 'R', '1'), 202051, 200473, 200229, 0 }, + { MKTAG('B', 'A', 'R', 'K'), 200510, 201326, 0, 0 }, + { MKTAG('B', 'A', 'R', 'U'), 200510, 201326, 0, 0 }, + { MKTAG('B', 'O', 'D', 'Y'), 201704, 0, 0, 0 }, + { MKTAG('C', 'M', 'N', 'T'), 202270, 0, 0, 0 }, + { MKTAG('D', 'E', 'S', '2'), 201529, 0, 0, 0 }, + { MKTAG('D', 'N', 'C', 'E'), 200952, 200953, 200960, 0 }, + { MKTAG('D', 'O', 'R', '2'), 200372, 0, 0, 0 }, + { MKTAG('F', 'U', 'L', 'N'), 202035, 202044, 0, 0 }, + { MKTAG('H', 'O', 'M', 'E'), 202252, 0, 0, 0 }, + { MKTAG('I', 'S', 'H', 'E'), 201609, 0, 0, 0 }, + { MKTAG('J', 'N', 'A', 'M'), 202035, 0, 0, 0 }, + { MKTAG('L', 'I', 'F', '1'), 201704, 0, 0, 0 }, + { MKTAG('L', 'I', 'F', '2'), 201704, 0, 0, 0 }, + { MKTAG('L', 'I', 'F', '3'), 201704, 0, 0, 0 }, + { MKTAG('M', 'A', 'D', '1'), 201238, 0, 0, 0 }, + { MKTAG('M', 'A', 'D', '4'), 200292, 0, 0, 0 }, + { MKTAG('M', 'A', 'D', '5'), 200140, 0, 0, 0 }, + { MKTAG('M', 'A', 'D', '6'), 200968, 0, 0, 0 }, + { MKTAG('M', 'C', 'P', 'Y'), 200514, 0, 0, 0 }, + { MKTAG('M', 'I', 'N', 'S'), 200541, 0, 0, 0 }, + { MKTAG('N', 'A', 'U', 'T'), 200529, 0, 0, 0 }, + { MKTAG('N', 'O', 'N', 'O'), 200127, 0, 0, 0 }, + { MKTAG('N', 'P', 'L', 'C'), 200234, 201625, 0, 0 }, + { MKTAG('O', 'R', 'D', '1'), 200473, 0, 0, 0 }, + { MKTAG('O', 'R', 'D', '2'), 200473, 0, 0, 0 }, + { MKTAG('O', 'R', 'D', '3'), 200473, 0, 0, 0 }, + { MKTAG('O', 'R', 'D', '4'), 200473, 0, 0, 0 }, + { MKTAG('O', 'R', 'D', '5'), 200473, 0, 0, 0 }, + { MKTAG('S', 'U', 'C', '2'), 200024, 0, 0, 0 }, + { MKTAG('S', 'U', 'M', 'S'), 200139, 0, 0, 0 }, + { MKTAG('T', 'I', 'T', 'A'), 200606, 0, 0, 0 }, + { MKTAG('W', 'T', 'H', 'R'), 201094, 201097, 201092, 0 }, + { MKTAG('Y', 'E', 'S', 'S'), 201525, 201529, 0, 0 }, +}; + +void writeScriptTags(const char *name, const int *tags, uint count) { + outputFile.seek(dataOffset); + + for (int idx = 0; idx < count * 5; ++idx, ++tags) + outputFile.writeLong(*tags); + + writeEntryHeader(name, dataOffset, count * 5 * 4); + dataOffset += count * 5 * 4; +} + +void writeAllScriptTags() { + writeScriptTags("Responses/Deskbot", &DESKBOT_RESPONSES[0][0], 128); + writeScriptTags("Responses/Bellbot", &BELLBOT_RESPONSES[0][0], 130); +} \ No newline at end of file diff --git a/devtools/create_titanic/script_responses.h b/devtools/create_titanic/script_responses.h new file mode 100644 index 0000000000..86cd1e6aed --- /dev/null +++ b/devtools/create_titanic/script_responses.h @@ -0,0 +1,32 @@ +/* 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. + * + */ + +#ifndef COMMON_SCRIPT_TAGS_H +#define COMMON_SCRIPT_TAGS_H + +#include "common/scummsys.h" + +extern void writeAllScriptTags(); +extern void writeEntryHeader(const char *name, uint offset, uint size); +extern uint dataOffset; + +#endif diff --git a/devtools/create_titanic/script_tags.cpp b/devtools/create_titanic/script_tags.cpp deleted file mode 100644 index e5df5e6b87..0000000000 --- a/devtools/create_titanic/script_tags.cpp +++ /dev/null @@ -1,190 +0,0 @@ -/* 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. - * - */ - - // Disable symbol overrides so that we can use system headers. -#define FORBIDDEN_SYMBOL_ALLOW_ALL - -// HACK to allow building with the SDL backend on MinGW -// see bug #1800764 "TOOLS: MinGW tools building broken" -#ifdef main -#undef main -#endif // main - -#include "file.h" -#include "script_tags.h" - -static const int DESKBOT_TAGS[128][5] = { - { MKTAG('P', 'K', 'U', 'P'), 240573, 0, 0, 0 }, - { MKTAG('S', 'E', 'X', '1'), 240573, 0, 0, 0 }, - { MKTAG('R', 'E', 'S', '1'), 240354, 0, 0, 0 }, - { MKTAG('R', 'E', 'S', '2'), 240547, 0, 0, 0 }, - { MKTAG('S', 'W', 'E', 'R'), 240578, 0, 0, 0 }, - { MKTAG('B', 'Y', 'Z', 'A'), 241173, 0, 0, 0 }, - { MKTAG('S', 'A', 'S', 'S'), 240986, 0, 0, 0 }, - { MKTAG('S', 'H', 'M', 'S'), 240453, 0, 0, 0 }, - { MKTAG('F', 'O', 'O', 'D'), 240849, 0, 0, 0 }, - { MKTAG('J', 'F', 'O', 'D'), 240849, 0, 0, 0 }, - - { MKTAG('C', 'H', 'S', 'E'), 240849, 0, 0, 0 }, - { MKTAG('A', 'C', 'T', 'R'), 240654, 0, 0, 0 }, - { MKTAG('A', 'C', 'T', 'S'), 240655, 0, 0, 0 }, - { MKTAG('M', 'U', 'S', 'I'), 240681, 240849, 0, 0 }, - { MKTAG('S', 'A', 'N', 'G'), 240681, 240657, 0, 0 }, - { MKTAG('S', 'O', 'A', 'P'), 240681, 0, 0, 0 }, - { MKTAG('T', 'V', 'S', 'H'), 240681, 0, 0, 0 }, - { MKTAG('A', 'R', 'T', 'I'), 240657, 0, 0, 0 }, - { MKTAG('A', 'U', 'T', 'H'), 240657, 0, 0, 0 }, - { MKTAG('C', 'O', 'M', 'D'), 240657, 240785, 0, 0 }, - - { MKTAG('C', 'O', 'O', 'K'), 240657, 0, 0, 0 }, - { MKTAG('C', 'O', 'P', 'S'), 240657, 0, 0, 0 }, - { MKTAG('H', 'E', 'R', 'O'), 240657, 0, 0, 0 }, - { MKTAG('H', 'O', 'S', 'T'), 240657, 0, 0, 0 }, - { MKTAG('P', 'T', 'I', 'C'), 240657, 0, 0, 0 }, - { MKTAG('S', 'C', 'I', 'T'), 240657, 0, 0, 0 }, - { MKTAG('E', 'A', 'R', 'T'), 240728, 0, 0, 0 }, - { MKTAG('P', 'L', 'A', 'N'), 240728, 0, 0, 0 }, - { MKTAG('F', 'I', 'L', 'M'), 240939, 0, 0, 0 }, - { MKTAG('F', 'I', 'S', 'H'), 240437, 0, 0, 0 }, - - { MKTAG('H', 'H', 'G', 'Q'), 241065, 240453, 0, 0 }, - { MKTAG('L', 'I', 'Q', 'D'), 241167, 0, 0, 0 }, - { MKTAG('P', 'H', 'I', 'L'), 240607, 0, 0, 0 }, - { MKTAG('S', 'I', 'C', 'K'), 241170, 0, 0, 0 }, - { MKTAG('T', 'W', 'A', 'T'), 240975, 0, 0, 0 }, - { MKTAG('H', 'A', 'H', 'A'), 240785, 0, 0, 0 }, - { MKTAG('S', 'C', 'I', 'T'), 240968, 241617, 0, 0 }, - { MKTAG('S', 'C', 'I', 'E'), 240967, 241616, 0, 0 }, - { MKTAG('S', 'L', 'O', 'W'), 241614, 0, 0, 0 }, - { MKTAG('T', 'H', 'A', 'T'), 240760, 241615, 0, 0 }, - - { MKTAG('T', 'D', 'U', 'P'), 241161, 241618, 0, 0 }, - { MKTAG('T', 'I', 'T', 'A'), 241619, 0, 0, 0 }, - { MKTAG('C', 'S', 'P', 'Y'), 241620, 0, 0, 0 }, - { MKTAG('M', 'I', 'N', 'S'), 241621, 0, 0, 0 }, - { MKTAG('M', 'C', 'P', 'Y'), 241622, 0, 0, 0 }, - { MKTAG('D', 'N', 'C', 'E'), 241623, 0, 0, 0 }, - { MKTAG('N', 'A', 'U', 'T'), 241624, 0, 0, 0 }, - { MKTAG('A', 'D', 'V', 'T'), 240939, 241622, 0, 0 }, - { MKTAG('A', 'N', 'S', 'W'), 240453, 0, 0, 0 }, - { MKTAG('A', 'R', 'T', 'Y'), 240658, 0, 0, 0 }, - - { MKTAG('B', 'A', 'R', 'T'), 240491, 0, 0, 0 }, - { MKTAG('B', 'A', 'R', '3'), 240610, 0, 0, 0 }, - { MKTAG('B', 'A', 'R', 'K'), 240768, 0, 0, 0 }, - { MKTAG('B', 'A', 'R', 'U'), 240768, 0, 0, 0 }, - { MKTAG('B', 'E', 'L', '1'), 240940, 0, 0, 0 }, - { MKTAG('B', 'E', 'L', '2'), 240591, 0, 0, 0 }, - { MKTAG('B', 'E', 'L', '3'), 240775, 0, 0, 0 }, - { MKTAG('B', 'E', 'L', '4'), 240558, 0, 0, 0 }, - { MKTAG('B', 'E', 'L', '5'), 240336, 0, 0, 0 }, - { MKTAG('B', 'E', 'L', '6'), 240759, 240760, 0, 0 }, - - { MKTAG('B', 'E', 'L', '7'), 240726, 0, 0, 0 }, - { MKTAG('B', 'L', 'F', '1'), 241652, 0, 0, 0 }, - { MKTAG('B', 'L', 'F', '2'), 240939, 0, 0, 0 }, - { MKTAG('B', 'L', 'P', '1'), 240654, 0, 0, 0 }, - { MKTAG('B', 'L', 'P', '2'), 240654, 0, 0, 0 }, - { MKTAG('B', 'L', 'P', '3'), 240654, 0, 0, 0 }, - { MKTAG('B', 'L', 'P', '4'), 240655, 0, 0, 0 }, - { MKTAG('B', 'L', 'R', '1'), 240654, 0, 0, 0 }, - { MKTAG('B', 'L', 'R', '2'), 240655, 0, 0, 0 }, - { MKTAG('B', 'L', 'T', '1'), 240718, 0, 0, 0 }, - - { MKTAG('B', 'L', 'T', '2'), 240681, 0, 0, 0 }, - { MKTAG('B', 'L', 'T', '3'), 240655, 0, 0, 0 }, - { MKTAG('B', 'L', 'T', '4'), 240664, 0, 0, 0 }, - { MKTAG('B', 'T', 'T', '5'), 240681, 0, 0, 0 }, - { MKTAG('B', 'O', 'D', 'Y'), 240596, 0, 0, 0 }, - { MKTAG('B', 'O', 'Y', 'S'), 240654, 0, 0, 0 }, - { MKTAG('B', 'R', 'N', 'D'), 240939, 241622, 0, 0 }, - { MKTAG('C', 'L', 'U', 'B'), 241675, 240681, 241623, 0 }, - { MKTAG('C', 'M', 'N', 'T'), 240849, 0, 0, 0 }, - { MKTAG('C', 'R', 'I', 'M'), 241096, 240725, 240729, 0 }, - - { MKTAG('D', 'C', 'T', 'R'), 240725, 0, 0, 0 }, - { MKTAG('D', 'O', 'R', '2'), 241405, 241404, 241403, 241402 }, - { MKTAG('D', 'B', 'U', 'G'), 240922, 240931, 0, 0 }, - { MKTAG('F', 'A', 'M', 'E'), 240726, 0, 0, 0 }, - { MKTAG('F', 'A', 'S', 'H'), 241172, 0, 0, 0 }, - { MKTAG('F', 'A', 'U', 'N'), 240939, 0, 0, 0 }, - { MKTAG('F', 'L', 'O', 'R'), 240825, 0, 0, 0 }, - { MKTAG('F', 'U', 'L', 'N'), 240864, 241072, 0, 0 }, - { MKTAG('G', 'I', 'R', 'L'), 241144, 0, 0, 0 }, - { MKTAG('H', 'B', 'B', 'Y'), 241144, 0, 0, 0 }, - - { MKTAG('H', 'H', 'L', 'D'), 241144, 0, 0, 0 }, - { MKTAG('H', 'O', 'M', 'E'), 240844, 240626, 0, 0 }, - { MKTAG('I', 'S', 'H', 'E'), 240731, 0, 0, 0 }, - { MKTAG('J', 'N', 'A', 'M'), 240785, 240657, 0, 0 }, - { MKTAG('J', 'O', 'K', 'E'), 240785, 0, 0, 0 }, - { MKTAG('K', 'N', 'O', 'B'), 240657, 0, 0, 0 }, - { MKTAG('K', 'P', 'L', 'C'), 240844, 240626, 0, 0 }, - { MKTAG('L', 'I', 'F', '3'), 240722, 0, 0, 0 }, - { MKTAG('L', 'I', 'T', 'E'), 240785, 0, 0, 0 }, - { MKTAG('L', 'I', 'T', 'R'), 241404, 241405, 241403, 241406 }, - - { MKTAG('M', 'A', 'D', '1'), 241124, 240971, 241615, 0 }, - { MKTAG('M', 'A', 'D', '4'), 241341, 0, 0, 0 }, - { MKTAG('M', 'A', 'D', '6'), 240860, 241114, 0, 0 }, - { MKTAG('M', 'A', 'G', 'S'), 241404, 241405, 241403, 241407 }, - { MKTAG('M', 'L', 'T', 'Y'), 240718, 240719, 0, 0 }, - { MKTAG('N', 'I', 'K', 'E'), 241622, 0, 0, 0 }, - { MKTAG('N', 'I', 'K', 'N'), 240785, 0, 0, 0 }, - { MKTAG('N', 'P', 'L', 'C'), 240844, 240626, 0, 0 }, - { MKTAG('O', 'R', 'D', '1'), 240695, 0, 0, 0 }, - { MKTAG('O', 'R', 'D', '2'), 240744, 240650, 0, 0 }, - - { MKTAG('O', 'R', 'D', '3'), 240647, 0, 0, 0 }, - { MKTAG('O', 'R', 'D', '4'), 240647, 0, 0, 0 }, - { MKTAG('O', 'R', 'D', '5'), 241191, 0, 0, 0 }, - { MKTAG('P', 'G', 'R', 'P'), 240725, 0, 0, 0 }, - { MKTAG('P', 'L', 'A', 'C'), 240728, 0, 0, 0 }, - { MKTAG('R', 'C', 'K', 'T'), 241070, 241161, 0, 0 }, - { MKTAG('S', 'F', 'S', 'F'), 241172, 0, 0, 0 }, - { MKTAG('S', 'P', 'R', 'T'), 241172, 0, 0, 0 }, - { MKTAG('S', 'U', 'C', '1'), 240467, 0, 0, 0 }, - { MKTAG('T', 'E', 'A', 'M'), 241172, 0, 0, 0 }, - - { MKTAG('T', 'L', 'A', ' '), 240727, 240658, 0, 0 }, - { MKTAG('T', 'O', 'Y', 'S'), 240607, 240606, 0, 0 }, - { MKTAG('T', 'R', 'A', '2'), 240611, 0, 0, 0 }, - { MKTAG('T', 'R', 'A', '3'), 240611, 0, 0, 0 }, - { MKTAG('W', 'E', 'A', 'P'), 240939, 0, 0, 0 }, - { MKTAG('W', 'E', 'A', 'T'), 241093, 241094, 241095, 0 }, - { MKTAG('W', 'T', 'H', 'R'), 241093, 241094, 241095, 0 }, - { MKTAG('W', 'W', 'E', 'B'), 241172, 0, 0, 0 } -}; - -void writeScriptTags(const char *name, const int *tags, uint count) { - outputFile.seek(dataOffset); - - for (int idx = 0; idx < count * 5; ++idx, ++tags) - outputFile.writeLong(*tags); - - writeEntryHeader(name, dataOffset, count * 5 * 4); - dataOffset += count * 5 * 4; -} - -void writeAllScriptTags() { - writeScriptTags("Tags/103", &DESKBOT_TAGS[0][0], 128); -} \ No newline at end of file diff --git a/devtools/create_titanic/script_tags.h b/devtools/create_titanic/script_tags.h deleted file mode 100644 index 86cd1e6aed..0000000000 --- a/devtools/create_titanic/script_tags.h +++ /dev/null @@ -1,32 +0,0 @@ -/* 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. - * - */ - -#ifndef COMMON_SCRIPT_TAGS_H -#define COMMON_SCRIPT_TAGS_H - -#include "common/scummsys.h" - -extern void writeAllScriptTags(); -extern void writeEntryHeader(const char *name, uint offset, uint size); -extern uint dataOffset; - -#endif -- cgit v1.2.3 From f51a428f8b32323a4328d69dff7c5afd48630224 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 31 May 2016 21:01:13 -0400 Subject: DEVTOOLS: Fixes to Deskbot responses in create_titanic --- devtools/create_titanic/create_titanic_dat.cpp | 6 ++-- devtools/create_titanic/script_responses.cpp | 48 ++++++++++---------------- devtools/create_titanic/script_responses.h | 2 +- 3 files changed, 21 insertions(+), 35 deletions(-) diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index 133bad577d..11b963c37f 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -353,7 +353,7 @@ void writeData() { writeStringArray("TEXT/PRONOUNS", 0x22F718, 15); writeNumbers(); - writeAllScriptTags(); + writeAllScriptResponses(); } // Support method used for translating IDA debugger's output for @@ -365,7 +365,7 @@ void createScriptResponses() { char c[2]; c[0] = c[1] = '\0'; - inFile.open("d:\\temp\\bellbot.txt"); + inFile.open("d:\\temp\\deskbot.txt"); printf("static const int xxxx_RESPONSES[][5] = {\n"); do { @@ -396,8 +396,6 @@ void createScriptResponses() { } int main(int argc, char *argv[]) { - createScriptResponses(); - if (argc != 3) { printf("Format: %s ST.exe titanic.dat\n", argv[0]); exit(0); diff --git a/devtools/create_titanic/script_responses.cpp b/devtools/create_titanic/script_responses.cpp index aa342396db..1c43eb0e20 100644 --- a/devtools/create_titanic/script_responses.cpp +++ b/devtools/create_titanic/script_responses.cpp @@ -35,26 +35,24 @@ static const int DESKBOT_RESPONSES[128][5] = { { MKTAG('P', 'K', 'U', 'P'), 240573, 0, 0, 0 }, { MKTAG('S', 'E', 'X', '1'), 240573, 0, 0, 0 }, - { MKTAG('R', 'E', 'S', '1'), 240354, 0, 0, 0 }, - { MKTAG('R', 'E', 'S', '2'), 240547, 0, 0, 0 }, + { MKTAG('D', 'E', 'S', '1'), 240354, 0, 0, 0 }, + { MKTAG('D', 'E', 'S', '2'), 240547, 0, 0, 0 }, { MKTAG('S', 'W', 'E', 'R'), 240578, 0, 0, 0 }, { MKTAG('B', 'Y', 'Z', 'A'), 241173, 0, 0, 0 }, { MKTAG('S', 'A', 'S', 'S'), 240986, 0, 0, 0 }, - { MKTAG('S', 'H', 'M', 'S'), 240453, 0, 0, 0 }, + { MKTAG('S', 'U', 'M', 'S'), 240453, 0, 0, 0 }, { MKTAG('F', 'O', 'O', 'D'), 240849, 0, 0, 0 }, { MKTAG('J', 'F', 'O', 'D'), 240849, 0, 0, 0 }, - { MKTAG('C', 'H', 'S', 'E'), 240849, 0, 0, 0 }, { MKTAG('A', 'C', 'T', 'R'), 240654, 0, 0, 0 }, { MKTAG('A', 'C', 'T', 'S'), 240655, 0, 0, 0 }, - { MKTAG('M', 'U', 'S', 'I'), 240681, 240849, 0, 0 }, - { MKTAG('S', 'A', 'N', 'G'), 240681, 240657, 0, 0 }, + { MKTAG('M', 'U', 'S', 'I'), 240681, 241621, 0, 0 }, + { MKTAG('S', 'O', 'N', 'G'), 240681, 241621, 0, 0 }, { MKTAG('S', 'O', 'A', 'P'), 240681, 0, 0, 0 }, { MKTAG('T', 'V', 'S', 'H'), 240681, 0, 0, 0 }, { MKTAG('A', 'R', 'T', 'I'), 240657, 0, 0, 0 }, { MKTAG('A', 'U', 'T', 'H'), 240657, 0, 0, 0 }, { MKTAG('C', 'O', 'M', 'D'), 240657, 240785, 0, 0 }, - { MKTAG('C', 'O', 'O', 'K'), 240657, 0, 0, 0 }, { MKTAG('C', 'O', 'P', 'S'), 240657, 0, 0, 0 }, { MKTAG('H', 'E', 'R', 'O'), 240657, 0, 0, 0 }, @@ -65,7 +63,6 @@ static const int DESKBOT_RESPONSES[128][5] = { { MKTAG('P', 'L', 'A', 'N'), 240728, 0, 0, 0 }, { MKTAG('F', 'I', 'L', 'M'), 240939, 0, 0, 0 }, { MKTAG('F', 'I', 'S', 'H'), 240437, 0, 0, 0 }, - { MKTAG('H', 'H', 'G', 'Q'), 241065, 240453, 0, 0 }, { MKTAG('L', 'I', 'Q', 'D'), 241167, 0, 0, 0 }, { MKTAG('P', 'H', 'I', 'L'), 240607, 0, 0, 0 }, @@ -75,9 +72,8 @@ static const int DESKBOT_RESPONSES[128][5] = { { MKTAG('S', 'C', 'I', 'T'), 240968, 241617, 0, 0 }, { MKTAG('S', 'C', 'I', 'E'), 240967, 241616, 0, 0 }, { MKTAG('S', 'L', 'O', 'W'), 241614, 0, 0, 0 }, - { MKTAG('T', 'H', 'A', 'T'), 240760, 241615, 0, 0 }, - - { MKTAG('T', 'D', 'U', 'P'), 241161, 241618, 0, 0 }, + { MKTAG('T', 'H', 'R', 'T'), 240760, 241615, 0, 0 }, + { MKTAG('T', 'D', 'V', 'P'), 241161, 241618, 0, 0 }, { MKTAG('T', 'I', 'T', 'A'), 241619, 0, 0, 0 }, { MKTAG('C', 'S', 'P', 'Y'), 241620, 0, 0, 0 }, { MKTAG('M', 'I', 'N', 'S'), 241621, 0, 0, 0 }, @@ -87,8 +83,7 @@ static const int DESKBOT_RESPONSES[128][5] = { { MKTAG('A', 'D', 'V', 'T'), 240939, 241622, 0, 0 }, { MKTAG('A', 'N', 'S', 'W'), 240453, 0, 0, 0 }, { MKTAG('A', 'R', 'T', 'Y'), 240658, 0, 0, 0 }, - - { MKTAG('B', 'A', 'R', 'T'), 240491, 0, 0, 0 }, + { MKTAG('B', 'A', 'R', '1'), 240491, 0, 0, 0 }, { MKTAG('B', 'A', 'R', '3'), 240610, 0, 0, 0 }, { MKTAG('B', 'A', 'R', 'K'), 240768, 0, 0, 0 }, { MKTAG('B', 'A', 'R', 'U'), 240768, 0, 0, 0 }, @@ -98,7 +93,6 @@ static const int DESKBOT_RESPONSES[128][5] = { { MKTAG('B', 'E', 'L', '4'), 240558, 0, 0, 0 }, { MKTAG('B', 'E', 'L', '5'), 240336, 0, 0, 0 }, { MKTAG('B', 'E', 'L', '6'), 240759, 240760, 0, 0 }, - { MKTAG('B', 'E', 'L', '7'), 240726, 0, 0, 0 }, { MKTAG('B', 'L', 'F', '1'), 241652, 0, 0, 0 }, { MKTAG('B', 'L', 'F', '2'), 240939, 0, 0, 0 }, @@ -109,40 +103,36 @@ static const int DESKBOT_RESPONSES[128][5] = { { MKTAG('B', 'L', 'R', '1'), 240654, 0, 0, 0 }, { MKTAG('B', 'L', 'R', '2'), 240655, 0, 0, 0 }, { MKTAG('B', 'L', 'T', '1'), 240718, 0, 0, 0 }, - { MKTAG('B', 'L', 'T', '2'), 240681, 0, 0, 0 }, { MKTAG('B', 'L', 'T', '3'), 240655, 0, 0, 0 }, { MKTAG('B', 'L', 'T', '4'), 240664, 0, 0, 0 }, - { MKTAG('B', 'T', 'T', '5'), 240681, 0, 0, 0 }, + { MKTAG('B', 'L', 'T', '5'), 240681, 0, 0, 0 }, { MKTAG('B', 'O', 'D', 'Y'), 240596, 0, 0, 0 }, { MKTAG('B', 'O', 'Y', 'S'), 240654, 0, 0, 0 }, { MKTAG('B', 'R', 'N', 'D'), 240939, 241622, 0, 0 }, { MKTAG('C', 'L', 'U', 'B'), 241675, 240681, 241623, 0 }, { MKTAG('C', 'M', 'N', 'T'), 240849, 0, 0, 0 }, { MKTAG('C', 'R', 'I', 'M'), 241096, 240725, 240729, 0 }, - - { MKTAG('D', 'C', 'T', 'R'), 240725, 0, 0, 0 }, + { MKTAG('D', 'C', 'T', 'R'), 240681, 0, 0, 0 }, { MKTAG('D', 'O', 'R', '2'), 241405, 241404, 241403, 241402 }, - { MKTAG('D', 'B', 'U', 'G'), 240922, 240931, 0, 0 }, + { MKTAG('D', 'R', 'U', 'G'), 240922, 240931, 0, 0 }, { MKTAG('F', 'A', 'M', 'E'), 240726, 0, 0, 0 }, { MKTAG('F', 'A', 'S', 'H'), 241172, 0, 0, 0 }, { MKTAG('F', 'A', 'U', 'N'), 240939, 0, 0, 0 }, { MKTAG('F', 'L', 'O', 'R'), 240825, 0, 0, 0 }, { MKTAG('F', 'U', 'L', 'N'), 240864, 241072, 0, 0 }, - { MKTAG('G', 'I', 'R', 'L'), 241144, 0, 0, 0 }, + { MKTAG('G', 'I', 'R', 'L'), 240655, 0, 0, 0 }, { MKTAG('H', 'B', 'B', 'Y'), 241144, 0, 0, 0 }, - { MKTAG('H', 'H', 'L', 'D'), 241144, 0, 0, 0 }, { MKTAG('H', 'O', 'M', 'E'), 240844, 240626, 0, 0 }, { MKTAG('I', 'S', 'H', 'E'), 240731, 0, 0, 0 }, - { MKTAG('J', 'N', 'A', 'M'), 240785, 240657, 0, 0 }, + { MKTAG('J', 'N', 'A', 'M'), 240785, 0, 0, 0 }, { MKTAG('J', 'O', 'K', 'E'), 240785, 0, 0, 0 }, { MKTAG('K', 'N', 'O', 'B'), 240657, 0, 0, 0 }, { MKTAG('K', 'P', 'L', 'C'), 240844, 240626, 0, 0 }, { MKTAG('L', 'I', 'F', '3'), 240722, 0, 0, 0 }, { MKTAG('L', 'I', 'T', 'E'), 240785, 0, 0, 0 }, { MKTAG('L', 'I', 'T', 'R'), 241404, 241405, 241403, 241406 }, - { MKTAG('M', 'A', 'D', '1'), 241124, 240971, 241615, 0 }, { MKTAG('M', 'A', 'D', '4'), 241341, 0, 0, 0 }, { MKTAG('M', 'A', 'D', '6'), 240860, 241114, 0, 0 }, @@ -153,18 +143,16 @@ static const int DESKBOT_RESPONSES[128][5] = { { MKTAG('N', 'P', 'L', 'C'), 240844, 240626, 0, 0 }, { MKTAG('O', 'R', 'D', '1'), 240695, 0, 0, 0 }, { MKTAG('O', 'R', 'D', '2'), 240744, 240650, 0, 0 }, - { MKTAG('O', 'R', 'D', '3'), 240647, 0, 0, 0 }, { MKTAG('O', 'R', 'D', '4'), 240647, 0, 0, 0 }, { MKTAG('O', 'R', 'D', '5'), 241191, 0, 0, 0 }, - { MKTAG('P', 'G', 'R', 'P'), 240725, 0, 0, 0 }, + { MKTAG('P', 'G', 'R', 'P'), 240681, 0, 0, 0 }, { MKTAG('P', 'L', 'A', 'C'), 240728, 0, 0, 0 }, { MKTAG('R', 'C', 'K', 'T'), 241070, 241161, 0, 0 }, { MKTAG('S', 'F', 'S', 'F'), 241172, 0, 0, 0 }, { MKTAG('S', 'P', 'R', 'T'), 241172, 0, 0, 0 }, { MKTAG('S', 'U', 'C', '1'), 240467, 0, 0, 0 }, { MKTAG('T', 'E', 'A', 'M'), 241172, 0, 0, 0 }, - { MKTAG('T', 'L', 'A', ' '), 240727, 240658, 0, 0 }, { MKTAG('T', 'O', 'Y', 'S'), 240607, 240606, 0, 0 }, { MKTAG('T', 'R', 'A', '2'), 240611, 0, 0, 0 }, @@ -307,7 +295,7 @@ static const int BELLBOT_RESPONSES[130][5] = { { MKTAG('Y', 'E', 'S', 'S'), 201525, 201529, 0, 0 }, }; -void writeScriptTags(const char *name, const int *tags, uint count) { +void writeScriptResponses(const char *name, const int *tags, uint count) { outputFile.seek(dataOffset); for (int idx = 0; idx < count * 5; ++idx, ++tags) @@ -317,7 +305,7 @@ void writeScriptTags(const char *name, const int *tags, uint count) { dataOffset += count * 5 * 4; } -void writeAllScriptTags() { - writeScriptTags("Responses/Deskbot", &DESKBOT_RESPONSES[0][0], 128); - writeScriptTags("Responses/Bellbot", &BELLBOT_RESPONSES[0][0], 130); +void writeAllScriptResponses() { + writeScriptResponses("Responses/Deskbot", &DESKBOT_RESPONSES[0][0], 128); + writeScriptResponses("Responses/Bellbot", &BELLBOT_RESPONSES[0][0], 130); } \ No newline at end of file diff --git a/devtools/create_titanic/script_responses.h b/devtools/create_titanic/script_responses.h index 86cd1e6aed..ca927e0ccd 100644 --- a/devtools/create_titanic/script_responses.h +++ b/devtools/create_titanic/script_responses.h @@ -25,7 +25,7 @@ #include "common/scummsys.h" -extern void writeAllScriptTags(); +extern void writeAllScriptResponses(); extern void writeEntryHeader(const char *name, uint offset, uint size); extern uint dataOffset; -- cgit v1.2.3 From ba5e13d479f3c8615e8c0984c58e86421499f1b3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 31 May 2016 21:47:12 -0400 Subject: TITANIC: Set up loading of deskbot & bellbot script response lists --- devtools/create_titanic/create_titanic_dat.cpp | 2 +- devtools/create_titanic/script_responses.cpp | 330 ++++++++++++++++++++++++- engines/titanic/true_talk/barbot_script.cpp | 4 +- engines/titanic/true_talk/barbot_script.h | 6 +- engines/titanic/true_talk/bellbot_script.cpp | 5 +- engines/titanic/true_talk/bellbot_script.h | 1 - engines/titanic/true_talk/deskbot_script.cpp | 17 +- engines/titanic/true_talk/deskbot_script.h | 3 - engines/titanic/true_talk/doorbot_script.cpp | 4 +- engines/titanic/true_talk/doorbot_script.h | 6 +- engines/titanic/true_talk/liftbot_script.cpp | 4 +- engines/titanic/true_talk/liftbot_script.h | 6 +- engines/titanic/true_talk/maitred_script.cpp | 4 +- engines/titanic/true_talk/maitred_script.h | 6 +- engines/titanic/true_talk/parrot_script.cpp | 4 +- engines/titanic/true_talk/parrot_script.h | 6 +- engines/titanic/true_talk/script_handler.cpp | 2 +- engines/titanic/true_talk/succubus_script.cpp | 4 +- engines/titanic/true_talk/succubus_script.h | 6 +- engines/titanic/true_talk/tt_npc_script.cpp | 33 ++- engines/titanic/true_talk/tt_npc_script.h | 27 +- 21 files changed, 426 insertions(+), 54 deletions(-) diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index 11b963c37f..4999ee3f7d 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -50,7 +50,7 @@ */ #define VERSION_NUMBER 1 -#define HEADER_SIZE 0x300 +#define HEADER_SIZE 0x340 Common::File inputFile, outputFile; Common::PEResources res; diff --git a/devtools/create_titanic/script_responses.cpp b/devtools/create_titanic/script_responses.cpp index 1c43eb0e20..30d0c7f1bd 100644 --- a/devtools/create_titanic/script_responses.cpp +++ b/devtools/create_titanic/script_responses.cpp @@ -295,17 +295,335 @@ static const int BELLBOT_RESPONSES[130][5] = { { MKTAG('Y', 'E', 'S', 'S'), 201525, 201529, 0, 0 }, }; -void writeScriptResponses(const char *name, const int *tags, uint count) { +const int BARBOT_RESPONSES[93][2] = { + { MKTAG('S', 'L', 'O', 'W'), 0x3D09E }, + { MKTAG('T', 'H', 'R', 'T'), 0x3D0B1 }, + { MKTAG('A', 'C', 'T', 'R'), 0x3D77F }, + { MKTAG('A', 'C', 'T', 'S'), 0x3D780 }, + { MKTAG('A', 'D', 'V', 'T'), 0x3D781 }, + { MKTAG('A', 'R', 'T', 'I'), 0x3D782 }, + { MKTAG('A', 'R', 'T', 'Y'), 0x3D783 }, + { MKTAG('A', 'U', 'T', 'H'), 0x3D784 }, + { MKTAG('B', 'A', 'R', 'K'), 0x3D786 }, + { MKTAG('B', 'A', 'R', 'U'), 0x3D786 }, + { MKTAG('B', 'O', 'Y', 'S'), 0x3D239 }, + { MKTAG('G', 'I', 'R', 'L'), 0x3D23A }, + { MKTAG('B', 'R', 'N', 'D'), 0x3D787 }, + { MKTAG('C', 'H', 'S', 'E'), 0x3D788 }, + { MKTAG('C', 'O', 'M', 'D'), 0x3D789 }, + { MKTAG('C', 'O', 'O', 'K'), 0x3D78A }, + { MKTAG('C', 'O', 'P', 'S'), 0x3D78B }, + { MKTAG('C', 'R', 'I', 'M'), 0x3D78C }, + { MKTAG('C', 'S', 'P', 'Y'), 0x3D78D }, + { MKTAG('D', 'C', 'T', 'R'), 0x3D78E }, + { MKTAG('D', 'N', 'C', 'E'), 0x3D78F }, + { MKTAG('D', 'R', 'U', 'G'), 0x3D790 }, + { MKTAG('E', 'A', 'R', 'T'), 0x3D791 }, + { MKTAG('E', 'M', 'O', 'T'), 0x3D792 }, + { MKTAG('F', 'A', 'M', 'E'), 0x3D793 }, + { MKTAG('A', 'S', 'H', '1'), 0x3D794 }, + { MKTAG('A', 'S', 'H', '2'), 0x3D795 }, + { MKTAG('F', 'A', 'U', 'N'), 0x3D796 }, + { MKTAG('F', 'I', 'L', 'M'), 0x3D797 }, + { MKTAG('F', 'I', 'S', 'H'), 0x3D798 }, + { MKTAG('F', 'L', 'O', 'R'), 0x3D799 }, + { MKTAG('F', 'O', 'O', 'D'), 0x3D79A }, + { MKTAG('J', 'F', 'O', 'D'), 0x3D79A }, + { MKTAG('H', 'B', 'B', 'Y'), 0x3D79B }, + { MKTAG('H', 'E', 'R', 'O'), 0x3D79C }, + { MKTAG('H', 'H', 'L', 'D'), 0x3D79D }, + { MKTAG('H', 'O', 'M', 'E'), 0x3D79E }, + { MKTAG('H', 'O', 'S', 'T'), 0x3D79F }, + { MKTAG('K', 'N', 'O', 'B'), 0x3D7A0 }, + { MKTAG('L', 'I', 'Q', 'D'), 0x3D7A1 }, + { MKTAG('L', 'I', 'T', 'R'), 0x3D7A2 }, + { MKTAG('M', 'A', 'G', 'S'), 0x3D7A3 }, + { MKTAG('M', 'C', 'P', 'Y'), 0x3D7A4 }, + { MKTAG('M', 'I', 'N', 'S'), 0x3D7A5 }, + { MKTAG('M', 'L', 'T', 'Y'), 0x3D7A6 }, + { MKTAG('M', 'U', 'S', 'I'), 0x3D7A7 }, + { MKTAG('N', 'A', 'U', 'T'), 0x3D7A8 }, + { MKTAG('P', 'G', 'R', 'P'), 0x3D7A9 }, + { MKTAG('P', 'H', 'I', 'L'), 0x3D7AA }, + { MKTAG('P', 'K', 'U', 'P'), 0x3D7AB }, + { MKTAG('P', 'L', 'A', 'N'), 0x3D7AC }, + { MKTAG('B', 'L', 'P', '1'), 0x3D7AD }, + { MKTAG('B', 'L', 'P', '2'), 0x3D7AD }, + { MKTAG('P', 'T', 'I', 'C'), 0x3D7AD }, + { MKTAG('R', 'C', 'K', 'T'), 0x3D7AE }, + { MKTAG('S', 'C', 'I', 'E'), 0x3D7AF }, + { MKTAG('S', 'C', 'I', 'T'), 0x3D7B0 }, + { MKTAG('S', 'E', 'X', '1'), 0x3D7B1 }, + { MKTAG('S', 'F', 'S', 'F'), 0x3D7B2 }, + { MKTAG('S', 'O', 'A', 'P'), 0x3D7B4 }, + { MKTAG('S', 'O', 'N', 'G'), 0x3D7B5 }, + { MKTAG('S', 'P', 'R', 'T'), 0x3D7B6 }, + { MKTAG('S', 'W', 'E', 'R'), 0x3D7B7 }, + { MKTAG('T', 'D', 'V', 'P'), 0x3D7BC }, + { MKTAG('T', 'E', 'A', 'M'), 0x3D7BD }, + { MKTAG('T', 'I', 'T', 'A'), 0x3D7BF }, + { MKTAG('T', 'L', 'A', ' '), 0x3D7C0 }, + { MKTAG('T', 'O', 'Y', 'S'), 0x3D7C1 }, + { MKTAG('T', 'R', 'A', '2'), 0x3D7C2 }, + { MKTAG('T', 'R', 'A', '3'), 0x3D7C3 }, + { MKTAG('T', 'V', 'S', 'H'), 0x3D7C4 }, + { MKTAG('W', 'E', 'A', 'P'), 0x3D7C5 }, + { MKTAG('W', 'E', 'A', 'T'), 0x3D7C6 }, + { MKTAG('W', 'W', 'E', 'B'), 0x3D7C7 }, + { MKTAG('I', 'S', 'H', 'E'), 0x3D221 }, + { MKTAG('L', 'I', 'T', 'E'), 0x3D31B }, + { MKTAG('B', 'Y', 'Z', 'A'), 0x3D448 }, + { MKTAG('W', 'T', 'H', 'R'), 0x3D6E5 }, + { MKTAG('N', 'P', 'L', 'C'), 0x3D231 }, + { MKTAG('B', 'A', 'R', '1'), 0x3D095 }, + { MKTAG('B', 'A', 'R', '2'), 0x3D107 }, + { MKTAG('B', 'A', 'R', '3'), 0x3D09D }, + { MKTAG('M', 'P', 'O', 'P'), 0x3D0D3 }, + { MKTAG('J', 'O', 'K', 'E'), 0x3D5A9 }, + { MKTAG('J', 'N', 'A', 'M'), 0x3D5A9 }, + { MKTAG('N', 'I', 'B', '1'), 0x3D128 }, + { MKTAG('N', 'I', 'B', '2'), 0x3D0DC }, + { MKTAG('N', 'I', 'B', '3'), 0x3D345 }, + { MKTAG('N', 'I', 'B', '4'), 0x3D125 }, + { MKTAG('N', 'I', 'B', '5'), 0x3D369 }, + { MKTAG('N', 'I', 'B', '6'), 0x3D444 }, + { MKTAG('B', 'A', 'R', '4'), 0x3D0DF }, + { MKTAG('F', 'U', 'L', 'N'), 0x3D32C } +}; + +const int DOORBOT_RESPONSES[101][2] = { + { MKTAG('W', 'E', 'A', 'T'), 0x2E29 }, + { MKTAG('T', 'W', 'A', 'T'), 0x2E29 }, + { MKTAG('B', 'A', 'R', 'M'), 0x2E29 }, + { MKTAG('B', 'A', 'R', 'U'), 0x2E29 }, + { MKTAG('B', 'A', 'R', 'K'), 0x2E29 }, + { MKTAG('B', 'Y', 'Z', 'A'), 0x274E }, + { MKTAG('S', 'I', 'C', 'K'), 0x28AC }, + { MKTAG('B', 'O', 'D', 'Y'), 0x28AC }, + { MKTAG('N', 'H', 'R', 'O'), 0x28A8 }, + { MKTAG('N', 'P', 'L', 'C'), 0x28A7 }, + { MKTAG('H', 'O', 'M', 'E'), 0x28A7 }, + { MKTAG('S', 'C', 'I', 'E'), 0x28A9 }, + { MKTAG('P', 'T', 'I', 'C'), 0x2E42 }, + { MKTAG('P', 'G', 'R', 'P'), 0x2E42 }, + { MKTAG('B', 'L', 'P', '1'), 0x2E42 }, + { MKTAG('B', 'L', 'P', '2'), 0x2E42 }, + { MKTAG('B', 'L', 'P', '3'), 0x2E42 }, + { MKTAG('B', 'L', 'P', '4'), 0x2E42 }, + { MKTAG('B', 'L', 'F', '1'), 0x2E3C }, + { MKTAG('B', 'L', 'F', '2'), 0x2E3C }, + { MKTAG('B', 'L', 'R', '1'), 0x2E42 }, + { MKTAG('B', 'L', 'T', '1'), 0x2E56 }, + { MKTAG('B', 'L', 'T', '2'), 0x2E48 }, + { MKTAG('B', 'L', 'T', '3'), 0x2E55 }, + { MKTAG('B', 'L', 'T', '4'), 0x2E56 }, + { MKTAG('B', 'L', 'T', '5'), 0x2E56 }, + { MKTAG('S', 'W', 'E', 'R'), 0x2E4E }, + { MKTAG('S', 'O', 'N', 'G'), 0x2E49 }, + { MKTAG('L', 'I', 'T', 'R'), 0x2E40 }, + { MKTAG('A', 'R', 'T', 'I'), 0x2E1F }, + { MKTAG('N', 'I', 'K', 'E'), 0x2E22 }, + { MKTAG('E', 'M', 'O', 'T'), 0x2E38 }, + { MKTAG('D', 'R', 'U', 'G'), 0x2E36 }, + { MKTAG('E', 'A', 'R', 'T'), 0x2E37 }, + { MKTAG('F', 'A', 'M', 'E'), 0x2E39 }, + { MKTAG('F', 'A', 'U', 'N'), 0x2E3B }, + { MKTAG('F', 'I', 'S', 'H'), 0x2E3B }, + { MKTAG('F', 'L', 'O', 'R'), 0x2E3D }, + { MKTAG('F', 'O', 'O', 'D'), 0x2E3E }, + { MKTAG('J', 'F', 'O', 'D'), 0x2E3E }, + { MKTAG('H', 'B', 'B', 'Y'), 0x2E3F }, + { MKTAG('H', 'E', 'R', 'O'), 0x2E4D }, + { MKTAG('H', 'O', 'S', 'T'), 0x2E55 }, + { MKTAG('L', 'I', 'Q', 'D'), 0x2E35 }, + { MKTAG('M', 'A', 'G', 'S'), 0x2E40 }, + { MKTAG('P', 'H', 'I', 'L'), 0x2E44 }, + { MKTAG('P', 'K', 'U', 'P'), 0x2E24 }, + { MKTAG('P', 'L', 'A', 'N'), 0x2E45 }, + { MKTAG('R', 'C', 'K', 'T'), 0x2E4A }, + { MKTAG('S', 'E', 'X', '1'), 0x2E47 }, + { MKTAG('S', 'U', 'C', '1'), 0x2E47 }, + { MKTAG('S', 'O', 'A', 'P'), 0x2E48 }, + { MKTAG('T', 'O', 'Y', 'S'), 0x2E50 }, + { MKTAG('H', 'H', 'L', 'D'), 0x2E50 }, + { MKTAG('A', 'C', 'T', 'R'), 0x2E1B }, + { MKTAG('A', 'C', 'T', 'S'), 0x2E1C }, + { MKTAG('A', 'D', 'V', 'T'), 0x2E1D }, + { MKTAG('B', 'R', 'N', 'D'), 0x2E21 }, + { MKTAG('B', 'R', 'N', '2'), 0x2E22 }, + { MKTAG('B', 'R', 'N', '3'), 0x2E23 }, + { MKTAG('F', 'A', 'S', 'H'), 0x2E3A }, + { MKTAG('F', 'I', 'L', 'M'), 0x2E3C }, + { MKTAG('K', 'N', 'O', 'B'), 0x2E42 }, + { MKTAG('M', 'U', 'S', 'I'), 0x2E43 }, + { MKTAG('S', 'F', 'S', 'F'), 0x2E46 }, + { MKTAG('S', 'P', 'R', 'T'), 0x2E4B }, + { MKTAG('T', 'E', 'A', 'M'), 0x2E4C }, + { MKTAG('T', 'R', 'A', 'V'), 0x2E52 }, + { MKTAG('T', 'V', 'S', 'H'), 0x2E56 }, + { MKTAG('W', 'E', 'A', 'P'), 0x2E57 }, + { MKTAG('W', 'W', 'E', 'B'), 0x2E58 }, + { MKTAG('A', 'R', 'T', 'Y'), 0x2E1E }, + { MKTAG('C', 'O', 'M', 'D'), 0x2E25 }, + { MKTAG('C', 'O', 'O', 'K'), 0x2E26 }, + { MKTAG('C', 'O', 'P', 'S'), 0x2E27 }, + { MKTAG('C', 'R', 'I', 'M'), 0x2E28 }, + { MKTAG('D', 'C', 'T', 'R'), 0x2E29 }, + { MKTAG('A', 'U', 'T', 'H'), 0x2E29 }, + { MKTAG('M', 'L', 'T', 'Y'), 0x2E41 }, + { MKTAG('S', 'A', 'S', 'S'), 0x28C3 }, + { MKTAG('B', 'O', 'Y', 'S'), 0x2768 }, + { MKTAG('G', 'I', 'R', 'L'), 0x2769 }, + { MKTAG('T', 'D', 'V', 'P'), 0x277D }, + { MKTAG('I', 'S', 'H', 'E'), 0x27B6 }, + { MKTAG('J', 'O', 'K', 'E'), 0x29FF }, + { MKTAG('J', 'N', 'A', 'M'), 0x29FF }, + { MKTAG('S', 'L', 'O', 'W'), 0x2823 }, + { MKTAG('T', 'H', 'R', 'T'), 0x2823 }, + { MKTAG('D', 'O', 'R', '2'), 0x2BC0 }, + { MKTAG('M', 'P', 'O', 'P'), 0x2BC0 }, + { MKTAG('C', 'L', 'U', 'B'), 0x2E39 }, + { MKTAG('C', 'O', 'L', 'R'), 0x2776 }, + { MKTAG('D', 'N', 'C', 'E'), 0x2931 }, + { MKTAG('M', 'C', 'P', 'Y'), 0x276B }, + { MKTAG('M', 'I', 'N', 'S'), 0x2E43 }, + { MKTAG('P', 'L', 'A', 'C'), 0x2E37 }, + { MKTAG('T', 'I', 'T', 'A'), 0x2E40 }, + { MKTAG('T', 'L', 'A', ' '), 0x277D }, + { MKTAG('H', 'A', 'H', 'A'), 0x27A8 }, + { MKTAG('F', 'U', 'L', 'N'), 0x2B15 }, + { MKTAG('B', 'A', 'R', '1'), 0x2E35 } +}; + +const int LIFTBOT_RESPONSES[34][2] = { + { MKTAG('L', 'I', 'F', '1'), 0x33453 }, + { MKTAG('L', 'I', 'F', '2'), 0x3345D }, + { MKTAG('L', 'I', 'F', '3'), 0x3354E }, + { MKTAG('L', 'I', 'F', '4'), 0x3374B }, + { MKTAG('I', 'S', 'H', 'E'), 0x335F7 }, + { MKTAG('J', 'O', 'K', 'E'), 0x3374B }, + { MKTAG('J', 'N', 'A', 'M'), 0x3374B }, + { MKTAG('S', 'L', 'O', 'W'), 0x337B5 }, + { MKTAG('T', 'H', 'R', 'T'), 0x337BB }, + { MKTAG('S', 'C', 'I', 'E'), 0x337B2 }, + { MKTAG('S', 'C', 'I', 'T'), 0x337B4 }, + { MKTAG('T', 'D', 'V', 'P'), 0x337BA }, + { MKTAG('T', 'I', 'T', 'A'), 0x337C0 }, + { MKTAG('C', 'S', 'P', 'Y'), 0x337A5 }, + { MKTAG('M', 'U', 'S', 'I'), 0x337AA }, + { MKTAG('M', 'C', 'P', 'Y'), 0x337A9 }, + { MKTAG('D', 'N', 'C', 'E'), 0x337A7 }, + { MKTAG('N', 'A', 'U', 'T'), 0x337AC }, + { MKTAG('T', 'L', 'A', ' '), 0x337C1 }, + { MKTAG('S', 'U', 'M', 'S'), 0x33598 }, + { MKTAG('O', 'R', 'D', '1'), 0x33776 }, + { MKTAG('O', 'R', 'D', '2'), 0x33779 }, + { MKTAG('O', 'R', 'D', '3'), 0x3377A }, + { MKTAG('O', 'R', 'D', '4'), 0x3377B }, + { MKTAG('O', 'R', 'D', '5'), 0x3377C }, + { MKTAG('O', 'R', 'D', '6'), 0x3377D }, + { MKTAG('O', 'R', 'D', '7'), 0x3377E }, + { MKTAG('L', 'I', 'Q', 'D'), 0x337FC }, + { MKTAG('F', 'O', 'O', 'D'), 0x337FD }, + { MKTAG('J', 'F', 'O', 'D'), 0x337FD }, + { MKTAG('W', 'E', 'A', 'T'), 0x337E3 }, + { MKTAG('S', 'I', 'C', 'K'), 0x336A1 }, + { MKTAG('B', 'O', 'D', 'Y'), 0x33624 }, + { MKTAG('B', 'Y', 'Z', 'A'), 0x33617 } +}; + +const int MAITRED_RESPONSES[74][2] = { + { MKTAG('M', 'A', 'D', '1'), 0x3F7E2 }, + { MKTAG('M', 'A', 'D', '2'), 0x3F916 }, + { MKTAG('M', 'A', 'D', '3'), 0x3F931 }, + { MKTAG('M', 'A', 'D', '4'), 0x3F936 }, + { MKTAG('M', 'A', 'D', '5'), 0x3F938 }, + { MKTAG('M', 'A', 'D', '6'), 0x3F943 }, + { MKTAG('M', 'A', 'D', '7'), 0x3F947 }, + { MKTAG('M', 'A', 'D', '8'), 0x3F945 }, + { MKTAG('M', 'A', 'D', '9'), 0x3F946 }, + { MKTAG('M', 'D', '1', '0'), 0x3F9F5 }, + { MKTAG('M', 'D', '1', '1'), 0x3F982 }, + { MKTAG('J', 'F', 'O', 'D'), 0x3F930 }, + { MKTAG('C', 'M', 'N', 'T'), 0x3F937 }, + { MKTAG('H', 'A', 'H', 'A'), 0x3FA47 }, + { MKTAG('S', 'U', 'M', 'S'), 0x3F9FE }, + { MKTAG('A', 'N', 'S', 'W'), 0x3F90B }, + { MKTAG('M', 'U', 'S', 'I'), 0x3FA35 }, + { MKTAG('S', 'O', 'N', 'G'), 0x3FA35 }, + { MKTAG('A', 'C', 'T', 'R'), 0x3F9B6 }, + { MKTAG('A', 'C', 'T', 'S'), 0x3F9B7 }, + { MKTAG('A', 'R', 'T', 'I'), 0x3F9CE }, + { MKTAG('A', 'R', 'T', 'Y'), 0x3F9CE }, + { MKTAG('A', 'U', 'T', 'H'), 0x3FAB6 }, + { MKTAG('C', 'O', 'M', 'D'), 0x3F963 }, + { MKTAG('C', 'O', 'P', 'S'), 0x3F9F8 }, + { MKTAG('C', 'R', 'I', 'M'), 0x3F9F8 }, + { MKTAG('C', 'S', 'P', 'Y'), 0x3F965 }, + { MKTAG('D', 'C', 'T', 'R'), 0x3F9B6 }, + { MKTAG('D', 'R', 'U', 'G'), 0x3F96F }, + { MKTAG('E', 'A', 'R', 'T'), 0x3F9E3 }, + { MKTAG('E', 'M', 'O', 'T'), 0x3FA29 }, + { MKTAG('F', 'A', 'M', 'E'), 0x3FAB6 }, + { MKTAG('F', 'A', 'S', 'H'), 0x3F8EA }, + { MKTAG('F', 'A', 'U', 'N'), 0x3F969 }, + { MKTAG('F', 'I', 'L', 'M'), 0x3F9CE }, + { MKTAG('F', 'L', 'O', 'R'), 0x3F9A3 }, + { MKTAG('H', 'B', 'B', 'Y'), 0x3F987 }, + { MKTAG('H', 'E', 'R', 'O'), 0x3F8DA }, + { MKTAG('H', 'H', 'G', 'Q'), 0x3F96B }, + { MKTAG('H', 'H', 'L', 'D'), 0x3FA2B }, + { MKTAG('H', 'O', 'S', 'T'), 0x3F9E1 }, + { MKTAG('K', 'N', 'O', 'B'), 0x3F9E1 }, + { MKTAG('L', 'I', 'Q', 'D'), 0x3F91C }, + { MKTAG('L', 'I', 'T', 'R'), 0x3F9CE }, + { MKTAG('M', 'A', 'G', 'S'), 0x3F912 }, + { MKTAG('M', 'L', 'T', 'Y'), 0x3F9F7 }, + { MKTAG('P', 'G', 'R', 'P'), 0x3F8D0 }, + { MKTAG('P', 'H', 'I', 'L'), 0x3F8E9 }, + { MKTAG('P', 'K', 'U', 'P'), 0x3F9FB }, + { MKTAG('P', 'L', 'A', 'C'), 0x3FA22 }, + { MKTAG('P', 'T', 'I', 'C'), 0x3F8D0 }, + { MKTAG('R', 'C', 'K', 'T'), 0x3F9A3 }, + { MKTAG('S', 'C', 'I', 'E'), 0x3F968 }, + { MKTAG('S', 'C', 'I', 'T'), 0x3F9E2 }, + { MKTAG('S', 'E', 'X', '1'), 0x3F9C9 }, + { MKTAG('S', 'F', 'S', 'F'), 0x3F988 }, + { MKTAG('S', 'O', 'A', 'P'), 0x3FA3C }, + { MKTAG('S', 'P', 'R', 'T'), 0x3FAB6 }, + { MKTAG('S', 'W', 'E', 'R'), 0x3F96B }, + { MKTAG('T', 'E', 'A', 'M'), 0x3F9B8 }, + { MKTAG('T', 'O', 'Y', 'S'), 0x3F96D }, + { MKTAG('T', 'V', 'S', 'H'), 0x3F9CE }, + { MKTAG('W', 'E', 'A', 'P'), 0x3F9D8 }, + { MKTAG('W', 'W', 'E', 'B'), 0x3F987 }, + { MKTAG('B', 'Y', 'Z', 'A'), 0x3F9A5 }, + { MKTAG('T', 'W', 'A', 'T'), 0x3F96F }, + { MKTAG('M', 'C', 'P', 'Y'), 0x3F9B9 }, + { MKTAG('T', 'H', 'R', 'T'), 0x3FB15 }, + { MKTAG('T', 'D', 'V', 'P'), 0x3FB17 }, + { MKTAG('T', 'I', 'T', 'A'), 0x3FB18 }, + { MKTAG('M', 'I', 'N', 'S'), 0x3FB19 }, + { MKTAG('D', 'N', 'C', 'E'), 0x3FB1A }, + { MKTAG('N', 'A', 'U', 'T'), 0x3FB1B }, + { MKTAG('T', 'L', 'A', ' '), 0x3FB1C } +}; + +void writeScriptResponses(const char *name, const int *tags, uint count, int valuesPerTag) { outputFile.seek(dataOffset); - for (int idx = 0; idx < count * 5; ++idx, ++tags) + for (int idx = 0; idx < count * (valuesPerTag + 1); ++idx, ++tags) outputFile.writeLong(*tags); - writeEntryHeader(name, dataOffset, count * 5 * 4); - dataOffset += count * 5 * 4; + writeEntryHeader(name, dataOffset, count * (valuesPerTag + 1) * 4); + dataOffset += count * (valuesPerTag + 1) * 4; } void writeAllScriptResponses() { - writeScriptResponses("Responses/Deskbot", &DESKBOT_RESPONSES[0][0], 128); - writeScriptResponses("Responses/Bellbot", &BELLBOT_RESPONSES[0][0], 130); + writeScriptResponses("Responses/Barbot", &BARBOT_RESPONSES[0][0], 93, 1); + writeScriptResponses("Responses/Bellbot", &BELLBOT_RESPONSES[0][0], 130, 4); + writeScriptResponses("Responses/Deskbot", &DESKBOT_RESPONSES[0][0], 128, 4); + writeScriptResponses("Responses/Doorbot", &DOORBOT_RESPONSES[0][0], 101, 1); + writeScriptResponses("Responses/Liftbot", &LIFTBOT_RESPONSES[0][0], 34, 1); + writeScriptResponses("Responses/MaitreD", &MAITRED_RESPONSES[0][0], 74, 1); } \ No newline at end of file diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index 2bb3a1876f..2c82949990 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -25,9 +25,9 @@ namespace Titanic { -int BarbotScript::proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag) { +int BarbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { warning("TODO"); - return 2; + return SS_2; } void BarbotScript::proc7(int v1, int v2) { diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index a55c12bc71..45681874df 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -33,7 +33,11 @@ public: const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} - virtual int proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag); + /** + * Chooses and adds a conversation response based on a specified tag Id. + */ + virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag); + virtual void proc7(int v1, int v2); virtual int proc10() const; virtual int proc15() const; diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 794e67130f..0e11aeaddf 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -38,11 +38,8 @@ BellbotScript::BellbotScript(int val1, const char *charClass, int v2, randomizeFlags(); _array[0] = 100; _array[1] = 0; -} -int BellbotScript::proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag) { - warning("TODO"); - return 2; + load("Responses/Bellbot"); } void BellbotScript::proc7(int v1, int v2) { diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index d7fbab3a8f..86e9165d01 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -38,7 +38,6 @@ public: BellbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); - virtual int proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag); virtual void proc7(int v1, int v2); virtual int proc10() const; virtual int proc15() const; diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index dbe2664e99..319175f40a 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -39,23 +39,8 @@ DeskbotScript::DeskbotScript(int val1, const char *charClass, int v2, _array[0] = 100; if (_field74 == 1) _field74 = 0; -} - -int DeskbotScript::proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag) { - for (uint idx = 0; idx < _tags.size(); ++idx) { - const TTnpcScriptTag &scriptTag = _tags[idx]; - uint currTag = (idx == 0) ? MKTAG('P', 'K', 'U', 'P') : scriptTag._tag; - - if (currTag == tag) { - int valIndex = getRandomNumber(scriptTag.size()) - 1; - uint diagId = getDialogueId(scriptTag._values[valIndex]); - addResponse(diagId); - applyResponse(); - break; - } - } - return SS_1; + load("Responses/Deskbot"); } void DeskbotScript::proc7(int v1, int v2) { diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index f2de881777..3dda552571 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -29,13 +29,10 @@ namespace Titanic { class DeskbotScript : public TTnpcScript { -private: - Common::Array _tags; public: DeskbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); - virtual int proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag); virtual void proc7(int v1, int v2); virtual int proc10() const; virtual int proc15() const; diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 9d35f697f9..d1638eeff3 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -25,9 +25,9 @@ namespace Titanic { -int DoorbotScript::proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag) { +int DoorbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { warning("TODO"); - return 2; + return SS_2; } void DoorbotScript::proc7(int v1, int v2) { diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 82897b7bfc..3158ef07d2 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -35,7 +35,11 @@ public: const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} - virtual int proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag); + /** + * Chooses and adds a conversation response based on a specified tag Id. + */ + virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag); + virtual void proc7(int v1, int v2); virtual int proc10() const; virtual int proc15() const; diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index b1577b3979..b627df658f 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -25,9 +25,9 @@ namespace Titanic { -int LiftbotScript::proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag) { +int LiftbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { warning("TODO"); - return 2; + return SS_2; } void LiftbotScript::proc7(int v1, int v2) { diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index 8c2ae3210c..9e7d72f012 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -33,7 +33,11 @@ public: const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} - virtual int proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag); + /** + * Chooses and adds a conversation response based on a specified tag Id. + */ + virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag); + virtual void proc7(int v1, int v2); virtual int proc9() const; virtual int proc10() const; diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index 5581c6b605..717dbca779 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -39,9 +39,9 @@ MaitreDScript::MaitreDScript(int val1, const char *charClass, int v2, CTrueTalkManager::setFlags(16, 0); } -int MaitreDScript::proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag) { +int MaitreDScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { warning("TODO"); - return 2; + return SS_2; } void MaitreDScript::proc7(int v1, int v2) { diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index 14505ca616..d638dee52b 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -32,7 +32,11 @@ public: MaitreDScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); - virtual int proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag); + /** + * Chooses and adds a conversation response based on a specified tag Id. + */ + virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag); + virtual void proc7(int v1, int v2); virtual int proc10() const; virtual bool proc16() const; diff --git a/engines/titanic/true_talk/parrot_script.cpp b/engines/titanic/true_talk/parrot_script.cpp index a6b37bfc57..6e90bbc0b1 100644 --- a/engines/titanic/true_talk/parrot_script.cpp +++ b/engines/titanic/true_talk/parrot_script.cpp @@ -25,9 +25,9 @@ namespace Titanic { -int ParrotScript::proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag) { +int ParrotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { warning("TODO"); - return 2; + return SS_2; } void ParrotScript::proc7(int v1, int v2) { diff --git a/engines/titanic/true_talk/parrot_script.h b/engines/titanic/true_talk/parrot_script.h index 0add5d9dfe..abf8042c37 100644 --- a/engines/titanic/true_talk/parrot_script.h +++ b/engines/titanic/true_talk/parrot_script.h @@ -33,7 +33,11 @@ public: const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} - virtual int proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag); + /** + * Chooses and adds a conversation response based on a specified tag Id. + */ + virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag); + virtual void proc7(int v1, int v2); virtual int proc10() const; virtual bool proc17() const; diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index b689aba031..f5db6eb5de 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -89,7 +89,7 @@ int CScriptHandler::processInput(TTroomScript *roomScript, TTnpcScript *npcScrip if (result) { sentence->set34(result); if (roomScript->proc6(npcScript, sentence, result)) { - canProcess = npcScript->proc6(roomScript, sentence, result); + canProcess = npcScript->chooseResponse(roomScript, sentence, result); } } diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp index 436b779432..60e3abbd65 100644 --- a/engines/titanic/true_talk/succubus_script.cpp +++ b/engines/titanic/true_talk/succubus_script.cpp @@ -25,9 +25,9 @@ namespace Titanic { -int SuccUBusScript::proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag) { +int SuccUBusScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { warning("TODO"); - return 2; + return SS_2; } void SuccUBusScript::proc7(int v1, int v2) { diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h index 8a078c2639..43249999a5 100644 --- a/engines/titanic/true_talk/succubus_script.h +++ b/engines/titanic/true_talk/succubus_script.h @@ -36,7 +36,11 @@ public: TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7), _field2D0(0) {} - virtual int proc6(TTnpcScript *npcScript, TTsentence *sentence, uint tag); + /** + * Chooses and adds a conversation response based on a specified tag Id. + */ + virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag); + virtual void proc7(int v1, int v2); virtual int proc10() const; virtual bool proc17() const; diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index bbd75a4854..59212cba55 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -27,7 +27,7 @@ namespace Titanic { -int TTnpcScriptTag::size() const { +int TTnpcScriptResponse::size() const { for (int idx = 0; idx < 4; ++idx) { if (_values[idx] == 0) return idx; @@ -63,6 +63,21 @@ TTnpcScript::TTnpcScript(int charId, const char *charClass, int v2, resetFlags(); } +void TTnpcScript::load(const char *name) { + Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); + + while (r->pos() < r->size()) { + TTnpcScriptResponse sr; + sr._tag = r->readUint32LE(); + for (int idx = 0; idx < 4; ++idx) + sr._values[idx] = r->readUint32LE(); + + _responses.push_back(sr); + } + + delete r; +} + void TTnpcScript::resetFlags() { Common::fill(&_array[20], &_array[140], 0); _field2CC = false; @@ -76,6 +91,22 @@ void TTnpcScript::proc4(int v) { warning("TODO"); } +int TTnpcScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { + for (uint idx = 0; idx < _responses.size(); ++idx) { + const TTnpcScriptResponse &response = _responses[idx]; + + if (response._tag == tag) { + int valIndex = getRandomNumber(response.size()) - 1; + uint diagId = getDialogueId(response._values[valIndex]); + addResponse(diagId); + applyResponse(); + return 2; + } + } + + return 1; +} + void TTnpcScript::proc7(int v1, int v2) { warning("TODO"); } diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index d52da2ed73..407b3648da 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -31,7 +31,7 @@ namespace Titanic { class TTroomScript; class TTsentence; -struct TTnpcScriptTag { +struct TTnpcScriptResponse { uint _tag; uint _values[4]; @@ -52,7 +52,11 @@ public: const char *charName, int v3, int val2, int v4, int v5, int v6, int v7); - virtual int proc6(TTroomScript *roomScript, TTsentence *sentence, int val) const = 0; + /** + * Chooses and adds a conversation response based on a specified tag Id. + */ + virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) = 0; + virtual void proc7(int v1, int v2) = 0; virtual int proc8() const = 0; virtual int proc9() const = 0; @@ -69,6 +73,8 @@ public: }; class TTnpcScript : public TTnpcScriptBase { +private: + Common::Array _responses; private: int translateByArray(int id); protected: @@ -85,6 +91,14 @@ protected: int _array[146]; bool _field2CC; protected: + /** + * Loads response data for the NPC from the given resource + */ + void load(const char *name); + + /** + * Reset script flags + */ void resetFlags(); void randomizeFlags(); @@ -111,7 +125,14 @@ public: int v5, int v6, int v7); virtual void proc4(int v); - virtual int proc6(TTroomScript *roomScript, TTsentence *sentence, int val) const { return 1; } + + /** + * Chooses and adds a conversation response based on a specified tag Id. + * This default implementation does a lookup into a list of known tags, + * and chooses a random dialogue Id from the available ones for that tag + */ + virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag); + virtual void proc7(int v1, int v2); virtual int proc8() const; virtual int proc9() const; -- cgit v1.2.3 From 451ab9d452e4003c6b0304d4c4609cf442fb3f81 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 1 Jun 2016 06:52:35 -0400 Subject: TITANIC: Load response data for remaining NPC scripts --- engines/titanic/true_talk/barbot_script.cpp | 6 ++++++ engines/titanic/true_talk/barbot_script.h | 3 +-- engines/titanic/true_talk/bellbot_script.cpp | 2 +- engines/titanic/true_talk/deskbot_script.cpp | 2 +- engines/titanic/true_talk/doorbot_script.cpp | 6 ++++++ engines/titanic/true_talk/doorbot_script.h | 3 +-- engines/titanic/true_talk/liftbot_script.cpp | 7 +++++++ engines/titanic/true_talk/liftbot_script.h | 3 +-- engines/titanic/true_talk/maitred_script.cpp | 6 ++++-- engines/titanic/true_talk/tt_npc_script.cpp | 4 ++-- engines/titanic/true_talk/tt_npc_script.h | 5 ++--- 11 files changed, 32 insertions(+), 15 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index 2c82949990..d47d2b5341 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -25,6 +25,12 @@ namespace Titanic { +BarbotScript::BarbotScript(int val1, const char *charClass, int v2, + const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : + TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { + load("Responses/Barbot"); +} + int BarbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { warning("TODO"); return SS_2; diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index 45681874df..9f3860448e 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -30,8 +30,7 @@ namespace Titanic { class BarbotScript : public TTnpcScript { public: BarbotScript(int val1, const char *charClass, int v2, - const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : - TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} + const char *charName, int v3, int val2, int v4, int v5, int v6, int v7); /** * Chooses and adds a conversation response based on a specified tag Id. diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 0e11aeaddf..7954b7f731 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -39,7 +39,7 @@ BellbotScript::BellbotScript(int val1, const char *charClass, int v2, _array[0] = 100; _array[1] = 0; - load("Responses/Bellbot"); + load("Responses/Bellbot", 4); } void BellbotScript::proc7(int v1, int v2) { diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 319175f40a..fe4de23436 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -40,7 +40,7 @@ DeskbotScript::DeskbotScript(int val1, const char *charClass, int v2, if (_field74 == 1) _field74 = 0; - load("Responses/Deskbot"); + load("Responses/Deskbot", 4); } void DeskbotScript::proc7(int v1, int v2) { diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index d1638eeff3..9c8c686c51 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -25,6 +25,12 @@ namespace Titanic { +DoorbotScript::DoorbotScript(int val1, const char *charClass, int v2, + const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : + TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { + load("Responses/Doorbot"); +} + int DoorbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { warning("TODO"); return SS_2; diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 3158ef07d2..d00e5b19ef 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -32,8 +32,7 @@ private: int _array[148]; public: DoorbotScript(int val1, const char *charClass, int v2, - const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : - TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} + const char *charName, int v3, int val2, int v4, int v5, int v6, int v7); /** * Chooses and adds a conversation response based on a specified tag Id. diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index b627df658f..90b8f10563 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -25,6 +25,13 @@ namespace Titanic { +LiftbotScript::LiftbotScript(int val1, const char *charClass, int v2, + const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : + TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { + load("Responses/Liftbot"); +} + + int LiftbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { warning("TODO"); return SS_2; diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index 9e7d72f012..0279392e68 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -30,8 +30,7 @@ namespace Titanic { class LiftbotScript : public TTnpcScript { public: LiftbotScript(int val1, const char *charClass, int v2, - const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : - TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} + const char *charName, int v3, int val2, int v4, int v5, int v6, int v7); /** * Chooses and adds a conversation response based on a specified tag Id. diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index 717dbca779..10c115dedd 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -27,8 +27,8 @@ namespace Titanic { MaitreDScript::MaitreDScript(int val1, const char *charClass, int v2, - const char *charName, int v3, int val2) : - TTnpcScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0) { + const char *charName, int v3, int val2) : + TTnpcScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0) { CTrueTalkManager::setFlags(9, 1); CTrueTalkManager::setFlags(10, 0); CTrueTalkManager::setFlags(11, 0); @@ -37,6 +37,8 @@ MaitreDScript::MaitreDScript(int val1, const char *charClass, int v2, CTrueTalkManager::setFlags(14, 0); CTrueTalkManager::setFlags(15, 0); CTrueTalkManager::setFlags(16, 0); + + load("Responses/MaitreD"); } int MaitreDScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 59212cba55..2c8b8ba783 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -63,13 +63,13 @@ TTnpcScript::TTnpcScript(int charId, const char *charClass, int v2, resetFlags(); } -void TTnpcScript::load(const char *name) { +void TTnpcScript::load(const char *name, int valuesPerTag) { Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); while (r->pos() < r->size()) { TTnpcScriptResponse sr; sr._tag = r->readUint32LE(); - for (int idx = 0; idx < 4; ++idx) + for (int idx = 0; idx < valuesPerTag; ++idx) sr._values[idx] = r->readUint32LE(); _responses.push_back(sr); diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 407b3648da..3822b520c8 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -73,11 +73,10 @@ public: }; class TTnpcScript : public TTnpcScriptBase { -private: - Common::Array _responses; private: int translateByArray(int id); protected: + Common::Array _responses; byte *_subPtr; int _field60; int _field64; @@ -94,7 +93,7 @@ protected: /** * Loads response data for the NPC from the given resource */ - void load(const char *name); + void load(const char *name, int valuesPerTag = 1); /** * Reset script flags -- cgit v1.2.3 From 58c8833d82cc9f7c19cd9424cacce8a71c555108 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 1 Jun 2016 07:27:13 -0400 Subject: TITANIC: Implementing npc scripts chooseResponse methods --- engines/titanic/true_talk/liftbot_script.cpp | 34 ++++++++++++++++++++++++--- engines/titanic/true_talk/liftbot_script.h | 2 ++ engines/titanic/true_talk/maitred_script.cpp | 11 +++++++-- engines/titanic/true_talk/parrot_script.cpp | 9 +++++-- engines/titanic/true_talk/succubus_script.cpp | 32 +++++++++++++++++++++++-- engines/titanic/true_talk/tt_script_base.h | 2 ++ 6 files changed, 81 insertions(+), 9 deletions(-) diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index 90b8f10563..dd6203dc62 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -25,16 +25,44 @@ namespace Titanic { +static const int STATE_ARRAY[7] = { + 0x78BE, 0x78C0, 0x78C1, 0x78C2, 0x78C3, 0x78C4, 0x78C5 +}; + LiftbotScript::LiftbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { + _state = 0; load("Responses/Liftbot"); } - int LiftbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { - warning("TODO"); - return SS_2; + switch (tag) { + case MKTAG('D', 'N', 'A', '1'): + case MKTAG('H', 'H', 'G', 'Q'): + case MKTAG('A', 'N', 'S', 'W'): + if (_state >= 7) { + proc14(30918); + set34(2); + _state = 0; + } else { + addResponse(STATE_ARRAY[_state++]); + } + + applyResponse(); + return 2; + + case MKTAG('O', 'R', 'D', '8'): + addResponse(30475); + addResponse(30467); + addResponse(30466); + addResponse(30474); + applyResponse(); + return SS_2; + + default: + return TTnpcScript::chooseResponse(roomScript, sentence, tag); + } } void LiftbotScript::proc7(int v1, int v2) { diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index 0279392e68..04454c84d0 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -28,6 +28,8 @@ namespace Titanic { class LiftbotScript : public TTnpcScript { +private: + int _state; public: LiftbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7); diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index 10c115dedd..ed9cc5b56b 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -42,8 +42,15 @@ MaitreDScript::MaitreDScript(int val1, const char *charClass, int v2, } int MaitreDScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { - warning("TODO"); - return SS_2; + if (tag == MKTAG('F', 'O', 'O', 'D') || tag == MKTAG('F', 'I', 'S', 'H') || + tag == MKTAG('C', 'H', 'S', 'E')) { + addResponse(getDialogueId(260388)); + addResponse(getDialogueId(260659)); + applyResponse(); + return 2; + } + + return TTnpcScript::chooseResponse(roomScript, sentence, tag); } void MaitreDScript::proc7(int v1, int v2) { diff --git a/engines/titanic/true_talk/parrot_script.cpp b/engines/titanic/true_talk/parrot_script.cpp index 6e90bbc0b1..3e195a00c1 100644 --- a/engines/titanic/true_talk/parrot_script.cpp +++ b/engines/titanic/true_talk/parrot_script.cpp @@ -26,8 +26,13 @@ namespace Titanic { int ParrotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { - warning("TODO"); - return SS_2; + if (tag == MKTAG('B', 'Y', 'Z', 'A')) { + addResponse(getDialogueId(280246)); + applyResponse(); + return 2; + } else { + return 1; + } } void ParrotScript::proc7(int v1, int v2) { diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp index 60e3abbd65..c09cadd9b0 100644 --- a/engines/titanic/true_talk/succubus_script.cpp +++ b/engines/titanic/true_talk/succubus_script.cpp @@ -26,8 +26,36 @@ namespace Titanic { int SuccUBusScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { - warning("TODO"); - return SS_2; + uint dialogueId = tag; + + switch (tag) { + case MKTAG('S', 'L', 'O', 'W'): + case MKTAG('T', 'H', 'R', 'T'): + dialogueId = 70021; + + case MKTAG('S', 'U', 'C', '1'): + dialogueId = getDialogueId(230009); + break; + + case MKTAG('S', 'U', 'C', '2'): + dialogueId = 70117; + break; + + case MKTAG('S', 'W', 'E', 'R'): + dialogueId = getRandomNumber(100) > 40 ? 70103 : getDialogueId(230030); + break; + + default: + break; + } + + if (dialogueId) { + addResponse(dialogueId); + applyResponse(); + return 2; + } else { + return 1; + } } void SuccUBusScript::proc7(int v1, int v2) { diff --git a/engines/titanic/true_talk/tt_script_base.h b/engines/titanic/true_talk/tt_script_base.h index 8387d24dbd..cdaf8c7fab 100644 --- a/engines/titanic/true_talk/tt_script_base.h +++ b/engines/titanic/true_talk/tt_script_base.h @@ -71,6 +71,8 @@ protected: void appendResponse2(int val1, int *val2, const TTstring &str) { appendResponse(val1, val2, str); } + + void set34(int val) { _field34 = val; } public: int _id; public: -- cgit v1.2.3 From 01020dcd8ca0ab8d930a9c2f1452e50cc2721ed5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 1 Jun 2016 20:39:31 -0400 Subject: TITANIC: Renaming script methods --- engines/titanic/true_talk/script_handler.cpp | 2 +- engines/titanic/true_talk/tt_concept.h | 2 +- engines/titanic/true_talk/tt_room_script.cpp | 4 ---- engines/titanic/true_talk/tt_room_script.h | 28 ++++++++++++++++++++++++---- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index f5db6eb5de..5e31a9de52 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -88,7 +88,7 @@ int CScriptHandler::processInput(TTroomScript *roomScript, TTnpcScript *npcScrip int canProcess = 0; if (result) { sentence->set34(result); - if (roomScript->proc6(npcScript, sentence, result)) { + if (roomScript->canRespond(npcScript, sentence, result)) { canProcess = npcScript->chooseResponse(roomScript, sentence, result); } } diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index 97cc70e41d..01f51e1ce9 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -70,7 +70,7 @@ public: TTconcept *_nextP; TTscriptBase *_scriptP; TTword *_wordP; - ScriptType _scriptType; + int _scriptType; int _field14; int _field20; int _field34; diff --git a/engines/titanic/true_talk/tt_room_script.cpp b/engines/titanic/true_talk/tt_room_script.cpp index 885021eb7f..4182498fa5 100644 --- a/engines/titanic/true_talk/tt_room_script.cpp +++ b/engines/titanic/true_talk/tt_room_script.cpp @@ -37,10 +37,6 @@ TTroomScript::TTroomScript(int scriptId) : TTroomScriptBase(scriptId, "", "", 0, -1, -1, -1, 0, 0) { } -void TTroomScript::proc7() { - warning("TODO"); -} - void TTroomScript::proc8() { warning("TODO"); } diff --git a/engines/titanic/true_talk/tt_room_script.h b/engines/titanic/true_talk/tt_room_script.h index 63aedd260c..4aa9b16da3 100644 --- a/engines/titanic/true_talk/tt_room_script.h +++ b/engines/titanic/true_talk/tt_room_script.h @@ -37,8 +37,16 @@ public: TTroomScriptBase(int scriptId, const char *charClass, const char *charName, int v3, int v4, int v5, int v6, int v2, int v7); - virtual int proc6(TTnpcScript *npcScript, TTsentence *sentence, int val) = 0; - virtual void proc7() = 0; + /** + * Returns true if a response can be made + */ + virtual bool canRespond(TTnpcScript *npcScript, TTsentence *sentence, int val) const = 0; + + /** + * Returns true if further sentence processing is allowed + */ + virtual bool canProcess(TTnpcScript *npcScript, TTsentence *sentence) const = 0; + virtual void proc8() = 0; virtual void proc9() = 0; @@ -57,8 +65,20 @@ public: public: TTroomScript(int scriptId); - virtual int proc6(TTnpcScript *npcScript, TTsentence *sentence, int val) { return 1; } - virtual void proc7(); + /** + * Returns true if a response can be made + */ + virtual bool canRespond(TTnpcScript *npcScript, TTsentence *sentence, int val) const { + return true; + } + + /** + * Returns true if further sentence processing is allowed + */ + virtual bool canProcess(TTnpcScript *npcScript, TTsentence *sentence) const { + return true; + } + virtual void proc8(); virtual void proc9(); -- cgit v1.2.3 From 4ab3b4d2097077ab16bc6c33fac7a332ee74e1a2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 1 Jun 2016 21:59:34 -0400 Subject: TITANIC: Further npc scripts chooseResponse methods --- engines/titanic/true_talk/barbot_script.cpp | 28 +++++++++++ engines/titanic/true_talk/barbot_script.h | 7 +++ engines/titanic/true_talk/doorbot_script.cpp | 71 +++++++++++++++++++++++++++- engines/titanic/true_talk/doorbot_script.h | 6 +++ 4 files changed, 110 insertions(+), 2 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index d47d2b5341..ed7e083897 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -25,13 +25,36 @@ namespace Titanic { +static const int STATE_ARRAY[7] = { + 0xCAB0, 0xCAB2, 0xCAB3, 0xCAB4, 0xCAB5, 0xCAB6, 0xCAB7 +}; + BarbotScript::BarbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { + _state = 0; load("Responses/Barbot"); } int BarbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { + if (tag == MKTAG('D', 'N', 'A', '1') || tag == MKTAG('H', 'H', 'G', 'Q') || + tag == MKTAG('A', 'N', 'S', 'W') || tag == MKTAG('S', 'U', 'M', 'S')) { + if (_state < 7) { + addResponse(STATE_ARRAY[_state++]); + } else { + proc14(51896); + set34(1); + _state = 0; + } + + applyResponse(); + return 2; + } + + if (tag == MKTAG('S', 'W', 'E', 'R')) { + + } + warning("TODO"); return SS_2; } @@ -107,4 +130,9 @@ uint BarbotScript::translateId(uint id) const { return 0; } +void BarbotScript::adjustDial(int dialNum, int amount) { + int level = CLIP(getDialLevel(dialNum) + amount, 0, 100); + setDial(dialNum, level); +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index 9f3860448e..4aaa5f5a40 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -28,6 +28,13 @@ namespace Titanic { class BarbotScript : public TTnpcScript { +private: + int _state; +private: + /** + * Adjust a given dial number by a given delta amount + */ + void adjustDial(int dialNum, int amount); public: BarbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7); diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 9c8c686c51..aec067e19e 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -22,18 +22,76 @@ #include "common/textconsole.h" #include "titanic/true_talk/doorbot_script.h" +#include "titanic/true_talk/tt_room_script.h" namespace Titanic { +static const int STATE_ARRAY[9] = { + 0x2E2A, 0x2E2B, 0x2E2C, 0x2E2D, 0x2E2E, 0x2E2F, 0x2E30, 0x2E31, 0x2E32 +}; + DoorbotScript::DoorbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { + Common::fill(&_array[0], &_array[148], 0); + _state = 0; load("Responses/Doorbot"); } int DoorbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { - warning("TODO"); - return SS_2; + if (tag == MKTAG('D', 'N', 'A', '1') || tag == MKTAG('H', 'H', 'G', 'Q') || + tag == MKTAG('A', 'N', 'S', 'W') || tag == MKTAG('S', 'U', 'M', 'S')) { + if (_state > 9) + _state = 0; + addResponse(STATE_ARRAY[_state]); + applyResponse(); + + if (STATE_ARRAY[_state] == 11826) + set34(1); + ++_state; + return 2; + } + + if (tag == MKTAG('C', 'H', 'S', 'E') || tag == MKTAG('C', 'M', 'N', 'T') || + tag == MKTAG('J', 'F', 'O', 'D')) + tag = MKTAG('F', 'O', 'O', 'D'); + + if (tag == MKTAG('F', 'O', 'O', 'D') && roomScript->_scriptId == 132) { + return setResponse(getDialogueId(220818)); + } + + if (tag == MKTAG('T', 'R', 'A', 'V')) { + return setResponse(11858 - getRandomBit()); + } else if (tag == MKTAG('C', 'S', 'P', 'Y')) { + return setResponse(10405, 3); + } else if (tag == MKTAG('S', 'C', 'I', 'T')) { + return setResponse(10410, 14); + } else if (tag == MKTAG('L', 'I', 'T', 'E')) { + return setResponse(10296, 17); + } else if (tag == MKTAG('D', 'O', 'R', '1')) { + return setResponse(getDialogueId(222034)); + } else if (tag == MKTAG('W', 'T', 'H', 'R')) { + return setResponse(getDialogueId(222126)); + } else if (tag == MKTAG('N', 'A', 'U', 'T')) { + return setResponse(getDialogueId(222259)); + } else if (tag == MKTAG('T', 'R', 'A', '2')) { + return setResponse(getRandomBit() ? 11860 : 11859); + } else if (tag == MKTAG('T', 'R', 'A', '3')) { + return setResponse(getRandomBit() ? 11859 : 11858); + } else if (tag == MKTAG('B', 'R', 'N', 'D')) { + switch (getRandomNumber(3)) { + case 1: + tag = MKTAG('B', 'R', 'N', '2'); + break; + case 2: + tag = MKTAG('B', 'R', 'N', '3'); + break; + default: + break; + } + } + + return TTnpcScript::chooseResponse(roomScript, sentence, tag); } void DoorbotScript::proc7(int v1, int v2) { @@ -107,4 +165,13 @@ uint DoorbotScript::translateId(uint id) const { return 0; } +int DoorbotScript::setResponse(int dialogueId, int v34) { + addResponse(dialogueId); + applyResponse(); + + if (v34 != -1) + set34(v34); + return 2; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index d00e5b19ef..5158eecb36 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -30,6 +30,12 @@ namespace Titanic { class DoorbotScript : public TTnpcScript { private: int _array[148]; + int _state; +private: + /** + * Sets a response + */ + int setResponse(int dialogueId, int v34 = -1); public: DoorbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7); -- cgit v1.2.3 From e2d3a0a32f62c6865397ca23984e15fbf6af5a3a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 1 Jun 2016 21:59:46 -0400 Subject: TITANIC: Adding setDial method --- engines/titanic/pet_control/pet_control.cpp | 5 ++++ engines/titanic/pet_control/pet_control.h | 5 ++++ engines/titanic/pet_control/pet_conversations.h | 10 ++++---- engines/titanic/true_talk/true_talk_manager.h | 10 ++++---- engines/titanic/true_talk/tt_npc_script.cpp | 31 +++++++++++++++++++++---- engines/titanic/true_talk/tt_npc_script.h | 23 ++++++++++++++---- 6 files changed, 65 insertions(+), 19 deletions(-) diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 92ec3d6b03..85bac6a63e 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -524,4 +524,9 @@ int CPetControl::roomFn2(int val) { return _rooms.fn2(val); } +void CPetControl::resetDials(int flag) { + if (flag == 1) + _conversations.resetDials(_activeNPCName); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 1eedc0382f..cf1589ca62 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -299,6 +299,11 @@ public: */ void addRoom(int roomNum); int roomFn2(int val); + + /** + * Resets the dial display to reflect new values + */ + void resetDials(int flag = 1); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index b88ddfacd5..cefdf1b8f1 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -148,11 +148,6 @@ private: * Called when the dial for an NPC is being changed */ void npcDialChange(uint dialNum, int oldLevel, int newLevel); - - /** - * Reset the dials with those for a given NPC - */ - void resetDials(const CString &name); public: CPetConversations(); virtual ~CPetConversations() {} @@ -241,6 +236,11 @@ public: * Hide the text cursor */ virtual void hideCursor(); + + /** + * Reset the dials with those for a given NPC + */ + void resetDials(const CString &name); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index ef226f2364..3140e72724 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -109,11 +109,6 @@ private: static bool proximityMethod1(int val); - /** - * Return the game manager - */ - CGameManager *getGameManager() const; - /** * Return the game state */ @@ -192,6 +187,11 @@ public: */ void removeCompleted(); + /** + * Return the game manager + */ + CGameManager *getGameManager() const; + void update2(); /** diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 2c8b8ba783..48135d0e63 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -21,6 +21,7 @@ */ #include "common/textconsole.h" +#include "titanic/pet_control/pet_control.h" #include "titanic/true_talk/tt_npc_script.h" #include "titanic/true_talk/true_talk_manager.h" #include "titanic/titanic.h" @@ -53,7 +54,8 @@ TTnpcScript::TTnpcScript(int charId, const char *charClass, int v2, _field6C(0), _field70(0), _field74(0), _field78(0), _field7C(0), _field80(0), _field2CC(false) { CTrueTalkManager::_v2 = 0; - Common::fill(&_array[0], &_array[146], 0); + Common::fill(&_dialValues[0], &_dialValues[DIALS_ARRAY_COUNT], 0); + Common::fill(&_array[0], &_array[136], 0); if (!CTrueTalkManager::_v10) { Common::fill(&CTrueTalkManager::_v11[0], &CTrueTalkManager::_v11[41], 0); @@ -243,15 +245,34 @@ int TTnpcScript::proc31() { return 0; } -void TTnpcScript::proc32() { +void TTnpcScript::proc32(int dialNum, int region) { warning("TODO"); } -void TTnpcScript::proc33(int v1, int v2) { - warning("TODO"); +void TTnpcScript::setDial(int dialNum, int value) { + if (dialNum < DIALS_ARRAY_COUNT) { + int oldRegion = proc34(dialNum); + + int newRegion = 1; + if (value < 50) + newRegion = 0; + else if (value > 150) + newRegion = 2; + + if (oldRegion == newRegion) + proc32(dialNum, newRegion); + + _dialValues[dialNum] = value; + } + + if (g_vm->_trueTalkManager) { + CPetControl *petControl = g_vm->_trueTalkManager->getGameManager()->getPetControl(); + if (petControl) + petControl->resetDials(); + } } -int TTnpcScript::proc34() { +int TTnpcScript::proc34(int dialNum) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 3822b520c8..bb495425aa 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -28,6 +28,8 @@ namespace Titanic { +#define DIALS_ARRAY_COUNT 10 + class TTroomScript; class TTsentence; @@ -87,7 +89,8 @@ protected: int _field78; int _field7C; int _field80; - int _array[146]; + int _dialValues[DIALS_ARRAY_COUNT]; + int _array[136]; bool _field2CC; protected: /** @@ -114,6 +117,13 @@ protected: */ uint getRandomNumber(int max) const; + /** + * Gets a random number of 0 or 1 + */ + uint getRandomBit() const { + return getRandomNumber(2) - 1; + } + /** * Returns a dialogue Id by script tag value Id */ @@ -164,9 +174,14 @@ public: virtual void saveBody(SimpleFile *file); virtual void loadBody(SimpleFile *file); virtual int proc31(); - virtual void proc32(); - virtual void proc33(int v1, int v2); - virtual int proc34(); + virtual void proc32(int dialNum, int region); + + /** + * Sets the value for an NPC's dial + */ + virtual void setDial(int dialNum, int value); + + virtual int proc34(int dialNum); /** * Get the NPC's dial level -- cgit v1.2.3 From b1ae3f44db79c7dc4ce31985dc5ca072fc1c9d76 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 1 Jun 2016 22:26:58 -0400 Subject: TITANIC: More script dial methods --- engines/titanic/true_talk/tt_npc_script.cpp | 39 +++++++++++++++++++++++------ engines/titanic/true_talk/tt_npc_script.h | 18 +++++++++++-- 2 files changed, 47 insertions(+), 10 deletions(-) diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 48135d0e63..8369d6623a 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -24,6 +24,7 @@ #include "titanic/pet_control/pet_control.h" #include "titanic/true_talk/tt_npc_script.h" #include "titanic/true_talk/true_talk_manager.h" +#include "titanic/game_manager.h" #include "titanic/titanic.h" namespace Titanic { @@ -245,13 +246,20 @@ int TTnpcScript::proc31() { return 0; } -void TTnpcScript::proc32(int dialNum, int region) { - warning("TODO"); +void TTnpcScript::setDialRegion(int dialNum, int region) { + if (dialNum < DIALS_ARRAY_COUNT) + _dialValues[dialNum] = region * 100; + + if (g_vm->_trueTalkManager) { + CPetControl *petControl = getPetControl(g_vm->_trueTalkManager->getGameManager()); + if (petControl) + petControl->playSound(1); + } } void TTnpcScript::setDial(int dialNum, int value) { if (dialNum < DIALS_ARRAY_COUNT) { - int oldRegion = proc34(dialNum); + int oldRegion = getDialRegion(dialNum); int newRegion = 1; if (value < 50) @@ -260,21 +268,30 @@ void TTnpcScript::setDial(int dialNum, int value) { newRegion = 2; if (oldRegion == newRegion) - proc32(dialNum, newRegion); + setDialRegion(dialNum, newRegion); _dialValues[dialNum] = value; } if (g_vm->_trueTalkManager) { - CPetControl *petControl = g_vm->_trueTalkManager->getGameManager()->getPetControl(); + CPetControl *petControl = getPetControl(g_vm->_trueTalkManager->getGameManager()); if (petControl) petControl->resetDials(); } } -int TTnpcScript::proc34(int dialNum) { - warning("TODO"); - return 0; +int TTnpcScript::getDialRegion(int dialNum) { + if (dialNum < DIALS_ARRAY_COUNT) { + int value = _dialValues[dialNum]; + if (value < 50) + return 0; + else if (value > 150) + return 2; + else + return 1; + } else { + return 0; + } } int TTnpcScript::getDialLevel(uint dialNum, bool flag) { @@ -424,4 +441,10 @@ int TTnpcScript::translateByArray(int id) { return -1; } +CPetControl *TTnpcScript::getPetControl(CGameManager *gameManager) { + if (gameManager && gameManager->_project) + return gameManager->_project->getPetControl(); + return nullptr; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index bb495425aa..69934ce863 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -30,6 +30,8 @@ namespace Titanic { #define DIALS_ARRAY_COUNT 10 +class CGameManager; +class CPetControl; class TTroomScript; class TTsentence; @@ -128,6 +130,11 @@ protected: * Returns a dialogue Id by script tag value Id */ uint getDialogueId(uint tagId); + + /** + * Returns a pointer to the PET control + */ + static CPetControl *getPetControl(CGameManager *gameManager); public: TTnpcScript(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, @@ -174,14 +181,21 @@ public: virtual void saveBody(SimpleFile *file); virtual void loadBody(SimpleFile *file); virtual int proc31(); - virtual void proc32(int dialNum, int region); + + /** + * Sets a given dial to be pointing in a specified region (0 to 2) + */ + virtual void setDialRegion(int dialNum, int region); /** * Sets the value for an NPC's dial */ virtual void setDial(int dialNum, int value); - virtual int proc34(int dialNum); + /** + * Returns a dial's region number + */ + virtual int getDialRegion(int dialNum); /** * Get the NPC's dial level -- cgit v1.2.3 From 95dc0bc4ccf51de23ab30133d6d1f339936ad413 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 2 Jun 2016 07:48:25 -0400 Subject: TITANIC: Finished BarbotScript chooseResponse --- engines/titanic/true_talk/barbot_script.cpp | 47 ++++++++++++++++++++++++++--- engines/titanic/true_talk/tt_npc_script.h | 3 +- 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index ed7e083897..16bc2447b6 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -49,14 +49,53 @@ int BarbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, applyResponse(); return 2; - } + + } else if (tag == MKTAG('S', 'W', 'E', 'R')) { + adjustDial(0, -18); + adjustDial(1, -5); + + if (getRandomNumber(100) > 50) { + addResponse(getDialogueId(getDialRegion(0) == 0 ? 250200 : 250062)); + applyResponse(); + return 2; + } + + } else if (tag == MKTAG('B', 'A', 'R', 'K') && getRandomNumber(100) > 50) { + proc14(250025); + switch (proc23()) { + case 4: + case 6: + addResponse(getDialogueId(250125)); + break; + default: + break; + } + + applyResponse(); + return 2; - if (tag == MKTAG('S', 'W', 'E', 'R')) { + } else if (tag == MKTAG('B', 'A', 'R', 'U') && getRandomNumber(100) > 50) { + proc14(250025); + switch (proc23()) { + case 4: + case 6: + addResponse(getDialogueId(250112)); + break; + default: + break; + } + applyResponse(); + return 2; } - warning("TODO"); - return SS_2; + if (tag == MKTAG('T', 'H', 'R', 'T') || tag == MKTAG('S', 'L', 'O', 'W') || + tag == MKTAG('S', 'E', 'X', '1') || tag == MKTAG('P', 'K', 'U', 'P')) { + adjustDial(0, -7); + adjustDial(1, -3); + } + + return TTnpcScript::chooseResponse(roomScript, sentence, tag); } void BarbotScript::proc7(int v1, int v2) { diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 69934ce863..906489ec3b 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -198,7 +198,8 @@ public: virtual int getDialRegion(int dialNum); /** - * Get the NPC's dial level + * Gets the value for a dial, introducing a slight random variance so that + * the displayed dial will oscillate randomly around it's real level */ virtual int getDialLevel(uint dialNum, bool flag = true); -- cgit v1.2.3 From 6075a8fe4900bb32216099b2f9fd34334dbc281b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 2 Jun 2016 19:14:59 -0400 Subject: TITANIC: Implement TTnpcScript selectResponse --- engines/titanic/true_talk/barbot_script.cpp | 6 +++--- engines/titanic/true_talk/liftbot_script.cpp | 2 +- engines/titanic/true_talk/tt_npc_script.cpp | 23 ++++++++++++++++------- engines/titanic/true_talk/tt_npc_script.h | 11 +++++++++-- 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index 16bc2447b6..ddb06b156f 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -42,7 +42,7 @@ int BarbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, if (_state < 7) { addResponse(STATE_ARRAY[_state++]); } else { - proc14(51896); + selectResponse(51896); set34(1); _state = 0; } @@ -61,7 +61,7 @@ int BarbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, } } else if (tag == MKTAG('B', 'A', 'R', 'K') && getRandomNumber(100) > 50) { - proc14(250025); + selectResponse(250025); switch (proc23()) { case 4: case 6: @@ -75,7 +75,7 @@ int BarbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, return 2; } else if (tag == MKTAG('B', 'A', 'R', 'U') && getRandomNumber(100) > 50) { - proc14(250025); + selectResponse(250025); switch (proc23()) { case 4: case 6: diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index dd6203dc62..5ffd6fb8ea 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -42,7 +42,7 @@ int LiftbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence case MKTAG('H', 'H', 'G', 'Q'): case MKTAG('A', 'N', 'S', 'W'): if (_state >= 7) { - proc14(30918); + selectResponse(30918); set34(2); _state = 0; } else { diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 8369d6623a..1f1fceb156 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -66,13 +66,14 @@ TTnpcScript::TTnpcScript(int charId, const char *charClass, int v2, resetFlags(); } -void TTnpcScript::load(const char *name, int valuesPerTag) { +void TTnpcScript::load(const char *name, int valuesPerResponse) { + _valuesPerResponse = valuesPerResponse; Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); while (r->pos() < r->size()) { TTnpcScriptResponse sr; sr._tag = r->readUint32LE(); - for (int idx = 0; idx < valuesPerTag; ++idx) + for (int idx = 0; idx < valuesPerResponse; ++idx) sr._values[idx] = r->readUint32LE(); _responses.push_back(sr); @@ -99,9 +100,14 @@ int TTnpcScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, const TTnpcScriptResponse &response = _responses[idx]; if (response._tag == tag) { - int valIndex = getRandomNumber(response.size()) - 1; - uint diagId = getDialogueId(response._values[valIndex]); - addResponse(diagId); + if (_valuesPerResponse == 1) { + selectResponse(response._values[0]); + } else { + int valIndex = getRandomNumber(response.size()) - 1; + uint diagId = getDialogueId(response._values[valIndex]); + addResponse(diagId); + } + applyResponse(); return 2; } @@ -135,8 +141,11 @@ bool TTnpcScript::proc13() const { return true; } -void TTnpcScript::proc14(int v) { - warning("TODO"); +void TTnpcScript::selectResponse(int id) { + if (id >= 200000 && id <= 290264) + id = getDialogueId(id); + + addResponse(id); } int TTnpcScript::proc15() const { diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 906489ec3b..239cccea4e 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -81,6 +81,7 @@ private: int translateByArray(int id); protected: Common::Array _responses; + int _valuesPerResponse; byte *_subPtr; int _field60; int _field64; @@ -98,7 +99,7 @@ protected: /** * Loads response data for the NPC from the given resource */ - void load(const char *name, int valuesPerTag = 1); + void load(const char *name, int valuesPerResponse = 1); /** * Reset script flags @@ -163,7 +164,13 @@ public: virtual int proc11() const; virtual int proc12() const; virtual bool proc13() const; - virtual void proc14(int v); + + /** + * Translate a passed Id to a dialogue Id if necessary, + * and adds it to the response + */ + virtual void selectResponse(int id); + virtual int proc15() const; virtual bool proc16() const; virtual bool proc17() const; -- cgit v1.2.3 From 928f9a8974753e84a051e354113811ba1b9548f1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 2 Jun 2016 19:51:55 -0400 Subject: TITANIC: Remove redundant CScriptHandlerSub class --- engines/titanic/true_talk/script_handler.cpp | 11 ++++++----- engines/titanic/true_talk/script_handler.h | 13 ------------- engines/titanic/true_talk/tt_npc_script.cpp | 2 +- engines/titanic/true_talk/tt_npc_script.h | 6 +++++- 4 files changed, 12 insertions(+), 20 deletions(-) diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index 5e31a9de52..cd06d71796 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -32,7 +32,7 @@ namespace Titanic { CScriptHandler::CScriptHandler(CTitleEngine *owner, int val1, int val2) : _owner(owner), _script(owner->_script), _resources(g_vm->_exeResources), - _sub1(), _parser(this), _field10(0), _inputCtr(0), + _parser(this), _field10(0), _inputCtr(0), _concept1P(nullptr), _concept2P(nullptr), _concept3P(nullptr), _concept4P(nullptr), _field30(0) { g_vm->_scriptHandler = this; @@ -94,12 +94,13 @@ int CScriptHandler::processInput(TTroomScript *roomScript, TTnpcScript *npcScrip } if (canProcess == 0 || canProcess == 1) { - _parser.findFrames(sentence); + if (!_parser.findFrames(sentence)) { + if (roomScript->canProcess(npcScript, sentence) && npcScript) { + npcScript->process(roomScript, sentence); + } + } } - warning("TODO: CScriptHandler::processInput"); - - // TODO delete sentence; return SS_VALID; } diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index 10699f1157..93abbc3d3a 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -35,24 +35,11 @@ namespace Titanic { class CTitleEngine; class CScriptHandler; -class CScriptHandlerSub1 { -public: - int _field0; - int _field4; - int _field8; - int _fieldC; - int _field10; -public: - CScriptHandlerSub1() : _field0(0), _field4(0), _field8(0), - _fieldC(0), _field10(0) {} -}; - class CScriptHandler { private: CTitleEngine *_owner; CExeResources &_resources; int _field10; - CScriptHandlerSub1 _sub1; int _inputCtr; int _field30; public: diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 1f1fceb156..20e7faf5a3 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -116,7 +116,7 @@ int TTnpcScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, return 1; } -void TTnpcScript::proc7(int v1, int v2) { +void TTnpcScript::process(TTroomScript *roomScript, TTsentence *sentence) { warning("TODO"); } diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 239cccea4e..3b9ffe86f7 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -150,7 +150,11 @@ public: */ virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag); - virtual void proc7(int v1, int v2); + /** + * Does further NPC specific processing of the sentence + */ + virtual void process(TTroomScript *roomScript, TTsentence *sentence); + virtual int proc8() const; virtual int proc9() const; -- cgit v1.2.3 From 62c699fa3ca815a658a930b06ab99f6ce31a881d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 2 Jun 2016 21:22:49 -0400 Subject: TITANIC: New TTsentenceEntries class for holding sentence res data --- engines/titanic/true_talk/tt_npc_script.cpp | 8 +++++-- engines/titanic/true_talk/tt_npc_script.h | 7 ++++-- engines/titanic/true_talk/tt_sentence.cpp | 35 +++++++++++++++++++++++++++++ engines/titanic/true_talk/tt_sentence.h | 34 ++++++++++++++++++++++++++++ 4 files changed, 80 insertions(+), 4 deletions(-) diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 20e7faf5a3..41bf5d8ac4 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -51,7 +51,7 @@ TTnpcScriptBase::TTnpcScriptBase(int charId, const char *charClass, int v2, TTnpcScript::TTnpcScript(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScriptBase(charId, charClass, v2, charName, v3, val2, v4, v5, v6, v7), - _subPtr(nullptr), _field60(0), _field64(0), _field68(0), + _subPtr(nullptr), _entriesP(nullptr), _entryCount(0), _field68(0), _field6C(0), _field70(0), _field74(0), _field78(0), _field7C(0), _field80(0), _field2CC(false) { CTrueTalkManager::_v2 = 0; @@ -117,7 +117,7 @@ int TTnpcScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, } void TTnpcScript::process(TTroomScript *roomScript, TTsentence *sentence) { - warning("TODO"); + processSentence(_entriesP, _entryCount, roomScript, sentence); } int TTnpcScript::proc8() const { @@ -456,4 +456,8 @@ CPetControl *TTnpcScript::getPetControl(CGameManager *gameManager) { return nullptr; } +void TTnpcScript::processSentence(const TTsentenceEntries *entries, int entryCount, TTroomScript *roomScript, TTsentence *sentence) { + warning("TODO"); +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 3b9ffe86f7..a6741e6136 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -34,6 +34,7 @@ class CGameManager; class CPetControl; class TTroomScript; class TTsentence; +class TTsentenceEntries; struct TTnpcScriptResponse { uint _tag; @@ -83,8 +84,8 @@ protected: Common::Array _responses; int _valuesPerResponse; byte *_subPtr; - int _field60; - int _field64; + const TTsentenceEntries *_entriesP; + int _entryCount; int _field68; int _field6C; int _field70; @@ -136,6 +137,8 @@ protected: * Returns a pointer to the PET control */ static CPetControl *getPetControl(CGameManager *gameManager); + + void processSentence(const TTsentenceEntries *entries, int entryCount, TTroomScript *roomScript, TTsentence *sentence); public: TTnpcScript(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index c777464f8d..697afddd77 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -39,6 +39,41 @@ TTsentenceConcept *TTsentenceConcept::addSibling() { /*------------------------------------------------------------------------*/ +bool TTsentenceEntry::load(Common::SeekableReadStream *s) { + if (s->pos() >= s->size()) + return false; + + _field0 = s->readUint32LE(); + _field4 = s->readUint32LE(); + _string8 = readStringFromStream(s); + _fieldC = s->readUint32LE(); + _string10 = readStringFromStream(s); + _string14 = readStringFromStream(s); + _string18 = readStringFromStream(s); + _string1C = readStringFromStream(s); + _field20 = s->readUint32LE(); + _string24 = readStringFromStream(s); + _field28 = s->readUint32LE(); + _field2C = s->readUint32LE(); + _field30 = s->readUint32LE(); + + return true; +} + +/*------------------------------------------------------------------------*/ + +void TTsentenceEntries::load(const CString &resName) { + TTsentenceEntry entry; + Common::SeekableReadStream *r = g_vm->_filesManager->getResource(resName); + + while (entry.load(r)) + push_back(entry); + + delete r; +} + +/*------------------------------------------------------------------------*/ + TTsentence::TTsentence(int inputCtr, const TTstring &line, CScriptHandler *owner, TTroomScript *roomScript, TTnpcScript *npcScript) : _owner(owner), _field2C(1), _inputCtr(inputCtr), _field34(0), diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index f51ca4bdda..3d1c9f2b74 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -23,6 +23,7 @@ #ifndef TITANIC_TT_SENTENCE_H #define TITANIC_TT_SENTENCE_H +#include "common/array.h" #include "titanic/true_talk/tt_concept_node.h" #include "titanic/true_talk/tt_npc_script.h" #include "titanic/true_talk/tt_room_script.h" @@ -45,6 +46,39 @@ public: TTsentenceConcept *addSibling(); }; +struct TTsentenceEntry { + int _field0; + int _field4; + CString _string8; + int _fieldC; + CString _string10; + CString _string14; + CString _string18; + CString _string1C; + int _field20; + CString _string24; + int _field28; + int _field2C; + int _field30; + + TTsentenceEntry() : _field0(0), _field4(0), _fieldC(0), + _field20(0), _field28(0), _field2C(0), _field30(0) {} + + /** + * Load an entry from the passed stream, and returns true + * if an entry was successfully loaded + */ + bool load(Common::SeekableReadStream *s); +}; + +class TTsentenceEntries : public Common::Array { +public: + /** + * Load a list of entries from the specified resource + */ + void load(const CString &resName); +}; + class TTsentence { private: CScriptHandler *_owner; -- cgit v1.2.3 From 6eb562a17a56ca415eb939f07d512d627b1907e9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 2 Jun 2016 22:22:54 -0400 Subject: TITANIC: Beginnings of script handler processSentence --- engines/titanic/true_talk/tt_npc_script.cpp | 32 ++++++++++++++++++++++++++++- engines/titanic/true_talk/tt_npc_script.h | 2 +- engines/titanic/true_talk/tt_sentence.cpp | 13 ++++++++++++ engines/titanic/true_talk/tt_sentence.h | 5 +++++ 4 files changed, 50 insertions(+), 2 deletions(-) diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 41bf5d8ac4..6f3c102013 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -456,7 +456,37 @@ CPetControl *TTnpcScript::getPetControl(CGameManager *gameManager) { return nullptr; } -void TTnpcScript::processSentence(const TTsentenceEntries *entries, int entryCount, TTroomScript *roomScript, TTsentence *sentence) { +int TTnpcScript::processSentence(const TTsentenceEntries *entries, uint entryCount, TTroomScript *roomScript, TTsentence *sentence) { + if (!entries) + return SS_1; + if (!entryCount) + // No count specified, so use entire list + entryCount = entries->size(); + int entryId = _field2C; + + for (uint loopCtr = 0; loopCtr < 2; ++loopCtr) { + for (uint entryCtr = 0; entryCtr < entryCount; ++entryCtr) { + const TTsentenceEntry &entry = (*entries)[entryCtr]; + if (entry._field4 != entryId && (loopCtr == 0 || entry._field4)) + continue; + + bool flag; + if (entry._fieldC || entry._string10.empty()) { + flag = sentence->fn1(entry._string8, entry._fieldC, + entry._string14, entry._string18, entry._string1C, + entry._field20, entry._field28, 0, nullptr); + } else { + flag = sentence->fn3(entry._string8, entry._string10, + entry._string14, entry._string18, entry._string1C, + entry._string24, entry._field28, 0, nullptr); + } + + if (flag) { + // TODO + } + } + } + warning("TODO"); } diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index a6741e6136..43e26b6e53 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -138,7 +138,7 @@ protected: */ static CPetControl *getPetControl(CGameManager *gameManager); - void processSentence(const TTsentenceEntries *entries, int entryCount, TTroomScript *roomScript, TTsentence *sentence); + int processSentence(const TTsentenceEntries *entries, uint entryCount, TTroomScript *roomScript, TTsentence *sentence); public: TTnpcScript(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index 697afddd77..f41ddd1565 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -142,6 +142,19 @@ int TTsentence::storeVocabHit(TTword *word) { return 0; } +bool TTsentence::fn1(const CString &str, int wordId1, const CString &str1, const CString &str2, + const CString &str3, int wordId2, int val, int val2, const TTconceptNode *node) { + // TODO + return false; +} + +bool TTsentence::fn3(const CString &str1, const CString &str2, const CString &str3, + const CString &str4, const CString &str5, const CString &str6, + int val, int val2, const TTconceptNode *node) { + // TODO + return false; +} + bool TTsentence::fn2(int slotIndex, const TTstring &str, TTconceptNode *conceptNode) { if (!conceptNode) conceptNode = &_sentenceConcept; diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index 3d1c9f2b74..66d64fcd6d 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -141,6 +141,11 @@ public: */ int storeVocabHit(TTword *word); + bool fn1(const CString &str, int wordId1, const CString &str1, const CString &str2, + const CString &str3, int wordId2, int val, int val2, const TTconceptNode *node); + bool fn3(const CString &str1, const CString &str2, const CString &str3, + const CString &str4, const CString &str5, const CString &str6, + int val, int val2, const TTconceptNode *node); bool fn2(int slotIndex, const TTstring &str, TTconceptNode *conceptNode); bool fn4(int mode, int wordId, TTconceptNode *node); }; -- cgit v1.2.3 From 3196e488f196a6c33f89eea389cf8d9a90d5f90d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 2 Jun 2016 23:33:55 -0400 Subject: TITANIC: Finished TTnpcScript processSentence --- engines/titanic/true_talk/barbot_script.cpp | 6 ++-- engines/titanic/true_talk/barbot_script.h | 6 ++-- engines/titanic/true_talk/bellbot_script.cpp | 6 ++-- engines/titanic/true_talk/bellbot_script.h | 6 ++-- engines/titanic/true_talk/deskbot_script.cpp | 6 ++-- engines/titanic/true_talk/deskbot_script.h | 6 ++-- engines/titanic/true_talk/doorbot_script.cpp | 6 ++-- engines/titanic/true_talk/doorbot_script.h | 6 ++-- engines/titanic/true_talk/liftbot_script.cpp | 6 ++-- engines/titanic/true_talk/liftbot_script.h | 6 ++-- engines/titanic/true_talk/maitred_script.cpp | 6 ++-- engines/titanic/true_talk/maitred_script.h | 6 ++-- engines/titanic/true_talk/parrot_script.cpp | 4 +-- engines/titanic/true_talk/parrot_script.h | 4 +-- engines/titanic/true_talk/succubus_script.cpp | 4 +-- engines/titanic/true_talk/succubus_script.h | 4 +-- engines/titanic/true_talk/tt_concept.h | 1 + engines/titanic/true_talk/tt_npc_script.cpp | 47 ++++++++++++++++++++++++--- engines/titanic/true_talk/tt_npc_script.h | 7 ++-- engines/titanic/true_talk/tt_sentence.cpp | 5 +++ engines/titanic/true_talk/tt_sentence.h | 2 ++ 21 files changed, 98 insertions(+), 52 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index ddb06b156f..d6768fc359 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -132,7 +132,7 @@ int BarbotScript::proc21(int v1, int v2, int v3) { return 0; } -int BarbotScript::proc22() const { +int BarbotScript::proc22(int id) const { warning("TODO"); return 0; } @@ -147,12 +147,12 @@ const int *BarbotScript::getTablePtr(int id) { return nullptr; } -int BarbotScript::proc25() const { +int BarbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { warning("TODO"); return 0; } -void BarbotScript::proc26() { +void BarbotScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { } void BarbotScript::proc32() { diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index 4aaa5f5a40..99dfac88ed 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -51,11 +51,11 @@ public: virtual bool proc17() const; virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); - virtual int proc22() const; + virtual int proc22(int id) const; virtual int proc23() const; virtual const int *getTablePtr(int id); - virtual int proc25() const; - virtual void proc26(); + virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; + virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual void proc32(); virtual int proc36(int val) const; diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 7954b7f731..1da2726b17 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -76,7 +76,7 @@ int BellbotScript::proc21(int v1, int v2, int v3) { return 0; } -int BellbotScript::proc22() const { +int BellbotScript::proc22(int id) const { warning("TODO"); return 0; } @@ -91,12 +91,12 @@ const int *BellbotScript::getTablePtr(int id) { return nullptr; } -int BellbotScript::proc25() const { +int BellbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { warning("TODO"); return 0; } -void BellbotScript::proc26() { +void BellbotScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { } int BellbotScript::proc36(int id) const { diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index 86e9165d01..3c23716892 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -45,11 +45,11 @@ public: virtual bool proc17() const; virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); - virtual int proc22() const; + virtual int proc22(int id) const; virtual int proc23() const; virtual const int *getTablePtr(int id); - virtual int proc25() const; - virtual void proc26(); + virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; + virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual int proc36(int val) const; virtual uint translateId(uint id) const; }; diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index fe4de23436..ce643f5f38 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -77,7 +77,7 @@ int DeskbotScript::proc21(int v1, int v2, int v3) { return 0; } -int DeskbotScript::proc22() const { +int DeskbotScript::proc22(int id) const { warning("TODO"); return 0; } @@ -92,12 +92,12 @@ const int *DeskbotScript::getTablePtr(int id) { return nullptr; } -int DeskbotScript::proc25() const { +int DeskbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { warning("TODO"); return 0; } -void DeskbotScript::proc26() { +void DeskbotScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { } int DeskbotScript::proc36(int id) const { diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index 3dda552571..a5fb11e92e 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -40,11 +40,11 @@ public: virtual bool proc17() const; virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); - virtual int proc22() const; + virtual int proc22(int id) const; virtual int proc23() const; virtual const int *getTablePtr(int id); - virtual int proc25() const; - virtual void proc26(); + virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; + virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual int proc36(int val) const; virtual uint translateId(uint id) const; diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index aec067e19e..2b248ac601 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -128,7 +128,7 @@ int DoorbotScript::proc21(int v1, int v2, int v3) { return 0; } -int DoorbotScript::proc22() const { +int DoorbotScript::proc22(int id) const { warning("TODO"); return 0; } @@ -143,12 +143,12 @@ const int *DoorbotScript::getTablePtr(int id) { return nullptr; } -int DoorbotScript::proc25() const { +int DoorbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { warning("TODO"); return 0; } -void DoorbotScript::proc26() { +void DoorbotScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { } void DoorbotScript::proc32() { diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 5158eecb36..72e24db104 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -52,11 +52,11 @@ public: virtual bool proc17() const; virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); - virtual int proc22() const; + virtual int proc22(int id) const; virtual int proc23() const; virtual const int *getTablePtr(int id); - virtual int proc25() const; - virtual void proc26(); + virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; + virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual void proc32(); virtual int proc36(int val) const; virtual uint translateId(uint id) const; diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index 5ffd6fb8ea..3a64733f2f 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -104,7 +104,7 @@ int LiftbotScript::proc21(int v1, int v2, int v3) { return 0; } -int LiftbotScript::proc22() const { +int LiftbotScript::proc22(int id) const { warning("TODO"); return 0; } @@ -119,12 +119,12 @@ const int *LiftbotScript::getTablePtr(int id) { return nullptr; } -int LiftbotScript::proc25() const { +int LiftbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { warning("TODO"); return 0; } -void LiftbotScript::proc26() { +void LiftbotScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { } void LiftbotScript::proc32() { diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index 04454c84d0..9e2a9ff3f8 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -47,11 +47,11 @@ public: virtual bool proc17() const; virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); - virtual int proc22() const; + virtual int proc22(int id) const; virtual int proc23() const; virtual const int *getTablePtr(int id); - virtual int proc25() const; - virtual void proc26(); + virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; + virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual void proc32(); virtual uint translateId(uint id) const; }; diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index ed9cc5b56b..c417940eb7 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -82,7 +82,7 @@ int MaitreDScript::proc21(int v1, int v2, int v3) { return 0; } -int MaitreDScript::proc22() const { +int MaitreDScript::proc22(int id) const { warning("TODO"); return 0; } @@ -97,12 +97,12 @@ const int *MaitreDScript::getTablePtr(int id) { return nullptr; } -int MaitreDScript::proc25() const { +int MaitreDScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { warning("TODO"); return 0; } -void MaitreDScript::proc26() { +void MaitreDScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { } uint MaitreDScript::translateId(uint id) const { diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index d638dee52b..389e3887ab 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -43,11 +43,11 @@ public: virtual bool proc17() const; virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); - virtual int proc22() const; + virtual int proc22(int id) const; virtual int proc23() const; virtual const int *getTablePtr(int id); - virtual int proc25() const; - virtual void proc26(); + virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; + virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual uint translateId(uint id) const; }; diff --git a/engines/titanic/true_talk/parrot_script.cpp b/engines/titanic/true_talk/parrot_script.cpp index 3e195a00c1..a889187ee2 100644 --- a/engines/titanic/true_talk/parrot_script.cpp +++ b/engines/titanic/true_talk/parrot_script.cpp @@ -64,12 +64,12 @@ const int *ParrotScript::getTablePtr(int id) { return nullptr; } -int ParrotScript::proc25() const { +int ParrotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { warning("TODO"); return 0; } -void ParrotScript::proc26() { +void ParrotScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { } } // End of namespace Titanic diff --git a/engines/titanic/true_talk/parrot_script.h b/engines/titanic/true_talk/parrot_script.h index abf8042c37..3cf804d10d 100644 --- a/engines/titanic/true_talk/parrot_script.h +++ b/engines/titanic/true_talk/parrot_script.h @@ -44,8 +44,8 @@ public: virtual bool proc18() const; virtual int proc23() const; virtual const int *getTablePtr(int id); - virtual int proc25() const; - virtual void proc26(); + virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; + virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp index c09cadd9b0..b52a02a8d5 100644 --- a/engines/titanic/true_talk/succubus_script.cpp +++ b/engines/titanic/true_talk/succubus_script.cpp @@ -92,12 +92,12 @@ const int *SuccUBusScript::getTablePtr(int id) { return nullptr; } -int SuccUBusScript::proc25() const { +int SuccUBusScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { warning("TODO"); return 0; } -void SuccUBusScript::proc26() { +void SuccUBusScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { } } // End of namespace Titanic diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h index 43249999a5..e9263dbf84 100644 --- a/engines/titanic/true_talk/succubus_script.h +++ b/engines/titanic/true_talk/succubus_script.h @@ -48,8 +48,8 @@ public: virtual int proc21(int v1, int v2, int v3); virtual int proc23() const; virtual const int *getTablePtr(int id); - virtual int proc25() const; - virtual void proc26(); + virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; + virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index 01f51e1ce9..3301926231 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -132,6 +132,7 @@ public: void setFlag(bool val) { _flag = val; } void set1C(int val) { _field1C = val; } int get20() const { return _field20; } + int get34() const { return _field34; } bool checkWordId1() const; bool checkWordId2() const; diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 6f3c102013..ff1d854388 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -178,7 +178,7 @@ int TTnpcScript::proc21(int v1, int v2, int v3) { return v1; } -int TTnpcScript::proc22() const { +int TTnpcScript::proc22(int id) const { return 0; } @@ -186,11 +186,11 @@ int TTnpcScript::proc23() const { return 0; } -int TTnpcScript::proc25() const { +int TTnpcScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { return 0; } -void TTnpcScript::proc26() { +void TTnpcScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { } void TTnpcScript::save(SimpleFile *file) { @@ -482,12 +482,49 @@ int TTnpcScript::processSentence(const TTsentenceEntries *entries, uint entryCou } if (flag) { - // TODO + if (entry._field2C) { + bool flag2 = true; + if (entry._field2C & 0x1000000) + flag2 = sentence->isConcept34(1); + + if (entry._field2C & 0x2000000) + flag2 = sentence->isConcept34(0) || sentence->isConcept34(4); + + if (!flag2) { + flag = false; + } else { + int result = proc25(entry._field2C & 0xFFFFFF, entry._field0, + roomScript, sentence); + if (result == 2) + return 2; + flag = !result; + } + } + + if (flag) { + int dialogueId = getDialogueId(entry._field0); + int id; + if (!dialogueId) + return 1; + else if (dialogueId == 4) + return 2; + addResponse(dialogueId); + + id = proc22(dialogueId); + if (id) + addResponse(getDialogueId(id)); + applyResponse(); + + if (entry._field30) + proc26(entry._field30, &entry, roomScript, sentence); + + return 2; + } } } } - warning("TODO"); + return 1; } } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 43e26b6e53..afd7680ac7 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -34,6 +34,7 @@ class CGameManager; class CPetControl; class TTroomScript; class TTsentence; +struct TTsentenceEntry; class TTsentenceEntries; struct TTnpcScriptResponse { @@ -185,11 +186,11 @@ public: virtual uint proc19(uint v); virtual void proc20(int v); virtual int proc21(int v1, int v2, int v3); - virtual int proc22() const; + virtual int proc22(int id) const; virtual int proc23() const; virtual const int *getTablePtr(int id) = 0; - virtual int proc25() const; - virtual void proc26(); + virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; + virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual void save(SimpleFile *file); virtual void load(SimpleFile *file); virtual void saveBody(SimpleFile *file); diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index f41ddd1565..8347b424fb 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -291,4 +291,9 @@ int TTsentence::is1C(int val, const TTconceptNode *node) const { return node->_field1C == val; } +bool TTsentence::isConcept34(int slotIndex, TTconceptNode *node) { + TTconcept *concept = getFrameEntry(slotIndex, node); + return concept && concept->get34(); +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index 66d64fcd6d..349d0c3175 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -148,6 +148,8 @@ public: int val, int val2, const TTconceptNode *node); bool fn2(int slotIndex, const TTstring &str, TTconceptNode *conceptNode); bool fn4(int mode, int wordId, TTconceptNode *node); + + bool isConcept34(int slotIndex, TTconceptNode *node = nullptr); }; } // End of namespace Titanic -- cgit v1.2.3 From f02efd2d9e762c9f79e983603b5684e5eb357496 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 3 Jun 2016 23:01:44 -0400 Subject: TITANIC: Beginnings of TTquotes class --- engines/titanic/module.mk | 1 + engines/titanic/true_talk/tt_quotes.cpp | 86 +++++++++++++++++++++++++++++++++ engines/titanic/true_talk/tt_quotes.h | 61 +++++++++++++++++++++++ 3 files changed, 148 insertions(+) create mode 100644 engines/titanic/true_talk/tt_quotes.cpp create mode 100644 engines/titanic/true_talk/tt_quotes.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index c97b30f7b0..2b604ec29d 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -471,6 +471,7 @@ MODULE_OBJS := \ true_talk/tt_parser.o \ true_talk/tt_picture.o \ true_talk/tt_pronoun.o \ + true_talk/tt_quotes.o \ true_talk/tt_response.o \ true_talk/tt_room_script.o \ true_talk/tt_script_base.o \ diff --git a/engines/titanic/true_talk/tt_quotes.cpp b/engines/titanic/true_talk/tt_quotes.cpp new file mode 100644 index 0000000000..ced7f8e454 --- /dev/null +++ b/engines/titanic/true_talk/tt_quotes.cpp @@ -0,0 +1,86 @@ +/* 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/algorithm.h" +#include "titanic/true_talk/tt_quotes.h" + +namespace Titanic { + +TTquotes::TTquotes() { + Common::fill(&_array[0], &_array[256], 0); + _dataP = nullptr; + _field540 = 0; + _field544 = 0; +} + +TTquotes::~TTquotes() { + for (int idx = 0; idx < 26; ++idx) + delete _alphabet[idx]._dataP; + + delete _dataP; +} + +void TTquotes::load(const CString &name) { + // TODO +} + +int TTquotes::read(const char *str) { + if (!str || !*str) + return 0; + + // Find start and end of string + const char *startP = str, *endP = str; + while (*endP) + ++endP; + + do { + int result = read(startP, endP); + if (result) + return result; + + // Move to next following space or end of string + while (*startP && *startP != ' ') + ++startP; + // If it's a space, then move past it to start of next word + while (*startP && *startP == ' ') + ++startP; + + } while (*startP); + + return 0; +} + +int TTquotes::read(const char *startP, const char *endP) { + int size = endP - startP; + if (size < 3) + return 0; + + uint index = MIN((uint)(*startP - 'a'), (uint)25); + TTquotesEntry &entry = _alphabet[index]; + if (!entry._dataP || entry._field4 <= 0) + return 0; + + // TODO + return 0; +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_quotes.h b/engines/titanic/true_talk/tt_quotes.h new file mode 100644 index 0000000000..2af612ca32 --- /dev/null +++ b/engines/titanic/true_talk/tt_quotes.h @@ -0,0 +1,61 @@ +/* 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. + * + */ + +#ifndef TITANIC_TT_QUOTES_H +#define TITANIC_TT_QUOTES_H + +#include "common/scummsys.h" +#include "titanic/support/string.h" + +namespace Titanic { + +class TTquotes { + struct TTquotesEntry { + byte *_dataP; + int _field4; + int _field8; + + TTquotesEntry() : _dataP(nullptr), _field4(0), _field8(0) {} + }; +private: + TTquotesEntry _alphabet[26]; + uint _array[256]; + byte *_dataP; + int _field540; + int _field544; +private: + int read(const char *startP, const char *endP); +public: + TTquotes(); + ~TTquotes(); + + /** + * Load quotes from the specified resource + */ + void load(const CString &name); + + int read(const char *str); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_QUOTES_H */ -- cgit v1.2.3 From 4e766db41cae9d747f49cbfefbb5a23612768ea5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 3 Jun 2016 23:16:11 -0400 Subject: TITANIC: Implemented TTnpcScript loadQuotes --- engines/titanic/true_talk/true_talk_manager.cpp | 1 + engines/titanic/true_talk/true_talk_manager.h | 3 +++ engines/titanic/true_talk/tt_npc_script.cpp | 14 +++++++++++--- engines/titanic/true_talk/tt_npc_script.h | 6 +++++- engines/titanic/true_talk/tt_scripts.cpp | 2 +- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 1c10953206..a5a1edcc37 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -49,6 +49,7 @@ CTrueTalkManager::CTrueTalkManager(CGameManager *owner) : _gameManager(owner), _scripts(&_titleEngine), _currentCharId(0), _dialogueFile(nullptr), _dialogueId(0) { _titleEngine.setup(3, 3); + _quotes.load("TEXT/JRQuotes.txt"); _currentNPC = nullptr; g_vm->_trueTalkManager = this; } diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index 3140e72724..754a9955ca 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -27,6 +27,7 @@ #include "titanic/support/simple_file.h" #include "titanic/true_talk/dialogue_file.h" #include "titanic/true_talk/title_engine.h" +#include "titanic/true_talk/tt_quotes.h" #include "titanic/true_talk/tt_scripts.h" #include "titanic/true_talk/tt_talker.h" @@ -128,6 +129,8 @@ public: static CTrueTalkNPC *_currentNPC; static void setFlags(int index, int val); +public: + TTquotes _quotes; public: /** * Get a specified state value from the currently set NPC diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index ff1d854388..337b367eb9 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -136,9 +136,17 @@ int TTnpcScript::proc12() const { return 1; } -bool TTnpcScript::proc13() const { - warning("TODO"); - return true; + +bool TTnpcScript::loadQuotes() { + // Original did a load of a global quotes here the first time + // this method is called. ScummVM implementation has refactored + // the loading to the CTrueTalkManager constructor + + if (!proc18()) { + return false; + } else { + return proc17(); + } } void TTnpcScript::selectResponse(int id) { diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index afd7680ac7..15ff5303b7 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -171,7 +171,11 @@ public: virtual int proc11() const; virtual int proc12() const; - virtual bool proc13() const; + + /** + * Handles loading quotes used by the scripts + */ + virtual bool loadQuotes(); /** * Translate a passed Id to a dialogue Id if necessary, diff --git a/engines/titanic/true_talk/tt_scripts.cpp b/engines/titanic/true_talk/tt_scripts.cpp index fbdf52fdc0..94420a4112 100644 --- a/engines/titanic/true_talk/tt_scripts.cpp +++ b/engines/titanic/true_talk/tt_scripts.cpp @@ -75,7 +75,7 @@ TTscripts::TTscripts(CTitleEngine *titleEngine) : } void TTscripts::addScript(TTnpcScript *script, int scriptId) { - script->proc13(); + script->loadQuotes(); // Find the room script this is associated with TTroomScript *roomScript = getRoomScript(scriptId); -- cgit v1.2.3 From b3bcf1cc4e2c22cedafd63417bb1d22ef591dd41 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 4 Jun 2016 00:50:06 -0400 Subject: TITANIC: Finished TTquotes load --- engines/titanic/true_talk/tt_quotes.cpp | 42 ++++++++++++++++++++++++++------- engines/titanic/true_talk/tt_quotes.h | 16 +++++++++---- 2 files changed, 45 insertions(+), 13 deletions(-) diff --git a/engines/titanic/true_talk/tt_quotes.cpp b/engines/titanic/true_talk/tt_quotes.cpp index ced7f8e454..734ad58fbd 100644 --- a/engines/titanic/true_talk/tt_quotes.cpp +++ b/engines/titanic/true_talk/tt_quotes.cpp @@ -22,25 +22,50 @@ #include "common/algorithm.h" #include "titanic/true_talk/tt_quotes.h" +#include "titanic/titanic.h" namespace Titanic { TTquotes::TTquotes() { Common::fill(&_array[0], &_array[256], 0); _dataP = nullptr; - _field540 = 0; + _dataSize = 0; _field544 = 0; } TTquotes::~TTquotes() { - for (int idx = 0; idx < 26; ++idx) - delete _alphabet[idx]._dataP; - - delete _dataP; + delete[] _dataP; } void TTquotes::load(const CString &name) { - // TODO + Common::SeekableReadStream *r = g_vm->_filesManager->getResource("TEXT/JRQuotes.txt"); + size_t size = r->readUint32LE(); + + _dataSize = _field544 = size; + _dataP = new char[size + 0x10]; + + for (int idx = 0; idx < 256; ++idx) + _array[idx] = r->readUint32LE(); + + for (int charIdx = 0; charIdx < 26; ++charIdx) { + TTquotesLetter &letter = _alphabet[charIdx]; + int count = r->readUint32LE(); + + // Load the list of entries for the given letter + letter._entries.resize(count); + for (int idx = 0; idx < count; ++idx) { + letter._entries[idx]._val1 = r->readByte(); + letter._entries[idx]._val2 = r->readByte(); + letter._entries[idx]._strP = _dataP + r->readUint32LE(); + } + } + + // Read in buffer and then decode it + r->read((byte *)_dataP, _dataSize); + for (size_t idx = 0; idx < _dataSize; idx += 4) + WRITE_LE_UINT32((byte *)_dataP + idx, READ_LE_UINT32((byte *)_dataP + idx) ^ 0xA55A5AA5); + + delete r; } int TTquotes::read(const char *str) { @@ -75,8 +100,9 @@ int TTquotes::read(const char *startP, const char *endP) { return 0; uint index = MIN((uint)(*startP - 'a'), (uint)25); - TTquotesEntry &entry = _alphabet[index]; - if (!entry._dataP || entry._field4 <= 0) + TTquotesLetter &letter = _alphabet[index]; + if (letter._entries.empty()) + // No entries for the letter, so exit immediately return 0; // TODO diff --git a/engines/titanic/true_talk/tt_quotes.h b/engines/titanic/true_talk/tt_quotes.h index 2af612ca32..6649c1f744 100644 --- a/engines/titanic/true_talk/tt_quotes.h +++ b/engines/titanic/true_talk/tt_quotes.h @@ -24,23 +24,29 @@ #define TITANIC_TT_QUOTES_H #include "common/scummsys.h" +#include "common/stream.h" #include "titanic/support/string.h" namespace Titanic { class TTquotes { struct TTquotesEntry { - byte *_dataP; + byte _val1, _val2; + const char *_strP; + TTquotesEntry() : _val1(0), _val2(0), _strP(nullptr) {} + }; + struct TTquotesLetter { + Common::Array _entries; int _field4; int _field8; - TTquotesEntry() : _dataP(nullptr), _field4(0), _field8(0) {} + TTquotesLetter() : _field4(0), _field8(0) {} }; private: - TTquotesEntry _alphabet[26]; + TTquotesLetter _alphabet[26]; uint _array[256]; - byte *_dataP; - int _field540; + const char *_dataP; + size_t _dataSize; int _field544; private: int read(const char *startP, const char *endP); -- cgit v1.2.3 From e9c239797d2c99ec15675513c577b92a1ea6802e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 4 Jun 2016 08:36:51 -0400 Subject: TITANIC: Implement TTquotes read --- engines/titanic/true_talk/tt_quotes.cpp | 38 +++++++++++++++++++++++++++++++-- engines/titanic/true_talk/tt_quotes.h | 8 +++++++ 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/engines/titanic/true_talk/tt_quotes.cpp b/engines/titanic/true_talk/tt_quotes.cpp index 734ad58fbd..856cba9421 100644 --- a/engines/titanic/true_talk/tt_quotes.cpp +++ b/engines/titanic/true_talk/tt_quotes.cpp @@ -100,12 +100,46 @@ int TTquotes::read(const char *startP, const char *endP) { return 0; uint index = MIN((uint)(*startP - 'a'), (uint)25); - TTquotesLetter &letter = _alphabet[index]; + const TTquotesLetter &letter = _alphabet[index]; if (letter._entries.empty()) // No entries for the letter, so exit immediately return 0; - // TODO + int maxSize = size + 4; + bool letterFlag = index != 25; + + for (uint idx = 0; idx < letter._entries.size(); ++idx) { + const TTquotesEntry &entry = letter._entries[idx]; + if (entry._val2 > maxSize) + continue; + + const char *srcP = startP; + const char *destP = entry._strP; + int srcIndex = 0, destIndex = 0; + if (*destP) { + do { + if (!srcP[srcIndex]) { + break; + } else if (srcP[srcIndex] == '*') { + ++srcIndex; + } else if (destP[destIndex] == '-') { + ++destIndex; + if (srcP[srcIndex] == ' ') + ++srcIndex; + } else if (srcP[srcIndex] != destP[destIndex]) { + break; + } else { + ++destIndex; + ++srcIndex; + } + } while (destP[destIndex]); + + if (!destP[destIndex] && (srcP[srcIndex] <= '*' || + (srcP[srcIndex] == 's' && srcP[srcIndex + 1] <= '*'))) + return entry._val1; + } + } + return 0; } diff --git a/engines/titanic/true_talk/tt_quotes.h b/engines/titanic/true_talk/tt_quotes.h index 6649c1f744..f67216cf72 100644 --- a/engines/titanic/true_talk/tt_quotes.h +++ b/engines/titanic/true_talk/tt_quotes.h @@ -49,6 +49,10 @@ private: size_t _dataSize; int _field544; private: + /** + * Test whether a substring contains one of the quotes, + * and if so, returns the Id associated with it + */ int read(const char *startP, const char *endP); public: TTquotes(); @@ -59,6 +63,10 @@ public: */ void load(const CString &name); + /** + * Test whether a passed string contains one of the quotes, + * and if so, returns the Id associated with it + */ int read(const char *str); }; -- cgit v1.2.3 From ebb60288716bc4876183989d04d7bb2208b9fceb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 4 Jun 2016 15:32:45 -0400 Subject: TITANIC: gcc compilation fixes --- engines/titanic/core/list.h | 2 +- engines/titanic/game_view.h | 1 + engines/titanic/sound/sound_manager.h | 1 + engines/titanic/true_talk/tt_word.h | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/engines/titanic/core/list.h b/engines/titanic/core/list.h index 1905c0ffa8..4052a018c7 100644 --- a/engines/titanic/core/list.h +++ b/engines/titanic/core/list.h @@ -149,7 +149,7 @@ public: } bool contains(const T *item) const { - for (Common::List::const_iterator i = Common::List::begin(); + for (typename Common::List::const_iterator i = Common::List::begin(); i != Common::List::end(); ++i) { if (*i == item) return true; diff --git a/engines/titanic/game_view.h b/engines/titanic/game_view.h index 0bba5cfa86..74ab207d36 100644 --- a/engines/titanic/game_view.h +++ b/engines/titanic/game_view.h @@ -39,6 +39,7 @@ public: CVideoSurface *_surface; public: CGameView(); + virtual ~CGameView() {} /** * Set the game manager diff --git a/engines/titanic/sound/sound_manager.h b/engines/titanic/sound/sound_manager.h index e9fd1faf0a..75cf06e931 100644 --- a/engines/titanic/sound/sound_manager.h +++ b/engines/titanic/sound/sound_manager.h @@ -36,6 +36,7 @@ protected: int _field14; public: SoundManager(); + virtual ~SoundManager() {} /** * Loads a sound diff --git a/engines/titanic/true_talk/tt_word.h b/engines/titanic/true_talk/tt_word.h index 349e9e9910..428a3e3229 100644 --- a/engines/titanic/true_talk/tt_word.h +++ b/engines/titanic/true_talk/tt_word.h @@ -70,7 +70,7 @@ public: public: TTword(const TTstring &str, WordClass wordClass, int val2); TTword(const TTword *src); - ~TTword(); + virtual ~TTword(); /** * Delete any following words chained to the word -- cgit v1.2.3 From 66efdc239c88124296acdcb45427d83793934e91 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 4 Jun 2016 15:56:47 -0400 Subject: TITANIC: gcc compilation fixes --- engines/titanic/core/saveable_object.cpp | 22 +++++++++++----------- engines/titanic/core/view_item.cpp | 2 +- engines/titanic/pet_control/pet_slider.h | 1 + engines/titanic/pet_control/pet_text.cpp | 2 +- engines/titanic/support/font.cpp | 4 ++-- engines/titanic/support/string.cpp | 4 +--- engines/titanic/true_talk/tt_parser.cpp | 7 +++---- engines/titanic/true_talk/tt_quotes.cpp | 2 +- 8 files changed, 21 insertions(+), 23 deletions(-) diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 4b24f3e37e..f6c83b2e74 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -783,9 +783,9 @@ DEFFN(CDropObjectMsg) DEFFN(CDropZoneGotObjectMsg) DEFFN(CDropZoneLostObjectMsg) DEFFN(CEditControlMsg) -DEFFN(CEnterNodeMsg); -DEFFN(CEnterRoomMsg); -DEFFN(CEnterViewMsg); +DEFFN(CEnterNodeMsg) +DEFFN(CEnterRoomMsg) +DEFFN(CEnterViewMsg) DEFFN(CEjectCylinderMsg) DEFFN(CErasePhonographCylinderMsg) DEFFN(CFrameMsg) @@ -805,9 +805,9 @@ DEFFN(CIsEarBowlPuzzleDone) DEFFN(CIsHookedOnMsg) DEFFN(CIsParrotPresentMsg) DEFFN(CKeyCharMsg) -DEFFN(CLeaveNodeMsg); -DEFFN(CLeaveRoomMsg); -DEFFN(CLeaveViewMsg); +DEFFN(CLeaveNodeMsg) +DEFFN(CLeaveRoomMsg) +DEFFN(CLeaveViewMsg) DEFFN(CLemonFallsFromTreeMsg) DEFFN(CLightsMsg) DEFFN(CLoadSuccessMsg) @@ -868,9 +868,9 @@ DEFFN(CPhonographRecordMsg) DEFFN(CPhonographStopMsg) DEFFN(CPlayRangeMsg) DEFFN(CPlayerTriesRestaurantTableMsg) -DEFFN(CPreEnterNodeMsg); -DEFFN(CPreEnterRoomMsg); -DEFFN(CPreEnterViewMsg); +DEFFN(CPreEnterNodeMsg) +DEFFN(CPreEnterRoomMsg) +DEFFN(CPreEnterViewMsg) DEFFN(CPreSaveMsg) DEFFN(CProdMaitreDMsg) DEFFN(CPumpingMsg) @@ -900,7 +900,7 @@ DEFFN(CSetChevLiftBits) DEFFN(CSetChevPanelBitMsg) DEFFN(CSetChevPanelButtonsMsg) DEFFN(CSetChevRoomBits) -DEFFN(CSetFrameMsg); +DEFFN(CSetFrameMsg) DEFFN(CSetMusicControlsMsg) DEFFN(CSetVarMsg) DEFFN(CSetVolumeMsg) @@ -998,7 +998,7 @@ DEFFN(CMusicPlayer) DEFFN(CNodeAutoSoundPlayer) DEFFN(CRestrictedAutoMusicPlayer) DEFFN(CRoomAutoSoundPlayer) -DEFFN(CRoomTriggerAutoMusicPlayer); +DEFFN(CRoomTriggerAutoMusicPlayer) DEFFN(CSeasonNoises) DEFFN(CSeasonalMusicPlayer) DEFFN(CTitaniaSpeech) diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index 07c01423e0..8faf100238 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -38,7 +38,7 @@ BEGIN_MESSAGE_MAP(CViewItem, CNamedItem) END_MESSAGE_MAP() CViewItem::CViewItem() : CNamedItem() { - Common::fill(&_buttonUpTargets[0], &_buttonUpTargets[4], nullptr); + Common::fill(&_buttonUpTargets[0], &_buttonUpTargets[4], (CTreeItem *)nullptr); _field24 = 0; _field28 = 0.0; _viewNumber = 0; diff --git a/engines/titanic/pet_control/pet_slider.h b/engines/titanic/pet_control/pet_slider.h index 93390a5d59..0bc9e825cd 100644 --- a/engines/titanic/pet_control/pet_slider.h +++ b/engines/titanic/pet_control/pet_slider.h @@ -80,6 +80,7 @@ protected: bool containsPt(const Point &pt) const { return _bounds.contains(pt); } public: CPetSlider(); + virtual ~CPetSlider() {} /** * Setup the background diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index a8d9ba6eb5..f87b037109 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -404,7 +404,7 @@ bool CPetText::handleKey(char c) { return true; default: - if (c >= 32 && c <= 127) + if ((byte)c >= 32 && (byte)c <= 127) appendText(CString(c, 1)); break; } diff --git a/engines/titanic/support/font.cpp b/engines/titanic/support/font.cpp index c960e2fa9e..f4466def31 100644 --- a/engines/titanic/support/font.cpp +++ b/engines/titanic/support/font.cpp @@ -112,7 +112,7 @@ int STFont::stringWidth(const CString &text) const { const char *srcP = text.c_str(); int total = 0; char c; - while (c = *srcP++) { + while (c = (*srcP++)) { if (c == 26) { // Skip over command parameter bytes srcP += 3; @@ -265,7 +265,7 @@ void STFont::checkLineWrap(Point &textSize, int maxWidth, const char *&str) cons else if (*srcPtr == TEXTCMD_SET_COLOR) srcPtr += 4; else - totalWidth += _chars[*srcPtr]._width; + totalWidth += _chars[(byte)*srcPtr]._width; } if ((textSize.x + totalWidth) >= maxWidth && totalWidth < maxWidth) { diff --git a/engines/titanic/support/string.cpp b/engines/titanic/support/string.cpp index 86dc0be0b0..d85fcfc515 100644 --- a/engines/titanic/support/string.cpp +++ b/engines/titanic/support/string.cpp @@ -32,9 +32,7 @@ CString::CString(char c, uint32 len) : Common::String() { } CString::CString(int val) : Common::String() { - char buffer[16]; - itoa(val, buffer, 10); - *this += buffer; + *this = CString::format("%d", val); } CString CString::left(uint count) const { diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp index 3014ebaa07..1d9c199054 100644 --- a/engines/titanic/true_talk/tt_parser.cpp +++ b/engines/titanic/true_talk/tt_parser.cpp @@ -476,7 +476,6 @@ const NumberEntry *TTparser::replaceNumbers2(TTstring &line, int *startIndex) { } int TTparser::findFrames(TTsentence *sentence) { - static bool flag; _sentenceConcept = &sentence->_sentenceConcept; _sentence = sentence; @@ -1428,10 +1427,10 @@ int TTparser::checkForAction() { } // Handle any remaining words - TTword *reqWord = nullptr; while (_currentWordP) { - if (considerRequests(_currentWordP) > 1) { - reqWord = _currentWordP; + int result = considerRequests(_currentWordP); + if (result > 1) { + status = result; } else { // Delete the top of the word chain TTword *wordP = _currentWordP; diff --git a/engines/titanic/true_talk/tt_quotes.cpp b/engines/titanic/true_talk/tt_quotes.cpp index 856cba9421..7b98558d63 100644 --- a/engines/titanic/true_talk/tt_quotes.cpp +++ b/engines/titanic/true_talk/tt_quotes.cpp @@ -63,7 +63,7 @@ void TTquotes::load(const CString &name) { // Read in buffer and then decode it r->read((byte *)_dataP, _dataSize); for (size_t idx = 0; idx < _dataSize; idx += 4) - WRITE_LE_UINT32((byte *)_dataP + idx, READ_LE_UINT32((byte *)_dataP + idx) ^ 0xA55A5AA5); + WRITE_LE_UINT32((byte *)_dataP + idx, READ_LE_UINT32((const byte *)_dataP + idx) ^ 0xA55A5AA5); delete r; } -- cgit v1.2.3 From 02b3526e297e38984eeb99c98b5c020f3a57da9e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 4 Jun 2016 16:19:18 -0400 Subject: TITANIC: gcc compilation fixes --- engines/titanic/true_talk/tt_quotes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/titanic/true_talk/tt_quotes.h b/engines/titanic/true_talk/tt_quotes.h index f67216cf72..4e7d0d3eb6 100644 --- a/engines/titanic/true_talk/tt_quotes.h +++ b/engines/titanic/true_talk/tt_quotes.h @@ -45,7 +45,7 @@ class TTquotes { private: TTquotesLetter _alphabet[26]; uint _array[256]; - const char *_dataP; + char *_dataP; size_t _dataSize; int _field544; private: -- cgit v1.2.3 From 764cfcb6d6ccad3046c9d96788b3edd5857f1c79 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 4 Jun 2016 17:24:38 -0400 Subject: TITANIC: gcc compilation fixes --- devtools/create_titanic/create_titanic_dat.cpp | 46 +++++++++++++++++++++++++- engines/titanic/core/game_object.cpp | 2 ++ engines/titanic/pet_control/pet_control.cpp | 2 +- engines/titanic/support/font.cpp | 4 +-- engines/titanic/true_talk/tt_npc_script.h | 2 +- 5 files changed, 51 insertions(+), 5 deletions(-) diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index 4999ee3f7d..b8d3565368 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -50,7 +50,7 @@ */ #define VERSION_NUMBER 1 -#define HEADER_SIZE 0x340 +#define HEADER_SIZE 0x380 Common::File inputFile, outputFile; Common::PEResources res; @@ -309,6 +309,47 @@ void writeNumbers() { dataOffset += size; } +void writeResponseTree() { + const int FILE_DIFF = 0x401C00; + outputFile.seek(dataOffset); + + inputFile.seek(0x619500 - FILE_DIFF); + char buffer[32]; + inputFile.read(buffer, 32); + if (strcmp(buffer, "ReadInt(): No number to read")) { + printf("Could not find tree data at expected position\n"); + exit(1); + } + + for (int idx = 0; idx < 1022; ++idx) { + inputFile.seek(0x619520 - FILE_DIFF + idx * 8); + uint id = inputFile.readLong(); + uint offset = inputFile.readLong(); + + outputFile.writeLong(id); + if (!id) { + // An end of list id + } else if (offset >= 0x619520 && offset <= 0x61B510) { + // Offset to another table + outputFile.writeByte(0); + outputFile.writeLong((offset - 0x619520) / 8); + } else { + // Offset to ASCIIZ string + outputFile.writeByte(1); + inputFile.seek(offset - FILE_DIFF); + char c; + do { + c = inputFile.readByte(); + outputFile.writeByte(c); + } while (c); + } + } + + uint size = outputFile.size() - dataOffset; + writeEntryHeader("TEXT/TREE", dataOffset, size); + dataOffset += size; +} + void writeHeader() { // Write out magic string const char *MAGIC_STR = "SVTN"; @@ -337,6 +378,8 @@ void writeData() { writeResource("STFONT", 152); writeResource("STFONT", 153); + writeResource("STARFIELD", 132); + writeResource("TEXT", "STVOCAB.TXT"); writeResource("TEXT", "JRQUOTES.TXT"); writeResource("TEXT", 155); @@ -351,6 +394,7 @@ void writeData() { writeStringArray("TEXT/REPLACEMENTS2", 0x21C120, 1576); writeStringArray("TEXT/REPLACEMENTS3", 0x21D9C8, 82); writeStringArray("TEXT/PRONOUNS", 0x22F718, 15); + writeResponseTree(); writeNumbers(); writeAllScriptResponses(); diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index eaf1dfe9a8..624a4b0e67 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -237,6 +237,8 @@ void CGameObject::loadResource(const CString &name) { case FILETYPE_MOVIE: loadMovie(name); break; + default: + break; } } diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 85bac6a63e..51631a3e1b 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -495,7 +495,7 @@ void CPetControl::summonNPC(const CString &name, int val) { void CPetControl::startPetTimer(uint timerIndex, uint firstDuration, uint duration, void *target) { stopPetTimer(timerIndex); - _timers[timerIndex]._id = (timerIndex, firstDuration, duration); + _timers[timerIndex]._id = addTimer(timerIndex, firstDuration, duration); _timers[timerIndex]._target = target; setTimer44(_timers[timerIndex]._id, 0); } diff --git a/engines/titanic/support/font.cpp b/engines/titanic/support/font.cpp index f4466def31..07e4c28991 100644 --- a/engines/titanic/support/font.cpp +++ b/engines/titanic/support/font.cpp @@ -112,7 +112,7 @@ int STFont::stringWidth(const CString &text) const { const char *srcP = text.c_str(); int total = 0; char c; - while (c = (*srcP++)) { + while ((c = *srcP++)) { if (c == 26) { // Skip over command parameter bytes srcP += 3; @@ -120,7 +120,7 @@ int STFont::stringWidth(const CString &text) const { // Skip over command parameter bytes srcP += 4; } else if (c != '\n') { - total += _chars[c]._width; + total += _chars[(byte)c]._width; } } diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 15ff5303b7..7362d4db87 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -210,7 +210,7 @@ public: * Sets the value for an NPC's dial */ virtual void setDial(int dialNum, int value); - + /** * Returns a dial's region number */ -- cgit v1.2.3 From 6c4eff4dfcb883df81d415bb57377da7bf239cc1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 4 Jun 2016 23:27:14 -0400 Subject: TITANIC: Fix loading of JRQUOTES --- engines/titanic/pet_control/pet_inventory_glyphs.cpp | 4 +++- engines/titanic/true_talk/true_talk_manager.cpp | 2 +- engines/titanic/true_talk/tt_quotes.cpp | 6 +++--- engines/titanic/true_talk/tt_quotes.h | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/engines/titanic/pet_control/pet_inventory_glyphs.cpp b/engines/titanic/pet_control/pet_inventory_glyphs.cpp index 6ce130f22d..b793c1af13 100644 --- a/engines/titanic/pet_control/pet_inventory_glyphs.cpp +++ b/engines/titanic/pet_control/pet_inventory_glyphs.cpp @@ -111,8 +111,10 @@ int CPetInventoryGlyph::populateItem(CGameObject *item, int val) { break; default: - return ITEM_MODES[itemIndex]; + break; } + + return ITEM_MODES[itemIndex]; } int CPetInventoryGlyph::subMode(CGameObject *item, int val) { diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index a5a1edcc37..555d0e6a1b 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -49,7 +49,7 @@ CTrueTalkManager::CTrueTalkManager(CGameManager *owner) : _gameManager(owner), _scripts(&_titleEngine), _currentCharId(0), _dialogueFile(nullptr), _dialogueId(0) { _titleEngine.setup(3, 3); - _quotes.load("TEXT/JRQuotes.txt"); + _quotes.load("TEXT/JRQUOTES.TXT"); _currentNPC = nullptr; g_vm->_trueTalkManager = this; } diff --git a/engines/titanic/true_talk/tt_quotes.cpp b/engines/titanic/true_talk/tt_quotes.cpp index 7b98558d63..8e9978bbb9 100644 --- a/engines/titanic/true_talk/tt_quotes.cpp +++ b/engines/titanic/true_talk/tt_quotes.cpp @@ -27,7 +27,7 @@ namespace Titanic { TTquotes::TTquotes() { - Common::fill(&_array[0], &_array[256], 0); + Common::fill(&_tags[0], &_tags[256], 0); _dataP = nullptr; _dataSize = 0; _field544 = 0; @@ -38,14 +38,14 @@ TTquotes::~TTquotes() { } void TTquotes::load(const CString &name) { - Common::SeekableReadStream *r = g_vm->_filesManager->getResource("TEXT/JRQuotes.txt"); + Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); size_t size = r->readUint32LE(); _dataSize = _field544 = size; _dataP = new char[size + 0x10]; for (int idx = 0; idx < 256; ++idx) - _array[idx] = r->readUint32LE(); + _tags[idx] = r->readUint32LE(); for (int charIdx = 0; charIdx < 26; ++charIdx) { TTquotesLetter &letter = _alphabet[charIdx]; diff --git a/engines/titanic/true_talk/tt_quotes.h b/engines/titanic/true_talk/tt_quotes.h index 4e7d0d3eb6..db105265ee 100644 --- a/engines/titanic/true_talk/tt_quotes.h +++ b/engines/titanic/true_talk/tt_quotes.h @@ -44,7 +44,7 @@ class TTquotes { }; private: TTquotesLetter _alphabet[26]; - uint _array[256]; + uint _tags[256]; char *_dataP; size_t _dataSize; int _field544; -- cgit v1.2.3 From 253cf2f57457d430236a4d972a1d6295511c21fa Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 4 Jun 2016 23:39:52 -0400 Subject: TITANIC: Fix startup crash when creating NPC scripts --- engines/titanic/true_talk/tt_npc_script.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 337b367eb9..86494e8d3c 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -83,7 +83,7 @@ void TTnpcScript::load(const char *name, int valuesPerResponse) { } void TTnpcScript::resetFlags() { - Common::fill(&_array[20], &_array[140], 0); + Common::fill(&_array[20], &_array[136], 0); _field2CC = false; } -- cgit v1.2.3 From 51226842c8f63ffa65c397906ad7aed9dd3d9ca9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 5 Jun 2016 00:10:54 -0400 Subject: TITANIC: Start of new TTvocabTree class; added load method --- engines/titanic/module.mk | 1 + engines/titanic/true_talk/true_talk_manager.cpp | 4 +- engines/titanic/true_talk/true_talk_manager.h | 2 + engines/titanic/true_talk/tt_quotes.cpp | 7 ++- engines/titanic/true_talk/tt_quotes.h | 4 +- engines/titanic/true_talk/tt_quotes_tree.cpp | 62 +++++++++++++++++++++++++ engines/titanic/true_talk/tt_quotes_tree.h | 56 ++++++++++++++++++++++ 7 files changed, 129 insertions(+), 7 deletions(-) create mode 100644 engines/titanic/true_talk/tt_quotes_tree.cpp create mode 100644 engines/titanic/true_talk/tt_quotes_tree.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 2b604ec29d..2879713758 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -472,6 +472,7 @@ MODULE_OBJS := \ true_talk/tt_picture.o \ true_talk/tt_pronoun.o \ true_talk/tt_quotes.o \ + true_talk/tt_quotes_tree.o \ true_talk/tt_response.o \ true_talk/tt_room_script.o \ true_talk/tt_script_base.o \ diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 555d0e6a1b..91e6c9e36b 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -49,7 +49,9 @@ CTrueTalkManager::CTrueTalkManager(CGameManager *owner) : _gameManager(owner), _scripts(&_titleEngine), _currentCharId(0), _dialogueFile(nullptr), _dialogueId(0) { _titleEngine.setup(3, 3); - _quotes.load("TEXT/JRQUOTES.TXT"); + _quotes.load(); + _quotesTree.load(); + _currentNPC = nullptr; g_vm->_trueTalkManager = this; } diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index 754a9955ca..ad378af9fc 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -28,6 +28,7 @@ #include "titanic/true_talk/dialogue_file.h" #include "titanic/true_talk/title_engine.h" #include "titanic/true_talk/tt_quotes.h" +#include "titanic/true_talk/tt_quotes_tree.h" #include "titanic/true_talk/tt_scripts.h" #include "titanic/true_talk/tt_talker.h" @@ -131,6 +132,7 @@ public: static void setFlags(int index, int val); public: TTquotes _quotes; + TTquotesTree _quotesTree; public: /** * Get a specified state value from the currently set NPC diff --git a/engines/titanic/true_talk/tt_quotes.cpp b/engines/titanic/true_talk/tt_quotes.cpp index 8e9978bbb9..a2afa1a949 100644 --- a/engines/titanic/true_talk/tt_quotes.cpp +++ b/engines/titanic/true_talk/tt_quotes.cpp @@ -37,8 +37,8 @@ TTquotes::~TTquotes() { delete[] _dataP; } -void TTquotes::load(const CString &name) { - Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); +void TTquotes::load() { + Common::SeekableReadStream *r = g_vm->_filesManager->getResource("TEXT/JRQUOTES.TXT"); size_t size = r->readUint32LE(); _dataSize = _field544 = size; @@ -106,7 +106,6 @@ int TTquotes::read(const char *startP, const char *endP) { return 0; int maxSize = size + 4; - bool letterFlag = index != 25; for (uint idx = 0; idx < letter._entries.size(); ++idx) { const TTquotesEntry &entry = letter._entries[idx]; @@ -115,7 +114,7 @@ int TTquotes::read(const char *startP, const char *endP) { const char *srcP = startP; const char *destP = entry._strP; - int srcIndex = 0, destIndex = 0; + int srcIndex = index != 25 ? 1 : 0, destIndex = 0; if (*destP) { do { if (!srcP[srcIndex]) { diff --git a/engines/titanic/true_talk/tt_quotes.h b/engines/titanic/true_talk/tt_quotes.h index db105265ee..a90c70e9cc 100644 --- a/engines/titanic/true_talk/tt_quotes.h +++ b/engines/titanic/true_talk/tt_quotes.h @@ -59,9 +59,9 @@ public: ~TTquotes(); /** - * Load quotes from the specified resource + * Load quotes data resource */ - void load(const CString &name); + void load(); /** * Test whether a passed string contains one of the quotes, diff --git a/engines/titanic/true_talk/tt_quotes_tree.cpp b/engines/titanic/true_talk/tt_quotes_tree.cpp new file mode 100644 index 0000000000..0f10a10aa6 --- /dev/null +++ b/engines/titanic/true_talk/tt_quotes_tree.cpp @@ -0,0 +1,62 @@ +/* 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/algorithm.h" +#include "titanic/true_talk/tt_quotes_tree.h" +#include "titanic/titanic.h" + +namespace Titanic { + +/** + * Specifies the starting index for each of the three main trees + */ +static uint TABLE_INDEXES[3] = { 922, 1015, 1018 }; + +void TTquotesTree::load() { + Common::SeekableReadStream *r = g_vm->_filesManager->getResource("TEXT/TREE"); + + for (int idx = 0; idx < QUOTES_TREE_COUNT; ++idx) { + TTquotesTree::TTquotesTreeEntry &rec = _entries[idx]; + assert(r->pos() < r->size()); + + rec._id = r->readUint32LE(); + if (rec._id == 0) { + rec._type = ET_END; + } else { + byte type = r->readByte(); + if (type == 0) { + // Index to sub-table + rec._subTable = &_entries[0] + r->readUint32LE(); + } else { + // Read in string for entry + char c; + while ((c = r->readByte()) != '\0') + rec._string += c; + } + } + } + + assert(r->pos() == r->size()); + delete r; +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_quotes_tree.h b/engines/titanic/true_talk/tt_quotes_tree.h new file mode 100644 index 0000000000..9496fa8887 --- /dev/null +++ b/engines/titanic/true_talk/tt_quotes_tree.h @@ -0,0 +1,56 @@ +/* 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. + * + */ + +#ifndef TITANIC_TT_QUOTES_TREE_H +#define TITANIC_TT_QUOTES_TREE_H + +#include "common/scummsys.h" +#include "common/stream.h" +#include "titanic/support/string.h" + +namespace Titanic { + +#define QUOTES_TREE_COUNT 1022 + +enum TreeEntryType { ET_END = 0, ET_TABLE = 1, ET_STRING = 2 }; + +class TTquotesTree { + struct TTquotesTreeEntry { + uint _id; + TreeEntryType _type; + TTquotesTreeEntry *_subTable; + CString _string; + + TTquotesTreeEntry() : _id(0), _type(ET_END), _subTable(nullptr) {} + }; +private: + TTquotesTreeEntry _entries[QUOTES_TREE_COUNT]; +public: + /** + * Load data for the quotes tree + */ + void load(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_QUOTES_TREE_H */ -- cgit v1.2.3 From bfe075d314f8e9d7010d0f5e60d44bb314e53846 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 5 Jun 2016 14:27:31 -0400 Subject: TITANIC: Further fleshing out of TTquotes and TTquotesTree --- engines/titanic/true_talk/tt_quotes.cpp | 8 +-- engines/titanic/true_talk/tt_quotes.h | 8 +-- engines/titanic/true_talk/tt_quotes_tree.cpp | 74 +++++++++++++++++++++++++++- engines/titanic/true_talk/tt_quotes_tree.h | 23 +++++++-- 4 files changed, 101 insertions(+), 12 deletions(-) diff --git a/engines/titanic/true_talk/tt_quotes.cpp b/engines/titanic/true_talk/tt_quotes.cpp index a2afa1a949..1df3c0c01e 100644 --- a/engines/titanic/true_talk/tt_quotes.cpp +++ b/engines/titanic/true_talk/tt_quotes.cpp @@ -54,8 +54,8 @@ void TTquotes::load() { // Load the list of entries for the given letter letter._entries.resize(count); for (int idx = 0; idx < count; ++idx) { - letter._entries[idx]._val1 = r->readByte(); - letter._entries[idx]._val2 = r->readByte(); + letter._entries[idx]._tagIndex = r->readByte(); + letter._entries[idx]._maxSize = r->readByte(); letter._entries[idx]._strP = _dataP + r->readUint32LE(); } } @@ -109,7 +109,7 @@ int TTquotes::read(const char *startP, const char *endP) { for (uint idx = 0; idx < letter._entries.size(); ++idx) { const TTquotesEntry &entry = letter._entries[idx]; - if (entry._val2 > maxSize) + if (entry._maxSize > maxSize) continue; const char *srcP = startP; @@ -135,7 +135,7 @@ int TTquotes::read(const char *startP, const char *endP) { if (!destP[destIndex] && (srcP[srcIndex] <= '*' || (srcP[srcIndex] == 's' && srcP[srcIndex + 1] <= '*'))) - return entry._val1; + return _tags[entry._tagIndex]; } } diff --git a/engines/titanic/true_talk/tt_quotes.h b/engines/titanic/true_talk/tt_quotes.h index a90c70e9cc..1387a1d873 100644 --- a/engines/titanic/true_talk/tt_quotes.h +++ b/engines/titanic/true_talk/tt_quotes.h @@ -31,9 +31,9 @@ namespace Titanic { class TTquotes { struct TTquotesEntry { - byte _val1, _val2; + byte _tagIndex, _maxSize; const char *_strP; - TTquotesEntry() : _val1(0), _val2(0), _strP(nullptr) {} + TTquotesEntry() : _tagIndex(0), _maxSize(0), _strP(nullptr) {} }; struct TTquotesLetter { Common::Array _entries; @@ -51,7 +51,7 @@ private: private: /** * Test whether a substring contains one of the quotes, - * and if so, returns the Id associated with it + * and if so, returns the 4-character tag Id associated with it */ int read(const char *startP, const char *endP); public: @@ -65,7 +65,7 @@ public: /** * Test whether a passed string contains one of the quotes, - * and if so, returns the Id associated with it + * and if so, returns the 4-character tag Id associated with it */ int read(const char *str); }; diff --git a/engines/titanic/true_talk/tt_quotes_tree.cpp b/engines/titanic/true_talk/tt_quotes_tree.cpp index 0f10a10aa6..6eee91227a 100644 --- a/engines/titanic/true_talk/tt_quotes_tree.cpp +++ b/engines/titanic/true_talk/tt_quotes_tree.cpp @@ -40,7 +40,7 @@ void TTquotesTree::load() { rec._id = r->readUint32LE(); if (rec._id == 0) { - rec._type = ET_END; + // Nothing needed } else { byte type = r->readByte(); if (type == 0) { @@ -59,4 +59,76 @@ void TTquotesTree::load() { delete r; } +void TTquotesTree::search(const char **str, TTquotesTreeEntry *bTree, + TTtreeBuffer *buffer, int quoteId) { + buffer->_strP = nullptr; + (buffer + 1)->_strP = nullptr; + + bool flag = false; + for (uint mode = bTree->_id >> 24; mode != 0; + ++bTree, mode = bTree->_id >> 24) { + + switch (mode) { + case 1: + if (compareWord(str, bTree->_string.c_str())) + flag = true; + break; + + case 2: + compareWord(str, bTree->_string.c_str()); + break; + + case 5: + warning("TODO: TTquotesTree::search"); + break; + + case 7: + + default: + break; + } + + if (flag) { + // TODO + break; + } + } + +} + +bool TTquotesTree::compareWord(const char **str, const char *refStr) { + // Skip over any spaces + const char *strP = *str; + while (*strP && *strP == ' ') + ++strP; + *str = strP; + + // Compare against the reference string + while (*strP && *refStr && *refStr != '*') { + if (*refStr == '-') { + if (*strP == ' ') + ++strP; + } else if (*strP == *refStr) { + ++strP; + } else { + return false; + } + } + + if (*refStr && *refStr != '*') + return false; + if (!*refStr && *strP && *strP != ' ') + return false; + + if (*refStr == '*') { + // Skip over to the end of the word + while (*strP && *strP != ' ') + ++strP; + } + + // Pass out the new updated string position + *str = strP; + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_quotes_tree.h b/engines/titanic/true_talk/tt_quotes_tree.h index 9496fa8887..fb7d262879 100644 --- a/engines/titanic/true_talk/tt_quotes_tree.h +++ b/engines/titanic/true_talk/tt_quotes_tree.h @@ -31,24 +31,41 @@ namespace Titanic { #define QUOTES_TREE_COUNT 1022 -enum TreeEntryType { ET_END = 0, ET_TABLE = 1, ET_STRING = 2 }; +class TTtreeBuffer { +public: + int _field0; + const char *_strP; +public: + TTtreeBuffer() : _field0(0), _strP(nullptr) {} +}; class TTquotesTree { struct TTquotesTreeEntry { uint _id; - TreeEntryType _type; TTquotesTreeEntry *_subTable; CString _string; - TTquotesTreeEntry() : _id(0), _type(ET_END), _subTable(nullptr) {} + TTquotesTreeEntry() : _id(0), _subTable(nullptr) {} }; private: TTquotesTreeEntry _entries[QUOTES_TREE_COUNT]; +private: + /** + * Inner search method + */ + void search(const char **str, TTquotesTreeEntry *bTree, TTtreeBuffer *buffer, + int quoteId); + + /** + * Compare the current word in the string against a specified word + */ + bool compareWord(const char **str, const char *refStr); public: /** * Load data for the quotes tree */ void load(); + }; } // End of namespace Titanic -- cgit v1.2.3 From 289856dce3868de36c985f1df94ce3d1f3bff99b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 5 Jun 2016 18:44:56 -0400 Subject: TITANIC: Finished TTquotesTree search methods --- engines/titanic/true_talk/tt_quotes.cpp | 11 ++-- engines/titanic/true_talk/tt_quotes.h | 4 +- engines/titanic/true_talk/tt_quotes_tree.cpp | 94 +++++++++++++++++++++++++--- engines/titanic/true_talk/tt_quotes_tree.h | 39 +++++++----- 4 files changed, 120 insertions(+), 28 deletions(-) diff --git a/engines/titanic/true_talk/tt_quotes.cpp b/engines/titanic/true_talk/tt_quotes.cpp index 1df3c0c01e..825210ae06 100644 --- a/engines/titanic/true_talk/tt_quotes.cpp +++ b/engines/titanic/true_talk/tt_quotes.cpp @@ -68,7 +68,7 @@ void TTquotes::load() { delete r; } -int TTquotes::read(const char *str) { +int TTquotes::find(const char *str) { if (!str || !*str) return 0; @@ -78,9 +78,9 @@ int TTquotes::read(const char *str) { ++endP; do { - int result = read(startP, endP); - if (result) - return result; + int tagId = find(startP, endP); + if (tagId) + return tagId; // Move to next following space or end of string while (*startP && *startP != ' ') @@ -91,10 +91,11 @@ int TTquotes::read(const char *str) { } while (*startP); + // No match return 0; } -int TTquotes::read(const char *startP, const char *endP) { +int TTquotes::find(const char *startP, const char *endP) { int size = endP - startP; if (size < 3) return 0; diff --git a/engines/titanic/true_talk/tt_quotes.h b/engines/titanic/true_talk/tt_quotes.h index 1387a1d873..c6627dcc34 100644 --- a/engines/titanic/true_talk/tt_quotes.h +++ b/engines/titanic/true_talk/tt_quotes.h @@ -53,7 +53,7 @@ private: * Test whether a substring contains one of the quotes, * and if so, returns the 4-character tag Id associated with it */ - int read(const char *startP, const char *endP); + int find(const char *startP, const char *endP); public: TTquotes(); ~TTquotes(); @@ -67,7 +67,7 @@ public: * Test whether a passed string contains one of the quotes, * and if so, returns the 4-character tag Id associated with it */ - int read(const char *str); + int find(const char *str); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_quotes_tree.cpp b/engines/titanic/true_talk/tt_quotes_tree.cpp index 6eee91227a..8641ab9a1d 100644 --- a/engines/titanic/true_talk/tt_quotes_tree.cpp +++ b/engines/titanic/true_talk/tt_quotes_tree.cpp @@ -35,7 +35,7 @@ void TTquotesTree::load() { Common::SeekableReadStream *r = g_vm->_filesManager->getResource("TEXT/TREE"); for (int idx = 0; idx < QUOTES_TREE_COUNT; ++idx) { - TTquotesTree::TTquotesTreeEntry &rec = _entries[idx]; + TTquotesTreeEntry &rec = _entries[idx]; assert(r->pos() < r->size()); rec._id = r->readUint32LE(); @@ -59,12 +59,30 @@ void TTquotesTree::load() { delete r; } -void TTquotesTree::search(const char **str, TTquotesTreeEntry *bTree, - TTtreeBuffer *buffer, int quoteId) { - buffer->_strP = nullptr; - (buffer + 1)->_strP = nullptr; +int TTquotesTree::search(const char *str, QuoteTreeNum treeNum, + TTtreeResult *buffer, uint tagId, int *remainder) { + const TTquotesTreeEntry *bTree = &_entries[TABLE_INDEXES[treeNum]]; + if (!search1(&str, bTree, buffer, tagId) || !buffer->_treeItemP) + return -1; + + if (remainder) { + while (*str) { + if (*str >= 'a' && *str != 's') + *remainder += *str; + } + } + + return buffer->_treeItemP->_id & 0xffffff; +} + +bool TTquotesTree::search1(const char **str, const TTquotesTreeEntry *bTree, + TTtreeResult *buffer, uint tagId) { + buffer->_treeItemP = nullptr; + (buffer + 1)->_treeItemP = nullptr; + const char *strP = *str; bool flag = false; + for (uint mode = bTree->_id >> 24; mode != 0; ++bTree, mode = bTree->_id >> 24) { @@ -79,21 +97,83 @@ void TTquotesTree::search(const char **str, TTquotesTreeEntry *bTree, break; case 5: - warning("TODO: TTquotesTree::search"); + if (READ_LE_UINT32(bTree->_string.c_str()) == tagId) + flag = true; break; case 7: + if (search1(str, bTree->_subTable, buffer + 1, tagId)) + flag = true; + break; + + case 8: + if (search2(str, bTree->_subTable, buffer + 1, tagId)) + flag = true; + break; default: break; } if (flag) { - // TODO + buffer->_treeItemP = bTree; + return true; + } + } + + *str = strP; + return false; +} + +bool TTquotesTree::search2(const char **str, const TTquotesTreeEntry *bTree, + TTtreeResult *buffer, uint tagId) { + buffer->_treeItemP = bTree; + (buffer + 1)->_treeItemP = nullptr; + + const char *strP = *str; + bool flag = false; + for (uint mode = bTree->_id >> 24; mode != 0; + ++bTree, mode = bTree->_id >> 24) { + switch (mode) { + case 0: + return true; + + case 1: + if (compareWord(str, bTree->_string.c_str())) + flag = true; + break; + + case 2: + compareWord(str, bTree->_string.c_str()); + break; + + case 5: + if (READ_LE_UINT32(bTree->_string.c_str()) == tagId) + flag = true; + break; + + case 7: + if (search1(str, bTree->_subTable, buffer + 1, tagId)) + flag = true; break; + + case 8: + if (search2(str, bTree->_subTable, buffer + 1, tagId)) + flag = true; + break; + + default: + break; + } + + if (flag) { + buffer->_treeItemP = nullptr; + *str = strP; + return false; } } + return true; } bool TTquotesTree::compareWord(const char **str, const char *refStr) { diff --git a/engines/titanic/true_talk/tt_quotes_tree.h b/engines/titanic/true_talk/tt_quotes_tree.h index fb7d262879..fa0e9edf2a 100644 --- a/engines/titanic/true_talk/tt_quotes_tree.h +++ b/engines/titanic/true_talk/tt_quotes_tree.h @@ -31,30 +31,39 @@ namespace Titanic { #define QUOTES_TREE_COUNT 1022 -class TTtreeBuffer { +enum QuoteTreeNum { TREE_1 = 0, TREE_2 = 1, TREE_3 = 2 }; + +struct TTquotesTreeEntry { + uint _id; + TTquotesTreeEntry *_subTable; + CString _string; + + TTquotesTreeEntry() : _id(0), _subTable(nullptr) {} +}; + +class TTtreeResult { public: - int _field0; - const char *_strP; + int _id; + const TTquotesTreeEntry *_treeItemP; public: - TTtreeBuffer() : _field0(0), _strP(nullptr) {} + TTtreeResult() : _id(0), _treeItemP(nullptr) {} }; class TTquotesTree { - struct TTquotesTreeEntry { - uint _id; - TTquotesTreeEntry *_subTable; - CString _string; - - TTquotesTreeEntry() : _id(0), _subTable(nullptr) {} - }; private: TTquotesTreeEntry _entries[QUOTES_TREE_COUNT]; private: /** - * Inner search method + * First inner search method + */ + bool search1(const char **str, const TTquotesTreeEntry *bTree, + TTtreeResult *buffer, uint tagId); + + /** + * Second inner search method */ - void search(const char **str, TTquotesTreeEntry *bTree, TTtreeBuffer *buffer, - int quoteId); + bool search2(const char **str, const TTquotesTreeEntry *bTree, + TTtreeResult *buffer, uint tagId); /** * Compare the current word in the string against a specified word @@ -66,6 +75,8 @@ public: */ void load(); + int search(const char *str, QuoteTreeNum treeNum, + TTtreeResult *buffer, uint tagId, int *remainder); }; } // End of namespace Titanic -- cgit v1.2.3 From 9d92a5a6a468889e39b1b8d4f696fde3769da79c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 5 Jun 2016 21:51:53 -0400 Subject: TITANIC: Fleshing out usage of TTscriptArrayItem in TTnpcScript --- engines/titanic/true_talk/deskbot_script.cpp | 3 +- engines/titanic/true_talk/deskbot_script.h | 3 +- engines/titanic/true_talk/doorbot_script.cpp | 3 +- engines/titanic/true_talk/doorbot_script.h | 3 +- engines/titanic/true_talk/liftbot_script.cpp | 3 +- engines/titanic/true_talk/liftbot_script.h | 4 +- engines/titanic/true_talk/maitred_script.cpp | 3 +- engines/titanic/true_talk/maitred_script.h | 4 +- engines/titanic/true_talk/tt_npc_script.cpp | 85 +++++++++++++++++++++++----- engines/titanic/true_talk/tt_npc_script.h | 33 ++++++++++- engines/titanic/true_talk/tt_quotes_tree.cpp | 2 +- engines/titanic/true_talk/tt_quotes_tree.h | 2 +- 12 files changed, 120 insertions(+), 28 deletions(-) diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index ce643f5f38..6edaa142be 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -57,7 +57,8 @@ int DeskbotScript::proc15() const { return 0; } -bool DeskbotScript::proc16() const { +bool DeskbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, + int val, uint tagId, uint remainder) const { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index a5fb11e92e..f7a46c99e3 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -36,7 +36,8 @@ public: virtual void proc7(int v1, int v2); virtual int proc10() const; virtual int proc15() const; - virtual bool proc16() const; + virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, + int val, uint tagId, uint remainder) const; virtual bool proc17() const; virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 2b248ac601..e65d744605 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -108,7 +108,8 @@ int DoorbotScript::proc15() const { return 0; } -bool DoorbotScript::proc16() const { +bool DoorbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, + int val, uint tagId, uint remainder) const { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 72e24db104..42fcb19fa4 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -48,7 +48,8 @@ public: virtual void proc7(int v1, int v2); virtual int proc10() const; virtual int proc15() const; - virtual bool proc16() const; + virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, + int val, uint tagId, uint remainder) const; virtual bool proc17() const; virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index 3a64733f2f..63900709dd 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -84,7 +84,8 @@ int LiftbotScript::proc15() const { return 0; } -bool LiftbotScript::proc16() const { +bool LiftbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, + int val, uint tagId, uint remainder) const { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index 9e2a9ff3f8..b3ab5295d7 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -43,7 +43,9 @@ public: virtual int proc9() const; virtual int proc10() const; virtual int proc15() const; - virtual bool proc16() const; + virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, + int val, uint tagId, uint remainder) const; + virtual bool proc17() const; virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index c417940eb7..b13e059d81 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -62,7 +62,8 @@ int MaitreDScript::proc10() const { return 0; } -bool MaitreDScript::proc16() const { +bool MaitreDScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, + int val, uint tagId, uint remainder) const { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index 389e3887ab..05c16ecde5 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -39,7 +39,9 @@ public: virtual void proc7(int v1, int v2); virtual int proc10() const; - virtual bool proc16() const; + virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, + int val, uint tagId, uint remainder) const; + virtual bool proc17() const; virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 86494e8d3c..40e95e5d97 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -40,6 +40,17 @@ int TTnpcScriptResponse::size() const { /*------------------------------------------------------------------------*/ +TTscriptArrayItem::TTscriptArrayItem(uint id, const uint *arrayP, bool flag1, bool flag2) : + _id(id), _arrayP(arrayP), _nextP(nullptr) { + _flags = 0; + if (flag1) + _flags |= SF_1; + if (flag2) + _flags |= SF_2; +} + +/*------------------------------------------------------------------------*/ + TTnpcScriptBase::TTnpcScriptBase(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTscriptBase(0, charClass, v2, charName, v3, v4, v5, v6, v7), @@ -51,9 +62,8 @@ TTnpcScriptBase::TTnpcScriptBase(int charId, const char *charClass, int v2, TTnpcScript::TTnpcScript(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScriptBase(charId, charClass, v2, charName, v3, val2, v4, v5, v6, v7), - _subPtr(nullptr), _entriesP(nullptr), _entryCount(0), _field68(0), - _field6C(0), _field70(0), _field74(0), _field78(0), - _field7C(0), _field80(0), _field2CC(false) { + _entriesP(nullptr), _entryCount(0), _field68(0), _field6C(0), _field70(0), + _field74(0), _field78(0), _field7C(0), _field80(0), _field2CC(false) { CTrueTalkManager::_v2 = 0; Common::fill(&_dialValues[0], &_dialValues[DIALS_ARRAY_COUNT], 0); Common::fill(&_array[0], &_array[136], 0); @@ -136,7 +146,6 @@ int TTnpcScript::proc12() const { return 1; } - bool TTnpcScript::loadQuotes() { // Original did a load of a global quotes here the first time // this method is called. ScummVM implementation has refactored @@ -160,7 +169,8 @@ int TTnpcScript::proc15() const { return 0; } -bool TTnpcScript::proc16() const { +bool TTnpcScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, + int val, uint tagId, uint remainder) const { return true; } @@ -240,8 +250,14 @@ void TTnpcScript::saveBody(SimpleFile *file) { int v = proc31(); file->writeNumber(v); - if (v > 0 && _subPtr) { - warning("TODO"); + if (v > 0) { + for (uint idx = 0; idx < _arrayItems.size(); ++idx) { + const TTscriptArrayItem &item = _arrayItems[idx]; + if (item._flags == SF_1 && item._val) { + file->writeNumber(item._id); + file->writeNumber(item._val); + } + } } } @@ -252,15 +268,25 @@ void TTnpcScript::loadBody(SimpleFile *file) { for (int index = 0; index < count; index += 2) { int v = file->readNumber(); - if (_subPtr) { - error("TODO - %d", v); + for (uint idx = 0; idx < _arrayItems.size(); ++idx) { + TTscriptArrayItem &item = _arrayItems[idx]; + if (!item._id) { + item._id = v; + break; + } } } } -int TTnpcScript::proc31() { - warning("TODO"); - return 0; +int TTnpcScript::proc31() const { + int count = 0; + for (uint idx = 0; idx < _arrayItems.size(); ++idx) { + const TTscriptArrayItem &item = _arrayItems[idx]; + if (item._flags != SF_1 && item._val) + ++count; + } + + return count * 2; } void TTnpcScript::setDialRegion(int dialNum, int region) { @@ -325,9 +351,8 @@ uint TTnpcScript::translateId(uint id) const { } void TTnpcScript::preLoad() { - if (_subPtr) { - error("TODO"); - } + for (uint idx = 0; idx < _arrayItems.size(); ++idx) + _arrayItems[idx]._val = 0; } int TTnpcScript::getRoom54(int roomId) { @@ -535,4 +560,34 @@ int TTnpcScript::processSentence(const TTsentenceEntries *entries, uint entryCou return 1; } +bool TTnpcScript::defaultProcess(TTroomScript *roomScript, TTsentence *sentence) { + uint remainder; + TTtreeResult results[32]; + const TTstring &line = sentence->_normalizedLine; + + uint tagId = g_vm->_trueTalkManager->_quotes.find(line.c_str()); + int val = g_vm->_trueTalkManager->_quotesTree.search(line.c_str(), TREE_1, results, tagId, &remainder); + + if (val > 0) { + if (!handleQuote(roomScript, sentence, val, tagId, remainder)) + return true; + } + + // TODO + return false; +} + +void TTnpcScript::addArrayItem(uint id, const uint *arrayP, bool flag1, bool flag2) { + _arrayItems.push_back(TTscriptArrayItem(id, arrayP, flag1, flag2)); +} + +TTscriptArrayItem *TTnpcScript::findArrayItem(uint id) { + for (uint idx = 0; idx < _arrayItems.size(); ++idx) { + if (_arrayItems[idx]._id == id) + return &_arrayItems[idx]; + } + + return nullptr; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 7362d4db87..2dd721e61a 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -30,6 +30,8 @@ namespace Titanic { #define DIALS_ARRAY_COUNT 10 +enum ScriptArrayFlag { SF_1 = 1, SF_2 = 2 }; + class CGameManager; class CPetControl; class TTroomScript; @@ -47,6 +49,18 @@ struct TTnpcScriptResponse { int size() const; }; +struct TTscriptArrayItem { + uint _id; + const uint *_arrayP; + TTscriptArrayItem *_nextP; + uint _val; + int _flags; + + TTscriptArrayItem() : _id(0), _arrayP(nullptr), _nextP(nullptr), + _val(0), _flags(0) {} + TTscriptArrayItem(uint id, const uint *arrayP, bool flag1, bool flag2); +}; + class TTnpcScriptBase : public TTscriptBase { protected: int _field54; @@ -84,7 +98,7 @@ private: protected: Common::Array _responses; int _valuesPerResponse; - byte *_subPtr; + Common::Array _arrayItems; const TTsentenceEntries *_entriesP; int _entryCount; int _field68; @@ -139,7 +153,19 @@ protected: */ static CPetControl *getPetControl(CGameManager *gameManager); + /** + * Adds a new item to the entries list + */ + void addArrayItem(uint id, const uint *arrayP, bool flag1, bool flag2); + + /** + * Finds an array item by Id + */ + TTscriptArrayItem *findArrayItem(uint id); + int processSentence(const TTsentenceEntries *entries, uint entryCount, TTroomScript *roomScript, TTsentence *sentence); + + bool defaultProcess(TTroomScript *roomScript, TTsentence *sentence); public: TTnpcScript(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, @@ -184,7 +210,8 @@ public: virtual void selectResponse(int id); virtual int proc15() const; - virtual bool proc16() const; + virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, + int val, uint tagId, uint remainder) const; virtual bool proc17() const; virtual bool proc18() const; virtual uint proc19(uint v); @@ -199,7 +226,7 @@ public: virtual void load(SimpleFile *file); virtual void saveBody(SimpleFile *file); virtual void loadBody(SimpleFile *file); - virtual int proc31(); + virtual int proc31() const; /** * Sets a given dial to be pointing in a specified region (0 to 2) diff --git a/engines/titanic/true_talk/tt_quotes_tree.cpp b/engines/titanic/true_talk/tt_quotes_tree.cpp index 8641ab9a1d..1f073b83f2 100644 --- a/engines/titanic/true_talk/tt_quotes_tree.cpp +++ b/engines/titanic/true_talk/tt_quotes_tree.cpp @@ -60,7 +60,7 @@ void TTquotesTree::load() { } int TTquotesTree::search(const char *str, QuoteTreeNum treeNum, - TTtreeResult *buffer, uint tagId, int *remainder) { + TTtreeResult *buffer, uint tagId, uint *remainder) { const TTquotesTreeEntry *bTree = &_entries[TABLE_INDEXES[treeNum]]; if (!search1(&str, bTree, buffer, tagId) || !buffer->_treeItemP) return -1; diff --git a/engines/titanic/true_talk/tt_quotes_tree.h b/engines/titanic/true_talk/tt_quotes_tree.h index fa0e9edf2a..d7ca798ae8 100644 --- a/engines/titanic/true_talk/tt_quotes_tree.h +++ b/engines/titanic/true_talk/tt_quotes_tree.h @@ -76,7 +76,7 @@ public: void load(); int search(const char *str, QuoteTreeNum treeNum, - TTtreeResult *buffer, uint tagId, int *remainder); + TTtreeResult *buffer, uint tagId, uint *remainder); }; } // End of namespace Titanic -- cgit v1.2.3 From a05173568253455ba05763865f5e8869bd36d7f0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 5 Jun 2016 23:04:10 -0400 Subject: TITANIC: Added TTnpcScript getRangeValue --- engines/titanic/true_talk/tt_npc_script.cpp | 102 +++++++++++++++++++--------- engines/titanic/true_talk/tt_npc_script.h | 40 ++++++----- 2 files changed, 95 insertions(+), 47 deletions(-) diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 40e95e5d97..c3f0509635 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -40,13 +40,14 @@ int TTnpcScriptResponse::size() const { /*------------------------------------------------------------------------*/ -TTscriptArrayItem::TTscriptArrayItem(uint id, const uint *arrayP, bool flag1, bool flag2) : +TTscriptRange::TTscriptRange(uint id, const uint *arrayP, bool isRandom, + bool isSequential) : _id(id), _arrayP(arrayP), _nextP(nullptr) { - _flags = 0; - if (flag1) - _flags |= SF_1; - if (flag2) - _flags |= SF_2; + _mode = SF_NONE; + if (isRandom) + _mode = SF_RANDOM; + if (isSequential) + _mode = SF_SEQUENTIAL; } /*------------------------------------------------------------------------*/ @@ -62,7 +63,7 @@ TTnpcScriptBase::TTnpcScriptBase(int charId, const char *charClass, int v2, TTnpcScript::TTnpcScript(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScriptBase(charId, charClass, v2, charName, v3, val2, v4, v5, v6, v7), - _entriesP(nullptr), _entryCount(0), _field68(0), _field6C(0), _field70(0), + _entriesP(nullptr), _entryCount(0), _field68(0), _field6C(0), _rangeResetCtr(0), _field74(0), _field78(0), _field7C(0), _field80(0), _field2CC(false) { CTrueTalkManager::_v2 = 0; Common::fill(&_dialValues[0], &_dialValues[DIALS_ARRAY_COUNT], 0); @@ -182,9 +183,48 @@ bool TTnpcScript::proc18() const { return true; } -uint TTnpcScript::proc19(uint v) { - warning("TODO"); - return 0; +uint TTnpcScript::getRangeValue(uint id) { + TTscriptRange *range = findRange(id); + if (!range) + return 0; + + switch (range->_mode) { + case SF_RANDOM: { + uint count = 0; + for (const uint *p = range->_arrayP; *p; ++p) + ++count; + + uint index = getRandomNumber(count) - 1; + if (count > 1 && range->_arrayP[index] == range->_priorIndex) { + for (int retry = 0; retry < 8 && index != range->_priorIndex; ++retry) + index = getRandomNumber(count) - 1; + } + + range->_priorIndex = index; + return range->_arrayP[index]; + } + + case SF_SEQUENTIAL: { + // Get the next value from the array sequentially + int val = range->_arrayP[range->_priorIndex]; + if (!val) { + // Reached end of array, so reset back to start + range->_priorIndex = 1; + val = range->_arrayP[1]; + } + + ++range->_priorIndex; + return val; + } + + default: + if (range->_arrayP[range->_priorIndex]) + return range->_arrayP[range->_priorIndex++]; + + range->_priorIndex = 1; + ++_rangeResetCtr; + return range->_arrayP[0]; + } } void TTnpcScript::proc20(int v) { @@ -216,7 +256,7 @@ void TTnpcScript::save(SimpleFile *file) { saveBody(file); file->writeNumber(4); - file->writeNumber(_field70); + file->writeNumber(_rangeResetCtr); file->writeNumber(_field74); file->writeNumber(_field78); file->writeNumber(_field7C); @@ -230,7 +270,7 @@ void TTnpcScript::load(SimpleFile *file) { loadBody(file); int count = file->readNumber(); - _field70 = file->readNumber(); + _rangeResetCtr = file->readNumber(); _field74 = file->readNumber(); _field78 = file->readNumber(); _field7C = file->readNumber(); @@ -251,11 +291,11 @@ void TTnpcScript::saveBody(SimpleFile *file) { file->writeNumber(v); if (v > 0) { - for (uint idx = 0; idx < _arrayItems.size(); ++idx) { - const TTscriptArrayItem &item = _arrayItems[idx]; - if (item._flags == SF_1 && item._val) { + for (uint idx = 0; idx < _ranges.size(); ++idx) { + const TTscriptRange &item = _ranges[idx]; + if (item._mode == SF_RANDOM && item._priorIndex) { file->writeNumber(item._id); - file->writeNumber(item._val); + file->writeNumber(item._priorIndex); } } } @@ -268,8 +308,8 @@ void TTnpcScript::loadBody(SimpleFile *file) { for (int index = 0; index < count; index += 2) { int v = file->readNumber(); - for (uint idx = 0; idx < _arrayItems.size(); ++idx) { - TTscriptArrayItem &item = _arrayItems[idx]; + for (uint idx = 0; idx < _ranges.size(); ++idx) { + TTscriptRange &item = _ranges[idx]; if (!item._id) { item._id = v; break; @@ -280,9 +320,9 @@ void TTnpcScript::loadBody(SimpleFile *file) { int TTnpcScript::proc31() const { int count = 0; - for (uint idx = 0; idx < _arrayItems.size(); ++idx) { - const TTscriptArrayItem &item = _arrayItems[idx]; - if (item._flags != SF_1 && item._val) + for (uint idx = 0; idx < _ranges.size(); ++idx) { + const TTscriptRange &item = _ranges[idx]; + if (item._mode != SF_RANDOM && item._priorIndex) ++count; } @@ -351,8 +391,8 @@ uint TTnpcScript::translateId(uint id) const { } void TTnpcScript::preLoad() { - for (uint idx = 0; idx < _arrayItems.size(); ++idx) - _arrayItems[idx]._val = 0; + for (uint idx = 0; idx < _ranges.size(); ++idx) + _ranges[idx]._priorIndex = 0; } int TTnpcScript::getRoom54(int roomId) { @@ -434,9 +474,9 @@ uint TTnpcScript::getDialogueId(uint tagId) { } uint oldTagId = tagId; - tagId = proc19(tagId); + tagId = getRangeValue(tagId); if (tagId != oldTagId) - tagId = proc19(tagId); + tagId = getRangeValue(tagId); oldTagId = proc23(); int v21 = proc21(origId, tagId, oldTagId); @@ -577,14 +617,14 @@ bool TTnpcScript::defaultProcess(TTroomScript *roomScript, TTsentence *sentence) return false; } -void TTnpcScript::addArrayItem(uint id, const uint *arrayP, bool flag1, bool flag2) { - _arrayItems.push_back(TTscriptArrayItem(id, arrayP, flag1, flag2)); +void TTnpcScript::addRange(uint id, const uint *arrayP, bool isRandom, bool isSequential) { + _ranges.push_back(TTscriptRange(id, arrayP, isRandom, isSequential)); } -TTscriptArrayItem *TTnpcScript::findArrayItem(uint id) { - for (uint idx = 0; idx < _arrayItems.size(); ++idx) { - if (_arrayItems[idx]._id == id) - return &_arrayItems[idx]; +TTscriptRange *TTnpcScript::findRange(uint id) { + for (uint idx = 0; idx < _ranges.size(); ++idx) { + if (_ranges[idx]._id == id) + return &_ranges[idx]; } return nullptr; diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 2dd721e61a..1c7446aabc 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -30,7 +30,7 @@ namespace Titanic { #define DIALS_ARRAY_COUNT 10 -enum ScriptArrayFlag { SF_1 = 1, SF_2 = 2 }; +enum ScriptArrayFlag { SF_NONE = 0, SF_RANDOM = 1, SF_SEQUENTIAL = 2 }; class CGameManager; class CPetControl; @@ -49,16 +49,17 @@ struct TTnpcScriptResponse { int size() const; }; -struct TTscriptArrayItem { +struct TTscriptRange { uint _id; const uint *_arrayP; - TTscriptArrayItem *_nextP; - uint _val; - int _flags; - - TTscriptArrayItem() : _id(0), _arrayP(nullptr), _nextP(nullptr), - _val(0), _flags(0) {} - TTscriptArrayItem(uint id, const uint *arrayP, bool flag1, bool flag2); + TTscriptRange *_nextP; + uint _priorIndex; + ScriptArrayFlag _mode; + + TTscriptRange() : _id(0), _arrayP(nullptr), _nextP(nullptr), + _priorIndex(0), _mode(SF_NONE) {} + TTscriptRange(uint id, const uint *arrayP, bool isRandom, + bool isSequential); }; class TTnpcScriptBase : public TTscriptBase { @@ -98,12 +99,12 @@ private: protected: Common::Array _responses; int _valuesPerResponse; - Common::Array _arrayItems; + Common::Array _ranges; const TTsentenceEntries *_entriesP; int _entryCount; int _field68; int _field6C; - int _field70; + int _rangeResetCtr; int _field74; int _field78; int _field7C; @@ -154,14 +155,14 @@ protected: static CPetControl *getPetControl(CGameManager *gameManager); /** - * Adds a new item to the entries list + * Adds a new item to the list of number ranges */ - void addArrayItem(uint id, const uint *arrayP, bool flag1, bool flag2); + void addRange(uint id, const uint *arrayP, bool isRandom, bool isSequential); /** - * Finds an array item by Id + * Finds an entry in the list of prevoiusly registered number ranges */ - TTscriptArrayItem *findArrayItem(uint id); + TTscriptRange *findRange(uint id); int processSentence(const TTsentenceEntries *entries, uint entryCount, TTroomScript *roomScript, TTsentence *sentence); @@ -214,7 +215,14 @@ public: int val, uint tagId, uint remainder) const; virtual bool proc17() const; virtual bool proc18() const; - virtual uint proc19(uint v); + + /** + * Given an Id for a previously registered set of random number values, + * picks one of the array values and returns it.. depending on flags, + * either a random value, or each value in turn + */ + virtual uint getRangeValue(uint id); + virtual void proc20(int v); virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; -- cgit v1.2.3 From b76a6e2fb4bbb74e4fa8c340a3d515553980f940 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 6 Jun 2016 06:52:33 -0400 Subject: TITANIC: Added TTnpcScript setupDials --- engines/titanic/true_talk/bellbot_script.cpp | 2 +- engines/titanic/true_talk/deskbot_script.cpp | 2 +- engines/titanic/true_talk/tt_npc_script.cpp | 17 ++++++++++++++--- engines/titanic/true_talk/tt_npc_script.h | 5 ++++- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 1da2726b17..828d6069ea 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -35,7 +35,7 @@ BellbotScript::BellbotScript(int val1, const char *charClass, int v2, CTrueTalkManager::setFlags(40, 0); CTrueTalkManager::setFlags(26, 0); - randomizeFlags(); + setupDials(0, 0, 0); _array[0] = 100; _array[1] = 0; diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 6edaa142be..4149199f56 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -35,7 +35,7 @@ DeskbotScript::DeskbotScript(int val1, const char *charClass, int v2, CTrueTalkManager::setFlags(21, 0); CTrueTalkManager::setFlags(22, 0); - randomizeFlags(); + setupDials(0, 0, 0); _array[0] = 100; if (_field74 == 1) _field74 = 0; diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index c3f0509635..e31be05b13 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -98,8 +98,15 @@ void TTnpcScript::resetFlags() { _field2CC = false; } -void TTnpcScript::randomizeFlags() { - warning("TODO"); +void TTnpcScript::setupDials(int dial1, int dial2, int dial3) { + _dialValues[0] = dial1; + _dialValues[1] = dial2; + _dialValues[2] = dial3; + _field74 = getRandomNumber(3) - 1; + _field78 = getRandomNumber(5) + 6; + + if (_dialValues[0] > 70) + _field78 = -_field78; } void TTnpcScript::proc4(int v) { @@ -613,7 +620,11 @@ bool TTnpcScript::defaultProcess(TTroomScript *roomScript, TTsentence *sentence) return true; } - // TODO + if (tagId) { + if (chooseResponse(roomScript, sentence, tagId) == 2) + return true; + } + return false; } diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 1c7446aabc..c76e385807 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -123,7 +123,10 @@ protected: */ void resetFlags(); - void randomizeFlags(); + /** + * Setup dials + */ + void setupDials(int dial1, int dial2, int dial3); static int getRoom54(int roomId); -- cgit v1.2.3 From 6792fd92b7101c9c85656ff914bafcb3e30a176a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 6 Jun 2016 08:13:00 -0400 Subject: TITANIC: Renamings for script setupRanges --- engines/titanic/true_talk/barbot_script.cpp | 2 +- engines/titanic/true_talk/barbot_script.h | 7 ++++++- engines/titanic/true_talk/bellbot_script.cpp | 2 +- engines/titanic/true_talk/bellbot_script.h | 7 ++++++- engines/titanic/true_talk/deskbot_script.cpp | 2 +- engines/titanic/true_talk/deskbot_script.h | 7 ++++++- engines/titanic/true_talk/doorbot_script.cpp | 2 +- engines/titanic/true_talk/doorbot_script.h | 7 ++++++- engines/titanic/true_talk/liftbot_script.cpp | 2 +- engines/titanic/true_talk/liftbot_script.h | 6 +++++- engines/titanic/true_talk/maitred_script.cpp | 2 +- engines/titanic/true_talk/maitred_script.h | 6 +++++- engines/titanic/true_talk/parrot_script.cpp | 2 +- engines/titanic/true_talk/parrot_script.h | 7 ++++++- engines/titanic/true_talk/succubus_script.cpp | 2 +- engines/titanic/true_talk/succubus_script.h | 7 ++++++- engines/titanic/true_talk/tt_npc_script.h | 7 +++++++ 17 files changed, 61 insertions(+), 16 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index d6768fc359..9d4bdf6bc0 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -117,7 +117,7 @@ bool BarbotScript::proc16() const { return false; } -bool BarbotScript::proc17() const { +bool BarbotScript::setupRanges() { warning("TODO"); return false; } diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index 99dfac88ed..38f6ecd907 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -48,7 +48,12 @@ public: virtual int proc10() const; virtual int proc15() const; virtual bool proc16() const; - virtual bool proc17() const; + + /** + * Setup range sets + */ + virtual bool setupRanges(); + virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 828d6069ea..d40de3d4b9 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -61,7 +61,7 @@ bool BellbotScript::proc16() const { return 0; } -bool BellbotScript::proc17() const { +bool BellbotScript::setupRanges() { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index 3c23716892..72b6a84ff5 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -42,7 +42,12 @@ public: virtual int proc10() const; virtual int proc15() const; virtual bool proc16() const; - virtual bool proc17() const; + + /** + * Setup range sets + */ + virtual bool setupRanges(); + virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 4149199f56..28a211b2d1 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -63,7 +63,7 @@ bool DeskbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return 0; } -bool DeskbotScript::proc17() const { +bool DeskbotScript::setupRanges() { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index f7a46c99e3..2fd5945776 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -38,7 +38,12 @@ public: virtual int proc15() const; virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const; - virtual bool proc17() const; + + /** + * Setup range sets + */ + virtual bool setupRanges(); + virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index e65d744605..b76f7aca9d 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -114,7 +114,7 @@ bool DoorbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return 0; } -bool DoorbotScript::proc17() const { +bool DoorbotScript::setupRanges() { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 42fcb19fa4..05f0048fb2 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -50,7 +50,12 @@ public: virtual int proc15() const; virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const; - virtual bool proc17() const; + + /** + * Setup range sets + */ + virtual bool setupRanges(); + virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index 63900709dd..9ba80a67b4 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -90,7 +90,7 @@ bool LiftbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return 0; } -bool LiftbotScript::proc17() const { +bool LiftbotScript::setupRanges() { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index b3ab5295d7..ddbe92b81f 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -46,7 +46,11 @@ public: virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const; - virtual bool proc17() const; + /** + * Setup range sets + */ + virtual bool setupRanges(); + virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index b13e059d81..bdfd505e6e 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -68,7 +68,7 @@ bool MaitreDScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return 0; } -bool MaitreDScript::proc17() const { +bool MaitreDScript::setupRanges() { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index 05c16ecde5..c2d146efbc 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -42,7 +42,11 @@ public: virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const; - virtual bool proc17() const; + /** + * Setup range sets + */ + virtual bool setupRanges(); + virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; diff --git a/engines/titanic/true_talk/parrot_script.cpp b/engines/titanic/true_talk/parrot_script.cpp index a889187ee2..93312bbfd2 100644 --- a/engines/titanic/true_talk/parrot_script.cpp +++ b/engines/titanic/true_talk/parrot_script.cpp @@ -44,7 +44,7 @@ int ParrotScript::proc10() const { return 0; } -bool ParrotScript::proc17() const { +bool ParrotScript::setupRanges() { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/parrot_script.h b/engines/titanic/true_talk/parrot_script.h index 3cf804d10d..dd8ed96602 100644 --- a/engines/titanic/true_talk/parrot_script.h +++ b/engines/titanic/true_talk/parrot_script.h @@ -40,7 +40,12 @@ public: virtual void proc7(int v1, int v2); virtual int proc10() const; - virtual bool proc17() const; + + /** + * Setup range sets + */ + virtual bool setupRanges(); + virtual bool proc18() const; virtual int proc23() const; virtual const int *getTablePtr(int id); diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp index b52a02a8d5..fcd0fcf829 100644 --- a/engines/titanic/true_talk/succubus_script.cpp +++ b/engines/titanic/true_talk/succubus_script.cpp @@ -67,7 +67,7 @@ int SuccUBusScript::proc10() const { return 0; } -bool SuccUBusScript::proc17() const { +bool SuccUBusScript::setupRanges() { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h index e9263dbf84..4a9166f6b3 100644 --- a/engines/titanic/true_talk/succubus_script.h +++ b/engines/titanic/true_talk/succubus_script.h @@ -43,7 +43,12 @@ public: virtual void proc7(int v1, int v2); virtual int proc10() const; - virtual bool proc17() const; + + /** + * Setup range sets + */ + virtual bool setupRanges(); + virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); virtual int proc23() const; diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index c76e385807..dadea17ac2 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -62,6 +62,13 @@ struct TTscriptRange { bool isSequential); }; +struct TTscriptRangeInit { + uint id; + uint *_array; + bool _isRandom; + bool _isSequential; +}; + class TTnpcScriptBase : public TTscriptBase { protected: int _field54; -- cgit v1.2.3 From 59c033e68f09f323601f17892dfa2a270c8f8a00 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 6 Jun 2016 08:51:37 -0400 Subject: DEVTOOLS: Start of script ranges addition to create_titanic --- devtools/create_titanic/create_titanic_dat.cpp | 2 + devtools/create_titanic/script_ranges.cpp | 235 +++++++++++++++++++++++++ devtools/create_titanic/script_ranges.h | 39 ++++ 3 files changed, 276 insertions(+) create mode 100644 devtools/create_titanic/script_ranges.cpp create mode 100644 devtools/create_titanic/script_ranges.h diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index b8d3565368..03d05528fc 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -37,6 +37,7 @@ #include "winexe_pe.h" #include "file.h" #include "script_responses.h" +#include "script_ranges.h" /** * Format of the access.dat file that will be created: @@ -398,6 +399,7 @@ void writeData() { writeNumbers(); writeAllScriptResponses(); + writeAllScriptRanges(); } // Support method used for translating IDA debugger's output for diff --git a/devtools/create_titanic/script_ranges.cpp b/devtools/create_titanic/script_ranges.cpp new file mode 100644 index 0000000000..94c5d76c22 --- /dev/null +++ b/devtools/create_titanic/script_ranges.cpp @@ -0,0 +1,235 @@ +/* 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. + * + */ + + // Disable symbol overrides so that we can use system headers. +#define FORBIDDEN_SYMBOL_ALLOW_ALL + +// HACK to allow building with the SDL backend on MinGW +// see bug #1800764 "TOOLS: MinGW tools building broken" +#ifdef main +#undef main +#endif // main + +#include "file.h" +#include "script_ranges.h" + +static uint BARBOT_RANGE1[] = { 250062, 250064, 250065, 250066, 250067, 250068, 250069, 250070, 250071, 250063, 0 }; +static uint BARBOT_RANGE2[] = { 250200, 250201, 250202, 250203, 250204, 250205, 250206, 250207, 0 }; +static uint BARBOT_RANGE3[] = { 250160, 250161, 250162, 250163, 0 }; +static uint BARBOT_RANGE4[] = { 250175, 250176, 250177, 250178, 250179, 250180, 250181, 250182, 250183, 0 }; +static uint BARBOT_RANGE5[] = { 250114, 250004, 0 }; +static uint BARBOT_RANGE6[] = { 250042, 250009, 250010, 250011, 251692, 251693, 251694, 0 }; +static uint BARBOT_RANGE7[] = { 250012, 250111, 0 }; +static uint BARBOT_RANGE8[] = { 250013, 250119, 0 }; +static uint BARBOT_RANGE9[] = { 250027, 250126, 250055, 0 }; +static uint BARBOT_RANGE10[] = { 250032, 250130, 0 }; +static uint BARBOT_RANGE11[] = { 250038, 250134, 0 }; +static uint BARBOT_RANGE12[] = { 250039, 250135, 250050, 0 }; +static uint BARBOT_RANGE13[] = { 250016, 250120, 250136, 250145, 250143, 0 }; +static uint BARBOT_RANGE14[] = { 250040, 250138, 250139, 0 }; +static uint BARBOT_RANGE15[] = { 250037, 250133, 250617, 0 }; +static uint BARBOT_RANGE16[] = { 250031, 250129, 0 }; +static uint BARBOT_RANGE17[] = { 250036, 250132, 0 }; +static uint BARBOT_RANGE18[] = { 250035, 250137, 0 }; +static uint BARBOT_RANGE19[] = { 250021, 250123, 0 }; +static uint BARBOT_RANGE20[] = { 250006, 250117, 0 }; +static uint BARBOT_RANGE21[] = { 250024, 250124, 0 }; +static uint BARBOT_RANGE22[] = { 250002, 250113, 0 }; +static uint BARBOT_RANGE23[] = { 250152, 250153, 250079, 250194, 250149, 250151, 250150, +250208, 250209, 250157, 250195, 250076, 250156, 250074, +250075, 250080, 250192, 250109, 250159, 250110, 250148, +250053, 250155, 250197, 250072, 250077, 250001, 250154, +250196, 250198, 250199, 250158, 250073, 0 }; +static uint BARBOT_RANGE24[] = { 251831, 251832, 251833, 251834, 251835, 250617, 0 }; +static uint BARBOT_RANGE25[] = { 250033, 251838, 0 }; +static uint BARBOT_RANGE26[] = { 250014, 251827, 251781, 250617, 0 }; +static uint BARBOT_RANGE27[] = { 251855, 251856, 0 }; +static uint BARBOT_RANGE28[] = { 251852, 251853, 0 }; +static uint BARBOT_RANGE29[] = { 251250, 251261, 251272, 251277, 251278, 251279, 251280, +251281, 251282, 251251, 251252, 251253, 251254, 251255, +251256, 251257, 251258, 251259, 251260, 251262, 251263, +251264, 251265, 251266, 251267, 251268, 251269, 251270, +251271, 251273, 251274, 251275, 251276, 0 }; +static uint BARBOT_RANGE30[] = { 251283, 251284, 251285, 251286, 0 }; +static uint BARBOT_RANGE31[] = { 250527, 250530, 250531, 250532, 250533, 250534, 250535, +250536, 250537, 250528, 250529, 0 }; +static uint BARBOT_RANGE32[] = { 250593, 250594, 0 }; +static uint BARBOT_RANGE33[] = { 250263, 250264, 250265, 250266, 0 }; +static uint BARBOT_RANGE34[] = { 250227, 250228, 250229, 250230, 0 }; +static uint BARBOT_RANGE35[] = { 250239, 250240, 250241, 250242, 250243, 0 }; +static uint BARBOT_RANGE36[] = { 250507, 250222, 250678, 250588, 0 }; +static uint BARBOT_RANGE37[] = { 250365, 250366, 250367, 250368, 0 }; +static uint BARBOT_RANGE38[] = { 250936, 250937, 250938, 0 }; +static uint BARBOT_RANGE39[] = { 250610, 250611, 0 }; +static uint BARBOT_RANGE40[] = { 250082, 250093, 250102, 250104, 250105, 250106, 250107, +250108, 250091, 250092, 250094, 250095, 250096, 250097, +250098, 250099, 250100, 250101, 251700, 251701, 251702, +251703, 251704, 251862, 250617, 250268, 250272, 0 }; +static uint BARBOT_RANGE41[] = { 250584, 250585, 0 }; +static uint BARBOT_RANGE42[] = { 250579, 251142, 0 }; +static uint BARBOT_RANGE43[] = { 250577, 250578, 0 }; +static uint BARBOT_RANGE44[] = { 250244, 250245, 250246, 250247, 250248, 250249, 250250, +250251, 250252, 250253, 250254, 250255, 250256, 250257, +250258, 250259, 250260, 250261, 250262, 0 }; +static uint BARBOT_RANGE45[] = { 250286, 250288, 250289, 250290, 250291, 250292, 250293, +250294, 250295, 250287, 0 }; +static uint BARBOT_RANGE46[] = { 250296, 250299, 250300, 250301, 250302, 250303, 250304, +250305, 250306, 250297, 250298, 0 }; +static uint BARBOT_RANGE47[] = { 250307, 250309, 250310, 250311, 250312, 250313, 250314, +250315, 250316, 0 }; +static uint BARBOT_RANGE48[] = { 251682, 251683, 251684, 251685, 251686, 251687, 251688, +251689, 250756, 250757, 250758, 250759, 0 }; +static uint BARBOT_RANGE49[] = { 250738, 250742, 250743, 250744, 250745, 250746, 250747, +250748, 250749, 250739, 250740, 250741, 0 }; +static uint BARBOT_RANGE50[] = { 250659, 250660, 250661, 250379, 0 }; +static uint BARBOT_RANGE51[] = { 251761, 251762, 251763, 251764, 0 }; +static uint BARBOT_RANGE52[] = { 251754, 251755, 251756, 251757, 251758, 251759, 0 }; +static uint BARBOT_RANGE53[] = { 250482, 250504, 250424, 250463, 250466, 250467, 250468, +250478, 250501, 250502, 250503, 250506, 250413, 251014, +250614, 250756, 250758, 250759, 250223, 250737, 250658, +251027, 250633, 250935, 250237, 251618, 0 }; +static uint BARBOT_RANGE54[] = { 250504, 250434, 250436, 250466, 250467, 250468, 250469, +250470, 250472, 250501, 250502, 250503, 250505, 250413, +251681, 250756, 250758, 250759, 250223, 251027, 250633, +250935, 250237, 251618, 250371, 0 }; +static uint BARBOT_RANGE55[] = { 250952, 250953, 0 }; +static uint BARBOT_RANGE56[] = { 251777, 250951, 0 }; +static uint BARBOT_RANGE57[] = { 251871, 251877, 251878, 251879, 251880, 251883, 251884, +251872, 251873, 0 }; +static uint BARBOT_RANGE58[] = { 250228, 250236, 250258, 250259, 250378, 250465, 250536, +251016, 251048, 251068, 0 }; +static uint BARBOT_RANGE59[] = { 250141, 250378, 251048, 0 }; +static uint BARBOT_RANGE60[] = { 251621, 251622, 251623, 251624, 251625, 251626, 0 }; +static uint BARBOT_RANGE61[] = { 251650, 251651, 0 }; +static uint BARBOT_RANGE62[] = { 251305, 251306, 251307, 251308, 0 }; +static uint BARBOT_RANGE63[] = { 251836, 251890, 251891, 251892, 0 }; +static uint BARBOT_RANGE64[] = { 250760, 251246, 251156, 251335, 251510, 251059, 251097, +251136, 250374, 250375, 250376, 250377, 251015, 251016, +251017, 251018, 0 }; +static uint BARBOT_RANGE65[] = { 250899, 250906, 250948, 250713, 250690, 0 }; +static uint BARBOT_RANGE66[] = { 250906, 250948, 250713, 250899, 250690, 0 }; +static uint BARBOT_RANGE67[] = { 250949, 250713, 250711, 250152, 250153, 250690, 250906, 0 }; +static uint BARBOT_RANGE68[] = { 251815, 250711, 0 }; +static uint BARBOT_RANGE69[] = { 251829, 250711, 0 }; +static uint BARBOT_RANGE70[] = { 251779, 250712, 0 }; + +#define BARBOT_RANGE_COUNT 70 +static ScriptRange BARBOT_RANGES[70] = { + { 250062, BARBOT_RANGE1, false, false }, + { 250200, BARBOT_RANGE2, false, false }, + { 250160, BARBOT_RANGE3, false, false }, + { 250175, BARBOT_RANGE4, false, false }, + { 250004, BARBOT_RANGE5, false, false }, + { 250042, BARBOT_RANGE6, true, false }, + { 250012, BARBOT_RANGE7, false, false }, + { 250013, BARBOT_RANGE8, false, false }, + { 250027, BARBOT_RANGE9, false, false }, + { 250032, BARBOT_RANGE10, false, false }, + { 250038, BARBOT_RANGE11, false, false }, + { 250039, BARBOT_RANGE12, false, false }, + { 250016, BARBOT_RANGE13, false, false }, + { 250040, BARBOT_RANGE14, false, false }, + { 250037, BARBOT_RANGE15, false, false }, + { 250031, BARBOT_RANGE16, false, false }, + { 250036, BARBOT_RANGE17, false, false }, + { 250035, BARBOT_RANGE18, false, false }, + { 250021, BARBOT_RANGE19, false, false }, + { 250006, BARBOT_RANGE20, false, false }, + + { 250024, BARBOT_RANGE21, false, false }, + { 250002, BARBOT_RANGE22, false, false }, + { 250210, BARBOT_RANGE23, false, false }, + { 251831, BARBOT_RANGE24, false, false }, + { 250033, BARBOT_RANGE25, false, false }, + { 250014, BARBOT_RANGE26, false, false }, + { 251855, BARBOT_RANGE27, false, false }, + { 251852, BARBOT_RANGE28, false, false }, + { 251250, BARBOT_RANGE29, false, false }, + { 251283, BARBOT_RANGE30, false, false }, + { 250527, BARBOT_RANGE31, false, false }, + { 250593, BARBOT_RANGE32, false, false }, + { 250263, BARBOT_RANGE33, false, false }, + { 250227, BARBOT_RANGE34, false, false }, + { 250239, BARBOT_RANGE35, false, false }, + { 250507, BARBOT_RANGE36, false, false }, + { 250365, BARBOT_RANGE37, false, false }, + { 250936, BARBOT_RANGE38, false, false }, + { 250610, BARBOT_RANGE39, false, false }, + { 250082, BARBOT_RANGE40, true, false }, + + { 250584, BARBOT_RANGE41, false, false }, + { 250579, BARBOT_RANGE42, false, false }, + { 250577, BARBOT_RANGE43, false, false }, + { 250244, BARBOT_RANGE44, true, false }, + { 250286, BARBOT_RANGE45, true, false }, + { 250296, BARBOT_RANGE46, true, false }, + { 250307, BARBOT_RANGE47, true, false }, + { 251682, BARBOT_RANGE48, true, false }, + { 250738, BARBOT_RANGE49, true, false }, + { 250659, BARBOT_RANGE50, true, false }, + { 251761, BARBOT_RANGE51, false, false }, + { 251754, BARBOT_RANGE52, false, false }, + { 251896, BARBOT_RANGE53, true, false }, + { 251897, BARBOT_RANGE54, true, false }, + { 250952, BARBOT_RANGE55, false, false }, + { 251777, BARBOT_RANGE56, false, false }, + { 251871, BARBOT_RANGE57, true, false }, + { 250140, BARBOT_RANGE58, true, false }, + { 250141, BARBOT_RANGE59, false, false }, + { 251621, BARBOT_RANGE60, false, false }, + + { 251650, BARBOT_RANGE61, false, false }, + { 251305, BARBOT_RANGE62, false, false }, + { 251836, BARBOT_RANGE63, false, false }, + { 251018, BARBOT_RANGE64, true, false }, + { 250899, BARBOT_RANGE65, false, false }, + { 250899, BARBOT_RANGE66, false, false }, + { 251899, BARBOT_RANGE67, false, false }, + { 251815, BARBOT_RANGE68, false, false }, + { 251829, BARBOT_RANGE69, false, false }, + { 251779, BARBOT_RANGE70 } +}; + + +void writeScriptRange(const char *name, const ScriptRange *ranges, int count) { + outputFile.seek(dataOffset); + + for (int idx = 0; idx < count; ++idx) { + outputFile.writeLong(ranges[idx]._id); + outputFile.writeByte(ranges[idx]._isRandom); + outputFile.writeByte(ranges[idx]._isSequential); + + const uint *v = ranges[idx]._array; + do { + outputFile.writeLong(*v); + } while (*v++ != 0); + } + outputFile.writeLong(0); + + uint size = outputFile.size() - dataOffset; + writeEntryHeader(name, dataOffset, size); + dataOffset += size; +} + +void writeAllScriptRanges() { + writeScriptRange("Ranges/Barbot", BARBOT_RANGES, 70); +} \ No newline at end of file diff --git a/devtools/create_titanic/script_ranges.h b/devtools/create_titanic/script_ranges.h new file mode 100644 index 0000000000..70caac1791 --- /dev/null +++ b/devtools/create_titanic/script_ranges.h @@ -0,0 +1,39 @@ +/* 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. + * + */ + +#ifndef COMMON_SCRIPT_RANGES_H +#define COMMON_SCRIPT_RANGES_H + +#include "common/scummsys.h" + +struct ScriptRange { + uint _id; + uint *_array; + bool _isRandom; + bool _isSequential; +}; + +extern void writeAllScriptRanges(); +extern void writeEntryHeader(const char *name, uint offset, uint size); +extern uint dataOffset; + +#endif -- cgit v1.2.3 From c660bbf1416410dbb3a985300b8c037f7f30eab3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 6 Jun 2016 08:52:02 -0400 Subject: TITANIC: Beginnings of loading NPC range data --- engines/titanic/true_talk/barbot_script.cpp | 3 +- engines/titanic/true_talk/bellbot_script.cpp | 2 +- engines/titanic/true_talk/deskbot_script.cpp | 2 +- engines/titanic/true_talk/doorbot_script.cpp | 2 +- engines/titanic/true_talk/liftbot_script.cpp | 2 +- engines/titanic/true_talk/maitred_script.cpp | 2 +- engines/titanic/true_talk/tt_npc_script.cpp | 54 +++++++++++++++++++--------- engines/titanic/true_talk/tt_npc_script.h | 22 ++++++------ 8 files changed, 55 insertions(+), 34 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index 9d4bdf6bc0..2a67a7b494 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -33,7 +33,8 @@ BarbotScript::BarbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { _state = 0; - load("Responses/Barbot"); + loadRanges("Ranges/Barbot"); + loadResponses("Responses/Barbot"); } int BarbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index d40de3d4b9..a02ef147c4 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -39,7 +39,7 @@ BellbotScript::BellbotScript(int val1, const char *charClass, int v2, _array[0] = 100; _array[1] = 0; - load("Responses/Bellbot", 4); + loadResponses("Responses/Bellbot", 4); } void BellbotScript::proc7(int v1, int v2) { diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 28a211b2d1..85b59b062a 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -40,7 +40,7 @@ DeskbotScript::DeskbotScript(int val1, const char *charClass, int v2, if (_field74 == 1) _field74 = 0; - load("Responses/Deskbot", 4); + loadResponses("Responses/Deskbot", 4); } void DeskbotScript::proc7(int v1, int v2) { diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index b76f7aca9d..7d291b6e7d 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -35,7 +35,7 @@ DoorbotScript::DoorbotScript(int val1, const char *charClass, int v2, TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { Common::fill(&_array[0], &_array[148], 0); _state = 0; - load("Responses/Doorbot"); + loadResponses("Responses/Doorbot"); } int DoorbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index 9ba80a67b4..5a63a51bb3 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -33,7 +33,7 @@ LiftbotScript::LiftbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { _state = 0; - load("Responses/Liftbot"); + loadResponses("Responses/Liftbot"); } int LiftbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index bdfd505e6e..7bd19c4c71 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -38,7 +38,7 @@ MaitreDScript::MaitreDScript(int val1, const char *charClass, int v2, CTrueTalkManager::setFlags(15, 0); CTrueTalkManager::setFlags(16, 0); - load("Responses/MaitreD"); + loadResponses("Responses/MaitreD"); } int MaitreDScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index e31be05b13..19ff05d134 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -40,14 +40,17 @@ int TTnpcScriptResponse::size() const { /*------------------------------------------------------------------------*/ -TTscriptRange::TTscriptRange(uint id, const uint *arrayP, bool isRandom, - bool isSequential) : - _id(id), _arrayP(arrayP), _nextP(nullptr) { +TTscriptRange::TTscriptRange(uint id, const Common::Array &values, + bool isRandom, bool isSequential) : + _id(id), _nextP(nullptr) { _mode = SF_NONE; if (isRandom) _mode = SF_RANDOM; if (isSequential) _mode = SF_SEQUENTIAL; + + for (uint idx = 0; idx < values.size(); ++idx) + _values.push_back(values[idx]); } /*------------------------------------------------------------------------*/ @@ -77,7 +80,7 @@ TTnpcScript::TTnpcScript(int charId, const char *charClass, int v2, resetFlags(); } -void TTnpcScript::load(const char *name, int valuesPerResponse) { +void TTnpcScript::loadResponses(const char *name, int valuesPerResponse) { _valuesPerResponse = valuesPerResponse; Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); @@ -93,6 +96,27 @@ void TTnpcScript::load(const char *name, int valuesPerResponse) { delete r; } +void TTnpcScript::loadRanges(const char *name) { + Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); + + while (r->pos() < r->size()) { + Common::Array values; + uint id = r->readUint32LE(); + bool isRandom = r->readByte(); + bool isSequential = r->readByte(); + + uint v; + do { + v = r->readUint32LE(); + values.push_back(v); + } while (v); + + addRange(id, values, isRandom, isSequential); + } + + delete r; +} + void TTnpcScript::resetFlags() { Common::fill(&_array[20], &_array[136], 0); _field2CC = false; @@ -197,27 +221,25 @@ uint TTnpcScript::getRangeValue(uint id) { switch (range->_mode) { case SF_RANDOM: { - uint count = 0; - for (const uint *p = range->_arrayP; *p; ++p) - ++count; + uint count = range->_values.size(); uint index = getRandomNumber(count) - 1; - if (count > 1 && range->_arrayP[index] == range->_priorIndex) { + if (count > 1 && range->_values[index] == range->_priorIndex) { for (int retry = 0; retry < 8 && index != range->_priorIndex; ++retry) index = getRandomNumber(count) - 1; } range->_priorIndex = index; - return range->_arrayP[index]; + return range->_values[index]; } case SF_SEQUENTIAL: { // Get the next value from the array sequentially - int val = range->_arrayP[range->_priorIndex]; + int val = range->_values[range->_priorIndex]; if (!val) { // Reached end of array, so reset back to start range->_priorIndex = 1; - val = range->_arrayP[1]; + val = range->_values[1]; } ++range->_priorIndex; @@ -225,12 +247,12 @@ uint TTnpcScript::getRangeValue(uint id) { } default: - if (range->_arrayP[range->_priorIndex]) - return range->_arrayP[range->_priorIndex++]; + if (range->_values[range->_priorIndex]) + return range->_values[range->_priorIndex++]; range->_priorIndex = 1; ++_rangeResetCtr; - return range->_arrayP[0]; + return range->_values[0]; } } @@ -628,8 +650,8 @@ bool TTnpcScript::defaultProcess(TTroomScript *roomScript, TTsentence *sentence) return false; } -void TTnpcScript::addRange(uint id, const uint *arrayP, bool isRandom, bool isSequential) { - _ranges.push_back(TTscriptRange(id, arrayP, isRandom, isSequential)); +void TTnpcScript::addRange(uint id, const Common::Array &values, bool isRandom, bool isSequential) { + _ranges.push_back(TTscriptRange(id, values, isRandom, isSequential)); } TTscriptRange *TTnpcScript::findRange(uint id) { diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index dadea17ac2..77f44453c7 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -51,24 +51,17 @@ struct TTnpcScriptResponse { struct TTscriptRange { uint _id; - const uint *_arrayP; + Common::Array _values; TTscriptRange *_nextP; uint _priorIndex; ScriptArrayFlag _mode; - TTscriptRange() : _id(0), _arrayP(nullptr), _nextP(nullptr), + TTscriptRange() : _id(0), _nextP(nullptr), _priorIndex(0), _mode(SF_NONE) {} - TTscriptRange(uint id, const uint *arrayP, bool isRandom, + TTscriptRange(uint id, const Common::Array &values, bool isRandom, bool isSequential); }; -struct TTscriptRangeInit { - uint id; - uint *_array; - bool _isRandom; - bool _isSequential; -}; - class TTnpcScriptBase : public TTscriptBase { protected: int _field54; @@ -123,7 +116,12 @@ protected: /** * Loads response data for the NPC from the given resource */ - void load(const char *name, int valuesPerResponse = 1); + void loadResponses(const char *name, int valuesPerResponse = 1); + + /** + * Load ranges data for the NPC from the given resource + */ + void loadRanges(const char *name); /** * Reset script flags @@ -167,7 +165,7 @@ protected: /** * Adds a new item to the list of number ranges */ - void addRange(uint id, const uint *arrayP, bool isRandom, bool isSequential); + void addRange(uint id, const Common::Array &values, bool isRandom, bool isSequential); /** * Finds an entry in the list of prevoiusly registered number ranges -- cgit v1.2.3 From 9a35125d65fcba2df05a0a226878da43c0394319 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 6 Jun 2016 22:40:20 -0400 Subject: TITANIC: Added Deskbot ranges to create_titanic --- devtools/create_titanic/create_titanic_dat.cpp | 2 +- devtools/create_titanic/script_ranges.cpp | 473 +++++++++++++++++++++---- devtools/create_titanic/script_ranges.h | 2 +- 3 files changed, 401 insertions(+), 76 deletions(-) diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index 03d05528fc..506aaaec70 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -51,7 +51,7 @@ */ #define VERSION_NUMBER 1 -#define HEADER_SIZE 0x380 +#define HEADER_SIZE 0x400 Common::File inputFile, outputFile; Common::PEResources res; diff --git a/devtools/create_titanic/script_ranges.cpp b/devtools/create_titanic/script_ranges.cpp index 94c5d76c22..25d3b8ee7e 100644 --- a/devtools/create_titanic/script_ranges.cpp +++ b/devtools/create_titanic/script_ranges.cpp @@ -32,108 +32,108 @@ #include "file.h" #include "script_ranges.h" -static uint BARBOT_RANGE1[] = { 250062, 250064, 250065, 250066, 250067, 250068, 250069, 250070, 250071, 250063, 0 }; -static uint BARBOT_RANGE2[] = { 250200, 250201, 250202, 250203, 250204, 250205, 250206, 250207, 0 }; -static uint BARBOT_RANGE3[] = { 250160, 250161, 250162, 250163, 0 }; -static uint BARBOT_RANGE4[] = { 250175, 250176, 250177, 250178, 250179, 250180, 250181, 250182, 250183, 0 }; -static uint BARBOT_RANGE5[] = { 250114, 250004, 0 }; -static uint BARBOT_RANGE6[] = { 250042, 250009, 250010, 250011, 251692, 251693, 251694, 0 }; -static uint BARBOT_RANGE7[] = { 250012, 250111, 0 }; -static uint BARBOT_RANGE8[] = { 250013, 250119, 0 }; -static uint BARBOT_RANGE9[] = { 250027, 250126, 250055, 0 }; -static uint BARBOT_RANGE10[] = { 250032, 250130, 0 }; -static uint BARBOT_RANGE11[] = { 250038, 250134, 0 }; -static uint BARBOT_RANGE12[] = { 250039, 250135, 250050, 0 }; -static uint BARBOT_RANGE13[] = { 250016, 250120, 250136, 250145, 250143, 0 }; -static uint BARBOT_RANGE14[] = { 250040, 250138, 250139, 0 }; -static uint BARBOT_RANGE15[] = { 250037, 250133, 250617, 0 }; -static uint BARBOT_RANGE16[] = { 250031, 250129, 0 }; -static uint BARBOT_RANGE17[] = { 250036, 250132, 0 }; -static uint BARBOT_RANGE18[] = { 250035, 250137, 0 }; -static uint BARBOT_RANGE19[] = { 250021, 250123, 0 }; -static uint BARBOT_RANGE20[] = { 250006, 250117, 0 }; -static uint BARBOT_RANGE21[] = { 250024, 250124, 0 }; -static uint BARBOT_RANGE22[] = { 250002, 250113, 0 }; -static uint BARBOT_RANGE23[] = { 250152, 250153, 250079, 250194, 250149, 250151, 250150, +const uint BARBOT_RANGE1[] = { 250062, 250064, 250065, 250066, 250067, 250068, 250069, 250070, 250071, 250063, 0 }; +const uint BARBOT_RANGE2[] = { 250200, 250201, 250202, 250203, 250204, 250205, 250206, 250207, 0 }; +const uint BARBOT_RANGE3[] = { 250160, 250161, 250162, 250163, 0 }; +const uint BARBOT_RANGE4[] = { 250175, 250176, 250177, 250178, 250179, 250180, 250181, 250182, 250183, 0 }; +const uint BARBOT_RANGE5[] = { 250114, 250004, 0 }; +const uint BARBOT_RANGE6[] = { 250042, 250009, 250010, 250011, 251692, 251693, 251694, 0 }; +const uint BARBOT_RANGE7[] = { 250012, 250111, 0 }; +const uint BARBOT_RANGE8[] = { 250013, 250119, 0 }; +const uint BARBOT_RANGE9[] = { 250027, 250126, 250055, 0 }; +const uint BARBOT_RANGE10[] = { 250032, 250130, 0 }; +const uint BARBOT_RANGE11[] = { 250038, 250134, 0 }; +const uint BARBOT_RANGE12[] = { 250039, 250135, 250050, 0 }; +const uint BARBOT_RANGE13[] = { 250016, 250120, 250136, 250145, 250143, 0 }; +const uint BARBOT_RANGE14[] = { 250040, 250138, 250139, 0 }; +const uint BARBOT_RANGE15[] = { 250037, 250133, 250617, 0 }; +const uint BARBOT_RANGE16[] = { 250031, 250129, 0 }; +const uint BARBOT_RANGE17[] = { 250036, 250132, 0 }; +const uint BARBOT_RANGE18[] = { 250035, 250137, 0 }; +const uint BARBOT_RANGE19[] = { 250021, 250123, 0 }; +const uint BARBOT_RANGE20[] = { 250006, 250117, 0 }; +const uint BARBOT_RANGE21[] = { 250024, 250124, 0 }; +const uint BARBOT_RANGE22[] = { 250002, 250113, 0 }; +const uint BARBOT_RANGE23[] = { 250152, 250153, 250079, 250194, 250149, 250151, 250150, 250208, 250209, 250157, 250195, 250076, 250156, 250074, 250075, 250080, 250192, 250109, 250159, 250110, 250148, 250053, 250155, 250197, 250072, 250077, 250001, 250154, 250196, 250198, 250199, 250158, 250073, 0 }; -static uint BARBOT_RANGE24[] = { 251831, 251832, 251833, 251834, 251835, 250617, 0 }; -static uint BARBOT_RANGE25[] = { 250033, 251838, 0 }; -static uint BARBOT_RANGE26[] = { 250014, 251827, 251781, 250617, 0 }; -static uint BARBOT_RANGE27[] = { 251855, 251856, 0 }; -static uint BARBOT_RANGE28[] = { 251852, 251853, 0 }; -static uint BARBOT_RANGE29[] = { 251250, 251261, 251272, 251277, 251278, 251279, 251280, +const uint BARBOT_RANGE24[] = { 251831, 251832, 251833, 251834, 251835, 250617, 0 }; +const uint BARBOT_RANGE25[] = { 250033, 251838, 0 }; +const uint BARBOT_RANGE26[] = { 250014, 251827, 251781, 250617, 0 }; +const uint BARBOT_RANGE27[] = { 251855, 251856, 0 }; +const uint BARBOT_RANGE28[] = { 251852, 251853, 0 }; +const uint BARBOT_RANGE29[] = { 251250, 251261, 251272, 251277, 251278, 251279, 251280, 251281, 251282, 251251, 251252, 251253, 251254, 251255, 251256, 251257, 251258, 251259, 251260, 251262, 251263, 251264, 251265, 251266, 251267, 251268, 251269, 251270, 251271, 251273, 251274, 251275, 251276, 0 }; -static uint BARBOT_RANGE30[] = { 251283, 251284, 251285, 251286, 0 }; -static uint BARBOT_RANGE31[] = { 250527, 250530, 250531, 250532, 250533, 250534, 250535, +const uint BARBOT_RANGE30[] = { 251283, 251284, 251285, 251286, 0 }; +const uint BARBOT_RANGE31[] = { 250527, 250530, 250531, 250532, 250533, 250534, 250535, 250536, 250537, 250528, 250529, 0 }; -static uint BARBOT_RANGE32[] = { 250593, 250594, 0 }; -static uint BARBOT_RANGE33[] = { 250263, 250264, 250265, 250266, 0 }; -static uint BARBOT_RANGE34[] = { 250227, 250228, 250229, 250230, 0 }; -static uint BARBOT_RANGE35[] = { 250239, 250240, 250241, 250242, 250243, 0 }; -static uint BARBOT_RANGE36[] = { 250507, 250222, 250678, 250588, 0 }; -static uint BARBOT_RANGE37[] = { 250365, 250366, 250367, 250368, 0 }; -static uint BARBOT_RANGE38[] = { 250936, 250937, 250938, 0 }; -static uint BARBOT_RANGE39[] = { 250610, 250611, 0 }; -static uint BARBOT_RANGE40[] = { 250082, 250093, 250102, 250104, 250105, 250106, 250107, +const uint BARBOT_RANGE32[] = { 250593, 250594, 0 }; +const uint BARBOT_RANGE33[] = { 250263, 250264, 250265, 250266, 0 }; +const uint BARBOT_RANGE34[] = { 250227, 250228, 250229, 250230, 0 }; +const uint BARBOT_RANGE35[] = { 250239, 250240, 250241, 250242, 250243, 0 }; +const uint BARBOT_RANGE36[] = { 250507, 250222, 250678, 250588, 0 }; +const uint BARBOT_RANGE37[] = { 250365, 250366, 250367, 250368, 0 }; +const uint BARBOT_RANGE38[] = { 250936, 250937, 250938, 0 }; +const uint BARBOT_RANGE39[] = { 250610, 250611, 0 }; +const uint BARBOT_RANGE40[] = { 250082, 250093, 250102, 250104, 250105, 250106, 250107, 250108, 250091, 250092, 250094, 250095, 250096, 250097, 250098, 250099, 250100, 250101, 251700, 251701, 251702, 251703, 251704, 251862, 250617, 250268, 250272, 0 }; -static uint BARBOT_RANGE41[] = { 250584, 250585, 0 }; -static uint BARBOT_RANGE42[] = { 250579, 251142, 0 }; -static uint BARBOT_RANGE43[] = { 250577, 250578, 0 }; -static uint BARBOT_RANGE44[] = { 250244, 250245, 250246, 250247, 250248, 250249, 250250, +const uint BARBOT_RANGE41[] = { 250584, 250585, 0 }; +const uint BARBOT_RANGE42[] = { 250579, 251142, 0 }; +const uint BARBOT_RANGE43[] = { 250577, 250578, 0 }; +const uint BARBOT_RANGE44[] = { 250244, 250245, 250246, 250247, 250248, 250249, 250250, 250251, 250252, 250253, 250254, 250255, 250256, 250257, 250258, 250259, 250260, 250261, 250262, 0 }; -static uint BARBOT_RANGE45[] = { 250286, 250288, 250289, 250290, 250291, 250292, 250293, +const uint BARBOT_RANGE45[] = { 250286, 250288, 250289, 250290, 250291, 250292, 250293, 250294, 250295, 250287, 0 }; -static uint BARBOT_RANGE46[] = { 250296, 250299, 250300, 250301, 250302, 250303, 250304, +const uint BARBOT_RANGE46[] = { 250296, 250299, 250300, 250301, 250302, 250303, 250304, 250305, 250306, 250297, 250298, 0 }; -static uint BARBOT_RANGE47[] = { 250307, 250309, 250310, 250311, 250312, 250313, 250314, +const uint BARBOT_RANGE47[] = { 250307, 250309, 250310, 250311, 250312, 250313, 250314, 250315, 250316, 0 }; -static uint BARBOT_RANGE48[] = { 251682, 251683, 251684, 251685, 251686, 251687, 251688, +const uint BARBOT_RANGE48[] = { 251682, 251683, 251684, 251685, 251686, 251687, 251688, 251689, 250756, 250757, 250758, 250759, 0 }; -static uint BARBOT_RANGE49[] = { 250738, 250742, 250743, 250744, 250745, 250746, 250747, +const uint BARBOT_RANGE49[] = { 250738, 250742, 250743, 250744, 250745, 250746, 250747, 250748, 250749, 250739, 250740, 250741, 0 }; -static uint BARBOT_RANGE50[] = { 250659, 250660, 250661, 250379, 0 }; -static uint BARBOT_RANGE51[] = { 251761, 251762, 251763, 251764, 0 }; -static uint BARBOT_RANGE52[] = { 251754, 251755, 251756, 251757, 251758, 251759, 0 }; -static uint BARBOT_RANGE53[] = { 250482, 250504, 250424, 250463, 250466, 250467, 250468, +const uint BARBOT_RANGE50[] = { 250659, 250660, 250661, 250379, 0 }; +const uint BARBOT_RANGE51[] = { 251761, 251762, 251763, 251764, 0 }; +const uint BARBOT_RANGE52[] = { 251754, 251755, 251756, 251757, 251758, 251759, 0 }; +const uint BARBOT_RANGE53[] = { 250482, 250504, 250424, 250463, 250466, 250467, 250468, 250478, 250501, 250502, 250503, 250506, 250413, 251014, 250614, 250756, 250758, 250759, 250223, 250737, 250658, 251027, 250633, 250935, 250237, 251618, 0 }; -static uint BARBOT_RANGE54[] = { 250504, 250434, 250436, 250466, 250467, 250468, 250469, +const uint BARBOT_RANGE54[] = { 250504, 250434, 250436, 250466, 250467, 250468, 250469, 250470, 250472, 250501, 250502, 250503, 250505, 250413, 251681, 250756, 250758, 250759, 250223, 251027, 250633, 250935, 250237, 251618, 250371, 0 }; -static uint BARBOT_RANGE55[] = { 250952, 250953, 0 }; -static uint BARBOT_RANGE56[] = { 251777, 250951, 0 }; -static uint BARBOT_RANGE57[] = { 251871, 251877, 251878, 251879, 251880, 251883, 251884, +const uint BARBOT_RANGE55[] = { 250952, 250953, 0 }; +const uint BARBOT_RANGE56[] = { 251777, 250951, 0 }; +const uint BARBOT_RANGE57[] = { 251871, 251877, 251878, 251879, 251880, 251883, 251884, 251872, 251873, 0 }; -static uint BARBOT_RANGE58[] = { 250228, 250236, 250258, 250259, 250378, 250465, 250536, +const uint BARBOT_RANGE58[] = { 250228, 250236, 250258, 250259, 250378, 250465, 250536, 251016, 251048, 251068, 0 }; -static uint BARBOT_RANGE59[] = { 250141, 250378, 251048, 0 }; -static uint BARBOT_RANGE60[] = { 251621, 251622, 251623, 251624, 251625, 251626, 0 }; -static uint BARBOT_RANGE61[] = { 251650, 251651, 0 }; -static uint BARBOT_RANGE62[] = { 251305, 251306, 251307, 251308, 0 }; -static uint BARBOT_RANGE63[] = { 251836, 251890, 251891, 251892, 0 }; -static uint BARBOT_RANGE64[] = { 250760, 251246, 251156, 251335, 251510, 251059, 251097, +const uint BARBOT_RANGE59[] = { 250141, 250378, 251048, 0 }; +const uint BARBOT_RANGE60[] = { 251621, 251622, 251623, 251624, 251625, 251626, 0 }; +const uint BARBOT_RANGE61[] = { 251650, 251651, 0 }; +const uint BARBOT_RANGE62[] = { 251305, 251306, 251307, 251308, 0 }; +const uint BARBOT_RANGE63[] = { 251836, 251890, 251891, 251892, 0 }; +const uint BARBOT_RANGE64[] = { 250760, 251246, 251156, 251335, 251510, 251059, 251097, 251136, 250374, 250375, 250376, 250377, 251015, 251016, 251017, 251018, 0 }; -static uint BARBOT_RANGE65[] = { 250899, 250906, 250948, 250713, 250690, 0 }; -static uint BARBOT_RANGE66[] = { 250906, 250948, 250713, 250899, 250690, 0 }; -static uint BARBOT_RANGE67[] = { 250949, 250713, 250711, 250152, 250153, 250690, 250906, 0 }; -static uint BARBOT_RANGE68[] = { 251815, 250711, 0 }; -static uint BARBOT_RANGE69[] = { 251829, 250711, 0 }; -static uint BARBOT_RANGE70[] = { 251779, 250712, 0 }; +const uint BARBOT_RANGE65[] = { 250899, 250906, 250948, 250713, 250690, 0 }; +const uint BARBOT_RANGE66[] = { 250906, 250948, 250713, 250899, 250690, 0 }; +const uint BARBOT_RANGE67[] = { 250949, 250713, 250711, 250152, 250153, 250690, 250906, 0 }; +const uint BARBOT_RANGE68[] = { 251815, 250711, 0 }; +const uint BARBOT_RANGE69[] = { 251829, 250711, 0 }; +const uint BARBOT_RANGE70[] = { 251779, 250712, 0 }; #define BARBOT_RANGE_COUNT 70 -static ScriptRange BARBOT_RANGES[70] = { +const ScriptRange BARBOT_RANGES[70] = { { 250062, BARBOT_RANGE1, false, false }, { 250200, BARBOT_RANGE2, false, false }, { 250160, BARBOT_RANGE3, false, false }, @@ -206,9 +206,334 @@ static ScriptRange BARBOT_RANGES[70] = { { 251899, BARBOT_RANGE67, false, false }, { 251815, BARBOT_RANGE68, false, false }, { 251829, BARBOT_RANGE69, false, false }, - { 251779, BARBOT_RANGE70 } + { 251779, BARBOT_RANGE70, false, false } }; +const uint DESKBOT_RANGE1[] = { 240002, 240003, 240006, 240007, 0 }; +const uint DESKBOT_RANGE2[] = { 240008, 240009, 240010, 240011, 240012, 240013, 240004, 240005, 0 }; +const uint DESKBOT_RANGE3[] = { 240336, 240337, 240338, 240339, 240340, 240341, 240342, 240343, 240344, 0 }; +const uint DESKBOT_RANGE4[] = { 240345, 240346, 240347, 0 }; +const uint DESKBOT_RANGE5[] = { 240348, 240349, 240350, 0 }; +const uint DESKBOT_RANGE6[] = { 240351, 240352, 240353, 0 }; +const uint DESKBOT_RANGE7[] = { 240355, 240356, 240357, 0 }; +const uint DESKBOT_RANGE8[] = { 240359, 240360, 240361, 0 }; +const uint DESKBOT_RANGE9[] = { 240362, 240363, 240364, 240365, 240366, 240367, 0 }; +const uint DESKBOT_RANGE10[] = { 240368, 240369, 240370, 240371, 0 }; + +const uint DESKBOT_RANGE11[] = { 240372, 240373, 240374, 0 }; +const uint DESKBOT_RANGE12[] = { 240375, 240376, 240377, 0 }; +const uint DESKBOT_RANGE13[] = { 240378, 240379, 240380, 0 }; +const uint DESKBOT_RANGE14[] = { 240381, 240382, 240383, 240384, 0 }; +const uint DESKBOT_RANGE15[] = { 240385, 240386, 240387, 0 }; +const uint DESKBOT_RANGE16[] = { 240388, 240389, 240390, 0 }; +const uint DESKBOT_RANGE17[] = { 240391, 240392, 240393, 0 }; +const uint DESKBOT_RANGE18[] = { 240394, 240395, 240396, 240397, 0 }; +const uint DESKBOT_RANGE19[] = { 240399, 0 }; +const uint DESKBOT_RANGE20[] = { 240401, 240402, 240403, 0 }; + +const uint DESKBOT_RANGE21[] = { 240404, 240405, 240406, 0 }; +const uint DESKBOT_RANGE22[] = { 240407, 240408, 240409, 240900, 240410, 240411, 240412, 240900, 241671, 241672, +241673, 241671, 241672, 241673, 241671, 241672, 241673, 0 }; +const uint DESKBOT_RANGE23[] = { 240421, 240422, 0 }; +const uint DESKBOT_RANGE24[] = { 240451, 240424, 240425, 240426, 240452, 240455, 240456, 240457, 240458, 240459, 240460, 0 }; +const uint DESKBOT_RANGE25[] = { 240451, 240424, 240425, 240426, 240452, 240455, 240456, 240457, 240458, 0 }; +const uint DESKBOT_RANGE26[] = { 240428, 240429, 240430, 0 }; +const uint DESKBOT_RANGE27[] = { 240431, 240432, 0 }; +const uint DESKBOT_RANGE28[] = { 240435, 240436, 240437, 240438, 240439, 0 }; +const uint DESKBOT_RANGE29[] = { 240440, 240441, 240442, 240443, 240444, 0 }; +const uint DESKBOT_RANGE30[] = { 240451, 240452, 0 }; + +const uint DESKBOT_RANGE31[] = { 240455, 240456, 240457, 240458, 240459, 240460, 0 }; +const uint DESKBOT_RANGE32[] = { 240461, 240462, 240463, 240464, 240977, 240978, 240979, 240980, 240804, 240806, + 240807, 240808, 0 }; +const uint DESKBOT_RANGE33[] = { 241742, 241743, 241744, 241745, 241746, 241747, 241748, 240954, 0 }; +const uint DESKBOT_RANGE34[] = { 240480, 240481, 240482, 0 }; +const uint DESKBOT_RANGE35[] = { 241117, 241515, 0 }; +const uint DESKBOT_RANGE36[] = { 240486, 241585, 240487, 241585, 240488, 241585, 0 }; +const uint DESKBOT_RANGE37[] = { 240490, 240491, 0 }; +const uint DESKBOT_RANGE38[] = { 240496, 240507, 240518, 240529, 240540, 240542, 240543, 240544, 240545, 240497, + 240498, 240499, 240500, 240501, 240502, 240503, 240504, 240505, 240506, 240508, + 240509, 240510, 240511, 240512, 240513, 240514, 240515, 240516, 240517, 240519, + 240520, 240521, 240522, 240523, 240524, 240525, 240526, 240527, 240528, 240530, + 240531, 240532, 240533, 240534, 240535, 240536, 240537, 240538, 240539, 240541, 0 }; +const uint DESKBOT_RANGE39[] = { 240587, 240588, 0 }; +const uint DESKBOT_RANGE40[] = { 240589, 240590, 240591, 241652, 0 }; + +const uint DESKBOT_RANGE41[] = { 240592, 240593, 240594, 241653, 0 }; +const uint DESKBOT_RANGE42[] = { 240595, 240596, 0 }; +const uint DESKBOT_RANGE43[] = { 240597, 240598, 0 }; +const uint DESKBOT_RANGE44[] = { 240602, 240613, 240622, 240623, 240624, 240627, 240603, 240606, 240609, 0 }; +const uint DESKBOT_RANGE45[] = { 240629, 240630, 240354, 0 }; +const uint DESKBOT_RANGE46[] = { 240635, 240636, 240637, 0 }; +const uint DESKBOT_RANGE47[] = { + 240640, 240656, 240667, 240678, 240689, 240699, 240710, 240721, 240732, 240641, + 240647, 240648, 240649, 240650, 240651, 240652, 240653, 240654, 240655, 240657, + 240658, 240659, 240660, 240661, 240662, 240663, 240664, 240665, 240666, 240668, + 240669, 240670, 240671, 240672, 240673, 240674, 240675, 240676, 240677, 240679, + 240680, 240681, 240682, 240683, 240684, 240685, 240686, 240687, 240688, 240690, + 240691, 240692, 240693, 240694, 240695, 240696, 240697, 240698, 240700, 240701, + 240702, 240703, 240704, 240705, 240706, 240707, 240708, 240709, 240711, 240712, + 240713, 240714, 240715, 240716, 240717, 240718, 240719, 240720, 240722, 240723, + 240724, 240725, 240726, 240727, 240728, 240729, 240730, 240731, 240733, 240734, + 240735, 240736, 240737, 240738, 240739, 240740, 240741, 240742, 240642, 240643, + 240644, 240645, 240646, 0 +}; +const uint DESKBOT_RANGE48[] = { 240758, 240759, 240760, 0 }; +const uint DESKBOT_RANGE49[] = { 240761, 240762, 240764, 240766, 0 }; +const uint DESKBOT_RANGE50[] = { 240335, 240776, 240778, 240779, 240780, 240781, 0 }; + +const uint DESKBOT_RANGE51[] = { 240335, 240776, 240777, 240778, 240779, 240780, 240781, 0 }; +const uint DESKBOT_RANGE52[] = { 240782, 240783, 240834, 240592, 240589, 240768, 240770, 240771, 240769, 240772, +240773, 240590, 240593, 240595, 240587, 240597, 240591, 240594, 240596, 240588, +240598, 241120, 240675, 241124, 0 }; +const uint DESKBOT_RANGE53[] = { 240787, 240788, 240789, 240790, 240791, 241635, 0 }; +const uint DESKBOT_RANGE54[] = { 240792, 240793, 240794, 240795, 240796, 240797, 241635, 0 }; +const uint DESKBOT_RANGE55[] = { 240798, 240799, 240800, 241635, 0 }; +const uint DESKBOT_RANGE56[] = { 240804, 240806, 240807, 240808, 0 }; +const uint DESKBOT_RANGE57[] = { 240809, 240820, 240822, 240823, 240824, 240825, 240826, 240827, 240828, 240829, +240810, 240811, 240812, 240813, 240814, 240815, 240816, 240817, 240818, 240819, +240821, 0 }; +const uint DESKBOT_RANGE58[] = { 240835, 240836, 240837, 240838, 240839, 240840, 0 }; +const uint DESKBOT_RANGE59[] = { 240861, 240862, 240863, 0 }; +const uint DESKBOT_RANGE60[] = { 240881, 240883, 240884, 240885, 240886, 240887, 240888, 240889, 240890, 240882, 0 }; + +const uint DESKBOT_RANGE61[] = { 240894, 240895, 240896, 240897, 240898, 240899, 240900, 240901, 240902, 0 }; +const uint DESKBOT_RANGE62[] = { 240904, 240905, 240906, 240907, 240908, 241342, 0 }; +const uint DESKBOT_RANGE63[] = { 240911, 240922, 240930, 240932, 240933, 240934, 240935, 240936, 240937, 240912, + 240913, 240914, 240915, 240916, 240917, 240918, 240919, 240920, 240921, 240923, + 240931, 240925, 240926, 240927, 240928, 240929, 0 +}; +const uint DESKBOT_RANGE64[] = { 240948, 240949, 240950, 240951, 0 }; +const uint DESKBOT_RANGE65[] = { 240959, 240960, 240961, 240962, 0 }; +const uint DESKBOT_RANGE66[] = { 240965, 240966, 0 }; +const uint DESKBOT_RANGE67[] = { 240972, 240973, 240974, 0 }; +const uint DESKBOT_RANGE68[] = { 240977, 240978, 240979, 240980, 0 }; +const uint DESKBOT_RANGE69[] = { 240982, 240983, 240984, 240985, 0 }; +const uint DESKBOT_RANGE70[] = { 240988, 240989, 240990, 240991, 0 }; + +const uint DESKBOT_RANGE71[] = { 240992, 240994, 240995, 240996, 240997, 240998, 241000, 241001, 0 }; +const uint DESKBOT_RANGE72[] = { 241002, 241004, 241005, 241006, 241007, 241008, 241009, 241010, 241011, 241003, 0 }; +const uint DESKBOT_RANGE73[] = { + 241012, 241023, 241034, 241045, 241050, 241051, 241052, 241053, 241054, 241013, + 241014, 241015, 241016, 241017, 241018, 241019, 241020, 241021, 241022, 241024, + 241025, 241026, 241027, 241028, 241029, 241030, 241031, 241032, 241033, 241035, + 241036, 241037, 241038, 241039, 241040, 241041, 241042, 241043, 241044, 241046, + 241047, 241048, 241049, 0 +}; +const uint DESKBOT_RANGE74[] = { 241055, 241057, 241058, 241059, 241060, 241061, 241062, 241063, 241064, 241056, 0 }; +const uint DESKBOT_RANGE75[] = { 241078, 241079, 241080, 241081, 241082, 241083, 241084, 241085, 0 }; +const uint DESKBOT_RANGE76[] = { 241091, 241092, 241093, 241094, 241095, 0 }; +const uint DESKBOT_RANGE77[] = { 241103, 241104, 241105, 241106, 241107, 0 }; +const uint DESKBOT_RANGE78[] = { + 241132, 241127, 241133, 241140, 241151, 241152, 241153, 241154, 241155, 241156, + 241157, 241128, 241129, 241130, 241131, 241136, 241137, 241138, 241139, 241141, + 241142, 241143, 241144, 241145, 241146, 241147, 241148, 241149, 241150, 0 +}; +const uint DESKBOT_RANGE79[] = { 240404, 241099, 0 }; +const uint DESKBOT_RANGE80[] = { 241125, 241124, 241125, 241125, 240649, 240729, 241686, 241680, 241738, 0 }; + +const uint DESKBOT_RANGE81[] = { 241096, 241112, 240727, 241679, 241738, 0 }; +const uint DESKBOT_RANGE82[] = { 240833, 240845, 241464, 241465, 241674, 241738, 0 }; +const uint DESKBOT_RANGE83[] = { 240726, 241684, 241738, 0 }; +const uint DESKBOT_RANGE84[] = { 240728, 240728, 240728, 240644, 240953, 240728, 240601, 240728, 241075, 240728, +240952, 240728, 240600, 241120, 241683, 241738, 241738, 241738, 0 }; +const uint DESKBOT_RANGE85[] = { 240730, 241738, 0 }; +const uint DESKBOT_RANGE86[] = { 240008, 240009, 240010, 240011, 240012, 240013, 240004, 240005, 0 }; +const uint DESKBOT_RANGE87[] = { 240677, 240680, 240766, 241109, 240633, 240747, 240940, 241187, 241120, 240665, +240669, 240620, 0 }; +const uint DESKBOT_RANGE88[] = { + 240948, 240602, 240613, 240622, 240624, 240625, 240626, 240627, 240603, 240605, + 240607, 240609, 240610, 241150, 240925, 240882, 240864, 241072, 240942, 240867, + 241096, 240971, 240785, 240868, 240833, 240955, 241077, 240877, 240754, 241163, + 241071, 241161, 240871, 241114, 240963, 240956, 240750, 240958, 240851, 240866, + 241100, 240941, 241115, 241088, 240628, 240846, 240857, 241164, 241165, 240954, + 241087, 240869, 240784, 240637, 240700, 240701, 240704, 240929, 240716, 240717, + 240720, 240689, 240732, 240648, 240653, 240664, 240676, 0 +}; +const uint DESKBOT_RANGE89[] = { 241012, 0 }; +const uint DESKBOT_RANGE90[] = { 240775, 240419, 240701, 240642, 240802, 240891, 241110, 241568, 241569, 241570, 241571, 0 }; + +const uint DESKBOT_RANGE91[] = { 241338, 240831, 0 }; +const uint DESKBOT_RANGE92[] = { 240416, 241343, 0 }; +const uint DESKBOT_RANGE93[] = { 241577, 241578, 241579, 241580, 241581, 241582, 0 }; +const uint DESKBOT_RANGE94[] = { 241383, 241586, 0 }; +const uint DESKBOT_RANGE95[] = { 241446, 241447, 241448, 0 }; +const uint DESKBOT_RANGE96[] = { 241443, 241444, 241445, 0 }; +const uint DESKBOT_RANGE97[] = { 241116, 241365, 0 }; +const uint DESKBOT_RANGE98[] = { + 241522, 241523, 241524, 241525, 241526, 241527, 241528, 241529, 241530, 241531, + 241532, 241533, 241534, 241535, 241536, 241537, 241538, 241539, 241540, 241541, + 241542, 241543, 241544, 241545, 241546, 241547, 241548, 241549, 241550, 241551, + 241552, 241553, 241554, 0 +}; +const uint DESKBOT_RANGE99[] = { 241341, 241634, 0 }; +const uint DESKBOT_RANGE100[] = { 241449, 241635, 241450, 241635, 0 }; + +const uint DESKBOT_RANGE101[] = { 241638, 241639, 241640, 241654, 241655, 241643, 0 }; +const uint DESKBOT_RANGE102[] = { 241702, 241703, 241704, 0 }; +const uint DESKBOT_RANGE103[] = { 240465, 241641, 0 }; +const uint DESKBOT_RANGE104[] = { 241371, 241111, 0 }; + +#define DESKBOT_RANGE_COUNT 146 +const ScriptRange DESKBOT_RANGES[146] = { + { 240546, DESKBOT_RANGE1, false, false }, + { 240547, DESKBOT_RANGE2, false, false }, + { 240548, DESKBOT_RANGE3, false, false }, + { 240549, DESKBOT_RANGE4, false, false }, + { 240550, DESKBOT_RANGE5, false, false }, + { 240551, DESKBOT_RANGE6, false, false }, + { 240552, DESKBOT_RANGE7, false, false }, + { 240553, DESKBOT_RANGE8, false, false }, + { 240554, DESKBOT_RANGE9, false, false }, + { 240555, DESKBOT_RANGE10, false, false }, + + { 240556, DESKBOT_RANGE11, false, false }, + { 240557, DESKBOT_RANGE12, false, false }, + { 240558, DESKBOT_RANGE13, false, false }, + { 240559, DESKBOT_RANGE14, false, false }, + { 240560, DESKBOT_RANGE15, false, false }, + { 240561, DESKBOT_RANGE16, false, false }, + { 240562, DESKBOT_RANGE17, false, false }, + { 240563, DESKBOT_RANGE18, false, false }, + { 240564, DESKBOT_RANGE19, false, false }, + { 240565, DESKBOT_RANGE20, false, false }, + + { 240566, DESKBOT_RANGE21, false, false }, + { 240567, DESKBOT_RANGE22, false, false }, + { 240568, DESKBOT_RANGE23, false, false }, + { 240569, DESKBOT_RANGE24, false, false }, + { 240570, DESKBOT_RANGE25, false, false }, + { 240571, DESKBOT_RANGE26, false, false }, + { 240572, DESKBOT_RANGE27, false, false }, + { 240573, DESKBOT_RANGE28, false, false }, + { 240574, DESKBOT_RANGE29, false, false }, + { 240575, DESKBOT_RANGE30, false, false }, + + { 240576, DESKBOT_RANGE31, false, false }, + { 240577, DESKBOT_RANGE32, false, false }, + { 240578, DESKBOT_RANGE33, false, false }, + { 240579, DESKBOT_RANGE34, false, false }, + { 240580, DESKBOT_RANGE35, false, false }, + { 240581, DESKBOT_RANGE36, false, false }, + { 240582, DESKBOT_RANGE37, false, false }, + { 240583, DESKBOT_RANGE38, false, false }, + { 241167, DESKBOT_RANGE39, false, false }, + { 241168, DESKBOT_RANGE40, false, false }, + + { 241169, DESKBOT_RANGE41, false, false }, + { 241170, DESKBOT_RANGE42, false, false }, + { 241171, DESKBOT_RANGE43, false, false }, + { 241172, DESKBOT_RANGE44, false, false }, + { 241173, DESKBOT_RANGE45, false, false }, + { 241174, DESKBOT_RANGE46, false, false }, + { 241175, DESKBOT_RANGE47, false, false }, + { 241176, DESKBOT_RANGE48, false, false }, + { 241177, DESKBOT_RANGE49, false, false }, + { 241178, DESKBOT_RANGE50, false, false }, + + { 241179, DESKBOT_RANGE51, false, false }, + { 241180, DESKBOT_RANGE52, false, false }, + { 241181, DESKBOT_RANGE53, false, false }, + { 241182, DESKBOT_RANGE54, false, false }, + { 241183, DESKBOT_RANGE55, false, false }, + { 241184, DESKBOT_RANGE56, false, false }, + { 241185, DESKBOT_RANGE57, false, false }, + { 241186, DESKBOT_RANGE58, false, false }, + { 241187, DESKBOT_RANGE59, false, false }, + { 241188, DESKBOT_RANGE60, false, false }, + + { 241189, DESKBOT_RANGE61, false, false }, + { 241190, DESKBOT_RANGE62, false, false }, + { 241191, DESKBOT_RANGE63, false, false }, + { 241192, DESKBOT_RANGE64, false, false }, + { 241193, DESKBOT_RANGE65, false, false }, + { 241194, DESKBOT_RANGE66, false, false }, + { 241195, DESKBOT_RANGE67, false, false }, + { 241196, DESKBOT_RANGE68, false, false }, + { 241197, DESKBOT_RANGE69, false, false }, + { 241198, DESKBOT_RANGE70, false, false }, + + { 241199, DESKBOT_RANGE71, false, false }, + { 241200, DESKBOT_RANGE72, false, false }, + { 241201, DESKBOT_RANGE73, false, false }, + { 241202, DESKBOT_RANGE74, false, false }, + { 241203, DESKBOT_RANGE75, false, false }, + { 241204, DESKBOT_RANGE76, false, false }, + { 241205, DESKBOT_RANGE77, false, false }, + { 241166, DESKBOT_RANGE78, false, false }, + { 241206, DESKBOT_RANGE79, false, false }, + { 241207, DESKBOT_RANGE80, false, false }, + + { 241208, DESKBOT_RANGE81, false, false }, + { 241209, DESKBOT_RANGE82, false, false }, + { 241210, DESKBOT_RANGE83, false, false }, + { 241211, DESKBOT_RANGE84, false, false }, + { 241212, DESKBOT_RANGE85, false, false }, + { 241213, DESKBOT_RANGE86, false, false }, + { 241214, DESKBOT_RANGE87, false, false }, + { 241215, DESKBOT_RANGE88, false, false }, + + { 241217, DESKBOT_RANGE89, false, false }, + { 241218, DESKBOT_RANGE89, false, false }, + { 241219, DESKBOT_RANGE89, false, false }, + { 241220, DESKBOT_RANGE89, false, false }, + { 241221, DESKBOT_RANGE89, false, false }, + { 241222, DESKBOT_RANGE89, false, false }, + { 241223, DESKBOT_RANGE89, false, false }, + { 241224, DESKBOT_RANGE89, false, false }, + { 241225, DESKBOT_RANGE89, false, false }, + { 241226, DESKBOT_RANGE89, false, false }, + { 241227, DESKBOT_RANGE89, false, false }, + { 241228, DESKBOT_RANGE89, false, false }, + { 241229, DESKBOT_RANGE89, false, false }, + { 241230, DESKBOT_RANGE89, false, false }, + { 241231, DESKBOT_RANGE89, false, false }, + { 241232, DESKBOT_RANGE89, false, false }, + { 241233, DESKBOT_RANGE89, false, false }, + { 241234, DESKBOT_RANGE89, false, false }, + { 241235, DESKBOT_RANGE89, false, false }, + { 241236, DESKBOT_RANGE89, false, false }, + { 241237, DESKBOT_RANGE89, false, false }, + { 241238, DESKBOT_RANGE89, false, false }, + { 241239, DESKBOT_RANGE89, false, false }, + { 241240, DESKBOT_RANGE89, false, false }, + { 241241, DESKBOT_RANGE89, false, false }, + { 241242, DESKBOT_RANGE89, false, false }, + { 241243, DESKBOT_RANGE89, false, false }, + { 241244, DESKBOT_RANGE89, false, false }, + { 241245, DESKBOT_RANGE89, false, false }, + { 241246, DESKBOT_RANGE89, false, false }, + { 241247, DESKBOT_RANGE89, false, false }, + { 241248, DESKBOT_RANGE89, false, false }, + { 241249, DESKBOT_RANGE89, false, false }, + { 241250, DESKBOT_RANGE89, false, false }, + { 241251, DESKBOT_RANGE89, false, false }, + { 241252, DESKBOT_RANGE89, false, false }, + { 241253, DESKBOT_RANGE89, false, false }, + { 241254, DESKBOT_RANGE89, false, false }, + { 241255, DESKBOT_RANGE89, false, false }, + { 241256, DESKBOT_RANGE89, false, false }, + { 241257, DESKBOT_RANGE89, false, false }, + { 241258, DESKBOT_RANGE89, false, false }, + { 241259, DESKBOT_RANGE89, false, false }, + + { 241216, DESKBOT_RANGE90, false, false }, + { 241625, DESKBOT_RANGE91, false, false }, + { 241626, DESKBOT_RANGE92, false, false }, + { 241627, DESKBOT_RANGE93, false, false }, + { 241628, DESKBOT_RANGE94, false, false }, + { 241629, DESKBOT_RANGE95, false, false }, + { 241630, DESKBOT_RANGE96, false, false }, + { 241631, DESKBOT_RANGE97, false, false }, + { 241632, DESKBOT_RANGE98, false, false }, + { 241633, DESKBOT_RANGE99, false, false }, + { 241634, DESKBOT_RANGE100, false, false }, + + { 241738, DESKBOT_RANGE101, false, false }, + { 241739, DESKBOT_RANGE102, false, false }, + { 241740, DESKBOT_RANGE103, false, false }, + { 241741, DESKBOT_RANGE104, false, false } +}; void writeScriptRange(const char *name, const ScriptRange *ranges, int count) { outputFile.seek(dataOffset); @@ -223,7 +548,6 @@ void writeScriptRange(const char *name, const ScriptRange *ranges, int count) { outputFile.writeLong(*v); } while (*v++ != 0); } - outputFile.writeLong(0); uint size = outputFile.size() - dataOffset; writeEntryHeader(name, dataOffset, size); @@ -231,5 +555,6 @@ void writeScriptRange(const char *name, const ScriptRange *ranges, int count) { } void writeAllScriptRanges() { - writeScriptRange("Ranges/Barbot", BARBOT_RANGES, 70); + writeScriptRange("Ranges/Barbot", BARBOT_RANGES, BARBOT_RANGE_COUNT); + writeScriptRange("Ranges/Deskbot", DESKBOT_RANGES, DESKBOT_RANGE_COUNT); } \ No newline at end of file diff --git a/devtools/create_titanic/script_ranges.h b/devtools/create_titanic/script_ranges.h index 70caac1791..3013a32139 100644 --- a/devtools/create_titanic/script_ranges.h +++ b/devtools/create_titanic/script_ranges.h @@ -27,7 +27,7 @@ struct ScriptRange { uint _id; - uint *_array; + const uint *_array; bool _isRandom; bool _isSequential; }; -- cgit v1.2.3 From 16797bd75ff0bbbfbd52c99ad3f7d5ac884b37a5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 6 Jun 2016 22:40:34 -0400 Subject: TITANIC: Add loading of Deskbot ranges --- engines/titanic/true_talk/deskbot_script.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 85b59b062a..7efd925fb0 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -40,6 +40,7 @@ DeskbotScript::DeskbotScript(int val1, const char *charClass, int v2, if (_field74 == 1) _field74 = 0; + loadRanges("Ranges/Deskbot"); loadResponses("Responses/Deskbot", 4); } -- cgit v1.2.3 From 565940d27c159823468bb2d059e3695d72974530 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 6 Jun 2016 23:13:54 -0400 Subject: DEVTOOLS: Added Doorbot ranges to create_titanic --- devtools/create_titanic/script_ranges.cpp | 207 +++++++++++++++++++++++------- 1 file changed, 164 insertions(+), 43 deletions(-) diff --git a/devtools/create_titanic/script_ranges.cpp b/devtools/create_titanic/script_ranges.cpp index 25d3b8ee7e..58dcecf8b6 100644 --- a/devtools/create_titanic/script_ranges.cpp +++ b/devtools/create_titanic/script_ranges.cpp @@ -399,28 +399,28 @@ const ScriptRange DESKBOT_RANGES[146] = { { 240565, DESKBOT_RANGE20, false, false }, { 240566, DESKBOT_RANGE21, false, false }, - { 240567, DESKBOT_RANGE22, false, false }, + { 240567, DESKBOT_RANGE22, true, false }, { 240568, DESKBOT_RANGE23, false, false }, { 240569, DESKBOT_RANGE24, false, false }, { 240570, DESKBOT_RANGE25, false, false }, { 240571, DESKBOT_RANGE26, false, false }, { 240572, DESKBOT_RANGE27, false, false }, - { 240573, DESKBOT_RANGE28, false, false }, + { 240573, DESKBOT_RANGE28, true, false }, { 240574, DESKBOT_RANGE29, false, false }, { 240575, DESKBOT_RANGE30, false, false }, { 240576, DESKBOT_RANGE31, false, false }, - { 240577, DESKBOT_RANGE32, false, false }, - { 240578, DESKBOT_RANGE33, false, false }, + { 240577, DESKBOT_RANGE32, true, false }, + { 240578, DESKBOT_RANGE33, true, false }, { 240579, DESKBOT_RANGE34, false, false }, - { 240580, DESKBOT_RANGE35, false, false }, + { 240580, DESKBOT_RANGE35, true, false }, { 240581, DESKBOT_RANGE36, false, false }, { 240582, DESKBOT_RANGE37, false, false }, { 240583, DESKBOT_RANGE38, false, false }, { 241167, DESKBOT_RANGE39, false, false }, - { 241168, DESKBOT_RANGE40, false, false }, + { 241168, DESKBOT_RANGE40, true, false }, - { 241169, DESKBOT_RANGE41, false, false }, + { 241169, DESKBOT_RANGE41, true, false }, { 241170, DESKBOT_RANGE42, false, false }, { 241171, DESKBOT_RANGE43, false, false }, { 241172, DESKBOT_RANGE44, false, false }, @@ -429,29 +429,29 @@ const ScriptRange DESKBOT_RANGES[146] = { { 241175, DESKBOT_RANGE47, false, false }, { 241176, DESKBOT_RANGE48, false, false }, { 241177, DESKBOT_RANGE49, false, false }, - { 241178, DESKBOT_RANGE50, false, false }, - - { 241179, DESKBOT_RANGE51, false, false }, - { 241180, DESKBOT_RANGE52, false, false }, - { 241181, DESKBOT_RANGE53, false, false }, - { 241182, DESKBOT_RANGE54, false, false }, - { 241183, DESKBOT_RANGE55, false, false }, - { 241184, DESKBOT_RANGE56, false, false }, + { 241178, DESKBOT_RANGE50, true, false }, + + { 241179, DESKBOT_RANGE51, true, false }, + { 241180, DESKBOT_RANGE52, true, false }, + { 241181, DESKBOT_RANGE53, true, false }, + { 241182, DESKBOT_RANGE54, true, false }, + { 241183, DESKBOT_RANGE55, true, false }, + { 241184, DESKBOT_RANGE56, true, false }, { 241185, DESKBOT_RANGE57, false, false }, { 241186, DESKBOT_RANGE58, false, false }, { 241187, DESKBOT_RANGE59, false, false }, - { 241188, DESKBOT_RANGE60, false, false }, + { 241188, DESKBOT_RANGE60, true, false }, { 241189, DESKBOT_RANGE61, false, false }, - { 241190, DESKBOT_RANGE62, false, false }, - { 241191, DESKBOT_RANGE63, false, false }, + { 241190, DESKBOT_RANGE62, true, false }, + { 241191, DESKBOT_RANGE63, true, false }, { 241192, DESKBOT_RANGE64, false, false }, { 241193, DESKBOT_RANGE65, false, false }, { 241194, DESKBOT_RANGE66, false, false }, { 241195, DESKBOT_RANGE67, false, false }, { 241196, DESKBOT_RANGE68, false, false }, - { 241197, DESKBOT_RANGE69, false, false }, - { 241198, DESKBOT_RANGE70, false, false }, + { 241197, DESKBOT_RANGE69, true, false }, + { 241198, DESKBOT_RANGE70, true, false }, { 241199, DESKBOT_RANGE71, false, false }, { 241200, DESKBOT_RANGE72, false, false }, @@ -462,16 +462,16 @@ const ScriptRange DESKBOT_RANGES[146] = { { 241205, DESKBOT_RANGE77, false, false }, { 241166, DESKBOT_RANGE78, false, false }, { 241206, DESKBOT_RANGE79, false, false }, - { 241207, DESKBOT_RANGE80, false, false }, + { 241207, DESKBOT_RANGE80, true, false }, - { 241208, DESKBOT_RANGE81, false, false }, - { 241209, DESKBOT_RANGE82, false, false }, - { 241210, DESKBOT_RANGE83, false, false }, - { 241211, DESKBOT_RANGE84, false, false }, - { 241212, DESKBOT_RANGE85, false, false }, - { 241213, DESKBOT_RANGE86, false, false }, - { 241214, DESKBOT_RANGE87, false, false }, - { 241215, DESKBOT_RANGE88, false, false }, + { 241208, DESKBOT_RANGE81, true, false }, + { 241209, DESKBOT_RANGE82, true, false }, + { 241210, DESKBOT_RANGE83, true, false }, + { 241211, DESKBOT_RANGE84, true, false }, + { 241212, DESKBOT_RANGE85, true, false }, + { 241213, DESKBOT_RANGE86, true, false }, + { 241214, DESKBOT_RANGE87, true, false }, + { 241215, DESKBOT_RANGE88, true, false }, { 241217, DESKBOT_RANGE89, false, false }, { 241218, DESKBOT_RANGE89, false, false }, @@ -517,22 +517,142 @@ const ScriptRange DESKBOT_RANGES[146] = { { 241258, DESKBOT_RANGE89, false, false }, { 241259, DESKBOT_RANGE89, false, false }, - { 241216, DESKBOT_RANGE90, false, false }, + { 241216, DESKBOT_RANGE90, true, false }, { 241625, DESKBOT_RANGE91, false, false }, - { 241626, DESKBOT_RANGE92, false, false }, + { 241626, DESKBOT_RANGE92, true, false }, { 241627, DESKBOT_RANGE93, false, false }, - { 241628, DESKBOT_RANGE94, false, false }, - { 241629, DESKBOT_RANGE95, false, false }, - { 241630, DESKBOT_RANGE96, false, false }, - { 241631, DESKBOT_RANGE97, false, false }, - { 241632, DESKBOT_RANGE98, false, false }, - { 241633, DESKBOT_RANGE99, false, false }, - { 241634, DESKBOT_RANGE100, false, false }, - - { 241738, DESKBOT_RANGE101, false, false }, - { 241739, DESKBOT_RANGE102, false, false }, - { 241740, DESKBOT_RANGE103, false, false }, - { 241741, DESKBOT_RANGE104, false, false } + { 241628, DESKBOT_RANGE94, true, false }, + { 241629, DESKBOT_RANGE95, true, false }, + { 241630, DESKBOT_RANGE96, true, false }, + { 241631, DESKBOT_RANGE97, true, false }, + { 241632, DESKBOT_RANGE98, true, false }, + { 241633, DESKBOT_RANGE99, true, false }, + { 241634, DESKBOT_RANGE100, true, false }, + + { 241738, DESKBOT_RANGE101, true, false }, + { 241739, DESKBOT_RANGE102, true, false }, + { 241740, DESKBOT_RANGE103, true, false }, + { 241741, DESKBOT_RANGE104, true, false } +}; + +const uint DOORBOT_RANGE1[] = { 220075, 220078, 220080, 220081, 220082, 220083, 220084, 0 }; +const uint DOORBOT_RANGE2[] = { 220077, 220079, 220076, 0 }; +const uint DOORBOT_RANGE3[] = { + 220008, 220009, 220010, 220011, 220012, 220013, 220014, + 220015, 220016, 221053, 221054, 221055, 221056, 221057, + 221058, 221059, 221060, 221061, 0 +}; +const uint DOORBOT_RANGE4[] = { + 221062, 221063, 221064, 221065, 221066, 221067, 221068, + 221069, 221070, 221071, 221072, 221073, 221074, 221075, + 221076, 221077, 221078, 221079, 221080, 221081, 221082, + 0 +}; +const uint DOORBOT_RANGE5[] = { 220737, 220738, 220739, 220740, 0 }; +const uint DOORBOT_RANGE6[] = { 220759, 220760, 220761, 0 }; +const uint DOORBOT_RANGE7[] = { 220771, 220772, 220773, 220774, 220775, 0 }; +const uint DOORBOT_RANGE8[] = { 220792, 220793, 220794, 220795, 220796, 220797, 220798, 0 }; +const uint DOORBOT_RANGE9[] = { 220017, 220018, 220019, 220020, 220833, 0 }; +const uint DOORBOT_RANGE10[] = { 220035, 220036, 220038, 0 }; + +const uint DOORBOT_RANGE11[] = { 220093, 220094, 220095, 0 }; +const uint DOORBOT_RANGE12[] = { 220109, 220117, 0 }; +const uint DOORBOT_RANGE13[] = { 220837, 220838, 220839, 0 }; +const uint DOORBOT_RANGE14[] = { 220849, 220850, 220851, 220852, 0 }; +const uint DOORBOT_RANGE15[] = { 220858, 220860, 0 }; +const uint DOORBOT_RANGE16[] = { 221043, 221045, 221046, 221047, 221048, 221049, 221050, + 221051, 221052, 221044, 0 }; +const uint DOORBOT_RANGE17[] = { 221140, 221141, 221142, 221143, 221144, 221145, 221146, + 221147, 0 }; +const uint DOORBOT_RANGE18[] = { 220885, 220886, 220887, 220888, 220890, 220883, 220884, + 220889, 0 }; +const uint DOORBOT_RANGE19[] = { + 221356, 221364, 221365, 221366, 221129, 221367, 221368, + 221132, 221369, 221357, 221359, 221363, 220902, 0 +}; +const uint DOORBOT_RANGE20[] = { 221129, 221130, 221131, 221132, 221133, 221136, 221137, + 221138, 0 }; +const uint DOORBOT_RANGE21[] = { 221157, 221165, 221166, 221167, 221130, 221168, 221169, + 221132, 221170, 221171, 221158, 220910, 0 }; +const uint DOORBOT_RANGE22[] = { 221356, 221364, 221366, 221129, 221368, 221132, 221369, + 221357, 221359, 221363, 220902, 220919, 220911, 220936, + 220942, 220946, 220988, 0 +}; +const uint DOORBOT_RANGE23[] = { + 221157, 221165, 221166, 221167, 221130, 221168, 221169, + 221132, 221170, 221171, 221158, 220910, 220911, 220929, + 220944, 220948, 220909, 0 +}; +const uint DOORBOT_RANGE24[] = { 220980, 220981, 220982, 220984, 220956, 220931, 220926, + 220916, 220914, 220913, 220974, 220952, 0 }; +const uint DOORBOT_RANGE25[] = { 220873, 220874, 220875, 220876, 220877, 0 }; +const uint DOORBOT_RANGE26[] = { 221242, 221243, 221244, 221242, 221243, 221244, 221251, 0 }; +const uint DOORBOT_RANGE27[] = { 221245, 221246, 221247, 221248, 221249, 221250, 0 }; +const uint DOORBOT_RANGE28[] = { 221777, 221780, 0 }; +const uint DOORBOT_RANGE29[] = { 221966, 221967, 0 }; +const uint DOORBOT_RANGE30[] = { 220986, 222096, 222099, 222102, 0 }; +const uint DOORBOT_RANGE31[] = { 222193, 222197, 222198, 222199, 222200, 222201, 222202, + 222203, 222204, 222194, 222195, 222196, 0 }; +const uint DOORBOT_RANGE32[] = { 221927, 221931, 0 }; +const uint DOORBOT_RANGE33[] = { 221945, 221948, 0 }; +const uint DOORBOT_RANGE34[] = { 222004, 222001, 0 }; +const uint DOORBOT_RANGE35[] = { 222259, 222262, 222265, 222268, 222271, 222274, 222277, + 222280, 222283, 222254, 222257, 0 }; +const uint DOORBOT_RANGE36[] = { 221364, 221365, 221360, 221252, 220952, 220916, 220996, + 220924, 220926, 220931, 220956, 220967, 220968, 220980, + 220981, 220982, 220984, 220988, 0 }; +const uint DOORBOT_RANGE37[] = { + 221166, 221252, 220984, 220952, 220996, 220916, 220926, + 220931, 220948, 220965, 220967, 220980, 220981, 220982, + 220983, 220988, 220903, 221019, 221355, 0 }; +const uint DOORBOT_RANGE38[] = { 222248, 220081, 220082, 220083, 220084, 0 }; +const uint DOORBOT_RANGE39[] = { 221095, 222202, 222239, 221758, 221759, 221762, 221763, + 221766, 221767, 221768, 0 }; + +#define DOORBOT_RANGE_COUNT 39 +const ScriptRange DOORBOT_RANGES[39] = { + { 220074, DOORBOT_RANGE1, false, false }, + { 221381, DOORBOT_RANGE2, false, false }, + { 220000, DOORBOT_RANGE3, true, false }, + { 221380, DOORBOT_RANGE4, true, false }, + { 220736, DOORBOT_RANGE5, false, false }, + { 220759, DOORBOT_RANGE6, false, false }, + { 220771, DOORBOT_RANGE7, false, false }, + { 220792, DOORBOT_RANGE8, false, false }, + { 220017, DOORBOT_RANGE9, false, false }, + { 220037, DOORBOT_RANGE10, false, false }, + + { 220093, DOORBOT_RANGE11, false, false }, + { 220109, DOORBOT_RANGE12, false, false }, + { 220837, DOORBOT_RANGE13, false, false }, + { 220849, DOORBOT_RANGE14, false, false }, + { 220858, DOORBOT_RANGE15, false, false }, + { 221043, DOORBOT_RANGE16, false, false }, + { 221140, DOORBOT_RANGE17, false, false }, + { 220883, DOORBOT_RANGE18, false, false }, + { 221375, DOORBOT_RANGE19, true, false }, + { 221129, DOORBOT_RANGE20, true, false }, + + { 221376, DOORBOT_RANGE21, true, false }, + { 221377, DOORBOT_RANGE22, true, false }, + { 221378, DOORBOT_RANGE23, true, false }, + { 221379, DOORBOT_RANGE24, true, false }, + { 220873, DOORBOT_RANGE25, false, false }, + { 221242, DOORBOT_RANGE26, false, false }, + { 221245, DOORBOT_RANGE27, false, false }, + { 221777, DOORBOT_RANGE28, false, false }, + { 221966, DOORBOT_RANGE29, false, false }, + { 220986, DOORBOT_RANGE30, false, false }, + + { 222193, DOORBOT_RANGE31, false, false }, + { 221927, DOORBOT_RANGE32, false, false }, + { 221948, DOORBOT_RANGE33, false, true }, + { 222000, DOORBOT_RANGE34, false, false }, + { 222259, DOORBOT_RANGE35, false, false }, + { 222415, DOORBOT_RANGE36, true, false }, + { 222416, DOORBOT_RANGE37, true, false }, + { 222248, DOORBOT_RANGE38, false, false }, + { 221095, DOORBOT_RANGE39, true, false } }; void writeScriptRange(const char *name, const ScriptRange *ranges, int count) { @@ -557,4 +677,5 @@ void writeScriptRange(const char *name, const ScriptRange *ranges, int count) { void writeAllScriptRanges() { writeScriptRange("Ranges/Barbot", BARBOT_RANGES, BARBOT_RANGE_COUNT); writeScriptRange("Ranges/Deskbot", DESKBOT_RANGES, DESKBOT_RANGE_COUNT); + writeScriptRange("Ranges/Doorbot", DOORBOT_RANGES, DOORBOT_RANGE_COUNT); } \ No newline at end of file -- cgit v1.2.3 From 0825f00bccfe94f055afba4ba721f73d8a6297fe Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 6 Jun 2016 23:37:27 -0400 Subject: DEVTOOLS: Added Liftbot ranges to create_titanic --- devtools/create_titanic/script_ranges.cpp | 111 ++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) diff --git a/devtools/create_titanic/script_ranges.cpp b/devtools/create_titanic/script_ranges.cpp index 58dcecf8b6..8f52bd17c9 100644 --- a/devtools/create_titanic/script_ranges.cpp +++ b/devtools/create_titanic/script_ranges.cpp @@ -655,6 +655,116 @@ const ScriptRange DOORBOT_RANGES[39] = { { 221095, DOORBOT_RANGE39, true, false } }; +const uint LIFTBOT_RANGE1[] = { 210028, 210034, 210039, 210044, 210049, 210054, 0 }; +const uint LIFTBOT_RANGE2[] = { 210321, 210322, 210323, 210324, 210792, 210794, 210796, 210793, 210795, 210797, 0 }; +const uint LIFTBOT_RANGE3[] = { + 210572, 210568, 210338, 210341, 210355, 210419, 210430, 210441, 210460, 210463, + 210464, 210475, 210477, 210496, 210497, 210503, 210357, 210359, 210372, 210382, + 210388, 210393, 210394, 210400, 210415, 0 +}; +const uint LIFTBOT_RANGE4[] = { + 210568, 210342, 210555, 210551, 210534, 210557, 210334, 210474, 210504, 210505, + 210517, 210358, 210359, 210360, 210376, 210378, 210379, 210382, 210396, 210398, + 210402, 0 +}; +const uint LIFTBOT_RANGE5[] = { + 210572, 210568, 210397, 210408, 210419, 210430, 210441, 210460, 210463, 210464, + 210475, 210477, 210496, 210497, 210503, 210357, 210359, 210372, 210382, 210388, + 210393, 210394, 210400, 210415, 0 +}; +const uint LIFTBOT_RANGE6[] = { + 210555, 210551, 210534, 210557, 210334, 210474, 210504, 210505, 210517, 210358, + 210359, 210360, 210376, 210378, 210379, 210382, 210396, 210398, 210402, 0 +}; +const uint LIFTBOT_RANGE7[] = { 210344, 210447, 210529, 210530, 210351, 210356, 210378, 0 }; +const uint LIFTBOT_RANGE8[] = { 210512, 210513, 210345, 0 }; +const uint LIFTBOT_RANGE9[] = { 210847, 210848, 210153, 0 }; +const uint LIFTBOT_RANGE10[] = { 210846, 210153, 0 }; + +const uint LIFTBOT_RANGE11[] = { 210595, 210601, 210602, 210603, 210604, 210605, 210606, 210607, 210608, 210596, + 210597, 210598, 210599, 210600, 0 }; +const uint LIFTBOT_RANGE12[] = { 210489, 210570, 210610, 210610, 210610, 210610, 210610, 0 }; +const uint LIFTBOT_RANGE13[] = { 210819, 210822, 210823, 210824, 210825, 210827, 210828, 210829, 210820, 210821, + 210965, 210969, 210965, 210969, 0 }; +const uint LIFTBOT_RANGE14[] = { 210869, 210870, 210871, 210872, 210873, 0 }; +const uint LIFTBOT_RANGE15[] = { 210875, 210876, 210877, 210878, 210879, 0 }; +const uint LIFTBOT_RANGE16[] = { 210866, 210867, 0 }; +const uint LIFTBOT_RANGE17[] = { 210853, 210854, 0 }; +const uint LIFTBOT_RANGE18[] = { 210858, 210859, 0 }; +const uint LIFTBOT_RANGE19[] = { 210860, 210861, 210862, 210863, 210864, 210865, 0 }; +const uint LIFTBOT_RANGE20[] = { 210771, 210914, 0 }; + +const uint LIFTBOT_RANGE21[] = { 210764, 210765, 210766, 210767, 210768, 210769, 210770, 0 }; +const uint LIFTBOT_RANGE22[] = { 210607, 210799, 210800, 210801, 210802, 210815, 210890, 210892, 0 }; +const uint LIFTBOT_RANGE23[] = { 210355, 210359, 210376, 210388, 210416, 210568, 210551, 0 }; +const uint LIFTBOT_RANGE24[] = { 210511, 210522, 210382, 210383, 210392, 210337, 210546, 210576, 0 }; +const uint LIFTBOT_RANGE25[] = { 210775, 210777, 210778, 210779, 210780, 210781, 210782, 210783, 210784, 210776, + 210459, 210789, 210790, 210791, 0 }; +const uint LIFTBOT_RANGE26[] = { 210780, 210781, 210782, 210783, 210784, 210780, 210781, 210782, 210783, 210784, + 210789, 210790, 210791, 0 }; +const uint LIFTBOT_RANGE27[] = { 210440, 210442, 0 }; +const uint LIFTBOT_RANGE28[] = { 210906, 210907, 210908, 210909, 210910, 210911, 210912, 0 }; +const uint LIFTBOT_RANGE29[] = { 210901, 210902, 210903, 210904, 210905, 0 }; +const uint LIFTBOT_RANGE30[] = { 210970, 210971, 210974, 210975, 210976, 210977, 210978, 210979, 210980, 210981, + 210972, 210973, 0 }; + +const uint LIFTBOT_RANGE31[] = { 210830, 210831, 210832, 210833, 210834, 210835, 210836, 210837, 0 }; +const uint LIFTBOT_RANGE32[] = { 210692, 210695, 210696, 210697, 210698, 210699, 210700, 210701, 210702, 210693, 210694, 0 }; +const uint LIFTBOT_RANGE33[] = { 210915, 210916, 210917, 0 }; +const uint LIFTBOT_RANGE34[] = { 210688, 210689, 210690, 0 }; +const uint LIFTBOT_RANGE35[] = { 210946, 210947, 210948, 210949, 210950, 210951, 210952, 210953, 210954, 0 }; +const uint LIFTBOT_RANGE36[] = { 210923, 210924, 0 }; +const uint LIFTBOT_RANGE37[] = { 210925, 210926, 210927, 210928, 210929, 210930, 210931, 210932, 210933, 0 }; +const uint LIFTBOT_RANGE38[] = { 210413, 210799, 210800, 210801, 210802, 210888, 210889, 210890, 210891, 210892, 0 }; +const uint LIFTBOT_RANGE39[] = { 210682, 210684, 210028, 210034, 210683, 210039, 210685, 210044, 210049, 210686, + 210054, 0 }; + +#define LIFTBOT_RANGE_COUNT 40 +const ScriptRange LIFTBOT_RANGES[40] = { + { 210033, LIFTBOT_RANGE1, false, false }, + { 210321, LIFTBOT_RANGE2, true, false }, + { 210580, LIFTBOT_RANGE3, true, false }, + { 210581, LIFTBOT_RANGE4, true, false }, + { 210582, LIFTBOT_RANGE5, true, false }, + { 210583, LIFTBOT_RANGE6, true, false }, + { 210584, LIFTBOT_RANGE7, true, false }, + { 210585, LIFTBOT_RANGE8, true, false }, + { 210586, LIFTBOT_RANGE9, false, false }, + { 210587, LIFTBOT_RANGE10, false, false }, + + { 210588, LIFTBOT_RANGE11, true, false }, + { 210589, LIFTBOT_RANGE12, true, false }, + { 210590, LIFTBOT_RANGE13, true, false }, + { 210869, LIFTBOT_RANGE14, false, false }, + { 210875, LIFTBOT_RANGE15, false, false }, + { 210866, LIFTBOT_RANGE16, false, false }, + { 210853, LIFTBOT_RANGE17, false, false }, + { 210858, LIFTBOT_RANGE18, false, false }, + { 210860, LIFTBOT_RANGE19, false, false }, + { 210771, LIFTBOT_RANGE20, false, false }, + + { 210764, LIFTBOT_RANGE21, false, false }, + { 210958, LIFTBOT_RANGE22, true, false }, + { 210591, LIFTBOT_RANGE23, true, false }, + { 210592, LIFTBOT_RANGE24, true, false }, + { 210594, LIFTBOT_RANGE25, true, false }, + { 210593, LIFTBOT_RANGE26, true, false }, + { 210440, LIFTBOT_RANGE27, false, false }, + { 210906, LIFTBOT_RANGE28, true, false }, + { 210901, LIFTBOT_RANGE29, true, false }, + { 210970, LIFTBOT_RANGE30, false, false }, + + { 210830, LIFTBOT_RANGE31, true, false }, + { 210692, LIFTBOT_RANGE32, false, false }, + { 210915, LIFTBOT_RANGE33, false, false }, + { 210688, LIFTBOT_RANGE34, false, false }, + { 210946, LIFTBOT_RANGE35, true, false }, + { 210923, LIFTBOT_RANGE36, false, false }, + { 210925, LIFTBOT_RANGE37, true, false }, + { 210413, LIFTBOT_RANGE38, true, false }, + { 210682, LIFTBOT_RANGE39, false, false } +}; + void writeScriptRange(const char *name, const ScriptRange *ranges, int count) { outputFile.seek(dataOffset); @@ -678,4 +788,5 @@ void writeAllScriptRanges() { writeScriptRange("Ranges/Barbot", BARBOT_RANGES, BARBOT_RANGE_COUNT); writeScriptRange("Ranges/Deskbot", DESKBOT_RANGES, DESKBOT_RANGE_COUNT); writeScriptRange("Ranges/Doorbot", DOORBOT_RANGES, DOORBOT_RANGE_COUNT); + writeScriptRange("Ranges/Liftbot", LIFTBOT_RANGES, LIFTBOT_RANGE_COUNT); } \ No newline at end of file -- cgit v1.2.3 From 96f700a205d983111ffccf2eed25ab728d40434c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 7 Jun 2016 19:11:07 -0400 Subject: DEVTOOLS: Added MaitreD ranges to create_titanic --- devtools/create_titanic/script_ranges.cpp | 249 ++++++++++++++++++++++++++++++ 1 file changed, 249 insertions(+) diff --git a/devtools/create_titanic/script_ranges.cpp b/devtools/create_titanic/script_ranges.cpp index 8f52bd17c9..511d2664f2 100644 --- a/devtools/create_titanic/script_ranges.cpp +++ b/devtools/create_titanic/script_ranges.cpp @@ -765,6 +765,254 @@ const ScriptRange LIFTBOT_RANGES[40] = { { 210682, LIFTBOT_RANGE39, false, false } }; +const uint MAITRED_RANGE1[] = { 260009, 260010, 260011, 260012, 0 }; +const uint MAITRED_RANGE2[] = { + 260043, 260013, 260044, 260014, 260017, 260015, 260016, 260040, 260042, 260019, + 260029, 260021, 260018, 260020, 260022, 260023, 260041, 260028, 260045, 260031, + 260032, 260033, 260030, 260046, 260034, 260039, 0 +}; +const uint MAITRED_RANGE3[] = { + 260013, 260014, 260029, 260040, 260041, 260042, 260043, 260044, 260045, 260046, + 260015, 260016, 260017, 260018, 260019, 260020, 260021, 260022, 260023, 260028, + 260030, 260031, 260032, 260033, 260034, 260035, 260039, 0 +}; +const uint MAITRED_RANGE4[] = { + 260013, 260014, 260029, 260040, 260041, 260042, 260043, 260044, 260045, 260046, + 260015, 260016, 260017, 260018, 260019, 260020, 260021, 260022, 260023, 260025, + 260028, 260030, 260031, 260032, 260033, 260034, 260036, 260039, 0 +}; +const uint MAITRED_RANGE5[] = { + 260013, 260014, 260029, 260040, 260041, 260042, 260043, 260044, 260045, 260046, + 260015, 260016, 260017, 260018, 260019, 260020, 260021, 260022, 260023, 260026, + 260028, 260030, 260031, 260032, 260033, 260034, 260037, 260039, 0 +}; +const uint MAITRED_RANGE6[] = { + 260013, 260014, 260029, 260040, 260041, 260042, 260043, 260044, 260045, 260046, + 260015, 260016, 260017, 260018, 260019, 260020, 260021, 260022, 260023, 260027, + 260028, 260030, 260031, 260032, 260033, 260034, 260038, 260039, 0 +}; +const uint MAITRED_RANGE7[] = { 260048, 260049, 260050, 0 }; +const uint MAITRED_RANGE8[] = { 260054, 260055, 260056, 260057, 260058, 260059, 260060, 0 }; +const uint MAITRED_RANGE9[] = { 260061, 260062, 0 }; +const uint MAITRED_RANGE10[] = { 260064, 260065, 260066, 0 }; +const uint MAITRED_RANGE11[] = { 260068, 260110, 260069, 260070, 260075, 261010, 260181, 260076, 0 }; +const uint MAITRED_RANGE12[] = { 260068, 260110, 260069, 260070, 260075, 261010, 260181, 260076, 0 }; +const uint MAITRED_RANGE13[] = { 260068, 260110, 260069, 260071, 260075, 261010, 260181, 260076, 0 }; +const uint MAITRED_RANGE14[] = { 260068, 260110, 260069, 260072, 260075, 261010, 260181, 260076, 0 }; +const uint MAITRED_RANGE15[] = { 260068, 260110, 260069, 260073, 260075, 261010, 260181, 260076, 0 }; +const uint MAITRED_RANGE16[] = { 260068, 260110, 260069, 260074, 260075, 261010, 260181, 260076, 0 }; +const uint MAITRED_RANGE17[] = { 260078, 260079, 260080, 0 }; +const uint MAITRED_RANGE18[] = { 260081, 260082, 260083, 260084, 260085, 0 }; +const uint MAITRED_RANGE19[] = { 260103, 260104, 260105, 0 }; +const uint MAITRED_RANGE20[] = { 260092, 260093, 260088, 260090, 0 }; +const uint MAITRED_RANGE21[] = { + 260132, 260133, 260134, 260135, 260136, 260137, 260138, 260139, 260140, 260141, + 260142, 260143, 260144, 260145, 260146, 260147, 260148, 260149, 260150, 260151, + 260152, 260153, 260154, 260155, 260156, 0 +}; +const uint MAITRED_RANGE22[] = { + 260158, 260159, 260160, 260161, 260162, 260163, 260164, 260165, 260166, 260167, + 260168, 260169, 260170, 260171, 260172, 260173, 260174, 260175, 260176, 260177, + 260178, 260179, 260180, 0 +}; +const uint MAITRED_RANGE23[] = { 260185, 260186, 260187, 260188, 0 }; +const uint MAITRED_RANGE24[] = { 260191, 260192, 260193, 0 }; +const uint MAITRED_RANGE25[] = { 260203, 260204, 0 }; +const uint MAITRED_RANGE26[] = { 260217, 260218, 260219, 260220, 0 }; +const uint MAITRED_RANGE27[] = { 260263, 260264, 260265, 260427, 260053, 0 }; +const uint MAITRED_RANGE28[] = { 260266, 260267, 260268, 0 }; +const uint MAITRED_RANGE29[] = { 260274, 260278, 260287, 260288, 0 }; +const uint MAITRED_RANGE30[] = { 260275, 260276, 260281, 260283, 260289, 260361, 0 }; +const uint MAITRED_RANGE31[] = { 260277, 260280, 260284, 260286, 260359, 0 }; +const uint MAITRED_RANGE32[] = { 260279, 260285, 0 }; +const uint MAITRED_RANGE33[] = { 260275, 260276, 260281, 260283, 260289, 260361, 0 }; +const uint MAITRED_RANGE34[] = { 260282, 260360, 0 }; +const uint MAITRED_RANGE35[] = { 260432, 260306, 0 }; +const uint MAITRED_RANGE36[] = { 260319, 260320, 260321, 0 }; +const uint MAITRED_RANGE37[] = { 260322, 260485, 0 }; +const uint MAITRED_RANGE38[] = { 260324, 260325, 0 }; +const uint MAITRED_RANGE39[] = { 260326, 260327, 0 }; +const uint MAITRED_RANGE40[] = { 260338, 260339, 260340, 260341, 260342, 260343, 0 }; +const uint MAITRED_RANGE41[] = { + 260054, 260055, 260056, 260057, 260058, 260059, 260345, 260346, 260347, 260348, + 260349, 260350, 260351, 260352, 260353, 260354, 260355, 260356, 260357, 260358, 0 +}; +const uint MAITRED_RANGE42[] = { 260369, 260370, 0 }; +const uint MAITRED_RANGE43[] = { 260207, 260375, 260767, 0 }; +const uint MAITRED_RANGE44[] = { 260381, 260382, 260383, 260384, 260385, 0 }; +const uint MAITRED_RANGE45[] = { 260389, 260390, 260391, 260392, 260393, 260394, 260395, 260396, 260397, 260398, 0 }; +const uint MAITRED_RANGE46[] = { 260403, 260404, 260763, 0 }; +const uint MAITRED_RANGE47[] = { 260424, 260425, 260426, 0 }; +const uint MAITRED_RANGE48[] = { 260450, 260451, 0 }; +const uint MAITRED_RANGE49[] = { 260521, 260501, 0 }; +const uint MAITRED_RANGE50[] = { 260526, 260429, 0 }; +const uint MAITRED_RANGE51[] = { 260527, 260430, 0 }; +const uint MAITRED_RANGE52[] = { 260528, 260431, 0 }; +const uint MAITRED_RANGE53[] = { 260567, 260568, 0 }; +const uint MAITRED_RANGE54[] = { 260495, 260496, 0 }; +const uint MAITRED_RANGE55[] = { 260511, 260512, 0 }; +const uint MAITRED_RANGE56[] = { 260573, 260572, 0 }; +const uint MAITRED_RANGE57[] = { 260595, 260596, 260597, 260598, 260599, 260600, 0 }; +const uint MAITRED_RANGE58[] = { 260620, 260621, 0 }; +const uint MAITRED_RANGE59[] = { 260623, 260630, 260636, 0 }; +const uint MAITRED_RANGE60[] = { 260215, 260690, 260223, 260691, 0 }; +const uint MAITRED_RANGE61[] = { 260000, 260212, 0 }; +const uint MAITRED_RANGE62[] = { 260213, 260252, 0 }; +const uint MAITRED_RANGE63[] = { + 260700, 260701, 260702, 260703, 260704, 260705, 260706, 260707, 260708, 260709, + 260710, 260711, 260712, 260713, 260714, 260715, 260716, 260717, 260718, 260719, + 260720, 260721, 260731, 260732, 260733, 260734, 260735, 260736, 260737, 260738, + 260739, 260740, 260741, 260742, 260743, 260744, 260745, 260746, 260747, 260748, + 260749, 260750, 260751, 260752, 260753, 260754, 260755, 260756, 260757, 260758, + 260759, 260760, 0 +}; +const uint MAITRED_RANGE64[] = { 260723, 260724, 260725, 260726, 260727, 260728, 260729, 260730, 0 }; +const uint MAITRED_RANGE65[] = { 260765, 260766, 0 }; +const uint MAITRED_RANGE66[] = { 260770, 260771, 0 }; +const uint MAITRED_RANGE67[] = { 260773, 260774, 260775, 260776, 260271, 0 }; +const uint MAITRED_RANGE68[] = { 260801, 260802, 0 }; +const uint MAITRED_RANGE69[] = { 260804, 260805, 260806, 260807, 260808, 0 }; +const uint MAITRED_RANGE70[] = { 260810, 260811, 0 }; +const uint MAITRED_RANGE71[] = { 260813, 260814, 260815, 0 }; +const uint MAITRED_RANGE72[] = { 260818, 260819, 0 }; +const uint MAITRED_RANGE73[] = { 260844, 260845, 260846, 260847, 260848, 0 }; +const uint MAITRED_RANGE74[] = { 260857, 260858, 260859, 0 }; +const uint MAITRED_RANGE75[] = { 260861, 260862, 0 }; +const uint MAITRED_RANGE76[] = { 260864, 260865, 260866, 260867, 260868, 260869, 260870, 260871, 260872, 0 }; +const uint MAITRED_RANGE77[] = { 260876, 260877, 260878, 260879, 0 }; +const uint MAITRED_RANGE78[] = { 260881, 260882, 260883, 260884, 0 }; +const uint MAITRED_RANGE79[] = { 260899, 260900, 260901, 260902, 260903, 260904, 260905, 260906, 260907, 260908, +260909, 260910, 260911, 260912, 0 }; +const uint MAITRED_RANGE80[] = { 260914, 260915, 0 }; +const uint MAITRED_RANGE81[] = { 260917, 260918, 260919, 0 }; +const uint MAITRED_RANGE82[] = { 260921, 260922, 260923, 260924, 260925, 260926, 260927, 260928, 260929, 260930, + 260931, 0 }; +const uint MAITRED_RANGE83[] = { 260933, 260946, 0 }; +const uint MAITRED_RANGE84[] = { 260935, 260947, 0 }; +const uint MAITRED_RANGE85[] = { 260939, 260948, 0 }; +const uint MAITRED_RANGE86[] = { 260941, 260949, 0 }; +const uint MAITRED_RANGE87[] = { 260943, 260950, 0 }; +const uint MAITRED_RANGE88[] = { 260945, 260951, 0 }; +const uint MAITRED_RANGE89[] = { 260953, 260954, 260955, 0 }; +const uint MAITRED_RANGE90[] = { 260957, 260958, 0 }; +const uint MAITRED_RANGE91[] = { 260962, 260963, 260964, 260965, 0 }; +const uint MAITRED_RANGE92[] = { 260967, 260968, 260969, 260970, 260971, 260972, 260973, 0 }; +const uint MAITRED_RANGE93[] = { 260982, 260983, 260984, 0 }; +const uint MAITRED_RANGE94[] = { 260993, 260994, 260995, 0 }; +const uint MAITRED_RANGE95[] = { 261013, 261014, 261015, 0 }; +const uint MAITRED_RANGE96[] = { 260798, 260211, 0 }; +const uint MAITRED_RANGE97[] = { 260790, 260416, 260417, 0 }; + +#define MAITRED_RANGE_COUNT 97 +const ScriptRange MAITRED_RANGES[97] = { + { 260112, MAITRED_RANGE1, true, false }, + { 260131, MAITRED_RANGE2, false, false }, + { 260113, MAITRED_RANGE3, true, false }, + { 260114, MAITRED_RANGE4, true, false }, + { 260115, MAITRED_RANGE5, true, false }, + { 260116, MAITRED_RANGE6, true, false }, + { 260117, MAITRED_RANGE7, false, false }, + { 260118, MAITRED_RANGE8, true, false }, + { 260120, MAITRED_RANGE9, false, false }, + { 260119, MAITRED_RANGE10, false, false }, + + { 260121, MAITRED_RANGE11, false, false }, + { 260122, MAITRED_RANGE12, false, false }, + { 260123, MAITRED_RANGE13, false, false }, + { 260124, MAITRED_RANGE14, false, false }, + { 260125, MAITRED_RANGE15, false, false }, + { 260126, MAITRED_RANGE16, false, false }, + { 260127, MAITRED_RANGE17, false, false }, + { 260128, MAITRED_RANGE18, true, false }, + { 260129, MAITRED_RANGE19, false, false }, + { 260130, MAITRED_RANGE20, false, false }, + + { 260674, MAITRED_RANGE21, true, false }, + { 260675, MAITRED_RANGE22, true, false }, + { 260676, MAITRED_RANGE23, false, false }, + { 260677, MAITRED_RANGE24, false, false }, + { 260678, MAITRED_RANGE25, false, false }, + { 260679, MAITRED_RANGE26, false, false }, + { 260680, MAITRED_RANGE27, true, false }, + { 260681, MAITRED_RANGE28, false, false }, + { 260682, MAITRED_RANGE29, true, false }, + { 260644, MAITRED_RANGE30, true, false }, + + { 260645, MAITRED_RANGE31, true, false }, + { 260646, MAITRED_RANGE32, true, false }, + { 260647, MAITRED_RANGE33, true, false }, + { 260648, MAITRED_RANGE34, true, false }, + { 260649, MAITRED_RANGE35, true, false }, + { 260650, MAITRED_RANGE36, false, false }, + { 260651, MAITRED_RANGE37, false, false }, + { 260652, MAITRED_RANGE38, false, false }, + { 260653, MAITRED_RANGE39, false, false }, + { 260654, MAITRED_RANGE40, true, false }, + + { 260655, MAITRED_RANGE41, true, false }, + { 260656, MAITRED_RANGE42, false, false }, + { 260657, MAITRED_RANGE43, true, false }, + { 260658, MAITRED_RANGE44, false, false }, + { 260659, MAITRED_RANGE45, false, false }, + { 260660, MAITRED_RANGE46, true, false }, + { 260661, MAITRED_RANGE47, false, false }, + { 260662, MAITRED_RANGE48, false, false }, + { 260663, MAITRED_RANGE49, false, false }, + { 260664, MAITRED_RANGE50, false, false }, + + { 260665, MAITRED_RANGE51, false, false }, + { 260666, MAITRED_RANGE52, false, false }, + { 260667, MAITRED_RANGE53, false, false }, + { 260668, MAITRED_RANGE54, false, false }, + { 260669, MAITRED_RANGE55, false, false }, + { 260670, MAITRED_RANGE56, false, false }, + { 260671, MAITRED_RANGE57, false, false }, + { 260672, MAITRED_RANGE58, false, false }, + { 260673, MAITRED_RANGE59, false, false }, + { 260683, MAITRED_RANGE60, false, false }, + + { 260684, MAITRED_RANGE61, false, false }, + { 260685, MAITRED_RANGE62, false, false }, + { 260699, MAITRED_RANGE63, true, false }, + { 260722, MAITRED_RANGE64, true, false }, + { 260764, MAITRED_RANGE65, true, false }, + { 260769, MAITRED_RANGE66, true, false }, + { 260772, MAITRED_RANGE67, true, false }, + { 260800, MAITRED_RANGE68, true, false }, + { 260803, MAITRED_RANGE69, true, false }, + { 260809, MAITRED_RANGE70, true, false }, + + { 260812, MAITRED_RANGE71, true, false }, + { 260817, MAITRED_RANGE72, true, false }, + { 260843, MAITRED_RANGE73, true, false }, + { 260856, MAITRED_RANGE74, true, false }, + { 260860, MAITRED_RANGE75, true, false }, + { 260863, MAITRED_RANGE76, true, false }, + { 260875, MAITRED_RANGE77, true, false }, + { 260880, MAITRED_RANGE78, true, false }, + { 260898, MAITRED_RANGE79, true, false }, + { 260913, MAITRED_RANGE80, true, false }, + + { 260916, MAITRED_RANGE81, true, false }, + { 260920, MAITRED_RANGE82, true, false }, + { 260932, MAITRED_RANGE83, true, false }, + { 260934, MAITRED_RANGE84, true, false }, + { 260938, MAITRED_RANGE85, true, false }, + { 260940, MAITRED_RANGE86, true, false }, + { 260942, MAITRED_RANGE87, true, false }, + { 260944, MAITRED_RANGE88, true, false }, + { 260952, MAITRED_RANGE89, true, false }, + { 260956, MAITRED_RANGE90, true, false }, + + { 260961, MAITRED_RANGE91, true, false }, + { 260966, MAITRED_RANGE92, true, false }, + { 260981, MAITRED_RANGE93, false, false }, + { 260992, MAITRED_RANGE94, true, false }, + { 261012, MAITRED_RANGE95, true, false }, + { 261016, MAITRED_RANGE96, true, false }, + { 261017, MAITRED_RANGE97, true, false } +}; + void writeScriptRange(const char *name, const ScriptRange *ranges, int count) { outputFile.seek(dataOffset); @@ -789,4 +1037,5 @@ void writeAllScriptRanges() { writeScriptRange("Ranges/Deskbot", DESKBOT_RANGES, DESKBOT_RANGE_COUNT); writeScriptRange("Ranges/Doorbot", DOORBOT_RANGES, DOORBOT_RANGE_COUNT); writeScriptRange("Ranges/Liftbot", LIFTBOT_RANGES, LIFTBOT_RANGE_COUNT); + writeScriptRange("Ranges/MaitreD", MAITRED_RANGES, MAITRED_RANGE_COUNT); } \ No newline at end of file -- cgit v1.2.3 From 448b59c0991cb532f61eacdecb684a2fce3ef6b8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 7 Jun 2016 19:31:02 -0400 Subject: DEVTOOLS: Added Parrot ranges to create_titanic --- devtools/create_titanic/script_ranges.cpp | 81 +++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/devtools/create_titanic/script_ranges.cpp b/devtools/create_titanic/script_ranges.cpp index 511d2664f2..8bac9c5662 100644 --- a/devtools/create_titanic/script_ranges.cpp +++ b/devtools/create_titanic/script_ranges.cpp @@ -1013,6 +1013,86 @@ const ScriptRange MAITRED_RANGES[97] = { { 261017, MAITRED_RANGE97, true, false } }; +const uint PARROT_RANGE1[] = { 280171, 280172, 280173, 280174, 280175, 280176, 280153, 280154, 280155, 0 }; +const uint PARROT_RANGE2[] = { 280004, 280005, 280006, 280007, 280008, 280009, 280010, 280011, 280012, 0 }; +const uint PARROT_RANGE3[] = { 280000, 280001, 280002, 0 }; +const uint PARROT_RANGE4[] = { 280161, 280162, 280163, 280164, 280165, 0 }; +const uint PARROT_RANGE5[] = { 280156, 280157, 0 }; +const uint PARROT_RANGE6[] = { 280158, 280159, 280160, 0 }; +const uint PARROT_RANGE7[] = { 280166, 280167, 280168, 0 }; +const uint PARROT_RANGE8[] = { 280179, 280180, 280181, 0 }; +const uint PARROT_RANGE9[] = { 280086, 280087, 280088, 280089, 280090, 280091, 0 }; +const uint PARROT_RANGE10[] = { 280153, 280154, 280155, 0 }; +const uint PARROT_RANGE11[] = { 280043, 280044, 280045, 280046, 280047, 280048, 280049, 280050, 280051, 280052, 0 }; +const uint PARROT_RANGE12[] = { 280014, 280015, 280016, 0 }; +const uint PARROT_RANGE13[] = { 280217, 280039, 280040, 280041, 280042, 0 }; +const uint PARROT_RANGE14[] = { 280119, 280120, 280121, 280122, 280028, 280029, 280030, 280031, 280116, 280117, + 280118, 0 }; +const uint PARROT_RANGE15[] = { 280028, 280029, 280030, 280031, 0 }; +const uint PARROT_RANGE16[] = { 280123, 280124, 280125, 280126, 280127, 280128, 0 }; +const uint PARROT_RANGE17[] = { 280129, 280130, 280131, 280132, 280133, 280134, 280135, 280136, 280137, 280138, 0 }; +const uint PARROT_RANGE18[] = { 280035, 280036, 280037, 280038, 0 }; +const uint PARROT_RANGE19[] = { 280094, 280095, 280096, 280097, 280098, 280099, 280100, 280101, 280102, 280103, + 280104, 0 }; +const uint PARROT_RANGE20[] = { 280078, 280079, 280080, 280081, 280082, 280083, 280084, 0 }; +const uint PARROT_RANGE21[] = { 280067, 280068, 0 }; +const uint PARROT_RANGE22[] = { 280139, 280140, 280141, 0 }; +const uint PARROT_RANGE23[] = { 280017, 280018, 280019, 280020, 280021, 280022, 280023, 280024, 280025, 280026, + 280027, 0 }; +const uint PARROT_RANGE24[] = { 280065, 280143, 280142, 280190, 280144, 280066, 280145, 280146, 280147, 0 }; +const uint PARROT_RANGE25[] = { 280148, 280062, 280063, 0 }; +const uint PARROT_RANGE26[] = { 280071, 280072, 280073, 280074, 280075, 280076, 280077, 0 }; +const uint PARROT_RANGE27[] = { 280218, 280219, 0 }; +const uint PARROT_RANGE28[] = { 280057, 280058, 280059, 280060, 280061, 0 }; +const uint PARROT_RANGE29[] = { 280196, 280197, 280198, 280199, 280200, 0 }; +const uint PARROT_RANGE30[] = { 280202, 280203, 280204, 280205, 0 }; +const uint PARROT_RANGE31[] = { 280193, 280194, 280195, 0 }; +const uint PARROT_RANGE32[] = { 280149, 280069, 280070, 0 }; +const uint PARROT_RANGE33[] = { 280222, 280223, 280224, 280225, 280226, 280227, 280228, 280229, 280230, 280231, + 280232, 280233, 280234, 0 }; +const uint PARROT_RANGE34[] = { 280268, 280269, 280270, 280271, 280272, 280273, 280274, 0 }; + +#define PARROT_RANGE_COUNT 34 +const ScriptRange PARROT_RANGES[34] = { + { 280235, PARROT_RANGE1, false, false }, + { 280236, PARROT_RANGE1, false, false }, + { 280237, PARROT_RANGE1, false, false }, + { 280238, PARROT_RANGE1, false, false }, + { 280239, PARROT_RANGE1, false, false }, + { 280240, PARROT_RANGE1, false, false }, + { 280241, PARROT_RANGE1, false, false }, + { 280242, PARROT_RANGE1, false, false }, + { 280243, PARROT_RANGE1, false, false }, + { 280244, PARROT_RANGE1, false, false }, + + { 280245, PARROT_RANGE1, false, false }, + { 280246, PARROT_RANGE1, false, false }, + { 280247, PARROT_RANGE1, false, false }, + { 280248, PARROT_RANGE1, false, false }, + { 280249, PARROT_RANGE1, false, false }, + { 280250, PARROT_RANGE1, false, false }, + { 280251, PARROT_RANGE1, false, false }, + { 280252, PARROT_RANGE1, false, false }, + { 280253, PARROT_RANGE1, false, false }, + { 280254, PARROT_RANGE1, false, false }, + + { 280255, PARROT_RANGE1, false, false }, + { 280256, PARROT_RANGE1, false, false }, + { 280257, PARROT_RANGE1, false, false }, + { 280258, PARROT_RANGE1, false, false }, + { 280259, PARROT_RANGE1, false, false }, + { 280260, PARROT_RANGE1, false, false }, + { 280261, PARROT_RANGE1, false, false }, + { 280262, PARROT_RANGE1, false, false }, + { 280263, PARROT_RANGE1, false, false }, + { 280264, PARROT_RANGE1, false, false }, + + { 280265, PARROT_RANGE1, false, false }, + { 280266, PARROT_RANGE1, false, false }, + { 280222, PARROT_RANGE1, false, false }, + { 280267, PARROT_RANGE1, false, false } +}; + void writeScriptRange(const char *name, const ScriptRange *ranges, int count) { outputFile.seek(dataOffset); @@ -1038,4 +1118,5 @@ void writeAllScriptRanges() { writeScriptRange("Ranges/Doorbot", DOORBOT_RANGES, DOORBOT_RANGE_COUNT); writeScriptRange("Ranges/Liftbot", LIFTBOT_RANGES, LIFTBOT_RANGE_COUNT); writeScriptRange("Ranges/MaitreD", MAITRED_RANGES, MAITRED_RANGE_COUNT); + writeScriptRange("Ranges/Parrot", PARROT_RANGES, PARROT_RANGE_COUNT); } \ No newline at end of file -- cgit v1.2.3 From 31f8f1fbaff7ef0aa68914307fed209d278751d3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 7 Jun 2016 19:47:12 -0400 Subject: DEVTOOLS: Added SuccUBus ranges to create_titanic --- devtools/create_titanic/script_ranges.cpp | 48 +++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/devtools/create_titanic/script_ranges.cpp b/devtools/create_titanic/script_ranges.cpp index 8bac9c5662..ce2d1b8728 100644 --- a/devtools/create_titanic/script_ranges.cpp +++ b/devtools/create_titanic/script_ranges.cpp @@ -1093,6 +1093,53 @@ const ScriptRange PARROT_RANGES[34] = { { 280267, PARROT_RANGE1, false, false } }; +const uint SUCCUBUS_RANGE1[] = { 230001, 230149, 230078, 230002, 230033, 230067, 230003, 230079, 230034, 230055, + 230080, 230081, 230064, 230035, 0 }; +const uint SUCCUBUS_RANGE2[] = { 230005, 230085, 230006, 230091, 0 }; +const uint SUCCUBUS_RANGE3[] = { 230009, 230010, 230011, 0 }; +const uint SUCCUBUS_RANGE4[] = { 230030, 230031, 230032, 230033, 230034, 230035, 230036, 230037, 230038, 230142, + 230097, 0 }; +const uint SUCCUBUS_RANGE5[] = { 230100, 230101, 230102, 230104, 230105, 230113, 0 }; +const uint SUCCUBUS_RANGE6[] = { 230106, 230107, 230108, 230109, 230110, 0 }; +const uint SUCCUBUS_RANGE7[] = { 230119, 230120, 0 }; +const uint SUCCUBUS_RANGE8[] = { 230150, 230152, 230153, 230151, 0 }; +const uint SUCCUBUS_RANGE9[] = { 230154, 230155, 0 }; +const uint SUCCUBUS_RANGE10[] = { 230163, 230164, 230167, 230165, 230166, 230168, 0 }; +const uint SUCCUBUS_RANGE11[] = { 230123, 230124, 230126, 230127, 230128, 230129, 230130, 230131, 0 }; +const uint SUCCUBUS_RANGE12[] = { 230117, 230115, 0 }; +const uint SUCCUBUS_RANGE13[] = { 230179, 230180, 230057, 230181, 230068, 230182, 230118, 230048, 230058, 0 }; +const uint SUCCUBUS_RANGE14[] = { 230191, 230192, 230193, 230194, 0 }; +const uint SUCCUBUS_RANGE15[] = { 230239, 230240, 230241, 0 }; +const uint SUCCUBUS_RANGE16[] = { 230200, 230201, 230202, 230203, 230204, 230205, 230206, 0 }; +const uint SUCCUBUS_RANGE17[] = { 230122, 230073, 230074, 230075, 230076, 230077, 0 }; +const uint SUCCUBUS_RANGE18[] = { 230103, 230114, 230125, 230136, 230147, 230158, 230169, 230079, 230080, 230081, + 230082, 0 }; +const uint SUCCUBUS_RANGE19[] = { 230207, 230072, 0 }; + +#define SUCCUBUS_RANGE_COUNT 19 +const ScriptRange SUCCUBUS_RANGES[19] = { + { 230001, SUCCUBUS_RANGE1, false, false }, + { 230005, SUCCUBUS_RANGE2, false, false }, + { 230009, SUCCUBUS_RANGE3, false, false }, + { 230030, SUCCUBUS_RANGE4, false, false }, + { 230244, SUCCUBUS_RANGE5, false, false }, + { 230106, SUCCUBUS_RANGE6, false, false }, + { 230119, SUCCUBUS_RANGE7, false, false }, + { 230150, SUCCUBUS_RANGE8, false, false }, + { 230154, SUCCUBUS_RANGE9, false, false }, + { 230163, SUCCUBUS_RANGE10, false, false }, + + { 230123, SUCCUBUS_RANGE11, false, false }, + { 230117, SUCCUBUS_RANGE12, false, false }, + { 230179, SUCCUBUS_RANGE13, false, false }, + { 230191, SUCCUBUS_RANGE14, false, false }, + { 230239, SUCCUBUS_RANGE15, false, false }, + { 230200, SUCCUBUS_RANGE16, false, false }, + { 230122, SUCCUBUS_RANGE17, false, false }, + { 230103, SUCCUBUS_RANGE18, false, false }, + { 230207, SUCCUBUS_RANGE19, false, false } +}; + void writeScriptRange(const char *name, const ScriptRange *ranges, int count) { outputFile.seek(dataOffset); @@ -1119,4 +1166,5 @@ void writeAllScriptRanges() { writeScriptRange("Ranges/Liftbot", LIFTBOT_RANGES, LIFTBOT_RANGE_COUNT); writeScriptRange("Ranges/MaitreD", MAITRED_RANGES, MAITRED_RANGE_COUNT); writeScriptRange("Ranges/Parrot", PARROT_RANGES, PARROT_RANGE_COUNT); + writeScriptRange("Ranges/SuccUBus", SUCCUBUS_RANGES, SUCCUBUS_RANGE_COUNT); } \ No newline at end of file -- cgit v1.2.3 From e9c3d180cd245fd25fb0f234e55e30ea864634ce Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 7 Jun 2016 20:12:12 -0400 Subject: DEVTOOLS: Fixes for range data generation in create_titanic --- devtools/create_titanic/create_titanic_dat.cpp | 2 +- devtools/create_titanic/script_ranges.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index 506aaaec70..b5a8e46da4 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -51,7 +51,7 @@ */ #define VERSION_NUMBER 1 -#define HEADER_SIZE 0x400 +#define HEADER_SIZE 0x420 Common::File inputFile, outputFile; Common::PEResources res; diff --git a/devtools/create_titanic/script_ranges.cpp b/devtools/create_titanic/script_ranges.cpp index ce2d1b8728..834b0f5648 100644 --- a/devtools/create_titanic/script_ranges.cpp +++ b/devtools/create_titanic/script_ranges.cpp @@ -719,8 +719,8 @@ const uint LIFTBOT_RANGE38[] = { 210413, 210799, 210800, 210801, 210802, 210888, const uint LIFTBOT_RANGE39[] = { 210682, 210684, 210028, 210034, 210683, 210039, 210685, 210044, 210049, 210686, 210054, 0 }; -#define LIFTBOT_RANGE_COUNT 40 -const ScriptRange LIFTBOT_RANGES[40] = { +#define LIFTBOT_RANGE_COUNT 39 +const ScriptRange LIFTBOT_RANGES[39] = { { 210033, LIFTBOT_RANGE1, false, false }, { 210321, LIFTBOT_RANGE2, true, false }, { 210580, LIFTBOT_RANGE3, true, false }, -- cgit v1.2.3 From 02cd4557a40d10f50b76425c7df0a26cc46aa6a8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 7 Jun 2016 20:13:20 -0400 Subject: TITANIC: Remove unneeded NPC setupRanges methods --- engines/titanic/true_talk/barbot_script.cpp | 5 ----- engines/titanic/true_talk/barbot_script.h | 5 ----- engines/titanic/true_talk/bellbot_script.cpp | 6 +----- engines/titanic/true_talk/bellbot_script.h | 5 ----- engines/titanic/true_talk/deskbot_script.cpp | 5 ----- engines/titanic/true_talk/deskbot_script.h | 5 ----- engines/titanic/true_talk/doorbot_script.cpp | 6 +----- engines/titanic/true_talk/doorbot_script.h | 5 ----- engines/titanic/true_talk/liftbot_script.cpp | 6 +----- engines/titanic/true_talk/liftbot_script.h | 5 ----- engines/titanic/true_talk/maitred_script.cpp | 6 +----- engines/titanic/true_talk/maitred_script.h | 5 ----- engines/titanic/true_talk/parrot_script.cpp | 11 ++++++----- engines/titanic/true_talk/parrot_script.h | 8 +------- engines/titanic/true_talk/succubus_script.cpp | 12 +++++++----- engines/titanic/true_talk/succubus_script.h | 9 +-------- 16 files changed, 19 insertions(+), 85 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index 2a67a7b494..dc8a5bbd62 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -118,11 +118,6 @@ bool BarbotScript::proc16() const { return false; } -bool BarbotScript::setupRanges() { - warning("TODO"); - return false; -} - bool BarbotScript::proc18() const { warning("TODO"); return false; diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index 38f6ecd907..c2f53dacf3 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -49,11 +49,6 @@ public: virtual int proc15() const; virtual bool proc16() const; - /** - * Setup range sets - */ - virtual bool setupRanges(); - virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index a02ef147c4..dec4ace8ea 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -39,6 +39,7 @@ BellbotScript::BellbotScript(int val1, const char *charClass, int v2, _array[0] = 100; _array[1] = 0; + loadRanges("Ranges/Bellbot"); loadResponses("Responses/Bellbot", 4); } @@ -61,11 +62,6 @@ bool BellbotScript::proc16() const { return 0; } -bool BellbotScript::setupRanges() { - warning("TODO"); - return 0; -} - bool BellbotScript::proc18() const { warning("TODO"); return 0; diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index 72b6a84ff5..552f834094 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -43,11 +43,6 @@ public: virtual int proc15() const; virtual bool proc16() const; - /** - * Setup range sets - */ - virtual bool setupRanges(); - virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 7efd925fb0..e92dd6b790 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -64,11 +64,6 @@ bool DeskbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return 0; } -bool DeskbotScript::setupRanges() { - warning("TODO"); - return 0; -} - bool DeskbotScript::proc18() const { warning("TODO"); return 0; diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index 2fd5945776..144209a7e7 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -39,11 +39,6 @@ public: virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const; - /** - * Setup range sets - */ - virtual bool setupRanges(); - virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 7d291b6e7d..65fc194c11 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -35,6 +35,7 @@ DoorbotScript::DoorbotScript(int val1, const char *charClass, int v2, TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { Common::fill(&_array[0], &_array[148], 0); _state = 0; + loadRanges("Ranges/Doorbot"); loadResponses("Responses/Doorbot"); } @@ -114,11 +115,6 @@ bool DoorbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return 0; } -bool DoorbotScript::setupRanges() { - warning("TODO"); - return 0; -} - bool DoorbotScript::proc18() const { warning("TODO"); return 0; diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 05f0048fb2..4c18f1fdf4 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -51,11 +51,6 @@ public: virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const; - /** - * Setup range sets - */ - virtual bool setupRanges(); - virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index 5a63a51bb3..daa3b6c177 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -33,6 +33,7 @@ LiftbotScript::LiftbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { _state = 0; + loadRanges("Ranges/Liftbot"); loadResponses("Responses/Liftbot"); } @@ -90,11 +91,6 @@ bool LiftbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return 0; } -bool LiftbotScript::setupRanges() { - warning("TODO"); - return 0; -} - bool LiftbotScript::proc18() const { warning("TODO"); return 0; diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index ddbe92b81f..b4d739e41d 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -46,11 +46,6 @@ public: virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const; - /** - * Setup range sets - */ - virtual bool setupRanges(); - virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index 7bd19c4c71..8980da32a3 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -38,6 +38,7 @@ MaitreDScript::MaitreDScript(int val1, const char *charClass, int v2, CTrueTalkManager::setFlags(15, 0); CTrueTalkManager::setFlags(16, 0); + loadRanges("Ranges/MaitreD"); loadResponses("Responses/MaitreD"); } @@ -68,11 +69,6 @@ bool MaitreDScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return 0; } -bool MaitreDScript::setupRanges() { - warning("TODO"); - return 0; -} - bool MaitreDScript::proc18() const { warning("TODO"); return 0; diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index c2d146efbc..b6e2369e9f 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -42,11 +42,6 @@ public: virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const; - /** - * Setup range sets - */ - virtual bool setupRanges(); - virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; diff --git a/engines/titanic/true_talk/parrot_script.cpp b/engines/titanic/true_talk/parrot_script.cpp index 93312bbfd2..ecfc8e870d 100644 --- a/engines/titanic/true_talk/parrot_script.cpp +++ b/engines/titanic/true_talk/parrot_script.cpp @@ -25,6 +25,12 @@ namespace Titanic { +ParrotScript::ParrotScript(int val1, const char *charClass, int v2, + const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : + TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { + loadRanges("Ranges/Parrot"); +} + int ParrotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { if (tag == MKTAG('B', 'Y', 'Z', 'A')) { addResponse(getDialogueId(280246)); @@ -44,11 +50,6 @@ int ParrotScript::proc10() const { return 0; } -bool ParrotScript::setupRanges() { - warning("TODO"); - return 0; -} - bool ParrotScript::proc18() const { warning("TODO"); return 0; diff --git a/engines/titanic/true_talk/parrot_script.h b/engines/titanic/true_talk/parrot_script.h index dd8ed96602..ad078af9a2 100644 --- a/engines/titanic/true_talk/parrot_script.h +++ b/engines/titanic/true_talk/parrot_script.h @@ -30,8 +30,7 @@ namespace Titanic { class ParrotScript : public TTnpcScript { public: ParrotScript(int val1, const char *charClass, int v2, - const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : - TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {} + const char *charName, int v3, int val2, int v4, int v5, int v6, int v7); /** * Chooses and adds a conversation response based on a specified tag Id. @@ -41,11 +40,6 @@ public: virtual void proc7(int v1, int v2); virtual int proc10() const; - /** - * Setup range sets - */ - virtual bool setupRanges(); - virtual bool proc18() const; virtual int proc23() const; virtual const int *getTablePtr(int id); diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp index fcd0fcf829..403136880d 100644 --- a/engines/titanic/true_talk/succubus_script.cpp +++ b/engines/titanic/true_talk/succubus_script.cpp @@ -25,6 +25,13 @@ namespace Titanic { +SuccUBusScript::SuccUBusScript(int val1, const char *charClass, int v2, + const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : + TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7), + _field2D0(0) { + loadRanges("Ranges/SuccUBus"); +} + int SuccUBusScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { uint dialogueId = tag; @@ -67,11 +74,6 @@ int SuccUBusScript::proc10() const { return 0; } -bool SuccUBusScript::setupRanges() { - warning("TODO"); - return 0; -} - bool SuccUBusScript::proc18() const { warning("TODO"); return 0; diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h index 4a9166f6b3..77f338b771 100644 --- a/engines/titanic/true_talk/succubus_script.h +++ b/engines/titanic/true_talk/succubus_script.h @@ -32,9 +32,7 @@ private: int _field2D0; public: SuccUBusScript(int val1, const char *charClass, int v2, - const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : - TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7), - _field2D0(0) {} + const char *charName, int v3, int val2, int v4, int v5, int v6, int v7); /** * Chooses and adds a conversation response based on a specified tag Id. @@ -44,11 +42,6 @@ public: virtual void proc7(int v1, int v2); virtual int proc10() const; - /** - * Setup range sets - */ - virtual bool setupRanges(); - virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); virtual int proc23() const; -- cgit v1.2.3 From 074dbb8c1a2bfd9ad377ec6f57280d62dfe83803 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 7 Jun 2016 22:33:51 -0400 Subject: DEVTOOLS: Add NPC sentence entry data to create_titanic --- devtools/create_titanic/create_titanic_dat.cpp | 79 +++++++++++++++++++++++--- 1 file changed, 71 insertions(+), 8 deletions(-) diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index b5a8e46da4..ad52a5dba5 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -51,7 +51,7 @@ */ #define VERSION_NUMBER 1 -#define HEADER_SIZE 0x420 +#define HEADER_SIZE 0x500 Common::File inputFile, outputFile; Common::PEResources res; @@ -310,6 +310,16 @@ void writeNumbers() { dataOffset += size; } +void writeString(uint offset) { + const int FILE_DIFF = 0x401C00; + inputFile.seek(offset - FILE_DIFF); + char c; + do { + c = inputFile.readByte(); + outputFile.writeByte(c); + } while (c); +} + void writeResponseTree() { const int FILE_DIFF = 0x401C00; outputFile.seek(dataOffset); @@ -337,12 +347,7 @@ void writeResponseTree() { } else { // Offset to ASCIIZ string outputFile.writeByte(1); - inputFile.seek(offset - FILE_DIFF); - char c; - do { - c = inputFile.readByte(); - outputFile.writeByte(c); - } while (c); + writeString(offset); } } @@ -351,6 +356,55 @@ void writeResponseTree() { dataOffset += size; } + +void writeSentenceEntries(const char *name, uint tableOffset) { + const int FILE_DIFF = 0x401C00; + outputFile.seek(dataOffset); + + uint v1, v2, v4, v9, v11, v12, v13; + uint offset3, offset5, offset6, offset7, offset8, offset10; + + for (uint idx = 0; ; ++idx) { + inputFile.seek(tableOffset - FILE_DIFF + idx * 0x34); + v1 = inputFile.readLong(); + if (!v1) + // Reached end of list + break; + + // Read data fields + v2 = inputFile.readLong(); + offset3 = inputFile.readLong(); + v4 = inputFile.readLong(); + offset5 = inputFile.readLong(); + offset6 = inputFile.readLong(); + offset7 = inputFile.readLong(); + offset8 = inputFile.readLong(); + v9 = inputFile.readLong(); + offset10 = inputFile.readLong(); + v11 = inputFile.readLong(); + v12 = inputFile.readLong(); + v13 = inputFile.readLong(); + + outputFile.writeLong(v1); + outputFile.writeLong(v2); + writeString(offset3); + outputFile.writeLong(v1); + writeString(offset5); + writeString(offset6); + writeString(offset7); + writeString(offset8); + outputFile.writeLong(v9); + writeString(offset10); + outputFile.writeLong(v11); + outputFile.writeLong(v12); + outputFile.writeLong(v13); + } + + uint size = outputFile.size() - dataOffset; + writeEntryHeader("TEXT/TREE", dataOffset, size); + dataOffset += size; +} + void writeHeader() { // Write out magic string const char *MAGIC_STR = "SVTN"; @@ -395,8 +449,17 @@ void writeData() { writeStringArray("TEXT/REPLACEMENTS2", 0x21C120, 1576); writeStringArray("TEXT/REPLACEMENTS3", 0x21D9C8, 82); writeStringArray("TEXT/PRONOUNS", 0x22F718, 15); - writeResponseTree(); + writeSentenceEntries("Sentences/Barbot", 0x5ABE60); + writeSentenceEntries("Sentences/Bellbot", 0x5C2230); + writeSentenceEntries("Sentences/Deskbot", 0x5DCD10); + writeSentenceEntries("Sentences/Doorbot", 0x5EC110); + writeSentenceEntries("Sentences/Liftbot", 0x6026B0); + writeSentenceEntries("Sentences/MaitreD", 0x60CFD8); + writeSentenceEntries("Sentences/Parrot", 0x615858); + writeSentenceEntries("Sentences/SuccUBus", 0x616698); + + writeResponseTree(); writeNumbers(); writeAllScriptResponses(); writeAllScriptRanges(); -- cgit v1.2.3 From 041ce7f4efd80af0c8cea3b58d87741ee1206a6e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 8 Jun 2016 19:15:15 -0400 Subject: DEVTOOLS: Add NPC Id mapping tables to create_titanic --- devtools/create_titanic/create_titanic_dat.cpp | 32 ++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index ad52a5dba5..b90777c243 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -51,7 +51,7 @@ */ #define VERSION_NUMBER 1 -#define HEADER_SIZE 0x500 +#define HEADER_SIZE 0x580 Common::File inputFile, outputFile; Common::PEResources res; @@ -59,6 +59,8 @@ uint headerOffset = 6; uint dataOffset = HEADER_SIZE; #define SEGMENT_OFFSET 0x401C00 +const int FILE_DIFF = 0x401C00; + static const char *const ITEM_NAMES[46] = { "LeftArmWith", "LeftArmWithout", "RightArmWith", "RightArmWithout", "BridgeRed", "BridgeYellow", "BridgeBlue", "BridgeGreen", "Parrot", "CentralCore", "BrainGreen", @@ -311,7 +313,6 @@ void writeNumbers() { } void writeString(uint offset) { - const int FILE_DIFF = 0x401C00; inputFile.seek(offset - FILE_DIFF); char c; do { @@ -321,7 +322,6 @@ void writeString(uint offset) { } void writeResponseTree() { - const int FILE_DIFF = 0x401C00; outputFile.seek(dataOffset); inputFile.seek(0x619500 - FILE_DIFF); @@ -358,7 +358,6 @@ void writeResponseTree() { void writeSentenceEntries(const char *name, uint tableOffset) { - const int FILE_DIFF = 0x401C00; outputFile.seek(dataOffset); uint v1, v2, v4, v9, v11, v12, v13; @@ -405,6 +404,23 @@ void writeSentenceEntries(const char *name, uint tableOffset) { dataOffset += size; } +void writeSentenceMappings(const char *name, uint offset, int numValues) { + inputFile.seek(offset - FILE_DIFF); + outputFile.seek(dataOffset); + + uint id; + while ((id = inputFile.readLong()) != 0) { + outputFile.writeLong(id); + + for (int ctr = 0; ctr < numValues; ++ctr) + outputFile.writeLong(inputFile.readLong()); + } + + uint size = outputFile.size() - dataOffset; + writeEntryHeader(name, dataOffset, size); + dataOffset += size; +} + void writeHeader() { // Write out magic string const char *MAGIC_STR = "SVTN"; @@ -458,6 +474,14 @@ void writeData() { writeSentenceEntries("Sentences/MaitreD", 0x60CFD8); writeSentenceEntries("Sentences/Parrot", 0x615858); writeSentenceEntries("Sentences/SuccUBus", 0x616698); + writeSentenceMappings("Sentences/Barbot", 0x5B28A0, 8); + writeSentenceMappings("Sentences/Bellbot", 0x5CD830, 1); + writeSentenceMappings("Sentences/Deskbot", 0x5E2BB8, 4); + writeSentenceMappings("Sentences/Doorbot", 0x5F7950, 4); + writeSentenceMappings("Sentences/Liftbot", 0x608660, 4); + writeSentenceMappings("Sentences/MaitreD", 0x6125C8, 1); + writeSentenceMappings("Sentences/Parrot", 0x615B68, 1); + writeSentenceMappings("Sentences/SuccUBus", 0x6189F0, 1); writeResponseTree(); writeNumbers(); -- cgit v1.2.3 From cf79431c72becc58791a610f2ff184801e74f998 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 8 Jun 2016 19:41:20 -0400 Subject: DEVTOOLS: Fix NPC Id mapping names in create_titanic --- devtools/create_titanic/create_titanic_dat.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index b90777c243..22489dd9e8 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -474,14 +474,14 @@ void writeData() { writeSentenceEntries("Sentences/MaitreD", 0x60CFD8); writeSentenceEntries("Sentences/Parrot", 0x615858); writeSentenceEntries("Sentences/SuccUBus", 0x616698); - writeSentenceMappings("Sentences/Barbot", 0x5B28A0, 8); - writeSentenceMappings("Sentences/Bellbot", 0x5CD830, 1); - writeSentenceMappings("Sentences/Deskbot", 0x5E2BB8, 4); - writeSentenceMappings("Sentences/Doorbot", 0x5F7950, 4); - writeSentenceMappings("Sentences/Liftbot", 0x608660, 4); - writeSentenceMappings("Sentences/MaitreD", 0x6125C8, 1); - writeSentenceMappings("Sentences/Parrot", 0x615B68, 1); - writeSentenceMappings("Sentences/SuccUBus", 0x6189F0, 1); + writeSentenceMappings("Mappings/Barbot", 0x5B28A0, 8); + writeSentenceMappings("Mappings/Bellbot", 0x5CD830, 1); + writeSentenceMappings("Mappings/Deskbot", 0x5E2BB8, 4); + writeSentenceMappings("Mappings/Doorbot", 0x5F7950, 4); + writeSentenceMappings("Mappings/Liftbot", 0x608660, 4); + writeSentenceMappings("Mappings/MaitreD", 0x6125C8, 1); + writeSentenceMappings("Mappings/Parrot", 0x615B68, 1); + writeSentenceMappings("Mappings/SuccUBus", 0x6189F0, 1); writeResponseTree(); writeNumbers(); -- cgit v1.2.3 From bc8e37e17bb02c81467c36dd8c0b60d8e1f9eca1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 8 Jun 2016 19:42:37 -0400 Subject: TITANIC: Load NPC mapping tables --- engines/titanic/true_talk/barbot_script.cpp | 1 + engines/titanic/true_talk/bellbot_script.cpp | 1 + engines/titanic/true_talk/deskbot_script.cpp | 1 + engines/titanic/true_talk/doorbot_script.cpp | 1 + engines/titanic/true_talk/liftbot_script.cpp | 1 + engines/titanic/true_talk/maitred_script.cpp | 1 + engines/titanic/true_talk/parrot_script.cpp | 1 + engines/titanic/true_talk/succubus_script.cpp | 1 + engines/titanic/true_talk/tt_npc_script.cpp | 24 ++++++++++++++++++++++++ engines/titanic/true_talk/tt_npc_script.h | 15 +++++++++++++++ 10 files changed, 47 insertions(+) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index dc8a5bbd62..ebd35a775a 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -33,6 +33,7 @@ BarbotScript::BarbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { _state = 0; + _mappings.load("Mappings/Barbot", 8); loadRanges("Ranges/Barbot"); loadResponses("Responses/Barbot"); } diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index dec4ace8ea..5acf01179b 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -39,6 +39,7 @@ BellbotScript::BellbotScript(int val1, const char *charClass, int v2, _array[0] = 100; _array[1] = 0; + _mappings.load("Mappings/Bellbot", 1); loadRanges("Ranges/Bellbot"); loadResponses("Responses/Bellbot", 4); } diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index e92dd6b790..8c526163cc 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -40,6 +40,7 @@ DeskbotScript::DeskbotScript(int val1, const char *charClass, int v2, if (_field74 == 1) _field74 = 0; + _mappings.load("Mappings/Deskbot", 4); loadRanges("Ranges/Deskbot"); loadResponses("Responses/Deskbot", 4); } diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 65fc194c11..92db168eb1 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -35,6 +35,7 @@ DoorbotScript::DoorbotScript(int val1, const char *charClass, int v2, TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { Common::fill(&_array[0], &_array[148], 0); _state = 0; + _mappings.load("Mappings/Doorbot", 4); loadRanges("Ranges/Doorbot"); loadResponses("Responses/Doorbot"); } diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index daa3b6c177..a040160736 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -33,6 +33,7 @@ LiftbotScript::LiftbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { _state = 0; + _mappings.load("Mappings/Liftbot", 4); loadRanges("Ranges/Liftbot"); loadResponses("Responses/Liftbot"); } diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index 8980da32a3..6b7a124a18 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -38,6 +38,7 @@ MaitreDScript::MaitreDScript(int val1, const char *charClass, int v2, CTrueTalkManager::setFlags(15, 0); CTrueTalkManager::setFlags(16, 0); + _mappings.load("Mappings/MaitreD", 1); loadRanges("Ranges/MaitreD"); loadResponses("Responses/MaitreD"); } diff --git a/engines/titanic/true_talk/parrot_script.cpp b/engines/titanic/true_talk/parrot_script.cpp index ecfc8e870d..5434b8b247 100644 --- a/engines/titanic/true_talk/parrot_script.cpp +++ b/engines/titanic/true_talk/parrot_script.cpp @@ -28,6 +28,7 @@ namespace Titanic { ParrotScript::ParrotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { + _mappings.load("Mappings/Parrot", 1); loadRanges("Ranges/Parrot"); } diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp index 403136880d..f0f2003556 100644 --- a/engines/titanic/true_talk/succubus_script.cpp +++ b/engines/titanic/true_talk/succubus_script.cpp @@ -29,6 +29,7 @@ SuccUBusScript::SuccUBusScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7), _field2D0(0) { + _mappings.load("Mappings/SuccUBus", 1); loadRanges("Ranges/SuccUBus"); } diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 19ff05d134..e6b803a04c 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -55,6 +55,30 @@ TTscriptRange::TTscriptRange(uint id, const Common::Array &values, /*------------------------------------------------------------------------*/ +TTscriptMapping::TTscriptMapping() : _id(0) { + Common::fill(&_values[0], &_values[8], 0); +} + +/*------------------------------------------------------------------------*/ + +void TTscriptMappings::load(const char *name, int valuesPerMapping) { + Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); + _valuesPerMapping = valuesPerMapping; + + while (r->pos() < r->size()) { + resize(size() + 1); + TTscriptMapping &m = (*this)[size() - 1]; + + m._id = r->readUint32LE(); + for (int idx = 0; idx < valuesPerMapping; ++idx) + m._values[idx] = r->readUint32LE(); + } + + delete r; +} + +/*------------------------------------------------------------------------*/ + TTnpcScriptBase::TTnpcScriptBase(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTscriptBase(0, charClass, v2, charName, v3, v4, v5, v6, v7), diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 77f44453c7..66cb3af1c3 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -62,6 +62,20 @@ struct TTscriptRange { bool isSequential); }; +struct TTscriptMapping { + uint _id; + uint _values[8]; + + TTscriptMapping(); +}; + +class TTscriptMappings : public Common::Array { +public: + int _valuesPerMapping; + + void load(const char *name, int valuesPerMapping); +}; + class TTnpcScriptBase : public TTscriptBase { protected: int _field54; @@ -100,6 +114,7 @@ protected: Common::Array _responses; int _valuesPerResponse; Common::Array _ranges; + TTscriptMappings _mappings; const TTsentenceEntries *_entriesP; int _entryCount; int _field68; -- cgit v1.2.3 From c3d2f5f5ca89b0626c0ee933a825572fc952d4b4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 8 Jun 2016 22:00:36 -0400 Subject: DEVTOOLS: Fix writing of sentence entries in create_titanic --- devtools/create_titanic/create_titanic_dat.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index 22489dd9e8..f0f7370693 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -51,7 +51,7 @@ */ #define VERSION_NUMBER 1 -#define HEADER_SIZE 0x580 +#define HEADER_SIZE 0x5A0 Common::File inputFile, outputFile; Common::PEResources res; @@ -400,7 +400,7 @@ void writeSentenceEntries(const char *name, uint tableOffset) { } uint size = outputFile.size() - dataOffset; - writeEntryHeader("TEXT/TREE", dataOffset, size); + writeEntryHeader(name, dataOffset, size); dataOffset += size; } -- cgit v1.2.3 From 67b19851d56cc507ce48994a1b92407e79f53056 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 8 Jun 2016 22:01:55 -0400 Subject: TITANIC: Add loading of NPC sentence entry data --- engines/titanic/true_talk/barbot_script.cpp | 16 ++++++++++- engines/titanic/true_talk/barbot_script.h | 5 ++++ engines/titanic/true_talk/bellbot_script.cpp | 10 ++++++- engines/titanic/true_talk/bellbot_script.h | 5 ++++ engines/titanic/true_talk/deskbot_script.cpp | 10 ++++++- engines/titanic/true_talk/deskbot_script.h | 5 ++++ engines/titanic/true_talk/doorbot_script.cpp | 17 ++++++++++-- engines/titanic/true_talk/doorbot_script.h | 6 +++- engines/titanic/true_talk/liftbot_script.cpp | 14 +++++++++- engines/titanic/true_talk/liftbot_script.h | 5 ++++ engines/titanic/true_talk/maitred_script.cpp | 9 +++++- engines/titanic/true_talk/maitred_script.h | 5 ++++ engines/titanic/true_talk/parrot_script.cpp | 10 ++++++- engines/titanic/true_talk/parrot_script.h | 5 ++++ engines/titanic/true_talk/succubus_script.cpp | 10 ++++++- engines/titanic/true_talk/succubus_script.h | 5 ++++ engines/titanic/true_talk/tt_npc_script.cpp | 40 +++++++++++++++++++++++++-- engines/titanic/true_talk/tt_npc_script.h | 37 +++++++++++++++++++++++-- engines/titanic/true_talk/tt_sentence.cpp | 35 ----------------------- engines/titanic/true_talk/tt_sentence.h | 33 ---------------------- 20 files changed, 199 insertions(+), 83 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index ebd35a775a..f768885088 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -22,6 +22,7 @@ #include "common/textconsole.h" #include "titanic/true_talk/barbot_script.h" +#include "titanic/true_talk/true_talk_manager.h" namespace Titanic { @@ -33,9 +34,22 @@ BarbotScript::BarbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { _state = 0; - _mappings.load("Mappings/Barbot", 8); + loadRanges("Ranges/Barbot"); loadResponses("Responses/Barbot"); + setupSentences(); +} + +void BarbotScript::setupSentences() { + for (int idx = 28; idx < 35; ++idx) + CTrueTalkManager::setFlags(idx, 0); + setupDials(100, 100, 100); + + if (!_field74) + _field74 = 2; + + _mappings.load("Mappings/Barbot", 8); + _entries.load("Sentences/Barbot"); } int BarbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index c2f53dacf3..c5f7800de4 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -35,6 +35,11 @@ private: * Adjust a given dial number by a given delta amount */ void adjustDial(int dialNum, int amount); + + /** + * Setup sentence data + */ + void setupSentences(); public: BarbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7); diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 5acf01179b..78eab6ee1f 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -39,9 +39,17 @@ BellbotScript::BellbotScript(int val1, const char *charClass, int v2, _array[0] = 100; _array[1] = 0; - _mappings.load("Mappings/Bellbot", 1); loadRanges("Ranges/Bellbot"); loadResponses("Responses/Bellbot", 4); + setupSentences(); +} + +void BellbotScript::setupSentences() { + _mappings.load("Mappings/Bellbot", 1); + _entries.load("Sentences/Bellbot"); + _field2DC = 0; + _field68 = 0; + _entryCount = 0; } void BellbotScript::proc7(int v1, int v2) { diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index 552f834094..cc70b27b8d 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -34,6 +34,11 @@ private: int _field2D4; int _field2D8; int _field2DC; +private: + /** + * Setup sentence data + */ + void setupSentences(); public: BellbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 8c526163cc..0b8c7e247d 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -40,9 +40,17 @@ DeskbotScript::DeskbotScript(int val1, const char *charClass, int v2, if (_field74 == 1) _field74 = 0; - _mappings.load("Mappings/Deskbot", 4); loadRanges("Ranges/Deskbot"); loadResponses("Responses/Deskbot", 4); + setupSentences(); +} + +void DeskbotScript::setupSentences() { + _mappings.load("Mappings/Deskbot", 4); + _entries.load("Sentences/Deskbot"); + _dialValues[0] = _dialValues[1] = 0; + _field68 = 0; + _entryCount = 0; } void DeskbotScript::proc7(int v1, int v2) { diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index 144209a7e7..224496cc0f 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -29,6 +29,11 @@ namespace Titanic { class DeskbotScript : public TTnpcScript { +private: + /** + * Setup sentence data + */ + void setupSentences(); public: DeskbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 92db168eb1..7e0181308f 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -23,6 +23,7 @@ #include "common/textconsole.h" #include "titanic/true_talk/doorbot_script.h" #include "titanic/true_talk/tt_room_script.h" +#include "titanic/true_talk/true_talk_manager.h" namespace Titanic { @@ -33,11 +34,21 @@ static const int STATE_ARRAY[9] = { DoorbotScript::DoorbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { - Common::fill(&_array[0], &_array[148], 0); - _state = 0; - _mappings.load("Mappings/Doorbot", 4); loadRanges("Ranges/Doorbot"); loadResponses("Responses/Doorbot"); + setupSentences(); +} + +void DoorbotScript::setupSentences() { + for (int idx = 35; idx < 40; ++idx) + CTrueTalkManager::setFlags(idx, 0); + _state = 1; + _dialValues[0] = _dialValues[1] = 100; + + _mappings.load("Mappings/Doorbot", 4); + _entries.load("Sentences/Doorbot"); + _field68 = 0; + _entryCount = 0; } int DoorbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 4c18f1fdf4..f7015e14dd 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -29,9 +29,13 @@ namespace Titanic { class DoorbotScript : public TTnpcScript { private: - int _array[148]; int _state; private: + /** + * Setup sentence data + */ + void setupSentences(); + /** * Sets a response */ diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index a040160736..b96f485ea9 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -22,6 +22,7 @@ #include "common/textconsole.h" #include "titanic/true_talk/liftbot_script.h" +#include "titanic/true_talk/true_talk_manager.h" namespace Titanic { @@ -33,9 +34,20 @@ LiftbotScript::LiftbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { _state = 0; - _mappings.load("Mappings/Liftbot", 4); + loadRanges("Ranges/Liftbot"); loadResponses("Responses/Liftbot"); + setupSentences(); +} + +void LiftbotScript::setupSentences() { + CTrueTalkManager::setFlags(27, 0); + setupDials(getRandomNumber(40) + 60, getRandomNumber(40) + 60, 0); + + _mappings.load("Mappings/Liftbot", 4); + _entries.load("Sentences/Liftbot"); + _field68 = 0; + _entryCount = 0; } int LiftbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index b4d739e41d..1db3163956 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -30,6 +30,11 @@ namespace Titanic { class LiftbotScript : public TTnpcScript { private: int _state; +private: + /** + * Setup sentence data + */ + void setupSentences(); public: LiftbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7); diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index 6b7a124a18..2497fd83fb 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -38,9 +38,16 @@ MaitreDScript::MaitreDScript(int val1, const char *charClass, int v2, CTrueTalkManager::setFlags(15, 0); CTrueTalkManager::setFlags(16, 0); - _mappings.load("Mappings/MaitreD", 1); loadRanges("Ranges/MaitreD"); loadResponses("Responses/MaitreD"); + setupSentences(); +} + +void MaitreDScript::setupSentences() { + _mappings.load("Mappings/MaitreD", 1); + _entries.load("Sentences/MaitreD"); + _field68 = 0; + _entryCount = 0; } int MaitreDScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index b6e2369e9f..0ebfabfe7f 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -28,6 +28,11 @@ namespace Titanic { class MaitreDScript : public TTnpcScript { +private: + /** + * Setup sentence data + */ + void setupSentences(); public: MaitreDScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); diff --git a/engines/titanic/true_talk/parrot_script.cpp b/engines/titanic/true_talk/parrot_script.cpp index 5434b8b247..eb08d7ca0e 100644 --- a/engines/titanic/true_talk/parrot_script.cpp +++ b/engines/titanic/true_talk/parrot_script.cpp @@ -28,8 +28,16 @@ namespace Titanic { ParrotScript::ParrotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { - _mappings.load("Mappings/Parrot", 1); + loadRanges("Ranges/Parrot"); + setupSentences(); +} + +void ParrotScript::setupSentences() { + _mappings.load("Mappings/Parrot", 1); + _entries.load("Sentences/Parrot"); + _field68 = 0; + _entryCount = 0; } int ParrotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { diff --git a/engines/titanic/true_talk/parrot_script.h b/engines/titanic/true_talk/parrot_script.h index ad078af9a2..f5d9cb2828 100644 --- a/engines/titanic/true_talk/parrot_script.h +++ b/engines/titanic/true_talk/parrot_script.h @@ -28,6 +28,11 @@ namespace Titanic { class ParrotScript : public TTnpcScript { +private: + /** + * Setup sentence data + */ + void setupSentences(); public: ParrotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7); diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp index f0f2003556..1a2348499d 100644 --- a/engines/titanic/true_talk/succubus_script.cpp +++ b/engines/titanic/true_talk/succubus_script.cpp @@ -29,8 +29,16 @@ SuccUBusScript::SuccUBusScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7), _field2D0(0) { - _mappings.load("Mappings/SuccUBus", 1); + loadRanges("Ranges/SuccUBus"); + setupSentences(); +} + +void SuccUBusScript::setupSentences() { + _mappings.load("Mappings/SuccUBus", 1); + _entries.load("Sentences/SuccUBus"); + _field68 = 0; + _entryCount = 0; } int SuccUBusScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h index 77f338b771..fffdd80d89 100644 --- a/engines/titanic/true_talk/succubus_script.h +++ b/engines/titanic/true_talk/succubus_script.h @@ -30,6 +30,11 @@ namespace Titanic { class SuccUBusScript : public TTnpcScript { private: int _field2D0; +private: + /** + * Setup sentence data + */ + void setupSentences(); public: SuccUBusScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7); diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index e6b803a04c..e06184a0a0 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -55,6 +55,42 @@ TTscriptRange::TTscriptRange(uint id, const Common::Array &values, /*------------------------------------------------------------------------*/ + +bool TTsentenceEntry::load(Common::SeekableReadStream *s) { + if (s->pos() >= s->size()) + return false; + + _field0 = s->readUint32LE(); + _field4 = s->readUint32LE(); + _string8 = readStringFromStream(s); + _fieldC = s->readUint32LE(); + _string10 = readStringFromStream(s); + _string14 = readStringFromStream(s); + _string18 = readStringFromStream(s); + _string1C = readStringFromStream(s); + _field20 = s->readUint32LE(); + _string24 = readStringFromStream(s); + _field28 = s->readUint32LE(); + _field2C = s->readUint32LE(); + _field30 = s->readUint32LE(); + + return true; +} + +/*------------------------------------------------------------------------*/ + +void TTsentenceEntries::load(const CString &resName) { + TTsentenceEntry entry; + Common::SeekableReadStream *r = g_vm->_filesManager->getResource(resName); + + while (entry.load(r)) + push_back(entry); + + delete r; +} + +/*------------------------------------------------------------------------*/ + TTscriptMapping::TTscriptMapping() : _id(0) { Common::fill(&_values[0], &_values[8], 0); } @@ -90,7 +126,7 @@ TTnpcScriptBase::TTnpcScriptBase(int charId, const char *charClass, int v2, TTnpcScript::TTnpcScript(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScriptBase(charId, charClass, v2, charName, v3, val2, v4, v5, v6, v7), - _entriesP(nullptr), _entryCount(0), _field68(0), _field6C(0), _rangeResetCtr(0), + _entryCount(0), _field68(0), _field6C(0), _rangeResetCtr(0), _field74(0), _field78(0), _field7C(0), _field80(0), _field2CC(false) { CTrueTalkManager::_v2 = 0; Common::fill(&_dialValues[0], &_dialValues[DIALS_ARRAY_COUNT], 0); @@ -183,7 +219,7 @@ int TTnpcScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, } void TTnpcScript::process(TTroomScript *roomScript, TTsentence *sentence) { - processSentence(_entriesP, _entryCount, roomScript, sentence); + processSentence(&_entries, _entryCount, roomScript, sentence); } int TTnpcScript::proc8() const { diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 66cb3af1c3..3a4ac570b7 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -37,7 +37,6 @@ class CPetControl; class TTroomScript; class TTsentence; struct TTsentenceEntry; -class TTsentenceEntries; struct TTnpcScriptResponse { uint _tag; @@ -62,6 +61,40 @@ struct TTscriptRange { bool isSequential); }; + +struct TTsentenceEntry { + int _field0; + int _field4; + CString _string8; + int _fieldC; + CString _string10; + CString _string14; + CString _string18; + CString _string1C; + int _field20; + CString _string24; + int _field28; + int _field2C; + int _field30; + + TTsentenceEntry() : _field0(0), _field4(0), _fieldC(0), + _field20(0), _field28(0), _field2C(0), _field30(0) {} + + /** + * Load an entry from the passed stream, and returns true + * if an entry was successfully loaded + */ + bool load(Common::SeekableReadStream *s); +}; + +class TTsentenceEntries : public Common::Array { +public: + /** + * Load a list of entries from the specified resource + */ + void load(const CString &resName); +}; + struct TTscriptMapping { uint _id; uint _values[8]; @@ -115,7 +148,7 @@ protected: int _valuesPerResponse; Common::Array _ranges; TTscriptMappings _mappings; - const TTsentenceEntries *_entriesP; + TTsentenceEntries _entries; int _entryCount; int _field68; int _field6C; diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index 8347b424fb..b11912d5e1 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -39,41 +39,6 @@ TTsentenceConcept *TTsentenceConcept::addSibling() { /*------------------------------------------------------------------------*/ -bool TTsentenceEntry::load(Common::SeekableReadStream *s) { - if (s->pos() >= s->size()) - return false; - - _field0 = s->readUint32LE(); - _field4 = s->readUint32LE(); - _string8 = readStringFromStream(s); - _fieldC = s->readUint32LE(); - _string10 = readStringFromStream(s); - _string14 = readStringFromStream(s); - _string18 = readStringFromStream(s); - _string1C = readStringFromStream(s); - _field20 = s->readUint32LE(); - _string24 = readStringFromStream(s); - _field28 = s->readUint32LE(); - _field2C = s->readUint32LE(); - _field30 = s->readUint32LE(); - - return true; -} - -/*------------------------------------------------------------------------*/ - -void TTsentenceEntries::load(const CString &resName) { - TTsentenceEntry entry; - Common::SeekableReadStream *r = g_vm->_filesManager->getResource(resName); - - while (entry.load(r)) - push_back(entry); - - delete r; -} - -/*------------------------------------------------------------------------*/ - TTsentence::TTsentence(int inputCtr, const TTstring &line, CScriptHandler *owner, TTroomScript *roomScript, TTnpcScript *npcScript) : _owner(owner), _field2C(1), _inputCtr(inputCtr), _field34(0), diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index 349d0c3175..f26dd35ce7 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -46,39 +46,6 @@ public: TTsentenceConcept *addSibling(); }; -struct TTsentenceEntry { - int _field0; - int _field4; - CString _string8; - int _fieldC; - CString _string10; - CString _string14; - CString _string18; - CString _string1C; - int _field20; - CString _string24; - int _field28; - int _field2C; - int _field30; - - TTsentenceEntry() : _field0(0), _field4(0), _fieldC(0), - _field20(0), _field28(0), _field2C(0), _field30(0) {} - - /** - * Load an entry from the passed stream, and returns true - * if an entry was successfully loaded - */ - bool load(Common::SeekableReadStream *s); -}; - -class TTsentenceEntries : public Common::Array { -public: - /** - * Load a list of entries from the specified resource - */ - void load(const CString &resName); -}; - class TTsentence { private: CScriptHandler *_owner; -- cgit v1.2.3 From f88e65fe94b756c0277113f341c0d96890bd1d99 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 9 Jun 2016 13:17:38 -0400 Subject: DEVTOOLS: Add Bellbot range data to create_titanic --- devtools/create_titanic/script_ranges.cpp | 633 ++++++++++++++++++++++++++++++ 1 file changed, 633 insertions(+) diff --git a/devtools/create_titanic/script_ranges.cpp b/devtools/create_titanic/script_ranges.cpp index 834b0f5648..6a0140a06b 100644 --- a/devtools/create_titanic/script_ranges.cpp +++ b/devtools/create_titanic/script_ranges.cpp @@ -209,6 +209,639 @@ const ScriptRange BARBOT_RANGES[70] = { { 251779, BARBOT_RANGE70, false, false } }; +const uint BELLBOT_RANGE1[] = { 200059, 200637, 0 }; +const uint BELLBOT_RANGE2[] = { 200001, 200002, 200003, 200004, 200005, 200006, 0 }; +const uint BELLBOT_RANGE3[] = { 200020, 200021, 202117, 202118, 0 }; +const uint BELLBOT_RANGE4[] = { 200023, 200024, 200025, 0 }; +const uint BELLBOT_RANGE5[] = { 200029, 0 }; +const uint BELLBOT_RANGE6[] = { 200034, 200035, 0 }; +const uint BELLBOT_RANGE7[] = { 200038, 200039, 0 }; +const uint BELLBOT_RANGE8[] = { 200061, 200062, 200063, 200064, 200065, 200066, 200201, 200202, 200203, 200204, + 200205, 0 }; +const uint BELLBOT_RANGE9[] = { 200068, 200069, 200070, 200071, 200072, 0 }; +const uint BELLBOT_RANGE10[] = { 200076, 200077, 0 }; + +const uint BELLBOT_RANGE11[] = { 200079, 200080, 200081, 200082, 200083, 200084, 0 }; +const uint BELLBOT_RANGE12[] = { 200119, 200120, 200121, 200122, 200123, 200124, 200125, 200126, 0 }; +const uint BELLBOT_RANGE13[] = { 200134, 200135, 0 }; +const uint BELLBOT_RANGE14[] = { 200141, 200149, 200150, 200151, 200152, 200153, 200154, 200155, 200156, 200142, +200143, 200144, 200145, 200147, 200148, 0 }; +const uint BELLBOT_RANGE15[] = { 200158, 200168, 200169, 200170, 200171, 200172, 200173, 200174, 200175, 200159, +200160, 200161, 200162, 200146, 200163, 200164, 200165, 200166, 200167, 0 }; +const uint BELLBOT_RANGE16[] = { + 200177, 200182, 200183, 200184, 200185, 200186, 200187, 200188, 200189, 200191, + 200178, 200179, 200180, 200181, 0 +}; +const uint BELLBOT_RANGE17[] = { 200194, 200195, 200196, 200197, 200198, 200199, 0 }; +const uint BELLBOT_RANGE18[] = { 200201, 200202, 200203, 200204, 200205, 200078, 0 }; +const uint BELLBOT_RANGE19[] = { 200236, 200237, 200238, 200239, 200240, 0 }; +const uint BELLBOT_RANGE20[] = { 200244, 200245, 200246, 200247, 200248, 0 }; + +const uint BELLBOT_RANGE21[] = { 200262, 200263, 200264, 200265, 200266, 200267, 200268, 200269, 200270, 200271, 0 }; +const uint BELLBOT_RANGE22[] = { 200280, 200281, 200282, 0 }; +const uint BELLBOT_RANGE23[] = { 200284, 200285, 200286, 200287, 200288, 200289, 0 }; +const uint BELLBOT_RANGE24[] = { 200291, 200292, 202254, 0 }; +const uint BELLBOT_RANGE25[] = { 200294, 200295, 200296, 200297, 200298, 200299, 200300, 200301, 200481, 200481, +200481, 0 }; +const uint BELLBOT_RANGE26[] = { 200307, 200308, 200309, 0 }; +const uint BELLBOT_RANGE27[] = { 200312, 200313, 0 }; +const uint BELLBOT_RANGE28[] = { 200324, 200325, 200326, 200327, 200328, 0 }; +const uint BELLBOT_RANGE29[] = { 200331, 200332, 200722, 200723, 0 }; +const uint BELLBOT_RANGE30[] = { 200337, 200338, 200339, 200340, 200341, 200342, 200343, 200344, 200345, 200346, 0 }; + +const uint BELLBOT_RANGE31[] = { 200351, 200352, 200353, 200354, 200355, 200356, 200357, 200358, 0 }; +const uint BELLBOT_RANGE32[] = { 200360, 200361, 0 }; +const uint BELLBOT_RANGE33[] = { 200363, 200364, 0 }; +const uint BELLBOT_RANGE34[] = { 200371, 200372, 200373, 0 }; +const uint BELLBOT_RANGE35[] = { 200375, 200376, 0 }; +const uint BELLBOT_RANGE36[] = { 200394, 200395, 200396, 0 }; +const uint BELLBOT_RANGE37[] = { 200406, 200407, 0 }; +const uint BELLBOT_RANGE38[] = { 200414, 200415, 0 }; +const uint BELLBOT_RANGE39[] = { 200423, 200424, 0 }; +const uint BELLBOT_RANGE40[] = { 200433, 200434, 200435, 0 }; + +const uint BELLBOT_RANGE41[] = { 200437, 200440, 200441, 200442, 200443, 200444, 200445, 200446, 200447, 200438, +200439, 0 }; +const uint BELLBOT_RANGE42[] = { 200449, 200450, 200451, 200452, 200453, 200454, 0 }; +const uint BELLBOT_RANGE43[] = { 200456, 200457, 200458, 0 }; +const uint BELLBOT_RANGE44[] = { + 201036, 201037, 200997, 200998, 200999, 201000, 201009, 201010, 200482, 200483, + 200484, 200485, 200486, 200487, 200488, 200489, 200490, 200691, 202215, 200666, + 200665, 200375, 200788, 200687, 200985, 200986, 201011, 201021, 0 +}; +const uint BELLBOT_RANGE45[] = { 200497, 200498, 200499, 200500, 200501, 200502, 200503, 0 }; +const uint BELLBOT_RANGE46[] = { 200508, 200509, 200510, 202219, 0 }; +const uint BELLBOT_RANGE47[] = { 200517, 200518, 200519, 200520, 200521, 200522, 200523, 200524, 0 }; +const uint BELLBOT_RANGE48[] = { 200529, 200530, 200531, 0 }; +const uint BELLBOT_RANGE49[] = { 200540, 200541, 0 }; +const uint BELLBOT_RANGE50[] = { 200558, 200559, 200560, 200561, 0 }; + +const uint BELLBOT_RANGE51[] = { 200563, 200564, 200565, 200566, 200567, 200568, 200569, 0 }; +const uint BELLBOT_RANGE52[] = { 200572, 200573, 200574, 0 }; +const uint BELLBOT_RANGE53[] = { 200584, 200586, 200587, 200588, 200589, 0 }; +const uint BELLBOT_RANGE54[] = { 200591, 200592, 200593, 0 }; +const uint BELLBOT_RANGE55[] = { 200602, 200603, 200604, 0 }; +const uint BELLBOT_RANGE56[] = { 200606, 200607, 0 }; +const uint BELLBOT_RANGE57[] = { 200619, 200620, 200621, 200622, 200623, 200624, 200625, 200626, 0 }; +const uint BELLBOT_RANGE58[] = { 200636, 200637, 0 }; +const uint BELLBOT_RANGE59[] = { 200672, 200671, 0 }; +const uint BELLBOT_RANGE60[] = { 200679, 201977, 0 }; + +const uint BELLBOT_RANGE61[] = { 200687, 200688, 200689, 200690, 200691, 200692, 0 }; +const uint BELLBOT_RANGE62[] = { 200699, 200700, 0 }; +const uint BELLBOT_RANGE63[] = { 200705, 200706, 200707, 0 }; +const uint BELLBOT_RANGE64[] = { 200711, 200712, 200713, 0 }; +const uint BELLBOT_RANGE65[] = { 200717, 200718, 0 }; +const uint BELLBOT_RANGE66[] = { 200724, 200725, 200726, 200727, 200728, 0 }; +const uint BELLBOT_RANGE67[] = { 200734, 200735, 200736, 0 }; +const uint BELLBOT_RANGE68[] = { 200749, 200750, 200751, 200752, 200753, 200481, 200481, 200481, 0 }; +const uint BELLBOT_RANGE69[] = { 200758, 200759, 0 }; +const uint BELLBOT_RANGE70[] = { 200774, 200775, 200776, 201820, 0 }; + +const uint BELLBOT_RANGE71[] = { 200778, 200779, 200780, 200781, 200481, 200481, 0 }; +const uint BELLBOT_RANGE72[] = { 200783, 200784, 200785, 200786, 200787, 200481, 200481, 0 }; +const uint BELLBOT_RANGE73[] = { 200800, 200801, 200802, 200803, 200804, 200805, 200806, 200807, 200808, 200809, + 200481, 200481, 0 }; +const uint BELLBOT_RANGE74[] = { 200815, 200816, 200481, 0 }; +const uint BELLBOT_RANGE75[] = { 200827, 200828, 200829, 200481, 0 }; +const uint BELLBOT_RANGE76[] = { 200867, 200868, 200869, 200481, 0 }; +const uint BELLBOT_RANGE77[] = { 200875, 200876, 0 }; +const uint BELLBOT_RANGE78[] = { 200878, 200879, 200880, 200481, 0 }; +const uint BELLBOT_RANGE79[] = { 200889, 200890, 200891, 200481, 0 }; +const uint BELLBOT_RANGE80[] = { 200893, 200894, 200895, 200896, 200897, 200898, 200481, 0 }; + +const uint BELLBOT_RANGE81[] = { 200400, 200399, 0 }; +const uint BELLBOT_RANGE82[] = { 200114, 200115, 0 }; +const uint BELLBOT_RANGE83[] = { 200660, 200659, 0 }; +const uint BELLBOT_RANGE84[] = { 200303, 200304, 0 }; +const uint BELLBOT_RANGE85[] = { 200837, 200838, 0 }; +const uint BELLBOT_RANGE86[] = { 200790, 200791, 0 }; +const uint BELLBOT_RANGE87[] = { 200771, 200772, 0 }; +const uint BELLBOT_RANGE88[] = { 200137, 200138, 0 }; +const uint BELLBOT_RANGE89[] = { 200548, 200551, 200555, 200549, 200547, 200553, 200552, 200545, 200550, 200554, +200546, 200556, 0 }; +const uint BELLBOT_RANGE90[] = { + 200906, 200907, 200908, 200909, 200910, 200911, 200912, 200913, 200914, 200915, + 200916, 200917, 200918, 200919, 200922, 200923, 200924, 200925, 200926, 200927, + 200928, 200929, 200930, 0 +}; + +const uint BELLBOT_RANGE91[] = { + 200931, 200932, 200933, 200934, 200935, 200936, 200937, 200938, 200939, 200940, + 200941, 200942, 200943, 200944, 200947, 200948, 200949, 200950, 200951, 200952, + 200953, 200954, 200955, 200956, 200957, 200958, 200959, 200960, 200962, 200965, + 200966, 201028, 201029, 201030, 201033, 202051, 0 +}; +const uint BELLBOT_RANGE92[] = { + 200967, 200968, 200969, 200970, 200971, 200972, 200973, 200974, 200975, 200976, + 200977, 200978, 200979, 200980, 200981, 200982, 200983, 200984, 200985, 200986, + 200987, 200988, 200989, 201036, 201037, 0 +}; +const uint BELLBOT_RANGE93[] = { 200991, 200992, 200993, 200994, 200995, 200996, 201001, 201002, 201003, 201004, +201007, 0 }; +const uint BELLBOT_RANGE94[] = { 200997, 200998, 200999, 201000, 201009, 201010, 0 }; +const uint BELLBOT_RANGE95[] = { 201014, 201015, 201016, 201017, 201018, 201019, 201020, 201023, 201024, 0 }; +const uint BELLBOT_RANGE96[] = { 201025, 201026, 201027, 0 }; +const uint BELLBOT_RANGE97[] = { 201044, 201045, 201046, 201047, 0 }; +const uint BELLBOT_RANGE98[] = { 201048, 201051, 201059, 201063, 201065, 201068, 201069, 200236, 200237, 200238, +200239, 201882, 0 }; +const uint BELLBOT_RANGE99[] = { 201060, 201061, 201062, 0 }; +const uint BELLBOT_RANGE100[] = { 201053, 201054, 0 }; + +const uint BELLBOT_RANGE101[] = { 201055, 201056, 201057, 201058, 0 }; +const uint BELLBOT_RANGE102[] = { 201073, 201074, 201075, 0 }; +const uint BELLBOT_RANGE103[] = { 202158, 201076, 201077, 201078, 202159, 0 }; +const uint BELLBOT_RANGE104[] = { 201079, 201080, 201081, 201082, 201087, 201088, 0 }; +const uint BELLBOT_RANGE105[] = { 201084, 201085, 0 }; +const uint BELLBOT_RANGE106[] = { 201090, 201091, 201092, 201093, 201094, 201095, 201096, 201097, 0 }; +const uint BELLBOT_RANGE107[] = { 201098, 201099, 201100, 201101, 201102, 201105, 201106, 201107, 201108, 0 }; +const uint BELLBOT_RANGE108[] = { + 201111, 201112, 201113, 201114, 201115, 201116, 201117, 201118, 201119, 201120, + 201121, 201122, 201123, 201124, 201125, 201126, 201127, 201128, 201130, 201131, + 201132, 201133, 0 +}; +const uint BELLBOT_RANGE109[] = { 201134, 201136, 201137, 201138, 0 }; +const uint BELLBOT_RANGE110[] = { 201139, 201140, 201141, 201142, 201143, 201144, 201145, 201146, 201147, 201148, 0 }; + +const uint BELLBOT_RANGE111[] = { 201149, 201150, 201151, 201152, 201153, 201154, 201155, 201156, 201157, 0 }; +const uint BELLBOT_RANGE112[] = { 201158, 201159, 201160, 201161, 201162, 201163, 201164, 201165, 201166, 0 }; +const uint BELLBOT_RANGE113[] = { + 201170, 201171, 201172, 201173, 201174, 201175, 201176, 201177, 201178, 201179, + 201180, 201181, 201182, 201183, 201184, 201185, 201186, 201187, 201188, 201189, + 201190, 201191, 201192, 201193, 201194, 201195, 201196, 201197, 201198, 201199, + 201200, 201201, 201202, 201203, 201204, 201205, 201206, 201207, 201208, 201209, + 201210, 201211, 201212, 201213, 201214, 201215, 0 +}; +const uint BELLBOT_RANGE114[] = { 201170, 0 }; +const uint BELLBOT_RANGE115[] = { 201239, 201240, 201241, 0 }; +const uint BELLBOT_RANGE116[] = { 201242, 201243, 0 }; +const uint BELLBOT_RANGE117[] = { 201245, 201246, 201247, 201248, 0 }; +const uint BELLBOT_RANGE118[] = { 201249, 201250, 201251, 201252, 0 }; +const uint BELLBOT_RANGE119[] = { 201253, 201254, 201255, 0 }; +const uint BELLBOT_RANGE120[] = { 201258, 201259, 202138, 201260, 202139, 201261, 202138, 0 }; + +const uint BELLBOT_RANGE121[] = { 201265, 201266, 201267, 201268, 0 }; +const uint BELLBOT_RANGE122[] = { 201310, 201312, 0 }; +const uint BELLBOT_RANGE123[] = { 201313, 201314, 201315, 201316, 201317, 201318, 201319, 201320, 201321, 0 }; +const uint BELLBOT_RANGE124[] = { 201340, 201342, 0 }; +const uint BELLBOT_RANGE125[] = { 201344, 201432, 0 }; +const uint BELLBOT_RANGE126[] = { 201345, 201458, 0 }; +const uint BELLBOT_RANGE127[] = { 201346, 201484, 0 }; +const uint BELLBOT_RANGE128[] = { 201444, 0 }; +const uint BELLBOT_RANGE129[] = { 201348, 201406, 201456, 0 }; +const uint BELLBOT_RANGE130[] = { 201350, 201351, 0 }; + +const uint BELLBOT_RANGE131[] = { 201398, 201352, 201429, 0 }; +const uint BELLBOT_RANGE132[] = { 201354, 201460, 0 }; +const uint BELLBOT_RANGE133[] = { 201355, 201465, 0 }; +const uint BELLBOT_RANGE134[] = { 201356, 201415, 0 }; +const uint BELLBOT_RANGE135[] = { 201357, 201358, 0 }; +const uint BELLBOT_RANGE136[] = { 201359, 201410, 0 }; +const uint BELLBOT_RANGE137[] = { 201360, 201477, 0 }; +const uint BELLBOT_RANGE138[] = { 201361, 201422, 0 }; +const uint BELLBOT_RANGE139[] = { 201362, 201481, 0 }; +const uint BELLBOT_RANGE140[] = { 201363, 201364, 201440, 0 }; + +const uint BELLBOT_RANGE141[] = { 201365, 201366, 0 }; +const uint BELLBOT_RANGE142[] = { 201367, 201390, 0 }; +const uint BELLBOT_RANGE143[] = { 201368, 201461, 0 }; +const uint BELLBOT_RANGE144[] = { 201370, 201419, 0 }; +const uint BELLBOT_RANGE145[] = { 201371, 201462, 0 }; +const uint BELLBOT_RANGE146[] = { 201372, 201423, 201453, 0 }; +const uint BELLBOT_RANGE147[] = { 201374, 201443, 0 }; +const uint BELLBOT_RANGE148[] = { 201376, 201420, 0 }; +const uint BELLBOT_RANGE149[] = { 201377, 201409, 0 }; +const uint BELLBOT_RANGE150[] = { 201378, 201434, 0 }; + +const uint BELLBOT_RANGE151[] = { 201380, 201381, 0 }; +const uint BELLBOT_RANGE152[] = { 201382, 201396, 201414, 201446, 201463, 0 }; +const uint BELLBOT_RANGE153[] = { 201383, 201413, 0 }; +const uint BELLBOT_RANGE154[] = { 201401, 201402, 0 }; +const uint BELLBOT_RANGE155[] = { 201438, 201439, 0 }; +const uint BELLBOT_RANGE156[] = { 201493, 201494, 201495, 201496, 201497, 201498, 201499, 201500, 0 }; +const uint BELLBOT_RANGE157[] = { 201502, 201503, 201504, 201505, 201506, 201507, 201508, 201509, 0 }; +const uint BELLBOT_RANGE158[] = { 201513, 201514, 201515, 201516, 201517, 201518, 201519, 201520, 0 }; +const uint BELLBOT_RANGE159[] = { 201628, 201629, 0 }; +const uint BELLBOT_RANGE160[] = { 201640, 201641, 0 }; + +const uint BELLBOT_RANGE161[] = { 201663, 201664, 0 }; +const uint BELLBOT_RANGE162[] = { 201031, 201032, 0 }; +const uint BELLBOT_RANGE163[] = { 201442, 0 }; +const uint BELLBOT_RANGE164[] = { 201384, 201442, 0 }; +const uint BELLBOT_RANGE165[] = { + 200451, 200452, 200056, 200057, 200228, 201686, 201687, 201688, 201025, 201028, + 201029, 201030, 201033, 201051, 201060, 201061, 201086, 201703, 201315, 201316, + 201497, 201533, 201529, 201525, 201537, 201543, 201546, 201547, 201550, 201559, + 201565, 201573, 201580, 201584, 201594, 201595, 201596, 201597, 201598, 201599, + 201602, 201601, 201605, 201607, 201620, 201625, 201639, 201684, 0 }; +const uint BELLBOT_RANGE166[] = { 200083, 200084, 201335, 0 }; +const uint BELLBOT_RANGE167[] = { 200951, 200952, 200953, 200956, 201029, 200660, 201003, 201060, 201066, 201111, +201115, 0 }; +const uint BELLBOT_RANGE168[] = { 200109, 200110, 0 }; +const uint BELLBOT_RANGE169[] = { 200864, 200865, 0 }; +const uint BELLBOT_RANGE170[] = { 200090, 200091, 0 }; + +const uint BELLBOT_RANGE171[] = { 200675, 200676, 0 }; +const uint BELLBOT_RANGE172[] = { + 201979, 201980, 201981, 201982, 201983, 200442, 200238, 200236, 201098, 201101, + 201102, 201105, 201108, 201270, 201510, 0 +}; +const uint BELLBOT_RANGE173[] = { 202134, 202135, 202136, 202137, 202138, 202139, 0 }; +const uint BELLBOT_RANGE174[] = { 202276, 202232, 200858, 202276, 202276, 202276, 0 }; +const uint BELLBOT_RANGE175[] = { 202214, 202215, 200845, 0 }; +const uint BELLBOT_RANGE176[] = { 201852, 201853, 0 }; +const uint BELLBOT_RANGE177[] = { 202017, 202018, 0 }; +const uint BELLBOT_RANGE178[] = { 202023, 202024, 0 }; +const uint BELLBOT_RANGE179[] = { 202028, 202029, 0 }; +const uint BELLBOT_RANGE180[] = { 202031, 202032, 202033, 202034, 0 }; + +const uint BELLBOT_RANGE181[] = { 202036, 202037, 0 }; +const uint BELLBOT_RANGE182[] = { 202039, 202040, 202041, 0 }; +const uint BELLBOT_RANGE183[] = { 201810, 201811, 0 }; +const uint BELLBOT_RANGE184[] = { 201817, 201818, 201819, 0 }; +const uint BELLBOT_RANGE185[] = { 201823, 201824, 201825, 201826, 201827, 0 }; +const uint BELLBOT_RANGE186[] = { 201829, 201830, 201831, 0 }; +const uint BELLBOT_RANGE187[] = { 201833, 201834, 201838, 200273, 201840, 0 }; +const uint BELLBOT_RANGE188[] = { 201836, 201837, 201838, 0 }; +const uint BELLBOT_RANGE189[] = { 201842, 201843, 0 }; +const uint BELLBOT_RANGE190[] = { 201845, 201846, 0 }; + +const uint BELLBOT_RANGE191[] = { 201860, 201861, 201862, 201867, 201866, 0 }; +const uint BELLBOT_RANGE192[] = { 201866, 201867, 0 }; +const uint BELLBOT_RANGE193[] = { 201871, 201872, 201873, 201874, 0 }; +const uint BELLBOT_RANGE194[] = { 201878, 201879, 0 }; +const uint BELLBOT_RANGE195[] = { 201907, 201908, 201909, 201910, 0 }; +const uint BELLBOT_RANGE196[] = { 201917, 201918, 201919, 201920, 0 }; +const uint BELLBOT_RANGE197[] = { 201925, 201926, 201927, 201808, 0 }; +const uint BELLBOT_RANGE198[] = { 201931, 201932, 201810, 201811, 0 }; +const uint BELLBOT_RANGE199[] = { 201989, 201990, 0 }; +const uint BELLBOT_RANGE200[] = { 202049, 202050, 0 }; + +const uint BELLBOT_RANGE201[] = { 202053, 202054, 0 }; +const uint BELLBOT_RANGE202[] = { 202057, 202058, 202068, 200274, 0 }; +const uint BELLBOT_RANGE203[] = { 202060, 202061, 202062, 202063, 202064, 0 }; +const uint BELLBOT_RANGE204[] = { 202093, 202094, 200275, 202095, 0 }; +const uint BELLBOT_RANGE205[] = { 202097, 202098, 202099, 202100, 202101, 0 }; +const uint BELLBOT_RANGE206[] = { 202104, 202105, 202106, 0 }; +const uint BELLBOT_RANGE207[] = { 202112, 202113, 202114, 200277, 0 }; +const uint BELLBOT_RANGE208[] = { 200020, 200021, 202117, 202118, 200276, 0 }; +const uint BELLBOT_RANGE209[] = { 202120, 202121, 202122, 202123, 202124, 202125, 202126, 0 }; +const uint BELLBOT_RANGE210[] = { 202128, 202129, 202130, 0 }; + +const uint BELLBOT_RANGE211[] = { 202146, 202147, 202148, 201116, 0 }; +const uint BELLBOT_RANGE212[] = { 202151, 202152, 202153, 202154, 202155, 0 }; +const uint BELLBOT_RANGE213[] = { 202163, 202164, 200325, 202023, 202024, 202189, 0 }; +const uint BELLBOT_RANGE214[] = { 202166, 202167, 202168, 0 }; +const uint BELLBOT_RANGE215[] = { 202172, 202173, 0 }; +const uint BELLBOT_RANGE216[] = { 202176, 202177, 0 }; +const uint BELLBOT_RANGE217[] = { 202186, 202187, 0 }; +const uint BELLBOT_RANGE218[] = { 202192, 202193, 0 }; +const uint BELLBOT_RANGE219[] = { 202195, 202196, 202197, 202198, 202199, 202200, 0 }; +const uint BELLBOT_RANGE220[] = { 202158, 202159, 201076, 201077, 201078, 0 }; + +const uint BELLBOT_RANGE221[] = { 200849, 202001, 0 }; +const uint BELLBOT_RANGE222[] = { 202000, 200844, 0 }; +const uint BELLBOT_RANGE223[] = { 201915, 200272, 0 }; +const uint BELLBOT_RANGE224[] = { 200239, 201049, 201063, 201089, 201113, 202150, 201062, 0 }; +const uint BELLBOT_RANGE225[] = { 201984, 201985, 201049, 201065, 201068, 0 }; +const uint BELLBOT_RANGE226[] = { 200001, 200003, 200004, 200005, 200121, 200122, 200351, 200352, 200353, 200354, +200355, 200356, 200357, 200358, 202174, 201085, 200510, 202261, 0 }; +const uint BELLBOT_RANGE227[] = { 202134, 202135, 202136, 202137, 202138, 202139, 200352, 200358, 201084, 0 }; +const uint BELLBOT_RANGE228[] = { 200444, 200081, 200082, 200083, 200084, 200923, 201331, 201343, 202109, 0 }; +const uint BELLBOT_RANGE229[] = { 200280, 200080, 200287, 200922, 201337, 201338, 201339, 201908, 201909, 0 }; +const uint BELLBOT_RANGE230[] = { 201324, 200917, 200281, 200282, 200727, 200924, 200926, 0 }; + +const uint BELLBOT_RANGE231[] = { 201323, 200925, 200927, 200928, 200919, 200906, 201333, 202176, 202178, 202177, +201987, 201989, 201990, 0 }; +const uint BELLBOT_RANGE232[] = { + 200916, 200915, 200918, 200907, 200908, 200909, 200910, 200911, 200912, 200913, + 201325, 201326, 201327, 201328, 201329, 201330, 201332, 201334, 201335, 201336, + 201340, 201341, 201342, 201833, 201834, 0 +}; +const uint BELLBOT_RANGE233[] = { + 200125, 200205, 200264, 200419, 200440, 200443, 200445, 200446, 200447, 200438, + 200420, 200620, 200621, 200622, 200624, 200669, 200771, 200787, 200093, 201026, + 201047, 201088, 201271, 201086, 200664, 2006642, 0 }; +const uint BELLBOT_RANGE234[] = { 200729, 0 }; +const uint BELLBOT_RANGE235[] = { 200252, 200766, 201105, 201106, 201107, 201108, 0 }; +const uint BELLBOT_RANGE236[] = { 202220, 200537, 0 }; +const uint BELLBOT_RANGE237[] = { 202230, 202144, 0 }; +const uint BELLBOT_RANGE238[] = { 202019, 202018, 202017, 201049, 201050, 200891, 201043, 201521, 0 }; +const uint BELLBOT_RANGE239[] = { 200476, 202203, 0 }; +const uint BELLBOT_RANGE240[] = { 200475, 201856, 0 }; + +#define BELLBOT_RANGE_COUNT 283 +static ScriptRange BELLBOT_RANGES[283] = { + { 200058, BELLBOT_RANGE1, false, false }, + { 200000, BELLBOT_RANGE2, true, false }, + { 200019, BELLBOT_RANGE3, true, false }, + { 200022, BELLBOT_RANGE4, true, false }, + { 200027, BELLBOT_RANGE5, false, false }, + { 200033, BELLBOT_RANGE6, false, false }, + { 200037, BELLBOT_RANGE7, false, false }, + { 200060, BELLBOT_RANGE8, true, false }, + { 200067, BELLBOT_RANGE9, true, false }, + { 200075, BELLBOT_RANGE10, false, false }, + + { 200078, BELLBOT_RANGE11, false, false }, + { 200118, BELLBOT_RANGE12, false, false }, + { 200133, BELLBOT_RANGE13, false, false }, + { 200140, BELLBOT_RANGE14, true, false }, + { 200157, BELLBOT_RANGE15, true, false }, + { 200176, BELLBOT_RANGE16, true, false }, + { 200193, BELLBOT_RANGE17, true, false }, + { 200200, BELLBOT_RANGE18, false, false }, + { 200235, BELLBOT_RANGE19, false, false }, + { 200243, BELLBOT_RANGE20, false, false }, + + { 200261, BELLBOT_RANGE21, false, false }, + { 200279, BELLBOT_RANGE22, false, false }, + { 200283, BELLBOT_RANGE23, false, false }, + { 200290, BELLBOT_RANGE24, true, false }, + { 200293, BELLBOT_RANGE25, false, false }, + { 200306, BELLBOT_RANGE26, false, false }, + { 200311, BELLBOT_RANGE27, false, false }, + { 200323, BELLBOT_RANGE28, false, false }, + { 200330, BELLBOT_RANGE29, true, false }, + { 200336, BELLBOT_RANGE30, false, false }, + + { 200350, BELLBOT_RANGE31, false, false }, + { 200359, BELLBOT_RANGE32, false, false }, + { 200362, BELLBOT_RANGE33, false, false }, + { 200370, BELLBOT_RANGE34, false, false }, + { 200374, BELLBOT_RANGE35, false, false }, + { 200393, BELLBOT_RANGE36, false, false }, + { 200405, BELLBOT_RANGE37, false, false }, + { 200413, BELLBOT_RANGE38, false, false }, + { 200422, BELLBOT_RANGE39, false, false }, + { 200432, BELLBOT_RANGE40, true, false }, + + { 200436, BELLBOT_RANGE41, true, false }, + { 200448, BELLBOT_RANGE42, true, false }, + { 200455, BELLBOT_RANGE43, false, false }, + { 200481, BELLBOT_RANGE44, true, false }, + { 200496, BELLBOT_RANGE45, false, false }, + { 200507, BELLBOT_RANGE46, true, false }, + { 200516, BELLBOT_RANGE47, true, false }, + { 200528, BELLBOT_RANGE48, true, false }, + { 200539, BELLBOT_RANGE49, true, false }, + { 200557, BELLBOT_RANGE50, true, false }, + + { 200562, BELLBOT_RANGE51, true, false }, + { 200571, BELLBOT_RANGE52, true, false }, + { 200585, BELLBOT_RANGE53, true, false }, + { 200590, BELLBOT_RANGE54, true, false }, + { 200601, BELLBOT_RANGE55, true, false }, + { 200605, BELLBOT_RANGE56, true, false }, + { 200617, BELLBOT_RANGE57, true, false }, + { 200635, BELLBOT_RANGE58, false, false }, + { 200670, BELLBOT_RANGE59, false, false }, + { 200677, BELLBOT_RANGE60, true, false }, + + { 200686, BELLBOT_RANGE61, false, false }, + { 200698, BELLBOT_RANGE62, false, false }, + { 200704, BELLBOT_RANGE63, false, false }, + { 200710, BELLBOT_RANGE64, true, false }, + { 200716, BELLBOT_RANGE65, false, false }, + { 200723, BELLBOT_RANGE66, true, false }, + { 200733, BELLBOT_RANGE67, false, false }, + { 200748, BELLBOT_RANGE68, true, false }, + { 200757, BELLBOT_RANGE69, false, false }, + { 200773, BELLBOT_RANGE70, true, false }, + + { 200777, BELLBOT_RANGE71, true, false }, + { 200782, BELLBOT_RANGE72, true, false }, + { 200799, BELLBOT_RANGE73, true, false }, + { 200814, BELLBOT_RANGE74, true, false }, + { 200826, BELLBOT_RANGE75, true, false }, + { 200866, BELLBOT_RANGE76, true, false }, + { 200874, BELLBOT_RANGE77, false, false }, + { 200877, BELLBOT_RANGE78, true, false }, + { 200888, BELLBOT_RANGE79, true, false }, + { 200892, BELLBOT_RANGE80, true, false }, + + { 200398, BELLBOT_RANGE81, false, false }, + { 200113, BELLBOT_RANGE82, false, false }, + { 200658, BELLBOT_RANGE83, false, false }, + { 200302, BELLBOT_RANGE84, false, false }, + { 200836, BELLBOT_RANGE85, false, false }, + { 200789, BELLBOT_RANGE86, false, false }, + { 200770, BELLBOT_RANGE87, false, false }, + { 200136, BELLBOT_RANGE88, false, false }, + { 200544, BELLBOT_RANGE89, false, false }, + { 201685, BELLBOT_RANGE90, false, false }, + + { 201686, BELLBOT_RANGE91, true, false }, + { 201687, BELLBOT_RANGE92, true, false }, + { 201688, BELLBOT_RANGE93, true, false }, + { 201689, BELLBOT_RANGE94, false, false }, + { 201690, BELLBOT_RANGE95, false, false }, + { 201691, BELLBOT_RANGE96, false, false }, + { 201692, BELLBOT_RANGE97, true, false }, + { 201693, BELLBOT_RANGE98, true, false }, + { 201694, BELLBOT_RANGE99, false, false }, + { 201695, BELLBOT_RANGE100, true, false }, + + { 201696, BELLBOT_RANGE101, true, false }, + { 201697, BELLBOT_RANGE102, true, false }, + { 201698, BELLBOT_RANGE103, false, false }, + { 201699, BELLBOT_RANGE104, true, false }, + { 201700, BELLBOT_RANGE105, true, false }, + { 201701, BELLBOT_RANGE106, false, false }, + { 201702, BELLBOT_RANGE107, false, false }, + { 201703, BELLBOT_RANGE108, true, false }, + { 201704, BELLBOT_RANGE109, true, false }, + { 201705, BELLBOT_RANGE110, true, false }, + + { 201706, BELLBOT_RANGE111, true, false }, + { 201707, BELLBOT_RANGE112, true, false }, + { 201708, BELLBOT_RANGE113, false, false }, + + { 201709, BELLBOT_RANGE114, false, false }, + { 201710, BELLBOT_RANGE114, false, false }, + { 201711, BELLBOT_RANGE114, false, false }, + { 201712, BELLBOT_RANGE114, false, false }, + { 201713, BELLBOT_RANGE114, false, false }, + { 201714, BELLBOT_RANGE114, false, false }, + { 201715, BELLBOT_RANGE114, false, false }, + { 201716, BELLBOT_RANGE114, false, false }, + { 201717, BELLBOT_RANGE114, false, false }, + { 201718, BELLBOT_RANGE114, false, false }, + { 201719, BELLBOT_RANGE114, false, false }, + { 201720, BELLBOT_RANGE114, false, false }, + { 201721, BELLBOT_RANGE114, false, false }, + { 201722, BELLBOT_RANGE114, false, false }, + { 201723, BELLBOT_RANGE114, false, false }, + { 201724, BELLBOT_RANGE114, false, false }, + { 201725, BELLBOT_RANGE114, false, false }, + { 201726, BELLBOT_RANGE114, false, false }, + { 201727, BELLBOT_RANGE114, false, false }, + { 201728, BELLBOT_RANGE114, false, false }, + { 201729, BELLBOT_RANGE114, false, false }, + { 201730, BELLBOT_RANGE114, false, false }, + { 201731, BELLBOT_RANGE114, false, false }, + { 201732, BELLBOT_RANGE114, false, false }, + { 201733, BELLBOT_RANGE114, false, false }, + { 201735, BELLBOT_RANGE114, false, false }, + { 201736, BELLBOT_RANGE114, false, false }, + { 201737, BELLBOT_RANGE114, false, false }, + { 201738, BELLBOT_RANGE114, false, false }, + { 201739, BELLBOT_RANGE114, false, false }, + { 201740, BELLBOT_RANGE114, false, false }, + { 201741, BELLBOT_RANGE114, false, false }, + { 201743, BELLBOT_RANGE114, false, false }, + { 201744, BELLBOT_RANGE114, false, false }, + { 201745, BELLBOT_RANGE114, false, false }, + { 201746, BELLBOT_RANGE114, false, false }, + { 201747, BELLBOT_RANGE114, false, false }, + { 201748, BELLBOT_RANGE114, false, false }, + { 201749, BELLBOT_RANGE114, false, false }, + { 201750, BELLBOT_RANGE114, false, false }, + { 201751, BELLBOT_RANGE114, false, false }, + { 201752, BELLBOT_RANGE114, false, false }, + { 201753, BELLBOT_RANGE114, false, false }, + { 201754, BELLBOT_RANGE114, false, false }, + + { 201755, BELLBOT_RANGE115, true, false }, + { 201756, BELLBOT_RANGE116, true, false }, + { 201757, BELLBOT_RANGE117, true, false }, + { 201758, BELLBOT_RANGE118, true, false }, + { 201759, BELLBOT_RANGE119, true, false }, + { 201760, BELLBOT_RANGE120, false, false }, + + { 201761, BELLBOT_RANGE121, true, false }, + { 201762, BELLBOT_RANGE122, true, false }, + { 201763, BELLBOT_RANGE123, true, false }, + { 201764, BELLBOT_RANGE124, false, false }, + { 201765, BELLBOT_RANGE125, false, false }, + { 201766, BELLBOT_RANGE126, false, false }, + { 201767, BELLBOT_RANGE127, false, false }, + { 201768, BELLBOT_RANGE128, false, false }, + { 201769, BELLBOT_RANGE129, false, false }, + { 201770, BELLBOT_RANGE130, false, false }, + + { 201771, BELLBOT_RANGE131, true, false }, + { 201772, BELLBOT_RANGE132, false, false }, + { 201773, BELLBOT_RANGE133, false, false }, + { 201774, BELLBOT_RANGE134, false, false }, + { 201775, BELLBOT_RANGE135, false, false }, + { 201776, BELLBOT_RANGE136, false, false }, + { 201777, BELLBOT_RANGE137, false, false }, + { 201778, BELLBOT_RANGE138, false, false }, + { 201779, BELLBOT_RANGE139, false, false }, + { 201780, BELLBOT_RANGE140, false, false }, + + { 201781, BELLBOT_RANGE141, false, false }, + { 201782, BELLBOT_RANGE142, false, false }, + { 201783, BELLBOT_RANGE143, false, false }, + { 201784, BELLBOT_RANGE144, false, false }, + { 201785, BELLBOT_RANGE145, false, false }, + { 201786, BELLBOT_RANGE146, false, false }, + { 201787, BELLBOT_RANGE147, false, false }, + { 201788, BELLBOT_RANGE148, false, false }, + { 201789, BELLBOT_RANGE149, false, false }, + { 201790, BELLBOT_RANGE150, false, false }, + + { 201791, BELLBOT_RANGE151, false, false }, + { 201792, BELLBOT_RANGE152, false, false }, + { 201793, BELLBOT_RANGE153, false, false }, + { 201794, BELLBOT_RANGE154, false, false }, + { 201795, BELLBOT_RANGE155, false, false }, + { 201796, BELLBOT_RANGE156, true, false }, + { 201797, BELLBOT_RANGE157, false, false }, + { 201798, BELLBOT_RANGE158, false, false }, + { 201799, BELLBOT_RANGE159, false, false }, + { 201800, BELLBOT_RANGE160, false, false }, + + { 201801, BELLBOT_RANGE161, false, false }, + { 201802, BELLBOT_RANGE162, false, false }, + { 201803, BELLBOT_RANGE163, false, false }, + { 201804, BELLBOT_RANGE164, true, false }, + { 201805, BELLBOT_RANGE165, true, false }, + { 201806, BELLBOT_RANGE166, true, false }, + { 201807, BELLBOT_RANGE167, true, false }, + { 200108, BELLBOT_RANGE168, false, false }, + { 200863, BELLBOT_RANGE169, false, false }, + { 200089, BELLBOT_RANGE170, false, false }, + + { 200674, BELLBOT_RANGE171, false, false }, + { 201978, BELLBOT_RANGE172, true, false }, + { 202133, BELLBOT_RANGE173, true, false }, + { 202231, BELLBOT_RANGE174, true, false }, + { 202213, BELLBOT_RANGE175, true, false }, + { 201851, BELLBOT_RANGE176, true, false }, + { 202016, BELLBOT_RANGE177, false, false }, + { 202022, BELLBOT_RANGE178, false, false }, + { 202027, BELLBOT_RANGE179, false, false }, + { 202030, BELLBOT_RANGE180, true, false }, + + { 202035, BELLBOT_RANGE181, false, false }, + { 202038, BELLBOT_RANGE182, false, false }, + { 201809, BELLBOT_RANGE183, true, false }, + { 201816, BELLBOT_RANGE184, true, false }, + { 201822, BELLBOT_RANGE185, false, false }, + { 201828, BELLBOT_RANGE186, true, false }, + { 201832, BELLBOT_RANGE187, true, false }, + { 201835, BELLBOT_RANGE188, true, false }, + { 201841, BELLBOT_RANGE189, true, false }, + { 201844, BELLBOT_RANGE190, true, false }, + + { 201859, BELLBOT_RANGE191, true, false }, + { 201865, BELLBOT_RANGE192, true, false }, + { 201870, BELLBOT_RANGE193, false, false }, + { 201877, BELLBOT_RANGE194, false, false }, + { 201906, BELLBOT_RANGE195, true, false }, + { 201916, BELLBOT_RANGE196, true, false }, + { 201924, BELLBOT_RANGE197, true, false }, + { 201930, BELLBOT_RANGE198, true, false }, + { 201988, BELLBOT_RANGE199, true, false }, + { 202048, BELLBOT_RANGE200, true, false }, + + { 202052, BELLBOT_RANGE201, true, false }, + { 202056, BELLBOT_RANGE202, true, false }, + { 202059, BELLBOT_RANGE203, true, false }, + { 202092, BELLBOT_RANGE204, true, false }, + { 202096, BELLBOT_RANGE205, false, false }, + { 202103, BELLBOT_RANGE206, true, false }, + { 202111, BELLBOT_RANGE207, true, false }, + { 202116, BELLBOT_RANGE208, true, true }, + { 202119, BELLBOT_RANGE209, true, false }, + { 202127, BELLBOT_RANGE210, true, false }, + + { 202145, BELLBOT_RANGE211, true, false }, + { 202150, BELLBOT_RANGE212, true, false }, + { 202162, BELLBOT_RANGE213, true, false }, + { 202165, BELLBOT_RANGE214, true, false }, + { 202171, BELLBOT_RANGE215, true, false }, + { 202175, BELLBOT_RANGE216, false, false }, + { 202185, BELLBOT_RANGE217, false, false }, + { 202191, BELLBOT_RANGE218, false, false }, + { 202194, BELLBOT_RANGE219, false, false }, + { 202157, BELLBOT_RANGE220, false, false }, + + { 202256, BELLBOT_RANGE221, true, false }, + { 202255, BELLBOT_RANGE222, true, false }, + { 202257, BELLBOT_RANGE223, true, false }, + { 202258, BELLBOT_RANGE224, true, false }, + { 202259, BELLBOT_RANGE225, true, false }, + { 202260, BELLBOT_RANGE226, true, false }, + { 202261, BELLBOT_RANGE227, true, false }, + { 202262, BELLBOT_RANGE228, true, false }, + { 202263, BELLBOT_RANGE229, true, false }, + { 202264, BELLBOT_RANGE230, true, false }, + + { 202265, BELLBOT_RANGE231, true, false }, + { 202266, BELLBOT_RANGE232, true, false }, + { 202267, BELLBOT_RANGE233, true, false }, + { 202268, BELLBOT_RANGE234, true, false }, + { 202269, BELLBOT_RANGE235, true, false }, + { 202270, BELLBOT_RANGE236, true, false }, + { 202271, BELLBOT_RANGE237, true, false }, + { 202272, BELLBOT_RANGE238, true, false }, + { 202273, BELLBOT_RANGE239, true, false }, + { 202274, BELLBOT_RANGE240, true, false } +}; + const uint DESKBOT_RANGE1[] = { 240002, 240003, 240006, 240007, 0 }; const uint DESKBOT_RANGE2[] = { 240008, 240009, 240010, 240011, 240012, 240013, 240004, 240005, 0 }; const uint DESKBOT_RANGE3[] = { 240336, 240337, 240338, 240339, 240340, 240341, 240342, 240343, 240344, 0 }; -- cgit v1.2.3 From 4cdd55a7f251b40b7b9b354316cf4cf3d1cc88dd Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 9 Jun 2016 19:26:30 -0400 Subject: TITANIC: Implemented remaining TTroomScript virtual methods --- engines/titanic/true_talk/tt_room_script.cpp | 13 +++++++------ engines/titanic/true_talk/tt_room_script.h | 13 +++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/engines/titanic/true_talk/tt_room_script.cpp b/engines/titanic/true_talk/tt_room_script.cpp index 4182498fa5..b8fbca7d39 100644 --- a/engines/titanic/true_talk/tt_room_script.cpp +++ b/engines/titanic/true_talk/tt_room_script.cpp @@ -37,12 +37,13 @@ TTroomScript::TTroomScript(int scriptId) : TTroomScriptBase(scriptId, "", "", 0, -1, -1, -1, 0, 0) { } -void TTroomScript::proc8() { - warning("TODO"); +bool TTroomScript::proc8() const { + return false; } -void TTroomScript::proc9() { - warning("TODO"); +void TTroomScript::proc9(int v) { + if (v == 1) + _field54 = 1; } ScriptChangedResult TTroomScript::scriptChanged(TTscriptBase *npcScript, int id) { @@ -52,8 +53,8 @@ ScriptChangedResult TTroomScript::scriptChanged(TTscriptBase *npcScript, int id) return SCR_1; } -void TTroomScript::proc11() { - warning("TODO"); +bool TTroomScript::proc11() const { + return true; } } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_room_script.h b/engines/titanic/true_talk/tt_room_script.h index 4aa9b16da3..d4da5fcc10 100644 --- a/engines/titanic/true_talk/tt_room_script.h +++ b/engines/titanic/true_talk/tt_room_script.h @@ -47,15 +47,15 @@ public: */ virtual bool canProcess(TTnpcScript *npcScript, TTsentence *sentence) const = 0; - virtual void proc8() = 0; - virtual void proc9() = 0; + virtual bool proc8() const = 0; + virtual void proc9(int v) = 0; /** * Called when the script changes */ virtual ScriptChangedResult scriptChanged(TTscriptBase *npcScript, int id) = 0; - virtual void proc11() = 0; + virtual bool proc11() const = 0; }; @@ -79,15 +79,16 @@ public: return true; } - virtual void proc8(); - virtual void proc9(); + virtual bool proc8() const; + + virtual void proc9(int v); /** * Called when the script changes */ virtual ScriptChangedResult scriptChanged(TTscriptBase *npcScript, int id); - virtual void proc11(); + virtual bool proc11() const; /** * Called with the new script and id -- cgit v1.2.3 From d99e06f373da39f7eda3c302619709d1e042ec8b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 9 Jun 2016 20:03:36 -0400 Subject: TITANIC: Added TTnpcScript checkItems --- engines/titanic/true_talk/barbot_script.cpp | 8 +++++-- engines/titanic/true_talk/barbot_script.h | 6 ++++- engines/titanic/true_talk/tt_npc_script.cpp | 36 +++++++++++++++++++++++++---- engines/titanic/true_talk/tt_npc_script.h | 19 +++++++++++---- engines/titanic/true_talk/tt_sentence.cpp | 5 ++++ engines/titanic/true_talk/tt_sentence.h | 2 ++ 6 files changed, 64 insertions(+), 12 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index f768885088..ba3ca03282 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -114,8 +114,12 @@ int BarbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, return TTnpcScript::chooseResponse(roomScript, sentence, tag); } -void BarbotScript::proc7(int v1, int v2) { - warning("TODO"); +int BarbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { + if (roomScript->_scriptId != 112) + return 2; + + // TODO + return 2; } int BarbotScript::proc10() const { diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index c5f7800de4..4be978cda6 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -49,7 +49,11 @@ public: */ virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag); - virtual void proc7(int v1, int v2); + /** + * Does NPC specific processing of the parsed sentence + */ + virtual int process(TTroomScript *roomScript, TTsentence *sentence); + virtual int proc10() const; virtual int proc15() const; virtual bool proc16() const; diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index e06184a0a0..1f9bb83be1 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -23,12 +23,21 @@ #include "common/textconsole.h" #include "titanic/pet_control/pet_control.h" #include "titanic/true_talk/tt_npc_script.h" +#include "titanic/true_talk/tt_sentence.h" #include "titanic/true_talk/true_talk_manager.h" #include "titanic/game_manager.h" #include "titanic/titanic.h" namespace Titanic { +static const char *const ITEMS[] = { + "chicken", "napkin", "parrot", "moth", "fuse", "eye", "nose", "ear", "mouth", + "auditorycenter", "visioncenter", "olfactorycenter", "speechcenter", "stick", + "longstick", "bomb", "lemon", "puree", "television", "hammer", nullptr +}; + +/*------------------------------------------------------------------------*/ + int TTnpcScriptResponse::size() const { for (int idx = 0; idx < 4; ++idx) { if (_values[idx] == 0) @@ -127,7 +136,7 @@ TTnpcScript::TTnpcScript(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScriptBase(charId, charClass, v2, charName, v3, val2, v4, v5, v6, v7), _entryCount(0), _field68(0), _field6C(0), _rangeResetCtr(0), - _field74(0), _field78(0), _field7C(0), _field80(0), _field2CC(false) { + _field74(0), _field78(0), _field7C(0), _itemStringP(nullptr), _field2CC(false) { CTrueTalkManager::_v2 = 0; Common::fill(&_dialValues[0], &_dialValues[DIALS_ARRAY_COUNT], 0); Common::fill(&_array[0], &_array[136], 0); @@ -218,8 +227,8 @@ int TTnpcScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, return 1; } -void TTnpcScript::process(TTroomScript *roomScript, TTsentence *sentence) { - processSentence(&_entries, _entryCount, roomScript, sentence); +int TTnpcScript::process(TTroomScript *roomScript, TTsentence *sentence) { + return processEntries(&_entries, _entryCount, roomScript, sentence); } int TTnpcScript::proc8() const { @@ -618,7 +627,7 @@ CPetControl *TTnpcScript::getPetControl(CGameManager *gameManager) { return nullptr; } -int TTnpcScript::processSentence(const TTsentenceEntries *entries, uint entryCount, TTroomScript *roomScript, TTsentence *sentence) { +int TTnpcScript::processEntries(const TTsentenceEntries *entries, uint entryCount, TTroomScript *roomScript, TTsentence *sentence) { if (!entries) return SS_1; if (!entryCount) @@ -723,4 +732,23 @@ TTscriptRange *TTnpcScript::findRange(uint id) { return nullptr; } +void TTnpcScript::checkItems(TTroomScript *roomScript, TTsentence *sentence) { + _field2CC = 0; + ++CTrueTalkManager::_v2; + + if (sentence) { + if (!_itemStringP || getRandomNumber(100) > 80) { + for (const char *const *strP = &ITEMS[0]; *strP; ++strP) { + if (sentence->localWord(*strP)) { + _itemStringP = *strP; + break; + } + } + } + + if (sentence->localWord("bomb")) + _field7C = 1; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 3a4ac570b7..f31a769665 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -125,7 +125,11 @@ public: */ virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) = 0; - virtual void proc7(int v1, int v2) = 0; + /** + * Does NPC specific processing of the parsed sentence + */ + virtual int process(TTroomScript *roomScript, TTsentence *sentence) = 0; + virtual int proc8() const = 0; virtual int proc9() const = 0; @@ -156,7 +160,7 @@ protected: int _field74; int _field78; int _field7C; - int _field80; + const char *_itemStringP; int _dialValues[DIALS_ARRAY_COUNT]; int _array[136]; bool _field2CC; @@ -220,9 +224,14 @@ protected: */ TTscriptRange *findRange(uint id); - int processSentence(const TTsentenceEntries *entries, uint entryCount, TTroomScript *roomScript, TTsentence *sentence); + /** + * Scans through a list of sentence entries for a matching standardized response + */ + int processEntries(const TTsentenceEntries *entries, uint entryCount, TTroomScript *roomScript, TTsentence *sentence); bool defaultProcess(TTroomScript *roomScript, TTsentence *sentence); + + void checkItems(TTroomScript *roomScript, TTsentence *sentence); public: TTnpcScript(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, @@ -238,9 +247,9 @@ public: virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag); /** - * Does further NPC specific processing of the sentence + * Does NPC specific processing of the parsed sentence */ - virtual void process(TTroomScript *roomScript, TTsentence *sentence); + virtual int process(TTroomScript *roomScript, TTsentence *sentence); virtual int proc8() const; virtual int proc9() const; diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index b11912d5e1..54c66446f3 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -261,4 +261,9 @@ bool TTsentence::isConcept34(int slotIndex, TTconceptNode *node) { return concept && concept->get34(); } +bool TTsentence::localWord(const char *str) const { + // TODO + return false; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index f26dd35ce7..c9e8de9a7a 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -117,6 +117,8 @@ public: bool fn4(int mode, int wordId, TTconceptNode *node); bool isConcept34(int slotIndex, TTconceptNode *node = nullptr); + + bool localWord(const char *str) const; }; } // End of namespace Titanic -- cgit v1.2.3 From f6cd02ce78627cfbc725eb999aca1a623cf43917 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 9 Jun 2016 20:12:29 -0400 Subject: TITANIC: Added TTsentence contains --- engines/titanic/true_talk/tt_sentence.cpp | 4 ++++ engines/titanic/true_talk/tt_sentence.h | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index 54c66446f3..56ccc5ab04 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -266,4 +266,8 @@ bool TTsentence::localWord(const char *str) const { return false; } +bool TTsentence::contains(const char *str) const { + return _initialLine.contains(str) || _normalizedLine.contains(str); +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index c9e8de9a7a..94cc265f5f 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -119,6 +119,12 @@ public: bool isConcept34(int slotIndex, TTconceptNode *node = nullptr); bool localWord(const char *str) const; + + /** + * Returns true if the sentence (either the original or normalized lines) + * contain the specified substring + */ + bool contains(const char *str) const; }; } // End of namespace Titanic -- cgit v1.2.3 From d3dc8d81ce24146913c531c5d8cae25a383f8e03 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 9 Jun 2016 21:07:27 -0400 Subject: TITANIC: Beginnings of BarbotScript process --- engines/titanic/true_talk/barbot_script.cpp | 79 ++++++++++++++++++++++++++++ engines/titanic/true_talk/barbot_script.h | 3 ++ engines/titanic/true_talk/tt_npc_script.cpp | 10 ++-- engines/titanic/true_talk/tt_npc_script.h | 4 +- engines/titanic/true_talk/tt_script_base.cpp | 4 +- engines/titanic/true_talk/tt_script_base.h | 2 +- 6 files changed, 94 insertions(+), 8 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index ba3ca03282..2687336388 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -30,10 +30,21 @@ static const int STATE_ARRAY[7] = { 0xCAB0, 0xCAB2, 0xCAB3, 0xCAB4, 0xCAB5, 0xCAB6, 0xCAB7 }; +static const uint ARRAY1[] = { + 0, 50033, 50044, 50045, 50046, 50047, 50048, 50049, + 50050, 50051, 50034, 50035, 50036, 50037, 50038, 50039, + 50040, 50041, 50042, 50043, 50411, 0 +}; + +static const uint ARRAY2[] = { + 51899, 51900, 51901, 51902, 51903, 51904, 51905, 51906, 51907, 0 +}; + BarbotScript::BarbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { _state = 0; + _arrIndex = 0; loadRanges("Ranges/Barbot"); loadResponses("Responses/Barbot"); @@ -115,9 +126,73 @@ int BarbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, } int BarbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { + int dialogueId = 0; + if (roomScript->_scriptId != 112) return 2; + checkItems(roomScript, sentence); + if (isState9()) { + if (sentence->localWord("visioncenter") || sentence->localWord("brain") || + sentence->contains("vision") || sentence->contains("visual") || + sentence->contains("brain") || sentence->contains("crystal")) { + if (CTrueTalkManager::getStateValue(2)) { + addResponse(getDialogueId(251003)); + applyResponse(); + CTrueTalkManager::triggerAction(6, 0); + return 2; + } + } + + if (sentence->contains("goldfish")) { + addResponse(getDialogueId(250184)); + applyResponse(); + return 2; + } + + dialogueId = ARRAY1[getRandomNumber(20)]; + if (!ARRAY2[_arrIndex]) + _arrIndex = 0; + + if (_arrIndex) { + dialogueId = ARRAY2[_arrIndex++]; + } else if (getRandomNumber(100) > 35) { + dialogueId = ARRAY2[0]; + _arrIndex = 1; + } else if (getRandomNumber(100) > 60) { + switch (sentence->_field2C) { + case 2: + dialogueId = 51914; + break; + case 3: + dialogueId = 51911; + break; + case 4: + dialogueId = 51913; + break; + case 5: + dialogueId = 51912; + break; + case 6: + dialogueId = 51915; + break; + case 7: + dialogueId = 51909; + break; + default: + break; + } + } + + addResponse(dialogueId); + if (getRandomNumber(100) > 65) + addResponse(getDialogueId(251250)); + applyResponse(); + return 2; + } + + + // TODO return 2; } @@ -189,4 +264,8 @@ void BarbotScript::adjustDial(int dialNum, int amount) { setDial(dialNum, level); } +bool BarbotScript::isState9() const { + return CTrueTalkManager::getStateValue(9) != 0; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index 4be978cda6..419d7cf606 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -30,6 +30,7 @@ namespace Titanic { class BarbotScript : public TTnpcScript { private: int _state; + int _arrIndex; private: /** * Adjust a given dial number by a given delta amount @@ -40,6 +41,8 @@ private: * Setup sentence data */ void setupSentences(); + + bool isState9() const; public: BarbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7); diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 1f9bb83be1..070ecbb583 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -202,8 +202,12 @@ void TTnpcScript::setupDials(int dial1, int dial2, int dial3) { _field78 = -_field78; } -void TTnpcScript::proc4(int v) { - warning("TODO"); +void TTnpcScript::addResponse(int id) { + if (id > 200000) + id = getDialogueId(id); + + proc15(id); + TTscriptBase::addResponse(id); } int TTnpcScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { @@ -266,7 +270,7 @@ void TTnpcScript::selectResponse(int id) { addResponse(id); } -int TTnpcScript::proc15() const { +int TTnpcScript::proc15(int id) const { return 0; } diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index f31a769665..bcf3c7decd 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -237,7 +237,7 @@ public: const char *charName, int v3, int val2, int v4, int v5, int v6, int v7); - virtual void proc4(int v); + virtual void addResponse(int id); /** * Chooses and adds a conversation response based on a specified tag Id. @@ -275,7 +275,7 @@ public: */ virtual void selectResponse(int id); - virtual int proc15() const; + virtual int proc15(int id) const; virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const; virtual bool proc17() const; diff --git a/engines/titanic/true_talk/tt_script_base.cpp b/engines/titanic/true_talk/tt_script_base.cpp index 218c86deb3..c6a197a8a4 100644 --- a/engines/titanic/true_talk/tt_script_base.cpp +++ b/engines/titanic/true_talk/tt_script_base.cpp @@ -98,8 +98,8 @@ void TTscriptBase::addResponse(const TTstring &str) { appendResponse2(-1, nullptr, str); } -void TTscriptBase::addResponse(int val) { - appendResponse(-1, nullptr, val); +void TTscriptBase::addResponse(int id) { + appendResponse(-1, nullptr, id); } void TTscriptBase::applyResponse() { diff --git a/engines/titanic/true_talk/tt_script_base.h b/engines/titanic/true_talk/tt_script_base.h index cdaf8c7fab..e855fefb2c 100644 --- a/engines/titanic/true_talk/tt_script_base.h +++ b/engines/titanic/true_talk/tt_script_base.h @@ -82,7 +82,7 @@ public: virtual void addResponse(const TTstring &str); - virtual void addResponse(int val); + virtual void addResponse(int id); /** * Passes on the list of dialogue Ids stored in the response(s) -- cgit v1.2.3 From 8c237b3ee2c6b33edcc11ce9783f87e34f971508 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 9 Jun 2016 22:14:29 -0400 Subject: TITANIC: Fix NPC handleQuote method stubs --- devtools/create_titanic/create_titanic_dat.cpp | 29 +- devtools/create_titanic/script_ranges.cpp | 1 + devtools/create_titanic/tag_maps.cpp | 391 +++++++++++++++++++++++++ devtools/create_titanic/tag_maps.h | 37 +++ engines/titanic/true_talk/barbot_script.cpp | 5 +- engines/titanic/true_talk/barbot_script.h | 4 +- engines/titanic/true_talk/bellbot_script.cpp | 7 +- engines/titanic/true_talk/bellbot_script.h | 4 +- engines/titanic/true_talk/deskbot_script.h | 1 + engines/titanic/true_talk/doorbot_script.h | 1 + engines/titanic/true_talk/liftbot_script.h | 1 + engines/titanic/true_talk/maitred_script.h | 1 + engines/titanic/true_talk/tt_npc_script.h | 2 + 13 files changed, 464 insertions(+), 20 deletions(-) create mode 100644 devtools/create_titanic/tag_maps.cpp create mode 100644 devtools/create_titanic/tag_maps.h diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index f0f7370693..09a4b4ce35 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -38,6 +38,7 @@ #include "file.h" #include "script_responses.h" #include "script_ranges.h" +#include "tag_maps.h" /** * Format of the access.dat file that will be created: @@ -51,7 +52,7 @@ */ #define VERSION_NUMBER 1 -#define HEADER_SIZE 0x5A0 +#define HEADER_SIZE 0x640 Common::File inputFile, outputFile; Common::PEResources res; @@ -487,19 +488,18 @@ void writeData() { writeNumbers(); writeAllScriptResponses(); writeAllScriptRanges(); + writeAllTagMappings(); } -// Support method used for translating IDA debugger's output for -// an NPC's chooseResponse method tag list to a format for inclusion -// in this tool's script_respones.cpp file -void createScriptResponses() { +void createScriptMap() { Common::File inFile; char line[80]; char c[2]; c[0] = c[1] = '\0'; + int counter = 0; - inFile.open("d:\\temp\\deskbot.txt"); - printf("static const int xxxx_RESPONSES[][5] = {\n"); + inFile.open("d:\\temp\\map.txt"); + printf("static const TagMapping xxxx_ID_MAP[] = {\n"); do { strcpy(line, ""); @@ -511,17 +511,20 @@ void createScriptResponses() { else if (c[0] == '\r') continue; strcat(line, c); - if (inFile.eof() || strlen(line) == (5 * 9)) + if (inFile.eof() || strlen(line) == (2 * 9)) break; } - int tag, v1, v2, v3, v4; - sscanf(line, "%x %x %x %x %x", &tag, &v1, &v2, &v3, &v4); + int v1, v2; + sscanf(line, "%x %x", &v1, &v2); - printf("\t{ MKTAG('%c', '%c', '%c', '%c'), %d, %d, %d, %d },\n", - (tag >> 24) & 0xff, (tag >> 16) & 0xff, (tag >> 8) & 0xff, tag & 0xff, - v1, v2, v3, v4); + if (counter != 0 && (counter % 3) == 0) + printf("\r\n"); + if ((counter % 3) == 0) + printf("\t"); + printf("{ 0x%.5x, 0x%.5x }, ", v1, v2); + ++counter; } while (!inFile.eof()); printf("};\r\n"); diff --git a/devtools/create_titanic/script_ranges.cpp b/devtools/create_titanic/script_ranges.cpp index 6a0140a06b..b6550f78f6 100644 --- a/devtools/create_titanic/script_ranges.cpp +++ b/devtools/create_titanic/script_ranges.cpp @@ -1794,6 +1794,7 @@ void writeScriptRange(const char *name, const ScriptRange *ranges, int count) { void writeAllScriptRanges() { writeScriptRange("Ranges/Barbot", BARBOT_RANGES, BARBOT_RANGE_COUNT); + writeScriptRange("Ranges/Bellbot", BELLBOT_RANGES, BELLBOT_RANGE_COUNT); writeScriptRange("Ranges/Deskbot", DESKBOT_RANGES, DESKBOT_RANGE_COUNT); writeScriptRange("Ranges/Doorbot", DOORBOT_RANGES, DOORBOT_RANGE_COUNT); writeScriptRange("Ranges/Liftbot", LIFTBOT_RANGES, LIFTBOT_RANGE_COUNT); diff --git a/devtools/create_titanic/tag_maps.cpp b/devtools/create_titanic/tag_maps.cpp new file mode 100644 index 0000000000..d3640f8404 --- /dev/null +++ b/devtools/create_titanic/tag_maps.cpp @@ -0,0 +1,391 @@ +/* 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. + * + */ + + // Disable symbol overrides so that we can use system headers. +#define FORBIDDEN_SYMBOL_ALLOW_ALL + +// HACK to allow building with the SDL backend on MinGW +// see bug #1800764 "TOOLS: MinGW tools building broken" +#ifdef main +#undef main +#endif // main + +#include "file.h" +#include "tag_maps.h" + +#define BARBOT_COUNT 250 +static const TagMapping BARBOT_MAP[250] = { + { 0x46cd0, 0x3d21e }, { 0x46ce2, 0x3d23b }, { 0x46ced, 0x3d246 }, + { 0x46cf8, 0x3d251 }, { 0x46d03, 0x3d25c }, { 0x46d0e, 0x3d267 }, + { 0x46d19, 0x3d272 }, { 0x46d24, 0x3d27d }, { 0x46d2f, 0x3d288 }, + { 0x46cd1, 0x3d21f }, { 0x46cd9, 0x3d22a }, { 0x46cda, 0x3d233 }, + { 0x46cdb, 0x3d234 }, { 0x46cdc, 0x3d235 }, { 0x46cdd, 0x3d236 }, + { 0x46cde, 0x3d237 }, { 0x46cdf, 0x3d238 }, { 0x46ce0, 0x3d239 }, + { 0x46ce1, 0x3d23a }, { 0x46ce3, 0x3d23c }, { 0x46ce4, 0x3d23d }, + { 0x46ce5, 0x3d23e }, { 0x46ce6, 0x3d23f }, { 0x46ce7, 0x3d240 }, + { 0x46ce8, 0x3d241 }, { 0x46ce9, 0x3d242 }, { 0x46cea, 0x3d243 }, + { 0x46ceb, 0x3d244 }, { 0x46cec, 0x3d245 }, { 0x46cee, 0x3d26b }, + { 0x46cef, 0x3d247 }, { 0x46cf0, 0x3d248 }, { 0x46cf1, 0x3d249 }, + { 0x46cf2, 0x3d24a }, { 0x46cf3, 0x3d24b }, { 0x46cf4, 0x3d24c }, + { 0x46cf5, 0x3d24d }, { 0x46cf6, 0x3d24e }, { 0x46cf7, 0x3d24f }, + { 0x46cf9, 0x3d250 }, { 0x46cfa, 0x3d252 }, { 0x46cfb, 0x3d253 }, + { 0x46cfc, 0x3d254 }, { 0x46cfd, 0x3d255 }, { 0x46cfe, 0x3d256 }, + { 0x46cff, 0x3d257 }, { 0x46d00, 0x3d258 }, { 0x46d01, 0x3d259 }, + { 0x46d02, 0x3d25a }, { 0x46d04, 0x3d25b }, { 0x46d05, 0x3d25d }, + { 0x46d06, 0x3d25e }, { 0x46d07, 0x3d25f }, { 0x46d08, 0x3d260 }, + { 0x46d09, 0x3d26f }, { 0x46d0a, 0x3d270 }, { 0x46d0b, 0x3d271 }, + { 0x46d0c, 0x3d273 }, { 0x46d0d, 0x3d274 }, { 0x46d0f, 0x3d275 }, + { 0x46d10, 0x3d276 }, { 0x46d11, 0x3d277 }, { 0x46d12, 0x3d278 }, + { 0x46d13, 0x3d279 }, { 0x46d14, 0x3d27a }, { 0x46d15, 0x3d27b }, + { 0x46d16, 0x3d27c }, { 0x46d17, 0x3d27e }, { 0x46d18, 0x3d27f }, + { 0x46d1a, 0x3d280 }, { 0x46d1b, 0x3d281 }, { 0x46d1c, 0x3d282 }, + { 0x46d1d, 0x3d283 }, { 0x46d1e, 0x3d284 }, { 0x46d1f, 0x3d285 }, + { 0x46d20, 0x3d286 }, { 0x46d21, 0x3d287 }, { 0x46d22, 0x3d289 }, + { 0x46d23, 0x3d28a }, { 0x46d25, 0x3d28b }, { 0x46d26, 0x3d28c }, + { 0x46d27, 0x3d28d }, { 0x46d28, 0x3d28e }, { 0x46d29, 0x3d28f }, + { 0x46d2a, 0x3d290 }, { 0x46d2b, 0x3d291 }, { 0x46d2c, 0x3d292 }, + { 0x46d2d, 0x3d220 }, { 0x46d2e, 0x3d221 }, { 0x46d30, 0x3d222 }, + { 0x46d31, 0x3d223 }, { 0x46d32, 0x3d224 }, { 0x46d33, 0x3d225 }, + { 0x46d34, 0x3d226 }, { 0x46d35, 0x3d227 }, { 0x46d36, 0x3d228 }, + { 0x46d37, 0x3d229 }, { 0x46d38, 0x3d22b }, { 0x46d39, 0x3d22c }, + { 0x46cd2, 0x3d22d }, { 0x46cd3, 0x3d22e }, { 0x46cd5, 0x3d22f }, + { 0x46cd6, 0x3d230 }, { 0x46cd7, 0x3d231 }, { 0x46cd8, 0x3d232 }, + { 0x46d3a, 0x3d768 }, { 0x46d3b, 0x3d372 }, { 0x46d47, 0x3d43c }, + { 0x46d48, 0x3d7ce }, { 0x46d49, 0x3d7cf }, { 0x46d4a, 0x3d6f1 }, + { 0x46d4b, 0x3d77c }, { 0x46d4c, 0x3d49d }, { 0x46d4d, 0x3d77c }, + { 0x46d4e, 0x3d0b5 }, { 0x46d4f, 0x3d177 }, { 0x46d50, 0x3d2d7 }, + { 0x46d51, 0x3d77c }, { 0x46d52, 0x3d77c }, { 0x46d53, 0x3d30b }, + { 0x46d55, 0x3d706 }, { 0x46d56, 0x3d704 }, { 0x46d57, 0x3d77c }, + { 0x46d54, 0x3d0a0 }, { 0x46d58, 0x3d722 }, { 0x46d5a, 0x3d44a }, + { 0x46d5b, 0x3d452 }, { 0x46d5c, 0x3d469 }, { 0x46d5d, 0x3d475 }, + { 0x46d5e, 0x3d476 }, { 0x46d5f, 0x3d477 }, { 0x46d60, 0x3d478 }, + { 0x46d61, 0x3d479 }, { 0x46d62, 0x3d47a }, { 0x46d63, 0x3d44b }, + { 0x46d64, 0x3d44c }, { 0x46d65, 0x3d44d }, { 0x46d66, 0x3d44e }, + { 0x46d67, 0x3d44f }, { 0x46d68, 0x3d450 }, { 0x46d69, 0x3d451 }, + { 0x46d6a, 0x3d453 }, { 0x46d6b, 0x3d460 }, { 0x46d6c, 0x3d462 }, + { 0x46d6d, 0x3d463 }, { 0x46d6e, 0x3d464 }, { 0x46d6f, 0x3d465 }, + { 0x46d70, 0x3d466 }, { 0x46d71, 0x3d467 }, { 0x46d72, 0x3d468 }, + { 0x46d73, 0x3d454 }, { 0x46d74, 0x3d455 }, { 0x46d75, 0x3d456 }, + { 0x46d76, 0x3d457 }, { 0x46d77, 0x3d458 }, { 0x46d78, 0x3d459 }, + { 0x46d79, 0x3d45a }, { 0x46d7a, 0x3d45b }, { 0x46d7b, 0x3d45c }, + { 0x46d7c, 0x3d45f }, { 0x46d7d, 0x3d461 }, { 0x46d7e, 0x3d46a }, + { 0x46d7f, 0x3d46d }, { 0x46d80, 0x3d46e }, { 0x46d81, 0x3d46f }, + { 0x46d82, 0x3d470 }, { 0x46d83, 0x3d471 }, { 0x46d84, 0x3d472 }, + { 0x46d85, 0x3d473 }, { 0x46d86, 0x3d474 }, { 0x46d87, 0x3d46b }, + { 0x46d88, 0x3d75d }, { 0x46d89, 0x3d75e }, { 0x46d8a, 0x3d75f }, + { 0x46d8b, 0x3d760 }, { 0x46d8c, 0x3d761 }, { 0x46d8d, 0x3d762 }, + { 0x46d8e, 0x3d763 }, { 0x46d8f, 0x3d766 }, { 0x46d90, 0x3d767 }, + { 0x46d91, 0x3d77c }, { 0x46d92, 0x3d768 }, { 0x46d93, 0x3d765 }, + { 0x46d94, 0x3d769 }, { 0x46d95, 0x3d770 }, { 0x46d96, 0x3d775 }, + { 0x46d97, 0x3d776 }, { 0x46d98, 0x3d777 }, { 0x46d99, 0x3d778 }, + { 0x46d9a, 0x3d779 }, { 0x46d9b, 0x3d77a }, { 0x46d9c, 0x3d77b }, + { 0x46d9d, 0x3d764 }, { 0x46d9e, 0x3d739 }, { 0x46d9f, 0x3d73a }, + { 0x46da0, 0x3d73b }, { 0x46da1, 0x3d73c }, { 0x46da2, 0x3d73d }, + { 0x46da3, 0x3d73e }, { 0x46da4, 0x3d742 }, { 0x46da5, 0x3d744 }, + { 0x46da6, 0x3d743 }, { 0x46da7, 0x3d745 }, { 0x46da8, 0x3d741 }, + { 0x46da9, 0x3d746 }, { 0x46daa, 0x3d747 }, { 0x46dab, 0x3d748 }, + { 0x46dac, 0x3d749 }, { 0x46dad, 0x3d74a }, { 0x46dae, 0x3d74b }, + { 0x46daf, 0x3d73f }, { 0x46db0, 0x3d771 }, { 0x46db1, 0x3d74c }, + { 0x46db2, 0x3d74d }, { 0x46db3, 0x3d74e }, { 0x46db4, 0x3d74f }, + { 0x46db5, 0x3d750 }, { 0x46db6, 0x3d751 }, { 0x46db7, 0x3d753 }, + { 0x46db8, 0x3d755 }, { 0x46db9, 0x3d754 }, { 0x46dba, 0x3d756 }, + { 0x46dbb, 0x3d752 }, { 0x46dbc, 0x3d757 }, { 0x46dbd, 0x3d758 }, + { 0x46dbe, 0x3d759 }, { 0x46dbf, 0x3d75a }, { 0x46dc0, 0x3d75b }, + { 0x46dc1, 0x3d75c }, { 0x46dc2, 0x3d4a7 }, { 0x46dc3, 0x3d2bf }, + { 0x46dc4, 0x3d6fa }, { 0x46dc5, 0x3d6f9 }, { 0x46dc6, 0x3d6fb }, + { 0x46dc7, 0x3d6f5 }, { 0x46dc8, 0x3d6fc }, { 0x46dc9, 0x3d6ff }, + { 0x46dca, 0x3d2ab }, { 0x46dcb, 0x3d715 }, { 0x46dcc, 0x3d710 }, + { 0x46dcd, 0x3d70c }, { 0x46dce, 0x3d712 }, { 0x46dcf, 0x3d70f }, + { 0x46dd0, 0x3d717 }, { 0x46dd1, 0x3d716 }, { 0x46dd2, 0x3d285 }, + { 0x46dd3, 0x3d269 }, { 0x46dd4, 0x3d2f8 }, { 0x46dd5, 0x0c421 }, + { 0x46dd6, 0x0c3fc } +}; + +#define BELLBOT_COUNT 108 +static const TagMapping BELLBOT_MAP[108] = { + { 0x46cd0, 0x31331 }, { 0x46ce2, 0x31332 }, { 0x46ced, 0x31333 }, + { 0x46cf8, 0x31334 }, { 0x46d03, 0x31335 }, { 0x46d0e, 0x31336 }, + { 0x46d19, 0x31337 }, { 0x46d24, 0x31338 }, { 0x46d2f, 0x31339 }, + { 0x46cd1, 0x3133a }, { 0x46cd9, 0x3133b }, { 0x46cda, 0x3133c }, + { 0x46cdb, 0x3133d }, { 0x46cdc, 0x3133e }, { 0x46cdd, 0x3133f }, + { 0x46cde, 0x31340 }, { 0x46cdf, 0x31341 }, { 0x46ce0, 0x31342 }, + { 0x46ce1, 0x31343 }, { 0x46ce3, 0x31344 }, { 0x46ce4, 0x31345 }, + { 0x46ce5, 0x31346 }, { 0x46ce6, 0x31347 }, { 0x46ce7, 0x31348 }, + { 0x46ce8, 0x31349 }, { 0x46ce9, 0x3134a }, { 0x46cea, 0x3134b }, + { 0x46ceb, 0x3134c }, { 0x46cec, 0x3134d }, { 0x46cee, 0x3134e }, + { 0x46cef, 0x3134f }, { 0x46cf0, 0x31350 }, { 0x46cf1, 0x31351 }, + { 0x46cf2, 0x31352 }, { 0x46cf3, 0x31353 }, { 0x46cf4, 0x31354 }, + { 0x46cf5, 0x31355 }, { 0x46cf6, 0x31356 }, { 0x46cf7, 0x31357 }, + { 0x46cf9, 0x31358 }, { 0x46cfa, 0x31359 }, { 0x46cfb, 0x3135a }, + { 0x46cfc, 0x3135b }, { 0x46cfd, 0x3135c }, { 0x46cfe, 0x3135d }, + { 0x46cff, 0x3135e }, { 0x46d00, 0x3135f }, { 0x46d01, 0x31360 }, + { 0x46d02, 0x31361 }, { 0x46d04, 0x31362 }, { 0x46d05, 0x31363 }, + { 0x46d06, 0x31364 }, { 0x46d07, 0x31365 }, { 0x46d08, 0x31366 }, + { 0x46d09, 0x31367 }, { 0x46d0a, 0x31368 }, { 0x46d0b, 0x31369 }, + { 0x46d0c, 0x3136a }, { 0x46d0d, 0x3136b }, { 0x46d0f, 0x3136c }, + { 0x46d10, 0x3136d }, { 0x46d11, 0x3136e }, { 0x46d12, 0x3136f }, + { 0x46d13, 0x31370 }, { 0x46d14, 0x31371 }, { 0x46d15, 0x31372 }, + { 0x46d16, 0x31373 }, { 0x46d17, 0x31374 }, { 0x46d18, 0x31375 }, + { 0x46d1a, 0x31376 }, { 0x46d1b, 0x31377 }, { 0x46d1c, 0x31378 }, + { 0x46d1d, 0x31379 }, { 0x46d1e, 0x3137a }, { 0x46d1f, 0x3137b }, + { 0x46d20, 0x3137c }, { 0x46d21, 0x3137d }, { 0x46d22, 0x3137e }, + { 0x46d23, 0x3137f }, { 0x46d25, 0x31380 }, { 0x46d26, 0x31381 }, + { 0x46d27, 0x31382 }, { 0x46d28, 0x31383 }, { 0x46d29, 0x31384 }, + { 0x46d2a, 0x31385 }, { 0x46d2b, 0x31386 }, { 0x46d2c, 0x31387 }, + { 0x46d2d, 0x31388 }, { 0x46d2e, 0x31389 }, { 0x46d30, 0x3138a }, + { 0x46d31, 0x3138b }, { 0x46d32, 0x3138c }, { 0x46d33, 0x3138d }, + { 0x46d34, 0x3138e }, { 0x46d35, 0x3138f }, { 0x46d36, 0x31390 }, + { 0x46d37, 0x31391 }, { 0x46d38, 0x31392 }, { 0x46d39, 0x31393 }, + { 0x46cd2, 0x31394 }, { 0x46cd3, 0x31395 }, { 0x46cd4, 0x31396 }, + { 0x46cd5, 0x31397 }, { 0x46cd6, 0x31398 }, { 0x46cd7, 0x31399 }, + { 0x46cd8, 0x3139a }, { 0x46d3b, 0x313d7 }, { 0x46d58, 0x313d6 } +}; + +#define DESKBOT_COUNT 108 +static const TagMapping DESKBOT_MAP[108] = { + { 0x46cd0, 0x3ac00 }, { 0x46ce2, 0x3ac10 }, { 0x46ced, 0x3ac1b }, + { 0x46cf8, 0x3ac26 }, { 0x46d03, 0x3ac31 }, { 0x46d0e, 0x3ac3b }, + { 0x46d19, 0x3ac46 }, { 0x46d24, 0x3ac51 }, { 0x46d2f, 0x3ac5c }, + { 0x46cd1, 0x3ac01 }, { 0x46cd9, 0x3ac07 }, { 0x46cda, 0x3ac08 }, + { 0x46cdb, 0x3ac09 }, { 0x46cdc, 0x3ac0a }, { 0x46cdd, 0x3ac0b }, + { 0x46cde, 0x3ac0c }, { 0x46cdf, 0x3ac0d }, { 0x46ce0, 0x3ac0e }, + { 0x46ce1, 0x3ac0f }, { 0x46ce3, 0x3ac11 }, { 0x46ce4, 0x3ac12 }, + { 0x46ce5, 0x3ac13 }, { 0x46ce6, 0x3ac15 }, { 0x46ce7, 0x3ac16 }, + { 0x46ce8, 0x3ac17 }, { 0x46ce9, 0x3ac18 }, { 0x46cea, 0x3ac19 }, + { 0x46ceb, 0x3ac1a }, { 0x46cec, 0x3ac1c }, { 0x46cee, 0x3abf2 }, + { 0x46cef, 0x3ac1d }, { 0x46cf0, 0x3ac1e }, { 0x46cf1, 0x3ac1f }, + { 0x46cf2, 0x3ac20 }, { 0x46cf3, 0x3ac21 }, { 0x46cf4, 0x3ac22 }, + { 0x46cf5, 0x3ac23 }, { 0x46cf6, 0x3ac24 }, { 0x46cf7, 0x3ac25 }, + { 0x46cf9, 0x3ac27 }, { 0x46cfa, 0x3ac28 }, { 0x46cfb, 0x3ac29 }, + { 0x46cfc, 0x3ac2a }, { 0x46cfd, 0x3ac2b }, { 0x46cfe, 0x3ac2c }, + { 0x46cff, 0x3ac2d }, { 0x46d00, 0x3ac2e }, { 0x46d01, 0x3ac2f }, + { 0x46d02, 0x3ac30 }, { 0x46d04, 0x3ac32 }, { 0x46d05, 0x3ac33 }, + { 0x46d06, 0x3ac34 }, { 0x46d07, 0x3ac35 }, { 0x46d08, 0x3ac36 }, + { 0x46d09, 0x3acd2 }, { 0x46d0a, 0x3ac37 }, { 0x46d0b, 0x3ac38 }, + { 0x46d0c, 0x3ac39 }, { 0x46d0d, 0x3ac3a }, { 0x46d0f, 0x3ac3c }, + { 0x46d10, 0x3ac3d }, { 0x46d11, 0x3ac3e }, { 0x46d12, 0x3ac3f }, + { 0x46d13, 0x3ac40 }, { 0x46d14, 0x3ac41 }, { 0x46d15, 0x3ac42 }, + { 0x46d16, 0x3ac43 }, { 0x46d17, 0x3ac44 }, { 0x46d18, 0x3ac45 }, + { 0x46d1a, 0x3ac47 }, { 0x46d1b, 0x3ac48 }, { 0x46d1c, 0x3ac49 }, + { 0x46d1d, 0x3ac4a }, { 0x46d1e, 0x3ac4b }, { 0x46d1f, 0x3ac4c }, + { 0x46d20, 0x3ac4d }, { 0x46d21, 0x3ac4e }, { 0x46d22, 0x3ac4f }, + { 0x46d23, 0x3ac50 }, { 0x46d25, 0x3ac52 }, { 0x46d26, 0x3ac53 }, + { 0x46d27, 0x3ac54 }, { 0x46d28, 0x3ac55 }, { 0x46d29, 0x3ac56 }, + { 0x46d2a, 0x3ac57 }, { 0x46d2b, 0x3ac58 }, { 0x46d2c, 0x3ac59 }, + { 0x46d2d, 0x3ac5a }, { 0x46d2e, 0x3ac5b }, { 0x46d30, 0x3ac5d }, + { 0x46d31, 0x3ac5e }, { 0x46d32, 0x3ac5f }, { 0x46d33, 0x3ac60 }, + { 0x46d34, 0x3ac61 }, { 0x46d35, 0x3ac62 }, { 0x46d36, 0x3ac63 }, + { 0x46d37, 0x3ac64 }, { 0x46d38, 0x3ac65 }, { 0x46d39, 0x3ac66 }, + { 0x46cd2, 0x3ac02 }, { 0x46cd3, 0x3ac03 }, { 0x46cd4, 0x3ac04 }, + { 0x46cd5, 0x3ac05 }, { 0x46cd6, 0x3ac06 }, { 0x46d3b, 0x3ae27 }, + { 0x46d58, 0x3ae0e }, { 0x46dd2, 0x3aebc }, { 0x46dd6, 0x3aebd } +}; + +#define DOORBOT_COUNT 240 +static const TagMapping DOORBOT_MAP[240] = { + { 0x46cd1, 0x35ee6 }, { 0x46cd2, 0x35ee7 }, { 0x46cd3, 0x35ee8 }, + { 0x46cd4, 0x35ee9 }, { 0x46cd5, 0x35eea }, { 0x46cd6, 0x35eeb }, + { 0x46cd7, 0x35eec }, { 0x46cd8, 0x35eed }, { 0x46cd9, 0x35eee }, + { 0x46cda, 0x35eef }, { 0x46cdb, 0x35ef0 }, { 0x46cdc, 0x35ef1 }, + { 0x46cdd, 0x35ef2 }, { 0x46cde, 0x35ef3 }, { 0x46cdf, 0x35ef4 }, + { 0x46ce0, 0x35ef5 }, { 0x46ce1, 0x35ef6 }, { 0x46ce2, 0x35ef7 }, + { 0x46ce3, 0x35ef8 }, { 0x46ce4, 0x35ef9 }, { 0x46ce5, 0x35efa }, + { 0x46ce6, 0x35efb }, { 0x46ce7, 0x35efc }, { 0x46ce8, 0x35efd }, + { 0x46ce9, 0x35efe }, { 0x46cea, 0x35eff }, { 0x46ceb, 0x35f00 }, + { 0x46cec, 0x35f01 }, { 0x46ced, 0x35f02 }, { 0x46cee, 0x35f03 }, + { 0x46cef, 0x35f04 }, { 0x46cf0, 0x35f05 }, { 0x46cf1, 0x35f06 }, + { 0x46cf2, 0x35f07 }, { 0x46cf3, 0x35f08 }, { 0x46cf4, 0x35f09 }, + { 0x46cf5, 0x35f0a }, { 0x46cf6, 0x35f0b }, { 0x46cf7, 0x35f0c }, + { 0x46cf8, 0x35f0d }, { 0x46cf9, 0x35f0e }, { 0x46cfa, 0x35f0f }, + { 0x46cfb, 0x35f10 }, { 0x46cfc, 0x35f11 }, { 0x46cfd, 0x35f12 }, + { 0x46cfe, 0x35f13 }, { 0x46cff, 0x35f14 }, { 0x46d00, 0x35f15 }, + { 0x46d01, 0x35f16 }, { 0x46d02, 0x35f17 }, { 0x46d03, 0x35f18 }, + { 0x46d04, 0x35f19 }, { 0x46d05, 0x35f1a }, { 0x46d06, 0x35f1b }, + { 0x46d07, 0x35f1c }, { 0x46d08, 0x35f1d }, { 0x46d09, 0x35f1e }, + { 0x46d0a, 0x35f1f }, { 0x46d0b, 0x35f20 }, { 0x46d0c, 0x35f21 }, + { 0x46d0d, 0x35f22 }, { 0x46d0e, 0x35f23 }, { 0x46d0f, 0x35f24 }, + { 0x46d10, 0x35f25 }, { 0x46d11, 0x35f26 }, { 0x46d12, 0x35f27 }, + { 0x46d13, 0x35f28 }, { 0x46d14, 0x35f29 }, { 0x46d15, 0x35f2a }, + { 0x46d16, 0x35f2b }, { 0x46d17, 0x35f2c }, { 0x46d18, 0x35f2d }, + { 0x46d19, 0x35f2e }, { 0x46d1a, 0x35f2f }, { 0x46d1b, 0x35f30 }, + { 0x46d1c, 0x35f31 }, { 0x46d1d, 0x35f32 }, { 0x46d1e, 0x35f33 }, + { 0x46d1f, 0x35f34 }, { 0x46d20, 0x35f35 }, { 0x46d21, 0x35f36 }, + { 0x46d22, 0x35f37 }, { 0x46d23, 0x35f38 }, { 0x46d24, 0x35f39 }, + { 0x46d25, 0x35f3a }, { 0x46d26, 0x35f3b }, { 0x46d27, 0x35f3c }, + { 0x46d28, 0x35f3d }, { 0x46d29, 0x35f3e }, { 0x46d2a, 0x35f3f }, + { 0x46d2b, 0x35f40 }, { 0x46d2c, 0x35f41 }, { 0x46d2d, 0x35f42 }, + { 0x46d2e, 0x35f43 }, { 0x46d2f, 0x35f44 }, { 0x46d30, 0x35f45 }, + { 0x46d31, 0x35f46 }, { 0x46d32, 0x35f47 }, { 0x46d33, 0x35f48 }, + { 0x46d34, 0x35f49 }, { 0x46d35, 0x35f4a }, { 0x46d36, 0x35f4b }, + { 0x46d37, 0x35f4c }, { 0x46d38, 0x35f4d }, { 0x46d39, 0x35f4e }, + { 0x46d3a, 0x35bf5 }, { 0x46d3b, 0x360c0 }, { 0x46d3d, 0x36027 }, + { 0x46d3e, 0x36028 }, { 0x46d3f, 0x36029 }, { 0x46d40, 0x3602a }, + { 0x46d41, 0x3602e }, { 0x46d42, 0x3602f }, { 0x46d43, 0x36030 }, + { 0x46d44, 0x36031 }, { 0x46d45, 0x3602c }, { 0x46d46, 0x3602d }, + { 0x46d47, 0x36227 }, { 0x46d48, 0x36084 }, { 0x46d49, 0x36085 }, + { 0x46d4a, 0x36467 }, { 0x46d4b, 0x36457 }, { 0x46d4c, 0x36457 }, + { 0x46d4d, 0x36457 }, { 0x46d4e, 0x3646d }, { 0x46d4f, 0x36457 }, + { 0x46d50, 0x36470 }, { 0x46d51, 0x36457 }, { 0x46d52, 0x36457 }, + { 0x46d53, 0x36457 }, { 0x46d55, 0x360a3 }, { 0x46d56, 0x3634c }, + { 0x46d57, 0x36457 }, { 0x46d54, 0x36457 }, { 0x46d58, 0x360bf }, + { 0x46d5a, 0x36407 }, { 0x46d5b, 0x3640c }, { 0x46d5c, 0x3641a }, + { 0x46d5d, 0x36420 }, { 0x46d5e, 0x36421 }, { 0x46d5f, 0x36422 }, + { 0x46d60, 0x36423 }, { 0x46d61, 0x36424 }, { 0x46d66, 0x36408 }, + { 0x46d67, 0x36409 }, { 0x46d68, 0x3640a }, { 0x46d69, 0x3640b }, + { 0x46d6a, 0x3640d }, { 0x46d6e, 0x36415 }, { 0x46d6f, 0x36416 }, + { 0x46d70, 0x36417 }, { 0x46d71, 0x36418 }, { 0x46d72, 0x36419 }, + { 0x46d73, 0x3640e }, { 0x46d74, 0x3640f }, { 0x46d75, 0x36410 }, + { 0x46d76, 0x36411 }, { 0x46d77, 0x36412 }, { 0x46d7e, 0x3641b }, + { 0x46d7f, 0x3641c }, { 0x46d80, 0x3641d }, { 0x46d81, 0x3641e }, + { 0x46d82, 0x3641f }, { 0x46d88, 0x362d4 }, { 0x46d89, 0x362db }, + { 0x46d8a, 0x362e2 }, { 0x46d8b, 0x362e3 }, { 0x46d8c, 0x362e7 }, + { 0x46d8d, 0x362eb }, { 0x46d8e, 0x362f2 }, { 0x46d8f, 0x362f5 }, + { 0x46d90, 0x36305 }, { 0x46d91, 0x36457 }, { 0x46d92, 0x36309 }, + { 0x46d93, 0x362f4 }, { 0x46d94, 0x3630a }, { 0x46d96, 0x36318 }, + { 0x46d97, 0x36319 }, { 0x46d98, 0x36326 }, { 0x46d99, 0x36327 }, + { 0x46d9a, 0x3632e }, { 0x46d9b, 0x3632f }, { 0x46d9c, 0x36330 }, + { 0x46d9d, 0x362f3 }, { 0x46d9e, 0x362b0 }, { 0x46d9f, 0x362b1 }, + { 0x46da0, 0x362b2 }, { 0x46da1, 0x362b3 }, { 0x46da2, 0x362b4 }, + { 0x46da3, 0x362b5 }, { 0x46da4, 0x362b9 }, { 0x46da5, 0x362bb }, + { 0x46da6, 0x362ba }, { 0x46da7, 0x362bc }, { 0x46da8, 0x362b8 }, + { 0x46da9, 0x362bd }, { 0x46daa, 0x362be }, { 0x46dab, 0x362bf }, + { 0x46dac, 0x362c0 }, { 0x46dad, 0x362c1 }, { 0x46dae, 0x362c2 }, + { 0x46daf, 0x362b6 }, { 0x46db0, 0x36314 }, { 0x46db1, 0x362c3 }, + { 0x46db2, 0x362c4 }, { 0x46db3, 0x362c5 }, { 0x46db4, 0x362c6 }, + { 0x46db5, 0x362c7 }, { 0x46db6, 0x362c8 }, { 0x46db7, 0x362ca }, + { 0x46db8, 0x362cc }, { 0x46db9, 0x362cb }, { 0x46dba, 0x362cd }, + { 0x46dbb, 0x362c9 }, { 0x46dbc, 0x362ce }, { 0x46dbd, 0x362cf }, + { 0x46dbe, 0x362d0 }, { 0x46dbf, 0x362d1 }, { 0x46dc0, 0x362d2 }, + { 0x46dc1, 0x362d3 }, { 0x46dc2, 0x3637c }, { 0x46dc3, 0x3627c }, + { 0x46dc4, 0x36497 }, { 0x46dc5, 0x36493 }, { 0x46dc6, 0x3647f }, + { 0x46dc7, 0x3647c }, { 0x46dc8, 0x36482 }, { 0x46dc9, 0x3648a }, + { 0x46dca, 0x3649b }, { 0x46dcb, 0x364b6 }, { 0x46dcc, 0x364aa }, + { 0x46dcd, 0x364a1 }, { 0x46dce, 0x364b0 }, { 0x46dcf, 0x364a7 }, + { 0x46dd1, 0x364b9 }, { 0x46dd2, 0x36370 }, { 0x46dd3, 0x363ab }, + { 0x46dd4, 0x36404 }, { 0x46dd5, 0x362ab }, { 0x46dd6, 0x3636d } +}; + +#define LIFTBOT_COUNT 118 +static const TagMapping LIFTBOT_MAP[118] = { + { 0x46cd1, 0x335b5 }, { 0x46cd2, 0x33603 }, { 0x46cd3, 0x33604 }, + { 0x46cd4, 0x33605 }, { 0x46cd5, 0x33606 }, { 0x46cd6, 0x33607 }, + { 0x46cd7, 0x33608 }, { 0x46cd8, 0x33607 }, { 0x46cd9, 0x335b6 }, + { 0x46cda, 0x335b7 }, { 0x46cdb, 0x335b8 }, { 0x46cdc, 0x335b9 }, + { 0x46cdd, 0x335ba }, { 0x46cde, 0x335bb }, { 0x46cdf, 0x335bc }, + { 0x46ce0, 0x335bd }, { 0x46ce1, 0x335bf }, { 0x46ce2, 0x335ac }, + { 0x46ce3, 0x335c0 }, { 0x46ce4, 0x335c1 }, { 0x46ce5, 0x335c2 }, + { 0x46ce6, 0x335c4 }, { 0x46ce7, 0x335c5 }, { 0x46ce8, 0x335c6 }, + { 0x46ce9, 0x335c7 }, { 0x46cea, 0x335c8 }, { 0x46ceb, 0x335ca }, + { 0x46cec, 0x335cb }, { 0x46ced, 0x335ad }, { 0x46cee, 0x335cc }, + { 0x46cef, 0x335ce }, { 0x46cf0, 0x335d0 }, { 0x46cf1, 0x335d1 }, + { 0x46cf2, 0x335d2 }, { 0x46cf3, 0x335d4 }, { 0x46cf4, 0x335d5 }, + { 0x46cf5, 0x335d6 }, { 0x46cf6, 0x335d7 }, { 0x46cf7, 0x335d8 }, + { 0x46cf8, 0x335ae }, { 0x46cf9, 0x335d9 }, { 0x46cfa, 0x335db }, + { 0x46cfb, 0x335de }, { 0x46cfc, 0x335df }, { 0x46cfd, 0x335e0 }, + { 0x46cfe, 0x335e1 }, { 0x46cff, 0x335e2 }, { 0x46d00, 0x335e3 }, + { 0x46d01, 0x335e4 }, { 0x46d02, 0x335e5 }, { 0x46d03, 0x335af }, + { 0x46d04, 0x335e6 }, { 0x46d05, 0x335e7 }, { 0x46d06, 0x335ea }, + { 0x46d07, 0x335eb }, { 0x46d08, 0x335ec }, { 0x46d09, 0x3364a }, + { 0x46d0a, 0x3364b }, { 0x46d0b, 0x3364c }, { 0x46d0c, 0x3364d }, + { 0x46d0d, 0x3364e }, { 0x46d0e, 0x335b0 }, { 0x46d0f, 0x33650 }, + { 0x46d10, 0x33651 }, { 0x46d11, 0x33652 }, { 0x46d12, 0x33653 }, + { 0x46d13, 0x33654 }, { 0x46d14, 0x33656 }, { 0x46d15, 0x33657 }, + { 0x46d16, 0x33658 }, { 0x46d17, 0x33659 }, { 0x46d18, 0x3365b }, + { 0x46d19, 0x335b1 }, { 0x46d1a, 0x3365c }, { 0x46d1b, 0x3365d }, + { 0x46d1c, 0x3365e }, { 0x46d1d, 0x3365f }, { 0x46d1e, 0x33660 }, + { 0x46d1f, 0x33661 }, { 0x46d20, 0x33662 }, { 0x46d21, 0x33663 }, + { 0x46d22, 0x335a9 }, { 0x46d23, 0x335aa }, { 0x46d24, 0x335b2 }, + { 0x46d25, 0x335ed }, { 0x46d26, 0x335ee }, { 0x46d27, 0x335ef }, + { 0x46d28, 0x335f0 }, { 0x46d29, 0x335f1 }, { 0x46d2a, 0x335f2 }, + { 0x46d2b, 0x335f4 }, { 0x46d2c, 0x335f5 }, { 0x46d2d, 0x335f6 }, + { 0x46d2e, 0x335f7 }, { 0x46d2f, 0x335b4 }, { 0x46d30, 0x335f8 }, + { 0x46d31, 0x335f9 }, { 0x46d32, 0x335fa }, { 0x46d33, 0x335fb }, + { 0x46d34, 0x335fc }, { 0x46d35, 0x335fd }, { 0x46d36, 0x335ff }, + { 0x46d37, 0x33600 }, { 0x46d38, 0x33601 }, { 0x46d39, 0x33602 }, + { 0x46d3a, 0x3380f }, { 0x46d3b, 0x33695 }, { 0x46d47, 0x07536 }, + { 0x46d4a, 0x3360c }, { 0x46d4e, 0x337fc }, { 0x46d50, 0x337fd }, + { 0x46d56, 0x33800 }, { 0x46d58, 0x33694 }, { 0x46dc2, 0x337f3 }, + { 0x46dc6, 0x337fb }, { 0x46dc7, 0x337f9 }, { 0x46dca, 0x33802 }, + { 0x46dd3, 0x33775 } +}; + +#define MAITRED_COUNT 108 +static const TagMapping MAITRED_MAP[] = { + { 0x46cd0, 0x3f94c }, { 0x46ce2, 0x3f9a6 }, { 0x46ced, 0x3f9a7 }, + { 0x46cf8, 0x3f9a8 }, { 0x46d03, 0x3f9a9 }, { 0x46d0e, 0x3f9aa }, + { 0x46d19, 0x3f9ab }, { 0x46d24, 0x3f9ac }, { 0x46d2f, 0x3f9ad }, + { 0x46cd1, 0x3f9ae }, { 0x46cd9, 0x3f9af }, { 0x46cda, 0x3f9b0 }, + { 0x46cdb, 0x3f9b1 }, { 0x46cdc, 0x3f9b2 }, { 0x46cdd, 0x3f9b3 }, + { 0x46cde, 0x3f9b4 }, { 0x46cdf, 0x3f9b5 }, { 0x46ce0, 0x3f9b6 }, + { 0x46ce1, 0x3f9b7 }, { 0x46ce3, 0x3f9b8 }, { 0x46ce4, 0x3f9b9 }, + { 0x46ce5, 0x3f9ba }, { 0x46ce6, 0x3f9bb }, { 0x46ce7, 0x3f9bc }, + { 0x46ce8, 0x3f9bd }, { 0x46ce9, 0x3f9be }, { 0x46cea, 0x3f9bf }, + { 0x46ceb, 0x3f9c0 }, { 0x46cec, 0x3f9c1 }, { 0x46cee, 0x3f9c2 }, + { 0x46cef, 0x3f9c3 }, { 0x46cf0, 0x3f9c4 }, { 0x46cf1, 0x3f9c5 }, + { 0x46cf2, 0x3f9c6 }, { 0x46cf3, 0x3f9c7 }, { 0x46cf4, 0x3f9c8 }, + { 0x46cf5, 0x3f9c9 }, { 0x46cf6, 0x3f9ca }, { 0x46cf7, 0x3f9cb }, + { 0x46cf9, 0x3f9cc }, { 0x46cfa, 0x3f9cd }, { 0x46cfb, 0x3f9ce }, + { 0x46cfc, 0x3f9cf }, { 0x46cfd, 0x3f9d0 }, { 0x46cfe, 0x3f9d1 }, + { 0x46cff, 0x3f9d2 }, { 0x46d00, 0x3f9d3 }, { 0x46d01, 0x3f9d4 }, + { 0x46d02, 0x3f9d5 }, { 0x46d04, 0x3f9d6 }, { 0x46d05, 0x3f9d7 }, + { 0x46d06, 0x3f9d9 }, { 0x46d07, 0x3f9da }, { 0x46d08, 0x3f9db }, + { 0x46d09, 0x3f98a }, { 0x46d0a, 0x3f98b }, { 0x46d0b, 0x3f98c }, + { 0x46d0c, 0x3f98d }, { 0x46d0d, 0x3f98e }, { 0x46d0f, 0x3f98f }, + { 0x46d10, 0x3f991 }, { 0x46d11, 0x3f992 }, { 0x46d12, 0x3f993 }, + { 0x46d13, 0x3f994 }, { 0x46d14, 0x3f996 }, { 0x46d15, 0x3f997 }, + { 0x46d16, 0x3f998 }, { 0x46d17, 0x3f999 }, { 0x46d18, 0x3f99a }, + { 0x46d1a, 0x3f99b }, { 0x46d1b, 0x3f99c }, { 0x46d1c, 0x3f99d }, + { 0x46d1d, 0x3f99e }, { 0x46d1e, 0x3f99f }, { 0x46d1f, 0x3f9a1 }, + { 0x46d20, 0x3f9a2 }, { 0x46d21, 0x3f9a3 }, { 0x46d22, 0x3f9a4 }, + { 0x46d23, 0x3f9a5 }, { 0x46d25, 0x3f9dd }, { 0x46d26, 0x3f9de }, + { 0x46d27, 0x3f9df }, { 0x46d28, 0x3f9e0 }, { 0x46d29, 0x3f9e1 }, + { 0x46d2a, 0x3f9e2 }, { 0x46d2b, 0x3f9e3 }, { 0x46d2c, 0x3f9e4 }, + { 0x46d2d, 0x3f9e5 }, { 0x46d2e, 0x3f9e6 }, { 0x46d30, 0x3f9e7 }, + { 0x46d31, 0x3f9e8 }, { 0x46d32, 0x3f9e9 }, { 0x46d33, 0x3f9ea }, + { 0x46d34, 0x3f9eb }, { 0x46d35, 0x3f9ec }, { 0x46d36, 0x3f9ed }, + { 0x46d37, 0x3f9ee }, { 0x46d38, 0x3f9ef }, { 0x46d39, 0x3f9f0 }, + { 0x46cd2, 0x3f9f1 }, { 0x46cd3, 0x3f9f2 }, { 0x46cd4, 0x3f9f3 }, + { 0x46cd5, 0x3f9f9 }, { 0x46cd6, 0x3f9fa }, { 0x46cd7, 0x3f9fb }, + { 0x46cd8, 0x3f9fc }, { 0x46d3b, 0x3f853 }, { 0x46d58, 0x3f83c } +}; + +void writeTagMappings(const char *name, const TagMapping *map, int count) { + outputFile.seek(dataOffset); + + for (int idx = 0; idx < count; ++idx, ++map) { + outputFile.writeLong(map->_src); + outputFile.writeLong(map->_dest); + } + + uint size = outputFile.size() - dataOffset; + writeEntryHeader(name, dataOffset, size); + dataOffset += size; +} + +void writeAllTagMappings() { + writeTagMappings("TagMap/Barbot", BARBOT_MAP, BARBOT_COUNT); + writeTagMappings("TagMap/Bellbot", BELLBOT_MAP, BELLBOT_COUNT); + writeTagMappings("TagMap/Deskbot", DESKBOT_MAP, DESKBOT_COUNT); + writeTagMappings("TagMap/Doorbot", DOORBOT_MAP, DOORBOT_COUNT); + writeTagMappings("TagMap/Liftbot", LIFTBOT_MAP, LIFTBOT_COUNT); + writeTagMappings("TagMap/MaitreD", MAITRED_MAP, MAITRED_COUNT); +} \ No newline at end of file diff --git a/devtools/create_titanic/tag_maps.h b/devtools/create_titanic/tag_maps.h new file mode 100644 index 0000000000..33dd8e648c --- /dev/null +++ b/devtools/create_titanic/tag_maps.h @@ -0,0 +1,37 @@ +/* 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. + * + */ + +#ifndef COMMON_TAG_MAPS_H +#define COMMON_TAG_MAPS_H + +#include "common/scummsys.h" + +struct TagMapping { + uint _src; + uint _dest; +}; + +extern void writeAllTagMappings(); +extern void writeEntryHeader(const char *name, uint offset, uint size); +extern uint dataOffset; + +#endif diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index 2687336388..a864107e91 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -207,8 +207,9 @@ int BarbotScript::proc15() const { return 0; } -bool BarbotScript::proc16() const { - warning("TODO"); +bool BarbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, + int val, uint tagId, uint remainder) const { + warning("TODO: handleQuote"); return false; } diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index 419d7cf606..d49cf59a54 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -59,7 +59,9 @@ public: virtual int proc10() const; virtual int proc15() const; - virtual bool proc16() const; + + virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, + int val, uint tagId, uint remainder) const; virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 78eab6ee1f..ddb7e04b44 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -66,9 +66,10 @@ int BellbotScript::proc15() const { return 0; } -bool BellbotScript::proc16() const { - warning("TODO"); - return 0; +bool BellbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, + int val, uint tagId, uint remainder) const { + warning("TODO: handleQuote"); + return false; } bool BellbotScript::proc18() const { diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index cc70b27b8d..1c027e733a 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -46,7 +46,9 @@ public: virtual void proc7(int v1, int v2); virtual int proc10() const; virtual int proc15() const; - virtual bool proc16() const; + + virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, + int val, uint tagId, uint remainder) const; virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index 224496cc0f..0012cf7bc1 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -41,6 +41,7 @@ public: virtual void proc7(int v1, int v2); virtual int proc10() const; virtual int proc15() const; + virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const; diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index f7015e14dd..912e881792 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -52,6 +52,7 @@ public: virtual void proc7(int v1, int v2); virtual int proc10() const; virtual int proc15() const; + virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const; diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index 1db3163956..f3704e128b 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -48,6 +48,7 @@ public: virtual int proc9() const; virtual int proc10() const; virtual int proc15() const; + virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const; diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index 0ebfabfe7f..ea3aaee782 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -44,6 +44,7 @@ public: virtual void proc7(int v1, int v2); virtual int proc10() const; + virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const; diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index bcf3c7decd..be96cf9738 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -276,8 +276,10 @@ public: virtual void selectResponse(int id); virtual int proc15(int id) const; + virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const; + virtual bool proc17() const; virtual bool proc18() const; -- cgit v1.2.3 From ab55958319e285781e086ad2edc28297fce65a3d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 10 Jun 2016 23:56:25 +0200 Subject: TITANIC: Fix compilation on MSVC9 --- engines/titanic/true_talk/true_talk_manager.cpp | 3 +-- engines/titanic/true_talk/tt_string.cpp | 2 +- engines/titanic/true_talk/tt_string.h | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index 91e6c9e36b..5444cde5af 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -335,8 +335,7 @@ void CTrueTalkManager::processInput(CTrueTalkNPC *npc, CTextInputMsg *msg, CView if (npcScript && roomScript) { _currentNPC = npc; - _titleEngine._scriptHandler->processInput(roomScript, npcScript, - TTstring(msg->_input)); + _titleEngine._scriptHandler->processInput(roomScript, npcScript, TTstring(msg->_input)); _currentNPC = nullptr; loadAssets(npc, npcScript->charId()); diff --git a/engines/titanic/true_talk/tt_string.cpp b/engines/titanic/true_talk/tt_string.cpp index 589141303b..198a8c2e80 100644 --- a/engines/titanic/true_talk/tt_string.cpp +++ b/engines/titanic/true_talk/tt_string.cpp @@ -38,7 +38,7 @@ TTstring::TTstring(const CString &str) { _data = new TTstringData(str); } -TTstring::TTstring(TTstring &str) { +TTstring::TTstring(const TTstring &str) { if (str._status != SS_VALID) { _status = SS_5; _data = nullptr; diff --git a/engines/titanic/true_talk/tt_string.h b/engines/titanic/true_talk/tt_string.h index 12daa07a9d..5b12d93418 100644 --- a/engines/titanic/true_talk/tt_string.h +++ b/engines/titanic/true_talk/tt_string.h @@ -51,7 +51,7 @@ public: TTstring(); TTstring(const char *str); TTstring(const CString &str); - TTstring(TTstring &str); + TTstring(const TTstring &str); virtual ~TTstring(); void operator=(const TTstring &str); -- cgit v1.2.3 From 840557236c7f9f3e4e10b586781a36eb712b7de3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 10 Jun 2016 23:28:55 -0400 Subject: TITANIC: Add loading of NPC tag maps, TTnpcScript translateId method --- engines/titanic/true_talk/barbot_script.cpp | 6 +----- engines/titanic/true_talk/barbot_script.h | 2 -- engines/titanic/true_talk/bellbot_script.cpp | 6 +----- engines/titanic/true_talk/bellbot_script.h | 1 - engines/titanic/true_talk/deskbot_script.cpp | 6 +----- engines/titanic/true_talk/deskbot_script.h | 1 - engines/titanic/true_talk/doorbot_script.cpp | 6 +----- engines/titanic/true_talk/doorbot_script.h | 1 - engines/titanic/true_talk/liftbot_script.cpp | 6 +----- engines/titanic/true_talk/liftbot_script.h | 1 - engines/titanic/true_talk/maitred_script.cpp | 6 +----- engines/titanic/true_talk/maitred_script.h | 1 - engines/titanic/true_talk/tt_npc_script.cpp | 20 ++++++++++++++++++++ engines/titanic/true_talk/tt_npc_script.h | 12 ++++++++++++ 14 files changed, 38 insertions(+), 37 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index a864107e91..7cc1e0a698 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -49,6 +49,7 @@ BarbotScript::BarbotScript(int val1, const char *charClass, int v2, loadRanges("Ranges/Barbot"); loadResponses("Responses/Barbot"); setupSentences(); + _tagMappings.load("TagMap/Barbot"); } void BarbotScript::setupSentences() { @@ -255,11 +256,6 @@ int BarbotScript::proc36(int tagId) const { return 0; } -uint BarbotScript::translateId(uint id) const { - warning("TODO"); - return 0; -} - void BarbotScript::adjustDial(int dialNum, int amount) { int level = CLIP(getDialLevel(dialNum) + amount, 0, 100); setDial(dialNum, level); diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index d49cf59a54..4232102371 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -72,8 +72,6 @@ public: virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual void proc32(); virtual int proc36(int val) const; - - virtual uint translateId(uint id) const; }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index ddb7e04b44..fa00718ed8 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -42,6 +42,7 @@ BellbotScript::BellbotScript(int val1, const char *charClass, int v2, loadRanges("Ranges/Bellbot"); loadResponses("Responses/Bellbot", 4); setupSentences(); + _tagMappings.load("TagMap/Bellbot"); } void BellbotScript::setupSentences() { @@ -110,9 +111,4 @@ int BellbotScript::proc36(int id) const { return 0; } -uint BellbotScript::translateId(uint id) const { - warning("TODO"); - return 0; -} - } // End of namespace Titanic diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index 1c027e733a..f13b1b2abe 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -58,7 +58,6 @@ public: virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual int proc36(int val) const; - virtual uint translateId(uint id) const; }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 0b8c7e247d..c323c7c55e 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -43,6 +43,7 @@ DeskbotScript::DeskbotScript(int val1, const char *charClass, int v2, loadRanges("Ranges/Deskbot"); loadResponses("Responses/Deskbot", 4); setupSentences(); + _tagMappings.load("TagMap/Deskbot"); } void DeskbotScript::setupSentences() { @@ -111,11 +112,6 @@ int DeskbotScript::proc36(int id) const { return 0; } -uint DeskbotScript::translateId(uint id) const { - warning("TODO"); - return 0; -} - void DeskbotScript::proc38() { warning("TODO"); } diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index 0012cf7bc1..b75abaa4d5 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -53,7 +53,6 @@ public: virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual int proc36(int val) const; - virtual uint translateId(uint id) const; virtual void proc38(); virtual void proc39(); diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 7e0181308f..bfa1ba9181 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -37,6 +37,7 @@ DoorbotScript::DoorbotScript(int val1, const char *charClass, int v2, loadRanges("Ranges/Doorbot"); loadResponses("Responses/Doorbot"); setupSentences(); + _tagMappings.load("TagMap/Doorbot"); } void DoorbotScript::setupSentences() { @@ -169,11 +170,6 @@ int DoorbotScript::proc36(int id) const { return 0; } -uint DoorbotScript::translateId(uint id) const { - warning("TODO"); - return 0; -} - int DoorbotScript::setResponse(int dialogueId, int v34) { addResponse(dialogueId); applyResponse(); diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 912e881792..ef14cf7e59 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -65,7 +65,6 @@ public: virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual void proc32(); virtual int proc36(int val) const; - virtual uint translateId(uint id) const; }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index b96f485ea9..cabfe41734 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -38,6 +38,7 @@ LiftbotScript::LiftbotScript(int val1, const char *charClass, int v2, loadRanges("Ranges/Liftbot"); loadResponses("Responses/Liftbot"); setupSentences(); + _tagMappings.load("TagMap/Liftbot"); } void LiftbotScript::setupSentences() { @@ -141,9 +142,4 @@ void LiftbotScript::proc32() { warning("TODO"); } -uint LiftbotScript::translateId(uint id) const { - warning("TODO"); - return 0; -} - } // End of namespace Titanic diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index f3704e128b..39ff9bbc52 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -60,7 +60,6 @@ public: virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual void proc32(); - virtual uint translateId(uint id) const; }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index 2497fd83fb..b5d5e3abeb 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -41,6 +41,7 @@ MaitreDScript::MaitreDScript(int val1, const char *charClass, int v2, loadRanges("Ranges/MaitreD"); loadResponses("Responses/MaitreD"); setupSentences(); + _tagMappings.load("TagMap/MaitreD"); } void MaitreDScript::setupSentences() { @@ -110,9 +111,4 @@ int MaitreDScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsenten void MaitreDScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { } -uint MaitreDScript::translateId(uint id) const { - warning("TODO"); - return 0; -} - } // End of namespace Titanic diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index ea3aaee782..0c96434ed4 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -55,7 +55,6 @@ public: virtual const int *getTablePtr(int id); virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); - virtual uint translateId(uint id) const; }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 070ecbb583..d7fc34f4e6 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -124,6 +124,21 @@ void TTscriptMappings::load(const char *name, int valuesPerMapping) { /*------------------------------------------------------------------------*/ +void TTtagMappings::load(const char *name) { + Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); + + while (r->pos() < r->size()) { + uint src = r->readUint32LE(); + uint dest = r->readUint32LE(); + + push_back(TTtagMapping(src, dest)); + } + + delete r; +} + +/*------------------------------------------------------------------------*/ + TTnpcScriptBase::TTnpcScriptBase(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTscriptBase(0, charClass, v2, charName, v3, v4, v5, v6, v7), @@ -489,6 +504,11 @@ int TTnpcScript::proc36(int id) const { } uint TTnpcScript::translateId(uint id) const { + for (uint idx = 0; idx < _tagMappings.size(); ++idx) { + if (_tagMappings[idx]._src == id) + return _tagMappings[idx]._dest; + } + return 0; } diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index be96cf9738..d2a53287c0 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -109,6 +109,17 @@ public: void load(const char *name, int valuesPerMapping); }; +struct TTtagMapping { + uint _src, _dest; + TTtagMapping() : _src(0), _dest(0) {} + TTtagMapping(uint src, uint dest) : _src(src), _dest(dest) {} +}; + +class TTtagMappings : public Common::Array { +public: + void load(const char *name); +}; + class TTnpcScriptBase : public TTscriptBase { protected: int _field54; @@ -153,6 +164,7 @@ protected: Common::Array _ranges; TTscriptMappings _mappings; TTsentenceEntries _entries; + TTtagMappings _tagMappings; int _entryCount; int _field68; int _field6C; -- cgit v1.2.3 From d13501bd1c78504f7d75443e8f45bcee67900e96 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 11 Jun 2016 16:23:40 -0400 Subject: TITANIC: Added TTnpcScript getDialLevel --- engines/titanic/true_talk/tt_npc_script.cpp | 18 +++++++++++++++--- engines/titanic/true_talk/tt_npc_script.h | 8 +++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index d7fc34f4e6..94401da7b5 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -20,6 +20,7 @@ * */ +#include "common/algorithm.h" #include "common/textconsole.h" #include "titanic/pet_control/pet_control.h" #include "titanic/true_talk/tt_npc_script.h" @@ -494,9 +495,20 @@ int TTnpcScript::getDialRegion(int dialNum) { } } -int TTnpcScript::getDialLevel(uint dialNum, bool flag) { - warning("TODO"); - return 0; +int TTnpcScript::getDialLevel(uint dialNum, bool randomizeFlag) { + int result = _dialValues[dialNum]; + if (randomizeFlag) { + bool lowFlag = result <= 50; + result = CLIP(result + (int)getRandomNumber(18) - 9, 0, 100); + + if (lowFlag) { + result = MIN(result, 46); + } else { + result = MAX(result, 54); + } + } + + return result; } int TTnpcScript::proc36(int id) const { diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index d2a53287c0..0e4359b7b0 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -331,10 +331,12 @@ public: virtual int getDialRegion(int dialNum); /** - * Gets the value for a dial, introducing a slight random variance so that - * the displayed dial will oscillate randomly around it's real level + * Gets the value for a dial + * @param dialNum Dial number + * @param randomizeFlag If set, introduces a slight random variance so that + * the displayed dial will oscillate randomly around it's real level */ - virtual int getDialLevel(uint dialNum, bool flag = true); + virtual int getDialLevel(uint dialNum, bool randomizeFlag = true); virtual int proc36(int val) const; virtual uint translateId(uint id) const; -- cgit v1.2.3 From f4ce2d04c35de96bd8cbc2897b0d4998784bfde3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 11 Jun 2016 17:11:45 -0400 Subject: TITANIC: Added Deskbot dial test methods --- engines/titanic/true_talk/deskbot_script.cpp | 16 ++++++++-------- engines/titanic/true_talk/deskbot_script.h | 23 +++++++++++++++++++---- engines/titanic/true_talk/tt_npc_script.cpp | 11 ++++++----- engines/titanic/true_talk/tt_npc_script.h | 8 ++++++-- 4 files changed, 39 insertions(+), 19 deletions(-) diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index c323c7c55e..019f182b1c 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -112,20 +112,20 @@ int DeskbotScript::proc36(int id) const { return 0; } -void DeskbotScript::proc38() { - warning("TODO"); +bool DeskbotScript::isDial0Medium() const { + return getDialRegion(0) == 1; } -void DeskbotScript::proc39() { - warning("TODO"); +bool DeskbotScript::isDial0Low() const { + return getDialRegion(0) == 0; } -void DeskbotScript::proc40() { - warning("TODO"); +bool DeskbotScript::isDial1Medium() const { + return getDialRegion(1) == 1; } -void DeskbotScript::proc41() { - warning("TODO"); +bool DeskbotScript::isDial1Low() const { + return getDialRegion(1) == 0; } } // End of namespace Titanic diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index b75abaa4d5..59438486ab 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -54,10 +54,25 @@ public: virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual int proc36(int val) const; - virtual void proc38(); - virtual void proc39(); - virtual void proc40(); - virtual void proc41(); + /** + * Returns true if dial 1 is the medium (1) region + */ + virtual bool isDial0Medium() const; + + /** + * Returns true if dial 0 is the low end region + */ + virtual bool isDial0Low() const; + + /** + * Returns true if dial 1 is the medium (1) region + */ + bool isDial1Medium() const; + + /** + * Returns true if dial 1 is the low end region + */ + virtual bool isDial1Low() const; }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 94401da7b5..2bfef608dd 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -345,13 +345,14 @@ uint TTnpcScript::getRangeValue(uint id) { } } -void TTnpcScript::proc20(int v) { - warning("TODO"); +void TTnpcScript::resetRange(int id) { + TTscriptRange *range = findRange(id); + if (range && range->_mode != SF_RANDOM) + range->_priorIndex = 0; } int TTnpcScript::proc21(int v1, int v2, int v3) { - // TODO - return v1; + return v2; } int TTnpcScript::proc22(int id) const { @@ -481,7 +482,7 @@ void TTnpcScript::setDial(int dialNum, int value) { } } -int TTnpcScript::getDialRegion(int dialNum) { +int TTnpcScript::getDialRegion(int dialNum) const { if (dialNum < DIALS_ARRAY_COUNT) { int value = _dialValues[dialNum]; if (value < 50) diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 0e4359b7b0..261bc57d7b 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -302,7 +302,11 @@ public: */ virtual uint getRangeValue(uint id); - virtual void proc20(int v); + /** + * Resets the prior used index for the specified range + */ + virtual void resetRange(int id); + virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; virtual int proc23() const; @@ -328,7 +332,7 @@ public: /** * Returns a dial's region number */ - virtual int getDialRegion(int dialNum); + virtual int getDialRegion(int dialNum) const; /** * Gets the value for a dial -- cgit v1.2.3 From bf1657beb011749a17c531aec185b50ba6baf9fc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 11 Jun 2016 17:42:01 -0400 Subject: TITANIC: Changed NPC proc10 definitions to scriptChanged --- engines/titanic/true_talk/barbot_script.cpp | 4 ++-- engines/titanic/true_talk/barbot_script.h | 6 +++++- engines/titanic/true_talk/bellbot_script.cpp | 4 ++-- engines/titanic/true_talk/bellbot_script.h | 7 ++++++- engines/titanic/true_talk/deskbot_script.cpp | 4 ++-- engines/titanic/true_talk/deskbot_script.h | 7 ++++++- engines/titanic/true_talk/doorbot_script.cpp | 4 ++-- engines/titanic/true_talk/doorbot_script.h | 7 ++++++- engines/titanic/true_talk/liftbot_script.cpp | 4 ++-- engines/titanic/true_talk/liftbot_script.h | 7 ++++++- engines/titanic/true_talk/maitred_script.cpp | 4 ++-- engines/titanic/true_talk/maitred_script.h | 6 +++++- engines/titanic/true_talk/parrot_script.cpp | 4 ++-- engines/titanic/true_talk/parrot_script.h | 6 +++++- engines/titanic/true_talk/succubus_script.cpp | 4 ++-- engines/titanic/true_talk/succubus_script.h | 7 ++++++- 16 files changed, 61 insertions(+), 24 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index 7cc1e0a698..c734711cdd 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -198,9 +198,9 @@ int BarbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { return 2; } -int BarbotScript::proc10() const { +ScriptChangedResult BarbotScript::scriptChanged(TTscriptBase *roomScript, uint id) { warning("TODO"); - return 0; + return SCR_1; } int BarbotScript::proc15() const { diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index 4232102371..1456c8d39b 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -57,7 +57,11 @@ public: */ virtual int process(TTroomScript *roomScript, TTsentence *sentence); - virtual int proc10() const; + /** + * Called when the script/id changes + */ + virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); + virtual int proc15() const; virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index fa00718ed8..08bddcb7da 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -57,9 +57,9 @@ void BellbotScript::proc7(int v1, int v2) { warning("TODO"); } -int BellbotScript::proc10() const { +ScriptChangedResult BellbotScript::scriptChanged(TTscriptBase *roomScript, uint id) { warning("TODO"); - return 0; + return SCR_1; } int BellbotScript::proc15() const { diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index f13b1b2abe..141346f820 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -44,7 +44,12 @@ public: const char *charName, int v3, int val2); virtual void proc7(int v1, int v2); - virtual int proc10() const; + + /** + * Called when the script/id changes + */ + virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); + virtual int proc15() const; virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 019f182b1c..91d90b703b 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -58,9 +58,9 @@ void DeskbotScript::proc7(int v1, int v2) { warning("TODO"); } -int DeskbotScript::proc10() const { +ScriptChangedResult DeskbotScript::scriptChanged(TTscriptBase *roomScript, uint id) { warning("TODO"); - return 0; + return SCR_1; } int DeskbotScript::proc15() const { diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index 59438486ab..a5b879808b 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -39,7 +39,12 @@ public: const char *charName, int v3, int val2); virtual void proc7(int v1, int v2); - virtual int proc10() const; + + /** + * Called when the script/id changes + */ + virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); + virtual int proc15() const; virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index bfa1ba9181..427ed65afc 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -112,9 +112,9 @@ void DoorbotScript::proc7(int v1, int v2) { warning("TODO"); } -int DoorbotScript::proc10() const { +ScriptChangedResult DoorbotScript::scriptChanged(TTscriptBase *roomScript, uint id) { warning("TODO"); - return 0; + return SCR_1; } int DoorbotScript::proc15() const { diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index ef14cf7e59..3bff98b812 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -50,7 +50,12 @@ public: virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag); virtual void proc7(int v1, int v2); - virtual int proc10() const; + + /** + * Called when the script/id changes + */ + virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); + virtual int proc15() const; virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index cabfe41734..4a8a86060d 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -89,9 +89,9 @@ int LiftbotScript::proc9() const { return 0; } -int LiftbotScript::proc10() const { +ScriptChangedResult LiftbotScript::scriptChanged(TTscriptBase *roomScript, uint id) { warning("TODO"); - return 0; + return SCR_1; } int LiftbotScript::proc15() const { diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index 39ff9bbc52..bbe296197c 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -46,7 +46,12 @@ public: virtual void proc7(int v1, int v2); virtual int proc9() const; - virtual int proc10() const; + + /** + * Called when the script/id changes + */ + virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); + virtual int proc15() const; virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index b5d5e3abeb..659d6abcfd 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -67,9 +67,9 @@ void MaitreDScript::proc7(int v1, int v2) { warning("TODO"); } -int MaitreDScript::proc10() const { +ScriptChangedResult MaitreDScript::scriptChanged(TTscriptBase *roomScript, uint id) { warning("TODO"); - return 0; + return SCR_1; } bool MaitreDScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index 0c96434ed4..da73e0edbf 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -43,7 +43,11 @@ public: virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag); virtual void proc7(int v1, int v2); - virtual int proc10() const; + + /** + * Called when the script/id changes + */ + virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const; diff --git a/engines/titanic/true_talk/parrot_script.cpp b/engines/titanic/true_talk/parrot_script.cpp index eb08d7ca0e..abb29d0f12 100644 --- a/engines/titanic/true_talk/parrot_script.cpp +++ b/engines/titanic/true_talk/parrot_script.cpp @@ -54,9 +54,9 @@ void ParrotScript::proc7(int v1, int v2) { warning("TODO"); } -int ParrotScript::proc10() const { +ScriptChangedResult ParrotScript::scriptChanged(TTscriptBase *roomScript, uint id) { warning("TODO"); - return 0; + return SCR_1; } bool ParrotScript::proc18() const { diff --git a/engines/titanic/true_talk/parrot_script.h b/engines/titanic/true_talk/parrot_script.h index f5d9cb2828..4d4e07dacd 100644 --- a/engines/titanic/true_talk/parrot_script.h +++ b/engines/titanic/true_talk/parrot_script.h @@ -43,7 +43,11 @@ public: virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag); virtual void proc7(int v1, int v2); - virtual int proc10() const; + + /** + * Called when the script/id changes + */ + virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); virtual bool proc18() const; virtual int proc23() const; diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp index 1a2348499d..9768703633 100644 --- a/engines/titanic/true_talk/succubus_script.cpp +++ b/engines/titanic/true_talk/succubus_script.cpp @@ -78,9 +78,9 @@ void SuccUBusScript::proc7(int v1, int v2) { warning("TODO"); } -int SuccUBusScript::proc10() const { +ScriptChangedResult SuccUBusScript::scriptChanged(TTscriptBase *roomScript, uint id) { warning("TODO"); - return 0; + return SCR_1; } bool SuccUBusScript::proc18() const { diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h index fffdd80d89..482723c38a 100644 --- a/engines/titanic/true_talk/succubus_script.h +++ b/engines/titanic/true_talk/succubus_script.h @@ -45,7 +45,12 @@ public: virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag); virtual void proc7(int v1, int v2); - virtual int proc10() const; + + /** + * Called when the script/id changes + */ + virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); + virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); -- cgit v1.2.3 From 52f6394ae5e0ef37213f12dd430ac0e580ccd463 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 11 Jun 2016 17:49:55 -0400 Subject: TITANIC: Changed NPC proc7 definitions to process --- engines/titanic/true_talk/bellbot_script.cpp | 5 +++-- engines/titanic/true_talk/bellbot_script.h | 5 ++++- engines/titanic/true_talk/deskbot_script.cpp | 5 +++-- engines/titanic/true_talk/deskbot_script.h | 5 ++++- engines/titanic/true_talk/doorbot_script.cpp | 5 +++-- engines/titanic/true_talk/doorbot_script.h | 5 ++++- engines/titanic/true_talk/liftbot_script.cpp | 5 +++-- engines/titanic/true_talk/liftbot_script.h | 6 +++++- engines/titanic/true_talk/maitred_script.cpp | 5 +++-- engines/titanic/true_talk/maitred_script.h | 5 ++++- engines/titanic/true_talk/parrot_script.cpp | 5 +++-- engines/titanic/true_talk/parrot_script.h | 5 ++++- engines/titanic/true_talk/succubus_script.cpp | 5 +++-- engines/titanic/true_talk/succubus_script.h | 5 ++++- 14 files changed, 50 insertions(+), 21 deletions(-) diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 08bddcb7da..623fe07a5d 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -53,8 +53,9 @@ void BellbotScript::setupSentences() { _entryCount = 0; } -void BellbotScript::proc7(int v1, int v2) { - warning("TODO"); +int BellbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { + // TODO + return 0; } ScriptChangedResult BellbotScript::scriptChanged(TTscriptBase *roomScript, uint id) { diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index 141346f820..b6aa92ee0f 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -43,7 +43,10 @@ public: BellbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); - virtual void proc7(int v1, int v2); + /** + * Does NPC specific processing of the parsed sentence + */ + virtual int process(TTroomScript *roomScript, TTsentence *sentence); /** * Called when the script/id changes diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 91d90b703b..999dd65473 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -54,8 +54,9 @@ void DeskbotScript::setupSentences() { _entryCount = 0; } -void DeskbotScript::proc7(int v1, int v2) { - warning("TODO"); +int DeskbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { + // TODO + return 0; } ScriptChangedResult DeskbotScript::scriptChanged(TTscriptBase *roomScript, uint id) { diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index a5b879808b..973641bcc4 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -38,7 +38,10 @@ public: DeskbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); - virtual void proc7(int v1, int v2); + /** + * Does NPC specific processing of the parsed sentence + */ + virtual int process(TTroomScript *roomScript, TTsentence *sentence); /** * Called when the script/id changes diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 427ed65afc..65bf88c4b4 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -108,8 +108,9 @@ int DoorbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence return TTnpcScript::chooseResponse(roomScript, sentence, tag); } -void DoorbotScript::proc7(int v1, int v2) { - warning("TODO"); +int DoorbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { + // TODO + return 0; } ScriptChangedResult DoorbotScript::scriptChanged(TTscriptBase *roomScript, uint id) { diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 3bff98b812..fee23734be 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -49,7 +49,10 @@ public: */ virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag); - virtual void proc7(int v1, int v2); + /** + * Does NPC specific processing of the parsed sentence + */ + virtual int process(TTroomScript *roomScript, TTsentence *sentence); /** * Called when the script/id changes diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index 4a8a86060d..36aea54838 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -80,8 +80,9 @@ int LiftbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence } } -void LiftbotScript::proc7(int v1, int v2) { - warning("TODO"); +int LiftbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { + // TODO + return 0; } int LiftbotScript::proc9() const { diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index bbe296197c..d800eed6ad 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -44,7 +44,11 @@ public: */ virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag); - virtual void proc7(int v1, int v2); + /** + * Does NPC specific processing of the parsed sentence + */ + virtual int process(TTroomScript *roomScript, TTsentence *sentence); + virtual int proc9() const; /** diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index 659d6abcfd..987a7ffdee 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -63,8 +63,9 @@ int MaitreDScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence return TTnpcScript::chooseResponse(roomScript, sentence, tag); } -void MaitreDScript::proc7(int v1, int v2) { - warning("TODO"); +int MaitreDScript::process(TTroomScript *roomScript, TTsentence *sentence) { + // TODO + return 0; } ScriptChangedResult MaitreDScript::scriptChanged(TTscriptBase *roomScript, uint id) { diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index da73e0edbf..87a1fdbf2a 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -42,7 +42,10 @@ public: */ virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag); - virtual void proc7(int v1, int v2); + /** + * Does NPC specific processing of the parsed sentence + */ + virtual int process(TTroomScript *roomScript, TTsentence *sentence); /** * Called when the script/id changes diff --git a/engines/titanic/true_talk/parrot_script.cpp b/engines/titanic/true_talk/parrot_script.cpp index abb29d0f12..cafb220910 100644 --- a/engines/titanic/true_talk/parrot_script.cpp +++ b/engines/titanic/true_talk/parrot_script.cpp @@ -50,8 +50,9 @@ int ParrotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, } } -void ParrotScript::proc7(int v1, int v2) { - warning("TODO"); +int ParrotScript::process(TTroomScript *roomScript, TTsentence *sentence) { + // TODO + return 0; } ScriptChangedResult ParrotScript::scriptChanged(TTscriptBase *roomScript, uint id) { diff --git a/engines/titanic/true_talk/parrot_script.h b/engines/titanic/true_talk/parrot_script.h index 4d4e07dacd..504f3112ba 100644 --- a/engines/titanic/true_talk/parrot_script.h +++ b/engines/titanic/true_talk/parrot_script.h @@ -42,7 +42,10 @@ public: */ virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag); - virtual void proc7(int v1, int v2); + /** + * Does NPC specific processing of the parsed sentence + */ + virtual int process(TTroomScript *roomScript, TTsentence *sentence); /** * Called when the script/id changes diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp index 9768703633..5373f3ff94 100644 --- a/engines/titanic/true_talk/succubus_script.cpp +++ b/engines/titanic/true_talk/succubus_script.cpp @@ -74,8 +74,9 @@ int SuccUBusScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentenc } } -void SuccUBusScript::proc7(int v1, int v2) { - warning("TODO"); +int SuccUBusScript::process(TTroomScript *roomScript, TTsentence *sentence) { + // TODO + return 0; } ScriptChangedResult SuccUBusScript::scriptChanged(TTscriptBase *roomScript, uint id) { diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h index 482723c38a..e83475b666 100644 --- a/engines/titanic/true_talk/succubus_script.h +++ b/engines/titanic/true_talk/succubus_script.h @@ -44,7 +44,10 @@ public: */ virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag); - virtual void proc7(int v1, int v2); + /** + * Does NPC specific processing of the parsed sentence + */ + virtual int process(TTroomScript *roomScript, TTsentence *sentence); /** * Called when the script/id changes -- cgit v1.2.3 From 314a8f25ab8ea8600962af8c82356a728ff3b977 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 11 Jun 2016 21:10:01 -0400 Subject: TITANIC: Added ParrotScript scriptChanged --- engines/titanic/core/game_object.h | 10 +++--- engines/titanic/true_talk/parrot_script.cpp | 51 ++++++++++++++++++++++++++--- engines/titanic/true_talk/tt_npc_script.h | 7 ++++ 3 files changed, 59 insertions(+), 9 deletions(-) diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 22c62a809d..24a8ac2f81 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -228,11 +228,6 @@ protected: */ CGameObject *findRoomObject(const CString &name) const; - /** - * Finds an item in various system areas - */ - Found find(const CString &name, CGameObject **item, int findAreas); - /** * Scan the specified room for an item by name */ @@ -461,6 +456,11 @@ public: int getPriorClass() const; int getSurface45() const; + + /** + * Finds an item in various system areas + */ + Found find(const CString &name, CGameObject **item, int findAreas); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/parrot_script.cpp b/engines/titanic/true_talk/parrot_script.cpp index cafb220910..e0c7a9b6d4 100644 --- a/engines/titanic/true_talk/parrot_script.cpp +++ b/engines/titanic/true_talk/parrot_script.cpp @@ -22,6 +22,7 @@ #include "common/textconsole.h" #include "titanic/true_talk/parrot_script.h" +#include "titanic/titanic.h" namespace Titanic { @@ -51,13 +52,55 @@ int ParrotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, } int ParrotScript::process(TTroomScript *roomScript, TTsentence *sentence) { - // TODO - return 0; + if (processEntries(roomScript, sentence) == 2) { + int tagId = g_vm->_trueTalkManager->_quotes.find(sentence->_normalizedLine); + if (!tagId || chooseResponse(roomScript, sentence, tagId) != 2) { + addResponse(getDialogueId(sentence->check2C() ? 280248 : 280235)); + applyResponse(); + } + } + + return 2; } ScriptChangedResult ParrotScript::scriptChanged(TTscriptBase *roomScript, uint id) { - warning("TODO"); - return SCR_1; + if (id >= 280000 && id <= 280276) { + if (id == 280258) { + if (CTrueTalkManager::_currentNPC) { + CGameObject *chicken; + if (CTrueTalkManager::_currentNPC->find("Chicken", &chicken, FIND_PET)) + id = 280147 - getRandomBit(); + } + + id = getDialogueId(id); + } else { + if ((id == 280146 || id == 280147) && CTrueTalkManager::_currentNPC) { + CGameObject *chicken; + if (CTrueTalkManager::_currentNPC->find("Chicken", &chicken, FIND_PET)) + id = 280142; + } + + addResponse(getDialogueId(id)); + if (id == 280192) + addResponse(getDialogueId(280222)); + applyResponse(); + } + } + + if (id >= 80000 && id <= 80244) { + if ((id == 80155 || id == 80156) && CTrueTalkManager::_currentNPC) { + CGameObject *chicken; + if (CTrueTalkManager::_currentNPC->find("Chicken", &chicken, FIND_PET)) + id = 80151; + } + + addResponse(id); + if (id == 80201) + addResponse(getDialogueId(280222)); + applyResponse(); + } + + return (id == 3) ? SCR_2 : SCR_1; } bool ParrotScript::proc18() const { diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 261bc57d7b..b12c35d67a 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -241,6 +241,13 @@ protected: */ int processEntries(const TTsentenceEntries *entries, uint entryCount, TTroomScript *roomScript, TTsentence *sentence); + /** + * Scans through a list of sentence entries for a matching standardized response + */ + int processEntries(TTroomScript *roomScript, TTsentence *sentence) { + return processEntries(&_entries, _entryCount, roomScript, sentence); + } + bool defaultProcess(TTroomScript *roomScript, TTsentence *sentence); void checkItems(TTroomScript *roomScript, TTsentence *sentence); -- cgit v1.2.3 From a5e6d1e345872cfec5101912db50514b74cf4e38 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 11 Jun 2016 21:21:12 -0400 Subject: TITANIC: Remove deprecated NPC methods for data now loaded from DAT file --- engines/titanic/true_talk/barbot_script.cpp | 5 ----- engines/titanic/true_talk/barbot_script.h | 1 - engines/titanic/true_talk/bellbot_script.cpp | 5 ----- engines/titanic/true_talk/bellbot_script.h | 1 - engines/titanic/true_talk/deskbot_script.cpp | 5 ----- engines/titanic/true_talk/deskbot_script.h | 1 - engines/titanic/true_talk/doorbot_script.cpp | 5 ----- engines/titanic/true_talk/doorbot_script.h | 1 - engines/titanic/true_talk/liftbot_script.cpp | 5 ----- engines/titanic/true_talk/liftbot_script.h | 1 - engines/titanic/true_talk/maitred_script.cpp | 5 ----- engines/titanic/true_talk/maitred_script.h | 1 - engines/titanic/true_talk/parrot_script.cpp | 5 ----- engines/titanic/true_talk/parrot_script.h | 1 - engines/titanic/true_talk/succubus_script.cpp | 5 ----- engines/titanic/true_talk/succubus_script.h | 2 -- engines/titanic/true_talk/tt_npc_script.cpp | 20 -------------------- engines/titanic/true_talk/tt_npc_script.h | 8 -------- engines/titanic/true_talk/tt_scripts.cpp | 2 -- 19 files changed, 79 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index c734711cdd..e66c17b1bd 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -214,11 +214,6 @@ bool BarbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return false; } -bool BarbotScript::proc18() const { - warning("TODO"); - return false; -} - int BarbotScript::proc21(int v1, int v2, int v3) { warning("TODO"); return 0; diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index 1456c8d39b..526cf71a60 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -67,7 +67,6 @@ public: virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const; - virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; virtual int proc23() const; diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 623fe07a5d..3e75fce15b 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -74,11 +74,6 @@ bool BellbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return false; } -bool BellbotScript::proc18() const { - warning("TODO"); - return 0; -} - int BellbotScript::proc21(int v1, int v2, int v3) { warning("TODO"); return 0; diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index b6aa92ee0f..0dcdbfe29f 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -58,7 +58,6 @@ public: virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const; - virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; virtual int proc23() const; diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 999dd65473..54e22a9602 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -75,11 +75,6 @@ bool DeskbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return 0; } -bool DeskbotScript::proc18() const { - warning("TODO"); - return 0; -} - int DeskbotScript::proc21(int v1, int v2, int v3) { warning("TODO"); return 0; diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index 973641bcc4..d0d1f8abab 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -53,7 +53,6 @@ public: virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const; - virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; virtual int proc23() const; diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 65bf88c4b4..7689fc2c04 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -129,11 +129,6 @@ bool DoorbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return 0; } -bool DoorbotScript::proc18() const { - warning("TODO"); - return 0; -} - int DoorbotScript::proc21(int v1, int v2, int v3) { warning("TODO"); return 0; diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index fee23734be..97d42e39b3 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -64,7 +64,6 @@ public: virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const; - virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; virtual int proc23() const; diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index 36aea54838..21bdbdde92 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -106,11 +106,6 @@ bool LiftbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return 0; } -bool LiftbotScript::proc18() const { - warning("TODO"); - return 0; -} - int LiftbotScript::proc21(int v1, int v2, int v3) { warning("TODO"); return 0; diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index d800eed6ad..67565f44a3 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -61,7 +61,6 @@ public: virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const; - virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; virtual int proc23() const; diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index 987a7ffdee..92966adeaf 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -79,11 +79,6 @@ bool MaitreDScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return 0; } -bool MaitreDScript::proc18() const { - warning("TODO"); - return 0; -} - int MaitreDScript::proc21(int v1, int v2, int v3) { warning("TODO"); return 0; diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index 87a1fdbf2a..27c72f1585 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -55,7 +55,6 @@ public: virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const; - virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; virtual int proc23() const; diff --git a/engines/titanic/true_talk/parrot_script.cpp b/engines/titanic/true_talk/parrot_script.cpp index e0c7a9b6d4..8e88e58810 100644 --- a/engines/titanic/true_talk/parrot_script.cpp +++ b/engines/titanic/true_talk/parrot_script.cpp @@ -103,11 +103,6 @@ ScriptChangedResult ParrotScript::scriptChanged(TTscriptBase *roomScript, uint i return (id == 3) ? SCR_2 : SCR_1; } -bool ParrotScript::proc18() const { - warning("TODO"); - return 0; -} - int ParrotScript::proc23() const { warning("TODO"); return 0; diff --git a/engines/titanic/true_talk/parrot_script.h b/engines/titanic/true_talk/parrot_script.h index 504f3112ba..02ec4e967b 100644 --- a/engines/titanic/true_talk/parrot_script.h +++ b/engines/titanic/true_talk/parrot_script.h @@ -52,7 +52,6 @@ public: */ virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); - virtual bool proc18() const; virtual int proc23() const; virtual const int *getTablePtr(int id); virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp index 5373f3ff94..cb1b0356ab 100644 --- a/engines/titanic/true_talk/succubus_script.cpp +++ b/engines/titanic/true_talk/succubus_script.cpp @@ -84,11 +84,6 @@ ScriptChangedResult SuccUBusScript::scriptChanged(TTscriptBase *roomScript, uint return SCR_1; } -bool SuccUBusScript::proc18() const { - warning("TODO"); - return 0; -} - int SuccUBusScript::proc21(int v1, int v2, int v3) { warning("TODO"); return 0; diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h index e83475b666..9787b2cbcf 100644 --- a/engines/titanic/true_talk/succubus_script.h +++ b/engines/titanic/true_talk/succubus_script.h @@ -54,8 +54,6 @@ public: */ virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); - - virtual bool proc18() const; virtual int proc21(int v1, int v2, int v3); virtual int proc23() const; virtual const int *getTablePtr(int id); diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 2bfef608dd..0de460cce3 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -267,18 +267,6 @@ int TTnpcScript::proc12() const { return 1; } -bool TTnpcScript::loadQuotes() { - // Original did a load of a global quotes here the first time - // this method is called. ScummVM implementation has refactored - // the loading to the CTrueTalkManager constructor - - if (!proc18()) { - return false; - } else { - return proc17(); - } -} - void TTnpcScript::selectResponse(int id) { if (id >= 200000 && id <= 290264) id = getDialogueId(id); @@ -295,14 +283,6 @@ bool TTnpcScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return true; } -bool TTnpcScript::proc17() const { - return true; -} - -bool TTnpcScript::proc18() const { - return true; -} - uint TTnpcScript::getRangeValue(uint id) { TTscriptRange *range = findRange(id); if (!range) diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index b12c35d67a..b143af66da 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -283,11 +283,6 @@ public: virtual int proc11() const; virtual int proc12() const; - /** - * Handles loading quotes used by the scripts - */ - virtual bool loadQuotes(); - /** * Translate a passed Id to a dialogue Id if necessary, * and adds it to the response @@ -299,9 +294,6 @@ public: virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const; - virtual bool proc17() const; - virtual bool proc18() const; - /** * Given an Id for a previously registered set of random number values, * picks one of the array values and returns it.. depending on flags, diff --git a/engines/titanic/true_talk/tt_scripts.cpp b/engines/titanic/true_talk/tt_scripts.cpp index 94420a4112..5783866b7e 100644 --- a/engines/titanic/true_talk/tt_scripts.cpp +++ b/engines/titanic/true_talk/tt_scripts.cpp @@ -75,8 +75,6 @@ TTscripts::TTscripts(CTitleEngine *titleEngine) : } void TTscripts::addScript(TTnpcScript *script, int scriptId) { - script->loadQuotes(); - // Find the room script this is associated with TTroomScript *roomScript = getRoomScript(scriptId); assert(roomScript); -- cgit v1.2.3 From 441d168d3782683acd4ec05535d2b73afb1c86f5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 12 Jun 2016 09:03:46 -0400 Subject: TITANIC: Replace NPC proc23 methods with a single getMapping --- engines/titanic/true_talk/barbot_script.cpp | 5 ----- engines/titanic/true_talk/barbot_script.h | 1 - engines/titanic/true_talk/bellbot_script.cpp | 5 ----- engines/titanic/true_talk/bellbot_script.h | 1 - engines/titanic/true_talk/deskbot_script.cpp | 5 ----- engines/titanic/true_talk/deskbot_script.h | 1 - engines/titanic/true_talk/doorbot_script.cpp | 5 ----- engines/titanic/true_talk/doorbot_script.h | 1 - engines/titanic/true_talk/liftbot_script.cpp | 5 ----- engines/titanic/true_talk/liftbot_script.h | 1 - engines/titanic/true_talk/maitred_script.cpp | 5 ----- engines/titanic/true_talk/maitred_script.h | 1 - engines/titanic/true_talk/parrot_script.cpp | 7 ------- engines/titanic/true_talk/parrot_script.h | 1 - engines/titanic/true_talk/succubus_script.cpp | 5 ----- engines/titanic/true_talk/succubus_script.h | 1 - engines/titanic/true_talk/tt_npc_script.cpp | 18 ++++++++++++------ engines/titanic/true_talk/tt_npc_script.h | 2 +- 18 files changed, 13 insertions(+), 57 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index e66c17b1bd..cfde44df9f 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -229,11 +229,6 @@ int BarbotScript::proc23() const { return 0; } -const int *BarbotScript::getTablePtr(int id) { - warning("TODO"); - return nullptr; -} - int BarbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { warning("TODO"); return 0; diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index 526cf71a60..1d73094660 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -70,7 +70,6 @@ public: virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; virtual int proc23() const; - virtual const int *getTablePtr(int id); virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual void proc32(); diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 3e75fce15b..a13f9d6106 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -89,11 +89,6 @@ int BellbotScript::proc23() const { return 0; } -const int *BellbotScript::getTablePtr(int id) { - warning("TODO"); - return nullptr; -} - int BellbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { warning("TODO"); return 0; diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index 0dcdbfe29f..b21d689b71 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -61,7 +61,6 @@ public: virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; virtual int proc23() const; - virtual const int *getTablePtr(int id); virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual int proc36(int val) const; diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 54e22a9602..ca000a4c28 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -90,11 +90,6 @@ int DeskbotScript::proc23() const { return 0; } -const int *DeskbotScript::getTablePtr(int id) { - warning("TODO"); - return nullptr; -} - int DeskbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { warning("TODO"); return 0; diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index d0d1f8abab..f685b7a9ca 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -56,7 +56,6 @@ public: virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; virtual int proc23() const; - virtual const int *getTablePtr(int id); virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual int proc36(int val) const; diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 7689fc2c04..0db75474eb 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -144,11 +144,6 @@ int DoorbotScript::proc23() const { return 0; } -const int *DoorbotScript::getTablePtr(int id) { - warning("TODO"); - return nullptr; -} - int DoorbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { warning("TODO"); return 0; diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 97d42e39b3..f50fa28f12 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -67,7 +67,6 @@ public: virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; virtual int proc23() const; - virtual const int *getTablePtr(int id); virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual void proc32(); diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index 21bdbdde92..e911fe181e 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -121,11 +121,6 @@ int LiftbotScript::proc23() const { return 0; } -const int *LiftbotScript::getTablePtr(int id) { - warning("TODO"); - return nullptr; -} - int LiftbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { warning("TODO"); return 0; diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index 67565f44a3..b2662b1206 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -64,7 +64,6 @@ public: virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; virtual int proc23() const; - virtual const int *getTablePtr(int id); virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual void proc32(); diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index 92966adeaf..998048f272 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -94,11 +94,6 @@ int MaitreDScript::proc23() const { return 0; } -const int *MaitreDScript::getTablePtr(int id) { - warning("TODO"); - return nullptr; -} - int MaitreDScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { warning("TODO"); return 0; diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index 27c72f1585..c210f71a7d 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -58,7 +58,6 @@ public: virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; virtual int proc23() const; - virtual const int *getTablePtr(int id); virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); }; diff --git a/engines/titanic/true_talk/parrot_script.cpp b/engines/titanic/true_talk/parrot_script.cpp index 8e88e58810..358c943cc4 100644 --- a/engines/titanic/true_talk/parrot_script.cpp +++ b/engines/titanic/true_talk/parrot_script.cpp @@ -104,17 +104,10 @@ ScriptChangedResult ParrotScript::scriptChanged(TTscriptBase *roomScript, uint i } int ParrotScript::proc23() const { - warning("TODO"); return 0; } -const int *ParrotScript::getTablePtr(int id) { - warning("TODO"); - return nullptr; -} - int ParrotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { - warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/parrot_script.h b/engines/titanic/true_talk/parrot_script.h index 02ec4e967b..921dc22df4 100644 --- a/engines/titanic/true_talk/parrot_script.h +++ b/engines/titanic/true_talk/parrot_script.h @@ -53,7 +53,6 @@ public: virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); virtual int proc23() const; - virtual const int *getTablePtr(int id); virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); }; diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp index cb1b0356ab..cb1c12f580 100644 --- a/engines/titanic/true_talk/succubus_script.cpp +++ b/engines/titanic/true_talk/succubus_script.cpp @@ -94,11 +94,6 @@ int SuccUBusScript::proc23() const { return 0; } -const int *SuccUBusScript::getTablePtr(int id) { - warning("TODO"); - return nullptr; -} - int SuccUBusScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { warning("TODO"); return 0; diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h index 9787b2cbcf..c5ba51ee1c 100644 --- a/engines/titanic/true_talk/succubus_script.h +++ b/engines/titanic/true_talk/succubus_script.h @@ -56,7 +56,6 @@ public: virtual int proc21(int v1, int v2, int v3); virtual int proc23() const; - virtual const int *getTablePtr(int id); virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); }; diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 0de460cce3..1ee5785907 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -343,6 +343,12 @@ int TTnpcScript::proc23() const { return 0; } +const TTscriptMapping *TTnpcScript::getMapping(int index) { + if (index >= 0 && index < (int)_mappings.size()) + return &_mappings[index]; + return nullptr; +} + int TTnpcScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { return 0; } @@ -594,21 +600,21 @@ uint TTnpcScript::getDialogueId(uint tagId) { tagId = getRangeValue(tagId); oldTagId = proc23(); - int v21 = proc21(origId, tagId, oldTagId); - if (!v21) + uint newId = proc21(origId, tagId, oldTagId); + if (!newId) return 0; int idx = 0; - const int *tableP; + const TTscriptMapping *tableP; for (;;) { - tableP = getTablePtr(idx++); + tableP = getMapping(idx++); if (!tableP) return 0; - if (*tableP == v21) + if (tableP->_id == newId) break; } - uint newVal = tableP[oldTagId + 1]; + uint newVal = tableP->_values[oldTagId]; idx = 0; int *arrP = &_array[26]; diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index b143af66da..d7cec8d6d8 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -309,7 +309,7 @@ public: virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; virtual int proc23() const; - virtual const int *getTablePtr(int id) = 0; + virtual const TTscriptMapping *getMapping(int index); virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual void save(SimpleFile *file); -- cgit v1.2.3 From 758fb87f0ead14545ea7bbea85ae5355230ff113 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 12 Jun 2016 23:43:47 +0200 Subject: TITANIC: Improve configure.engine --- engines/titanic/configure.engine | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/titanic/configure.engine b/engines/titanic/configure.engine index 781b783cf5..c73bb19f97 100644 --- a/engines/titanic/configure.engine +++ b/engines/titanic/configure.engine @@ -1,3 +1,3 @@ # This file is included from the main "configure" script # add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] -add_engine titanic "Starship Titanic" no +add_engine titanic "Starship Titanic" no "" "" "jpeg highres" -- cgit v1.2.3 From 68f13646e185416bb74812ea489764b9b28b8e22 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 19 Jun 2016 09:58:00 -0400 Subject: TITANIC: Implementing more CGameObject/OSScreenManager draw methods --- engines/titanic/core/game_object.cpp | 57 +++++++++++++++++++++--------- engines/titanic/core/game_object.h | 20 +++++++++-- engines/titanic/support/screen_manager.cpp | 16 +++++++-- engines/titanic/support/screen_manager.h | 16 ++++++--- 4 files changed, 84 insertions(+), 25 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 624a4b0e67..5f68037f22 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -161,6 +161,47 @@ bool CGameObject::checkPoint(const Point &pt, bool ignore40, bool visibleOnly) { return pixel != transColor; } +bool CGameObject::clipRect(const Rect &rect1, Rect &rect2) const { + if (!rect2.intersects(rect1)) + return false; + + rect2.clip(rect1); + return true; +} + +void CGameObject::draw(CScreenManager *screenManager, const Rect &destRect, const Rect &srcRect) { + Rect tempRect = destRect; + if (clipRect(srcRect, tempRect)) { + if (!_surface && !_resource.empty()) { + loadResource(_resource); + _resource.clear(); + } + + if (_surface) + screenManager->blitFrom(SURFACE_PRIMARY, &tempRect, _surface); + } +} + +void CGameObject::draw(CScreenManager *screenManager, const Point &destPos) { + if (!_surface && !_resource.empty()) { + loadResource(_resource); + _resource.clear(); + } + + if (_surface) { + int xSize = _surface->getWidth(); + int ySize = _surface->getHeight(); + + if (xSize > 0 && ySize > 0) { + screenManager->blitFrom(SURFACE_BACKBUFFER, _surface, &destPos); + } + } +} + +void CGameObject::draw(CScreenManager *screenManager, const Point &destPos, const Rect &srcRect) { + draw(screenManager, Rect(destPos.x, destPos.y, destPos.x + 52, destPos.y + 52), srcRect); +} + void CGameObject::draw(CScreenManager *screenManager) { if (!_visible) return; @@ -209,22 +250,6 @@ void CGameObject::draw(CScreenManager *screenManager) { } } -void CGameObject::draw(CScreenManager *screenManager, const Common::Point &destPos) { - if (!_surface && !_resource.empty()) { - loadResource(_resource); - _resource.clear(); - } - - if (_surface) { - int xSize = _surface->getWidth(); - int ySize = _surface->getHeight(); - - if (xSize > 0 && ySize > 0) { - screenManager->blitFrom(SURFACE_BACKBUFFER, _surface, &destPos); - } - } -} - bool CGameObject::isPet() const { return isInstanceOf(CPetControl::_type); } diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 24a8ac2f81..a30c348312 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -66,6 +66,12 @@ private: void loadImage(const CString &name, bool pendingFlag = true); void processClipList2(); + + /** + * Merges one rect into another, and returns true if there was + * a common intersection + */ + bool clipRect(const Rect &rect1, Rect &rect2) const; protected: Rect _bounds; double _field34; @@ -367,12 +373,22 @@ public: /** * Allows the item to draw itself */ - virtual void draw(CScreenManager *screenManager); + void draw(CScreenManager *screenManager, const Rect &destRect, const Rect &srcRect); /** * Allows the item to draw itself */ - virtual void draw(CScreenManager *screenManager, const Common::Point &destPos); + void draw(CScreenManager *screenManager, const Point &destPos); + + /** + * Allows the item to draw itself + */ + void draw(CScreenManager *screenManager, const Point &destPos, const Rect &srcRect); + + /** + * Allows the item to draw itself + */ + virtual void draw(CScreenManager *screenManager); /** * Returns true if the item is the PET control diff --git a/engines/titanic/support/screen_manager.cpp b/engines/titanic/support/screen_manager.cpp index b0e249d7b3..27c0d9886e 100644 --- a/engines/titanic/support/screen_manager.cpp +++ b/engines/titanic/support/screen_manager.cpp @@ -163,7 +163,7 @@ void OSScreenManager::fillRect(SurfaceNum surfaceNum, Rect *rect, byte r, byte g } void OSScreenManager::blitFrom(SurfaceNum surfaceNum, CVideoSurface *src, - const Point *destPos, const Rect *srcRect) { + const Point *destPos, const Rect *srcRect) { // Get the dest surface CVideoSurface *destSurface = _frontRenderSurface; if (surfaceNum < -1) @@ -200,7 +200,19 @@ void OSScreenManager::blitFrom(SurfaceNum surfaceNum, CVideoSurface *src, destSurface->blitFrom(destPoint, src, bounds); } -void OSScreenManager::proc12() {} +void OSScreenManager::blitFrom(SurfaceNum surfaceNum, const Rect *rect, CVideoSurface *src, int v) { + // Get the dest surface + CVideoSurface *destSurface = _frontRenderSurface; + if (surfaceNum < -1) + return; + if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) + destSurface = _backSurfaces[surfaceNum]._surface; + if (!destSurface->hasSurface()) + return; + + if (!rect->isEmpty()) + destSurface->blitFrom(Point(rect->left, rect->top), src, rect); +} int OSScreenManager::writeString(int surfaceNum, const Rect &destRect, int yOffset, const CString &str, CTextCursor *textCursor) { diff --git a/engines/titanic/support/screen_manager.h b/engines/titanic/support/screen_manager.h index 2e80869085..21b40cad37 100644 --- a/engines/titanic/support/screen_manager.h +++ b/engines/titanic/support/screen_manager.h @@ -41,8 +41,8 @@ namespace Titanic { * remapped to the primary surface */ enum SurfaceNum { - SURFACE_PRIMARY = -1, - SURFACE_BACKBUFFER = -1 + SURFACE_PRIMARY = -1, // Surface 0 + SURFACE_BACKBUFFER = -1 // Surface -1 }; class TitanicEngine; @@ -109,8 +109,11 @@ public: virtual void blitFrom(SurfaceNum surfaceNum, CVideoSurface *src, const Point *destPos = nullptr, const Rect *srcRect = nullptr) = 0; - virtual void proc12() = 0; - + /** + * Blits a surface onto one of the screen surfaces + */ + virtual void blitFrom(SurfaceNum surfaceNum, const Rect *rect, CVideoSurface *src, int v = 0) = 0; + /** * Write a string * @param surfaceNum Destination surface @@ -248,7 +251,10 @@ public: virtual void blitFrom(SurfaceNum surfaceNum, CVideoSurface *src, const Point *destPos, const Rect *srcRect = nullptr); - virtual void proc12(); + /** + * Blits a surface onto one of the screen surfaces + */ + virtual void blitFrom(SurfaceNum surfaceNum, const Rect *rect, CVideoSurface *src, int v = 0); /** * Write a string -- cgit v1.2.3 From 2267c5eb4c5addecbf0012495f84ece6d6df835d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 19 Jun 2016 16:21:49 -0400 Subject: TITANIC: Beginnings of CCreditText class --- engines/titanic/core/game_object.cpp | 23 ++++++++- engines/titanic/core/game_object.h | 20 +++++++- engines/titanic/module.mk | 1 + engines/titanic/support/credit_text.cpp | 63 +++++++++++++++++++++++ engines/titanic/support/credit_text.h | 90 +++++++++++++++++++++++++++++++++ engines/titanic/titanic.cpp | 2 + 6 files changed, 195 insertions(+), 4 deletions(-) create mode 100644 engines/titanic/support/credit_text.cpp create mode 100644 engines/titanic/support/credit_text.h diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 5f68037f22..2da7d79949 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -38,7 +38,19 @@ namespace Titanic { BEGIN_MESSAGE_MAP(CGameObject, CNamedItem) END_MESSAGE_MAP() -void *CGameObject::_v1 = nullptr; +CCreditText *CGameObject::_credits; + +void CGameObject::init() { + _credits = nullptr; +} + +void CGameObject::deinit() { + if (_credits) { + _credits->clear(); + delete _credits; + _credits = nullptr; + } +} CGameObject::CGameObject(): CNamedItem() { _bounds = Rect(0, 0, 15, 15); @@ -205,7 +217,7 @@ void CGameObject::draw(CScreenManager *screenManager, const Point &destPos, cons void CGameObject::draw(CScreenManager *screenManager) { if (!_visible) return; - if (_v1) { + if (_credits) { error("TODO: Block in CGameObject::draw"); } @@ -927,4 +939,11 @@ void CGameObject::setPassengerClass(int newClass) { } } +void CGameObject::createCredits() { + _credits = new CCreditText(); + CScreenManager *screenManager = getGameManager()->setScreenManager(); + _credits->load(this, screenManager, _bounds); + +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index a30c348312..44e12319e4 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -24,6 +24,7 @@ #define TITANIC_GAME_OBJECT_H #include "titanic/support/mouse_cursor.h" +#include "titanic/support/credit_text.h" #include "titanic/support/proximity.h" #include "titanic/support/rect.h" #include "titanic/core/movie_clip.h" @@ -47,8 +48,8 @@ class OSMovie; class CGameObject : public CNamedItem { friend class OSMovie; DECLARE_MESSAGE_MAP -public: - static void *_v1; +private: + static CCreditText *_credits; private: /** * Load a visual resource for the object @@ -356,6 +357,16 @@ public: int _field60; CursorId _cursorId; bool _visible; +public: + /** + * Initializes statics + */ + static void init(); + + /** + * Deinitializes statics + */ + static void deinit(); public: CLASSDEF CGameObject(); @@ -477,6 +488,11 @@ public: * Finds an item in various system areas */ Found find(const CString &name, CGameObject **item, int findAreas); + + /** + * Sets up credits text + */ + void createCredits(); }; } // End of namespace Titanic diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 2879713758..dac6287c28 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -440,6 +440,7 @@ MODULE_OBJS := \ support/movie.o \ support/movie_event.o \ support/movie_range_info.o \ + support/credit_text.o \ support/proximity.o \ support/rect.o \ support/screen_manager.o \ diff --git a/engines/titanic/support/credit_text.cpp b/engines/titanic/support/credit_text.cpp new file mode 100644 index 0000000000..e70d1dcf7a --- /dev/null +++ b/engines/titanic/support/credit_text.cpp @@ -0,0 +1,63 @@ +/* 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 "titanic/support/credit_text.h" +#include "titanic/titanic.h" + +namespace Titanic { + +CCreditText::CCreditText() : _screenManagerP(nullptr), _field14(0), + _ticks(0), _fontHeight(1), _objectP(nullptr), _field34(0), _field38(0), + _field3C(0), _field40(0), _field44(0), _field48(0), _field4C(0), + _field50(0), _field54(0), _field58(0), _field5C(0) { +} + +void CCreditText::clear() { + _list.destroyContents(); + _objectP = nullptr; +} + +void CCreditText::load(CGameObject *obj, CScreenManager *screenManager, + const Rect &rect, int v) { + _objectP = obj; + _screenManagerP = screenManager; + _field14 = v; + _ticks = g_vm->_events->getTicksCount(); + _field40 = 0; + _field44 = 0xFF; + _field48 = 0xFF; + _field4C = 0xFF; + _field50 = 0; + _field54 = 0; + _field58 = 0; + _field5C = 0; +} + +void CCreditText::setup() { + // TODO +} + +bool CCreditText::draw() { + return false; +} + +} // End of namespace Titanic diff --git a/engines/titanic/support/credit_text.h b/engines/titanic/support/credit_text.h new file mode 100644 index 0000000000..82da833bbe --- /dev/null +++ b/engines/titanic/support/credit_text.h @@ -0,0 +1,90 @@ +/* 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. + * + */ + +#ifndef TITANIC_CREDIT_TEXT_H +#define TITANIC_CREDIT_TEXT_H + +#include "titanic/core/list.h" + +namespace Titanic { + +class CGameObject; +class CScreenManager; + +class COverrideSubItem : public ListItem { + +}; +typedef List CCreditTextSubList; + +class CCreditTextItem : public ListItem { + +}; +typedef List CCreditTextList; + +class CCreditText { +private: + /** + * Sets up needed data + */ + void setup(); +public: + CScreenManager *_screenManagerP; + Rect _rect; + int _field14; + CCreditTextList _list; + uint _ticks; + uint _fontHeight; + CGameObject *_objectP; + int _field34; + int _field38; + int _field3C; + int _field40; + int _field44; + int _field48; + int _field4C; + int _field50; + int _field54; + int _field58; + int _field5C; +public: + CCreditText(); + + /** + * Clears the object + */ + void clear(); + + /** + * Sets the game object this override is associated with + */ + void load(CGameObject *obj, CScreenManager *screenManager, + const Rect &rect, int v = 0); + + /** + * Draw the item + */ + bool draw(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CREDIT_TEXT_H */ diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index da9be20808..9d44cd6141 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -84,6 +84,7 @@ void TitanicEngine::initialize() { CSaveableObject::initClassList(); CEnterExitFirstClassState::init(); + CGameObject::init(); CGetLiftEye2::init(); CHose::init(); CParrotLobbyObject::init(); @@ -115,6 +116,7 @@ void TitanicEngine::deinitialize() { CSGTStateRoom::deinit(); CExitPellerator::deinit(); CEnterExitSecClassMiniLift::deinit(); + CGameObject::deinit(); CTelevision::deinit(); } -- cgit v1.2.3 From f0889c17a46019b8b294a74d054d0c60e445190b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 19 Jun 2016 20:58:37 -0400 Subject: TITANIC: Implementing lots of cGameObject methods --- engines/titanic/core/game_object.cpp | 91 ++++++++++++++++++++++++++++- engines/titanic/core/game_object.h | 41 +++++++++++++ engines/titanic/core/mail_man.cpp | 17 ++++++ engines/titanic/core/mail_man.h | 9 +++ engines/titanic/game_state.cpp | 2 +- engines/titanic/game_state.h | 2 +- engines/titanic/pet_control/pet_control.cpp | 4 -- engines/titanic/pet_control/pet_control.h | 6 +- engines/titanic/support/movie.cpp | 8 ++- engines/titanic/support/movie.h | 2 + engines/titanic/support/video_surface.cpp | 4 ++ engines/titanic/support/video_surface.h | 4 ++ 12 files changed, 178 insertions(+), 12 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 2da7d79949..4a5dd9b065 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -343,7 +343,10 @@ void CGameObject::loadFrame(int frameNumber) { } void CGameObject::processClipList2() { - warning("CGameObject::processClipList2"); + for (CMovieClipList::iterator i = _clipList2.begin(); i != _clipList2.end(); ++i) + (*i)->process(this); + + _clipList2.destroyContents(); } void CGameObject::makeDirty(const Rect &r) { @@ -429,6 +432,17 @@ void CGameObject::playClip(uint startFrame, uint endFrame) { gameManager->playClip(clip, room, room); } +void CGameObject::playRandomClip(const char **names, uint flags) { + // Count size of array + int count = 0; + for (const char **p = names; *p; ++p) + ++count; + + // Play clip + const char *name = names[g_vm->getRandomNumber(count - 1)]; + playClip(name, flags); +} + void CGameObject::playMovie(uint flags) { _frameNumber = -1; if (!_surface && !_resource.empty()) { @@ -844,6 +858,11 @@ void CGameObject::dragMove(const Point &pt) { setPosition(Point(pt.x - _bounds.width() / 2, pt.y - _bounds.height() / 2)); } +Point CGameObject::getControid() const { + return Point(_bounds.left + _bounds.width() / 2, + _bounds.top + _bounds.height() / 2); +} + bool CGameObject::clipExistsByStart(const CString &name, int startFrame) const { return _clipList1.existsByStart(name, startFrame); } @@ -943,7 +962,75 @@ void CGameObject::createCredits() { _credits = new CCreditText(); CScreenManager *screenManager = getGameManager()->setScreenManager(); _credits->load(this, screenManager, _bounds); - +} + +void CGameObject::fn10(int v1, int v2, int v3) { + makeDirty(); + _field44 = v1; + _field48 = v2; + _field4C = v3; +} + +void CGameObject::setMovie14(int v) { + if (!_surface && !_resource.empty()) { + loadResource(_resource); + _resource.clear(); + } + + if (_surface && _surface->_movie) + _surface->_movie->_field14 = v; +} + +void CGameObject::movie38(int v1, int v2) { + if (_surface) + _surface->proc38(v1, v2); +} + +void CGameObject::movie38(int v1) { + if (_surface) + _surface->proc38(-1, v1); +} + +int CGameObject::getClipDuration(const CString &name, int frameRate) const { + CMovieClip *clip = _clipList1.findByName(name); + return clip ? (clip->_endFrame - clip->_startFrame) * 1000 / frameRate : 0; +} + +void CGameObject::petIncC0() { + getPetControl()->incC0(); +} + +void CGameObject::petDecC0() { + getPetControl()->decC0(); +} + +void CGameObject::setState1C(bool flag) { + getGameManager()->_gameState._field1C = flag; +} + +void CGameObject::mailFn10(int v) { + CMailMan *mailMan = getMailMan(); + if (mailMan) { + makeDirty(); + mailMan->fn10(this, v); + } +} + +void CGameObject::mailFn11(int v) { + CMailMan *mailMan = getMailMan(); + if (mailMan) { + makeDirty(); + mailMan->fn11(this, v); + } +} + +bool CGameObject::mailExists(int id) const { + return findMail(id) != nullptr; +} + +CGameObject *CGameObject::findMail(int id) const { + CMailMan *mailMan = getMailMan(); + return mailMan ? mailMan->findMail(id) : nullptr; } } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 44e12319e4..01f15ceb85 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -275,6 +275,11 @@ protected: */ void dragMove(const Point &pt); + /** + * Get the centre of the game object's bounds + */ + Point getControid() const; + /** * Set the position of the object */ @@ -292,6 +297,11 @@ protected: */ void playClip(uint startFrame, uint endFrame); + /** + * Play a clip randomly from a passed list of names + */ + void playRandomClip(const char **names, uint flags); + /** * Return the current view/node/room as a single string */ @@ -353,6 +363,37 @@ protected: * Set's the player's passenger class */ void setPassengerClass(int newClass); + + void setMovie14(int v); + + void movie38(int v1, int v2); + + void movie38(int v1); + + void fn10(int v1, int v2, int v3); + + /** + * Gets the duration of a specified clip in milliseconds + */ + int getClipDuration(const CString &name, int frameRate = 14) const; + + void petIncC0(); + void petDecC0(); + + void setState1C(bool flag); + + void mailFn10(int v); + void mailFn11(int v); + + /** + * Returns true if a mail with a specified Id exists + */ + bool mailExists(int id) const; + + /** + * Returns a specified mail, if one exists + */ + CGameObject *findMail(int id) const; public: int _field60; CursorId _cursorId; diff --git a/engines/titanic/core/mail_man.cpp b/engines/titanic/core/mail_man.cpp index cb959245b5..e96b697dff 100644 --- a/engines/titanic/core/mail_man.cpp +++ b/engines/titanic/core/mail_man.cpp @@ -47,4 +47,21 @@ CGameObject *CMailMan::getNextObject(CGameObject *prior) const { return static_cast(prior->getNextSibling()); } +void CMailMan::fn10(CGameObject *obj, int v) { + warning("TODO: CMailMan::fn10"); +} + +void CMailMan::fn11(CGameObject *obj, int v) { + warning("TODO: CMailMan::fn11"); +} + +CGameObject *CMailMan::findMail(int id) const { + for (CGameObject *obj = getFirstObject(); obj; obj = getNextObject(obj)) { + if (_field50 && _field54 == id) + return obj; + } + + return nullptr; +} + } // End of namespace Titanic diff --git a/engines/titanic/core/mail_man.h b/engines/titanic/core/mail_man.h index d1c84e2264..1a95729ff1 100644 --- a/engines/titanic/core/mail_man.h +++ b/engines/titanic/core/mail_man.h @@ -54,8 +54,17 @@ public: * the passed game object */ CGameObject *getNextObject(CGameObject *prior) const; + + void fn10(CGameObject *obj, int v); + void fn11(CGameObject *obj, int v); + + /** + * Scan the mail list for a specified item + */ + CGameObject *findMail(int id) const; }; + } // End of namespace Titanic #endif /* TITANIC_MAIL_MAN_H */ diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index c552c69831..d129767e10 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -46,7 +46,7 @@ bool CGameStateMovieList::clear() { CGameState::CGameState(CGameManager *gameManager) : _gameManager(gameManager), _gameLocation(this), _passengerClass(0), _priorClass(0), _mode(GSMODE_UNSELECTED), - _field14(0), _petActive(false), _field1C(0), _quitGame(false), + _field14(0), _petActive(false), _field1C(false), _quitGame(false), _field24(0), _nodeChangeCtr(0), _nodeEnterTicks(0), _field38(0) { } diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h index 65126120be..327459278d 100644 --- a/engines/titanic/game_state.h +++ b/engines/titanic/game_state.h @@ -59,7 +59,7 @@ public: GameStateMode _mode; int _field14; bool _petActive; - int _field1C; + bool _field1C; bool _quitGame; int _field24; uint _nodeChangeCtr; diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 51631a3e1b..37af6f7d0a 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -239,10 +239,6 @@ bool CPetControl::containsPt(const Common::Point &pt) const { return _drawBounds.contains(pt); } -bool CPetControl::getC0() const { - return _fieldC0 > 0; -} - bool CPetControl::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { if (!containsPt(msg->_mousePos) || getC0()) return false; diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index cf1589ca62..71785cedb6 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -92,8 +92,6 @@ private: */ bool containsPt(const Common::Point &pt) const; - bool getC0() const; - /** * Checks whether a designated NPC in present in the current view */ @@ -304,6 +302,10 @@ public: * Resets the dial display to reflect new values */ void resetDials(int flag = 1); + + bool getC0() const { return _fieldC0 > 0; } + void incC0() { ++_fieldC0; } + void decC0() { --_fieldC0; } }; } // End of namespace Titanic diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index 1c94cab250..26620de3a6 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -26,7 +26,8 @@ namespace Titanic { -CMovie::CMovie() : ListItem(), _state(MOVIE_STOPPED), _field10(0) { +CMovie::CMovie() : ListItem(), _state(MOVIE_STOPPED), _field10(0), + _field14(0) { } CMovie::~CMovie() { @@ -50,7 +51,10 @@ bool CMovie::get10() { OSMovie::OSMovie(const CResourceKey &name, CVideoSurface *surface) : _videoSurface(surface), _gameObject(nullptr), _endFrame(-1) { - _video = new Video::AVIDecoder(); + Video::AVIDecoder *decoder = new Video::AVIDecoder(); + _video = decoder; + _field14 = 1; + if (!_video->loadFile(name.getString())) error("Could not open video - %s", name.getString().c_str()); } diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index 20de84afa5..01f107ec5b 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -45,6 +45,8 @@ class CMovie : public ListItem { protected: MovieState _state; int _field10; +public: + int _field14; public: CMovie(); virtual ~CMovie(); diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index 813138da4a..3b026c546c 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -418,6 +418,10 @@ void OSVideoSurface::setMovieFrame(uint frameNumber) { _movie->setFrame(frameNumber); } +void OSVideoSurface::proc38(int v1, int v2) { + warning("OSVideoSurface::proc38"); +} + bool OSVideoSurface::loadIfReady() { _videoSurfaceNum = _videoSurfaceCounter; diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index aee28be730..8d0dd2ffac 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -178,6 +178,8 @@ public: */ virtual void setMovieFrame(uint frameNumber) = 0; + virtual void proc38(int v1, int v2) = 0; + /** * Loads the surface's resource if there's one pending */ @@ -343,6 +345,8 @@ public: */ virtual void setMovieFrame(uint frameNumber); + virtual void proc38(int v1, int v2); + /** * Loads the surface's resource if there's one pending */ -- cgit v1.2.3 From 701caa956ca652256504a1dd6a82e24a853323ac Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 19 Jun 2016 21:50:06 -0400 Subject: TITANIC: Implemented mail manager methods --- engines/titanic/core/game_object.cpp | 28 +++++++++++++++++++-------- engines/titanic/core/game_object.h | 27 +++++++++++++++++++++----- engines/titanic/core/mail_man.cpp | 24 ++++++++++++++++++----- engines/titanic/core/mail_man.h | 18 +++++++++++++++-- engines/titanic/pet_control/pet_drag_chev.cpp | 2 +- 5 files changed, 78 insertions(+), 21 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 4a5dd9b065..466fb443da 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -61,8 +61,8 @@ CGameObject::CGameObject(): CNamedItem() { _field44 = 0xF0; _field48 = 0xF0; _field4C = 0xFF; - _field50 = 0; - _field54 = 0; + _isMail = false; + _id = 0; _field58 = 0; _visible = true; _field60 = 0; @@ -124,8 +124,8 @@ void CGameObject::load(SimpleFile *file) { _field4C = file->readNumber(); _fieldB8 = file->readNumber(); _visible = file->readNumber() != 0; - _field50 = file->readNumber(); - _field54 = file->readNumber(); + _isMail = file->readNumber(); + _id = file->readNumber(); _field58 = file->readNumber(); resourceKey.load(file); @@ -1008,19 +1008,19 @@ void CGameObject::setState1C(bool flag) { getGameManager()->_gameState._field1C = flag; } -void CGameObject::mailFn10(int v) { +void CGameObject::addMail(int mailId) { CMailMan *mailMan = getMailMan(); if (mailMan) { makeDirty(); - mailMan->fn10(this, v); + mailMan->addMail(this, mailId); } } -void CGameObject::mailFn11(int v) { +void CGameObject::setMailId(int mailId) { CMailMan *mailMan = getMailMan(); if (mailMan) { makeDirty(); - mailMan->fn11(this, v); + mailMan->setMailId(this, mailId); } } @@ -1033,4 +1033,16 @@ CGameObject *CGameObject::findMail(int id) const { return mailMan ? mailMan->findMail(id) : nullptr; } +void CGameObject::removeMail(int id, int v) { + CMailMan *mailMan = getMailMan(); + if (mailMan) + mailMan->removeMail(id, v); +} + +void CGameObject::resetMail() { + CMailMan *mailMan = getMailMan(); + if (mailMan) + mailMan->resetValue(); +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 01f15ceb85..ad0d93948e 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -82,9 +82,6 @@ protected: int _field44; int _field48; int _field4C; - int _field50; - int _field54; - int _field58; CMovieClipList _clipList1; int _initialFrame; CMovieClipList _clipList2; @@ -382,8 +379,15 @@ protected: void setState1C(bool flag); - void mailFn10(int v); - void mailFn11(int v); + /** + * Adds an object to the mail list + */ + void addMail(int mailId); + + /** + * Sets the mail identifier for an object + */ + void setMailId(int mailId); /** * Returns true if a mail with a specified Id exists @@ -394,7 +398,20 @@ protected: * Returns a specified mail, if one exists */ CGameObject *findMail(int id) const; + + /** + * Remove an object from the mail list + */ + void removeMail(int id, int v); + + /** + * Resets the Mail Man value + */ + void resetMail(); public: + bool _isMail; + int _id; + int _field58; int _field60; CursorId _cursorId; bool _visible; diff --git a/engines/titanic/core/mail_man.cpp b/engines/titanic/core/mail_man.cpp index e96b697dff..8ac50e9767 100644 --- a/engines/titanic/core/mail_man.cpp +++ b/engines/titanic/core/mail_man.cpp @@ -47,21 +47,35 @@ CGameObject *CMailMan::getNextObject(CGameObject *prior) const { return static_cast(prior->getNextSibling()); } -void CMailMan::fn10(CGameObject *obj, int v) { - warning("TODO: CMailMan::fn10"); +void CMailMan::addMail(CGameObject *obj, int id) { + obj->detach(); + obj->addUnder(this); + setMailId(obj, id); } -void CMailMan::fn11(CGameObject *obj, int v) { - warning("TODO: CMailMan::fn11"); +void CMailMan::setMailId(CGameObject *obj, int id) { + obj->_id = id; + obj->_field58 = 0; + obj->_isMail = true; } CGameObject *CMailMan::findMail(int id) const { for (CGameObject *obj = getFirstObject(); obj; obj = getNextObject(obj)) { - if (_field50 && _field54 == id) + if (obj->_isMail && obj->_id == id) return obj; } return nullptr; } +void CMailMan::removeMail(int id, int v) { + for (CGameObject *obj = getFirstObject(); obj; obj = getNextObject(obj)) { + if (obj->_isMail && obj->_id == id) { + obj->_isMail = false; + obj->_field58 = v; + break; + } + } +} + } // End of namespace Titanic diff --git a/engines/titanic/core/mail_man.h b/engines/titanic/core/mail_man.h index 1a95729ff1..982aae4cc0 100644 --- a/engines/titanic/core/mail_man.h +++ b/engines/titanic/core/mail_man.h @@ -55,13 +55,27 @@ public: */ CGameObject *getNextObject(CGameObject *prior) const; - void fn10(CGameObject *obj, int v); - void fn11(CGameObject *obj, int v); + /** + * Add an object to the mail list + */ + void addMail(CGameObject *obj, int id); + + /** + * Sets the mail identifier for an object + */ + static void setMailId(CGameObject *obj, int id); /** * Scan the mail list for a specified item */ CGameObject *findMail(int id) const; + + /** + * Remove a mail item + */ + void removeMail(int id, int v); + + void resetValue() { _value = 0; } }; diff --git a/engines/titanic/pet_control/pet_drag_chev.cpp b/engines/titanic/pet_control/pet_drag_chev.cpp index 645804118d..3143cde0ea 100644 --- a/engines/titanic/pet_control/pet_drag_chev.cpp +++ b/engines/titanic/pet_control/pet_drag_chev.cpp @@ -56,7 +56,7 @@ bool CPetDragChev::MouseDragEndMsg(CMouseDragEndMsg *msg) { CSuccUBus *succubus = static_cast(msg->_dropTarget); if (succubus) { - CSetChevRoomBits chevMsg(_field54); + CSetChevRoomBits chevMsg(_id); chevMsg.execute(succubus); } else { CPetControl *petControl = getPetControl(); -- cgit v1.2.3 From cafde797732d62241207fb39b66456a69a0eb3c1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 19 Jun 2016 22:20:32 -0400 Subject: TITANIC: Added PET cursor related methods --- engines/titanic/core/game_object.cpp | 16 ++++++++++++++-- engines/titanic/core/game_object.h | 16 +++++++++++++++- engines/titanic/game/television.cpp | 2 +- engines/titanic/pet_control/pet_control.cpp | 12 ++++++++++-- engines/titanic/pet_control/pet_control.h | 17 +++++++++++++++-- engines/titanic/pet_control/pet_remote.cpp | 4 ++-- engines/titanic/pet_control/pet_remote.h | 5 ++++- engines/titanic/pet_control/pet_section.h | 5 ++++- 8 files changed, 65 insertions(+), 12 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 466fb443da..aa0de49174 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -384,10 +384,22 @@ void CGameObject::setVisible(bool val) { } } -void CGameObject::petFn2(int val) { +void CGameObject::petHighlightGlyph(int val) { CPetControl *pet = getPetControl(); if (pet) - pet->fn2(val); + pet->highlightGlyph(val); +} + +void CGameObject::petHideCursor() { + CPetControl *pet = getPetControl(); + if (pet) + pet->hideCursor(); +} + +void CGameObject::petShowCursor() { + CPetControl *pet = getPetControl(); + if (pet) + pet->showCursor(); } void CGameObject::petFn3(CTreeItem *item) { diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index ad0d93948e..20729d586a 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -126,7 +126,21 @@ protected: */ CViewItem * parseView(const CString &viewString); - void petFn2(int val); + /** + * Highlights a glyph in the currently active PET section + */ + void petHighlightGlyph(int id); + + /** + * Hides the text cursor in the current section, if applicable + */ + void petHideCursor(); + + /** + * Shows the text cursor in the current section, if applicable + */ + void petShowCursor(); + void petFn3(CTreeItem *item); void incState38(); void inc54(); diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp index 280f7f25d6..5127712cad 100644 --- a/engines/titanic/game/television.cpp +++ b/engines/titanic/game/television.cpp @@ -140,7 +140,7 @@ bool CTelevision::ChangeSeasonMsg(CChangeSeasonMsg *msg) { bool CTelevision::EnterViewMsg(CEnterViewMsg *msg) { setPetArea(PET_REMOTE); - petFn2(2); + petHighlightGlyph(GLYPH_TELEVISION_CONTROL); petFn3(0); setVisible(0); _fieldE0 = 1; diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 37af6f7d0a..bc2ab036b2 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -211,8 +211,16 @@ PetArea CPetControl::setArea(PetArea newArea) { return newArea; } -void CPetControl::fn2(int val) { - _sections[_currentArea]->proc38(val); +void CPetControl::hideCursor() { + _sections[_currentArea]->hideCursor(); +} + +void CPetControl::showCursor() { + _sections[_currentArea]->showCursor(); +} + +void CPetControl::highlightGlyph(int id) { + _sections[_currentArea]->highlight(id); } void CPetControl::fn3(CTreeItem *item) { diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 71785cedb6..3dee76fea6 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -163,8 +163,6 @@ public: bool fn1(int val); - void fn2(int val); - void fn3(CTreeItem *item); void fn4(); @@ -174,6 +172,21 @@ public: */ PetArea setArea(PetArea newSection); + /** + * Hides the text cursor in the current section, if applicable + */ + void hideCursor(); + + /** + * Shows the text cursor in the current section, if applicable + */ + void showCursor(); + + /** + * Highlights a glyph item in the currently active section, if applicable + */ + void highlightGlyph(int id); + /** * Returns true if the PET is currently unlocked */ diff --git a/engines/titanic/pet_control/pet_remote.cpp b/engines/titanic/pet_control/pet_remote.cpp index aac0dc8146..6f133259a8 100644 --- a/engines/titanic/pet_control/pet_remote.cpp +++ b/engines/titanic/pet_control/pet_remote.cpp @@ -214,8 +214,8 @@ CPetGfxElement *CPetRemote::getElement(uint id) { } } -void CPetRemote::proc38(int val) { - int highlightIndex = getHighlightIndex((RemoteGlyph)val); +void CPetRemote::highlight(int id) { + int highlightIndex = getHighlightIndex((RemoteGlyph)id); if (highlightIndex != -1) _items.highlight(highlightIndex); } diff --git a/engines/titanic/pet_control/pet_remote.h b/engines/titanic/pet_control/pet_remote.h index 8703abd099..58c429f5bf 100644 --- a/engines/titanic/pet_control/pet_remote.h +++ b/engines/titanic/pet_control/pet_remote.h @@ -143,7 +143,10 @@ public: */ virtual CPetGfxElement *getElement(uint id); - virtual void proc38(int val); + /** + * Highlights a glyph item in the section + */ + virtual void highlight(int id); /** * Generates a PET message diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 52890fc79a..15c4033e8b 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -182,7 +182,10 @@ public: */ virtual void hideCursor() {} - virtual void proc38(int val) {} + /** + * Highlights a glyph item in the section, if applicable + */ + virtual void highlight(int id) {} /** * Get the PET control -- cgit v1.2.3 From 4f85562c47d6e4b16e9b0e8e018e09635bf4ba9d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 21 Jun 2016 22:40:16 -0400 Subject: TITANIC: In progress adding CRoomFlags class --- engines/titanic/module.mk | 1 + engines/titanic/room_flags.cpp | 403 +++++++++++++++++++++++++++++++++++++++++ engines/titanic/room_flags.h | 202 +++++++++++++++++++++ 3 files changed, 606 insertions(+) create mode 100644 engines/titanic/room_flags.cpp create mode 100644 engines/titanic/room_flags.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index dac6287c28..b1b35fc3f3 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -11,6 +11,7 @@ MODULE_OBJS := \ input_handler.o \ input_translator.o \ main_game_window.o \ + room_flags.o \ titanic.o \ carry/auditory_centre.o \ carry/arm.o \ diff --git a/engines/titanic/room_flags.cpp b/engines/titanic/room_flags.cpp new file mode 100644 index 0000000000..ac3ae4943b --- /dev/null +++ b/engines/titanic/room_flags.cpp @@ -0,0 +1,403 @@ +/* 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 "titanic/room_flags.h" + +namespace Titanic { + +#define ELEVATOR_SHIFT 18 +#define ELEVATOR_MASK 3 +#define PASSENGER_CLASS_SHIFT 16 +#define PASSENGER_CLASS_MASK 3 +#define FLOOR_SHIFT 8 +#define FLOOR_MASK 0xFF +#define ROOM_SHIFT 1 +#define ROOM_MASK 0x7F + +struct TransportFlagsEntry { + const char *const _roomName; + uint _roomFlags; +}; +struct SuccUBusFlagsEntry { + const char *const _roomName; + uint _roomFlags; + uint _succubusNum; +}; + +#define TRANSPORT_ROOMS_SIZE 6 +const TransportFlagsEntry TRANSPORT_ROOMS[TRANSPORT_ROOMS_SIZE] = { + { "TopOfWell", 0xDF4D1 }, + { "Pellerator", 0xC95E9 }, + { "Dome", 0xAD171 }, + { "Lift", 0x96E45 }, + { "SGTLeisure", 0x5D3AD }, + { "ServiceElevator", 0x68797 } +}; + +#define SUCCUBUS_ROOMS_SIZE 17 +const SuccUBusFlagsEntry SUCCUBUS_ROOMS[SUCCUBUS_ROOMS_SIZE] = { + { "ParrotLobby", 0x1D0D9, 3 }, + { "SculptureChamber", 0x465FB, 2 }, + { "Bar", 0x0B3D97, 2 }, + { "EmbLobby", 0x0CC971, 3 }, + { "MoonEmbLobby", 0x0CC971, 3 }, + { "MusicRoom", 0x0F34DB, 2 }, + { "MusicRoomLobby", 0x0F34DB, 2 }, + { "Titania", 0x8A397, 3 }, + { "BottomOfWell", 0x59FAD, 3 }, + { "Arboretum", 0x4D6AF, 1 }, + { "PromenadeDeck", 0x79C45, 2 }, + { "1stClassRestaurant", 0x896B9, 1 }, + { "CreatorsChamber", 0x2F86D, 2 }, + { "CreatorsChamberOn", 0x2F86D, 2 }, + { "BilgeRoom", 0x3D94B, 3 }, + { "BilgeRoomWith", 0x3D94B, 3 }, + { "Bridge", 0x39FCB, 3 } +}; + +int CRoomFlags::getConditionally() const { + if (getRoomArea() != 5 || getRoomCategory() != 5) + return _data; + else + return 5; +} + +bool CRoomFlags::isTransportRoom() const { + for (int idx = 0; idx < TRANSPORT_ROOMS_SIZE; ++idx) { + if (TRANSPORT_ROOMS[idx]._roomFlags == _data) + return true; + } + + return false; +} + +int CRoomFlags::getRoomCategory() const { + if (getRoomNum() == 0) + return false; + + CRoomFlags tempFlags = _data; + tempFlags.setRoomBits(1); + return tempFlags.getRoomArea() != 5; +} + +CString CRoomFlags::getRoomDesc() const { + switch (getRoomArea()) { + case 1: + case 2: + case 3: { + CString result = getPassengerClassDesc(); + result += ", "; + result += getFloorDesc(); + result += ", "; + result += getElevatorDesc(); + result += ", "; + result += getRoomDesc(); + return result; + } + + case 4: + if (isTransportRoom()) { + switch (_data) { + case 0x68797: + return "The Service Elevator"; + case 0x5D3AD: + return "The Super Galactic Leisure Lounge"; + case 0x96E45: + return "The Elevator"; + case 0xAD171: + return "The Dome"; + case 0xC95E9: + return "The Pellerator"; + case 0xDF4D1: + return "The Top of the Well"; + default: + break; + } + } + + if (getRoomCategory() == 0) { + return "Nowhere you're likely to want to go."; + } else { + CString result = getPassengerClassDesc(); + result += ", "; + result += getFloorDesc(); + return result; + } + break; + + case 5: + switch (_data) { + case 0x1D0D9: + return "The Parrot Lobby"; + case 0x2F86D: + return "The Creators' Chamber"; + case 0x39FCB: + return "The Bridge"; + case 0x3D94B: + return "The Bilge Room"; + case 0x465FB: + return "The Sculpture Chamber"; + case 0x4D6AF: + return "The Arboretum"; + case 0x59FAD: + return "The Bottom of the Well"; + case 0x79C45: + return "The Promenade Deck"; + case 0x896B9: + return "The 1st class restaurant"; + case 0x8A397: + return "Titania's Room"; + case 0xB3D97: + return "The Bar"; + case 0xCC971: + return "The Embarkation Lobby"; + case 0xF34DB: + return "The Music Room"; + default: + break; + } + return "Unknown Room"; + + default: + break; + } + + return "Unknown Room"; +} + +void CRoomFlags::setElevatorBits(uint val) { + _data &= ~(ELEVATOR_MASK << ELEVATOR_SHIFT); + _data |= (val & ELEVATOR_MASK) << ELEVATOR_SHIFT; +} + +uint CRoomFlags::getElevatorBits() const { + return (_data >> ELEVATOR_SHIFT) & ELEVATOR_MASK; +} + +void CRoomFlags::setPassengerClassBits(uint val) { + _data &= ~(PASSENGER_CLASS_MASK << PASSENGER_CLASS_SHIFT); + _data |= (val & PASSENGER_CLASS_MASK) << PASSENGER_CLASS_SHIFT; +} + +uint CRoomFlags::getPassengerClassBits() const { + return (_data >> PASSENGER_CLASS_SHIFT) & PASSENGER_CLASS_MASK; +} + +CString CRoomFlags::getPassengerClassDesc() const { + int classNum = getPassengerClassNum(); + + switch (classNum) { + case 1: + return "1st class"; + case 2: + return "2nd class"; + case 3: + return "SGT class"; + default: + return "no class"; + } +} + +void CRoomFlags::setFloorBits(uint val) { + _data &= ~(FLOOR_MASK << FLOOR_SHIFT); + _data |= (val & FLOOR_MASK) << FLOOR_SHIFT; +} + +uint CRoomFlags::getFloorBits() const { + return (_data >> FLOOR_SHIFT) & FLOOR_MASK; +} + +uint CRoomFlags::decodeFloorBits(uint bits) const { + int base = 0; + int offset = bits & 0xF; + + switch ((bits >> 4) & 0xF) { + case 1: + case 2: + case 3: + base = 40; + break; + case 4: + base = 10; + break; + case 5: + base = 20; + break; + case 6: + base = 30; + break; + default: + break; + } + + return offset >= 10 ? 0 : base + offset; +} + +void CRoomFlags::setFloorNum(uint floorNum) { + uint base = 0; + + switch (floorNum / 10) { + case 0: + base = 0x90; + break; + case 1: + base = 0xD0; + case 2: + base = 0xE0; + case 3: + base = 0xF0; + break; + default: + break; + } + + setFloorBits(base | (floorNum % 10)); +} + +uint CRoomFlags::getFloorNum() const { + return decodeFloorBits(getFloorBits()); +} + +void CRoomFlags::setRoomBits(uint roomBits) { + _data &= ~(ROOM_MASK << ROOM_SHIFT); + _data |= (roomBits & ROOM_MASK) << ROOM_SHIFT; +} + +uint CRoomFlags::getRoomBits() const { + return (_data >> ROOM_SHIFT) & ROOM_MASK; +} + +uint CRoomFlags::getRoomArea() const { + warning("TODO: CRoomFlags::getRoomArea"); + return 0; +} + +bool CRoomFlags::isSuccUBusRoomFlags() const { + for (int idx = 0; idx < SUCCUBUS_ROOMS_SIZE; ++idx) { + if (SUCCUBUS_ROOMS[idx]._roomFlags == _data) + return true; + } + + return false; +} + +bool CRoomFlags::getBit0() const { + return _data & 1; +} + +uint CRoomFlags::getSpecialRoomFlags(const CString &roomName) { + for (int idx = 0; idx < SUCCUBUS_ROOMS_SIZE; ++idx) { + if (!roomName.compareTo(SUCCUBUS_ROOMS[idx]._roomName)) + return SUCCUBUS_ROOMS[idx]._roomFlags; + } + + for (int idx = 0; idx < TRANSPORT_ROOMS_SIZE; ++idx) { + if (!roomName.compareTo(TRANSPORT_ROOMS[idx]._roomName)) + return TRANSPORT_ROOMS[idx]._roomFlags; + } + + return 0; +} + +uint CRoomFlags::getSuccUBusNum(const CString &roomName) { + for (int idx = 0; idx < SUCCUBUS_ROOMS_SIZE; ++idx) { + if (!roomName.compareTo(SUCCUBUS_ROOMS[idx]._roomName)) + return SUCCUBUS_ROOMS[idx]._succubusNum; + } + + return 0; +} + +CString CRoomFlags::getSuccUBusRoomName() const { + for (int idx = 0; idx < SUCCUBUS_ROOMS_SIZE; ++idx) { + if (SUCCUBUS_ROOMS[idx]._roomFlags == _data) + return SUCCUBUS_ROOMS[idx]._roomName; + } + + return CString(); +} + +void CRoomFlags::changeLocation(int action) { + uint floorNum = getFloorNum(); + uint roomNum = getRoomNum(); + uint elevatorNum = getElevatorNum(); + uint classNum = getPassengerClassNum(); + uint v10, v11, v12, v13; + + switch (classNum) { + case 1: + v10 = 2; + v11 = 19; + v12 = 1; + v13 = 3; + break; + + case 2: + v10 = 20; + v11 = 27; + v12 = 1; + v13 = (elevatorNum & 1) ? 3 : 4; + break; + + case 3: + v10 = 28; + v11 = 38; + v12 = 1; + v13 = 18; + break; + + default: + v10 = 0; + v11 = 0; + v12 = 0; + v13 = 0; + break; + } + + // Perform action to change room or floor + switch (action) { + case 1: + if (--roomNum < v12) + roomNum = v12; + break; + + case 2: + if (++roomNum > v13) + roomNum = v13; + break; + + case 3: + if (--floorNum < v10) + floorNum = v10; + break; + + case 4: + if (++floorNum > v11) + floorNum = v11; + } + + // Set new floor and room + setFloorNum(floorNum); + setRoomBits(roomNum); +} + +} // End of namespace Titanic diff --git a/engines/titanic/room_flags.h b/engines/titanic/room_flags.h new file mode 100644 index 0000000000..961452535e --- /dev/null +++ b/engines/titanic/room_flags.h @@ -0,0 +1,202 @@ +/* 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. + * + */ + +#ifndef TITANIC_ROOM_FLAGS_H +#define TITANIC_ROOM_FLAGS_H + +#include "titanic/support/string.h" + +namespace Titanic { + +class CRoomFlags { +private: + uint _data; +private: + int getConditionally() const; + + bool not5() const { return getConditionally() != 5; } + + /** + * Returns true if the current flags appear in the + * list of transport rooms + */ + bool isTransportRoom() const; + + int getRoomCategory() const; + + /** + * Set the bits for the elevator number + */ + void setElevatorBits(uint val); + + /** + * Set the bits for the passenger class + */ + void setPassengerClassBits(uint val); + + /** + * Set the bits for the floor number + */ + void setFloorBits(uint val); + + /** + * Translates bits for floor into a floor number + */ + uint decodeFloorBits(uint bits) const; + + uint getRoomArea() const; + + /** + * Returns true if the current flags are in the succubus list + */ + bool isSuccUBusRoomFlags() const; + + /** + * Gets the special flags for a transport or succubus room + */ + uint getSpecialRoomFlags(const CString &roomName); + + /** + * Gets the succubus number associated with a given room + */ + uint getSuccUBusNum(const CString &roomName); + + /** + * Gets the succubus room name associated with the current room flags + */ + CString getSuccUBusRoomName() const; +public: + CRoomFlags() : _data(0) {} + CRoomFlags(uint data) : _data(data) {} + operator uint() { return _data; } + + /** + * Set the flags value + */ + void set(uint data) { _data = data; } + + /** + * Get the flags value + */ + uint get() const { return _data; } + + bool test5(const CRoomFlags &roomFlags) const { + return roomFlags.not5(); + } + + /** + * Get a description for the room + */ + CString getRoomDesc() const; + + /** + * Get the bits for the elevator number + */ + uint getElevatorBits() const; + + /** + * Set the elevator number + */ + void setElevatorNum(uint val) { setElevatorBits(val - 1); } + + /** + * Get the elevator number + */ + uint getElevatorNum() const { return getElevatorBits() + 1; } + + /** + * Get a description for the elevator number + */ + CString getElevatorDesc() const { + return CString::format("Elevator %d", getElevatorNum()); + } + + /** + * Gets the bits for the passenger class + */ + uint getPassengerClassBits() const; + + /** + * Gets the passenger class number + */ + uint getPassengerClassNum() const { return getPassengerClassBits(); } + + /** + * Get a description for the passenger class + */ + CString getPassengerClassDesc() const; + + /** + * Gets the bits for the floor number + */ + uint getFloorBits() const; + + /** + * Sets the floor number + */ + void setFloorNum(uint floorNum); + + /** + * Gets the floor number + */ + uint getFloorNum() const; + + /** + * Get a description for the floor number + */ + CString getFloorDesc() const { + return CString::format("Floor %d", getFloorNum()); + } + + /** + * Sets the bits for the room number + */ + void setRoomBits(uint roomBits); + + /** + * Gets the bits for the room number + */ + uint getRoomBits() const; + + /** + * Gets the room number + */ + uint getRoomNum() const { return getRoomBits(); } + + /** + * Gets a string for the room number + */ + CString getRoomNumDesc() const { + return CString::format("Room %d", getRoomNum()); + } + + bool getBit0() const; + + /** + * Change the passenger class + */ + void changeLocation(int action); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ROOM_FLAGS_H */ -- cgit v1.2.3 From 23da68350dee0b211cdcf29734146ac71583044b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 22 Jun 2016 08:00:20 -0400 Subject: TITANIC: Finished CRoomFlags methods --- engines/titanic/pet_control/pet_control.cpp | 7 ++ engines/titanic/pet_control/pet_control.h | 6 ++ engines/titanic/room_flags.cpp | 121 ++++++++++++++++++++++++++-- engines/titanic/room_flags.h | 53 ++++++++---- 4 files changed, 166 insertions(+), 21 deletions(-) diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index bc2ab036b2..f7973e008b 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -533,4 +533,11 @@ void CPetControl::resetDials(int flag) { _conversations.resetDials(_activeNPCName); } +int CPetControl::getMailDest(const CRoomFlags &roomFlags) const { + if (!roomFlags.isSuccUBusRoomFlags()) + return roomFlags.getPassengerClassNum(); + + return roomFlags.getSuccUBusNum(roomFlags.getSuccUBusRoomName()); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 3dee76fea6..758069e5f1 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -36,6 +36,7 @@ #include "titanic/pet_control/pet_real_life.h" #include "titanic/pet_control/pet_remote.h" #include "titanic/pet_control/pet_rooms.h" +#include "titanic/room_flags.h" namespace Titanic { @@ -319,6 +320,11 @@ public: bool getC0() const { return _fieldC0 > 0; } void incC0() { ++_fieldC0; } void decC0() { --_fieldC0; } + + /** + * Get mail destination given the specified flags + */ + int getMailDest(const CRoomFlags &roomFlags) const; }; } // End of namespace Titanic diff --git a/engines/titanic/room_flags.cpp b/engines/titanic/room_flags.cpp index ac3ae4943b..b64b6509ca 100644 --- a/engines/titanic/room_flags.cpp +++ b/engines/titanic/room_flags.cpp @@ -21,6 +21,7 @@ */ #include "titanic/room_flags.h" +#include "titanic/titanic.h" namespace Titanic { @@ -99,6 +100,43 @@ int CRoomFlags::getRoomCategory() const { return tempFlags.getRoomArea() != 5; } +int CRoomFlags::getRoomArea() const { + if (isSuccUBusRoomFlags()) + return 4; + + if (!getBit0()) { + uint v3 = getFloorNum(); + if (v3 <= 38) { + uint v4 = getRoomNum(); + if (v4 <= 18) { + uint v6 = getElevatorNum(); + + if (v6 >= 1 && v6 <= 4) { + uint v7 = getPassengerClassNum() - 1; + if (v7) { + uint v8 = v7 - 1; + if (v8) { + if (v8 == 1 && is28To38(v3) && (v6 & 1) && v4 >= 1) + return 3; + } else if (is20To27(v3)) { + if (v6 & 1) { + if (v4 >= 1 && v4 <= 3) + return 2; + } else if (v4 >= 1 && v4 <= 4) { + return 2; + } + } + } else if (is2To19(v3) && v4 >= 1 && v4 <= 3) { + return 1; + } + } + } + } + } + + return 5; +} + CString CRoomFlags::getRoomDesc() const { switch (getRoomArea()) { case 1: @@ -286,11 +324,6 @@ uint CRoomFlags::getRoomBits() const { return (_data >> ROOM_SHIFT) & ROOM_MASK; } -uint CRoomFlags::getRoomArea() const { - warning("TODO: CRoomFlags::getRoomArea"); - return 0; -} - bool CRoomFlags::isSuccUBusRoomFlags() const { for (int idx = 0; idx < SUCCUBUS_ROOMS_SIZE; ++idx) { if (SUCCUBUS_ROOMS[idx]._roomFlags == _data) @@ -318,7 +351,7 @@ uint CRoomFlags::getSpecialRoomFlags(const CString &roomName) { return 0; } -uint CRoomFlags::getSuccUBusNum(const CString &roomName) { +uint CRoomFlags::getSuccUBusNum(const CString &roomName) const { for (int idx = 0; idx < SUCCUBUS_ROOMS_SIZE; ++idx) { if (!roomName.compareTo(SUCCUBUS_ROOMS[idx]._roomName)) return SUCCUBUS_ROOMS[idx]._succubusNum; @@ -400,4 +433,80 @@ void CRoomFlags::changeLocation(int action) { setRoomBits(roomNum); } +bool CRoomFlags::compareFlags(CRoomFlags flags1, CRoomFlags flags2) const { + if (flags1.getFloorNum() != flags2.getFloorNum()) + return false; + + uint elev1 = flags1.getElevatorNum(); + uint elev2 = flags2.getElevatorNum(); + uint class1 = getPassengerClassNum(); + uint class2 = getPassengerClassNum(); + + if (class1 > 0 && class1 < 3) { + if (elev1 == 2) + elev1 = 1; + else if (elev1 == 4) + elev1 = 3; + } + if (class2 > 0 && class2 < 3) { + if (elev2 == 2) + elev2 = 1; + else if (elev2 == 4) + elev2 = 3; + } + + return elev1 == elev2; +} + +bool CRoomFlags::compareLocation(uint roomFlags) { + CRoomFlags flags(roomFlags); + + return getElevatorNum() == flags.getElevatorBits() && + getFloorNum() == flags.getFloorNum() && + getRoomNum() == flags.getRoomNum(); +} + +void CRoomFlags::setRandomLocation(int classNum, bool flag) { + uint minRoom, elevNum, maxRoom, maxFloor, minFloor; + + do { + switch (classNum) { + case 1: + minFloor = 2; + maxFloor = 19; + minRoom = 1; + maxRoom = 3; + elevNum = g_vm->getRandomNumber(flag ? 2 : 3); + break; + + case 2: + minFloor = 20; + maxFloor = 27; + elevNum = g_vm->getRandomNumber(flag ? 2 : 3); + minRoom = 1; + maxRoom = ((elevNum - 1) & 1) ? 3 : 4; + break; + + case 3: + minRoom = 1; + minFloor = 28; + maxFloor = 38; + maxRoom = 18; + elevNum = g_vm->getRandomNumber(1); + if (elevNum == 1) + elevNum = 2; + break; + + default: + return; + } + + uint floorNum = minFloor + g_vm->getRandomNumber(maxFloor - minFloor); + uint roomNum = minRoom + g_vm->getRandomNumber(maxRoom - minRoom); + setElevatorBits(elevNum); + setRoomBits(roomNum); + setFloorNum(floorNum); + } while (_data == 0x59706); +} + } // End of namespace Titanic diff --git a/engines/titanic/room_flags.h b/engines/titanic/room_flags.h index 961452535e..553e0a32d6 100644 --- a/engines/titanic/room_flags.h +++ b/engines/titanic/room_flags.h @@ -43,6 +43,8 @@ private: int getRoomCategory() const; + int getRoomArea() const; + /** * Set the bits for the elevator number */ @@ -63,27 +65,27 @@ private: */ uint decodeFloorBits(uint bits) const; - uint getRoomArea() const; - /** - * Returns true if the current flags are in the succubus list + * Compares two room flags together */ - bool isSuccUBusRoomFlags() const; + bool compareFlags(CRoomFlags flags1, CRoomFlags flags2) const; /** - * Gets the special flags for a transport or succubus room + * Compares the current flags against the specified flags + * for a matching elevator, floor, and room */ - uint getSpecialRoomFlags(const CString &roomName); + bool compareLocation(uint roomFlags); /** - * Gets the succubus number associated with a given room + * Returns true if the current flags is for Titania's room */ - uint getSuccUBusNum(const CString &roomName); + bool isTitania() const { return _data == 0x8A397; } - /** - * Gets the succubus room name associated with the current room flags - */ - CString getSuccUBusRoomName() const; + bool is59706() const { return _data == 0x59706; } + + bool is2To19(uint v) const { return v >= 2 && v <= 19; } + bool is20To27(uint v) const { return v >= 20 && v <= 27; } + bool is28To38(uint v) const { return v >= 28 && v <= 38; } public: CRoomFlags() : _data(0) {} CRoomFlags(uint data) : _data(data) {} @@ -99,9 +101,15 @@ public: */ uint get() const { return _data; } - bool test5(const CRoomFlags &roomFlags) const { - return roomFlags.not5(); - } + /** + * Gets the special flags for a transport or succubus room + */ + uint getSpecialRoomFlags(const CString &roomName); + + /** + * Returns true if the current flags are in the succubus list + */ + bool isSuccUBusRoomFlags() const; /** * Get a description for the room @@ -195,6 +203,21 @@ public: * Change the passenger class */ void changeLocation(int action); + + /** + * Sets a random destination in the flags + */ + void setRandomLocation(int classNum, bool flag); + + /** + * Gets the succubus number associated with a given room + */ + uint getSuccUBusNum(const CString &roomName) const; + + /** + * Gets the succubus room name associated with the current room flags + */ + CString getSuccUBusRoomName() const; }; } // End of namespace Titanic -- cgit v1.2.3 From 5aff1d01b4088979e207c434476fa7ca3f6a644f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 22 Jun 2016 13:48:33 -0400 Subject: TITANIC: Cleaning up mode and room flags fields on PET room glyphs --- engines/titanic/pet_control/pet_rooms.cpp | 15 ++++++++---- engines/titanic/pet_control/pet_rooms.h | 4 +++- engines/titanic/pet_control/pet_rooms_glyphs.cpp | 20 ++++++++++++---- engines/titanic/pet_control/pet_rooms_glyphs.h | 29 ++++++++++++++++++++---- 4 files changed, 52 insertions(+), 16 deletions(-) diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp index a14258ebbf..29a46880e0 100644 --- a/engines/titanic/pet_control/pet_rooms.cpp +++ b/engines/titanic/pet_control/pet_rooms.cpp @@ -114,10 +114,10 @@ void CPetRooms::load(SimpleFile *file, int param) { for (int idx = 0; idx < count; ++idx) { CPetRoomsGlyph *glyph = addGlyph(file->readNumber(), false); - glyph->set3C(file->readNumber()); + glyph->setMode((RoomGlyphMode)file->readNumber()); } - _glyphItem.set34(file->readNumber()); + _glyphItem.setMode((RoomGlyphMode)file->readNumber()); file->readNumber(); _field1C0 = file->readNumber(); _field1C4 = file->readNumber(); @@ -191,15 +191,15 @@ bool CPetRooms::setupControl(CPetControl *petControl) { } void CPetRooms::resetHighlight() { - _glyphItem.set34(fn1()); + _glyphItem.setMode(fn1()); _glyphs.resetHighlight(); _glyphItem.updateTooltip(); areaChanged(PET_ROOMS); } -int CPetRooms::fn1() { +RoomGlyphMode CPetRooms::fn1() { warning("TODO: CPetRooms::fn1"); - return 0; + return RGM_0; } int CPetRooms::fn2(int val) { @@ -230,4 +230,9 @@ void CPetRooms::addRoom(int roomNum) { warning("TODO: CPetRooms::addRoom"); } +uint CPetRooms::mode1Flags() const { + CPetRoomsGlyph *glyph = _glyphs.findMode1(); + return glyph ? glyph->getRoomFlags() : 0; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms.h b/engines/titanic/pet_control/pet_rooms.h index 515c9fb10d..608940fec6 100644 --- a/engines/titanic/pet_control/pet_rooms.h +++ b/engines/titanic/pet_control/pet_rooms.h @@ -65,7 +65,7 @@ private: */ void resetHighlight(); - int fn1(); + RoomGlyphMode fn1(); void areaChanged(PetArea area); @@ -73,6 +73,8 @@ private: * Adds a glyph to the list */ CPetRoomsGlyph *addGlyph(int val, bool highlight); + + uint mode1Flags() const; public: CPetRooms(); diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.cpp b/engines/titanic/pet_control/pet_rooms_glyphs.cpp index 57c6e8568c..71fdc5662d 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.cpp +++ b/engines/titanic/pet_control/pet_rooms_glyphs.cpp @@ -27,13 +27,13 @@ namespace Titanic { CPetRoomsGlyph::CPetRoomsGlyph() : CPetGlyph(), - _field34(0), _field38(0), _field3C(0), + _roomFlags(0), _field38(0), _mode(RGM_0), _field40(nullptr), _field44(nullptr), _field48(nullptr), _field4C(nullptr), _field50(nullptr), _field54(nullptr), _field58(nullptr), _field5C(nullptr) { } -CPetRoomsGlyph::CPetRoomsGlyph(int val) : CPetGlyph(), - _field34(val), _field38(0), _field3C(0), +CPetRoomsGlyph::CPetRoomsGlyph(uint flags) : CPetGlyph(), + _roomFlags(flags), _field38(0), _mode(RGM_0), _field40(nullptr), _field44(nullptr), _field48(nullptr), _field4C(nullptr), _field50(nullptr), _field54(nullptr), _field58(nullptr), _field5C(nullptr) { } @@ -71,8 +71,8 @@ int CPetRoomsGlyph::proc29(const Point &pt) { } void CPetRoomsGlyph::save2(SimpleFile *file, int indent) const { - file->writeNumberLine(_field34, indent); - file->writeNumberLine(_field3C, indent); + file->writeNumberLine(_roomFlags, indent); + file->writeNumberLine(_mode, indent); } int CPetRoomsGlyph::proc33() { @@ -92,4 +92,14 @@ void CPetRoomsGlyphs::save2(SimpleFile *file, int indent) const { (*i)->save2(file, indent); } +CPetRoomsGlyph *CPetRoomsGlyphs::findMode1() const { + for (const_iterator i = begin(); i != end(); ++i) { + CPetRoomsGlyph *glyph = static_cast(*i); + if (glyph->isMode1()) + return glyph; + } + + return nullptr; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.h b/engines/titanic/pet_control/pet_rooms_glyphs.h index 3f37bdb55d..c48011f347 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.h +++ b/engines/titanic/pet_control/pet_rooms_glyphs.h @@ -27,11 +27,13 @@ namespace Titanic { +enum RoomGlyphMode { RGM_0 = 0, RGM_1 = 1, RGM_2 = 2 }; + class CPetRoomsGlyph : public CPetGlyph { protected: - int _field34; + uint _roomFlags; int _field38; - int _field3C; + RoomGlyphMode _mode; CGameObject *_field40; CGameObject *_field44; CGameObject *_field48; @@ -42,13 +44,28 @@ protected: CGameObject *_field5C; public: CPetRoomsGlyph(); - CPetRoomsGlyph(int val); + CPetRoomsGlyph(uint flags); - void set34(int val) { _field34 = val; } + /** + * Set the room flags for the glyph + */ + void setFoomFlags(uint flags) { _roomFlags = flags; } + + /** + * Get the room flags for the glyph + */ + uint getRoomFlags() const { return _roomFlags; } void set38(int val) { _field38 = val; } - void set3C(int val) { _field3C = val; } + /** + * Sets the mode of the glyph + */ + void setMode(RoomGlyphMode mode) { _mode = mode; } + + bool isModeValid() const { return _mode != RGM_0; } + bool isMode1() const { return _mode == RGM_1; } + bool isMode2() const { return _mode == RGM_2; } /** * Setup the glyph @@ -86,6 +103,8 @@ public: * Save the list */ void save2(SimpleFile *file, int indent) const; + + CPetRoomsGlyph *findMode1() const; }; } // End of namespace Titanic -- cgit v1.2.3 From 452274dae027933b2199cd26236f1a5e908c4275 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 22 Jun 2016 20:43:54 -0400 Subject: TITANIC: Flesh out PET Rooms adding glyphs --- engines/titanic/core/game_object.cpp | 4 +- engines/titanic/core/game_object.h | 2 +- engines/titanic/npcs/deskbot.cpp | 6 +-- engines/titanic/pet_control/pet_control.cpp | 4 +- engines/titanic/pet_control/pet_control.h | 5 ++- engines/titanic/pet_control/pet_rooms.cpp | 45 +++++++++++++++++--- engines/titanic/pet_control/pet_rooms.h | 11 +++-- engines/titanic/pet_control/pet_rooms_glyphs.cpp | 10 +++++ engines/titanic/pet_control/pet_rooms_glyphs.h | 54 +++++++++++++++--------- 9 files changed, 101 insertions(+), 40 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index aa0de49174..695a6d66a5 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -790,10 +790,10 @@ void CGameObject::dec54() { getGameManager()->dec54(); } -void CGameObject::petAddRoom(int roomNum) { +void CGameObject::petAddRandomRoom(int passClassNum) { CPetControl *petControl = getPetControl(); if (petControl) - petControl->addRoom(roomNum); + petControl->addRandomRoom(passClassNum); } void CGameObject::lockMouse() { diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 20729d586a..bb6b161a48 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -149,7 +149,7 @@ protected: /** * Adds a room to the room list */ - void petAddRoom(int roomNum); + void petAddRandomRoom(int passClassNum); /** * Locks/hides the mouse diff --git a/engines/titanic/npcs/deskbot.cpp b/engines/titanic/npcs/deskbot.cpp index 18c1e2a137..a52d7c7e4d 100644 --- a/engines/titanic/npcs/deskbot.cpp +++ b/engines/titanic/npcs/deskbot.cpp @@ -178,16 +178,16 @@ bool CDeskbot::TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg) { case 1: petDisplayMsg("You have been upgraded to 1st Class status. Enjoy hugely."); setPassengerClass(_classNum); - petAddRoom(_classNum); + petAddRandomRoom(_classNum); break; case 2: petDisplayMsg("You have been upgraded to 2nd Class status. Enjoy."); setPassengerClass(_classNum); - petAddRoom(_classNum); + petAddRandomRoom(_classNum); break; case 3: setPassengerClass(3); - petAddRoom(_classNum); + petAddRandomRoom(_classNum); break; default: break; diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index f7973e008b..e7bf1eeb7a 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -520,8 +520,8 @@ CString CPetControl::getFullViewName() { return gameManager ? gameManager->getFullViewName() : CString(); } -void CPetControl::addRoom(int roomNum) { - _rooms.addRoom(roomNum); +void CPetControl::addRandomRoom(int passClassNum) { + _rooms.addRandomRoom(passClassNum); } int CPetControl::roomFn2(int val) { diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 758069e5f1..652a6e8c83 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -307,9 +307,10 @@ public: CString getFullViewName(); /** - * Adds a room to the room list + * Adds a random room to the room list */ - void addRoom(int roomNum); + void addRandomRoom(int passClassNum); + int roomFn2(int val); /** diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp index 29a46880e0..b98c68c174 100644 --- a/engines/titanic/pet_control/pet_rooms.cpp +++ b/engines/titanic/pet_control/pet_rooms.cpp @@ -212,8 +212,45 @@ void CPetRooms::areaChanged(PetArea area) { _petControl->makeDirty(); } -CPetRoomsGlyph *CPetRooms::addGlyph(int val, bool highlight) { - CPetRoomsGlyph *glyph = new CPetRoomsGlyph(val); +void CPetRooms::addRandomRoom(int passClassNum) { + CPetRoomsGlyph *glyph = _glyphs.findMode1(); + if (glyph) + glyph->setMode(RGM_2); + + CRoomFlags roomFlags; + roomFlags.setRandomLocation(passClassNum, _field1D4); + if (addRoom(roomFlags, true)) { + + } + + warning("TODO: CPetRooms::addRoom"); +} + +CPetRoomsGlyph *CPetRooms::addRoom(uint roomFlags, bool highlight) { + // Ensure that we don't add room if the room is already present + if (_glyphs.hasFlags(roomFlags)) + return nullptr; + + if (_glyphs.size() >= 32) + // Too many rooms already + return nullptr; + + // Do a preliminary scan of the glyph list for any glyph that is + // no longer valid, and thus can be removed + for (CPetRoomsGlyphs::iterator i = _glyphs.begin(); i != _glyphs.end(); ++i) { + CPetRoomsGlyph *glyph = static_cast(*i); + if (!glyph->isModeValid()) { + _glyphs.erase(i); + break; + } + } + + // Add the glyph + return addGlyph(roomFlags, highlight); +} + +CPetRoomsGlyph *CPetRooms::addGlyph(uint roomFlags, bool highlight) { + CPetRoomsGlyph *glyph = new CPetRoomsGlyph(roomFlags); if (!glyph->setup(_petControl, &_glyphs)) { delete glyph; return nullptr; @@ -226,10 +263,6 @@ CPetRoomsGlyph *CPetRooms::addGlyph(int val, bool highlight) { } } -void CPetRooms::addRoom(int roomNum) { - warning("TODO: CPetRooms::addRoom"); -} - uint CPetRooms::mode1Flags() const { CPetRoomsGlyph *glyph = _glyphs.findMode1(); return glyph ? glyph->getRoomFlags() : 0; diff --git a/engines/titanic/pet_control/pet_rooms.h b/engines/titanic/pet_control/pet_rooms.h index 608940fec6..a8a83af753 100644 --- a/engines/titanic/pet_control/pet_rooms.h +++ b/engines/titanic/pet_control/pet_rooms.h @@ -72,7 +72,12 @@ private: /** * Adds a glyph to the list */ - CPetRoomsGlyph *addGlyph(int val, bool highlight); + CPetRoomsGlyph *addRoom(uint roomFlags, bool highlight); + + /** + * Adds a glyph to the list + */ + CPetRoomsGlyph *addGlyph(uint roomFlags, bool highlight); uint mode1Flags() const; public: @@ -151,9 +156,9 @@ public: virtual CGameObject *getBackground(int index); /** - * Adds a room to the room list + * Adds a random room to the glyph list */ - void addRoom(int roomNum); + void addRandomRoom(int passClassNum); int fn2(int val); }; diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.cpp b/engines/titanic/pet_control/pet_rooms_glyphs.cpp index 71fdc5662d..1048180369 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.cpp +++ b/engines/titanic/pet_control/pet_rooms_glyphs.cpp @@ -102,4 +102,14 @@ CPetRoomsGlyph *CPetRoomsGlyphs::findMode1() const { return nullptr; } +CPetRoomsGlyph *CPetRoomsGlyphs::findGlyphByFlags(uint flags) const { + for (const_iterator i = begin(); i != end(); ++i) { + CPetRoomsGlyph *glyph = static_cast(*i); + if (glyph->getRoomFlags() == flags) + return glyph; + } + + return nullptr; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.h b/engines/titanic/pet_control/pet_rooms_glyphs.h index c48011f347..1d6ded7af9 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.h +++ b/engines/titanic/pet_control/pet_rooms_glyphs.h @@ -46,27 +46,6 @@ public: CPetRoomsGlyph(); CPetRoomsGlyph(uint flags); - /** - * Set the room flags for the glyph - */ - void setFoomFlags(uint flags) { _roomFlags = flags; } - - /** - * Get the room flags for the glyph - */ - uint getRoomFlags() const { return _roomFlags; } - - void set38(int val) { _field38 = val; } - - /** - * Sets the mode of the glyph - */ - void setMode(RoomGlyphMode mode) { _mode = mode; } - - bool isModeValid() const { return _mode != RGM_0; } - bool isMode1() const { return _mode == RGM_1; } - bool isMode2() const { return _mode == RGM_2; } - /** * Setup the glyph */ @@ -94,6 +73,28 @@ public: virtual int proc33(); virtual void proc39(); + + + /** + * Set the room flags for the glyph + */ + void setFoomFlags(uint flags) { _roomFlags = flags; } + + /** + * Get the room flags for the glyph + */ + uint getRoomFlags() const { return _roomFlags; } + + void set38(int val) { _field38 = val; } + + /** + * Sets the mode of the glyph + */ + void setMode(RoomGlyphMode mode) { _mode = mode; } + + bool isModeValid() const { return _mode != RGM_0; } + bool isMode1() const { return _mode == RGM_1; } + bool isMode2() const { return _mode == RGM_2; } }; class CPetRoomsGlyphs : public CPetGlyphs { @@ -105,6 +106,17 @@ public: void save2(SimpleFile *file, int indent) const; CPetRoomsGlyph *findMode1() const; + + + /** + * Finds a glyph in the list by it's room flags + */ + CPetRoomsGlyph *findGlyphByFlags(uint flags) const; + + /** + * Returns true if there's a glyph in the list with a given room flags + */ + bool hasFlags(uint flags) const { return findGlyphByFlags(flags) != nullptr; } }; } // End of namespace Titanic -- cgit v1.2.3 From 5a328ce28f4edfe3da0c261d7abc884aa6af94a2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 22 Jun 2016 23:20:14 -0400 Subject: TITANIC: Completed CPetRooms methods --- engines/titanic/game/television.cpp | 6 +- engines/titanic/npcs/deskbot.cpp | 8 +- engines/titanic/pet_control/pet_control.cpp | 12 -- engines/titanic/pet_control/pet_control.h | 135 ++++++++++++++++++-- engines/titanic/pet_control/pet_rooms.cpp | 153 +++++++++++++++++++---- engines/titanic/pet_control/pet_rooms.h | 53 ++++++-- engines/titanic/pet_control/pet_rooms_glyphs.cpp | 7 ++ engines/titanic/pet_control/pet_rooms_glyphs.h | 4 +- engines/titanic/room_flags.cpp | 7 ++ engines/titanic/room_flags.h | 31 +++-- 10 files changed, 341 insertions(+), 75 deletions(-) diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp index 5127712cad..a3f8ec3391 100644 --- a/engines/titanic/game/television.cpp +++ b/engines/titanic/game/television.cpp @@ -277,10 +277,12 @@ bool CTelevision::TurnOn(CTurnOn *msg) { bool CTelevision::LightsMsg(CLightsMsg *msg) { CPetControl *pet = getPetControl(); + bool flag = false; + if (pet) - pet->fn4(); + flag = pet->isRoom59706(); - if (msg->_field8 || !_turnOn) + if (msg->_field8 || !flag) _turnOn = true; return true; diff --git a/engines/titanic/npcs/deskbot.cpp b/engines/titanic/npcs/deskbot.cpp index a52d7c7e4d..2af758b598 100644 --- a/engines/titanic/npcs/deskbot.cpp +++ b/engines/titanic/npcs/deskbot.cpp @@ -197,7 +197,7 @@ bool CDeskbot::TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg) { if (getPassengerClass() == 1) { CPetControl *petControl = getPetControl(); if (petControl) - petControl->roomFn2(4); + petControl->changeLocationClass(4); } break; @@ -205,7 +205,7 @@ bool CDeskbot::TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg) { if (getPassengerClass() == 1) { CPetControl *petControl = getPetControl(); if (petControl) - petControl->roomFn2(3); + petControl->changeLocationClass(3); } break; @@ -213,7 +213,7 @@ bool CDeskbot::TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg) { if (getPassengerClass() == 1) { CPetControl *petControl = getPetControl(); if (petControl) - petControl->roomFn2(2); + petControl->changeLocationClass(2); } break; @@ -221,7 +221,7 @@ bool CDeskbot::TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg) { if (getPassengerClass() == 1) { CPetControl *petControl = getPetControl(); if (petControl) - petControl->roomFn2(1); + petControl->changeLocationClass(1); } break; diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index e7bf1eeb7a..45b5ac3c93 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -188,10 +188,6 @@ bool CPetControl::fn1(int val) { return false; } -void CPetControl::fn4() { - warning("TODO: CPetControl::fn4"); -} - PetArea CPetControl::setArea(PetArea newArea) { if (newArea == _currentArea || !isUnlocked()) return _currentArea; @@ -520,14 +516,6 @@ CString CPetControl::getFullViewName() { return gameManager ? gameManager->getFullViewName() : CString(); } -void CPetControl::addRandomRoom(int passClassNum) { - _rooms.addRandomRoom(passClassNum); -} - -int CPetControl::roomFn2(int val) { - return _rooms.fn2(val); -} - void CPetControl::resetDials(int flag) { if (flag == 1) _conversations.resetDials(_activeNPCName); diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 652a6e8c83..c9056a7b32 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -166,8 +166,6 @@ public: void fn3(CTreeItem *item); - void fn4(); - /** * Sets the currently viewed area within the PET */ @@ -306,13 +304,6 @@ public: */ CString getFullViewName(); - /** - * Adds a random room to the room list - */ - void addRandomRoom(int passClassNum); - - int roomFn2(int val); - /** * Resets the dial display to reflect new values */ @@ -322,10 +313,136 @@ public: void incC0() { ++_fieldC0; } void decC0() { --_fieldC0; } + /* CPetRooms methods */ + + /** + * Adds a random room to the room list + */ + void addRandomRoom(int passClassNum) { + _rooms.addRandomRoom(passClassNum); + } + + /** + * Change the current location passenger class + */ + bool changeLocationClass(int newClassNum) { + return _rooms.changeLocationClass(newClassNum); + } + + /** + * Returns true if the Rooms list has a room with the given flags + */ + bool hasRoomFlags() const { + return _rooms.hasRoomFlags(getRoomFlags()); + } + + uint getRoomFlags() const { + return _rooms.getRoomFlags(); + } + + /** + * Set the current elevator number to use for room glyphs + */ + void setRoomsElevatorNum(int elevNum) { + _rooms.setElevatorNum(elevNum); + } + + /** + * Get the current elevator number used by room glyphs + */ + int getRoomsElevatorNum() const { + return _rooms.getElevatorNum(); + } + + /** + * Set the current floor number to use for room glyphs + */ + void setRoomsFloorNum(int floorNum) { + _rooms.setFloorNum(floorNum); + } + + /** + * Get the current floor number used by room glyphs + */ + int getRoomsFloorNum() const { + return _rooms.getFloorNum(); + } + + /** + * Set the current room number to use for room glyphs + */ + void setRoomsRoomNum(int roomNum) { + _rooms.setRoomNum(roomNum); + } + + /** + * Get the current floor number used by room glyphs + */ + int getRoomsRoomNum() const { + return _rooms.getRoomNum(); + } + + void setRooms1D0(int v) { + _rooms.set1D0(v); + } + int getRooms1D0() const { + return _rooms.get1D0(); + } + void setRooms1CC(int v) { + _rooms.set1CC(v); + } + int getRooms1CC() const { + return _rooms.get1CC(); + } + + /** + * Reset the highlight + */ + void resetRoomsHighlight() { + _rooms.resetHighlight(); + } + + int getRoomsMode1Flags() const { + return _rooms.mode1Flags(); + } + + uint getSpecialRoomFlags(const CString &name) { + return CRoomFlags::getSpecialRoomFlags(name); + } + /** * Get mail destination given the specified flags */ int getMailDest(const CRoomFlags &roomFlags) const; + + bool testRooms5(uint roomFlags) { + return CRoomFlags(roomFlags).not5(); + } + + int getRoomsRoomNum1() const { + return _rooms.getMode1RoomNum(); + } + int getRoomsFloorNum1() const { + return _rooms.getMode1FloorNum(); + } + int getRoomsElevatorNum1() const { + return _rooms.getMode1ElevatorNum(); + } + + void setRooms1D4(int val) { + _rooms.set1D4(val); + } + + bool isRoom59706() const { + return CRoomFlags(getRoomFlags()).is59706(); + } + + /** + * Returns true if the passed room flags indicate the room has a succubus + */ + bool isSuccUBusRoom(const CRoomFlags &roomFlags) { + return roomFlags.isSuccUBusRoomFlags(); + } }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp index b98c68c174..9db5adc7de 100644 --- a/engines/titanic/pet_control/pet_rooms.cpp +++ b/engines/titanic/pet_control/pet_rooms.cpp @@ -30,7 +30,7 @@ CPetRooms::CPetRooms() : _chevRightOnDim(nullptr), _chevRightOffDim(nullptr), _chevLeftOnLit(nullptr), _chevLeftOffLit(nullptr), _chevRightOnLit(nullptr), _chevRightOffLit(nullptr), - _field1C0(0), _field1C4(0), _field1C8(0), _field1CC(0), + _floorNum(0), _elevatorNum(0), _roomNum(0), _field1CC(0), _field1D0(0), _field1D4(0) { } @@ -95,7 +95,22 @@ bool CPetRooms::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { } bool CPetRooms::checkDragEnd(CGameObject *item) { - warning("TODO: CPetRooms::checkDragEnd"); + // Ignore any item drops except valid mail items + if (!item->_isMail) + return false; + + uint roomFlags = item->_id; + CPetRoomsGlyph *glyph = _glyphs.findGlyphByFlags(roomFlags); + if (glyph) { + if (_glyphs.findGlyphByFlags(0)) { + _glyphs.highlight(glyph); + return false; + } + + roomFlags = 0; + } + + addRoom(roomFlags, true); return false; } @@ -119,9 +134,9 @@ void CPetRooms::load(SimpleFile *file, int param) { _glyphItem.setMode((RoomGlyphMode)file->readNumber()); file->readNumber(); - _field1C0 = file->readNumber(); - _field1C4 = file->readNumber(); - _field1C8 = file->readNumber(); + _floorNum = file->readNumber(); + _elevatorNum = file->readNumber(); + _roomNum = file->readNumber(); _field1CC = file->readNumber(); _field1D0 = file->readNumber(); _field1D4 = file->readNumber(); @@ -135,9 +150,9 @@ void CPetRooms::postLoad() { void CPetRooms::save(SimpleFile *file, int indent) const { _glyphs.save2(file, indent); _glyphItem.save2(file, indent); - file->writeNumberLine(_field1C0, indent); - file->writeNumberLine(_field1C4, indent); - file->writeNumberLine(_field1C8, indent); + file->writeNumberLine(_floorNum, indent); + file->writeNumberLine(_elevatorNum, indent); + file->writeNumberLine(_roomNum, indent); file->writeNumberLine(_field1CC, indent); file->writeNumberLine(_field1D0, indent); file->writeNumberLine(_field1D4, indent); @@ -157,7 +172,26 @@ CPetText *CPetRooms::getText() { } CGameObject *CPetRooms::getBackground(int index) { - return nullptr; + switch (index) { + case 8: + return _chevLeftOnDim; + case 9: + return _chevLeftOffDim; + case 10: + return _chevLeftOnLit; + case 11: + return _chevLeftOffLit; + case 12: + return _chevRightOnDim; + case 13: + return _chevRightOffDim; + case 14: + return _chevRightOnLit; + case 15: + return _chevRightOffLit; + default: + return nullptr; + } } bool CPetRooms::setupControl(CPetControl *petControl) { @@ -191,20 +225,54 @@ bool CPetRooms::setupControl(CPetControl *petControl) { } void CPetRooms::resetHighlight() { - _glyphItem.setMode(fn1()); + _glyphItem.setRoomFlags(getRoomFlags()); _glyphs.resetHighlight(); _glyphItem.updateTooltip(); areaChanged(PET_ROOMS); } -RoomGlyphMode CPetRooms::fn1() { - warning("TODO: CPetRooms::fn1"); - return RGM_0; -} +uint CPetRooms::getRoomFlags() const { + CRoomFlags roomFlags; + CString roomName = _petControl->getRoomName(); + + uint flags = roomFlags.getSpecialRoomFlags(roomName); + if (flags) + return flags; + + int classNum = roomFlags.whatPassengerClass(_floorNum); + roomFlags.setPassengerClassBits(classNum); + roomFlags.setFloorNum(_floorNum); + + switch (classNum) { + case 1: + roomFlags.setElevatorNum(_elevatorNum); + roomFlags.setRoomBits(_roomNum); + break; + + case 2: + if (_roomNum > 0) { + if (_roomNum >= 3) { + roomFlags.setElevatorNum(_elevatorNum == 1 || _elevatorNum == 2 ? 1 : 3); + } else { + roomFlags.setElevatorNum(_elevatorNum == 1 || _elevatorNum == 2 ? 2 : 4); + } + + roomFlags.setRoomBits(((_roomNum - 1) & 1) + (_field1CC > 1 ? 3 : 2)); + } else { + roomFlags.setRoomBits(0); + } + break; -int CPetRooms::fn2(int val) { - warning("TODO: CPetRooms::fn2"); - return 0; + case 3: + roomFlags.setElevatorNum(_elevatorNum); + roomFlags.setRoomBits(_roomNum + _field1CC * 6 - 6); + break; + + default: + break; + } + + return roomFlags.get(); } void CPetRooms::areaChanged(PetArea area) { @@ -219,11 +287,11 @@ void CPetRooms::addRandomRoom(int passClassNum) { CRoomFlags roomFlags; roomFlags.setRandomLocation(passClassNum, _field1D4); - if (addRoom(roomFlags, true)) { - + glyph = addRoom(roomFlags, true); + if (glyph) { + glyph->setMode(RGM_1); + _glyphs.highlight(glyph); } - - warning("TODO: CPetRooms::addRoom"); } CPetRoomsGlyph *CPetRooms::addRoom(uint roomFlags, bool highlight) { @@ -268,4 +336,47 @@ uint CPetRooms::mode1Flags() const { return glyph ? glyph->getRoomFlags() : 0; } +bool CPetRooms::changeLocationClass(int newClassNum) { + CPetRoomsGlyph *glyph = _glyphs.findMode1(); + if (!glyph) + return 0; + + glyph->changeLocation(newClassNum); + return true; +} + +bool CPetRooms::hasRoomFlags(uint roomFlags) const { + for (CPetRoomsGlyphs::const_iterator i = _glyphs.begin(); i != _glyphs.end(); ++i) { + const CPetRoomsGlyph *glyph = static_cast(*i); + if (glyph->isModeValid() && glyph->getRoomFlags() == roomFlags) + return true; + } + + return false; +} + +int CPetRooms::getMode1RoomNum() const { + uint flags = mode1Flags(); + if (!flags) + return 0; + + return CRoomFlags(flags).getRoomNum(); +} + +int CPetRooms::getMode1FloorNum() const { + uint flags = mode1Flags(); + if (!flags) + return 0; + + return CRoomFlags(flags).getFloorNum(); +} + +int CPetRooms::getMode1ElevatorNum() const { + uint flags = mode1Flags(); + if (!flags) + return 0; + + return CRoomFlags(flags).getElevatorNum(); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms.h b/engines/titanic/pet_control/pet_rooms.h index a8a83af753..1e7468ac1b 100644 --- a/engines/titanic/pet_control/pet_rooms.h +++ b/engines/titanic/pet_control/pet_rooms.h @@ -43,9 +43,9 @@ private: CGameObject *_chevRightOffLit; CPetGfxElement _plinth; CPetText _text; - int _field1C0; - int _field1C4; - int _field1C8; + int _floorNum; + int _elevatorNum; + int _roomNum; int _field1CC; int _field1D0; int _field1D4; @@ -60,13 +60,6 @@ private: */ Point getGlyphPos() const { return Point(509, 388); } - /** - * Reset the highlight - */ - void resetHighlight(); - - RoomGlyphMode fn1(); - void areaChanged(PetArea area); /** @@ -78,8 +71,6 @@ private: * Adds a glyph to the list */ CPetRoomsGlyph *addGlyph(uint roomFlags, bool highlight); - - uint mode1Flags() const; public: CPetRooms(); @@ -155,12 +146,48 @@ public: virtual CGameObject *getBackground(int index); + /** + * Reset the highlight + */ + void resetHighlight(); + /** * Adds a random room to the glyph list */ void addRandomRoom(int passClassNum); - int fn2(int val); + /** + * Change the current location passenger class + */ + bool changeLocationClass(int newClassNum); + + /** + * Returns true if a room glyph exists with the given flags + */ + bool hasRoomFlags(uint roomFlags) const; + + int getMode1RoomNum() const; + int getMode1FloorNum() const; + int getMode1ElevatorNum() const; + + /** + * Gets room flags to use for glyphs + */ + uint getRoomFlags() const; + + uint mode1Flags() const; + + void setFloorNum(int floorNum) { _floorNum = floorNum; } + int getFloorNum() const { return _floorNum; } + void setElevatorNum(int elevNum) { _elevatorNum = elevNum; } + int getElevatorNum() const { return _elevatorNum; } + void setRoomNum(int roomNum) { _roomNum = roomNum; } + int getRoomNum() const { return _roomNum; } + void set1CC(int val) { _field1CC = val; } + int get1CC() const { return _field1CC; } + void set1D0(int val) { _field1D0 = val; } + int get1D0() const { return _field1D0; } + void set1D4(int val) { _field1D4 = val; } }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.cpp b/engines/titanic/pet_control/pet_rooms_glyphs.cpp index 1048180369..786049791e 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.cpp +++ b/engines/titanic/pet_control/pet_rooms_glyphs.cpp @@ -23,6 +23,7 @@ #include "titanic/pet_control/pet_rooms_glyphs.h" #include "titanic/pet_control/pet_section.h" #include "titanic/support/screen_manager.h" +#include "titanic/room_flags.h" namespace Titanic { @@ -83,6 +84,12 @@ void CPetRoomsGlyph::proc39() { } +void CPetRoomsGlyph::changeLocation(int newClassNum) { + CRoomFlags roomFlags(_roomFlags); + roomFlags.changeLocation(newClassNum); + _roomFlags = roomFlags.get(); +} + /*------------------------------------------------------------------------*/ void CPetRoomsGlyphs::save2(SimpleFile *file, int indent) const { diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.h b/engines/titanic/pet_control/pet_rooms_glyphs.h index 1d6ded7af9..98ddcc74e9 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.h +++ b/engines/titanic/pet_control/pet_rooms_glyphs.h @@ -78,7 +78,7 @@ public: /** * Set the room flags for the glyph */ - void setFoomFlags(uint flags) { _roomFlags = flags; } + void setRoomFlags(uint flags) { _roomFlags = flags; } /** * Get the room flags for the glyph @@ -92,6 +92,8 @@ public: */ void setMode(RoomGlyphMode mode) { _mode = mode; } + void changeLocation(int newClassNum); + bool isModeValid() const { return _mode != RGM_0; } bool isMode1() const { return _mode == RGM_1; } bool isMode2() const { return _mode == RGM_2; } diff --git a/engines/titanic/room_flags.cpp b/engines/titanic/room_flags.cpp index b64b6509ca..ac378e20c1 100644 --- a/engines/titanic/room_flags.cpp +++ b/engines/titanic/room_flags.cpp @@ -509,4 +509,11 @@ void CRoomFlags::setRandomLocation(int classNum, bool flag) { } while (_data == 0x59706); } +int CRoomFlags::whatPassengerClass(int floorNum) { + if (is2To19(floorNum)) + return 1; + + return is20To27(floorNum) ? 2 : 3; +} + } // End of namespace Titanic diff --git a/engines/titanic/room_flags.h b/engines/titanic/room_flags.h index 553e0a32d6..dfb7c89d96 100644 --- a/engines/titanic/room_flags.h +++ b/engines/titanic/room_flags.h @@ -33,8 +33,6 @@ private: private: int getConditionally() const; - bool not5() const { return getConditionally() != 5; } - /** * Returns true if the current flags appear in the * list of transport rooms @@ -50,11 +48,6 @@ private: */ void setElevatorBits(uint val); - /** - * Set the bits for the passenger class - */ - void setPassengerClassBits(uint val); - /** * Set the bits for the floor number */ @@ -81,11 +74,9 @@ private: */ bool isTitania() const { return _data == 0x8A397; } - bool is59706() const { return _data == 0x59706; } - - bool is2To19(uint v) const { return v >= 2 && v <= 19; } - bool is20To27(uint v) const { return v >= 20 && v <= 27; } - bool is28To38(uint v) const { return v >= 28 && v <= 38; } + static bool is2To19(uint v) { return v >= 2 && v <= 19; } + static bool is20To27(uint v) { return v >= 20 && v <= 27; } + static bool is28To38(uint v) { return v >= 28 && v <= 38; } public: CRoomFlags() : _data(0) {} CRoomFlags(uint data) : _data(data) {} @@ -104,7 +95,7 @@ public: /** * Gets the special flags for a transport or succubus room */ - uint getSpecialRoomFlags(const CString &roomName); + static uint getSpecialRoomFlags(const CString &roomName); /** * Returns true if the current flags are in the succubus list @@ -143,6 +134,11 @@ public: */ uint getPassengerClassBits() const; + /** + * Set the bits for the passenger class + */ + void setPassengerClassBits(uint val); + /** * Gets the passenger class number */ @@ -218,6 +214,15 @@ public: * Gets the succubus room name associated with the current room flags */ CString getSuccUBusRoomName() const; + + /** + * Returns what passenger class a particular floor number belongs to + */ + static int whatPassengerClass(int floorNum); + + bool not5() const { return getConditionally() != 5; } + + bool is59706() const { return _data == 0x59706; } }; } // End of namespace Titanic -- cgit v1.2.3 From 3fb8c888a76762160179f331b2df2d3fa967b242 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 23 Jun 2016 07:39:25 -0400 Subject: TITANIC: Adding miscellaneous CGameObject & CPetControl methods --- engines/titanic/core/game_object.cpp | 22 ++++++++++++++++++++-- engines/titanic/core/game_object.h | 20 ++++++++++++++------ engines/titanic/pet_control/pet_control.cpp | 15 ++++++++++----- engines/titanic/pet_control/pet_control.h | 18 +++++++++++++----- 4 files changed, 57 insertions(+), 18 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 695a6d66a5..79ceb92116 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -402,10 +402,10 @@ void CGameObject::petShowCursor() { pet->showCursor(); } -void CGameObject::petFn3(CTreeItem *item) { +void CGameObject::petSetRemoteTarget() { CPetControl *pet = getPetControl(); if (pet) - pet->fn3(item); + pet->setRemoteTarget(this); } void CGameObject::playMovie(uint startFrame, uint endFrame, uint flags) { @@ -1057,4 +1057,22 @@ void CGameObject::resetMail() { mailMan->resetValue(); } +void CGameObject::petSetRooms1D0(int val) { + CPetControl *petControl = getPetControl(); + if (petControl) + petControl->setRooms1D0(val); +} + +int CGameObject::petGetRooms1D0() const { + CPetControl *petControl = getPetControl(); + return petControl ? petControl->getRooms1D0() : 0; +} + +void CGameObject::petAddRandomRoom(int passClassNum) { + CPetControl *petControl = getPetControl(); + if (petControl) + petControl->addRandomRoom(passClassNum); +} + + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index bb6b161a48..0a6070463f 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -141,16 +141,15 @@ protected: */ void petShowCursor(); - void petFn3(CTreeItem *item); + /** + * Set the remote target in the PET to this object + */ + void petSetRemoteTarget(); + void incState38(); void inc54(); void dec54(); - /** - * Adds a room to the room list - */ - void petAddRandomRoom(int passClassNum); - /** * Locks/hides the mouse */ @@ -565,6 +564,15 @@ public: * Sets up credits text */ void createCredits(); + + void petSetRooms1D0(int val); + + int petGetRooms1D0() const; + + /** + * Adds a random room to the pET + */ + void petAddRandomRoom(int passClassNum); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 45b5ac3c93..802e0ada12 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -178,9 +178,14 @@ void CPetControl::enterRoom(CRoomItem *room) { _remote.enterRoom(room); } -void CPetControl::clear() { +void CPetControl::resetRemoteTarget() { _remoteTarget = nullptr; - _string2.clear(); + _remoteTargetName.clear(); +} + +void CPetControl::resetActiveNPC() { + _activeNPC = nullptr; + _activeNPCName = ""; } bool CPetControl::fn1(int val) { @@ -219,12 +224,12 @@ void CPetControl::highlightGlyph(int id) { _sections[_currentArea]->highlight(id); } -void CPetControl::fn3(CTreeItem *item) { +void CPetControl::setRemoteTarget(CGameObject *item) { _remoteTarget = item; if (item) - _string2 = item->getName(); + _remoteTargetName = item->getName(); else - _string2.clear(); + _remoteTargetName.clear(); } CRoomItem *CPetControl::getHiddenRoom() { diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index c9056a7b32..3881bda78f 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -63,7 +63,7 @@ private: CPetMessage _message; CPetFrame _frame; CString _activeNPCName; - CString _string2; + CString _remoteTargetName; CRoomItem *_hiddenRoom; Rect _drawBounds; PetEventInfo _timers[2]; @@ -112,7 +112,7 @@ protected: public: PetArea _currentArea; CTreeItem *_activeNPC; - CTreeItem *_remoteTarget; + CGameObject *_remoteTarget; public: CLASSDEF CPetControl(); @@ -158,13 +158,21 @@ public: void enterRoom(CRoomItem *room); /** - * Called to clear the PET display + * Called to reset the remote target */ - void clear(); + void resetRemoteTarget(); + + /** + * Resets the Active NPC + */ + void resetActiveNPC(); bool fn1(int val); - void fn3(CTreeItem *item); + /** + * Set the remote target + */ + void setRemoteTarget(CGameObject *item); /** * Sets the currently viewed area within the PET -- cgit v1.2.3 From 54eac84dc5051c9833ea96f0be6c7b44ba262817 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 23 Jun 2016 19:08:45 -0400 Subject: TITANIC: Fix compilation issues --- engines/titanic/core/game_object.cpp | 8 +------- engines/titanic/game/television.cpp | 2 +- engines/titanic/pet_control/pet_control.cpp | 8 ++++---- engines/titanic/pet_control/pet_rooms_glyphs.cpp | 6 ++++-- engines/titanic/pet_control/pet_rooms_glyphs.h | 7 +++++-- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 79ceb92116..f0fd08ae94 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -790,12 +790,6 @@ void CGameObject::dec54() { getGameManager()->dec54(); } -void CGameObject::petAddRandomRoom(int passClassNum) { - CPetControl *petControl = getPetControl(); - if (petControl) - petControl->addRandomRoom(passClassNum); -} - void CGameObject::lockMouse() { CGameManager *gameMan = getGameManager(); gameMan->lockInputHandler(); @@ -897,7 +891,7 @@ void CGameObject::checkPlayMovie(const CString &name, int flags) { void CGameObject::clearPet() const { CPetControl *petControl = getPetControl(); if (petControl) - petControl->clear(); + petControl->resetActiveNPC(); } CPetControl *CGameObject::getPetControl() const { diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp index a3f8ec3391..4d8e3f2042 100644 --- a/engines/titanic/game/television.cpp +++ b/engines/titanic/game/television.cpp @@ -141,7 +141,7 @@ bool CTelevision::ChangeSeasonMsg(CChangeSeasonMsg *msg) { bool CTelevision::EnterViewMsg(CEnterViewMsg *msg) { setPetArea(PET_REMOTE); petHighlightGlyph(GLYPH_TELEVISION_CONTROL); - petFn3(0); + petSetRemoteTarget(); setVisible(0); _fieldE0 = 1; diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 802e0ada12..22b513ef75 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -59,7 +59,7 @@ void CPetControl::save(SimpleFile *file, int indent) const { file->writeNumberLine(0, indent); file->writeNumberLine(_currentArea, indent); file->writeQuotedLine(_activeNPCName, indent); - file->writeQuotedLine(_string2, indent); + file->writeQuotedLine(_remoteTargetName, indent); saveAreas(file, indent); CGameObject::save(file, indent); @@ -72,7 +72,7 @@ void CPetControl::load(SimpleFile *file) { if (!val) { _currentArea = (PetArea)file->readNumber(); _activeNPCName = file->readString(); - _string2 = file->readString(); + _remoteTargetName = file->readString(); loadAreas(file, 0); } @@ -151,8 +151,8 @@ void CPetControl::postLoad() { if (!_activeNPCName.empty() && root) _activeNPC = root->findByName(_activeNPCName); - if (!_string2.empty() && root) - _remoteTarget = root->findByName(_string2); + if (!_remoteTargetName.empty() && root) + _remoteTarget = static_cast(root->findByName(_remoteTargetName)); setArea(_currentArea); loaded(); diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.cpp b/engines/titanic/pet_control/pet_rooms_glyphs.cpp index 786049791e..9ecaefbf68 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.cpp +++ b/engines/titanic/pet_control/pet_rooms_glyphs.cpp @@ -80,8 +80,10 @@ int CPetRoomsGlyph::proc33() { return 1; } -void CPetRoomsGlyph::proc39() { - +void CPetRoomsGlyph::loadFlags(SimpleFile *file, int val) { + if (!val) { + _roomFlags = file->readNumber(); + } } void CPetRoomsGlyph::changeLocation(int newClassNum) { diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.h b/engines/titanic/pet_control/pet_rooms_glyphs.h index 98ddcc74e9..bed167f934 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.h +++ b/engines/titanic/pet_control/pet_rooms_glyphs.h @@ -24,6 +24,7 @@ #define TITANIC_PET_ROOMS_GLYPHS_H #include "titanic/pet_control/pet_glyphs.h" +#include "titanic/support/simple_file.h" namespace Titanic { @@ -71,9 +72,11 @@ public: virtual void save2(SimpleFile *file, int indent) const; virtual int proc33(); - - virtual void proc39(); + /** + * Loads flags for the glyph + */ + virtual void loadFlags(SimpleFile *file, int val); /** * Set the room flags for the glyph -- cgit v1.2.3 From f7d6db05e849855cbd17a60c3bbc3b1e96d1453a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 23 Jun 2016 20:17:26 -0400 Subject: TITANIC: Adding Pet Room glyph methods --- engines/titanic/events.h | 4 +- engines/titanic/pet_control/pet_glyphs.h | 2 +- engines/titanic/pet_control/pet_rooms_glyphs.cpp | 51 +++++++++++++++++++++++- engines/titanic/pet_control/pet_rooms_glyphs.h | 10 ++++- 4 files changed, 62 insertions(+), 5 deletions(-) diff --git a/engines/titanic/events.h b/engines/titanic/events.h index 4cbba178ad..4638056e8c 100644 --- a/engines/titanic/events.h +++ b/engines/titanic/events.h @@ -48,7 +48,7 @@ private: uint32 _priorMiddleDownTime; uint32 _priorRightDownTime; Common::Point _mousePos; - int _specialButtons; + uint _specialButtons; /** * Check whether it's time to display the next screen frame @@ -108,6 +108,8 @@ public: * Sleep for a specified period of time */ void sleep(uint time); + + uint getSpecialButtons() const { return _specialButtons; } }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index 5dc5013a9b..f0b9ef128b 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -178,7 +178,7 @@ public: /** * */ - virtual void proc28(const Point &pt) {} + virtual void proc28(const Point &topLeft, const Point &pt) {} virtual int proc29(const Point &pt) { return 0; } diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.cpp b/engines/titanic/pet_control/pet_rooms_glyphs.cpp index 9ecaefbf68..de06e02bc4 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.cpp +++ b/engines/titanic/pet_control/pet_rooms_glyphs.cpp @@ -21,9 +21,11 @@ */ #include "titanic/pet_control/pet_rooms_glyphs.h" +#include "titanic/pet_control/pet_control.h" #include "titanic/pet_control/pet_section.h" #include "titanic/support/screen_manager.h" #include "titanic/room_flags.h" +#include "titanic/titanic.h" namespace Titanic { @@ -63,11 +65,36 @@ void CPetRoomsGlyph::drawAt(CScreenManager *screenManager, const Point &pt) { warning("TODO: CPetRoomsGlyph::drawAt"); } -void CPetRoomsGlyph::proc28(const Point &pt) { +void CPetRoomsGlyph::proc28(const Point &topLeft, const Point &pt) { + if (isModeValid()) { + bool isShiftPressed = g_vm->_events->getSpecialButtons() & MK_SHIFT; + if (isShiftPressed) { + int selection = getSelection(topLeft, pt); + if (selection >= 0) + _roomFlags |= 1 << selection; + } + + updateTooltip(); + } } int CPetRoomsGlyph::proc29(const Point &pt) { + bool isShiftPressed = g_vm->_events->getSpecialButtons() & MK_SHIFT; + CPetControl *petControl = getPetControl(); + + if (!isShiftPressed && petControl) { + CGameObject *chevron = petControl->getHiddenObject("3PetChevron"); + + if (chevron) { + chevron->_id = _roomFlags; + chevron->_isMail = _field38; +// petControl->removeFromInventory(chevon); +// chevron->loadSurface(); + // TODO + } + } + return 0; } @@ -92,6 +119,28 @@ void CPetRoomsGlyph::changeLocation(int newClassNum) { _roomFlags = roomFlags.get(); } +int CPetRoomsGlyph::getSelection(const Point &topLeft, const Point &pt) { + Rect rects[4] = { + Rect(topLeft.x, topLeft.y, topLeft.x + 13, topLeft.y + 10), + Rect(topLeft.x + 13, topLeft.y, topLeft.x + 26, topLeft.y + 10), + Rect(topLeft.x + 26, topLeft.y, topLeft.x + 39, topLeft.y + 10), + Rect(topLeft.x + 39, topLeft.y, topLeft.x + 52, topLeft.y + 10) + }; + + for (int idx = 0, btnIndex = 19; idx < 5; ++idx, btnIndex -= 4) { + // Iterate through each of the four rects, seeing if there's a match. + // If not, move it down to the next row for the next loop iteration + for (int i = 0; i < 4; ++i) { + if (rects[i].contains(pt)) + return btnIndex - i; + + rects[i].translate(0, 10); + } + } + + return -1; +} + /*------------------------------------------------------------------------*/ void CPetRoomsGlyphs::save2(SimpleFile *file, int indent) const { diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.h b/engines/titanic/pet_control/pet_rooms_glyphs.h index bed167f934..cb937ec5c0 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.h +++ b/engines/titanic/pet_control/pet_rooms_glyphs.h @@ -31,7 +31,7 @@ namespace Titanic { enum RoomGlyphMode { RGM_0 = 0, RGM_1 = 1, RGM_2 = 2 }; class CPetRoomsGlyph : public CPetGlyph { -protected: +private: uint _roomFlags; int _field38; RoomGlyphMode _mode; @@ -43,6 +43,12 @@ protected: CGameObject *_field54; CGameObject *_field58; CGameObject *_field5C; +private: + /** + * Find the selected button under the given point, based on the buttons + * starting at a designated top/left position + */ + int getSelection(const Point &topLeft, const Point &pt); public: CPetRoomsGlyph(); CPetRoomsGlyph(uint flags); @@ -65,7 +71,7 @@ public: /** * */ - virtual void proc28(const Point &pt); + virtual void proc28(const Point &topLeft, const Point &pt); virtual int proc29(const Point &pt); -- cgit v1.2.3 From 5b98885f8797d5c36336a22a9399611b11a3715f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 23 Jun 2016 21:22:59 -0400 Subject: TITANIC: Figured out PET Room Glyph modes --- engines/titanic/core/game_object.cpp | 5 ++- engines/titanic/core/game_object.h | 14 ++++---- engines/titanic/npcs/deskbot.cpp | 6 ++-- engines/titanic/pet_control/pet_control.cpp | 4 +-- engines/titanic/pet_control/pet_control.h | 35 +++++++++++++------- engines/titanic/pet_control/pet_inventory.cpp | 2 +- engines/titanic/pet_control/pet_inventory.h | 2 +- engines/titanic/pet_control/pet_inventory_glyphs.h | 4 +-- engines/titanic/pet_control/pet_rooms.cpp | 38 ++++++++++++---------- engines/titanic/pet_control/pet_rooms.h | 28 ++++++++++++---- engines/titanic/pet_control/pet_rooms_glyphs.cpp | 34 +++++++++++++++---- engines/titanic/pet_control/pet_rooms_glyphs.h | 32 ++++++++++++++---- 12 files changed, 135 insertions(+), 69 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index f0fd08ae94..735caad288 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -1062,11 +1062,10 @@ int CGameObject::petGetRooms1D0() const { return petControl ? petControl->getRooms1D0() : 0; } -void CGameObject::petAddRandomRoom(int passClassNum) { +void CGameObject::reassignRoom(int passClassNum) { CPetControl *petControl = getPetControl(); if (petControl) - petControl->addRandomRoom(passClassNum); + petControl->reassignRoom(passClassNum); } - } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 0a6070463f..059b705700 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -270,11 +270,6 @@ protected: */ void endTalking(CTrueTalkNPC *npc, uint id, CViewItem *view = nullptr); - /** - * Load the surface - */ - void loadSurface(); - /** * Change the view */ @@ -528,6 +523,11 @@ public: */ void loadFrame(int frameNumber); + /** + * Load the surface + */ + void loadSurface(); + /** * Marks the area occupied by the object as dirty, requiring re-rendering */ @@ -570,9 +570,9 @@ public: int petGetRooms1D0() const; /** - * Adds a random room to the pET + * Gives the player a new assigned room in the specified passenger class */ - void petAddRandomRoom(int passClassNum); + void reassignRoom(int passClassNum); }; } // End of namespace Titanic diff --git a/engines/titanic/npcs/deskbot.cpp b/engines/titanic/npcs/deskbot.cpp index 2af758b598..eb42a8e21d 100644 --- a/engines/titanic/npcs/deskbot.cpp +++ b/engines/titanic/npcs/deskbot.cpp @@ -178,16 +178,16 @@ bool CDeskbot::TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg) { case 1: petDisplayMsg("You have been upgraded to 1st Class status. Enjoy hugely."); setPassengerClass(_classNum); - petAddRandomRoom(_classNum); + reassignRoom(_classNum); break; case 2: petDisplayMsg("You have been upgraded to 2nd Class status. Enjoy."); setPassengerClass(_classNum); - petAddRandomRoom(_classNum); + reassignRoom(_classNum); break; case 3: setPassengerClass(3); - petAddRandomRoom(_classNum); + reassignRoom(_classNum); break; default: break; diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 22b513ef75..5de87cd04b 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -376,7 +376,7 @@ CGameObject *CPetControl::getNextObject(CGameObject *prior) const { return static_cast(prior->getNextSibling()); } -void CPetControl::addToInventory(CCarry *item) { +void CPetControl::addToInventory(CGameObject *item) { item->detach(); if (item->getName() == "CarryParcel") { @@ -403,7 +403,7 @@ void CPetControl::addToInventory(CCarry *item) { msg.execute(item); } -void CPetControl::removeFromInventory(CCarry *item, CTreeItem *newParent, +void CPetControl::removeFromInventory(CGameObject *item, CTreeItem *newParent, bool refreshUI, bool sendMsg) { if (item && newParent) { item->detach(); diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 3881bda78f..8093152089 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -251,12 +251,12 @@ public: /** * Adds an item to the PET inventory */ - void addToInventory(CCarry *item); + void addToInventory(CGameObject *item); /** * Remove an item from the inventory */ - void removeFromInventory(CCarry *item, CTreeItem *newParent, + void removeFromInventory(CGameObject *item, CTreeItem *newParent, bool refreshUI = true, bool sendMsg = true); /** @@ -324,10 +324,10 @@ public: /* CPetRooms methods */ /** - * Adds a random room to the room list + * Gives the player a new assigned room in the specified passenger class */ - void addRandomRoom(int passClassNum) { - _rooms.addRandomRoom(passClassNum); + void reassignRoom(int passClassNum) { + _rooms.reassignRoom(passClassNum); } /** @@ -410,8 +410,8 @@ public: _rooms.resetHighlight(); } - int getRoomsMode1Flags() const { - return _rooms.mode1Flags(); + int getAssignedRoomFlags() const { + return _rooms.getAssignedRoomFlags(); } uint getSpecialRoomFlags(const CString &name) { @@ -427,14 +427,25 @@ public: return CRoomFlags(roomFlags).not5(); } - int getRoomsRoomNum1() const { - return _rooms.getMode1RoomNum(); + /** + * Returns the room number for the player's currently assigned room + */ + int getAssignedRoomNum() const { + return _rooms.getAssignedRoomNum(); } - int getRoomsFloorNum1() const { - return _rooms.getMode1FloorNum(); + + /** + * Returns the floor number for the player's currently assigned room + */ + int getAssignedFloorNum() const { + return _rooms.getAssignedFloorNum(); } + + /** + * Returns the elevator number for the player's currently assigned room + */ int getRoomsElevatorNum1() const { - return _rooms.getMode1ElevatorNum(); + return _rooms.getAssignedElevatorNum(); } void setRooms1D4(int val) { diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index 1ea78062d5..37a73420bd 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -128,7 +128,7 @@ void CPetInventory::change(CCarry *item) { } } -void CPetInventory::itemRemoved(CCarry *item) { +void CPetInventory::itemRemoved(CGameObject *item) { if (item) { CInventoryGlyphAction action(item, ACTION_REMOVED); _items.change(&action); diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h index 70bcc12f85..58e6bd9a1d 100644 --- a/engines/titanic/pet_control/pet_inventory.h +++ b/engines/titanic/pet_control/pet_inventory.h @@ -127,7 +127,7 @@ public: /** * Called when an item has been removed from the PET */ - void itemRemoved(CCarry *item); + void itemRemoved(CGameObject *item); /** * Called when the items under the PET have changed diff --git a/engines/titanic/pet_control/pet_inventory_glyphs.h b/engines/titanic/pet_control/pet_inventory_glyphs.h index 190bce77ac..91b1e5ee50 100644 --- a/engines/titanic/pet_control/pet_inventory_glyphs.h +++ b/engines/titanic/pet_control/pet_inventory_glyphs.h @@ -61,9 +61,9 @@ public: class CInventoryGlyphAction : public CGlyphAction { public: - CCarry *_item; + CGameObject *_item; public: - CInventoryGlyphAction(CCarry *item, GlyphActionMode mode) : + CInventoryGlyphAction(CGameObject *item, GlyphActionMode mode) : CGlyphAction(mode), _item(item) {} }; diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp index 9db5adc7de..6f34ee5869 100644 --- a/engines/titanic/pet_control/pet_rooms.cpp +++ b/engines/titanic/pet_control/pet_rooms.cpp @@ -280,16 +280,18 @@ void CPetRooms::areaChanged(PetArea area) { _petControl->makeDirty(); } -void CPetRooms::addRandomRoom(int passClassNum) { - CPetRoomsGlyph *glyph = _glyphs.findMode1(); +void CPetRooms::reassignRoom(int passClassNum) { + CPetRoomsGlyph *glyph = _glyphs.findAssignedRoom(); if (glyph) - glyph->setMode(RGM_2); + // Flag the old assigned room as no longer assigned + glyph->setMode(RGM_PREV_ASSIGNED_ROOM); CRoomFlags roomFlags; roomFlags.setRandomLocation(passClassNum, _field1D4); glyph = addRoom(roomFlags, true); if (glyph) { - glyph->setMode(RGM_1); + // Flag the new room as assigned to the player, and highlight it + glyph->setMode(RGM_ASSIGNED_ROOM); _glyphs.highlight(glyph); } } @@ -307,7 +309,7 @@ CPetRoomsGlyph *CPetRooms::addRoom(uint roomFlags, bool highlight) { // no longer valid, and thus can be removed for (CPetRoomsGlyphs::iterator i = _glyphs.begin(); i != _glyphs.end(); ++i) { CPetRoomsGlyph *glyph = static_cast(*i); - if (!glyph->isModeValid()) { + if (!glyph->isAssigned()) { _glyphs.erase(i); break; } @@ -331,13 +333,8 @@ CPetRoomsGlyph *CPetRooms::addGlyph(uint roomFlags, bool highlight) { } } -uint CPetRooms::mode1Flags() const { - CPetRoomsGlyph *glyph = _glyphs.findMode1(); - return glyph ? glyph->getRoomFlags() : 0; -} - bool CPetRooms::changeLocationClass(int newClassNum) { - CPetRoomsGlyph *glyph = _glyphs.findMode1(); + CPetRoomsGlyph *glyph = _glyphs.findAssignedRoom(); if (!glyph) return 0; @@ -348,31 +345,36 @@ bool CPetRooms::changeLocationClass(int newClassNum) { bool CPetRooms::hasRoomFlags(uint roomFlags) const { for (CPetRoomsGlyphs::const_iterator i = _glyphs.begin(); i != _glyphs.end(); ++i) { const CPetRoomsGlyph *glyph = static_cast(*i); - if (glyph->isModeValid() && glyph->getRoomFlags() == roomFlags) + if (glyph->isAssigned() && glyph->getRoomFlags() == roomFlags) return true; } return false; } -int CPetRooms::getMode1RoomNum() const { - uint flags = mode1Flags(); +uint CPetRooms::getAssignedRoomFlags() const { + CPetRoomsGlyph *glyph = _glyphs.findAssignedRoom(); + return glyph ? glyph->getRoomFlags() : 0; +} + +int CPetRooms::getAssignedRoomNum() const { + uint flags = getAssignedRoomFlags(); if (!flags) return 0; return CRoomFlags(flags).getRoomNum(); } -int CPetRooms::getMode1FloorNum() const { - uint flags = mode1Flags(); +int CPetRooms::getAssignedFloorNum() const { + uint flags = getAssignedRoomFlags(); if (!flags) return 0; return CRoomFlags(flags).getFloorNum(); } -int CPetRooms::getMode1ElevatorNum() const { - uint flags = mode1Flags(); +int CPetRooms::getAssignedElevatorNum() const { + uint flags = getAssignedRoomFlags(); if (!flags) return 0; diff --git a/engines/titanic/pet_control/pet_rooms.h b/engines/titanic/pet_control/pet_rooms.h index 1e7468ac1b..b39587a7f7 100644 --- a/engines/titanic/pet_control/pet_rooms.h +++ b/engines/titanic/pet_control/pet_rooms.h @@ -152,9 +152,9 @@ public: void resetHighlight(); /** - * Adds a random room to the glyph list + * Gives the player a new assigned room in the specified passenger class */ - void addRandomRoom(int passClassNum); + void reassignRoom(int passClassNum); /** * Change the current location passenger class @@ -166,17 +166,31 @@ public: */ bool hasRoomFlags(uint roomFlags) const; - int getMode1RoomNum() const; - int getMode1FloorNum() const; - int getMode1ElevatorNum() const; + /** + * Returns the room flags for the player's currently assigned room + */ + uint getAssignedRoomFlags() const; + + /** + * Returns the room number for the player's currently assigned room + */ + int getAssignedRoomNum() const; + + /** + * Returns the floor number for the player's currently assigned room + */ + int getAssignedFloorNum() const; + + /** + * Returns the elevator number for the player's currently assigned room + */ + int getAssignedElevatorNum() const; /** * Gets room flags to use for glyphs */ uint getRoomFlags() const; - uint mode1Flags() const; - void setFloorNum(int floorNum) { _floorNum = floorNum; } int getFloorNum() const { return _floorNum; } void setElevatorNum(int elevNum) { _elevatorNum = elevNum; } diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.cpp b/engines/titanic/pet_control/pet_rooms_glyphs.cpp index de06e02bc4..d6f13c3314 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.cpp +++ b/engines/titanic/pet_control/pet_rooms_glyphs.cpp @@ -30,13 +30,13 @@ namespace Titanic { CPetRoomsGlyph::CPetRoomsGlyph() : CPetGlyph(), - _roomFlags(0), _field38(0), _mode(RGM_0), + _roomFlags(0), _field38(0), _mode(RGM_UNASSIGNED), _field40(nullptr), _field44(nullptr), _field48(nullptr), _field4C(nullptr), _field50(nullptr), _field54(nullptr), _field58(nullptr), _field5C(nullptr) { } CPetRoomsGlyph::CPetRoomsGlyph(uint flags) : CPetGlyph(), - _roomFlags(flags), _field38(0), _mode(RGM_0), + _roomFlags(flags), _field38(0), _mode(RGM_UNASSIGNED), _field40(nullptr), _field44(nullptr), _field48(nullptr), _field4C(nullptr), _field50(nullptr), _field54(nullptr), _field58(nullptr), _field5C(nullptr) { } @@ -66,7 +66,7 @@ void CPetRoomsGlyph::drawAt(CScreenManager *screenManager, const Point &pt) { } void CPetRoomsGlyph::proc28(const Point &topLeft, const Point &pt) { - if (isModeValid()) { + if (isAssigned()) { bool isShiftPressed = g_vm->_events->getSpecialButtons() & MK_SHIFT; if (isShiftPressed) { @@ -89,8 +89,10 @@ int CPetRoomsGlyph::proc29(const Point &pt) { if (chevron) { chevron->_id = _roomFlags; chevron->_isMail = _field38; -// petControl->removeFromInventory(chevon); -// chevron->loadSurface(); + petControl->removeFromInventory(chevron, false, false); + chevron->loadSurface(); + + warning("TODO: CPetRoomsGlyph::proc29"); // TODO } } @@ -98,6 +100,24 @@ int CPetRoomsGlyph::proc29(const Point &pt) { return 0; } +void CPetRoomsGlyph::getTooltip(CPetText *text) { + CRoomFlags roomFlags(_roomFlags); + CPetSection *owner = getPetSection(); + + CString msg; + if (isCurrentlyAssigned()) { + msg = "Your assigned room: "; + } else if (isPreviouslyAssigned()) { + msg = "A previously assigned room: "; + } else if (!_field38) { + msg = "Saved Chevron: "; + } else if (_field38 == 1 && getRoomFlags() == _roomFlags) { + msg = "Current location: "; + } + + // TODO: More stuff +} + void CPetRoomsGlyph::save2(SimpleFile *file, int indent) const { file->writeNumberLine(_roomFlags, indent); file->writeNumberLine(_mode, indent); @@ -150,10 +170,10 @@ void CPetRoomsGlyphs::save2(SimpleFile *file, int indent) const { (*i)->save2(file, indent); } -CPetRoomsGlyph *CPetRoomsGlyphs::findMode1() const { +CPetRoomsGlyph *CPetRoomsGlyphs::findAssignedRoom() const { for (const_iterator i = begin(); i != end(); ++i) { CPetRoomsGlyph *glyph = static_cast(*i); - if (glyph->isMode1()) + if (glyph->isCurrentlyAssigned()) return glyph; } diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.h b/engines/titanic/pet_control/pet_rooms_glyphs.h index cb937ec5c0..574403b0c6 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.h +++ b/engines/titanic/pet_control/pet_rooms_glyphs.h @@ -28,7 +28,9 @@ namespace Titanic { -enum RoomGlyphMode { RGM_0 = 0, RGM_1 = 1, RGM_2 = 2 }; +enum RoomGlyphMode { + RGM_UNASSIGNED = 0, RGM_ASSIGNED_ROOM = 1, RGM_PREV_ASSIGNED_ROOM = 2 +}; class CPetRoomsGlyph : public CPetGlyph { private: @@ -75,6 +77,11 @@ public: virtual int proc29(const Point &pt); + /** + * Returns the tooltip text for when the glyph is selected + */ + virtual void getTooltip(CPetText *text); + virtual void save2(SimpleFile *file, int indent) const; virtual int proc33(); @@ -103,9 +110,20 @@ public: void changeLocation(int newClassNum); - bool isModeValid() const { return _mode != RGM_0; } - bool isMode1() const { return _mode == RGM_1; } - bool isMode2() const { return _mode == RGM_2; } + /** + * Returns true if the room is either currently or previously assigned + */ + bool isAssigned() const { return _mode != RGM_UNASSIGNED; } + + /** + * Returns true if the room is the one currently assigned to the player + */ + bool isCurrentlyAssigned() const { return _mode == RGM_ASSIGNED_ROOM; } + + /** + * Returns true if the room was previously assigned to the player + */ + bool isPreviouslyAssigned() const { return _mode == RGM_PREV_ASSIGNED_ROOM; } }; class CPetRoomsGlyphs : public CPetGlyphs { @@ -116,8 +134,10 @@ public: */ void save2(SimpleFile *file, int indent) const; - CPetRoomsGlyph *findMode1() const; - + /** + * Returns the glyph for hte player's assigned room + */ + CPetRoomsGlyph *findAssignedRoom() const; /** * Finds a glyph in the list by it's room flags -- cgit v1.2.3 From fd2fd2cdc5e730b43510d2a6b866a9aa67c3c7d5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 23 Jun 2016 22:14:50 -0400 Subject: TITANIC: Added PET Room Glyph drawing --- engines/titanic/pet_control/pet_rooms.cpp | 2 +- engines/titanic/pet_control/pet_rooms_glyphs.cpp | 93 +++++++++++++++++++----- engines/titanic/pet_control/pet_rooms_glyphs.h | 23 +++--- 3 files changed, 91 insertions(+), 27 deletions(-) diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp index 6f34ee5869..34554eba95 100644 --- a/engines/titanic/pet_control/pet_rooms.cpp +++ b/engines/titanic/pet_control/pet_rooms.cpp @@ -56,7 +56,7 @@ bool CPetRooms::reset() { void CPetRooms::draw(CScreenManager *screenManager) { _petControl->drawSquares(screenManager, 6); _plinth.draw(screenManager); - _glyphItem.drawAt(screenManager, getGlyphPos()); + _glyphItem.drawAt(screenManager, getGlyphPos(), false); _text.draw(screenManager); } diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.cpp b/engines/titanic/pet_control/pet_rooms_glyphs.cpp index d6f13c3314..520a649688 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.cpp +++ b/engines/titanic/pet_control/pet_rooms_glyphs.cpp @@ -31,14 +31,14 @@ namespace Titanic { CPetRoomsGlyph::CPetRoomsGlyph() : CPetGlyph(), _roomFlags(0), _field38(0), _mode(RGM_UNASSIGNED), - _field40(nullptr), _field44(nullptr), _field48(nullptr), _field4C(nullptr), - _field50(nullptr), _field54(nullptr), _field58(nullptr), _field5C(nullptr) { + _object0(nullptr), _object1(nullptr), _object2(nullptr), _object3(nullptr), + _object4(nullptr), _object5(nullptr), _object6(nullptr), _object7(nullptr) { } CPetRoomsGlyph::CPetRoomsGlyph(uint flags) : CPetGlyph(), _roomFlags(flags), _field38(0), _mode(RGM_UNASSIGNED), - _field40(nullptr), _field44(nullptr), _field48(nullptr), _field4C(nullptr), - _field50(nullptr), _field54(nullptr), _field58(nullptr), _field5C(nullptr) { + _object0(nullptr), _object1(nullptr), _object2(nullptr), _object3(nullptr), + _object4(nullptr), _object5(nullptr), _object6(nullptr), _object7(nullptr) { } bool CPetRoomsGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { @@ -46,23 +46,59 @@ bool CPetRoomsGlyph::setup(CPetControl *petControl, CPetGlyphs *owner) { return false; CPetSection *section = owner->getOwner(); - _field40 = section->getBackground(9); - _field44 = section->getBackground(12); - _field50 = section->getBackground(13); - _field54 = section->getBackground(10); - _field48 = section->getBackground(11); - _field4C = section->getBackground(14); - _field58 = section->getBackground(15); - _field5C = _field58; + _object0 = section->getBackground(9); + _object1 = section->getBackground(12); + _object4 = section->getBackground(13); + _object5 = section->getBackground(10); + _object2 = section->getBackground(11); + _object3 = section->getBackground(14); + _object6 = section->getBackground(15); + _object7 = _object6; return true; } -void CPetRoomsGlyph::drawAt(CScreenManager *screenManager, const Point &pt) { +void CPetRoomsGlyph::drawAt(CScreenManager *screenManager, const Point &pt, bool isHighlighted) { // Clear background Rect rect(pt.x, pt.y, pt.x + 52, pt.y + 52); screenManager->fillRect(SURFACE_BACKBUFFER, &rect, 0, 0, 0); - warning("TODO: CPetRoomsGlyph::drawAt"); + CRoomFlags roomFlags(_roomFlags); + uint elevBits = roomFlags.getElevatorBits(); + uint classBits = roomFlags.getPassengerClassBits(); + uint floorBits = roomFlags.getFloorBits(); + uint roomBits = roomFlags.getRoomBits(); + + // Save a copy of object pointers that may be modified + CGameObject *obj0 = _object0; + CGameObject *obj1 = _object1; + CGameObject *obj4 = _object4; + CGameObject *obj5 = _object5; + + if (_field38 == 1 || isHighlighted) { + _object0 = _object2; + _object1 = _object3; + _object4 = _object6; + _object5 = _object7; + } + + // Draw the images + Point destPt = pt; + drawObjects(classBits + elevBits * 4, destPt, screenManager); + destPt.y += 10; + drawObjects((floorBits >> 4) & 15, destPt, screenManager); + destPt.y += 10; + drawObjects(floorBits & 15, destPt, screenManager); + destPt.y += 10; + drawObjects(roomBits >> 3, destPt, screenManager); + destPt.y += 7; + drawObjects(((roomBits & 7) << 1) + (roomFlags.getBit0() ? 1 : 0), + destPt, screenManager); + + // Restore original object pointers + _object0 = obj0; + _object1 = obj1; + _object4 = obj4; + _object5 = obj5; } void CPetRoomsGlyph::proc28(const Point &topLeft, const Point &pt) { @@ -102,7 +138,7 @@ int CPetRoomsGlyph::proc29(const Point &pt) { void CPetRoomsGlyph::getTooltip(CPetText *text) { CRoomFlags roomFlags(_roomFlags); - CPetSection *owner = getPetSection(); + CPetRooms *owner = static_cast(getPetSection()); CString msg; if (isCurrentlyAssigned()) { @@ -111,11 +147,20 @@ void CPetRoomsGlyph::getTooltip(CPetText *text) { msg = "A previously assigned room: "; } else if (!_field38) { msg = "Saved Chevron: "; - } else if (_field38 == 1 && getRoomFlags() == _roomFlags) { + } else if (_field38 == 1 && owner->getRoomFlags() == _roomFlags) { msg = "Current location: "; } - // TODO: More stuff + // Get the room description + CString roomStr = roomFlags.getRoomDesc(); + + if (roomStr == "The Elevator") { + int elevNum = owner->getElevatorNum(); + roomStr = CString::format("Elevator %d", elevNum); + } + + roomStr += " (shift-click edits)"; + text->setText(roomStr); } void CPetRoomsGlyph::save2(SimpleFile *file, int indent) const { @@ -161,6 +206,20 @@ int CPetRoomsGlyph::getSelection(const Point &topLeft, const Point &pt) { return -1; } +void CPetRoomsGlyph::drawObjects(uint flags, const Point &pt, CScreenManager *screenManager) { + if (_object0 && _object1 && _object4 && _object5) { + Point destPos = pt; + ((flags & 8) ? _object0 : _object5)->draw(screenManager, destPos); + destPos.x += 13; + ((flags & 4) ? _object4 : _object5)->draw(screenManager, destPos); + destPos.x += 13; + ((flags & 2) ? _object0 : _object1)->draw(screenManager, destPos); + destPos.x += 13; + ((flags & 1) ? _object4 : _object5)->draw(screenManager, destPos); + } +} + + /*------------------------------------------------------------------------*/ void CPetRoomsGlyphs::save2(SimpleFile *file, int indent) const { diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.h b/engines/titanic/pet_control/pet_rooms_glyphs.h index 574403b0c6..f0b243ea7c 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.h +++ b/engines/titanic/pet_control/pet_rooms_glyphs.h @@ -37,20 +37,25 @@ private: uint _roomFlags; int _field38; RoomGlyphMode _mode; - CGameObject *_field40; - CGameObject *_field44; - CGameObject *_field48; - CGameObject *_field4C; - CGameObject *_field50; - CGameObject *_field54; - CGameObject *_field58; - CGameObject *_field5C; + CGameObject *_object0; + CGameObject *_object1; + CGameObject *_object2; + CGameObject *_object3; + CGameObject *_object4; + CGameObject *_object5; + CGameObject *_object6; + CGameObject *_object7; private: /** * Find the selected button under the given point, based on the buttons * starting at a designated top/left position */ int getSelection(const Point &topLeft, const Point &pt); + + /** + * Draws the objects + */ + void drawObjects(uint flags, const Point &pt, CScreenManager *screenManager); public: CPetRoomsGlyph(); CPetRoomsGlyph(uint flags); @@ -63,7 +68,7 @@ public: /** * Draw the glyph at a specified position */ - virtual void drawAt(CScreenManager *screenManager, const Point &pt); + virtual void drawAt(CScreenManager *screenManager, const Point &pt, bool isHighlighted); /** * Handles any secondary drawing of the glyph -- cgit v1.2.3 From a4b746d24eaeba4cfd05603be2591dc3ec2d10e9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 23 Jun 2016 22:23:03 -0400 Subject: TITANIC: Added further PET Rooms Glyph method --- engines/titanic/pet_control/pet_glyphs.h | 2 +- engines/titanic/pet_control/pet_rooms_glyphs.cpp | 6 ++++-- engines/titanic/pet_control/pet_rooms_glyphs.h | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index f0b9ef128b..f6c4806d83 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -195,7 +195,7 @@ public: virtual void save2(SimpleFile *file, int indent) {} - virtual int proc33() { return 1; } + virtual bool proc33(CPetGlyph *glyph) { return true; } virtual int proc34() { return 1; } /** diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.cpp b/engines/titanic/pet_control/pet_rooms_glyphs.cpp index 520a649688..7f6ebd6898 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.cpp +++ b/engines/titanic/pet_control/pet_rooms_glyphs.cpp @@ -168,8 +168,10 @@ void CPetRoomsGlyph::save2(SimpleFile *file, int indent) const { file->writeNumberLine(_mode, indent); } -int CPetRoomsGlyph::proc33() { - return 1; +bool CPetRoomsGlyph::proc33(CPetGlyph *glyph) { + CPetRoomsGlyph *roomGlyph = static_cast(glyph); + + return proc33(glyph) && _roomFlags == roomGlyph->_roomFlags; } void CPetRoomsGlyph::loadFlags(SimpleFile *file, int val) { diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.h b/engines/titanic/pet_control/pet_rooms_glyphs.h index f0b243ea7c..f3bd2d2b61 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.h +++ b/engines/titanic/pet_control/pet_rooms_glyphs.h @@ -89,7 +89,7 @@ public: virtual void save2(SimpleFile *file, int indent) const; - virtual int proc33(); + virtual bool proc33(CPetGlyph *glyph); /** * Loads flags for the glyph -- cgit v1.2.3 From 934787b19be3aa86e02d77eea0a1a5ffa1771075 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 23 Jun 2016 22:44:17 -0400 Subject: TITANIC: Finsihed remaining PET Remote methods --- engines/titanic/pet_control/pet_remote.cpp | 20 +++++++++++++++++--- engines/titanic/pet_control/pet_remote.h | 2 +- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/engines/titanic/pet_control/pet_remote.cpp b/engines/titanic/pet_control/pet_remote.cpp index 6f133259a8..f59f1fb0d7 100644 --- a/engines/titanic/pet_control/pet_remote.cpp +++ b/engines/titanic/pet_control/pet_remote.cpp @@ -178,7 +178,19 @@ void CPetRemote::enter(PetArea oldArea) { } void CPetRemote::enterRoom(CRoomItem *room) { - // TODO + clearGlyphs(); + + if (room) { + CString roomName = room->getName(); + int roomIndex = roomIndexOf(roomName); + if (roomIndex != -1) { + Common::Array indexes; + if (getRemoteData(roomIndex, indexes)) { + loadGlyphs(indexes); + _items.scrollToStart(); + } + } + } } CPetText *CPetRemote::getText() { @@ -298,17 +310,19 @@ int CPetRemote::roomIndexOf(const CString &name) { return -1; } -void CPetRemote::getRemoteData(int roomIndex, Common::Array &indexes) { +bool CPetRemote::getRemoteData(int roomIndex, Common::Array &indexes) { const byte *p = &REMOTE_DATA[0]; for (int idx = 0; idx < TOTAL_ROOMS; ++idx) { if (*p == roomIndex) { for (int ctr = 0; ctr < *p; ++ctr) indexes.push_back(p[ctr + 1]); - return; + return true; } p += *(p + 1) + 2; } + + return false; } bool CPetRemote::loadGlyphs(const Common::Array &indexes) { diff --git a/engines/titanic/pet_control/pet_remote.h b/engines/titanic/pet_control/pet_remote.h index 58c429f5bf..22ea1e05ad 100644 --- a/engines/titanic/pet_control/pet_remote.h +++ b/engines/titanic/pet_control/pet_remote.h @@ -70,7 +70,7 @@ private: /** * Return a list of remote action glyph indexes for a given room */ - void getRemoteData(int roomIndex, Common::Array &indexes); + bool getRemoteData(int roomIndex, Common::Array &indexes); /** * Clear the list of rooms glyphs -- cgit v1.2.3 From ec5dcc17dc75a1b74a417676edf0c51048e19b6c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 23 Jun 2016 23:18:30 -0400 Subject: TITANIC: Added TTtalker methods --- engines/titanic/core/game_object.h | 10 +++++----- engines/titanic/pet_control/pet_control.cpp | 2 +- engines/titanic/pet_control/pet_control.h | 21 +++++++++++++++------ engines/titanic/pet_control/pet_conversations.cpp | 11 +++++++++++ engines/titanic/pet_control/pet_conversations.h | 10 ++++++++++ engines/titanic/true_talk/tt_npc_script.cpp | 2 +- engines/titanic/true_talk/tt_talker.cpp | 17 +++++++++++++++++ engines/titanic/true_talk/tt_talker.h | 11 ++++++++++- 8 files changed, 70 insertions(+), 14 deletions(-) diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 059b705700..4b9fab98f7 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -328,11 +328,6 @@ protected: * Clear the PET display */ void clearPet() const; - - /** - * Returns the PET control - */ - CPetControl *getPetControl() const; /** * Returns the MailMan @@ -471,6 +466,11 @@ public: * Returns true if the item is the PET control */ virtual bool isPet() const; + + /** + * Returns the PET control + */ + CPetControl *getPetControl() const; /** * Play the movie specified in _resource diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 5de87cd04b..549ba728a8 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -521,7 +521,7 @@ CString CPetControl::getFullViewName() { return gameManager ? gameManager->getFullViewName() : CString(); } -void CPetControl::resetDials(int flag) { +void CPetControl::convResetDials(int flag) { if (flag == 1) _conversations.resetDials(_activeNPCName); } diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 8093152089..fb5e0093da 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -312,16 +312,25 @@ public: */ CString getFullViewName(); - /** - * Resets the dial display to reflect new values - */ - void resetDials(int flag = 1); - bool getC0() const { return _fieldC0 > 0; } void incC0() { ++_fieldC0; } void decC0() { --_fieldC0; } - /* CPetRooms methods */ + /*--- CPetConversations methods ---*/ + + /** + * Resets the dial display in the conversation tab to reflect new values + */ + void convResetDials(int flag = 1); + + /** + * Adds a line to the conversation log + */ + void convAddLine(const CString &line) { + _conversations.addLine(line); + } + + /*--- CPetRooms methods ---*/ /** * Gives the player a new assigned room in the specified passenger class diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index 4e2d905960..b1c3ef3763 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -239,6 +239,8 @@ void CPetConversations::save(SimpleFile *file, int indent) const { } void CPetConversations::enter(PetArea oldArea) { + resetDials(); + if (_petControl && _petControl->_activeNPC) // Start a timer for the NPC startNPCTimer(); @@ -558,6 +560,10 @@ void CPetConversations::npcDialChange(uint dialNum, int oldLevel, int newLevel) } } +void CPetConversations::resetDials() { + resetDials(getActiveNPCName()); +} + void CPetConversations::resetDials(const CString &name) { TTnpcScript *script = getNPCScript(name); @@ -569,4 +575,9 @@ void CPetConversations::resetDials(const CString &name) { } } +void CPetConversations::addLine(const CString &line) { + _log.addLine(line); + scrollToBottom(); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index cefdf1b8f1..d6a3e252d1 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -237,10 +237,20 @@ public: */ virtual void hideCursor(); + /** + * Resets the dials with the data for the currently active NPC + */ + void resetDials(); + /** * Reset the dials with those for a given NPC */ void resetDials(const CString &name); + + /** + * Adds a line to the log + */ + void addLine(const CString &line); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 1ee5785907..8289b53504 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -464,7 +464,7 @@ void TTnpcScript::setDial(int dialNum, int value) { if (g_vm->_trueTalkManager) { CPetControl *petControl = getPetControl(g_vm->_trueTalkManager->getGameManager()); if (petControl) - petControl->resetDials(); + petControl->convResetDials(); } } diff --git a/engines/titanic/true_talk/tt_talker.cpp b/engines/titanic/true_talk/tt_talker.cpp index 1eb7fc8b2e..61443a4835 100644 --- a/engines/titanic/true_talk/tt_talker.cpp +++ b/engines/titanic/true_talk/tt_talker.cpp @@ -22,6 +22,7 @@ #include "titanic/true_talk/tt_talker.h" #include "titanic/messages/messages.h" +#include "titanic/pet_control/pet_control.h" namespace Titanic { @@ -32,4 +33,20 @@ void TTtalker::speechStarted(const CString &dialogueStr, uint dialogueId, uint s msg.execute(_npc, nullptr, MSGFLAG_BREAK_IF_HANDLED); } +TTtalker::~TTtalker() { + CPetControl *petControl = _npc->getPetControl(); + if (petControl) + // Add in final line + petControl->convAddLine(_line); + + // Notify the end of the speech + CTrueTalkNotifySpeechEndedMsg endedMsg(_field24, _dialogueId); + endedMsg.execute(_npc, nullptr, MSGFLAG_BREAK_IF_HANDLED); +} + +void TTtalker::endSpeech(int val) { + _done = true; + _field24 = val; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_talker.h b/engines/titanic/true_talk/tt_talker.h index 9bb59fbe64..636eb0c022 100644 --- a/engines/titanic/true_talk/tt_talker.h +++ b/engines/titanic/true_talk/tt_talker.h @@ -35,7 +35,7 @@ class TTtalker : public ListItem { public: CTrueTalkManager *_owner; CTrueTalkNPC *_npc; - CString _string1; + CString _line; int _dialogueId; int _field24; int _done; @@ -44,8 +44,17 @@ public: _dialogueId(0), _field24(0), _done(0) {} TTtalker(CTrueTalkManager *owner, CTrueTalkNPC *npc) : _owner(owner), _npc(npc), _dialogueId(0), _field24(0), _done(0) {} + ~TTtalker(); + /** + * Start a new speech + */ void speechStarted(const CString &dialogueStr, uint dialogueId, uint soundId); + + /** + * End the speech + */ + void endSpeech(int val); }; class TTtalkerList : public List { -- cgit v1.2.3 From 9ae0a76333a2258d92996a62a6cc7b1e630107b6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 24 Jun 2016 07:34:02 -0400 Subject: TITANIC: Properly named several PET Glyph virtual methods --- engines/titanic/core/game_object.cpp | 2 +- engines/titanic/core/game_object.h | 10 +++++----- engines/titanic/messages/mouse_messages.h | 6 +++--- engines/titanic/pet_control/pet_glyphs.cpp | 6 +++--- engines/titanic/pet_control/pet_glyphs.h | 14 ++++++++++---- engines/titanic/pet_control/pet_rooms.cpp | 5 +++-- engines/titanic/pet_control/pet_rooms_glyphs.cpp | 13 ++++++++----- engines/titanic/pet_control/pet_rooms_glyphs.h | 9 ++++++--- 8 files changed, 39 insertions(+), 26 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 735caad288..7b894380b0 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -492,7 +492,7 @@ void CGameObject::setPosition(const Point &newPos) { } bool CGameObject::checkStartDragging(CMouseDragStartMsg *msg) { - if (_visible && checkPoint(msg->_mousePos, msg->_field14, 1)) { + if (_visible && checkPoint(msg->_mousePos, msg->_handled, 1)) { savePosition(); msg->_dragItem = this; return true; diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 4b9fab98f7..afcd2f05ee 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -275,11 +275,6 @@ protected: */ bool changeView(const CString &viewName, const CString &clipName); - /** - * Support function for drag moving - */ - void dragMove(const Point &pt); - /** * Get the centre of the game object's bounds */ @@ -573,6 +568,11 @@ public: * Gives the player a new assigned room in the specified passenger class */ void reassignRoom(int passClassNum); + + /** + * Support function for drag moving + */ + void dragMove(const Point &pt); }; } // End of namespace Titanic diff --git a/engines/titanic/messages/mouse_messages.h b/engines/titanic/messages/mouse_messages.h index ce02e1df73..4f568cd682 100644 --- a/engines/titanic/messages/mouse_messages.h +++ b/engines/titanic/messages/mouse_messages.h @@ -127,12 +127,12 @@ public: class CMouseDragStartMsg : public CMouseDragMsg { public: CTreeItem *_dragItem; - int _field14; + bool _handled; public: CLASSDEF - CMouseDragStartMsg() : CMouseDragMsg(), _dragItem(nullptr), _field14(0) {} + CMouseDragStartMsg() : CMouseDragMsg(), _dragItem(nullptr), _handled(false) {} CMouseDragStartMsg(const Point &pt) : CMouseDragMsg(pt), - _dragItem(nullptr), _field14(0) {} + _dragItem(nullptr), _handled(false) {} static bool isSupportedBy(const CTreeItem *item) { return supports(item, _type); diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index d1cb384729..b5fa407dd4 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -259,7 +259,7 @@ void CPetGlyphs::setFirstVisible(int index) { int idx = getHighlightedIndex(_highlightIndex); if (idx != -1) { Point tempPt = getPosition(idx); - glyph->proc27(tempPt, true); + glyph->glyphFocused(tempPt, true); } } } @@ -318,7 +318,7 @@ bool CPetGlyphs::MouseButtonDownMsg(const Point &pt) { CPetGlyph *glyph = getGlyph(index); if (glyph) { if (_highlightIndex == index) { - glyph->MouseButtonDownMsg(glyphRect); + glyph->selectGlyph(glyphRect, pt); glyph->updateTooltip(); } else { changeHighlight(index); @@ -366,7 +366,7 @@ bool CPetGlyphs::MouseDragStartMsg(CMouseDragStartMsg *msg) { Rect glyphRect = getRect(index); if (glyphRect.contains(msg->_mousePos)) - return glyph->proc29(glyphRect); + return glyph->dragGlyph(glyphRect, msg); else return glyph->MouseDragStartMsg(msg); } diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index f6c4806d83..26b1a658a6 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -173,14 +173,20 @@ public: */ virtual void highlightCurrent(const Point &pt) {} - virtual void proc27(const Point &pt, bool flag) {} + /** + * Glyph has been shifted to be first visible one + */ + virtual void glyphFocused(const Point &pt, bool flag) {} /** - * + * Selects a glyph */ - virtual void proc28(const Point &topLeft, const Point &pt) {} + virtual void selectGlyph(const Point &topLeft, const Point &pt) {} - virtual int proc29(const Point &pt) { return 0; } + /** + * Called when a glyph drag starts + */ + virtual bool dragGlyph(const Point &topLeft, CMouseDragStartMsg *msg) { return false; } /** * Returns true if the glyph's bounds, shifted to a given position, diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp index 34554eba95..028f1def3d 100644 --- a/engines/titanic/pet_control/pet_rooms.cpp +++ b/engines/titanic/pet_control/pet_rooms.cpp @@ -75,10 +75,11 @@ bool CPetRooms::MouseDragStartMsg(CMouseDragStartMsg *msg) { if (_glyphs.MouseDragStartMsg(msg)) return true; - if (!_glyphItem.contains(getGlyphPos(), msg->_mousePos)) + Point topLeft = getGlyphPos(); + if (!_glyphItem.contains(topLeft, msg->_mousePos)) return false; - _glyphItem.proc29(msg->_mousePos); + _glyphItem.dragGlyph(topLeft, msg); return true; } diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.cpp b/engines/titanic/pet_control/pet_rooms_glyphs.cpp index 7f6ebd6898..b0a486d574 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.cpp +++ b/engines/titanic/pet_control/pet_rooms_glyphs.cpp @@ -101,7 +101,7 @@ void CPetRoomsGlyph::drawAt(CScreenManager *screenManager, const Point &pt, bool _object5 = obj5; } -void CPetRoomsGlyph::proc28(const Point &topLeft, const Point &pt) { +void CPetRoomsGlyph::selectGlyph(const Point &topLeft, const Point &pt) { if (isAssigned()) { bool isShiftPressed = g_vm->_events->getSpecialButtons() & MK_SHIFT; @@ -115,7 +115,7 @@ void CPetRoomsGlyph::proc28(const Point &topLeft, const Point &pt) { } } -int CPetRoomsGlyph::proc29(const Point &pt) { +bool CPetRoomsGlyph::dragGlyph(const Point &topLeft, CMouseDragStartMsg *msg) { bool isShiftPressed = g_vm->_events->getSpecialButtons() & MK_SHIFT; CPetControl *petControl = getPetControl(); @@ -128,12 +128,15 @@ int CPetRoomsGlyph::proc29(const Point &pt) { petControl->removeFromInventory(chevron, false, false); chevron->loadSurface(); - warning("TODO: CPetRoomsGlyph::proc29"); - // TODO + chevron->dragMove(msg->_mousePos); + msg->_handled = true; + + if (msg->execute(chevron)) + return true; } } - return 0; + return false; } void CPetRoomsGlyph::getTooltip(CPetText *text) { diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.h b/engines/titanic/pet_control/pet_rooms_glyphs.h index f3bd2d2b61..3706fcc01e 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.h +++ b/engines/titanic/pet_control/pet_rooms_glyphs.h @@ -76,11 +76,14 @@ public: virtual void draw2(CScreenManager *screenManager) {} /** - * + * Selects a glyph */ - virtual void proc28(const Point &topLeft, const Point &pt); + virtual void selectGlyph(const Point &topLeft, const Point &pt); - virtual int proc29(const Point &pt); + /** + * Called when a glyph drag starts + */ + virtual bool dragGlyph(const Point &topLeft, CMouseDragStartMsg *msg); /** * Returns the tooltip text for when the glyph is selected -- cgit v1.2.3 From 6b376e2fa1cce5323ae2a462451b7742ff5840d6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 24 Jun 2016 08:18:24 -0400 Subject: TITANIC: Added remaining PET Conversations methods --- engines/titanic/pet_control/pet_conversations.cpp | 12 ++++++++++++ engines/titanic/pet_control/pet_conversations.h | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index b1c3ef3763..9f41a356ed 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -513,6 +513,13 @@ CString CPetConversations::getActiveNPCName() const { return CString(); } +void CPetConversations::setActiveNPC(const CString &name) { + _npcName = name; + _field418 = 1; + resetDials(); + startNPCTimer(); +} + void CPetConversations::copyColors(uint tableNum, uint colors[5]) { const uint *src = getColorTable(tableNum); Common::copy(src, src + 5, colors); @@ -575,6 +582,11 @@ void CPetConversations::resetDials(const CString &name) { } } +void CPetConversations::resetDials0() { + stopNPCTimer(); + resetDials("0"); +} + void CPetConversations::addLine(const CString &line) { _log.addLine(line); scrollToBottom(); diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index d6a3e252d1..9b75a3300c 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -129,6 +129,11 @@ private: */ CString getActiveNPCName() const; + /** + * Set the active NPC + */ + void setActiveNPC(const CString &name); + /** * Create a color table */ @@ -247,6 +252,11 @@ public: */ void resetDials(const CString &name); + /** + * Reset the dials to the '0' position + */ + void resetDials0(); + /** * Adds a line to the log */ -- cgit v1.2.3 From c2f6110d0218802b811c1172f114b5d8ed8bf37c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 24 Jun 2016 08:39:56 -0400 Subject: TITANIC: Added CPetGlyphs methods --- engines/titanic/pet_control/pet_glyphs.cpp | 35 +++++++++++++++++++++++++++++- engines/titanic/pet_control/pet_glyphs.h | 15 +++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index b5fa407dd4..1aea34f708 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -219,7 +219,11 @@ void CPetGlyphs::changeHighlight(int index) { } void CPetGlyphs::highlight(int index) { - warning("TODO: CPetGlyphs::highlight"); + if (index >= 0) { + setSelectedIndex(index); + changeHighlight(index); + makePetDirty(); + } } void CPetGlyphs::highlight(const CPetGlyph *glyph) { @@ -235,6 +239,15 @@ int CPetGlyphs::getItemIndex(int index) { return _firstVisibleIndex + index; } +void CPetGlyphs::setSelectedIndex(int index) { + if (index >= 0 && index < (int)size() && getHighlightedIndex(index) == -1) { + if (_firstVisibleIndex <= index) + index -= _numVisibleGlyphs - 1; + + setFirstVisible(index); + } +} + CPetGlyph *CPetGlyphs::getGlyph(int index) { for (iterator i = begin(); i != end(); ++i) { if (index-- == 0) @@ -459,4 +472,24 @@ int CPetGlyphs::indexOf(const CPetGlyph *glyph) const { return -1; } +void CPetGlyphs::incSelection() { + if (_highlightIndex >= 0 && _highlightIndex < ((int)size() - 1)) { + if (getHighlightedIndex(_highlightIndex) >= (_numVisibleGlyphs - 1)) + scrollRight(); + + changeHighlight(_highlightIndex + 1); + makePetDirty(); + } +} + +void CPetGlyphs::decSelection() { + if (_highlightIndex > 0) { + if (getHighlightedIndex(_highlightIndex) == 0) + scrollLeft(); + + changeHighlight(_highlightIndex - 1); + makePetDirty(); + } +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index 26b1a658a6..f1587e3e5a 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -244,6 +244,11 @@ private: */ int getItemIndex(int index); + /** + * Set the item index + */ + void setSelectedIndex(int index); + /** * Return a specified glyph */ @@ -419,6 +424,16 @@ public: * Resets the scrolling of the glyphs list back to the start */ void scrollToStart() { _firstVisibleIndex = 0; } + + /** + * Increment the currently selected index + */ + void incSelection(); + + /** + * Decrement the currently selected index + */ + void decSelection(); }; } // End of namespace Titanic -- cgit v1.2.3 From 6f5f59af17290930ea75261c604471057e3b45e3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 24 Jun 2016 22:39:01 -0400 Subject: TITANIC: Added various PET methods --- engines/titanic/pet_control/pet_conversations.cpp | 2 +- engines/titanic/pet_control/pet_conversations.h | 5 +- engines/titanic/pet_control/pet_glyphs.cpp | 58 +++++++++++++-- engines/titanic/pet_control/pet_glyphs.h | 84 ++++++++++++++-------- engines/titanic/pet_control/pet_inventory.cpp | 4 +- .../titanic/pet_control/pet_inventory_glyphs.cpp | 10 ++- engines/titanic/pet_control/pet_inventory_glyphs.h | 9 ++- engines/titanic/pet_control/pet_rooms.cpp | 4 +- engines/titanic/pet_control/pet_rooms_glyphs.cpp | 6 +- engines/titanic/pet_control/pet_rooms_glyphs.h | 7 +- engines/titanic/pet_control/pet_section.h | 9 ++- 11 files changed, 146 insertions(+), 52 deletions(-) diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index 9f41a356ed..4ec6e8996d 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -309,7 +309,7 @@ void CPetConversations::displayNPCName(CGameObject *npc) { } } -void CPetConversations::proc34(const CString &name) { +void CPetConversations::setNPC(const CString &name) { _field418 = 0; resetDials(name); startNPCTimer(); diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index 9b75a3300c..9af1f14ee7 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -228,7 +228,10 @@ public: */ virtual void displayNPCName(CGameObject *npc); - virtual void proc34(const CString &name); + /** + * Sets the NPC to use + */ + virtual void setNPC(const CString &name); virtual void proc35(); diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index 1aea34f708..2e9b590db1 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -71,6 +71,10 @@ void CPetGlyph::setName(const CString &name, CPetControl *petControl) { _element.reset(name, petControl, MODE_UNSELECTED); } +bool CPetGlyph::isHighlighted() const { + return _owner->isGlyphHighlighted(this); +} + /*------------------------------------------------------------------------*/ CPetGlyphs::CPetGlyphs() : _firstVisibleIndex(0), _numVisibleGlyphs(TOTAL_GLYPHS), @@ -177,7 +181,7 @@ void CPetGlyphs::draw(CScreenManager *screenManager) { } } -Point CPetGlyphs::getPosition(int index) { +Point CPetGlyphs::getPosition(int index) const { Point tempPoint(37 + index * 70, 375); return tempPoint; } @@ -230,7 +234,7 @@ void CPetGlyphs::highlight(const CPetGlyph *glyph) { highlight(indexOf(glyph)); } -int CPetGlyphs::getHighlightedIndex(int index) { +int CPetGlyphs::getHighlightedIndex(int index) const { int idx = index - _firstVisibleIndex; return (idx >= 0 && idx < _numVisibleGlyphs) ? idx : -1; } @@ -416,15 +420,27 @@ bool CPetGlyphs::KeyCharMsg(int key) { bool CPetGlyphs::VirtualKeyCharMsg(int key) { bool handled = false; - warning("TODO: CPetGlyphs::virtualKeyCharMsg"); - if (!handled && _highlightIndex >= 0) { + switch (key) { + case Common::KEYCODE_LEFT: + decSelection(); + return true; + + case Common::KEYCODE_RIGHT: + incSelection(); + return true; + + default: + break; + } + + if (_highlightIndex >= 0) { CPetGlyph *glyph = getGlyph(_highlightIndex); if (glyph && glyph->VirtualKeyCharMsg(key)) - handled = true; + return true; } - return handled; + return false; } bool CPetGlyphs::enterHighlighted() { @@ -492,4 +508,34 @@ void CPetGlyphs::decSelection() { } } +CGameObject *CPetGlyphs::getObjectAt(const Point &pt) { + for (int idx = 0; idx < _numVisibleGlyphs; ++idx) { + Rect glyphRect = getRect(idx); + if (glyphRect.contains(pt)) { + CPetGlyph *glyph = getGlyph(getItemIndex(idx)); + if (glyph) + return glyph->getObjectAt(); + } + } + + return nullptr; +} + +bool CPetGlyphs::isGlyphHighlighted(const CPetGlyph *glyph) const { + if (_highlightIndex == -1) + return false; + + return indexOf(glyph) == _highlightIndex; +} + +Point CPetGlyphs::getHighlightedGlyphPos() const { + if (_highlightIndex != -1) { + int idx = getHighlightedIndex(_highlightIndex); + if (idx >= 0) + return getPosition(idx); + } + + return Point(0, 0); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index f1587e3e5a..9dfe5ad3fa 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -63,31 +63,6 @@ public: public: CPetGlyph() : ListItem(), _owner(nullptr) {} - /** - * Translate the glyph's position - */ - void translate(const Point &pt) { _element.translate(pt.x, pt.y); } - - /** - * Translate the glyph's position back - */ - void translateBack(const Point &pt) { _element.translate(-pt.x, -pt.y); } - - /** - * Get the parent RealLife area - */ - CPetGlyphs *getOwner() { return _owner; } - - /** - * Get the PET control - */ - CPetControl *getPetControl() const; - - /** - * Sets new name and default bounds for glyph - */ - void setName(const CString &name, CPetControl *petControl); - /** * Setup the glyph */ @@ -199,7 +174,10 @@ public: */ virtual void getTooltip(CPetText *text) {} - virtual void save2(SimpleFile *file, int indent) {} + /** + * Saves the data for the glyph + */ + virtual void saveGlyph(SimpleFile *file, int indent) {} virtual bool proc33(CPetGlyph *glyph) { return true; } virtual int proc34() { return 1; } @@ -214,12 +192,45 @@ public: */ virtual void leaveHighlighted() {} - virtual int proc37() { return 0; } + /** + * Returns the object associated with the glyph + */ + virtual CGameObject *getObjectAt() { return nullptr; } /** * Does a processing action on the glyph */ virtual bool doAction(CGlyphAction *action) { return true; } + + /** + * Translate the glyph's position + */ + void translate(const Point &pt) { _element.translate(pt.x, pt.y); } + + /** + * Translate the glyph's position back + */ + void translateBack(const Point &pt) { _element.translate(-pt.x, -pt.y); } + + /** + * Get the parent RealLife area + */ + CPetGlyphs *getOwner() { return _owner; } + + /** + * Get the PET control + */ + CPetControl *getPetControl() const; + + /** + * Sets new name and default bounds for glyph + */ + void setName(const CString &name, CPetControl *petControl); + + /** + * Returns true if the specified glyph is the currently highlighted one + */ + bool isHighlighted() const; }; class CPetGlyphs : public List { @@ -227,7 +238,7 @@ private: /** * Get a position for the glyph */ - Point getPosition(int index); + Point getPosition(int index) const; /** * Get a rect for the glyph @@ -237,7 +248,7 @@ private: /** * Returns the on-screen index for the highlight to be shown at */ - int getHighlightedIndex(int index); + int getHighlightedIndex(int index) const; /** * Returns the index of a glyph given the visible on-screen glyph number @@ -434,6 +445,21 @@ public: * Decrement the currently selected index */ void decSelection(); + + /** + * Returns the object associated the glyph under the specified position + */ + CGameObject *getObjectAt(const Point &pt); + + /** + * Returns true if the specified glyph is the currently highlighted one + */ + bool isGlyphHighlighted(const CPetGlyph *glyph) const; + + /** + * Get the top-left position of the currently highlighted glyph + */ + Point getHighlightedGlyphPos() const; }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index 37a73420bd..bf6b913d0d 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -124,14 +124,14 @@ bool CPetInventory::setPetControl(CPetControl *petControl) { void CPetInventory::change(CCarry *item) { if (item) { CInventoryGlyphAction action(item, ACTION_CHANGE); - _items.change(&action); + _items.doAction(&action); } } void CPetInventory::itemRemoved(CGameObject *item) { if (item) { CInventoryGlyphAction action(item, ACTION_REMOVED); - _items.change(&action); + _items.doAction(&action); } } diff --git a/engines/titanic/pet_control/pet_inventory_glyphs.cpp b/engines/titanic/pet_control/pet_inventory_glyphs.cpp index b793c1af13..441726ee75 100644 --- a/engines/titanic/pet_control/pet_inventory_glyphs.cpp +++ b/engines/titanic/pet_control/pet_inventory_glyphs.cpp @@ -146,7 +146,15 @@ bool CPetInventoryGlyph::doAction(CGlyphAction *action) { if (_item == invAction->_item && _owner) { int v = populateItem(_item, 0); _background = owner->getBackground(v); + + if (isHighlighted()) { + warning("TODO"); + } } + break; + + default: + break; } return true; @@ -154,7 +162,7 @@ bool CPetInventoryGlyph::doAction(CGlyphAction *action) { /*------------------------------------------------------------------------*/ -bool CPetInventoryGlyphs::change(CInventoryGlyphAction *action) { +bool CPetInventoryGlyphs::doAction(CInventoryGlyphAction *action) { for (iterator i = begin(); i != end(); ++i) { (*i)->doAction(action); } diff --git a/engines/titanic/pet_control/pet_inventory_glyphs.h b/engines/titanic/pet_control/pet_inventory_glyphs.h index 91b1e5ee50..17222a9076 100644 --- a/engines/titanic/pet_control/pet_inventory_glyphs.h +++ b/engines/titanic/pet_control/pet_inventory_glyphs.h @@ -53,6 +53,11 @@ public: */ void setItem(CGameObject *item, int val); + /** + * Returns the object associated with the glyph + */ + virtual CGameObject *getObjectAt() { return _item; } + /** * Does a processing action on the glyph */ @@ -73,9 +78,9 @@ private: CGameObject *getBackground(int index); public: /** - * + * Do an action on the glyphs */ - bool change(CInventoryGlyphAction *item); + bool doAction(CInventoryGlyphAction *item); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp index 028f1def3d..bbb8dafef7 100644 --- a/engines/titanic/pet_control/pet_rooms.cpp +++ b/engines/titanic/pet_control/pet_rooms.cpp @@ -149,8 +149,8 @@ void CPetRooms::postLoad() { } void CPetRooms::save(SimpleFile *file, int indent) const { - _glyphs.save2(file, indent); - _glyphItem.save2(file, indent); + _glyphs.saveGlyphs(file, indent); + _glyphItem.saveGlyph(file, indent); file->writeNumberLine(_floorNum, indent); file->writeNumberLine(_elevatorNum, indent); file->writeNumberLine(_roomNum, indent); diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.cpp b/engines/titanic/pet_control/pet_rooms_glyphs.cpp index b0a486d574..864ae2ee39 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.cpp +++ b/engines/titanic/pet_control/pet_rooms_glyphs.cpp @@ -166,7 +166,7 @@ void CPetRoomsGlyph::getTooltip(CPetText *text) { text->setText(roomStr); } -void CPetRoomsGlyph::save2(SimpleFile *file, int indent) const { +void CPetRoomsGlyph::saveGlyph(SimpleFile *file, int indent) const { file->writeNumberLine(_roomFlags, indent); file->writeNumberLine(_mode, indent); } @@ -227,11 +227,11 @@ void CPetRoomsGlyph::drawObjects(uint flags, const Point &pt, CScreenManager *sc /*------------------------------------------------------------------------*/ -void CPetRoomsGlyphs::save2(SimpleFile *file, int indent) const { +void CPetRoomsGlyphs::saveGlyphs(SimpleFile *file, int indent) const { file->writeNumberLine(size(), indent); for (const_iterator i = begin(); i != end(); ++i) - (*i)->save2(file, indent); + (*i)->saveGlyph(file, indent); } CPetRoomsGlyph *CPetRoomsGlyphs::findAssignedRoom() const { diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.h b/engines/titanic/pet_control/pet_rooms_glyphs.h index 3706fcc01e..f0c2ce0133 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.h +++ b/engines/titanic/pet_control/pet_rooms_glyphs.h @@ -90,7 +90,10 @@ public: */ virtual void getTooltip(CPetText *text); - virtual void save2(SimpleFile *file, int indent) const; + /** + * Saves the data for the glyph + */ + virtual void saveGlyph(SimpleFile *file, int indent) const; virtual bool proc33(CPetGlyph *glyph); @@ -140,7 +143,7 @@ public: /** * Save the list */ - void save2(SimpleFile *file, int indent) const; + void saveGlyphs(SimpleFile *file, int indent) const; /** * Returns the glyph for hte player's assigned room diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 15c4033e8b..d888e051c8 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -167,9 +167,12 @@ public: virtual void displayNPCName(CGameObject *npc) {} virtual void proc33() {} - - virtual void proc34(const CString &name) {} - + + /** + * Sets the NPC to use + */ + virtual void setNPC(const CString &name) {} + virtual void proc35() {} /** -- cgit v1.2.3 From bb567c6e1160615b647c27040743353df9311699 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 25 Jun 2016 08:30:50 -0400 Subject: TITANIC: Adding PET Inventory Glyph methods --- engines/titanic/core/game_object.h | 10 +- engines/titanic/pet_control/pet_glyphs.cpp | 18 +- engines/titanic/pet_control/pet_glyphs.h | 16 +- engines/titanic/pet_control/pet_inventory.cpp | 2 +- engines/titanic/pet_control/pet_inventory.h | 10 +- .../titanic/pet_control/pet_inventory_glyphs.cpp | 181 +++++++++++++++++---- engines/titanic/pet_control/pet_inventory_glyphs.h | 71 +++++++- 7 files changed, 248 insertions(+), 60 deletions(-) diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index afcd2f05ee..7f245cc5fe 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -280,11 +280,6 @@ protected: */ Point getControid() const; - /** - * Set the position of the object - */ - void setPosition(const Point &newPos); - void sound8(bool flag) const; /** @@ -483,6 +478,11 @@ public: */ bool checkPoint(const Point &pt, bool ignore40 = false, bool visibleOnly = false); + /** + * Set the position of the object + */ + void setPosition(const Point &newPos); + /** * Change the object's status */ diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index 2e9b590db1..c132a2f0ab 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -120,24 +120,20 @@ void CPetGlyphs::reset() { } } -bool CPetGlyphs::enter() { +void CPetGlyphs::enter() { if (_highlightIndex != -1) { CPetGlyph *glyph = getGlyph(_highlightIndex); - if (glyph && glyph->enter()) - return true; + if (glyph) + glyph->enter(); } - - return false; } -bool CPetGlyphs::leave() { +void CPetGlyphs::leave() { if (_highlightIndex != -1) { CPetGlyph *glyph = getGlyph(_highlightIndex); - if (glyph && glyph->leave()) - return true; + if (glyph) + glyph->leave(); } - - return false; } void CPetGlyphs::draw(CScreenManager *screenManager) { @@ -419,8 +415,6 @@ bool CPetGlyphs::KeyCharMsg(int key) { } bool CPetGlyphs::VirtualKeyCharMsg(int key) { - bool handled = false; - switch (key) { case Common::KEYCODE_LEFT: decSelection(); diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index 9dfe5ad3fa..e240cd1b86 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -76,12 +76,12 @@ public: /** * Called when the PET area is entered */ - virtual bool enter() { return false; } + virtual void enter() {} /** * Called when the PET area is left */ - virtual bool leave() { return false; } + virtual void leave() {} /** * Draw the glyph at a specified position @@ -151,7 +151,7 @@ public: /** * Glyph has been shifted to be first visible one */ - virtual void glyphFocused(const Point &pt, bool flag) {} + virtual void glyphFocused(const Point &topLeft, bool flag) {} /** * Selects a glyph @@ -180,7 +180,11 @@ public: virtual void saveGlyph(SimpleFile *file, int indent) {} virtual bool proc33(CPetGlyph *glyph) { return true; } - virtual int proc34() { return 1; } + + /** + * Return whether the glyph has an associated image + */ + virtual bool hasImage() const { return true; } /** * Called on a highlighted item when PET area is entered @@ -328,12 +332,12 @@ public: /** * Called when PET area is entered */ - virtual bool enter(); + virtual void enter(); /** * Called when PET area is left */ - virtual bool leave(); + virtual void leave(); void setFlags(int flags) { _flags = flags; } diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index bf6b913d0d..930a93fbcb 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -199,7 +199,7 @@ CGameObject *CPetInventory::getImage(int index) { return nullptr; } -void CPetInventory::setMovie(CGameObject *movie, int flag) { +void CPetInventory::playMovie(CGameObject *movie, int flag) { if (_movie) _movie->stopMovie(); _movie = movie; diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h index 58e6bd9a1d..3437d098ef 100644 --- a/engines/titanic/pet_control/pet_inventory.h +++ b/engines/titanic/pet_control/pet_inventory.h @@ -53,11 +53,6 @@ private: * Get the index of an item added to the PET */ int getItemIndex(CGameObject *item) const; - - /** - * Set the animated inventory item movie - */ - void setMovie(CGameObject *movie, int flag); public: CPetInventory(); @@ -140,6 +135,11 @@ public: void highlightItem(CGameObject *item); CGameObject *getImage(int index); + + /** + * Play the animated movie for an object + */ + void playMovie(CGameObject *movie, int flag); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory_glyphs.cpp b/engines/titanic/pet_control/pet_inventory_glyphs.cpp index 441726ee75..57c8611b9c 100644 --- a/engines/titanic/pet_control/pet_inventory_glyphs.cpp +++ b/engines/titanic/pet_control/pet_inventory_glyphs.cpp @@ -20,9 +20,9 @@ * */ -#include "common/textconsole.h" #include "titanic/pet_control/pet_inventory_glyphs.h" #include "titanic/pet_control/pet_inventory.h" +#include "titanic/messages/pet_messages.h" #include "titanic/titanic.h" namespace Titanic { @@ -34,6 +34,129 @@ const uint ITEM_MODES[40] = { 33, 34, 35, 38, 41, 42, 43, 44, 45, 37 }; +void CPetInventoryGlyph::enter() { + startBackgroundMovie(); +} + +void CPetInventoryGlyph::leave() { + stopMovie(); +} + +void CPetInventoryGlyph::drawAt(CScreenManager *screenManager, const Point &pt, bool isHighlighted) { + if (!_field34) + return; + + if (_image) { + if (_image->hasActiveMovie()) { + if (isHighlighted) + _image->draw(screenManager); + else + _image->draw(screenManager, pt); + return; + } + + _image = nullptr; + if (_background && isHighlighted) { + _background->setPosition(pt); + startBackgroundMovie(); + } + } + + if (_background) { + if (isHighlighted) + _background->draw(screenManager); + else + _background->draw(screenManager, pt); + } else if (_image) { + _image->draw(screenManager, pt, Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)); + } +} + + +void CPetInventoryGlyph::unhighlightCurrent() { + if (_image) { + _image->setPosition(Point(0, 0)); + stopMovie(); + } else if (_background) { + _background->setPosition(Point(0, 0)); + _background->loadFrame(0); + stopMovie(); + } +} + +void CPetInventoryGlyph::highlightCurrent(const Point &pt) { + reposition(pt); + if (_item) { + CPETObjectSelectedMsg selectedMsg; + selectedMsg.execute(_item); + } +} + +void CPetInventoryGlyph::glyphFocused(const Point &topLeft, bool flag) { + if (_background && flag) + _background->setPosition(topLeft); +} + +bool CPetInventoryGlyph::dragGlyph(const Point &topLeft, CMouseDragStartMsg *msg) { + warning("TODO"); + return false; +} + +void CPetInventoryGlyph::getTooltip(CPetText *text) { + if (text) { + text->setText(""); + + if (_field34 && _item) { + int itemIndex = populateItem(_item, 0); + if (itemIndex >= 14 && itemIndex <= 18) { + CPETObjectStateMsg stateMsg(0); + stateMsg.execute(_item); + + text->setText(CString::format("%s %s", + stateMsg._value ? "A hot " : "A cold ", + g_vm->_itemDescriptions[itemIndex].c_str() + )); + + } else { + text->setText(g_vm->_itemDescriptions[itemIndex]); + } + } + } +} + +bool CPetInventoryGlyph::doAction(CGlyphAction *action) { + CInventoryGlyphAction *invAction = static_cast(action); + CPetInventoryGlyphs *owner = static_cast(_owner); + if (!invAction) + return false; + + switch (invAction->getMode()) { + case ACTION_REMOVED: + if (invAction->_item == _item) { + _item = nullptr; + _background = nullptr; + _field34 = 0; + } + break; + + case ACTION_REMOVE: + if (_item == invAction->_item && _owner) { + int v = populateItem(_item, 0); + _background = owner->getBackground(v); + + if (isHighlighted()) { + warning("TODO"); + } + } + break; + + default: + break; + } + + return true; +} + void CPetInventoryGlyph::setItem(CGameObject *item, int val) { _item = item; @@ -127,37 +250,39 @@ int CPetInventoryGlyph::subMode(CGameObject *item, int val) { return frameNum; } -bool CPetInventoryGlyph::doAction(CGlyphAction *action) { - CInventoryGlyphAction *invAction = static_cast(action); - CPetInventoryGlyphs *owner = static_cast(_owner); - if (!invAction) - return false; - - switch (invAction->getMode()) { - case ACTION_REMOVED: - if (invAction->_item == _item) { - _item = nullptr; - _background = nullptr; - _field34 = 0; - } - break; - - case ACTION_REMOVE: - if (_item == invAction->_item && _owner) { - int v = populateItem(_item, 0); - _background = owner->getBackground(v); +void CPetInventoryGlyph::startBackgroundMovie() { + if (_owner) { + CPetInventory *section = static_cast(_owner->getOwner()); + if (section) + section->playMovie(_background, 1); + } +} - if (isHighlighted()) { - warning("TODO"); - } - } - break; +void CPetInventoryGlyph::startForegroundMovie() { + if (_owner) { + CPetInventory *section = static_cast(_owner->getOwner()); + if (section) + section->playMovie(_image, 1); + } +} - default: - break; +void CPetInventoryGlyph::stopMovie() { + if (_owner) { + CPetInventory *section = static_cast(_owner->getOwner()); + if (section) + section->playMovie(nullptr, 1); } +} - return true; +void CPetInventoryGlyph::reposition(const Point &pt) { + if (_image) { + _image->setPosition(pt); + startForegroundMovie(); + } + else if (_background) { + _background->setPosition(pt); + startBackgroundMovie(); + } } /*------------------------------------------------------------------------*/ diff --git a/engines/titanic/pet_control/pet_inventory_glyphs.h b/engines/titanic/pet_control/pet_inventory_glyphs.h index 17222a9076..06e1d06d30 100644 --- a/engines/titanic/pet_control/pet_inventory_glyphs.h +++ b/engines/titanic/pet_control/pet_inventory_glyphs.h @@ -37,21 +37,81 @@ private: int populateItem(CGameObject *item, int val); int subMode(CGameObject *item, int val); + + /** + * Start any movie for the background + */ + void startBackgroundMovie(); + + /** + * Start any movie for the foreground item + */ + void startForegroundMovie(); + + /** + * Stop any previously started foreground or background movie + */ + void stopMovie(); + + /** + * Reposition the inventory item + */ + void reposition(const Point &pt); public: CGameObject *_item; int _field34; CGameObject *_background; CGameObject *_image; public: - CPetInventoryGlyph() : _item(nullptr), _field34(0), + CPetInventoryGlyph() : _item(nullptr), _field34(1), _background(nullptr), _image(nullptr) {} CPetInventoryGlyph(CCarry *item, int val) : _item(item), _field34(val), _background(nullptr), _image(nullptr) {} /** - * Set the inventory item + * Called when the PET area is entered */ - void setItem(CGameObject *item, int val); + virtual void enter(); + + /** + * Called when the PET area is left + */ + virtual void leave(); + + /** + * Draw the glyph at a specified position + */ + virtual void drawAt(CScreenManager *screenManager, const Point &pt, bool isHighlighted); + + /** + * Unhighlight any currently highlighted element + */ + virtual void unhighlightCurrent(); + + /** + * Highlight any currently highlighted element + */ + virtual void highlightCurrent(const Point &pt); + + /** + * Glyph has been shifted to be first visible one + */ + virtual void glyphFocused(const Point &topLeft, bool flag); + + /** + * Called when a glyph drag starts + */ + virtual bool dragGlyph(const Point &topLeft, CMouseDragStartMsg *msg); + + /** + * Returns the tooltip text for when the glyph is selected + */ + virtual void getTooltip(CPetText *text); + + /** + * Return whether the glyph has an associated image + */ + virtual bool hasImage() const { return _item && _background; } /** * Returns the object associated with the glyph @@ -62,6 +122,11 @@ public: * Does a processing action on the glyph */ virtual bool doAction(CGlyphAction *action); + + /** + * Set the inventory item + */ + void setItem(CGameObject *item, int val); }; class CInventoryGlyphAction : public CGlyphAction { -- cgit v1.2.3 From 5fe1f73159d43cd165d20bdc8297eb5eb6d42492 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 25 Jun 2016 09:39:12 -0400 Subject: TITANIC: Added remaining PET Inventory Glyph methods --- engines/titanic/pet_control/pet_control.cpp | 8 ++++ engines/titanic/pet_control/pet_control.h | 2 + .../titanic/pet_control/pet_inventory_glyphs.cpp | 50 +++++++++++++++++++--- 3 files changed, 55 insertions(+), 5 deletions(-) diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 549ba728a8..e2279e5bba 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -521,6 +521,14 @@ CString CPetControl::getFullViewName() { return gameManager ? gameManager->getFullViewName() : CString(); } +bool CPetControl::isSuccUBusActive() const { + if (!_activeNPC) + return false; + + CString name = getName(); + return name.contains("Succubus") || name.contains("Sub"); +} + void CPetControl::convResetDials(int flag) { if (flag == 1) _conversations.resetDials(_activeNPCName); diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index fb5e0093da..5e47f3299b 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -316,6 +316,8 @@ public: void incC0() { ++_fieldC0; } void decC0() { --_fieldC0; } + bool isSuccUBusActive() const; + /*--- CPetConversations methods ---*/ /** diff --git a/engines/titanic/pet_control/pet_inventory_glyphs.cpp b/engines/titanic/pet_control/pet_inventory_glyphs.cpp index 57c8611b9c..8eeccbbd1d 100644 --- a/engines/titanic/pet_control/pet_inventory_glyphs.cpp +++ b/engines/titanic/pet_control/pet_inventory_glyphs.cpp @@ -21,6 +21,7 @@ */ #include "titanic/pet_control/pet_inventory_glyphs.h" +#include "titanic/pet_control/pet_control.h" #include "titanic/pet_control/pet_inventory.h" #include "titanic/messages/pet_messages.h" #include "titanic/titanic.h" @@ -98,8 +99,46 @@ void CPetInventoryGlyph::glyphFocused(const Point &topLeft, bool flag) { } bool CPetInventoryGlyph::dragGlyph(const Point &topLeft, CMouseDragStartMsg *msg) { - warning("TODO"); - return false; + if (!_item) + return false; + + if (_background) { + _field34 = 0; + stopMovie(); + } + + CPetControl *petControl = getPetControl(); + if (!petControl) + return false; + + CGameObject *carryParcel = petControl->getHiddenObject("CarryParcel"); + + if (petControl->isSuccUBusActive() && carryParcel) { + petControl->removeFromInventory(_item, carryParcel, false, true); + petControl->removeFromInventory(_item, false, false); + + carryParcel->setPosition(Point(msg->_mousePos.x - carryParcel->getBounds().width() / 2, + msg->_mousePos.y - carryParcel->getBounds().height() / 2)); + _item->setPosition(Point(SCREEN_WIDTH, SCREEN_HEIGHT)); + } else { + petControl->removeFromInventory(_item, false, true); + + _item->setPosition(Point(msg->_mousePos.x - carryParcel->getBounds().width() / 2, + msg->_mousePos.y - carryParcel->getBounds().height() / 2)); + _item->setVisible(true); + } + + msg->_handled = true; + if (msg->execute(carryParcel)) { + _item = nullptr; + _background = nullptr; + _field34 = 0; + petControl->setC8(1); + return true; + } else { + petControl->addToInventory(carryParcel); + return false; + } } void CPetInventoryGlyph::getTooltip(CPetText *text) { @@ -145,7 +184,9 @@ bool CPetInventoryGlyph::doAction(CGlyphAction *action) { _background = owner->getBackground(v); if (isHighlighted()) { - warning("TODO"); + Point glyphPos = _owner->getHighlightedGlyphPos(); + reposition(glyphPos); + updateTooltip(); } } break; @@ -278,8 +319,7 @@ void CPetInventoryGlyph::reposition(const Point &pt) { if (_image) { _image->setPosition(pt); startForegroundMovie(); - } - else if (_background) { + } else if (_background) { _background->setPosition(pt); startBackgroundMovie(); } -- cgit v1.2.3 From 42c8ac1c880076c181071922aff3b923a185af98 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 25 Jun 2016 16:09:15 -0400 Subject: TITANIC: Added Pet Inventorty virtual methods --- engines/titanic/pet_control/pet_control.cpp | 2 +- engines/titanic/pet_control/pet_glyphs.cpp | 45 +++++++++++++++++---- engines/titanic/pet_control/pet_glyphs.h | 45 +++++++++++++++------ engines/titanic/pet_control/pet_inventory.cpp | 47 ++++++++++++++++++++-- engines/titanic/pet_control/pet_inventory.h | 47 +++++++++++++++++----- engines/titanic/pet_control/pet_inventory_glyphs.h | 4 +- engines/titanic/pet_control/pet_real_life.cpp | 2 +- engines/titanic/pet_control/pet_real_life.h | 2 - engines/titanic/pet_control/pet_remote.cpp | 2 +- engines/titanic/pet_control/pet_rooms.cpp | 2 +- engines/titanic/pet_control/pet_rooms.h | 3 ++ engines/titanic/pet_control/pet_section.h | 8 +++- 12 files changed, 168 insertions(+), 41 deletions(-) diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index e2279e5bba..f5c5647688 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -131,7 +131,7 @@ void CPetControl::draw(CScreenManager *screenManager) { if (!bounds.isEmpty()) { if (_fieldC8 >= 0) { - _inventory.proc5(_fieldC8); + _inventory.changed(_fieldC8); _fieldC8 = -1; } diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index c132a2f0ab..eca6f309ad 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -182,7 +182,7 @@ Point CPetGlyphs::getPosition(int index) const { return tempPoint; } -Rect CPetGlyphs::getRect(int index) { +Rect CPetGlyphs::getRect(int index) const { Point pt = getPosition(index); return Rect(pt.x, pt.y, pt.x + 52, pt.y + 52); } @@ -235,7 +235,7 @@ int CPetGlyphs::getHighlightedIndex(int index) const { return (idx >= 0 && idx < _numVisibleGlyphs) ? idx : -1; } -int CPetGlyphs::getItemIndex(int index) { +int CPetGlyphs::getItemIndex(int index) const { return _firstVisibleIndex + index; } @@ -248,8 +248,8 @@ void CPetGlyphs::setSelectedIndex(int index) { } } -CPetGlyph *CPetGlyphs::getGlyph(int index) { - for (iterator i = begin(); i != end(); ++i) { +CPetGlyph *CPetGlyphs::getGlyph(int index) const { + for (const_iterator i = begin(); i != end(); ++i) { if (index-- == 0) return *i; } @@ -414,7 +414,9 @@ bool CPetGlyphs::KeyCharMsg(int key) { return false; } -bool CPetGlyphs::VirtualKeyCharMsg(int key) { +bool CPetGlyphs::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { + Common::KeyCode key = msg->_keyState.keycode; + switch (key) { case Common::KEYCODE_LEFT: decSelection(); @@ -430,7 +432,7 @@ bool CPetGlyphs::VirtualKeyCharMsg(int key) { if (_highlightIndex >= 0) { CPetGlyph *glyph = getGlyph(_highlightIndex); - if (glyph && glyph->VirtualKeyCharMsg(key)) + if (glyph && glyph->VirtualKeyCharMsg(msg)) return true; } @@ -502,7 +504,7 @@ void CPetGlyphs::decSelection() { } } -CGameObject *CPetGlyphs::getObjectAt(const Point &pt) { +CGameObject *CPetGlyphs::getObjectAt(const Point &pt) const { for (int idx = 0; idx < _numVisibleGlyphs; ++idx) { Rect glyphRect = getRect(idx); if (glyphRect.contains(pt)) { @@ -532,4 +534,33 @@ Point CPetGlyphs::getHighlightedGlyphPos() const { return Point(0, 0); } +bool CPetGlyphs::areItemsValid() const { + for (const_iterator i = begin(); i != end(); ++i) { + if (!(*i)->isValid()) + return false; + } + + return true; +} + +void CPetGlyphs::removeInvalid() { + if (!areItemsValid()) { + changeHighlight(-1); + + for (iterator i = begin(); i != end(); ) { + CPetGlyph *glyph = *i; + + if (!glyph->isValid()) { + i = erase(i); + delete glyph; + } else { + ++i; + } + } + + _firstVisibleIndex = CLIP(_firstVisibleIndex, 0, + (int)size() - _numVisibleGlyphs); + } +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index e240cd1b86..7271d6cd61 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -127,16 +127,21 @@ public: * Handles mouse button up messages */ virtual bool MouseButtonUpMsg(const Point &pt) { return false; } - - virtual int proc21() { return 0; } - virtual int proc22() { return 0; } /** - * Handles keypresses when the glyph is focused + * Handles mouse double-click messages + */ + virtual bool MouseDoubleClickMsg(const CMouseDoubleClickMsg *msg) { return false; } + + /** + * Handles keypresses */ virtual bool KeyCharMsg(int key) { return false; } - virtual bool VirtualKeyCharMsg(int key) { return false; } + /** + * Handles keypresses + */ + virtual bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { return false; } /** * Unhighlight any currently highlighted element @@ -182,9 +187,9 @@ public: virtual bool proc33(CPetGlyph *glyph) { return true; } /** - * Return whether the glyph has an associated image + * Return whether the glyph is currently valid */ - virtual bool hasImage() const { return true; } + virtual bool isValid() const { return true; } /** * Called on a highlighted item when PET area is entered @@ -247,7 +252,7 @@ private: /** * Get a rect for the glyph */ - Rect getRect(int index); + Rect getRect(int index) const; /** * Returns the on-screen index for the highlight to be shown at @@ -257,7 +262,7 @@ private: /** * Returns the index of a glyph given the visible on-screen glyph number */ - int getItemIndex(int index); + int getItemIndex(int index) const; /** * Set the item index @@ -267,7 +272,7 @@ private: /** * Return a specified glyph */ - CPetGlyph *getGlyph(int index); + CPetGlyph *getGlyph(int index) const; /** * Scrolls the glyphs to the left @@ -288,6 +293,11 @@ private: * Make the PET dirty */ void makePetDirty(); + + /** + * Returns true if all the glyphs are in a valid state + */ + bool areItemsValid() const; protected: int _firstVisibleIndex; int _totalGlyphs; @@ -376,6 +386,11 @@ public: */ bool MouseButtonUpMsg(const Point &pt); + /** + * Mouse double click message + */ + bool MouseDoubleClickMsg(const Point &pt) { return true; } + /** * Mouse drag start messagge */ @@ -399,7 +414,7 @@ public: /** * Virtual key message */ - bool VirtualKeyCharMsg(int key); + bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg); /** * When the PET section is entered, passes onto the highlighted @@ -453,7 +468,7 @@ public: /** * Returns the object associated the glyph under the specified position */ - CGameObject *getObjectAt(const Point &pt); + CGameObject *getObjectAt(const Point &pt) const; /** * Returns true if the specified glyph is the currently highlighted one @@ -464,6 +479,12 @@ public: * Get the top-left position of the currently highlighted glyph */ Point getHighlightedGlyphPos() const; + + /** + * Removes any glyphs from the list that no longer have any images + * associated with them + */ + void removeInvalid(); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index 930a93fbcb..a207c6695d 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -41,8 +41,9 @@ bool CPetInventory::setup(CPetControl *petControl) { bool CPetInventory::reset() { _items.reset(); _text.setup(); + _text.setColor(getColor(0)); + _text.setLineColor(0, getColor(0)); - // TODO return true; } @@ -56,9 +57,45 @@ Rect CPetInventory::getBounds() { return _movie ? _movie->getBounds() : Rect(); } +void CPetInventory::changed(int changeType) { + switch (changeType) { + case 0: + case 2: + itemsChanged(); + break; + case 1: + removeInvalid(); + break; + default: + break; + } +} + +bool CPetInventory::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + return _items.MouseButtonDownMsg(msg->_mousePos); +} + +bool CPetInventory::MouseDragStartMsg(CMouseDragStartMsg *msg) { + bool result = _items.MouseDragStartMsg(msg); + if (result) + _petControl->makeDirty(); + return result; +} + +bool CPetInventory::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + return _items.MouseButtonUpMsg(msg->_mousePos); +} + +bool CPetInventory::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { + return _items.MouseDoubleClickMsg(msg->_mousePos); +} + +bool CPetInventory::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { + return _items.VirtualKeyCharMsg(msg); +} + CGameObject *CPetInventory::dragEnd(const Point &pt) const { - warning("TODO: CPetInventory::dragEnd"); - return nullptr; + return _items.getObjectAt(pt); } bool CPetInventory::isValid(CPetControl *petControl) { @@ -212,4 +249,8 @@ void CPetInventory::playMovie(CGameObject *movie, int flag) { } } +void CPetInventory::removeInvalid() { + _items.removeInvalid(); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h index 3437d098ef..e931abf5c6 100644 --- a/engines/titanic/pet_control/pet_inventory.h +++ b/engines/titanic/pet_control/pet_inventory.h @@ -53,6 +53,11 @@ private: * Get the index of an item added to the PET */ int getItemIndex(CGameObject *item) const; + + /** + * Remove any invalid inventory glyphs + */ + void removeInvalid(); public: CPetInventory(); @@ -77,41 +82,63 @@ public: virtual Rect getBounds(); /** - * Save the data for the class to file + * Called when a general change occurs */ - virtual void save(SimpleFile *file, int indent) const; + virtual void changed(int changeType); /** - * Load the data for the class from file + * Following are handlers for the various messages that the PET can + * pass onto the currently active section/area */ - virtual void load(SimpleFile *file, int param); + virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + virtual bool MouseDragStartMsg(CMouseDragStartMsg *msg); + virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); + virtual bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg); + virtual bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg); /** * Returns item a drag-drop operation has dropped on, if any */ virtual CGameObject *dragEnd(const Point &pt) const; - /** * Returns true if the object is in a valid state */ virtual bool isValid(CPetControl *petControl); + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file, int param); + /** * Called after a game has been loaded */ virtual void postLoad(); /** - * Called when a section is switched to + * Save the data for the class to file */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Called when a section is switched to + */ virtual void enter(PetArea oldArea); - + /** - * Called when a section is being left, to switch to another area - */ + * Called when a section is being left, to switch to another area + */ virtual void leave(); - + + /** + * Get a reference to the tooltip text associated with the section + */ + virtual CPetText *getText() { return &_text; } + + /** + * Special retrieval of glyph background image + */ virtual CGameObject *getBackground(int index) const; /** diff --git a/engines/titanic/pet_control/pet_inventory_glyphs.h b/engines/titanic/pet_control/pet_inventory_glyphs.h index 06e1d06d30..716c9d1ad1 100644 --- a/engines/titanic/pet_control/pet_inventory_glyphs.h +++ b/engines/titanic/pet_control/pet_inventory_glyphs.h @@ -109,9 +109,9 @@ public: virtual void getTooltip(CPetText *text); /** - * Return whether the glyph has an associated image + * Return whether the glyph is currently valid */ - virtual bool hasImage() const { return _item && _background; } + virtual bool isValid() const { return _item && _background; } /** * Returns the object associated with the glyph diff --git a/engines/titanic/pet_control/pet_real_life.cpp b/engines/titanic/pet_control/pet_real_life.cpp index 72e350cd33..b9e1990dd2 100644 --- a/engines/titanic/pet_control/pet_real_life.cpp +++ b/engines/titanic/pet_control/pet_real_life.cpp @@ -76,7 +76,7 @@ bool CPetRealLife::KeyCharMsg(CKeyCharMsg *msg) { } bool CPetRealLife::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { - return _glyphs.VirtualKeyCharMsg(msg->_keyState.keycode); + return _glyphs.VirtualKeyCharMsg(msg); } void CPetRealLife::postLoad() { diff --git a/engines/titanic/pet_control/pet_real_life.h b/engines/titanic/pet_control/pet_real_life.h index b00c7c14c3..aa980fca0f 100644 --- a/engines/titanic/pet_control/pet_real_life.h +++ b/engines/titanic/pet_control/pet_real_life.h @@ -69,8 +69,6 @@ public: */ virtual Rect getBounds() { return Rect(); } - virtual void proc5(int val) {} - /** * Following are handlers for the various messages that the PET can * pass onto the currently active section/area diff --git a/engines/titanic/pet_control/pet_remote.cpp b/engines/titanic/pet_control/pet_remote.cpp index f59f1fb0d7..9b43b8dab9 100644 --- a/engines/titanic/pet_control/pet_remote.cpp +++ b/engines/titanic/pet_control/pet_remote.cpp @@ -158,7 +158,7 @@ bool CPetRemote::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { } bool CPetRemote::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { - return _items.VirtualKeyCharMsg(msg->_keyState.keycode); + return _items.VirtualKeyCharMsg(msg); } bool CPetRemote::isValid(CPetControl *petControl) { diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp index bbb8dafef7..467c645e0e 100644 --- a/engines/titanic/pet_control/pet_rooms.cpp +++ b/engines/titanic/pet_control/pet_rooms.cpp @@ -92,7 +92,7 @@ bool CPetRooms::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { } bool CPetRooms::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { - return _glyphs.VirtualKeyCharMsg(msg->_keyState.keycode); + return _glyphs.VirtualKeyCharMsg(msg); } bool CPetRooms::checkDragEnd(CGameObject *item) { diff --git a/engines/titanic/pet_control/pet_rooms.h b/engines/titanic/pet_control/pet_rooms.h index b39587a7f7..14dbf8f26f 100644 --- a/engines/titanic/pet_control/pet_rooms.h +++ b/engines/titanic/pet_control/pet_rooms.h @@ -144,6 +144,9 @@ public: */ virtual CPetText *getText(); + /** + * Special retrieval of glyph background image + */ virtual CGameObject *getBackground(int index); /** diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index d888e051c8..cf729b70a4 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -76,7 +76,10 @@ public: */ virtual Rect getBounds() { return Rect(); } - virtual void proc5(int val) {} + /** + * Called when a general change occurs + */ + virtual void changed(int changeType) {} /** * Following are handlers for the various messages that the PET can @@ -159,6 +162,9 @@ public: */ virtual CPetElement *getElement(uint id) { return nullptr; } + /** + * Special retrieval of glyph background image + */ virtual CGameObject *getBackground(int index) const { return nullptr; } /** -- cgit v1.2.3 From 4ed93ca8f175d7a43c6a0de72ad02b42827938b7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 25 Jun 2016 16:41:31 -0400 Subject: TITANIC: Cleanup of PET section classes methods to match original --- engines/titanic/pet_control/pet_conversations.cpp | 12 -------- engines/titanic/pet_control/pet_conversations.h | 10 ------- engines/titanic/pet_control/pet_glyphs.cpp | 4 +-- engines/titanic/pet_control/pet_rooms.cpp | 5 ---- engines/titanic/pet_control/pet_rooms.h | 2 -- engines/titanic/pet_control/pet_section.cpp | 35 +++++++++++++++++++---- engines/titanic/pet_control/pet_section.h | 32 +++++++++++++++++++-- 7 files changed, 60 insertions(+), 40 deletions(-) diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index 4ec6e8996d..276b99e610 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -506,13 +506,6 @@ void CPetConversations::textLineEntered(const CString &textLine) { scrollToBottom(); } -CString CPetConversations::getActiveNPCName() const { - if (_petControl && _petControl->_activeNPC) - return _petControl->_activeNPC->getName(); - else - return CString(); -} - void CPetConversations::setActiveNPC(const CString &name) { _npcName = name; _field418 = 1; @@ -520,11 +513,6 @@ void CPetConversations::setActiveNPC(const CString &name) { startNPCTimer(); } -void CPetConversations::copyColors(uint tableNum, uint colors[5]) { - const uint *src = getColorTable(tableNum); - Common::copy(src, src + 5, colors); -} - void CPetConversations::updateDial(uint dialNum, const CString &npcName) { TTnpcScript *script = getNPCScript(npcName); uint newLevel = getDialLevel(dialNum, script); diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index 9af1f14ee7..4deab3eb5f 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -124,21 +124,11 @@ private: */ void textLineEntered(const CString &textLine); - /** - * Returns the name of the currently active NPC, if any - */ - CString getActiveNPCName() const; - /** * Set the active NPC */ void setActiveNPC(const CString &name); - /** - * Create a color table - */ - void copyColors(uint tableNum, uint colors[5]); - /** * Updates one of the dials with data from a given NPC */ diff --git a/engines/titanic/pet_control/pet_glyphs.cpp b/engines/titanic/pet_control/pet_glyphs.cpp index eca6f309ad..c36bae6545 100644 --- a/engines/titanic/pet_control/pet_glyphs.cpp +++ b/engines/titanic/pet_control/pet_glyphs.cpp @@ -45,7 +45,7 @@ void CPetGlyph::updateTooltip() { getTooltip(petText); if (_owner) - getPetSection()->proc29(); + getPetSection()->stopTextTimer(); } } @@ -214,7 +214,7 @@ void CPetGlyphs::changeHighlight(int index) { glyph->updateTooltip(); } } else if (_owner) { - _owner->proc28(); + _owner->removeText(); } } diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp index 467c645e0e..fb7cb2bad8 100644 --- a/engines/titanic/pet_control/pet_rooms.cpp +++ b/engines/titanic/pet_control/pet_rooms.cpp @@ -276,11 +276,6 @@ uint CPetRooms::getRoomFlags() const { return roomFlags.get(); } -void CPetRooms::areaChanged(PetArea area) { - if (_petControl && _petControl->_currentArea == area) - _petControl->makeDirty(); -} - void CPetRooms::reassignRoom(int passClassNum) { CPetRoomsGlyph *glyph = _glyphs.findAssignedRoom(); if (glyph) diff --git a/engines/titanic/pet_control/pet_rooms.h b/engines/titanic/pet_control/pet_rooms.h index 14dbf8f26f..64fd0168bc 100644 --- a/engines/titanic/pet_control/pet_rooms.h +++ b/engines/titanic/pet_control/pet_rooms.h @@ -60,8 +60,6 @@ private: */ Point getGlyphPos() const { return Point(509, 388); } - void areaChanged(PetArea area); - /** * Adds a glyph to the list */ diff --git a/engines/titanic/pet_control/pet_section.cpp b/engines/titanic/pet_control/pet_section.cpp index 116fd94ddb..a29a8f8115 100644 --- a/engines/titanic/pet_control/pet_section.cpp +++ b/engines/titanic/pet_control/pet_section.cpp @@ -39,30 +39,36 @@ static const uint PALETTE3[5] = { }; void CPetSection::displayMessage(const CString &msg) { - error("TODO"); + CPetText *text = getText(); + + if (text) { + text->setColor(getColor(1)); + _petControl->makeDirty(); + removeText(5000); + } } void CPetSection::proc25(int val) { if (!val) { - proc28(); + removeText(); _petControl->makeDirty(); } } -void CPetSection::proc27(int duration) { +void CPetSection::removeText(int duration) { if (duration > 0) _petControl->startPetTimer(0, duration, 0, this); else - proc28(); + removeText(); } -void CPetSection::proc28() { +void CPetSection::removeText() { CPetText *text = getText(); if (text) text->setup(); } -void CPetSection::proc29() { +void CPetSection::stopTextTimer() { _petControl->stopPetTimer(0); } @@ -83,4 +89,21 @@ const uint *CPetSection::getColorTable(int tableNum) { } } +void CPetSection::areaChanged(PetArea area) { + if (_petControl && _petControl->_currentArea == area) + _petControl->makeDirty(); +} + +CString CPetSection::getActiveNPCName() const { + if (_petControl && _petControl->_activeNPC) + return _petControl->_activeNPC->getName(); + else + return CString(); +} + +void CPetSection::copyColors(uint tableNum, uint colors[5]) { + const uint *src = getColorTable(tableNum); + Common::copy(src, src + 5, colors); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index cf729b70a4..5ae86b785c 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -52,6 +52,21 @@ struct CPetSectionSubData { class CPetSection { public: CPetControl *_petControl; +protected: + /** + * Called when the current area is changed + */ + void areaChanged(PetArea area); + + /** + * Returns the name of the currently active NPC, if any + */ + CString getActiveNPCName() const; + + /** + * Create a color table + */ + void copyColors(uint tableNum, uint colors[5]); public: CPetSection() : _petControl(nullptr) {} virtual ~CPetSection() {} @@ -153,9 +168,20 @@ public: */ virtual CPetText *getText() { return nullptr; } - virtual void proc27(int duration); - virtual void proc28(); - virtual void proc29(); + /** + * Removes text after a given duration + */ + virtual void removeText(int duration); + + /** + * Removes text after a given duration + */ + virtual void removeText(); + + /** + * Stops the text removal timer + */ + virtual void stopTextTimer(); /** * Get an element from the section by a designated Id -- cgit v1.2.3 From 243a3e6a7dbedf5960a20b7028263310fb5ab27a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 25 Jun 2016 17:16:07 -0400 Subject: TITANIC: Rename CPlaceHolder to CPlaceHolderItem to match original --- engines/titanic/core/saveable_object.cpp | 12 +++--- engines/titanic/core/tree_item.cpp | 5 +++ engines/titanic/core/tree_item.h | 5 +++ .../game/placeholder/bar_shelf_vis_centre.cpp | 4 +- .../game/placeholder/bar_shelf_vis_centre.h | 6 +-- engines/titanic/game/placeholder/lemon_on_bar.cpp | 4 +- engines/titanic/game/placeholder/lemon_on_bar.h | 4 +- engines/titanic/game/placeholder/place_holder.cpp | 37 ----------------- engines/titanic/game/placeholder/place_holder.h | 47 ---------------------- .../titanic/game/placeholder/place_holder_item.cpp | 37 +++++++++++++++++ .../titanic/game/placeholder/place_holder_item.h | 47 ++++++++++++++++++++++ engines/titanic/game/placeholder/tv_on_bar.cpp | 4 +- engines/titanic/game/placeholder/tv_on_bar.h | 4 +- engines/titanic/module.mk | 2 +- 14 files changed, 114 insertions(+), 104 deletions(-) delete mode 100644 engines/titanic/game/placeholder/place_holder.cpp delete mode 100644 engines/titanic/game/placeholder/place_holder.h create mode 100644 engines/titanic/game/placeholder/place_holder_item.cpp create mode 100644 engines/titanic/game/placeholder/place_holder_item.h diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index f6c83b2e74..300d9718bd 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -251,7 +251,7 @@ #include "titanic/game/pickup/pick_up_vis_centre.h" #include "titanic/game/placeholder/bar_shelf_vis_centre.h" #include "titanic/game/placeholder/lemon_on_bar.h" -#include "titanic/game/placeholder/place_holder.h" +#include "titanic/game/placeholder/place_holder_item.h" #include "titanic/game/placeholder/tv_on_bar.h" #include "titanic/game/sgt/armchair.h" #include "titanic/game/sgt/basin.h" @@ -665,7 +665,7 @@ DEFFN(CPickUpSpeechCentre) DEFFN(CPickUpVisCentre) DEFFN(CBarShelfVisCentre) DEFFN(CLemonOnBar) -DEFFN(CPlaceHolder) +DEFFN(CPlaceHolderItem) DEFFN(CTVOnBar) DEFFN(CArmchair) DEFFN(CBasin) @@ -1245,10 +1245,10 @@ void CSaveableObject::initClassList() { ADDFN(CPickUpLemon, CPickUp); ADDFN(CPickUpSpeechCentre, CPickUp); ADDFN(CPickUpVisCentre, CPickUp); - ADDFN(CBarShelfVisCentre, CPlaceHolder); - ADDFN(CLemonOnBar, CPlaceHolder); - ADDFN(CPlaceHolder, CGameObject); - ADDFN(CTVOnBar, CPlaceHolder); + ADDFN(CBarShelfVisCentre, CPlaceHolderItem); + ADDFN(CLemonOnBar, CPlaceHolderItem); + ADDFN(CPlaceHolderItem, CGameObject); + ADDFN(CTVOnBar, CPlaceHolderItem); ADDFN(CArmchair, CSGTStateRoom); ADDFN(CBasin, CSGTStateRoom); ADDFN(CBedfoot, CSGTStateRoom); diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index 9b5097040c..190dc997e7 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -34,6 +34,7 @@ #include "titanic/core/room_item.h" #include "titanic/pet_control/pet_control.h" #include "titanic/game_manager.h" +#include "titanic/game/placeholder/place_holder_item.h" namespace Titanic { @@ -95,6 +96,10 @@ bool CTreeItem::isLinkItem() const { return isInstanceOf(CLinkItem::_type); } +bool CTreeItem::isPlaceHolderItem() const { + return isInstanceOf(CPlaceHolderItem::_type); +} + bool CTreeItem::isNamedItem() const { return isInstanceOf(CNamedItem::_type); } diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index c0d37d14d0..2ea7b4249e 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -98,6 +98,11 @@ public: */ virtual bool isLinkItem() const; + /** + * Returns true if the item is a placeholder item + */ + virtual bool isPlaceHolderItem() const; + /** * Returns true if the item is a named item */ diff --git a/engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp b/engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp index 3d3a05692f..f3eda053f1 100644 --- a/engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp +++ b/engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp @@ -27,13 +27,13 @@ namespace Titanic { void CBarShelfVisCentre::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); - CPlaceHolder::save(file, indent); + CPlaceHolderItem::save(file, indent); } void CBarShelfVisCentre::load(SimpleFile *file) { file->readNumber(); _value = file->readNumber(); - CPlaceHolder::load(file); + CPlaceHolderItem::load(file); } } // End of namespace Titanic diff --git a/engines/titanic/game/placeholder/bar_shelf_vis_centre.h b/engines/titanic/game/placeholder/bar_shelf_vis_centre.h index a2d39c3ea7..a5acff6a47 100644 --- a/engines/titanic/game/placeholder/bar_shelf_vis_centre.h +++ b/engines/titanic/game/placeholder/bar_shelf_vis_centre.h @@ -23,16 +23,16 @@ #ifndef TITANIC_BAR_SHELF_VIS_CENTRE_H #define TITANIC_BAR_SHELF_VIS_CENTRE_H -#include "titanic/game/placeholder/place_holder.h" +#include "titanic/game/placeholder/place_holder_item.h" namespace Titanic { -class CBarShelfVisCentre : public CPlaceHolder { +class CBarShelfVisCentre : public CPlaceHolderItem { private: int _value; public: CLASSDEF - CBarShelfVisCentre() : CPlaceHolder(), _value(0) {} + CBarShelfVisCentre() : CPlaceHolderItem(), _value(0) {} /** * Save the data for the class to file diff --git a/engines/titanic/game/placeholder/lemon_on_bar.cpp b/engines/titanic/game/placeholder/lemon_on_bar.cpp index 336933a8df..d51f4b8758 100644 --- a/engines/titanic/game/placeholder/lemon_on_bar.cpp +++ b/engines/titanic/game/placeholder/lemon_on_bar.cpp @@ -27,13 +27,13 @@ namespace Titanic { void CLemonOnBar::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); file->writePoint(_pos1, indent); - CPlaceHolder::save(file, indent); + CPlaceHolderItem::save(file, indent); } void CLemonOnBar::load(SimpleFile *file) { file->readNumber(); _pos1 = file->readPoint(); - CPlaceHolder::load(file); + CPlaceHolderItem::load(file); } } // End of namespace Titanic diff --git a/engines/titanic/game/placeholder/lemon_on_bar.h b/engines/titanic/game/placeholder/lemon_on_bar.h index 18559b0350..d1654bfeb9 100644 --- a/engines/titanic/game/placeholder/lemon_on_bar.h +++ b/engines/titanic/game/placeholder/lemon_on_bar.h @@ -23,11 +23,11 @@ #ifndef TITANIC_LEMON_ON_BAR_H #define TITANIC_LEMON_ON_BAR_H -#include "titanic/game/placeholder/place_holder.h" +#include "titanic/game/placeholder/place_holder_item.h" namespace Titanic { -class CLemonOnBar : public CPlaceHolder { +class CLemonOnBar : public CPlaceHolderItem { private: Point _pos1; public: diff --git a/engines/titanic/game/placeholder/place_holder.cpp b/engines/titanic/game/placeholder/place_holder.cpp deleted file mode 100644 index d96f551ee4..0000000000 --- a/engines/titanic/game/placeholder/place_holder.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* 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 "titanic/game/placeholder/place_holder.h" - -namespace Titanic { - -void CPlaceHolder::save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - CGameObject::save(file, indent); -} - -void CPlaceHolder::load(SimpleFile *file) { - file->readNumber(); - CGameObject::load(file); -} - -} // End of namespace Titanic diff --git a/engines/titanic/game/placeholder/place_holder.h b/engines/titanic/game/placeholder/place_holder.h deleted file mode 100644 index 4d01cd6c39..0000000000 --- a/engines/titanic/game/placeholder/place_holder.h +++ /dev/null @@ -1,47 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PLACE_HOLDER_H -#define TITANIC_PLACE_HOLDER_H - -#include "titanic/core/game_object.h" - -namespace Titanic { - -class CPlaceHolder : public CGameObject { -public: - CLASSDEF - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PLACE_HOLDER_H */ diff --git a/engines/titanic/game/placeholder/place_holder_item.cpp b/engines/titanic/game/placeholder/place_holder_item.cpp new file mode 100644 index 0000000000..a3c26c8b7f --- /dev/null +++ b/engines/titanic/game/placeholder/place_holder_item.cpp @@ -0,0 +1,37 @@ +/* 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 "titanic/game/placeholder/place_holder_item.h" + +namespace Titanic { + +void CPlaceHolderItem::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CGameObject::save(file, indent); +} + +void CPlaceHolderItem::load(SimpleFile *file) { + file->readNumber(); + CGameObject::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/game/placeholder/place_holder_item.h b/engines/titanic/game/placeholder/place_holder_item.h new file mode 100644 index 0000000000..c665e0f626 --- /dev/null +++ b/engines/titanic/game/placeholder/place_holder_item.h @@ -0,0 +1,47 @@ +/* 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. + * + */ + +#ifndef TITANIC_PLACE_HOLDER_H +#define TITANIC_PLACE_HOLDER_H + +#include "titanic/core/game_object.h" + +namespace Titanic { + +class CPlaceHolderItem : public CGameObject { +public: + CLASSDEF + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PLACE_HOLDER_H */ diff --git a/engines/titanic/game/placeholder/tv_on_bar.cpp b/engines/titanic/game/placeholder/tv_on_bar.cpp index 5b22069a93..3b97658a86 100644 --- a/engines/titanic/game/placeholder/tv_on_bar.cpp +++ b/engines/titanic/game/placeholder/tv_on_bar.cpp @@ -27,13 +27,13 @@ namespace Titanic { void CTVOnBar::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); file->writePoint(_pos1, indent); - CPlaceHolder::save(file, indent); + CPlaceHolderItem::save(file, indent); } void CTVOnBar::load(SimpleFile *file) { file->readNumber(); _pos1 = file->readPoint(); - CPlaceHolder::load(file); + CPlaceHolderItem::load(file); } } // End of namespace Titanic diff --git a/engines/titanic/game/placeholder/tv_on_bar.h b/engines/titanic/game/placeholder/tv_on_bar.h index 3af59deb5b..2cc5494464 100644 --- a/engines/titanic/game/placeholder/tv_on_bar.h +++ b/engines/titanic/game/placeholder/tv_on_bar.h @@ -23,11 +23,11 @@ #ifndef TITANIC_TV_ON_BAR_H #define TITANIC_TV_ON_BAR_H -#include "titanic/game/placeholder/place_holder.h" +#include "titanic/game/placeholder/place_holder_item.h" namespace Titanic { -class CTVOnBar : public CPlaceHolder { +class CTVOnBar : public CPlaceHolderItem { private: Point _pos1; public: diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index b1b35fc3f3..a204c7cc5a 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -245,7 +245,7 @@ MODULE_OBJS := \ game/pickup/pick_up_speech_centre.o \ game/pickup/pick_up_vis_centre.o \ game/placeholder/bar_shelf_vis_centre.o \ - game/placeholder/place_holder.o \ + game/placeholder/place_holder_item.o \ game/placeholder/lemon_on_bar.o \ game/placeholder/tv_on_bar.o \ game/transport/gondolier.o \ -- cgit v1.2.3 From 507924b39d0beb50bacb05f3ad15f66fc113f3a9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 25 Jun 2016 20:17:35 -0400 Subject: TITANIC: Fix initializing PET Remote glyphs --- engines/titanic/pet_control/pet_remote_glyphs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/titanic/pet_control/pet_remote_glyphs.cpp b/engines/titanic/pet_control/pet_remote_glyphs.cpp index e42e0825b0..6b7c8cb4ae 100644 --- a/engines/titanic/pet_control/pet_remote_glyphs.cpp +++ b/engines/titanic/pet_control/pet_remote_glyphs.cpp @@ -39,8 +39,8 @@ void CPetRemoteGlyphs::generateMessage(RemoteMessage msgNum, const CString &name /*------------------------------------------------------------------------*/ void CPetRemoteGlyph::setDefaults(const CString &name, CPetControl *petControl) { - _gfxElement->setBounds(Rect(0, 0, 52, 52)); - _gfxElement->setup(MODE_UNSELECTED, name, petControl); + _element.setBounds(Rect(0, 0, 52, 52)); + _element.setup(MODE_UNSELECTED, name, petControl); } CPetRemoteGlyphs *CPetRemoteGlyph::getOwner() const { -- cgit v1.2.3 From 04afc633794035cfcc0cb7030113d7750a7dbae3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 25 Jun 2016 23:07:44 -0400 Subject: TITANIC: Adding savegame header load/save methods --- engines/titanic/core/project_item.cpp | 128 +++++++++++++++++++++++++++++++- engines/titanic/core/project_item.h | 35 ++++++++- engines/titanic/support/simple_file.cpp | 31 ++++++++ engines/titanic/support/simple_file.h | 33 ++++++++ engines/titanic/titanic.cpp | 23 ++++++ engines/titanic/titanic.h | 36 ++++++--- 6 files changed, 275 insertions(+), 11 deletions(-) diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp index 7546f20936..c6a5c2eb61 100644 --- a/engines/titanic/core/project_item.cpp +++ b/engines/titanic/core/project_item.cpp @@ -22,6 +22,8 @@ #include "common/file.h" #include "common/savefile.h" +#include "graphics/scaler.h" +#include "graphics/thumbnail.h" #include "titanic/game_manager.h" #include "titanic/titanic.h" #include "titanic/core/dont_save_file_item.h" @@ -32,6 +34,13 @@ namespace Titanic { +#define CURRENT_SAVEGAME_VERSION 1 +#define MAX_SAVEGAME_SLOTS 99 +#define MINIMUM_SAVEGAME_VERSION 1 + +static const char *const SAVEGAME_STR = "TNIC"; +#define SAVEGAME_STR_SIZE 4 + void CFileListItem::save(SimpleFile *file, int indent) const { file->writeNumberLine(0, indent); file->writeQuotedLine(_name, indent); @@ -158,6 +167,11 @@ void CProjectItem::loadGame(int slotId) { file.open(newFile); } + // Load the savegame header in + TitanicSavegameHeader header; + readSavegameHeader(&file, header); + delete header._thumbnail; + // Load the contents in CProjectItem *newProject = loadData(&file); file.IsClassStart(); @@ -183,7 +197,7 @@ void CProjectItem::loadGame(int slotId) { postLoad(); } -void CProjectItem::saveGame(int slotId) { +void CProjectItem::saveGame(int slotId, const CString &desc) { CompressedFile file; Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving( Common::String::format("slot%d.gam", slotId)); @@ -192,6 +206,11 @@ void CProjectItem::saveGame(int slotId) { // Signal the game is being saved preSave(); + // Write out the savegame header + TitanicSavegameHeader header; + header._saveName = desc; + writeSavegameHeader(&file, header); + // Save the contents out saveData(&file, this); @@ -411,4 +430,111 @@ CViewItem *CProjectItem::findView(int roomNumber, int nodeNumber, int viewNumber return nullptr; } +SaveStateList CProjectItem::getSavegameList(const Common::String &target) { + Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); + Common::StringArray filenames; + Common::String saveDesc; + Common::String pattern = Common::String::format("%s.0??", target.c_str()); + TitanicSavegameHeader header; + + filenames = saveFileMan->listSavefiles(pattern); + sort(filenames.begin(), filenames.end()); // Sort to get the files in numerical order + + SaveStateList saveList; + for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { + const char *ext = strrchr(file->c_str(), '.'); + int slot = ext ? atoi(ext + 1) : -1; + + if (slot >= 0 && slot < MAX_SAVEGAME_SLOTS) { + Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(*file); + + if (in) { + SimpleFile f; + f.open(in); + if (!readSavegameHeader(&f, header)) + continue; + + saveList.push_back(SaveStateDescriptor(slot, header._saveName)); + + header._thumbnail->free(); + delete header._thumbnail; + delete in; + } + } + } + + return saveList; +} + +bool CProjectItem::readSavegameHeader(SimpleFile *file, TitanicSavegameHeader &header) { + char saveIdentBuffer[SAVEGAME_STR_SIZE + 1]; + header._thumbnail = nullptr; + + // Validate the header Id + file->unsafeRead(saveIdentBuffer, SAVEGAME_STR_SIZE + 1); + if (strncmp(saveIdentBuffer, SAVEGAME_STR, SAVEGAME_STR_SIZE)) { + file->seek(-SAVEGAME_STR_SIZE, SEEK_CUR); + header._saveName = "Unnamed"; + return true; + } + + header._version = file->readByte(); + if (header._version < MINIMUM_SAVEGAME_VERSION || header._version > CURRENT_SAVEGAME_VERSION) + return false; + + // Read in the string + header._saveName.clear(); + char ch; + while ((ch = (char)file->readByte()) != '\0') header._saveName += ch; + + // Get the thumbnail + header._thumbnail = Graphics::loadThumbnail(*file); + if (!header._thumbnail) + return false; + + // Read in save date/time + header._year = file->readUint16LE(); + header._month = file->readUint16LE(); + header._day = file->readUint16LE(); + header._hour = file->readUint16LE(); + header._minute = file->readUint16LE(); + header._totalFrames = file->readUint32LE(); + + return true; +} + +void CProjectItem::writeSavegameHeader(SimpleFile *file, TitanicSavegameHeader &header) { + // Write out a savegame header + file->write(SAVEGAME_STR, SAVEGAME_STR_SIZE + 1); + + file->writeByte(CURRENT_SAVEGAME_VERSION); + + // Write savegame name + file->write(header._saveName.c_str(), header._saveName.size()); + file->writeByte('\0'); + + // Create a thumbnail of the screen and save it out + Graphics::Surface *thumb = createThumbnail(); + Graphics::saveThumbnail(*file, *thumb); + thumb->free(); + delete thumb; + + // Write out the save date/time + TimeDate td; + g_system->getTimeAndDate(td); + file->writeUint16LE(td.tm_year + 1900); + file->writeUint16LE(td.tm_mon + 1); + file->writeUint16LE(td.tm_mday); + file->writeUint16LE(td.tm_hour); + file->writeUint16LE(td.tm_min); + file->writeUint16LE(g_vm->_events->getFrameCounter()); +} + +Graphics::Surface *CProjectItem::createThumbnail() { + Graphics::Surface *thumb = new Graphics::Surface(); + + ::createThumbnailFromScreen(thumb); + return thumb; +} + } // End of namespace Titanic diff --git a/engines/titanic/core/project_item.h b/engines/titanic/core/project_item.h index 0807460852..213fa9d638 100644 --- a/engines/titanic/core/project_item.h +++ b/engines/titanic/core/project_item.h @@ -24,6 +24,9 @@ #define TITANIC_PROJECT_ITEM_H #include "common/scummsys.h" +#include "common/str.h" +#include "engines/savestate.h" +#include "graphics/surface.h" #include "titanic/support/simple_file.h" #include "titanic/core/dont_save_file_item.h" #include "titanic/core/file_item.h" @@ -32,6 +35,16 @@ namespace Titanic { +struct TitanicSavegameHeader { + uint8 _version; + CString _saveName; + Graphics::Surface *_thumbnail; + int _year, _month, _day; + int _hour, _minute; + int _totalFrames; +}; + + class CGameManager; class CPetControl; class CViewItem; @@ -117,6 +130,26 @@ private: * Save project data to the passed file */ void saveData(SimpleFile *file, CTreeItem *item) const; + + /** + * Creates a thumbnail for the current on-screen contents + */ + static Graphics::Surface *createThumbnail(); +public: + /** + * Load a list of savegames + */ + static SaveStateList getSavegameList(const Common::String &target); + + /** + * Write out the header information for a savegame + */ + static void writeSavegameHeader(SimpleFile *file, TitanicSavegameHeader &header); + + /** + * Read in the header information for a savegame + */ + static bool readSavegameHeader(SimpleFile *file, TitanicSavegameHeader &header); public: CLASSDEF CProjectItem(); @@ -159,7 +192,7 @@ public: /** * Save the entire project data to a given savegame slot */ - void saveGame(int slotId); + void saveGame(int slotId, const CString &desc); /** * Clear any currently loaded project diff --git a/engines/titanic/support/simple_file.cpp b/engines/titanic/support/simple_file.cpp index 45b5c8a7cb..e60b7c7485 100644 --- a/engines/titanic/support/simple_file.cpp +++ b/engines/titanic/support/simple_file.cpp @@ -89,12 +89,29 @@ size_t SimpleFile::write(const void *src, size_t count) const { return _outStream->write(src, count); } +void SimpleFile::seek(int offset, int origin) { + assert(_inStream); + _inStream->seek(offset, origin); +} + byte SimpleFile::readByte() { byte b; safeRead(&b, 1); return b; } +uint SimpleFile::readUint16LE() { + uint val; + safeRead(&val, 2); + return READ_LE_UINT16(&val); +} + +uint SimpleFile::readUint32LE() { + uint val; + safeRead(&val, 4); + return READ_LE_UINT32(&val); +} + CString SimpleFile::readString() { char c; CString result; @@ -248,6 +265,20 @@ void SimpleFile::readBuffer(char *buffer, size_t count) { } } +void SimpleFile::writeUint16LE(uint val) { + byte lo = val & 0xff; + byte hi = (val >> 8) & 0xff; + write(&lo, 1); + write(&hi, 1); +} + +void SimpleFile::writeUint32LE(uint val) { + uint16 lo = val & 0xffff; + uint16 hi = (val >> 16) & 0xff; + writeUint16LE(lo); + writeUint16LE(hi); +} + void SimpleFile::writeLine(const CString &str) const { write(str.c_str(), str.size()); write("\r\n", 2); diff --git a/engines/titanic/support/simple_file.h b/engines/titanic/support/simple_file.h index bca96a631a..a83e5922e2 100644 --- a/engines/titanic/support/simple_file.h +++ b/engines/titanic/support/simple_file.h @@ -61,6 +61,9 @@ public: SimpleFile(); virtual ~SimpleFile(); + operator Common::SeekableReadStream &() { return *_inStream; } + operator Common::WriteStream &() { return *_outStream; } + /** * Set up a stream for read access */ @@ -91,11 +94,26 @@ public: */ virtual size_t write(const void *src, size_t count) const; + /** + * Seek + */ + virtual void seek(int offset, int origin); + /** * Read a byte */ byte readByte(); + /** + * Read a 16-bit LE number + */ + uint readUint16LE(); + + /** + * Read a 32-bit LE number + */ + uint readUint32LE(); + /** * Read a string from the file */ @@ -136,6 +154,21 @@ public: */ bool scanf(const char *format, ...); + /** + * Write out a byte + */ + void writeByte(byte b) { write(&b, 1); } + + /** + * Write out a raw 16-bit LE number + */ + void writeUint16LE(uint val); + + /** + * Write out a raw 32-bit LE number + */ + void writeUint32LE(uint val); + /** * Write a string line */ diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index 9d44cd6141..ab734d9eeb 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -157,4 +157,27 @@ void TitanicEngine::setRoomNames() { delete r; } + +bool TitanicEngine::canLoadGameStateCurrently() { + return _window->_inputAllowed; +} + +bool TitanicEngine::canSaveGameStateCurrently() { + return _window->_inputAllowed; +} + +Common::Error TitanicEngine::loadGameState(int slot) { + _window->_project->loadGame(slot); + return Common::kNoError; +} + +Common::Error TitanicEngine::saveGameState(int slot, const Common::String &desc) { + _window->_project->saveGame(slot, desc); + return Common::kNoError; +} + +CString TitanicEngine::generateSaveName(int slot) { + return CString::format("%s.%03d", _targetName.c_str(), slot); +} + } // End of namespace Titanic diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index 4391796e51..9acf78cbf2 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -73,15 +73,6 @@ enum TitanicDebugChannels { struct TitanicGameDescription; class TitanicEngine; -struct TitanicSavegameHeader { - uint8 _version; - Common::String _saveName; - Graphics::Surface *_thumbnail; - int _year, _month, _day; - int _hour, _minute; - int _totalFrames; -}; - class TitanicEngine : public Engine { private: /** @@ -133,6 +124,27 @@ public: TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc); virtual ~TitanicEngine(); + + /** + * Returns true if a savegame can be loaded + */ + virtual bool canLoadGameStateCurrently(); + + /** + * Returns true if the game can be saved + */ + virtual bool canSaveGameStateCurrently(); + + /** + * Called by the GMM to load a savegame + */ + virtual Common::Error loadGameState(int slot); + + /** + * Called by the GMM to save the game + */ + virtual Common::Error saveGameState(int slot, const Common::String &desc); + uint32 getFeatures() const; bool isDemo() const; Common::Language getLanguage() const; @@ -141,6 +153,12 @@ public: * Gets a random number */ uint getRandomNumber(uint max) { return _randomSource.getRandomNumber(max); } + + /** + * Support method that generates a savegame name + * @param slot Slot number + */ + CString generateSaveName(int slot); }; extern TitanicEngine *g_vm; -- cgit v1.2.3 From 0146a3c6b6bdb16eef6f46e116b0d9fe9883858f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 26 Jun 2016 07:23:15 -0400 Subject: TITANIC: Added remaining CPetControl methods --- engines/titanic/carry/carry_parrot.cpp | 2 +- engines/titanic/core/game_object.cpp | 8 +-- engines/titanic/core/game_object.h | 13 +++- engines/titanic/pet_control/pet_control.cpp | 39 +++++------ engines/titanic/pet_control/pet_control.h | 80 ++++++++++++++++------ engines/titanic/pet_control/pet_conversations.cpp | 6 +- engines/titanic/pet_control/pet_conversations.h | 20 ++++-- .../titanic/pet_control/pet_inventory_glyphs.cpp | 2 +- engines/titanic/pet_control/pet_section.cpp | 2 +- engines/titanic/pet_control/pet_section.h | 10 ++- engines/titanic/support/simple_file.h | 1 - 11 files changed, 117 insertions(+), 66 deletions(-) diff --git a/engines/titanic/carry/carry_parrot.cpp b/engines/titanic/carry/carry_parrot.cpp index d164e2ee46..e274679b82 100644 --- a/engines/titanic/carry/carry_parrot.cpp +++ b/engines/titanic/carry/carry_parrot.cpp @@ -222,7 +222,7 @@ bool CCarryParrot::ActMsg(CActMsg *msg) { } getPetControl()->removeFromInventory(this); - getPetControl()->setC8(true); + getPetControl()->setAreaChangeType(1); moveUnder(getRoom()); } diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 7b894380b0..95024b9dae 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -1002,12 +1002,12 @@ int CGameObject::getClipDuration(const CString &name, int frameRate) const { return clip ? (clip->_endFrame - clip->_startFrame) * 1000 / frameRate : 0; } -void CGameObject::petIncC0() { - getPetControl()->incC0(); +void CGameObject::petLockInput() { + getPetControl()->incInputLocks(); } -void CGameObject::petDecC0() { - getPetControl()->decC0(); +void CGameObject::petUnlockInput() { + getPetControl()->decInputLocks(); } void CGameObject::setState1C(bool flag) { diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 7f245cc5fe..7a12abe76c 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -367,9 +367,6 @@ protected: */ int getClipDuration(const CString &name, int frameRate = 14) const; - void petIncC0(); - void petDecC0(); - void setState1C(bool flag); /** @@ -401,6 +398,16 @@ protected: * Resets the Mail Man value */ void resetMail(); + + /** + * Locks the PET, disabling all input. Can be called multiple times + */ + void petLockInput(); + + /** + * Unlocks PET input + */ + void petUnlockInput(); public: bool _isMail; int _id; diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index f5c5647688..7e5cd20441 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -43,9 +43,9 @@ BEGIN_MESSAGE_MAP(CPetControl, CGameObject) END_MESSAGE_MAP() CPetControl::CPetControl() : CGameObject(), - _currentArea(PET_CONVERSATION), _fieldC0(0), _locked(0), _fieldC8(0), - _activeNPC(nullptr), _remoteTarget(nullptr), _hiddenRoom(nullptr), - _drawBounds(20, 350, 620, 480) { + _currentArea(PET_CONVERSATION), _inputLockCount(0), _areaLockCount(0), + _areaChangeType(-1), _activeNPC(nullptr), _remoteTarget(nullptr), + _hiddenRoom(nullptr), _drawBounds(20, 350, 620, 480) { _sections[PET_INVENTORY] = &_inventory; _sections[PET_CONVERSATION] = &_conversations; _sections[PET_REMOTE] = &_remote; @@ -81,7 +81,7 @@ void CPetControl::load(SimpleFile *file) { } void CPetControl::setup() { - warning("TODO: CPetControl::setup"); + _conversations.setup(this); _rooms.setup(this); _remote.setup(this); _inventory.setup(this); @@ -130,9 +130,9 @@ void CPetControl::draw(CScreenManager *screenManager) { bounds.constrain(gameManager->_bounds); if (!bounds.isEmpty()) { - if (_fieldC8 >= 0) { - _inventory.changed(_fieldC8); - _fieldC8 = -1; + if (_areaChangeType >= 0) { + _inventory.changed(_areaChangeType); + _areaChangeType = -1; } _frame.drawFrame(screenManager); @@ -188,13 +188,8 @@ void CPetControl::resetActiveNPC() { _activeNPCName = ""; } -bool CPetControl::fn1(int val) { - warning("TODO: CPetControl::fn1"); - return false; -} - PetArea CPetControl::setArea(PetArea newArea) { - if (newArea == _currentArea || !isUnlocked()) + if (newArea == _currentArea || !isAreaActive()) return _currentArea; // Signal the currently active area that it's being left @@ -249,11 +244,11 @@ bool CPetControl::containsPt(const Common::Point &pt) const { } bool CPetControl::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { - if (!containsPt(msg->_mousePos) || getC0()) + if (!containsPt(msg->_mousePos) || isInputLocked()) return false; bool result = false; - if (isUnlocked()) + if (isAreaActive()) result = _frame.MouseButtonDownMsg(msg); if (!result) { @@ -265,7 +260,7 @@ bool CPetControl::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { } bool CPetControl::MouseDragStartMsg(CMouseDragStartMsg *msg) { - if (!containsPt(msg->_mousePos) || getC0()) + if (!containsPt(msg->_mousePos) || isInputLocked()) return false; return _sections[_currentArea]->MouseDragStartMsg(msg); @@ -280,11 +275,11 @@ bool CPetControl::MouseDragEndMsg(CMouseDragEndMsg *msg) { } bool CPetControl::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { - if (!containsPt(msg->_mousePos) || getC0()) + if (!containsPt(msg->_mousePos) || isInputLocked()) return false; bool result = false; - if (isUnlocked()) + if (isAreaActive()) result = _frame.MouseButtonUpMsg(msg); if (!result) @@ -295,21 +290,21 @@ bool CPetControl::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { } bool CPetControl::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { - if (!containsPt(msg->_mousePos) || getC0()) + if (!containsPt(msg->_mousePos) || isInputLocked()) return false; return _sections[_currentArea]->MouseDoubleClickMsg(msg); } bool CPetControl::KeyCharMsg(CKeyCharMsg *msg) { - if (getC0()) + if (isInputLocked()) return false; return _sections[_currentArea]->KeyCharMsg(msg); } bool CPetControl::VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { - if (getC0()) + if (isInputLocked()) return false; bool result = _sections[_currentArea]->VirtualKeyCharMsg(msg); @@ -498,7 +493,7 @@ void CPetControl::summonNPC(const CString &name, int val) { } } -void CPetControl::startPetTimer(uint timerIndex, uint firstDuration, uint duration, void *target) { +void CPetControl::startPetTimer(uint timerIndex, uint firstDuration, uint duration, CPetSection *target) { stopPetTimer(timerIndex); _timers[timerIndex]._id = addTimer(timerIndex, firstDuration, duration); _timers[timerIndex]._target = target; diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 5e47f3299b..c3afb7862b 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -46,13 +46,13 @@ class CPetControl : public CGameObject { DECLARE_MESSAGE_MAP struct PetEventInfo { int _id; - void *_target; + CPetSection *_target; PetEventInfo() : _id(0), _target(nullptr) {} }; private: - int _fieldC0; - int _locked; - int _fieldC8; + int _inputLockCount; + int _areaLockCount; + int _areaChangeType; CPetSection *_sections[7]; CPetConversations _conversations; CPetInventory _inventory; @@ -162,13 +162,6 @@ public: */ void resetRemoteTarget(); - /** - * Resets the Active NPC - */ - void resetActiveNPC(); - - bool fn1(int val); - /** * Set the remote target */ @@ -194,10 +187,6 @@ public: */ void highlightGlyph(int id); - /** - * Returns true if the PET is currently unlocked - */ - bool isUnlocked() const { return _locked == 0; } /** * Returns a game object used by the PET by name from within the @@ -274,7 +263,11 @@ public: */ void moveToHiddenRoom(CTreeItem *item); - void setC8(int val) { _fieldC8 = val; } + /** + * Sets a change for the PET Area's glyphs. Only applicable when + * the Inventory is the active tab + */ + void setAreaChangeType(int changeType) { _areaChangeType = changeType; } /** * Play a sound @@ -297,9 +290,9 @@ public: void summonNPC(const CString &name, int val); /** - * Start a timer + * Start a timer for a Pet Area */ - void startPetTimer(uint timerIndex, uint firstDuration, uint duration, void *target); + void startPetTimer(uint timerIndex, uint firstDuration, uint duration, CPetSection *target); /** * Stop a timer @@ -312,14 +305,59 @@ public: */ CString getFullViewName(); - bool getC0() const { return _fieldC0 > 0; } - void incC0() { ++_fieldC0; } - void decC0() { --_fieldC0; } + /** + * Returns true if all input is currently locked (disabled) + */ + bool isInputLocked() const { return _inputLockCount > 0; } + + /** + * Increments the input locked count + */ + void incInputLocks() { ++_inputLockCount; } + + /** + * Decremenst the input locked count + */ + void decInputLocks() { --_inputLockCount; } + + /** + * Returns true if the PET is currently unlocked + */ + bool isAreaActive() const { return _areaLockCount == 0; } + + /** + * Increment the number of PET area (tab) locks + */ + void incAreaLocks() { ++_areaLockCount; } + + /** + * Decrement the number of PET area (tab) locks + */ + void decAreaLocks() { + _areaLockCount = MAX(_areaLockCount - 1, 0); + } bool isSuccUBusActive() const; /*--- CPetConversations methods ---*/ + /** + * Sets the active NPC + */ + void setActiveNPC(const CString &name) { + _conversations.setActiveNPC(name); + } + + /** + * Resets the Active NPC + */ + void resetActiveNPC(); + + /** + * Resets the conversation dials back to 0 position + */ + void resetDials0() { _conversations.resetDials0(); } + /** * Resets the dial display in the conversation tab to reflect new values */ diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index 276b99e610..3d239bb36b 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -254,9 +254,9 @@ void CPetConversations::leave() { stopNPCTimer(); } -void CPetConversations::proc25(int val) { +void CPetConversations::timerExpired(int val) { if (val == 1) { - proc25(val); + CPetSection::timerExpired(val); } else { CString name = _field418 ? _npcName : getActiveNPCName(); @@ -315,7 +315,7 @@ void CPetConversations::setNPC(const CString &name) { startNPCTimer(); } -void CPetConversations::proc35() { +void CPetConversations::resetNPC() { stopNPCTimer(); resetDials("0"); } diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index 4deab3eb5f..876f3d78a9 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -124,11 +124,6 @@ private: */ void textLineEntered(const CString &textLine); - /** - * Set the active NPC - */ - void setActiveNPC(const CString &name); - /** * Updates one of the dials with data from a given NPC */ @@ -211,7 +206,10 @@ public: */ virtual void leave(); - virtual void proc25(int val); + /** + * Called when a previously set up PET timer expires + */ + virtual void timerExpired(int val); /** * Display a title for an NPC @@ -223,7 +221,10 @@ public: */ virtual void setNPC(const CString &name); - virtual void proc35(); + /** + * Resets the active NPC + */ + virtual void resetNPC(); /** * Show the text cursor @@ -235,6 +236,11 @@ public: */ virtual void hideCursor(); + /** + * Set the active NPC + */ + void setActiveNPC(const CString &name); + /** * Resets the dials with the data for the currently active NPC */ diff --git a/engines/titanic/pet_control/pet_inventory_glyphs.cpp b/engines/titanic/pet_control/pet_inventory_glyphs.cpp index 8eeccbbd1d..deea8eebca 100644 --- a/engines/titanic/pet_control/pet_inventory_glyphs.cpp +++ b/engines/titanic/pet_control/pet_inventory_glyphs.cpp @@ -133,7 +133,7 @@ bool CPetInventoryGlyph::dragGlyph(const Point &topLeft, CMouseDragStartMsg *msg _item = nullptr; _background = nullptr; _field34 = 0; - petControl->setC8(1); + petControl->setAreaChangeType(1); return true; } else { petControl->addToInventory(carryParcel); diff --git a/engines/titanic/pet_control/pet_section.cpp b/engines/titanic/pet_control/pet_section.cpp index a29a8f8115..50d6c7615c 100644 --- a/engines/titanic/pet_control/pet_section.cpp +++ b/engines/titanic/pet_control/pet_section.cpp @@ -48,7 +48,7 @@ void CPetSection::displayMessage(const CString &msg) { } } -void CPetSection::proc25(int val) { +void CPetSection::timerExpired(int val) { if (!val) { removeText(); _petControl->makeDirty(); diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 5ae86b785c..58938c56c0 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -161,7 +161,10 @@ public: */ virtual void enterRoom(CRoomItem *room) {} - virtual void proc25(int val); + /** + * Called when a previously set up PET timer expires + */ + virtual void timerExpired(int val); /** * Get a reference to the tooltip text associated with the section @@ -205,7 +208,10 @@ public: */ virtual void setNPC(const CString &name) {} - virtual void proc35() {} + /** + * Resets the active NPC + */ + virtual void resetNPC() {} /** * Show the text cursor diff --git a/engines/titanic/support/simple_file.h b/engines/titanic/support/simple_file.h index a83e5922e2..0cfb424fad 100644 --- a/engines/titanic/support/simple_file.h +++ b/engines/titanic/support/simple_file.h @@ -98,7 +98,6 @@ public: * Seek */ virtual void seek(int offset, int origin); - /** * Read a byte */ -- cgit v1.2.3 From 6f063c4703e5705edbba7ad39ef9c0656b74bc75 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 26 Jun 2016 12:39:44 -0400 Subject: TITANIC: Fleshing out CGameObject and CPetControl methods --- engines/titanic/carry/arm.cpp | 10 +- engines/titanic/carry/brain.cpp | 4 +- engines/titanic/carry/bridge_piece.cpp | 4 +- engines/titanic/carry/carry.cpp | 22 +-- engines/titanic/carry/carry.h | 10 -- engines/titanic/carry/carry_parrot.cpp | 4 +- engines/titanic/carry/chicken.cpp | 12 +- engines/titanic/carry/napkin.cpp | 4 +- engines/titanic/core/game_object.cpp | 182 +++++++++++++++------- engines/titanic/core/game_object.h | 159 ++++++++++++------- engines/titanic/debugger.cpp | 2 +- engines/titanic/game/television.cpp | 4 +- engines/titanic/npcs/deskbot.cpp | 16 +- engines/titanic/npcs/true_talk_npc.cpp | 10 +- engines/titanic/npcs/true_talk_npc.h | 10 +- engines/titanic/pet_control/pet_control.cpp | 115 +++++++++++++- engines/titanic/pet_control/pet_control.h | 32 +++- engines/titanic/pet_control/pet_conversations.cpp | 16 +- engines/titanic/pet_control/pet_conversations.h | 4 +- engines/titanic/pet_control/pet_drag_chev.cpp | 2 +- engines/titanic/pet_control/pet_inventory.cpp | 2 +- engines/titanic/pet_control/pet_inventory.h | 2 +- engines/titanic/pet_control/pet_real_life.h | 2 - engines/titanic/room_flags.cpp | 30 ++-- engines/titanic/room_flags.h | 20 +-- 25 files changed, 450 insertions(+), 228 deletions(-) diff --git a/engines/titanic/carry/arm.cpp b/engines/titanic/carry/arm.cpp index d662b43f76..ee58aea445 100644 --- a/engines/titanic/carry/arm.cpp +++ b/engines/titanic/carry/arm.cpp @@ -119,7 +119,7 @@ bool CArm::UseWithOtherMsg(CUseWithOtherMsg *msg) { if (hookedMsg._result) { _string7 = "GondolierLeftLever"; } else { - addToInventory(); + petAddToInventory(); } } else if (msg->_other->getName() == "GondolierRightLever") { CIsHookedOnMsg hookedMsg(_hookedRect, 0, getName()); @@ -129,7 +129,7 @@ bool CArm::UseWithOtherMsg(CUseWithOtherMsg *msg) { if (hookedMsg._result) { _string7 = "GondolierRightLever"; } else { - addToInventory(); + petAddToInventory(); } } @@ -166,13 +166,13 @@ bool CArm::MaitreDHappyMsg(CMaitreDHappyMsg *msg) { CGameObject *child = static_cast(getFirstChild()); if (child) { child->setVisible(true); - addToInventory(); + petAddToInventory(); } _visibleFrame = _field170; loadFrame(_visibleFrame); _string6 = "None"; - invChange(); + petInvChange(); } } @@ -189,7 +189,7 @@ bool CArm::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { _visibleFrame = _field170; loadFrame(_visibleFrame); child->setVisible(true); - child->addToInventory(); + child->petAddToInventory(); } _string6 = "None"; diff --git a/engines/titanic/carry/brain.cpp b/engines/titanic/carry/brain.cpp index acc29b3f0e..a60e652bda 100644 --- a/engines/titanic/carry/brain.cpp +++ b/engines/titanic/carry/brain.cpp @@ -59,13 +59,13 @@ bool CBrain::UseWithOtherMsg(CUseWithOtherMsg *msg) { if (slot) { if (slot->getName() == "CentralCore") { setVisible(false); - moveToHiddenRoom(); + petMoveToHiddenRoom(); CAddHeadPieceMsg headpieceMsg(getName()); headpieceMsg.execute("CentralCoreSlot"); } else if (!slot->_value1 && slot->getName() == "CentralCoreSlot") { setVisible(false); - moveToHiddenRoom(); + petMoveToHiddenRoom(); CAddHeadPieceMsg headpieceMsg(getName()); headpieceMsg.execute(msg->_other); playSound("z#116.wav", 100, 0, 0); diff --git a/engines/titanic/carry/bridge_piece.cpp b/engines/titanic/carry/bridge_piece.cpp index 4fafac26b5..1fe5e048ed 100644 --- a/engines/titanic/carry/bridge_piece.cpp +++ b/engines/titanic/carry/bridge_piece.cpp @@ -56,14 +56,14 @@ bool CBridgePiece::UseWithOtherMsg(CUseWithOtherMsg *msg) { if (!shipSetting) { return CCarry::UseWithOtherMsg(msg); } else if (shipSetting->_string4 == "NULL") { - addToInventory(); + petAddToInventory(); return true; } else { setVisible(false); playSound("z#54.wav", 100, 0, 0); setPosition(shipSetting->_pos1); shipSetting->_string4 = getName(); - moveToHiddenRoom(); + petMoveToHiddenRoom(); CAddHeadPieceMsg headpieceMsg(shipSetting->getName() == _string6 ? "Enable" : "Disable"); diff --git a/engines/titanic/carry/carry.cpp b/engines/titanic/carry/carry.cpp index cb87b94c90..ca022a6c8f 100644 --- a/engines/titanic/carry/carry.cpp +++ b/engines/titanic/carry/carry.cpp @@ -123,7 +123,7 @@ bool CCarry::MouseDragMoveMsg(CMouseDragMoveMsg *msg) { bool CCarry::MouseDragEndMsg(CMouseDragEndMsg *msg) { if (msg->_dropTarget) { if (msg->_dropTarget->isPet()) { - addToInventory(); + petAddToInventory(); return true; } @@ -147,7 +147,7 @@ bool CCarry::MouseDragEndMsg(CMouseDragEndMsg *msg) { CString viewName = getViewFullName(); if (viewName.empty() || msg->_mousePos.y >= 360) { sleep(250); - addToInventory(); + petAddToInventory(); } else { setPosition(_origPos); loadFrame(_itemFrame); @@ -165,7 +165,7 @@ bool CCarry::UseWithCharMsg(CUseWithCharMsg *msg) { } else { CShowTextMsg textMsg(_string4); textMsg.execute("PET"); - addToInventory(); + petAddToInventory(); } return true; @@ -182,7 +182,7 @@ bool CCarry::UseWithOtherMsg(CUseWithOtherMsg *msg) { _fullViewName = getViewFullName(); if (_fullViewName.empty() || _bounds.top >= 360) { sleep(250); - addToInventory(); + petAddToInventory(); } else { setPosition(_origPos); } @@ -238,18 +238,4 @@ bool CCarry::PassOnDragStartMsg(CPassOnDragStartMsg *msg) { return true; } -void CCarry::addToInventory() { - CPetControl *pet = getPetControl(); - if (pet) { - makeDirty(); - pet->addToInventory(this); - } -} - -void CCarry::invChange() { - CPetControl *pet = getPetControl(); - if (pet) - pet->invChange(this); -} - } // End of namespace Titanic diff --git a/engines/titanic/carry/carry.h b/engines/titanic/carry/carry.h index ba782fda7e..f4476721cc 100644 --- a/engines/titanic/carry/carry.h +++ b/engines/titanic/carry/carry.h @@ -61,11 +61,6 @@ protected: int _enterFrame; bool _enterFrameSet; int _visibleFrame; -protected: - /** - * - */ - void invChange(); public: CLASSDEF CCarry(); @@ -79,11 +74,6 @@ public: * Load the data for the class from file */ virtual void load(SimpleFile *file); - - /** - * Add the item to the inventory - */ - void addToInventory(); }; } // End of namespace Titanic diff --git a/engines/titanic/carry/carry_parrot.cpp b/engines/titanic/carry/carry_parrot.cpp index e274679b82..b0916bb4c4 100644 --- a/engines/titanic/carry/carry_parrot.cpp +++ b/engines/titanic/carry/carry_parrot.cpp @@ -105,7 +105,7 @@ bool CCarryParrot::MouseDragEndMsg(CMouseDragEndMsg *msg) { stopMovie(); if (msg->_mousePos.y >= 360) { - addToInventory(); + petAddToInventory(); return true; } @@ -215,7 +215,7 @@ bool CCarryParrot::ActMsg(CActMsg *msg) { CCarry *feathers = static_cast(getRoot()->findByName("Feathers")); if (feathers) { feathers->setVisible(true); - feathers->addToInventory(); + feathers->petAddToInventory(); } _field140 = true; diff --git a/engines/titanic/carry/chicken.cpp b/engines/titanic/carry/chicken.cpp index 8483a3fb29..60627bdb7e 100644 --- a/engines/titanic/carry/chicken.cpp +++ b/engines/titanic/carry/chicken.cpp @@ -72,13 +72,13 @@ bool CChicken::UseWithOtherMsg(CUseWithOtherMsg *msg) { if (_field12C || _string6 == "None") { CActMsg actMsg("Clean"); actMsg.execute(this); - addToInventory(); + petAddToInventory(); } else { CShowTextMsg textMsg("The chicken is already clean."); textMsg.execute("PET"); } - addToInventory(); + petAddToInventory(); } else { CSauceDispensor *dispensor = static_cast(msg->_other); if (!dispensor || _string6 == "None") { @@ -101,7 +101,7 @@ bool CChicken::UseWithCharMsg(CUseWithCharMsg *msg) { acceptMsg._item = this; acceptMsg.execute(succubus); } else { - addToInventory(); + petAddToInventory(); } return true; @@ -110,7 +110,7 @@ bool CChicken::UseWithCharMsg(CUseWithCharMsg *msg) { bool CChicken::ActMsg(CActMsg *msg) { if (msg->_action == "GoToPET") { setVisible(true); - addToInventory(); + petAddToInventory(); } else if (msg->_action == "Tomato") { _string6 = "Tomato"; loadFrame(4); @@ -142,7 +142,7 @@ bool CChicken::ActMsg(CActMsg *msg) { _v1 = 120; } else if (msg->_action == "Eaten") { setVisible(false); - moveToHiddenRoom(); + petMoveToHiddenRoom(); _field13C = 1; } @@ -171,7 +171,7 @@ bool CChicken::TimerMsg(CTimerMsg *msg) { } if (flag) { - invChange(); + petInvChange(); stopTimer(_timerId); } diff --git a/engines/titanic/carry/napkin.cpp b/engines/titanic/carry/napkin.cpp index a8ceaad5ba..cba2b4a560 100644 --- a/engines/titanic/carry/napkin.cpp +++ b/engines/titanic/carry/napkin.cpp @@ -49,11 +49,11 @@ bool CNapkin::UseWithOtherMsg(CUseWithOtherMsg *msg) { CActMsg actMsg("Clean"); actMsg.execute("Chicken"); } else { - petDisplayMsg("The Chicken is already quite clean enough, thank you."); + petDisplayMessage("The Chicken is already quite clean enough, thank you."); } } - addToInventory(); + petAddToInventory(); return CCarry::UseWithOtherMsg(msg); } diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 95024b9dae..a90318961c 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -501,12 +501,6 @@ bool CGameObject::checkStartDragging(CMouseDragStartMsg *msg) { } } -void CGameObject::setPetArea(PetArea newArea) const { - CPetControl *pet = getPetControl(); - if (pet) - pet->setArea(newArea); -} - bool CGameObject::hasActiveMovie() const { if (_surface && _surface->_movie) return _surface->_movie->isActive(); @@ -684,16 +678,6 @@ int CGameObject::compareRoomNameTo(const CString &name) { return room->getName().compareToIgnoreCase(name); } -void CGameObject::petDisplayMsg(const CString &msg) const { - CPetControl *pet = getPetControl(); - if (pet) - pet->displayMessage(msg); -} - -void CGameObject::displayMessage(const CString &msg) const { - petDisplayMsg(msg); -} - CGameObject *CGameObject::getMailManFirstObject() const { CMailMan *mailMan = getMailMan(); return mailMan ? mailMan->getFirstObject() : nullptr; @@ -764,14 +748,6 @@ Found CGameObject::find(const CString &name, CGameObject **item, int findAreas) return FOUND_NONE; } -void CGameObject::moveToHiddenRoom() { - CPetControl *pet = getPetControl(); - if (pet) { - makeDirty(); - pet->moveToHiddenRoom(this); - } -} - void CGameObject::moveToView() { CViewItem *view = getGameManager()->getView(); detach(); @@ -806,24 +782,6 @@ void CGameObject::unlockMouse() { gameMan->unlockInputHandler(); } -void CGameObject::startTalking(const CString &npcName, uint id, CViewItem *view) { - CTrueTalkNPC *npc = static_cast(getRoot()->findByName(npcName)); - startTalking(npc, id, view); -} - -void CGameObject::startTalking(CTrueTalkNPC *npc, uint id, CViewItem *view) { - CGameManager *gameManager = getGameManager(); - if (gameManager) { - CTrueTalkManager *talkManager = gameManager->getTalkManager(); - if (talkManager) - talkManager->start(npc, id, view); - } -} - -void CGameObject::endTalking(CTrueTalkNPC *npc, uint id, CViewItem *view) { - warning("TODO: CGameObject::endTalking"); -} - void CGameObject::loadSurface() { if (!_surface && !_resource.empty()) { loadResource(_resource); @@ -869,6 +827,10 @@ Point CGameObject::getControid() const { _bounds.top + _bounds.height() / 2); } +void CGameObject::performAction(int actionNum, CViewItem *view) { + // TODO +} + bool CGameObject::clipExistsByStart(const CString &name, int startFrame) const { return _clipList1.existsByStart(name, startFrame); } @@ -888,7 +850,7 @@ void CGameObject::checkPlayMovie(const CString &name, int flags) { } } -void CGameObject::clearPet() const { +void CGameObject::petClear() const { CPetControl *petControl = getPetControl(); if (petControl) petControl->resetActiveNPC(); @@ -1002,12 +964,20 @@ int CGameObject::getClipDuration(const CString &name, int frameRate) const { return clip ? (clip->_endFrame - clip->_startFrame) * 1000 / frameRate : 0; } -void CGameObject::petLockInput() { - getPetControl()->incInputLocks(); -} +bool CGameObject::compareRoomFlags(int mode, uint flags1, uint flags2) { + switch (mode) { + case 1: + return CRoomFlags::compareLocation(flags1, flags2); -void CGameObject::petUnlockInput() { - getPetControl()->decInputLocks(); + case 2: + return CRoomFlags::compareClassElevator(flags1, flags2); + + case 3: + return CRoomFlags::isTitania(flags1, flags2); + + default: + return false; + } } void CGameObject::setState1C(bool flag) { @@ -1051,10 +1021,48 @@ void CGameObject::resetMail() { mailMan->resetValue(); } -void CGameObject::petSetRooms1D0(int val) { - CPetControl *petControl = getPetControl(); - if (petControl) - petControl->setRooms1D0(val); +void CGameObject::petAddToCarryParcel(CGameObject *obj) { + CPetControl *pet = getPetControl(); + if (pet) { + CGameObject *parcel = pet->getHiddenObject("CarryParcel"); + if (parcel) + parcel->moveUnder(obj); + } +} + +void CGameObject::petAddToInventory() { + CPetControl *pet = getPetControl(); + if (pet) { + makeDirty(); + pet->addToInventory(this); + } +} + +CTreeItem *CGameObject::petContainerRemove(CGameObject *obj) { + CPetControl *pet = getPetControl(); + if (!obj || !pet) + return nullptr; + if (!obj->compareRoomNameTo("CarryParcel")) + return obj; + + CGameObject *item = static_cast(pet->getLastChild()); + if (item) + item->detach(); + + pet->moveToHiddenRoom(obj); + pet->removeFromInventory(item, false, false); + + return item; +} + +void CGameObject::petDisplayMessage(int unused, const CString &msg) { + petDisplayMessage(msg); +} + +void CGameObject::petDisplayMessage(const CString &msg) { + CPetControl *pet = getPetControl(); + if (pet) + pet->displayMessage(msg); } int CGameObject::petGetRooms1D0() const { @@ -1062,10 +1070,78 @@ int CGameObject::petGetRooms1D0() const { return petControl ? petControl->getRooms1D0() : 0; } -void CGameObject::reassignRoom(int passClassNum) { +void CGameObject::petInvChange() { + CPetControl *pet = getPetControl(); + if (pet) + pet->invChange(this); +} + +void CGameObject::petLockInput() { + getPetControl()->incInputLocks(); +} + +void CGameObject::petMoveToHiddenRoom() { + CPetControl *pet = getPetControl(); + if (pet) { + makeDirty(); + pet->moveToHiddenRoom(this); + } +} + +void CGameObject::petReassignRoom(int passClassNum) { CPetControl *petControl = getPetControl(); if (petControl) petControl->reassignRoom(passClassNum); } +void CGameObject::petSetArea(PetArea newArea) const { + CPetControl *pet = getPetControl(); + if (pet) + pet->setArea(newArea); +} + +void CGameObject::petSetRooms1D0(int val) { + CPetControl *petControl = getPetControl(); + if (petControl) + petControl->setRooms1D0(val); +} + +void CGameObject::petOnSummonBot(const CString &name, int val) { + CPetControl *pet = getPetControl(); + if (pet) + pet->summonBot(name, val); +} + +void CGameObject::petUnlockInput() { + getPetControl()->decInputLocks(); +} + +/*------------------------------------------------------------------------*/ + +void CGameObject::startTalking(const CString &npcName, uint id, CViewItem *view) { + CTrueTalkNPC *npc = static_cast(getRoot()->findByName(npcName)); + startTalking(npc, id, view); +} + +void CGameObject::startTalking(CTrueTalkNPC *npc, uint id, CViewItem *view) { + CGameManager *gameManager = getGameManager(); + if (gameManager) { + CTrueTalkManager *talkManager = gameManager->getTalkManager(); + if (talkManager) + talkManager->start(npc, id, view); + } +} + +void CGameObject::endTalking(CTrueTalkNPC *npc, bool viewFlag, CViewItem *view) { + CPetControl *pet = getPetControl(); + if (pet) + pet->setActiveNPC(npc); + + if (viewFlag) + npc->setView(view); + + if (pet) + pet->refreshNPC(); +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 7a12abe76c..4ca8061d75 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -110,11 +110,6 @@ protected: */ bool checkStartDragging(CMouseDragStartMsg *msg); - /** - * Sets a new area in the PET - */ - void setPetArea(PetArea newArea) const; - /** * Goto a new view */ @@ -126,26 +121,6 @@ protected: */ CViewItem * parseView(const CString &viewString); - /** - * Highlights a glyph in the currently active PET section - */ - void petHighlightGlyph(int id); - - /** - * Hides the text cursor in the current section, if applicable - */ - void petHideCursor(); - - /** - * Shows the text cursor in the current section, if applicable - */ - void petShowCursor(); - - /** - * Set the remote target in the PET to this object - */ - void petSetRemoteTarget(); - void incState38(); void inc54(); void dec54(); @@ -220,11 +195,6 @@ protected: */ int compareRoomNameTo(const CString &name); - /** - * Display a message in the PET - */ - void petDisplayMsg(const CString &msg) const; - /** * Display a message */ @@ -255,21 +225,6 @@ protected: */ void moveToView(); - /** - * Start a conversation with the NPC - */ - void startTalking(const CString &name, uint id, CViewItem *view = nullptr); - - /** - * Start a conversation with the NPC - */ - void startTalking(CTrueTalkNPC *npc, uint id, CViewItem *view = nullptr); - - /** - * Stop a conversation with the NPC - */ - void endTalking(CTrueTalkNPC *npc, uint id, CViewItem *view = nullptr); - /** * Change the view */ @@ -317,7 +272,12 @@ protected: /** * Clear the PET display */ - void clearPet() const; + void petClear() const; + + /** + * Perform an action + */ + void performAction(int actionNum, CViewItem *view = nullptr); /** * Returns the MailMan @@ -463,22 +423,12 @@ public: * Returns true if the item is the PET control */ virtual bool isPet() const; - - /** - * Returns the PET control - */ - CPetControl *getPetControl() const; /** * Play the movie specified in _resource */ void playMovie(uint startFrame, uint endFrame, uint flags); - /** - * Moves the item from it's original position to be under the hidden room - */ - void moveToHiddenRoom(); - /** * Checks the passed point is validly in the object, * with extra checking of object flags status @@ -567,19 +517,108 @@ public: */ void createCredits(); - void petSetRooms1D0(int val); + /** + * Support function for drag moving + */ + void dragMove(const Point &pt); + + bool compareRoomFlags(int mode, uint flags1, uint flags2); + + /*--- CPetControl Methods ---*/ + + /** + * Returns the PET control + */ + CPetControl *getPetControl() const; + + /** + * Moves a specified item to the carry parcel + */ + void petAddToCarryParcel(CGameObject *obj); + + /** + * Add the item to the inventory + */ + void petAddToInventory(); + + CTreeItem *petContainerRemove(CGameObject *obj); + + /** + * Display a message in the PET + */ + void petDisplayMessage(int unused, const CString &msg); + + /** + * Display a message in the PET + */ + void petDisplayMessage(const CString &msg); int petGetRooms1D0() const; + /** + * Hides the text cursor in the current section, if applicable + */ + void petHideCursor(); + + /** + * Highlights a glyph in the currently active PET section + */ + void petHighlightGlyph(int id); + + /** + * Called when the status of an item in the inventory has changed + */ + void petInvChange(); + + /** + * Moves the item from it's original position to be under the hidden room + */ + void petMoveToHiddenRoom(); + /** * Gives the player a new assigned room in the specified passenger class */ - void reassignRoom(int passClassNum); + void petReassignRoom(int passClassNum); /** - * Support function for drag moving + * Sets a new area in the PET */ - void dragMove(const Point &pt); + void petSetArea(PetArea newArea) const; + + /** + * Set the remote target in the PET to this object + */ + void petSetRemoteTarget(); + + void petSetRooms1D0(int val); + + /** + * Shows the text cursor in the current section, if applicable + */ + void petShowCursor(); + + /** + * Summon a bot + */ + void petOnSummonBot(const CString &name, int val); + + /*--- CTrueTalkManager Methods ---*/ + + /** + * Stop a conversation with the NPC + */ + void endTalking(CTrueTalkNPC *npc, bool viewFlag, CViewItem *view = nullptr); + + /** + * Start a conversation with the NPC + */ + void startTalking(CTrueTalkNPC *npc, uint id, CViewItem *view = nullptr); + + /** + * Start a conversation with the NPC + */ + void startTalking(const CString &name, uint id, CViewItem *view = nullptr); + }; } // End of namespace Titanic diff --git a/engines/titanic/debugger.cpp b/engines/titanic/debugger.cpp index e02f1c8f64..37fc546851 100644 --- a/engines/titanic/debugger.cpp +++ b/engines/titanic/debugger.cpp @@ -249,7 +249,7 @@ bool Debugger::cmdItem(int argc, const char **argv) { // Ensure the PET is active and add the item to the inventory gameState._petActive = true; gameManager.initBounds(); - item->addToInventory(); + item->petAddToInventory(); return false; } else { diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp index 4d8e3f2042..57b2b7f453 100644 --- a/engines/titanic/game/television.cpp +++ b/engines/titanic/game/television.cpp @@ -101,7 +101,7 @@ void CTelevision::load(SimpleFile *file) { } bool CTelevision::LeaveViewMsg(CLeaveViewMsg *msg) { - clearPet(); + petClear(); if (_isOn) { if (soundFn1(_soundHandle)) stopSound(_soundHandle, 0); @@ -139,7 +139,7 @@ bool CTelevision::ChangeSeasonMsg(CChangeSeasonMsg *msg) { } bool CTelevision::EnterViewMsg(CEnterViewMsg *msg) { - setPetArea(PET_REMOTE); + petSetArea(PET_REMOTE); petHighlightGlyph(GLYPH_TELEVISION_CONTROL); petSetRemoteTarget(); setVisible(0); diff --git a/engines/titanic/npcs/deskbot.cpp b/engines/titanic/npcs/deskbot.cpp index eb42a8e21d..3fe92367ce 100644 --- a/engines/titanic/npcs/deskbot.cpp +++ b/engines/titanic/npcs/deskbot.cpp @@ -80,7 +80,7 @@ bool CDeskbot::TurnOn(CTurnOn *msg) { setVisible(true); playClip("BellRinging", 4); playSound("b#69.wav"); - setPetArea(PET_CONVERSATION); + petSetArea(PET_CONVERSATION); _npcFlags |= NPCFLAG_20000; _deskbotActive = true; @@ -110,7 +110,7 @@ bool CDeskbot::MovieEndMsg(CMovieEndMsg *msg) { bool flag = false; if (_npcFlags & NPCFLAG_10000) { if (_classNum) { - setPetArea(PET_ROOMS); + petSetArea(PET_ROOMS); dec54(); unlockMouse(); playSound("z#47.wav", 100, 0, 0); @@ -169,25 +169,25 @@ bool CDeskbot::TrueTalkTriggerActionMsg(CTrueTalkTriggerActionMsg *msg) { case 19: inc54(); lockMouse(); - setPetArea(PET_CONVERSATION); + petSetArea(PET_CONVERSATION); playClip("ReprogramPETInHand", 4); _npcFlags |= NPCFLAG_10000; _classNum = msg->_param1; switch (_classNum) { case 1: - petDisplayMsg("You have been upgraded to 1st Class status. Enjoy hugely."); + petDisplayMessage("You have been upgraded to 1st Class status. Enjoy hugely."); setPassengerClass(_classNum); - reassignRoom(_classNum); + petReassignRoom(_classNum); break; case 2: - petDisplayMsg("You have been upgraded to 2nd Class status. Enjoy."); + petDisplayMessage("You have been upgraded to 2nd Class status. Enjoy."); setPassengerClass(_classNum); - reassignRoom(_classNum); + petReassignRoom(_classNum); break; case 3: setPassengerClass(3); - reassignRoom(_classNum); + petReassignRoom(_classNum); break; default: break; diff --git a/engines/titanic/npcs/true_talk_npc.cpp b/engines/titanic/npcs/true_talk_npc.cpp index 32c6412fef..00b68c2913 100644 --- a/engines/titanic/npcs/true_talk_npc.cpp +++ b/engines/titanic/npcs/true_talk_npc.cpp @@ -197,10 +197,6 @@ void CTrueTalkNPC::processInput(CTextInputMsg *msg, CViewItem *view) { talkManager->processInput(this, msg, view); } -void CTrueTalkNPC::performAction(int actionNum, CViewItem *view) { - // TODO -} - int CTrueTalkNPC::startAnimTimer(const CString &action, uint firstDuration, uint duration) { CTimeEventInfo *timer = new CTimeEventInfo(g_vm->_events->getTicksCount(), duration > 0, firstDuration, duration, this, 0, action); @@ -209,4 +205,10 @@ int CTrueTalkNPC::startAnimTimer(const CString &action, uint firstDuration, uint return timer->_id; } +void CTrueTalkNPC::setView(CViewItem *view) { + CTrueTalkManager *talkManager = getGameManager()->getTalkManager(); + if (talkManager) + talkManager->start3(this, view); +} + } // End of namespace Titanic diff --git a/engines/titanic/npcs/true_talk_npc.h b/engines/titanic/npcs/true_talk_npc.h index a1303c3e5d..1a10a0aa9b 100644 --- a/engines/titanic/npcs/true_talk_npc.h +++ b/engines/titanic/npcs/true_talk_npc.h @@ -63,11 +63,6 @@ protected: protected: void processInput(CTextInputMsg *msg, CViewItem *view); - /** - * Perform an action - */ - void performAction(int actionNum, CViewItem *view = nullptr); - /** * Start an animation timer */ @@ -85,6 +80,11 @@ public: * Load the data for the class from file */ virtual void load(SimpleFile *file); + + /** + * Set the view for the NPC + */ + void setView(CViewItem *view); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 7e5cd20441..e526a03b58 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -183,6 +183,21 @@ void CPetControl::resetRemoteTarget() { _remoteTargetName.clear(); } +void CPetControl::setActiveNPC(CTrueTalkNPC *npc) { + if (_activeNPC == npc) { + if (_activeNPC) { + _activeNPCName = npc->getName(); + _conversations.displayNPCName(npc); + } else { + _activeNPCName = ""; + } + } +} + +void CPetControl::refreshNPC() { + _conversations.setNPC(_activeNPCName); +} + void CPetControl::resetActiveNPC() { _activeNPC = nullptr; _activeNPCName = ""; @@ -379,7 +394,7 @@ void CPetControl::addToInventory(CGameObject *item) { if (child) child->detach(); - item->moveToHiddenRoom(); + item->petMoveToHiddenRoom(); if (!child) return; @@ -413,12 +428,12 @@ void CPetControl::removeFromInventory(CGameObject *item, CTreeItem *newParent, } } -void CPetControl::removeFromInventory(CCarry *item, bool refreshUI, bool sendMsg) { +void CPetControl::removeFromInventory(CGameObject *item, bool refreshUI, bool sendMsg) { CViewItem *view = getGameManager()->getView(); removeFromInventory(item, view, refreshUI, sendMsg); } -void CPetControl::invChange(CCarry *item) { +void CPetControl::invChange(CGameObject *item) { _inventory.change(item); } @@ -430,6 +445,66 @@ void CPetControl::moveToHiddenRoom(CTreeItem *item) { } } +bool CPetControl::checkNode(const CString &name) { + CGameManager *gameManager = getGameManager(); + if (!gameManager) + return true; + if (name == "NULL") + return false; + + CViewItem *view = gameManager->getView(); + if (!view) + return true; + + CNodeItem *node = view->findNode(); + if (!node) + return true; + + CString viewName = view->getName(); + CString nodeName = node->getName(); + CRoomItem *room = getGameManager()->getRoom(); + + if (room) { + CString roomName = room->getName(); + CString newNode; + + if (roomName == "1stClassRestaurant") { + } else if (nodeName == "Lobby Node") { + nodeName = "Node 1"; + } else if (nodeName == "Entrance Node") { + nodeName = "Node 2"; + } else if (nodeName == "MaitreD Node") { + nodeName = "Node 3"; + } else if (nodeName == "Scraliontis Table Standing Node") { + nodeName = "Node 4"; + } else if (nodeName == "Pellerator Node") { + nodeName = "Node 5"; + } else if (nodeName == "SUB Node") { + nodeName = "Node 6"; + } else if (nodeName == "Phonograph Node") { + nodeName = "Node 7"; + } else if (nodeName == "Scraliontis Table Seated Node") { + nodeName = "Node 8"; + } + + if (roomName == "MusicRoom") { + if (nodeName == "Musical Instruments") + nodeName = "Node 1"; + if (nodeName == "Phonograph Node") + nodeName = "Node 2"; + } + } + + CString str = CString::format("%s.%s", nodeName.c_str(), viewName.c_str()); + str = str.right(5); + str.toLowercase(); + + CString nameLower = name; + nameLower.toLowercase(); + + return nameLower.contains(str); +} + void CPetControl::playSound(int soundNum) { CTreeItem *player = getHiddenObject("PETSoundPlayer"); if (player) { @@ -443,9 +518,9 @@ CString CPetControl::getRoomName() const { return room ? room->getName() : CString(); } -int CPetControl::canSummonNPC(const CString &name) { +int CPetControl::canSummonBot(const CString &name) { // If player is the very same view as the NPC, then it's already present - if (isNPCInView(name)) + if (isBotInView(name)) return SUMMON_CAN; // Get the room @@ -461,7 +536,7 @@ int CPetControl::canSummonNPC(const CString &name) { return queryMsg.execute(room) ? SUMMON_CAN : SUMMON_CANT; } -bool CPetControl::isNPCInView(const CString &name) const { +bool CPetControl::isBotInView(const CString &name) const { CGameManager *gameManager = getGameManager(); if (!gameManager) return false; @@ -481,7 +556,7 @@ bool CPetControl::isNPCInView(const CString &name) const { return false; } -void CPetControl::summonNPC(const CString &name, int val) { +void CPetControl::summonBot(const CString &name, int val) { CGameManager *gameManager = getGameManager(); if (gameManager) { CRoomItem *room = gameManager->getRoom(); @@ -493,6 +568,20 @@ void CPetControl::summonNPC(const CString &name, int val) { } } +void CPetControl::onSummonBot(const CString &name, int val) { + CGameObject *bot = findObject(name, getHiddenRoom()); + if (!bot) { + bot = findObject(name, getRoot()); + } + + if (bot) { + removeFromInventory(bot, false, false); + + COnSummonBotMsg summonMsg(val); + summonMsg.execute(bot); + } +} + void CPetControl::startPetTimer(uint timerIndex, uint firstDuration, uint duration, CPetSection *target) { stopPetTimer(timerIndex); _timers[timerIndex]._id = addTimer(timerIndex, firstDuration, duration); @@ -511,6 +600,18 @@ void CPetControl::setTimer44(int id, int val) { getGameManager()->setTimer44(id, val); } +CGameObject *CPetControl::findObject(const CString &name, CTreeItem *root) { + for (CTreeItem *item = root; item; item = item->scan(root)) { + if (!item->getName().compareToIgnoreCase(name)) { + CGameObject *obj = static_cast(item); + if (obj) + return obj; + } + } + + return nullptr; +} + CString CPetControl::getFullViewName() { CGameManager *gameManager = getGameManager(); return gameManager ? gameManager->getFullViewName() : CString(); diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index c3afb7862b..6b40c15a6d 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -96,9 +96,14 @@ private: /** * Checks whether a designated NPC in present in the current view */ - bool isNPCInView(const CString &name) const; + bool isBotInView(const CString &name) const; void setTimer44(int id, int val); + + /** + * Find an object under a given root + */ + CGameObject *findObject(const CString &name, CTreeItem *root); protected: bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); bool MouseDragStartMsg(CMouseDragStartMsg *msg); @@ -251,12 +256,12 @@ public: /** * Remove an item from the inventory */ - void removeFromInventory(CCarry *item, bool refreshUI = true, bool sendMsg = true); + void removeFromInventory(CGameObject *item, bool refreshUI = true, bool sendMsg = true); /** * Called when the status of an item in the inventory has changed */ - void invChange(CCarry *item); + void invChange(CGameObject *item); /** * Moves a tree item from it's original position to be under the hidden room @@ -269,6 +274,8 @@ public: */ void setAreaChangeType(int changeType) { _areaChangeType = changeType; } + bool checkNode(const CString &name); + /** * Play a sound */ @@ -282,12 +289,17 @@ public: /** * Check whether an NPC can be summoned */ - int canSummonNPC(const CString &name); + int canSummonBot(const CString &name); /** * Summon an NPC to the player */ - void summonNPC(const CString &name, int val); + void summonBot(const CString &name, int val); + + /** + * Summon a bot to the player + */ + void onSummonBot(const CString &name, int val); /** * Start a timer for a Pet Area @@ -348,6 +360,16 @@ public: _conversations.setActiveNPC(name); } + /** + * Sets the actie NPC + */ + void setActiveNPC(CTrueTalkNPC *npc); + + /** + * Refresh the currently active NPC + */ + void refreshNPC(); + /** * Resets the Active NPC */ diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index 3d239bb36b..f9c051a883 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -162,12 +162,12 @@ bool CPetConversations::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { return true; if (_doorBot.MouseButtonUpMsg(msg->_mousePos)) { - switch (canSummonNPC("DoorBot")) { + switch (canSummonBot("DoorBot")) { case SUMMON_CANT: _log.addLine("Sadly, it is not possible to summon the DoorBot from this location.", getColor(1)); break; case SUMMON_CAN: - summonNPC("DoorBot"); + summonBot("DoorBot"); return true; default: break; @@ -179,12 +179,12 @@ bool CPetConversations::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { } if (_bellBot.MouseButtonUpMsg(msg->_mousePos)) { - switch (canSummonNPC("BellBot")) { + switch (canSummonBot("BellBot")) { case SUMMON_CANT: _log.addLine("Sadly, it is not possible to summon the BellBot from this location.", getColor(1)); break; case SUMMON_CAN: - summonNPC("BellBot"); + summonBot("BellBot"); return true; default: break; @@ -412,16 +412,16 @@ void CPetConversations::scrollToBottom() { _logChanged = true; } -int CPetConversations::canSummonNPC(const CString &name) { - return _petControl ? _petControl->canSummonNPC(name) : SUMMON_CANT; +int CPetConversations::canSummonBot(const CString &name) { + return _petControl ? _petControl->canSummonBot(name) : SUMMON_CANT; } -void CPetConversations::summonNPC(const CString &name) { +void CPetConversations::summonBot(const CString &name) { if (_petControl) { if (_petControl->getPassengerClass() >= 4) { _petControl->displayMessage("Sorry, you must be at least 3rd class before you can summon for help."); } else { - _petControl->summonNPC(name, 0); + _petControl->summonBot(name, 0); } } } diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index 876f3d78a9..51487e1ff4 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -92,12 +92,12 @@ private: /** * Check whether an NPC can be summoned */ - int canSummonNPC(const CString &name); + int canSummonBot(const CString &name); /** * Summon an NPC */ - void summonNPC(const CString &name); + void summonBot(const CString &name); /** * Starts the NPC timer diff --git a/engines/titanic/pet_control/pet_drag_chev.cpp b/engines/titanic/pet_control/pet_drag_chev.cpp index 3143cde0ea..e6c4749123 100644 --- a/engines/titanic/pet_control/pet_drag_chev.cpp +++ b/engines/titanic/pet_control/pet_drag_chev.cpp @@ -63,7 +63,7 @@ bool CPetDragChev::MouseDragEndMsg(CMouseDragEndMsg *msg) { if (petControl && petControl->contains(msg->_mousePos) && msg->_mousePos.x < 528) { if (petControl->checkDragEnd(this)) - moveToHiddenRoom(); + petMoveToHiddenRoom(); } } } diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index a207c6695d..62eee83667 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -158,7 +158,7 @@ bool CPetInventory::setPetControl(CPetControl *petControl) { return true; } -void CPetInventory::change(CCarry *item) { +void CPetInventory::change(CGameObject *item) { if (item) { CInventoryGlyphAction action(item, ACTION_CHANGE); _items.doAction(&action); diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h index e931abf5c6..8a6bcebd9f 100644 --- a/engines/titanic/pet_control/pet_inventory.h +++ b/engines/titanic/pet_control/pet_inventory.h @@ -144,7 +144,7 @@ public: /** * */ - void change(CCarry *item); + void change(CGameObject *item); /** * Called when an item has been removed from the PET diff --git a/engines/titanic/pet_control/pet_real_life.h b/engines/titanic/pet_control/pet_real_life.h index aa980fca0f..d049d47913 100644 --- a/engines/titanic/pet_control/pet_real_life.h +++ b/engines/titanic/pet_control/pet_real_life.h @@ -81,8 +81,6 @@ public: virtual bool KeyCharMsg(CKeyCharMsg *msg); virtual bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg); - virtual int proc14() { return 0; } - /** * Returns item a drag-drop operation has dropped on, if any */ diff --git a/engines/titanic/room_flags.cpp b/engines/titanic/room_flags.cpp index ac378e20c1..4b3aeb424e 100644 --- a/engines/titanic/room_flags.cpp +++ b/engines/titanic/room_flags.cpp @@ -433,14 +433,17 @@ void CRoomFlags::changeLocation(int action) { setRoomBits(roomNum); } -bool CRoomFlags::compareFlags(CRoomFlags flags1, CRoomFlags flags2) const { - if (flags1.getFloorNum() != flags2.getFloorNum()) +bool CRoomFlags::compareClassElevator(uint flags1, uint flags2) { + CRoomFlags f1(flags1); + CRoomFlags f2(flags2); + + if (f1.getFloorNum() != f2.getFloorNum()) return false; - uint elev1 = flags1.getElevatorNum(); - uint elev2 = flags2.getElevatorNum(); - uint class1 = getPassengerClassNum(); - uint class2 = getPassengerClassNum(); + uint elev1 = f1.getElevatorNum(); + uint elev2 = f2.getElevatorNum(); + uint class1 = f1.getPassengerClassNum(); + uint class2 = f2.getPassengerClassNum(); if (class1 > 0 && class1 < 3) { if (elev1 == 2) @@ -458,12 +461,17 @@ bool CRoomFlags::compareFlags(CRoomFlags flags1, CRoomFlags flags2) const { return elev1 == elev2; } -bool CRoomFlags::compareLocation(uint roomFlags) { - CRoomFlags flags(roomFlags); +bool CRoomFlags::compareLocation(uint flags1, uint flags2) { + CRoomFlags f1(flags1); + CRoomFlags f2(flags2); + + return f1.getElevatorNum() == f2.getElevatorBits() && + f1.getFloorNum() == f2.getFloorNum() && + f1.getRoomNum() == f2.getRoomNum(); +} - return getElevatorNum() == flags.getElevatorBits() && - getFloorNum() == flags.getFloorNum() && - getRoomNum() == flags.getRoomNum(); +bool CRoomFlags::isTitania(uint flags1, uint flags2) { + return flags2 == 0x8A397; } void CRoomFlags::setRandomLocation(int classNum, bool flag) { diff --git a/engines/titanic/room_flags.h b/engines/titanic/room_flags.h index dfb7c89d96..f0f90f80d1 100644 --- a/engines/titanic/room_flags.h +++ b/engines/titanic/room_flags.h @@ -58,25 +58,25 @@ private: */ uint decodeFloorBits(uint bits) const; + static bool is2To19(uint v) { return v >= 2 && v <= 19; } + static bool is20To27(uint v) { return v >= 20 && v <= 27; } + static bool is28To38(uint v) { return v >= 28 && v <= 38; } +public: /** - * Compares two room flags together + * Compares the current flags against the specified flags + * for a matching elevator, floor, and room */ - bool compareFlags(CRoomFlags flags1, CRoomFlags flags2) const; + static bool compareLocation(uint flags1, uint flags2); /** - * Compares the current flags against the specified flags - * for a matching elevator, floor, and room + * Compares two room flags together */ - bool compareLocation(uint roomFlags); + static bool compareClassElevator(uint flags1, uint flags2); /** * Returns true if the current flags is for Titania's room */ - bool isTitania() const { return _data == 0x8A397; } - - static bool is2To19(uint v) { return v >= 2 && v <= 19; } - static bool is20To27(uint v) { return v >= 20 && v <= 27; } - static bool is28To38(uint v) { return v >= 28 && v <= 38; } + static bool isTitania(uint flags1, uint flags2); public: CRoomFlags() : _data(0) {} CRoomFlags(uint data) : _data(data) {} -- cgit v1.2.3 From ad873455cf29622e52c15ac48e608d385a744be2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 26 Jun 2016 15:02:55 -0400 Subject: TITANIC: Adding PET Control bot methods --- engines/titanic/core/game_object.cpp | 10 +++++++ engines/titanic/core/game_object.h | 10 +++++++ engines/titanic/pet_control/pet_control.cpp | 46 +++++++++++++++++++++++++++-- engines/titanic/pet_control/pet_control.h | 18 ++++++++--- 4 files changed, 77 insertions(+), 7 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index a90318961c..154d2aeefc 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -1055,6 +1055,16 @@ CTreeItem *CGameObject::petContainerRemove(CGameObject *obj) { return item; } +bool CGameObject::petDismissBot(const CString &name) { + CPetControl *pet = getPetControl(); + return pet ? pet->dismissBot(name) : false; +} + +bool CGameObject::petDoorOrBellbotPresent() const { + CPetControl *pet = getPetControl(); + return pet ? pet->isDoorOrBellbotPresent() : false; +} + void CGameObject::petDisplayMessage(int unused, const CString &msg) { petDisplayMessage(msg); } diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 4ca8061d75..c43d73f73d 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -543,6 +543,16 @@ public: CTreeItem *petContainerRemove(CGameObject *obj); + /** + * Dismiss a bot + */ + bool petDismissBot(const CString &name); + + /** + * Is Doorbot or Bellbot present in the current view + */ + bool petDoorOrBellbotPresent() const; + /** * Display a message in the PET */ diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index e526a03b58..7d35eb31f2 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -569,9 +569,9 @@ void CPetControl::summonBot(const CString &name, int val) { } void CPetControl::onSummonBot(const CString &name, int val) { - CGameObject *bot = findObject(name, getHiddenRoom()); + CGameObject *bot = findBot(name, getHiddenRoom()); if (!bot) { - bot = findObject(name, getRoot()); + bot = findBot(name, getRoot()); } if (bot) { @@ -582,6 +582,46 @@ void CPetControl::onSummonBot(const CString &name, int val) { } } +bool CPetControl::dismissBot(const CString &name) { + CGameManager *gameManager = getGameManager(); + if (!gameManager) + return false; + CViewItem *view = gameManager->getView(); + if (!view) + return false; + + bool result = false; + CDismissBotMsg dismissMsg; + for (CTreeItem *treeItem = view->getFirstChild(); treeItem; + treeItem = treeItem->scan(view)) { + if (!treeItem->getName().compareToIgnoreCase(name)) + dismissMsg.execute(treeItem); + else + result = true; + } + + return result; +} + +bool CPetControl::isDoorOrBellbotPresent() const { + CGameManager *gameManager = getGameManager(); + if (!gameManager) + return false; + CViewItem *view = gameManager->getView(); + if (!view) + return false; + + for (CTreeItem *treeItem = view->getFirstChild(); treeItem; + treeItem = treeItem->scan(view)) { + CString name = treeItem->getName(); + if (static_cast(treeItem) && + (name.contains("Doorbot") || name.contains("BellBot"))) + return true; + } + + return false; +} + void CPetControl::startPetTimer(uint timerIndex, uint firstDuration, uint duration, CPetSection *target) { stopPetTimer(timerIndex); _timers[timerIndex]._id = addTimer(timerIndex, firstDuration, duration); @@ -600,7 +640,7 @@ void CPetControl::setTimer44(int id, int val) { getGameManager()->setTimer44(id, val); } -CGameObject *CPetControl::findObject(const CString &name, CTreeItem *root) { +CGameObject *CPetControl::findBot(const CString &name, CTreeItem *root) { for (CTreeItem *item = root; item; item = item->scan(root)) { if (!item->getName().compareToIgnoreCase(name)) { CGameObject *obj = static_cast(item); diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 6b40c15a6d..07a4ffa680 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -98,12 +98,12 @@ private: */ bool isBotInView(const CString &name) const; - void setTimer44(int id, int val); - /** - * Find an object under a given root + * Find a bot under a given root */ - CGameObject *findObject(const CString &name, CTreeItem *root); + CGameObject *findBot(const CString &name, CTreeItem *root); + + void setTimer44(int id, int val); protected: bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); bool MouseDragStartMsg(CMouseDragStartMsg *msg); @@ -301,6 +301,16 @@ public: */ void onSummonBot(const CString &name, int val); + /** + * Dismiss an NPC + */ + bool dismissBot(const CString &name); + + /** + * Returns true if Doorbot or Bellbot present + */ + bool isDoorOrBellbotPresent() const; + /** * Start a timer for a Pet Area */ -- cgit v1.2.3 From be9a05f8b54e77a04c92aa766233bb8908b50c92 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 26 Jun 2016 17:20:33 -0400 Subject: TITANIC: Added CPetStarfield methods --- engines/titanic/core/game_object.h | 12 +- engines/titanic/module.mk | 2 +- engines/titanic/pet_control/pet_control.cpp | 2 +- engines/titanic/pet_control/pet_control.h | 4 +- engines/titanic/pet_control/pet_frame.cpp | 2 +- engines/titanic/pet_control/pet_nav_helmet.cpp | 182 ------------------ engines/titanic/pet_control/pet_nav_helmet.h | 105 ---------- engines/titanic/pet_control/pet_quit.h | 5 + engines/titanic/pet_control/pet_section.h | 2 +- engines/titanic/pet_control/pet_starfield.cpp | 256 +++++++++++++++++++++++++ engines/titanic/pet_control/pet_starfield.h | 122 ++++++++++++ engines/titanic/star_control/star_control.cpp | 4 + engines/titanic/star_control/star_control.h | 2 + 13 files changed, 402 insertions(+), 298 deletions(-) delete mode 100644 engines/titanic/pet_control/pet_nav_helmet.cpp delete mode 100644 engines/titanic/pet_control/pet_nav_helmet.h create mode 100644 engines/titanic/pet_control/pet_starfield.cpp create mode 100644 engines/titanic/pet_control/pet_starfield.h diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index c43d73f73d..d372b40f88 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -284,11 +284,6 @@ protected: */ CMailMan *getMailMan() const; - /** - * Returns the star control - */ - CStarControl *getStarControl() const; - /** * Returns a child of the Dont Save area of the project of the given class */ @@ -612,6 +607,13 @@ public: */ void petOnSummonBot(const CString &name, int val); + /*--- CStarControl Methods ---*/ + + /** + * Returns the star control + */ + CStarControl *getStarControl() const; + /*--- CTrueTalkManager Methods ---*/ /** diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index a204c7cc5a..881aa025ef 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -364,7 +364,7 @@ MODULE_OBJS := \ pet_control/pet_inventory.o \ pet_control/pet_inventory_glyphs.o \ pet_control/pet_message.o \ - pet_control/pet_nav_helmet.o \ + pet_control/pet_starfield.o \ pet_control/pet_real_life.o \ pet_control/pet_remote.o \ pet_control/pet_remote_glyphs.o \ diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 7d35eb31f2..b6648b9661 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -51,7 +51,7 @@ CPetControl::CPetControl() : CGameObject(), _sections[PET_REMOTE] = &_remote; _sections[PET_ROOMS] = &_rooms; _sections[PET_REAL_LIFE] = &_realLife; - _sections[PET_NAV_HELMET] = &_navHelmet; + _sections[PET_STARFIELD] = &_navHelmet; _sections[PET_MESSAGE] = &_message; } diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 07a4ffa680..d03f1c5efb 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -32,7 +32,7 @@ #include "titanic/pet_control/pet_frame.h" #include "titanic/pet_control/pet_inventory.h" #include "titanic/pet_control/pet_message.h" -#include "titanic/pet_control/pet_nav_helmet.h" +#include "titanic/pet_control/pet_starfield.h" #include "titanic/pet_control/pet_real_life.h" #include "titanic/pet_control/pet_remote.h" #include "titanic/pet_control/pet_rooms.h" @@ -56,7 +56,7 @@ private: CPetSection *_sections[7]; CPetConversations _conversations; CPetInventory _inventory; - CPetNavHelmet _navHelmet; + CPetStarfield _navHelmet; CPetRemote _remote; CPetRooms _rooms; CPetRealLife _realLife; diff --git a/engines/titanic/pet_control/pet_frame.cpp b/engines/titanic/pet_control/pet_frame.cpp index 4c3c518962..bc1a8e93b6 100644 --- a/engines/titanic/pet_control/pet_frame.cpp +++ b/engines/titanic/pet_control/pet_frame.cpp @@ -27,7 +27,7 @@ namespace Titanic { static const PetArea PET_AREAS[6] = { PET_CONVERSATION, PET_INVENTORY, PET_REMOTE, - PET_ROOMS, PET_REAL_LIFE, PET_NAV_HELMET + PET_ROOMS, PET_REAL_LIFE, PET_STARFIELD }; CPetFrame::CPetFrame() : CPetSection() { diff --git a/engines/titanic/pet_control/pet_nav_helmet.cpp b/engines/titanic/pet_control/pet_nav_helmet.cpp deleted file mode 100644 index b995786b97..0000000000 --- a/engines/titanic/pet_control/pet_nav_helmet.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* 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 "titanic/pet_control/pet_nav_helmet.h" -#include "titanic/pet_control/pet_control.h" -#include "titanic/messages/pet_messages.h" - -namespace Titanic { - -CPetNavHelmet::CPetNavHelmet() : - _field98(0), _field9C(0), _fieldA0(0), _field18C(0), - _photoOn(true), _field210(0), _rect1(22, 352, 598, 478) { -} - -bool CPetNavHelmet::setup(CPetControl *petControl) { - if (petControl && setupControl(petControl)) - return reset(); - return false; -} - -bool CPetNavHelmet::reset() { - if (_petControl) { - _val1.setup(MODE_UNSELECTED, "3PetStarField", _petControl); - _val2.setup(MODE_UNSELECTED, "HomePhotoOnOff", _petControl); - _setDestination.setup(MODE_UNSELECTED, "3PetSetDestin", _petControl); - _setDestination.setup(MODE_SELECTED, "3PetSetDestin1", _petControl); - _val4.setup(MODE_UNSELECTED, "3PetStarCtrl", _petControl); - - _leds[0].setup(MODE_UNSELECTED, "LEDOff1", _petControl); - _leds[1].setup(MODE_UNSELECTED, "LEDOn1", _petControl); - _leds[2].setup(MODE_UNSELECTED, "LEDOff2", _petControl); - _leds[3].setup(MODE_UNSELECTED, "LEDOn2", _petControl); - _leds[4].setup(MODE_UNSELECTED, "LEDOff3", _petControl); - _leds[5].setup(MODE_UNSELECTED, "LEDOn3", _petControl); - - uint col = getColor(0); - _text.setColor(col); - _text.setLineColor(0, col); - } - - return true; -} - -void CPetNavHelmet::draw(CScreenManager *screenManager) { - _petControl->drawSquares(screenManager, 2); - - if (_photoOn) { - _val2.draw(screenManager); - } else { - _val4.draw(screenManager); - } - - _setDestination.draw(screenManager); - drawButton(_field98, 0, screenManager); - drawButton(_field9C, 2, screenManager); - drawButton(_fieldA0, 4, screenManager); - _text.draw(screenManager); -} - -bool CPetNavHelmet::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { - if (!_petControl->_remoteTarget) - return false; - - if (_val1.MouseButtonDownMsg(msg->_mousePos)) { - CPETHelmetOnOffMsg helmetMsg; - helmetMsg.execute(_petControl->_remoteTarget); - } else if (_val2.MouseButtonDownMsg(msg->_mousePos)) { - if (_field210) { - _photoOn = !_photoOn; - CPETPhotoOnOffMsg photoMsg; - photoMsg.execute(_petControl->_remoteTarget); - } else { - _petControl->displayMessage("Please supply Galactic reference material."); - } - } else if (_setDestination.MouseButtonDownMsg(msg->_mousePos)) { - warning("TODO: CPetNavHelmet::MouseButtonDownMsg"); - } - - return true; -} - -bool CPetNavHelmet::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { - if (!_petControl->_remoteTarget || !_setDestination.MouseButtonUpMsg(msg->_mousePos)) - return false; - - if (_petControl) { - warning("TODO: CPetNavHelmet::MouseButtonUpMsg"); - } - - return true; -} - -bool CPetNavHelmet::isValid(CPetControl *petControl) { - return setupControl(petControl); -} - -void CPetNavHelmet::load(SimpleFile *file, int param) { - if (!param) { - _photoOn = file->readNumber(); - _field210 = file->readNumber(); - } -} - -void CPetNavHelmet::postLoad() { - reset(); -} - -void CPetNavHelmet::save(SimpleFile *file, int indent) const { - file->writeNumberLine(_photoOn, indent); - file->writeNumberLine(_field210, indent); -} - -bool CPetNavHelmet::setupControl(CPetControl *petControl) { - if (petControl) { - _petControl = petControl; - - Rect r(0, 0, 64, 64); - r.translate(_rect1.left, _rect1.top); - - _val1.setBounds(r); - _val1.translate(15, 23); - _val2.setBounds(r); - _val2.translate(85, 23); - _val4.setBounds(r); - _val4.translate(85, 23); - - r = Rect(0, 0, 34, 34); - r.translate(468, 396); - _leds[0].setBounds(r); - _leds[1].setBounds(r); - - r.translate(36, 0); - _leds[2].setBounds(r); - _leds[3].setBounds(r); - - r.translate(36, 0); - _leds[4].setBounds(r); - _leds[5].setBounds(r); - - r = Rect(0, 0, 157, 51); - r.translate(224, 33); - r.translate(20, 350); - _setDestination.setBounds(r); - - r = Rect(0, 0, 580, 15); - r.translate(32, 445); - _text.setBounds(r); - _text.setHasBorder(false); - } - - return true; -} - -void CPetNavHelmet::drawButton(int offset, int index, CScreenManager *screenManager) { - if (_field18C < 4 && (offset / 3) == 1) - --offset; - if (offset == 2) - offset = 1; - - _leds[index + offset].draw(screenManager); -} - -} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_nav_helmet.h b/engines/titanic/pet_control/pet_nav_helmet.h deleted file mode 100644 index 09504a1b27..0000000000 --- a/engines/titanic/pet_control/pet_nav_helmet.h +++ /dev/null @@ -1,105 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_PET_NAV_HELMET_H -#define TITANIC_PET_NAV_HELMET_H - -#include "titanic/pet_control/pet_section.h" -#include "titanic/pet_control/pet_text.h" -#include "titanic/pet_control/pet_gfx_element.h" - -namespace Titanic { - -class CPetNavHelmet : public CPetSection { -private: - CPetGfxElement _val1; - CPetGfxElement _val2; - CPetGfxElement _setDestination; - CPetGfxElement _val4; - int _field98; - int _field9C; - int _fieldA0; - CPetGfxElement _leds[6]; - Rect _rect1; - int _field18C; - CPetText _text; - bool _photoOn; - int _field210; -private: - /** - * Setup the control - */ - bool setupControl(CPetControl *petControl); - - /** - * Draw a button - */ - void drawButton(int offset, int index, CScreenManager *screenManager); -public: - CPetNavHelmet(); - - /** - * Sets up the section - */ - virtual bool setup(CPetControl *petControl); - - /** - * Reset the section - */ - virtual bool reset(); - - /** - * Draw the section - */ - virtual void draw(CScreenManager *screenManager); - - /** - * Following are handlers for the various messages that the PET can - * pass onto the currently active section/area - */ - virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); - virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); - - /** - * Returns true if the object is in a valid state - */ - virtual bool isValid(CPetControl *petControl); - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file, int param); - - /** - * Called after a game has been loaded - */ - virtual void postLoad(); - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; -}; - -} // End of namespace Titanic - -#endif /* TITANIC_PET_NAV_HELMET_H */ diff --git a/engines/titanic/pet_control/pet_quit.h b/engines/titanic/pet_control/pet_quit.h index 7d22690ff8..87d8aefbbf 100644 --- a/engines/titanic/pet_control/pet_quit.h +++ b/engines/titanic/pet_control/pet_quit.h @@ -63,6 +63,11 @@ public: * Returns the tooltip text for when the glyph is selected */ virtual void getTooltip(CPetText *text); + + /** + * Get a reference to the tooltip text associated with the section + */ + virtual CPetText *getText() { return &_text; } }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 58938c56c0..3673d4dfcc 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -30,7 +30,7 @@ namespace Titanic { enum PetArea { PET_INVENTORY = 0, PET_CONVERSATION = 1, PET_REMOTE = 2, - PET_ROOMS = 3, PET_REAL_LIFE = 4, PET_NAV_HELMET = 5, PET_MESSAGE = 6 + PET_ROOMS = 3, PET_REAL_LIFE = 4, PET_STARFIELD = 5, PET_MESSAGE = 6 }; class CPetControl; diff --git a/engines/titanic/pet_control/pet_starfield.cpp b/engines/titanic/pet_control/pet_starfield.cpp new file mode 100644 index 0000000000..f657d9b4ff --- /dev/null +++ b/engines/titanic/pet_control/pet_starfield.cpp @@ -0,0 +1,256 @@ +/* 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 "titanic/pet_control/pet_starfield.h" +#include "titanic/pet_control/pet_control.h" +#include "titanic/messages/pet_messages.h" +#include "titanic/star_control/star_control.h" + +namespace Titanic { + +CPetStarfield::CPetStarfield() : _field18C(0), _photoOn(true), + _field210(0), _rect1(22, 352, 598, 478) { + _btnOffsets[0] = _btnOffsets[1] = _btnOffsets[2] = 0; +} + +bool CPetStarfield::setup(CPetControl *petControl) { + if (petControl && setupControl(petControl)) + return reset(); + return false; +} + +bool CPetStarfield::reset() { + if (_petControl) { + _val1.setup(MODE_UNSELECTED, "3PetStarField", _petControl); + _val2.setup(MODE_UNSELECTED, "HomePhotoOnOff", _petControl); + _setDestination.setup(MODE_UNSELECTED, "3PetSetDestin", _petControl); + _setDestination.setup(MODE_SELECTED, "3PetSetDestin1", _petControl); + _val4.setup(MODE_UNSELECTED, "3PetStarCtrl", _petControl); + + _leds[0].setup(MODE_UNSELECTED, "LEDOff1", _petControl); + _leds[1].setup(MODE_UNSELECTED, "LEDOn1", _petControl); + _leds[2].setup(MODE_UNSELECTED, "LEDOff2", _petControl); + _leds[3].setup(MODE_UNSELECTED, "LEDOn2", _petControl); + _leds[4].setup(MODE_UNSELECTED, "LEDOff3", _petControl); + _leds[5].setup(MODE_UNSELECTED, "LEDOn3", _petControl); + + uint col = getColor(0); + _text.setColor(col); + _text.setLineColor(0, col); + } + + return true; +} + +void CPetStarfield::draw(CScreenManager *screenManager) { + _petControl->drawSquares(screenManager, 2); + + if (_photoOn) { + _val2.draw(screenManager); + } else { + _val4.draw(screenManager); + } + + _setDestination.draw(screenManager); + drawButton(_btnOffsets[0], 0, screenManager); + drawButton(_btnOffsets[1], 2, screenManager); + drawButton(_btnOffsets[2], 4, screenManager); + _text.draw(screenManager); +} + +bool CPetStarfield::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (!_petControl->_remoteTarget) + return false; + + if (_val1.MouseButtonDownMsg(msg->_mousePos)) { + CPETHelmetOnOffMsg helmetMsg; + helmetMsg.execute(_petControl->_remoteTarget); + } else if (_val2.MouseButtonDownMsg(msg->_mousePos)) { + if (_field210) { + _photoOn = !_photoOn; + CPETPhotoOnOffMsg photoMsg; + photoMsg.execute(_petControl->_remoteTarget); + } else { + _petControl->displayMessage("Please supply Galactic reference material."); + } + } else if (!_setDestination.MouseButtonDownMsg(msg->_mousePos)) { + return elementsMouseDown(msg); + } + + return true; +} + +bool CPetStarfield::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { + if (!_petControl->_remoteTarget || !_setDestination.MouseButtonUpMsg(msg->_mousePos)) + return false; + + if (_petControl) { + CStarControl *starControl = _petControl->getStarControl(); + + if (starControl) { + CPETSetStarDestinationMsg starfieldMsg; + starfieldMsg.execute(_petControl->_remoteTarget); + starControl->fn3(); + } + } + + return true; +} + +bool CPetStarfield::isValid(CPetControl *petControl) { + return setupControl(petControl); +} + +void CPetStarfield::load(SimpleFile *file, int param) { + if (!param) { + _photoOn = file->readNumber(); + _field210 = file->readNumber(); + } +} + +void CPetStarfield::postLoad() { + reset(); +} + +void CPetStarfield::save(SimpleFile *file, int indent) const { + file->writeNumberLine(_photoOn, indent); + file->writeNumberLine(_field210, indent); +} + +bool CPetStarfield::setupControl(CPetControl *petControl) { + if (petControl) { + _petControl = petControl; + + Rect r(0, 0, 64, 64); + r.translate(_rect1.left, _rect1.top); + + _val1.setBounds(r); + _val1.translate(15, 23); + _val2.setBounds(r); + _val2.translate(85, 23); + _val4.setBounds(r); + _val4.translate(85, 23); + + r = Rect(0, 0, 34, 34); + r.translate(468, 396); + _leds[0].setBounds(r); + _leds[1].setBounds(r); + + r.translate(36, 0); + _leds[2].setBounds(r); + _leds[3].setBounds(r); + + r.translate(36, 0); + _leds[4].setBounds(r); + _leds[5].setBounds(r); + + r = Rect(0, 0, 157, 51); + r.translate(224, 33); + r.translate(20, 350); + _setDestination.setBounds(r); + + r = Rect(0, 0, 580, 15); + r.translate(32, 445); + _text.setBounds(r); + _text.setHasBorder(false); + } + + return true; +} + +void CPetStarfield::drawButton(int offset, int index, CScreenManager *screenManager) { + if (_field18C < 4 && (offset / 3) == 1) + --offset; + if (offset == 2) + offset = 1; + + _leds[index + offset].draw(screenManager); +} + +void CPetStarfield::setButtons(int val1, int val2) { + _btnOffsets[0] = 0; + _btnOffsets[1] = 0; + _btnOffsets[2] = 0; + + if (val1 >= 0) + _btnOffsets[0] = 2; + if (val1 >= 1) + _btnOffsets[1] = 2; + if (val1 >= 2) + _btnOffsets[2] = 2; + + if (val2) { + if (val1 == -1) + _btnOffsets[0] = 1; + if (val1 == 0) + _btnOffsets[1] = 1; + if (val1 == 1) + _btnOffsets[2] = 1; + } + + _field18C = (_field18C + 1) % 8; +} + +void CPetStarfield::makePetDirty() { + _petControl->makeDirty(); +} + +bool CPetStarfield::elementsMouseDown(CMouseButtonDownMsg *msg) { + if (elementMouseButton(0, msg, _leds[0].getBounds())) + return true; + if (elementMouseButton(1, msg, _leds[2].getBounds())) + return true; + if (elementMouseButton(2, msg, _leds[4].getBounds())) + return true; + + return false; +} + +bool CPetStarfield::elementMouseButton(int index, CMouseButtonDownMsg *msg, const Rect &rect) { + if (!rect.contains(msg->_mousePos)) + return false; + + switch (_btnOffsets[index]) { + case 1: + if (_petControl->_remoteTarget) { + CPETStarFieldLockMsg lockMsg(1); + lockMsg.execute(_petControl->_remoteTarget); + } + break; + + case 2: + if (index < 2 && _btnOffsets[index] >= 2) { + if (_petControl->_remoteTarget) { + CPETStarFieldLockMsg lockMsg(1); + lockMsg.execute(_petControl->_remoteTarget); + } + } + break; + + default: + break; + } + + return true; +} + +} // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_starfield.h b/engines/titanic/pet_control/pet_starfield.h new file mode 100644 index 0000000000..30766b3d82 --- /dev/null +++ b/engines/titanic/pet_control/pet_starfield.h @@ -0,0 +1,122 @@ +/* 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. + * + */ + +#ifndef TITANIC_PET_STARFIELD_H +#define TITANIC_PET_STARFIELD_H + +#include "titanic/pet_control/pet_section.h" +#include "titanic/pet_control/pet_text.h" +#include "titanic/pet_control/pet_gfx_element.h" + +namespace Titanic { + +class CPetStarfield : public CPetSection { +private: + CPetGfxElement _val1; + CPetGfxElement _val2; + CPetGfxElement _setDestination; + CPetGfxElement _val4; + int _btnOffsets[3]; + CPetGfxElement _leds[6]; + Rect _rect1; + int _field18C; + CPetText _text; + bool _photoOn; + int _field210; +private: + /** + * Setup the control + */ + bool setupControl(CPetControl *petControl); + + /** + * Draw a button + */ + void drawButton(int offset, int index, CScreenManager *screenManager); + + void set210(int val) { _field210 = val; } + + /** + * Sets the offsets for each of the buttons + */ + void setButtons(int val1, int val2); + + /** + * Make the PET as dirty, requiring a redraw + */ + void makePetDirty(); + + /** + * Mouse down handling for Nav elements + */ + bool elementsMouseDown(CMouseButtonDownMsg *msg); + + bool elementMouseButton(int index, CMouseButtonDownMsg *msg, const Rect &rect); +public: + CPetStarfield(); + + /** + * Sets up the section + */ + virtual bool setup(CPetControl *petControl); + + /** + * Reset the section + */ + virtual bool reset(); + + /** + * Draw the section + */ + virtual void draw(CScreenManager *screenManager); + + /** + * Following are handlers for the various messages that the PET can + * pass onto the currently active section/area + */ + virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); + + /** + * Returns true if the object is in a valid state + */ + virtual bool isValid(CPetControl *petControl); + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file, int param); + + /** + * Called after a game has been loaded + */ + virtual void postLoad(); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; +}; + +} // End of namespace Titanic + +#endif /* TITANIC_PET_STARFIELD_H */ diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp index 446579855a..3f84a947f3 100644 --- a/engines/titanic/star_control/star_control.cpp +++ b/engines/titanic/star_control/star_control.cpp @@ -53,4 +53,8 @@ void CStarControl::load(SimpleFile *file) { CGameObject::load(file); } +void CStarControl::fn3() { + warning("CStarControl::fn3"); +} + } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control.h b/engines/titanic/star_control/star_control.h index 9462cee559..3e53db11bf 100644 --- a/engines/titanic/star_control/star_control.h +++ b/engines/titanic/star_control/star_control.h @@ -52,6 +52,8 @@ public: * Load the data for the class from file */ virtual void load(SimpleFile *file); + + void fn3(); }; } // End of namespace Titanic -- cgit v1.2.3 From b6f476c70f90dd451e7e931fe91ce7c86b922b20 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 26 Jun 2016 17:52:42 -0400 Subject: TITANIC: Cleanup and renamings for PET Starfield controller --- engines/titanic/pet_control/pet_control.cpp | 12 ++++----- engines/titanic/pet_control/pet_control.h | 2 +- engines/titanic/pet_control/pet_starfield.cpp | 39 ++++++++++++++------------- engines/titanic/pet_control/pet_starfield.h | 8 +++--- 4 files changed, 31 insertions(+), 30 deletions(-) diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index b6648b9661..793436521c 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -51,7 +51,7 @@ CPetControl::CPetControl() : CGameObject(), _sections[PET_REMOTE] = &_remote; _sections[PET_ROOMS] = &_rooms; _sections[PET_REAL_LIFE] = &_realLife; - _sections[PET_STARFIELD] = &_navHelmet; + _sections[PET_STARFIELD] = &_starfield; _sections[PET_MESSAGE] = &_message; } @@ -85,7 +85,7 @@ void CPetControl::setup() { _rooms.setup(this); _remote.setup(this); _inventory.setup(this); - _navHelmet.setup(this); + _starfield.setup(this); _realLife.setup(this); _message.setup(this); _frame.setup(this); @@ -96,7 +96,7 @@ bool CPetControl::isValid() { _rooms.isValid(this) && _remote.isValid(this) && _inventory.isValid(this) && - _navHelmet.isValid(this) && + _starfield.isValid(this) && _realLife.isValid(this) && _message.isValid(this) && _frame.isValid(this); @@ -107,7 +107,7 @@ void CPetControl::loadAreas(SimpleFile *file, int param) { _rooms.load(file, param); _remote.load(file, param); _inventory.load(file, param); - _navHelmet.load(file, param); + _starfield.load(file, param); _realLife.load(file, param); _message.load(file, param); _frame.load(file, param); @@ -118,7 +118,7 @@ void CPetControl::saveAreas(SimpleFile *file, int indent) const { _rooms.save(file, indent); _remote.save(file, indent); _inventory.save(file, indent); - _navHelmet.save(file, indent); + _starfield.save(file, indent); _realLife.save(file, indent); _message.save(file, indent); _frame.save(file, indent); @@ -163,7 +163,7 @@ void CPetControl::loaded() { _rooms.postLoad(); _remote.postLoad(); _inventory.postLoad(); - _navHelmet.postLoad(); + _starfield.postLoad(); _realLife.postLoad(); _message.postLoad(); _frame.postLoad(); diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index d03f1c5efb..e389a0e31a 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -56,7 +56,7 @@ private: CPetSection *_sections[7]; CPetConversations _conversations; CPetInventory _inventory; - CPetStarfield _navHelmet; + CPetStarfield _starfield; CPetRemote _remote; CPetRooms _rooms; CPetRealLife _realLife; diff --git a/engines/titanic/pet_control/pet_starfield.cpp b/engines/titanic/pet_control/pet_starfield.cpp index f657d9b4ff..4230d9454f 100644 --- a/engines/titanic/pet_control/pet_starfield.cpp +++ b/engines/titanic/pet_control/pet_starfield.cpp @@ -40,11 +40,11 @@ bool CPetStarfield::setup(CPetControl *petControl) { bool CPetStarfield::reset() { if (_petControl) { - _val1.setup(MODE_UNSELECTED, "3PetStarField", _petControl); - _val2.setup(MODE_UNSELECTED, "HomePhotoOnOff", _petControl); - _setDestination.setup(MODE_UNSELECTED, "3PetSetDestin", _petControl); - _setDestination.setup(MODE_SELECTED, "3PetSetDestin1", _petControl); - _val4.setup(MODE_UNSELECTED, "3PetStarCtrl", _petControl); + _imgStarfield.setup(MODE_UNSELECTED, "3PetStarField", _petControl); + _imgPhoto.setup(MODE_UNSELECTED, "HomePhotoOnOff", _petControl); + _btnSetDest.setup(MODE_UNSELECTED, "3PetSetDestin", _petControl); + _btnSetDest.setup(MODE_SELECTED, "3PetSetDestin1", _petControl); + _imgStarCtrl.setup(MODE_UNSELECTED, "3PetStarCtrl", _petControl); _leds[0].setup(MODE_UNSELECTED, "LEDOff1", _petControl); _leds[1].setup(MODE_UNSELECTED, "LEDOn1", _petControl); @@ -64,13 +64,14 @@ bool CPetStarfield::reset() { void CPetStarfield::draw(CScreenManager *screenManager) { _petControl->drawSquares(screenManager, 2); + _imgStarfield.draw(screenManager); if (_photoOn) { - _val2.draw(screenManager); + _imgPhoto.draw(screenManager); } else { - _val4.draw(screenManager); + _imgStarCtrl.draw(screenManager); } - _setDestination.draw(screenManager); + _btnSetDest.draw(screenManager); drawButton(_btnOffsets[0], 0, screenManager); drawButton(_btnOffsets[1], 2, screenManager); drawButton(_btnOffsets[2], 4, screenManager); @@ -81,10 +82,10 @@ bool CPetStarfield::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { if (!_petControl->_remoteTarget) return false; - if (_val1.MouseButtonDownMsg(msg->_mousePos)) { + if (_imgStarfield.MouseButtonDownMsg(msg->_mousePos)) { CPETHelmetOnOffMsg helmetMsg; helmetMsg.execute(_petControl->_remoteTarget); - } else if (_val2.MouseButtonDownMsg(msg->_mousePos)) { + } else if (_imgPhoto.MouseButtonDownMsg(msg->_mousePos)) { if (_field210) { _photoOn = !_photoOn; CPETPhotoOnOffMsg photoMsg; @@ -92,7 +93,7 @@ bool CPetStarfield::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { } else { _petControl->displayMessage("Please supply Galactic reference material."); } - } else if (!_setDestination.MouseButtonDownMsg(msg->_mousePos)) { + } else if (!_btnSetDest.MouseButtonDownMsg(msg->_mousePos)) { return elementsMouseDown(msg); } @@ -100,7 +101,7 @@ bool CPetStarfield::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { } bool CPetStarfield::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { - if (!_petControl->_remoteTarget || !_setDestination.MouseButtonUpMsg(msg->_mousePos)) + if (!_petControl->_remoteTarget || !_btnSetDest.MouseButtonUpMsg(msg->_mousePos)) return false; if (_petControl) { @@ -143,12 +144,12 @@ bool CPetStarfield::setupControl(CPetControl *petControl) { Rect r(0, 0, 64, 64); r.translate(_rect1.left, _rect1.top); - _val1.setBounds(r); - _val1.translate(15, 23); - _val2.setBounds(r); - _val2.translate(85, 23); - _val4.setBounds(r); - _val4.translate(85, 23); + _imgStarfield.setBounds(r); + _imgStarfield.translate(15, 23); + _imgPhoto.setBounds(r); + _imgPhoto.translate(85, 23); + _imgStarCtrl.setBounds(r); + _imgStarCtrl.translate(85, 23); r = Rect(0, 0, 34, 34); r.translate(468, 396); @@ -166,7 +167,7 @@ bool CPetStarfield::setupControl(CPetControl *petControl) { r = Rect(0, 0, 157, 51); r.translate(224, 33); r.translate(20, 350); - _setDestination.setBounds(r); + _btnSetDest.setBounds(r); r = Rect(0, 0, 580, 15); r.translate(32, 445); diff --git a/engines/titanic/pet_control/pet_starfield.h b/engines/titanic/pet_control/pet_starfield.h index 30766b3d82..6cfc308d24 100644 --- a/engines/titanic/pet_control/pet_starfield.h +++ b/engines/titanic/pet_control/pet_starfield.h @@ -31,10 +31,10 @@ namespace Titanic { class CPetStarfield : public CPetSection { private: - CPetGfxElement _val1; - CPetGfxElement _val2; - CPetGfxElement _setDestination; - CPetGfxElement _val4; + CPetGfxElement _imgStarfield; + CPetGfxElement _imgPhoto; + CPetGfxElement _imgStarCtrl; + CPetGfxElement _btnSetDest; int _btnOffsets[3]; CPetGfxElement _leds[6]; Rect _rect1; -- cgit v1.2.3 From ef1d10e926fcf31ffeb5c594a305ec0cd8bf7064 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 26 Jun 2016 23:00:00 -0400 Subject: TITANIC: Implemented remaining CGameManager methods and others --- engines/titanic/core/game_object.cpp | 50 ++++++++++++++++++------- engines/titanic/core/game_object.h | 30 ++++++++++----- engines/titanic/core/mail_man.cpp | 6 +-- engines/titanic/core/room_item.cpp | 9 +++++ engines/titanic/core/room_item.h | 4 ++ engines/titanic/game_manager.cpp | 53 +++++++++++++++++++++++---- engines/titanic/game_manager.h | 13 +++++-- engines/titanic/pet_control/pet_control.cpp | 12 +++++- engines/titanic/pet_control/pet_control.h | 24 ++++++++++++ engines/titanic/pet_control/pet_starfield.cpp | 8 ++-- engines/titanic/pet_control/pet_starfield.h | 29 ++++++++------- engines/titanic/support/movie.cpp | 4 +- engines/titanic/support/movie.h | 12 +++++- 13 files changed, 193 insertions(+), 61 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 154d2aeefc..0bf54647f5 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -63,7 +63,7 @@ CGameObject::CGameObject(): CNamedItem() { _field4C = 0xFF; _isMail = false; _id = 0; - _field58 = 0; + _roomFlags = 0; _visible = true; _field60 = 0; _cursorId = CURSOR_ARROW; @@ -126,7 +126,7 @@ void CGameObject::load(SimpleFile *file) { _visible = file->readNumber() != 0; _isMail = file->readNumber(); _id = file->readNumber(); - _field58 = file->readNumber(); + _roomFlags = file->readNumber(); resourceKey.load(file); _surface = nullptr; @@ -688,24 +688,29 @@ CGameObject *CGameObject::getMailManNextObject(CGameObject *prior) const { return mailMan ? mailMan->getNextObject(prior) : nullptr; } -CGameObject *CGameObject::findRoomObject(const CString &name) const { - return static_cast(findRoom()->findByName(name)); -} - -CGameObject *CGameObject::findUnder(CTreeItem *parent, const CString &name) { - if (!parent) +CGameObject *CGameObject::findMailByFlags(int mode, uint roomFlags) { + CMailMan *mailMan = getMailMan(); + if (!mailMan) return nullptr; - - for (CTreeItem *treeItem = parent->getFirstChild(); treeItem; - treeItem = treeItem->scan(parent)) { - if (!treeItem->getName().compareTo(name)) { - return dynamic_cast(treeItem); - } + + for (CGameObject *obj = mailMan->getFirstObject(); obj; + obj = mailMan->getNextObject(obj)) { + if (compareRoomFlags(mode, roomFlags, obj->_roomFlags)) + return obj; } return nullptr; } +CGameObject *CGameObject::getNextMail(CGameObject *prior) { + CMailMan *mailMan = getMailMan(); + return mailMan ? mailMan->getNextObject(prior) : nullptr; +} + +CGameObject *CGameObject::findRoomObject(const CString &name) const { + return static_cast(findRoom()->findByName(name)); +} + Found CGameObject::find(const CString &name, CGameObject **item, int findAreas) { CGameObject *go; *item = nullptr; @@ -897,6 +902,23 @@ CRoomItem *CGameObject::getHiddenRoom() const { return root ? root->findHiddenRoom() : nullptr; } +CGameObject *CGameObject::getHiddenObject(const CString &name) const { + CRoomItem *room = getHiddenRoom(); + return room ? static_cast(findUnder(room, name)) : nullptr; +} + +CTreeItem *CGameObject::findUnder(CTreeItem *parent, const CString &name) const { + if (!parent) + return nullptr; + + for (CTreeItem *item = parent->getFirstChild(); item; item = item->scan(parent)) { + if (item->getName() == name) + return item; + } + + return nullptr; +} + CMusicRoom *CGameObject::getMusicRoom() const { CGameManager *gameManager = getGameManager(); return gameManager ? &gameManager->_musicRoom : nullptr; diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index d372b40f88..67bf13141d 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -195,11 +195,6 @@ protected: */ int compareRoomNameTo(const CString &name); - /** - * Display a message - */ - void displayMessage(const CString &msg) const; - /** * Gets the first object under the system MailMan */ @@ -211,14 +206,19 @@ protected: CGameObject *getMailManNextObject(CGameObject *prior) const; /** - * Finds an object by name within the object's room + * Find mail by room flags */ - CGameObject *findRoomObject(const CString &name) const; + CGameObject *findMailByFlags(int mode, uint roomFlags); /** - * Scan the specified room for an item by name + * Find next mail from a given prior one + */ + CGameObject *getNextMail(CGameObject *prior); + + /** + * Finds an object by name within the object's room */ - static CGameObject *findUnder(CTreeItem *parent, const CString &name); + CGameObject *findRoomObject(const CString &name) const; /** * Moves the item from it's original position to be under the current view @@ -299,6 +299,16 @@ protected: */ CRoomItem *getHiddenRoom() const; + /** + * Returns a hidden object + */ + CGameObject *getHiddenObject(const CString &name) const; + + /** + * Scan the specified room for an item by name + */ + CTreeItem *findUnder(CTreeItem *parent, const CString &name) const; + /** * Returns the music room instance from the game manager */ @@ -366,7 +376,7 @@ protected: public: bool _isMail; int _id; - int _field58; + uint _roomFlags; int _field60; CursorId _cursorId; bool _visible; diff --git a/engines/titanic/core/mail_man.cpp b/engines/titanic/core/mail_man.cpp index 8ac50e9767..8226ebfc80 100644 --- a/engines/titanic/core/mail_man.cpp +++ b/engines/titanic/core/mail_man.cpp @@ -55,7 +55,7 @@ void CMailMan::addMail(CGameObject *obj, int id) { void CMailMan::setMailId(CGameObject *obj, int id) { obj->_id = id; - obj->_field58 = 0; + obj->_roomFlags = 0; obj->_isMail = true; } @@ -68,11 +68,11 @@ CGameObject *CMailMan::findMail(int id) const { return nullptr; } -void CMailMan::removeMail(int id, int v) { +void CMailMan::removeMail(int id, int roomFlags) { for (CGameObject *obj = getFirstObject(); obj; obj = getNextObject(obj)) { if (obj->_isMail && obj->_id == id) { obj->_isMail = false; - obj->_field58 = v; + obj->_roomFlags = roomFlags; break; } } diff --git a/engines/titanic/core/room_item.cpp b/engines/titanic/core/room_item.cpp index 6143849661..e33d0c41dd 100644 --- a/engines/titanic/core/room_item.cpp +++ b/engines/titanic/core/room_item.cpp @@ -183,4 +183,13 @@ int CRoomItem::getScriptId() const { return 0; } +CResourceKey CRoomItem::getTransitionMovieKey() { + _transitionMovieKey.scanForFile(); + return _transitionMovieKey; +} + +CResourceKey CRoomItem::getExitMovieKey() { + return _exitMovieKey; +} + } // End of namespace Titanic diff --git a/engines/titanic/core/room_item.h b/engines/titanic/core/room_item.h index e3ba71c0ae..4692318419 100644 --- a/engines/titanic/core/room_item.h +++ b/engines/titanic/core/room_item.h @@ -72,6 +72,10 @@ public: * Get the TrueTalk script Id associated with the room */ int getScriptId() const; + + CResourceKey getTransitionMovieKey(); + + CResourceKey getExitMovieKey(); }; } // End of namespace Titanic diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index d0400a4b21..c5f0f111f9 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -34,16 +34,28 @@ CGameManager::CGameManager(CProjectItem *project, CGameView *gameView): _project(project), _gameView(gameView), _trueTalkManager(this), _inputHandler(this), _inputTranslator(&_inputHandler), _gameState(this), _sound(this), _musicRoom(this), - _field30(0), _soundMaker(nullptr), _field4C(0), + _treeItem(nullptr), _soundMaker(nullptr), _movieRoom(nullptr), _dragItem(nullptr), _field54(0), _lastDiskTicksCount(0), _tickCount2(0) { CTimeEventInfo::_nextId = 0; - _videoSurface1 = nullptr; - _videoSurface2 = CScreenManager::_screenManagerPtr->createSurface(600, 340); + _movie = nullptr; + _movieSurface = CScreenManager::_screenManagerPtr->createSurface(600, 340); _project->setGameManager(this); g_vm->_filesManager->setGameManager(this); } +CGameManager::~CGameManager() { + delete _movie; + delete _movieSurface; + + if (_treeItem) { + _treeItem->destroyAll(); + _treeItem = nullptr; + } + + _project->resetGameManager(); +} + void CGameManager::load(SimpleFile *file) { file->readNumber(); @@ -107,8 +119,33 @@ void CGameManager::initBounds() { _bounds = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); } +void CGameManager::roomTransition(CRoomItem *oldRoom, CRoomItem *newRoom) { + delete _movie; + _movie = nullptr; + + CResourceKey movieKey = (oldRoom == newRoom) ? oldRoom->getTransitionMovieKey() : + oldRoom->getExitMovieKey(); + CString filename = movieKey.exists(); + if (g_vm->_filesManager->fileExists(filename)) { + _movieSurface->freeSurface(); + _movie = new OSMovie(filename, _movieSurface); + } +} + void CGameManager::playClip(CMovieClip *clip, CRoomItem *oldRoom, CRoomItem *newRoom) { - warning("TODO: CGameManager::playClip"); + if (oldRoom != newRoom || newRoom != _movieRoom || !_movie) + roomTransition(oldRoom, newRoom); + + if (clip && clip->_startFrame != clip->_endFrame && _movie) { + // Clip details specifying a sub-section of movie to play + Rect tempRect(20, 10, SCREEN_WIDTH - 20, 350); + + lockInputHandler(); + CScreenManager::_screenManagerPtr->_mouseCursor->hide(); + _movie->playClip(tempRect, clip->_startFrame, clip->_endFrame); + CScreenManager::_screenManagerPtr->_mouseCursor->show(); + unlockInputHandler(); + } } void CGameManager::update() { @@ -191,11 +228,11 @@ void CGameManager::updateDiskTicksCount() { } void CGameManager::viewChange() { - delete _videoSurface1; - delete _videoSurface2; + delete _movie; + delete _movieSurface; - _videoSurface1 = nullptr; - _videoSurface2 = CScreenManager::_screenManagerPtr->createSurface(600, 340); + _movie = nullptr; + _movieSurface = CScreenManager::_screenManagerPtr->createSurface(600, 340); _trueTalkManager.clear(); for (CTreeItem *treeItem = _project; treeItem; treeItem = treeItem->scan(_project)) diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index c4e6bc6ec8..179e6cde14 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -44,12 +44,12 @@ class CGameManager { private: CTrueTalkManager _trueTalkManager; CTimeEventInfoList _timers; - int _field30; + CTreeItem *_treeItem; CBackgroundSoundMaker *_soundMaker; - CVideoSurface *_videoSurface1; - int _field4C; + CMovie *_movie; + CRoomItem *_movieRoom; int _field54; - CVideoSurface *_videoSurface2; + CVideoSurface *_movieSurface; uint _lastDiskTicksCount; uint _tickCount2; private: @@ -62,6 +62,11 @@ private: * Handles any ongoing movie playback */ void updateMovies(); + + /** + * Handles a room transition + */ + void roomTransition(CRoomItem *oldRoom, CRoomItem *newRoom); public: CProjectItem *_project; CGameView *_gameView; diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 793436521c..1643459963 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -251,7 +251,7 @@ CRoomItem *CPetControl::getHiddenRoom() { CGameObject *CPetControl::getHiddenObject(const CString &name) { CRoomItem *room = getHiddenRoom(); - return room ? findUnder(room, name) : nullptr; + return room ? static_cast(findUnder(room, name)) : nullptr; } bool CPetControl::containsPt(const Common::Point &pt) const { @@ -677,4 +677,14 @@ int CPetControl::getMailDest(const CRoomFlags &roomFlags) const { return roomFlags.getSuccUBusNum(roomFlags.getSuccUBusRoomName()); } +void CPetControl::starsSetButtons(int val1, int val2) { + _starfield.setButtons(val1, val2); + if (_currentArea == PET_STARFIELD) + _starfield.makePetDirty(); +} + +void CPetControl::starsSetReference(bool hasRef) { + _starfield.setHasReference(hasRef); +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index e389a0e31a..5601c403f4 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -385,6 +385,13 @@ public: */ void resetActiveNPC(); + /** + * Resets NPC in conversations + */ + void convResetNPC() { + _conversations.resetNPC(); + } + /** * Resets the conversation dials back to 0 position */ @@ -543,6 +550,23 @@ public: bool isSuccUBusRoom(const CRoomFlags &roomFlags) { return roomFlags.isSuccUBusRoomFlags(); } + + /** + * Called with a phonograph action for Send, Receive, or Record + */ + void phonographAction(const CString &action) { + // Original had some code that had no effect + } + + /** + * Sets the status buttons for the starfield control + */ + void starsSetButtons(int val1, int val2); + + /** + * Set whether the user has the galactic reference material + */ + void starsSetReference(bool hasRef); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_starfield.cpp b/engines/titanic/pet_control/pet_starfield.cpp index 4230d9454f..cde512c681 100644 --- a/engines/titanic/pet_control/pet_starfield.cpp +++ b/engines/titanic/pet_control/pet_starfield.cpp @@ -28,7 +28,7 @@ namespace Titanic { CPetStarfield::CPetStarfield() : _field18C(0), _photoOn(true), - _field210(0), _rect1(22, 352, 598, 478) { + _hasReference(false), _rect1(22, 352, 598, 478) { _btnOffsets[0] = _btnOffsets[1] = _btnOffsets[2] = 0; } @@ -86,7 +86,7 @@ bool CPetStarfield::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { CPETHelmetOnOffMsg helmetMsg; helmetMsg.execute(_petControl->_remoteTarget); } else if (_imgPhoto.MouseButtonDownMsg(msg->_mousePos)) { - if (_field210) { + if (_hasReference) { _photoOn = !_photoOn; CPETPhotoOnOffMsg photoMsg; photoMsg.execute(_petControl->_remoteTarget); @@ -124,7 +124,7 @@ bool CPetStarfield::isValid(CPetControl *petControl) { void CPetStarfield::load(SimpleFile *file, int param) { if (!param) { _photoOn = file->readNumber(); - _field210 = file->readNumber(); + _hasReference = file->readNumber(); } } @@ -134,7 +134,7 @@ void CPetStarfield::postLoad() { void CPetStarfield::save(SimpleFile *file, int indent) const { file->writeNumberLine(_photoOn, indent); - file->writeNumberLine(_field210, indent); + file->writeNumberLine(_hasReference, indent); } bool CPetStarfield::setupControl(CPetControl *petControl) { diff --git a/engines/titanic/pet_control/pet_starfield.h b/engines/titanic/pet_control/pet_starfield.h index 6cfc308d24..ec659ccb31 100644 --- a/engines/titanic/pet_control/pet_starfield.h +++ b/engines/titanic/pet_control/pet_starfield.h @@ -41,7 +41,7 @@ private: int _field18C; CPetText _text; bool _photoOn; - int _field210; + bool _hasReference; private: /** * Setup the control @@ -53,18 +53,6 @@ private: */ void drawButton(int offset, int index, CScreenManager *screenManager); - void set210(int val) { _field210 = val; } - - /** - * Sets the offsets for each of the buttons - */ - void setButtons(int val1, int val2); - - /** - * Make the PET as dirty, requiring a redraw - */ - void makePetDirty(); - /** * Mouse down handling for Nav elements */ @@ -115,6 +103,21 @@ public: * Save the data for the class to file */ virtual void save(SimpleFile *file, int indent) const; + + /** + * Sets the offsets for each of the buttons + */ + void setButtons(int val1, int val2); + + /** + * Sets whether the player has the galactic reference material + */ + void setHasReference(bool hasRef) { _hasReference = hasRef; } + + /** + * Make the PET as dirty, requiring a redraw + */ + void makePetDirty(); }; } // End of namespace Titanic diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index 26620de3a6..cde3b22a8c 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -87,8 +87,8 @@ void OSMovie::play(uint startFrame, uint endFrame, int v3, bool v4) { _state = MOVIE_NONE; } -void OSMovie::proc10() { - warning("TODO: OSMovie::proc10"); +void OSMovie::playClip(const Rect &rect, uint startFrame, uint endFrame) { + warning("TODO: OSMovie::playClip"); } void OSMovie::proc11() { diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index 01f107ec5b..61dd4cf61d 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -61,7 +61,11 @@ public: */ virtual void play(uint startFrame, uint endFrame, int v3, bool v4) = 0; - virtual void proc10() = 0; + /** + * Plays a sub-section of a movie + */ + virtual void playClip(const Rect &rect, uint startFrame, uint endFrame) = 0; + virtual void proc11() = 0; virtual void proc12(const CString &name, int flags, CGameObject *obj) = 0; @@ -119,7 +123,11 @@ public: */ virtual void play(uint startFrame, uint endFrame, int v3, bool v4); - virtual void proc10(); + /** + * Plays a sub-section of a movie + */ + virtual void playClip(const Rect &rect, uint startFrame, uint endFrame); + virtual void proc11(); virtual void proc12(const CString &name, int flags, CGameObject *obj); -- cgit v1.2.3 From e161a3d2078c8b9d284b5bfbeab8de3d8304eedb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 27 Jun 2016 07:58:32 -0400 Subject: TITANIC: Added extra CGameState methods --- engines/titanic/game_state.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h index 327459278d..125882a9dd 100644 --- a/engines/titanic/game_state.h +++ b/engines/titanic/game_state.h @@ -124,6 +124,11 @@ public: */ void addMovie(CMovie *movie); + void inc14() { _field14 = (_field14 + 1) & 3; } + void set24(int v) { _field24 = v; } + int get24() const { return _field24; } + int getNodeChangedCtr() const { return _nodeChangeCtr; } + uint32 getNodeEnterTicks() const { return _nodeEnterTicks; } void inc38() { ++_field38; } }; -- cgit v1.2.3 From c87a6e212aa190a7473722dfdd34cf794105d265 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 27 Jun 2016 08:28:10 -0400 Subject: TITANIC: Adding stub methods to CGameObject --- engines/titanic/core/game_object.cpp | 60 ++++++++++++++++++++------- engines/titanic/core/game_object.h | 25 ++++++++--- engines/titanic/star_control/star_control.cpp | 8 ++++ engines/titanic/star_control/star_control.h | 2 + 4 files changed, 74 insertions(+), 21 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 0bf54647f5..15bc1ec143 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -869,17 +869,6 @@ CMailMan *CGameObject::getMailMan() const { return dynamic_cast(getDontSaveChild(CMailMan::_type)); } -CStarControl *CGameObject::getStarControl() const { - CStarControl *starControl = static_cast(getDontSaveChild(CStarControl::_type)); - if (!starControl) { - CViewItem *view = getGameManager()->getView(); - if (view) - starControl = starControl = static_cast(view->findChildInstanceOf(CStarControl::_type)); - } - - return starControl; -} - CTreeItem *CGameObject::getDontSaveChild(ClassDef *classDef) const { CProjectItem *root = getRoot(); if (!root) @@ -892,11 +881,6 @@ CTreeItem *CGameObject::getDontSaveChild(ClassDef *classDef) const { return dontSave->findChildInstanceOf(classDef); } -CRoomItem *CGameObject::getRoom() const { - CGameManager *gameManager = getGameManager(); - return gameManager ? gameManager->getRoom() : nullptr; -} - CRoomItem *CGameObject::getHiddenRoom() const { CProjectItem *root = getRoot(); return root ? root->findHiddenRoom() : nullptr; @@ -1043,6 +1027,25 @@ void CGameObject::resetMail() { mailMan->resetValue(); } +/*------------------------------------------------------------------------*/ + +CRoomItem *CGameObject::getRoom() const { + CGameManager *gameManager = getGameManager(); + return gameManager ? gameManager->getRoom() : nullptr; +} + +CNodeItem *CGameObject::getNode() const { + CGameManager *gameManager = getGameManager(); + return gameManager ? gameManager->getNode() : nullptr; +} + +CViewItem *CGameObject::getView() const { + CGameManager *gameManager = getGameManager(); + return gameManager ? gameManager->getView() : nullptr; +} + +/*------------------------------------------------------------------------*/ + void CGameObject::petAddToCarryParcel(CGameObject *obj) { CPetControl *pet = getPetControl(); if (pet) { @@ -1150,6 +1153,31 @@ void CGameObject::petUnlockInput() { /*------------------------------------------------------------------------*/ +CStarControl *CGameObject::getStarControl() const { + CStarControl *starControl = static_cast(getDontSaveChild(CStarControl::_type)); + if (!starControl) { + CViewItem *view = getGameManager()->getView(); + if (view) + starControl = starControl = static_cast(view->findChildInstanceOf(CStarControl::_type)); + } + + return starControl; +} + +void CGameObject::starFn1(int v) { + CStarControl *starControl = getStarControl(); + if (starControl) + starControl->fn1(v); +} + +void CGameObject::starFn2() { + CStarControl *starControl = getStarControl(); + if (starControl) + starControl->fn4(); +} + +/*------------------------------------------------------------------------*/ + void CGameObject::startTalking(const CString &npcName, uint id, CViewItem *view) { CTrueTalkNPC *npc = static_cast(getRoot()->findByName(npcName)); startTalking(npc, id, view); diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 67bf13141d..448b547e21 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -289,11 +289,6 @@ protected: */ CTreeItem *getDontSaveChild(ClassDef *classDef) const; - /** - * Return the current room - */ - CRoomItem *getRoom() const; - /** * Returns the special hidden room container */ @@ -529,6 +524,23 @@ public: bool compareRoomFlags(int mode, uint flags1, uint flags2); + /*--- CGameManager Methods ---*/ + + /** + * Return the current room + */ + CRoomItem *getRoom() const; + + /** + * Return the current node + */ + CNodeItem *getNode() const; + + /** + * Return the current room + */ + CViewItem *getView() const; + /*--- CPetControl Methods ---*/ /** @@ -624,6 +636,9 @@ public: */ CStarControl *getStarControl() const; + void starFn1(int v); + void starFn2(); + /*--- CTrueTalkManager Methods ---*/ /** diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp index 3f84a947f3..f27f16dab2 100644 --- a/engines/titanic/star_control/star_control.cpp +++ b/engines/titanic/star_control/star_control.cpp @@ -57,4 +57,12 @@ void CStarControl::fn3() { warning("CStarControl::fn3"); } +void CStarControl::fn1(int v) { + warning("CStarControl::fn1"); +} + +void CStarControl::fn4() { + warning("CStarControl::fn4"); +} + } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control.h b/engines/titanic/star_control/star_control.h index 3e53db11bf..ee042b6bc8 100644 --- a/engines/titanic/star_control/star_control.h +++ b/engines/titanic/star_control/star_control.h @@ -53,7 +53,9 @@ public: */ virtual void load(SimpleFile *file); + void fn1(int v); void fn3(); + void fn4(); }; } // End of namespace Titanic -- cgit v1.2.3 From 3988a9eeee98efdd3b297cde76640416fc13f3ca Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 27 Jun 2016 13:43:27 -0400 Subject: TITANIC: Adding more game object methods --- engines/titanic/core/game_object.cpp | 35 +++++++++++++++++++++++++++++ engines/titanic/core/game_object.h | 27 +++++++++++++++++++++- engines/titanic/npcs/true_talk_npc.cpp | 7 ++++++ engines/titanic/npcs/true_talk_npc.h | 5 +++++ engines/titanic/pet_control/pet_control.cpp | 10 --------- engines/titanic/pet_control/pet_control.h | 11 --------- 6 files changed, 73 insertions(+), 22 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 15bc1ec143..72a6e9249b 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -678,6 +678,26 @@ int CGameObject::compareRoomNameTo(const CString &name) { return room->getName().compareToIgnoreCase(name); } +CString CGameObject::getRoomName() const { + CRoomItem *room = getRoom(); + return room ? room->getName() : CString(); +} + +CString CGameObject::getRoomNodeName() const { + CNodeItem *node = getNode(); + if (!node) + return CString(); + + CRoomItem *room = node->findRoom(); + + return CString::format("%s.%s", room->getName().c_str(), node->getName().c_str()); +} + +CString CGameObject::getFullViewName() { + CGameManager *gameManager = getGameManager(); + return gameManager ? gameManager->getFullViewName() : CString(); +} + CGameObject *CGameObject::getMailManFirstObject() const { CMailMan *mailMan = getMailMan(); return mailMan ? mailMan->getFirstObject() : nullptr; @@ -711,6 +731,11 @@ CGameObject *CGameObject::findRoomObject(const CString &name) const { return static_cast(findRoom()->findByName(name)); } +CGameObject *CGameObject::findInRoom(const CString &name) { + CRoomItem *room = getRoom(); + return room ? static_cast(room->findByName(name)) : nullptr; +} + Found CGameObject::find(const CString &name, CGameObject **item, int findAreas) { CGameObject *go; *item = nullptr; @@ -903,6 +928,16 @@ CTreeItem *CGameObject::findUnder(CTreeItem *parent, const CString &name) const return nullptr; } +CRoomItem *CGameObject::findRoomByName(const CString &name) { + CProjectItem *project = getRoot(); + for (CRoomItem *room = project->findFirstRoom(); room; room = project->findNextRoom(room)) { + if (!room->getName().compareToIgnoreCase(name)) + return room; + } + + return nullptr; +} + CMusicRoom *CGameObject::getMusicRoom() const { CGameManager *gameManager = getGameManager(); return gameManager ? &gameManager->_musicRoom : nullptr; diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 448b547e21..4d53bd3e6e 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -220,6 +220,11 @@ protected: */ CGameObject *findRoomObject(const CString &name) const; + /** + * FInds an object under the current room + */ + CGameObject *findInRoom(const CString &name); + /** * Moves the item from it's original position to be under the current view */ @@ -304,6 +309,11 @@ protected: */ CTreeItem *findUnder(CTreeItem *parent, const CString &name) const; + /** + * Finds a room by name + */ + CRoomItem *findRoomByName(const CString &name); + /** * Returns the music room instance from the game manager */ @@ -541,6 +551,22 @@ public: */ CViewItem *getView() const; + /** + * Get the current room name + */ + CString getRoomName() const; + + /** + * Get the current node and room in the form "room.node" + */ + CString getRoomNodeName() const; + + /** + * Return the full Id of the current view in a + * room.node.view tuplet form + */ + CString getFullViewName(); + /*--- CPetControl Methods ---*/ /** @@ -655,7 +681,6 @@ public: * Start a conversation with the NPC */ void startTalking(const CString &name, uint id, CViewItem *view = nullptr); - }; } // End of namespace Titanic diff --git a/engines/titanic/npcs/true_talk_npc.cpp b/engines/titanic/npcs/true_talk_npc.cpp index 00b68c2913..0295826eb5 100644 --- a/engines/titanic/npcs/true_talk_npc.cpp +++ b/engines/titanic/npcs/true_talk_npc.cpp @@ -211,4 +211,11 @@ void CTrueTalkNPC::setView(CViewItem *view) { talkManager->start3(this, view); } +void CTrueTalkNPC::startTalker(CViewItem *view) { + CGameManager *gameManager = getGameManager(); + if (gameManager) + gameManager->getTalkManager()->start4(this, view); +} + + } // End of namespace Titanic diff --git a/engines/titanic/npcs/true_talk_npc.h b/engines/titanic/npcs/true_talk_npc.h index 1a10a0aa9b..b13841b742 100644 --- a/engines/titanic/npcs/true_talk_npc.h +++ b/engines/titanic/npcs/true_talk_npc.h @@ -85,6 +85,11 @@ public: * Set the view for the NPC */ void setView(CViewItem *view); + + /** + * Start the talker in the given view + */ + void startTalker(CViewItem *view); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 1643459963..6e30711397 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -513,11 +513,6 @@ void CPetControl::playSound(int soundNum) { } } -CString CPetControl::getRoomName() const { - CRoomItem *room = getRoom(); - return room ? room->getName() : CString(); -} - int CPetControl::canSummonBot(const CString &name) { // If player is the very same view as the NPC, then it's already present if (isBotInView(name)) @@ -652,11 +647,6 @@ CGameObject *CPetControl::findBot(const CString &name, CTreeItem *root) { return nullptr; } -CString CPetControl::getFullViewName() { - CGameManager *gameManager = getGameManager(); - return gameManager ? gameManager->getFullViewName() : CString(); -} - bool CPetControl::isSuccUBusActive() const { if (!_activeNPC) return false; diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 5601c403f4..75b92d734e 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -281,11 +281,6 @@ public: */ void playSound(int soundNum); - /** - * Get the room name - */ - CString getRoomName() const; - /** * Check whether an NPC can be summoned */ @@ -321,12 +316,6 @@ public: */ void stopPetTimer(uint timerIndex); - /** - * Return the full Id of the current view in a - * room.node.view tuplet form - */ - CString getFullViewName(); - /** * Returns true if all input is currently locked (disabled) */ -- cgit v1.2.3 From f141b337177bb0bd001c753f8cb17999b6ea2bf9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 27 Jun 2016 19:19:04 -0400 Subject: TITANIC: Adding CGameObject methods --- engines/titanic/core/game_object.cpp | 151 ++++++++++++++++++++++---------- engines/titanic/core/game_object.h | 50 ++++++++++- engines/titanic/core/tree_item.h | 10 ++- engines/titanic/support/video_surface.h | 2 +- 4 files changed, 159 insertions(+), 54 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 72a6e9249b..795ed92236 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -143,6 +143,70 @@ void CGameObject::load(SimpleFile *file) { CNamedItem::load(file); } +void CGameObject::draw(CScreenManager *screenManager) { + if (!_visible) + return; + if (_credits) { + error("TODO: Block in CGameObject::draw"); + } + + if (_field40) { + if (_field90) { + if (_bounds.intersects(getGameManager()->_bounds)) + warning("TODO: _field90(screenManager);"); + } + } + else { + if (!_surface) { + if (!_resource.empty()) { + loadResource(_resource); + _resource = ""; + } + } + + if (_surface) { + _bounds.setWidth(_surface->getWidth()); + _bounds.setHeight(_surface->getHeight()); + + if (!_bounds.width() || !_bounds.height()) + return; + + if (_frameNumber >= 0) { + loadFrame(_frameNumber); + _frameNumber = -1; + } + + if (!_clipList2.empty()) + processClipList2(); + + if (_bounds.intersects(getGameManager()->_bounds)) { + if (_surface) { + Point destPos(_bounds.left, _bounds.top); + screenManager->blitFrom(SURFACE_BACKBUFFER, _surface, &destPos); + } + + if (_field90) + warning("TODO: sub_415f80(screenManager);"); + } + } + } +} + +Rect CGameObject::getBounds() const { + return (_surface && _surface->proc45()) ? _bounds : Rect(); +} + +void CGameObject::viewChange() { + // Handle freeing the surfaces of objects when their view is left + if (_surface) { + _resource = _surface->_resourceKey.getString(); + _initialFrame = getMovieFrame(); + + delete _surface; + _surface = nullptr; + } +} + void CGameObject::stopMovie() { if (_surface) _surface->stopMovie(); @@ -214,54 +278,6 @@ void CGameObject::draw(CScreenManager *screenManager, const Point &destPos, cons draw(screenManager, Rect(destPos.x, destPos.y, destPos.x + 52, destPos.y + 52), srcRect); } -void CGameObject::draw(CScreenManager *screenManager) { - if (!_visible) - return; - if (_credits) { - error("TODO: Block in CGameObject::draw"); - } - - if (_field40) { - if (_field90) { - if (_bounds.intersects(getGameManager()->_bounds)) - warning("TODO: _field90(screenManager);"); - } - } else { - if (!_surface) { - if (!_resource.empty()) { - loadResource(_resource); - _resource = ""; - } - } - - if (_surface) { - _bounds.setWidth(_surface->getWidth()); - _bounds.setHeight(_surface->getHeight()); - - if (!_bounds.width() || !_bounds.height()) - return; - - if (_frameNumber >= 0) { - loadFrame(_frameNumber); - _frameNumber = -1; - } - - if (!_clipList2.empty()) - processClipList2(); - - if (_bounds.intersects(getGameManager()->_bounds)) { - if (_surface) { - Point destPos(_bounds.left, _bounds.top); - screenManager->blitFrom(SURFACE_BACKBUFFER, _surface, &destPos); - } - - if (_field90) - warning("TODO: sub_415f80(screenManager);"); - } - } - } -} - bool CGameObject::isPet() const { return isInstanceOf(CPetControl::_type); } @@ -369,6 +385,10 @@ bool CGameObject::soundFn1(int handle) { return false; } +void CGameObject::soundFn2(const CString &resName, int v1, int v2, int v3, int handleIndex) { + warning("TODO: CGameObject::soundFn2"); +} + void CGameObject::soundFn3(int handle, int val2, int val3) { if (handle != 0 && handle != -1) { CGameManager *gameManager = getGameManager(); @@ -377,6 +397,14 @@ void CGameObject::soundFn3(int handle, int val2, int val3) { } } +void CGameObject::soundFn4(int v1, int v2, int v3) { + warning("CGameObject::soundFn4"); +} + +void CGameObject::soundFn5(int v1, int v2, int v3) { + warning("CGameObject::soundFn5"); +} + void CGameObject::setVisible(bool val) { if (val != _visible) { _visible = val; @@ -402,6 +430,24 @@ void CGameObject::petShowCursor() { pet->showCursor(); } +void CGameObject::petShow() { + CGameManager *gameManager = getGameManager(); + if (gameManager) { + gameManager->_gameState._petActive = true; + gameManager->_gameState.setMode(GSMODE_SELECTED); + gameManager->initBounds(); + } +} + +void CGameObject::petHide() { + CGameManager *gameManager = getGameManager(); + if (gameManager) { + gameManager->_gameState._petActive = false; + gameManager->_gameState.setMode(GSMODE_SELECTED); + gameManager->initBounds(); + } +} + void CGameObject::petSetRemoteTarget() { CPetControl *pet = getPetControl(); if (pet) @@ -886,6 +932,11 @@ void CGameObject::petClear() const { petControl->resetActiveNPC(); } +CDontSaveFileItem *CGameObject::getDontSave() const { + CProjectItem *project = getRoot(); + return project ? project->getDontSaveFileItem() : nullptr; +} + CPetControl *CGameObject::getPetControl() const { return static_cast(getDontSaveChild(CPetControl::_type)); } @@ -1005,6 +1056,10 @@ int CGameObject::getClipDuration(const CString &name, int frameRate) const { return clip ? (clip->_endFrame - clip->_startFrame) * 1000 / frameRate : 0; } +uint32 CGameObject::getTickCount() { + return g_vm->_events->getTicksCount(); +} + bool CGameObject::compareRoomFlags(int mode, uint flags1, uint flags2) { switch (mode) { case 1: diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 4d53bd3e6e..a744cd116a 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -36,6 +36,7 @@ namespace Titanic { enum Find { FIND_GLOBAL = 1, FIND_ROOM = 2, FIND_PET = 4, FIND_MAILMAN = 8 }; enum Found { FOUND_NONE = 0, FOUND_GLOBAL = 1, FOUND_ROOM = 2, FOUND_PET = 3, FOUND_MAILMAN = 4 }; +class CDontSaveFileItem; class CMailMan; class CMusicRoom; class CRoomItem; @@ -157,8 +158,14 @@ protected: bool soundFn1(int handle); + void soundFn2(const CString &resName, int v1, int v2, int v3, int handleIndex); + void soundFn3(int handle, int val2, int val3); + void soundFn4(int v1, int v2, int v3); + + void soundFn5(int v1, int v2, int v3); + /** * Adds a timer */ @@ -289,6 +296,11 @@ protected: */ CMailMan *getMailMan() const; + /** + * Gets the don't save container object + */ + CDontSaveFileItem *getDontSave() const; + /** * Returns a child of the Dont Save area of the project of the given class */ @@ -337,6 +349,11 @@ protected: */ int getClipDuration(const CString &name, int frameRate = 14) const; + /** + * Returns the current system tick count + */ + uint32 getTickCount(); + void setState1C(bool flag); /** @@ -409,25 +426,40 @@ public: */ virtual void load(SimpleFile *file); + /** + * Returns the clip list, if any, associated with the item + */ + virtual const CMovieClipList *getClipList() const { return &_clipList1; } + /** * Allows the item to draw itself */ - void draw(CScreenManager *screenManager, const Rect &destRect, const Rect &srcRect); + virtual void draw(CScreenManager *screenManager); + + /** + * Gets the bounds occupied by the item + */ + virtual Rect getBounds() const; + + /** + * Called when the view changes + */ + virtual void viewChange(); /** * Allows the item to draw itself */ - void draw(CScreenManager *screenManager, const Point &destPos); + void draw(CScreenManager *screenManager, const Rect &destRect, const Rect &srcRect); /** * Allows the item to draw itself */ - void draw(CScreenManager *screenManager, const Point &destPos, const Rect &srcRect); + void draw(CScreenManager *screenManager, const Point &destPos); /** * Allows the item to draw itself */ - virtual void draw(CScreenManager *screenManager); + void draw(CScreenManager *screenManager, const Point &destPos, const Rect &srcRect); /** * Returns true if the item is the PET control @@ -608,6 +640,11 @@ public: int petGetRooms1D0() const; + /** + * Hide the PET + */ + void petHide(); + /** * Hides the text cursor in the current section, if applicable */ @@ -645,6 +682,11 @@ public: void petSetRooms1D0(int val); + /** + * Show the PET + */ + void petShow(); + /** * Shows the text cursor in the current section, if applicable */ diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index 2ea7b4249e..77d7aa59b5 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -29,6 +29,7 @@ namespace Titanic { class CGameManager; +class CMovieClipList; class CNamedItem; class CProjectItem; class CScreenManager; @@ -128,6 +129,13 @@ public: */ virtual int compareTo(const CString &name, int maxLen) const { return false; } + virtual int proc23() const { return 0; } + + /** + * Returns the clip list, if any, associated with the item + */ + virtual const CMovieClipList *getClipList() const { return nullptr; } + /** * Returns true if the given item connects to another specified view */ @@ -141,7 +149,7 @@ public: /** * Gets the bounds occupied by the item */ - virtual Rect getBounds() { return Rect(); } + virtual Rect getBounds() const { return Rect(); } /** * Called when the view changes diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index 8d0dd2ffac..6f707a39ff 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -54,7 +54,6 @@ protected: static int _videoSurfaceCounter; protected: CScreenManager *_screenManager; - CResourceKey _resourceKey; Graphics::ManagedSurface *_rawSurface; bool _pendingLoad; void *_field40; @@ -68,6 +67,7 @@ public: DirectDrawSurface *_ddSurface; bool _blitFlag; bool _blitStyleFlag; + CResourceKey _resourceKey; public: CVideoSurface(CScreenManager *screenManager); virtual ~CVideoSurface(); -- cgit v1.2.3 From 0e8148207070e92a5234e5c0a4e05fe401901736 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 27 Jun 2016 19:44:16 -0400 Subject: TITANIC: Added more CGameObject methods --- engines/titanic/core/game_object.cpp | 39 ++++++++++++++++++++++++++++++++++++ engines/titanic/core/game_object.h | 25 +++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 795ed92236..183cb6b6ee 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -850,6 +850,14 @@ void CGameObject::lockMouse() { CScreenManager::_screenManagerPtr->_mouseCursor->hide(); } +void CGameObject::hideMouse() { + CScreenManager::_screenManagerPtr->_mouseCursor->hide(); +} + +void CGameObject::showMouse() { + CScreenManager::_screenManagerPtr->_mouseCursor->show(); +} + void CGameObject::unlockMouse() { if (CScreenManager::_screenManagerPtr->_mouseCursor) CScreenManager::_screenManagerPtr->_mouseCursor->show(); @@ -898,6 +906,11 @@ void CGameObject::dragMove(const Point &pt) { setPosition(Point(pt.x - _bounds.width() / 2, pt.y - _bounds.height() / 2)); } +bool CGameObject::isObjectDragging() const { + CTreeItem *item = getGameManager()->_dragItem; + return item ? static_cast(item) != nullptr : false; +} + Point CGameObject::getControid() const { return Point(_bounds.left + _bounds.width() / 2, _bounds.top + _bounds.height() / 2); @@ -1294,4 +1307,30 @@ void CGameObject::endTalking(CTrueTalkNPC *npc, bool viewFlag, CViewItem *view) pet->refreshNPC(); } +void CGameObject::talkSetDialRegion(const CString &name, int dialNum, int regionNum) { + CGameManager *gameManager = getGameManager(); + if (gameManager) { + CTrueTalkManager *talkManager = gameManager->getTalkManager(); + if (talkManager) { + TTnpcScript *npcScript = talkManager->getTalker(name); + if (npcScript) + npcScript->setDialRegion(dialNum, regionNum); + } + } +} + +int CGameObject::talkGetDIalRegion(const CString &name, int dialNum) { + CGameManager *gameManager = getGameManager(); + if (gameManager) { + CTrueTalkManager *talkManager = gameManager->getTalkManager(); + if (talkManager) { + TTnpcScript *npcScript = talkManager->getTalker(name); + if (npcScript) + return npcScript->getDialRegion(dialNum); + } + } + + return 0; +} + } // End of namespace Titanic diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index a744cd116a..d9f382c2e4 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -136,6 +136,16 @@ protected: */ void unlockMouse(); + /** + * Hides the mouse cursor + */ + void hideMouse(); + + /** + * Shows the mouse cursor + */ + void showMouse(); + /** * Load a sound */ @@ -564,6 +574,11 @@ public: */ void dragMove(const Point &pt); + /** + * Returns true if an item being dragged is a game object + */ + bool isObjectDragging() const; + bool compareRoomFlags(int mode, uint flags1, uint flags2); /*--- CGameManager Methods ---*/ @@ -723,6 +738,16 @@ public: * Start a conversation with the NPC */ void startTalking(const CString &name, uint id, CViewItem *view = nullptr); + + /** + * Sets a dial region for a given NPC + */ + void talkSetDialRegion(const CString &name, int dialNum, int regionNum); + + /** + * Gets a dial region for a given NPC + */ + int talkGetDIalRegion(const CString &name, int dialNum); }; } // End of namespace Titanic -- cgit v1.2.3 From a1c181f94945633300a9e9c4f657bb654abad98c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 27 Jun 2016 21:26:00 -0400 Subject: TITANIC: Adding CGameObject methods --- engines/titanic/core/game_object.cpp | 63 +++++++++++++++++++++++++++++++ engines/titanic/core/game_object.h | 46 ++++++++++++++++++++-- engines/titanic/npcs/true_talk_npc.cpp | 4 ++ engines/titanic/npcs/true_talk_npc.h | 5 +++ engines/titanic/support/mouse_cursor.cpp | 18 ++++++++- engines/titanic/support/mouse_cursor.h | 7 ++++ engines/titanic/support/video_surface.cpp | 4 ++ engines/titanic/support/video_surface.h | 4 ++ 8 files changed, 146 insertions(+), 5 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 183cb6b6ee..9c5f9db3b4 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -830,10 +830,32 @@ void CGameObject::moveToView() { view->addUnder(this); } +void CGameObject::moveToView(const CString &name) { + CViewItem *view = parseView(name); + detach(); + view->addUnder(this); +} + void CGameObject::incState38() { getGameManager()->_gameState.inc38(); } +void CGameObject::stateInc14() { + getGameManager()->_gameState.inc14(); +} + +int CGameObject::stateGet14() { + return getGameManager()->_gameState._field14; +} + +void CGameObject::stateSet24() { + getGameManager()->_gameState.set24(1); +} + +int CGameObject::stateGet24() { + return getGameManager()->_gameState.get24(); +} + void CGameObject::inc54() { getGameManager()->inc54(); } @@ -842,6 +864,11 @@ void CGameObject::dec54() { getGameManager()->dec54(); } +void CGameObject::surface39(int v1, int v2) { + if (_surface) + _surface->proc39(v1, v2); +} + void CGameObject::lockMouse() { CGameManager *gameMan = getGameManager(); gameMan->lockInputHandler(); @@ -858,6 +885,36 @@ void CGameObject::showMouse() { CScreenManager::_screenManagerPtr->_mouseCursor->show(); } +void CGameObject::disableMouse() { + lockInputHandler(); + hideMouse(); +} + +void CGameObject::enableMouse() { + unlockInputHandler(); + showMouse(); +} + +void CGameObject::mouseLockE4() { + CScreenManager::_screenManagerPtr->_mouseCursor->lockE4(); +} + +void CGameObject::mouseUnlockE4() { + CScreenManager::_screenManagerPtr->_mouseCursor->unlockE4(); +} + +void CGameObject::mouseSaveState(int v1, int v2, int v3) { + CScreenManager::_screenManagerPtr->_mouseCursor->saveState(v1, v2, v3); +} + +void CGameObject::lockInputHandler() { + getGameManager()->lockInputHandler(); +} + +void CGameObject::unlockInputHandler() { + getGameManager()->unlockInputHandler(); +} + void CGameObject::unlockMouse() { if (CScreenManager::_screenManagerPtr->_mouseCursor) CScreenManager::_screenManagerPtr->_mouseCursor->show(); @@ -1244,6 +1301,12 @@ void CGameObject::petSetRooms1D0(int val) { petControl->setRooms1D0(val); } +void CGameObject::petSetRooms1D4(int v) { + CPetControl *pet = getPetControl(); + if (pet) + pet->setRooms1D4(v); +} + void CGameObject::petOnSummonBot(const CString &name, int val) { CPetControl *pet = getPetControl(); if (pet) diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index d9f382c2e4..02168c9f00 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -122,7 +122,6 @@ protected: */ CViewItem * parseView(const CString &viewString); - void incState38(); void inc54(); void dec54(); @@ -146,6 +145,31 @@ protected: */ void showMouse(); + /** + * Disable the mouse + */ + void disableMouse(); + + /** + * Enable the mouse + */ + void enableMouse(); + + void mouseLockE4(); + void mouseUnlockE4(); + + void mouseSaveState(int v1, int v2, int v3); + + /** + * Lock the input handler + */ + void lockInputHandler(); + + /** + * Unlock the input handler + */ + void unlockInputHandler(); + /** * Load a sound */ @@ -243,10 +267,15 @@ protected: CGameObject *findInRoom(const CString &name); /** - * Moves the item from it's original position to be under the current view + * Moves the object to be under the current view */ void moveToView(); + /** + * Moves the object to be under the specified view + */ + void moveToView(const CString &name); + /** * Change the view */ @@ -364,8 +393,6 @@ protected: */ uint32 getTickCount(); - void setState1C(bool flag); - /** * Adds an object to the mail list */ @@ -405,6 +432,15 @@ protected: * Unlocks PET input */ void petUnlockInput(); + + void setState1C(bool flag); + void incState38(); + void stateInc14(); + int stateGet14(); + void stateSet24(); + int stateGet24(); + + void surface39(int v1, int v2); public: bool _isMail; int _id; @@ -696,6 +732,8 @@ public: void petSetRemoteTarget(); void petSetRooms1D0(int val); + void petSetRooms1D4(int v); + /** * Show the PET diff --git a/engines/titanic/npcs/true_talk_npc.cpp b/engines/titanic/npcs/true_talk_npc.cpp index 0295826eb5..c989aa3bd7 100644 --- a/engines/titanic/npcs/true_talk_npc.cpp +++ b/engines/titanic/npcs/true_talk_npc.cpp @@ -205,6 +205,10 @@ int CTrueTalkNPC::startAnimTimer(const CString &action, uint firstDuration, uint return timer->_id; } +void CTrueTalkNPC::stopAnimTimer(int id) { + getGameManager()->stopTimer(id); +} + void CTrueTalkNPC::setView(CViewItem *view) { CTrueTalkManager *talkManager = getGameManager()->getTalkManager(); if (talkManager) diff --git a/engines/titanic/npcs/true_talk_npc.h b/engines/titanic/npcs/true_talk_npc.h index b13841b742..23613041d0 100644 --- a/engines/titanic/npcs/true_talk_npc.h +++ b/engines/titanic/npcs/true_talk_npc.h @@ -67,6 +67,11 @@ protected: * Start an animation timer */ int startAnimTimer(const CString &action, uint firstDuration, uint duration); + + /** + * Stop an animation timer + */ + void stopAnimTimer(int id); public: CLASSDEF CTrueTalkNPC(); diff --git a/engines/titanic/support/mouse_cursor.cpp b/engines/titanic/support/mouse_cursor.cpp index 6ebf4f2164..d87e7a499b 100644 --- a/engines/titanic/support/mouse_cursor.cpp +++ b/engines/titanic/support/mouse_cursor.cpp @@ -51,7 +51,8 @@ static const int CURSOR_DATA[NUM_CURSORS][4] = { }; CMouseCursor::CMouseCursor(CScreenManager *screenManager) : - _screenManager(screenManager), _cursorId(CURSOR_HOURGLASS), _setCursorCount(0) { + _screenManager(screenManager), _cursorId(CURSOR_HOURGLASS), + _setCursorCount(0), _fieldE4(0), _fieldE8(0) { loadCursorImages(); setCursor(CURSOR_ARROW); } @@ -129,4 +130,19 @@ void CMouseCursor::update() { // No implementation needed } +void CMouseCursor::lockE4() { + _fieldE4 = 0; + CScreenManager::_screenManagerPtr->_inputHandler->incLockCount(); +} + +void CMouseCursor::unlockE4() { + _fieldE4 = 1; + _fieldE8 = 0; + CScreenManager::_screenManagerPtr->_inputHandler->decLockCount(); +} + +void CMouseCursor::saveState(int v1, int v2, int v3) { + // TODO +} + } // End of namespace Titanic diff --git a/engines/titanic/support/mouse_cursor.h b/engines/titanic/support/mouse_cursor.h index ac5da26382..55e0cb4da5 100644 --- a/engines/titanic/support/mouse_cursor.h +++ b/engines/titanic/support/mouse_cursor.h @@ -62,6 +62,8 @@ private: CursorId _cursorId; CursorEntry _cursors[NUM_CURSORS]; uint _setCursorCount; + int _fieldE4; + int _fieldE8; /** * Load the images for each cursor @@ -95,6 +97,11 @@ public: * Returns the number of times the cursor has been set */ uint getChangeCount() const { return _setCursorCount; } + + void lockE4(); + void unlockE4(); + + void saveState(int v1, int v2, int v3); }; diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index 3b026c546c..c1af869e1e 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -422,6 +422,10 @@ void OSVideoSurface::proc38(int v1, int v2) { warning("OSVideoSurface::proc38"); } +void OSVideoSurface::proc39(int v1, int v2) { + warning("OSVideoSurface::proc39"); +} + bool OSVideoSurface::loadIfReady() { _videoSurfaceNum = _videoSurfaceCounter; diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index 6f707a39ff..2b66b269e7 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -180,6 +180,8 @@ public: virtual void proc38(int v1, int v2) = 0; + virtual void proc39(int v1, int v2) = 0; + /** * Loads the surface's resource if there's one pending */ @@ -347,6 +349,8 @@ public: virtual void proc38(int v1, int v2); + virtual void proc39(int v1, int v2); + /** * Loads the surface's resource if there's one pending */ -- cgit v1.2.3 From 4db07ba145f75cdcf65a88b136790abc891b2745 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 27 Jun 2016 22:03:46 -0400 Subject: TITANIC: Add mouse down/up generation methods --- engines/titanic/messages/mouse_messages.cpp | 48 +++++++++++++++++++++++++++++ engines/titanic/messages/mouse_messages.h | 10 ++++++ engines/titanic/module.mk | 1 + 3 files changed, 59 insertions(+) create mode 100644 engines/titanic/messages/mouse_messages.cpp diff --git a/engines/titanic/messages/mouse_messages.cpp b/engines/titanic/messages/mouse_messages.cpp new file mode 100644 index 0000000000..8ef7f38fd3 --- /dev/null +++ b/engines/titanic/messages/mouse_messages.cpp @@ -0,0 +1,48 @@ +/* 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 "titanic/messages/mouse_messages.h" +#include "titanic/support/mouse_cursor.h" +#include "titanic/support/screen_manager.h" +#include "titanic/titanic.h" + +namespace Titanic { + +void CMouseButtonDownMsg::generate() { + CInputHandler &inputHandler = *CScreenManager::_screenManagerPtr->_inputHandler; + const Point &mousePos = inputHandler._mousePos; + + CMouseButtonDownMsg msg(mousePos, MB_LEFT); + inputHandler.handleMessage(msg, false); +} + +/*------------------------------------------------------------------------*/ + +void CMouseButtonUpMsg::generate() { + CInputHandler &inputHandler = *CScreenManager::_screenManagerPtr->_inputHandler; + const Point &mousePos = inputHandler._mousePos; + + CMouseButtonUpMsg msg(mousePos, MB_LEFT); + inputHandler.handleMessage(msg, false); +} + +} // End of namespace Titanic diff --git a/engines/titanic/messages/mouse_messages.h b/engines/titanic/messages/mouse_messages.h index 4f568cd682..8d5aa8bced 100644 --- a/engines/titanic/messages/mouse_messages.h +++ b/engines/titanic/messages/mouse_messages.h @@ -78,6 +78,11 @@ public: static bool isSupportedBy(const CTreeItem *item) { return supports(item, _type); } + + /** + * Generate a dummy mouse down message at the current mouse position + */ + static void generate(); }; class CMouseButtonUpMsg : public CMouseButtonMsg { @@ -89,6 +94,11 @@ public: static bool isSupportedBy(const CTreeItem *item) { return supports(item, _type); } + + /** + * Generate a dummy mouse up message at the current mouse position + */ + static void generate(); }; class CMouseDoubleClickMsg : public CMouseButtonMsg { diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 881aa025ef..28be2495c3 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -317,6 +317,7 @@ MODULE_OBJS := \ messages/bilge_dispensor_event.o \ messages/door_auto_sound_event.o \ messages/messages.o \ + messages/mouse_messages.o \ messages/service_elevator_door.o \ moves/enter_bomb_room.o \ moves/enter_bridge.o \ -- cgit v1.2.3 From 0715be79269a0830136f76e78da2e893ce2e2ed4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 27 Jun 2016 23:48:13 -0400 Subject: TITANIC: Added CGameObject text methods --- engines/titanic/core/game_object.cpp | 101 +++++++++++++++++++++++++++---- engines/titanic/core/game_object.h | 58 +++++++++++++++++- engines/titanic/pet_control/pet_text.cpp | 14 +++++ engines/titanic/pet_control/pet_text.h | 20 ++++-- engines/titanic/support/movie.cpp | 4 ++ engines/titanic/support/movie.h | 10 +++ 6 files changed, 188 insertions(+), 19 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 9c5f9db3b4..66417ac630 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -69,14 +69,18 @@ CGameObject::CGameObject(): CNamedItem() { _cursorId = CURSOR_ARROW; _initialFrame = 0; _frameNumber = -1; - _field90 = 0; - _field94 = 0; - _field98 = 0; + _text = nullptr; + _textBorder = _textBorderRight = 0; _field9C = 0; _surface = nullptr; _fieldB8 = 0; } +CGameObject::~CGameObject() { + delete _surface; + delete _text; +} + void CGameObject::save(SimpleFile *file, int indent) const { file->writeNumberLine(7, indent); error("TODO: CGameObject::save"); @@ -151,12 +155,12 @@ void CGameObject::draw(CScreenManager *screenManager) { } if (_field40) { - if (_field90) { - if (_bounds.intersects(getGameManager()->_bounds)) - warning("TODO: _field90(screenManager);"); - } - } - else { + // If a text object is defined, handle drawing it + if (_text && _bounds.intersects(getGameManager()->_bounds)) + _text->draw(screenManager); + + return; + } else { if (!_surface) { if (!_resource.empty()) { loadResource(_resource); @@ -185,8 +189,8 @@ void CGameObject::draw(CScreenManager *screenManager) { screenManager->blitFrom(SURFACE_BACKBUFFER, _surface, &destPos); } - if (_field90) - warning("TODO: sub_415f80(screenManager);"); + if (_text) + _text->draw(screenManager); } } } @@ -358,6 +362,21 @@ void CGameObject::loadFrame(int frameNumber) { makeDirty(); } +void CGameObject::playMovie(int v1, int v2) { + if (_surface && !_resource.empty()) { + loadResource(_resource); + _resource.clear(); + } + + if (_surface && _surface->loadIfReady()) { + if (_surface->_movie) { + disableMouse(); + _surface->_movie->play(_bounds, v1, v2); + enableMouse(); + } + } +} + void CGameObject::processClipList2() { for (CMovieClipList::iterator i = _clipList2.begin(); i != _clipList2.end(); ++i) (*i)->process(this); @@ -869,6 +888,66 @@ void CGameObject::surface39(int v1, int v2) { _surface->proc39(v1, v2); } +void CGameObject::setTextBorder(const CString &str, int border, int borderRight) { + if (!_text) + _text = new CPetText(); + _textBorder = border; + _textBorderRight = borderRight; + + _text->setText(str); + CScreenManager *screenManager = getGameManager()->setScreenManager(); + _text->scrollToTop(screenManager); +} + +void CGameObject::setTextHasBorders(bool hasBorders) { + if (!_text) + _text = new CPetText(); + + _text->setHasBorder(hasBorders); +} + +void CGameObject::setTextBounds() { + Rect rect = _bounds; + rect.grow(_textBorder); + rect.right -= _textBorderRight; + + _text->setBounds(rect); + makeDirty(); +} + +void CGameObject::setTextColor(byte r, byte g, byte b) { + if (!_text) + _text = new CPetText(); + + _text->setColor(r, g, b); +} + +void CGameObject::setTextFontNumber(int fontNumber) { + if (!_text) + _text = new CPetText(); + + _text->setFontNumber(fontNumber); +} + +int CGameObject::getTextWidth() const { + assert(_text); + return _text->getTextWidth(CScreenManager::_screenManagerPtr); +} + +CTextCursor *CGameObject::getTextCursor() const { + return CScreenManager::_screenManagerPtr->_textCursor; +} + +void CGameObject::scrollTextUp() { + if (_text) + _text->scrollUp(CScreenManager::_screenManagerPtr); +} + +void CGameObject::scrollTextDown() { + if (_text) + _text->scrollDown(CScreenManager::_screenManagerPtr); +} + void CGameObject::lockMouse() { CGameManager *gameMan = getGameManager(); gameMan->lockInputHandler(); diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 02168c9f00..145b81ee65 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -30,6 +30,7 @@ #include "titanic/core/movie_clip.h" #include "titanic/core/named_item.h" #include "titanic/pet_control/pet_section.h" +#include "titanic/pet_control/pet_text.h" namespace Titanic { @@ -87,9 +88,9 @@ protected: int _initialFrame; CMovieClipList _clipList2; int _frameNumber; - int _field90; - int _field94; - int _field98; + CPetText *_text; + uint _textBorder; + uint _textBorderRight; int _field9C; Common::Point _savedPos; CVideoSurface *_surface; @@ -288,6 +289,11 @@ protected: void sound8(bool flag) const; + /** + * Plays a movie + */ + void playMovie(int v1, int v2); + /** * Play an arbitrary clip */ @@ -441,6 +447,51 @@ protected: int stateGet24(); void surface39(int v1, int v2); + + /** + * Set up the text borders for the object + */ + void setTextBorder(const CString &str, int border = 0, int borderRight = 0); + + /** + * Sets whether the text will use borders + */ + void setTextHasBorders(bool hasBorders); + + /** + * Sets the bounds for a previously defined text area + */ + void setTextBounds(); + + /** + * Sets the color for the object's text + */ + void setTextColor(byte r, byte g, byte b); + + /** + * Sets the font number to use for text + */ + void setTextFontNumber(int fontNumber); + + /** + * Gets the width of the text contents + */ + int getTextWidth() const; + + /** + * Returns the text cursor + */ + CTextCursor *getTextCursor() const; + + /** + * Scroll text up + */ + void scrollTextUp(); + + /** + * Scroll text down + */ + void scrollTextDown(); public: bool _isMail; int _id; @@ -461,6 +512,7 @@ public: public: CLASSDEF CGameObject(); + ~CGameObject(); /** * Save the data for the class to file diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index f87b037109..fa7441c988 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -277,6 +277,15 @@ void CPetText::updateStr3(int lineNum) { } } +int CPetText::getTextWidth(CScreenManager *screenManager) { + mergeStrings(); + int oldFontNumber = screenManager->setFontNumber(_fontNumber); + int textWidth = screenManager->stringWidth(_lines); + screenManager->setFontNumber(oldFontNumber); + + return textWidth; +} + int CPetText::getTextHeight(CScreenManager *screenManager) { mergeStrings(); int oldFontNumber = screenManager->setFontNumber(_fontNumber); @@ -459,4 +468,9 @@ int CPetText::getNPCNum(uint npcId, uint startIndex) { return - 1; } +void CPetText::setFontNumber(int fontNumber) { + if (fontNumber >= 0 && fontNumber <= 2) + _fontNumber = fontNumber; +} + } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h index 930bf3da8b..2a6e24ddb8 100644 --- a/engines/titanic/pet_control/pet_text.h +++ b/engines/titanic/pet_control/pet_text.h @@ -78,11 +78,6 @@ private: void updateStr3(int lineNum); - /** - * Get the required height to draw the text - */ - int getTextHeight(CScreenManager *screenManager); - /** * Ensures the Y scrolling for the text is in the valid range */ @@ -253,6 +248,21 @@ public: * first list with the entry at the same index in the dest list */ void remapColors(uint count, uint *srcColors, uint *destColors); + + /** + * Set the font number to use + */ + void setFontNumber(int fontNumber); + + /** + * Get the width of the text + */ + int getTextWidth(CScreenManager *screenManager); + + /** + * Get the required height to draw the text + */ + int getTextHeight(CScreenManager *screenManager); }; } // End of namespace Titanic diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index cde3b22a8c..27bcb97ae9 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -87,6 +87,10 @@ void OSMovie::play(uint startFrame, uint endFrame, int v3, bool v4) { _state = MOVIE_NONE; } +void OSMovie::play(const Rect &rect, int v1, int v2) { + warning("TODO: OSMovie::play 3"); +} + void OSMovie::playClip(const Rect &rect, uint startFrame, uint endFrame) { warning("TODO: OSMovie::playClip"); } diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index 61dd4cf61d..da3285547d 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -60,6 +60,11 @@ public: * Plays the movie */ virtual void play(uint startFrame, uint endFrame, int v3, bool v4) = 0; + + /** + * Plays the movie + */ + virtual void play(const Rect &rect, int v1, int v2) = 0; /** * Plays a sub-section of a movie @@ -123,6 +128,11 @@ public: */ virtual void play(uint startFrame, uint endFrame, int v3, bool v4); + /** + * Plays the movie + */ + virtual void play(const Rect &rect, int v1, int v2); + /** * Plays a sub-section of a movie */ -- cgit v1.2.3 From 5c2a39e74ac1cf8b67e17fe25e00bcca487c9f99 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 28 Jun 2016 21:18:13 -0400 Subject: TITANIC: Set up empty message targets for classes without messages --- engines/titanic/carry/brain.cpp | 2 +- engines/titanic/carry/feathers.cpp | 3 +- engines/titanic/carry/hose_end.cpp | 2 ++ engines/titanic/carry/hose_end.h | 1 + engines/titanic/carry/parcel.cpp | 3 +- engines/titanic/core/dont_save_file_item.cpp | 2 ++ engines/titanic/core/dont_save_file_item.h | 1 + engines/titanic/core/file_item.cpp | 2 ++ engines/titanic/core/file_item.h | 1 + engines/titanic/core/game_object.cpp | 31 ++++++++++------- engines/titanic/core/game_object.h | 16 ++++++--- engines/titanic/core/link_item.cpp | 2 ++ engines/titanic/core/link_item.h | 1 + engines/titanic/core/message_target.h | 15 +++++++++ engines/titanic/core/named_item.cpp | 3 +- engines/titanic/core/node_item.cpp | 2 ++ engines/titanic/core/node_item.h | 1 + engines/titanic/core/project_item.cpp | 2 ++ engines/titanic/core/project_item.h | 3 +- engines/titanic/core/room_item.cpp | 2 ++ engines/titanic/core/room_item.h | 1 + engines/titanic/core/static_image.cpp | 2 ++ engines/titanic/core/static_image.h | 1 + engines/titanic/core/tree_item.cpp | 3 +- engines/titanic/game/arb_background.cpp | 2 ++ engines/titanic/game/arb_background.h | 1 + engines/titanic/game/broken_pell_base.cpp | 2 ++ engines/titanic/game/broken_pell_base.h | 1 + engines/titanic/game/leave_sec_class_state.cpp | 2 ++ engines/titanic/game/leave_sec_class_state.h | 1 + engines/titanic/game/music_room_phonograph.cpp | 2 ++ engines/titanic/game/music_room_phonograph.h | 1 + engines/titanic/game/musical_instrument.cpp | 2 ++ engines/titanic/game/musical_instrument.h | 1 + engines/titanic/game/navigation_computer.cpp | 2 ++ engines/titanic/game/navigation_computer.h | 1 + engines/titanic/game/null_port_hole.cpp | 2 ++ engines/titanic/game/null_port_hole.h | 1 + .../titanic/game/parrot/parrot_lobby_object.cpp | 2 ++ engines/titanic/game/parrot/parrot_lobby_object.h | 1 + engines/titanic/game/pet/pet_class1.cpp | 2 ++ engines/titanic/game/pet/pet_class1.h | 1 + engines/titanic/game/pet/pet_class2.cpp | 2 ++ engines/titanic/game/pet/pet_class2.h | 1 + engines/titanic/game/pet/pet_class3.cpp | 2 ++ engines/titanic/game/pet/pet_class3.h | 1 + engines/titanic/game/splash_animation.cpp | 2 ++ engines/titanic/game/splash_animation.h | 1 + engines/titanic/game/transport/transport.cpp | 2 ++ engines/titanic/game/transport/transport.h | 1 + engines/titanic/gfx/chev_left_off.cpp | 2 ++ engines/titanic/gfx/chev_left_off.h | 1 + engines/titanic/gfx/chev_left_on.cpp | 2 ++ engines/titanic/gfx/chev_left_on.h | 1 + engines/titanic/gfx/chev_right_off.cpp | 2 ++ engines/titanic/gfx/chev_right_off.h | 1 + engines/titanic/gfx/chev_right_on.cpp | 2 ++ engines/titanic/gfx/chev_right_on.h | 1 + engines/titanic/gfx/chev_send_rec_switch.cpp | 2 ++ engines/titanic/gfx/chev_send_rec_switch.h | 1 + engines/titanic/gfx/elevator_button.cpp | 2 ++ engines/titanic/gfx/elevator_button.h | 1 + engines/titanic/gfx/get_from_succ.cpp | 2 ++ engines/titanic/gfx/get_from_succ.h | 1 + engines/titanic/gfx/helmet_on_off.cpp | 2 ++ engines/titanic/gfx/helmet_on_off.h | 1 + engines/titanic/gfx/home_photo.cpp | 2 ++ engines/titanic/gfx/home_photo.h | 1 + engines/titanic/gfx/icon_nav_action.cpp | 2 ++ engines/titanic/gfx/icon_nav_action.h | 1 + engines/titanic/gfx/icon_nav_butt.cpp | 2 ++ engines/titanic/gfx/icon_nav_butt.h | 1 + engines/titanic/gfx/icon_nav_down.cpp | 2 ++ engines/titanic/gfx/icon_nav_down.h | 1 + engines/titanic/gfx/icon_nav_image.cpp | 2 ++ engines/titanic/gfx/icon_nav_image.h | 1 + engines/titanic/gfx/icon_nav_left.cpp | 2 ++ engines/titanic/gfx/icon_nav_left.h | 1 + engines/titanic/gfx/icon_nav_receive.cpp | 2 ++ engines/titanic/gfx/icon_nav_receive.h | 1 + engines/titanic/gfx/icon_nav_right.cpp | 2 ++ engines/titanic/gfx/icon_nav_right.h | 1 + engines/titanic/gfx/icon_nav_send.cpp | 2 ++ engines/titanic/gfx/icon_nav_send.h | 1 + engines/titanic/gfx/icon_nav_up.cpp | 2 ++ engines/titanic/gfx/icon_nav_up.h | 1 + engines/titanic/gfx/keybrd_butt.cpp | 2 ++ engines/titanic/gfx/keybrd_butt.h | 1 + engines/titanic/gfx/music_slider.cpp | 39 ++++++++++++++++++++++ engines/titanic/gfx/music_slider.h | 11 ++---- engines/titanic/gfx/music_switch.cpp | 39 ++++++++++++++++++++++ engines/titanic/gfx/music_switch.h | 11 ++---- engines/titanic/gfx/send_to_succ.cpp | 2 ++ engines/titanic/gfx/send_to_succ.h | 1 + engines/titanic/gfx/sgt_selector.cpp | 2 ++ engines/titanic/gfx/sgt_selector.h | 1 + engines/titanic/gfx/small_chev_left_off.cpp | 2 ++ engines/titanic/gfx/small_chev_left_off.h | 1 + engines/titanic/gfx/small_chev_left_on.cpp | 2 ++ engines/titanic/gfx/small_chev_left_on.h | 1 + engines/titanic/gfx/small_chev_right_off.cpp | 2 ++ engines/titanic/gfx/small_chev_right_off.h | 1 + engines/titanic/gfx/small_chev_right_on.cpp | 2 ++ engines/titanic/gfx/small_chev_right_on.h | 1 + engines/titanic/gfx/text_down.cpp | 2 ++ engines/titanic/gfx/text_down.h | 1 + engines/titanic/gfx/text_skrew.cpp | 2 ++ engines/titanic/gfx/text_skrew.h | 1 + engines/titanic/gfx/text_up.cpp | 2 ++ engines/titanic/gfx/text_up.h | 1 + engines/titanic/gfx/toggle_button.cpp | 2 ++ engines/titanic/gfx/toggle_button.h | 1 + engines/titanic/module.mk | 2 ++ engines/titanic/npcs/mobile.cpp | 2 ++ engines/titanic/npcs/mobile.h | 1 + engines/titanic/npcs/true_talk_npc.cpp | 12 +++++++ engines/titanic/npcs/true_talk_npc.h | 5 +++ engines/titanic/pet_control/pet_graphic.cpp | 3 +- engines/titanic/pet_control/pet_graphic2.cpp | 3 +- engines/titanic/pet_control/pet_leaf.cpp | 2 ++ engines/titanic/pet_control/pet_leaf.h | 1 + engines/titanic/pet_control/pet_mode_off.cpp | 3 +- engines/titanic/pet_control/pet_mode_on.cpp | 3 +- engines/titanic/pet_control/pet_mode_panel.cpp | 3 +- engines/titanic/pet_control/pet_pannel1.cpp | 3 +- engines/titanic/pet_control/pet_pannel2.cpp | 3 +- engines/titanic/pet_control/pet_pannel3.cpp | 3 +- engines/titanic/sound/dome_from_top_of_well.cpp | 2 ++ engines/titanic/sound/dome_from_top_of_well.h | 1 + engines/titanic/sound/water_lapping_sounds.cpp | 2 ++ engines/titanic/sound/water_lapping_sounds.h | 1 + 131 files changed, 323 insertions(+), 60 deletions(-) create mode 100644 engines/titanic/gfx/music_slider.cpp create mode 100644 engines/titanic/gfx/music_switch.cpp diff --git a/engines/titanic/carry/brain.cpp b/engines/titanic/carry/brain.cpp index a60e652bda..1fe0c1b5d8 100644 --- a/engines/titanic/carry/brain.cpp +++ b/engines/titanic/carry/brain.cpp @@ -123,7 +123,7 @@ bool CBrain::PassOnDragStartMsg(CPassOnDragStartMsg *msg) { bool CBrain::PETGainedObjectMsg(CPETGainedObjectMsg *msg) { if (!_field138) { if (getName() == "Perch") { - incState38(); + stateInc38(); _field138 = 1; } } diff --git a/engines/titanic/carry/feathers.cpp b/engines/titanic/carry/feathers.cpp index a738d74249..e89f33564b 100644 --- a/engines/titanic/carry/feathers.cpp +++ b/engines/titanic/carry/feathers.cpp @@ -24,8 +24,7 @@ namespace Titanic { -BEGIN_MESSAGE_MAP(CFeathers, CCarry) -END_MESSAGE_MAP() +EMPTY_MESSAGE_MAP(CFeathers, CCarry) CFeathers::CFeathers() : CCarry() { } diff --git a/engines/titanic/carry/hose_end.cpp b/engines/titanic/carry/hose_end.cpp index 97d75b0ac4..6f15d5be1b 100644 --- a/engines/titanic/carry/hose_end.cpp +++ b/engines/titanic/carry/hose_end.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CHoseEnd, CHose) + CHoseEnd::CHoseEnd() : CHose() { _string6 = "Connection refused by remote hose."; } diff --git a/engines/titanic/carry/hose_end.h b/engines/titanic/carry/hose_end.h index d9efb594bc..796191e12f 100644 --- a/engines/titanic/carry/hose_end.h +++ b/engines/titanic/carry/hose_end.h @@ -28,6 +28,7 @@ namespace Titanic { class CHoseEnd : public CHose { + DECLARE_MESSAGE_MAP public: CLASSDEF CHoseEnd(); diff --git a/engines/titanic/carry/parcel.cpp b/engines/titanic/carry/parcel.cpp index 275c982d63..d532bac92b 100644 --- a/engines/titanic/carry/parcel.cpp +++ b/engines/titanic/carry/parcel.cpp @@ -24,8 +24,7 @@ namespace Titanic { -BEGIN_MESSAGE_MAP(CParcel, CCarry) -END_MESSAGE_MAP() +EMPTY_MESSAGE_MAP(CParcel, CCarry) CParcel::CParcel() : CCarry() { } diff --git a/engines/titanic/core/dont_save_file_item.cpp b/engines/titanic/core/dont_save_file_item.cpp index 389cef5a9c..00b7dd22ce 100644 --- a/engines/titanic/core/dont_save_file_item.cpp +++ b/engines/titanic/core/dont_save_file_item.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CDontSaveFileItem, CFileItem) + void CDontSaveFileItem::save(SimpleFile *file, int indent) const { file->writeNumberLine(0, indent); } diff --git a/engines/titanic/core/dont_save_file_item.h b/engines/titanic/core/dont_save_file_item.h index d4d5da2e4b..7517976825 100644 --- a/engines/titanic/core/dont_save_file_item.h +++ b/engines/titanic/core/dont_save_file_item.h @@ -28,6 +28,7 @@ namespace Titanic { class CDontSaveFileItem : public CFileItem { + DECLARE_MESSAGE_MAP public: CLASSDEF diff --git a/engines/titanic/core/file_item.cpp b/engines/titanic/core/file_item.cpp index 0d3316dbf3..566f9104a9 100644 --- a/engines/titanic/core/file_item.cpp +++ b/engines/titanic/core/file_item.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CFileItem, CTreeItem) + void CFileItem::save(SimpleFile *file, int indent) const { file->writeNumberLine(0, indent); CTreeItem::save(file, indent); diff --git a/engines/titanic/core/file_item.h b/engines/titanic/core/file_item.h index 34ba0ae683..e8e4935de0 100644 --- a/engines/titanic/core/file_item.h +++ b/engines/titanic/core/file_item.h @@ -30,6 +30,7 @@ namespace Titanic { class CFileItem: public CTreeItem { + DECLARE_MESSAGE_MAP private: CString _filename; public: diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 66417ac630..d1f3a32493 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -35,8 +35,7 @@ namespace Titanic { -BEGIN_MESSAGE_MAP(CGameObject, CNamedItem) -END_MESSAGE_MAP() +EMPTY_MESSAGE_MAP(CGameObject, CNamedItem) CCreditText *CGameObject::_credits; @@ -424,6 +423,10 @@ void CGameObject::soundFn5(int v1, int v2, int v3) { warning("CGameObject::soundFn5"); } +void CGameObject::sound8(bool flag) const { + getGameManager()->_sound.managerProc8(flag ? 3 : 0); +} + void CGameObject::setVisible(bool val) { if (val != _visible) { _visible = val; @@ -582,10 +585,6 @@ int CGameObject::getSurface45() const { return _surface ? _surface->proc45() : 0; } -void CGameObject::sound8(bool flag) const { - getGameManager()->_sound.managerProc8(flag ? 3 : 0); -} - void CGameObject::loadSound(const CString &name) { CGameManager *gameManager = getGameManager(); if (gameManager) { @@ -855,15 +854,11 @@ void CGameObject::moveToView(const CString &name) { view->addUnder(this); } -void CGameObject::incState38() { - getGameManager()->_gameState.inc38(); -} - void CGameObject::stateInc14() { getGameManager()->_gameState.inc14(); } -int CGameObject::stateGet14() { +int CGameObject::stateGet14() const { return getGameManager()->_gameState._field14; } @@ -871,10 +866,22 @@ void CGameObject::stateSet24() { getGameManager()->_gameState.set24(1); } -int CGameObject::stateGet24() { +int CGameObject::stateGet24() const { return getGameManager()->_gameState.get24(); } +void CGameObject::stateInc38() { + getGameManager()->_gameState.inc38(); +} + +int CGameObject::stateGet38() const { + return getGameManager()->_gameState._field38; +} + +void CGameObject::quitGame() { + getGameManager()->_gameState._quitGame = true; +} + void CGameObject::inc54() { getGameManager()->inc54(); } diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 145b81ee65..ade8800e5d 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -201,6 +201,8 @@ protected: void soundFn5(int v1, int v2, int v3); + void sound8(bool flag) const; + /** * Adds a timer */ @@ -287,8 +289,6 @@ protected: */ Point getControid() const; - void sound8(bool flag) const; - /** * Plays a movie */ @@ -440,11 +440,17 @@ protected: void petUnlockInput(); void setState1C(bool flag); - void incState38(); void stateInc14(); - int stateGet14(); + int stateGet14() const; void stateSet24(); - int stateGet24(); + int stateGet24() const; + void stateInc38(); + int stateGet38() const; + + /** + * Flag to quit the game + */ + void quitGame(); void surface39(int v1, int v2); diff --git a/engines/titanic/core/link_item.cpp b/engines/titanic/core/link_item.cpp index b172b9b4d0..a0460bd2c6 100644 --- a/engines/titanic/core/link_item.cpp +++ b/engines/titanic/core/link_item.cpp @@ -27,6 +27,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CLinkItem, CNamedItem) + CLinkItem::CLinkItem() : CNamedItem() { _roomNumber = -1; _nodeNumber = -1; diff --git a/engines/titanic/core/link_item.h b/engines/titanic/core/link_item.h index 25de74104b..9c376396f7 100644 --- a/engines/titanic/core/link_item.h +++ b/engines/titanic/core/link_item.h @@ -34,6 +34,7 @@ class CNodeItem; class CRoomItem; class CLinkItem : public CNamedItem { + DECLARE_MESSAGE_MAP private: /** * Returns a new name for the link item, based on the diff --git a/engines/titanic/core/message_target.h b/engines/titanic/core/message_target.h index 0f43bcd2c5..e5bdf3e08a 100644 --- a/engines/titanic/core/message_target.h +++ b/engines/titanic/core/message_target.h @@ -68,6 +68,21 @@ protected: \ return &messageMap; \ } +#define EMPTY_MESSAGE_MAP(theClass, baseClass) \ + const MSGMAP *theClass::getMessageMap() const \ + { return getThisMessageMap(); } \ + const MSGMAP *theClass::getThisMessageMap() \ + { \ + typedef theClass ThisClass; \ + typedef baseClass TheBaseClass; \ + static const MSGMAP_ENTRY _messageEntries[] = { \ + { (PMSG)nullptr, nullptr } \ + }; \ + static const MSGMAP messageMap = \ + { &TheBaseClass::getThisMessageMap, &_messageEntries[0] }; \ + return &messageMap; \ + } + class CMessageTarget: public CSaveableObject { DECLARE_MESSAGE_MAP public: diff --git a/engines/titanic/core/named_item.cpp b/engines/titanic/core/named_item.cpp index 72d3fd9f42..981627a280 100644 --- a/engines/titanic/core/named_item.cpp +++ b/engines/titanic/core/named_item.cpp @@ -27,8 +27,7 @@ namespace Titanic { -BEGIN_MESSAGE_MAP(CNamedItem, CTreeItem) -END_MESSAGE_MAP() +EMPTY_MESSAGE_MAP(CNamedItem, CTreeItem) CString CNamedItem::dumpItem(int indent) const { CString result = CTreeItem::dumpItem(indent); diff --git a/engines/titanic/core/node_item.cpp b/engines/titanic/core/node_item.cpp index 6b7d6452cb..57acbdb3b8 100644 --- a/engines/titanic/core/node_item.cpp +++ b/engines/titanic/core/node_item.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CNodeItem, CNamedItem) + CNodeItem::CNodeItem() : CNamedItem(), _nodeNumber(0) { } diff --git a/engines/titanic/core/node_item.h b/engines/titanic/core/node_item.h index 32db1c1401..85003bf97c 100644 --- a/engines/titanic/core/node_item.h +++ b/engines/titanic/core/node_item.h @@ -28,6 +28,7 @@ namespace Titanic { class CNodeItem : public CNamedItem { + DECLARE_MESSAGE_MAP public: int _nodeNumber; Point _nodePos; diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp index c6a5c2eb61..586301b9f4 100644 --- a/engines/titanic/core/project_item.cpp +++ b/engines/titanic/core/project_item.cpp @@ -41,6 +41,8 @@ namespace Titanic { static const char *const SAVEGAME_STR = "TNIC"; #define SAVEGAME_STR_SIZE 4 +EMPTY_MESSAGE_MAP(CProjectItem, CFileItem) + void CFileListItem::save(SimpleFile *file, int indent) const { file->writeNumberLine(0, indent); file->writeQuotedLine(_name, indent); diff --git a/engines/titanic/core/project_item.h b/engines/titanic/core/project_item.h index 213fa9d638..d0b8d77598 100644 --- a/engines/titanic/core/project_item.h +++ b/engines/titanic/core/project_item.h @@ -73,11 +73,10 @@ public: * Filename list */ class CFileList: public List { -public: }; - class CProjectItem : public CFileItem { + DECLARE_MESSAGE_MAP private: CString _filename; CFileList _files; diff --git a/engines/titanic/core/room_item.cpp b/engines/titanic/core/room_item.cpp index e33d0c41dd..b3a3fe41cc 100644 --- a/engines/titanic/core/room_item.cpp +++ b/engines/titanic/core/room_item.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CRoomItem, CNamedItem) + CRoomItem::CRoomItem() : CNamedItem(), _roomNumber(0), _roomDimensionX(0.0), _roomDimensionY(0.0) { } diff --git a/engines/titanic/core/room_item.h b/engines/titanic/core/room_item.h index 4692318419..f44a525b60 100644 --- a/engines/titanic/core/room_item.h +++ b/engines/titanic/core/room_item.h @@ -32,6 +32,7 @@ namespace Titanic { class CRoomItem : public CNamedItem { + DECLARE_MESSAGE_MAP private: /** * Handles post-load processing diff --git a/engines/titanic/core/static_image.cpp b/engines/titanic/core/static_image.cpp index 54a041fff5..cc8e1ddc1a 100644 --- a/engines/titanic/core/static_image.cpp +++ b/engines/titanic/core/static_image.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CStaticImage, CGameObject) + void CStaticImage::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/core/static_image.h b/engines/titanic/core/static_image.h index 2b0a3ad071..953cf4d6bf 100644 --- a/engines/titanic/core/static_image.h +++ b/engines/titanic/core/static_image.h @@ -28,6 +28,7 @@ namespace Titanic { class CStaticImage : public CGameObject { + DECLARE_MESSAGE_MAP public: CLASSDEF diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index 190dc997e7..21496ee8a5 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -38,8 +38,7 @@ namespace Titanic { -BEGIN_MESSAGE_MAP(CTreeItem, CMessageTarget) -END_MESSAGE_MAP() +EMPTY_MESSAGE_MAP(CTreeItem, CMessageTarget) CTreeItem::CTreeItem() : _parent(nullptr), _firstChild(nullptr), _nextSibling(nullptr), _priorSibling(nullptr), _field14(0) { diff --git a/engines/titanic/game/arb_background.cpp b/engines/titanic/game/arb_background.cpp index 54e9c17e3c..07558157f0 100644 --- a/engines/titanic/game/arb_background.cpp +++ b/engines/titanic/game/arb_background.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CArbBackground, CBackground) + CArbBackground::CArbBackground() : CBackground(), _fieldE0(0), _fieldE4(61), _fieldE8(62), _fieldEC(118) { } diff --git a/engines/titanic/game/arb_background.h b/engines/titanic/game/arb_background.h index 50a9075750..a5850afc0f 100644 --- a/engines/titanic/game/arb_background.h +++ b/engines/titanic/game/arb_background.h @@ -28,6 +28,7 @@ namespace Titanic { class CArbBackground : public CBackground { + DECLARE_MESSAGE_MAP public: int _fieldE0; int _fieldE4; diff --git a/engines/titanic/game/broken_pell_base.cpp b/engines/titanic/game/broken_pell_base.cpp index 2d11e544e2..8b8e0b9db5 100644 --- a/engines/titanic/game/broken_pell_base.cpp +++ b/engines/titanic/game/broken_pell_base.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CBrokenPellBase, CBackground) + int CBrokenPellBase::_v1; int CBrokenPellBase::_v2; diff --git a/engines/titanic/game/broken_pell_base.h b/engines/titanic/game/broken_pell_base.h index 46e7a70581..45b6594301 100644 --- a/engines/titanic/game/broken_pell_base.h +++ b/engines/titanic/game/broken_pell_base.h @@ -28,6 +28,7 @@ namespace Titanic { class CBrokenPellBase : public CBackground { + DECLARE_MESSAGE_MAP private: static int _v1; static int _v2; diff --git a/engines/titanic/game/leave_sec_class_state.cpp b/engines/titanic/game/leave_sec_class_state.cpp index cbeb872dc8..922bd98c70 100644 --- a/engines/titanic/game/leave_sec_class_state.cpp +++ b/engines/titanic/game/leave_sec_class_state.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CLeaveSecClassState, CGameObject) + void CLeaveSecClassState::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/game/leave_sec_class_state.h b/engines/titanic/game/leave_sec_class_state.h index 34ba31b6c0..5f77436ed1 100644 --- a/engines/titanic/game/leave_sec_class_state.h +++ b/engines/titanic/game/leave_sec_class_state.h @@ -28,6 +28,7 @@ namespace Titanic { class CLeaveSecClassState : public CGameObject { + DECLARE_MESSAGE_MAP public: CLASSDEF diff --git a/engines/titanic/game/music_room_phonograph.cpp b/engines/titanic/game/music_room_phonograph.cpp index 7fa30f5dcf..c08b23006f 100644 --- a/engines/titanic/game/music_room_phonograph.cpp +++ b/engines/titanic/game/music_room_phonograph.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CMusicRoomPhonograph, CRestaurantPhonograph) + void CMusicRoomPhonograph::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); file->writeNumberLine(_field118, indent); diff --git a/engines/titanic/game/music_room_phonograph.h b/engines/titanic/game/music_room_phonograph.h index 6660503616..cad59f35b3 100644 --- a/engines/titanic/game/music_room_phonograph.h +++ b/engines/titanic/game/music_room_phonograph.h @@ -28,6 +28,7 @@ namespace Titanic { class CMusicRoomPhonograph : public CRestaurantPhonograph { + DECLARE_MESSAGE_MAP private: int _field118; public: diff --git a/engines/titanic/game/musical_instrument.cpp b/engines/titanic/game/musical_instrument.cpp index 6695104aba..6480f9f8d1 100644 --- a/engines/titanic/game/musical_instrument.cpp +++ b/engines/titanic/game/musical_instrument.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CMusicalInstrument, CBackground) + void CMusicalInstrument::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CBackground::save(file, indent); diff --git a/engines/titanic/game/musical_instrument.h b/engines/titanic/game/musical_instrument.h index b4abe4fdb2..5bc7446f13 100644 --- a/engines/titanic/game/musical_instrument.h +++ b/engines/titanic/game/musical_instrument.h @@ -28,6 +28,7 @@ namespace Titanic { class CMusicalInstrument : public CBackground { + DECLARE_MESSAGE_MAP public: CLASSDEF diff --git a/engines/titanic/game/navigation_computer.cpp b/engines/titanic/game/navigation_computer.cpp index be2f189083..7e04f848fc 100644 --- a/engines/titanic/game/navigation_computer.cpp +++ b/engines/titanic/game/navigation_computer.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CNavigationComputer, CGameObject) + void CNavigationComputer::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/game/navigation_computer.h b/engines/titanic/game/navigation_computer.h index a7077f7dcd..5315c882cf 100644 --- a/engines/titanic/game/navigation_computer.h +++ b/engines/titanic/game/navigation_computer.h @@ -28,6 +28,7 @@ namespace Titanic { class CNavigationComputer : public CGameObject { + DECLARE_MESSAGE_MAP public: CLASSDEF diff --git a/engines/titanic/game/null_port_hole.cpp b/engines/titanic/game/null_port_hole.cpp index c437dfea10..93dd7eb64e 100644 --- a/engines/titanic/game/null_port_hole.cpp +++ b/engines/titanic/game/null_port_hole.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CNullPortHole, CClickResponder) + CNullPortHole::CNullPortHole() : CClickResponder() { _string1 = "For a better view, why not visit the Promenade Deck?"; _string2 = "b#48.wav"; diff --git a/engines/titanic/game/null_port_hole.h b/engines/titanic/game/null_port_hole.h index fb07462ea8..be335ef47c 100644 --- a/engines/titanic/game/null_port_hole.h +++ b/engines/titanic/game/null_port_hole.h @@ -28,6 +28,7 @@ namespace Titanic { class CNullPortHole : public CClickResponder { + DECLARE_MESSAGE_MAP public: CLASSDEF CNullPortHole(); diff --git a/engines/titanic/game/parrot/parrot_lobby_object.cpp b/engines/titanic/game/parrot/parrot_lobby_object.cpp index 137f3e2ff9..8090a1d46c 100644 --- a/engines/titanic/game/parrot/parrot_lobby_object.cpp +++ b/engines/titanic/game/parrot/parrot_lobby_object.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CParrotLobbyObject, CGameObject) + int CParrotLobbyObject::_v1; int CParrotLobbyObject::_v2; int CParrotLobbyObject::_v3; diff --git a/engines/titanic/game/parrot/parrot_lobby_object.h b/engines/titanic/game/parrot/parrot_lobby_object.h index 9cc979cd26..5b53276eb0 100644 --- a/engines/titanic/game/parrot/parrot_lobby_object.h +++ b/engines/titanic/game/parrot/parrot_lobby_object.h @@ -28,6 +28,7 @@ namespace Titanic { class CParrotLobbyObject : public CGameObject { + DECLARE_MESSAGE_MAP public: static int _v1; static int _v2; diff --git a/engines/titanic/game/pet/pet_class1.cpp b/engines/titanic/game/pet/pet_class1.cpp index 4bd25560fb..b0407ef6e5 100644 --- a/engines/titanic/game/pet/pet_class1.cpp +++ b/engines/titanic/game/pet/pet_class1.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CPETClass1, CGameObject) + void CPETClass1::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/game/pet/pet_class1.h b/engines/titanic/game/pet/pet_class1.h index 12dfb322b2..e22b2148b5 100644 --- a/engines/titanic/game/pet/pet_class1.h +++ b/engines/titanic/game/pet/pet_class1.h @@ -28,6 +28,7 @@ namespace Titanic { class CPETClass1 : public CGameObject { + DECLARE_MESSAGE_MAP public: CLASSDEF diff --git a/engines/titanic/game/pet/pet_class2.cpp b/engines/titanic/game/pet/pet_class2.cpp index 8399468489..8809f84214 100644 --- a/engines/titanic/game/pet/pet_class2.cpp +++ b/engines/titanic/game/pet/pet_class2.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CPETClass2, CGameObject) + void CPETClass2::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/game/pet/pet_class2.h b/engines/titanic/game/pet/pet_class2.h index 5b96118c7c..529f9534e2 100644 --- a/engines/titanic/game/pet/pet_class2.h +++ b/engines/titanic/game/pet/pet_class2.h @@ -28,6 +28,7 @@ namespace Titanic { class CPETClass2 : public CGameObject { + DECLARE_MESSAGE_MAP public: CLASSDEF diff --git a/engines/titanic/game/pet/pet_class3.cpp b/engines/titanic/game/pet/pet_class3.cpp index 96ce66461f..81ddf8adf8 100644 --- a/engines/titanic/game/pet/pet_class3.cpp +++ b/engines/titanic/game/pet/pet_class3.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CPETClass3, CGameObject) + void CPETClass3::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/game/pet/pet_class3.h b/engines/titanic/game/pet/pet_class3.h index d68cb098ec..d34c9d335e 100644 --- a/engines/titanic/game/pet/pet_class3.h +++ b/engines/titanic/game/pet/pet_class3.h @@ -28,6 +28,7 @@ namespace Titanic { class CPETClass3 : public CGameObject { + DECLARE_MESSAGE_MAP public: CLASSDEF diff --git a/engines/titanic/game/splash_animation.cpp b/engines/titanic/game/splash_animation.cpp index 16cf067629..3d35929e2d 100644 --- a/engines/titanic/game/splash_animation.cpp +++ b/engines/titanic/game/splash_animation.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CSplashAnimation, CGameObject) + void CSplashAnimation::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/game/splash_animation.h b/engines/titanic/game/splash_animation.h index 2f4056231b..9b6322e175 100644 --- a/engines/titanic/game/splash_animation.h +++ b/engines/titanic/game/splash_animation.h @@ -28,6 +28,7 @@ namespace Titanic { class CSplashAnimation : public CGameObject { + DECLARE_MESSAGE_MAP public: CLASSDEF diff --git a/engines/titanic/game/transport/transport.cpp b/engines/titanic/game/transport/transport.cpp index ef31a07367..e00375975b 100644 --- a/engines/titanic/game/transport/transport.cpp +++ b/engines/titanic/game/transport/transport.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CTransport, CMobile) + CTransport::CTransport() : CMobile(), _string1("*.*.*") { } diff --git a/engines/titanic/game/transport/transport.h b/engines/titanic/game/transport/transport.h index faa00b4dd9..b7540add0e 100644 --- a/engines/titanic/game/transport/transport.h +++ b/engines/titanic/game/transport/transport.h @@ -28,6 +28,7 @@ namespace Titanic { class CTransport : public CMobile { + DECLARE_MESSAGE_MAP public: CString _string1; CString _string2; diff --git a/engines/titanic/gfx/chev_left_off.cpp b/engines/titanic/gfx/chev_left_off.cpp index 736cc0d6c4..0ce2d62af3 100644 --- a/engines/titanic/gfx/chev_left_off.cpp +++ b/engines/titanic/gfx/chev_left_off.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CChevLeftOff, CToggleSwitch) + CChevLeftOff::CChevLeftOff() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/chev_left_off.h b/engines/titanic/gfx/chev_left_off.h index 753aba3be0..36a9d2c3ad 100644 --- a/engines/titanic/gfx/chev_left_off.h +++ b/engines/titanic/gfx/chev_left_off.h @@ -28,6 +28,7 @@ namespace Titanic { class CChevLeftOff : public CToggleSwitch { + DECLARE_MESSAGE_MAP public: CLASSDEF CChevLeftOff(); diff --git a/engines/titanic/gfx/chev_left_on.cpp b/engines/titanic/gfx/chev_left_on.cpp index f233c53a43..c3264b794b 100644 --- a/engines/titanic/gfx/chev_left_on.cpp +++ b/engines/titanic/gfx/chev_left_on.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CChevLeftOn, CToggleSwitch) + CChevLeftOn::CChevLeftOn() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/chev_left_on.h b/engines/titanic/gfx/chev_left_on.h index 99126d792c..0de814bfcc 100644 --- a/engines/titanic/gfx/chev_left_on.h +++ b/engines/titanic/gfx/chev_left_on.h @@ -28,6 +28,7 @@ namespace Titanic { class CChevLeftOn : public CToggleSwitch { + DECLARE_MESSAGE_MAP public: CLASSDEF CChevLeftOn(); diff --git a/engines/titanic/gfx/chev_right_off.cpp b/engines/titanic/gfx/chev_right_off.cpp index 7cf3b11d19..60ed2de30c 100644 --- a/engines/titanic/gfx/chev_right_off.cpp +++ b/engines/titanic/gfx/chev_right_off.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CChevRightOff, CToggleSwitch) + CChevRightOff::CChevRightOff() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/chev_right_off.h b/engines/titanic/gfx/chev_right_off.h index 1a31007f19..3714c2b386 100644 --- a/engines/titanic/gfx/chev_right_off.h +++ b/engines/titanic/gfx/chev_right_off.h @@ -28,6 +28,7 @@ namespace Titanic { class CChevRightOff : public CToggleSwitch { + DECLARE_MESSAGE_MAP public: CLASSDEF CChevRightOff(); diff --git a/engines/titanic/gfx/chev_right_on.cpp b/engines/titanic/gfx/chev_right_on.cpp index 848abfc005..ac55100ed6 100644 --- a/engines/titanic/gfx/chev_right_on.cpp +++ b/engines/titanic/gfx/chev_right_on.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CChevRightOn, CToggleSwitch) + CChevRightOn::CChevRightOn() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/chev_right_on.h b/engines/titanic/gfx/chev_right_on.h index 084b02ea08..d72c34a895 100644 --- a/engines/titanic/gfx/chev_right_on.h +++ b/engines/titanic/gfx/chev_right_on.h @@ -28,6 +28,7 @@ namespace Titanic { class CChevRightOn : public CToggleSwitch { + DECLARE_MESSAGE_MAP public: CLASSDEF CChevRightOn(); diff --git a/engines/titanic/gfx/chev_send_rec_switch.cpp b/engines/titanic/gfx/chev_send_rec_switch.cpp index affe9bce8f..d0d4a819a3 100644 --- a/engines/titanic/gfx/chev_send_rec_switch.cpp +++ b/engines/titanic/gfx/chev_send_rec_switch.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CChevSendRecSwitch, CToggleSwitch) + CChevSendRecSwitch::CChevSendRecSwitch() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/chev_send_rec_switch.h b/engines/titanic/gfx/chev_send_rec_switch.h index 29d6e7ab82..2f51bae259 100644 --- a/engines/titanic/gfx/chev_send_rec_switch.h +++ b/engines/titanic/gfx/chev_send_rec_switch.h @@ -28,6 +28,7 @@ namespace Titanic { class CChevSendRecSwitch : public CToggleSwitch { + DECLARE_MESSAGE_MAP public: CLASSDEF CChevSendRecSwitch(); diff --git a/engines/titanic/gfx/elevator_button.cpp b/engines/titanic/gfx/elevator_button.cpp index 81c9598b03..2a599ca491 100644 --- a/engines/titanic/gfx/elevator_button.cpp +++ b/engines/titanic/gfx/elevator_button.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CElevatorButton, CSTButton) + CElevatorButton::CElevatorButton() : CSTButton() { } diff --git a/engines/titanic/gfx/elevator_button.h b/engines/titanic/gfx/elevator_button.h index dddb7077b3..d6bf5dc3d6 100644 --- a/engines/titanic/gfx/elevator_button.h +++ b/engines/titanic/gfx/elevator_button.h @@ -28,6 +28,7 @@ namespace Titanic { class CElevatorButton : public CSTButton { + DECLARE_MESSAGE_MAP public: CLASSDEF CElevatorButton(); diff --git a/engines/titanic/gfx/get_from_succ.cpp b/engines/titanic/gfx/get_from_succ.cpp index ad7b5dc2e8..c7a59fd97d 100644 --- a/engines/titanic/gfx/get_from_succ.cpp +++ b/engines/titanic/gfx/get_from_succ.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CGetFromSucc, CToggleSwitch) + CGetFromSucc::CGetFromSucc() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/get_from_succ.h b/engines/titanic/gfx/get_from_succ.h index f0b028afa0..dc611f140f 100644 --- a/engines/titanic/gfx/get_from_succ.h +++ b/engines/titanic/gfx/get_from_succ.h @@ -28,6 +28,7 @@ namespace Titanic { class CGetFromSucc : public CToggleSwitch { + DECLARE_MESSAGE_MAP public: CLASSDEF CGetFromSucc(); diff --git a/engines/titanic/gfx/helmet_on_off.cpp b/engines/titanic/gfx/helmet_on_off.cpp index e1c698932e..29131778cb 100644 --- a/engines/titanic/gfx/helmet_on_off.cpp +++ b/engines/titanic/gfx/helmet_on_off.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CHelmetOnOff, CToggleSwitch) + CHelmetOnOff::CHelmetOnOff() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/helmet_on_off.h b/engines/titanic/gfx/helmet_on_off.h index 41621f340e..f607b47c0c 100644 --- a/engines/titanic/gfx/helmet_on_off.h +++ b/engines/titanic/gfx/helmet_on_off.h @@ -28,6 +28,7 @@ namespace Titanic { class CHelmetOnOff : public CToggleSwitch { + DECLARE_MESSAGE_MAP public: CLASSDEF CHelmetOnOff(); diff --git a/engines/titanic/gfx/home_photo.cpp b/engines/titanic/gfx/home_photo.cpp index 48661fc70d..303e56d1ca 100644 --- a/engines/titanic/gfx/home_photo.cpp +++ b/engines/titanic/gfx/home_photo.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CHomePhoto, CToggleSwitch) + CHomePhoto::CHomePhoto() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/home_photo.h b/engines/titanic/gfx/home_photo.h index 6e6f4976a2..db0be89a77 100644 --- a/engines/titanic/gfx/home_photo.h +++ b/engines/titanic/gfx/home_photo.h @@ -28,6 +28,7 @@ namespace Titanic { class CHomePhoto : public CToggleSwitch { + DECLARE_MESSAGE_MAP public: CLASSDEF CHomePhoto(); diff --git a/engines/titanic/gfx/icon_nav_action.cpp b/engines/titanic/gfx/icon_nav_action.cpp index f8aaa72396..e66c345bf5 100644 --- a/engines/titanic/gfx/icon_nav_action.cpp +++ b/engines/titanic/gfx/icon_nav_action.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CIconNavAction, CToggleSwitch) + CIconNavAction::CIconNavAction() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/icon_nav_action.h b/engines/titanic/gfx/icon_nav_action.h index cb8fae932a..189ea357e4 100644 --- a/engines/titanic/gfx/icon_nav_action.h +++ b/engines/titanic/gfx/icon_nav_action.h @@ -28,6 +28,7 @@ namespace Titanic { class CIconNavAction : public CToggleSwitch { + DECLARE_MESSAGE_MAP public: CLASSDEF CIconNavAction(); diff --git a/engines/titanic/gfx/icon_nav_butt.cpp b/engines/titanic/gfx/icon_nav_butt.cpp index 85eb1304c2..820a4270d4 100644 --- a/engines/titanic/gfx/icon_nav_butt.cpp +++ b/engines/titanic/gfx/icon_nav_butt.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CIconNavButt, CPetGraphic) + void CIconNavButt::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CPetGraphic::save(file, indent); diff --git a/engines/titanic/gfx/icon_nav_butt.h b/engines/titanic/gfx/icon_nav_butt.h index b2db4c7794..0cb2f1a3b1 100644 --- a/engines/titanic/gfx/icon_nav_butt.h +++ b/engines/titanic/gfx/icon_nav_butt.h @@ -28,6 +28,7 @@ namespace Titanic { class CIconNavButt : public CPetGraphic { + DECLARE_MESSAGE_MAP public: CLASSDEF diff --git a/engines/titanic/gfx/icon_nav_down.cpp b/engines/titanic/gfx/icon_nav_down.cpp index 947aa4c4f0..78727a3e8b 100644 --- a/engines/titanic/gfx/icon_nav_down.cpp +++ b/engines/titanic/gfx/icon_nav_down.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CIconNavDown, CToggleSwitch) + CIconNavDown::CIconNavDown() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/icon_nav_down.h b/engines/titanic/gfx/icon_nav_down.h index b7759e059d..3eef9ef7f1 100644 --- a/engines/titanic/gfx/icon_nav_down.h +++ b/engines/titanic/gfx/icon_nav_down.h @@ -28,6 +28,7 @@ namespace Titanic { class CIconNavDown : public CToggleSwitch { + DECLARE_MESSAGE_MAP public: CLASSDEF CIconNavDown(); diff --git a/engines/titanic/gfx/icon_nav_image.cpp b/engines/titanic/gfx/icon_nav_image.cpp index 1e8a1ca2c3..d0c6239dcd 100644 --- a/engines/titanic/gfx/icon_nav_image.cpp +++ b/engines/titanic/gfx/icon_nav_image.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CIconNavImage, CPetGraphic) + void CIconNavImage::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CPetGraphic::save(file, indent); diff --git a/engines/titanic/gfx/icon_nav_image.h b/engines/titanic/gfx/icon_nav_image.h index 295ffe7d3b..8460733a12 100644 --- a/engines/titanic/gfx/icon_nav_image.h +++ b/engines/titanic/gfx/icon_nav_image.h @@ -28,6 +28,7 @@ namespace Titanic { class CIconNavImage : public CPetGraphic { + DECLARE_MESSAGE_MAP public: CLASSDEF diff --git a/engines/titanic/gfx/icon_nav_left.cpp b/engines/titanic/gfx/icon_nav_left.cpp index 5ec50904d2..803818f19f 100644 --- a/engines/titanic/gfx/icon_nav_left.cpp +++ b/engines/titanic/gfx/icon_nav_left.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CIconNavLeft, CToggleSwitch) + CIconNavLeft::CIconNavLeft() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/icon_nav_left.h b/engines/titanic/gfx/icon_nav_left.h index e507d2c2dd..5fd7b65a83 100644 --- a/engines/titanic/gfx/icon_nav_left.h +++ b/engines/titanic/gfx/icon_nav_left.h @@ -28,6 +28,7 @@ namespace Titanic { class CIconNavLeft : public CToggleSwitch { + DECLARE_MESSAGE_MAP public: CLASSDEF CIconNavLeft(); diff --git a/engines/titanic/gfx/icon_nav_receive.cpp b/engines/titanic/gfx/icon_nav_receive.cpp index ad7e0e7160..554656cf0a 100644 --- a/engines/titanic/gfx/icon_nav_receive.cpp +++ b/engines/titanic/gfx/icon_nav_receive.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CIconNavReceive, CPetGraphic) + void CIconNavReceive::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CPetGraphic::save(file, indent); diff --git a/engines/titanic/gfx/icon_nav_receive.h b/engines/titanic/gfx/icon_nav_receive.h index 36eed5376b..f181439289 100644 --- a/engines/titanic/gfx/icon_nav_receive.h +++ b/engines/titanic/gfx/icon_nav_receive.h @@ -28,6 +28,7 @@ namespace Titanic { class CIconNavReceive : public CPetGraphic { + DECLARE_MESSAGE_MAP public: CLASSDEF diff --git a/engines/titanic/gfx/icon_nav_right.cpp b/engines/titanic/gfx/icon_nav_right.cpp index d133ed3b81..1553c9127c 100644 --- a/engines/titanic/gfx/icon_nav_right.cpp +++ b/engines/titanic/gfx/icon_nav_right.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CIconNavRight, CToggleSwitch) + CIconNavRight::CIconNavRight() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/icon_nav_right.h b/engines/titanic/gfx/icon_nav_right.h index db3bab4bb8..c088a2334a 100644 --- a/engines/titanic/gfx/icon_nav_right.h +++ b/engines/titanic/gfx/icon_nav_right.h @@ -28,6 +28,7 @@ namespace Titanic { class CIconNavRight : public CToggleSwitch { + DECLARE_MESSAGE_MAP public: CLASSDEF CIconNavRight(); diff --git a/engines/titanic/gfx/icon_nav_send.cpp b/engines/titanic/gfx/icon_nav_send.cpp index 856560c175..64d2a8660e 100644 --- a/engines/titanic/gfx/icon_nav_send.cpp +++ b/engines/titanic/gfx/icon_nav_send.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CIconNavSend, CPetGraphic) + void CIconNavSend::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CPetGraphic::save(file, indent); diff --git a/engines/titanic/gfx/icon_nav_send.h b/engines/titanic/gfx/icon_nav_send.h index d25d0b9149..41c747edad 100644 --- a/engines/titanic/gfx/icon_nav_send.h +++ b/engines/titanic/gfx/icon_nav_send.h @@ -28,6 +28,7 @@ namespace Titanic { class CIconNavSend : public CPetGraphic { + DECLARE_MESSAGE_MAP public: CLASSDEF diff --git a/engines/titanic/gfx/icon_nav_up.cpp b/engines/titanic/gfx/icon_nav_up.cpp index 5b5d5ec9f0..a8f4f552b5 100644 --- a/engines/titanic/gfx/icon_nav_up.cpp +++ b/engines/titanic/gfx/icon_nav_up.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CIconNavUp, CToggleSwitch) + CIconNavUp::CIconNavUp() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/icon_nav_up.h b/engines/titanic/gfx/icon_nav_up.h index 7eeeb773b1..691e6652e7 100644 --- a/engines/titanic/gfx/icon_nav_up.h +++ b/engines/titanic/gfx/icon_nav_up.h @@ -28,6 +28,7 @@ namespace Titanic { class CIconNavUp : public CToggleSwitch { + DECLARE_MESSAGE_MAP public: CLASSDEF CIconNavUp(); diff --git a/engines/titanic/gfx/keybrd_butt.cpp b/engines/titanic/gfx/keybrd_butt.cpp index 3e7f5c19de..4a18d99f0a 100644 --- a/engines/titanic/gfx/keybrd_butt.cpp +++ b/engines/titanic/gfx/keybrd_butt.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CKeybrdButt, CToggleSwitch) + CKeybrdButt::CKeybrdButt() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/keybrd_butt.h b/engines/titanic/gfx/keybrd_butt.h index a4f233b209..33ff418c56 100644 --- a/engines/titanic/gfx/keybrd_butt.h +++ b/engines/titanic/gfx/keybrd_butt.h @@ -28,6 +28,7 @@ namespace Titanic { class CKeybrdButt : public CToggleSwitch { + DECLARE_MESSAGE_MAP public: CLASSDEF CKeybrdButt(); diff --git a/engines/titanic/gfx/music_slider.cpp b/engines/titanic/gfx/music_slider.cpp new file mode 100644 index 0000000000..f065ae6729 --- /dev/null +++ b/engines/titanic/gfx/music_slider.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/gfx/music_slider.h" + +namespace Titanic { + +EMPTY_MESSAGE_MAP(CMusicSlider, CMusicControl) + +void CMusicSlider::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CMusicControl::save(file, indent); +} + +void CMusicSlider::load(SimpleFile *file) { + file->readNumber(); + CMusicControl::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/music_slider.h b/engines/titanic/gfx/music_slider.h index 3fd0ab341e..b396074b00 100644 --- a/engines/titanic/gfx/music_slider.h +++ b/engines/titanic/gfx/music_slider.h @@ -28,24 +28,19 @@ namespace Titanic { class CMusicSlider : public CMusicControl { + DECLARE_MESSAGE_MAP public: CLASSDEF /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - CMusicControl::save(file, indent); - } + virtual void save(SimpleFile *file, int indent) const; /** * Load the data for the class from file */ - virtual void load(SimpleFile *file) { - file->readNumber(); - CMusicControl::load(file); - } + virtual void load(SimpleFile *file); }; } // End of namespace Titanic diff --git a/engines/titanic/gfx/music_switch.cpp b/engines/titanic/gfx/music_switch.cpp new file mode 100644 index 0000000000..69e8f2eb4c --- /dev/null +++ b/engines/titanic/gfx/music_switch.cpp @@ -0,0 +1,39 @@ +/* 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 "titanic/gfx/music_switch.h" + +namespace Titanic { + +EMPTY_MESSAGE_MAP(CMusicSwitch, CMusicControl) + +void CMusicSwitch::save(SimpleFile *file, int indent) const { + file->writeNumberLine(1, indent); + CMusicControl::save(file, indent); +} + +void CMusicSwitch::load(SimpleFile *file) { + file->readNumber(); + CMusicControl::load(file); +} + +} // End of namespace Titanic diff --git a/engines/titanic/gfx/music_switch.h b/engines/titanic/gfx/music_switch.h index 534eb251de..bd9397e041 100644 --- a/engines/titanic/gfx/music_switch.h +++ b/engines/titanic/gfx/music_switch.h @@ -28,24 +28,19 @@ namespace Titanic { class CMusicSwitch : public CMusicControl { + DECLARE_MESSAGE_MAP public: CLASSDEF /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const { - file->writeNumberLine(1, indent); - CMusicControl::save(file, indent); - } + virtual void save(SimpleFile *file, int indent) const; /** * Load the data for the class from file */ - virtual void load(SimpleFile *file) { - file->readNumber(); - CMusicControl::load(file); - } + virtual void load(SimpleFile *file); }; } // End of namespace Titanic diff --git a/engines/titanic/gfx/send_to_succ.cpp b/engines/titanic/gfx/send_to_succ.cpp index 82c923c045..938fa7c3a9 100644 --- a/engines/titanic/gfx/send_to_succ.cpp +++ b/engines/titanic/gfx/send_to_succ.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CSendToSucc, CToggleSwitch) + CSendToSucc::CSendToSucc() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/send_to_succ.h b/engines/titanic/gfx/send_to_succ.h index fb237f206d..65868cd83d 100644 --- a/engines/titanic/gfx/send_to_succ.h +++ b/engines/titanic/gfx/send_to_succ.h @@ -28,6 +28,7 @@ namespace Titanic { class CSendToSucc : public CToggleSwitch { + DECLARE_MESSAGE_MAP public: CLASSDEF CSendToSucc(); diff --git a/engines/titanic/gfx/sgt_selector.cpp b/engines/titanic/gfx/sgt_selector.cpp index 7ad126b60a..170b0f4712 100644 --- a/engines/titanic/gfx/sgt_selector.cpp +++ b/engines/titanic/gfx/sgt_selector.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CSGTSelector, CPetGraphic) + void CSGTSelector::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CPetGraphic::save(file, indent); diff --git a/engines/titanic/gfx/sgt_selector.h b/engines/titanic/gfx/sgt_selector.h index 8ebd7ae255..82757fa3b9 100644 --- a/engines/titanic/gfx/sgt_selector.h +++ b/engines/titanic/gfx/sgt_selector.h @@ -28,6 +28,7 @@ namespace Titanic { class CSGTSelector : public CPetGraphic { + DECLARE_MESSAGE_MAP public: CLASSDEF diff --git a/engines/titanic/gfx/small_chev_left_off.cpp b/engines/titanic/gfx/small_chev_left_off.cpp index 8614e336e1..8647ad8fe4 100644 --- a/engines/titanic/gfx/small_chev_left_off.cpp +++ b/engines/titanic/gfx/small_chev_left_off.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CSmallChevLeftOff, CToggleSwitch) + CSmallChevLeftOff::CSmallChevLeftOff() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/small_chev_left_off.h b/engines/titanic/gfx/small_chev_left_off.h index fc500cee69..27c40017ad 100644 --- a/engines/titanic/gfx/small_chev_left_off.h +++ b/engines/titanic/gfx/small_chev_left_off.h @@ -28,6 +28,7 @@ namespace Titanic { class CSmallChevLeftOff : public CToggleSwitch { + DECLARE_MESSAGE_MAP public: CLASSDEF CSmallChevLeftOff(); diff --git a/engines/titanic/gfx/small_chev_left_on.cpp b/engines/titanic/gfx/small_chev_left_on.cpp index 7f6a4ee3db..b5031e922e 100644 --- a/engines/titanic/gfx/small_chev_left_on.cpp +++ b/engines/titanic/gfx/small_chev_left_on.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CSmallChevLeftOn, CToggleSwitch) + CSmallChevLeftOn::CSmallChevLeftOn() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/small_chev_left_on.h b/engines/titanic/gfx/small_chev_left_on.h index 8ab9417468..7b60857e67 100644 --- a/engines/titanic/gfx/small_chev_left_on.h +++ b/engines/titanic/gfx/small_chev_left_on.h @@ -28,6 +28,7 @@ namespace Titanic { class CSmallChevLeftOn : public CToggleSwitch { + DECLARE_MESSAGE_MAP public: CLASSDEF CSmallChevLeftOn(); diff --git a/engines/titanic/gfx/small_chev_right_off.cpp b/engines/titanic/gfx/small_chev_right_off.cpp index 1a3051bb4d..6d0c08eb8e 100644 --- a/engines/titanic/gfx/small_chev_right_off.cpp +++ b/engines/titanic/gfx/small_chev_right_off.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CSmallChevRightOff, CToggleSwitch) + CSmallChevRightOff::CSmallChevRightOff() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/small_chev_right_off.h b/engines/titanic/gfx/small_chev_right_off.h index fae9c3c674..0dadae1e07 100644 --- a/engines/titanic/gfx/small_chev_right_off.h +++ b/engines/titanic/gfx/small_chev_right_off.h @@ -28,6 +28,7 @@ namespace Titanic { class CSmallChevRightOff : public CToggleSwitch { + DECLARE_MESSAGE_MAP public: CLASSDEF CSmallChevRightOff(); diff --git a/engines/titanic/gfx/small_chev_right_on.cpp b/engines/titanic/gfx/small_chev_right_on.cpp index 714b6b314b..552990d0b8 100644 --- a/engines/titanic/gfx/small_chev_right_on.cpp +++ b/engines/titanic/gfx/small_chev_right_on.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CSmallChevRightOn, CToggleSwitch) + CSmallChevRightOn::CSmallChevRightOn() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/small_chev_right_on.h b/engines/titanic/gfx/small_chev_right_on.h index c5cb4d792d..ea042d30ee 100644 --- a/engines/titanic/gfx/small_chev_right_on.h +++ b/engines/titanic/gfx/small_chev_right_on.h @@ -28,6 +28,7 @@ namespace Titanic { class CSmallChevRightOn : public CToggleSwitch { + DECLARE_MESSAGE_MAP public: CLASSDEF CSmallChevRightOn(); diff --git a/engines/titanic/gfx/text_down.cpp b/engines/titanic/gfx/text_down.cpp index d4bdfdb72f..967d60f495 100644 --- a/engines/titanic/gfx/text_down.cpp +++ b/engines/titanic/gfx/text_down.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CTextDown, CPetGraphic) + void CTextDown::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CPetGraphic::save(file, indent); diff --git a/engines/titanic/gfx/text_down.h b/engines/titanic/gfx/text_down.h index 189f795650..920ea8c958 100644 --- a/engines/titanic/gfx/text_down.h +++ b/engines/titanic/gfx/text_down.h @@ -28,6 +28,7 @@ namespace Titanic { class CTextDown : public CPetGraphic { + DECLARE_MESSAGE_MAP public: CLASSDEF diff --git a/engines/titanic/gfx/text_skrew.cpp b/engines/titanic/gfx/text_skrew.cpp index 8d1f026913..30cc7f407b 100644 --- a/engines/titanic/gfx/text_skrew.cpp +++ b/engines/titanic/gfx/text_skrew.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CTextSkrew, CPetGraphic) + void CTextSkrew::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CPetGraphic::save(file, indent); diff --git a/engines/titanic/gfx/text_skrew.h b/engines/titanic/gfx/text_skrew.h index aa6c375098..6e86e70825 100644 --- a/engines/titanic/gfx/text_skrew.h +++ b/engines/titanic/gfx/text_skrew.h @@ -28,6 +28,7 @@ namespace Titanic { class CTextSkrew : public CPetGraphic { + DECLARE_MESSAGE_MAP public: CLASSDEF diff --git a/engines/titanic/gfx/text_up.cpp b/engines/titanic/gfx/text_up.cpp index ce3ff100dc..0cb4153f25 100644 --- a/engines/titanic/gfx/text_up.cpp +++ b/engines/titanic/gfx/text_up.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CTextUp, CPetGraphic) + void CTextUp::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CPetGraphic::save(file, indent); diff --git a/engines/titanic/gfx/text_up.h b/engines/titanic/gfx/text_up.h index 103f62159c..05a54bc45a 100644 --- a/engines/titanic/gfx/text_up.h +++ b/engines/titanic/gfx/text_up.h @@ -28,6 +28,7 @@ namespace Titanic { class CTextUp : public CPetGraphic { + DECLARE_MESSAGE_MAP public: CLASSDEF diff --git a/engines/titanic/gfx/toggle_button.cpp b/engines/titanic/gfx/toggle_button.cpp index 8284d35aac..3bb2e967e9 100644 --- a/engines/titanic/gfx/toggle_button.cpp +++ b/engines/titanic/gfx/toggle_button.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CToggleButton, CBackground) + void CToggleButton::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); diff --git a/engines/titanic/gfx/toggle_button.h b/engines/titanic/gfx/toggle_button.h index a98a94df9e..ac0bb69b9d 100644 --- a/engines/titanic/gfx/toggle_button.h +++ b/engines/titanic/gfx/toggle_button.h @@ -28,6 +28,7 @@ namespace Titanic { class CToggleButton : public CBackground { + DECLARE_MESSAGE_MAP private: int _fieldE0; public: diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 28be2495c3..3985ebfa81 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -298,6 +298,8 @@ MODULE_OBJS := \ gfx/keybrd_butt.o \ gfx/move_object_button.o \ gfx/music_control.o \ + gfx/music_slider.o \ + gfx/music_switch.o \ gfx/send_to_succ.o \ gfx/sgt_selector.o \ gfx/slider_button.o \ diff --git a/engines/titanic/npcs/mobile.cpp b/engines/titanic/npcs/mobile.cpp index 37c1d13fee..55b37f52f1 100644 --- a/engines/titanic/npcs/mobile.cpp +++ b/engines/titanic/npcs/mobile.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CMobile, CCharacter) + CMobile::CMobile() : CCharacter(), _fieldDC(0) { } diff --git a/engines/titanic/npcs/mobile.h b/engines/titanic/npcs/mobile.h index 4979d54fc3..3ec19a4371 100644 --- a/engines/titanic/npcs/mobile.h +++ b/engines/titanic/npcs/mobile.h @@ -28,6 +28,7 @@ namespace Titanic { class CMobile : public CCharacter { + DECLARE_MESSAGE_MAP private: Point _pos1; int _fieldDC; diff --git a/engines/titanic/npcs/true_talk_npc.cpp b/engines/titanic/npcs/true_talk_npc.cpp index c989aa3bd7..0eaf21359e 100644 --- a/engines/titanic/npcs/true_talk_npc.cpp +++ b/engines/titanic/npcs/true_talk_npc.cpp @@ -22,6 +22,7 @@ #include "titanic/npcs/true_talk_npc.h" #include "titanic/core/view_item.h" +#include "titanic/pet_control/pet_control.h" #include "titanic/titanic.h" namespace Titanic { @@ -221,5 +222,16 @@ void CTrueTalkNPC::startTalker(CViewItem *view) { gameManager->getTalkManager()->start4(this, view); } +void CTrueTalkNPC::performAction(bool startTalking, CViewItem *view) { + CPetControl *pet = getPetControl(); + if (pet) + pet->resetActiveNPC(); + + if (startTalking) + startTalker(view); + + if (pet) + pet->convResetNPC(); +} } // End of namespace Titanic diff --git a/engines/titanic/npcs/true_talk_npc.h b/engines/titanic/npcs/true_talk_npc.h index 23613041d0..3126d92d3e 100644 --- a/engines/titanic/npcs/true_talk_npc.h +++ b/engines/titanic/npcs/true_talk_npc.h @@ -72,6 +72,11 @@ protected: * Stop an animation timer */ void stopAnimTimer(int id); + + /** + * Perform an action + */ + void performAction(bool startTalking, CViewItem *view); public: CLASSDEF CTrueTalkNPC(); diff --git a/engines/titanic/pet_control/pet_graphic.cpp b/engines/titanic/pet_control/pet_graphic.cpp index 797c560ab0..25a77397c3 100644 --- a/engines/titanic/pet_control/pet_graphic.cpp +++ b/engines/titanic/pet_control/pet_graphic.cpp @@ -24,8 +24,7 @@ namespace Titanic { -BEGIN_MESSAGE_MAP(CPetGraphic, CGameObject) -END_MESSAGE_MAP() +EMPTY_MESSAGE_MAP(CPetGraphic, CGameObject) void CPetGraphic::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); diff --git a/engines/titanic/pet_control/pet_graphic2.cpp b/engines/titanic/pet_control/pet_graphic2.cpp index ef898194e8..a33a1c7d93 100644 --- a/engines/titanic/pet_control/pet_graphic2.cpp +++ b/engines/titanic/pet_control/pet_graphic2.cpp @@ -24,8 +24,7 @@ namespace Titanic { -BEGIN_MESSAGE_MAP(CPetGraphic2, CGameObject) -END_MESSAGE_MAP() +EMPTY_MESSAGE_MAP(CPetGraphic2, CGameObject) void CPetGraphic2::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); diff --git a/engines/titanic/pet_control/pet_leaf.cpp b/engines/titanic/pet_control/pet_leaf.cpp index 77b0d426a5..833f4ed8b9 100644 --- a/engines/titanic/pet_control/pet_leaf.cpp +++ b/engines/titanic/pet_control/pet_leaf.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(PETLeaf, CGameObject) + void PETLeaf::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/pet_control/pet_leaf.h b/engines/titanic/pet_control/pet_leaf.h index 073374970c..b9c516f6cb 100644 --- a/engines/titanic/pet_control/pet_leaf.h +++ b/engines/titanic/pet_control/pet_leaf.h @@ -28,6 +28,7 @@ namespace Titanic { class PETLeaf : public CGameObject { + DECLARE_MESSAGE_MAP public: CLASSDEF diff --git a/engines/titanic/pet_control/pet_mode_off.cpp b/engines/titanic/pet_control/pet_mode_off.cpp index 3d3eb376c8..a1c9f3dd34 100644 --- a/engines/titanic/pet_control/pet_mode_off.cpp +++ b/engines/titanic/pet_control/pet_mode_off.cpp @@ -24,8 +24,7 @@ namespace Titanic { -BEGIN_MESSAGE_MAP(CPetModeOff, CToggleSwitch) -END_MESSAGE_MAP() +EMPTY_MESSAGE_MAP(CPetModeOff, CToggleSwitch) CPetModeOff::CPetModeOff() : CToggleSwitch() { } diff --git a/engines/titanic/pet_control/pet_mode_on.cpp b/engines/titanic/pet_control/pet_mode_on.cpp index bde318bfcf..1a7c2c26e7 100644 --- a/engines/titanic/pet_control/pet_mode_on.cpp +++ b/engines/titanic/pet_control/pet_mode_on.cpp @@ -24,8 +24,7 @@ namespace Titanic { -BEGIN_MESSAGE_MAP(CPetModeOn, CToggleSwitch) -END_MESSAGE_MAP() +EMPTY_MESSAGE_MAP(CPetModeOn, CToggleSwitch) CPetModeOn::CPetModeOn() : CToggleSwitch() { } diff --git a/engines/titanic/pet_control/pet_mode_panel.cpp b/engines/titanic/pet_control/pet_mode_panel.cpp index 1890f9a30a..87351bed24 100644 --- a/engines/titanic/pet_control/pet_mode_panel.cpp +++ b/engines/titanic/pet_control/pet_mode_panel.cpp @@ -24,8 +24,7 @@ namespace Titanic { -BEGIN_MESSAGE_MAP(CPetModePanel, CToggleSwitch) -END_MESSAGE_MAP() +EMPTY_MESSAGE_MAP(CPetModePanel, CToggleSwitch) CPetModePanel::CPetModePanel() : CToggleSwitch() { } diff --git a/engines/titanic/pet_control/pet_pannel1.cpp b/engines/titanic/pet_control/pet_pannel1.cpp index 01e2b930dd..527841f883 100644 --- a/engines/titanic/pet_control/pet_pannel1.cpp +++ b/engines/titanic/pet_control/pet_pannel1.cpp @@ -24,8 +24,7 @@ namespace Titanic { -BEGIN_MESSAGE_MAP(CPetPannel1, CPetGraphic) -END_MESSAGE_MAP() +EMPTY_MESSAGE_MAP(CPetPannel1, CPetGraphic) void CPetPannel1::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); diff --git a/engines/titanic/pet_control/pet_pannel2.cpp b/engines/titanic/pet_control/pet_pannel2.cpp index e55468d492..48675a7384 100644 --- a/engines/titanic/pet_control/pet_pannel2.cpp +++ b/engines/titanic/pet_control/pet_pannel2.cpp @@ -24,8 +24,7 @@ namespace Titanic { -BEGIN_MESSAGE_MAP(CPetPannel2, CPetGraphic) -END_MESSAGE_MAP() +EMPTY_MESSAGE_MAP(CPetPannel2, CPetGraphic) void CPetPannel2::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); diff --git a/engines/titanic/pet_control/pet_pannel3.cpp b/engines/titanic/pet_control/pet_pannel3.cpp index ea623a33a8..a0b693872a 100644 --- a/engines/titanic/pet_control/pet_pannel3.cpp +++ b/engines/titanic/pet_control/pet_pannel3.cpp @@ -24,8 +24,7 @@ namespace Titanic { -BEGIN_MESSAGE_MAP(CPetPannel3, CPetGraphic) -END_MESSAGE_MAP() +EMPTY_MESSAGE_MAP(CPetPannel3, CPetGraphic) void CPetPannel3::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); diff --git a/engines/titanic/sound/dome_from_top_of_well.cpp b/engines/titanic/sound/dome_from_top_of_well.cpp index 6e31937af0..f8d946a1e3 100644 --- a/engines/titanic/sound/dome_from_top_of_well.cpp +++ b/engines/titanic/sound/dome_from_top_of_well.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CDomeFromTopOfWell, CViewAutoSoundPlayer) + void CDomeFromTopOfWell::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); CViewAutoSoundPlayer::save(file, indent); diff --git a/engines/titanic/sound/dome_from_top_of_well.h b/engines/titanic/sound/dome_from_top_of_well.h index bb8ab6372a..24c165028a 100644 --- a/engines/titanic/sound/dome_from_top_of_well.h +++ b/engines/titanic/sound/dome_from_top_of_well.h @@ -28,6 +28,7 @@ namespace Titanic { class CDomeFromTopOfWell : public CViewAutoSoundPlayer { + DECLARE_MESSAGE_MAP public: CLASSDEF diff --git a/engines/titanic/sound/water_lapping_sounds.cpp b/engines/titanic/sound/water_lapping_sounds.cpp index b3f5d23a2c..f5a69e6eed 100644 --- a/engines/titanic/sound/water_lapping_sounds.cpp +++ b/engines/titanic/sound/water_lapping_sounds.cpp @@ -24,6 +24,8 @@ namespace Titanic { +EMPTY_MESSAGE_MAP(CWaterLappingSounds, CRoomAutoSoundPlayer) + void CWaterLappingSounds::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); file->writeQuotedLine(_string1, indent); diff --git a/engines/titanic/sound/water_lapping_sounds.h b/engines/titanic/sound/water_lapping_sounds.h index 0d885bedd4..cf6c72146b 100644 --- a/engines/titanic/sound/water_lapping_sounds.h +++ b/engines/titanic/sound/water_lapping_sounds.h @@ -28,6 +28,7 @@ namespace Titanic { class CWaterLappingSounds : public CRoomAutoSoundPlayer { + DECLARE_MESSAGE_MAP public: int _value; public: -- cgit v1.2.3 From 123966554abab05646f666b85a29726b02342661 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 28 Jun 2016 21:28:42 -0400 Subject: TITANIC: gcc compilation fixes --- engines/titanic/core/game_object.cpp | 2 +- engines/titanic/core/message_target.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index d1f3a32493..9e155908d5 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -1410,7 +1410,7 @@ CStarControl *CGameObject::getStarControl() const { if (!starControl) { CViewItem *view = getGameManager()->getView(); if (view) - starControl = starControl = static_cast(view->findChildInstanceOf(CStarControl::_type)); + starControl = static_cast(view->findChildInstanceOf(CStarControl::_type)); } return starControl; diff --git a/engines/titanic/core/message_target.h b/engines/titanic/core/message_target.h index e5bdf3e08a..42e9e5a3c4 100644 --- a/engines/titanic/core/message_target.h +++ b/engines/titanic/core/message_target.h @@ -73,7 +73,6 @@ protected: \ { return getThisMessageMap(); } \ const MSGMAP *theClass::getThisMessageMap() \ { \ - typedef theClass ThisClass; \ typedef baseClass TheBaseClass; \ static const MSGMAP_ENTRY _messageEntries[] = { \ { (PMSG)nullptr, nullptr } \ -- cgit v1.2.3 From ce0be01e317996c0454a85dd9a24b896e13ddc8e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 29 Jun 2016 13:08:17 -0400 Subject: TITANIC: Cleanup CGameObject list from CMovieClipList to CMovieRangeInfoList --- engines/titanic/core/game_object.cpp | 22 +++--- engines/titanic/core/game_object.h | 14 ++-- engines/titanic/core/game_object_desc_item.h | 2 +- engines/titanic/core/link_item.h | 2 +- engines/titanic/core/movie_clip.cpp | 112 --------------------------- engines/titanic/core/movie_clip.h | 94 ---------------------- engines/titanic/core/room_item.h | 2 +- engines/titanic/core/saveable_object.cpp | 2 +- engines/titanic/module.mk | 2 +- engines/titanic/support/movie_clip.cpp | 98 +++++++++++++++++++++++ engines/titanic/support/movie_clip.h | 92 ++++++++++++++++++++++ engines/titanic/support/movie_range_info.cpp | 14 ++++ engines/titanic/support/movie_range_info.h | 7 ++ 13 files changed, 236 insertions(+), 227 deletions(-) delete mode 100644 engines/titanic/core/movie_clip.cpp delete mode 100644 engines/titanic/core/movie_clip.h create mode 100644 engines/titanic/support/movie_clip.cpp create mode 100644 engines/titanic/support/movie_clip.h diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 9e155908d5..2a2c6cf772 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -93,7 +93,7 @@ void CGameObject::load(SimpleFile *file) { switch (val) { case 7: - _clipList2.load(file); + _movieRangeInfo.load(file); _frameNumber = file->readNumber(); // Deliberate fall-through @@ -102,7 +102,7 @@ void CGameObject::load(SimpleFile *file) { // Deliberate fall-through case 5: - _clipList1.load(file); + _movieClips.load(file); // Deliberate fall-through case 4: @@ -179,8 +179,8 @@ void CGameObject::draw(CScreenManager *screenManager) { _frameNumber = -1; } - if (!_clipList2.empty()) - processClipList2(); + if (!_movieRangeInfo.empty()) + processMoveRangeInfo(); if (_bounds.intersects(getGameManager()->_bounds)) { if (_surface) { @@ -376,11 +376,11 @@ void CGameObject::playMovie(int v1, int v2) { } } -void CGameObject::processClipList2() { - for (CMovieClipList::iterator i = _clipList2.begin(); i != _clipList2.end(); ++i) +void CGameObject::processMoveRangeInfo() { + for (CMovieRangeInfoList::iterator i = _movieRangeInfo.begin(); i != _movieRangeInfo.end(); ++i) (*i)->process(this); - _clipList2.destroyContents(); + _movieRangeInfo.destroyContents(); } void CGameObject::makeDirty(const Rect &r) { @@ -499,7 +499,7 @@ void CGameObject::playMovie(uint startFrame, uint endFrame, uint flags) { void CGameObject::playClip(const CString &name, uint flags) { _frameNumber = -1; - CMovieClip *clip = _clipList1.findByName(name); + CMovieClip *clip = _movieClips.findByName(name); if (clip) playMovie(clip->_startFrame, clip->_endFrame, flags); } @@ -1064,11 +1064,11 @@ void CGameObject::performAction(int actionNum, CViewItem *view) { } bool CGameObject::clipExistsByStart(const CString &name, int startFrame) const { - return _clipList1.existsByStart(name, startFrame); + return _movieClips.existsByStart(name, startFrame); } bool CGameObject::clipExistsByEnd(const CString &name, int endFrame) const { - return _clipList1.existsByEnd(name, endFrame); + return _movieClips.existsByEnd(name, endFrame); } void CGameObject::checkPlayMovie(const CString &name, int flags) { @@ -1208,7 +1208,7 @@ void CGameObject::movie38(int v1) { } int CGameObject::getClipDuration(const CString &name, int frameRate) const { - CMovieClip *clip = _clipList1.findByName(name); + CMovieClip *clip = _movieClips.findByName(name); return clip ? (clip->_endFrame - clip->_startFrame) * 1000 / frameRate : 0; } diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index ade8800e5d..553367378c 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -25,9 +25,10 @@ #include "titanic/support/mouse_cursor.h" #include "titanic/support/credit_text.h" +#include "titanic/support/movie_range_info.h" #include "titanic/support/proximity.h" #include "titanic/support/rect.h" -#include "titanic/core/movie_clip.h" +#include "titanic/support/movie_clip.h" #include "titanic/core/named_item.h" #include "titanic/pet_control/pet_section.h" #include "titanic/pet_control/pet_text.h" @@ -68,7 +69,10 @@ private: */ void loadImage(const CString &name, bool pendingFlag = true); - void processClipList2(); + /** + * Process and remove any registered movie range info + */ + void processMoveRangeInfo(); /** * Merges one rect into another, and returns true if there was @@ -84,9 +88,9 @@ protected: int _field44; int _field48; int _field4C; - CMovieClipList _clipList1; + CMovieClipList _movieClips; int _initialFrame; - CMovieClipList _clipList2; + CMovieRangeInfoList _movieRangeInfo; int _frameNumber; CPetText *_text; uint _textBorder; @@ -533,7 +537,7 @@ public: /** * Returns the clip list, if any, associated with the item */ - virtual const CMovieClipList *getClipList() const { return &_clipList1; } + virtual const CMovieClipList *getClipList() const { return &_movieClips; } /** * Allows the item to draw itself diff --git a/engines/titanic/core/game_object_desc_item.h b/engines/titanic/core/game_object_desc_item.h index 4ac5816dbc..5bfc483b44 100644 --- a/engines/titanic/core/game_object_desc_item.h +++ b/engines/titanic/core/game_object_desc_item.h @@ -23,7 +23,7 @@ #ifndef TITANIC_GAME_OBJECT_DESK_ITEM_H #define TITANIC_GAME_OBJECT_DESK_ITEM_H -#include "titanic/core/movie_clip.h" +#include "titanic/support/movie_clip.h" #include "titanic/core/tree_item.h" #include "titanic/core/list.h" diff --git a/engines/titanic/core/link_item.h b/engines/titanic/core/link_item.h index 9c376396f7..328d5bcc06 100644 --- a/engines/titanic/core/link_item.h +++ b/engines/titanic/core/link_item.h @@ -25,7 +25,7 @@ #include "titanic/support/mouse_cursor.h" #include "titanic/core/named_item.h" -#include "titanic/core/movie_clip.h" +#include "titanic/support/movie_clip.h" namespace Titanic { diff --git a/engines/titanic/core/movie_clip.cpp b/engines/titanic/core/movie_clip.cpp deleted file mode 100644 index 9e5df67bd7..0000000000 --- a/engines/titanic/core/movie_clip.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* 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 "titanic/core/movie_clip.h" -#include "titanic/core/game_object.h" - -namespace Titanic { - -CMovieClip::CMovieClip(): ListItem(), _startFrame(0), _endFrame(0) { -} - -CMovieClip::CMovieClip(const CString &name, int startFrame, int endFrame): - ListItem(), _name(name), _startFrame(startFrame), _endFrame(endFrame) { -} - -void CMovieClip::save(SimpleFile *file, int indent) const { - file->writeNumberLine(2, indent); - file->writeQuotedLine("Clip", indent); - file->writeQuotedLine(_name, indent); - file->writeNumberLine(_startFrame, indent); - file->writeNumberLine(_endFrame, indent); - - ListItem::save(file, indent); -} - -void CMovieClip::load(SimpleFile *file) { - int val = file->readNumber(); - - switch (val) { - case 1: - // This should never be used - assert(0); - break; - - case 2: - file->readString(); - _name = file->readString(); - _startFrame = file->readNumber(); - _endFrame = file->readNumber(); - break; - - default: - break; - } - - ListItem::load(file); -} - -void CMovieClip::process(CGameObject *owner) { - int flags = 0; - if (_endFrame) - flags |= CLIPFLAG_HAS_END_FRAME; - if (_startFrame) - flags |= CLIPFLAG_HAS_START_FRAME; - - warning("TODO: CMovieClip::process"); - - owner->checkPlayMovie(_name, flags); - - -} - -CMovieClip *CMovieClipList::findByName(const Common::String &name) const { - for (const_iterator i = begin(); i != end(); ++i) { - CMovieClip *clip = *i; - if (clip->_name == name) - return clip; - } - - return nullptr; -} - -bool CMovieClipList::existsByStart(const CString &name, int startFrame) const { - for (const_iterator i = begin(); i != end(); ++i) { - CMovieClip *clip = *i; - if (clip->_startFrame == startFrame && clip->_name == name) - return true; - } - - return false; -} - -bool CMovieClipList::existsByEnd(const CString &name, int endFrame) const { - for (const_iterator i = begin(); i != end(); ++i) { - CMovieClip *clip = *i; - if (clip->_endFrame == endFrame && clip->_name == name) - return true; - } - - return false; -} - -} // End of namespace Titanic diff --git a/engines/titanic/core/movie_clip.h b/engines/titanic/core/movie_clip.h deleted file mode 100644 index 6486259c3b..0000000000 --- a/engines/titanic/core/movie_clip.h +++ /dev/null @@ -1,94 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_MOVIE_CLIP_H -#define TITANIC_MOVIE_CLIP_H - -#include "titanic/core/list.h" - -namespace Titanic { - -enum ClipFlag { - CLIPFLAG_HAS_END_FRAME = 1, - CLIPFLAG_4 = 4, - CLIPFLAG_HAS_START_FRAME = 8, - CLIPFLAG_PLAY = 0x10 -}; - -class CGameObject; - -/** - * Movie clip - */ -class CMovieClip : public ListItem { -private: - Common::List _items; - CString _string2; - CString _string3; -public: - CString _name; - int _startFrame; - int _endFrame; -public: - CLASSDEF - CMovieClip(); - CMovieClip(const CString &name, int startFrame, int endFrame); - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); - - void process(CGameObject *owner); -}; - -/** - * Movie clip list - */ -class CMovieClipList: public List { -public: - /** - * Finds and returns a movie clip in the list by name - */ - CMovieClip *findByName(const Common::String &name) const; - - /** - * Returns true if a clip exists in the list with a given name - * and starting frame number - */ - bool existsByStart(const CString &name, int startFrame = 0) const; - - /** - * Returns true if a clip exists in the list with a given name - * and starting frame number - */ - bool existsByEnd(const CString &name, int endFrame = 0) const; -}; - -} // End of namespace Titanic - -#endif /* TITANIC_MOVIE_CLIP_H */ diff --git a/engines/titanic/core/room_item.h b/engines/titanic/core/room_item.h index f44a525b60..eb7f4c43bf 100644 --- a/engines/titanic/core/room_item.h +++ b/engines/titanic/core/room_item.h @@ -25,7 +25,7 @@ #include "titanic/support/rect.h" #include "titanic/core/list.h" -#include "titanic/core/movie_clip.h" +#include "titanic/support/movie_clip.h" #include "titanic/core/named_item.h" #include "titanic/core/resource_key.h" diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 300d9718bd..ad98ac4dfd 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -70,7 +70,7 @@ #include "titanic/core/list.h" #include "titanic/core/mail_man.h" #include "titanic/core/message_target.h" -#include "titanic/core/movie_clip.h" +#include "titanic/support/movie_clip.h" #include "titanic/core/multi_drop_target.h" #include "titanic/core/node_item.h" #include "titanic/core/project_item.h" diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 3985ebfa81..3c752bf13a 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -63,7 +63,6 @@ MODULE_OBJS := \ core/list.o \ core/mail_man.o \ core/message_target.o \ - core/movie_clip.o \ core/multi_drop_target.o \ core/named_item.o \ core/node_item.o \ @@ -442,6 +441,7 @@ MODULE_OBJS := \ support/image_decoders.o \ support/mouse_cursor.o \ support/movie.o \ + support/movie_clip.o \ support/movie_event.o \ support/movie_range_info.o \ support/credit_text.o \ diff --git a/engines/titanic/support/movie_clip.cpp b/engines/titanic/support/movie_clip.cpp new file mode 100644 index 0000000000..da655ce76a --- /dev/null +++ b/engines/titanic/support/movie_clip.cpp @@ -0,0 +1,98 @@ +/* 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 "titanic/support/movie_clip.h" +#include "titanic/core/game_object.h" + +namespace Titanic { + +CMovieClip::CMovieClip(): ListItem(), _startFrame(0), _endFrame(0) { +} + +CMovieClip::CMovieClip(const CString &name, int startFrame, int endFrame): + ListItem(), _name(name), _startFrame(startFrame), _endFrame(endFrame) { +} + +void CMovieClip::save(SimpleFile *file, int indent) const { + file->writeNumberLine(2, indent); + file->writeQuotedLine("Clip", indent); + file->writeQuotedLine(_name, indent); + file->writeNumberLine(_startFrame, indent); + file->writeNumberLine(_endFrame, indent); + + ListItem::save(file, indent); +} + +void CMovieClip::load(SimpleFile *file) { + int val = file->readNumber(); + + switch (val) { + case 1: + // This should never be used + assert(0); + break; + + case 2: + file->readString(); + _name = file->readString(); + _startFrame = file->readNumber(); + _endFrame = file->readNumber(); + break; + + default: + break; + } + + ListItem::load(file); +} + +CMovieClip *CMovieClipList::findByName(const Common::String &name) const { + for (const_iterator i = begin(); i != end(); ++i) { + CMovieClip *clip = *i; + if (clip->_name == name) + return clip; + } + + return nullptr; +} + +bool CMovieClipList::existsByStart(const CString &name, int startFrame) const { + for (const_iterator i = begin(); i != end(); ++i) { + CMovieClip *clip = *i; + if (clip->_startFrame == startFrame && clip->_name == name) + return true; + } + + return false; +} + +bool CMovieClipList::existsByEnd(const CString &name, int endFrame) const { + for (const_iterator i = begin(); i != end(); ++i) { + CMovieClip *clip = *i; + if (clip->_endFrame == endFrame && clip->_name == name) + return true; + } + + return false; +} + +} // End of namespace Titanic diff --git a/engines/titanic/support/movie_clip.h b/engines/titanic/support/movie_clip.h new file mode 100644 index 0000000000..0b1106f420 --- /dev/null +++ b/engines/titanic/support/movie_clip.h @@ -0,0 +1,92 @@ +/* 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. + * + */ + +#ifndef TITANIC_MOVIE_CLIP_H +#define TITANIC_MOVIE_CLIP_H + +#include "titanic/core/list.h" + +namespace Titanic { + +enum ClipFlag { + CLIPFLAG_HAS_END_FRAME = 1, + CLIPFLAG_4 = 4, + CLIPFLAG_HAS_START_FRAME = 8, + CLIPFLAG_PLAY = 0x10 +}; + +class CGameObject; + +/** + * Movie clip + */ +class CMovieClip : public ListItem { +private: + Common::List _items; + CString _string2; + CString _string3; +public: + CString _name; + int _startFrame; + int _endFrame; +public: + CLASSDEF + CMovieClip(); + CMovieClip(const CString &name, int startFrame, int endFrame); + + /** + * Save the data for the class to file + */ + virtual void save(SimpleFile *file, int indent) const; + + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file); +}; + +/** + * Movie clip list + */ +class CMovieClipList: public List { +public: + /** + * Finds and returns a movie clip in the list by name + */ + CMovieClip *findByName(const Common::String &name) const; + + /** + * Returns true if a clip exists in the list with a given name + * and starting frame number + */ + bool existsByStart(const CString &name, int startFrame = 0) const; + + /** + * Returns true if a clip exists in the list with a given name + * and starting frame number + */ + bool existsByEnd(const CString &name, int endFrame = 0) const; +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MOVIE_CLIP_H */ diff --git a/engines/titanic/support/movie_range_info.cpp b/engines/titanic/support/movie_range_info.cpp index 6242673c10..ff246fbe7b 100644 --- a/engines/titanic/support/movie_range_info.cpp +++ b/engines/titanic/support/movie_range_info.cpp @@ -64,4 +64,18 @@ void CMovieRangeInfo::load(SimpleFile *file) { } } +void CMovieRangeInfo::process(CGameObject *owner) { +/* + int flags = 0; + if (_endFrame) + flags |= CLIPFLAG_HAS_END_FRAME; + if (_startFrame) + flags |= CLIPFLAG_HAS_START_FRAME; + + warning("TODO: CMovieClip::process"); + + owner->checkPlayMovie(_name, flags); + */ +} + } // End of namespace Titanic diff --git a/engines/titanic/support/movie_range_info.h b/engines/titanic/support/movie_range_info.h index e751e303db..2c7d86f3c5 100644 --- a/engines/titanic/support/movie_range_info.h +++ b/engines/titanic/support/movie_range_info.h @@ -30,6 +30,8 @@ namespace Titanic { +class CGameObject; + class CMovieRangeInfo : public ListItem { public: int _fieldC; @@ -57,6 +59,11 @@ public: * Adds an event to the events list */ void add(CMovieEvent *movieEvent) { _events.push_back(movieEvent); } + + void process(CGameObject *owner); +}; + +class CMovieRangeInfoList : public List { }; } // End of namespace Titanic -- cgit v1.2.3 From a82bcd3ce7ef0ae604af45fdb56668fca47e7137 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 29 Jun 2016 19:29:32 -0400 Subject: TITANIC: Added CMovieRangeInfo methods --- engines/titanic/core/game_object.cpp | 4 +- engines/titanic/core/game_object.h | 10 +++-- engines/titanic/support/movie_range_info.cpp | 67 +++++++++++++++++++--------- engines/titanic/support/movie_range_info.h | 16 ++++--- 4 files changed, 63 insertions(+), 34 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 2a2c6cf772..af866ddac4 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -1197,12 +1197,12 @@ void CGameObject::setMovie14(int v) { _surface->_movie->_field14 = v; } -void CGameObject::movie38(int v1, int v2) { +void CGameObject::surface38(int v1, int v2) { if (_surface) _surface->proc38(v1, v2); } -void CGameObject::movie38(int v1) { +void CGameObject::surface38(int v1) { if (_surface) _surface->proc38(-1, v1); } diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 553367378c..98d6d6099e 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -387,10 +387,6 @@ protected: void setMovie14(int v); - void movie38(int v1, int v2); - - void movie38(int v1); - void fn10(int v1, int v2, int v3); /** @@ -848,6 +844,12 @@ public: * Gets a dial region for a given NPC */ int talkGetDIalRegion(const CString &name, int dialNum); + + /*--- CVideoSurface Methods ---*/ + + void surface38(int v1, int v2); + + void surface38(int v1); }; } // End of namespace Titanic diff --git a/engines/titanic/support/movie_range_info.cpp b/engines/titanic/support/movie_range_info.cpp index ff246fbe7b..ab34082540 100644 --- a/engines/titanic/support/movie_range_info.cpp +++ b/engines/titanic/support/movie_range_info.cpp @@ -21,19 +21,22 @@ */ #include "titanic/support/movie_range_info.h" +#include "titanic/support/movie_clip.h" +#include "titanic/core/game_object.h" namespace Titanic { -CMovieRangeInfo::CMovieRangeInfo() : ListItem(), _fieldC(0), - _field10(0), _field14(0), _field18(0), _field1C(0) { +CMovieRangeInfo::CMovieRangeInfo() : ListItem(), _startFrame(0), _endFrame(0) { +} + +CMovieRangeInfo::~CMovieRangeInfo() { + _events.destroyContents(); } CMovieRangeInfo::CMovieRangeInfo(const CMovieRangeInfo *src) : ListItem() { - _fieldC = src->_fieldC; - _field10 = src->_field10; - _field14 = src->_field14; - _field18 = src->_field18; - _field1C = src->_field1C; + _movieName = src->_movieName; + _startFrame = src->_startFrame; + _endFrame = src->_endFrame; // Duplicate the events list for (CMovieEventList::const_iterator i = _events.begin(); @@ -44,38 +47,60 @@ CMovieRangeInfo::CMovieRangeInfo(const CMovieRangeInfo *src) : ListItem() { void CMovieRangeInfo::save(SimpleFile *file, int indent) const { file->writeNumberLine(0, indent); - file->writeNumberLine(_fieldC, indent + 1); - file->writeNumberLine(_field10, indent + 1); - file->writeNumberLine(_field14, indent + 1); - file->writeNumberLine(_field1C, indent + 1); - file->writeNumberLine(_field18, indent + 1); + file->writeQuotedLine(_movieName, indent + 1); + file->writeNumberLine(_endFrame, indent + 1); + file->writeNumberLine(_startFrame, indent + 1); _events.save(file, indent + 1); } void CMovieRangeInfo::load(SimpleFile *file) { int val = file->readNumber(); if (!val) { - _fieldC = file->readNumber(); - _field10 = file->readNumber(); - _field14 = file->readNumber(); - _field1C = file->readNumber(); - _field18 = file->readNumber(); + _movieName = file->readString(); + _endFrame = file->readNumber(); + _startFrame = file->readNumber(); _events.load(file); } } +void CMovieRangeInfo::get1(CMovieEventList &list) { + for (CMovieEventList::iterator i = _events.begin(); i != _events.end(); ++i) { + CMovieEvent *movieEvent = *i; + if (movieEvent->_fieldC == 1) + list.push_back(new CMovieEvent(movieEvent)); + } +} + +void CMovieRangeInfo::get2(CMovieEventList &list, int val) { + for (CMovieEventList::iterator i = _events.begin(); i != _events.end(); ++i) { + CMovieEvent *movieEvent = *i; + if (movieEvent->_fieldC == 2 && movieEvent->_field1C == val) + list.push_back(new CMovieEvent(movieEvent)); + } +} + void CMovieRangeInfo::process(CGameObject *owner) { -/* int flags = 0; if (_endFrame) flags |= CLIPFLAG_HAS_END_FRAME; if (_startFrame) flags |= CLIPFLAG_HAS_START_FRAME; + + for (CMovieEventList::iterator i = _events.begin(); i != _events.end(); ++i) { + CMovieEvent *movieEvent = *i; + if (!movieEvent->_fieldC) { + flags |= CLIPFLAG_PLAY; + break; + } + } - warning("TODO: CMovieClip::process"); + owner->checkPlayMovie(_movieName, flags); - owner->checkPlayMovie(_name, flags); - */ + for (CMovieEventList::iterator i = _events.begin(); i != _events.end(); ++i) { + CMovieEvent *movieEvent = *i; + if (!movieEvent->_fieldC) + owner->surface38(movieEvent->_field1C); + } } } // End of namespace Titanic diff --git a/engines/titanic/support/movie_range_info.h b/engines/titanic/support/movie_range_info.h index 2c7d86f3c5..3f077c717e 100644 --- a/engines/titanic/support/movie_range_info.h +++ b/engines/titanic/support/movie_range_info.h @@ -34,16 +34,14 @@ class CGameObject; class CMovieRangeInfo : public ListItem { public: - int _fieldC; - int _field10; - int _field14; - int _field18; - int _field1C; + CString _movieName; + uint _startFrame; + uint _endFrame; CMovieEventList _events; public: CMovieRangeInfo(); CMovieRangeInfo(const CMovieRangeInfo *src); - virtual ~CMovieRangeInfo() {} + virtual ~CMovieRangeInfo(); /** * Save the data for the class to file @@ -58,7 +56,11 @@ public: /** * Adds an event to the events list */ - void add(CMovieEvent *movieEvent) { _events.push_back(movieEvent); } + void addEvent(CMovieEvent *movieEvent) { _events.push_back(movieEvent); } + + void get1(CMovieEventList &list); + + void get2(CMovieEventList &list, int val); void process(CGameObject *owner); }; -- cgit v1.2.3 From 5ccc0a66da38d23520234e7060efaf966d3345b9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 29 Jun 2016 19:53:16 -0400 Subject: TITANIC: Removed const modifier from all saveable objects Turns out that CGameObject::save regenerates the _movieRangeInfo list. So the const suffix can no longer be used for the entire hierarchy --- engines/titanic/carry/arm.cpp | 2 +- engines/titanic/carry/arm.h | 2 +- engines/titanic/carry/auditory_centre.cpp | 2 +- engines/titanic/carry/auditory_centre.h | 2 +- engines/titanic/carry/bowl_ear.cpp | 2 +- engines/titanic/carry/bowl_ear.h | 2 +- engines/titanic/carry/brain.cpp | 2 +- engines/titanic/carry/brain.h | 2 +- engines/titanic/carry/bridge_piece.cpp | 2 +- engines/titanic/carry/bridge_piece.h | 2 +- engines/titanic/carry/carry.cpp | 2 +- engines/titanic/carry/carry.h | 2 +- engines/titanic/carry/carry_parrot.cpp | 2 +- engines/titanic/carry/carry_parrot.h | 2 +- engines/titanic/carry/central_core.cpp | 2 +- engines/titanic/carry/central_core.h | 2 +- engines/titanic/carry/chicken.cpp | 2 +- engines/titanic/carry/chicken.h | 2 +- engines/titanic/carry/crushed_tv.cpp | 2 +- engines/titanic/carry/crushed_tv.h | 2 +- engines/titanic/carry/ear.cpp | 2 +- engines/titanic/carry/ear.h | 2 +- engines/titanic/carry/eye.cpp | 2 +- engines/titanic/carry/eye.h | 2 +- engines/titanic/carry/feathers.cpp | 2 +- engines/titanic/carry/feathers.h | 2 +- engines/titanic/carry/fruit.cpp | 2 +- engines/titanic/carry/fruit.h | 2 +- engines/titanic/carry/glass.cpp | 2 +- engines/titanic/carry/glass.h | 2 +- engines/titanic/carry/hammer.cpp | 2 +- engines/titanic/carry/hammer.h | 2 +- engines/titanic/carry/head_piece.cpp | 2 +- engines/titanic/carry/head_piece.h | 2 +- engines/titanic/carry/hose.cpp | 2 +- engines/titanic/carry/hose.h | 2 +- engines/titanic/carry/hose_end.cpp | 2 +- engines/titanic/carry/hose_end.h | 2 +- engines/titanic/carry/key.cpp | 2 +- engines/titanic/carry/key.h | 2 +- engines/titanic/carry/liftbot_head.cpp | 2 +- engines/titanic/carry/liftbot_head.h | 2 +- engines/titanic/carry/long_stick.cpp | 2 +- engines/titanic/carry/long_stick.h | 2 +- engines/titanic/carry/magazine.cpp | 2 +- engines/titanic/carry/magazine.h | 2 +- engines/titanic/carry/maitred_left_arm.cpp | 2 +- engines/titanic/carry/maitred_left_arm.h | 2 +- engines/titanic/carry/maitred_right_arm.cpp | 2 +- engines/titanic/carry/maitred_right_arm.h | 2 +- engines/titanic/carry/mouth.cpp | 2 +- engines/titanic/carry/mouth.h | 2 +- engines/titanic/carry/napkin.cpp | 2 +- engines/titanic/carry/napkin.h | 2 +- engines/titanic/carry/nose.cpp | 2 +- engines/titanic/carry/nose.h | 2 +- engines/titanic/carry/note.cpp | 2 +- engines/titanic/carry/note.h | 2 +- engines/titanic/carry/parcel.cpp | 2 +- engines/titanic/carry/parcel.h | 2 +- engines/titanic/carry/perch.cpp | 2 +- engines/titanic/carry/perch.h | 2 +- engines/titanic/carry/phonograph_cylinder.cpp | 2 +- engines/titanic/carry/phonograph_cylinder.h | 2 +- engines/titanic/carry/phonograph_ear.cpp | 2 +- engines/titanic/carry/phonograph_ear.h | 2 +- engines/titanic/carry/photograph.cpp | 2 +- engines/titanic/carry/photograph.h | 2 +- engines/titanic/carry/plug_in.cpp | 2 +- engines/titanic/carry/plug_in.h | 2 +- engines/titanic/carry/speech_centre.cpp | 2 +- engines/titanic/carry/speech_centre.h | 2 +- engines/titanic/carry/sweets.cpp | 2 +- engines/titanic/carry/sweets.h | 2 +- engines/titanic/carry/test_carry.cpp | 2 +- engines/titanic/carry/test_carry.h | 2 +- engines/titanic/carry/vision_centre.cpp | 2 +- engines/titanic/carry/vision_centre.h | 2 +- engines/titanic/core/background.cpp | 2 +- engines/titanic/core/background.h | 2 +- engines/titanic/core/click_responder.cpp | 2 +- engines/titanic/core/click_responder.h | 2 +- engines/titanic/core/dont_save_file_item.cpp | 2 +- engines/titanic/core/dont_save_file_item.h | 2 +- engines/titanic/core/drop_target.cpp | 2 +- engines/titanic/core/drop_target.h | 2 +- engines/titanic/core/file_item.cpp | 2 +- engines/titanic/core/file_item.h | 2 +- engines/titanic/core/game_object.cpp | 2 +- engines/titanic/core/game_object.h | 2 +- engines/titanic/core/game_object_desc_item.cpp | 2 +- engines/titanic/core/game_object_desc_item.h | 2 +- engines/titanic/core/link_item.cpp | 2 +- engines/titanic/core/link_item.h | 2 +- engines/titanic/core/list.cpp | 2 +- engines/titanic/core/list.h | 8 ++++---- engines/titanic/core/mail_man.cpp | 2 +- engines/titanic/core/mail_man.h | 2 +- engines/titanic/core/message_target.cpp | 2 +- engines/titanic/core/message_target.h | 2 +- engines/titanic/core/multi_drop_target.cpp | 2 +- engines/titanic/core/multi_drop_target.h | 2 +- engines/titanic/core/named_item.cpp | 2 +- engines/titanic/core/named_item.h | 2 +- engines/titanic/core/node_item.cpp | 2 +- engines/titanic/core/node_item.h | 2 +- engines/titanic/core/project_item.cpp | 4 ++-- engines/titanic/core/project_item.h | 4 ++-- engines/titanic/core/resource_key.cpp | 2 +- engines/titanic/core/resource_key.h | 2 +- engines/titanic/core/room_item.cpp | 2 +- engines/titanic/core/room_item.h | 2 +- engines/titanic/core/saveable_object.cpp | 6 +++--- engines/titanic/core/saveable_object.h | 6 +++--- engines/titanic/core/static_image.cpp | 2 +- engines/titanic/core/static_image.h | 2 +- engines/titanic/core/tree_item.cpp | 2 +- engines/titanic/core/tree_item.h | 2 +- engines/titanic/core/turn_on_object.cpp | 2 +- engines/titanic/core/turn_on_object.h | 2 +- engines/titanic/core/turn_on_play_sound.cpp | 2 +- engines/titanic/core/turn_on_play_sound.h | 2 +- engines/titanic/core/turn_on_turn_off.cpp | 2 +- engines/titanic/core/turn_on_turn_off.h | 2 +- engines/titanic/core/view_item.cpp | 2 +- engines/titanic/core/view_item.h | 2 +- engines/titanic/game/announce.cpp | 2 +- engines/titanic/game/announce.h | 2 +- engines/titanic/game/annoy_barbot.cpp | 2 +- engines/titanic/game/annoy_barbot.h | 2 +- engines/titanic/game/arb_background.cpp | 2 +- engines/titanic/game/arb_background.h | 2 +- engines/titanic/game/arboretum_gate.cpp | 2 +- engines/titanic/game/arboretum_gate.h | 2 +- engines/titanic/game/auto_animate.cpp | 2 +- engines/titanic/game/auto_animate.h | 2 +- engines/titanic/game/bar_bell.cpp | 2 +- engines/titanic/game/bar_bell.h | 2 +- engines/titanic/game/bar_menu.cpp | 2 +- engines/titanic/game/bar_menu.h | 2 +- engines/titanic/game/bar_menu_button.cpp | 2 +- engines/titanic/game/bar_menu_button.h | 2 +- engines/titanic/game/belbot_get_light.cpp | 2 +- engines/titanic/game/belbot_get_light.h | 2 +- engines/titanic/game/bilge_succubus.cpp | 2 +- engines/titanic/game/bilge_succubus.h | 2 +- engines/titanic/game/bomb.cpp | 2 +- engines/titanic/game/bomb.h | 2 +- engines/titanic/game/bottom_of_well_monitor.cpp | 2 +- engines/titanic/game/bottom_of_well_monitor.h | 2 +- engines/titanic/game/bowl_unlocker.cpp | 2 +- engines/titanic/game/bowl_unlocker.h | 2 +- engines/titanic/game/brain_slot.cpp | 2 +- engines/titanic/game/brain_slot.h | 2 +- engines/titanic/game/bridge_door.cpp | 2 +- engines/titanic/game/bridge_door.h | 2 +- engines/titanic/game/bridge_view.cpp | 2 +- engines/titanic/game/bridge_view.h | 2 +- engines/titanic/game/broken_pell_base.cpp | 2 +- engines/titanic/game/broken_pell_base.h | 2 +- engines/titanic/game/broken_pellerator.cpp | 2 +- engines/titanic/game/broken_pellerator.h | 2 +- engines/titanic/game/broken_pellerator_froz.cpp | 2 +- engines/titanic/game/broken_pellerator_froz.h | 2 +- engines/titanic/game/cage.cpp | 2 +- engines/titanic/game/cage.h | 2 +- engines/titanic/game/call_pellerator.cpp | 2 +- engines/titanic/game/call_pellerator.h | 2 +- engines/titanic/game/captains_wheel.cpp | 2 +- engines/titanic/game/captains_wheel.h | 2 +- engines/titanic/game/cdrom.cpp | 2 +- engines/titanic/game/cdrom.h | 2 +- engines/titanic/game/cdrom_computer.cpp | 2 +- engines/titanic/game/cdrom_computer.h | 2 +- engines/titanic/game/cdrom_tray.cpp | 2 +- engines/titanic/game/cdrom_tray.h | 2 +- engines/titanic/game/cell_point_button.cpp | 2 +- engines/titanic/game/cell_point_button.h | 2 +- engines/titanic/game/chev_code.cpp | 2 +- engines/titanic/game/chev_code.h | 2 +- engines/titanic/game/chev_panel.cpp | 2 +- engines/titanic/game/chev_panel.h | 2 +- engines/titanic/game/chicken_cooler.cpp | 2 +- engines/titanic/game/chicken_cooler.h | 2 +- engines/titanic/game/chicken_dispensor.cpp | 2 +- engines/titanic/game/chicken_dispensor.h | 2 +- engines/titanic/game/close_broken_pel.cpp | 2 +- engines/titanic/game/close_broken_pel.h | 2 +- engines/titanic/game/code_wheel.cpp | 2 +- engines/titanic/game/code_wheel.h | 2 +- engines/titanic/game/computer.cpp | 2 +- engines/titanic/game/computer.h | 2 +- engines/titanic/game/computer_screen.cpp | 2 +- engines/titanic/game/computer_screen.h | 2 +- engines/titanic/game/cookie.cpp | 2 +- engines/titanic/game/cookie.h | 2 +- engines/titanic/game/credits.cpp | 2 +- engines/titanic/game/credits.h | 2 +- engines/titanic/game/credits_button.cpp | 2 +- engines/titanic/game/credits_button.h | 2 +- engines/titanic/game/dead_area.cpp | 2 +- engines/titanic/game/dead_area.h | 2 +- engines/titanic/game/desk_click_responder.cpp | 2 +- engines/titanic/game/desk_click_responder.h | 2 +- engines/titanic/game/doorbot_elevator_handler.cpp | 2 +- engines/titanic/game/doorbot_elevator_handler.h | 2 +- engines/titanic/game/doorbot_home_handler.cpp | 2 +- engines/titanic/game/doorbot_home_handler.h | 2 +- engines/titanic/game/ear_sweet_bowl.cpp | 2 +- engines/titanic/game/ear_sweet_bowl.h | 2 +- engines/titanic/game/eject_phonograph_button.cpp | 2 +- engines/titanic/game/eject_phonograph_button.h | 2 +- engines/titanic/game/elevator_action_area.cpp | 2 +- engines/titanic/game/elevator_action_area.h | 2 +- engines/titanic/game/emma_control.cpp | 2 +- engines/titanic/game/emma_control.h | 2 +- engines/titanic/game/empty_nut_bowl.cpp | 2 +- engines/titanic/game/empty_nut_bowl.h | 2 +- engines/titanic/game/end_credit_text.cpp | 2 +- engines/titanic/game/end_credit_text.h | 2 +- engines/titanic/game/end_credits.cpp | 2 +- engines/titanic/game/end_credits.h | 2 +- engines/titanic/game/end_explode_ship.cpp | 2 +- engines/titanic/game/end_explode_ship.h | 2 +- engines/titanic/game/end_game_credits.cpp | 2 +- engines/titanic/game/end_game_credits.h | 2 +- engines/titanic/game/end_sequence_control.cpp | 2 +- engines/titanic/game/end_sequence_control.h | 2 +- engines/titanic/game/fan.cpp | 2 +- engines/titanic/game/fan.h | 2 +- engines/titanic/game/fan_control.cpp | 2 +- engines/titanic/game/fan_control.h | 2 +- engines/titanic/game/fan_decrease.cpp | 2 +- engines/titanic/game/fan_decrease.h | 2 +- engines/titanic/game/fan_increase.cpp | 2 +- engines/titanic/game/fan_increase.h | 2 +- engines/titanic/game/fan_noises.cpp | 2 +- engines/titanic/game/fan_noises.h | 2 +- engines/titanic/game/floor_indicator.cpp | 2 +- engines/titanic/game/floor_indicator.h | 2 +- engines/titanic/game/games_console.cpp | 2 +- engines/titanic/game/games_console.h | 2 +- engines/titanic/game/get_lift_eye2.cpp | 2 +- engines/titanic/game/get_lift_eye2.h | 2 +- engines/titanic/game/glass_smasher.cpp | 2 +- engines/titanic/game/glass_smasher.h | 2 +- engines/titanic/game/gondolier/gondolier_base.cpp | 2 +- engines/titanic/game/gondolier/gondolier_base.h | 2 +- engines/titanic/game/gondolier/gondolier_chest.cpp | 2 +- engines/titanic/game/gondolier/gondolier_chest.h | 2 +- engines/titanic/game/gondolier/gondolier_face.cpp | 2 +- engines/titanic/game/gondolier/gondolier_face.h | 2 +- engines/titanic/game/gondolier/gondolier_mixer.cpp | 2 +- engines/titanic/game/gondolier/gondolier_mixer.h | 2 +- engines/titanic/game/gondolier/gondolier_slider.cpp | 2 +- engines/titanic/game/gondolier/gondolier_slider.h | 2 +- engines/titanic/game/hammer_clip.cpp | 2 +- engines/titanic/game/hammer_clip.h | 2 +- engines/titanic/game/hammer_dispensor.cpp | 2 +- engines/titanic/game/hammer_dispensor.h | 2 +- engines/titanic/game/hammer_dispensor_button.cpp | 2 +- engines/titanic/game/hammer_dispensor_button.h | 2 +- engines/titanic/game/head_slot.cpp | 2 +- engines/titanic/game/head_slot.h | 2 +- engines/titanic/game/head_smash_event.cpp | 2 +- engines/titanic/game/head_smash_event.h | 2 +- engines/titanic/game/head_smash_lever.cpp | 2 +- engines/titanic/game/head_smash_lever.h | 2 +- engines/titanic/game/head_spinner.cpp | 2 +- engines/titanic/game/head_spinner.h | 2 +- engines/titanic/game/idle_summoner.cpp | 2 +- engines/titanic/game/idle_summoner.h | 2 +- engines/titanic/game/leave_sec_class_state.cpp | 2 +- engines/titanic/game/leave_sec_class_state.h | 2 +- engines/titanic/game/lemon_dispensor.cpp | 2 +- engines/titanic/game/lemon_dispensor.h | 2 +- engines/titanic/game/light.cpp | 2 +- engines/titanic/game/light.h | 2 +- engines/titanic/game/light_switch.cpp | 2 +- engines/titanic/game/light_switch.h | 2 +- engines/titanic/game/little_lift_button.cpp | 2 +- engines/titanic/game/little_lift_button.h | 2 +- engines/titanic/game/long_stick_dispenser.cpp | 2 +- engines/titanic/game/long_stick_dispenser.h | 2 +- engines/titanic/game/maitred/maitred_arm_holder.cpp | 2 +- engines/titanic/game/maitred/maitred_arm_holder.h | 2 +- engines/titanic/game/maitred/maitred_body.cpp | 2 +- engines/titanic/game/maitred/maitred_body.h | 2 +- engines/titanic/game/maitred/maitred_legs.cpp | 2 +- engines/titanic/game/maitred/maitred_legs.h | 2 +- engines/titanic/game/maitred/maitred_prod_receptor.cpp | 2 +- engines/titanic/game/maitred/maitred_prod_receptor.h | 2 +- engines/titanic/game/missiveomat.cpp | 2 +- engines/titanic/game/missiveomat.h | 2 +- engines/titanic/game/missiveomat_button.cpp | 2 +- engines/titanic/game/missiveomat_button.h | 2 +- engines/titanic/game/movie_tester.cpp | 2 +- engines/titanic/game/movie_tester.h | 2 +- engines/titanic/game/music_console_button.cpp | 2 +- engines/titanic/game/music_console_button.h | 2 +- engines/titanic/game/music_room_phonograph.cpp | 2 +- engines/titanic/game/music_room_phonograph.h | 2 +- engines/titanic/game/music_room_stop_phonograph_button.cpp | 2 +- engines/titanic/game/music_room_stop_phonograph_button.h | 2 +- engines/titanic/game/music_system_lock.cpp | 2 +- engines/titanic/game/music_system_lock.h | 2 +- engines/titanic/game/musical_instrument.cpp | 2 +- engines/titanic/game/musical_instrument.h | 2 +- engines/titanic/game/nav_helmet.cpp | 2 +- engines/titanic/game/nav_helmet.h | 2 +- engines/titanic/game/navigation_computer.cpp | 2 +- engines/titanic/game/navigation_computer.h | 2 +- engines/titanic/game/no_nut_bowl.cpp | 2 +- engines/titanic/game/no_nut_bowl.h | 2 +- engines/titanic/game/nose_holder.cpp | 2 +- engines/titanic/game/nose_holder.h | 2 +- engines/titanic/game/null_port_hole.cpp | 2 +- engines/titanic/game/null_port_hole.h | 2 +- engines/titanic/game/nut_replacer.cpp | 2 +- engines/titanic/game/nut_replacer.h | 2 +- engines/titanic/game/parrot/parrot_lobby_controller.cpp | 2 +- engines/titanic/game/parrot/parrot_lobby_controller.h | 2 +- engines/titanic/game/parrot/parrot_lobby_link_updater.cpp | 2 +- engines/titanic/game/parrot/parrot_lobby_link_updater.h | 2 +- engines/titanic/game/parrot/parrot_lobby_object.cpp | 2 +- engines/titanic/game/parrot/parrot_lobby_object.h | 2 +- engines/titanic/game/parrot/parrot_lobby_view_object.cpp | 2 +- engines/titanic/game/parrot/parrot_lobby_view_object.h | 2 +- engines/titanic/game/parrot/parrot_loser.cpp | 2 +- engines/titanic/game/parrot/parrot_loser.h | 2 +- engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp | 2 +- engines/titanic/game/parrot/parrot_nut_bowl_actor.h | 2 +- engines/titanic/game/parrot/parrot_nut_eater.cpp | 2 +- engines/titanic/game/parrot/parrot_nut_eater.h | 2 +- engines/titanic/game/parrot/parrot_perch_holder.cpp | 2 +- engines/titanic/game/parrot/parrot_perch_holder.h | 2 +- engines/titanic/game/parrot/parrot_succubus.cpp | 2 +- engines/titanic/game/parrot/parrot_succubus.h | 2 +- engines/titanic/game/parrot/parrot_trigger.cpp | 2 +- engines/titanic/game/parrot/parrot_trigger.h | 2 +- engines/titanic/game/parrot/player_meets_parrot.cpp | 2 +- engines/titanic/game/parrot/player_meets_parrot.h | 2 +- engines/titanic/game/pet/pet.cpp | 2 +- engines/titanic/game/pet/pet.h | 2 +- engines/titanic/game/pet/pet_class1.cpp | 2 +- engines/titanic/game/pet/pet_class1.h | 2 +- engines/titanic/game/pet/pet_class2.cpp | 2 +- engines/titanic/game/pet/pet_class2.h | 2 +- engines/titanic/game/pet/pet_class3.cpp | 2 +- engines/titanic/game/pet/pet_class3.h | 2 +- engines/titanic/game/pet/pet_lift.cpp | 2 +- engines/titanic/game/pet/pet_lift.h | 2 +- engines/titanic/game/pet/pet_monitor.cpp | 2 +- engines/titanic/game/pet/pet_monitor.h | 2 +- engines/titanic/game/pet/pet_pellerator.cpp | 2 +- engines/titanic/game/pet/pet_pellerator.h | 2 +- engines/titanic/game/pet/pet_position.cpp | 2 +- engines/titanic/game/pet/pet_position.h | 2 +- engines/titanic/game/pet/pet_sentinal.cpp | 2 +- engines/titanic/game/pet/pet_sentinal.h | 2 +- engines/titanic/game/pet/pet_sounds.cpp | 2 +- engines/titanic/game/pet/pet_sounds.h | 2 +- engines/titanic/game/pet/pet_transition.cpp | 2 +- engines/titanic/game/pet/pet_transition.h | 2 +- engines/titanic/game/pet/pet_transport.cpp | 2 +- engines/titanic/game/pet/pet_transport.h | 2 +- engines/titanic/game/pet_disabler.cpp | 2 +- engines/titanic/game/pet_disabler.h | 2 +- engines/titanic/game/phonograph.cpp | 2 +- engines/titanic/game/phonograph.h | 2 +- engines/titanic/game/phonograph_lid.cpp | 2 +- engines/titanic/game/phonograph_lid.h | 2 +- engines/titanic/game/pickup/pick_up.cpp | 2 +- engines/titanic/game/pickup/pick_up.h | 2 +- engines/titanic/game/pickup/pick_up_bar_glass.cpp | 2 +- engines/titanic/game/pickup/pick_up_bar_glass.h | 2 +- engines/titanic/game/pickup/pick_up_hose.cpp | 2 +- engines/titanic/game/pickup/pick_up_hose.h | 2 +- engines/titanic/game/pickup/pick_up_lemon.cpp | 2 +- engines/titanic/game/pickup/pick_up_lemon.h | 2 +- engines/titanic/game/pickup/pick_up_speech_centre.cpp | 2 +- engines/titanic/game/pickup/pick_up_speech_centre.h | 2 +- engines/titanic/game/pickup/pick_up_vis_centre.cpp | 2 +- engines/titanic/game/pickup/pick_up_vis_centre.h | 2 +- engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp | 2 +- engines/titanic/game/placeholder/bar_shelf_vis_centre.h | 2 +- engines/titanic/game/placeholder/lemon_on_bar.cpp | 2 +- engines/titanic/game/placeholder/lemon_on_bar.h | 2 +- engines/titanic/game/placeholder/place_holder_item.cpp | 2 +- engines/titanic/game/placeholder/place_holder_item.h | 2 +- engines/titanic/game/placeholder/tv_on_bar.cpp | 2 +- engines/titanic/game/placeholder/tv_on_bar.h | 2 +- engines/titanic/game/play_music_button.cpp | 2 +- engines/titanic/game/play_music_button.h | 2 +- engines/titanic/game/play_on_act.cpp | 2 +- engines/titanic/game/play_on_act.h | 2 +- engines/titanic/game/port_hole.cpp | 2 +- engines/titanic/game/port_hole.h | 2 +- engines/titanic/game/record_phonograph_button.cpp | 2 +- engines/titanic/game/record_phonograph_button.h | 2 +- engines/titanic/game/replacement_ear.cpp | 2 +- engines/titanic/game/replacement_ear.h | 2 +- engines/titanic/game/reserved_table.cpp | 2 +- engines/titanic/game/reserved_table.h | 2 +- engines/titanic/game/restaurant_cylinder_holder.cpp | 2 +- engines/titanic/game/restaurant_cylinder_holder.h | 2 +- engines/titanic/game/restaurant_phonograph.cpp | 2 +- engines/titanic/game/restaurant_phonograph.h | 2 +- engines/titanic/game/sauce_dispensor.cpp | 2 +- engines/titanic/game/sauce_dispensor.h | 2 +- engines/titanic/game/search_point.cpp | 2 +- engines/titanic/game/search_point.h | 2 +- engines/titanic/game/season_background.cpp | 2 +- engines/titanic/game/season_background.h | 2 +- engines/titanic/game/season_barrel.cpp | 2 +- engines/titanic/game/season_barrel.h | 2 +- engines/titanic/game/seasonal_adjustment.cpp | 2 +- engines/titanic/game/seasonal_adjustment.h | 2 +- engines/titanic/game/service_elevator_window.cpp | 2 +- engines/titanic/game/service_elevator_window.h | 2 +- engines/titanic/game/sgt/armchair.cpp | 2 +- engines/titanic/game/sgt/armchair.h | 2 +- engines/titanic/game/sgt/basin.cpp | 2 +- engines/titanic/game/sgt/basin.h | 2 +- engines/titanic/game/sgt/bedfoot.cpp | 2 +- engines/titanic/game/sgt/bedfoot.h | 2 +- engines/titanic/game/sgt/bedhead.cpp | 2 +- engines/titanic/game/sgt/bedhead.h | 2 +- engines/titanic/game/sgt/chest_of_drawers.cpp | 2 +- engines/titanic/game/sgt/chest_of_drawers.h | 2 +- engines/titanic/game/sgt/desk.cpp | 2 +- engines/titanic/game/sgt/desk.h | 2 +- engines/titanic/game/sgt/deskchair.cpp | 2 +- engines/titanic/game/sgt/deskchair.h | 2 +- engines/titanic/game/sgt/drawer.cpp | 2 +- engines/titanic/game/sgt/drawer.h | 2 +- engines/titanic/game/sgt/sgt_doors.cpp | 2 +- engines/titanic/game/sgt/sgt_doors.h | 2 +- engines/titanic/game/sgt/sgt_nav.cpp | 2 +- engines/titanic/game/sgt/sgt_nav.h | 2 +- engines/titanic/game/sgt/sgt_navigation.cpp | 2 +- engines/titanic/game/sgt/sgt_navigation.h | 2 +- engines/titanic/game/sgt/sgt_restaurant_doors.cpp | 2 +- engines/titanic/game/sgt/sgt_restaurant_doors.h | 2 +- engines/titanic/game/sgt/sgt_state_control.cpp | 2 +- engines/titanic/game/sgt/sgt_state_control.h | 2 +- engines/titanic/game/sgt/sgt_state_room.cpp | 2 +- engines/titanic/game/sgt/sgt_state_room.h | 2 +- engines/titanic/game/sgt/sgt_tv.cpp | 2 +- engines/titanic/game/sgt/sgt_tv.h | 2 +- engines/titanic/game/sgt/sgt_upper_doors_sound.cpp | 2 +- engines/titanic/game/sgt/sgt_upper_doors_sound.h | 2 +- engines/titanic/game/sgt/toilet.cpp | 2 +- engines/titanic/game/sgt/toilet.h | 2 +- engines/titanic/game/sgt/vase.cpp | 2 +- engines/titanic/game/sgt/vase.h | 2 +- engines/titanic/game/sgt/washstand.cpp | 2 +- engines/titanic/game/sgt/washstand.h | 2 +- engines/titanic/game/ship_setting.cpp | 2 +- engines/titanic/game/ship_setting.h | 2 +- engines/titanic/game/ship_setting_button.cpp | 2 +- engines/titanic/game/ship_setting_button.h | 2 +- engines/titanic/game/show_cell_points.cpp | 2 +- engines/titanic/game/show_cell_points.h | 2 +- engines/titanic/game/speech_dispensor.cpp | 2 +- engines/titanic/game/speech_dispensor.h | 2 +- engines/titanic/game/splash_animation.cpp | 2 +- engines/titanic/game/splash_animation.h | 2 +- engines/titanic/game/starling_puret.cpp | 2 +- engines/titanic/game/starling_puret.h | 2 +- engines/titanic/game/start_action.cpp | 2 +- engines/titanic/game/start_action.h | 2 +- engines/titanic/game/stop_phonograph_button.cpp | 2 +- engines/titanic/game/stop_phonograph_button.h | 2 +- engines/titanic/game/sub_glass.cpp | 2 +- engines/titanic/game/sub_glass.h | 2 +- engines/titanic/game/sub_wrapper.cpp | 2 +- engines/titanic/game/sub_wrapper.h | 2 +- engines/titanic/game/sweet_bowl.cpp | 2 +- engines/titanic/game/sweet_bowl.h | 2 +- engines/titanic/game/television.cpp | 2 +- engines/titanic/game/television.h | 2 +- engines/titanic/game/third_class_canal.cpp | 2 +- engines/titanic/game/third_class_canal.h | 2 +- engines/titanic/game/throw_tv_down_well.cpp | 2 +- engines/titanic/game/throw_tv_down_well.h | 2 +- engines/titanic/game/titania_still_control.cpp | 2 +- engines/titanic/game/titania_still_control.h | 2 +- engines/titanic/game/tow_parrot_nav.cpp | 2 +- engines/titanic/game/tow_parrot_nav.h | 2 +- engines/titanic/game/transport/exit_pellerator.h | 2 +- engines/titanic/game/transport/gondolier.cpp | 2 +- engines/titanic/game/transport/gondolier.h | 2 +- engines/titanic/game/transport/lift.cpp | 2 +- engines/titanic/game/transport/lift.h | 2 +- engines/titanic/game/transport/lift_indicator.cpp | 2 +- engines/titanic/game/transport/lift_indicator.h | 2 +- engines/titanic/game/transport/pellerator.cpp | 2 +- engines/titanic/game/transport/pellerator.h | 2 +- engines/titanic/game/transport/service_elevator.cpp | 2 +- engines/titanic/game/transport/service_elevator.h | 2 +- engines/titanic/game/transport/transport.cpp | 2 +- engines/titanic/game/transport/transport.h | 2 +- engines/titanic/game/up_lighter.cpp | 2 +- engines/titanic/game/up_lighter.h | 2 +- engines/titanic/game/useless_lever.cpp | 2 +- engines/titanic/game/useless_lever.h | 2 +- engines/titanic/game/volume_control.cpp | 2 +- engines/titanic/game/volume_control.h | 2 +- engines/titanic/game/wheel_button.cpp | 2 +- engines/titanic/game/wheel_button.h | 2 +- engines/titanic/game/wheel_hotspot.cpp | 2 +- engines/titanic/game/wheel_hotspot.h | 2 +- engines/titanic/game/wheel_spin.cpp | 2 +- engines/titanic/game/wheel_spin.h | 2 +- engines/titanic/game/wheel_spin_horn.cpp | 2 +- engines/titanic/game/wheel_spin_horn.h | 2 +- engines/titanic/gfx/act_button.cpp | 2 +- engines/titanic/gfx/act_button.h | 2 +- engines/titanic/gfx/changes_season_button.cpp | 2 +- engines/titanic/gfx/changes_season_button.h | 2 +- engines/titanic/gfx/chev_left_off.cpp | 2 +- engines/titanic/gfx/chev_left_off.h | 2 +- engines/titanic/gfx/chev_left_on.cpp | 2 +- engines/titanic/gfx/chev_left_on.h | 2 +- engines/titanic/gfx/chev_right_off.cpp | 2 +- engines/titanic/gfx/chev_right_off.h | 2 +- engines/titanic/gfx/chev_right_on.cpp | 2 +- engines/titanic/gfx/chev_right_on.h | 2 +- engines/titanic/gfx/chev_send_rec_switch.cpp | 2 +- engines/titanic/gfx/chev_send_rec_switch.h | 2 +- engines/titanic/gfx/chev_switch.cpp | 2 +- engines/titanic/gfx/chev_switch.h | 2 +- engines/titanic/gfx/edit_control.cpp | 2 +- engines/titanic/gfx/edit_control.h | 2 +- engines/titanic/gfx/elevator_button.cpp | 2 +- engines/titanic/gfx/elevator_button.h | 2 +- engines/titanic/gfx/get_from_succ.cpp | 2 +- engines/titanic/gfx/get_from_succ.h | 2 +- engines/titanic/gfx/helmet_on_off.cpp | 2 +- engines/titanic/gfx/helmet_on_off.h | 2 +- engines/titanic/gfx/home_photo.cpp | 2 +- engines/titanic/gfx/home_photo.h | 2 +- engines/titanic/gfx/icon_nav_action.cpp | 2 +- engines/titanic/gfx/icon_nav_action.h | 2 +- engines/titanic/gfx/icon_nav_butt.cpp | 2 +- engines/titanic/gfx/icon_nav_butt.h | 2 +- engines/titanic/gfx/icon_nav_down.cpp | 2 +- engines/titanic/gfx/icon_nav_down.h | 2 +- engines/titanic/gfx/icon_nav_image.cpp | 2 +- engines/titanic/gfx/icon_nav_image.h | 2 +- engines/titanic/gfx/icon_nav_left.cpp | 2 +- engines/titanic/gfx/icon_nav_left.h | 2 +- engines/titanic/gfx/icon_nav_receive.cpp | 2 +- engines/titanic/gfx/icon_nav_receive.h | 2 +- engines/titanic/gfx/icon_nav_right.cpp | 2 +- engines/titanic/gfx/icon_nav_right.h | 2 +- engines/titanic/gfx/icon_nav_send.cpp | 2 +- engines/titanic/gfx/icon_nav_send.h | 2 +- engines/titanic/gfx/icon_nav_up.cpp | 2 +- engines/titanic/gfx/icon_nav_up.h | 2 +- engines/titanic/gfx/keybrd_butt.cpp | 2 +- engines/titanic/gfx/keybrd_butt.h | 2 +- engines/titanic/gfx/move_object_button.cpp | 2 +- engines/titanic/gfx/move_object_button.h | 2 +- engines/titanic/gfx/music_control.cpp | 2 +- engines/titanic/gfx/music_control.h | 2 +- engines/titanic/gfx/music_slider.cpp | 2 +- engines/titanic/gfx/music_slider.h | 2 +- engines/titanic/gfx/music_slider_pitch.h | 2 +- engines/titanic/gfx/music_slider_speed.h | 2 +- engines/titanic/gfx/music_switch.cpp | 2 +- engines/titanic/gfx/music_switch.h | 2 +- engines/titanic/gfx/music_switch_inversion.h | 2 +- engines/titanic/gfx/music_switch_reverse.h | 2 +- engines/titanic/gfx/music_voice_mute.h | 2 +- engines/titanic/gfx/send_to_succ.cpp | 2 +- engines/titanic/gfx/send_to_succ.h | 2 +- engines/titanic/gfx/sgt_selector.cpp | 2 +- engines/titanic/gfx/sgt_selector.h | 2 +- engines/titanic/gfx/slider_button.cpp | 2 +- engines/titanic/gfx/slider_button.h | 2 +- engines/titanic/gfx/small_chev_left_off.cpp | 2 +- engines/titanic/gfx/small_chev_left_off.h | 2 +- engines/titanic/gfx/small_chev_left_on.cpp | 2 +- engines/titanic/gfx/small_chev_left_on.h | 2 +- engines/titanic/gfx/small_chev_right_off.cpp | 2 +- engines/titanic/gfx/small_chev_right_off.h | 2 +- engines/titanic/gfx/small_chev_right_on.cpp | 2 +- engines/titanic/gfx/small_chev_right_on.h | 2 +- engines/titanic/gfx/st_button.cpp | 2 +- engines/titanic/gfx/st_button.h | 2 +- engines/titanic/gfx/status_change_button.cpp | 2 +- engines/titanic/gfx/status_change_button.h | 2 +- engines/titanic/gfx/text_down.cpp | 2 +- engines/titanic/gfx/text_down.h | 2 +- engines/titanic/gfx/text_skrew.cpp | 2 +- engines/titanic/gfx/text_skrew.h | 2 +- engines/titanic/gfx/text_up.cpp | 2 +- engines/titanic/gfx/text_up.h | 2 +- engines/titanic/gfx/toggle_button.cpp | 2 +- engines/titanic/gfx/toggle_button.h | 2 +- engines/titanic/gfx/toggle_switch.cpp | 2 +- engines/titanic/gfx/toggle_switch.h | 2 +- engines/titanic/messages/auto_sound_event.cpp | 2 +- engines/titanic/messages/auto_sound_event.h | 2 +- engines/titanic/messages/bilge_auto_sound_event.cpp | 2 +- engines/titanic/messages/bilge_auto_sound_event.h | 2 +- engines/titanic/messages/bilge_dispensor_event.cpp | 2 +- engines/titanic/messages/bilge_dispensor_event.h | 2 +- engines/titanic/messages/door_auto_sound_event.cpp | 2 +- engines/titanic/messages/door_auto_sound_event.h | 2 +- engines/titanic/messages/messages.cpp | 2 +- engines/titanic/messages/messages.h | 2 +- engines/titanic/messages/service_elevator_door.cpp | 2 +- engines/titanic/messages/service_elevator_door.h | 2 +- engines/titanic/moves/enter_bomb_room.cpp | 2 +- engines/titanic/moves/enter_bomb_room.h | 2 +- engines/titanic/moves/enter_bridge.cpp | 2 +- engines/titanic/moves/enter_bridge.h | 2 +- engines/titanic/moves/enter_exit_first_class_state.cpp | 2 +- engines/titanic/moves/enter_exit_first_class_state.h | 2 +- engines/titanic/moves/enter_exit_mini_lift.cpp | 2 +- engines/titanic/moves/enter_exit_mini_lift.h | 2 +- engines/titanic/moves/enter_exit_sec_class_mini_lift.cpp | 2 +- engines/titanic/moves/enter_exit_sec_class_mini_lift.h | 2 +- engines/titanic/moves/enter_exit_view.cpp | 2 +- engines/titanic/moves/enter_exit_view.h | 2 +- engines/titanic/moves/enter_sec_class_state.cpp | 2 +- engines/titanic/moves/enter_sec_class_state.h | 2 +- engines/titanic/moves/exit_arboretum.cpp | 2 +- engines/titanic/moves/exit_arboretum.h | 2 +- engines/titanic/moves/exit_bridge.cpp | 2 +- engines/titanic/moves/exit_bridge.h | 2 +- engines/titanic/moves/exit_lift.cpp | 2 +- engines/titanic/moves/exit_lift.h | 2 +- engines/titanic/moves/exit_pellerator.cpp | 2 +- engines/titanic/moves/exit_pellerator.h | 2 +- engines/titanic/moves/exit_state_room.cpp | 2 +- engines/titanic/moves/exit_state_room.h | 2 +- engines/titanic/moves/exit_tiania.cpp | 2 +- engines/titanic/moves/exit_tiania.h | 2 +- engines/titanic/moves/move_player_in_parrot_room.cpp | 2 +- engines/titanic/moves/move_player_in_parrot_room.h | 2 +- engines/titanic/moves/move_player_to.cpp | 2 +- engines/titanic/moves/move_player_to.h | 2 +- engines/titanic/moves/move_player_to_from.cpp | 2 +- engines/titanic/moves/move_player_to_from.h | 2 +- engines/titanic/moves/multi_move.cpp | 2 +- engines/titanic/moves/multi_move.h | 2 +- engines/titanic/moves/pan_from_pel.cpp | 2 +- engines/titanic/moves/pan_from_pel.h | 2 +- engines/titanic/moves/restaurant_pan_handler.cpp | 2 +- engines/titanic/moves/restaurant_pan_handler.h | 2 +- engines/titanic/moves/restricted_move.cpp | 2 +- engines/titanic/moves/restricted_move.h | 2 +- engines/titanic/moves/scraliontis_table.cpp | 2 +- engines/titanic/moves/scraliontis_table.h | 2 +- engines/titanic/moves/trip_down_canal.cpp | 2 +- engines/titanic/moves/trip_down_canal.h | 2 +- engines/titanic/npcs/barbot.cpp | 2 +- engines/titanic/npcs/barbot.h | 2 +- engines/titanic/npcs/bellbot.cpp | 2 +- engines/titanic/npcs/bellbot.h | 2 +- engines/titanic/npcs/callbot.cpp | 2 +- engines/titanic/npcs/callbot.h | 2 +- engines/titanic/npcs/character.cpp | 2 +- engines/titanic/npcs/character.h | 2 +- engines/titanic/npcs/deskbot.cpp | 2 +- engines/titanic/npcs/deskbot.h | 2 +- engines/titanic/npcs/doorbot.cpp | 2 +- engines/titanic/npcs/doorbot.h | 2 +- engines/titanic/npcs/liftbot.cpp | 2 +- engines/titanic/npcs/liftbot.h | 2 +- engines/titanic/npcs/maitre_d.cpp | 2 +- engines/titanic/npcs/maitre_d.h | 2 +- engines/titanic/npcs/mobile.cpp | 2 +- engines/titanic/npcs/mobile.h | 2 +- engines/titanic/npcs/parrot.cpp | 2 +- engines/titanic/npcs/parrot.h | 2 +- engines/titanic/npcs/robot_controller.cpp | 2 +- engines/titanic/npcs/robot_controller.h | 2 +- engines/titanic/npcs/starlings.cpp | 2 +- engines/titanic/npcs/starlings.h | 2 +- engines/titanic/npcs/succubus.cpp | 2 +- engines/titanic/npcs/succubus.h | 2 +- engines/titanic/npcs/summon_bots.cpp | 2 +- engines/titanic/npcs/summon_bots.h | 2 +- engines/titanic/npcs/titania.cpp | 2 +- engines/titanic/npcs/titania.h | 2 +- engines/titanic/npcs/true_talk_npc.cpp | 2 +- engines/titanic/npcs/true_talk_npc.h | 2 +- engines/titanic/pet_control/pet_control.cpp | 4 ++-- engines/titanic/pet_control/pet_control.h | 4 ++-- engines/titanic/pet_control/pet_conversations.cpp | 2 +- engines/titanic/pet_control/pet_conversations.h | 2 +- engines/titanic/pet_control/pet_drag_chev.cpp | 2 +- engines/titanic/pet_control/pet_drag_chev.h | 2 +- engines/titanic/pet_control/pet_graphic.cpp | 2 +- engines/titanic/pet_control/pet_graphic.h | 2 +- engines/titanic/pet_control/pet_graphic2.cpp | 2 +- engines/titanic/pet_control/pet_graphic2.h | 2 +- engines/titanic/pet_control/pet_inventory.cpp | 2 +- engines/titanic/pet_control/pet_inventory.h | 2 +- engines/titanic/pet_control/pet_leaf.cpp | 2 +- engines/titanic/pet_control/pet_leaf.h | 2 +- engines/titanic/pet_control/pet_message.h | 2 +- engines/titanic/pet_control/pet_mode_off.cpp | 2 +- engines/titanic/pet_control/pet_mode_off.h | 2 +- engines/titanic/pet_control/pet_mode_on.cpp | 2 +- engines/titanic/pet_control/pet_mode_on.h | 2 +- engines/titanic/pet_control/pet_mode_panel.cpp | 2 +- engines/titanic/pet_control/pet_mode_panel.h | 2 +- engines/titanic/pet_control/pet_pannel1.cpp | 2 +- engines/titanic/pet_control/pet_pannel1.h | 2 +- engines/titanic/pet_control/pet_pannel2.cpp | 2 +- engines/titanic/pet_control/pet_pannel2.h | 2 +- engines/titanic/pet_control/pet_pannel3.cpp | 2 +- engines/titanic/pet_control/pet_pannel3.h | 2 +- engines/titanic/pet_control/pet_real_life.h | 2 +- engines/titanic/pet_control/pet_rooms.cpp | 2 +- engines/titanic/pet_control/pet_rooms.h | 2 +- engines/titanic/pet_control/pet_rooms_glyphs.cpp | 4 ++-- engines/titanic/pet_control/pet_rooms_glyphs.h | 4 ++-- engines/titanic/pet_control/pet_section.h | 2 +- engines/titanic/pet_control/pet_starfield.cpp | 2 +- engines/titanic/pet_control/pet_starfield.h | 2 +- engines/titanic/pet_control/pet_text.cpp | 2 +- engines/titanic/pet_control/pet_text.h | 2 +- engines/titanic/sound/auto_music_player.cpp | 2 +- engines/titanic/sound/auto_music_player.h | 2 +- engines/titanic/sound/auto_music_player_base.cpp | 2 +- engines/titanic/sound/auto_music_player_base.h | 2 +- engines/titanic/sound/auto_sound_player.cpp | 2 +- engines/titanic/sound/auto_sound_player.h | 2 +- engines/titanic/sound/auto_sound_player_adsr.cpp | 2 +- engines/titanic/sound/auto_sound_player_adsr.h | 2 +- engines/titanic/sound/background_sound_maker.cpp | 2 +- engines/titanic/sound/background_sound_maker.h | 2 +- engines/titanic/sound/bird_song.cpp | 2 +- engines/titanic/sound/bird_song.h | 2 +- engines/titanic/sound/dome_from_top_of_well.cpp | 2 +- engines/titanic/sound/dome_from_top_of_well.h | 2 +- engines/titanic/sound/enter_view_toggles_other_music.cpp | 2 +- engines/titanic/sound/enter_view_toggles_other_music.h | 2 +- engines/titanic/sound/gondolier_song.cpp | 2 +- engines/titanic/sound/gondolier_song.h | 2 +- engines/titanic/sound/music_player.cpp | 2 +- engines/titanic/sound/music_player.h | 2 +- engines/titanic/sound/node_auto_sound_player.cpp | 2 +- engines/titanic/sound/node_auto_sound_player.h | 2 +- engines/titanic/sound/restricted_auto_music_player.cpp | 2 +- engines/titanic/sound/restricted_auto_music_player.h | 2 +- engines/titanic/sound/room_auto_sound_player.cpp | 2 +- engines/titanic/sound/room_auto_sound_player.h | 2 +- engines/titanic/sound/room_trigger_auto_music_player.cpp | 2 +- engines/titanic/sound/room_trigger_auto_music_player.h | 2 +- engines/titanic/sound/season_noises.cpp | 2 +- engines/titanic/sound/season_noises.h | 2 +- engines/titanic/sound/seasonal_music_player.cpp | 2 +- engines/titanic/sound/seasonal_music_player.h | 2 +- engines/titanic/sound/titania_speech.cpp | 2 +- engines/titanic/sound/titania_speech.h | 2 +- engines/titanic/sound/trigger_auto_music_player.cpp | 2 +- engines/titanic/sound/trigger_auto_music_player.h | 2 +- engines/titanic/sound/view_auto_sound_player.cpp | 2 +- engines/titanic/sound/view_auto_sound_player.h | 2 +- engines/titanic/sound/view_toggles_other_music.cpp | 2 +- engines/titanic/sound/view_toggles_other_music.h | 2 +- engines/titanic/sound/water_lapping_sounds.cpp | 2 +- engines/titanic/sound/water_lapping_sounds.h | 2 +- engines/titanic/star_control/star_control.cpp | 2 +- engines/titanic/star_control/star_control.h | 2 +- engines/titanic/star_control/star_control_sub11.cpp | 2 +- engines/titanic/star_control/star_control_sub11.h | 2 +- engines/titanic/star_control/star_control_sub12.cpp | 2 +- engines/titanic/star_control/star_control_sub12.h | 2 +- engines/titanic/star_control/star_control_sub13.cpp | 2 +- engines/titanic/star_control/star_control_sub13.h | 2 +- engines/titanic/star_control/star_control_sub14.cpp | 2 +- engines/titanic/star_control/star_control_sub14.h | 2 +- engines/titanic/star_control/star_control_sub8.h | 2 +- engines/titanic/support/movie_clip.cpp | 2 +- engines/titanic/support/movie_clip.h | 2 +- engines/titanic/support/movie_event.cpp | 2 +- engines/titanic/support/movie_event.h | 2 +- engines/titanic/support/movie_range_info.cpp | 2 +- engines/titanic/support/movie_range_info.h | 2 +- engines/titanic/support/time_event_info.cpp | 2 +- engines/titanic/support/time_event_info.h | 2 +- 790 files changed, 803 insertions(+), 803 deletions(-) diff --git a/engines/titanic/carry/arm.cpp b/engines/titanic/carry/arm.cpp index ee58aea445..880c93d309 100644 --- a/engines/titanic/carry/arm.cpp +++ b/engines/titanic/carry/arm.cpp @@ -40,7 +40,7 @@ CArm::CArm() : CCarry(), _string6("Key"), _armRect(220, 208, 409, 350) { } -void CArm::save(SimpleFile *file, int indent) const { +void CArm::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string6, indent); file->writeNumberLine(_field138, indent); diff --git a/engines/titanic/carry/arm.h b/engines/titanic/carry/arm.h index f19943de51..afef22ba49 100644 --- a/engines/titanic/carry/arm.h +++ b/engines/titanic/carry/arm.h @@ -55,7 +55,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/auditory_centre.cpp b/engines/titanic/carry/auditory_centre.cpp index e5dedcd654..d88989a801 100644 --- a/engines/titanic/carry/auditory_centre.cpp +++ b/engines/titanic/carry/auditory_centre.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CAuditoryCentre::save(SimpleFile *file, int indent) const { +void CAuditoryCentre::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CBrain::save(file, indent); } diff --git a/engines/titanic/carry/auditory_centre.h b/engines/titanic/carry/auditory_centre.h index c429fd78cd..d4b9beedc7 100644 --- a/engines/titanic/carry/auditory_centre.h +++ b/engines/titanic/carry/auditory_centre.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/bowl_ear.cpp b/engines/titanic/carry/bowl_ear.cpp index 70d2409a05..bb5172e580 100644 --- a/engines/titanic/carry/bowl_ear.cpp +++ b/engines/titanic/carry/bowl_ear.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CBowlEar::save(SimpleFile *file, int indent) const { +void CBowlEar::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CEar::save(file, indent); } diff --git a/engines/titanic/carry/bowl_ear.h b/engines/titanic/carry/bowl_ear.h index 1617ceda8d..39d5dc9ff8 100644 --- a/engines/titanic/carry/bowl_ear.h +++ b/engines/titanic/carry/bowl_ear.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/brain.cpp b/engines/titanic/carry/brain.cpp index 1fe0c1b5d8..8df0de9961 100644 --- a/engines/titanic/carry/brain.cpp +++ b/engines/titanic/carry/brain.cpp @@ -36,7 +36,7 @@ END_MESSAGE_MAP() CBrain::CBrain() : CCarry(), _field134(0), _field138(0) { } -void CBrain::save(SimpleFile *file, int indent) const { +void CBrain::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writePoint(_pos1, indent); file->writeNumberLine(_field134, indent); diff --git a/engines/titanic/carry/brain.h b/engines/titanic/carry/brain.h index 3e24f5215b..fd70a7e0c9 100644 --- a/engines/titanic/carry/brain.h +++ b/engines/titanic/carry/brain.h @@ -48,7 +48,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/bridge_piece.cpp b/engines/titanic/carry/bridge_piece.cpp index 1fe5e048ed..fc845feff0 100644 --- a/engines/titanic/carry/bridge_piece.cpp +++ b/engines/titanic/carry/bridge_piece.cpp @@ -33,7 +33,7 @@ END_MESSAGE_MAP() CBridgePiece::CBridgePiece() : CCarry(), _field140(0) { } -void CBridgePiece::save(SimpleFile *file, int indent) const { +void CBridgePiece::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string6, indent); file->writePoint(_pos3, indent); diff --git a/engines/titanic/carry/bridge_piece.h b/engines/titanic/carry/bridge_piece.h index 5041cbc049..04bc7b9181 100644 --- a/engines/titanic/carry/bridge_piece.h +++ b/engines/titanic/carry/bridge_piece.h @@ -42,7 +42,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/carry.cpp b/engines/titanic/carry/carry.cpp index ca022a6c8f..75b3b6f35b 100644 --- a/engines/titanic/carry/carry.cpp +++ b/engines/titanic/carry/carry.cpp @@ -52,7 +52,7 @@ CCarry::CCarry() : CGameObject(), _fieldDC(0), _fieldE0(1), _string4("It doesn't seem to want this.") { } -void CCarry::save(SimpleFile *file, int indent) const { +void CCarry::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string1, indent); file->writePoint(_origPos, indent); diff --git a/engines/titanic/carry/carry.h b/engines/titanic/carry/carry.h index f4476721cc..36589635f7 100644 --- a/engines/titanic/carry/carry.h +++ b/engines/titanic/carry/carry.h @@ -68,7 +68,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/carry_parrot.cpp b/engines/titanic/carry/carry_parrot.cpp index b0916bb4c4..cf96204122 100644 --- a/engines/titanic/carry/carry_parrot.cpp +++ b/engines/titanic/carry/carry_parrot.cpp @@ -47,7 +47,7 @@ CCarryParrot::CCarryParrot() : CCarry(), _string6("PerchedParrot"), _field148(25), _field14C(0), _field150(8) { } -void CCarryParrot::save(SimpleFile *file, int indent) const { +void CCarryParrot::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string6, indent); file->writeNumberLine(_timerId, indent); diff --git a/engines/titanic/carry/carry_parrot.h b/engines/titanic/carry/carry_parrot.h index 1c5cc2e890..84c656ce8e 100644 --- a/engines/titanic/carry/carry_parrot.h +++ b/engines/titanic/carry/carry_parrot.h @@ -57,7 +57,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/central_core.cpp b/engines/titanic/carry/central_core.cpp index 97309e0a86..a50c95abbc 100644 --- a/engines/titanic/carry/central_core.cpp +++ b/engines/titanic/carry/central_core.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CCentralCore::save(SimpleFile *file, int indent) const { +void CCentralCore::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CBrain::save(file, indent); } diff --git a/engines/titanic/carry/central_core.h b/engines/titanic/carry/central_core.h index b397046088..852d2b63e1 100644 --- a/engines/titanic/carry/central_core.h +++ b/engines/titanic/carry/central_core.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/chicken.cpp b/engines/titanic/carry/chicken.cpp index 60627bdb7e..65404dc65d 100644 --- a/engines/titanic/carry/chicken.cpp +++ b/engines/titanic/carry/chicken.cpp @@ -45,7 +45,7 @@ CChicken::CChicken() : CCarry(), _string6("None"), _field12C(1), _field13C(0), _timerId(0) { } -void CChicken::save(SimpleFile *file, int indent) const { +void CChicken::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_field12C, indent); file->writeQuotedLine(_string6, indent); diff --git a/engines/titanic/carry/chicken.h b/engines/titanic/carry/chicken.h index 946c102c48..e9e8f00000 100644 --- a/engines/titanic/carry/chicken.h +++ b/engines/titanic/carry/chicken.h @@ -55,7 +55,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/crushed_tv.cpp b/engines/titanic/carry/crushed_tv.cpp index 5abc8fac98..a265b611a9 100644 --- a/engines/titanic/carry/crushed_tv.cpp +++ b/engines/titanic/carry/crushed_tv.cpp @@ -34,7 +34,7 @@ END_MESSAGE_MAP() CCrushedTV::CCrushedTV() : CCarry() { } -void CCrushedTV::save(SimpleFile *file, int indent) const { +void CCrushedTV::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CCarry::save(file, indent); } diff --git a/engines/titanic/carry/crushed_tv.h b/engines/titanic/carry/crushed_tv.h index 3e7753499d..d141589ec8 100644 --- a/engines/titanic/carry/crushed_tv.h +++ b/engines/titanic/carry/crushed_tv.h @@ -41,7 +41,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/ear.cpp b/engines/titanic/carry/ear.cpp index d87b09d9b4..8d85e247f7 100644 --- a/engines/titanic/carry/ear.cpp +++ b/engines/titanic/carry/ear.cpp @@ -27,7 +27,7 @@ namespace Titanic { CEar::CEar() : CHeadPiece() { } -void CEar::save(SimpleFile *file, int indent) const { +void CEar::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CHeadPiece::save(file, indent); } diff --git a/engines/titanic/carry/ear.h b/engines/titanic/carry/ear.h index 2a20620342..bdffdc2678 100644 --- a/engines/titanic/carry/ear.h +++ b/engines/titanic/carry/ear.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/eye.cpp b/engines/titanic/carry/eye.cpp index 21fc3faa7e..5de1789e54 100644 --- a/engines/titanic/carry/eye.cpp +++ b/engines/titanic/carry/eye.cpp @@ -27,7 +27,7 @@ namespace Titanic { CEye::CEye() : CHeadPiece(), _eyeNum(0) { } -void CEye::save(SimpleFile *file, int indent) const { +void CEye::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_eyeNum, indent); CHeadPiece::save(file, indent); diff --git a/engines/titanic/carry/eye.h b/engines/titanic/carry/eye.h index f7e17fa81f..2531666037 100644 --- a/engines/titanic/carry/eye.h +++ b/engines/titanic/carry/eye.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/feathers.cpp b/engines/titanic/carry/feathers.cpp index e89f33564b..c2cf369bd8 100644 --- a/engines/titanic/carry/feathers.cpp +++ b/engines/titanic/carry/feathers.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CFeathers, CCarry) CFeathers::CFeathers() : CCarry() { } -void CFeathers::save(SimpleFile *file, int indent) const { +void CFeathers::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CCarry::save(file, indent); } diff --git a/engines/titanic/carry/feathers.h b/engines/titanic/carry/feathers.h index f90de11abd..e2c8ab77db 100644 --- a/engines/titanic/carry/feathers.h +++ b/engines/titanic/carry/feathers.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/fruit.cpp b/engines/titanic/carry/fruit.cpp index 3355d6e006..832dccf45a 100644 --- a/engines/titanic/carry/fruit.cpp +++ b/engines/titanic/carry/fruit.cpp @@ -28,7 +28,7 @@ CFruit::CFruit() : CCarry(), _field12C(0), _field130(0), _field134(0), _field138(0) { } -void CFruit::save(SimpleFile *file, int indent) const { +void CFruit::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_field12C, indent); file->writeNumberLine(_field130, indent); diff --git a/engines/titanic/carry/fruit.h b/engines/titanic/carry/fruit.h index 3d23afd389..595f27d56c 100644 --- a/engines/titanic/carry/fruit.h +++ b/engines/titanic/carry/fruit.h @@ -40,7 +40,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/glass.cpp b/engines/titanic/carry/glass.cpp index 1f0e059f54..051457af03 100644 --- a/engines/titanic/carry/glass.cpp +++ b/engines/titanic/carry/glass.cpp @@ -27,7 +27,7 @@ namespace Titanic { CGlass::CGlass() : CCarry(), _string6("None") { } -void CGlass::save(SimpleFile *file, int indent) const { +void CGlass::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string6, indent); CCarry::save(file, indent); diff --git a/engines/titanic/carry/glass.h b/engines/titanic/carry/glass.h index 55c032269a..4e540152fa 100644 --- a/engines/titanic/carry/glass.h +++ b/engines/titanic/carry/glass.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/hammer.cpp b/engines/titanic/carry/hammer.cpp index f1dc3b2aa0..d3b912184c 100644 --- a/engines/titanic/carry/hammer.cpp +++ b/engines/titanic/carry/hammer.cpp @@ -27,7 +27,7 @@ namespace Titanic { CHammer::CHammer() : CCarry() { } -void CHammer::save(SimpleFile *file, int indent) const { +void CHammer::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CCarry::save(file, indent); } diff --git a/engines/titanic/carry/hammer.h b/engines/titanic/carry/hammer.h index e3180e76a0..e35fdd1d85 100644 --- a/engines/titanic/carry/hammer.h +++ b/engines/titanic/carry/hammer.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/head_piece.cpp b/engines/titanic/carry/head_piece.cpp index 1eab585462..ae709644a0 100644 --- a/engines/titanic/carry/head_piece.cpp +++ b/engines/titanic/carry/head_piece.cpp @@ -28,7 +28,7 @@ CHeadPiece::CHeadPiece() : CCarry(), _string6("Not Working"), _field12C(0), _field13C(0) { } -void CHeadPiece::save(SimpleFile *file, int indent) const { +void CHeadPiece::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_field12C, indent); file->writeQuotedLine(_string6, indent); diff --git a/engines/titanic/carry/head_piece.h b/engines/titanic/carry/head_piece.h index daa5925530..1989b0ef2d 100644 --- a/engines/titanic/carry/head_piece.h +++ b/engines/titanic/carry/head_piece.h @@ -39,7 +39,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/hose.cpp b/engines/titanic/carry/hose.cpp index 1617feffc1..747d58c339 100644 --- a/engines/titanic/carry/hose.cpp +++ b/engines/titanic/carry/hose.cpp @@ -38,7 +38,7 @@ CHose::CHose() : CCarry(), _string6("Succ-U-Bus auxiliary hose attachment incompatible with sliding glass cover.") { } -void CHose::save(SimpleFile *file, int indent) const { +void CHose::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_statics->_v1, indent); file->writeQuotedLine(_statics->_v2, indent); diff --git a/engines/titanic/carry/hose.h b/engines/titanic/carry/hose.h index c16351b937..d45fc08bc4 100644 --- a/engines/titanic/carry/hose.h +++ b/engines/titanic/carry/hose.h @@ -46,7 +46,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/hose_end.cpp b/engines/titanic/carry/hose_end.cpp index 6f15d5be1b..f6097c4db7 100644 --- a/engines/titanic/carry/hose_end.cpp +++ b/engines/titanic/carry/hose_end.cpp @@ -30,7 +30,7 @@ CHoseEnd::CHoseEnd() : CHose() { _string6 = "Connection refused by remote hose."; } -void CHoseEnd::save(SimpleFile *file, int indent) const { +void CHoseEnd::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string6, indent); CHose::save(file, indent); diff --git a/engines/titanic/carry/hose_end.h b/engines/titanic/carry/hose_end.h index 796191e12f..8a82ec5363 100644 --- a/engines/titanic/carry/hose_end.h +++ b/engines/titanic/carry/hose_end.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/key.cpp b/engines/titanic/carry/key.cpp index 2c559bb6c9..6e947464f1 100644 --- a/engines/titanic/carry/key.cpp +++ b/engines/titanic/carry/key.cpp @@ -27,7 +27,7 @@ namespace Titanic { CKey::CKey() : CCarry() { } -void CKey::save(SimpleFile *file, int indent) const { +void CKey::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CCarry::save(file, indent); } diff --git a/engines/titanic/carry/key.h b/engines/titanic/carry/key.h index e6973b5c7c..6b7a134991 100644 --- a/engines/titanic/carry/key.h +++ b/engines/titanic/carry/key.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/liftbot_head.cpp b/engines/titanic/carry/liftbot_head.cpp index 422d88ad0f..bcab8e8574 100644 --- a/engines/titanic/carry/liftbot_head.cpp +++ b/engines/titanic/carry/liftbot_head.cpp @@ -27,7 +27,7 @@ namespace Titanic { CLiftbotHead::CLiftbotHead() : CCarry(), _field12C(0) { } -void CLiftbotHead::save(SimpleFile *file, int indent) const { +void CLiftbotHead::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_field12C, indent); CCarry::save(file, indent); diff --git a/engines/titanic/carry/liftbot_head.h b/engines/titanic/carry/liftbot_head.h index f2b60c1d7e..9dc625014b 100644 --- a/engines/titanic/carry/liftbot_head.h +++ b/engines/titanic/carry/liftbot_head.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/long_stick.cpp b/engines/titanic/carry/long_stick.cpp index d5bf73b9b0..ab1e42b81f 100644 --- a/engines/titanic/carry/long_stick.cpp +++ b/engines/titanic/carry/long_stick.cpp @@ -27,7 +27,7 @@ namespace Titanic { CLongStick::CLongStick() : CCarry() { } -void CLongStick::save(SimpleFile *file, int indent) const { +void CLongStick::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CCarry::save(file, indent); } diff --git a/engines/titanic/carry/long_stick.h b/engines/titanic/carry/long_stick.h index e2718a3d2b..60bff0d6f7 100644 --- a/engines/titanic/carry/long_stick.h +++ b/engines/titanic/carry/long_stick.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/magazine.cpp b/engines/titanic/carry/magazine.cpp index 68d898c399..cdf92fc707 100644 --- a/engines/titanic/carry/magazine.cpp +++ b/engines/titanic/carry/magazine.cpp @@ -35,7 +35,7 @@ END_MESSAGE_MAP() CMagazine::CMagazine() : CCarry() { } -void CMagazine::save(SimpleFile *file, int indent) const { +void CMagazine::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_field12C, indent); file->writeNumberLine(_field130, indent); diff --git a/engines/titanic/carry/magazine.h b/engines/titanic/carry/magazine.h index 16ef4bb2b0..afe9598d3b 100644 --- a/engines/titanic/carry/magazine.h +++ b/engines/titanic/carry/magazine.h @@ -45,7 +45,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/maitred_left_arm.cpp b/engines/titanic/carry/maitred_left_arm.cpp index 6fb93ecc63..b31c2a6f6d 100644 --- a/engines/titanic/carry/maitred_left_arm.cpp +++ b/engines/titanic/carry/maitred_left_arm.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CMaitreDLeftArm::save(SimpleFile *file, int indent) const { +void CMaitreDLeftArm::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_field174, indent); CArm::save(file, indent); diff --git a/engines/titanic/carry/maitred_left_arm.h b/engines/titanic/carry/maitred_left_arm.h index e46485cdac..e59d84e2b7 100644 --- a/engines/titanic/carry/maitred_left_arm.h +++ b/engines/titanic/carry/maitred_left_arm.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/maitred_right_arm.cpp b/engines/titanic/carry/maitred_right_arm.cpp index 15767a2fc2..7030e83c9d 100644 --- a/engines/titanic/carry/maitred_right_arm.cpp +++ b/engines/titanic/carry/maitred_right_arm.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CMaitreDRightArm::save(SimpleFile *file, int indent) const { +void CMaitreDRightArm::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CArm::save(file, indent); } diff --git a/engines/titanic/carry/maitred_right_arm.h b/engines/titanic/carry/maitred_right_arm.h index c89b7e82a3..f8a7861640 100644 --- a/engines/titanic/carry/maitred_right_arm.h +++ b/engines/titanic/carry/maitred_right_arm.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/mouth.cpp b/engines/titanic/carry/mouth.cpp index 058ffc42d7..8c3791fa9c 100644 --- a/engines/titanic/carry/mouth.cpp +++ b/engines/titanic/carry/mouth.cpp @@ -27,7 +27,7 @@ namespace Titanic { CMouth::CMouth() : CHeadPiece() { } -void CMouth::save(SimpleFile *file, int indent) const { +void CMouth::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CHeadPiece::save(file, indent); } diff --git a/engines/titanic/carry/mouth.h b/engines/titanic/carry/mouth.h index 1c446b2296..0efaf73bbb 100644 --- a/engines/titanic/carry/mouth.h +++ b/engines/titanic/carry/mouth.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/napkin.cpp b/engines/titanic/carry/napkin.cpp index cba2b4a560..ace5a389a0 100644 --- a/engines/titanic/carry/napkin.cpp +++ b/engines/titanic/carry/napkin.cpp @@ -32,7 +32,7 @@ END_MESSAGE_MAP() CNapkin::CNapkin() : CCarry() { } -void CNapkin::save(SimpleFile *file, int indent) const { +void CNapkin::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CCarry::save(file, indent); } diff --git a/engines/titanic/carry/napkin.h b/engines/titanic/carry/napkin.h index ac14b70efa..b94a61837d 100644 --- a/engines/titanic/carry/napkin.h +++ b/engines/titanic/carry/napkin.h @@ -38,7 +38,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/nose.cpp b/engines/titanic/carry/nose.cpp index cd5085db44..4f3afe24ac 100644 --- a/engines/titanic/carry/nose.cpp +++ b/engines/titanic/carry/nose.cpp @@ -27,7 +27,7 @@ namespace Titanic { CNose::CNose() : CHeadPiece() { } -void CNose::save(SimpleFile *file, int indent) const { +void CNose::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CHeadPiece::save(file, indent); } diff --git a/engines/titanic/carry/nose.h b/engines/titanic/carry/nose.h index 717b639e82..337617c1c7 100644 --- a/engines/titanic/carry/nose.h +++ b/engines/titanic/carry/nose.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/note.cpp b/engines/titanic/carry/note.cpp index 78286d71bd..388f87e638 100644 --- a/engines/titanic/carry/note.cpp +++ b/engines/titanic/carry/note.cpp @@ -31,7 +31,7 @@ END_MESSAGE_MAP() CNote::CNote() : CCarry(), _field138(1) { } -void CNote::save(SimpleFile *file, int indent) const { +void CNote::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string6, indent); file->writeNumberLine(_field138, indent); diff --git a/engines/titanic/carry/note.h b/engines/titanic/carry/note.h index 22a95b0bd3..f0563f57da 100644 --- a/engines/titanic/carry/note.h +++ b/engines/titanic/carry/note.h @@ -41,7 +41,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/parcel.cpp b/engines/titanic/carry/parcel.cpp index d532bac92b..13e2f6dec4 100644 --- a/engines/titanic/carry/parcel.cpp +++ b/engines/titanic/carry/parcel.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CParcel, CCarry) CParcel::CParcel() : CCarry() { } -void CParcel::save(SimpleFile *file, int indent) const { +void CParcel::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CCarry::save(file, indent); } diff --git a/engines/titanic/carry/parcel.h b/engines/titanic/carry/parcel.h index cb36bed23d..7209bd31cd 100644 --- a/engines/titanic/carry/parcel.h +++ b/engines/titanic/carry/parcel.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/perch.cpp b/engines/titanic/carry/perch.cpp index 976921beb0..281b3fce53 100644 --- a/engines/titanic/carry/perch.cpp +++ b/engines/titanic/carry/perch.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CPerch::save(SimpleFile *file, int indent) const { +void CPerch::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CCentralCore::save(file, indent); } diff --git a/engines/titanic/carry/perch.h b/engines/titanic/carry/perch.h index 1ed2ccaa9f..ef04d1130f 100644 --- a/engines/titanic/carry/perch.h +++ b/engines/titanic/carry/perch.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/phonograph_cylinder.cpp b/engines/titanic/carry/phonograph_cylinder.cpp index d7b9fe6c96..0684c56611 100644 --- a/engines/titanic/carry/phonograph_cylinder.cpp +++ b/engines/titanic/carry/phonograph_cylinder.cpp @@ -46,7 +46,7 @@ CPhonographCylinder::CPhonographCylinder() : CCarry(), _bassInversionControl(false) { } -void CPhonographCylinder::save(SimpleFile *file, int indent) const { +void CPhonographCylinder::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_itemName, indent); file->writeNumberLine(_bellsMuteControl, indent); diff --git a/engines/titanic/carry/phonograph_cylinder.h b/engines/titanic/carry/phonograph_cylinder.h index 8c4ca6489e..2f950d175c 100644 --- a/engines/titanic/carry/phonograph_cylinder.h +++ b/engines/titanic/carry/phonograph_cylinder.h @@ -63,7 +63,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/phonograph_ear.cpp b/engines/titanic/carry/phonograph_ear.cpp index 0b4142ca37..ceb71babd2 100644 --- a/engines/titanic/carry/phonograph_ear.cpp +++ b/engines/titanic/carry/phonograph_ear.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CPhonographEar::save(SimpleFile *file, int indent) const { +void CPhonographEar::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_field140, indent); CEar::save(file, indent); diff --git a/engines/titanic/carry/phonograph_ear.h b/engines/titanic/carry/phonograph_ear.h index 71ef38f926..d450f2868e 100644 --- a/engines/titanic/carry/phonograph_ear.h +++ b/engines/titanic/carry/phonograph_ear.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/photograph.cpp b/engines/titanic/carry/photograph.cpp index 7f76f394bd..7f32a0623d 100644 --- a/engines/titanic/carry/photograph.cpp +++ b/engines/titanic/carry/photograph.cpp @@ -37,7 +37,7 @@ int CPhotograph::_v1; CPhotograph::CPhotograph() : CCarry(), _field12C(0), _field130(0) { } -void CPhotograph::save(SimpleFile *file, int indent) const { +void CPhotograph::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_field12C, indent); file->writeNumberLine(_v1, indent); diff --git a/engines/titanic/carry/photograph.h b/engines/titanic/carry/photograph.h index b7ce488d09..3161e4861e 100644 --- a/engines/titanic/carry/photograph.h +++ b/engines/titanic/carry/photograph.h @@ -48,7 +48,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/plug_in.cpp b/engines/titanic/carry/plug_in.cpp index e4fe54dd27..c82a4cc422 100644 --- a/engines/titanic/carry/plug_in.cpp +++ b/engines/titanic/carry/plug_in.cpp @@ -31,7 +31,7 @@ END_MESSAGE_MAP() CPlugIn::CPlugIn() : CCarry(), _field12C(0) { } -void CPlugIn::save(SimpleFile *file, int indent) const { +void CPlugIn::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CCarry::save(file, indent); } diff --git a/engines/titanic/carry/plug_in.h b/engines/titanic/carry/plug_in.h index f48a74bd2b..e788d15869 100644 --- a/engines/titanic/carry/plug_in.h +++ b/engines/titanic/carry/plug_in.h @@ -39,7 +39,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/speech_centre.cpp b/engines/titanic/carry/speech_centre.cpp index 86ed730284..b8076aee76 100644 --- a/engines/titanic/carry/speech_centre.cpp +++ b/engines/titanic/carry/speech_centre.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CSpeechCentre::save(SimpleFile *file, int indent) const { +void CSpeechCentre::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_field13C, indent); file->writeQuotedLine(_string1, indent); diff --git a/engines/titanic/carry/speech_centre.h b/engines/titanic/carry/speech_centre.h index 8f6fdfdcd0..e16556e60f 100644 --- a/engines/titanic/carry/speech_centre.h +++ b/engines/titanic/carry/speech_centre.h @@ -40,7 +40,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/sweets.cpp b/engines/titanic/carry/sweets.cpp index 71295a3441..f19a8287b7 100644 --- a/engines/titanic/carry/sweets.cpp +++ b/engines/titanic/carry/sweets.cpp @@ -31,7 +31,7 @@ END_MESSAGE_MAP() CSweets::CSweets() : CCarry() { } -void CSweets::save(SimpleFile *file, int indent) const { +void CSweets::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CCarry::save(file, indent); } diff --git a/engines/titanic/carry/sweets.h b/engines/titanic/carry/sweets.h index 7fc0787f76..8eb0a1623a 100644 --- a/engines/titanic/carry/sweets.h +++ b/engines/titanic/carry/sweets.h @@ -38,7 +38,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/test_carry.cpp b/engines/titanic/carry/test_carry.cpp index 26b4f566e9..0e86c51d0a 100644 --- a/engines/titanic/carry/test_carry.cpp +++ b/engines/titanic/carry/test_carry.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CTestArray::save(SimpleFile *file, int indent) const { +void CTestArray::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value1, indent); file->writeNumberLine(_value2, indent); diff --git a/engines/titanic/carry/test_carry.h b/engines/titanic/carry/test_carry.h index 56526b424e..b9591a7842 100644 --- a/engines/titanic/carry/test_carry.h +++ b/engines/titanic/carry/test_carry.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/carry/vision_centre.cpp b/engines/titanic/carry/vision_centre.cpp index b85f99fbf1..8c8bab15f8 100644 --- a/engines/titanic/carry/vision_centre.cpp +++ b/engines/titanic/carry/vision_centre.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CVisionCentre::save(SimpleFile *file, int indent) const { +void CVisionCentre::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CBrain::save(file, indent); } diff --git a/engines/titanic/carry/vision_centre.h b/engines/titanic/carry/vision_centre.h index ce1d9599a2..6cf2d9d49e 100644 --- a/engines/titanic/carry/vision_centre.h +++ b/engines/titanic/carry/vision_centre.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/core/background.cpp b/engines/titanic/core/background.cpp index 52ff4c4ac2..f180df8867 100644 --- a/engines/titanic/core/background.cpp +++ b/engines/titanic/core/background.cpp @@ -33,7 +33,7 @@ END_MESSAGE_MAP() CBackground::CBackground() : CGameObject(), _fieldBC(0), _fieldC0(0), _fieldDC(0) { } -void CBackground::save(SimpleFile *file, int indent) const { +void CBackground::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); file->writeNumberLine(_fieldC0, indent); diff --git a/engines/titanic/core/background.h b/engines/titanic/core/background.h index f4969d4454..ef9a6c3e7b 100644 --- a/engines/titanic/core/background.h +++ b/engines/titanic/core/background.h @@ -46,7 +46,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/core/click_responder.cpp b/engines/titanic/core/click_responder.cpp index 9e8564b6d5..f9694557df 100644 --- a/engines/titanic/core/click_responder.cpp +++ b/engines/titanic/core/click_responder.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CClickResponder::save(SimpleFile *file, int indent) const { +void CClickResponder::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string1, indent); file->writeQuotedLine(_string2, indent); diff --git a/engines/titanic/core/click_responder.h b/engines/titanic/core/click_responder.h index 68d3e34cdd..c682530f76 100644 --- a/engines/titanic/core/click_responder.h +++ b/engines/titanic/core/click_responder.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/core/dont_save_file_item.cpp b/engines/titanic/core/dont_save_file_item.cpp index 00b7dd22ce..87ab77e78b 100644 --- a/engines/titanic/core/dont_save_file_item.cpp +++ b/engines/titanic/core/dont_save_file_item.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CDontSaveFileItem, CFileItem) -void CDontSaveFileItem::save(SimpleFile *file, int indent) const { +void CDontSaveFileItem::save(SimpleFile *file, int indent) { file->writeNumberLine(0, indent); } diff --git a/engines/titanic/core/dont_save_file_item.h b/engines/titanic/core/dont_save_file_item.h index 7517976825..242e37372a 100644 --- a/engines/titanic/core/dont_save_file_item.h +++ b/engines/titanic/core/dont_save_file_item.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/core/drop_target.cpp b/engines/titanic/core/drop_target.cpp index 9782967105..05ea6445c3 100644 --- a/engines/titanic/core/drop_target.cpp +++ b/engines/titanic/core/drop_target.cpp @@ -29,7 +29,7 @@ CDropTarget::CDropTarget() : CGameObject(), _fieldC4(0), _fieldFC(0), _field10C(1), _field110(8), _field114(20) { } -void CDropTarget::save(SimpleFile *file, int indent) const { +void CDropTarget::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writePoint(_pos1, indent); file->writeNumberLine(_fieldC4, indent); diff --git a/engines/titanic/core/drop_target.h b/engines/titanic/core/drop_target.h index 6c1cdcfe38..99734d71f4 100644 --- a/engines/titanic/core/drop_target.h +++ b/engines/titanic/core/drop_target.h @@ -50,7 +50,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/core/file_item.cpp b/engines/titanic/core/file_item.cpp index 566f9104a9..824195d97c 100644 --- a/engines/titanic/core/file_item.cpp +++ b/engines/titanic/core/file_item.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CFileItem, CTreeItem) -void CFileItem::save(SimpleFile *file, int indent) const { +void CFileItem::save(SimpleFile *file, int indent) { file->writeNumberLine(0, indent); CTreeItem::save(file, indent); } diff --git a/engines/titanic/core/file_item.h b/engines/titanic/core/file_item.h index e8e4935de0..4210251af0 100644 --- a/engines/titanic/core/file_item.h +++ b/engines/titanic/core/file_item.h @@ -39,7 +39,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index af866ddac4..29ad735a66 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -80,7 +80,7 @@ CGameObject::~CGameObject() { delete _text; } -void CGameObject::save(SimpleFile *file, int indent) const { +void CGameObject::save(SimpleFile *file, int indent) { file->writeNumberLine(7, indent); error("TODO: CGameObject::save"); diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 98d6d6099e..1afe834876 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -523,7 +523,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/core/game_object_desc_item.cpp b/engines/titanic/core/game_object_desc_item.cpp index 77174e5d06..409334c9d7 100644 --- a/engines/titanic/core/game_object_desc_item.cpp +++ b/engines/titanic/core/game_object_desc_item.cpp @@ -27,7 +27,7 @@ namespace Titanic { CGameObjectDescItem::CGameObjectDescItem(): CTreeItem() { } -void CGameObjectDescItem::save(SimpleFile *file, int indent) const { +void CGameObjectDescItem::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); _clipList.save(file, indent); file->writeQuotedLine(_string1, indent); diff --git a/engines/titanic/core/game_object_desc_item.h b/engines/titanic/core/game_object_desc_item.h index 5bfc483b44..df9ef7bdd1 100644 --- a/engines/titanic/core/game_object_desc_item.h +++ b/engines/titanic/core/game_object_desc_item.h @@ -43,7 +43,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/core/link_item.cpp b/engines/titanic/core/link_item.cpp index a0460bd2c6..a56122fa43 100644 --- a/engines/titanic/core/link_item.cpp +++ b/engines/titanic/core/link_item.cpp @@ -43,7 +43,7 @@ CString CLinkItem::formName() { return ""; } -void CLinkItem::save(SimpleFile *file, int indent) const { +void CLinkItem::save(SimpleFile *file, int indent) { file->writeNumberLine(2, indent); file->writeQuotedLine("L", indent); file->writeNumberLine(_cursorId, indent + 1); diff --git a/engines/titanic/core/link_item.h b/engines/titanic/core/link_item.h index 328d5bcc06..09f3a7ab48 100644 --- a/engines/titanic/core/link_item.h +++ b/engines/titanic/core/link_item.h @@ -56,7 +56,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/core/list.cpp b/engines/titanic/core/list.cpp index d733ce25c5..8e90e9ff40 100644 --- a/engines/titanic/core/list.cpp +++ b/engines/titanic/core/list.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void ListItem::save(SimpleFile *file, int indent) const { +void ListItem::save(SimpleFile *file, int indent) { file->writeNumberLine(0, indent); } diff --git a/engines/titanic/core/list.h b/engines/titanic/core/list.h index 4052a018c7..eb87d7fe1c 100644 --- a/engines/titanic/core/list.h +++ b/engines/titanic/core/list.h @@ -40,7 +40,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file @@ -76,7 +76,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const { + virtual void save(SimpleFile *file, int indent) { file->writeNumberLine(0, indent); // Write out number of items @@ -84,9 +84,9 @@ public: file->writeNumberLine(Common::List::size(), indent); // Iterate through writing entries - typename Common::List::const_iterator i; + typename Common::List::iterator i; for (i = Common::List::begin(); i != Common::List::end(); ++i) { - const ListItem *item = *i; + ListItem *item = *i; item->saveHeader(file, indent); item->save(file, indent + 1); item->saveFooter(file, indent); diff --git a/engines/titanic/core/mail_man.cpp b/engines/titanic/core/mail_man.cpp index 8226ebfc80..afe13bebad 100644 --- a/engines/titanic/core/mail_man.cpp +++ b/engines/titanic/core/mail_man.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CMailMan::save(SimpleFile *file, int indent) const { +void CMailMan::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/core/mail_man.h b/engines/titanic/core/mail_man.h index 982aae4cc0..27a6cd11c0 100644 --- a/engines/titanic/core/mail_man.h +++ b/engines/titanic/core/mail_man.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/core/message_target.cpp b/engines/titanic/core/message_target.cpp index b99fa5c606..4815d03973 100644 --- a/engines/titanic/core/message_target.cpp +++ b/engines/titanic/core/message_target.cpp @@ -37,7 +37,7 @@ const MSGMAP *CMessageTarget::getThisMessageMap() { return &messageMap; } -void CMessageTarget::save(SimpleFile *file, int indent) const { +void CMessageTarget::save(SimpleFile *file, int indent) { file->writeNumberLine(0, indent); CSaveableObject::save(file, indent); } diff --git a/engines/titanic/core/message_target.h b/engines/titanic/core/message_target.h index 42e9e5a3c4..5508c47c95 100644 --- a/engines/titanic/core/message_target.h +++ b/engines/titanic/core/message_target.h @@ -90,7 +90,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/core/multi_drop_target.cpp b/engines/titanic/core/multi_drop_target.cpp index 1f6e6cf210..f2998199b1 100644 --- a/engines/titanic/core/multi_drop_target.cpp +++ b/engines/titanic/core/multi_drop_target.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CMultiDropTarget::save(SimpleFile *file, int indent) const { +void CMultiDropTarget::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string5, indent); file->writeQuotedLine(_string6, indent); diff --git a/engines/titanic/core/multi_drop_target.h b/engines/titanic/core/multi_drop_target.h index ddf20e441e..22cc0941a3 100644 --- a/engines/titanic/core/multi_drop_target.h +++ b/engines/titanic/core/multi_drop_target.h @@ -38,7 +38,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/core/named_item.cpp b/engines/titanic/core/named_item.cpp index 981627a280..2b741f7657 100644 --- a/engines/titanic/core/named_item.cpp +++ b/engines/titanic/core/named_item.cpp @@ -36,7 +36,7 @@ CString CNamedItem::dumpItem(int indent) const { return result; } -void CNamedItem::save(SimpleFile *file, int indent) const { +void CNamedItem::save(SimpleFile *file, int indent) { file->writeNumberLine(0, indent); file->writeQuotedLine(_name, indent); diff --git a/engines/titanic/core/named_item.h b/engines/titanic/core/named_item.h index 9763e1b332..889a847e9d 100644 --- a/engines/titanic/core/named_item.h +++ b/engines/titanic/core/named_item.h @@ -46,7 +46,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/core/node_item.cpp b/engines/titanic/core/node_item.cpp index 57acbdb3b8..79188dd385 100644 --- a/engines/titanic/core/node_item.cpp +++ b/engines/titanic/core/node_item.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CNodeItem, CNamedItem) CNodeItem::CNodeItem() : CNamedItem(), _nodeNumber(0) { } -void CNodeItem::save(SimpleFile *file, int indent) const { +void CNodeItem::save(SimpleFile *file, int indent) { file->writeNumberLine(0, indent); file->writeQuotedLine("N", indent); file->writeNumberLine(_nodePos.x, indent + 1); diff --git a/engines/titanic/core/node_item.h b/engines/titanic/core/node_item.h index 85003bf97c..ff57448c7f 100644 --- a/engines/titanic/core/node_item.h +++ b/engines/titanic/core/node_item.h @@ -39,7 +39,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp index 586301b9f4..a768d0e955 100644 --- a/engines/titanic/core/project_item.cpp +++ b/engines/titanic/core/project_item.cpp @@ -43,7 +43,7 @@ static const char *const SAVEGAME_STR = "TNIC"; EMPTY_MESSAGE_MAP(CProjectItem, CFileItem) -void CFileListItem::save(SimpleFile *file, int indent) const { +void CFileListItem::save(SimpleFile *file, int indent) { file->writeNumberLine(0, indent); file->writeQuotedLine(_name, indent); @@ -63,7 +63,7 @@ CProjectItem::CProjectItem() : _nextRoomNumber(0), _nextMessageNumber(0), _nextObjectNumber(0), _gameManager(nullptr) { } -void CProjectItem::save(SimpleFile *file, int indent) const { +void CProjectItem::save(SimpleFile *file, int indent) { file->writeNumberLine(6, indent); file->writeQuotedLine("Next Avail. Object Number", indent); file->writeNumberLine(_nextObjectNumber, indent); diff --git a/engines/titanic/core/project_item.h b/engines/titanic/core/project_item.h index d0b8d77598..9270bdf6d1 100644 --- a/engines/titanic/core/project_item.h +++ b/engines/titanic/core/project_item.h @@ -61,7 +61,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file @@ -156,7 +156,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/core/resource_key.cpp b/engines/titanic/core/resource_key.cpp index a6a06153de..3b390af2d4 100644 --- a/engines/titanic/core/resource_key.cpp +++ b/engines/titanic/core/resource_key.cpp @@ -27,7 +27,7 @@ namespace Titanic { -void CResourceKey::save(SimpleFile *file, int indent) const { +void CResourceKey::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine("Resource Key...", indent); file->writeQuotedLine(_key, indent); diff --git a/engines/titanic/core/resource_key.h b/engines/titanic/core/resource_key.h index 8a6f86f193..eb08334de7 100644 --- a/engines/titanic/core/resource_key.h +++ b/engines/titanic/core/resource_key.h @@ -42,7 +42,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/core/room_item.cpp b/engines/titanic/core/room_item.cpp index b3a3fe41cc..78bd678138 100644 --- a/engines/titanic/core/room_item.cpp +++ b/engines/titanic/core/room_item.cpp @@ -30,7 +30,7 @@ CRoomItem::CRoomItem() : CNamedItem(), _roomNumber(0), _roomDimensionX(0.0), _roomDimensionY(0.0) { } -void CRoomItem::save(SimpleFile *file, int indent) const { +void CRoomItem::save(SimpleFile *file, int indent) { file->writeNumberLine(3, indent); file->writeQuotedLine("Exit Movies", indent); _exitMovieKey.save(file, indent); diff --git a/engines/titanic/core/room_item.h b/engines/titanic/core/room_item.h index eb7f4c43bf..bcdc95ebe0 100644 --- a/engines/titanic/core/room_item.h +++ b/engines/titanic/core/room_item.h @@ -52,7 +52,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index ad98ac4dfd..d3c64a13ec 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -1614,7 +1614,7 @@ CSaveableObject *CSaveableObject::createInstance(const Common::String &name) { return (*_classList)[name](); } -void CSaveableObject::save(SimpleFile *file, int indent) const { +void CSaveableObject::save(SimpleFile *file, int indent) { file->writeNumberLine(0, indent); } @@ -1622,11 +1622,11 @@ void CSaveableObject::load(SimpleFile *file) { file->readNumber(); } -void CSaveableObject::saveHeader(SimpleFile *file, int indent) const { +void CSaveableObject::saveHeader(SimpleFile *file, int indent) { file->writeClassStart(getType()->_className, indent); } -void CSaveableObject::saveFooter(SimpleFile *file, int indent) const { +void CSaveableObject::saveFooter(SimpleFile *file, int indent) { file->writeClassEnd(indent); } diff --git a/engines/titanic/core/saveable_object.h b/engines/titanic/core/saveable_object.h index e067df2b99..6d80ad121d 100644 --- a/engines/titanic/core/saveable_object.h +++ b/engines/titanic/core/saveable_object.h @@ -85,7 +85,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file @@ -96,13 +96,13 @@ public: * Write out a header definition for the class to file * prior to saving the actual data for the class */ - virtual void saveHeader(SimpleFile *file, int indent) const; + virtual void saveHeader(SimpleFile *file, int indent); /** * Writes out a footer for the class after it's data has * been written to file */ - virtual void saveFooter(SimpleFile *file, int indent) const; + virtual void saveFooter(SimpleFile *file, int indent); }; } // End of namespace Titanic diff --git a/engines/titanic/core/static_image.cpp b/engines/titanic/core/static_image.cpp index cc8e1ddc1a..67286108d8 100644 --- a/engines/titanic/core/static_image.cpp +++ b/engines/titanic/core/static_image.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CStaticImage, CGameObject) -void CStaticImage::save(SimpleFile *file, int indent) const { +void CStaticImage::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/core/static_image.h b/engines/titanic/core/static_image.h index 953cf4d6bf..27f861ef55 100644 --- a/engines/titanic/core/static_image.h +++ b/engines/titanic/core/static_image.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index 21496ee8a5..de3d87e0d3 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -65,7 +65,7 @@ CString CTreeItem::dumpItem(int indent) const { return result; } -void CTreeItem::save(SimpleFile *file, int indent) const { +void CTreeItem::save(SimpleFile *file, int indent) { file->writeNumberLine(0, indent); CMessageTarget::save(file, indent); } diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index 77d7aa59b5..a15a5ae52f 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -62,7 +62,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/core/turn_on_object.cpp b/engines/titanic/core/turn_on_object.cpp index a24843b3bb..221602bb7b 100644 --- a/engines/titanic/core/turn_on_object.cpp +++ b/engines/titanic/core/turn_on_object.cpp @@ -32,7 +32,7 @@ END_MESSAGE_MAP() CTurnOnObject::CTurnOnObject() : CBackground(), _msgName("NULL") { } -void CTurnOnObject::save(SimpleFile *file, int indent) const { +void CTurnOnObject::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_msgName, indent); diff --git a/engines/titanic/core/turn_on_object.h b/engines/titanic/core/turn_on_object.h index 3ac5a897f1..7150069909 100644 --- a/engines/titanic/core/turn_on_object.h +++ b/engines/titanic/core/turn_on_object.h @@ -40,7 +40,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/core/turn_on_play_sound.cpp b/engines/titanic/core/turn_on_play_sound.cpp index d56aef8bb7..2f9dba24a6 100644 --- a/engines/titanic/core/turn_on_play_sound.cpp +++ b/engines/titanic/core/turn_on_play_sound.cpp @@ -28,7 +28,7 @@ CTurnOnPlaySound::CTurnOnPlaySound() : CTurnOnObject(), _string3("NULL"), _fieldF8(80), _fieldFC(0) { } -void CTurnOnPlaySound::save(SimpleFile *file, int indent) const { +void CTurnOnPlaySound::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string3, indent); file->writeNumberLine(_fieldF8, indent); diff --git a/engines/titanic/core/turn_on_play_sound.h b/engines/titanic/core/turn_on_play_sound.h index 263709b844..58d33ab78b 100644 --- a/engines/titanic/core/turn_on_play_sound.h +++ b/engines/titanic/core/turn_on_play_sound.h @@ -39,7 +39,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/core/turn_on_turn_off.cpp b/engines/titanic/core/turn_on_turn_off.cpp index a6a65e30f2..d43ddf7038 100644 --- a/engines/titanic/core/turn_on_turn_off.cpp +++ b/engines/titanic/core/turn_on_turn_off.cpp @@ -28,7 +28,7 @@ CTurnOnTurnOff::CTurnOnTurnOff() : CBackground(), _fieldE0(0), _fieldE4(0), _fieldE8(0), _fieldEC(0), _fieldF0(0) { } -void CTurnOnTurnOff::save(SimpleFile *file, int indent) const { +void CTurnOnTurnOff::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); file->writeNumberLine(_fieldE4, indent); diff --git a/engines/titanic/core/turn_on_turn_off.h b/engines/titanic/core/turn_on_turn_off.h index 5683a0db0e..2df8830b0f 100644 --- a/engines/titanic/core/turn_on_turn_off.h +++ b/engines/titanic/core/turn_on_turn_off.h @@ -41,7 +41,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/core/view_item.cpp b/engines/titanic/core/view_item.cpp index 8faf100238..56069a9799 100644 --- a/engines/titanic/core/view_item.cpp +++ b/engines/titanic/core/view_item.cpp @@ -53,7 +53,7 @@ void CViewItem::setData(double v) { _field54 = sin(_field28) * -30.0; } -void CViewItem::save(SimpleFile *file, int indent) const { +void CViewItem::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); _resourceKey.save(file, indent); file->writeQuotedLine("V", indent); diff --git a/engines/titanic/core/view_item.h b/engines/titanic/core/view_item.h index d85117a0ec..4e25c007d9 100644 --- a/engines/titanic/core/view_item.h +++ b/engines/titanic/core/view_item.h @@ -65,7 +65,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/announce.cpp b/engines/titanic/game/announce.cpp index 098ae70aa7..df6689d262 100644 --- a/engines/titanic/game/announce.cpp +++ b/engines/titanic/game/announce.cpp @@ -27,7 +27,7 @@ namespace Titanic { CAnnounce::CAnnounce() : _fieldBC(0), _fieldC0(0), _fieldC4(1), _fieldC8(0) { } -void CAnnounce::save(SimpleFile *file, int indent) const { +void CAnnounce::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); file->writeNumberLine(_fieldC0, indent); diff --git a/engines/titanic/game/announce.h b/engines/titanic/game/announce.h index 18702c3baf..3845d96deb 100644 --- a/engines/titanic/game/announce.h +++ b/engines/titanic/game/announce.h @@ -40,7 +40,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/annoy_barbot.cpp b/engines/titanic/game/annoy_barbot.cpp index caea823105..d69d9fff3c 100644 --- a/engines/titanic/game/annoy_barbot.cpp +++ b/engines/titanic/game/annoy_barbot.cpp @@ -26,7 +26,7 @@ namespace Titanic { int CAnnoyBarbot::_v1; -void CAnnoyBarbot::save(SimpleFile *file, int indent) const { +void CAnnoyBarbot::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_v1, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/game/annoy_barbot.h b/engines/titanic/game/annoy_barbot.h index c15b41dc85..e29c0c4ca0 100644 --- a/engines/titanic/game/annoy_barbot.h +++ b/engines/titanic/game/annoy_barbot.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/arb_background.cpp b/engines/titanic/game/arb_background.cpp index 07558157f0..b86ecb1d85 100644 --- a/engines/titanic/game/arb_background.cpp +++ b/engines/titanic/game/arb_background.cpp @@ -30,7 +30,7 @@ CArbBackground::CArbBackground() : CBackground(), _fieldE0(0), _fieldE4(61), _fieldE8(62), _fieldEC(118) { } -void CArbBackground::save(SimpleFile *file, int indent) const { +void CArbBackground::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); file->writeNumberLine(_fieldE4, indent); diff --git a/engines/titanic/game/arb_background.h b/engines/titanic/game/arb_background.h index a5850afc0f..42276678e7 100644 --- a/engines/titanic/game/arb_background.h +++ b/engines/titanic/game/arb_background.h @@ -41,7 +41,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/arboretum_gate.cpp b/engines/titanic/game/arboretum_gate.cpp index f3e3301136..9caa87c48d 100644 --- a/engines/titanic/game/arboretum_gate.cpp +++ b/engines/titanic/game/arboretum_gate.cpp @@ -69,7 +69,7 @@ CArboretumGate::CArboretumGate() : CBackground() { _field150 = 424; } -void CArboretumGate::save(SimpleFile *file, int indent) const { +void CArboretumGate::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); file->writeNumberLine(_v1, indent); diff --git a/engines/titanic/game/arboretum_gate.h b/engines/titanic/game/arboretum_gate.h index 736f67bd7b..bd41dd13f0 100644 --- a/engines/titanic/game/arboretum_gate.h +++ b/engines/titanic/game/arboretum_gate.h @@ -80,7 +80,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/auto_animate.cpp b/engines/titanic/game/auto_animate.cpp index 8bd332a550..172b8c44df 100644 --- a/engines/titanic/game/auto_animate.cpp +++ b/engines/titanic/game/auto_animate.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CAutoAnimate::save(SimpleFile *file, int indent) const { +void CAutoAnimate::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); file->writeNumberLine(_fieldE4, indent); diff --git a/engines/titanic/game/auto_animate.h b/engines/titanic/game/auto_animate.h index 7130d6a5cf..fe704004bb 100644 --- a/engines/titanic/game/auto_animate.h +++ b/engines/titanic/game/auto_animate.h @@ -41,7 +41,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/bar_bell.cpp b/engines/titanic/game/bar_bell.cpp index adb563cfde..b33ee1c26c 100644 --- a/engines/titanic/game/bar_bell.cpp +++ b/engines/titanic/game/bar_bell.cpp @@ -28,7 +28,7 @@ CBarBell::CBarBell() : CGameObject(), _fieldBC(0), _fieldC0(65), _fieldC4(0), _fieldC8(0), _fieldCC(0) { } -void CBarBell::save(SimpleFile *file, int indent) const { +void CBarBell::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); file->writeNumberLine(_fieldC0, indent); diff --git a/engines/titanic/game/bar_bell.h b/engines/titanic/game/bar_bell.h index b17d8089bc..9010012887 100644 --- a/engines/titanic/game/bar_bell.h +++ b/engines/titanic/game/bar_bell.h @@ -43,7 +43,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/bar_menu.cpp b/engines/titanic/game/bar_menu.cpp index 25da001660..b24c429c9b 100644 --- a/engines/titanic/game/bar_menu.cpp +++ b/engines/titanic/game/bar_menu.cpp @@ -27,7 +27,7 @@ namespace Titanic { CBarMenu::CBarMenu() : CGameObject(), _fieldBC(0), _fieldC0(0), _fieldC4(6) { } -void CBarMenu::save(SimpleFile *file, int indent) const { +void CBarMenu::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); file->writeNumberLine(_fieldC0, indent); diff --git a/engines/titanic/game/bar_menu.h b/engines/titanic/game/bar_menu.h index ac253fc747..db3c93799b 100644 --- a/engines/titanic/game/bar_menu.h +++ b/engines/titanic/game/bar_menu.h @@ -39,7 +39,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/bar_menu_button.cpp b/engines/titanic/game/bar_menu_button.cpp index 897c7a8e1e..f57d72c64a 100644 --- a/engines/titanic/game/bar_menu_button.cpp +++ b/engines/titanic/game/bar_menu_button.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CBarMenuButton::save(SimpleFile *file, int indent) const { +void CBarMenuButton::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/game/bar_menu_button.h b/engines/titanic/game/bar_menu_button.h index 1a9d42c5d2..fe7d7d913f 100644 --- a/engines/titanic/game/bar_menu_button.h +++ b/engines/titanic/game/bar_menu_button.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/belbot_get_light.cpp b/engines/titanic/game/belbot_get_light.cpp index 4bbafcd31c..3e678a8a0c 100644 --- a/engines/titanic/game/belbot_get_light.cpp +++ b/engines/titanic/game/belbot_get_light.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CBelbotGetLight::save(SimpleFile *file, int indent) const { +void CBelbotGetLight::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_value, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/game/belbot_get_light.h b/engines/titanic/game/belbot_get_light.h index 05c14f5b45..dd6f361384 100644 --- a/engines/titanic/game/belbot_get_light.h +++ b/engines/titanic/game/belbot_get_light.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/bilge_succubus.cpp b/engines/titanic/game/bilge_succubus.cpp index 9c19d81020..ceee3f7740 100644 --- a/engines/titanic/game/bilge_succubus.cpp +++ b/engines/titanic/game/bilge_succubus.cpp @@ -28,7 +28,7 @@ CBilgeSuccUBus::CBilgeSuccUBus() : CSuccUBus(), _field1DC(0), _field1E0(0), _field1E4(0), _field1E8(0) { } -void CBilgeSuccUBus::save(SimpleFile *file, int indent) const { +void CBilgeSuccUBus::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_field1DC, indent); file->writeNumberLine(_field1E0, indent); diff --git a/engines/titanic/game/bilge_succubus.h b/engines/titanic/game/bilge_succubus.h index 4ff72a57c7..9546d00847 100644 --- a/engines/titanic/game/bilge_succubus.h +++ b/engines/titanic/game/bilge_succubus.h @@ -40,7 +40,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/bomb.cpp b/engines/titanic/game/bomb.cpp index a6086a2bca..9a08f26ece 100644 --- a/engines/titanic/game/bomb.cpp +++ b/engines/titanic/game/bomb.cpp @@ -38,7 +38,7 @@ CBomb::CBomb() : CBackground() { _field104 = 60; } -void CBomb::save(SimpleFile *file, int indent) const { +void CBomb::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); file->writeNumberLine(_fieldE4, indent); diff --git a/engines/titanic/game/bomb.h b/engines/titanic/game/bomb.h index 76799da323..59351db27c 100644 --- a/engines/titanic/game/bomb.h +++ b/engines/titanic/game/bomb.h @@ -48,7 +48,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/bottom_of_well_monitor.cpp b/engines/titanic/game/bottom_of_well_monitor.cpp index b48b5ad291..beb2a80ce9 100644 --- a/engines/titanic/game/bottom_of_well_monitor.cpp +++ b/engines/titanic/game/bottom_of_well_monitor.cpp @@ -27,7 +27,7 @@ namespace Titanic { int CBottomOfWellMonitor::_v1; int CBottomOfWellMonitor::_v2; -void CBottomOfWellMonitor::save(SimpleFile *file, int indent) const { +void CBottomOfWellMonitor::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_v1, indent); file->writeNumberLine(_v2, indent); diff --git a/engines/titanic/game/bottom_of_well_monitor.h b/engines/titanic/game/bottom_of_well_monitor.h index e063579056..cae02b9cb8 100644 --- a/engines/titanic/game/bottom_of_well_monitor.h +++ b/engines/titanic/game/bottom_of_well_monitor.h @@ -38,7 +38,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/bowl_unlocker.cpp b/engines/titanic/game/bowl_unlocker.cpp index 83ae9e35d5..c3c501dbd6 100644 --- a/engines/titanic/game/bowl_unlocker.cpp +++ b/engines/titanic/game/bowl_unlocker.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CBowlUnlocker::save(SimpleFile *file, int indent) const { +void CBowlUnlocker::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/game/bowl_unlocker.h b/engines/titanic/game/bowl_unlocker.h index 7b886c406a..9ab9e63048 100644 --- a/engines/titanic/game/bowl_unlocker.h +++ b/engines/titanic/game/bowl_unlocker.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/brain_slot.cpp b/engines/titanic/game/brain_slot.cpp index f655a963d5..f1963142ac 100644 --- a/engines/titanic/game/brain_slot.cpp +++ b/engines/titanic/game/brain_slot.cpp @@ -27,7 +27,7 @@ namespace Titanic { int CBrainSlot::_v1; int CBrainSlot::_v2; -void CBrainSlot::save(SimpleFile *file, int indent) const { +void CBrainSlot::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value1, indent); file->writeQuotedLine(_value2, indent); diff --git a/engines/titanic/game/brain_slot.h b/engines/titanic/game/brain_slot.h index ae797ebb2f..f94ffc7eca 100644 --- a/engines/titanic/game/brain_slot.h +++ b/engines/titanic/game/brain_slot.h @@ -40,7 +40,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/bridge_door.cpp b/engines/titanic/game/bridge_door.cpp index b24f7a6b6a..57cdbd23ad 100644 --- a/engines/titanic/game/bridge_door.cpp +++ b/engines/titanic/game/bridge_door.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CBridgeDoor::save(SimpleFile *file, int indent) const { +void CBridgeDoor::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/game/bridge_door.h b/engines/titanic/game/bridge_door.h index 828562dfa3..f14d6010a4 100644 --- a/engines/titanic/game/bridge_door.h +++ b/engines/titanic/game/bridge_door.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/bridge_view.cpp b/engines/titanic/game/bridge_view.cpp index 8afca38cf1..9854969494 100644 --- a/engines/titanic/game/bridge_view.cpp +++ b/engines/titanic/game/bridge_view.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CBridgeView::save(SimpleFile *file, int indent) const { +void CBridgeView::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); CBackground::save(file, indent); diff --git a/engines/titanic/game/bridge_view.h b/engines/titanic/game/bridge_view.h index 35de076573..be349f3a15 100644 --- a/engines/titanic/game/bridge_view.h +++ b/engines/titanic/game/bridge_view.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/broken_pell_base.cpp b/engines/titanic/game/broken_pell_base.cpp index 8b8e0b9db5..77d3aee625 100644 --- a/engines/titanic/game/broken_pell_base.cpp +++ b/engines/titanic/game/broken_pell_base.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CBrokenPellBase, CBackground) int CBrokenPellBase::_v1; int CBrokenPellBase::_v2; -void CBrokenPellBase::save(SimpleFile *file, int indent) const { +void CBrokenPellBase::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_v1, indent); file->writeNumberLine(_v2, indent); diff --git a/engines/titanic/game/broken_pell_base.h b/engines/titanic/game/broken_pell_base.h index 45b6594301..d3157fdcff 100644 --- a/engines/titanic/game/broken_pell_base.h +++ b/engines/titanic/game/broken_pell_base.h @@ -41,7 +41,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/broken_pellerator.cpp b/engines/titanic/game/broken_pellerator.cpp index ea167677bf..d3b204b1e5 100644 --- a/engines/titanic/game/broken_pellerator.cpp +++ b/engines/titanic/game/broken_pellerator.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CBrokenPellerator::save(SimpleFile *file, int indent) const { +void CBrokenPellerator::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string2, indent); file->writeQuotedLine(_string3, indent); diff --git a/engines/titanic/game/broken_pellerator.h b/engines/titanic/game/broken_pellerator.h index 974d5d21b4..ebb31d58e1 100644 --- a/engines/titanic/game/broken_pellerator.h +++ b/engines/titanic/game/broken_pellerator.h @@ -39,7 +39,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/broken_pellerator_froz.cpp b/engines/titanic/game/broken_pellerator_froz.cpp index 6b077d27ec..4b21ea93d0 100644 --- a/engines/titanic/game/broken_pellerator_froz.cpp +++ b/engines/titanic/game/broken_pellerator_froz.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CBrokenPelleratorFroz::save(SimpleFile *file, int indent) const { +void CBrokenPelleratorFroz::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string2, indent); file->writeQuotedLine(_string3, indent); diff --git a/engines/titanic/game/broken_pellerator_froz.h b/engines/titanic/game/broken_pellerator_froz.h index c3674f0af7..cc2ed317a4 100644 --- a/engines/titanic/game/broken_pellerator_froz.h +++ b/engines/titanic/game/broken_pellerator_froz.h @@ -39,7 +39,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/cage.cpp b/engines/titanic/game/cage.cpp index 480944fb47..7fbc052278 100644 --- a/engines/titanic/game/cage.cpp +++ b/engines/titanic/game/cage.cpp @@ -27,7 +27,7 @@ namespace Titanic { int CCage::_v1; int CCage::_v2; -void CCage::save(SimpleFile *file, int indent) const { +void CCage::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_v1, indent); file->writeNumberLine(_v2, indent); diff --git a/engines/titanic/game/cage.h b/engines/titanic/game/cage.h index 08fc8c8c43..72de9fba7b 100644 --- a/engines/titanic/game/cage.h +++ b/engines/titanic/game/cage.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/call_pellerator.cpp b/engines/titanic/game/call_pellerator.cpp index 85f2ab83b5..0ea48131b1 100644 --- a/engines/titanic/game/call_pellerator.cpp +++ b/engines/titanic/game/call_pellerator.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CCallPellerator::save(SimpleFile *file, int indent) const { +void CCallPellerator::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/game/call_pellerator.h b/engines/titanic/game/call_pellerator.h index dc9afe0a1a..fc8110afdb 100644 --- a/engines/titanic/game/call_pellerator.h +++ b/engines/titanic/game/call_pellerator.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/captains_wheel.cpp b/engines/titanic/game/captains_wheel.cpp index b4e31fdc40..c84c9194ce 100644 --- a/engines/titanic/game/captains_wheel.cpp +++ b/engines/titanic/game/captains_wheel.cpp @@ -29,7 +29,7 @@ CCaptainsWheel::CCaptainsWheel() : CBackground(), _fieldF0(0), _fieldF4(0) { } -void CCaptainsWheel::save(SimpleFile *file, int indent) const { +void CCaptainsWheel::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); file->writeNumberLine(_fieldE4, indent); diff --git a/engines/titanic/game/captains_wheel.h b/engines/titanic/game/captains_wheel.h index bcfc5136e7..f817ee709e 100644 --- a/engines/titanic/game/captains_wheel.h +++ b/engines/titanic/game/captains_wheel.h @@ -42,7 +42,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/cdrom.cpp b/engines/titanic/game/cdrom.cpp index 0fd7eb5dbd..111b090920 100644 --- a/engines/titanic/game/cdrom.cpp +++ b/engines/titanic/game/cdrom.cpp @@ -36,7 +36,7 @@ END_MESSAGE_MAP() CCDROM::CCDROM() : CGameObject() { } -void CCDROM::save(SimpleFile *file, int indent) const { +void CCDROM::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writePoint(_tempPos, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/game/cdrom.h b/engines/titanic/game/cdrom.h index 44e1e82216..ece72428bc 100644 --- a/engines/titanic/game/cdrom.h +++ b/engines/titanic/game/cdrom.h @@ -44,7 +44,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/cdrom_computer.cpp b/engines/titanic/game/cdrom_computer.cpp index a25706a198..ceb0595188 100644 --- a/engines/titanic/game/cdrom_computer.cpp +++ b/engines/titanic/game/cdrom_computer.cpp @@ -33,7 +33,7 @@ CCDROMComputer::CCDROMComputer() : CGameObject(), _clickRect(0, 3, 55, 32) { } -void CCDROMComputer::save(SimpleFile *file, int indent) const { +void CCDROMComputer::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_clickRect.left, indent); file->writeNumberLine(_clickRect.top, indent); diff --git a/engines/titanic/game/cdrom_computer.h b/engines/titanic/game/cdrom_computer.h index 4ea2f4d568..da6e0e778b 100644 --- a/engines/titanic/game/cdrom_computer.h +++ b/engines/titanic/game/cdrom_computer.h @@ -40,7 +40,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/cdrom_tray.cpp b/engines/titanic/game/cdrom_tray.cpp index 1b2d6baf07..118150bee9 100644 --- a/engines/titanic/game/cdrom_tray.cpp +++ b/engines/titanic/game/cdrom_tray.cpp @@ -36,7 +36,7 @@ END_MESSAGE_MAP() CCDROMTray::CCDROMTray() : CGameObject(), _state(0) { } -void CCDROMTray::save(SimpleFile *file, int indent) const { +void CCDROMTray::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_state, indent); file->writeQuotedLine(_insertedCD, indent); diff --git a/engines/titanic/game/cdrom_tray.h b/engines/titanic/game/cdrom_tray.h index 96faf64600..dbeec170d7 100644 --- a/engines/titanic/game/cdrom_tray.h +++ b/engines/titanic/game/cdrom_tray.h @@ -43,7 +43,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/cell_point_button.cpp b/engines/titanic/game/cell_point_button.cpp index 45ddad8164..18ece09cb0 100644 --- a/engines/titanic/game/cell_point_button.cpp +++ b/engines/titanic/game/cell_point_button.cpp @@ -38,7 +38,7 @@ CCellPointButton::CCellPointButton() : CBackground() { _field108 = 1; } -void CCellPointButton::save(SimpleFile *file, int indent) const { +void CCellPointButton::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); file->writeNumberLine(_fieldE4, indent); diff --git a/engines/titanic/game/cell_point_button.h b/engines/titanic/game/cell_point_button.h index 02710f6ce5..0a04350838 100644 --- a/engines/titanic/game/cell_point_button.h +++ b/engines/titanic/game/cell_point_button.h @@ -49,7 +49,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/chev_code.cpp b/engines/titanic/game/chev_code.cpp index d2818f60a8..ebc20578b7 100644 --- a/engines/titanic/game/chev_code.cpp +++ b/engines/titanic/game/chev_code.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CChevCode::save(SimpleFile *file, int indent) const { +void CChevCode::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/game/chev_code.h b/engines/titanic/game/chev_code.h index 3d5347bd05..df7421e06f 100644 --- a/engines/titanic/game/chev_code.h +++ b/engines/titanic/game/chev_code.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/chev_panel.cpp b/engines/titanic/game/chev_panel.cpp index 665b91dca2..245968e356 100644 --- a/engines/titanic/game/chev_panel.cpp +++ b/engines/titanic/game/chev_panel.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CChevPanel::save(SimpleFile *file, int indent) const { +void CChevPanel::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); file->writeNumberLine(_fieldC0, indent); diff --git a/engines/titanic/game/chev_panel.h b/engines/titanic/game/chev_panel.h index 9ddca37dc3..e53a94e69e 100644 --- a/engines/titanic/game/chev_panel.h +++ b/engines/titanic/game/chev_panel.h @@ -39,7 +39,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/chicken_cooler.cpp b/engines/titanic/game/chicken_cooler.cpp index aa39f041a4..29232e10bf 100644 --- a/engines/titanic/game/chicken_cooler.cpp +++ b/engines/titanic/game/chicken_cooler.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CChickenCooler::save(SimpleFile *file, int indent) const { +void CChickenCooler::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); file->writeNumberLine(_fieldC0, indent); diff --git a/engines/titanic/game/chicken_cooler.h b/engines/titanic/game/chicken_cooler.h index 220dba081b..b735b0f9c9 100644 --- a/engines/titanic/game/chicken_cooler.h +++ b/engines/titanic/game/chicken_cooler.h @@ -40,7 +40,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/chicken_dispensor.cpp b/engines/titanic/game/chicken_dispensor.cpp index d3660bdf03..a9bf576765 100644 --- a/engines/titanic/game/chicken_dispensor.cpp +++ b/engines/titanic/game/chicken_dispensor.cpp @@ -28,7 +28,7 @@ CChickenDispensor::CChickenDispensor() : CBackground(), _fieldE0(0), _fieldE4(0), _fieldE8(0) { } -void CChickenDispensor::save(SimpleFile *file, int indent) const { +void CChickenDispensor::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); file->writeNumberLine(_fieldE4, indent); diff --git a/engines/titanic/game/chicken_dispensor.h b/engines/titanic/game/chicken_dispensor.h index 97e5f864f6..21163c681c 100644 --- a/engines/titanic/game/chicken_dispensor.h +++ b/engines/titanic/game/chicken_dispensor.h @@ -39,7 +39,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/close_broken_pel.cpp b/engines/titanic/game/close_broken_pel.cpp index 9cc4eb6535..d27441ac96 100644 --- a/engines/titanic/game/close_broken_pel.cpp +++ b/engines/titanic/game/close_broken_pel.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CCloseBrokenPel::save(SimpleFile *file, int indent) const { +void CCloseBrokenPel::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string3, indent); CBackground::save(file, indent); diff --git a/engines/titanic/game/close_broken_pel.h b/engines/titanic/game/close_broken_pel.h index ecf38d904c..252d0895cf 100644 --- a/engines/titanic/game/close_broken_pel.h +++ b/engines/titanic/game/close_broken_pel.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/code_wheel.cpp b/engines/titanic/game/code_wheel.cpp index a10a70c974..d8ce48e390 100644 --- a/engines/titanic/game/code_wheel.cpp +++ b/engines/titanic/game/code_wheel.cpp @@ -27,7 +27,7 @@ namespace Titanic { CodeWheel::CodeWheel() : CBomb(), _field108(0), _field10C(4), _field110(0) { } -void CodeWheel::save(SimpleFile *file, int indent) const { +void CodeWheel::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_field108, indent); file->writeNumberLine(_field10C, indent); diff --git a/engines/titanic/game/code_wheel.h b/engines/titanic/game/code_wheel.h index 6080e92041..1776ad6055 100644 --- a/engines/titanic/game/code_wheel.h +++ b/engines/titanic/game/code_wheel.h @@ -39,7 +39,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/computer.cpp b/engines/titanic/game/computer.cpp index d2a2cc1935..e3f9430f3e 100644 --- a/engines/titanic/game/computer.cpp +++ b/engines/titanic/game/computer.cpp @@ -30,7 +30,7 @@ BEGIN_MESSAGE_MAP(CComputer, CBackground) ON_MESSAGE(MovieEndMsg) END_MESSAGE_MAP() -void CComputer::save(SimpleFile *file, int indent) const { +void CComputer::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_currentCD, indent); file->writeNumberLine(_state, indent); diff --git a/engines/titanic/game/computer.h b/engines/titanic/game/computer.h index 3db0ee1979..e9716aa08a 100644 --- a/engines/titanic/game/computer.h +++ b/engines/titanic/game/computer.h @@ -42,7 +42,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/computer_screen.cpp b/engines/titanic/game/computer_screen.cpp index 9d15ea903f..c73db4f879 100644 --- a/engines/titanic/game/computer_screen.cpp +++ b/engines/titanic/game/computer_screen.cpp @@ -35,7 +35,7 @@ END_MESSAGE_MAP() CComputerScreen::CComputerScreen() : CGameObject() { } -void CComputerScreen::save(SimpleFile *file, int indent) const { +void CComputerScreen::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/game/computer_screen.h b/engines/titanic/game/computer_screen.h index fa02ef5e1a..032c724ba6 100644 --- a/engines/titanic/game/computer_screen.h +++ b/engines/titanic/game/computer_screen.h @@ -40,7 +40,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/cookie.cpp b/engines/titanic/game/cookie.cpp index 98621d04ab..915bb93b4a 100644 --- a/engines/titanic/game/cookie.cpp +++ b/engines/titanic/game/cookie.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CCookie::save(SimpleFile *file, int indent) const { +void CCookie::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value1, indent); file->writeNumberLine(_value2, indent); diff --git a/engines/titanic/game/cookie.h b/engines/titanic/game/cookie.h index bd9d1fff04..72b29dc078 100644 --- a/engines/titanic/game/cookie.h +++ b/engines/titanic/game/cookie.h @@ -38,7 +38,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/credits.cpp b/engines/titanic/game/credits.cpp index 178d268fb6..7078d41a17 100644 --- a/engines/titanic/game/credits.cpp +++ b/engines/titanic/game/credits.cpp @@ -27,7 +27,7 @@ namespace Titanic { CCredits::CCredits() : CGameObject(), _fieldBC(-1), _fieldC0(1) { } -void CCredits::save(SimpleFile *file, int indent) const { +void CCredits::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); file->writeNumberLine(_fieldC0, indent); diff --git a/engines/titanic/game/credits.h b/engines/titanic/game/credits.h index dc229127c8..5b3fe290d6 100644 --- a/engines/titanic/game/credits.h +++ b/engines/titanic/game/credits.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/credits_button.cpp b/engines/titanic/game/credits_button.cpp index 0ab23c1efc..90bb1b5ebe 100644 --- a/engines/titanic/game/credits_button.cpp +++ b/engines/titanic/game/credits_button.cpp @@ -27,7 +27,7 @@ namespace Titanic { CCreditsButton::CCreditsButton() : CBackground(), _fieldE0(1) { } -void CCreditsButton::save(SimpleFile *file, int indent) const { +void CCreditsButton::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); CBackground::save(file, indent); diff --git a/engines/titanic/game/credits_button.h b/engines/titanic/game/credits_button.h index fd7a8ad0c2..74fcdc03b5 100644 --- a/engines/titanic/game/credits_button.h +++ b/engines/titanic/game/credits_button.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/dead_area.cpp b/engines/titanic/game/dead_area.cpp index 5d5b2d06aa..3c41ab34ba 100644 --- a/engines/titanic/game/dead_area.cpp +++ b/engines/titanic/game/dead_area.cpp @@ -32,7 +32,7 @@ END_MESSAGE_MAP() CDeadArea::CDeadArea() : CGameObject() { } -void CDeadArea::save(SimpleFile *file, int indent) const { +void CDeadArea::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/game/dead_area.h b/engines/titanic/game/dead_area.h index 367308e5b5..8bffed75ca 100644 --- a/engines/titanic/game/dead_area.h +++ b/engines/titanic/game/dead_area.h @@ -42,7 +42,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/desk_click_responder.cpp b/engines/titanic/game/desk_click_responder.cpp index 312fe564af..d9b2cb64b4 100644 --- a/engines/titanic/game/desk_click_responder.cpp +++ b/engines/titanic/game/desk_click_responder.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CDeskClickResponder::save(SimpleFile *file, int indent) const { +void CDeskClickResponder::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldD4, indent); file->writeNumberLine(_fieldD8, indent); diff --git a/engines/titanic/game/desk_click_responder.h b/engines/titanic/game/desk_click_responder.h index a11d7ae328..3967b687db 100644 --- a/engines/titanic/game/desk_click_responder.h +++ b/engines/titanic/game/desk_click_responder.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/doorbot_elevator_handler.cpp b/engines/titanic/game/doorbot_elevator_handler.cpp index ae1894da53..13fc368137 100644 --- a/engines/titanic/game/doorbot_elevator_handler.cpp +++ b/engines/titanic/game/doorbot_elevator_handler.cpp @@ -26,7 +26,7 @@ namespace Titanic { int CDoorbotElevatorHandler::_v1; -void CDoorbotElevatorHandler::save(SimpleFile *file, int indent) const { +void CDoorbotElevatorHandler::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); file->writeNumberLine(_v1, indent); diff --git a/engines/titanic/game/doorbot_elevator_handler.h b/engines/titanic/game/doorbot_elevator_handler.h index 2bbfab906b..57722c5448 100644 --- a/engines/titanic/game/doorbot_elevator_handler.h +++ b/engines/titanic/game/doorbot_elevator_handler.h @@ -39,7 +39,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/doorbot_home_handler.cpp b/engines/titanic/game/doorbot_home_handler.cpp index 5d250172b1..b848308845 100644 --- a/engines/titanic/game/doorbot_home_handler.cpp +++ b/engines/titanic/game/doorbot_home_handler.cpp @@ -27,7 +27,7 @@ namespace Titanic { CDoorbotHomeHandler::CDoorbotHomeHandler() { } -void CDoorbotHomeHandler::save(SimpleFile *file, int indent) const { +void CDoorbotHomeHandler::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/game/doorbot_home_handler.h b/engines/titanic/game/doorbot_home_handler.h index 1e5d128a7d..66cec70ee9 100644 --- a/engines/titanic/game/doorbot_home_handler.h +++ b/engines/titanic/game/doorbot_home_handler.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/ear_sweet_bowl.cpp b/engines/titanic/game/ear_sweet_bowl.cpp index dc4ca7af08..0f7069356d 100644 --- a/engines/titanic/game/ear_sweet_bowl.cpp +++ b/engines/titanic/game/ear_sweet_bowl.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CEarSweetBowl::save(SimpleFile *file, int indent) const { +void CEarSweetBowl::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CSweetBowl::save(file, indent); } diff --git a/engines/titanic/game/ear_sweet_bowl.h b/engines/titanic/game/ear_sweet_bowl.h index aa276f82a7..a5386d4da0 100644 --- a/engines/titanic/game/ear_sweet_bowl.h +++ b/engines/titanic/game/ear_sweet_bowl.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/eject_phonograph_button.cpp b/engines/titanic/game/eject_phonograph_button.cpp index bd444f94e5..4657f04126 100644 --- a/engines/titanic/game/eject_phonograph_button.cpp +++ b/engines/titanic/game/eject_phonograph_button.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CEjectPhonographButton::save(SimpleFile *file, int indent) const { +void CEjectPhonographButton::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); file->writeNumberLine(_fieldE4, indent); diff --git a/engines/titanic/game/eject_phonograph_button.h b/engines/titanic/game/eject_phonograph_button.h index d3e8a50618..670670b56f 100644 --- a/engines/titanic/game/eject_phonograph_button.h +++ b/engines/titanic/game/eject_phonograph_button.h @@ -40,7 +40,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/elevator_action_area.cpp b/engines/titanic/game/elevator_action_area.cpp index c9916bfc73..1cbff8d64d 100644 --- a/engines/titanic/game/elevator_action_area.cpp +++ b/engines/titanic/game/elevator_action_area.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CElevatorActionArea::save(SimpleFile *file, int indent) const { +void CElevatorActionArea::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/game/elevator_action_area.h b/engines/titanic/game/elevator_action_area.h index 570ee808ed..361f19afb8 100644 --- a/engines/titanic/game/elevator_action_area.h +++ b/engines/titanic/game/elevator_action_area.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/emma_control.cpp b/engines/titanic/game/emma_control.cpp index fac429ccec..814cb44d79 100644 --- a/engines/titanic/game/emma_control.cpp +++ b/engines/titanic/game/emma_control.cpp @@ -26,7 +26,7 @@ namespace Titanic { int CEmmaControl::_v1; -void CEmmaControl::save(SimpleFile *file, int indent) const { +void CEmmaControl::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_v1, indent); file->writeQuotedLine(_wavFile1, indent); diff --git a/engines/titanic/game/emma_control.h b/engines/titanic/game/emma_control.h index ea30c52279..654d3c5237 100644 --- a/engines/titanic/game/emma_control.h +++ b/engines/titanic/game/emma_control.h @@ -39,7 +39,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/empty_nut_bowl.cpp b/engines/titanic/game/empty_nut_bowl.cpp index 217029be19..ae9cb35e4d 100644 --- a/engines/titanic/game/empty_nut_bowl.cpp +++ b/engines/titanic/game/empty_nut_bowl.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CEmptyNutBowl::save(SimpleFile *file, int indent) const { +void CEmptyNutBowl::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/game/empty_nut_bowl.h b/engines/titanic/game/empty_nut_bowl.h index 9645284e1b..31f31e2339 100644 --- a/engines/titanic/game/empty_nut_bowl.h +++ b/engines/titanic/game/empty_nut_bowl.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/end_credit_text.cpp b/engines/titanic/game/end_credit_text.cpp index 8ae83ac8d0..6e0c21bbe9 100644 --- a/engines/titanic/game/end_credit_text.cpp +++ b/engines/titanic/game/end_credit_text.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CEndCreditText::save(SimpleFile *file, int indent) const { +void CEndCreditText::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/game/end_credit_text.h b/engines/titanic/game/end_credit_text.h index 0003a8b4e3..137e51094e 100644 --- a/engines/titanic/game/end_credit_text.h +++ b/engines/titanic/game/end_credit_text.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/end_credits.cpp b/engines/titanic/game/end_credits.cpp index 0f71cfc91a..61640b92ad 100644 --- a/engines/titanic/game/end_credits.cpp +++ b/engines/titanic/game/end_credits.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CEndCredits::save(SimpleFile *file, int indent) const { +void CEndCredits::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/game/end_credits.h b/engines/titanic/game/end_credits.h index a259a215a4..9aad29769a 100644 --- a/engines/titanic/game/end_credits.h +++ b/engines/titanic/game/end_credits.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/end_explode_ship.cpp b/engines/titanic/game/end_explode_ship.cpp index e12e03e28d..f7ac36503f 100644 --- a/engines/titanic/game/end_explode_ship.cpp +++ b/engines/titanic/game/end_explode_ship.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CEndExplodeShip::save(SimpleFile *file, int indent) const { +void CEndExplodeShip::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value1, indent); file->writeNumberLine(_value2, indent); diff --git a/engines/titanic/game/end_explode_ship.h b/engines/titanic/game/end_explode_ship.h index a6b053fe55..48bbeca897 100644 --- a/engines/titanic/game/end_explode_ship.h +++ b/engines/titanic/game/end_explode_ship.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/end_game_credits.cpp b/engines/titanic/game/end_game_credits.cpp index 56b06e6ec0..2d1aa79b1d 100644 --- a/engines/titanic/game/end_game_credits.cpp +++ b/engines/titanic/game/end_game_credits.cpp @@ -27,7 +27,7 @@ namespace Titanic { CEndGameCredits::CEndGameCredits() : CGameObject(), _fieldBC(0) { } -void CEndGameCredits::save(SimpleFile *file, int indent) const { +void CEndGameCredits::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); file->writePoint(_pos1, indent); diff --git a/engines/titanic/game/end_game_credits.h b/engines/titanic/game/end_game_credits.h index ab14f2680b..5eee5fc7c8 100644 --- a/engines/titanic/game/end_game_credits.h +++ b/engines/titanic/game/end_game_credits.h @@ -38,7 +38,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/end_sequence_control.cpp b/engines/titanic/game/end_sequence_control.cpp index 2417214f16..d32b3d1713 100644 --- a/engines/titanic/game/end_sequence_control.cpp +++ b/engines/titanic/game/end_sequence_control.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CEndSequenceControl::save(SimpleFile *file, int indent) const { +void CEndSequenceControl::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/game/end_sequence_control.h b/engines/titanic/game/end_sequence_control.h index 64bafcbd0b..0a9d6f0717 100644 --- a/engines/titanic/game/end_sequence_control.h +++ b/engines/titanic/game/end_sequence_control.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/fan.cpp b/engines/titanic/game/fan.cpp index 4715aa76dd..eabaf63568 100644 --- a/engines/titanic/game/fan.cpp +++ b/engines/titanic/game/fan.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CFan::save(SimpleFile *file, int indent) const { +void CFan::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value1, indent); file->writeNumberLine(_value2, indent); diff --git a/engines/titanic/game/fan.h b/engines/titanic/game/fan.h index 6f234074f5..d3cf527b08 100644 --- a/engines/titanic/game/fan.h +++ b/engines/titanic/game/fan.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/fan_control.cpp b/engines/titanic/game/fan_control.cpp index 44e36b2b6c..a42e4dd5c1 100644 --- a/engines/titanic/game/fan_control.cpp +++ b/engines/titanic/game/fan_control.cpp @@ -28,7 +28,7 @@ CFanControl::CFanControl() : CGameObject(), _fieldBC(0), _fieldC0(0), _fieldC4(0), _fieldC8(0), _fieldCC(0) { } -void CFanControl::save(SimpleFile *file, int indent) const { +void CFanControl::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); file->writeNumberLine(_fieldC0, indent); diff --git a/engines/titanic/game/fan_control.h b/engines/titanic/game/fan_control.h index 54ebbe27f3..14b56db152 100644 --- a/engines/titanic/game/fan_control.h +++ b/engines/titanic/game/fan_control.h @@ -41,7 +41,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/fan_decrease.cpp b/engines/titanic/game/fan_decrease.cpp index 41e227e98b..2049b1ebc9 100644 --- a/engines/titanic/game/fan_decrease.cpp +++ b/engines/titanic/game/fan_decrease.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CFanDecrease::save(SimpleFile *file, int indent) const { +void CFanDecrease::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/game/fan_decrease.h b/engines/titanic/game/fan_decrease.h index bac102823d..7d0c4a3671 100644 --- a/engines/titanic/game/fan_decrease.h +++ b/engines/titanic/game/fan_decrease.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/fan_increase.cpp b/engines/titanic/game/fan_increase.cpp index 06fcf474b7..aa23dd9275 100644 --- a/engines/titanic/game/fan_increase.cpp +++ b/engines/titanic/game/fan_increase.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CFanIncrease::save(SimpleFile *file, int indent) const { +void CFanIncrease::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/game/fan_increase.h b/engines/titanic/game/fan_increase.h index 62561f1c54..e81ff4640f 100644 --- a/engines/titanic/game/fan_increase.h +++ b/engines/titanic/game/fan_increase.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/fan_noises.cpp b/engines/titanic/game/fan_noises.cpp index 18a6ef76ce..14177ab64e 100644 --- a/engines/titanic/game/fan_noises.cpp +++ b/engines/titanic/game/fan_noises.cpp @@ -29,7 +29,7 @@ CFanNoises::CFanNoises() : CGameObject(), _fieldBC(-1), _fieldD0(0), _fieldD4(-1) { } -void CFanNoises::save(SimpleFile *file, int indent) const { +void CFanNoises::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); file->writeNumberLine(_fieldC0, indent); diff --git a/engines/titanic/game/fan_noises.h b/engines/titanic/game/fan_noises.h index a78b3ca897..f187853097 100644 --- a/engines/titanic/game/fan_noises.h +++ b/engines/titanic/game/fan_noises.h @@ -45,7 +45,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/floor_indicator.cpp b/engines/titanic/game/floor_indicator.cpp index b17bd4beeb..360232c38c 100644 --- a/engines/titanic/game/floor_indicator.cpp +++ b/engines/titanic/game/floor_indicator.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CFloorIndicator::save(SimpleFile *file, int indent) const { +void CFloorIndicator::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/game/floor_indicator.h b/engines/titanic/game/floor_indicator.h index a3511fb622..ccd6a8b797 100644 --- a/engines/titanic/game/floor_indicator.h +++ b/engines/titanic/game/floor_indicator.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/games_console.cpp b/engines/titanic/game/games_console.cpp index 13a726058a..b7500f9dd9 100644 --- a/engines/titanic/game/games_console.cpp +++ b/engines/titanic/game/games_console.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CGamesConsole::save(SimpleFile *file, int indent) const { +void CGamesConsole::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); CBackground::save(file, indent); diff --git a/engines/titanic/game/games_console.h b/engines/titanic/game/games_console.h index 67634d8d41..8d37186b6d 100644 --- a/engines/titanic/game/games_console.h +++ b/engines/titanic/game/games_console.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/get_lift_eye2.cpp b/engines/titanic/game/get_lift_eye2.cpp index 76e6d2aa64..7747f7b0c2 100644 --- a/engines/titanic/game/get_lift_eye2.cpp +++ b/engines/titanic/game/get_lift_eye2.cpp @@ -34,7 +34,7 @@ void CGetLiftEye2::deinit() { delete _v1; } -void CGetLiftEye2::save(SimpleFile *file, int indent) const { +void CGetLiftEye2::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(*_v1, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/game/get_lift_eye2.h b/engines/titanic/game/get_lift_eye2.h index d936559313..7a3caa1283 100644 --- a/engines/titanic/game/get_lift_eye2.h +++ b/engines/titanic/game/get_lift_eye2.h @@ -39,7 +39,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/glass_smasher.cpp b/engines/titanic/game/glass_smasher.cpp index 80b665d6d8..8c33124a47 100644 --- a/engines/titanic/game/glass_smasher.cpp +++ b/engines/titanic/game/glass_smasher.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CGlassSmasher::save(SimpleFile *file, int indent) const { +void CGlassSmasher::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/game/glass_smasher.h b/engines/titanic/game/glass_smasher.h index 9c25065ecf..1c4e703bea 100644 --- a/engines/titanic/game/glass_smasher.h +++ b/engines/titanic/game/glass_smasher.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/gondolier/gondolier_base.cpp b/engines/titanic/game/gondolier/gondolier_base.cpp index bf54ed4d8d..1f7339cf38 100644 --- a/engines/titanic/game/gondolier/gondolier_base.cpp +++ b/engines/titanic/game/gondolier/gondolier_base.cpp @@ -35,7 +35,7 @@ int CGondolierBase::_v8; int CGondolierBase::_v9; int CGondolierBase::_v10; -void CGondolierBase::save(SimpleFile *file, int indent) const { +void CGondolierBase::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_v1, indent); file->writeNumberLine(_v2, indent); diff --git a/engines/titanic/game/gondolier/gondolier_base.h b/engines/titanic/game/gondolier/gondolier_base.h index c45e3e2283..e5efaf8a35 100644 --- a/engines/titanic/game/gondolier/gondolier_base.h +++ b/engines/titanic/game/gondolier/gondolier_base.h @@ -45,7 +45,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/gondolier/gondolier_chest.cpp b/engines/titanic/game/gondolier/gondolier_chest.cpp index 441a8bac31..b3e7217502 100644 --- a/engines/titanic/game/gondolier/gondolier_chest.cpp +++ b/engines/titanic/game/gondolier/gondolier_chest.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CGondolierChest::save(SimpleFile *file, int indent) const { +void CGondolierChest::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGondolierBase::save(file, indent); } diff --git a/engines/titanic/game/gondolier/gondolier_chest.h b/engines/titanic/game/gondolier/gondolier_chest.h index d2c13812f4..55e5a2ba75 100644 --- a/engines/titanic/game/gondolier/gondolier_chest.h +++ b/engines/titanic/game/gondolier/gondolier_chest.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/gondolier/gondolier_face.cpp b/engines/titanic/game/gondolier/gondolier_face.cpp index 6db23d8a1a..bdab8491ed 100644 --- a/engines/titanic/game/gondolier/gondolier_face.cpp +++ b/engines/titanic/game/gondolier/gondolier_face.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CGondolierFace::save(SimpleFile *file, int indent) const { +void CGondolierFace::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); CGondolierBase::save(file, indent); diff --git a/engines/titanic/game/gondolier/gondolier_face.h b/engines/titanic/game/gondolier/gondolier_face.h index 334cab143f..03e221e030 100644 --- a/engines/titanic/game/gondolier/gondolier_face.h +++ b/engines/titanic/game/gondolier/gondolier_face.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/gondolier/gondolier_mixer.cpp b/engines/titanic/game/gondolier/gondolier_mixer.cpp index 76bf2597d9..9b7b72c11b 100644 --- a/engines/titanic/game/gondolier/gondolier_mixer.cpp +++ b/engines/titanic/game/gondolier/gondolier_mixer.cpp @@ -31,7 +31,7 @@ CGondolierMixer::CGondolierMixer() : CGondolierBase(), _fieldE4(0) { } -void CGondolierMixer::save(SimpleFile *file, int indent) const { +void CGondolierMixer::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); file->writeNumberLine(_fieldC0, indent); diff --git a/engines/titanic/game/gondolier/gondolier_mixer.h b/engines/titanic/game/gondolier/gondolier_mixer.h index 2202d24d5f..0276de16c8 100644 --- a/engines/titanic/game/gondolier/gondolier_mixer.h +++ b/engines/titanic/game/gondolier/gondolier_mixer.h @@ -45,7 +45,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/gondolier/gondolier_slider.cpp b/engines/titanic/game/gondolier/gondolier_slider.cpp index dff464ce64..eb6b1a9ad8 100644 --- a/engines/titanic/game/gondolier/gondolier_slider.cpp +++ b/engines/titanic/game/gondolier/gondolier_slider.cpp @@ -31,7 +31,7 @@ CGondolierSlider::CGondolierSlider() : CGondolierBase(), _fieldEC(0), _string1("NULL"), _fieldFC(0), _field118(0) { } -void CGondolierSlider::save(SimpleFile *file, int indent) const { +void CGondolierSlider::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); file->writeNumberLine(_fieldC0, indent); diff --git a/engines/titanic/game/gondolier/gondolier_slider.h b/engines/titanic/game/gondolier/gondolier_slider.h index eef4a58089..c5fd08f8cf 100644 --- a/engines/titanic/game/gondolier/gondolier_slider.h +++ b/engines/titanic/game/gondolier/gondolier_slider.h @@ -54,7 +54,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/hammer_clip.cpp b/engines/titanic/game/hammer_clip.cpp index 60955a21ff..e3f3a09a90 100644 --- a/engines/titanic/game/hammer_clip.cpp +++ b/engines/titanic/game/hammer_clip.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CHammerClip::save(SimpleFile *file, int indent) const { +void CHammerClip::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/game/hammer_clip.h b/engines/titanic/game/hammer_clip.h index d1891d8c09..01f419c8e4 100644 --- a/engines/titanic/game/hammer_clip.h +++ b/engines/titanic/game/hammer_clip.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/hammer_dispensor.cpp b/engines/titanic/game/hammer_dispensor.cpp index d486910843..440fe1bc7b 100644 --- a/engines/titanic/game/hammer_dispensor.cpp +++ b/engines/titanic/game/hammer_dispensor.cpp @@ -28,7 +28,7 @@ CHammerDispensor::CHammerDispensor() : CBackground(), _fieldE0(0), _fieldE4(0), _fieldE8(0) { } -void CHammerDispensor::save(SimpleFile *file, int indent) const { +void CHammerDispensor::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); file->writeNumberLine(_fieldE4, indent); diff --git a/engines/titanic/game/hammer_dispensor.h b/engines/titanic/game/hammer_dispensor.h index b99045dcb5..9a58850e66 100644 --- a/engines/titanic/game/hammer_dispensor.h +++ b/engines/titanic/game/hammer_dispensor.h @@ -39,7 +39,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/hammer_dispensor_button.cpp b/engines/titanic/game/hammer_dispensor_button.cpp index eb9fa3845b..3346498623 100644 --- a/engines/titanic/game/hammer_dispensor_button.cpp +++ b/engines/titanic/game/hammer_dispensor_button.cpp @@ -29,7 +29,7 @@ CHammerDispensorButton::CHammerDispensorButton() : CStartAction(), _field108(6), _field10C(0), _field110(0) { } -void CHammerDispensorButton::save(SimpleFile *file, int indent) const { +void CHammerDispensorButton::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldF8, indent); file->writeNumberLine(_fieldFC, indent); diff --git a/engines/titanic/game/hammer_dispensor_button.h b/engines/titanic/game/hammer_dispensor_button.h index 3f28360a8f..5b91bbd974 100644 --- a/engines/titanic/game/hammer_dispensor_button.h +++ b/engines/titanic/game/hammer_dispensor_button.h @@ -43,7 +43,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/head_slot.cpp b/engines/titanic/game/head_slot.cpp index 4cb15ccd1e..32650b75e4 100644 --- a/engines/titanic/game/head_slot.cpp +++ b/engines/titanic/game/head_slot.cpp @@ -31,7 +31,7 @@ CHeadSlot::CHeadSlot() : CGameObject(), _string1("NotWorking"), _string2("NULL") _fieldE4(82), _fieldE8(112), _fieldEC(0) { } -void CHeadSlot::save(SimpleFile *file, int indent) const { +void CHeadSlot::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); file->writeQuotedLine(_string1, indent); diff --git a/engines/titanic/game/head_slot.h b/engines/titanic/game/head_slot.h index 3ba94a6669..b09794774e 100644 --- a/engines/titanic/game/head_slot.h +++ b/engines/titanic/game/head_slot.h @@ -47,7 +47,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/head_smash_event.cpp b/engines/titanic/game/head_smash_event.cpp index a3d3395a6e..5b79acf7a5 100644 --- a/engines/titanic/game/head_smash_event.cpp +++ b/engines/titanic/game/head_smash_event.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CHeadSmashEvent::save(SimpleFile *file, int indent) const { +void CHeadSmashEvent::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CBackground::save(file, indent); } diff --git a/engines/titanic/game/head_smash_event.h b/engines/titanic/game/head_smash_event.h index 847e86eeba..9e21080a93 100644 --- a/engines/titanic/game/head_smash_event.h +++ b/engines/titanic/game/head_smash_event.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/head_smash_lever.cpp b/engines/titanic/game/head_smash_lever.cpp index 23ca96d6f9..5a2fe1f4c2 100644 --- a/engines/titanic/game/head_smash_lever.cpp +++ b/engines/titanic/game/head_smash_lever.cpp @@ -27,7 +27,7 @@ namespace Titanic { CHeadSmashLever::CHeadSmashLever() : CBackground(), _fieldE0(0), _fieldE4(0), _fieldE8(0) {} -void CHeadSmashLever::save(SimpleFile *file, int indent) const { +void CHeadSmashLever::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); file->writeNumberLine(_fieldE4, indent); diff --git a/engines/titanic/game/head_smash_lever.h b/engines/titanic/game/head_smash_lever.h index 8a67f56c67..a35a18c0a6 100644 --- a/engines/titanic/game/head_smash_lever.h +++ b/engines/titanic/game/head_smash_lever.h @@ -39,7 +39,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/head_spinner.cpp b/engines/titanic/game/head_spinner.cpp index a01f4ea1f3..2fb3654c4a 100644 --- a/engines/titanic/game/head_spinner.cpp +++ b/engines/titanic/game/head_spinner.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CHeadSpinner::save(SimpleFile *file, int indent) const { +void CHeadSpinner::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value1, indent); file->writeNumberLine(_value2, indent); diff --git a/engines/titanic/game/head_spinner.h b/engines/titanic/game/head_spinner.h index 3ed3e1f01a..8f1f8c2477 100644 --- a/engines/titanic/game/head_spinner.h +++ b/engines/titanic/game/head_spinner.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/idle_summoner.cpp b/engines/titanic/game/idle_summoner.cpp index 39327266e4..19d760a8db 100644 --- a/engines/titanic/game/idle_summoner.cpp +++ b/engines/titanic/game/idle_summoner.cpp @@ -30,7 +30,7 @@ CIdleSummoner::CIdleSummoner() : CGameObject(), _fieldBC(0x57E40), _fieldD8(0xEA60), _fieldDC(0xEA60) { } -void CIdleSummoner::save(SimpleFile *file, int indent) const { +void CIdleSummoner::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); file->writeNumberLine(_fieldC0, indent); diff --git a/engines/titanic/game/idle_summoner.h b/engines/titanic/game/idle_summoner.h index a983684a15..ccee7bc8fd 100644 --- a/engines/titanic/game/idle_summoner.h +++ b/engines/titanic/game/idle_summoner.h @@ -45,7 +45,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/leave_sec_class_state.cpp b/engines/titanic/game/leave_sec_class_state.cpp index 922bd98c70..014306220c 100644 --- a/engines/titanic/game/leave_sec_class_state.cpp +++ b/engines/titanic/game/leave_sec_class_state.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CLeaveSecClassState, CGameObject) -void CLeaveSecClassState::save(SimpleFile *file, int indent) const { +void CLeaveSecClassState::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/game/leave_sec_class_state.h b/engines/titanic/game/leave_sec_class_state.h index 5f77436ed1..fe55b9439a 100644 --- a/engines/titanic/game/leave_sec_class_state.h +++ b/engines/titanic/game/leave_sec_class_state.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/lemon_dispensor.cpp b/engines/titanic/game/lemon_dispensor.cpp index b13b6d8f0b..8e1674cb2d 100644 --- a/engines/titanic/game/lemon_dispensor.cpp +++ b/engines/titanic/game/lemon_dispensor.cpp @@ -32,7 +32,7 @@ CLemonDispensor::CLemonDispensor() : CBackground(), _fieldE0(0), _fieldE4(9), _fieldE8(15), _fieldEC(0) { } -void CLemonDispensor::save(SimpleFile *file, int indent) const { +void CLemonDispensor::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_v1, indent); file->writeNumberLine(_v2, indent); diff --git a/engines/titanic/game/lemon_dispensor.h b/engines/titanic/game/lemon_dispensor.h index 091c6d7b27..fe5ab529af 100644 --- a/engines/titanic/game/lemon_dispensor.h +++ b/engines/titanic/game/lemon_dispensor.h @@ -44,7 +44,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/light.cpp b/engines/titanic/game/light.cpp index 6b5ff51f28..fd3c446875 100644 --- a/engines/titanic/game/light.cpp +++ b/engines/titanic/game/light.cpp @@ -29,7 +29,7 @@ CLight::CLight() : CBackground(), _fieldE0(0), _fieldE4(0), _fieldF8(0), _fieldFC(0) { } -void CLight::save(SimpleFile *file, int indent) const { +void CLight::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); file->writeNumberLine(_fieldE4, indent); diff --git a/engines/titanic/game/light.h b/engines/titanic/game/light.h index 625e256b5c..b919c5f06c 100644 --- a/engines/titanic/game/light.h +++ b/engines/titanic/game/light.h @@ -46,7 +46,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/light_switch.cpp b/engines/titanic/game/light_switch.cpp index 78a0548f41..3f5c8d2084 100644 --- a/engines/titanic/game/light_switch.cpp +++ b/engines/titanic/game/light_switch.cpp @@ -30,7 +30,7 @@ CLightSwitch::CLightSwitch() : CBackground(), _fieldE0(0), _fieldE4(0), _fieldE8(0) { } -void CLightSwitch::save(SimpleFile *file, int indent) const { +void CLightSwitch::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); file->writeNumberLine(_fieldE4, indent); diff --git a/engines/titanic/game/light_switch.h b/engines/titanic/game/light_switch.h index 80adf81582..c8728e06ff 100644 --- a/engines/titanic/game/light_switch.h +++ b/engines/titanic/game/light_switch.h @@ -43,7 +43,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/little_lift_button.cpp b/engines/titanic/game/little_lift_button.cpp index 3e2fbdd6e8..5005cb1757 100644 --- a/engines/titanic/game/little_lift_button.cpp +++ b/engines/titanic/game/little_lift_button.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CLittleLiftButton::save(SimpleFile *file, int indent) const { +void CLittleLiftButton::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); CBackground::save(file, indent); diff --git a/engines/titanic/game/little_lift_button.h b/engines/titanic/game/little_lift_button.h index 92f084aba1..451c6ced95 100644 --- a/engines/titanic/game/little_lift_button.h +++ b/engines/titanic/game/little_lift_button.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/long_stick_dispenser.cpp b/engines/titanic/game/long_stick_dispenser.cpp index cf1109604f..cb562ec3ca 100644 --- a/engines/titanic/game/long_stick_dispenser.cpp +++ b/engines/titanic/game/long_stick_dispenser.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CLongStickDispenser::save(SimpleFile *file, int indent) const { +void CLongStickDispenser::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); file->writeNumberLine(_fieldC0, indent); diff --git a/engines/titanic/game/long_stick_dispenser.h b/engines/titanic/game/long_stick_dispenser.h index bf5db20e1d..63066866c7 100644 --- a/engines/titanic/game/long_stick_dispenser.h +++ b/engines/titanic/game/long_stick_dispenser.h @@ -42,7 +42,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/maitred/maitred_arm_holder.cpp b/engines/titanic/game/maitred/maitred_arm_holder.cpp index b6fc494441..4d35277a33 100644 --- a/engines/titanic/game/maitred/maitred_arm_holder.cpp +++ b/engines/titanic/game/maitred/maitred_arm_holder.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CMaitreDArmHolder::save(SimpleFile *file, int indent) const { +void CMaitreDArmHolder::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CDropTarget::save(file, indent); } diff --git a/engines/titanic/game/maitred/maitred_arm_holder.h b/engines/titanic/game/maitred/maitred_arm_holder.h index e329157837..c823bd94cf 100644 --- a/engines/titanic/game/maitred/maitred_arm_holder.h +++ b/engines/titanic/game/maitred/maitred_arm_holder.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/maitred/maitred_body.cpp b/engines/titanic/game/maitred/maitred_body.cpp index 4cdd5899de..6b495e5a1c 100644 --- a/engines/titanic/game/maitred/maitred_body.cpp +++ b/engines/titanic/game/maitred/maitred_body.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CMaitreDLegs::save(SimpleFile *file, int indent) const { +void CMaitreDLegs::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldC8, indent); CMaitreDProdReceptor::save(file, indent); diff --git a/engines/titanic/game/maitred/maitred_body.h b/engines/titanic/game/maitred/maitred_body.h index 9dcc2af4ea..52e2ac8fe6 100644 --- a/engines/titanic/game/maitred/maitred_body.h +++ b/engines/titanic/game/maitred/maitred_body.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/maitred/maitred_legs.cpp b/engines/titanic/game/maitred/maitred_legs.cpp index ce7054e057..5071805101 100644 --- a/engines/titanic/game/maitred/maitred_legs.cpp +++ b/engines/titanic/game/maitred/maitred_legs.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CMaitreDBody::save(SimpleFile *file, int indent) const { +void CMaitreDBody::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldC8, indent); CMaitreDProdReceptor::save(file, indent); diff --git a/engines/titanic/game/maitred/maitred_legs.h b/engines/titanic/game/maitred/maitred_legs.h index 0dc1b34143..5ee9482d18 100644 --- a/engines/titanic/game/maitred/maitred_legs.h +++ b/engines/titanic/game/maitred/maitred_legs.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/maitred/maitred_prod_receptor.cpp b/engines/titanic/game/maitred/maitred_prod_receptor.cpp index 6e6143c510..4823f143b0 100644 --- a/engines/titanic/game/maitred/maitred_prod_receptor.cpp +++ b/engines/titanic/game/maitred/maitred_prod_receptor.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CMaitreDProdReceptor::save(SimpleFile *file, int indent) const { +void CMaitreDProdReceptor::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); file->writeNumberLine(_fieldC0, indent); diff --git a/engines/titanic/game/maitred/maitred_prod_receptor.h b/engines/titanic/game/maitred/maitred_prod_receptor.h index b82c95b9b5..5138d46e6e 100644 --- a/engines/titanic/game/maitred/maitred_prod_receptor.h +++ b/engines/titanic/game/maitred/maitred_prod_receptor.h @@ -40,7 +40,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/missiveomat.cpp b/engines/titanic/game/missiveomat.cpp index fbe430fb13..931b146801 100644 --- a/engines/titanic/game/missiveomat.cpp +++ b/engines/titanic/game/missiveomat.cpp @@ -28,7 +28,7 @@ CMissiveOMat::CMissiveOMat() : CGameObject(), _fieldBC(1), _fieldC0(0), _fieldC4(0), _fieldE0(-1) { } -void CMissiveOMat::save(SimpleFile *file, int indent) const { +void CMissiveOMat::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); file->writeNumberLine(_fieldC0, indent); diff --git a/engines/titanic/game/missiveomat.h b/engines/titanic/game/missiveomat.h index a58c928497..1b7850ff3d 100644 --- a/engines/titanic/game/missiveomat.h +++ b/engines/titanic/game/missiveomat.h @@ -42,7 +42,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/missiveomat_button.cpp b/engines/titanic/game/missiveomat_button.cpp index 8f0918a294..d5ae75dbc2 100644 --- a/engines/titanic/game/missiveomat_button.cpp +++ b/engines/titanic/game/missiveomat_button.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CMissiveOMatButton::save(SimpleFile *file, int indent) const { +void CMissiveOMatButton::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldFC, indent); diff --git a/engines/titanic/game/missiveomat_button.h b/engines/titanic/game/missiveomat_button.h index 603d2f5955..eb00b7e2a2 100644 --- a/engines/titanic/game/missiveomat_button.h +++ b/engines/titanic/game/missiveomat_button.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/movie_tester.cpp b/engines/titanic/game/movie_tester.cpp index 0a4f4a9a9c..1b266d9c7e 100644 --- a/engines/titanic/game/movie_tester.cpp +++ b/engines/titanic/game/movie_tester.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CMovieTester::save(SimpleFile *file, int indent) const { +void CMovieTester::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value1, indent); file->writeNumberLine(_value2, indent); diff --git a/engines/titanic/game/movie_tester.h b/engines/titanic/game/movie_tester.h index 2fffd5d2c0..cf39ae3f61 100644 --- a/engines/titanic/game/movie_tester.h +++ b/engines/titanic/game/movie_tester.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/music_console_button.cpp b/engines/titanic/game/music_console_button.cpp index d92dd4d3bb..1bc78ffe23 100644 --- a/engines/titanic/game/music_console_button.cpp +++ b/engines/titanic/game/music_console_button.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CMusicConsoleButton::save(SimpleFile *file, int indent) const { +void CMusicConsoleButton::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CMusicPlayer::save(file, indent); } diff --git a/engines/titanic/game/music_console_button.h b/engines/titanic/game/music_console_button.h index f6c33a91c5..1a1861b36b 100644 --- a/engines/titanic/game/music_console_button.h +++ b/engines/titanic/game/music_console_button.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/music_room_phonograph.cpp b/engines/titanic/game/music_room_phonograph.cpp index c08b23006f..2fceca2e2f 100644 --- a/engines/titanic/game/music_room_phonograph.cpp +++ b/engines/titanic/game/music_room_phonograph.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CMusicRoomPhonograph, CRestaurantPhonograph) -void CMusicRoomPhonograph::save(SimpleFile *file, int indent) const { +void CMusicRoomPhonograph::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_field118, indent); CRestaurantPhonograph::save(file, indent); diff --git a/engines/titanic/game/music_room_phonograph.h b/engines/titanic/game/music_room_phonograph.h index cad59f35b3..dcc7267cde 100644 --- a/engines/titanic/game/music_room_phonograph.h +++ b/engines/titanic/game/music_room_phonograph.h @@ -38,7 +38,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/music_room_stop_phonograph_button.cpp b/engines/titanic/game/music_room_stop_phonograph_button.cpp index 7e00bade35..44342fc2d6 100644 --- a/engines/titanic/game/music_room_stop_phonograph_button.cpp +++ b/engines/titanic/game/music_room_stop_phonograph_button.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CMusicRoomStopPhonographButton::save(SimpleFile *file, int indent) const { +void CMusicRoomStopPhonographButton::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_field100, indent); CEjectPhonographButton::save(file, indent); diff --git a/engines/titanic/game/music_room_stop_phonograph_button.h b/engines/titanic/game/music_room_stop_phonograph_button.h index c37065fde4..81cd755526 100644 --- a/engines/titanic/game/music_room_stop_phonograph_button.h +++ b/engines/titanic/game/music_room_stop_phonograph_button.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/music_system_lock.cpp b/engines/titanic/game/music_system_lock.cpp index 6bd83f6811..f1e062b3ee 100644 --- a/engines/titanic/game/music_system_lock.cpp +++ b/engines/titanic/game/music_system_lock.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CMusicSystemLock::save(SimpleFile *file, int indent) const { +void CMusicSystemLock::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); CDropTarget::save(file, indent); diff --git a/engines/titanic/game/music_system_lock.h b/engines/titanic/game/music_system_lock.h index b5f4da55d6..ad722caccf 100644 --- a/engines/titanic/game/music_system_lock.h +++ b/engines/titanic/game/music_system_lock.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/musical_instrument.cpp b/engines/titanic/game/musical_instrument.cpp index 6480f9f8d1..aea58b4472 100644 --- a/engines/titanic/game/musical_instrument.cpp +++ b/engines/titanic/game/musical_instrument.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CMusicalInstrument, CBackground) -void CMusicalInstrument::save(SimpleFile *file, int indent) const { +void CMusicalInstrument::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CBackground::save(file, indent); } diff --git a/engines/titanic/game/musical_instrument.h b/engines/titanic/game/musical_instrument.h index 5bc7446f13..273770c2e6 100644 --- a/engines/titanic/game/musical_instrument.h +++ b/engines/titanic/game/musical_instrument.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/nav_helmet.cpp b/engines/titanic/game/nav_helmet.cpp index c1dbb115f5..770eb7375e 100644 --- a/engines/titanic/game/nav_helmet.cpp +++ b/engines/titanic/game/nav_helmet.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CNavHelmet::save(SimpleFile *file, int indent) const { +void CNavHelmet::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/game/nav_helmet.h b/engines/titanic/game/nav_helmet.h index ff39280e5b..5e17622b65 100644 --- a/engines/titanic/game/nav_helmet.h +++ b/engines/titanic/game/nav_helmet.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/navigation_computer.cpp b/engines/titanic/game/navigation_computer.cpp index 7e04f848fc..042901c07a 100644 --- a/engines/titanic/game/navigation_computer.cpp +++ b/engines/titanic/game/navigation_computer.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CNavigationComputer, CGameObject) -void CNavigationComputer::save(SimpleFile *file, int indent) const { +void CNavigationComputer::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/game/navigation_computer.h b/engines/titanic/game/navigation_computer.h index 5315c882cf..f24cbada34 100644 --- a/engines/titanic/game/navigation_computer.h +++ b/engines/titanic/game/navigation_computer.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/no_nut_bowl.cpp b/engines/titanic/game/no_nut_bowl.cpp index 354dea3cd8..47f9d7901e 100644 --- a/engines/titanic/game/no_nut_bowl.cpp +++ b/engines/titanic/game/no_nut_bowl.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CNoNutBowl::save(SimpleFile *file, int indent) const { +void CNoNutBowl::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CBackground::save(file, indent); } diff --git a/engines/titanic/game/no_nut_bowl.h b/engines/titanic/game/no_nut_bowl.h index 7557491b68..5cb3aa2c43 100644 --- a/engines/titanic/game/no_nut_bowl.h +++ b/engines/titanic/game/no_nut_bowl.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/nose_holder.cpp b/engines/titanic/game/nose_holder.cpp index ba512d015a..cd9433ee9c 100644 --- a/engines/titanic/game/nose_holder.cpp +++ b/engines/titanic/game/nose_holder.cpp @@ -27,7 +27,7 @@ namespace Titanic { CNoseHolder::CNoseHolder() : CDropTarget(), _field118(0), _field11C(0) { } -void CNoseHolder::save(SimpleFile *file, int indent) const { +void CNoseHolder::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_field11C, indent); diff --git a/engines/titanic/game/nose_holder.h b/engines/titanic/game/nose_holder.h index e26c70fa1d..6e25835465 100644 --- a/engines/titanic/game/nose_holder.h +++ b/engines/titanic/game/nose_holder.h @@ -38,7 +38,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/null_port_hole.cpp b/engines/titanic/game/null_port_hole.cpp index 93dd7eb64e..060e5f04ca 100644 --- a/engines/titanic/game/null_port_hole.cpp +++ b/engines/titanic/game/null_port_hole.cpp @@ -31,7 +31,7 @@ CNullPortHole::CNullPortHole() : CClickResponder() { _string2 = "b#48.wav"; } -void CNullPortHole::save(SimpleFile *file, int indent) const { +void CNullPortHole::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string2, indent); file->writeQuotedLine(_string1, indent); diff --git a/engines/titanic/game/null_port_hole.h b/engines/titanic/game/null_port_hole.h index be335ef47c..3170a84b39 100644 --- a/engines/titanic/game/null_port_hole.h +++ b/engines/titanic/game/null_port_hole.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/nut_replacer.cpp b/engines/titanic/game/nut_replacer.cpp index 36c0510b20..9a73355c91 100644 --- a/engines/titanic/game/nut_replacer.cpp +++ b/engines/titanic/game/nut_replacer.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CNutReplacer::save(SimpleFile *file, int indent) const { +void CNutReplacer::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/game/nut_replacer.h b/engines/titanic/game/nut_replacer.h index 0917b40bd2..6a8e014751 100644 --- a/engines/titanic/game/nut_replacer.h +++ b/engines/titanic/game/nut_replacer.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/parrot/parrot_lobby_controller.cpp b/engines/titanic/game/parrot/parrot_lobby_controller.cpp index 2376cea25c..f1e054a8dd 100644 --- a/engines/titanic/game/parrot/parrot_lobby_controller.cpp +++ b/engines/titanic/game/parrot/parrot_lobby_controller.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CParrotLobbyController::save(SimpleFile *file, int indent) const { +void CParrotLobbyController::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CParrotLobbyObject::save(file, indent); } diff --git a/engines/titanic/game/parrot/parrot_lobby_controller.h b/engines/titanic/game/parrot/parrot_lobby_controller.h index 6515a23944..9f5ddcab75 100644 --- a/engines/titanic/game/parrot/parrot_lobby_controller.h +++ b/engines/titanic/game/parrot/parrot_lobby_controller.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/parrot/parrot_lobby_link_updater.cpp b/engines/titanic/game/parrot/parrot_lobby_link_updater.cpp index e62e9dde48..25d5ec724b 100644 --- a/engines/titanic/game/parrot/parrot_lobby_link_updater.cpp +++ b/engines/titanic/game/parrot/parrot_lobby_link_updater.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CParrotLobbyLinkUpdater::save(SimpleFile *file, int indent) const { +void CParrotLobbyLinkUpdater::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CParrotLobbyObject::save(file, indent); } diff --git a/engines/titanic/game/parrot/parrot_lobby_link_updater.h b/engines/titanic/game/parrot/parrot_lobby_link_updater.h index 2f3ce7bac4..a433f0be84 100644 --- a/engines/titanic/game/parrot/parrot_lobby_link_updater.h +++ b/engines/titanic/game/parrot/parrot_lobby_link_updater.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/parrot/parrot_lobby_object.cpp b/engines/titanic/game/parrot/parrot_lobby_object.cpp index 8090a1d46c..9d556b5b91 100644 --- a/engines/titanic/game/parrot/parrot_lobby_object.cpp +++ b/engines/titanic/game/parrot/parrot_lobby_object.cpp @@ -38,7 +38,7 @@ void CParrotLobbyObject::init() { _v4 = 7; } -void CParrotLobbyObject::save(SimpleFile *file, int indent) const { +void CParrotLobbyObject::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_v1, indent); file->writeNumberLine(_v2, indent); diff --git a/engines/titanic/game/parrot/parrot_lobby_object.h b/engines/titanic/game/parrot/parrot_lobby_object.h index 5b53276eb0..967ad23fd8 100644 --- a/engines/titanic/game/parrot/parrot_lobby_object.h +++ b/engines/titanic/game/parrot/parrot_lobby_object.h @@ -42,7 +42,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/parrot/parrot_lobby_view_object.cpp b/engines/titanic/game/parrot/parrot_lobby_view_object.cpp index 740eac83de..ae398036a8 100644 --- a/engines/titanic/game/parrot/parrot_lobby_view_object.cpp +++ b/engines/titanic/game/parrot/parrot_lobby_view_object.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CParrotLobbyViewObject::save(SimpleFile *file, int indent) const { +void CParrotLobbyViewObject::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); CParrotLobbyObject::save(file, indent); diff --git a/engines/titanic/game/parrot/parrot_lobby_view_object.h b/engines/titanic/game/parrot/parrot_lobby_view_object.h index 1e3e398c2c..656924ff9f 100644 --- a/engines/titanic/game/parrot/parrot_lobby_view_object.h +++ b/engines/titanic/game/parrot/parrot_lobby_view_object.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/parrot/parrot_loser.cpp b/engines/titanic/game/parrot/parrot_loser.cpp index e82506e137..6e23ef8314 100644 --- a/engines/titanic/game/parrot/parrot_loser.cpp +++ b/engines/titanic/game/parrot/parrot_loser.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CParrotLoser::save(SimpleFile *file, int indent) const { +void CParrotLoser::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/game/parrot/parrot_loser.h b/engines/titanic/game/parrot/parrot_loser.h index 806195db19..c1e6c9fddd 100644 --- a/engines/titanic/game/parrot/parrot_loser.h +++ b/engines/titanic/game/parrot/parrot_loser.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp b/engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp index 0917319da0..c83d66cbdf 100644 --- a/engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp +++ b/engines/titanic/game/parrot/parrot_nut_bowl_actor.cpp @@ -28,7 +28,7 @@ CParrotNutBowlActor::CParrotNutBowlActor() : CGameObject(), _value1(0), _value2(0) { } -void CParrotNutBowlActor::save(SimpleFile *file, int indent) const { +void CParrotNutBowlActor::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value1, indent); file->writeNumberLine(_value2, indent); diff --git a/engines/titanic/game/parrot/parrot_nut_bowl_actor.h b/engines/titanic/game/parrot/parrot_nut_bowl_actor.h index d1ccca6a71..34be83a918 100644 --- a/engines/titanic/game/parrot/parrot_nut_bowl_actor.h +++ b/engines/titanic/game/parrot/parrot_nut_bowl_actor.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/parrot/parrot_nut_eater.cpp b/engines/titanic/game/parrot/parrot_nut_eater.cpp index 9d58632c89..309b379ab8 100644 --- a/engines/titanic/game/parrot/parrot_nut_eater.cpp +++ b/engines/titanic/game/parrot/parrot_nut_eater.cpp @@ -28,7 +28,7 @@ CParrotNutEater::CParrotNutEater() : CGameObject(), _fieldBC(0), _fieldC0(69), _fieldC4(132), _fieldC8(0), _fieldCC(68) { } -void CParrotNutEater::save(SimpleFile *file, int indent) const { +void CParrotNutEater::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); diff --git a/engines/titanic/game/parrot/parrot_nut_eater.h b/engines/titanic/game/parrot/parrot_nut_eater.h index 6a7afd94cf..fe0a3aeb0f 100644 --- a/engines/titanic/game/parrot/parrot_nut_eater.h +++ b/engines/titanic/game/parrot/parrot_nut_eater.h @@ -41,7 +41,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/parrot/parrot_perch_holder.cpp b/engines/titanic/game/parrot/parrot_perch_holder.cpp index 00dfe4a1c9..dd8523990b 100644 --- a/engines/titanic/game/parrot/parrot_perch_holder.cpp +++ b/engines/titanic/game/parrot/parrot_perch_holder.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CParrotPerchHolder::save(SimpleFile *file, int indent) const { +void CParrotPerchHolder::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CMultiDropTarget::save(file, indent); } diff --git a/engines/titanic/game/parrot/parrot_perch_holder.h b/engines/titanic/game/parrot/parrot_perch_holder.h index f355263846..8c7a441001 100644 --- a/engines/titanic/game/parrot/parrot_perch_holder.h +++ b/engines/titanic/game/parrot/parrot_perch_holder.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/parrot/parrot_succubus.cpp b/engines/titanic/game/parrot/parrot_succubus.cpp index e29c6a6781..02a29b748e 100644 --- a/engines/titanic/game/parrot/parrot_succubus.cpp +++ b/engines/titanic/game/parrot/parrot_succubus.cpp @@ -28,7 +28,7 @@ CParrotSuccUBus::CParrotSuccUBus() : CSuccUBus(), _field1DC(0), _field1EC(0), _field1F0(376), _field1F4(393) { } -void CParrotSuccUBus::save(SimpleFile *file, int indent) const { +void CParrotSuccUBus::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_field1DC, indent); file->writeQuotedLine(_string3, indent); diff --git a/engines/titanic/game/parrot/parrot_succubus.h b/engines/titanic/game/parrot/parrot_succubus.h index e60d35cd6c..7984cc6a8c 100644 --- a/engines/titanic/game/parrot/parrot_succubus.h +++ b/engines/titanic/game/parrot/parrot_succubus.h @@ -41,7 +41,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/parrot/parrot_trigger.cpp b/engines/titanic/game/parrot/parrot_trigger.cpp index aeab3c1ea7..36e99ada33 100644 --- a/engines/titanic/game/parrot/parrot_trigger.cpp +++ b/engines/titanic/game/parrot/parrot_trigger.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CParrotTrigger::save(SimpleFile *file, int indent) const { +void CParrotTrigger::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/game/parrot/parrot_trigger.h b/engines/titanic/game/parrot/parrot_trigger.h index 33aea157ad..f2d1d7e904 100644 --- a/engines/titanic/game/parrot/parrot_trigger.h +++ b/engines/titanic/game/parrot/parrot_trigger.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/parrot/player_meets_parrot.cpp b/engines/titanic/game/parrot/player_meets_parrot.cpp index 15dd29009a..6db9345bc0 100644 --- a/engines/titanic/game/parrot/player_meets_parrot.cpp +++ b/engines/titanic/game/parrot/player_meets_parrot.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CPlayerMeetsParrot::save(SimpleFile *file, int indent) const { +void CPlayerMeetsParrot::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/game/parrot/player_meets_parrot.h b/engines/titanic/game/parrot/player_meets_parrot.h index 53fa63a95c..0a720993a5 100644 --- a/engines/titanic/game/parrot/player_meets_parrot.h +++ b/engines/titanic/game/parrot/player_meets_parrot.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/pet/pet.cpp b/engines/titanic/game/pet/pet.cpp index 3e65755989..cd4e16d38c 100644 --- a/engines/titanic/game/pet/pet.cpp +++ b/engines/titanic/game/pet/pet.cpp @@ -28,7 +28,7 @@ CPET::CPET() : CGameObject(), _fieldBC(0), _fieldC0(3), _fieldC4(0), _fieldC8(0), _fieldD8(0), _fieldDC(0) { } -void CPET::save(SimpleFile *file, int indent) const { +void CPET::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); file->writeNumberLine(_fieldC0, indent); diff --git a/engines/titanic/game/pet/pet.h b/engines/titanic/game/pet/pet.h index 58e3577235..de62294994 100644 --- a/engines/titanic/game/pet/pet.h +++ b/engines/titanic/game/pet/pet.h @@ -43,7 +43,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/pet/pet_class1.cpp b/engines/titanic/game/pet/pet_class1.cpp index b0407ef6e5..096977e26f 100644 --- a/engines/titanic/game/pet/pet_class1.cpp +++ b/engines/titanic/game/pet/pet_class1.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CPETClass1, CGameObject) -void CPETClass1::save(SimpleFile *file, int indent) const { +void CPETClass1::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/game/pet/pet_class1.h b/engines/titanic/game/pet/pet_class1.h index e22b2148b5..aeb01adc7c 100644 --- a/engines/titanic/game/pet/pet_class1.h +++ b/engines/titanic/game/pet/pet_class1.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/pet/pet_class2.cpp b/engines/titanic/game/pet/pet_class2.cpp index 8809f84214..d13ed66fbd 100644 --- a/engines/titanic/game/pet/pet_class2.cpp +++ b/engines/titanic/game/pet/pet_class2.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CPETClass2, CGameObject) -void CPETClass2::save(SimpleFile *file, int indent) const { +void CPETClass2::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/game/pet/pet_class2.h b/engines/titanic/game/pet/pet_class2.h index 529f9534e2..aa85397385 100644 --- a/engines/titanic/game/pet/pet_class2.h +++ b/engines/titanic/game/pet/pet_class2.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/pet/pet_class3.cpp b/engines/titanic/game/pet/pet_class3.cpp index 81ddf8adf8..0c0adf2090 100644 --- a/engines/titanic/game/pet/pet_class3.cpp +++ b/engines/titanic/game/pet/pet_class3.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CPETClass3, CGameObject) -void CPETClass3::save(SimpleFile *file, int indent) const { +void CPETClass3::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/game/pet/pet_class3.h b/engines/titanic/game/pet/pet_class3.h index d34c9d335e..733186a096 100644 --- a/engines/titanic/game/pet/pet_class3.h +++ b/engines/titanic/game/pet/pet_class3.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/pet/pet_lift.cpp b/engines/titanic/game/pet/pet_lift.cpp index 8a16c678d5..39b0d01540 100644 --- a/engines/titanic/game/pet/pet_lift.cpp +++ b/engines/titanic/game/pet/pet_lift.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CPETLift::save(SimpleFile *file, int indent) const { +void CPETLift::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CPETTransport::save(file, indent); } diff --git a/engines/titanic/game/pet/pet_lift.h b/engines/titanic/game/pet/pet_lift.h index 1c56b0515a..9bdf5313d0 100644 --- a/engines/titanic/game/pet/pet_lift.h +++ b/engines/titanic/game/pet/pet_lift.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/pet/pet_monitor.cpp b/engines/titanic/game/pet/pet_monitor.cpp index ebbddd8587..6a0d207a55 100644 --- a/engines/titanic/game/pet/pet_monitor.cpp +++ b/engines/titanic/game/pet/pet_monitor.cpp @@ -28,7 +28,7 @@ BEGIN_MESSAGE_MAP(CPETMonitor, CGameObject) ON_MESSAGE(EnterRoomMsg) END_MESSAGE_MAP() -void CPETMonitor::save(SimpleFile *file, int indent) const { +void CPETMonitor::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/game/pet/pet_monitor.h b/engines/titanic/game/pet/pet_monitor.h index a53f360ed1..140c17b825 100644 --- a/engines/titanic/game/pet/pet_monitor.h +++ b/engines/titanic/game/pet/pet_monitor.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/pet/pet_pellerator.cpp b/engines/titanic/game/pet/pet_pellerator.cpp index bcddc75919..a29942ca59 100644 --- a/engines/titanic/game/pet/pet_pellerator.cpp +++ b/engines/titanic/game/pet/pet_pellerator.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CPETPellerator::save(SimpleFile *file, int indent) const { +void CPETPellerator::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CPETTransport::save(file, indent); } diff --git a/engines/titanic/game/pet/pet_pellerator.h b/engines/titanic/game/pet/pet_pellerator.h index 1036c93c66..31b44e337b 100644 --- a/engines/titanic/game/pet/pet_pellerator.h +++ b/engines/titanic/game/pet/pet_pellerator.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/pet/pet_position.cpp b/engines/titanic/game/pet/pet_position.cpp index 66e8e36231..9f58093ccc 100644 --- a/engines/titanic/game/pet/pet_position.cpp +++ b/engines/titanic/game/pet/pet_position.cpp @@ -28,7 +28,7 @@ BEGIN_MESSAGE_MAP(CPETPosition, CGameObject) ON_MESSAGE(EnterRoomMsg) END_MESSAGE_MAP() -void CPETPosition::save(SimpleFile *file, int indent) const { +void CPETPosition::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/game/pet/pet_position.h b/engines/titanic/game/pet/pet_position.h index f4f0fd5299..63c0bf215f 100644 --- a/engines/titanic/game/pet/pet_position.h +++ b/engines/titanic/game/pet/pet_position.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/pet/pet_sentinal.cpp b/engines/titanic/game/pet/pet_sentinal.cpp index 4ced872b00..1b647d7c62 100644 --- a/engines/titanic/game/pet/pet_sentinal.cpp +++ b/engines/titanic/game/pet/pet_sentinal.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CPETSentinal::save(SimpleFile *file, int indent) const { +void CPETSentinal::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/game/pet/pet_sentinal.h b/engines/titanic/game/pet/pet_sentinal.h index 728ddbfe57..8b1e992ebf 100644 --- a/engines/titanic/game/pet/pet_sentinal.h +++ b/engines/titanic/game/pet/pet_sentinal.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/pet/pet_sounds.cpp b/engines/titanic/game/pet/pet_sounds.cpp index abf6ba3264..d612c745bb 100644 --- a/engines/titanic/game/pet/pet_sounds.cpp +++ b/engines/titanic/game/pet/pet_sounds.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CPETSounds::save(SimpleFile *file, int indent) const { +void CPETSounds::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/game/pet/pet_sounds.h b/engines/titanic/game/pet/pet_sounds.h index f099d9efb5..3513da5535 100644 --- a/engines/titanic/game/pet/pet_sounds.h +++ b/engines/titanic/game/pet/pet_sounds.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/pet/pet_transition.cpp b/engines/titanic/game/pet/pet_transition.cpp index fed2d2c63a..33cc36ca11 100644 --- a/engines/titanic/game/pet/pet_transition.cpp +++ b/engines/titanic/game/pet/pet_transition.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CPETTransition::save(SimpleFile *file, int indent) const { +void CPETTransition::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/game/pet/pet_transition.h b/engines/titanic/game/pet/pet_transition.h index c8dc153d53..9e4a62875d 100644 --- a/engines/titanic/game/pet/pet_transition.h +++ b/engines/titanic/game/pet/pet_transition.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/pet/pet_transport.cpp b/engines/titanic/game/pet/pet_transport.cpp index bcbf319fd0..9661cace2c 100644 --- a/engines/titanic/game/pet/pet_transport.cpp +++ b/engines/titanic/game/pet/pet_transport.cpp @@ -28,7 +28,7 @@ BEGIN_MESSAGE_MAP(CPETTransport, CGameObject) ON_MESSAGE(EnterRoomMsg) END_MESSAGE_MAP() -void CPETTransport::save(SimpleFile *file, int indent) const { +void CPETTransport::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/game/pet/pet_transport.h b/engines/titanic/game/pet/pet_transport.h index 052fd7bda0..e580ab8616 100644 --- a/engines/titanic/game/pet/pet_transport.h +++ b/engines/titanic/game/pet/pet_transport.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/pet_disabler.cpp b/engines/titanic/game/pet_disabler.cpp index 94a4964ed2..2275156503 100644 --- a/engines/titanic/game/pet_disabler.cpp +++ b/engines/titanic/game/pet_disabler.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CPetDisabler::save(SimpleFile *file, int indent) const { +void CPetDisabler::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_value, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/game/pet_disabler.h b/engines/titanic/game/pet_disabler.h index 5db5d7b533..5928d44921 100644 --- a/engines/titanic/game/pet_disabler.h +++ b/engines/titanic/game/pet_disabler.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/phonograph.cpp b/engines/titanic/game/phonograph.cpp index f086376651..9740e29273 100644 --- a/engines/titanic/game/phonograph.cpp +++ b/engines/titanic/game/phonograph.cpp @@ -29,7 +29,7 @@ CPhonograph::CPhonograph() : CMusicPlayer(), _fieldF0(0), _fieldF4(0) { } -void CPhonograph::save(SimpleFile *file, int indent) const { +void CPhonograph::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string2, indent); file->writeNumberLine(_fieldE0, indent); diff --git a/engines/titanic/game/phonograph.h b/engines/titanic/game/phonograph.h index c5f5a90c9c..e0f407b251 100644 --- a/engines/titanic/game/phonograph.h +++ b/engines/titanic/game/phonograph.h @@ -45,7 +45,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/phonograph_lid.cpp b/engines/titanic/game/phonograph_lid.cpp index a228af8c70..a0518420f7 100644 --- a/engines/titanic/game/phonograph_lid.cpp +++ b/engines/titanic/game/phonograph_lid.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CPhonographLid::save(SimpleFile *file, int indent) const { +void CPhonographLid::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/game/phonograph_lid.h b/engines/titanic/game/phonograph_lid.h index 38c8924885..486a9b4b84 100644 --- a/engines/titanic/game/phonograph_lid.h +++ b/engines/titanic/game/phonograph_lid.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/pickup/pick_up.cpp b/engines/titanic/game/pickup/pick_up.cpp index 58ffc5ad09..c660a36a32 100644 --- a/engines/titanic/game/pickup/pick_up.cpp +++ b/engines/titanic/game/pickup/pick_up.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CPickUp::save(SimpleFile *file, int indent) const { +void CPickUp::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/game/pickup/pick_up.h b/engines/titanic/game/pickup/pick_up.h index d5a858017d..76537d1e74 100644 --- a/engines/titanic/game/pickup/pick_up.h +++ b/engines/titanic/game/pickup/pick_up.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/pickup/pick_up_bar_glass.cpp b/engines/titanic/game/pickup/pick_up_bar_glass.cpp index 1d475c2a85..85b883281e 100644 --- a/engines/titanic/game/pickup/pick_up_bar_glass.cpp +++ b/engines/titanic/game/pickup/pick_up_bar_glass.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CPickUpBarGlass::save(SimpleFile *file, int indent) const { +void CPickUpBarGlass::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CPickUp::save(file, indent); } diff --git a/engines/titanic/game/pickup/pick_up_bar_glass.h b/engines/titanic/game/pickup/pick_up_bar_glass.h index f1c75555ad..f9bcb00192 100644 --- a/engines/titanic/game/pickup/pick_up_bar_glass.h +++ b/engines/titanic/game/pickup/pick_up_bar_glass.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/pickup/pick_up_hose.cpp b/engines/titanic/game/pickup/pick_up_hose.cpp index e6902cb6b3..7375ddaa63 100644 --- a/engines/titanic/game/pickup/pick_up_hose.cpp +++ b/engines/titanic/game/pickup/pick_up_hose.cpp @@ -26,7 +26,7 @@ namespace Titanic { int CPickUpHose::_v1; -void CPickUpHose::save(SimpleFile *file, int indent) const { +void CPickUpHose::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string1, indent); file->writeNumberLine(_v1, indent); diff --git a/engines/titanic/game/pickup/pick_up_hose.h b/engines/titanic/game/pickup/pick_up_hose.h index 9014934ba1..68bec367d4 100644 --- a/engines/titanic/game/pickup/pick_up_hose.h +++ b/engines/titanic/game/pickup/pick_up_hose.h @@ -38,7 +38,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/pickup/pick_up_lemon.cpp b/engines/titanic/game/pickup/pick_up_lemon.cpp index 7364fee299..772114f76c 100644 --- a/engines/titanic/game/pickup/pick_up_lemon.cpp +++ b/engines/titanic/game/pickup/pick_up_lemon.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CPickUpLemon::save(SimpleFile *file, int indent) const { +void CPickUpLemon::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CPickUp::save(file, indent); } diff --git a/engines/titanic/game/pickup/pick_up_lemon.h b/engines/titanic/game/pickup/pick_up_lemon.h index dc2942f366..9bed9ceb73 100644 --- a/engines/titanic/game/pickup/pick_up_lemon.h +++ b/engines/titanic/game/pickup/pick_up_lemon.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/pickup/pick_up_speech_centre.cpp b/engines/titanic/game/pickup/pick_up_speech_centre.cpp index 74c473943e..0b9a8d2c48 100644 --- a/engines/titanic/game/pickup/pick_up_speech_centre.cpp +++ b/engines/titanic/game/pickup/pick_up_speech_centre.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CPickUpSpeechCentre::save(SimpleFile *file, int indent) const { +void CPickUpSpeechCentre::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CPickUp::save(file, indent); } diff --git a/engines/titanic/game/pickup/pick_up_speech_centre.h b/engines/titanic/game/pickup/pick_up_speech_centre.h index 5d7d133ccc..a74566b4d5 100644 --- a/engines/titanic/game/pickup/pick_up_speech_centre.h +++ b/engines/titanic/game/pickup/pick_up_speech_centre.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/pickup/pick_up_vis_centre.cpp b/engines/titanic/game/pickup/pick_up_vis_centre.cpp index 8fda66fe3d..796e46778c 100644 --- a/engines/titanic/game/pickup/pick_up_vis_centre.cpp +++ b/engines/titanic/game/pickup/pick_up_vis_centre.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CPickUpVisCentre::save(SimpleFile *file, int indent) const { +void CPickUpVisCentre::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CPickUp::save(file, indent); } diff --git a/engines/titanic/game/pickup/pick_up_vis_centre.h b/engines/titanic/game/pickup/pick_up_vis_centre.h index 4345fceda9..059c4f85b0 100644 --- a/engines/titanic/game/pickup/pick_up_vis_centre.h +++ b/engines/titanic/game/pickup/pick_up_vis_centre.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp b/engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp index f3eda053f1..a8a33fe1b1 100644 --- a/engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp +++ b/engines/titanic/game/placeholder/bar_shelf_vis_centre.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CBarShelfVisCentre::save(SimpleFile *file, int indent) const { +void CBarShelfVisCentre::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); CPlaceHolderItem::save(file, indent); diff --git a/engines/titanic/game/placeholder/bar_shelf_vis_centre.h b/engines/titanic/game/placeholder/bar_shelf_vis_centre.h index a5acff6a47..7cb4478d8a 100644 --- a/engines/titanic/game/placeholder/bar_shelf_vis_centre.h +++ b/engines/titanic/game/placeholder/bar_shelf_vis_centre.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/placeholder/lemon_on_bar.cpp b/engines/titanic/game/placeholder/lemon_on_bar.cpp index d51f4b8758..08d686e81a 100644 --- a/engines/titanic/game/placeholder/lemon_on_bar.cpp +++ b/engines/titanic/game/placeholder/lemon_on_bar.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CLemonOnBar::save(SimpleFile *file, int indent) const { +void CLemonOnBar::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writePoint(_pos1, indent); CPlaceHolderItem::save(file, indent); diff --git a/engines/titanic/game/placeholder/lemon_on_bar.h b/engines/titanic/game/placeholder/lemon_on_bar.h index d1654bfeb9..030481e9ea 100644 --- a/engines/titanic/game/placeholder/lemon_on_bar.h +++ b/engines/titanic/game/placeholder/lemon_on_bar.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/placeholder/place_holder_item.cpp b/engines/titanic/game/placeholder/place_holder_item.cpp index a3c26c8b7f..365e8cbe50 100644 --- a/engines/titanic/game/placeholder/place_holder_item.cpp +++ b/engines/titanic/game/placeholder/place_holder_item.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CPlaceHolderItem::save(SimpleFile *file, int indent) const { +void CPlaceHolderItem::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/game/placeholder/place_holder_item.h b/engines/titanic/game/placeholder/place_holder_item.h index c665e0f626..72f49c0a8a 100644 --- a/engines/titanic/game/placeholder/place_holder_item.h +++ b/engines/titanic/game/placeholder/place_holder_item.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/placeholder/tv_on_bar.cpp b/engines/titanic/game/placeholder/tv_on_bar.cpp index 3b97658a86..efbbe50461 100644 --- a/engines/titanic/game/placeholder/tv_on_bar.cpp +++ b/engines/titanic/game/placeholder/tv_on_bar.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CTVOnBar::save(SimpleFile *file, int indent) const { +void CTVOnBar::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writePoint(_pos1, indent); CPlaceHolderItem::save(file, indent); diff --git a/engines/titanic/game/placeholder/tv_on_bar.h b/engines/titanic/game/placeholder/tv_on_bar.h index 2cc5494464..ffe8109a9b 100644 --- a/engines/titanic/game/placeholder/tv_on_bar.h +++ b/engines/titanic/game/placeholder/tv_on_bar.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/play_music_button.cpp b/engines/titanic/game/play_music_button.cpp index 49e128cb66..8066739f10 100644 --- a/engines/titanic/game/play_music_button.cpp +++ b/engines/titanic/game/play_music_button.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CPlayMusicButton::save(SimpleFile *file, int indent) const { +void CPlayMusicButton::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); file->writeNumberLine(_fieldE4, indent); diff --git a/engines/titanic/game/play_music_button.h b/engines/titanic/game/play_music_button.h index 9e0bb464b3..8ae32dc8c2 100644 --- a/engines/titanic/game/play_music_button.h +++ b/engines/titanic/game/play_music_button.h @@ -38,7 +38,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/play_on_act.cpp b/engines/titanic/game/play_on_act.cpp index b0236cda5a..e1ef1201c6 100644 --- a/engines/titanic/game/play_on_act.cpp +++ b/engines/titanic/game/play_on_act.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CPlayOnAct::save(SimpleFile *file, int indent) const { +void CPlayOnAct::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CBackground::save(file, indent); } diff --git a/engines/titanic/game/play_on_act.h b/engines/titanic/game/play_on_act.h index 22bb54de6a..bd6060077a 100644 --- a/engines/titanic/game/play_on_act.h +++ b/engines/titanic/game/play_on_act.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/port_hole.cpp b/engines/titanic/game/port_hole.cpp index 556473263b..f3c447f443 100644 --- a/engines/titanic/game/port_hole.cpp +++ b/engines/titanic/game/port_hole.cpp @@ -28,7 +28,7 @@ CPortHole::CPortHole() : CGameObject(), _fieldBC(0), _string1("b#47.wav"), _string2("b#46.wav") { } -void CPortHole::save(SimpleFile *file, int indent) const { +void CPortHole::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); file->writeQuotedLine(_string1, indent); diff --git a/engines/titanic/game/port_hole.h b/engines/titanic/game/port_hole.h index 2672614d68..4e952cc369 100644 --- a/engines/titanic/game/port_hole.h +++ b/engines/titanic/game/port_hole.h @@ -38,7 +38,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/record_phonograph_button.cpp b/engines/titanic/game/record_phonograph_button.cpp index 896e9d2be6..f022957dbb 100644 --- a/engines/titanic/game/record_phonograph_button.cpp +++ b/engines/titanic/game/record_phonograph_button.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CRecordPhonographButton::save(SimpleFile *file, int indent) const { +void CRecordPhonographButton::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); CBackground::save(file, indent); diff --git a/engines/titanic/game/record_phonograph_button.h b/engines/titanic/game/record_phonograph_button.h index 3ae7fb1dea..9750b7d42e 100644 --- a/engines/titanic/game/record_phonograph_button.h +++ b/engines/titanic/game/record_phonograph_button.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/replacement_ear.cpp b/engines/titanic/game/replacement_ear.cpp index 4926932c17..1f9960365d 100644 --- a/engines/titanic/game/replacement_ear.cpp +++ b/engines/titanic/game/replacement_ear.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CReplacementEar::save(SimpleFile *file, int indent) const { +void CReplacementEar::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CBackground::save(file, indent); } diff --git a/engines/titanic/game/replacement_ear.h b/engines/titanic/game/replacement_ear.h index 0cff55d684..59d291f231 100644 --- a/engines/titanic/game/replacement_ear.h +++ b/engines/titanic/game/replacement_ear.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/reserved_table.cpp b/engines/titanic/game/reserved_table.cpp index 222712ac1c..a600190709 100644 --- a/engines/titanic/game/reserved_table.cpp +++ b/engines/titanic/game/reserved_table.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CReservedTable::save(SimpleFile *file, int indent) const { +void CReservedTable::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value1, indent); file->writeNumberLine(_value2, indent); diff --git a/engines/titanic/game/reserved_table.h b/engines/titanic/game/reserved_table.h index 49cd5e8e39..a0927fafe1 100644 --- a/engines/titanic/game/reserved_table.h +++ b/engines/titanic/game/reserved_table.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/restaurant_cylinder_holder.cpp b/engines/titanic/game/restaurant_cylinder_holder.cpp index 1662064d17..d70009f151 100644 --- a/engines/titanic/game/restaurant_cylinder_holder.cpp +++ b/engines/titanic/game/restaurant_cylinder_holder.cpp @@ -29,7 +29,7 @@ CRestaurantCylinderHolder::CRestaurantCylinderHolder() : CDropTarget(), _string6("z#61.wav"), _field140(1) { } -void CRestaurantCylinderHolder::save(SimpleFile *file, int indent) const { +void CRestaurantCylinderHolder::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_field118, indent); file->writeNumberLine(_field11C, indent); diff --git a/engines/titanic/game/restaurant_cylinder_holder.h b/engines/titanic/game/restaurant_cylinder_holder.h index 9f3911d850..d679dd1aa3 100644 --- a/engines/titanic/game/restaurant_cylinder_holder.h +++ b/engines/titanic/game/restaurant_cylinder_holder.h @@ -43,7 +43,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/restaurant_phonograph.cpp b/engines/titanic/game/restaurant_phonograph.cpp index c73bd51d34..83a4ac3e71 100644 --- a/engines/titanic/game/restaurant_phonograph.cpp +++ b/engines/titanic/game/restaurant_phonograph.cpp @@ -27,7 +27,7 @@ namespace Titanic { CRestaurantPhonograph::CRestaurantPhonograph() : CPhonograph(), _fieldF8(1), _field114(0) {} -void CRestaurantPhonograph::save(SimpleFile *file, int indent) const { +void CRestaurantPhonograph::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldF8, indent); file->writeQuotedLine(_string2, indent); diff --git a/engines/titanic/game/restaurant_phonograph.h b/engines/titanic/game/restaurant_phonograph.h index 40116f5d07..62434977be 100644 --- a/engines/titanic/game/restaurant_phonograph.h +++ b/engines/titanic/game/restaurant_phonograph.h @@ -40,7 +40,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/sauce_dispensor.cpp b/engines/titanic/game/sauce_dispensor.cpp index 6365f6e57b..8dc818d917 100644 --- a/engines/titanic/game/sauce_dispensor.cpp +++ b/engines/titanic/game/sauce_dispensor.cpp @@ -28,7 +28,7 @@ CSauceDispensor::CSauceDispensor() : CBackground(), _fieldEC(0), _fieldF0(0), _field104(0), _field108(0) { } -void CSauceDispensor::save(SimpleFile *file, int indent) const { +void CSauceDispensor::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string3, indent); file->writeNumberLine(_fieldEC, indent); diff --git a/engines/titanic/game/sauce_dispensor.h b/engines/titanic/game/sauce_dispensor.h index 8a5cc96eca..f87420b489 100644 --- a/engines/titanic/game/sauce_dispensor.h +++ b/engines/titanic/game/sauce_dispensor.h @@ -43,7 +43,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/search_point.cpp b/engines/titanic/game/search_point.cpp index c235e4765a..f60a3132b7 100644 --- a/engines/titanic/game/search_point.cpp +++ b/engines/titanic/game/search_point.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CSearchPoint::save(SimpleFile *file, int indent) const { +void CSearchPoint::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/game/search_point.h b/engines/titanic/game/search_point.h index 7bd05d8d1e..057bb4d2aa 100644 --- a/engines/titanic/game/search_point.h +++ b/engines/titanic/game/search_point.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/season_background.cpp b/engines/titanic/game/season_background.cpp index a4de590ecd..1c63f3d892 100644 --- a/engines/titanic/game/season_background.cpp +++ b/engines/titanic/game/season_background.cpp @@ -28,7 +28,7 @@ CSeasonBackground::CSeasonBackground() : CBackground(), _fieldE0(0), _fieldE4(0), _fieldE8(46), _fieldEC(0) { } -void CSeasonBackground::save(SimpleFile *file, int indent) const { +void CSeasonBackground::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); file->writeNumberLine(_fieldE4, indent); diff --git a/engines/titanic/game/season_background.h b/engines/titanic/game/season_background.h index 709f1002c3..c89e6a6ba4 100644 --- a/engines/titanic/game/season_background.h +++ b/engines/titanic/game/season_background.h @@ -40,7 +40,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/season_barrel.cpp b/engines/titanic/game/season_barrel.cpp index 8aa7b22033..9594396885 100644 --- a/engines/titanic/game/season_barrel.cpp +++ b/engines/titanic/game/season_barrel.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CSeasonBarrel::save(SimpleFile *file, int indent) const { +void CSeasonBarrel::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); file->writeNumberLine(_fieldE4, indent); diff --git a/engines/titanic/game/season_barrel.h b/engines/titanic/game/season_barrel.h index d3f7b1a91e..145dfa02b2 100644 --- a/engines/titanic/game/season_barrel.h +++ b/engines/titanic/game/season_barrel.h @@ -38,7 +38,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/seasonal_adjustment.cpp b/engines/titanic/game/seasonal_adjustment.cpp index c0c7b2f1b4..33a0ae89c5 100644 --- a/engines/titanic/game/seasonal_adjustment.cpp +++ b/engines/titanic/game/seasonal_adjustment.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CSeasonalAdjustment::save(SimpleFile *file, int indent) const { +void CSeasonalAdjustment::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); file->writeNumberLine(_fieldE4, indent); diff --git a/engines/titanic/game/seasonal_adjustment.h b/engines/titanic/game/seasonal_adjustment.h index 4bfec1a47a..4f251ad764 100644 --- a/engines/titanic/game/seasonal_adjustment.h +++ b/engines/titanic/game/seasonal_adjustment.h @@ -38,7 +38,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/service_elevator_window.cpp b/engines/titanic/game/service_elevator_window.cpp index 1371fb7c48..95b2735b37 100644 --- a/engines/titanic/game/service_elevator_window.cpp +++ b/engines/titanic/game/service_elevator_window.cpp @@ -28,7 +28,7 @@ CServiceElevatorWindow::CServiceElevatorWindow() : CBackground(), _fieldE0(0), _fieldE4(0), _fieldE8(0), _fieldEC(0) { } -void CServiceElevatorWindow::save(SimpleFile *file, int indent) const { +void CServiceElevatorWindow::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); file->writeNumberLine(_fieldE4, indent); diff --git a/engines/titanic/game/service_elevator_window.h b/engines/titanic/game/service_elevator_window.h index 70c38753b2..08150238cc 100644 --- a/engines/titanic/game/service_elevator_window.h +++ b/engines/titanic/game/service_elevator_window.h @@ -40,7 +40,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/sgt/armchair.cpp b/engines/titanic/game/sgt/armchair.cpp index 3491452a8d..4c4ef44199 100644 --- a/engines/titanic/game/sgt/armchair.cpp +++ b/engines/titanic/game/sgt/armchair.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CArmchair::save(SimpleFile *file, int indent) const { +void CArmchair::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CSGTStateRoom::save(file, indent); } diff --git a/engines/titanic/game/sgt/armchair.h b/engines/titanic/game/sgt/armchair.h index 1ce6955c58..5dfd94d095 100644 --- a/engines/titanic/game/sgt/armchair.h +++ b/engines/titanic/game/sgt/armchair.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/sgt/basin.cpp b/engines/titanic/game/sgt/basin.cpp index 75c53bce72..1eb1d161c9 100644 --- a/engines/titanic/game/sgt/basin.cpp +++ b/engines/titanic/game/sgt/basin.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CBasin::save(SimpleFile *file, int indent) const { +void CBasin::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CSGTStateRoom::save(file, indent); } diff --git a/engines/titanic/game/sgt/basin.h b/engines/titanic/game/sgt/basin.h index cc9739fd1d..950bdb8241 100644 --- a/engines/titanic/game/sgt/basin.h +++ b/engines/titanic/game/sgt/basin.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/sgt/bedfoot.cpp b/engines/titanic/game/sgt/bedfoot.cpp index b039f8a9d8..18ea07aca0 100644 --- a/engines/titanic/game/sgt/bedfoot.cpp +++ b/engines/titanic/game/sgt/bedfoot.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CBedfoot::save(SimpleFile *file, int indent) const { +void CBedfoot::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CSGTStateRoom::save(file, indent); } diff --git a/engines/titanic/game/sgt/bedfoot.h b/engines/titanic/game/sgt/bedfoot.h index 55be4fdadd..db1e1dd031 100644 --- a/engines/titanic/game/sgt/bedfoot.h +++ b/engines/titanic/game/sgt/bedfoot.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/sgt/bedhead.cpp b/engines/titanic/game/sgt/bedhead.cpp index 758c1ffe37..fad7272f3a 100644 --- a/engines/titanic/game/sgt/bedhead.cpp +++ b/engines/titanic/game/sgt/bedhead.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CBedhead::save(SimpleFile *file, int indent) const { +void CBedhead::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CSGTStateRoom::save(file, indent); } diff --git a/engines/titanic/game/sgt/bedhead.h b/engines/titanic/game/sgt/bedhead.h index 317b7eb2a3..b938dcd795 100644 --- a/engines/titanic/game/sgt/bedhead.h +++ b/engines/titanic/game/sgt/bedhead.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/sgt/chest_of_drawers.cpp b/engines/titanic/game/sgt/chest_of_drawers.cpp index 5ec98e8d5a..be62e12c8e 100644 --- a/engines/titanic/game/sgt/chest_of_drawers.cpp +++ b/engines/titanic/game/sgt/chest_of_drawers.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CChestOfDrawers::save(SimpleFile *file, int indent) const { +void CChestOfDrawers::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CSGTStateRoom::save(file, indent); } diff --git a/engines/titanic/game/sgt/chest_of_drawers.h b/engines/titanic/game/sgt/chest_of_drawers.h index e0bdd7579e..5b72f3eef3 100644 --- a/engines/titanic/game/sgt/chest_of_drawers.h +++ b/engines/titanic/game/sgt/chest_of_drawers.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/sgt/desk.cpp b/engines/titanic/game/sgt/desk.cpp index ea00c24f46..4dd0fdab92 100644 --- a/engines/titanic/game/sgt/desk.cpp +++ b/engines/titanic/game/sgt/desk.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CDesk::save(SimpleFile *file, int indent) const { +void CDesk::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CSGTStateRoom::save(file, indent); } diff --git a/engines/titanic/game/sgt/desk.h b/engines/titanic/game/sgt/desk.h index 7fbb65ad5e..d35417c599 100644 --- a/engines/titanic/game/sgt/desk.h +++ b/engines/titanic/game/sgt/desk.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/sgt/deskchair.cpp b/engines/titanic/game/sgt/deskchair.cpp index 337b55a5d1..a4a2badeb0 100644 --- a/engines/titanic/game/sgt/deskchair.cpp +++ b/engines/titanic/game/sgt/deskchair.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CDeskchair::save(SimpleFile *file, int indent) const { +void CDeskchair::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CSGTStateRoom::save(file, indent); } diff --git a/engines/titanic/game/sgt/deskchair.h b/engines/titanic/game/sgt/deskchair.h index 205209c22c..38e4d6de5d 100644 --- a/engines/titanic/game/sgt/deskchair.h +++ b/engines/titanic/game/sgt/deskchair.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/sgt/drawer.cpp b/engines/titanic/game/sgt/drawer.cpp index 1d7fad275b..03aa1b5358 100644 --- a/engines/titanic/game/sgt/drawer.cpp +++ b/engines/titanic/game/sgt/drawer.cpp @@ -27,7 +27,7 @@ namespace Titanic { CDrawer::CDrawer() : CSGTStateRoom(), _fieldF4(0) { } -void CDrawer::save(SimpleFile *file, int indent) const { +void CDrawer::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldF4, indent); CSGTStateRoom::save(file, indent); diff --git a/engines/titanic/game/sgt/drawer.h b/engines/titanic/game/sgt/drawer.h index 8436e5ccb7..4f68b1b5ad 100644 --- a/engines/titanic/game/sgt/drawer.h +++ b/engines/titanic/game/sgt/drawer.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/sgt/sgt_doors.cpp b/engines/titanic/game/sgt/sgt_doors.cpp index 587a961ac1..516b0f1351 100644 --- a/engines/titanic/game/sgt/sgt_doors.cpp +++ b/engines/titanic/game/sgt/sgt_doors.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CSGTDoors::save(SimpleFile *file, int indent) const { +void CSGTDoors::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value1, indent); file->writeNumberLine(_value2, indent); diff --git a/engines/titanic/game/sgt/sgt_doors.h b/engines/titanic/game/sgt/sgt_doors.h index 9828708377..11825c069b 100644 --- a/engines/titanic/game/sgt/sgt_doors.h +++ b/engines/titanic/game/sgt/sgt_doors.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/sgt/sgt_nav.cpp b/engines/titanic/game/sgt/sgt_nav.cpp index e40d34d446..f98e486fd0 100644 --- a/engines/titanic/game/sgt/sgt_nav.cpp +++ b/engines/titanic/game/sgt/sgt_nav.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void SGTNav::save(SimpleFile *file, int indent) const { +void SGTNav::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CSGTStateRoom::save(file, indent); } diff --git a/engines/titanic/game/sgt/sgt_nav.h b/engines/titanic/game/sgt/sgt_nav.h index 7d7f57f851..39b267fc9c 100644 --- a/engines/titanic/game/sgt/sgt_nav.h +++ b/engines/titanic/game/sgt/sgt_nav.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/sgt/sgt_navigation.cpp b/engines/titanic/game/sgt/sgt_navigation.cpp index 666459bbf1..d0c308457c 100644 --- a/engines/titanic/game/sgt/sgt_navigation.cpp +++ b/engines/titanic/game/sgt/sgt_navigation.cpp @@ -34,7 +34,7 @@ void CSGTNavigation::deinit() { delete _statics; } -void CSGTNavigation::save(SimpleFile *file, int indent) const { +void CSGTNavigation::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_statics->_v1, indent); file->writeQuotedLine(_statics->_v2, indent); diff --git a/engines/titanic/game/sgt/sgt_navigation.h b/engines/titanic/game/sgt/sgt_navigation.h index 083efa8cfa..ac8c475cce 100644 --- a/engines/titanic/game/sgt/sgt_navigation.h +++ b/engines/titanic/game/sgt/sgt_navigation.h @@ -44,7 +44,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/sgt/sgt_restaurant_doors.cpp b/engines/titanic/game/sgt/sgt_restaurant_doors.cpp index 1e4a167357..74a71e75b2 100644 --- a/engines/titanic/game/sgt/sgt_restaurant_doors.cpp +++ b/engines/titanic/game/sgt/sgt_restaurant_doors.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CSGTRestaurantDoors::save(SimpleFile *file, int indent) const { +void CSGTRestaurantDoors::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/game/sgt/sgt_restaurant_doors.h b/engines/titanic/game/sgt/sgt_restaurant_doors.h index 14677ea5f9..e740db6246 100644 --- a/engines/titanic/game/sgt/sgt_restaurant_doors.h +++ b/engines/titanic/game/sgt/sgt_restaurant_doors.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/sgt/sgt_state_control.cpp b/engines/titanic/game/sgt/sgt_state_control.cpp index 113bd0dd2a..07c1f5efc0 100644 --- a/engines/titanic/game/sgt/sgt_state_control.cpp +++ b/engines/titanic/game/sgt/sgt_state_control.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CSGTStateControl::save(SimpleFile *file, int indent) const { +void CSGTStateControl::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); CBackground::save(file, indent); diff --git a/engines/titanic/game/sgt/sgt_state_control.h b/engines/titanic/game/sgt/sgt_state_control.h index 05d8fde7d1..af51274355 100644 --- a/engines/titanic/game/sgt/sgt_state_control.h +++ b/engines/titanic/game/sgt/sgt_state_control.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/sgt/sgt_state_room.cpp b/engines/titanic/game/sgt/sgt_state_room.cpp index 1a68131589..55f08de8b4 100644 --- a/engines/titanic/game/sgt/sgt_state_room.cpp +++ b/engines/titanic/game/sgt/sgt_state_room.cpp @@ -42,7 +42,7 @@ CSGTStateRoom::CSGTStateRoom() : CBackground(), _fieldE0(1), _fieldE4(1), _fieldE8(0), _fieldEC(1), _fieldF0(1) { } -void CSGTStateRoom::save(SimpleFile *file, int indent) const { +void CSGTStateRoom::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_statics->_v1, indent); file->writeQuotedLine(_statics->_v2, indent); diff --git a/engines/titanic/game/sgt/sgt_state_room.h b/engines/titanic/game/sgt/sgt_state_room.h index 7b2b5a81f0..1809ec8ee2 100644 --- a/engines/titanic/game/sgt/sgt_state_room.h +++ b/engines/titanic/game/sgt/sgt_state_room.h @@ -65,7 +65,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/sgt/sgt_tv.cpp b/engines/titanic/game/sgt/sgt_tv.cpp index 316545860e..ae4c59e2f9 100644 --- a/engines/titanic/game/sgt/sgt_tv.cpp +++ b/engines/titanic/game/sgt/sgt_tv.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CSGTTV::save(SimpleFile *file, int indent) const { +void CSGTTV::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CSGTStateRoom::save(file, indent); } diff --git a/engines/titanic/game/sgt/sgt_tv.h b/engines/titanic/game/sgt/sgt_tv.h index 347d2c74ab..e97f97427a 100644 --- a/engines/titanic/game/sgt/sgt_tv.h +++ b/engines/titanic/game/sgt/sgt_tv.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/sgt/sgt_upper_doors_sound.cpp b/engines/titanic/game/sgt/sgt_upper_doors_sound.cpp index 83a500e022..ed37b0a5c7 100644 --- a/engines/titanic/game/sgt/sgt_upper_doors_sound.cpp +++ b/engines/titanic/game/sgt/sgt_upper_doors_sound.cpp @@ -28,7 +28,7 @@ CSGTUpperDoorsSound::CSGTUpperDoorsSound() { _string2 = "b#53.wav"; } -void CSGTUpperDoorsSound::save(SimpleFile *file, int indent) const { +void CSGTUpperDoorsSound::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string2, indent); diff --git a/engines/titanic/game/sgt/sgt_upper_doors_sound.h b/engines/titanic/game/sgt/sgt_upper_doors_sound.h index cd62aa5cf6..3289b88f43 100644 --- a/engines/titanic/game/sgt/sgt_upper_doors_sound.h +++ b/engines/titanic/game/sgt/sgt_upper_doors_sound.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/sgt/toilet.cpp b/engines/titanic/game/sgt/toilet.cpp index ed4ac52412..799abd6c76 100644 --- a/engines/titanic/game/sgt/toilet.cpp +++ b/engines/titanic/game/sgt/toilet.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CToilet::save(SimpleFile *file, int indent) const { +void CToilet::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CSGTStateRoom::save(file, indent); } diff --git a/engines/titanic/game/sgt/toilet.h b/engines/titanic/game/sgt/toilet.h index 08926516ee..d0d2851367 100644 --- a/engines/titanic/game/sgt/toilet.h +++ b/engines/titanic/game/sgt/toilet.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/sgt/vase.cpp b/engines/titanic/game/sgt/vase.cpp index 04c5165795..3e04b5db9e 100644 --- a/engines/titanic/game/sgt/vase.cpp +++ b/engines/titanic/game/sgt/vase.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CVase::save(SimpleFile *file, int indent) const { +void CVase::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CSGTStateRoom::save(file, indent); } diff --git a/engines/titanic/game/sgt/vase.h b/engines/titanic/game/sgt/vase.h index 1b2a89f17b..ec3662b9ee 100644 --- a/engines/titanic/game/sgt/vase.h +++ b/engines/titanic/game/sgt/vase.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/sgt/washstand.cpp b/engines/titanic/game/sgt/washstand.cpp index f361b14e1d..8127a59a59 100644 --- a/engines/titanic/game/sgt/washstand.cpp +++ b/engines/titanic/game/sgt/washstand.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CWashstand::save(SimpleFile *file, int indent) const { +void CWashstand::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CSGTStateRoom::save(file, indent); } diff --git a/engines/titanic/game/sgt/washstand.h b/engines/titanic/game/sgt/washstand.h index 975a4d57c9..ea7636c485 100644 --- a/engines/titanic/game/sgt/washstand.h +++ b/engines/titanic/game/sgt/washstand.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/ship_setting.cpp b/engines/titanic/game/ship_setting.cpp index 037a199816..462f396501 100644 --- a/engines/titanic/game/ship_setting.cpp +++ b/engines/titanic/game/ship_setting.cpp @@ -28,7 +28,7 @@ CShipSetting::CShipSetting() : CBackground(), _string4("NULL"), _string5("NULL") { } -void CShipSetting::save(SimpleFile *file, int indent) const { +void CShipSetting::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string3, indent); file->writePoint(_pos1, indent); diff --git a/engines/titanic/game/ship_setting.h b/engines/titanic/game/ship_setting.h index acc06d171f..e0a52dd4c7 100644 --- a/engines/titanic/game/ship_setting.h +++ b/engines/titanic/game/ship_setting.h @@ -42,7 +42,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/ship_setting_button.cpp b/engines/titanic/game/ship_setting_button.cpp index 95507f3c90..7dc2cabac0 100644 --- a/engines/titanic/game/ship_setting_button.cpp +++ b/engines/titanic/game/ship_setting_button.cpp @@ -27,7 +27,7 @@ namespace Titanic { CShipSettingButton::CShipSettingButton() : CGameObject(), _fieldC8(0), _fieldCC(0) { } -void CShipSettingButton::save(SimpleFile *file, int indent) const { +void CShipSettingButton::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string1, indent); file->writeNumberLine(_fieldC8, indent); diff --git a/engines/titanic/game/ship_setting_button.h b/engines/titanic/game/ship_setting_button.h index e6a6822854..e5a889bcc3 100644 --- a/engines/titanic/game/ship_setting_button.h +++ b/engines/titanic/game/ship_setting_button.h @@ -39,7 +39,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/show_cell_points.cpp b/engines/titanic/game/show_cell_points.cpp index e23d588b76..7d54401a02 100644 --- a/engines/titanic/game/show_cell_points.cpp +++ b/engines/titanic/game/show_cell_points.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CShowCellpoints::save(SimpleFile *file, int indent) const { +void CShowCellpoints::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_strValue, indent); file->writeNumberLine(_numValue, indent); diff --git a/engines/titanic/game/show_cell_points.h b/engines/titanic/game/show_cell_points.h index a3d7ba2e5a..83592210e5 100644 --- a/engines/titanic/game/show_cell_points.h +++ b/engines/titanic/game/show_cell_points.h @@ -38,7 +38,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/speech_dispensor.cpp b/engines/titanic/game/speech_dispensor.cpp index 72873391db..f9cc019672 100644 --- a/engines/titanic/game/speech_dispensor.cpp +++ b/engines/titanic/game/speech_dispensor.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CSpeechDispensor::save(SimpleFile *file, int indent) const { +void CSpeechDispensor::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); file->writeNumberLine(_fieldE4, indent); diff --git a/engines/titanic/game/speech_dispensor.h b/engines/titanic/game/speech_dispensor.h index 440746e5c2..6302ca3d88 100644 --- a/engines/titanic/game/speech_dispensor.h +++ b/engines/titanic/game/speech_dispensor.h @@ -43,7 +43,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/splash_animation.cpp b/engines/titanic/game/splash_animation.cpp index 3d35929e2d..cfaf697d25 100644 --- a/engines/titanic/game/splash_animation.cpp +++ b/engines/titanic/game/splash_animation.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CSplashAnimation, CGameObject) -void CSplashAnimation::save(SimpleFile *file, int indent) const { +void CSplashAnimation::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/game/splash_animation.h b/engines/titanic/game/splash_animation.h index 9b6322e175..4b70b38f10 100644 --- a/engines/titanic/game/splash_animation.h +++ b/engines/titanic/game/splash_animation.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/starling_puret.cpp b/engines/titanic/game/starling_puret.cpp index 1fa0dc82ea..359ad774df 100644 --- a/engines/titanic/game/starling_puret.cpp +++ b/engines/titanic/game/starling_puret.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CStarlingPuret::save(SimpleFile *file, int indent) const { +void CStarlingPuret::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/game/starling_puret.h b/engines/titanic/game/starling_puret.h index 7299c68449..36cd23e54d 100644 --- a/engines/titanic/game/starling_puret.h +++ b/engines/titanic/game/starling_puret.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/start_action.cpp b/engines/titanic/game/start_action.cpp index e41b7df4bf..ab356ea1f4 100644 --- a/engines/titanic/game/start_action.cpp +++ b/engines/titanic/game/start_action.cpp @@ -33,7 +33,7 @@ END_MESSAGE_MAP() CStartAction::CStartAction() : CBackground() { } -void CStartAction::save(SimpleFile *file, int indent) const { +void CStartAction::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_msgTarget, indent); file->writeQuotedLine(_msgAction, indent); diff --git a/engines/titanic/game/start_action.h b/engines/titanic/game/start_action.h index de3c488c14..6b6860e265 100644 --- a/engines/titanic/game/start_action.h +++ b/engines/titanic/game/start_action.h @@ -42,7 +42,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/stop_phonograph_button.cpp b/engines/titanic/game/stop_phonograph_button.cpp index 7c4367a9c7..d18f4713ac 100644 --- a/engines/titanic/game/stop_phonograph_button.cpp +++ b/engines/titanic/game/stop_phonograph_button.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CStopPhonographButton::save(SimpleFile *file, int indent) const { +void CStopPhonographButton::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CBackground::save(file, indent); } diff --git a/engines/titanic/game/stop_phonograph_button.h b/engines/titanic/game/stop_phonograph_button.h index b1accfe1e1..1109f81475 100644 --- a/engines/titanic/game/stop_phonograph_button.h +++ b/engines/titanic/game/stop_phonograph_button.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/sub_glass.cpp b/engines/titanic/game/sub_glass.cpp index b16199deed..f1349f06ea 100644 --- a/engines/titanic/game/sub_glass.cpp +++ b/engines/titanic/game/sub_glass.cpp @@ -27,7 +27,7 @@ namespace Titanic { CSUBGlass::CSUBGlass() : _fieldBC(0), _fieldC0(0), _fieldC4(1), _fieldC8(0) { } -void CSUBGlass::save(SimpleFile *file, int indent) const { +void CSUBGlass::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); file->writeNumberLine(_fieldC0, indent); diff --git a/engines/titanic/game/sub_glass.h b/engines/titanic/game/sub_glass.h index b7ba51379e..1aa73d21ff 100644 --- a/engines/titanic/game/sub_glass.h +++ b/engines/titanic/game/sub_glass.h @@ -42,7 +42,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/sub_wrapper.cpp b/engines/titanic/game/sub_wrapper.cpp index be6b3e275f..dcc489316b 100644 --- a/engines/titanic/game/sub_wrapper.cpp +++ b/engines/titanic/game/sub_wrapper.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CSUBWrapper::save(SimpleFile *file, int indent) const { +void CSUBWrapper::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/game/sub_wrapper.h b/engines/titanic/game/sub_wrapper.h index 6b724f8000..d2fc914a08 100644 --- a/engines/titanic/game/sub_wrapper.h +++ b/engines/titanic/game/sub_wrapper.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/sweet_bowl.cpp b/engines/titanic/game/sweet_bowl.cpp index f6bbb2c89c..e14f900e77 100644 --- a/engines/titanic/game/sweet_bowl.cpp +++ b/engines/titanic/game/sweet_bowl.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CSweetBowl::save(SimpleFile *file, int indent) const { +void CSweetBowl::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/game/sweet_bowl.h b/engines/titanic/game/sweet_bowl.h index fa607bb67b..5beb9605f0 100644 --- a/engines/titanic/game/sweet_bowl.h +++ b/engines/titanic/game/sweet_bowl.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp index 57b2b7f453..f5a7e5f63a 100644 --- a/engines/titanic/game/television.cpp +++ b/engines/titanic/game/television.cpp @@ -66,7 +66,7 @@ void CTelevision::init() { void CTelevision::deinit() { } -void CTelevision::save(SimpleFile *file, int indent) const { +void CTelevision::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); file->writeNumberLine(_v1, indent); diff --git a/engines/titanic/game/television.h b/engines/titanic/game/television.h index 64202c7917..27dd3d65a8 100644 --- a/engines/titanic/game/television.h +++ b/engines/titanic/game/television.h @@ -66,7 +66,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/third_class_canal.cpp b/engines/titanic/game/third_class_canal.cpp index a25d5f20ef..6b0a101f7b 100644 --- a/engines/titanic/game/third_class_canal.cpp +++ b/engines/titanic/game/third_class_canal.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CThirdClassCanal::save(SimpleFile *file, int indent) const { +void CThirdClassCanal::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CBackground::save(file, indent); } diff --git a/engines/titanic/game/third_class_canal.h b/engines/titanic/game/third_class_canal.h index 7a2c3d4f77..1cc53948d3 100644 --- a/engines/titanic/game/third_class_canal.h +++ b/engines/titanic/game/third_class_canal.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/throw_tv_down_well.cpp b/engines/titanic/game/throw_tv_down_well.cpp index d77d7760c5..c8a9fc7c9e 100644 --- a/engines/titanic/game/throw_tv_down_well.cpp +++ b/engines/titanic/game/throw_tv_down_well.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CThrowTVDownWell::save(SimpleFile *file, int indent) const { +void CThrowTVDownWell::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_strValue, indent); file->writeNumberLine(_numValue, indent); diff --git a/engines/titanic/game/throw_tv_down_well.h b/engines/titanic/game/throw_tv_down_well.h index dee145014b..ce10264230 100644 --- a/engines/titanic/game/throw_tv_down_well.h +++ b/engines/titanic/game/throw_tv_down_well.h @@ -38,7 +38,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/titania_still_control.cpp b/engines/titanic/game/titania_still_control.cpp index 96c003defe..67866ecdcb 100644 --- a/engines/titanic/game/titania_still_control.cpp +++ b/engines/titanic/game/titania_still_control.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CTitaniaStillControl::save(SimpleFile *file, int indent) const { +void CTitaniaStillControl::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/game/titania_still_control.h b/engines/titanic/game/titania_still_control.h index a0f739db01..dbff0c73bb 100644 --- a/engines/titanic/game/titania_still_control.h +++ b/engines/titanic/game/titania_still_control.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/tow_parrot_nav.cpp b/engines/titanic/game/tow_parrot_nav.cpp index d476681ad4..9361808870 100644 --- a/engines/titanic/game/tow_parrot_nav.cpp +++ b/engines/titanic/game/tow_parrot_nav.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CTOWParrotNav::save(SimpleFile *file, int indent) const { +void CTOWParrotNav::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/game/tow_parrot_nav.h b/engines/titanic/game/tow_parrot_nav.h index 420c29bfab..651b8bea56 100644 --- a/engines/titanic/game/tow_parrot_nav.h +++ b/engines/titanic/game/tow_parrot_nav.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/transport/exit_pellerator.h b/engines/titanic/game/transport/exit_pellerator.h index e72cbb4b9d..e55a8fbf04 100644 --- a/engines/titanic/game/transport/exit_pellerator.h +++ b/engines/titanic/game/transport/exit_pellerator.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/transport/gondolier.cpp b/engines/titanic/game/transport/gondolier.cpp index f67a3b68d9..f731e45bde 100644 --- a/engines/titanic/game/transport/gondolier.cpp +++ b/engines/titanic/game/transport/gondolier.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CGondolier::save(SimpleFile *file, int indent) const { +void CGondolier::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CTransport::save(file, indent); } diff --git a/engines/titanic/game/transport/gondolier.h b/engines/titanic/game/transport/gondolier.h index bdfb3e7156..4f4c57081b 100644 --- a/engines/titanic/game/transport/gondolier.h +++ b/engines/titanic/game/transport/gondolier.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/transport/lift.cpp b/engines/titanic/game/transport/lift.cpp index e978762528..72f832bf76 100644 --- a/engines/titanic/game/transport/lift.cpp +++ b/engines/titanic/game/transport/lift.cpp @@ -35,7 +35,7 @@ int CLift::_v4; int CLift::_v5; int CLift::_v6; -void CLift::save(SimpleFile *file, int indent) const { +void CLift::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_v1, indent); file->writeNumberLine(_v2, indent); diff --git a/engines/titanic/game/transport/lift.h b/engines/titanic/game/transport/lift.h index 161061c042..4b39d34008 100644 --- a/engines/titanic/game/transport/lift.h +++ b/engines/titanic/game/transport/lift.h @@ -47,7 +47,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/transport/lift_indicator.cpp b/engines/titanic/game/transport/lift_indicator.cpp index eb7f6bfa1c..582de8ad3b 100644 --- a/engines/titanic/game/transport/lift_indicator.cpp +++ b/engines/titanic/game/transport/lift_indicator.cpp @@ -32,7 +32,7 @@ CLiftindicator::CLiftindicator() : CLift(), _fieldFC(0), _field108(0), _field10C(0) { } -void CLiftindicator::save(SimpleFile *file, int indent) const { +void CLiftindicator::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldFC, indent); file->writePoint(_pos2, indent); diff --git a/engines/titanic/game/transport/lift_indicator.h b/engines/titanic/game/transport/lift_indicator.h index c73d1f46d4..2b08da5975 100644 --- a/engines/titanic/game/transport/lift_indicator.h +++ b/engines/titanic/game/transport/lift_indicator.h @@ -43,7 +43,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/transport/pellerator.cpp b/engines/titanic/game/transport/pellerator.cpp index ed82aa9c3d..e789c20a3d 100644 --- a/engines/titanic/game/transport/pellerator.cpp +++ b/engines/titanic/game/transport/pellerator.cpp @@ -31,7 +31,7 @@ END_MESSAGE_MAP() int CPellerator::_v1; int CPellerator::_v2; -void CPellerator::save(SimpleFile *file, int indent) const { +void CPellerator::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_v1, indent); file->writeNumberLine(_v2, indent); diff --git a/engines/titanic/game/transport/pellerator.h b/engines/titanic/game/transport/pellerator.h index 0539b5ceac..ac1486de3a 100644 --- a/engines/titanic/game/transport/pellerator.h +++ b/engines/titanic/game/transport/pellerator.h @@ -40,7 +40,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/transport/service_elevator.cpp b/engines/titanic/game/transport/service_elevator.cpp index ba68bc8c2b..1ea8d14e36 100644 --- a/engines/titanic/game/transport/service_elevator.cpp +++ b/engines/titanic/game/transport/service_elevator.cpp @@ -32,7 +32,7 @@ CServiceElevator::CServiceElevator() : CTransport(), _fieldF8(0), _fieldFC(0), _field100(0), _field104(0) { } -void CServiceElevator::save(SimpleFile *file, int indent) const { +void CServiceElevator::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_v1, indent); file->writeNumberLine(_v2, indent); diff --git a/engines/titanic/game/transport/service_elevator.h b/engines/titanic/game/transport/service_elevator.h index 9edc1f9100..472f4580ad 100644 --- a/engines/titanic/game/transport/service_elevator.h +++ b/engines/titanic/game/transport/service_elevator.h @@ -44,7 +44,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/transport/transport.cpp b/engines/titanic/game/transport/transport.cpp index e00375975b..f9598c7b7b 100644 --- a/engines/titanic/game/transport/transport.cpp +++ b/engines/titanic/game/transport/transport.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CTransport, CMobile) CTransport::CTransport() : CMobile(), _string1("*.*.*") { } -void CTransport::save(SimpleFile *file, int indent) const { +void CTransport::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string1, indent); file->writeQuotedLine(_string2, indent); diff --git a/engines/titanic/game/transport/transport.h b/engines/titanic/game/transport/transport.h index b7540add0e..66906888a0 100644 --- a/engines/titanic/game/transport/transport.h +++ b/engines/titanic/game/transport/transport.h @@ -39,7 +39,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/up_lighter.cpp b/engines/titanic/game/up_lighter.cpp index 50cd1d426f..f03b8f37a0 100644 --- a/engines/titanic/game/up_lighter.cpp +++ b/engines/titanic/game/up_lighter.cpp @@ -28,7 +28,7 @@ CUpLighter::CUpLighter() : CDropTarget(), _field118(0), _field11C(0), _field120(0), _field124(0) { } -void CUpLighter::save(SimpleFile *file, int indent) const { +void CUpLighter::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_field118, indent); file->writeNumberLine(_field11C, indent); diff --git a/engines/titanic/game/up_lighter.h b/engines/titanic/game/up_lighter.h index a3f8b2a7f2..be76f576de 100644 --- a/engines/titanic/game/up_lighter.h +++ b/engines/titanic/game/up_lighter.h @@ -42,7 +42,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/useless_lever.cpp b/engines/titanic/game/useless_lever.cpp index afc025b58f..e48ad55a71 100644 --- a/engines/titanic/game/useless_lever.cpp +++ b/engines/titanic/game/useless_lever.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CUselessLever::save(SimpleFile *file, int indent) const { +void CUselessLever::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CToggleButton::save(file, indent); } diff --git a/engines/titanic/game/useless_lever.h b/engines/titanic/game/useless_lever.h index f582bdee63..d6c54802f9 100644 --- a/engines/titanic/game/useless_lever.h +++ b/engines/titanic/game/useless_lever.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/volume_control.cpp b/engines/titanic/game/volume_control.cpp index e9b66c769e..c6b0e414ae 100644 --- a/engines/titanic/game/volume_control.cpp +++ b/engines/titanic/game/volume_control.cpp @@ -27,7 +27,7 @@ namespace Titanic { CVolumeControl::CVolumeControl() : CGameObject() { } -void CVolumeControl::save(SimpleFile *file, int indent) const { +void CVolumeControl::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); file->writeQuotedLine(_string1, indent); diff --git a/engines/titanic/game/volume_control.h b/engines/titanic/game/volume_control.h index cef5ac492f..77e33463e4 100644 --- a/engines/titanic/game/volume_control.h +++ b/engines/titanic/game/volume_control.h @@ -41,7 +41,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/wheel_button.cpp b/engines/titanic/game/wheel_button.cpp index 0fad6848fd..19c42a8807 100644 --- a/engines/titanic/game/wheel_button.cpp +++ b/engines/titanic/game/wheel_button.cpp @@ -28,7 +28,7 @@ CWheelButton::CWheelButton() : CBackground(), _fieldE0(0), _fieldE4(0), _fieldE8(0) { } -void CWheelButton::save(SimpleFile *file, int indent) const { +void CWheelButton::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); file->writeNumberLine(_fieldE4, indent); diff --git a/engines/titanic/game/wheel_button.h b/engines/titanic/game/wheel_button.h index 75e1268585..78ea7085c2 100644 --- a/engines/titanic/game/wheel_button.h +++ b/engines/titanic/game/wheel_button.h @@ -39,7 +39,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/wheel_hotspot.cpp b/engines/titanic/game/wheel_hotspot.cpp index 8b05f45642..f9af594cd5 100644 --- a/engines/titanic/game/wheel_hotspot.cpp +++ b/engines/titanic/game/wheel_hotspot.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CWheelHotSpot::save(SimpleFile *file, int indent) const { +void CWheelHotSpot::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); file->writeNumberLine(_fieldE4, indent); diff --git a/engines/titanic/game/wheel_hotspot.h b/engines/titanic/game/wheel_hotspot.h index 7164b88b71..75b597c425 100644 --- a/engines/titanic/game/wheel_hotspot.h +++ b/engines/titanic/game/wheel_hotspot.h @@ -38,7 +38,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/wheel_spin.cpp b/engines/titanic/game/wheel_spin.cpp index 7f16a4c559..daa9918e29 100644 --- a/engines/titanic/game/wheel_spin.cpp +++ b/engines/titanic/game/wheel_spin.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CWheelSpin::save(SimpleFile *file, int indent) const { +void CWheelSpin::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); CBackground::save(file, indent); diff --git a/engines/titanic/game/wheel_spin.h b/engines/titanic/game/wheel_spin.h index 2e21da4984..9e584a1e48 100644 --- a/engines/titanic/game/wheel_spin.h +++ b/engines/titanic/game/wheel_spin.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/game/wheel_spin_horn.cpp b/engines/titanic/game/wheel_spin_horn.cpp index 3bc705dddb..b01cc678df 100644 --- a/engines/titanic/game/wheel_spin_horn.cpp +++ b/engines/titanic/game/wheel_spin_horn.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CWheelSpinHorn::save(SimpleFile *file, int indent) const { +void CWheelSpinHorn::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string1, indent); file->writeQuotedLine(_string2, indent); diff --git a/engines/titanic/game/wheel_spin_horn.h b/engines/titanic/game/wheel_spin_horn.h index e4c0bd738c..ac4021f3a7 100644 --- a/engines/titanic/game/wheel_spin_horn.h +++ b/engines/titanic/game/wheel_spin_horn.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/act_button.cpp b/engines/titanic/gfx/act_button.cpp index 3e79a171c1..c84f358ca9 100644 --- a/engines/titanic/gfx/act_button.cpp +++ b/engines/titanic/gfx/act_button.cpp @@ -27,7 +27,7 @@ namespace Titanic { CActButton::CActButton() : CSTButton() { } -void CActButton::save(SimpleFile *file, int indent) const { +void CActButton::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CSTButton::save(file, indent); } diff --git a/engines/titanic/gfx/act_button.h b/engines/titanic/gfx/act_button.h index b8f8f21173..3b78e0c3af 100644 --- a/engines/titanic/gfx/act_button.h +++ b/engines/titanic/gfx/act_button.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/changes_season_button.cpp b/engines/titanic/gfx/changes_season_button.cpp index a5f6778815..d5242ad890 100644 --- a/engines/titanic/gfx/changes_season_button.cpp +++ b/engines/titanic/gfx/changes_season_button.cpp @@ -27,7 +27,7 @@ namespace Titanic { CChangesSeasonButton::CChangesSeasonButton() : CSTButton() { } -void CChangesSeasonButton::save(SimpleFile *file, int indent) const { +void CChangesSeasonButton::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CSTButton::save(file, indent); } diff --git a/engines/titanic/gfx/changes_season_button.h b/engines/titanic/gfx/changes_season_button.h index f39cfdc647..2fe4672c1f 100644 --- a/engines/titanic/gfx/changes_season_button.h +++ b/engines/titanic/gfx/changes_season_button.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/chev_left_off.cpp b/engines/titanic/gfx/chev_left_off.cpp index 0ce2d62af3..51583992c2 100644 --- a/engines/titanic/gfx/chev_left_off.cpp +++ b/engines/titanic/gfx/chev_left_off.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CChevLeftOff, CToggleSwitch) CChevLeftOff::CChevLeftOff() : CToggleSwitch() { } -void CChevLeftOff::save(SimpleFile *file, int indent) const { +void CChevLeftOff::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CToggleSwitch::save(file, indent); } diff --git a/engines/titanic/gfx/chev_left_off.h b/engines/titanic/gfx/chev_left_off.h index 36a9d2c3ad..572f58abf3 100644 --- a/engines/titanic/gfx/chev_left_off.h +++ b/engines/titanic/gfx/chev_left_off.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/chev_left_on.cpp b/engines/titanic/gfx/chev_left_on.cpp index c3264b794b..5b3f6a8dcf 100644 --- a/engines/titanic/gfx/chev_left_on.cpp +++ b/engines/titanic/gfx/chev_left_on.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CChevLeftOn, CToggleSwitch) CChevLeftOn::CChevLeftOn() : CToggleSwitch() { } -void CChevLeftOn::save(SimpleFile *file, int indent) const { +void CChevLeftOn::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CToggleSwitch::save(file, indent); } diff --git a/engines/titanic/gfx/chev_left_on.h b/engines/titanic/gfx/chev_left_on.h index 0de814bfcc..c015eef7c1 100644 --- a/engines/titanic/gfx/chev_left_on.h +++ b/engines/titanic/gfx/chev_left_on.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/chev_right_off.cpp b/engines/titanic/gfx/chev_right_off.cpp index 60ed2de30c..4cab0708b3 100644 --- a/engines/titanic/gfx/chev_right_off.cpp +++ b/engines/titanic/gfx/chev_right_off.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CChevRightOff, CToggleSwitch) CChevRightOff::CChevRightOff() : CToggleSwitch() { } -void CChevRightOff::save(SimpleFile *file, int indent) const { +void CChevRightOff::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CToggleSwitch::save(file, indent); } diff --git a/engines/titanic/gfx/chev_right_off.h b/engines/titanic/gfx/chev_right_off.h index 3714c2b386..05b62f3241 100644 --- a/engines/titanic/gfx/chev_right_off.h +++ b/engines/titanic/gfx/chev_right_off.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/chev_right_on.cpp b/engines/titanic/gfx/chev_right_on.cpp index ac55100ed6..29a07f0d41 100644 --- a/engines/titanic/gfx/chev_right_on.cpp +++ b/engines/titanic/gfx/chev_right_on.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CChevRightOn, CToggleSwitch) CChevRightOn::CChevRightOn() : CToggleSwitch() { } -void CChevRightOn::save(SimpleFile *file, int indent) const { +void CChevRightOn::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CToggleSwitch::save(file, indent); } diff --git a/engines/titanic/gfx/chev_right_on.h b/engines/titanic/gfx/chev_right_on.h index d72c34a895..56672f27bb 100644 --- a/engines/titanic/gfx/chev_right_on.h +++ b/engines/titanic/gfx/chev_right_on.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/chev_send_rec_switch.cpp b/engines/titanic/gfx/chev_send_rec_switch.cpp index d0d4a819a3..92b551852e 100644 --- a/engines/titanic/gfx/chev_send_rec_switch.cpp +++ b/engines/titanic/gfx/chev_send_rec_switch.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CChevSendRecSwitch, CToggleSwitch) CChevSendRecSwitch::CChevSendRecSwitch() : CToggleSwitch() { } -void CChevSendRecSwitch::save(SimpleFile *file, int indent) const { +void CChevSendRecSwitch::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CToggleSwitch::save(file, indent); } diff --git a/engines/titanic/gfx/chev_send_rec_switch.h b/engines/titanic/gfx/chev_send_rec_switch.h index 2f51bae259..17a1b0a855 100644 --- a/engines/titanic/gfx/chev_send_rec_switch.h +++ b/engines/titanic/gfx/chev_send_rec_switch.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/chev_switch.cpp b/engines/titanic/gfx/chev_switch.cpp index d7f1107c17..a6ce93098c 100644 --- a/engines/titanic/gfx/chev_switch.cpp +++ b/engines/titanic/gfx/chev_switch.cpp @@ -27,7 +27,7 @@ namespace Titanic { CChevSwitch::CChevSwitch() : CToggleSwitch() { } -void CChevSwitch::save(SimpleFile *file, int indent) const { +void CChevSwitch::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CToggleSwitch::save(file, indent); } diff --git a/engines/titanic/gfx/chev_switch.h b/engines/titanic/gfx/chev_switch.h index 6c0314be4c..d3c884e92a 100644 --- a/engines/titanic/gfx/chev_switch.h +++ b/engines/titanic/gfx/chev_switch.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/edit_control.cpp b/engines/titanic/gfx/edit_control.cpp index 17a56d6677..3b611e9bbe 100644 --- a/engines/titanic/gfx/edit_control.cpp +++ b/engines/titanic/gfx/edit_control.cpp @@ -31,7 +31,7 @@ CEditControl::CEditControl() : CGameObject(), _fieldBC(0), _fieldC0(0), { } -void CEditControl::save(SimpleFile *file, int indent) const { +void CEditControl::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); file->writeNumberLine(_fieldC0, indent); diff --git a/engines/titanic/gfx/edit_control.h b/engines/titanic/gfx/edit_control.h index d782b72669..42886372d2 100644 --- a/engines/titanic/gfx/edit_control.h +++ b/engines/titanic/gfx/edit_control.h @@ -49,7 +49,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/elevator_button.cpp b/engines/titanic/gfx/elevator_button.cpp index 2a599ca491..3c61869677 100644 --- a/engines/titanic/gfx/elevator_button.cpp +++ b/engines/titanic/gfx/elevator_button.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CElevatorButton, CSTButton) CElevatorButton::CElevatorButton() : CSTButton() { } -void CElevatorButton::save(SimpleFile *file, int indent) const { +void CElevatorButton::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CSTButton::save(file, indent); } diff --git a/engines/titanic/gfx/elevator_button.h b/engines/titanic/gfx/elevator_button.h index d6bf5dc3d6..da7e25a275 100644 --- a/engines/titanic/gfx/elevator_button.h +++ b/engines/titanic/gfx/elevator_button.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/get_from_succ.cpp b/engines/titanic/gfx/get_from_succ.cpp index c7a59fd97d..0f3f4ba412 100644 --- a/engines/titanic/gfx/get_from_succ.cpp +++ b/engines/titanic/gfx/get_from_succ.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CGetFromSucc, CToggleSwitch) CGetFromSucc::CGetFromSucc() : CToggleSwitch() { } -void CGetFromSucc::save(SimpleFile *file, int indent) const { +void CGetFromSucc::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CToggleSwitch::save(file, indent); } diff --git a/engines/titanic/gfx/get_from_succ.h b/engines/titanic/gfx/get_from_succ.h index dc611f140f..5f16f9175f 100644 --- a/engines/titanic/gfx/get_from_succ.h +++ b/engines/titanic/gfx/get_from_succ.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/helmet_on_off.cpp b/engines/titanic/gfx/helmet_on_off.cpp index 29131778cb..c72c795994 100644 --- a/engines/titanic/gfx/helmet_on_off.cpp +++ b/engines/titanic/gfx/helmet_on_off.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CHelmetOnOff, CToggleSwitch) CHelmetOnOff::CHelmetOnOff() : CToggleSwitch() { } -void CHelmetOnOff::save(SimpleFile *file, int indent) const { +void CHelmetOnOff::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CToggleSwitch::save(file, indent); } diff --git a/engines/titanic/gfx/helmet_on_off.h b/engines/titanic/gfx/helmet_on_off.h index f607b47c0c..c0e1a0affe 100644 --- a/engines/titanic/gfx/helmet_on_off.h +++ b/engines/titanic/gfx/helmet_on_off.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/home_photo.cpp b/engines/titanic/gfx/home_photo.cpp index 303e56d1ca..1c3b064955 100644 --- a/engines/titanic/gfx/home_photo.cpp +++ b/engines/titanic/gfx/home_photo.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CHomePhoto, CToggleSwitch) CHomePhoto::CHomePhoto() : CToggleSwitch() { } -void CHomePhoto::save(SimpleFile *file, int indent) const { +void CHomePhoto::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CToggleSwitch::save(file, indent); } diff --git a/engines/titanic/gfx/home_photo.h b/engines/titanic/gfx/home_photo.h index db0be89a77..c14352375a 100644 --- a/engines/titanic/gfx/home_photo.h +++ b/engines/titanic/gfx/home_photo.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/icon_nav_action.cpp b/engines/titanic/gfx/icon_nav_action.cpp index e66c345bf5..bd32c937fb 100644 --- a/engines/titanic/gfx/icon_nav_action.cpp +++ b/engines/titanic/gfx/icon_nav_action.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CIconNavAction, CToggleSwitch) CIconNavAction::CIconNavAction() : CToggleSwitch() { } -void CIconNavAction::save(SimpleFile *file, int indent) const { +void CIconNavAction::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CToggleSwitch::save(file, indent); } diff --git a/engines/titanic/gfx/icon_nav_action.h b/engines/titanic/gfx/icon_nav_action.h index 189ea357e4..2a5961d590 100644 --- a/engines/titanic/gfx/icon_nav_action.h +++ b/engines/titanic/gfx/icon_nav_action.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/icon_nav_butt.cpp b/engines/titanic/gfx/icon_nav_butt.cpp index 820a4270d4..cc9a217cbf 100644 --- a/engines/titanic/gfx/icon_nav_butt.cpp +++ b/engines/titanic/gfx/icon_nav_butt.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CIconNavButt, CPetGraphic) -void CIconNavButt::save(SimpleFile *file, int indent) const { +void CIconNavButt::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CPetGraphic::save(file, indent); } diff --git a/engines/titanic/gfx/icon_nav_butt.h b/engines/titanic/gfx/icon_nav_butt.h index 0cb2f1a3b1..3c73a274b2 100644 --- a/engines/titanic/gfx/icon_nav_butt.h +++ b/engines/titanic/gfx/icon_nav_butt.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/icon_nav_down.cpp b/engines/titanic/gfx/icon_nav_down.cpp index 78727a3e8b..09a0332828 100644 --- a/engines/titanic/gfx/icon_nav_down.cpp +++ b/engines/titanic/gfx/icon_nav_down.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CIconNavDown, CToggleSwitch) CIconNavDown::CIconNavDown() : CToggleSwitch() { } -void CIconNavDown::save(SimpleFile *file, int indent) const { +void CIconNavDown::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CToggleSwitch::save(file, indent); } diff --git a/engines/titanic/gfx/icon_nav_down.h b/engines/titanic/gfx/icon_nav_down.h index 3eef9ef7f1..6de13eac11 100644 --- a/engines/titanic/gfx/icon_nav_down.h +++ b/engines/titanic/gfx/icon_nav_down.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/icon_nav_image.cpp b/engines/titanic/gfx/icon_nav_image.cpp index d0c6239dcd..59a50bb8a6 100644 --- a/engines/titanic/gfx/icon_nav_image.cpp +++ b/engines/titanic/gfx/icon_nav_image.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CIconNavImage, CPetGraphic) -void CIconNavImage::save(SimpleFile *file, int indent) const { +void CIconNavImage::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CPetGraphic::save(file, indent); } diff --git a/engines/titanic/gfx/icon_nav_image.h b/engines/titanic/gfx/icon_nav_image.h index 8460733a12..3ff82f385c 100644 --- a/engines/titanic/gfx/icon_nav_image.h +++ b/engines/titanic/gfx/icon_nav_image.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/icon_nav_left.cpp b/engines/titanic/gfx/icon_nav_left.cpp index 803818f19f..272e2a63af 100644 --- a/engines/titanic/gfx/icon_nav_left.cpp +++ b/engines/titanic/gfx/icon_nav_left.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CIconNavLeft, CToggleSwitch) CIconNavLeft::CIconNavLeft() : CToggleSwitch() { } -void CIconNavLeft::save(SimpleFile *file, int indent) const { +void CIconNavLeft::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CToggleSwitch::save(file, indent); } diff --git a/engines/titanic/gfx/icon_nav_left.h b/engines/titanic/gfx/icon_nav_left.h index 5fd7b65a83..bba3016d7b 100644 --- a/engines/titanic/gfx/icon_nav_left.h +++ b/engines/titanic/gfx/icon_nav_left.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/icon_nav_receive.cpp b/engines/titanic/gfx/icon_nav_receive.cpp index 554656cf0a..ba5d8eaafa 100644 --- a/engines/titanic/gfx/icon_nav_receive.cpp +++ b/engines/titanic/gfx/icon_nav_receive.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CIconNavReceive, CPetGraphic) -void CIconNavReceive::save(SimpleFile *file, int indent) const { +void CIconNavReceive::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CPetGraphic::save(file, indent); } diff --git a/engines/titanic/gfx/icon_nav_receive.h b/engines/titanic/gfx/icon_nav_receive.h index f181439289..8fff0d0cd1 100644 --- a/engines/titanic/gfx/icon_nav_receive.h +++ b/engines/titanic/gfx/icon_nav_receive.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/icon_nav_right.cpp b/engines/titanic/gfx/icon_nav_right.cpp index 1553c9127c..a661e0d8dc 100644 --- a/engines/titanic/gfx/icon_nav_right.cpp +++ b/engines/titanic/gfx/icon_nav_right.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CIconNavRight, CToggleSwitch) CIconNavRight::CIconNavRight() : CToggleSwitch() { } -void CIconNavRight::save(SimpleFile *file, int indent) const { +void CIconNavRight::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CToggleSwitch::save(file, indent); } diff --git a/engines/titanic/gfx/icon_nav_right.h b/engines/titanic/gfx/icon_nav_right.h index c088a2334a..1df10433b5 100644 --- a/engines/titanic/gfx/icon_nav_right.h +++ b/engines/titanic/gfx/icon_nav_right.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/icon_nav_send.cpp b/engines/titanic/gfx/icon_nav_send.cpp index 64d2a8660e..067e44847f 100644 --- a/engines/titanic/gfx/icon_nav_send.cpp +++ b/engines/titanic/gfx/icon_nav_send.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CIconNavSend, CPetGraphic) -void CIconNavSend::save(SimpleFile *file, int indent) const { +void CIconNavSend::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CPetGraphic::save(file, indent); } diff --git a/engines/titanic/gfx/icon_nav_send.h b/engines/titanic/gfx/icon_nav_send.h index 41c747edad..d70920507a 100644 --- a/engines/titanic/gfx/icon_nav_send.h +++ b/engines/titanic/gfx/icon_nav_send.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/icon_nav_up.cpp b/engines/titanic/gfx/icon_nav_up.cpp index a8f4f552b5..5671dee9cf 100644 --- a/engines/titanic/gfx/icon_nav_up.cpp +++ b/engines/titanic/gfx/icon_nav_up.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CIconNavUp, CToggleSwitch) CIconNavUp::CIconNavUp() : CToggleSwitch() { } -void CIconNavUp::save(SimpleFile *file, int indent) const { +void CIconNavUp::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CToggleSwitch::save(file, indent); } diff --git a/engines/titanic/gfx/icon_nav_up.h b/engines/titanic/gfx/icon_nav_up.h index 691e6652e7..73d4fc3f8b 100644 --- a/engines/titanic/gfx/icon_nav_up.h +++ b/engines/titanic/gfx/icon_nav_up.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/keybrd_butt.cpp b/engines/titanic/gfx/keybrd_butt.cpp index 4a18d99f0a..1a0a927e54 100644 --- a/engines/titanic/gfx/keybrd_butt.cpp +++ b/engines/titanic/gfx/keybrd_butt.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CKeybrdButt, CToggleSwitch) CKeybrdButt::CKeybrdButt() : CToggleSwitch() { } -void CKeybrdButt::save(SimpleFile *file, int indent) const { +void CKeybrdButt::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CToggleSwitch::save(file, indent); } diff --git a/engines/titanic/gfx/keybrd_butt.h b/engines/titanic/gfx/keybrd_butt.h index 33ff418c56..4bf38a1954 100644 --- a/engines/titanic/gfx/keybrd_butt.h +++ b/engines/titanic/gfx/keybrd_butt.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/move_object_button.cpp b/engines/titanic/gfx/move_object_button.cpp index 4ab0825864..bdc90a673c 100644 --- a/engines/titanic/gfx/move_object_button.cpp +++ b/engines/titanic/gfx/move_object_button.cpp @@ -27,7 +27,7 @@ namespace Titanic { CMoveObjectButton::CMoveObjectButton() : CSTButton(), _field11C(1) { } -void CMoveObjectButton::save(SimpleFile *file, int indent) const { +void CMoveObjectButton::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writePoint(_pos1, indent); file->writeNumberLine(_field11C, indent); diff --git a/engines/titanic/gfx/move_object_button.h b/engines/titanic/gfx/move_object_button.h index 3873db6f4e..a255ecf38a 100644 --- a/engines/titanic/gfx/move_object_button.h +++ b/engines/titanic/gfx/move_object_button.h @@ -38,7 +38,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/music_control.cpp b/engines/titanic/gfx/music_control.cpp index 5ca079f9ff..85a3d777ef 100644 --- a/engines/titanic/gfx/music_control.cpp +++ b/engines/titanic/gfx/music_control.cpp @@ -28,7 +28,7 @@ CMusicControl::CMusicControl() : CBackground(), _fieldE0(0), _fieldE4(0), _fieldE8(1), _fieldEC(1) { } -void CMusicControl::save(SimpleFile *file, int indent) const { +void CMusicControl::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); file->writeNumberLine(_fieldE4, indent); diff --git a/engines/titanic/gfx/music_control.h b/engines/titanic/gfx/music_control.h index 97a0077c18..4b7927060b 100644 --- a/engines/titanic/gfx/music_control.h +++ b/engines/titanic/gfx/music_control.h @@ -40,7 +40,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/music_slider.cpp b/engines/titanic/gfx/music_slider.cpp index f065ae6729..fcf4d4bc76 100644 --- a/engines/titanic/gfx/music_slider.cpp +++ b/engines/titanic/gfx/music_slider.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CMusicSlider, CMusicControl) -void CMusicSlider::save(SimpleFile *file, int indent) const { +void CMusicSlider::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CMusicControl::save(file, indent); } diff --git a/engines/titanic/gfx/music_slider.h b/engines/titanic/gfx/music_slider.h index b396074b00..87a06c6b60 100644 --- a/engines/titanic/gfx/music_slider.h +++ b/engines/titanic/gfx/music_slider.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/music_slider_pitch.h b/engines/titanic/gfx/music_slider_pitch.h index f50958bdcd..edb8f42680 100644 --- a/engines/titanic/gfx/music_slider_pitch.h +++ b/engines/titanic/gfx/music_slider_pitch.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const { + virtual void save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CMusicSlider::save(file, indent); } diff --git a/engines/titanic/gfx/music_slider_speed.h b/engines/titanic/gfx/music_slider_speed.h index 8ed18625ff..c6a35ddd5f 100644 --- a/engines/titanic/gfx/music_slider_speed.h +++ b/engines/titanic/gfx/music_slider_speed.h @@ -34,7 +34,7 @@ namespace Titanic { /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const { + virtual void save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CMusicSlider::save(file, indent); } diff --git a/engines/titanic/gfx/music_switch.cpp b/engines/titanic/gfx/music_switch.cpp index 69e8f2eb4c..fb1c6de9f7 100644 --- a/engines/titanic/gfx/music_switch.cpp +++ b/engines/titanic/gfx/music_switch.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CMusicSwitch, CMusicControl) -void CMusicSwitch::save(SimpleFile *file, int indent) const { +void CMusicSwitch::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CMusicControl::save(file, indent); } diff --git a/engines/titanic/gfx/music_switch.h b/engines/titanic/gfx/music_switch.h index bd9397e041..bb90a8f205 100644 --- a/engines/titanic/gfx/music_switch.h +++ b/engines/titanic/gfx/music_switch.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/music_switch_inversion.h b/engines/titanic/gfx/music_switch_inversion.h index 6aea692f61..052c812897 100644 --- a/engines/titanic/gfx/music_switch_inversion.h +++ b/engines/titanic/gfx/music_switch_inversion.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const { + virtual void save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CMusicSwitch::save(file, indent); } diff --git a/engines/titanic/gfx/music_switch_reverse.h b/engines/titanic/gfx/music_switch_reverse.h index 99460f1845..5a6208cede 100644 --- a/engines/titanic/gfx/music_switch_reverse.h +++ b/engines/titanic/gfx/music_switch_reverse.h @@ -34,7 +34,7 @@ namespace Titanic { /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const { + virtual void save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CMusicSwitch::save(file, indent); } diff --git a/engines/titanic/gfx/music_voice_mute.h b/engines/titanic/gfx/music_voice_mute.h index 2198b96e42..85aeda869c 100644 --- a/engines/titanic/gfx/music_voice_mute.h +++ b/engines/titanic/gfx/music_voice_mute.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const { + virtual void save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CMusicControl::save(file, indent); } diff --git a/engines/titanic/gfx/send_to_succ.cpp b/engines/titanic/gfx/send_to_succ.cpp index 938fa7c3a9..3054191e94 100644 --- a/engines/titanic/gfx/send_to_succ.cpp +++ b/engines/titanic/gfx/send_to_succ.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CSendToSucc, CToggleSwitch) CSendToSucc::CSendToSucc() : CToggleSwitch() { } -void CSendToSucc::save(SimpleFile *file, int indent) const { +void CSendToSucc::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CToggleSwitch::save(file, indent); } diff --git a/engines/titanic/gfx/send_to_succ.h b/engines/titanic/gfx/send_to_succ.h index 65868cd83d..1b8d17741e 100644 --- a/engines/titanic/gfx/send_to_succ.h +++ b/engines/titanic/gfx/send_to_succ.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/sgt_selector.cpp b/engines/titanic/gfx/sgt_selector.cpp index 170b0f4712..c7b52f8b03 100644 --- a/engines/titanic/gfx/sgt_selector.cpp +++ b/engines/titanic/gfx/sgt_selector.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CSGTSelector, CPetGraphic) -void CSGTSelector::save(SimpleFile *file, int indent) const { +void CSGTSelector::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CPetGraphic::save(file, indent); } diff --git a/engines/titanic/gfx/sgt_selector.h b/engines/titanic/gfx/sgt_selector.h index 82757fa3b9..c6d2a167d2 100644 --- a/engines/titanic/gfx/sgt_selector.h +++ b/engines/titanic/gfx/sgt_selector.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/slider_button.cpp b/engines/titanic/gfx/slider_button.cpp index bcd9adde57..0633158e97 100644 --- a/engines/titanic/gfx/slider_button.cpp +++ b/engines/titanic/gfx/slider_button.cpp @@ -28,7 +28,7 @@ CSliderButton::CSliderButton() : CSTButton(), _field114(0), _field118(0), _field11C(0) { } -void CSliderButton::save(SimpleFile *file, int indent) const { +void CSliderButton::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_field114, indent); file->writeNumberLine(_field118, indent); diff --git a/engines/titanic/gfx/slider_button.h b/engines/titanic/gfx/slider_button.h index 2fdf448d09..3bd33aa2ba 100644 --- a/engines/titanic/gfx/slider_button.h +++ b/engines/titanic/gfx/slider_button.h @@ -40,7 +40,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/small_chev_left_off.cpp b/engines/titanic/gfx/small_chev_left_off.cpp index 8647ad8fe4..b0b22e9928 100644 --- a/engines/titanic/gfx/small_chev_left_off.cpp +++ b/engines/titanic/gfx/small_chev_left_off.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CSmallChevLeftOff, CToggleSwitch) CSmallChevLeftOff::CSmallChevLeftOff() : CToggleSwitch() { } -void CSmallChevLeftOff::save(SimpleFile *file, int indent) const { +void CSmallChevLeftOff::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CToggleSwitch::save(file, indent); } diff --git a/engines/titanic/gfx/small_chev_left_off.h b/engines/titanic/gfx/small_chev_left_off.h index 27c40017ad..a164235828 100644 --- a/engines/titanic/gfx/small_chev_left_off.h +++ b/engines/titanic/gfx/small_chev_left_off.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/small_chev_left_on.cpp b/engines/titanic/gfx/small_chev_left_on.cpp index b5031e922e..a2df2b524c 100644 --- a/engines/titanic/gfx/small_chev_left_on.cpp +++ b/engines/titanic/gfx/small_chev_left_on.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CSmallChevLeftOn, CToggleSwitch) CSmallChevLeftOn::CSmallChevLeftOn() : CToggleSwitch() { } -void CSmallChevLeftOn::save(SimpleFile *file, int indent) const { +void CSmallChevLeftOn::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CToggleSwitch::save(file, indent); } diff --git a/engines/titanic/gfx/small_chev_left_on.h b/engines/titanic/gfx/small_chev_left_on.h index 7b60857e67..ab9414727d 100644 --- a/engines/titanic/gfx/small_chev_left_on.h +++ b/engines/titanic/gfx/small_chev_left_on.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/small_chev_right_off.cpp b/engines/titanic/gfx/small_chev_right_off.cpp index 6d0c08eb8e..48f0941c95 100644 --- a/engines/titanic/gfx/small_chev_right_off.cpp +++ b/engines/titanic/gfx/small_chev_right_off.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CSmallChevRightOff, CToggleSwitch) CSmallChevRightOff::CSmallChevRightOff() : CToggleSwitch() { } -void CSmallChevRightOff::save(SimpleFile *file, int indent) const { +void CSmallChevRightOff::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CToggleSwitch::save(file, indent); } diff --git a/engines/titanic/gfx/small_chev_right_off.h b/engines/titanic/gfx/small_chev_right_off.h index 0dadae1e07..3283eb2606 100644 --- a/engines/titanic/gfx/small_chev_right_off.h +++ b/engines/titanic/gfx/small_chev_right_off.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/small_chev_right_on.cpp b/engines/titanic/gfx/small_chev_right_on.cpp index 552990d0b8..af794fa428 100644 --- a/engines/titanic/gfx/small_chev_right_on.cpp +++ b/engines/titanic/gfx/small_chev_right_on.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CSmallChevRightOn, CToggleSwitch) CSmallChevRightOn::CSmallChevRightOn() : CToggleSwitch() { } -void CSmallChevRightOn::save(SimpleFile *file, int indent) const { +void CSmallChevRightOn::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CToggleSwitch::save(file, indent); } diff --git a/engines/titanic/gfx/small_chev_right_on.h b/engines/titanic/gfx/small_chev_right_on.h index ea042d30ee..fe522c45cb 100644 --- a/engines/titanic/gfx/small_chev_right_on.h +++ b/engines/titanic/gfx/small_chev_right_on.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/st_button.cpp b/engines/titanic/gfx/st_button.cpp index b45d990c31..4b93d46595 100644 --- a/engines/titanic/gfx/st_button.cpp +++ b/engines/titanic/gfx/st_button.cpp @@ -40,7 +40,7 @@ CSTButton::CSTButton() : CBackground() { _buttonFrame = 0; } -void CSTButton::save(SimpleFile *file, int indent) const { +void CSTButton::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_statusInc, indent); file->writeQuotedLine(_statusTarget, indent); diff --git a/engines/titanic/gfx/st_button.h b/engines/titanic/gfx/st_button.h index e2f9aa3ea1..b3bd5e82ad 100644 --- a/engines/titanic/gfx/st_button.h +++ b/engines/titanic/gfx/st_button.h @@ -49,7 +49,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/status_change_button.cpp b/engines/titanic/gfx/status_change_button.cpp index 36037a2564..6644247ff2 100644 --- a/engines/titanic/gfx/status_change_button.cpp +++ b/engines/titanic/gfx/status_change_button.cpp @@ -27,7 +27,7 @@ namespace Titanic { CStatusChangeButton::CStatusChangeButton() : CSTButton() { } -void CStatusChangeButton::save(SimpleFile *file, int indent) const { +void CStatusChangeButton::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CSTButton::save(file, indent); } diff --git a/engines/titanic/gfx/status_change_button.h b/engines/titanic/gfx/status_change_button.h index be0d9985b2..818f21e056 100644 --- a/engines/titanic/gfx/status_change_button.h +++ b/engines/titanic/gfx/status_change_button.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/text_down.cpp b/engines/titanic/gfx/text_down.cpp index 967d60f495..4a68752922 100644 --- a/engines/titanic/gfx/text_down.cpp +++ b/engines/titanic/gfx/text_down.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CTextDown, CPetGraphic) -void CTextDown::save(SimpleFile *file, int indent) const { +void CTextDown::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CPetGraphic::save(file, indent); } diff --git a/engines/titanic/gfx/text_down.h b/engines/titanic/gfx/text_down.h index 920ea8c958..04805e714a 100644 --- a/engines/titanic/gfx/text_down.h +++ b/engines/titanic/gfx/text_down.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/text_skrew.cpp b/engines/titanic/gfx/text_skrew.cpp index 30cc7f407b..391ed3796f 100644 --- a/engines/titanic/gfx/text_skrew.cpp +++ b/engines/titanic/gfx/text_skrew.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CTextSkrew, CPetGraphic) -void CTextSkrew::save(SimpleFile *file, int indent) const { +void CTextSkrew::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CPetGraphic::save(file, indent); } diff --git a/engines/titanic/gfx/text_skrew.h b/engines/titanic/gfx/text_skrew.h index 6e86e70825..a9326336bb 100644 --- a/engines/titanic/gfx/text_skrew.h +++ b/engines/titanic/gfx/text_skrew.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/text_up.cpp b/engines/titanic/gfx/text_up.cpp index 0cb4153f25..d5e2b1bab3 100644 --- a/engines/titanic/gfx/text_up.cpp +++ b/engines/titanic/gfx/text_up.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CTextUp, CPetGraphic) -void CTextUp::save(SimpleFile *file, int indent) const { +void CTextUp::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CPetGraphic::save(file, indent); } diff --git a/engines/titanic/gfx/text_up.h b/engines/titanic/gfx/text_up.h index 05a54bc45a..19f150b600 100644 --- a/engines/titanic/gfx/text_up.h +++ b/engines/titanic/gfx/text_up.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/toggle_button.cpp b/engines/titanic/gfx/toggle_button.cpp index 3bb2e967e9..78e53569de 100644 --- a/engines/titanic/gfx/toggle_button.cpp +++ b/engines/titanic/gfx/toggle_button.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CToggleButton, CBackground) -void CToggleButton::save(SimpleFile *file, int indent) const { +void CToggleButton::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); diff --git a/engines/titanic/gfx/toggle_button.h b/engines/titanic/gfx/toggle_button.h index ac0bb69b9d..b82e255029 100644 --- a/engines/titanic/gfx/toggle_button.h +++ b/engines/titanic/gfx/toggle_button.h @@ -38,7 +38,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/gfx/toggle_switch.cpp b/engines/titanic/gfx/toggle_switch.cpp index 330714693f..20cbb863ee 100644 --- a/engines/titanic/gfx/toggle_switch.cpp +++ b/engines/titanic/gfx/toggle_switch.cpp @@ -27,7 +27,7 @@ namespace Titanic { CToggleSwitch::CToggleSwitch() : CGameObject(), _fieldBC(0) { } -void CToggleSwitch::save(SimpleFile *file, int indent) const { +void CToggleSwitch::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); file->writePoint(_pos1, indent); diff --git a/engines/titanic/gfx/toggle_switch.h b/engines/titanic/gfx/toggle_switch.h index cc369f6281..ce39feefda 100644 --- a/engines/titanic/gfx/toggle_switch.h +++ b/engines/titanic/gfx/toggle_switch.h @@ -38,7 +38,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/messages/auto_sound_event.cpp b/engines/titanic/messages/auto_sound_event.cpp index 006762c49b..baa11c7d41 100644 --- a/engines/titanic/messages/auto_sound_event.cpp +++ b/engines/titanic/messages/auto_sound_event.cpp @@ -27,7 +27,7 @@ namespace Titanic { CAutoSoundEvent::CAutoSoundEvent() : CGameObject(), _value1(0), _value2(70) { } -void CAutoSoundEvent::save(SimpleFile *file, int indent) const { +void CAutoSoundEvent::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value1, indent); file->writeNumberLine(_value2, indent); diff --git a/engines/titanic/messages/auto_sound_event.h b/engines/titanic/messages/auto_sound_event.h index 03baba354f..599404de9e 100644 --- a/engines/titanic/messages/auto_sound_event.h +++ b/engines/titanic/messages/auto_sound_event.h @@ -38,7 +38,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/messages/bilge_auto_sound_event.cpp b/engines/titanic/messages/bilge_auto_sound_event.cpp index 7bc91da0bc..fa87b4b79c 100644 --- a/engines/titanic/messages/bilge_auto_sound_event.cpp +++ b/engines/titanic/messages/bilge_auto_sound_event.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CBilgeAutoSoundEvent::save(SimpleFile *file, int indent) const { +void CBilgeAutoSoundEvent::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CAutoSoundEvent::save(file, indent); } diff --git a/engines/titanic/messages/bilge_auto_sound_event.h b/engines/titanic/messages/bilge_auto_sound_event.h index e51f74bfa5..5d322820ac 100644 --- a/engines/titanic/messages/bilge_auto_sound_event.h +++ b/engines/titanic/messages/bilge_auto_sound_event.h @@ -34,7 +34,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/messages/bilge_dispensor_event.cpp b/engines/titanic/messages/bilge_dispensor_event.cpp index f0daa7aa5e..043ffe75d3 100644 --- a/engines/titanic/messages/bilge_dispensor_event.cpp +++ b/engines/titanic/messages/bilge_dispensor_event.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CBilgeDispensorEvent::save(SimpleFile *file, int indent) const { +void CBilgeDispensorEvent::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CAutoSoundEvent::save(file, indent); } diff --git a/engines/titanic/messages/bilge_dispensor_event.h b/engines/titanic/messages/bilge_dispensor_event.h index df6e1127c1..8616373174 100644 --- a/engines/titanic/messages/bilge_dispensor_event.h +++ b/engines/titanic/messages/bilge_dispensor_event.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/messages/door_auto_sound_event.cpp b/engines/titanic/messages/door_auto_sound_event.cpp index ff9101f506..b9cedae6de 100644 --- a/engines/titanic/messages/door_auto_sound_event.cpp +++ b/engines/titanic/messages/door_auto_sound_event.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CDoorAutoSoundEvent::save(SimpleFile *file, int indent) const { +void CDoorAutoSoundEvent::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string1, indent); file->writeQuotedLine(_string2, indent); diff --git a/engines/titanic/messages/door_auto_sound_event.h b/engines/titanic/messages/door_auto_sound_event.h index cccc3fff9d..9b3ebbc3bc 100644 --- a/engines/titanic/messages/door_auto_sound_event.h +++ b/engines/titanic/messages/door_auto_sound_event.h @@ -42,7 +42,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/messages/messages.cpp b/engines/titanic/messages/messages.cpp index e25c22fc7e..5f587c975d 100644 --- a/engines/titanic/messages/messages.cpp +++ b/engines/titanic/messages/messages.cpp @@ -32,7 +32,7 @@ namespace Titanic { CMessage::CMessage() : CSaveableObject() { } -void CMessage::save(SimpleFile *file, int indent) const { +void CMessage::save(SimpleFile *file, int indent) { file->writeNumberLine(0, indent); } diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index d456714179..278fac1fbd 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -123,7 +123,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/messages/service_elevator_door.cpp b/engines/titanic/messages/service_elevator_door.cpp index e771f14484..748790e4aa 100644 --- a/engines/titanic/messages/service_elevator_door.cpp +++ b/engines/titanic/messages/service_elevator_door.cpp @@ -29,7 +29,7 @@ CServiceElevatorDoor::CServiceElevatorDoor() : CDoorAutoSoundEvent() { _string2 = "z#32.wav"; } -void CServiceElevatorDoor::save(SimpleFile *file, int indent) const { +void CServiceElevatorDoor::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string2, indent); file->writeQuotedLine(_string1, indent); diff --git a/engines/titanic/messages/service_elevator_door.h b/engines/titanic/messages/service_elevator_door.h index ac5cf5148d..104b5735f1 100644 --- a/engines/titanic/messages/service_elevator_door.h +++ b/engines/titanic/messages/service_elevator_door.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/moves/enter_bomb_room.cpp b/engines/titanic/moves/enter_bomb_room.cpp index e989d47114..55b838d026 100644 --- a/engines/titanic/moves/enter_bomb_room.cpp +++ b/engines/titanic/moves/enter_bomb_room.cpp @@ -27,7 +27,7 @@ namespace Titanic { CEnterBombRoom::CEnterBombRoom() : CMovePlayerTo(), _fieldC8(0) { } -void CEnterBombRoom::save(SimpleFile *file, int indent) const { +void CEnterBombRoom::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CMovePlayerTo::save(file, indent); } diff --git a/engines/titanic/moves/enter_bomb_room.h b/engines/titanic/moves/enter_bomb_room.h index dabde2e308..d49b17688a 100644 --- a/engines/titanic/moves/enter_bomb_room.h +++ b/engines/titanic/moves/enter_bomb_room.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/moves/enter_bridge.cpp b/engines/titanic/moves/enter_bridge.cpp index f5269348a9..2600ee699f 100644 --- a/engines/titanic/moves/enter_bridge.cpp +++ b/engines/titanic/moves/enter_bridge.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CEnterBridge::save(SimpleFile *file, int indent) const { +void CEnterBridge::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/moves/enter_bridge.h b/engines/titanic/moves/enter_bridge.h index fee299adf0..86cc2f3dca 100644 --- a/engines/titanic/moves/enter_bridge.h +++ b/engines/titanic/moves/enter_bridge.h @@ -39,7 +39,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/moves/enter_exit_first_class_state.cpp b/engines/titanic/moves/enter_exit_first_class_state.cpp index ed80947c07..0e2c6c0b6c 100644 --- a/engines/titanic/moves/enter_exit_first_class_state.cpp +++ b/engines/titanic/moves/enter_exit_first_class_state.cpp @@ -34,7 +34,7 @@ void CEnterExitFirstClassState::deinit() { delete _v1; } -void CEnterExitFirstClassState::save(SimpleFile *file, int indent) const { +void CEnterExitFirstClassState::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(*_v1, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/moves/enter_exit_first_class_state.h b/engines/titanic/moves/enter_exit_first_class_state.h index 728395d20c..2038084214 100644 --- a/engines/titanic/moves/enter_exit_first_class_state.h +++ b/engines/titanic/moves/enter_exit_first_class_state.h @@ -46,7 +46,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/moves/enter_exit_mini_lift.cpp b/engines/titanic/moves/enter_exit_mini_lift.cpp index b6a1423875..eb56bdb3bd 100644 --- a/engines/titanic/moves/enter_exit_mini_lift.cpp +++ b/engines/titanic/moves/enter_exit_mini_lift.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CEnterExitMiniLift::save(SimpleFile *file, int indent) const { +void CEnterExitMiniLift::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); file->writeNumberLine(_fieldC0, indent); diff --git a/engines/titanic/moves/enter_exit_mini_lift.h b/engines/titanic/moves/enter_exit_mini_lift.h index 5a91d397f9..e973cf8f8f 100644 --- a/engines/titanic/moves/enter_exit_mini_lift.h +++ b/engines/titanic/moves/enter_exit_mini_lift.h @@ -38,7 +38,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/moves/enter_exit_sec_class_mini_lift.cpp b/engines/titanic/moves/enter_exit_sec_class_mini_lift.cpp index f993d26797..b571a255c5 100644 --- a/engines/titanic/moves/enter_exit_sec_class_mini_lift.cpp +++ b/engines/titanic/moves/enter_exit_sec_class_mini_lift.cpp @@ -34,7 +34,7 @@ void CEnterExitSecClassMiniLift::deinit() { delete _statics; } -void CEnterExitSecClassMiniLift::save(SimpleFile *file, int indent) const { +void CEnterExitSecClassMiniLift::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_statics->_v1, indent); file->writeNumberLine(_statics->_v2, indent); diff --git a/engines/titanic/moves/enter_exit_sec_class_mini_lift.h b/engines/titanic/moves/enter_exit_sec_class_mini_lift.h index a1081c2836..935dfb7079 100644 --- a/engines/titanic/moves/enter_exit_sec_class_mini_lift.h +++ b/engines/titanic/moves/enter_exit_sec_class_mini_lift.h @@ -47,7 +47,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/moves/enter_exit_view.cpp b/engines/titanic/moves/enter_exit_view.cpp index 3e5789eebe..825156acce 100644 --- a/engines/titanic/moves/enter_exit_view.cpp +++ b/engines/titanic/moves/enter_exit_view.cpp @@ -28,7 +28,7 @@ CEnterExitView::CEnterExitView() : CGameObject(), _fieldBC(0), _fieldC0(0), _fieldC4(0), _fieldC8(0), _fieldCC(0) { } -void CEnterExitView::save(SimpleFile *file, int indent) const { +void CEnterExitView::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); file->writeNumberLine(_fieldC0, indent); diff --git a/engines/titanic/moves/enter_exit_view.h b/engines/titanic/moves/enter_exit_view.h index e967723558..774c72e512 100644 --- a/engines/titanic/moves/enter_exit_view.h +++ b/engines/titanic/moves/enter_exit_view.h @@ -41,7 +41,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/moves/enter_sec_class_state.cpp b/engines/titanic/moves/enter_sec_class_state.cpp index 74f6176650..dced724de7 100644 --- a/engines/titanic/moves/enter_sec_class_state.cpp +++ b/engines/titanic/moves/enter_sec_class_state.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CEnterSecClassState::save(SimpleFile *file, int indent) const { +void CEnterSecClassState::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value1, indent); file->writeNumberLine(_value2, indent); diff --git a/engines/titanic/moves/enter_sec_class_state.h b/engines/titanic/moves/enter_sec_class_state.h index 2e80939976..3eadfa2717 100644 --- a/engines/titanic/moves/enter_sec_class_state.h +++ b/engines/titanic/moves/enter_sec_class_state.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/moves/exit_arboretum.cpp b/engines/titanic/moves/exit_arboretum.cpp index 2b5b497f5c..d606510c6e 100644 --- a/engines/titanic/moves/exit_arboretum.cpp +++ b/engines/titanic/moves/exit_arboretum.cpp @@ -28,7 +28,7 @@ CExitArboretum::CExitArboretum() : CMovePlayerTo(), _fieldC8(0), _fieldCC(0), _fieldD0(1) { } -void CExitArboretum::save(SimpleFile *file, int indent) const { +void CExitArboretum::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldC8, indent); file->writeNumberLine(_fieldCC, indent); diff --git a/engines/titanic/moves/exit_arboretum.h b/engines/titanic/moves/exit_arboretum.h index 0da67dd5a0..a20cf46fff 100644 --- a/engines/titanic/moves/exit_arboretum.h +++ b/engines/titanic/moves/exit_arboretum.h @@ -39,7 +39,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/moves/exit_bridge.cpp b/engines/titanic/moves/exit_bridge.cpp index 99138f946e..2ff56d30ec 100644 --- a/engines/titanic/moves/exit_bridge.cpp +++ b/engines/titanic/moves/exit_bridge.cpp @@ -27,7 +27,7 @@ namespace Titanic { CExitBridge::CExitBridge() : CMovePlayerTo() { } -void CExitBridge::save(SimpleFile *file, int indent) const { +void CExitBridge::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CMovePlayerTo::save(file, indent); } diff --git a/engines/titanic/moves/exit_bridge.h b/engines/titanic/moves/exit_bridge.h index 9231728e12..b5fcd9af27 100644 --- a/engines/titanic/moves/exit_bridge.h +++ b/engines/titanic/moves/exit_bridge.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/moves/exit_lift.cpp b/engines/titanic/moves/exit_lift.cpp index 376b9e04f1..a264be883d 100644 --- a/engines/titanic/moves/exit_lift.cpp +++ b/engines/titanic/moves/exit_lift.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CExitLift::save(SimpleFile *file, int indent) const { +void CExitLift::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_value, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/moves/exit_lift.h b/engines/titanic/moves/exit_lift.h index e97f041804..6144d4325d 100644 --- a/engines/titanic/moves/exit_lift.h +++ b/engines/titanic/moves/exit_lift.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/moves/exit_pellerator.cpp b/engines/titanic/moves/exit_pellerator.cpp index 7c0a52b2ae..68a2a8da91 100644 --- a/engines/titanic/moves/exit_pellerator.cpp +++ b/engines/titanic/moves/exit_pellerator.cpp @@ -34,7 +34,7 @@ void CExitPellerator::deinit() { delete _statics; } -void CExitPellerator::save(SimpleFile *file, int indent) const { +void CExitPellerator::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_statics->_v1, indent); file->writeNumberLine(_statics->_v2, indent); diff --git a/engines/titanic/moves/exit_pellerator.h b/engines/titanic/moves/exit_pellerator.h index 3ae70dbed8..36108314bd 100644 --- a/engines/titanic/moves/exit_pellerator.h +++ b/engines/titanic/moves/exit_pellerator.h @@ -44,7 +44,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/moves/exit_state_room.cpp b/engines/titanic/moves/exit_state_room.cpp index 0dc4a4f967..1c78a69ac2 100644 --- a/engines/titanic/moves/exit_state_room.cpp +++ b/engines/titanic/moves/exit_state_room.cpp @@ -27,7 +27,7 @@ namespace Titanic { CExitStateRoom::CExitStateRoom() : CMovePlayerTo(), _fieldC8(0) { } -void CExitStateRoom::save(SimpleFile *file, int indent) const { +void CExitStateRoom::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CMovePlayerTo::save(file, indent); } diff --git a/engines/titanic/moves/exit_state_room.h b/engines/titanic/moves/exit_state_room.h index ccf52ce3f3..ac94297986 100644 --- a/engines/titanic/moves/exit_state_room.h +++ b/engines/titanic/moves/exit_state_room.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/moves/exit_tiania.cpp b/engines/titanic/moves/exit_tiania.cpp index 99b6c96db7..6cb2422b1f 100644 --- a/engines/titanic/moves/exit_tiania.cpp +++ b/engines/titanic/moves/exit_tiania.cpp @@ -28,7 +28,7 @@ CExitTiania::CExitTiania() : CMovePlayerTo(), _fieldC8(0), _string1("NULL"), _string2("NULL"), _string3("NULL") { } -void CExitTiania::save(SimpleFile *file, int indent) const { +void CExitTiania::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldC8, indent); file->writeQuotedLine(_string1, indent); diff --git a/engines/titanic/moves/exit_tiania.h b/engines/titanic/moves/exit_tiania.h index 3af5aadc2e..6ae3bc8406 100644 --- a/engines/titanic/moves/exit_tiania.h +++ b/engines/titanic/moves/exit_tiania.h @@ -40,7 +40,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/moves/move_player_in_parrot_room.cpp b/engines/titanic/moves/move_player_in_parrot_room.cpp index 91c1706abf..df38c63cd4 100644 --- a/engines/titanic/moves/move_player_in_parrot_room.cpp +++ b/engines/titanic/moves/move_player_in_parrot_room.cpp @@ -27,7 +27,7 @@ namespace Titanic { CMovePlayerInParrotRoom::CMovePlayerInParrotRoom() : CMovePlayerTo() { } -void CMovePlayerInParrotRoom::save(SimpleFile *file, int indent) const { +void CMovePlayerInParrotRoom::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CMovePlayerTo::save(file, indent); } diff --git a/engines/titanic/moves/move_player_in_parrot_room.h b/engines/titanic/moves/move_player_in_parrot_room.h index 5339a60a9c..cdb00070a8 100644 --- a/engines/titanic/moves/move_player_in_parrot_room.h +++ b/engines/titanic/moves/move_player_in_parrot_room.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/moves/move_player_to.cpp b/engines/titanic/moves/move_player_to.cpp index 8ce8f77896..9b6000c4f8 100644 --- a/engines/titanic/moves/move_player_to.cpp +++ b/engines/titanic/moves/move_player_to.cpp @@ -27,7 +27,7 @@ namespace Titanic { CMovePlayerTo::CMovePlayerTo() : CGameObject() { } -void CMovePlayerTo::save(SimpleFile *file, int indent) const { +void CMovePlayerTo::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_destination, indent); diff --git a/engines/titanic/moves/move_player_to.h b/engines/titanic/moves/move_player_to.h index 2617b46097..890c822acd 100644 --- a/engines/titanic/moves/move_player_to.h +++ b/engines/titanic/moves/move_player_to.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/moves/move_player_to_from.cpp b/engines/titanic/moves/move_player_to_from.cpp index f349c5c265..1a67dc8505 100644 --- a/engines/titanic/moves/move_player_to_from.cpp +++ b/engines/titanic/moves/move_player_to_from.cpp @@ -27,7 +27,7 @@ namespace Titanic { CMovePlayerToFrom::CMovePlayerToFrom() : CGameObject() { } -void CMovePlayerToFrom::save(SimpleFile *file, int indent) const { +void CMovePlayerToFrom::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string2, indent); diff --git a/engines/titanic/moves/move_player_to_from.h b/engines/titanic/moves/move_player_to_from.h index bc1878af38..14c6e3ae25 100644 --- a/engines/titanic/moves/move_player_to_from.h +++ b/engines/titanic/moves/move_player_to_from.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/moves/multi_move.cpp b/engines/titanic/moves/multi_move.cpp index 6b35b88654..fb5570df9b 100644 --- a/engines/titanic/moves/multi_move.cpp +++ b/engines/titanic/moves/multi_move.cpp @@ -27,7 +27,7 @@ namespace Titanic { CMultiMove::CMultiMove() : CMovePlayerTo() { } -void CMultiMove::save(SimpleFile *file, int indent) const { +void CMultiMove::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string1, indent); file->writeQuotedLine(_string2, indent); diff --git a/engines/titanic/moves/multi_move.h b/engines/titanic/moves/multi_move.h index a06632df52..a18eb7676f 100644 --- a/engines/titanic/moves/multi_move.h +++ b/engines/titanic/moves/multi_move.h @@ -41,7 +41,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/moves/pan_from_pel.cpp b/engines/titanic/moves/pan_from_pel.cpp index db3c9bf49c..fccc643ec5 100644 --- a/engines/titanic/moves/pan_from_pel.cpp +++ b/engines/titanic/moves/pan_from_pel.cpp @@ -27,7 +27,7 @@ namespace Titanic { CPanFromPel::CPanFromPel() : CMovePlayerTo(), _fieldC8(0) { } -void CPanFromPel::save(SimpleFile *file, int indent) const { +void CPanFromPel::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldC8, indent); file->writeQuotedLine(_string1, indent); diff --git a/engines/titanic/moves/pan_from_pel.h b/engines/titanic/moves/pan_from_pel.h index b94f5166d7..936bac8764 100644 --- a/engines/titanic/moves/pan_from_pel.h +++ b/engines/titanic/moves/pan_from_pel.h @@ -38,7 +38,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/moves/restaurant_pan_handler.cpp b/engines/titanic/moves/restaurant_pan_handler.cpp index 8efc5cbe65..92f55b46cc 100644 --- a/engines/titanic/moves/restaurant_pan_handler.cpp +++ b/engines/titanic/moves/restaurant_pan_handler.cpp @@ -26,7 +26,7 @@ namespace Titanic { int CRestaurantPanHandler::_v1; -void CRestaurantPanHandler::save(SimpleFile *file, int indent) const { +void CRestaurantPanHandler::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_v1, indent); file->writeQuotedLine(_string1, indent); diff --git a/engines/titanic/moves/restaurant_pan_handler.h b/engines/titanic/moves/restaurant_pan_handler.h index 29f7832b74..2caf286d6c 100644 --- a/engines/titanic/moves/restaurant_pan_handler.h +++ b/engines/titanic/moves/restaurant_pan_handler.h @@ -39,7 +39,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/moves/restricted_move.cpp b/engines/titanic/moves/restricted_move.cpp index d6a046d30c..5f18dab8ff 100644 --- a/engines/titanic/moves/restricted_move.cpp +++ b/engines/titanic/moves/restricted_move.cpp @@ -27,7 +27,7 @@ namespace Titanic { CRestrictedMove::CRestrictedMove() : CMovePlayerTo(), _fieldC8(0) { } -void CRestrictedMove::save(SimpleFile *file, int indent) const { +void CRestrictedMove::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldC8, indent); diff --git a/engines/titanic/moves/restricted_move.h b/engines/titanic/moves/restricted_move.h index ef95e0f5b5..59ff69ff3f 100644 --- a/engines/titanic/moves/restricted_move.h +++ b/engines/titanic/moves/restricted_move.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/moves/scraliontis_table.cpp b/engines/titanic/moves/scraliontis_table.cpp index d67b2f3622..77d2f9df60 100644 --- a/engines/titanic/moves/scraliontis_table.cpp +++ b/engines/titanic/moves/scraliontis_table.cpp @@ -28,7 +28,7 @@ CScraliontisTable::CScraliontisTable() : CRestaurantPanHandler(), _fieldE0(0), _fieldE4(0), _fieldE8(0), _fieldEC(0) { } -void CScraliontisTable::save(SimpleFile *file, int indent) const { +void CScraliontisTable::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldE0, indent); file->writeNumberLine(_fieldE4, indent); diff --git a/engines/titanic/moves/scraliontis_table.h b/engines/titanic/moves/scraliontis_table.h index 53b000646b..a1b8052bfc 100644 --- a/engines/titanic/moves/scraliontis_table.h +++ b/engines/titanic/moves/scraliontis_table.h @@ -40,7 +40,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/moves/trip_down_canal.cpp b/engines/titanic/moves/trip_down_canal.cpp index 349a7e945c..c8051dda03 100644 --- a/engines/titanic/moves/trip_down_canal.cpp +++ b/engines/titanic/moves/trip_down_canal.cpp @@ -27,7 +27,7 @@ namespace Titanic { CTripDownCanal::CTripDownCanal() : CMovePlayerTo() { } -void CTripDownCanal::save(SimpleFile *file, int indent) const { +void CTripDownCanal::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CMovePlayerTo::save(file, indent); } diff --git a/engines/titanic/moves/trip_down_canal.h b/engines/titanic/moves/trip_down_canal.h index 80d5dcf706..debe064287 100644 --- a/engines/titanic/moves/trip_down_canal.h +++ b/engines/titanic/moves/trip_down_canal.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/npcs/barbot.cpp b/engines/titanic/npcs/barbot.cpp index 8abf41d426..8f1c5e6ab3 100644 --- a/engines/titanic/npcs/barbot.cpp +++ b/engines/titanic/npcs/barbot.cpp @@ -171,7 +171,7 @@ CBarbot::CBarbot() : CTrueTalkNPC() { _field340 = 95; } -void CBarbot::save(SimpleFile *file, int indent) const { +void CBarbot::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_field108, indent); file->writeNumberLine(_field10C, indent); diff --git a/engines/titanic/npcs/barbot.h b/engines/titanic/npcs/barbot.h index fa06f8f638..27a091ef29 100644 --- a/engines/titanic/npcs/barbot.h +++ b/engines/titanic/npcs/barbot.h @@ -181,7 +181,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/npcs/bellbot.cpp b/engines/titanic/npcs/bellbot.cpp index 48747228f8..7ee0128a1e 100644 --- a/engines/titanic/npcs/bellbot.cpp +++ b/engines/titanic/npcs/bellbot.cpp @@ -27,7 +27,7 @@ namespace Titanic { CBellBot::CBellBot() : CTrueTalkNPC(), _field108(0) { } -void CBellBot::save(SimpleFile *file, int indent) const { +void CBellBot::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_field108, indent); diff --git a/engines/titanic/npcs/bellbot.h b/engines/titanic/npcs/bellbot.h index c3d38f65ec..6be0615303 100644 --- a/engines/titanic/npcs/bellbot.h +++ b/engines/titanic/npcs/bellbot.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/npcs/callbot.cpp b/engines/titanic/npcs/callbot.cpp index 3fb7ee2f59..eb0d4b71d5 100644 --- a/engines/titanic/npcs/callbot.cpp +++ b/engines/titanic/npcs/callbot.cpp @@ -27,7 +27,7 @@ namespace Titanic { CCallBot::CCallBot() : CGameObject(), _fieldC8(0) { } -void CCallBot::save(SimpleFile *file, int indent) const { +void CCallBot::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string1, indent); file->writeNumberLine(_fieldC8, indent); diff --git a/engines/titanic/npcs/callbot.h b/engines/titanic/npcs/callbot.h index 299a329c07..6848121529 100644 --- a/engines/titanic/npcs/callbot.h +++ b/engines/titanic/npcs/callbot.h @@ -38,7 +38,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/npcs/character.cpp b/engines/titanic/npcs/character.cpp index df905d98b3..ed36db16d3 100644 --- a/engines/titanic/npcs/character.cpp +++ b/engines/titanic/npcs/character.cpp @@ -33,7 +33,7 @@ END_MESSAGE_MAP() CCharacter::CCharacter() : CGameObject(), _fieldBC(0), _fieldC0(0), _fieldC4(1) { } -void CCharacter::save(SimpleFile *file, int indent) const { +void CCharacter::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); file->writeNumberLine(_fieldC0, indent); diff --git a/engines/titanic/npcs/character.h b/engines/titanic/npcs/character.h index c0cc8ff65f..2362f01dac 100644 --- a/engines/titanic/npcs/character.h +++ b/engines/titanic/npcs/character.h @@ -44,7 +44,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/npcs/deskbot.cpp b/engines/titanic/npcs/deskbot.cpp index 3fe92367ce..d11b135983 100644 --- a/engines/titanic/npcs/deskbot.cpp +++ b/engines/titanic/npcs/deskbot.cpp @@ -55,7 +55,7 @@ int CDeskbot::_v2; CDeskbot::CDeskbot() : CTrueTalkNPC(), _deskbotActive(false), _classNum(0) { } -void CDeskbot::save(SimpleFile *file, int indent) const { +void CDeskbot::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_v1, indent); file->writeNumberLine(_v2, indent); diff --git a/engines/titanic/npcs/deskbot.h b/engines/titanic/npcs/deskbot.h index 3e155f6788..ff5459910b 100644 --- a/engines/titanic/npcs/deskbot.h +++ b/engines/titanic/npcs/deskbot.h @@ -53,7 +53,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/npcs/doorbot.cpp b/engines/titanic/npcs/doorbot.cpp index 17db94f2d7..76db55f92c 100644 --- a/engines/titanic/npcs/doorbot.cpp +++ b/engines/titanic/npcs/doorbot.cpp @@ -34,7 +34,7 @@ CDoorbot::CDoorbot() : CTrueTalkNPC() { _field114 = 0; } -void CDoorbot::save(SimpleFile *file, int indent) const { +void CDoorbot::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_v1, indent); file->writeNumberLine(_v2, indent); diff --git a/engines/titanic/npcs/doorbot.h b/engines/titanic/npcs/doorbot.h index f0c46e5a16..9ea7de6c77 100644 --- a/engines/titanic/npcs/doorbot.h +++ b/engines/titanic/npcs/doorbot.h @@ -43,7 +43,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/npcs/liftbot.cpp b/engines/titanic/npcs/liftbot.cpp index 0125406d6a..43daa017c1 100644 --- a/engines/titanic/npcs/liftbot.cpp +++ b/engines/titanic/npcs/liftbot.cpp @@ -30,7 +30,7 @@ int CLiftBot::_v2; CLiftBot::CLiftBot() : CTrueTalkNPC(), _field108(1) { } -void CLiftBot::save(SimpleFile *file, int indent) const { +void CLiftBot::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_v1, indent); file->writeNumberLine(_field108, indent); diff --git a/engines/titanic/npcs/liftbot.h b/engines/titanic/npcs/liftbot.h index d0db94e95d..e993da0d32 100644 --- a/engines/titanic/npcs/liftbot.h +++ b/engines/titanic/npcs/liftbot.h @@ -42,7 +42,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/npcs/maitre_d.cpp b/engines/titanic/npcs/maitre_d.cpp index d100a0b301..903f3a49c9 100644 --- a/engines/titanic/npcs/maitre_d.cpp +++ b/engines/titanic/npcs/maitre_d.cpp @@ -31,7 +31,7 @@ CMaitreD::CMaitreD() : CTrueTalkNPC(), _field11C(0), _field12C(0), _field130(1), _field134(0), _field138(0) { } -void CMaitreD::save(SimpleFile *file, int indent) const { +void CMaitreD::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_field108, indent); file->writeQuotedLine(_string2, indent); diff --git a/engines/titanic/npcs/maitre_d.h b/engines/titanic/npcs/maitre_d.h index bae682bc74..6a63348d28 100644 --- a/engines/titanic/npcs/maitre_d.h +++ b/engines/titanic/npcs/maitre_d.h @@ -47,7 +47,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/npcs/mobile.cpp b/engines/titanic/npcs/mobile.cpp index 55b37f52f1..83f886ed21 100644 --- a/engines/titanic/npcs/mobile.cpp +++ b/engines/titanic/npcs/mobile.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CMobile, CCharacter) CMobile::CMobile() : CCharacter(), _fieldDC(0) { } -void CMobile::save(SimpleFile *file, int indent) const { +void CMobile::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writePoint(_pos1, indent); file->writeNumberLine(_fieldDC, indent); diff --git a/engines/titanic/npcs/mobile.h b/engines/titanic/npcs/mobile.h index 3ec19a4371..42effc6715 100644 --- a/engines/titanic/npcs/mobile.h +++ b/engines/titanic/npcs/mobile.h @@ -39,7 +39,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/npcs/parrot.cpp b/engines/titanic/npcs/parrot.cpp index a4cfa0872b..49e4f4066e 100644 --- a/engines/titanic/npcs/parrot.cpp +++ b/engines/titanic/npcs/parrot.cpp @@ -92,7 +92,7 @@ CParrot::CParrot() : CTrueTalkNPC() { _assetNumber = 0x13880; } -void CParrot::save(SimpleFile *file, int indent) const { +void CParrot::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_assetNumber, indent); diff --git a/engines/titanic/npcs/parrot.h b/engines/titanic/npcs/parrot.h index 0019437ce0..010d9af503 100644 --- a/engines/titanic/npcs/parrot.h +++ b/engines/titanic/npcs/parrot.h @@ -98,7 +98,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/npcs/robot_controller.cpp b/engines/titanic/npcs/robot_controller.cpp index c6ef4222ef..98866e4505 100644 --- a/engines/titanic/npcs/robot_controller.cpp +++ b/engines/titanic/npcs/robot_controller.cpp @@ -27,7 +27,7 @@ namespace Titanic { CRobotController::CRobotController() : CGameObject(), _string1("BellBot") { } -void CRobotController::save(SimpleFile *file, int indent) const { +void CRobotController::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string1, indent); diff --git a/engines/titanic/npcs/robot_controller.h b/engines/titanic/npcs/robot_controller.h index 998453eb62..54b0a20b24 100644 --- a/engines/titanic/npcs/robot_controller.h +++ b/engines/titanic/npcs/robot_controller.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/npcs/starlings.cpp b/engines/titanic/npcs/starlings.cpp index dcb9fbda81..333f4c4b7a 100644 --- a/engines/titanic/npcs/starlings.cpp +++ b/engines/titanic/npcs/starlings.cpp @@ -29,7 +29,7 @@ int CStarlings::_v1; CStarlings::CStarlings() : CCharacter() { } -void CStarlings::save(SimpleFile *file, int indent) const { +void CStarlings::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_v1, indent); diff --git a/engines/titanic/npcs/starlings.h b/engines/titanic/npcs/starlings.h index f7b144273c..40cb1b8083 100644 --- a/engines/titanic/npcs/starlings.h +++ b/engines/titanic/npcs/starlings.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/npcs/succubus.cpp b/engines/titanic/npcs/succubus.cpp index 7570338274..f66a59cb84 100644 --- a/engines/titanic/npcs/succubus.cpp +++ b/engines/titanic/npcs/succubus.cpp @@ -84,7 +84,7 @@ CSuccUBus::CSuccUBus() : CTrueTalkNPC() { _field1D8 = 0; } -void CSuccUBus::save(SimpleFile *file, int indent) const { +void CSuccUBus::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_v0, indent); diff --git a/engines/titanic/npcs/succubus.h b/engines/titanic/npcs/succubus.h index e46592caa1..a78a88b69a 100644 --- a/engines/titanic/npcs/succubus.h +++ b/engines/titanic/npcs/succubus.h @@ -93,7 +93,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/npcs/summon_bots.cpp b/engines/titanic/npcs/summon_bots.cpp index 661b3f0490..8796e5ffda 100644 --- a/engines/titanic/npcs/summon_bots.cpp +++ b/engines/titanic/npcs/summon_bots.cpp @@ -28,7 +28,7 @@ CSummonBots::CSummonBots() : CRobotController(), _string2("NULL"), _fieldC8(0), _fieldCC(0) { } -void CSummonBots::save(SimpleFile *file, int indent) const { +void CSummonBots::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldC8, indent); file->writeNumberLine(_fieldCC, indent); diff --git a/engines/titanic/npcs/summon_bots.h b/engines/titanic/npcs/summon_bots.h index 80aef73486..245d047bfa 100644 --- a/engines/titanic/npcs/summon_bots.h +++ b/engines/titanic/npcs/summon_bots.h @@ -39,7 +39,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/npcs/titania.cpp b/engines/titanic/npcs/titania.cpp index 3a71d7fea1..34c21d0efe 100644 --- a/engines/titanic/npcs/titania.cpp +++ b/engines/titanic/npcs/titania.cpp @@ -38,7 +38,7 @@ CTitania::CTitania() : CCharacter() { _field100 = 1; } -void CTitania::save(SimpleFile *file, int indent) const { +void CTitania::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldD4, indent); file->writeNumberLine(_fieldD8, indent); diff --git a/engines/titanic/npcs/titania.h b/engines/titanic/npcs/titania.h index 4c4c81267b..3eb95c08d3 100644 --- a/engines/titanic/npcs/titania.h +++ b/engines/titanic/npcs/titania.h @@ -48,7 +48,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/npcs/true_talk_npc.cpp b/engines/titanic/npcs/true_talk_npc.cpp index 0eaf21359e..51d7c2e003 100644 --- a/engines/titanic/npcs/true_talk_npc.cpp +++ b/engines/titanic/npcs/true_talk_npc.cpp @@ -44,7 +44,7 @@ CTrueTalkNPC::CTrueTalkNPC() : _assetName("z451.dlg"), _fieldF4(0), _fieldF8(0), _speechTimerId(0), _field100(0), _field104(0) { } -void CTrueTalkNPC::save(SimpleFile *file, int indent) const { +void CTrueTalkNPC::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_assetNumber, indent); file->writeQuotedLine(_assetName, indent); diff --git a/engines/titanic/npcs/true_talk_npc.h b/engines/titanic/npcs/true_talk_npc.h index 3126d92d3e..7202f253de 100644 --- a/engines/titanic/npcs/true_talk_npc.h +++ b/engines/titanic/npcs/true_talk_npc.h @@ -84,7 +84,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 6e30711397..0695cdea79 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -55,7 +55,7 @@ CPetControl::CPetControl() : CGameObject(), _sections[PET_MESSAGE] = &_message; } -void CPetControl::save(SimpleFile *file, int indent) const { +void CPetControl::save(SimpleFile *file, int indent) { file->writeNumberLine(0, indent); file->writeNumberLine(_currentArea, indent); file->writeQuotedLine(_activeNPCName, indent); @@ -113,7 +113,7 @@ void CPetControl::loadAreas(SimpleFile *file, int param) { _frame.load(file, param); } -void CPetControl::saveAreas(SimpleFile *file, int indent) const { +void CPetControl::saveAreas(SimpleFile *file, int indent) { _conversations.save(file, indent); _rooms.save(file, indent); _remote.save(file, indent); diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 75b92d734e..e56d8f8f90 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -81,7 +81,7 @@ private: /** * Saves data for the individual areas */ - void saveAreas(SimpleFile *file, int indent) const; + void saveAreas(SimpleFile *file, int indent); /** * Called at the end of the post game-load handling @@ -125,7 +125,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index f9c051a883..0a8a71bf94 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -230,7 +230,7 @@ void CPetConversations::postLoad() { reset(); } -void CPetConversations::save(SimpleFile *file, int indent) const { +void CPetConversations::save(SimpleFile *file, int indent) { _textInput.save(file, indent); _log.save(file, indent); diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index 51487e1ff4..62cddd4008 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -194,7 +194,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Called when a section is switched to diff --git a/engines/titanic/pet_control/pet_drag_chev.cpp b/engines/titanic/pet_control/pet_drag_chev.cpp index e6c4749123..beaac4e763 100644 --- a/engines/titanic/pet_control/pet_drag_chev.cpp +++ b/engines/titanic/pet_control/pet_drag_chev.cpp @@ -31,7 +31,7 @@ BEGIN_MESSAGE_MAP(CPetDragChev, CPetGraphic2) END_MESSAGE_MAP() -void CPetDragChev::save(SimpleFile *file, int indent) const { +void CPetDragChev::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CPetGraphic2::save(file, indent); } diff --git a/engines/titanic/pet_control/pet_drag_chev.h b/engines/titanic/pet_control/pet_drag_chev.h index 4e671ceff2..1ca9788f5b 100644 --- a/engines/titanic/pet_control/pet_drag_chev.h +++ b/engines/titanic/pet_control/pet_drag_chev.h @@ -39,7 +39,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/pet_control/pet_graphic.cpp b/engines/titanic/pet_control/pet_graphic.cpp index 25a77397c3..c4e184990a 100644 --- a/engines/titanic/pet_control/pet_graphic.cpp +++ b/engines/titanic/pet_control/pet_graphic.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CPetGraphic, CGameObject) -void CPetGraphic::save(SimpleFile *file, int indent) const { +void CPetGraphic::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/pet_control/pet_graphic.h b/engines/titanic/pet_control/pet_graphic.h index d49d0d4a1a..34badfd8a5 100644 --- a/engines/titanic/pet_control/pet_graphic.h +++ b/engines/titanic/pet_control/pet_graphic.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/pet_control/pet_graphic2.cpp b/engines/titanic/pet_control/pet_graphic2.cpp index a33a1c7d93..79cf42eeb0 100644 --- a/engines/titanic/pet_control/pet_graphic2.cpp +++ b/engines/titanic/pet_control/pet_graphic2.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CPetGraphic2, CGameObject) -void CPetGraphic2::save(SimpleFile *file, int indent) const { +void CPetGraphic2::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/pet_control/pet_graphic2.h b/engines/titanic/pet_control/pet_graphic2.h index d10dd102a0..4e77662a82 100644 --- a/engines/titanic/pet_control/pet_graphic2.h +++ b/engines/titanic/pet_control/pet_graphic2.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index 62eee83667..2f8125cfac 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -114,7 +114,7 @@ void CPetInventory::postLoad() { _field290 = 0; } -void CPetInventory::save(SimpleFile *file, int indent) const { +void CPetInventory::save(SimpleFile *file, int indent) { file->writeNumberLine(_field298, indent); } diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h index 8a6bcebd9f..9e074dd89b 100644 --- a/engines/titanic/pet_control/pet_inventory.h +++ b/engines/titanic/pet_control/pet_inventory.h @@ -119,7 +119,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Called when a section is switched to diff --git a/engines/titanic/pet_control/pet_leaf.cpp b/engines/titanic/pet_control/pet_leaf.cpp index 833f4ed8b9..bf40b6ca5c 100644 --- a/engines/titanic/pet_control/pet_leaf.cpp +++ b/engines/titanic/pet_control/pet_leaf.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(PETLeaf, CGameObject) -void PETLeaf::save(SimpleFile *file, int indent) const { +void PETLeaf::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/pet_control/pet_leaf.h b/engines/titanic/pet_control/pet_leaf.h index b9c516f6cb..0d187423ff 100644 --- a/engines/titanic/pet_control/pet_leaf.h +++ b/engines/titanic/pet_control/pet_leaf.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/pet_control/pet_message.h b/engines/titanic/pet_control/pet_message.h index 1ad031da65..499f274c54 100644 --- a/engines/titanic/pet_control/pet_message.h +++ b/engines/titanic/pet_control/pet_message.h @@ -82,7 +82,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const {} + virtual void save(SimpleFile *file, int indent) {} /** * Get a reference to the tooltip text associated with the section diff --git a/engines/titanic/pet_control/pet_mode_off.cpp b/engines/titanic/pet_control/pet_mode_off.cpp index a1c9f3dd34..277b8e5eac 100644 --- a/engines/titanic/pet_control/pet_mode_off.cpp +++ b/engines/titanic/pet_control/pet_mode_off.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CPetModeOff, CToggleSwitch) CPetModeOff::CPetModeOff() : CToggleSwitch() { } -void CPetModeOff::save(SimpleFile *file, int indent) const { +void CPetModeOff::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CToggleSwitch::save(file, indent); } diff --git a/engines/titanic/pet_control/pet_mode_off.h b/engines/titanic/pet_control/pet_mode_off.h index a84ed30480..0a4851ad72 100644 --- a/engines/titanic/pet_control/pet_mode_off.h +++ b/engines/titanic/pet_control/pet_mode_off.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/pet_control/pet_mode_on.cpp b/engines/titanic/pet_control/pet_mode_on.cpp index 1a7c2c26e7..89845dc49a 100644 --- a/engines/titanic/pet_control/pet_mode_on.cpp +++ b/engines/titanic/pet_control/pet_mode_on.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CPetModeOn, CToggleSwitch) CPetModeOn::CPetModeOn() : CToggleSwitch() { } -void CPetModeOn::save(SimpleFile *file, int indent) const { +void CPetModeOn::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CToggleSwitch::save(file, indent); } diff --git a/engines/titanic/pet_control/pet_mode_on.h b/engines/titanic/pet_control/pet_mode_on.h index 76e0c92607..d33a0d2829 100644 --- a/engines/titanic/pet_control/pet_mode_on.h +++ b/engines/titanic/pet_control/pet_mode_on.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/pet_control/pet_mode_panel.cpp b/engines/titanic/pet_control/pet_mode_panel.cpp index 87351bed24..1384602183 100644 --- a/engines/titanic/pet_control/pet_mode_panel.cpp +++ b/engines/titanic/pet_control/pet_mode_panel.cpp @@ -29,7 +29,7 @@ EMPTY_MESSAGE_MAP(CPetModePanel, CToggleSwitch) CPetModePanel::CPetModePanel() : CToggleSwitch() { } -void CPetModePanel::save(SimpleFile *file, int indent) const { +void CPetModePanel::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CToggleSwitch::save(file, indent); } diff --git a/engines/titanic/pet_control/pet_mode_panel.h b/engines/titanic/pet_control/pet_mode_panel.h index b55f38a6ff..17ce48d8b8 100644 --- a/engines/titanic/pet_control/pet_mode_panel.h +++ b/engines/titanic/pet_control/pet_mode_panel.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/pet_control/pet_pannel1.cpp b/engines/titanic/pet_control/pet_pannel1.cpp index 527841f883..9906212b4b 100644 --- a/engines/titanic/pet_control/pet_pannel1.cpp +++ b/engines/titanic/pet_control/pet_pannel1.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CPetPannel1, CPetGraphic) -void CPetPannel1::save(SimpleFile *file, int indent) const { +void CPetPannel1::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CPetGraphic::save(file, indent); } diff --git a/engines/titanic/pet_control/pet_pannel1.h b/engines/titanic/pet_control/pet_pannel1.h index 4e145363d4..c81d451d50 100644 --- a/engines/titanic/pet_control/pet_pannel1.h +++ b/engines/titanic/pet_control/pet_pannel1.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/pet_control/pet_pannel2.cpp b/engines/titanic/pet_control/pet_pannel2.cpp index 48675a7384..b67e0edfcd 100644 --- a/engines/titanic/pet_control/pet_pannel2.cpp +++ b/engines/titanic/pet_control/pet_pannel2.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CPetPannel2, CPetGraphic) -void CPetPannel2::save(SimpleFile *file, int indent) const { +void CPetPannel2::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CPetGraphic::save(file, indent); } diff --git a/engines/titanic/pet_control/pet_pannel2.h b/engines/titanic/pet_control/pet_pannel2.h index b32e10e0db..404dd88be5 100644 --- a/engines/titanic/pet_control/pet_pannel2.h +++ b/engines/titanic/pet_control/pet_pannel2.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/pet_control/pet_pannel3.cpp b/engines/titanic/pet_control/pet_pannel3.cpp index a0b693872a..a2a1fbedf9 100644 --- a/engines/titanic/pet_control/pet_pannel3.cpp +++ b/engines/titanic/pet_control/pet_pannel3.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CPetPannel3, CPetGraphic) -void CPetPannel3::save(SimpleFile *file, int indent) const { +void CPetPannel3::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CPetGraphic::save(file, indent); } diff --git a/engines/titanic/pet_control/pet_pannel3.h b/engines/titanic/pet_control/pet_pannel3.h index f80456f006..addf6144eb 100644 --- a/engines/titanic/pet_control/pet_pannel3.h +++ b/engines/titanic/pet_control/pet_pannel3.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/pet_control/pet_real_life.h b/engines/titanic/pet_control/pet_real_life.h index d049d47913..a4ae67fa6b 100644 --- a/engines/titanic/pet_control/pet_real_life.h +++ b/engines/titanic/pet_control/pet_real_life.h @@ -109,7 +109,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const {} + virtual void save(SimpleFile *file, int indent) {} /** * Called when a section is switched to diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp index fb7cb2bad8..2d731130e9 100644 --- a/engines/titanic/pet_control/pet_rooms.cpp +++ b/engines/titanic/pet_control/pet_rooms.cpp @@ -148,7 +148,7 @@ void CPetRooms::postLoad() { reset(); } -void CPetRooms::save(SimpleFile *file, int indent) const { +void CPetRooms::save(SimpleFile *file, int indent) { _glyphs.saveGlyphs(file, indent); _glyphItem.saveGlyph(file, indent); file->writeNumberLine(_floorNum, indent); diff --git a/engines/titanic/pet_control/pet_rooms.h b/engines/titanic/pet_control/pet_rooms.h index 64fd0168bc..b82b42ca8b 100644 --- a/engines/titanic/pet_control/pet_rooms.h +++ b/engines/titanic/pet_control/pet_rooms.h @@ -125,7 +125,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Called when a section is switched to diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.cpp b/engines/titanic/pet_control/pet_rooms_glyphs.cpp index 864ae2ee39..5de814af24 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.cpp +++ b/engines/titanic/pet_control/pet_rooms_glyphs.cpp @@ -166,7 +166,7 @@ void CPetRoomsGlyph::getTooltip(CPetText *text) { text->setText(roomStr); } -void CPetRoomsGlyph::saveGlyph(SimpleFile *file, int indent) const { +void CPetRoomsGlyph::saveGlyph(SimpleFile *file, int indent) { file->writeNumberLine(_roomFlags, indent); file->writeNumberLine(_mode, indent); } @@ -227,7 +227,7 @@ void CPetRoomsGlyph::drawObjects(uint flags, const Point &pt, CScreenManager *sc /*------------------------------------------------------------------------*/ -void CPetRoomsGlyphs::saveGlyphs(SimpleFile *file, int indent) const { +void CPetRoomsGlyphs::saveGlyphs(SimpleFile *file, int indent) { file->writeNumberLine(size(), indent); for (const_iterator i = begin(); i != end(); ++i) diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.h b/engines/titanic/pet_control/pet_rooms_glyphs.h index f0c2ce0133..5d0fec84f8 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.h +++ b/engines/titanic/pet_control/pet_rooms_glyphs.h @@ -93,7 +93,7 @@ public: /** * Saves the data for the glyph */ - virtual void saveGlyph(SimpleFile *file, int indent) const; + virtual void saveGlyph(SimpleFile *file, int indent); virtual bool proc33(CPetGlyph *glyph); @@ -143,7 +143,7 @@ public: /** * Save the list */ - void saveGlyphs(SimpleFile *file, int indent) const; + void saveGlyphs(SimpleFile *file, int indent); /** * Returns the glyph for hte player's assigned room diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 3673d4dfcc..4047ab03de 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -142,7 +142,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const {} + virtual void save(SimpleFile *file, int indent) {} /** * Called when a section is switched to diff --git a/engines/titanic/pet_control/pet_starfield.cpp b/engines/titanic/pet_control/pet_starfield.cpp index cde512c681..35ef943f54 100644 --- a/engines/titanic/pet_control/pet_starfield.cpp +++ b/engines/titanic/pet_control/pet_starfield.cpp @@ -132,7 +132,7 @@ void CPetStarfield::postLoad() { reset(); } -void CPetStarfield::save(SimpleFile *file, int indent) const { +void CPetStarfield::save(SimpleFile *file, int indent) { file->writeNumberLine(_photoOn, indent); file->writeNumberLine(_hasReference, indent); } diff --git a/engines/titanic/pet_control/pet_starfield.h b/engines/titanic/pet_control/pet_starfield.h index ec659ccb31..9550e0acf9 100644 --- a/engines/titanic/pet_control/pet_starfield.h +++ b/engines/titanic/pet_control/pet_starfield.h @@ -102,7 +102,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Sets the offsets for each of the buttons diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index fa7441c988..983d35ebe5 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -108,7 +108,7 @@ void CPetText::load(SimpleFile *file, int param) { } } -void CPetText::save(SimpleFile *file, int indent) const { +void CPetText::save(SimpleFile *file, int indent) { int numLines = _lineCount + 1; file->writeNumberLine(_array.size(), indent); diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h index 2a6e24ddb8..f5d4235690 100644 --- a/engines/titanic/pet_control/pet_text.h +++ b/engines/titanic/pet_control/pet_text.h @@ -108,7 +108,7 @@ public: /** * Save the data for the control */ - void save(SimpleFile *file, int indent) const; + void save(SimpleFile *file, int indent); /** * Set the bounds for the control diff --git a/engines/titanic/sound/auto_music_player.cpp b/engines/titanic/sound/auto_music_player.cpp index 309c57b1d5..964814348d 100644 --- a/engines/titanic/sound/auto_music_player.cpp +++ b/engines/titanic/sound/auto_music_player.cpp @@ -27,7 +27,7 @@ namespace Titanic { CAutoMusicPlayer::CAutoMusicPlayer() : CAutoMusicPlayerBase() { } -void CAutoMusicPlayer::save(SimpleFile *file, int indent) const { +void CAutoMusicPlayer::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string2, indent); diff --git a/engines/titanic/sound/auto_music_player.h b/engines/titanic/sound/auto_music_player.h index 063778c02a..5d9bb0f332 100644 --- a/engines/titanic/sound/auto_music_player.h +++ b/engines/titanic/sound/auto_music_player.h @@ -39,7 +39,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/sound/auto_music_player_base.cpp b/engines/titanic/sound/auto_music_player_base.cpp index 116fcf7186..c8b9adc275 100644 --- a/engines/titanic/sound/auto_music_player_base.cpp +++ b/engines/titanic/sound/auto_music_player_base.cpp @@ -27,7 +27,7 @@ namespace Titanic { CAutoMusicPlayerBase::CAutoMusicPlayerBase() : CGameObject(), _fieldC8(1), _fieldCC(0), _fieldD0(-1), _fieldD4(1) { } -void CAutoMusicPlayerBase::save(SimpleFile *file, int indent) const { +void CAutoMusicPlayerBase::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string1, indent); file->writeNumberLine(_fieldC8, indent); diff --git a/engines/titanic/sound/auto_music_player_base.h b/engines/titanic/sound/auto_music_player_base.h index e762ef40b9..d6d9926db3 100644 --- a/engines/titanic/sound/auto_music_player_base.h +++ b/engines/titanic/sound/auto_music_player_base.h @@ -41,7 +41,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/sound/auto_sound_player.cpp b/engines/titanic/sound/auto_sound_player.cpp index 7b20f65907..3e3d5298e4 100644 --- a/engines/titanic/sound/auto_sound_player.cpp +++ b/engines/titanic/sound/auto_sound_player.cpp @@ -29,7 +29,7 @@ CAutoSoundPlayer::CAutoSoundPlayer() : CGameObject(), _fieldDC(0), _fieldE0(-1), _fieldE4(0), _fieldE8(0) { } -void CAutoSoundPlayer::save(SimpleFile *file, int indent) const { +void CAutoSoundPlayer::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); file->writeQuotedLine(_string1, indent); diff --git a/engines/titanic/sound/auto_sound_player.h b/engines/titanic/sound/auto_sound_player.h index 15f1325e06..b85bb68cea 100644 --- a/engines/titanic/sound/auto_sound_player.h +++ b/engines/titanic/sound/auto_sound_player.h @@ -46,7 +46,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/sound/auto_sound_player_adsr.cpp b/engines/titanic/sound/auto_sound_player_adsr.cpp index 815c1cde52..4bfd5578fb 100644 --- a/engines/titanic/sound/auto_sound_player_adsr.cpp +++ b/engines/titanic/sound/auto_sound_player_adsr.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CAutoSoundPlayerADSR::save(SimpleFile *file, int indent) const { +void CAutoSoundPlayerADSR::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string2, indent); file->writeQuotedLine(_string3, indent); diff --git a/engines/titanic/sound/auto_sound_player_adsr.h b/engines/titanic/sound/auto_sound_player_adsr.h index c88a861f9b..9dd9ec5b15 100644 --- a/engines/titanic/sound/auto_sound_player_adsr.h +++ b/engines/titanic/sound/auto_sound_player_adsr.h @@ -38,7 +38,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/sound/background_sound_maker.cpp b/engines/titanic/sound/background_sound_maker.cpp index 111e641054..0abab8906b 100644 --- a/engines/titanic/sound/background_sound_maker.cpp +++ b/engines/titanic/sound/background_sound_maker.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CBackgroundSoundMaker::save(SimpleFile *file, int indent) const { +void CBackgroundSoundMaker::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/sound/background_sound_maker.h b/engines/titanic/sound/background_sound_maker.h index 68c1d7d1a9..32fb50b080 100644 --- a/engines/titanic/sound/background_sound_maker.h +++ b/engines/titanic/sound/background_sound_maker.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/sound/bird_song.cpp b/engines/titanic/sound/bird_song.cpp index f003a4f2c4..7f7d0ad5ce 100644 --- a/engines/titanic/sound/bird_song.cpp +++ b/engines/titanic/sound/bird_song.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CBirdSong::save(SimpleFile *file, int indent) const { +void CBirdSong::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); CRoomAutoSoundPlayer::save(file, indent); diff --git a/engines/titanic/sound/bird_song.h b/engines/titanic/sound/bird_song.h index d932cfde7d..1b1e309931 100644 --- a/engines/titanic/sound/bird_song.h +++ b/engines/titanic/sound/bird_song.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/sound/dome_from_top_of_well.cpp b/engines/titanic/sound/dome_from_top_of_well.cpp index f8d946a1e3..778f016a4e 100644 --- a/engines/titanic/sound/dome_from_top_of_well.cpp +++ b/engines/titanic/sound/dome_from_top_of_well.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CDomeFromTopOfWell, CViewAutoSoundPlayer) -void CDomeFromTopOfWell::save(SimpleFile *file, int indent) const { +void CDomeFromTopOfWell::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CViewAutoSoundPlayer::save(file, indent); } diff --git a/engines/titanic/sound/dome_from_top_of_well.h b/engines/titanic/sound/dome_from_top_of_well.h index 24c165028a..62c97da137 100644 --- a/engines/titanic/sound/dome_from_top_of_well.h +++ b/engines/titanic/sound/dome_from_top_of_well.h @@ -35,7 +35,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/sound/enter_view_toggles_other_music.cpp b/engines/titanic/sound/enter_view_toggles_other_music.cpp index fbf5b4a46d..0b149993a3 100644 --- a/engines/titanic/sound/enter_view_toggles_other_music.cpp +++ b/engines/titanic/sound/enter_view_toggles_other_music.cpp @@ -27,7 +27,7 @@ namespace Titanic { CEnterViewTogglesOtherMusic::CEnterViewTogglesOtherMusic() : CTriggerAutoMusicPlayer(), _fieldC8(0) { } -void CEnterViewTogglesOtherMusic::save(SimpleFile *file, int indent) const { +void CEnterViewTogglesOtherMusic::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldC8, indent); diff --git a/engines/titanic/sound/enter_view_toggles_other_music.h b/engines/titanic/sound/enter_view_toggles_other_music.h index 991a6ad2bc..adcf3df2d4 100644 --- a/engines/titanic/sound/enter_view_toggles_other_music.h +++ b/engines/titanic/sound/enter_view_toggles_other_music.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/sound/gondolier_song.cpp b/engines/titanic/sound/gondolier_song.cpp index 52b7ae04bf..b44400b2db 100644 --- a/engines/titanic/sound/gondolier_song.cpp +++ b/engines/titanic/sound/gondolier_song.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CGondolierSong::save(SimpleFile *file, int indent) const { +void CGondolierSong::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value, indent); CRoomAutoSoundPlayer::save(file, indent); diff --git a/engines/titanic/sound/gondolier_song.h b/engines/titanic/sound/gondolier_song.h index 6377279c04..710cd961fe 100644 --- a/engines/titanic/sound/gondolier_song.h +++ b/engines/titanic/sound/gondolier_song.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/sound/music_player.cpp b/engines/titanic/sound/music_player.cpp index 193527b3d8..fb48ae8378 100644 --- a/engines/titanic/sound/music_player.cpp +++ b/engines/titanic/sound/music_player.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CMusicPlayer::save(SimpleFile *file, int indent) const { +void CMusicPlayer::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldBC, indent); file->writeQuotedLine(_string1, indent); diff --git a/engines/titanic/sound/music_player.h b/engines/titanic/sound/music_player.h index 1b928fa652..fa877ec861 100644 --- a/engines/titanic/sound/music_player.h +++ b/engines/titanic/sound/music_player.h @@ -43,7 +43,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/sound/node_auto_sound_player.cpp b/engines/titanic/sound/node_auto_sound_player.cpp index ee403bae20..f74c891644 100644 --- a/engines/titanic/sound/node_auto_sound_player.cpp +++ b/engines/titanic/sound/node_auto_sound_player.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CNodeAutoSoundPlayer::save(SimpleFile *file, int indent) const { +void CNodeAutoSoundPlayer::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldEC, indent); CAutoSoundPlayer::save(file, indent); diff --git a/engines/titanic/sound/node_auto_sound_player.h b/engines/titanic/sound/node_auto_sound_player.h index 2f961ddcd9..06322f84d3 100644 --- a/engines/titanic/sound/node_auto_sound_player.h +++ b/engines/titanic/sound/node_auto_sound_player.h @@ -39,7 +39,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/sound/restricted_auto_music_player.cpp b/engines/titanic/sound/restricted_auto_music_player.cpp index cd1b1930e7..4ccfecc58d 100644 --- a/engines/titanic/sound/restricted_auto_music_player.cpp +++ b/engines/titanic/sound/restricted_auto_music_player.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CRestrictedAutoMusicPlayer::save(SimpleFile *file, int indent) const { +void CRestrictedAutoMusicPlayer::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string3, indent); file->writeQuotedLine(_string4, indent); diff --git a/engines/titanic/sound/restricted_auto_music_player.h b/engines/titanic/sound/restricted_auto_music_player.h index b2882964aa..be40bd84a1 100644 --- a/engines/titanic/sound/restricted_auto_music_player.h +++ b/engines/titanic/sound/restricted_auto_music_player.h @@ -41,7 +41,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/sound/room_auto_sound_player.cpp b/engines/titanic/sound/room_auto_sound_player.cpp index 4393d411fc..da98d41329 100644 --- a/engines/titanic/sound/room_auto_sound_player.cpp +++ b/engines/titanic/sound/room_auto_sound_player.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CRoomAutoSoundPlayer::save(SimpleFile *file, int indent) const { +void CRoomAutoSoundPlayer::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CAutoSoundPlayer::save(file, indent); } diff --git a/engines/titanic/sound/room_auto_sound_player.h b/engines/titanic/sound/room_auto_sound_player.h index c17d983ee1..8b5fc86488 100644 --- a/engines/titanic/sound/room_auto_sound_player.h +++ b/engines/titanic/sound/room_auto_sound_player.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/sound/room_trigger_auto_music_player.cpp b/engines/titanic/sound/room_trigger_auto_music_player.cpp index 8c20097927..4506dfd7d4 100644 --- a/engines/titanic/sound/room_trigger_auto_music_player.cpp +++ b/engines/titanic/sound/room_trigger_auto_music_player.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CRoomTriggerAutoMusicPlayer::save(SimpleFile *file, int indent) const { +void CRoomTriggerAutoMusicPlayer::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CTriggerAutoMusicPlayer::save(file, indent); } diff --git a/engines/titanic/sound/room_trigger_auto_music_player.h b/engines/titanic/sound/room_trigger_auto_music_player.h index 26823ced38..da378a32e5 100644 --- a/engines/titanic/sound/room_trigger_auto_music_player.h +++ b/engines/titanic/sound/room_trigger_auto_music_player.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/sound/season_noises.cpp b/engines/titanic/sound/season_noises.cpp index beacdefffa..e7307654fe 100644 --- a/engines/titanic/sound/season_noises.cpp +++ b/engines/titanic/sound/season_noises.cpp @@ -28,7 +28,7 @@ CSeasonNoises::CSeasonNoises() : CViewAutoSoundPlayer(), _fieldF0(0), _string2("NULL"), _string3("NULL"), _string4("NULL"), _string5("NULL") { } -void CSeasonNoises::save(SimpleFile *file, int indent) const { +void CSeasonNoises::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldF0, indent); file->writeQuotedLine(_string2, indent); diff --git a/engines/titanic/sound/season_noises.h b/engines/titanic/sound/season_noises.h index 7746c164e8..6d65de8373 100644 --- a/engines/titanic/sound/season_noises.h +++ b/engines/titanic/sound/season_noises.h @@ -41,7 +41,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/sound/seasonal_music_player.cpp b/engines/titanic/sound/seasonal_music_player.cpp index c4a8f02f43..8ac6eb6763 100644 --- a/engines/titanic/sound/seasonal_music_player.cpp +++ b/engines/titanic/sound/seasonal_music_player.cpp @@ -35,7 +35,7 @@ CSeasonalMusicPlayer::CSeasonalMusicPlayer() : CAutoMusicPlayerBase() { _fieldF4 = -4; } -void CSeasonalMusicPlayer::save(SimpleFile *file, int indent) const { +void CSeasonalMusicPlayer::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldD8, indent); file->writeNumberLine(_fieldDC, indent); diff --git a/engines/titanic/sound/seasonal_music_player.h b/engines/titanic/sound/seasonal_music_player.h index da19e1f0b0..3c434ec023 100644 --- a/engines/titanic/sound/seasonal_music_player.h +++ b/engines/titanic/sound/seasonal_music_player.h @@ -44,7 +44,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/sound/titania_speech.cpp b/engines/titanic/sound/titania_speech.cpp index 8c6062666d..f9d5b91705 100644 --- a/engines/titanic/sound/titania_speech.cpp +++ b/engines/titanic/sound/titania_speech.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CTitaniaSpeech::save(SimpleFile *file, int indent) const { +void CTitaniaSpeech::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_value1, indent); file->writeNumberLine(_value2, indent); diff --git a/engines/titanic/sound/titania_speech.h b/engines/titanic/sound/titania_speech.h index 78c4098d69..1ff52be1a2 100644 --- a/engines/titanic/sound/titania_speech.h +++ b/engines/titanic/sound/titania_speech.h @@ -39,7 +39,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/sound/trigger_auto_music_player.cpp b/engines/titanic/sound/trigger_auto_music_player.cpp index 17499a70e1..21050e0877 100644 --- a/engines/titanic/sound/trigger_auto_music_player.cpp +++ b/engines/titanic/sound/trigger_auto_music_player.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CTriggerAutoMusicPlayer::save(SimpleFile *file, int indent) const { +void CTriggerAutoMusicPlayer::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_fieldBC, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/sound/trigger_auto_music_player.h b/engines/titanic/sound/trigger_auto_music_player.h index 6387236181..11c096682a 100644 --- a/engines/titanic/sound/trigger_auto_music_player.h +++ b/engines/titanic/sound/trigger_auto_music_player.h @@ -36,7 +36,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/sound/view_auto_sound_player.cpp b/engines/titanic/sound/view_auto_sound_player.cpp index 3d6c92fe22..91507488fd 100644 --- a/engines/titanic/sound/view_auto_sound_player.cpp +++ b/engines/titanic/sound/view_auto_sound_player.cpp @@ -24,7 +24,7 @@ namespace Titanic { -void CViewAutoSoundPlayer::save(SimpleFile *file, int indent) const { +void CViewAutoSoundPlayer::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldEC, indent); CAutoSoundPlayer::save(file, indent); diff --git a/engines/titanic/sound/view_auto_sound_player.h b/engines/titanic/sound/view_auto_sound_player.h index 60de391ecb..dab96678da 100644 --- a/engines/titanic/sound/view_auto_sound_player.h +++ b/engines/titanic/sound/view_auto_sound_player.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/sound/view_toggles_other_music.cpp b/engines/titanic/sound/view_toggles_other_music.cpp index 262d7de628..35888fba9d 100644 --- a/engines/titanic/sound/view_toggles_other_music.cpp +++ b/engines/titanic/sound/view_toggles_other_music.cpp @@ -27,7 +27,7 @@ namespace Titanic { CViewTogglesOtherMusic::CViewTogglesOtherMusic() : CEnterViewTogglesOtherMusic(), _fieldCC(0) { } -void CViewTogglesOtherMusic::save(SimpleFile *file, int indent) const { +void CViewTogglesOtherMusic::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeNumberLine(_fieldCC, indent); diff --git a/engines/titanic/sound/view_toggles_other_music.h b/engines/titanic/sound/view_toggles_other_music.h index 68fa47b2be..f97f690998 100644 --- a/engines/titanic/sound/view_toggles_other_music.h +++ b/engines/titanic/sound/view_toggles_other_music.h @@ -37,7 +37,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/sound/water_lapping_sounds.cpp b/engines/titanic/sound/water_lapping_sounds.cpp index f5a69e6eed..74af78736c 100644 --- a/engines/titanic/sound/water_lapping_sounds.cpp +++ b/engines/titanic/sound/water_lapping_sounds.cpp @@ -26,7 +26,7 @@ namespace Titanic { EMPTY_MESSAGE_MAP(CWaterLappingSounds, CRoomAutoSoundPlayer) -void CWaterLappingSounds::save(SimpleFile *file, int indent) const { +void CWaterLappingSounds::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); file->writeQuotedLine(_string1, indent); file->writeNumberLine(_fieldD4, indent); diff --git a/engines/titanic/sound/water_lapping_sounds.h b/engines/titanic/sound/water_lapping_sounds.h index cf6c72146b..7fc7cc4361 100644 --- a/engines/titanic/sound/water_lapping_sounds.h +++ b/engines/titanic/sound/water_lapping_sounds.h @@ -38,7 +38,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp index f27f16dab2..9880e6f28c 100644 --- a/engines/titanic/star_control/star_control.cpp +++ b/engines/titanic/star_control/star_control.cpp @@ -29,7 +29,7 @@ CStarControl::CStarControl() : _fieldBC(0), _field80A0(0), _field80A4(0), _field80A8(0), _field80AC(0), _field80B0(0) { } -void CStarControl::save(SimpleFile *file, int indent) const { +void CStarControl::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CGameObject::save(file, indent); } diff --git a/engines/titanic/star_control/star_control.h b/engines/titanic/star_control/star_control.h index ee042b6bc8..1bd2dec92b 100644 --- a/engines/titanic/star_control/star_control.h +++ b/engines/titanic/star_control/star_control.h @@ -46,7 +46,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/star_control/star_control_sub11.cpp b/engines/titanic/star_control/star_control_sub11.cpp index f590ee61e6..05f2733e21 100644 --- a/engines/titanic/star_control/star_control_sub11.cpp +++ b/engines/titanic/star_control/star_control_sub11.cpp @@ -45,7 +45,7 @@ void CStarControlSub11::load(SimpleFile *file, int param) { } } -void CStarControlSub11::save(SimpleFile *file, int indent) const { +void CStarControlSub11::save(SimpleFile *file, int indent) { } } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub11.h b/engines/titanic/star_control/star_control_sub11.h index 9cb9cbeb50..a322e1e43a 100644 --- a/engines/titanic/star_control/star_control_sub11.h +++ b/engines/titanic/star_control/star_control_sub11.h @@ -55,7 +55,7 @@ public: /** * Save the data for the class to file */ - void save(SimpleFile *file, int indent) const; + void save(SimpleFile *file, int indent); }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub12.cpp b/engines/titanic/star_control/star_control_sub12.cpp index 3e288e83c0..aa65f718eb 100644 --- a/engines/titanic/star_control/star_control_sub12.cpp +++ b/engines/titanic/star_control/star_control_sub12.cpp @@ -33,7 +33,7 @@ void CStarControlSub12::load(SimpleFile *file, int param) { _sub13.load(file, param); } -void CStarControlSub12::save(SimpleFile *file, int indent) const { +void CStarControlSub12::save(SimpleFile *file, int indent) { _sub13.save(file, indent); } diff --git a/engines/titanic/star_control/star_control_sub12.h b/engines/titanic/star_control/star_control_sub12.h index 586e138969..3637e13bd1 100644 --- a/engines/titanic/star_control/star_control_sub12.h +++ b/engines/titanic/star_control/star_control_sub12.h @@ -56,7 +56,7 @@ public: /** * Save the data for the class to file */ - void save(SimpleFile *file, int indent) const; + void save(SimpleFile *file, int indent); }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub13.cpp b/engines/titanic/star_control/star_control_sub13.cpp index fbe40b9532..f22a22a6e9 100644 --- a/engines/titanic/star_control/star_control_sub13.cpp +++ b/engines/titanic/star_control/star_control_sub13.cpp @@ -67,7 +67,7 @@ void CStarControlSub13::load(SimpleFile *file, int param) { _fieldD4 = 0; } -void CStarControlSub13::save(SimpleFile *file, int indent) const { +void CStarControlSub13::save(SimpleFile *file, int indent) { _sub14.save(file, indent); } diff --git a/engines/titanic/star_control/star_control_sub13.h b/engines/titanic/star_control/star_control_sub13.h index 1ec841ae2d..e1b54775ce 100644 --- a/engines/titanic/star_control/star_control_sub13.h +++ b/engines/titanic/star_control/star_control_sub13.h @@ -65,7 +65,7 @@ public: /** * Save the data for the class to file */ - void save(SimpleFile *file, int indent) const; + void save(SimpleFile *file, int indent); }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub14.cpp b/engines/titanic/star_control/star_control_sub14.cpp index 3d02705af5..75e7c68d8e 100644 --- a/engines/titanic/star_control/star_control_sub14.cpp +++ b/engines/titanic/star_control/star_control_sub14.cpp @@ -42,7 +42,7 @@ void CStarControlSub14::load(SimpleFile *file, int param) { _field20 = file->readFloat(); } -void CStarControlSub14::save(SimpleFile *file, int indent) const { +void CStarControlSub14::save(SimpleFile *file, int indent) { } diff --git a/engines/titanic/star_control/star_control_sub14.h b/engines/titanic/star_control/star_control_sub14.h index 2d02d13d8c..0b1d4e3b08 100644 --- a/engines/titanic/star_control/star_control_sub14.h +++ b/engines/titanic/star_control/star_control_sub14.h @@ -49,7 +49,7 @@ public: /** * Save the data for the class to file */ - void save(SimpleFile *file, int indent) const; + void save(SimpleFile *file, int indent); }; diff --git a/engines/titanic/star_control/star_control_sub8.h b/engines/titanic/star_control/star_control_sub8.h index 6dcd147da2..39d9fef7dc 100644 --- a/engines/titanic/star_control/star_control_sub8.h +++ b/engines/titanic/star_control/star_control_sub8.h @@ -51,7 +51,7 @@ public: /** * Save the data for the class to file */ - void save(SimpleFile *file, int indent) const {} + void save(SimpleFile *file, int indent) {} }; } // End of namespace Titanic diff --git a/engines/titanic/support/movie_clip.cpp b/engines/titanic/support/movie_clip.cpp index da655ce76a..2d3187b000 100644 --- a/engines/titanic/support/movie_clip.cpp +++ b/engines/titanic/support/movie_clip.cpp @@ -32,7 +32,7 @@ CMovieClip::CMovieClip(const CString &name, int startFrame, int endFrame): ListItem(), _name(name), _startFrame(startFrame), _endFrame(endFrame) { } -void CMovieClip::save(SimpleFile *file, int indent) const { +void CMovieClip::save(SimpleFile *file, int indent) { file->writeNumberLine(2, indent); file->writeQuotedLine("Clip", indent); file->writeQuotedLine(_name, indent); diff --git a/engines/titanic/support/movie_clip.h b/engines/titanic/support/movie_clip.h index 0b1106f420..813996bbf0 100644 --- a/engines/titanic/support/movie_clip.h +++ b/engines/titanic/support/movie_clip.h @@ -56,7 +56,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/support/movie_event.cpp b/engines/titanic/support/movie_event.cpp index b3e788e6fc..870a06fe6f 100644 --- a/engines/titanic/support/movie_event.cpp +++ b/engines/titanic/support/movie_event.cpp @@ -36,7 +36,7 @@ CMovieEvent::CMovieEvent(const CMovieEvent *src) { _field1C = src->_field1C; } -void CMovieEvent::save(SimpleFile *file, int indent) const { +void CMovieEvent::save(SimpleFile *file, int indent) { file->writeNumberLine(0, indent); file->writeNumberLine(_fieldC, indent + 1); file->writeNumberLine(_field10, indent + 1); diff --git a/engines/titanic/support/movie_event.h b/engines/titanic/support/movie_event.h index 5c62220919..ed72e2d349 100644 --- a/engines/titanic/support/movie_event.h +++ b/engines/titanic/support/movie_event.h @@ -42,7 +42,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/support/movie_range_info.cpp b/engines/titanic/support/movie_range_info.cpp index ab34082540..d48bab1df6 100644 --- a/engines/titanic/support/movie_range_info.cpp +++ b/engines/titanic/support/movie_range_info.cpp @@ -45,7 +45,7 @@ CMovieRangeInfo::CMovieRangeInfo(const CMovieRangeInfo *src) : ListItem() { } } -void CMovieRangeInfo::save(SimpleFile *file, int indent) const { +void CMovieRangeInfo::save(SimpleFile *file, int indent) { file->writeNumberLine(0, indent); file->writeQuotedLine(_movieName, indent + 1); file->writeNumberLine(_endFrame, indent + 1); diff --git a/engines/titanic/support/movie_range_info.h b/engines/titanic/support/movie_range_info.h index 3f077c717e..2776ac2851 100644 --- a/engines/titanic/support/movie_range_info.h +++ b/engines/titanic/support/movie_range_info.h @@ -46,7 +46,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file diff --git a/engines/titanic/support/time_event_info.cpp b/engines/titanic/support/time_event_info.cpp index c3312de7d7..041a01ccfb 100644 --- a/engines/titanic/support/time_event_info.cpp +++ b/engines/titanic/support/time_event_info.cpp @@ -106,7 +106,7 @@ CTimeEventInfo::CTimeEventInfo(uint ticks, uint f14, uint firstDuration, _id = _nextId++; } -void CTimeEventInfo::save(SimpleFile *file, int indent) const { +void CTimeEventInfo::save(SimpleFile *file, int indent) { file->writeNumberLine(0, indent); CString targetName; diff --git a/engines/titanic/support/time_event_info.h b/engines/titanic/support/time_event_info.h index ee923f5fcb..b436f87f65 100644 --- a/engines/titanic/support/time_event_info.h +++ b/engines/titanic/support/time_event_info.h @@ -72,7 +72,7 @@ public: /** * Save the data for the class to file */ - virtual void save(SimpleFile *file, int indent) const; + virtual void save(SimpleFile *file, int indent); /** * Load the data for the class from file -- cgit v1.2.3 From 8ea5d533294193a4d220316152cec59580bbf10c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 29 Jun 2016 22:05:06 -0400 Subject: TITANIC: Added CGameObject saving, and movie range info methods --- engines/titanic/core/game_object.cpp | 56 ++++++++++++++++++++++++---- engines/titanic/core/game_object.h | 6 +-- engines/titanic/core/tree_item.h | 2 +- engines/titanic/support/movie.cpp | 7 ++-- engines/titanic/support/movie.h | 20 ++++++++-- engines/titanic/support/movie_clip.cpp | 2 + engines/titanic/support/movie_range_info.cpp | 14 +++++-- engines/titanic/support/movie_range_info.h | 4 +- engines/titanic/support/video_surface.cpp | 8 +++- engines/titanic/support/video_surface.h | 15 +++++++- 10 files changed, 107 insertions(+), 27 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 29ad735a66..a5657f583a 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -82,7 +82,49 @@ CGameObject::~CGameObject() { void CGameObject::save(SimpleFile *file, int indent) { file->writeNumberLine(7, indent); - error("TODO: CGameObject::save"); + _movieRangeInfoList.destroyContents(); + + if (_surface) { + Common::List rangeList = _surface->getMovieRangeInfo(); + + for (Common::List::const_iterator i = rangeList.begin(); + i != rangeList.end(); ++i) { + CMovieRangeInfo *rangeInfo = new CMovieRangeInfo(*i); + rangeInfo->_frameNumber = (i == rangeList.begin()) ? getMovieFrame() : -1; + } + } + + _movieRangeInfoList.save(file, indent); + _movieRangeInfoList.destroyContents(); + + file->writeNumberLine(getMovieFrame(), indent + 1); + file->writeNumberLine(_cursorId, indent + 1); + _movieClips.save(file, indent + 1); + file->writeNumberLine(_field60, indent + 1); + file->writeNumberLine(_field40, indent + 1); + file->writeQuotedLine(_resource, indent + 1); + file->writeBounds(_bounds, indent + 1); + + file->writeFloatLine(_field34, indent + 1); + file->writeFloatLine(_field38, indent + 1); + file->writeFloatLine(_field3C, indent + 1); + + file->writeNumberLine(_field44, indent + 1); + file->writeNumberLine(_field48, indent + 1); + file->writeNumberLine(_field4C, indent + 1); + file->writeNumberLine(_fieldB8, indent + 1); + file->writeNumberLine(_visible, indent + 1); + file->writeNumberLine(_isMail, indent + 1); + file->writeNumberLine(_id, indent + 1); + file->writeNumberLine(_roomFlags, indent + 1); + + if (_surface) { + _surface->_resourceKey.save(file, indent); + } else { + CResourceKey resourceKey; + resourceKey.save(file, indent); + } + file->writeNumberLine(_surface != nullptr, indent); CNamedItem::save(file, indent); } @@ -93,7 +135,7 @@ void CGameObject::load(SimpleFile *file) { switch (val) { case 7: - _movieRangeInfo.load(file); + _movieRangeInfoList.load(file); _frameNumber = file->readNumber(); // Deliberate fall-through @@ -179,7 +221,7 @@ void CGameObject::draw(CScreenManager *screenManager) { _frameNumber = -1; } - if (!_movieRangeInfo.empty()) + if (!_movieRangeInfoList.empty()) processMoveRangeInfo(); if (_bounds.intersects(getGameManager()->_bounds)) { @@ -377,10 +419,10 @@ void CGameObject::playMovie(int v1, int v2) { } void CGameObject::processMoveRangeInfo() { - for (CMovieRangeInfoList::iterator i = _movieRangeInfo.begin(); i != _movieRangeInfo.end(); ++i) + for (CMovieRangeInfoList::iterator i = _movieRangeInfoList.begin(); i != _movieRangeInfoList.end(); ++i) (*i)->process(this); - _movieRangeInfo.destroyContents(); + _movieRangeInfoList.destroyContents(); } void CGameObject::makeDirty(const Rect &r) { @@ -1071,12 +1113,12 @@ bool CGameObject::clipExistsByEnd(const CString &name, int endFrame) const { return _movieClips.existsByEnd(name, endFrame); } -void CGameObject::checkPlayMovie(const CString &name, int flags) { +void CGameObject::checkPlayMovie(int fieldC, int field10, int frameNumber, int flags) { if (!_surface && !_resource.empty()) loadResource(_resource); if (_surface ) { - _surface->proc35(name, flags, (flags & CLIPFLAG_4) ? this : nullptr); + _surface->proc35(fieldC, field10, frameNumber, flags, (flags & CLIPFLAG_4) ? this : nullptr); if (flags & CLIPFLAG_PLAY) getGameManager()->_gameState.addMovie(_surface->_movie); } diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 1afe834876..8c53e159be 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -90,7 +90,7 @@ protected: int _field4C; CMovieClipList _movieClips; int _initialFrame; - CMovieRangeInfoList _movieRangeInfo; + CMovieRangeInfoList _movieRangeInfoList; int _frameNumber; CPetText *_text; uint _textBorder; @@ -533,7 +533,7 @@ public: /** * Returns the clip list, if any, associated with the item */ - virtual const CMovieClipList *getClipList() const { return &_movieClips; } + virtual const CMovieClipList *getMovieClips() const { return &_movieClips; } /** * Allows the item to draw itself @@ -594,7 +594,7 @@ public: /** * Checks and plays a pending clip */ - void checkPlayMovie(const CString &name, int flags); + void checkPlayMovie(int fieldC, int field10, int frameNumber, int flags); /** * Returns true if the object has a currently active movie diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index a15a5ae52f..49a3fa7a65 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -134,7 +134,7 @@ public: /** * Returns the clip list, if any, associated with the item */ - virtual const CMovieClipList *getClipList() const { return nullptr; } + virtual const CMovieClipList *getMovieClips() const { return nullptr; } /** * Returns true if the given item connects to another specified view diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index 27bcb97ae9..361bf6e1fa 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -99,7 +99,7 @@ void OSMovie::proc11() { warning("TODO: OSMovie::proc11"); } -void OSMovie::proc12(const CString &name, int flags, CGameObject *obj) { +void OSMovie::proc12(int v1, int v2, int frameNumber, int flags, CGameObject *obj) { warning("TODO: OSMovie::proc12"); } @@ -121,8 +121,9 @@ void OSMovie::proc16() { warning("TODO: OSMovie::proc16"); } -void OSMovie::proc17() { - warning("TODO: OSMovie::proc17"); +const Common::List OSMovie::getMovieRangeInfo() const { + warning("TODO: OSMovie::getMovieRangeInfo"); + return Common::List(); } void OSMovie::proc18() { diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index da3285547d..2d7bdc9c6d 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -23,9 +23,11 @@ #ifndef TITANIC_MOVIE_H #define TITANIC_MOVIE_H +#include "common/list.h" #include "video/video_decoder.h" #include "titanic/core/list.h" #include "titanic/core/resource_key.h" +#include "titanic/support/movie_range_info.h" namespace Titanic { @@ -72,7 +74,7 @@ public: virtual void playClip(const Rect &rect, uint startFrame, uint endFrame) = 0; virtual void proc11() = 0; - virtual void proc12(const CString &name, int flags, CGameObject *obj) = 0; + virtual void proc12(int v1, int v2, int frameNumber, int flags, CGameObject *obj) = 0; /** * Stops the movie @@ -82,7 +84,12 @@ public: virtual void proc14() = 0; virtual void setFrame(uint frameNumber) = 0; virtual void proc16() = 0; - virtual void proc17() = 0; + + /** + * Return any movie range info associated with the movie + */ + virtual const Common::List getMovieRangeInfo() const = 0; + virtual void proc18() = 0; /** @@ -139,7 +146,7 @@ public: virtual void playClip(const Rect &rect, uint startFrame, uint endFrame); virtual void proc11(); - virtual void proc12(const CString &name, int flags, CGameObject *obj); + virtual void proc12(int v1, int v2, int frameNumber, int flags, CGameObject *obj); /** * Stops the movie @@ -154,7 +161,12 @@ public: virtual void setFrame(uint frameNumber); virtual void proc16(); - virtual void proc17(); + + /** + * Return any movie range info associated with the movie + */ + virtual const Common::List getMovieRangeInfo() const; + virtual void proc18(); /** diff --git a/engines/titanic/support/movie_clip.cpp b/engines/titanic/support/movie_clip.cpp index 2d3187b000..1f2ef66428 100644 --- a/engines/titanic/support/movie_clip.cpp +++ b/engines/titanic/support/movie_clip.cpp @@ -65,6 +65,8 @@ void CMovieClip::load(SimpleFile *file) { ListItem::load(file); } +/*------------------------------------------------------------------------*/ + CMovieClip *CMovieClipList::findByName(const Common::String &name) const { for (const_iterator i = begin(); i != end(); ++i) { CMovieClip *clip = *i; diff --git a/engines/titanic/support/movie_range_info.cpp b/engines/titanic/support/movie_range_info.cpp index d48bab1df6..e6b28ce4e8 100644 --- a/engines/titanic/support/movie_range_info.cpp +++ b/engines/titanic/support/movie_range_info.cpp @@ -34,7 +34,9 @@ CMovieRangeInfo::~CMovieRangeInfo() { } CMovieRangeInfo::CMovieRangeInfo(const CMovieRangeInfo *src) : ListItem() { - _movieName = src->_movieName; + _fieldC = src->_fieldC; + _field10 = src->_field10; + _frameNumber = src->_frameNumber; _startFrame = src->_startFrame; _endFrame = src->_endFrame; @@ -47,7 +49,9 @@ CMovieRangeInfo::CMovieRangeInfo(const CMovieRangeInfo *src) : ListItem() { void CMovieRangeInfo::save(SimpleFile *file, int indent) { file->writeNumberLine(0, indent); - file->writeQuotedLine(_movieName, indent + 1); + file->writeNumberLine(_fieldC, indent + 1); + file->writeNumberLine(_field10, indent + 1); + file->writeNumberLine(_frameNumber, indent + 1); file->writeNumberLine(_endFrame, indent + 1); file->writeNumberLine(_startFrame, indent + 1); _events.save(file, indent + 1); @@ -56,7 +60,9 @@ void CMovieRangeInfo::save(SimpleFile *file, int indent) { void CMovieRangeInfo::load(SimpleFile *file) { int val = file->readNumber(); if (!val) { - _movieName = file->readString(); + _fieldC = file->readNumber(); + _field10 = file->readNumber(); + _frameNumber = file->readNumber(); _endFrame = file->readNumber(); _startFrame = file->readNumber(); _events.load(file); @@ -94,7 +100,7 @@ void CMovieRangeInfo::process(CGameObject *owner) { } } - owner->checkPlayMovie(_movieName, flags); + owner->checkPlayMovie(_fieldC, _field10, _frameNumber, flags); for (CMovieEventList::iterator i = _events.begin(); i != _events.end(); ++i) { CMovieEvent *movieEvent = *i; diff --git a/engines/titanic/support/movie_range_info.h b/engines/titanic/support/movie_range_info.h index 2776ac2851..be04975cbf 100644 --- a/engines/titanic/support/movie_range_info.h +++ b/engines/titanic/support/movie_range_info.h @@ -34,7 +34,9 @@ class CGameObject; class CMovieRangeInfo : public ListItem { public: - CString _movieName; + int _fieldC; + int _field10; + int _frameNumber; uint _startFrame; uint _endFrame; CMovieEventList _events; diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index c1af869e1e..9293b03f02 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -402,9 +402,9 @@ void OSVideoSurface::playMovie(uint startFrame, uint endFrame, int v3, bool v4) } } -void OSVideoSurface::proc35(const CString &name, int flags, CGameObject *owner) { +void OSVideoSurface::proc35(int v1, int v2, int frameNumber, int flags, CGameObject *owner) { if (loadIfReady() && _movie) { - _movie->proc12(name, flags, owner); + _movie->proc12(v1, v2, frameNumber, flags, owner); } } @@ -426,6 +426,10 @@ void OSVideoSurface::proc39(int v1, int v2) { warning("OSVideoSurface::proc39"); } +const Common::List OSVideoSurface::getMovieRangeInfo() const { + return _movie ? _movie->getMovieRangeInfo() : Common::List(); +} + bool OSVideoSurface::loadIfReady() { _videoSurfaceNum = _videoSurfaceCounter; diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index 2b66b269e7..e5d904f6d6 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -28,6 +28,7 @@ #include "titanic/support/font.h" #include "titanic/support/direct_draw.h" #include "titanic/support/movie.h" +#include "titanic/support/movie_range_info.h" #include "titanic/support/rect.h" #include "titanic/core/list.h" #include "titanic/core/resource_key.h" @@ -166,7 +167,7 @@ public: */ virtual void playMovie(uint startFrame, uint endFrame, int v3, bool v4) = 0; - virtual void proc35(const CString &name, int flags, CGameObject *owner) = 0; + virtual void proc35(int v1, int v2, int frameNumber, int flags, CGameObject *owner) = 0; /** * Stops any movie currently attached to the surface @@ -182,6 +183,11 @@ public: virtual void proc39(int v1, int v2) = 0; + /** + * Return any movie range info associated with the surface's movie + */ + virtual const Common::List getMovieRangeInfo() const = 0; + /** * Loads the surface's resource if there's one pending */ @@ -335,7 +341,7 @@ public: */ virtual void playMovie(uint startFrame, uint endFrame, int v3, bool v4); - virtual void proc35(const CString &name, int flags, CGameObject *owner); + virtual void proc35(int v1, int v2, int frameNumber, int flags, CGameObject *owner); /** * Stops any movie currently attached to the surface @@ -351,6 +357,11 @@ public: virtual void proc39(int v1, int v2); + /** + * Return any movie range info associated with the surface's movie + */ + virtual const Common::List getMovieRangeInfo() const; + /** * Loads the surface's resource if there's one pending */ -- cgit v1.2.3 From d436ce5dae8ab9d4c7dbe4c6d069f7202309f297 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 30 Jun 2016 13:40:55 -0400 Subject: TITANIC: Beginning of work on star control hierarchy --- engines/titanic/star_control/star_control_sub12.h | 1 - engines/titanic/star_control/star_control_sub6.cpp | 21 +++++++++++++++++---- engines/titanic/star_control/star_control_sub6.h | 2 ++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/engines/titanic/star_control/star_control_sub12.h b/engines/titanic/star_control/star_control_sub12.h index 3637e13bd1..bce668f863 100644 --- a/engines/titanic/star_control/star_control_sub12.h +++ b/engines/titanic/star_control/star_control_sub12.h @@ -41,7 +41,6 @@ private: int _field2C; CStarControlSub13 _sub13; int _field108; - int _field21C; public: CStarControlSub12(void *val1, void *val2); virtual ~CStarControlSub12() {} diff --git a/engines/titanic/star_control/star_control_sub6.cpp b/engines/titanic/star_control/star_control_sub6.cpp index 48285a7dbe..79937b7cab 100644 --- a/engines/titanic/star_control/star_control_sub6.cpp +++ b/engines/titanic/star_control/star_control_sub6.cpp @@ -24,10 +24,23 @@ namespace Titanic { -CStarControlSub6::CStarControlSub6() : - _field0(0x3F800000), _field4(0), _field8(0), _fieldC(0), - _field10(0x3F800000), _field14(0), _field18(0), _field1C(0), - _field20(0x3F800000), _field24(0), _field28(0), _field2C(0) { +CStarControlSub6::CStarControlSub6() { + clear(); +} + +void CStarControlSub6::clear() { + _field0 = 0x3F800000; + _field4 = 0; + _field8 = 0; + _fieldC = 0), + _field10 = 0x3F800000; + _field14 = 0; + _field18 = 0; + _field1C = 0), + _field20 = 0x3F800000; + _field24 = 0; + _field28 = 0; + _field2C = 0; } } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub6.h b/engines/titanic/star_control/star_control_sub6.h index d57b35cf7c..3531c76d1b 100644 --- a/engines/titanic/star_control/star_control_sub6.h +++ b/engines/titanic/star_control/star_control_sub6.h @@ -41,6 +41,8 @@ private: int _field2C; public: CStarControlSub6(); + + void clear(); }; } // End of namespace Titanic -- cgit v1.2.3 From eebb42be89b3fe520bb4d175a0c0fac3c3291841 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 30 Jun 2016 23:40:58 -0400 Subject: TITANIC: Work on CBaseStar and CStarControlSub4 classes --- engines/titanic/module.mk | 2 +- engines/titanic/star_control/base_star.cpp | 63 +++++++++++++++++ engines/titanic/star_control/base_star.h | 81 ++++++++++++++++++++++ engines/titanic/star_control/star_control.cpp | 4 +- engines/titanic/star_control/star_control.h | 5 +- engines/titanic/star_control/star_control_sub2.cpp | 20 ++++++ engines/titanic/star_control/star_control_sub2.h | 9 ++- engines/titanic/star_control/star_control_sub3.cpp | 35 ---------- engines/titanic/star_control/star_control_sub3.h | 58 ---------------- engines/titanic/star_control/star_control_sub4.cpp | 18 ++++- engines/titanic/star_control/star_control_sub4.h | 16 +++-- engines/titanic/star_control/star_control_sub6.cpp | 4 +- engines/titanic/star_control/star_control_sub7.cpp | 8 +++ engines/titanic/star_control/star_control_sub7.h | 8 ++- 14 files changed, 217 insertions(+), 114 deletions(-) create mode 100644 engines/titanic/star_control/base_star.cpp create mode 100644 engines/titanic/star_control/base_star.h delete mode 100644 engines/titanic/star_control/star_control_sub3.cpp delete mode 100644 engines/titanic/star_control/star_control_sub3.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 3c752bf13a..7138f57464 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -419,7 +419,7 @@ MODULE_OBJS := \ star_control/star_control.o \ star_control/star_control_sub1.o \ star_control/star_control_sub2.o \ - star_control/star_control_sub3.o \ + star_control/base_star.o \ star_control/star_control_sub4.o \ star_control/star_control_sub5.o \ star_control/star_control_sub6.o \ diff --git a/engines/titanic/star_control/base_star.cpp b/engines/titanic/star_control/base_star.cpp new file mode 100644 index 0000000000..c8f55a7931 --- /dev/null +++ b/engines/titanic/star_control/base_star.cpp @@ -0,0 +1,63 @@ +/* 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 "titanic/star_control/base_star.h" + +namespace Titanic { + +CBaseStar::CBaseStar() : _fieldC(1), _minVal(0.0), _maxVal(1.0), _range(0.0) { +} + +void CBaseStar::proc2(int v1, int v2, int v3) { + error("TODO"); +} + +void CBaseStar::clear() { + if (!_data.empty()) { + if (_fieldC) + _data.clear(); + } +} + +void CBaseStar::initialize() { + _minVal = 9.9999998e10; + _maxVal = -9.9999998e10; + _sub4.initialize(); + + for (uint idx = 0; idx < _data.size(); ++idx) { + const CBaseStarEntry *entry = getDataPtr(idx); + _sub4.checkEntry(entry->_val); + + if (entry->_value < _minVal) + _minVal = entry->_value; + if (entry->_value > _maxVal) + _maxVal = entry->_value; + } + + _range = (_maxVal - _minVal) / 1.0; +} + +CBaseStarEntry *CBaseStar::getDataPtr(int index) { + return (index >= 0 && index < (int)_data.size()) ? &_data[index] : nullptr; +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/base_star.h b/engines/titanic/star_control/base_star.h new file mode 100644 index 0000000000..20dbacedb6 --- /dev/null +++ b/engines/titanic/star_control/base_star.h @@ -0,0 +1,81 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_CONTROL_SUB3_H +#define TITANIC_STAR_CONTROL_SUB3_H + +#include "titanic/support/simple_file.h" +#include "titanic/star_control/star_control_sub4.h" + +namespace Titanic { + +struct CBaseStarEntry { + int _field0; + double _value; + CBaseStarVal _val; +}; + +class CBaseStar { +protected: + Common::Array _data; + int _fieldC; + CStarControlSub4 _sub4; + double _minVal; + double _maxVal; + double _range; +public: + CBaseStar(); + virtual ~CBaseStar() {} + + virtual void proc2(int v1, int v2, int v3); + virtual bool loadYale(int v1) { return true; } + virtual bool proc4(int v1, int v2, int v3, int v4, int v5) { return false; } + virtual bool proc5(int v1) { return false; } + virtual bool loadStar() { return false; } + virtual bool proc7(int v1, int v2) { return true; } + + /** + * Load the item's data + */ + virtual void load(SimpleFile *file) {} + + /** + * Save the item's data + */ + virtual void save(SimpleFile *file, int indent) {} + + /** + * Clear allocated data + */ + void clear(); + + void initialize(); + + /** + * Get a pointer to a data entry + */ + CBaseStarEntry *getDataPtr(int index); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB3_H */ diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp index 9880e6f28c..d8b7d1206c 100644 --- a/engines/titanic/star_control/star_control.cpp +++ b/engines/titanic/star_control/star_control.cpp @@ -25,8 +25,8 @@ namespace Titanic { -CStarControl::CStarControl() : _fieldBC(0), _field80A0(0), - _field80A4(0), _field80A8(0), _field80AC(0), _field80B0(0) { +CStarControl::CStarControl() : _fieldBC(0), _field80B0(0), + _starRect(20, 10, 620, 350) { } void CStarControl::save(SimpleFile *file, int indent) { diff --git a/engines/titanic/star_control/star_control.h b/engines/titanic/star_control/star_control.h index 1bd2dec92b..be8ee752cf 100644 --- a/engines/titanic/star_control/star_control.h +++ b/engines/titanic/star_control/star_control.h @@ -34,10 +34,7 @@ private: int _fieldBC; CStarControlSub1 _sub1; CStarControlSub11 _sub11; - int _field80A0; - int _field80A4; - int _field80A8; - int _field80AC; + Rect _starRect; int _field80B0; public: CLASSDEF diff --git a/engines/titanic/star_control/star_control_sub2.cpp b/engines/titanic/star_control/star_control_sub2.cpp index 9b9a5f84ad..d221c9fb0e 100644 --- a/engines/titanic/star_control/star_control_sub2.cpp +++ b/engines/titanic/star_control/star_control_sub2.cpp @@ -24,5 +24,25 @@ namespace Titanic { +bool CStarControlSub2::proc3(int v1) { + clear(); + // TODO + return true; +} + +bool CStarControlSub2::proc4(int v1, int v2, int v3, int v4, int v5) { + // TODO + return true; +} + +bool CStarControlSub2::proc6() { + // TODO + return true; +} + +bool CStarControlSub2::proc7(int v1, int v2) { + // TODO + return true; +} } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub2.h b/engines/titanic/star_control/star_control_sub2.h index 2bae029c96..33fdb4259a 100644 --- a/engines/titanic/star_control/star_control_sub2.h +++ b/engines/titanic/star_control/star_control_sub2.h @@ -23,13 +23,18 @@ #ifndef TITANIC_STAR_CONTROL_SUB2_H #define TITANIC_STAR_CONTROL_SUB2_H -#include "titanic/star_control/star_control_sub3.h" +#include "titanic/star_control/base_star.h" namespace Titanic { -class CStarControlSub2: public CStarControlSub3 { +class CStarControlSub2: public CBaseStar { public: virtual ~CStarControlSub2() {} + + virtual bool proc3(int v1); + virtual bool proc4(int v1, int v2, int v3, int v4, int v5); + virtual bool proc6(); + virtual bool proc7(int v1, int v2); }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub3.cpp b/engines/titanic/star_control/star_control_sub3.cpp deleted file mode 100644 index c65a308535..0000000000 --- a/engines/titanic/star_control/star_control_sub3.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* 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 "titanic/star_control/star_control_sub3.h" - -namespace Titanic { - -CStarControlSub3::CStarControlSub3() : _field4(0), _field8(0), - _fieldC(1), _field28(0), _field2C(0x3F800000) { -} - -void CStarControlSub3::proc2() { - error("TODO"); -} - -} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub3.h b/engines/titanic/star_control/star_control_sub3.h deleted file mode 100644 index 08d0835e1c..0000000000 --- a/engines/titanic/star_control/star_control_sub3.h +++ /dev/null @@ -1,58 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_STAR_CONTROL_SUB3_H -#define TITANIC_STAR_CONTROL_SUB3_H - -#include "titanic/support/simple_file.h" -#include "titanic/star_control/star_control_sub4.h" - -namespace Titanic { - -class CStarControlSub3 { -protected: - int _field4; - int _field8; - int _fieldC; - CStarControlSub4 _sub4; - int _field28; - int _field2C; -public: - CStarControlSub3(); - virtual ~CStarControlSub3() {} - - virtual void proc2(); - virtual int proc3() { return 1; } - virtual int proc4() { return 0; } - virtual int proc5() { return 0; } - virtual int proc6() { return 0; } - virtual int proc7() { return 1; } - - virtual void load(SimpleFile *file) {} - - virtual void proc9() {} - -}; - -} // End of namespace Titanic - -#endif /* TITANIC_STAR_CONTROL_SUB3_H */ diff --git a/engines/titanic/star_control/star_control_sub4.cpp b/engines/titanic/star_control/star_control_sub4.cpp index 27ef859f51..f765acbbc1 100644 --- a/engines/titanic/star_control/star_control_sub4.cpp +++ b/engines/titanic/star_control/star_control_sub4.cpp @@ -20,12 +20,26 @@ * */ +#include "common/algorithm.h" #include "titanic/star_control/star_control_sub4.h" namespace Titanic { -CStarControlSub4::CStarControlSub4() : _field0(0), - _field4(0), _fieldC(0), _field10(0), _field14(0) { +CStarControlSub4::CStarControlSub4() { +} + +void CStarControlSub4::initialize() { + _min._v1 = _min._v2 = _min._v3 = 9.9999994e27; + _max._v1 = _max._v2 = _max._v3 = -9.9999994e27; +} + +void CStarControlSub4::checkEntry(const CBaseStarVal &val) { + _min._v1 = MIN(_min._v1, val._v1); + _min._v2 = MIN(_min._v2, val._v2); + _min._v3 = MIN(_min._v3, val._v3); + _max._v1 = MAX(_max._v1, val._v1); + _max._v2 = MAX(_max._v2, val._v2); + _max._v3 = MAX(_max._v3, val._v3); } } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub4.h b/engines/titanic/star_control/star_control_sub4.h index 4aa75f8566..f0fcfaf7f4 100644 --- a/engines/titanic/star_control/star_control_sub4.h +++ b/engines/titanic/star_control/star_control_sub4.h @@ -25,17 +25,21 @@ namespace Titanic { +struct CBaseStarVal { + double _v1, _v2, _v3; + CBaseStarVal() : _v1(0), _v2(0), _v3(0) {} +}; + class CStarControlSub4 { private: - int _field0; - int _field4; - int _field8; - int _fieldC; - int _field10; - int _field14; + CBaseStarVal _min; + CBaseStarVal _max; public: CStarControlSub4(); + void initialize(); + + void checkEntry(const CBaseStarVal &val); }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub6.cpp b/engines/titanic/star_control/star_control_sub6.cpp index 79937b7cab..c4161813f4 100644 --- a/engines/titanic/star_control/star_control_sub6.cpp +++ b/engines/titanic/star_control/star_control_sub6.cpp @@ -32,11 +32,11 @@ void CStarControlSub6::clear() { _field0 = 0x3F800000; _field4 = 0; _field8 = 0; - _fieldC = 0), + _fieldC = 0; _field10 = 0x3F800000; _field14 = 0; _field18 = 0; - _field1C = 0), + _field1C = 0; _field20 = 0x3F800000; _field24 = 0; _field28 = 0; diff --git a/engines/titanic/star_control/star_control_sub7.cpp b/engines/titanic/star_control/star_control_sub7.cpp index 0677e33558..b33f8be582 100644 --- a/engines/titanic/star_control/star_control_sub7.cpp +++ b/engines/titanic/star_control/star_control_sub7.cpp @@ -24,5 +24,13 @@ namespace Titanic { +void CStarControlSub7::proc2(int v1, int v2, int v3) { + // TODO +} + +bool CStarControlSub7::proc5(int v1) { + // TODO + return true; +} } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub7.h b/engines/titanic/star_control/star_control_sub7.h index 9999423d94..b73124ddd7 100644 --- a/engines/titanic/star_control/star_control_sub7.h +++ b/engines/titanic/star_control/star_control_sub7.h @@ -23,11 +23,15 @@ #ifndef TITANIC_STAR_CONTROL_SUB7_H #define TITANIC_STAR_CONTROL_SUB7_H -#include "titanic/star_control/star_control_sub3.h" +#include "titanic/star_control/base_star.h" namespace Titanic { -class CStarControlSub7 : public CStarControlSub3 { +class CStarControlSub7 : public CBaseStar { public: + virtual ~CStarControlSub7() { clear(); } + + virtual void proc2(int v1, int v2, int v3); + virtual bool proc5(int v1); }; } // End of namespace Titanic -- cgit v1.2.3 From 8f6ba6e00a919fdeb56f70d79f6c1fb62856971d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 1 Jul 2016 18:25:03 -0400 Subject: TITANIC: Added CBaseStar data loading --- engines/titanic/star_control/base_star.cpp | 65 ++++++++++++++++++++-- engines/titanic/star_control/base_star.h | 35 +++++++++--- engines/titanic/star_control/star_control_sub2.cpp | 2 +- engines/titanic/star_control/star_control_sub2.h | 2 +- 4 files changed, 90 insertions(+), 14 deletions(-) diff --git a/engines/titanic/star_control/base_star.cpp b/engines/titanic/star_control/base_star.cpp index c8f55a7931..7b57b88f6b 100644 --- a/engines/titanic/star_control/base_star.cpp +++ b/engines/titanic/star_control/base_star.cpp @@ -21,10 +21,31 @@ */ #include "titanic/star_control/base_star.h" +#include "titanic/titanic.h" namespace Titanic { -CBaseStar::CBaseStar() : _fieldC(1), _minVal(0.0), _maxVal(1.0), _range(0.0) { +CBaseStarEntry::CBaseStarEntry() : _field0(0), _value(0.0) { + Common::fill(&_data[0], &_data[5], 0); +} + +void CBaseStarEntry::load(Common::SeekableReadStream &s) { + _field0 = s.readByte(); + _field1 = s.readByte(); + _field2 = s.readByte(); + _field3 = s.readByte(); + *((uint32 *)&_value) = s.readUint32LE(); // FIXME + _val._v1 = s.readUint32LE(); + _val._v2 = s.readUint32LE(); + _val._v3 = s.readUint32LE(); + + for (int idx = 0; idx < 5; ++idx) + _data[idx] = s.readUint32LE(); +} + +/*------------------------------------------------------------------------*/ + +CBaseStar::CBaseStar() : _minVal(0.0), _maxVal(1.0), _range(0.0) { } void CBaseStar::proc2(int v1, int v2, int v3) { @@ -32,10 +53,7 @@ void CBaseStar::proc2(int v1, int v2, int v3) { } void CBaseStar::clear() { - if (!_data.empty()) { - if (_fieldC) - _data.clear(); - } + _data.clear(); } void CBaseStar::initialize() { @@ -60,4 +78,41 @@ CBaseStarEntry *CBaseStar::getDataPtr(int index) { return (index >= 0 && index < (int)_data.size()) ? &_data[index] : nullptr; } +void CBaseStar::loadData(Common::SeekableReadStream &s) { + uint headerId = s.readUint32LE(); + uint count = s.readUint32LE(); + if (headerId != 100 || count == 0); + error("Invalid star data"); + + // Initialize the data array + clear(); + _data.resize(count); + + // Iterate through reading the data for each entry + for (uint idx = 0; idx < count; ++idx) + _data[idx].load(s); +} + +void CBaseStar::loadData(const CString &resName) { + // Get a stream to read the data from the DAT file + Common::SeekableReadStream *stream = g_vm->_filesManager->getResource(resName); + assert(stream); + + // Load the stream + loadData(*stream); + delete stream; +} + +void CBaseStar::resetEntry(CBaseStarEntry &entry) { + entry._field0 = 0xFF; + entry._field1 = 0xFF; + entry._field2 = 0xFF; + entry._field3 = 0; + entry._val._v1 = 0; + entry._val._v2 = 0; + entry._val._v3 = 0; + for (int idx = 0; idx < 5; ++idx) + entry._data[idx] = 0; +} + } // End of namespace Titanic diff --git a/engines/titanic/star_control/base_star.h b/engines/titanic/star_control/base_star.h index 20dbacedb6..ad3ad13804 100644 --- a/engines/titanic/star_control/base_star.h +++ b/engines/titanic/star_control/base_star.h @@ -29,19 +29,45 @@ namespace Titanic { struct CBaseStarEntry { - int _field0; + byte _field0; + byte _field1; + byte _field2; + byte _field3; double _value; CBaseStarVal _val; + uint _data[5]; + + CBaseStarEntry(); + void load(Common::SeekableReadStream &s); }; class CBaseStar { protected: Common::Array _data; - int _fieldC; CStarControlSub4 _sub4; double _minVal; double _maxVal; double _range; +protected: + /** + * Get a pointer to a data entry + */ + CBaseStarEntry *getDataPtr(int index); + + /** + * Load entry data from a passed stream + */ + void loadData(Common::SeekableReadStream &s); + + /** + * Load entry data from a specified resource + */ + void loadData(const CString &resName); + + /** + * Reset the data for an entry + */ + void resetEntry(CBaseStarEntry &entry); public: CBaseStar(); virtual ~CBaseStar() {} @@ -69,11 +95,6 @@ public: void clear(); void initialize(); - - /** - * Get a pointer to a data entry - */ - CBaseStarEntry *getDataPtr(int index); }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub2.cpp b/engines/titanic/star_control/star_control_sub2.cpp index d221c9fb0e..eeebaa157a 100644 --- a/engines/titanic/star_control/star_control_sub2.cpp +++ b/engines/titanic/star_control/star_control_sub2.cpp @@ -35,7 +35,7 @@ bool CStarControlSub2::proc4(int v1, int v2, int v3, int v4, int v5) { return true; } -bool CStarControlSub2::proc6() { +bool CStarControlSub2::loadStar() { // TODO return true; } diff --git a/engines/titanic/star_control/star_control_sub2.h b/engines/titanic/star_control/star_control_sub2.h index 33fdb4259a..bfbe02c41c 100644 --- a/engines/titanic/star_control/star_control_sub2.h +++ b/engines/titanic/star_control/star_control_sub2.h @@ -33,7 +33,7 @@ public: virtual bool proc3(int v1); virtual bool proc4(int v1, int v2, int v3, int v4, int v5); - virtual bool proc6(); + virtual bool loadStar(); virtual bool proc7(int v1, int v2); }; -- cgit v1.2.3 From 712db65ff4d1e10d07ed873cc5929a1cbb0862be Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 2 Jul 2016 14:17:02 -0400 Subject: TITANIC: Implemented CStarControlSub15 class --- engines/titanic/module.mk | 4 +- engines/titanic/star_control/star_control.cpp | 9 ++- engines/titanic/star_control/star_control.h | 9 ++- .../titanic/star_control/star_control_sub11.cpp | 51 --------------- engines/titanic/star_control/star_control_sub11.h | 63 ------------------ engines/titanic/star_control/star_control_sub12.h | 4 +- .../titanic/star_control/star_control_sub16.cpp | 74 ++++++++++++++++++++++ engines/titanic/star_control/star_control_sub16.h | 57 +++++++++++++++++ engines/titanic/star_control/star_view.cpp | 67 ++++++++++++++++++++ engines/titanic/star_control/star_view.h | 69 ++++++++++++++++++++ 10 files changed, 287 insertions(+), 120 deletions(-) delete mode 100644 engines/titanic/star_control/star_control_sub11.cpp delete mode 100644 engines/titanic/star_control/star_control_sub11.h create mode 100644 engines/titanic/star_control/star_control_sub16.cpp create mode 100644 engines/titanic/star_control/star_control_sub16.h create mode 100644 engines/titanic/star_control/star_view.cpp create mode 100644 engines/titanic/star_control/star_view.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 7138f57464..71df87d9cf 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -427,11 +427,13 @@ MODULE_OBJS := \ star_control/star_control_sub8.o \ star_control/star_control_sub9.o \ star_control/star_control_sub10.o \ - star_control/star_control_sub11.o \ + star_control/star_view.o \ star_control/star_control_sub12.o \ star_control/star_control_sub13.o \ star_control/star_control_sub14.o \ star_control/star_control_sub15.o \ + star_control/star_control_sub16.o \ + star_control/surface_obj.o \ support/direct_draw.o \ support/direct_draw_surface.o \ support/exe_resources.o \ diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp index d8b7d1206c..aa65781e93 100644 --- a/engines/titanic/star_control/star_control.cpp +++ b/engines/titanic/star_control/star_control.cpp @@ -31,6 +31,8 @@ CStarControl::CStarControl() : _fieldBC(0), _field80B0(0), void CStarControl::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); + _sub1.save(file, indent); + _view.save(file, indent); CGameObject::save(file, indent); } @@ -42,7 +44,7 @@ void CStarControl::load(SimpleFile *file) { if (!_sub1.initDocument()) error("Couldn't initialise the StarField document"); - _sub11.load(file, 0); + _view.load(file, 0); CScreenManager *screenManager = CScreenManager::setCurrent(); if (!screenManager) error("There's no screen manager during loading"); @@ -53,6 +55,11 @@ void CStarControl::load(SimpleFile *file) { CGameObject::load(file); } +void CStarControl::draw(CScreenManager *screenManager) { + if (_visible) + _view.draw(screenManager); +} + void CStarControl::fn3() { warning("CStarControl::fn3"); } diff --git a/engines/titanic/star_control/star_control.h b/engines/titanic/star_control/star_control.h index be8ee752cf..c653e8ef7b 100644 --- a/engines/titanic/star_control/star_control.h +++ b/engines/titanic/star_control/star_control.h @@ -25,7 +25,7 @@ #include "titanic/core/game_object.h" #include "titanic/star_control/star_control_sub1.h" -#include "titanic/star_control/star_control_sub11.h" +#include "titanic/star_control/star_view.h" namespace Titanic { @@ -33,7 +33,7 @@ class CStarControl : public CGameObject { private: int _fieldBC; CStarControlSub1 _sub1; - CStarControlSub11 _sub11; + CStarView _view; Rect _starRect; int _field80B0; public: @@ -50,6 +50,11 @@ public: */ virtual void load(SimpleFile *file); + /** + * Allows the item to draw itself + */ + virtual void draw(CScreenManager *screenManager); + void fn1(int v); void fn3(); void fn4(); diff --git a/engines/titanic/star_control/star_control_sub11.cpp b/engines/titanic/star_control/star_control_sub11.cpp deleted file mode 100644 index 05f2733e21..0000000000 --- a/engines/titanic/star_control/star_control_sub11.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* 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 "titanic/support/screen_manager.h" -#include "titanic/star_control/star_control_sub11.h" - -namespace Titanic { - -CStarControlSub11::CStarControlSub11() : - _sub12(nullptr, nullptr), _sub13(nullptr), - _field4(0), _field8(0), _field118(0), _field20C(0), - _field210(0), _field214(0), _field218(0), _field21C(0) { - _sub12.proc3(); -} - -void CStarControlSub11::load(SimpleFile *file, int param) { - if (!param) { - _sub12.load(file, param); - - _field118 = file->readNumber(); - if (_field118) - _sub13.load(file, 0); - - _field218 = file->readNumber(); - _field21C = file->readNumber(); - } -} - -void CStarControlSub11::save(SimpleFile *file, int indent) { -} - -} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub11.h b/engines/titanic/star_control/star_control_sub11.h deleted file mode 100644 index a322e1e43a..0000000000 --- a/engines/titanic/star_control/star_control_sub11.h +++ /dev/null @@ -1,63 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_STAR_CONTROL_SUB11_H -#define TITANIC_STAR_CONTROL_SUB11_H - -#include "titanic/support/simple_file.h" -#include "titanic/star_control/star_control_sub12.h" -#include "titanic/star_control/star_control_sub13.h" -#include "titanic/star_control/star_control_sub15.h" - -namespace Titanic { - -class CStarControlSub11 { -private: - int _field0; - int _field4; - int _field8; - CStarControlSub12 _sub12; - int _field118; - CStarControlSub13 _sub13; - CStarControlSub15 _sub15; - int _field20C; - int _field210; - int _field214; - int _field218; - int _field21C; -public: - CStarControlSub11(); - - /** - * Load the data for the class from file - */ - void load(SimpleFile *file, int param); - - /** - * Save the data for the class to file - */ - void save(SimpleFile *file, int indent); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_STAR_CONTROL_SUB11_H */ diff --git a/engines/titanic/star_control/star_control_sub12.h b/engines/titanic/star_control/star_control_sub12.h index bce668f863..e053aefb84 100644 --- a/engines/titanic/star_control/star_control_sub12.h +++ b/engines/titanic/star_control/star_control_sub12.h @@ -50,12 +50,12 @@ public: /** * Load the data for the class from file */ - void load(SimpleFile *file, int param); + virtual void load(SimpleFile *file, int param); /** * Save the data for the class to file */ - void save(SimpleFile *file, int indent); + virtual void save(SimpleFile *file, int indent); }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub16.cpp b/engines/titanic/star_control/star_control_sub16.cpp new file mode 100644 index 0000000000..1465ac6a3e --- /dev/null +++ b/engines/titanic/star_control/star_control_sub16.cpp @@ -0,0 +1,74 @@ +/* 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 "titanic/star_control/star_control_sub16.h" + +namespace Titanic { + +CStarControlSub16::CStarControlSub16() : _field4(-1), _field8(32), + _videoSurface(nullptr) { +} + +void CStarControlSub16::reset() { + _field4 = 0; +} + +bool CStarControlSub16::setupSurface(CScreenManager *screenManager, CVideoSurface *srcSurface) { + int width = srcSurface->getWidth(); + int height = srcSurface->getHeight(); + + if (_videoSurface) { + if (width == _videoSurface->getWidth() && _videoSurface->getHeight()) + // Allocated surface already matches new size + return true; + + // Different sizes, so delete old surface + delete _videoSurface; + } + + _videoSurface = screenManager->createSurface(width, height); + return true; +} + +CVideoSurface *CStarControlSub16::loadSurface(CScreenManager *screenManager, CVideoSurface *srcSurface) { + if (_field4 < 0 || _field4 >= _field8) + return srcSurface; + + if (!_field8 && !setupSurface(screenManager, srcSurface)) + return nullptr; + + srcSurface->lock(); + _videoSurface->lock(); + CSurfaceObj srcSurfaceObj(srcSurface); + CSurfaceObj destSurfaceObj(_videoSurface); + + proc4(srcSurfaceObj, destSurfaceObj); + + srcSurface->unlock(); + _videoSurface->unlock(); + + ++_field4; + return _videoSurface; +} + + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub16.h b/engines/titanic/star_control/star_control_sub16.h new file mode 100644 index 0000000000..64e463ca5b --- /dev/null +++ b/engines/titanic/star_control/star_control_sub16.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_CONTROL_SUB16_H +#define TITANIC_STAR_CONTROL_SUB16_H + +#include "titanic/support/video_surface.h" +#include "titanic/support/screen_manager.h" +#include "titanic/star_control/surface_obj.h" + +namespace Titanic { + +class CStarControlSub16 { +private: + /** + * Sets up an internal surface to match the size of the specified one + */ + bool setupSurface(CScreenManager *screenManager, CVideoSurface *srcSurface); +protected: + int _field4; + int _field8; + CVideoSurface *_videoSurface; +protected: + virtual void proc4(CSurfaceObj &srcSurface, CSurfaceObj &destSurface) = 0; +public: + CStarControlSub16(); + + virtual void reset(); + + /** + * Loads from a given source surface + */ + virtual CVideoSurface *loadSurface(CScreenManager *screenManager, CVideoSurface *srcSurface); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB16_H */ diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp new file mode 100644 index 0000000000..8af94c6b08 --- /dev/null +++ b/engines/titanic/star_control/star_view.cpp @@ -0,0 +1,67 @@ +/* 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 "titanic/support/screen_manager.h" +#include "titanic/star_control/star_view.h" + +namespace Titanic { + +CStarView::CStarView() : + _sub12(nullptr, nullptr), _sub13(nullptr), + _field4(0), _videoSurface(nullptr), _field118(0), _field20C(0), + _field210(0), _field214(0), _field218(0), _field21C(0) { + _sub12.proc3(); +} + +void CStarView::load(SimpleFile *file, int param) { + if (!param) { + _sub12.load(file, param); + + _field118 = file->readNumber(); + if (_field118) + _sub13.load(file, 0); + + _field218 = file->readNumber(); + _field21C = file->readNumber(); + } +} + +void CStarView::save(SimpleFile *file, int indent) { + _sub12.save(file, indent); + + file->writeNumberLine(_field118, indent); + if (_field118) + _sub13.save(file, indent); + + file->writeNumberLine(_field218, indent); + file->writeNumberLine(_field21C, indent); +} + +void CStarView::draw(CScreenManager *screenManager) { + if (!screenManager) + return; + + + // TODO +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_view.h b/engines/titanic/star_control/star_view.h new file mode 100644 index 0000000000..47d138a0dc --- /dev/null +++ b/engines/titanic/star_control/star_view.h @@ -0,0 +1,69 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_VIEW_H +#define TITANIC_STAR_VIEW_H + +#include "titanic/support/simple_file.h" +#include "titanic/support/video_surface.h" +#include "titanic/star_control/star_control_sub12.h" +#include "titanic/star_control/star_control_sub13.h" +#include "titanic/star_control/star_control_sub15.h" + +namespace Titanic { + +class CStarView { +private: + int _field0; + int _field4; + CVideoSurface *_videoSurface; + CStarControlSub12 _sub12; + int _field118; + CStarControlSub13 _sub13; + CStarControlSub15 _sub15; + int _field20C; + int _field210; + int _field214; + int _field218; + int _field21C; +public: + CStarView(); + + /** + * Load the data for the class from file + */ + void load(SimpleFile *file, int param); + + /** + * Save the data for the class to file + */ + void save(SimpleFile *file, int indent); + + /** + * Allows the item to draw itself + */ + void draw(CScreenManager *screenManager); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_RENDERER_H */ -- cgit v1.2.3 From ed2a716790255c93a75db3570de0d821978cfe68 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 2 Jul 2016 14:18:24 -0400 Subject: TITANIC: Implemented CSurfaceObj class --- engines/titanic/star_control/surface_obj.cpp | 50 +++++++++++++++++++++ engines/titanic/star_control/surface_obj.h | 65 ++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 engines/titanic/star_control/surface_obj.cpp create mode 100644 engines/titanic/star_control/surface_obj.h diff --git a/engines/titanic/star_control/surface_obj.cpp b/engines/titanic/star_control/surface_obj.cpp new file mode 100644 index 0000000000..93f46e5ad4 --- /dev/null +++ b/engines/titanic/star_control/surface_obj.cpp @@ -0,0 +1,50 @@ +/* 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 "titanic/star_control/surface_obj.h" + +namespace Titanic { + +CSurfaceObj::CSurfaceObj(CVideoSurface *surface) { + _width = surface->getWidth(); + _height = surface->getHeight(); + _pitch = surface->getPitch(); + + // Original supported other pixel depths + _bpp = surface->getPixelDepth(); + assert(_bpp == 2); + _pixelsPtr = surface->getPixels(); + + initialize(); +} + +void CSurfaceObj::initialize() { + _bounds = Rect(0, 0, _width - 1, _height - 1); + _centroid = Point(_width / 2, _height / 2); + _field22 = _field21 = _field20 = 0xFF; + _field27 = _field26 = _field25 = 0; + _field24 = _field23 = 0; + _field28 = _field2C = 0; + _field38 = 0; +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/surface_obj.h b/engines/titanic/star_control/surface_obj.h new file mode 100644 index 0000000000..518f85b502 --- /dev/null +++ b/engines/titanic/star_control/surface_obj.h @@ -0,0 +1,65 @@ +/* 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. + * + */ + +#ifndef TITANIC_SURFACE_OBJ_H +#define TITANIC_SURFACE_OBJ_H + +#include "titanic/support/rect.h" +#include "titanic/support/video_surface.h" + +namespace Titanic { + +class CSurfaceObj { +private: + /** + * Initialize data for the class + */ + void initialize(); +public: + int _field0; + int _width; + int _height; + int _pitch; + int _bpp; + uint16 *_pixelsPtr; + Point _centroid; + byte _field20; + byte _field21; + byte _field22; + byte _field23; + byte _field24; + byte _field25; + byte _field26; + byte _field27; + int _field28; + int _field2C; + int _field30; + int _field34; + int _field38; + Rect _bounds; +public: + CSurfaceObj(CVideoSurface *surface); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB16_H */ -- cgit v1.2.3 From 79b4754b3318c21479dfccaf91dcf09fabf23fd4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 2 Jul 2016 16:11:19 -0400 Subject: TITANIC: Finish and better name fader classes --- engines/titanic/module.mk | 4 +- .../titanic/star_control/star_control_sub15.cpp | 31 --------- engines/titanic/star_control/star_control_sub15.h | 43 ------------ .../titanic/star_control/star_control_sub16.cpp | 74 -------------------- engines/titanic/star_control/star_control_sub16.h | 57 ---------------- engines/titanic/star_control/star_view.h | 4 +- engines/titanic/star_control/surface_area.cpp | 50 ++++++++++++++ engines/titanic/star_control/surface_area.h | 65 ++++++++++++++++++ engines/titanic/star_control/surface_fader.cpp | 73 ++++++++++++++++++++ engines/titanic/star_control/surface_fader.h | 51 ++++++++++++++ .../titanic/star_control/surface_fader_base.cpp | 78 ++++++++++++++++++++++ engines/titanic/star_control/surface_fader_base.h | 62 +++++++++++++++++ engines/titanic/star_control/surface_obj.cpp | 50 -------------- engines/titanic/star_control/surface_obj.h | 65 ------------------ 14 files changed, 384 insertions(+), 323 deletions(-) delete mode 100644 engines/titanic/star_control/star_control_sub15.cpp delete mode 100644 engines/titanic/star_control/star_control_sub15.h delete mode 100644 engines/titanic/star_control/star_control_sub16.cpp delete mode 100644 engines/titanic/star_control/star_control_sub16.h create mode 100644 engines/titanic/star_control/surface_area.cpp create mode 100644 engines/titanic/star_control/surface_area.h create mode 100644 engines/titanic/star_control/surface_fader.cpp create mode 100644 engines/titanic/star_control/surface_fader.h create mode 100644 engines/titanic/star_control/surface_fader_base.cpp create mode 100644 engines/titanic/star_control/surface_fader_base.h delete mode 100644 engines/titanic/star_control/surface_obj.cpp delete mode 100644 engines/titanic/star_control/surface_obj.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 71df87d9cf..79f55d4413 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -433,7 +433,9 @@ MODULE_OBJS := \ star_control/star_control_sub14.o \ star_control/star_control_sub15.o \ star_control/star_control_sub16.o \ - star_control/surface_obj.o \ + star_control/surface_area.o \ + star_control/surface_fader_base.o \ + star_control/surface_fader.o \ support/direct_draw.o \ support/direct_draw_surface.o \ support/exe_resources.o \ diff --git a/engines/titanic/star_control/star_control_sub15.cpp b/engines/titanic/star_control/star_control_sub15.cpp deleted file mode 100644 index 07ed80ccc5..0000000000 --- a/engines/titanic/star_control/star_control_sub15.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 "titanic/star_control/star_control_sub15.h" - -namespace Titanic { - -CStarControlSub15::CStarControlSub15() : _field4(-1), - _field8(32), _fieldC(0), _field10(0), _field14(0) { -} - -} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub15.h b/engines/titanic/star_control/star_control_sub15.h deleted file mode 100644 index 0e0d2e41c0..0000000000 --- a/engines/titanic/star_control/star_control_sub15.h +++ /dev/null @@ -1,43 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_STAR_CONTROL_SUB15_H -#define TITANIC_STAR_CONTROL_SUB15_H - -#include "titanic/support/simple_file.h" - -namespace Titanic { - -class CStarControlSub15 { -private: - double _field4; - double _field8; - double _fieldC; - double _field10; - double _field14; -public: - CStarControlSub15(); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_STAR_CONTROL_SUB15_H */ diff --git a/engines/titanic/star_control/star_control_sub16.cpp b/engines/titanic/star_control/star_control_sub16.cpp deleted file mode 100644 index 1465ac6a3e..0000000000 --- a/engines/titanic/star_control/star_control_sub16.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* 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 "titanic/star_control/star_control_sub16.h" - -namespace Titanic { - -CStarControlSub16::CStarControlSub16() : _field4(-1), _field8(32), - _videoSurface(nullptr) { -} - -void CStarControlSub16::reset() { - _field4 = 0; -} - -bool CStarControlSub16::setupSurface(CScreenManager *screenManager, CVideoSurface *srcSurface) { - int width = srcSurface->getWidth(); - int height = srcSurface->getHeight(); - - if (_videoSurface) { - if (width == _videoSurface->getWidth() && _videoSurface->getHeight()) - // Allocated surface already matches new size - return true; - - // Different sizes, so delete old surface - delete _videoSurface; - } - - _videoSurface = screenManager->createSurface(width, height); - return true; -} - -CVideoSurface *CStarControlSub16::loadSurface(CScreenManager *screenManager, CVideoSurface *srcSurface) { - if (_field4 < 0 || _field4 >= _field8) - return srcSurface; - - if (!_field8 && !setupSurface(screenManager, srcSurface)) - return nullptr; - - srcSurface->lock(); - _videoSurface->lock(); - CSurfaceObj srcSurfaceObj(srcSurface); - CSurfaceObj destSurfaceObj(_videoSurface); - - proc4(srcSurfaceObj, destSurfaceObj); - - srcSurface->unlock(); - _videoSurface->unlock(); - - ++_field4; - return _videoSurface; -} - - -} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub16.h b/engines/titanic/star_control/star_control_sub16.h deleted file mode 100644 index 64e463ca5b..0000000000 --- a/engines/titanic/star_control/star_control_sub16.h +++ /dev/null @@ -1,57 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_STAR_CONTROL_SUB16_H -#define TITANIC_STAR_CONTROL_SUB16_H - -#include "titanic/support/video_surface.h" -#include "titanic/support/screen_manager.h" -#include "titanic/star_control/surface_obj.h" - -namespace Titanic { - -class CStarControlSub16 { -private: - /** - * Sets up an internal surface to match the size of the specified one - */ - bool setupSurface(CScreenManager *screenManager, CVideoSurface *srcSurface); -protected: - int _field4; - int _field8; - CVideoSurface *_videoSurface; -protected: - virtual void proc4(CSurfaceObj &srcSurface, CSurfaceObj &destSurface) = 0; -public: - CStarControlSub16(); - - virtual void reset(); - - /** - * Loads from a given source surface - */ - virtual CVideoSurface *loadSurface(CScreenManager *screenManager, CVideoSurface *srcSurface); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_STAR_CONTROL_SUB16_H */ diff --git a/engines/titanic/star_control/star_view.h b/engines/titanic/star_control/star_view.h index 47d138a0dc..d625d9bf0f 100644 --- a/engines/titanic/star_control/star_view.h +++ b/engines/titanic/star_control/star_view.h @@ -27,7 +27,7 @@ #include "titanic/support/video_surface.h" #include "titanic/star_control/star_control_sub12.h" #include "titanic/star_control/star_control_sub13.h" -#include "titanic/star_control/star_control_sub15.h" +#include "titanic/star_control/surface_fader.h" namespace Titanic { @@ -39,7 +39,7 @@ private: CStarControlSub12 _sub12; int _field118; CStarControlSub13 _sub13; - CStarControlSub15 _sub15; + CSurfaceFader _fader; int _field20C; int _field210; int _field214; diff --git a/engines/titanic/star_control/surface_area.cpp b/engines/titanic/star_control/surface_area.cpp new file mode 100644 index 0000000000..77f8222dad --- /dev/null +++ b/engines/titanic/star_control/surface_area.cpp @@ -0,0 +1,50 @@ +/* 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 "titanic/star_control/surface_area.h" + +namespace Titanic { + +CSurfaceArea::CSurfaceArea(CVideoSurface *surface) { + _width = surface->getWidth(); + _height = surface->getHeight(); + _pitch = surface->getPitch(); + + // Original supported other pixel depths + _bpp = surface->getPixelDepth(); + assert(_bpp == 2); + _pixelsPtr = surface->getPixels(); + + initialize(); +} + +void CSurfaceArea::initialize() { + _bounds = Rect(0, 0, _width - 1, _height - 1); + _centroid = Point(_width / 2, _height / 2); + _field22 = _field21 = _field20 = 0xFF; + _field27 = _field26 = _field25 = 0; + _field24 = _field23 = 0; + _field28 = _field2C = 0; + _field38 = 0; +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/surface_area.h b/engines/titanic/star_control/surface_area.h new file mode 100644 index 0000000000..4d1913123c --- /dev/null +++ b/engines/titanic/star_control/surface_area.h @@ -0,0 +1,65 @@ +/* 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. + * + */ + +#ifndef TITANIC_SURFACE_OBJ_H +#define TITANIC_SURFACE_OBJ_H + +#include "titanic/support/rect.h" +#include "titanic/support/video_surface.h" + +namespace Titanic { + +class CSurfaceArea { +private: + /** + * Initialize data for the class + */ + void initialize(); +public: + int _field0; + int _width; + int _height; + int _pitch; + int _bpp; + uint16 *_pixelsPtr; + Point _centroid; + byte _field20; + byte _field21; + byte _field22; + byte _field23; + byte _field24; + byte _field25; + byte _field26; + byte _field27; + int _field28; + int _field2C; + int _field30; + int _field34; + int _field38; + Rect _bounds; +public: + CSurfaceArea(CVideoSurface *surface); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB16_H */ diff --git a/engines/titanic/star_control/surface_fader.cpp b/engines/titanic/star_control/surface_fader.cpp new file mode 100644 index 0000000000..089ad51717 --- /dev/null +++ b/engines/titanic/star_control/surface_fader.cpp @@ -0,0 +1,73 @@ +/* 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 "titanic/star_control/surface_fader.h" +#include "common/system.h" +#include "graphics/pixelformat.h" + +namespace Titanic { + +CSurfaceFader::CSurfaceFader() : CSurfaceFaderBase() { + _dataP = new byte[_count]; + + for (int idx = 0; idx < _count; ++idx) { + // TODO: Setup data bytes + } +} + +CSurfaceFader::~CSurfaceFader() { + delete[] _dataP; +} + +void CSurfaceFader::copySurface(CSurfaceArea &srcSurface, CSurfaceArea &destSurface) { + const uint16 *srcPixelP = srcSurface._pixelsPtr; + uint16 *destPixelP = destSurface._pixelsPtr; + + // Currently we only support 2 bytes per pixel surfaces + assert(srcSurface._bpp == 2); + + byte dataVal = _dataP[_index]; + double fraction = (double)dataVal / ((double)(_count - 1)); + if (!_fadeIn) + // For fade outs, reverse the percentage visibility + fraction = 1.0 - fraction; + + // Iterate through the pixels + byte r, g, b; + Graphics::PixelFormat format = g_system->getScreenFormat(); + + for (int yp = 0; yp < srcSurface._height; ++yp) { + for (int xp = 0; xp < srcSurface._width; ++xp, ++srcPixelP, ++destPixelP) { + format.colorToRGB(*srcPixelP, r, g, b); + r = (byte)((double)r * fraction); + g = (byte)((double)g * fraction); + b = (byte)((double)b * fraction); + *destPixelP = format.RGBToColor(r, g, b); + } + } +} + +void CSurfaceFader::setFadeIn(bool fadeIn) { + _fadeIn = fadeIn; +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/surface_fader.h b/engines/titanic/star_control/surface_fader.h new file mode 100644 index 0000000000..650cbbb19b --- /dev/null +++ b/engines/titanic/star_control/surface_fader.h @@ -0,0 +1,51 @@ +/* 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. + * + */ + +#ifndef TITANIC_SURFACE_FADER_H +#define TITANIC_SURFACE_FADER_H + +#include "titanic/star_control/surface_fader_base.h" + +namespace Titanic { + +class CSurfaceFader: public CSurfaceFaderBase { +private: + byte *_dataP; + bool _fadeIn; +protected: + /** + * Create a faded version of the source surface at the given dest + */ + virtual void copySurface(CSurfaceArea &srcSurface, CSurfaceArea &destSurface); +public: + CSurfaceFader(); + virtual ~CSurfaceFader(); + + /** + * Sets whether a fade in (versus a fade out) should be done + */ + void setFadeIn(bool fadeIn); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SURFACE_SHADER_H */ diff --git a/engines/titanic/star_control/surface_fader_base.cpp b/engines/titanic/star_control/surface_fader_base.cpp new file mode 100644 index 0000000000..dfd7c4ab1d --- /dev/null +++ b/engines/titanic/star_control/surface_fader_base.cpp @@ -0,0 +1,78 @@ +/* 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 "titanic/star_control/surface_fader_base.h" + +namespace Titanic { + +CSurfaceFaderBase::CSurfaceFaderBase() : _index(-1), _count(32), + _videoSurface(nullptr) { +} + +CSurfaceFaderBase::~CSurfaceFaderBase() { + delete _videoSurface; +} + +void CSurfaceFaderBase::reset() { + _index = 0; +} + +bool CSurfaceFaderBase::setupSurface(CScreenManager *screenManager, CVideoSurface *srcSurface) { + int width = srcSurface->getWidth(); + int height = srcSurface->getHeight(); + + if (_videoSurface) { + if (width == _videoSurface->getWidth() && _videoSurface->getHeight()) + // Allocated surface already matches new size + return true; + + // Different sizes, so delete old surface + delete _videoSurface; + } + + _videoSurface = screenManager->createSurface(width, height); + return true; +} + +CVideoSurface *CSurfaceFaderBase::fade(CScreenManager *screenManager, CVideoSurface *srcSurface) { + if (_index == -1 || _index >= _count) + return srcSurface; + + if (!_count && !setupSurface(screenManager, srcSurface)) + return nullptr; + + srcSurface->lock(); + _videoSurface->lock(); + CSurfaceArea srCSurfaceArea(srcSurface); + CSurfaceArea destSurfaceObj(_videoSurface); + + // Copy the surface with fading + copySurface(srCSurfaceArea, destSurfaceObj); + + srcSurface->unlock(); + _videoSurface->unlock(); + + ++_index; + return _videoSurface; +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/surface_fader_base.h b/engines/titanic/star_control/surface_fader_base.h new file mode 100644 index 0000000000..ead4460521 --- /dev/null +++ b/engines/titanic/star_control/surface_fader_base.h @@ -0,0 +1,62 @@ +/* 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. + * + */ + +#ifndef TITANIC_SURFACE_FADER_BASE_H +#define TITANIC_SURFACE_FADER_BASE_H + +#include "titanic/support/video_surface.h" +#include "titanic/support/screen_manager.h" +#include "titanic/star_control/surface_area.h" + +namespace Titanic { + +class CSurfaceFaderBase { +private: + /** + * Sets up an internal surface to match the size of the specified one + */ + bool setupSurface(CScreenManager *screenManager, CVideoSurface *srcSurface); +protected: + int _index; + int _count; + CVideoSurface *_videoSurface; +protected: + /** + * Create a faded version of the source surface at the given dest + */ + virtual void copySurface(CSurfaceArea &srcSurface, CSurfaceArea &destSurface) = 0; +public: + CSurfaceFaderBase(); + virtual ~CSurfaceFaderBase(); + + virtual void reset(); + + /** + * Creates a faded version of the passed source surface, based on a percentage + * visibility specified by _index of _count + */ + virtual CVideoSurface *fade(CScreenManager *screenManager, CVideoSurface *srcSurface); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SURFACE_FADER_BASE_H */ diff --git a/engines/titanic/star_control/surface_obj.cpp b/engines/titanic/star_control/surface_obj.cpp deleted file mode 100644 index 93f46e5ad4..0000000000 --- a/engines/titanic/star_control/surface_obj.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* 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 "titanic/star_control/surface_obj.h" - -namespace Titanic { - -CSurfaceObj::CSurfaceObj(CVideoSurface *surface) { - _width = surface->getWidth(); - _height = surface->getHeight(); - _pitch = surface->getPitch(); - - // Original supported other pixel depths - _bpp = surface->getPixelDepth(); - assert(_bpp == 2); - _pixelsPtr = surface->getPixels(); - - initialize(); -} - -void CSurfaceObj::initialize() { - _bounds = Rect(0, 0, _width - 1, _height - 1); - _centroid = Point(_width / 2, _height / 2); - _field22 = _field21 = _field20 = 0xFF; - _field27 = _field26 = _field25 = 0; - _field24 = _field23 = 0; - _field28 = _field2C = 0; - _field38 = 0; -} - -} // End of namespace Titanic diff --git a/engines/titanic/star_control/surface_obj.h b/engines/titanic/star_control/surface_obj.h deleted file mode 100644 index 518f85b502..0000000000 --- a/engines/titanic/star_control/surface_obj.h +++ /dev/null @@ -1,65 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_SURFACE_OBJ_H -#define TITANIC_SURFACE_OBJ_H - -#include "titanic/support/rect.h" -#include "titanic/support/video_surface.h" - -namespace Titanic { - -class CSurfaceObj { -private: - /** - * Initialize data for the class - */ - void initialize(); -public: - int _field0; - int _width; - int _height; - int _pitch; - int _bpp; - uint16 *_pixelsPtr; - Point _centroid; - byte _field20; - byte _field21; - byte _field22; - byte _field23; - byte _field24; - byte _field25; - byte _field26; - byte _field27; - int _field28; - int _field2C; - int _field30; - int _field34; - int _field38; - Rect _bounds; -public: - CSurfaceObj(CVideoSurface *surface); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_STAR_CONTROL_SUB16_H */ -- cgit v1.2.3 From ed06a1a44e508fe671d05a3b5de96fdc2a415ba7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 2 Jul 2016 18:04:37 -0400 Subject: TITANIC: Added bulk ofCStarView draw --- engines/titanic/core/game_object.cpp | 4 --- engines/titanic/core/game_object.h | 15 +++------ engines/titanic/star_control/star_control.cpp | 5 ++- engines/titanic/star_control/star_view.cpp | 41 +++++++++++++++++++---- engines/titanic/star_control/star_view.h | 18 +++++++--- engines/titanic/star_control/surface_fader_base.h | 16 ++++++--- 6 files changed, 70 insertions(+), 29 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index a5657f583a..dcc66f569d 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -1101,10 +1101,6 @@ Point CGameObject::getControid() const { _bounds.top + _bounds.height() / 2); } -void CGameObject::performAction(int actionNum, CViewItem *view) { - // TODO -} - bool CGameObject::clipExistsByStart(const CString &name, int startFrame) const { return _movieClips.existsByStart(name, startFrame); } diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 8c53e159be..20059539d9 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -335,11 +335,6 @@ protected: */ void petClear() const; - /** - * Perform an action - */ - void performAction(int actionNum, CViewItem *view = nullptr); - /** * Returns the MailMan */ @@ -360,11 +355,6 @@ protected: */ CRoomItem *getHiddenRoom() const; - /** - * Returns a hidden object - */ - CGameObject *getHiddenObject(const CString &name) const; - /** * Scan the specified room for an item by name */ @@ -658,6 +648,11 @@ public: */ Found find(const CString &name, CGameObject **item, int findAreas); + /** + * Returns a hidden object + */ + CGameObject *getHiddenObject(const CString &name) const; + /** * Sets up credits text */ diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp index aa65781e93..ae29f3af83 100644 --- a/engines/titanic/star_control/star_control.cpp +++ b/engines/titanic/star_control/star_control.cpp @@ -49,7 +49,10 @@ void CStarControl::load(SimpleFile *file) { if (!screenManager) error("There's no screen manager during loading"); - warning("TODO"); + _view.setup(screenManager, &_sub1, this); + _view.reset(); + + _fieldBC = 1; } CGameObject::load(file); diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp index 8af94c6b08..c31a28c4b2 100644 --- a/engines/titanic/star_control/star_view.cpp +++ b/engines/titanic/star_control/star_view.cpp @@ -22,13 +22,15 @@ #include "titanic/support/screen_manager.h" #include "titanic/star_control/star_view.h" +#include "titanic/star_control/star_control.h" +#include "titanic/core/game_object.h" namespace Titanic { -CStarView::CStarView() : - _sub12(nullptr, nullptr), _sub13(nullptr), - _field4(0), _videoSurface(nullptr), _field118(0), _field20C(0), - _field210(0), _field214(0), _field218(0), _field21C(0) { +CStarView::CStarView() : _sub12(nullptr, nullptr), _sub13(nullptr), + _owner(nullptr), _sub1(nullptr), _videoSurface(nullptr), _field118(0), + _videoSurface2(nullptr), _field210(0), _homePhotoMask(nullptr), + _field218(0), _field21C(0) { _sub12.proc3(); } @@ -56,12 +58,39 @@ void CStarView::save(SimpleFile *file, int indent) { file->writeNumberLine(_field21C, indent); } +void CStarView::setup(CScreenManager *screenManager, CStarControlSub1 *sub1, CStarControl *starControl) { + _sub1 = sub1; + _owner = starControl; +} + +void CStarView::reset() { + // TODO +} + void CStarView::draw(CScreenManager *screenManager) { - if (!screenManager) + if (!screenManager || !_videoSurface || !_sub1) return; + if (_fader.isActive()) { + CVideoSurface *surface = _field21C ? _videoSurface2 : _videoSurface; + surface = _fader.fade(screenManager, surface); + screenManager->blitFrom(SURFACE_PRIMARY, surface); + } else { + Point destPos(20, 10); - // TODO + if (_field21C) { + screenManager->blitFrom(SURFACE_PRIMARY, _videoSurface2, &destPos); + + if (!_homePhotoMask && _owner) { + _homePhotoMask = _owner->getHiddenObject("HomePhotoMask"); + } + + if (_homePhotoMask) + _homePhotoMask->draw(screenManager, Point(20, 187)); + } else { + // TODO + } + } } } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_view.h b/engines/titanic/star_control/star_view.h index d625d9bf0f..cfd2c8c94d 100644 --- a/engines/titanic/star_control/star_view.h +++ b/engines/titanic/star_control/star_view.h @@ -31,18 +31,21 @@ namespace Titanic { +class CStarControl; +class CStarControlSub1; + class CStarView { private: - int _field0; - int _field4; + CStarControl *_owner; + CStarControlSub1 *_sub1; CVideoSurface *_videoSurface; CStarControlSub12 _sub12; int _field118; CStarControlSub13 _sub13; CSurfaceFader _fader; - int _field20C; + CVideoSurface *_videoSurface2; int _field210; - int _field214; + CGameObject *_homePhotoMask; int _field218; int _field21C; public: @@ -58,6 +61,13 @@ public: */ void save(SimpleFile *file, int indent); + /** + * Sets references used by the view + */ + void setup(CScreenManager *screenManager, CStarControlSub1 *sub1, CStarControl *starControl); + + void reset(); + /** * Allows the item to draw itself */ diff --git a/engines/titanic/star_control/surface_fader_base.h b/engines/titanic/star_control/surface_fader_base.h index ead4460521..463183537b 100644 --- a/engines/titanic/star_control/surface_fader_base.h +++ b/engines/titanic/star_control/surface_fader_base.h @@ -35,19 +35,22 @@ private: * Sets up an internal surface to match the size of the specified one */ bool setupSurface(CScreenManager *screenManager, CVideoSurface *srcSurface); -protected: - int _index; - int _count; - CVideoSurface *_videoSurface; protected: /** * Create a faded version of the source surface at the given dest */ virtual void copySurface(CSurfaceArea &srcSurface, CSurfaceArea &destSurface) = 0; +public: + int _index; + int _count; + CVideoSurface *_videoSurface; public: CSurfaceFaderBase(); virtual ~CSurfaceFaderBase(); + /** + * Reset fading back to the start + */ virtual void reset(); /** @@ -55,6 +58,11 @@ public: * visibility specified by _index of _count */ virtual CVideoSurface *fade(CScreenManager *screenManager, CVideoSurface *srcSurface); + + /** + * Returns true if a fade is in progress + */ + bool isActive() const { return _index != -1 && _index < _count; } }; } // End of namespace Titanic -- cgit v1.2.3 From 46ec1a004bf68d238e5cb141de7dbb426dbd3249 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 2 Jul 2016 18:46:54 -0400 Subject: TITANIC: Added CStarControl message handlers --- engines/titanic/star_control/error_code.h | 51 +++++++++++++++++++++++++ engines/titanic/star_control/star_control.cpp | 55 +++++++++++++++++++++++++++ engines/titanic/star_control/star_control.h | 10 +++++ engines/titanic/star_control/star_view.cpp | 13 +++++++ engines/titanic/star_control/star_view.h | 16 ++++++++ 5 files changed, 145 insertions(+) create mode 100644 engines/titanic/star_control/error_code.h diff --git a/engines/titanic/star_control/error_code.h b/engines/titanic/star_control/error_code.h new file mode 100644 index 0000000000..52b0fb9f9e --- /dev/null +++ b/engines/titanic/star_control/error_code.h @@ -0,0 +1,51 @@ +/* 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. + * + */ + +#ifndef TITANIC_ERROR_CODE_H +#define TITANIC_ERROR_CODE_H + +namespace Titanic { + +class CErrorCode { +private: + int _value; +public: + CErrorCode() : _value(0) {} + + /** + * Sets the error code + */ + void set() { _value = 1; } + + /** + * Gets the error code and resets it + */ + int get() { + int result = _value; + _value = 0; + return result; + } +}; + +} // End of namespace Titanic + +#endif /* TITANIC_ERROR_CODE_H */ diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp index ae29f3af83..8ab247e2aa 100644 --- a/engines/titanic/star_control/star_control.cpp +++ b/engines/titanic/star_control/star_control.cpp @@ -22,9 +22,17 @@ #include "titanic/support/screen_manager.h" #include "titanic/star_control/star_control.h" +#include "titanic/star_control/error_code.h" namespace Titanic { +BEGIN_MESSAGE_MAP(CStarControl, CGameObject) + ON_MESSAGE(MouseMoveMsg) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(KeyCharMsg) + ON_MESSAGE(FrameMsg) +END_MESSAGE_MAP() + CStarControl::CStarControl() : _fieldBC(0), _field80B0(0), _starRect(20, 10, 620, 350) { } @@ -63,6 +71,53 @@ void CStarControl::draw(CScreenManager *screenManager) { _view.draw(screenManager); } +bool CStarControl::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_visible && _starRect.contains(msg->_mousePos)) { + _view.MouseButtonDownMsg(0, Point(msg->_mousePos.x - 20, + msg->_mousePos.y - 10)); + return true; + } else { + return false; + } +} + +bool CStarControl::MouseMoveMsg(CMouseMoveMsg *msg) { + if (_visible && _starRect.contains(msg->_mousePos)) { + _view.MouseMoveMsg(0, Point(msg->_mousePos.x - 20, + msg->_mousePos.y - 10)); + makeDirty(); + return true; + } else { + return false; + } +} + +bool CStarControl::KeyCharMsg(CKeyCharMsg *msg) { + if (_visible) + _view.KeyCharMsg(msg->_key); + + return false; +} + +bool CStarControl::FrameMsg(CFrameMsg *msg) { + if (_visible) { + Point pt = getMousePos(); + if (_starRect.contains(pt)) + _view.MouseMoveMsg(0, pt); + + newFrame(); + makeDirty(); + return true; + } else { + return false; + } +} + +void CStarControl::newFrame() { + // TODO +} + + void CStarControl::fn3() { warning("CStarControl::fn3"); } diff --git a/engines/titanic/star_control/star_control.h b/engines/titanic/star_control/star_control.h index c653e8ef7b..0c1fab73e0 100644 --- a/engines/titanic/star_control/star_control.h +++ b/engines/titanic/star_control/star_control.h @@ -30,12 +30,22 @@ namespace Titanic { class CStarControl : public CGameObject { + DECLARE_MESSAGE_MAP + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool MouseMoveMsg(CMouseMoveMsg *msg); + bool KeyCharMsg(CKeyCharMsg *msg); + bool FrameMsg(CFrameMsg *msg); private: int _fieldBC; CStarControlSub1 _sub1; CStarView _view; Rect _starRect; int _field80B0; +private: + /** + * Called for ever new game frame + */ + void newFrame(); public: CLASSDEF CStarControl(); diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp index c31a28c4b2..35920a38ba 100644 --- a/engines/titanic/star_control/star_view.cpp +++ b/engines/titanic/star_control/star_view.cpp @@ -93,4 +93,17 @@ void CStarView::draw(CScreenManager *screenManager) { } } +void CStarView::MouseButtonDownMsg(int unused, const Point &pt) { + // TODO +} + +void CStarView::MouseMoveMsg(int unused, const Point &pt) { + // TODO +} + +CErrorCode CStarView::KeyCharMsg(int key) { + // TODO + return CErrorCode(); +} + } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_view.h b/engines/titanic/star_control/star_view.h index cfd2c8c94d..7ec86b5d22 100644 --- a/engines/titanic/star_control/star_view.h +++ b/engines/titanic/star_control/star_view.h @@ -28,6 +28,7 @@ #include "titanic/star_control/star_control_sub12.h" #include "titanic/star_control/star_control_sub13.h" #include "titanic/star_control/surface_fader.h" +#include "titanic/star_control/error_code.h" namespace Titanic { @@ -72,6 +73,21 @@ public: * Allows the item to draw itself */ void draw(CScreenManager *screenManager); + + /** + * Handles mouse down messages + */ + void MouseButtonDownMsg(int unused, const Point &pt); + + /** + * Handles mouse move messages + */ + void MouseMoveMsg(int unused, const Point &pt); + + /** + * Handles keyboard messages + */ + CErrorCode KeyCharMsg(int key); }; } // End of namespace Titanic -- cgit v1.2.3 From 2ff4d3ed66bd839fb3534429a645291b8ccbec67 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 2 Jul 2016 19:48:40 -0400 Subject: TITANIC: Adding starfield points loading --- devtools/create_titanic/create_titanic_dat.cpp | 15 ++++++- engines/titanic/module.mk | 2 +- engines/titanic/star_control/star_array.cpp | 50 ++++++++++++++++++++++ engines/titanic/star_control/star_array.h | 49 +++++++++++++++++++++ engines/titanic/star_control/star_control_sub1.cpp | 1 + engines/titanic/star_control/star_control_sub1.h | 4 +- .../titanic/star_control/star_control_sub10.cpp | 28 ------------ engines/titanic/star_control/star_control_sub10.h | 38 ---------------- 8 files changed, 117 insertions(+), 70 deletions(-) create mode 100644 engines/titanic/star_control/star_array.cpp create mode 100644 engines/titanic/star_control/star_array.h delete mode 100644 engines/titanic/star_control/star_control_sub10.cpp delete mode 100644 engines/titanic/star_control/star_control_sub10.h diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index 09a4b4ce35..be58deb68d 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -52,7 +52,7 @@ */ #define VERSION_NUMBER 1 -#define HEADER_SIZE 0x640 +#define HEADER_SIZE 0x680 Common::File inputFile, outputFile; Common::PEResources res; @@ -422,6 +422,18 @@ void writeSentenceMappings(const char *name, uint offset, int numValues) { dataOffset += size; } + +void writeStarfieldPoints() { + outputFile.seek(dataOffset); + + inputFile.seek(0x59DE4C - FILE_DIFF); + uint size = 876 * 12; + + outputFile.write(inputFile, size); + writeEntryHeader("STARFIELD/POINTS", dataOffset, size); + dataOffset += size; +} + void writeHeader() { // Write out magic string const char *MAGIC_STR = "SVTN"; @@ -451,6 +463,7 @@ void writeData() { writeResource("STFONT", 153); writeResource("STARFIELD", 132); + writeStarfieldPoints(); writeResource("TEXT", "STVOCAB.TXT"); writeResource("TEXT", "JRQUOTES.TXT"); diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 79f55d4413..f1392f165b 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -420,13 +420,13 @@ MODULE_OBJS := \ star_control/star_control_sub1.o \ star_control/star_control_sub2.o \ star_control/base_star.o \ + star_control/star_array.o \ star_control/star_control_sub4.o \ star_control/star_control_sub5.o \ star_control/star_control_sub6.o \ star_control/star_control_sub7.o \ star_control/star_control_sub8.o \ star_control/star_control_sub9.o \ - star_control/star_control_sub10.o \ star_control/star_view.o \ star_control/star_control_sub12.o \ star_control/star_control_sub13.o \ diff --git a/engines/titanic/star_control/star_array.cpp b/engines/titanic/star_control/star_array.cpp new file mode 100644 index 0000000000..1af608db51 --- /dev/null +++ b/engines/titanic/star_control/star_array.cpp @@ -0,0 +1,50 @@ +/* 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 "titanic/star_control/star_array.h" +#include "titanic/titanic.h" + +namespace Titanic { + +#define ARRAY_COUNT 876 + +CStarArray::CStarArray() { +} + +void CStarArray::initialize() { + // Get a reference to the starfield points resource + Common::SeekableReadStream *stream = g_vm->_filesManager->getResource("STARFIELD/POINTS"); + assert(stream && stream->size() == (12 * ARRAY_COUNT)); + + _data.resize(ARRAY_COUNT); + for (int idx = 0; idx < ARRAY_COUNT; ++idx) { + // Get the next set of values + int v1 = stream->readUint32LE(); + int v2 = stream->readUint32LE(); + stream->readUint32LE(); + + // Pre-process them + // TODO + } +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_array.h b/engines/titanic/star_control/star_array.h new file mode 100644 index 0000000000..859db60ed1 --- /dev/null +++ b/engines/titanic/star_control/star_array.h @@ -0,0 +1,49 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_ARRAY_H +#define TITANIC_STAR_ARRAY_H + +#include "common/array.h" + +namespace Titanic { + +class CStarArray { + struct CStarArrayEntry { + double _v1; + double _v2; + double _v3; + }; +private: + Common::Array _data; +public: + CStarArray(); + + /** + * Initialize the array + */ + void initialize(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_ARRAY_H */ diff --git a/engines/titanic/star_control/star_control_sub1.cpp b/engines/titanic/star_control/star_control_sub1.cpp index 6adc9a64d0..5edbab1e86 100644 --- a/engines/titanic/star_control/star_control_sub1.cpp +++ b/engines/titanic/star_control/star_control_sub1.cpp @@ -43,6 +43,7 @@ void CStarControlSub1::load(SimpleFile *file, int param) { bool CStarControlSub1::initDocument() { warning("CStarControlSub1::initDocument"); + _starArray.initialize(); return true; } diff --git a/engines/titanic/star_control/star_control_sub1.h b/engines/titanic/star_control/star_control_sub1.h index 2e76a1ff41..0e99b4ef72 100644 --- a/engines/titanic/star_control/star_control_sub1.h +++ b/engines/titanic/star_control/star_control_sub1.h @@ -23,12 +23,12 @@ #ifndef TITANIC_STAR_CONTROL_SUB1_H #define TITANIC_STAR_CONTROL_SUB1_H +#include "titanic/star_control/star_array.h" #include "titanic/star_control/star_control_sub2.h" #include "titanic/star_control/star_control_sub5.h" #include "titanic/star_control/star_control_sub7.h" #include "titanic/star_control/star_control_sub8.h" #include "titanic/star_control/star_control_sub9.h" -#include "titanic/star_control/star_control_sub10.h" namespace Titanic { @@ -37,7 +37,7 @@ private: CStarControlSub7 _sub7; CStarControlSub8 _sub8; CStarControlSub9 _sub9; - CStarControlSub10 _sub10; + CStarArray _starArray; CStarControlSub5 _sub5; int _field7DA8; int _field7DAC; diff --git a/engines/titanic/star_control/star_control_sub10.cpp b/engines/titanic/star_control/star_control_sub10.cpp deleted file mode 100644 index ca32f5e7dc..0000000000 --- a/engines/titanic/star_control/star_control_sub10.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* 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 "titanic/star_control/star_control_sub10.h" - -namespace Titanic { - - -} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub10.h b/engines/titanic/star_control/star_control_sub10.h deleted file mode 100644 index af4ad17c6e..0000000000 --- a/engines/titanic/star_control/star_control_sub10.h +++ /dev/null @@ -1,38 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_STAR_CONTROL_SUB10_H -#define TITANIC_STAR_CONTROL_SUB10_H - -namespace Titanic { - -class CStarControlSub10 { -private: - int _field0; - int _field4; -public: - CStarControlSub10() : _field0(0), _field4(0) {} -}; - -} // End of namespace Titanic - -#endif /* TITANIC_STAR_CONTROL_SUB10_H */ -- cgit v1.2.3 From 82c0be2bc525e87b1be0f59c88a93ebd0ae2e189 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 3 Jul 2016 11:28:26 -0400 Subject: DEVTOOLS: Add second starfield points array to create_titanic --- devtools/create_titanic/create_titanic_dat.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index be58deb68d..2ea8f2a676 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -422,7 +422,6 @@ void writeSentenceMappings(const char *name, uint offset, int numValues) { dataOffset += size; } - void writeStarfieldPoints() { outputFile.seek(dataOffset); @@ -434,6 +433,25 @@ void writeStarfieldPoints() { dataOffset += size; } +void writeStarfieldPoints2() { + outputFile.seek(dataOffset); + + for (int rootCtr = 0; rootCtr < 80; ++rootCtr) { + inputFile.seek(0x5A2F28 - FILE_DIFF + rootCtr * 8); + uint offset = inputFile.readUint32LE(); + uint count = inputFile.readUint32LE(); + + outputFile.writeLong(count); + inputFile.seek(offset - FILE_DIFF); + outputFile.write(inputFile, count * 4 * 4); + } + + uint size = outputFile.size() - dataOffset; + outputFile.write(inputFile, size); + writeEntryHeader("STARFIELD/POINTS2", dataOffset, size); + dataOffset += size; +} + void writeHeader() { // Write out magic string const char *MAGIC_STR = "SVTN"; @@ -464,6 +482,7 @@ void writeData() { writeResource("STARFIELD", 132); writeStarfieldPoints(); + writeStarfieldPoints2(); writeResource("TEXT", "STVOCAB.TXT"); writeResource("TEXT", "JRQUOTES.TXT"); -- cgit v1.2.3 From 4840e3e86b9d710f255b7e6faefdf8dc9ec8aecc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 3 Jul 2016 11:28:49 -0400 Subject: TITANIC: In-progress loading of second starfield points array --- engines/titanic/star_control/star_array.cpp | 5 +++++ engines/titanic/star_control/star_array.h | 8 +++++++ engines/titanic/star_control/star_control_sub1.cpp | 1 + engines/titanic/star_control/star_control_sub9.cpp | 25 ++++++++++++++++++++++ engines/titanic/star_control/star_control_sub9.h | 22 ++++++++++++++----- 5 files changed, 56 insertions(+), 5 deletions(-) diff --git a/engines/titanic/star_control/star_array.cpp b/engines/titanic/star_control/star_array.cpp index 1af608db51..f25d8376e7 100644 --- a/engines/titanic/star_control/star_array.cpp +++ b/engines/titanic/star_control/star_array.cpp @@ -21,6 +21,7 @@ */ #include "titanic/star_control/star_array.h" +#include "titanic/star_control/star_control_sub12.h" #include "titanic/titanic.h" namespace Titanic { @@ -47,4 +48,8 @@ void CStarArray::initialize() { } } +void CStarArray::draw(CSurfaceArea *surface, CStarControlSub12 *img) { + // TODO +} + } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_array.h b/engines/titanic/star_control/star_array.h index 859db60ed1..827af01739 100644 --- a/engines/titanic/star_control/star_array.h +++ b/engines/titanic/star_control/star_array.h @@ -24,9 +24,12 @@ #define TITANIC_STAR_ARRAY_H #include "common/array.h" +#include "titanic/star_control/surface_area.h" namespace Titanic { +class CStarControlSub12; + class CStarArray { struct CStarArrayEntry { double _v1; @@ -42,6 +45,11 @@ public: * Initialize the array */ void initialize(); + + /** + * Draw the starfield points + */ + void draw(CSurfaceArea *surface, CStarControlSub12 *img); }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub1.cpp b/engines/titanic/star_control/star_control_sub1.cpp index 5edbab1e86..75dc2303f1 100644 --- a/engines/titanic/star_control/star_control_sub1.cpp +++ b/engines/titanic/star_control/star_control_sub1.cpp @@ -44,6 +44,7 @@ void CStarControlSub1::load(SimpleFile *file, int param) { bool CStarControlSub1::initDocument() { warning("CStarControlSub1::initDocument"); _starArray.initialize(); + _sub9.initialize(); return true; } diff --git a/engines/titanic/star_control/star_control_sub9.cpp b/engines/titanic/star_control/star_control_sub9.cpp index 92ce8f6a85..be06e46f45 100644 --- a/engines/titanic/star_control/star_control_sub9.cpp +++ b/engines/titanic/star_control/star_control_sub9.cpp @@ -21,8 +21,33 @@ */ #include "titanic/star_control/star_control_sub9.h" +#include "titanic/titanic.h" namespace Titanic { +#define ARRAY_COUNT 80 + +void CStarControlSub9::initialize() { + // Get a reference to the starfield points resource + Common::SeekableReadStream *stream = g_vm->_filesManager->getResource("STARFIELD/POINTS2"); + + _data.resize(ARRAY_COUNT); + for (int rootCtr = 0; rootCtr < ARRAY_COUNT; ++rootCtr) { + // Get the number of sub-entries for this entry + int count = stream->readUint32LE(); + + // Read in the sub-entries + RootEntry &rootEntry = _data[rootCtr]; + rootEntry.resize(count); + for (int idx = 0; idx < count; ++idx) { + int v1 = stream->readSint32LE(); + int v2 = stream->readSint32LE(); + int v3 = stream->readSint32LE(); + int v4 = stream->readSint32LE(); + + // TODO: Processing here + } + } +} } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub9.h b/engines/titanic/star_control/star_control_sub9.h index 67a14a5109..ad05a4a478 100644 --- a/engines/titanic/star_control/star_control_sub9.h +++ b/engines/titanic/star_control/star_control_sub9.h @@ -23,18 +23,30 @@ #ifndef TITANIC_STAR_CONTROL_SUB9_H #define TITANIC_STAR_CONTROL_SUB9_H +#include "common/array.h" + namespace Titanic { class CStarControlSub9 { - struct ArrayEntry { + struct DataEntry { + int _v1; + int _v2; + int _v3; + int _v4; + }; + + class RootEntry : public Common::Array { + public: int _field0; - int _field4; - int _field8; - ArrayEntry() : _field0(0), _field4(0), _field8(0) {} + RootEntry() : _field0(0) {} }; private: - ArrayEntry _array[80]; + Common::Array _data; public: + /** + * Initializes the data + */ + void initialize(); }; } // End of namespace Titanic -- cgit v1.2.3 From d9e05e215c1ba8ab93530e7263b527c03fcc61c8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 3 Jul 2016 12:48:05 -0400 Subject: TITANIC: Fleshing out screen manager --- engines/titanic/support/screen_manager.cpp | 35 +++++++---- engines/titanic/support/screen_manager.h | 95 +++++++++++++++++++++++++----- 2 files changed, 106 insertions(+), 24 deletions(-) diff --git a/engines/titanic/support/screen_manager.cpp b/engines/titanic/support/screen_manager.cpp index 27c0d9886e..d795f78764 100644 --- a/engines/titanic/support/screen_manager.cpp +++ b/engines/titanic/support/screen_manager.cpp @@ -130,8 +130,15 @@ DirectDrawSurface *OSScreenManager::getDDSurface(SurfaceNum surfaceNum) { return nullptr; } -void OSScreenManager::proc6() {} -void OSScreenManager::proc7() {} +CVideoSurface *OSScreenManager::lockSurface(SurfaceNum surfaceNum) { + CVideoSurface *surface = getSurface(surfaceNum); + surface->lock(); + return surface; +} + +void OSScreenManager::unlockSurface(CVideoSurface *surface) { + surface->unlock(); +} CVideoSurface *OSScreenManager::getSurface(SurfaceNum surfaceNum) const { if (surfaceNum == SURFACE_PRIMARY) @@ -233,7 +240,11 @@ int OSScreenManager::writeString(int surfaceNum, const Rect &destRect, yOffset, str, textCursor); } -void OSScreenManager::proc14() {} +int OSScreenManager::writeString(int surfaceNum, const Rect &srcRect, + const Rect &destRect, const CString &str, CTextCursor *textCursor) { + // TODO + return 0; +} void OSScreenManager::setFontColor(byte r, byte g, byte b) { _fonts[_fontNumber].setColor(r, g, b); @@ -251,7 +262,15 @@ int OSScreenManager::stringWidth(const CString &str) { return _fonts[_fontNumber].stringWidth(str); } -void OSScreenManager::proc19() {} +void OSScreenManager::frameRect(SurfaceNum surfaceNum, const Rect &rect, byte r, byte g, byte b) { + Rect top(rect.left, rect.top, rect.right, rect.top + 1); + fillRect(surfaceNum, &top, r, g, b); + Rect bottom(rect.left, rect.bottom - 1, rect.right, rect.bottom); + fillRect(surfaceNum, &bottom, r, g, b); + Rect left(rect.left, rect.top, rect.left + 1, rect.bottom); + fillRect(surfaceNum, &left, r, g, b); + Rect right(rect.right - 1, rect.top, rect.right, rect.bottom); +} void OSScreenManager::clearSurface(SurfaceNum surfaceNum, Rect *bounds) { if (surfaceNum == SURFACE_PRIMARY) @@ -274,16 +293,12 @@ CVideoSurface *OSScreenManager::createSurface(const CResourceKey &key) { return new OSVideoSurface(this, key); } -void OSScreenManager::proc23() {} -void OSScreenManager::proc24() {} -void OSScreenManager::proc25() {} - void OSScreenManager::showCursor() { - + CScreenManager::_screenManagerPtr->_mouseCursor->show(); } void OSScreenManager::hideCursor() { - + CScreenManager::_screenManagerPtr->_mouseCursor->hide(); } void OSScreenManager::destroyFrontAndBackBuffers() { diff --git a/engines/titanic/support/screen_manager.h b/engines/titanic/support/screen_manager.h index 21b40cad37..0736f1393c 100644 --- a/engines/titanic/support/screen_manager.h +++ b/engines/titanic/support/screen_manager.h @@ -89,8 +89,19 @@ public: */ virtual void drawCursors() = 0; - virtual void proc6() = 0; - virtual void proc7() = 0; + /** + * Locks a specified surface number for access and returns a pointer to it + */ + virtual CVideoSurface *lockSurface(SurfaceNum surfaceNum) = 0; + + /** + * Unlocks a previously locked surface + */ + virtual void unlockSurface(CVideoSurface *surface) = 0; + + /** + * Gets a specified surface number + */ virtual CVideoSurface *getSurface(SurfaceNum surfaceNum) const = 0; /** @@ -126,7 +137,16 @@ public: virtual int writeString(int surfaceNum, const Rect &destRect, int yOffset, const CString &str, CTextCursor *textCursor) = 0; - virtual void proc14() = 0; + /** + * Write a string + * @param surfaceNum Destination surface + * @param srcRect Drawing area + * @param destRect Bounds of dest surface + * @param str Line or lines to write + * @param textCursor Optional text cursor pointer + */ + virtual int writeString(int surfaceNum, const Rect &srcRect, + const Rect &destRect, const CString &str, CTextCursor *textCursor) = 0; /** * Set the font color @@ -152,7 +172,10 @@ public: */ virtual int stringWidth(const CString &str) = 0; - virtual void proc19() = 0; + /** + * Draws a frame enclosing the specified area + */ + virtual void frameRect(SurfaceNum surfaceNum, const Rect &rect, byte r, byte g, byte b) = 0; /** * Clear a portion of a specified surface @@ -173,10 +196,27 @@ public: * Creates a surface from a specified resource */ virtual CVideoSurface *createSurface(const CResourceKey &key) = 0; - - virtual void proc24() = 0; - virtual void proc25() = 0; + + /** + * Get the top-left corner of the screen in global screen co-ordinates + * For ScummVM, this is always (0, 0), even in Windowed mode + */ + virtual Point getScreenTopLeft() { return Point(0, 0); } + + /** + * Waits for a vertical screen sync + * For ScummVM, this can be safely ignored + */ + virtual void waitForVSync() {} + + /** + * Show the mouse cursor + */ virtual void showCursor() = 0; + + /** + * Hide the mouse cursor + */ virtual void hideCursor() = 0; /** @@ -228,8 +268,19 @@ public: */ virtual void drawCursors(); - virtual void proc6(); - virtual void proc7(); + /** + * Locks a specified surface number for access and returns a pointer to it + */ + virtual CVideoSurface *lockSurface(SurfaceNum surfaceNum); + + /** + * Unlocks a previously locked surface + */ + virtual void unlockSurface(CVideoSurface *surface); + + /** + * Gets a specified surface number + */ virtual CVideoSurface *getSurface(SurfaceNum surfaceNum) const; /** @@ -268,7 +319,16 @@ public: virtual int writeString(int surfaceNum, const Rect &destRect, int yOffset, const CString &str, CTextCursor *textCursor); - virtual void proc14(); + /** + * Write a string + * @param surfaceNum Destination surface + * @param srcRect Drawing area + * @param destRect Bounds of dest surface + * @param str Line or lines to write + * @param textCursor Optional text cursor pointer + */ + virtual int writeString(int surfaceNum, const Rect &srcRect, + const Rect &destRect, const CString &str, CTextCursor *textCursor); /** * Set the font color @@ -294,7 +354,10 @@ public: */ virtual int stringWidth(const CString &str); - virtual void proc19(); + /** + * Draws a frame enclosing the specified area + */ + virtual void frameRect(SurfaceNum surfaceNum, const Rect &rect, byte r, byte g, byte b); /** * Clear a portion of the screen surface @@ -316,10 +379,14 @@ public: */ virtual CVideoSurface *createSurface(const CResourceKey &key); - virtual void proc23(); - virtual void proc24(); - virtual void proc25(); + /** + * Show the mouse cursor + */ virtual void showCursor(); + + /** + * Hide the mouse cursor + */ virtual void hideCursor(); }; -- cgit v1.2.3 From 5ab33f117a0bc3451a1d30024208c45a2a548a4b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 3 Jul 2016 13:52:09 -0400 Subject: TITANIC: Adding more video surface methods --- engines/titanic/support/image_decoders.cpp | 4 +- engines/titanic/support/movie.cpp | 2 +- engines/titanic/support/video_surface.cpp | 36 +++++++++++++++++- engines/titanic/support/video_surface.h | 59 ++++++++++++++++++++++++++++-- 4 files changed, 92 insertions(+), 9 deletions(-) diff --git a/engines/titanic/support/image_decoders.cpp b/engines/titanic/support/image_decoders.cpp index 9fe55eb02b..4203dad97c 100644 --- a/engines/titanic/support/image_decoders.cpp +++ b/engines/titanic/support/image_decoders.cpp @@ -36,7 +36,7 @@ void CJPEGDecode::decode(OSVideoSurface &surface, const CString &name) { // Resize the surface if necessary if (!surface.hasSurface() || surface.getWidth() != srcSurf->w || surface.getHeight() != srcSurf->h) - surface.resize(srcSurf->w, srcSurf->h); + surface.recreate(srcSurf->w, srcSurf->h); // Convert the decoded surface to the correct pixel format, and then copy it over surface.lock(); @@ -63,7 +63,7 @@ void CTargaDecode::decode(OSVideoSurface &surface, const CString &name) { // Resize the surface if necessary if (!surface.hasSurface() || surface.getWidth() != srcSurf->w || surface.getHeight() != srcSurf->h) - surface.resize(srcSurf->w, srcSurf->h); + surface.recreate(srcSurf->w, srcSurf->h); // Convert the decoded surface to the correct pixel format, and then copy it over surface.lock(); diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index 361bf6e1fa..9b6fd01710 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -175,7 +175,7 @@ void OSMovie::decodeFrame() { // If the video surface doesn't yet have an underlying surface, create it if (!videoSurface->hasSurface()) - videoSurface->resize(frame->w, frame->h); + videoSurface->recreate(frame->w, frame->h); // Lock access to the surface videoSurface->lock(); diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index 9293b03f02..e71b25184b 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -296,7 +296,14 @@ int OSVideoSurface::getPitch() { return _ddSurface->getPitch(); } -void OSVideoSurface::resize(int width, int height) { +int OSVideoSurface::getBpp() { + if (!loadIfReady()) + error("Could not load resource"); + + return getPixelDepth(); +} + +void OSVideoSurface::recreate(int width, int height) { freeSurface(); _screenManager->resizeSurface(this, width, height); @@ -304,9 +311,19 @@ void OSVideoSurface::resize(int width, int height) { _videoSurfaceCounter += _ddSurface->getSize(); } +void OSVideoSurface::resize(int width, int height) { + if (!_ddSurface || _ddSurface->getWidth() != width || + _ddSurface->getHeight() != height) + recreate(width, height); +} + +void OSVideoSurface::detachSurface() { + _ddSurface = nullptr; +} + int OSVideoSurface::getPixelDepth() { if (!loadIfReady()) - assert(0); + error("Could not load resource"); lock(); @@ -360,6 +377,13 @@ uint16 OSVideoSurface::getPixel(const Common::Point &pt) { } } +void OSVideoSurface::setPixel(const Point &pt, uint pixel) { + assert(getPixelDepth() == 2); + + uint16 *pixelP = (uint16 *)_rawSurface->getBasePtr(pt.x, pt.y); + *pixelP = pixel; +} + void OSVideoSurface::changePixel(uint16 *pixelP, uint16 *color, byte srcVal, bool remapFlag) { assert(getPixelDepth() == 2); const Graphics::PixelFormat &destFormat = _ddSurface->getFormat(); @@ -391,9 +415,17 @@ void OSVideoSurface::shiftColors() { // we already convert 16-bit surfaces as soon as they're loaded } +void OSVideoSurface::clear() { + if (!loadIfReady()) + error("Could not load resource"); + +} + void OSVideoSurface::playMovie(uint flags, CVideoSurface *surface) { if (loadIfReady() && _movie) _movie->play(flags, surface); + + _ddSurface->fill(nullptr, 0); } void OSVideoSurface::playMovie(uint startFrame, uint endFrame, int v3, bool v4) { diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index e5d904f6d6..9b7e0fbaec 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -129,12 +129,27 @@ public: * Returns the pitch of the surface in bytes */ virtual int getPitch() = 0; - + + /** + * Returns the bytes per pixel of the surface + */ + virtual int getBpp() = 0; + /** - * Reiszes the surface + * Recreates the surface + */ + virtual void recreate(int width, int height) = 0; + + /** + * Resizes the surface */ virtual void resize(int width, int height) = 0; + /** + * Detachs the underlying raw surface + */ + virtual void detachSurface() = 0; + /** * Returns the number of bytes per pixel in the surface */ @@ -145,6 +160,12 @@ public: */ virtual uint16 getPixel(const Common::Point &pt) = 0; + + /** + * Sets a pixel at a specified position within the surface + */ + virtual void setPixel(const Point &pt, uint pixel) = 0; + /** * Change a pixel */ @@ -155,6 +176,11 @@ public: */ virtual void shiftColors() = 0; + /** + * Clears the entire surface to black + */ + virtual void clear() = 0; + /** * Plays a movie, loading it from the specified _resource * if not already loaded @@ -305,10 +331,25 @@ public: virtual int getPitch(); /** - * Reiszes the surface + * Returns the bytes per pixel of the surface + */ + virtual int getBpp(); + + /** + * Recreates the surface with the designated size + */ + virtual void recreate(int width, int height); + + /** + * Resizes the surface */ virtual void resize(int width, int height); + /** + * Detachs the underlying raw surface + */ + virtual void detachSurface(); + /** * Returns the number of bytes per pixel in the surface */ @@ -317,7 +358,12 @@ public: /** * Gets the pixel at the specified position within the surface */ - virtual uint16 getPixel(const Common::Point &pt); + virtual uint16 getPixel(const Point &pt); + + /** + * Sets a pixel at a specified position within the surface + */ + virtual void setPixel(const Point &pt, uint pixel); /** * Change a pixel @@ -329,6 +375,11 @@ public: */ virtual void shiftColors(); + /** + * Clears the entire surface to black + */ + virtual void clear(); + /** * Plays a movie, loading it from the specified _resource * if not already loaded -- cgit v1.2.3 From 3f12927b77735c17eedfbe14f36607ddc6580c83 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 3 Jul 2016 14:22:33 -0400 Subject: TITANIC: Added CVideoSurface transPixelate --- engines/titanic/support/video_surface.cpp | 28 ++++++++++++++++++++++++++++ engines/titanic/support/video_surface.h | 12 ++++++++++++ 2 files changed, 40 insertions(+) diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index e71b25184b..85a1aa1c58 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -476,6 +476,34 @@ bool OSVideoSurface::loadIfReady() { } } +void OSVideoSurface::transPixelate() { + if (!loadIfReady()) + return; + + lock(); + Graphics::ManagedSurface *surface = _rawSurface; + uint transColor = getTransparencyColor(); + // TODO: Check whether color is correct + uint pixelColor = surface->format.RGBToColor(0x50, 0, 0); + + for (int yp = 0; yp < surface->h; ++yp) { + uint16 *pixelsP = (uint16 *)surface->getBasePtr(0, yp); + bool bitFlag = (yp % 2) == 0; + int replaceCtr = yp & 3; + + for (int xp = 0; xp < surface->w; ++xp, ++pixelsP) { + if (bitFlag && *pixelsP == transColor && replaceCtr == 0) + *pixelsP = pixelColor; + + bitFlag = !bitFlag; + replaceCtr = (replaceCtr + 1) & 3; + } + } + + surface->markAllDirty(); + unlock(); +} + int OSVideoSurface::freeSurface() { if (!_ddSurface) return 0; diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index 9b7e0fbaec..45c6182fe6 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -224,6 +224,12 @@ public: */ virtual bool load() = 0; + /** + * Does a replacement of transparent pixels on certain lines at regular + * intervals. This is totally weird + */ + virtual void transPixelate() = 0; + virtual bool proc45(); /** @@ -423,6 +429,12 @@ public: */ virtual bool load(); + /** + * Does a replacement of transparent pixels on certain lines at regular + * intervals. This is totally weird + */ + virtual void transPixelate(); + /** * Frees the underlying surface */ -- cgit v1.2.3 From fb06cb4dde4d612289ea1b5830f8cd1c9e1bedfc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 3 Jul 2016 17:43:37 -0400 Subject: TITANIC: Added CMovieManager class --- engines/titanic/game_manager.cpp | 9 +++--- engines/titanic/game_state.cpp | 13 ++------ engines/titanic/module.mk | 1 + engines/titanic/support/movie.cpp | 31 +++++++++++++++--- engines/titanic/support/movie.h | 26 +++++++++++++-- engines/titanic/support/movie_manager.cpp | 35 ++++++++++++++++++++ engines/titanic/support/movie_manager.h | 53 +++++++++++++++++++++++++++++++ engines/titanic/support/video_surface.cpp | 8 ++++- engines/titanic/support/video_surface.h | 10 ++++++ engines/titanic/titanic.cpp | 3 +- engines/titanic/titanic.h | 4 +-- 11 files changed, 167 insertions(+), 26 deletions(-) create mode 100644 engines/titanic/support/movie_manager.cpp create mode 100644 engines/titanic/support/movie_manager.h diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index c5f0f111f9..7e8531fe68 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -128,7 +128,7 @@ void CGameManager::roomTransition(CRoomItem *oldRoom, CRoomItem *newRoom) { CString filename = movieKey.exists(); if (g_vm->_filesManager->fileExists(filename)) { _movieSurface->freeSurface(); - _movie = new OSMovie(filename, _movieSurface); + _movie = g_vm->_movieManager.createMovie(filename, _movieSurface); } } @@ -194,8 +194,8 @@ void CGameManager::update() { void CGameManager::updateMovies() { // TODO: Make this more like the original, if I can figuring out // what's it doing with temporary lists and the OSMovie methods - for (CMovieList::iterator i = g_vm->_activeMovies.begin(); - i != g_vm->_activeMovies.end(); ) { + for (CMovieList::iterator i = CMovie::_activeMovies->begin(); + i != CMovie::_activeMovies->end(); ) { OSMovie *movie = static_cast(*i); assert(movie && movie->_gameObject); @@ -205,7 +205,8 @@ void CGameManager::updateMovies() { CMovieEndMsg endMsg; endMsg.execute(movie->_gameObject); - i = g_vm->_activeMovies.erase(i); + i = CMovie::_activeMovies->erase(i); + delete movie; continue; } diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index d129767e10..6c81bc8699 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -28,17 +28,8 @@ namespace Titanic { bool CGameStateMovieList::clear() { - for (iterator i = begin(); i != end(); ) { - CMovieListItem *listItem = *i; - ++i; - - if (!g_vm->_activeMovies.contains(listItem->_item)) { - remove(listItem); - delete listItem; - } - } - - return size() > 0; + // TODO + return false; } /*------------------------------------------------------------------------*/ diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index f1392f165b..71db594f5e 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -448,6 +448,7 @@ MODULE_OBJS := \ support/movie_clip.o \ support/movie_event.o \ support/movie_range_info.o \ + support/movie_manager.o \ support/credit_text.o \ support/proximity.o \ support/rect.o \ diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index 9b6fd01710..869a3518f8 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -26,16 +26,35 @@ namespace Titanic { +CMovieList *CMovie::_activeMovies; + CMovie::CMovie() : ListItem(), _state(MOVIE_STOPPED), _field10(0), _field14(0) { } CMovie::~CMovie() { - g_vm->_activeMovies.remove(this); + removeFromActiveMovies(); +} + +void CMovie::init() { + _activeMovies = new CMovieList(); +} + +void CMovie::deinit() { + delete _activeMovies; +} + +void CMovie::addToActiveMovies() { + if (!isActive()) + _activeMovies->push_back(this); +} + +void CMovie::removeFromActiveMovies() { + _activeMovies->remove(this); } bool CMovie::isActive() const { - return g_vm->_activeMovies.contains(this); + return _activeMovies->contains(this); } bool CMovie::get10() { @@ -67,7 +86,6 @@ OSMovie::OSMovie(Common::SeekableReadStream *stream, CVideoSurface *surface) : } OSMovie::~OSMovie() { - g_vm->_activeMovies.remove(this); delete _video; } @@ -83,7 +101,7 @@ void OSMovie::play(uint startFrame, uint endFrame, int v3, bool v4) { _video->seekToFrame(startFrame); _endFrame = endFrame; - g_vm->_activeMovies.push_back(this); + addToActiveMovies(); _state = MOVIE_NONE; } @@ -126,7 +144,10 @@ const Common::List OSMovie::getMovieRangeInfo() const { return Common::List(); } -void OSMovie::proc18() { +void OSMovie::proc18(int v) { +// if (_aviSurface) +// _aviSurface->_field3C = 0; + warning("TODO: OSMovie::proc18"); } diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index 2d7bdc9c6d..fbbfebc845 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -47,8 +47,30 @@ class CMovie : public ListItem { protected: MovieState _state; int _field10; +protected: + /** + * Adds the movie to the active movies list + */ + void addToActiveMovies(); + + /** + * Removes the movie from the active movies list + */ + void removeFromActiveMovies(); public: int _field14; +public: + static CMovieList *_activeMovies; + + /** + * Initializes statics + */ + static void init(); + + /** + * Deinitializes statics + */ + static void deinit(); public: CMovie(); virtual ~CMovie(); @@ -90,7 +112,7 @@ public: */ virtual const Common::List getMovieRangeInfo() const = 0; - virtual void proc18() = 0; + virtual void proc18(int v) = 0; /** * Get the current movie frame @@ -167,7 +189,7 @@ public: */ virtual const Common::List getMovieRangeInfo() const; - virtual void proc18(); + virtual void proc18(int v); /** * Get the current movie frame diff --git a/engines/titanic/support/movie_manager.cpp b/engines/titanic/support/movie_manager.cpp new file mode 100644 index 0000000000..e3330f0080 --- /dev/null +++ b/engines/titanic/support/movie_manager.cpp @@ -0,0 +1,35 @@ +/* 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 "titanic/support/movie_manager.h" +#include "titanic/support/movie.h" +#include "titanic/support/video_surface.h" + +namespace Titanic { + +CMovie *CMovieManager::createMovie(const CResourceKey &key, CVideoSurface *surface) { + CMovie *movie = new OSMovie(key, surface); + movie->proc18(_field4); + return movie; +} + +} // End of namespace Titanic diff --git a/engines/titanic/support/movie_manager.h b/engines/titanic/support/movie_manager.h new file mode 100644 index 0000000000..91ea75e49b --- /dev/null +++ b/engines/titanic/support/movie_manager.h @@ -0,0 +1,53 @@ +/* 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. + * + */ + +#ifndef TITANIC_MOVIE_MANAGER_H +#define TITANIC_MOVIE_MANAGER_H + +#include "titanic/core/list.h" +#include "titanic/core/resource_key.h" + +namespace Titanic { + +class CMovie; +class CVideoSurface; + +class CMovieManagerBase { +public: + virtual ~CMovieManagerBase() {} + + virtual CMovie *createMovie(const CResourceKey &key, CVideoSurface *surface) = 0; +}; + +class CMovieManager : public CMovieManagerBase { +private: + int _field4; +public: + CMovieManager() : CMovieManagerBase(), _field4(0) {} + virtual ~CMovieManager() {} + + virtual CMovie *createMovie(const CResourceKey &key, CVideoSurface *surface); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MOVIE_MANAGER_H */ diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index 85a1aa1c58..0335e7d9b1 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -23,6 +23,7 @@ #include "titanic/support/video_surface.h" #include "titanic/support/image_decoders.h" #include "titanic/support/screen_manager.h" +#include "titanic/titanic.h" namespace Titanic { @@ -234,6 +235,11 @@ void OSVideoSurface::loadJPEG(const CResourceKey &key) { _resourceKey = key; } +void OSVideoSurface::loadTarga(const CString &name) { + CResourceKey key(name); + loadTarga(key); +} + void OSVideoSurface::loadMovie(const CResourceKey &key, bool destroyFlag) { // Delete any prior movie if (_movie) { @@ -242,7 +248,7 @@ void OSVideoSurface::loadMovie(const CResourceKey &key, bool destroyFlag) { } // Create the new movie and load the first frame to the video surface - _movie = new OSMovie(key, this); + _movie = g_vm->_movieManager.createMovie(key, this); _movie->setFrame(0); // If flagged to destroy, then immediately destroy movie instance diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index 45c6182fe6..37afccf9e1 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -93,6 +93,11 @@ public: */ virtual void loadJPEG(const CResourceKey &key) = 0; + /** + * Loads a Targa image file specified by the given name + */ + virtual void loadTarga(const CString &name) = 0; + /** * Loads a movie file specified by the resource key. * @param key Resource key for movie to load @@ -299,6 +304,11 @@ public: */ virtual void loadJPEG(const CResourceKey &key); + /** + * Loads a Targa image file specified by the given name + */ + virtual void loadTarga(const CString &name); + /** * Loads a movie file specified by the resource key. * @param key Resource key for movie to load diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index ab734d9eeb..7b91a1a630 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -67,7 +67,6 @@ TitanicEngine::~TitanicEngine() { delete _screenManager; delete _filesManager; CSaveableObject::freeClassList(); - _activeMovies.clear(); } void TitanicEngine::initializePath(const Common::FSNode &gamePath) { @@ -87,6 +86,7 @@ void TitanicEngine::initialize() { CGameObject::init(); CGetLiftEye2::init(); CHose::init(); + CMovie::init(); CParrotLobbyObject::init(); CSGTNavigation::init(); CSGTStateRoom::init(); @@ -112,6 +112,7 @@ void TitanicEngine::deinitialize() { CEnterExitFirstClassState::deinit(); CGetLiftEye2::deinit(); CHose::deinit(); + CMovie::deinit(); CSGTNavigation::deinit(); CSGTStateRoom::deinit(); CExitPellerator::deinit(); diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index 9acf78cbf2..dd289714c9 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -36,7 +36,7 @@ #include "titanic/support/files_manager.h" #include "titanic/main_game_window.h" #include "titanic/support/exe_resources.h" -#include "titanic/support/movie.h" +#include "titanic/support/movie_manager.h" #include "titanic/support/screen_manager.h" #include "titanic/support/string.h" #include "titanic/true_talk/tt_script_base.h" @@ -106,6 +106,7 @@ public: Debugger *_debugger; Events *_events; CFilesManager *_filesManager; + CMovieManager _movieManager; Graphics::Screen *_screen; OSScreenManager *_screenManager; CMainGameWindow *_window; @@ -114,7 +115,6 @@ public: TTscriptBase *_script; CTrueTalkManager *_trueTalkManager; CExeResources _exeResources; - CMovieList _activeMovies; StringArray _itemNames; StringArray _itemDescriptions; CString _itemObjects[TOTAL_ITEMS]; -- cgit v1.2.3 From 8b2d85f8e5b30aeb73817894974a4db53588565b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 3 Jul 2016 19:07:38 -0400 Subject: TITANIC: Figured out remainder of CMovieManager --- engines/titanic/sound/sound.cpp | 2 ++ engines/titanic/sound/sound_manager.cpp | 2 +- engines/titanic/sound/sound_manager.h | 8 ++++---- engines/titanic/support/movie.cpp | 5 +++-- engines/titanic/support/movie.h | 15 +++++++++++---- engines/titanic/support/movie_manager.cpp | 2 +- engines/titanic/support/movie_manager.h | 16 ++++++++++++++-- 7 files changed, 36 insertions(+), 14 deletions(-) diff --git a/engines/titanic/sound/sound.cpp b/engines/titanic/sound/sound.cpp index dc8d0eeb21..7968a088da 100644 --- a/engines/titanic/sound/sound.cpp +++ b/engines/titanic/sound/sound.cpp @@ -22,6 +22,7 @@ #include "titanic/sound/sound.h" #include "titanic/game_manager.h" +#include "titanic/titanic.h" namespace Titanic { @@ -31,6 +32,7 @@ int CSoundItem::fn1() { } CSound::CSound(CGameManager *owner) : _gameManager(owner) { + g_vm->_movieManager.setSoundManager(&_soundManager); } void CSound::save(SimpleFile *file) const { diff --git a/engines/titanic/sound/sound_manager.cpp b/engines/titanic/sound/sound_manager.cpp index fa1e5fb166..05a924f352 100644 --- a/engines/titanic/sound/sound_manager.cpp +++ b/engines/titanic/sound/sound_manager.cpp @@ -24,7 +24,7 @@ namespace Titanic { -SoundManager::SoundManager() : _musicPercent(75.0), _speechPercent(75.0), +CSoundManager::CSoundManager() : _musicPercent(75.0), _speechPercent(75.0), _masterPercent(75.0), _parrotPercent(75.0), _field14(1) { } diff --git a/engines/titanic/sound/sound_manager.h b/engines/titanic/sound/sound_manager.h index 75cf06e931..ac4ac1ef9f 100644 --- a/engines/titanic/sound/sound_manager.h +++ b/engines/titanic/sound/sound_manager.h @@ -27,7 +27,7 @@ namespace Titanic { -class SoundManager { +class CSoundManager { protected: double _musicPercent; double _speechPercent; @@ -35,8 +35,8 @@ protected: double _parrotPercent; int _field14; public: - SoundManager(); - virtual ~SoundManager() {} + CSoundManager(); + virtual ~CSoundManager() {} /** * Loads a sound @@ -98,7 +98,7 @@ public: virtual void proc29() {} }; -class QSoundManager : public SoundManager { +class QSoundManager : public CSoundManager { public: int _field18; int _field1C; diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index 869a3518f8..6a79c02a3e 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -21,6 +21,7 @@ */ #include "video/avi_decoder.h" +#include "titanic/sound/sound_manager.h" #include "titanic/support/movie.h" #include "titanic/titanic.h" @@ -144,9 +145,9 @@ const Common::List OSMovie::getMovieRangeInfo() const { return Common::List(); } -void OSMovie::proc18(int v) { +void OSMovie::setSoundManager(CSoundManager *soundManager) { // if (_aviSurface) -// _aviSurface->_field3C = 0; +// _aviSurface->_field3C = soundManager; warning("TODO: OSMovie::proc18"); } diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index fbbfebc845..7abca6bbc0 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -35,9 +35,10 @@ enum MovieState { MOVIE_STOPPED = -1, MOVIE_NONE = 0, MOVIE_FINISHED = 1, MOVIE_FRAME = 2 }; -class CVideoSurface; -class CMovie; class CGameObject; +class CMovie; +class CSoundManager; +class CVideoSurface; class CMovieList : public List { public: @@ -112,7 +113,10 @@ public: */ virtual const Common::List getMovieRangeInfo() const = 0; - virtual void proc18(int v) = 0; + /** + * Set the sound manager reference + */ + virtual void setSoundManager(CSoundManager *soundManager) = 0; /** * Get the current movie frame @@ -189,7 +193,10 @@ public: */ virtual const Common::List getMovieRangeInfo() const; - virtual void proc18(int v); + /** + * Set the sound manager reference + */ + virtual void setSoundManager(CSoundManager *soundManager); /** * Get the current movie frame diff --git a/engines/titanic/support/movie_manager.cpp b/engines/titanic/support/movie_manager.cpp index e3330f0080..bfeb081b5c 100644 --- a/engines/titanic/support/movie_manager.cpp +++ b/engines/titanic/support/movie_manager.cpp @@ -28,7 +28,7 @@ namespace Titanic { CMovie *CMovieManager::createMovie(const CResourceKey &key, CVideoSurface *surface) { CMovie *movie = new OSMovie(key, surface); - movie->proc18(_field4); + movie->setSoundManager(_soundManager); return movie; } diff --git a/engines/titanic/support/movie_manager.h b/engines/titanic/support/movie_manager.h index 91ea75e49b..2920d909b7 100644 --- a/engines/titanic/support/movie_manager.h +++ b/engines/titanic/support/movie_manager.h @@ -25,6 +25,7 @@ #include "titanic/core/list.h" #include "titanic/core/resource_key.h" +#include "titanic/sound/sound_manager.h" namespace Titanic { @@ -35,17 +36,28 @@ class CMovieManagerBase { public: virtual ~CMovieManagerBase() {} + /** + * Create a new movie and return it + */ virtual CMovie *createMovie(const CResourceKey &key, CVideoSurface *surface) = 0; }; class CMovieManager : public CMovieManagerBase { private: - int _field4; + CSoundManager *_soundManager; public: - CMovieManager() : CMovieManagerBase(), _field4(0) {} + CMovieManager() : CMovieManagerBase(), _soundManager(nullptr) {} virtual ~CMovieManager() {} + /** + * Create a new movie and return it + */ virtual CMovie *createMovie(const CResourceKey &key, CVideoSurface *surface); + + /** + * Sets the sound manager that will be attached to all created movies + */ + void setSoundManager(CSoundManager *soundManager) { _soundManager = soundManager; } }; } // End of namespace Titanic -- cgit v1.2.3 From f99b16f564315be5863de57bd03bb8354673f0c5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 3 Jul 2016 19:13:32 -0400 Subject: TITANIC: Suppress some warnings in unimplemented code --- engines/titanic/star_control/base_star.cpp | 4 ++-- engines/titanic/star_control/star_array.cpp | 1 + engines/titanic/star_control/star_control_sub9.cpp | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/engines/titanic/star_control/base_star.cpp b/engines/titanic/star_control/base_star.cpp index 7b57b88f6b..4f4f838c12 100644 --- a/engines/titanic/star_control/base_star.cpp +++ b/engines/titanic/star_control/base_star.cpp @@ -81,8 +81,8 @@ CBaseStarEntry *CBaseStar::getDataPtr(int index) { void CBaseStar::loadData(Common::SeekableReadStream &s) { uint headerId = s.readUint32LE(); uint count = s.readUint32LE(); - if (headerId != 100 || count == 0); - error("Invalid star data"); + if (headerId != 100 || count == 0) + error("Invalid star data"); // Initialize the data array clear(); diff --git a/engines/titanic/star_control/star_array.cpp b/engines/titanic/star_control/star_array.cpp index f25d8376e7..8049cb567f 100644 --- a/engines/titanic/star_control/star_array.cpp +++ b/engines/titanic/star_control/star_array.cpp @@ -43,6 +43,7 @@ void CStarArray::initialize() { int v2 = stream->readUint32LE(); stream->readUint32LE(); + warning("TODO: %d %d", v1, v2); // Pre-process them // TODO } diff --git a/engines/titanic/star_control/star_control_sub9.cpp b/engines/titanic/star_control/star_control_sub9.cpp index be06e46f45..fda2f5b5bf 100644 --- a/engines/titanic/star_control/star_control_sub9.cpp +++ b/engines/titanic/star_control/star_control_sub9.cpp @@ -40,11 +40,14 @@ void CStarControlSub9::initialize() { RootEntry &rootEntry = _data[rootCtr]; rootEntry.resize(count); for (int idx = 0; idx < count; ++idx) { + DataEntry &entry = rootEntry[idx]; int v1 = stream->readSint32LE(); int v2 = stream->readSint32LE(); int v3 = stream->readSint32LE(); int v4 = stream->readSint32LE(); + warning("TODO: %d %d %d %d", v1, v2, v3, v4); + entry._v1 = 0; // TODO: Processing here } } -- cgit v1.2.3 From 0b860220fc25d6ba78c7a403913d07561f492a6a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 4 Jul 2016 21:18:04 -0400 Subject: TITANIC: Beginnings of AVISurface class --- engines/titanic/module.mk | 1 + engines/titanic/support/avi_surface.cpp | 32 ++++++++++++++++++ engines/titanic/support/avi_surface.h | 57 +++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 engines/titanic/support/avi_surface.cpp create mode 100644 engines/titanic/support/avi_surface.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 71db594f5e..8d25bc3e29 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -436,6 +436,7 @@ MODULE_OBJS := \ star_control/surface_area.o \ star_control/surface_fader_base.o \ star_control/surface_fader.o \ + support/avi_surface.o \ support/direct_draw.o \ support/direct_draw_surface.o \ support/exe_resources.o \ diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp new file mode 100644 index 0000000000..f6f63a7f1d --- /dev/null +++ b/engines/titanic/support/avi_surface.cpp @@ -0,0 +1,32 @@ +/* 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 "titanic/support/avi_surface.h" +#include "video/avi_decoder.h" + +namespace Titanic { + +AVISurface::AVISurface(const CResourceKey &key) { + // TODO +} + +} // End of namespace Titanic diff --git a/engines/titanic/support/avi_surface.h b/engines/titanic/support/avi_surface.h new file mode 100644 index 0000000000..248f2c5ab3 --- /dev/null +++ b/engines/titanic/support/avi_surface.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_AVI_SURFACE_H +#define TITANIC_AVI_SURFACE_H + +#include "video/video_decoder.h" +#include "titanic/core/resource_key.h" +#include "titanic/support/movie_range_info.h" + +namespace Titanic { + +class CSoundManager; + +class AVISurface { +private: + int _field4; + int _field8; + int _fieldC; + int _field10; + int _frame; + CMovieRangeInfoList _movieRangeInfo; + int _field28; + int _field2C; + int _field30; + int _field34; + int _field38; + CSoundManager *_soundManager; + // TODO: Lots more fields +public: + AVISurface(const CResourceKey &key); + + +}; + +} // End of namespace Titanic + +#endif /* TITANIC_AVI_SURFACE_H */ -- cgit v1.2.3 From b725c9add76b793fa1bdb2ecd00195d20dfa0567 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 5 Jul 2016 22:33:21 -0400 Subject: TITANIC: Added CStarArray initialization --- engines/titanic/star_control/star_array.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/engines/titanic/star_control/star_array.cpp b/engines/titanic/star_control/star_array.cpp index 8049cb567f..d2a5fe1a84 100644 --- a/engines/titanic/star_control/star_array.cpp +++ b/engines/titanic/star_control/star_array.cpp @@ -36,16 +36,23 @@ void CStarArray::initialize() { Common::SeekableReadStream *stream = g_vm->_filesManager->getResource("STARFIELD/POINTS"); assert(stream && stream->size() == (12 * ARRAY_COUNT)); + double factor = 3.1415927 * 0.0055555557; + _data.resize(ARRAY_COUNT); for (int idx = 0; idx < ARRAY_COUNT; ++idx) { + CStarArrayEntry &entry = _data[idx]; + // Get the next set of values - int v1 = stream->readUint32LE(); - int v2 = stream->readUint32LE(); + double v1 = stream->readUint32LE(); + double v2 = stream->readUint32LE(); stream->readUint32LE(); - warning("TODO: %d %d", v1, v2); - // Pre-process them - // TODO + v1 *= 0.0099999998 * factor; + v2 *= 0.015 * factor; + + entry._v1 = cos(v2) * 3000000.0 * cos(v1); + entry._v2 = sin(v2) * 3000000.0 * cos(v1); + entry._v3 = sin(v1) * 3000000.0; } } -- cgit v1.2.3 From 341cf1866168a8e270ed08b38cd43aa83387ea5a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 6 Jul 2016 06:54:22 -0400 Subject: TITANIC: Added CStarControlSub9 loading --- engines/titanic/star_control/star_array.cpp | 7 +++---- engines/titanic/star_control/star_control_sub9.cpp | 23 +++++++++++----------- engines/titanic/star_control/star_control_sub9.h | 1 - 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/engines/titanic/star_control/star_array.cpp b/engines/titanic/star_control/star_array.cpp index d2a5fe1a84..2e4a928aa2 100644 --- a/engines/titanic/star_control/star_array.cpp +++ b/engines/titanic/star_control/star_array.cpp @@ -27,6 +27,7 @@ namespace Titanic { #define ARRAY_COUNT 876 +const double FACTOR = 3.1415927 * 0.0055555557; CStarArray::CStarArray() { } @@ -36,8 +37,6 @@ void CStarArray::initialize() { Common::SeekableReadStream *stream = g_vm->_filesManager->getResource("STARFIELD/POINTS"); assert(stream && stream->size() == (12 * ARRAY_COUNT)); - double factor = 3.1415927 * 0.0055555557; - _data.resize(ARRAY_COUNT); for (int idx = 0; idx < ARRAY_COUNT; ++idx) { CStarArrayEntry &entry = _data[idx]; @@ -47,8 +46,8 @@ void CStarArray::initialize() { double v2 = stream->readUint32LE(); stream->readUint32LE(); - v1 *= 0.0099999998 * factor; - v2 *= 0.015 * factor; + v1 *= 0.0099999998 * FACTOR; + v2 *= 0.015 * FACTOR; entry._v1 = cos(v2) * 3000000.0 * cos(v1); entry._v2 = sin(v2) * 3000000.0 * cos(v1); diff --git a/engines/titanic/star_control/star_control_sub9.cpp b/engines/titanic/star_control/star_control_sub9.cpp index fda2f5b5bf..e19977c4a4 100644 --- a/engines/titanic/star_control/star_control_sub9.cpp +++ b/engines/titanic/star_control/star_control_sub9.cpp @@ -26,6 +26,7 @@ namespace Titanic { #define ARRAY_COUNT 80 +const double FACTOR = 3.1415927 * 0.0055555557; void CStarControlSub9::initialize() { // Get a reference to the starfield points resource @@ -35,20 +36,20 @@ void CStarControlSub9::initialize() { for (int rootCtr = 0; rootCtr < ARRAY_COUNT; ++rootCtr) { // Get the number of sub-entries for this entry int count = stream->readUint32LE(); + double v1, v2; // Read in the sub-entries RootEntry &rootEntry = _data[rootCtr]; - rootEntry.resize(count); - for (int idx = 0; idx < count; ++idx) { - DataEntry &entry = rootEntry[idx]; - int v1 = stream->readSint32LE(); - int v2 = stream->readSint32LE(); - int v3 = stream->readSint32LE(); - int v4 = stream->readSint32LE(); - - warning("TODO: %d %d %d %d", v1, v2, v3, v4); - entry._v1 = 0; - // TODO: Processing here + rootEntry.resize(count * 2); + for (int idx = 0; idx < count * 2; ++idx) { + DataEntry &entry = rootEntry[idx * 2]; + v1 = stream->readSint32LE(); + v2 = stream->readSint32LE(); + v1 *= 0.015 * FACTOR; + v2 *= 0.0099999998 * FACTOR; + entry._v1 = cos(v1) * 3000000.0 * cos(v2); + entry._v2 = sin(v1) * 3000000.0 * cos(v2); + entry._v3 = sin(v2) * 3000000.0; } } } diff --git a/engines/titanic/star_control/star_control_sub9.h b/engines/titanic/star_control/star_control_sub9.h index ad05a4a478..5f334f48d1 100644 --- a/engines/titanic/star_control/star_control_sub9.h +++ b/engines/titanic/star_control/star_control_sub9.h @@ -32,7 +32,6 @@ class CStarControlSub9 { int _v1; int _v2; int _v3; - int _v4; }; class RootEntry : public Common::Array { -- cgit v1.2.3 From cc9bf88ed56a4c5fbb14c05d30395b1688f5ebe7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 9 Jul 2016 11:32:15 -0400 Subject: TITANIC: Major implementation of OSMovie and AVISurface classes --- engines/titanic/core/game_object.cpp | 112 ++++++------ engines/titanic/core/game_object.h | 30 ++-- engines/titanic/events.cpp | 23 +++ engines/titanic/events.h | 7 +- engines/titanic/game/computer.cpp | 2 +- engines/titanic/game_manager.cpp | 68 +++++--- engines/titanic/messages/messages.h | 4 +- engines/titanic/sound/sound_manager.cpp | 4 +- engines/titanic/sound/sound_manager.h | 15 +- engines/titanic/support/avi_surface.cpp | 185 ++++++++++++++++++++ engines/titanic/support/avi_surface.h | 110 ++++++++++-- engines/titanic/support/mouse_cursor.cpp | 12 +- engines/titanic/support/mouse_cursor.h | 2 +- engines/titanic/support/movie.cpp | 245 ++++++++++++++------------- engines/titanic/support/movie.h | 132 ++++++++------- engines/titanic/support/movie_event.cpp | 33 ++-- engines/titanic/support/movie_event.h | 18 +- engines/titanic/support/movie_range_info.cpp | 42 ++--- engines/titanic/support/movie_range_info.h | 20 ++- engines/titanic/support/video_surface.cpp | 23 +-- engines/titanic/support/video_surface.h | 58 +++++-- 21 files changed, 759 insertions(+), 386 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index dcc66f569d..78b91c3375 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -85,12 +85,14 @@ void CGameObject::save(SimpleFile *file, int indent) { _movieRangeInfoList.destroyContents(); if (_surface) { - Common::List rangeList = _surface->getMovieRangeInfo(); + const CMovieRangeInfoList *rangeList = _surface->getMovieRangeInfo(); - for (Common::List::const_iterator i = rangeList.begin(); - i != rangeList.end(); ++i) { - CMovieRangeInfo *rangeInfo = new CMovieRangeInfo(*i); - rangeInfo->_frameNumber = (i == rangeList.begin()) ? getMovieFrame() : -1; + if (rangeList) { + for (CMovieRangeInfoList::const_iterator i = rangeList->begin(); + i != rangeList->end(); ++i) { + CMovieRangeInfo *rangeInfo = new CMovieRangeInfo(*i); + rangeInfo->_initialFrame = (i == rangeList->begin()) ? getMovieFrame() : -1; + } } } @@ -403,21 +405,6 @@ void CGameObject::loadFrame(int frameNumber) { makeDirty(); } -void CGameObject::playMovie(int v1, int v2) { - if (_surface && !_resource.empty()) { - loadResource(_resource); - _resource.clear(); - } - - if (_surface && _surface->loadIfReady()) { - if (_surface->_movie) { - disableMouse(); - _surface->_movie->play(_bounds, v1, v2); - enableMouse(); - } - } -} - void CGameObject::processMoveRangeInfo() { for (CMovieRangeInfoList::iterator i = _movieRangeInfoList.begin(); i != _movieRangeInfoList.end(); ++i) (*i)->process(this); @@ -518,23 +505,53 @@ void CGameObject::petSetRemoteTarget() { pet->setRemoteTarget(this); } -void CGameObject::playMovie(uint startFrame, uint endFrame, uint flags) { +void CGameObject::playMovie(uint flags) { _frameNumber = -1; + + if (_surface && !_resource.empty()) { + loadResource(_resource); + _resource.clear(); + } + + CGameObject *obj = (flags & MOVIE_NO_OBJECT) ? nullptr : this; + if (_surface) { + _surface->playMovie(flags, obj); + if (flags & MOVIE_GAMESTATE) + getGameManager()->_gameState.addMovie(_surface->_movie); + } +} + +void CGameObject::playMovie(int startFrame, int endFrame, uint flags) { + _frameNumber = -1; + if (!_surface) { if (!_resource.empty()) loadResource(_resource); _resource.clear(); } + CGameObject *obj = (flags & MOVIE_NO_OBJECT) ? nullptr : this; if (_surface) { - // TODO: Figure out where to do this legitimately - OSMovie *movie = static_cast(_surface->_movie); - if (movie) - movie->_gameObject = this; + _surface->playMovie(startFrame, endFrame, flags, obj); + if (flags & MOVIE_GAMESTATE) + getGameManager()->_gameState.addMovie(_surface->_movie); + } +} + - _surface->playMovie(startFrame, endFrame, flags, flags != 0); +void CGameObject::playMovie(int startFrame, int endFrame, int initialFrame, uint flags) { + _frameNumber = -1; - if (flags & 0x10) + if (!_surface) { + if (!_resource.empty()) + loadResource(_resource); + _resource.clear(); + } + + CGameObject *obj = (flags & MOVIE_NO_OBJECT) ? nullptr : this; + if (_surface) { + _surface->playMovie(startFrame, endFrame, initialFrame, flags, obj); + if (flags & MOVIE_GAMESTATE) getGameManager()->_gameState.addMovie(_surface->_movie); } } @@ -565,28 +582,6 @@ void CGameObject::playRandomClip(const char **names, uint flags) { playClip(name, flags); } -void CGameObject::playMovie(uint flags) { - _frameNumber = -1; - if (!_surface && !_resource.empty()) { - loadResource(_resource); - _resource.clear(); - } - - CVideoSurface *surface = (flags & 4) ? _surface : nullptr; - if (_surface) { - _surface->playMovie(flags, surface); - - // TODO: Figure out where to do this legitimately - OSMovie *movie = static_cast(_surface->_movie); - if (movie) - movie->_gameObject = this; - - if (flags & 0x10) { - getGameManager()->_gameState.addMovie(_surface->_movie); - } - } -} - void CGameObject::savePosition() { _savedPos = _bounds; } @@ -1109,17 +1104,6 @@ bool CGameObject::clipExistsByEnd(const CString &name, int endFrame) const { return _movieClips.existsByEnd(name, endFrame); } -void CGameObject::checkPlayMovie(int fieldC, int field10, int frameNumber, int flags) { - if (!_surface && !_resource.empty()) - loadResource(_resource); - - if (_surface ) { - _surface->proc35(fieldC, field10, frameNumber, flags, (flags & CLIPFLAG_4) ? this : nullptr); - if (flags & CLIPFLAG_PLAY) - getGameManager()->_gameState.addMovie(_surface->_movie); - } -} - void CGameObject::petClear() const { CPetControl *petControl = getPetControl(); if (petControl) @@ -1235,14 +1219,14 @@ void CGameObject::setMovie14(int v) { _surface->_movie->_field14 = v; } -void CGameObject::surface38(int v1, int v2) { +void CGameObject::movieEvent(int frameNumber) { if (_surface) - _surface->proc38(v1, v2); + _surface->addMovieEvent(frameNumber, this); } -void CGameObject::surface38(int v1) { +void CGameObject::movieEvent() { if (_surface) - _surface->proc38(-1, v1); + _surface->addMovieEvent(-1, this); } int CGameObject::getClipDuration(const CString &name, int frameRate) const { diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 20059539d9..58ae4c6123 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -293,11 +293,6 @@ protected: */ Point getControid() const; - /** - * Plays a movie - */ - void playMovie(int v1, int v2); - /** * Play an arbitrary clip */ @@ -560,11 +555,6 @@ public: */ virtual bool isPet() const; - /** - * Play the movie specified in _resource - */ - void playMovie(uint startFrame, uint endFrame, uint flags); - /** * Checks the passed point is validly in the object, * with extra checking of object flags status @@ -582,9 +572,14 @@ public: void playMovie(uint flags); /** - * Checks and plays a pending clip + * Play the movie specified in _resource + */ + void playMovie(int startFrame, int endFrame, uint flags); + + /** + * Play the movie specified in _resource */ - void checkPlayMovie(int fieldC, int field10, int frameNumber, int flags); + void playMovie(int startFrame, int endFrame, int initialFrame, uint flags); /** * Returns true if the object has a currently active movie @@ -842,9 +837,16 @@ public: /*--- CVideoSurface Methods ---*/ - void surface38(int v1, int v2); + /** + * Signal a movie event for the given frame + */ + void movieEvent(int frameNumber); - void surface38(int v1); + /** + * Signal a movie event at the end of all currently + * playing ranges + */ + void movieEvent(); }; } // End of namespace Titanic diff --git a/engines/titanic/events.cpp b/engines/titanic/events.cpp index 590107336c..ff425abcde 100644 --- a/engines/titanic/events.cpp +++ b/engines/titanic/events.cpp @@ -235,4 +235,27 @@ void Events::sleep(uint time) { } } +bool Events::waitForPress(uint expiry) { + uint32 delayEnd = g_system->getMillis() + expiry; + + while (!_vm->shouldQuit() && g_system->getMillis() < delayEnd) { + g_system->delayMillis(10); + checkForNextFrameCounter(); + + Common::Event event; + if (g_system->getEventManager()->pollEvent(event)) { + switch (event.type) { + case Common::EVENT_LBUTTONDOWN: + case Common::EVENT_MBUTTONDOWN: + case Common::EVENT_KEYDOWN: + return true; + default: + break; + } + } + } + + return false; +} + } // End of namespace Titanic diff --git a/engines/titanic/events.h b/engines/titanic/events.h index 4638056e8c..ab3d755535 100644 --- a/engines/titanic/events.h +++ b/engines/titanic/events.h @@ -104,12 +104,17 @@ public: */ bool isSpecialPressed(SpecialButtons btn) const { return _specialButtons; } + uint getSpecialButtons() const { return _specialButtons; } + /** * Sleep for a specified period of time */ void sleep(uint time); - uint getSpecialButtons() const { return _specialButtons; } + /** + * Wait for a mouse or keypress + */ + bool waitForPress(uint expiry); }; } // End of namespace Titanic diff --git a/engines/titanic/game/computer.cpp b/engines/titanic/game/computer.cpp index e3f9430f3e..90574997b1 100644 --- a/engines/titanic/game/computer.cpp +++ b/engines/titanic/game/computer.cpp @@ -91,7 +91,7 @@ bool CComputer::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { } bool CComputer::MovieEndMsg(CMovieEndMsg *msg) { - if (msg->_value2 == 90) { + if (msg->_endFrame == 90) { playSound("a#32.wav", 100, 0, 0); playSound("a#33.wav", 100, 0, 0); playSound("a#31.wav", 100, 0, 0); diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index 7e8531fe68..84306b42e3 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -192,36 +192,48 @@ void CGameManager::update() { } void CGameManager::updateMovies() { - // TODO: Make this more like the original, if I can figuring out - // what's it doing with temporary lists and the OSMovie methods - for (CMovieList::iterator i = CMovie::_activeMovies->begin(); - i != CMovie::_activeMovies->end(); ) { - OSMovie *movie = static_cast(*i); - assert(movie && movie->_gameObject); - - movie->update(); - switch (movie->getState()) { - case MOVIE_FINISHED: { - CMovieEndMsg endMsg; - endMsg.execute(movie->_gameObject); - - i = CMovie::_activeMovies->erase(i); - delete movie; - continue; - } - - case MOVIE_FRAME: { - CMovieFrameMsg frameMsg; - frameMsg.execute(movie->_gameObject); + bool repeatFlag; + do { + repeatFlag = false; + + for (CMovieList::iterator i = CMovie::_playingMovies->begin(); + i != CMovie::_playingMovies->end(); ) { + CMovie *movie = *i; + if (movie->_state) + continue; + + CMovieEventList eventsList; + if (!movie->handleEvents(eventsList)) + movie->removeFromPlayingMovies(); + + while (!eventsList.empty()) { + CMovieEvent *movieEvent = eventsList.front(); + + switch (movieEvent->_type) { + case MET_MOVIE_END: { + CMovieEndMsg endMsg(movieEvent->_startFrame, movieEvent->_endFrame); + endMsg.execute(movieEvent->_gameObject); + break; + } + + case MET_FRAME: { + CMovieFrameMsg frameMsg(movieEvent->_initialFrame, 0); + frameMsg.execute(movieEvent->_gameObject); + break; + } + + default: + break; + } + + eventsList.remove(movieEvent); + } + + repeatFlag = true; + movie->_state = MSTATE_1; break; } - - default: - break; - } - - ++i; - } + } while (repeatFlag); } void CGameManager::updateDiskTicksCount() { diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 278fac1fbd..de5d0bdcc0 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -264,8 +264,8 @@ MESSAGE0(CMaitreDDefeatedMsg); MESSAGE0(CMaitreDHappyMsg); MESSAGE1(CMissiveOMatActionMsg, int, value, 0); MESSAGE0(CMoveToStartPosMsg); -MESSAGE2(CMovieEndMsg, int, value1, 0, int, value2, 0); -MESSAGE2(CMovieFrameMsg, int, value1, 0, int, value2, 0); +MESSAGE2(CMovieEndMsg, int, startFrame, 0, int, endFrame, 0); +MESSAGE2(CMovieFrameMsg, int, frameNumber, 0, int, value2, 0); MESSAGE0(CMusicHasStartedMsg); MESSAGE0(CMusicHasStoppedMsg); MESSAGE0(CMusicSettingChangedMsg); diff --git a/engines/titanic/sound/sound_manager.cpp b/engines/titanic/sound/sound_manager.cpp index 05a924f352..440d74ade5 100644 --- a/engines/titanic/sound/sound_manager.cpp +++ b/engines/titanic/sound/sound_manager.cpp @@ -100,8 +100,8 @@ void QSoundManager::WaveMixPump() { warning("TODO"); } -int QSoundManager::proc18() const { - warning("TODO"); +bool QSoundManager::movieStarted() const { + // TODO return 0; } diff --git a/engines/titanic/sound/sound_manager.h b/engines/titanic/sound/sound_manager.h index ac4ac1ef9f..942124e796 100644 --- a/engines/titanic/sound/sound_manager.h +++ b/engines/titanic/sound/sound_manager.h @@ -59,7 +59,12 @@ public: virtual bool isActive(int handle) const { return false; } virtual int proc16() const { return 0; } virtual void WaveMixPump() {} - virtual int proc18() const { return 0; } + + /** + * Called when a movie with audio is started + */ + virtual bool movieStarted() const { return false; } + virtual void setMusicPercent(double percent) { _musicPercent = percent; } virtual void setSpeechPercent(double percent) { _speechPercent = percent; } virtual void setMasterPercent(double percent) { _masterPercent = percent; } @@ -128,7 +133,13 @@ public: virtual bool isActive(int handle) const; virtual int proc16(); virtual void WaveMixPump(); - virtual int proc18() const; + + + /** + * Called when a movie with audio is started + */ + virtual bool movieStarted() const; + virtual void proc19(int v); virtual void proc20(int v); virtual void proc21(int v); diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp index f6f63a7f1d..47127fe83b 100644 --- a/engines/titanic/support/avi_surface.cpp +++ b/engines/titanic/support/avi_surface.cpp @@ -21,12 +21,197 @@ */ #include "titanic/support/avi_surface.h" +#include "titanic/support/video_surface.h" #include "video/avi_decoder.h" namespace Titanic { AVISurface::AVISurface(const CResourceKey &key) { + // TODO +/* +Video::AVIDecoder *decoder = new Video::AVIDecoder(); +decoder->ignoreSecondaryVideoTracks(); +_video = decoder; +_field14 = 1; + +if (!_video->loadFile(name.getString())) +error("Could not open video - %s", name.getString().c_str()); +*/ +} + +AVISurface::~AVISurface() { + if (_videoSurface) + _videoSurface->_blitStyleFlag = false; + delete _frameInfo; +} + +bool AVISurface::play(uint flags, CGameObject *obj) { + if (flags & MOVIE_REVERSE) + return play(_decoder->getFrameCount() - 1, 0, flags, obj); + else + return play(0, _decoder->getFrameCount() - 1, flags, obj); +} + +bool AVISurface::play(int startFrame, int endFrame, uint flags, CGameObject *obj) { + if (flags & MOVIE_STOP_PREVIOUS) + stop(); + + return play(startFrame, endFrame, -1, flags, obj); +} + +bool AVISurface::play(int startFrame, int endFrame, int initialFrame, uint flags, CGameObject *obj) { + CMovieRangeInfo *info = new CMovieRangeInfo(); + info->_startFrame = startFrame; + info->_endFrame = endFrame; + info->_isReversed = endFrame < startFrame; + info->_isFlag1 = flags & MOVIE_1; + + if (obj) { + CMovieEvent *me = new CMovieEvent(); + me->_type = MET_MOVIE_END; + me->_startFrame = startFrame; + me->_endFrame = endFrame; + me->_initialFrame = 0; + me->_gameObject = obj; + + info->addEvent(me); + } + + _movieRangeInfo.push_back(info); + + if (_movieRangeInfo.size() == 1) { + changeFrame(initialFrame); + } else { + return true; + } +} + +void AVISurface::stop() { + _isPlaying = false; + _decoder->stop(); + _movieRangeInfo.destroyContents(); +} + +bool AVISurface::changeFrame(int frameNumber) { + if (_isPlaying) + return false; + + if (frameNumber == -1) + // Default to starting frame of first movie range + frameNumber = _movieRangeInfo.front()->_startFrame; + + seekToFrame(frameNumber); + renderFrame(); + + _isPlaying = true; + return true; +} + +void AVISurface::seekToFrame(uint frameNumber) { + _decoder->seekToFrame(frameNumber); + _priorFrame = frameNumber; +} + +bool AVISurface::handleEvents(CMovieEventList &events) { + if (!_isPlaying) + return true; + + CMovieRangeInfo *info = _movieRangeInfo.front(); + _currentPos += info->_isReversed ? -1 : 1; + if ((info->_isReversed && _currentPos < info->_endFrame) || + (!info->_isReversed && _currentPos > info->_endFrame)) { + if (info->_isFlag1) { + info->getMovieEnd(events); + _movieRangeInfo.remove(info); + delete info; + + if (_movieRangeInfo.empty()) { + // NO more ranges, so stop playback + stop(); + } else { + // Not empty, so move onto new first one + info = _movieRangeInfo.front(); + _currentPos = info->_startFrame; + } + } else { + _currentPos = info->_startFrame; + } + } + + if (_isPlaying) { + // SInce movie ranges can change the position in the movie, + // ensure the decoder is kept in sync + seekToFrame(_currentPos); + + info->getMovieFrame(events, _currentPos); + return renderFrame(); + } else { + return false; + } +} + +void AVISurface::setVideoSurface(CVideoSurface *surface) { + _videoSurface = surface; + + warning("TODO: Get video track list from video decoder"); +} + +uint AVISurface::getWidth() const { + return _decoder->getWidth(); +} + +uint AVISurface::getHeight() const { + return _decoder->getHeight(); +} + +void AVISurface::setFrame(int frameNumber) { + // If playback was in process, stop it + if (_isPlaying) + stop(); + + // Ensure the frame number is valid + if (frameNumber >= _decoder->getFrameCount()) + frameNumber = _decoder->getFrameCount() - 1; + + seekToFrame(frameNumber); + renderFrame(); +} + +int AVISurface::getFrame() const { + return _decoder->getCurFrame(); +} + +bool AVISurface::renderFrame() { + // Check there's a frame ready for + assert(_videoSurface); + if (!_decoder->needsUpdate()) + return false; + + // Get the frame to render, and draw it on the surface + const Graphics::Surface *frame = _decoder->decodeNextFrame(); + _videoSurface->blitFrom(Point(0, 0), frame); + return false; +} + +bool AVISurface::addEvent(int frameNumber, CGameObject *obj) { + if (!_movieRangeInfo.empty()) { + CMovieRangeInfo *tail = _movieRangeInfo.back(); + if (frameNumber == -1) + frameNumber = tail->_startFrame; + + CMovieEvent *me = new CMovieEvent(); + me->_type = MET_FRAME; + me->_startFrame = 0; + me->_endFrame = 0; + me->_initialFrame = frameNumber; + me->_gameObject = obj; + tail->addEvent(me); + + return _movieRangeInfo.size() == 1 && frameNumber == _priorFrame; + } + + return false; } } // End of namespace Titanic diff --git a/engines/titanic/support/avi_surface.h b/engines/titanic/support/avi_surface.h index 248f2c5ab3..48c8169e78 100644 --- a/engines/titanic/support/avi_surface.h +++ b/engines/titanic/support/avi_surface.h @@ -23,33 +23,121 @@ #ifndef TITANIC_AVI_SURFACE_H #define TITANIC_AVI_SURFACE_H -#include "video/video_decoder.h" +#include "video/avi_decoder.h" #include "titanic/core/resource_key.h" #include "titanic/support/movie_range_info.h" namespace Titanic { class CSoundManager; +class CVideoSurface; + +enum MovieFlag { + MOVIE_1 = 1, MOVIE_STOP_PREVIOUS = 2, MOVIE_NO_OBJECT = 4, + MOVIE_REVERSE = 8, MOVIE_GAMESTATE = 0x10 +}; class AVISurface { private: + Video::AVIDecoder *_decoder; + CVideoSurface *_videoSurface; int _field4; int _field8; - int _fieldC; - int _field10; - int _frame; + int _currentPos; + int _priorFrame; CMovieRangeInfoList _movieRangeInfo; - int _field28; - int _field2C; - int _field30; - int _field34; - int _field38; + int _streamCount; + void *_frameInfo; +private: + /** + * Render a frame to the video surface + */ + bool renderFrame(); +protected: + /** + * Change the frame with ??? checking + */ + virtual bool changeFrame(int frameNumber); + + /** + * Seeks to a given frame number in the video + */ + virtual void seekToFrame(uint frameNumber); +public: CSoundManager *_soundManager; - // TODO: Lots more fields + bool _hasAudio; + bool _isPlaying; + double _frameRate; public: AVISurface(const CResourceKey &key); + ~AVISurface(); + + /** + * Start playing the loaded AVI video + */ + virtual bool play(uint flags, CGameObject *obj); + + /** + * Start playing the loaded AVI video + */ + virtual bool play(int startFrame, int endFrame, uint flags, CGameObject *obj); + + /** + * Start playing the loaded AVI video + */ + virtual bool play(int startFrame, int endFrame, int initialFrame, uint flags, CGameObject *obj); + + /** + * Stop the currently playing video + */ + virtual void stop(); + + /** + * Handle any movie events relevent for the frame + */ + virtual bool handleEvents(CMovieEventList &events); + + /** + * Set the video surface the AVI Surface will render on + */ + void setVideoSurface(CVideoSurface *surface); + + /** + * Get the width of the video + */ + uint getWidth() const; + + /** + * Get the height of the video + */ + uint getHeight() const; + + /** + * Set the current frame + */ + void setFrame(int frameNumber); + + /** + * Gets the current frame + */ + int getFrame() const; + + /** + * Add a movie event + */ + bool addEvent(int frameNumber, CGameObject *obj); + + const void *getFrameInfo() const { + return _streamCount <= 1 ? nullptr : _frameInfo; + } + + /** + * Get a reference to the movie range info list + */ + const CMovieRangeInfoList *getMovieRangeInfo() const { + return &_movieRangeInfo; + } - }; } // End of namespace Titanic diff --git a/engines/titanic/support/mouse_cursor.cpp b/engines/titanic/support/mouse_cursor.cpp index d87e7a499b..721088f086 100644 --- a/engines/titanic/support/mouse_cursor.cpp +++ b/engines/titanic/support/mouse_cursor.cpp @@ -91,15 +91,17 @@ void CMouseCursor::loadCursorImages() { // Create the surface CVideoSurface *surface = _screenManager->createSurface(64, 64); _cursors[idx]._videoSurface = surface; - +/* Common::SeekableReadStream *stream = new Common::MemoryReadStream( movieData, f.size(), DisposeAfterUse::NO); OSMovie movie(stream, surface); movie.setFrame(idx); - - _cursors[idx]._ptrUnknown = movie.proc21(); - surface->set40(_cursors[idx]._ptrUnknown); - } + + int frameNum = movie.proc21(); + _cursors[idx]._frameNumber = frameNum; + surface->setMovieFrame(frameNum); +*/ + } } void CMouseCursor::show() { diff --git a/engines/titanic/support/mouse_cursor.h b/engines/titanic/support/mouse_cursor.h index 55e0cb4da5..168a7be539 100644 --- a/engines/titanic/support/mouse_cursor.h +++ b/engines/titanic/support/mouse_cursor.h @@ -54,7 +54,7 @@ class CVideoSurface; class CMouseCursor { struct CursorEntry { CVideoSurface *_videoSurface; - void *_ptrUnknown; + int _frameNumber; Common::Point _centroid; }; private: diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index 6a79c02a3e..338396ff96 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -20,42 +20,51 @@ * */ -#include "video/avi_decoder.h" -#include "titanic/sound/sound_manager.h" #include "titanic/support/movie.h" +#include "titanic/support/avi_surface.h" +#include "titanic/sound/sound_manager.h" +#include "titanic/messages/messages.h" #include "titanic/titanic.h" namespace Titanic { -CMovieList *CMovie::_activeMovies; +#define CLIP_WIDTH 600 +#define CLIP_WIDTH_REDUCED (CLIP_WIDTH / 2) +#define CLIP_HEIGHT 340 +#define CLIP_HEIGHT_REDUCED (CLIP_HEIGHT / 2) + +CMovieList *CMovie::_playingMovies; +CVideoSurface *CMovie::_movieSurface; -CMovie::CMovie() : ListItem(), _state(MOVIE_STOPPED), _field10(0), +CMovie::CMovie() : ListItem(), _state(MSTATE_0), _field10(0), _field14(0) { } CMovie::~CMovie() { - removeFromActiveMovies(); + removeFromPlayingMovies(); } void CMovie::init() { - _activeMovies = new CMovieList(); + _playingMovies = new CMovieList(); + _movieSurface = nullptr; } void CMovie::deinit() { - delete _activeMovies; + delete _playingMovies; + delete _movieSurface; } -void CMovie::addToActiveMovies() { +void CMovie::addToPlayingMovies() { if (!isActive()) - _activeMovies->push_back(this); + _playingMovies->push_back(this); } -void CMovie::removeFromActiveMovies() { - _activeMovies->remove(this); +void CMovie::removeFromPlayingMovies() { + _playingMovies->remove(this); } bool CMovie::isActive() const { - return _activeMovies->contains(this); + return _playingMovies->contains(this); } bool CMovie::get10() { @@ -70,156 +79,148 @@ bool CMovie::get10() { /*------------------------------------------------------------------------*/ OSMovie::OSMovie(const CResourceKey &name, CVideoSurface *surface) : - _videoSurface(surface), _gameObject(nullptr), _endFrame(-1) { - Video::AVIDecoder *decoder = new Video::AVIDecoder(); - _video = decoder; - _field14 = 1; - - if (!_video->loadFile(name.getString())) - error("Could not open video - %s", name.getString().c_str()); -} + _aviSurface(name), _videoSurface(surface) { + _field18 = 0; + _field24 = 0; + _field28 = 0; + _field2C = 0; + _ticksStart = 0; + _frameTime1 = 0; + _frameTime2 = 17066; -OSMovie::OSMovie(Common::SeekableReadStream *stream, CVideoSurface *surface) : - _videoSurface(surface), _gameObject(nullptr), _endFrame(-1) { - _video = new Video::AVIDecoder(); - if (!_video->loadStream(stream)) - error("Could not parse movie stream"); + surface->resize(_aviSurface.getWidth(), _aviSurface.getHeight()); + _aviSurface.setVideoSurface(surface); } OSMovie::~OSMovie() { - delete _video; } -void OSMovie::play(uint flags, CVideoSurface *surface) { - uint endFrame = _video->getFrameCount(); - play(0, endFrame, 0, 0); -} +void OSMovie::play(uint flags, CGameObject *obj) { + _aviSurface.play(flags, obj); -void OSMovie::play(uint startFrame, uint endFrame, int v3, bool v4) { - warning("TODO: OSMovie::play properly"); + if (_aviSurface._isPlaying) + movieStarted(); +} - _video->start(); - _video->seekToFrame(startFrame); - _endFrame = endFrame; +void OSMovie::play(uint startFrame, uint endFrame, uint flags, CGameObject *obj) { + _aviSurface.play(startFrame, endFrame, flags, obj); - addToActiveMovies(); - _state = MOVIE_NONE; + if (_aviSurface._isPlaying) + movieStarted(); } -void OSMovie::play(const Rect &rect, int v1, int v2) { - warning("TODO: OSMovie::play 3"); -} +void OSMovie::play(uint startFrame, uint endFrame, uint initialFrame, uint flags, CGameObject *obj) { + _aviSurface.play(startFrame, endFrame, initialFrame, flags, obj); -void OSMovie::playClip(const Rect &rect, uint startFrame, uint endFrame) { - warning("TODO: OSMovie::playClip"); + if (_aviSurface._isPlaying) + movieStarted(); } -void OSMovie::proc11() { - warning("TODO: OSMovie::proc11"); -} +void OSMovie::playClip(const Point &drawPos, uint startFrame, uint endFrame) { + if (!_movieSurface) + _movieSurface = CScreenManager::_screenManagerPtr->createSurface(600, 340); + + bool widthLess = _videoSurface->getWidth() < 600; + bool heightLess = _videoSurface->getHeight() < 340; + Rect r(drawPos.x, drawPos.y, + drawPos.x + widthLess ? CLIP_WIDTH_REDUCED : CLIP_WIDTH, + drawPos.y + heightLess ? CLIP_HEIGHT_REDUCED : CLIP_HEIGHT + ); -void OSMovie::proc12(int v1, int v2, int frameNumber, int flags, CGameObject *obj) { - warning("TODO: OSMovie::proc12"); + uint timePerFrame = 1000 / _aviSurface._frameRate; + + for (; endFrame >= startFrame; ++startFrame) { + // Set the frame + _aviSurface.setFrame(startFrame); + + // TODO: See if we need to do anything further here. The original had a bunch + // of calls and using of the _movieSurface; perhaps to allow scaling down + // videos to half-size + if (widthLess || heightLess) + warning("Not properly reducing clip size: %d %d", r.width(), r.height()); + + // Wait for the next frame, unless the user interrupts the clip + if (g_vm->_events->waitForPress(timePerFrame)) + break; + } } void OSMovie::stop() { - _video->stop(); - _state = MOVIE_STOPPED; + _aviSurface.stop(); + removeFromPlayingMovies(); } -void OSMovie::proc14() { - warning("TODO: OSMovie::proc14"); +void OSMovie::addEvent(int frameNumber, CGameObject *obj) { + if (_aviSurface.addEvent(frameNumber, obj)) { + CMovieFrameMsg frameMsg(frameNumber, 0); + frameMsg.execute(obj); + } } void OSMovie::setFrame(uint frameNumber) { - _video->seekToFrame(frameNumber); - decodeFrame(); + _aviSurface.setFrame(frameNumber); + _videoSurface->setMovieFrame(frameNumber); } -void OSMovie::proc16() { - warning("TODO: OSMovie::proc16"); -} +bool OSMovie::handleEvents(CMovieEventList &events) { + if (!_aviSurface._isPlaying) + return false; -const Common::List OSMovie::getMovieRangeInfo() const { - warning("TODO: OSMovie::getMovieRangeInfo"); - return Common::List(); -} + int time = (g_vm->_events->getTicksCount() + ((_ticksStart << 24) - _ticksStart)) << 8; + if (time < _frameTime1) + return _aviSurface._isPlaying; -void OSMovie::setSoundManager(CSoundManager *soundManager) { -// if (_aviSurface) -// _aviSurface->_field3C = soundManager; + if (!_field14 && (time - _frameTime1) > (_frameTime2 * 2)) + _frameTime1 = time; - warning("TODO: OSMovie::proc18"); -} + _frameTime1 += _frameTime2; + _aviSurface.handleEvents(events); + _videoSurface->setMovieFrameInfo(_aviSurface.getFrameInfo()); -int OSMovie::getFrame() { - assert(_video); - return _video->getCurFrame(); -} + if (_field14) { + while (_frameTime1 >= time && events.empty()) { + _aviSurface.handleEvents(events); + _videoSurface->setMovieFrameInfo(_aviSurface.getFrameInfo()); -void OSMovie::proc20() { - warning("TODO: OSMovie::proc20"); -} - -void *OSMovie::proc21() { - warning("TODO: OSMovie::proc21"); - return nullptr; -} - -MovieState OSMovie::getState() { - if (!_video) - _state = MOVIE_STOPPED; - return _state; -} - -void OSMovie::update() { - if (_state != MOVIE_STOPPED) { - if (_video->isPlaying()) { - if (_video->getCurFrame() >= _endFrame) { - _video->stop(); - _state = MOVIE_FINISHED; - } else if (_video->needsUpdate()) { - decodeFrame(); - _state = MOVIE_FRAME; - } else { - _state = MOVIE_NONE; - } - } else { - _state = MOVIE_STOPPED; + _frameTime1 += _frameTime2; } } + + return _aviSurface._isPlaying; +} + +const CMovieRangeInfoList *OSMovie::getMovieRangeInfo() const { + return _aviSurface.getMovieRangeInfo(); } -void OSMovie::decodeFrame() { - const Graphics::Surface *frame = _video->decodeNextFrame(); - OSVideoSurface *videoSurface = static_cast(_videoSurface); - assert(videoSurface); +void OSMovie::setSoundManager(CSoundManager *soundManager) { + _aviSurface._soundManager = soundManager; +} - // If the video surface doesn't yet have an underlying surface, create it - if (!videoSurface->hasSurface()) - videoSurface->recreate(frame->w, frame->h); +int OSMovie::getFrame() const { + return _aviSurface.getFrame(); +} - // Lock access to the surface - videoSurface->lock(); - assert(videoSurface->_rawSurface); +void OSMovie::movieStarted() { + _frameTime1 = _frameTime2 = 256000.0 / _aviSurface._frameRate; + _ticksStart = g_vm->_events->getTicksCount(); - if (frame->format == videoSurface->_rawSurface->format) { - // Matching format, so we can copy straight from the video frame - videoSurface->_rawSurface->blitFrom(*frame); - } else { - // Different formats so we have to convert it first - Graphics::Surface *s = frame->convertTo(videoSurface->_rawSurface->format); - videoSurface->_rawSurface->blitFrom(*s); + if (_aviSurface._hasAudio) + _aviSurface._soundManager->movieStarted(); - s->free(); - delete s; - } + // Register the movie in the playing list + addToPlayingMovies(); + _field10 = 1; +} - // Unlock the surface - videoSurface->unlock(); +void OSMovie::proc20() { + // TODO +} - if (_gameObject) - _gameObject->makeDirty(); +int OSMovie::proc21() { + // TODO + return 0; } + } // End of namespace Titanic diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index 7abca6bbc0..c839c882ca 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -27,12 +27,13 @@ #include "video/video_decoder.h" #include "titanic/core/list.h" #include "titanic/core/resource_key.h" +#include "titanic/support/avi_surface.h" #include "titanic/support/movie_range_info.h" namespace Titanic { enum MovieState { - MOVIE_STOPPED = -1, MOVIE_NONE = 0, MOVIE_FINISHED = 1, MOVIE_FRAME = 2 + MSTATE_0 = 0, MSTATE_1 = 1 }; class CGameObject; @@ -46,22 +47,17 @@ public: class CMovie : public ListItem { protected: - MovieState _state; - int _field10; -protected: - /** - * Adds the movie to the active movies list - */ - void addToActiveMovies(); - /** - * Removes the movie from the active movies list + * Adds the movie to the list of currently playing movies */ - void removeFromActiveMovies(); + void addToPlayingMovies(); public: + MovieState _state; + int _field10; int _field14; public: - static CMovieList *_activeMovies; + static CMovieList *_playingMovies; + static CVideoSurface *_movieSurface; /** * Initializes statics @@ -77,41 +73,49 @@ public: virtual ~CMovie(); /** - * Plays the movie + * Starts playing the movie */ - virtual void play(uint flags, CVideoSurface *surface) = 0; + virtual void play(uint flags, CGameObject *obj) = 0; /** - * Plays the movie + * Starts playing the movie */ - virtual void play(uint startFrame, uint endFrame, int v3, bool v4) = 0; + virtual void play(uint startFrame, uint endFrame, uint flags, CGameObject *obj) = 0; /** - * Plays the movie + * Starts playing the movie */ - virtual void play(const Rect &rect, int v1, int v2) = 0; + virtual void play(uint startFrame, uint endFrame, uint initialFrame, uint flags, CGameObject *obj) = 0; /** * Plays a sub-section of a movie */ - virtual void playClip(const Rect &rect, uint startFrame, uint endFrame) = 0; + virtual void playClip(const Point &drawPos, uint startFrame, uint endFrame) = 0; - virtual void proc11() = 0; - virtual void proc12(int v1, int v2, int frameNumber, int flags, CGameObject *obj) = 0; - /** * Stops the movie */ virtual void stop() = 0; - virtual void proc14() = 0; + /** + * Add a playback event + */ + virtual void addEvent(int frameNumber, CGameObject *obj) = 0; + + /** + * Set the current frame number + */ virtual void setFrame(uint frameNumber) = 0; - virtual void proc16() = 0; + + /** + * Handle any pending movie events + */ + virtual bool handleEvents(CMovieEventList &events) = 0; /** * Return any movie range info associated with the movie */ - virtual const Common::List getMovieRangeInfo() const = 0; + virtual const CMovieRangeInfoList *getMovieRangeInfo() const = 0; /** * Set the sound manager reference @@ -121,94 +125,102 @@ public: /** * Get the current movie frame */ - virtual int getFrame() = 0; + virtual int getFrame() const = 0; virtual void proc20() = 0; - virtual void *proc21() = 0; + virtual int proc21() = 0; + + /** + * Removes the movie from the list of currently playing movies + */ + void removeFromPlayingMovies(); + /** + * Returns true if the movie is currently active + */ bool isActive() const; bool get10(); - - virtual MovieState getState() = 0; - virtual void update() = 0; }; class OSMovie : public CMovie { private: - Video::VideoDecoder *_video; + AVISurface _aviSurface; CVideoSurface *_videoSurface; - int _endFrame; - + int _field18; + int _field24; + int _field28; + int _field2C; + int _ticksStart; + int _frameTime1; + int _frameTime2; +private: /** - * Decodes the next frame + * Called when a movie is started playing */ - void decodeFrame(); -public: - CGameObject *_gameObject; + void movieStarted(); public: OSMovie(const CResourceKey &name, CVideoSurface *surface); - OSMovie(Common::SeekableReadStream *stream, CVideoSurface *surface); virtual ~OSMovie(); /** - * Plays the movie + * Starts playing the movie */ - virtual void play(uint flags, CVideoSurface *surface); + virtual void play(uint flags, CGameObject *obj); /** - * Plays the movie + * Starts playing the movie */ - virtual void play(uint startFrame, uint endFrame, int v3, bool v4); + virtual void play(uint startFrame, uint endFrame, uint flags, CGameObject *obj); /** - * Plays the movie + * Starts playing the movie */ - virtual void play(const Rect &rect, int v1, int v2); + virtual void play(uint startFrame, uint endFrame, uint initialFrame, uint flags, CGameObject *obj); /** * Plays a sub-section of a movie */ - virtual void playClip(const Rect &rect, uint startFrame, uint endFrame); - - virtual void proc11(); - virtual void proc12(int v1, int v2, int frameNumber, int flags, CGameObject *obj); + virtual void playClip(const Point &drawPos, uint startFrame, uint endFrame); /** * Stops the movie */ virtual void stop(); - virtual void proc14(); + /** + * Add a playback event + */ + virtual void addEvent(int eventId, CGameObject *obj); /** * Set the current frame number */ virtual void setFrame(uint frameNumber); - virtual void proc16(); + /** + * Handle any pending movie events + */ + virtual bool handleEvents(CMovieEventList &events); /** - * Return any movie range info associated with the movie + * Get the current frame number */ - virtual const Common::List getMovieRangeInfo() const; + virtual int getFrame() const; /** - * Set the sound manager reference + * Return any movie range info associated with the movie */ - virtual void setSoundManager(CSoundManager *soundManager); + virtual const CMovieRangeInfoList *getMovieRangeInfo() const; /** - * Get the current movie frame + * Set the sound manager reference */ - virtual int getFrame(); + virtual void setSoundManager(CSoundManager *soundManager); virtual void proc20(); - virtual void *proc21(); - + virtual int proc21(); - virtual MovieState getState(); - virtual void update(); }; } // End of namespace Titanic diff --git a/engines/titanic/support/movie_event.cpp b/engines/titanic/support/movie_event.cpp index 870a06fe6f..5f8a6da019 100644 --- a/engines/titanic/support/movie_event.cpp +++ b/engines/titanic/support/movie_event.cpp @@ -21,27 +21,29 @@ */ #include "titanic/support/movie_event.h" +#include "titanic/core/game_object.h" namespace Titanic { -CMovieEvent::CMovieEvent() : ListItem(), _fieldC(0), _field10(0), - _field14(0), _field1C(0) { +CMovieEvent::CMovieEvent() : ListItem(), _type(MET_PLAY), _startFrame(0), + _endFrame(0), _initialFrame(0), _gameObject(nullptr) { } CMovieEvent::CMovieEvent(const CMovieEvent *src) { - _fieldC = src->_fieldC; - _field10 = src->_field10; - _field14 = src->_field14; - _field18 = src->_field18; - _field1C = src->_field1C; + _type = src->_type; + _startFrame = src->_startFrame; + _endFrame = src->_endFrame; + _initialFrame = src->_initialFrame; + _gameObject = src->_gameObject; } void CMovieEvent::save(SimpleFile *file, int indent) { file->writeNumberLine(0, indent); - file->writeNumberLine(_fieldC, indent + 1); - file->writeNumberLine(_field10, indent + 1); - file->writeNumberLine(_field14, indent + 1); - file->writeNumberLine(_field1C, indent + 1); + file->writeNumberLine(_startFrame, indent + 1); + file->writeNumberLine(_endFrame, indent + 1); + error("FIXME: Original save/loaded object pointer"); + // file->writeNumberLine(_gameObject, indent + 1); + file->writeNumberLine(_initialFrame, indent + 1); ListItem::save(file, indent); } @@ -49,10 +51,11 @@ void CMovieEvent::save(SimpleFile *file, int indent) { void CMovieEvent::load(SimpleFile *file) { int val = file->readNumber(); if (!val) { - _fieldC = file->readNumber(); - _field10 = file->readNumber(); - _field14 = file->readNumber(); - _field1C = file->readNumber(); + _startFrame = file->readNumber(); + _endFrame = file->readNumber(); + file->readNumber(); + error("FIXME: Original save/loaded object pointer"); + _initialFrame = file->readNumber(); } ListItem::load(file); diff --git a/engines/titanic/support/movie_event.h b/engines/titanic/support/movie_event.h index ed72e2d349..af93c76a31 100644 --- a/engines/titanic/support/movie_event.h +++ b/engines/titanic/support/movie_event.h @@ -27,13 +27,17 @@ namespace Titanic { +enum MovieEventType { MET_PLAY = 0, MET_MOVIE_END = 1, MET_FRAME = 2 }; + +class CGameObject; + class CMovieEvent : public ListItem { public: - int _fieldC; - int _field10; - int _field14; - int _field18; - int _field1C; + MovieEventType _type; + int _startFrame; + int _endFrame; + CGameObject *_gameObject; + int _initialFrame; public: CMovieEvent(); CMovieEvent(const CMovieEvent *src); @@ -53,6 +57,10 @@ public: class CMovieEventList : public List { }; +class CSharedMovieEventList : public Common::List { +}; + + } // End of namespace Titanic #endif /* TITANIC_MOVIE_EVENT_H */ diff --git a/engines/titanic/support/movie_range_info.cpp b/engines/titanic/support/movie_range_info.cpp index e6b28ce4e8..4c62539864 100644 --- a/engines/titanic/support/movie_range_info.cpp +++ b/engines/titanic/support/movie_range_info.cpp @@ -34,11 +34,11 @@ CMovieRangeInfo::~CMovieRangeInfo() { } CMovieRangeInfo::CMovieRangeInfo(const CMovieRangeInfo *src) : ListItem() { - _fieldC = src->_fieldC; - _field10 = src->_field10; - _frameNumber = src->_frameNumber; _startFrame = src->_startFrame; _endFrame = src->_endFrame; + _initialFrame = src->_initialFrame; + _isReversed = src->_isReversed; + _isFlag1 = src->_isFlag1; // Duplicate the events list for (CMovieEventList::const_iterator i = _events.begin(); @@ -49,38 +49,38 @@ CMovieRangeInfo::CMovieRangeInfo(const CMovieRangeInfo *src) : ListItem() { void CMovieRangeInfo::save(SimpleFile *file, int indent) { file->writeNumberLine(0, indent); - file->writeNumberLine(_fieldC, indent + 1); - file->writeNumberLine(_field10, indent + 1); - file->writeNumberLine(_frameNumber, indent + 1); - file->writeNumberLine(_endFrame, indent + 1); file->writeNumberLine(_startFrame, indent + 1); + file->writeNumberLine(_endFrame, indent + 1); + file->writeNumberLine(_initialFrame, indent + 1); + file->writeNumberLine(_isFlag1, indent + 1); + file->writeNumberLine(_isReversed, indent + 1); _events.save(file, indent + 1); } void CMovieRangeInfo::load(SimpleFile *file) { int val = file->readNumber(); if (!val) { - _fieldC = file->readNumber(); - _field10 = file->readNumber(); - _frameNumber = file->readNumber(); - _endFrame = file->readNumber(); _startFrame = file->readNumber(); + _endFrame = file->readNumber(); + _initialFrame = file->readNumber(); + _isFlag1 = file->readNumber(); + _isReversed = file->readNumber(); _events.load(file); } } -void CMovieRangeInfo::get1(CMovieEventList &list) { +void CMovieRangeInfo::getMovieEnd(CMovieEventList &list) { for (CMovieEventList::iterator i = _events.begin(); i != _events.end(); ++i) { CMovieEvent *movieEvent = *i; - if (movieEvent->_fieldC == 1) + if (movieEvent->_type == MET_MOVIE_END) list.push_back(new CMovieEvent(movieEvent)); } } -void CMovieRangeInfo::get2(CMovieEventList &list, int val) { +void CMovieRangeInfo::getMovieFrame(CMovieEventList &list, int frameNumber) { for (CMovieEventList::iterator i = _events.begin(); i != _events.end(); ++i) { CMovieEvent *movieEvent = *i; - if (movieEvent->_fieldC == 2 && movieEvent->_field1C == val) + if (movieEvent->_type == MET_FRAME && movieEvent->_initialFrame == frameNumber) list.push_back(new CMovieEvent(movieEvent)); } } @@ -88,24 +88,24 @@ void CMovieRangeInfo::get2(CMovieEventList &list, int val) { void CMovieRangeInfo::process(CGameObject *owner) { int flags = 0; if (_endFrame) - flags |= CLIPFLAG_HAS_END_FRAME; + flags |= MOVIE_1; if (_startFrame) - flags |= CLIPFLAG_HAS_START_FRAME; + flags |= MOVIE_REVERSE; for (CMovieEventList::iterator i = _events.begin(); i != _events.end(); ++i) { CMovieEvent *movieEvent = *i; - if (!movieEvent->_fieldC) { + if (!movieEvent->_type == MET_PLAY) { flags |= CLIPFLAG_PLAY; break; } } - owner->checkPlayMovie(_fieldC, _field10, _frameNumber, flags); + owner->playMovie(_startFrame, _endFrame, _initialFrame, flags); for (CMovieEventList::iterator i = _events.begin(); i != _events.end(); ++i) { CMovieEvent *movieEvent = *i; - if (!movieEvent->_fieldC) - owner->surface38(movieEvent->_field1C); + if (movieEvent->_type == MET_PLAY) + owner->movieEvent(movieEvent->_initialFrame); } } diff --git a/engines/titanic/support/movie_range_info.h b/engines/titanic/support/movie_range_info.h index be04975cbf..b8186e6f7e 100644 --- a/engines/titanic/support/movie_range_info.h +++ b/engines/titanic/support/movie_range_info.h @@ -34,11 +34,11 @@ class CGameObject; class CMovieRangeInfo : public ListItem { public: - int _fieldC; - int _field10; - int _frameNumber; - uint _startFrame; - uint _endFrame; + int _startFrame; + int _endFrame; + int _initialFrame; + bool _isReversed; + bool _isFlag1; CMovieEventList _events; public: CMovieRangeInfo(); @@ -60,9 +60,15 @@ public: */ void addEvent(CMovieEvent *movieEvent) { _events.push_back(movieEvent); } - void get1(CMovieEventList &list); + /** + * Get any movie end events for the range + */ + void getMovieEnd(CMovieEventList &list); - void get2(CMovieEventList &list, int val); + /** + * Get any movie frame events for a specified frame number + */ + void getMovieFrame(CMovieEventList &list, int frameNumber); void process(CGameObject *owner); }; diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index 0335e7d9b1..fc7db30391 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -32,7 +32,7 @@ int CVideoSurface::_videoSurfaceCounter = 0; CVideoSurface::CVideoSurface(CScreenManager *screenManager) : _screenManager(screenManager), _rawSurface(nullptr), _movie(nullptr), _pendingLoad(false), _blitStyleFlag(false), _blitFlag(false), - _field40(nullptr), _field44(4), _field48(0), _field50(1) { + _movieFrameInfo(nullptr), _transparencyMode(TRANS_DEFAULT), _field48(0), _field50(1) { _videoSurfaceNum = _videoSurfaceCounter++; } @@ -427,22 +427,22 @@ void OSVideoSurface::clear() { } -void OSVideoSurface::playMovie(uint flags, CVideoSurface *surface) { +void OSVideoSurface::playMovie(uint flags, CGameObject *obj) { if (loadIfReady() && _movie) - _movie->play(flags, surface); + _movie->play(flags, obj); _ddSurface->fill(nullptr, 0); } -void OSVideoSurface::playMovie(uint startFrame, uint endFrame, int v3, bool v4) { +void OSVideoSurface::playMovie(uint startFrame, uint endFrame, uint flags, CGameObject *obj) { if (loadIfReady() && _movie) { - _movie->play(startFrame, endFrame, v3, v4); + _movie->play(startFrame, endFrame, flags, obj); } } -void OSVideoSurface::proc35(int v1, int v2, int frameNumber, int flags, CGameObject *owner) { +void OSVideoSurface::playMovie(uint startFrame, uint endFrame, uint initialFrame, uint flags, CGameObject *obj) { if (loadIfReady() && _movie) { - _movie->proc12(v1, v2, frameNumber, flags, owner); + _movie->play(startFrame, endFrame, initialFrame, flags, obj); } } @@ -456,16 +456,17 @@ void OSVideoSurface::setMovieFrame(uint frameNumber) { _movie->setFrame(frameNumber); } -void OSVideoSurface::proc38(int v1, int v2) { - warning("OSVideoSurface::proc38"); +void OSVideoSurface::addMovieEvent(int frameNumber, CGameObject *obj) { + if (_movie) + _movie->addEvent(frameNumber, obj); } void OSVideoSurface::proc39(int v1, int v2) { warning("OSVideoSurface::proc39"); } -const Common::List OSVideoSurface::getMovieRangeInfo() const { - return _movie ? _movie->getMovieRangeInfo() : Common::List(); +const CMovieRangeInfoList *OSVideoSurface::getMovieRangeInfo() const { + return _movie ? _movie->getMovieRangeInfo() : nullptr; } bool OSVideoSurface::loadIfReady() { diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index 37afccf9e1..3521be6336 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -35,6 +35,11 @@ namespace Titanic { +enum TransparencyMode { + TRANS_MASK0 = 0, TRANS_MASK255 = 1, TRANS_ALPHA0 = 2, + TRANS_ALPHA255 = 3, TRANS_DEFAULT = 4 +}; + class CScreenManager; class CJPEGDecode; class CTargaDecode; @@ -57,8 +62,7 @@ protected: CScreenManager *_screenManager; Graphics::ManagedSurface *_rawSurface; bool _pendingLoad; - void *_field40; - int _field44; + const void *_movieFrameInfo; int _field48; int _videoSurfaceNum; int _field50; @@ -69,6 +73,7 @@ public: bool _blitFlag; bool _blitStyleFlag; CResourceKey _resourceKey; + TransparencyMode _transparencyMode; public: CVideoSurface(CScreenManager *screenManager); virtual ~CVideoSurface(); @@ -190,15 +195,19 @@ public: * Plays a movie, loading it from the specified _resource * if not already loaded */ - virtual void playMovie(uint flags, CVideoSurface *surface) = 0; + virtual void playMovie(uint flags, CGameObject *obj) = 0; /** * Plays a movie, loading it from the specified _resource * if not already loaded */ - virtual void playMovie(uint startFrame, uint endFrame, int v3, bool v4) = 0; + virtual void playMovie(uint startFrame, uint endFrame, uint flags, CGameObject *obj) = 0; - virtual void proc35(int v1, int v2, int frameNumber, int flags, CGameObject *owner) = 0; + /** + * Plays a movie, loading it from the specified _resource + * if not already loaded + */ + virtual void playMovie(uint startFrame, uint endFrame, uint initialFrame, uint flags, CGameObject *obj) = 0; /** * Stops any movie currently attached to the surface @@ -206,18 +215,21 @@ public: virtual void stopMovie() = 0; /** - * Sets the movie to the specified frame number + * Set the current movie frame number */ virtual void setMovieFrame(uint frameNumber) = 0; - virtual void proc38(int v1, int v2) = 0; + /** + * Adds a movie playback event + */ + virtual void addMovieEvent(int eventId, CGameObject *obj) = 0; virtual void proc39(int v1, int v2) = 0; /** * Return any movie range info associated with the surface's movie */ - virtual const Common::List getMovieRangeInfo() const = 0; + virtual const CMovieRangeInfoList *getMovieRangeInfo() const = 0; /** * Loads the surface's resource if there's one pending @@ -257,8 +269,19 @@ public: */ void blitFrom(const Point &destPos, const Graphics::Surface *src); - void set40(void *v) { _field40 = v; } + /** + * + */ + void setMovieFrameInfo(const void *frameInfo) { _movieFrameInfo = frameInfo; } + + /** + */ + const void *getMovieFrameInfo() const { return _movieFrameInfo; } + /** + * Get the pixels associated with the surface. Only valid when the + * surface has been locked for access + */ uint16 *getPixels() { return (uint16 *)_rawSurface->getPixels(); } /** @@ -400,15 +423,19 @@ public: * Plays a movie, loading it from the specified _resource * if not already loaded */ - virtual void playMovie(uint flags, CVideoSurface *surface); + virtual void playMovie(uint flags, CGameObject *obj); /** * Plays a movie, loading it from the specified _resource * if not already loaded */ - virtual void playMovie(uint startFrame, uint endFrame, int v3, bool v4); + virtual void playMovie(uint startFrame, uint endFrame, uint flags, CGameObject *obj); - virtual void proc35(int v1, int v2, int frameNumber, int flags, CGameObject *owner); + /** + * Plays a movie, loading it from the specified _resource + * if not already loaded + */ + virtual void playMovie(uint startFrame, uint endFrame, uint initialFrame, uint flags, CGameObject *obj); /** * Stops any movie currently attached to the surface @@ -420,14 +447,17 @@ public: */ virtual void setMovieFrame(uint frameNumber); - virtual void proc38(int v1, int v2); + /** + * Adds a movie playback event + */ + virtual void addMovieEvent(int frameNumber, CGameObject *obj); virtual void proc39(int v1, int v2); /** * Return any movie range info associated with the surface's movie */ - virtual const Common::List getMovieRangeInfo() const; + virtual const CMovieRangeInfoList *getMovieRangeInfo() const; /** * Loads the surface's resource if there's one pending -- cgit v1.2.3 From 6c56d5aa11db1401bc0a2277776ec43128174bc2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 9 Jul 2016 12:07:12 -0400 Subject: TITANIC: Named two remaining OSMovie virtual methods --- engines/titanic/support/avi_surface.cpp | 12 ++++++++++++ engines/titanic/support/avi_surface.h | 9 +++++++++ engines/titanic/support/mouse_cursor.cpp | 10 +++++----- engines/titanic/support/mouse_cursor.h | 5 ++++- engines/titanic/support/movie.cpp | 10 ++++------ engines/titanic/support/movie.h | 23 ++++++++++++++++++----- 6 files changed, 52 insertions(+), 17 deletions(-) diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp index 47127fe83b..a416bc3d69 100644 --- a/engines/titanic/support/avi_surface.cpp +++ b/engines/titanic/support/avi_surface.cpp @@ -214,4 +214,16 @@ bool AVISurface::addEvent(int frameNumber, CGameObject *obj) { return false; } +void AVISurface::setFrameRate(double rate) { + if (rate >= 0.0 && rate <= 100.0) { + _frameRate = rate; + warning("TODO: Frame rate set to %d yet to be implemented", (int)rate); + } +} + +void *AVISurface::duplicateFrameInfo() const { + // TODO + return nullptr; +} + } // End of namespace Titanic diff --git a/engines/titanic/support/avi_surface.h b/engines/titanic/support/avi_surface.h index 48c8169e78..fe3e972b07 100644 --- a/engines/titanic/support/avi_surface.h +++ b/engines/titanic/support/avi_surface.h @@ -127,6 +127,11 @@ public: */ bool addEvent(int frameNumber, CGameObject *obj); + /** + * Set the frame rate + */ + void setFrameRate(double rate); + const void *getFrameInfo() const { return _streamCount <= 1 ? nullptr : _frameInfo; } @@ -138,6 +143,10 @@ public: return &_movieRangeInfo; } + /** + * Duplicate the frame info + */ + void *duplicateFrameInfo() const; }; } // End of namespace Titanic diff --git a/engines/titanic/support/mouse_cursor.cpp b/engines/titanic/support/mouse_cursor.cpp index 721088f086..be607a432f 100644 --- a/engines/titanic/support/mouse_cursor.cpp +++ b/engines/titanic/support/mouse_cursor.cpp @@ -97,11 +97,11 @@ void CMouseCursor::loadCursorImages() { OSMovie movie(stream, surface); movie.setFrame(idx); - int frameNum = movie.proc21(); - _cursors[idx]._frameNumber = frameNum; - surface->setMovieFrame(frameNum); -*/ - } + void *frameInfo = movie.duplicateFrameInfo(); + _cursors[idx]._frameInfo = frameInfo; + surface->setMovieFrameInfo(frameInfo); + */ + } } void CMouseCursor::show() { diff --git a/engines/titanic/support/mouse_cursor.h b/engines/titanic/support/mouse_cursor.h index 168a7be539..f674ccd23d 100644 --- a/engines/titanic/support/mouse_cursor.h +++ b/engines/titanic/support/mouse_cursor.h @@ -54,8 +54,11 @@ class CVideoSurface; class CMouseCursor { struct CursorEntry { CVideoSurface *_videoSurface; - int _frameNumber; + void *_frameInfo; Common::Point _centroid; + + CursorEntry() : _videoSurface(nullptr), _frameInfo(nullptr) {} + ~CursorEntry() { delete _frameInfo; } }; private: CScreenManager *_screenManager; diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index 338396ff96..fc31750508 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -213,14 +213,12 @@ void OSMovie::movieStarted() { _field10 = 1; } -void OSMovie::proc20() { - // TODO +void OSMovie::setFrameRate(double rate) { + _aviSurface.setFrameRate(rate); } -int OSMovie::proc21() { - // TODO - return 0; +void *OSMovie::duplicateFrameInfo() const { + return _aviSurface.duplicateFrameInfo(); } - } // End of namespace Titanic diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index c839c882ca..8034bd4032 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -126,9 +126,16 @@ public: * Get the current movie frame */ virtual int getFrame() const = 0; - - virtual void proc20() = 0; - virtual int proc21() = 0; + + /** + * Set the frame rate for the movie + */ + virtual void setFrameRate(double rate) = 0; + + /** + * Creates a duplicate of the frame info + */ + virtual void *duplicateFrameInfo() const = 0; /** * Removes the movie from the list of currently playing movies @@ -218,9 +225,15 @@ public: */ virtual void setSoundManager(CSoundManager *soundManager); - virtual void proc20(); - virtual int proc21(); + /** + * Set the frame rate for the movie + */ + virtual void setFrameRate(double rate); + /** + * Creates a duplicate of the frame info + */ + virtual void *duplicateFrameInfo() const; }; } // End of namespace Titanic -- cgit v1.2.3 From fd954a8e0b41370ae68f3b409295676de207313d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 10 Jul 2016 11:36:04 -0400 Subject: TITANIC: Added OSVideoSurface flipVertically --- engines/titanic/core/game_object.cpp | 4 ++-- engines/titanic/core/game_object.h | 5 ++++- engines/titanic/support/avi_surface.cpp | 21 ++++++++++--------- engines/titanic/support/video_surface.cpp | 34 +++++++++++++++++++++++++++++-- engines/titanic/support/video_surface.h | 31 ++++++++++++++++++++++++++-- 5 files changed, 78 insertions(+), 17 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 78b91c3375..eeb765e40f 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -927,9 +927,9 @@ void CGameObject::dec54() { getGameManager()->dec54(); } -void CGameObject::surface39(int v1, int v2) { +void CGameObject::setMovieFrameRate(double rate) { if (_surface) - _surface->proc39(v1, v2); + _surface->setMovieFrameRate(rate); } void CGameObject::setTextBorder(const CString &str, int border, int borderRight) { diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 58ae4c6123..b74c35f524 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -437,7 +437,10 @@ protected: */ void quitGame(); - void surface39(int v1, int v2); + /** + * Set the frame rate for the currently loaded movie + */ + void setMovieFrameRate(double rate); /** * Set up the text borders for the object diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp index a416bc3d69..e371ccb812 100644 --- a/engines/titanic/support/avi_surface.cpp +++ b/engines/titanic/support/avi_surface.cpp @@ -27,23 +27,24 @@ namespace Titanic { AVISurface::AVISurface(const CResourceKey &key) { + _videoSurface = nullptr; + _field4 = 0; + _field8 = 0; + _currentPos = 0; + _priorFrame = 0; + _streamCount = 0; + _frameInfo = nullptr; - // TODO -/* -Video::AVIDecoder *decoder = new Video::AVIDecoder(); -decoder->ignoreSecondaryVideoTracks(); -_video = decoder; -_field14 = 1; - -if (!_video->loadFile(name.getString())) -error("Could not open video - %s", name.getString().c_str()); -*/ + _decoder = new Video::AVIDecoder(); + if (!_decoder->loadFile(key.getString())) + error("Could not open video - %s", key.getString().c_str()); } AVISurface::~AVISurface() { if (_videoSurface) _videoSurface->_blitStyleFlag = false; delete _frameInfo; + delete _decoder; } bool AVISurface::play(uint flags, CGameObject *obj) { diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index fc7db30391..546c2c475b 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -461,14 +461,40 @@ void OSVideoSurface::addMovieEvent(int frameNumber, CGameObject *obj) { _movie->addEvent(frameNumber, obj); } -void OSVideoSurface::proc39(int v1, int v2) { - warning("OSVideoSurface::proc39"); +void OSVideoSurface::setMovieFrameRate(double rate) { + if (_movie) + _movie->setFrameRate(rate); } const CMovieRangeInfoList *OSVideoSurface::getMovieRangeInfo() const { return _movie ? _movie->getMovieRangeInfo() : nullptr; } +void OSVideoSurface::flipVertically(bool needsLock) { + if (!loadIfReady() || !_blitStyleFlag) + return; + + if (needsLock) + lock(); + + byte lineBuffer[SCREEN_WIDTH * 2]; + int pitch = getBpp() * getWidth(); + assert(pitch < (SCREEN_WIDTH * 2)); + + for (int yp = 0; yp < (_rawSurface->h / 2); ++yp) { + byte *line1P = (byte *)_rawSurface->getBasePtr(0, yp); + byte *line2P = (byte *)_rawSurface->getBasePtr(0, _rawSurface->h - yp - 1); + + Common::copy(line1P, line1P + pitch, lineBuffer); + Common::copy(line2P, line2P + pitch, line1P); + Common::copy(lineBuffer, lineBuffer + pitch, line1P); + } + + _blitStyleFlag = false; + if (needsLock) + unlock(); +} + bool OSVideoSurface::loadIfReady() { _videoSurfaceNum = _videoSurfaceCounter; @@ -511,6 +537,10 @@ void OSVideoSurface::transPixelate() { unlock(); } +void *OSVideoSurface::dupMovieFrameInfo() const { + return _movie ? _movie->duplicateFrameInfo() : nullptr; +} + int OSVideoSurface::freeSurface() { if (!_ddSurface) return 0; diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index 3521be6336..c8cfb78cd4 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -224,13 +224,21 @@ public: */ virtual void addMovieEvent(int eventId, CGameObject *obj) = 0; - virtual void proc39(int v1, int v2) = 0; + /** + * Set the movie frame rate + */ + virtual void setMovieFrameRate(double rate) = 0; /** * Return any movie range info associated with the surface's movie */ virtual const CMovieRangeInfoList *getMovieRangeInfo() const = 0; + /** + * + */ + virtual void flipVertically(bool needsLock = true) = 0; + /** * Loads the surface's resource if there's one pending */ @@ -249,6 +257,11 @@ public: virtual bool proc45(); + /** + * Duplicates movie frame info + */ + virtual void *dupMovieFrameInfo() const = 0; + /** * Frees the underlying surface */ @@ -452,13 +465,21 @@ public: */ virtual void addMovieEvent(int frameNumber, CGameObject *obj); - virtual void proc39(int v1, int v2); + /** + * Set the movie frame rate + */ + virtual void setMovieFrameRate(double rate); /** * Return any movie range info associated with the surface's movie */ virtual const CMovieRangeInfoList *getMovieRangeInfo() const; + /** + * + */ + virtual void flipVertically(bool needsLock = true); + /** * Loads the surface's resource if there's one pending */ @@ -475,6 +496,12 @@ public: */ virtual void transPixelate(); + /** + * Duplicates movie frame info + */ + virtual void *dupMovieFrameInfo() const; + + /** * Frees the underlying surface */ -- cgit v1.2.3 From 62f2763bf794dfb711fd48e32d7c2162bdb5aed8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 10 Jul 2016 14:59:11 -0400 Subject: VIDEO: Respect RIFF filesize field when decoding AVI files Starship Titanic in particular needs this, since some of the videos have extra junk at the end of the file, such as ycursors.avi, and parsing fails if we don't respect the filesize field --- video/avi_decoder.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/video/avi_decoder.cpp b/video/avi_decoder.cpp index 52a55f600c..8f1bec4388 100644 --- a/video/avi_decoder.cpp +++ b/video/avi_decoder.cpp @@ -296,7 +296,7 @@ bool AVIDecoder::loadStream(Common::SeekableReadStream *stream) { return false; } - /* uint32 fileSize = */ stream->readUint32LE(); + uint32 fileSize = stream->readUint32LE(); uint32 riffType = stream->readUint32BE(); if (riffType != ID_AVI) { @@ -307,7 +307,7 @@ bool AVIDecoder::loadStream(Common::SeekableReadStream *stream) { _fileStream = stream; // Go through all chunks in the file - while (parseNextChunk()) + while (_fileStream->pos() < fileSize && parseNextChunk()) ; if (!_decodedHeader) { -- cgit v1.2.3 From 207e1cbb296c8f825d19167d420bbf141398ac1d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 10 Jul 2016 17:19:11 -0400 Subject: TITANIC: Remove old hard-coded video loading code from cursors loading --- engines/titanic/support/mouse_cursor.cpp | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/engines/titanic/support/mouse_cursor.cpp b/engines/titanic/support/mouse_cursor.cpp index be607a432f..496b1527fe 100644 --- a/engines/titanic/support/mouse_cursor.cpp +++ b/engines/titanic/support/mouse_cursor.cpp @@ -63,26 +63,10 @@ CMouseCursor::~CMouseCursor() { } void CMouseCursor::loadCursorImages() { - const CString name("ycursors.avi"); - g_vm->_filesManager->fn4(name); - - // WORKAROUND: We need to manipulate ycursors.avi file so it can be read - // by the ScummVM AVIDecoder, by removing the redundant second video track - Common::File f; - if (!f.open(name)) - error("Could not open cursors file"); - - // Read in the entire file - byte *movieData = (byte *)malloc(f.size()); - f.read(movieData, f.size()); - - if (READ_BE_UINT32(movieData + 254) == MKTAG('s', 't', 'r', 'h')) { - // Change the second video chunk to junk data so it gets ignored - WRITE_BE_UINT32(movieData + 254, MKTAG('J', 'U', 'N', 'K')); - WRITE_LE_UINT32(movieData + 258, 1128); - } + const CResourceKey key("ycursors.avi"); + g_vm->_filesManager->fn4(key.getString()); - // Iterate through each cursor + // Iterate through getting each cursor for (int idx = 0; idx < NUM_CURSORS; ++idx) { assert(CURSOR_DATA[idx][0] == (idx + 1)); _cursors[idx]._centroid = Common::Point(CURSOR_DATA[idx][2], @@ -91,16 +75,14 @@ void CMouseCursor::loadCursorImages() { // Create the surface CVideoSurface *surface = _screenManager->createSurface(64, 64); _cursors[idx]._videoSurface = surface; -/* - Common::SeekableReadStream *stream = new Common::MemoryReadStream( - movieData, f.size(), DisposeAfterUse::NO); - OSMovie movie(stream, surface); + + // Open the cursors video and move to the given frame + OSMovie movie(key, surface); movie.setFrame(idx); void *frameInfo = movie.duplicateFrameInfo(); _cursors[idx]._frameInfo = frameInfo; surface->setMovieFrameInfo(frameInfo); - */ } } -- cgit v1.2.3 From fa6e12aaab4e19424481fc26eab281663cbf3283 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 11 Jul 2016 19:39:53 -0400 Subject: VIDEO: Add support for a track filtering callback function This is needed for Starship Titanic, where videos can have a secondary video track. It was simpler to use the callback as a means to select one video track each across two decoders than trying to make VideoDecoder and/or AVIDecoder support decoding from multiple video tracks simultaneously --- video/avi_decoder.cpp | 20 ++++++++++++-------- video/avi_decoder.h | 10 ++++++++-- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/video/avi_decoder.cpp b/video/avi_decoder.cpp index 8f1bec4388..cb087c72fc 100644 --- a/video/avi_decoder.cpp +++ b/video/avi_decoder.cpp @@ -76,12 +76,13 @@ enum { }; -AVIDecoder::AVIDecoder(Audio::Mixer::SoundType soundType) : _frameRateOverride(0), _soundType(soundType) { +AVIDecoder::AVIDecoder(Audio::Mixer::SoundType soundType, SelectTrackFn trackFn) : + _frameRateOverride(0), _soundType(soundType), _selectTrackFn(trackFn) { initCommon(); } -AVIDecoder::AVIDecoder(const Common::Rational &frameRateOverride, Audio::Mixer::SoundType soundType) - : _frameRateOverride(frameRateOverride), _soundType(soundType) { +AVIDecoder::AVIDecoder(const Common::Rational &frameRateOverride, Audio::Mixer::SoundType soundType, + SelectTrackFn trackFn) : _frameRateOverride(frameRateOverride), _soundType(soundType), _selectTrackFn(trackFn) { initCommon(); } @@ -99,6 +100,7 @@ void AVIDecoder::initCommon() { _movieListStart = 0; _movieListEnd = 0; _fileStream = 0; + _videoTrackCounter = _audioTrackCounter = 0; memset(&_header, 0, sizeof(_header)); } @@ -263,7 +265,8 @@ void AVIDecoder::handleStreamHeader(uint32 size) { } } - addTrack(new AVIVideoTrack(_header.totalFrames, sHeader, bmInfo, initialPalette)); + if (!_selectTrackFn || _selectTrackFn(true, _videoTrackCounter++)) + addTrack(new AVIVideoTrack(_header.totalFrames, sHeader, bmInfo, initialPalette)); } else if (sHeader.streamType == ID_AUDS) { PCMWaveFormat wvInfo; wvInfo.tag = _fileStream->readUint16LE(); @@ -278,9 +281,11 @@ void AVIDecoder::handleStreamHeader(uint32 size) { if (wvInfo.channels == 2) sHeader.sampleSize /= 2; - AVIAudioTrack *track = createAudioTrack(sHeader, wvInfo); - track->createAudioStream(); - addTrack(track); + if (!_selectTrackFn || _selectTrackFn(false, _audioTrackCounter++)) { + AVIAudioTrack *track = createAudioTrack(sHeader, wvInfo); + track->createAudioStream(); + addTrack(track); + } } // Ensure that we're at the end of the chunk @@ -337,7 +342,6 @@ bool AVIDecoder::loadStream(Common::SeekableReadStream *stream) { } if (_videoTracks.size() != 1) { - warning("Unhandled AVI video track count: %d", _videoTracks.size()); close(); return false; } diff --git a/video/avi_decoder.h b/video/avi_decoder.h index 96d9e821ff..04e6a1847e 100644 --- a/video/avi_decoder.h +++ b/video/avi_decoder.h @@ -61,8 +61,10 @@ namespace Video { */ class AVIDecoder : public VideoDecoder { public: - AVIDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType); - AVIDecoder(const Common::Rational &frameRateOverride, Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType); + typedef bool(*SelectTrackFn)(bool isVideo, int trackNumber); + AVIDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType, SelectTrackFn trackFn = nullptr); + AVIDecoder(const Common::Rational &frameRateOverride, Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType, + SelectTrackFn trackFn = nullptr); virtual ~AVIDecoder(); bool loadStream(Common::SeekableReadStream *stream); @@ -268,6 +270,10 @@ protected: Audio::Mixer::SoundType _soundType; Common::Rational _frameRateOverride; + + int _videoTrackCounter, _audioTrackCounter; + SelectTrackFn _selectTrackFn; + void initCommon(); bool parseNextChunk(); -- cgit v1.2.3 From 8a6bba0fec0718f9c9fc9b69478b8aa6ff0bd791 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 11 Jul 2016 19:43:42 -0400 Subject: TITANIC: Change AVISurface to use a separate AVIDecoder for each video track --- engines/titanic/support/avi_surface.cpp | 70 +++++++++++++++++++++++++-------- engines/titanic/support/avi_surface.h | 2 +- 2 files changed, 55 insertions(+), 17 deletions(-) diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp index e371ccb812..96bd6f7a1b 100644 --- a/engines/titanic/support/avi_surface.cpp +++ b/engines/titanic/support/avi_surface.cpp @@ -26,6 +26,21 @@ namespace Titanic { +/** + * Track filter for AVIDecoder that filters out any secondary video track + */ +static bool primaryTrackSelect(bool isVideo, int trackCounter) { + return !isVideo || trackCounter == 0; +} + +/** + * Track filter for AVIDecoder that only accepts the secondary video track + * for a video, if present + */ +static bool secondaryTrackSelect(bool isVideo, int trackCounter) { + return isVideo && trackCounter > 0; +} + AVISurface::AVISurface(const CResourceKey &key) { _videoSurface = nullptr; _field4 = 0; @@ -34,24 +49,35 @@ AVISurface::AVISurface(const CResourceKey &key) { _priorFrame = 0; _streamCount = 0; _frameInfo = nullptr; + _isPlaying = false; - _decoder = new Video::AVIDecoder(); - if (!_decoder->loadFile(key.getString())) + // Create a decoder for the audio (if any) and primary video track + _decoders[0] = new Video::AVIDecoder(Audio::Mixer::kPlainSoundType, primaryTrackSelect); + if (!_decoders[0]->loadFile(key.getString())) error("Could not open video - %s", key.getString().c_str()); + + // Create a decoder for any secondary video track + Video::AVIDecoder *decoder2 = new Video::AVIDecoder(Audio::Mixer::kPlainSoundType, secondaryTrackSelect); + if (decoder2->loadFile(key.getString())) { + _decoders[1] = decoder2; + } else { + delete decoder2; + } } AVISurface::~AVISurface() { if (_videoSurface) _videoSurface->_blitStyleFlag = false; delete _frameInfo; - delete _decoder; + delete _decoders[0]; + delete _decoders[1]; } bool AVISurface::play(uint flags, CGameObject *obj) { if (flags & MOVIE_REVERSE) - return play(_decoder->getFrameCount() - 1, 0, flags, obj); + return play(_decoders[0]->getFrameCount() - 1, 0, flags, obj); else - return play(0, _decoder->getFrameCount() - 1, flags, obj); + return play(0, _decoders[0]->getFrameCount() - 1, flags, obj); } bool AVISurface::play(int startFrame, int endFrame, uint flags, CGameObject *obj) { @@ -90,7 +116,10 @@ bool AVISurface::play(int startFrame, int endFrame, int initialFrame, uint flags void AVISurface::stop() { _isPlaying = false; - _decoder->stop(); + _decoders[0]->stop(); + if (_decoders[1]) + _decoders[1]->stop(); + _movieRangeInfo.destroyContents(); } @@ -110,7 +139,10 @@ bool AVISurface::changeFrame(int frameNumber) { } void AVISurface::seekToFrame(uint frameNumber) { - _decoder->seekToFrame(frameNumber); + _decoders[0]->seekToFrame(frameNumber); + if (_decoders[1]) + _decoders[1]->seekToFrame(frameNumber); + _priorFrame = frameNumber; } @@ -159,11 +191,11 @@ void AVISurface::setVideoSurface(CVideoSurface *surface) { } uint AVISurface::getWidth() const { - return _decoder->getWidth(); + return _decoders[0]->getWidth(); } uint AVISurface::getHeight() const { - return _decoder->getHeight(); + return _decoders[0]->getHeight(); } void AVISurface::setFrame(int frameNumber) { @@ -172,26 +204,32 @@ void AVISurface::setFrame(int frameNumber) { stop(); // Ensure the frame number is valid - if (frameNumber >= _decoder->getFrameCount()) - frameNumber = _decoder->getFrameCount() - 1; + if (frameNumber >= _decoders[0]->getFrameCount()) + frameNumber = _decoders[0]->getFrameCount() - 1; seekToFrame(frameNumber); renderFrame(); } int AVISurface::getFrame() const { - return _decoder->getCurFrame(); + return _decoders[0]->getCurFrame(); } bool AVISurface::renderFrame() { - // Check there's a frame ready for + // Check there's a frame ready for display assert(_videoSurface); - if (!_decoder->needsUpdate()) + if (!_decoders[0]->needsUpdate() || (_decoders[1] && !_decoders[1]->needsUpdate())) return false; // Get the frame to render, and draw it on the surface - const Graphics::Surface *frame = _decoder->decodeNextFrame(); - _videoSurface->blitFrom(Point(0, 0), frame); + // TODO: Handle transparency + for (int idx = 0; idx < 2; ++idx) { + if (_decoders[idx]) { + const Graphics::Surface *frame = _decoders[idx]->decodeNextFrame(); + _videoSurface->blitFrom(Point(0, 0), frame); + } + } + return false; } diff --git a/engines/titanic/support/avi_surface.h b/engines/titanic/support/avi_surface.h index fe3e972b07..f3722ca513 100644 --- a/engines/titanic/support/avi_surface.h +++ b/engines/titanic/support/avi_surface.h @@ -39,7 +39,7 @@ enum MovieFlag { class AVISurface { private: - Video::AVIDecoder *_decoder; + Video::AVIDecoder *_decoders[2]; CVideoSurface *_videoSurface; int _field4; int _field8; -- cgit v1.2.3 From bb2d290dcaae8d29f56066ac92330c59862012a7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 11 Jul 2016 21:49:11 -0400 Subject: VIDEO: Handle STRN chunks in AVI file streams to set stream name --- video/avi_decoder.cpp | 51 ++++++++++++++++++++++++++++++++++++++++++--------- video/avi_decoder.h | 15 +++++++++++++++ 2 files changed, 57 insertions(+), 9 deletions(-) diff --git a/video/avi_decoder.cpp b/video/avi_decoder.cpp index cb087c72fc..44f8ade933 100644 --- a/video/avi_decoder.cpp +++ b/video/avi_decoder.cpp @@ -101,6 +101,7 @@ void AVIDecoder::initCommon() { _movieListEnd = 0; _fileStream = 0; _videoTrackCounter = _audioTrackCounter = 0; + _lastAddedTrack = nullptr; memset(&_header, 0, sizeof(_header)); } @@ -147,10 +148,12 @@ bool AVIDecoder::parseNextChunk() { case ID_JUNQ: // Same as JUNK, safe to ignore case ID_ISFT: // Metadata, safe to ignore case ID_DISP: // Metadata, should be safe to ignore - case ID_STRN: // Metadata, safe to ignore case ID_DMLH: // OpenDML extension, contains an extra total frames field, safe to ignore skipChunk(size); break; + case ID_STRN: // Metadata, safe to ignore + readStreamName(size); + break; case ID_IDX1: readOldIndex(size); break; @@ -265,8 +268,7 @@ void AVIDecoder::handleStreamHeader(uint32 size) { } } - if (!_selectTrackFn || _selectTrackFn(true, _videoTrackCounter++)) - addTrack(new AVIVideoTrack(_header.totalFrames, sHeader, bmInfo, initialPalette)); + addTrack(new AVIVideoTrack(_header.totalFrames, sHeader, bmInfo, initialPalette)); } else if (sHeader.streamType == ID_AUDS) { PCMWaveFormat wvInfo; wvInfo.tag = _fileStream->readUint16LE(); @@ -281,17 +283,48 @@ void AVIDecoder::handleStreamHeader(uint32 size) { if (wvInfo.channels == 2) sHeader.sampleSize /= 2; - if (!_selectTrackFn || _selectTrackFn(false, _audioTrackCounter++)) { - AVIAudioTrack *track = createAudioTrack(sHeader, wvInfo); - track->createAudioStream(); - addTrack(track); - } + AVIAudioTrack *track = createAudioTrack(sHeader, wvInfo); + track->createAudioStream(); + addTrack(track); } // Ensure that we're at the end of the chunk _fileStream->seek(startPos + strfSize); } +void AVIDecoder::addTrack(Track *track, bool isExternal) { + if (!_selectTrackFn || + (dynamic_cast(track) && _selectTrackFn(true, _videoTrackCounter++)) || + (dynamic_cast(track) && _selectTrackFn(false, _audioTrackCounter++))) { + VideoDecoder::addTrack(track, isExternal); + _lastAddedTrack = track; + } else { + _lastAddedTrack = nullptr; + } +} + +void AVIDecoder::readStreamName(uint32 size) { + if (!_lastAddedTrack) { + skipChunk(size); + } else { + // Get in the name + assert(size > 0 && size < 64); + char buffer[64]; + _fileStream->read(buffer, size); + if (size & 1) + _fileStream->skip(1); + + // Apply it to the most recently read stream + assert(_lastAddedTrack); + AVIVideoTrack *vidTrack = dynamic_cast(_lastAddedTrack); + AVIAudioTrack *audTrack = dynamic_cast(_lastAddedTrack); + if (vidTrack) + vidTrack->getName() = Common::String(buffer); + else if (audTrack) + audTrack->getName() = Common::String(buffer); + } +} + bool AVIDecoder::loadStream(Common::SeekableReadStream *stream) { close(); @@ -301,7 +334,7 @@ bool AVIDecoder::loadStream(Common::SeekableReadStream *stream) { return false; } - uint32 fileSize = stream->readUint32LE(); + int32 fileSize = stream->readUint32LE(); uint32 riffType = stream->readUint32BE(); if (riffType != ID_AVI) { diff --git a/video/avi_decoder.h b/video/avi_decoder.h index 04e6a1847e..8b9fcbd9a3 100644 --- a/video/avi_decoder.h +++ b/video/avi_decoder.h @@ -83,6 +83,16 @@ protected: bool supportsAudioTrackSwitching() const { return true; } AudioTrack *getAudioTrack(int index); + /** + * Define a track to be used by this class. + * + * The pointer is then owned by this base class. + * + * @param track The track to add + * @param isExternal Is this an external track not found by loadStream()? + */ + void addTrack(Track *track, bool isExternal = false); + struct BitmapInfoHeader { uint32 size; uint32 width; @@ -166,6 +176,7 @@ protected: uint32 quality; uint32 sampleSize; Common::Rect frame; + Common::String name; }; class AVIVideoTrack : public FixedRateVideoTrack { @@ -181,6 +192,7 @@ protected: Graphics::PixelFormat getPixelFormat() const; int getCurFrame() const { return _curFrame; } int getFrameCount() const { return _frameCount; } + Common::String &getName() { return _vidsHeader.name; } const Graphics::Surface *decodeNextFrame() { return _lastFrame; } const byte *getPalette() const; @@ -224,6 +236,7 @@ protected: void skipAudio(const Audio::Timestamp &time, const Audio::Timestamp &frameTime); virtual void resetStream(); uint32 getCurChunk() const { return _curChunk; } + Common::String &getName() { return _audsHeader.name; } void setCurChunk(uint32 chunk) { _curChunk = chunk; } bool isRewindable() const { return true; } @@ -272,6 +285,7 @@ protected: Common::Rational _frameRateOverride; int _videoTrackCounter, _audioTrackCounter; + Track *_lastAddedTrack; SelectTrackFn _selectTrackFn; void initCommon(); @@ -280,6 +294,7 @@ protected: void skipChunk(uint32 size); void handleList(uint32 listSize); void handleStreamHeader(uint32 size); + void readStreamName(uint32 size); uint16 getStreamType(uint32 tag) const { return tag & 0xFFFF; } byte getStreamIndex(uint32 tag) const; void checkTruemotion1(); -- cgit v1.2.3 From c458c3c9b740602002cd0a130a99af8b10402806 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 11 Jul 2016 21:52:57 -0400 Subject: TITANIC: Fix warnings in AVISurface --- engines/titanic/support/avi_surface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp index 96bd6f7a1b..7f2cd3cc47 100644 --- a/engines/titanic/support/avi_surface.cpp +++ b/engines/titanic/support/avi_surface.cpp @@ -108,7 +108,7 @@ bool AVISurface::play(int startFrame, int endFrame, int initialFrame, uint flags _movieRangeInfo.push_back(info); if (_movieRangeInfo.size() == 1) { - changeFrame(initialFrame); + return changeFrame(initialFrame); } else { return true; } @@ -204,7 +204,7 @@ void AVISurface::setFrame(int frameNumber) { stop(); // Ensure the frame number is valid - if (frameNumber >= _decoders[0]->getFrameCount()) + if (frameNumber >= (int)_decoders[0]->getFrameCount()) frameNumber = _decoders[0]->getFrameCount() - 1; seekToFrame(frameNumber); -- cgit v1.2.3 From 513723c82d5db078236421577924bd9cde29b99b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 12 Jul 2016 08:38:26 -0400 Subject: TITANIC: Making the AVISurface frameInfo a video surface --- engines/titanic/core/game_object.cpp | 2 +- engines/titanic/game_view.cpp | 2 +- engines/titanic/support/avi_surface.cpp | 65 +++++++++++++++++++++++++------ engines/titanic/support/avi_surface.h | 32 ++++++++++----- engines/titanic/support/mouse_cursor.cpp | 11 ++++-- engines/titanic/support/mouse_cursor.h | 6 +-- engines/titanic/support/movie.cpp | 10 ++--- engines/titanic/support/movie.h | 6 +-- engines/titanic/support/video_surface.cpp | 34 +++++++++------- engines/titanic/support/video_surface.h | 24 ++++++------ 10 files changed, 129 insertions(+), 63 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index eeb765e40f..f0f0980181 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -275,7 +275,7 @@ bool CGameObject::checkPoint(const Point &pt, bool ignore40, bool visibleOnly) { } Common::Point pixelPos = pt - _bounds; - if (_surface->_blitStyleFlag) { + if (_surface->_transBlitFlag) { pixelPos.y = ((_bounds.height() - _bounds.top) / 2) * 2 - pixelPos.y; } diff --git a/engines/titanic/game_view.cpp b/engines/titanic/game_view.cpp index 2f0e74ac08..9bc95511ca 100644 --- a/engines/titanic/game_view.cpp +++ b/engines/titanic/game_view.cpp @@ -57,7 +57,7 @@ void CGameView::createSurface(const CResourceKey &key) { // Create a fresh surface CScreenManager::setCurrent(); _surface = CScreenManager::_currentScreenManagerPtr->createSurface(key); - _surface->_blitFlag = true; + _surface->_fastBlitFlag = true; } void CGameView::drawView() { diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp index 7f2cd3cc47..85590f1d1e 100644 --- a/engines/titanic/support/avi_surface.cpp +++ b/engines/titanic/support/avi_surface.cpp @@ -21,11 +21,20 @@ */ #include "titanic/support/avi_surface.h" +#include "titanic/support/screen_manager.h" #include "titanic/support/video_surface.h" #include "video/avi_decoder.h" namespace Titanic { +Video::AVIDecoder::AVIVideoTrack &AVIDecoder::getVideoTrack() { + for (TrackListIterator it = getTrackListBegin(); it != getTrackListEnd(); it++) + if ((*it)->getTrackType() == Track::kTrackTypeVideo) + return *static_cast(*it); + + error("Could not find video track"); +} + /** * Track filter for AVIDecoder that filters out any secondary video track */ @@ -43,21 +52,19 @@ static bool secondaryTrackSelect(bool isVideo, int trackCounter) { AVISurface::AVISurface(const CResourceKey &key) { _videoSurface = nullptr; - _field4 = 0; - _field8 = 0; _currentPos = 0; _priorFrame = 0; _streamCount = 0; - _frameInfo = nullptr; + _movieFrameSurface[0] = _movieFrameSurface[1] = nullptr; _isPlaying = false; // Create a decoder for the audio (if any) and primary video track - _decoders[0] = new Video::AVIDecoder(Audio::Mixer::kPlainSoundType, primaryTrackSelect); + _decoders[0] = new AVIDecoder(Audio::Mixer::kPlainSoundType, primaryTrackSelect); if (!_decoders[0]->loadFile(key.getString())) error("Could not open video - %s", key.getString().c_str()); // Create a decoder for any secondary video track - Video::AVIDecoder *decoder2 = new Video::AVIDecoder(Audio::Mixer::kPlainSoundType, secondaryTrackSelect); + AVIDecoder *decoder2 = new AVIDecoder(Audio::Mixer::kPlainSoundType, secondaryTrackSelect); if (decoder2->loadFile(key.getString())) { _decoders[1] = decoder2; } else { @@ -67,8 +74,9 @@ AVISurface::AVISurface(const CResourceKey &key) { AVISurface::~AVISurface() { if (_videoSurface) - _videoSurface->_blitStyleFlag = false; - delete _frameInfo; + _videoSurface->_transBlitFlag = false; + delete _movieFrameSurface[0]; + delete _movieFrameSurface[1]; delete _decoders[0]; delete _decoders[1]; } @@ -187,7 +195,37 @@ bool AVISurface::handleEvents(CMovieEventList &events) { void AVISurface::setVideoSurface(CVideoSurface *surface) { _videoSurface = surface; - warning("TODO: Get video track list from video decoder"); + // Handling for secondary video stream + if (_decoders[1]) { + const Common::String &streamName = _decoders[1]->getVideoTrack().getName(); + + if (streamName == "mask0") { + _videoSurface->_transparencyMode = TRANS_MASK0; + } else if (streamName == "mask255") { + _videoSurface->_transparencyMode = TRANS_MASK255; + } else if (streamName == "alpha0") { + _videoSurface->_transparencyMode = TRANS_ALPHA0; + } else if (streamName == "alpha255") { + _videoSurface->_transparencyMode = TRANS_ALPHA255; + } + } + + setupDecompressor(); +} + +void AVISurface::setupDecompressor() { + for (int idx = 0; idx < 2; ++idx) { + if (!_decoders[idx]) + continue; + AVIDecoder &decoder = *_decoders[idx]; + + // Setup frame surface + _movieFrameSurface[idx] = CScreenManager::_screenManagerPtr->createSurface(decoder.getWidth(), decoder.getHeight()); + + // TODO: See whether this simplified form of original works + if (idx == 2) + _videoSurface->_transBlitFlag = true; + } } uint AVISurface::getWidth() const { @@ -260,9 +298,14 @@ void AVISurface::setFrameRate(double rate) { } } -void *AVISurface::duplicateFrameInfo() const { - // TODO - return nullptr; +CVideoSurface *AVISurface::getSecondarySurface() { + return _streamCount <= 1 ? nullptr : _movieFrameSurface[1]; +} + +CVideoSurface *AVISurface::duplicateSecondaryFrame() const { + // TODO: Make this cleaner + OSVideoSurface *src = dynamic_cast(_movieFrameSurface[1]); + return new OSVideoSurface(*src); } } // End of namespace Titanic diff --git a/engines/titanic/support/avi_surface.h b/engines/titanic/support/avi_surface.h index f3722ca513..62fc5172c9 100644 --- a/engines/titanic/support/avi_surface.h +++ b/engines/titanic/support/avi_surface.h @@ -37,22 +37,35 @@ enum MovieFlag { MOVIE_REVERSE = 8, MOVIE_GAMESTATE = 0x10 }; +class AVIDecoder : public Video::AVIDecoder { +public: + AVIDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType, SelectTrackFn trackFn = nullptr) : + Video::AVIDecoder(soundType, trackFn) {} + AVIDecoder(const Common::Rational &frameRateOverride, Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType, + SelectTrackFn trackFn = nullptr) : Video::AVIDecoder(frameRateOverride, soundType, trackFn) {} + + Video::AVIDecoder::AVIVideoTrack &getVideoTrack(); +}; + class AVISurface { private: - Video::AVIDecoder *_decoders[2]; + AVIDecoder *_decoders[2]; CVideoSurface *_videoSurface; - int _field4; - int _field8; int _currentPos; int _priorFrame; CMovieRangeInfoList _movieRangeInfo; int _streamCount; - void *_frameInfo; + CVideoSurface *_movieFrameSurface[2]; private: /** * Render a frame to the video surface */ bool renderFrame(); + + /** + * Sets up for video decompression + */ + void setupDecompressor(); protected: /** * Change the frame with ??? checking @@ -132,9 +145,10 @@ public: */ void setFrameRate(double rate); - const void *getFrameInfo() const { - return _streamCount <= 1 ? nullptr : _frameInfo; - } + /** + * Returns the surface for the secondary video track frame, if present + */ + CVideoSurface *getSecondarySurface(); /** * Get a reference to the movie range info list @@ -144,9 +158,9 @@ public: } /** - * Duplicate the frame info + * Duplicates the secondary frame, if the movie has a second video track */ - void *duplicateFrameInfo() const; + CVideoSurface *duplicateSecondaryFrame() const; }; } // End of namespace Titanic diff --git a/engines/titanic/support/mouse_cursor.cpp b/engines/titanic/support/mouse_cursor.cpp index 496b1527fe..628211c7f1 100644 --- a/engines/titanic/support/mouse_cursor.cpp +++ b/engines/titanic/support/mouse_cursor.cpp @@ -50,6 +50,11 @@ static const int CURSOR_DATA[NUM_CURSORS][4] = { { 15, 138, 20, 28 } }; +CMouseCursor::CursorEntry::~CursorEntry() { + delete _videoSurface; + delete _frameSurface; +} + CMouseCursor::CMouseCursor(CScreenManager *screenManager) : _screenManager(screenManager), _cursorId(CURSOR_HOURGLASS), _setCursorCount(0), _fieldE4(0), _fieldE8(0) { @@ -80,9 +85,9 @@ void CMouseCursor::loadCursorImages() { OSMovie movie(key, surface); movie.setFrame(idx); - void *frameInfo = movie.duplicateFrameInfo(); - _cursors[idx]._frameInfo = frameInfo; - surface->setMovieFrameInfo(frameInfo); + CVideoSurface *frameSurface = movie.duplicateFrame(); + _cursors[idx]._frameSurface = frameSurface; + surface->setMovieFrameSurface(frameSurface); } } diff --git a/engines/titanic/support/mouse_cursor.h b/engines/titanic/support/mouse_cursor.h index f674ccd23d..f6ab92dca7 100644 --- a/engines/titanic/support/mouse_cursor.h +++ b/engines/titanic/support/mouse_cursor.h @@ -54,11 +54,11 @@ class CVideoSurface; class CMouseCursor { struct CursorEntry { CVideoSurface *_videoSurface; - void *_frameInfo; + CVideoSurface *_frameSurface; Common::Point _centroid; - CursorEntry() : _videoSurface(nullptr), _frameInfo(nullptr) {} - ~CursorEntry() { delete _frameInfo; } + CursorEntry() : _videoSurface(nullptr), _frameSurface(nullptr) {} + ~CursorEntry(); }; private: CScreenManager *_screenManager; diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index fc31750508..495cf7c2a7 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -159,7 +159,7 @@ void OSMovie::addEvent(int frameNumber, CGameObject *obj) { void OSMovie::setFrame(uint frameNumber) { _aviSurface.setFrame(frameNumber); - _videoSurface->setMovieFrame(frameNumber); + _videoSurface->setMovieFrameSurface(_aviSurface.getSecondarySurface()); } bool OSMovie::handleEvents(CMovieEventList &events) { @@ -175,12 +175,12 @@ bool OSMovie::handleEvents(CMovieEventList &events) { _frameTime1 += _frameTime2; _aviSurface.handleEvents(events); - _videoSurface->setMovieFrameInfo(_aviSurface.getFrameInfo()); + _videoSurface->setMovieFrameSurface(_aviSurface.getSecondarySurface()); if (_field14) { while (_frameTime1 >= time && events.empty()) { _aviSurface.handleEvents(events); - _videoSurface->setMovieFrameInfo(_aviSurface.getFrameInfo()); + _videoSurface->setMovieFrameSurface(_aviSurface.getSecondarySurface()); _frameTime1 += _frameTime2; } @@ -217,8 +217,8 @@ void OSMovie::setFrameRate(double rate) { _aviSurface.setFrameRate(rate); } -void *OSMovie::duplicateFrameInfo() const { - return _aviSurface.duplicateFrameInfo(); +CVideoSurface *OSMovie::duplicateFrame() const { + return _aviSurface.duplicateSecondaryFrame(); } } // End of namespace Titanic diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index 8034bd4032..f9e368606c 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -133,9 +133,9 @@ public: virtual void setFrameRate(double rate) = 0; /** - * Creates a duplicate of the frame info + * Creates a duplicate of the movie's frame */ - virtual void *duplicateFrameInfo() const = 0; + virtual CVideoSurface *duplicateFrame() const = 0; /** * Removes the movie from the list of currently playing movies @@ -233,7 +233,7 @@ public: /** * Creates a duplicate of the frame info */ - virtual void *duplicateFrameInfo() const; + virtual CVideoSurface *duplicateFrame() const; }; } // End of namespace Titanic diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index 546c2c475b..3e6e93abf1 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -31,8 +31,8 @@ int CVideoSurface::_videoSurfaceCounter = 0; CVideoSurface::CVideoSurface(CScreenManager *screenManager) : _screenManager(screenManager), _rawSurface(nullptr), _movie(nullptr), - _pendingLoad(false), _blitStyleFlag(false), _blitFlag(false), - _movieFrameInfo(nullptr), _transparencyMode(TRANS_DEFAULT), _field48(0), _field50(1) { + _pendingLoad(false), _transBlitFlag(false), _fastBlitFlag(false), + _movieFrameSurface(nullptr), _transparencyMode(TRANS_DEFAULT), _field48(0), _field50(1) { _videoSurfaceNum = _videoSurfaceCounter++; } @@ -52,10 +52,10 @@ void CVideoSurface::blitFrom(const Point &destPos, CVideoSurface *src, const Rec Rect srcBounds, destBounds; clipBounds(srcBounds, destBounds, src, srcRect, &destPos); - if (_blitStyleFlag) - blitRect2(srcBounds, destBounds, src); + if (_transBlitFlag) + transBlitRect(srcBounds, destBounds, src); else - blitRect1(srcBounds, destBounds, src); + blitRect(srcBounds, destBounds, src); } } @@ -128,21 +128,25 @@ void CVideoSurface::clipBounds(Rect &srcRect, Rect &destRect, error("Invalid rect"); } -void CVideoSurface::blitRect1(const Rect &srcRect, const Rect &destRect, CVideoSurface *src) { +void CVideoSurface::blitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src) { src->lock(); lock(); - // TODO: Do it like the original does it - _rawSurface->transBlitFrom(*src->_rawSurface, srcRect, destRect, - getTransparencyColor()); + if (_fastBlitFlag) { + _rawSurface->transBlitFrom(*src->_rawSurface, srcRect, destRect, + getTransparencyColor()); + return; + } + + // TODO src->unlock(); unlock(); } -void CVideoSurface::blitRect2(const Rect &srcRect, const Rect &destRect, CVideoSurface *src) { +void CVideoSurface::transBlitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src) { // TODO: Do it like the original does it - blitRect1(srcRect, destRect, src); + blitRect(srcRect, destRect, src); } uint CVideoSurface::getTransparencyColor() { @@ -471,7 +475,7 @@ const CMovieRangeInfoList *OSVideoSurface::getMovieRangeInfo() const { } void OSVideoSurface::flipVertically(bool needsLock) { - if (!loadIfReady() || !_blitStyleFlag) + if (!loadIfReady() || !_transBlitFlag) return; if (needsLock) @@ -490,7 +494,7 @@ void OSVideoSurface::flipVertically(bool needsLock) { Common::copy(lineBuffer, lineBuffer + pitch, line1P); } - _blitStyleFlag = false; + _transBlitFlag = false; if (needsLock) unlock(); } @@ -537,8 +541,8 @@ void OSVideoSurface::transPixelate() { unlock(); } -void *OSVideoSurface::dupMovieFrameInfo() const { - return _movie ? _movie->duplicateFrameInfo() : nullptr; +CVideoSurface *OSVideoSurface::dupMovieFrame() const { + return _movie ? _movie->duplicateFrame() : nullptr; } int OSVideoSurface::freeSurface() { diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index c8cfb78cd4..254745805e 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -54,15 +54,15 @@ private: void clipBounds(Rect &srcRect, Rect &destRect, CVideoSurface *srcSurface, const Rect *subRect = nullptr, const Point *destPos = nullptr); - void blitRect1(const Rect &srcRect, const Rect &destRect, CVideoSurface *src); - void blitRect2(const Rect &srcRect, const Rect &destRect, CVideoSurface *src); + void blitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src); + void transBlitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src); protected: static int _videoSurfaceCounter; protected: CScreenManager *_screenManager; Graphics::ManagedSurface *_rawSurface; bool _pendingLoad; - const void *_movieFrameInfo; + CVideoSurface *_movieFrameSurface; int _field48; int _videoSurfaceNum; int _field50; @@ -70,8 +70,8 @@ protected: public: CMovie *_movie; DirectDrawSurface *_ddSurface; - bool _blitFlag; - bool _blitStyleFlag; + bool _fastBlitFlag; + bool _transBlitFlag; CResourceKey _resourceKey; TransparencyMode _transparencyMode; public: @@ -258,9 +258,9 @@ public: virtual bool proc45(); /** - * Duplicates movie frame info - */ - virtual void *dupMovieFrameInfo() const = 0; + * Duplicates movie frame surface + */ + virtual CVideoSurface *dupMovieFrame() const = 0; /** * Frees the underlying surface @@ -285,11 +285,11 @@ public: /** * */ - void setMovieFrameInfo(const void *frameInfo) { _movieFrameInfo = frameInfo; } + void setMovieFrameSurface(CVideoSurface *frameSurface) { _movieFrameSurface = frameSurface; } /** */ - const void *getMovieFrameInfo() const { return _movieFrameInfo; } + CVideoSurface *getMovieFrameSurface() const { return _movieFrameSurface; } /** * Get the pixels associated with the surface. Only valid when the @@ -497,9 +497,9 @@ public: virtual void transPixelate(); /** - * Duplicates movie frame info + * Duplicates movie frame surface */ - virtual void *dupMovieFrameInfo() const; + virtual CVideoSurface *dupMovieFrame() const; /** -- cgit v1.2.3 From 6b250453f90a399b76d373ae9205b1bb985f8e46 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 12 Jul 2016 17:35:48 -0400 Subject: TITANIC: Further implementation of movie frame decoding --- engines/titanic/support/avi_surface.cpp | 40 ++++++++++++++++++++++++------- engines/titanic/support/avi_surface.h | 7 +++--- engines/titanic/support/mouse_cursor.cpp | 2 +- engines/titanic/support/mouse_cursor.h | 3 ++- engines/titanic/support/movie.cpp | 2 +- engines/titanic/support/movie.h | 4 ++-- engines/titanic/support/video_surface.cpp | 2 +- engines/titanic/support/video_surface.h | 20 +++++++++++----- 8 files changed, 56 insertions(+), 24 deletions(-) diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp index 85590f1d1e..ca6a09ade2 100644 --- a/engines/titanic/support/avi_surface.cpp +++ b/engines/titanic/support/avi_surface.cpp @@ -23,6 +23,8 @@ #include "titanic/support/avi_surface.h" #include "titanic/support/screen_manager.h" #include "titanic/support/video_surface.h" +#include "common/system.h" +#include "graphics/pixelformat.h" #include "video/avi_decoder.h" namespace Titanic { @@ -220,7 +222,8 @@ void AVISurface::setupDecompressor() { AVIDecoder &decoder = *_decoders[idx]; // Setup frame surface - _movieFrameSurface[idx] = CScreenManager::_screenManagerPtr->createSurface(decoder.getWidth(), decoder.getHeight()); + _movieFrameSurface[idx] = new Graphics::ManagedSurface(decoder.getWidth(), decoder.getHeight(), + g_system->getScreenFormat()); // TODO: See whether this simplified form of original works if (idx == 2) @@ -259,15 +262,29 @@ bool AVISurface::renderFrame() { if (!_decoders[0]->needsUpdate() || (_decoders[1] && !_decoders[1]->needsUpdate())) return false; - // Get the frame to render, and draw it on the surface - // TODO: Handle transparency + // Decode each decoder's video stream into the appropriate surface for (int idx = 0; idx < 2; ++idx) { if (_decoders[idx]) { const Graphics::Surface *frame = _decoders[idx]->decodeNextFrame(); - _videoSurface->blitFrom(Point(0, 0), frame); + + if (_movieFrameSurface[idx]->format == frame->format) { + _movieFrameSurface[idx]->blitFrom(*frame); + } else { + // Format mis-match, so we need to convert the frame + Graphics::Surface *s = frame->convertTo(_movieFrameSurface[idx]->format, + _decoders[idx]->getPalette()); + _movieFrameSurface[idx]->blitFrom(*s); + s->free(); + delete s; + } } } + // Blit the primary video frame onto the main overall surface + _videoSurface->lock(); + _videoSurface->getRawSurface()->blitFrom(*_movieFrameSurface[0]); + _videoSurface->unlock(); + return false; } @@ -298,14 +315,19 @@ void AVISurface::setFrameRate(double rate) { } } -CVideoSurface *AVISurface::getSecondarySurface() { +Graphics::ManagedSurface *AVISurface::getSecondarySurface() { return _streamCount <= 1 ? nullptr : _movieFrameSurface[1]; } -CVideoSurface *AVISurface::duplicateSecondaryFrame() const { - // TODO: Make this cleaner - OSVideoSurface *src = dynamic_cast(_movieFrameSurface[1]); - return new OSVideoSurface(*src); +Graphics::ManagedSurface *AVISurface::duplicateSecondaryFrame() const { + if (_streamCount <= 1) { + return nullptr; + } else { + Graphics::ManagedSurface *dest = new Graphics::ManagedSurface(_movieFrameSurface[1]->w, + _movieFrameSurface[1]->h, _movieFrameSurface[1]->format); + dest->blitFrom(*_movieFrameSurface[1]); + return dest; + } } } // End of namespace Titanic diff --git a/engines/titanic/support/avi_surface.h b/engines/titanic/support/avi_surface.h index 62fc5172c9..f74f6a808e 100644 --- a/engines/titanic/support/avi_surface.h +++ b/engines/titanic/support/avi_surface.h @@ -24,6 +24,7 @@ #define TITANIC_AVI_SURFACE_H #include "video/avi_decoder.h" +#include "graphics/managed_surface.h" #include "titanic/core/resource_key.h" #include "titanic/support/movie_range_info.h" @@ -55,7 +56,7 @@ private: int _priorFrame; CMovieRangeInfoList _movieRangeInfo; int _streamCount; - CVideoSurface *_movieFrameSurface[2]; + Graphics::ManagedSurface *_movieFrameSurface[2]; private: /** * Render a frame to the video surface @@ -148,7 +149,7 @@ public: /** * Returns the surface for the secondary video track frame, if present */ - CVideoSurface *getSecondarySurface(); + Graphics::ManagedSurface *getSecondarySurface(); /** * Get a reference to the movie range info list @@ -160,7 +161,7 @@ public: /** * Duplicates the secondary frame, if the movie has a second video track */ - CVideoSurface *duplicateSecondaryFrame() const; + Graphics::ManagedSurface *duplicateSecondaryFrame() const; }; } // End of namespace Titanic diff --git a/engines/titanic/support/mouse_cursor.cpp b/engines/titanic/support/mouse_cursor.cpp index 628211c7f1..5694d83dc6 100644 --- a/engines/titanic/support/mouse_cursor.cpp +++ b/engines/titanic/support/mouse_cursor.cpp @@ -85,7 +85,7 @@ void CMouseCursor::loadCursorImages() { OSMovie movie(key, surface); movie.setFrame(idx); - CVideoSurface *frameSurface = movie.duplicateFrame(); + Graphics::ManagedSurface *frameSurface = movie.duplicateFrame(); _cursors[idx]._frameSurface = frameSurface; surface->setMovieFrameSurface(frameSurface); } diff --git a/engines/titanic/support/mouse_cursor.h b/engines/titanic/support/mouse_cursor.h index f6ab92dca7..7a81ad43fa 100644 --- a/engines/titanic/support/mouse_cursor.h +++ b/engines/titanic/support/mouse_cursor.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "common/rect.h" +#include "graphics/managed_surface.h" namespace Titanic { @@ -54,7 +55,7 @@ class CVideoSurface; class CMouseCursor { struct CursorEntry { CVideoSurface *_videoSurface; - CVideoSurface *_frameSurface; + Graphics::ManagedSurface *_frameSurface; Common::Point _centroid; CursorEntry() : _videoSurface(nullptr), _frameSurface(nullptr) {} diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index 495cf7c2a7..b98a5b57a1 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -217,7 +217,7 @@ void OSMovie::setFrameRate(double rate) { _aviSurface.setFrameRate(rate); } -CVideoSurface *OSMovie::duplicateFrame() const { +Graphics::ManagedSurface *OSMovie::duplicateFrame() const { return _aviSurface.duplicateSecondaryFrame(); } diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index f9e368606c..b6c2a09667 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -135,7 +135,7 @@ public: /** * Creates a duplicate of the movie's frame */ - virtual CVideoSurface *duplicateFrame() const = 0; + virtual Graphics::ManagedSurface *duplicateFrame() const = 0; /** * Removes the movie from the list of currently playing movies @@ -233,7 +233,7 @@ public: /** * Creates a duplicate of the frame info */ - virtual CVideoSurface *duplicateFrame() const; + virtual Graphics::ManagedSurface *duplicateFrame() const; }; } // End of namespace Titanic diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index 3e6e93abf1..0429ed4257 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -541,7 +541,7 @@ void OSVideoSurface::transPixelate() { unlock(); } -CVideoSurface *OSVideoSurface::dupMovieFrame() const { +Graphics::ManagedSurface *OSVideoSurface::dupMovieFrame() const { return _movie ? _movie->duplicateFrame() : nullptr; } diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index 254745805e..a0e74b5b3d 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "common/array.h" +#include "graphics/managed_surface.h" #include "titanic/support/font.h" #include "titanic/support/direct_draw.h" #include "titanic/support/movie.h" @@ -62,7 +63,7 @@ protected: CScreenManager *_screenManager; Graphics::ManagedSurface *_rawSurface; bool _pendingLoad; - CVideoSurface *_movieFrameSurface; + Graphics::ManagedSurface *_movieFrameSurface; int _field48; int _videoSurfaceNum; int _field50; @@ -260,7 +261,7 @@ public: /** * Duplicates movie frame surface */ - virtual CVideoSurface *dupMovieFrame() const = 0; + virtual Graphics::ManagedSurface *dupMovieFrame() const = 0; /** * Frees the underlying surface @@ -283,13 +284,14 @@ public: void blitFrom(const Point &destPos, const Graphics::Surface *src); /** - * + * Sets the movie frame surface containing frame data from an active movie */ - void setMovieFrameSurface(CVideoSurface *frameSurface) { _movieFrameSurface = frameSurface; } + void setMovieFrameSurface(Graphics::ManagedSurface *frameSurface) { _movieFrameSurface = frameSurface; } /** + * Get the previously set movie frame surface */ - CVideoSurface *getMovieFrameSurface() const { return _movieFrameSurface; } + Graphics::ManagedSurface *getMovieFrameSurface() const { return _movieFrameSurface; } /** * Get the pixels associated with the surface. Only valid when the @@ -297,6 +299,12 @@ public: */ uint16 *getPixels() { return (uint16 *)_rawSurface->getPixels(); } + /** + * Get a reference to the underlying surface. Only valid when the surface + * has been locked for access + */ + Graphics::ManagedSurface *getRawSurface() { return _rawSurface; } + /** * Returns the transparent color */ @@ -499,7 +507,7 @@ public: /** * Duplicates movie frame surface */ - virtual CVideoSurface *dupMovieFrame() const; + virtual Graphics::ManagedSurface *dupMovieFrame() const; /** -- cgit v1.2.3 From f92f2243fdfd905b73b642ffc651311f28ba8320 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 12 Jul 2016 18:06:16 -0400 Subject: TITANIC: Fix star control points 2 loading --- engines/titanic/star_control/star_control_sub9.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/titanic/star_control/star_control_sub9.cpp b/engines/titanic/star_control/star_control_sub9.cpp index e19977c4a4..292e9a87d0 100644 --- a/engines/titanic/star_control/star_control_sub9.cpp +++ b/engines/titanic/star_control/star_control_sub9.cpp @@ -42,7 +42,7 @@ void CStarControlSub9::initialize() { RootEntry &rootEntry = _data[rootCtr]; rootEntry.resize(count * 2); for (int idx = 0; idx < count * 2; ++idx) { - DataEntry &entry = rootEntry[idx * 2]; + DataEntry &entry = rootEntry[idx]; v1 = stream->readSint32LE(); v2 = stream->readSint32LE(); v1 *= 0.015 * FACTOR; -- cgit v1.2.3 From 1986fa6e83884688a62c0cfbfb9109fcd26fac6e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 12 Jul 2016 18:13:16 -0400 Subject: TITANIC: Fixes for mouse cursor/movie frame handling --- engines/titanic/support/avi_surface.cpp | 27 ++++++++++++++------------- engines/titanic/support/mouse_cursor.cpp | 2 -- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp index ca6a09ade2..b685fa8cce 100644 --- a/engines/titanic/support/avi_surface.cpp +++ b/engines/titanic/support/avi_surface.cpp @@ -65,10 +65,13 @@ AVISurface::AVISurface(const CResourceKey &key) { if (!_decoders[0]->loadFile(key.getString())) error("Could not open video - %s", key.getString().c_str()); + _streamCount = 1; + // Create a decoder for any secondary video track AVIDecoder *decoder2 = new AVIDecoder(Audio::Mixer::kPlainSoundType, secondaryTrackSelect); if (decoder2->loadFile(key.getString())) { _decoders[1] = decoder2; + ++_streamCount; } else { delete decoder2; } @@ -263,20 +266,18 @@ bool AVISurface::renderFrame() { return false; // Decode each decoder's video stream into the appropriate surface - for (int idx = 0; idx < 2; ++idx) { - if (_decoders[idx]) { - const Graphics::Surface *frame = _decoders[idx]->decodeNextFrame(); + for (int idx = 0; idx < _streamCount; ++idx) { + const Graphics::Surface *frame = _decoders[idx]->decodeNextFrame(); - if (_movieFrameSurface[idx]->format == frame->format) { - _movieFrameSurface[idx]->blitFrom(*frame); - } else { - // Format mis-match, so we need to convert the frame - Graphics::Surface *s = frame->convertTo(_movieFrameSurface[idx]->format, - _decoders[idx]->getPalette()); - _movieFrameSurface[idx]->blitFrom(*s); - s->free(); - delete s; - } + if (_movieFrameSurface[idx]->format == frame->format) { + _movieFrameSurface[idx]->blitFrom(*frame); + } else { + // Format mis-match, so we need to convert the frame + Graphics::Surface *s = frame->convertTo(_movieFrameSurface[idx]->format, + _decoders[idx]->getPalette()); + _movieFrameSurface[idx]->blitFrom(*s); + s->free(); + delete s; } } diff --git a/engines/titanic/support/mouse_cursor.cpp b/engines/titanic/support/mouse_cursor.cpp index 5694d83dc6..d6a42823f5 100644 --- a/engines/titanic/support/mouse_cursor.cpp +++ b/engines/titanic/support/mouse_cursor.cpp @@ -63,8 +63,6 @@ CMouseCursor::CMouseCursor(CScreenManager *screenManager) : } CMouseCursor::~CMouseCursor() { - for (int idx = 0; idx < NUM_CURSORS; ++idx) - delete _cursors[idx]._videoSurface; } void CMouseCursor::loadCursorImages() { -- cgit v1.2.3 From b843b2fd3385533955a325ff8819e37ab3b0b2f0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 12 Jul 2016 18:27:33 -0400 Subject: TITANIC: Fix memory leak in image decoders --- engines/titanic/support/image_decoders.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/titanic/support/image_decoders.cpp b/engines/titanic/support/image_decoders.cpp index 4203dad97c..495d1d0982 100644 --- a/engines/titanic/support/image_decoders.cpp +++ b/engines/titanic/support/image_decoders.cpp @@ -45,6 +45,7 @@ void CJPEGDecode::decode(OSVideoSurface &surface, const CString &name) { Common::copy((byte *)convertedSurface->getPixels(), (byte *)convertedSurface->getPixels() + surface.getPitch() * surface.getHeight(), (byte *)surface._rawSurface->getPixels()); + convertedSurface->free(); delete convertedSurface; surface.unlock(); } @@ -72,6 +73,7 @@ void CTargaDecode::decode(OSVideoSurface &surface, const CString &name) { Common::copy((byte *)convertedSurface->getPixels(), (byte *)convertedSurface->getPixels() + surface.getPitch() * surface.getHeight(), (byte *)surface._rawSurface->getPixels()); + convertedSurface->free(); delete convertedSurface; surface.unlock(); } -- cgit v1.2.3 From 6331e3814a7fe501056ec5a356924b9c4c40c16f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 12 Jul 2016 19:19:06 -0400 Subject: TITANIC: Fleshing out & fixes for video surface blit methods --- engines/titanic/support/video_surface.cpp | 42 ++++++++++++++++++++----------- engines/titanic/support/video_surface.h | 5 ++-- 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index 0429ed4257..4169a80b4b 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -32,7 +32,8 @@ int CVideoSurface::_videoSurfaceCounter = 0; CVideoSurface::CVideoSurface(CScreenManager *screenManager) : _screenManager(screenManager), _rawSurface(nullptr), _movie(nullptr), _pendingLoad(false), _transBlitFlag(false), _fastBlitFlag(false), - _movieFrameSurface(nullptr), _transparencyMode(TRANS_DEFAULT), _field48(0), _field50(1) { + _movieFrameSurface(nullptr), _transparencyMode(TRANS_DEFAULT), + _field48(0), _field50(1), _lockCount(0) { _videoSurfaceNum = _videoSurfaceCounter++; } @@ -52,10 +53,10 @@ void CVideoSurface::blitFrom(const Point &destPos, CVideoSurface *src, const Rec Rect srcBounds, destBounds; clipBounds(srcBounds, destBounds, src, srcRect, &destPos); - if (_transBlitFlag) - transBlitRect(srcBounds, destBounds, src); + if (src->_transBlitFlag) + blitRect2(srcBounds, destBounds, src); else - blitRect(srcBounds, destBounds, src); + blitRect1(srcBounds, destBounds, src); } } @@ -128,25 +129,38 @@ void CVideoSurface::clipBounds(Rect &srcRect, Rect &destRect, error("Invalid rect"); } -void CVideoSurface::blitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src) { +void CVideoSurface::blitRect1(const Rect &srcRect, const Rect &destRect, CVideoSurface *src) { src->lock(); lock(); - if (_fastBlitFlag) { - _rawSurface->transBlitFrom(*src->_rawSurface, srcRect, destRect, - getTransparencyColor()); - return; + if (src->_fastBlitFlag) { + _rawSurface->blitFrom(*src->_rawSurface, srcRect, Point(destRect.left, destRect.top)); + } else if (getMovieFrameSurface()) { + movieBlitRect(srcRect, destRect, src); + } else { + _rawSurface->transBlitFrom(*src->_rawSurface, srcRect, destRect, src->getTransparencyColor()); } - // TODO - src->unlock(); unlock(); } -void CVideoSurface::transBlitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src) { - // TODO: Do it like the original does it - blitRect(srcRect, destRect, src); +void CVideoSurface::blitRect2(const Rect &srcRect, const Rect &destRect, CVideoSurface *src) { + if (getMovieFrameSurface()) { + movieBlitRect(srcRect, destRect, src); + } else { + src->lock(); + lock(); + + _rawSurface->blitFrom(*src->_rawSurface, srcRect, Point(destRect.left, destRect.top)); + + src->unlock(); + unlock(); + } +} + +void CVideoSurface::movieBlitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src) { + // TODO } uint CVideoSurface::getTransparencyColor() { diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index a0e74b5b3d..040161fe8e 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -55,8 +55,9 @@ private: void clipBounds(Rect &srcRect, Rect &destRect, CVideoSurface *srcSurface, const Rect *subRect = nullptr, const Point *destPos = nullptr); - void blitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src); - void transBlitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src); + void blitRect1(const Rect &srcRect, const Rect &destRect, CVideoSurface *src); + void blitRect2(const Rect &srcRect, const Rect &destRect, CVideoSurface *src); + void movieBlitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src); protected: static int _videoSurfaceCounter; protected: -- cgit v1.2.3 From 7b331771ca631236be57778f8e64fa916e1ec112 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 12 Jul 2016 21:49:04 -0400 Subject: TITANIC: Beginnings of CStarControlSub15 class --- engines/titanic/module.mk | 1 - .../titanic/star_control/star_control_sub15.cpp | 36 ++++++++++++++ engines/titanic/star_control/star_control_sub15.h | 57 ++++++++++++++++++++++ 3 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 engines/titanic/star_control/star_control_sub15.cpp create mode 100644 engines/titanic/star_control/star_control_sub15.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 8d25bc3e29..e015a25fb4 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -432,7 +432,6 @@ MODULE_OBJS := \ star_control/star_control_sub13.o \ star_control/star_control_sub14.o \ star_control/star_control_sub15.o \ - star_control/star_control_sub16.o \ star_control/surface_area.o \ star_control/surface_fader_base.o \ star_control/surface_fader.o \ diff --git a/engines/titanic/star_control/star_control_sub15.cpp b/engines/titanic/star_control/star_control_sub15.cpp new file mode 100644 index 0000000000..a6eb2e88fa --- /dev/null +++ b/engines/titanic/star_control/star_control_sub15.cpp @@ -0,0 +1,36 @@ +/* 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 "titanic/star_control/star_control_sub15.h" + +namespace Titanic { + +CStarControlSub15::CStarControlSub15() : + _field0(1.875), _field8(0), _fieldC(0), + _field10(0), _field14(0), _field18(0.0), _field1C(0), + _field20(1.875), _field28(0), _field2C(0), + _field30(0), _field38(0), _field3C(0), + _field40(1.875), _field48(0), _field4C(0), + _field50(0), _field54(0), _field58(0), _field5C(0) { +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub15.h b/engines/titanic/star_control/star_control_sub15.h new file mode 100644 index 0000000000..faf68f1b87 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub15.h @@ -0,0 +1,57 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_CONTROL_SUB15_H +#define TITANIC_STAR_CONTROL_SUB15_H + +namespace Titanic { + +class CStarControlSub15 { +private: + double _field0; + int _field8; + int _fieldC; + int _field10; + int _field14; + double _field18; + int _field1C; + double _field20; + int _field24; + int _field28; + int _field2C; + double _field30; + int _field38; + int _field3C; + double _field40; + int _field48; + int _field4C; + int _field50; + int _field54; + int _field58; + int _field5C; +public: + CStarControlSub15(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB15_H */ -- cgit v1.2.3 From ce7e2c80d618f3721afc3948e6a0b2f7a2585ba8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 13 Jul 2016 20:33:39 -0400 Subject: TITANIC: Further star control class stubs --- engines/titanic/module.mk | 7 + .../titanic/star_control/star_control_sub20.cpp | 144 +++++++++++++++++++++ engines/titanic/star_control/star_control_sub20.h | 96 ++++++++++++++ .../titanic/star_control/star_control_sub21.cpp | 144 +++++++++++++++++++++ engines/titanic/star_control/star_control_sub21.h | 35 +++++ .../titanic/star_control/star_control_sub22.cpp | 28 ++++ engines/titanic/star_control/star_control_sub22.h | 33 +++++ .../titanic/star_control/star_control_sub23.cpp | 28 ++++ engines/titanic/star_control/star_control_sub23.h | 33 +++++ .../titanic/star_control/star_control_sub24.cpp | 29 +++++ engines/titanic/star_control/star_control_sub24.h | 33 +++++ .../titanic/star_control/star_control_sub25.cpp | 28 ++++ engines/titanic/star_control/star_control_sub25.h | 33 +++++ .../titanic/star_control/star_control_sub26.cpp | 28 ++++ engines/titanic/star_control/star_control_sub26.h | 33 +++++ 15 files changed, 732 insertions(+) create mode 100644 engines/titanic/star_control/star_control_sub20.cpp create mode 100644 engines/titanic/star_control/star_control_sub20.h create mode 100644 engines/titanic/star_control/star_control_sub21.cpp create mode 100644 engines/titanic/star_control/star_control_sub21.h create mode 100644 engines/titanic/star_control/star_control_sub22.cpp create mode 100644 engines/titanic/star_control/star_control_sub22.h create mode 100644 engines/titanic/star_control/star_control_sub23.cpp create mode 100644 engines/titanic/star_control/star_control_sub23.h create mode 100644 engines/titanic/star_control/star_control_sub24.cpp create mode 100644 engines/titanic/star_control/star_control_sub24.h create mode 100644 engines/titanic/star_control/star_control_sub25.cpp create mode 100644 engines/titanic/star_control/star_control_sub25.h create mode 100644 engines/titanic/star_control/star_control_sub26.cpp create mode 100644 engines/titanic/star_control/star_control_sub26.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index e015a25fb4..de82f1d968 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -432,6 +432,13 @@ MODULE_OBJS := \ star_control/star_control_sub13.o \ star_control/star_control_sub14.o \ star_control/star_control_sub15.o \ + star_control/star_control_sub20.o \ + star_control/star_control_sub21.o \ + star_control/star_control_sub22.o \ + star_control/star_control_sub23.o \ + star_control/star_control_sub24.o \ + star_control/star_control_sub25.o \ + star_control/star_control_sub26.o \ star_control/surface_area.o \ star_control/surface_fader_base.o \ star_control/surface_fader.o \ diff --git a/engines/titanic/star_control/star_control_sub20.cpp b/engines/titanic/star_control/star_control_sub20.cpp new file mode 100644 index 0000000000..958ee3813e --- /dev/null +++ b/engines/titanic/star_control/star_control_sub20.cpp @@ -0,0 +1,144 @@ +/* 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 "titanic/star_control/star_control_sub20.h" +#include "common/textconsole.h" + +namespace Titanic { + +CStarControlSub20::CStarControlSub20(void *src) { + _lockCounter = 0; + _dataP = nullptr; + + if (src) { + copyFrom1(src); + } else { + _field4 = 0.0; + _field8 = 0.0; + _fieldC = 20.0; + _field10 = 0.0; + _field14 = 50000.0; + _field18 = 1.0; + _field1C = 1.0; + _field20 = 0.0; + } +} + +CStarControlSub20::~CStarControlSub20() { + clear(); +} + +void CStarControlSub20::copyFrom1(void *src) { + error("TODO: CStarControlSub20::copyFrom1"); +} + +void CStarControlSub20::copyFrom2(void *src) { + error("TODO: CStarControlSub20::copyFrom2"); +} + +void CStarControlSub20::proc4() { + if (!isLocked() && _field4 < _field14) { + _field8 += _field4; + if (_fieldC == _field8) + _field4 -= _field8; + else + _field4 += _field8; + } +} + +void CStarControlSub20::proc5() { + if (!isLocked()) { + _field8 -= _fieldC; + if (_field8 == _field4) + _field4 += _field8; + else + _field4 -= _field8; + + if (_field8 < 0.0) + _field8 = 0.0; + } +} + +void CStarControlSub20::proc6() { + if (!isLocked()) + _field4 = _field14; +} + +void CStarControlSub20::proc7() { + if (!isLocked()) { + _field4 = 0.0; + _field8 = 0.0; + } +} + +void CStarControlSub20::proc11(CErrorCode *errorCode, void *v2, void *v3) { + if (_field4 > 0.0) { + warning("TODO: CStarControlSub20::proc11"); + } +} + +void CStarControlSub20::setData(void *data) { + clear(); + _dataP = data; +} + +void CStarControlSub20::clear() { + if (_dataP) { + delete _dataP; + _dataP = nullptr; + } +} + +void CStarControlSub20::load(SimpleFile *file, int val) { + if (!val) { + _field4 = file->readFloat(); + _field8 = file->readFloat(); + _fieldC = file->readFloat(); + _field10 = file->readFloat(); + _field14 = file->readFloat(); + _field18 = file->readFloat(); + _field1C = file->readFloat(); + _field20 = file->readFloat(); + } +} + +void CStarControlSub20::save(SimpleFile *file, int indent) { + file->writeFloatLine(_field4, indent); + file->writeFloatLine(_field8, indent); + file->writeFloatLine(_fieldC, indent); + file->writeFloatLine(_field10, indent); + file->writeFloatLine(_field14, indent); + file->writeFloatLine(_field18, indent); + file->writeFloatLine(_field1C, indent); + file->writeFloatLine(_field20, indent); +} + +void CStarControlSub20::incLockCount() { + ++_lockCounter; +} + +void CStarControlSub20::decLockCount() { + if (_lockCounter > 0) + --_lockCounter; +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub20.h b/engines/titanic/star_control/star_control_sub20.h new file mode 100644 index 0000000000..376c09743a --- /dev/null +++ b/engines/titanic/star_control/star_control_sub20.h @@ -0,0 +1,96 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_CONTROL_SUB20_H +#define TITANIC_STAR_CONTROL_SUB20_H + +#include "titanic/support/simple_file.h" +#include "titanic/star_control/error_code.h" + +namespace Titanic { + +class CStarControlSub20 { +public: + double _field4; + double _field8; + double _fieldC; + double _field10; + double _field14; + double _field18; + double _field1C; + double _field20; + int _lockCounter; + void *_dataP; +public: + CStarControlSub20(void *src); + virtual ~CStarControlSub20(); + + virtual void copyFrom1(void *src); + virtual void copyFrom2(void *src); + virtual void proc4(); + virtual void proc5(); + virtual void proc6(); + virtual void proc7(); + virtual void proc8() {} + virtual void proc9() {} + virtual void proc10() {} + virtual void proc11(CErrorCode *errorCode, void *v2, void *v3); + + /** + * Set the data + */ + virtual void setData(void *data); + + /** + * Clear the class + */ + virtual void clear(); + + /** + * Load the class + */ + virtual void load(SimpleFile *file, int val = 0); + + /** + * Save the class + */ + virtual void save(SimpleFile *file, int indent); + + /** + * Increment tthe lock counter + */ + void incLockCount(); + + /** + * Decrement the lock counter + */ + void decLockCount(); + + /** + * Returns true if the lock counter is non-zero + */ + bool isLocked() const { return _lockCounter > 0; } +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB20_H */ diff --git a/engines/titanic/star_control/star_control_sub21.cpp b/engines/titanic/star_control/star_control_sub21.cpp new file mode 100644 index 0000000000..958ee3813e --- /dev/null +++ b/engines/titanic/star_control/star_control_sub21.cpp @@ -0,0 +1,144 @@ +/* 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 "titanic/star_control/star_control_sub20.h" +#include "common/textconsole.h" + +namespace Titanic { + +CStarControlSub20::CStarControlSub20(void *src) { + _lockCounter = 0; + _dataP = nullptr; + + if (src) { + copyFrom1(src); + } else { + _field4 = 0.0; + _field8 = 0.0; + _fieldC = 20.0; + _field10 = 0.0; + _field14 = 50000.0; + _field18 = 1.0; + _field1C = 1.0; + _field20 = 0.0; + } +} + +CStarControlSub20::~CStarControlSub20() { + clear(); +} + +void CStarControlSub20::copyFrom1(void *src) { + error("TODO: CStarControlSub20::copyFrom1"); +} + +void CStarControlSub20::copyFrom2(void *src) { + error("TODO: CStarControlSub20::copyFrom2"); +} + +void CStarControlSub20::proc4() { + if (!isLocked() && _field4 < _field14) { + _field8 += _field4; + if (_fieldC == _field8) + _field4 -= _field8; + else + _field4 += _field8; + } +} + +void CStarControlSub20::proc5() { + if (!isLocked()) { + _field8 -= _fieldC; + if (_field8 == _field4) + _field4 += _field8; + else + _field4 -= _field8; + + if (_field8 < 0.0) + _field8 = 0.0; + } +} + +void CStarControlSub20::proc6() { + if (!isLocked()) + _field4 = _field14; +} + +void CStarControlSub20::proc7() { + if (!isLocked()) { + _field4 = 0.0; + _field8 = 0.0; + } +} + +void CStarControlSub20::proc11(CErrorCode *errorCode, void *v2, void *v3) { + if (_field4 > 0.0) { + warning("TODO: CStarControlSub20::proc11"); + } +} + +void CStarControlSub20::setData(void *data) { + clear(); + _dataP = data; +} + +void CStarControlSub20::clear() { + if (_dataP) { + delete _dataP; + _dataP = nullptr; + } +} + +void CStarControlSub20::load(SimpleFile *file, int val) { + if (!val) { + _field4 = file->readFloat(); + _field8 = file->readFloat(); + _fieldC = file->readFloat(); + _field10 = file->readFloat(); + _field14 = file->readFloat(); + _field18 = file->readFloat(); + _field1C = file->readFloat(); + _field20 = file->readFloat(); + } +} + +void CStarControlSub20::save(SimpleFile *file, int indent) { + file->writeFloatLine(_field4, indent); + file->writeFloatLine(_field8, indent); + file->writeFloatLine(_fieldC, indent); + file->writeFloatLine(_field10, indent); + file->writeFloatLine(_field14, indent); + file->writeFloatLine(_field18, indent); + file->writeFloatLine(_field1C, indent); + file->writeFloatLine(_field20, indent); +} + +void CStarControlSub20::incLockCount() { + ++_lockCounter; +} + +void CStarControlSub20::decLockCount() { + if (_lockCounter > 0) + --_lockCounter; +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub21.h b/engines/titanic/star_control/star_control_sub21.h new file mode 100644 index 0000000000..8214a1824e --- /dev/null +++ b/engines/titanic/star_control/star_control_sub21.h @@ -0,0 +1,35 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_CONTROL_SUB21_H +#define TITANIC_STAR_CONTROL_SUB21_H + +#include "titanic/star_control/star_control_sub20.h" + +namespace Titanic { + +class CStarControlSub21 : public CStarControlSub20 { +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB21_H */ diff --git a/engines/titanic/star_control/star_control_sub22.cpp b/engines/titanic/star_control/star_control_sub22.cpp new file mode 100644 index 0000000000..d7835a68bf --- /dev/null +++ b/engines/titanic/star_control/star_control_sub22.cpp @@ -0,0 +1,28 @@ +/* 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 "titanic/star_control/star_control_sub22.h" +#include "common/textconsole.h" + +namespace Titanic { + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub22.h b/engines/titanic/star_control/star_control_sub22.h new file mode 100644 index 0000000000..94a0cdf7f9 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub22.h @@ -0,0 +1,33 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_CONTROL_SUB22_H +#define TITANIC_STAR_CONTROL_SUB22_H + +namespace Titanic { + +class CStarControlSub22 { +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB22_H */ diff --git a/engines/titanic/star_control/star_control_sub23.cpp b/engines/titanic/star_control/star_control_sub23.cpp new file mode 100644 index 0000000000..b009cbc35b --- /dev/null +++ b/engines/titanic/star_control/star_control_sub23.cpp @@ -0,0 +1,28 @@ +/* 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 "titanic/star_control/star_control_sub23.h" +#include "common/textconsole.h" + +namespace Titanic { + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub23.h b/engines/titanic/star_control/star_control_sub23.h new file mode 100644 index 0000000000..136401e329 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub23.h @@ -0,0 +1,33 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_CONTROL_SUB23_H +#define TITANIC_STAR_CONTROL_SUB23_H + +namespace Titanic { + +class CStarControlSub23 { +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB23_H */ diff --git a/engines/titanic/star_control/star_control_sub24.cpp b/engines/titanic/star_control/star_control_sub24.cpp new file mode 100644 index 0000000000..6f17eb7193 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub24.cpp @@ -0,0 +1,29 @@ +/* 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 "titanic/star_control/star_control_sub24.h" +#include "common/textconsole.h" + +namespace Titanic { + + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub24.h b/engines/titanic/star_control/star_control_sub24.h new file mode 100644 index 0000000000..43f1e0933e --- /dev/null +++ b/engines/titanic/star_control/star_control_sub24.h @@ -0,0 +1,33 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_CONTROL_SUB24_H +#define TITANIC_STAR_CONTROL_SUB24_H + +namespace Titanic { + +class CStarControlSub24 { +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB24_H */ diff --git a/engines/titanic/star_control/star_control_sub25.cpp b/engines/titanic/star_control/star_control_sub25.cpp new file mode 100644 index 0000000000..f91c75af6a --- /dev/null +++ b/engines/titanic/star_control/star_control_sub25.cpp @@ -0,0 +1,28 @@ +/* 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 "titanic/star_control/star_control_sub25.h" +#include "common/textconsole.h" + +namespace Titanic { + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub25.h b/engines/titanic/star_control/star_control_sub25.h new file mode 100644 index 0000000000..ebfe7898d7 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub25.h @@ -0,0 +1,33 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_CONTROL_SUB25_H +#define TITANIC_STAR_CONTROL_SUB25_H + +namespace Titanic { + +class CStarControlSub25 { +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB25_H */ diff --git a/engines/titanic/star_control/star_control_sub26.cpp b/engines/titanic/star_control/star_control_sub26.cpp new file mode 100644 index 0000000000..9d796a0475 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub26.cpp @@ -0,0 +1,28 @@ +/* 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 "titanic/star_control/star_control_sub26.h" +#include "common/textconsole.h" + +namespace Titanic { + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub26.h b/engines/titanic/star_control/star_control_sub26.h new file mode 100644 index 0000000000..2edfce7052 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub26.h @@ -0,0 +1,33 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_CONTROL_SUB26_H +#define TITANIC_STAR_CONTROL_SUB26_H + +namespace Titanic { + +class CStarControlSub26 { +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB26_H */ -- cgit v1.2.3 From 7553b81d8694fe05b5ba29893f3578b3d43aed68 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 15 Jul 2016 18:59:36 -0400 Subject: TITANIC: Some star control class definitions --- engines/titanic/star_control/star_control_sub25.h | 10 ++++++++++ engines/titanic/star_control/star_control_sub26.h | 14 ++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/engines/titanic/star_control/star_control_sub25.h b/engines/titanic/star_control/star_control_sub25.h index ebfe7898d7..81b5bb0f54 100644 --- a/engines/titanic/star_control/star_control_sub25.h +++ b/engines/titanic/star_control/star_control_sub25.h @@ -23,9 +23,19 @@ #ifndef TITANIC_STAR_CONTROL_SUB25_H #define TITANIC_STAR_CONTROL_SUB25_H +#include "titanic/star_control/star_control_sub14.h" +#include "titanic/star_control/star_control_sub26.h" + namespace Titanic { class CStarControlSub25 { +public: + CStarControlSub14 _sub1; + CStarControlSub14 _sub2; + CStarControlSub26 _sub3; + CStarControlSub26 _sub4; +public: + }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub26.h b/engines/titanic/star_control/star_control_sub26.h index 2edfce7052..cf0c62afeb 100644 --- a/engines/titanic/star_control/star_control_sub26.h +++ b/engines/titanic/star_control/star_control_sub26.h @@ -26,6 +26,20 @@ namespace Titanic { class CStarControlSub26 { + struct Sub { + int _field0; + int _field4; + int _field8; + int _field10; + int _field14; + + Sub() : _field0(0), _field4(0), _field8(0), _field10(0), _field14(0) {} + }; +public: + int _field0; + double _field4; +public: + CStarControlSub26() : _field0(0), _field4(1.875) {} }; } // End of namespace Titanic -- cgit v1.2.3 From e1695101bc464fe1a4917f7cd25db38854c923e0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 16 Jul 2016 08:50:42 -0400 Subject: TITANIC: Beginnings of matrix and vector classes --- engines/titanic/module.mk | 11 ++-- engines/titanic/star_control/dmatrix.cpp | 33 ++++++++++ engines/titanic/star_control/dmatrix.h | 42 ++++++++++++ engines/titanic/star_control/dvector.cpp | 28 ++++++++ engines/titanic/star_control/dvector.h | 38 +++++++++++ engines/titanic/star_control/fmatrix.cpp | 75 ++++++++++++++++++++++ engines/titanic/star_control/fmatrix.h | 70 ++++++++++++++++++++ engines/titanic/star_control/fpoint.cpp | 28 ++++++++ engines/titanic/star_control/fpoint.h | 38 +++++++++++ engines/titanic/star_control/fvector.cpp | 28 ++++++++ engines/titanic/star_control/fvector.h | 38 +++++++++++ .../titanic/star_control/star_control_sub13.cpp | 4 +- engines/titanic/star_control/star_control_sub13.h | 4 +- .../titanic/star_control/star_control_sub14.cpp | 50 --------------- engines/titanic/star_control/star_control_sub14.h | 58 ----------------- .../titanic/star_control/star_control_sub15.cpp | 36 ----------- engines/titanic/star_control/star_control_sub15.h | 57 ---------------- engines/titanic/star_control/star_control_sub25.h | 10 +-- 18 files changed, 434 insertions(+), 214 deletions(-) create mode 100644 engines/titanic/star_control/dmatrix.cpp create mode 100644 engines/titanic/star_control/dmatrix.h create mode 100644 engines/titanic/star_control/dvector.cpp create mode 100644 engines/titanic/star_control/dvector.h create mode 100644 engines/titanic/star_control/fmatrix.cpp create mode 100644 engines/titanic/star_control/fmatrix.h create mode 100644 engines/titanic/star_control/fpoint.cpp create mode 100644 engines/titanic/star_control/fpoint.h create mode 100644 engines/titanic/star_control/fvector.cpp create mode 100644 engines/titanic/star_control/fvector.h delete mode 100644 engines/titanic/star_control/star_control_sub14.cpp delete mode 100644 engines/titanic/star_control/star_control_sub14.h delete mode 100644 engines/titanic/star_control/star_control_sub15.cpp delete mode 100644 engines/titanic/star_control/star_control_sub15.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index de82f1d968..9dfbc92986 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -417,10 +417,15 @@ MODULE_OBJS := \ sound/water_lapping_sounds.o \ sound/wave_file.o \ star_control/star_control.o \ - star_control/star_control_sub1.o \ - star_control/star_control_sub2.o \ star_control/base_star.o \ + star_control/dmatrix.o \ + star_control/dvector.o \ + star_control/fmatrix.o \ + star_control/fpoint.o \ + star_control/fvector.o \ star_control/star_array.o \ + star_control/star_control_sub1.o \ + star_control/star_control_sub2.o \ star_control/star_control_sub4.o \ star_control/star_control_sub5.o \ star_control/star_control_sub6.o \ @@ -430,8 +435,6 @@ MODULE_OBJS := \ star_control/star_view.o \ star_control/star_control_sub12.o \ star_control/star_control_sub13.o \ - star_control/star_control_sub14.o \ - star_control/star_control_sub15.o \ star_control/star_control_sub20.o \ star_control/star_control_sub21.o \ star_control/star_control_sub22.o \ diff --git a/engines/titanic/star_control/dmatrix.cpp b/engines/titanic/star_control/dmatrix.cpp new file mode 100644 index 0000000000..160dccafe1 --- /dev/null +++ b/engines/titanic/star_control/dmatrix.cpp @@ -0,0 +1,33 @@ +/* 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 "titanic/star_control/dmatrix.h" + +namespace Titanic { + +DMatrix::DMatrix() : + _row1(1.0, 0.0, 0.0), _row2(0.0, 1.0, 0.0), _row3(0.0, 0.0, 1.0), + _row4(0.0, 0.0, 0.0) { +} + + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/dmatrix.h b/engines/titanic/star_control/dmatrix.h new file mode 100644 index 0000000000..8c5eeeb584 --- /dev/null +++ b/engines/titanic/star_control/dmatrix.h @@ -0,0 +1,42 @@ +/* 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. + * + */ + +#ifndef TITANIC_DMATRIX_H +#define TITANIC_DMATRIX_H + +#include "titanic/star_control/dvector.h" + +namespace Titanic { + +class DMatrix { +private: + DVector _row1; + DVector _row2; + DVector _row3; + DVector _row4; +public: + DMatrix(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DMATRIX_H */ diff --git a/engines/titanic/star_control/dvector.cpp b/engines/titanic/star_control/dvector.cpp new file mode 100644 index 0000000000..8e071cf0ab --- /dev/null +++ b/engines/titanic/star_control/dvector.cpp @@ -0,0 +1,28 @@ +/* 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 "titanic/star_control/dvector.h" + +namespace Titanic { + + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/dvector.h b/engines/titanic/star_control/dvector.h new file mode 100644 index 0000000000..32d2bdd229 --- /dev/null +++ b/engines/titanic/star_control/dvector.h @@ -0,0 +1,38 @@ +/* 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. + * + */ + +#ifndef TITANIC_DVECTOR_H +#define TITANIC_DVECTOR_H + +namespace Titanic { + +class DVector { +public: + double _x, _y, _z; +public: + DVector() : _x(0), _y(0), _z(0) {} + DVector(double x, double y, double z) : _x(x), _y(y), _z(z) {} +}; + +} // End of namespace Titanic + +#endif /* TITANIC_DVECTOR_H */ diff --git a/engines/titanic/star_control/fmatrix.cpp b/engines/titanic/star_control/fmatrix.cpp new file mode 100644 index 0000000000..52fc2bfd86 --- /dev/null +++ b/engines/titanic/star_control/fmatrix.cpp @@ -0,0 +1,75 @@ +/* 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 "titanic/star_control/fmatrix.h" + +namespace Titanic { + +FMatrix::FMatrix() : + _row1(1.0, 0.0, 0.0), _row2(0.0, 1.0, 0.0), _row3(0.0, 0.0, 1.0) { +} + +FMatrix::FMatrix(DMatrix *src) { + copyFrom(src); +} + +void FMatrix::copyFrom(const DMatrix *src) { + // TODO +} + +void FMatrix::load(SimpleFile *file, int param) { + _row1._x = file->readFloat(); + _row1._y = file->readFloat(); + _row1._z = file->readFloat(); + _row2._x = file->readFloat(); + _row2._y = file->readFloat(); + _row2._z = file->readFloat(); + _row3._x = file->readFloat(); + _row3._y = file->readFloat(); + _row3._z = file->readFloat(); +} + +void FMatrix::save(SimpleFile *file, int indent) { + file->writeFloatLine(_row1._x, indent); + file->writeFloatLine(_row1._y, indent); + file->writeFloatLine(_row1._z, indent); + file->writeFloatLine(_row2._x, indent); + file->writeFloatLine(_row2._y, indent); + file->writeFloatLine(_row2._z, indent); + file->writeFloatLine(_row3._x, indent); + file->writeFloatLine(_row3._y, indent); + file->writeFloatLine(_row3._z, indent); +} + +void FMatrix::clear() { + _row1 = FVector(1.0, 0.0, 0.0); + _row2 = FVector(0.0, 1.0, 0.0); + _row3 = FVector(0.0, 0.0, 1.0); +} + +void FMatrix::set(FVector *row1, FVector *row2, FVector *row3) { + _row1 = *row1; + _row2 = *row2; + _row3 = *row3; +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/fmatrix.h b/engines/titanic/star_control/fmatrix.h new file mode 100644 index 0000000000..e98b160f01 --- /dev/null +++ b/engines/titanic/star_control/fmatrix.h @@ -0,0 +1,70 @@ +/* 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. + * + */ + +#ifndef TITANIC_FMATRIX_H +#define TITANIC_FMATRIX_H + +#include "titanic/support/simple_file.h" +#include "titanic/star_control/fvector.h" + +namespace Titanic { + +class DMatrix; + +class FMatrix { +private: + FVector _row1; + FVector _row2; + FVector _row3; +private: + /** + * Copys data from a given source + */ + void copyFrom(const DMatrix *src); +public: + FMatrix(); + FMatrix(DMatrix *src); + + /** + * Load the data for the class from file + */ + void load(SimpleFile *file, int param); + + /** + * Save the data for the class to file + */ + void save(SimpleFile *file, int indent); + + /** + * Clears the matrix + */ + void clear(); + + /** + * Sets the data for the matrix + */ + void set(FVector *row1, FVector *row2, FVector *row3); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MATRIX3_H */ diff --git a/engines/titanic/star_control/fpoint.cpp b/engines/titanic/star_control/fpoint.cpp new file mode 100644 index 0000000000..f3d7008324 --- /dev/null +++ b/engines/titanic/star_control/fpoint.cpp @@ -0,0 +1,28 @@ +/* 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 "titanic/star_control/fpoint.h" + +namespace Titanic { + + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/fpoint.h b/engines/titanic/star_control/fpoint.h new file mode 100644 index 0000000000..5329ecb9e3 --- /dev/null +++ b/engines/titanic/star_control/fpoint.h @@ -0,0 +1,38 @@ +/* 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. + * + */ + +#ifndef TITANIC_FPOINT_H +#define TITANIC_FPOINT_H + +namespace Titanic { + +class FVector { +public: + double _x, _y; +public: + FVector() : _x(0), _y(0) {} + FVector(double x, double y) : _x(x), _y(y) {} +}; + +} // End of namespace Titanic + +#endif /* TITANIC_FPOINT_H */ diff --git a/engines/titanic/star_control/fvector.cpp b/engines/titanic/star_control/fvector.cpp new file mode 100644 index 0000000000..39d303c4dc --- /dev/null +++ b/engines/titanic/star_control/fvector.cpp @@ -0,0 +1,28 @@ +/* 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 "titanic/star_control/fvector.h" + +namespace Titanic { + + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/fvector.h b/engines/titanic/star_control/fvector.h new file mode 100644 index 0000000000..86e6e384ac --- /dev/null +++ b/engines/titanic/star_control/fvector.h @@ -0,0 +1,38 @@ +/* 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. + * + */ + +#ifndef TITANIC_FVECTOR_H +#define TITANIC_FVECTOR_H + +namespace Titanic { + +class FVector { +public: + double _x, _y, _z; +public: + FVector() : _x(0), _y(0), _z(0) {} + FVector(double x, double y, double z) : _x(x), _y(y), _z(z) {} +}; + +} // End of namespace Titanic + +#endif /* TITANIC_FVECTOR_H */ diff --git a/engines/titanic/star_control/star_control_sub13.cpp b/engines/titanic/star_control/star_control_sub13.cpp index f22a22a6e9..fd67c19785 100644 --- a/engines/titanic/star_control/star_control_sub13.cpp +++ b/engines/titanic/star_control/star_control_sub13.cpp @@ -63,12 +63,12 @@ void CStarControlSub13::load(SimpleFile *file, int param) { for (int idx = 0; idx < 5; ++idx) _valArray[idx] = file->readFloat(); - _sub14.load(file, param); + _matrix.load(file, param); _fieldD4 = 0; } void CStarControlSub13::save(SimpleFile *file, int indent) { - _sub14.save(file, indent); + _matrix.save(file, indent); } diff --git a/engines/titanic/star_control/star_control_sub13.h b/engines/titanic/star_control/star_control_sub13.h index e1b54775ce..37ffe1bdb9 100644 --- a/engines/titanic/star_control/star_control_sub13.h +++ b/engines/titanic/star_control/star_control_sub13.h @@ -25,7 +25,7 @@ #include "titanic/support/simple_file.h" #include "titanic/star_control/star_control_sub6.h" -#include "titanic/star_control/star_control_sub14.h" +#include "titanic/star_control/fmatrix.h" namespace Titanic { @@ -43,7 +43,7 @@ private: int _field22; int _field24; double _valArray[5]; - CStarControlSub14 _sub14; + FMatrix _matrix; CStarControlSub6 _sub1; CStarControlSub6 _sub2; int _fieldC0; diff --git a/engines/titanic/star_control/star_control_sub14.cpp b/engines/titanic/star_control/star_control_sub14.cpp deleted file mode 100644 index 75e7c68d8e..0000000000 --- a/engines/titanic/star_control/star_control_sub14.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* 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 "titanic/star_control/star_control_sub14.h" - -namespace Titanic { - -CStarControlSub14::CStarControlSub14() : - _field0(0x3F800000), _field4(0), _field8(0), _fieldC(0), - _field10(0x3F800000), _field14(0), _field18(0), _field1C(0), - _field20(0x3F800000) { -} - -void CStarControlSub14::load(SimpleFile *file, int param) { - _field0 = file->readFloat(); - _field4 = file->readFloat(); - _field8 = file->readFloat(); - _fieldC = file->readFloat(); - _field10 = file->readFloat(); - _field14 = file->readFloat(); - _field18 = file->readFloat(); - _field1C = file->readFloat(); - _field20 = file->readFloat(); -} - -void CStarControlSub14::save(SimpleFile *file, int indent) { - -} - - -} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub14.h b/engines/titanic/star_control/star_control_sub14.h deleted file mode 100644 index 0b1d4e3b08..0000000000 --- a/engines/titanic/star_control/star_control_sub14.h +++ /dev/null @@ -1,58 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_STAR_CONTROL_SUB14_H -#define TITANIC_STAR_CONTROL_SUB14_H - -#include "titanic/support/simple_file.h" - -namespace Titanic { - -class CStarControlSub14 { -private: - double _field0; - double _field4; - double _field8; - double _fieldC; - double _field10; - double _field14; - double _field18; - double _field1C; - double _field20; -public: - CStarControlSub14(); - - /** - * Load the data for the class from file - */ - void load(SimpleFile *file, int param); - - /** - * Save the data for the class to file - */ - void save(SimpleFile *file, int indent); - -}; - -} // End of namespace Titanic - -#endif /* TITANIC_STAR_CONTROL_SUB13_H */ diff --git a/engines/titanic/star_control/star_control_sub15.cpp b/engines/titanic/star_control/star_control_sub15.cpp deleted file mode 100644 index a6eb2e88fa..0000000000 --- a/engines/titanic/star_control/star_control_sub15.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 "titanic/star_control/star_control_sub15.h" - -namespace Titanic { - -CStarControlSub15::CStarControlSub15() : - _field0(1.875), _field8(0), _fieldC(0), - _field10(0), _field14(0), _field18(0.0), _field1C(0), - _field20(1.875), _field28(0), _field2C(0), - _field30(0), _field38(0), _field3C(0), - _field40(1.875), _field48(0), _field4C(0), - _field50(0), _field54(0), _field58(0), _field5C(0) { -} - -} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub15.h b/engines/titanic/star_control/star_control_sub15.h deleted file mode 100644 index faf68f1b87..0000000000 --- a/engines/titanic/star_control/star_control_sub15.h +++ /dev/null @@ -1,57 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_STAR_CONTROL_SUB15_H -#define TITANIC_STAR_CONTROL_SUB15_H - -namespace Titanic { - -class CStarControlSub15 { -private: - double _field0; - int _field8; - int _fieldC; - int _field10; - int _field14; - double _field18; - int _field1C; - double _field20; - int _field24; - int _field28; - int _field2C; - double _field30; - int _field38; - int _field3C; - double _field40; - int _field48; - int _field4C; - int _field50; - int _field54; - int _field58; - int _field5C; -public: - CStarControlSub15(); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_STAR_CONTROL_SUB15_H */ diff --git a/engines/titanic/star_control/star_control_sub25.h b/engines/titanic/star_control/star_control_sub25.h index 81b5bb0f54..e943782e37 100644 --- a/engines/titanic/star_control/star_control_sub25.h +++ b/engines/titanic/star_control/star_control_sub25.h @@ -23,17 +23,17 @@ #ifndef TITANIC_STAR_CONTROL_SUB25_H #define TITANIC_STAR_CONTROL_SUB25_H -#include "titanic/star_control/star_control_sub14.h" +#include "titanic/star_control/fmatrix.h" #include "titanic/star_control/star_control_sub26.h" namespace Titanic { class CStarControlSub25 { public: - CStarControlSub14 _sub1; - CStarControlSub14 _sub2; - CStarControlSub26 _sub3; - CStarControlSub26 _sub4; + FMatrix _matrix1; + FMatrix _matrix2; + CStarControlSub26 _sub1; + CStarControlSub26 _sub2; public: }; -- cgit v1.2.3 From 9b1efa3bf5696ea606b9374d216d4a1ecf52610b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 16 Jul 2016 12:36:02 -0400 Subject: TITANIC: Added FMatrix methods --- engines/titanic/star_control/dmatrix.h | 4 + engines/titanic/star_control/dvector.cpp | 9 ++ engines/titanic/star_control/dvector.h | 6 ++ engines/titanic/star_control/fmatrix.cpp | 55 ++++++++++ engines/titanic/star_control/fmatrix.h | 23 ++++ engines/titanic/star_control/fpoint.h | 9 +- engines/titanic/star_control/fvector.cpp | 22 ++++ engines/titanic/star_control/fvector.h | 22 ++++ .../titanic/star_control/star_control_sub21.cpp | 118 +-------------------- engines/titanic/star_control/star_control_sub6.cpp | 10 +- engines/titanic/star_control/star_control_sub6.h | 12 +-- 11 files changed, 152 insertions(+), 138 deletions(-) diff --git a/engines/titanic/star_control/dmatrix.h b/engines/titanic/star_control/dmatrix.h index 8c5eeeb584..565df80cd1 100644 --- a/engines/titanic/star_control/dmatrix.h +++ b/engines/titanic/star_control/dmatrix.h @@ -27,6 +27,10 @@ namespace Titanic { +/** + * Double based matrix class. + * @remarks TODO: See if it can be merged with FMatrix + */ class DMatrix { private: DVector _row1; diff --git a/engines/titanic/star_control/dvector.cpp b/engines/titanic/star_control/dvector.cpp index 8e071cf0ab..e4c5b15cb0 100644 --- a/engines/titanic/star_control/dvector.cpp +++ b/engines/titanic/star_control/dvector.cpp @@ -21,8 +21,17 @@ */ #include "titanic/star_control/dvector.h" +#include "common/algorithm.h" namespace Titanic { +void DVector::fn3() { + double hyp = sqrt(_x * _x + _y * _y + _z * _z); + assert(hyp); + + _x *= 1.0 / hyp; + _y *= 1.0 / hyp; + _z *= 1.0 / hyp; +} } // End of namespace Titanic diff --git a/engines/titanic/star_control/dvector.h b/engines/titanic/star_control/dvector.h index 32d2bdd229..7aca407c1c 100644 --- a/engines/titanic/star_control/dvector.h +++ b/engines/titanic/star_control/dvector.h @@ -25,12 +25,18 @@ namespace Titanic { +/** + * Double based vector class. + * @remarks TODO: See if it can be merged with FVector + */ class DVector { public: double _x, _y, _z; public: DVector() : _x(0), _y(0), _z(0) {} DVector(double x, double y, double z) : _x(x), _y(y), _z(z) {} + + void fn3(); }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/fmatrix.cpp b/engines/titanic/star_control/fmatrix.cpp index 52fc2bfd86..c53892d0fe 100644 --- a/engines/titanic/star_control/fmatrix.cpp +++ b/engines/titanic/star_control/fmatrix.cpp @@ -72,4 +72,59 @@ void FMatrix::set(FVector *row1, FVector *row2, FVector *row3) { _row3 = *row3; } +void FMatrix::fn1(FVector *v) { + _row3._x = v->_x; + + FVector tempVector; + tempVector.fn1(v); + + _row2._x = tempVector._x; + _row2._y = tempVector._y; + _row2._z = tempVector._z; + + _row3.multiply(v, &_row2); + _row1._x = _row2._x; + _row1._y = _row2._y; + _row1._z = _row2._z; + _row1.fn3(); + + _row3.multiply(&tempVector, &_row1); + _row2._x = _row1._x; + _row2._y = _row1._y; + _row2._z = _row1._z; + _row2.fn3(); +} + +void FMatrix::fn2(FMatrix *m) { + double x1 = _row1._y * m->_row2._x + _row1._z * m->_row3._x + _row1._x * m->_row1._x; + double y1 = _row1._x * m->_row1._y + m->_row2._y * _row1._y + m->_row3._y * _row1._z; + double z1 = _row1._x * m->_row1._z + _row1._y * m->_row2._z + _row1._z * m->_row3._z; + double x2 = m->_row1._x * _row2._x + m->_row3._x * _row2._z + m->_row2._x * _row2._y; + double y2 = m->_row3._y * _row2._z + m->_row1._y * _row2._x + m->_row2._y * _row2._y; + double z2 = _row2._z * m->_row3._z + _row2._x * m->_row1._z + _row2._y * m->_row2._z; + double x3 = m->_row1._x * _row3._x + _row3._z * m->_row3._x + _row3._y * m->_row2._x; + double y3 = _row3._y * m->_row2._y + _row3._z * m->_row3._y + _row3._x * m->_row1._y; + double z3 = _row3._x * m->_row1._z + _row3._y * m->_row2._z + _row3._z * m->_row3._z; + + _row1 = FVector(x1, y1, z1); + _row2 = FVector(x2, y2, z2); + _row3 = FVector(x3, y3, z3); +} + +void FMatrix::fn3(FMatrix *m) { + double x1 = _row2._x * m->_row1._y + m->_row1._z * _row3._x + _row1._x * m->_row1._x; + double y1 = m->_row1._x * _row1._y + _row3._y * m->_row1._z + _row2._y * m->_row1._y; + double z1 = m->_row1._x * _row1._z + m->_row1._y * _row2._z + m->_row1._z * _row3._z; + double x2 = _row1._x * m->_row2._x + _row2._x * m->_row2._y + _row3._x * m->_row2._z; + double y2 = _row3._y * m->_row2._z + _row1._y * m->_row2._x + _row2._y * m->_row2._y; + double z2 = m->_row2._z * _row3._z + m->_row2._x * _row1._z + m->_row2._y * _row2._z; + double x3 = _row1._x * m->_row3._x + m->_row3._z * _row3._x + m->_row3._y * _row2._x; + double y3 = m->_row3._y * _row2._y + m->_row3._z * _row3._y + m->_row3._x * _row1._y; + double z3 = m->_row3._x * _row1._z + m->_row3._y * _row2._z + m->_row3._z * _row3._z; + + _row1 = FVector(x1, y1, z1); + _row2 = FVector(x2, y2, z2); + _row3 = FVector(x3, y3, z3); +} + } // End of namespace Titanic diff --git a/engines/titanic/star_control/fmatrix.h b/engines/titanic/star_control/fmatrix.h index e98b160f01..391e117472 100644 --- a/engines/titanic/star_control/fmatrix.h +++ b/engines/titanic/star_control/fmatrix.h @@ -30,6 +30,10 @@ namespace Titanic { class DMatrix; +/** + * Floating point matrix class. + * @remarks TODO: See if it can be merged with DMatrix + */ class FMatrix { private: FVector _row1; @@ -63,6 +67,25 @@ public: * Sets the data for the matrix */ void set(FVector *row1, FVector *row2, FVector *row3); + + void fn1(FVector *v); + + void fn2(FMatrix *m); + void fn3(FMatrix *m); + + /** + * Returns true if the passed matrix equals this one + */ + bool operator==(const FMatrix &src) { + return _row1 == src._row1 && _row2 == src._row2 && _row3 == src._row3; + } + + /** + * Returns true if the passed matrix does not equal this one + */ + bool operator!=(const FMatrix &src) { + return !operator==(src); + } }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/fpoint.h b/engines/titanic/star_control/fpoint.h index 5329ecb9e3..f2cef18ea5 100644 --- a/engines/titanic/star_control/fpoint.h +++ b/engines/titanic/star_control/fpoint.h @@ -25,12 +25,15 @@ namespace Titanic { -class FVector { +/** + * Floating point Point class + */ +class FPoint { public: double _x, _y; public: - FVector() : _x(0), _y(0) {} - FVector(double x, double y) : _x(x), _y(y) {} + FPoint() : _x(0), _y(0) {} + FPoint(double x, double y) : _x(x), _y(y) {} }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/fvector.cpp b/engines/titanic/star_control/fvector.cpp index 39d303c4dc..a7520bf508 100644 --- a/engines/titanic/star_control/fvector.cpp +++ b/engines/titanic/star_control/fvector.cpp @@ -21,8 +21,30 @@ */ #include "titanic/star_control/fvector.h" +#include "common/algorithm.h" namespace Titanic { +void FVector::fn1(FVector *v) { + v->_x = (ABS(_x - _y) < 0.00001 && ABS(_y - _z) < 0.00001 && + ABS(_x - _z) < 0.00001) ? -_x : _x; + v->_y = _y; + v->_z = _z; +} + +void FVector::multiply(FVector *dest, const FVector *src) { + dest->_x = (src->_z * _y) - (_z * src->_y); + dest->_y = (src->_x * _z) - (_x * src->_z); + dest->_z = (src->_y * _x) - (_y * src->_x); +} + +void FVector::fn3() { + double hyp = sqrt(_x * _x + _y * _y + _z * _z); + assert(hyp); + + _x *= 1.0 / hyp; + _y *= 1.0 / hyp; + _z *= 1.0 / hyp; +} } // End of namespace Titanic diff --git a/engines/titanic/star_control/fvector.h b/engines/titanic/star_control/fvector.h index 86e6e384ac..75ad2f8fe0 100644 --- a/engines/titanic/star_control/fvector.h +++ b/engines/titanic/star_control/fvector.h @@ -25,12 +25,34 @@ namespace Titanic { +/** + * Floating point vector class. + * @remarks TODO: See if it can be merged with DVector + */ class FVector { public: double _x, _y, _z; public: FVector() : _x(0), _y(0), _z(0) {} FVector(double x, double y, double z) : _x(x), _y(y), _z(z) {} + + void fn1(FVector *v); + void multiply(FVector *dest, const FVector *src); + void fn3(); + + /** + * Returns true if the passed vector equals this one + */ + bool operator==(const FVector &src) const { + return _x != src._x || _y != src._y || _z != src._z; + } + + /** + * Returns true if the passed vector does not equal this one + */ + bool operator!=(const FVector &src) const { + return !operator==(src); + } }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub21.cpp b/engines/titanic/star_control/star_control_sub21.cpp index 958ee3813e..b606d15b41 100644 --- a/engines/titanic/star_control/star_control_sub21.cpp +++ b/engines/titanic/star_control/star_control_sub21.cpp @@ -20,125 +20,9 @@ * */ -#include "titanic/star_control/star_control_sub20.h" +#include "titanic/star_control/star_control_sub21.h" #include "common/textconsole.h" namespace Titanic { -CStarControlSub20::CStarControlSub20(void *src) { - _lockCounter = 0; - _dataP = nullptr; - - if (src) { - copyFrom1(src); - } else { - _field4 = 0.0; - _field8 = 0.0; - _fieldC = 20.0; - _field10 = 0.0; - _field14 = 50000.0; - _field18 = 1.0; - _field1C = 1.0; - _field20 = 0.0; - } -} - -CStarControlSub20::~CStarControlSub20() { - clear(); -} - -void CStarControlSub20::copyFrom1(void *src) { - error("TODO: CStarControlSub20::copyFrom1"); -} - -void CStarControlSub20::copyFrom2(void *src) { - error("TODO: CStarControlSub20::copyFrom2"); -} - -void CStarControlSub20::proc4() { - if (!isLocked() && _field4 < _field14) { - _field8 += _field4; - if (_fieldC == _field8) - _field4 -= _field8; - else - _field4 += _field8; - } -} - -void CStarControlSub20::proc5() { - if (!isLocked()) { - _field8 -= _fieldC; - if (_field8 == _field4) - _field4 += _field8; - else - _field4 -= _field8; - - if (_field8 < 0.0) - _field8 = 0.0; - } -} - -void CStarControlSub20::proc6() { - if (!isLocked()) - _field4 = _field14; -} - -void CStarControlSub20::proc7() { - if (!isLocked()) { - _field4 = 0.0; - _field8 = 0.0; - } -} - -void CStarControlSub20::proc11(CErrorCode *errorCode, void *v2, void *v3) { - if (_field4 > 0.0) { - warning("TODO: CStarControlSub20::proc11"); - } -} - -void CStarControlSub20::setData(void *data) { - clear(); - _dataP = data; -} - -void CStarControlSub20::clear() { - if (_dataP) { - delete _dataP; - _dataP = nullptr; - } -} - -void CStarControlSub20::load(SimpleFile *file, int val) { - if (!val) { - _field4 = file->readFloat(); - _field8 = file->readFloat(); - _fieldC = file->readFloat(); - _field10 = file->readFloat(); - _field14 = file->readFloat(); - _field18 = file->readFloat(); - _field1C = file->readFloat(); - _field20 = file->readFloat(); - } -} - -void CStarControlSub20::save(SimpleFile *file, int indent) { - file->writeFloatLine(_field4, indent); - file->writeFloatLine(_field8, indent); - file->writeFloatLine(_fieldC, indent); - file->writeFloatLine(_field10, indent); - file->writeFloatLine(_field14, indent); - file->writeFloatLine(_field18, indent); - file->writeFloatLine(_field1C, indent); - file->writeFloatLine(_field20, indent); -} - -void CStarControlSub20::incLockCount() { - ++_lockCounter; -} - -void CStarControlSub20::decLockCount() { - if (_lockCounter > 0) - --_lockCounter; -} - } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub6.cpp b/engines/titanic/star_control/star_control_sub6.cpp index c4161813f4..dfa23d65b6 100644 --- a/engines/titanic/star_control/star_control_sub6.cpp +++ b/engines/titanic/star_control/star_control_sub6.cpp @@ -29,15 +29,7 @@ CStarControlSub6::CStarControlSub6() { } void CStarControlSub6::clear() { - _field0 = 0x3F800000; - _field4 = 0; - _field8 = 0; - _fieldC = 0; - _field10 = 0x3F800000; - _field14 = 0; - _field18 = 0; - _field1C = 0; - _field20 = 0x3F800000; + _matrix.clear(); _field24 = 0; _field28 = 0; _field2C = 0; diff --git a/engines/titanic/star_control/star_control_sub6.h b/engines/titanic/star_control/star_control_sub6.h index 3531c76d1b..0c477ee345 100644 --- a/engines/titanic/star_control/star_control_sub6.h +++ b/engines/titanic/star_control/star_control_sub6.h @@ -23,19 +23,13 @@ #ifndef TITANIC_STAR_CONTROL_SUB6_H #define TITANIC_STAR_CONTROL_SUB6_H +#include "titanic/star_control/fmatrix.h" + namespace Titanic { class CStarControlSub6 { private: - int _field0; - int _field4; - int _field8; - int _fieldC; - int _field10; - int _field14; - int _field18; - int _field1C; - int _field20; + FMatrix _matrix; int _field24; int _field28; int _field2C; -- cgit v1.2.3 From e674116edbd61054dae994033c0b0c10259b8aed Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 16 Jul 2016 17:05:51 -0400 Subject: TITANIC: More FVector methods --- engines/titanic/star_control/fvector.cpp | 20 ++++++++++++++++++++ engines/titanic/star_control/fvector.h | 8 ++++++++ 2 files changed, 28 insertions(+) diff --git a/engines/titanic/star_control/fvector.cpp b/engines/titanic/star_control/fvector.cpp index a7520bf508..ce7b62bc16 100644 --- a/engines/titanic/star_control/fvector.cpp +++ b/engines/titanic/star_control/fvector.cpp @@ -22,6 +22,7 @@ #include "titanic/star_control/fvector.h" #include "common/algorithm.h" +#include "common/textconsole.h" namespace Titanic { @@ -47,4 +48,23 @@ void FVector::fn3() { _z *= 1.0 / hyp; } +double FVector::getDistance(const FVector *src) const { + double xd = src->_x - _x; + double yd = src->_y - _y; + double zd = src->_z - _z; + + return sqrt(xd * xd + yd * yd + zd * zd); +} + +void FVector::fn4(FVector *dest, const FVector *v1, const FVector *v2) { + FVector tempVector(v1->_x + v2->_x, v1->_y + v2->_y, v1->_z + v2->_z); + tempVector.fn3(); + + *dest = tempVector; +} + +void FVector::fn5(FVector *dest, const void *v) const { + error("TODO: FVector::fn5"); +} + } // End of namespace Titanic diff --git a/engines/titanic/star_control/fvector.h b/engines/titanic/star_control/fvector.h index 75ad2f8fe0..9af18dc71a 100644 --- a/engines/titanic/star_control/fvector.h +++ b/engines/titanic/star_control/fvector.h @@ -40,6 +40,14 @@ public: void multiply(FVector *dest, const FVector *src); void fn3(); + /** + * Returns the distance between a specified point and this one + */ + double getDistance(const FVector *src) const; + + static void fn4(FVector *dest, const FVector *v1, const FVector *v2); + void fn5(FVector *dest, const void *v) const; + /** * Returns true if the passed vector equals this one */ -- cgit v1.2.3 From 1b06a9294ac40dbba1437806e222e4cbdd32c016 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 16 Jul 2016 18:23:25 -0400 Subject: TITANIC: Setup of CStarControlSub6 class --- engines/titanic/star_control/fmatrix.h | 8 +-- engines/titanic/star_control/star_control.cpp | 6 ++ engines/titanic/star_control/star_control.h | 1 + engines/titanic/star_control/star_control_sub6.cpp | 65 ++++++++++++++++++++++ engines/titanic/star_control/star_control_sub6.h | 14 +++++ 5 files changed, 90 insertions(+), 4 deletions(-) diff --git a/engines/titanic/star_control/fmatrix.h b/engines/titanic/star_control/fmatrix.h index 391e117472..5dbbe99253 100644 --- a/engines/titanic/star_control/fmatrix.h +++ b/engines/titanic/star_control/fmatrix.h @@ -35,15 +35,15 @@ class DMatrix; * @remarks TODO: See if it can be merged with DMatrix */ class FMatrix { -private: - FVector _row1; - FVector _row2; - FVector _row3; private: /** * Copys data from a given source */ void copyFrom(const DMatrix *src); +public: + FVector _row1; + FVector _row2; + FVector _row3; public: FMatrix(); FMatrix(DMatrix *src); diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp index 8ab247e2aa..0e54cf5399 100644 --- a/engines/titanic/star_control/star_control.cpp +++ b/engines/titanic/star_control/star_control.cpp @@ -23,6 +23,7 @@ #include "titanic/support/screen_manager.h" #include "titanic/star_control/star_control.h" #include "titanic/star_control/error_code.h" +#include "titanic/star_control/star_control_sub6.h" namespace Titanic { @@ -35,6 +36,11 @@ END_MESSAGE_MAP() CStarControl::CStarControl() : _fieldBC(0), _field80B0(0), _starRect(20, 10, 620, 350) { + CStarControlSub6::init(); +} + +CStarControl::~CStarControl() { + CStarControlSub6::deinit(); } void CStarControl::save(SimpleFile *file, int indent) { diff --git a/engines/titanic/star_control/star_control.h b/engines/titanic/star_control/star_control.h index 0c1fab73e0..c771373135 100644 --- a/engines/titanic/star_control/star_control.h +++ b/engines/titanic/star_control/star_control.h @@ -49,6 +49,7 @@ private: public: CLASSDEF CStarControl(); + virtual ~CStarControl(); /** * Save the data for the class to file diff --git a/engines/titanic/star_control/star_control_sub6.cpp b/engines/titanic/star_control/star_control_sub6.cpp index dfa23d65b6..2022ab8aa6 100644 --- a/engines/titanic/star_control/star_control_sub6.cpp +++ b/engines/titanic/star_control/star_control_sub6.cpp @@ -24,10 +24,24 @@ namespace Titanic { +CStarControlSub6 *CStarControlSub6::_static; + CStarControlSub6::CStarControlSub6() { clear(); } +CStarControlSub6::CStarControlSub6(int mode, double val) { + set(mode, val); +} + +void CStarControlSub6::init() { + _static = nullptr; +} + +void CStarControlSub6::deinit() { + delete _static; +} + void CStarControlSub6::clear() { _matrix.clear(); _field24 = 0; @@ -35,4 +49,55 @@ void CStarControlSub6::clear() { _field2C = 0; } +void CStarControlSub6::set(int mode, double amount) { + const double ROTATION = 3.1415927 * 0.0055555557; + double sinVal = sin(amount * ROTATION); + double cosVal = cos(amount * ROTATION); + + switch (mode) { + case 0: + _matrix._row1._x = 1.0; + _matrix._row1._y = 0.0; + _matrix._row1._z = 0.0; + _matrix._row2._x = 0.0; + _matrix._row2._y = cosVal; + _matrix._row2._z = sinVal; + _matrix._row3._x = 0.0; + _matrix._row3._y = -sinVal; + _matrix._row3._z = cosVal; + break; + + case 1: + _matrix._row1._x = cosVal; + _matrix._row1._y = 0.0; + _matrix._row1._z = sinVal; + _matrix._row2._x = 0.0; + _matrix._row2._y = 1.0; + _matrix._row2._z = 0.0; + _matrix._row3._x = -sinVal; + _matrix._row3._y = 0.0; + _matrix._row3._z = sinVal; + break; + + case 2: + _matrix._row1._x = cosVal; + _matrix._row1._y = sinVal; + _matrix._row1._z = 0.0; + _matrix._row2._x = -sinVal; + _matrix._row2._y = cosVal; + _matrix._row2._z = 0.0; + _matrix._row3._x = 0.0; + _matrix._row3._y = 0.0; + _matrix._row3._z = 1.0; + break; + + default: + break; + } + + _field24 = 0.0; + _field28 = 0.0; + _field2C = 0.0; +} + } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub6.h b/engines/titanic/star_control/star_control_sub6.h index 0c477ee345..10058f5888 100644 --- a/engines/titanic/star_control/star_control_sub6.h +++ b/engines/titanic/star_control/star_control_sub6.h @@ -33,10 +33,24 @@ private: int _field24; int _field28; int _field2C; +private: + static CStarControlSub6 *_static; +public: + static void init(); + static void deinit(); public: CStarControlSub6(); + CStarControlSub6(int mode, double amount); + /** + * Clear the item + */ void clear(); + + /** + * Sets the default data + */ + void set(int mode, double val); }; } // End of namespace Titanic -- cgit v1.2.3 From 0118919d358332f243713b69e6fff163413146a3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 16 Jul 2016 21:41:51 -0400 Subject: TITANIC: Further work on DMatrix --- engines/titanic/star_control/dmatrix.cpp | 75 +++++++++++++++++++++- engines/titanic/star_control/dmatrix.h | 21 +++++- engines/titanic/star_control/star_control.cpp | 3 + .../titanic/star_control/star_control_sub26.cpp | 6 ++ engines/titanic/star_control/star_control_sub26.h | 18 +++--- engines/titanic/star_control/star_control_sub6.cpp | 1 + 6 files changed, 112 insertions(+), 12 deletions(-) diff --git a/engines/titanic/star_control/dmatrix.cpp b/engines/titanic/star_control/dmatrix.cpp index 160dccafe1..70008054b6 100644 --- a/engines/titanic/star_control/dmatrix.cpp +++ b/engines/titanic/star_control/dmatrix.cpp @@ -21,13 +21,84 @@ */ #include "titanic/star_control/dmatrix.h" +#include "titanic/star_control/fmatrix.h" +#include "titanic/star_control/star_control_sub26.h" namespace Titanic { +DMatrix *DMatrix::_static; + DMatrix::DMatrix() : - _row1(1.0, 0.0, 0.0), _row2(0.0, 1.0, 0.0), _row3(0.0, 0.0, 1.0), - _row4(0.0, 0.0, 0.0) { + _row1(1.0, 0.0, 0.0), _row2(0.0, 1.0, 0.0), _row3(0.0, 0.0, 1.0) { +} + +DMatrix::DMatrix(int mode, const FMatrix *src) { + assert(!mode); + + _row1._x = 1.0; + _row2._y = 1.0; + _row3._z = 1.0; + _frow1._x = src->_row1._x; + _frow1._y = src->_row1._y; + _frow1._z = src->_row1._z; + _frow2._x = src->_row2._x; + _frow2._y = src->_row2._y; + _frow2._z = src->_row2._z; +} + +DMatrix::DMatrix(int mode, double val) { + set(mode, val); +} + +void DMatrix::init() { + _static = nullptr; +} + +void DMatrix::deinit() { + delete _static; + _static = nullptr; } +void DMatrix::set(int mode, double amount) { + const double FACTOR = 0.0174532925199433; + double sinVal = sin(amount * FACTOR); + double cosVal = cos(amount * FACTOR); + + switch (mode) { + case 0: + _row1._x = 1.0; + _row2._y = cosVal; + _row2._z = sinVal; + _row3._y = -sinVal; + _row3._z = cosVal; + break; + + case 1: + _row1._x = cosVal; + _row1._z = sinVal; + _row2._y = 1.0; + _row3._x = -sinVal; + _row3._z = cosVal; + break; + + case 2: + _row1._x = cosVal; + _row1._y = sinVal; + _row2._x = -sinVal; + _row2._y = cosVal; + _row3._z = 1.0; + break; + + default: + break; + } +} + +void DMatrix::fn3(CStarControlSub26 *sub26) { + double v = sub26->fn1(); + v = (v < 0.0) ? 0.0 : 2.0 / v; + + error("TODO: DMatrix::fn3 %d", (int)v); +} } // End of namespace Titanic diff --git a/engines/titanic/star_control/dmatrix.h b/engines/titanic/star_control/dmatrix.h index 565df80cd1..14f6bb0331 100644 --- a/engines/titanic/star_control/dmatrix.h +++ b/engines/titanic/star_control/dmatrix.h @@ -24,21 +24,40 @@ #define TITANIC_DMATRIX_H #include "titanic/star_control/dvector.h" +#include "titanic/star_control/fvector.h" namespace Titanic { +class FMatrix; +class CStarControlSub26; + /** * Double based matrix class. * @remarks TODO: See if it can be merged with FMatrix */ class DMatrix { private: + static DMatrix *_static; +public: DVector _row1; DVector _row2; DVector _row3; - DVector _row4; + FVector _frow1; + FVector _frow2; +public: + static void init(); + static void deinit(); public: DMatrix(); + DMatrix(int mode, const FMatrix *src); + DMatrix(int mode, double val); + + /** + * Sets up data for the matrix + */ + void set(int mode, double amount); + + void fn3(CStarControlSub26 *sub26); }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp index 0e54cf5399..e048d11e88 100644 --- a/engines/titanic/star_control/star_control.cpp +++ b/engines/titanic/star_control/star_control.cpp @@ -22,6 +22,7 @@ #include "titanic/support/screen_manager.h" #include "titanic/star_control/star_control.h" +#include "titanic/star_control/dmatrix.h" #include "titanic/star_control/error_code.h" #include "titanic/star_control/star_control_sub6.h" @@ -37,10 +38,12 @@ END_MESSAGE_MAP() CStarControl::CStarControl() : _fieldBC(0), _field80B0(0), _starRect(20, 10, 620, 350) { CStarControlSub6::init(); + DMatrix::init(); } CStarControl::~CStarControl() { CStarControlSub6::deinit(); + DMatrix::deinit(); } void CStarControl::save(SimpleFile *file, int indent) { diff --git a/engines/titanic/star_control/star_control_sub26.cpp b/engines/titanic/star_control/star_control_sub26.cpp index 9d796a0475..89ff93c347 100644 --- a/engines/titanic/star_control/star_control_sub26.cpp +++ b/engines/titanic/star_control/star_control_sub26.cpp @@ -25,4 +25,10 @@ namespace Titanic { +double CStarControlSub26::fn1() const { + return _sub._v1 * _sub._v1 + _sub._v2 * _sub._v2 + + _sub._v3 * _sub._v3 + _field0 * _field0; +} + + } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub26.h b/engines/titanic/star_control/star_control_sub26.h index cf0c62afeb..4054a2ba6e 100644 --- a/engines/titanic/star_control/star_control_sub26.h +++ b/engines/titanic/star_control/star_control_sub26.h @@ -27,19 +27,19 @@ namespace Titanic { class CStarControlSub26 { struct Sub { - int _field0; - int _field4; - int _field8; - int _field10; - int _field14; + double _v1; + double _v2; + double _v3; - Sub() : _field0(0), _field4(0), _field8(0), _field10(0), _field14(0) {} + Sub() : _v1(0.0), _v2(0.0), _v3(0.0) {} }; public: - int _field0; - double _field4; + double _field0; + Sub _sub; public: - CStarControlSub26() : _field0(0), _field4(1.875) {} + CStarControlSub26() : _field0(1.0) {} + + double fn1() const; }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub6.cpp b/engines/titanic/star_control/star_control_sub6.cpp index 2022ab8aa6..83abc22c6f 100644 --- a/engines/titanic/star_control/star_control_sub6.cpp +++ b/engines/titanic/star_control/star_control_sub6.cpp @@ -40,6 +40,7 @@ void CStarControlSub6::init() { void CStarControlSub6::deinit() { delete _static; + _static = nullptr; } void CStarControlSub6::clear() { -- cgit v1.2.3 From dee69e206906f59d6af5f6e6351d5b9d8770221f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 16 Jul 2016 22:02:09 -0400 Subject: TITANIC: Renaming of star point classes --- engines/titanic/module.mk | 6 +-- engines/titanic/star_control/star_array.cpp | 62 ---------------------- engines/titanic/star_control/star_array.h | 57 -------------------- engines/titanic/star_control/star_control_sub1.cpp | 4 +- engines/titanic/star_control/star_control_sub1.h | 8 +-- engines/titanic/star_control/star_control_sub9.cpp | 57 -------------------- engines/titanic/star_control/star_control_sub9.h | 53 ------------------ engines/titanic/star_control/star_points1.cpp | 62 ++++++++++++++++++++++ engines/titanic/star_control/star_points1.h | 53 ++++++++++++++++++ engines/titanic/star_control/star_points2.cpp | 57 ++++++++++++++++++++ engines/titanic/star_control/star_points2.h | 53 ++++++++++++++++++ 11 files changed, 234 insertions(+), 238 deletions(-) delete mode 100644 engines/titanic/star_control/star_array.cpp delete mode 100644 engines/titanic/star_control/star_array.h delete mode 100644 engines/titanic/star_control/star_control_sub9.cpp delete mode 100644 engines/titanic/star_control/star_control_sub9.h create mode 100644 engines/titanic/star_control/star_points1.cpp create mode 100644 engines/titanic/star_control/star_points1.h create mode 100644 engines/titanic/star_control/star_points2.cpp create mode 100644 engines/titanic/star_control/star_points2.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 9dfbc92986..96715f2c6d 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -423,7 +423,6 @@ MODULE_OBJS := \ star_control/fmatrix.o \ star_control/fpoint.o \ star_control/fvector.o \ - star_control/star_array.o \ star_control/star_control_sub1.o \ star_control/star_control_sub2.o \ star_control/star_control_sub4.o \ @@ -431,8 +430,6 @@ MODULE_OBJS := \ star_control/star_control_sub6.o \ star_control/star_control_sub7.o \ star_control/star_control_sub8.o \ - star_control/star_control_sub9.o \ - star_control/star_view.o \ star_control/star_control_sub12.o \ star_control/star_control_sub13.o \ star_control/star_control_sub20.o \ @@ -442,6 +439,9 @@ MODULE_OBJS := \ star_control/star_control_sub24.o \ star_control/star_control_sub25.o \ star_control/star_control_sub26.o \ + star_control/star_points1.o \ + star_control/star_points2.o \ + star_control/star_view.o \ star_control/surface_area.o \ star_control/surface_fader_base.o \ star_control/surface_fader.o \ diff --git a/engines/titanic/star_control/star_array.cpp b/engines/titanic/star_control/star_array.cpp deleted file mode 100644 index 2e4a928aa2..0000000000 --- a/engines/titanic/star_control/star_array.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* 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 "titanic/star_control/star_array.h" -#include "titanic/star_control/star_control_sub12.h" -#include "titanic/titanic.h" - -namespace Titanic { - -#define ARRAY_COUNT 876 -const double FACTOR = 3.1415927 * 0.0055555557; - -CStarArray::CStarArray() { -} - -void CStarArray::initialize() { - // Get a reference to the starfield points resource - Common::SeekableReadStream *stream = g_vm->_filesManager->getResource("STARFIELD/POINTS"); - assert(stream && stream->size() == (12 * ARRAY_COUNT)); - - _data.resize(ARRAY_COUNT); - for (int idx = 0; idx < ARRAY_COUNT; ++idx) { - CStarArrayEntry &entry = _data[idx]; - - // Get the next set of values - double v1 = stream->readUint32LE(); - double v2 = stream->readUint32LE(); - stream->readUint32LE(); - - v1 *= 0.0099999998 * FACTOR; - v2 *= 0.015 * FACTOR; - - entry._v1 = cos(v2) * 3000000.0 * cos(v1); - entry._v2 = sin(v2) * 3000000.0 * cos(v1); - entry._v3 = sin(v1) * 3000000.0; - } -} - -void CStarArray::draw(CSurfaceArea *surface, CStarControlSub12 *img) { - // TODO -} - -} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_array.h b/engines/titanic/star_control/star_array.h deleted file mode 100644 index 827af01739..0000000000 --- a/engines/titanic/star_control/star_array.h +++ /dev/null @@ -1,57 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_STAR_ARRAY_H -#define TITANIC_STAR_ARRAY_H - -#include "common/array.h" -#include "titanic/star_control/surface_area.h" - -namespace Titanic { - -class CStarControlSub12; - -class CStarArray { - struct CStarArrayEntry { - double _v1; - double _v2; - double _v3; - }; -private: - Common::Array _data; -public: - CStarArray(); - - /** - * Initialize the array - */ - void initialize(); - - /** - * Draw the starfield points - */ - void draw(CSurfaceArea *surface, CStarControlSub12 *img); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_STAR_ARRAY_H */ diff --git a/engines/titanic/star_control/star_control_sub1.cpp b/engines/titanic/star_control/star_control_sub1.cpp index 75dc2303f1..c3a268eee3 100644 --- a/engines/titanic/star_control/star_control_sub1.cpp +++ b/engines/titanic/star_control/star_control_sub1.cpp @@ -43,8 +43,8 @@ void CStarControlSub1::load(SimpleFile *file, int param) { bool CStarControlSub1::initDocument() { warning("CStarControlSub1::initDocument"); - _starArray.initialize(); - _sub9.initialize(); + _points1.initialize(); + _points2.initialize(); return true; } diff --git a/engines/titanic/star_control/star_control_sub1.h b/engines/titanic/star_control/star_control_sub1.h index 0e99b4ef72..dd7ae5f20c 100644 --- a/engines/titanic/star_control/star_control_sub1.h +++ b/engines/titanic/star_control/star_control_sub1.h @@ -23,12 +23,12 @@ #ifndef TITANIC_STAR_CONTROL_SUB1_H #define TITANIC_STAR_CONTROL_SUB1_H -#include "titanic/star_control/star_array.h" #include "titanic/star_control/star_control_sub2.h" #include "titanic/star_control/star_control_sub5.h" #include "titanic/star_control/star_control_sub7.h" #include "titanic/star_control/star_control_sub8.h" -#include "titanic/star_control/star_control_sub9.h" +#include "titanic/star_control/star_points1.h" +#include "titanic/star_control/star_points2.h" namespace Titanic { @@ -36,8 +36,8 @@ class CStarControlSub1 : public CStarControlSub2 { private: CStarControlSub7 _sub7; CStarControlSub8 _sub8; - CStarControlSub9 _sub9; - CStarArray _starArray; + CStarPoints1 _points1; + CStarPoints2 _points2; CStarControlSub5 _sub5; int _field7DA8; int _field7DAC; diff --git a/engines/titanic/star_control/star_control_sub9.cpp b/engines/titanic/star_control/star_control_sub9.cpp deleted file mode 100644 index 292e9a87d0..0000000000 --- a/engines/titanic/star_control/star_control_sub9.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* 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 "titanic/star_control/star_control_sub9.h" -#include "titanic/titanic.h" - -namespace Titanic { - -#define ARRAY_COUNT 80 -const double FACTOR = 3.1415927 * 0.0055555557; - -void CStarControlSub9::initialize() { - // Get a reference to the starfield points resource - Common::SeekableReadStream *stream = g_vm->_filesManager->getResource("STARFIELD/POINTS2"); - - _data.resize(ARRAY_COUNT); - for (int rootCtr = 0; rootCtr < ARRAY_COUNT; ++rootCtr) { - // Get the number of sub-entries for this entry - int count = stream->readUint32LE(); - double v1, v2; - - // Read in the sub-entries - RootEntry &rootEntry = _data[rootCtr]; - rootEntry.resize(count * 2); - for (int idx = 0; idx < count * 2; ++idx) { - DataEntry &entry = rootEntry[idx]; - v1 = stream->readSint32LE(); - v2 = stream->readSint32LE(); - v1 *= 0.015 * FACTOR; - v2 *= 0.0099999998 * FACTOR; - entry._v1 = cos(v1) * 3000000.0 * cos(v2); - entry._v2 = sin(v1) * 3000000.0 * cos(v2); - entry._v3 = sin(v2) * 3000000.0; - } - } -} - -} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub9.h b/engines/titanic/star_control/star_control_sub9.h deleted file mode 100644 index 5f334f48d1..0000000000 --- a/engines/titanic/star_control/star_control_sub9.h +++ /dev/null @@ -1,53 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_STAR_CONTROL_SUB9_H -#define TITANIC_STAR_CONTROL_SUB9_H - -#include "common/array.h" - -namespace Titanic { - -class CStarControlSub9 { - struct DataEntry { - int _v1; - int _v2; - int _v3; - }; - - class RootEntry : public Common::Array { - public: - int _field0; - RootEntry() : _field0(0) {} - }; -private: - Common::Array _data; -public: - /** - * Initializes the data - */ - void initialize(); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_STAR_CONTROL_SUB9_H */ diff --git a/engines/titanic/star_control/star_points1.cpp b/engines/titanic/star_control/star_points1.cpp new file mode 100644 index 0000000000..9e684f3c10 --- /dev/null +++ b/engines/titanic/star_control/star_points1.cpp @@ -0,0 +1,62 @@ +/* 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 "titanic/star_control/star_points1.h" +#include "titanic/star_control/star_control_sub12.h" +#include "titanic/titanic.h" + +namespace Titanic { + +#define ARRAY_COUNT 876 +const double FACTOR = 3.1415927 * 0.0055555557; + +CStarPoints1::CStarPoints1() { +} + +void CStarPoints1::initialize() { + // Get a reference to the starfield points resource + Common::SeekableReadStream *stream = g_vm->_filesManager->getResource("STARFIELD/POINTS"); + assert(stream && stream->size() == (12 * ARRAY_COUNT)); + + _data.resize(ARRAY_COUNT); + for (int idx = 0; idx < ARRAY_COUNT; ++idx) { + FVector &entry = _data[idx]; + + // Get the next set of values + double v1 = stream->readUint32LE(); + double v2 = stream->readUint32LE(); + stream->readUint32LE(); + + v1 *= 0.0099999998 * FACTOR; + v2 *= 0.015 * FACTOR; + + entry._x = cos(v2) * 3000000.0 * cos(v1); + entry._y = sin(v2) * 3000000.0 * cos(v1); + entry._z = sin(v1) * 3000000.0; + } +} + +void CStarPoints1::draw(CSurfaceArea *surface, CStarControlSub12 *img) { + // TODO +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_points1.h b/engines/titanic/star_control/star_points1.h new file mode 100644 index 0000000000..41fb6b488e --- /dev/null +++ b/engines/titanic/star_control/star_points1.h @@ -0,0 +1,53 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_POINTS1_H +#define TITANIC_STAR_POINTS1_H + +#include "common/array.h" +#include "titanic/star_control/surface_area.h" +#include "titanic/star_control/fvector.h" + +namespace Titanic { + +class CStarControlSub12; + +class CStarPoints1 { +private: + Common::Array _data; +public: + CStarPoints1(); + + /** + * Initialize the array + */ + void initialize(); + + /** + * Draw the starfield points + */ + void draw(CSurfaceArea *surface, CStarControlSub12 *img); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_POINTS1_H */ diff --git a/engines/titanic/star_control/star_points2.cpp b/engines/titanic/star_control/star_points2.cpp new file mode 100644 index 0000000000..10d10e1836 --- /dev/null +++ b/engines/titanic/star_control/star_points2.cpp @@ -0,0 +1,57 @@ +/* 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 "titanic/star_control/star_points2.h" +#include "titanic/titanic.h" + +namespace Titanic { + +#define ARRAY_COUNT 80 +const double FACTOR = 3.1415927 * 0.0055555557; + +void CStarPoints2::initialize() { + // Get a reference to the starfield points resource + Common::SeekableReadStream *stream = g_vm->_filesManager->getResource("STARFIELD/POINTS2"); + + _data.resize(ARRAY_COUNT); + for (int rootCtr = 0; rootCtr < ARRAY_COUNT; ++rootCtr) { + // Get the number of sub-entries for this entry + int count = stream->readUint32LE(); + double v1, v2; + + // Read in the sub-entries + RootEntry &rootEntry = _data[rootCtr]; + rootEntry.resize(count * 2); + for (int idx = 0; idx < count * 2; ++idx) { + DataEntry &entry = rootEntry[idx]; + v1 = stream->readSint32LE(); + v2 = stream->readSint32LE(); + v1 *= 0.015 * FACTOR; + v2 *= 0.0099999998 * FACTOR; + entry._v1 = cos(v1) * 3000000.0 * cos(v2); + entry._v2 = sin(v1) * 3000000.0 * cos(v2); + entry._v3 = sin(v2) * 3000000.0; + } + } +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_points2.h b/engines/titanic/star_control/star_points2.h new file mode 100644 index 0000000000..0ba5e0a655 --- /dev/null +++ b/engines/titanic/star_control/star_points2.h @@ -0,0 +1,53 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_POINTS2_H +#define TITANIC_STAR_POINTS2_H + +#include "common/array.h" + +namespace Titanic { + +class CStarPoints2 { + struct DataEntry { + int _v1; + int _v2; + int _v3; + }; + + class RootEntry : public Common::Array { + public: + int _field0; + RootEntry() : _field0(0) {} + }; +private: + Common::Array _data; +public: + /** + * Initializes the data + */ + void initialize(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_POINTS2_H */ -- cgit v1.2.3 From c4e3cd87abbddef07436c83736cd3acebd0798aa Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 17 Jul 2016 10:44:35 -0400 Subject: TITANIC: Finished startfield initDocument --- engines/titanic/pet_control/pet_starfield.cpp | 4 +-- engines/titanic/star_control/star_control.cpp | 15 +++++---- engines/titanic/star_control/star_control.h | 15 +++++++-- engines/titanic/star_control/star_control_sub1.cpp | 38 +++++++++++++++------- engines/titanic/star_control/star_control_sub1.h | 21 ++++++++---- engines/titanic/star_control/star_control_sub2.cpp | 5 +++ engines/titanic/star_control/star_control_sub2.h | 5 +++ engines/titanic/star_control/star_control_sub5.cpp | 13 ++++++++ engines/titanic/star_control/star_control_sub5.h | 5 +++ engines/titanic/star_control/star_points1.cpp | 9 ++++- engines/titanic/star_control/star_points1.h | 2 +- engines/titanic/star_control/star_points2.cpp | 4 ++- engines/titanic/star_control/star_points2.h | 2 +- engines/titanic/star_control/star_view.cpp | 9 +++++ engines/titanic/star_control/star_view.h | 10 ++++++ 15 files changed, 124 insertions(+), 33 deletions(-) diff --git a/engines/titanic/pet_control/pet_starfield.cpp b/engines/titanic/pet_control/pet_starfield.cpp index 35ef943f54..34d696e09c 100644 --- a/engines/titanic/pet_control/pet_starfield.cpp +++ b/engines/titanic/pet_control/pet_starfield.cpp @@ -107,10 +107,10 @@ bool CPetStarfield::MouseButtonUpMsg(CMouseButtonUpMsg *msg) { if (_petControl) { CStarControl *starControl = _petControl->getStarControl(); - if (starControl) { + if (starControl && starControl->canSetStarDestination()) { CPETSetStarDestinationMsg starfieldMsg; starfieldMsg.execute(_petControl->_remoteTarget); - starControl->fn3(); + starControl->starDestinationSet(); } } diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp index e048d11e88..e8524320a2 100644 --- a/engines/titanic/star_control/star_control.cpp +++ b/engines/titanic/star_control/star_control.cpp @@ -126,17 +126,20 @@ void CStarControl::newFrame() { // TODO } +void CStarControl::fn1(int action) { + // TODO +} -void CStarControl::fn3() { - warning("CStarControl::fn3"); +bool CStarControl::fn4() { + return _sub1.get7(); } -void CStarControl::fn1(int v) { - warning("CStarControl::fn1"); +bool CStarControl::canSetStarDestination() const { + return _view.canSetStarDestination(); } -void CStarControl::fn4() { - warning("CStarControl::fn4"); +void CStarControl::starDestinationSet() { + _view.starDestinationSet(); } } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control.h b/engines/titanic/star_control/star_control.h index c771373135..43cfdc4a05 100644 --- a/engines/titanic/star_control/star_control.h +++ b/engines/titanic/star_control/star_control.h @@ -66,9 +66,18 @@ public: */ virtual void draw(CScreenManager *screenManager); - void fn1(int v); - void fn3(); - void fn4(); + void fn1(int action); + bool fn4(); + + /** + * Returns true if a star destination can be set + */ + bool canSetStarDestination() const; + + /** + * Called when a star destination is set + */ + void starDestinationSet(); }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub1.cpp b/engines/titanic/star_control/star_control_sub1.cpp index c3a268eee3..35bce35fc3 100644 --- a/engines/titanic/star_control/star_control_sub1.cpp +++ b/engines/titanic/star_control/star_control_sub1.cpp @@ -24,28 +24,42 @@ namespace Titanic { -CStarControlSub1::CStarControlSub1() : - _field7DA8(0), _field7DAC(0), _field7DB0(0), - _field7DB4(1), _field7DB8(0), _field7DBC(0) { +CStarControlSub1::CStarControlSub1() : _val1(0), _val2(0), _val3(0), _val4(1), + _val5(0), _val6(false) { } void CStarControlSub1::load(SimpleFile *file, int param) { if (!param) { _sub7.load(file); _sub8.load(file); - _field7DA8 = file->readNumber(); - _field7DAC = file->readNumber(); - _field7DB0 = file->readNumber(); - _field7DB4 = file->readNumber(); - _field7DBC = file->readNumber(); + _val1 = file->readNumber(); + _val2 = file->readNumber(); + _val3 = file->readNumber(); + _val4 = file->readNumber(); + _val6 = file->readNumber(); } } +void CStarControlSub1::save(SimpleFile *file, int indent) { + _sub7.save(file, indent); + _sub8.save(file, indent); + file->writeNumberLine(_val1, indent); + file->writeNumberLine(_val2, indent); + file->writeNumberLine(_val3, indent); + file->writeNumberLine(_val4, indent); + file->writeNumberLine(_val6, indent); +} + bool CStarControlSub1::initDocument() { - warning("CStarControlSub1::initDocument"); - _points1.initialize(); - _points2.initialize(); - return true; + bool valid = setup() && _points1.initialize(); + if (valid) + valid = _sub5.setup(); + if (valid) + valid = _points1.initialize(); + if (valid) + valid = _points2.initialize(); + + return valid; } } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub1.h b/engines/titanic/star_control/star_control_sub1.h index dd7ae5f20c..8aab0b6ab4 100644 --- a/engines/titanic/star_control/star_control_sub1.h +++ b/engines/titanic/star_control/star_control_sub1.h @@ -39,12 +39,13 @@ private: CStarPoints1 _points1; CStarPoints2 _points2; CStarControlSub5 _sub5; - int _field7DA8; - int _field7DAC; - int _field7DB0; - int _field7DB4; - int _field7DB8; - int _field7DBC; + int _val1; + int _val2; + int _val3; + int _val4; + int _val5; + int _val6; + bool _val7; public: CStarControlSub1(); @@ -53,7 +54,15 @@ public: */ void load(SimpleFile *file, int param); + /** + * Save the data for the class to file + */ + void save(SimpleFile *file, int indent); + bool initDocument(); + + int get6() const { return _val6; } + bool get7() const { return _val7; } }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub2.cpp b/engines/titanic/star_control/star_control_sub2.cpp index eeebaa157a..fcbb70cbcb 100644 --- a/engines/titanic/star_control/star_control_sub2.cpp +++ b/engines/titanic/star_control/star_control_sub2.cpp @@ -45,4 +45,9 @@ bool CStarControlSub2::proc7(int v1, int v2) { return true; } +bool CStarControlSub2::setup() { + // TODO + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub2.h b/engines/titanic/star_control/star_control_sub2.h index bfbe02c41c..cd7781548f 100644 --- a/engines/titanic/star_control/star_control_sub2.h +++ b/engines/titanic/star_control/star_control_sub2.h @@ -35,6 +35,11 @@ public: virtual bool proc4(int v1, int v2, int v3, int v4, int v5); virtual bool loadStar(); virtual bool proc7(int v1, int v2); + + /** + * Setup the control + */ + bool setup(); }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub5.cpp b/engines/titanic/star_control/star_control_sub5.cpp index 64e48e1814..e2899220c8 100644 --- a/engines/titanic/star_control/star_control_sub5.cpp +++ b/engines/titanic/star_control/star_control_sub5.cpp @@ -28,4 +28,17 @@ CStarControlSub5::CStarControlSub5() : _field4(1), _field78AC(0), _field78B0(0) { } +bool CStarControlSub5::setup() { + // TODO + return true; +} + +void CStarControlSub5::proc2() { + // TODO +} + +void CStarControlSub5::proc3(CErrorCode *errorCode) { + // TODO +} + } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub5.h b/engines/titanic/star_control/star_control_sub5.h index c3621e93b4..e245b29d10 100644 --- a/engines/titanic/star_control/star_control_sub5.h +++ b/engines/titanic/star_control/star_control_sub5.h @@ -24,6 +24,7 @@ #define TITANIC_STAR_CONTROL_SUB5_H #include "titanic/star_control/star_control_sub6.h" +#include "titanic/star_control/error_code.h" namespace Titanic { @@ -43,6 +44,10 @@ private: int _field78B0; public: CStarControlSub5(); + + virtual bool setup(); + virtual void proc2(); + virtual void proc3(CErrorCode *errorCode); }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_points1.cpp b/engines/titanic/star_control/star_points1.cpp index 9e684f3c10..6e698d61f7 100644 --- a/engines/titanic/star_control/star_points1.cpp +++ b/engines/titanic/star_control/star_points1.cpp @@ -32,7 +32,7 @@ const double FACTOR = 3.1415927 * 0.0055555557; CStarPoints1::CStarPoints1() { } -void CStarPoints1::initialize() { +bool CStarPoints1::initialize() { // Get a reference to the starfield points resource Common::SeekableReadStream *stream = g_vm->_filesManager->getResource("STARFIELD/POINTS"); assert(stream && stream->size() == (12 * ARRAY_COUNT)); @@ -53,9 +53,16 @@ void CStarPoints1::initialize() { entry._y = sin(v2) * 3000000.0 * cos(v1); entry._z = sin(v1) * 3000000.0; } + + return true; } void CStarPoints1::draw(CSurfaceArea *surface, CStarControlSub12 *img) { + if (_data.empty()) + return; + + + // TODO } diff --git a/engines/titanic/star_control/star_points1.h b/engines/titanic/star_control/star_points1.h index 41fb6b488e..a6e4ee2ec9 100644 --- a/engines/titanic/star_control/star_points1.h +++ b/engines/titanic/star_control/star_points1.h @@ -40,7 +40,7 @@ public: /** * Initialize the array */ - void initialize(); + bool initialize(); /** * Draw the starfield points diff --git a/engines/titanic/star_control/star_points2.cpp b/engines/titanic/star_control/star_points2.cpp index 10d10e1836..4fea298f93 100644 --- a/engines/titanic/star_control/star_points2.cpp +++ b/engines/titanic/star_control/star_points2.cpp @@ -28,7 +28,7 @@ namespace Titanic { #define ARRAY_COUNT 80 const double FACTOR = 3.1415927 * 0.0055555557; -void CStarPoints2::initialize() { +bool CStarPoints2::initialize() { // Get a reference to the starfield points resource Common::SeekableReadStream *stream = g_vm->_filesManager->getResource("STARFIELD/POINTS2"); @@ -52,6 +52,8 @@ void CStarPoints2::initialize() { entry._v3 = sin(v2) * 3000000.0; } } + + return true; } } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_points2.h b/engines/titanic/star_control/star_points2.h index 0ba5e0a655..31bded4069 100644 --- a/engines/titanic/star_control/star_points2.h +++ b/engines/titanic/star_control/star_points2.h @@ -45,7 +45,7 @@ public: /** * Initializes the data */ - void initialize(); + bool initialize(); }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp index 35920a38ba..5bfef41847 100644 --- a/engines/titanic/star_control/star_view.cpp +++ b/engines/titanic/star_control/star_view.cpp @@ -106,4 +106,13 @@ CErrorCode CStarView::KeyCharMsg(int key) { return CErrorCode(); } +bool CStarView::canSetStarDestination() const { + // TODO + return false; +} + +void CStarView::starDestinationSet() { + // TODO +} + } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_view.h b/engines/titanic/star_control/star_view.h index 7ec86b5d22..cc40fb4a16 100644 --- a/engines/titanic/star_control/star_view.h +++ b/engines/titanic/star_control/star_view.h @@ -88,6 +88,16 @@ public: * Handles keyboard messages */ CErrorCode KeyCharMsg(int key); + + /** + * Returns true if a star destination can be set + */ + bool canSetStarDestination() const; + + /** + * Called when a star destination is set + */ + void starDestinationSet(); }; } // End of namespace Titanic -- cgit v1.2.3 From 29c87fe375947a6683d81be7f4b24f7c04960fac Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 17 Jul 2016 13:02:47 -0400 Subject: TITANIC: Renamed CStarControlSub12 to CStarField --- engines/titanic/module.mk | 2 +- engines/titanic/star_control/star_control.cpp | 10 +-- engines/titanic/star_control/star_control.h | 4 +- engines/titanic/star_control/star_control_sub1.cpp | 65 ------------------- engines/titanic/star_control/star_control_sub1.h | 70 -------------------- engines/titanic/star_control/star_field.cpp | 69 ++++++++++++++++++++ engines/titanic/star_control/star_field.h | 75 ++++++++++++++++++++++ engines/titanic/star_control/star_view.cpp | 24 +++++-- engines/titanic/star_control/star_view.h | 8 ++- 9 files changed, 176 insertions(+), 151 deletions(-) delete mode 100644 engines/titanic/star_control/star_control_sub1.cpp delete mode 100644 engines/titanic/star_control/star_control_sub1.h create mode 100644 engines/titanic/star_control/star_field.cpp create mode 100644 engines/titanic/star_control/star_field.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 96715f2c6d..33e3558f72 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -423,7 +423,6 @@ MODULE_OBJS := \ star_control/fmatrix.o \ star_control/fpoint.o \ star_control/fvector.o \ - star_control/star_control_sub1.o \ star_control/star_control_sub2.o \ star_control/star_control_sub4.o \ star_control/star_control_sub5.o \ @@ -439,6 +438,7 @@ MODULE_OBJS := \ star_control/star_control_sub24.o \ star_control/star_control_sub25.o \ star_control/star_control_sub26.o \ + star_control/star_field.o \ star_control/star_points1.o \ star_control/star_points2.o \ star_control/star_view.o \ diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp index e8524320a2..e1e804f0df 100644 --- a/engines/titanic/star_control/star_control.cpp +++ b/engines/titanic/star_control/star_control.cpp @@ -48,7 +48,7 @@ CStarControl::~CStarControl() { void CStarControl::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - _sub1.save(file, indent); + _starField.save(file, indent); _view.save(file, indent); CGameObject::save(file, indent); } @@ -57,8 +57,8 @@ void CStarControl::load(SimpleFile *file) { int val = file->readNumber(); if (!val) { - _sub1.load(file, 0); - if (!_sub1.initDocument()) + _starField.load(file, 0); + if (!_starField.initDocument()) error("Couldn't initialise the StarField document"); _view.load(file, 0); @@ -66,7 +66,7 @@ void CStarControl::load(SimpleFile *file) { if (!screenManager) error("There's no screen manager during loading"); - _view.setup(screenManager, &_sub1, this); + _view.setup(screenManager, &_starField, this); _view.reset(); _fieldBC = 1; @@ -131,7 +131,7 @@ void CStarControl::fn1(int action) { } bool CStarControl::fn4() { - return _sub1.get7(); + return _starField.get7(); } bool CStarControl::canSetStarDestination() const { diff --git a/engines/titanic/star_control/star_control.h b/engines/titanic/star_control/star_control.h index 43cfdc4a05..2f6a86ad78 100644 --- a/engines/titanic/star_control/star_control.h +++ b/engines/titanic/star_control/star_control.h @@ -24,7 +24,7 @@ #define TITANIC_STAR_CONTROL_H #include "titanic/core/game_object.h" -#include "titanic/star_control/star_control_sub1.h" +#include "titanic/star_control/star_field.h" #include "titanic/star_control/star_view.h" namespace Titanic { @@ -37,7 +37,7 @@ class CStarControl : public CGameObject { bool FrameMsg(CFrameMsg *msg); private: int _fieldBC; - CStarControlSub1 _sub1; + CStarField _starField; CStarView _view; Rect _starRect; int _field80B0; diff --git a/engines/titanic/star_control/star_control_sub1.cpp b/engines/titanic/star_control/star_control_sub1.cpp deleted file mode 100644 index 35bce35fc3..0000000000 --- a/engines/titanic/star_control/star_control_sub1.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* 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 "titanic/star_control/star_control_sub1.h" - -namespace Titanic { - -CStarControlSub1::CStarControlSub1() : _val1(0), _val2(0), _val3(0), _val4(1), - _val5(0), _val6(false) { -} - -void CStarControlSub1::load(SimpleFile *file, int param) { - if (!param) { - _sub7.load(file); - _sub8.load(file); - _val1 = file->readNumber(); - _val2 = file->readNumber(); - _val3 = file->readNumber(); - _val4 = file->readNumber(); - _val6 = file->readNumber(); - } -} - -void CStarControlSub1::save(SimpleFile *file, int indent) { - _sub7.save(file, indent); - _sub8.save(file, indent); - file->writeNumberLine(_val1, indent); - file->writeNumberLine(_val2, indent); - file->writeNumberLine(_val3, indent); - file->writeNumberLine(_val4, indent); - file->writeNumberLine(_val6, indent); -} - -bool CStarControlSub1::initDocument() { - bool valid = setup() && _points1.initialize(); - if (valid) - valid = _sub5.setup(); - if (valid) - valid = _points1.initialize(); - if (valid) - valid = _points2.initialize(); - - return valid; -} - -} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub1.h b/engines/titanic/star_control/star_control_sub1.h deleted file mode 100644 index 8aab0b6ab4..0000000000 --- a/engines/titanic/star_control/star_control_sub1.h +++ /dev/null @@ -1,70 +0,0 @@ -/* 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. - * - */ - -#ifndef TITANIC_STAR_CONTROL_SUB1_H -#define TITANIC_STAR_CONTROL_SUB1_H - -#include "titanic/star_control/star_control_sub2.h" -#include "titanic/star_control/star_control_sub5.h" -#include "titanic/star_control/star_control_sub7.h" -#include "titanic/star_control/star_control_sub8.h" -#include "titanic/star_control/star_points1.h" -#include "titanic/star_control/star_points2.h" - -namespace Titanic { - -class CStarControlSub1 : public CStarControlSub2 { -private: - CStarControlSub7 _sub7; - CStarControlSub8 _sub8; - CStarPoints1 _points1; - CStarPoints2 _points2; - CStarControlSub5 _sub5; - int _val1; - int _val2; - int _val3; - int _val4; - int _val5; - int _val6; - bool _val7; -public: - CStarControlSub1(); - - /** - * Load the data for the class from file - */ - void load(SimpleFile *file, int param); - - /** - * Save the data for the class to file - */ - void save(SimpleFile *file, int indent); - - bool initDocument(); - - int get6() const { return _val6; } - bool get7() const { return _val7; } -}; - -} // End of namespace Titanic - -#endif /* TITANIC_STAR_CONTROL_SUB1_H */ diff --git a/engines/titanic/star_control/star_field.cpp b/engines/titanic/star_control/star_field.cpp new file mode 100644 index 0000000000..1d667c098b --- /dev/null +++ b/engines/titanic/star_control/star_field.cpp @@ -0,0 +1,69 @@ +/* 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 "titanic/star_control/star_field.h" + +namespace Titanic { + +CStarField::CStarField() : _val1(0), _val2(0), _val3(0), _val4(1), + _val5(0), _val6(false) { +} + +void CStarField::load(SimpleFile *file, int param) { + if (!param) { + _sub7.load(file); + _sub8.load(file); + _val1 = file->readNumber(); + _val2 = file->readNumber(); + _val3 = file->readNumber(); + _val4 = file->readNumber(); + _val6 = file->readNumber(); + } +} + +void CStarField::save(SimpleFile *file, int indent) { + _sub7.save(file, indent); + _sub8.save(file, indent); + file->writeNumberLine(_val1, indent); + file->writeNumberLine(_val2, indent); + file->writeNumberLine(_val3, indent); + file->writeNumberLine(_val4, indent); + file->writeNumberLine(_val6, indent); +} + +bool CStarField::initDocument() { + bool valid = setup() && _points1.initialize(); + if (valid) + valid = _sub5.setup(); + if (valid) + valid = _points1.initialize(); + if (valid) + valid = _points2.initialize(); + + return valid; +} + +void CStarField::draw(CVideoSurface *surface, CStarControlSub12 *sub12) { + // TODO +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_field.h b/engines/titanic/star_control/star_field.h new file mode 100644 index 0000000000..48c2721b6d --- /dev/null +++ b/engines/titanic/star_control/star_field.h @@ -0,0 +1,75 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_FIELD_H +#define TITANIC_STAR_FIELD_H + +#include "titanic/star_control/star_control_sub2.h" +#include "titanic/star_control/star_control_sub5.h" +#include "titanic/star_control/star_control_sub7.h" +#include "titanic/star_control/star_control_sub8.h" +#include "titanic/star_control/star_points1.h" +#include "titanic/star_control/star_points2.h" + +namespace Titanic { + +class CStarField : public CStarControlSub2 { +private: + CStarControlSub7 _sub7; + CStarControlSub8 _sub8; + CStarPoints1 _points1; + CStarPoints2 _points2; + CStarControlSub5 _sub5; + int _val1; + int _val2; + int _val3; + int _val4; + int _val5; + int _val6; + bool _val7; +public: + CStarField(); + + /** + * Load the data for the class from file + */ + void load(SimpleFile *file, int param); + + /** + * Save the data for the class to file + */ + void save(SimpleFile *file, int indent); + + bool initDocument(); + + /** + * Renders the contents of the starfield + */ + void draw(CVideoSurface *surface, CStarControlSub12 *sub12); + + int get6() const { return _val6; } + bool get7() const { return _val7; } +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_FIELD_H */ diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp index 5bfef41847..63bbed139b 100644 --- a/engines/titanic/star_control/star_view.cpp +++ b/engines/titanic/star_control/star_view.cpp @@ -23,12 +23,13 @@ #include "titanic/support/screen_manager.h" #include "titanic/star_control/star_view.h" #include "titanic/star_control/star_control.h" +#include "titanic/star_control/star_field.h" #include "titanic/core/game_object.h" namespace Titanic { CStarView::CStarView() : _sub12(nullptr, nullptr), _sub13(nullptr), - _owner(nullptr), _sub1(nullptr), _videoSurface(nullptr), _field118(0), + _owner(nullptr), _starField(nullptr), _videoSurface(nullptr), _field118(0), _videoSurface2(nullptr), _field210(0), _homePhotoMask(nullptr), _field218(0), _field21C(0) { _sub12.proc3(); @@ -58,8 +59,8 @@ void CStarView::save(SimpleFile *file, int indent) { file->writeNumberLine(_field21C, indent); } -void CStarView::setup(CScreenManager *screenManager, CStarControlSub1 *sub1, CStarControl *starControl) { - _sub1 = sub1; +void CStarView::setup(CScreenManager *screenManager, CStarField *starField, CStarControl *starControl) { + _starField = starField; _owner = starControl; } @@ -68,7 +69,7 @@ void CStarView::reset() { } void CStarView::draw(CScreenManager *screenManager) { - if (!screenManager || !_videoSurface || !_sub1) + if (!screenManager || !_videoSurface || !_starField) return; if (_fader.isActive()) { @@ -88,7 +89,16 @@ void CStarView::draw(CScreenManager *screenManager) { if (_homePhotoMask) _homePhotoMask->draw(screenManager, Point(20, 187)); } else { - // TODO + fn1(); + + // Render the display + _videoSurface->clear(); + _videoSurface->lock(); + _starField->draw(_videoSurface, &_sub12); + _videoSurface->unlock(); + + // Blit the resulting surface to the screen + screenManager->blitFrom(SURFACE_PRIMARY, _videoSurface, &destPos); } } } @@ -115,4 +125,8 @@ void CStarView::starDestinationSet() { // TODO } +void CStarView::fn1() { + // TODO +} + } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_view.h b/engines/titanic/star_control/star_view.h index cc40fb4a16..bcba5ac436 100644 --- a/engines/titanic/star_control/star_view.h +++ b/engines/titanic/star_control/star_view.h @@ -33,12 +33,12 @@ namespace Titanic { class CStarControl; -class CStarControlSub1; +class CStarField; class CStarView { private: CStarControl *_owner; - CStarControlSub1 *_sub1; + CStarField *_starField; CVideoSurface *_videoSurface; CStarControlSub12 _sub12; int _field118; @@ -49,6 +49,8 @@ private: CGameObject *_homePhotoMask; int _field218; int _field21C; +private: + void fn1(); public: CStarView(); @@ -65,7 +67,7 @@ public: /** * Sets references used by the view */ - void setup(CScreenManager *screenManager, CStarControlSub1 *sub1, CStarControl *starControl); + void setup(CScreenManager *screenManager, CStarField *starField, CStarControl *starControl); void reset(); -- cgit v1.2.3 From 789760295df25b209e312a1d48c0ca6be74c2c81 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 17 Jul 2016 13:05:48 -0400 Subject: VIDEO: Add titanic to list of engines using AVIDecoder --- video/avi_decoder.h | 1 + 1 file changed, 1 insertion(+) diff --git a/video/avi_decoder.h b/video/avi_decoder.h index 8b9fcbd9a3..a3733b579c 100644 --- a/video/avi_decoder.h +++ b/video/avi_decoder.h @@ -57,6 +57,7 @@ namespace Video { * - sci * - sword1 * - sword2 + * - titanic * - zvision */ class AVIDecoder : public VideoDecoder { -- cgit v1.2.3 From 816b99f5a657181ea84e0f42d2713406a9f041d2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 17 Jul 2016 13:26:22 -0400 Subject: TITANIC: Added CStarField support methods --- engines/titanic/star_control/star_control.cpp | 2 +- engines/titanic/star_control/star_control_sub5.h | 3 ++ engines/titanic/star_control/star_control_sub8.h | 3 +- engines/titanic/star_control/star_field.cpp | 60 +++++++++++++++++++++++- engines/titanic/star_control/star_field.h | 21 +++++++-- 5 files changed, 81 insertions(+), 8 deletions(-) diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp index e1e804f0df..3e0ff16c55 100644 --- a/engines/titanic/star_control/star_control.cpp +++ b/engines/titanic/star_control/star_control.cpp @@ -131,7 +131,7 @@ void CStarControl::fn1(int action) { } bool CStarControl::fn4() { - return _starField.get7(); + return _starField.get6(); } bool CStarControl::canSetStarDestination() const { diff --git a/engines/titanic/star_control/star_control_sub5.h b/engines/titanic/star_control/star_control_sub5.h index e245b29d10..8007f83338 100644 --- a/engines/titanic/star_control/star_control_sub5.h +++ b/engines/titanic/star_control/star_control_sub5.h @@ -48,6 +48,9 @@ public: virtual bool setup(); virtual void proc2(); virtual void proc3(CErrorCode *errorCode); + + int get4() const { return _field4; } + void set4(int val) { _field4 = val; } }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub8.h b/engines/titanic/star_control/star_control_sub8.h index 39d9fef7dc..6d8d1f0c7d 100644 --- a/engines/titanic/star_control/star_control_sub8.h +++ b/engines/titanic/star_control/star_control_sub8.h @@ -37,9 +37,10 @@ class CStarControlSub8 { private: int _field0; int _field4; - int _field8; int _fieldC; StructEntry _array[3]; +public: + int _field8; public: CStarControlSub8(); diff --git a/engines/titanic/star_control/star_field.cpp b/engines/titanic/star_control/star_field.cpp index 1d667c098b..2c94ebbc62 100644 --- a/engines/titanic/star_control/star_field.cpp +++ b/engines/titanic/star_control/star_field.cpp @@ -24,7 +24,7 @@ namespace Titanic { -CStarField::CStarField() : _val1(0), _val2(0), _val3(0), _val4(1), +CStarField::CStarField() : _val1(0), _val2(0), _val3(0), _val4(true), _val5(0), _val6(false) { } @@ -66,4 +66,62 @@ void CStarField::draw(CVideoSurface *surface, CStarControlSub12 *sub12) { // TODO } +int CStarField::get1() const { + return _val1; +} + +void CStarField::set1(int val) { + _val1 = val; +} + +int CStarField::get2() const { + return _val2; +} + +void CStarField::set2(int val) { + _val2 = val; +} + +int CStarField::get54() const { + return _sub5.get4(); +} + +void CStarField::set54(int val) { + _sub5.set4(val); +} + +int CStarField::get3() const { + return _val3; +} + +void CStarField::set3(int val) { + _val3 = val; +} + +void CStarField::toggle4() { + _val4 = !_val4; +} + +bool CStarField::set4(bool val) { + bool oldVal = _val4; + _val4 = val; + return val; +} + +int CStarField::get88() const { + return _sub8._field8; +} + +int CStarField::get5() const { + return _val5; +} + +void CStarField::update6() { + _val6 = _sub8._field8 == 2; +} + +int CStarField::get6() const { + return _val6; +} + } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_field.h b/engines/titanic/star_control/star_field.h index 48c2721b6d..d02749b048 100644 --- a/engines/titanic/star_control/star_field.h +++ b/engines/titanic/star_control/star_field.h @@ -42,10 +42,9 @@ private: int _val1; int _val2; int _val3; - int _val4; + bool _val4; int _val5; - int _val6; - bool _val7; + bool _val6; public: CStarField(); @@ -66,8 +65,20 @@ public: */ void draw(CVideoSurface *surface, CStarControlSub12 *sub12); - int get6() const { return _val6; } - bool get7() const { return _val7; } + int get1() const; + void set1(int val); + int get2() const; + void set2(int val); + int get54() const; + void set54(int val); + int get3() const; + void set3(int val); + void toggle4(); + bool set4(bool val); + int get88() const; + int get5() const; + void update6(); + int get6() const; }; } // End of namespace Titanic -- cgit v1.2.3 From 90f2cce0b9621b483f9530c3615b40a0c8a50bb8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 17 Jul 2016 15:40:07 -0400 Subject: TITANIC: Start of starfield rendering --- engines/titanic/star_control/base_star.cpp | 4 ++-- engines/titanic/star_control/base_star.h | 10 +++++++++- engines/titanic/star_control/star_control_sub12.cpp | 4 ++++ engines/titanic/star_control/star_control_sub12.h | 2 ++ engines/titanic/star_control/star_field.cpp | 7 ++++++- engines/titanic/star_control/star_field.h | 2 +- engines/titanic/star_control/star_view.cpp | 2 +- 7 files changed, 25 insertions(+), 6 deletions(-) diff --git a/engines/titanic/star_control/base_star.cpp b/engines/titanic/star_control/base_star.cpp index 4f4f838c12..f09df38620 100644 --- a/engines/titanic/star_control/base_star.cpp +++ b/engines/titanic/star_control/base_star.cpp @@ -48,8 +48,8 @@ void CBaseStarEntry::load(Common::SeekableReadStream &s) { CBaseStar::CBaseStar() : _minVal(0.0), _maxVal(1.0), _range(0.0) { } -void CBaseStar::proc2(int v1, int v2, int v3) { - error("TODO"); +void CBaseStar::draw(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStarControlSub5 *sub5) { + // TODO } void CBaseStar::clear() { diff --git a/engines/titanic/star_control/base_star.h b/engines/titanic/star_control/base_star.h index ad3ad13804..cf5cbc72d2 100644 --- a/engines/titanic/star_control/base_star.h +++ b/engines/titanic/star_control/base_star.h @@ -25,9 +25,13 @@ #include "titanic/support/simple_file.h" #include "titanic/star_control/star_control_sub4.h" +#include "titanic/star_control/star_control_sub5.h" +#include "titanic/star_control/surface_area.h" namespace Titanic { +class CStarControlSub12; + struct CBaseStarEntry { byte _field0; byte _field1; @@ -72,7 +76,11 @@ public: CBaseStar(); virtual ~CBaseStar() {} - virtual void proc2(int v1, int v2, int v3); + /** + * Draw the item + */ + virtual void draw(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStarControlSub5 *sub5); + virtual bool loadYale(int v1) { return true; } virtual bool proc4(int v1, int v2, int v3, int v4, int v5) { return false; } virtual bool proc5(int v1) { return false; } diff --git a/engines/titanic/star_control/star_control_sub12.cpp b/engines/titanic/star_control/star_control_sub12.cpp index aa65f718eb..5fc26e4cf3 100644 --- a/engines/titanic/star_control/star_control_sub12.cpp +++ b/engines/titanic/star_control/star_control_sub12.cpp @@ -37,4 +37,8 @@ void CStarControlSub12::save(SimpleFile *file, int indent) { _sub13.save(file, indent); } +void CStarControlSub12::setupHandler(void *v) { + // TODO +} + } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub12.h b/engines/titanic/star_control/star_control_sub12.h index e053aefb84..51d836628f 100644 --- a/engines/titanic/star_control/star_control_sub12.h +++ b/engines/titanic/star_control/star_control_sub12.h @@ -41,6 +41,8 @@ private: int _field2C; CStarControlSub13 _sub13; int _field108; +private: + void setupHandler(void *v); public: CStarControlSub12(void *val1, void *val2); virtual ~CStarControlSub12() {} diff --git a/engines/titanic/star_control/star_field.cpp b/engines/titanic/star_control/star_field.cpp index 2c94ebbc62..a90d2280a1 100644 --- a/engines/titanic/star_control/star_field.cpp +++ b/engines/titanic/star_control/star_field.cpp @@ -21,6 +21,7 @@ */ #include "titanic/star_control/star_field.h" +#include "titanic/star_control/surface_area.h" namespace Titanic { @@ -62,7 +63,11 @@ bool CStarField::initDocument() { return valid; } -void CStarField::draw(CVideoSurface *surface, CStarControlSub12 *sub12) { +void CStarField::render(CVideoSurface *surface, CStarControlSub12 *sub12) { + CSurfaceArea surfaceArea(surface); + draw(&surfaceArea, sub12, &_sub5); + + // TODO } diff --git a/engines/titanic/star_control/star_field.h b/engines/titanic/star_control/star_field.h index d02749b048..18104cdedf 100644 --- a/engines/titanic/star_control/star_field.h +++ b/engines/titanic/star_control/star_field.h @@ -63,7 +63,7 @@ public: /** * Renders the contents of the starfield */ - void draw(CVideoSurface *surface, CStarControlSub12 *sub12); + void render(CVideoSurface *surface, CStarControlSub12 *sub12); int get1() const; void set1(int val); diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp index 63bbed139b..a4c742c82a 100644 --- a/engines/titanic/star_control/star_view.cpp +++ b/engines/titanic/star_control/star_view.cpp @@ -94,7 +94,7 @@ void CStarView::draw(CScreenManager *screenManager) { // Render the display _videoSurface->clear(); _videoSurface->lock(); - _starField->draw(_videoSurface, &_sub12); + _starField->render(_videoSurface, &_sub12); _videoSurface->unlock(); // Blit the resulting surface to the screen -- cgit v1.2.3 From 9e14d4a56660ab3f090fd8eaed756a4d83353d76 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 17 Jul 2016 16:01:49 -0400 Subject: TITANIC: Added CStarControlSub12 setupHandler --- engines/titanic/module.mk | 1 + .../titanic/star_control/star_control_sub12.cpp | 43 ++++++++++++++++++++-- engines/titanic/star_control/star_control_sub12.h | 15 ++++++-- .../titanic/star_control/star_control_sub21.cpp | 4 ++ engines/titanic/star_control/star_control_sub21.h | 5 +++ .../titanic/star_control/star_control_sub22.cpp | 4 ++ engines/titanic/star_control/star_control_sub22.h | 9 ++++- engines/titanic/star_control/star_control_sub24.h | 4 +- .../titanic/star_control/star_control_sub27.cpp | 29 +++++++++++++++ engines/titanic/star_control/star_control_sub27.h | 35 ++++++++++++++++++ 10 files changed, 141 insertions(+), 8 deletions(-) create mode 100644 engines/titanic/star_control/star_control_sub27.cpp create mode 100644 engines/titanic/star_control/star_control_sub27.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 33e3558f72..ec3294747e 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -438,6 +438,7 @@ MODULE_OBJS := \ star_control/star_control_sub24.o \ star_control/star_control_sub25.o \ star_control/star_control_sub26.o \ + star_control/star_control_sub27.o \ star_control/star_field.o \ star_control/star_points1.o \ star_control/star_points2.o \ diff --git a/engines/titanic/star_control/star_control_sub12.cpp b/engines/titanic/star_control/star_control_sub12.cpp index 5fc26e4cf3..a2e1f068ef 100644 --- a/engines/titanic/star_control/star_control_sub12.cpp +++ b/engines/titanic/star_control/star_control_sub12.cpp @@ -21,12 +21,19 @@ */ #include "titanic/star_control/star_control_sub12.h" +#include "titanic/star_control/star_control_sub21.h" +#include "titanic/star_control/star_control_sub22.h" namespace Titanic { CStarControlSub12::CStarControlSub12(void *val1, void *val2) : - _field4(-1), _field2C(0), _field108(0), + _field4(-1), _handlerP(nullptr), _field108(0), _sub13(val1) { + setupHandler(val2); +} + +CStarControlSub12::~CStarControlSub12() { + deleteHandler(); } void CStarControlSub12::load(SimpleFile *file, int param) { @@ -37,8 +44,38 @@ void CStarControlSub12::save(SimpleFile *file, int indent) { _sub13.save(file, indent); } -void CStarControlSub12::setupHandler(void *v) { - // TODO +bool CStarControlSub12::setupHandler(void *src) { + CStarControlSub20 *handler = nullptr; + + switch (_field4) { + case -1: + handler = new CStarControlSub21(src); + break; + + case 0: + case 1: + case 2: + handler = new CStarControlSub22(src); + break; + + default: + break; + } + + if (handler) { + assert(!_handlerP); + _handlerP = handler; + return true; + } else { + return false; + } +} + +void CStarControlSub12::deleteHandler() { + if (_handlerP) { + delete _handlerP; + _handlerP = nullptr; + } } } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub12.h b/engines/titanic/star_control/star_control_sub12.h index 51d836628f..a114cded81 100644 --- a/engines/titanic/star_control/star_control_sub12.h +++ b/engines/titanic/star_control/star_control_sub12.h @@ -25,6 +25,7 @@ #include "titanic/support/simple_file.h" #include "titanic/star_control/star_control_sub13.h" +#include "titanic/star_control/star_control_sub20.h" namespace Titanic { @@ -38,14 +39,22 @@ class CStarControlSub12 { private: int _field4; ArrayEntry _array[3]; - int _field2C; + CStarControlSub20 *_handlerP; CStarControlSub13 _sub13; int _field108; private: - void setupHandler(void *v); + /** + * Set up a handler + */ + bool setupHandler(void *src); + + /** + * Deletes any previous handler + */ + void deleteHandler(); public: CStarControlSub12(void *val1, void *val2); - virtual ~CStarControlSub12() {} + virtual ~CStarControlSub12(); virtual void proc3() {} diff --git a/engines/titanic/star_control/star_control_sub21.cpp b/engines/titanic/star_control/star_control_sub21.cpp index b606d15b41..20b8bc5f86 100644 --- a/engines/titanic/star_control/star_control_sub21.cpp +++ b/engines/titanic/star_control/star_control_sub21.cpp @@ -25,4 +25,8 @@ namespace Titanic { +CStarControlSub21::CStarControlSub21(void *src) : + CStarControlSub20(src), _sub24() { +} + } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub21.h b/engines/titanic/star_control/star_control_sub21.h index 8214a1824e..610f26ec65 100644 --- a/engines/titanic/star_control/star_control_sub21.h +++ b/engines/titanic/star_control/star_control_sub21.h @@ -24,10 +24,15 @@ #define TITANIC_STAR_CONTROL_SUB21_H #include "titanic/star_control/star_control_sub20.h" +#include "titanic/star_control/star_control_sub24.h" namespace Titanic { class CStarControlSub21 : public CStarControlSub20 { +private: + CStarControlSub24 _sub24; +public: + CStarControlSub21(void *src); }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub22.cpp b/engines/titanic/star_control/star_control_sub22.cpp index d7835a68bf..9298d5b6de 100644 --- a/engines/titanic/star_control/star_control_sub22.cpp +++ b/engines/titanic/star_control/star_control_sub22.cpp @@ -25,4 +25,8 @@ namespace Titanic { +CStarControlSub22::CStarControlSub22(void *src) : + CStarControlSub20(src), _sub27() { +} + } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub22.h b/engines/titanic/star_control/star_control_sub22.h index 94a0cdf7f9..dae231f703 100644 --- a/engines/titanic/star_control/star_control_sub22.h +++ b/engines/titanic/star_control/star_control_sub22.h @@ -23,9 +23,16 @@ #ifndef TITANIC_STAR_CONTROL_SUB22_H #define TITANIC_STAR_CONTROL_SUB22_H +#include "titanic/star_control/star_control_sub20.h" +#include "titanic/star_control/star_control_sub27.h" + namespace Titanic { -class CStarControlSub22 { +class CStarControlSub22 : public CStarControlSub20 { +private: + CStarControlSub27 _sub27; +public: + CStarControlSub22(void *src); }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub24.h b/engines/titanic/star_control/star_control_sub24.h index 43f1e0933e..e0970fc1de 100644 --- a/engines/titanic/star_control/star_control_sub24.h +++ b/engines/titanic/star_control/star_control_sub24.h @@ -23,9 +23,11 @@ #ifndef TITANIC_STAR_CONTROL_SUB24_H #define TITANIC_STAR_CONTROL_SUB24_H +#include "titanic/star_control/star_control_sub23.h" + namespace Titanic { -class CStarControlSub24 { +class CStarControlSub24 : public CStarControlSub23 { }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub27.cpp b/engines/titanic/star_control/star_control_sub27.cpp new file mode 100644 index 0000000000..6f17eb7193 --- /dev/null +++ b/engines/titanic/star_control/star_control_sub27.cpp @@ -0,0 +1,29 @@ +/* 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 "titanic/star_control/star_control_sub24.h" +#include "common/textconsole.h" + +namespace Titanic { + + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub27.h b/engines/titanic/star_control/star_control_sub27.h new file mode 100644 index 0000000000..01782b69ca --- /dev/null +++ b/engines/titanic/star_control/star_control_sub27.h @@ -0,0 +1,35 @@ +/* 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. + * + */ + +#ifndef TITANIC_STAR_CONTROL_SUB27_H +#define TITANIC_STAR_CONTROL_SUB27_H + +#include "titanic/star_control/star_control_sub23.h" + +namespace Titanic { + +class CStarControlSub27 : public CStarControlSub23 { +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB27_H */ -- cgit v1.2.3 From 011286d4b88b9d01ea1ceb232d6369385e68887e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 17 Jul 2016 16:43:53 -0400 Subject: TITANIC: Extra construction for CStarControlSub12 --- engines/titanic/star_control/fmatrix.cpp | 6 +++ engines/titanic/star_control/fmatrix.h | 1 + .../titanic/star_control/star_control_sub12.cpp | 5 ++ engines/titanic/star_control/star_control_sub12.h | 1 + .../titanic/star_control/star_control_sub13.cpp | 55 +++++++++++++++++++--- engines/titanic/star_control/star_control_sub13.h | 5 +- engines/titanic/star_control/star_control_sub6.cpp | 11 +++++ engines/titanic/star_control/star_control_sub6.h | 3 ++ engines/titanic/star_control/star_view.cpp | 2 +- 9 files changed, 79 insertions(+), 10 deletions(-) diff --git a/engines/titanic/star_control/fmatrix.cpp b/engines/titanic/star_control/fmatrix.cpp index c53892d0fe..81604c84ec 100644 --- a/engines/titanic/star_control/fmatrix.cpp +++ b/engines/titanic/star_control/fmatrix.cpp @@ -32,6 +32,12 @@ FMatrix::FMatrix(DMatrix *src) { copyFrom(src); } +FMatrix::FMatrix(FMatrix *src) { + _row1 = src->_row1; + _row2 = src->_row2; + _row3 = src->_row3; +} + void FMatrix::copyFrom(const DMatrix *src) { // TODO } diff --git a/engines/titanic/star_control/fmatrix.h b/engines/titanic/star_control/fmatrix.h index 5dbbe99253..33673874b4 100644 --- a/engines/titanic/star_control/fmatrix.h +++ b/engines/titanic/star_control/fmatrix.h @@ -47,6 +47,7 @@ public: public: FMatrix(); FMatrix(DMatrix *src); + FMatrix(FMatrix *src); /** * Load the data for the class from file diff --git a/engines/titanic/star_control/star_control_sub12.cpp b/engines/titanic/star_control/star_control_sub12.cpp index a2e1f068ef..aa90a3c7c3 100644 --- a/engines/titanic/star_control/star_control_sub12.cpp +++ b/engines/titanic/star_control/star_control_sub12.cpp @@ -32,6 +32,11 @@ CStarControlSub12::CStarControlSub12(void *val1, void *val2) : setupHandler(val2); } +CStarControlSub12::CStarControlSub12(CStarControlSub13 *src) : + _field4(-1), _handlerP(nullptr), _field108(0), _sub13(src) { + +} + CStarControlSub12::~CStarControlSub12() { deleteHandler(); } diff --git a/engines/titanic/star_control/star_control_sub12.h b/engines/titanic/star_control/star_control_sub12.h index a114cded81..0600aba446 100644 --- a/engines/titanic/star_control/star_control_sub12.h +++ b/engines/titanic/star_control/star_control_sub12.h @@ -54,6 +54,7 @@ private: void deleteHandler(); public: CStarControlSub12(void *val1, void *val2); + CStarControlSub12(CStarControlSub13 *src); virtual ~CStarControlSub12(); virtual void proc3() {} diff --git a/engines/titanic/star_control/star_control_sub13.cpp b/engines/titanic/star_control/star_control_sub13.cpp index fd67c19785..2038af3127 100644 --- a/engines/titanic/star_control/star_control_sub13.cpp +++ b/engines/titanic/star_control/star_control_sub13.cpp @@ -24,25 +24,51 @@ namespace Titanic { -CStarControlSub13::CStarControlSub13(void *ptr): +CStarControlSub13::CStarControlSub13(void *src) : _field0(0), _field4(0), _field8(0), _fieldC0(0), _fieldC4(0), _fieldC8(0), _fieldCC(0), _fieldD0(0) { - if (ptr) { - setup(ptr); + if (src) { + setup(src); } else { _fieldC = 0; _field10 = 0x44480000; _field14 = 0x461C4000; _field18 = 0x41A00000; _field1C = 0x41A00000; - _field20 = 600; - _field22 = 340; + _width = 600; + _height = 340; _field24 = 0; } _fieldD4 = 0; } +CStarControlSub13::CStarControlSub13(CStarControlSub13 *src) : + _matrix(&src->_matrix), _sub1(&src->_sub1), _sub2(&src->_sub2) { + _field0 = src->_field0; + _field4 = src->_field4; + _field8 = src->_field8; + _fieldC = src->_fieldC; + _field10 = src->_field10; + _field14 = src->_field14; + _field18 = src->_field18; + _field1C = src->_field1C; + _width = src->_width; + _height = src->_height; + + _fieldCC = src->_fieldCC; + _fieldD0 = src->_fieldD0; + _fieldC0 = src->_fieldC0; + _fieldC4 = src->_fieldC4; + _fieldC8 = src->_fieldC8; + _field24 = src->_field24; + + _valArray[0] = src->_valArray[0]; + _valArray[2] = src->_valArray[2]; + _valArray[3] = src->_valArray[3]; + _fieldD4 = 0; +} + void CStarControlSub13::setup(void *ptr) { // TODO } @@ -56,8 +82,10 @@ void CStarControlSub13::load(SimpleFile *file, int param) { _field14 = file->readFloat(); _field18 = file->readFloat(); _field1C = file->readFloat(); - _field20 = file->readNumber(); - _field22 = _field20 >> 16; + + int widthHeight = file->readNumber(); + _width = widthHeight & 0xff; + _height = _width >> 16; _field24 = file->readNumber(); for (int idx = 0; idx < 5; ++idx) @@ -68,6 +96,19 @@ void CStarControlSub13::load(SimpleFile *file, int param) { } void CStarControlSub13::save(SimpleFile *file, int indent) { + file->writeFloatLine(_field0, indent); + file->writeFloatLine(_field4, indent); + file->writeFloatLine(_field8, indent); + file->writeFloatLine(_fieldC, indent); + file->writeFloatLine(_field10, indent); + file->writeFloatLine(_field14, indent); + file->writeFloatLine(_field18, indent); + file->writeFloatLine(_field1C, indent); + file->writeFloatLine(_width | (_height << 16), indent); + + for (int idx = 0; idx < 5; ++idx) + file->writeFloatLine(_valArray[idx], indent); + _matrix.save(file, indent); } diff --git a/engines/titanic/star_control/star_control_sub13.h b/engines/titanic/star_control/star_control_sub13.h index 37ffe1bdb9..7eeab972aa 100644 --- a/engines/titanic/star_control/star_control_sub13.h +++ b/engines/titanic/star_control/star_control_sub13.h @@ -39,8 +39,8 @@ private: double _field14; double _field18; double _field1C; - int _field20; - int _field22; + int _width; + int _height; int _field24; double _valArray[5]; FMatrix _matrix; @@ -56,6 +56,7 @@ private: void setup(void *ptr); public: CStarControlSub13(void *ptr); + CStarControlSub13(CStarControlSub13 *src); /** * Load the data for the class from file diff --git a/engines/titanic/star_control/star_control_sub6.cpp b/engines/titanic/star_control/star_control_sub6.cpp index 83abc22c6f..a5a1d81aa8 100644 --- a/engines/titanic/star_control/star_control_sub6.cpp +++ b/engines/titanic/star_control/star_control_sub6.cpp @@ -34,6 +34,10 @@ CStarControlSub6::CStarControlSub6(int mode, double val) { set(mode, val); } +CStarControlSub6::CStarControlSub6(const CStarControlSub6 *src) { + copyFrom(src); +} + void CStarControlSub6::init() { _static = nullptr; } @@ -101,4 +105,11 @@ void CStarControlSub6::set(int mode, double amount) { _field2C = 0.0; } +void CStarControlSub6::copyFrom(const CStarControlSub6 *src) { + _matrix = src->_matrix; + _field24 = src->_field24; + _field28 = src->_field28; + _field2C = src->_field2C; +} + } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub6.h b/engines/titanic/star_control/star_control_sub6.h index 10058f5888..fe2b3d44b5 100644 --- a/engines/titanic/star_control/star_control_sub6.h +++ b/engines/titanic/star_control/star_control_sub6.h @@ -41,6 +41,7 @@ public: public: CStarControlSub6(); CStarControlSub6(int mode, double amount); + CStarControlSub6(const CStarControlSub6 *src); /** * Clear the item @@ -51,6 +52,8 @@ public: * Sets the default data */ void set(int mode, double val); + + void copyFrom(const CStarControlSub6 *src); }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp index a4c742c82a..2308227f6c 100644 --- a/engines/titanic/star_control/star_view.cpp +++ b/engines/titanic/star_control/star_view.cpp @@ -28,7 +28,7 @@ namespace Titanic { -CStarView::CStarView() : _sub12(nullptr, nullptr), _sub13(nullptr), +CStarView::CStarView() : _sub12(nullptr, nullptr), _sub13((void *)nullptr), _owner(nullptr), _starField(nullptr), _videoSurface(nullptr), _field118(0), _videoSurface2(nullptr), _field210(0), _homePhotoMask(nullptr), _field218(0), _field21C(0) { -- cgit v1.2.3 From 87db74d771d86281def59c12ba8359abeaa03585 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 17 Jul 2016 20:18:20 -0400 Subject: TITANIC: Adding CStarControlSub12 methods --- engines/titanic/star_control/fmatrix.cpp | 6 +-- engines/titanic/star_control/fmatrix.h | 2 +- .../titanic/star_control/star_control_sub12.cpp | 59 ++++++++++++++++++++ engines/titanic/star_control/star_control_sub12.h | 23 +++++++- .../titanic/star_control/star_control_sub13.cpp | 63 ++++++++++++++++++++++ engines/titanic/star_control/star_control_sub13.h | 13 +++++ .../titanic/star_control/star_control_sub20.cpp | 4 +- engines/titanic/star_control/star_control_sub20.h | 4 +- engines/titanic/star_control/star_view.cpp | 5 +- 9 files changed, 169 insertions(+), 10 deletions(-) diff --git a/engines/titanic/star_control/fmatrix.cpp b/engines/titanic/star_control/fmatrix.cpp index 81604c84ec..af15477d04 100644 --- a/engines/titanic/star_control/fmatrix.cpp +++ b/engines/titanic/star_control/fmatrix.cpp @@ -78,17 +78,17 @@ void FMatrix::set(FVector *row1, FVector *row2, FVector *row3) { _row3 = *row3; } -void FMatrix::fn1(FVector *v) { +void FMatrix::fn1(const FVector *v) { _row3._x = v->_x; FVector tempVector; - tempVector.fn1(v); + _row3.fn1(&tempVector); _row2._x = tempVector._x; _row2._y = tempVector._y; _row2._z = tempVector._z; - _row3.multiply(v, &_row2); + _row3.multiply(&tempVector, &_row2); _row1._x = _row2._x; _row1._y = _row2._y; _row1._z = _row2._z; diff --git a/engines/titanic/star_control/fmatrix.h b/engines/titanic/star_control/fmatrix.h index 33673874b4..d7c4acfbdc 100644 --- a/engines/titanic/star_control/fmatrix.h +++ b/engines/titanic/star_control/fmatrix.h @@ -69,7 +69,7 @@ public: */ void set(FVector *row1, FVector *row2, FVector *row3); - void fn1(FVector *v); + void fn1(const FVector *v); void fn2(FMatrix *m); void fn3(FMatrix *m); diff --git a/engines/titanic/star_control/star_control_sub12.cpp b/engines/titanic/star_control/star_control_sub12.cpp index aa90a3c7c3..f968559a2f 100644 --- a/engines/titanic/star_control/star_control_sub12.cpp +++ b/engines/titanic/star_control/star_control_sub12.cpp @@ -41,6 +41,65 @@ CStarControlSub12::~CStarControlSub12() { deleteHandler(); } +void CStarControlSub12::proc2(const void *src) { + _sub13.copyFrom(src); +} + +void CStarControlSub12::proc3(const void *src) { + _handlerP->copyFrom1(src); +} + +void CStarControlSub12::proc4(const void *src) { + if (!isLocked()) { + _sub13.fn10(src); + set108(); + } +} + +void CStarControlSub12::proc5(const FVector *src) { + if (!isLocked()) + _sub13.fn11(src); +} + +void CStarControlSub12::proc6(int v) { + if (!isLocked()) + _sub13.setC(v); +} + +void CStarControlSub12::proc7(int v) { + if (!isLocked()) + _sub13.set10(v); +} + +void CStarControlSub12::proc8(int v) { + if (!isLocked()) + _sub13.set14(v); +} + +void CStarControlSub12::proc9(int v) { + if (!isLocked()) + _sub13.set18(v); +} + +void CStarControlSub12::proc10(int v) { + if (!isLocked()) + _sub13.set1C(v); +} + +void CStarControlSub12::proc11() { + if (!isLocked()) + _sub13.fn12(); +} + +void CStarControlSub12::proc12(double v1, double v2) { + if (!isLocked()) + _sub13.fn13(v1, v2); +} + +void CStarControlSub12::proc13(CStarControlSub13 *dest) { + *dest = _sub13; +} + void CStarControlSub12::load(SimpleFile *file, int param) { _sub13.load(file, param); } diff --git a/engines/titanic/star_control/star_control_sub12.h b/engines/titanic/star_control/star_control_sub12.h index 0600aba446..1262aa8bf3 100644 --- a/engines/titanic/star_control/star_control_sub12.h +++ b/engines/titanic/star_control/star_control_sub12.h @@ -52,12 +52,28 @@ private: * Deletes any previous handler */ void deleteHandler(); + + /** + * Return whether the handler is locked + */ + bool isLocked() { return _handlerP->isLocked(); } public: CStarControlSub12(void *val1, void *val2); CStarControlSub12(CStarControlSub13 *src); virtual ~CStarControlSub12(); - virtual void proc3() {} + virtual void proc2(const void *src); + virtual void proc3(const void *src); + virtual void proc4(const void *src); + virtual void proc5(const FVector *src); + virtual void proc6(int v); + virtual void proc7(int v); + virtual void proc8(int v); + virtual void proc9(int v); + virtual void proc10(int v); + virtual void proc11(); + virtual void proc12(double v1, double v2); + virtual void proc13(CStarControlSub13 *dest); /** * Load the data for the class from file @@ -68,6 +84,11 @@ public: * Save the data for the class to file */ virtual void save(SimpleFile *file, int indent); + + + bool is108() const { return _field108; } + void set108() { _field108 = true; } + void reset108() { _field108 = false; } }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub13.cpp b/engines/titanic/star_control/star_control_sub13.cpp index 2038af3127..a8599a7654 100644 --- a/engines/titanic/star_control/star_control_sub13.cpp +++ b/engines/titanic/star_control/star_control_sub13.cpp @@ -21,6 +21,7 @@ */ #include "titanic/star_control/star_control_sub13.h" +#include "titanic/titanic.h" namespace Titanic { @@ -73,6 +74,18 @@ void CStarControlSub13::setup(void *ptr) { // TODO } +void CStarControlSub13::copyFrom(const void *src) { + if (!src) + return; +/* + _field0 = src->_field0; + _field4 = src->_field4; + _field8 = src->_field8; + _fieldC = src->_field18; + _field10 = src->_field1C; + */ +} + void CStarControlSub13::load(SimpleFile *file, int param) { _field0 = file->readFloat(); _field4 = file->readFloat(); @@ -112,5 +125,55 @@ void CStarControlSub13::save(SimpleFile *file, int indent) { _matrix.save(file, indent); } +void CStarControlSub13::fn10(const void *src) { + error("TODO: CStarControlSub13::fn10"); +} + +void CStarControlSub13::fn11(const FVector *v) { + _matrix.fn1(v); + _fieldD4 = 0; +} + +void CStarControlSub13::setC(int v) { + _fieldC = v; + _fieldD4 = 0; +} + +void CStarControlSub13::set10(int v) { + _field10 = v; + _fieldD4 = 0; +} + +void CStarControlSub13::set14(int v) { + _field10 = v; +} + +void CStarControlSub13::set18(int v) { + _field18 = v; + _fieldD4 = 0; +} + +void CStarControlSub13::set1C(int v) { + _field1C = v; + _fieldD4 = 0; +} + +void CStarControlSub13::fn12() { + _matrix.clear(); + error("TODO: CStarControlSub13::fn12"); +} + +void CStarControlSub13::fn13(double v1, double v2) { + if (v1 == 0.0) { + _valArray[0] = v2; + _valArray[1] = -v2; + } else { + _valArray[3] = v2; + _valArray[4] = -v2; + } + + _valArray[2] = 0.0; + _field24 = v2 ? 2 : 0; +} } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub13.h b/engines/titanic/star_control/star_control_sub13.h index 7eeab972aa..eb4a07cb32 100644 --- a/engines/titanic/star_control/star_control_sub13.h +++ b/engines/titanic/star_control/star_control_sub13.h @@ -58,6 +58,8 @@ public: CStarControlSub13(void *ptr); CStarControlSub13(CStarControlSub13 *src); + void copyFrom(const void *src); + /** * Load the data for the class from file */ @@ -67,6 +69,17 @@ public: * Save the data for the class to file */ void save(SimpleFile *file, int indent); + + void fn10(const void *src); + void fn11(const FVector *v); + void fn12(); + void fn13(double v1, double v2); + + void setC(int v); + void set10(int v); + void set14(int v); + void set18(int v); + void set1C(int v); }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub20.cpp b/engines/titanic/star_control/star_control_sub20.cpp index 958ee3813e..82b6b0d7dd 100644 --- a/engines/titanic/star_control/star_control_sub20.cpp +++ b/engines/titanic/star_control/star_control_sub20.cpp @@ -47,11 +47,11 @@ CStarControlSub20::~CStarControlSub20() { clear(); } -void CStarControlSub20::copyFrom1(void *src) { +void CStarControlSub20::copyFrom1(const void *src) { error("TODO: CStarControlSub20::copyFrom1"); } -void CStarControlSub20::copyFrom2(void *src) { +void CStarControlSub20::copyFrom2(const void *src) { error("TODO: CStarControlSub20::copyFrom2"); } diff --git a/engines/titanic/star_control/star_control_sub20.h b/engines/titanic/star_control/star_control_sub20.h index 376c09743a..9d90b80d26 100644 --- a/engines/titanic/star_control/star_control_sub20.h +++ b/engines/titanic/star_control/star_control_sub20.h @@ -44,8 +44,8 @@ public: CStarControlSub20(void *src); virtual ~CStarControlSub20(); - virtual void copyFrom1(void *src); - virtual void copyFrom2(void *src); + virtual void copyFrom1(const void *src); + virtual void copyFrom2(const void *src); virtual void proc4(); virtual void proc5(); virtual void proc6(); diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp index 2308227f6c..5140dc086f 100644 --- a/engines/titanic/star_control/star_view.cpp +++ b/engines/titanic/star_control/star_view.cpp @@ -32,7 +32,10 @@ CStarView::CStarView() : _sub12(nullptr, nullptr), _sub13((void *)nullptr), _owner(nullptr), _starField(nullptr), _videoSurface(nullptr), _field118(0), _videoSurface2(nullptr), _field210(0), _homePhotoMask(nullptr), _field218(0), _field21C(0) { - _sub12.proc3(); + static const uint DATA[8] = { 0, 0, 0x47C35000, 0, 0x41A00000, + 0x3F800000, 0x3F800000, 0x3F800000 }; + + _sub12.proc3(&DATA[0]); } void CStarView::load(SimpleFile *file, int param) { -- cgit v1.2.3 From 020655a6f3925a7a5e919274a96451bd434c2120 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 17 Jul 2016 21:26:03 -0400 Subject: TITANIC: Adding CStarControlSub12 methods --- engines/titanic/star_control/star_control.cpp | 3 ++ .../titanic/star_control/star_control_sub12.cpp | 54 ++++++++++++++++++++-- engines/titanic/star_control/star_control_sub12.h | 13 +++++- .../titanic/star_control/star_control_sub13.cpp | 37 +++++++++------ engines/titanic/star_control/star_control_sub13.h | 23 +++++++-- .../titanic/star_control/star_control_sub20.cpp | 2 +- engines/titanic/star_control/star_control_sub20.h | 5 +- 7 files changed, 108 insertions(+), 29 deletions(-) diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp index 3e0ff16c55..3324d177ba 100644 --- a/engines/titanic/star_control/star_control.cpp +++ b/engines/titanic/star_control/star_control.cpp @@ -25,6 +25,7 @@ #include "titanic/star_control/dmatrix.h" #include "titanic/star_control/error_code.h" #include "titanic/star_control/star_control_sub6.h" +#include "titanic/star_control/star_control_sub12.h" namespace Titanic { @@ -38,11 +39,13 @@ END_MESSAGE_MAP() CStarControl::CStarControl() : _fieldBC(0), _field80B0(0), _starRect(20, 10, 620, 350) { CStarControlSub6::init(); + CStarControlSub12::init(); DMatrix::init(); } CStarControl::~CStarControl() { CStarControlSub6::deinit(); + CStarControlSub12::deinit(); DMatrix::deinit(); } diff --git a/engines/titanic/star_control/star_control_sub12.cpp b/engines/titanic/star_control/star_control_sub12.cpp index f968559a2f..967327014e 100644 --- a/engines/titanic/star_control/star_control_sub12.cpp +++ b/engines/titanic/star_control/star_control_sub12.cpp @@ -26,6 +26,9 @@ namespace Titanic { +FMatrix *CStarControlSub12::_matrix1; +FMatrix *CStarControlSub12::_matrix2; + CStarControlSub12::CStarControlSub12(void *val1, void *val2) : _field4(-1), _handlerP(nullptr), _field108(0), _sub13(val1) { @@ -34,7 +37,18 @@ CStarControlSub12::CStarControlSub12(void *val1, void *val2) : CStarControlSub12::CStarControlSub12(CStarControlSub13 *src) : _field4(-1), _handlerP(nullptr), _field108(0), _sub13(src) { +} + +void CStarControlSub12::init() { + _matrix1 = nullptr; + _matrix2 = nullptr; +} +void CStarControlSub12::deinit() { + delete _matrix1; + delete _matrix2; + _matrix1 = nullptr; + _matrix2 = nullptr; } CStarControlSub12::~CStarControlSub12() { @@ -49,16 +63,16 @@ void CStarControlSub12::proc3(const void *src) { _handlerP->copyFrom1(src); } -void CStarControlSub12::proc4(const void *src) { +void CStarControlSub12::setPosition(const FVector &v) { if (!isLocked()) { - _sub13.fn10(src); + _sub13.setPosition(v); set108(); } } -void CStarControlSub12::proc5(const FVector *src) { +void CStarControlSub12::proc5(const FVector &v) { if (!isLocked()) - _sub13.fn11(src); + _sub13.fn11(v); } void CStarControlSub12::proc6(int v) { @@ -100,6 +114,38 @@ void CStarControlSub12::proc13(CStarControlSub13 *dest) { *dest = _sub13; } +void CStarControlSub12::proc14(int v) { + FMatrix matrix; + _sub13.getMatrix(&matrix); + FVector vector = _sub13._position; + + _handlerP->proc9(&vector, v, &matrix); +} + +void CStarControlSub12::proc15(int v) { + if (!_matrix1) + _matrix1 = new FMatrix(); + if (!_matrix2) + _matrix2 = new FMatrix(); + + _sub13.getMatrix(_matrix1); + *_matrix2 = *_matrix1; + + FVector v1 = _sub13._position; + FVector v2 = _sub13._position; + CErrorCode errorCode; + _handlerP->proc11(errorCode, v2, _matrix2); + + if (v1 != v2) { + _sub13.setPosition(v2); + set108(); + } + + if (_matrix1 != _matrix2) { + _sub13.setMatrix(_matrix2); + } +} + void CStarControlSub12::load(SimpleFile *file, int param) { _sub13.load(file, param); } diff --git a/engines/titanic/star_control/star_control_sub12.h b/engines/titanic/star_control/star_control_sub12.h index 1262aa8bf3..643e3dfb67 100644 --- a/engines/titanic/star_control/star_control_sub12.h +++ b/engines/titanic/star_control/star_control_sub12.h @@ -24,6 +24,7 @@ #define TITANIC_STAR_CONTROL_SUB12_H #include "titanic/support/simple_file.h" +#include "titanic/star_control/fmatrix.h" #include "titanic/star_control/star_control_sub13.h" #include "titanic/star_control/star_control_sub20.h" @@ -36,6 +37,9 @@ class CStarControlSub12 { int _field8; ArrayEntry() : _field0(0), _field4(0), _field8(0) {} }; +private: + static FMatrix *_matrix1; + static FMatrix *_matrix2; private: int _field4; ArrayEntry _array[3]; @@ -57,6 +61,9 @@ private: * Return whether the handler is locked */ bool isLocked() { return _handlerP->isLocked(); } +public: + static void init(); + static void deinit(); public: CStarControlSub12(void *val1, void *val2); CStarControlSub12(CStarControlSub13 *src); @@ -64,8 +71,8 @@ public: virtual void proc2(const void *src); virtual void proc3(const void *src); - virtual void proc4(const void *src); - virtual void proc5(const FVector *src); + virtual void setPosition(const FVector &v); + virtual void proc5(const FVector &v); virtual void proc6(int v); virtual void proc7(int v); virtual void proc8(int v); @@ -74,6 +81,8 @@ public: virtual void proc11(); virtual void proc12(double v1, double v2); virtual void proc13(CStarControlSub13 *dest); + virtual void proc14(int v); + virtual void proc15(int v); /** * Load the data for the class from file diff --git a/engines/titanic/star_control/star_control_sub13.cpp b/engines/titanic/star_control/star_control_sub13.cpp index a8599a7654..a69937bfb8 100644 --- a/engines/titanic/star_control/star_control_sub13.cpp +++ b/engines/titanic/star_control/star_control_sub13.cpp @@ -26,8 +26,7 @@ namespace Titanic { CStarControlSub13::CStarControlSub13(void *src) : - _field0(0), _field4(0), _field8(0), _fieldC0(0), - _fieldC4(0), _fieldC8(0), _fieldCC(0), _fieldD0(0) { + _fieldC0(0), _fieldC4(0), _fieldC8(0), _fieldCC(0), _fieldD0(0) { if (src) { setup(src); } else { @@ -46,9 +45,7 @@ CStarControlSub13::CStarControlSub13(void *src) : CStarControlSub13::CStarControlSub13(CStarControlSub13 *src) : _matrix(&src->_matrix), _sub1(&src->_sub1), _sub2(&src->_sub2) { - _field0 = src->_field0; - _field4 = src->_field4; - _field8 = src->_field8; + _position = src->_position; _fieldC = src->_fieldC; _field10 = src->_field10; _field14 = src->_field14; @@ -87,9 +84,9 @@ void CStarControlSub13::copyFrom(const void *src) { } void CStarControlSub13::load(SimpleFile *file, int param) { - _field0 = file->readFloat(); - _field4 = file->readFloat(); - _field8 = file->readFloat(); + _position._x = file->readFloat(); + _position._y = file->readFloat(); + _position._z = file->readFloat(); _fieldC = file->readFloat(); _field10 = file->readFloat(); _field14 = file->readFloat(); @@ -109,9 +106,9 @@ void CStarControlSub13::load(SimpleFile *file, int param) { } void CStarControlSub13::save(SimpleFile *file, int indent) { - file->writeFloatLine(_field0, indent); - file->writeFloatLine(_field4, indent); - file->writeFloatLine(_field8, indent); + file->writeFloatLine(_position._x, indent); + file->writeFloatLine(_position._y, indent); + file->writeFloatLine(_position._z, indent); file->writeFloatLine(_fieldC, indent); file->writeFloatLine(_field10, indent); file->writeFloatLine(_field14, indent); @@ -125,12 +122,18 @@ void CStarControlSub13::save(SimpleFile *file, int indent) { _matrix.save(file, indent); } -void CStarControlSub13::fn10(const void *src) { - error("TODO: CStarControlSub13::fn10"); +void CStarControlSub13::setPosition(const FVector &v) { + _position = v; + _fieldD4 = 0; } -void CStarControlSub13::fn11(const FVector *v) { - _matrix.fn1(v); +void CStarControlSub13::setMatrix(const FMatrix &m) { + _matrix = m; + _fieldD4 = 0; +} + +void CStarControlSub13::fn11(const FVector &v) { + _matrix.fn1(&v); _fieldD4 = 0; } @@ -176,4 +179,8 @@ void CStarControlSub13::fn13(double v1, double v2) { _field24 = v2 ? 2 : 0; } +void CStarControlSub13::getMatrix(FMatrix *matrix) { + *matrix = _matrix; +} + } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub13.h b/engines/titanic/star_control/star_control_sub13.h index eb4a07cb32..eacdce3447 100644 --- a/engines/titanic/star_control/star_control_sub13.h +++ b/engines/titanic/star_control/star_control_sub13.h @@ -31,9 +31,6 @@ namespace Titanic { class CStarControlSub13 { private: - double _field0; - double _field4; - double _field8; double _fieldC; double _field10; double _field14; @@ -54,6 +51,8 @@ private: int _fieldD4; private: void setup(void *ptr); +public: + FVector _position; public: CStarControlSub13(void *ptr); CStarControlSub13(CStarControlSub13 *src); @@ -70,11 +69,25 @@ public: */ void save(SimpleFile *file, int indent); - void fn10(const void *src); - void fn11(const FVector *v); + /** + * Sets the position + */ + void setPosition(const FVector &v); + + /** + * Sets the matrix + */ + void setMatrix(const FMatrix &m); + + void fn11(const FVector &v); void fn12(); void fn13(double v1, double v2); + /** + * Makes a copy of the instance's matrix into the passed matrix + */ + void getMatrix(FMatrix *matrix); + void setC(int v); void set10(int v); void set14(int v); diff --git a/engines/titanic/star_control/star_control_sub20.cpp b/engines/titanic/star_control/star_control_sub20.cpp index 82b6b0d7dd..3611478100 100644 --- a/engines/titanic/star_control/star_control_sub20.cpp +++ b/engines/titanic/star_control/star_control_sub20.cpp @@ -90,7 +90,7 @@ void CStarControlSub20::proc7() { } } -void CStarControlSub20::proc11(CErrorCode *errorCode, void *v2, void *v3) { +void CStarControlSub20::proc11(CErrorCode &errorCode, FVector &v, const FMatrix &m) { if (_field4 > 0.0) { warning("TODO: CStarControlSub20::proc11"); } diff --git a/engines/titanic/star_control/star_control_sub20.h b/engines/titanic/star_control/star_control_sub20.h index 9d90b80d26..eaa9d4fecd 100644 --- a/engines/titanic/star_control/star_control_sub20.h +++ b/engines/titanic/star_control/star_control_sub20.h @@ -25,6 +25,7 @@ #include "titanic/support/simple_file.h" #include "titanic/star_control/error_code.h" +#include "titanic/star_control/fmatrix.h" namespace Titanic { @@ -51,9 +52,9 @@ public: virtual void proc6(); virtual void proc7(); virtual void proc8() {} - virtual void proc9() {} + virtual void proc9(FVector *v, int v2, FMatrix *matrix) {} virtual void proc10() {} - virtual void proc11(CErrorCode *errorCode, void *v2, void *v3); + virtual void proc11(CErrorCode &errorCode, FVector &v, const FMatrix &m); /** * Set the data -- cgit v1.2.3 From 3ee3784073fb7c5299f553c3fd07842aed2d356f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 17 Jul 2016 23:18:06 -0400 Subject: TITANIC: Added remaining CStarControlSub12 virtual methods --- engines/titanic/star_control/fvector.cpp | 3 +- engines/titanic/star_control/fvector.h | 4 +- .../titanic/star_control/star_control_sub12.cpp | 98 +++++++++++++++++++++- engines/titanic/star_control/star_control_sub12.h | 31 +++++-- .../titanic/star_control/star_control_sub13.cpp | 51 +++++++++++ engines/titanic/star_control/star_control_sub13.h | 27 ++++-- engines/titanic/star_control/star_control_sub6.h | 3 +- 7 files changed, 197 insertions(+), 20 deletions(-) diff --git a/engines/titanic/star_control/fvector.cpp b/engines/titanic/star_control/fvector.cpp index ce7b62bc16..aa99e8b4d1 100644 --- a/engines/titanic/star_control/fvector.cpp +++ b/engines/titanic/star_control/fvector.cpp @@ -21,6 +21,7 @@ */ #include "titanic/star_control/fvector.h" +#include "titanic/star_control/star_control_sub6.h" #include "common/algorithm.h" #include "common/textconsole.h" @@ -63,7 +64,7 @@ void FVector::fn4(FVector *dest, const FVector *v1, const FVector *v2) { *dest = tempVector; } -void FVector::fn5(FVector *dest, const void *v) const { +void FVector::fn5(FVector *dest, const CStarControlSub6 *sub6) const { error("TODO: FVector::fn5"); } diff --git a/engines/titanic/star_control/fvector.h b/engines/titanic/star_control/fvector.h index 9af18dc71a..8e1ba47a3e 100644 --- a/engines/titanic/star_control/fvector.h +++ b/engines/titanic/star_control/fvector.h @@ -25,6 +25,8 @@ namespace Titanic { +class CStarControlSub6; + /** * Floating point vector class. * @remarks TODO: See if it can be merged with DVector @@ -46,7 +48,7 @@ public: double getDistance(const FVector *src) const; static void fn4(FVector *dest, const FVector *v1, const FVector *v2); - void fn5(FVector *dest, const void *v) const; + void fn5(FVector *dest, const CStarControlSub6 *sub6) const; /** * Returns true if the passed vector equals this one diff --git a/engines/titanic/star_control/star_control_sub12.cpp b/engines/titanic/star_control/star_control_sub12.cpp index 967327014e..85b7c83878 100644 --- a/engines/titanic/star_control/star_control_sub12.cpp +++ b/engines/titanic/star_control/star_control_sub12.cpp @@ -30,13 +30,13 @@ FMatrix *CStarControlSub12::_matrix1; FMatrix *CStarControlSub12::_matrix2; CStarControlSub12::CStarControlSub12(void *val1, void *val2) : - _field4(-1), _handlerP(nullptr), _field108(0), + _currentIndex(-1), _handlerP(nullptr), _field108(0), _sub13(val1) { setupHandler(val2); } CStarControlSub12::CStarControlSub12(CStarControlSub13 *src) : - _field4(-1), _handlerP(nullptr), _field108(0), _sub13(src) { + _currentIndex(-1), _handlerP(nullptr), _field108(0), _sub13(src) { } void CStarControlSub12::init() { @@ -146,6 +146,98 @@ void CStarControlSub12::proc15(int v) { } } +void CStarControlSub12::proc16() { + _handlerP->proc4(); +} + +void CStarControlSub12::proc17() { + _handlerP->proc5(); +} + +void CStarControlSub12::proc18() { + _handlerP->proc6(); +} + +void CStarControlSub12::proc19() { + _handlerP->proc7(); +} + +void CStarControlSub12::proc20(double v) { + if (!isLocked()) + _sub13.fn14(v); +} + +void CStarControlSub12::proc21(CStarControlSub6 &sub6) { + if (!isLocked()) { + _sub13.setPosition(sub6); + set108(); + } +} + +void CStarControlSub12::proc22(FMatrix &m) { + if (!isLocked()) + _sub13.fn15(m); +} + +CStarControlSub6 CStarControlSub12::proc23() { + return _sub13.getSub1(); +} + +CStarControlSub6 CStarControlSub12::proc24() { + return _sub13.getSub2(); +} + +double CStarControlSub12::proc25() const { + return _sub13._field10; +} + +double CStarControlSub12::proc26() const { + return _sub13._field14; +} + +int CStarControlSub12::proc27() const { + return _sub13._field24; +} + +FVector CStarControlSub12::proc28(int index, const void *v2) { + error("TODO: CStarControlSub12::proc28"); + return FVector(); +} + +FVector CStarControlSub12::proc29(const FVector &v) { + return _sub13.fn16(v); +} + +FVector CStarControlSub12::proc30(int index, const FVector &v) { + return _sub13.fn17(index, v); +} + +FVector CStarControlSub12::proc31(int index, const FVector &v) { + return _sub13.fn18(index, v); +} + +void CStarControlSub12::proc32(double v1, double v2) { + error("TODO: CStarControlSub12::proc32"); +} + +bool CStarControlSub12::setArrayVector(const FVector &v) { + if (_currentIndex >= 2) + return false; + + error("TODO: CStarControlSub12::setArrayVector"); +} + +bool CStarControlSub12::proc35() { + if (_currentIndex == -1) + return false; + + error("TODO: CStarControlSub12::proc35"); +} + +void CStarControlSub12::proc36(double *v1, double *v2, double *v3, double *v4) { + _sub13.fn19(v1, v2, v3, v4); +} + void CStarControlSub12::load(SimpleFile *file, int param) { _sub13.load(file, param); } @@ -157,7 +249,7 @@ void CStarControlSub12::save(SimpleFile *file, int indent) { bool CStarControlSub12::setupHandler(void *src) { CStarControlSub20 *handler = nullptr; - switch (_field4) { + switch (_currentIndex) { case -1: handler = new CStarControlSub21(src); break; diff --git a/engines/titanic/star_control/star_control_sub12.h b/engines/titanic/star_control/star_control_sub12.h index 643e3dfb67..1d5f693d20 100644 --- a/engines/titanic/star_control/star_control_sub12.h +++ b/engines/titanic/star_control/star_control_sub12.h @@ -31,18 +31,12 @@ namespace Titanic { class CStarControlSub12 { - struct ArrayEntry { - int _field0; - int _field4; - int _field8; - ArrayEntry() : _field0(0), _field4(0), _field8(0) {} - }; private: static FMatrix *_matrix1; static FMatrix *_matrix2; private: - int _field4; - ArrayEntry _array[3]; + int _currentIndex; + FVector _array[3]; CStarControlSub20 *_handlerP; CStarControlSub13 _sub13; int _field108; @@ -83,6 +77,27 @@ public: virtual void proc13(CStarControlSub13 *dest); virtual void proc14(int v); virtual void proc15(int v); + virtual void proc16(); + virtual void proc17(); + virtual void proc18(); + virtual void proc19(); + virtual void proc20(double v); + virtual void proc21(CStarControlSub6 &sub6); + virtual void proc22(FMatrix &m); + virtual CStarControlSub6 proc23(); + virtual CStarControlSub6 proc24(); + virtual double proc25() const; + virtual double proc26() const; + virtual int proc27() const; + virtual FVector proc28(int index, const void *v2); + virtual FVector proc29(const FVector &v); + virtual FVector proc30(int index, const FVector &v); + virtual FVector proc31(int index, const FVector &v); + virtual void proc32(double v1, double v2); + virtual int getCurrentIndex() const { return _currentIndex; } + virtual bool setArrayVector(const FVector &v); + virtual bool proc35(); + virtual void proc36(double *v1, double *v2, double *v3, double *v4); /** * Load the data for the class from file diff --git a/engines/titanic/star_control/star_control_sub13.cpp b/engines/titanic/star_control/star_control_sub13.cpp index a69937bfb8..c721b395c6 100644 --- a/engines/titanic/star_control/star_control_sub13.cpp +++ b/engines/titanic/star_control/star_control_sub13.cpp @@ -127,6 +127,13 @@ void CStarControlSub13::setPosition(const FVector &v) { _fieldD4 = 0; } +void CStarControlSub13::setPosition(const CStarControlSub6 &sub6) { + FVector vector; + _position.fn5(&vector, &sub6); + _position = sub6._matrix._row1; + _fieldD4 = 0; +} + void CStarControlSub13::setMatrix(const FMatrix &m) { _matrix = m; _fieldD4 = 0; @@ -179,6 +186,50 @@ void CStarControlSub13::fn13(double v1, double v2) { _field24 = v2 ? 2 : 0; } +void CStarControlSub13::fn14(double v) { + error("TODO: CStarControlSub13::fn14"); +} + +void CStarControlSub13::fn15(FMatrix &matrix) { + _matrix.fn3(&matrix); + _fieldD4 = 0; +} + +CStarControlSub6 CStarControlSub13::getSub1() { + if (!_fieldD4) + reset(); + + return _sub1; +} + +CStarControlSub6 CStarControlSub13::getSub2() { + if (!_fieldD4) + reset(); + + return _sub2; +} + +FVector CStarControlSub13::fn16(const FVector &v) { + error("TODO: CStarControlSub13::fn16"); +} + +FVector CStarControlSub13::fn17(int index, const FVector &v) { + error("TODO: CStarControlSub13::fn17"); +} + +FVector CStarControlSub13::fn18(int index, const FVector &v) { + error("TODO: CStarControlSub13::fn17"); +} + +void CStarControlSub13::fn19(double *v1, double *v2, double *v3, double *v4) { + error("TODO: CStarControlSub13::fn19"); +} + +void CStarControlSub13::reset() { + const double FACTOR = 3.1415927 * 0.0055555557; + error("TODO: CStarControlSub13::reset"); +} + void CStarControlSub13::getMatrix(FMatrix *matrix) { *matrix = _matrix; } diff --git a/engines/titanic/star_control/star_control_sub13.h b/engines/titanic/star_control/star_control_sub13.h index eacdce3447..2f0b479cec 100644 --- a/engines/titanic/star_control/star_control_sub13.h +++ b/engines/titanic/star_control/star_control_sub13.h @@ -32,27 +32,29 @@ namespace Titanic { class CStarControlSub13 { private: double _fieldC; - double _field10; - double _field14; double _field18; double _field1C; int _width; int _height; - int _field24; double _valArray[5]; FMatrix _matrix; CStarControlSub6 _sub1; CStarControlSub6 _sub2; - int _fieldC0; - int _fieldC4; + double _fieldC0; + double _fieldC4; int _fieldC8; int _fieldCC; - int _fieldD0; + double _fieldD0; int _fieldD4; private: void setup(void *ptr); + + void reset(); public: FVector _position; + double _field10; + double _field14; + int _field24; public: CStarControlSub13(void *ptr); CStarControlSub13(CStarControlSub13 *src); @@ -74,6 +76,11 @@ public: */ void setPosition(const FVector &v); + /** + * Sets the position + */ + void setPosition(const CStarControlSub6 &sub6); + /** * Sets the matrix */ @@ -82,6 +89,14 @@ public: void fn11(const FVector &v); void fn12(); void fn13(double v1, double v2); + void fn14(double v); + void fn15(FMatrix &matrix); + CStarControlSub6 getSub1(); + CStarControlSub6 getSub2(); + FVector fn16(const FVector &v); + FVector fn17(int index, const FVector &v); + FVector fn18(int index, const FVector &v); + void fn19(double *v1, double *v2, double *v3, double *v4); /** * Makes a copy of the instance's matrix into the passed matrix diff --git a/engines/titanic/star_control/star_control_sub6.h b/engines/titanic/star_control/star_control_sub6.h index fe2b3d44b5..118c7c7f10 100644 --- a/engines/titanic/star_control/star_control_sub6.h +++ b/engines/titanic/star_control/star_control_sub6.h @@ -29,7 +29,6 @@ namespace Titanic { class CStarControlSub6 { private: - FMatrix _matrix; int _field24; int _field28; int _field2C; @@ -38,6 +37,8 @@ private: public: static void init(); static void deinit(); +public: + FMatrix _matrix; public: CStarControlSub6(); CStarControlSub6(int mode, double amount); -- cgit v1.2.3 From 5387d4dd7b025ec3e18c4f2c17a5a82d9164e1c8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 18 Jul 2016 18:59:10 -0400 Subject: TITANIC: Added CStarControlSub20 copyFrom/copyTo methods --- .../titanic/star_control/star_control_sub12.cpp | 10 +-- engines/titanic/star_control/star_control_sub12.h | 6 +- .../titanic/star_control/star_control_sub20.cpp | 90 +++++++++++----------- engines/titanic/star_control/star_control_sub20.h | 16 ++-- .../titanic/star_control/star_control_sub21.cpp | 2 +- engines/titanic/star_control/star_control_sub21.h | 2 +- .../titanic/star_control/star_control_sub22.cpp | 2 +- engines/titanic/star_control/star_control_sub22.h | 2 +- engines/titanic/star_control/star_view.cpp | 4 +- 9 files changed, 69 insertions(+), 65 deletions(-) diff --git a/engines/titanic/star_control/star_control_sub12.cpp b/engines/titanic/star_control/star_control_sub12.cpp index 85b7c83878..5840495d34 100644 --- a/engines/titanic/star_control/star_control_sub12.cpp +++ b/engines/titanic/star_control/star_control_sub12.cpp @@ -29,10 +29,10 @@ namespace Titanic { FMatrix *CStarControlSub12::_matrix1; FMatrix *CStarControlSub12::_matrix2; -CStarControlSub12::CStarControlSub12(void *val1, void *val2) : +CStarControlSub12::CStarControlSub12(void *val1, const CStar20Data *data) : _currentIndex(-1), _handlerP(nullptr), _field108(0), _sub13(val1) { - setupHandler(val2); + setupHandler(data); } CStarControlSub12::CStarControlSub12(CStarControlSub13 *src) : @@ -59,8 +59,8 @@ void CStarControlSub12::proc2(const void *src) { _sub13.copyFrom(src); } -void CStarControlSub12::proc3(const void *src) { - _handlerP->copyFrom1(src); +void CStarControlSub12::proc3(const CStar20Data *src) { + _handlerP->copyFrom(src); } void CStarControlSub12::setPosition(const FVector &v) { @@ -246,7 +246,7 @@ void CStarControlSub12::save(SimpleFile *file, int indent) { _sub13.save(file, indent); } -bool CStarControlSub12::setupHandler(void *src) { +bool CStarControlSub12::setupHandler(const CStar20Data *src) { CStarControlSub20 *handler = nullptr; switch (_currentIndex) { diff --git a/engines/titanic/star_control/star_control_sub12.h b/engines/titanic/star_control/star_control_sub12.h index 1d5f693d20..8da45df5c0 100644 --- a/engines/titanic/star_control/star_control_sub12.h +++ b/engines/titanic/star_control/star_control_sub12.h @@ -44,7 +44,7 @@ private: /** * Set up a handler */ - bool setupHandler(void *src); + bool setupHandler(const CStar20Data *src); /** * Deletes any previous handler @@ -59,12 +59,12 @@ public: static void init(); static void deinit(); public: - CStarControlSub12(void *val1, void *val2); + CStarControlSub12(void *val1, const CStar20Data *data); CStarControlSub12(CStarControlSub13 *src); virtual ~CStarControlSub12(); virtual void proc2(const void *src); - virtual void proc3(const void *src); + virtual void proc3(const CStar20Data *src); virtual void setPosition(const FVector &v); virtual void proc5(const FVector &v); virtual void proc6(int v); diff --git a/engines/titanic/star_control/star_control_sub20.cpp b/engines/titanic/star_control/star_control_sub20.cpp index 3611478100..36e70367b5 100644 --- a/engines/titanic/star_control/star_control_sub20.cpp +++ b/engines/titanic/star_control/star_control_sub20.cpp @@ -25,21 +25,21 @@ namespace Titanic { -CStarControlSub20::CStarControlSub20(void *src) { +CStarControlSub20::CStarControlSub20(const CStar20Data *src) { _lockCounter = 0; _dataP = nullptr; if (src) { - copyFrom1(src); + copyFrom(src); } else { - _field4 = 0.0; - _field8 = 0.0; - _fieldC = 20.0; - _field10 = 0.0; - _field14 = 50000.0; - _field18 = 1.0; - _field1C = 1.0; - _field20 = 0.0; + _data._field0 = 0.0; + _data._field4 = 0.0; + _data._field8 = 20.0; + _data._fieldC = 0.0; + _data._field10 = 50000.0; + _data._field14 = 1.0; + _data._field18 = 1.0; + _data._field1C = 0.0; } } @@ -47,51 +47,51 @@ CStarControlSub20::~CStarControlSub20() { clear(); } -void CStarControlSub20::copyFrom1(const void *src) { - error("TODO: CStarControlSub20::copyFrom1"); +void CStarControlSub20::copyFrom(const CStar20Data *src) { + _data = *src; } -void CStarControlSub20::copyFrom2(const void *src) { - error("TODO: CStarControlSub20::copyFrom2"); +void CStarControlSub20::copyTo(CStar20Data *dest) { + *dest = _data; } void CStarControlSub20::proc4() { - if (!isLocked() && _field4 < _field14) { - _field8 += _field4; - if (_fieldC == _field8) - _field4 -= _field8; + if (!isLocked() && _data._field0 < _data._field10) { + _data._field4 += _data._field0; + if (_data._field8 == _data._field4) + _data._field0 -= _data._field4; else - _field4 += _field8; + _data._field0 += _data._field4; } } void CStarControlSub20::proc5() { if (!isLocked()) { - _field8 -= _fieldC; - if (_field8 == _field4) - _field4 += _field8; + _data._field4 -= _data._field8; + if (_data._field4 == _data._field0) + _data._field0 += _data._field4; else - _field4 -= _field8; + _data._field0 -= _data._field4; - if (_field8 < 0.0) - _field8 = 0.0; + if (_data._field4 < 0.0) + _data._field4 = 0.0; } } void CStarControlSub20::proc6() { if (!isLocked()) - _field4 = _field14; + _data._field0 = _data._field10; } void CStarControlSub20::proc7() { if (!isLocked()) { - _field4 = 0.0; - _field8 = 0.0; + _data._field0 = 0.0; + _data._field4 = 0.0; } } void CStarControlSub20::proc11(CErrorCode &errorCode, FVector &v, const FMatrix &m) { - if (_field4 > 0.0) { + if (_data._field0 > 0.0) { warning("TODO: CStarControlSub20::proc11"); } } @@ -110,26 +110,26 @@ void CStarControlSub20::clear() { void CStarControlSub20::load(SimpleFile *file, int val) { if (!val) { - _field4 = file->readFloat(); - _field8 = file->readFloat(); - _fieldC = file->readFloat(); - _field10 = file->readFloat(); - _field14 = file->readFloat(); - _field18 = file->readFloat(); - _field1C = file->readFloat(); - _field20 = file->readFloat(); + _data._field0 = file->readFloat(); + _data._field4 = file->readFloat(); + _data._field8 = file->readFloat(); + _data._fieldC = file->readFloat(); + _data._field10 = file->readFloat(); + _data._field14 = file->readFloat(); + _data._field18 = file->readFloat(); + _data._field1C = file->readFloat(); } } void CStarControlSub20::save(SimpleFile *file, int indent) { - file->writeFloatLine(_field4, indent); - file->writeFloatLine(_field8, indent); - file->writeFloatLine(_fieldC, indent); - file->writeFloatLine(_field10, indent); - file->writeFloatLine(_field14, indent); - file->writeFloatLine(_field18, indent); - file->writeFloatLine(_field1C, indent); - file->writeFloatLine(_field20, indent); + file->writeFloatLine(_data._field0, indent); + file->writeFloatLine(_data._field4, indent); + file->writeFloatLine(_data._field8, indent); + file->writeFloatLine(_data._fieldC, indent); + file->writeFloatLine(_data._field10, indent); + file->writeFloatLine(_data._field14, indent); + file->writeFloatLine(_data._field18, indent); + file->writeFloatLine(_data._field1C, indent); } void CStarControlSub20::incLockCount() { diff --git a/engines/titanic/star_control/star_control_sub20.h b/engines/titanic/star_control/star_control_sub20.h index eaa9d4fecd..66e10a8145 100644 --- a/engines/titanic/star_control/star_control_sub20.h +++ b/engines/titanic/star_control/star_control_sub20.h @@ -29,8 +29,8 @@ namespace Titanic { -class CStarControlSub20 { -public: +struct CStar20Data { + double _field0; double _field4; double _field8; double _fieldC; @@ -38,15 +38,19 @@ public: double _field14; double _field18; double _field1C; - double _field20; +}; + +class CStarControlSub20 { +public: + CStar20Data _data; int _lockCounter; void *_dataP; public: - CStarControlSub20(void *src); + CStarControlSub20(const CStar20Data *src); virtual ~CStarControlSub20(); - virtual void copyFrom1(const void *src); - virtual void copyFrom2(const void *src); + virtual void copyFrom(const CStar20Data *src); + virtual void copyTo(CStar20Data *dest); virtual void proc4(); virtual void proc5(); virtual void proc6(); diff --git a/engines/titanic/star_control/star_control_sub21.cpp b/engines/titanic/star_control/star_control_sub21.cpp index 20b8bc5f86..1730244184 100644 --- a/engines/titanic/star_control/star_control_sub21.cpp +++ b/engines/titanic/star_control/star_control_sub21.cpp @@ -25,7 +25,7 @@ namespace Titanic { -CStarControlSub21::CStarControlSub21(void *src) : +CStarControlSub21::CStarControlSub21(const CStar20Data *src) : CStarControlSub20(src), _sub24() { } diff --git a/engines/titanic/star_control/star_control_sub21.h b/engines/titanic/star_control/star_control_sub21.h index 610f26ec65..5febda0ebb 100644 --- a/engines/titanic/star_control/star_control_sub21.h +++ b/engines/titanic/star_control/star_control_sub21.h @@ -32,7 +32,7 @@ class CStarControlSub21 : public CStarControlSub20 { private: CStarControlSub24 _sub24; public: - CStarControlSub21(void *src); + CStarControlSub21(const CStar20Data *src); }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub22.cpp b/engines/titanic/star_control/star_control_sub22.cpp index 9298d5b6de..b06731b6d2 100644 --- a/engines/titanic/star_control/star_control_sub22.cpp +++ b/engines/titanic/star_control/star_control_sub22.cpp @@ -25,7 +25,7 @@ namespace Titanic { -CStarControlSub22::CStarControlSub22(void *src) : +CStarControlSub22::CStarControlSub22(const CStar20Data *src) : CStarControlSub20(src), _sub27() { } diff --git a/engines/titanic/star_control/star_control_sub22.h b/engines/titanic/star_control/star_control_sub22.h index dae231f703..88a114f8c3 100644 --- a/engines/titanic/star_control/star_control_sub22.h +++ b/engines/titanic/star_control/star_control_sub22.h @@ -32,7 +32,7 @@ class CStarControlSub22 : public CStarControlSub20 { private: CStarControlSub27 _sub27; public: - CStarControlSub22(void *src); + CStarControlSub22(const CStar20Data *src); }; } // End of namespace Titanic diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp index 5140dc086f..f5d1d36c49 100644 --- a/engines/titanic/star_control/star_view.cpp +++ b/engines/titanic/star_control/star_view.cpp @@ -32,10 +32,10 @@ CStarView::CStarView() : _sub12(nullptr, nullptr), _sub13((void *)nullptr), _owner(nullptr), _starField(nullptr), _videoSurface(nullptr), _field118(0), _videoSurface2(nullptr), _field210(0), _homePhotoMask(nullptr), _field218(0), _field21C(0) { - static const uint DATA[8] = { 0, 0, 0x47C35000, 0, 0x41A00000, + CStar20Data data = { 0, 0, 0x47C35000, 0, 0x41A00000, 0x3F800000, 0x3F800000, 0x3F800000 }; - _sub12.proc3(&DATA[0]); + _sub12.proc3(&data); } void CStarView::load(SimpleFile *file, int param) { -- cgit v1.2.3 From 25e8d1d5a8724b7bb93de2cb3b0253bdb6b66e4c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 18 Jul 2016 19:28:10 -0400 Subject: TITANIC: Simplify data usage in CStarControlSub20 --- .../titanic/star_control/star_control_sub20.cpp | 82 +++++++++++----------- engines/titanic/star_control/star_control_sub20.h | 3 +- 2 files changed, 42 insertions(+), 43 deletions(-) diff --git a/engines/titanic/star_control/star_control_sub20.cpp b/engines/titanic/star_control/star_control_sub20.cpp index 36e70367b5..4454ead74b 100644 --- a/engines/titanic/star_control/star_control_sub20.cpp +++ b/engines/titanic/star_control/star_control_sub20.cpp @@ -32,14 +32,14 @@ CStarControlSub20::CStarControlSub20(const CStar20Data *src) { if (src) { copyFrom(src); } else { - _data._field0 = 0.0; - _data._field4 = 0.0; - _data._field8 = 20.0; - _data._fieldC = 0.0; - _data._field10 = 50000.0; - _data._field14 = 1.0; - _data._field18 = 1.0; - _data._field1C = 0.0; + _field0 = 0.0; + _field4 = 0.0; + _field8 = 20.0; + _fieldC = 0.0; + _field10 = 50000.0; + _field14 = 1.0; + _field18 = 1.0; + _field1C = 0.0; } } @@ -48,50 +48,50 @@ CStarControlSub20::~CStarControlSub20() { } void CStarControlSub20::copyFrom(const CStar20Data *src) { - _data = *src; + *((CStar20Data *)this) = *src; } void CStarControlSub20::copyTo(CStar20Data *dest) { - *dest = _data; + *dest = *((CStar20Data *)this); } void CStarControlSub20::proc4() { - if (!isLocked() && _data._field0 < _data._field10) { - _data._field4 += _data._field0; - if (_data._field8 == _data._field4) - _data._field0 -= _data._field4; + if (!isLocked() && _field0 < _field10) { + _field4 += _field0; + if (_field8 == _field4) + _field0 -= _field4; else - _data._field0 += _data._field4; + _field0 += _field4; } } void CStarControlSub20::proc5() { if (!isLocked()) { - _data._field4 -= _data._field8; - if (_data._field4 == _data._field0) - _data._field0 += _data._field4; + _field4 -= _field8; + if (_field4 == _field0) + _field0 += _field4; else - _data._field0 -= _data._field4; + _field0 -= _field4; - if (_data._field4 < 0.0) - _data._field4 = 0.0; + if (_field4 < 0.0) + _field4 = 0.0; } } void CStarControlSub20::proc6() { if (!isLocked()) - _data._field0 = _data._field10; + _field0 = _field10; } void CStarControlSub20::proc7() { if (!isLocked()) { - _data._field0 = 0.0; - _data._field4 = 0.0; + _field0 = 0.0; + _field4 = 0.0; } } void CStarControlSub20::proc11(CErrorCode &errorCode, FVector &v, const FMatrix &m) { - if (_data._field0 > 0.0) { + if (_field0 > 0.0) { warning("TODO: CStarControlSub20::proc11"); } } @@ -110,26 +110,26 @@ void CStarControlSub20::clear() { void CStarControlSub20::load(SimpleFile *file, int val) { if (!val) { - _data._field0 = file->readFloat(); - _data._field4 = file->readFloat(); - _data._field8 = file->readFloat(); - _data._fieldC = file->readFloat(); - _data._field10 = file->readFloat(); - _data._field14 = file->readFloat(); - _data._field18 = file->readFloat(); - _data._field1C = file->readFloat(); + _field0 = file->readFloat(); + _field4 = file->readFloat(); + _field8 = file->readFloat(); + _fieldC = file->readFloat(); + _field10 = file->readFloat(); + _field14 = file->readFloat(); + _field18 = file->readFloat(); + _field1C = file->readFloat(); } } void CStarControlSub20::save(SimpleFile *file, int indent) { - file->writeFloatLine(_data._field0, indent); - file->writeFloatLine(_data._field4, indent); - file->writeFloatLine(_data._field8, indent); - file->writeFloatLine(_data._fieldC, indent); - file->writeFloatLine(_data._field10, indent); - file->writeFloatLine(_data._field14, indent); - file->writeFloatLine(_data._field18, indent); - file->writeFloatLine(_data._field1C, indent); + file->writeFloatLine(_field0, indent); + file->writeFloatLine(_field4, indent); + file->writeFloatLine(_field8, indent); + file->writeFloatLine(_fieldC, indent); + file->writeFloatLine(_field10, indent); + file->writeFloatLine(_field14, indent); + file->writeFloatLine(_field18, indent); + file->writeFloatLine(_field1C, indent); } void CStarControlSub20::incLockCount() { diff --git a/engines/titanic/star_control/star_control_sub20.h b/engines/titanic/star_control/star_control_sub20.h index 66e10a8145..359482bc57 100644 --- a/engines/titanic/star_control/star_control_sub20.h +++ b/engines/titanic/star_control/star_control_sub20.h @@ -40,9 +40,8 @@ struct CStar20Data { double _field1C; }; -class CStarControlSub20 { +class CStarControlSub20 : public CStar20Data { public: - CStar20Data _data; int _lockCounter; void *_dataP; public: -- cgit v1.2.3 From 87379442ffb497352915b058b100b688d96a98e9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 18 Jul 2016 21:47:19 -0400 Subject: TITANIC: Fix scanning for files not to free resources --- engines/titanic/support/files_manager.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/engines/titanic/support/files_manager.cpp b/engines/titanic/support/files_manager.cpp index c415731f16..1d2b1d9a8e 100644 --- a/engines/titanic/support/files_manager.cpp +++ b/engines/titanic/support/files_manager.cpp @@ -86,14 +86,16 @@ bool CFilesManager::scanForFile(const CString &name) { fname += ".st"; } + // Return true if the file exists + if (fileExists(fname)) + return true; + + // Couldn't find file. Start by calling the game manager's viewChange + // method, which handles all active scene objects freeing their resources if (_gameManager) _gameManager->viewChange(); - // The original had a bunch of code here handling determining - // which asset path, if any, the filename was present for, - // and storing the "active asset path" it was found on. - // This is redundant for ScummVM, which takes care of the paths - return fileExists(fname); + return false; } void CFilesManager::loadDrive() { -- cgit v1.2.3 From 18e06f727ab55eb232a8f97c09cb9950b29eeef8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 18 Jul 2016 21:51:50 -0400 Subject: TITANIC: Fix loading of movies with only a single video track --- engines/titanic/support/avi_surface.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp index b685fa8cce..7779baf2ff 100644 --- a/engines/titanic/support/avi_surface.cpp +++ b/engines/titanic/support/avi_surface.cpp @@ -74,6 +74,7 @@ AVISurface::AVISurface(const CResourceKey &key) { ++_streamCount; } else { delete decoder2; + _decoders[1] = nullptr; } } -- cgit v1.2.3 From 2ea4116e0ac29c73cad891cb194e16ba645786fa Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 18 Jul 2016 22:32:28 -0400 Subject: TITANIC: gcc compilation fixes --- engines/titanic/pet_control/pet_drag_chev.cpp | 4 +++- engines/titanic/star_control/star_control_sub20.cpp | 2 +- engines/titanic/star_control/star_control_sub20.h | 2 +- engines/titanic/star_control/star_control_sub5.h | 1 + engines/titanic/support/avi_surface.h | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/engines/titanic/pet_control/pet_drag_chev.cpp b/engines/titanic/pet_control/pet_drag_chev.cpp index beaac4e763..d437d43799 100644 --- a/engines/titanic/pet_control/pet_drag_chev.cpp +++ b/engines/titanic/pet_control/pet_drag_chev.cpp @@ -28,7 +28,9 @@ namespace Titanic { BEGIN_MESSAGE_MAP(CPetDragChev, CPetGraphic2) - + ON_MESSAGE(MouseDragStartMsg) + ON_MESSAGE(MouseDragMoveMsg) + ON_MESSAGE(MouseDragEndMsg) END_MESSAGE_MAP() void CPetDragChev::save(SimpleFile *file, int indent) { diff --git a/engines/titanic/star_control/star_control_sub20.cpp b/engines/titanic/star_control/star_control_sub20.cpp index 4454ead74b..5c6c243eaa 100644 --- a/engines/titanic/star_control/star_control_sub20.cpp +++ b/engines/titanic/star_control/star_control_sub20.cpp @@ -98,7 +98,7 @@ void CStarControlSub20::proc11(CErrorCode &errorCode, FVector &v, const FMatrix void CStarControlSub20::setData(void *data) { clear(); - _dataP = data; + _dataP = (byte *)data; } void CStarControlSub20::clear() { diff --git a/engines/titanic/star_control/star_control_sub20.h b/engines/titanic/star_control/star_control_sub20.h index 359482bc57..9dbabbb7f1 100644 --- a/engines/titanic/star_control/star_control_sub20.h +++ b/engines/titanic/star_control/star_control_sub20.h @@ -43,7 +43,7 @@ struct CStar20Data { class CStarControlSub20 : public CStar20Data { public: int _lockCounter; - void *_dataP; + byte *_dataP; public: CStarControlSub20(const CStar20Data *src); virtual ~CStarControlSub20(); diff --git a/engines/titanic/star_control/star_control_sub5.h b/engines/titanic/star_control/star_control_sub5.h index 8007f83338..ce92ef1135 100644 --- a/engines/titanic/star_control/star_control_sub5.h +++ b/engines/titanic/star_control/star_control_sub5.h @@ -44,6 +44,7 @@ private: int _field78B0; public: CStarControlSub5(); + virtual ~CStarControlSub5() {} virtual bool setup(); virtual void proc2(); diff --git a/engines/titanic/support/avi_surface.h b/engines/titanic/support/avi_surface.h index f74f6a808e..32db925d7a 100644 --- a/engines/titanic/support/avi_surface.h +++ b/engines/titanic/support/avi_surface.h @@ -84,7 +84,7 @@ public: double _frameRate; public: AVISurface(const CResourceKey &key); - ~AVISurface(); + virtual ~AVISurface(); /** * Start playing the loaded AVI video -- cgit v1.2.3 From 53c7517dfbae96fe99b7a8e7a32298526e46baa1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 19 Jul 2016 22:41:03 -0400 Subject: TITANIC: Fix loading movies for playback --- engines/titanic/core/game_object.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index f0f0980181..3dad7c2c7f 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -508,7 +508,7 @@ void CGameObject::petSetRemoteTarget() { void CGameObject::playMovie(uint flags) { _frameNumber = -1; - if (_surface && !_resource.empty()) { + if (!_surface && !_resource.empty()) { loadResource(_resource); _resource.clear(); } -- cgit v1.2.3 From d5bf17e73ff9533d2f54588622048ab755f4151b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 20 Jul 2016 07:38:13 -0400 Subject: TITANIC: Add movie _handled flag, simplify frame timinig code --- engines/titanic/game_manager.cpp | 13 ++++++++++--- engines/titanic/support/avi_surface.cpp | 7 +++++-- engines/titanic/support/avi_surface.h | 5 +++++ engines/titanic/support/movie.cpp | 30 ++++++------------------------ engines/titanic/support/movie.h | 9 +-------- 5 files changed, 27 insertions(+), 37 deletions(-) diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index 84306b42e3..7e6916a526 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -192,14 +192,20 @@ void CGameManager::update() { } void CGameManager::updateMovies() { + // Initial iteration to mark all the movies as not yet handled + for (CMovieList::iterator i = CMovie::_playingMovies->begin(); + i != CMovie::_playingMovies->end(); ++i) + (*i)->_handled = false; + bool repeatFlag; do { repeatFlag = false; + // Scan for a movie to process for (CMovieList::iterator i = CMovie::_playingMovies->begin(); - i != CMovie::_playingMovies->end(); ) { + i != CMovie::_playingMovies->end(); ++i) { CMovie *movie = *i; - if (movie->_state) + if (movie->_handled) continue; CMovieEventList eventsList; @@ -229,8 +235,9 @@ void CGameManager::updateMovies() { eventsList.remove(movieEvent); } + // Flag the movie as having been handled + movie->_handled = true; repeatFlag = true; - movie->_state = MSTATE_1; break; } } while (repeatFlag); diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp index 7779baf2ff..38bccafa89 100644 --- a/engines/titanic/support/avi_surface.cpp +++ b/engines/titanic/support/avi_surface.cpp @@ -260,10 +260,13 @@ int AVISurface::getFrame() const { return _decoders[0]->getCurFrame(); } +bool AVISurface::isFrameReady() const { + return _decoders[0]->needsUpdate() && (!_decoders[1] || _decoders[1]->needsUpdate()); +} + bool AVISurface::renderFrame() { // Check there's a frame ready for display - assert(_videoSurface); - if (!_decoders[0]->needsUpdate() || (_decoders[1] && !_decoders[1]->needsUpdate())) + if (!isFrameReady()) return false; // Decode each decoder's video stream into the appropriate surface diff --git a/engines/titanic/support/avi_surface.h b/engines/titanic/support/avi_surface.h index 32db925d7a..dfd4c59267 100644 --- a/engines/titanic/support/avi_surface.h +++ b/engines/titanic/support/avi_surface.h @@ -162,6 +162,11 @@ public: * Duplicates the secondary frame, if the movie has a second video track */ Graphics::ManagedSurface *duplicateSecondaryFrame() const; + + /** + * Returns true if a frame is ready to be rendered + */ + bool isFrameReady() const; }; } // End of namespace Titanic diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index b98a5b57a1..2943ee1a84 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -36,7 +36,7 @@ namespace Titanic { CMovieList *CMovie::_playingMovies; CVideoSurface *CMovie::_movieSurface; -CMovie::CMovie() : ListItem(), _state(MSTATE_0), _field10(0), +CMovie::CMovie() : ListItem(), _handled(false), _field10(0), _field14(0) { } @@ -84,9 +84,6 @@ OSMovie::OSMovie(const CResourceKey &name, CVideoSurface *surface) : _field24 = 0; _field28 = 0; _field2C = 0; - _ticksStart = 0; - _frameTime1 = 0; - _frameTime2 = 17066; surface->resize(_aviSurface.getWidth(), _aviSurface.getHeight()); _aviSurface.setVideoSurface(surface); @@ -165,25 +162,13 @@ void OSMovie::setFrame(uint frameNumber) { bool OSMovie::handleEvents(CMovieEventList &events) { if (!_aviSurface._isPlaying) return false; - - int time = (g_vm->_events->getTicksCount() + ((_ticksStart << 24) - _ticksStart)) << 8; - if (time < _frameTime1) + if (!_aviSurface.isFrameReady()) return _aviSurface._isPlaying; - if (!_field14 && (time - _frameTime1) > (_frameTime2 * 2)) - _frameTime1 = time; - - _frameTime1 += _frameTime2; - _aviSurface.handleEvents(events); - _videoSurface->setMovieFrameSurface(_aviSurface.getSecondarySurface()); - - if (_field14) { - while (_frameTime1 >= time && events.empty()) { - _aviSurface.handleEvents(events); - _videoSurface->setMovieFrameSurface(_aviSurface.getSecondarySurface()); - - _frameTime1 += _frameTime2; - } + // Handle updating the frame + while (_aviSurface.isFrameReady()) { + _aviSurface.handleEvents(events); + _videoSurface->setMovieFrameSurface(_aviSurface.getSecondarySurface()); } return _aviSurface._isPlaying; @@ -202,9 +187,6 @@ int OSMovie::getFrame() const { } void OSMovie::movieStarted() { - _frameTime1 = _frameTime2 = 256000.0 / _aviSurface._frameRate; - _ticksStart = g_vm->_events->getTicksCount(); - if (_aviSurface._hasAudio) _aviSurface._soundManager->movieStarted(); diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index b6c2a09667..feb320f0b2 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -32,10 +32,6 @@ namespace Titanic { -enum MovieState { - MSTATE_0 = 0, MSTATE_1 = 1 -}; - class CGameObject; class CMovie; class CSoundManager; @@ -52,7 +48,7 @@ protected: */ void addToPlayingMovies(); public: - MovieState _state; + bool _handled; int _field10; int _field14; public: @@ -158,9 +154,6 @@ private: int _field24; int _field28; int _field2C; - int _ticksStart; - int _frameTime1; - int _frameTime2; private: /** * Called when a movie is started playing -- cgit v1.2.3 From c5792fce4bcf8a4e2e89d83242a248a56f579bc6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 20 Jul 2016 07:56:26 -0400 Subject: TITANIC: Clarify movie/surface has frame fields & variables --- engines/titanic/core/game_object.cpp | 6 +++--- engines/titanic/core/game_object.h | 6 +++++- engines/titanic/pet_control/pet_gfx_element.cpp | 2 +- engines/titanic/support/movie.cpp | 13 ++++++++----- engines/titanic/support/movie.h | 7 +++++-- engines/titanic/support/video_surface.cpp | 12 ++++++------ engines/titanic/support/video_surface.h | 7 +++++-- 7 files changed, 33 insertions(+), 20 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 3dad7c2c7f..5d913ebf1f 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -240,7 +240,7 @@ void CGameObject::draw(CScreenManager *screenManager) { } Rect CGameObject::getBounds() const { - return (_surface && _surface->proc45()) ? _bounds : Rect(); + return (_surface && _surface->hasFrame()) ? _bounds : Rect(); } void CGameObject::viewChange() { @@ -618,8 +618,8 @@ int CGameObject::getMovieFrame() const { return _initialFrame; } -int CGameObject::getSurface45() const { - return _surface ? _surface->proc45() : 0; +bool CGameObject::surfaceHasFrame() const { + return _surface ? _surface->hasFrame() : false; } void CGameObject::loadSound(const CString &name) { diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index b74c35f524..3f77776bf5 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -639,7 +639,11 @@ public: */ int getPriorClass() const; - int getSurface45() const; + /** + * Returns true if there's an attached surface which has a frame + * ready for display + */ + bool surfaceHasFrame() const; /** * Finds an item in various system areas diff --git a/engines/titanic/pet_control/pet_gfx_element.cpp b/engines/titanic/pet_control/pet_gfx_element.cpp index 511fb5e4de..9fc0c2a57d 100644 --- a/engines/titanic/pet_control/pet_gfx_element.cpp +++ b/engines/titanic/pet_control/pet_gfx_element.cpp @@ -81,7 +81,7 @@ Rect CPetGfxElement::getBounds() const { if (!obj) obj = _object0; - if (obj && obj->getSurface45()) + if (obj && obj->surfaceHasFrame()) return _bounds; else return Rect(); diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index 2943ee1a84..3856c44e7f 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -36,7 +36,7 @@ namespace Titanic { CMovieList *CMovie::_playingMovies; CVideoSurface *CMovie::_movieSurface; -CMovie::CMovie() : ListItem(), _handled(false), _field10(0), +CMovie::CMovie() : ListItem(), _handled(false), _hasVideoFrame(false), _field14(0) { } @@ -67,9 +67,9 @@ bool CMovie::isActive() const { return _playingMovies->contains(this); } -bool CMovie::get10() { - if (_field10) { - _field10 = 0; +bool CMovie::hasVideoFrame() { + if (_hasVideoFrame) { + _hasVideoFrame = 0; return true; } else { return false; @@ -171,6 +171,9 @@ bool OSMovie::handleEvents(CMovieEventList &events) { _videoSurface->setMovieFrameSurface(_aviSurface.getSecondarySurface()); } + // Flag there's a video frame + _hasVideoFrame = true; + return _aviSurface._isPlaying; } @@ -192,7 +195,7 @@ void OSMovie::movieStarted() { // Register the movie in the playing list addToPlayingMovies(); - _field10 = 1; + _hasVideoFrame = true; } void OSMovie::setFrameRate(double rate) { diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index feb320f0b2..2a7d589194 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -49,7 +49,7 @@ protected: void addToPlayingMovies(); public: bool _handled; - int _field10; + bool _hasVideoFrame; int _field14; public: static CMovieList *_playingMovies; @@ -143,7 +143,10 @@ public: */ bool isActive() const; - bool get10(); + /** + * Returns true if there's a video frame + */ + bool hasVideoFrame(); }; class OSMovie : public CMovie { diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index 4169a80b4b..49388b64d8 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -33,7 +33,7 @@ CVideoSurface::CVideoSurface(CScreenManager *screenManager) : _screenManager(screenManager), _rawSurface(nullptr), _movie(nullptr), _pendingLoad(false), _transBlitFlag(false), _fastBlitFlag(false), _movieFrameSurface(nullptr), _transparencyMode(TRANS_DEFAULT), - _field48(0), _field50(1), _lockCount(0) { + _field48(0), _hasFrame(true), _lockCount(0) { _videoSurfaceNum = _videoSurfaceCounter++; } @@ -170,12 +170,12 @@ uint CVideoSurface::getTransparencyColor() { return val; } -bool CVideoSurface::proc45() { - if (_field50) { - _field50 = 0; +bool CVideoSurface::hasFrame() { + if (_hasFrame) { + _hasFrame = false; return true; } else if (_movie) { - return _movie->get10(); + return _movie->hasVideoFrame(); } else { return false; } @@ -519,7 +519,7 @@ bool OSVideoSurface::loadIfReady() { if (hasSurface()) { return true; } else if (_pendingLoad) { - _field50 = 1; + _hasFrame = true; load(); return true; } else { diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index 040161fe8e..0e777bac1e 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -67,7 +67,7 @@ protected: Graphics::ManagedSurface *_movieFrameSurface; int _field48; int _videoSurfaceNum; - int _field50; + bool _hasFrame; int _lockCount; public: CMovie *_movie; @@ -257,7 +257,10 @@ public: */ virtual void transPixelate() = 0; - virtual bool proc45(); + /** + * Returns true if there's a frame to display on the video surface + */ + virtual bool hasFrame(); /** * Duplicates movie frame surface -- cgit v1.2.3 From a13134b38d1400bfc6746657faf87907f9575e80 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 20 Jul 2016 13:44:19 -0400 Subject: TITANIC: Clarify CVideoSurface _field48 as _freeMovieSurface --- engines/titanic/support/video_surface.cpp | 5 ++++- engines/titanic/support/video_surface.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index 49388b64d8..594f660937 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -33,7 +33,7 @@ CVideoSurface::CVideoSurface(CScreenManager *screenManager) : _screenManager(screenManager), _rawSurface(nullptr), _movie(nullptr), _pendingLoad(false), _transBlitFlag(false), _fastBlitFlag(false), _movieFrameSurface(nullptr), _transparencyMode(TRANS_DEFAULT), - _field48(0), _hasFrame(true), _lockCount(0) { + _freeMovieSurface(DisposeAfterUse::NO), _hasFrame(true), _lockCount(0) { _videoSurfaceNum = _videoSurfaceCounter++; } @@ -41,6 +41,9 @@ CVideoSurface::~CVideoSurface() { if (_ddSurface) _videoSurfaceCounter -= freeSurface(); --_videoSurfaceCounter; + + if (_freeMovieSurface == DisposeAfterUse::YES) + delete _movieFrameSurface; } void CVideoSurface::setSurface(CScreenManager *screenManager, DirectDrawSurface *surface) { diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index 0e777bac1e..1f3a0fa2b3 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -65,7 +65,7 @@ protected: Graphics::ManagedSurface *_rawSurface; bool _pendingLoad; Graphics::ManagedSurface *_movieFrameSurface; - int _field48; + DisposeAfterUse::Flag _freeMovieSurface; int _videoSurfaceNum; bool _hasFrame; int _lockCount; -- cgit v1.2.3 From 1102203396b8e924991fd0dc9990004b5d7f2e63 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 20 Jul 2016 18:49:41 -0400 Subject: TITANIC: Add missing engine saving functionality --- engines/titanic/core/project_item.cpp | 4 +-- engines/titanic/detection.cpp | 59 +++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 2 deletions(-) diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp index a768d0e955..6596816c14 100644 --- a/engines/titanic/core/project_item.cpp +++ b/engines/titanic/core/project_item.cpp @@ -160,7 +160,7 @@ void CProjectItem::loadGame(int slotId) { // Open either an existing savegame slot or the new game template if (slotId >= 0) { Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading( - Common::String::format("slot%d.gam", slotId)); + g_vm->generateSaveName(slotId)); file.open(saveFile); } else { Common::File *newFile = new Common::File(); @@ -202,7 +202,7 @@ void CProjectItem::loadGame(int slotId) { void CProjectItem::saveGame(int slotId, const CString &desc) { CompressedFile file; Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving( - Common::String::format("slot%d.gam", slotId)); + g_vm->generateSaveName(slotId)); file.open(saveFile); // Signal the game is being saved diff --git a/engines/titanic/detection.cpp b/engines/titanic/detection.cpp index 70fe25d532..ca4db961b2 100644 --- a/engines/titanic/detection.cpp +++ b/engines/titanic/detection.cpp @@ -21,6 +21,8 @@ */ #include "titanic/titanic.h" +#include "titanic/core/project_item.h" +#include "titanic/support/simple_file.h" #include "base/plugins.h" #include "common/savefile.h" @@ -106,7 +108,40 @@ bool TitanicMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADG } SaveStateList TitanicMetaEngine::listSaves(const char *target) const { + Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); + Common::StringArray filenames; + Common::String saveDesc; + Common::String pattern = Common::String::format("%s.0##", target); + Titanic::TitanicSavegameHeader header; + + filenames = saveFileMan->listSavefiles(pattern); + SaveStateList saveList; + for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { + const char *ext = strrchr(file->c_str(), '.'); + int slot = ext ? atoi(ext + 1) : -1; + + if (slot >= 0 && slot < MAX_SAVES) { + Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(*file); + + if (in) { + Titanic::CompressedFile file; + file.open(in); + Titanic::CProjectItem::readSavegameHeader(&file, header); + saveList.push_back(SaveStateDescriptor(slot, header._saveName)); + + if (header._thumbnail) { + header._thumbnail->free(); + delete header._thumbnail; + } + + file.close(); + } + } + } + + // Sort saves based on slot number. + Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator()); return saveList; } @@ -115,9 +150,33 @@ int TitanicMetaEngine::getMaximumSaveSlot() const { } void TitanicMetaEngine::removeSaveState(const char *target, int slot) const { + Common::String filename = Common::String::format("%s.%03d", target, slot); + g_system->getSavefileManager()->removeSavefile(filename); } SaveStateDescriptor TitanicMetaEngine::querySaveMetaInfos(const char *target, int slot) const { + Common::String filename = Common::String::format("%s.%03d", target, slot); + Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(filename); + + if (f) { + Titanic::CompressedFile file; + file.open(f); + + Titanic::TitanicSavegameHeader header; + Titanic::CProjectItem::readSavegameHeader(&file, header); + + file.close(); + + // Create the return descriptor + SaveStateDescriptor desc(slot, header._saveName); + desc.setThumbnail(header._thumbnail); + desc.setSaveDate(header._year, header._month, header._day); + desc.setSaveTime(header._hour, header._minute); + desc.setPlayTime(header._totalFrames * GAME_FRAME_TIME); + + return desc; + } + return SaveStateDescriptor(); } -- cgit v1.2.3 From 543434aa78fd46a73ba169a773259cf71451e0c5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 20 Jul 2016 19:03:30 -0400 Subject: TITANIC: Fix destroying previous game project when loading savegame --- engines/titanic/core/tree_item.cpp | 12 ++++++------ engines/titanic/core/tree_item.h | 5 +++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index de3d87e0d3..5fcd74bbd7 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -213,16 +213,16 @@ void CTreeItem::moveUnder(CTreeItem *newParent) { } void CTreeItem::destroyAll() { - destroyOthers(); + destroyChildren(); detach(); delete this; } -int CTreeItem::destroyOthers() { +int CTreeItem::destroyChildren() { if (!_firstChild) return 0; - CTreeItem *item = this, *child, *nextSibling; + CTreeItem *item = _firstChild, *child, *nextSibling; int total = 0; do { @@ -230,9 +230,9 @@ int CTreeItem::destroyOthers() { nextSibling = item->_nextSibling; if (child) - total += child->destroyOthers(); - child->detach(); - delete child; + total += item->destroyChildren(); + item->detach(); + delete item; ++total; } while ((item = nextSibling) != nullptr); diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index 49a3fa7a65..46d7996f0f 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -233,9 +233,10 @@ public: void destroyAll(); /** - * Destroys all tree items around the given one + * Destroys all child tree items under this one. + * @returns Total number of tree items recursively removed */ - int destroyOthers(); + int destroyChildren(); /** * Detach the tree item from any other associated tree items -- cgit v1.2.3 From 2db54279e95da5b3ed72b02fe840648b2ce3accd Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 20 Jul 2016 20:12:45 -0400 Subject: TITANIC: Fixes for saving/loading savegame headers --- engines/titanic/core/project_item.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp index 6596816c14..9448aaee1c 100644 --- a/engines/titanic/core/project_item.cpp +++ b/engines/titanic/core/project_item.cpp @@ -202,7 +202,7 @@ void CProjectItem::loadGame(int slotId) { void CProjectItem::saveGame(int slotId, const CString &desc) { CompressedFile file; Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving( - g_vm->generateSaveName(slotId)); + g_vm->generateSaveName(slotId), false); file.open(saveFile); // Signal the game is being saved @@ -529,7 +529,7 @@ void CProjectItem::writeSavegameHeader(SimpleFile *file, TitanicSavegameHeader & file->writeUint16LE(td.tm_mday); file->writeUint16LE(td.tm_hour); file->writeUint16LE(td.tm_min); - file->writeUint16LE(g_vm->_events->getFrameCounter()); + file->writeUint32LE(g_vm->_events->getFrameCounter()); } Graphics::Surface *CProjectItem::createThumbnail() { -- cgit v1.2.3 From 0ed7b463e885e499f2603b6bd3e49929c45af84a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 20 Jul 2016 21:51:44 -0400 Subject: TITANIC: Fixes for saving & loading savegames --- engines/titanic/core/project_item.cpp | 7 +++++++ engines/titanic/core/room_item.cpp | 1 + engines/titanic/game_manager.cpp | 8 ++++++++ engines/titanic/game_manager.h | 5 +++++ engines/titanic/moves/exit_bridge.cpp | 2 ++ engines/titanic/star_control/star_control.cpp | 2 +- engines/titanic/true_talk/tt_npc_script.cpp | 13 +++++++------ 7 files changed, 31 insertions(+), 7 deletions(-) diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp index 9448aaee1c..4fd2ea2f5c 100644 --- a/engines/titanic/core/project_item.cpp +++ b/engines/titanic/core/project_item.cpp @@ -69,6 +69,10 @@ void CProjectItem::save(SimpleFile *file, int indent) { file->writeNumberLine(_nextObjectNumber, indent); file->writeQuotedLine("Next Avail. Message Number", indent); file->writeNumberLine(_nextMessageNumber, indent); + + file->writeQuotedLine("", indent); + _files.save(file, indent); + file->writeQuotedLine("Next Avail. Room Number", indent); file->writeNumberLine(_nextRoomNumber, indent); @@ -216,6 +220,9 @@ void CProjectItem::saveGame(int slotId, const CString &desc) { // Save the contents out saveData(&file, this); + // Save the game manager data + _gameManager->save(&file); + // Close the file and signal that the saving has finished file.close(); postSave(); diff --git a/engines/titanic/core/room_item.cpp b/engines/titanic/core/room_item.cpp index 78bd678138..a88238d94d 100644 --- a/engines/titanic/core/room_item.cpp +++ b/engines/titanic/core/room_item.cpp @@ -35,6 +35,7 @@ void CRoomItem::save(SimpleFile *file, int indent) { file->writeQuotedLine("Exit Movies", indent); _exitMovieKey.save(file, indent); + file->writeQuotedLine("Room dimensions x 1000", indent); file->writeNumberLine(_roomDimensionX * 1000.0, indent + 1); file->writeNumberLine(_roomDimensionY * 1000.0, indent + 1); diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index 7e6916a526..06704995bd 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -56,6 +56,14 @@ CGameManager::~CGameManager() { _project->resetGameManager(); } +void CGameManager::save(SimpleFile *file) { + file->writeNumber(_lastDiskTicksCount); + _gameState.save(file); + _timers.save(file, 0); + _trueTalkManager.save(file); + _sound.save(file); +} + void CGameManager::load(SimpleFile *file) { file->readNumber(); diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index 179e6cde14..129ce6b175 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -81,6 +81,11 @@ public: CGameManager(CProjectItem *project, CGameView *gameView); ~CGameManager(); + /** + * Save data to a save file + */ + void save(SimpleFile *file); + /** * Load data from a save file */ diff --git a/engines/titanic/moves/exit_bridge.cpp b/engines/titanic/moves/exit_bridge.cpp index 2ff56d30ec..b913911341 100644 --- a/engines/titanic/moves/exit_bridge.cpp +++ b/engines/titanic/moves/exit_bridge.cpp @@ -29,6 +29,8 @@ CExitBridge::CExitBridge() : CMovePlayerTo() { void CExitBridge::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); + file->writeQuotedLine(_string1, indent); + CMovePlayerTo::save(file, indent); } diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp index 3324d177ba..18876adadc 100644 --- a/engines/titanic/star_control/star_control.cpp +++ b/engines/titanic/star_control/star_control.cpp @@ -50,7 +50,7 @@ CStarControl::~CStarControl() { } void CStarControl::save(SimpleFile *file, int indent) { - file->writeNumberLine(1, indent); + file->writeNumberLine(0, indent); _starField.save(file, indent); _view.save(file, indent); CGameObject::save(file, indent); diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 8289b53504..70953914fa 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -392,10 +392,10 @@ void TTnpcScript::load(SimpleFile *file) { } void TTnpcScript::saveBody(SimpleFile *file) { - int v = proc31(); - file->writeNumber(v); + int count = proc31(); + file->writeNumber(count); - if (v > 0) { + if (count > 0) { for (uint idx = 0; idx < _ranges.size(); ++idx) { const TTscriptRange &item = _ranges[idx]; if (item._mode == SF_RANDOM && item._priorIndex) { @@ -411,12 +411,13 @@ void TTnpcScript::loadBody(SimpleFile *file) { preLoad(); for (int index = 0; index < count; index += 2) { - int v = file->readNumber(); + int id = file->readNumber(); + int val = file->readNumber(); for (uint idx = 0; idx < _ranges.size(); ++idx) { TTscriptRange &item = _ranges[idx]; - if (!item._id) { - item._id = v; + if (item._id == id) { + item._priorIndex = val; break; } } -- cgit v1.2.3 From 4ff421570679621db76cca59315a036bf64a6550 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 20 Jul 2016 22:23:42 -0400 Subject: TITANIC: Display first 5 savegame slots in PET RealLife tab --- engines/titanic/pet_control/pet_load_save.cpp | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/engines/titanic/pet_control/pet_load_save.cpp b/engines/titanic/pet_control/pet_load_save.cpp index 0ae9f3fe77..17e6f5eee5 100644 --- a/engines/titanic/pet_control/pet_load_save.cpp +++ b/engines/titanic/pet_control/pet_load_save.cpp @@ -23,6 +23,7 @@ #include "titanic/pet_control/pet_load_save.h" #include "titanic/pet_control/pet_control.h" #include "titanic/core/project_item.h" +#include "titanic/titanic.h" namespace Titanic { @@ -53,6 +54,7 @@ bool CPetLoadSave::setup(CPetControl *petControl, CPetGlyphs *owner) { bool CPetLoadSave::reset() { highlightChange(); + resetSlots(); CPetControl *pet = getPetControl(); if (pet) { @@ -124,14 +126,29 @@ Rect CPetLoadSave::getSlotBounds(int index) { } void CPetLoadSave::resetSlots() { - CPetControl *pet = getPetControl(); - CProjectItem *project = pet ? pet->getRoot() : nullptr; - for (int idx = 0; idx < SAVEGAME_SLOTS_COUNT; ++idx) { _slotNames[idx].setText("Empty"); - if (project) { - warning("TODO: Get savegame name"); + // Try and open up the savegame for access + Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading( + g_vm->generateSaveName(idx)); + + if (in) { + // Read in the savegame header data + CompressedFile file; + file.open(in); + + TitanicSavegameHeader header; + CProjectItem::readSavegameHeader(&file, header); + if (header._thumbnail) { + header._thumbnail->free(); + delete header._thumbnail; + } + + file.close(); + + // Set the name text + _slotNames[idx].setText(header._saveName); } } -- cgit v1.2.3 From 41a3c83bc6444550c9e4ea1a5918450403e0e5ee Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 22 Jul 2016 12:44:14 -0400 Subject: TITANIC: Fleshing out PET RealLife Load functionality --- engines/titanic/game_manager.cpp | 7 +++++-- engines/titanic/game_manager.h | 5 +++++ engines/titanic/pet_control/pet_load.cpp | 28 ++++++++++++++++++++++++++- engines/titanic/pet_control/pet_load.h | 5 +++++ engines/titanic/pet_control/pet_load_save.cpp | 20 ++++++------------- engines/titanic/pet_control/pet_load_save.h | 9 ++++----- engines/titanic/pet_control/pet_save.cpp | 15 ++++++++++++++ engines/titanic/pet_control/pet_save.h | 7 ++++++- 8 files changed, 73 insertions(+), 23 deletions(-) diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index 06704995bd..2f83bca867 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -47,13 +47,16 @@ CGameManager::CGameManager(CProjectItem *project, CGameView *gameView): CGameManager::~CGameManager() { delete _movie; delete _movieSurface; + destroyTreeItem(); + _project->resetGameManager(); +} + +void CGameManager::destroyTreeItem() { if (_treeItem) { _treeItem->destroyAll(); _treeItem = nullptr; } - - _project->resetGameManager(); } void CGameManager::save(SimpleFile *file) { diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index 129ce6b175..4808b260b7 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -81,6 +81,11 @@ public: CGameManager(CProjectItem *project, CGameView *gameView); ~CGameManager(); + /** + * Destroys and allocated tree item + */ + void destroyTreeItem(); + /** * Save data to a save file */ diff --git a/engines/titanic/pet_control/pet_load.cpp b/engines/titanic/pet_control/pet_load.cpp index f4be690bd2..cb3514ee56 100644 --- a/engines/titanic/pet_control/pet_load.cpp +++ b/engines/titanic/pet_control/pet_load.cpp @@ -22,6 +22,8 @@ #include "titanic/pet_control/pet_load.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/core/project_item.h" +#include "titanic/game_manager.h" namespace Titanic { @@ -38,12 +40,36 @@ bool CPetLoad::reset() { return true; } +bool CPetLoad::MouseButtonUpMsg(const Point &pt) { + if (_btnLoadSave.MouseButtonUpMsg(pt)) { + execute(); + return true; + } else { + return false; + } +} + void CPetLoad::getTooltip(CPetText *text) { text->setText("Load the game."); } void CPetLoad::execute() { - warning("TODO: CPetLoad::execute"); + CPetControl *pet = getPetControl(); + + if (_savegameSlotNum >= 0 && _slotInUse[_savegameSlotNum]) { + CProjectItem *project = pet ? pet->getRoot() : nullptr; + CGameManager *gameManager = project ? project->getGameManager() : nullptr; + + if (project && gameManager) { + pet->displayMessage("Loading the selected game, please wait."); + + gameManager->destroyTreeItem(); + gameManager->initBounds(); + project->loadGame(_savegameSlotNum); + } + } else if (pet) { + pet->displayMessage("You must select a game to load first."); + } } } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_load.h b/engines/titanic/pet_control/pet_load.h index f87cd8afb2..ad0b026818 100644 --- a/engines/titanic/pet_control/pet_load.h +++ b/engines/titanic/pet_control/pet_load.h @@ -34,6 +34,11 @@ public: */ virtual bool reset(); + /** + * Handles mouse button up messages + */ + virtual bool MouseButtonUpMsg(const Point &pt); + /** * Highlight any currently highlighted element */ diff --git a/engines/titanic/pet_control/pet_load_save.cpp b/engines/titanic/pet_control/pet_load_save.cpp index 17e6f5eee5..77b6126249 100644 --- a/engines/titanic/pet_control/pet_load_save.cpp +++ b/engines/titanic/pet_control/pet_load_save.cpp @@ -81,16 +81,6 @@ bool CPetLoadSave::MouseButtonDownMsg(const Point &pt) { return false; } -bool CPetLoadSave::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { - if (_btnLoadSave.MouseButtonUpMsg(msg->_mousePos)) { - execute(); - resetSlots(); - return true; - } else { - return false; - } -} - bool CPetLoadSave::KeyCharMsg(Common::KeyCode key) { switch (key) { case Common::KEYCODE_TAB: @@ -128,6 +118,7 @@ Rect CPetLoadSave::getSlotBounds(int index) { void CPetLoadSave::resetSlots() { for (int idx = 0; idx < SAVEGAME_SLOTS_COUNT; ++idx) { _slotNames[idx].setText("Empty"); + _slotInUse[idx] = false; // Try and open up the savegame for access Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading( @@ -139,16 +130,17 @@ void CPetLoadSave::resetSlots() { file.open(in); TitanicSavegameHeader header; - CProjectItem::readSavegameHeader(&file, header); + if (CProjectItem::readSavegameHeader(&file, header)) { + _slotInUse[idx] = true; + _slotNames[idx].setText(header._saveName); + } + if (header._thumbnail) { header._thumbnail->free(); delete header._thumbnail; } file.close(); - - // Set the name text - _slotNames[idx].setText(header._saveName); } } diff --git a/engines/titanic/pet_control/pet_load_save.h b/engines/titanic/pet_control/pet_load_save.h index 8f8634dfdf..687bd13e58 100644 --- a/engines/titanic/pet_control/pet_load_save.h +++ b/engines/titanic/pet_control/pet_load_save.h @@ -58,6 +58,7 @@ private: bool isSlotHighlighted(int index, const Point &pt); protected: CPetText _slotNames[SAVEGAME_SLOTS_COUNT]; + bool _slotInUse[SAVEGAME_SLOTS_COUNT]; CPetGfxElement _btnLoadSave; CPetGfxElement _gutter; static int _savegameSlotNum; @@ -87,16 +88,14 @@ public: */ virtual bool MouseButtonDownMsg(const Point &pt); - /** - * Handles mouse button messages - */ - virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); - /** * Handles keypresses when the glyph is focused */ virtual bool KeyCharMsg(Common::KeyCode key); + /** + * Resets highlighting on the save slots + */ virtual void resetSaves() { resetSlots(); } /** diff --git a/engines/titanic/pet_control/pet_save.cpp b/engines/titanic/pet_control/pet_save.cpp index a2e458b52a..341053948e 100644 --- a/engines/titanic/pet_control/pet_save.cpp +++ b/engines/titanic/pet_control/pet_save.cpp @@ -38,6 +38,21 @@ bool CPetSave::reset() { return true; } +bool CPetSave::MouseButtonUpMsg(const Point &pt) { + if (_btnLoadSave.MouseButtonUpMsg(pt)) { + execute(); + resetSlots(); + return true; + } else { + return false; + } +} + +void CPetSave::highlightCurrent() { + resetSlots(); + highlightSave(_savegameSlotNum); +} + void CPetSave::getTooltip(CPetText *text) { text->setText("Save the game."); } diff --git a/engines/titanic/pet_control/pet_save.h b/engines/titanic/pet_control/pet_save.h index 106d499d96..d37f4e3012 100644 --- a/engines/titanic/pet_control/pet_save.h +++ b/engines/titanic/pet_control/pet_save.h @@ -34,6 +34,11 @@ public: */ virtual bool reset(); + /** + * Handles mouse button up messages + */ + virtual bool MouseButtonUpMsg(const Point &pt); + /** * Unhighlight any currently highlighted element */ @@ -42,7 +47,7 @@ public: /** * Highlight any currently highlighted element */ - virtual void highlightCurrent() { highlightSave(_savegameSlotNum); } + virtual void highlightCurrent(); /** * Returns the tooltip text for when the glyph is selected -- cgit v1.2.3 From 03b45f44dfdb86a9607aaa09a02e5c57968e275f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 22 Jul 2016 13:28:32 -0400 Subject: TITANIC: Workaround for original using destroyed objects after save load The original loads savegames by loading a new project hierarchy and then deleting and replacing the existing one. This means that objects in the original project, such as the PET control, are destroyed, leaving the remainder of the PET code that called load operating on destroyed objects. This workaround instead flags for a load to be done, and adds new code in the game manager to take care of it. This way, the remainder of the PET event handling can finish first, and it will be then safe to destroy the original game project (including PET) and load the new savegame. --- engines/titanic/game_state.h | 3 ++- engines/titanic/main_game_window.cpp | 12 ++++++++++++ engines/titanic/main_game_window.h | 6 ++++++ engines/titanic/pet_control/pet_load.cpp | 13 ++++--------- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h index 125882a9dd..d90c845ed5 100644 --- a/engines/titanic/game_state.h +++ b/engines/titanic/game_state.h @@ -33,7 +33,8 @@ namespace Titanic { class CGameManager; -enum GameStateMode { GSMODE_UNSELECTED = 0, GSMODE_SELECTED = 1, GSMODE_2 = 2, GSMODE_3 = 3, GSMODE_4 = 4, GSMODE_5 = 5 }; +enum GameStateMode { GSMODE_UNSELECTED = 0, GSMODE_SELECTED = 1, GSMODE_2 = 2, GSMODE_3 = 3, GSMODE_4 = 4, GSMODE_5 = 5, + GSMODE_PENDING_LOAD }; PTR_LIST_ITEM(CMovie); class CGameStateMovieList : public List { diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 73ce375881..3c549c4e89 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -36,6 +36,7 @@ CMainGameWindow::CMainGameWindow(TitanicEngine *vm): _vm(vm) { _inputAllowed = false; _image = nullptr; _cursor = nullptr; + _pendingLoadSlot = -1; } bool CMainGameWindow::Create() { @@ -137,6 +138,12 @@ void CMainGameWindow::draw() { g_vm->_filesManager->debug(scrManager); break; + case GSMODE_PENDING_LOAD: + // Pending savegame to load + _gameManager->_gameState.setMode(GSMODE_SELECTED); + _vm->_window->_project->loadGame(_pendingLoadSlot); + break; + default: break; } @@ -190,4 +197,9 @@ void CMainGameWindow::mouseChanged() { _gameManager->update(); } +void CMainGameWindow::loadGame(int slotId) { + _pendingLoadSlot = slotId; + _gameManager->_gameState.setMode(GSMODE_PENDING_LOAD); +} + } // End of namespace Titanic diff --git a/engines/titanic/main_game_window.h b/engines/titanic/main_game_window.h index 78f01b9d79..18c03942ce 100644 --- a/engines/titanic/main_game_window.h +++ b/engines/titanic/main_game_window.h @@ -37,6 +37,7 @@ class TitanicEngine; class CMainGameWindow { private: TitanicEngine *_vm; + int _pendingLoadSlot; /** * Checks for the presence of any savegames and, if present, @@ -98,6 +99,11 @@ public: * Called by the event handler when a mouse event has been generated */ void mouseChanged(); + + /** + * Schedules a savegame to be loaded + */ + void loadGame(int slotId); }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_load.cpp b/engines/titanic/pet_control/pet_load.cpp index cb3514ee56..04eec54f25 100644 --- a/engines/titanic/pet_control/pet_load.cpp +++ b/engines/titanic/pet_control/pet_load.cpp @@ -24,6 +24,7 @@ #include "titanic/pet_control/pet_control.h" #include "titanic/core/project_item.h" #include "titanic/game_manager.h" +#include "titanic/titanic.h" namespace Titanic { @@ -57,16 +58,10 @@ void CPetLoad::execute() { CPetControl *pet = getPetControl(); if (_savegameSlotNum >= 0 && _slotInUse[_savegameSlotNum]) { - CProjectItem *project = pet ? pet->getRoot() : nullptr; - CGameManager *gameManager = project ? project->getGameManager() : nullptr; + CMainGameWindow *window = g_vm->_window; - if (project && gameManager) { - pet->displayMessage("Loading the selected game, please wait."); - - gameManager->destroyTreeItem(); - gameManager->initBounds(); - project->loadGame(_savegameSlotNum); - } + // WORKAROUND: Schedule the savegame to be loaded after frame rendering ends + window->loadGame(_savegameSlotNum); } else if (pet) { pet->displayMessage("You must select a game to load first."); } -- cgit v1.2.3 From 4f08292c8c082361af7212e3951af4b1b6c45199 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 22 Jul 2016 19:20:05 -0400 Subject: TITANIC: Add support for arbitrary window event targets Also moved all standard game event methods to CMainGameWindow. This will allow for the Continue Save dialog to be added in and get events instead of the game window --- engines/titanic/detection.cpp | 5 +- engines/titanic/events.cpp | 143 ++-------------------- engines/titanic/events.h | 79 +++++++----- engines/titanic/game_state.cpp | 2 +- engines/titanic/main_game_window.cpp | 147 +++++++++++++++++++++-- engines/titanic/main_game_window.h | 42 ++++++- engines/titanic/pet_control/pet_rooms_glyphs.cpp | 4 +- engines/titanic/titanic.cpp | 27 +++++ engines/titanic/titanic.h | 8 ++ engines/titanic/true_talk/tt_npc_script.cpp | 2 +- 10 files changed, 282 insertions(+), 177 deletions(-) diff --git a/engines/titanic/detection.cpp b/engines/titanic/detection.cpp index ca4db961b2..a9878d9da7 100644 --- a/engines/titanic/detection.cpp +++ b/engines/titanic/detection.cpp @@ -127,8 +127,9 @@ SaveStateList TitanicMetaEngine::listSaves(const char *target) const { if (in) { Titanic::CompressedFile file; file.open(in); - Titanic::CProjectItem::readSavegameHeader(&file, header); - saveList.push_back(SaveStateDescriptor(slot, header._saveName)); + + if (Titanic::CProjectItem::readSavegameHeader(&file, header)) + saveList.push_back(SaveStateDescriptor(slot, header._saveName)); if (header._thumbnail) { header._thumbnail->free(); diff --git a/engines/titanic/events.cpp b/engines/titanic/events.cpp index ff425abcde..381d371a68 100644 --- a/engines/titanic/events.cpp +++ b/engines/titanic/events.cpp @@ -30,9 +30,8 @@ namespace Titanic { -Events::Events(TitanicEngine *vm): _vm(vm), _specialButtons(0), - _frameCounter(1), _priorFrameTime(0), _priorLeftDownTime(0), - _priorMiddleDownTime(0), _priorRightDownTime(0) { +Events::Events(TitanicEngine *vm): _vm(vm), _frameCounter(1), + _priorFrameTime(0) { } void Events::pollEvents() { @@ -45,29 +44,29 @@ void Events::pollEvents() { switch (event.type) { case Common::EVENT_MOUSEMOVE: _mousePos = event.mouse; - mouseMove(); + eventTarget()->mouseMove(_mousePos); break; case Common::EVENT_LBUTTONDOWN: _mousePos = event.mouse; - leftButtonDown(); + eventTarget()->leftButtonDown(_mousePos); break; case Common::EVENT_LBUTTONUP: _mousePos = event.mouse; - leftButtonUp(); + eventTarget()->leftButtonUp(_mousePos); break; case Common::EVENT_MBUTTONDOWN: _mousePos = event.mouse; - middleButtonDown(); + eventTarget()->middleButtonDown(_mousePos); break; case Common::EVENT_MBUTTONUP: _mousePos = event.mouse; - middleButtonUp(); + eventTarget()->middleButtonUp(_mousePos); break; case Common::EVENT_KEYDOWN: - keyDown(event.kbd); + eventTarget()->keyDown(event.kbd); break; case Common::EVENT_KEYUP: - keyUp(event.kbd); + eventTarget()->keyUp(event.kbd); break; default: break; @@ -87,7 +86,7 @@ bool Events::checkForNextFrameCounter() { _priorFrameTime = milli; // Handle any idle updates - onIdle(); + eventTarget()->onIdle(); // Give time to the debugger _vm->_debugger->onFrame(); @@ -105,128 +104,6 @@ uint32 Events::getTicksCount() const { return g_system->getMillis(); } -void Events::onIdle() { - if (!_vm->_window->_inputAllowed) - return; - CGameManager *gameManager = _vm->_window->_gameManager; - if (!gameManager) - return; - - // Let the game manager perform any game updates - gameManager->update(); - - if (gameManager->_gameState._quitGame) { - // Game needs to shut down - _vm->quitGame(); - } -} - -#define HANDLE_MESSAGE(METHOD) if (_vm->_window->_inputAllowed) { \ - _vm->_window->_gameManager->_inputTranslator.METHOD(_specialButtons, Point(_mousePos.x, _mousePos.y)); \ - _vm->_window->mouseChanged(); \ - } - - -void Events::mouseMove() { - HANDLE_MESSAGE(mouseMove) -} - -void Events::leftButtonDown() { - _specialButtons |= MK_LBUTTON; - - if ((getTicksCount() - _priorLeftDownTime) < DOUBLE_CLICK_TIME) { - _priorLeftDownTime = 0; - leftButtonDoubleClick(); - } else { - _priorLeftDownTime = getTicksCount(); - HANDLE_MESSAGE(leftButtonDown) - } -} - -void Events::leftButtonUp() { - _specialButtons &= ~MK_LBUTTON; - HANDLE_MESSAGE(leftButtonUp) -} - -void Events::leftButtonDoubleClick() { - HANDLE_MESSAGE(leftButtonDoubleClick) -} - -void Events::middleButtonDown() { - _specialButtons |= MK_MBUTTON; - - if ((getTicksCount() - _priorMiddleDownTime) < DOUBLE_CLICK_TIME) { - _priorMiddleDownTime = 0; - middleButtonDoubleClick(); - } else { - _priorMiddleDownTime = getTicksCount(); - HANDLE_MESSAGE(middleButtonDown) - } -} - -void Events::middleButtonUp() { - _specialButtons &= ~MK_MBUTTON; - HANDLE_MESSAGE(middleButtonUp) -} - -void Events::middleButtonDoubleClick() { - HANDLE_MESSAGE(middleButtonDoubleClick) -} - -void Events::rightButtonDown() { - _specialButtons |= MK_RBUTTON; - - if ((getTicksCount() - _priorRightDownTime) < DOUBLE_CLICK_TIME) { - _priorRightDownTime = 0; - rightButtonDoubleClick(); - } else { - _priorRightDownTime = getTicksCount(); - HANDLE_MESSAGE(rightButtonDown) - } -} - -void Events::rightButtonUp() { - _specialButtons &= ~MK_RBUTTON; - HANDLE_MESSAGE(rightButtonUp) -} - -void Events::rightButtonDoubleClick() { - HANDLE_MESSAGE(rightButtonDoubleClick) -} - -void Events::charPress(char c) { - -} - -void Events::keyDown(Common::KeyState keyState) { - handleKbdSpecial(keyState); - - if (keyState.keycode == Common::KEYCODE_d && (keyState.flags & Common::KBD_CTRL)) { - // Attach to the debugger - _vm->_debugger->attach(); - _vm->_debugger->onFrame(); - } - - if (_vm->_window->_inputAllowed) - _vm->_window->_gameManager->_inputTranslator.keyDown(keyState); -} - -void Events::keyUp(Common::KeyState keyState) { - handleKbdSpecial(keyState); -} - -void Events::handleKbdSpecial(Common::KeyState keyState) { - if (keyState.flags & Common::KBD_CTRL) - _specialButtons |= MK_CONTROL; - else - _specialButtons &= ~MK_CONTROL; - - if (keyState.flags & Common::KBD_SHIFT) - _specialButtons |= MK_SHIFT; - else - _specialButtons &= ~MK_SHIFT; -} - void Events::sleep(uint time) { uint32 delayEnd = g_system->getMillis() + time; diff --git a/engines/titanic/events.h b/engines/titanic/events.h index ab3d755535..68666c7c46 100644 --- a/engines/titanic/events.h +++ b/engines/titanic/events.h @@ -25,6 +25,8 @@ #include "common/scummsys.h" #include "common/events.h" +#include "common/stack.h" +#include "support/rect.h" namespace Titanic { @@ -39,16 +41,41 @@ enum SpecialButtons { class TitanicEngine; +/** + * A base class for windows that can receive event messages + */ +class CEventTarget { +public: + virtual ~CEventTarget() {} + + /** + * Called to handle any regular updates the game requires + */ + virtual void onIdle() {} + + /** + * Mouse/key event handlers + */ + virtual void mouseMove(const Point &mousePos) {} + virtual void leftButtonDown(const Point &mousePos) {} + virtual void leftButtonUp(const Point &mousePos) {} + virtual void leftButtonDoubleClick(const Point &mousePos) {} + virtual void middleButtonDown(const Point &mousePos) {} + virtual void middleButtonUp(const Point &mousePos) {} + virtual void middleButtonDoubleClick(const Point &mousePos) {} + virtual void rightButtonDown(const Point &mousePos) {} + virtual void rightButtonUp(const Point &mousePos) {} + virtual void keyDown(Common::KeyState keyState) {} + virtual void keyUp(Common::KeyState keyState) {} +}; + class Events { private: TitanicEngine *_vm; + Common::Stack _eventTargets; uint32 _frameCounter; uint32 _priorFrameTime; - uint32 _priorLeftDownTime; - uint32 _priorMiddleDownTime; - uint32 _priorRightDownTime; Common::Point _mousePos; - uint _specialButtons; /** * Check whether it's time to display the next screen frame @@ -56,28 +83,31 @@ private: bool checkForNextFrameCounter(); /** - * Called to handle any regular updates the game requires + * Return the currently active event target */ - void onIdle(); - - void mouseMove(); - void leftButtonDown(); - void leftButtonUp(); - void leftButtonDoubleClick(); - void middleButtonDown(); - void middleButtonUp(); - void middleButtonDoubleClick(); - void rightButtonDown(); - void rightButtonUp(); - void rightButtonDoubleClick(); - void charPress(char c); - void keyDown(Common::KeyState keyState); - void keyUp(Common::KeyState keyState); - void handleKbdSpecial(Common::KeyState keyState); + CEventTarget *eventTarget() const { + return _eventTargets.top(); + } public: Events(TitanicEngine *vm); ~Events() {} + /** + * Adds a new event target to the top of the list. It will get + * all events generated until such time as another is pushed on + * top of it, or the removeTarget method is called + */ + void addTarget(CEventTarget *target) { + _eventTargets.push(target); + } + + /** + * Removes the currently active event target + */ + void removeTarget() { + _eventTargets.pop(); + } + /** * Check for any pending events */ @@ -99,13 +129,6 @@ public: */ uint32 getTicksCount() const; - /** - * Return whether a given special key is currently pressed - */ - bool isSpecialPressed(SpecialButtons btn) const { return _specialButtons; } - - uint getSpecialButtons() const { return _specialButtons; } - /** * Sleep for a specified period of time */ diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index 6c81bc8699..f7ae304b29 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -120,7 +120,7 @@ void CGameState::changeView(CViewItem *newView, CMovieClip *clip) { oldView->leaveView(newView); // If Shift key is pressed, skip showing the transition clip - if (g_vm->_events->isSpecialPressed(MK_SHIFT)) + if (g_vm->_window->isSpecialPressed(MK_SHIFT)) clip = nullptr; if (_mode == GSMODE_2) { diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 3c549c4e89..736154a502 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -20,16 +20,19 @@ * */ +#include "common/config-manager.h" #include "titanic/titanic.h" -#include "titanic/main_game_window.h" #include "titanic/game_manager.h" #include "titanic/game_view.h" +#include "titanic/main_game_window.h" #include "titanic/messages/messages.h" #include "titanic/pet_control/pet_control.h" namespace Titanic { -CMainGameWindow::CMainGameWindow(TitanicEngine *vm): _vm(vm) { +CMainGameWindow::CMainGameWindow(TitanicEngine *vm): _vm(vm), + _specialButtons(0), _priorLeftDownTime(0), + _priorMiddleDownTime(0), _priorRightDownTime(0) { _gameView = nullptr; _gameManager = nullptr; _project = nullptr; @@ -37,6 +40,12 @@ CMainGameWindow::CMainGameWindow(TitanicEngine *vm): _vm(vm) { _image = nullptr; _cursor = nullptr; _pendingLoadSlot = -1; + + // Set the window as an event target + vm->_events->addTarget(this); +} + +CMainGameWindow::~CMainGameWindow() { } bool CMainGameWindow::Create() { @@ -53,14 +62,11 @@ void CMainGameWindow::applicationStarting() { // Set up the game project, and get game slot int saveSlot = loadGame(); assert(_project); - + // Set the video mode CScreenManager *screenManager = CScreenManager::setCurrent(); screenManager->setMode(640, 480, 16, 0, true); - // TODO: Remove initial background and palette - - // Create game view and manager _gameView = new CSTGameView(this); _gameManager = new CGameManager(_project, _gameView); @@ -98,7 +104,10 @@ int CMainGameWindow::loadGame() { } int CMainGameWindow::selectSavegame() { - // TODO: For now, hardcoded to -1 for new saves + // If the user selected a savegame from the launcher, return it + if (ConfMan.hasKey("save_slot")) + return ConfMan.getInt("save_slot"); + return -1; } @@ -111,7 +120,7 @@ void CMainGameWindow::setActiveView(CViewItem *viewItem) { _gameView->createSurface(key); } } - + void CMainGameWindow::draw() { if (_gameManager) { if (!_gameView->_surface) { @@ -202,4 +211,126 @@ void CMainGameWindow::loadGame(int slotId) { _gameManager->_gameState.setMode(GSMODE_PENDING_LOAD); } +void CMainGameWindow::onIdle() { + if (!_inputAllowed) + return; + CGameManager *gameManager = _gameManager; + if (!gameManager) + return; + + // Let the game manager perform any game updates + gameManager->update(); + + if (gameManager->_gameState._quitGame) { + // Game needs to shut down + _vm->quitGame(); + } +} + +#define HANDLE_MESSAGE(METHOD) if (_inputAllowed) { \ + _gameManager->_inputTranslator.METHOD(_specialButtons, mousePos); \ + mouseChanged(); \ + } + + +void CMainGameWindow::mouseMove(const Point &mousePos) { + HANDLE_MESSAGE(mouseMove) +} + +void CMainGameWindow::leftButtonDown(const Point &mousePos) { + _specialButtons |= MK_LBUTTON; + + if ((_vm->_events->getTicksCount() - _priorLeftDownTime) < DOUBLE_CLICK_TIME) { + _priorLeftDownTime = 0; + leftButtonDoubleClick(mousePos); + } else { + _priorLeftDownTime = _vm->_events->getTicksCount(); + HANDLE_MESSAGE(leftButtonDown) + } +} + +void CMainGameWindow::leftButtonUp(const Point &mousePos) { + _specialButtons &= ~MK_LBUTTON; + HANDLE_MESSAGE(leftButtonUp) +} + +void CMainGameWindow::leftButtonDoubleClick(const Point &mousePos) { + HANDLE_MESSAGE(leftButtonDoubleClick) +} + +void CMainGameWindow::middleButtonDown(const Point &mousePos) { + _specialButtons |= MK_MBUTTON; + + if ((_vm->_events->getTicksCount() - _priorMiddleDownTime) < DOUBLE_CLICK_TIME) { + _priorMiddleDownTime = 0; + middleButtonDoubleClick(mousePos); + } else { + _priorMiddleDownTime = _vm->_events->getTicksCount(); + HANDLE_MESSAGE(middleButtonDown) + } +} + +void CMainGameWindow::middleButtonUp(const Point &mousePos) { + _specialButtons &= ~MK_MBUTTON; + HANDLE_MESSAGE(middleButtonUp) +} + +void CMainGameWindow::middleButtonDoubleClick(const Point &mousePos) { + HANDLE_MESSAGE(middleButtonDoubleClick) +} + +void CMainGameWindow::rightButtonDown(const Point &mousePos) { + _specialButtons |= MK_RBUTTON; + + if ((_vm->_events->getTicksCount() - _priorRightDownTime) < DOUBLE_CLICK_TIME) { + _priorRightDownTime = 0; + rightButtonDoubleClick(mousePos); + } else { + _priorRightDownTime = _vm->_events->getTicksCount(); + HANDLE_MESSAGE(rightButtonDown) + } +} + +void CMainGameWindow::rightButtonUp(const Point &mousePos) { + _specialButtons &= ~MK_RBUTTON; + HANDLE_MESSAGE(rightButtonUp) +} + +void CMainGameWindow::rightButtonDoubleClick(const Point &mousePos) { + HANDLE_MESSAGE(rightButtonDoubleClick) +} + +void CMainGameWindow::charPress(char c) { + +} + +void CMainGameWindow::keyDown(Common::KeyState keyState) { + handleKbdSpecial(keyState); + + if (keyState.keycode == Common::KEYCODE_d && (keyState.flags & Common::KBD_CTRL)) { + // Attach to the debugger + _vm->_debugger->attach(); + _vm->_debugger->onFrame(); + } + + if (_inputAllowed) + _gameManager->_inputTranslator.keyDown(keyState); +} + +void CMainGameWindow::keyUp(Common::KeyState keyState) { + handleKbdSpecial(keyState); +} + +void CMainGameWindow::handleKbdSpecial(Common::KeyState keyState) { + if (keyState.flags & Common::KBD_CTRL) + _specialButtons |= MK_CONTROL; + else + _specialButtons &= ~MK_CONTROL; + + if (keyState.flags & Common::KBD_SHIFT) + _specialButtons |= MK_SHIFT; + else + _specialButtons &= ~MK_SHIFT; +} + } // End of namespace Titanic diff --git a/engines/titanic/main_game_window.h b/engines/titanic/main_game_window.h index 18c03942ce..7a651ec970 100644 --- a/engines/titanic/main_game_window.h +++ b/engines/titanic/main_game_window.h @@ -29,16 +29,22 @@ #include "titanic/game_view.h" #include "titanic/support/image.h" #include "titanic/core/project_item.h" +#include "titanic/events.h" namespace Titanic { class TitanicEngine; -class CMainGameWindow { +class CMainGameWindow : public CEventTarget { private: TitanicEngine *_vm; int _pendingLoadSlot; - + uint _specialButtons; + uint32 _priorFrameTime; + uint32 _priorLeftDownTime; + uint32 _priorMiddleDownTime; + uint32 _priorRightDownTime; +private: /** * Checks for the presence of any savegames and, if present, * lets the user pick one to resume @@ -65,6 +71,12 @@ private: * Draws all the items within the view */ void drawViewContents(CScreenManager *screenManager); + + void leftButtonDoubleClick(const Point &mousePos); + void middleButtonDoubleClick(const Point &mousePos); + void rightButtonDoubleClick(const Point &mousePos); + void charPress(char c); + void handleKbdSpecial(Common::KeyState keyState); public: CGameView *_gameView; CGameManager *_gameManager; @@ -74,6 +86,22 @@ public: void *_cursor; public: CMainGameWindow(TitanicEngine *vm); + virtual ~CMainGameWindow(); + + /** + * Called to handle any regular updates the game requires + */ + void onIdle(); + + virtual void mouseMove(const Point &mousePos); + virtual void leftButtonDown(const Point &mousePos); + virtual void leftButtonUp(const Point &mousePos); + virtual void middleButtonDown(const Point &mousePos); + virtual void middleButtonUp(const Point &mousePos); + virtual void rightButtonDown(const Point &mousePos); + virtual void rightButtonUp(const Point &mousePos); + virtual void keyDown(Common::KeyState keyState); + virtual void keyUp(Common::KeyState keyState); /** * Creates the window @@ -104,6 +132,16 @@ public: * Schedules a savegame to be loaded */ void loadGame(int slotId); + + /* + * Return whether a given special key is currently pressed + */ + bool isSpecialPressed(SpecialButtons btn) const { return _specialButtons; } + + /** + * Returns the bitset of the currently pressed special buttons + */ + uint getSpecialButtons() const { return _specialButtons; } }; } // End of namespace Titanic diff --git a/engines/titanic/pet_control/pet_rooms_glyphs.cpp b/engines/titanic/pet_control/pet_rooms_glyphs.cpp index 5de814af24..810342a23e 100644 --- a/engines/titanic/pet_control/pet_rooms_glyphs.cpp +++ b/engines/titanic/pet_control/pet_rooms_glyphs.cpp @@ -103,7 +103,7 @@ void CPetRoomsGlyph::drawAt(CScreenManager *screenManager, const Point &pt, bool void CPetRoomsGlyph::selectGlyph(const Point &topLeft, const Point &pt) { if (isAssigned()) { - bool isShiftPressed = g_vm->_events->getSpecialButtons() & MK_SHIFT; + bool isShiftPressed = g_vm->_window->getSpecialButtons() & MK_SHIFT; if (isShiftPressed) { int selection = getSelection(topLeft, pt); @@ -116,7 +116,7 @@ void CPetRoomsGlyph::selectGlyph(const Point &topLeft, const Point &pt) { } bool CPetRoomsGlyph::dragGlyph(const Point &topLeft, CMouseDragStartMsg *msg) { - bool isShiftPressed = g_vm->_events->getSpecialButtons() & MK_SHIFT; + bool isShiftPressed = g_vm->_window->getSpecialButtons() & MK_SHIFT; CPetControl *petControl = getPetControl(); if (!isShiftPressed && petControl) { diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index 7b91a1a630..dfb68fd9d5 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -181,4 +181,31 @@ CString TitanicEngine::generateSaveName(int slot) { return CString::format("%s.%03d", _targetName.c_str(), slot); } +CString TitanicEngine::getSavegameName(int slot) { + // Try and open up the savegame for access + Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading( + generateSaveName(slot)); + + if (in) { + // Read in the savegame header data + CompressedFile file; + file.open(in); + + TitanicSavegameHeader header; + bool isValid = CProjectItem::readSavegameHeader(&file, header); + if (header._thumbnail) { + header._thumbnail->free(); + delete header._thumbnail; + } + + file.close(); + + if (isValid) + // Set the name text + return header._saveName; + } + + return CString(); +} + } // End of namespace Titanic diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index dd289714c9..ec015551b8 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -70,6 +70,8 @@ enum TitanicDebugChannels { #define TOTAL_ITEMS 46 #define TOTAL_ROOMS 34 +#define MAX_SAVES 99 + struct TitanicGameDescription; class TitanicEngine; @@ -159,6 +161,12 @@ public: * @param slot Slot number */ CString generateSaveName(int slot); + + /** + * Checks whether a savegame exists for the given slot, + * and if it exists, returns it's description + */ + CString getSavegameName(int slot); }; extern TitanicEngine *g_vm; diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 70953914fa..8cce90ebff 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -416,7 +416,7 @@ void TTnpcScript::loadBody(SimpleFile *file) { for (uint idx = 0; idx < _ranges.size(); ++idx) { TTscriptRange &item = _ranges[idx]; - if (item._id == id) { + if (item._id == (uint)id) { item._priorIndex = val; break; } -- cgit v1.2.3 From 7f05cfad13fbce82326542d9bdd0dd0473565baf Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 22 Jul 2016 21:44:50 -0400 Subject: DEVTOOLS: Save create_titanic bitmap resources with correct bitmap headers --- devtools/create_titanic/create_titanic_dat.cpp | 66 ++++++++++++++++++++------ 1 file changed, 51 insertions(+), 15 deletions(-) diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index 2ea8f2a676..ed263d7b77 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -279,9 +279,9 @@ void writeResource(const char *name, Common::File *file) { delete file; } -void writeResource(const char *sectionStr, const uint32 resId) { +void writeResource(const char *sectionStr, uint32 resId) { char nameBuffer[256]; - sprintf(nameBuffer, "%s/%d", sectionStr, resId); + sprintf(nameBuffer, "%s/%u", sectionStr, resId); Common::File *file = res.getResource(getResId(sectionStr), resId); assert(file); @@ -298,6 +298,43 @@ void writeResource(const char *sectionStr, const char *resId) { writeResource(nameBuffer, file); } +void writeBitmap(const char *name, Common::File *file) { + outputFile.seek(dataOffset); + + // Write out the necessary bitmap header so that the ScummVM + // BMP decoder can properly handle decoding the bitmaps + outputFile.write("BM", 2); + outputFile.writeLong(file->size() + 14); // Filesize + outputFile.writeLong(0); // res1 & res2 + outputFile.writeLong(0x436); // image offset + + outputFile.write(*file, file->size() + 14); + + writeEntryHeader(name, dataOffset, file->size() + 14); + dataOffset += file->size() + 14; + delete file; +} + +void writeBitmap(const char *sectionStr, const char *resId) { + char nameBuffer[256]; + sprintf(nameBuffer, "%s/%s", sectionStr, resId); + + Common::File *file = res.getResource(getResId(sectionStr), + Common::WinResourceID(resId)); + assert(file); + writeBitmap(nameBuffer, file); +} + +void writeBitmap(const char *sectionStr, uint32 resId) { + char nameBuffer[256]; + sprintf(nameBuffer, "%s/%u", sectionStr, resId); + + Common::File *file = res.getResource(getResId(sectionStr), + Common::WinResourceID(resId)); + assert(file); + writeBitmap(nameBuffer, file); +} + void writeNumbers() { outputFile.seek(dataOffset); @@ -357,7 +394,6 @@ void writeResponseTree() { dataOffset += size; } - void writeSentenceEntries(const char *name, uint tableOffset) { outputFile.seek(dataOffset); @@ -462,18 +498,18 @@ void writeHeader() { } void writeData() { - writeResource("Bitmap", "BACKDROP"); - writeResource("Bitmap", "EVILTWIN"); - writeResource("Bitmap", "RESTORED"); - writeResource("Bitmap", "RESTOREF"); - writeResource("Bitmap", "RESTOREU"); - writeResource("Bitmap", "STARTD"); - writeResource("Bitmap", "STARTF"); - writeResource("Bitmap", "STARTU"); - writeResource("Bitmap", "TITANIC"); - writeResource("Bitmap", 133); - writeResource("Bitmap", 164); - writeResource("Bitmap", 165); + writeBitmap("Bitmap", "BACKDROP"); + writeBitmap("Bitmap", "EVILTWIN"); + writeBitmap("Bitmap", "RESTORED"); + writeBitmap("Bitmap", "RESTOREF"); + writeBitmap("Bitmap", "RESTOREU"); + writeBitmap("Bitmap", "STARTD"); + writeBitmap("Bitmap", "STARTF"); + writeBitmap("Bitmap", "STARTU"); + writeBitmap("Bitmap", "TITANIC"); + writeBitmap("Bitmap", 133); + writeBitmap("Bitmap", 164); + writeBitmap("Bitmap", 165); writeResource("STFONT", 149); writeResource("STFONT", 151); -- cgit v1.2.3 From 21e4d6686f515e70fce1ee177388b5d3bc7a4d61 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 22 Jul 2016 21:46:32 -0400 Subject: TITANIC: Beginnings of Continue Save dialog --- engines/titanic/continue_save_dialog.cpp | 80 ++++++++++++++++++++++ engines/titanic/continue_save_dialog.h | 78 +++++++++++++++++++++ engines/titanic/main_game_window.cpp | 32 ++++++--- engines/titanic/main_game_window.h | 2 +- engines/titanic/module.mk | 1 + engines/titanic/support/image.cpp | 113 +++++++------------------------ engines/titanic/support/image.h | 49 ++------------ 7 files changed, 212 insertions(+), 143 deletions(-) create mode 100644 engines/titanic/continue_save_dialog.cpp create mode 100644 engines/titanic/continue_save_dialog.h diff --git a/engines/titanic/continue_save_dialog.cpp b/engines/titanic/continue_save_dialog.cpp new file mode 100644 index 0000000000..1db3ba29b8 --- /dev/null +++ b/engines/titanic/continue_save_dialog.cpp @@ -0,0 +1,80 @@ +/* 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 "titanic/continue_save_dialog.h" +#include "titanic/titanic.h" + +namespace Titanic { + +CContinueSaveDialog::CContinueSaveDialog() { + g_vm->_events->addTarget(this); + _highlightedSlot = _selectedSlot = -999; +} + +CContinueSaveDialog::~CContinueSaveDialog() { + g_vm->_events->removeTarget(); +} + +void CContinueSaveDialog::addSavegame(int slot, const CString &name) { + _saves.push_back(SaveEntry(slot, name)); +} + +int CContinueSaveDialog::show() { + // Load images for the dialog + loadImages(); + + // Render the view + render(); + + // Event loop waiting for selection + while (!g_vm->shouldQuit() && _selectedSlot == -999) { + g_vm->_events->pollEventsAndWait(); + } + + return _selectedSlot; +} + +void CContinueSaveDialog::loadImages() { + _backdrop.load("Bitmap/BACKDROP"); + _evilTwin.load("Bitmap/EVILTWIN"); +} + +void CContinueSaveDialog::render() { + Graphics::Screen &screen = *g_vm->_screen; + screen.clear(); + screen.blitFrom(_backdrop, Common::Point(48, 22)); +} + +void CContinueSaveDialog::leftButtonDown(const Point &mousePos) { + +} + +void CContinueSaveDialog::leftButtonUp(const Point &mousePos) { + +} + +void CContinueSaveDialog::keyDown(Common::KeyState keyState) { + if (keyState.keycode == Common::KEYCODE_ESCAPE) + _selectedSlot = EXIT_GAME; +} + +} // End of namespace Titanic diff --git a/engines/titanic/continue_save_dialog.h b/engines/titanic/continue_save_dialog.h new file mode 100644 index 0000000000..0dc0c069db --- /dev/null +++ b/engines/titanic/continue_save_dialog.h @@ -0,0 +1,78 @@ +/* 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. + * + */ + +#ifndef TITANIC_CONTINUE_SAVE_DIALOG_H +#define TITANIC_CONTINUE_SAVE_DIALOG_H + +#include "common/array.h" +#include "titanic/events.h" +#include "titanic/support/image.h" +#include "titanic/support/string.h" + +namespace Titanic { + +#define EXIT_GAME -2 + +class CContinueSaveDialog : public CEventTarget { + struct SaveEntry { + int _slot; + CString _name; + SaveEntry() : _slot(0) {} + SaveEntry(int slot, const CString &name) : _slot(slot), _name(name) {} + }; +private: + Common::Array _saves; + int _highlightedSlot, _selectedSlot; + Image _backdrop; + Image _evilTwin; +private: + /** + * Load the images + */ + void loadImages(); + + /** + * Render the dialog + */ + void render(); +public: + CContinueSaveDialog(); + virtual ~CContinueSaveDialog(); + + virtual void leftButtonDown(const Point &mousePos); + virtual void leftButtonUp(const Point &mousePos); + virtual void keyDown(Common::KeyState keyState); + + /** + * Add a savegame to the list to be displayed + */ + void addSavegame(int slot, const CString &name); + + /** + * Show the dialog and wait for a slot to be selected + */ + int show(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_CONTINUE_SAVE_DIALOG_H */ diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 736154a502..2ecc319257 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -22,6 +22,7 @@ #include "common/config-manager.h" #include "titanic/titanic.h" +#include "titanic/continue_save_dialog.h" #include "titanic/game_manager.h" #include "titanic/game_view.h" #include "titanic/main_game_window.h" @@ -50,23 +51,22 @@ CMainGameWindow::~CMainGameWindow() { bool CMainGameWindow::Create() { Image image; - bool result = image.loadResource("TITANIC"); - if (!result) - return true; + image.load("TITANIC"); // TODO: Stuff return true; } void CMainGameWindow::applicationStarting() { - // Set up the game project, and get game slot - int saveSlot = loadGame(); - assert(_project); - // Set the video mode CScreenManager *screenManager = CScreenManager::setCurrent(); screenManager->setMode(640, 480, 16, 0, true); + // Set up the game project, and get game slot + int saveSlot = getSavegameSlot(); + if (saveSlot == -2) + return; + // Create game view and manager _gameView = new CSTGameView(this); _gameManager = new CGameManager(_project, _gameView); @@ -96,7 +96,7 @@ void CMainGameWindow::applicationStarting() { _gameManager->initBounds(); } -int CMainGameWindow::loadGame() { +int CMainGameWindow::getSavegameSlot() { _project = new CProjectItem(); _project->setFilename("starship.prj"); @@ -108,7 +108,21 @@ int CMainGameWindow::selectSavegame() { if (ConfMan.hasKey("save_slot")) return ConfMan.getInt("save_slot"); - return -1; + CContinueSaveDialog dialog; + bool hasSavegames = false; + + // Loop through save slots to find any existing save slots + for (int idx = 0; idx < MAX_SAVES; ++idx) { + CString saveName = g_vm->getSavegameName(idx); + if (!saveName.empty()) { + dialog.addSavegame(idx, saveName); + hasSavegames = true; + } + } + + // If there are savegames, show the select dialog and get a choice. + // If there aren't, return -1 to indicate starting a new game + return hasSavegames ? dialog.show() : -1; } void CMainGameWindow::setActiveView(CViewItem *viewItem) { diff --git a/engines/titanic/main_game_window.h b/engines/titanic/main_game_window.h index 7a651ec970..82e24e250e 100644 --- a/engines/titanic/main_game_window.h +++ b/engines/titanic/main_game_window.h @@ -49,7 +49,7 @@ private: * Checks for the presence of any savegames and, if present, * lets the user pick one to resume */ - int loadGame(); + int getSavegameSlot(); /** * Creates the game "project" and determine a game save slot diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index ec3294747e..60a95bc094 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -1,6 +1,7 @@ MODULE := engines/titanic MODULE_OBJS := \ + continue_save_dialog.o \ debugger.o \ detection.o \ events.o \ diff --git a/engines/titanic/support/image.cpp b/engines/titanic/support/image.cpp index cabdd64cf3..1e936b6940 100644 --- a/engines/titanic/support/image.cpp +++ b/engines/titanic/support/image.cpp @@ -20,102 +20,37 @@ * */ -#include "common/file.h" #include "titanic/support/image.h" +#include "titanic/titanic.h" +#include "image/bmp.h" namespace Titanic { -BITMAPINFOHEADER::BITMAPINFOHEADER() { - _biSize = 0; - _biWidth = 0; - _biHeight = 0; - _biPlanes = 0; - _biBitCount = 0; - _biCompression = 0; - _biSizeImage = 0; - _biXPelsPerMeter = 0; - _biYPelsPerMeter = 0; - _biClrUsed = 0; - _biClrImportant = 0; -} - -/*------------------------------------------------------------------------*/ - -RGBQuad::RGBQuad() : _rgbRed(0), _rgbGreen(0), _rgbBlue(0), _rgbReserved(0) {} - -/*------------------------------------------------------------------------*/ - -Image::Image() { - _bitmapInfo = nullptr; - _bits = nullptr; - _flag = true; - - set(16, 16); -} - -void Image::proc6() { - -} - -void Image::set(int width, int height) { - delete _bitmapInfo; - if (_flag && _bitmapInfo) - delete[] _bits; - - _bitmapInfo = new tagBITMAPINFO; - _bits = new byte[(width + 3) & 0xFFFC * height]; - - tagBITMAPINFO &bi = *_bitmapInfo; - bi._bmiHeader._biWidth = width; - bi._bmiHeader._biHeight = height; - bi._bmiHeader._biPlanes = 1; - bi._bmiHeader._biBitCount = 8; -} - -void Image::proc8() { - -} - -bool Image::loadResource(const Common::String &name) { - // This method is hardcoded for the Titanic splash screen resource - assert(name == "TITANIC"); - - Common::File f; - if (!f.open("ST.exe")) - return false; - - // The ST.exe executable has a bitmap called "TITANIC". Since we can't use - // the Windows FindResource function in ScummVM, this is hardcoded for now - f.seek(0x29B660); - uint size = f.readUint32LE(); - if (size != 40) - return false; - - loadBitmap(f); - - return true; -} - -void Image::proc10() { - -} - -void Image::draw() { - +void Image::load(const CString &resName) { + Common::SeekableReadStream *stream = g_vm->_filesManager->getResource(resName); + loadBitmap(*stream); + delete stream; } void Image::loadBitmap(Common::SeekableReadStream &s) { - _bitmapInfo->_bmiHeader._biWidth = s.readUint32LE(); - _bitmapInfo->_bmiHeader._biHeight = s.readUint32LE(); - _bitmapInfo->_bmiHeader._biPlanes = s.readUint16LE(); - _bitmapInfo->_bmiHeader._biBitCount = s.readUint16LE(); - _bitmapInfo->_bmiHeader._biCompression = s.readUint32LE(); - _bitmapInfo->_bmiHeader._biSizeImage = s.readUint32LE(); - _bitmapInfo->_bmiHeader._biXPelsPerMeter = s.readUint32LE(); - _bitmapInfo->_bmiHeader._biYPelsPerMeter = s.readUint32LE(); - _bitmapInfo->_bmiHeader._biClrUsed = s.readUint32LE(); - _bitmapInfo->_bmiHeader._biClrImportant = s.readUint32LE(); - + ::Image::BitmapDecoder decoder; + decoder.loadStream(s); + const Graphics::Surface *src = decoder.getSurface(); + Graphics::PixelFormat scrFormat = g_system->getScreenFormat(); + + if (src->format == scrFormat) { + create(src->w, src->h, scrFormat); + blitFrom(*src); + } else { + // Convert the loaded surface to the screen surface format + const byte *palette = decoder.getPalette(); + Graphics::Surface *surface = src->convertTo(scrFormat, palette); + create(surface->w, surface->h, scrFormat); + blitFrom(*surface); + + surface->free(); + delete surface; + } } } // End of namespace Titanic diff --git a/engines/titanic/support/image.h b/engines/titanic/support/image.h index 9030e81ad7..9876f15c40 100644 --- a/engines/titanic/support/image.h +++ b/engines/titanic/support/image.h @@ -23,58 +23,19 @@ #ifndef TITANIC_IMAGE_H #define TITANIC_IMAGE_H -#include "common/scummsys.h" -#include "common/array.h" +#include "common/stream.h" +#include "graphics/managed_surface.h" +#include "titanic/support/string.h" namespace Titanic { -struct BITMAPINFOHEADER { - int _biSize; - int _biWidth; - int _biHeight; - int _biPlanes; - int _biBitCount; - int _biCompression; - int _biSizeImage; - int _biXPelsPerMeter; - int _biYPelsPerMeter; - int _biClrUsed; - int _biClrImportant; - - BITMAPINFOHEADER(); -}; - -struct RGBQuad { - byte _rgbRed; - byte _rgbGreen; - byte _rgbBlue; - byte _rgbReserved; - - RGBQuad(); -}; - -struct tagBITMAPINFO { - BITMAPINFOHEADER _bmiHeader; - RGBQuad _bmiColors[256]; -}; - -class Image { +class Image : public Graphics::ManagedSurface { private: void loadBitmap(Common::SeekableReadStream &s); public: - tagBITMAPINFO *_bitmapInfo; - byte *_bits; - bool _flag; -public: - Image(); virtual ~Image() {} - virtual void proc6(); - virtual void set(int width, int height); - virtual void proc8(); - virtual bool loadResource(const Common::String &name); - virtual void proc10(); - virtual void draw(); + void load(const CString &resName); }; } // End of namespace Titanic -- cgit v1.2.3 From 7821b846591bd5a7da0770082e1ca30317b0e360 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 22 Jul 2016 22:42:46 -0400 Subject: TITANIC: Add button handling and evil twin to Continue Save dialog --- engines/titanic/continue_save_dialog.cpp | 112 ++++++++++++++++++++++++++++++- engines/titanic/continue_save_dialog.h | 15 +++++ engines/titanic/events.cpp | 8 +++ 3 files changed, 134 insertions(+), 1 deletion(-) diff --git a/engines/titanic/continue_save_dialog.cpp b/engines/titanic/continue_save_dialog.cpp index 1db3ba29b8..1be0cf1e0c 100644 --- a/engines/titanic/continue_save_dialog.cpp +++ b/engines/titanic/continue_save_dialog.cpp @@ -25,9 +25,17 @@ namespace Titanic { +#define RESTORE_X 346 +#define RESTORE_Y 94 +#define START_X 370 +#define START_Y 276 + CContinueSaveDialog::CContinueSaveDialog() { g_vm->_events->addTarget(this); _highlightedSlot = _selectedSlot = -999; + _restoreState = _startState = -1; + _mouseDown = false; + _evilTwinShown = false; } CContinueSaveDialog::~CContinueSaveDialog() { @@ -56,20 +64,122 @@ int CContinueSaveDialog::show() { void CContinueSaveDialog::loadImages() { _backdrop.load("Bitmap/BACKDROP"); _evilTwin.load("Bitmap/EVILTWIN"); + _restoreD.load("Bitmap/RESTORED"); + _restoreU.load("Bitmap/RESTOREU"); + _restoreF.load("Bitmap/RESTOREF"); + _startD.load("Bitmap/STARTD"); + _startU.load("Bitmap/STARTU"); + _startF.load("Bitmap/STARTF"); } void CContinueSaveDialog::render() { Graphics::Screen &screen = *g_vm->_screen; screen.clear(); screen.blitFrom(_backdrop, Common::Point(48, 22)); + + if (_evilTwinShown) + screen.blitFrom(_evilTwin, Common::Point(78, 59)); + + _restoreState = _startState = -1; + renderButtons(); } -void CContinueSaveDialog::leftButtonDown(const Point &mousePos) { +void CContinueSaveDialog::renderButtons() { + Graphics::Screen &screen = *g_vm->_screen; + Rect restoreRect(RESTORE_X, RESTORE_Y, RESTORE_X + _restoreU.w, RESTORE_Y + _restoreU.h); + Rect startRect(START_X, START_Y, START_X + _startU.w, START_Y + _startU.h); + + // Determine the current state for the buttons + int restoreState, startState; + if (!restoreRect.contains(_mousePos)) + restoreState = 0; + else + restoreState = _mouseDown ? 1 : 2; + + if (!startRect.contains(_mousePos)) + startState = 0; + else + startState = _mouseDown ? 1 : 2; + + // Draw the start button + if (startState != _startState) { + _startState = startState; + switch (_startState) { + case 0: + screen.blitFrom(_startU, Common::Point(START_X, START_Y)); + break; + case 1: + screen.blitFrom(_startD, Common::Point(START_X, START_Y)); + break; + case 2: + screen.blitFrom(_startF, Common::Point(START_X, START_Y)); + break; + default: + break; + } + } + // Draw the restore button + if (restoreState != _restoreState) { + _restoreState = restoreState; + switch (_restoreState) { + case 0: + screen.blitFrom(_restoreU, Common::Point(RESTORE_X, RESTORE_Y)); + break; + case 1: + screen.blitFrom(_restoreD, Common::Point(RESTORE_X, RESTORE_Y)); + break; + case 2: + screen.blitFrom(_restoreF, Common::Point(RESTORE_X, RESTORE_Y)); + break; + default: + break; + } + } +} + +void CContinueSaveDialog::mouseMove(const Point &mousePos) { + _mousePos = mousePos; + renderButtons(); +} + +void CContinueSaveDialog::leftButtonDown(const Point &mousePos) { + _mouseDown = true; + mouseMove(mousePos); } void CContinueSaveDialog::leftButtonUp(const Point &mousePos) { + Rect restoreRect(RESTORE_X, RESTORE_Y, RESTORE_X + _restoreU.w, RESTORE_Y + _restoreU.h); + Rect startRect(START_X, START_Y, START_X + _startU.w, START_Y + _startU.h); + _mouseDown = false; + + if (restoreRect.contains(mousePos)) { + // Flag to exit dialog and load highlighted slot. If no slot was + // selected explicitly, then fall back on loading the first slot + _selectedSlot = (_highlightedSlot == -999) ? _saves[0]._slot : + _saves[_highlightedSlot]._slot; + } else if (startRect.contains(mousePos)) { + // Start a new game + _selectedSlot = -1; + } else { + // TODO: Slot highlighting + } +} + +void CContinueSaveDialog::rightButtonDown(const Point &mousePos) { + Rect eye1(188, 190, 192, 195), eye2(209, 192, 213, 197); + if (eye1.contains(mousePos) || eye2.contains(mousePos)) { + _evilTwinShown = true; + render(); + } +} + +void CContinueSaveDialog::rightButtonUp(const Point &mousePos) { + if (_evilTwinShown) { + _evilTwinShown = false; + render(); + } } void CContinueSaveDialog::keyDown(Common::KeyState keyState) { diff --git a/engines/titanic/continue_save_dialog.h b/engines/titanic/continue_save_dialog.h index 0dc0c069db..697a930b7b 100644 --- a/engines/titanic/continue_save_dialog.h +++ b/engines/titanic/continue_save_dialog.h @@ -26,6 +26,7 @@ #include "common/array.h" #include "titanic/events.h" #include "titanic/support/image.h" +#include "titanic/support/rect.h" #include "titanic/support/string.h" namespace Titanic { @@ -42,8 +43,14 @@ class CContinueSaveDialog : public CEventTarget { private: Common::Array _saves; int _highlightedSlot, _selectedSlot; + Point _mousePos; + bool _evilTwinShown; + bool _mouseDown; + int _restoreState, _startState; Image _backdrop; Image _evilTwin; + Image _restoreD, _restoreU, _restoreF; + Image _startD, _startU, _startF; private: /** * Load the images @@ -54,12 +61,20 @@ private: * Render the dialog */ void render(); + + /** + * Render the buttons + */ + void renderButtons(); public: CContinueSaveDialog(); virtual ~CContinueSaveDialog(); + virtual void mouseMove(const Point &mousePos); virtual void leftButtonDown(const Point &mousePos); virtual void leftButtonUp(const Point &mousePos); + virtual void rightButtonDown(const Point &mousePos); + virtual void rightButtonUp(const Point &mousePos); virtual void keyDown(Common::KeyState keyState); /** diff --git a/engines/titanic/events.cpp b/engines/titanic/events.cpp index 381d371a68..997dbfa556 100644 --- a/engines/titanic/events.cpp +++ b/engines/titanic/events.cpp @@ -62,6 +62,14 @@ void Events::pollEvents() { _mousePos = event.mouse; eventTarget()->middleButtonUp(_mousePos); break; + case Common::EVENT_RBUTTONDOWN: + _mousePos = event.mouse; + eventTarget()->rightButtonDown(_mousePos); + break; + case Common::EVENT_RBUTTONUP: + _mousePos = event.mouse; + eventTarget()->rightButtonUp(_mousePos); + break; case Common::EVENT_KEYDOWN: eventTarget()->keyDown(event.kbd); break; -- cgit v1.2.3 From 8f43f2a7a563c13200a9d946f4473ca11d05385a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 22 Jul 2016 23:48:56 -0400 Subject: TITANIC: Setting up Continue Save dialog slot names list --- engines/titanic/continue_save_dialog.cpp | 23 +++++++++++++++++++++++ engines/titanic/continue_save_dialog.h | 12 ++++++++++++ 2 files changed, 35 insertions(+) diff --git a/engines/titanic/continue_save_dialog.cpp b/engines/titanic/continue_save_dialog.cpp index 1be0cf1e0c..5a881c1ac6 100644 --- a/engines/titanic/continue_save_dialog.cpp +++ b/engines/titanic/continue_save_dialog.cpp @@ -25,6 +25,7 @@ namespace Titanic { +#define SAVEGAME_SLOTS_COUNT 5 #define RESTORE_X 346 #define RESTORE_Y 94 #define START_X 370 @@ -36,6 +37,16 @@ CContinueSaveDialog::CContinueSaveDialog() { _restoreState = _startState = -1; _mouseDown = false; _evilTwinShown = false; + + for (int idx = 0; idx < SAVEGAME_SLOTS_COUNT; ++idx) { + Rect slotRect = getSlotBounds(idx); + _slotNames[idx].setFontNumber(0); + _slotNames[idx].setBounds(slotRect); + _slotNames[idx].resize(3); + _slotNames[idx].setMaxCharsPerLine(22); + _slotNames[idx].setHasBorder(false); + _slotNames[idx].setup(); + } } CContinueSaveDialog::~CContinueSaveDialog() { @@ -43,9 +54,15 @@ CContinueSaveDialog::~CContinueSaveDialog() { } void CContinueSaveDialog::addSavegame(int slot, const CString &name) { + assert(_saves.size() < SAVEGAME_SLOTS_COUNT); + _slotNames[_saves.size()].setText(name); _saves.push_back(SaveEntry(slot, name)); } +Rect CContinueSaveDialog::getSlotBounds(int index) { + return Rect(360, 168 + index * 12, 556, 180 + index * 12); +} + int CContinueSaveDialog::show() { // Load images for the dialog loadImages(); @@ -82,6 +99,7 @@ void CContinueSaveDialog::render() { _restoreState = _startState = -1; renderButtons(); + renderSlots(); } void CContinueSaveDialog::renderButtons() { @@ -138,6 +156,11 @@ void CContinueSaveDialog::renderButtons() { } } +void CContinueSaveDialog::renderSlots() { + for (int idx = 0; idx < SAVEGAME_SLOTS_COUNT; ++idx) + _slotNames[idx].draw(CScreenManager::_screenManagerPtr); +} + void CContinueSaveDialog::mouseMove(const Point &mousePos) { _mousePos = mousePos; renderButtons(); diff --git a/engines/titanic/continue_save_dialog.h b/engines/titanic/continue_save_dialog.h index 697a930b7b..58c7deef00 100644 --- a/engines/titanic/continue_save_dialog.h +++ b/engines/titanic/continue_save_dialog.h @@ -28,6 +28,7 @@ #include "titanic/support/image.h" #include "titanic/support/rect.h" #include "titanic/support/string.h" +#include "titanic/pet_control/pet_text.h" namespace Titanic { @@ -42,6 +43,7 @@ class CContinueSaveDialog : public CEventTarget { }; private: Common::Array _saves; + CPetText _slotNames[5]; int _highlightedSlot, _selectedSlot; Point _mousePos; bool _evilTwinShown; @@ -66,6 +68,16 @@ private: * Render the buttons */ void renderButtons(); + + /** + * Render the slots + */ + void renderSlots(); + + /** + * Get the area to draw a slot name in + */ + Rect getSlotBounds(int index); public: CContinueSaveDialog(); virtual ~CContinueSaveDialog(); -- cgit v1.2.3 From 9a69ee3f44ee6ad72da8f5bacf3329f95d86707f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 23 Jul 2016 09:13:00 -0400 Subject: TITANIC: Fix redrawing CPetText after line colors are changed --- engines/titanic/pet_control/pet_text.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index 983d35ebe5..6813095626 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -76,6 +76,8 @@ void CPetText::setLineColor(uint lineNum, byte r, byte g, byte b) { buffer[4] = TEXTCMD_SET_COLOR; buffer[5] = '\0'; _array[lineNum]._rgb = buffer; + + _stringsMerged = false; } void CPetText::load(SimpleFile *file, int param) { -- cgit v1.2.3 From 4bad949717c9179e9192b0edf6b81b9012fd0fbf Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 23 Jul 2016 09:13:55 -0400 Subject: TITANIC: Add Continue Save dialog slots rendering and selection --- engines/titanic/continue_save_dialog.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/engines/titanic/continue_save_dialog.cpp b/engines/titanic/continue_save_dialog.cpp index 5a881c1ac6..483b308db9 100644 --- a/engines/titanic/continue_save_dialog.cpp +++ b/engines/titanic/continue_save_dialog.cpp @@ -60,7 +60,7 @@ void CContinueSaveDialog::addSavegame(int slot, const CString &name) { } Rect CContinueSaveDialog::getSlotBounds(int index) { - return Rect(360, 168 + index * 12, 556, 180 + index * 12); + return Rect(360, 164 + index * 19, 556, 180 + index * 19); } int CContinueSaveDialog::show() { @@ -157,8 +157,12 @@ void CContinueSaveDialog::renderButtons() { } void CContinueSaveDialog::renderSlots() { - for (int idx = 0; idx < SAVEGAME_SLOTS_COUNT; ++idx) + for (uint idx = 0; idx < _saves.size(); ++idx) { + byte rgb = (_highlightedSlot == idx) ? 255 : 0; + _slotNames[idx].setColor(rgb, rgb, rgb); + _slotNames[idx].setLineColor(0, rgb, rgb, rgb); _slotNames[idx].draw(CScreenManager::_screenManagerPtr); + } } void CContinueSaveDialog::mouseMove(const Point &mousePos) { @@ -185,7 +189,14 @@ void CContinueSaveDialog::leftButtonUp(const Point &mousePos) { // Start a new game _selectedSlot = -1; } else { - // TODO: Slot highlighting + // Check whether a filled in slot was selected + for (uint idx = 0; idx < _saves.size(); ++idx) { + if (getSlotBounds(idx).contains(mousePos)) { + _highlightedSlot = idx; + render(); + break; + } + } } } -- cgit v1.2.3 From 9c5f3c305a5edcc60d0415b92fa4dfc533af8918 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 23 Jul 2016 10:37:04 -0400 Subject: TITANIC: gcc compilation fix --- engines/titanic/continue_save_dialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/titanic/continue_save_dialog.cpp b/engines/titanic/continue_save_dialog.cpp index 483b308db9..39b7d1942a 100644 --- a/engines/titanic/continue_save_dialog.cpp +++ b/engines/titanic/continue_save_dialog.cpp @@ -157,7 +157,7 @@ void CContinueSaveDialog::renderButtons() { } void CContinueSaveDialog::renderSlots() { - for (uint idx = 0; idx < _saves.size(); ++idx) { + for (int idx = 0; idx < (int)_saves.size(); ++idx) { byte rgb = (_highlightedSlot == idx) ? 255 : 0; _slotNames[idx].setColor(rgb, rgb, rgb); _slotNames[idx].setLineColor(0, rgb, rgb, rgb); -- cgit v1.2.3 From 71b76acc630af3537b7379be24d59d38326f2606 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 23 Jul 2016 11:38:39 -0400 Subject: TITANIC: Fixes and simplification of AVISurface --- engines/titanic/pet_control/pet_element.cpp | 2 +- engines/titanic/pet_control/pet_element.h | 2 +- engines/titanic/support/avi_surface.cpp | 58 ++++++++++++++++------------- engines/titanic/support/avi_surface.h | 12 +++--- engines/titanic/support/movie.cpp | 12 +++--- 5 files changed, 47 insertions(+), 39 deletions(-) diff --git a/engines/titanic/pet_control/pet_element.cpp b/engines/titanic/pet_control/pet_element.cpp index 0827b331df..8727d4f6f4 100644 --- a/engines/titanic/pet_control/pet_element.cpp +++ b/engines/titanic/pet_control/pet_element.cpp @@ -86,7 +86,7 @@ void CPetElement::loadFrame(int frameNumber) { gameObject->loadFrame(frameNumber); } -int CPetElement::getFrame() { +int CPetElement::getMovieFrame() const { CGameObject *gameObject = getObject(); return gameObject ? gameObject->getMovieFrame() : 0; } diff --git a/engines/titanic/pet_control/pet_element.h b/engines/titanic/pet_control/pet_element.h index e1edcac217..ad4e7fe5c8 100644 --- a/engines/titanic/pet_control/pet_element.h +++ b/engines/titanic/pet_control/pet_element.h @@ -114,7 +114,7 @@ public: /** * Get the current frame */ - virtual int getFrame(); + virtual int getMovieFrame() const; /** * Get the game object associated with this item diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp index 38bccafa89..c64edca7a4 100644 --- a/engines/titanic/support/avi_surface.cpp +++ b/engines/titanic/support/avi_surface.cpp @@ -54,11 +54,8 @@ static bool secondaryTrackSelect(bool isVideo, int trackCounter) { AVISurface::AVISurface(const CResourceKey &key) { _videoSurface = nullptr; - _currentPos = 0; - _priorFrame = 0; _streamCount = 0; _movieFrameSurface[0] = _movieFrameSurface[1] = nullptr; - _isPlaying = false; // Create a decoder for the audio (if any) and primary video track _decoders[0] = new AVIDecoder(Audio::Mixer::kPlainSoundType, primaryTrackSelect); @@ -122,14 +119,13 @@ bool AVISurface::play(int startFrame, int endFrame, int initialFrame, uint flags _movieRangeInfo.push_back(info); if (_movieRangeInfo.size() == 1) { - return changeFrame(initialFrame); + return startAtFrame(initialFrame); } else { return true; } } void AVISurface::stop() { - _isPlaying = false; _decoders[0]->stop(); if (_decoders[1]) _decoders[1]->stop(); @@ -137,37 +133,46 @@ void AVISurface::stop() { _movieRangeInfo.destroyContents(); } -bool AVISurface::changeFrame(int frameNumber) { - if (_isPlaying) +bool AVISurface::startAtFrame(int frameNumber) { + if (isPlaying()) + // If it's already playing, then don't allow it return false; if (frameNumber == -1) // Default to starting frame of first movie range frameNumber = _movieRangeInfo.front()->_startFrame; + // Get the initial frame seekToFrame(frameNumber); renderFrame(); - _isPlaying = true; + // Start the playback + _decoders[0]->start(); + if (_decoders[1]) + _decoders[1]->start(); + return true; } void AVISurface::seekToFrame(uint frameNumber) { - _decoders[0]->seekToFrame(frameNumber); - if (_decoders[1]) - _decoders[1]->seekToFrame(frameNumber); + if ((int)frameNumber != getFrame()) { + _decoders[0]->seekToFrame(frameNumber); + if (_decoders[1]) + _decoders[1]->seekToFrame(frameNumber); + } - _priorFrame = frameNumber; + renderFrame(); } bool AVISurface::handleEvents(CMovieEventList &events) { - if (!_isPlaying) + if (!isPlaying()) return true; CMovieRangeInfo *info = _movieRangeInfo.front(); - _currentPos += info->_isReversed ? -1 : 1; - if ((info->_isReversed && _currentPos < info->_endFrame) || - (!info->_isReversed && _currentPos > info->_endFrame)) { + int currentPos = getFrame(); + + if ((info->_isReversed && currentPos < info->_endFrame) || + (!info->_isReversed && currentPos > info->_endFrame)) { if (info->_isFlag1) { info->getMovieEnd(events); _movieRangeInfo.remove(info); @@ -179,19 +184,20 @@ bool AVISurface::handleEvents(CMovieEventList &events) { } else { // Not empty, so move onto new first one info = _movieRangeInfo.front(); - _currentPos = info->_startFrame; + currentPos = info->_startFrame; } } else { - _currentPos = info->_startFrame; + currentPos = info->_startFrame; } } - if (_isPlaying) { - // SInce movie ranges can change the position in the movie, - // ensure the decoder is kept in sync - seekToFrame(_currentPos); - - info->getMovieFrame(events, _currentPos); + if (isPlaying()) { + if (currentPos != getFrame()) + // The frame has been changed, so move to new position + seekToFrame(currentPos); + + // Get any events for the given position + info->getMovieFrame(events, currentPos); return renderFrame(); } else { return false; @@ -245,7 +251,7 @@ uint AVISurface::getHeight() const { void AVISurface::setFrame(int frameNumber) { // If playback was in process, stop it - if (_isPlaying) + if (isPlaying()) stop(); // Ensure the frame number is valid @@ -307,7 +313,7 @@ bool AVISurface::addEvent(int frameNumber, CGameObject *obj) { me->_gameObject = obj; tail->addEvent(me); - return _movieRangeInfo.size() == 1 && frameNumber == _priorFrame; + return _movieRangeInfo.size() == 1 && frameNumber == getFrame(); } return false; diff --git a/engines/titanic/support/avi_surface.h b/engines/titanic/support/avi_surface.h index dfd4c59267..4372757bc6 100644 --- a/engines/titanic/support/avi_surface.h +++ b/engines/titanic/support/avi_surface.h @@ -52,8 +52,6 @@ class AVISurface { private: AVIDecoder *_decoders[2]; CVideoSurface *_videoSurface; - int _currentPos; - int _priorFrame; CMovieRangeInfoList _movieRangeInfo; int _streamCount; Graphics::ManagedSurface *_movieFrameSurface[2]; @@ -69,9 +67,9 @@ private: void setupDecompressor(); protected: /** - * Change the frame with ??? checking + * Start playback at the specified frame */ - virtual bool changeFrame(int frameNumber); + virtual bool startAtFrame(int frameNumber); /** * Seeks to a given frame number in the video @@ -80,7 +78,6 @@ protected: public: CSoundManager *_soundManager; bool _hasAudio; - bool _isPlaying; double _frameRate; public: AVISurface(const CResourceKey &key); @@ -106,6 +103,11 @@ public: */ virtual void stop(); + /** + * Return true if a video is currently playing + */ + virtual bool isPlaying() const { return _decoders[0]->isPlaying(); } + /** * Handle any movie events relevent for the frame */ diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index 3856c44e7f..9dc57b897a 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -95,21 +95,21 @@ OSMovie::~OSMovie() { void OSMovie::play(uint flags, CGameObject *obj) { _aviSurface.play(flags, obj); - if (_aviSurface._isPlaying) + if (_aviSurface.isPlaying()) movieStarted(); } void OSMovie::play(uint startFrame, uint endFrame, uint flags, CGameObject *obj) { _aviSurface.play(startFrame, endFrame, flags, obj); - if (_aviSurface._isPlaying) + if (_aviSurface.isPlaying()) movieStarted(); } void OSMovie::play(uint startFrame, uint endFrame, uint initialFrame, uint flags, CGameObject *obj) { _aviSurface.play(startFrame, endFrame, initialFrame, flags, obj); - if (_aviSurface._isPlaying) + if (_aviSurface.isPlaying()) movieStarted(); } @@ -160,10 +160,10 @@ void OSMovie::setFrame(uint frameNumber) { } bool OSMovie::handleEvents(CMovieEventList &events) { - if (!_aviSurface._isPlaying) + if (!_aviSurface.isPlaying()) return false; if (!_aviSurface.isFrameReady()) - return _aviSurface._isPlaying; + return _aviSurface.isPlaying(); // Handle updating the frame while (_aviSurface.isFrameReady()) { @@ -174,7 +174,7 @@ bool OSMovie::handleEvents(CMovieEventList &events) { // Flag there's a video frame _hasVideoFrame = true; - return _aviSurface._isPlaying; + return _aviSurface.isPlaying(); } const CMovieRangeInfoList *OSMovie::getMovieRangeInfo() const { -- cgit v1.2.3 From 8a6a5cebfbb6c18fe136e2925dd086912a0b7e6c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 23 Jul 2016 11:50:07 -0400 Subject: TITANIC: Clarify MODE_2 as MODE_FOCUSED --- engines/titanic/pet_control/pet_element.cpp | 6 +++--- engines/titanic/pet_control/pet_element.h | 7 +++++-- engines/titanic/pet_control/pet_gfx_element.cpp | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/engines/titanic/pet_control/pet_element.cpp b/engines/titanic/pet_control/pet_element.cpp index 8727d4f6f4..c5e1a6ea9c 100644 --- a/engines/titanic/pet_control/pet_element.cpp +++ b/engines/titanic/pet_control/pet_element.cpp @@ -50,10 +50,10 @@ bool CPetElement::MouseDoubleClickMsg(const Point &pt) const { return _bounds.contains(pt); } -int CPetElement::proc9(const Point &pt) { +bool CPetElement::MouseMoveMsg(const Point &pt) { bool result = _bounds.contains(pt); if (result) - setMode(MODE_2); + setMode(MODE_FOCUSED); return result; } @@ -92,7 +92,7 @@ int CPetElement::getMovieFrame() const { } void CPetElement::setMode(PetElementMode newMode) { - if (newMode >= MODE_UNSELECTED && newMode <= MODE_2) + if (newMode >= MODE_UNSELECTED && newMode <= MODE_FOCUSED) changeMode(newMode); } diff --git a/engines/titanic/pet_control/pet_element.h b/engines/titanic/pet_control/pet_element.h index ad4e7fe5c8..bbf3e83537 100644 --- a/engines/titanic/pet_control/pet_element.h +++ b/engines/titanic/pet_control/pet_element.h @@ -30,7 +30,7 @@ namespace Titanic { -enum PetElementMode { MODE_UNSELECTED = 0, MODE_SELECTED = 1, MODE_2 = 2 }; +enum PetElementMode { MODE_UNSELECTED = 0, MODE_SELECTED = 1, MODE_FOCUSED = 2 }; class CGameObject; class CPetControl; @@ -84,7 +84,10 @@ public: */ virtual bool MouseDoubleClickMsg(const Point &pt) const; - virtual int proc9(const Point &pt); + /** + * Handles processing mouse move messages + */ + virtual bool MouseMoveMsg(const Point &pt); /** * Returns whether the passed point falls inside the item diff --git a/engines/titanic/pet_control/pet_gfx_element.cpp b/engines/titanic/pet_control/pet_gfx_element.cpp index 9fc0c2a57d..6022885770 100644 --- a/engines/titanic/pet_control/pet_gfx_element.cpp +++ b/engines/titanic/pet_control/pet_gfx_element.cpp @@ -36,7 +36,7 @@ void CPetGfxElement::setup(PetElementMode mode, const CString &name, case MODE_SELECTED: _object1 = petControl->getHiddenObject(name); break; - case MODE_2: + case MODE_FOCUSED: _object2 = petControl->getHiddenObject(name); break; default: @@ -93,7 +93,7 @@ CGameObject *CPetGfxElement::getObject() const { return _object0; case MODE_SELECTED: return _object1; - case MODE_2: + case MODE_FOCUSED: return _object2; default: return nullptr; -- cgit v1.2.3 From c918602800772556ae95ba477141b80316aa07ae Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 23 Jul 2016 12:11:09 -0400 Subject: TITANIC: Fix some warnings --- engines/titanic/core/tree_item.h | 4 +--- engines/titanic/detection.cpp | 8 ++++---- engines/titanic/star_control/star_field.cpp | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index 46d7996f0f..3754bd413e 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -127,9 +127,7 @@ public: /** * Compares the name of the item to a passed name */ - virtual int compareTo(const CString &name, int maxLen) const { return false; } - - virtual int proc23() const { return 0; } + virtual int compareTo(const CString &name, int maxLen = 0) const { return false; } /** * Returns the clip list, if any, associated with the item diff --git a/engines/titanic/detection.cpp b/engines/titanic/detection.cpp index a9878d9da7..86d26f2f27 100644 --- a/engines/titanic/detection.cpp +++ b/engines/titanic/detection.cpp @@ -125,10 +125,10 @@ SaveStateList TitanicMetaEngine::listSaves(const char *target) const { Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(*file); if (in) { - Titanic::CompressedFile file; - file.open(in); + Titanic::CompressedFile cf; + cf.open(in); - if (Titanic::CProjectItem::readSavegameHeader(&file, header)) + if (Titanic::CProjectItem::readSavegameHeader(&cf, header)) saveList.push_back(SaveStateDescriptor(slot, header._saveName)); if (header._thumbnail) { @@ -136,7 +136,7 @@ SaveStateList TitanicMetaEngine::listSaves(const char *target) const { delete header._thumbnail; } - file.close(); + cf.close(); } } } diff --git a/engines/titanic/star_control/star_field.cpp b/engines/titanic/star_control/star_field.cpp index a90d2280a1..882e3c3600 100644 --- a/engines/titanic/star_control/star_field.cpp +++ b/engines/titanic/star_control/star_field.cpp @@ -110,7 +110,7 @@ void CStarField::toggle4() { bool CStarField::set4(bool val) { bool oldVal = _val4; _val4 = val; - return val; + return oldVal; } int CStarField::get88() const { -- cgit v1.2.3 From 8dd24dd94530db499ead47dc4fda62194c179efd Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 23 Jul 2016 12:30:53 -0400 Subject: TITANIC: Finish CLinkItem class --- engines/titanic/core/link_item.cpp | 44 +++++++++++++++++++++++++++++++------- engines/titanic/core/link_item.h | 4 ++-- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/engines/titanic/core/link_item.cpp b/engines/titanic/core/link_item.cpp index a56122fa43..5de0d4cdeb 100644 --- a/engines/titanic/core/link_item.cpp +++ b/engines/titanic/core/link_item.cpp @@ -33,21 +33,49 @@ CLinkItem::CLinkItem() : CNamedItem() { _roomNumber = -1; _nodeNumber = -1; _viewNumber = -1; - _field30 = 0; + _linkMode = 0; _cursorId = CURSOR_ARROW; _name = "Link"; } CString CLinkItem::formName() { - warning("TODO: CLinkItem::formName"); - return ""; + CViewItem *view = findView(); + CNodeItem *node = view->findNode(); + CRoomItem *room = node->findRoom(); + + CViewItem *destView = getDestView(); + CNodeItem *destNode = destView->findNode(); + CRoomItem *destRoom = destNode->findRoom(); + + switch (_linkMode) { + case 1: + return CString::format("_PANL,%d,%s,%s", node->_nodeNumber, + view->getName(), destView->getName()); + + case 2: + return CString::format("_PANR,%d,%s,%s", node->_nodeNumber, + view->getName(), destView->getName()); + + case 3: + return CString::format("_TRACK,%d,%s,%d,%s", + node->_nodeNumber, view->getName(), + destNode->_nodeNumber, destView->getName()); + + case 4: + return CString::format("_EXIT,%d,%d,%s,%d,%d,%s", + room->_roomNumber, node->_nodeNumber, view->getName(), + destRoom->_roomNumber, destNode->_nodeNumber, destView->getName()); + + default: + return getName(); + } } void CLinkItem::save(SimpleFile *file, int indent) { file->writeNumberLine(2, indent); file->writeQuotedLine("L", indent); file->writeNumberLine(_cursorId, indent + 1); - file->writeNumberLine(_field30, indent + 1); + file->writeNumberLine(_linkMode, indent + 1); file->writeNumberLine(_roomNumber, indent + 1); file->writeNumberLine(_nodeNumber, indent + 1); file->writeNumberLine(_viewNumber, indent + 1); @@ -71,7 +99,7 @@ void CLinkItem::load(SimpleFile *file) { // Deliberate fall-through case 1: - _field30 = file->readNumber(); + _linkMode = file->readNumber(); // Deliberate fall-through case 0: @@ -93,7 +121,7 @@ void CLinkItem::load(SimpleFile *file) { CNamedItem::load(file); if (val < 2) { - switch (_field30) { + switch (_linkMode) { case 2: _cursorId = CURSOR_MOVE_LEFT; break; @@ -120,11 +148,11 @@ bool CLinkItem::connectsTo(CViewItem *destView) const { } void CLinkItem::setDestination(int roomNumber, int nodeNumber, - int viewNumber, int v) { + int viewNumber, int linkMode) { _roomNumber = roomNumber; _nodeNumber = nodeNumber; _viewNumber = viewNumber; - _field30 = v; + _linkMode = linkMode; _name = formName(); } diff --git a/engines/titanic/core/link_item.h b/engines/titanic/core/link_item.h index 09f3a7ab48..f194bc1361 100644 --- a/engines/titanic/core/link_item.h +++ b/engines/titanic/core/link_item.h @@ -45,7 +45,7 @@ protected: int _roomNumber; int _nodeNumber; int _viewNumber; - int _field30; + int _linkMode; public: Rect _bounds; CursorId _cursorId; @@ -72,7 +72,7 @@ public: * Set the destination for the link item */ virtual void setDestination(int roomNumber, int nodeNumber, - int viewNumber, int v); + int viewNumber, int linkMode); /** * Get the destination view for the link item -- cgit v1.2.3 From 382ba52e332a02a49343c1ba1c2aed80dfcd5c87 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 23 Jul 2016 12:45:29 -0400 Subject: TITANIC: Fix exit crash when a movie is active --- engines/titanic/support/movie.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index 9dc57b897a..33e7d33154 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -50,6 +50,15 @@ void CMovie::init() { } void CMovie::deinit() { + // Delete each movie in turn + for (CMovieList::iterator i = _playingMovies->begin(); i != _playingMovies->end(); ) { + // We need to increment iterator before deleting movie, + // since the CMovie destructor calls removeFromPlayingMovies + CMovie *movie = *i; + ++i; + delete movie; + } + delete _playingMovies; delete _movieSurface; } -- cgit v1.2.3 From 9e02409ef4ece6b3184c1d745106e87f3169e6ca Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 23 Jul 2016 13:15:24 -0400 Subject: TITANIC: Clarification and fixes for movie reverse and repeat flags --- engines/titanic/support/avi_surface.cpp | 23 +++++++++++++++++------ engines/titanic/support/avi_surface.h | 9 +++++++-- engines/titanic/support/movie.cpp | 2 +- engines/titanic/support/movie_range_info.cpp | 8 ++++---- engines/titanic/support/movie_range_info.h | 2 +- 5 files changed, 30 insertions(+), 14 deletions(-) diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp index c64edca7a4..c3a720154a 100644 --- a/engines/titanic/support/avi_surface.cpp +++ b/engines/titanic/support/avi_surface.cpp @@ -103,7 +103,7 @@ bool AVISurface::play(int startFrame, int endFrame, int initialFrame, uint flags info->_startFrame = startFrame; info->_endFrame = endFrame; info->_isReversed = endFrame < startFrame; - info->_isFlag1 = flags & MOVIE_1; + info->_isRepeat = flags & MOVIE_REPEAT; if (obj) { CMovieEvent *me = new CMovieEvent(); @@ -119,6 +119,8 @@ bool AVISurface::play(int startFrame, int endFrame, int initialFrame, uint flags _movieRangeInfo.push_back(info); if (_movieRangeInfo.size() == 1) { + // First play call, so start the movie playing + setReversed(info->_isReversed); return startAtFrame(initialFrame); } else { return true; @@ -164,6 +166,12 @@ void AVISurface::seekToFrame(uint frameNumber) { renderFrame(); } +void AVISurface::setReversed(bool isReversed) { + _decoders[0]->setReverse(isReversed); + if (_decoders[1]) + _decoders[1]->setReverse(isReversed); +} + bool AVISurface::handleEvents(CMovieEventList &events) { if (!isPlaying()) return true; @@ -173,7 +181,9 @@ bool AVISurface::handleEvents(CMovieEventList &events) { if ((info->_isReversed && currentPos < info->_endFrame) || (!info->_isReversed && currentPos > info->_endFrame)) { - if (info->_isFlag1) { + if (info->_isRepeat) { + currentPos = info->_startFrame; + } else { info->getMovieEnd(events); _movieRangeInfo.remove(info); delete info; @@ -186,15 +196,15 @@ bool AVISurface::handleEvents(CMovieEventList &events) { info = _movieRangeInfo.front(); currentPos = info->_startFrame; } - } else { - currentPos = info->_startFrame; } } if (isPlaying()) { - if (currentPos != getFrame()) + if (currentPos != getFrame()) { // The frame has been changed, so move to new position + setReversed(info->_isReversed); seekToFrame(currentPos); + } // Get any events for the given position info->getMovieFrame(events, currentPos); @@ -267,7 +277,8 @@ int AVISurface::getFrame() const { } bool AVISurface::isFrameReady() const { - return _decoders[0]->needsUpdate() && (!_decoders[1] || _decoders[1]->needsUpdate()); + return _decoders[0]->needsUpdate() && + (!_decoders[1] || _decoders[1]->needsUpdate()); } bool AVISurface::renderFrame() { diff --git a/engines/titanic/support/avi_surface.h b/engines/titanic/support/avi_surface.h index 4372757bc6..77186edeb4 100644 --- a/engines/titanic/support/avi_surface.h +++ b/engines/titanic/support/avi_surface.h @@ -34,7 +34,7 @@ class CSoundManager; class CVideoSurface; enum MovieFlag { - MOVIE_1 = 1, MOVIE_STOP_PREVIOUS = 2, MOVIE_NO_OBJECT = 4, + MOVIE_REPEAT = 1, MOVIE_STOP_PREVIOUS = 2, MOVIE_NO_OBJECT = 4, MOVIE_REVERSE = 8, MOVIE_GAMESTATE = 0x10 }; @@ -69,7 +69,12 @@ protected: /** * Start playback at the specified frame */ - virtual bool startAtFrame(int frameNumber); + bool startAtFrame(int frameNumber); + + /** + * Sets whether the movie is playing in reverse + */ + void setReversed(bool isReversed); /** * Seeks to a given frame number in the video diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index 33e7d33154..eba878e875 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -175,7 +175,7 @@ bool OSMovie::handleEvents(CMovieEventList &events) { return _aviSurface.isPlaying(); // Handle updating the frame - while (_aviSurface.isFrameReady()) { + while (_aviSurface.isPlaying() && _aviSurface.isFrameReady()) { _aviSurface.handleEvents(events); _videoSurface->setMovieFrameSurface(_aviSurface.getSecondarySurface()); } diff --git a/engines/titanic/support/movie_range_info.cpp b/engines/titanic/support/movie_range_info.cpp index 4c62539864..634ab1cc62 100644 --- a/engines/titanic/support/movie_range_info.cpp +++ b/engines/titanic/support/movie_range_info.cpp @@ -38,7 +38,7 @@ CMovieRangeInfo::CMovieRangeInfo(const CMovieRangeInfo *src) : ListItem() { _endFrame = src->_endFrame; _initialFrame = src->_initialFrame; _isReversed = src->_isReversed; - _isFlag1 = src->_isFlag1; + _isRepeat = src->_isRepeat; // Duplicate the events list for (CMovieEventList::const_iterator i = _events.begin(); @@ -52,7 +52,7 @@ void CMovieRangeInfo::save(SimpleFile *file, int indent) { file->writeNumberLine(_startFrame, indent + 1); file->writeNumberLine(_endFrame, indent + 1); file->writeNumberLine(_initialFrame, indent + 1); - file->writeNumberLine(_isFlag1, indent + 1); + file->writeNumberLine(_isRepeat, indent + 1); file->writeNumberLine(_isReversed, indent + 1); _events.save(file, indent + 1); } @@ -63,7 +63,7 @@ void CMovieRangeInfo::load(SimpleFile *file) { _startFrame = file->readNumber(); _endFrame = file->readNumber(); _initialFrame = file->readNumber(); - _isFlag1 = file->readNumber(); + _isRepeat = file->readNumber(); _isReversed = file->readNumber(); _events.load(file); } @@ -88,7 +88,7 @@ void CMovieRangeInfo::getMovieFrame(CMovieEventList &list, int frameNumber) { void CMovieRangeInfo::process(CGameObject *owner) { int flags = 0; if (_endFrame) - flags |= MOVIE_1; + flags |= MOVIE_REPEAT; if (_startFrame) flags |= MOVIE_REVERSE; diff --git a/engines/titanic/support/movie_range_info.h b/engines/titanic/support/movie_range_info.h index b8186e6f7e..6b13fbadb5 100644 --- a/engines/titanic/support/movie_range_info.h +++ b/engines/titanic/support/movie_range_info.h @@ -38,7 +38,7 @@ public: int _endFrame; int _initialFrame; bool _isReversed; - bool _isFlag1; + bool _isRepeat; CMovieEventList _events; public: CMovieRangeInfo(); -- cgit v1.2.3 From 00c568e17572ce2ac4e9c97c21c00a734951ae9a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 23 Jul 2016 14:39:07 -0400 Subject: TITANIC: Fix for movie play ranges that end at the AVI file end --- engines/titanic/support/avi_surface.cpp | 46 +++++++++++++++++++-------------- engines/titanic/support/avi_surface.h | 8 +++--- engines/titanic/support/movie.cpp | 4 +-- 3 files changed, 33 insertions(+), 25 deletions(-) diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp index c3a720154a..6507c8bbd4 100644 --- a/engines/titanic/support/avi_surface.cpp +++ b/engines/titanic/support/avi_surface.cpp @@ -57,6 +57,12 @@ AVISurface::AVISurface(const CResourceKey &key) { _streamCount = 0; _movieFrameSurface[0] = _movieFrameSurface[1] = nullptr; + // Reset current frame. We need to keep track of frames separately from the decoders, + // since it needs to be able to go beyond the frame count or to negative to allow + // correct detection of when range playbacks have finished + _currentFrame = -1; + _isReversed = false; + // Create a decoder for the audio (if any) and primary video track _decoders[0] = new AVIDecoder(Audio::Mixer::kPlainSoundType, primaryTrackSelect); if (!_decoders[0]->loadFile(key.getString())) @@ -103,6 +109,7 @@ bool AVISurface::play(int startFrame, int endFrame, int initialFrame, uint flags info->_startFrame = startFrame; info->_endFrame = endFrame; info->_isReversed = endFrame < startFrame; + info->_initialFrame = 0; info->_isRepeat = flags & MOVIE_REPEAT; if (obj) { @@ -161,6 +168,8 @@ void AVISurface::seekToFrame(uint frameNumber) { _decoders[0]->seekToFrame(frameNumber); if (_decoders[1]) _decoders[1]->seekToFrame(frameNumber); + + _currentFrame = (int)frameNumber; } renderFrame(); @@ -170,6 +179,8 @@ void AVISurface::setReversed(bool isReversed) { _decoders[0]->setReverse(isReversed); if (_decoders[1]) _decoders[1]->setReverse(isReversed); + + _isReversed = isReversed; } bool AVISurface::handleEvents(CMovieEventList &events) { @@ -177,12 +188,13 @@ bool AVISurface::handleEvents(CMovieEventList &events) { return true; CMovieRangeInfo *info = _movieRangeInfo.front(); - int currentPos = getFrame(); + _currentFrame += _isReversed ? -1 : 1; - if ((info->_isReversed && currentPos < info->_endFrame) || - (!info->_isReversed && currentPos > info->_endFrame)) { + int newFrame = _currentFrame; + if ((info->_isReversed && newFrame <= info->_endFrame) || + (!info->_isReversed && newFrame >= info->_endFrame)) { if (info->_isRepeat) { - currentPos = info->_startFrame; + newFrame = info->_startFrame; } else { info->getMovieEnd(events); _movieRangeInfo.remove(info); @@ -194,20 +206,20 @@ bool AVISurface::handleEvents(CMovieEventList &events) { } else { // Not empty, so move onto new first one info = _movieRangeInfo.front(); - currentPos = info->_startFrame; + newFrame = info->_startFrame; } } } if (isPlaying()) { - if (currentPos != getFrame()) { + if (newFrame != getFrame()) { // The frame has been changed, so move to new position setReversed(info->_isReversed); - seekToFrame(currentPos); + seekToFrame(newFrame); } // Get any events for the given position - info->getMovieFrame(events, currentPos); + info->getMovieFrame(events, newFrame); return renderFrame(); } else { return false; @@ -272,18 +284,13 @@ void AVISurface::setFrame(int frameNumber) { renderFrame(); } -int AVISurface::getFrame() const { - return _decoders[0]->getCurFrame(); -} - -bool AVISurface::isFrameReady() const { - return _decoders[0]->needsUpdate() && - (!_decoders[1] || _decoders[1]->needsUpdate()); +bool AVISurface::isNextFrame() const { + return _decoders[0]->getTimeToNextFrame() == 0; } bool AVISurface::renderFrame() { // Check there's a frame ready for display - if (!isFrameReady()) + if (!_decoders[0]->needsUpdate()) return false; // Decode each decoder's video stream into the appropriate surface @@ -331,10 +338,9 @@ bool AVISurface::addEvent(int frameNumber, CGameObject *obj) { } void AVISurface::setFrameRate(double rate) { - if (rate >= 0.0 && rate <= 100.0) { - _frameRate = rate; - warning("TODO: Frame rate set to %d yet to be implemented", (int)rate); - } + _decoders[0]->setRate(Common::Rational(rate)); + if (_decoders[1]) + _decoders[1]->setRate(Common::Rational(rate)); } Graphics::ManagedSurface *AVISurface::getSecondarySurface() { diff --git a/engines/titanic/support/avi_surface.h b/engines/titanic/support/avi_surface.h index 77186edeb4..53e2aae6fc 100644 --- a/engines/titanic/support/avi_surface.h +++ b/engines/titanic/support/avi_surface.h @@ -55,6 +55,8 @@ private: CMovieRangeInfoList _movieRangeInfo; int _streamCount; Graphics::ManagedSurface *_movieFrameSurface[2]; + bool _isReversed; + int _currentFrame; private: /** * Render a frame to the video surface @@ -141,7 +143,7 @@ public: /** * Gets the current frame */ - int getFrame() const; + int getFrame() const { return _currentFrame; } /** * Add a movie event @@ -171,9 +173,9 @@ public: Graphics::ManagedSurface *duplicateSecondaryFrame() const; /** - * Returns true if a frame is ready to be rendered + * Returns true if it's time for the next */ - bool isFrameReady() const; + bool isNextFrame() const; }; } // End of namespace Titanic diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index eba878e875..3c935e83a8 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -171,11 +171,11 @@ void OSMovie::setFrame(uint frameNumber) { bool OSMovie::handleEvents(CMovieEventList &events) { if (!_aviSurface.isPlaying()) return false; - if (!_aviSurface.isFrameReady()) + if (!_aviSurface.isNextFrame()) return _aviSurface.isPlaying(); // Handle updating the frame - while (_aviSurface.isPlaying() && _aviSurface.isFrameReady()) { + while (_aviSurface.isPlaying() && _aviSurface.isNextFrame()) { _aviSurface.handleEvents(events); _videoSurface->setMovieFrameSurface(_aviSurface.getSecondarySurface()); } -- cgit v1.2.3 From d979dcd020d65aa0019d7a53c1dcd8b4f4a0f909 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 23 Jul 2016 17:21:38 -0400 Subject: TITANIC: Fixes for movie notification, computer game logic cleanup --- engines/titanic/core/game_object.cpp | 10 +++---- engines/titanic/game/cdrom.cpp | 2 +- engines/titanic/game/cdrom_tray.cpp | 46 +++++++++++++++++------------ engines/titanic/game/cdrom_tray.h | 2 +- engines/titanic/game/computer_screen.cpp | 6 ++-- engines/titanic/game_state.cpp | 14 ++++----- engines/titanic/game_state.h | 6 ++-- engines/titanic/input_handler.cpp | 2 +- engines/titanic/main_game_window.cpp | 8 ++--- engines/titanic/support/avi_surface.h | 2 +- engines/titanic/support/files_manager.cpp | 2 +- engines/titanic/support/time_event_info.cpp | 2 +- 12 files changed, 56 insertions(+), 46 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 5d913ebf1f..4f9a2a5c9f 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -485,7 +485,7 @@ void CGameObject::petShow() { CGameManager *gameManager = getGameManager(); if (gameManager) { gameManager->_gameState._petActive = true; - gameManager->_gameState.setMode(GSMODE_SELECTED); + gameManager->_gameState.setMode(GSMODE_INTERACTIVE); gameManager->initBounds(); } } @@ -494,7 +494,7 @@ void CGameObject::petHide() { CGameManager *gameManager = getGameManager(); if (gameManager) { gameManager->_gameState._petActive = false; - gameManager->_gameState.setMode(GSMODE_SELECTED); + gameManager->_gameState.setMode(GSMODE_INTERACTIVE); gameManager->initBounds(); } } @@ -513,7 +513,7 @@ void CGameObject::playMovie(uint flags) { _resource.clear(); } - CGameObject *obj = (flags & MOVIE_NO_OBJECT) ? nullptr : this; + CGameObject *obj = (flags & MOVIE_NOTIFY_OBJECT) ? this : nullptr; if (_surface) { _surface->playMovie(flags, obj); if (flags & MOVIE_GAMESTATE) @@ -530,7 +530,7 @@ void CGameObject::playMovie(int startFrame, int endFrame, uint flags) { _resource.clear(); } - CGameObject *obj = (flags & MOVIE_NO_OBJECT) ? nullptr : this; + CGameObject *obj = (flags & MOVIE_NOTIFY_OBJECT) ? this : nullptr; if (_surface) { _surface->playMovie(startFrame, endFrame, flags, obj); if (flags & MOVIE_GAMESTATE) @@ -548,7 +548,7 @@ void CGameObject::playMovie(int startFrame, int endFrame, int initialFrame, uint _resource.clear(); } - CGameObject *obj = (flags & MOVIE_NO_OBJECT) ? nullptr : this; + CGameObject *obj = (flags & MOVIE_NOTIFY_OBJECT) ? this : nullptr; if (_surface) { _surface->playMovie(startFrame, endFrame, initialFrame, flags, obj); if (flags & MOVIE_GAMESTATE) diff --git a/engines/titanic/game/cdrom.cpp b/engines/titanic/game/cdrom.cpp index 111b090920..cd913d05f7 100644 --- a/engines/titanic/game/cdrom.cpp +++ b/engines/titanic/game/cdrom.cpp @@ -62,7 +62,7 @@ bool CCDROM::MouseDragEndMsg(CMouseDragEndMsg *msg) { if (msg->_dropTarget && msg->_dropTarget->getName() == "newComputer") { CCDROMTray *newTray = dynamic_cast(getRoom()->findByName("newTray")); - if (newTray->_state && newTray->_insertedCD == "None") { + if (newTray->_isOpened && newTray->_insertedCD == "None") { CActMsg actMsg(getName()); actMsg.execute(newTray); setVisible(false); diff --git a/engines/titanic/game/cdrom_tray.cpp b/engines/titanic/game/cdrom_tray.cpp index 118150bee9..1e5b135d35 100644 --- a/engines/titanic/game/cdrom_tray.cpp +++ b/engines/titanic/game/cdrom_tray.cpp @@ -33,12 +33,12 @@ BEGIN_MESSAGE_MAP(CCDROMTray, CGameObject) END_MESSAGE_MAP() -CCDROMTray::CCDROMTray() : CGameObject(), _state(0) { +CCDROMTray::CCDROMTray() : CGameObject(), _isOpened(false) { } void CCDROMTray::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_state, indent); + file->writeNumberLine(_isOpened, indent); file->writeQuotedLine(_insertedCD, indent); CGameObject::save(file, indent); @@ -46,7 +46,7 @@ void CCDROMTray::save(SimpleFile *file, int indent) { void CCDROMTray::load(SimpleFile *file) { file->readNumber(); - _state = file->readNumber(); + _isOpened = file->readNumber(); _insertedCD = file->readString(); CGameObject::load(file); @@ -54,65 +54,73 @@ void CCDROMTray::load(SimpleFile *file) { bool CCDROMTray::ActMsg(CActMsg *msg) { if (msg->_action == "ClickedOn") { - if (_state) { + if (_isOpened) { + // Closing the tray if (_insertedCD == "None") { + // No CD in tray playMovie(55, 65, 0); playSound("a#35.wav", 50, 0, 0); - _state = 0; + _isOpened = false; } else { - CTreeItem *treeItem = getRoom()->findByName(_insertedCD); - if (treeItem) { + // Ejecting tray with CD + CTreeItem *cdrom = getRoom()->findByName(_insertedCD); + if (cdrom) { CActMsg actMsg("Ejected"); - actMsg.execute(treeItem); + actMsg.execute(cdrom); } _insertedCD = "None"; loadFrame(52); } } else if (_insertedCD == "None") { + // Opening tray with no CD playMovie(44, 54, 0); playSound("a#34.wav", 50, 0, 0); - _state = 1; + _isOpened = true; } else if (_insertedCD == "newCD1" || _insertedCD == "newCD2") { + // Opening tray with standard CD playMovie(22, 32, 0); playSound("a#34.wav", 50, 0, 0); - _state = 1; + _isOpened = true; } else if (_insertedCD == "newSTCD") { + // Opening tray with Starship Titanic CD playMovie(0, 10, 0); playSound("a#34.wav", 50, 0, 0); - _state = 1; + _isOpened = true; } - } else if (_state) { + } else if (_isOpened) { if (msg->_action == "newCD1" || msg->_action == "newCD2") { - playMovie(33, 43, 4); + // Standard CD dropped on CDROM Tray + playMovie(33, 43, MOVIE_NOTIFY_OBJECT); playSound("a#35.wav", 50, 0, 0); } else if (msg->_action == "newSTCD") { - playMovie(11, 21, 4); + // Starship Titanic CD dropped on CDROM Tray + playMovie(11, 21, MOVIE_NOTIFY_OBJECT); playSound("a#35.wav", 50, 0, 0); } else { return true; } _insertedCD = msg->_action; - _state = 0; + _isOpened = false; } return true; } bool CCDROMTray::MovieEndMsg(CMovieEndMsg *msg) { - CTreeItem *treeItem = getRoom()->findByName("newScreen"); + CTreeItem *screen = getRoom()->findByName("newScreen"); - if (treeItem) { + if (screen) { CActMsg actMsg(_insertedCD); - actMsg.execute(treeItem); + actMsg.execute(screen); } return true; } bool CCDROMTray::StatusChangeMsg(CStatusChangeMsg *msg) { - msg->_success = _state; + msg->_success = _isOpened; return true; } diff --git a/engines/titanic/game/cdrom_tray.h b/engines/titanic/game/cdrom_tray.h index dbeec170d7..c91e0450fe 100644 --- a/engines/titanic/game/cdrom_tray.h +++ b/engines/titanic/game/cdrom_tray.h @@ -34,7 +34,7 @@ class CCDROMTray : public CGameObject { bool MovieEndMsg(CMovieEndMsg *msg); bool StatusChangeMsg(CStatusChangeMsg *msg); public: - int _state; + bool _isOpened; CString _insertedCD; public: CLASSDEF diff --git a/engines/titanic/game/computer_screen.cpp b/engines/titanic/game/computer_screen.cpp index c73db4f879..b73beda8a7 100644 --- a/engines/titanic/game/computer_screen.cpp +++ b/engines/titanic/game/computer_screen.cpp @@ -47,10 +47,10 @@ void CComputerScreen::load(SimpleFile *file) { bool CComputerScreen::ActMsg(CActMsg *msg) { if (msg->_action == "newCD1" || msg->_action == "newCD2") { - playMovie(27, 53, 16); - playMovie(19, 26, 16); + playMovie(27, 53, MOVIE_GAMESTATE); + playMovie(19, 26, MOVIE_GAMESTATE); } else if (msg->_action == "newSTCD") { - playMovie(0, 18, 20); + playMovie(0, 18, MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); } return true; diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index f7ae304b29..0f2ed1798e 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -36,7 +36,7 @@ bool CGameStateMovieList::clear() { CGameState::CGameState(CGameManager *gameManager) : _gameManager(gameManager), _gameLocation(this), - _passengerClass(0), _priorClass(0), _mode(GSMODE_UNSELECTED), + _passengerClass(0), _priorClass(0), _mode(GSMODE_NONE), _field14(0), _petActive(false), _field1C(false), _quitGame(false), _field24(0), _nodeChangeCtr(0), _nodeEnterTicks(0), _field38(0) { } @@ -69,14 +69,14 @@ void CGameState::load(SimpleFile *file) { void CGameState::setMode(GameStateMode newMode) { CScreenManager *sm = CScreenManager::_screenManagerPtr; - if (newMode == GSMODE_2 && newMode != _mode) { + if (newMode == GSMODE_CUTSCENE && newMode != _mode) { if (_gameManager) _gameManager->lockInputHandler(); if (sm && sm->_mouseCursor) sm->_mouseCursor->hide(); - } else if (newMode != GSMODE_2 && newMode != _mode) { + } else if (newMode != GSMODE_CUTSCENE && newMode != _mode) { if (sm && sm->_mouseCursor) sm->_mouseCursor->show(); @@ -123,7 +123,7 @@ void CGameState::changeView(CViewItem *newView, CMovieClip *clip) { if (g_vm->_window->isSpecialPressed(MK_SHIFT)) clip = nullptr; - if (_mode == GSMODE_2) { + if (_mode == GSMODE_CUTSCENE) { _movieList._view = newView; _movieList._movieClip = clip; } else { @@ -143,8 +143,8 @@ void CGameState::changeView(CViewItem *newView, CMovieClip *clip) { } void CGameState::checkForViewChange() { - if (_mode == GSMODE_2 && _movieList.clear()) { - setMode(GSMODE_SELECTED); + if (_mode == GSMODE_CUTSCENE && _movieList.clear()) { + setMode(GSMODE_INTERACTIVE); if (_movieList._view) enterView(); } @@ -152,7 +152,7 @@ void CGameState::checkForViewChange() { void CGameState::addMovie(CMovie *movie) { _movieList.push_back(new CMovieListItem(movie)); - setMode(GSMODE_2); + setMode(GSMODE_CUTSCENE); } } // End of namespace Titanic diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h index d90c845ed5..0bfa0d5b31 100644 --- a/engines/titanic/game_state.h +++ b/engines/titanic/game_state.h @@ -33,8 +33,10 @@ namespace Titanic { class CGameManager; -enum GameStateMode { GSMODE_UNSELECTED = 0, GSMODE_SELECTED = 1, GSMODE_2 = 2, GSMODE_3 = 3, GSMODE_4 = 4, GSMODE_5 = 5, - GSMODE_PENDING_LOAD }; +enum GameStateMode { + GSMODE_NONE = 0, GSMODE_INTERACTIVE = 1, GSMODE_CUTSCENE = 2, + GSMODE_3 = 3, GSMODE_4 = 4, GSMODE_5 = 5, GSMODE_PENDING_LOAD = 6 +}; PTR_LIST_ITEM(CMovie); class CGameStateMovieList : public List { diff --git a/engines/titanic/input_handler.cpp b/engines/titanic/input_handler.cpp index 289e707bb0..395f55df6f 100644 --- a/engines/titanic/input_handler.cpp +++ b/engines/titanic/input_handler.cpp @@ -50,7 +50,7 @@ void CInputHandler::decLockCount() { void CInputHandler::handleMessage(CMessage &msg, bool respectLock) { if (!respectLock || _lockCount <= 0) { - if (_gameManager->_gameState._mode == GSMODE_SELECTED) { + if (_gameManager->_gameState._mode == GSMODE_INTERACTIVE) { processMessage(&msg); } else if (!msg.isMouseMsg()) { g_vm->_filesManager->loadDrive(); diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 2ecc319257..46d658b004 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -75,7 +75,7 @@ void CMainGameWindow::applicationStarting() { // Load either a new game or selected existing save _project->loadGame(saveSlot); _inputAllowed = true; - _gameManager->_gameState.setMode(GSMODE_SELECTED); + _gameManager->_gameState.setMode(GSMODE_INTERACTIVE); // TODO: Cursor/image @@ -147,8 +147,8 @@ void CMainGameWindow::draw() { scrManager->clearSurface(SURFACE_BACKBUFFER, &_gameManager->_bounds); switch (_gameManager->_gameState._mode) { - case GSMODE_SELECTED: - case GSMODE_2: + case GSMODE_INTERACTIVE: + case GSMODE_CUTSCENE: if (_gameManager->_gameState._petActive) drawPet(scrManager); @@ -163,7 +163,7 @@ void CMainGameWindow::draw() { case GSMODE_PENDING_LOAD: // Pending savegame to load - _gameManager->_gameState.setMode(GSMODE_SELECTED); + _gameManager->_gameState.setMode(GSMODE_INTERACTIVE); _vm->_window->_project->loadGame(_pendingLoadSlot); break; diff --git a/engines/titanic/support/avi_surface.h b/engines/titanic/support/avi_surface.h index 53e2aae6fc..d21182bca9 100644 --- a/engines/titanic/support/avi_surface.h +++ b/engines/titanic/support/avi_surface.h @@ -34,7 +34,7 @@ class CSoundManager; class CVideoSurface; enum MovieFlag { - MOVIE_REPEAT = 1, MOVIE_STOP_PREVIOUS = 2, MOVIE_NO_OBJECT = 4, + MOVIE_REPEAT = 1, MOVIE_STOP_PREVIOUS = 2, MOVIE_NOTIFY_OBJECT = 4, MOVIE_REVERSE = 8, MOVIE_GAMESTATE = 0x10 }; diff --git a/engines/titanic/support/files_manager.cpp b/engines/titanic/support/files_manager.cpp index 1d2b1d9a8e..04928b96d6 100644 --- a/engines/titanic/support/files_manager.cpp +++ b/engines/titanic/support/files_manager.cpp @@ -109,7 +109,7 @@ void CFilesManager::debug(CScreenManager *screenManager) { void CFilesManager::resetView() { if (_gameManager) { - _gameManager->_gameState.setMode(GSMODE_SELECTED); + _gameManager->_gameState.setMode(GSMODE_INTERACTIVE); _gameManager->initBounds(); } } diff --git a/engines/titanic/support/time_event_info.cpp b/engines/titanic/support/time_event_info.cpp index 041a01ccfb..a1922338d1 100644 --- a/engines/titanic/support/time_event_info.cpp +++ b/engines/titanic/support/time_event_info.cpp @@ -100,7 +100,7 @@ CTimeEventInfo::CTimeEventInfo() : ListItem(), _lockCounter(0), CTimeEventInfo::CTimeEventInfo(uint ticks, uint f14, uint firstDuration, uint duration, CTreeItem *target, int timerVal3, const CString &action) : ListItem(), _lockCounter(0), _field14(f14), _firstDuration(firstDuration), - _duration(duration), _target(target), _field2C(0), _field30(0), + _duration(duration), _target(target), _actionVal(0), _field2C(0), _field30(0), _timerCtr(0), _lastTimerTicks(ticks), _field3C(0), _done(false), _field44(true) { _id = _nextId++; -- cgit v1.2.3 From d690ca322c04ee2044b7502369c5cc104a0c7b76 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 23 Jul 2016 18:10:34 -0400 Subject: TITANIC: Cleanup of CTimeEventInfo class --- engines/titanic/core/game_object.cpp | 8 +++---- engines/titanic/core/game_object.h | 4 ++-- engines/titanic/game/computer_screen.cpp | 2 +- engines/titanic/messages/messages.h | 8 +++---- engines/titanic/support/time_event_info.cpp | 35 +++++++++++++++-------------- engines/titanic/support/time_event_info.h | 10 ++++----- 6 files changed, 34 insertions(+), 33 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 4f9a2a5c9f..d33a0c928b 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -659,17 +659,17 @@ void CGameObject::stopSound(int handle, int val2) { } } -int CGameObject::addTimer(int endVal, uint firstDuration, uint duration) { +int CGameObject::addTimer(int endVal, uint firstDuration, uint repeatDuration) { CTimeEventInfo *timer = new CTimeEventInfo(g_vm->_events->getTicksCount(), - duration != 0, firstDuration, duration, this, endVal, CString()); + repeatDuration != 0, firstDuration, repeatDuration, this, endVal, CString()); getGameManager()->addTimer(timer); return timer->_id; } -int CGameObject::addTimer(uint firstDuration, uint duration) { +int CGameObject::addTimer(uint firstDuration, uint repeatDuration) { CTimeEventInfo *timer = new CTimeEventInfo(g_vm->_events->getTicksCount(), - duration != 0, firstDuration, duration, this, 0, CString()); + repeatDuration != 0, firstDuration, repeatDuration, this, 0, CString()); getGameManager()->addTimer(timer); return timer->_id; diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 3f77776bf5..bde5e25c58 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -210,12 +210,12 @@ protected: /** * Adds a timer */ - int addTimer(int endVal, uint firstDuration, uint duration); + int addTimer(int endVal, uint firstDuration, uint repeatDuration); /** * Adds a timer */ - int addTimer(uint firstDuration, uint duration); + int addTimer(uint firstDuration, uint repeatDuration); /** * Stops a timer diff --git a/engines/titanic/game/computer_screen.cpp b/engines/titanic/game/computer_screen.cpp index b73beda8a7..fd56737b01 100644 --- a/engines/titanic/game/computer_screen.cpp +++ b/engines/titanic/game/computer_screen.cpp @@ -73,7 +73,7 @@ bool CComputerScreen::EnterViewMsg(CEnterViewMsg *msg) { bool CComputerScreen::TimerMsg(CTimerMsg *msg) { int handle; - switch (msg->_val3) { + switch (msg->_actionVal) { case 0: loadSound("a#32.wav"); loadSound("a#31.wav"); diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index de5d0bdcc0..0fe6968ed4 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -185,13 +185,13 @@ MESSAGE1(CTimeMsg, uint, _ticks, 0); class CTimerMsg : public CTimeMsg { public: uint _timerCtr; - int _val3; + int _actionVal; CString _action; public: CLASSDEF - CTimerMsg() : CTimeMsg(), _timerCtr(0), _val3(0) {} - CTimerMsg(uint ticks, uint timerCtr, int val2, const CString &action) : - CTimeMsg(ticks), _timerCtr(timerCtr), _val3(val2), _action(action) {} + CTimerMsg() : CTimeMsg(), _timerCtr(0), _actionVal(0) {} + CTimerMsg(uint ticks, uint timerCtr, int actionVal, const CString &action) : + CTimeMsg(ticks), _timerCtr(timerCtr), _actionVal(actionVal), _action(action) {} static bool isSupportedBy(const CTreeItem *item) { return supports(item, _type); diff --git a/engines/titanic/support/time_event_info.cpp b/engines/titanic/support/time_event_info.cpp index a1922338d1..1787741809 100644 --- a/engines/titanic/support/time_event_info.cpp +++ b/engines/titanic/support/time_event_info.cpp @@ -91,17 +91,17 @@ void CTimeEventInfoList::set44(uint id, uint val) { uint CTimeEventInfo::_nextId; CTimeEventInfo::CTimeEventInfo() : ListItem(), _lockCounter(0), - _field14(0), _firstDuration(0), _duration(0), _target(nullptr), + _repeated(false), _firstDuration(0), _repeatDuration(0), _target(nullptr), _actionVal(0), _field2C(0), _field30(0), _timerCtr(0), - _lastTimerTicks(0), _field3C(0), _done(false), _field44(0) { + _lastTimerTicks(0), _relativeTicks(0), _done(false), _field44(0) { _id = _nextId++; } -CTimeEventInfo::CTimeEventInfo(uint ticks, uint f14, uint firstDuration, - uint duration, CTreeItem *target, int timerVal3, const CString &action) : - ListItem(), _lockCounter(0), _field14(f14), _firstDuration(firstDuration), - _duration(duration), _target(target), _actionVal(0), _field2C(0), _field30(0), - _timerCtr(0), _lastTimerTicks(ticks), _field3C(0), _done(false), +CTimeEventInfo::CTimeEventInfo(uint ticks, bool repeated, uint firstDuration, + uint repeatDuration, CTreeItem *target, int endVal, const CString &action) : + ListItem(), _lockCounter(0), _repeated(repeated), _firstDuration(firstDuration), + _repeatDuration(repeatDuration), _target(target), _actionVal(endVal), _field2C(0), + _field30(0), _timerCtr(0), _lastTimerTicks(ticks), _relativeTicks(0), _done(false), _field44(true) { _id = _nextId++; } @@ -114,13 +114,13 @@ void CTimeEventInfo::save(SimpleFile *file, int indent) { targetName = _target->getName(); file->writeQuotedLine(targetName, indent); file->writeNumberLine(_id, indent); - file->writeNumberLine(_field14, indent); + file->writeNumberLine(_repeated, indent); file->writeNumberLine(_firstDuration, indent); - file->writeNumberLine(_duration, indent); + file->writeNumberLine(_repeatDuration, indent); file->writeNumberLine(_actionVal, indent); file->writeQuotedLine(_action, indent); file->writeNumberLine(_timerCtr, indent); - file->writeNumberLine(_field3C, indent); + file->writeNumberLine(_relativeTicks, indent); file->writeNumberLine(_done, indent); file->writeNumberLine(_field44, indent); } @@ -132,13 +132,13 @@ void CTimeEventInfo::load(SimpleFile *file) { if (!val) { _targetName = file->readString(); _id = file->readNumber(); - _field14 = file->readNumber(); + _repeated = file->readNumber(); _firstDuration = file->readNumber(); - _duration = file->readNumber(); + _repeatDuration = file->readNumber(); _actionVal = file->readNumber(); _action = file->readString(); _timerCtr = file->readNumber(); - _field3C = file->readNumber(); + _relativeTicks = file->readNumber(); _done = file->readNumber() != 0; _field44 = file->readNumber(); _target = nullptr; @@ -155,7 +155,7 @@ void CTimeEventInfo::postLoad(uint ticks, CProjectItem *project) { if (!_target) _done = true; - _lastTimerTicks = ticks + _field3C; + _lastTimerTicks = ticks + _relativeTicks; if (_id >= _nextId) _nextId = _id + 1; @@ -163,7 +163,7 @@ void CTimeEventInfo::postLoad(uint ticks, CProjectItem *project) { } void CTimeEventInfo::preSave(uint ticks) { - _field3C = _lastTimerTicks - ticks; + _relativeTicks = _lastTimerTicks - ticks; lock(); } @@ -176,7 +176,7 @@ bool CTimeEventInfo::update(uint ticks) { return false; if (_timerCtr) { - if (ticks > (_lastTimerTicks + _duration)) { + if (ticks > (_lastTimerTicks + _repeatDuration)) { ++_timerCtr; _lastTimerTicks = ticks; @@ -195,7 +195,8 @@ bool CTimeEventInfo::update(uint ticks) { timerMsg.execute(_target); } - if (!_field14) + if (!_repeated) + // Event is done, and can be removed return true; } } diff --git a/engines/titanic/support/time_event_info.h b/engines/titanic/support/time_event_info.h index b436f87f65..23d0d2b803 100644 --- a/engines/titanic/support/time_event_info.h +++ b/engines/titanic/support/time_event_info.h @@ -49,9 +49,9 @@ public: public: int _lockCounter; uint _id; - uint _field14; + bool _repeated; uint _firstDuration; - uint _duration; + uint _repeatDuration; CTreeItem *_target; uint _actionVal; CString _action; @@ -59,15 +59,15 @@ public: uint _field30; uint _timerCtr; uint _lastTimerTicks; - uint _field3C; + uint _relativeTicks; bool _done; uint _field44; CString _targetName; public: CLASSDEF CTimeEventInfo(); - CTimeEventInfo(uint ticks, uint f14, uint firstDuration, uint duration, - CTreeItem *target, int timerVal3, const CString &action); + CTimeEventInfo(uint ticks, bool repeated, uint firstDuration, uint repeatDuration, + CTreeItem *target, int endVal, const CString &action); /** * Save the data for the class to file -- cgit v1.2.3 From 2efee2ae8c1c4e285fe81bce66a594d9b949548a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 23 Jul 2016 19:15:26 -0400 Subject: TITANIC: Further timers cleanup --- engines/titanic/game_manager.h | 7 ++++++- engines/titanic/pet_control/pet_control.cpp | 6 +++--- engines/titanic/pet_control/pet_control.h | 5 ++++- engines/titanic/support/time_event_info.cpp | 21 ++++++++++----------- engines/titanic/support/time_event_info.h | 14 +++++++++----- 5 files changed, 32 insertions(+), 21 deletions(-) diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index 4808b260b7..aa2df461e8 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -193,7 +193,12 @@ public: */ void stopTimer(uint id) { _timers.stop(id); } - void setTimer44(uint id, uint val) { _timers.set44(id, val); } + /** + * Flags whether the timer will be persisent across save & loads + */ + void setTimerPersisent(uint id, bool flag) { + _timers.setPersisent(id, flag); + } /** * Return the true talk manager diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 0695cdea79..83081456d1 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -621,7 +621,7 @@ void CPetControl::startPetTimer(uint timerIndex, uint firstDuration, uint durati stopPetTimer(timerIndex); _timers[timerIndex]._id = addTimer(timerIndex, firstDuration, duration); _timers[timerIndex]._target = target; - setTimer44(_timers[timerIndex]._id, 0); + setTimerPersisent(_timers[timerIndex]._id, false); } void CPetControl::stopPetTimer(uint timerIndex) { @@ -631,8 +631,8 @@ void CPetControl::stopPetTimer(uint timerIndex) { } } -void CPetControl::setTimer44(int id, int val) { - getGameManager()->setTimer44(id, val); +void CPetControl::setTimerPersisent(int id, bool flag) { + getGameManager()->setTimerPersisent(id, flag); } CGameObject *CPetControl::findBot(const CString &name, CTreeItem *root) { diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index e56d8f8f90..39df91cf91 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -103,7 +103,10 @@ private: */ CGameObject *findBot(const CString &name, CTreeItem *root); - void setTimer44(int id, int val); + /** + * Flags whether the timer will be persisent across save & loads + */ + void setTimerPersisent(int id, bool flag); protected: bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); bool MouseDragStartMsg(CMouseDragStartMsg *msg); diff --git a/engines/titanic/support/time_event_info.cpp b/engines/titanic/support/time_event_info.cpp index 1787741809..0226223f1a 100644 --- a/engines/titanic/support/time_event_info.cpp +++ b/engines/titanic/support/time_event_info.cpp @@ -76,11 +76,11 @@ void CTimeEventInfoList::stop(uint id) { } } -void CTimeEventInfoList::set44(uint id, uint val) { +void CTimeEventInfoList::setPersisent(uint id, bool flag) { for (iterator i = begin(); i != end(); ++i) { CTimeEventInfo *item = *i; if (item->_id == id) { - item->set44(val); + item->setPersisent(flag); return; } } @@ -91,18 +91,17 @@ void CTimeEventInfoList::set44(uint id, uint val) { uint CTimeEventInfo::_nextId; CTimeEventInfo::CTimeEventInfo() : ListItem(), _lockCounter(0), - _repeated(false), _firstDuration(0), _repeatDuration(0), _target(nullptr), - _actionVal(0), _field2C(0), _field30(0), _timerCtr(0), - _lastTimerTicks(0), _relativeTicks(0), _done(false), _field44(0) { + _repeated(false), _firstDuration(0), _repeatDuration(0), + _target(nullptr), _actionVal(0), _timerCtr(0), _done(false), + _lastTimerTicks(0), _relativeTicks(0), _persisent(true) { _id = _nextId++; } CTimeEventInfo::CTimeEventInfo(uint ticks, bool repeated, uint firstDuration, uint repeatDuration, CTreeItem *target, int endVal, const CString &action) : ListItem(), _lockCounter(0), _repeated(repeated), _firstDuration(firstDuration), - _repeatDuration(repeatDuration), _target(target), _actionVal(endVal), _field2C(0), - _field30(0), _timerCtr(0), _lastTimerTicks(ticks), _relativeTicks(0), _done(false), - _field44(true) { + _repeatDuration(repeatDuration), _target(target), _actionVal(endVal), _done(false), + _timerCtr(0), _lastTimerTicks(ticks), _relativeTicks(0), _persisent(true) { _id = _nextId++; } @@ -122,7 +121,7 @@ void CTimeEventInfo::save(SimpleFile *file, int indent) { file->writeNumberLine(_timerCtr, indent); file->writeNumberLine(_relativeTicks, indent); file->writeNumberLine(_done, indent); - file->writeNumberLine(_field44, indent); + file->writeNumberLine(_persisent, indent); } void CTimeEventInfo::load(SimpleFile *file) { @@ -140,13 +139,13 @@ void CTimeEventInfo::load(SimpleFile *file) { _timerCtr = file->readNumber(); _relativeTicks = file->readNumber(); _done = file->readNumber() != 0; - _field44 = file->readNumber(); + _persisent = file->readNumber() != 0; _target = nullptr; } } void CTimeEventInfo::postLoad(uint ticks, CProjectItem *project) { - if (!_field44 || _targetName.empty()) + if (!_persisent || _targetName.empty()) _done = true; // Get the timer's target diff --git a/engines/titanic/support/time_event_info.h b/engines/titanic/support/time_event_info.h index 23d0d2b803..ee787bcbef 100644 --- a/engines/titanic/support/time_event_info.h +++ b/engines/titanic/support/time_event_info.h @@ -55,13 +55,11 @@ public: CTreeItem *_target; uint _actionVal; CString _action; - uint _field2C; - uint _field30; uint _timerCtr; uint _lastTimerTicks; uint _relativeTicks; bool _done; - uint _field44; + bool _persisent; CString _targetName; public: CLASSDEF @@ -96,7 +94,10 @@ public: bool update(uint ticks); - void set44(uint val) { _field44 = val; } + /** + * Flags whether the timer will be persisent across save & loads + */ + void setPersisent(bool val) { _persisent = val; } }; class CTimeEventInfoList : public List { @@ -126,7 +127,10 @@ public: */ void stop(uint id); - void set44(uint id, uint val); + /** + * Sets whether a timer with a given Id will be persisent across saves + */ + void setPersisent(uint id, bool flag); }; } // End of namespace Titanic -- cgit v1.2.3 From f1344c2c277125e652092b94a0a5347f842c45d0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 23 Jul 2016 21:50:51 -0400 Subject: TITANIC: Added CCreditText loading --- engines/titanic/core/game_object.cpp | 7 ++- engines/titanic/support/credit_text.cpp | 101 ++++++++++++++++++++++++++++++-- engines/titanic/support/credit_text.h | 36 ++++++++---- engines/titanic/support/string.cpp | 5 ++ engines/titanic/support/string.h | 5 ++ 5 files changed, 137 insertions(+), 17 deletions(-) diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index d33a0c928b..af4ffab1e3 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -193,8 +193,11 @@ void CGameObject::load(SimpleFile *file) { void CGameObject::draw(CScreenManager *screenManager) { if (!_visible) return; - if (_credits) { - error("TODO: Block in CGameObject::draw"); + if (_credits && _credits->_objectP == this) { + if (!_credits->draw()) + CGameObject::deinit(); + + return; } if (_field40) { diff --git a/engines/titanic/support/credit_text.cpp b/engines/titanic/support/credit_text.cpp index e70d1dcf7a..1f12341e71 100644 --- a/engines/titanic/support/credit_text.cpp +++ b/engines/titanic/support/credit_text.cpp @@ -26,13 +26,13 @@ namespace Titanic { CCreditText::CCreditText() : _screenManagerP(nullptr), _field14(0), - _ticks(0), _fontHeight(1), _objectP(nullptr), _field34(0), _field38(0), - _field3C(0), _field40(0), _field44(0), _field48(0), _field4C(0), - _field50(0), _field54(0), _field58(0), _field5C(0) { + _ticks(0), _fontHeight(1), _objectP(nullptr), _totalHeight(0), + _field40(0), _field44(0), _field48(0), _field4C(0), _field50(0), + _field54(0), _field58(0), _field5C(0) { } void CCreditText::clear() { - _list.destroyContents(); + _groups.destroyContents(); _objectP = nullptr; } @@ -41,6 +41,9 @@ void CCreditText::load(CGameObject *obj, CScreenManager *screenManager, _objectP = obj; _screenManagerP = screenManager; _field14 = v; + + setup(); + _ticks = g_vm->_events->getTicksCount(); _field40 = 0; _field44 = 0xFF; @@ -53,7 +56,95 @@ void CCreditText::load(CGameObject *obj, CScreenManager *screenManager, } void CCreditText::setup() { - // TODO + Common::SeekableReadStream *stream = g_vm->_filesManager->getResource( + CString::format("TEXT/155")); + int oldFontNumber = _screenManagerP->setFontNumber(3); + _fontHeight = _screenManagerP->getFontHeight(); + + while (stream->pos() < stream->size()) { + // Read in the line + CString srcLine = readLine(stream); + + // Create a new group and line within it + CCreditLineGroup *group = new CCreditLineGroup(); + CCreditLine *line = new CCreditLine(srcLine, + _screenManagerP->stringWidth(srcLine)); + group->_lines.push_back(line); + + // Loop to add more lines to the group + bool hasDots = false; + while (stream->pos() < stream->size()) { + srcLine = readLine(stream); + if (srcLine.empty()) + break; + + CCreditLine *line = new CCreditLine(srcLine, + _screenManagerP->stringWidth(srcLine)); + group->_lines.push_back(line); + + if (srcLine.contains("....")) + hasDots = true; + } + + _groups.push_back(group); + } + + _groupIt = _groups.begin(); + _lineIt = (*_groupIt)->_lines.begin(); + _totalHeight = _objectP->getBounds().height() + _fontHeight * 2; +} + +CString CCreditText::readLine(Common::SeekableReadStream *stream) { + CString line; + char c = stream->readByte(); + + while (c != '\r' && c != '\n' && c != '\0') { + line += c; + + if (stream->pos() == stream->size()) + break; + c = stream->readByte(); + } + + if (c == '\r') { + c = stream->readByte(); + if (c != '\n') + stream->skip(-1); + } + + return line; +} + +void CCreditText::handleDots(CCreditLineGroup *group) { + uint maxWidth = 0; + CCreditLines::iterator second = group->_lines.begin(); + ++second; + + // Figure out the maximum width of secondary lines + for (CCreditLines::iterator i = second; i != group->_lines.end(); ++i) + maxWidth = MAX(maxWidth, (*i)->_lineWidth); + + int charWidth = _screenManagerP->stringWidth("."); + + // Process the secondary lines + for (CCreditLines::iterator i = second; i != group->_lines.end(); ++i) { + CCreditLine *line = *i; + if (line->_lineWidth >= maxWidth) + continue; + + int dotsCount = (maxWidth + charWidth / 2 - line->_lineWidth) / charWidth; + int dotIndex = line->_line.indexOf("...."); + + if (dotIndex > 0) { + CString leftStr = line->_line.left(dotIndex); + CString dotsStr('.', dotsCount); + CString rightStr = line->_line.right(dotIndex); + + line->_line = CString::format("%s%s%s", leftStr.c_str(), + dotsStr.c_str(), rightStr.c_str()); + line->_lineWidth = maxWidth; + } + } } bool CCreditText::draw() { diff --git a/engines/titanic/support/credit_text.h b/engines/titanic/support/credit_text.h index 82da833bbe..ec8fc22cda 100644 --- a/engines/titanic/support/credit_text.h +++ b/engines/titanic/support/credit_text.h @@ -30,15 +30,21 @@ namespace Titanic { class CGameObject; class CScreenManager; -class COverrideSubItem : public ListItem { - +class CCreditLine : public ListItem { +public: + CString _line; + uint _lineWidth; +public: + CCreditLine() : _lineWidth(0) {} + CCreditLine(const CString &line, uint lineWidth) : _line(line), _lineWidth(lineWidth) {} }; -typedef List CCreditTextSubList; - -class CCreditTextItem : public ListItem { +typedef List CCreditLines; +class CCreditLineGroup : public ListItem { +public: + CCreditLines _lines; }; -typedef List CCreditTextList; +typedef List CCreditLineGroups; class CCreditText { private: @@ -46,17 +52,27 @@ private: * Sets up needed data */ void setup(); + + /** + * Read in a text line from the passed stream + */ + CString readLine(Common::SeekableReadStream *stream); + + /** + * Handles a group where the .... sequence was encountered + */ + void handleDots(CCreditLineGroup *group); public: CScreenManager *_screenManagerP; Rect _rect; int _field14; - CCreditTextList _list; + CCreditLineGroups _groups; uint _ticks; uint _fontHeight; CGameObject *_objectP; - int _field34; - int _field38; - int _field3C; + CCreditLineGroups::iterator _groupIt; + CCreditLines::iterator _lineIt; + uint _totalHeight; int _field40; int _field44; int _field48; diff --git a/engines/titanic/support/string.cpp b/engines/titanic/support/string.cpp index d85fcfc515..cd39c03861 100644 --- a/engines/titanic/support/string.cpp +++ b/engines/titanic/support/string.cpp @@ -63,6 +63,11 @@ int CString::indexOf(char c) const { return charP ? charP - c_str() : -1; } +int CString::indexOf(const char *s) const { + const char *strP = strstr(c_str(), s); + return strP ? strP - c_str() : -1; +} + int CString::lastIndexOf(char c) const { const char *charP = strrchr(c_str(), c); return charP ? charP - c_str() : -1; diff --git a/engines/titanic/support/string.h b/engines/titanic/support/string.h index fdaf92cfad..9550ce88a7 100644 --- a/engines/titanic/support/string.h +++ b/engines/titanic/support/string.h @@ -74,6 +74,11 @@ public: */ int indexOf(char c) const; + /** + * Returns the index of the first occurance of a given string + */ + int indexOf(const char *s) const; + /** * Returns the index of the last occurance of a given character */ -- cgit v1.2.3 From fd316a60589f07ac75cfdf1b56188d9d464336bd Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 Jul 2016 07:45:30 -0400 Subject: TITANIC: Fleshed out various methods --- engines/titanic/game_state.cpp | 14 ++++++++++++-- engines/titanic/input_handler.cpp | 20 ++++++++++++++------ engines/titanic/input_handler.h | 2 +- engines/titanic/input_translator.cpp | 5 +++++ engines/titanic/input_translator.h | 5 +++++ engines/titanic/support/credit_text.cpp | 7 +++---- 6 files changed, 40 insertions(+), 13 deletions(-) diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index 0f2ed1798e..5628161558 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -28,8 +28,18 @@ namespace Titanic { bool CGameStateMovieList::clear() { - // TODO - return false; + for (CGameStateMovieList::iterator i = begin(); i != end(); ) { + CMovieListItem *movieItem = *i; + + if (movieItem->_item->isActive()) { + ++i; + } else { + i = erase(i); + delete movieItem; + } + } + + return !empty(); } /*------------------------------------------------------------------------*/ diff --git a/engines/titanic/input_handler.cpp b/engines/titanic/input_handler.cpp index 395f55df6f..7c35a5d855 100644 --- a/engines/titanic/input_handler.cpp +++ b/engines/titanic/input_handler.cpp @@ -22,15 +22,17 @@ #include "titanic/input_handler.h" #include "titanic/game_manager.h" -#include "titanic/support/screen_manager.h" #include "titanic/titanic.h" +#include "titanic/messages/mouse_messages.h" #include "titanic/pet_control/pet_control.h" +#include "titanic/support/screen_manager.h" namespace Titanic { CInputHandler::CInputHandler(CGameManager *owner) : _gameManager(owner), _inputTranslator(nullptr), _dragging(false), - _buttonDown(false), _dragItem(nullptr), _lockCount(0), _field24(0) { + _buttonDown(false), _dragItem(nullptr), _lockCount(0), + _singleton(false) { CScreenManager::_screenManagerPtr->_inputHandler = this; } @@ -44,7 +46,13 @@ void CInputHandler::incLockCount() { void CInputHandler::decLockCount() { if (--_lockCount == 0 && _inputTranslator) { - warning("TODO"); + if (_dragging && !_inputTranslator->isMousePressed()) { + CMouseButtonUpMsg upMsg(_mousePos, MK_LBUTTON); + handleMessage(upMsg); + } + + _buttonDown = _inputTranslator->isMousePressed(); + _singleton = true; } } @@ -60,11 +68,11 @@ void CInputHandler::handleMessage(CMessage &msg, bool respectLock) { void CInputHandler::processMessage(CMessage *msg) { const CMouseMsg *mouseMsg = dynamic_cast(msg); - _field24 = 0; + _singleton = false; dispatchMessage(msg); - if (_field24) { - _field24 = 0; + if (_singleton) { + _singleton = false; } else if (mouseMsg) { // Keep the game state mouse position up to date if (_mousePos != mouseMsg->_mousePos) { diff --git a/engines/titanic/input_handler.h b/engines/titanic/input_handler.h index 2d62127a11..7244ddc050 100644 --- a/engines/titanic/input_handler.h +++ b/engines/titanic/input_handler.h @@ -56,7 +56,7 @@ public: Point _dragStartPos; Point _mousePos; int _lockCount; - int _field24; + bool _singleton; public: CInputHandler(CGameManager *owner); diff --git a/engines/titanic/input_translator.cpp b/engines/titanic/input_translator.cpp index 571b6dfa14..ce272d152c 100644 --- a/engines/titanic/input_translator.cpp +++ b/engines/titanic/input_translator.cpp @@ -24,6 +24,7 @@ #include "titanic/input_translator.h" #include "titanic/events.h" #include "titanic/messages/mouse_messages.h" +#include "titanic/titanic.h" namespace Titanic { @@ -106,4 +107,8 @@ void CInputTranslator::keyDown(const Common::KeyState &keyState) { } } +bool CInputTranslator::isMousePressed() const { + return g_vm->_window->getSpecialButtons() & (MK_LBUTTON | MK_RBUTTON | MK_MBUTTON); +} + } // End of namespace Titanic diff --git a/engines/titanic/input_translator.h b/engines/titanic/input_translator.h index 7ca2a78699..d92157bccc 100644 --- a/engines/titanic/input_translator.h +++ b/engines/titanic/input_translator.h @@ -52,6 +52,11 @@ public: void rightButtonUp(int special, const Point &pt); void rightButtonDoubleClick(int special, const Point &pt); void keyDown(const Common::KeyState &keyState); + + /** + * Returns true if any mouse button is currently pressed + */ + bool isMousePressed() const; }; } // End of namespace Titanic diff --git a/engines/titanic/support/credit_text.cpp b/engines/titanic/support/credit_text.cpp index 1f12341e71..0e9715aaa6 100644 --- a/engines/titanic/support/credit_text.cpp +++ b/engines/titanic/support/credit_text.cpp @@ -78,7 +78,7 @@ void CCreditText::setup() { if (srcLine.empty()) break; - CCreditLine *line = new CCreditLine(srcLine, + line = new CCreditLine(srcLine, _screenManagerP->stringWidth(srcLine)); group->_lines.push_back(line); @@ -107,9 +107,8 @@ CString CCreditText::readLine(Common::SeekableReadStream *stream) { } if (c == '\r') { - c = stream->readByte(); - if (c != '\n') - stream->skip(-1); + // Read following '\n' + stream->readByte(); } return line; -- cgit v1.2.3 From d1880452b52c75bd5bc9b4d20e4890ccc4bb0dba Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 Jul 2016 15:20:49 -0400 Subject: TITANIC: Added 16bit requirement to configure.engine --- engines/titanic/configure.engine | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/titanic/configure.engine b/engines/titanic/configure.engine index c73bb19f97..daf4e6b388 100644 --- a/engines/titanic/configure.engine +++ b/engines/titanic/configure.engine @@ -1,3 +1,3 @@ # This file is included from the main "configure" script # add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] -add_engine titanic "Starship Titanic" no "" "" "jpeg highres" +add_engine titanic "Starship Titanic" no "" "" "16bit jpeg highres" -- cgit v1.2.3 From 125a38c98a174d7908d6974048948ad2c80ec015 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 Jul 2016 16:29:41 -0400 Subject: TITANIC: In progress adding TTbarbotScript process method --- engines/titanic/true_talk/barbot_script.cpp | 449 ++++++++++++++++++++++++++++ engines/titanic/true_talk/barbot_script.h | 2 + engines/titanic/true_talk/tt_npc_script.cpp | 117 ++++++++ engines/titanic/true_talk/tt_npc_script.h | 5 + engines/titanic/true_talk/tt_script_base.h | 1 + 5 files changed, 574 insertions(+) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index cfde44df9f..89dfe0ae51 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -192,6 +192,434 @@ int BarbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { return 2; } + CTrueTalkManager::setFlags(29, getValue(29) - 1); + CTrueTalkManager::setFlags(30, getValue(30) - 1); + CTrueTalkManager::setFlags(31, getValue(31) - 1); + CTrueTalkManager::setFlags(32, getValue(32) - 1); + CTrueTalkManager::setFlags(33, getValue(33) - 1); + CTrueTalkManager::setFlags(34, getValue(34) - 1); + + int val34 = get34(); + set34(0); + + int val2C = sentence->_field2C; + bool flag = val2C == 11 || val2C == 13; + bool flag2 = val2C == 12; + + if (!val34) { + goto done; + } else if (val34 > 50357) { + goto done; + } else if (val34 == 50357) { + return applySentenceIds(50358, -1); + } + + switch (val34) { + case 1: + if (flag) + return applySentenceIds(51898, 2); + if (flag2) + return applySentenceIds(51897); + break; + case 2: + if (flag) + return applySentenceIds(51897); + break; + case 3: + if (sentence->localWord("useless") || sentence->contains("useless")) + return applySentenceIds(50824); + break; + case 4: + if (flag) + return applySentenceIds(getRandomBit() ? 50512 : 51642); + else if (flag2) + return applySentenceIds(getRandomBit() ? 50511 : 51643); + break; + case 5: + if (flag) + return applySentenceIds(50829, 6); + if (flag2) + return applySentenceIds(50828); + break; + case 6: + if (flag) + return applySentenceIds(50831); + if (flag2) + return applySentenceIds(50830); + break; + case 7: + if (flag2 || sentence->contains("never")) + return applySentenceIds(51553); + if (flag || sentence->contains("nicest")) + return applySentenceIds(51554); + break; + case 8: + if (flag) + return applySentenceIds(50961); + if (flag2) + return applySentenceIds(50960); + break; + case 9: + if (flag) + return applySentenceIds(getDialogueId(251858)); + break; + case 10: + if (flag) + return applySentenceIds(getDialogueId(251014)); + else if (flag2) + return applySentenceIds(getDialogueId(251013)); + break; + case 11: + if (flag) + return applySentenceIds(getDialogueId(251008)); + else if (flag2) + return applySentenceIds(getDialogueId(251007)); + break; + case 12: + if (flag) + return applySentenceIds(getDialogueId(250656)); + else if (flag2) + return applySentenceIds(getDialogueId(250655)); + break; + case 13: + if (flag) + return applySentenceIds(getDialogueId(250614)); + else if (flag2) + return applySentenceIds(getDialogueId(250613)); + break; + case 14: + if (val2C == 6) + return applySentenceIds(getDialogueId(250946)); + break; + case 15: + /* TODO + if (flag || sentence->contains("or")) { + return applySentenceIds(getDialogueId(250526), 16); + } else { + TTtreeResult treeResult; + if (TTquotesTree::search(sentence->_normalizedLine.c_str(), + &TTnpcScript_BTREE_3, &treeResult, 0, 0) != -1) { + id = getDialogueId(250526); + return applySentenceIds(id, 16); + } + } + */ + break; + case 17: + if (flag) { + return applySentenceIds(50382); + } else if (flag2) { + return applySentenceIds(51423); + } + // Deliberate fall-through + + case 16: + if (val2C == 7 || val2C == 10) + return applySentenceIds(getDialogueId(250525)); + break; + case 18: + return applySentenceIds(getDialogueId(250589)); + case 19: + return applySentenceIds(getDialogueId(250565), 20); + case 20: + if (flag) + return applySentenceIds(50307); + if (flag2) + return applySentenceIds(50306); + break; + case 21: + if (flag) + return applySentenceIds(50359); + if (flag2) + return applySentenceIds(50357); + break; + case 23: + if (val2C == 6 || val2C == 10) + return applySentenceIds(getDialogueId(250551)); + break; + case 24: + if (sentence->contains("do not know") + || sentence->contains("no idea") + || sentence->contains("a clue")) { + return applySentenceIds(getDialogueId(250553)); + } else { + return applySentenceIds(getDialogueId(250552)); + } + break; + case 25: + if (flag || val2C == 10) + applySentenceIds(getDialogueId(251899), 26); + else if (flag2) + return applySentenceIds(50215); + break; + case 26: + /* TODO + v43 = TTstring_cstr(&sentence->normalizedLine); + if (TTquotesTree_Search(v43, &TTnpcScript_BTREE_3, &buffer, 0, 0) == -1) + break; + */ + return applySentenceIds(getDialogueId(251899), 26); + + case 27: + if (flag) + return applySentenceIds(getDialogueId(250766)); + else if (flag2) + return applySentenceIds(getDialogueId(250764)); + break; + case 28: + return applySentenceIds(getDialogueId(250765)); + case 29: + return applySentenceIds(getDialogueId(250652)); + case 30: + return applySentenceIds(getDialogueId(250653)); + case 31: + if (flag) + return applySentenceIds(getDialogueId(250664)); + else if (flag2) + return applySentenceIds(getDialogueId(250663)); + break; + case 32: + if (flag) + return applySentenceIds(getDialogueId(250643)); + else if (flag2) + return applySentenceIds(getDialogueId(250642)); + break; + case 33: + return applySentenceIds(50763); + case 34: + if (flag) + return applySentenceIds(getDialogueId(251622)); + else if (flag2) + return applySentenceIds(getDialogueId(251624)); + break; + case 35: + if (val2C == 6 || val2C == 10) + return applySentenceIds(getDialogueId(251623)); + break; + case 36: + if (flag) + return applySentenceIds(50335); + if (flag2) + return applySentenceIds(50334); + break; + case 37: + if (flag) + return applySentenceIds(50217); + if (flag2) + return applySentenceIds(50153); + break; + case 38: + return applySentenceIds(getDialogueId(250637)); + case 39: + return applySentenceIds(getDialogueId(250638)); + case 40: + return applySentenceIds(getDialogueId(250639)); + case 41: + return applySentenceIds(getDialogueId(250640)); + case 42: + if (flag) + return applySentenceIds(getDialogueId(250676)); + else if (flag2) + return applySentenceIds(getDialogueId(250673)); + break; + case 43: + if (flag) + return applySentenceIds(50416, -1); + if (flag2) + return applySentenceIds(50415, -1); + break; + case 44: + if (flag) + return applySentenceIds(getDialogueId(250468)); + else if (flag2) + return applySentenceIds(getDialogueId(250413)); + + if (val2C == 6 || val2C == 10) + return applySentenceIds(getDialogueId(251649)); + break; + case 45: + if (sentence->localWord("summer") + || sentence->contains("summer") + || sentence->localWord("autumn") + || sentence->contains("autumn")) { + return applySentenceIds(50743); + } else if (sentence->localWord("winter") || sentence->contains("winter")) { + return applySentenceIds(50696); + } else { + return applySentenceIds(50225); + } + break; + case 46: + if (val2C == 7 || val2C == 10) + return applySentenceIds(50698); + break; + case 47: + if (flag || flag2 || val2C == 6) + return applySentenceIds(50717); + break; + case 48: + if (flag) + return applySentenceIds(50710); + if (flag2) + return applySentenceIds(50225); + break; + case 49: + if (sentence->localWord("scraliontis") || sentence->contains("scraliontis")) + return applySentenceIds(50711); + if (sentence->localWord("brobostigon") || sentence->contains("brobostigon")) + return applySentenceIds(50712); + break; + case 50: + return applySentenceIds(50713); + case 51: + if (flag) + return applySentenceIds(50715); + if (flag2) + return applySentenceIds(50714); + break; + case 52: + if (sentence->localWord("note") || sentence->contains("note")) + return applySentenceIds(50716); + return applySentenceIds(50210); + case 53: + return applySentenceIds(50210); + case 54: + if (getDialRegion(0) != 0) { + if (val2C == 12) + return applySentenceIds(50174); + else + return applySentenceIds(50300); + } else if (val2C == 7 || val2C == 10) { + return applySentenceIds(50871); + } + break; + case 55: + if (flag) + return applySentenceIds(50302); + if (flag2) + return applySentenceIds(50301); + break; + case 56: + if (flag) + return applySentenceIds(50304); + if (flag2) + return applySentenceIds(50303); + break; + case 57: + if (sentence->localWord("mustard") + || sentence->contains("mustard") + || sentence->localWord("tomato") + || sentence->contains("tomato")) + return applySentenceIds(50320); + if (sentence->localWord("sauce") + || sentence->localWord("puree") + || sentence->contains("sauce") + || sentence->contains("puree") + || sentence->contains("bird") + || sentence->contains("starling")) { + applySentenceIds(50321); + CTrueTalkManager::triggerAction(30, 0); + return 2; + } + + return applySentenceIds(50320); + case 58: + if (val2C == 6 || val2C == 10) + return applySentenceIds(50880); + break; + case 59: + if (flag) { + if (addRandomResponse(true)) { + set34(59); + return 2; + } + } else if (flag2) { + return applySentenceIds(getDialogueId(251754)); + } + break; + case 60: + if (flag && addRandomResponse(true)) { + set34(59); + return 2; + } else if (flag2 || val2C == 7 || val2C == 10) { + return applySentenceIds(getDialogueId(251712)); + } + break; + case 61: + if (val2C == 3) { + if (sentence->localWord("loop")) + return applySentenceIds(getDialogueId(250269)); + else if (sentence->localWord("do")) + return applySentenceIds(getDialogueId(250270)); + } else if (val2C == 7) { + return applySentenceIds(getDialogueId(250270)); + } else if (flag) { + return applySentenceIds(getDialogueId(250270)); + } + + return applySentenceIds(getDialogueId(250272)); + case 62: + if (flag + || (val2C == 3 && sentence->localWord("do")) + || val2C == 7 + || sentence->localWord("help")) + return applySentenceIds(getDialogueId(250270)); + + return applySentenceIds(getDialogueId(2570272)); + case 63: + if (flag + || (val2C == 3 || sentence->localWord("do")) + || val2C == 7 + || sentence->localWord("help")) + return applySentenceIds(getDialogueId(250271)); + + return applySentenceIds(getDialogueId(250272)); + case 64: + if (flag || val2C == 3 || val2C == 8) + return applySentenceIds(getDialogueId(250631)); + break; + case 65: + if (sentence->localWord("now") || sentence->localWord("soonh")) + return applySentenceIds(getDialogueId(250424)); + return applySentenceIds(getDialogueId(250506)); + case 66: + if (flag || sentence->localWord("good") || sentence->localWord("well")) + return applySentenceIds(getDialogueId(251027)); + return applySentenceIds(getDialogueId(251021)); + case 67: + if (flag || val2C == 6 || val2C == 10) { + setDial(0, getDialLevel(0, false) - 8); + return applySentenceIds(getDialogueId(251589)); + } + break; + case 68: + if (flag || val2C == 6 || val2C == 10) { + setDial(0, getDialLevel(0, false) - 12); + return applySentenceIds(getDialogueId(251590)); + } + break; + case 69: + if (flag || val2C == 6 || val2C == 10) { + setDial(0, getDialLevel(0, false) - 25); + return applySentenceIds(getDialogueId(251591)); + } + break; + default: + break; + } + +done: + // Adjust primary dial + set34(0); + if (sentence->get58() != 5) { + adjustDial(0, sentence->get58() * 4 - 20); + } else if (getDialLevel(0, false) > 65) { + adjustDial(0, -2 - getRandomNumber(7)); + } else if (getDialLevel(0, false) < 35) { + adjustDial(0, 2 + getRandomNumber(7)); + } + + // TODO: Remainder of method // TODO @@ -255,4 +683,25 @@ bool BarbotScript::isState9() const { return CTrueTalkManager::getStateValue(9) != 0; } +int BarbotScript::applySentenceIds(int dialogueId, int v34) { + addResponse(dialogueId); + applyResponse(); + + if (v34 != -1) { + set34(v34); + } else { + for (uint idx = 0; idx < _mappings.size(); ++idx) { + const TTscriptMapping &m = _mappings[idx]; + for (int vidx = 0; vidx < _mappings._valuesPerMapping; ++idx) { + if (m._values[vidx] == (uint)dialogueId) { + proc21(m._id, m._id, vidx); + break; + } + } + } + } + + return -2; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index 1d73094660..3d2a5133ac 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -43,6 +43,8 @@ private: void setupSentences(); bool isState9() const; + + int applySentenceIds(int dialogueId, int v34 = -1); public: BarbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7); diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 8cce90ebff..647523bc32 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -37,6 +37,69 @@ static const char *const ITEMS[] = { "longstick", "bomb", "lemon", "puree", "television", "hammer", nullptr }; +struct ItemRec { + const char *const _name; + uint _id; +}; +static const ItemRec ARRAY1[] = { + { ITEMS[0], 290138 }, + { ITEMS[1], 290139 }, + { ITEMS[2], 290141 }, + { ITEMS[3], 290142 }, + { ITEMS[4], 290153 }, + { ITEMS[5], 290158 }, + { ITEMS[6], 290159 }, + { ITEMS[7], 290160 }, + { ITEMS[8], 290161 }, + { ITEMS[9], 290162 }, + { ITEMS[10], 290163 }, + { ITEMS[11], 290164 }, + { ITEMS[12], 290165 }, + { ITEMS[13], 290166 }, + { ITEMS[14], 290166 }, + { ITEMS[15], 290178 }, + { ITEMS[16], 290174 }, + { ITEMS[17], 290175 }, + { ITEMS[18], 290176 }, + { ITEMS[19], 290179 }, + { nullptr, 0 } +}; +static const uint ARRAY2[] = { + 290167, 290178, 290183, 290144, 290148, 290151, 290154, 290156, 290158, 290159, 290160, 290161, + 290162, 290163, 290164, 290165, 290177, 290181, 0 +}; +static const uint RANDOM1[] = { + 290184, 290185, 290187, 290188, 290190, 290191, 290193, 290195, 290196, 290197, 290198, 290199, + 290202, 290205, 0 +}; +static const uint RANDOM2[] = { + 290186, 290187, 290188, 290190, 290191, 290193, 290194, 290195, 290196, 290197, 290198, 290199, + 290200, 290201, 290202, 290204, 290205, 0 +}; +static const uint RANDOM3[] = { + 290188, 290190, 290192, 290194, 290197, 290200, 290201, 290202, 290204, 290205, 0 +}; +static const uint RANDOM4[] = { + 290206, 290207, 290209, 290210, 290211, 290212, 290216, 290217, 290218, 290219, 290222, 290223, 0 +}; +static const uint RANDOM5[] = { + 290208, 290209, 290210, 290211, 290212, 290214, 290215, 290216, 290217, 290218, 290219, 290221, + 290222, 290223, 0 +}; +static const uint RANDOM6[] = { + 290210, 290211, 290213, 290214, 290215, 290220, 290221, 290222, 290223, 0 +}; +static const uint RANDOM7[] = { + 290225, 290226, 290228, 290229, 290230, 290232, 290231, 290235, 290236, 290237, 290238, 290241, 0 +}; +static const uint RANDOM8[] = { + 290227, 290228, 290229, 290230, 290231, 290232, 290233, 290234, 290235, 290236, 290237, 290238, + 290240, 290241, 0 +}; +static const uint RANDOM9[] = { + 290228, 290229, 290230, 290232, 290233, 290234, 290239, 290240, 290241, 0 +}; + /*------------------------------------------------------------------------*/ int TTnpcScriptResponse::size() const { @@ -775,4 +838,58 @@ void TTnpcScript::checkItems(TTroomScript *roomScript, TTsentence *sentence) { } } +bool TTnpcScript::addRandomResponse(bool flag) { + if (getValue(1) > 3) + return false; + + const uint *data; + if (flag) { + if (getValue(1) == 2) + data = RANDOM8; + else if (getValue(1) == 1) + data = RANDOM7; + else + data = RANDOM9; + } else if (getRandomBit()) { + if (getValue(1) == 2) + data = RANDOM2; + else if (getValue(1) == 1) + data = RANDOM1; + else + data = RANDOM3; + } else { + if (getValue(1) == 2) + data = RANDOM5; + else if (getValue(1) == 1) + data = RANDOM4; + else + data = RANDOM6; + } + + // Pick a random entry + uint count = 0; + while (data[count]) + ++count; + uint id = data[getRandomNumber(count - 1)]; + + if (id == 290188 && getRoom54(101)) + id = 290189; + else if (id == 290202 && getRoom54(123)) + id = 290203; + + if (!id) + return false; + id = getDialogueId(id); + if (id == 4) + return true; + if (!id) + return false; + + if (flag) + addResponse(getDialogueId(290224)); + + addResponse(id); + applyResponse(); +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index d7cec8d6d8..43764d89c4 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -251,6 +251,11 @@ protected: bool defaultProcess(TTroomScript *roomScript, TTsentence *sentence); void checkItems(TTroomScript *roomScript, TTsentence *sentence); + + /** + * Adds a random conversation response + */ + bool addRandomResponse(bool flag); public: TTnpcScript(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, diff --git a/engines/titanic/true_talk/tt_script_base.h b/engines/titanic/true_talk/tt_script_base.h index e855fefb2c..e94bab3277 100644 --- a/engines/titanic/true_talk/tt_script_base.h +++ b/engines/titanic/true_talk/tt_script_base.h @@ -73,6 +73,7 @@ protected: } void set34(int val) { _field34 = val; } + int get34() const { return _field34; } public: int _id; public: -- cgit v1.2.3 From 773bfca60551c519a3bf1989724bafe77390a728 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 Jul 2016 19:44:04 -0400 Subject: DEVTOOLS: Add secondary Barbot sentence data to create_titanic --- devtools/create_titanic/create_titanic_dat.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index ed263d7b77..199a8d1fec 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -52,7 +52,7 @@ */ #define VERSION_NUMBER 1 -#define HEADER_SIZE 0x680 +#define HEADER_SIZE 0x700 Common::File inputFile, outputFile; Common::PEResources res; @@ -535,7 +535,9 @@ void writeData() { writeStringArray("TEXT/REPLACEMENTS3", 0x21D9C8, 82); writeStringArray("TEXT/PRONOUNS", 0x22F718, 15); + writeSentenceEntries("Sentences/Default", 0x5C0130); writeSentenceEntries("Sentences/Barbot", 0x5ABE60); + writeSentenceEntries("Sentences/Barbot2", 0x5BD4E8); writeSentenceEntries("Sentences/Bellbot", 0x5C2230); writeSentenceEntries("Sentences/Deskbot", 0x5DCD10); writeSentenceEntries("Sentences/Doorbot", 0x5EC110); -- cgit v1.2.3 From 6e2a4edd2a9cbb5c44be1a930e27d607e744361d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 Jul 2016 19:44:19 -0400 Subject: TITANIC: Finish TTbarbotScript process method --- engines/titanic/titanic.cpp | 3 + engines/titanic/true_talk/barbot_script.cpp | 137 ++++++++++++++++++++++++++- engines/titanic/true_talk/barbot_script.h | 1 + engines/titanic/true_talk/deskbot_script.cpp | 4 +- engines/titanic/true_talk/tt_npc_script.cpp | 53 +++++++++-- engines/titanic/true_talk/tt_npc_script.h | 14 ++- 6 files changed, 196 insertions(+), 16 deletions(-) diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index dfb68fd9d5..66d4e46546 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -41,6 +41,7 @@ #include "titanic/moves/enter_exit_sec_class_mini_lift.h" #include "titanic/moves/exit_pellerator.h" #include "titanic/support/simple_file.h" +#include "titanic/true_talk/tt_npc_script.h" namespace Titanic { @@ -93,6 +94,7 @@ void TitanicEngine::initialize() { CExitPellerator::init(); CEnterExitSecClassMiniLift::init(); CTelevision::init(); + TTnpcScript::init(); OSVideoSurface::setup(); _debugger = new Debugger(this); @@ -119,6 +121,7 @@ void TitanicEngine::deinitialize() { CEnterExitSecClassMiniLift::deinit(); CGameObject::deinit(); CTelevision::deinit(); + TTnpcScript::deinit(); } Common::Error TitanicEngine::run() { diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index 89dfe0ae51..03aa1cdaae 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -57,11 +57,12 @@ void BarbotScript::setupSentences() { CTrueTalkManager::setFlags(idx, 0); setupDials(100, 100, 100); - if (!_field74) - _field74 = 2; + if (!_currentDialNum) + _currentDialNum = 2; _mappings.load("Mappings/Barbot", 8); _entries.load("Sentences/Barbot"); + _entries2.load("Sentences/Barbot2"); } int BarbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { @@ -619,10 +620,138 @@ done: adjustDial(0, 2 + getRandomNumber(7)); } - // TODO: Remainder of method + updateCurrentDial(true); + if (sentence->contains("goldfish")) { + addResponse(250184); + } else if ((sentence->localWord("puree") || sentence->localWord("pureed")) + && sentence->localWord("parrot")) { + addResponse(250021); + } else if (sentence->localWord("starling")) { + addResponse(250024); + } else { + if (getRandomNumber(100) > 95 && getDialRegion(2) == 0) { + addResponse(getDialogueId(250210)); + } + + if (processEntries(&_entries, _entryCount, roomScript, sentence) == 2) + return 2; + if (processEntries(_defaultEntries, 0, roomScript, sentence) != 2 + && !defaultProcess(roomScript, sentence)) { + int dval = 0; + flag = getRandomNumber(100) > 50; + int val; + + switch (_field2C) { + case 2: + val = getValue(29); + if (val < 16) + val += 4; + if (val < 9) { + val = val / 2; + dval = 250081 + flag ? 0 : 267; + } + CTrueTalkManager::setFlags(29, val); + break; + + case 3: + val = getValue(30); + if (val < 16) + val += 4; + if (val < 9) { + val = val / 2; + dval = 250081 + flag ? 0 : 243; + } + CTrueTalkManager::setFlags(30, val); + break; + + case 4: + val = getValue(31); + if (val < 16) + val += 4; + if (val < 9) { + val = val / 2; + dval = 250081 + flag ? 0 : 256; + } + CTrueTalkManager::setFlags(31, val); + break; + + case 5: + val = getValue(32); + if (val < 16) + val += 4; + if (val < 9) { + val = val / 2; + dval = 250081 + flag ? 0 : 251; + } + CTrueTalkManager::setFlags(32, val); + break; + + case 6: + val = getValue(33); + if (val < 16) + val += 4; + if (val < 9) { + val = val / 2; + dval = 250081 + flag ? 0 : 273; + } + CTrueTalkManager::setFlags(33, val); + break; + + case 7: + val = getValue(34); + if (val < 16) + val += 4; + if (val < 9) { + val = val / 2; + dval = 250081 + flag ? 0 : 236; + } + CTrueTalkManager::setFlags(34, val); + break; + + + case 11: + addResponse(getDialogueId(250463)); + applyResponse(); + return 2; + + case 12: + addResponse(getDialogueId(250455)); + applyResponse(); + return 2; + + case 13: + addResponse(getDialogueId(250447)); + applyResponse(); + return 2; + + case 19: + return applySentenceIds(getDialogueId(getDialRegion(0) ? 250062 : 250200)); - // TODO + default: + break; + } + + if (dval) { + adjustDial(0, -9); + adjustDial(1, -2); + + if (dval != 250081) { + selectResponse(250286); + selectResponse(250296); + selectResponse(250307); + applyResponse(); + return 2; + } + } else if (processEntries(&_entries2, 0, roomScript, sentence) == 2) { + return 2; + } + + addResponse(getDialogueId(250082 + getRandomNumber(100) <= 89 ? 128 : 0)); + } + } + + applyResponse(); return 2; } diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index 3d2a5133ac..94491491c0 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -31,6 +31,7 @@ class BarbotScript : public TTnpcScript { private: int _state; int _arrIndex; + TTsentenceEntries _entries2; private: /** * Adjust a given dial number by a given delta amount diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index ca000a4c28..61e1f717c9 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -37,8 +37,8 @@ DeskbotScript::DeskbotScript(int val1, const char *charClass, int v2, setupDials(0, 0, 0); _array[0] = 100; - if (_field74 == 1) - _field74 = 0; + if (_currentDialNum == 1) + _currentDialNum = 0; loadRanges("Ranges/Deskbot"); loadResponses("Responses/Deskbot", 4); diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 647523bc32..f673cc0313 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -31,6 +31,8 @@ namespace Titanic { +TTsentenceEntries *TTnpcScript::_defaultEntries; + static const char *const ITEMS[] = { "chicken", "napkin", "parrot", "moth", "fuse", "eye", "nose", "ear", "mouth", "auditorycenter", "visioncenter", "olfactorycenter", "speechcenter", "stick", @@ -211,11 +213,21 @@ TTnpcScriptBase::TTnpcScriptBase(int charId, const char *charClass, int v2, /*------------------------------------------------------------------------*/ +void TTnpcScript::init() { + _defaultEntries = new TTsentenceEntries(); + _defaultEntries->load("Sentences/Default"); +} + +void TTnpcScript::deinit() { + delete _defaultEntries; + _defaultEntries = nullptr; +} + TTnpcScript::TTnpcScript(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScriptBase(charId, charClass, v2, charName, v3, val2, v4, v5, v6, v7), _entryCount(0), _field68(0), _field6C(0), _rangeResetCtr(0), - _field74(0), _field78(0), _field7C(0), _itemStringP(nullptr), _field2CC(false) { + _currentDialNum(0), _dialDelta(0), _field7C(0), _itemStringP(nullptr), _field2CC(false) { CTrueTalkManager::_v2 = 0; Common::fill(&_dialValues[0], &_dialValues[DIALS_ARRAY_COUNT], 0); Common::fill(&_array[0], &_array[136], 0); @@ -274,11 +286,11 @@ void TTnpcScript::setupDials(int dial1, int dial2, int dial3) { _dialValues[0] = dial1; _dialValues[1] = dial2; _dialValues[2] = dial3; - _field74 = getRandomNumber(3) - 1; - _field78 = getRandomNumber(5) + 6; + _currentDialNum = getRandomNumber(3) - 1; + _dialDelta = getRandomNumber(5) + 6; if (_dialValues[0] > 70) - _field78 = -_field78; + _dialDelta = -_dialDelta; } void TTnpcScript::addResponse(int id) { @@ -425,8 +437,8 @@ void TTnpcScript::save(SimpleFile *file) { file->writeNumber(4); file->writeNumber(_rangeResetCtr); - file->writeNumber(_field74); - file->writeNumber(_field78); + file->writeNumber(_currentDialNum); + file->writeNumber(_dialDelta); file->writeNumber(_field7C); file->writeNumber(10); @@ -439,8 +451,8 @@ void TTnpcScript::load(SimpleFile *file) { int count = file->readNumber(); _rangeResetCtr = file->readNumber(); - _field74 = file->readNumber(); - _field78 = file->readNumber(); + _currentDialNum = file->readNumber(); + _dialDelta = file->readNumber(); _field7C = file->readNumber(); for (int idx = count; idx > 4; --idx) @@ -890,6 +902,31 @@ bool TTnpcScript::addRandomResponse(bool flag) { addResponse(id); applyResponse(); + return true; +} + +void TTnpcScript::updateCurrentDial(bool changeDial) { + int dialLevel = CLIP(getDialLevel(_currentDialNum) + _dialDelta, 0, 100); + setDial(_currentDialNum, dialLevel); + + bool edgeFlag = false; + if (_dialDelta < 0) { + if (dialLevel < 10 || getRandomNumber(100) > 93) + edgeFlag = true; + } else { + if (dialLevel > 90 || getRandomNumber(100) > 93) + edgeFlag = true; + } + + if (edgeFlag) { + if (changeDial) + _currentDialNum = getRandomNumber(3); + + _dialDelta = getRandomNumber(12) + 3; + dialLevel = getDialLevel(_currentDialNum, false); + if (dialLevel > 50) + _dialDelta = -_dialDelta; + } } } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 43764d89c4..8a17064034 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -158,6 +158,8 @@ public: class TTnpcScript : public TTnpcScriptBase { private: int translateByArray(int id); +protected: + static TTsentenceEntries *_defaultEntries; protected: Common::Array _responses; int _valuesPerResponse; @@ -169,8 +171,8 @@ protected: int _field68; int _field6C; int _rangeResetCtr; - int _field74; - int _field78; + int _currentDialNum; + int _dialDelta; int _field7C; const char *_itemStringP; int _dialValues[DIALS_ARRAY_COUNT]; @@ -256,6 +258,14 @@ protected: * Adds a random conversation response */ bool addRandomResponse(bool flag); + + /** + * Updates the current dial with the given delta + */ + void updateCurrentDial(bool changeDial); +public: + static void init(); + static void deinit(); public: TTnpcScript(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, -- cgit v1.2.3 From 7d554339d3e1040480c9e1105d3ce7065fc77772 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 Jul 2016 19:55:46 -0400 Subject: TITANIC: Add semicolons after DEFFN lines --- engines/titanic/core/saveable_object.cpp | 1154 +++++++++++++++--------------- 1 file changed, 577 insertions(+), 577 deletions(-) diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index d3c64a13ec..62cee47045 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -420,594 +420,594 @@ Common::HashMap * CSaveableObject::_classList = nullptr; Common::List *CSaveableObject::_classDefs; -#define DEFFN(T) ClassDef *T::_type; \ - CSaveableObject *Function##T() { return new T(); } +#define DEFFN(T) CSaveableObject *Function##T() { return new T(); } \ + ClassDef *T::_type #define ADDFN(CHILD, PARENT) \ CHILD::_type = new TypeTemplate(#CHILD, PARENT::_type); \ (*_classList)[#CHILD] = Function##CHILD -DEFFN(CArm) -DEFFN(CAuditoryCentre) -DEFFN(CBowlEar) -DEFFN(CBrain) -DEFFN(CBridgePiece) -DEFFN(CCarry) -DEFFN(CCarryParrot) -DEFFN(CCentralCore) -DEFFN(CChicken) -DEFFN(CCrushedTV) -DEFFN(CEar) -DEFFN(CEye) -DEFFN(CFeathers) -DEFFN(CFruit) -DEFFN(CGlass) -DEFFN(CHammer) -DEFFN(CHeadPiece) -DEFFN(CHose) -DEFFN(CHoseEnd) -DEFFN(CKey) -DEFFN(CLiftbotHead) -DEFFN(CLongStick) -DEFFN(CMagazine) -DEFFN(CMaitreDLeftArm) -DEFFN(CMaitreDRightArm) -DEFFN(CMouth) -DEFFN(CNapkin) -DEFFN(CNose) -DEFFN(CNote) -DEFFN(CParcel) -DEFFN(CPerch) -DEFFN(CPhonographCylinder) -DEFFN(CPhonographEar) -DEFFN(CPhotograph) -DEFFN(CPlugIn) -DEFFN(CSpeechCentre) -DEFFN(CSweets) -DEFFN(CVisionCentre) +DEFFN(CArm); +DEFFN(CAuditoryCentre); +DEFFN(CBowlEar); +DEFFN(CBrain); +DEFFN(CBridgePiece); +DEFFN(CCarry); +DEFFN(CCarryParrot); +DEFFN(CCentralCore); +DEFFN(CChicken); +DEFFN(CCrushedTV); +DEFFN(CEar); +DEFFN(CEye); +DEFFN(CFeathers); +DEFFN(CFruit); +DEFFN(CGlass); +DEFFN(CHammer); +DEFFN(CHeadPiece); +DEFFN(CHose); +DEFFN(CHoseEnd); +DEFFN(CKey); +DEFFN(CLiftbotHead); +DEFFN(CLongStick); +DEFFN(CMagazine); +DEFFN(CMaitreDLeftArm); +DEFFN(CMaitreDRightArm); +DEFFN(CMouth); +DEFFN(CNapkin); +DEFFN(CNose); +DEFFN(CNote); +DEFFN(CParcel); +DEFFN(CPerch); +DEFFN(CPhonographCylinder); +DEFFN(CPhonographEar); +DEFFN(CPhotograph); +DEFFN(CPlugIn); +DEFFN(CSpeechCentre); +DEFFN(CSweets); +DEFFN(CVisionCentre); -DEFFN(CBackground) -DEFFN(CClickResponder) -DEFFN(CDontSaveFileItem) -DEFFN(CDropTarget) -DEFFN(CFileItem) -DEFFN(CFileListItem) -DEFFN(CGameObject) -DEFFN(CGameObjectDescItem) -DEFFN(CLinkItem) -DEFFN(ListItem) -DEFFN(CMailMan) -DEFFN(CMessageTarget) -DEFFN(CMovieClip) -DEFFN(CMultiDropTarget) -DEFFN(CNamedItem) -DEFFN(CNodeItem) -DEFFN(CProjectItem) -DEFFN(CResourceKey) -DEFFN(CRoomItem) -DEFFN(CSaveableObject) -DEFFN(CStaticImage) -DEFFN(CTurnOnObject) -DEFFN(CTurnOnPlaySound) -DEFFN(CTurnOnTurnOff) -DEFFN(CTreeItem) -DEFFN(CViewItem) +DEFFN(CBackground); +DEFFN(CClickResponder); +DEFFN(CDontSaveFileItem); +DEFFN(CDropTarget); +DEFFN(CFileItem); +DEFFN(CFileListItem); +DEFFN(CGameObject); +DEFFN(CGameObjectDescItem); +DEFFN(CLinkItem); +DEFFN(ListItem); +DEFFN(CMailMan); +DEFFN(CMessageTarget); +DEFFN(CMovieClip); +DEFFN(CMultiDropTarget); +DEFFN(CNamedItem); +DEFFN(CNodeItem); +DEFFN(CProjectItem); +DEFFN(CResourceKey); +DEFFN(CRoomItem); +DEFFN(CSaveableObject); +DEFFN(CStaticImage); +DEFFN(CTurnOnObject); +DEFFN(CTurnOnPlaySound); +DEFFN(CTurnOnTurnOff); +DEFFN(CTreeItem); +DEFFN(CViewItem); -DEFFN(CAnnounce) -DEFFN(CAnnoyBarbot) -DEFFN(CArbBackground) -DEFFN(CArboretumGate) -DEFFN(CAutoAnimate) -DEFFN(CBarBell) -DEFFN(CBarMenu) -DEFFN(CBarMenuButton) -DEFFN(CBelbotGetLight) -DEFFN(CBilgeSuccUBus) -DEFFN(CBomb) -DEFFN(CBottomOfWellMonitor) -DEFFN(CBowlUnlocker) -DEFFN(CBrainSlot) -DEFFN(CBridgeDoor) -DEFFN(CBridgeView) -DEFFN(CBrokenPellBase) -DEFFN(CBrokenPellerator) -DEFFN(CBrokenPelleratorFroz) -DEFFN(CCage) -DEFFN(CCallPellerator) -DEFFN(CCaptainsWheel) -DEFFN(CCDROM) -DEFFN(CCDROMComputer) -DEFFN(CCDROMTray) -DEFFN(CCellPointButton) -DEFFN(CChevCode) -DEFFN(CChevPanel) -DEFFN(CChickenCooler) -DEFFN(CChickenDispensor) -DEFFN(CCloseBrokenPel) -DEFFN(CodeWheel) -DEFFN(CComputer) -DEFFN(CComputerScreen) -DEFFN(CCookie) -DEFFN(CCredits) -DEFFN(CCreditsButton) -DEFFN(CDeadArea) -DEFFN(CDeskClickResponder) -DEFFN(CDoorbotElevatorHandler) -DEFFN(CDoorbotHomeHandler) -DEFFN(CEarSweetBowl) -DEFFN(CEjectPhonographButton) -DEFFN(CElevatorActionArea) -DEFFN(CEmmaControl) -DEFFN(CEmptyNutBowl) -DEFFN(CEndCreditText) -DEFFN(CEndCredits) -DEFFN(CEndExplodeShip) -DEFFN(CEndGameCredits) -DEFFN(CEndSequenceControl) -DEFFN(CFan) -DEFFN(CFanControl) -DEFFN(CFanDecrease) -DEFFN(CFanIncrease) -DEFFN(CFanNoises) -DEFFN(CFloorIndicator) -DEFFN(CGamesConsole) -DEFFN(CGetLiftEye2) -DEFFN(CGlassSmasher) -DEFFN(CHammerClip) -DEFFN(CHammerDispensor) -DEFFN(CHammerDispensorButton) -DEFFN(CHeadSlot) -DEFFN(CHeadSmashEvent) -DEFFN(CHeadSmashLever) -DEFFN(CHeadSpinner) -DEFFN(CIdleSummoner) -DEFFN(CLeaveSecClassState) -DEFFN(CLemonDispensor) -DEFFN(CLight) -DEFFN(CLightSwitch) -DEFFN(CLittleLiftButton) -DEFFN(CLongStickDispenser) -DEFFN(CMissiveOMat) -DEFFN(CMissiveOMatButton) -DEFFN(CMovieTester) -DEFFN(CMusicalInstrument) -DEFFN(CMusicConsoleButton) -DEFFN(CMusicRoomPhonograph) -DEFFN(CMusicRoomStopPhonographButton) -DEFFN(CMusicSystemLock) -DEFFN(CNavHelmet) -DEFFN(CNavigationComputer) -DEFFN(CNoNutBowl) -DEFFN(CNoseHolder) -DEFFN(CNullPortHole) -DEFFN(CNutReplacer) -DEFFN(CPetDisabler) -DEFFN(CPhonograph) -DEFFN(CPhonographLid) -DEFFN(CPlayMusicButton) -DEFFN(CPlayOnAct) -DEFFN(CPortHole) -DEFFN(CRecordPhonographButton) -DEFFN(CReplacementEar) -DEFFN(CReservedTable) -DEFFN(CRestaurantCylinderHolder) -DEFFN(CRestaurantPhonograph) -DEFFN(CSauceDispensor) -DEFFN(CSearchPoint) -DEFFN(CSeasonBackground) -DEFFN(CSeasonBarrel) -DEFFN(CSeasonalAdjustment) -DEFFN(CServiceElevatorWindow) -DEFFN(CShipSetting) -DEFFN(CShipSettingButton) -DEFFN(CShowCellpoints) -DEFFN(CSpeechDispensor) -DEFFN(CSplashAnimation) -DEFFN(CStarlingPuret) -DEFFN(CStartAction) -DEFFN(CStopPhonographButton) -DEFFN(CSUBGlass) -DEFFN(CSUBWrapper) -DEFFN(CSweetBowl) -DEFFN(CTelevision) -DEFFN(CThirdClassCanal) -DEFFN(CThrowTVDownWell) -DEFFN(CTitaniaStillControl) -DEFFN(CTOWParrotNav) -DEFFN(CUpLighter) -DEFFN(CUselessLever) -DEFFN(CVolumeControl) -DEFFN(CWheelButton) -DEFFN(CWheelHotSpot) -DEFFN(CWheelSpin) -DEFFN(CWheelSpinHorn) -DEFFN(CGondolierBase) -DEFFN(CGondolierChest) -DEFFN(CGondolierFace) -DEFFN(CGondolierMixer) -DEFFN(CGondolierSlider) -DEFFN(CMaitreDArmHolder) -DEFFN(CMaitreDBody) -DEFFN(CMaitreDLegs) -DEFFN(CMaitreDProdReceptor) -DEFFN(CParrotLobbyController) -DEFFN(CParrotLobbyLinkUpdater) -DEFFN(CParrotLobbyObject) -DEFFN(CParrotLobbyViewObject) -DEFFN(CParrotLoser) -DEFFN(CParrotNutBowlActor) -DEFFN(CParrotNutEater) -DEFFN(CParrotPerchHolder) -DEFFN(CParrotSuccUBus) -DEFFN(CParrotTrigger) -DEFFN(CPlayerMeetsParrot) -DEFFN(CPET) -DEFFN(CPETClass1) -DEFFN(CPETClass2) -DEFFN(CPETClass3) -DEFFN(CPetControl) -DEFFN(CPetDragChev) -DEFFN(CPetGraphic) -DEFFN(CPetGraphic2) -DEFFN(PETLeaf) -DEFFN(CPETLift) -DEFFN(CPETMonitor) -DEFFN(CPETPellerator) -DEFFN(CPETPosition) -DEFFN(CPETSentinal) -DEFFN(CPETSounds) -DEFFN(CPETTransition) -DEFFN(CPETTransport) -DEFFN(CPickUp) -DEFFN(CPickUpBarGlass) -DEFFN(CPickUpHose) -DEFFN(CPickUpLemon) -DEFFN(CPickUpSpeechCentre) -DEFFN(CPickUpVisCentre) -DEFFN(CBarShelfVisCentre) -DEFFN(CLemonOnBar) -DEFFN(CPlaceHolderItem) -DEFFN(CTVOnBar) -DEFFN(CArmchair) -DEFFN(CBasin) -DEFFN(CBedfoot) -DEFFN(CBedhead) -DEFFN(CChestOfDrawers) -DEFFN(CDesk) -DEFFN(CDeskchair) -DEFFN(CDrawer) -DEFFN(CSGTDoors) -DEFFN(SGTNav) -DEFFN(CSGTNavigation) -DEFFN(CSGTRestaurantDoors) -DEFFN(CSGTStateControl) -DEFFN(CSGTStateRoom) -DEFFN(CSGTTV) -DEFFN(CSGTUpperDoorsSound) -DEFFN(CToilet) -DEFFN(CVase) -DEFFN(CWashstand) +DEFFN(CAnnounce); +DEFFN(CAnnoyBarbot); +DEFFN(CArbBackground); +DEFFN(CArboretumGate); +DEFFN(CAutoAnimate); +DEFFN(CBarBell); +DEFFN(CBarMenu); +DEFFN(CBarMenuButton); +DEFFN(CBelbotGetLight); +DEFFN(CBilgeSuccUBus); +DEFFN(CBomb); +DEFFN(CBottomOfWellMonitor); +DEFFN(CBowlUnlocker); +DEFFN(CBrainSlot); +DEFFN(CBridgeDoor); +DEFFN(CBridgeView); +DEFFN(CBrokenPellBase); +DEFFN(CBrokenPellerator); +DEFFN(CBrokenPelleratorFroz); +DEFFN(CCage); +DEFFN(CCallPellerator); +DEFFN(CCaptainsWheel); +DEFFN(CCDROM); +DEFFN(CCDROMComputer); +DEFFN(CCDROMTray); +DEFFN(CCellPointButton); +DEFFN(CChevCode); +DEFFN(CChevPanel); +DEFFN(CChickenCooler); +DEFFN(CChickenDispensor); +DEFFN(CCloseBrokenPel); +DEFFN(CodeWheel); +DEFFN(CComputer); +DEFFN(CComputerScreen); +DEFFN(CCookie); +DEFFN(CCredits); +DEFFN(CCreditsButton); +DEFFN(CDeadArea); +DEFFN(CDeskClickResponder); +DEFFN(CDoorbotElevatorHandler); +DEFFN(CDoorbotHomeHandler); +DEFFN(CEarSweetBowl); +DEFFN(CEjectPhonographButton); +DEFFN(CElevatorActionArea); +DEFFN(CEmmaControl); +DEFFN(CEmptyNutBowl); +DEFFN(CEndCreditText); +DEFFN(CEndCredits); +DEFFN(CEndExplodeShip); +DEFFN(CEndGameCredits); +DEFFN(CEndSequenceControl); +DEFFN(CFan); +DEFFN(CFanControl); +DEFFN(CFanDecrease); +DEFFN(CFanIncrease); +DEFFN(CFanNoises); +DEFFN(CFloorIndicator); +DEFFN(CGamesConsole); +DEFFN(CGetLiftEye2); +DEFFN(CGlassSmasher); +DEFFN(CHammerClip); +DEFFN(CHammerDispensor); +DEFFN(CHammerDispensorButton); +DEFFN(CHeadSlot); +DEFFN(CHeadSmashEvent); +DEFFN(CHeadSmashLever); +DEFFN(CHeadSpinner); +DEFFN(CIdleSummoner); +DEFFN(CLeaveSecClassState); +DEFFN(CLemonDispensor); +DEFFN(CLight); +DEFFN(CLightSwitch); +DEFFN(CLittleLiftButton); +DEFFN(CLongStickDispenser); +DEFFN(CMissiveOMat); +DEFFN(CMissiveOMatButton); +DEFFN(CMovieTester); +DEFFN(CMusicalInstrument); +DEFFN(CMusicConsoleButton); +DEFFN(CMusicRoomPhonograph); +DEFFN(CMusicRoomStopPhonographButton); +DEFFN(CMusicSystemLock); +DEFFN(CNavHelmet); +DEFFN(CNavigationComputer); +DEFFN(CNoNutBowl); +DEFFN(CNoseHolder); +DEFFN(CNullPortHole); +DEFFN(CNutReplacer); +DEFFN(CPetDisabler); +DEFFN(CPhonograph); +DEFFN(CPhonographLid); +DEFFN(CPlayMusicButton); +DEFFN(CPlayOnAct); +DEFFN(CPortHole); +DEFFN(CRecordPhonographButton); +DEFFN(CReplacementEar); +DEFFN(CReservedTable); +DEFFN(CRestaurantCylinderHolder); +DEFFN(CRestaurantPhonograph); +DEFFN(CSauceDispensor); +DEFFN(CSearchPoint); +DEFFN(CSeasonBackground); +DEFFN(CSeasonBarrel); +DEFFN(CSeasonalAdjustment); +DEFFN(CServiceElevatorWindow); +DEFFN(CShipSetting); +DEFFN(CShipSettingButton); +DEFFN(CShowCellpoints); +DEFFN(CSpeechDispensor); +DEFFN(CSplashAnimation); +DEFFN(CStarlingPuret); +DEFFN(CStartAction); +DEFFN(CStopPhonographButton); +DEFFN(CSUBGlass); +DEFFN(CSUBWrapper); +DEFFN(CSweetBowl); +DEFFN(CTelevision); +DEFFN(CThirdClassCanal); +DEFFN(CThrowTVDownWell); +DEFFN(CTitaniaStillControl); +DEFFN(CTOWParrotNav); +DEFFN(CUpLighter); +DEFFN(CUselessLever); +DEFFN(CVolumeControl); +DEFFN(CWheelButton); +DEFFN(CWheelHotSpot); +DEFFN(CWheelSpin); +DEFFN(CWheelSpinHorn); +DEFFN(CGondolierBase); +DEFFN(CGondolierChest); +DEFFN(CGondolierFace); +DEFFN(CGondolierMixer); +DEFFN(CGondolierSlider); +DEFFN(CMaitreDArmHolder); +DEFFN(CMaitreDBody); +DEFFN(CMaitreDLegs); +DEFFN(CMaitreDProdReceptor); +DEFFN(CParrotLobbyController); +DEFFN(CParrotLobbyLinkUpdater); +DEFFN(CParrotLobbyObject); +DEFFN(CParrotLobbyViewObject); +DEFFN(CParrotLoser); +DEFFN(CParrotNutBowlActor); +DEFFN(CParrotNutEater); +DEFFN(CParrotPerchHolder); +DEFFN(CParrotSuccUBus); +DEFFN(CParrotTrigger); +DEFFN(CPlayerMeetsParrot); +DEFFN(CPET); +DEFFN(CPETClass1); +DEFFN(CPETClass2); +DEFFN(CPETClass3); +DEFFN(CPetControl); +DEFFN(CPetDragChev); +DEFFN(CPetGraphic); +DEFFN(CPetGraphic2); +DEFFN(PETLeaf); +DEFFN(CPETLift); +DEFFN(CPETMonitor); +DEFFN(CPETPellerator); +DEFFN(CPETPosition); +DEFFN(CPETSentinal); +DEFFN(CPETSounds); +DEFFN(CPETTransition); +DEFFN(CPETTransport); +DEFFN(CPickUp); +DEFFN(CPickUpBarGlass); +DEFFN(CPickUpHose); +DEFFN(CPickUpLemon); +DEFFN(CPickUpSpeechCentre); +DEFFN(CPickUpVisCentre); +DEFFN(CBarShelfVisCentre); +DEFFN(CLemonOnBar); +DEFFN(CPlaceHolderItem); +DEFFN(CTVOnBar); +DEFFN(CArmchair); +DEFFN(CBasin); +DEFFN(CBedfoot); +DEFFN(CBedhead); +DEFFN(CChestOfDrawers); +DEFFN(CDesk); +DEFFN(CDeskchair); +DEFFN(CDrawer); +DEFFN(CSGTDoors); +DEFFN(SGTNav); +DEFFN(CSGTNavigation); +DEFFN(CSGTRestaurantDoors); +DEFFN(CSGTStateControl); +DEFFN(CSGTStateRoom); +DEFFN(CSGTTV); +DEFFN(CSGTUpperDoorsSound); +DEFFN(CToilet); +DEFFN(CVase); +DEFFN(CWashstand); -DEFFN(CGondolier) -DEFFN(CLift) -DEFFN(CLiftindicator) -DEFFN(CPellerator) -DEFFN(CServiceElevator) -DEFFN(CTransport) +DEFFN(CGondolier); +DEFFN(CLift); +DEFFN(CLiftindicator); +DEFFN(CPellerator); +DEFFN(CServiceElevator); +DEFFN(CTransport); -DEFFN(CActButton) -DEFFN(CChangesSeasonButton) -DEFFN(CChevLeftOff) -DEFFN(CChevLeftOn) -DEFFN(CChevRightOff) -DEFFN(CChevRightOn) -DEFFN(CChevSendRecSwitch) -DEFFN(CChevSwitch) -DEFFN(CEditControl) -DEFFN(CElevatorButton) -DEFFN(CGetFromSucc) -DEFFN(CHelmetOnOff) -DEFFN(CHomePhoto) -DEFFN(CIconNavAction) -DEFFN(CIconNavButt) -DEFFN(CIconNavDown) -DEFFN(CIconNavImage) -DEFFN(CIconNavLeft) -DEFFN(CIconNavReceive) -DEFFN(CIconNavRight) -DEFFN(CIconNavSend) -DEFFN(CIconNavUp) -DEFFN(CKeybrdButt) -DEFFN(CMoveObjectButton) -DEFFN(CMusicControl) -DEFFN(CMusicSlider) -DEFFN(CMusicSliderPitch) -DEFFN(CMusicSliderSpeed) -DEFFN(CMusicSwitch) -DEFFN(CMusicSwitchInversion) -DEFFN(CMusicSwitchReverse) -DEFFN(CMusicVoiceMute) -DEFFN(CPetModeOff) -DEFFN(CPetModeOn) -DEFFN(CPetModePanel) -DEFFN(CPetPannel1) -DEFFN(CPetPannel2) -DEFFN(CPetPannel3) -DEFFN(CSendToSucc) -DEFFN(CSGTSelector) -DEFFN(CSliderButton) -DEFFN(CSmallChevLeftOff) -DEFFN(CSmallChevLeftOn) -DEFFN(CSmallChevRightOff) -DEFFN(CSmallChevRightOn) -DEFFN(CStatusChangeButton) -DEFFN(CSTButton) -DEFFN(CTextDown) -DEFFN(CTextSkrew) -DEFFN(CTextUp) -DEFFN(CToggleButton) -DEFFN(CToggleSwitch) +DEFFN(CActButton); +DEFFN(CChangesSeasonButton); +DEFFN(CChevLeftOff); +DEFFN(CChevLeftOn); +DEFFN(CChevRightOff); +DEFFN(CChevRightOn); +DEFFN(CChevSendRecSwitch); +DEFFN(CChevSwitch); +DEFFN(CEditControl); +DEFFN(CElevatorButton); +DEFFN(CGetFromSucc); +DEFFN(CHelmetOnOff); +DEFFN(CHomePhoto); +DEFFN(CIconNavAction); +DEFFN(CIconNavButt); +DEFFN(CIconNavDown); +DEFFN(CIconNavImage); +DEFFN(CIconNavLeft); +DEFFN(CIconNavReceive); +DEFFN(CIconNavRight); +DEFFN(CIconNavSend); +DEFFN(CIconNavUp); +DEFFN(CKeybrdButt); +DEFFN(CMoveObjectButton); +DEFFN(CMusicControl); +DEFFN(CMusicSlider); +DEFFN(CMusicSliderPitch); +DEFFN(CMusicSliderSpeed); +DEFFN(CMusicSwitch); +DEFFN(CMusicSwitchInversion); +DEFFN(CMusicSwitchReverse); +DEFFN(CMusicVoiceMute); +DEFFN(CPetModeOff); +DEFFN(CPetModeOn); +DEFFN(CPetModePanel); +DEFFN(CPetPannel1); +DEFFN(CPetPannel2); +DEFFN(CPetPannel3); +DEFFN(CSendToSucc); +DEFFN(CSGTSelector); +DEFFN(CSliderButton); +DEFFN(CSmallChevLeftOff); +DEFFN(CSmallChevLeftOn); +DEFFN(CSmallChevRightOff); +DEFFN(CSmallChevRightOn); +DEFFN(CStatusChangeButton); +DEFFN(CSTButton); +DEFFN(CTextDown); +DEFFN(CTextSkrew); +DEFFN(CTextUp); +DEFFN(CToggleButton); +DEFFN(CToggleSwitch); -DEFFN(CActMsg) -DEFFN(CActivationmsg) -DEFFN(CAddHeadPieceMsg) -DEFFN(CAnimateMaitreDMsg) -DEFFN(CArboretumGateMsg) -DEFFN(CArmPickedUpFromTableMsg) -DEFFN(CAutoSoundEvent) -DEFFN(CBilgeAutoSoundEvent) -DEFFN(CBilgeDispensorEvent) -DEFFN(CBodyInBilgeRoomMsg) -DEFFN(CBowlStateChange) -DEFFN(CCarryObjectArrivedMsg) -DEFFN(CChangeMusicMsg) -DEFFN(CChangeSeasonMsg) -DEFFN(CCheckAllPossibleCodes) -DEFFN(CCheckChevCode) -DEFFN(CChildDragEndMsg) -DEFFN(CChildDragMoveMsg) -DEFFN(CChildDragStartMsg) -DEFFN(CClearChevPanelBits) -DEFFN(CCorrectMusicPlayedMsg) -DEFFN(CCreateMusicPlayerMsg) -DEFFN(CCylinderHolderReadyMsg) -DEFFN(CDeactivationMsg) -DEFFN(CDeliverCCarryMsg) -DEFFN(CDisableMaitreDProdReceptor) -DEFFN(CDismissBotMsg) -DEFFN(CDoffNavHelmet) -DEFFN(CDonNavHelmet) -DEFFN(CDoorAutoSoundEvent) -DEFFN(CDoorbotNeededInElevatorMsg) -DEFFN(CDoorbotNeededInHomeMsg) -DEFFN(CDropObjectMsg) -DEFFN(CDropZoneGotObjectMsg) -DEFFN(CDropZoneLostObjectMsg) -DEFFN(CEditControlMsg) -DEFFN(CEnterNodeMsg) -DEFFN(CEnterRoomMsg) -DEFFN(CEnterViewMsg) -DEFFN(CEjectCylinderMsg) -DEFFN(CErasePhonographCylinderMsg) -DEFFN(CFrameMsg) -DEFFN(CFreshenCookieMsg) -DEFFN(CGetChevClassBits) -DEFFN(CGetChevClassNum) -DEFFN(CGetChevCodeFromRoomNameMsg) -DEFFN(CGetChevFloorBits) -DEFFN(CGetChevFloorNum) -DEFFN(CGetChevLiftBits) -DEFFN(CGetChevLiftNum) -DEFFN(CGetChevRoomBits) -DEFFN(CGetChevRoomNum) -DEFFN(CHoseConnectedMsg) -DEFFN(CInitializeAnimMsg) -DEFFN(CIsEarBowlPuzzleDone) -DEFFN(CIsHookedOnMsg) -DEFFN(CIsParrotPresentMsg) -DEFFN(CKeyCharMsg) -DEFFN(CLeaveNodeMsg) -DEFFN(CLeaveRoomMsg) -DEFFN(CLeaveViewMsg) -DEFFN(CLemonFallsFromTreeMsg) -DEFFN(CLightsMsg) -DEFFN(CLoadSuccessMsg) -DEFFN(CLockPhonographMsg) -DEFFN(CMaitreDDefeatedMsg) -DEFFN(CMaitreDHappyMsg) -DEFFN(CMessage) -DEFFN(CMissiveOMatActionMsg) -DEFFN(CMouseMsg) -DEFFN(CMouseMoveMsg) -DEFFN(CMouseButtonMsg) -DEFFN(CMouseButtonDownMsg) -DEFFN(CMouseButtonUpMsg) -DEFFN(CMouseDoubleClickMsg) -DEFFN(CMouseDragMsg) -DEFFN(CMouseDragStartMsg) -DEFFN(CMouseDragMoveMsg) -DEFFN(CMouseDragEndMsg) -DEFFN(CMoveToStartPosMsg) -DEFFN(CMovieEndMsg) -DEFFN(CMovieFrameMsg) -DEFFN(CMusicHasStartedMsg) -DEFFN(CMusicHasStoppedMsg) -DEFFN(CMusicSettingChangedMsg) -DEFFN(CNPCPlayAnimationMsg) -DEFFN(CNPCPlayIdleAnimationMsg) -DEFFN(CNPCPlayTalkingAnimationMsg) -DEFFN(CNPCQueueIdleAnimMsg) -DEFFN(CNutPuzzleMsg) -DEFFN(COnSummonBotMsg) -DEFFN(COpeningCreditsMsg) -DEFFN(CPETDeliverMsg) -DEFFN(CPETGainedObjectMsg) -DEFFN(CPETHelmetOnOffMsg) -DEFFN(CPETKeyboardOnOffMsg) -DEFFN(CPETLostObjectMsg) -DEFFN(CPETObjectSelectedMsg) -DEFFN(CPETObjectStateMsg) -DEFFN(CPETPhotoOnOffMsg) -DEFFN(CPETPlaySoundMsg) -DEFFN(CPETReceiveMsg) -DEFFN(CPETSetStarDestinationMsg) -DEFFN(CPETStarFieldLockMsg) -DEFFN(CPETStereoFieldOnOffMsg) -DEFFN(CPETTargetMsg) -DEFFN(CPETUpMsg) -DEFFN(CPETDownMsg) -DEFFN(CPETLeftMsg) -DEFFN(CPETRightMsg) -DEFFN(CPETActivateMsg) -DEFFN(CPanningAwayFromParrotMsg) -DEFFN(CParrotSpeakMsg) -DEFFN(CParrotTriesChickenMsg) -DEFFN(CPassOnDragStartMsg) -DEFFN(CPhonographPlayMsg) -DEFFN(CPhonographReadyToPlayMsg) -DEFFN(CPhonographRecordMsg) -DEFFN(CPhonographStopMsg) -DEFFN(CPlayRangeMsg) -DEFFN(CPlayerTriesRestaurantTableMsg) -DEFFN(CPreEnterNodeMsg) -DEFFN(CPreEnterRoomMsg) -DEFFN(CPreEnterViewMsg) -DEFFN(CPreSaveMsg) -DEFFN(CProdMaitreDMsg) -DEFFN(CPumpingMsg) -DEFFN(CPutBotBackInHisBoxMsg) -DEFFN(CPutParrotBackMsg) -DEFFN(CPuzzleSolvedMsg) -DEFFN(CQueryCylinderHolderMsg) -DEFFN(CQueryCylinderMsg) -DEFFN(CQueryCylinderNameMsg) -DEFFN(CQueryCylinderTypeMsg) -DEFFN(CQueryMusicControlSettingMsg) -DEFFN(CQueryPhonographState) -DEFFN(CRecordOntoCylinderMsg) -DEFFN(CRemoveFromGameMsg) -DEFFN(CReplaceBowlAndNutsMsg) -DEFFN(CRestaurantMusicChanged) -DEFFN(CSendCCarryMsg) -DEFFN(CSenseWorkingMsg) -DEFFN(CServiceElevatorDoor) -DEFFN(CServiceElevatorFloorChangeMsg) -DEFFN(CServiceElevatorFloorRequestMsg) -DEFFN(CServiceElevatorMsg) -DEFFN(CSetChevButtonImageMsg) -DEFFN(CSetChevClassBits) -DEFFN(CSetChevFloorBits) -DEFFN(CSetChevLiftBits) -DEFFN(CSetChevPanelBitMsg) -DEFFN(CSetChevPanelButtonsMsg) -DEFFN(CSetChevRoomBits) -DEFFN(CSetFrameMsg) -DEFFN(CSetMusicControlsMsg) -DEFFN(CSetVarMsg) -DEFFN(CSetVolumeMsg) -DEFFN(CShipSettingMsg) -DEFFN(CShowTextMsg) -DEFFN(CSignalObject) -DEFFN(CSpeechFallsFromTreeMsg) -DEFFN(CStartMusicMsg) -DEFFN(CStatusChangeMsg) -DEFFN(CStopMusicMsg) -DEFFN(CSubAcceptCCarryMsg) -DEFFN(CSubDeliverCCarryMsg) -DEFFN(CSubSendCCarryMsg) -DEFFN(CSUBTransition) -DEFFN(CSubTurnOffMsg) -DEFFN(CSubTurnOnMsg) -DEFFN(CSummonBotMsg) -DEFFN(CSummonBotQueryMsg) -DEFFN(CTakeHeadPieceMsg) -DEFFN(CTextInputMsg) -DEFFN(CTimeDilationMsg) -DEFFN(CTimeMsg) -DEFFN(CTimerMsg) -DEFFN(CTitleSequenceEndedMsg) -DEFFN(CTransitMsg) -DEFFN(CTranslateObjectMsg) -DEFFN(CTransportMsg) -DEFFN(CTriggerAutoMusicPlayerMsg) -DEFFN(CTriggerNPCEvent) -DEFFN(CTrueTalkGetAnimSetMsg) -DEFFN(CTrueTalkGetAssetDetailsMsg) -DEFFN(CTrueTalkGetStateValueMsg) -DEFFN(CTrueTalkNotifySpeechEndedMsg) -DEFFN(CTrueTalkNotifySpeechStartedMsg) -DEFFN(CTrueTalkQueueUpAnimSetMsg) -DEFFN(CTrueTalkSelfQueueAnimSetMsg) -DEFFN(CTrueTalkTriggerActionMsg) -DEFFN(CTurnOff) -DEFFN(CTurnOn) -DEFFN(CUse) -DEFFN(CUseWithCharMsg) -DEFFN(CUseWithOtherMsg) -DEFFN(CVirtualKeyCharMsg) -DEFFN(CVisibleMsg) +DEFFN(CActMsg); +DEFFN(CActivationmsg); +DEFFN(CAddHeadPieceMsg); +DEFFN(CAnimateMaitreDMsg); +DEFFN(CArboretumGateMsg); +DEFFN(CArmPickedUpFromTableMsg); +DEFFN(CAutoSoundEvent); +DEFFN(CBilgeAutoSoundEvent); +DEFFN(CBilgeDispensorEvent); +DEFFN(CBodyInBilgeRoomMsg); +DEFFN(CBowlStateChange); +DEFFN(CCarryObjectArrivedMsg); +DEFFN(CChangeMusicMsg); +DEFFN(CChangeSeasonMsg); +DEFFN(CCheckAllPossibleCodes); +DEFFN(CCheckChevCode); +DEFFN(CChildDragEndMsg); +DEFFN(CChildDragMoveMsg); +DEFFN(CChildDragStartMsg); +DEFFN(CClearChevPanelBits); +DEFFN(CCorrectMusicPlayedMsg); +DEFFN(CCreateMusicPlayerMsg); +DEFFN(CCylinderHolderReadyMsg); +DEFFN(CDeactivationMsg); +DEFFN(CDeliverCCarryMsg); +DEFFN(CDisableMaitreDProdReceptor); +DEFFN(CDismissBotMsg); +DEFFN(CDoffNavHelmet); +DEFFN(CDonNavHelmet); +DEFFN(CDoorAutoSoundEvent); +DEFFN(CDoorbotNeededInElevatorMsg); +DEFFN(CDoorbotNeededInHomeMsg); +DEFFN(CDropObjectMsg); +DEFFN(CDropZoneGotObjectMsg); +DEFFN(CDropZoneLostObjectMsg); +DEFFN(CEditControlMsg); +DEFFN(CEnterNodeMsg); +DEFFN(CEnterRoomMsg); +DEFFN(CEnterViewMsg); +DEFFN(CEjectCylinderMsg); +DEFFN(CErasePhonographCylinderMsg); +DEFFN(CFrameMsg); +DEFFN(CFreshenCookieMsg); +DEFFN(CGetChevClassBits); +DEFFN(CGetChevClassNum); +DEFFN(CGetChevCodeFromRoomNameMsg); +DEFFN(CGetChevFloorBits); +DEFFN(CGetChevFloorNum); +DEFFN(CGetChevLiftBits); +DEFFN(CGetChevLiftNum); +DEFFN(CGetChevRoomBits); +DEFFN(CGetChevRoomNum); +DEFFN(CHoseConnectedMsg); +DEFFN(CInitializeAnimMsg); +DEFFN(CIsEarBowlPuzzleDone); +DEFFN(CIsHookedOnMsg); +DEFFN(CIsParrotPresentMsg); +DEFFN(CKeyCharMsg); +DEFFN(CLeaveNodeMsg); +DEFFN(CLeaveRoomMsg); +DEFFN(CLeaveViewMsg); +DEFFN(CLemonFallsFromTreeMsg); +DEFFN(CLightsMsg); +DEFFN(CLoadSuccessMsg); +DEFFN(CLockPhonographMsg); +DEFFN(CMaitreDDefeatedMsg); +DEFFN(CMaitreDHappyMsg); +DEFFN(CMessage); +DEFFN(CMissiveOMatActionMsg); +DEFFN(CMouseMsg); +DEFFN(CMouseMoveMsg); +DEFFN(CMouseButtonMsg); +DEFFN(CMouseButtonDownMsg); +DEFFN(CMouseButtonUpMsg); +DEFFN(CMouseDoubleClickMsg); +DEFFN(CMouseDragMsg); +DEFFN(CMouseDragStartMsg); +DEFFN(CMouseDragMoveMsg); +DEFFN(CMouseDragEndMsg); +DEFFN(CMoveToStartPosMsg); +DEFFN(CMovieEndMsg); +DEFFN(CMovieFrameMsg); +DEFFN(CMusicHasStartedMsg); +DEFFN(CMusicHasStoppedMsg); +DEFFN(CMusicSettingChangedMsg); +DEFFN(CNPCPlayAnimationMsg); +DEFFN(CNPCPlayIdleAnimationMsg); +DEFFN(CNPCPlayTalkingAnimationMsg); +DEFFN(CNPCQueueIdleAnimMsg); +DEFFN(CNutPuzzleMsg); +DEFFN(COnSummonBotMsg); +DEFFN(COpeningCreditsMsg); +DEFFN(CPETDeliverMsg); +DEFFN(CPETGainedObjectMsg); +DEFFN(CPETHelmetOnOffMsg); +DEFFN(CPETKeyboardOnOffMsg); +DEFFN(CPETLostObjectMsg); +DEFFN(CPETObjectSelectedMsg); +DEFFN(CPETObjectStateMsg); +DEFFN(CPETPhotoOnOffMsg); +DEFFN(CPETPlaySoundMsg); +DEFFN(CPETReceiveMsg); +DEFFN(CPETSetStarDestinationMsg); +DEFFN(CPETStarFieldLockMsg); +DEFFN(CPETStereoFieldOnOffMsg); +DEFFN(CPETTargetMsg); +DEFFN(CPETUpMsg); +DEFFN(CPETDownMsg); +DEFFN(CPETLeftMsg); +DEFFN(CPETRightMsg); +DEFFN(CPETActivateMsg); +DEFFN(CPanningAwayFromParrotMsg); +DEFFN(CParrotSpeakMsg); +DEFFN(CParrotTriesChickenMsg); +DEFFN(CPassOnDragStartMsg); +DEFFN(CPhonographPlayMsg); +DEFFN(CPhonographReadyToPlayMsg); +DEFFN(CPhonographRecordMsg); +DEFFN(CPhonographStopMsg); +DEFFN(CPlayRangeMsg); +DEFFN(CPlayerTriesRestaurantTableMsg); +DEFFN(CPreEnterNodeMsg); +DEFFN(CPreEnterRoomMsg); +DEFFN(CPreEnterViewMsg); +DEFFN(CPreSaveMsg); +DEFFN(CProdMaitreDMsg); +DEFFN(CPumpingMsg); +DEFFN(CPutBotBackInHisBoxMsg); +DEFFN(CPutParrotBackMsg); +DEFFN(CPuzzleSolvedMsg); +DEFFN(CQueryCylinderHolderMsg); +DEFFN(CQueryCylinderMsg); +DEFFN(CQueryCylinderNameMsg); +DEFFN(CQueryCylinderTypeMsg); +DEFFN(CQueryMusicControlSettingMsg); +DEFFN(CQueryPhonographState); +DEFFN(CRecordOntoCylinderMsg); +DEFFN(CRemoveFromGameMsg); +DEFFN(CReplaceBowlAndNutsMsg); +DEFFN(CRestaurantMusicChanged); +DEFFN(CSendCCarryMsg); +DEFFN(CSenseWorkingMsg); +DEFFN(CServiceElevatorDoor); +DEFFN(CServiceElevatorFloorChangeMsg); +DEFFN(CServiceElevatorFloorRequestMsg); +DEFFN(CServiceElevatorMsg); +DEFFN(CSetChevButtonImageMsg); +DEFFN(CSetChevClassBits); +DEFFN(CSetChevFloorBits); +DEFFN(CSetChevLiftBits); +DEFFN(CSetChevPanelBitMsg); +DEFFN(CSetChevPanelButtonsMsg); +DEFFN(CSetChevRoomBits); +DEFFN(CSetFrameMsg); +DEFFN(CSetMusicControlsMsg); +DEFFN(CSetVarMsg); +DEFFN(CSetVolumeMsg); +DEFFN(CShipSettingMsg); +DEFFN(CShowTextMsg); +DEFFN(CSignalObject); +DEFFN(CSpeechFallsFromTreeMsg); +DEFFN(CStartMusicMsg); +DEFFN(CStatusChangeMsg); +DEFFN(CStopMusicMsg); +DEFFN(CSubAcceptCCarryMsg); +DEFFN(CSubDeliverCCarryMsg); +DEFFN(CSubSendCCarryMsg); +DEFFN(CSUBTransition); +DEFFN(CSubTurnOffMsg); +DEFFN(CSubTurnOnMsg); +DEFFN(CSummonBotMsg); +DEFFN(CSummonBotQueryMsg); +DEFFN(CTakeHeadPieceMsg); +DEFFN(CTextInputMsg); +DEFFN(CTimeDilationMsg); +DEFFN(CTimeMsg); +DEFFN(CTimerMsg); +DEFFN(CTitleSequenceEndedMsg); +DEFFN(CTransitMsg); +DEFFN(CTranslateObjectMsg); +DEFFN(CTransportMsg); +DEFFN(CTriggerAutoMusicPlayerMsg); +DEFFN(CTriggerNPCEvent); +DEFFN(CTrueTalkGetAnimSetMsg); +DEFFN(CTrueTalkGetAssetDetailsMsg); +DEFFN(CTrueTalkGetStateValueMsg); +DEFFN(CTrueTalkNotifySpeechEndedMsg); +DEFFN(CTrueTalkNotifySpeechStartedMsg); +DEFFN(CTrueTalkQueueUpAnimSetMsg); +DEFFN(CTrueTalkSelfQueueAnimSetMsg); +DEFFN(CTrueTalkTriggerActionMsg); +DEFFN(CTurnOff); +DEFFN(CTurnOn); +DEFFN(CUse); +DEFFN(CUseWithCharMsg); +DEFFN(CUseWithOtherMsg); +DEFFN(CVirtualKeyCharMsg); +DEFFN(CVisibleMsg); -DEFFN(CEnterBombRoom) -DEFFN(CEnterBridge) -DEFFN(CEnterExitFirstClassState) -DEFFN(CEnterExitMiniLift) -DEFFN(CEnterExitSecClassMiniLift) -DEFFN(CEnterExitView) -DEFFN(CEnterSecClassState) -DEFFN(CExitArboretum) -DEFFN(CExitBridge) -DEFFN(CExitLift) -DEFFN(CExitPellerator) -DEFFN(CExitStateRoom) -DEFFN(CExitTiania) -DEFFN(CMovePlayerInParrotRoom) -DEFFN(CMovePlayerTo) -DEFFN(CMovePlayerToFrom) -DEFFN(CMultiMove) -DEFFN(CPanFromPel) -DEFFN(CRestaurantPanHandler) -DEFFN(CScraliontisTable) -DEFFN(CRestrictedMove) -DEFFN(CTripDownCanal) +DEFFN(CEnterBombRoom); +DEFFN(CEnterBridge); +DEFFN(CEnterExitFirstClassState); +DEFFN(CEnterExitMiniLift); +DEFFN(CEnterExitSecClassMiniLift); +DEFFN(CEnterExitView); +DEFFN(CEnterSecClassState); +DEFFN(CExitArboretum); +DEFFN(CExitBridge); +DEFFN(CExitLift); +DEFFN(CExitPellerator); +DEFFN(CExitStateRoom); +DEFFN(CExitTiania); +DEFFN(CMovePlayerInParrotRoom); +DEFFN(CMovePlayerTo); +DEFFN(CMovePlayerToFrom); +DEFFN(CMultiMove); +DEFFN(CPanFromPel); +DEFFN(CRestaurantPanHandler); +DEFFN(CScraliontisTable); +DEFFN(CRestrictedMove); +DEFFN(CTripDownCanal); -DEFFN(CBarbot) -DEFFN(CBellBot) -DEFFN(CCallBot) -DEFFN(CCharacter) -DEFFN(CDeskbot) -DEFFN(CDoorbot) -DEFFN(CLiftBot) -DEFFN(CMaitreD) -DEFFN(CMobile) -DEFFN(CParrot) -DEFFN(CRobotController) -DEFFN(CStarlings) -DEFFN(CSummonBots) -DEFFN(CSuccUBus) -DEFFN(CTitania) -DEFFN(CTrueTalkNPC) -DEFFN(CAutoMusicPlayer) -DEFFN(CAutoMusicPlayerBase) -DEFFN(CAutoSoundPlayer) -DEFFN(CAutoSoundPlayerADSR) -DEFFN(CBackgroundSoundMaker) -DEFFN(CBirdSong) -DEFFN(CDomeFromTopOfWell) -DEFFN(CEnterViewTogglesOtherMusic) -DEFFN(CGondolierSong) -DEFFN(CMusicPlayer) -DEFFN(CNodeAutoSoundPlayer) -DEFFN(CRestrictedAutoMusicPlayer) -DEFFN(CRoomAutoSoundPlayer) -DEFFN(CRoomTriggerAutoMusicPlayer) -DEFFN(CSeasonNoises) -DEFFN(CSeasonalMusicPlayer) -DEFFN(CTitaniaSpeech) -DEFFN(CTriggerAutoMusicPlayer) -DEFFN(CViewAutoSoundPlayer) -DEFFN(CViewTogglesOtherMusic) -DEFFN(CWaterLappingSounds) -DEFFN(CStarControl) -DEFFN(CTimeEventInfo) +DEFFN(CBarbot); +DEFFN(CBellBot); +DEFFN(CCallBot); +DEFFN(CCharacter); +DEFFN(CDeskbot); +DEFFN(CDoorbot); +DEFFN(CLiftBot); +DEFFN(CMaitreD); +DEFFN(CMobile); +DEFFN(CParrot); +DEFFN(CRobotController); +DEFFN(CStarlings); +DEFFN(CSummonBots); +DEFFN(CSuccUBus); +DEFFN(CTitania); +DEFFN(CTrueTalkNPC); +DEFFN(CAutoMusicPlayer); +DEFFN(CAutoMusicPlayerBase); +DEFFN(CAutoSoundPlayer); +DEFFN(CAutoSoundPlayerADSR); +DEFFN(CBackgroundSoundMaker); +DEFFN(CBirdSong); +DEFFN(CDomeFromTopOfWell); +DEFFN(CEnterViewTogglesOtherMusic); +DEFFN(CGondolierSong); +DEFFN(CMusicPlayer); +DEFFN(CNodeAutoSoundPlayer); +DEFFN(CRestrictedAutoMusicPlayer); +DEFFN(CRoomAutoSoundPlayer); +DEFFN(CRoomTriggerAutoMusicPlayer); +DEFFN(CSeasonNoises); +DEFFN(CSeasonalMusicPlayer); +DEFFN(CTitaniaSpeech); +DEFFN(CTriggerAutoMusicPlayer); +DEFFN(CViewAutoSoundPlayer); +DEFFN(CViewTogglesOtherMusic); +DEFFN(CWaterLappingSounds); +DEFFN(CStarControl); +DEFFN(CTimeEventInfo); void CSaveableObject::initClassList() { _classDefs = new Common::List(); -- cgit v1.2.3 From eb98b984fb5a630422013ab5f030d49b0aa39552 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 Jul 2016 20:11:49 -0400 Subject: TITANIC: Add semicolon after EMPTY_MESSAGE_MAP macro usages --- engines/titanic/carry/feathers.cpp | 2 +- engines/titanic/carry/hose_end.cpp | 2 +- engines/titanic/carry/parcel.cpp | 2 +- engines/titanic/core/dont_save_file_item.cpp | 2 +- engines/titanic/core/file_item.cpp | 2 +- engines/titanic/core/game_object.cpp | 2 +- engines/titanic/core/link_item.cpp | 2 +- engines/titanic/core/message_target.h | 3 ++- engines/titanic/core/named_item.cpp | 2 +- engines/titanic/core/node_item.cpp | 2 +- engines/titanic/core/project_item.cpp | 2 +- engines/titanic/core/room_item.cpp | 2 +- engines/titanic/core/static_image.cpp | 2 +- engines/titanic/core/tree_item.cpp | 2 +- engines/titanic/game/arb_background.cpp | 2 +- engines/titanic/game/broken_pell_base.cpp | 2 +- engines/titanic/game/leave_sec_class_state.cpp | 2 +- engines/titanic/game/music_room_phonograph.cpp | 2 +- engines/titanic/game/musical_instrument.cpp | 2 +- engines/titanic/game/navigation_computer.cpp | 2 +- engines/titanic/game/null_port_hole.cpp | 2 +- engines/titanic/game/parrot/parrot_lobby_object.cpp | 2 +- engines/titanic/game/pet/pet_class1.cpp | 2 +- engines/titanic/game/pet/pet_class2.cpp | 2 +- engines/titanic/game/pet/pet_class3.cpp | 2 +- engines/titanic/game/splash_animation.cpp | 2 +- engines/titanic/game/transport/transport.cpp | 2 +- engines/titanic/gfx/chev_left_off.cpp | 2 +- engines/titanic/gfx/chev_left_on.cpp | 2 +- engines/titanic/gfx/chev_right_off.cpp | 2 +- engines/titanic/gfx/chev_right_on.cpp | 2 +- engines/titanic/gfx/chev_send_rec_switch.cpp | 2 +- engines/titanic/gfx/elevator_button.cpp | 2 +- engines/titanic/gfx/get_from_succ.cpp | 2 +- engines/titanic/gfx/helmet_on_off.cpp | 2 +- engines/titanic/gfx/home_photo.cpp | 2 +- engines/titanic/gfx/icon_nav_action.cpp | 2 +- engines/titanic/gfx/icon_nav_butt.cpp | 2 +- engines/titanic/gfx/icon_nav_down.cpp | 2 +- engines/titanic/gfx/icon_nav_image.cpp | 2 +- engines/titanic/gfx/icon_nav_left.cpp | 2 +- engines/titanic/gfx/icon_nav_receive.cpp | 2 +- engines/titanic/gfx/icon_nav_right.cpp | 2 +- engines/titanic/gfx/icon_nav_send.cpp | 2 +- engines/titanic/gfx/icon_nav_up.cpp | 2 +- engines/titanic/gfx/keybrd_butt.cpp | 2 +- engines/titanic/gfx/music_slider.cpp | 2 +- engines/titanic/gfx/music_switch.cpp | 2 +- engines/titanic/gfx/send_to_succ.cpp | 2 +- engines/titanic/gfx/sgt_selector.cpp | 2 +- engines/titanic/gfx/small_chev_left_off.cpp | 2 +- engines/titanic/gfx/small_chev_left_on.cpp | 2 +- engines/titanic/gfx/small_chev_right_off.cpp | 2 +- engines/titanic/gfx/small_chev_right_on.cpp | 2 +- engines/titanic/gfx/text_down.cpp | 2 +- engines/titanic/gfx/text_skrew.cpp | 2 +- engines/titanic/gfx/text_up.cpp | 2 +- engines/titanic/gfx/toggle_button.cpp | 2 +- engines/titanic/npcs/mobile.cpp | 2 +- engines/titanic/pet_control/pet_graphic.cpp | 2 +- engines/titanic/pet_control/pet_graphic2.cpp | 2 +- engines/titanic/pet_control/pet_leaf.cpp | 2 +- engines/titanic/pet_control/pet_mode_off.cpp | 2 +- engines/titanic/pet_control/pet_mode_on.cpp | 2 +- engines/titanic/pet_control/pet_mode_panel.cpp | 2 +- engines/titanic/pet_control/pet_pannel1.cpp | 2 +- engines/titanic/pet_control/pet_pannel2.cpp | 2 +- engines/titanic/pet_control/pet_pannel3.cpp | 2 +- engines/titanic/sound/dome_from_top_of_well.cpp | 2 +- engines/titanic/sound/water_lapping_sounds.cpp | 2 +- 70 files changed, 71 insertions(+), 70 deletions(-) diff --git a/engines/titanic/carry/feathers.cpp b/engines/titanic/carry/feathers.cpp index c2cf369bd8..a5d2babfb1 100644 --- a/engines/titanic/carry/feathers.cpp +++ b/engines/titanic/carry/feathers.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CFeathers, CCarry) +EMPTY_MESSAGE_MAP(CFeathers, CCarry); CFeathers::CFeathers() : CCarry() { } diff --git a/engines/titanic/carry/hose_end.cpp b/engines/titanic/carry/hose_end.cpp index f6097c4db7..c9996437bb 100644 --- a/engines/titanic/carry/hose_end.cpp +++ b/engines/titanic/carry/hose_end.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CHoseEnd, CHose) +EMPTY_MESSAGE_MAP(CHoseEnd, CHose); CHoseEnd::CHoseEnd() : CHose() { _string6 = "Connection refused by remote hose."; diff --git a/engines/titanic/carry/parcel.cpp b/engines/titanic/carry/parcel.cpp index 13e2f6dec4..2ffe8b0aac 100644 --- a/engines/titanic/carry/parcel.cpp +++ b/engines/titanic/carry/parcel.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CParcel, CCarry) +EMPTY_MESSAGE_MAP(CParcel, CCarry); CParcel::CParcel() : CCarry() { } diff --git a/engines/titanic/core/dont_save_file_item.cpp b/engines/titanic/core/dont_save_file_item.cpp index 87ab77e78b..b8864bb2b5 100644 --- a/engines/titanic/core/dont_save_file_item.cpp +++ b/engines/titanic/core/dont_save_file_item.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CDontSaveFileItem, CFileItem) +EMPTY_MESSAGE_MAP(CDontSaveFileItem, CFileItem); void CDontSaveFileItem::save(SimpleFile *file, int indent) { file->writeNumberLine(0, indent); diff --git a/engines/titanic/core/file_item.cpp b/engines/titanic/core/file_item.cpp index 824195d97c..b783c758df 100644 --- a/engines/titanic/core/file_item.cpp +++ b/engines/titanic/core/file_item.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CFileItem, CTreeItem) +EMPTY_MESSAGE_MAP(CFileItem, CTreeItem); void CFileItem::save(SimpleFile *file, int indent) { file->writeNumberLine(0, indent); diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index af4ffab1e3..39e4f8412e 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -35,7 +35,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CGameObject, CNamedItem) +EMPTY_MESSAGE_MAP(CGameObject, CNamedItem); CCreditText *CGameObject::_credits; diff --git a/engines/titanic/core/link_item.cpp b/engines/titanic/core/link_item.cpp index 5de0d4cdeb..110218401a 100644 --- a/engines/titanic/core/link_item.cpp +++ b/engines/titanic/core/link_item.cpp @@ -27,7 +27,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CLinkItem, CNamedItem) +EMPTY_MESSAGE_MAP(CLinkItem, CNamedItem); CLinkItem::CLinkItem() : CNamedItem() { _roomNumber = -1; diff --git a/engines/titanic/core/message_target.h b/engines/titanic/core/message_target.h index 5508c47c95..cfd7ac14e7 100644 --- a/engines/titanic/core/message_target.h +++ b/engines/titanic/core/message_target.h @@ -80,7 +80,8 @@ protected: \ static const MSGMAP messageMap = \ { &TheBaseClass::getThisMessageMap, &_messageEntries[0] }; \ return &messageMap; \ - } + } \ + static const int DUMMY class CMessageTarget: public CSaveableObject { DECLARE_MESSAGE_MAP diff --git a/engines/titanic/core/named_item.cpp b/engines/titanic/core/named_item.cpp index 2b741f7657..6eafbf8c8b 100644 --- a/engines/titanic/core/named_item.cpp +++ b/engines/titanic/core/named_item.cpp @@ -27,7 +27,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CNamedItem, CTreeItem) +EMPTY_MESSAGE_MAP(CNamedItem, CTreeItem); CString CNamedItem::dumpItem(int indent) const { CString result = CTreeItem::dumpItem(indent); diff --git a/engines/titanic/core/node_item.cpp b/engines/titanic/core/node_item.cpp index 79188dd385..1de065a49d 100644 --- a/engines/titanic/core/node_item.cpp +++ b/engines/titanic/core/node_item.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CNodeItem, CNamedItem) +EMPTY_MESSAGE_MAP(CNodeItem, CNamedItem); CNodeItem::CNodeItem() : CNamedItem(), _nodeNumber(0) { } diff --git a/engines/titanic/core/project_item.cpp b/engines/titanic/core/project_item.cpp index 4fd2ea2f5c..76293233b0 100644 --- a/engines/titanic/core/project_item.cpp +++ b/engines/titanic/core/project_item.cpp @@ -41,7 +41,7 @@ namespace Titanic { static const char *const SAVEGAME_STR = "TNIC"; #define SAVEGAME_STR_SIZE 4 -EMPTY_MESSAGE_MAP(CProjectItem, CFileItem) +EMPTY_MESSAGE_MAP(CProjectItem, CFileItem); void CFileListItem::save(SimpleFile *file, int indent) { file->writeNumberLine(0, indent); diff --git a/engines/titanic/core/room_item.cpp b/engines/titanic/core/room_item.cpp index a88238d94d..541a8e1a9e 100644 --- a/engines/titanic/core/room_item.cpp +++ b/engines/titanic/core/room_item.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CRoomItem, CNamedItem) +EMPTY_MESSAGE_MAP(CRoomItem, CNamedItem); CRoomItem::CRoomItem() : CNamedItem(), _roomNumber(0), _roomDimensionX(0.0), _roomDimensionY(0.0) { diff --git a/engines/titanic/core/static_image.cpp b/engines/titanic/core/static_image.cpp index 67286108d8..977009e750 100644 --- a/engines/titanic/core/static_image.cpp +++ b/engines/titanic/core/static_image.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CStaticImage, CGameObject) +EMPTY_MESSAGE_MAP(CStaticImage, CGameObject); void CStaticImage::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); diff --git a/engines/titanic/core/tree_item.cpp b/engines/titanic/core/tree_item.cpp index 5fcd74bbd7..6adbbe39fa 100644 --- a/engines/titanic/core/tree_item.cpp +++ b/engines/titanic/core/tree_item.cpp @@ -38,7 +38,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CTreeItem, CMessageTarget) +EMPTY_MESSAGE_MAP(CTreeItem, CMessageTarget); CTreeItem::CTreeItem() : _parent(nullptr), _firstChild(nullptr), _nextSibling(nullptr), _priorSibling(nullptr), _field14(0) { diff --git a/engines/titanic/game/arb_background.cpp b/engines/titanic/game/arb_background.cpp index b86ecb1d85..f71bcf90d1 100644 --- a/engines/titanic/game/arb_background.cpp +++ b/engines/titanic/game/arb_background.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CArbBackground, CBackground) +EMPTY_MESSAGE_MAP(CArbBackground, CBackground); CArbBackground::CArbBackground() : CBackground(), _fieldE0(0), _fieldE4(61), _fieldE8(62), _fieldEC(118) { diff --git a/engines/titanic/game/broken_pell_base.cpp b/engines/titanic/game/broken_pell_base.cpp index 77d3aee625..59e2b9bca1 100644 --- a/engines/titanic/game/broken_pell_base.cpp +++ b/engines/titanic/game/broken_pell_base.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CBrokenPellBase, CBackground) +EMPTY_MESSAGE_MAP(CBrokenPellBase, CBackground); int CBrokenPellBase::_v1; int CBrokenPellBase::_v2; diff --git a/engines/titanic/game/leave_sec_class_state.cpp b/engines/titanic/game/leave_sec_class_state.cpp index 014306220c..3e23e3ad1c 100644 --- a/engines/titanic/game/leave_sec_class_state.cpp +++ b/engines/titanic/game/leave_sec_class_state.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CLeaveSecClassState, CGameObject) +EMPTY_MESSAGE_MAP(CLeaveSecClassState, CGameObject); void CLeaveSecClassState::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); diff --git a/engines/titanic/game/music_room_phonograph.cpp b/engines/titanic/game/music_room_phonograph.cpp index 2fceca2e2f..06a35dc4d5 100644 --- a/engines/titanic/game/music_room_phonograph.cpp +++ b/engines/titanic/game/music_room_phonograph.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CMusicRoomPhonograph, CRestaurantPhonograph) +EMPTY_MESSAGE_MAP(CMusicRoomPhonograph, CRestaurantPhonograph); void CMusicRoomPhonograph::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); diff --git a/engines/titanic/game/musical_instrument.cpp b/engines/titanic/game/musical_instrument.cpp index aea58b4472..3bd2e37ccc 100644 --- a/engines/titanic/game/musical_instrument.cpp +++ b/engines/titanic/game/musical_instrument.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CMusicalInstrument, CBackground) +EMPTY_MESSAGE_MAP(CMusicalInstrument, CBackground); void CMusicalInstrument::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); diff --git a/engines/titanic/game/navigation_computer.cpp b/engines/titanic/game/navigation_computer.cpp index 042901c07a..49bd252988 100644 --- a/engines/titanic/game/navigation_computer.cpp +++ b/engines/titanic/game/navigation_computer.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CNavigationComputer, CGameObject) +EMPTY_MESSAGE_MAP(CNavigationComputer, CGameObject); void CNavigationComputer::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); diff --git a/engines/titanic/game/null_port_hole.cpp b/engines/titanic/game/null_port_hole.cpp index 060e5f04ca..e651b1b59f 100644 --- a/engines/titanic/game/null_port_hole.cpp +++ b/engines/titanic/game/null_port_hole.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CNullPortHole, CClickResponder) +EMPTY_MESSAGE_MAP(CNullPortHole, CClickResponder); CNullPortHole::CNullPortHole() : CClickResponder() { _string1 = "For a better view, why not visit the Promenade Deck?"; diff --git a/engines/titanic/game/parrot/parrot_lobby_object.cpp b/engines/titanic/game/parrot/parrot_lobby_object.cpp index 9d556b5b91..a78ab2b6d9 100644 --- a/engines/titanic/game/parrot/parrot_lobby_object.cpp +++ b/engines/titanic/game/parrot/parrot_lobby_object.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CParrotLobbyObject, CGameObject) +EMPTY_MESSAGE_MAP(CParrotLobbyObject, CGameObject); int CParrotLobbyObject::_v1; int CParrotLobbyObject::_v2; diff --git a/engines/titanic/game/pet/pet_class1.cpp b/engines/titanic/game/pet/pet_class1.cpp index 096977e26f..651a8f9ed3 100644 --- a/engines/titanic/game/pet/pet_class1.cpp +++ b/engines/titanic/game/pet/pet_class1.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CPETClass1, CGameObject) +EMPTY_MESSAGE_MAP(CPETClass1, CGameObject); void CPETClass1::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); diff --git a/engines/titanic/game/pet/pet_class2.cpp b/engines/titanic/game/pet/pet_class2.cpp index d13ed66fbd..e3e23f62ed 100644 --- a/engines/titanic/game/pet/pet_class2.cpp +++ b/engines/titanic/game/pet/pet_class2.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CPETClass2, CGameObject) +EMPTY_MESSAGE_MAP(CPETClass2, CGameObject); void CPETClass2::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); diff --git a/engines/titanic/game/pet/pet_class3.cpp b/engines/titanic/game/pet/pet_class3.cpp index 0c0adf2090..7751b994ab 100644 --- a/engines/titanic/game/pet/pet_class3.cpp +++ b/engines/titanic/game/pet/pet_class3.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CPETClass3, CGameObject) +EMPTY_MESSAGE_MAP(CPETClass3, CGameObject); void CPETClass3::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); diff --git a/engines/titanic/game/splash_animation.cpp b/engines/titanic/game/splash_animation.cpp index cfaf697d25..2094ec14fa 100644 --- a/engines/titanic/game/splash_animation.cpp +++ b/engines/titanic/game/splash_animation.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CSplashAnimation, CGameObject) +EMPTY_MESSAGE_MAP(CSplashAnimation, CGameObject); void CSplashAnimation::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); diff --git a/engines/titanic/game/transport/transport.cpp b/engines/titanic/game/transport/transport.cpp index f9598c7b7b..6fe45c2fc8 100644 --- a/engines/titanic/game/transport/transport.cpp +++ b/engines/titanic/game/transport/transport.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CTransport, CMobile) +EMPTY_MESSAGE_MAP(CTransport, CMobile); CTransport::CTransport() : CMobile(), _string1("*.*.*") { } diff --git a/engines/titanic/gfx/chev_left_off.cpp b/engines/titanic/gfx/chev_left_off.cpp index 51583992c2..d5c7dcffd6 100644 --- a/engines/titanic/gfx/chev_left_off.cpp +++ b/engines/titanic/gfx/chev_left_off.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CChevLeftOff, CToggleSwitch) +EMPTY_MESSAGE_MAP(CChevLeftOff, CToggleSwitch); CChevLeftOff::CChevLeftOff() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/chev_left_on.cpp b/engines/titanic/gfx/chev_left_on.cpp index 5b3f6a8dcf..9b4a5b6d58 100644 --- a/engines/titanic/gfx/chev_left_on.cpp +++ b/engines/titanic/gfx/chev_left_on.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CChevLeftOn, CToggleSwitch) +EMPTY_MESSAGE_MAP(CChevLeftOn, CToggleSwitch); CChevLeftOn::CChevLeftOn() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/chev_right_off.cpp b/engines/titanic/gfx/chev_right_off.cpp index 4cab0708b3..c4ff3628a0 100644 --- a/engines/titanic/gfx/chev_right_off.cpp +++ b/engines/titanic/gfx/chev_right_off.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CChevRightOff, CToggleSwitch) +EMPTY_MESSAGE_MAP(CChevRightOff, CToggleSwitch); CChevRightOff::CChevRightOff() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/chev_right_on.cpp b/engines/titanic/gfx/chev_right_on.cpp index 29a07f0d41..0351c105d2 100644 --- a/engines/titanic/gfx/chev_right_on.cpp +++ b/engines/titanic/gfx/chev_right_on.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CChevRightOn, CToggleSwitch) +EMPTY_MESSAGE_MAP(CChevRightOn, CToggleSwitch); CChevRightOn::CChevRightOn() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/chev_send_rec_switch.cpp b/engines/titanic/gfx/chev_send_rec_switch.cpp index 92b551852e..6e30280315 100644 --- a/engines/titanic/gfx/chev_send_rec_switch.cpp +++ b/engines/titanic/gfx/chev_send_rec_switch.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CChevSendRecSwitch, CToggleSwitch) +EMPTY_MESSAGE_MAP(CChevSendRecSwitch, CToggleSwitch); CChevSendRecSwitch::CChevSendRecSwitch() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/elevator_button.cpp b/engines/titanic/gfx/elevator_button.cpp index 3c61869677..e66ee19af3 100644 --- a/engines/titanic/gfx/elevator_button.cpp +++ b/engines/titanic/gfx/elevator_button.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CElevatorButton, CSTButton) +EMPTY_MESSAGE_MAP(CElevatorButton, CSTButton); CElevatorButton::CElevatorButton() : CSTButton() { } diff --git a/engines/titanic/gfx/get_from_succ.cpp b/engines/titanic/gfx/get_from_succ.cpp index 0f3f4ba412..d701f73537 100644 --- a/engines/titanic/gfx/get_from_succ.cpp +++ b/engines/titanic/gfx/get_from_succ.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CGetFromSucc, CToggleSwitch) +EMPTY_MESSAGE_MAP(CGetFromSucc, CToggleSwitch); CGetFromSucc::CGetFromSucc() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/helmet_on_off.cpp b/engines/titanic/gfx/helmet_on_off.cpp index c72c795994..06e7d43d32 100644 --- a/engines/titanic/gfx/helmet_on_off.cpp +++ b/engines/titanic/gfx/helmet_on_off.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CHelmetOnOff, CToggleSwitch) +EMPTY_MESSAGE_MAP(CHelmetOnOff, CToggleSwitch); CHelmetOnOff::CHelmetOnOff() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/home_photo.cpp b/engines/titanic/gfx/home_photo.cpp index 1c3b064955..758a5caa75 100644 --- a/engines/titanic/gfx/home_photo.cpp +++ b/engines/titanic/gfx/home_photo.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CHomePhoto, CToggleSwitch) +EMPTY_MESSAGE_MAP(CHomePhoto, CToggleSwitch); CHomePhoto::CHomePhoto() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/icon_nav_action.cpp b/engines/titanic/gfx/icon_nav_action.cpp index bd32c937fb..4d32f46571 100644 --- a/engines/titanic/gfx/icon_nav_action.cpp +++ b/engines/titanic/gfx/icon_nav_action.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CIconNavAction, CToggleSwitch) +EMPTY_MESSAGE_MAP(CIconNavAction, CToggleSwitch); CIconNavAction::CIconNavAction() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/icon_nav_butt.cpp b/engines/titanic/gfx/icon_nav_butt.cpp index cc9a217cbf..951c2f5e7b 100644 --- a/engines/titanic/gfx/icon_nav_butt.cpp +++ b/engines/titanic/gfx/icon_nav_butt.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CIconNavButt, CPetGraphic) +EMPTY_MESSAGE_MAP(CIconNavButt, CPetGraphic); void CIconNavButt::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); diff --git a/engines/titanic/gfx/icon_nav_down.cpp b/engines/titanic/gfx/icon_nav_down.cpp index 09a0332828..efa2124b14 100644 --- a/engines/titanic/gfx/icon_nav_down.cpp +++ b/engines/titanic/gfx/icon_nav_down.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CIconNavDown, CToggleSwitch) +EMPTY_MESSAGE_MAP(CIconNavDown, CToggleSwitch); CIconNavDown::CIconNavDown() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/icon_nav_image.cpp b/engines/titanic/gfx/icon_nav_image.cpp index 59a50bb8a6..403ae44b17 100644 --- a/engines/titanic/gfx/icon_nav_image.cpp +++ b/engines/titanic/gfx/icon_nav_image.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CIconNavImage, CPetGraphic) +EMPTY_MESSAGE_MAP(CIconNavImage, CPetGraphic); void CIconNavImage::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); diff --git a/engines/titanic/gfx/icon_nav_left.cpp b/engines/titanic/gfx/icon_nav_left.cpp index 272e2a63af..8d98f3724c 100644 --- a/engines/titanic/gfx/icon_nav_left.cpp +++ b/engines/titanic/gfx/icon_nav_left.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CIconNavLeft, CToggleSwitch) +EMPTY_MESSAGE_MAP(CIconNavLeft, CToggleSwitch); CIconNavLeft::CIconNavLeft() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/icon_nav_receive.cpp b/engines/titanic/gfx/icon_nav_receive.cpp index ba5d8eaafa..e3e0986690 100644 --- a/engines/titanic/gfx/icon_nav_receive.cpp +++ b/engines/titanic/gfx/icon_nav_receive.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CIconNavReceive, CPetGraphic) +EMPTY_MESSAGE_MAP(CIconNavReceive, CPetGraphic); void CIconNavReceive::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); diff --git a/engines/titanic/gfx/icon_nav_right.cpp b/engines/titanic/gfx/icon_nav_right.cpp index a661e0d8dc..de827918e9 100644 --- a/engines/titanic/gfx/icon_nav_right.cpp +++ b/engines/titanic/gfx/icon_nav_right.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CIconNavRight, CToggleSwitch) +EMPTY_MESSAGE_MAP(CIconNavRight, CToggleSwitch); CIconNavRight::CIconNavRight() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/icon_nav_send.cpp b/engines/titanic/gfx/icon_nav_send.cpp index 067e44847f..9baa9e8f33 100644 --- a/engines/titanic/gfx/icon_nav_send.cpp +++ b/engines/titanic/gfx/icon_nav_send.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CIconNavSend, CPetGraphic) +EMPTY_MESSAGE_MAP(CIconNavSend, CPetGraphic); void CIconNavSend::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); diff --git a/engines/titanic/gfx/icon_nav_up.cpp b/engines/titanic/gfx/icon_nav_up.cpp index 5671dee9cf..4268d97868 100644 --- a/engines/titanic/gfx/icon_nav_up.cpp +++ b/engines/titanic/gfx/icon_nav_up.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CIconNavUp, CToggleSwitch) +EMPTY_MESSAGE_MAP(CIconNavUp, CToggleSwitch); CIconNavUp::CIconNavUp() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/keybrd_butt.cpp b/engines/titanic/gfx/keybrd_butt.cpp index 1a0a927e54..063e709a7b 100644 --- a/engines/titanic/gfx/keybrd_butt.cpp +++ b/engines/titanic/gfx/keybrd_butt.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CKeybrdButt, CToggleSwitch) +EMPTY_MESSAGE_MAP(CKeybrdButt, CToggleSwitch); CKeybrdButt::CKeybrdButt() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/music_slider.cpp b/engines/titanic/gfx/music_slider.cpp index fcf4d4bc76..ec7ff5e3f6 100644 --- a/engines/titanic/gfx/music_slider.cpp +++ b/engines/titanic/gfx/music_slider.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CMusicSlider, CMusicControl) +EMPTY_MESSAGE_MAP(CMusicSlider, CMusicControl); void CMusicSlider::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); diff --git a/engines/titanic/gfx/music_switch.cpp b/engines/titanic/gfx/music_switch.cpp index fb1c6de9f7..1c2ced0b4e 100644 --- a/engines/titanic/gfx/music_switch.cpp +++ b/engines/titanic/gfx/music_switch.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CMusicSwitch, CMusicControl) +EMPTY_MESSAGE_MAP(CMusicSwitch, CMusicControl); void CMusicSwitch::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); diff --git a/engines/titanic/gfx/send_to_succ.cpp b/engines/titanic/gfx/send_to_succ.cpp index 3054191e94..0e2b83361b 100644 --- a/engines/titanic/gfx/send_to_succ.cpp +++ b/engines/titanic/gfx/send_to_succ.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CSendToSucc, CToggleSwitch) +EMPTY_MESSAGE_MAP(CSendToSucc, CToggleSwitch); CSendToSucc::CSendToSucc() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/sgt_selector.cpp b/engines/titanic/gfx/sgt_selector.cpp index c7b52f8b03..81cccb72ce 100644 --- a/engines/titanic/gfx/sgt_selector.cpp +++ b/engines/titanic/gfx/sgt_selector.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CSGTSelector, CPetGraphic) +EMPTY_MESSAGE_MAP(CSGTSelector, CPetGraphic); void CSGTSelector::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); diff --git a/engines/titanic/gfx/small_chev_left_off.cpp b/engines/titanic/gfx/small_chev_left_off.cpp index b0b22e9928..f7c27f9036 100644 --- a/engines/titanic/gfx/small_chev_left_off.cpp +++ b/engines/titanic/gfx/small_chev_left_off.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CSmallChevLeftOff, CToggleSwitch) +EMPTY_MESSAGE_MAP(CSmallChevLeftOff, CToggleSwitch); CSmallChevLeftOff::CSmallChevLeftOff() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/small_chev_left_on.cpp b/engines/titanic/gfx/small_chev_left_on.cpp index a2df2b524c..7a82c1878e 100644 --- a/engines/titanic/gfx/small_chev_left_on.cpp +++ b/engines/titanic/gfx/small_chev_left_on.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CSmallChevLeftOn, CToggleSwitch) +EMPTY_MESSAGE_MAP(CSmallChevLeftOn, CToggleSwitch); CSmallChevLeftOn::CSmallChevLeftOn() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/small_chev_right_off.cpp b/engines/titanic/gfx/small_chev_right_off.cpp index 48f0941c95..f07c5a3d00 100644 --- a/engines/titanic/gfx/small_chev_right_off.cpp +++ b/engines/titanic/gfx/small_chev_right_off.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CSmallChevRightOff, CToggleSwitch) +EMPTY_MESSAGE_MAP(CSmallChevRightOff, CToggleSwitch); CSmallChevRightOff::CSmallChevRightOff() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/small_chev_right_on.cpp b/engines/titanic/gfx/small_chev_right_on.cpp index af794fa428..18aba4a91f 100644 --- a/engines/titanic/gfx/small_chev_right_on.cpp +++ b/engines/titanic/gfx/small_chev_right_on.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CSmallChevRightOn, CToggleSwitch) +EMPTY_MESSAGE_MAP(CSmallChevRightOn, CToggleSwitch); CSmallChevRightOn::CSmallChevRightOn() : CToggleSwitch() { } diff --git a/engines/titanic/gfx/text_down.cpp b/engines/titanic/gfx/text_down.cpp index 4a68752922..4d9bb0b077 100644 --- a/engines/titanic/gfx/text_down.cpp +++ b/engines/titanic/gfx/text_down.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CTextDown, CPetGraphic) +EMPTY_MESSAGE_MAP(CTextDown, CPetGraphic); void CTextDown::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); diff --git a/engines/titanic/gfx/text_skrew.cpp b/engines/titanic/gfx/text_skrew.cpp index 391ed3796f..6d403eabfb 100644 --- a/engines/titanic/gfx/text_skrew.cpp +++ b/engines/titanic/gfx/text_skrew.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CTextSkrew, CPetGraphic) +EMPTY_MESSAGE_MAP(CTextSkrew, CPetGraphic); void CTextSkrew::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); diff --git a/engines/titanic/gfx/text_up.cpp b/engines/titanic/gfx/text_up.cpp index d5e2b1bab3..842be63ee6 100644 --- a/engines/titanic/gfx/text_up.cpp +++ b/engines/titanic/gfx/text_up.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CTextUp, CPetGraphic) +EMPTY_MESSAGE_MAP(CTextUp, CPetGraphic); void CTextUp::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); diff --git a/engines/titanic/gfx/toggle_button.cpp b/engines/titanic/gfx/toggle_button.cpp index 78e53569de..2b7c80d3df 100644 --- a/engines/titanic/gfx/toggle_button.cpp +++ b/engines/titanic/gfx/toggle_button.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CToggleButton, CBackground) +EMPTY_MESSAGE_MAP(CToggleButton, CBackground); void CToggleButton::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); diff --git a/engines/titanic/npcs/mobile.cpp b/engines/titanic/npcs/mobile.cpp index 83f886ed21..8a45f9e3cf 100644 --- a/engines/titanic/npcs/mobile.cpp +++ b/engines/titanic/npcs/mobile.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CMobile, CCharacter) +EMPTY_MESSAGE_MAP(CMobile, CCharacter); CMobile::CMobile() : CCharacter(), _fieldDC(0) { } diff --git a/engines/titanic/pet_control/pet_graphic.cpp b/engines/titanic/pet_control/pet_graphic.cpp index c4e184990a..bc7d86142d 100644 --- a/engines/titanic/pet_control/pet_graphic.cpp +++ b/engines/titanic/pet_control/pet_graphic.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CPetGraphic, CGameObject) +EMPTY_MESSAGE_MAP(CPetGraphic, CGameObject); void CPetGraphic::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); diff --git a/engines/titanic/pet_control/pet_graphic2.cpp b/engines/titanic/pet_control/pet_graphic2.cpp index 79cf42eeb0..36c4d0f55a 100644 --- a/engines/titanic/pet_control/pet_graphic2.cpp +++ b/engines/titanic/pet_control/pet_graphic2.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CPetGraphic2, CGameObject) +EMPTY_MESSAGE_MAP(CPetGraphic2, CGameObject); void CPetGraphic2::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); diff --git a/engines/titanic/pet_control/pet_leaf.cpp b/engines/titanic/pet_control/pet_leaf.cpp index bf40b6ca5c..718ffe5e6e 100644 --- a/engines/titanic/pet_control/pet_leaf.cpp +++ b/engines/titanic/pet_control/pet_leaf.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(PETLeaf, CGameObject) +EMPTY_MESSAGE_MAP(PETLeaf, CGameObject); void PETLeaf::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); diff --git a/engines/titanic/pet_control/pet_mode_off.cpp b/engines/titanic/pet_control/pet_mode_off.cpp index 277b8e5eac..119c15a65c 100644 --- a/engines/titanic/pet_control/pet_mode_off.cpp +++ b/engines/titanic/pet_control/pet_mode_off.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CPetModeOff, CToggleSwitch) +EMPTY_MESSAGE_MAP(CPetModeOff, CToggleSwitch); CPetModeOff::CPetModeOff() : CToggleSwitch() { } diff --git a/engines/titanic/pet_control/pet_mode_on.cpp b/engines/titanic/pet_control/pet_mode_on.cpp index 89845dc49a..2b61461a24 100644 --- a/engines/titanic/pet_control/pet_mode_on.cpp +++ b/engines/titanic/pet_control/pet_mode_on.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CPetModeOn, CToggleSwitch) +EMPTY_MESSAGE_MAP(CPetModeOn, CToggleSwitch); CPetModeOn::CPetModeOn() : CToggleSwitch() { } diff --git a/engines/titanic/pet_control/pet_mode_panel.cpp b/engines/titanic/pet_control/pet_mode_panel.cpp index 1384602183..8579c31cea 100644 --- a/engines/titanic/pet_control/pet_mode_panel.cpp +++ b/engines/titanic/pet_control/pet_mode_panel.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CPetModePanel, CToggleSwitch) +EMPTY_MESSAGE_MAP(CPetModePanel, CToggleSwitch); CPetModePanel::CPetModePanel() : CToggleSwitch() { } diff --git a/engines/titanic/pet_control/pet_pannel1.cpp b/engines/titanic/pet_control/pet_pannel1.cpp index 9906212b4b..7a757bfe57 100644 --- a/engines/titanic/pet_control/pet_pannel1.cpp +++ b/engines/titanic/pet_control/pet_pannel1.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CPetPannel1, CPetGraphic) +EMPTY_MESSAGE_MAP(CPetPannel1, CPetGraphic); void CPetPannel1::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); diff --git a/engines/titanic/pet_control/pet_pannel2.cpp b/engines/titanic/pet_control/pet_pannel2.cpp index b67e0edfcd..096a39afbf 100644 --- a/engines/titanic/pet_control/pet_pannel2.cpp +++ b/engines/titanic/pet_control/pet_pannel2.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CPetPannel2, CPetGraphic) +EMPTY_MESSAGE_MAP(CPetPannel2, CPetGraphic); void CPetPannel2::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); diff --git a/engines/titanic/pet_control/pet_pannel3.cpp b/engines/titanic/pet_control/pet_pannel3.cpp index a2a1fbedf9..0d095a62c5 100644 --- a/engines/titanic/pet_control/pet_pannel3.cpp +++ b/engines/titanic/pet_control/pet_pannel3.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CPetPannel3, CPetGraphic) +EMPTY_MESSAGE_MAP(CPetPannel3, CPetGraphic); void CPetPannel3::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); diff --git a/engines/titanic/sound/dome_from_top_of_well.cpp b/engines/titanic/sound/dome_from_top_of_well.cpp index 778f016a4e..3721b9f3b7 100644 --- a/engines/titanic/sound/dome_from_top_of_well.cpp +++ b/engines/titanic/sound/dome_from_top_of_well.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CDomeFromTopOfWell, CViewAutoSoundPlayer) +EMPTY_MESSAGE_MAP(CDomeFromTopOfWell, CViewAutoSoundPlayer); void CDomeFromTopOfWell::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); diff --git a/engines/titanic/sound/water_lapping_sounds.cpp b/engines/titanic/sound/water_lapping_sounds.cpp index 74af78736c..c33db412e1 100644 --- a/engines/titanic/sound/water_lapping_sounds.cpp +++ b/engines/titanic/sound/water_lapping_sounds.cpp @@ -24,7 +24,7 @@ namespace Titanic { -EMPTY_MESSAGE_MAP(CWaterLappingSounds, CRoomAutoSoundPlayer) +EMPTY_MESSAGE_MAP(CWaterLappingSounds, CRoomAutoSoundPlayer); void CWaterLappingSounds::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); -- cgit v1.2.3 From 4d79ee16c07e2398e9058fe93947b4704cd6048a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 Jul 2016 20:30:56 -0400 Subject: TITANIC: Add semicolon after CLASSDEF macro usage --- engines/titanic/carry/arm.h | 2 +- engines/titanic/carry/auditory_centre.h | 2 +- engines/titanic/carry/bowl_ear.h | 2 +- engines/titanic/carry/brain.h | 2 +- engines/titanic/carry/bridge_piece.h | 2 +- engines/titanic/carry/carry.h | 2 +- engines/titanic/carry/carry_parrot.h | 2 +- engines/titanic/carry/central_core.h | 2 +- engines/titanic/carry/chicken.h | 2 +- engines/titanic/carry/crushed_tv.h | 2 +- engines/titanic/carry/ear.h | 2 +- engines/titanic/carry/eye.h | 2 +- engines/titanic/carry/feathers.h | 2 +- engines/titanic/carry/fruit.h | 2 +- engines/titanic/carry/glass.h | 2 +- engines/titanic/carry/hammer.h | 2 +- engines/titanic/carry/head_piece.h | 2 +- engines/titanic/carry/hose.h | 2 +- engines/titanic/carry/hose_end.h | 2 +- engines/titanic/carry/key.h | 2 +- engines/titanic/carry/liftbot_head.h | 2 +- engines/titanic/carry/long_stick.h | 2 +- engines/titanic/carry/magazine.h | 2 +- engines/titanic/carry/maitred_left_arm.h | 2 +- engines/titanic/carry/maitred_right_arm.h | 2 +- engines/titanic/carry/mouth.h | 2 +- engines/titanic/carry/napkin.h | 2 +- engines/titanic/carry/nose.h | 2 +- engines/titanic/carry/note.h | 2 +- engines/titanic/carry/parcel.h | 2 +- engines/titanic/carry/perch.h | 2 +- engines/titanic/carry/phonograph_cylinder.h | 2 +- engines/titanic/carry/phonograph_ear.h | 2 +- engines/titanic/carry/photograph.h | 2 +- engines/titanic/carry/plug_in.h | 2 +- engines/titanic/carry/speech_centre.h | 2 +- engines/titanic/carry/sweets.h | 2 +- engines/titanic/carry/test_carry.h | 2 +- engines/titanic/carry/vision_centre.h | 2 +- engines/titanic/core/background.h | 2 +- engines/titanic/core/click_responder.h | 2 +- engines/titanic/core/dont_save_file_item.h | 2 +- engines/titanic/core/drop_target.h | 2 +- engines/titanic/core/file_item.h | 2 +- engines/titanic/core/game_object.h | 2 +- engines/titanic/core/game_object_desc_item.h | 2 +- engines/titanic/core/link_item.h | 2 +- engines/titanic/core/list.h | 2 +- engines/titanic/core/mail_man.h | 2 +- engines/titanic/core/message_target.h | 2 +- engines/titanic/core/multi_drop_target.h | 2 +- engines/titanic/core/named_item.h | 2 +- engines/titanic/core/node_item.h | 2 +- engines/titanic/core/project_item.h | 4 ++-- engines/titanic/core/resource_key.h | 2 +- engines/titanic/core/room_item.h | 2 +- engines/titanic/core/static_image.h | 2 +- engines/titanic/core/tree_item.h | 2 +- engines/titanic/core/turn_on_object.h | 2 +- engines/titanic/core/turn_on_play_sound.h | 2 +- engines/titanic/core/turn_on_turn_off.h | 2 +- engines/titanic/core/view_item.h | 2 +- engines/titanic/game/announce.h | 2 +- engines/titanic/game/annoy_barbot.h | 2 +- engines/titanic/game/arb_background.h | 2 +- engines/titanic/game/arboretum_gate.h | 2 +- engines/titanic/game/auto_animate.h | 2 +- engines/titanic/game/bar_bell.h | 2 +- engines/titanic/game/bar_menu.h | 2 +- engines/titanic/game/bar_menu_button.h | 2 +- engines/titanic/game/belbot_get_light.h | 2 +- engines/titanic/game/bilge_succubus.h | 2 +- engines/titanic/game/bomb.h | 2 +- engines/titanic/game/bottom_of_well_monitor.h | 2 +- engines/titanic/game/bowl_unlocker.h | 2 +- engines/titanic/game/brain_slot.h | 2 +- engines/titanic/game/bridge_door.h | 2 +- engines/titanic/game/bridge_view.h | 2 +- engines/titanic/game/broken_pell_base.h | 2 +- engines/titanic/game/broken_pellerator.h | 2 +- engines/titanic/game/broken_pellerator_froz.h | 2 +- engines/titanic/game/cage.h | 2 +- engines/titanic/game/call_pellerator.h | 2 +- engines/titanic/game/captains_wheel.h | 2 +- engines/titanic/game/cdrom.h | 2 +- engines/titanic/game/cdrom_computer.h | 2 +- engines/titanic/game/cdrom_tray.h | 2 +- engines/titanic/game/cell_point_button.h | 2 +- engines/titanic/game/chev_code.h | 2 +- engines/titanic/game/chev_panel.h | 2 +- engines/titanic/game/chicken_cooler.h | 2 +- engines/titanic/game/chicken_dispensor.h | 2 +- engines/titanic/game/close_broken_pel.h | 2 +- engines/titanic/game/code_wheel.h | 2 +- engines/titanic/game/computer.h | 2 +- engines/titanic/game/computer_screen.h | 2 +- engines/titanic/game/cookie.h | 2 +- engines/titanic/game/credits.h | 2 +- engines/titanic/game/credits_button.h | 2 +- engines/titanic/game/dead_area.h | 2 +- engines/titanic/game/desk_click_responder.h | 2 +- engines/titanic/game/doorbot_elevator_handler.h | 2 +- engines/titanic/game/doorbot_home_handler.h | 2 +- engines/titanic/game/ear_sweet_bowl.h | 2 +- engines/titanic/game/eject_phonograph_button.h | 2 +- engines/titanic/game/elevator_action_area.h | 2 +- engines/titanic/game/emma_control.h | 2 +- engines/titanic/game/empty_nut_bowl.h | 2 +- engines/titanic/game/end_credit_text.h | 2 +- engines/titanic/game/end_credits.h | 2 +- engines/titanic/game/end_explode_ship.h | 2 +- engines/titanic/game/end_game_credits.h | 2 +- engines/titanic/game/end_sequence_control.h | 2 +- engines/titanic/game/fan.h | 2 +- engines/titanic/game/fan_control.h | 2 +- engines/titanic/game/fan_decrease.h | 2 +- engines/titanic/game/fan_increase.h | 2 +- engines/titanic/game/fan_noises.h | 2 +- engines/titanic/game/floor_indicator.h | 2 +- engines/titanic/game/games_console.h | 2 +- engines/titanic/game/get_lift_eye2.h | 2 +- engines/titanic/game/glass_smasher.h | 2 +- engines/titanic/game/gondolier/gondolier_base.h | 2 +- engines/titanic/game/gondolier/gondolier_chest.h | 2 +- engines/titanic/game/gondolier/gondolier_face.h | 2 +- engines/titanic/game/gondolier/gondolier_mixer.h | 2 +- engines/titanic/game/gondolier/gondolier_slider.h | 2 +- engines/titanic/game/hammer_clip.h | 2 +- engines/titanic/game/hammer_dispensor.h | 2 +- engines/titanic/game/hammer_dispensor_button.h | 2 +- engines/titanic/game/head_slot.h | 2 +- engines/titanic/game/head_smash_event.h | 2 +- engines/titanic/game/head_smash_lever.h | 2 +- engines/titanic/game/head_spinner.h | 2 +- engines/titanic/game/idle_summoner.h | 2 +- engines/titanic/game/leave_sec_class_state.h | 2 +- engines/titanic/game/lemon_dispensor.h | 2 +- engines/titanic/game/light.h | 2 +- engines/titanic/game/light_switch.h | 2 +- engines/titanic/game/little_lift_button.h | 2 +- engines/titanic/game/long_stick_dispenser.h | 2 +- engines/titanic/game/maitred/maitred_arm_holder.h | 2 +- engines/titanic/game/maitred/maitred_body.h | 2 +- engines/titanic/game/maitred/maitred_legs.h | 2 +- .../titanic/game/maitred/maitred_prod_receptor.h | 2 +- engines/titanic/game/missiveomat.h | 2 +- engines/titanic/game/missiveomat_button.h | 2 +- engines/titanic/game/movie_tester.h | 2 +- engines/titanic/game/music_console_button.h | 2 +- engines/titanic/game/music_room_phonograph.h | 2 +- .../game/music_room_stop_phonograph_button.h | 2 +- engines/titanic/game/music_system_lock.h | 2 +- engines/titanic/game/musical_instrument.h | 2 +- engines/titanic/game/nav_helmet.h | 2 +- engines/titanic/game/navigation_computer.h | 2 +- engines/titanic/game/no_nut_bowl.h | 2 +- engines/titanic/game/nose_holder.h | 2 +- engines/titanic/game/null_port_hole.h | 2 +- engines/titanic/game/nut_replacer.h | 2 +- .../titanic/game/parrot/parrot_lobby_controller.h | 2 +- .../game/parrot/parrot_lobby_link_updater.h | 2 +- engines/titanic/game/parrot/parrot_lobby_object.h | 2 +- .../titanic/game/parrot/parrot_lobby_view_object.h | 2 +- engines/titanic/game/parrot/parrot_loser.h | 2 +- .../titanic/game/parrot/parrot_nut_bowl_actor.h | 2 +- engines/titanic/game/parrot/parrot_nut_eater.h | 2 +- engines/titanic/game/parrot/parrot_perch_holder.h | 2 +- engines/titanic/game/parrot/parrot_succubus.h | 2 +- engines/titanic/game/parrot/parrot_trigger.h | 2 +- engines/titanic/game/parrot/player_meets_parrot.h | 2 +- engines/titanic/game/pet/pet.h | 2 +- engines/titanic/game/pet/pet_class1.h | 2 +- engines/titanic/game/pet/pet_class2.h | 2 +- engines/titanic/game/pet/pet_class3.h | 2 +- engines/titanic/game/pet/pet_lift.h | 2 +- engines/titanic/game/pet/pet_monitor.h | 2 +- engines/titanic/game/pet/pet_pellerator.h | 2 +- engines/titanic/game/pet/pet_position.h | 2 +- engines/titanic/game/pet/pet_sentinal.h | 2 +- engines/titanic/game/pet/pet_sounds.h | 2 +- engines/titanic/game/pet/pet_transition.h | 2 +- engines/titanic/game/pet/pet_transport.h | 2 +- engines/titanic/game/pet_disabler.h | 2 +- engines/titanic/game/phonograph.h | 2 +- engines/titanic/game/phonograph_lid.h | 2 +- engines/titanic/game/pickup/pick_up.h | 2 +- engines/titanic/game/pickup/pick_up_bar_glass.h | 2 +- engines/titanic/game/pickup/pick_up_hose.h | 2 +- engines/titanic/game/pickup/pick_up_lemon.h | 2 +- .../titanic/game/pickup/pick_up_speech_centre.h | 2 +- engines/titanic/game/pickup/pick_up_vis_centre.h | 2 +- .../game/placeholder/bar_shelf_vis_centre.h | 2 +- engines/titanic/game/placeholder/lemon_on_bar.h | 2 +- .../titanic/game/placeholder/place_holder_item.h | 2 +- engines/titanic/game/placeholder/tv_on_bar.h | 2 +- engines/titanic/game/play_music_button.h | 2 +- engines/titanic/game/play_on_act.h | 2 +- engines/titanic/game/port_hole.h | 2 +- engines/titanic/game/record_phonograph_button.h | 2 +- engines/titanic/game/replacement_ear.h | 2 +- engines/titanic/game/reserved_table.h | 2 +- engines/titanic/game/restaurant_cylinder_holder.h | 2 +- engines/titanic/game/restaurant_phonograph.h | 2 +- engines/titanic/game/sauce_dispensor.h | 2 +- engines/titanic/game/search_point.h | 2 +- engines/titanic/game/season_background.h | 2 +- engines/titanic/game/season_barrel.h | 2 +- engines/titanic/game/seasonal_adjustment.h | 2 +- engines/titanic/game/service_elevator_window.h | 2 +- engines/titanic/game/sgt/armchair.h | 2 +- engines/titanic/game/sgt/basin.h | 2 +- engines/titanic/game/sgt/bedfoot.h | 2 +- engines/titanic/game/sgt/bedhead.h | 2 +- engines/titanic/game/sgt/chest_of_drawers.h | 2 +- engines/titanic/game/sgt/desk.h | 2 +- engines/titanic/game/sgt/deskchair.h | 2 +- engines/titanic/game/sgt/drawer.h | 2 +- engines/titanic/game/sgt/sgt_doors.h | 2 +- engines/titanic/game/sgt/sgt_nav.h | 2 +- engines/titanic/game/sgt/sgt_navigation.h | 2 +- engines/titanic/game/sgt/sgt_restaurant_doors.h | 2 +- engines/titanic/game/sgt/sgt_state_control.h | 2 +- engines/titanic/game/sgt/sgt_state_room.h | 2 +- engines/titanic/game/sgt/sgt_tv.h | 2 +- engines/titanic/game/sgt/sgt_upper_doors_sound.h | 2 +- engines/titanic/game/sgt/toilet.h | 2 +- engines/titanic/game/sgt/vase.h | 2 +- engines/titanic/game/sgt/washstand.h | 2 +- engines/titanic/game/ship_setting.h | 2 +- engines/titanic/game/ship_setting_button.h | 2 +- engines/titanic/game/show_cell_points.h | 2 +- engines/titanic/game/speech_dispensor.h | 2 +- engines/titanic/game/splash_animation.h | 2 +- engines/titanic/game/starling_puret.h | 2 +- engines/titanic/game/start_action.h | 2 +- engines/titanic/game/stop_phonograph_button.h | 2 +- engines/titanic/game/sub_glass.h | 2 +- engines/titanic/game/sub_wrapper.h | 2 +- engines/titanic/game/sweet_bowl.h | 2 +- engines/titanic/game/television.h | 2 +- engines/titanic/game/third_class_canal.h | 2 +- engines/titanic/game/throw_tv_down_well.h | 2 +- engines/titanic/game/titania_still_control.h | 2 +- engines/titanic/game/tow_parrot_nav.h | 2 +- engines/titanic/game/transport/exit_pellerator.h | 2 +- engines/titanic/game/transport/gondolier.h | 2 +- engines/titanic/game/transport/lift.h | 2 +- engines/titanic/game/transport/lift_indicator.h | 2 +- engines/titanic/game/transport/pellerator.h | 2 +- engines/titanic/game/transport/service_elevator.h | 2 +- engines/titanic/game/transport/transport.h | 2 +- engines/titanic/game/up_lighter.h | 2 +- engines/titanic/game/useless_lever.h | 2 +- engines/titanic/game/volume_control.h | 2 +- engines/titanic/game/wheel_button.h | 2 +- engines/titanic/game/wheel_hotspot.h | 2 +- engines/titanic/game/wheel_spin.h | 2 +- engines/titanic/game/wheel_spin_horn.h | 2 +- engines/titanic/gfx/act_button.h | 2 +- engines/titanic/gfx/changes_season_button.h | 2 +- engines/titanic/gfx/chev_left_off.h | 2 +- engines/titanic/gfx/chev_left_on.h | 2 +- engines/titanic/gfx/chev_right_off.h | 2 +- engines/titanic/gfx/chev_right_on.h | 2 +- engines/titanic/gfx/chev_send_rec_switch.h | 2 +- engines/titanic/gfx/chev_switch.h | 2 +- engines/titanic/gfx/edit_control.h | 2 +- engines/titanic/gfx/elevator_button.h | 2 +- engines/titanic/gfx/get_from_succ.h | 2 +- engines/titanic/gfx/helmet_on_off.h | 2 +- engines/titanic/gfx/home_photo.h | 2 +- engines/titanic/gfx/icon_nav_action.h | 2 +- engines/titanic/gfx/icon_nav_butt.h | 2 +- engines/titanic/gfx/icon_nav_down.h | 2 +- engines/titanic/gfx/icon_nav_image.h | 2 +- engines/titanic/gfx/icon_nav_left.h | 2 +- engines/titanic/gfx/icon_nav_receive.h | 2 +- engines/titanic/gfx/icon_nav_right.h | 2 +- engines/titanic/gfx/icon_nav_send.h | 2 +- engines/titanic/gfx/icon_nav_up.h | 2 +- engines/titanic/gfx/keybrd_butt.h | 2 +- engines/titanic/gfx/move_object_button.h | 2 +- engines/titanic/gfx/music_control.h | 2 +- engines/titanic/gfx/music_slider.h | 2 +- engines/titanic/gfx/music_slider_pitch.h | 2 +- engines/titanic/gfx/music_slider_speed.h | 2 +- engines/titanic/gfx/music_switch.h | 2 +- engines/titanic/gfx/music_switch_inversion.h | 2 +- engines/titanic/gfx/music_switch_reverse.h | 2 +- engines/titanic/gfx/music_voice_mute.h | 2 +- engines/titanic/gfx/send_to_succ.h | 2 +- engines/titanic/gfx/sgt_selector.h | 2 +- engines/titanic/gfx/slider_button.h | 2 +- engines/titanic/gfx/small_chev_left_off.h | 2 +- engines/titanic/gfx/small_chev_left_on.h | 2 +- engines/titanic/gfx/small_chev_right_off.h | 2 +- engines/titanic/gfx/small_chev_right_on.h | 2 +- engines/titanic/gfx/st_button.h | 2 +- engines/titanic/gfx/status_change_button.h | 2 +- engines/titanic/gfx/text_down.h | 2 +- engines/titanic/gfx/text_skrew.h | 2 +- engines/titanic/gfx/text_up.h | 2 +- engines/titanic/gfx/toggle_button.h | 2 +- engines/titanic/gfx/toggle_switch.h | 2 +- engines/titanic/messages/auto_sound_event.h | 2 +- engines/titanic/messages/bilge_auto_sound_event.h | 2 +- engines/titanic/messages/bilge_dispensor_event.h | 2 +- engines/titanic/messages/door_auto_sound_event.h | 2 +- engines/titanic/messages/messages.h | 18 +++++++++--------- engines/titanic/messages/mouse_messages.h | 22 +++++++++++----------- engines/titanic/messages/pet_messages.h | 2 +- engines/titanic/messages/service_elevator_door.h | 2 +- engines/titanic/moves/enter_bomb_room.h | 2 +- engines/titanic/moves/enter_bridge.h | 2 +- .../titanic/moves/enter_exit_first_class_state.h | 2 +- engines/titanic/moves/enter_exit_mini_lift.h | 2 +- .../titanic/moves/enter_exit_sec_class_mini_lift.h | 2 +- engines/titanic/moves/enter_exit_view.h | 2 +- engines/titanic/moves/enter_sec_class_state.h | 2 +- engines/titanic/moves/exit_arboretum.h | 2 +- engines/titanic/moves/exit_bridge.h | 2 +- engines/titanic/moves/exit_lift.h | 2 +- engines/titanic/moves/exit_pellerator.h | 2 +- engines/titanic/moves/exit_state_room.h | 2 +- engines/titanic/moves/exit_tiania.h | 2 +- engines/titanic/moves/move_player_in_parrot_room.h | 2 +- engines/titanic/moves/move_player_to.h | 2 +- engines/titanic/moves/move_player_to_from.h | 2 +- engines/titanic/moves/multi_move.h | 2 +- engines/titanic/moves/pan_from_pel.h | 2 +- engines/titanic/moves/restaurant_pan_handler.h | 2 +- engines/titanic/moves/restricted_move.h | 2 +- engines/titanic/moves/scraliontis_table.h | 2 +- engines/titanic/moves/trip_down_canal.h | 2 +- engines/titanic/npcs/barbot.h | 2 +- engines/titanic/npcs/bellbot.h | 2 +- engines/titanic/npcs/callbot.h | 2 +- engines/titanic/npcs/character.h | 2 +- engines/titanic/npcs/deskbot.h | 2 +- engines/titanic/npcs/doorbot.h | 2 +- engines/titanic/npcs/liftbot.h | 2 +- engines/titanic/npcs/maitre_d.h | 2 +- engines/titanic/npcs/mobile.h | 2 +- engines/titanic/npcs/parrot.h | 2 +- engines/titanic/npcs/robot_controller.h | 2 +- engines/titanic/npcs/starlings.h | 2 +- engines/titanic/npcs/succubus.h | 2 +- engines/titanic/npcs/summon_bots.h | 2 +- engines/titanic/npcs/titania.h | 2 +- engines/titanic/npcs/true_talk_npc.h | 2 +- engines/titanic/pet_control/pet_control.h | 2 +- engines/titanic/pet_control/pet_drag_chev.h | 2 +- engines/titanic/pet_control/pet_graphic.h | 2 +- engines/titanic/pet_control/pet_graphic2.h | 2 +- engines/titanic/pet_control/pet_leaf.h | 2 +- engines/titanic/pet_control/pet_mode_off.h | 2 +- engines/titanic/pet_control/pet_mode_on.h | 2 +- engines/titanic/pet_control/pet_mode_panel.h | 2 +- engines/titanic/pet_control/pet_pannel1.h | 2 +- engines/titanic/pet_control/pet_pannel2.h | 2 +- engines/titanic/pet_control/pet_pannel3.h | 2 +- engines/titanic/sound/auto_music_player.h | 2 +- engines/titanic/sound/auto_music_player_base.h | 2 +- engines/titanic/sound/auto_sound_player.h | 2 +- engines/titanic/sound/auto_sound_player_adsr.h | 2 +- engines/titanic/sound/background_sound_maker.h | 2 +- engines/titanic/sound/bird_song.h | 2 +- engines/titanic/sound/dome_from_top_of_well.h | 2 +- .../titanic/sound/enter_view_toggles_other_music.h | 2 +- engines/titanic/sound/gondolier_song.h | 2 +- engines/titanic/sound/music_player.h | 2 +- engines/titanic/sound/node_auto_sound_player.h | 2 +- .../titanic/sound/restricted_auto_music_player.h | 2 +- engines/titanic/sound/room_auto_sound_player.h | 2 +- .../titanic/sound/room_trigger_auto_music_player.h | 2 +- engines/titanic/sound/season_noises.h | 2 +- engines/titanic/sound/seasonal_music_player.h | 2 +- engines/titanic/sound/titania_speech.h | 2 +- engines/titanic/sound/trigger_auto_music_player.h | 2 +- engines/titanic/sound/view_auto_sound_player.h | 2 +- engines/titanic/sound/view_toggles_other_music.h | 2 +- engines/titanic/sound/water_lapping_sounds.h | 2 +- engines/titanic/star_control/star_control.h | 2 +- engines/titanic/support/movie_clip.h | 2 +- engines/titanic/support/time_event_info.h | 2 +- 385 files changed, 404 insertions(+), 404 deletions(-) diff --git a/engines/titanic/carry/arm.h b/engines/titanic/carry/arm.h index afef22ba49..48201ed90a 100644 --- a/engines/titanic/carry/arm.h +++ b/engines/titanic/carry/arm.h @@ -49,7 +49,7 @@ private: int _field16C; int _field170; public: - CLASSDEF + CLASSDEF; CArm(); /** diff --git a/engines/titanic/carry/auditory_centre.h b/engines/titanic/carry/auditory_centre.h index d4b9beedc7..743f8f2498 100644 --- a/engines/titanic/carry/auditory_centre.h +++ b/engines/titanic/carry/auditory_centre.h @@ -29,7 +29,7 @@ namespace Titanic { class CAuditoryCentre : public CBrain { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/carry/bowl_ear.h b/engines/titanic/carry/bowl_ear.h index 39d5dc9ff8..4f2fbea478 100644 --- a/engines/titanic/carry/bowl_ear.h +++ b/engines/titanic/carry/bowl_ear.h @@ -29,7 +29,7 @@ namespace Titanic { class CBowlEar : public CEar { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/carry/brain.h b/engines/titanic/carry/brain.h index fd70a7e0c9..5f76e7deff 100644 --- a/engines/titanic/carry/brain.h +++ b/engines/titanic/carry/brain.h @@ -42,7 +42,7 @@ private: int _field134; int _field138; public: - CLASSDEF + CLASSDEF; CBrain(); /** diff --git a/engines/titanic/carry/bridge_piece.h b/engines/titanic/carry/bridge_piece.h index 04bc7b9181..01c44c0b97 100644 --- a/engines/titanic/carry/bridge_piece.h +++ b/engines/titanic/carry/bridge_piece.h @@ -36,7 +36,7 @@ private: Point _pos3; int _field140; public: - CLASSDEF + CLASSDEF; CBridgePiece(); /** diff --git a/engines/titanic/carry/carry.h b/engines/titanic/carry/carry.h index 36589635f7..f4ea648b80 100644 --- a/engines/titanic/carry/carry.h +++ b/engines/titanic/carry/carry.h @@ -62,7 +62,7 @@ protected: bool _enterFrameSet; int _visibleFrame; public: - CLASSDEF + CLASSDEF; CCarry(); /** diff --git a/engines/titanic/carry/carry_parrot.h b/engines/titanic/carry/carry_parrot.h index 84c656ce8e..70caee85d3 100644 --- a/engines/titanic/carry/carry_parrot.h +++ b/engines/titanic/carry/carry_parrot.h @@ -51,7 +51,7 @@ private: int _field14C; int _field150; public: - CLASSDEF + CLASSDEF; CCarryParrot(); /** diff --git a/engines/titanic/carry/central_core.h b/engines/titanic/carry/central_core.h index 852d2b63e1..9d7bef2c13 100644 --- a/engines/titanic/carry/central_core.h +++ b/engines/titanic/carry/central_core.h @@ -29,7 +29,7 @@ namespace Titanic { class CCentralCore : public CBrain { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/carry/chicken.h b/engines/titanic/carry/chicken.h index e9e8f00000..c78d4a023b 100644 --- a/engines/titanic/carry/chicken.h +++ b/engines/titanic/carry/chicken.h @@ -49,7 +49,7 @@ public: int _field13C; int _timerId; public: - CLASSDEF + CLASSDEF; CChicken(); /** diff --git a/engines/titanic/carry/crushed_tv.h b/engines/titanic/carry/crushed_tv.h index d141589ec8..ba6b52cd2e 100644 --- a/engines/titanic/carry/crushed_tv.h +++ b/engines/titanic/carry/crushed_tv.h @@ -35,7 +35,7 @@ class CCrushedTV : public CCarry { bool UseWithCharMsg(CUseWithCharMsg *msg); bool MouseDragStartMsg(CMouseDragStartMsg *msg); public: - CLASSDEF + CLASSDEF; CCrushedTV(); /** diff --git a/engines/titanic/carry/ear.h b/engines/titanic/carry/ear.h index bdffdc2678..edef873d35 100644 --- a/engines/titanic/carry/ear.h +++ b/engines/titanic/carry/ear.h @@ -29,7 +29,7 @@ namespace Titanic { class CEar : public CHeadPiece { public: - CLASSDEF + CLASSDEF; CEar(); /** diff --git a/engines/titanic/carry/eye.h b/engines/titanic/carry/eye.h index 2531666037..066a85609b 100644 --- a/engines/titanic/carry/eye.h +++ b/engines/titanic/carry/eye.h @@ -31,7 +31,7 @@ class CEye : public CHeadPiece { private: int _eyeNum; public: - CLASSDEF + CLASSDEF; CEye(); /** diff --git a/engines/titanic/carry/feathers.h b/engines/titanic/carry/feathers.h index e2c8ab77db..4d193afc3f 100644 --- a/engines/titanic/carry/feathers.h +++ b/engines/titanic/carry/feathers.h @@ -30,7 +30,7 @@ namespace Titanic { class CFeathers : public CCarry { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; CFeathers(); /** diff --git a/engines/titanic/carry/fruit.h b/engines/titanic/carry/fruit.h index 595f27d56c..93fe920740 100644 --- a/engines/titanic/carry/fruit.h +++ b/engines/titanic/carry/fruit.h @@ -34,7 +34,7 @@ private: int _field134; int _field138; public: - CLASSDEF + CLASSDEF; CFruit(); /** diff --git a/engines/titanic/carry/glass.h b/engines/titanic/carry/glass.h index 4e540152fa..9f4056b1be 100644 --- a/engines/titanic/carry/glass.h +++ b/engines/titanic/carry/glass.h @@ -31,7 +31,7 @@ class CGlass : public CCarry { private: CString _string6; public: - CLASSDEF + CLASSDEF; CGlass(); /** diff --git a/engines/titanic/carry/hammer.h b/engines/titanic/carry/hammer.h index e35fdd1d85..a455d71434 100644 --- a/engines/titanic/carry/hammer.h +++ b/engines/titanic/carry/hammer.h @@ -29,7 +29,7 @@ namespace Titanic { class CHammer : public CCarry { public: - CLASSDEF + CLASSDEF; CHammer(); /** diff --git a/engines/titanic/carry/head_piece.h b/engines/titanic/carry/head_piece.h index 1989b0ef2d..05ac772853 100644 --- a/engines/titanic/carry/head_piece.h +++ b/engines/titanic/carry/head_piece.h @@ -33,7 +33,7 @@ private: CString _string6; int _field13C; public: - CLASSDEF + CLASSDEF; CHeadPiece(); /** diff --git a/engines/titanic/carry/hose.h b/engines/titanic/carry/hose.h index d45fc08bc4..ebd45860e8 100644 --- a/engines/titanic/carry/hose.h +++ b/engines/titanic/carry/hose.h @@ -38,7 +38,7 @@ protected: CString _string6; public: - CLASSDEF + CLASSDEF; CHose(); static void init(); static void deinit(); diff --git a/engines/titanic/carry/hose_end.h b/engines/titanic/carry/hose_end.h index 8a82ec5363..6996d6367a 100644 --- a/engines/titanic/carry/hose_end.h +++ b/engines/titanic/carry/hose_end.h @@ -30,7 +30,7 @@ namespace Titanic { class CHoseEnd : public CHose { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; CHoseEnd(); /** diff --git a/engines/titanic/carry/key.h b/engines/titanic/carry/key.h index 6b7a134991..8f1600f2b3 100644 --- a/engines/titanic/carry/key.h +++ b/engines/titanic/carry/key.h @@ -29,7 +29,7 @@ namespace Titanic { class CKey : public CCarry { public: - CLASSDEF + CLASSDEF; CKey(); /** diff --git a/engines/titanic/carry/liftbot_head.h b/engines/titanic/carry/liftbot_head.h index 9dc625014b..2fcd6a71f9 100644 --- a/engines/titanic/carry/liftbot_head.h +++ b/engines/titanic/carry/liftbot_head.h @@ -31,7 +31,7 @@ class CLiftbotHead : public CCarry { private: int _field12C; public: - CLASSDEF + CLASSDEF; CLiftbotHead(); /** diff --git a/engines/titanic/carry/long_stick.h b/engines/titanic/carry/long_stick.h index 60bff0d6f7..2ff5b7228e 100644 --- a/engines/titanic/carry/long_stick.h +++ b/engines/titanic/carry/long_stick.h @@ -29,7 +29,7 @@ namespace Titanic { class CLongStick : public CCarry { public: - CLASSDEF + CLASSDEF; CLongStick(); /** diff --git a/engines/titanic/carry/magazine.h b/engines/titanic/carry/magazine.h index afe9598d3b..69b9937b85 100644 --- a/engines/titanic/carry/magazine.h +++ b/engines/titanic/carry/magazine.h @@ -39,7 +39,7 @@ private: int _field12C; int _field130; public: - CLASSDEF + CLASSDEF; CMagazine(); /** diff --git a/engines/titanic/carry/maitred_left_arm.h b/engines/titanic/carry/maitred_left_arm.h index e59d84e2b7..8f5090b073 100644 --- a/engines/titanic/carry/maitred_left_arm.h +++ b/engines/titanic/carry/maitred_left_arm.h @@ -31,7 +31,7 @@ class CMaitreDLeftArm : public CArm { private: int _field174; public: - CLASSDEF + CLASSDEF; CMaitreDLeftArm() : CArm(), _field174(0) {} /** diff --git a/engines/titanic/carry/maitred_right_arm.h b/engines/titanic/carry/maitred_right_arm.h index f8a7861640..ce07ed7af4 100644 --- a/engines/titanic/carry/maitred_right_arm.h +++ b/engines/titanic/carry/maitred_right_arm.h @@ -29,7 +29,7 @@ namespace Titanic { class CMaitreDRightArm : public CArm { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/carry/mouth.h b/engines/titanic/carry/mouth.h index 0efaf73bbb..e394330494 100644 --- a/engines/titanic/carry/mouth.h +++ b/engines/titanic/carry/mouth.h @@ -29,7 +29,7 @@ namespace Titanic { class CMouth : public CHeadPiece { public: - CLASSDEF + CLASSDEF; CMouth(); /** diff --git a/engines/titanic/carry/napkin.h b/engines/titanic/carry/napkin.h index b94a61837d..cec7a6b7fc 100644 --- a/engines/titanic/carry/napkin.h +++ b/engines/titanic/carry/napkin.h @@ -32,7 +32,7 @@ class CNapkin : public CCarry { DECLARE_MESSAGE_MAP bool UseWithOtherMsg(CUseWithOtherMsg *msg); public: - CLASSDEF + CLASSDEF; CNapkin(); /** diff --git a/engines/titanic/carry/nose.h b/engines/titanic/carry/nose.h index 337617c1c7..b688da231a 100644 --- a/engines/titanic/carry/nose.h +++ b/engines/titanic/carry/nose.h @@ -29,7 +29,7 @@ namespace Titanic { class CNose : public CHeadPiece { public: - CLASSDEF + CLASSDEF; CNose(); /** diff --git a/engines/titanic/carry/note.h b/engines/titanic/carry/note.h index f0563f57da..4edb2024c5 100644 --- a/engines/titanic/carry/note.h +++ b/engines/titanic/carry/note.h @@ -35,7 +35,7 @@ private: CString _string6; int _field138; public: - CLASSDEF + CLASSDEF; CNote(); /** diff --git a/engines/titanic/carry/parcel.h b/engines/titanic/carry/parcel.h index 7209bd31cd..88282a6c14 100644 --- a/engines/titanic/carry/parcel.h +++ b/engines/titanic/carry/parcel.h @@ -30,7 +30,7 @@ namespace Titanic { class CParcel : public CCarry { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; CParcel(); /** diff --git a/engines/titanic/carry/perch.h b/engines/titanic/carry/perch.h index ef04d1130f..d23868d909 100644 --- a/engines/titanic/carry/perch.h +++ b/engines/titanic/carry/perch.h @@ -29,7 +29,7 @@ namespace Titanic { class CPerch : public CCentralCore { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/carry/phonograph_cylinder.h b/engines/titanic/carry/phonograph_cylinder.h index 2f950d175c..ba56bb3ca2 100644 --- a/engines/titanic/carry/phonograph_cylinder.h +++ b/engines/titanic/carry/phonograph_cylinder.h @@ -57,7 +57,7 @@ private: bool _bassInversionControl; bool _bassDirectionControl; public: - CLASSDEF + CLASSDEF; CPhonographCylinder(); /** diff --git a/engines/titanic/carry/phonograph_ear.h b/engines/titanic/carry/phonograph_ear.h index d450f2868e..582db9f7ef 100644 --- a/engines/titanic/carry/phonograph_ear.h +++ b/engines/titanic/carry/phonograph_ear.h @@ -31,7 +31,7 @@ class CPhonographEar : public CEar { private: int _field140; public: - CLASSDEF + CLASSDEF; CPhonographEar() : CEar(), _field140(1) {} /** diff --git a/engines/titanic/carry/photograph.h b/engines/titanic/carry/photograph.h index 3161e4861e..fcae07be07 100644 --- a/engines/titanic/carry/photograph.h +++ b/engines/titanic/carry/photograph.h @@ -42,7 +42,7 @@ private: int _field12C; int _field130; public: - CLASSDEF + CLASSDEF; CPhotograph(); /** diff --git a/engines/titanic/carry/plug_in.h b/engines/titanic/carry/plug_in.h index e788d15869..9601dc161c 100644 --- a/engines/titanic/carry/plug_in.h +++ b/engines/titanic/carry/plug_in.h @@ -33,7 +33,7 @@ class CPlugIn : public CCarry { private: int _field12C; public: - CLASSDEF + CLASSDEF; CPlugIn(); /** diff --git a/engines/titanic/carry/speech_centre.h b/engines/titanic/carry/speech_centre.h index e16556e60f..50f47e9c8a 100644 --- a/engines/titanic/carry/speech_centre.h +++ b/engines/titanic/carry/speech_centre.h @@ -33,7 +33,7 @@ private: CString _string1; int _field14C; public: - CLASSDEF + CLASSDEF; CSpeechCentre() : CBrain(), _string1("Summer"), _field13C(1), _field14C(0) {} diff --git a/engines/titanic/carry/sweets.h b/engines/titanic/carry/sweets.h index 8eb0a1623a..ed598767fc 100644 --- a/engines/titanic/carry/sweets.h +++ b/engines/titanic/carry/sweets.h @@ -32,7 +32,7 @@ class CSweets : public CCarry { DECLARE_MESSAGE_MAP bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); public: - CLASSDEF + CLASSDEF; CSweets(); /** diff --git a/engines/titanic/carry/test_carry.h b/engines/titanic/carry/test_carry.h index b9591a7842..75e8bb9bf0 100644 --- a/engines/titanic/carry/test_carry.h +++ b/engines/titanic/carry/test_carry.h @@ -31,7 +31,7 @@ class CTestArray : public CGameObject { public: int _value1, _value2; public: - CLASSDEF + CLASSDEF; CTestArray() : CGameObject(), _value1(0), _value2(0) {} /** diff --git a/engines/titanic/carry/vision_centre.h b/engines/titanic/carry/vision_centre.h index 6cf2d9d49e..6cf8e2c653 100644 --- a/engines/titanic/carry/vision_centre.h +++ b/engines/titanic/carry/vision_centre.h @@ -29,7 +29,7 @@ namespace Titanic { class CVisionCentre : public CBrain { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/core/background.h b/engines/titanic/core/background.h index ef9a6c3e7b..004ab4d0cf 100644 --- a/engines/titanic/core/background.h +++ b/engines/titanic/core/background.h @@ -40,7 +40,7 @@ protected: CString _string2; int _fieldDC; public: - CLASSDEF + CLASSDEF; CBackground(); /** diff --git a/engines/titanic/core/click_responder.h b/engines/titanic/core/click_responder.h index c682530f76..78381b9948 100644 --- a/engines/titanic/core/click_responder.h +++ b/engines/titanic/core/click_responder.h @@ -31,7 +31,7 @@ class CClickResponder : public CGameObject { protected: CString _string1, _string2; public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/core/dont_save_file_item.h b/engines/titanic/core/dont_save_file_item.h index 242e37372a..92425ae009 100644 --- a/engines/titanic/core/dont_save_file_item.h +++ b/engines/titanic/core/dont_save_file_item.h @@ -30,7 +30,7 @@ namespace Titanic { class CDontSaveFileItem : public CFileItem { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/core/drop_target.h b/engines/titanic/core/drop_target.h index 99734d71f4..4bd0ae448c 100644 --- a/engines/titanic/core/drop_target.h +++ b/engines/titanic/core/drop_target.h @@ -44,7 +44,7 @@ private: int _field110; int _field114; public: - CLASSDEF + CLASSDEF; CDropTarget(); /** diff --git a/engines/titanic/core/file_item.h b/engines/titanic/core/file_item.h index 4210251af0..4b7c341fdb 100644 --- a/engines/titanic/core/file_item.h +++ b/engines/titanic/core/file_item.h @@ -34,7 +34,7 @@ class CFileItem: public CTreeItem { private: CString _filename; public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index bde5e25c58..746ef45db4 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -504,7 +504,7 @@ public: */ static void deinit(); public: - CLASSDEF + CLASSDEF; CGameObject(); ~CGameObject(); diff --git a/engines/titanic/core/game_object_desc_item.h b/engines/titanic/core/game_object_desc_item.h index df9ef7bdd1..7bfecaf5a2 100644 --- a/engines/titanic/core/game_object_desc_item.h +++ b/engines/titanic/core/game_object_desc_item.h @@ -37,7 +37,7 @@ protected: List _list2; CMovieClipList _clipList; public: - CLASSDEF + CLASSDEF; CGameObjectDescItem(); /** diff --git a/engines/titanic/core/link_item.h b/engines/titanic/core/link_item.h index f194bc1361..4b316809fb 100644 --- a/engines/titanic/core/link_item.h +++ b/engines/titanic/core/link_item.h @@ -50,7 +50,7 @@ public: Rect _bounds; CursorId _cursorId; public: - CLASSDEF + CLASSDEF; CLinkItem(); /** diff --git a/engines/titanic/core/list.h b/engines/titanic/core/list.h index eb87d7fe1c..91a74adbdc 100644 --- a/engines/titanic/core/list.h +++ b/engines/titanic/core/list.h @@ -35,7 +35,7 @@ namespace Titanic { */ class ListItem: public CSaveableObject { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/core/mail_man.h b/engines/titanic/core/mail_man.h index 27a6cd11c0..4c63cdfa13 100644 --- a/engines/titanic/core/mail_man.h +++ b/engines/titanic/core/mail_man.h @@ -31,7 +31,7 @@ class CMailMan : public CGameObject { public: int _value; public: - CLASSDEF + CLASSDEF; CMailMan() : CGameObject(), _value(1) {} /** diff --git a/engines/titanic/core/message_target.h b/engines/titanic/core/message_target.h index cfd7ac14e7..05ceaad26a 100644 --- a/engines/titanic/core/message_target.h +++ b/engines/titanic/core/message_target.h @@ -86,7 +86,7 @@ protected: \ class CMessageTarget: public CSaveableObject { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/core/multi_drop_target.h b/engines/titanic/core/multi_drop_target.h index 22cc0941a3..c004b9bece 100644 --- a/engines/titanic/core/multi_drop_target.h +++ b/engines/titanic/core/multi_drop_target.h @@ -32,7 +32,7 @@ public: CString _string5; CString _string6; public: - CLASSDEF + CLASSDEF; CMultiDropTarget() : CDropTarget(), _string5("1,2") {} /** diff --git a/engines/titanic/core/named_item.h b/engines/titanic/core/named_item.h index 889a847e9d..2ff34c7421 100644 --- a/engines/titanic/core/named_item.h +++ b/engines/titanic/core/named_item.h @@ -36,7 +36,7 @@ class CNamedItem: public CTreeItem { public: CString _name; public: - CLASSDEF + CLASSDEF; /** * Dump the item diff --git a/engines/titanic/core/node_item.h b/engines/titanic/core/node_item.h index ff57448c7f..f54e882085 100644 --- a/engines/titanic/core/node_item.h +++ b/engines/titanic/core/node_item.h @@ -33,7 +33,7 @@ public: int _nodeNumber; Point _nodePos; public: - CLASSDEF + CLASSDEF; CNodeItem(); /** diff --git a/engines/titanic/core/project_item.h b/engines/titanic/core/project_item.h index 9270bdf6d1..00c13e52a2 100644 --- a/engines/titanic/core/project_item.h +++ b/engines/titanic/core/project_item.h @@ -56,7 +56,7 @@ class CFileListItem : public ListItem { public: CString _name; public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file @@ -150,7 +150,7 @@ public: */ static bool readSavegameHeader(SimpleFile *file, TitanicSavegameHeader &header); public: - CLASSDEF + CLASSDEF; CProjectItem(); /** diff --git a/engines/titanic/core/resource_key.h b/engines/titanic/core/resource_key.h index eb08334de7..27b23ed1e7 100644 --- a/engines/titanic/core/resource_key.h +++ b/engines/titanic/core/resource_key.h @@ -35,7 +35,7 @@ private: void setValue(const CString &name); public: - CLASSDEF + CLASSDEF; CResourceKey() {} CResourceKey(const CString &name) { setValue(name); } diff --git a/engines/titanic/core/room_item.h b/engines/titanic/core/room_item.h index bcdc95ebe0..22d6e8b40a 100644 --- a/engines/titanic/core/room_item.h +++ b/engines/titanic/core/room_item.h @@ -46,7 +46,7 @@ public: CResourceKey _exitMovieKey; double _roomDimensionX, _roomDimensionY; public: - CLASSDEF + CLASSDEF; CRoomItem(); /** diff --git a/engines/titanic/core/static_image.h b/engines/titanic/core/static_image.h index 27f861ef55..16cae82ff7 100644 --- a/engines/titanic/core/static_image.h +++ b/engines/titanic/core/static_image.h @@ -30,7 +30,7 @@ namespace Titanic { class CStaticImage : public CGameObject { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index 3754bd413e..85d0215e9b 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -45,7 +45,7 @@ private: CTreeItem *_firstChild; int _field14; public: - CLASSDEF + CLASSDEF; CTreeItem(); diff --git a/engines/titanic/core/turn_on_object.h b/engines/titanic/core/turn_on_object.h index 7150069909..67cef9c1ab 100644 --- a/engines/titanic/core/turn_on_object.h +++ b/engines/titanic/core/turn_on_object.h @@ -34,7 +34,7 @@ class CTurnOnObject : public CBackground { protected: CString _msgName; public: - CLASSDEF + CLASSDEF; CTurnOnObject(); /** diff --git a/engines/titanic/core/turn_on_play_sound.h b/engines/titanic/core/turn_on_play_sound.h index 58d33ab78b..1164135071 100644 --- a/engines/titanic/core/turn_on_play_sound.h +++ b/engines/titanic/core/turn_on_play_sound.h @@ -33,7 +33,7 @@ private: int _fieldF8; int _fieldFC; public: - CLASSDEF + CLASSDEF; CTurnOnPlaySound(); /** diff --git a/engines/titanic/core/turn_on_turn_off.h b/engines/titanic/core/turn_on_turn_off.h index 2df8830b0f..adca6876ff 100644 --- a/engines/titanic/core/turn_on_turn_off.h +++ b/engines/titanic/core/turn_on_turn_off.h @@ -35,7 +35,7 @@ private: int _fieldEC; int _fieldF0; public: - CLASSDEF + CLASSDEF; CTurnOnTurnOff(); /** diff --git a/engines/titanic/core/view_item.h b/engines/titanic/core/view_item.h index 4e25c007d9..227319fac6 100644 --- a/engines/titanic/core/view_item.h +++ b/engines/titanic/core/view_item.h @@ -59,7 +59,7 @@ protected: public: int _viewNumber; public: - CLASSDEF + CLASSDEF; CViewItem(); /** diff --git a/engines/titanic/game/announce.h b/engines/titanic/game/announce.h index 3845d96deb..f960241c36 100644 --- a/engines/titanic/game/announce.h +++ b/engines/titanic/game/announce.h @@ -34,7 +34,7 @@ private: int _fieldC4; int _fieldC8; public: - CLASSDEF + CLASSDEF; CAnnounce(); /** diff --git a/engines/titanic/game/annoy_barbot.h b/engines/titanic/game/annoy_barbot.h index e29c0c4ca0..955a82bdf8 100644 --- a/engines/titanic/game/annoy_barbot.h +++ b/engines/titanic/game/annoy_barbot.h @@ -31,7 +31,7 @@ class CAnnoyBarbot : public CGameObject { private: static int _v1; public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/arb_background.h b/engines/titanic/game/arb_background.h index 42276678e7..b80c988d23 100644 --- a/engines/titanic/game/arb_background.h +++ b/engines/titanic/game/arb_background.h @@ -35,7 +35,7 @@ public: int _fieldE8; int _fieldEC; public: - CLASSDEF + CLASSDEF; CArbBackground(); /** diff --git a/engines/titanic/game/arboretum_gate.h b/engines/titanic/game/arboretum_gate.h index bd41dd13f0..7e07261fbd 100644 --- a/engines/titanic/game/arboretum_gate.h +++ b/engines/titanic/game/arboretum_gate.h @@ -74,7 +74,7 @@ private: int _field150; CString _string2; public: - CLASSDEF + CLASSDEF; CArboretumGate(); /** diff --git a/engines/titanic/game/auto_animate.h b/engines/titanic/game/auto_animate.h index fe704004bb..7bca808bfb 100644 --- a/engines/titanic/game/auto_animate.h +++ b/engines/titanic/game/auto_animate.h @@ -35,7 +35,7 @@ private: int _fieldE4; int _fieldE8; public: - CLASSDEF + CLASSDEF; CAutoAnimate() : CBackground(), _fieldE0(1), _fieldE4(1), _fieldE8(0) {} /** diff --git a/engines/titanic/game/bar_bell.h b/engines/titanic/game/bar_bell.h index 9010012887..5d1d2c54e0 100644 --- a/engines/titanic/game/bar_bell.h +++ b/engines/titanic/game/bar_bell.h @@ -37,7 +37,7 @@ public: int _fieldC8; int _fieldCC; public: - CLASSDEF + CLASSDEF; CBarBell(); /** diff --git a/engines/titanic/game/bar_menu.h b/engines/titanic/game/bar_menu.h index db3c93799b..84c0219084 100644 --- a/engines/titanic/game/bar_menu.h +++ b/engines/titanic/game/bar_menu.h @@ -33,7 +33,7 @@ public: int _fieldC0; int _fieldC4; public: - CLASSDEF + CLASSDEF; CBarMenu(); /** diff --git a/engines/titanic/game/bar_menu_button.h b/engines/titanic/game/bar_menu_button.h index fe7d7d913f..c666df413b 100644 --- a/engines/titanic/game/bar_menu_button.h +++ b/engines/titanic/game/bar_menu_button.h @@ -31,7 +31,7 @@ class CBarMenuButton : public CGameObject { public: int _value; public: - CLASSDEF + CLASSDEF; CBarMenuButton() : CGameObject(), _value(1) {} /** diff --git a/engines/titanic/game/belbot_get_light.h b/engines/titanic/game/belbot_get_light.h index dd6f361384..a3aa0f737e 100644 --- a/engines/titanic/game/belbot_get_light.h +++ b/engines/titanic/game/belbot_get_light.h @@ -31,7 +31,7 @@ class CBelbotGetLight : public CGameObject { private: CString _value; public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/bilge_succubus.h b/engines/titanic/game/bilge_succubus.h index 9546d00847..4b2a626dc2 100644 --- a/engines/titanic/game/bilge_succubus.h +++ b/engines/titanic/game/bilge_succubus.h @@ -34,7 +34,7 @@ public: int _field1E4; int _field1E8; public: - CLASSDEF + CLASSDEF; CBilgeSuccUBus(); /** diff --git a/engines/titanic/game/bomb.h b/engines/titanic/game/bomb.h index 59351db27c..ab4df16db0 100644 --- a/engines/titanic/game/bomb.h +++ b/engines/titanic/game/bomb.h @@ -42,7 +42,7 @@ private: int _startingTicks; int _field104; public: - CLASSDEF + CLASSDEF; CBomb(); /** diff --git a/engines/titanic/game/bottom_of_well_monitor.h b/engines/titanic/game/bottom_of_well_monitor.h index cae02b9cb8..65424aad70 100644 --- a/engines/titanic/game/bottom_of_well_monitor.h +++ b/engines/titanic/game/bottom_of_well_monitor.h @@ -32,7 +32,7 @@ public: static int _v1, _v2; int _value; public: - CLASSDEF + CLASSDEF; CBottomOfWellMonitor() : _value(1) {} /** diff --git a/engines/titanic/game/bowl_unlocker.h b/engines/titanic/game/bowl_unlocker.h index 9ab9e63048..2559ac2c52 100644 --- a/engines/titanic/game/bowl_unlocker.h +++ b/engines/titanic/game/bowl_unlocker.h @@ -31,7 +31,7 @@ class CBowlUnlocker : public CGameObject { public: int _value; public: - CLASSDEF + CLASSDEF; CBowlUnlocker() : CGameObject(), _value(0) {} /** diff --git a/engines/titanic/game/brain_slot.h b/engines/titanic/game/brain_slot.h index f94ffc7eca..94b6d7f227 100644 --- a/engines/titanic/game/brain_slot.h +++ b/engines/titanic/game/brain_slot.h @@ -34,7 +34,7 @@ public: int _value1; CString _value2; public: - CLASSDEF + CLASSDEF; CBrainSlot() : CGameObject(), _value1(0) {} /** diff --git a/engines/titanic/game/bridge_door.h b/engines/titanic/game/bridge_door.h index f14d6010a4..c1872a29be 100644 --- a/engines/titanic/game/bridge_door.h +++ b/engines/titanic/game/bridge_door.h @@ -29,7 +29,7 @@ namespace Titanic { class CBridgeDoor : public CGameObject { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/bridge_view.h b/engines/titanic/game/bridge_view.h index be349f3a15..d7c7c35aa9 100644 --- a/engines/titanic/game/bridge_view.h +++ b/engines/titanic/game/bridge_view.h @@ -31,7 +31,7 @@ class CBridgeView : public CBackground { public: int _fieldE0; public: - CLASSDEF + CLASSDEF; CBridgeView() : CBackground(), _fieldE0(0) {} /** diff --git a/engines/titanic/game/broken_pell_base.h b/engines/titanic/game/broken_pell_base.h index d3157fdcff..f62f04d8f8 100644 --- a/engines/titanic/game/broken_pell_base.h +++ b/engines/titanic/game/broken_pell_base.h @@ -35,7 +35,7 @@ private: int _fieldE0; public: - CLASSDEF + CLASSDEF; CBrokenPellBase() : CBackground(), _fieldE0(0) {} /** diff --git a/engines/titanic/game/broken_pellerator.h b/engines/titanic/game/broken_pellerator.h index ebb31d58e1..6fbde91053 100644 --- a/engines/titanic/game/broken_pellerator.h +++ b/engines/titanic/game/broken_pellerator.h @@ -34,7 +34,7 @@ private: CString _string4; CString _string5; public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/broken_pellerator_froz.h b/engines/titanic/game/broken_pellerator_froz.h index cc2ed317a4..1df6d2d0b2 100644 --- a/engines/titanic/game/broken_pellerator_froz.h +++ b/engines/titanic/game/broken_pellerator_froz.h @@ -34,7 +34,7 @@ private: CString _string4; CString _string5; public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/cage.h b/engines/titanic/game/cage.h index 72de9fba7b..bbce978489 100644 --- a/engines/titanic/game/cage.h +++ b/engines/titanic/game/cage.h @@ -32,7 +32,7 @@ public: static int _v1; static int _v2; public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/call_pellerator.h b/engines/titanic/game/call_pellerator.h index fc8110afdb..7da4b40794 100644 --- a/engines/titanic/game/call_pellerator.h +++ b/engines/titanic/game/call_pellerator.h @@ -29,7 +29,7 @@ namespace Titanic { class CCallPellerator : public CGameObject { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/captains_wheel.h b/engines/titanic/game/captains_wheel.h index f817ee709e..549dcbe685 100644 --- a/engines/titanic/game/captains_wheel.h +++ b/engines/titanic/game/captains_wheel.h @@ -36,7 +36,7 @@ public: int _fieldF0; int _fieldF4; public: - CLASSDEF + CLASSDEF; CCaptainsWheel(); /** diff --git a/engines/titanic/game/cdrom.h b/engines/titanic/game/cdrom.h index ece72428bc..9dcb270d74 100644 --- a/engines/titanic/game/cdrom.h +++ b/engines/titanic/game/cdrom.h @@ -38,7 +38,7 @@ class CCDROM : public CGameObject { private: Point _tempPos; public: - CLASSDEF + CLASSDEF; CCDROM(); /** diff --git a/engines/titanic/game/cdrom_computer.h b/engines/titanic/game/cdrom_computer.h index da6e0e778b..90b7b518d1 100644 --- a/engines/titanic/game/cdrom_computer.h +++ b/engines/titanic/game/cdrom_computer.h @@ -34,7 +34,7 @@ class CCDROMComputer : public CGameObject { private: Rect _clickRect; public: - CLASSDEF + CLASSDEF; CCDROMComputer(); /** diff --git a/engines/titanic/game/cdrom_tray.h b/engines/titanic/game/cdrom_tray.h index c91e0450fe..76c7a9a6ad 100644 --- a/engines/titanic/game/cdrom_tray.h +++ b/engines/titanic/game/cdrom_tray.h @@ -37,7 +37,7 @@ public: bool _isOpened; CString _insertedCD; public: - CLASSDEF + CLASSDEF; CCDROMTray(); /** diff --git a/engines/titanic/game/cell_point_button.h b/engines/titanic/game/cell_point_button.h index 0a04350838..6f1fdc3809 100644 --- a/engines/titanic/game/cell_point_button.h +++ b/engines/titanic/game/cell_point_button.h @@ -43,7 +43,7 @@ public: CString _string3; int _field118; public: - CLASSDEF + CLASSDEF; CCellPointButton(); /** diff --git a/engines/titanic/game/chev_code.h b/engines/titanic/game/chev_code.h index df7421e06f..c4552d00a2 100644 --- a/engines/titanic/game/chev_code.h +++ b/engines/titanic/game/chev_code.h @@ -31,7 +31,7 @@ class CChevCode : public CGameObject { public: int _value; public: - CLASSDEF + CLASSDEF; CChevCode() : CGameObject(), _value(0) {} /** diff --git a/engines/titanic/game/chev_panel.h b/engines/titanic/game/chev_panel.h index e53a94e69e..99b5501ac2 100644 --- a/engines/titanic/game/chev_panel.h +++ b/engines/titanic/game/chev_panel.h @@ -33,7 +33,7 @@ public: int _fieldC0; int _fieldC4; public: - CLASSDEF + CLASSDEF; CChevPanel() : _fieldBC(0), _fieldC0(0), _fieldC4(0) {} /** diff --git a/engines/titanic/game/chicken_cooler.h b/engines/titanic/game/chicken_cooler.h index b735b0f9c9..724727b905 100644 --- a/engines/titanic/game/chicken_cooler.h +++ b/engines/titanic/game/chicken_cooler.h @@ -34,7 +34,7 @@ private: int _fieldBC; int _fieldC0; public: - CLASSDEF + CLASSDEF; CChickenCooler() : CGameObject(), _fieldBC(0), _fieldC0(0) {} /** diff --git a/engines/titanic/game/chicken_dispensor.h b/engines/titanic/game/chicken_dispensor.h index 21163c681c..d86b850871 100644 --- a/engines/titanic/game/chicken_dispensor.h +++ b/engines/titanic/game/chicken_dispensor.h @@ -33,7 +33,7 @@ public: int _fieldE4; int _fieldE8; public: - CLASSDEF + CLASSDEF; CChickenDispensor(); /** diff --git a/engines/titanic/game/close_broken_pel.h b/engines/titanic/game/close_broken_pel.h index 252d0895cf..aacda6c002 100644 --- a/engines/titanic/game/close_broken_pel.h +++ b/engines/titanic/game/close_broken_pel.h @@ -31,7 +31,7 @@ class CCloseBrokenPel : public CBackground { public: CString _string3; public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/code_wheel.h b/engines/titanic/game/code_wheel.h index 1776ad6055..63af97c6fb 100644 --- a/engines/titanic/game/code_wheel.h +++ b/engines/titanic/game/code_wheel.h @@ -33,7 +33,7 @@ private: int _field10C; int _field110; public: - CLASSDEF + CLASSDEF; CodeWheel(); /** diff --git a/engines/titanic/game/computer.h b/engines/titanic/game/computer.h index e9716aa08a..f64f723733 100644 --- a/engines/titanic/game/computer.h +++ b/engines/titanic/game/computer.h @@ -36,7 +36,7 @@ public: CString _currentCD; int _state; public: - CLASSDEF + CLASSDEF; CComputer() : CBackground(), _currentCD("None"), _state(0) {} /** diff --git a/engines/titanic/game/computer_screen.h b/engines/titanic/game/computer_screen.h index 032c724ba6..1aed01c723 100644 --- a/engines/titanic/game/computer_screen.h +++ b/engines/titanic/game/computer_screen.h @@ -34,7 +34,7 @@ class CComputerScreen : public CGameObject { bool EnterViewMsg(CEnterViewMsg *msg); bool TimerMsg(CTimerMsg *msg); public: - CLASSDEF + CLASSDEF; CComputerScreen(); /** diff --git a/engines/titanic/game/cookie.h b/engines/titanic/game/cookie.h index 72b29dc078..7ae04f1144 100644 --- a/engines/titanic/game/cookie.h +++ b/engines/titanic/game/cookie.h @@ -32,7 +32,7 @@ public: int _value1; int _value2; public: - CLASSDEF + CLASSDEF; CCookie() : CGameObject(), _value1(0), _value2(0) {} /** diff --git a/engines/titanic/game/credits.h b/engines/titanic/game/credits.h index 5b3fe290d6..fa9794b6de 100644 --- a/engines/titanic/game/credits.h +++ b/engines/titanic/game/credits.h @@ -31,7 +31,7 @@ class CCredits : public CGameObject { public: int _fieldBC, _fieldC0; public: - CLASSDEF + CLASSDEF; CCredits(); /** diff --git a/engines/titanic/game/credits_button.h b/engines/titanic/game/credits_button.h index 74fcdc03b5..5e0bf96677 100644 --- a/engines/titanic/game/credits_button.h +++ b/engines/titanic/game/credits_button.h @@ -31,7 +31,7 @@ class CCreditsButton : public CBackground { public: int _fieldE0; public: - CLASSDEF + CLASSDEF; CCreditsButton(); /** diff --git a/engines/titanic/game/dead_area.h b/engines/titanic/game/dead_area.h index 8bffed75ca..05a3f4ed62 100644 --- a/engines/titanic/game/dead_area.h +++ b/engines/titanic/game/dead_area.h @@ -36,7 +36,7 @@ class CDeadArea : public CGameObject { bool MouseButtonDownMsg(CMouseButtonDownMsg *msg) { return true; } bool MouseButtonUpMsg(CMouseButtonUpMsg *msg) { return true; } public: - CLASSDEF + CLASSDEF; CDeadArea(); /** diff --git a/engines/titanic/game/desk_click_responder.h b/engines/titanic/game/desk_click_responder.h index 3967b687db..12825ba9de 100644 --- a/engines/titanic/game/desk_click_responder.h +++ b/engines/titanic/game/desk_click_responder.h @@ -32,7 +32,7 @@ protected: int _fieldD4; int _fieldD8; public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/doorbot_elevator_handler.h b/engines/titanic/game/doorbot_elevator_handler.h index 57722c5448..7b39e727e3 100644 --- a/engines/titanic/game/doorbot_elevator_handler.h +++ b/engines/titanic/game/doorbot_elevator_handler.h @@ -34,7 +34,7 @@ private: static int _v1; int _value; public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/doorbot_home_handler.h b/engines/titanic/game/doorbot_home_handler.h index 66cec70ee9..99ba6d37a9 100644 --- a/engines/titanic/game/doorbot_home_handler.h +++ b/engines/titanic/game/doorbot_home_handler.h @@ -29,7 +29,7 @@ namespace Titanic { class CDoorbotHomeHandler : public CGameObject { public: - CLASSDEF + CLASSDEF; CDoorbotHomeHandler(); /** diff --git a/engines/titanic/game/ear_sweet_bowl.h b/engines/titanic/game/ear_sweet_bowl.h index a5386d4da0..3f41950e47 100644 --- a/engines/titanic/game/ear_sweet_bowl.h +++ b/engines/titanic/game/ear_sweet_bowl.h @@ -29,7 +29,7 @@ namespace Titanic { class CEarSweetBowl : public CSweetBowl { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/eject_phonograph_button.h b/engines/titanic/game/eject_phonograph_button.h index 670670b56f..5f5da8053e 100644 --- a/engines/titanic/game/eject_phonograph_button.h +++ b/engines/titanic/game/eject_phonograph_button.h @@ -34,7 +34,7 @@ public: CString _string3; CString _string4; public: - CLASSDEF + CLASSDEF; CEjectPhonographButton() : CBackground(), _fieldE0(0), _fieldE4(0) {} /** diff --git a/engines/titanic/game/elevator_action_area.h b/engines/titanic/game/elevator_action_area.h index 361f19afb8..6c756fb95f 100644 --- a/engines/titanic/game/elevator_action_area.h +++ b/engines/titanic/game/elevator_action_area.h @@ -31,7 +31,7 @@ class CElevatorActionArea : public CGameObject { public: int _value; public: - CLASSDEF + CLASSDEF; CElevatorActionArea() : CGameObject(), _value(4) {} /** diff --git a/engines/titanic/game/emma_control.h b/engines/titanic/game/emma_control.h index 654d3c5237..721660f61e 100644 --- a/engines/titanic/game/emma_control.h +++ b/engines/titanic/game/emma_control.h @@ -33,7 +33,7 @@ private: CString _wavFile1, _wavFile2; public: - CLASSDEF + CLASSDEF; CEmmaControl() : CBackground(), _wavFile1("b#39.wav"), _wavFile2("b#38.wav") {} /** diff --git a/engines/titanic/game/empty_nut_bowl.h b/engines/titanic/game/empty_nut_bowl.h index 31f31e2339..112e2c6075 100644 --- a/engines/titanic/game/empty_nut_bowl.h +++ b/engines/titanic/game/empty_nut_bowl.h @@ -31,7 +31,7 @@ class CEmptyNutBowl : public CGameObject { public: int _value; public: - CLASSDEF + CLASSDEF; CEmptyNutBowl() : CGameObject(), _value(1) {} /** diff --git a/engines/titanic/game/end_credit_text.h b/engines/titanic/game/end_credit_text.h index 137e51094e..54c6c7ff73 100644 --- a/engines/titanic/game/end_credit_text.h +++ b/engines/titanic/game/end_credit_text.h @@ -31,7 +31,7 @@ class CEndCreditText : public CGameObject { private: int _value; public: - CLASSDEF + CLASSDEF; CEndCreditText() : CGameObject(), _value(0) {} /** diff --git a/engines/titanic/game/end_credits.h b/engines/titanic/game/end_credits.h index 9aad29769a..d160bc94e8 100644 --- a/engines/titanic/game/end_credits.h +++ b/engines/titanic/game/end_credits.h @@ -31,7 +31,7 @@ class CEndCredits : public CGameObject { public: int _value; public: - CLASSDEF + CLASSDEF; CEndCredits() : CGameObject(), _value(0) {} /** diff --git a/engines/titanic/game/end_explode_ship.h b/engines/titanic/game/end_explode_ship.h index 48bbeca897..b8159d3ca7 100644 --- a/engines/titanic/game/end_explode_ship.h +++ b/engines/titanic/game/end_explode_ship.h @@ -31,7 +31,7 @@ class CEndExplodeShip : public CGameObject { public: int _value1, _value2; public: - CLASSDEF + CLASSDEF; CEndExplodeShip() : CGameObject(), _value1(0), _value2(0) {} /** diff --git a/engines/titanic/game/end_game_credits.h b/engines/titanic/game/end_game_credits.h index 5eee5fc7c8..5962950737 100644 --- a/engines/titanic/game/end_game_credits.h +++ b/engines/titanic/game/end_game_credits.h @@ -32,7 +32,7 @@ private: int _fieldBC; Point _pos1; public: - CLASSDEF + CLASSDEF; CEndGameCredits(); /** diff --git a/engines/titanic/game/end_sequence_control.h b/engines/titanic/game/end_sequence_control.h index 0a9d6f0717..35e9a934e1 100644 --- a/engines/titanic/game/end_sequence_control.h +++ b/engines/titanic/game/end_sequence_control.h @@ -31,7 +31,7 @@ namespace Titanic { class CEndSequenceControl : public CGameObject { bool EnterRoomMsg(CEnterRoomMsg *msg); public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/fan.h b/engines/titanic/game/fan.h index d3cf527b08..2c5a2410a8 100644 --- a/engines/titanic/game/fan.h +++ b/engines/titanic/game/fan.h @@ -31,7 +31,7 @@ class CFan : public CGameObject { public: int _value1, _value2; public: - CLASSDEF + CLASSDEF; CFan() : CGameObject(), _value1(0), _value2(0) {} /** diff --git a/engines/titanic/game/fan_control.h b/engines/titanic/game/fan_control.h index 14b56db152..4d89adb311 100644 --- a/engines/titanic/game/fan_control.h +++ b/engines/titanic/game/fan_control.h @@ -35,7 +35,7 @@ public: int _fieldC8; int _fieldCC; public: - CLASSDEF + CLASSDEF; CFanControl(); /** diff --git a/engines/titanic/game/fan_decrease.h b/engines/titanic/game/fan_decrease.h index 7d0c4a3671..765c7d1560 100644 --- a/engines/titanic/game/fan_decrease.h +++ b/engines/titanic/game/fan_decrease.h @@ -29,7 +29,7 @@ namespace Titanic { class CFanDecrease : public CGameObject { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/fan_increase.h b/engines/titanic/game/fan_increase.h index e81ff4640f..08ec1322cd 100644 --- a/engines/titanic/game/fan_increase.h +++ b/engines/titanic/game/fan_increase.h @@ -29,7 +29,7 @@ namespace Titanic { class CFanIncrease : public CGameObject { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/fan_noises.h b/engines/titanic/game/fan_noises.h index f187853097..bb2c35989d 100644 --- a/engines/titanic/game/fan_noises.h +++ b/engines/titanic/game/fan_noises.h @@ -39,7 +39,7 @@ private: int _fieldD0; int _fieldD4; public: - CLASSDEF + CLASSDEF; CFanNoises(); /** diff --git a/engines/titanic/game/floor_indicator.h b/engines/titanic/game/floor_indicator.h index ccd6a8b797..066209e52e 100644 --- a/engines/titanic/game/floor_indicator.h +++ b/engines/titanic/game/floor_indicator.h @@ -29,7 +29,7 @@ namespace Titanic { class CFloorIndicator : public CGameObject { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/games_console.h b/engines/titanic/game/games_console.h index 8d37186b6d..2b1da70e96 100644 --- a/engines/titanic/game/games_console.h +++ b/engines/titanic/game/games_console.h @@ -31,7 +31,7 @@ class CGamesConsole : public CBackground { public: int _fieldE0; public: - CLASSDEF + CLASSDEF; CGamesConsole() : CBackground(), _fieldE0(0) {} /** diff --git a/engines/titanic/game/get_lift_eye2.h b/engines/titanic/game/get_lift_eye2.h index 7a3caa1283..496784a3c1 100644 --- a/engines/titanic/game/get_lift_eye2.h +++ b/engines/titanic/game/get_lift_eye2.h @@ -32,7 +32,7 @@ class CGetLiftEye2 : public CGameObject { public: static CString *_v1; public: - CLASSDEF + CLASSDEF; static void init(); static void deinit(); diff --git a/engines/titanic/game/glass_smasher.h b/engines/titanic/game/glass_smasher.h index 1c4e703bea..7e38f4e36b 100644 --- a/engines/titanic/game/glass_smasher.h +++ b/engines/titanic/game/glass_smasher.h @@ -29,7 +29,7 @@ namespace Titanic { class CGlassSmasher : public CGameObject { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/gondolier/gondolier_base.h b/engines/titanic/game/gondolier/gondolier_base.h index e5efaf8a35..a7ea2d4931 100644 --- a/engines/titanic/game/gondolier/gondolier_base.h +++ b/engines/titanic/game/gondolier/gondolier_base.h @@ -40,7 +40,7 @@ private: static int _v9; static int _v10; public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/gondolier/gondolier_chest.h b/engines/titanic/game/gondolier/gondolier_chest.h index 55e5a2ba75..d796917371 100644 --- a/engines/titanic/game/gondolier/gondolier_chest.h +++ b/engines/titanic/game/gondolier/gondolier_chest.h @@ -29,7 +29,7 @@ namespace Titanic { class CGondolierChest : public CGondolierBase { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/gondolier/gondolier_face.h b/engines/titanic/game/gondolier/gondolier_face.h index 03e221e030..71bdd6d444 100644 --- a/engines/titanic/game/gondolier/gondolier_face.h +++ b/engines/titanic/game/gondolier/gondolier_face.h @@ -31,7 +31,7 @@ class CGondolierFace : public CGondolierBase { private: int _fieldBC; public: - CLASSDEF + CLASSDEF; CGondolierFace() : CGondolierBase(), _fieldBC(0) {} /** diff --git a/engines/titanic/game/gondolier/gondolier_mixer.h b/engines/titanic/game/gondolier/gondolier_mixer.h index 0276de16c8..247e520ba6 100644 --- a/engines/titanic/game/gondolier/gondolier_mixer.h +++ b/engines/titanic/game/gondolier/gondolier_mixer.h @@ -39,7 +39,7 @@ private: CString _string2; int _fieldE4; public: - CLASSDEF + CLASSDEF; CGondolierMixer(); /** diff --git a/engines/titanic/game/gondolier/gondolier_slider.h b/engines/titanic/game/gondolier/gondolier_slider.h index c5fd08f8cf..0ae14a91a0 100644 --- a/engines/titanic/game/gondolier/gondolier_slider.h +++ b/engines/titanic/game/gondolier/gondolier_slider.h @@ -48,7 +48,7 @@ private: CString _string3; int _field118; public: - CLASSDEF + CLASSDEF; CGondolierSlider(); /** diff --git a/engines/titanic/game/hammer_clip.h b/engines/titanic/game/hammer_clip.h index 01f419c8e4..7f5c5ab5f8 100644 --- a/engines/titanic/game/hammer_clip.h +++ b/engines/titanic/game/hammer_clip.h @@ -31,7 +31,7 @@ class CHammerClip : public CGameObject { public: int _value; public: - CLASSDEF + CLASSDEF; CHammerClip() : CGameObject(), _value(0) {} /** diff --git a/engines/titanic/game/hammer_dispensor.h b/engines/titanic/game/hammer_dispensor.h index 9a58850e66..e1b30d9045 100644 --- a/engines/titanic/game/hammer_dispensor.h +++ b/engines/titanic/game/hammer_dispensor.h @@ -33,7 +33,7 @@ private: int _fieldE4; int _fieldE8; public: - CLASSDEF + CLASSDEF; CHammerDispensor(); /** diff --git a/engines/titanic/game/hammer_dispensor_button.h b/engines/titanic/game/hammer_dispensor_button.h index 5b91bbd974..36732adb2d 100644 --- a/engines/titanic/game/hammer_dispensor_button.h +++ b/engines/titanic/game/hammer_dispensor_button.h @@ -37,7 +37,7 @@ private: int _field10C; int _field110; public: - CLASSDEF + CLASSDEF; CHammerDispensorButton(); /** diff --git a/engines/titanic/game/head_slot.h b/engines/titanic/game/head_slot.h index b09794774e..0080411033 100644 --- a/engines/titanic/game/head_slot.h +++ b/engines/titanic/game/head_slot.h @@ -41,7 +41,7 @@ public: int _fieldE8; int _fieldEC; public: - CLASSDEF + CLASSDEF; CHeadSlot(); /** diff --git a/engines/titanic/game/head_smash_event.h b/engines/titanic/game/head_smash_event.h index 9e21080a93..912cf36bf3 100644 --- a/engines/titanic/game/head_smash_event.h +++ b/engines/titanic/game/head_smash_event.h @@ -29,7 +29,7 @@ namespace Titanic { class CHeadSmashEvent : public CBackground { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/head_smash_lever.h b/engines/titanic/game/head_smash_lever.h index a35a18c0a6..b8f04d39de 100644 --- a/engines/titanic/game/head_smash_lever.h +++ b/engines/titanic/game/head_smash_lever.h @@ -33,7 +33,7 @@ public: int _fieldE4; int _fieldE8; public: - CLASSDEF + CLASSDEF; CHeadSmashLever(); /** diff --git a/engines/titanic/game/head_spinner.h b/engines/titanic/game/head_spinner.h index 8f1f8c2477..4456070ee4 100644 --- a/engines/titanic/game/head_spinner.h +++ b/engines/titanic/game/head_spinner.h @@ -32,7 +32,7 @@ public: int _value1, _value2; public: CHeadSpinner() : CGameObject(), _value1(0), _value2(0) {} - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/idle_summoner.h b/engines/titanic/game/idle_summoner.h index ccee7bc8fd..1d9fcdd176 100644 --- a/engines/titanic/game/idle_summoner.h +++ b/engines/titanic/game/idle_summoner.h @@ -40,7 +40,7 @@ public: int _fieldDC; public: CIdleSummoner(); - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/leave_sec_class_state.h b/engines/titanic/game/leave_sec_class_state.h index fe55b9439a..67300b6b17 100644 --- a/engines/titanic/game/leave_sec_class_state.h +++ b/engines/titanic/game/leave_sec_class_state.h @@ -30,7 +30,7 @@ namespace Titanic { class CLeaveSecClassState : public CGameObject { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/lemon_dispensor.h b/engines/titanic/game/lemon_dispensor.h index fe5ab529af..d6315ed620 100644 --- a/engines/titanic/game/lemon_dispensor.h +++ b/engines/titanic/game/lemon_dispensor.h @@ -38,7 +38,7 @@ private: int _fieldE8; int _fieldEC; public: - CLASSDEF + CLASSDEF; CLemonDispensor(); /** diff --git a/engines/titanic/game/light.h b/engines/titanic/game/light.h index b919c5f06c..79e4bc400e 100644 --- a/engines/titanic/game/light.h +++ b/engines/titanic/game/light.h @@ -40,7 +40,7 @@ private: int _fieldF8; int _fieldFC; public: - CLASSDEF + CLASSDEF; CLight(); /** diff --git a/engines/titanic/game/light_switch.h b/engines/titanic/game/light_switch.h index c8728e06ff..ce62d7d68c 100644 --- a/engines/titanic/game/light_switch.h +++ b/engines/titanic/game/light_switch.h @@ -37,7 +37,7 @@ private: int _fieldE4; int _fieldE8; public: - CLASSDEF + CLASSDEF; CLightSwitch(); /** diff --git a/engines/titanic/game/little_lift_button.h b/engines/titanic/game/little_lift_button.h index 451c6ced95..b14651f4b8 100644 --- a/engines/titanic/game/little_lift_button.h +++ b/engines/titanic/game/little_lift_button.h @@ -31,7 +31,7 @@ class CLittleLiftButton : public CBackground { private: int _value; public: - CLASSDEF + CLASSDEF; CLittleLiftButton() : CBackground(), _value(0) {} /** diff --git a/engines/titanic/game/long_stick_dispenser.h b/engines/titanic/game/long_stick_dispenser.h index 63066866c7..2a1b86fb84 100644 --- a/engines/titanic/game/long_stick_dispenser.h +++ b/engines/titanic/game/long_stick_dispenser.h @@ -35,7 +35,7 @@ private: int _fieldC0; int _fieldC4; public: - CLASSDEF + CLASSDEF; CLongStickDispenser() : CGameObject(), _fieldBC(0), _fieldC0(0), _fieldC4(1) {} diff --git a/engines/titanic/game/maitred/maitred_arm_holder.h b/engines/titanic/game/maitred/maitred_arm_holder.h index c823bd94cf..3392d60e43 100644 --- a/engines/titanic/game/maitred/maitred_arm_holder.h +++ b/engines/titanic/game/maitred/maitred_arm_holder.h @@ -29,7 +29,7 @@ namespace Titanic { class CMaitreDArmHolder : public CDropTarget { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/maitred/maitred_body.h b/engines/titanic/game/maitred/maitred_body.h index 52e2ac8fe6..7016c15c71 100644 --- a/engines/titanic/game/maitred/maitred_body.h +++ b/engines/titanic/game/maitred/maitred_body.h @@ -31,7 +31,7 @@ class CMaitreDBody : public CMaitreDProdReceptor { private: int _fieldC8; public: - CLASSDEF + CLASSDEF; CMaitreDBody() : CMaitreDProdReceptor(), _fieldC8(1) {} /** diff --git a/engines/titanic/game/maitred/maitred_legs.h b/engines/titanic/game/maitred/maitred_legs.h index 5ee9482d18..24ba01e712 100644 --- a/engines/titanic/game/maitred/maitred_legs.h +++ b/engines/titanic/game/maitred/maitred_legs.h @@ -31,7 +31,7 @@ class CMaitreDLegs : public CMaitreDProdReceptor { private: int _fieldC8; public: - CLASSDEF + CLASSDEF; CMaitreDLegs() : CMaitreDProdReceptor(), _fieldC8(1) {} /** diff --git a/engines/titanic/game/maitred/maitred_prod_receptor.h b/engines/titanic/game/maitred/maitred_prod_receptor.h index 5138d46e6e..f3a547b8ef 100644 --- a/engines/titanic/game/maitred/maitred_prod_receptor.h +++ b/engines/titanic/game/maitred/maitred_prod_receptor.h @@ -33,7 +33,7 @@ protected: int _fieldC0; int _fieldC4; public: - CLASSDEF + CLASSDEF; CMaitreDProdReceptor() : CGameObject(), _fieldBC(0), _fieldC0(0), _fieldC4(1) {} diff --git a/engines/titanic/game/missiveomat.h b/engines/titanic/game/missiveomat.h index 1b7850ff3d..7fde8cf25d 100644 --- a/engines/titanic/game/missiveomat.h +++ b/engines/titanic/game/missiveomat.h @@ -36,7 +36,7 @@ public: CString _string2; int _fieldE0; public: - CLASSDEF + CLASSDEF; CMissiveOMat(); /** diff --git a/engines/titanic/game/missiveomat_button.h b/engines/titanic/game/missiveomat_button.h index eb00b7e2a2..d36f5bd958 100644 --- a/engines/titanic/game/missiveomat_button.h +++ b/engines/titanic/game/missiveomat_button.h @@ -31,7 +31,7 @@ class CMissiveOMatButton : public CEditControl { public: int _fieldFC; public: - CLASSDEF + CLASSDEF; CMissiveOMatButton() : CEditControl(), _fieldFC(2) {} /** diff --git a/engines/titanic/game/movie_tester.h b/engines/titanic/game/movie_tester.h index cf39ae3f61..de2ef2cc5e 100644 --- a/engines/titanic/game/movie_tester.h +++ b/engines/titanic/game/movie_tester.h @@ -31,7 +31,7 @@ class CMovieTester : public CGameObject { public: int _value1, _value2; public: - CLASSDEF + CLASSDEF; CMovieTester() : CGameObject(), _value1(0), _value2(0) {} /** diff --git a/engines/titanic/game/music_console_button.h b/engines/titanic/game/music_console_button.h index 1a1861b36b..8e05b698d7 100644 --- a/engines/titanic/game/music_console_button.h +++ b/engines/titanic/game/music_console_button.h @@ -29,7 +29,7 @@ namespace Titanic { class CMusicConsoleButton : public CMusicPlayer { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/music_room_phonograph.h b/engines/titanic/game/music_room_phonograph.h index dcc7267cde..58afe7f427 100644 --- a/engines/titanic/game/music_room_phonograph.h +++ b/engines/titanic/game/music_room_phonograph.h @@ -32,7 +32,7 @@ class CMusicRoomPhonograph : public CRestaurantPhonograph { private: int _field118; public: - CLASSDEF + CLASSDEF; CMusicRoomPhonograph() : CRestaurantPhonograph(), _field118(0) {} /** diff --git a/engines/titanic/game/music_room_stop_phonograph_button.h b/engines/titanic/game/music_room_stop_phonograph_button.h index 81cd755526..7260e5aaab 100644 --- a/engines/titanic/game/music_room_stop_phonograph_button.h +++ b/engines/titanic/game/music_room_stop_phonograph_button.h @@ -31,7 +31,7 @@ class CMusicRoomStopPhonographButton : public CEjectPhonographButton { private: int _field100; public: - CLASSDEF + CLASSDEF; CMusicRoomStopPhonographButton() : CEjectPhonographButton(), _field100(0) {} /** diff --git a/engines/titanic/game/music_system_lock.h b/engines/titanic/game/music_system_lock.h index ad722caccf..ff826f5c77 100644 --- a/engines/titanic/game/music_system_lock.h +++ b/engines/titanic/game/music_system_lock.h @@ -31,7 +31,7 @@ class CMusicSystemLock : public CDropTarget { private: int _value; public: - CLASSDEF + CLASSDEF; CMusicSystemLock() : CDropTarget(), _value(0) {} /** diff --git a/engines/titanic/game/musical_instrument.h b/engines/titanic/game/musical_instrument.h index 273770c2e6..8b534606e0 100644 --- a/engines/titanic/game/musical_instrument.h +++ b/engines/titanic/game/musical_instrument.h @@ -30,7 +30,7 @@ namespace Titanic { class CMusicalInstrument : public CBackground { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/nav_helmet.h b/engines/titanic/game/nav_helmet.h index 5e17622b65..74caa52534 100644 --- a/engines/titanic/game/nav_helmet.h +++ b/engines/titanic/game/nav_helmet.h @@ -31,7 +31,7 @@ class CNavHelmet : public CGameObject { private: int _value; public: - CLASSDEF + CLASSDEF; CNavHelmet() : CGameObject(), _value(0) {} /** diff --git a/engines/titanic/game/navigation_computer.h b/engines/titanic/game/navigation_computer.h index f24cbada34..6de75437a5 100644 --- a/engines/titanic/game/navigation_computer.h +++ b/engines/titanic/game/navigation_computer.h @@ -30,7 +30,7 @@ namespace Titanic { class CNavigationComputer : public CGameObject { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/no_nut_bowl.h b/engines/titanic/game/no_nut_bowl.h index 5cb3aa2c43..548b324869 100644 --- a/engines/titanic/game/no_nut_bowl.h +++ b/engines/titanic/game/no_nut_bowl.h @@ -29,7 +29,7 @@ namespace Titanic { class CNoNutBowl : public CBackground { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/nose_holder.h b/engines/titanic/game/nose_holder.h index 6e25835465..b8cca95869 100644 --- a/engines/titanic/game/nose_holder.h +++ b/engines/titanic/game/nose_holder.h @@ -32,7 +32,7 @@ private: int _field118; int _field11C; public: - CLASSDEF + CLASSDEF; CNoseHolder(); /** diff --git a/engines/titanic/game/null_port_hole.h b/engines/titanic/game/null_port_hole.h index 3170a84b39..2924aff9f5 100644 --- a/engines/titanic/game/null_port_hole.h +++ b/engines/titanic/game/null_port_hole.h @@ -30,7 +30,7 @@ namespace Titanic { class CNullPortHole : public CClickResponder { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; CNullPortHole(); /** diff --git a/engines/titanic/game/nut_replacer.h b/engines/titanic/game/nut_replacer.h index 6a8e014751..ead9713801 100644 --- a/engines/titanic/game/nut_replacer.h +++ b/engines/titanic/game/nut_replacer.h @@ -29,7 +29,7 @@ namespace Titanic { class CNutReplacer : public CGameObject { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/parrot/parrot_lobby_controller.h b/engines/titanic/game/parrot/parrot_lobby_controller.h index 9f5ddcab75..d2fa4a1801 100644 --- a/engines/titanic/game/parrot/parrot_lobby_controller.h +++ b/engines/titanic/game/parrot/parrot_lobby_controller.h @@ -29,7 +29,7 @@ namespace Titanic { class CParrotLobbyController : public CParrotLobbyObject { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/parrot/parrot_lobby_link_updater.h b/engines/titanic/game/parrot/parrot_lobby_link_updater.h index a433f0be84..0470a62dee 100644 --- a/engines/titanic/game/parrot/parrot_lobby_link_updater.h +++ b/engines/titanic/game/parrot/parrot_lobby_link_updater.h @@ -31,7 +31,7 @@ class CParrotLobbyLinkUpdater : public CParrotLobbyObject { public: int _fieldBC; public: - CLASSDEF + CLASSDEF; CParrotLobbyLinkUpdater() : CParrotLobbyObject(), _fieldBC(1) {} /** diff --git a/engines/titanic/game/parrot/parrot_lobby_object.h b/engines/titanic/game/parrot/parrot_lobby_object.h index 967ad23fd8..dfb6592325 100644 --- a/engines/titanic/game/parrot/parrot_lobby_object.h +++ b/engines/titanic/game/parrot/parrot_lobby_object.h @@ -37,7 +37,7 @@ public: static void init(); public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/parrot/parrot_lobby_view_object.h b/engines/titanic/game/parrot/parrot_lobby_view_object.h index 656924ff9f..3179bb962d 100644 --- a/engines/titanic/game/parrot/parrot_lobby_view_object.h +++ b/engines/titanic/game/parrot/parrot_lobby_view_object.h @@ -31,7 +31,7 @@ class CParrotLobbyViewObject : public CParrotLobbyObject { public: int _fieldBC; public: - CLASSDEF + CLASSDEF; CParrotLobbyViewObject() : CParrotLobbyObject(), _fieldBC(1) {} /** diff --git a/engines/titanic/game/parrot/parrot_loser.h b/engines/titanic/game/parrot/parrot_loser.h index c1e6c9fddd..819fd6614c 100644 --- a/engines/titanic/game/parrot/parrot_loser.h +++ b/engines/titanic/game/parrot/parrot_loser.h @@ -29,7 +29,7 @@ namespace Titanic { class CParrotLoser : public CGameObject { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/parrot/parrot_nut_bowl_actor.h b/engines/titanic/game/parrot/parrot_nut_bowl_actor.h index 34be83a918..d8395bb65a 100644 --- a/engines/titanic/game/parrot/parrot_nut_bowl_actor.h +++ b/engines/titanic/game/parrot/parrot_nut_bowl_actor.h @@ -31,7 +31,7 @@ class CParrotNutBowlActor : public CGameObject { public: int _value1, _value2; public: - CLASSDEF + CLASSDEF; CParrotNutBowlActor(); /** diff --git a/engines/titanic/game/parrot/parrot_nut_eater.h b/engines/titanic/game/parrot/parrot_nut_eater.h index fe0a3aeb0f..5dcb01ca11 100644 --- a/engines/titanic/game/parrot/parrot_nut_eater.h +++ b/engines/titanic/game/parrot/parrot_nut_eater.h @@ -35,7 +35,7 @@ public: int _fieldC8; int _fieldCC; public: - CLASSDEF + CLASSDEF; CParrotNutEater(); /** diff --git a/engines/titanic/game/parrot/parrot_perch_holder.h b/engines/titanic/game/parrot/parrot_perch_holder.h index 8c7a441001..ff618f09dc 100644 --- a/engines/titanic/game/parrot/parrot_perch_holder.h +++ b/engines/titanic/game/parrot/parrot_perch_holder.h @@ -29,7 +29,7 @@ namespace Titanic { class CParrotPerchHolder : public CMultiDropTarget { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/parrot/parrot_succubus.h b/engines/titanic/game/parrot/parrot_succubus.h index 7984cc6a8c..6f5d9e602a 100644 --- a/engines/titanic/game/parrot/parrot_succubus.h +++ b/engines/titanic/game/parrot/parrot_succubus.h @@ -35,7 +35,7 @@ public: int _field1F0; int _field1F4; public: - CLASSDEF + CLASSDEF; CParrotSuccUBus(); /** diff --git a/engines/titanic/game/parrot/parrot_trigger.h b/engines/titanic/game/parrot/parrot_trigger.h index f2d1d7e904..28a1663fa8 100644 --- a/engines/titanic/game/parrot/parrot_trigger.h +++ b/engines/titanic/game/parrot/parrot_trigger.h @@ -31,7 +31,7 @@ class CParrotTrigger : public CGameObject { public: int _value; public: - CLASSDEF + CLASSDEF; CParrotTrigger() : CGameObject(), _value(0x446AB) {} /** diff --git a/engines/titanic/game/parrot/player_meets_parrot.h b/engines/titanic/game/parrot/player_meets_parrot.h index 0a720993a5..9cee9ee322 100644 --- a/engines/titanic/game/parrot/player_meets_parrot.h +++ b/engines/titanic/game/parrot/player_meets_parrot.h @@ -32,7 +32,7 @@ class CPlayerMeetsParrot : public CGameObject { protected: bool EnterRoomMsg(CEnterRoomMsg *msg); public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/pet/pet.h b/engines/titanic/game/pet/pet.h index de62294994..cdad649401 100644 --- a/engines/titanic/game/pet/pet.h +++ b/engines/titanic/game/pet/pet.h @@ -37,7 +37,7 @@ public: int _fieldD8; int _fieldDC; public: - CLASSDEF + CLASSDEF; CPET(); /** diff --git a/engines/titanic/game/pet/pet_class1.h b/engines/titanic/game/pet/pet_class1.h index aeb01adc7c..ad97f45bb2 100644 --- a/engines/titanic/game/pet/pet_class1.h +++ b/engines/titanic/game/pet/pet_class1.h @@ -30,7 +30,7 @@ namespace Titanic { class CPETClass1 : public CGameObject { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/pet/pet_class2.h b/engines/titanic/game/pet/pet_class2.h index aa85397385..6ae78f4db8 100644 --- a/engines/titanic/game/pet/pet_class2.h +++ b/engines/titanic/game/pet/pet_class2.h @@ -30,7 +30,7 @@ namespace Titanic { class CPETClass2 : public CGameObject { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/pet/pet_class3.h b/engines/titanic/game/pet/pet_class3.h index 733186a096..780cad3b6c 100644 --- a/engines/titanic/game/pet/pet_class3.h +++ b/engines/titanic/game/pet/pet_class3.h @@ -30,7 +30,7 @@ namespace Titanic { class CPETClass3 : public CGameObject { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/pet/pet_lift.h b/engines/titanic/game/pet/pet_lift.h index 9bdf5313d0..88b4e1c029 100644 --- a/engines/titanic/game/pet/pet_lift.h +++ b/engines/titanic/game/pet/pet_lift.h @@ -29,7 +29,7 @@ namespace Titanic { class CPETLift : public CPETTransport { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/pet/pet_monitor.h b/engines/titanic/game/pet/pet_monitor.h index 140c17b825..3fc50bdf63 100644 --- a/engines/titanic/game/pet/pet_monitor.h +++ b/engines/titanic/game/pet/pet_monitor.h @@ -32,7 +32,7 @@ class CPETMonitor : public CGameObject { DECLARE_MESSAGE_MAP bool EnterRoomMsg(CEnterRoomMsg *msg); public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/pet/pet_pellerator.h b/engines/titanic/game/pet/pet_pellerator.h index 31b44e337b..9b90c9af28 100644 --- a/engines/titanic/game/pet/pet_pellerator.h +++ b/engines/titanic/game/pet/pet_pellerator.h @@ -29,7 +29,7 @@ namespace Titanic { class CPETPellerator : public CPETTransport { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/pet/pet_position.h b/engines/titanic/game/pet/pet_position.h index 63c0bf215f..9419684823 100644 --- a/engines/titanic/game/pet/pet_position.h +++ b/engines/titanic/game/pet/pet_position.h @@ -32,7 +32,7 @@ class CPETPosition : public CGameObject { DECLARE_MESSAGE_MAP bool EnterRoomMsg(CEnterRoomMsg *msg); public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/pet/pet_sentinal.h b/engines/titanic/game/pet/pet_sentinal.h index 8b1e992ebf..f7f9fef0ba 100644 --- a/engines/titanic/game/pet/pet_sentinal.h +++ b/engines/titanic/game/pet/pet_sentinal.h @@ -29,7 +29,7 @@ namespace Titanic { class CPETSentinal : public CGameObject { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/pet/pet_sounds.h b/engines/titanic/game/pet/pet_sounds.h index 3513da5535..1d3acdb5f3 100644 --- a/engines/titanic/game/pet/pet_sounds.h +++ b/engines/titanic/game/pet/pet_sounds.h @@ -31,7 +31,7 @@ class CPETSounds : public CGameObject { public: int _value; public: - CLASSDEF + CLASSDEF; CPETSounds() : CGameObject(), _value(0) {} /** diff --git a/engines/titanic/game/pet/pet_transition.h b/engines/titanic/game/pet/pet_transition.h index 9e4a62875d..4abf16d509 100644 --- a/engines/titanic/game/pet/pet_transition.h +++ b/engines/titanic/game/pet/pet_transition.h @@ -29,7 +29,7 @@ namespace Titanic { class CPETTransition : public CGameObject { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/pet/pet_transport.h b/engines/titanic/game/pet/pet_transport.h index e580ab8616..44beafebc8 100644 --- a/engines/titanic/game/pet/pet_transport.h +++ b/engines/titanic/game/pet/pet_transport.h @@ -32,7 +32,7 @@ class CPETTransport : public CGameObject { DECLARE_MESSAGE_MAP virtual bool EnterRoomMsg(CEnterRoomMsg *msg); public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/pet_disabler.h b/engines/titanic/game/pet_disabler.h index 5928d44921..92b4dff0a8 100644 --- a/engines/titanic/game/pet_disabler.h +++ b/engines/titanic/game/pet_disabler.h @@ -31,7 +31,7 @@ class CPetDisabler : public CGameObject { public: CString _value; public: - CLASSDEF + CLASSDEF; CPetDisabler() : CGameObject() {} /** diff --git a/engines/titanic/game/phonograph.h b/engines/titanic/game/phonograph.h index e0f407b251..274d4ba367 100644 --- a/engines/titanic/game/phonograph.h +++ b/engines/titanic/game/phonograph.h @@ -39,7 +39,7 @@ protected: int _fieldF0; int _fieldF4; public: - CLASSDEF + CLASSDEF; CPhonograph(); /** diff --git a/engines/titanic/game/phonograph_lid.h b/engines/titanic/game/phonograph_lid.h index 486a9b4b84..ab32be268b 100644 --- a/engines/titanic/game/phonograph_lid.h +++ b/engines/titanic/game/phonograph_lid.h @@ -31,7 +31,7 @@ class CPhonographLid : public CGameObject { private: int _value; public: - CLASSDEF + CLASSDEF; CPhonographLid() : CGameObject(), _value(0) {} /** diff --git a/engines/titanic/game/pickup/pick_up.h b/engines/titanic/game/pickup/pick_up.h index 76537d1e74..f0b6794442 100644 --- a/engines/titanic/game/pickup/pick_up.h +++ b/engines/titanic/game/pickup/pick_up.h @@ -31,7 +31,7 @@ class CPickUp : public CGameObject { private: int _fieldBC; public: - CLASSDEF + CLASSDEF; CPickUp() : CGameObject(), _fieldBC(0) {} /** diff --git a/engines/titanic/game/pickup/pick_up_bar_glass.h b/engines/titanic/game/pickup/pick_up_bar_glass.h index f9bcb00192..b5ef6f5a47 100644 --- a/engines/titanic/game/pickup/pick_up_bar_glass.h +++ b/engines/titanic/game/pickup/pick_up_bar_glass.h @@ -29,7 +29,7 @@ namespace Titanic { class CPickUpBarGlass : public CPickUp { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/pickup/pick_up_hose.h b/engines/titanic/game/pickup/pick_up_hose.h index 68bec367d4..80ccedc845 100644 --- a/engines/titanic/game/pickup/pick_up_hose.h +++ b/engines/titanic/game/pickup/pick_up_hose.h @@ -33,7 +33,7 @@ private: CString _string1; public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/pickup/pick_up_lemon.h b/engines/titanic/game/pickup/pick_up_lemon.h index 9bed9ceb73..0312c71012 100644 --- a/engines/titanic/game/pickup/pick_up_lemon.h +++ b/engines/titanic/game/pickup/pick_up_lemon.h @@ -29,7 +29,7 @@ namespace Titanic { class CPickUpLemon : public CPickUp { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/pickup/pick_up_speech_centre.h b/engines/titanic/game/pickup/pick_up_speech_centre.h index a74566b4d5..29dce04fb3 100644 --- a/engines/titanic/game/pickup/pick_up_speech_centre.h +++ b/engines/titanic/game/pickup/pick_up_speech_centre.h @@ -29,7 +29,7 @@ namespace Titanic { class CPickUpSpeechCentre : public CPickUp { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/pickup/pick_up_vis_centre.h b/engines/titanic/game/pickup/pick_up_vis_centre.h index 059c4f85b0..4f808f73c5 100644 --- a/engines/titanic/game/pickup/pick_up_vis_centre.h +++ b/engines/titanic/game/pickup/pick_up_vis_centre.h @@ -29,7 +29,7 @@ namespace Titanic { class CPickUpVisCentre : public CPickUp { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/placeholder/bar_shelf_vis_centre.h b/engines/titanic/game/placeholder/bar_shelf_vis_centre.h index 7cb4478d8a..a53ef2633f 100644 --- a/engines/titanic/game/placeholder/bar_shelf_vis_centre.h +++ b/engines/titanic/game/placeholder/bar_shelf_vis_centre.h @@ -31,7 +31,7 @@ class CBarShelfVisCentre : public CPlaceHolderItem { private: int _value; public: - CLASSDEF + CLASSDEF; CBarShelfVisCentre() : CPlaceHolderItem(), _value(0) {} /** diff --git a/engines/titanic/game/placeholder/lemon_on_bar.h b/engines/titanic/game/placeholder/lemon_on_bar.h index 030481e9ea..92dd54c49b 100644 --- a/engines/titanic/game/placeholder/lemon_on_bar.h +++ b/engines/titanic/game/placeholder/lemon_on_bar.h @@ -31,7 +31,7 @@ class CLemonOnBar : public CPlaceHolderItem { private: Point _pos1; public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/placeholder/place_holder_item.h b/engines/titanic/game/placeholder/place_holder_item.h index 72f49c0a8a..de04a64bf7 100644 --- a/engines/titanic/game/placeholder/place_holder_item.h +++ b/engines/titanic/game/placeholder/place_holder_item.h @@ -29,7 +29,7 @@ namespace Titanic { class CPlaceHolderItem : public CGameObject { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/placeholder/tv_on_bar.h b/engines/titanic/game/placeholder/tv_on_bar.h index ffe8109a9b..d41d972e73 100644 --- a/engines/titanic/game/placeholder/tv_on_bar.h +++ b/engines/titanic/game/placeholder/tv_on_bar.h @@ -31,7 +31,7 @@ class CTVOnBar : public CPlaceHolderItem { private: Point _pos1; public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/play_music_button.h b/engines/titanic/game/play_music_button.h index 8ae32dc8c2..4e3474181c 100644 --- a/engines/titanic/game/play_music_button.h +++ b/engines/titanic/game/play_music_button.h @@ -32,7 +32,7 @@ public: int _fieldE0; int _fieldE4; public: - CLASSDEF + CLASSDEF; CPlayMusicButton() : CBackground(), _fieldE0(0), _fieldE4(0) {} /** diff --git a/engines/titanic/game/play_on_act.h b/engines/titanic/game/play_on_act.h index bd6060077a..197e647943 100644 --- a/engines/titanic/game/play_on_act.h +++ b/engines/titanic/game/play_on_act.h @@ -29,7 +29,7 @@ namespace Titanic { class CPlayOnAct : public CBackground { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/port_hole.h b/engines/titanic/game/port_hole.h index 4e952cc369..7bba18d12a 100644 --- a/engines/titanic/game/port_hole.h +++ b/engines/titanic/game/port_hole.h @@ -32,7 +32,7 @@ private: int _fieldBC; CString _string1, _string2; public: - CLASSDEF + CLASSDEF; CPortHole(); /** diff --git a/engines/titanic/game/record_phonograph_button.h b/engines/titanic/game/record_phonograph_button.h index 9750b7d42e..3383c01e31 100644 --- a/engines/titanic/game/record_phonograph_button.h +++ b/engines/titanic/game/record_phonograph_button.h @@ -31,7 +31,7 @@ class CRecordPhonographButton : public CBackground { public: int _value; public: - CLASSDEF + CLASSDEF; CRecordPhonographButton() : CBackground(), _value(0) {} /** diff --git a/engines/titanic/game/replacement_ear.h b/engines/titanic/game/replacement_ear.h index 59d291f231..0d282b7fb4 100644 --- a/engines/titanic/game/replacement_ear.h +++ b/engines/titanic/game/replacement_ear.h @@ -29,7 +29,7 @@ namespace Titanic { class CReplacementEar : public CBackground { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/reserved_table.h b/engines/titanic/game/reserved_table.h index a0927fafe1..a3532c7d14 100644 --- a/engines/titanic/game/reserved_table.h +++ b/engines/titanic/game/reserved_table.h @@ -31,7 +31,7 @@ class CReservedTable : public CGameObject { public: int _value1, _value2; public: - CLASSDEF + CLASSDEF; CReservedTable() : CGameObject(), _value1(0), _value2(0) {} /** diff --git a/engines/titanic/game/restaurant_cylinder_holder.h b/engines/titanic/game/restaurant_cylinder_holder.h index d679dd1aa3..3aa979b0a5 100644 --- a/engines/titanic/game/restaurant_cylinder_holder.h +++ b/engines/titanic/game/restaurant_cylinder_holder.h @@ -37,7 +37,7 @@ private: CString _string6; int _field140; public: - CLASSDEF + CLASSDEF; CRestaurantCylinderHolder(); /** diff --git a/engines/titanic/game/restaurant_phonograph.h b/engines/titanic/game/restaurant_phonograph.h index 62434977be..710a2edd73 100644 --- a/engines/titanic/game/restaurant_phonograph.h +++ b/engines/titanic/game/restaurant_phonograph.h @@ -34,7 +34,7 @@ private: CString _string3; int _field114; public: - CLASSDEF + CLASSDEF; CRestaurantPhonograph(); /** diff --git a/engines/titanic/game/sauce_dispensor.h b/engines/titanic/game/sauce_dispensor.h index f87420b489..aa177050d5 100644 --- a/engines/titanic/game/sauce_dispensor.h +++ b/engines/titanic/game/sauce_dispensor.h @@ -37,7 +37,7 @@ public: int _field104; int _field108; public: - CLASSDEF + CLASSDEF; CSauceDispensor(); /** diff --git a/engines/titanic/game/search_point.h b/engines/titanic/game/search_point.h index 057bb4d2aa..3c5639b104 100644 --- a/engines/titanic/game/search_point.h +++ b/engines/titanic/game/search_point.h @@ -31,7 +31,7 @@ class CSearchPoint : public CGameObject { public: int _value; public: - CLASSDEF + CLASSDEF; CSearchPoint() : CGameObject(), _value(2) {} /** diff --git a/engines/titanic/game/season_background.h b/engines/titanic/game/season_background.h index c89e6a6ba4..f0fd2cdc63 100644 --- a/engines/titanic/game/season_background.h +++ b/engines/titanic/game/season_background.h @@ -34,7 +34,7 @@ public: int _fieldE8; int _fieldEC; public: - CLASSDEF + CLASSDEF; CSeasonBackground(); /** diff --git a/engines/titanic/game/season_barrel.h b/engines/titanic/game/season_barrel.h index 145dfa02b2..f77864599d 100644 --- a/engines/titanic/game/season_barrel.h +++ b/engines/titanic/game/season_barrel.h @@ -32,7 +32,7 @@ public: int _fieldE0; int _fieldE4; public: - CLASSDEF + CLASSDEF; CSeasonBarrel() : CBackground(), _fieldE0(0), _fieldE4(7) {} /** diff --git a/engines/titanic/game/seasonal_adjustment.h b/engines/titanic/game/seasonal_adjustment.h index 4f251ad764..39132d614d 100644 --- a/engines/titanic/game/seasonal_adjustment.h +++ b/engines/titanic/game/seasonal_adjustment.h @@ -32,7 +32,7 @@ public: int _fieldE0; int _fieldE4; public: - CLASSDEF + CLASSDEF; CSeasonalAdjustment() : CBackground(), _fieldE0(0), _fieldE4(0) {} /** diff --git a/engines/titanic/game/service_elevator_window.h b/engines/titanic/game/service_elevator_window.h index 08150238cc..4233b8405a 100644 --- a/engines/titanic/game/service_elevator_window.h +++ b/engines/titanic/game/service_elevator_window.h @@ -34,7 +34,7 @@ public: int _fieldE8; int _fieldEC; public: - CLASSDEF + CLASSDEF; CServiceElevatorWindow(); /** diff --git a/engines/titanic/game/sgt/armchair.h b/engines/titanic/game/sgt/armchair.h index 5dfd94d095..b5505554f0 100644 --- a/engines/titanic/game/sgt/armchair.h +++ b/engines/titanic/game/sgt/armchair.h @@ -29,7 +29,7 @@ namespace Titanic { class CArmchair : public CSGTStateRoom { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/sgt/basin.h b/engines/titanic/game/sgt/basin.h index 950bdb8241..e4a36eb841 100644 --- a/engines/titanic/game/sgt/basin.h +++ b/engines/titanic/game/sgt/basin.h @@ -29,7 +29,7 @@ namespace Titanic { class CBasin : public CSGTStateRoom { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/sgt/bedfoot.h b/engines/titanic/game/sgt/bedfoot.h index db1e1dd031..df3db42d6d 100644 --- a/engines/titanic/game/sgt/bedfoot.h +++ b/engines/titanic/game/sgt/bedfoot.h @@ -29,7 +29,7 @@ namespace Titanic { class CBedfoot : public CSGTStateRoom { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/sgt/bedhead.h b/engines/titanic/game/sgt/bedhead.h index b938dcd795..f1ba31786c 100644 --- a/engines/titanic/game/sgt/bedhead.h +++ b/engines/titanic/game/sgt/bedhead.h @@ -29,7 +29,7 @@ namespace Titanic { class CBedhead : public CSGTStateRoom { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/sgt/chest_of_drawers.h b/engines/titanic/game/sgt/chest_of_drawers.h index 5b72f3eef3..16a1bf8fea 100644 --- a/engines/titanic/game/sgt/chest_of_drawers.h +++ b/engines/titanic/game/sgt/chest_of_drawers.h @@ -29,7 +29,7 @@ namespace Titanic { class CChestOfDrawers : public CSGTStateRoom { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/sgt/desk.h b/engines/titanic/game/sgt/desk.h index d35417c599..77b5fa17af 100644 --- a/engines/titanic/game/sgt/desk.h +++ b/engines/titanic/game/sgt/desk.h @@ -29,7 +29,7 @@ namespace Titanic { class CDesk : public CSGTStateRoom { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/sgt/deskchair.h b/engines/titanic/game/sgt/deskchair.h index 38e4d6de5d..5181b650d2 100644 --- a/engines/titanic/game/sgt/deskchair.h +++ b/engines/titanic/game/sgt/deskchair.h @@ -29,7 +29,7 @@ namespace Titanic { class CDeskchair : public CSGTStateRoom { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/sgt/drawer.h b/engines/titanic/game/sgt/drawer.h index 4f68b1b5ad..c079be389f 100644 --- a/engines/titanic/game/sgt/drawer.h +++ b/engines/titanic/game/sgt/drawer.h @@ -31,7 +31,7 @@ class CDrawer : public CSGTStateRoom { private: int _fieldF4; public: - CLASSDEF + CLASSDEF; CDrawer(); /** diff --git a/engines/titanic/game/sgt/sgt_doors.h b/engines/titanic/game/sgt/sgt_doors.h index 11825c069b..4b4f4a3153 100644 --- a/engines/titanic/game/sgt/sgt_doors.h +++ b/engines/titanic/game/sgt/sgt_doors.h @@ -31,7 +31,7 @@ class CSGTDoors : public CGameObject { public: int _value1, _value2; public: - CLASSDEF + CLASSDEF; CSGTDoors() : CGameObject(), _value1(0), _value2(0) {} /** diff --git a/engines/titanic/game/sgt/sgt_nav.h b/engines/titanic/game/sgt/sgt_nav.h index 39b267fc9c..40fdc4eff1 100644 --- a/engines/titanic/game/sgt/sgt_nav.h +++ b/engines/titanic/game/sgt/sgt_nav.h @@ -29,7 +29,7 @@ namespace Titanic { class SGTNav : public CSGTStateRoom { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/sgt/sgt_navigation.h b/engines/titanic/game/sgt/sgt_navigation.h index ac8c475cce..6d24fe6761 100644 --- a/engines/titanic/game/sgt/sgt_navigation.h +++ b/engines/titanic/game/sgt/sgt_navigation.h @@ -37,7 +37,7 @@ class CSGTNavigation : public CGameObject { private: static CSGTNavigationStatics *_statics; public: - CLASSDEF + CLASSDEF; static void init(); static void deinit(); diff --git a/engines/titanic/game/sgt/sgt_restaurant_doors.h b/engines/titanic/game/sgt/sgt_restaurant_doors.h index e740db6246..2a10d8f059 100644 --- a/engines/titanic/game/sgt/sgt_restaurant_doors.h +++ b/engines/titanic/game/sgt/sgt_restaurant_doors.h @@ -31,7 +31,7 @@ class CSGTRestaurantDoors : public CGameObject { private: int _fieldBC; public: - CLASSDEF + CLASSDEF; CSGTRestaurantDoors() : CGameObject(), _fieldBC(0) {} /** diff --git a/engines/titanic/game/sgt/sgt_state_control.h b/engines/titanic/game/sgt/sgt_state_control.h index af51274355..49fd5113cd 100644 --- a/engines/titanic/game/sgt/sgt_state_control.h +++ b/engines/titanic/game/sgt/sgt_state_control.h @@ -31,7 +31,7 @@ class CSGTStateControl : public CBackground { private: int _fieldE0; public: - CLASSDEF + CLASSDEF; CSGTStateControl() : CBackground(), _fieldE0(1) {} /** diff --git a/engines/titanic/game/sgt/sgt_state_room.h b/engines/titanic/game/sgt/sgt_state_room.h index 1809ec8ee2..ee9079943b 100644 --- a/engines/titanic/game/sgt/sgt_state_room.h +++ b/engines/titanic/game/sgt/sgt_state_room.h @@ -57,7 +57,7 @@ private: int _fieldEC; int _fieldF0; public: - CLASSDEF + CLASSDEF; CSGTStateRoom(); static void init(); static void deinit(); diff --git a/engines/titanic/game/sgt/sgt_tv.h b/engines/titanic/game/sgt/sgt_tv.h index e97f97427a..90fed90efe 100644 --- a/engines/titanic/game/sgt/sgt_tv.h +++ b/engines/titanic/game/sgt/sgt_tv.h @@ -29,7 +29,7 @@ namespace Titanic { class CSGTTV : public CSGTStateRoom { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/sgt/sgt_upper_doors_sound.h b/engines/titanic/game/sgt/sgt_upper_doors_sound.h index 3289b88f43..fc8c6c2bf1 100644 --- a/engines/titanic/game/sgt/sgt_upper_doors_sound.h +++ b/engines/titanic/game/sgt/sgt_upper_doors_sound.h @@ -29,7 +29,7 @@ namespace Titanic { class CSGTUpperDoorsSound : public CClickResponder { public: - CLASSDEF + CLASSDEF; CSGTUpperDoorsSound(); /** diff --git a/engines/titanic/game/sgt/toilet.h b/engines/titanic/game/sgt/toilet.h index d0d2851367..d87531ad7a 100644 --- a/engines/titanic/game/sgt/toilet.h +++ b/engines/titanic/game/sgt/toilet.h @@ -29,7 +29,7 @@ namespace Titanic { class CToilet : public CSGTStateRoom { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/sgt/vase.h b/engines/titanic/game/sgt/vase.h index ec3662b9ee..8aa35acdf5 100644 --- a/engines/titanic/game/sgt/vase.h +++ b/engines/titanic/game/sgt/vase.h @@ -29,7 +29,7 @@ namespace Titanic { class CVase : public CSGTStateRoom { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/sgt/washstand.h b/engines/titanic/game/sgt/washstand.h index ea7636c485..f140b17f49 100644 --- a/engines/titanic/game/sgt/washstand.h +++ b/engines/titanic/game/sgt/washstand.h @@ -29,7 +29,7 @@ namespace Titanic { class CWashstand : public CSGTStateRoom { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/ship_setting.h b/engines/titanic/game/ship_setting.h index e0a52dd4c7..4fcc10a424 100644 --- a/engines/titanic/game/ship_setting.h +++ b/engines/titanic/game/ship_setting.h @@ -36,7 +36,7 @@ public: CString _string4; CString _string5; public: - CLASSDEF + CLASSDEF; CShipSetting(); /** diff --git a/engines/titanic/game/ship_setting_button.h b/engines/titanic/game/ship_setting_button.h index e5a889bcc3..e152e8e2c3 100644 --- a/engines/titanic/game/ship_setting_button.h +++ b/engines/titanic/game/ship_setting_button.h @@ -33,7 +33,7 @@ private: int _fieldC8; int _fieldCC; public: - CLASSDEF + CLASSDEF; CShipSettingButton(); /** diff --git a/engines/titanic/game/show_cell_points.h b/engines/titanic/game/show_cell_points.h index 83592210e5..9de2e06dca 100644 --- a/engines/titanic/game/show_cell_points.h +++ b/engines/titanic/game/show_cell_points.h @@ -32,7 +32,7 @@ public: CString _strValue; int _numValue; public: - CLASSDEF + CLASSDEF; CShowCellpoints() : CGameObject(), _numValue(0) {} /** diff --git a/engines/titanic/game/speech_dispensor.h b/engines/titanic/game/speech_dispensor.h index 6302ca3d88..3b877e8d99 100644 --- a/engines/titanic/game/speech_dispensor.h +++ b/engines/titanic/game/speech_dispensor.h @@ -38,7 +38,7 @@ private: int _fieldF8; int _fieldFC; public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/splash_animation.h b/engines/titanic/game/splash_animation.h index 4b70b38f10..b1de994f92 100644 --- a/engines/titanic/game/splash_animation.h +++ b/engines/titanic/game/splash_animation.h @@ -30,7 +30,7 @@ namespace Titanic { class CSplashAnimation : public CGameObject { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/starling_puret.h b/engines/titanic/game/starling_puret.h index 36cd23e54d..fcd3319958 100644 --- a/engines/titanic/game/starling_puret.h +++ b/engines/titanic/game/starling_puret.h @@ -31,7 +31,7 @@ class CStarlingPuret : public CGameObject { private: int _value; public: - CLASSDEF + CLASSDEF; CStarlingPuret() : CGameObject(), _value(0) {} /** diff --git a/engines/titanic/game/start_action.h b/engines/titanic/game/start_action.h index 6b6860e265..8be17f0a50 100644 --- a/engines/titanic/game/start_action.h +++ b/engines/titanic/game/start_action.h @@ -36,7 +36,7 @@ protected: CString _msgTarget; CString _msgAction; public: - CLASSDEF + CLASSDEF; CStartAction(); /** diff --git a/engines/titanic/game/stop_phonograph_button.h b/engines/titanic/game/stop_phonograph_button.h index 1109f81475..b469375e20 100644 --- a/engines/titanic/game/stop_phonograph_button.h +++ b/engines/titanic/game/stop_phonograph_button.h @@ -29,7 +29,7 @@ namespace Titanic { class CStopPhonographButton : public CBackground { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/sub_glass.h b/engines/titanic/game/sub_glass.h index 1aa73d21ff..aab5c8400e 100644 --- a/engines/titanic/game/sub_glass.h +++ b/engines/titanic/game/sub_glass.h @@ -36,7 +36,7 @@ private: int _fieldCC; CString _string; public: - CLASSDEF + CLASSDEF; CSUBGlass(); /** diff --git a/engines/titanic/game/sub_wrapper.h b/engines/titanic/game/sub_wrapper.h index d2fc914a08..81f8fdc941 100644 --- a/engines/titanic/game/sub_wrapper.h +++ b/engines/titanic/game/sub_wrapper.h @@ -31,7 +31,7 @@ class CSUBWrapper : public CGameObject { public: int _value; public: - CLASSDEF + CLASSDEF; CSUBWrapper() : CGameObject(), _value(0) {} /** diff --git a/engines/titanic/game/sweet_bowl.h b/engines/titanic/game/sweet_bowl.h index 5beb9605f0..cf3d0023a4 100644 --- a/engines/titanic/game/sweet_bowl.h +++ b/engines/titanic/game/sweet_bowl.h @@ -29,7 +29,7 @@ namespace Titanic { class CSweetBowl : public CGameObject { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/television.h b/engines/titanic/game/television.h index 27dd3d65a8..3ce55053bf 100644 --- a/engines/titanic/game/television.h +++ b/engines/titanic/game/television.h @@ -58,7 +58,7 @@ private: int _fieldEC; int _soundHandle; public: - CLASSDEF + CLASSDEF; CTelevision(); static void init(); static void deinit(); diff --git a/engines/titanic/game/third_class_canal.h b/engines/titanic/game/third_class_canal.h index 1cc53948d3..f6fc471444 100644 --- a/engines/titanic/game/third_class_canal.h +++ b/engines/titanic/game/third_class_canal.h @@ -29,7 +29,7 @@ namespace Titanic { class CThirdClassCanal : public CBackground { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/throw_tv_down_well.h b/engines/titanic/game/throw_tv_down_well.h index ce10264230..b6003aa3ef 100644 --- a/engines/titanic/game/throw_tv_down_well.h +++ b/engines/titanic/game/throw_tv_down_well.h @@ -32,7 +32,7 @@ public: CString _strValue; int _numValue; public: - CLASSDEF + CLASSDEF; CThrowTVDownWell() : CGameObject(), _numValue(0) {} /** diff --git a/engines/titanic/game/titania_still_control.h b/engines/titanic/game/titania_still_control.h index dbff0c73bb..66c3045187 100644 --- a/engines/titanic/game/titania_still_control.h +++ b/engines/titanic/game/titania_still_control.h @@ -29,7 +29,7 @@ namespace Titanic { class CTitaniaStillControl : public CGameObject { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/tow_parrot_nav.h b/engines/titanic/game/tow_parrot_nav.h index 651b8bea56..17618ff6de 100644 --- a/engines/titanic/game/tow_parrot_nav.h +++ b/engines/titanic/game/tow_parrot_nav.h @@ -29,7 +29,7 @@ namespace Titanic { class CTOWParrotNav : public CGameObject { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/transport/exit_pellerator.h b/engines/titanic/game/transport/exit_pellerator.h index e55a8fbf04..53056c7417 100644 --- a/engines/titanic/game/transport/exit_pellerator.h +++ b/engines/titanic/game/transport/exit_pellerator.h @@ -32,7 +32,7 @@ private: static int _v1; static int _v2; public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/transport/gondolier.h b/engines/titanic/game/transport/gondolier.h index 4f4c57081b..ac1617256f 100644 --- a/engines/titanic/game/transport/gondolier.h +++ b/engines/titanic/game/transport/gondolier.h @@ -29,7 +29,7 @@ namespace Titanic { class CGondolier : public CTransport { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/transport/lift.h b/engines/titanic/game/transport/lift.h index 4b39d34008..9c90466af5 100644 --- a/engines/titanic/game/transport/lift.h +++ b/engines/titanic/game/transport/lift.h @@ -41,7 +41,7 @@ private: int _fieldF8; public: - CLASSDEF + CLASSDEF; CLift() : CTransport(), _fieldF8(1) {} /** diff --git a/engines/titanic/game/transport/lift_indicator.h b/engines/titanic/game/transport/lift_indicator.h index 2b08da5975..ff394d7230 100644 --- a/engines/titanic/game/transport/lift_indicator.h +++ b/engines/titanic/game/transport/lift_indicator.h @@ -37,7 +37,7 @@ private: int _field108; int _field10C; public: - CLASSDEF + CLASSDEF; CLiftindicator(); /** diff --git a/engines/titanic/game/transport/pellerator.h b/engines/titanic/game/transport/pellerator.h index ac1486de3a..9d223ec770 100644 --- a/engines/titanic/game/transport/pellerator.h +++ b/engines/titanic/game/transport/pellerator.h @@ -35,7 +35,7 @@ private: static int _v1; static int _v2; public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/transport/service_elevator.h b/engines/titanic/game/transport/service_elevator.h index 472f4580ad..b2c135021a 100644 --- a/engines/titanic/game/transport/service_elevator.h +++ b/engines/titanic/game/transport/service_elevator.h @@ -38,7 +38,7 @@ private: int _field100; int _field104; public: - CLASSDEF + CLASSDEF; CServiceElevator(); /** diff --git a/engines/titanic/game/transport/transport.h b/engines/titanic/game/transport/transport.h index 66906888a0..b2c9aee20d 100644 --- a/engines/titanic/game/transport/transport.h +++ b/engines/titanic/game/transport/transport.h @@ -33,7 +33,7 @@ public: CString _string1; CString _string2; public: - CLASSDEF + CLASSDEF; CTransport(); /** diff --git a/engines/titanic/game/up_lighter.h b/engines/titanic/game/up_lighter.h index be76f576de..2367e41314 100644 --- a/engines/titanic/game/up_lighter.h +++ b/engines/titanic/game/up_lighter.h @@ -36,7 +36,7 @@ private: int _field120; int _field124; public: - CLASSDEF + CLASSDEF; CUpLighter(); /** diff --git a/engines/titanic/game/useless_lever.h b/engines/titanic/game/useless_lever.h index d6c54802f9..27397de216 100644 --- a/engines/titanic/game/useless_lever.h +++ b/engines/titanic/game/useless_lever.h @@ -29,7 +29,7 @@ namespace Titanic { class CUselessLever : public CToggleButton { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/game/volume_control.h b/engines/titanic/game/volume_control.h index 77e33463e4..dcc6f63781 100644 --- a/engines/titanic/game/volume_control.h +++ b/engines/titanic/game/volume_control.h @@ -35,7 +35,7 @@ private: CString _string1; int _fieldCC; public: - CLASSDEF + CLASSDEF; CVolumeControl(); /** diff --git a/engines/titanic/game/wheel_button.h b/engines/titanic/game/wheel_button.h index 78ea7085c2..cb089a660f 100644 --- a/engines/titanic/game/wheel_button.h +++ b/engines/titanic/game/wheel_button.h @@ -33,7 +33,7 @@ public: int _fieldE4; int _fieldE8; public: - CLASSDEF + CLASSDEF; CWheelButton(); /** diff --git a/engines/titanic/game/wheel_hotspot.h b/engines/titanic/game/wheel_hotspot.h index 75b597c425..364fe9a060 100644 --- a/engines/titanic/game/wheel_hotspot.h +++ b/engines/titanic/game/wheel_hotspot.h @@ -32,7 +32,7 @@ public: int _fieldE0; int _fieldE4; public: - CLASSDEF + CLASSDEF; CWheelHotSpot() : CBackground(), _fieldE0(0), _fieldE4(0) {} /** diff --git a/engines/titanic/game/wheel_spin.h b/engines/titanic/game/wheel_spin.h index 9e584a1e48..509db1a4bf 100644 --- a/engines/titanic/game/wheel_spin.h +++ b/engines/titanic/game/wheel_spin.h @@ -31,7 +31,7 @@ class CWheelSpin : public CBackground { public: int _value; public: - CLASSDEF + CLASSDEF; CWheelSpin() : CBackground(), _value(0) {} /** diff --git a/engines/titanic/game/wheel_spin_horn.h b/engines/titanic/game/wheel_spin_horn.h index ac4021f3a7..21182253b3 100644 --- a/engines/titanic/game/wheel_spin_horn.h +++ b/engines/titanic/game/wheel_spin_horn.h @@ -32,7 +32,7 @@ public: CString _string1; CString _string2; public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/gfx/act_button.h b/engines/titanic/gfx/act_button.h index 3b78e0c3af..26e5595411 100644 --- a/engines/titanic/gfx/act_button.h +++ b/engines/titanic/gfx/act_button.h @@ -29,7 +29,7 @@ namespace Titanic { class CActButton : public CSTButton { public: - CLASSDEF + CLASSDEF; CActButton(); /** diff --git a/engines/titanic/gfx/changes_season_button.h b/engines/titanic/gfx/changes_season_button.h index 2fe4672c1f..2b58a3199b 100644 --- a/engines/titanic/gfx/changes_season_button.h +++ b/engines/titanic/gfx/changes_season_button.h @@ -29,7 +29,7 @@ namespace Titanic { class CChangesSeasonButton : public CSTButton { public: - CLASSDEF + CLASSDEF; CChangesSeasonButton(); /** diff --git a/engines/titanic/gfx/chev_left_off.h b/engines/titanic/gfx/chev_left_off.h index 572f58abf3..1e356d3bf9 100644 --- a/engines/titanic/gfx/chev_left_off.h +++ b/engines/titanic/gfx/chev_left_off.h @@ -30,7 +30,7 @@ namespace Titanic { class CChevLeftOff : public CToggleSwitch { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; CChevLeftOff(); /** diff --git a/engines/titanic/gfx/chev_left_on.h b/engines/titanic/gfx/chev_left_on.h index c015eef7c1..2014002fca 100644 --- a/engines/titanic/gfx/chev_left_on.h +++ b/engines/titanic/gfx/chev_left_on.h @@ -30,7 +30,7 @@ namespace Titanic { class CChevLeftOn : public CToggleSwitch { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; CChevLeftOn(); /** diff --git a/engines/titanic/gfx/chev_right_off.h b/engines/titanic/gfx/chev_right_off.h index 05b62f3241..2bd3e24f9f 100644 --- a/engines/titanic/gfx/chev_right_off.h +++ b/engines/titanic/gfx/chev_right_off.h @@ -30,7 +30,7 @@ namespace Titanic { class CChevRightOff : public CToggleSwitch { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; CChevRightOff(); /** diff --git a/engines/titanic/gfx/chev_right_on.h b/engines/titanic/gfx/chev_right_on.h index 56672f27bb..bc3e0ff7be 100644 --- a/engines/titanic/gfx/chev_right_on.h +++ b/engines/titanic/gfx/chev_right_on.h @@ -30,7 +30,7 @@ namespace Titanic { class CChevRightOn : public CToggleSwitch { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; CChevRightOn(); /** diff --git a/engines/titanic/gfx/chev_send_rec_switch.h b/engines/titanic/gfx/chev_send_rec_switch.h index 17a1b0a855..041492893c 100644 --- a/engines/titanic/gfx/chev_send_rec_switch.h +++ b/engines/titanic/gfx/chev_send_rec_switch.h @@ -30,7 +30,7 @@ namespace Titanic { class CChevSendRecSwitch : public CToggleSwitch { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; CChevSendRecSwitch(); /** diff --git a/engines/titanic/gfx/chev_switch.h b/engines/titanic/gfx/chev_switch.h index d3c884e92a..0305a6ca83 100644 --- a/engines/titanic/gfx/chev_switch.h +++ b/engines/titanic/gfx/chev_switch.h @@ -29,7 +29,7 @@ namespace Titanic { class CChevSwitch : public CToggleSwitch { public: - CLASSDEF + CLASSDEF; CChevSwitch(); /** diff --git a/engines/titanic/gfx/edit_control.h b/engines/titanic/gfx/edit_control.h index 42886372d2..77d03cb225 100644 --- a/engines/titanic/gfx/edit_control.h +++ b/engines/titanic/gfx/edit_control.h @@ -43,7 +43,7 @@ protected: int _fieldF0; int _fieldF4; public: - CLASSDEF + CLASSDEF; CEditControl(); /** diff --git a/engines/titanic/gfx/elevator_button.h b/engines/titanic/gfx/elevator_button.h index da7e25a275..dec4775f3f 100644 --- a/engines/titanic/gfx/elevator_button.h +++ b/engines/titanic/gfx/elevator_button.h @@ -30,7 +30,7 @@ namespace Titanic { class CElevatorButton : public CSTButton { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; CElevatorButton(); /** diff --git a/engines/titanic/gfx/get_from_succ.h b/engines/titanic/gfx/get_from_succ.h index 5f16f9175f..d93341e913 100644 --- a/engines/titanic/gfx/get_from_succ.h +++ b/engines/titanic/gfx/get_from_succ.h @@ -30,7 +30,7 @@ namespace Titanic { class CGetFromSucc : public CToggleSwitch { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; CGetFromSucc(); /** diff --git a/engines/titanic/gfx/helmet_on_off.h b/engines/titanic/gfx/helmet_on_off.h index c0e1a0affe..881757a2ef 100644 --- a/engines/titanic/gfx/helmet_on_off.h +++ b/engines/titanic/gfx/helmet_on_off.h @@ -30,7 +30,7 @@ namespace Titanic { class CHelmetOnOff : public CToggleSwitch { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; CHelmetOnOff(); /** diff --git a/engines/titanic/gfx/home_photo.h b/engines/titanic/gfx/home_photo.h index c14352375a..9181bfd820 100644 --- a/engines/titanic/gfx/home_photo.h +++ b/engines/titanic/gfx/home_photo.h @@ -30,7 +30,7 @@ namespace Titanic { class CHomePhoto : public CToggleSwitch { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; CHomePhoto(); /** diff --git a/engines/titanic/gfx/icon_nav_action.h b/engines/titanic/gfx/icon_nav_action.h index 2a5961d590..9a63a47196 100644 --- a/engines/titanic/gfx/icon_nav_action.h +++ b/engines/titanic/gfx/icon_nav_action.h @@ -30,7 +30,7 @@ namespace Titanic { class CIconNavAction : public CToggleSwitch { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; CIconNavAction(); /** diff --git a/engines/titanic/gfx/icon_nav_butt.h b/engines/titanic/gfx/icon_nav_butt.h index 3c73a274b2..a27fc8b0fa 100644 --- a/engines/titanic/gfx/icon_nav_butt.h +++ b/engines/titanic/gfx/icon_nav_butt.h @@ -30,7 +30,7 @@ namespace Titanic { class CIconNavButt : public CPetGraphic { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/gfx/icon_nav_down.h b/engines/titanic/gfx/icon_nav_down.h index 6de13eac11..759d887913 100644 --- a/engines/titanic/gfx/icon_nav_down.h +++ b/engines/titanic/gfx/icon_nav_down.h @@ -30,7 +30,7 @@ namespace Titanic { class CIconNavDown : public CToggleSwitch { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; CIconNavDown(); /** diff --git a/engines/titanic/gfx/icon_nav_image.h b/engines/titanic/gfx/icon_nav_image.h index 3ff82f385c..ab0e955bfa 100644 --- a/engines/titanic/gfx/icon_nav_image.h +++ b/engines/titanic/gfx/icon_nav_image.h @@ -30,7 +30,7 @@ namespace Titanic { class CIconNavImage : public CPetGraphic { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/gfx/icon_nav_left.h b/engines/titanic/gfx/icon_nav_left.h index bba3016d7b..d58a426ae9 100644 --- a/engines/titanic/gfx/icon_nav_left.h +++ b/engines/titanic/gfx/icon_nav_left.h @@ -30,7 +30,7 @@ namespace Titanic { class CIconNavLeft : public CToggleSwitch { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; CIconNavLeft(); /** diff --git a/engines/titanic/gfx/icon_nav_receive.h b/engines/titanic/gfx/icon_nav_receive.h index 8fff0d0cd1..5d055dd156 100644 --- a/engines/titanic/gfx/icon_nav_receive.h +++ b/engines/titanic/gfx/icon_nav_receive.h @@ -30,7 +30,7 @@ namespace Titanic { class CIconNavReceive : public CPetGraphic { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/gfx/icon_nav_right.h b/engines/titanic/gfx/icon_nav_right.h index 1df10433b5..c12ff7cf8b 100644 --- a/engines/titanic/gfx/icon_nav_right.h +++ b/engines/titanic/gfx/icon_nav_right.h @@ -30,7 +30,7 @@ namespace Titanic { class CIconNavRight : public CToggleSwitch { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; CIconNavRight(); /** diff --git a/engines/titanic/gfx/icon_nav_send.h b/engines/titanic/gfx/icon_nav_send.h index d70920507a..f2b220f0d9 100644 --- a/engines/titanic/gfx/icon_nav_send.h +++ b/engines/titanic/gfx/icon_nav_send.h @@ -30,7 +30,7 @@ namespace Titanic { class CIconNavSend : public CPetGraphic { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/gfx/icon_nav_up.h b/engines/titanic/gfx/icon_nav_up.h index 73d4fc3f8b..a9702c763f 100644 --- a/engines/titanic/gfx/icon_nav_up.h +++ b/engines/titanic/gfx/icon_nav_up.h @@ -30,7 +30,7 @@ namespace Titanic { class CIconNavUp : public CToggleSwitch { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; CIconNavUp(); /** diff --git a/engines/titanic/gfx/keybrd_butt.h b/engines/titanic/gfx/keybrd_butt.h index 4bf38a1954..5514f115c7 100644 --- a/engines/titanic/gfx/keybrd_butt.h +++ b/engines/titanic/gfx/keybrd_butt.h @@ -30,7 +30,7 @@ namespace Titanic { class CKeybrdButt : public CToggleSwitch { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; CKeybrdButt(); /** diff --git a/engines/titanic/gfx/move_object_button.h b/engines/titanic/gfx/move_object_button.h index a255ecf38a..eb2fdc4ff2 100644 --- a/engines/titanic/gfx/move_object_button.h +++ b/engines/titanic/gfx/move_object_button.h @@ -32,7 +32,7 @@ private: Point _pos1; int _field11C; public: - CLASSDEF + CLASSDEF; CMoveObjectButton(); /** diff --git a/engines/titanic/gfx/music_control.h b/engines/titanic/gfx/music_control.h index 4b7927060b..04085f789c 100644 --- a/engines/titanic/gfx/music_control.h +++ b/engines/titanic/gfx/music_control.h @@ -34,7 +34,7 @@ public: int _fieldE8; int _fieldEC; public: - CLASSDEF + CLASSDEF; CMusicControl(); /** diff --git a/engines/titanic/gfx/music_slider.h b/engines/titanic/gfx/music_slider.h index 87a06c6b60..1636afeb89 100644 --- a/engines/titanic/gfx/music_slider.h +++ b/engines/titanic/gfx/music_slider.h @@ -30,7 +30,7 @@ namespace Titanic { class CMusicSlider : public CMusicControl { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/gfx/music_slider_pitch.h b/engines/titanic/gfx/music_slider_pitch.h index edb8f42680..10c1d62c3a 100644 --- a/engines/titanic/gfx/music_slider_pitch.h +++ b/engines/titanic/gfx/music_slider_pitch.h @@ -29,7 +29,7 @@ namespace Titanic { class CMusicSliderPitch : public CMusicSlider { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/gfx/music_slider_speed.h b/engines/titanic/gfx/music_slider_speed.h index c6a35ddd5f..9814ca0312 100644 --- a/engines/titanic/gfx/music_slider_speed.h +++ b/engines/titanic/gfx/music_slider_speed.h @@ -29,7 +29,7 @@ namespace Titanic { class CMusicSliderSpeed : public CMusicSlider { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/gfx/music_switch.h b/engines/titanic/gfx/music_switch.h index bb90a8f205..6ee615d594 100644 --- a/engines/titanic/gfx/music_switch.h +++ b/engines/titanic/gfx/music_switch.h @@ -30,7 +30,7 @@ namespace Titanic { class CMusicSwitch : public CMusicControl { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/gfx/music_switch_inversion.h b/engines/titanic/gfx/music_switch_inversion.h index 052c812897..8b3718cf14 100644 --- a/engines/titanic/gfx/music_switch_inversion.h +++ b/engines/titanic/gfx/music_switch_inversion.h @@ -29,7 +29,7 @@ namespace Titanic { class CMusicSwitchInversion : public CMusicSwitch { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/gfx/music_switch_reverse.h b/engines/titanic/gfx/music_switch_reverse.h index 5a6208cede..3bfcb53b00 100644 --- a/engines/titanic/gfx/music_switch_reverse.h +++ b/engines/titanic/gfx/music_switch_reverse.h @@ -29,7 +29,7 @@ namespace Titanic { class CMusicSwitchReverse : public CMusicSwitch { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/gfx/music_voice_mute.h b/engines/titanic/gfx/music_voice_mute.h index 85aeda869c..ca15806c09 100644 --- a/engines/titanic/gfx/music_voice_mute.h +++ b/engines/titanic/gfx/music_voice_mute.h @@ -29,7 +29,7 @@ namespace Titanic { class CMusicVoiceMute : public CMusicControl { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/gfx/send_to_succ.h b/engines/titanic/gfx/send_to_succ.h index 1b8d17741e..dfcb345f4c 100644 --- a/engines/titanic/gfx/send_to_succ.h +++ b/engines/titanic/gfx/send_to_succ.h @@ -30,7 +30,7 @@ namespace Titanic { class CSendToSucc : public CToggleSwitch { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; CSendToSucc(); /** diff --git a/engines/titanic/gfx/sgt_selector.h b/engines/titanic/gfx/sgt_selector.h index c6d2a167d2..2afd40209b 100644 --- a/engines/titanic/gfx/sgt_selector.h +++ b/engines/titanic/gfx/sgt_selector.h @@ -30,7 +30,7 @@ namespace Titanic { class CSGTSelector : public CPetGraphic { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/gfx/slider_button.h b/engines/titanic/gfx/slider_button.h index 3bd33aa2ba..398290bb05 100644 --- a/engines/titanic/gfx/slider_button.h +++ b/engines/titanic/gfx/slider_button.h @@ -34,7 +34,7 @@ private: int _field11C; Point _pos1; public: - CLASSDEF + CLASSDEF; CSliderButton(); /** diff --git a/engines/titanic/gfx/small_chev_left_off.h b/engines/titanic/gfx/small_chev_left_off.h index a164235828..c3af9bb837 100644 --- a/engines/titanic/gfx/small_chev_left_off.h +++ b/engines/titanic/gfx/small_chev_left_off.h @@ -30,7 +30,7 @@ namespace Titanic { class CSmallChevLeftOff : public CToggleSwitch { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; CSmallChevLeftOff(); /** diff --git a/engines/titanic/gfx/small_chev_left_on.h b/engines/titanic/gfx/small_chev_left_on.h index ab9414727d..4fcba625fa 100644 --- a/engines/titanic/gfx/small_chev_left_on.h +++ b/engines/titanic/gfx/small_chev_left_on.h @@ -30,7 +30,7 @@ namespace Titanic { class CSmallChevLeftOn : public CToggleSwitch { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; CSmallChevLeftOn(); /** diff --git a/engines/titanic/gfx/small_chev_right_off.h b/engines/titanic/gfx/small_chev_right_off.h index 3283eb2606..f56cc83981 100644 --- a/engines/titanic/gfx/small_chev_right_off.h +++ b/engines/titanic/gfx/small_chev_right_off.h @@ -30,7 +30,7 @@ namespace Titanic { class CSmallChevRightOff : public CToggleSwitch { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; CSmallChevRightOff(); /** diff --git a/engines/titanic/gfx/small_chev_right_on.h b/engines/titanic/gfx/small_chev_right_on.h index fe522c45cb..aeb9ce33e7 100644 --- a/engines/titanic/gfx/small_chev_right_on.h +++ b/engines/titanic/gfx/small_chev_right_on.h @@ -30,7 +30,7 @@ namespace Titanic { class CSmallChevRightOn : public CToggleSwitch { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; CSmallChevRightOn(); /** diff --git a/engines/titanic/gfx/st_button.h b/engines/titanic/gfx/st_button.h index b3bd5e82ad..6a8af1b9fa 100644 --- a/engines/titanic/gfx/st_button.h +++ b/engines/titanic/gfx/st_button.h @@ -43,7 +43,7 @@ private: CString _soundName; int _buttonFrame; public: - CLASSDEF + CLASSDEF; CSTButton(); /** diff --git a/engines/titanic/gfx/status_change_button.h b/engines/titanic/gfx/status_change_button.h index 818f21e056..9e410c66f2 100644 --- a/engines/titanic/gfx/status_change_button.h +++ b/engines/titanic/gfx/status_change_button.h @@ -29,7 +29,7 @@ namespace Titanic { class CStatusChangeButton : public CSTButton { public: - CLASSDEF + CLASSDEF; CStatusChangeButton(); /** diff --git a/engines/titanic/gfx/text_down.h b/engines/titanic/gfx/text_down.h index 04805e714a..5c924b8129 100644 --- a/engines/titanic/gfx/text_down.h +++ b/engines/titanic/gfx/text_down.h @@ -30,7 +30,7 @@ namespace Titanic { class CTextDown : public CPetGraphic { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/gfx/text_skrew.h b/engines/titanic/gfx/text_skrew.h index a9326336bb..df90d95ba6 100644 --- a/engines/titanic/gfx/text_skrew.h +++ b/engines/titanic/gfx/text_skrew.h @@ -30,7 +30,7 @@ namespace Titanic { class CTextSkrew : public CPetGraphic { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/gfx/text_up.h b/engines/titanic/gfx/text_up.h index 19f150b600..0e839e0345 100644 --- a/engines/titanic/gfx/text_up.h +++ b/engines/titanic/gfx/text_up.h @@ -30,7 +30,7 @@ namespace Titanic { class CTextUp : public CPetGraphic { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/gfx/toggle_button.h b/engines/titanic/gfx/toggle_button.h index b82e255029..9eb6fdb8c8 100644 --- a/engines/titanic/gfx/toggle_button.h +++ b/engines/titanic/gfx/toggle_button.h @@ -32,7 +32,7 @@ class CToggleButton : public CBackground { private: int _fieldE0; public: - CLASSDEF + CLASSDEF; CToggleButton() : CBackground(), _fieldE0(1) {} /** diff --git a/engines/titanic/gfx/toggle_switch.h b/engines/titanic/gfx/toggle_switch.h index ce39feefda..ae96c75ebd 100644 --- a/engines/titanic/gfx/toggle_switch.h +++ b/engines/titanic/gfx/toggle_switch.h @@ -32,7 +32,7 @@ private: int _fieldBC; Point _pos1; public: - CLASSDEF + CLASSDEF; CToggleSwitch(); /** diff --git a/engines/titanic/messages/auto_sound_event.h b/engines/titanic/messages/auto_sound_event.h index 599404de9e..eb1c11c4ff 100644 --- a/engines/titanic/messages/auto_sound_event.h +++ b/engines/titanic/messages/auto_sound_event.h @@ -32,7 +32,7 @@ public: int _value1; int _value2; public: - CLASSDEF + CLASSDEF; CAutoSoundEvent(); /** diff --git a/engines/titanic/messages/bilge_auto_sound_event.h b/engines/titanic/messages/bilge_auto_sound_event.h index 5d322820ac..9a7fbd6261 100644 --- a/engines/titanic/messages/bilge_auto_sound_event.h +++ b/engines/titanic/messages/bilge_auto_sound_event.h @@ -29,7 +29,7 @@ namespace Titanic { class CBilgeAutoSoundEvent : public CAutoSoundEvent { public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/messages/bilge_dispensor_event.h b/engines/titanic/messages/bilge_dispensor_event.h index 8616373174..96ef92a54e 100644 --- a/engines/titanic/messages/bilge_dispensor_event.h +++ b/engines/titanic/messages/bilge_dispensor_event.h @@ -31,7 +31,7 @@ namespace Titanic { class CBilgeDispensorEvent : public CAutoSoundEvent { bool EnterRoomMsg(CEnterRoomMsg *msg); public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/messages/door_auto_sound_event.h b/engines/titanic/messages/door_auto_sound_event.h index 9b3ebbc3bc..e6ea1b0f98 100644 --- a/engines/titanic/messages/door_auto_sound_event.h +++ b/engines/titanic/messages/door_auto_sound_event.h @@ -34,7 +34,7 @@ public: int _fieldDC; int _fieldE0; public: - CLASSDEF + CLASSDEF; CDoorAutoSoundEvent() : CAutoSoundEvent(), _string1("z#44.wav"), _string2("z#43.wav"), _fieldDC(25), _fieldE0(25) { } diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h index 0fe6968ed4..b7205df8b3 100644 --- a/engines/titanic/messages/messages.h +++ b/engines/titanic/messages/messages.h @@ -38,7 +38,7 @@ enum MessageFlag { #define MESSAGE0(NAME) \ class NAME: public CMessage { \ public: NAME() : CMessage() {} \ - CLASSDEF \ + CLASSDEF; \ static bool isSupportedBy(const CTreeItem *item) { \ return supports(item, _type); } \ } @@ -47,7 +47,7 @@ enum MessageFlag { public: F1 _##N1; \ NAME() : CMessage(), _##N1(V1) {} \ NAME(F1 N1) : CMessage(), _##N1(N1) {} \ - CLASSDEF \ + CLASSDEF; \ static bool isSupportedBy(const CTreeItem *item) { \ return supports(item, _type); } \ } @@ -56,7 +56,7 @@ enum MessageFlag { public: F1 _##N1; F2 _##N2; \ NAME() : CMessage(), _##N1(V1), _##N2(V2) {} \ NAME(F1 N1, F2 N2) : CMessage(), _##N1(N1), _##N2(N2) {} \ - CLASSDEF \ + CLASSDEF; \ static bool isSupportedBy(const CTreeItem *item) { \ return supports(item, _type); } \ } @@ -65,7 +65,7 @@ enum MessageFlag { public: F1 _##N1; F2 _##N2; F3 _##N3; \ NAME() : CMessage(), _##N1(V1), _##N2(V2), _##N3(V3) {} \ NAME(F1 N1, F2 N2, F3 N3) : CMessage(), _##N1(N1), _##N2(N2), _##N3(N3) {} \ - CLASSDEF \ + CLASSDEF; \ static bool isSupportedBy(const CTreeItem *item) { \ return supports(item, _type); } \ } @@ -74,7 +74,7 @@ enum MessageFlag { public: F1 _##N1; F2 _##N2; F3 _##N3; F4 _##N4; \ NAME() : CMessage(), _##N1(V1), _##N2(V2), _##N3(V3), _##N4(V4) {} \ NAME(F1 N1, F2 N2, F3 N3, F4 N4) : CMessage(), _##N1(N1), _##N2(N2), _##N3(N3), _##N4(N4) {} \ - CLASSDEF \ + CLASSDEF; \ static bool isSupportedBy(const CTreeItem *item) { \ return supports(item, _type); } \ } @@ -93,7 +93,7 @@ private: */ static const MSGMAP_ENTRY *findMapEntry(const CTreeItem *treeItem, const ClassDef *classDef); public: - CLASSDEF + CLASSDEF; CMessage(); /** @@ -155,7 +155,7 @@ public: int _field1C; int _field20; public: - CLASSDEF + CLASSDEF; CEditControlMsg() : _field4(0), _field8(0), _field18(0), _field1C(0), _field20(0) {} @@ -171,7 +171,7 @@ public: int _fieldC; int _field10; public: - CLASSDEF + CLASSDEF; CLightsMsg() : CMessage(), _field4(0), _field8(0), _fieldC(0), _field10(0) {} @@ -188,7 +188,7 @@ public: int _actionVal; CString _action; public: - CLASSDEF + CLASSDEF; CTimerMsg() : CTimeMsg(), _timerCtr(0), _actionVal(0) {} CTimerMsg(uint ticks, uint timerCtr, int actionVal, const CString &action) : CTimeMsg(ticks), _timerCtr(timerCtr), _actionVal(actionVal), _action(action) {} diff --git a/engines/titanic/messages/mouse_messages.h b/engines/titanic/messages/mouse_messages.h index 8d5aa8bced..d17bd51c78 100644 --- a/engines/titanic/messages/mouse_messages.h +++ b/engines/titanic/messages/mouse_messages.h @@ -35,7 +35,7 @@ public: int _buttons; Point _mousePos; public: - CLASSDEF + CLASSDEF; static bool isSupportedBy(const CTreeItem *item) { return supports(item, _type); } @@ -47,7 +47,7 @@ public: class CMouseMoveMsg : public CMouseMsg { public: - CLASSDEF + CLASSDEF; CMouseMoveMsg() : CMouseMsg() {} CMouseMoveMsg(const Point &pt, int buttons) : CMouseMsg(pt, buttons) {} @@ -60,7 +60,7 @@ class CMouseButtonMsg : public CMouseMsg { public: int _field10; public: - CLASSDEF + CLASSDEF; CMouseButtonMsg() : CMouseMsg(), _field10(0) {} CMouseButtonMsg(const Point &pt, int buttons) : CMouseMsg(pt, buttons) {} @@ -71,7 +71,7 @@ public: class CMouseButtonDownMsg : public CMouseButtonMsg { public: - CLASSDEF + CLASSDEF; CMouseButtonDownMsg() : CMouseButtonMsg() {} CMouseButtonDownMsg(const Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} @@ -87,7 +87,7 @@ public: class CMouseButtonUpMsg : public CMouseButtonMsg { public: - CLASSDEF + CLASSDEF; CMouseButtonUpMsg() : CMouseButtonMsg() {} CMouseButtonUpMsg(const Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} @@ -103,7 +103,7 @@ public: class CMouseDoubleClickMsg : public CMouseButtonMsg { public: - CLASSDEF + CLASSDEF; CMouseDoubleClickMsg() : CMouseButtonMsg() {} CMouseDoubleClickMsg(const Point &pt, int buttons) : CMouseButtonMsg(pt, buttons) {} @@ -114,7 +114,7 @@ public: class CMouseDragMsg : public CMouseMsg { public: - CLASSDEF + CLASSDEF; CMouseDragMsg() : CMouseMsg() {} CMouseDragMsg(const Point &pt) : CMouseMsg(pt, 0) {} @@ -125,7 +125,7 @@ public: class CMouseDragMoveMsg : public CMouseDragMsg { public: - CLASSDEF + CLASSDEF; CMouseDragMoveMsg() : CMouseDragMsg() {} CMouseDragMoveMsg(const Point &pt) : CMouseDragMsg(pt) {} @@ -139,7 +139,7 @@ public: CTreeItem *_dragItem; bool _handled; public: - CLASSDEF + CLASSDEF; CMouseDragStartMsg() : CMouseDragMsg(), _dragItem(nullptr), _handled(false) {} CMouseDragStartMsg(const Point &pt) : CMouseDragMsg(pt), _dragItem(nullptr), _handled(false) {} @@ -155,7 +155,7 @@ public: int _value3; int _value4; public: - CLASSDEF + CLASSDEF; CPassOnDragStartMsg() : CMessage() {} CPassOnDragStartMsg(const Point &pt, int v3 = 0, int v4 = 0) : CMessage(), _mousePos(pt), _value3(v3), _value4(v4) {} @@ -169,7 +169,7 @@ class CMouseDragEndMsg : public CMouseDragMsg { public: CGameObject *_dropTarget; public: - CLASSDEF + CLASSDEF; CMouseDragEndMsg() : CMouseDragMsg(), _dropTarget(nullptr) {} CMouseDragEndMsg(const Point &pt, CGameObject *dropTarget = nullptr) : CMouseDragMsg(pt), _dropTarget(dropTarget) {} diff --git a/engines/titanic/messages/pet_messages.h b/engines/titanic/messages/pet_messages.h index f7d9c301a6..48e5bab64c 100644 --- a/engines/titanic/messages/pet_messages.h +++ b/engines/titanic/messages/pet_messages.h @@ -47,7 +47,7 @@ MESSAGE2(CPETTargetMsg, CString, name, "", int, numValue, -1); public: \ NAME() : CPETTargetMsg() {} \ NAME(const CString &name, int num) : CPETTargetMsg(name, num) {} \ - CLASSDEF \ + CLASSDEF; \ static bool isSupportedBy(const CTreeItem *item) { \ return supports(item, _type); \ } \ diff --git a/engines/titanic/messages/service_elevator_door.h b/engines/titanic/messages/service_elevator_door.h index 104b5735f1..cc8da0917d 100644 --- a/engines/titanic/messages/service_elevator_door.h +++ b/engines/titanic/messages/service_elevator_door.h @@ -29,7 +29,7 @@ namespace Titanic { class CServiceElevatorDoor : public CDoorAutoSoundEvent { public: - CLASSDEF + CLASSDEF; CServiceElevatorDoor(); /** diff --git a/engines/titanic/moves/enter_bomb_room.h b/engines/titanic/moves/enter_bomb_room.h index d49b17688a..7fe8287eae 100644 --- a/engines/titanic/moves/enter_bomb_room.h +++ b/engines/titanic/moves/enter_bomb_room.h @@ -31,7 +31,7 @@ class CEnterBombRoom : public CMovePlayerTo { protected: int _fieldC8; public: - CLASSDEF + CLASSDEF; CEnterBombRoom(); /** diff --git a/engines/titanic/moves/enter_bridge.h b/engines/titanic/moves/enter_bridge.h index 86cc2f3dca..a2410a6f1f 100644 --- a/engines/titanic/moves/enter_bridge.h +++ b/engines/titanic/moves/enter_bridge.h @@ -33,7 +33,7 @@ class CEnterBridge : public CGameObject { private: int _value; public: - CLASSDEF + CLASSDEF; CEnterBridge() : CGameObject(), _value(1) {} /** diff --git a/engines/titanic/moves/enter_exit_first_class_state.h b/engines/titanic/moves/enter_exit_first_class_state.h index 2038084214..a08de07711 100644 --- a/engines/titanic/moves/enter_exit_first_class_state.h +++ b/engines/titanic/moves/enter_exit_first_class_state.h @@ -41,7 +41,7 @@ public: */ static void deinit(); public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/moves/enter_exit_mini_lift.h b/engines/titanic/moves/enter_exit_mini_lift.h index e973cf8f8f..26f3dba8d4 100644 --- a/engines/titanic/moves/enter_exit_mini_lift.h +++ b/engines/titanic/moves/enter_exit_mini_lift.h @@ -32,7 +32,7 @@ private: int _fieldBC; int _fieldC0; public: - CLASSDEF + CLASSDEF; CEnterExitMiniLift() : CSGTNavigation(), _fieldBC(0), _fieldC0(1) {} /** diff --git a/engines/titanic/moves/enter_exit_sec_class_mini_lift.h b/engines/titanic/moves/enter_exit_sec_class_mini_lift.h index 935dfb7079..10c7edca7d 100644 --- a/engines/titanic/moves/enter_exit_sec_class_mini_lift.h +++ b/engines/titanic/moves/enter_exit_sec_class_mini_lift.h @@ -39,7 +39,7 @@ private: static CEnterExitSecClassMiniLiftStatics *_statics; int _value; public: - CLASSDEF + CLASSDEF; CEnterExitSecClassMiniLift() : CGameObject(), _value(0) {} static void init(); static void deinit(); diff --git a/engines/titanic/moves/enter_exit_view.h b/engines/titanic/moves/enter_exit_view.h index 774c72e512..4a3f1a967b 100644 --- a/engines/titanic/moves/enter_exit_view.h +++ b/engines/titanic/moves/enter_exit_view.h @@ -35,7 +35,7 @@ public: int _fieldC8; int _fieldCC; public: - CLASSDEF + CLASSDEF; CEnterExitView(); /** diff --git a/engines/titanic/moves/enter_sec_class_state.h b/engines/titanic/moves/enter_sec_class_state.h index 3eadfa2717..c3e3cabf20 100644 --- a/engines/titanic/moves/enter_sec_class_state.h +++ b/engines/titanic/moves/enter_sec_class_state.h @@ -31,7 +31,7 @@ class CEnterSecClassState : public CGameObject { public: int _value1, _value2; public: - CLASSDEF + CLASSDEF; CEnterSecClassState() : CGameObject(), _value1(0), _value2(0) {} /** diff --git a/engines/titanic/moves/exit_arboretum.h b/engines/titanic/moves/exit_arboretum.h index a20cf46fff..f6ebf71515 100644 --- a/engines/titanic/moves/exit_arboretum.h +++ b/engines/titanic/moves/exit_arboretum.h @@ -33,7 +33,7 @@ protected: int _fieldCC; int _fieldD0; public: - CLASSDEF + CLASSDEF; CExitArboretum(); /** diff --git a/engines/titanic/moves/exit_bridge.h b/engines/titanic/moves/exit_bridge.h index b5fcd9af27..4ab29524db 100644 --- a/engines/titanic/moves/exit_bridge.h +++ b/engines/titanic/moves/exit_bridge.h @@ -31,7 +31,7 @@ class CExitBridge : public CMovePlayerTo { private: CString _string1; public: - CLASSDEF + CLASSDEF; CExitBridge(); /** diff --git a/engines/titanic/moves/exit_lift.h b/engines/titanic/moves/exit_lift.h index 6144d4325d..04dabfaf13 100644 --- a/engines/titanic/moves/exit_lift.h +++ b/engines/titanic/moves/exit_lift.h @@ -31,7 +31,7 @@ class CExitLift : public CGameObject { public: CString _value; public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/moves/exit_pellerator.h b/engines/titanic/moves/exit_pellerator.h index 36108314bd..280d1e9a6c 100644 --- a/engines/titanic/moves/exit_pellerator.h +++ b/engines/titanic/moves/exit_pellerator.h @@ -37,7 +37,7 @@ class CExitPellerator : public CGameObject { private: static CExitPelleratorStatics *_statics; public: - CLASSDEF + CLASSDEF; static void init(); static void deinit(); diff --git a/engines/titanic/moves/exit_state_room.h b/engines/titanic/moves/exit_state_room.h index ac94297986..c0f9737817 100644 --- a/engines/titanic/moves/exit_state_room.h +++ b/engines/titanic/moves/exit_state_room.h @@ -31,7 +31,7 @@ class CExitStateRoom : public CMovePlayerTo { protected: int _fieldC8; public: - CLASSDEF + CLASSDEF; CExitStateRoom(); /** diff --git a/engines/titanic/moves/exit_tiania.h b/engines/titanic/moves/exit_tiania.h index 6ae3bc8406..c2b7772ce7 100644 --- a/engines/titanic/moves/exit_tiania.h +++ b/engines/titanic/moves/exit_tiania.h @@ -34,7 +34,7 @@ private: CString _string2; CString _string3; public: - CLASSDEF + CLASSDEF; CExitTiania(); /** diff --git a/engines/titanic/moves/move_player_in_parrot_room.h b/engines/titanic/moves/move_player_in_parrot_room.h index cdb00070a8..de693fe2e2 100644 --- a/engines/titanic/moves/move_player_in_parrot_room.h +++ b/engines/titanic/moves/move_player_in_parrot_room.h @@ -29,7 +29,7 @@ namespace Titanic { class CMovePlayerInParrotRoom : public CMovePlayerTo { public: - CLASSDEF + CLASSDEF; CMovePlayerInParrotRoom(); /** diff --git a/engines/titanic/moves/move_player_to.h b/engines/titanic/moves/move_player_to.h index 890c822acd..4bfffcb0b2 100644 --- a/engines/titanic/moves/move_player_to.h +++ b/engines/titanic/moves/move_player_to.h @@ -31,7 +31,7 @@ class CMovePlayerTo : public CGameObject { protected: CString _destination; public: - CLASSDEF + CLASSDEF; CMovePlayerTo(); /** diff --git a/engines/titanic/moves/move_player_to_from.h b/engines/titanic/moves/move_player_to_from.h index 14c6e3ae25..c9eefe532f 100644 --- a/engines/titanic/moves/move_player_to_from.h +++ b/engines/titanic/moves/move_player_to_from.h @@ -31,7 +31,7 @@ class CMovePlayerToFrom : public CGameObject { private: CString _string2; public: - CLASSDEF + CLASSDEF; CMovePlayerToFrom(); /** diff --git a/engines/titanic/moves/multi_move.h b/engines/titanic/moves/multi_move.h index a18eb7676f..977afc2a20 100644 --- a/engines/titanic/moves/multi_move.h +++ b/engines/titanic/moves/multi_move.h @@ -35,7 +35,7 @@ private: CString _string4; CString _string5; public: - CLASSDEF + CLASSDEF; CMultiMove(); /** diff --git a/engines/titanic/moves/pan_from_pel.h b/engines/titanic/moves/pan_from_pel.h index 936bac8764..c81be9f338 100644 --- a/engines/titanic/moves/pan_from_pel.h +++ b/engines/titanic/moves/pan_from_pel.h @@ -32,7 +32,7 @@ protected: int _fieldC8; CString _string1; public: - CLASSDEF + CLASSDEF; CPanFromPel(); /** diff --git a/engines/titanic/moves/restaurant_pan_handler.h b/engines/titanic/moves/restaurant_pan_handler.h index 2caf286d6c..4925aa685b 100644 --- a/engines/titanic/moves/restaurant_pan_handler.h +++ b/engines/titanic/moves/restaurant_pan_handler.h @@ -34,7 +34,7 @@ protected: CString _string1; CString _string2; public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/moves/restricted_move.h b/engines/titanic/moves/restricted_move.h index 59ff69ff3f..bdf093c353 100644 --- a/engines/titanic/moves/restricted_move.h +++ b/engines/titanic/moves/restricted_move.h @@ -31,7 +31,7 @@ class CRestrictedMove : public CMovePlayerTo { protected: int _fieldC8; public: - CLASSDEF + CLASSDEF; CRestrictedMove(); /** diff --git a/engines/titanic/moves/scraliontis_table.h b/engines/titanic/moves/scraliontis_table.h index a1b8052bfc..2ce3745654 100644 --- a/engines/titanic/moves/scraliontis_table.h +++ b/engines/titanic/moves/scraliontis_table.h @@ -34,7 +34,7 @@ private: int _fieldE8; int _fieldEC; public: - CLASSDEF + CLASSDEF; CScraliontisTable(); /** diff --git a/engines/titanic/moves/trip_down_canal.h b/engines/titanic/moves/trip_down_canal.h index debe064287..736caf4131 100644 --- a/engines/titanic/moves/trip_down_canal.h +++ b/engines/titanic/moves/trip_down_canal.h @@ -29,7 +29,7 @@ namespace Titanic { class CTripDownCanal : public CMovePlayerTo { public: - CLASSDEF + CLASSDEF; CTripDownCanal(); /** diff --git a/engines/titanic/npcs/barbot.h b/engines/titanic/npcs/barbot.h index 27a091ef29..7557fdd2c6 100644 --- a/engines/titanic/npcs/barbot.h +++ b/engines/titanic/npcs/barbot.h @@ -175,7 +175,7 @@ private: int _field33C; int _field340; public: - CLASSDEF + CLASSDEF; CBarbot(); /** diff --git a/engines/titanic/npcs/bellbot.h b/engines/titanic/npcs/bellbot.h index 6be0615303..93c4a2857d 100644 --- a/engines/titanic/npcs/bellbot.h +++ b/engines/titanic/npcs/bellbot.h @@ -31,7 +31,7 @@ class CBellBot : public CTrueTalkNPC { private: int _field108; public: - CLASSDEF + CLASSDEF; CBellBot(); /** diff --git a/engines/titanic/npcs/callbot.h b/engines/titanic/npcs/callbot.h index 6848121529..9b89d59d3f 100644 --- a/engines/titanic/npcs/callbot.h +++ b/engines/titanic/npcs/callbot.h @@ -32,7 +32,7 @@ protected: CString _string1; int _fieldC8; public: - CLASSDEF + CLASSDEF; CCallBot(); /** diff --git a/engines/titanic/npcs/character.h b/engines/titanic/npcs/character.h index 2362f01dac..6f3de9a06a 100644 --- a/engines/titanic/npcs/character.h +++ b/engines/titanic/npcs/character.h @@ -38,7 +38,7 @@ protected: int _fieldC4; CString _charName; public: - CLASSDEF + CLASSDEF; CCharacter(); /** diff --git a/engines/titanic/npcs/deskbot.h b/engines/titanic/npcs/deskbot.h index ff5459910b..e900781ea6 100644 --- a/engines/titanic/npcs/deskbot.h +++ b/engines/titanic/npcs/deskbot.h @@ -47,7 +47,7 @@ public: bool _deskbotActive; int _classNum; public: - CLASSDEF + CLASSDEF; CDeskbot(); /** diff --git a/engines/titanic/npcs/doorbot.h b/engines/titanic/npcs/doorbot.h index 9ea7de6c77..b62026c7d9 100644 --- a/engines/titanic/npcs/doorbot.h +++ b/engines/titanic/npcs/doorbot.h @@ -37,7 +37,7 @@ private: int _field110; int _field114; public: - CLASSDEF + CLASSDEF; CDoorbot(); /** diff --git a/engines/titanic/npcs/liftbot.h b/engines/titanic/npcs/liftbot.h index e993da0d32..7550a8a6f0 100644 --- a/engines/titanic/npcs/liftbot.h +++ b/engines/titanic/npcs/liftbot.h @@ -36,7 +36,7 @@ private: private: int _field108; public: - CLASSDEF + CLASSDEF; CLiftBot(); /** diff --git a/engines/titanic/npcs/maitre_d.h b/engines/titanic/npcs/maitre_d.h index 6a63348d28..af73f02a9a 100644 --- a/engines/titanic/npcs/maitre_d.h +++ b/engines/titanic/npcs/maitre_d.h @@ -41,7 +41,7 @@ private: int _field134; int _field138; public: - CLASSDEF + CLASSDEF; CMaitreD(); /** diff --git a/engines/titanic/npcs/mobile.h b/engines/titanic/npcs/mobile.h index 42effc6715..f9b3955d71 100644 --- a/engines/titanic/npcs/mobile.h +++ b/engines/titanic/npcs/mobile.h @@ -33,7 +33,7 @@ private: Point _pos1; int _fieldDC; public: - CLASSDEF + CLASSDEF; CMobile(); /** diff --git a/engines/titanic/npcs/parrot.h b/engines/titanic/npcs/parrot.h index 010d9af503..a3c8540f0e 100644 --- a/engines/titanic/npcs/parrot.h +++ b/engines/titanic/npcs/parrot.h @@ -92,7 +92,7 @@ private: int _field1E8; int _field1EC; public: - CLASSDEF + CLASSDEF; CParrot(); /** diff --git a/engines/titanic/npcs/robot_controller.h b/engines/titanic/npcs/robot_controller.h index 54b0a20b24..6cbf57aef2 100644 --- a/engines/titanic/npcs/robot_controller.h +++ b/engines/titanic/npcs/robot_controller.h @@ -31,7 +31,7 @@ class CRobotController : public CGameObject { protected: CString _string1; public: - CLASSDEF + CLASSDEF; CRobotController(); /** diff --git a/engines/titanic/npcs/starlings.h b/engines/titanic/npcs/starlings.h index 40cb1b8083..4d96e5c77f 100644 --- a/engines/titanic/npcs/starlings.h +++ b/engines/titanic/npcs/starlings.h @@ -31,7 +31,7 @@ class CStarlings : public CCharacter { private: static int _v1; public: - CLASSDEF + CLASSDEF; CStarlings(); /** diff --git a/engines/titanic/npcs/succubus.h b/engines/titanic/npcs/succubus.h index a78a88b69a..f6f5a6b9e9 100644 --- a/engines/titanic/npcs/succubus.h +++ b/engines/titanic/npcs/succubus.h @@ -87,7 +87,7 @@ private: int _field1D4; int _field1D8; public: - CLASSDEF + CLASSDEF; CSuccUBus(); /** diff --git a/engines/titanic/npcs/summon_bots.h b/engines/titanic/npcs/summon_bots.h index 245d047bfa..ee537fee76 100644 --- a/engines/titanic/npcs/summon_bots.h +++ b/engines/titanic/npcs/summon_bots.h @@ -33,7 +33,7 @@ protected: int _fieldC8; int _fieldCC; public: - CLASSDEF + CLASSDEF; CSummonBots(); /** diff --git a/engines/titanic/npcs/titania.h b/engines/titanic/npcs/titania.h index 3eb95c08d3..4edd626ab6 100644 --- a/engines/titanic/npcs/titania.h +++ b/engines/titanic/npcs/titania.h @@ -42,7 +42,7 @@ private: int _fieldFC; int _field100; public: - CLASSDEF + CLASSDEF; CTitania(); /** diff --git a/engines/titanic/npcs/true_talk_npc.h b/engines/titanic/npcs/true_talk_npc.h index 7202f253de..cece8ed055 100644 --- a/engines/titanic/npcs/true_talk_npc.h +++ b/engines/titanic/npcs/true_talk_npc.h @@ -78,7 +78,7 @@ protected: */ void performAction(bool startTalking, CViewItem *view); public: - CLASSDEF + CLASSDEF; CTrueTalkNPC(); /** diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 39df91cf91..468c4f3b14 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -122,7 +122,7 @@ public: CTreeItem *_activeNPC; CGameObject *_remoteTarget; public: - CLASSDEF + CLASSDEF; CPetControl(); /** diff --git a/engines/titanic/pet_control/pet_drag_chev.h b/engines/titanic/pet_control/pet_drag_chev.h index 1ca9788f5b..153b954c40 100644 --- a/engines/titanic/pet_control/pet_drag_chev.h +++ b/engines/titanic/pet_control/pet_drag_chev.h @@ -34,7 +34,7 @@ protected: bool MouseDragMoveMsg(CMouseDragMoveMsg *msg); bool MouseDragEndMsg(CMouseDragEndMsg *msg); public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/pet_control/pet_graphic.h b/engines/titanic/pet_control/pet_graphic.h index 34badfd8a5..082a27fe0d 100644 --- a/engines/titanic/pet_control/pet_graphic.h +++ b/engines/titanic/pet_control/pet_graphic.h @@ -30,7 +30,7 @@ namespace Titanic { class CPetGraphic : public CGameObject { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/pet_control/pet_graphic2.h b/engines/titanic/pet_control/pet_graphic2.h index 4e77662a82..6b832fef7d 100644 --- a/engines/titanic/pet_control/pet_graphic2.h +++ b/engines/titanic/pet_control/pet_graphic2.h @@ -30,7 +30,7 @@ namespace Titanic { class CPetGraphic2 : public CGameObject { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/pet_control/pet_leaf.h b/engines/titanic/pet_control/pet_leaf.h index 0d187423ff..8428647eab 100644 --- a/engines/titanic/pet_control/pet_leaf.h +++ b/engines/titanic/pet_control/pet_leaf.h @@ -30,7 +30,7 @@ namespace Titanic { class PETLeaf : public CGameObject { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/pet_control/pet_mode_off.h b/engines/titanic/pet_control/pet_mode_off.h index 0a4851ad72..a906bc6174 100644 --- a/engines/titanic/pet_control/pet_mode_off.h +++ b/engines/titanic/pet_control/pet_mode_off.h @@ -30,7 +30,7 @@ namespace Titanic { class CPetModeOff : public CToggleSwitch { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; CPetModeOff(); /** diff --git a/engines/titanic/pet_control/pet_mode_on.h b/engines/titanic/pet_control/pet_mode_on.h index d33a0d2829..074e33ea8c 100644 --- a/engines/titanic/pet_control/pet_mode_on.h +++ b/engines/titanic/pet_control/pet_mode_on.h @@ -30,7 +30,7 @@ namespace Titanic { class CPetModeOn : public CToggleSwitch { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; CPetModeOn(); /** diff --git a/engines/titanic/pet_control/pet_mode_panel.h b/engines/titanic/pet_control/pet_mode_panel.h index 17ce48d8b8..0812c11942 100644 --- a/engines/titanic/pet_control/pet_mode_panel.h +++ b/engines/titanic/pet_control/pet_mode_panel.h @@ -30,7 +30,7 @@ namespace Titanic { class CPetModePanel : public CToggleSwitch { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; CPetModePanel(); /** diff --git a/engines/titanic/pet_control/pet_pannel1.h b/engines/titanic/pet_control/pet_pannel1.h index c81d451d50..7ca7378a09 100644 --- a/engines/titanic/pet_control/pet_pannel1.h +++ b/engines/titanic/pet_control/pet_pannel1.h @@ -30,7 +30,7 @@ namespace Titanic { class CPetPannel1 : public CPetGraphic { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/pet_control/pet_pannel2.h b/engines/titanic/pet_control/pet_pannel2.h index 404dd88be5..62dd2aae2b 100644 --- a/engines/titanic/pet_control/pet_pannel2.h +++ b/engines/titanic/pet_control/pet_pannel2.h @@ -30,7 +30,7 @@ namespace Titanic { class CPetPannel2 : public CPetGraphic { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/pet_control/pet_pannel3.h b/engines/titanic/pet_control/pet_pannel3.h index addf6144eb..2acf269873 100644 --- a/engines/titanic/pet_control/pet_pannel3.h +++ b/engines/titanic/pet_control/pet_pannel3.h @@ -30,7 +30,7 @@ namespace Titanic { class CPetPannel3 : public CPetGraphic { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/sound/auto_music_player.h b/engines/titanic/sound/auto_music_player.h index 5d9bb0f332..e9e9763116 100644 --- a/engines/titanic/sound/auto_music_player.h +++ b/engines/titanic/sound/auto_music_player.h @@ -33,7 +33,7 @@ class CAutoMusicPlayer : public CAutoMusicPlayerBase { private: CString _string2; public: - CLASSDEF + CLASSDEF; CAutoMusicPlayer(); /** diff --git a/engines/titanic/sound/auto_music_player_base.h b/engines/titanic/sound/auto_music_player_base.h index d6d9926db3..657c5272e4 100644 --- a/engines/titanic/sound/auto_music_player_base.h +++ b/engines/titanic/sound/auto_music_player_base.h @@ -35,7 +35,7 @@ protected: int _fieldD0; int _fieldD4; public: - CLASSDEF + CLASSDEF; CAutoMusicPlayerBase(); /** diff --git a/engines/titanic/sound/auto_sound_player.h b/engines/titanic/sound/auto_sound_player.h index b85bb68cea..6de2b12561 100644 --- a/engines/titanic/sound/auto_sound_player.h +++ b/engines/titanic/sound/auto_sound_player.h @@ -40,7 +40,7 @@ public: int _fieldE4; int _fieldE8; public: - CLASSDEF + CLASSDEF; CAutoSoundPlayer(); /** diff --git a/engines/titanic/sound/auto_sound_player_adsr.h b/engines/titanic/sound/auto_sound_player_adsr.h index 9dd9ec5b15..6dc2853425 100644 --- a/engines/titanic/sound/auto_sound_player_adsr.h +++ b/engines/titanic/sound/auto_sound_player_adsr.h @@ -33,7 +33,7 @@ private: CString _string3; CString _string4; public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/sound/background_sound_maker.h b/engines/titanic/sound/background_sound_maker.h index 32fb50b080..022d8f4741 100644 --- a/engines/titanic/sound/background_sound_maker.h +++ b/engines/titanic/sound/background_sound_maker.h @@ -31,7 +31,7 @@ class CBackgroundSoundMaker : public CGameObject { public: int _value; public: - CLASSDEF + CLASSDEF; CBackgroundSoundMaker() : CGameObject(), _value(0) {} /** diff --git a/engines/titanic/sound/bird_song.h b/engines/titanic/sound/bird_song.h index 1b1e309931..35758e5b77 100644 --- a/engines/titanic/sound/bird_song.h +++ b/engines/titanic/sound/bird_song.h @@ -31,7 +31,7 @@ class CBirdSong : public CRoomAutoSoundPlayer { public: int _value; public: - CLASSDEF + CLASSDEF; CBirdSong() : CRoomAutoSoundPlayer(), _value(0) {} /** diff --git a/engines/titanic/sound/dome_from_top_of_well.h b/engines/titanic/sound/dome_from_top_of_well.h index 62c97da137..fba71685f1 100644 --- a/engines/titanic/sound/dome_from_top_of_well.h +++ b/engines/titanic/sound/dome_from_top_of_well.h @@ -30,7 +30,7 @@ namespace Titanic { class CDomeFromTopOfWell : public CViewAutoSoundPlayer { DECLARE_MESSAGE_MAP public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/sound/enter_view_toggles_other_music.h b/engines/titanic/sound/enter_view_toggles_other_music.h index adcf3df2d4..6bbeea4890 100644 --- a/engines/titanic/sound/enter_view_toggles_other_music.h +++ b/engines/titanic/sound/enter_view_toggles_other_music.h @@ -31,7 +31,7 @@ class CEnterViewTogglesOtherMusic : public CTriggerAutoMusicPlayer { protected: int _fieldC8; public: - CLASSDEF + CLASSDEF; CEnterViewTogglesOtherMusic(); /** diff --git a/engines/titanic/sound/gondolier_song.h b/engines/titanic/sound/gondolier_song.h index 710cd961fe..0a7120c0fc 100644 --- a/engines/titanic/sound/gondolier_song.h +++ b/engines/titanic/sound/gondolier_song.h @@ -31,7 +31,7 @@ class CGondolierSong : public CRoomAutoSoundPlayer { public: int _value; public: - CLASSDEF + CLASSDEF; CGondolierSong() : CRoomAutoSoundPlayer(), _value(0) {} /** diff --git a/engines/titanic/sound/music_player.h b/engines/titanic/sound/music_player.h index fa877ec861..a2c495d2eb 100644 --- a/engines/titanic/sound/music_player.h +++ b/engines/titanic/sound/music_player.h @@ -36,7 +36,7 @@ protected: int _fieldCC; int _fieldD0; public: - CLASSDEF + CLASSDEF; CMusicPlayer() : CGameObject(), _fieldBC(0), _fieldCC(0), _fieldD0(100) {} diff --git a/engines/titanic/sound/node_auto_sound_player.h b/engines/titanic/sound/node_auto_sound_player.h index 06322f84d3..e980841c36 100644 --- a/engines/titanic/sound/node_auto_sound_player.h +++ b/engines/titanic/sound/node_auto_sound_player.h @@ -33,7 +33,7 @@ class CNodeAutoSoundPlayer : public CAutoSoundPlayer { private: int _fieldEC; public: - CLASSDEF + CLASSDEF; CNodeAutoSoundPlayer() : CAutoSoundPlayer(), _fieldEC(1) {} /** diff --git a/engines/titanic/sound/restricted_auto_music_player.h b/engines/titanic/sound/restricted_auto_music_player.h index be40bd84a1..4a26d3770a 100644 --- a/engines/titanic/sound/restricted_auto_music_player.h +++ b/engines/titanic/sound/restricted_auto_music_player.h @@ -36,7 +36,7 @@ private: CString _string5; CString _string6; public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/sound/room_auto_sound_player.h b/engines/titanic/sound/room_auto_sound_player.h index 8b5fc86488..9c3feb5d91 100644 --- a/engines/titanic/sound/room_auto_sound_player.h +++ b/engines/titanic/sound/room_auto_sound_player.h @@ -31,7 +31,7 @@ namespace Titanic { class CRoomAutoSoundPlayer : public CAutoSoundPlayer { bool EnterRoomMsg(CEnterRoomMsg *msg); public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/sound/room_trigger_auto_music_player.h b/engines/titanic/sound/room_trigger_auto_music_player.h index da378a32e5..250adad864 100644 --- a/engines/titanic/sound/room_trigger_auto_music_player.h +++ b/engines/titanic/sound/room_trigger_auto_music_player.h @@ -31,7 +31,7 @@ namespace Titanic { class CRoomTriggerAutoMusicPlayer : public CTriggerAutoMusicPlayer { bool EnterRoomMsg(CEnterRoomMsg *msg); public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/sound/season_noises.h b/engines/titanic/sound/season_noises.h index 6d65de8373..ff39b01d73 100644 --- a/engines/titanic/sound/season_noises.h +++ b/engines/titanic/sound/season_noises.h @@ -35,7 +35,7 @@ private: CString _string4; CString _string5; public: - CLASSDEF + CLASSDEF; CSeasonNoises(); /** diff --git a/engines/titanic/sound/seasonal_music_player.h b/engines/titanic/sound/seasonal_music_player.h index 3c434ec023..30c296d24d 100644 --- a/engines/titanic/sound/seasonal_music_player.h +++ b/engines/titanic/sound/seasonal_music_player.h @@ -38,7 +38,7 @@ private: int _fieldF0; int _fieldF4; public: - CLASSDEF + CLASSDEF; CSeasonalMusicPlayer(); /** diff --git a/engines/titanic/sound/titania_speech.h b/engines/titanic/sound/titania_speech.h index 1ff52be1a2..c9b93043f6 100644 --- a/engines/titanic/sound/titania_speech.h +++ b/engines/titanic/sound/titania_speech.h @@ -33,7 +33,7 @@ class CTitaniaSpeech : public CGameObject { private: int _value1, _value2; public: - CLASSDEF + CLASSDEF; CTitaniaSpeech() : CGameObject(), _value1(1), _value2(0) {} /** diff --git a/engines/titanic/sound/trigger_auto_music_player.h b/engines/titanic/sound/trigger_auto_music_player.h index 11c096682a..537e780db6 100644 --- a/engines/titanic/sound/trigger_auto_music_player.h +++ b/engines/titanic/sound/trigger_auto_music_player.h @@ -31,7 +31,7 @@ class CTriggerAutoMusicPlayer : public CGameObject { protected: CString _fieldBC; public: - CLASSDEF + CLASSDEF; /** * Save the data for the class to file diff --git a/engines/titanic/sound/view_auto_sound_player.h b/engines/titanic/sound/view_auto_sound_player.h index dab96678da..29bdee71a0 100644 --- a/engines/titanic/sound/view_auto_sound_player.h +++ b/engines/titanic/sound/view_auto_sound_player.h @@ -31,7 +31,7 @@ class CViewAutoSoundPlayer : public CAutoSoundPlayer { private: int _fieldEC; public: - CLASSDEF + CLASSDEF; CViewAutoSoundPlayer() : CAutoSoundPlayer(), _fieldEC(0) {} /** diff --git a/engines/titanic/sound/view_toggles_other_music.h b/engines/titanic/sound/view_toggles_other_music.h index f97f690998..a5ba68ba45 100644 --- a/engines/titanic/sound/view_toggles_other_music.h +++ b/engines/titanic/sound/view_toggles_other_music.h @@ -31,7 +31,7 @@ class CViewTogglesOtherMusic : public CEnterViewTogglesOtherMusic { private: int _fieldCC; public: - CLASSDEF + CLASSDEF; CViewTogglesOtherMusic(); /** diff --git a/engines/titanic/sound/water_lapping_sounds.h b/engines/titanic/sound/water_lapping_sounds.h index 7fc7cc4361..d7017d29c1 100644 --- a/engines/titanic/sound/water_lapping_sounds.h +++ b/engines/titanic/sound/water_lapping_sounds.h @@ -32,7 +32,7 @@ class CWaterLappingSounds : public CRoomAutoSoundPlayer { public: int _value; public: - CLASSDEF + CLASSDEF; CWaterLappingSounds() : CRoomAutoSoundPlayer(), _value(0) {} /** diff --git a/engines/titanic/star_control/star_control.h b/engines/titanic/star_control/star_control.h index 2f6a86ad78..f5f0af2653 100644 --- a/engines/titanic/star_control/star_control.h +++ b/engines/titanic/star_control/star_control.h @@ -47,7 +47,7 @@ private: */ void newFrame(); public: - CLASSDEF + CLASSDEF; CStarControl(); virtual ~CStarControl(); diff --git a/engines/titanic/support/movie_clip.h b/engines/titanic/support/movie_clip.h index 813996bbf0..513ed4a339 100644 --- a/engines/titanic/support/movie_clip.h +++ b/engines/titanic/support/movie_clip.h @@ -49,7 +49,7 @@ public: int _startFrame; int _endFrame; public: - CLASSDEF + CLASSDEF; CMovieClip(); CMovieClip(const CString &name, int startFrame, int endFrame); diff --git a/engines/titanic/support/time_event_info.h b/engines/titanic/support/time_event_info.h index ee787bcbef..ebf5b54458 100644 --- a/engines/titanic/support/time_event_info.h +++ b/engines/titanic/support/time_event_info.h @@ -62,7 +62,7 @@ public: bool _persisent; CString _targetName; public: - CLASSDEF + CLASSDEF; CTimeEventInfo(); CTimeEventInfo(uint ticks, bool repeated, uint firstDuration, uint repeatDuration, CTreeItem *target, int endVal, const CString &action); -- cgit v1.2.3 From c6e2f4e68020dddea2a8248e8dd7ecdcb2147314 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 Jul 2016 20:48:44 -0400 Subject: TITANIC: gcc compilation fix --- engines/titanic/core/message_target.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/titanic/core/message_target.h b/engines/titanic/core/message_target.h index 05ceaad26a..0afd847c34 100644 --- a/engines/titanic/core/message_target.h +++ b/engines/titanic/core/message_target.h @@ -81,7 +81,7 @@ protected: \ { &TheBaseClass::getThisMessageMap, &_messageEntries[0] }; \ return &messageMap; \ } \ - static const int DUMMY + static const int DUMMY = 0 class CMessageTarget: public CSaveableObject { DECLARE_MESSAGE_MAP -- cgit v1.2.3 From 875002daea7a007c2727685a767eaaf3709a5252 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 Jul 2016 20:52:21 -0400 Subject: TITANIC: Add semicolon to DECLARE_MESSAGE_MAP usage --- engines/titanic/carry/arm.h | 2 +- engines/titanic/carry/brain.h | 2 +- engines/titanic/carry/bridge_piece.h | 2 +- engines/titanic/carry/carry.h | 2 +- engines/titanic/carry/carry_parrot.h | 2 +- engines/titanic/carry/chicken.h | 2 +- engines/titanic/carry/crushed_tv.h | 2 +- engines/titanic/carry/feathers.h | 2 +- engines/titanic/carry/hose_end.h | 2 +- engines/titanic/carry/magazine.h | 2 +- engines/titanic/carry/napkin.h | 2 +- engines/titanic/carry/note.h | 2 +- engines/titanic/carry/parcel.h | 2 +- engines/titanic/carry/phonograph_cylinder.h | 2 +- engines/titanic/carry/photograph.h | 2 +- engines/titanic/carry/plug_in.h | 2 +- engines/titanic/carry/sweets.h | 2 +- engines/titanic/core/background.h | 2 +- engines/titanic/core/dont_save_file_item.h | 2 +- engines/titanic/core/file_item.h | 2 +- engines/titanic/core/game_object.h | 2 +- engines/titanic/core/link_item.h | 2 +- engines/titanic/core/message_target.h | 4 ++-- engines/titanic/core/named_item.h | 2 +- engines/titanic/core/node_item.h | 2 +- engines/titanic/core/project_item.h | 2 +- engines/titanic/core/room_item.h | 2 +- engines/titanic/core/static_image.h | 2 +- engines/titanic/core/tree_item.h | 2 +- engines/titanic/core/turn_on_object.h | 2 +- engines/titanic/core/view_item.h | 2 +- engines/titanic/game/arb_background.h | 2 +- engines/titanic/game/arboretum_gate.h | 2 +- engines/titanic/game/broken_pell_base.h | 2 +- engines/titanic/game/cdrom.h | 2 +- engines/titanic/game/cdrom_computer.h | 2 +- engines/titanic/game/cdrom_tray.h | 2 +- engines/titanic/game/computer.h | 2 +- engines/titanic/game/computer_screen.h | 2 +- engines/titanic/game/dead_area.h | 2 +- engines/titanic/game/leave_sec_class_state.h | 2 +- engines/titanic/game/music_room_phonograph.h | 2 +- engines/titanic/game/musical_instrument.h | 2 +- engines/titanic/game/navigation_computer.h | 2 +- engines/titanic/game/null_port_hole.h | 2 +- engines/titanic/game/parrot/parrot_lobby_object.h | 2 +- engines/titanic/game/pet/pet_class1.h | 2 +- engines/titanic/game/pet/pet_class2.h | 2 +- engines/titanic/game/pet/pet_class3.h | 2 +- engines/titanic/game/pet/pet_monitor.h | 2 +- engines/titanic/game/pet/pet_position.h | 2 +- engines/titanic/game/pet/pet_transport.h | 2 +- engines/titanic/game/sgt/sgt_state_room.h | 2 +- engines/titanic/game/splash_animation.h | 2 +- engines/titanic/game/start_action.h | 2 +- engines/titanic/game/television.h | 2 +- engines/titanic/game/transport/lift.h | 2 +- engines/titanic/game/transport/lift_indicator.h | 2 +- engines/titanic/game/transport/pellerator.h | 2 +- engines/titanic/game/transport/transport.h | 2 +- engines/titanic/gfx/chev_left_off.h | 2 +- engines/titanic/gfx/chev_left_on.h | 2 +- engines/titanic/gfx/chev_right_off.h | 2 +- engines/titanic/gfx/chev_right_on.h | 2 +- engines/titanic/gfx/chev_send_rec_switch.h | 2 +- engines/titanic/gfx/elevator_button.h | 2 +- engines/titanic/gfx/get_from_succ.h | 2 +- engines/titanic/gfx/helmet_on_off.h | 2 +- engines/titanic/gfx/home_photo.h | 2 +- engines/titanic/gfx/icon_nav_action.h | 2 +- engines/titanic/gfx/icon_nav_butt.h | 2 +- engines/titanic/gfx/icon_nav_down.h | 2 +- engines/titanic/gfx/icon_nav_image.h | 2 +- engines/titanic/gfx/icon_nav_left.h | 2 +- engines/titanic/gfx/icon_nav_receive.h | 2 +- engines/titanic/gfx/icon_nav_right.h | 2 +- engines/titanic/gfx/icon_nav_send.h | 2 +- engines/titanic/gfx/icon_nav_up.h | 2 +- engines/titanic/gfx/keybrd_butt.h | 2 +- engines/titanic/gfx/music_slider.h | 2 +- engines/titanic/gfx/music_switch.h | 2 +- engines/titanic/gfx/send_to_succ.h | 2 +- engines/titanic/gfx/sgt_selector.h | 2 +- engines/titanic/gfx/small_chev_left_off.h | 2 +- engines/titanic/gfx/small_chev_left_on.h | 2 +- engines/titanic/gfx/small_chev_right_off.h | 2 +- engines/titanic/gfx/small_chev_right_on.h | 2 +- engines/titanic/gfx/st_button.h | 2 +- engines/titanic/gfx/text_down.h | 2 +- engines/titanic/gfx/text_skrew.h | 2 +- engines/titanic/gfx/text_up.h | 2 +- engines/titanic/gfx/toggle_button.h | 2 +- engines/titanic/npcs/character.h | 2 +- engines/titanic/npcs/deskbot.h | 2 +- engines/titanic/npcs/mobile.h | 2 +- engines/titanic/npcs/true_talk_npc.h | 2 +- engines/titanic/pet_control/pet_control.h | 2 +- engines/titanic/pet_control/pet_drag_chev.h | 2 +- engines/titanic/pet_control/pet_graphic.h | 2 +- engines/titanic/pet_control/pet_graphic2.h | 2 +- engines/titanic/pet_control/pet_leaf.h | 2 +- engines/titanic/pet_control/pet_mode_off.h | 2 +- engines/titanic/pet_control/pet_mode_on.h | 2 +- engines/titanic/pet_control/pet_mode_panel.h | 2 +- engines/titanic/pet_control/pet_pannel1.h | 2 +- engines/titanic/pet_control/pet_pannel2.h | 2 +- engines/titanic/pet_control/pet_pannel3.h | 2 +- engines/titanic/sound/dome_from_top_of_well.h | 2 +- engines/titanic/sound/water_lapping_sounds.h | 2 +- engines/titanic/star_control/star_control.h | 2 +- 110 files changed, 111 insertions(+), 111 deletions(-) diff --git a/engines/titanic/carry/arm.h b/engines/titanic/carry/arm.h index 48201ed90a..fc8bba1f08 100644 --- a/engines/titanic/carry/arm.h +++ b/engines/titanic/carry/arm.h @@ -31,7 +31,7 @@ namespace Titanic { class CArm : public CCarry { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool PuzzleSolvedMsg(CPuzzleSolvedMsg *msg); bool TranslateObjectMsg(CTranslateObjectMsg *msg); bool UseWithOtherMsg(CUseWithOtherMsg *msg); diff --git a/engines/titanic/carry/brain.h b/engines/titanic/carry/brain.h index 5f76e7deff..bcba161e27 100644 --- a/engines/titanic/carry/brain.h +++ b/engines/titanic/carry/brain.h @@ -31,7 +31,7 @@ namespace Titanic { class CBrain : public CCarry { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool UseWithOtherMsg(CUseWithOtherMsg *msg); bool VisibleMsg(CVisibleMsg *msg); bool MouseDragStartMsg(CMouseDragStartMsg *msg); diff --git a/engines/titanic/carry/bridge_piece.h b/engines/titanic/carry/bridge_piece.h index 01c44c0b97..80a1cc98a8 100644 --- a/engines/titanic/carry/bridge_piece.h +++ b/engines/titanic/carry/bridge_piece.h @@ -28,7 +28,7 @@ namespace Titanic { class CBridgePiece : public CCarry { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool UseWithOtherMsg(CUseWithOtherMsg *msg); bool PassOnDragStartMsg(CPassOnDragStartMsg *msg); private: diff --git a/engines/titanic/carry/carry.h b/engines/titanic/carry/carry.h index f4ea648b80..72f4024904 100644 --- a/engines/titanic/carry/carry.h +++ b/engines/titanic/carry/carry.h @@ -30,7 +30,7 @@ namespace Titanic { class CCarry : public CGameObject { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool MouseDragStartMsg(CMouseDragStartMsg *msg); bool MouseDragMoveMsg(CMouseDragMoveMsg *msg); bool MouseDragEndMsg(CMouseDragEndMsg *msg); diff --git a/engines/titanic/carry/carry_parrot.h b/engines/titanic/carry/carry_parrot.h index 70caee85d3..2980f26d8a 100644 --- a/engines/titanic/carry/carry_parrot.h +++ b/engines/titanic/carry/carry_parrot.h @@ -31,7 +31,7 @@ namespace Titanic { class CCarryParrot : public CCarry { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool PETGainedObjectMsg(CPETGainedObjectMsg *msg); bool TimerMsg(CTimerMsg *msg); bool IsParrotPresentMsg(CIsParrotPresentMsg *msg); diff --git a/engines/titanic/carry/chicken.h b/engines/titanic/carry/chicken.h index c78d4a023b..65fe30fd81 100644 --- a/engines/titanic/carry/chicken.h +++ b/engines/titanic/carry/chicken.h @@ -30,7 +30,7 @@ namespace Titanic { class CChicken : public CCarry { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool UseWithOtherMsg(CUseWithOtherMsg *msg); bool UseWithCharMsg(CUseWithCharMsg *msg); bool ActMsg(CActMsg *msg); diff --git a/engines/titanic/carry/crushed_tv.h b/engines/titanic/carry/crushed_tv.h index ba6b52cd2e..340930f842 100644 --- a/engines/titanic/carry/crushed_tv.h +++ b/engines/titanic/carry/crushed_tv.h @@ -30,7 +30,7 @@ namespace Titanic { class CCrushedTV : public CCarry { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool ActMsg(CActMsg *msg); bool UseWithCharMsg(CUseWithCharMsg *msg); bool MouseDragStartMsg(CMouseDragStartMsg *msg); diff --git a/engines/titanic/carry/feathers.h b/engines/titanic/carry/feathers.h index 4d193afc3f..7282bcb580 100644 --- a/engines/titanic/carry/feathers.h +++ b/engines/titanic/carry/feathers.h @@ -28,7 +28,7 @@ namespace Titanic { class CFeathers : public CCarry { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; CFeathers(); diff --git a/engines/titanic/carry/hose_end.h b/engines/titanic/carry/hose_end.h index 6996d6367a..836c94456a 100644 --- a/engines/titanic/carry/hose_end.h +++ b/engines/titanic/carry/hose_end.h @@ -28,7 +28,7 @@ namespace Titanic { class CHoseEnd : public CHose { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; CHoseEnd(); diff --git a/engines/titanic/carry/magazine.h b/engines/titanic/carry/magazine.h index 69b9937b85..d1db4689ba 100644 --- a/engines/titanic/carry/magazine.h +++ b/engines/titanic/carry/magazine.h @@ -30,7 +30,7 @@ namespace Titanic { class CMagazine : public CCarry { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool UseWithCharMsg(CUseWithCharMsg *msg); bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg); bool VisibleMsg(CVisibleMsg *msg); diff --git a/engines/titanic/carry/napkin.h b/engines/titanic/carry/napkin.h index cec7a6b7fc..ce47dd6059 100644 --- a/engines/titanic/carry/napkin.h +++ b/engines/titanic/carry/napkin.h @@ -29,7 +29,7 @@ namespace Titanic { class CNapkin : public CCarry { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool UseWithOtherMsg(CUseWithOtherMsg *msg); public: CLASSDEF; diff --git a/engines/titanic/carry/note.h b/engines/titanic/carry/note.h index 4edb2024c5..37ebf96d72 100644 --- a/engines/titanic/carry/note.h +++ b/engines/titanic/carry/note.h @@ -29,7 +29,7 @@ namespace Titanic { class CNote : public CCarry { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg); private: CString _string6; diff --git a/engines/titanic/carry/parcel.h b/engines/titanic/carry/parcel.h index 88282a6c14..f33c2ff65a 100644 --- a/engines/titanic/carry/parcel.h +++ b/engines/titanic/carry/parcel.h @@ -28,7 +28,7 @@ namespace Titanic { class CParcel : public CCarry { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; CParcel(); diff --git a/engines/titanic/carry/phonograph_cylinder.h b/engines/titanic/carry/phonograph_cylinder.h index ba56bb3ca2..bbb1524cb5 100644 --- a/engines/titanic/carry/phonograph_cylinder.h +++ b/engines/titanic/carry/phonograph_cylinder.h @@ -28,7 +28,7 @@ namespace Titanic { class CPhonographCylinder : public CCarry { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool UseWithOtherMsg(CUseWithOtherMsg *msg); bool QueryCylinderMsg(CQueryCylinderMsg *msg); bool RecordOntoCylinderMsg(CRecordOntoCylinderMsg *msg); diff --git a/engines/titanic/carry/photograph.h b/engines/titanic/carry/photograph.h index fcae07be07..9cea1e4799 100644 --- a/engines/titanic/carry/photograph.h +++ b/engines/titanic/carry/photograph.h @@ -31,7 +31,7 @@ namespace Titanic { class CPhotograph : public CCarry { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool MouseDragEndMsg(CMouseDragEndMsg *msg); bool MouseDragStartMsg(CMouseDragStartMsg *msg); bool PETGainedObjectMsg(CPETGainedObjectMsg *msg); diff --git a/engines/titanic/carry/plug_in.h b/engines/titanic/carry/plug_in.h index 9601dc161c..1358a99e39 100644 --- a/engines/titanic/carry/plug_in.h +++ b/engines/titanic/carry/plug_in.h @@ -28,7 +28,7 @@ namespace Titanic { class CPlugIn : public CCarry { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool UseWithOtherMsg(CUseWithOtherMsg *msg); private: int _field12C; diff --git a/engines/titanic/carry/sweets.h b/engines/titanic/carry/sweets.h index ed598767fc..3655fabfb9 100644 --- a/engines/titanic/carry/sweets.h +++ b/engines/titanic/carry/sweets.h @@ -29,7 +29,7 @@ namespace Titanic { class CSweets : public CCarry { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); public: CLASSDEF; diff --git a/engines/titanic/core/background.h b/engines/titanic/core/background.h index 004ab4d0cf..6a2fd21454 100644 --- a/engines/titanic/core/background.h +++ b/engines/titanic/core/background.h @@ -29,7 +29,7 @@ namespace Titanic { class CBackground : public CGameObject { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool StatusChangeMsg(CStatusChangeMsg *msg); bool SetFrameMsg(CSetFrameMsg *msg); bool VisibleMsg(CVisibleMsg *msg); diff --git a/engines/titanic/core/dont_save_file_item.h b/engines/titanic/core/dont_save_file_item.h index 92425ae009..f5ec4f791d 100644 --- a/engines/titanic/core/dont_save_file_item.h +++ b/engines/titanic/core/dont_save_file_item.h @@ -28,7 +28,7 @@ namespace Titanic { class CDontSaveFileItem : public CFileItem { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; diff --git a/engines/titanic/core/file_item.h b/engines/titanic/core/file_item.h index 4b7c341fdb..4cecee4882 100644 --- a/engines/titanic/core/file_item.h +++ b/engines/titanic/core/file_item.h @@ -30,7 +30,7 @@ namespace Titanic { class CFileItem: public CTreeItem { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; private: CString _filename; public: diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 746ef45db4..69036b1690 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -50,7 +50,7 @@ class OSMovie; class CGameObject : public CNamedItem { friend class OSMovie; - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; private: static CCreditText *_credits; private: diff --git a/engines/titanic/core/link_item.h b/engines/titanic/core/link_item.h index 4b316809fb..dd93e2a0bf 100644 --- a/engines/titanic/core/link_item.h +++ b/engines/titanic/core/link_item.h @@ -34,7 +34,7 @@ class CNodeItem; class CRoomItem; class CLinkItem : public CNamedItem { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; private: /** * Returns a new name for the link item, based on the diff --git a/engines/titanic/core/message_target.h b/engines/titanic/core/message_target.h index 0afd847c34..a52de591b3 100644 --- a/engines/titanic/core/message_target.h +++ b/engines/titanic/core/message_target.h @@ -45,7 +45,7 @@ struct MSGMAP { #define DECLARE_MESSAGE_MAP \ protected: \ static const MSGMAP *getThisMessageMap(); \ - virtual const MSGMAP *getMessageMap() const; + virtual const MSGMAP *getMessageMap() const #define BEGIN_MESSAGE_MAP(theClass, baseClass) \ const MSGMAP *theClass::getMessageMap() const \ @@ -84,7 +84,7 @@ protected: \ static const int DUMMY = 0 class CMessageTarget: public CSaveableObject { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; diff --git a/engines/titanic/core/named_item.h b/engines/titanic/core/named_item.h index 2ff34c7421..809cda1156 100644 --- a/engines/titanic/core/named_item.h +++ b/engines/titanic/core/named_item.h @@ -32,7 +32,7 @@ class CNodeItem; class CRoomItem; class CNamedItem: public CTreeItem { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CString _name; public: diff --git a/engines/titanic/core/node_item.h b/engines/titanic/core/node_item.h index f54e882085..8fda9464ec 100644 --- a/engines/titanic/core/node_item.h +++ b/engines/titanic/core/node_item.h @@ -28,7 +28,7 @@ namespace Titanic { class CNodeItem : public CNamedItem { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: int _nodeNumber; Point _nodePos; diff --git a/engines/titanic/core/project_item.h b/engines/titanic/core/project_item.h index 00c13e52a2..473ffd9556 100644 --- a/engines/titanic/core/project_item.h +++ b/engines/titanic/core/project_item.h @@ -76,7 +76,7 @@ class CFileList: public List { }; class CProjectItem : public CFileItem { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; private: CString _filename; CFileList _files; diff --git a/engines/titanic/core/room_item.h b/engines/titanic/core/room_item.h index 22d6e8b40a..cb343a15d2 100644 --- a/engines/titanic/core/room_item.h +++ b/engines/titanic/core/room_item.h @@ -32,7 +32,7 @@ namespace Titanic { class CRoomItem : public CNamedItem { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; private: /** * Handles post-load processing diff --git a/engines/titanic/core/static_image.h b/engines/titanic/core/static_image.h index 16cae82ff7..7a715a84fa 100644 --- a/engines/titanic/core/static_image.h +++ b/engines/titanic/core/static_image.h @@ -28,7 +28,7 @@ namespace Titanic { class CStaticImage : public CGameObject { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index 85d0215e9b..db4ba30a44 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -37,7 +37,7 @@ class CViewItem; class CTreeItem: public CMessageTarget { friend class CMessage; - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; private: CTreeItem *_parent; CTreeItem *_nextSibling; diff --git a/engines/titanic/core/turn_on_object.h b/engines/titanic/core/turn_on_object.h index 67cef9c1ab..0f7cd76382 100644 --- a/engines/titanic/core/turn_on_object.h +++ b/engines/titanic/core/turn_on_object.h @@ -28,7 +28,7 @@ namespace Titanic { class CTurnOnObject : public CBackground { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); protected: diff --git a/engines/titanic/core/view_item.h b/engines/titanic/core/view_item.h index 227319fac6..6e8003d6c6 100644 --- a/engines/titanic/core/view_item.h +++ b/engines/titanic/core/view_item.h @@ -31,7 +31,7 @@ namespace Titanic { class CViewItem : public CNamedItem { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); bool MouseMoveMsg(CMouseMoveMsg *msg); diff --git a/engines/titanic/game/arb_background.h b/engines/titanic/game/arb_background.h index b80c988d23..88d4d1bec6 100644 --- a/engines/titanic/game/arb_background.h +++ b/engines/titanic/game/arb_background.h @@ -28,7 +28,7 @@ namespace Titanic { class CArbBackground : public CBackground { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: int _fieldE0; int _fieldE4; diff --git a/engines/titanic/game/arboretum_gate.h b/engines/titanic/game/arboretum_gate.h index 7e07261fbd..927b2190c7 100644 --- a/engines/titanic/game/arboretum_gate.h +++ b/engines/titanic/game/arboretum_gate.h @@ -30,7 +30,7 @@ namespace Titanic { class CArboretumGate : public CBackground { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool ActMsg(CActMsg *msg); bool LeaveViewMsg(CLeaveViewMsg *msg); bool TurnOff(CTurnOff *msg); diff --git a/engines/titanic/game/broken_pell_base.h b/engines/titanic/game/broken_pell_base.h index f62f04d8f8..f63cd0112b 100644 --- a/engines/titanic/game/broken_pell_base.h +++ b/engines/titanic/game/broken_pell_base.h @@ -28,7 +28,7 @@ namespace Titanic { class CBrokenPellBase : public CBackground { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; private: static int _v1; static int _v2; diff --git a/engines/titanic/game/cdrom.h b/engines/titanic/game/cdrom.h index 9dcb270d74..017914830c 100644 --- a/engines/titanic/game/cdrom.h +++ b/engines/titanic/game/cdrom.h @@ -30,7 +30,7 @@ namespace Titanic { class CCDROM : public CGameObject { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool MouseDragStartMsg(CMouseDragStartMsg *msg); bool MouseDragEndMsg(CMouseDragEndMsg *msg); bool MouseDragMoveMsg(CMouseDragMoveMsg *msg); diff --git a/engines/titanic/game/cdrom_computer.h b/engines/titanic/game/cdrom_computer.h index 90b7b518d1..39fa9b9498 100644 --- a/engines/titanic/game/cdrom_computer.h +++ b/engines/titanic/game/cdrom_computer.h @@ -29,7 +29,7 @@ namespace Titanic { class CCDROMComputer : public CGameObject { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); private: Rect _clickRect; diff --git a/engines/titanic/game/cdrom_tray.h b/engines/titanic/game/cdrom_tray.h index 76c7a9a6ad..10fc1e145e 100644 --- a/engines/titanic/game/cdrom_tray.h +++ b/engines/titanic/game/cdrom_tray.h @@ -29,7 +29,7 @@ namespace Titanic { class CCDROMTray : public CGameObject { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool ActMsg(CActMsg *msg); bool MovieEndMsg(CMovieEndMsg *msg); bool StatusChangeMsg(CStatusChangeMsg *msg); diff --git a/engines/titanic/game/computer.h b/engines/titanic/game/computer.h index f64f723733..6acdba27ea 100644 --- a/engines/titanic/game/computer.h +++ b/engines/titanic/game/computer.h @@ -28,7 +28,7 @@ namespace Titanic { class CComputer : public CBackground { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool ActMsg(CActMsg *msg); bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); bool MovieEndMsg(CMovieEndMsg *msg); diff --git a/engines/titanic/game/computer_screen.h b/engines/titanic/game/computer_screen.h index 1aed01c723..8fb1dcd4dc 100644 --- a/engines/titanic/game/computer_screen.h +++ b/engines/titanic/game/computer_screen.h @@ -28,7 +28,7 @@ namespace Titanic { class CComputerScreen : public CGameObject { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool ActMsg(CActMsg *msg); bool MovieEndMsg(CMovieEndMsg *msg); bool EnterViewMsg(CEnterViewMsg *msg); diff --git a/engines/titanic/game/dead_area.h b/engines/titanic/game/dead_area.h index 05a3f4ed62..fdb44ef5df 100644 --- a/engines/titanic/game/dead_area.h +++ b/engines/titanic/game/dead_area.h @@ -32,7 +32,7 @@ namespace Titanic { * Implements a non-responsive screen area */ class CDeadArea : public CGameObject { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool MouseButtonDownMsg(CMouseButtonDownMsg *msg) { return true; } bool MouseButtonUpMsg(CMouseButtonUpMsg *msg) { return true; } public: diff --git a/engines/titanic/game/leave_sec_class_state.h b/engines/titanic/game/leave_sec_class_state.h index 67300b6b17..0b1e854f57 100644 --- a/engines/titanic/game/leave_sec_class_state.h +++ b/engines/titanic/game/leave_sec_class_state.h @@ -28,7 +28,7 @@ namespace Titanic { class CLeaveSecClassState : public CGameObject { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; diff --git a/engines/titanic/game/music_room_phonograph.h b/engines/titanic/game/music_room_phonograph.h index 58afe7f427..9286861785 100644 --- a/engines/titanic/game/music_room_phonograph.h +++ b/engines/titanic/game/music_room_phonograph.h @@ -28,7 +28,7 @@ namespace Titanic { class CMusicRoomPhonograph : public CRestaurantPhonograph { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; private: int _field118; public: diff --git a/engines/titanic/game/musical_instrument.h b/engines/titanic/game/musical_instrument.h index 8b534606e0..5d18ed91f0 100644 --- a/engines/titanic/game/musical_instrument.h +++ b/engines/titanic/game/musical_instrument.h @@ -28,7 +28,7 @@ namespace Titanic { class CMusicalInstrument : public CBackground { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; diff --git a/engines/titanic/game/navigation_computer.h b/engines/titanic/game/navigation_computer.h index 6de75437a5..27d06c1f27 100644 --- a/engines/titanic/game/navigation_computer.h +++ b/engines/titanic/game/navigation_computer.h @@ -28,7 +28,7 @@ namespace Titanic { class CNavigationComputer : public CGameObject { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; diff --git a/engines/titanic/game/null_port_hole.h b/engines/titanic/game/null_port_hole.h index 2924aff9f5..26564271b9 100644 --- a/engines/titanic/game/null_port_hole.h +++ b/engines/titanic/game/null_port_hole.h @@ -28,7 +28,7 @@ namespace Titanic { class CNullPortHole : public CClickResponder { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; CNullPortHole(); diff --git a/engines/titanic/game/parrot/parrot_lobby_object.h b/engines/titanic/game/parrot/parrot_lobby_object.h index dfb6592325..5272303888 100644 --- a/engines/titanic/game/parrot/parrot_lobby_object.h +++ b/engines/titanic/game/parrot/parrot_lobby_object.h @@ -28,7 +28,7 @@ namespace Titanic { class CParrotLobbyObject : public CGameObject { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: static int _v1; static int _v2; diff --git a/engines/titanic/game/pet/pet_class1.h b/engines/titanic/game/pet/pet_class1.h index ad97f45bb2..fb7a48b927 100644 --- a/engines/titanic/game/pet/pet_class1.h +++ b/engines/titanic/game/pet/pet_class1.h @@ -28,7 +28,7 @@ namespace Titanic { class CPETClass1 : public CGameObject { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; diff --git a/engines/titanic/game/pet/pet_class2.h b/engines/titanic/game/pet/pet_class2.h index 6ae78f4db8..c8855c82f3 100644 --- a/engines/titanic/game/pet/pet_class2.h +++ b/engines/titanic/game/pet/pet_class2.h @@ -28,7 +28,7 @@ namespace Titanic { class CPETClass2 : public CGameObject { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; diff --git a/engines/titanic/game/pet/pet_class3.h b/engines/titanic/game/pet/pet_class3.h index 780cad3b6c..59d8389665 100644 --- a/engines/titanic/game/pet/pet_class3.h +++ b/engines/titanic/game/pet/pet_class3.h @@ -28,7 +28,7 @@ namespace Titanic { class CPETClass3 : public CGameObject { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; diff --git a/engines/titanic/game/pet/pet_monitor.h b/engines/titanic/game/pet/pet_monitor.h index 3fc50bdf63..61d1ba8ab6 100644 --- a/engines/titanic/game/pet/pet_monitor.h +++ b/engines/titanic/game/pet/pet_monitor.h @@ -29,7 +29,7 @@ namespace Titanic { class CPETMonitor : public CGameObject { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool EnterRoomMsg(CEnterRoomMsg *msg); public: CLASSDEF; diff --git a/engines/titanic/game/pet/pet_position.h b/engines/titanic/game/pet/pet_position.h index 9419684823..d1ac0507f4 100644 --- a/engines/titanic/game/pet/pet_position.h +++ b/engines/titanic/game/pet/pet_position.h @@ -29,7 +29,7 @@ namespace Titanic { class CPETPosition : public CGameObject { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool EnterRoomMsg(CEnterRoomMsg *msg); public: CLASSDEF; diff --git a/engines/titanic/game/pet/pet_transport.h b/engines/titanic/game/pet/pet_transport.h index 44beafebc8..58aefe6743 100644 --- a/engines/titanic/game/pet/pet_transport.h +++ b/engines/titanic/game/pet/pet_transport.h @@ -29,7 +29,7 @@ namespace Titanic { class CPETTransport : public CGameObject { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; virtual bool EnterRoomMsg(CEnterRoomMsg *msg); public: CLASSDEF; diff --git a/engines/titanic/game/sgt/sgt_state_room.h b/engines/titanic/game/sgt/sgt_state_room.h index ee9079943b..375da71326 100644 --- a/engines/titanic/game/sgt/sgt_state_room.h +++ b/engines/titanic/game/sgt/sgt_state_room.h @@ -46,7 +46,7 @@ struct CSGTStateRoomStatics { }; class CSGTStateRoom : public CBackground { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool EnterRoomMsg(CEnterRoomMsg *msg); private: static CSGTStateRoomStatics *_statics; diff --git a/engines/titanic/game/splash_animation.h b/engines/titanic/game/splash_animation.h index b1de994f92..11715b4d73 100644 --- a/engines/titanic/game/splash_animation.h +++ b/engines/titanic/game/splash_animation.h @@ -28,7 +28,7 @@ namespace Titanic { class CSplashAnimation : public CGameObject { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; diff --git a/engines/titanic/game/start_action.h b/engines/titanic/game/start_action.h index 8be17f0a50..60381bad2f 100644 --- a/engines/titanic/game/start_action.h +++ b/engines/titanic/game/start_action.h @@ -29,7 +29,7 @@ namespace Titanic { class CStartAction : public CBackground { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); protected: diff --git a/engines/titanic/game/television.h b/engines/titanic/game/television.h index 3ce55053bf..6e6d9b23c2 100644 --- a/engines/titanic/game/television.h +++ b/engines/titanic/game/television.h @@ -30,7 +30,7 @@ namespace Titanic { class CTelevision : public CBackground { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool LeaveViewMsg(CLeaveViewMsg *msg); bool ChangeSeasonMsg(CChangeSeasonMsg *msg); bool EnterViewMsg(CEnterViewMsg *msg); diff --git a/engines/titanic/game/transport/lift.h b/engines/titanic/game/transport/lift.h index 9c90466af5..4595f0fec2 100644 --- a/engines/titanic/game/transport/lift.h +++ b/engines/titanic/game/transport/lift.h @@ -29,7 +29,7 @@ namespace Titanic { class CLift : public CTransport { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool EnterRoomMsg(CEnterRoomMsg *msg); private: static int _v1; diff --git a/engines/titanic/game/transport/lift_indicator.h b/engines/titanic/game/transport/lift_indicator.h index ff394d7230..945f627417 100644 --- a/engines/titanic/game/transport/lift_indicator.h +++ b/engines/titanic/game/transport/lift_indicator.h @@ -29,7 +29,7 @@ namespace Titanic { class CLiftindicator : public CLift { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool EnterRoomMsg(CEnterRoomMsg *msg) { return true; } private: int _fieldFC; diff --git a/engines/titanic/game/transport/pellerator.h b/engines/titanic/game/transport/pellerator.h index 9d223ec770..fa400a49cd 100644 --- a/engines/titanic/game/transport/pellerator.h +++ b/engines/titanic/game/transport/pellerator.h @@ -29,7 +29,7 @@ namespace Titanic { class CPellerator : public CTransport { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool EnterRoomMsg(CEnterRoomMsg *msg); private: static int _v1; diff --git a/engines/titanic/game/transport/transport.h b/engines/titanic/game/transport/transport.h index b2c9aee20d..d87251212a 100644 --- a/engines/titanic/game/transport/transport.h +++ b/engines/titanic/game/transport/transport.h @@ -28,7 +28,7 @@ namespace Titanic { class CTransport : public CMobile { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CString _string1; CString _string2; diff --git a/engines/titanic/gfx/chev_left_off.h b/engines/titanic/gfx/chev_left_off.h index 1e356d3bf9..5034c1a71a 100644 --- a/engines/titanic/gfx/chev_left_off.h +++ b/engines/titanic/gfx/chev_left_off.h @@ -28,7 +28,7 @@ namespace Titanic { class CChevLeftOff : public CToggleSwitch { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; CChevLeftOff(); diff --git a/engines/titanic/gfx/chev_left_on.h b/engines/titanic/gfx/chev_left_on.h index 2014002fca..df430f6700 100644 --- a/engines/titanic/gfx/chev_left_on.h +++ b/engines/titanic/gfx/chev_left_on.h @@ -28,7 +28,7 @@ namespace Titanic { class CChevLeftOn : public CToggleSwitch { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; CChevLeftOn(); diff --git a/engines/titanic/gfx/chev_right_off.h b/engines/titanic/gfx/chev_right_off.h index 2bd3e24f9f..8f6c3fc254 100644 --- a/engines/titanic/gfx/chev_right_off.h +++ b/engines/titanic/gfx/chev_right_off.h @@ -28,7 +28,7 @@ namespace Titanic { class CChevRightOff : public CToggleSwitch { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; CChevRightOff(); diff --git a/engines/titanic/gfx/chev_right_on.h b/engines/titanic/gfx/chev_right_on.h index bc3e0ff7be..accd42cff8 100644 --- a/engines/titanic/gfx/chev_right_on.h +++ b/engines/titanic/gfx/chev_right_on.h @@ -28,7 +28,7 @@ namespace Titanic { class CChevRightOn : public CToggleSwitch { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; CChevRightOn(); diff --git a/engines/titanic/gfx/chev_send_rec_switch.h b/engines/titanic/gfx/chev_send_rec_switch.h index 041492893c..b3ccab2f09 100644 --- a/engines/titanic/gfx/chev_send_rec_switch.h +++ b/engines/titanic/gfx/chev_send_rec_switch.h @@ -28,7 +28,7 @@ namespace Titanic { class CChevSendRecSwitch : public CToggleSwitch { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; CChevSendRecSwitch(); diff --git a/engines/titanic/gfx/elevator_button.h b/engines/titanic/gfx/elevator_button.h index dec4775f3f..28110d8102 100644 --- a/engines/titanic/gfx/elevator_button.h +++ b/engines/titanic/gfx/elevator_button.h @@ -28,7 +28,7 @@ namespace Titanic { class CElevatorButton : public CSTButton { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; CElevatorButton(); diff --git a/engines/titanic/gfx/get_from_succ.h b/engines/titanic/gfx/get_from_succ.h index d93341e913..f85f1b4cf2 100644 --- a/engines/titanic/gfx/get_from_succ.h +++ b/engines/titanic/gfx/get_from_succ.h @@ -28,7 +28,7 @@ namespace Titanic { class CGetFromSucc : public CToggleSwitch { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; CGetFromSucc(); diff --git a/engines/titanic/gfx/helmet_on_off.h b/engines/titanic/gfx/helmet_on_off.h index 881757a2ef..c2910eb59d 100644 --- a/engines/titanic/gfx/helmet_on_off.h +++ b/engines/titanic/gfx/helmet_on_off.h @@ -28,7 +28,7 @@ namespace Titanic { class CHelmetOnOff : public CToggleSwitch { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; CHelmetOnOff(); diff --git a/engines/titanic/gfx/home_photo.h b/engines/titanic/gfx/home_photo.h index 9181bfd820..09b18b7c0f 100644 --- a/engines/titanic/gfx/home_photo.h +++ b/engines/titanic/gfx/home_photo.h @@ -28,7 +28,7 @@ namespace Titanic { class CHomePhoto : public CToggleSwitch { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; CHomePhoto(); diff --git a/engines/titanic/gfx/icon_nav_action.h b/engines/titanic/gfx/icon_nav_action.h index 9a63a47196..841334dd41 100644 --- a/engines/titanic/gfx/icon_nav_action.h +++ b/engines/titanic/gfx/icon_nav_action.h @@ -28,7 +28,7 @@ namespace Titanic { class CIconNavAction : public CToggleSwitch { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; CIconNavAction(); diff --git a/engines/titanic/gfx/icon_nav_butt.h b/engines/titanic/gfx/icon_nav_butt.h index a27fc8b0fa..c60877e2c0 100644 --- a/engines/titanic/gfx/icon_nav_butt.h +++ b/engines/titanic/gfx/icon_nav_butt.h @@ -28,7 +28,7 @@ namespace Titanic { class CIconNavButt : public CPetGraphic { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; diff --git a/engines/titanic/gfx/icon_nav_down.h b/engines/titanic/gfx/icon_nav_down.h index 759d887913..6c0c2870e4 100644 --- a/engines/titanic/gfx/icon_nav_down.h +++ b/engines/titanic/gfx/icon_nav_down.h @@ -28,7 +28,7 @@ namespace Titanic { class CIconNavDown : public CToggleSwitch { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; CIconNavDown(); diff --git a/engines/titanic/gfx/icon_nav_image.h b/engines/titanic/gfx/icon_nav_image.h index ab0e955bfa..580762c32d 100644 --- a/engines/titanic/gfx/icon_nav_image.h +++ b/engines/titanic/gfx/icon_nav_image.h @@ -28,7 +28,7 @@ namespace Titanic { class CIconNavImage : public CPetGraphic { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; diff --git a/engines/titanic/gfx/icon_nav_left.h b/engines/titanic/gfx/icon_nav_left.h index d58a426ae9..bb61c26362 100644 --- a/engines/titanic/gfx/icon_nav_left.h +++ b/engines/titanic/gfx/icon_nav_left.h @@ -28,7 +28,7 @@ namespace Titanic { class CIconNavLeft : public CToggleSwitch { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; CIconNavLeft(); diff --git a/engines/titanic/gfx/icon_nav_receive.h b/engines/titanic/gfx/icon_nav_receive.h index 5d055dd156..0744105835 100644 --- a/engines/titanic/gfx/icon_nav_receive.h +++ b/engines/titanic/gfx/icon_nav_receive.h @@ -28,7 +28,7 @@ namespace Titanic { class CIconNavReceive : public CPetGraphic { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; diff --git a/engines/titanic/gfx/icon_nav_right.h b/engines/titanic/gfx/icon_nav_right.h index c12ff7cf8b..a1bed9ca8f 100644 --- a/engines/titanic/gfx/icon_nav_right.h +++ b/engines/titanic/gfx/icon_nav_right.h @@ -28,7 +28,7 @@ namespace Titanic { class CIconNavRight : public CToggleSwitch { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; CIconNavRight(); diff --git a/engines/titanic/gfx/icon_nav_send.h b/engines/titanic/gfx/icon_nav_send.h index f2b220f0d9..f3af8d9c65 100644 --- a/engines/titanic/gfx/icon_nav_send.h +++ b/engines/titanic/gfx/icon_nav_send.h @@ -28,7 +28,7 @@ namespace Titanic { class CIconNavSend : public CPetGraphic { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; diff --git a/engines/titanic/gfx/icon_nav_up.h b/engines/titanic/gfx/icon_nav_up.h index a9702c763f..4b7320d610 100644 --- a/engines/titanic/gfx/icon_nav_up.h +++ b/engines/titanic/gfx/icon_nav_up.h @@ -28,7 +28,7 @@ namespace Titanic { class CIconNavUp : public CToggleSwitch { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; CIconNavUp(); diff --git a/engines/titanic/gfx/keybrd_butt.h b/engines/titanic/gfx/keybrd_butt.h index 5514f115c7..822be41ed2 100644 --- a/engines/titanic/gfx/keybrd_butt.h +++ b/engines/titanic/gfx/keybrd_butt.h @@ -28,7 +28,7 @@ namespace Titanic { class CKeybrdButt : public CToggleSwitch { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; CKeybrdButt(); diff --git a/engines/titanic/gfx/music_slider.h b/engines/titanic/gfx/music_slider.h index 1636afeb89..be2c5631b6 100644 --- a/engines/titanic/gfx/music_slider.h +++ b/engines/titanic/gfx/music_slider.h @@ -28,7 +28,7 @@ namespace Titanic { class CMusicSlider : public CMusicControl { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; diff --git a/engines/titanic/gfx/music_switch.h b/engines/titanic/gfx/music_switch.h index 6ee615d594..35af84bdbf 100644 --- a/engines/titanic/gfx/music_switch.h +++ b/engines/titanic/gfx/music_switch.h @@ -28,7 +28,7 @@ namespace Titanic { class CMusicSwitch : public CMusicControl { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; diff --git a/engines/titanic/gfx/send_to_succ.h b/engines/titanic/gfx/send_to_succ.h index dfcb345f4c..734c4a7db3 100644 --- a/engines/titanic/gfx/send_to_succ.h +++ b/engines/titanic/gfx/send_to_succ.h @@ -28,7 +28,7 @@ namespace Titanic { class CSendToSucc : public CToggleSwitch { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; CSendToSucc(); diff --git a/engines/titanic/gfx/sgt_selector.h b/engines/titanic/gfx/sgt_selector.h index 2afd40209b..be35635c2b 100644 --- a/engines/titanic/gfx/sgt_selector.h +++ b/engines/titanic/gfx/sgt_selector.h @@ -28,7 +28,7 @@ namespace Titanic { class CSGTSelector : public CPetGraphic { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; diff --git a/engines/titanic/gfx/small_chev_left_off.h b/engines/titanic/gfx/small_chev_left_off.h index c3af9bb837..bed64befdb 100644 --- a/engines/titanic/gfx/small_chev_left_off.h +++ b/engines/titanic/gfx/small_chev_left_off.h @@ -28,7 +28,7 @@ namespace Titanic { class CSmallChevLeftOff : public CToggleSwitch { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; CSmallChevLeftOff(); diff --git a/engines/titanic/gfx/small_chev_left_on.h b/engines/titanic/gfx/small_chev_left_on.h index 4fcba625fa..9d1771311c 100644 --- a/engines/titanic/gfx/small_chev_left_on.h +++ b/engines/titanic/gfx/small_chev_left_on.h @@ -28,7 +28,7 @@ namespace Titanic { class CSmallChevLeftOn : public CToggleSwitch { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; CSmallChevLeftOn(); diff --git a/engines/titanic/gfx/small_chev_right_off.h b/engines/titanic/gfx/small_chev_right_off.h index f56cc83981..eb6ca455d2 100644 --- a/engines/titanic/gfx/small_chev_right_off.h +++ b/engines/titanic/gfx/small_chev_right_off.h @@ -28,7 +28,7 @@ namespace Titanic { class CSmallChevRightOff : public CToggleSwitch { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; CSmallChevRightOff(); diff --git a/engines/titanic/gfx/small_chev_right_on.h b/engines/titanic/gfx/small_chev_right_on.h index aeb9ce33e7..1dfb2d6fb2 100644 --- a/engines/titanic/gfx/small_chev_right_on.h +++ b/engines/titanic/gfx/small_chev_right_on.h @@ -28,7 +28,7 @@ namespace Titanic { class CSmallChevRightOn : public CToggleSwitch { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; CSmallChevRightOn(); diff --git a/engines/titanic/gfx/st_button.h b/engines/titanic/gfx/st_button.h index 6a8af1b9fa..789437691b 100644 --- a/engines/titanic/gfx/st_button.h +++ b/engines/titanic/gfx/st_button.h @@ -30,7 +30,7 @@ namespace Titanic { class CSTButton : public CBackground { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); bool MouseButtonUpMsg(CMouseButtonUpMsg *msg); bool EnterViewMsg(CEnterViewMsg *msg); diff --git a/engines/titanic/gfx/text_down.h b/engines/titanic/gfx/text_down.h index 5c924b8129..97660605d5 100644 --- a/engines/titanic/gfx/text_down.h +++ b/engines/titanic/gfx/text_down.h @@ -28,7 +28,7 @@ namespace Titanic { class CTextDown : public CPetGraphic { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; diff --git a/engines/titanic/gfx/text_skrew.h b/engines/titanic/gfx/text_skrew.h index df90d95ba6..d0d9b82afd 100644 --- a/engines/titanic/gfx/text_skrew.h +++ b/engines/titanic/gfx/text_skrew.h @@ -28,7 +28,7 @@ namespace Titanic { class CTextSkrew : public CPetGraphic { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; diff --git a/engines/titanic/gfx/text_up.h b/engines/titanic/gfx/text_up.h index 0e839e0345..dda8d8461b 100644 --- a/engines/titanic/gfx/text_up.h +++ b/engines/titanic/gfx/text_up.h @@ -28,7 +28,7 @@ namespace Titanic { class CTextUp : public CPetGraphic { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; diff --git a/engines/titanic/gfx/toggle_button.h b/engines/titanic/gfx/toggle_button.h index 9eb6fdb8c8..5328072982 100644 --- a/engines/titanic/gfx/toggle_button.h +++ b/engines/titanic/gfx/toggle_button.h @@ -28,7 +28,7 @@ namespace Titanic { class CToggleButton : public CBackground { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; private: int _fieldE0; public: diff --git a/engines/titanic/npcs/character.h b/engines/titanic/npcs/character.h index 6f3de9a06a..4912740189 100644 --- a/engines/titanic/npcs/character.h +++ b/engines/titanic/npcs/character.h @@ -28,7 +28,7 @@ namespace Titanic { class CCharacter : public CGameObject { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool LeaveViewMsg(CLeaveViewMsg *msg); bool TurnOn(CTurnOn *msg); bool TurnOff(CTurnOff *msg); diff --git a/engines/titanic/npcs/deskbot.h b/engines/titanic/npcs/deskbot.h index e900781ea6..ab48d63546 100644 --- a/engines/titanic/npcs/deskbot.h +++ b/engines/titanic/npcs/deskbot.h @@ -28,7 +28,7 @@ namespace Titanic { class CDeskbot : public CTrueTalkNPC { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool TurnOn(CTurnOn *msg); bool EnterViewMsg(CEnterViewMsg *msg); bool ActMsg(CActMsg *msg); diff --git a/engines/titanic/npcs/mobile.h b/engines/titanic/npcs/mobile.h index f9b3955d71..68e74a5afe 100644 --- a/engines/titanic/npcs/mobile.h +++ b/engines/titanic/npcs/mobile.h @@ -28,7 +28,7 @@ namespace Titanic { class CMobile : public CCharacter { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; private: Point _pos1; int _fieldDC; diff --git a/engines/titanic/npcs/true_talk_npc.h b/engines/titanic/npcs/true_talk_npc.h index cece8ed055..0deb832c82 100644 --- a/engines/titanic/npcs/true_talk_npc.h +++ b/engines/titanic/npcs/true_talk_npc.h @@ -38,7 +38,7 @@ enum NpcFlag { class CViewItem; class CTrueTalkNPC : public CCharacter { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool TextInputMsg(CTextInputMsg *msg); bool TrueTalkGetAssetDetailsMsg(CTrueTalkGetAssetDetailsMsg *msg); bool DismissBotMsg(CDismissBotMsg *msg); diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 468c4f3b14..5e77b15230 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -43,7 +43,7 @@ namespace Titanic { enum SummonResult { SUMMON_CANT = 0, SUMMON_PRESENT = 1, SUMMON_CAN = 2 }; class CPetControl : public CGameObject { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; struct PetEventInfo { int _id; CPetSection *_target; diff --git a/engines/titanic/pet_control/pet_drag_chev.h b/engines/titanic/pet_control/pet_drag_chev.h index 153b954c40..9f4a6f0dc9 100644 --- a/engines/titanic/pet_control/pet_drag_chev.h +++ b/engines/titanic/pet_control/pet_drag_chev.h @@ -28,7 +28,7 @@ namespace Titanic { class CPetDragChev : public CPetGraphic2 { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; protected: bool MouseDragStartMsg(CMouseDragStartMsg *msg); bool MouseDragMoveMsg(CMouseDragMoveMsg *msg); diff --git a/engines/titanic/pet_control/pet_graphic.h b/engines/titanic/pet_control/pet_graphic.h index 082a27fe0d..630c8446eb 100644 --- a/engines/titanic/pet_control/pet_graphic.h +++ b/engines/titanic/pet_control/pet_graphic.h @@ -28,7 +28,7 @@ namespace Titanic { class CPetGraphic : public CGameObject { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; diff --git a/engines/titanic/pet_control/pet_graphic2.h b/engines/titanic/pet_control/pet_graphic2.h index 6b832fef7d..58852fc65e 100644 --- a/engines/titanic/pet_control/pet_graphic2.h +++ b/engines/titanic/pet_control/pet_graphic2.h @@ -28,7 +28,7 @@ namespace Titanic { class CPetGraphic2 : public CGameObject { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; diff --git a/engines/titanic/pet_control/pet_leaf.h b/engines/titanic/pet_control/pet_leaf.h index 8428647eab..0c21352e39 100644 --- a/engines/titanic/pet_control/pet_leaf.h +++ b/engines/titanic/pet_control/pet_leaf.h @@ -28,7 +28,7 @@ namespace Titanic { class PETLeaf : public CGameObject { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; diff --git a/engines/titanic/pet_control/pet_mode_off.h b/engines/titanic/pet_control/pet_mode_off.h index a906bc6174..9162270953 100644 --- a/engines/titanic/pet_control/pet_mode_off.h +++ b/engines/titanic/pet_control/pet_mode_off.h @@ -28,7 +28,7 @@ namespace Titanic { class CPetModeOff : public CToggleSwitch { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; CPetModeOff(); diff --git a/engines/titanic/pet_control/pet_mode_on.h b/engines/titanic/pet_control/pet_mode_on.h index 074e33ea8c..f77fd1f447 100644 --- a/engines/titanic/pet_control/pet_mode_on.h +++ b/engines/titanic/pet_control/pet_mode_on.h @@ -28,7 +28,7 @@ namespace Titanic { class CPetModeOn : public CToggleSwitch { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; CPetModeOn(); diff --git a/engines/titanic/pet_control/pet_mode_panel.h b/engines/titanic/pet_control/pet_mode_panel.h index 0812c11942..f37c543b98 100644 --- a/engines/titanic/pet_control/pet_mode_panel.h +++ b/engines/titanic/pet_control/pet_mode_panel.h @@ -28,7 +28,7 @@ namespace Titanic { class CPetModePanel : public CToggleSwitch { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; CPetModePanel(); diff --git a/engines/titanic/pet_control/pet_pannel1.h b/engines/titanic/pet_control/pet_pannel1.h index 7ca7378a09..f39314fed9 100644 --- a/engines/titanic/pet_control/pet_pannel1.h +++ b/engines/titanic/pet_control/pet_pannel1.h @@ -28,7 +28,7 @@ namespace Titanic { class CPetPannel1 : public CPetGraphic { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; diff --git a/engines/titanic/pet_control/pet_pannel2.h b/engines/titanic/pet_control/pet_pannel2.h index 62dd2aae2b..f820847035 100644 --- a/engines/titanic/pet_control/pet_pannel2.h +++ b/engines/titanic/pet_control/pet_pannel2.h @@ -28,7 +28,7 @@ namespace Titanic { class CPetPannel2 : public CPetGraphic { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; diff --git a/engines/titanic/pet_control/pet_pannel3.h b/engines/titanic/pet_control/pet_pannel3.h index 2acf269873..dd0d2f9fa2 100644 --- a/engines/titanic/pet_control/pet_pannel3.h +++ b/engines/titanic/pet_control/pet_pannel3.h @@ -28,7 +28,7 @@ namespace Titanic { class CPetPannel3 : public CPetGraphic { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; diff --git a/engines/titanic/sound/dome_from_top_of_well.h b/engines/titanic/sound/dome_from_top_of_well.h index fba71685f1..e3d2877379 100644 --- a/engines/titanic/sound/dome_from_top_of_well.h +++ b/engines/titanic/sound/dome_from_top_of_well.h @@ -28,7 +28,7 @@ namespace Titanic { class CDomeFromTopOfWell : public CViewAutoSoundPlayer { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: CLASSDEF; diff --git a/engines/titanic/sound/water_lapping_sounds.h b/engines/titanic/sound/water_lapping_sounds.h index d7017d29c1..5db41a312e 100644 --- a/engines/titanic/sound/water_lapping_sounds.h +++ b/engines/titanic/sound/water_lapping_sounds.h @@ -28,7 +28,7 @@ namespace Titanic { class CWaterLappingSounds : public CRoomAutoSoundPlayer { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; public: int _value; public: diff --git a/engines/titanic/star_control/star_control.h b/engines/titanic/star_control/star_control.h index f5f0af2653..c0561ce908 100644 --- a/engines/titanic/star_control/star_control.h +++ b/engines/titanic/star_control/star_control.h @@ -30,7 +30,7 @@ namespace Titanic { class CStarControl : public CGameObject { - DECLARE_MESSAGE_MAP + DECLARE_MESSAGE_MAP; bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); bool MouseMoveMsg(CMouseMoveMsg *msg); bool KeyCharMsg(CKeyCharMsg *msg); -- cgit v1.2.3 From 13ce0156ff16cddbdfe108b92fbcf83a28c090e7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 Jul 2016 20:56:58 -0400 Subject: TITANIC: Fix crash loading Sentences/Default NPC data --- engines/titanic/titanic.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index 66d4e46546..6b23a2595d 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -82,6 +82,9 @@ void TitanicEngine::initialize() { DebugMan.addDebugChannel(kDebugGraphics, "graphics", "Graphics handling"); DebugMan.addDebugChannel(kDebugSound, "sound", "Sound and Music handling"); + _debugger = new Debugger(this); + _filesManager = new CFilesManager(); + CSaveableObject::initClassList(); CEnterExitFirstClassState::init(); CGameObject::init(); @@ -97,9 +100,7 @@ void TitanicEngine::initialize() { TTnpcScript::init(); OSVideoSurface::setup(); - _debugger = new Debugger(this); _events = new Events(this); - _filesManager = new CFilesManager(); _screen = new Graphics::Screen(0, 0); _screenManager = new OSScreenManager(this); _window = new CMainGameWindow(this); -- cgit v1.2.3 From cf805b07d33adb7809f88e8e5d297831d75df166 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 Jul 2016 22:13:55 -0400 Subject: TITANIC: Adding NPC Script support methods --- engines/titanic/true_talk/barbot_script.cpp | 83 +++++++++++++++++++++++++++- engines/titanic/true_talk/script_handler.cpp | 22 ++++++++ engines/titanic/true_talk/script_handler.h | 5 ++ engines/titanic/true_talk/tt_npc_script.cpp | 43 ++++++++++++++ engines/titanic/true_talk/tt_npc_script.h | 3 + 5 files changed, 154 insertions(+), 2 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index 03aa1cdaae..cd44d631b4 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -756,8 +756,87 @@ done: } ScriptChangedResult BarbotScript::scriptChanged(TTscriptBase *roomScript, uint id) { - warning("TODO"); - return SCR_1; + switch (id) { + case 1: + case 100: + if (!isState9()) { + selectResponse(250210); + applyResponse(); + } + + adjustDial(0, getRandomBit() ? getRandomNumber(5) * 4 : + -getRandomNumber(5) * 4); + break; + + case 3: + if (isState9()) { + selectResponse(250244); + applyResponse(); + resetFlags(); + } else { + if (!getValue(28) || !fn10(true)) { + addResponse(getDialogueId(251627 + getValue(28) ? -1034 : 0)); + applyResponse(); + } + + CTrueTalkManager::setFlags(28, 1); + resetFlags(); + } + break; + + case 4: + selectResponse(isState9() ? 250141 : 250140); + applyResponse(); + adjustDial(2, getDialLevel(2, false) < 50 ? -15 - getRandomNumber(30) : + 15 + getRandomNumber(30)); + + if (getDialRegion(1) != 0 && getRandomNumber(100) > 75) + adjustDial(1, -35); + break; + + case 143: + addResponse(getDialogueId(isState9() ? 250577 : 250576)); + break; + + case 144: + addResponse(getDialogueId(isState9() ? 250577 : 250584)); + break; + + case 145: + if (isState9()) { + addResponse(getDialogueId(250577)); + applyResponse(); + } else { + set34(57); + } + break; + + case 146: + addResponse(getDialogueId(isState9() ? 250577 : 250574)); + break; + + case 147: + addResponse(getDialogueId(250579)); + break; + + } + + if (id >= 250000 && id <= 251900) { + if (id > 250571) { + if (id != 250575 && (id == 250586 || id == 251858 || !isState9())) { + addResponse(getDialogueId(id)); + applyResponse(); + } + } else if (id == 250571 || (id != 250244 && !isState9()) || isState9()) { + addResponse(getDialogueId(id)); + applyResponse(); + } else { + addResponse(getDialogueId(251018)); + applyResponse(); + } + } + + return SCR_2; } int BarbotScript::proc15() const { diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index cd06d71796..c4665465da 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -24,6 +24,7 @@ #include "titanic/true_talk/tt_concept.h" #include "titanic/true_talk/tt_sentence.h" #include "titanic/true_talk/tt_parser.h" +#include "titanic/true_talk/tt_word.h" #include "titanic/titanic.h" namespace Titanic { @@ -117,4 +118,25 @@ int CScriptHandler::setResponse(TTscriptBase *script, TTresponse *response) { return _owner->setResponse(script, response); } +void CScriptHandler::handleWord(TTstring &str) { + handleWord1(str); + handleWord2(str); +} + +void CScriptHandler::handleWord1(TTstring &str) { + if (_concept2P) + delete _concept2P; + + TTword word(str, WC_UNKNOWN, 0); + _concept2P = new TTconcept(&word); +} + +void CScriptHandler::handleWord2(TTstring &str) { + if (_concept1P) + delete _concept1P; + + TTword word(str, WC_UNKNOWN, 0); + _concept1P = new TTconcept(&word); +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index 93abbc3d3a..11976d902d 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -42,6 +42,9 @@ private: int _field10; int _inputCtr; int _field30; +private: + void handleWord1(TTstring &str); + void handleWord2(TTstring &str); public: TTparser _parser; TTvocab *_vocab; @@ -77,6 +80,8 @@ public: * Sets a conversation reponse */ int setResponse(TTscriptBase *script, TTresponse *response); + + void handleWord(TTstring &str); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index f673cc0313..70be472d79 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -929,4 +929,47 @@ void TTnpcScript::updateCurrentDial(bool changeDial) { } } +bool TTnpcScript::fn10(bool flag) { + if (_itemStringP) { + for (const ItemRec *ir = ARRAY1; ir->_id; ++ir) { + if (!strcmp(ir->_name, _itemStringP)) { + _itemStringP = nullptr; + uint id = getDialogueId(ir->_id); + if (id == 4) { + return true; + } else if (id != 0) { + addResponse(id); + applyResponse(); + return true; + } + break; + } + } + + _itemStringP = nullptr; + } + + if (flag && getRandomNumber(100) > 60) { + int val = getRandomNumber(18) - 1; + + if (val == 0 && !getRoom54(101) && !getRoom54(132)) + val = -1; + else if ((val == 1 && !_field7C) || val == 2) + val = -1; + + if (val >= 0) { + val = getDialogueId(ARRAY2[val]); + if (val == 4) { + return true; + } else { + addResponse(val); + applyResponse(); + return true; + } + } + } + + return false; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 8a17064034..2bd4e6dae3 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -263,6 +263,9 @@ protected: * Updates the current dial with the given delta */ void updateCurrentDial(bool changeDial); + + bool fn10(bool flag); + public: static void init(); static void deinit(); -- cgit v1.2.3 From 6558eb78c351aa852c02071ef1c73b5b9ff7259f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 Jul 2016 22:30:30 -0400 Subject: TITANIC: More NPC Script support methods --- engines/titanic/true_talk/tt_npc_script.cpp | 20 ++++++++++++++++++++ engines/titanic/true_talk/tt_npc_script.h | 6 ++++++ 2 files changed, 26 insertions(+) diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 70be472d79..d7e3bc167e 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -22,6 +22,7 @@ #include "common/algorithm.h" #include "common/textconsole.h" +#include "titanic/messages/messages.h" #include "titanic/pet_control/pet_control.h" #include "titanic/true_talk/tt_npc_script.h" #include "titanic/true_talk/tt_sentence.h" @@ -972,4 +973,23 @@ bool TTnpcScript::fn10(bool flag) { return false; } +bool TTnpcScript::getStateValue() const { + if (!CTrueTalkManager::_currentNPC) + return false; + + CGameObject *bomb; + if (CTrueTalkManager::_currentNPC->find("Bomb", &bomb, FIND_GLOBAL) && bomb) { + CTrueTalkGetStateValueMsg stateMsg(10, -1000); + stateMsg.execute(bomb); + if (stateMsg._stateVal) + return true; + } + + return false; +} + +bool TTnpcScript::sentence2C(TTsentence *sentence) { + return sentence->_field2C >= 2 && sentence->_field2C <= 7; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 2bd4e6dae3..ab4379bf60 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -266,6 +266,12 @@ protected: bool fn10(bool flag); + static bool sentence2C(TTsentence *sentence); + + /** + * Gets the True Talk state value + */ + bool getStateValue() const; public: static void init(); static void deinit(); -- cgit v1.2.3 From d59b012442289e81f021957306bee36de294aac5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 Jul 2016 23:08:19 -0400 Subject: DEVTOOLS: Add NPC Script word lists to create_titanic --- devtools/create_titanic/create_titanic_dat.cpp | 30 +++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index 199a8d1fec..1ddfd46fd3 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -52,7 +52,7 @@ */ #define VERSION_NUMBER 1 -#define HEADER_SIZE 0x700 +#define HEADER_SIZE 0x740 Common::File inputFile, outputFile; Common::PEResources res; @@ -441,6 +441,29 @@ void writeSentenceEntries(const char *name, uint tableOffset) { dataOffset += size; } +void writeWords(const char *name, uint tableOffset, int recordCount = 2) { + outputFile.seek(dataOffset); + int recordSize = recordCount * 4; + + uint val, strOffset; + for (uint idx = 0; ; ++idx) { + inputFile.seek(tableOffset - FILE_DIFF + idx * recordSize); + val = inputFile.readLong(); + strOffset = inputFile.readLong(); + + if (!val) + // Reached end of list + break; + + outputFile.writeLong(val); + writeString(strOffset); + } + + uint size = outputFile.size() - dataOffset; + writeEntryHeader(name, dataOffset, size); + dataOffset += size; +} + void writeSentenceMappings(const char *name, uint offset, int numValues) { inputFile.seek(offset - FILE_DIFF); outputFile.seek(dataOffset); @@ -553,6 +576,11 @@ void writeData() { writeSentenceMappings("Mappings/MaitreD", 0x6125C8, 1); writeSentenceMappings("Mappings/Parrot", 0x615B68, 1); writeSentenceMappings("Mappings/SuccUBus", 0x6189F0, 1); + writeWords("Words/Barbot", 0x5BE2E0); + writeWords("Words/Bellbot", 0x5D8230); + writeWords("Words/Deskbot", 0x5EAAA8); + writeWords("Words/Doorbot", 0x601098, 3); + writeWords("Words/Liftbot", 0x60C788); writeResponseTree(); writeNumbers(); -- cgit v1.2.3 From 3c547b6b354fc54a19dc88cc2470fb51093eb5bb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 Jul 2016 23:08:46 -0400 Subject: TITANIC: Load word lists for each NPC Script class --- engines/titanic/true_talk/barbot_script.cpp | 1 + engines/titanic/true_talk/bellbot_script.cpp | 1 + engines/titanic/true_talk/deskbot_script.cpp | 1 + engines/titanic/true_talk/doorbot_script.cpp | 1 + engines/titanic/true_talk/liftbot_script.cpp | 1 + engines/titanic/true_talk/script_handler.cpp | 20 ++++++++++------ engines/titanic/true_talk/script_handler.h | 6 ++--- engines/titanic/true_talk/tt_npc_script.cpp | 35 +++++++++++++++++++++++++--- engines/titanic/true_talk/tt_npc_script.h | 19 ++++++++++++++- 9 files changed, 71 insertions(+), 14 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index cd44d631b4..6317f16e7c 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -63,6 +63,7 @@ void BarbotScript::setupSentences() { _mappings.load("Mappings/Barbot", 8); _entries.load("Sentences/Barbot"); _entries2.load("Sentences/Barbot2"); + _words.load("Words/Barbot"); } int BarbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index a13f9d6106..baf75cd405 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -43,6 +43,7 @@ BellbotScript::BellbotScript(int val1, const char *charClass, int v2, loadResponses("Responses/Bellbot", 4); setupSentences(); _tagMappings.load("TagMap/Bellbot"); + _words.load("Words/Bellbot"); } void BellbotScript::setupSentences() { diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 61e1f717c9..1349a78755 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -44,6 +44,7 @@ DeskbotScript::DeskbotScript(int val1, const char *charClass, int v2, loadResponses("Responses/Deskbot", 4); setupSentences(); _tagMappings.load("TagMap/Deskbot"); + _words.load("Words/Deskbot"); } void DeskbotScript::setupSentences() { diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 0db75474eb..4be25118ef 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -38,6 +38,7 @@ DoorbotScript::DoorbotScript(int val1, const char *charClass, int v2, loadResponses("Responses/Doorbot"); setupSentences(); _tagMappings.load("TagMap/Doorbot"); + _words.load("Words/Doorbot"); } void DoorbotScript::setupSentences() { diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index e911fe181e..dae80c2e69 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -39,6 +39,7 @@ LiftbotScript::LiftbotScript(int val1, const char *charClass, int v2, loadResponses("Responses/Liftbot"); setupSentences(); _tagMappings.load("TagMap/Liftbot"); + _words.load("Words/Liftbot"); } void LiftbotScript::setupSentences() { diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index c4665465da..23ecf35290 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -118,25 +118,31 @@ int CScriptHandler::setResponse(TTscriptBase *script, TTresponse *response) { return _owner->setResponse(script, response); } -void CScriptHandler::handleWord(TTstring &str) { +void CScriptHandler::handleWord(const TTstring *str) { handleWord1(str); handleWord2(str); } -void CScriptHandler::handleWord1(TTstring &str) { +void CScriptHandler::handleWord1(const TTstring *str) { if (_concept2P) delete _concept2P; + _concept2P = nullptr; - TTword word(str, WC_UNKNOWN, 0); - _concept2P = new TTconcept(&word); + if (str) { + TTword word(*str, WC_UNKNOWN, 0); + _concept2P = new TTconcept(&word); + } } -void CScriptHandler::handleWord2(TTstring &str) { +void CScriptHandler::handleWord2(const TTstring *str) { if (_concept1P) delete _concept1P; + _concept1P = nullptr; - TTword word(str, WC_UNKNOWN, 0); - _concept1P = new TTconcept(&word); + if (str) { + TTword word(*str, WC_UNKNOWN, 0); + _concept1P = new TTconcept(&word); + } } } // End of namespace Titanic diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h index 11976d902d..193c60f719 100644 --- a/engines/titanic/true_talk/script_handler.h +++ b/engines/titanic/true_talk/script_handler.h @@ -43,8 +43,8 @@ private: int _inputCtr; int _field30; private: - void handleWord1(TTstring &str); - void handleWord2(TTstring &str); + void handleWord1(const TTstring *str); + void handleWord2(const TTstring *str); public: TTparser _parser; TTvocab *_vocab; @@ -81,7 +81,7 @@ public: */ int setResponse(TTscriptBase *script, TTresponse *response); - void handleWord(TTstring &str); + void handleWord(const TTstring *str); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index d7e3bc167e..c552d00eed 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -206,6 +206,22 @@ void TTtagMappings::load(const char *name) { /*------------------------------------------------------------------------*/ +void TTwordEntries::load(const char *name) { + Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); + + while (r->pos() < r->size()) { + TTwordEntry we; + we._id = r->readUint32LE(); + we._text = readStringFromStream(r); + + push_back(we); + } + + delete r; +} + +/*------------------------------------------------------------------------*/ + TTnpcScriptBase::TTnpcScriptBase(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTscriptBase(0, charClass, v2, charName, v3, v4, v5, v6, v7), @@ -298,7 +314,7 @@ void TTnpcScript::addResponse(int id) { if (id > 200000) id = getDialogueId(id); - proc15(id); + handleWord(id); TTscriptBase::addResponse(id); } @@ -350,8 +366,21 @@ void TTnpcScript::selectResponse(int id) { addResponse(id); } -int TTnpcScript::proc15(int id) const { - return 0; +bool TTnpcScript::handleWord(uint id) const { + if (_words.empty()) + return false; + + for (uint idx = 0; idx < _words.size(); ++idx) { + const TTwordEntry &we = _words[idx]; + if (we._id == id) { + TTstring str(we._text); + g_vm->_scriptHandler->handleWord(&str); + return true; + } + } + + g_vm->_scriptHandler->handleWord(nullptr); + return true; } bool TTnpcScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index ab4379bf60..29b174b8e0 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -120,6 +120,18 @@ public: void load(const char *name); }; +struct TTwordEntry { + uint _id; + CString _text; + + TTwordEntry() : _id(0) {} +}; + +class TTwordEntries : public Common::Array { +public: + void load(const char *name); +}; + class TTnpcScriptBase : public TTscriptBase { protected: int _field54; @@ -167,6 +179,7 @@ protected: TTscriptMappings _mappings; TTsentenceEntries _entries; TTtagMappings _tagMappings; + TTwordEntries _words; int _entryCount; int _field68; int _field6C; @@ -313,7 +326,11 @@ public: */ virtual void selectResponse(int id); - virtual int proc15(int id) const; + /** + * Handles scanning the word list for a given Id, and if + * found adds it to the sentence concept list + */ + virtual bool handleWord(uint id) const; virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const; -- cgit v1.2.3 From 539f13f5a4238a091dc4ff6bf1ddbe0bf2e201e3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 Jul 2016 23:13:37 -0400 Subject: TITANIC: Remove deprecated code --- engines/titanic/true_talk/barbot_script.cpp | 7 +------ engines/titanic/true_talk/barbot_script.h | 2 -- engines/titanic/true_talk/deskbot_script.cpp | 5 ----- engines/titanic/true_talk/deskbot_script.h | 2 -- engines/titanic/true_talk/doorbot_script.cpp | 5 ----- engines/titanic/true_talk/doorbot_script.h | 2 -- engines/titanic/true_talk/liftbot_script.cpp | 5 ----- engines/titanic/true_talk/liftbot_script.h | 2 -- 8 files changed, 1 insertion(+), 29 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index 6317f16e7c..080b48aea3 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -766,7 +766,7 @@ ScriptChangedResult BarbotScript::scriptChanged(TTscriptBase *roomScript, uint i } adjustDial(0, getRandomBit() ? getRandomNumber(5) * 4 : - -getRandomNumber(5) * 4); + -(int)getRandomNumber(5) * 4); break; case 3: @@ -840,11 +840,6 @@ ScriptChangedResult BarbotScript::scriptChanged(TTscriptBase *roomScript, uint i return SCR_2; } -int BarbotScript::proc15() const { - warning("TODO"); - return 0; -} - bool BarbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const { warning("TODO: handleQuote"); diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index 94491491c0..a5e6b50dc3 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -65,8 +65,6 @@ public: */ virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); - virtual int proc15() const; - virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const; diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 1349a78755..0458868e29 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -65,11 +65,6 @@ ScriptChangedResult DeskbotScript::scriptChanged(TTscriptBase *roomScript, uint return SCR_1; } -int DeskbotScript::proc15() const { - warning("TODO"); - return 0; -} - bool DeskbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const { warning("TODO"); diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index f685b7a9ca..417cebd37c 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -48,8 +48,6 @@ public: */ virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); - virtual int proc15() const; - virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const; diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 4be25118ef..51647b98e0 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -119,11 +119,6 @@ ScriptChangedResult DoorbotScript::scriptChanged(TTscriptBase *roomScript, uint return SCR_1; } -int DoorbotScript::proc15() const { - warning("TODO"); - return 0; -} - bool DoorbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const { warning("TODO"); diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index f50fa28f12..16f5c9684b 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -59,8 +59,6 @@ public: */ virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); - virtual int proc15() const; - virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const; diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index dae80c2e69..826690be5a 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -96,11 +96,6 @@ ScriptChangedResult LiftbotScript::scriptChanged(TTscriptBase *roomScript, uint return SCR_1; } -int LiftbotScript::proc15() const { - warning("TODO"); - return 0; -} - bool LiftbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const { warning("TODO"); diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index b2662b1206..20c9444b11 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -56,8 +56,6 @@ public: */ virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); - virtual int proc15() const; - virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, int val, uint tagId, uint remainder) const; -- cgit v1.2.3 From 2844574dc0f9e8c50e13cbebddd68db8c4dbc0bf Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 Jul 2016 23:29:59 -0400 Subject: TITANIC: Added NPC Script setDialRegion methods --- engines/titanic/true_talk/barbot_script.cpp | 7 ++++--- engines/titanic/true_talk/barbot_script.h | 7 ++++++- engines/titanic/true_talk/doorbot_script.cpp | 10 ++++++++-- engines/titanic/true_talk/doorbot_script.h | 7 ++++++- engines/titanic/true_talk/liftbot_script.cpp | 6 ++++-- engines/titanic/true_talk/liftbot_script.h | 6 +++++- 6 files changed, 33 insertions(+), 10 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index 080b48aea3..36916e2710 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -869,12 +869,13 @@ int BarbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentenc void BarbotScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { } -void BarbotScript::proc32() { - warning("TODO"); +void BarbotScript::setDialRegion(int dialNum, int region) { + TTnpcScript::setDialRegion(dialNum, region); + selectResponse(250365); + applyResponse(); } int BarbotScript::proc36(int tagId) const { - warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index a5e6b50dc3..cc8c2f19e3 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -73,7 +73,12 @@ public: virtual int proc23() const; virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); - virtual void proc32(); + + /** + * Sets a given dial to be pointing in a specified region (0 to 2) + */ + virtual void setDialRegion(int dialNum, int region); + virtual int proc36(int val) const; }; diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 51647b98e0..15ede3a727 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -148,8 +148,14 @@ int DoorbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsenten void DoorbotScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { } -void DoorbotScript::proc32() { - warning("TODO"); +void DoorbotScript::setDialRegion(int dialNum, int region) { + TTnpcScript::setDialRegion(dialNum, region); + if (dialNum == 1 && region != 1) { + CTrueTalkManager::setFlags(37, dialNum); + } else { + addResponse(getDialogueId(221777)); + applyResponse(); + } } int DoorbotScript::proc36(int id) const { diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 16f5c9684b..21a3e7f976 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -67,7 +67,12 @@ public: virtual int proc23() const; virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); - virtual void proc32(); + + /** + * Sets a given dial to be pointing in a specified region (0 to 2) + */ + virtual void setDialRegion(int dialNum, int region); + virtual int proc36(int val) const; }; diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index 826690be5a..cfa8a70480 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -125,8 +125,10 @@ int LiftbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsenten void LiftbotScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { } -void LiftbotScript::proc32() { - warning("TODO"); +void LiftbotScript::setDialRegion(int dialNum, int region) { + TTnpcScript::setDialRegion(dialNum, region); + addResponse(getDialogueId(210688)); + applyResponse(); } } // End of namespace Titanic diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index 20c9444b11..553c3712ad 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -64,7 +64,11 @@ public: virtual int proc23() const; virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); - virtual void proc32(); + + /** + * Sets a given dial to be pointing in a specified region (0 to 2) + */ + virtual void setDialRegion(int dialNum, int region); }; } // End of namespace Titanic -- cgit v1.2.3 From 3efc9f5cdea40c1658466b1f0d6ea8235567b293 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 25 Jul 2016 08:17:22 -0400 Subject: TITANIC: Added NPC scripts gitDialsBitsets methods --- engines/titanic/true_talk/barbot_script.cpp | 17 ++++++++++++----- engines/titanic/true_talk/barbot_script.h | 7 ++++++- engines/titanic/true_talk/doorbot_script.cpp | 11 ++++++++--- engines/titanic/true_talk/doorbot_script.h | 7 ++++++- engines/titanic/true_talk/liftbot_script.cpp | 14 +++++++++++--- engines/titanic/true_talk/liftbot_script.h | 7 ++++++- engines/titanic/true_talk/tt_npc_script.cpp | 6 +----- engines/titanic/true_talk/tt_npc_script.h | 7 ++++++- 8 files changed, 56 insertions(+), 20 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index 36916e2710..d191f4d0b3 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -92,7 +92,7 @@ int BarbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, } else if (tag == MKTAG('B', 'A', 'R', 'K') && getRandomNumber(100) > 50) { selectResponse(250025); - switch (proc23()) { + switch (getDialsBitset()) { case 4: case 6: addResponse(getDialogueId(250125)); @@ -106,7 +106,7 @@ int BarbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, } else if (tag == MKTAG('B', 'A', 'R', 'U') && getRandomNumber(100) > 50) { selectResponse(250025); - switch (proc23()) { + switch (getDialsBitset()) { case 4: case 6: addResponse(getDialogueId(250112)); @@ -856,9 +856,16 @@ int BarbotScript::proc22(int id) const { return 0; } -int BarbotScript::proc23() const { - warning("TODO"); - return 0; +uint BarbotScript::getDialsBitset() const { + uint bits = 0; + if (!getDialRegion(0)) + bits = 1; + if (!getDialRegion(1)) + bits |= 2; + if (!getDialRegion(2)) + bits |= 4; + + return bits; } int BarbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index cc8c2f19e3..a6739114ec 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -70,7 +70,12 @@ public: virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; - virtual int proc23() const; + + /** + * Returns a bitset of the first three dialgs being on or not + */ + virtual uint getDialsBitset() const; + virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 15ede3a727..ba84c9a7d7 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -135,9 +135,14 @@ int DoorbotScript::proc22(int id) const { return 0; } -int DoorbotScript::proc23() const { - warning("TODO"); - return 0; +uint DoorbotScript::getDialsBitset() const { + uint bits = 0; + if (!getDialRegion(1)) + bits = 1; + if (!getDialRegion(0)) + bits |= 2; + + return bits; } int DoorbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 21a3e7f976..cc3428cade 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -64,7 +64,12 @@ public: virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; - virtual int proc23() const; + + /** + * Returns a bitset of the dials being off or not + */ + virtual uint getDialsBitset() const; + virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index cfa8a70480..b37274a122 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -112,11 +112,19 @@ int LiftbotScript::proc22(int id) const { return 0; } -int LiftbotScript::proc23() const { - warning("TODO"); - return 0; +uint LiftbotScript::getDialsBitset() const { + uint bits = 0; + if (!getDialRegion(1)) + bits = 1; + if (!getDialRegion(0)) + bits |= 2; + if (bits > 1) + bits ^= 1; + + return bits; } + int LiftbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { warning("TODO"); return 0; diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index 553c3712ad..6e38287b12 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -61,7 +61,12 @@ public: virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; - virtual int proc23() const; + + /** + * Returns a bitset of the dials being off or not + */ + virtual uint getDialsBitset() const; + virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index c552d00eed..68e74467d1 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -444,10 +444,6 @@ int TTnpcScript::proc22(int id) const { return 0; } -int TTnpcScript::proc23() const { - return 0; -} - const TTscriptMapping *TTnpcScript::getMapping(int index) { if (index >= 0 && index < (int)_mappings.size()) return &_mappings[index]; @@ -705,7 +701,7 @@ uint TTnpcScript::getDialogueId(uint tagId) { if (tagId != oldTagId) tagId = getRangeValue(tagId); - oldTagId = proc23(); + oldTagId = getDialsBitset(); uint newId = proc21(origId, tagId, oldTagId); if (!newId) return 0; diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 29b174b8e0..ff4c34e963 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -349,7 +349,12 @@ public: virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; - virtual int proc23() const; + + /** + * Returns a bitset of the dials being off or not + */ + virtual uint getDialsBitset() const { return 0; } + virtual const TTscriptMapping *getMapping(int index); virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); -- cgit v1.2.3 From 9c763c978d9ba5b5115ca305429b7dea81091731 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 25 Jul 2016 19:38:33 -0400 Subject: TITANIC: Added BarbotScript proc25 --- engines/titanic/true_talk/barbot_script.cpp | 138 +++++++++++++++++++++++++- engines/titanic/true_talk/barbot_script.h | 3 +- engines/titanic/true_talk/bellbot_script.cpp | 2 +- engines/titanic/true_talk/bellbot_script.h | 4 +- engines/titanic/true_talk/deskbot_script.cpp | 2 +- engines/titanic/true_talk/deskbot_script.h | 2 +- engines/titanic/true_talk/doorbot_script.cpp | 2 +- engines/titanic/true_talk/doorbot_script.h | 2 +- engines/titanic/true_talk/liftbot_script.cpp | 2 +- engines/titanic/true_talk/liftbot_script.h | 2 +- engines/titanic/true_talk/maitred_script.cpp | 2 +- engines/titanic/true_talk/maitred_script.h | 2 +- engines/titanic/true_talk/parrot_script.cpp | 2 +- engines/titanic/true_talk/parrot_script.h | 2 +- engines/titanic/true_talk/succubus_script.cpp | 2 +- engines/titanic/true_talk/succubus_script.h | 2 +- engines/titanic/true_talk/tt_npc_script.cpp | 4 +- engines/titanic/true_talk/tt_npc_script.h | 2 +- engines/titanic/true_talk/tt_sentence.h | 2 +- 19 files changed, 157 insertions(+), 22 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index d191f4d0b3..d3e25eacaf 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -868,9 +868,141 @@ uint BarbotScript::getDialsBitset() const { return bits; } -int BarbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { - warning("TODO"); - return 0; +int BarbotScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { + int v34 = get34(); + uint id = 0; + + if (v34 > 0x200) { + switch (v34 - 0x201) { + case 0: + if (getValue(4) != 2) + id = 250738; + break; + case 1: + if (getValue(4) != 3) + id = 250738; + case 2: + if (getValue(4) != 0) + id = 250738; + break; + default: + break; + } + } else if (v34 == 0x200) { + if (getValue(4) != 1) + id = 250738; + } else { + switch (v34) { + case 2: + if (getValue(1) != 1) + return 1; + break; + case 3: + if (getValue(1) != 2) + return 1; + break; + case 4: + if (getValue(1) != 3) + return 1; + break; + case 5: + if (getValue(1) == 3) + return 1; + break; + case 6: + if (sentence->contains("do not") || sentence->contains("have no") || + sentence->contains("got no")) + return 1; + break; + case 7: + if (!sentence->contains("do not") && !sentence->contains("have no") && + !sentence->contains("got no")) + return 1; + break; + case 8: + if (sentence->_field38 == 2) + return 1; + break; + case 9: { + uint val = CTrueTalkManager::getStateValue(3); + bool bit0 = (val & 1) != 0; + bool bit2 = (val & 4) != 0; + bool bit3 = (val & 8) != 0; + + if (bit2) { + if (!bit0) { + id = 250085 - bit3 ? 0 : 199715; + break; + } else if (!bit3) { + id = 250627; + } + } else { + if (!bit0) { + id = 50365 + bit3 ? 0 : 2; + } else if (!bit3) { + id = 50370; + } + } + + if (id) { + addResponse(getDialogueId(id)); + applyResponse(); + return 2; + } + break; + } + + case 10: { + uint val = CTrueTalkManager::getStateValue(3); + bool bit0 = (val & 1) != 0; + bool bit2 = (val & 4) != 0; + bool bit3 = (val & 8) != 0; + + if (bit0 && bit2 && bit3) { + addResponse(getDialogueId(251027)); + applyResponse(); + CTrueTalkManager::triggerAction(7, 0); + return 2; + } else { + if (getDialRegion(1) == 1) { + if (*val2 != 251650) + id = 251651; + } else { + addResponse(getDialRegion(0) != 0 ? 51444 : 51530); + applyResponse(); + return 2; + } + } + break; + } + + case 11: + if (CTrueTalkManager::getStateValue(2) != 0) { + CTrueTalkManager::triggerAction(6, 0); + id = 251003; + } + break; + + case 12: + if (getDialRegion(1) == 0) { + addResponse(getDialogueId(251871)); + applyResponse(); + return 2; + } else if (getRandomNumber(100) > 25 && addRandomResponse(false)) { + return 2; + } + + default: + break; + } + } + + if (id) { + addResponse(getDialogueId(id)); + applyResponse(); + } + + return 2; } void BarbotScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index a6739114ec..4ce9be6b0a 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -76,7 +76,8 @@ public: */ virtual uint getDialsBitset() const; - virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; + virtual int proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence); + virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); /** diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index baf75cd405..66719be0b7 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -90,7 +90,7 @@ int BellbotScript::proc23() const { return 0; } -int BellbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { +int BellbotScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index b21d689b71..dbe3d6272c 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -61,7 +61,9 @@ public: virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; virtual int proc23() const; - virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; + + virtual int proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence); + virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual int proc36(int val) const; }; diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 0458868e29..b50f4ad99e 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -86,7 +86,7 @@ int DeskbotScript::proc23() const { return 0; } -int DeskbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { +int DeskbotScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index 417cebd37c..2348a2b59e 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -54,7 +54,7 @@ public: virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; virtual int proc23() const; - virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; + virtual int proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual int proc36(int val) const; diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index ba84c9a7d7..5450bbe0df 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -145,7 +145,7 @@ uint DoorbotScript::getDialsBitset() const { return bits; } -int DoorbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { +int DoorbotScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index cc3428cade..25d66acd7d 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -70,7 +70,7 @@ public: */ virtual uint getDialsBitset() const; - virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; + virtual int proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); /** diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index b37274a122..fe45624b48 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -125,7 +125,7 @@ uint LiftbotScript::getDialsBitset() const { } -int LiftbotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { +int LiftbotScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index 6e38287b12..8fec92ebf4 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -67,7 +67,7 @@ public: */ virtual uint getDialsBitset() const; - virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; + virtual int proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); /** diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index 998048f272..dc96e8f168 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -94,7 +94,7 @@ int MaitreDScript::proc23() const { return 0; } -int MaitreDScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { +int MaitreDScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index c210f71a7d..4b6d967ee4 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -58,7 +58,7 @@ public: virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; virtual int proc23() const; - virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; + virtual int proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); }; diff --git a/engines/titanic/true_talk/parrot_script.cpp b/engines/titanic/true_talk/parrot_script.cpp index 358c943cc4..d69f6b7807 100644 --- a/engines/titanic/true_talk/parrot_script.cpp +++ b/engines/titanic/true_talk/parrot_script.cpp @@ -107,7 +107,7 @@ int ParrotScript::proc23() const { return 0; } -int ParrotScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { +int ParrotScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { return 0; } diff --git a/engines/titanic/true_talk/parrot_script.h b/engines/titanic/true_talk/parrot_script.h index 921dc22df4..2da5897e4b 100644 --- a/engines/titanic/true_talk/parrot_script.h +++ b/engines/titanic/true_talk/parrot_script.h @@ -53,7 +53,7 @@ public: virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); virtual int proc23() const; - virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; + virtual int proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); }; diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp index cb1c12f580..346c75e1ff 100644 --- a/engines/titanic/true_talk/succubus_script.cpp +++ b/engines/titanic/true_talk/succubus_script.cpp @@ -94,7 +94,7 @@ int SuccUBusScript::proc23() const { return 0; } -int SuccUBusScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { +int SuccUBusScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h index c5ba51ee1c..1ff07d48a1 100644 --- a/engines/titanic/true_talk/succubus_script.h +++ b/engines/titanic/true_talk/succubus_script.h @@ -56,7 +56,7 @@ public: virtual int proc21(int v1, int v2, int v3); virtual int proc23() const; - virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; + virtual int proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); }; diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 68e74467d1..6199f1123e 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -450,7 +450,7 @@ const TTscriptMapping *TTnpcScript::getMapping(int index) { return nullptr; } -int TTnpcScript::proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const { +int TTnpcScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { return 0; } @@ -789,7 +789,7 @@ int TTnpcScript::processEntries(const TTsentenceEntries *entries, uint entryCoun if (!flag2) { flag = false; } else { - int result = proc25(entry._field2C & 0xFFFFFF, entry._field0, + int result = proc25(entry._field2C & 0xFFFFFF, &entry._field0, roomScript, sentence); if (result == 2) return 2; diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index ff4c34e963..346ed694ee 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -356,7 +356,7 @@ public: virtual uint getDialsBitset() const { return 0; } virtual const TTscriptMapping *getMapping(int index); - virtual int proc25(int val1, int val2, TTroomScript *roomScript, TTsentence *sentence) const; + virtual int proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual void save(SimpleFile *file); virtual void load(SimpleFile *file); diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index 94cc265f5f..2e40dd7e93 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -51,7 +51,6 @@ private: CScriptHandler *_owner; int _inputCtr; int _field34; - int _field38; TTsentenceNode *_nodesP; int _field5C; int _status; @@ -64,6 +63,7 @@ public: TTsentenceConcept _sentenceConcept; TTstring _initialLine; TTstring _normalizedLine; + int _field38; int _field58; TTroomScript *_roomScript; TTnpcScript *_npcScript; -- cgit v1.2.3 From fcb42d57150297725bd0f4aacb802fda78ec5695 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 25 Jul 2016 21:01:36 -0400 Subject: TITANIC: Added Bellbot & Deskbot proc25 --- engines/titanic/pet_control/pet_control.h | 2 +- engines/titanic/true_talk/barbot_script.cpp | 4 +- engines/titanic/true_talk/barbot_script.h | 2 +- engines/titanic/true_talk/bellbot_script.cpp | 84 ++++++++++++++++++++++++++- engines/titanic/true_talk/bellbot_script.h | 2 +- engines/titanic/true_talk/deskbot_script.cpp | 65 ++++++++++++++++++++- engines/titanic/true_talk/deskbot_script.h | 7 ++- engines/titanic/true_talk/doorbot_script.cpp | 2 +- engines/titanic/true_talk/doorbot_script.h | 2 +- engines/titanic/true_talk/liftbot_script.cpp | 2 +- engines/titanic/true_talk/liftbot_script.h | 2 +- engines/titanic/true_talk/maitred_script.cpp | 2 +- engines/titanic/true_talk/maitred_script.h | 2 +- engines/titanic/true_talk/parrot_script.cpp | 2 +- engines/titanic/true_talk/parrot_script.h | 2 +- engines/titanic/true_talk/succubus_script.cpp | 2 +- engines/titanic/true_talk/succubus_script.h | 2 +- engines/titanic/true_talk/tt_npc_script.cpp | 29 ++++++++- engines/titanic/true_talk/tt_npc_script.h | 7 ++- 19 files changed, 200 insertions(+), 22 deletions(-) diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 5e77b15230..362fc11f6e 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -524,7 +524,7 @@ public: /** * Returns the elevator number for the player's currently assigned room */ - int getRoomsElevatorNum1() const { + int getAssignedElevatorNum() const { return _rooms.getAssignedElevatorNum(); } diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index d3e25eacaf..93fa50eda9 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -868,7 +868,7 @@ uint BarbotScript::getDialsBitset() const { return bits; } -int BarbotScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { +int BarbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { int v34 = get34(); uint id = 0; @@ -965,7 +965,7 @@ int BarbotScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TT return 2; } else { if (getDialRegion(1) == 1) { - if (*val2 != 251650) + if (*srcIdP != 251650) id = 251651; } else { addResponse(getDialRegion(0) != 0 ? 51444 : 51530); diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index 4ce9be6b0a..90f4d951a6 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -76,7 +76,7 @@ public: */ virtual uint getDialsBitset() const; - virtual int proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence); + virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 66719be0b7..72ea5a471e 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -23,6 +23,7 @@ #include "common/textconsole.h" #include "titanic/true_talk/bellbot_script.h" #include "titanic/true_talk/true_talk_manager.h" +#include "titanic/core/node_item.h" namespace Titanic { @@ -90,8 +91,87 @@ int BellbotScript::proc23() const { return 0; } -int BellbotScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { - warning("TODO"); +int BellbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { + switch (val1) { + case 1: + addResponse(getDialogueId(*srcIdP)); + applyResponse(); + return 2; + + case 2: + addResponse(getDialogueId(*srcIdP)); + addResponse(getDialogueId(getRandomNumber(2) == 1 ? 200192 : 200157)); + addResponse(getDialogueId(200176)); + applyResponse(); + return 2; + + case 21: + if (CTrueTalkManager::getStateValue(7) == 0) { + selectResponse(21372); + applyResponse(); + return 2; + } + + if (!sentence->localWord("broken") && !sentence->contains("broken") && + CTrueTalkManager::_currentNPC) { + CNodeItem *node = CTrueTalkManager::_currentNPC->getNode(); + if (node) { + CString nodeName = node->getName(); + if (nodeName == "5" || nodeName == "6" || nodeName == "7") { + CTrueTalkManager::triggerAction(29, 2); + selectResponse(201571); + applyResponse(); + return 2; + } + } + } + + CTrueTalkManager::triggerAction(29, 1); + selectResponse(201771); + applyResponse(); + return 2; + + case 22: + if (CTrueTalkManager::getStateValue(7) == 0) { + selectResponse(21372); + applyResponse(); + return 2; + } + + if (!sentence->localWord("broken") && !sentence->contains("broken") && + CTrueTalkManager::_currentNPC) { + CNodeItem *node = CTrueTalkManager::_currentNPC->getNode(); + if (node) { + CString nodeName = node->getName(); + if (nodeName == "5" || nodeName == "6" || nodeName != "7") { + CTrueTalkManager::triggerAction(29, 2); + selectResponse(201571); + applyResponse(); + return 2; + } + } + } + + CTrueTalkManager::triggerAction(29, 1); + selectResponse(201771); + applyResponse(); + return 2; + + case 23: + case 24: + if (CTrueTalkManager::getStateValue(7) == 0) { + selectResponse(21372); + applyResponse(); + return 2; + } + + CTrueTalkManager::triggerAction(29, val1 == 23 ? 3 : 4); + break; + + default: + break; + } + return 0; } diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index dbe3d6272c..e990e322e5 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -62,7 +62,7 @@ public: virtual int proc22(int id) const; virtual int proc23() const; - virtual int proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence); + virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual int proc36(int val) const; diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index b50f4ad99e..20431b34a9 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -86,8 +86,48 @@ int DeskbotScript::proc23() const { return 0; } -int DeskbotScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { - warning("TODO"); +int DeskbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { + uint id; + + switch (val1) { + case 1: + id = *srcIdP; + if (id == 240431 || id == 240432) { + switch (getValue(1)) { + case 1: + id = 240336; + break; + case 2: + id = addAssignedRoomDialogue(); + break; + case 3: + if (getValue(3) == 1) { + if (id == 240431) + id = 240432; + } + else { + if (id == 240432) + id = 240431; + } + default: + break; + } + + addResponse(getDialogueId(id)); + applyResponse(); + return 2; + } + break; + + case 2: + if (getValue(1) == 1) + return true; + break; + + default: + break; + } + return 0; } @@ -115,4 +155,25 @@ bool DeskbotScript::isDial1Low() const { return getDialRegion(1) == 0; } +int DeskbotScript::addAssignedRoomDialogue() { + if (isDial1Medium()) { + addResponse(getDialogueId(240407)); + addResponse(getDialogueId(241510)); + CTrueTalkManager::setFlags(1, 1); + CTrueTalkManager::triggerAction(19, 1); + + int roomNum, floorNum, elevatorNum; + getAssignedRoom(&roomNum, &floorNum, &elevatorNum); + + addResponse(getDialogueId(241317 + roomNum)); + addResponse(getDialogueId(241271 + floorNum)); + addResponse(getDialogueId(241511)); + addResponse(getDialogueId(241313 + elevatorNum)); + + return 241512; + } else { + return 240567; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index 2348a2b59e..2cc8145684 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -34,6 +34,11 @@ private: * Setup sentence data */ void setupSentences(); + + /** + * Adds dialogue for the player's assigned room + */ + int addAssignedRoomDialogue(); public: DeskbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); @@ -54,7 +59,7 @@ public: virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; virtual int proc23() const; - virtual int proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence); + virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual int proc36(int val) const; diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 5450bbe0df..0ed9a68d7a 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -145,7 +145,7 @@ uint DoorbotScript::getDialsBitset() const { return bits; } -int DoorbotScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { +int DoorbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 25d66acd7d..233a247556 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -70,7 +70,7 @@ public: */ virtual uint getDialsBitset() const; - virtual int proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence); + virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); /** diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index fe45624b48..123eb7f3c6 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -125,7 +125,7 @@ uint LiftbotScript::getDialsBitset() const { } -int LiftbotScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { +int LiftbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index 8fec92ebf4..db85a85541 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -67,7 +67,7 @@ public: */ virtual uint getDialsBitset() const; - virtual int proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence); + virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); /** diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index dc96e8f168..a59583c993 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -94,7 +94,7 @@ int MaitreDScript::proc23() const { return 0; } -int MaitreDScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { +int MaitreDScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index 4b6d967ee4..91732cddc1 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -58,7 +58,7 @@ public: virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; virtual int proc23() const; - virtual int proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence); + virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); }; diff --git a/engines/titanic/true_talk/parrot_script.cpp b/engines/titanic/true_talk/parrot_script.cpp index d69f6b7807..01d998d9e8 100644 --- a/engines/titanic/true_talk/parrot_script.cpp +++ b/engines/titanic/true_talk/parrot_script.cpp @@ -107,7 +107,7 @@ int ParrotScript::proc23() const { return 0; } -int ParrotScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { +int ParrotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { return 0; } diff --git a/engines/titanic/true_talk/parrot_script.h b/engines/titanic/true_talk/parrot_script.h index 2da5897e4b..e832f7cfe7 100644 --- a/engines/titanic/true_talk/parrot_script.h +++ b/engines/titanic/true_talk/parrot_script.h @@ -53,7 +53,7 @@ public: virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); virtual int proc23() const; - virtual int proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence); + virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); }; diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp index 346c75e1ff..876cd163bb 100644 --- a/engines/titanic/true_talk/succubus_script.cpp +++ b/engines/titanic/true_talk/succubus_script.cpp @@ -94,7 +94,7 @@ int SuccUBusScript::proc23() const { return 0; } -int SuccUBusScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { +int SuccUBusScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h index 1ff07d48a1..9e393b84b2 100644 --- a/engines/titanic/true_talk/succubus_script.h +++ b/engines/titanic/true_talk/succubus_script.h @@ -56,7 +56,7 @@ public: virtual int proc21(int v1, int v2, int v3); virtual int proc23() const; - virtual int proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence); + virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); }; diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 6199f1123e..7a2ab856d8 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -450,7 +450,7 @@ const TTscriptMapping *TTnpcScript::getMapping(int index) { return nullptr; } -int TTnpcScript::proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence) { +int TTnpcScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { return 0; } @@ -1017,4 +1017,31 @@ bool TTnpcScript::sentence2C(TTsentence *sentence) { return sentence->_field2C >= 2 && sentence->_field2C <= 7; } +void TTnpcScript::getAssignedRoom(int *roomNum, int *floorNum, int *elevatorNum) const { + if (roomNum) + *roomNum = 5; + if (floorNum) + *floorNum = 40; + if (elevatorNum) + *elevatorNum = 3; + + CGameManager *gameManager = g_vm->_trueTalkManager->getGameManager(); + CPetControl *petControl = getPetControl(gameManager); + if (petControl) { + if (roomNum) + *roomNum = petControl->getAssignedRoomNum(); + if (floorNum) + *floorNum = petControl->getAssignedFloorNum(); + if (elevatorNum) + *elevatorNum = petControl->getAssignedElevatorNum(); + } + + if (floorNum) + *floorNum = CLIP(*floorNum, 1, 42); + if (roomNum) + *roomNum = CLIP(*roomNum, 1, 18); + if (elevatorNum) + *elevatorNum = CLIP(*elevatorNum, 1, 4); +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 346ed694ee..5b992f0675 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -285,6 +285,11 @@ protected: * Gets the True Talk state value */ bool getStateValue() const; + + /** + * Gets the assigned room's room, floor, and elevator number + */ + void getAssignedRoom(int *roomNum, int *floorNum, int *elevatorNum) const; public: static void init(); static void deinit(); @@ -356,7 +361,7 @@ public: virtual uint getDialsBitset() const { return 0; } virtual const TTscriptMapping *getMapping(int index); - virtual int proc25(int val1, const int *val2, TTroomScript *roomScript, TTsentence *sentence); + virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual void save(SimpleFile *file); virtual void load(SimpleFile *file); -- cgit v1.2.3 From 2faa3125c0978bbfceecc8913148f0f5eefb1a2e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 25 Jul 2016 22:07:23 -0400 Subject: TITANIC: Added DoorbotScript proc25 --- engines/titanic/true_talk/doorbot_script.cpp | 208 +++++++++++++++++++++++++++ engines/titanic/true_talk/doorbot_script.h | 10 ++ 2 files changed, 218 insertions(+) diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 0ed9a68d7a..04530f1491 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -31,6 +31,26 @@ static const int STATE_ARRAY[9] = { 0x2E2A, 0x2E2B, 0x2E2C, 0x2E2D, 0x2E2E, 0x2E2F, 0x2E30, 0x2E31, 0x2E32 }; +struct RoomDialogueId { + int _roomNum; + int _dialogueId; +}; +static const RoomDialogueId ROOM_DIALOGUES1[] = { + { 100, 10523 }, { 101, 10499 }, { 107, 10516 }, { 108, 10500 }, + { 109, 10490 }, { 110, 10504 }, { 111, 10506 }, { 112, 10498 }, + { 113, 10502 }, { 114, 10507 }, { 115, 10497 }, { 116, 10508 }, + { 117, 10505 }, { 118, 10505 }, { 122, 10516 }, { 123, 10383 }, + { 124, 10510 }, { 125, 10511 }, { 126, 10513 }, { 127, 10512 }, + { 128, 10495 }, { 129, 10496 }, { 130, 10491 }, { 131, 10493 }, + { 132, 10492 }, { 0, 0 } +}; +static const RoomDialogueId ROOM_DIALOGUES2[] = { + { 102, 221981 }, { 110, 221948 }, { 111, 221968 }, { 107, 222000 }, + { 101, 221935 }, { 112, 221924 }, { 113, 221942 }, { 116, 221977 }, + { 124, 221987 }, { 125, 221984 }, { 127, 221991 }, { 128, 221916 }, + { 129, 221919 }, { 131, 221912 }, { 132, 221908 }, { 0, 0 } +}; + DoorbotScript::DoorbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { @@ -146,6 +166,176 @@ uint DoorbotScript::getDialsBitset() const { } int DoorbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { + int id2, id = 0; + + switch (val1) { + case 2: + if (getValue(1) != 1) + return 1; + break; + case 3: + if (getValue(1) != 2) + return 1; + break; + case 4: + if (getValue(1) != 3) + return 1; + break; + case 5: + if (getValue(1) == 3) + return 1; + case 6: + if (getRoom54(132)) + return 1; + break; + case 9: + if (sentence->localWord("my") || sentence->contains("my")) + return true; + id2 = getRoomDialogueId1(roomScript); + if (id2) { + addResponse(id2); + applyResponse(); + return 2; + } + break; + case 11: + switch (getValue(1)) { + case 1: + id = 220837; + break; + case 2: + id = 220849; + break; + default: + id = 220858; + break; + } + break; + case 12: + if (getValue(4) != 1) + id = 221157; + break; + case 13: + if (getValue(4) != 2) + id = 221157; + break; + case 14: + if (getValue(4) != 3) + id = 221157; + break; + case 15: + if (getValue(4) != 0) + id = 221157; + break; + case 16: + if (!sentence->localWord("weather")) + return true; + switch (getRandomNumber(4)) { + case 1: + if (getValue(4) != 0) + id = 221354 - getRandomNumber(2) ? -489 : 0; + break; + case 2: + switch (getValue(4)) { + case 0: + id = 220851; + break; + case 1: + id = 221268; + break; + case 2: + id = 221270; + break; + default: + id = 220865; + } + break; + case 3: + id = 221280; + break; + default: + break; + } + break; + case 17: + if (get34()) + return 1; + set34(0); + break; + case 18: + if (roomScript->_scriptId == 100) { + CTrueTalkManager::triggerAction(3, 0); + return 2; + } + break; + case 19: + CTrueTalkManager::_v9 = 104; + CTrueTalkManager::triggerAction(4, 0); + break; + case 20: + CTrueTalkManager::triggerAction(28, 0); + break; + case 22: + CTrueTalkManager::triggerAction(29, 1); + break; + case 23: + CTrueTalkManager::triggerAction(29, 2); + break; + case 24: + CTrueTalkManager::triggerAction(29, 3); + break; + case 25: + CTrueTalkManager::triggerAction(29, 4); + break; + case 26: + if (!sentence->localWord("my") && !sentence->contains("my")) + return 1; + break; + case 27: + if (!sentence->localWord("earth") && !sentence->contains("earth")) + return 1; + break; + case 28: + id2 = getRoomDialogueId2(roomScript); + if (id2) { + addResponse(id2); + applyResponse(); + return 2; + } + break; + case 29: + if (sentence->localWord("another") || sentence->localWord("more") || + sentence->localWord("additional") || sentence->contains("another") || + sentence->contains("more") || sentence->contains("additional")) { + addResponse(getDialogueId(220058)); + applyResponse(); + return 2; + } + break; + case 30: + if (!sentence->localWord("because") && !sentence->contains("because")) + return 1; + break; + case 0x200: + if (getValue(4) != 1) + id = 221157; + break; + case 0x201: + if (getValue(4) != 2) + id = 221157; + break; + case 0x202: + if (getValue(4) != 3) + id = 221157; + break; + case 0x203: + if (getValue(4) != 0) + id = 221157; + break; + default: + break; + } + warning("TODO"); return 0; } @@ -177,4 +367,22 @@ int DoorbotScript::setResponse(int dialogueId, int v34) { return 2; } +int DoorbotScript::getRoomDialogueId1(const TTroomScript *roomScript) { + for (const RoomDialogueId *r = ROOM_DIALOGUES1; r->_roomNum; ++r) { + if (r->_roomNum == roomScript->_scriptId == r->_roomNum) + return getDialogueId(r->_dialogueId); + } + + return 0; +} + +int DoorbotScript::getRoomDialogueId2(const TTroomScript *roomScript) { + for (const RoomDialogueId *r = ROOM_DIALOGUES2; r->_roomNum; ++r) { + if (r->_roomNum == roomScript->_scriptId == r->_roomNum) + return getDialogueId(r->_dialogueId); + } + + return 0; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 233a247556..3ec4cfb520 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -40,6 +40,16 @@ private: * Sets a response */ int setResponse(int dialogueId, int v34 = -1); + + /** + * Gets the dialogue Id for a given room + */ + int getRoomDialogueId1(const TTroomScript *roomScript); + + /** + * Gets the dialogue Id for a given room + */ + int getRoomDialogueId2(const TTroomScript *roomScript); public: DoorbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7); -- cgit v1.2.3 From f1c4647c9b721d5a1b166d0974a98d9f8b5ae894 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 25 Jul 2016 23:51:41 -0400 Subject: TITANIC: Added LiftbotScript proc25 --- engines/titanic/true_talk/liftbot_script.cpp | 203 ++++++++++++++++++++++++++- engines/titanic/true_talk/liftbot_script.h | 10 ++ 2 files changed, 212 insertions(+), 1 deletion(-) diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index 123eb7f3c6..c91bd73f1a 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -126,7 +126,109 @@ uint LiftbotScript::getDialsBitset() const { int LiftbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { - warning("TODO"); + static const int ARRAY13[] = { + 210724, 210735, 210746, 210757, 210758, 210759, 210760, + 210761, 210762, 210725, 210726, 210727, 210728, 210729, + 210730, 210731, 210732, 210733, 210734, 210736, 210737, + 210738, 210739, 210740, 210741, 210742, 210743, 210744, + 210745, 210747, 210748, 210749, 210750, 210751, 210752, + 210753, 210754, 210755, 210756 + }; + static const int ARRAY14[] = { + 0, 210849, 210850, 210851, 210852, 210838, 210839, 210840, 210841, 0 + }; + + get34(); + int stateVal; + + switch (val1) { + case 1: + if (getValue(1) != 1) + return 1; + break; + case 2: + if (getValue(1) != 2) + return 1; + break; + case 3: + if (getValue(1) != 3) + return 1; + break; + case 4: + case 5: + return !sentence1(sentence); + case 6: + if (sentence->localWord("big") || sentence->localWord("small")) { + addResponse(getDialogueId(210215)); + applyResponse(); + } else if (sentence->localWord("my") || sentence->contains("my") || + sentence->contains("bedroom") || sentence->contains("state")) { + addResponse1(CTrueTalkManager::getStateValue(4), true, 0); + } else { + selectResponse(210763); + applyResponse(); + } + return 2; + case 7: + if (!sentence->localWord("ill") && !sentence->localWord("well")) + return 1; + break; + case 8: + if (!sentence->localWord("long")) + return 1; + break; + case 9: + if (addResponse1(1, false, 0)) + return 2; + break; + case 10: + if (addResponse1(39, false, 0)) + return 2; + break; + case 11: + if (getState6() == 2 || getState6() == 4) + return 1; + break; + case 12: + if (getState6() == 1 || getState6() == 3) + return 1; + break; + case 13: + selectResponse(ARRAY13[getState5()]); + applyResponse(); + return 2; + case 14: + stateVal = getState6(); + if (sentence->contains("elevator") || + (!sentence->contains("lift") && getRandomNumber(100) > 60)) + stateVal += 4; + selectResponse(ARRAY14[stateVal]); + applyResponse(); + return 2; + case 15: + if (getRandomNumber(100) > 60) { + addResponse(getDialogueId(210440)); + } else { + addResponse(getDialogueId(210906)); + addResponse(getDialogueId(210901)); + } + applyResponse(); + return 2; + case 16: + if (sentence->contains("elevator") || sentence->contains("elavator")) + addResponse(30579); + else + addResponse(30580); + applyResponse(); + return 2; + case 17: + if (sentence->localWord("restaurant") || sentence->contains("restaurant")) + return 1; + break; + default: + break; + } + return 0; } @@ -139,4 +241,103 @@ void LiftbotScript::setDialRegion(int dialNum, int region) { applyResponse(); } +int LiftbotScript::getState5() const { + int val = CTrueTalkManager::getStateValue(5); + return CLIP(val, 1, 39); +} + +int LiftbotScript::getState6() const { + int val = CTrueTalkManager::getStateValue(6); + return (val < 1 || val > 4) ? 1 : val; +} + +int LiftbotScript::addDialogueAndState(int id, int state) { + addResponse(id); + applyResponse(); + + if (state != 1) + set34(state); + return 2; +} + +int LiftbotScript::addResponse1(int index, bool flag, int id) { + static const int DIALOGUE_IDS[37] = { + 210735, 210746, 210757, 210758, 210759, 210760, 210761, 210762, + 210725, 210726, 210727, 210728, 210729, 210730, 210731, 210732, + 210733, 210734, 210736, 210737, 210738, 210739, 210740, 210741, + 210742, 210743, 210744, 210745, 210747, 210748, 210749, 210750, + 210751, 210752, 210753, 210754, 210755 + }; + + int stateVal = getState6(); + int maxIndex = (stateVal == 2 || stateVal == 4) ? 27 : 39; + + if (index < 1 || index > maxIndex) { + addResponse(getDialogueId(maxIndex == 27 ? 210587 : 210586)); + applyResponse(); + return 1; + } else if (index == getState5()) { + if (index == 1) { + addResponse(30558 - getRandomBit() ? 290 : 0); + addResponse(getDialogueId(210589)); + } else { + if (index == 39) + addResponse(30346); + addResponse(getDialogueId(210589)); + } + + applyResponse(); + return 2; + } + + stateVal = getValue(1); + if (index >= 2 && index <= 19 && stateVal > 1) { + addResponse(getDialogueId(210203)); + applyResponse(); + set34(7); + return true; + } + + if (index >= 20 && index <= 27 && stateVal > 2) { + addResponse(getDialogueId(210210)); + applyResponse(); + set34(8); + return true; + } + + if (flag) { + if (index == 1) { + selectResponse(30558 - getRandomBit() ? 290 : 0); + } else if (index == 39) { + addResponse(30346); + } else { + if (getRandomNumber(100) > 35 && index >= 2 && index <= 38) { + addResponse(getDialogueId(DIALOGUE_IDS[index - 2])); + } + + addResponse(getDialogueId(210588)); + } + + if (id) { + if (id == 210717 || id == 210716 || id == 210719 || id == 210718) { + addResponse(getDialogueId(210720)); + addResponse(getDialogueId(id)); + addResponse(getDialogueId(210715)); + } else { + addResponse(getDialogueId(id)); + } + } + + applyResponse(); + } + + CTrueTalkManager::triggerAction(2, index); + return flag; +} + +int LiftbotScript::sentence1(const TTsentence *sentence) { + warning("TODO: LiftbotScript::sentence1"); + return 0; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index db85a85541..03c4eac8f9 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -35,6 +35,16 @@ private: * Setup sentence data */ void setupSentences(); + + int addResponse1(int mode, bool flag, int id); + int sentence1(const TTsentence *sentence); + int getState5() const; + int getState6() const; + + /** + * Adds a dialogue response and sets the state + */ + int addDialogueAndState(int id, int state); public: LiftbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7); -- cgit v1.2.3 From 40955e590c627f600ae4708eb1980cf2ab81931d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 26 Jul 2016 17:39:40 -0400 Subject: TITANIC: Handled tag switch in BarbotScript handleQuote --- engines/titanic/true_talk/barbot_script.cpp | 108 +++++++++++++++++++++++++++- 1 file changed, 106 insertions(+), 2 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index 93fa50eda9..141603c152 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -841,8 +841,112 @@ ScriptChangedResult BarbotScript::scriptChanged(TTscriptBase *roomScript, uint i } bool BarbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, - int val, uint tagId, uint remainder) const { - warning("TODO: handleQuote"); + int val, uint tagId, uint remainder) const { + switch (tagId) { + case MKTAG('A', 'D', 'V', 'T'): + case MKTAG('A', 'R', 'T', 'I'): + case MKTAG('A', 'R', 'T', 'Y'): + case MKTAG('B', 'R', 'N', 'D'): + case MKTAG('C', 'O', 'M', 'D'): + case MKTAG('D', 'N', 'C', 'E'): + case MKTAG('H', 'B', 'B', 'Y'): + case MKTAG('M', 'A', 'G', 'S'): + case MKTAG('L', 'I', 'T', 'R'): + case MKTAG('M', 'C', 'P', 'Y'): + case MKTAG('M', 'I', 'N', 'S'): + case MKTAG('M', 'U', 'S', 'I'): + case MKTAG('N', 'I', 'K', 'E'): + case MKTAG('S', 'F', 'S', 'F'): + case MKTAG('S', 'O', 'A', 'P'): + case MKTAG('S', 'O', 'N', 'G'): + case MKTAG('S', 'P', 'R', 'T'): + case MKTAG('T', 'E', 'A', 'M'): + case MKTAG('T', 'U', 'S', 'H'): + case MKTAG('W', 'W', 'E', 'B'): + tagId = MKTAG('E', 'N', 'T', 'N'); + break; + case MKTAG('A', 'U', 'T', 'H'): + case MKTAG('B', 'A', 'R', 'K'): + case MKTAG('B', 'L', 'R', '1'): + case MKTAG('B', 'L', 'P', '1'): + case MKTAG('B', 'L', 'P', '2'): + case MKTAG('B', 'L', 'P', '3'): + case MKTAG('B', 'L', 'P', '4'): + case MKTAG('B', 'L', 'T', '1'): + case MKTAG('B', 'L', 'T', '2'): + case MKTAG('B', 'L', 'T', '3'): + case MKTAG('B', 'L', 'T', '4'): + case MKTAG('B', 'L', 'T', '5'): + case MKTAG('B', 'O', 'Y', 'S'): + case MKTAG('C', 'O', 'P', 'S'): + case MKTAG('D', 'C', 'T', 'R'): + case MKTAG('F', 'A', 'M', 'E'): + case MKTAG('F', 'A', 'S', 'H'): + case MKTAG('G', 'I', 'R', 'L'): + case MKTAG('H', 'E', 'R', 'O'): + case MKTAG('H', 'O', 'S', 'T'): + case MKTAG('K', 'N', 'O', 'B'): + case MKTAG('N', 'H', 'R', 'O'): + case MKTAG('R', 'A', 'C', 'E'): + case MKTAG('S', 'C', 'I', 'T'): + case MKTAG('T', 'D', 'U', 'P'): + case MKTAG('T', 'W', 'A', 'T'): + case MKTAG('W', 'E', 'A', 'T'): + tagId = MKTAG('P', 'R', 'S', 'N'); + break; + case MKTAG('C', 'H', 'S', 'E'): + case MKTAG('C', 'M', 'N', 'T'): + case MKTAG('F', 'I', 'L', 'M'): + case MKTAG('J', 'F', 'O', 'D'): + case MKTAG('L', 'I', 'Q', 'D'): + tagId = MKTAG('F', 'O', 'O', 'D'); + break; + case MKTAG('C', 'R', 'M', 'N'): + case MKTAG('C', 'S', 'P', 'Y'): + case MKTAG('U', 'B', 'A', 'D'): + tagId = MKTAG('U', 'B', 'A', 'D'); + break; + case MKTAG('E', 'A', 'R', 'T'): + case MKTAG('H', 'O', 'M', 'E'): + case MKTAG('N', 'P', 'L', 'C'): + case MKTAG('P', 'L', 'A', 'C'): + case MKTAG('P', 'L', 'A', 'N'): + tagId = MKTAG('P', 'L', 'A', 'C'); + break; + case MKTAG('F', 'A', 'U', 'N'): + case MKTAG('F', 'I', 'S', 'H'): + case MKTAG('F', 'L', 'O', 'R'): + tagId = MKTAG('N', 'A', 'T', 'R'); + break; + case MKTAG('H', 'H', 'L', 'D'): + case MKTAG('T', 'O', 'Y', 'S'): + case MKTAG('W', 'E', 'A', 'P'): + tagId = MKTAG('M', 'A', 'C', 'H'); + break; + case MKTAG('M', 'L', 'T', 'Y'): + case MKTAG('P', 'G', 'R', 'P'): + case MKTAG('P', 'T', 'I', 'C'): + tagId = MKTAG('G', 'R', 'U', 'P'); + break; + case MKTAG('P', 'K', 'U', 'P'): + case MKTAG('S', 'E', 'X', '1'): + case MKTAG('S', 'W', 'E', 'R'): + tagId = MKTAG('R', 'U', 'D', 'E'); + break; + case MKTAG('P', 'H', 'I', 'L'): + case MKTAG('R', 'C', 'K', 'T'): + case MKTAG('S', 'C', 'I', 'E'): + tagId = MKTAG('S', 'C', 'I', 'E'); + break; + case MKTAG('T', 'R', 'A', '2'): + case MKTAG('T', 'R', 'A', '3'): + tagId = MKTAG('T', 'R', 'A', 'V'); + break; + default: + break; + } + + warning("TODO: handleQuote - %d", tagId); return false; } -- cgit v1.2.3 From 78d8c4e3da631e4749d70cc4923cd12871d0232f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 26 Jul 2016 18:37:39 -0400 Subject: TITANIC: Handled tag switch in BellbotScript handleQuote --- engines/titanic/true_talk/bellbot_script.cpp | 108 ++++++++++++++++++++++++++- 1 file changed, 107 insertions(+), 1 deletion(-) diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 72ea5a471e..ecb503cdc3 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -71,7 +71,113 @@ int BellbotScript::proc15() const { } bool BellbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, - int val, uint tagId, uint remainder) const { + int val, uint tagId, uint remainder) const { + switch (tagId) { + case MKTAG('A', 'D', 'V', 'T'): + case MKTAG('A', 'R', 'T', 'I'): + case MKTAG('A', 'R', 'T', 'Y'): + case MKTAG('B', 'R', 'N', 'D'): + case MKTAG('C', 'O', 'M', 'D'): + case MKTAG('D', 'N', 'C', 'E'): + case MKTAG('H', 'B', 'B', 'Y'): + case MKTAG('L', 'I', 'T', 'R'): + case MKTAG('M', 'A', 'G', 'S'): + case MKTAG('M', 'C', 'P', 'Y'): + case MKTAG('M', 'I', 'N', 'S'): + case MKTAG('M', 'U', 'S', 'I'): + case MKTAG('N', 'I', 'K', 'E'): + case MKTAG('S', 'F', 'S', 'F'): + case MKTAG('S', 'O', 'A', 'P'): + case MKTAG('S', 'O', 'N', 'G'): + case MKTAG('S', 'P', 'R', 'T'): + case MKTAG('T', 'E', 'A', 'M'): + case MKTAG('T', 'V', 'S', 'H'): + case MKTAG('W', 'W', 'E', 'B'): + tagId = MKTAG('E', 'N', 'T', 'N'); + break; + case MKTAG('A', 'C', 'T', 'R'): + case MKTAG('A', 'C', 'T', 'S'): + case MKTAG('A', 'U', 'T', 'H'): + case MKTAG('B', 'A', 'R', 'K'): + case MKTAG('B', 'A', 'R', 'U'): + case MKTAG('B', 'L', 'F', '1'): + case MKTAG('B', 'L', 'F', '2'): + case MKTAG('B', 'L', 'P', '1'): + case MKTAG('B', 'L', 'P', '2'): + case MKTAG('B', 'L', 'P', '3'): + case MKTAG('B', 'L', 'P', '4'): + case MKTAG('B', 'L', 'R', '1'): + case MKTAG('B', 'L', 'R', '2'): + case MKTAG('B', 'L', 'T', '1'): + case MKTAG('B', 'L', 'T', '2'): + case MKTAG('B', 'L', 'T', '3'): + case MKTAG('B', 'L', 'T', '4'): + case MKTAG('B', 'L', 'T', '5'): + case MKTAG('C', 'O', 'P', 'S'): + case MKTAG('D', 'C', 'T', 'R'): + case MKTAG('F', 'A', 'S', 'H'): + case MKTAG('F', 'A', 'M', 'E'): + case MKTAG('H', 'E', 'R', 'D'): + case MKTAG('H', 'O', 'S', 'T'): + case MKTAG('K', 'N', 'O', 'B'): + case MKTAG('N', 'H', 'R', 'O'): + case MKTAG('R', 'A', 'C', 'E'): + case MKTAG('S', 'C', 'I', 'T'): + case MKTAG('T', 'O', 'U', 'P'): + case MKTAG('T', 'W', 'A', 'T'): + case MKTAG('W', 'E', 'A', 'T'): + tagId = MKTAG('P', 'R', 'S', 'N'); + break; + case MKTAG('C', 'H', 'S', 'E'): + case MKTAG('C', 'M', 'N', 't'): + case MKTAG('F', 'I', 'L', 'M'): + case MKTAG('J', 'F', 'O', 'D'): + case MKTAG('L', 'I', 'Q', 'D'): + tagId = MKTAG('F', 'O', 'O', 'D'); + break; + case MKTAG('C', 'R', 'I', 'M'): + case MKTAG('C', 'S', 'P', 'Y'): + case MKTAG('D', 'R', 'U', 'G'): + tagId = MKTAG('V', 'B', 'A', 'D'); + break; + case MKTAG('E', 'A', 'R', 'T'): + case MKTAG('H', 'O', 'M', 'E'): + case MKTAG('N', 'P', 'L', 'C'): + case MKTAG('P', 'L', 'A', 'N'): + tagId = MKTAG('P', 'L', 'A', 'C'); + break; + case MKTAG('F', 'A', 'U', 'N'): + case MKTAG('F', 'I', 'S', 'H'): + case MKTAG('F', 'L', 'O', 'R'): + tagId = MKTAG('N', 'A', 'T', 'R'); + break; + case MKTAG('H', 'H', 'L', 'D'): + case MKTAG('T', 'O', 'Y', 'S'): + case MKTAG('W', 'E', 'A', 'P'): + tagId = MKTAG('M', 'A', 'C', 'H'); + break; + case MKTAG('M', 'L', 'T', 'Y'): + case MKTAG('P', 'G', 'R', 'P'): + case MKTAG('P', 'T', 'I', 'C'): + tagId = MKTAG('G', 'R', 'U', 'P'); + break; + case MKTAG('P', 'K', 'U', 'P'): + case MKTAG('S', 'E', 'X', '1'): + case MKTAG('S', 'W', 'E', 'R'): + tagId = MKTAG('R', 'U', 'D', 'E'); + break; + case MKTAG('P', 'H', 'I', 'L'): + case MKTAG('R', 'C', 'K', 'T'): + tagId = MKTAG('S', 'C', 'I', 'E'); + break; + case MKTAG('T', 'R', 'A', '2'): + case MKTAG('T', 'R', 'A', '3'): + tagId = MKTAG('T', 'R', 'A', 'V'); + break; + default: + break; + } + warning("TODO: handleQuote"); return false; } -- cgit v1.2.3 From de494c8c27ac2ede69f6e73b76fa48c3a9597314 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 26 Jul 2016 19:10:57 -0400 Subject: TITANIC: Handled tag switch in DeskbotScript handleQuote --- engines/titanic/true_talk/barbot_script.cpp | 4 +- engines/titanic/true_talk/deskbot_script.cpp | 110 ++++++++++++++++++++++++++- 2 files changed, 111 insertions(+), 3 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index 141603c152..cbb58cdd1c 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -889,7 +889,7 @@ bool BarbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, case MKTAG('N', 'H', 'R', 'O'): case MKTAG('R', 'A', 'C', 'E'): case MKTAG('S', 'C', 'I', 'T'): - case MKTAG('T', 'D', 'U', 'P'): + case MKTAG('T', 'D', 'V', 'P'): case MKTAG('T', 'W', 'A', 'T'): case MKTAG('W', 'E', 'A', 'T'): tagId = MKTAG('P', 'R', 'S', 'N'); @@ -904,7 +904,7 @@ bool BarbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, case MKTAG('C', 'R', 'M', 'N'): case MKTAG('C', 'S', 'P', 'Y'): case MKTAG('U', 'B', 'A', 'D'): - tagId = MKTAG('U', 'B', 'A', 'D'); + tagId = MKTAG('V', 'B', 'A', 'D'); break; case MKTAG('E', 'A', 'R', 'T'): case MKTAG('H', 'O', 'M', 'E'): diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 20431b34a9..28eff25374 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -66,7 +66,115 @@ ScriptChangedResult DeskbotScript::scriptChanged(TTscriptBase *roomScript, uint } bool DeskbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, - int val, uint tagId, uint remainder) const { + int val, uint tagId, uint remainder) const { + switch (tagId) { + case MKTAG('A', 'D', 'V', 'T'): + case MKTAG('A', 'R', 'T', 'I'): + case MKTAG('A', 'R', 'T', 'Y'): + case MKTAG('B', 'R', 'N', 'D'): + case MKTAG('C', 'O', 'M', 'D'): + case MKTAG('D', 'N', 'C', 'E'): + case MKTAG('H', 'B', 'B', 'Y'): + case MKTAG('L', 'I', 'T', 'R'): + case MKTAG('M', 'A', 'G', 'S'): + case MKTAG('M', 'C', 'P', 'Y'): + case MKTAG('M', 'I', 'N', 'S'): + case MKTAG('M', 'U', 'S', 'I'): + case MKTAG('N', 'I', 'K', 'E'): + case MKTAG('S', 'F', 'S', 'F'): + case MKTAG('S', 'O', 'A', 'P'): + case MKTAG('S', 'O', 'N', 'G'): + case MKTAG('S', 'P', 'R', 'T'): + case MKTAG('T', 'E', 'A', 'M'): + case MKTAG('T', 'V', 'S', 'H'): + tagId = MKTAG('E', 'N', 'T', 'N'); + break; + case MKTAG('A', 'C', 'T', 'R'): + case MKTAG('A', 'C', 'T', 'S'): + case MKTAG('A', 'U', 'T', 'H'): + case MKTAG('B', 'A', 'R', 'K'): + case MKTAG('B', 'A', 'R', 'U'): + case MKTAG('B', 'L', 'F', '1'): + case MKTAG('B', 'L', 'F', '2'): + case MKTAG('B', 'L', 'P', '1'): + case MKTAG('B', 'L', 'P', '2'): + case MKTAG('B', 'L', 'P', '3'): + case MKTAG('B', 'L', 'P', '4'): + case MKTAG('B', 'L', 'R', '1'): + case MKTAG('B', 'L', 'R', '2'): + case MKTAG('B', 'L', 'T', '1'): + case MKTAG('B', 'L', 'T', '2'): + case MKTAG('B', 'L', 'T', '3'): + case MKTAG('B', 'L', 'T', '4'): + case MKTAG('B', 'L', 'T', '5'): + case MKTAG('B', 'O', 'Y', 'S'): + case MKTAG('C', 'O', 'P', 'S'): + case MKTAG('D', 'C', 'T', 'R'): + case MKTAG('F', 'A', 'M', 'E'): + case MKTAG('F', 'A', 'S', 'H'): + case MKTAG('G', 'I', 'R', 'L'): + case MKTAG('H', 'E', 'R', 'O'): + case MKTAG('H', 'O', 'S', 'T'): + case MKTAG('K', 'N', 'O', 'B'): + case MKTAG('N', 'H', 'R', 'O'): + case MKTAG('R', 'A', 'C', 'E'): + case MKTAG('S', 'C', 'I', 'T'): + case MKTAG('T', 'D', 'V', 'P'): + case MKTAG('T', 'W', 'A', 'T'): + case MKTAG('W', 'E', 'A', 'T'): + case MKTAG('W', 'W', 'E', 'B'): + tagId = MKTAG('P', 'R', 'S', 'N'); + break; + case MKTAG('C', 'H', 'S', 'E'): + case MKTAG('C', 'M', 'N', 'T'): + case MKTAG('F', 'I', 'L', 'M'): + case MKTAG('J', 'F', 'O', 'D'): + case MKTAG('L', 'I', 'Q', 'D'): + tagId = MKTAG('F', 'O', 'O', 'D'); + break; + case MKTAG('C', 'R', 'I', 'M'): + case MKTAG('C', 'S', 'P', 'Y'): + case MKTAG('D', 'R', 'U', 'G'): + tagId = MKTAG('V', 'B', 'A', 'D'); + break; + case MKTAG('E', 'A', 'R', 'T'): + case MKTAG('H', 'O', 'M', 'E'): + case MKTAG('N', 'P', 'L', 'C'): + case MKTAG('P', 'L', 'A', 'N'): + tagId = MKTAG('P', 'L', 'A', 'C'); + break; + case MKTAG('F', 'A', 'U', 'N'): + case MKTAG('F', 'I', 'S', 'H'): + case MKTAG('F', 'L', 'O', 'R'): + tagId = MKTAG('N', 'A', 'T', 'R'); + break; + case MKTAG('H', 'H', 'L', 'D'): + case MKTAG('T', 'O', 'Y', 'S'): + case MKTAG('W', 'E', 'A', 'P'): + tagId = MKTAG('M', 'A', 'C', 'H'); + break; + case MKTAG('M', 'L', 'T', 'Y'): + case MKTAG('P', 'G', 'R', 'P'): + case MKTAG('P', 'T', 'I', 'C'): + tagId = MKTAG('G', 'R', 'U', 'P'); + break; + case MKTAG('P', 'K', 'U', 'P'): + case MKTAG('S', 'E', 'X', '1'): + case MKTAG('S', 'W', 'E', 'R'): + tagId = MKTAG('R', 'U', 'D', 'E'); + break; + case MKTAG('P', 'H', 'I', 'L'): + case MKTAG('R', 'C', 'K', 'T'): + tagId = MKTAG('S', 'C', 'I', 'E'); + break; + case MKTAG('T', 'R', 'A', '2'): + case MKTAG('T', 'R', 'A', '3'): + tagId = MKTAG('T', 'R', 'A', 'V'); + break; + default: + break; + } + warning("TODO"); return 0; } -- cgit v1.2.3 From 04931130b49482262f24bf330a698d254690bb90 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 26 Jul 2016 20:25:44 -0400 Subject: TITANIC: Split NPC script support data structures to their own file --- engines/titanic/module.mk | 1 + engines/titanic/true_talk/script_support.cpp | 143 +++++++++++++++++++++++++++ engines/titanic/true_talk/script_support.h | 130 ++++++++++++++++++++++++ engines/titanic/true_talk/tt_npc_script.cpp | 117 ---------------------- engines/titanic/true_talk/tt_npc_script.h | 99 +------------------ 5 files changed, 275 insertions(+), 215 deletions(-) create mode 100644 engines/titanic/true_talk/script_support.cpp create mode 100644 engines/titanic/true_talk/script_support.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 60a95bc094..1107fddaf5 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -481,6 +481,7 @@ MODULE_OBJS := \ true_talk/succubus_script.o \ true_talk/title_engine.o \ true_talk/script_handler.o \ + true_talk/script_support.o \ true_talk/true_talk_manager.o \ true_talk/tt_action.o \ true_talk/tt_adj.o \ diff --git a/engines/titanic/true_talk/script_support.cpp b/engines/titanic/true_talk/script_support.cpp new file mode 100644 index 0000000000..857d774f82 --- /dev/null +++ b/engines/titanic/true_talk/script_support.cpp @@ -0,0 +1,143 @@ +/* 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 "titanic/true_talk/script_support.h" +#include "titanic/titanic.h" + +namespace Titanic { + +int TTnpcScriptResponse::size() const { + for (int idx = 0; idx < 4; ++idx) { + if (_values[idx] == 0) + return idx; + } + + return 4; +} + +/*------------------------------------------------------------------------*/ + +TTscriptRange::TTscriptRange(uint id, const Common::Array &values, + bool isRandom, bool isSequential) : + _id(id), _nextP(nullptr) { + _mode = SF_NONE; + if (isRandom) + _mode = SF_RANDOM; + if (isSequential) + _mode = SF_SEQUENTIAL; + + for (uint idx = 0; idx < values.size(); ++idx) + _values.push_back(values[idx]); +} + +/*------------------------------------------------------------------------*/ + + +bool TTsentenceEntry::load(Common::SeekableReadStream *s) { + if (s->pos() >= s->size()) + return false; + + _field0 = s->readUint32LE(); + _field4 = s->readUint32LE(); + _string8 = readStringFromStream(s); + _fieldC = s->readUint32LE(); + _string10 = readStringFromStream(s); + _string14 = readStringFromStream(s); + _string18 = readStringFromStream(s); + _string1C = readStringFromStream(s); + _field20 = s->readUint32LE(); + _string24 = readStringFromStream(s); + _field28 = s->readUint32LE(); + _field2C = s->readUint32LE(); + _field30 = s->readUint32LE(); + + return true; +} + +/*------------------------------------------------------------------------*/ + +void TTsentenceEntries::load(const CString &resName) { + TTsentenceEntry entry; + Common::SeekableReadStream *r = g_vm->_filesManager->getResource(resName); + + while (entry.load(r)) + push_back(entry); + + delete r; +} + +/*------------------------------------------------------------------------*/ + +TTscriptMapping::TTscriptMapping() : _id(0) { + Common::fill(&_values[0], &_values[8], 0); +} + +/*------------------------------------------------------------------------*/ + +void TTscriptMappings::load(const char *name, int valuesPerMapping) { + Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); + _valuesPerMapping = valuesPerMapping; + + while (r->pos() < r->size()) { + resize(size() + 1); + TTscriptMapping &m = (*this)[size() - 1]; + + m._id = r->readUint32LE(); + for (int idx = 0; idx < valuesPerMapping; ++idx) + m._values[idx] = r->readUint32LE(); + } + + delete r; +} + +/*------------------------------------------------------------------------*/ + +void TTtagMappings::load(const char *name) { + Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); + + while (r->pos() < r->size()) { + uint src = r->readUint32LE(); + uint dest = r->readUint32LE(); + + push_back(TTtagMapping(src, dest)); + } + + delete r; +} + +/*------------------------------------------------------------------------*/ + +void TTwordEntries::load(const char *name) { + Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); + + while (r->pos() < r->size()) { + TTwordEntry we; + we._id = r->readUint32LE(); + we._text = readStringFromStream(r); + + push_back(we); + } + + delete r; +} + +} // End of namespace Titanic diff --git a/engines/titanic/true_talk/script_support.h b/engines/titanic/true_talk/script_support.h new file mode 100644 index 0000000000..c87b553367 --- /dev/null +++ b/engines/titanic/true_talk/script_support.h @@ -0,0 +1,130 @@ +/* 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. + * + */ + +#ifndef TITANIC_SCRIPT_SUPPORT_H +#define TITANIC_SCRIPT_SUPPORT_H + +#include "titanic/support/simple_file.h" + +namespace Titanic { + +#define DIALS_ARRAY_COUNT 10 + +enum ScriptArrayFlag { SF_NONE = 0, SF_RANDOM = 1, SF_SEQUENTIAL = 2 }; + +struct TTnpcScriptResponse { + uint _tag; + uint _values[4]; + + /** + * Returns the size of the values list plus 1 + */ + int size() const; +}; + +struct TTscriptRange { + uint _id; + Common::Array _values; + TTscriptRange *_nextP; + uint _priorIndex; + ScriptArrayFlag _mode; + + TTscriptRange() : _id(0), _nextP(nullptr), + _priorIndex(0), _mode(SF_NONE) {} + TTscriptRange(uint id, const Common::Array &values, bool isRandom, + bool isSequential); +}; + + +struct TTsentenceEntry { + int _field0; + int _field4; + CString _string8; + int _fieldC; + CString _string10; + CString _string14; + CString _string18; + CString _string1C; + int _field20; + CString _string24; + int _field28; + int _field2C; + int _field30; + + TTsentenceEntry() : _field0(0), _field4(0), _fieldC(0), + _field20(0), _field28(0), _field2C(0), _field30(0) {} + + /** + * Load an entry from the passed stream, and returns true + * if an entry was successfully loaded + */ + bool load(Common::SeekableReadStream *s); +}; + +class TTsentenceEntries : public Common::Array { +public: + /** + * Load a list of entries from the specified resource + */ + void load(const CString &resName); +}; + +struct TTscriptMapping { + uint _id; + uint _values[8]; + + TTscriptMapping(); +}; + +class TTscriptMappings : public Common::Array { +public: + int _valuesPerMapping; + + void load(const char *name, int valuesPerMapping); +}; + +struct TTtagMapping { + uint _src, _dest; + TTtagMapping() : _src(0), _dest(0) {} + TTtagMapping(uint src, uint dest) : _src(src), _dest(dest) {} +}; + +class TTtagMappings : public Common::Array { +public: + void load(const char *name); +}; + +struct TTwordEntry { + uint _id; + CString _text; + + TTwordEntry() : _id(0) {} +}; + +class TTwordEntries : public Common::Array { +public: + void load(const char *name); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_TT_NPC_SCRIPT_H */ diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 7a2ab856d8..dde16d15ca 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -105,123 +105,6 @@ static const uint RANDOM9[] = { /*------------------------------------------------------------------------*/ -int TTnpcScriptResponse::size() const { - for (int idx = 0; idx < 4; ++idx) { - if (_values[idx] == 0) - return idx; - } - - return 4; -} - -/*------------------------------------------------------------------------*/ - -TTscriptRange::TTscriptRange(uint id, const Common::Array &values, - bool isRandom, bool isSequential) : - _id(id), _nextP(nullptr) { - _mode = SF_NONE; - if (isRandom) - _mode = SF_RANDOM; - if (isSequential) - _mode = SF_SEQUENTIAL; - - for (uint idx = 0; idx < values.size(); ++idx) - _values.push_back(values[idx]); -} - -/*------------------------------------------------------------------------*/ - - -bool TTsentenceEntry::load(Common::SeekableReadStream *s) { - if (s->pos() >= s->size()) - return false; - - _field0 = s->readUint32LE(); - _field4 = s->readUint32LE(); - _string8 = readStringFromStream(s); - _fieldC = s->readUint32LE(); - _string10 = readStringFromStream(s); - _string14 = readStringFromStream(s); - _string18 = readStringFromStream(s); - _string1C = readStringFromStream(s); - _field20 = s->readUint32LE(); - _string24 = readStringFromStream(s); - _field28 = s->readUint32LE(); - _field2C = s->readUint32LE(); - _field30 = s->readUint32LE(); - - return true; -} - -/*------------------------------------------------------------------------*/ - -void TTsentenceEntries::load(const CString &resName) { - TTsentenceEntry entry; - Common::SeekableReadStream *r = g_vm->_filesManager->getResource(resName); - - while (entry.load(r)) - push_back(entry); - - delete r; -} - -/*------------------------------------------------------------------------*/ - -TTscriptMapping::TTscriptMapping() : _id(0) { - Common::fill(&_values[0], &_values[8], 0); -} - -/*------------------------------------------------------------------------*/ - -void TTscriptMappings::load(const char *name, int valuesPerMapping) { - Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); - _valuesPerMapping = valuesPerMapping; - - while (r->pos() < r->size()) { - resize(size() + 1); - TTscriptMapping &m = (*this)[size() - 1]; - - m._id = r->readUint32LE(); - for (int idx = 0; idx < valuesPerMapping; ++idx) - m._values[idx] = r->readUint32LE(); - } - - delete r; -} - -/*------------------------------------------------------------------------*/ - -void TTtagMappings::load(const char *name) { - Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); - - while (r->pos() < r->size()) { - uint src = r->readUint32LE(); - uint dest = r->readUint32LE(); - - push_back(TTtagMapping(src, dest)); - } - - delete r; -} - -/*------------------------------------------------------------------------*/ - -void TTwordEntries::load(const char *name) { - Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); - - while (r->pos() < r->size()) { - TTwordEntry we; - we._id = r->readUint32LE(); - we._text = readStringFromStream(r); - - push_back(we); - } - - delete r; -} - -/*------------------------------------------------------------------------*/ - TTnpcScriptBase::TTnpcScriptBase(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTscriptBase(0, charClass, v2, charName, v3, v4, v5, v6, v7), diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 5b992f0675..111298ca27 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -25,112 +25,15 @@ #include "titanic/support/simple_file.h" #include "titanic/true_talk/tt_script_base.h" +#include "titanic/true_talk/script_support.h" namespace Titanic { #define DIALS_ARRAY_COUNT 10 -enum ScriptArrayFlag { SF_NONE = 0, SF_RANDOM = 1, SF_SEQUENTIAL = 2 }; - class CGameManager; class CPetControl; class TTroomScript; -class TTsentence; -struct TTsentenceEntry; - -struct TTnpcScriptResponse { - uint _tag; - uint _values[4]; - - /** - * Returns the size of the values list plus 1 - */ - int size() const; -}; - -struct TTscriptRange { - uint _id; - Common::Array _values; - TTscriptRange *_nextP; - uint _priorIndex; - ScriptArrayFlag _mode; - - TTscriptRange() : _id(0), _nextP(nullptr), - _priorIndex(0), _mode(SF_NONE) {} - TTscriptRange(uint id, const Common::Array &values, bool isRandom, - bool isSequential); -}; - - -struct TTsentenceEntry { - int _field0; - int _field4; - CString _string8; - int _fieldC; - CString _string10; - CString _string14; - CString _string18; - CString _string1C; - int _field20; - CString _string24; - int _field28; - int _field2C; - int _field30; - - TTsentenceEntry() : _field0(0), _field4(0), _fieldC(0), - _field20(0), _field28(0), _field2C(0), _field30(0) {} - - /** - * Load an entry from the passed stream, and returns true - * if an entry was successfully loaded - */ - bool load(Common::SeekableReadStream *s); -}; - -class TTsentenceEntries : public Common::Array { -public: - /** - * Load a list of entries from the specified resource - */ - void load(const CString &resName); -}; - -struct TTscriptMapping { - uint _id; - uint _values[8]; - - TTscriptMapping(); -}; - -class TTscriptMappings : public Common::Array { -public: - int _valuesPerMapping; - - void load(const char *name, int valuesPerMapping); -}; - -struct TTtagMapping { - uint _src, _dest; - TTtagMapping() : _src(0), _dest(0) {} - TTtagMapping(uint src, uint dest) : _src(src), _dest(dest) {} -}; - -class TTtagMappings : public Common::Array { -public: - void load(const char *name); -}; - -struct TTwordEntry { - uint _id; - CString _text; - - TTwordEntry() : _id(0) {} -}; - -class TTwordEntries : public Common::Array { -public: - void load(const char *name); -}; class TTnpcScriptBase : public TTscriptBase { protected: -- cgit v1.2.3 From ebeea1bb232845b5a863bc73edc2aafd56da36fc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 26 Jul 2016 22:27:47 -0400 Subject: TITANIC: Added remainder of BarbotScript handleQuote --- engines/titanic/true_talk/barbot_script.cpp | 123 +++++++++++++++++++++++++-- engines/titanic/true_talk/barbot_script.h | 9 +- engines/titanic/true_talk/bellbot_script.cpp | 4 +- engines/titanic/true_talk/bellbot_script.h | 4 +- engines/titanic/true_talk/deskbot_script.cpp | 4 +- engines/titanic/true_talk/deskbot_script.h | 4 +- engines/titanic/true_talk/doorbot_script.cpp | 4 +- engines/titanic/true_talk/doorbot_script.h | 4 +- engines/titanic/true_talk/liftbot_script.cpp | 4 +- engines/titanic/true_talk/liftbot_script.h | 4 +- engines/titanic/true_talk/maitred_script.cpp | 4 +- engines/titanic/true_talk/maitred_script.h | 4 +- engines/titanic/true_talk/script_support.h | 6 ++ engines/titanic/true_talk/tt_npc_script.cpp | 6 +- engines/titanic/true_talk/tt_npc_script.h | 4 +- 15 files changed, 156 insertions(+), 32 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index cbb58cdd1c..5c0c5fbe82 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -40,6 +40,55 @@ static const uint ARRAY2[] = { 51899, 51900, 51901, 51902, 51903, 51904, 51905, 51906, 51907, 0 }; +static const TThandleQuoteEntry QUOTES[] = { + { 0x00000008, 0x00000000, 0x0003D372 }, + { 0x00000007, 0x00000000, 0x0003D72B }, + { 0x00000004, 0x00000000, 0x0003D722 }, + { 0x00000006, 0x00000000, 0x0003D264 }, + { 0x00000005, 0x00000000, 0x0003D72F }, + { 0x00000001, 0x00000032, 0x00000001 }, + { 0x00000002, 0x00000032, 0x00000001 }, + { 0x00000003, 0x00000032, 0x00000001 }, + { 0x00000010, 0x54524156, 0x0003D2B1 }, + { 0x00000010, 0x0000003C, 0x00000000 }, + { 0x00000011, 0x00000000, 0x0003D484 }, + { 0x00000015, 0x00000032, 0x0003D2B2 }, + { 0x00000012, 0x00000042, 0x0003D499 }, + { 0x00000013, 0x00000021, 0x0003D31E }, + { 0x0000001D, 0x00000021, 0x0003D31E }, + { 0x00000014, 0x00000042, 0x0003D49E }, + { 0x00000016, 0x0000003C, 0x0003D2B6 }, + { 0x00000017, 0x00000028, 0x0003D2B5 }, + { 0x00000018, 0x00000000, 0x0003D35E }, + { 0x00000019, 0x00000000, 0x0003D35E }, + { 0x0000001A, 0x0000003C, 0x0003D38B }, + { 0x0000001B, 0x00000000, 0x0003D2F8 }, + { 0x00000009, 0x00000019, 0x0003D326 }, + { 0x0000000A, 0x00000019, 0x0003D314 }, + { 0x0000000B, 0x00000028, 0x0003D311 }, + { 0x0000001E, 0x00000000, 0x0003D6F2 }, + { 0x0000001F, 0x00000000, 0x0003D26C }, + { 0x0000000C, 0x00000000, 0x0003D2F4 }, + { 0x0000000D, 0x00000000, 0x0003D2F4 }, + { 0x0000000E, 0x00000000, 0x0003D2F4 }, + { 0x0000000F, 0x00000000, 0x0003D2F4 }, + { 0x00000020, 0x00000019, 0x0003D389 }, + { 0x00000021, 0x0000000F, 0x0003D29C }, + { 0x00000022, 0x0000000F, 0x0003D494 }, + { 0x0000001C, 0x00000032, 0x00000000 }, + { 0x00000023, 0x00000000, 0x0003D7F8 }, + { 0x00000024, 0x00000000, 0x0003D7F9 }, + { 0x00000031, 0x00000000, 0x0003D722 }, + { 0x00000032, 0x00000000, 0x0003D722 }, + { 0x00000033, 0x00000000, 0x0003D372 }, + { 0x00000034, 0x00000000, 0x0003D323 }, + { 0x0000003E, 0x00000000, 0x0003D163 }, + { 0x0000003F, 0x00000000, 0x0003D163 }, + { 0x00000040, 0x00000000, 0x0003D163 }, + { 0x00000041, 0x00000000, 0x0003D691 }, + { 0x00000000, 0x00000000, 0x00000000 } +}; + BarbotScript::BarbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { @@ -840,8 +889,8 @@ ScriptChangedResult BarbotScript::scriptChanged(TTscriptBase *roomScript, uint i return SCR_2; } -bool BarbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, - int val, uint tagId, uint remainder) const { +int BarbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, + uint val, uint tagId, uint remainder) { switch (tagId) { case MKTAG('A', 'D', 'V', 'T'): case MKTAG('A', 'R', 'T', 'I'): @@ -945,9 +994,64 @@ bool BarbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, default: break; } - - warning("TODO: handleQuote - %d", tagId); - return false; + + if (val == 36) { + switch (getValue(1)) { + case 1: + return setResponse(getDialogueId(220837), -1); + break; + case 2: + return setResponse(getDialogueId(220849), -1); + default: + return setResponse(getDialogueId(220858), -1); + } + } else if (val == 61 && getValue(1) > 2) { + return setResponse(getDialogueId(222301), -1); + } + + int loopCounter = 0; + for (const TThandleQuoteEntry *qe = QUOTES; qe->_index && loopCounter < 2; ++qe) { + if (!qe->_index) { + // End of list; start at beginning again + ++loopCounter; + qe = QUOTES; + } + + if (qe->_index == val && ( + (tagId == 0 && loopCounter == 2) || + (qe->_tagId < MKTAG('A', 'A', 'A', 'A')) || + (qe->_tagId == tagId) + )) { + uint foundTagId = qe->_tagId; + if (foundTagId > 0 && foundTagId < 100) { + if (!tagId) + foundTagId >>= 1; + if (getRandomNumber(100) < foundTagId) + return 1; + } + + uint dialogueId = qe->_dialogueId; + if (dialogueId < 1000) { + if (dialogueId >= 3) + error("Invalid dialogue index in BarbotScript"); + const int RANDOM_LIMITS[3] = { 30, 50, 70 }; + int rangeLimit = RANDOM_LIMITS[dialogueId]; + int dialRegion = getDialRegion(0); + + if (dialRegion != 1) { + rangeLimit = MAX(rangeLimit - 20, 20); + } + + dialogueId = (((int)remainder + 25) % 100) > rangeLimit ? 221376 : 221375; + } + + addResponse(getDialogueId(dialogueId)); + applyResponse(); + return 2; + } + } + + return 1; } int BarbotScript::proc21(int v1, int v2, int v3) { @@ -1152,4 +1256,13 @@ int BarbotScript::applySentenceIds(int dialogueId, int v34) { return -2; } +int BarbotScript::setResponse(int dialogueId, int state) { + addResponse(dialogueId); + applyResponse(); + + if (state != -1) + set34(state); + return 2; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index 90f4d951a6..977d0a1d6b 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -46,6 +46,11 @@ private: bool isState9() const; int applySentenceIds(int dialogueId, int v34 = -1); + + /** + * Add a response and optionally set the state + */ + int setResponse(int dialogueId, int state = -1); public: BarbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7); @@ -65,8 +70,8 @@ public: */ virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); - virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, - int val, uint tagId, uint remainder) const; + virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, + uint val, uint tagId, uint remainder); virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index ecb503cdc3..f4a0a3e824 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -70,8 +70,8 @@ int BellbotScript::proc15() const { return 0; } -bool BellbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, - int val, uint tagId, uint remainder) const { +int BellbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, + uint val, uint tagId, uint remainder) { switch (tagId) { case MKTAG('A', 'D', 'V', 'T'): case MKTAG('A', 'R', 'T', 'I'): diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index e990e322e5..704bce815e 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -55,8 +55,8 @@ public: virtual int proc15() const; - virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, - int val, uint tagId, uint remainder) const; + virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, + uint val, uint tagId, uint remainder); virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 28eff25374..a1d205514a 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -65,8 +65,8 @@ ScriptChangedResult DeskbotScript::scriptChanged(TTscriptBase *roomScript, uint return SCR_1; } -bool DeskbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, - int val, uint tagId, uint remainder) const { +int DeskbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, + uint val, uint tagId, uint remainder) { switch (tagId) { case MKTAG('A', 'D', 'V', 'T'): case MKTAG('A', 'R', 'T', 'I'): diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index 2cc8145684..efe71de7e2 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -53,8 +53,8 @@ public: */ virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); - virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, - int val, uint tagId, uint remainder) const; + virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, + uint val, uint tagId, uint remainder); virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 04530f1491..8ae19666aa 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -139,8 +139,8 @@ ScriptChangedResult DoorbotScript::scriptChanged(TTscriptBase *roomScript, uint return SCR_1; } -bool DoorbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, - int val, uint tagId, uint remainder) const { +int DoorbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, + uint val, uint tagId, uint remainder) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 3ec4cfb520..3d2fdfdc26 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -69,8 +69,8 @@ public: */ virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); - virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, - int val, uint tagId, uint remainder) const; + virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, + uint val, uint tagId, uint remainder); virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index c91bd73f1a..926d96f658 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -96,8 +96,8 @@ ScriptChangedResult LiftbotScript::scriptChanged(TTscriptBase *roomScript, uint return SCR_1; } -bool LiftbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, - int val, uint tagId, uint remainder) const { +int LiftbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, + uint val, uint tagId, uint remainder) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index 03c4eac8f9..ba917f41c2 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -66,8 +66,8 @@ public: */ virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); - virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, - int val, uint tagId, uint remainder) const; + virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, + uint val, uint tagId, uint remainder); virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index a59583c993..891c66167e 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -73,8 +73,8 @@ ScriptChangedResult MaitreDScript::scriptChanged(TTscriptBase *roomScript, uint return SCR_1; } -bool MaitreDScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, - int val, uint tagId, uint remainder) const { +int MaitreDScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, + uint val, uint tagId, uint remainder) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index 91732cddc1..178979c614 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -52,8 +52,8 @@ public: */ virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); - virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, - int val, uint tagId, uint remainder) const; + virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, + uint val, uint tagId, uint remainder); virtual int proc21(int v1, int v2, int v3); virtual int proc22(int id) const; diff --git a/engines/titanic/true_talk/script_support.h b/engines/titanic/true_talk/script_support.h index c87b553367..50576cab85 100644 --- a/engines/titanic/true_talk/script_support.h +++ b/engines/titanic/true_talk/script_support.h @@ -125,6 +125,12 @@ public: void load(const char *name); }; +struct TThandleQuoteEntry { + uint _index; + uint _tagId; + uint _dialogueId; +}; + } // End of namespace Titanic #endif /* TITANIC_TT_NPC_SCRIPT_H */ diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index dde16d15ca..3fc6d0aec1 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -266,9 +266,9 @@ bool TTnpcScript::handleWord(uint id) const { return true; } -bool TTnpcScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, - int val, uint tagId, uint remainder) const { - return true; +int TTnpcScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, + uint val, uint tagId, uint remainder) { + return 1; } uint TTnpcScript::getRangeValue(uint id) { diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 111298ca27..bd5b759480 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -240,8 +240,8 @@ public: */ virtual bool handleWord(uint id) const; - virtual bool handleQuote(TTroomScript *roomScript, TTsentence *sentence, - int val, uint tagId, uint remainder) const; + virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, + uint val, uint tagId, uint remainder); /** * Given an Id for a previously registered set of random number values, -- cgit v1.2.3 From 7eece359513890137358a27366d488bc629be47a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 26 Jul 2016 22:54:32 -0400 Subject: TITANIC: Added remainder of BellbotScript handleQuote --- engines/titanic/true_talk/barbot_script.cpp | 2 +- engines/titanic/true_talk/bellbot_script.cpp | 127 ++++++++++++++++++++++++++- 2 files changed, 126 insertions(+), 3 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index 5c0c5fbe82..a3ab0586b4 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -1042,7 +1042,7 @@ int BarbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, rangeLimit = MAX(rangeLimit - 20, 20); } - dialogueId = (((int)remainder + 25) % 100) > rangeLimit ? 221376 : 221375; + dialogueId = (((int)remainder + 25) % 100) >= rangeLimit ? 221376 : 221375; } addResponse(getDialogueId(dialogueId)); diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index f4a0a3e824..b91d78b057 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -27,6 +27,87 @@ namespace Titanic { +static const TThandleQuoteEntry QUOTES[] = { + { 0x00000008, 0x00000000, 0x00031116 }, + { 0x00000007, 0x00000000, 0x00031447 }, + { 0x00000006, 0x00000000, 0x000310F9 }, + { 0x00000005, 0x00000000, 0x000313A1 }, + { 0x00000001, 0x56424144, 0x000313D7 }, + { 0x00000001, 0x52554445, 0x000313D7 }, + { 0x00000001, 0x5052534E, 0x00041EB3 }, + { 0x00000001, 0x424F5953, 0x00041EB3 }, + { 0x00000001, 0x4749524C, 0x00041EB3 }, + { 0x00000001, 0x464F4F44, 0x00041EB3 }, + { 0x00000001, 0x00000032, 0x00041EB1 }, + { 0x0000001C, 0x00000032, 0x00041EB0 }, + { 0x00000010, 0x54524156, 0x000313C6 }, + { 0x00000010, 0x0000003C, 0x00041EB0 }, + { 0x00000011, 0x00000000, 0x0003139E }, + { 0x00000015, 0x00000032, 0x0003139F }, + { 0x00000012, 0x00000042, 0x000313A0 }, + { 0x00000013, 0x00000021, 0x000313A7 }, + { 0x0000001D, 0x00000021, 0x000313A7 }, + { 0x00000014, 0x00000042, 0x000313A4 }, + { 0x0000001B, 0x00000000, 0x0003139B }, + { 0x0000001E, 0x00000000, 0x000313A2 }, + { 0x0000001F, 0x00000000, 0x00030DC0 }, + { 0x0000000C, 0x00000000, 0x000313A9 }, + { 0x0000000D, 0x00000000, 0x000313A9 }, + { 0x0000000E, 0x00000000, 0x000313A8 }, + { 0x0000000F, 0x00000000, 0x000313A8 }, + { 0x00000020, 0x00000019, 0x000313AB }, + { 0x00000021, 0x0000000F, 0x000313AC }, + { 0x00000023, 0x00000000, 0x00031337 }, + { 0x00000024, 0x00000000, 0x0003135A }, + { 0x00000025, 0x00000000, 0x000311AB }, + { 0x00000026, 0x00000000, 0x0003112E }, + { 0x00000030, 0x00000000, 0x0003106C }, + { 0x00000027, 0x424F5953, 0x0003140C }, + { 0x00000027, 0x4749524C, 0x0003140D }, + { 0x00000027, 0x00000000, 0x0003140D }, + { 0x00000028, 0x00000000, 0x00031404 }, + { 0x00000029, 0x00000000, 0x00031405 }, + { 0x0000002A, 0x00000000, 0x00031406 }, + { 0x0000002B, 0x00000000, 0x00031407 }, + { 0x0000002C, 0x00000000, 0x00031408 }, + { 0x0000002D, 0x00000000, 0x00031409 }, + { 0x0000002E, 0x424F5953, 0x0003140A }, + { 0x0000002E, 0x4749524C, 0x0003140B }, + { 0x0000002E, 0x00000000, 0x0003140B }, + { 0x00000032, 0x00000000, 0x000313D6 }, + { 0x00000033, 0x00000000, 0x000313D7 }, + { 0x00000034, 0x00000000, 0x000313D8 }, + { 0x00000035, 0x00000000, 0x0003113D }, + { 0x00000036, 0x00000000, 0x00030DCB }, + { 0x00000031, 0x00000000, 0x00030DB5 }, + { 0x00000037, 0x00000000, 0x000313DD }, + { 0x00000038, 0x00000000, 0x00030EE4 }, + { 0x00000039, 0x00000000, 0x0003160B }, + { 0x0000003A, 0x00000000, 0x000310C4 }, + { 0x0000003B, 0x00000000, 0x000310C5 }, + { 0x0000003C, 0x00000000, 0x0003121C }, + { 0x0000003D, 0x00000000, 0x00031623 }, + { 0x0000003F, 0x00000000, 0x00030D99 }, + { 0x0000003E, 0x00000000, 0x00030D99 }, + { 0x00000040, 0x00000000, 0x000315CE }, + { 0x00000041, 0x00000000, 0x000315DC }, + { 0x00000042, 0x00000000, 0x00031478 }, + { 0x00000043, 0x00000000, 0x00030FC8 }, + { 0x00000044, 0x00000000, 0x0003106D }, + { 0x00000054, 0x00000000, 0x00031514 }, + { 0x00000055, 0x00000000, 0x00031515 }, + { 0x00000056, 0x00000000, 0x000315CF }, + { 0x0000005A, 0x00000000, 0x000310F9 }, + { 0x00000058, 0x00000000, 0x000315DF }, + { 0x0000005B, 0x00000000, 0x00031620 }, + { 0x0000005C, 0x00000000, 0x0003134B }, + { 0x00000059, 0x00000000, 0x0003150F }, + { 0x00000057, 0x00000000, 0x00030D58 }, + { 0x00000045, 0x0000000A, 0x000310C3 }, + { 0x00000046, 0x00000000, 0x00030EAD }, + { 0x00000000, 0x00000000, 0x00000000 } +}; + BellbotScript::BellbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2) : TTnpcScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0), @@ -178,8 +259,50 @@ int BellbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, break; } - warning("TODO: handleQuote"); - return false; + int loopCounter = 0; + for (const TThandleQuoteEntry *qe = QUOTES; qe->_index && loopCounter < 2; ++qe) { + if (!qe->_index) { + // End of list; start at beginning again + ++loopCounter; + qe = QUOTES; + } + + if (qe->_index == val && ( + (tagId == 0 && loopCounter == 2) || + (qe->_tagId < MKTAG('A', 'A', 'A', 'A')) || + (qe->_tagId == tagId) + )) { + uint foundTagId = qe->_tagId; + if (foundTagId > 0 && foundTagId < 100) { + if (!tagId) + foundTagId >>= 1; + if (getRandomNumber(100) < foundTagId) + return 1; + } + + uint dialogueId = qe->_dialogueId; + if (dialogueId >= 270000 && dialogueId <= 275000) { + dialogueId -= 270000; + if (dialogueId >= 3) + error("Invalid dialogue index in BarbotScript"); + const int RANDOM_LIMITS[3] = { 30, 50, 70 }; + int rangeLimit = RANDOM_LIMITS[dialogueId]; + int dialRegion = getDialRegion(0); + + if (dialRegion != 1) { + rangeLimit = MAX(rangeLimit - 20, 20); + } + + dialogueId = (((int)remainder + 25) % 100) >= rangeLimit ? 201687 : 201686; + } + + addResponse(getDialogueId(dialogueId)); + applyResponse(); + return 2; + } + } + + return 1; } int BellbotScript::proc21(int v1, int v2, int v3) { -- cgit v1.2.3 From a0441c83ec642db914b08895b0ddb400ae7bdbce Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 26 Jul 2016 23:12:20 -0400 Subject: TITANIC: Added remainder of DeskbotScript handleQuote --- engines/titanic/true_talk/deskbot_script.cpp | 124 ++++++++++++++++++++++++++- 1 file changed, 122 insertions(+), 2 deletions(-) diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index a1d205514a..8e92007402 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -26,6 +26,84 @@ namespace Titanic { +static const TThandleQuoteEntry QUOTES[] = { + { 0x00000008, 0x00000000, 0x0003ACD0 }, + { 0x00000007, 0x00000000, 0x0003ACDC }, + { 0x00000006, 0x00000000, 0x0003ABF9 }, + { 0x00000005, 0x00000000, 0x0003AD04 }, + { 0x00000001, 0x56424144, 0x0003AE27 }, + { 0x00000001, 0x52554445, 0x0003AE27 }, + { 0x00000001, 0x5052534E, 0x00041EB3 }, + { 0x00000001, 0x464F4F44, 0x00041EB3 }, + { 0x00000001, 0x00000032, 0x00041EB1 }, + { 0x00000002, 0x56424144, 0x0003AE27 }, + { 0x00000002, 0x52554445, 0x0003AE27 }, + { 0x00000002, 0x5052534E, 0x00041EB3 }, + { 0x00000002, 0x464F4F44, 0x00041EB3 }, + { 0x00000002, 0x00000032, 0x00041EB1 }, + { 0x00000003, 0x56424144, 0x0003AE0E }, + { 0x00000003, 0x52554445, 0x0003AE0E }, + { 0x00000003, 0x5052534E, 0x00041EB3 }, + { 0x00000003, 0x464F4F44, 0x00041EB3 }, + { 0x00000003, 0x00000032, 0x00041EB1 }, + { 0x00000010, 0x54524156, 0x0003ACFE }, + { 0x00000010, 0x0000003C, 0x00041EB0 }, + { 0x00000011, 0x00000000, 0x0003ABF9 }, + { 0x00000015, 0x00000032, 0x0003AC70 }, + { 0x00000012, 0x00000042, 0x0003AC7E }, + { 0x00000013, 0x00000021, 0x0003AC70 }, + { 0x0000001D, 0x00000021, 0x0003AC09 }, + { 0x00000014, 0x00000042, 0x0003AE07 }, + { 0x0000001B, 0x00000000, 0x00041EB2 }, + { 0x0000001E, 0x00000000, 0x0003ACC1 }, + { 0x0000001F, 0x00000000, 0x0003AC3E }, + { 0x0000000C, 0x00000000, 0x0003AE4C }, + { 0x0000000D, 0x00000000, 0x0003AE4C }, + { 0x0000000E, 0x00000000, 0x0003AE4B }, + { 0x0000000F, 0x00000000, 0x0003AE4B }, + { 0x00000020, 0x00000019, 0x0003AE24 }, + { 0x00000021, 0x0000000F, 0x0003AE10 }, + { 0x0000001C, 0x00000032, 0x00041EB0 }, + { 0x00000023, 0x00000000, 0x0003AC46 }, + { 0x00000024, 0x00000000, 0x0003AE1F }, + { 0x00000025, 0x00000000, 0x0003AE14 }, + { 0x00000026, 0x00000000, 0x0003AC7B }, + { 0x00000030, 0x00000000, 0x0003AE3D }, + { 0x00000027, 0x424F5953, 0x0003AE5D }, + { 0x00000027, 0x4749524C, 0x0003AE5E }, + { 0x00000027, 0x00000000, 0x0003AE5C }, + { 0x00000028, 0x00000000, 0x0003AE5B }, + { 0x00000029, 0x00000000, 0x0003AE58 }, + { 0x0000002A, 0x00000000, 0x0003AE59 }, + { 0x0000002B, 0x00000000, 0x0003AE5A }, + { 0x0000002C, 0x00000000, 0x0003AE57 }, + { 0x0000002D, 0x00000000, 0x0003AE5C }, + { 0x0000002E, 0x424F5953, 0x0003AE5A }, + { 0x0000002E, 0x4749524C, 0x0003AE5A }, + { 0x0000002E, 0x00000000, 0x0003AE5A }, + { 0x00000032, 0x00000000, 0x0003AE0E }, + { 0x00000033, 0x00000000, 0x0003AE27 }, + { 0x00000034, 0x00000000, 0x0003AE24 }, + { 0x00000035, 0x00000000, 0x0003AE3E }, + { 0x00000037, 0x00000000, 0x0003AE26 }, + { 0x00000038, 0x00000000, 0x0003AEC0 }, + { 0x00000039, 0x00000000, 0x0003AEC1 }, + { 0x0000003A, 0x00000000, 0x0003AC7F }, + { 0x0000003B, 0x00000000, 0x0003ADD5 }, + { 0x0000003C, 0x00000000, 0x0003AEC5 }, + { 0x0000003D, 0x00000000, 0x0003AEC9 }, + { 0x0000003F, 0x00000000, 0x0003ABC5 }, + { 0x0000003E, 0x00000000, 0x0003ABC5 }, + { 0x00000040, 0x00000000, 0x0003AFB0 }, + { 0x00000041, 0x00000000, 0x0003AFDC }, + { 0x00000042, 0x00000000, 0x0003AFB5 }, + { 0x00000043, 0x00000000, 0x0003AFDD }, + { 0x00000044, 0x00000000, 0x0003AFDD }, + { 0x00000045, 0x0000000A, 0x0003AC7E }, + { 0x00000046, 0x00000000, 0x0003AF6E }, + { 0x00000000, 0x00000000, 0x00000000 } +}; + DeskbotScript::DeskbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2) : TTnpcScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0) { @@ -175,8 +253,50 @@ int DeskbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, break; } - warning("TODO"); - return 0; + int loopCounter = 0; + for (const TThandleQuoteEntry *qe = QUOTES; qe->_index && loopCounter < 2; ++qe) { + if (!qe->_index) { + // End of list; start at beginning again + ++loopCounter; + qe = QUOTES; + } + + if (qe->_index == val && ( + (tagId == 0 && loopCounter == 2) || + (qe->_tagId < MKTAG('A', 'A', 'A', 'A')) || + (qe->_tagId == tagId) + )) { + uint foundTagId = qe->_tagId; + if (foundTagId > 0 && foundTagId < 100) { + if (!tagId) + foundTagId >>= 1; + if (getRandomNumber(100) < foundTagId) + return 1; + } + + uint dialogueId = qe->_dialogueId; + if (dialogueId >= 270000 && dialogueId <= 275000) { + dialogueId -= 270000; + if (dialogueId >= 3) + error("Invalid dialogue index in BarbotScript"); + const int RANDOM_LIMITS[3] = { 30, 50, 70 }; + int rangeLimit = RANDOM_LIMITS[dialogueId]; + int dialRegion = getDialRegion(0); + + if (dialRegion != 1) { + rangeLimit = MAX(rangeLimit - 20, 20); + } + + dialogueId = (((int)remainder + 25) % 100) >= rangeLimit ? 241191 : 241166; + } + + addResponse(getDialogueId(dialogueId)); + applyResponse(); + return 2; + } + } + + return 1; } int DeskbotScript::proc21(int v1, int v2, int v3) { -- cgit v1.2.3 From 95529c6a6ea17b88da2f0d3f93e3cfdae6cac5e8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 27 Jul 2016 06:42:40 -0400 Subject: DEVTOOLS: Added handleQuote methods arrays to create_titanic --- devtools/create_titanic/create_titanic_dat.cpp | 4 +- devtools/create_titanic/script_quotes.cpp | 457 +++++++++++++++++++++++++ devtools/create_titanic/script_quotes.h | 38 ++ 3 files changed, 498 insertions(+), 1 deletion(-) create mode 100644 devtools/create_titanic/script_quotes.cpp create mode 100644 devtools/create_titanic/script_quotes.h diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index 1ddfd46fd3..c202e75fcf 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -36,6 +36,7 @@ #include "common/rect.h" #include "winexe_pe.h" #include "file.h" +#include "script_quotes.h" #include "script_responses.h" #include "script_ranges.h" #include "tag_maps.h" @@ -52,7 +53,7 @@ */ #define VERSION_NUMBER 1 -#define HEADER_SIZE 0x740 +#define HEADER_SIZE 0x800 Common::File inputFile, outputFile; Common::PEResources res; @@ -584,6 +585,7 @@ void writeData() { writeResponseTree(); writeNumbers(); + writeAllScriptQuotes(); writeAllScriptResponses(); writeAllScriptRanges(); writeAllTagMappings(); diff --git a/devtools/create_titanic/script_quotes.cpp b/devtools/create_titanic/script_quotes.cpp new file mode 100644 index 0000000000..7e4838c338 --- /dev/null +++ b/devtools/create_titanic/script_quotes.cpp @@ -0,0 +1,457 @@ +/* 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. + * + */ + + // Disable symbol overrides so that we can use system headers. +#define FORBIDDEN_SYMBOL_ALLOW_ALL + +// HACK to allow building with the SDL backend on MinGW +// see bug #1800764 "TOOLS: MinGW tools building broken" +#ifdef main +#undef main +#endif // main + +#include "file.h" +#include "script_quotes.h" + +static const ScriptQuote BARBOT_QUOTES[] = { + { 0x00000008, 0x00000000, 0x0003D372 }, + { 0x00000007, 0x00000000, 0x0003D72B }, + { 0x00000004, 0x00000000, 0x0003D722 }, + { 0x00000006, 0x00000000, 0x0003D264 }, + { 0x00000005, 0x00000000, 0x0003D72F }, + { 0x00000001, 0x00000032, 0x00000001 }, + { 0x00000002, 0x00000032, 0x00000001 }, + { 0x00000003, 0x00000032, 0x00000001 }, + { 0x00000010, 0x54524156, 0x0003D2B1 }, + { 0x00000010, 0x0000003C, 0x00000000 }, + { 0x00000011, 0x00000000, 0x0003D484 }, + { 0x00000015, 0x00000032, 0x0003D2B2 }, + { 0x00000012, 0x00000042, 0x0003D499 }, + { 0x00000013, 0x00000021, 0x0003D31E }, + { 0x0000001D, 0x00000021, 0x0003D31E }, + { 0x00000014, 0x00000042, 0x0003D49E }, + { 0x00000016, 0x0000003C, 0x0003D2B6 }, + { 0x00000017, 0x00000028, 0x0003D2B5 }, + { 0x00000018, 0x00000000, 0x0003D35E }, + { 0x00000019, 0x00000000, 0x0003D35E }, + { 0x0000001A, 0x0000003C, 0x0003D38B }, + { 0x0000001B, 0x00000000, 0x0003D2F8 }, + { 0x00000009, 0x00000019, 0x0003D326 }, + { 0x0000000A, 0x00000019, 0x0003D314 }, + { 0x0000000B, 0x00000028, 0x0003D311 }, + { 0x0000001E, 0x00000000, 0x0003D6F2 }, + { 0x0000001F, 0x00000000, 0x0003D26C }, + { 0x0000000C, 0x00000000, 0x0003D2F4 }, + { 0x0000000D, 0x00000000, 0x0003D2F4 }, + { 0x0000000E, 0x00000000, 0x0003D2F4 }, + { 0x0000000F, 0x00000000, 0x0003D2F4 }, + { 0x00000020, 0x00000019, 0x0003D389 }, + { 0x00000021, 0x0000000F, 0x0003D29C }, + { 0x00000022, 0x0000000F, 0x0003D494 }, + { 0x0000001C, 0x00000032, 0x00000000 }, + { 0x00000023, 0x00000000, 0x0003D7F8 }, + { 0x00000024, 0x00000000, 0x0003D7F9 }, + { 0x00000031, 0x00000000, 0x0003D722 }, + { 0x00000032, 0x00000000, 0x0003D722 }, + { 0x00000033, 0x00000000, 0x0003D372 }, + { 0x00000034, 0x00000000, 0x0003D323 }, + { 0x0000003E, 0x00000000, 0x0003D163 }, + { 0x0000003F, 0x00000000, 0x0003D163 }, + { 0x00000040, 0x00000000, 0x0003D163 }, + { 0x00000041, 0x00000000, 0x0003D691 }, + { 0x00000000, 0x00000000, 0x00000000 } +}; + +static const ScriptQuote BELLBOT_QUOTES[] = { + { 0x00000008, 0x00000000, 0x00031116 }, + { 0x00000007, 0x00000000, 0x00031447 }, + { 0x00000006, 0x00000000, 0x000310F9 }, + { 0x00000005, 0x00000000, 0x000313A1 }, + { 0x00000001, 0x56424144, 0x000313D7 }, + { 0x00000001, 0x52554445, 0x000313D7 }, + { 0x00000001, 0x5052534E, 0x00041EB3 }, + { 0x00000001, 0x424F5953, 0x00041EB3 }, + { 0x00000001, 0x4749524C, 0x00041EB3 }, + { 0x00000001, 0x464F4F44, 0x00041EB3 }, + { 0x00000001, 0x00000032, 0x00041EB1 }, + { 0x0000001C, 0x00000032, 0x00041EB0 }, + { 0x00000010, 0x54524156, 0x000313C6 }, + { 0x00000010, 0x0000003C, 0x00041EB0 }, + { 0x00000011, 0x00000000, 0x0003139E }, + { 0x00000015, 0x00000032, 0x0003139F }, + { 0x00000012, 0x00000042, 0x000313A0 }, + { 0x00000013, 0x00000021, 0x000313A7 }, + { 0x0000001D, 0x00000021, 0x000313A7 }, + { 0x00000014, 0x00000042, 0x000313A4 }, + { 0x0000001B, 0x00000000, 0x0003139B }, + { 0x0000001E, 0x00000000, 0x000313A2 }, + { 0x0000001F, 0x00000000, 0x00030DC0 }, + { 0x0000000C, 0x00000000, 0x000313A9 }, + { 0x0000000D, 0x00000000, 0x000313A9 }, + { 0x0000000E, 0x00000000, 0x000313A8 }, + { 0x0000000F, 0x00000000, 0x000313A8 }, + { 0x00000020, 0x00000019, 0x000313AB }, + { 0x00000021, 0x0000000F, 0x000313AC }, + { 0x00000023, 0x00000000, 0x00031337 }, + { 0x00000024, 0x00000000, 0x0003135A }, + { 0x00000025, 0x00000000, 0x000311AB }, + { 0x00000026, 0x00000000, 0x0003112E }, + { 0x00000030, 0x00000000, 0x0003106C }, + { 0x00000027, 0x424F5953, 0x0003140C }, + { 0x00000027, 0x4749524C, 0x0003140D }, + { 0x00000027, 0x00000000, 0x0003140D }, + { 0x00000028, 0x00000000, 0x00031404 }, + { 0x00000029, 0x00000000, 0x00031405 }, + { 0x0000002A, 0x00000000, 0x00031406 }, + { 0x0000002B, 0x00000000, 0x00031407 }, + { 0x0000002C, 0x00000000, 0x00031408 }, + { 0x0000002D, 0x00000000, 0x00031409 }, + { 0x0000002E, 0x424F5953, 0x0003140A }, + { 0x0000002E, 0x4749524C, 0x0003140B }, + { 0x0000002E, 0x00000000, 0x0003140B }, + { 0x00000032, 0x00000000, 0x000313D6 }, + { 0x00000033, 0x00000000, 0x000313D7 }, + { 0x00000034, 0x00000000, 0x000313D8 }, + { 0x00000035, 0x00000000, 0x0003113D }, + { 0x00000036, 0x00000000, 0x00030DCB }, + { 0x00000031, 0x00000000, 0x00030DB5 }, + { 0x00000037, 0x00000000, 0x000313DD }, + { 0x00000038, 0x00000000, 0x00030EE4 }, + { 0x00000039, 0x00000000, 0x0003160B }, + { 0x0000003A, 0x00000000, 0x000310C4 }, + { 0x0000003B, 0x00000000, 0x000310C5 }, + { 0x0000003C, 0x00000000, 0x0003121C }, + { 0x0000003D, 0x00000000, 0x00031623 }, + { 0x0000003F, 0x00000000, 0x00030D99 }, + { 0x0000003E, 0x00000000, 0x00030D99 }, + { 0x00000040, 0x00000000, 0x000315CE }, + { 0x00000041, 0x00000000, 0x000315DC }, + { 0x00000042, 0x00000000, 0x00031478 }, + { 0x00000043, 0x00000000, 0x00030FC8 }, + { 0x00000044, 0x00000000, 0x0003106D }, + { 0x00000054, 0x00000000, 0x00031514 }, + { 0x00000055, 0x00000000, 0x00031515 }, + { 0x00000056, 0x00000000, 0x000315CF }, + { 0x0000005A, 0x00000000, 0x000310F9 }, + { 0x00000058, 0x00000000, 0x000315DF }, + { 0x0000005B, 0x00000000, 0x00031620 }, + { 0x0000005C, 0x00000000, 0x0003134B }, + { 0x00000059, 0x00000000, 0x0003150F }, + { 0x00000057, 0x00000000, 0x00030D58 }, + { 0x00000045, 0x0000000A, 0x000310C3 }, + { 0x00000046, 0x00000000, 0x00030EAD }, + { 0x00000000, 0x00000000, 0x00000000 } +}; + +static const ScriptQuote DESKBOT_QUOTES[] = { + { 0x00000008, 0x00000000, 0x0003ACD0 }, + { 0x00000007, 0x00000000, 0x0003ACDC }, + { 0x00000006, 0x00000000, 0x0003ABF9 }, + { 0x00000005, 0x00000000, 0x0003AD04 }, + { 0x00000001, 0x56424144, 0x0003AE27 }, + { 0x00000001, 0x52554445, 0x0003AE27 }, + { 0x00000001, 0x5052534E, 0x00041EB3 }, + { 0x00000001, 0x464F4F44, 0x00041EB3 }, + { 0x00000001, 0x00000032, 0x00041EB1 }, + { 0x00000002, 0x56424144, 0x0003AE27 }, + { 0x00000002, 0x52554445, 0x0003AE27 }, + { 0x00000002, 0x5052534E, 0x00041EB3 }, + { 0x00000002, 0x464F4F44, 0x00041EB3 }, + { 0x00000002, 0x00000032, 0x00041EB1 }, + { 0x00000003, 0x56424144, 0x0003AE0E }, + { 0x00000003, 0x52554445, 0x0003AE0E }, + { 0x00000003, 0x5052534E, 0x00041EB3 }, + { 0x00000003, 0x464F4F44, 0x00041EB3 }, + { 0x00000003, 0x00000032, 0x00041EB1 }, + { 0x00000010, 0x54524156, 0x0003ACFE }, + { 0x00000010, 0x0000003C, 0x00041EB0 }, + { 0x00000011, 0x00000000, 0x0003ABF9 }, + { 0x00000015, 0x00000032, 0x0003AC70 }, + { 0x00000012, 0x00000042, 0x0003AC7E }, + { 0x00000013, 0x00000021, 0x0003AC70 }, + { 0x0000001D, 0x00000021, 0x0003AC09 }, + { 0x00000014, 0x00000042, 0x0003AE07 }, + { 0x0000001B, 0x00000000, 0x00041EB2 }, + { 0x0000001E, 0x00000000, 0x0003ACC1 }, + { 0x0000001F, 0x00000000, 0x0003AC3E }, + { 0x0000000C, 0x00000000, 0x0003AE4C }, + { 0x0000000D, 0x00000000, 0x0003AE4C }, + { 0x0000000E, 0x00000000, 0x0003AE4B }, + { 0x0000000F, 0x00000000, 0x0003AE4B }, + { 0x00000020, 0x00000019, 0x0003AE24 }, + { 0x00000021, 0x0000000F, 0x0003AE10 }, + { 0x0000001C, 0x00000032, 0x00041EB0 }, + { 0x00000023, 0x00000000, 0x0003AC46 }, + { 0x00000024, 0x00000000, 0x0003AE1F }, + { 0x00000025, 0x00000000, 0x0003AE14 }, + { 0x00000026, 0x00000000, 0x0003AC7B }, + { 0x00000030, 0x00000000, 0x0003AE3D }, + { 0x00000027, 0x424F5953, 0x0003AE5D }, + { 0x00000027, 0x4749524C, 0x0003AE5E }, + { 0x00000027, 0x00000000, 0x0003AE5C }, + { 0x00000028, 0x00000000, 0x0003AE5B }, + { 0x00000029, 0x00000000, 0x0003AE58 }, + { 0x0000002A, 0x00000000, 0x0003AE59 }, + { 0x0000002B, 0x00000000, 0x0003AE5A }, + { 0x0000002C, 0x00000000, 0x0003AE57 }, + { 0x0000002D, 0x00000000, 0x0003AE5C }, + { 0x0000002E, 0x424F5953, 0x0003AE5A }, + { 0x0000002E, 0x4749524C, 0x0003AE5A }, + { 0x0000002E, 0x00000000, 0x0003AE5A }, + { 0x00000032, 0x00000000, 0x0003AE0E }, + { 0x00000033, 0x00000000, 0x0003AE27 }, + { 0x00000034, 0x00000000, 0x0003AE24 }, + { 0x00000035, 0x00000000, 0x0003AE3E }, + { 0x00000037, 0x00000000, 0x0003AE26 }, + { 0x00000038, 0x00000000, 0x0003AEC0 }, + { 0x00000039, 0x00000000, 0x0003AEC1 }, + { 0x0000003A, 0x00000000, 0x0003AC7F }, + { 0x0000003B, 0x00000000, 0x0003ADD5 }, + { 0x0000003C, 0x00000000, 0x0003AEC5 }, + { 0x0000003D, 0x00000000, 0x0003AEC9 }, + { 0x0000003F, 0x00000000, 0x0003ABC5 }, + { 0x0000003E, 0x00000000, 0x0003ABC5 }, + { 0x00000040, 0x00000000, 0x0003AFB0 }, + { 0x00000041, 0x00000000, 0x0003AFDC }, + { 0x00000042, 0x00000000, 0x0003AFB5 }, + { 0x00000043, 0x00000000, 0x0003AFDD }, + { 0x00000044, 0x00000000, 0x0003AFDD }, + { 0x00000045, 0x0000000A, 0x0003AC7E }, + { 0x00000046, 0x00000000, 0x0003AF6E }, + { 0x00000000, 0x00000000, 0x00000000 } +}; + +static const ScriptQuote DOORBOT_QUOTES[] = { + { 0x00000008, 0x00000000, 0x00035F14 }, + { 0x00000007, 0x00000000, 0x00035F6F }, + { 0x00000004, 0x00000000, 0x000360BF }, + { 0x00000006, 0x00000000, 0x000360AF }, + { 0x00000005, 0x00000000, 0x000360BC }, + { 0x00000001, 0x56424144, 0x000360C0 }, + { 0x00000001, 0x52554445, 0x000360C0 }, + { 0x00000001, 0x5052534E, 0x00000003 }, + { 0x00000001, 0x464F4F44, 0x00000003 }, + { 0x00000001, 0x00000032, 0x00000001 }, + { 0x00000002, 0x56424144, 0x000360C0 }, + { 0x00000002, 0x52554445, 0x000360C0 }, + { 0x00000002, 0x5052534E, 0x00000003 }, + { 0x00000002, 0x464F4F44, 0x00000003 }, + { 0x00000002, 0x00000032, 0x00000001 }, + { 0x00000003, 0x56424144, 0x000360C0 }, + { 0x00000003, 0x52554445, 0x000360C0 }, + { 0x00000003, 0x5052534E, 0x00000003 }, + { 0x00000003, 0x464F4F44, 0x00000003 }, + { 0x00000003, 0x00000032, 0x00000001 }, + { 0x00000010, 0x54524156, 0x00035F6A }, + { 0x00000010, 0x0000003C, 0x00000000 }, + { 0x00000011, 0x00000000, 0x0003604F }, + { 0x00000015, 0x00000032, 0x00036046 }, + { 0x00000012, 0x00000042, 0x00036057 }, + { 0x00000013, 0x00000021, 0x00035FC8 }, + { 0x0000001D, 0x00000021, 0x00035FC8 }, + { 0x00000014, 0x00000042, 0x00036059 }, + { 0x00000016, 0x0000003C, 0x00035F6E }, + { 0x00000017, 0x00000028, 0x00035F6D }, + { 0x00000018, 0x00000000, 0x00035F68 }, + { 0x00000019, 0x00000000, 0x00035F68 }, + { 0x0000001A, 0x0000003C, 0x00035F67 }, + { 0x0000001B, 0x00000000, 0x00035FA0 }, + { 0x00000009, 0x00000019, 0x00035FD3 }, + { 0x0000000A, 0x00000019, 0x00036051 }, + { 0x0000000B, 0x00000028, 0x00035FC4 }, + { 0x0000001E, 0x00000000, 0x00035F5C }, + { 0x0000001F, 0x00000000, 0x00035F5C }, + { 0x0000000C, 0x00000000, 0x00035F9D }, + { 0x0000000D, 0x00000000, 0x00035F9D }, + { 0x0000000E, 0x00000000, 0x00035F9C }, + { 0x0000000F, 0x00000000, 0x00035F9C }, + { 0x00000020, 0x00000019, 0x00035FFF }, + { 0x00000021, 0x0000000F, 0x00035F59 }, + { 0x00000022, 0x0000000F, 0x00036055 }, + { 0x0000001C, 0x00000032, 0x00000000 }, + { 0x00000023, 0x00000000, 0x000360C3 }, + { 0x00000024, 0x00000000, 0x00035F5B }, + { 0x00000025, 0x00000000, 0x00035EFE }, + { 0x00000026, 0x00000000, 0x00035F03 }, + { 0x0000002C, 0x00000000, 0x000360C0 }, + { 0x0000002D, 0x00000000, 0x000360C0 }, + { 0x00000030, 0x00000000, 0x00035F42 }, + { 0x00000031, 0x00000000, 0x000360BF }, + { 0x00000032, 0x00000000, 0x000360BF }, + { 0x00000033, 0x00000000, 0x000360C0 }, + { 0x00000034, 0x00000000, 0x00035FC9 }, + { 0x00000035, 0x00000000, 0x00035E8B }, + { 0x00000036, 0x00000000, 0x00035DFA }, + { 0x00000037, 0x00000000, 0x000363AB }, + { 0x00000038, 0x00000000, 0x00035F0F }, + { 0x0000003C, 0x00000000, 0x00036379 }, + { 0x0000003E, 0x00000000, 0x00036262 }, + { 0x0000003F, 0x00000000, 0x00036262 }, + { 0x00000040, 0x00000000, 0x00036271 }, + { 0x00000041, 0x00000000, 0x0003626C }, + { 0x00000042, 0x00000000, 0x0003625D }, + { 0x00000043, 0x00000000, 0x0003649B }, + { 0x00000044, 0x00000000, 0x0003649B }, + { 0x00000046, 0x00000000, 0x00036035 }, + { 0x00000000, 0x00000000, 0x00000000 } +}; + +static const ScriptQuote LIFTBOT_QUOTES[] = { + { 0x00000008, 0x00000000, 0x00033655 }, + { 0x00000007, 0x00000000, 0x000335A0 }, + { 0x00000006, 0x00000000, 0x0003368B }, + { 0x00000005, 0x00000028, 0x00033693 }, + { 0x00000001, 0x56424144, 0x00033695 }, + { 0x00000001, 0x52554445, 0x00033695 }, + { 0x00000001, 0x5052534E, 0x00000003 }, + { 0x00000001, 0x464F4F44, 0x00000003 }, + { 0x00000001, 0x00000032, 0x00000001 }, + { 0x00000002, 0x56424144, 0x00033695 }, + { 0x00000002, 0x52554445, 0x00033695 }, + { 0x00000002, 0x5052534E, 0x00000003 }, + { 0x00000002, 0x464F4F44, 0x00000003 }, + { 0x00000002, 0x00000032, 0x00000001 }, + { 0x00000003, 0x56424144, 0x00033695 }, + { 0x00000003, 0x52554445, 0x00033695 }, + { 0x00000003, 0x5052534E, 0x00000003 }, + { 0x00000003, 0x464F4F44, 0x00000003 }, + { 0x00000003, 0x00000032, 0x00000001 }, + { 0x00000010, 0x54524156, 0x000335A4 }, + { 0x00000010, 0x0000003C, 0x00000000 }, + { 0x00000011, 0x00000000, 0x0003367B }, + { 0x00000015, 0x00000032, 0x000335A1 }, + { 0x00000012, 0x00000042, 0x00033672 }, + { 0x00000013, 0x00000021, 0x00033679 }, + { 0x0000001D, 0x00000021, 0x00033679 }, + { 0x00000014, 0x00000042, 0x00033688 }, + { 0x00000016, 0x0000003C, 0x000335A4 }, + { 0x00000017, 0x00000028, 0x00033689 }, + { 0x00000018, 0x00000000, 0x00033670 }, + { 0x00000019, 0x00000000, 0x000335A0 }, + { 0x0000001A, 0x0000003C, 0x0003368F }, + { 0x0000001B, 0x00000000, 0x00033695 }, + { 0x00000009, 0x00000019, 0x000335A2 }, + { 0x0000000A, 0x00000019, 0x000335A6 }, + { 0x0000000B, 0x00000028, 0x00033668 }, + { 0x0000001E, 0x00000000, 0x00033691 }, + { 0x0000001F, 0x00000000, 0x00033691 }, + { 0x0000000C, 0x00000014, 0x00033666 }, + { 0x0000000D, 0x00000014, 0x00033666 }, + { 0x0000000E, 0x00000014, 0x0003367A }, + { 0x0000000F, 0x00000014, 0x0003367A }, + { 0x00000020, 0x00000019, 0x0003367C }, + { 0x00000021, 0x0000000F, 0x00033690 }, + { 0x00000022, 0x0000000F, 0x00033682 }, + { 0x0000001C, 0x00000032, 0x00000000 }, + { 0x00000023, 0x00000000, 0x00033698 }, + { 0x00000024, 0x00000000, 0x00033699 }, + { 0x00000031, 0x00000000, 0x00033694 }, + { 0x00000032, 0x00000000, 0x00033694 }, + { 0x00000033, 0x00000000, 0x00033695 }, + { 0x00000034, 0x00000000, 0x0003369F }, + { 0x00000035, 0x00000000, 0x000336A0 }, + { 0x00000036, 0x00000000, 0x00033585 }, + { 0x0000003E, 0x00000000, 0x0003380D }, + { 0x0000003F, 0x00000000, 0x0003380D }, + { 0x00000040, 0x00000000, 0x0003380D }, + { 0x00000041, 0x00000000, 0x000337E7 }, + { 0x00000042, 0x00000000, 0x00033711 }, + { 0x00000000, 0x00000000, 0x00000000 } +}; + +static const ScriptQuote MAITRED_QUOTES[] = { + { 0x00000008, 0x00000000, 0x0003F967 }, + { 0x00000007, 0x00000000, 0x0003F995 }, + { 0x00000006, 0x00000000, 0x0003F833 }, + { 0x00000005, 0x00000000, 0x0003F95B }, + { 0x00000001, 0x56424144, 0x0003F847 }, + { 0x00000001, 0x52554445, 0x0003F847 }, + { 0x00000001, 0x5052534E, 0x00041EB3 }, + { 0x00000001, 0x464F4F44, 0x0003FB88 }, + { 0x00000001, 0x00000032, 0x00041EB1 }, + { 0x00000010, 0x54524156, 0x0003F9FA }, + { 0x00000010, 0x0000003C, 0x00041EB0 }, + { 0x00000011, 0x00000000, 0x0003F967 }, + { 0x00000015, 0x00000032, 0x0003F83D }, + { 0x00000012, 0x00000042, 0x0003F83D }, + { 0x00000013, 0x00000021, 0x0003F95B }, + { 0x0000001D, 0x00000021, 0x0003F971 }, + { 0x00000014, 0x00000042, 0x0003F96C }, + { 0x0000001B, 0x00000000, 0x0003F95B }, + { 0x0000001E, 0x00000000, 0x0003FA3C }, + { 0x0000001F, 0x00000000, 0x0003F991 }, + { 0x0000000C, 0x00000000, 0x0003F9C9 }, + { 0x0000000D, 0x00000000, 0x0003F9C9 }, + { 0x0000000E, 0x00000000, 0x0003F9C9 }, + { 0x0000000F, 0x00000000, 0x0003F9C9 }, + { 0x00000020, 0x00000019, 0x0003F847 }, + { 0x00000021, 0x0000000F, 0x0003FA22 }, + { 0x00000037, 0x00000000, 0x0003FA9C }, + { 0x0000003C, 0x00000000, 0x0003FAA0 }, + { 0x00000047, 0x00000000, 0x0003FAA1 }, + { 0x0000003F, 0x00000000, 0x0003FABD }, + { 0x0000003E, 0x00000000, 0x0003FABD }, + { 0x00000040, 0x00000000, 0x0003FABB }, + { 0x00000041, 0x00000000, 0x0003FABB }, + { 0x00000042, 0x00000000, 0x0003FABC }, + { 0x00000048, 0x00000000, 0x0003FB45 }, + { 0x00000049, 0x00000000, 0x0003FB48 }, + { 0x0000004A, 0x00000000, 0x0003FB52 }, + { 0x0000004B, 0x00000000, 0x0003FB4A }, + { 0x0000004C, 0x00000000, 0x0003FB47 }, + { 0x0000004D, 0x00000000, 0x0003FB49 }, + { 0x0000004E, 0x00000000, 0x0003FB53 }, + { 0x0000004F, 0x00000000, 0x0003FB4C }, + { 0x00000050, 0x00000000, 0x0003FB4E }, + { 0x00000051, 0x00000000, 0x0003FB50 }, + { 0x00000052, 0x00000000, 0x0003FB75 }, + { 0x00000053, 0x00000000, 0x0003F9A8 }, + { 0x00000000, 0x00000000, 0x00000000 } +}; + +void writeScriptQuotes(const char *name, const ScriptQuote *quotes, + uint tag1, uint tag2, uint rangeStart, uint rangeEnd) { + outputFile.seek(dataOffset); + outputFile.writeLong(tag1); + outputFile.writeLong(tag2); + outputFile.writeLong(rangeStart); + outputFile.writeLong(rangeEnd); + + for (; quotes->_index; ++quotes) { + outputFile.writeLong(quotes->_index); + outputFile.writeLong(quotes->_tagId); + outputFile.writeLong(quotes->_dialogueId); + } + + uint size = outputFile.size() - dataOffset; + writeEntryHeader(name, dataOffset, size); + dataOffset += size; +} + +void writeAllScriptQuotes() { + writeScriptQuotes("Quotes/Barbot", BARBOT_QUOTES, 221376, 221375, 0, 999); + writeScriptQuotes("Quotes/Bellbot", BELLBOT_QUOTES, 201687, 201686, 270000, 270500); + writeScriptQuotes("Quotes/Deskbot", DESKBOT_QUOTES, 241191, 241166, 270000, 270500); + writeScriptQuotes("Quotes/Doorbot", DOORBOT_QUOTES, 221376, 221375, 0, 999); + writeScriptQuotes("Quotes/Liftbot", LIFTBOT_QUOTES, 210581, 210580, 0, 999); + writeScriptQuotes("Quotes/MaitreD", MAITRED_QUOTES, 260167, 260147, 270000, 270500); +} \ No newline at end of file diff --git a/devtools/create_titanic/script_quotes.h b/devtools/create_titanic/script_quotes.h new file mode 100644 index 0000000000..5b4f25c3c8 --- /dev/null +++ b/devtools/create_titanic/script_quotes.h @@ -0,0 +1,38 @@ +/* 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. + * + */ + +#ifndef COMMON_SCRIPT_QUOTES_H +#define COMMON_SCRIPT_QUOTES_H + +#include "common/scummsys.h" + +struct ScriptQuote { + uint _index; + uint _tagId; + uint _dialogueId; +}; + +extern void writeAllScriptQuotes(); +extern void writeEntryHeader(const char *name, uint offset, uint size); +extern uint dataOffset; + +#endif -- cgit v1.2.3 From 89da2a88573f1acd8c311764a84f0054011f46c2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 27 Jul 2016 06:43:12 -0400 Subject: TITANIC: Moved handleQuote data arrays to datafile --- engines/titanic/true_talk/barbot_script.cpp | 94 +------------------ engines/titanic/true_talk/bellbot_script.cpp | 129 +-------------------------- engines/titanic/true_talk/deskbot_script.cpp | 123 +------------------------ engines/titanic/true_talk/doorbot_script.cpp | 4 +- engines/titanic/true_talk/liftbot_script.cpp | 4 +- engines/titanic/true_talk/maitred_script.cpp | 4 +- engines/titanic/true_talk/script_support.cpp | 22 +++++ engines/titanic/true_talk/script_support.h | 12 +++ engines/titanic/true_talk/tt_npc_script.cpp | 53 +++++++++++ engines/titanic/true_talk/tt_npc_script.h | 1 + 10 files changed, 104 insertions(+), 342 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index a3ab0586b4..7a20ee44ad 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -40,55 +40,6 @@ static const uint ARRAY2[] = { 51899, 51900, 51901, 51902, 51903, 51904, 51905, 51906, 51907, 0 }; -static const TThandleQuoteEntry QUOTES[] = { - { 0x00000008, 0x00000000, 0x0003D372 }, - { 0x00000007, 0x00000000, 0x0003D72B }, - { 0x00000004, 0x00000000, 0x0003D722 }, - { 0x00000006, 0x00000000, 0x0003D264 }, - { 0x00000005, 0x00000000, 0x0003D72F }, - { 0x00000001, 0x00000032, 0x00000001 }, - { 0x00000002, 0x00000032, 0x00000001 }, - { 0x00000003, 0x00000032, 0x00000001 }, - { 0x00000010, 0x54524156, 0x0003D2B1 }, - { 0x00000010, 0x0000003C, 0x00000000 }, - { 0x00000011, 0x00000000, 0x0003D484 }, - { 0x00000015, 0x00000032, 0x0003D2B2 }, - { 0x00000012, 0x00000042, 0x0003D499 }, - { 0x00000013, 0x00000021, 0x0003D31E }, - { 0x0000001D, 0x00000021, 0x0003D31E }, - { 0x00000014, 0x00000042, 0x0003D49E }, - { 0x00000016, 0x0000003C, 0x0003D2B6 }, - { 0x00000017, 0x00000028, 0x0003D2B5 }, - { 0x00000018, 0x00000000, 0x0003D35E }, - { 0x00000019, 0x00000000, 0x0003D35E }, - { 0x0000001A, 0x0000003C, 0x0003D38B }, - { 0x0000001B, 0x00000000, 0x0003D2F8 }, - { 0x00000009, 0x00000019, 0x0003D326 }, - { 0x0000000A, 0x00000019, 0x0003D314 }, - { 0x0000000B, 0x00000028, 0x0003D311 }, - { 0x0000001E, 0x00000000, 0x0003D6F2 }, - { 0x0000001F, 0x00000000, 0x0003D26C }, - { 0x0000000C, 0x00000000, 0x0003D2F4 }, - { 0x0000000D, 0x00000000, 0x0003D2F4 }, - { 0x0000000E, 0x00000000, 0x0003D2F4 }, - { 0x0000000F, 0x00000000, 0x0003D2F4 }, - { 0x00000020, 0x00000019, 0x0003D389 }, - { 0x00000021, 0x0000000F, 0x0003D29C }, - { 0x00000022, 0x0000000F, 0x0003D494 }, - { 0x0000001C, 0x00000032, 0x00000000 }, - { 0x00000023, 0x00000000, 0x0003D7F8 }, - { 0x00000024, 0x00000000, 0x0003D7F9 }, - { 0x00000031, 0x00000000, 0x0003D722 }, - { 0x00000032, 0x00000000, 0x0003D722 }, - { 0x00000033, 0x00000000, 0x0003D372 }, - { 0x00000034, 0x00000000, 0x0003D323 }, - { 0x0000003E, 0x00000000, 0x0003D163 }, - { 0x0000003F, 0x00000000, 0x0003D163 }, - { 0x00000040, 0x00000000, 0x0003D163 }, - { 0x00000041, 0x00000000, 0x0003D691 }, - { 0x00000000, 0x00000000, 0x00000000 } -}; - BarbotScript::BarbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { @@ -99,6 +50,7 @@ BarbotScript::BarbotScript(int val1, const char *charClass, int v2, loadResponses("Responses/Barbot"); setupSentences(); _tagMappings.load("TagMap/Barbot"); + _quotes.load("Quotes/Barbot"); } void BarbotScript::setupSentences() { @@ -1009,49 +961,7 @@ int BarbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return setResponse(getDialogueId(222301), -1); } - int loopCounter = 0; - for (const TThandleQuoteEntry *qe = QUOTES; qe->_index && loopCounter < 2; ++qe) { - if (!qe->_index) { - // End of list; start at beginning again - ++loopCounter; - qe = QUOTES; - } - - if (qe->_index == val && ( - (tagId == 0 && loopCounter == 2) || - (qe->_tagId < MKTAG('A', 'A', 'A', 'A')) || - (qe->_tagId == tagId) - )) { - uint foundTagId = qe->_tagId; - if (foundTagId > 0 && foundTagId < 100) { - if (!tagId) - foundTagId >>= 1; - if (getRandomNumber(100) < foundTagId) - return 1; - } - - uint dialogueId = qe->_dialogueId; - if (dialogueId < 1000) { - if (dialogueId >= 3) - error("Invalid dialogue index in BarbotScript"); - const int RANDOM_LIMITS[3] = { 30, 50, 70 }; - int rangeLimit = RANDOM_LIMITS[dialogueId]; - int dialRegion = getDialRegion(0); - - if (dialRegion != 1) { - rangeLimit = MAX(rangeLimit - 20, 20); - } - - dialogueId = (((int)remainder + 25) % 100) >= rangeLimit ? 221376 : 221375; - } - - addResponse(getDialogueId(dialogueId)); - applyResponse(); - return 2; - } - } - - return 1; + return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); } int BarbotScript::proc21(int v1, int v2, int v3) { diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index b91d78b057..988efa940b 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -27,87 +27,6 @@ namespace Titanic { -static const TThandleQuoteEntry QUOTES[] = { - { 0x00000008, 0x00000000, 0x00031116 }, - { 0x00000007, 0x00000000, 0x00031447 }, - { 0x00000006, 0x00000000, 0x000310F9 }, - { 0x00000005, 0x00000000, 0x000313A1 }, - { 0x00000001, 0x56424144, 0x000313D7 }, - { 0x00000001, 0x52554445, 0x000313D7 }, - { 0x00000001, 0x5052534E, 0x00041EB3 }, - { 0x00000001, 0x424F5953, 0x00041EB3 }, - { 0x00000001, 0x4749524C, 0x00041EB3 }, - { 0x00000001, 0x464F4F44, 0x00041EB3 }, - { 0x00000001, 0x00000032, 0x00041EB1 }, - { 0x0000001C, 0x00000032, 0x00041EB0 }, - { 0x00000010, 0x54524156, 0x000313C6 }, - { 0x00000010, 0x0000003C, 0x00041EB0 }, - { 0x00000011, 0x00000000, 0x0003139E }, - { 0x00000015, 0x00000032, 0x0003139F }, - { 0x00000012, 0x00000042, 0x000313A0 }, - { 0x00000013, 0x00000021, 0x000313A7 }, - { 0x0000001D, 0x00000021, 0x000313A7 }, - { 0x00000014, 0x00000042, 0x000313A4 }, - { 0x0000001B, 0x00000000, 0x0003139B }, - { 0x0000001E, 0x00000000, 0x000313A2 }, - { 0x0000001F, 0x00000000, 0x00030DC0 }, - { 0x0000000C, 0x00000000, 0x000313A9 }, - { 0x0000000D, 0x00000000, 0x000313A9 }, - { 0x0000000E, 0x00000000, 0x000313A8 }, - { 0x0000000F, 0x00000000, 0x000313A8 }, - { 0x00000020, 0x00000019, 0x000313AB }, - { 0x00000021, 0x0000000F, 0x000313AC }, - { 0x00000023, 0x00000000, 0x00031337 }, - { 0x00000024, 0x00000000, 0x0003135A }, - { 0x00000025, 0x00000000, 0x000311AB }, - { 0x00000026, 0x00000000, 0x0003112E }, - { 0x00000030, 0x00000000, 0x0003106C }, - { 0x00000027, 0x424F5953, 0x0003140C }, - { 0x00000027, 0x4749524C, 0x0003140D }, - { 0x00000027, 0x00000000, 0x0003140D }, - { 0x00000028, 0x00000000, 0x00031404 }, - { 0x00000029, 0x00000000, 0x00031405 }, - { 0x0000002A, 0x00000000, 0x00031406 }, - { 0x0000002B, 0x00000000, 0x00031407 }, - { 0x0000002C, 0x00000000, 0x00031408 }, - { 0x0000002D, 0x00000000, 0x00031409 }, - { 0x0000002E, 0x424F5953, 0x0003140A }, - { 0x0000002E, 0x4749524C, 0x0003140B }, - { 0x0000002E, 0x00000000, 0x0003140B }, - { 0x00000032, 0x00000000, 0x000313D6 }, - { 0x00000033, 0x00000000, 0x000313D7 }, - { 0x00000034, 0x00000000, 0x000313D8 }, - { 0x00000035, 0x00000000, 0x0003113D }, - { 0x00000036, 0x00000000, 0x00030DCB }, - { 0x00000031, 0x00000000, 0x00030DB5 }, - { 0x00000037, 0x00000000, 0x000313DD }, - { 0x00000038, 0x00000000, 0x00030EE4 }, - { 0x00000039, 0x00000000, 0x0003160B }, - { 0x0000003A, 0x00000000, 0x000310C4 }, - { 0x0000003B, 0x00000000, 0x000310C5 }, - { 0x0000003C, 0x00000000, 0x0003121C }, - { 0x0000003D, 0x00000000, 0x00031623 }, - { 0x0000003F, 0x00000000, 0x00030D99 }, - { 0x0000003E, 0x00000000, 0x00030D99 }, - { 0x00000040, 0x00000000, 0x000315CE }, - { 0x00000041, 0x00000000, 0x000315DC }, - { 0x00000042, 0x00000000, 0x00031478 }, - { 0x00000043, 0x00000000, 0x00030FC8 }, - { 0x00000044, 0x00000000, 0x0003106D }, - { 0x00000054, 0x00000000, 0x00031514 }, - { 0x00000055, 0x00000000, 0x00031515 }, - { 0x00000056, 0x00000000, 0x000315CF }, - { 0x0000005A, 0x00000000, 0x000310F9 }, - { 0x00000058, 0x00000000, 0x000315DF }, - { 0x0000005B, 0x00000000, 0x00031620 }, - { 0x0000005C, 0x00000000, 0x0003134B }, - { 0x00000059, 0x00000000, 0x0003150F }, - { 0x00000057, 0x00000000, 0x00030D58 }, - { 0x00000045, 0x0000000A, 0x000310C3 }, - { 0x00000046, 0x00000000, 0x00030EAD }, - { 0x00000000, 0x00000000, 0x00000000 } -}; - BellbotScript::BellbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2) : TTnpcScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0), @@ -126,6 +45,7 @@ BellbotScript::BellbotScript(int val1, const char *charClass, int v2, setupSentences(); _tagMappings.load("TagMap/Bellbot"); _words.load("Words/Bellbot"); + _quotes.load("Quotes/Bellbot"); } void BellbotScript::setupSentences() { @@ -258,51 +178,8 @@ int BellbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, default: break; } - - int loopCounter = 0; - for (const TThandleQuoteEntry *qe = QUOTES; qe->_index && loopCounter < 2; ++qe) { - if (!qe->_index) { - // End of list; start at beginning again - ++loopCounter; - qe = QUOTES; - } - - if (qe->_index == val && ( - (tagId == 0 && loopCounter == 2) || - (qe->_tagId < MKTAG('A', 'A', 'A', 'A')) || - (qe->_tagId == tagId) - )) { - uint foundTagId = qe->_tagId; - if (foundTagId > 0 && foundTagId < 100) { - if (!tagId) - foundTagId >>= 1; - if (getRandomNumber(100) < foundTagId) - return 1; - } - - uint dialogueId = qe->_dialogueId; - if (dialogueId >= 270000 && dialogueId <= 275000) { - dialogueId -= 270000; - if (dialogueId >= 3) - error("Invalid dialogue index in BarbotScript"); - const int RANDOM_LIMITS[3] = { 30, 50, 70 }; - int rangeLimit = RANDOM_LIMITS[dialogueId]; - int dialRegion = getDialRegion(0); - - if (dialRegion != 1) { - rangeLimit = MAX(rangeLimit - 20, 20); - } - - dialogueId = (((int)remainder + 25) % 100) >= rangeLimit ? 201687 : 201686; - } - - addResponse(getDialogueId(dialogueId)); - applyResponse(); - return 2; - } - } - - return 1; + + return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); } int BellbotScript::proc21(int v1, int v2, int v3) { diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 8e92007402..a95e4dffb7 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -26,84 +26,6 @@ namespace Titanic { -static const TThandleQuoteEntry QUOTES[] = { - { 0x00000008, 0x00000000, 0x0003ACD0 }, - { 0x00000007, 0x00000000, 0x0003ACDC }, - { 0x00000006, 0x00000000, 0x0003ABF9 }, - { 0x00000005, 0x00000000, 0x0003AD04 }, - { 0x00000001, 0x56424144, 0x0003AE27 }, - { 0x00000001, 0x52554445, 0x0003AE27 }, - { 0x00000001, 0x5052534E, 0x00041EB3 }, - { 0x00000001, 0x464F4F44, 0x00041EB3 }, - { 0x00000001, 0x00000032, 0x00041EB1 }, - { 0x00000002, 0x56424144, 0x0003AE27 }, - { 0x00000002, 0x52554445, 0x0003AE27 }, - { 0x00000002, 0x5052534E, 0x00041EB3 }, - { 0x00000002, 0x464F4F44, 0x00041EB3 }, - { 0x00000002, 0x00000032, 0x00041EB1 }, - { 0x00000003, 0x56424144, 0x0003AE0E }, - { 0x00000003, 0x52554445, 0x0003AE0E }, - { 0x00000003, 0x5052534E, 0x00041EB3 }, - { 0x00000003, 0x464F4F44, 0x00041EB3 }, - { 0x00000003, 0x00000032, 0x00041EB1 }, - { 0x00000010, 0x54524156, 0x0003ACFE }, - { 0x00000010, 0x0000003C, 0x00041EB0 }, - { 0x00000011, 0x00000000, 0x0003ABF9 }, - { 0x00000015, 0x00000032, 0x0003AC70 }, - { 0x00000012, 0x00000042, 0x0003AC7E }, - { 0x00000013, 0x00000021, 0x0003AC70 }, - { 0x0000001D, 0x00000021, 0x0003AC09 }, - { 0x00000014, 0x00000042, 0x0003AE07 }, - { 0x0000001B, 0x00000000, 0x00041EB2 }, - { 0x0000001E, 0x00000000, 0x0003ACC1 }, - { 0x0000001F, 0x00000000, 0x0003AC3E }, - { 0x0000000C, 0x00000000, 0x0003AE4C }, - { 0x0000000D, 0x00000000, 0x0003AE4C }, - { 0x0000000E, 0x00000000, 0x0003AE4B }, - { 0x0000000F, 0x00000000, 0x0003AE4B }, - { 0x00000020, 0x00000019, 0x0003AE24 }, - { 0x00000021, 0x0000000F, 0x0003AE10 }, - { 0x0000001C, 0x00000032, 0x00041EB0 }, - { 0x00000023, 0x00000000, 0x0003AC46 }, - { 0x00000024, 0x00000000, 0x0003AE1F }, - { 0x00000025, 0x00000000, 0x0003AE14 }, - { 0x00000026, 0x00000000, 0x0003AC7B }, - { 0x00000030, 0x00000000, 0x0003AE3D }, - { 0x00000027, 0x424F5953, 0x0003AE5D }, - { 0x00000027, 0x4749524C, 0x0003AE5E }, - { 0x00000027, 0x00000000, 0x0003AE5C }, - { 0x00000028, 0x00000000, 0x0003AE5B }, - { 0x00000029, 0x00000000, 0x0003AE58 }, - { 0x0000002A, 0x00000000, 0x0003AE59 }, - { 0x0000002B, 0x00000000, 0x0003AE5A }, - { 0x0000002C, 0x00000000, 0x0003AE57 }, - { 0x0000002D, 0x00000000, 0x0003AE5C }, - { 0x0000002E, 0x424F5953, 0x0003AE5A }, - { 0x0000002E, 0x4749524C, 0x0003AE5A }, - { 0x0000002E, 0x00000000, 0x0003AE5A }, - { 0x00000032, 0x00000000, 0x0003AE0E }, - { 0x00000033, 0x00000000, 0x0003AE27 }, - { 0x00000034, 0x00000000, 0x0003AE24 }, - { 0x00000035, 0x00000000, 0x0003AE3E }, - { 0x00000037, 0x00000000, 0x0003AE26 }, - { 0x00000038, 0x00000000, 0x0003AEC0 }, - { 0x00000039, 0x00000000, 0x0003AEC1 }, - { 0x0000003A, 0x00000000, 0x0003AC7F }, - { 0x0000003B, 0x00000000, 0x0003ADD5 }, - { 0x0000003C, 0x00000000, 0x0003AEC5 }, - { 0x0000003D, 0x00000000, 0x0003AEC9 }, - { 0x0000003F, 0x00000000, 0x0003ABC5 }, - { 0x0000003E, 0x00000000, 0x0003ABC5 }, - { 0x00000040, 0x00000000, 0x0003AFB0 }, - { 0x00000041, 0x00000000, 0x0003AFDC }, - { 0x00000042, 0x00000000, 0x0003AFB5 }, - { 0x00000043, 0x00000000, 0x0003AFDD }, - { 0x00000044, 0x00000000, 0x0003AFDD }, - { 0x00000045, 0x0000000A, 0x0003AC7E }, - { 0x00000046, 0x00000000, 0x0003AF6E }, - { 0x00000000, 0x00000000, 0x00000000 } -}; - DeskbotScript::DeskbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2) : TTnpcScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0) { @@ -123,6 +45,7 @@ DeskbotScript::DeskbotScript(int val1, const char *charClass, int v2, setupSentences(); _tagMappings.load("TagMap/Deskbot"); _words.load("Words/Deskbot"); + _quotes.load("Quotes/Deskbot"); } void DeskbotScript::setupSentences() { @@ -253,50 +176,8 @@ int DeskbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, break; } - int loopCounter = 0; - for (const TThandleQuoteEntry *qe = QUOTES; qe->_index && loopCounter < 2; ++qe) { - if (!qe->_index) { - // End of list; start at beginning again - ++loopCounter; - qe = QUOTES; - } - - if (qe->_index == val && ( - (tagId == 0 && loopCounter == 2) || - (qe->_tagId < MKTAG('A', 'A', 'A', 'A')) || - (qe->_tagId == tagId) - )) { - uint foundTagId = qe->_tagId; - if (foundTagId > 0 && foundTagId < 100) { - if (!tagId) - foundTagId >>= 1; - if (getRandomNumber(100) < foundTagId) - return 1; - } - - uint dialogueId = qe->_dialogueId; - if (dialogueId >= 270000 && dialogueId <= 275000) { - dialogueId -= 270000; - if (dialogueId >= 3) - error("Invalid dialogue index in BarbotScript"); - const int RANDOM_LIMITS[3] = { 30, 50, 70 }; - int rangeLimit = RANDOM_LIMITS[dialogueId]; - int dialRegion = getDialRegion(0); - - if (dialRegion != 1) { - rangeLimit = MAX(rangeLimit - 20, 20); - } - - dialogueId = (((int)remainder + 25) % 100) >= rangeLimit ? 241191 : 241166; - } - - addResponse(getDialogueId(dialogueId)); - applyResponse(); - return 2; - } - } + return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); - return 1; } int DeskbotScript::proc21(int v1, int v2, int v3) { diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 8ae19666aa..a864141428 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -59,6 +59,7 @@ DoorbotScript::DoorbotScript(int val1, const char *charClass, int v2, setupSentences(); _tagMappings.load("TagMap/Doorbot"); _words.load("Words/Doorbot"); + _quotes.load("Quotes/Doorbot"); } void DoorbotScript::setupSentences() { @@ -142,7 +143,8 @@ ScriptChangedResult DoorbotScript::scriptChanged(TTscriptBase *roomScript, uint int DoorbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder) { warning("TODO"); - return 0; + + return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); } int DoorbotScript::proc21(int v1, int v2, int v3) { diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index 926d96f658..b6b2428de5 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -40,6 +40,7 @@ LiftbotScript::LiftbotScript(int val1, const char *charClass, int v2, setupSentences(); _tagMappings.load("TagMap/Liftbot"); _words.load("Words/Liftbot"); + _quotes.load("Quotes/Liftbot"); } void LiftbotScript::setupSentences() { @@ -99,7 +100,8 @@ ScriptChangedResult LiftbotScript::scriptChanged(TTscriptBase *roomScript, uint int LiftbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder) { warning("TODO"); - return 0; + + return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); } int LiftbotScript::proc21(int v1, int v2, int v3) { diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index 891c66167e..d02a2adc85 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -42,6 +42,7 @@ MaitreDScript::MaitreDScript(int val1, const char *charClass, int v2, loadResponses("Responses/MaitreD"); setupSentences(); _tagMappings.load("TagMap/MaitreD"); + _quotes.load("Quotes/MaitreD"); } void MaitreDScript::setupSentences() { @@ -76,7 +77,8 @@ ScriptChangedResult MaitreDScript::scriptChanged(TTscriptBase *roomScript, uint int MaitreDScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder) { warning("TODO"); - return 0; + + return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); } int MaitreDScript::proc21(int v1, int v2, int v3) { diff --git a/engines/titanic/true_talk/script_support.cpp b/engines/titanic/true_talk/script_support.cpp index 857d774f82..dd20edd23d 100644 --- a/engines/titanic/true_talk/script_support.cpp +++ b/engines/titanic/true_talk/script_support.cpp @@ -140,4 +140,26 @@ void TTwordEntries::load(const char *name) { delete r; } +/*------------------------------------------------------------------------*/ + +void TThandleQuoteEntries::load(const char *name) { + Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); + + _tag1 = r->readUint32LE(); + _tag2 = r->readUint32LE(); + _rangeStart = r->readUint32LE(); + _rangeEnd = r->readUint32LE(); + + while (r->pos() < r->size()) { + TThandleQuoteEntry qe; + qe._index = r->readUint32LE(); + qe._tagId = r->readUint32LE(); + qe._dialogueId = r->readUint32LE(); + + push_back(qe); + } + + delete r; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/script_support.h b/engines/titanic/true_talk/script_support.h index 50576cab85..625ae3fed3 100644 --- a/engines/titanic/true_talk/script_support.h +++ b/engines/titanic/true_talk/script_support.h @@ -129,8 +129,20 @@ struct TThandleQuoteEntry { uint _index; uint _tagId; uint _dialogueId; + + TThandleQuoteEntry() : _index(0), _tagId(0), _dialogueId(0) {} }; +class TThandleQuoteEntries : public Common::Array { +public: + uint _tag1, _tag2; + uint _rangeStart, _rangeEnd; +public: + TThandleQuoteEntries() : _tag1(0), _tag2(0), _rangeStart(0), _rangeEnd(0) {} + void load(const char *name); +}; + + } // End of namespace Titanic #endif /* TITANIC_TT_NPC_SCRIPT_H */ diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 3fc6d0aec1..3e8564c46c 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -268,7 +268,60 @@ bool TTnpcScript::handleWord(uint id) const { int TTnpcScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder) { + if (_quotes.empty()) + return 1; + + + int loopCounter = 0; + for (uint idx = 0; idx < _quotes.size() && loopCounter < 2; ++idx) { + const TThandleQuoteEntry *qe = &_quotes[idx]; + + if (!qe->_index) { + // End of list; start at beginning again + ++loopCounter; + idx = 0; + qe = &_quotes[0]; + } + + if (qe->_index == val && ( + (tagId == 0 && loopCounter == 2) || + (qe->_tagId < MKTAG('A', 'A', 'A', 'A')) || + (qe->_tagId == tagId) + )) { + uint foundTagId = qe->_tagId; + if (foundTagId > 0 && foundTagId < 100) { + if (!tagId) + foundTagId >>= 1; + if (getRandomNumber(100) < foundTagId) + return 1; + } + + uint dialogueId = qe->_dialogueId; + if (dialogueId >= _quotes._rangeStart && dialogueId <= _quotes._rangeEnd) { + dialogueId -= _quotes._rangeStart; + if (dialogueId > 3) + error("Invalid dialogue index in BarbotScript"); + + const int RANDOM_LIMITS[4] = { 30, 50, 70, 60 }; + int rangeLimit = RANDOM_LIMITS[dialogueId]; + int dialRegion = getDialRegion(0); + + if (dialRegion != 1) { + rangeLimit = MAX(rangeLimit - 20, 20); + } + + dialogueId = (((int)remainder + 25) % 100) >= rangeLimit + ? _quotes._tag1 : _quotes._tag2; + } + + addResponse(getDialogueId(dialogueId)); + applyResponse(); + return 2; + } + } + return 1; + } uint TTnpcScript::getRangeValue(uint id) { diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index bd5b759480..819de77311 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -83,6 +83,7 @@ protected: TTsentenceEntries _entries; TTtagMappings _tagMappings; TTwordEntries _words; + TThandleQuoteEntries _quotes; int _entryCount; int _field68; int _field6C; -- cgit v1.2.3 From 5bc347007c3168bf99fe4847d09904f5f236624b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 27 Jul 2016 11:57:44 -0400 Subject: TITANIC: Finish DoorbotScript handleQuote --- engines/titanic/true_talk/doorbot_script.cpp | 105 ++++++++++++++++++++++++++- 1 file changed, 104 insertions(+), 1 deletion(-) diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index a864141428..bd654fcc0e 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -142,7 +142,110 @@ ScriptChangedResult DoorbotScript::scriptChanged(TTscriptBase *roomScript, uint int DoorbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder) { - warning("TODO"); + switch (tagId) { + case MKTAG('A', 'D', 'V', 'T'): + case MKTAG('A', 'R', 'T', 'I'): + case MKTAG('A', 'R', 'T', 'Y'): + case MKTAG('B', 'R', 'N', 'D'): + case MKTAG('C', 'O', 'M', 'D'): + case MKTAG('D', 'N', 'C', 'E'): + case MKTAG('H', 'B', 'B', 'Y'): + case MKTAG('L', 'I', 'T', 'R'): + case MKTAG('M', 'A', 'G', 'S'): + case MKTAG('M', 'C', 'P', 'Y'): + case MKTAG('M', 'I', 'N', 'S'): + case MKTAG('M', 'U', 'S', 'I'): + case MKTAG('N', 'I', 'K', 'E'): + case MKTAG('S', 'F', 'S', 'F'): + case MKTAG('S', 'O', 'A', 'P'): + case MKTAG('S', 'O', 'N', 'G'): + case MKTAG('S', 'P', 'R', 'T'): + case MKTAG('T', 'E', 'A', 'M'): + case MKTAG('T', 'V', 'S', 'H'): + case MKTAG('W', 'W', 'E', 'B'): + tagId = MKTAG('E', 'N', 'T', 'N'); + break; + case MKTAG('A', 'C', 'T', 'R'): + case MKTAG('A', 'C', 'T', 'S'): + case MKTAG('A', 'U', 'T', 'H'): + case MKTAG('B', 'A', 'R', 'K'): + case MKTAG('B', 'A', 'R', 'U'): + case MKTAG('B', 'L', 'F', '1'): + case MKTAG('B', 'L', 'F', '2'): + case MKTAG('B', 'L', 'P', '1'): + case MKTAG('B', 'L', 'P', '2'): + case MKTAG('B', 'L', 'P', '3'): + case MKTAG('B', 'L', 'P', '4'): + case MKTAG('B', 'L', 'T', '1'): + case MKTAG('B', 'L', 'T', '2'): + case MKTAG('B', 'L', 'T', '3'): + case MKTAG('B', 'L', 'T', '4'): + case MKTAG('B', 'L', 'T', '5'): + case MKTAG('B', 'O', 'Y', 'S'): + case MKTAG('D', 'C', 'T', 'R'): + case MKTAG('F', 'A', 'M', 'E'): + case MKTAG('F', 'A', 'S', 'H'): + case MKTAG('G', 'I', 'R', 'L'): + case MKTAG('H', 'E', 'R', 'O'): + case MKTAG('H', 'O', 'S', 'T'): + case MKTAG('K', 'N', 'O', 'B'): + case MKTAG('N', 'H', 'R', 'O'): + case MKTAG('R', 'A', 'C', 'E'): + case MKTAG('S', 'C', 'I', 'T'): + case MKTAG('T', 'D', 'V', 'P'): + case MKTAG('T', 'W', 'A', 'T'): + case MKTAG('W', 'E', 'A', 'T'): + tagId = MKTAG('P', 'R', 'S', 'N'); + break; + case MKTAG('C', 'H', 'S', 'E'): + case MKTAG('C', 'M', 'N', 'T'): + case MKTAG('F', 'I', 'L', 'M'): + case MKTAG('J', 'F', 'O', 'D'): + case MKTAG('L', 'I', 'Q', 'D'): + tagId = MKTAG('F', 'O', 'O', 'D'); + break; + case MKTAG('C', 'R', 'I', 'M'): + case MKTAG('C', 'S', 'P', 'Y'): + case MKTAG('D', 'R', 'U', 'G'): + tagId = MKTAG('V', 'B', 'A', 'D'); + break; + case MKTAG('E', 'A', 'R', 'T'): + case MKTAG('H', 'O', 'M', 'E'): + case MKTAG('N', 'P', 'L', 'C'): + case MKTAG('P', 'L', 'A', 'N'): + tagId = MKTAG('P', 'L', 'A', 'C'); + break; + case MKTAG('F', 'A', 'U', 'N'): + case MKTAG('F', 'I', 'S', 'H'): + case MKTAG('F', 'L', 'O', 'R'): + tagId = MKTAG('N', 'A', 'T', 'R'); + break; + case MKTAG('H', 'H', 'L', 'D'): + case MKTAG('T', 'O', 'Y', 'S'): + case MKTAG('W', 'E', 'A', 'P'): + tagId = MKTAG('M', 'A', 'C', 'H'); + break; + case MKTAG('M', 'L', 'T', 'Y'): + case MKTAG('P', 'G', 'R', 'P'): + case MKTAG('P', 'T', 'I', 'C'): + tagId = MKTAG('G', 'R', 'U', 'P'); + break; + case MKTAG('P', 'K', 'U', 'P'): + case MKTAG('S', 'E', 'X', '1'): + case MKTAG('S', 'W', 'E', 'R'): + tagId = MKTAG('R', 'U', 'D', 'E'); + break; + case MKTAG('P', 'H', 'I', 'L'): + case MKTAG('R', 'C', 'K', 'T'): + tagId = MKTAG('S', 'C', 'I', 'E'); + break; + case MKTAG('T', 'R', 'A', '2'): + case MKTAG('T', 'R', 'A', '3'): + tagId = MKTAG('T', 'R', 'A', 'V'); + break; + default: + break; + } return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); } -- cgit v1.2.3 From 13114f1d836f90eca211ea69a50d5e4a4ae0497a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 27 Jul 2016 12:20:46 -0400 Subject: TITANIC: Finish LiftbotScript handleQuote --- engines/titanic/true_talk/liftbot_script.cpp | 106 ++++++++++++++++++++++++++- 1 file changed, 105 insertions(+), 1 deletion(-) diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index b6b2428de5..30016ac1ac 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -99,7 +99,111 @@ ScriptChangedResult LiftbotScript::scriptChanged(TTscriptBase *roomScript, uint int LiftbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder) { - warning("TODO"); + switch (tagId) { + case MKTAG('A', 'D', 'V', 'T'): + case MKTAG('A', 'R', 'T', 'I'): + case MKTAG('A', 'R', 'T', 'Y'): + case MKTAG('B', 'R', 'N', 'D'): + case MKTAG('C', 'O', 'M', 'D'): + case MKTAG('D', 'N', 'C', 'E'): + case MKTAG('H', 'B', 'B', 'Y'): + case MKTAG('L', 'I', 'T', 'R'): + case MKTAG('M', 'A', 'G', 'S'): + case MKTAG('M', 'C', 'P', 'Y'): + case MKTAG('M', 'I', 'N', 'S'): + case MKTAG('M', 'U', 'S', 'I'): + case MKTAG('N', 'I', 'K', 'E'): + case MKTAG('S', 'F', 'S', 'F'): + case MKTAG('S', 'O', 'A', 'P'): + case MKTAG('S', 'O', 'N', 'G'): + case MKTAG('S', 'P', 'R', 'T'): + case MKTAG('T', 'E', 'A', 'M'): + case MKTAG('T', 'V', 'S', 'H'): + case MKTAG('W', 'W', 'E', 'B'): + tagId = MKTAG('E', 'N', 'T', 'N'); + break; + case MKTAG('A', 'C', 'T', 'R'): + case MKTAG('A', 'C', 'T', 'S'): + case MKTAG('A', 'U', 'T', 'H'): + case MKTAG('B', 'A', 'R', 'K'): + case MKTAG('B', 'A', 'R', 'U'): + case MKTAG('B', 'L', 'F', '1'): + case MKTAG('B', 'L', 'F', '2'): + case MKTAG('B', 'L', 'R', '1'): + case MKTAG('B', 'L', 'R', '2'): + case MKTAG('B', 'L', 'P', '1'): + case MKTAG('B', 'L', 'P', '2'): + case MKTAG('B', 'L', 'P', '3'): + case MKTAG('B', 'L', 'P', '4'): + case MKTAG('B', 'L', 'T', '1'): + case MKTAG('B', 'L', 'T', '2'): + case MKTAG('B', 'L', 'T', '3'): + case MKTAG('B', 'L', 'T', '4'): + case MKTAG('B', 'L', 'T', '5'): + case MKTAG('B', 'O', 'Y', 'S'): + case MKTAG('C', 'O', 'P', 'S'): + case MKTAG('D', 'C', 'T', 'R'): + case MKTAG('F', 'A', 'M', 'E'): + case MKTAG('F', 'A', 'S', 'H'): + case MKTAG('G', 'I', 'R', 'L'): + case MKTAG('H', 'E', 'R', 'O'): + case MKTAG('H', 'O', 'S', 'T'): + case MKTAG('K', 'N', 'O', 'B'): + case MKTAG('N', 'H', 'R', 'O'): + case MKTAG('R', 'A', 'C', 'E'): + case MKTAG('S', 'C', 'I', 'T'): + case MKTAG('T', 'D', 'V', 'P'): + case MKTAG('T', 'W', 'A', 'T'): + case MKTAG('W', 'E', 'A', 'T'): + tagId = MKTAG('P', 'R', 'S', 'N'); + break; + case MKTAG('C', 'H', 'S', 'E'): + case MKTAG('C', 'M', 'N', 'T'): + case MKTAG('F', 'I', 'L', 'M'): + case MKTAG('J', 'F', 'O', 'D'): + case MKTAG('L', 'I', 'Q', 'D'): + tagId = MKTAG('F', 'O', 'O', 'D'); + break; + case MKTAG('C', 'R', 'I', 'M'): + case MKTAG('C', 'S', 'P', 'Y'): + case MKTAG('D', 'R', 'U', 'G'): + tagId = MKTAG('V', 'B', 'A', 'D'); + break; + case MKTAG('E', 'A', 'R', 'T'): + case MKTAG('H', 'O', 'M', 'E'): + case MKTAG('N', 'P', 'L', 'C'): + case MKTAG('P', 'L', 'A', 'N'): + tagId = MKTAG('P', 'L', 'A', 'C'); + break; + case MKTAG('F', 'A', 'U', 'N'): + case MKTAG('F', 'I', 'S', 'H'): + case MKTAG('F', 'L', 'O', 'R'): + tagId = MKTAG('N', 'A', 'T', 'R'); + break; + case MKTAG('H', 'H', 'L', 'D'): + case MKTAG('T', 'O', 'Y', 'S'): + case MKTAG('W', 'E', 'A', 'P'): + tagId = MKTAG('M', 'A', 'C', 'H'); + break; + case MKTAG('M', 'L', 'T', 'Y'): + case MKTAG('P', 'G', 'R', 'P'): + case MKTAG('P', 'T', 'I', 'C'): + tagId = MKTAG('G', 'R', 'U', 'P'); + break; + case MKTAG('P', 'K', 'U', 'P'): + case MKTAG('S', 'E', 'X', '1'): + case MKTAG('S', 'W', 'E', 'R'): + tagId = MKTAG('R', 'U', 'D', 'E'); + break; + case MKTAG('P', 'H', 'I', 'L'): + case MKTAG('R', 'C', 'K', 'T'): + tagId = MKTAG('S', 'C', 'I', 'E'); + break; + case MKTAG('T', 'R', 'A', '2'): + case MKTAG('T', 'R', 'A', '3'): + tagId = MKTAG('T', 'R', 'A', 'V'); + break; + } return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); } -- cgit v1.2.3 From 2457340315e73617b6a9a1a37e28628aacfde45c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 27 Jul 2016 12:44:49 -0400 Subject: TITANIC: Finish MaitreDScript handleQuote --- engines/titanic/true_talk/maitred_script.cpp | 105 ++++++++++++++++++++++++++- 1 file changed, 104 insertions(+), 1 deletion(-) diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index d02a2adc85..86862a7037 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -76,7 +76,110 @@ ScriptChangedResult MaitreDScript::scriptChanged(TTscriptBase *roomScript, uint int MaitreDScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder) { - warning("TODO"); + switch (tagId) { + case MKTAG('A', 'D', 'V', 'T'): + case MKTAG('A', 'R', 'T', 'I'): + case MKTAG('A', 'R', 'T', 'Y'): + case MKTAG('B', 'R', 'N', 'D'): + case MKTAG('C', 'O', 'M', 'D'): + case MKTAG('D', 'N', 'C', 'E'): + case MKTAG('H', 'B', 'B', 'Y'): + case MKTAG('L', 'I', 'T', 'R'): + case MKTAG('M', 'A', 'G', 'S'): + case MKTAG('M', 'C', 'P', 'Y'): + case MKTAG('M', 'I', 'N', 'S'): + case MKTAG('M', 'U', 'S', 'I'): + case MKTAG('N', 'I', 'K', 'E'): + case MKTAG('S', 'F', 'S', 'F'): + case MKTAG('S', 'O', 'A', 'P'): + case MKTAG('S', 'P', 'R', 'T'): + case MKTAG('S', 'O', 'N', 'G'): + case MKTAG('T', 'E', 'A', 'M'): + case MKTAG('T', 'V', 'S', 'H'): + case MKTAG('W', 'W', 'E', 'B'): + tagId = MKTAG('E', 'N', 'T', 'N'); + break; + case MKTAG('A', 'C', 'T', 'R'): + case MKTAG('A', 'C', 'T', 'S'): + case MKTAG('A', 'U', 'T', 'H'): + case MKTAG('B', 'A', 'R', 'K'): + case MKTAG('B', 'A', 'R', 'U'): + case MKTAG('B', 'L', 'F', '1'): + case MKTAG('B', 'L', 'F', '2'): + case MKTAG('B', 'L', 'P', '1'): + case MKTAG('B', 'L', 'P', '2'): + case MKTAG('B', 'L', 'P', '3'): + case MKTAG('B', 'L', 'P', '4'): + case MKTAG('B', 'L', 'R', '1'): + case MKTAG('B', 'L', 'R', '2'): + case MKTAG('B', 'L', 'T', '1'): + case MKTAG('B', 'L', 'T', '2'): + case MKTAG('B', 'L', 'T', '3'): + case MKTAG('B', 'L', 'T', '4'): + case MKTAG('B', 'L', 'T', '5'): + case MKTAG('C', 'O', 'P', 'S'): + case MKTAG('D', 'C', 'T', 'R'): + case MKTAG('F', 'A', 'M', 'E'): + case MKTAG('F', 'A', 'S', 'H'): + case MKTAG('G', 'I', 'R', 'L'): + case MKTAG('H', 'E', 'R', 'O'): + case MKTAG('H', 'O', 'S', 'T'): + case MKTAG('K', 'N', 'O', 'B'): + case MKTAG('N', 'H', 'R', 'O'): + case MKTAG('R', 'A', 'C', 'E'): + case MKTAG('S', 'C', 'I', 'T'): + case MKTAG('T', 'D', 'V', 'P'): + case MKTAG('T', 'W', 'A', 'T'): + case MKTAG('W', 'E', 'A', 'T'): + tagId = MKTAG('P', 'R', 'S', 'N'); + break; + case MKTAG('C', 'H', 'S', 'E'): + case MKTAG('C', 'M', 'N', 'T'): + case MKTAG('F', 'I', 'L', 'M'): + case MKTAG('L', 'I', 'Q', 'D'): + tagId = MKTAG('F', 'O', 'O', 'D'); + break; + case MKTAG('C', 'R', 'I', 'M'): + case MKTAG('C', 'S', 'P', 'Y'): + case MKTAG('D', 'R', 'U', 'G'): + tagId = MKTAG('V', 'B', 'A', 'D'); + break; + case MKTAG('E', 'A', 'R', 'T'): + case MKTAG('H', 'O', 'M', 'E'): + case MKTAG('N', 'P', 'L', 'C'): + case MKTAG('P', 'L', 'A', 'N'): + tagId = MKTAG('P', 'L', 'A', 'C'); + break; + case MKTAG('F', 'A', 'U', 'N'): + case MKTAG('F', 'I', 'S', 'H'): + case MKTAG('F', 'L', 'O', 'R'): + tagId = MKTAG('N', 'A', 'T', 'R'); + break; + case MKTAG('H', 'H', 'L', 'D'): + case MKTAG('T', 'O', 'Y', 'S'): + case MKTAG('W', 'E', 'A', 'P'): + tagId = MKTAG('M', 'A', 'C', 'H'); + break; + case MKTAG('M', 'L', 'T', 'Y'): + case MKTAG('P', 'G', 'R', 'P'): + case MKTAG('P', 'T', 'I', 'C'): + tagId = MKTAG('G', 'R', 'U', 'P'); + break; + case MKTAG('P', 'K', 'U', 'P'): + case MKTAG('S', 'E', 'X', '1'): + case MKTAG('S', 'W', 'E', 'R'): + tagId = MKTAG('R', 'U', 'D', 'E'); + break; + case MKTAG('P', 'H', 'I', 'L'): + case MKTAG('R', 'C', 'K', 'T'): + tagId = MKTAG('S', 'C', 'I', 'E'); + break; + case MKTAG('T', 'R', 'A', '2'): + case MKTAG('T', 'R', 'A', '3'): + tagId = MKTAG('T', 'R', 'A', 'V'); + break; + + } return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); } -- cgit v1.2.3 From 8cc9142a92298dbf16f438dcf36d3e4d74e3d9f9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 27 Jul 2016 19:41:07 -0400 Subject: TITANIC: Renaming for NPC state methods --- engines/titanic/true_talk/barbot_script.cpp | 24 ++++++++++++------------ engines/titanic/true_talk/barbot_script.h | 6 +++++- engines/titanic/true_talk/bellbot_script.cpp | 2 +- engines/titanic/true_talk/bellbot_script.h | 6 +++++- engines/titanic/true_talk/deskbot_script.cpp | 2 +- engines/titanic/true_talk/deskbot_script.h | 6 +++++- engines/titanic/true_talk/doorbot_script.cpp | 10 +++++----- engines/titanic/true_talk/doorbot_script.h | 6 +++++- engines/titanic/true_talk/liftbot_script.cpp | 12 ++++++------ engines/titanic/true_talk/liftbot_script.h | 6 +++++- engines/titanic/true_talk/maitred_script.cpp | 2 +- engines/titanic/true_talk/maitred_script.h | 6 +++++- engines/titanic/true_talk/script_handler.cpp | 2 +- engines/titanic/true_talk/succubus_script.cpp | 2 +- engines/titanic/true_talk/succubus_script.h | 6 +++++- engines/titanic/true_talk/tt_concept.h | 2 +- engines/titanic/true_talk/tt_npc_script.cpp | 6 +++--- engines/titanic/true_talk/tt_npc_script.h | 6 +++++- engines/titanic/true_talk/tt_script_base.cpp | 8 ++++---- engines/titanic/true_talk/tt_script_base.h | 13 ++++++++++--- engines/titanic/true_talk/tt_sentence.cpp | 2 +- engines/titanic/true_talk/tt_sentence.h | 2 +- 22 files changed, 88 insertions(+), 49 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index 7a20ee44ad..11197220fa 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -74,7 +74,7 @@ int BarbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, addResponse(STATE_ARRAY[_state++]); } else { selectResponse(51896); - set34(1); + setState(1); _state = 0; } @@ -202,8 +202,8 @@ int BarbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { CTrueTalkManager::setFlags(33, getValue(33) - 1); CTrueTalkManager::setFlags(34, getValue(34) - 1); - int val34 = get34(); - set34(0); + int val34 = getState(); + setState(0); int val2C = sentence->_field2C; bool flag = val2C == 11 || val2C == 13; @@ -533,7 +533,7 @@ int BarbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { case 59: if (flag) { if (addRandomResponse(true)) { - set34(59); + setState(59); return 2; } } else if (flag2) { @@ -542,7 +542,7 @@ int BarbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { break; case 60: if (flag && addRandomResponse(true)) { - set34(59); + setState(59); return 2; } else if (flag2 || val2C == 7 || val2C == 10) { return applySentenceIds(getDialogueId(251712)); @@ -613,7 +613,7 @@ int BarbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { done: // Adjust primary dial - set34(0); + setState(0); if (sentence->get58() != 5) { adjustDial(0, sentence->get58() * 4 - 20); } else if (getDialLevel(0, false) > 65) { @@ -809,7 +809,7 @@ ScriptChangedResult BarbotScript::scriptChanged(TTscriptBase *roomScript, uint i addResponse(getDialogueId(250577)); applyResponse(); } else { - set34(57); + setState(57); } break; @@ -964,7 +964,7 @@ int BarbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); } -int BarbotScript::proc21(int v1, int v2, int v3) { +int BarbotScript::updateState(int oldId, int newId, int index) { warning("TODO"); return 0; } @@ -987,7 +987,7 @@ uint BarbotScript::getDialsBitset() const { } int BarbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { - int v34 = get34(); + int v34 = getState(); uint id = 0; if (v34 > 0x200) { @@ -1150,13 +1150,13 @@ int BarbotScript::applySentenceIds(int dialogueId, int v34) { applyResponse(); if (v34 != -1) { - set34(v34); + setState(v34); } else { for (uint idx = 0; idx < _mappings.size(); ++idx) { const TTscriptMapping &m = _mappings[idx]; for (int vidx = 0; vidx < _mappings._valuesPerMapping; ++idx) { if (m._values[vidx] == (uint)dialogueId) { - proc21(m._id, m._id, vidx); + updateState(m._id, m._id, vidx); break; } } @@ -1171,7 +1171,7 @@ int BarbotScript::setResponse(int dialogueId, int state) { applyResponse(); if (state != -1) - set34(state); + setState(state); return 2; } diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index 977d0a1d6b..dff72d579a 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -73,7 +73,11 @@ public: virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder); - virtual int proc21(int v1, int v2, int v3); + /** + * Handles updating NPC state based on specified dialogue Ids and dial positions + */ + virtual int updateState(int oldId, int newId, int index); + virtual int proc22(int id) const; /** diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 988efa940b..573015c943 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -182,7 +182,7 @@ int BellbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); } -int BellbotScript::proc21(int v1, int v2, int v3) { +int BellbotScript::updateState(int oldId, int newId, int index) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index 704bce815e..235076832f 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -58,7 +58,11 @@ public: virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder); - virtual int proc21(int v1, int v2, int v3); + /** + * Handles updating NPC state based on specified dialogue Ids and dial positions + */ + virtual int updateState(int oldId, int newId, int index); + virtual int proc22(int id) const; virtual int proc23() const; diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index a95e4dffb7..e1c596bf6b 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -180,7 +180,7 @@ int DeskbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, } -int DeskbotScript::proc21(int v1, int v2, int v3) { +int DeskbotScript::updateState(int oldId, int newId, int index) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index efe71de7e2..1481cdd54c 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -56,7 +56,11 @@ public: virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder); - virtual int proc21(int v1, int v2, int v3); + /** + * Handles updating NPC state based on specified dialogue Ids and dial positions + */ + virtual int updateState(int oldId, int newId, int index); + virtual int proc22(int id) const; virtual int proc23() const; virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index bd654fcc0e..4f74b19463 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -83,7 +83,7 @@ int DoorbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence applyResponse(); if (STATE_ARRAY[_state] == 11826) - set34(1); + setState(1); ++_state; return 2; } @@ -250,7 +250,7 @@ int DoorbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); } -int DoorbotScript::proc21(int v1, int v2, int v3) { +int DoorbotScript::updateState(int oldId, int newId, int index) { warning("TODO"); return 0; } @@ -363,9 +363,9 @@ int DoorbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, } break; case 17: - if (get34()) + if (getState()) return 1; - set34(0); + setState(0); break; case 18: if (roomScript->_scriptId == 100) { @@ -468,7 +468,7 @@ int DoorbotScript::setResponse(int dialogueId, int v34) { applyResponse(); if (v34 != -1) - set34(v34); + setState(v34); return 2; } diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 3d2fdfdc26..db81882af5 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -72,7 +72,11 @@ public: virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder); - virtual int proc21(int v1, int v2, int v3); + /** + * Handles updating NPC state based on specified dialogue Ids and dial positions + */ + virtual int updateState(int oldId, int newId, int index); + virtual int proc22(int id) const; /** diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index 30016ac1ac..6e7d16a66b 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -60,7 +60,7 @@ int LiftbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence case MKTAG('A', 'N', 'S', 'W'): if (_state >= 7) { selectResponse(30918); - set34(2); + setState(2); _state = 0; } else { addResponse(STATE_ARRAY[_state++]); @@ -208,7 +208,7 @@ int LiftbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); } -int LiftbotScript::proc21(int v1, int v2, int v3) { +int LiftbotScript::updateState(int oldId, int newId, int index) { warning("TODO"); return 0; } @@ -244,7 +244,7 @@ int LiftbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, 0, 210849, 210850, 210851, 210852, 210838, 210839, 210840, 210841, 0 }; - get34(); + getState(); int stateVal; switch (val1) { @@ -362,7 +362,7 @@ int LiftbotScript::addDialogueAndState(int id, int state) { applyResponse(); if (state != 1) - set34(state); + setState(state); return 2; } @@ -400,14 +400,14 @@ int LiftbotScript::addResponse1(int index, bool flag, int id) { if (index >= 2 && index <= 19 && stateVal > 1) { addResponse(getDialogueId(210203)); applyResponse(); - set34(7); + setState(7); return true; } if (index >= 20 && index <= 27 && stateVal > 2) { addResponse(getDialogueId(210210)); applyResponse(); - set34(8); + setState(8); return true; } diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index ba917f41c2..3aa620db36 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -69,7 +69,11 @@ public: virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder); - virtual int proc21(int v1, int v2, int v3); + /** + * Handles updating NPC state based on specified dialogue Ids and dial positions + */ + virtual int updateState(int oldId, int newId, int index); + virtual int proc22(int id) const; /** diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index 86862a7037..d1d6424c18 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -184,7 +184,7 @@ int MaitreDScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); } -int MaitreDScript::proc21(int v1, int v2, int v3) { +int MaitreDScript::updateState(int oldId, int newId, int index) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index 178979c614..5937b7d740 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -55,7 +55,11 @@ public: virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder); - virtual int proc21(int v1, int v2, int v3); + /** + * Handles updating NPC state based on specified dialogue Ids and dial positions + */ + virtual int updateState(int oldId, int newId, int index); + virtual int proc22(int id) const; virtual int proc23() const; virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index 23ecf35290..51e88ec3ea 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -88,7 +88,7 @@ int CScriptHandler::processInput(TTroomScript *roomScript, TTnpcScript *npcScrip int canProcess = 0; if (result) { - sentence->set34(result); + sentence->setState(result); if (roomScript->canRespond(npcScript, sentence, result)) { canProcess = npcScript->chooseResponse(roomScript, sentence, result); } diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp index 876cd163bb..b1e4351ee5 100644 --- a/engines/titanic/true_talk/succubus_script.cpp +++ b/engines/titanic/true_talk/succubus_script.cpp @@ -84,7 +84,7 @@ ScriptChangedResult SuccUBusScript::scriptChanged(TTscriptBase *roomScript, uint return SCR_1; } -int SuccUBusScript::proc21(int v1, int v2, int v3) { +int SuccUBusScript::updateState(int oldId, int newId, int index) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h index 9e393b84b2..ba8bc610bf 100644 --- a/engines/titanic/true_talk/succubus_script.h +++ b/engines/titanic/true_talk/succubus_script.h @@ -54,7 +54,11 @@ public: */ virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); - virtual int proc21(int v1, int v2, int v3); + /** + * Handles updating NPC state based on specified dialogue Ids and dial positions + */ + virtual int updateState(int oldId, int newId, int index); + virtual int proc23() const; virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); diff --git a/engines/titanic/true_talk/tt_concept.h b/engines/titanic/true_talk/tt_concept.h index 3301926231..88afb6f28b 100644 --- a/engines/titanic/true_talk/tt_concept.h +++ b/engines/titanic/true_talk/tt_concept.h @@ -132,7 +132,7 @@ public: void setFlag(bool val) { _flag = val; } void set1C(int val) { _field1C = val; } int get20() const { return _field20; } - int get34() const { return _field34; } + int getState() const { return _field34; } bool checkWordId1() const; bool checkWordId2() const; diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 3e8564c46c..1c133bd7c8 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -372,8 +372,8 @@ void TTnpcScript::resetRange(int id) { range->_priorIndex = 0; } -int TTnpcScript::proc21(int v1, int v2, int v3) { - return v2; +int TTnpcScript::updateState(int oldId, int newId, int index) { + return newId; } int TTnpcScript::proc22(int id) const { @@ -638,7 +638,7 @@ uint TTnpcScript::getDialogueId(uint tagId) { tagId = getRangeValue(tagId); oldTagId = getDialsBitset(); - uint newId = proc21(origId, tagId, oldTagId); + uint newId = updateState(origId, tagId, oldTagId); if (!newId) return 0; diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 819de77311..1353dcdfe8 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -256,7 +256,11 @@ public: */ virtual void resetRange(int id); - virtual int proc21(int v1, int v2, int v3); + /** + * Handles updating NPC state based on specified dialogue Ids and dial positions + */ + virtual int updateState(int oldId, int newId, int index); + virtual int proc22(int id) const; /** diff --git a/engines/titanic/true_talk/tt_script_base.cpp b/engines/titanic/true_talk/tt_script_base.cpp index c6a197a8a4..e96f877810 100644 --- a/engines/titanic/true_talk/tt_script_base.cpp +++ b/engines/titanic/true_talk/tt_script_base.cpp @@ -26,12 +26,12 @@ namespace Titanic { -TTscriptBase::TTscriptBase(int scriptId, const char *charClass, int v2, +TTscriptBase::TTscriptBase(int scriptId, const char *charClass, int state, const char *charName, int v3, int v4, int v5, int v6, int v7) : _charName(charName), _charClass(charClass), _status(0), _nodesP(nullptr), _id(0), _hist1P(nullptr), _field20(0), _field24(0), _field28(0), _field2C(0), - _field30(0), _field34(0), _hist2P(nullptr), _field3C(0), + _field30(0), _state(0), _hist2P(nullptr), _field3C(0), _respHeadP(nullptr), _respTailP(nullptr), _oldResponseP(nullptr) { if (!isValid()) { if (!v7 || !getStatus()) { @@ -41,7 +41,7 @@ TTscriptBase::TTscriptBase(int scriptId, const char *charClass, int v2, _field28 = v5; _field2C = v6; _field30 = v7; - _field34 = v2; + _state = state; } else { _status = 5; } @@ -79,7 +79,7 @@ void TTscriptBase::reset() { _field28 = -1; _field2C = -1; _field30 = 0; - _field34 = 0; + _state = 0; _hist2P = nullptr; _field3C = 0; _respHeadP = nullptr; diff --git a/engines/titanic/true_talk/tt_script_base.h b/engines/titanic/true_talk/tt_script_base.h index e94bab3277..3060602d1b 100644 --- a/engines/titanic/true_talk/tt_script_base.h +++ b/engines/titanic/true_talk/tt_script_base.h @@ -48,7 +48,7 @@ protected: int _field28; int _field2C; int _field30; - int _field34; + int _state; TThist *_hist2P; int _field3C; TTresponse *_respHeadP; @@ -72,8 +72,15 @@ protected: appendResponse(val1, val2, str); } - void set34(int val) { _field34 = val; } - int get34() const { return _field34; } + /** + * Set the script state + */ + void setState(int state) { _state = state; } + + /** + * Get the current state + */ + int getState() const { return _state; } public: int _id; public: diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index 56ccc5ab04..467f6a188a 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -258,7 +258,7 @@ int TTsentence::is1C(int val, const TTconceptNode *node) const { bool TTsentence::isConcept34(int slotIndex, TTconceptNode *node) { TTconcept *concept = getFrameEntry(slotIndex, node); - return concept && concept->get34(); + return concept && concept->getState(); } bool TTsentence::localWord(const char *str) const { diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index 2e40dd7e93..2900a4d4b3 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -74,7 +74,7 @@ public: TTsentence(const TTsentence *src); ~TTsentence(); - void set34(int v) { _field34 = v; } + void setState(int v) { _field34 = v; } void set38(int v) { _field38 = v; } bool check2C() const { return _field2C > 1 && _field2C <= 10; } int concept18(TTconceptNode *conceptNode) { -- cgit v1.2.3 From 875a9998c5c537f861c5c4e9855bf7d84332cd6b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 27 Jul 2016 22:26:23 -0400 Subject: TITANIC: Added BellbotScript updateState --- engines/titanic/true_talk/bellbot_script.cpp | 142 ++++++++++++++++++++++++++- engines/titanic/true_talk/bellbot_script.h | 16 +++ engines/titanic/true_talk/script_support.cpp | 17 ++++ engines/titanic/true_talk/script_support.h | 10 ++ engines/titanic/true_talk/tt_npc_script.cpp | 2 +- engines/titanic/true_talk/tt_npc_script.h | 2 +- 6 files changed, 185 insertions(+), 4 deletions(-) diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 573015c943..87bdb9373d 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -23,10 +23,14 @@ #include "common/textconsole.h" #include "titanic/true_talk/bellbot_script.h" #include "titanic/true_talk/true_talk_manager.h" +#include "titanic/pet_control/pet_control.h" #include "titanic/core/node_item.h" +#include "titanic/titanic.h" namespace Titanic { +int BellbotScript::_oldId; + BellbotScript::BellbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2) : TTnpcScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0), @@ -183,8 +187,115 @@ int BellbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, } int BellbotScript::updateState(int oldId, int newId, int index) { - warning("TODO"); - return 0; + if (!getValue(25)) { + newId = 202043 - getValue(1) <= 2 ? 994 : 0; + CTrueTalkManager::setFlags(25, 1); + } + + if (oldId == _oldId && _rangeResetCtr >= 3) { + TTscriptRange *range = findRange(oldId); + if (range) + range->_priorIndex = 0; + + _rangeResetCtr = 0; + return getRangeValue(200370); + } + + if (oldId != _oldId) { + _oldId = oldId; + _rangeResetCtr = 0; + } + + if (oldId >= 201709 && oldId <= 201754) { + addResponse(getDialogueId(201705)); + addResponse(getDialogueId(201706)); + newId = getRangeValue(201707); + } + + if (newId == 202276) + newId = addLocation(); + if (newId == 202275) + newId = getStateDialogueId(); + + if (getValue(1) >= 2) { + if (newId == 200840 || newId == 200845 || newId == 200846 || newId == 200851) { + if (getValue(1) == 2) { + newId = 202047; + } else { + newId = getRangeValue(202848); + } + } + } + + if (getValue(1) >= 3) { + if (newId == 200841 || newId == 200842 || newId == 200843 || + newId == 200847 || newId == 200848 || newId == 200854) { + newId = getRangeValue(202038); + } + } + + if (newId == 200264 && getValue(1) == 1) + newId = 200267; + if (newId == 202231 && getValue(1) == 1) + newId = 200848; + + int v4 = getValue(4); + if (newId == 200187 && v4) { + return 200188; + } else if (newId == 200188 && !v4) { + return 200187; + } else if (newId == 200014 && (v4 == 1 || v4 == 2)) { + return 200011; + } else if (newId == 200011 && !v4) { + return 200014; + } + + if (oldId == 200612) { + CTrueTalkManager::setFlags(25, 2); + CTrueTalkManager::setFlags(5, 1); + } + + if (newId == 200423 || newId == 200424 || newId == 200425) { + if (getValue(5)) { + CTrueTalkManager::triggerAction(16, 0); + } else { + newId = 200611; + } + } + + if (oldId == 200261 && getRandomNumber(10) == 1) { + if (getValue(1) >= 3) + newId = getRangeValue(200283); + else if (getValue(1) == 2) + newId = getRangeValue(200279); + } + + if (oldId == 200962) { + if (getValue(1) == 2) + return 200963; + if (getValue(1) == 1) + return 200964; + } + if (oldId == 200989 && getValue(1) <= 2) + return 200990; + + if (oldId == 201760) { + CGameManager *gameManager = g_vm->_trueTalkManager->getGameManager(); + CPetControl *pet = getPetControl(gameManager); + + if (pet) { + bool canSummon = pet->canSummonBot("DoorBot"); + if (canSummon) { + CTrueTalkManager::_v9 = 101; + CTrueTalkManager::triggerAction(5, 0); + } else { + newId = 201857; + } + } + } + + setValue25(newId); + return newId; } int BellbotScript::proc22(int id) const { @@ -289,4 +400,31 @@ int BellbotScript::proc36(int id) const { return 0; } +int BellbotScript::addLocation() { + addResponse(getDialogueId(202228)); + int roomNum, floorNum, elevatorNum; + getAssignedRoom(&roomNum, &floorNum, &elevatorNum); + + addResponse(getDialogueId(202071 + roomNum)); + addResponse(getDialogueId(201933 + floorNum)); + addResponse(getDialogueId(201916 + elevatorNum)); + + return 200858; +} + +int BellbotScript::getStateDialogueId() const { + switch (getValue(1)) { + case 1: + return 201253; + case 2: + return 200282; + default: + return 201246; + } +} + +void BellbotScript::setValue25(int id) { + // TODO +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index 235076832f..e3cea8bc54 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -29,6 +29,7 @@ namespace Titanic { class BellbotScript : public TTnpcScript { private: + static int _oldId; int _array[150]; int _field2D0; int _field2D4; @@ -39,6 +40,21 @@ private: * Setup sentence data */ void setupSentences(); + + /** + * Add the current location to the response + */ + int addLocation(); + + /** + * Get a dialogue Id based on the state + */ + int getStateDialogueId() const; + + /** + * Sets the state value 25 based on the passed Id + */ + void setValue25(int id); public: BellbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); diff --git a/engines/titanic/true_talk/script_support.cpp b/engines/titanic/true_talk/script_support.cpp index dd20edd23d..3a7c33ead4 100644 --- a/engines/titanic/true_talk/script_support.cpp +++ b/engines/titanic/true_talk/script_support.cpp @@ -162,4 +162,21 @@ void TThandleQuoteEntries::load(const char *name) { delete r; } +/*------------------------------------------------------------------------*/ + +void TTupdateStateEntries::load(const char *name) { + Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); + + while (r->pos() < r->size()) { + TTupdateStateEntry ue; + ue._v1 = r->readUint32LE(); + ue._v2 = r->readUint32LE(); + ue._v3 = r->readUint32LE(); + + push_back(ue); + } + + delete r; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/script_support.h b/engines/titanic/true_talk/script_support.h index 625ae3fed3..915b9ebb11 100644 --- a/engines/titanic/true_talk/script_support.h +++ b/engines/titanic/true_talk/script_support.h @@ -142,6 +142,16 @@ public: void load(const char *name); }; +struct TTupdateStateEntry { + uint _v1; + uint _v2; + uint _v3; +}; + +class TTupdateStateEntries : public Common::Array { +public: + void load(const char *name); +}; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 1c133bd7c8..f21111134e 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -559,7 +559,7 @@ int TTnpcScript::getRoom54(int roomId) { return room ? room->_field54 : 0; } -int TTnpcScript::getValue(int testNum) { +int TTnpcScript::getValue(int testNum) const { switch (testNum) { case 0: return CTrueTalkManager::_v2; diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 1353dcdfe8..833262deb8 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -121,7 +121,7 @@ protected: /** * Perform test on various state values */ - int getValue(int testNum); + int getValue(int testNum) const; /** * Gets a random number between 1 and a given max -- cgit v1.2.3 From a185a99a86b44f0a05580b9dc3da308b7666b8bf Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 27 Jul 2016 23:04:26 -0400 Subject: TTIANIC: Added support methods for BellbotScript updateState --- engines/titanic/true_talk/bellbot_script.cpp | 14 +++++++++++--- engines/titanic/true_talk/bellbot_script.h | 3 ++- engines/titanic/true_talk/script_support.cpp | 16 ++++++++++++++++ engines/titanic/true_talk/script_support.h | 12 ++++++++++++ 4 files changed, 41 insertions(+), 4 deletions(-) diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 87bdb9373d..7748a9d222 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -50,6 +50,7 @@ BellbotScript::BellbotScript(int val1, const char *charClass, int v2, _tagMappings.load("TagMap/Bellbot"); _words.load("Words/Bellbot"); _quotes.load("Quotes/Bellbot"); + _states.load("States/Bellbot"); } void BellbotScript::setupSentences() { @@ -294,7 +295,7 @@ int BellbotScript::updateState(int oldId, int newId, int index) { } } - setValue25(newId); + setValue23(newId); return newId; } @@ -423,8 +424,15 @@ int BellbotScript::getStateDialogueId() const { } } -void BellbotScript::setValue25(int id) { - // TODO +void BellbotScript::setValue23(uint id) { + uint val = 0; + for (uint idx = 0; idx < _states.size() && !val; ++idx) { + TTmapEntry &me = _states[idx]; + if (me._src == id) + val = me._dest; + } + + CTrueTalkManager::setFlags(23, val); } } // End of namespace Titanic diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index e3cea8bc54..98dd2c90f0 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -30,6 +30,7 @@ namespace Titanic { class BellbotScript : public TTnpcScript { private: static int _oldId; + TTmapEntries _states; int _array[150]; int _field2D0; int _field2D4; @@ -54,7 +55,7 @@ private: /** * Sets the state value 25 based on the passed Id */ - void setValue25(int id); + void setValue23(uint id); public: BellbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); diff --git a/engines/titanic/true_talk/script_support.cpp b/engines/titanic/true_talk/script_support.cpp index 3a7c33ead4..17820abf0d 100644 --- a/engines/titanic/true_talk/script_support.cpp +++ b/engines/titanic/true_talk/script_support.cpp @@ -179,4 +179,20 @@ void TTupdateStateEntries::load(const char *name) { delete r; } +/*------------------------------------------------------------------------*/ + +void TTmapEntries::load(const char *name) { + Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); + + while (r->pos() < r->size()) { + TTmapEntry me; + me._src = r->readUint32LE(); + me._dest = r->readUint32LE(); + + push_back(me); + } + + delete r; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/script_support.h b/engines/titanic/true_talk/script_support.h index 915b9ebb11..7bc9bb8dfa 100644 --- a/engines/titanic/true_talk/script_support.h +++ b/engines/titanic/true_talk/script_support.h @@ -153,6 +153,18 @@ public: void load(const char *name); }; +struct TTmapEntry { + uint _src; + uint _dest; + + TTmapEntry() : _src(0), _dest(0) {} +}; + +class TTmapEntries : public Common::Array { +public: + void load(const char *name); +}; + } // End of namespace Titanic #endif /* TITANIC_TT_NPC_SCRIPT_H */ -- cgit v1.2.3 From 7a2a705a7a2aeba7ca7d96b0e561b6d4a56fc4a5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 28 Jul 2016 19:00:22 -0400 Subject: TITANIC: Added DeskbotScript updateState --- engines/titanic/true_talk/deskbot_script.cpp | 118 ++++++++++++++++++++++++++- engines/titanic/true_talk/deskbot_script.h | 22 +++++ engines/titanic/true_talk/script_support.cpp | 6 +- engines/titanic/true_talk/script_support.h | 6 +- 4 files changed, 144 insertions(+), 8 deletions(-) diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index e1c596bf6b..facc5fd79a 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -26,6 +26,8 @@ namespace Titanic { +int DeskbotScript::_oldId; + DeskbotScript::DeskbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2) : TTnpcScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0) { @@ -181,8 +183,71 @@ int DeskbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, } int DeskbotScript::updateState(int oldId, int newId, int index) { - warning("TODO"); - return 0; + if (isDial1Medium() || getValue(1) < 4) + CTrueTalkManager::setFlags(22, 1); + + if (newId == 240420 || newId == 240947 || newId == 241261) { + if (getValue(22) && (newId == 240947 || newId == 241261)) + newId = getRangeValue(241184); + } + + if (newId == 240832) + setDialRegion(1, 0); + + if (oldId == 241183) { + if (getValue(1) == 2) + newId = getRangeValue(241182); + else if (getValue(1) == 1) + newId = getRangeValue(241181); + } + + if (newId == 240931 && getValue(1) <= 2) { + newId = 240924; + } else if (newId == 240924 && getValue(1) > 2) { + newId = 240931; + } + + if (newId == 240830 && getValue(1) == 1) { + newId = 240801; + } else if (newId == 240801 && getValue(1) > 1) { + newId = 240830; + } + + if (oldId >= 241217 && oldId <= 241259) { + addResponse(getDialogueId(241202)); + addResponse(getDialogueId(241200)); + newId = getRangeValue(241199); + } + + if (newId == 241354) + newId = addAssignedRoomDialogue2(); + if (newId == 241353) + newId = getStateDialogueId(); + if (newId == 240464 && getValue(1) != 1) + newId = 240462; + + if (newId == 241635 && isDial1Medium()) { + addResponse(getDialogueId(241556)); + newId = getRangeValue(241632); + } + + if (getValue(20) && (oldId == 240569 || oldId == 240576)) + newId = 240460; + if (!getValue(20)) { + if (newId != 240460) + goto exit; + CTrueTalkManager::setFlags(20, 1); + } + if (newId == 240460 && _oldId != 240569) { + CTrueTalkManager::setFlags(20, 0); + newId = 240455; + } + +exit: + _oldId = oldId; + setFlags17(newId, index); + + return newId; } int DeskbotScript::proc22(int id) const { @@ -285,4 +350,53 @@ int DeskbotScript::addAssignedRoomDialogue() { } } +int DeskbotScript::addAssignedRoomDialogue2() { + addResponse(getDialogueId(241355)); + int roomNum = 0, floorNum = 0, elevatorNum = 0; + getAssignedRoom(&roomNum, &floorNum, &elevatorNum); + + addResponse(getDialogueId(241317 + roomNum)); + addResponse(getDialogueId(241271 + floorNum)); + addResponse(getDialogueId(241356)); + addResponse(getDialogueId(241313 + elevatorNum)); + + return 241357; +} + +void DeskbotScript::addAssignedRoomDialogue3() { + addResponse(getDialogueId(241513)); + addResponse(getDialogueId(241510)); + + CTrueTalkManager::setFlags(1, 2); + setDialRegion(0, 0); + setDialRegion(1, 0); + CTrueTalkManager::triggerAction(19, 2); + CTrueTalkManager::setFlags(3, 0); + + int roomNum = 1, floorNum = 1, elevatorNum = 1; + getAssignedRoom(&roomNum, &floorNum, &elevatorNum); + + addResponse(getDialogueId(241317 + roomNum)); + addResponse(getDialogueId(241271 + floorNum)); + addResponse(getDialogueId(241511)); + addResponse(getDialogueId(241313 + elevatorNum)); + addResponse(getDialogueId(241512)); + applyResponse(); +} + +int DeskbotScript::getStateDialogueId() const { + switch (getValue(1)) { + case 1: + return 241503; + case 2: + return 241504; + default: + return 241505; + } +} + +void DeskbotScript::setFlags17(int newId, int index) { + // TODO +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index 1481cdd54c..c1313a0762 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -29,6 +29,8 @@ namespace Titanic { class DeskbotScript : public TTnpcScript { +private: + static int _oldId; private: /** * Setup sentence data @@ -39,6 +41,26 @@ private: * Adds dialogue for the player's assigned room */ int addAssignedRoomDialogue(); + + /** + * Adds dialogue for the player's assigned room + */ + int addAssignedRoomDialogue2(); + + /** + * Adds dialogue for the player's assigned room + */ + void addAssignedRoomDialogue3(); + + /** + * Gets a dialogue Id based on the NPC's state + */ + int getStateDialogueId() const; + + /** + * Sets state data in flags 17 + */ + void setFlags17(int newId, int index); public: DeskbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); diff --git a/engines/titanic/true_talk/script_support.cpp b/engines/titanic/true_talk/script_support.cpp index 17820abf0d..1a3d66ad4a 100644 --- a/engines/titanic/true_talk/script_support.cpp +++ b/engines/titanic/true_talk/script_support.cpp @@ -169,9 +169,9 @@ void TTupdateStateEntries::load(const char *name) { while (r->pos() < r->size()) { TTupdateStateEntry ue; - ue._v1 = r->readUint32LE(); - ue._v2 = r->readUint32LE(); - ue._v3 = r->readUint32LE(); + ue._newId = r->readUint32LE(); + ue._newValue = r->readUint32LE(); + ue._idMatch = r->readUint32LE(); push_back(ue); } diff --git a/engines/titanic/true_talk/script_support.h b/engines/titanic/true_talk/script_support.h index 7bc9bb8dfa..ef71ff08e4 100644 --- a/engines/titanic/true_talk/script_support.h +++ b/engines/titanic/true_talk/script_support.h @@ -143,9 +143,9 @@ public: }; struct TTupdateStateEntry { - uint _v1; - uint _v2; - uint _v3; + uint _newId; + uint _newValue; + uint _idMatch; }; class TTupdateStateEntries : public Common::Array { -- cgit v1.2.3 From f36d392c11ef58c33050d952459870a9c931e427 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 28 Jul 2016 21:03:02 -0400 Subject: DEVTOOLS: Add updateState methods arrays to create_titanic --- devtools/create_titanic/create_titanic_dat.cpp | 4 +- devtools/create_titanic/module.mk | 3 + devtools/create_titanic/script_states.cpp | 548 +++++++++++++++++++++++++ devtools/create_titanic/script_states.h | 43 ++ 4 files changed, 597 insertions(+), 1 deletion(-) create mode 100644 devtools/create_titanic/script_states.cpp create mode 100644 devtools/create_titanic/script_states.h diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index c202e75fcf..cc0283e454 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -39,6 +39,7 @@ #include "script_quotes.h" #include "script_responses.h" #include "script_ranges.h" +#include "script_states.h" #include "tag_maps.h" /** @@ -53,7 +54,7 @@ */ #define VERSION_NUMBER 1 -#define HEADER_SIZE 0x800 +#define HEADER_SIZE 0x880 Common::File inputFile, outputFile; Common::PEResources res; @@ -589,6 +590,7 @@ void writeData() { writeAllScriptResponses(); writeAllScriptRanges(); writeAllTagMappings(); + writeAllUpdateStates(); } void createScriptMap() { diff --git a/devtools/create_titanic/module.mk b/devtools/create_titanic/module.mk index ef5b2a0bdf..aae7b4bc53 100644 --- a/devtools/create_titanic/module.mk +++ b/devtools/create_titanic/module.mk @@ -4,7 +4,10 @@ MODULE := devtools/create_titanic MODULE_OBJS := \ create_titanic_dat.o \ hashmap.o \ + script_quotes.o \ + script_ranges.o \ script_responses.o \ + script_states.o \ str.o \ winexe.o \ winexe_pe.o diff --git a/devtools/create_titanic/script_states.cpp b/devtools/create_titanic/script_states.cpp new file mode 100644 index 0000000000..81157441e4 --- /dev/null +++ b/devtools/create_titanic/script_states.cpp @@ -0,0 +1,548 @@ +/* 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. + * + */ + + // Disable symbol overrides so that we can use system headers. +#define FORBIDDEN_SYMBOL_ALLOW_ALL + +// HACK to allow building with the SDL backend on MinGW +// see bug #1800764 "TOOLS: MinGW tools building broken" +#ifdef main +#undef main +#endif // main + +#include "file.h" +#include "script_states.h" + +static const UpdateState12 BARBOT_STATES[] = { + { 0x0003AB24, 0x00000005, 0x00 }, + { 0x0003AD33, 0x00000005, 0x00 }, + { 0x0003AB40, 0x00000008, 0x00 }, + { 0x0003AC6A, 0x00000008, 0x00 }, + { 0x0003AB3E, 0x00000006, 0x00 }, + { 0x0003AB3D, 0x00000006, 0x00 }, + { 0x0003AB41, 0x00000007, 0x00 }, + { 0x0003AB69, 0x00000008, 0x00 }, + { 0x0003AE6D, 0x0000004E, 0x00 }, + { 0x0003AC69, 0x0000004E, 0x00 }, + { 0x0003AE6E, 0x0000004F, 0x00 }, + { 0x0003AE6F, 0x00000051, 0x00 }, + { 0x0003AE70, 0x00000051, 0x00 }, + { 0x0003AE71, 0x00000051, 0x00 }, + { 0x0003AE72, 0x00000051, 0x00 }, + { 0x0003AE73, 0x00000051, 0x00 }, + { 0x0003AE74, 0x00000051, 0x00 }, + { 0x0003AE75, 0x00000051, 0x00 }, + { 0x0003AE76, 0x00000051, 0x00 }, + { 0x0003AE77, 0x00000051, 0x00 }, + { 0x0003AEB8, 0x00000051, 0x00 }, + { 0x0003AB20, 0x00000009, 0x00 }, + { 0x0003AB14, 0x0000000A, 0x00 }, + { 0x0003AB15, 0x0000000B, 0x00 }, + { 0x0003AB16, 0x0000000C, 0x00 }, + { 0x0003AB63, 0x0000000D, 0x00 }, + { 0x0003AB64, 0x0000000D, 0x00 }, + { 0x0003AB44, 0x00000001, 0x00 }, + { 0x0003AB43, 0x00000001, 0x0B }, + { 0x0003AB2A, 0x00000002, 0x00 }, + { 0x0003AB4A, 0x00000003, 0x0B }, + { 0x0003AB4C, 0x00000003, 0x0B }, + { 0x0003AB65, 0x00000004, 0x00 }, + { 0x0003AB2F, 0x0000000E, 0x00 }, + { 0x0003AB30, 0x0000000F, 0x00 }, + { 0x0003AB17, 0x00000010, 0x0B }, + { 0x0003AB18, 0x00000010, 0x0B }, + { 0x0003AAE3, 0x0000003E, 0x00 }, + { 0x0003AAE4, 0x0000003E, 0x00 }, + { 0x0003AAE5, 0x0000003E, 0x00 }, + { 0x0003AB0F, 0x00000011, 0x00 }, + { 0x0003AB11, 0x00000012, 0x00 }, + { 0x0003AB12, 0x00000013, 0x00 }, + { 0x0003AB13, 0x00000014, 0x00 }, + { 0x0003AADC, 0x00000019, 0x00 }, + { 0x0003AADD, 0x0000001A, 0x00 }, + { 0x0003AADE, 0x0000001B, 0x00 }, + { 0x0003AAFD, 0x00000015, 0x00 }, + { 0x0003AAFE, 0x00000016, 0x00 }, + { 0x0003AAFF, 0x00000017, 0x00 }, + { 0x0003AB00, 0x00000018, 0x00 }, + { 0x0003AAF4, 0x0000001C, 0x00 }, + { 0x0003AAF5, 0x0000001D, 0x00 }, + { 0x0003AAF6, 0x0000001E, 0x00 }, + { 0x0003AAD9, 0x0000001F, 0x00 }, + { 0x0003AADA, 0x00000020, 0x00 }, + { 0x0003AADB, 0x00000021, 0x00 }, + { 0x0003AAF7, 0x00000022, 0x00 }, + { 0x0003AAF8, 0x00000023, 0x00 }, + { 0x0003AAF9, 0x00000024, 0x00 }, + { 0x0003AB04, 0x0000002C, 0x00 }, + { 0x0003AB05, 0x0000002D, 0x00 }, + { 0x0003AB06, 0x0000002E, 0x00 }, + { 0x0003AADF, 0x00000029, 0x00 }, + { 0x0003AAE0, 0x0000002A, 0x00 }, + { 0x0003AAE1, 0x0000002B, 0x00 }, + { 0x0003AB07, 0x00000038, 0x00 }, + { 0x0003AB08, 0x00000039, 0x00 }, + { 0x0003AB09, 0x0000003A, 0x00 }, + { 0x0003AB01, 0x0000003B, 0x00 }, + { 0x0003AB02, 0x0000003C, 0x00 }, + { 0x0003AB03, 0x0000003D, 0x00 }, + { 0x0003AAF0, 0x00000025, 0x00 }, + { 0x0003AAF1, 0x00000026, 0x00 }, + { 0x0003AAF2, 0x00000027, 0x00 }, + { 0x0003AAF3, 0x00000028, 0x00 }, + { 0x0003AB0A, 0x0000002F, 0x00 }, + { 0x0003AB0B, 0x00000030, 0x00 }, + { 0x0003AB0C, 0x00000031, 0x00 }, + { 0x0003AB0D, 0x00000032, 0x00 }, + { 0x0003AAEA, 0x00000033, 0x00 }, + { 0x0003AAEB, 0x00000034, 0x00 }, + { 0x0003AAEC, 0x00000035, 0x00 }, + { 0x0003AAED, 0x00000036, 0x00 }, + { 0x0003AAEE, 0x00000037, 0x00 }, + { 0x0003ACC3, 0x0000003F, 0x00 }, + { 0x0003ACC4, 0x00000040, 0x00 }, + { 0x0003ACC5, 0x00000041, 0x00 }, + { 0x0003ACC6, 0x00000042, 0x00 }, + { 0x0003ACC7, 0x00000043, 0x00 }, + { 0x0003ACC8, 0x00000044, 0x00 }, + { 0x0003ADCF, 0x00000045, 0x00 }, + { 0x0003ADD0, 0x00000046, 0x00 }, + { 0x0003ADD1, 0x00000047, 0x00 }, + { 0x0003ADD2, 0x00000048, 0x00 }, + { 0x0003ADD3, 0x00000049, 0x00 }, + { 0x0003ACA4, 0x0000004A, 0x00 }, + { 0x0003ACA7, 0x0000004B, 0x00 }, + { 0x0003ADD5, 0x0000004C, 0x00 }, + { 0x0003AC7E, 0x0000004C, 0x00 }, + { 0x0003ABF9, 0x0000004C, 0x00 }, + { 0x0003AD14, 0x0000004C, 0x00 }, + { 0x0003AD15, 0x0000004C, 0x00 }, + { 0x0003AD10, 0x0000004C, 0x00 }, + { 0x0003AD17, 0x0000004C, 0x00 }, + { 0x0003AD21, 0x0000004C, 0x00 }, + { 0x0003AD2F, 0x0000004C, 0x00 }, + { 0x0003AC7F, 0x0000004D, 0x00 }, + { 0x0003AEBA, 0x00000052, 0x0E }, + { 0x0003AED5, 0x00000053, 0x00 }, + { 0x0003B034, 0x00000054, 0x00 }, + { 0x0003B037, 0x00000054, 0x00 }, + { 0x0003B036, 0x00000055, 0x00 }, + { 0x0003B035, 0x00000055, 0x00 }, + { 0x0003B02D, 0x00000055, 0x00 }, + { 0x0003B02F, 0x00000055, 0x00 }, + { 0x0003B02E, 0x00000056, 0x00 }, + { 0x0003B031, 0x00000056, 0x00 }, + { 0x0003B033, 0x00000056, 0x00 }, + { 0x0003B032, 0x00000057, 0x00 }, + { 0x0003B023, 0x00000057, 0x00 }, + { 0x0003B025, 0x00000057, 0x00 }, + { 0x0003B024, 0x00000058, 0x00 }, + { 0x0003B017, 0x00000058, 0x00 }, + { 0x0003B01C, 0x00000058, 0x00 }, + { 0x0003B01A, 0x00000059, 0x00 }, + { 0x0003B01B, 0x0000005A, 0x00 }, + { 0x0003B018, 0x0000005B, 0x00 }, + { 0x0003B019, 0x0000005D, 0x00 }, + { 0x0003B01D, 0x0000005D, 0x00 }, + { 0x0003B01E, 0x0000005D, 0x00 }, + { 0x0003B01F, 0x0000005D, 0x00 }, + { 0x0003B026, 0x0000005D, 0x00 }, + { 0x0003B027, 0x0000005D, 0x00 }, + { 0x0003B028, 0x0000005D, 0x00 }, + { 0x0003B029, 0x0000005D, 0x00 }, + { 0x0003B030, 0x0000005D, 0x00 }, + { 0x0003B02A, 0x0000005E, 0x00 }, + { 0x0003ABF7, 0x0000005F, 0x00 }, + { 0x0003AF6A, 0x00000060, 0x00 }, + { 0x0003AEC6, 0x00000061, 0x00 }, + { 0x00000000, 0x00000000, 0x00 } +}; + +static const UpdateState8 BELLBOT_STATES[] = { + { 0x00031070, 0x00000001 }, { 0x0003107B, 0x00000002 }, { 0x0003107E, 0x00000003 }, + { 0x0003104F, 0x00000004 }, { 0x00030F23, 0x00000005 }, { 0x00030F2A, 0x00000006 }, + { 0x00030F31, 0x00000007 }, { 0x00030F32, 0x00000007 }, { 0x00030F33, 0x00000007 }, + { 0x00030F34, 0x00000007 }, { 0x00030F35, 0x00000007 }, { 0x00030F36, 0x00000007 }, + { 0x00030F37, 0x00000008 }, { 0x00030F2E, 0x00000009 }, { 0x00030E78, 0x0000000A }, + { 0x00030E42, 0x0000000C }, { 0x00030E0C, 0x0000000D }, { 0x00030E9C, 0x0000000E }, + { 0x00030DC1, 0x0000000F }, { 0x00030DC2, 0x00000010 }, { 0x00030D6B, 0x00000011 }, + { 0x00030D6C, 0x00000011 }, { 0x00030E1D, 0x00000012 }, { 0x00030E1E, 0x00000013 }, + { 0x00030E3B, 0x00000014 }, { 0x00030EBA, 0x00000015 }, { 0x00031086, 0x00000016 }, + { 0x000310A4, 0x00000017 }, { 0x00031058, 0x00000018 }, { 0x00031059, 0x00000019 }, + { 0x00030E3F, 0x0000001A }, { 0x00030EBC, 0x0000001B }, { 0x00030E9B, 0x0000001C }, + { 0x00030E32, 0x0000001D }, { 0x00030E76, 0x0000001E }, { 0x00031060, 0x0000001F }, + { 0x00031065, 0x00000020 }, { 0x00031075, 0x00000021 }, { 0x00031077, 0x00000022 }, + { 0x00031041, 0x00000023 }, { 0x00031038, 0x00000024 }, { 0x00030FAB, 0x00000025 }, + { 0x00030FAF, 0x00000026 }, { 0x00030FB1, 0x00000027 }, { 0x00030FB8, 0x00000028 }, + { 0x00030FB2, 0x00000029 }, { 0x00030FC1, 0x0000002A }, { 0x00030FC2, 0x0000002B }, + { 0x00030FA4, 0x0000002C }, { 0x00030FA5, 0x0000002D }, { 0x00030FA7, 0x0000002E }, + { 0x00030FA8, 0x0000002C }, { 0x00030FA6, 0x0000002C }, { 0x00030EAD, 0x0000002F }, + { 0x00030EAE, 0x00000030 }, { 0x00030ED6, 0x00000031 }, { 0x00030ED7, 0x00000032 }, + { 0x00030ED8, 0x00000033 }, { 0x000310A9, 0x00000034 }, { 0x00030F4C, 0x00000035 }, + { 0x00030DA7, 0x00000036 }, { 0x00030D9F, 0x00000037 }, { 0x00030FC8, 0x00000038 }, + { 0x00030FC9, 0x00000039 }, { 0x00030FCF, 0x0000003A }, { 0x00030FCA, 0x0000003B }, + { 0x00030FCB, 0x0000003C }, { 0x00030FCC, 0x0000003D }, { 0x00030E41, 0x0000003E }, + { 0x00030E12, 0x0000003F }, { 0x00030D72, 0x00000040 }, { 0x00030D76, 0x00000041 }, + { 0x00030D78, 0x00000042 }, { 0x00030D79, 0x00000043 }, { 0x000310AE, 0x00000044 }, + { 0x0003112C, 0x00000044 }, { 0x00031132, 0x00000045 }, { 0x00031133, 0x00000046 }, + { 0x00031134, 0x00000047 }, { 0x000310D7, 0x00000048 }, { 0x0003113C, 0x00000049 }, + { 0x0003113E, 0x0000004A }, { 0x0003113D, 0x0000004A }, { 0x00031146, 0x0000004B }, + { 0x00031149, 0x0000004C }, { 0x0003114A, 0x0000004D }, { 0x0003114E, 0x0000004E }, + { 0x00031151, 0x0000004E }, { 0x0003114F, 0x0000004E }, { 0x00031152, 0x0000004E }, + { 0x0003115B, 0x0000004F }, { 0x00031163, 0x00000050 }, { 0x00031164, 0x00000051 }, + { 0x00031165, 0x00000051 }, { 0x00031166, 0x00000051 }, { 0x00031167, 0x00000052 }, + { 0x0003117A, 0x00000053 }, { 0x0003149A, 0x00000054 }, { 0x00031454, 0x00000055 }, + { 0x0003157B, 0x00000056 }, { 0x00031177, 0x00000057 }, { 0x00031171, 0x00000057 }, + { 0x0003117A, 0x00000057 }, { 0x00031507, 0x00000057 }, { 0x0003159D, 0x00000058 }, + { 0x000315DD, 0x00000059 }, { 0x00031147, 0x0000005A }, { 0x00031148, 0x0000005A }, + { 0x00000000, 0x00000000 } +}; + +static const UpdateState12 DESKBOT_STATES[] = { + { 0x0003AB24, 0x00000005, 0x00 }, + { 0x0003AD33, 0x00000005, 0x00 }, + { 0x0003AB40, 0x00000008, 0x00 }, + { 0x0003AC6A, 0x00000008, 0x00 }, + { 0x0003AB3E, 0x00000006, 0x00 }, + { 0x0003AB3D, 0x00000006, 0x00 }, + { 0x0003AB41, 0x00000007, 0x00 }, + { 0x0003AB69, 0x00000008, 0x00 }, + { 0x0003AE6D, 0x0000004E, 0x00 }, + { 0x0003AC69, 0x0000004E, 0x00 }, + { 0x0003AE6E, 0x0000004F, 0x00 }, + { 0x0003AE6F, 0x00000051, 0x00 }, + { 0x0003AE70, 0x00000051, 0x00 }, + { 0x0003AE71, 0x00000051, 0x00 }, + { 0x0003AE72, 0x00000051, 0x00 }, + { 0x0003AE73, 0x00000051, 0x00 }, + { 0x0003AE74, 0x00000051, 0x00 }, + { 0x0003AE75, 0x00000051, 0x00 }, + { 0x0003AE76, 0x00000051, 0x00 }, + { 0x0003AE77, 0x00000051, 0x00 }, + { 0x0003AEB8, 0x00000051, 0x00 }, + { 0x0003AB20, 0x00000009, 0x00 }, + { 0x0003AB14, 0x0000000A, 0x00 }, + { 0x0003AB15, 0x0000000B, 0x00 }, + { 0x0003AB16, 0x0000000C, 0x00 }, + { 0x0003AB63, 0x0000000D, 0x00 }, + { 0x0003AB64, 0x0000000D, 0x00 }, + { 0x0003AB44, 0x00000001, 0x00 }, + { 0x0003AB43, 0x00000001, 0x0B }, + { 0x0003AB2A, 0x00000002, 0x00 }, + { 0x0003AB4A, 0x00000003, 0x0B }, + { 0x0003AB4C, 0x00000003, 0x0B }, + { 0x0003AB65, 0x00000004, 0x00 }, + { 0x0003AB2F, 0x0000000E, 0x00 }, + { 0x0003AB30, 0x0000000F, 0x00 }, + { 0x0003AB17, 0x00000010, 0x0B }, + { 0x0003AB18, 0x00000010, 0x0B }, + { 0x0003AAE3, 0x0000003E, 0x00 }, + { 0x0003AAE4, 0x0000003E, 0x00 }, + { 0x0003AAE5, 0x0000003E, 0x00 }, + { 0x0003AB0F, 0x00000011, 0x00 }, + { 0x0003AB11, 0x00000012, 0x00 }, + { 0x0003AB12, 0x00000013, 0x00 }, + { 0x0003AB13, 0x00000014, 0x00 }, + { 0x0003AADC, 0x00000019, 0x00 }, + { 0x0003AADD, 0x0000001A, 0x00 }, + { 0x0003AADE, 0x0000001B, 0x00 }, + { 0x0003AAFD, 0x00000015, 0x00 }, + { 0x0003AAFE, 0x00000016, 0x00 }, + { 0x0003AAFF, 0x00000017, 0x00 }, + { 0x0003AB00, 0x00000018, 0x00 }, + { 0x0003AAF4, 0x0000001C, 0x00 }, + { 0x0003AAF5, 0x0000001D, 0x00 }, + { 0x0003AAF6, 0x0000001E, 0x00 }, + { 0x0003AAD9, 0x0000001F, 0x00 }, + { 0x0003AADA, 0x00000020, 0x00 }, + { 0x0003AADB, 0x00000021, 0x00 }, + { 0x0003AAF7, 0x00000022, 0x00 }, + { 0x0003AAF8, 0x00000023, 0x00 }, + { 0x0003AAF9, 0x00000024, 0x00 }, + { 0x0003AB04, 0x0000002C, 0x00 }, + { 0x0003AB05, 0x0000002D, 0x00 }, + { 0x0003AB06, 0x0000002E, 0x00 }, + { 0x0003AADF, 0x00000029, 0x00 }, + { 0x0003AAE0, 0x0000002A, 0x00 }, + { 0x0003AAE1, 0x0000002B, 0x00 }, + { 0x0003AB07, 0x00000038, 0x00 }, + { 0x0003AB08, 0x00000039, 0x00 }, + { 0x0003AB09, 0x0000003A, 0x00 }, + { 0x0003AB01, 0x0000003B, 0x00 }, + { 0x0003AB02, 0x0000003C, 0x00 }, + { 0x0003AB03, 0x0000003D, 0x00 }, + { 0x0003AAF0, 0x00000025, 0x00 }, + { 0x0003AAF1, 0x00000026, 0x00 }, + { 0x0003AAF2, 0x00000027, 0x00 }, + { 0x0003AAF3, 0x00000028, 0x00 }, + { 0x0003AB0A, 0x0000002F, 0x00 }, + { 0x0003AB0B, 0x00000030, 0x00 }, + { 0x0003AB0C, 0x00000031, 0x00 }, + { 0x0003AB0D, 0x00000032, 0x00 }, + { 0x0003AAEA, 0x00000033, 0x00 }, + { 0x0003AAEB, 0x00000034, 0x00 }, + { 0x0003AAEC, 0x00000035, 0x00 }, + { 0x0003AAED, 0x00000036, 0x00 }, + { 0x0003AAEE, 0x00000037, 0x00 }, + { 0x0003ACC3, 0x0000003F, 0x00 }, + { 0x0003ACC4, 0x00000040, 0x00 }, + { 0x0003ACC5, 0x00000041, 0x00 }, + { 0x0003ACC6, 0x00000042, 0x00 }, + { 0x0003ACC7, 0x00000043, 0x00 }, + { 0x0003ACC8, 0x00000044, 0x00 }, + { 0x0003ADCF, 0x00000045, 0x00 }, + { 0x0003ADD0, 0x00000046, 0x00 }, + { 0x0003ADD1, 0x00000047, 0x00 }, + { 0x0003ADD2, 0x00000048, 0x00 }, + { 0x0003ADD3, 0x00000049, 0x00 }, + { 0x0003ACA4, 0x0000004A, 0x00 }, + { 0x0003ACA7, 0x0000004B, 0x00 }, + { 0x0003ADD5, 0x0000004C, 0x00 }, + { 0x0003AC7E, 0x0000004C, 0x00 }, + { 0x0003ABF9, 0x0000004C, 0x00 }, + { 0x0003AD14, 0x0000004C, 0x00 }, + { 0x0003AD15, 0x0000004C, 0x00 }, + { 0x0003AD10, 0x0000004C, 0x00 }, + { 0x0003AD17, 0x0000004C, 0x00 }, + { 0x0003AD21, 0x0000004C, 0x00 }, + { 0x0003AD2F, 0x0000004C, 0x00 }, + { 0x0003AC7F, 0x0000004D, 0x00 }, + { 0x0003AEBA, 0x00000052, 0x0E }, + { 0x0003AED5, 0x00000053, 0x00 }, + { 0x0003B034, 0x00000054, 0x00 }, + { 0x0003B037, 0x00000054, 0x00 }, + { 0x0003B036, 0x00000055, 0x00 }, + { 0x0003B035, 0x00000055, 0x00 }, + { 0x0003B02D, 0x00000055, 0x00 }, + { 0x0003B02F, 0x00000055, 0x00 }, + { 0x0003B02E, 0x00000056, 0x00 }, + { 0x0003B031, 0x00000056, 0x00 }, + { 0x0003B033, 0x00000056, 0x00 }, + { 0x0003B032, 0x00000057, 0x00 }, + { 0x0003B023, 0x00000057, 0x00 }, + { 0x0003B025, 0x00000057, 0x00 }, + { 0x0003B024, 0x00000058, 0x00 }, + { 0x0003B017, 0x00000058, 0x00 }, + { 0x0003B01C, 0x00000058, 0x00 }, + { 0x0003B01A, 0x00000059, 0x00 }, + { 0x0003B01B, 0x0000005A, 0x00 }, + { 0x0003B018, 0x0000005B, 0x00 }, + { 0x0003B019, 0x0000005D, 0x00 }, + { 0x0003B01D, 0x0000005D, 0x00 }, + { 0x0003B01E, 0x0000005D, 0x00 }, + { 0x0003B01F, 0x0000005D, 0x00 }, + { 0x0003B026, 0x0000005D, 0x00 }, + { 0x0003B027, 0x0000005D, 0x00 }, + { 0x0003B028, 0x0000005D, 0x00 }, + { 0x0003B029, 0x0000005D, 0x00 }, + { 0x0003B030, 0x0000005D, 0x00 }, + { 0x0003B02A, 0x0000005E, 0x00 }, + { 0x0003ABF7, 0x0000005F, 0x00 }, + { 0x0003AF6A, 0x00000060, 0x00 }, + { 0x0003AEC6, 0x00000061, 0x00 }, + { 0x00000000, 0x00000000, 0x00 } +}; + +static const UpdateState12 DOORBOT_STATES[] = { + { 0x00035BD0, 0x00000004, 0x06 }, + { 0x00035BE7, 0x00000005, 0x00 }, + { 0x00035BED, 0x00000006, 0x0A }, + { 0x00035E41, 0x0000000C, 0x0A }, + { 0x00035F9D, 0x0000000F, 0x00 }, + { 0x00035F81, 0x00000010, 0x00 }, + { 0x00035F82, 0x00000010, 0x00 }, + { 0x00035F83, 0x00000010, 0x00 }, + { 0x00035F84, 0x00000010, 0x00 }, + { 0x00035F85, 0x00000010, 0x00 }, + { 0x00035FC5, 0x00000011, 0x00 }, + { 0x00035B6C, 0x00000021, 0x02 }, + { 0x00035B6D, 0x00000022, 0x02 }, + { 0x00035FCD, 0x00000012, 0x00 }, + { 0x00035EF0, 0x00000020, 0x00 }, + { 0x00035EF1, 0x00000020, 0x00 }, + { 0x00035F0A, 0x00000020, 0x00 }, + { 0x000362B0, 0x00000013, 0x00 }, + { 0x000362B1, 0x00000013, 0x00 }, + { 0x000362B2, 0x00000013, 0x00 }, + { 0x000362B3, 0x00000013, 0x00 }, + { 0x000362B4, 0x00000013, 0x00 }, + { 0x000362B5, 0x00000013, 0x00 }, + { 0x000362B9, 0x00000013, 0x00 }, + { 0x000362BB, 0x00000013, 0x00 }, + { 0x000362BA, 0x00000013, 0x00 }, + { 0x000362BC, 0x00000013, 0x00 }, + { 0x000362B8, 0x00000013, 0x00 }, + { 0x000362BD, 0x00000013, 0x00 }, + { 0x000362BE, 0x00000013, 0x00 }, + { 0x000362BF, 0x00000013, 0x00 }, + { 0x000362C0, 0x00000013, 0x00 }, + { 0x000362C1, 0x00000013, 0x00 }, + { 0x000362C2, 0x00000013, 0x00 }, + { 0x000362B6, 0x00000014, 0x00 }, + { 0x00035F8A, 0x00000015, 0x00 }, + { 0x00036407, 0x00000016, 0x00 }, + { 0x0003640C, 0x00000016, 0x00 }, + { 0x0003641A, 0x00000016, 0x00 }, + { 0x00036420, 0x00000016, 0x00 }, + { 0x00036421, 0x00000016, 0x00 }, + { 0x00036422, 0x00000016, 0x00 }, + { 0x00036408, 0x00000016, 0x00 }, + { 0x0003640A, 0x00000016, 0x00 }, + { 0x0003640B, 0x00000016, 0x00 }, + { 0x0003640D, 0x00000018, 0x00 }, + { 0x00036415, 0x00000016, 0x00 }, + { 0x00036416, 0x00000016, 0x00 }, + { 0x00036417, 0x00000016, 0x00 }, + { 0x00036418, 0x00000016, 0x00 }, + { 0x00036419, 0x00000016, 0x00 }, + { 0x0003640E, 0x00000016, 0x00 }, + { 0x0003640F, 0x00000016, 0x00 }, + { 0x00036410, 0x00000016, 0x00 }, + { 0x00036411, 0x00000019, 0x00 }, + { 0x00036412, 0x0000001A, 0x00 }, + { 0x0003641B, 0x00000016, 0x00 }, + { 0x0003641C, 0x00000016, 0x00 }, + { 0x0003641D, 0x00000016, 0x00 }, + { 0x0003641F, 0x00000016, 0x00 }, + { 0x00035FF6, 0x0000001B, 0x00 }, + { 0x00035FF7, 0x0000001C, 0x00 }, + { 0x00035FF8, 0x0000001D, 0x00 }, + { 0x00035FF9, 0x0000001E, 0x00 }, + { 0x0003627F, 0x00000023, 0x00 }, + { 0x00036280, 0x00000024, 0x00 }, + { 0x00036281, 0x00000025, 0x00 }, + { 0x00036282, 0x00000025, 0x00 }, + { 0x00036457, 0x00000026, 0x00 }, + { 0x00000000, 0x00000000, 0x00 } +}; + +static const UpdateState8 LIFTBOT_STATES[] = { + { 0x000335D6, 0x00000004 }, + { 0x000337A7, 0x00000005 }, + { 0x00033781, 0x00000006 }, + { 0x0003381A, 0x00000009 }, + { 0x0003381B, 0x00000009 }, + { 0x0003381E, 0x00000009 }, + { 0x0003381F, 0x00000009 }, + { 0x00033820, 0x00000009 }, + { 0x00033821, 0x00000009 }, + { 0x00033822, 0x00000009 }, + { 0x00033823, 0x00000009 }, + { 0x00033824, 0x00000009 }, + { 0x00033825, 0x00000009 }, + { 0x0003381C, 0x00000009 }, + { 0x0003381D, 0x00000009 }, + { 0x00000000, 0x00000000 } +}; + +static const UpdateState8 MAITRED_STATES[] = { + { 0x0003F7D4, 0x00000002 }, + { 0x0003F808, 0x00000003 }, + { 0x0003F809, 0x00000009 }, + { 0x0003F7F9, 0x00000009 }, + { 0x0003F7D2, 0x00000009 }, + { 0x0003F7F6, 0x00000004 }, + { 0x0003F7D3, 0x00000005 }, + { 0x0003F800, 0x00000006 }, + { 0x0003F801, 0x00000007 }, + { 0x0003F7FC, 0x00000008 }, + { 0x0003F7FD, 0x00000008 }, + { 0x0003F7F8, 0x00000008 }, + { 0x0003F7FA, 0x00000008 }, + { 0x0003F7F1, 0x0000000A }, + { 0x0003F7F2, 0x0000000A }, + { 0x0003F7F3, 0x0000000A }, + { 0x0003F7F4, 0x0000000A }, + { 0x0003F7F5, 0x0000000A }, + { 0x0003F877, 0x0000000B }, + { 0x0003FA55, 0x0000000C }, + { 0x0003F863, 0x0000000C }, + { 0x0003F864, 0x0000000C }, + { 0x0003F865, 0x0000000C }, + { 0x0003F866, 0x0000000D }, + { 0x0003F867, 0x0000000E }, + { 0x0003F86E, 0x0000000E }, + { 0x0003F868, 0x0000000F }, + { 0x0003F869, 0x0000000C }, + { 0x0003F870, 0x00000010 }, + { 0x0003F87C, 0x00000011 }, + { 0x0003F87D, 0x00000011 }, + { 0x0003F886, 0x00000012 }, + { 0x0003F889, 0x00000013 }, + { 0x0003F88A, 0x00000014 }, + { 0x0003F88B, 0x00000015 }, + { 0x0003F88C, 0x00000015 }, + { 0x0003F88D, 0x00000016 }, + { 0x0003F88E, 0x00000016 }, + { 0x0003F895, 0x00000016 }, + { 0x0003F893, 0x00000017 }, + { 0x0003F89A, 0x00000018 }, + { 0x0003F875, 0x00000019 }, + { 0x0003F89C, 0x00000019 }, + { 0x0003F8A3, 0x00000019 }, + { 0x0003F8A2, 0x00000019 }, + { 0x0003F89D, 0x0000001A }, + { 0x0003F89E, 0x0000001A }, + { 0x0003F89F, 0x0000001A }, + { 0x0003F8A5, 0x0000001B }, + { 0x0003F921, 0x0000001C }, + { 0x0003F922, 0x0000001C }, + { 0x0003FA56, 0x0000001E }, + { 0x00000000, 0x00000000 } +}; + +void writeUpdateStates(const char *name, const UpdateState8 *states) { + outputFile.seek(dataOffset); + + for (; states->_src; ++states) { + outputFile.writeLong(states->_src); + outputFile.writeLong(states->_dest); + } + + uint size = outputFile.size() - dataOffset; + writeEntryHeader(name, dataOffset, size); + dataOffset += size; +} + +void writeUpdateStates(const char *name, const UpdateState12 *states) { + outputFile.seek(dataOffset); + + for (; states->_newId; ++states) { + outputFile.writeLong(states->_newId); + outputFile.writeLong(states->_newValue); + outputFile.writeLong(states->_idMatch); + } + + uint size = outputFile.size() - dataOffset; + writeEntryHeader(name, dataOffset, size); + dataOffset += size; +} + +void writeAllUpdateStates() { + writeUpdateStates("States/Barbot", BARBOT_STATES); + writeUpdateStates("States/Bellbot", BELLBOT_STATES); + writeUpdateStates("States/Deskbot", DESKBOT_STATES); + writeUpdateStates("States/Doorbot", DOORBOT_STATES); + writeUpdateStates("States/Liftbot", LIFTBOT_STATES); + writeUpdateStates("States/MaitreD", MAITRED_STATES); + +} \ No newline at end of file diff --git a/devtools/create_titanic/script_states.h b/devtools/create_titanic/script_states.h new file mode 100644 index 0000000000..27dfe22ed4 --- /dev/null +++ b/devtools/create_titanic/script_states.h @@ -0,0 +1,43 @@ +/* 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. + * + */ + +#ifndef COMMON_SCRIPT_STATES_H +#define COMMON_SCRIPT_STATES_H + +#include "common/scummsys.h" + +struct UpdateState12 { + uint _newId; + uint _newValue; + uint _idMatch; +}; + +struct UpdateState8 { + uint _src; + uint _dest; +}; + +extern void writeAllUpdateStates(); +extern void writeEntryHeader(const char *name, uint offset, uint size); +extern uint dataOffset; + +#endif -- cgit v1.2.3 From 52b6c92ac0ac843ef1c7e54ee187fb0a16f381eb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 28 Jul 2016 21:17:01 -0400 Subject: TITANIC: Add loading of updateState arrays --- engines/titanic/true_talk/barbot_script.cpp | 1 + engines/titanic/true_talk/barbot_script.h | 1 + engines/titanic/true_talk/bellbot_script.cpp | 6 +++--- engines/titanic/true_talk/bellbot_script.h | 2 +- engines/titanic/true_talk/deskbot_script.cpp | 1 + engines/titanic/true_talk/deskbot_script.h | 1 + engines/titanic/true_talk/doorbot_script.cpp | 11 ++++++----- engines/titanic/true_talk/doorbot_script.h | 3 ++- engines/titanic/true_talk/liftbot_script.cpp | 11 +++++++---- engines/titanic/true_talk/liftbot_script.h | 3 ++- engines/titanic/true_talk/maitred_script.cpp | 1 + engines/titanic/true_talk/maitred_script.h | 2 ++ engines/titanic/true_talk/script_support.cpp | 22 +++++++++++----------- engines/titanic/true_talk/script_support.h | 22 ++++++++++++---------- 14 files changed, 51 insertions(+), 36 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index 11197220fa..345e9a3f0e 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -51,6 +51,7 @@ BarbotScript::BarbotScript(int val1, const char *charClass, int v2, setupSentences(); _tagMappings.load("TagMap/Barbot"); _quotes.load("Quotes/Barbot"); + _states.load("States/Barbot"); } void BarbotScript::setupSentences() { diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index dff72d579a..ba6c5e9000 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -32,6 +32,7 @@ private: int _state; int _arrIndex; TTsentenceEntries _entries2; + TTupdateState3Array _states; private: /** * Adjust a given dial number by a given delta amount diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 7748a9d222..3eb840f9ba 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -427,9 +427,9 @@ int BellbotScript::getStateDialogueId() const { void BellbotScript::setValue23(uint id) { uint val = 0; for (uint idx = 0; idx < _states.size() && !val; ++idx) { - TTmapEntry &me = _states[idx]; - if (me._src == id) - val = me._dest; + TTupdateState2 &us = _states[idx]; + if (us._src == id) + val = us._dest; } CTrueTalkManager::setFlags(23, val); diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index 98dd2c90f0..ef11985fac 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -30,7 +30,7 @@ namespace Titanic { class BellbotScript : public TTnpcScript { private: static int _oldId; - TTmapEntries _states; + TTupdateState2Array _states; int _array[150]; int _field2D0; int _field2D4; diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index facc5fd79a..a10aef25fc 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -48,6 +48,7 @@ DeskbotScript::DeskbotScript(int val1, const char *charClass, int v2, _tagMappings.load("TagMap/Deskbot"); _words.load("Words/Deskbot"); _quotes.load("Quotes/Deskbot"); + _states.load("States/Deskbot"); } void DeskbotScript::setupSentences() { diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index c1313a0762..628a7432b8 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -31,6 +31,7 @@ namespace Titanic { class DeskbotScript : public TTnpcScript { private: static int _oldId; + TTupdateState3Array _states; private: /** * Setup sentence data diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 4f74b19463..700ad3a666 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -60,6 +60,7 @@ DoorbotScript::DoorbotScript(int val1, const char *charClass, int v2, _tagMappings.load("TagMap/Doorbot"); _words.load("Words/Doorbot"); _quotes.load("Quotes/Doorbot"); + _states.load("States/Doorbot"); } void DoorbotScript::setupSentences() { @@ -77,14 +78,14 @@ void DoorbotScript::setupSentences() { int DoorbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { if (tag == MKTAG('D', 'N', 'A', '1') || tag == MKTAG('H', 'H', 'G', 'Q') || tag == MKTAG('A', 'N', 'S', 'W') || tag == MKTAG('S', 'U', 'M', 'S')) { - if (_state > 9) - _state = 0; - addResponse(STATE_ARRAY[_state]); + if (_stateIndex > 9) + _stateIndex = 0; + addResponse(STATE_ARRAY[_stateIndex]); applyResponse(); - if (STATE_ARRAY[_state] == 11826) + if (STATE_ARRAY[_stateIndex] == 11826) setState(1); - ++_state; + ++_stateIndex; return 2; } diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index db81882af5..fa7d39020d 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -29,7 +29,8 @@ namespace Titanic { class DoorbotScript : public TTnpcScript { private: - int _state; + TTupdateState3Array _states; + int _stateIndex; private: /** * Setup sentence data diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index 6e7d16a66b..04a5c15af8 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -26,6 +26,8 @@ namespace Titanic { +int LiftbotScript::_stateIndex; + static const int STATE_ARRAY[7] = { 0x78BE, 0x78C0, 0x78C1, 0x78C2, 0x78C3, 0x78C4, 0x78C5 }; @@ -33,7 +35,7 @@ static const int STATE_ARRAY[7] = { LiftbotScript::LiftbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) { - _state = 0; + _stateIndex = 0; loadRanges("Ranges/Liftbot"); loadResponses("Responses/Liftbot"); @@ -41,6 +43,7 @@ LiftbotScript::LiftbotScript(int val1, const char *charClass, int v2, _tagMappings.load("TagMap/Liftbot"); _words.load("Words/Liftbot"); _quotes.load("Quotes/Liftbot"); + _states.load("States/Liftbot"); } void LiftbotScript::setupSentences() { @@ -58,12 +61,12 @@ int LiftbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence case MKTAG('D', 'N', 'A', '1'): case MKTAG('H', 'H', 'G', 'Q'): case MKTAG('A', 'N', 'S', 'W'): - if (_state >= 7) { + if (_stateIndex >= 7) { selectResponse(30918); setState(2); - _state = 0; + _stateIndex = 0; } else { - addResponse(STATE_ARRAY[_state++]); + addResponse(STATE_ARRAY[_stateIndex++]); } applyResponse(); diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index 3aa620db36..ec71e41233 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -29,7 +29,8 @@ namespace Titanic { class LiftbotScript : public TTnpcScript { private: - int _state; + TTupdateState2Array _states; + static int _stateIndex; private: /** * Setup sentence data diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index d1d6424c18..089aff0788 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -43,6 +43,7 @@ MaitreDScript::MaitreDScript(int val1, const char *charClass, int v2, setupSentences(); _tagMappings.load("TagMap/MaitreD"); _quotes.load("Quotes/MaitreD"); + _states.load("States/MaitreD"); } void MaitreDScript::setupSentences() { diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index 5937b7d740..a310b0ab83 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -28,6 +28,8 @@ namespace Titanic { class MaitreDScript : public TTnpcScript { +private: + TTupdateState2Array _states; private: /** * Setup sentence data diff --git a/engines/titanic/true_talk/script_support.cpp b/engines/titanic/true_talk/script_support.cpp index 1a3d66ad4a..35777128ca 100644 --- a/engines/titanic/true_talk/script_support.cpp +++ b/engines/titanic/true_talk/script_support.cpp @@ -164,16 +164,15 @@ void TThandleQuoteEntries::load(const char *name) { /*------------------------------------------------------------------------*/ -void TTupdateStateEntries::load(const char *name) { +void TTupdateState2Array::load(const char *name) { Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); while (r->pos() < r->size()) { - TTupdateStateEntry ue; - ue._newId = r->readUint32LE(); - ue._newValue = r->readUint32LE(); - ue._idMatch = r->readUint32LE(); + TTupdateState2 us; + us._src = r->readUint32LE(); + us._dest = r->readUint32LE(); - push_back(ue); + push_back(us); } delete r; @@ -181,15 +180,16 @@ void TTupdateStateEntries::load(const char *name) { /*------------------------------------------------------------------------*/ -void TTmapEntries::load(const char *name) { +void TTupdateState3Array::load(const char *name) { Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); while (r->pos() < r->size()) { - TTmapEntry me; - me._src = r->readUint32LE(); - me._dest = r->readUint32LE(); + TTupdateState3 ue; + ue._newId = r->readUint32LE(); + ue._newValue = r->readUint32LE(); + ue._idMatch = r->readUint32LE(); - push_back(me); + push_back(ue); } delete r; diff --git a/engines/titanic/true_talk/script_support.h b/engines/titanic/true_talk/script_support.h index ef71ff08e4..595105f9ce 100644 --- a/engines/titanic/true_talk/script_support.h +++ b/engines/titanic/true_talk/script_support.h @@ -142,25 +142,27 @@ public: void load(const char *name); }; -struct TTupdateStateEntry { - uint _newId; - uint _newValue; - uint _idMatch; +struct TTupdateState2 { + uint _src; + uint _dest; + + TTupdateState2() : _src(0), _dest(0) {} }; -class TTupdateStateEntries : public Common::Array { +class TTupdateState2Array : public Common::Array { public: void load(const char *name); }; -struct TTmapEntry { - uint _src; - uint _dest; +struct TTupdateState3 { + uint _newId; + uint _newValue; + uint _idMatch; - TTmapEntry() : _src(0), _dest(0) {} + TTupdateState3() : _newId(0), _newValue(0), _idMatch(0) {} }; -class TTmapEntries : public Common::Array { +class TTupdateState3Array : public Common::Array { public: void load(const char *name); }; -- cgit v1.2.3 From c7bd63d8818bb064be19957c32a1ee4abe7c9515 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 28 Jul 2016 22:05:16 -0400 Subject: TITANIC: Added BarbotScript updateState --- engines/titanic/true_talk/barbot_script.cpp | 33 ++++++++++++++++++++++++--- engines/titanic/true_talk/barbot_script.h | 2 +- engines/titanic/true_talk/bellbot_script.cpp | 4 ++-- engines/titanic/true_talk/bellbot_script.h | 4 ++-- engines/titanic/true_talk/deskbot_script.cpp | 2 +- engines/titanic/true_talk/deskbot_script.h | 2 +- engines/titanic/true_talk/doorbot_script.cpp | 2 +- engines/titanic/true_talk/doorbot_script.h | 2 +- engines/titanic/true_talk/liftbot_script.cpp | 2 +- engines/titanic/true_talk/liftbot_script.h | 2 +- engines/titanic/true_talk/maitred_script.cpp | 2 +- engines/titanic/true_talk/maitred_script.h | 2 +- engines/titanic/true_talk/script_support.cpp | 2 +- engines/titanic/true_talk/script_support.h | 4 ++-- engines/titanic/true_talk/succubus_script.cpp | 2 +- engines/titanic/true_talk/succubus_script.h | 2 +- engines/titanic/true_talk/tt_npc_script.cpp | 2 +- engines/titanic/true_talk/tt_npc_script.h | 2 +- 18 files changed, 50 insertions(+), 23 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index 345e9a3f0e..f77b0b1b8a 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -965,9 +965,36 @@ int BarbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); } -int BarbotScript::updateState(int oldId, int newId, int index) { - warning("TODO"); - return 0; +int BarbotScript::updateState(uint oldId, uint newId, int index) { + if (newId == 250538) { + CTrueTalkManager::triggerAction(28, 0); + return 250538; + } + if (newId == 251704) { + return 251701 + _field7C ? 3 : 0; + } + + for (const TTupdateState3 *us = &_states[0]; us->_newId; ++us) { + if (us->_newId == newId) { + if ((us->_dialBits & 1) && !getDialRegion(0)) + continue; + if ((us->_dialBits & 2) && getDialRegion(0)) + continue; + if ((us->_dialBits & 4) && !getDialRegion(1)) + continue; + if ((us->_dialBits & 8) && getDialRegion(1)) + continue; + if ((us->_dialBits & 0x10) && !getDialRegion(2)) + continue; + if ((us->_dialBits & 0x20) && getDialRegion(2)) + continue; + + setState(us->_newValue); + break; + } + } + + return newId; } int BarbotScript::proc22(int id) const { diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index ba6c5e9000..c8b2962667 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -77,7 +77,7 @@ public: /** * Handles updating NPC state based on specified dialogue Ids and dial positions */ - virtual int updateState(int oldId, int newId, int index); + virtual int updateState(uint oldId, uint newId, int index); virtual int proc22(int id) const; diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 3eb840f9ba..1a9a607e6b 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -29,7 +29,7 @@ namespace Titanic { -int BellbotScript::_oldId; +uint BellbotScript::_oldId; BellbotScript::BellbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2) : @@ -187,7 +187,7 @@ int BellbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); } -int BellbotScript::updateState(int oldId, int newId, int index) { +int BellbotScript::updateState(uint oldId, uint newId, int index) { if (!getValue(25)) { newId = 202043 - getValue(1) <= 2 ? 994 : 0; CTrueTalkManager::setFlags(25, 1); diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index ef11985fac..798eecb99d 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -29,7 +29,7 @@ namespace Titanic { class BellbotScript : public TTnpcScript { private: - static int _oldId; + static uint _oldId; TTupdateState2Array _states; int _array[150]; int _field2D0; @@ -78,7 +78,7 @@ public: /** * Handles updating NPC state based on specified dialogue Ids and dial positions */ - virtual int updateState(int oldId, int newId, int index); + virtual int updateState(uint oldId, uint newId, int index); virtual int proc22(int id) const; virtual int proc23() const; diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index a10aef25fc..219ac74a24 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -183,7 +183,7 @@ int DeskbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, } -int DeskbotScript::updateState(int oldId, int newId, int index) { +int DeskbotScript::updateState(uint oldId, uint newId, int index) { if (isDial1Medium() || getValue(1) < 4) CTrueTalkManager::setFlags(22, 1); diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index 628a7432b8..be12b52509 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -82,7 +82,7 @@ public: /** * Handles updating NPC state based on specified dialogue Ids and dial positions */ - virtual int updateState(int oldId, int newId, int index); + virtual int updateState(uint oldId, uint newId, int index); virtual int proc22(int id) const; virtual int proc23() const; diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 700ad3a666..f644142793 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -251,7 +251,7 @@ int DoorbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); } -int DoorbotScript::updateState(int oldId, int newId, int index) { +int DoorbotScript::updateState(uint oldId, uint newId, int index) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index fa7d39020d..15463d5326 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -76,7 +76,7 @@ public: /** * Handles updating NPC state based on specified dialogue Ids and dial positions */ - virtual int updateState(int oldId, int newId, int index); + virtual int updateState(uint oldId, uint newId, int index); virtual int proc22(int id) const; diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index 04a5c15af8..2308ea1beb 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -211,7 +211,7 @@ int LiftbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); } -int LiftbotScript::updateState(int oldId, int newId, int index) { +int LiftbotScript::updateState(uint oldId, uint newId, int index) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index ec71e41233..ee8dbc14f5 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -73,7 +73,7 @@ public: /** * Handles updating NPC state based on specified dialogue Ids and dial positions */ - virtual int updateState(int oldId, int newId, int index); + virtual int updateState(uint oldId, uint newId, int index); virtual int proc22(int id) const; diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index 089aff0788..abf0bc934f 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -185,7 +185,7 @@ int MaitreDScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, return TTnpcScript::handleQuote(roomScript, sentence, val, tagId, remainder); } -int MaitreDScript::updateState(int oldId, int newId, int index) { +int MaitreDScript::updateState(uint oldId, uint newId, int index) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index a310b0ab83..ad43438705 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -60,7 +60,7 @@ public: /** * Handles updating NPC state based on specified dialogue Ids and dial positions */ - virtual int updateState(int oldId, int newId, int index); + virtual int updateState(uint oldId, uint newId, int index); virtual int proc22(int id) const; virtual int proc23() const; diff --git a/engines/titanic/true_talk/script_support.cpp b/engines/titanic/true_talk/script_support.cpp index 35777128ca..af5ef05283 100644 --- a/engines/titanic/true_talk/script_support.cpp +++ b/engines/titanic/true_talk/script_support.cpp @@ -187,7 +187,7 @@ void TTupdateState3Array::load(const char *name) { TTupdateState3 ue; ue._newId = r->readUint32LE(); ue._newValue = r->readUint32LE(); - ue._idMatch = r->readUint32LE(); + ue._dialBits = r->readUint32LE(); push_back(ue); } diff --git a/engines/titanic/true_talk/script_support.h b/engines/titanic/true_talk/script_support.h index 595105f9ce..6a60563202 100644 --- a/engines/titanic/true_talk/script_support.h +++ b/engines/titanic/true_talk/script_support.h @@ -157,9 +157,9 @@ public: struct TTupdateState3 { uint _newId; uint _newValue; - uint _idMatch; + uint _dialBits; - TTupdateState3() : _newId(0), _newValue(0), _idMatch(0) {} + TTupdateState3() : _newId(0), _newValue(0), _dialBits(0) {} }; class TTupdateState3Array : public Common::Array { diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp index b1e4351ee5..a6e1f7fccc 100644 --- a/engines/titanic/true_talk/succubus_script.cpp +++ b/engines/titanic/true_talk/succubus_script.cpp @@ -84,7 +84,7 @@ ScriptChangedResult SuccUBusScript::scriptChanged(TTscriptBase *roomScript, uint return SCR_1; } -int SuccUBusScript::updateState(int oldId, int newId, int index) { +int SuccUBusScript::updateState(uint oldId, uint newId, int index) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h index ba8bc610bf..560272bdd9 100644 --- a/engines/titanic/true_talk/succubus_script.h +++ b/engines/titanic/true_talk/succubus_script.h @@ -57,7 +57,7 @@ public: /** * Handles updating NPC state based on specified dialogue Ids and dial positions */ - virtual int updateState(int oldId, int newId, int index); + virtual int updateState(uint oldId, uint newId, int index); virtual int proc23() const; virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index f21111134e..18ade0cba6 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -372,7 +372,7 @@ void TTnpcScript::resetRange(int id) { range->_priorIndex = 0; } -int TTnpcScript::updateState(int oldId, int newId, int index) { +int TTnpcScript::updateState(uint oldId, uint newId, int index) { return newId; } diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 833262deb8..eb53dc9bb2 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -259,7 +259,7 @@ public: /** * Handles updating NPC state based on specified dialogue Ids and dial positions */ - virtual int updateState(int oldId, int newId, int index); + virtual int updateState(uint oldId, uint newId, int index); virtual int proc22(int id) const; -- cgit v1.2.3 From c08ad39a9442d6f15bacb33b34597338121fa5b4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 28 Jul 2016 22:36:29 -0400 Subject: TITANIC: Added DeskbotScript setFlags17 --- engines/titanic/true_talk/barbot_script.cpp | 19 ++++++++++--------- engines/titanic/true_talk/deskbot_script.cpp | 20 +++++++++++++++++++- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index f77b0b1b8a..1c652faf11 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -974,22 +974,23 @@ int BarbotScript::updateState(uint oldId, uint newId, int index) { return 251701 + _field7C ? 3 : 0; } - for (const TTupdateState3 *us = &_states[0]; us->_newId; ++us) { - if (us->_newId == newId) { - if ((us->_dialBits & 1) && !getDialRegion(0)) + for (uint idx = 0; idx < _states.size(); ++idx) { + const TTupdateState3 &us = _states[idx]; + if (us._newId == newId) { + if ((us._dialBits & 1) && !getDialRegion(0)) continue; - if ((us->_dialBits & 2) && getDialRegion(0)) + if ((us._dialBits & 2) && getDialRegion(0)) continue; - if ((us->_dialBits & 4) && !getDialRegion(1)) + if ((us._dialBits & 4) && !getDialRegion(1)) continue; - if ((us->_dialBits & 8) && getDialRegion(1)) + if ((us._dialBits & 8) && getDialRegion(1)) continue; - if ((us->_dialBits & 0x10) && !getDialRegion(2)) + if ((us._dialBits & 0x10) && !getDialRegion(2)) continue; - if ((us->_dialBits & 0x20) && getDialRegion(2)) + if ((us._dialBits & 0x20) && getDialRegion(2)) continue; - setState(us->_newValue); + setState(us._newValue); break; } } diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 219ac74a24..1e3eaae26a 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -397,7 +397,25 @@ int DeskbotScript::getStateDialogueId() const { } void DeskbotScript::setFlags17(int newId, int index) { - // TODO + int newValue = getValue(17); + + for (uint idx = 0; idx < _states.size(); ++idx) { + const TTupdateState3 &us = _states[idx]; + if (newId == (idx == 0 ? 0 : us._newId)) { + uint bits = us._dialBits; + + if (!bits + || (index == 1 && (bits & 1) && (bits & 4)) + || (index == 0 && (bits & 2) && (bits & 4)) + || (index == 3 && (bits & 1) && (bits & 8)) + || (index == 2 && (bits & 2) && (bits & 8))) { + newValue = us._newValue; + break; + } + } + } + + CTrueTalkManager::setFlags(17, newValue); } } // End of namespace Titanic -- cgit v1.2.3 From 186b4e095a7f91bf1d5a186c0da9b4a81a0ae525 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 28 Jul 2016 23:23:27 -0400 Subject: TITANIC: Added DoorbotScript updateState --- engines/titanic/true_talk/doorbot_script.cpp | 68 +++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 2 deletions(-) diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index f644142793..3dc1e7fa61 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -252,8 +252,72 @@ int DoorbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, } int DoorbotScript::updateState(uint oldId, uint newId, int index) { - warning("TODO"); - return 0; + getValue(38); + bool flag39 = getValue(39) != 0; + CTrueTalkManager::setFlags(38, 0); + CTrueTalkManager::setFlags(39, 0); + + if (newId > 220890) { + switch (newId) { + case 221064: + return getValue(1) == 2 ? newId : 221062; + case 221080: + return getValue(1) >= 2 ? newId : 221066; + case 221078: + case 221079: + return getValue(1) >= 3 ? newId : 221065; + case 221081: + return getValue(7) == 0 ? newId : 221070; + case 221251: + CTrueTalkManager::triggerAction(28, 0); + break; + default: + break; + } + } else if (newId >= 220883) { + CTrueTalkManager::setFlags(38, 1); + CTrueTalkManager::triggerAction(28, 0); + } else if (newId >= 220076) { + switch (newId) { + case 220078: + case 220080: + case 220081: + case 220082: + case 220083: + case 220084: + if (flag39) + return getRangeValue(221381); + break; + default: + break; + } + + CTrueTalkManager::setFlags(39, 1); + } else if (newId == 220075) { + if (flag39) + return getRangeValue(221381); + CTrueTalkManager::setFlags(39, 1); + } else if (newId == 220038) { + return 220038; + } + + for (uint idx = 0; idx < _states.size(); ++idx) { + TTupdateState3 &us = _states[idx]; + if (us._newId == newId) { + uint bits = us._dialBits; + + if (!bits + || (index == 0 && (bits == 5 || bits == 1)) + || (index == 1 && (bits == 6 || bits == 2)) + || (index == 2 && (bits == 9 || bits == 1)) + || (index == 3 && (bits == 10 || bits == 2))) { + setState(us._newValue); + break; + } + } + } + + return newId; } int DoorbotScript::proc22(int id) const { -- cgit v1.2.3 From 39f882d9f3bfcf304806968f97cfb43e5ce95481 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 28 Jul 2016 23:25:38 -0400 Subject: TITANIC: Added LiftbotScript updateState --- engines/titanic/true_talk/liftbot_script.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index 2308ea1beb..66e2042ee3 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -212,8 +212,15 @@ int LiftbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, } int LiftbotScript::updateState(uint oldId, uint newId, int index) { - warning("TODO"); - return 0; + for (uint idx = 0; idx < _states.size(); ++idx) { + TTupdateState2 &us = _states[idx]; + if (us._src == newId) { + setState(us._dest); + break; + } + } + + return newId; } int LiftbotScript::proc22(int id) const { -- cgit v1.2.3 From 72ef0e767508fedb5fa9670bed72463077df768c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 29 Jul 2016 19:36:57 -0400 Subject: TITANIC: Added MaitreDScript updateState --- engines/titanic/true_talk/maitred_script.cpp | 194 ++++++++++++++++++++++++++- engines/titanic/true_talk/maitred_script.h | 21 +++ 2 files changed, 213 insertions(+), 2 deletions(-) diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index abf0bc934f..6eabcb4017 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -186,8 +186,112 @@ int MaitreDScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, } int MaitreDScript::updateState(uint oldId, uint newId, int index) { - warning("TODO"); - return 0; + if (getValue(8)) { + if (oldId == 260112) + return getRangeValue(260654); + if (oldId != 260655 && oldId != 260654) + return getRangeValue(260655); + } + + newId = getStateDialogueId(oldId, newId); + + if (newId == 260023) { + switch (getValue(13)) { + case 1: + newId = 260023; break; + case 2: + newId = 260024; break; + case 3: + newId = 260025; break; + case 4: + newId = 260026; break; + case 5: + newId = 260027; break; + default: + newId = 260016; break; + } + } + + if (newId == 260034) { + switch (getValue(13)) { + case 1: + newId = 260034; break; + case 2: + newId = 260035; break; + case 3: + newId = 260036; break; + case 4: + newId = 260037; break; + case 5: + newId = 260038; break; + default: + newId = 260045; break; + } + } + + if (newId == 260070) { + switch (getValue(13)) { + case 1: + newId = 260070; break; + case 2: + newId = 260071; break; + case 3: + newId = 260072; break; + case 4: + newId = 260073; break; + case 5: + newId = 260074; break; + default: + newId = 260110; break; + } + } + + if (newId == 260076 || newId == 260181 || newId == 261010) { + CTrueTalkManager::setFlags(14, 1); + trigger12(true); + setFlags10(newId, index); + return newId; + } + + if (!getValue(12)) { + static const int FLAG_IDS[] = { + 260080, 260066, 260067, 260062, 260050, 260087, 260090, 260171, 260173, + 260184, 260193, 260202, 260205, 260220, 260221, 260223, 260231, 260232, + 260365, 260373, 260374, 260387, 260421, 260622, 260695, 0 + }; + + for (uint idx = 0; FLAG_IDS[idx]; ++idx) { + if (FLAG_IDS[idx] == newId) { + setFlags12(); + break; + } + } + } + + if (newId == 261018) { + if (getValue(8) == 0 && getValue(9) == 0) { + newId = getRangeValue(260961); + setFlags10(newId, index); + return newId; + } + + if (getValue(8) == 1 && getValue(9) == 1) { + newId = getRangeValue(260655); + setFlags10(newId, index); + return newId; + } + + if (getValue(9) && getValue(16)) { + newId = getValue(16); + setFlags10(newId, index); + return index; + } + + newId = 260989; + } + + setFlags10(newId, index); + return newId; } int MaitreDScript::proc22(int id) const { @@ -208,4 +312,90 @@ int MaitreDScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, void MaitreDScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { } +uint MaitreDScript::getStateDialogueId(uint oldId, uint newId) { + if (getValue(8) || getValue(9)) + return newId; + + switch (newId) { + case 260009: + case 260010: + case 260011: + case 260012: + return getRangeValue(260961); + case 260052: + return 260094; + case 260203: + return 260204; + case 260211: + case 260212: + case 260761: + case 260986: + case 260987: + case 260989: + return getRangeValue(260961); + case 260263: + case 260264: + return 260265; + case 260411: + return 260457; + case 260427: + case 260053: + case 260054: + case 260055: + case 260056: + case 260057: + case 260058: + case 260059: + case 260060: + return 260135; + case 260698: + case 260895: + case 260896: + return 260457; + case 260799: + return 260214; + + default: + return newId; + } +} + + +void MaitreDScript::setFlags12() { + int val = getValue(12); + CTrueTalkManager::setFlags(12, 1); + + if (!val) { + CTrueTalkManager::triggerAction(8, 0); + resetRange(260121); + resetRange(260122); + resetRange(260123); + resetRange(260124); + resetRange(260125); + resetRange(260126); + } +} + +void MaitreDScript::setFlags10(int newId, int index) { + int val = 28; + for (uint idx = 0; idx < _states.size(); ++idx) { + TTupdateState2 &us = _states[idx]; + if (us._src == newId) { + val = us._dest; + break; + } + } + + CTrueTalkManager::setFlags(10, val); +} + +void MaitreDScript::trigger12(bool flag) { + int val = getValue(12); + CTrueTalkManager::setFlags(12, 0); + + if (val) { + CTrueTalkManager::triggerAction(flag ? 10 : 9, 0); + } +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index ad43438705..7195fb2b4a 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -35,6 +35,27 @@ private: * Setup sentence data */ void setupSentences(); + + /** + * Alter dialogue Id based on current NPC state + */ + uint getStateDialogueId(uint oldId, uint newId); + + /** + * Sets flags 12 and resets some ranges + */ + void setFlags12(); + + /** + * Sets flags 10 to different values based on the passed + * dialogue Id + */ + void setFlags10(int newId, int index); + + /** + * Trigers 12 + */ + void trigger12(bool flag); public: MaitreDScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); -- cgit v1.2.3 From 0ab3c53e15507fc410507f5500e70fb53e7fc6fe Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 29 Jul 2016 21:57:19 -0400 Subject: DEVTOOLS: Add NPC pre-response arrays to create_titanic --- devtools/create_titanic/create_titanic_dat.cpp | 4 +- devtools/create_titanic/module.mk | 3 + devtools/create_titanic/script_preresponses.cpp | 156 ++++++++++++++++++++++++ devtools/create_titanic/script_preresponses.h | 37 ++++++ 4 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 devtools/create_titanic/script_preresponses.cpp create mode 100644 devtools/create_titanic/script_preresponses.h diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index cc0283e454..cffbf3cab4 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -36,6 +36,7 @@ #include "common/rect.h" #include "winexe_pe.h" #include "file.h" +#include "script_preresponses.h" #include "script_quotes.h" #include "script_responses.h" #include "script_ranges.h" @@ -54,7 +55,7 @@ */ #define VERSION_NUMBER 1 -#define HEADER_SIZE 0x880 +#define HEADER_SIZE 0x900 Common::File inputFile, outputFile; Common::PEResources res; @@ -591,6 +592,7 @@ void writeData() { writeAllScriptRanges(); writeAllTagMappings(); writeAllUpdateStates(); + writeAllScriptPreResponses(); } void createScriptMap() { diff --git a/devtools/create_titanic/module.mk b/devtools/create_titanic/module.mk index aae7b4bc53..9f77866d45 100644 --- a/devtools/create_titanic/module.mk +++ b/devtools/create_titanic/module.mk @@ -4,11 +4,14 @@ MODULE := devtools/create_titanic MODULE_OBJS := \ create_titanic_dat.o \ hashmap.o \ + memorypool.o \ + script_preresponses.o \ script_quotes.o \ script_ranges.o \ script_responses.o \ script_states.o \ str.o \ + tag_maps.o \ winexe.o \ winexe_pe.o diff --git a/devtools/create_titanic/script_preresponses.cpp b/devtools/create_titanic/script_preresponses.cpp new file mode 100644 index 0000000000..d906015296 --- /dev/null +++ b/devtools/create_titanic/script_preresponses.cpp @@ -0,0 +1,156 @@ +/* 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. + * + */ + + // Disable symbol overrides so that we can use system headers. +#define FORBIDDEN_SYMBOL_ALLOW_ALL + +// HACK to allow building with the SDL backend on MinGW +// see bug #1800764 "TOOLS: MinGW tools building broken" +#ifdef main +#undef main +#endif // main + +#include "file.h" +#include "script_preresponses.h" + +static const PreResponse BARBOT_PRERESPONSES[] = { + { 0x0000CA02, 0x0003D102 }, + { 0x0000CA68, 0x0003D102 }, + { 0x0000C9DA, 0x0003D102 }, + { 0x0000CA6A, 0x0003D103 }, + { 0x0000C922, 0x0003D099 }, + { 0x0000C97C, 0x0003D099 }, + { 0x0000CA0B, 0x0003D099 }, + { 0x0000CA72, 0x0003D099 }, + { 0x0000CA0E, 0x0003D107 }, + { 0x0000CA73, 0x0003D107 }, + { 0x0000CA12, 0x0003D108 }, + { 0x0000CA1C, 0x0003D10E }, + { 0x0000CA83, 0x0003D10E }, + { 0x0000CA1F, 0x0003D110 }, + { 0x0000CA86, 0x0003D110 }, + { 0x0000CA23, 0x0003D112 }, + { 0x0000CA8A, 0x0003D112 }, + { 0x0000CA92, 0x0003D122 }, + { 0x0000CA30, 0x0003D116 }, + { 0x0000CA96, 0x0003D116 }, + { 0x0000CA36, 0x0003D117 }, + { 0x0000C9FC, 0x0003D117 }, + { 0x0000CA9B, 0x0003D117 }, + { 0x0000CA63, 0x0003D117 }, + { 0x0000CA38, 0x0003D11B }, + { 0x0000CA15, 0x0003D109 }, + { 0x0000CA7B, 0x0003D109 }, + { 0x0000CA2E, 0x0003D115 }, + { 0x0000CA94, 0x0003D115 }, + { 0x0000CA5C, 0x0003D115 }, + { 0x0000CA21, 0x0003D111 }, + { 0x0000CA88, 0x0003D111 }, + { 0x0000CA2A, 0x0003D114 }, + { 0x0000CA28, 0x0003D119 }, + { 0x0000CA8E, 0x0003D119 }, + { 0x0000CA17, 0x0003D10B }, + { 0x0000CA7D, 0x0003D10B }, + { 0x0000CA4C, 0x0003D10B }, + { 0x0000CA06, 0x0003D105 }, + { 0x0000CA6C, 0x0003D105 }, + { 0x0000CA0A, 0x0003D106 }, + { 0x0000CA70, 0x0003D106 }, + { 0x0000CA19, 0x0003D10C }, + { 0x0000CA7F, 0x0003D10C }, + { 0x0000C9FF, 0x0003D101 }, + { 0x0000CA65, 0x0003D101 }, + { 0x00000000, 0x00000000 } +}; + +static const PreResponse BELLBOT_PRERESPONSES[] = { + { 0x000052DC, 0x00030D40 }, + { 0x000054E9, 0x00030D40 }, + { 0x000054EC, 0x00030D40 }, + { 0x000054F0, 0x00030D40 }, + { 0x0000532C, 0x00031625 }, + { 0x00005330, 0x00031625 }, + { 0x00005368, 0x00031625 }, + { 0x00005369, 0x00031625 }, + { 0x0000536A, 0x00031625 }, + { 0x0000536B, 0x00031625 }, + { 0x0000536C, 0x00031625 }, + { 0x0000536D, 0x00031625 }, + { 0x000053A4, 0x00031625 }, + { 0x0000558A, 0x00031625 }, + { 0x00005485, 0x00031625 }, + { 0x00004EE7, 0x00031625 }, + { 0x00004EE8, 0x00031625 }, + { 0x0000530A, 0x00031625 }, + { 0x0000530B, 0x00031625 }, + { 0x000053F6, 0x00031625 }, + { 0x000053F7, 0x00031625 }, + { 0x000053F8, 0x00031625 }, + { 0x000053F9, 0x00031625 }, + { 0x000053FA, 0x00031625 }, + { 0x000053FB, 0x00031625 }, + { 0x000053FC, 0x00031625 }, + { 0x000053FD, 0x00031625 }, + { 0x0000556B, 0x00031041 }, + { 0x00005499, 0x00030D40 }, + { 0x000053E9, 0x00030E01 }, + { 0x000053EB, 0x00030E01 }, + { 0x000053EC, 0x00030E01 }, + { 0x000053ED, 0x00030E01 }, + { 0x000053EE, 0x00030E01 }, + { 0x000053EF, 0x00030E01 }, + { 0x000053F0, 0x00030E01 }, + { 0x000053F1, 0x00030E01 }, + { 0x000053F2, 0x00030E01 }, + { 0x000053EA, 0x00030E01 }, + { 0x00005441, 0x00030F00 }, + { 0x00005444, 0x00030F00 }, + { 0x00005445, 0x00030F00 }, + { 0x00005443, 0x00030F00 }, + { 0x00005446, 0x00030F00 }, + { 0x00005447, 0x00030F00 }, + { 0x00005448, 0x00030F00 }, + { 0x00005449, 0x00030F00 }, + { 0x0000544A, 0x00030F00 }, + { 0x0000544B, 0x00030F00 }, + { 0x00005442, 0x00030F00 }, + { 0x0000527C, 0x000315C8 }, + { 0x00000000, 0x00000000 } +}; + +void writeScriptPreResponses(const char *name, const PreResponse *states) { + outputFile.seek(dataOffset); + + for (; states->_src; ++states) { + outputFile.writeLong(states->_src); + outputFile.writeLong(states->_dest); + } + + uint size = outputFile.size() - dataOffset; + writeEntryHeader(name, dataOffset, size); + dataOffset += size; +} + +void writeAllScriptPreResponses() { + writeScriptPreResponses("PreResponses/Barbot", BARBOT_PRERESPONSES); + writeScriptPreResponses("PreResponses/Bellbot", BELLBOT_PRERESPONSES); +} \ No newline at end of file diff --git a/devtools/create_titanic/script_preresponses.h b/devtools/create_titanic/script_preresponses.h new file mode 100644 index 0000000000..b4377be1c7 --- /dev/null +++ b/devtools/create_titanic/script_preresponses.h @@ -0,0 +1,37 @@ +/* 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. + * + */ + +#ifndef COMMON_SCRIPT_PRERESPONSES_H +#define COMMON_SCRIPT_PRERESPONSES_H + +#include "common/scummsys.h" + +struct PreResponse { + uint _src; + uint _dest; +}; + +extern void writeAllScriptPreResponses(); +extern void writeEntryHeader(const char *name, uint offset, uint size); +extern uint dataOffset; + +#endif -- cgit v1.2.3 From 0243d5b677c758f7b88598326e84d3d1034bd166 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 29 Jul 2016 21:57:35 -0400 Subject: TITANIC: Add NPC preResponse methods --- engines/titanic/true_talk/barbot_script.cpp | 11 +++++++---- engines/titanic/true_talk/barbot_script.h | 8 ++++++-- engines/titanic/true_talk/bellbot_script.cpp | 22 ++++++++++++++++++---- engines/titanic/true_talk/bellbot_script.h | 9 +++++++-- engines/titanic/true_talk/deskbot_script.cpp | 22 ++++++++++++++-------- engines/titanic/true_talk/deskbot_script.h | 16 ++++++++++------ engines/titanic/true_talk/doorbot_script.cpp | 13 +++++++++---- engines/titanic/true_talk/doorbot_script.h | 7 +++++-- engines/titanic/true_talk/liftbot_script.cpp | 12 +++++++++--- engines/titanic/true_talk/liftbot_script.h | 7 +++++-- engines/titanic/true_talk/maitred_script.cpp | 12 +++++++----- engines/titanic/true_talk/maitred_script.h | 10 +++++++--- engines/titanic/true_talk/script_support.cpp | 18 ++++++++++++++---- engines/titanic/true_talk/script_support.h | 17 +++++++++++------ engines/titanic/true_talk/tt_npc_script.cpp | 4 ++-- engines/titanic/true_talk/tt_npc_script.h | 5 ++++- 16 files changed, 135 insertions(+), 58 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index 1c652faf11..81682a2f7e 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -52,6 +52,7 @@ BarbotScript::BarbotScript(int val1, const char *charClass, int v2, _tagMappings.load("TagMap/Barbot"); _quotes.load("Quotes/Barbot"); _states.load("States/Barbot"); + _preResponses.load("PreResponses/Barbot"); } void BarbotScript::setupSentences() { @@ -975,7 +976,7 @@ int BarbotScript::updateState(uint oldId, uint newId, int index) { } for (uint idx = 0; idx < _states.size(); ++idx) { - const TTupdateState3 &us = _states[idx]; + const TTupdateState &us = _states[idx]; if (us._newId == newId) { if ((us._dialBits & 1) && !getDialRegion(0)) continue; @@ -998,9 +999,11 @@ int BarbotScript::updateState(uint oldId, uint newId, int index) { return newId; } -int BarbotScript::proc22(int id) const { - warning("TODO"); - return 0; +int BarbotScript::preResponse(uint id) { + if (getDialRegion(0) == 0 && getRandomNumber(100) > 80) + return 251250; + + return _preResponses.find(id); } uint BarbotScript::getDialsBitset() const { diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index c8b2962667..8a81099fd4 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -32,7 +32,8 @@ private: int _state; int _arrIndex; TTsentenceEntries _entries2; - TTupdateState3Array _states; + TTupdateStateArray _states; + TTmapEntryArray _preResponses; private: /** * Adjust a given dial number by a given delta amount @@ -79,7 +80,10 @@ public: */ virtual int updateState(uint oldId, uint newId, int index); - virtual int proc22(int id) const; + /** + * Handles getting a pre-response + */ + virtual int preResponse(uint id); /** * Returns a bitset of the first three dialgs being on or not diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 1a9a607e6b..88f13cc351 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -51,6 +51,7 @@ BellbotScript::BellbotScript(int val1, const char *charClass, int v2, _words.load("Words/Bellbot"); _quotes.load("Quotes/Bellbot"); _states.load("States/Bellbot"); + _preResponses.load("PreResponses/Bellbot"); } void BellbotScript::setupSentences() { @@ -299,9 +300,22 @@ int BellbotScript::updateState(uint oldId, uint newId, int index) { return newId; } -int BellbotScript::proc22(int id) const { - warning("TODO"); - return 0; +int BellbotScript::preResponse(uint id) { + int newId = _preResponses.find(id); + + if (newId == 202277) { + applyResponse(); + CTrueTalkManager::triggerAction(1, 0); + } + if (newId == 200769) { + applyResponse(); + CTrueTalkManager::triggerAction(18, 0); + } + + if (id == 21790) + CTrueTalkManager::triggerAction(13, 0); + + return newId; } int BellbotScript::proc23() const { @@ -427,7 +441,7 @@ int BellbotScript::getStateDialogueId() const { void BellbotScript::setValue23(uint id) { uint val = 0; for (uint idx = 0; idx < _states.size() && !val; ++idx) { - TTupdateState2 &us = _states[idx]; + TTmapEntry &us = _states[idx]; if (us._src == id) val = us._dest; } diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index 798eecb99d..60459651cf 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -30,7 +30,8 @@ namespace Titanic { class BellbotScript : public TTnpcScript { private: static uint _oldId; - TTupdateState2Array _states; + TTmapEntryArray _states; + TTmapEntryArray _preResponses; int _array[150]; int _field2D0; int _field2D4; @@ -80,7 +81,11 @@ public: */ virtual int updateState(uint oldId, uint newId, int index); - virtual int proc22(int id) const; + /** + * Handles getting a pre-response + */ + virtual int preResponse(uint id); + virtual int proc23() const; virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 1e3eaae26a..90fab86111 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -251,9 +251,15 @@ exit: return newId; } -int DeskbotScript::proc22(int id) const { - warning("TODO"); - return 0; +int DeskbotScript::preResponse(uint id) { + int newId = 0; + if (getValue(1) >= 3 && (id == 41176 || id == 41738 || id == 41413 || id == 41740)) + newId = 241601; + + if (id == 42114) + CTrueTalkManager::triggerAction(20, 0); + + return newId; } int DeskbotScript::proc23() const { @@ -330,7 +336,7 @@ bool DeskbotScript::isDial1Low() const { return getDialRegion(1) == 0; } -int DeskbotScript::addAssignedRoomDialogue() { +uint DeskbotScript::addAssignedRoomDialogue() { if (isDial1Medium()) { addResponse(getDialogueId(240407)); addResponse(getDialogueId(241510)); @@ -351,7 +357,7 @@ int DeskbotScript::addAssignedRoomDialogue() { } } -int DeskbotScript::addAssignedRoomDialogue2() { +uint DeskbotScript::addAssignedRoomDialogue2() { addResponse(getDialogueId(241355)); int roomNum = 0, floorNum = 0, elevatorNum = 0; getAssignedRoom(&roomNum, &floorNum, &elevatorNum); @@ -385,7 +391,7 @@ void DeskbotScript::addAssignedRoomDialogue3() { applyResponse(); } -int DeskbotScript::getStateDialogueId() const { +uint DeskbotScript::getStateDialogueId() const { switch (getValue(1)) { case 1: return 241503; @@ -396,11 +402,11 @@ int DeskbotScript::getStateDialogueId() const { } } -void DeskbotScript::setFlags17(int newId, int index) { +void DeskbotScript::setFlags17(uint newId, uint index) { int newValue = getValue(17); for (uint idx = 0; idx < _states.size(); ++idx) { - const TTupdateState3 &us = _states[idx]; + const TTupdateState &us = _states[idx]; if (newId == (idx == 0 ? 0 : us._newId)) { uint bits = us._dialBits; diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index be12b52509..09ae9c839e 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -31,7 +31,7 @@ namespace Titanic { class DeskbotScript : public TTnpcScript { private: static int _oldId; - TTupdateState3Array _states; + TTupdateStateArray _states; private: /** * Setup sentence data @@ -41,12 +41,12 @@ private: /** * Adds dialogue for the player's assigned room */ - int addAssignedRoomDialogue(); + uint addAssignedRoomDialogue(); /** * Adds dialogue for the player's assigned room */ - int addAssignedRoomDialogue2(); + uint addAssignedRoomDialogue2(); /** * Adds dialogue for the player's assigned room @@ -56,12 +56,12 @@ private: /** * Gets a dialogue Id based on the NPC's state */ - int getStateDialogueId() const; + uint getStateDialogueId() const; /** * Sets state data in flags 17 */ - void setFlags17(int newId, int index); + void setFlags17(uint newId, uint index); public: DeskbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); @@ -84,7 +84,11 @@ public: */ virtual int updateState(uint oldId, uint newId, int index); - virtual int proc22(int id) const; + /** + * Handles getting a pre-response + */ + virtual int preResponse(uint id); + virtual int proc23() const; virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 3dc1e7fa61..d4c18cfc60 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -302,7 +302,7 @@ int DoorbotScript::updateState(uint oldId, uint newId, int index) { } for (uint idx = 0; idx < _states.size(); ++idx) { - TTupdateState3 &us = _states[idx]; + TTupdateState &us = _states[idx]; if (us._newId == newId) { uint bits = us._dialBits; @@ -320,9 +320,14 @@ int DoorbotScript::updateState(uint oldId, uint newId, int index) { return newId; } -int DoorbotScript::proc22(int id) const { - warning("TODO"); - return 0; +int DoorbotScript::preResponse(uint id) { + uint newId = 0; + if (getDialRegion(0) != 1 && getRandomNumber(100) > 60) { + addResponse(11195); + newId = 222193; + } + + return newId; } uint DoorbotScript::getDialsBitset() const { diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 15463d5326..7aac6b2a98 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -29,7 +29,7 @@ namespace Titanic { class DoorbotScript : public TTnpcScript { private: - TTupdateState3Array _states; + TTupdateStateArray _states; int _stateIndex; private: /** @@ -78,7 +78,10 @@ public: */ virtual int updateState(uint oldId, uint newId, int index); - virtual int proc22(int id) const; + /** + * Handles getting a pre-response + */ + virtual int preResponse(uint id); /** * Returns a bitset of the dials being off or not diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index 66e2042ee3..0f582154cf 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -213,7 +213,7 @@ int LiftbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, int LiftbotScript::updateState(uint oldId, uint newId, int index) { for (uint idx = 0; idx < _states.size(); ++idx) { - TTupdateState2 &us = _states[idx]; + TTmapEntry &us = _states[idx]; if (us._src == newId) { setState(us._dest); break; @@ -223,8 +223,14 @@ int LiftbotScript::updateState(uint oldId, uint newId, int index) { return newId; } -int LiftbotScript::proc22(int id) const { - warning("TODO"); +int LiftbotScript::preResponse(uint id) { + if (id == 30565 || id == 30566 || id == 30567 || id == 30568 + || id == 30569 || id == 30570 || id == 30571) + return 210901; + + if (getDialRegion(0) == 0 && getRandomNumber(100) > 60) + return 210830; + return 0; } diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index ee8dbc14f5..33da983323 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -29,7 +29,7 @@ namespace Titanic { class LiftbotScript : public TTnpcScript { private: - TTupdateState2Array _states; + TTmapEntryArray _states; static int _stateIndex; private: /** @@ -75,7 +75,10 @@ public: */ virtual int updateState(uint oldId, uint newId, int index); - virtual int proc22(int id) const; + /** + * Handles getting a pre-response + */ + virtual int preResponse(uint id); /** * Returns a bitset of the dials being off or not diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index 6eabcb4017..c6ceca89c7 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -254,7 +254,7 @@ int MaitreDScript::updateState(uint oldId, uint newId, int index) { } if (!getValue(12)) { - static const int FLAG_IDS[] = { + static const uint FLAG_IDS[] = { 260080, 260066, 260067, 260062, 260050, 260087, 260090, 260171, 260173, 260184, 260193, 260202, 260205, 260220, 260221, 260223, 260231, 260232, 260365, 260373, 260374, 260387, 260421, 260622, 260695, 0 @@ -294,8 +294,10 @@ int MaitreDScript::updateState(uint oldId, uint newId, int index) { return newId; } -int MaitreDScript::proc22(int id) const { - warning("TODO"); +int MaitreDScript::preResponse(uint id) { + if (id == 60911) + return 260101; + return 0; } @@ -376,10 +378,10 @@ void MaitreDScript::setFlags12() { } } -void MaitreDScript::setFlags10(int newId, int index) { +void MaitreDScript::setFlags10(uint newId, uint index) { int val = 28; for (uint idx = 0; idx < _states.size(); ++idx) { - TTupdateState2 &us = _states[idx]; + TTmapEntry &us = _states[idx]; if (us._src == newId) { val = us._dest; break; diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index 7195fb2b4a..60113b82dc 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -29,7 +29,7 @@ namespace Titanic { class MaitreDScript : public TTnpcScript { private: - TTupdateState2Array _states; + TTmapEntryArray _states; private: /** * Setup sentence data @@ -50,7 +50,7 @@ private: * Sets flags 10 to different values based on the passed * dialogue Id */ - void setFlags10(int newId, int index); + void setFlags10(uint newId, uint index); /** * Trigers 12 @@ -83,7 +83,11 @@ public: */ virtual int updateState(uint oldId, uint newId, int index); - virtual int proc22(int id) const; + /** + * Handles getting a pre-response + */ + virtual int preResponse(uint id); + virtual int proc23() const; virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); diff --git a/engines/titanic/true_talk/script_support.cpp b/engines/titanic/true_talk/script_support.cpp index af5ef05283..f2c473d883 100644 --- a/engines/titanic/true_talk/script_support.cpp +++ b/engines/titanic/true_talk/script_support.cpp @@ -164,11 +164,11 @@ void TThandleQuoteEntries::load(const char *name) { /*------------------------------------------------------------------------*/ -void TTupdateState2Array::load(const char *name) { +void TTmapEntryArray::load(const char *name) { Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); while (r->pos() < r->size()) { - TTupdateState2 us; + TTmapEntry us; us._src = r->readUint32LE(); us._dest = r->readUint32LE(); @@ -178,13 +178,23 @@ void TTupdateState2Array::load(const char *name) { delete r; } +int TTmapEntryArray::find(uint id) const { + for (uint idx = 0; idx < size(); ++idx) { + const TTmapEntry &me = (*this)[idx]; + if (me._src == id) + return me._dest; + } + + return 0; +} + /*------------------------------------------------------------------------*/ -void TTupdateState3Array::load(const char *name) { +void TTupdateStateArray::load(const char *name) { Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); while (r->pos() < r->size()) { - TTupdateState3 ue; + TTupdateState ue; ue._newId = r->readUint32LE(); ue._newValue = r->readUint32LE(); ue._dialBits = r->readUint32LE(); diff --git a/engines/titanic/true_talk/script_support.h b/engines/titanic/true_talk/script_support.h index 6a60563202..ca70b09a62 100644 --- a/engines/titanic/true_talk/script_support.h +++ b/engines/titanic/true_talk/script_support.h @@ -142,27 +142,32 @@ public: void load(const char *name); }; -struct TTupdateState2 { +struct TTmapEntry { uint _src; uint _dest; - TTupdateState2() : _src(0), _dest(0) {} + TTmapEntry() : _src(0), _dest(0) {} }; -class TTupdateState2Array : public Common::Array { +class TTmapEntryArray : public Common::Array { public: void load(const char *name); + + /** + * Finds a record by Id, and returns it's associated value + */ + int find(uint id) const; }; -struct TTupdateState3 { +struct TTupdateState { uint _newId; uint _newValue; uint _dialBits; - TTupdateState3() : _newId(0), _newValue(0), _dialBits(0) {} + TTupdateState() : _newId(0), _newValue(0), _dialBits(0) {} }; -class TTupdateState3Array : public Common::Array { +class TTupdateStateArray : public Common::Array { public: void load(const char *name); }; diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 18ade0cba6..4cd964d57b 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -376,7 +376,7 @@ int TTnpcScript::updateState(uint oldId, uint newId, int index) { return newId; } -int TTnpcScript::proc22(int id) const { +int TTnpcScript::preResponse(uint id) { return 0; } @@ -742,7 +742,7 @@ int TTnpcScript::processEntries(const TTsentenceEntries *entries, uint entryCoun return 2; addResponse(dialogueId); - id = proc22(dialogueId); + id = preResponse(dialogueId); if (id) addResponse(getDialogueId(id)); applyResponse(); diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index eb53dc9bb2..f52df351b3 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -261,7 +261,10 @@ public: */ virtual int updateState(uint oldId, uint newId, int index); - virtual int proc22(int id) const; + /** + * Handles getting a pre-response + */ + virtual int preResponse(uint id); /** * Returns a bitset of the dials being off or not -- cgit v1.2.3 From eef9303027fd2ff8c71b111bb0a3bcda242098bc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 29 Jul 2016 22:07:49 -0400 Subject: TITANIC: Handle NPC postResponse methods --- engines/titanic/true_talk/barbot_script.cpp | 3 --- engines/titanic/true_talk/barbot_script.h | 2 -- engines/titanic/true_talk/bellbot_script.cpp | 3 --- engines/titanic/true_talk/bellbot_script.h | 1 - engines/titanic/true_talk/deskbot_script.cpp | 3 --- engines/titanic/true_talk/deskbot_script.h | 1 - engines/titanic/true_talk/doorbot_script.cpp | 3 --- engines/titanic/true_talk/doorbot_script.h | 1 - engines/titanic/true_talk/liftbot_script.cpp | 3 --- engines/titanic/true_talk/liftbot_script.h | 1 - engines/titanic/true_talk/maitred_script.cpp | 3 --- engines/titanic/true_talk/maitred_script.h | 1 - engines/titanic/true_talk/parrot_script.cpp | 3 --- engines/titanic/true_talk/parrot_script.h | 1 - engines/titanic/true_talk/succubus_script.cpp | 3 --- engines/titanic/true_talk/succubus_script.h | 1 - engines/titanic/true_talk/tt_npc_script.cpp | 5 +---- engines/titanic/true_talk/tt_npc_script.h | 7 ++++++- 18 files changed, 7 insertions(+), 38 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index 81682a2f7e..25252cc82c 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -1155,9 +1155,6 @@ int BarbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, return 2; } -void BarbotScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { -} - void BarbotScript::setDialRegion(int dialNum, int region) { TTnpcScript::setDialRegion(dialNum, region); selectResponse(250365); diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index 8a81099fd4..d1da7e1923 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -92,8 +92,6 @@ public: virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); - virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); - /** * Sets a given dial to be pointing in a specified region (0 to 2) */ diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 88f13cc351..ee964cbf25 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -407,9 +407,6 @@ int BellbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, return 0; } -void BellbotScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { -} - int BellbotScript::proc36(int id) const { warning("TODO"); return 0; diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index 60459651cf..fc88f62798 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -90,7 +90,6 @@ public: virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); - virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual int proc36(int val) const; }; diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 90fab86111..5b4eec13cd 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -312,9 +312,6 @@ int DeskbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, return 0; } -void DeskbotScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { -} - int DeskbotScript::proc36(int id) const { warning("TODO"); return 0; diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index 09ae9c839e..2e814eed3b 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -91,7 +91,6 @@ public: virtual int proc23() const; virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); - virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); virtual int proc36(int val) const; /** diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index d4c18cfc60..050a5440a7 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -515,9 +515,6 @@ int DoorbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, return 0; } -void DoorbotScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { -} - void DoorbotScript::setDialRegion(int dialNum, int region) { TTnpcScript::setDialRegion(dialNum, region); if (dialNum == 1 && region != 1) { diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 7aac6b2a98..11d4dd3190 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -89,7 +89,6 @@ public: virtual uint getDialsBitset() const; virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); - virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); /** * Sets a given dial to be pointing in a specified region (0 to 2) diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index 0f582154cf..7afd2c47ac 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -354,9 +354,6 @@ int LiftbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, return 0; } -void LiftbotScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { -} - void LiftbotScript::setDialRegion(int dialNum, int region) { TTnpcScript::setDialRegion(dialNum, region); addResponse(getDialogueId(210688)); diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index 33da983323..968e80dcf5 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -86,7 +86,6 @@ public: virtual uint getDialsBitset() const; virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); - virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); /** * Sets a given dial to be pointing in a specified region (0 to 2) diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index c6ceca89c7..0ef94e0910 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -311,9 +311,6 @@ int MaitreDScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, return 0; } -void MaitreDScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { -} - uint MaitreDScript::getStateDialogueId(uint oldId, uint newId) { if (getValue(8) || getValue(9)) return newId; diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index 60113b82dc..3cb2b5ab67 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -90,7 +90,6 @@ public: virtual int proc23() const; virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); - virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/parrot_script.cpp b/engines/titanic/true_talk/parrot_script.cpp index 01d998d9e8..c2f08ca37b 100644 --- a/engines/titanic/true_talk/parrot_script.cpp +++ b/engines/titanic/true_talk/parrot_script.cpp @@ -111,7 +111,4 @@ int ParrotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, return 0; } -void ParrotScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { -} - } // End of namespace Titanic diff --git a/engines/titanic/true_talk/parrot_script.h b/engines/titanic/true_talk/parrot_script.h index e832f7cfe7..620e098c0d 100644 --- a/engines/titanic/true_talk/parrot_script.h +++ b/engines/titanic/true_talk/parrot_script.h @@ -54,7 +54,6 @@ public: virtual int proc23() const; virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); - virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp index a6e1f7fccc..1050ba2a6c 100644 --- a/engines/titanic/true_talk/succubus_script.cpp +++ b/engines/titanic/true_talk/succubus_script.cpp @@ -99,7 +99,4 @@ int SuccUBusScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript return 0; } -void SuccUBusScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { -} - } // End of namespace Titanic diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h index 560272bdd9..7acc27fa0a 100644 --- a/engines/titanic/true_talk/succubus_script.h +++ b/engines/titanic/true_talk/succubus_script.h @@ -61,7 +61,6 @@ public: virtual int proc23() const; virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); - virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 4cd964d57b..7b25c66cc5 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -390,9 +390,6 @@ int TTnpcScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, T return 0; } -void TTnpcScript::proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) { -} - void TTnpcScript::save(SimpleFile *file) { file->writeNumber(charId()); saveBody(file); @@ -748,7 +745,7 @@ int TTnpcScript::processEntries(const TTsentenceEntries *entries, uint entryCoun applyResponse(); if (entry._field30) - proc26(entry._field30, &entry, roomScript, sentence); + postResponse(entry._field30, &entry, roomScript, sentence); return 2; } diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index f52df351b3..735e8b85b4 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -273,7 +273,12 @@ public: virtual const TTscriptMapping *getMapping(int index); virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); - virtual void proc26(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence); + + /** + * Handles any post-response NPC processing + */ + virtual void postResponse(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) {} + virtual void save(SimpleFile *file); virtual void load(SimpleFile *file); virtual void saveBody(SimpleFile *file); -- cgit v1.2.3 From 4df8e58cf39615398bf484e1eda34a7e9c507acb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 29 Jul 2016 22:22:37 -0400 Subject: TITANIC: Fix commented out quotes tree searches --- engines/titanic/true_talk/barbot_script.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index 25252cc82c..1ea2cae9bc 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -23,6 +23,7 @@ #include "common/textconsole.h" #include "titanic/true_talk/barbot_script.h" #include "titanic/true_talk/true_talk_manager.h" +#include "titanic/titanic.h" namespace Titanic { @@ -204,6 +205,7 @@ int BarbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { CTrueTalkManager::setFlags(33, getValue(33) - 1); CTrueTalkManager::setFlags(34, getValue(34) - 1); + TTtreeResult treeResult; int val34 = getState(); setState(0); @@ -297,18 +299,15 @@ int BarbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { return applySentenceIds(getDialogueId(250946)); break; case 15: - /* TODO if (flag || sentence->contains("or")) { return applySentenceIds(getDialogueId(250526), 16); } else { - TTtreeResult treeResult; - if (TTquotesTree::search(sentence->_normalizedLine.c_str(), - &TTnpcScript_BTREE_3, &treeResult, 0, 0) != -1) { - id = getDialogueId(250526); - return applySentenceIds(id, 16); + if (g_vm->_trueTalkManager->_quotesTree.search( + sentence->_normalizedLine.c_str(), TREE_3, &treeResult, 0, nullptr) != -1) { + uint newId = getDialogueId(250526); + return applySentenceIds(newId, 16); } } - */ break; case 17: if (flag) { @@ -358,12 +357,10 @@ int BarbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { return applySentenceIds(50215); break; case 26: - /* TODO - v43 = TTstring_cstr(&sentence->normalizedLine); - if (TTquotesTree_Search(v43, &TTnpcScript_BTREE_3, &buffer, 0, 0) == -1) - break; - */ - return applySentenceIds(getDialogueId(251899), 26); + if (g_vm->_trueTalkManager->_quotesTree.search( + sentence->_normalizedLine.c_str(), TREE_3, &treeResult, 0, nullptr) != -1) + return applySentenceIds(getDialogueId(251899), 26); + break; case 27: if (flag) -- cgit v1.2.3 From 6aef21517f5f65f6421103e1b2d150f44a6f17c6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 29 Jul 2016 22:27:07 -0400 Subject: TITANIC: Rename NPC scripts proc25 to doSentenceEntry --- engines/titanic/true_talk/barbot_script.cpp | 2 +- engines/titanic/true_talk/barbot_script.h | 2 +- engines/titanic/true_talk/bellbot_script.cpp | 2 +- engines/titanic/true_talk/bellbot_script.h | 2 +- engines/titanic/true_talk/deskbot_script.cpp | 2 +- engines/titanic/true_talk/deskbot_script.h | 2 +- engines/titanic/true_talk/doorbot_script.cpp | 2 +- engines/titanic/true_talk/doorbot_script.h | 2 +- engines/titanic/true_talk/liftbot_script.cpp | 2 +- engines/titanic/true_talk/liftbot_script.h | 2 +- engines/titanic/true_talk/maitred_script.cpp | 2 +- engines/titanic/true_talk/maitred_script.h | 2 +- engines/titanic/true_talk/parrot_script.cpp | 2 +- engines/titanic/true_talk/parrot_script.h | 2 +- engines/titanic/true_talk/succubus_script.cpp | 2 +- engines/titanic/true_talk/succubus_script.h | 2 +- engines/titanic/true_talk/tt_npc_script.cpp | 4 ++-- engines/titanic/true_talk/tt_npc_script.h | 2 +- 18 files changed, 19 insertions(+), 19 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index 1ea2cae9bc..fbda55425c 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -1015,7 +1015,7 @@ uint BarbotScript::getDialsBitset() const { return bits; } -int BarbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { +int BarbotScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { int v34 = getState(); uint id = 0; diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index d1da7e1923..d7fb1906f6 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -90,7 +90,7 @@ public: */ virtual uint getDialsBitset() const; - virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); + virtual int doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); /** * Sets a given dial to be pointing in a specified region (0 to 2) diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index ee964cbf25..d3fa24bcb4 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -323,7 +323,7 @@ int BellbotScript::proc23() const { return 0; } -int BellbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { +int BellbotScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { switch (val1) { case 1: addResponse(getDialogueId(*srcIdP)); diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index fc88f62798..ace2862ac1 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -88,7 +88,7 @@ public: virtual int proc23() const; - virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); + virtual int doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); virtual int proc36(int val) const; }; diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 5b4eec13cd..88bf1112d1 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -267,7 +267,7 @@ int DeskbotScript::proc23() const { return 0; } -int DeskbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { +int DeskbotScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { uint id; switch (val1) { diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index 2e814eed3b..2991e06636 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -90,7 +90,7 @@ public: virtual int preResponse(uint id); virtual int proc23() const; - virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); + virtual int doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); virtual int proc36(int val) const; /** diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 050a5440a7..8b837341b3 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -340,7 +340,7 @@ uint DoorbotScript::getDialsBitset() const { return bits; } -int DoorbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { +int DoorbotScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { int id2, id = 0; switch (val1) { diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 11d4dd3190..5f740dba17 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -88,7 +88,7 @@ public: */ virtual uint getDialsBitset() const; - virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); + virtual int doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); /** * Sets a given dial to be pointing in a specified region (0 to 2) diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index 7afd2c47ac..397338a1ab 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -247,7 +247,7 @@ uint LiftbotScript::getDialsBitset() const { } -int LiftbotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { +int LiftbotScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { static const int ARRAY13[] = { 210724, 210735, 210746, 210757, 210758, 210759, 210760, 210761, 210762, 210725, 210726, 210727, 210728, 210729, diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index 968e80dcf5..04d4b024b3 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -85,7 +85,7 @@ public: */ virtual uint getDialsBitset() const; - virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); + virtual int doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); /** * Sets a given dial to be pointing in a specified region (0 to 2) diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index 0ef94e0910..08e8119b00 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -306,7 +306,7 @@ int MaitreDScript::proc23() const { return 0; } -int MaitreDScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { +int MaitreDScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index 3cb2b5ab67..5d26bec5a2 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -89,7 +89,7 @@ public: virtual int preResponse(uint id); virtual int proc23() const; - virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); + virtual int doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/parrot_script.cpp b/engines/titanic/true_talk/parrot_script.cpp index c2f08ca37b..5894cd022c 100644 --- a/engines/titanic/true_talk/parrot_script.cpp +++ b/engines/titanic/true_talk/parrot_script.cpp @@ -107,7 +107,7 @@ int ParrotScript::proc23() const { return 0; } -int ParrotScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { +int ParrotScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { return 0; } diff --git a/engines/titanic/true_talk/parrot_script.h b/engines/titanic/true_talk/parrot_script.h index 620e098c0d..f83d1f55a6 100644 --- a/engines/titanic/true_talk/parrot_script.h +++ b/engines/titanic/true_talk/parrot_script.h @@ -53,7 +53,7 @@ public: virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); virtual int proc23() const; - virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); + virtual int doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp index 1050ba2a6c..2a44043fef 100644 --- a/engines/titanic/true_talk/succubus_script.cpp +++ b/engines/titanic/true_talk/succubus_script.cpp @@ -94,7 +94,7 @@ int SuccUBusScript::proc23() const { return 0; } -int SuccUBusScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { +int SuccUBusScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h index 7acc27fa0a..6401df08d7 100644 --- a/engines/titanic/true_talk/succubus_script.h +++ b/engines/titanic/true_talk/succubus_script.h @@ -60,7 +60,7 @@ public: virtual int updateState(uint oldId, uint newId, int index); virtual int proc23() const; - virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); + virtual int doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 7b25c66cc5..3e9af6583e 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -386,7 +386,7 @@ const TTscriptMapping *TTnpcScript::getMapping(int index) { return nullptr; } -int TTnpcScript::proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { +int TTnpcScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { return 0; } @@ -722,7 +722,7 @@ int TTnpcScript::processEntries(const TTsentenceEntries *entries, uint entryCoun if (!flag2) { flag = false; } else { - int result = proc25(entry._field2C & 0xFFFFFF, &entry._field0, + int result = doSentenceEntry(entry._field2C & 0xFFFFFF, &entry._field0, roomScript, sentence); if (result == 2) return 2; diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 735e8b85b4..e758cff737 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -272,7 +272,7 @@ public: virtual uint getDialsBitset() const { return 0; } virtual const TTscriptMapping *getMapping(int index); - virtual int proc25(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); + virtual int doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); /** * Handles any post-response NPC processing -- cgit v1.2.3 From a97dd2cda9a3352d74b66e1c317fa3aa2369ffe7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 29 Jul 2016 22:41:12 -0400 Subject: TITANIC: Handle NPC getDialsBitset methods --- engines/titanic/true_talk/barbot_script.h | 3 +++ engines/titanic/true_talk/bellbot_script.cpp | 5 ----- engines/titanic/true_talk/bellbot_script.h | 5 +++-- engines/titanic/true_talk/deskbot_script.cpp | 8 +++++--- engines/titanic/true_talk/deskbot_script.h | 10 +++++++++- engines/titanic/true_talk/doorbot_script.h | 3 +++ engines/titanic/true_talk/liftbot_script.h | 3 +++ engines/titanic/true_talk/maitred_script.cpp | 5 ----- engines/titanic/true_talk/maitred_script.h | 4 +++- engines/titanic/true_talk/parrot_script.cpp | 4 ---- engines/titanic/true_talk/parrot_script.h | 4 +++- engines/titanic/true_talk/succubus_script.cpp | 5 ----- engines/titanic/true_talk/succubus_script.h | 4 +++- 13 files changed, 35 insertions(+), 28 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index d7fb1906f6..77c7cce857 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -90,6 +90,9 @@ public: */ virtual uint getDialsBitset() const; + /** + * Process a sentence fragment entry + */ virtual int doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); /** diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index d3fa24bcb4..3149439b1f 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -318,11 +318,6 @@ int BellbotScript::preResponse(uint id) { return newId; } -int BellbotScript::proc23() const { - warning("TODO"); - return 0; -} - int BellbotScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { switch (val1) { case 1: diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index ace2862ac1..8b43e32005 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -86,8 +86,9 @@ public: */ virtual int preResponse(uint id); - virtual int proc23() const; - + /** + * Process a sentence fragment entry + */ virtual int doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); virtual int proc36(int val) const; diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 88bf1112d1..debd6ea7ba 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -262,9 +262,11 @@ int DeskbotScript::preResponse(uint id) { return newId; } -int DeskbotScript::proc23() const { - warning("TODO"); - return 0; +uint DeskbotScript::getDialsBitset() const { + if (getDialRegion(1)) + return getDialRegion(0) ? 2 : 3; + else + return getDialRegion(0) ? 0 : 1; } int DeskbotScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index 2991e06636..7a09c28d76 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -89,8 +89,16 @@ public: */ virtual int preResponse(uint id); - virtual int proc23() const; + /** + * Returns a bitset of the first three dialgs being on or not + */ + virtual uint getDialsBitset() const; + + /** + * Process a sentence fragment entry + */ virtual int doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); + virtual int proc36(int val) const; /** diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 5f740dba17..4c3c9eddd2 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -88,6 +88,9 @@ public: */ virtual uint getDialsBitset() const; + /** + * Process a sentence fragment entry + */ virtual int doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); /** diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index 04d4b024b3..118d6585bd 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -85,6 +85,9 @@ public: */ virtual uint getDialsBitset() const; + /** + * Process a sentence fragment entry + */ virtual int doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); /** diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index 08e8119b00..d013380fe7 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -301,11 +301,6 @@ int MaitreDScript::preResponse(uint id) { return 0; } -int MaitreDScript::proc23() const { - warning("TODO"); - return 0; -} - int MaitreDScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { warning("TODO"); return 0; diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index 5d26bec5a2..b3185d3b61 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -88,7 +88,9 @@ public: */ virtual int preResponse(uint id); - virtual int proc23() const; + /** + * Process a sentence fragment entry + */ virtual int doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); }; diff --git a/engines/titanic/true_talk/parrot_script.cpp b/engines/titanic/true_talk/parrot_script.cpp index 5894cd022c..0cd8082272 100644 --- a/engines/titanic/true_talk/parrot_script.cpp +++ b/engines/titanic/true_talk/parrot_script.cpp @@ -103,10 +103,6 @@ ScriptChangedResult ParrotScript::scriptChanged(TTscriptBase *roomScript, uint i return (id == 3) ? SCR_2 : SCR_1; } -int ParrotScript::proc23() const { - return 0; -} - int ParrotScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { return 0; } diff --git a/engines/titanic/true_talk/parrot_script.h b/engines/titanic/true_talk/parrot_script.h index f83d1f55a6..a27c159c79 100644 --- a/engines/titanic/true_talk/parrot_script.h +++ b/engines/titanic/true_talk/parrot_script.h @@ -52,7 +52,9 @@ public: */ virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); - virtual int proc23() const; + /** + * Process a sentence fragment entry + */ virtual int doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); }; diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp index 2a44043fef..07442ed758 100644 --- a/engines/titanic/true_talk/succubus_script.cpp +++ b/engines/titanic/true_talk/succubus_script.cpp @@ -89,11 +89,6 @@ int SuccUBusScript::updateState(uint oldId, uint newId, int index) { return 0; } -int SuccUBusScript::proc23() const { - warning("TODO"); - return 0; -} - int SuccUBusScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { warning("TODO"); return 0; diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h index 6401df08d7..4710e79a49 100644 --- a/engines/titanic/true_talk/succubus_script.h +++ b/engines/titanic/true_talk/succubus_script.h @@ -59,7 +59,9 @@ public: */ virtual int updateState(uint oldId, uint newId, int index); - virtual int proc23() const; + /** + * Process a sentence fragment entry + */ virtual int doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); }; -- cgit v1.2.3 From 1adebe83dc719699e0f32a238c5792a65847c76f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Jul 2016 12:15:28 -0400 Subject: TITANIC: Added NPC randomResponse methods, reworked NPC data --- engines/titanic/true_talk/barbot_script.cpp | 4 -- engines/titanic/true_talk/barbot_script.h | 2 - engines/titanic/true_talk/bellbot_script.cpp | 21 ++++++---- engines/titanic/true_talk/bellbot_script.h | 7 ++-- engines/titanic/true_talk/deskbot_script.cpp | 18 +++++++-- engines/titanic/true_talk/deskbot_script.h | 5 ++- engines/titanic/true_talk/doorbot_script.cpp | 38 ++++++++++++++++-- engines/titanic/true_talk/doorbot_script.h | 5 ++- engines/titanic/true_talk/tt_npc_script.cpp | 59 ++++++++++++++++++++++------ engines/titanic/true_talk/tt_npc_script.h | 23 ++++++++++- 10 files changed, 141 insertions(+), 41 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index fbda55425c..cc987f00b9 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -1158,10 +1158,6 @@ void BarbotScript::setDialRegion(int dialNum, int region) { applyResponse(); } -int BarbotScript::proc36(int tagId) const { - return 0; -} - void BarbotScript::adjustDial(int dialNum, int amount) { int level = CLIP(getDialLevel(dialNum) + amount, 0, 100); setDial(dialNum, level); diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index 77c7cce857..cf53e66b3d 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -99,8 +99,6 @@ public: * Sets a given dial to be pointing in a specified region (0 to 2) */ virtual void setDialRegion(int dialNum, int region); - - virtual int proc36(int val) const; }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 3149439b1f..7472111014 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -72,11 +72,6 @@ ScriptChangedResult BellbotScript::scriptChanged(TTscriptBase *roomScript, uint return SCR_1; } -int BellbotScript::proc15() const { - warning("TODO"); - return 0; -} - int BellbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder) { switch (tagId) { @@ -402,9 +397,19 @@ int BellbotScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *ro return 0; } -int BellbotScript::proc36(int id) const { - warning("TODO"); - return 0; +bool BellbotScript::randomResponse(int index) { + if (getRandomNumber(100) > 10 || getRandomNumber(10) <= index) + return 0; + + if (getRandomNumber(100) > 95) { + deleteResponses(); + addResponse(getDialogueId(201695)); + applyResponse(); + } else { + setResponseFromArray(index, 201696); + } + + return true; } int BellbotScript::addLocation() { diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index 8b43e32005..a006bb6d08 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -71,8 +71,6 @@ public: */ virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); - virtual int proc15() const; - virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder); @@ -91,7 +89,10 @@ public: */ virtual int doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); - virtual int proc36(int val) const; + /** + * Handles a randomzied response + */ + virtual bool randomResponse(int index); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index debd6ea7ba..c06e138332 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -38,7 +38,7 @@ DeskbotScript::DeskbotScript(int val1, const char *charClass, int v2, CTrueTalkManager::setFlags(22, 0); setupDials(0, 0, 0); - _array[0] = 100; + _data[0] = 100; if (_currentDialNum == 1) _currentDialNum = 0; @@ -314,9 +314,19 @@ int DeskbotScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *ro return 0; } -int DeskbotScript::proc36(int id) const { - warning("TODO"); - return 0; +bool DeskbotScript::randomResponse(int index) { + if (getValue(1) == 1 || getRandomNumber(100) > 10 || getRandomNumber(2) <= index) + return 0; + + if (getRandomNumber(100) > 95) { + deleteResponses(); + addResponse(getDialogueId(241195)); + applyResponse(); + } else { + setResponseFromArray(index, 241193); + } + + return true; } bool DeskbotScript::isDial0Medium() const { diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index 7a09c28d76..02a1126481 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -99,7 +99,10 @@ public: */ virtual int doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); - virtual int proc36(int val) const; + /** + * Handles a randomzied response + */ + virtual bool randomResponse(int index); /** * Returns true if dial 1 is the medium (1) region diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 8b837341b3..fa1078fe31 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -525,9 +525,41 @@ void DoorbotScript::setDialRegion(int dialNum, int region) { } } -int DoorbotScript::proc36(int id) const { - warning("TODO"); - return 0; +bool DoorbotScript::randomResponse(int index) { + static const int DIALOGUE_IDS[] = { + 220133, 220074, 220000, 220008, 220009, 220010, 220011, + 220012, 220013, 220014, 220015, 220016, 221053, 221054, + 221055, 221056, 221057, 221058, 221059, 221060, 221061, + 221173, 221174, 221175, 221176, 221177, 222415, 222416, + 221157, 221165, 221166, 221167, 221168, 221169, 221170, + 221171, 221172, 221158, 221159, 221356, 221364, 221365, + 221366, 221367, 221368, 221369, 221370, 221371, 221357, + 221358, 221359, 221360, 221252, 221019, 221355, 220952, + 220996, 220916, 220924, 220926, 220931, 220948, 220956, + 220965, 220967, 220968, 220980, 220981, 220982, 220983, + 220984, 220988, 220903, 221095, 222202, 222239, 221758, + 221759, 221762, 221763, 221766, 221767, 221768, 0 + }; + + int *dataP = _data.getSlot(index); + bool flag = false; + for (const int *idP = DIALOGUE_IDS; *idP && !flag; ++idP) { + flag = *idP == *dataP; + } + + if (flag || (getDialRegion(1) != 1 && getRandomNumber(100) > 33) + || getRandomNumber(8) <= index) + return false; + + if (getRandomNumber(100) > 40) { + deleteResponses(); + addResponse(getDialogueId(221242)); + applyResponse(); + } else { + setResponseFromArray(index, 221245); + } + + return true; } int DoorbotScript::setResponse(int dialogueId, int v34) { diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 4c3c9eddd2..c84af8c9f0 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -98,7 +98,10 @@ public: */ virtual void setDialRegion(int dialNum, int region); - virtual int proc36(int val) const; + /** + * Handles a randomzied response + */ + virtual bool randomResponse(int index); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 3e9af6583e..dd32114563 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -105,6 +105,16 @@ static const uint RANDOM9[] = { /*------------------------------------------------------------------------*/ +TTnpcData::TTnpcData() { + Common::fill(&_array[0], &_array[136], 0); +} + +void TTnpcData::resetFlags() { + Common::fill(&_array[20], &_array[136], 0); +} + +/*------------------------------------------------------------------------*/ + TTnpcScriptBase::TTnpcScriptBase(int charId, const char *charClass, int v2, const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) : TTscriptBase(0, charClass, v2, charName, v3, v4, v5, v6, v7), @@ -130,7 +140,6 @@ TTnpcScript::TTnpcScript(int charId, const char *charClass, int v2, _currentDialNum(0), _dialDelta(0), _field7C(0), _itemStringP(nullptr), _field2CC(false) { CTrueTalkManager::_v2 = 0; Common::fill(&_dialValues[0], &_dialValues[DIALS_ARRAY_COUNT], 0); - Common::fill(&_array[0], &_array[136], 0); if (!CTrueTalkManager::_v10) { Common::fill(&CTrueTalkManager::_v11[0], &CTrueTalkManager::_v11[41], 0); @@ -178,7 +187,7 @@ void TTnpcScript::loadRanges(const char *name) { } void TTnpcScript::resetFlags() { - Common::fill(&_array[20], &_array[136], 0); + _data.resetFlags(); _field2CC = false; } @@ -402,7 +411,7 @@ void TTnpcScript::save(SimpleFile *file) { file->writeNumber(10); for (int idx = 0; idx < 10; ++idx) - file->writeNumber(_array[idx]); + file->writeNumber(_data[idx]); } void TTnpcScript::load(SimpleFile *file) { @@ -421,7 +430,7 @@ void TTnpcScript::load(SimpleFile *file) { for (int idx = 0; idx < count; ++idx) { int v = file->readNumber(); if (idx < 10) - _array[idx] = v; + _data[idx] = v; } } @@ -533,8 +542,8 @@ int TTnpcScript::getDialLevel(uint dialNum, bool randomizeFlag) { return result; } -int TTnpcScript::proc36(int id) const { - return 0; +bool TTnpcScript::randomResponse(int index) { + return false; } uint TTnpcScript::translateId(uint id) const { @@ -624,7 +633,7 @@ uint TTnpcScript::getDialogueId(uint tagId) { _field2CC = true; int val = translateByArray(tagId); if (val > 0) { - if (proc36(val)) + if (randomResponse(val)) return 4; } } @@ -651,28 +660,32 @@ uint TTnpcScript::getDialogueId(uint tagId) { } uint newVal = tableP->_values[oldTagId]; + // First slot dialogue Ids idx = 0; - int *arrP = &_array[26]; + int *arrP = _data.getSlot(0); while (idx < 4 && arrP[idx]) ++idx; + if (idx == 4) return newVal; - - _array[26] = origId; + arrP[idx] = origId; + + // Second slot dialogue Ids idx = 0; - arrP = &_array[30]; + arrP = _data.getSlot(1); while (idx < 4 && arrP[idx]) ++idx; + if (idx == 4) return newVal; - arrP[idx] = newVal; + return newVal; } int TTnpcScript::translateByArray(int id) { for (uint idx = 1, arrIndex = 35; idx < 15; ++idx, arrIndex += 8) { - if (_array[idx - 1] == id && _array[idx] == 0) + if (_data[idx - 1] == id && _data[idx] == 0) return idx; } @@ -977,4 +990,24 @@ void TTnpcScript::getAssignedRoom(int *roomNum, int *floorNum, int *elevatorNum) *elevatorNum = CLIP(*elevatorNum, 1, 4); } +void TTnpcScript::setResponseFromArray(int index, int id) { + if (index >= 0 && index <= 15) { + deleteResponses(); + if (id) + addResponse(getDialogueId(id)); + + // Add any loaded responses + int *vals = _data.getSlot(index + 1); + for (int idx = 0; idx < 4; ++idx) { + if (vals[idx]) + addResponse(vals[idx]); + } + applyResponse(); + + // Clear out the values used + if (index) + Common::fill(vals, vals + 4, 0); + } +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index e758cff737..4f83f271ff 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -35,6 +35,16 @@ class CGameManager; class CPetControl; class TTroomScript; +struct TTnpcData { +private: + int _array[136]; +public: + TTnpcData(); + int &operator[](int idx) { return _array[idx]; } + int *getSlot(int idx) { return &_array[16 + idx * 4]; } + void resetFlags(); +}; + class TTnpcScriptBase : public TTscriptBase { protected: int _field54; @@ -93,7 +103,7 @@ protected: int _field7C; const char *_itemStringP; int _dialValues[DIALS_ARRAY_COUNT]; - int _array[136]; + TTnpcData _data; bool _field2CC; protected: /** @@ -194,6 +204,11 @@ protected: * Gets the assigned room's room, floor, and elevator number */ void getAssignedRoom(int *roomNum, int *floorNum, int *elevatorNum) const; + + /** + * Uses a porition of the state _array to set up a new response + */ + void setResponseFromArray(int index, int id); public: static void init(); static void deinit(); @@ -308,7 +323,11 @@ public: */ virtual int getDialLevel(uint dialNum, bool randomizeFlag = true); - virtual int proc36(int val) const; + /** + * Handles a randomzied response + */ + virtual bool randomResponse(int index); + virtual uint translateId(uint id) const; void preLoad(); -- cgit v1.2.3 From c3ba0badd1183e1f201c78690663e521b625196b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Jul 2016 16:41:01 -0400 Subject: TITANIC: Added BellbotScript preprocess --- engines/titanic/true_talk/bellbot_script.cpp | 813 ++++++++++++++++++++++++++- engines/titanic/true_talk/bellbot_script.h | 12 +- engines/titanic/true_talk/deskbot_script.cpp | 2 +- engines/titanic/true_talk/deskbot_script.h | 2 +- engines/titanic/true_talk/doorbot_script.cpp | 2 +- engines/titanic/true_talk/doorbot_script.h | 2 +- engines/titanic/true_talk/tt_npc_script.cpp | 2 +- engines/titanic/true_talk/tt_npc_script.h | 2 +- 8 files changed, 829 insertions(+), 8 deletions(-) diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 7472111014..9fbb49254f 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -397,7 +397,7 @@ int BellbotScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *ro return 0; } -bool BellbotScript::randomResponse(int index) { +bool BellbotScript::randomResponse(uint index) { if (getRandomNumber(100) > 10 || getRandomNumber(10) <= index) return 0; @@ -446,4 +446,815 @@ void BellbotScript::setValue23(uint id) { CTrueTalkManager::setFlags(23, val); } +int BellbotScript::preProcess(TTroomScript *roomScript, TTsentence *sentence) { + if (!roomScript || !sentence) + return true; + + bool applyFlag = false, stateFlag = true; + switch (getValue(23)) { + case 1: + if (sentence->_field2C == 11 || sentence->_field2C == 13) { + addResponse(getDialogueId(200818)); + applyFlag = true; + } + if (sentence->_field2C == 12) { + addResponse(getDialogueId(200817)); + applyFlag = true; + } + break; + + case 2: + if (sentence->_field2C == 11 || sentence->_field2C == 13) { + addResponse(getDialogueId(200835)); + addResponse(getDialogueId(200830)); + applyFlag = true; + } else if (sentence->_field2C == 12) { + addResponse(getDialogueId(200834)); + addResponse(getDialogueId(200830)); + applyFlag = true; + } + break; + + case 3: + if (sentence->_field2C >= 11 && sentence->_field2C <= 13) { + addResponse(getDialogueId(200831)); + addResponse(getDialogueId(200833)); + applyFlag = true; + } + break; + + case 4: + if (sentence->_field2C == 11) { + addResponse(getDialogueId(200872)); + applyFlag = true; + } + if (sentence->_field2C == 12 || sentence->_field2C == 13) { + addResponse(getDialogueId(200873)); + applyFlag = true; + } + break; + + case 5: + if (sentence->_field2C == 11 || sentence->_field2C == 13) { + addResponse(getDialogueId(200492)); + applyFlag = true; + } + if (sentence->_field2C == 12) { + addResponse(getDialogueId(200491)); + applyFlag = true; + } + break; + + case 6: + if (sentence->_field2C == 11 || sentence->_field2C == 13) { + addResponse(getDialogueId(200496)); + applyResponse(); + setState(0); + CTrueTalkManager::setFlags(23, 7); + return 2; + } + if (sentence->_field2C == 12) { + addResponse(getDialogueId(200127)); + applyFlag = true; + } + break; + + case 7: + addResponse(getDialogueId(200504)); + addResponse(getDialogueId(200496)); + applyFlag = true; + stateFlag = false; + break; + + case 8: + addResponse(getDialogueId(200494)); + applyFlag = true; + stateFlag = false; + break; + + case 9: + addResponse(getDialogueId(sentence->localWord("guess") ? 200495 : 200493)); + applyFlag = true; + break; + + case 10: + if (sentence->_field2C == 11 || sentence->_field2C == 13) { + addResponse(getDialogueId(200317)); + applyResponse(); + setState(0); + CTrueTalkManager::setFlags(23, 11); + return 2; + } + + addResponse(getDialogueId(sentence->_field2C == 12 ? 200316 : 200315)); + applyFlag = true; + break; + + case 11: + if (sentence->_field2C == 11 || sentence->_field2C == 13) { + addResponse(getDialogueId(200055)); + } else if (sentence->_field2C == 12) { + addResponse(getDialogueId(200318)); + } else { + addResponse(getDialogueId(200315)); + } + + applyFlag = true; + break; + + case 12: + if (sentence->_field2C == 6) { + addResponse(getDialogueId(200259)); + applyFlag = true; + } + break; + + case 13: + if (sentence->_field2C == 11 || sentence->_field2C == 13) { + addResponse(getDialogueId(200207)); + applyFlag = true; + } else if (sentence->_field2C == 12) { + addResponse(getDialogueId(200206)); + applyFlag = true; + } + break; + + case 14: + if (sentence->_field2C == 6) { + addResponse(getDialogueId(200349)); + applyFlag = true; + } + + case 15: + if (sentence->_field2C == 6) { + addResponse(getDialogueId(200130)); + applyResponse(); + setState(0); + CTrueTalkManager::setFlags(23, 16); + return 2; + } + break; + + case 16: + if (sentence->localWord("invented")) { + addResponse(getDialogueId(200131)); + applyFlag = true; + } + break; + + case 17: + if ((sentence->_field2C == 3 && sentence->localWord("code")) + || (sentence->localWord("which") && sentence->localWord("is")) + || sentence->localWord("remember") + || sentence->localWord("know") + ) { + addResponse(getDialogueId(200044)); + applyFlag = true; + stateFlag = false; + } + break; + + case 19: + if (sentence->_field2C == 11 || sentence->_field2C == 13) { + addResponse(getDialogueId(200223)); + applyFlag = true; + } + break; + + case 20: + addResponse(getDialogueId(200254)); + applyFlag = true; + break; + + case 21: + if (sentence->contains("hiker") || sentence->contains("hug")) { + addResponse(getDialogueId(200379)); + applyFlag = true; + } + break; + + case 22: + if (sentence->localWord("get") || sentence->localWord("it")) { + addResponse(getDialogueId(200474)); + applyFlag = true; + } + break; + + case 23: + addResponse(getDialogueId(sentence->localWord("long") ? 200870 : 200871)); + applyFlag = true; + break; + + case 24: + addResponse(getDialogueId(200793)); + applyFlag = true; + stateFlag = false; + break; + + case 25: + if (sentence->localWord("parrot")) { + addResponse(getDialogueId(200255)); + applyFlag = true; + stateFlag = false; + } + break; + + case 26: + if (sentence->localWord("cage")) { + addResponse(getDialogueId(200380)); + applyFlag = true; + stateFlag = false; + } + break; + + case 27: + addResponse(getDialogueId(200347)); + applyFlag = true; + stateFlag = false; + break; + + case 28: + if (sentence->localWord("perch")) { + addResponse(getDialogueId(200242)); + applyFlag = true; + stateFlag = false; + } + break; + + case 29: + if (sentence->localWord("brain") || sentence->localWord("titania")) { + addResponse(getDialogueId(200392)); + applyFlag = true; + stateFlag = false; + } + break; + + case 30: + if ((sentence->localWord("did") || sentence->localWord("not")) + || (sentence->localWord("would") || sentence->localWord("not")) + || (sentence->localWord("could") || sentence->localWord("not")) + || sentence->localWord("tried")) { + addResponse(getDialogueId(200416)); + applyFlag = true; + } + break; + + case 31: + addResponse(getDialogueId(sentence->_field2C == 11 ? 200810 : 200811)); + applyFlag = true; + break; + + case 32: + addResponse(getDialogueId(sentence->_field2C == 11 ? 200810 : 200812)); + applyFlag = true; + break; + + case 33: + addResponse(getDialogueId(200822)); + applyFlag = true; + break; + + case 34: + addResponse(getDialogueId(200824)); + applyFlag = true; + break; + + case 35: + if (sentence->_field2C == 3 && sentence->localWord("it") + && (sentence->localWord("for") || sentence->localWord("do"))) { + addResponse(getDialogueId(200768)); + applyFlag = true; + } + break; + + case 36: + if (sentence->_field2C == 11) { + CTrueTalkManager::triggerAction(14, 0); + addResponse(getDialogueId(200761)); + applyFlag = true; + } + break; + + case 37: + addResponse(getDialogueId(200630)); + applyFlag = true; + break; + + case 38: + if (sentence->_field2C == 12) { + addResponse(getDialogueId(200631)); + applyFlag = true; + } + break; + + case 39: + if (sentence->_field2C == 11 || sentence->_field2C == 13) { + addResponse(getDialogueId(200632)); + stateFlag = false; + } else { + addResponse(getDialogueId(200633)); + } + applyFlag = true; + break; + + case 40: + addResponse(getDialogueId(200633)); + applyFlag = true; + break; + + case 41: + addResponse(getDialogueId(sentence->contains("42") ? 200139 : 200627)); + applyFlag = true; + break; + + case 42: + if ((sentence->localWord("carry") && sentence->localWord("on")) + || (sentence->localWord("go") && sentence->localWord("on")) + || sentence->localWord("more") + || sentence->localWord("going") + || sentence->localWord("elaborate") + || sentence->localWord("suspicious") + || sentence->localWord("they")) { + addResponse(getDialogueId(200642)); + applyFlag = true; + stateFlag = false; + } + break; + + case 43: + if (sentence->_field2C == 11 || sentence->_field2C == 13) { + addResponse(getDialogueId(200643)); + applyFlag = true; + } + break; + + case 44: +case44: + if (better(sentence, 200615, 200613)) { + applyFlag = true; + stateFlag = false; + } + break; + + case 45: + if (sentence->contains("surprise")) { + addResponse(getDialogueId(200614)); + applyFlag = true; + stateFlag = false; + break; + } + goto case44; + + case 46: + if (sentence->contains("good")) { + addResponse(getDialogueId(200616)); + applyFlag = true; + stateFlag = false; + break; + } + goto case44; + + case 47: + if (sentence->_field2C == 12) + addResponse(getDialogueId(200368)); + addResponse(getDialogueId(200366)); + applyFlag = true; + stateFlag = false; + break; + + case 48: + if ((sentence->localWord("carry") && sentence->localWord("on")) + || sentence->localWord("more") + || (sentence->localWord("go") && sentence->localWord("on")) + || sentence->localWord("going") + || sentence->localWord("yes") + || sentence->localWord("really")) { + addResponse(getDialogueId(200367)); + applyFlag = true; + } + break; + + case 49: + if (sentence->_field2C >= 11 && sentence->_field2C <= 13) { + addResponse(getDialogueId(200407)); + applyFlag = true; + stateFlag = false; + } + break; + + case 50: + if (sentence->_field2C == 11 || sentence->_field2C == 13) { + addResponse(getDialogueId(200408)); + stateFlag = false; + } else { + addResponse(getDialogueId(200409)); + } + applyFlag = true; + break; + + case 51: + if (sentence->localWord("no") || sentence->localWord("it") + || sentence->localWord("is") || sentence->localWord("not") + || sentence->contains("yeah right")) { + addResponse(getDialogueId(200636)); + applyFlag = true; + } + break; + + case 52: + if (sentence->_field2C >= 11 && sentence->_field2C <= 13) { + addResponse(getDialogueId(200872)); + applyFlag = true; + } + break; + + case 53: + if (sentence->_field2C == 12) { + addResponse(getDialogueId(200525)); + applyFlag = true; + } else if (sentence->_field2C == 11 || sentence->_field2C == 13) { + addResponse(getDialogueId(200526)); + applyFlag = true; + } + break; + + case 54: + if (sentence->_field2C == 12) { + addResponse(getDialogueId(200095)); + applyFlag = true; + stateFlag = false; + } + break; + + case 55: + if (sentence->_field2C == 6) { + addResponse(getDialogueId(200112)); + applyFlag = true; + } + break; + + case 56: + if (sentence->localWord("sure") + || (sentence->localWord("nothing") && sentence->localWord("else"))) { + addResponse(getDialogueId(200649)); + applyFlag = true; + stateFlag = false; + } + break; + + case 57: + if (sentence->localWord("bad") + || (sentence->localWord("not") && sentence->localWord("good"))) { + addResponse(getDialogueId(200654)); + } else { + addResponse(getDialogueId(200655)); + stateFlag = false; + } + applyFlag = true; + break; + + case 58: + if (sentence->localWord("more") + || (sentence->localWord("go") && sentence->localWord("on")) + || (sentence->_field2C == 11 && sentence->localWord("really"))) { + addResponse(getDialogueId(200650)); + applyFlag = true; + stateFlag = false; + } + break; + + case 59: + if (!sentence->localWord("shutup")) { + addResponse(getDialogueId(200651)); + applyFlag = true; + stateFlag = false; + } + break; + + case 60: + if (sentence->_field2C == 3 && sentence->localWord("they") && sentence->localWord("do")) { + addResponse(getDialogueId(200652)); + applyFlag = true; +stateFlag = false; + } + break; + + case 61: + if ((sentence->localWord("that") && sentence->localWord("all")) + || (sentence->localWord("anything") && sentence->localWord("else"))) { + addResponse(getDialogueId(200653)); + applyFlag = true; + } + break; + + case 62: + if (sentence->localWord("meant") || sentence->localWord("woman")) { + addResponse(getDialogueId(200743)); + applyFlag = true; + } + break; + + case 63: + addResponse(getDialogueId(200208)); + applyFlag = true; + break; + + case 64: + if (sentence->localWord("rowboat")) { + addResponse(getDialogueId(200052)); + applyFlag = true; + } + break; + + case 65: + if (sentence->localWord("sorry")) { + addResponse(getDialogueId(200056)); + applyFlag = true; + stateFlag = false; + } + break; + + case 66: + if (sentence->localWord("sorry")) { + addResponse(getDialogueId(200057)); + applyFlag = true; + stateFlag = false; + } + break; + + case 67: + if (sentence->localWord("sorry")) { + addResponse(getDialogueId(200055)); + applyFlag = true; + stateFlag = false; + } + break; + + case 68: + if ((sentence->localWord("i") && sentence->localWord("care")) + || sentence->localWord("do") + || sentence->localWord("me")) { + addResponse(getDialogueId(201006)); + applyFlag = true; + } + break; + + case 69: + if ((sentence->localWord("what") && sentence->localWord("happen")) + || sentence->localWord("filigon")) { + addResponse(getDialogueId(201011)); + applyFlag = true; + stateFlag = false; + } + break; + + case 70: + if (sentence->_field2C == 12) { + addResponse(getDialogueId(201012)); + applyFlag = true; + stateFlag = false; + } + break; + + case 71: + if (sentence->localWord("why")) { + addResponse(getDialogueId(201013)); + applyFlag = true; + } + break; + + case 72: + if (sentence->_field2C == 12) { + addResponse(getDialogueId(200921)); + applyFlag = true; + } else if (sentence->_field2C == 11 || sentence->_field2C == 13) { + addResponse(getDialogueId(200920)); + applyFlag = true; + } + break; + + case 73: + if (sentence->localWord("mood") && (charId() == 7 || charId() == 5)) { + addResponse(getDialogueId(201021)); + applyFlag = true; + stateFlag = false; + } + break; + + case 74: + if (sentence->_field2C == 6) { + addResponse(getDialogueId(201022)); + applyFlag = true; + stateFlag = false; + } + break; + + case 75: + if (sentence->_field2C == 3) { + if (sentence->localWord("that") || sentence->localWord("worb")) { + addResponse(getDialogueId(201802)); + applyFlag = true; + } + } + break; + + case 76: + if (sentence->_field2C == 2 && (sentence->localWord("that") || sentence->localWord("gat"))) { + addResponse(getDialogueId(201034)); + applyFlag = true; + stateFlag = false; + } + break; + + case 77: + if (sentence->_field2C == 4 || sentence->_field2C == 3) { + if (sentence->localWord("that") || sentence->localWord("blerontis")) { + addResponse(getDialogueId(201035)); + applyFlag = true; + } + } + break; + + case 78: + if (sentence->_field2C == 12) { + addResponse(getDialogueId(201034)); + applyFlag = true; + stateFlag = false; + } else if (sentence->_field2C == 11) { + addResponse(getDialogueId(201040)); + applyFlag = true; + } else if ((sentence->localWord("not") && sentence->localWord("remember")) + || sentence->localWord("forgot")) { + addResponse(getDialogueId(201041)); + applyFlag = true; + stateFlag = false; + } else if (sentence->localWord("why")) { + addResponse(getDialogueId(201042)); + applyFlag = true; + stateFlag = false; + } + break; + + case 79: + if (sentence->_field2C == 11 || sentence->_field2C == 13) { + addResponse(getDialogueId(201052)); + CTrueTalkManager::triggerAction(14, 0); + applyFlag = true; + stateFlag = false; + } else if (sentence->_field2C == 12) { + addResponse(getDialogueId(202119)); + addResponse(getDialogueId(200256)); + applyFlag = true; + } + break; + + case 80: + if ((!sentence->localWord("what") && sentence->localWord("how")) + || sentence->localWord("about") + || sentence->localWord("you")) { + if (sentence->_field2C != 3 && sentence->_field2C != 4 && sentence->_field2C != 7) { + addResponse(getDialogueId(201694)); + applyFlag = true; + stateFlag = false; + } + } else { + addResponse(getDialogueId(201135)); + applyFlag = true; + } + break; + + case 81: + if ((!sentence->localWord("what") && !sentence->localWord("how")) + || !sentence->localWord("about") + || !sentence->localWord("you")) { + if (!sentence->localWord("and") || !sentence->localWord("yourself")) + break; + } + addResponse(getDialogueId(201135)); + applyFlag = true; + break; + + case 82: + if ((sentence->_field2C == 3 && sentence->localWord("mean")) + || sentence->localWord("surf") + || (sentence->localWord("what") && sentence->localWord("talk") + && sentence->localWord("about"))) { + addResponse(getDialogueId(201694)); + applyFlag = true; + stateFlag = false; + } + break; + + case 83: + if (sentence->_field2C != 3 && sentence->_field2C != 4 && sentence->_field2C != 7) { + addResponse(getDialogueId(201083)); + applyFlag = true; + } + break; + + case 84: + if (sentence->_field2C == 12) { + addResponse(getDialogueId(202119)); + + switch (getValue(1)) { + case 1: + addResponse(getDialogueId(202024)); + applyFlag = true; + break; + case 2: + addResponse(getDialogueId(201812)); + applyFlag = true; + stateFlag = false; + break; + default: + break; + } + } else if (sentence->_field2C == 11) { + addResponse(getDialogueId(201060)); + addResponse(getDialogueId(201079)); + applyFlag = true; + stateFlag = false; + } + break; + + case 85: + if (sentence->_field2C == 11 || sentence->_field2C == 13) { + addResponse(getDialogueId(201814)); + applyFlag = true; + } + if (sentence->_field2C == 12) { + addResponse(getDialogueId(201813)); + applyFlag = true; + } + break; + + case 86: + if (sentence->_field2C == 11 || sentence->_field2C == 13) { + addResponse(getDialogueId(202109)); + applyFlag = true; + } + if (sentence->_field2C == 12) { + addResponse(getDialogueId(202108)); + applyFlag = true; + } + break; + + case 87: + if (better(sentence, 201993, 200720)) { + applyFlag = true; + } + break; + + case 88: + if (sentence->_field2C == 6 || sentence->contains("upside down")) { + addResponse(getDialogueId(202142)); + applyFlag = true; + } + break; + + case 89: + if (sentence->_field2C == 2) { + addResponse(getDialogueId(200739)); + applyFlag = true; + stateFlag = false; + } + break; + + case 90: + if (sentence->contains("like") && (sentence->contains("slug") || sentence->contains("snail"))) { + addResponse(getDialogueId(201029)); + applyFlag = true; + stateFlag = false; + } else if (sentence->contains("slime") || sentence->localWord("what")) { + addResponse(getDialogueId(201220)); + applyFlag = true; + stateFlag = false; + } + + default: + break; + } + + if (applyFlag) + applyResponse(); + if (stateFlag) { + setState(0); + CTrueTalkManager::setFlags(23, 0); + } + + return applyFlag ? 2 : 1; +} + +bool BellbotScript::better(TTsentence *sentence, uint id1, uint id2) { + if (sentence->contains("good") || sentence->localWord("better")) { + addResponse(getDialogueId(id1)); + } else if (sentence->localWord("bad")) { + addResponse(getDialogueId(id2)); + } else { + return false; + } + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index a006bb6d08..d144b413a3 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -57,6 +57,16 @@ private: * Sets the state value 25 based on the passed Id */ void setValue23(uint id); + + /** + * Does preprocessing for the sentence + */ + int preProcess(TTroomScript *roomScript, TTsentence *sentence); + + /** + * Checks for good, better, or bad in the sentence + */ + bool better(TTsentence *sentence, uint id1, uint id2); public: BellbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); @@ -92,7 +102,7 @@ public: /** * Handles a randomzied response */ - virtual bool randomResponse(int index); + virtual bool randomResponse(uint index); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index c06e138332..4ac04c70fb 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -314,7 +314,7 @@ int DeskbotScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *ro return 0; } -bool DeskbotScript::randomResponse(int index) { +bool DeskbotScript::randomResponse(uint index) { if (getValue(1) == 1 || getRandomNumber(100) > 10 || getRandomNumber(2) <= index) return 0; diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index 02a1126481..d8a181c07b 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -102,7 +102,7 @@ public: /** * Handles a randomzied response */ - virtual bool randomResponse(int index); + virtual bool randomResponse(uint index); /** * Returns true if dial 1 is the medium (1) region diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index fa1078fe31..a9f1689d4f 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -525,7 +525,7 @@ void DoorbotScript::setDialRegion(int dialNum, int region) { } } -bool DoorbotScript::randomResponse(int index) { +bool DoorbotScript::randomResponse(uint index) { static const int DIALOGUE_IDS[] = { 220133, 220074, 220000, 220008, 220009, 220010, 220011, 220012, 220013, 220014, 220015, 220016, 221053, 221054, diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index c84af8c9f0..70cdfeaf3a 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -101,7 +101,7 @@ public: /** * Handles a randomzied response */ - virtual bool randomResponse(int index); + virtual bool randomResponse(uint index); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index dd32114563..14da4868a5 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -542,7 +542,7 @@ int TTnpcScript::getDialLevel(uint dialNum, bool randomizeFlag) { return result; } -bool TTnpcScript::randomResponse(int index) { +bool TTnpcScript::randomResponse(uint index) { return false; } diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 4f83f271ff..09fe470e72 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -326,7 +326,7 @@ public: /** * Handles a randomzied response */ - virtual bool randomResponse(int index); + virtual bool randomResponse(uint index); virtual uint translateId(uint id) const; -- cgit v1.2.3 From 6eca1801726de8e4c64c043eb16e89c64f72473e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Jul 2016 17:07:48 -0400 Subject: DEVTOOLS: Compilation fix for create_titanic under gcc --- devtools/create_titanic/hashmap.h | 2 +- devtools/create_titanic/memorypool.cpp | 182 +++++++++++++++++++++++++++++++++ devtools/create_titanic/memorypool.h | 162 +++++++++++++++++++++++++++++ devtools/create_titanic/str.cpp | 2 +- 4 files changed, 346 insertions(+), 2 deletions(-) create mode 100644 devtools/create_titanic/memorypool.cpp create mode 100644 devtools/create_titanic/memorypool.h diff --git a/devtools/create_titanic/hashmap.h b/devtools/create_titanic/hashmap.h index d7ba100571..c8691aeb42 100644 --- a/devtools/create_titanic/hashmap.h +++ b/devtools/create_titanic/hashmap.h @@ -50,7 +50,7 @@ #endif #ifdef USE_HASHMAP_MEMORY_POOL -#include "common/memorypool.h" +#include "memorypool.h" #endif diff --git a/devtools/create_titanic/memorypool.cpp b/devtools/create_titanic/memorypool.cpp new file mode 100644 index 0000000000..13c640b6ad --- /dev/null +++ b/devtools/create_titanic/memorypool.cpp @@ -0,0 +1,182 @@ +/* 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 "memorypool.h" +#include "common/util.h" + +namespace Common { + +enum { + INITIAL_CHUNKS_PER_PAGE = 8 +}; + +static size_t adjustChunkSize(size_t chunkSize) { + // You must at least fit the pointer in the node (technically unneeded considering the next rounding statement) + chunkSize = MAX(chunkSize, sizeof(void *)); + // There might be an alignment problem on some platforms when trying to load a void* on a non natural boundary + // so we round to the next sizeof(void *) + chunkSize = (chunkSize + sizeof(void *) - 1) & (~(sizeof(void *) - 1)); + + return chunkSize; +} + + +MemoryPool::MemoryPool(size_t chunkSize) + : _chunkSize(adjustChunkSize(chunkSize)) { + + _next = NULL; + + _chunksPerPage = INITIAL_CHUNKS_PER_PAGE; +} + +MemoryPool::~MemoryPool() { +#if 0 + freeUnusedPages(); + if (!_pages.empty()) + warning("Memory leak found in pool"); +#endif + + for (size_t i = 0; i < _pages.size(); ++i) + ::free(_pages[i].start); +} + +void MemoryPool::allocPage() { + Page page; + + // Allocate a new page + page.numChunks = _chunksPerPage; + assert(page.numChunks * _chunkSize < 16*1024*1024); // Refuse to allocate pages bigger than 16 MB + + page.start = ::malloc(page.numChunks * _chunkSize); + assert(page.start); + _pages.push_back(page); + + + // Next time, we'll allocate a page twice as big as this one. + _chunksPerPage *= 2; + + // Add the page to the pool of free chunk + addPageToPool(page); +} + +void MemoryPool::addPageToPool(const Page &page) { + // Add all chunks of the new page to the linked list (pool) of free chunks + void *current = page.start; + for (size_t i = 1; i < page.numChunks; ++i) { + void *next = (byte *)current + _chunkSize; + *(void **)current = next; + + current = next; + } + + // Last chunk points to the old _next + *(void **)current = _next; + + // From now on, the first free chunk is the first chunk of the new page + _next = page.start; +} + +void *MemoryPool::allocChunk() { + // No free chunks left? Allocate a new page + if (!_next) + allocPage(); + + assert(_next); + void *result = _next; + _next = *(void **)result; + return result; +} + +void MemoryPool::freeChunk(void *ptr) { + // Add the chunk back to (the start of) the list of free chunks + *(void **)ptr = _next; + _next = ptr; +} + +// Technically not compliant C++ to compare unrelated pointers. In practice... +bool MemoryPool::isPointerInPage(void *ptr, const Page &page) { + return (ptr >= page.start) && (ptr < (char *)page.start + page.numChunks * _chunkSize); +} + +void MemoryPool::freeUnusedPages() { + //std::sort(_pages.begin(), _pages.end()); + Array numberOfFreeChunksPerPage; + numberOfFreeChunksPerPage.resize(_pages.size()); + for (size_t i = 0; i < numberOfFreeChunksPerPage.size(); ++i) { + numberOfFreeChunksPerPage[i] = 0; + } + + // Compute for each page how many chunks in it are still in use. + void *iterator = _next; + while (iterator) { + // TODO: This should be a binary search (requiring us to keep _pages sorted) + for (size_t i = 0; i < _pages.size(); ++i) { + if (isPointerInPage(iterator, _pages[i])) { + ++numberOfFreeChunksPerPage[i]; + break; + } + } + + iterator = *(void **)iterator; + } + + // Free all pages which are not in use. + size_t freedPagesCount = 0; + for (size_t i = 0; i < _pages.size(); ++i) { + if (numberOfFreeChunksPerPage[i] == _pages[i].numChunks) { + // Remove all chunks of this page from the list of free chunks + void **iter2 = &_next; + while (*iter2) { + if (isPointerInPage(*iter2, _pages[i])) + *iter2 = **(void ***)iter2; + else + iter2 = *(void ***)iter2; + } + + ::free(_pages[i].start); + ++freedPagesCount; + _pages[i].start = NULL; + } + } + +// debug("freed %d pages out of %d", (int)freedPagesCount, (int)_pages.size()); + + // Remove all now unused pages + size_t newSize = 0; + for (size_t i = 0; i < _pages.size(); ++i) { + if (_pages[i].start != NULL) { + if (newSize != i) + _pages[newSize] = _pages[i]; + ++newSize; + } + } + _pages.resize(newSize); + + // Reset _chunksPerPage + _chunksPerPage = INITIAL_CHUNKS_PER_PAGE; + for (size_t i = 0; i < _pages.size(); ++i) { + if (_chunksPerPage < _pages[i].numChunks) + _chunksPerPage = _pages[i].numChunks; + } +} + +} // End of namespace Common diff --git a/devtools/create_titanic/memorypool.h b/devtools/create_titanic/memorypool.h new file mode 100644 index 0000000000..c8a8fc7a53 --- /dev/null +++ b/devtools/create_titanic/memorypool.h @@ -0,0 +1,162 @@ +/* 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. + * + */ + +#ifndef COMMON_MEMORYPOOL_H +#define COMMON_MEMORYPOOL_H + +#include "common/array.h" + + +namespace Common { + +/** + * This class provides a pool of memory 'chunks' of identical size. + * The size of a chunk is determined when creating the memory pool. + * + * Using a memory pool may yield better performance and memory usage + * when allocating and deallocating many memory blocks of equal size. + * E.g. the Common::String class uses a memory pool for the refCount + * variables (each the size of an int) it allocates for each string + * instance. + */ +class MemoryPool { +protected: + MemoryPool(const MemoryPool&); + MemoryPool& operator=(const MemoryPool&); + + struct Page { + void *start; + size_t numChunks; + }; + + const size_t _chunkSize; + Array _pages; + void *_next; + size_t _chunksPerPage; + + void allocPage(); + void addPageToPool(const Page &page); + bool isPointerInPage(void *ptr, const Page &page); + +public: + /** + * Constructor for a memory pool with the given chunk size. + * @param chunkSize the chunk size of this memory pool + */ + explicit MemoryPool(size_t chunkSize); + ~MemoryPool(); + + /** + * Allocate a new chunk from the memory pool. + */ + void *allocChunk(); + /** + * Return a chunk to the memory pool. The given pointer must have + * been obtained from calling the allocChunk() method of the very + * same MemoryPool instance. Passing any other pointer (e.g. to + * a chunk from another MemoryPool, or a malloc'ed memory block) + * will lead to undefined behavior and may result in a crash (if + * you are lucky) or in silent data corruption. + */ + void freeChunk(void *ptr); + + /** + * Perform garbage collection. The memory pool stores all the + * chunks it manages in memory 'pages' obtained via the classic + * memory allocation APIs (i.e. malloc/free). Ordinarily, once + * a page has been allocated, it won't be released again during + * the life time of the memory pool. The exception is when this + * method is called. + */ + void freeUnusedPages(); + + /** + * Return the chunk size used by this memory pool. + */ + size_t getChunkSize() const { return _chunkSize; } +}; + +/** + * This is a memory pool which already contains in itself some storage + * space for a fixed number of chunks. Thus if the memory pool is only + * lightly used, no malloc() calls have to be made at all. + */ +template +class FixedSizeMemoryPool : public MemoryPool { +private: + enum { + REAL_CHUNK_SIZE = (CHUNK_SIZE + sizeof(void *) - 1) & (~(sizeof(void *) - 1)) + }; + + byte _storage[NUM_INTERNAL_CHUNKS * REAL_CHUNK_SIZE]; +public: + FixedSizeMemoryPool() : MemoryPool(CHUNK_SIZE) { + assert(REAL_CHUNK_SIZE == _chunkSize); + // Insert some static storage + Page internalPage = { _storage, NUM_INTERNAL_CHUNKS }; + addPageToPool(internalPage); + } +}; + +// Ensure NUM_INTERNAL_CHUNKS == 0 results in a compile error +template +class FixedSizeMemoryPool : public MemoryPool { +public: + FixedSizeMemoryPool() : MemoryPool(CHUNK_SIZE) {} +}; + +/** + * A memory pool for C++ objects. + */ +template +class ObjectPool : public FixedSizeMemoryPool { +public: + /** + * Return the memory chunk used as storage for the given object back + * to the pool, after calling its destructor. + */ + void deleteChunk(T *ptr) { + ptr->~T(); + this->freeChunk(ptr); + } +}; + +} // End of namespace Common + +/** + * A custom placement new operator, using an arbitrary MemoryPool. + * + * This *should* work with all C++ implementations, but may not. + * + * For details on using placement new for custom allocators, see e.g. + * + */ +inline void *operator new(size_t nbytes, Common::MemoryPool &pool) { + assert(nbytes <= pool.getChunkSize()); + return pool.allocChunk(); +} + +inline void operator delete(void *p, Common::MemoryPool &pool) { + pool.freeChunk(p); +} + +#endif diff --git a/devtools/create_titanic/str.cpp b/devtools/create_titanic/str.cpp index 14a6e505ce..6aa66d0d20 100644 --- a/devtools/create_titanic/str.cpp +++ b/devtools/create_titanic/str.cpp @@ -22,7 +22,7 @@ #include "common/hash-str.h" #include "common/list.h" -#include "common/memorypool.h" +#include "memorypool.h" #include "common/str.h" #include "common/util.h" -- cgit v1.2.3 From 6dbbb173bd7738ff725eefbd12923699d1663392 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Jul 2016 17:39:09 -0400 Subject: TITANIC: Fix identified warnings --- engines/titanic/core/link_item.cpp | 14 +++++++------- engines/titanic/sound/sound_manager.cpp | 6 +++--- engines/titanic/sound/sound_manager.h | 6 +++--- engines/titanic/support/simple_file.cpp | 16 +++++++++------- engines/titanic/support/simple_file.h | 4 ++-- 5 files changed, 24 insertions(+), 22 deletions(-) diff --git a/engines/titanic/core/link_item.cpp b/engines/titanic/core/link_item.cpp index 110218401a..f77d081c61 100644 --- a/engines/titanic/core/link_item.cpp +++ b/engines/titanic/core/link_item.cpp @@ -50,24 +50,24 @@ CString CLinkItem::formName() { switch (_linkMode) { case 1: return CString::format("_PANL,%d,%s,%s", node->_nodeNumber, - view->getName(), destView->getName()); + view->getName().c_str(), destView->getName().c_str()); case 2: return CString::format("_PANR,%d,%s,%s", node->_nodeNumber, - view->getName(), destView->getName()); + view->getName().c_str(), destView->getName().c_str()); case 3: return CString::format("_TRACK,%d,%s,%d,%s", - node->_nodeNumber, view->getName(), - destNode->_nodeNumber, destView->getName()); + node->_nodeNumber, view->getName().c_str(), + destNode->_nodeNumber, destView->getName().c_str()); case 4: return CString::format("_EXIT,%d,%d,%s,%d,%d,%s", - room->_roomNumber, node->_nodeNumber, view->getName(), - destRoom->_roomNumber, destNode->_nodeNumber, destView->getName()); + room->_roomNumber, node->_nodeNumber, view->getName().c_str(), + destRoom->_roomNumber, destNode->_nodeNumber, destView->getName().c_str()); default: - return getName(); + return getName().c_str(); } } diff --git a/engines/titanic/sound/sound_manager.cpp b/engines/titanic/sound/sound_manager.cpp index 440d74ade5..1cafe3bafa 100644 --- a/engines/titanic/sound/sound_manager.cpp +++ b/engines/titanic/sound/sound_manager.cpp @@ -39,12 +39,12 @@ int QSoundManager::loadSound(const CString &name) { return 0; } -int QSoundManager::proc4() { +int QSoundManager::proc4() const { warning("TODO"); return 0; } -int QSoundManager::proc5() { +int QSoundManager::proc5() const { warning("TODO"); return 0; } @@ -91,7 +91,7 @@ bool QSoundManager::isActive(int handle) const { return false; } -int QSoundManager::proc16() { +int QSoundManager::proc16() const { warning("TODO"); return 0; } diff --git a/engines/titanic/sound/sound_manager.h b/engines/titanic/sound/sound_manager.h index 942124e796..a65162d779 100644 --- a/engines/titanic/sound/sound_manager.h +++ b/engines/titanic/sound/sound_manager.h @@ -119,8 +119,8 @@ public: */ virtual int loadSound(const CString &name); - virtual int proc4(); - virtual int proc5(); + virtual int proc4() const; + virtual int proc5() const; virtual void proc6(); virtual void proc7(); virtual void proc8(int v); @@ -131,7 +131,7 @@ public: virtual void proc13(); virtual bool proc14(); virtual bool isActive(int handle) const; - virtual int proc16(); + virtual int proc16() const; virtual void WaveMixPump(); diff --git a/engines/titanic/support/simple_file.cpp b/engines/titanic/support/simple_file.cpp index e60b7c7485..35b2e28e4a 100644 --- a/engines/titanic/support/simple_file.cpp +++ b/engines/titanic/support/simple_file.cpp @@ -36,9 +36,9 @@ CString readStringFromStream(Common::SeekableReadStream *s) { /*------------------------------------------------------------------------*/ -bool File::open(const Common::String &name) { - if (!Common::File::open(name)) - error("Could not open file - %s", name.c_str()); +bool File::open(const Common::String &filename) { + if (!Common::File::open(filename)) + error("Could not open file - %s", filename.c_str()); return true; } @@ -466,8 +466,9 @@ void SimpleFile::skipSpaces() { /*------------------------------------------------------------------------*/ -void StdCWadFile::open(const CString &name) { +bool StdCWadFile::open(const Common::String &filename) { File f; + CString name = filename; // Check for whether it is indeed a file/resource pair int idx = name.indexOf('#'); @@ -478,17 +479,17 @@ void StdCWadFile::open(const CString &name) { f.open(name); SimpleFile::open(f.readStream(f.size())); - return; + return true; } // Split up the name and resource, and get the resource index - CString filename = name.left(idx) + ".st"; + CString fname = name.left(idx) + ".st"; int extPos = name.lastIndexOf('.'); CString resStr = name.mid(idx + 1, extPos - idx - 1); int resIndex = resStr.readInt(); // Open up the index for access - f.open(filename); + f.open(fname); int indexSize = f.readUint32LE() / 4; assert(resIndex < indexSize); @@ -505,6 +506,7 @@ void StdCWadFile::open(const CString &name) { SimpleFile::open(stream); f.close(); + return true; } } // End of namespace Titanic diff --git a/engines/titanic/support/simple_file.h b/engines/titanic/support/simple_file.h index 0cfb424fad..6cf9995d16 100644 --- a/engines/titanic/support/simple_file.h +++ b/engines/titanic/support/simple_file.h @@ -41,7 +41,7 @@ class DecompressorData; */ class File : public Common::File { public: - virtual bool open(const Common::String &name); + virtual bool open(const Common::String &filename); }; /** @@ -293,7 +293,7 @@ public: /** * Open up the specified file */ - void open(const CString &name); + virtual bool open(const Common::String &filename); /** * Return a reference to the read stream -- cgit v1.2.3 From 01910f32f091debc62a8151b3bbde919d95d3fb3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Jul 2016 17:45:50 -0400 Subject: TITANIC: Fix identified warnings --- engines/titanic/pet_control/pet_control.cpp | 2 +- engines/titanic/pet_control/pet_control.h | 2 +- engines/titanic/pet_control/pet_conversations.cpp | 2 +- engines/titanic/pet_control/pet_conversations.h | 2 +- engines/titanic/pet_control/pet_inventory.cpp | 2 +- engines/titanic/pet_control/pet_inventory.h | 2 +- engines/titanic/pet_control/pet_rooms.cpp | 2 +- engines/titanic/pet_control/pet_rooms.h | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp index 83081456d1..b32a7907a4 100644 --- a/engines/titanic/pet_control/pet_control.cpp +++ b/engines/titanic/pet_control/pet_control.cpp @@ -142,7 +142,7 @@ void CPetControl::draw(CScreenManager *screenManager) { } } -Rect CPetControl::getBounds() { +Rect CPetControl::getBounds() const { return _sections[_currentArea]->getBounds(); } diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h index 362fc11f6e..ef7e49d4e4 100644 --- a/engines/titanic/pet_control/pet_control.h +++ b/engines/titanic/pet_control/pet_control.h @@ -143,7 +143,7 @@ public: /** * Gets the bounds occupied by the item */ - virtual Rect getBounds(); + virtual Rect getBounds() const; /** * Setups the sections within the PET diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index 0a8a71bf94..9bae8e7070 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -130,7 +130,7 @@ void CPetConversations::draw(CScreenManager *screenManager) { _npcIcons[_npcNum].draw(screenManager); } -Rect CPetConversations::getBounds() { +Rect CPetConversations::getBounds() const { Rect rect = _dials[0].getBounds(); rect.combine(_dials[1].getBounds()); rect.combine(_dials[2].getBounds()); diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index 62cddd4008..9e8b093d62 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -160,7 +160,7 @@ public: /** * Get the bounds for the section */ - virtual Rect getBounds(); + virtual Rect getBounds() const; /** * Returns true if the object is in a valid state diff --git a/engines/titanic/pet_control/pet_inventory.cpp b/engines/titanic/pet_control/pet_inventory.cpp index 2f8125cfac..2fb60bf9a6 100644 --- a/engines/titanic/pet_control/pet_inventory.cpp +++ b/engines/titanic/pet_control/pet_inventory.cpp @@ -53,7 +53,7 @@ void CPetInventory::draw(CScreenManager *screenManager) { _text.draw(screenManager); } -Rect CPetInventory::getBounds() { +Rect CPetInventory::getBounds() const { return _movie ? _movie->getBounds() : Rect(); } diff --git a/engines/titanic/pet_control/pet_inventory.h b/engines/titanic/pet_control/pet_inventory.h index 9e074dd89b..17649546ce 100644 --- a/engines/titanic/pet_control/pet_inventory.h +++ b/engines/titanic/pet_control/pet_inventory.h @@ -79,7 +79,7 @@ public: /** * Get the bounds for the section */ - virtual Rect getBounds(); + virtual Rect getBounds() const; /** * Called when a general change occurs diff --git a/engines/titanic/pet_control/pet_rooms.cpp b/engines/titanic/pet_control/pet_rooms.cpp index 2d731130e9..dfaa0405e4 100644 --- a/engines/titanic/pet_control/pet_rooms.cpp +++ b/engines/titanic/pet_control/pet_rooms.cpp @@ -172,7 +172,7 @@ CPetText *CPetRooms::getText() { return &_text; } -CGameObject *CPetRooms::getBackground(int index) { +CGameObject *CPetRooms::getBackground(int index) const { switch (index) { case 8: return _chevLeftOnDim; diff --git a/engines/titanic/pet_control/pet_rooms.h b/engines/titanic/pet_control/pet_rooms.h index b82b42ca8b..ba3356091a 100644 --- a/engines/titanic/pet_control/pet_rooms.h +++ b/engines/titanic/pet_control/pet_rooms.h @@ -145,7 +145,7 @@ public: /** * Special retrieval of glyph background image */ - virtual CGameObject *getBackground(int index); + virtual CGameObject *getBackground(int index) const; /** * Reset the highlight -- cgit v1.2.3 From d9435e538f3b06e4e51b414076134126ae498e72 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Jul 2016 20:02:52 -0400 Subject: TITANIC: Added BellbotScript process --- devtools/create_titanic/create_titanic_dat.cpp | 22 +- engines/titanic/true_talk/bellbot_script.cpp | 311 ++++++++++++++++++++++++- engines/titanic/true_talk/bellbot_script.h | 15 +- engines/titanic/true_talk/script_handler.cpp | 4 +- engines/titanic/true_talk/tt_script_base.cpp | 2 +- engines/titanic/true_talk/tt_script_base.h | 2 +- 6 files changed, 347 insertions(+), 9 deletions(-) diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index cffbf3cab4..afed200d4d 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -55,7 +55,7 @@ */ #define VERSION_NUMBER 1 -#define HEADER_SIZE 0x900 +#define HEADER_SIZE 0xB00 Common::File inputFile, outputFile; Common::PEResources res; @@ -565,6 +565,26 @@ void writeData() { writeSentenceEntries("Sentences/Barbot", 0x5ABE60); writeSentenceEntries("Sentences/Barbot2", 0x5BD4E8); writeSentenceEntries("Sentences/Bellbot", 0x5C2230); + writeSentenceEntries("Sentences/Bellbot/1", 0x5D1670); + writeSentenceEntries("Sentences/Bellbot/2", 0x5D1A80); + writeSentenceEntries("Sentences/Bellbot/3", 0x5D1AE8); + writeSentenceEntries("Sentences/Bellbot/4", 0x5D1B88); + writeSentenceEntries("Sentences/Bellbot/5", 0x5D2A60); + writeSentenceEntries("Sentences/Bellbot/6", 0x5D2CD0); + writeSentenceEntries("Sentences/Bellbot/7", 0x5D3488); + writeSentenceEntries("Sentences/Bellbot/8", 0x5D3900); + writeSentenceEntries("Sentences/Bellbot/9", 0x5D3968); + writeSentenceEntries("Sentences/Bellbot/10", 0x5D4668); + writeSentenceEntries("Sentences/Bellbot/11", 0x5D47A0); + writeSentenceEntries("Sentences/Bellbot/12", 0x5D4EC0); + writeSentenceEntries("Sentences/Bellbot/13", 0x5D5100); + writeSentenceEntries("Sentences/Bellbot/14", 0x5D5370); + writeSentenceEntries("Sentences/Bellbot/15", 0x5D5548); + writeSentenceEntries("Sentences/Bellbot/16", 0x5D56B8); + writeSentenceEntries("Sentences/Bellbot/17", 0x5D57C0); + writeSentenceEntries("Sentences/Bellbot/18", 0x5D5B38); + writeSentenceEntries("Sentences/Bellbot/19", 0x5D61B8); + writeSentenceEntries("Sentences/Deskbot", 0x5DCD10); writeSentenceEntries("Sentences/Doorbot", 0x5EC110); writeSentenceEntries("Sentences/Liftbot", 0x6026B0); diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 9fbb49254f..8f465b908d 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -57,14 +57,279 @@ BellbotScript::BellbotScript(int val1, const char *charClass, int v2, void BellbotScript::setupSentences() { _mappings.load("Mappings/Bellbot", 1); _entries.load("Sentences/Bellbot"); + for (int idx = 1; idx < 20; ++idx) + _sentences[idx].load(CString::format("Sentences/Bellbot/%d", idx)); + _field2DC = 0; _field68 = 0; _entryCount = 0; } int BellbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { - // TODO - return 0; + int val24 = getValue(24); + CTrueTalkManager::setFlags(24, 0); + + int result = preprocess(roomScript, sentence); + if (result != 1) + return 1; + + CTrueTalkManager::setFlags(23, 0); + setState(0); + if (getValue(1) <= 2) + updateCurrentDial(1); + + // Handle room specific sentences + switch (roomScript->_scriptId) { + case 101: + if (getValue(2) == 1) { + result = processEntries(&_sentences[11], 0, roomScript, sentence); + } + break; + + case 107: + result = processEntries(&_sentences[5], 0, roomScript, sentence); + break; + + case 108: + result = processEntries(&_sentences[7], 0, roomScript, sentence); + break; + + case 109: + result = processEntries(&_sentences[13], 0, roomScript, sentence); + break; + + case 110: + result = processEntries(&_sentences[16], 0, roomScript, sentence); + break; + + case 111: + result = processEntries(&_sentences[10], 0, roomScript, sentence); + break; + + case 112: + result = processEntries(&_sentences[15], 0, roomScript, sentence); + break; + + case 113: + result = processEntries(&_sentences[9], 0, roomScript, sentence); + break; + + case 114: + result = processEntries(&_sentences[18], 0, roomScript, sentence); + break; + + case 115: + result = processEntries(&_sentences[12], 0, roomScript, sentence); + break; + + case 116: + result = processEntries(&_sentences[8], 0, roomScript, sentence); + break; + + case 117: + result = processEntries(&_sentences[6], 0, roomScript, sentence); + break; + + case 123: + result = processEntries(&_sentences[17], 0, roomScript, sentence); + break; + + case 125: + result = processEntries(&_sentences[14], 0, roomScript, sentence); + break; + + case 131: + if (getValue(26) == 0) { + result = processEntries(&_sentences[getValue(6) ? 5 : 4], 0, roomScript, sentence); + } + break; + } + + if (result == 2) + return 2; + if (sentence->contains("pretend you summoned yourself") || + sentence->contains("pretend you just summoned yourself")) { + if (scriptChanged(roomScript, 157) == 2) + return 2; + } + + if (sentence->localWord("television") || roomScript->_scriptId == 111) { + if (sentence->localWord("drop") || sentence->localWord("throw") + || sentence->localWord("smash") || sentence->localWord("destroy") + || sentence->localWord("toss") || sentence->localWord("put") + || sentence->localWord("pitch") || sentence->localWord("heft")) { + if (getValue(40) == 1) { + addResponse(getDialogueId(201687)); + applyResponse(); + return 2; + } + else if (roomScript->_scriptId == 111) { + addResponse(getDialogueId(201687)); + applyResponse(); + CTrueTalkManager::triggerAction(17, 0); + CTrueTalkManager::setFlags(40, 1); + return 2; + } + else { + addResponse(getDialogueId(200710)); + addResponse(getDialogueId(201334)); + applyResponse(); + return 2; + } + } + } + + if (sentence->contains("what should i do here") + || sentence->contains("what do i do here") + || sentence->contains("what shall i do in here") + || sentence->contains("what shall i do in this room") + || sentence->contains("what should i do in this room") + || sentence->contains("what am i supposed to do in here") + || sentence->contains("what should i do in here") + || sentence->contains("what do i do in this room")) { + if (randomResponse4(roomScript)) { + applyResponse(); + return 2; + } + } + + if (sentence->contains("help") + || sentence->contains("what now") + || sentence->contains("what next") + || sentence->contains("give me a hint") + || sentence->contains("i need a hint") + || sentence->contains("what should i be doing") + || sentence->contains("what do you reckon i should do now") + || sentence->contains("what shall i do") + || sentence->contains("what would you do") + || sentence->contains("what should i do") + || sentence->contains("what do i do")) { + if (getDialRegion(0) == 1) { + randomResponse5(roomScript, getValue(1)); + applyResponse(); + return 2; + } else { + randomResponse3(roomScript, getValue(1)); + } + } + + if (sentence->get58() > 6 && sentence->contains("please")) { + addResponse(getDialogueId(200432)); + applyResponse(); + return 2; + } + + if (checkCommonSentences(roomScript, sentence) == 2) + return 2; + + // WORKAROUND: Skip processEntries call on unassigned sentence array + + // Standard sentence list + if (processEntries(&_entries, _entryCount, roomScript, sentence) == 2) + return 2; + + if ((sentence->_field2C == 4 && sentence->localWord("am") && sentence->localWord("i")) + || (sentence->localWord("are") && sentence->localWord("we")) + || (sentence->_field2C == 3 && sentence->localWord("room") + && sentence->localWord("we") && sentence->localWord("in")) + || (sentence->_field2C == 3 && sentence->localWord("rom") + && sentence->localWord("is") && sentence->localWord("this")) + ) { + uint id = getRangeValue(getRoomDialogueId(roomScript)); + addResponse(getDialogueId(id ? id : 201384)); + applyResponse(); + return 2; + } + + if (getValue(1) >= 3) { + result = processEntries(&_sentences[1], 0, roomScript, sentence); + } else if (getValue(1) == 2) { + result = processEntries(&_sentences[2], 0, roomScript, sentence); + } else if (getValue(1) == 1) { + result = processEntries(&_sentences[3], 0, roomScript, sentence); + + if (sentence->contains("shrinkbot")) { + addResponse(getDialogueId(200583)); + applyResponse(); + return 2; + } + } + + if (sentence->localWord("television") || sentence->localWord("tv") + || sentence->localWord("crush") || sentence->localWord("crushed")) { + if (roomScript->_scriptId == 111 || getRandomBit()) { + addResponse(getDialogueId(getRandomBit() ? 200912 : 200913)); + } else { + addResponse(getDialogueId(200710)); + addResponse(getDialogueId(201334)); + } + + applyResponse(); + return 2; + } + + if (checkCommonWords(roomScript, sentence)) { + applyResponse(); + setState(0); + return 2; + } + + if (sentence->contains("my") && (sentence->contains("where can i find") + || sentence->contains("where is") + || sentence->contains("wheres") + || sentence->contains("help me find") + || sentence->contains("what have you done with") + || sentence->contains("have you got") + || sentence->contains("id like") + || sentence->contains("i would like") + || sentence->contains("have you seen") + )) { + addResponse(getDialogueId(200799)); + applyResponse(); + return 2; + } + + setupSentences(); + uint tagId = g_vm->_trueTalkManager->_quotes.find(sentence->_normalizedLine); + if (tagId && chooseResponse(roomScript, sentence, tagId) == 2) + return 2; + if (defaultProcess(roomScript, sentence)) + return 2; + if (!processEntries(&_sentences[19], 0, roomScript, sentence)) + return 2; + if (!processEntries(_defaultEntries, 0, roomScript, sentence)) + return 2; + + if (sentence->contains("42")) { + addResponse(getDialogueId(200515)); + applyResponse(); + return 2; + } + + CTrueTalkManager::setFlags(24, val24 + 1); + if (getValue(24) > 3) { + addResponse(getDialogueId(200200)); + applyResponse(); + return 2; + } + + if (sentence->localWord("get")) { + addResponse(getDialogueId(200475)); + applyResponse(); + return 2; + } + + if (getRandomNumber(100) <= 75) { + addResponse(getDialogueId(200060)); + applyResponse(); + return 2; + } + + addResponse(getDialogueId(200140)); + addResponse(getDialogueId(getRandomBit() ? 200192 : 200157)); + addResponse(getDialogueId(200176)); + applyResponse(); + return 2; } ScriptChangedResult BellbotScript::scriptChanged(TTscriptBase *roomScript, uint id) { @@ -446,7 +711,7 @@ void BellbotScript::setValue23(uint id) { CTrueTalkManager::setFlags(23, val); } -int BellbotScript::preProcess(TTroomScript *roomScript, TTsentence *sentence) { +int BellbotScript::preprocess(TTroomScript *roomScript, TTsentence *sentence) { if (!roomScript || !sentence) return true; @@ -1257,4 +1522,44 @@ bool BellbotScript::better(TTsentence *sentence, uint id1, uint id2) { return true; } +bool BellbotScript::randomResponse1(TTroomScript *roomScript, uint id) { + // TODO + return false; +} + +bool BellbotScript::randomResponse2(TTroomScript *roomScript, uint id) { + // TODO + return false; +} + +bool BellbotScript::randomResponse3(TTroomScript *roomScript, uint id) { + // TODO + return false; +} + +bool BellbotScript::randomResponse4(TTroomScript *roomScript) { + // TODO + return false; +} + +bool BellbotScript::randomResponse5(TTroomScript *roomScript, uint id) { + // TODO + return false; +} + +int BellbotScript::checkCommonSentences(TTroomScript *roomScript, TTsentence *sentence) { + // TODO + return 0; +} + +int BellbotScript::checkCommonWords(TTroomScript *roomScript, TTsentence *sentence) { + // TODO + return 0; +} + +int BellbotScript::getRoomDialogueId(TTroomScript *roomScript) { + // TODO + return 0; +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index d144b413a3..4fe850bc9f 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -32,6 +32,7 @@ private: static uint _oldId; TTmapEntryArray _states; TTmapEntryArray _preResponses; + TTsentenceEntries _sentences[20]; int _array[150]; int _field2D0; int _field2D4; @@ -61,12 +62,24 @@ private: /** * Does preprocessing for the sentence */ - int preProcess(TTroomScript *roomScript, TTsentence *sentence); + int preprocess(TTroomScript *roomScript, TTsentence *sentence); /** * Checks for good, better, or bad in the sentence */ bool better(TTsentence *sentence, uint id1, uint id2); + + bool randomResponse1(TTroomScript *roomScript, uint id); + bool randomResponse2(TTroomScript *roomScript, uint id); + bool randomResponse3(TTroomScript *roomScript, uint id); + bool randomResponse4(TTroomScript *roomScript); + bool randomResponse5(TTroomScript *roomScript, uint id); + + int checkCommonSentences(TTroomScript *roomScript, TTsentence *sentence); + int checkCommonWords(TTroomScript *roomScript, TTsentence *sentence); + + int getRoomDialogueId(TTroomScript *roomScript); + public: BellbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp index 51e88ec3ea..64e789a4b9 100644 --- a/engines/titanic/true_talk/script_handler.cpp +++ b/engines/titanic/true_talk/script_handler.cpp @@ -83,8 +83,8 @@ int CScriptHandler::processInput(TTroomScript *roomScript, TTnpcScript *npcScrip TTsentence *sentence = new TTsentence(_inputCtr++, line, this, roomScript, npcScript); int result = _parser.preprocess(sentence); - roomScript->preprocess(sentence); - npcScript->preprocess(sentence); + roomScript->scriptPreprocess(sentence); + npcScript->scriptPreprocess(sentence); int canProcess = 0; if (result) { diff --git a/engines/titanic/true_talk/tt_script_base.cpp b/engines/titanic/true_talk/tt_script_base.cpp index e96f877810..4109134501 100644 --- a/engines/titanic/true_talk/tt_script_base.cpp +++ b/engines/titanic/true_talk/tt_script_base.cpp @@ -87,7 +87,7 @@ void TTscriptBase::reset() { _oldResponseP = nullptr; } -int TTscriptBase::preprocess(TTsentence *sentence) { +int TTscriptBase::scriptPreprocess(TTsentence *sentence) { delete _hist1P; _hist1P = new TTscriptHist(sentence); diff --git a/engines/titanic/true_talk/tt_script_base.h b/engines/titanic/true_talk/tt_script_base.h index 3060602d1b..3377aaa5f5 100644 --- a/engines/titanic/true_talk/tt_script_base.h +++ b/engines/titanic/true_talk/tt_script_base.h @@ -121,7 +121,7 @@ public: /** * Gets passed a newly created input wrapper during conversation text processing */ - int preprocess(TTsentence *sentence); + int scriptPreprocess(TTsentence *sentence); }; -- cgit v1.2.3 From cf63ceeb3c8e0b32b08e01186fe741bd42653c7e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Jul 2016 21:34:41 -0400 Subject: TITANIC: Adding BellbotScript support methods --- engines/titanic/true_talk/bellbot_script.cpp | 189 ++++++++++++++++++++++++--- engines/titanic/true_talk/bellbot_script.h | 15 ++- engines/titanic/true_talk/doorbot_script.cpp | 8 +- engines/titanic/true_talk/script_support.h | 5 + engines/titanic/true_talk/tt_room_script.h | 2 +- engines/titanic/true_talk/tt_scripts.cpp | 2 +- engines/titanic/true_talk/tt_scripts.h | 2 +- 7 files changed, 192 insertions(+), 31 deletions(-) diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 8f465b908d..9d2b93e2d0 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -34,7 +34,8 @@ uint BellbotScript::_oldId; BellbotScript::BellbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2) : TTnpcScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0), - _field2D0(0), _field2D4(0), _field2D8(0), _field2DC(0) { + _field2D0(0), _field2D4(0), _field2D8(0), _field2DC(0), + _room107First(false) { CTrueTalkManager::setFlags(25, 0); CTrueTalkManager::setFlags(24, 0); CTrueTalkManager::setFlags(40, 0); @@ -187,7 +188,7 @@ int BellbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { || sentence->contains("what am i supposed to do in here") || sentence->contains("what should i do in here") || sentence->contains("what do i do in this room")) { - if (randomResponse4(roomScript)) { + if (addRoomDescription(roomScript)) { applyResponse(); return 2; } @@ -205,7 +206,7 @@ int BellbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { || sentence->contains("what should i do") || sentence->contains("what do i do")) { if (getDialRegion(0) == 1) { - randomResponse5(roomScript, getValue(1)); + randomResponse4(roomScript, getValue(1)); applyResponse(); return 2; } else { @@ -1522,29 +1523,88 @@ bool BellbotScript::better(TTsentence *sentence, uint id1, uint id2) { return true; } +bool BellbotScript::randomResponse0(TTroomScript *roomScript, uint id) { + bool dr0 = getDialRegion(0) == 1; + uint newId = getValue(1); + + if (getValue(25) == 0) { + CTrueTalkManager::setFlags(25, 1); + if (getValue(1) > 2) { + addResponse(getDialogueId(202043)); + applyResponse(); + return true; + } + } + + bool result = dr0 ? randomResponse1(roomScript, newId) : + randomResponse2(roomScript, newId); + if (result) + CTrueTalkManager::triggerAction(1, 0); + + return true; +} + bool BellbotScript::randomResponse1(TTroomScript *roomScript, uint id) { - // TODO + if (getRandomNumber(100) < 10) { + addResponse(getDialogueId(201978)); + applyResponse(); + } else { + if (getRandomNumber(100) < 50) + addResponse(getDialogueId(202259)); + + randomResponse3(roomScript, id); + applyResponse(); + } + return false; } bool BellbotScript::randomResponse2(TTroomScript *roomScript, uint id) { - // TODO - return false; -} + if (getRandomNumber(100) < 5) { + addResponse(getDialogueId(202262)); + applyResponse(); + } else { + if (getRandomNumber(100) < 40) + addResponse(getDialogueId(202258)); + + randomResponse4(roomScript, id); + applyResponse(); + } -bool BellbotScript::randomResponse3(TTroomScript *roomScript, uint id) { - // TODO return false; } -bool BellbotScript::randomResponse4(TTroomScript *roomScript) { - // TODO - return false; +void BellbotScript::randomResponse3(TTroomScript *roomScript, uint id) { + bool result = false; + if (roomScript && getRandomNumber(100) < 50) + result = addRoomDescription(roomScript); + + if (result) + return; + if (getRandomNumber(100) >= 50) { + addResponse(getDialogueId(202262)); + return; + } + + if (id <= 2) { + if (getRandomNumber(100) < 50) { + addResponse(getDialogueId(202266)); + return; + } else if (id == 2) { + addResponse(getDialogueId(202264)); + return; + } + } + + addResponse(getDialogueId(id == 1 ? 202265 : 202263)); } -bool BellbotScript::randomResponse5(TTroomScript *roomScript, uint id) { - // TODO - return false; +void BellbotScript::randomResponse4(TTroomScript *roomScript, uint id) { + if (getRandomNumber(100) < 4 && id <= 2) { + addResponse(getDialogueId(202268)); + } else { + addResponse(getDialogueId(202267)); + } } int BellbotScript::checkCommonSentences(TTroomScript *roomScript, TTsentence *sentence) { @@ -1557,9 +1617,104 @@ int BellbotScript::checkCommonWords(TTroomScript *roomScript, TTsentence *senten return 0; } -int BellbotScript::getRoomDialogueId(TTroomScript *roomScript) { - // TODO +uint BellbotScript::getRoomDialogueId(TTroomScript *roomScript) { + if (!roomScript) + return 0; + + static const RoomDialogueId ROOM_DIALOGUE_IDS[] = { + { 100, 201442 }, { 101, 201417 }, { 107, 201491 }, { 108, 201421 }, + { 109, 201437 }, { 110, 201431 }, { 111, 201457 }, { 112, 201411 }, + { 113, 201424 }, { 114, 201464 }, { 115, 201407 }, { 116, 201468 }, + { 117, 201447 }, { 122, 201491 }, { 123, 201299 }, { 124, 201479 }, + { 125, 201480 }, { 126, 201476 }, { 127, 201483 }, { 128, 201399 }, + { 129, 201400 }, { 130, 201387 }, { 131, 201395 }, { 132, 201388 }, + { 0, 0 } + }; + + for (int idx = 0; ROOM_DIALOGUE_IDS[idx]._roomNum; ++idx) { + if (ROOM_DIALOGUE_IDS[idx]._roomNum == roomScript->_scriptId) + return ROOM_DIALOGUE_IDS[idx]._dialogueId; + } + return 0; } +bool BellbotScript::addRoomDescription(TTroomScript *roomScript) { + if (!roomScript) + return false; + + switch (roomScript->_scriptId) { + case 101: + addResponse(getDialogueId(getValue(2) == 1 ? 20185 : 201832)); + break; + case 107: + if (_room107First) { + addResponse(getDialogueId(202162)); + } else { + addResponse(getDialogueId(202162)); + _room107First = true; + } + break; + case 108: + addResponse(getDialogueId(201844)); + break; + case 109: + addResponse(getDialogueId(200303)); + break; + case 110: + addResponse(getDialogueId(202257)); + break; + case 111: + addResponse(getDialogueId(202056)); + break; + case 112: + addResponse(getDialogueId(201828)); + break; + case 113: + addResponse(getDialogueId(201859)); + break; + case 114: + addResponse(getDialogueId(202052)); + break; + case 115: + addResponse(getDialogueId(202004)); + break; + case 116: + addResponse(getDialogueId(202092)); + break; + case 117: + addResponse(getDialogueId(202027)); + break; + case 124: + addResponse(getDialogueId(202110)); + break; + case 125: + addResponse(getDialogueId(202103)); + break; + case 126: + addResponse(getDialogueId(202116)); + break; + case 127: + addResponse(getDialogueId(202111)); + break; + case 128: + addResponse(getDialogueId(201815)); + break; + case 129: + addResponse(getDialogueId(201816)); + break; + case 131: + addResponse(getDialogueId(201930)); + break; + case 132: + addResponse(getDialogueId(201924)); + break; + default: + return false; + } + + return true; +} + + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index 4fe850bc9f..f960521cf8 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -38,6 +38,7 @@ private: int _field2D4; int _field2D8; int _field2DC; + bool _room107First; private: /** * Setup sentence data @@ -69,17 +70,21 @@ private: */ bool better(TTsentence *sentence, uint id1, uint id2); + bool randomResponse0(TTroomScript *roomScript, uint id); bool randomResponse1(TTroomScript *roomScript, uint id); bool randomResponse2(TTroomScript *roomScript, uint id); - bool randomResponse3(TTroomScript *roomScript, uint id); - bool randomResponse4(TTroomScript *roomScript); - bool randomResponse5(TTroomScript *roomScript, uint id); + void randomResponse3(TTroomScript *roomScript, uint id); + void randomResponse4(TTroomScript *roomScript, uint id); int checkCommonSentences(TTroomScript *roomScript, TTsentence *sentence); int checkCommonWords(TTroomScript *roomScript, TTsentence *sentence); - int getRoomDialogueId(TTroomScript *roomScript); - + uint getRoomDialogueId(TTroomScript *roomScript); + + /** + * Adds a description of the room to the conversation response + */ + bool addRoomDescription(TTroomScript *roomScript); public: BellbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index a9f1689d4f..5839b72ba2 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -31,10 +31,6 @@ static const int STATE_ARRAY[9] = { 0x2E2A, 0x2E2B, 0x2E2C, 0x2E2D, 0x2E2E, 0x2E2F, 0x2E30, 0x2E31, 0x2E32 }; -struct RoomDialogueId { - int _roomNum; - int _dialogueId; -}; static const RoomDialogueId ROOM_DIALOGUES1[] = { { 100, 10523 }, { 101, 10499 }, { 107, 10516 }, { 108, 10500 }, { 109, 10490 }, { 110, 10504 }, { 111, 10506 }, { 112, 10498 }, @@ -573,7 +569,7 @@ int DoorbotScript::setResponse(int dialogueId, int v34) { int DoorbotScript::getRoomDialogueId1(const TTroomScript *roomScript) { for (const RoomDialogueId *r = ROOM_DIALOGUES1; r->_roomNum; ++r) { - if (r->_roomNum == roomScript->_scriptId == r->_roomNum) + if (r->_roomNum == roomScript->_scriptId) return getDialogueId(r->_dialogueId); } @@ -582,7 +578,7 @@ int DoorbotScript::getRoomDialogueId1(const TTroomScript *roomScript) { int DoorbotScript::getRoomDialogueId2(const TTroomScript *roomScript) { for (const RoomDialogueId *r = ROOM_DIALOGUES2; r->_roomNum; ++r) { - if (r->_roomNum == roomScript->_scriptId == r->_roomNum) + if (r->_roomNum == roomScript->_scriptId) return getDialogueId(r->_dialogueId); } diff --git a/engines/titanic/true_talk/script_support.h b/engines/titanic/true_talk/script_support.h index ca70b09a62..bc184641e4 100644 --- a/engines/titanic/true_talk/script_support.h +++ b/engines/titanic/true_talk/script_support.h @@ -31,6 +31,11 @@ namespace Titanic { enum ScriptArrayFlag { SF_NONE = 0, SF_RANDOM = 1, SF_SEQUENTIAL = 2 }; +struct RoomDialogueId { + uint _roomNum; + uint _dialogueId; +}; + struct TTnpcScriptResponse { uint _tag; uint _values[4]; diff --git a/engines/titanic/true_talk/tt_room_script.h b/engines/titanic/true_talk/tt_room_script.h index d4da5fcc10..39a50ac30d 100644 --- a/engines/titanic/true_talk/tt_room_script.h +++ b/engines/titanic/true_talk/tt_room_script.h @@ -32,7 +32,7 @@ class TTsentence; class TTroomScriptBase : public TTscriptBase { public: - int _scriptId; + uint _scriptId; public: TTroomScriptBase(int scriptId, const char *charClass, const char *charName, int v3, int v4, int v5, int v6, int v2, int v7); diff --git a/engines/titanic/true_talk/tt_scripts.cpp b/engines/titanic/true_talk/tt_scripts.cpp index 5783866b7e..f8ea65a475 100644 --- a/engines/titanic/true_talk/tt_scripts.cpp +++ b/engines/titanic/true_talk/tt_scripts.cpp @@ -45,7 +45,7 @@ TTnpcScript *TTnpcScriptList::findById(int charId) const { /*------------------------------------------------------------------------*/ -TTroomScript *TTroomScriptList::findById(int scriptId) const { +TTroomScript *TTroomScriptList::findById(uint scriptId) const { for (TTroomScriptList::const_iterator i = begin(); i != end(); ++i) { const TTroomScriptListItem *item = *i; if (item->_item->_scriptId == scriptId) diff --git a/engines/titanic/true_talk/tt_scripts.h b/engines/titanic/true_talk/tt_scripts.h index afcc2c3aef..734d86256f 100644 --- a/engines/titanic/true_talk/tt_scripts.h +++ b/engines/titanic/true_talk/tt_scripts.h @@ -51,7 +51,7 @@ public: class TTroomScriptList : public List { public: - TTroomScript *findById(int scriptId) const; + TTroomScript *findById(uint scriptId) const; }; class TTscripts { -- cgit v1.2.3 From 2b38dd4ff110e56e741b6ae6c2ea1598ddee6fc6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Jul 2016 23:28:03 -0400 Subject: TITANIC: Added Bellbot common phrase list to create_titanic --- devtools/create_titanic/create_titanic_dat.cpp | 63 ++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index afed200d4d..bf1da8e427 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -202,6 +202,54 @@ const NumberEntry NUMBERS[76] = { { "hundredth", 100, 6 } }; +struct CommonPhrase { + const char *_str; + uint _dialogueId; + uint _roomNum; + uint _val1; +}; + +static const CommonPhrase BELLBOT_COMMON_PHRASES[] = { + { "what is wrong with her", 0x30FF9, 0x7B, 0 }, + { "what is wrong with titania", 0x30FF9, 0x7B, 0 }, + { "something for the weekend", 0x30D8B, 0x00, 0 }, + { "other food", 0x30E1D, 0x00, 3 }, + { "different food", 0x30E1D, 0x00, 3 }, + { "alternative food", 0x30E1D, 0x00, 3 }, + { "decent food", 0x30E1D, 0x00, 3 }, + { "nice food", 0x30E1D, 0x00, 3 }, + { "nicer food", 0x30E1D, 0x00, 3 }, + { "make me happy", 0x31011, 0x00, 0 }, + { "cheer me up", 0x31011, 0x00, 0 }, + { "help me if im unhappy", 0x31011, 0x00, 0 }, + { "i obtain a better room", 0x30E8A, 0x00, 3 }, + { "i obtain a better room", 0x30E8A, 0x00, 2 }, + { "i get a better room", 0x30E8A, 0x00, 3 }, + { "i get a better room", 0x30E8A, 0x00, 2 }, + { "i want a better room", 0x30E8A, 0x00, 3 }, + { "i want a better room", 0x30E8A, 0x00, 2 }, + { "i understood", 0x30D75, 0x6D, 0 }, + { "i knew", 0x30D75, 0x6D, 0 }, + { "i know", 0x30D75, 0x6D, 0 }, + { "not stupid", 0x30D75, 0x6D, 0 }, + { "cheeky", 0x30D75, 0x6D, 0 }, + { "not help", 0x30D6F, 0x6D, 0 }, + { "not helpful", 0x30D6F, 0x6D, 0 }, + { "dont help", 0x30D6F, 0x6D, 0 }, + { "no help", 0x30D6F, 0x6D, 0 }, + { "sorry", 0x30D76, 0x6D, 0 }, + { "not mean that", 0x30D76, 0x6D, 0 }, + { "didnt mean that", 0x30D76, 0x6D, 0 }, + { "apologise", 0x30D76, 0x6D, 0 }, + { "play golf", 0x313B6, 0x00, 0 }, + { "is not the captain meant to go down with the ship", 0x31482, 0x00, 0 }, + { "is not the captain supposed to go down with the ship", 0x31482, 0x00, 0 }, + { "sauce sticks to the chicken", 0x3156B, 0x00, 0 }, + { "sauce gets stuck to the chicken", 0x3156B, 0x00, 0 }, + { nullptr, 0, 0, 0 } +}; + + void NORETURN_PRE error(const char *s, ...) { printf("%s\n", s); exit(1); @@ -514,6 +562,20 @@ void writeStarfieldPoints2() { dataOffset += size; } +void writePhrases(const char *name, const CommonPhrase *phrases) { + for (uint idx = 0; phrases->_str; ++idx, ++phrases) { + outputFile.seek(dataOffset + idx * 4); + outputFile.writeString(phrases->_str); + outputFile.writeLong(phrases->_dialogueId); + outputFile.writeLong(phrases->_roomNum); + outputFile.writeLong(phrases->_val1); + } + + uint size = outputFile.size() - dataOffset; + writeEntryHeader("Phrases/Bellbot", dataOffset, size); + dataOffset += size; +} + void writeHeader() { // Write out magic string const char *MAGIC_STR = "SVTN"; @@ -604,6 +666,7 @@ void writeData() { writeWords("Words/Deskbot", 0x5EAAA8); writeWords("Words/Doorbot", 0x601098, 3); writeWords("Words/Liftbot", 0x60C788); + writePhrases("Phrases/Bellbot", BELLBOT_COMMON_PHRASES); writeResponseTree(); writeNumbers(); -- cgit v1.2.3 From 45fb6a2d32d46ab5c1acbc90302a324520474fed Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Jul 2016 23:28:22 -0400 Subject: TITANIC: Added BellbotScript checkCommonPhrases --- engines/titanic/true_talk/bellbot_script.cpp | 148 ++++++++++++++++++++++++--- engines/titanic/true_talk/bellbot_script.h | 3 +- engines/titanic/true_talk/script_support.cpp | 28 ++++- engines/titanic/true_talk/script_support.h | 12 +++ 4 files changed, 171 insertions(+), 20 deletions(-) diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 9d2b93e2d0..15cbc21b64 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -31,6 +31,16 @@ namespace Titanic { uint BellbotScript::_oldId; +static const RoomDialogueId ROOM_DIALOGUE_IDS[] = { + { 100, 201442 },{ 101, 201417 },{ 107, 201491 },{ 108, 201421 }, + { 109, 201437 },{ 110, 201431 },{ 111, 201457 },{ 112, 201411 }, + { 113, 201424 },{ 114, 201464 },{ 115, 201407 },{ 116, 201468 }, + { 117, 201447 },{ 122, 201491 },{ 123, 201299 },{ 124, 201479 }, + { 125, 201480 },{ 126, 201476 },{ 127, 201483 },{ 128, 201399 }, + { 129, 201400 },{ 130, 201387 },{ 131, 201395 },{ 132, 201388 }, + { 0, 0 } +}; + BellbotScript::BellbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2) : TTnpcScript(val1, charClass, v2, charName, v3, val2, -1, -1, -1, 0), @@ -53,6 +63,7 @@ BellbotScript::BellbotScript(int val1, const char *charClass, int v2, _quotes.load("Quotes/Bellbot"); _states.load("States/Bellbot"); _preResponses.load("PreResponses/Bellbot"); + _phrases.load("Phrases/Bellbot"); } void BellbotScript::setupSentences() { @@ -1608,29 +1619,138 @@ void BellbotScript::randomResponse4(TTroomScript *roomScript, uint id) { } int BellbotScript::checkCommonSentences(TTroomScript *roomScript, TTsentence *sentence) { - // TODO + if (!roomScript || !sentence) + return 1; + + uint val1 = getValue(1); + uint newId = 0; + for (uint idx = 0; idx < _phrases.size(); ++idx) { + TTcommonPhrase &cp = _phrases[idx]; + + if (cp._roomNum != 0 && cp._roomNum != roomScript->_scriptId) + continue; + if (cp._val1 != 0 && cp._val1 != val1 && (cp._val1 == 3 || val1 != 4)) + continue; + if (!sentence->contains(cp._str.c_str())) + continue; + + addResponse(getDialogueId(cp._dialogueId)); + applyResponse(); + return 2; + } + return 0; } -int BellbotScript::checkCommonWords(TTroomScript *roomScript, TTsentence *sentence) { - // TODO - return 0; +bool BellbotScript::checkCommonWords(TTroomScript *roomScript, TTsentence *sentence) { + if (!roomScript || !sentence) + return 0; + CTrueTalkManager::setFlags(23, 0); + if (sentence->_field2C != 4) + return 0; + + if (sentence->localWord("garage")) { + addResponse(getDialogueId(200874)); + } else if (sentence->localWord("parrotfoodshop")) { + addResponse(getDialogueId(200821)); + } else if (sentence->localWord("sgt") && sentence->localWord("restaurant")) { + addResponse(getDialogueId(200857)); + } else if (sentence->localWord("firstclass") && sentence->localWord("restaurant")) { + addResponse(getDialogueId(200839)); + } else if (sentence->localWord("restaurant")) { + addResponse(getDialogueId(getValue(1) == 1 ? 200839 : 200857)); + } else if (getValue(1) == 1 && sentence->localWord("canal") && sentence->localWord("firstclass")) { + addResponse(getDialogueId(200846)); + } else if (getValue(1) == 2 && sentence->localWord("canal") && sentence->localWord("secondclass")) { + addResponse(getDialogueId(200847)); + } else if (sentence->localWord("canal")) { + addResponse(getDialogueId(getValue(1) == 1 ? 200846 : 200847)); + } else if (sentence->localWord("firstclass") && + (sentence->localWord("stateroom") || sentence->localWord("room"))) { + addResponse(getDialogueId(getValue(1) == 1 ? 200840 : 200306)); + } else if (sentence->localWord("secondclass") && sentence->localWord("stateroom") && sentence->localWord("room")) { + addResponse(getDialogueId(getValue(1) < 3 ? 202231 : 200306)); + } else if (sentence->localWord("stateroom") || sentence->contains("my room")) { + addResponse(getDialogueId(202231)); + } else if (sentence->localWord("firstclass")) { + addResponse(getDialogueId(200840)); + } else if (sentence->localWord("secondclass")) { + addResponse(getDialogueId(200841)); + } else if (sentence->localWord("thirdclass")) { + addResponse(getDialogueId(202231)); + } else if (sentence->localWord("arboretum")) { + addResponse(getDialogueId(200842)); + } else if (sentence->localWord("bar")) { + addResponse(getDialogueId(200843)); + } else if (sentence->localWord("bottomofwell")) { + addResponse(getDialogueId(200860)); + } else if (sentence->localWord("topwell") || sentence->localWord("well")) { + addResponse(getDialogueId(200861)); + } else if (sentence->localWord("bridge")) { + addResponse(getDialogueId(202213)); + } else if (sentence->localWord("creatorroom")) { + addResponse(getDialogueId(200848)); + } else if (sentence->localWord("servicelift")) { + addResponse(getDialogueId(200855)); + } else if (sentence->localWord("lift")) { + addResponse(getDialogueId(202256)); + } else if (sentence->localWord("bilgeroom")) { + addResponse(getDialogueId(202255)); + } else if (sentence->localWord("musicroom")) { + addResponse(getDialogueId(200851)); + } else if (sentence->localWord("parrotlobby")) { + addResponse(getDialogueId(200852)); + } else if (sentence->localWord("parrot") && + (sentence->localWord("room") || sentence->localWord("lobby"))) { + addResponse(getDialogueId(200852)); + } else if (sentence->localWord("promenade")) { + addResponse(getDialogueId(200853)); + } else if (sentence->localWord("sculpture") || sentence->localWord("sculptureroom") + || sentence->localWord("statue")) { + addResponse(getDialogueId(200854)); + } else if (sentence->localWord("lounge")) { + addResponse(getDialogueId(200856)); + } else if (sentence->localWord("titania")) { + if (sentence->localWord("room")) { + addResponse(getDialogueId(200859)); + } else if (sentence->localWord("nose")) { + addResponse(getDialogueId(200703)); + } else if (sentence->localWord("mouth")) { + addResponse(getDialogueId(200702)); + } else if (sentence->localWord("eyes")) { + addResponse(getDialogueId(200701)); + } else if (sentence->localWord("ear")) { + addResponse(getDialogueId(200698)); + } else if (sentence->localWord("brain")) { + addResponse(getDialogueId(200693)); + } else { + addResponse(getDialogueId(200686)); + } + } else if (sentence->localWord("embarklobby") + || sentence->localWord("lobby")) { + addResponse(getDialogueId(200850)); + } else if (sentence->localWord("pellerator")) { + addResponse(getDialogueId(200862)); + } else if (sentence->localWord("servicelift") + || (sentence->localWord("service") && sentence->localWord("elevator"))) { + addResponse(getDialogueId(200855)); + } else if (sentence->localWord("elevator")) { + addResponse(getDialogueId(202256)); + } else if (sentence->localWord("now")) { + addResponse(getDialogueId(200788)); + } else if (sentence->localWord("room")) { + addResponse(getDialogueId(200311)); + } else { + return false; + } + + return true; } uint BellbotScript::getRoomDialogueId(TTroomScript *roomScript) { if (!roomScript) return 0; - static const RoomDialogueId ROOM_DIALOGUE_IDS[] = { - { 100, 201442 }, { 101, 201417 }, { 107, 201491 }, { 108, 201421 }, - { 109, 201437 }, { 110, 201431 }, { 111, 201457 }, { 112, 201411 }, - { 113, 201424 }, { 114, 201464 }, { 115, 201407 }, { 116, 201468 }, - { 117, 201447 }, { 122, 201491 }, { 123, 201299 }, { 124, 201479 }, - { 125, 201480 }, { 126, 201476 }, { 127, 201483 }, { 128, 201399 }, - { 129, 201400 }, { 130, 201387 }, { 131, 201395 }, { 132, 201388 }, - { 0, 0 } - }; - for (int idx = 0; ROOM_DIALOGUE_IDS[idx]._roomNum; ++idx) { if (ROOM_DIALOGUE_IDS[idx]._roomNum == roomScript->_scriptId) return ROOM_DIALOGUE_IDS[idx]._dialogueId; diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index f960521cf8..58fb762cf4 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -33,6 +33,7 @@ private: TTmapEntryArray _states; TTmapEntryArray _preResponses; TTsentenceEntries _sentences[20]; + TTcommonPhraseArray _phrases; int _array[150]; int _field2D0; int _field2D4; @@ -77,7 +78,7 @@ private: void randomResponse4(TTroomScript *roomScript, uint id); int checkCommonSentences(TTroomScript *roomScript, TTsentence *sentence); - int checkCommonWords(TTroomScript *roomScript, TTsentence *sentence); + bool checkCommonWords(TTroomScript *roomScript, TTsentence *sentence); uint getRoomDialogueId(TTroomScript *roomScript); diff --git a/engines/titanic/true_talk/script_support.cpp b/engines/titanic/true_talk/script_support.cpp index f2c473d883..c24e275827 100644 --- a/engines/titanic/true_talk/script_support.cpp +++ b/engines/titanic/true_talk/script_support.cpp @@ -194,12 +194,30 @@ void TTupdateStateArray::load(const char *name) { Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); while (r->pos() < r->size()) { - TTupdateState ue; - ue._newId = r->readUint32LE(); - ue._newValue = r->readUint32LE(); - ue._dialBits = r->readUint32LE(); + TTupdateState us; + us._newId = r->readUint32LE(); + us._newValue = r->readUint32LE(); + us._dialBits = r->readUint32LE(); - push_back(ue); + push_back(us); + } + + delete r; +} + +/*------------------------------------------------------------------------*/ + +void TTcommonPhraseArray::load(const char *name) { + Common::SeekableReadStream *r = g_vm->_filesManager->getResource(name); + + while (r->pos() < r->size()) { + TTcommonPhrase cp; + cp._str = readStringFromStream(r); + cp._dialogueId = r->readUint32LE(); + cp._roomNum = r->readUint32LE(); + cp._val1 = r->readUint32LE(); + + push_back(cp); } delete r; diff --git a/engines/titanic/true_talk/script_support.h b/engines/titanic/true_talk/script_support.h index bc184641e4..a41673bd5c 100644 --- a/engines/titanic/true_talk/script_support.h +++ b/engines/titanic/true_talk/script_support.h @@ -177,6 +177,18 @@ public: void load(const char *name); }; +struct TTcommonPhrase { + CString _str; + uint _dialogueId; + uint _roomNum; + uint _val1; +}; + +class TTcommonPhraseArray : public Common::Array { +public: + void load(const char *name); +}; + } // End of namespace Titanic #endif /* TITANIC_TT_NPC_SCRIPT_H */ -- cgit v1.2.3 From 377f926a6bfba385c883ba14d96e247e6fcf88f8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 30 Jul 2016 23:52:09 -0400 Subject: TITANIC: Added BellbotScript scriptChanged --- engines/titanic/true_talk/barbot_script.cpp | 2 +- engines/titanic/true_talk/barbot_script.h | 2 +- engines/titanic/true_talk/bellbot_script.cpp | 73 +++++++++++++++++++++++++-- engines/titanic/true_talk/bellbot_script.h | 2 +- engines/titanic/true_talk/deskbot_script.cpp | 2 +- engines/titanic/true_talk/deskbot_script.h | 2 +- engines/titanic/true_talk/doorbot_script.cpp | 2 +- engines/titanic/true_talk/doorbot_script.h | 2 +- engines/titanic/true_talk/liftbot_script.cpp | 2 +- engines/titanic/true_talk/liftbot_script.h | 2 +- engines/titanic/true_talk/maitred_script.cpp | 2 +- engines/titanic/true_talk/maitred_script.h | 2 +- engines/titanic/true_talk/parrot_script.cpp | 2 +- engines/titanic/true_talk/parrot_script.h | 2 +- engines/titanic/true_talk/succubus_script.cpp | 2 +- engines/titanic/true_talk/succubus_script.h | 2 +- engines/titanic/true_talk/tt_npc_script.h | 8 +-- 17 files changed, 88 insertions(+), 23 deletions(-) diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index cc987f00b9..6d69244cd5 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -756,7 +756,7 @@ done: return 2; } -ScriptChangedResult BarbotScript::scriptChanged(TTscriptBase *roomScript, uint id) { +ScriptChangedResult BarbotScript::scriptChanged(TTroomScript *roomScript, uint id) { switch (id) { case 1: case 100: diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index cf53e66b3d..b7a19334d1 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -70,7 +70,7 @@ public: /** * Called when the script/id changes */ - virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); + virtual ScriptChangedResult scriptChanged(TTroomScript *roomScript, uint id); virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder); diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index 15cbc21b64..ddfd315f02 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -344,9 +344,75 @@ int BellbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { return 2; } -ScriptChangedResult BellbotScript::scriptChanged(TTscriptBase *roomScript, uint id) { - warning("TODO"); - return SCR_1; +ScriptChangedResult BellbotScript::scriptChanged(TTroomScript *roomScript, uint id) { + if (!roomScript) + return SCR_2; + + switch (id) { + case 104: + addResponse(getDialogueId(200617)); + applyResponse(); + break; + + case 105: + addResponse(getDialogueId(200732)); + applyResponse(); + break; + + case 106: + addResponse(getDialogueId(200733)); + applyResponse(); + break; + + case 107: + addResponse(getDialogueId(200731)); + applyResponse(); + break; + + case 157: + _field2DC = 1; + break; + + case 158: + CTrueTalkManager::setFlags(26, 1); + break; + + case 3: + if (_field2DC) { + if (randomResponse0(roomScript, id)) + return SCR_2; + } else { + addResponse(getDialogueId(201693)); + applyResponse(); + } + + _field2DC = 0; + CTrueTalkManager::_v9 = 0; + // Deliberate fall-through + default: + if (roomScript->_scriptId == 115 && id == 103) { + switch (getValue(4)) { + case 0: + addResponse(getDialogueId(200014)); + applyResponse(); + break; + case 1: + case 2: + addResponse(getDialogueId(200011)); + applyResponse(); + break; + case 3: + addResponse(getDialogueId(200007)); + applyResponse(); + break; + default: + break; + } + } + break; + } + + return SCR_2; } int BellbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, @@ -1623,7 +1689,6 @@ int BellbotScript::checkCommonSentences(TTroomScript *roomScript, TTsentence *se return 1; uint val1 = getValue(1); - uint newId = 0; for (uint idx = 0; idx < _phrases.size(); ++idx) { TTcommonPhrase &cp = _phrases[idx]; diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index 58fb762cf4..ee5a679041 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -98,7 +98,7 @@ public: /** * Called when the script/id changes */ - virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); + virtual ScriptChangedResult scriptChanged(TTroomScript *roomScript, uint id); virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder); diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 4ac04c70fb..13d6869c70 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -64,7 +64,7 @@ int DeskbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { return 0; } -ScriptChangedResult DeskbotScript::scriptChanged(TTscriptBase *roomScript, uint id) { +ScriptChangedResult DeskbotScript::scriptChanged(TTroomScript *roomScript, uint id) { warning("TODO"); return SCR_1; } diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index d8a181c07b..bbe52bd557 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -74,7 +74,7 @@ public: /** * Called when the script/id changes */ - virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); + virtual ScriptChangedResult scriptChanged(TTroomScript *roomScript, uint id); virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder); diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 5839b72ba2..7319058c0a 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -132,7 +132,7 @@ int DoorbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { return 0; } -ScriptChangedResult DoorbotScript::scriptChanged(TTscriptBase *roomScript, uint id) { +ScriptChangedResult DoorbotScript::scriptChanged(TTroomScript *roomScript, uint id) { warning("TODO"); return SCR_1; } diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index 70cdfeaf3a..be653fd1b6 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -68,7 +68,7 @@ public: /** * Called when the script/id changes */ - virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); + virtual ScriptChangedResult scriptChanged(TTroomScript *roomScript, uint id); virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder); diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index 397338a1ab..2f079cbaac 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -95,7 +95,7 @@ int LiftbotScript::proc9() const { return 0; } -ScriptChangedResult LiftbotScript::scriptChanged(TTscriptBase *roomScript, uint id) { +ScriptChangedResult LiftbotScript::scriptChanged(TTroomScript *roomScript, uint id) { warning("TODO"); return SCR_1; } diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index 118d6585bd..55752e1df6 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -65,7 +65,7 @@ public: /** * Called when the script/id changes */ - virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); + virtual ScriptChangedResult scriptChanged(TTroomScript *roomScript, uint id); virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder); diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index d013380fe7..7da541f0f7 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -70,7 +70,7 @@ int MaitreDScript::process(TTroomScript *roomScript, TTsentence *sentence) { return 0; } -ScriptChangedResult MaitreDScript::scriptChanged(TTscriptBase *roomScript, uint id) { +ScriptChangedResult MaitreDScript::scriptChanged(TTroomScript *roomScript, uint id) { warning("TODO"); return SCR_1; } diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index b3185d3b61..06fc6866ab 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -73,7 +73,7 @@ public: /** * Called when the script/id changes */ - virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); + virtual ScriptChangedResult scriptChanged(TTroomScript *roomScript, uint id); virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, uint val, uint tagId, uint remainder); diff --git a/engines/titanic/true_talk/parrot_script.cpp b/engines/titanic/true_talk/parrot_script.cpp index 0cd8082272..96efc627c1 100644 --- a/engines/titanic/true_talk/parrot_script.cpp +++ b/engines/titanic/true_talk/parrot_script.cpp @@ -63,7 +63,7 @@ int ParrotScript::process(TTroomScript *roomScript, TTsentence *sentence) { return 2; } -ScriptChangedResult ParrotScript::scriptChanged(TTscriptBase *roomScript, uint id) { +ScriptChangedResult ParrotScript::scriptChanged(TTroomScript *roomScript, uint id) { if (id >= 280000 && id <= 280276) { if (id == 280258) { if (CTrueTalkManager::_currentNPC) { diff --git a/engines/titanic/true_talk/parrot_script.h b/engines/titanic/true_talk/parrot_script.h index a27c159c79..7e473bf242 100644 --- a/engines/titanic/true_talk/parrot_script.h +++ b/engines/titanic/true_talk/parrot_script.h @@ -50,7 +50,7 @@ public: /** * Called when the script/id changes */ - virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); + virtual ScriptChangedResult scriptChanged(TTroomScript *roomScript, uint id); /** * Process a sentence fragment entry diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp index 07442ed758..9be779513f 100644 --- a/engines/titanic/true_talk/succubus_script.cpp +++ b/engines/titanic/true_talk/succubus_script.cpp @@ -79,7 +79,7 @@ int SuccUBusScript::process(TTroomScript *roomScript, TTsentence *sentence) { return 0; } -ScriptChangedResult SuccUBusScript::scriptChanged(TTscriptBase *roomScript, uint id) { +ScriptChangedResult SuccUBusScript::scriptChanged(TTroomScript *roomScript, uint id) { warning("TODO"); return SCR_1; } diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h index 4710e79a49..4ea85f1a92 100644 --- a/engines/titanic/true_talk/succubus_script.h +++ b/engines/titanic/true_talk/succubus_script.h @@ -52,7 +52,7 @@ public: /** * Called when the script/id changes */ - virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id); + virtual ScriptChangedResult scriptChanged(TTroomScript *roomScript, uint id); /** * Handles updating NPC state based on specified dialogue Ids and dial positions diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index 09fe470e72..d208576caf 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -72,7 +72,7 @@ public: /** * Called when the script/id changes */ - virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id) = 0; + virtual ScriptChangedResult scriptChanged(TTroomScript *roomScript, uint id) = 0; virtual int proc11() const = 0; virtual int proc12() const = 0; @@ -237,7 +237,7 @@ public: /** * Called when the script/id changes */ - virtual ScriptChangedResult scriptChanged(TTscriptBase *roomScript, uint id) { + virtual ScriptChangedResult scriptChanged(TTroomScript *roomScript, uint id) { return SCR_2; } @@ -335,8 +335,8 @@ public: /** * Called with the script and id changes */ - ScriptChangedResult notifyScript(TTscriptBase *npcScript, int id) { - return scriptChanged(npcScript, id); + ScriptChangedResult notifyScript(TTroomScript *roomScript, int id) { + return scriptChanged(roomScript, id); } }; -- cgit v1.2.3 From 2bb4e83d5a0022c3083547b056bdc1444633b3d4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 31 Jul 2016 00:05:22 -0400 Subject: DEVTOOLS: Properly set up PARROT_RANGES array in create_titanic --- devtools/create_titanic/script_ranges.cpp | 74 +++++++++++++++---------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/devtools/create_titanic/script_ranges.cpp b/devtools/create_titanic/script_ranges.cpp index b6550f78f6..6ac8092e3a 100644 --- a/devtools/create_titanic/script_ranges.cpp +++ b/devtools/create_titanic/script_ranges.cpp @@ -1687,43 +1687,43 @@ const uint PARROT_RANGE34[] = { 280268, 280269, 280270, 280271, 280272, 280273, #define PARROT_RANGE_COUNT 34 const ScriptRange PARROT_RANGES[34] = { - { 280235, PARROT_RANGE1, false, false }, - { 280236, PARROT_RANGE1, false, false }, - { 280237, PARROT_RANGE1, false, false }, - { 280238, PARROT_RANGE1, false, false }, - { 280239, PARROT_RANGE1, false, false }, - { 280240, PARROT_RANGE1, false, false }, - { 280241, PARROT_RANGE1, false, false }, - { 280242, PARROT_RANGE1, false, false }, - { 280243, PARROT_RANGE1, false, false }, - { 280244, PARROT_RANGE1, false, false }, - - { 280245, PARROT_RANGE1, false, false }, - { 280246, PARROT_RANGE1, false, false }, - { 280247, PARROT_RANGE1, false, false }, - { 280248, PARROT_RANGE1, false, false }, - { 280249, PARROT_RANGE1, false, false }, - { 280250, PARROT_RANGE1, false, false }, - { 280251, PARROT_RANGE1, false, false }, - { 280252, PARROT_RANGE1, false, false }, - { 280253, PARROT_RANGE1, false, false }, - { 280254, PARROT_RANGE1, false, false }, - - { 280255, PARROT_RANGE1, false, false }, - { 280256, PARROT_RANGE1, false, false }, - { 280257, PARROT_RANGE1, false, false }, - { 280258, PARROT_RANGE1, false, false }, - { 280259, PARROT_RANGE1, false, false }, - { 280260, PARROT_RANGE1, false, false }, - { 280261, PARROT_RANGE1, false, false }, - { 280262, PARROT_RANGE1, false, false }, - { 280263, PARROT_RANGE1, false, false }, - { 280264, PARROT_RANGE1, false, false }, - - { 280265, PARROT_RANGE1, false, false }, - { 280266, PARROT_RANGE1, false, false }, - { 280222, PARROT_RANGE1, false, false }, - { 280267, PARROT_RANGE1, false, false } + { 280235, PARROT_RANGE1, true, false }, + { 280236, PARROT_RANGE2, false, false }, + { 280237, PARROT_RANGE3, false, false }, + { 280238, PARROT_RANGE4, false, false }, + { 280239, PARROT_RANGE5, false, false }, + { 280240, PARROT_RANGE6, false, false }, + { 280241, PARROT_RANGE7, false, false }, + { 280242, PARROT_RANGE8, false, false }, + { 280243, PARROT_RANGE9, false, false }, + { 280244, PARROT_RANGE10, false, false }, + + { 280245, PARROT_RANGE11, false, false }, + { 280246, PARROT_RANGE12, false, false }, + { 280247, PARROT_RANGE13, false, false }, + { 280248, PARROT_RANGE14, false, false }, + { 280249, PARROT_RANGE15, false, false }, + { 280250, PARROT_RANGE16, false, false }, + { 280251, PARROT_RANGE17, false, false }, + { 280252, PARROT_RANGE18, false, false }, + { 280253, PARROT_RANGE19, false, false }, + { 280254, PARROT_RANGE20, false, false }, + + { 280255, PARROT_RANGE21, false, false }, + { 280256, PARROT_RANGE22, false, false }, + { 280257, PARROT_RANGE23, true, false }, + { 280258, PARROT_RANGE24, false, true }, + { 280259, PARROT_RANGE25, false, false }, + { 280260, PARROT_RANGE26, false, false }, + { 280261, PARROT_RANGE27, false, false }, + { 280262, PARROT_RANGE28, false, false }, + { 280263, PARROT_RANGE29, false, false }, + { 280264, PARROT_RANGE30, false, false }, + + { 280265, PARROT_RANGE31, false, false }, + { 280266, PARROT_RANGE32, false, false }, + { 280222, PARROT_RANGE33, true, false }, + { 280267, PARROT_RANGE34, true, false } }; const uint SUCCUBUS_RANGE1[] = { 230001, 230149, 230078, 230002, 230033, 230067, 230003, 230079, 230034, 230055, -- cgit v1.2.3 From 8a2491c51b1b7d27382030f3cb9d58c5b56265f0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 31 Jul 2016 07:24:07 -0400 Subject: TITANIC: Fix some clang warnings --- engines/titanic/support/simple_file.h | 10 ++++++++++ engines/titanic/support/video_surface.h | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/engines/titanic/support/simple_file.h b/engines/titanic/support/simple_file.h index 6cf9995d16..f5d0bc7c1b 100644 --- a/engines/titanic/support/simple_file.h +++ b/engines/titanic/support/simple_file.h @@ -295,6 +295,16 @@ public: */ virtual bool open(const Common::String &filename); + /** + * Unsupported open method from parent class + */ + virtual void open(Common::SeekableReadStream *stream) {} + + /** + * Unsupported open method from parent class + */ + virtual void open(Common::OutSaveFile *stream) {} + /** * Return a reference to the read stream */ diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index 1f3a0fa2b3..053eabb0f9 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -85,6 +85,13 @@ public: */ void setSurface(CScreenManager *screenManager, DirectDrawSurface *surface); + /** + * Load the data for the class from file + */ + virtual void load(SimpleFile *file) { + ListItem::load(file); + } + /** * Load the surface with the passed resource */ -- cgit v1.2.3 From e2b00938c7488af62521e1ad4e62566fa4077af0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 31 Jul 2016 13:06:51 -0400 Subject: TITANIC: Added DeskbotScript preprocess --- engines/titanic/true_talk/deskbot_script.cpp | 980 +++++++++++++++++++++++++++ engines/titanic/true_talk/deskbot_script.h | 25 + engines/titanic/true_talk/tt_npc_script.cpp | 2 +- engines/titanic/true_talk/tt_npc_script.h | 2 +- engines/titanic/true_talk/tt_quotes.cpp | 11 +- engines/titanic/true_talk/tt_quotes.h | 6 +- 6 files changed, 1016 insertions(+), 10 deletions(-) diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 13d6869c70..c955e7e925 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -23,6 +23,7 @@ #include "common/textconsole.h" #include "titanic/true_talk/deskbot_script.h" #include "titanic/true_talk/true_talk_manager.h" +#include "titanic/titanic.h" namespace Titanic { @@ -60,6 +61,17 @@ void DeskbotScript::setupSentences() { } int DeskbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { + if (roomScript->_scriptId != 110) + return 2; + + bool flag20 = getValue(20) != 0; + CTrueTalkManager::setFlags(20, 0); + checkItems(nullptr, nullptr); + getState(); + + if (preprocess(roomScript, sentence) != 1) + return 1; + // TODO return 0; } @@ -433,4 +445,972 @@ void DeskbotScript::setFlags17(uint newId, uint index) { CTrueTalkManager::setFlags(17, newValue); } +int DeskbotScript::preprocess(const TTroomScript *roomScript, const TTsentence *sentence) { + if (!roomScript || !sentence) + return 1; + + bool stateFlag = true, applyFlag = false; + switch (getValue(17)) { + case 1: + if (sentence->_field2C != 3 && sentence->_field2C != 4 + && sentence->_field2C != 6 && sentence->_field2C != 10 + && sentence->_field2C != 2) { + addResponse(getDialogueId(240423)); + applyFlag = true; + } + break; + + case 2: + if (sentence->localWord("gobbledygook")) { + addResponse(getDialogueId(240427)); + applyFlag = true; + } + break; + + case 3: + if (sentence->_field2C == 11 || sentence->_field2C == 13 + || sentence->_field2C == 3 || sentence->localWord("upgrade")) { + addResponse(getDialogueId(240433)); + applyFlag = true; + } + break; + + case 4: + addResponse(getDialogueId(sentence->_field2C == 11 || sentence->_field2C == 13 + ? 240495 : 240494)); + applyFlag = true; + break; + + case 5: + if (isDial1Low() && getValue(1) == 4) { + if (sentence->localWord("name") || sentence->localWord("called") + || sentence->localWord("passenger")) { + addResponse(getDialogueId(240867)); + addResponse(getDialogueId(240745)); + } else { + addResponse(getDialogueId(240446)); + } + + applyFlag = true; + stateFlag = false; + } + break; + + case 6: + if (isDial1Low() && getValue(1) == 4) { + if (sentence->localWord("passenger")) { + addResponse(getDialogueId(240449)); + applyFlag = true; + stateFlag = false; + } else if (sentence->localWord("home") + || sentence->localWord("destroy")) { + addResponse(getDialogueId(240574)); + stateFlag = true; + } else if (sentence->localWord("name") + || sentence->localWord("called") + || sentence->_field2C == 11) { + addResponse(getDialogueId(240448)); + stateFlag = true; + } else { + addResponse(getDialogueId(240489)); + stateFlag = true; + } + } + break; + + case 7: + if (sentence->_field2C == 11 || sentence->_field2C == 13 + || (sentence->localWord("what") && sentence->localWord("wrong")) + || sentence->localWord("clothes")) { + addResponse(getDialogueId(240489)); + applyFlag = true; + stateFlag = false; + } + break; + + case 8: + if (isDial1Low() && getValue(1) == 4) { + if (sentence->_field2C == 12 || sentence->_field2C == 13 + || sentence->contains("do not")) { + + addResponse(getDialogueId(240447)); + setDialRegion(0, 0); + setDialRegion(1, 0); + CTrueTalkManager::setFlags(1, 3); + CTrueTalkManager::triggerAction(19, 3); + CTrueTalkManager::setFlags(22, 1); + applyFlag = true; + } else if (sentence->_field2C == 11) { + addResponse(getDialogueId(240746)); + applyFlag = true; + stateFlag = false; + } else { + addResponse(getDialogueId(240448)); + applyFlag = true; + stateFlag = false; + } + } + break; + + case 9: + if (searchQuotes(roomScript, sentence)) { + if (isDial0Medium()) { + addResponse(getDialogueId(240382)); + applyFlag = true; + stateFlag = false; + } else { + addResponse(getDialogueId(240548)); + applyFlag = true; + } + } + break; + + case 10: + if (isDial1Medium() && searchQuotes(roomScript, sentence)) { + if (isDial0Medium()) { + addResponse(getDialogueId(240405)); + applyFlag = true; + stateFlag = false; + } else { + addResponse(getDialogueId(240548)); + applyFlag = true; + } + } + break; + + case 11: + if (isDial0Medium() && isDial1Medium() + && searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240403)); + applyFlag = true; + stateFlag = false; + } + break; + + case 12: + if (isDial0Medium() && isDial1Medium() + && searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240548)); + applyFlag = true; + stateFlag = false; + } + break; + + case 13: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240348)); + applyFlag = true; + stateFlag = false; + } + break; + + case 14: + if (isDial1Medium()) { + addResponse(getDialogueId(240568)); + applyFlag = true; + stateFlag = false; + } + break; + + case 15: + if (sentence->localWord("magazine")) { + addAssignedRoomDialogue3(); + stateFlag = true; + } + break; + + case 17: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240401)); + applyFlag = true; + stateFlag = false; + } + break; + + case 18: + if (!isDial0Low() || !isDial1Low()) { + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240402)); + applyFlag = true; + stateFlag = false; + } + } + break; + + case 19: + if (!isDial0Low() && searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240403)); + applyFlag = true; + stateFlag = false; + } + break; + + case 20: + if (!isDial1Medium() && searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240548)); + applyFlag = true; + } + break; + + case 21: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240382)); + applyFlag = true; + stateFlag = false; + } + break; + + case 22: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240383)); + applyFlag = true; + stateFlag = false; + } + break; + + case 23: + if (isDial0Medium() && searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240384)); + applyFlag = true; + stateFlag = false; + } + break; + + case 24: + setDialRegion(0, 0); + + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240548)); + applyFlag = true; + } + break; + + case 25: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240349)); + applyFlag = true; + stateFlag = false; + } + break; + + case 26: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240350)); + applyFlag = true; + stateFlag = false; + } + break; + + case 27: + case 30: + case 33: + case 36: + case 40: + case 43: + case 46: + case 50: + case 55: + case 58: + case 61: + case 68: + case 73: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240548)); + applyFlag = true; + } + break; + + case 28: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240373)); + applyFlag = true; + stateFlag = false; + } + break; + + case 29: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240374)); + applyFlag = true; + stateFlag = false; + } + break; + + case 31: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240346)); + applyFlag = true; + stateFlag = false; + } + break; + + case 32: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240347)); + applyFlag = true; + stateFlag = false; + } + break; + + case 34: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240376)); + applyFlag = true; + stateFlag = false; + } + break; + + case 35: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240377)); + applyFlag = true; + stateFlag = false; + } + break; + + case 37: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240369)); + applyFlag = true; + stateFlag = false; + } + break; + + case 38: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240370)); + applyFlag = true; + stateFlag = false; + } + break; + + case 39: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240371)); + applyFlag = true; + stateFlag = false; + } + break; + + case 41: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240352)); + applyFlag = true; + stateFlag = false; + } + break; + + case 42: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240353)); + applyFlag = true; + stateFlag = false; + } + break; + + case 44: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240389)); + applyFlag = true; + stateFlag = false; + } + break; + + case 45: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240390)); + applyFlag = true; + stateFlag = false; + } + break; + + case 47: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240395)); + applyFlag = true; + stateFlag = false; + } + break; + + case 48: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240396)); + applyFlag = true; + stateFlag = false; + } + break; + + case 49: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240397)); + applyFlag = true; + stateFlag = false; + } + break; + + case 51: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240363)); + applyFlag = true; + stateFlag = false; + } + break; + + case 52: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240364)); + applyFlag = true; + stateFlag = false; + } + break; + + case 53: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240365)); + applyFlag = true; + stateFlag = false; + } + break; + + case 54: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240366)); + applyFlag = true; + stateFlag = false; + } + break; + + case 56: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240392)); + applyFlag = true; + stateFlag = false; + } + break; + + case 57: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240393)); + applyFlag = true; + stateFlag = false; + } + break; + + case 59: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240386)); + applyFlag = true; + stateFlag = false; + } + break; + + case 60: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240387)); + applyFlag = true; + stateFlag = false; + } + break; + + case 62: + if (isDial1Medium() && getValue(1) == 1) { + if (isDial0Medium()) { + if (sentence->localWord("down")) { + addResponse(getDialogueId(240413)); + applyFlag = true; + } + } else if (sentence->contains("left") || sentence->contains("right")) { + addResponse(getDialogueId(240415)); + CTrueTalkManager::triggerAction(sentence->localWord("down") ? 22 : 23, 0); + } else { + addResponse(getDialogueId(240414)); + applyFlag = true; + } + } + break; + + case 63: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240836)); + applyFlag = true; + stateFlag = false; + } + break; + + case 64: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240837)); + applyFlag = true; + stateFlag = false; + } + break; + + case 65: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240838)); + applyFlag = true; + stateFlag = false; + } + break; + + case 66: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240839)); + applyFlag = true; + stateFlag = false; + } + break; + + case 67: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(240840)); + applyFlag = true; + stateFlag = false; + } + break; + + case 69: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(241104)); + applyFlag = true; + stateFlag = false; + } + break; + + case 70: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(241105)); + applyFlag = true; + stateFlag = false; + } + break; + + case 71: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(241106)); + applyFlag = true; + stateFlag = false; + } + break; + + case 72: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(241107)); + applyFlag = true; + stateFlag = false; + } + break; + + case 74: + case 75: + if (sentence->_field2C == 24) { + addResponse(getDialogueId(240972)); + applyFlag = true; + } else if (sentence->localWord("good") || sentence->localWord("yes") + || sentence->localWord("well") || sentence->localWord("ill") + || sentence->localWord("sad")) { + addResponse(getDialogueId(240805)); + applyFlag = true; + } + break; + + case 76: + if (sentence->_field2C == 6) { + addResponse(getDialogueId(240767)); + applyFlag = true; + stateFlag = false; + } + break; + + case 77: + if (sentence->_field2C == 3) { + addResponse(getDialogueId(241109)); + applyFlag = true; + stateFlag = false; + } + + case 78: + if (sentence->_field2C == 11 || sentence->_field2C == 13) { + addResponse(getDialogueId(241262)); + } else if (sentence->_field2C == 12 || sentence->contains("do not")) { + setDialRegion(0, 0); + setDialRegion(1, 0); + addResponse(getDialogueId(241268)); + add241716(); + } else { + addResponse(getDialogueId(240745)); + } + + applyFlag = true; + stateFlag = false; + break; + + case 79: + switch (checkCommonWords(sentence)) { + case 1: + addResponse(getDialogueId(241263)); + break; + case 2: + addResponse(getDialogueId(241266)); + break; + case 3: + addAssignedRoom(); + setState(0); + CTrueTalkManager::setFlags(17, 0); + return 2; + default: + addResponse(getDialogueId(241267)); + break; + } + + add241716(); + applyFlag = true; + stateFlag = false; + break; + + case 81: + addResponse(getDialogueId(sentence->_field2C == 12 ? 240602 : 241337)); + applyResponse(); + setState(0); + CTrueTalkManager::setFlags(17, 0); + return 2; + + case 82: + if (sentence->_field2C == 2) { + addResponse(getDialogueId(241339)); + applyFlag = true; + } + break; + + case 83: + if ((isDial1Medium() && isDial0Low()) || + (isDial1Low() && isDial0Medium())) { + if (sentence->localWord("yes") || sentence->localWord("but")) { + if (sentence->localWord("will") || sentence->localWord("do")) { + addResponse(getDialogueId(241366)); + applyFlag = true; + } + } + } + break; + + case 84: + if (sentence->_field2C == 12 || sentence->contains("vegetarian") + || sentence->contains("vegitarian")) { + addResponse(getDialogueId(241718)); + addResponse(getDialogueId(241709)); + applyFlag = true; + stateFlag = false; + } else if (sentence->contains("continental") + || sentence->contains("full") + || sentence->contains("porky") + || sentence->contains("the 1") + || sentence->contains("the 2") + || sentence->contains("former") + || sentence->contains("latter")) { + addResponse(getDialogueId(241717)); + addResponse(getDialogueId(241709)); + applyFlag = true; + stateFlag = false; + } else { + if (sentence2C(sentence)) + addResponse(getDialogueId(241707)); + addResponse(getDialogueId(241719)); + applyFlag = true; + stateFlag = false; + } + break; + + case 85: + if (sentence->_field2C == 12 || sentence->contains("bugle") + || sentence->contains("buggle") || sentence->contains("trumpet") + || sentence->contains("saxophone") || sentence->contains("kazoo") + || sentence->contains("blerontin 1") || sentence->contains("the 1") + || sentence->contains("the 2") || sentence->contains("the 3") + || sentence->contains("the 4") || sentence->contains("all of them") + || sentence->contains("the lot")) { + addResponse(getDialogueId(241710)); + addResponse(getDialogueId(241713)); + } else { + if (getRandomNumber(100) < 80 && sentence2C(sentence)) + addResponse(getDialogueId(241707)); + + addResponse(getDialogueId(241711)); + } + + applyFlag = true; + stateFlag = false; + break; + + case 86: + if (sentence->_field2C == 12 || sentence->_field2C == 11 || sentence->contains("view")) { + addResponse(getDialogueId(241714)); + addResponse(getDialogueId(241699)); + } else { + if (getRandomNumber(100) < 80 && sentence2C(sentence)) + addResponse(getDialogueId(241707)); + + if (getRandomNumber(100) < 50) { + addResponse(getDialogueId(241715)); + } else { + addResponse(getDialogueId(241712)); + addResponse(getDialogueId(241713)); + } + + } + + applyFlag = true; + stateFlag = false; + break; + + case 87: + if (sentence->contains("corner") || sentence->contains("on the end") + || sentence->contains("balcony") || sentence->contains("neither") + || sentence->contains("the 1") || sentence->contains("the 2") + || sentence->contains("former") || sentence->contains("latter") + || sentence->contains("either")) { + addResponse(getDialogueId(241700)); + addResponse(getDialogueId(241687)); + } else { + if (getRandomNumber(100) < 80 && sentence2C(sentence)) + addResponse(getDialogueId(241707)); + + addResponse(getDialogueId(241701)); + addResponse(getDialogueId(241699)); + } + + applyFlag = true; + stateFlag = false; + break; + + case 88: + if (sentence->contains("imperial") || sentence->contains("the 1")) { + addResponse(getDialogueId(241700)); + addResponse(getDialogueId(241739)); + } else if (sentence->contains("royal") || sentence->contains("the 2")) { + addResponse(getDialogueId(241690)); + } else if (sentence->contains("despotic") || sentence->contains("the last") + || sentence->contains("latter")) { + addResponse(getDialogueId(241688)); + } else if (sentence->contains("president") || sentence->contains("presidential") + || sentence->contains("the 3")) { + addResponse(getDialogueId(241689)); + } else { + if (getRandomNumber(100) < 80 && sentence2C(sentence)) + addResponse(getDialogueId(241707)); + + addResponse(getDialogueId(241692)); + } + + applyFlag = true; + stateFlag = false; + break; + + case 89: + if (sentence->contains("king")) { + addResponse(getDialogueId(241691)); + } else if (sentence->contains("queen") || sentence->contains("prince") + || sentence->contains("princess") || sentence->contains("small") + || sentence->contains("the 1") || sentence->contains("the 2") + || sentence->contains("the 3") || sentence->contains("the 4") + || sentence->contains("big") || sentence->contains("large")) { + addResponse(getDialogueId(241700)); + addResponse(getDialogueId(241739)); + } else { + if (getRandomNumber(100) < 100 && sentence2C(sentence)) + addResponse(getDialogueId(241707)); + + addResponse(getDialogueId(241690)); + } + + applyFlag = true; + stateFlag = false; + break; + + case 90: + if (sentence->contains("constitutional") || sentence->contains("const") + || sentence->contains("absolute") || sentence->contains("small") + || sentence->contains("the 1") || sentence->contains("the 2") + || sentence->contains("big") || sentence->contains("large")) { + addResponse(getDialogueId(241700)); + addResponse(getDialogueId(241739)); + } else { + if (getRandomNumber(100) < 80 && sentence2C(sentence)) + addResponse(getDialogueId(241708)); + + addResponse(getDialogueId(241691)); + } + + applyFlag = true; + stateFlag = false; + break; + + case 91: + if (sentence->contains("benev") || sentence->contains("dict") + || sentence->contains("small") || sentence->contains("the 1") + || sentence->contains("the 2") || sentence->contains("big") + || sentence->contains("large") || sentence->contains("former") + || sentence->contains("latter")) { + addResponse(getDialogueId(241700)); + addResponse(getDialogueId(241739)); + } else { + if (getRandomNumber(100) < 80 && sentence2C(sentence)) + addResponse(getDialogueId(241708)); + + addResponse(getDialogueId(241688)); + } + + applyFlag = true; + stateFlag = false; + break; + + case 92: + case 93: + if (sentence->_field2C == 11 || sentence->_field2C == 13) { + addResponse(getDialogueId(241077)); + addResponse(getDialogueId(241706)); + } else if (sentence->_field2C == 12) { + addAssignedRoom(); + setState(0); + CTrueTalkManager::setFlags(17, 0); + return 2; + } else if (g_vm->_trueTalkManager->_quotes.find(sentence->_normalizedLine.c_str()) + == MKTAG('F', 'I', 'S', 'H')) { + addResponse(getDialogueId(240877)); + addResponse(getDialogueId(241706)); + }else { + if (getRandomNumber(100) < 80 && sentence2C(sentence)) + addResponse(getDialogueId(241707)); + + addResponse(getDialogueId(241705)); + if (getRandomNumber(100) < 80) + addResponse(getDialogueId(241739)); + } + + applyFlag = true; + stateFlag = false; + break; + + case 94: + if (sentence->contains("seperate") || sentence->contains("separate") + || sentence->contains("detached") || sentence->contains("outside") + || sentence->contains("onsweet") || sentence->contains("ensuite") + || sentence->contains("suite") || sentence->contains("next door") + || sentence->contains("the 1") || sentence->contains("the 2") + || sentence->contains("former") || sentence->contains("latter") + || sentence->contains("same room")) { + addAssignedRoom(); + setState(0); + CTrueTalkManager::setFlags(17, 0); + return 2; + } else { + if (getRandomNumber(100) < 80 && sentence2C(sentence)) + addResponse(getDialogueId(241707)); + addResponse(getDialogueId(241706)); + applyFlag = true; + stateFlag = false; + } + break; + + case 95: + if (isDial1Medium()) { + if ((sentence->localWord("i") && sentence->localWord("am")) + || sentence->localWord("me")) { + addResponse(getDialogueId(240632)); + applyFlag = true; + stateFlag = false; + } + } + break; + + case 96: + if (sentence->_field2C == 2) { + addResponse(getDialogueId(241350)); + applyFlag = true; + stateFlag = false; + } + break; + + case 97: + if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(241351)); + applyFlag = true; + stateFlag = false; + } + break; + + default: + break; + } + + if (applyFlag) + applyResponse(); + if (stateFlag) { + setState(0); + CTrueTalkManager::setFlags(17, 0); + } + + return applyFlag ? 2 : 1; +} + +int DeskbotScript::searchQuotes(const TTroomScript *roomScript, const TTsentence *sentence) { + TTtreeResult treeResult; + return g_vm->_trueTalkManager->_quotesTree.search(sentence->_normalizedLine.c_str(), + TREE_2, &treeResult, 0, 0) != -1; +} + +int DeskbotScript::checkCommonWords(const TTsentence *sentence) { + if (sentence->contains("xyzzy")) + return 3; + + const TTquotes "es = g_vm->_trueTalkManager->_quotes; + if (quotes._loaded) { + uint tagId = quotes.find(sentence->_normalizedLine.c_str()); + if (tagId == MKTAG('F', 'U', 'L', 'N') + || tagId == MKTAG('T', 'D', 'V', 'P') + || tagId == MKTAG('H', 'E', 'R', 'O') + || sentence->contains("douglas adam")) + return 1; + else if (tagId == MKTAG('J', 'N', 'A', 'M') + || tagId == MKTAG('N', 'I', 'K', 'N') + || tagId == MKTAG('B', 'O', 'Y', 'S') + || tagId == MKTAG('G', 'I', 'R', 'L')) + return 2; + } else { + if (sentence->contains("douglas adams") + || sentence->contains("shaikh") + || sentence->contains("millican") + || sentence->contains("williams") + || sentence->contains("henkes") + || sentence->contains("kenny")) + return 1; + else if (sentence->contains("richard") + || sentence->contains("jason") + || sentence->contains("mike") + || sentence->contains("renata")) + return 2; + } + + return 0; +} + +void DeskbotScript::add241716() { + addResponse(getDialogueId(241716)); +} + +void DeskbotScript::addAssignedRoom() { + addResponse(getDialogueId(241696)); + addResponse(getDialogueId(241697)); + CTrueTalkManager::setFlags(1, 3); + CTrueTalkManager::triggerAction(19, 3); + CTrueTalkManager::setFlags(22, 1); + + int roomNum = 1, floorNum = 1, elevatorNum = 1; + getAssignedRoom(&roomNum, &floorNum, &elevatorNum); + addResponse(getDialogueId(241313 + elevatorNum)); + addResponse(getDialogueId(241271 + floorNum)); + addResponse(getDialogueId(241317 + roomNum)); + addResponse(getDialogueId(241698)); +} + } // End of namespace Titanic diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index bbe52bd557..55896a2425 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -62,6 +62,31 @@ private: * Sets state data in flags 17 */ void setFlags17(uint newId, uint index); + + /** + * Does preprocessing for the sentence + */ + int preprocess(const TTroomScript *roomScript, const TTsentence *sentence); + + /** + * Scans the quotes tree + */ + int searchQuotes(const TTroomScript *roomScript, const TTsentence *sentence); + + /** + * Checks for common words + */ + int checkCommonWords(const TTsentence *sentence); + + /** + * Adds response dialogue 241716 + */ + void add241716(); + + /** + * Adds a dialogue description for the player's assigned room + */ + void addAssignedRoom(); public: DeskbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index 14da4868a5..b61b9d53e1 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -959,7 +959,7 @@ bool TTnpcScript::getStateValue() const { return false; } -bool TTnpcScript::sentence2C(TTsentence *sentence) { +bool TTnpcScript::sentence2C(const TTsentence *sentence) { return sentence->_field2C >= 2 && sentence->_field2C <= 7; } diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index d208576caf..ddb5b8ff64 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -193,7 +193,7 @@ protected: bool fn10(bool flag); - static bool sentence2C(TTsentence *sentence); + static bool sentence2C(const TTsentence *sentence); /** * Gets the True Talk state value diff --git a/engines/titanic/true_talk/tt_quotes.cpp b/engines/titanic/true_talk/tt_quotes.cpp index 825210ae06..c690ac8780 100644 --- a/engines/titanic/true_talk/tt_quotes.cpp +++ b/engines/titanic/true_talk/tt_quotes.cpp @@ -26,11 +26,9 @@ namespace Titanic { -TTquotes::TTquotes() { +TTquotes::TTquotes() : _loaded(false), _dataP(nullptr), _dataSize(0), + _field544(0) { Common::fill(&_tags[0], &_tags[256], 0); - _dataP = nullptr; - _dataSize = 0; - _field544 = 0; } TTquotes::~TTquotes() { @@ -40,6 +38,7 @@ TTquotes::~TTquotes() { void TTquotes::load() { Common::SeekableReadStream *r = g_vm->_filesManager->getResource("TEXT/JRQUOTES.TXT"); size_t size = r->readUint32LE(); + _loaded = true; _dataSize = _field544 = size; _dataP = new char[size + 0x10]; @@ -68,7 +67,7 @@ void TTquotes::load() { delete r; } -int TTquotes::find(const char *str) { +int TTquotes::find(const char *str) const { if (!str || !*str) return 0; @@ -95,7 +94,7 @@ int TTquotes::find(const char *str) { return 0; } -int TTquotes::find(const char *startP, const char *endP) { +int TTquotes::find(const char *startP, const char *endP) const { int size = endP - startP; if (size < 3) return 0; diff --git a/engines/titanic/true_talk/tt_quotes.h b/engines/titanic/true_talk/tt_quotes.h index c6627dcc34..5958c9ebcf 100644 --- a/engines/titanic/true_talk/tt_quotes.h +++ b/engines/titanic/true_talk/tt_quotes.h @@ -53,7 +53,9 @@ private: * Test whether a substring contains one of the quotes, * and if so, returns the 4-character tag Id associated with it */ - int find(const char *startP, const char *endP); + int find(const char *startP, const char *endP) const; +public: + bool _loaded; public: TTquotes(); ~TTquotes(); @@ -67,7 +69,7 @@ public: * Test whether a passed string contains one of the quotes, * and if so, returns the 4-character tag Id associated with it */ - int find(const char *str); + int find(const char *str) const; }; } // End of namespace Titanic -- cgit v1.2.3 From 07bf7304433174203cc1cecec23aee54718b3d76 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 31 Jul 2016 14:31:36 -0400 Subject: TITANIC: Adding lots of const prefixes --- engines/titanic/pet_control/pet_glyphs.h | 2 +- engines/titanic/pet_control/pet_real_life.h | 2 +- engines/titanic/pet_control/pet_section.h | 2 +- engines/titanic/true_talk/barbot_script.cpp | 10 ++++----- engines/titanic/true_talk/barbot_script.h | 10 ++++----- engines/titanic/true_talk/bellbot_script.cpp | 30 +++++++++++++-------------- engines/titanic/true_talk/bellbot_script.h | 30 +++++++++++++-------------- engines/titanic/true_talk/deskbot_script.cpp | 8 +++---- engines/titanic/true_talk/deskbot_script.h | 8 +++---- engines/titanic/true_talk/doorbot_script.cpp | 10 ++++----- engines/titanic/true_talk/doorbot_script.h | 10 ++++----- engines/titanic/true_talk/liftbot_script.cpp | 10 ++++----- engines/titanic/true_talk/liftbot_script.h | 10 ++++----- engines/titanic/true_talk/maitred_script.cpp | 10 ++++----- engines/titanic/true_talk/maitred_script.h | 10 ++++----- engines/titanic/true_talk/parrot_script.cpp | 8 +++---- engines/titanic/true_talk/parrot_script.h | 8 +++---- engines/titanic/true_talk/succubus_script.cpp | 8 +++---- engines/titanic/true_talk/succubus_script.h | 8 +++---- engines/titanic/true_talk/tt_npc_script.cpp | 14 ++++++------- engines/titanic/true_talk/tt_npc_script.h | 26 +++++++++++------------ engines/titanic/true_talk/tt_sentence.cpp | 10 ++++----- engines/titanic/true_talk/tt_sentence.h | 10 ++++----- 23 files changed, 127 insertions(+), 127 deletions(-) diff --git a/engines/titanic/pet_control/pet_glyphs.h b/engines/titanic/pet_control/pet_glyphs.h index 7271d6cd61..c07cc5ed9a 100644 --- a/engines/titanic/pet_control/pet_glyphs.h +++ b/engines/titanic/pet_control/pet_glyphs.h @@ -101,7 +101,7 @@ public: /** * Get the bounds for the glyph */ - virtual Rect getBounds() { return Rect(); } + virtual Rect getBounds() const { return Rect(); } /** * Called for mouse button down messages diff --git a/engines/titanic/pet_control/pet_real_life.h b/engines/titanic/pet_control/pet_real_life.h index a4ae67fa6b..40bc87d9b5 100644 --- a/engines/titanic/pet_control/pet_real_life.h +++ b/engines/titanic/pet_control/pet_real_life.h @@ -67,7 +67,7 @@ public: /** * Get the bounds for the section */ - virtual Rect getBounds() { return Rect(); } + virtual Rect getBounds() const { return Rect(); } /** * Following are handlers for the various messages that the PET can diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h index 4047ab03de..8bc427e842 100644 --- a/engines/titanic/pet_control/pet_section.h +++ b/engines/titanic/pet_control/pet_section.h @@ -89,7 +89,7 @@ public: /** * Get the bounds for the section */ - virtual Rect getBounds() { return Rect(); } + virtual Rect getBounds() const { return Rect(); } /** * Called when a general change occurs diff --git a/engines/titanic/true_talk/barbot_script.cpp b/engines/titanic/true_talk/barbot_script.cpp index 6d69244cd5..ccc583347c 100644 --- a/engines/titanic/true_talk/barbot_script.cpp +++ b/engines/titanic/true_talk/barbot_script.cpp @@ -70,7 +70,7 @@ void BarbotScript::setupSentences() { _words.load("Words/Barbot"); } -int BarbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { +int BarbotScript::chooseResponse(const TTroomScript *roomScript, const TTsentence *sentence, uint tag) { if (tag == MKTAG('D', 'N', 'A', '1') || tag == MKTAG('H', 'H', 'G', 'Q') || tag == MKTAG('A', 'N', 'S', 'W') || tag == MKTAG('S', 'U', 'M', 'S')) { if (_state < 7) { @@ -132,7 +132,7 @@ int BarbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, return TTnpcScript::chooseResponse(roomScript, sentence, tag); } -int BarbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { +int BarbotScript::process(const TTroomScript *roomScript, const TTsentence *sentence) { int dialogueId = 0; if (roomScript->_scriptId != 112) @@ -756,7 +756,7 @@ done: return 2; } -ScriptChangedResult BarbotScript::scriptChanged(TTroomScript *roomScript, uint id) { +ScriptChangedResult BarbotScript::scriptChanged(const TTroomScript *roomScript, uint id) { switch (id) { case 1: case 100: @@ -840,7 +840,7 @@ ScriptChangedResult BarbotScript::scriptChanged(TTroomScript *roomScript, uint i return SCR_2; } -int BarbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, +int BarbotScript::handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, uint val, uint tagId, uint remainder) { switch (tagId) { case MKTAG('A', 'D', 'V', 'T'): @@ -1015,7 +1015,7 @@ uint BarbotScript::getDialsBitset() const { return bits; } -int BarbotScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { +int BarbotScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence) { int v34 = getState(); uint id = 0; diff --git a/engines/titanic/true_talk/barbot_script.h b/engines/titanic/true_talk/barbot_script.h index b7a19334d1..1820d77216 100644 --- a/engines/titanic/true_talk/barbot_script.h +++ b/engines/titanic/true_talk/barbot_script.h @@ -60,19 +60,19 @@ public: /** * Chooses and adds a conversation response based on a specified tag Id. */ - virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag); + virtual int chooseResponse(const TTroomScript *roomScript, const TTsentence *sentence, uint tag); /** * Does NPC specific processing of the parsed sentence */ - virtual int process(TTroomScript *roomScript, TTsentence *sentence); + virtual int process(const TTroomScript *roomScript, const TTsentence *sentence); /** * Called when the script/id changes */ - virtual ScriptChangedResult scriptChanged(TTroomScript *roomScript, uint id); + virtual ScriptChangedResult scriptChanged(const TTroomScript *roomScript, uint id); - virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, + virtual int handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, uint val, uint tagId, uint remainder); /** @@ -93,7 +93,7 @@ public: /** * Process a sentence fragment entry */ - virtual int doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); + virtual int doSentenceEntry(int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence); /** * Sets a given dial to be pointing in a specified region (0 to 2) diff --git a/engines/titanic/true_talk/bellbot_script.cpp b/engines/titanic/true_talk/bellbot_script.cpp index ddfd315f02..7da2ab6201 100644 --- a/engines/titanic/true_talk/bellbot_script.cpp +++ b/engines/titanic/true_talk/bellbot_script.cpp @@ -77,7 +77,7 @@ void BellbotScript::setupSentences() { _entryCount = 0; } -int BellbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { +int BellbotScript::process(const TTroomScript *roomScript, const TTsentence *sentence) { int val24 = getValue(24); CTrueTalkManager::setFlags(24, 0); @@ -344,7 +344,7 @@ int BellbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { return 2; } -ScriptChangedResult BellbotScript::scriptChanged(TTroomScript *roomScript, uint id) { +ScriptChangedResult BellbotScript::scriptChanged(const TTroomScript *roomScript, uint id) { if (!roomScript) return SCR_2; @@ -415,7 +415,7 @@ ScriptChangedResult BellbotScript::scriptChanged(TTroomScript *roomScript, uint return SCR_2; } -int BellbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, +int BellbotScript::handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, uint val, uint tagId, uint remainder) { switch (tagId) { case MKTAG('A', 'D', 'V', 'T'): @@ -656,7 +656,7 @@ int BellbotScript::preResponse(uint id) { return newId; } -int BellbotScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { +int BellbotScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence) { switch (val1) { case 1: addResponse(getDialogueId(*srcIdP)); @@ -789,7 +789,7 @@ void BellbotScript::setValue23(uint id) { CTrueTalkManager::setFlags(23, val); } -int BellbotScript::preprocess(TTroomScript *roomScript, TTsentence *sentence) { +int BellbotScript::preprocess(const TTroomScript *roomScript, const TTsentence *sentence) { if (!roomScript || !sentence) return true; @@ -1588,7 +1588,7 @@ stateFlag = false; return applyFlag ? 2 : 1; } -bool BellbotScript::better(TTsentence *sentence, uint id1, uint id2) { +bool BellbotScript::better(const TTsentence *sentence, uint id1, uint id2) { if (sentence->contains("good") || sentence->localWord("better")) { addResponse(getDialogueId(id1)); } else if (sentence->localWord("bad")) { @@ -1600,7 +1600,7 @@ bool BellbotScript::better(TTsentence *sentence, uint id1, uint id2) { return true; } -bool BellbotScript::randomResponse0(TTroomScript *roomScript, uint id) { +bool BellbotScript::randomResponse0(const TTroomScript *roomScript, uint id) { bool dr0 = getDialRegion(0) == 1; uint newId = getValue(1); @@ -1621,7 +1621,7 @@ bool BellbotScript::randomResponse0(TTroomScript *roomScript, uint id) { return true; } -bool BellbotScript::randomResponse1(TTroomScript *roomScript, uint id) { +bool BellbotScript::randomResponse1(const TTroomScript *roomScript, uint id) { if (getRandomNumber(100) < 10) { addResponse(getDialogueId(201978)); applyResponse(); @@ -1636,7 +1636,7 @@ bool BellbotScript::randomResponse1(TTroomScript *roomScript, uint id) { return false; } -bool BellbotScript::randomResponse2(TTroomScript *roomScript, uint id) { +bool BellbotScript::randomResponse2(const TTroomScript *roomScript, uint id) { if (getRandomNumber(100) < 5) { addResponse(getDialogueId(202262)); applyResponse(); @@ -1651,7 +1651,7 @@ bool BellbotScript::randomResponse2(TTroomScript *roomScript, uint id) { return false; } -void BellbotScript::randomResponse3(TTroomScript *roomScript, uint id) { +void BellbotScript::randomResponse3(const TTroomScript *roomScript, uint id) { bool result = false; if (roomScript && getRandomNumber(100) < 50) result = addRoomDescription(roomScript); @@ -1676,7 +1676,7 @@ void BellbotScript::randomResponse3(TTroomScript *roomScript, uint id) { addResponse(getDialogueId(id == 1 ? 202265 : 202263)); } -void BellbotScript::randomResponse4(TTroomScript *roomScript, uint id) { +void BellbotScript::randomResponse4(const TTroomScript *roomScript, uint id) { if (getRandomNumber(100) < 4 && id <= 2) { addResponse(getDialogueId(202268)); } else { @@ -1684,7 +1684,7 @@ void BellbotScript::randomResponse4(TTroomScript *roomScript, uint id) { } } -int BellbotScript::checkCommonSentences(TTroomScript *roomScript, TTsentence *sentence) { +int BellbotScript::checkCommonSentences(const TTroomScript *roomScript, const TTsentence *sentence) { if (!roomScript || !sentence) return 1; @@ -1707,7 +1707,7 @@ int BellbotScript::checkCommonSentences(TTroomScript *roomScript, TTsentence *se return 0; } -bool BellbotScript::checkCommonWords(TTroomScript *roomScript, TTsentence *sentence) { +bool BellbotScript::checkCommonWords(const TTroomScript *roomScript, const TTsentence *sentence) { if (!roomScript || !sentence) return 0; CTrueTalkManager::setFlags(23, 0); @@ -1812,7 +1812,7 @@ bool BellbotScript::checkCommonWords(TTroomScript *roomScript, TTsentence *sente return true; } -uint BellbotScript::getRoomDialogueId(TTroomScript *roomScript) { +uint BellbotScript::getRoomDialogueId(const TTroomScript *roomScript) { if (!roomScript) return 0; @@ -1824,7 +1824,7 @@ uint BellbotScript::getRoomDialogueId(TTroomScript *roomScript) { return 0; } -bool BellbotScript::addRoomDescription(TTroomScript *roomScript) { +bool BellbotScript::addRoomDescription(const TTroomScript *roomScript) { if (!roomScript) return false; diff --git a/engines/titanic/true_talk/bellbot_script.h b/engines/titanic/true_talk/bellbot_script.h index ee5a679041..3080b56902 100644 --- a/engines/titanic/true_talk/bellbot_script.h +++ b/engines/titanic/true_talk/bellbot_script.h @@ -64,28 +64,28 @@ private: /** * Does preprocessing for the sentence */ - int preprocess(TTroomScript *roomScript, TTsentence *sentence); + int preprocess(const TTroomScript *roomScript, const TTsentence *sentence); /** * Checks for good, better, or bad in the sentence */ - bool better(TTsentence *sentence, uint id1, uint id2); + bool better(const TTsentence *sentence, uint id1, uint id2); - bool randomResponse0(TTroomScript *roomScript, uint id); - bool randomResponse1(TTroomScript *roomScript, uint id); - bool randomResponse2(TTroomScript *roomScript, uint id); - void randomResponse3(TTroomScript *roomScript, uint id); - void randomResponse4(TTroomScript *roomScript, uint id); + bool randomResponse0(const TTroomScript *roomScript, uint id); + bool randomResponse1(const TTroomScript *roomScript, uint id); + bool randomResponse2(const TTroomScript *roomScript, uint id); + void randomResponse3(const TTroomScript *roomScript, uint id); + void randomResponse4(const TTroomScript *roomScript, uint id); - int checkCommonSentences(TTroomScript *roomScript, TTsentence *sentence); - bool checkCommonWords(TTroomScript *roomScript, TTsentence *sentence); + int checkCommonSentences(const TTroomScript *roomScript, const TTsentence *sentence); + bool checkCommonWords(const TTroomScript *roomScript, const TTsentence *sentence); - uint getRoomDialogueId(TTroomScript *roomScript); + uint getRoomDialogueId(const TTroomScript *roomScript); /** * Adds a description of the room to the conversation response */ - bool addRoomDescription(TTroomScript *roomScript); + bool addRoomDescription(const TTroomScript *roomScript); public: BellbotScript(int val1, const char *charClass, int v2, const char *charName, int v3, int val2); @@ -93,14 +93,14 @@ public: /** * Does NPC specific processing of the parsed sentence */ - virtual int process(TTroomScript *roomScript, TTsentence *sentence); + virtual int process(const TTroomScript *roomScript, const TTsentence *sentence); /** * Called when the script/id changes */ - virtual ScriptChangedResult scriptChanged(TTroomScript *roomScript, uint id); + virtual ScriptChangedResult scriptChanged(const TTroomScript *roomScript, uint id); - virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, + virtual int handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, uint val, uint tagId, uint remainder); /** @@ -116,7 +116,7 @@ public: /** * Process a sentence fragment entry */ - virtual int doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); + virtual int doSentenceEntry(int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence); /** * Handles a randomzied response diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index c955e7e925..d9bab2e237 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -60,7 +60,7 @@ void DeskbotScript::setupSentences() { _entryCount = 0; } -int DeskbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { +int DeskbotScript::process(const TTroomScript *roomScript, const TTsentence *sentence) { if (roomScript->_scriptId != 110) return 2; @@ -76,12 +76,12 @@ int DeskbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { return 0; } -ScriptChangedResult DeskbotScript::scriptChanged(TTroomScript *roomScript, uint id) { +ScriptChangedResult DeskbotScript::scriptChanged(const TTroomScript *roomScript, uint id) { warning("TODO"); return SCR_1; } -int DeskbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, +int DeskbotScript::handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, uint val, uint tagId, uint remainder) { switch (tagId) { case MKTAG('A', 'D', 'V', 'T'): @@ -281,7 +281,7 @@ uint DeskbotScript::getDialsBitset() const { return getDialRegion(0) ? 0 : 1; } -int DeskbotScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { +int DeskbotScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence) { uint id; switch (val1) { diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index 55896a2425..8f37b4b227 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -94,14 +94,14 @@ public: /** * Does NPC specific processing of the parsed sentence */ - virtual int process(TTroomScript *roomScript, TTsentence *sentence); + virtual int process(const TTroomScript *roomScript, const TTsentence *sentence); /** * Called when the script/id changes */ - virtual ScriptChangedResult scriptChanged(TTroomScript *roomScript, uint id); + virtual ScriptChangedResult scriptChanged(const TTroomScript *roomScript, uint id); - virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, + virtual int handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, uint val, uint tagId, uint remainder); /** @@ -122,7 +122,7 @@ public: /** * Process a sentence fragment entry */ - virtual int doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); + virtual int doSentenceEntry(int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence); /** * Handles a randomzied response diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 7319058c0a..6a31f93111 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -71,7 +71,7 @@ void DoorbotScript::setupSentences() { _entryCount = 0; } -int DoorbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { +int DoorbotScript::chooseResponse(const TTroomScript *roomScript, const TTsentence *sentence, uint tag) { if (tag == MKTAG('D', 'N', 'A', '1') || tag == MKTAG('H', 'H', 'G', 'Q') || tag == MKTAG('A', 'N', 'S', 'W') || tag == MKTAG('S', 'U', 'M', 'S')) { if (_stateIndex > 9) @@ -127,17 +127,17 @@ int DoorbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence return TTnpcScript::chooseResponse(roomScript, sentence, tag); } -int DoorbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { +int DoorbotScript::process(const TTroomScript *roomScript, const TTsentence *sentence) { // TODO return 0; } -ScriptChangedResult DoorbotScript::scriptChanged(TTroomScript *roomScript, uint id) { +ScriptChangedResult DoorbotScript::scriptChanged(const TTroomScript *roomScript, uint id) { warning("TODO"); return SCR_1; } -int DoorbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, +int DoorbotScript::handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, uint val, uint tagId, uint remainder) { switch (tagId) { case MKTAG('A', 'D', 'V', 'T'): @@ -336,7 +336,7 @@ uint DoorbotScript::getDialsBitset() const { return bits; } -int DoorbotScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { +int DoorbotScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence) { int id2, id = 0; switch (val1) { diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index be653fd1b6..ec615295b5 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -58,19 +58,19 @@ public: /** * Chooses and adds a conversation response based on a specified tag Id. */ - virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag); + virtual int chooseResponse(const TTroomScript *roomScript, const TTsentence *sentence, uint tag); /** * Does NPC specific processing of the parsed sentence */ - virtual int process(TTroomScript *roomScript, TTsentence *sentence); + virtual int process(const TTroomScript *roomScript, const TTsentence *sentence); /** * Called when the script/id changes */ - virtual ScriptChangedResult scriptChanged(TTroomScript *roomScript, uint id); + virtual ScriptChangedResult scriptChanged(const TTroomScript *roomScript, uint id); - virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, + virtual int handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, uint val, uint tagId, uint remainder); /** @@ -91,7 +91,7 @@ public: /** * Process a sentence fragment entry */ - virtual int doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); + virtual int doSentenceEntry(int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence); /** * Sets a given dial to be pointing in a specified region (0 to 2) diff --git a/engines/titanic/true_talk/liftbot_script.cpp b/engines/titanic/true_talk/liftbot_script.cpp index 2f079cbaac..027d597b08 100644 --- a/engines/titanic/true_talk/liftbot_script.cpp +++ b/engines/titanic/true_talk/liftbot_script.cpp @@ -56,7 +56,7 @@ void LiftbotScript::setupSentences() { _entryCount = 0; } -int LiftbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { +int LiftbotScript::chooseResponse(const TTroomScript *roomScript, const TTsentence *sentence, uint tag) { switch (tag) { case MKTAG('D', 'N', 'A', '1'): case MKTAG('H', 'H', 'G', 'Q'): @@ -85,7 +85,7 @@ int LiftbotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence } } -int LiftbotScript::process(TTroomScript *roomScript, TTsentence *sentence) { +int LiftbotScript::process(const TTroomScript *roomScript, const TTsentence *sentence) { // TODO return 0; } @@ -95,12 +95,12 @@ int LiftbotScript::proc9() const { return 0; } -ScriptChangedResult LiftbotScript::scriptChanged(TTroomScript *roomScript, uint id) { +ScriptChangedResult LiftbotScript::scriptChanged(const TTroomScript *roomScript, uint id) { warning("TODO"); return SCR_1; } -int LiftbotScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, +int LiftbotScript::handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, uint val, uint tagId, uint remainder) { switch (tagId) { case MKTAG('A', 'D', 'V', 'T'): @@ -247,7 +247,7 @@ uint LiftbotScript::getDialsBitset() const { } -int LiftbotScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { +int LiftbotScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence) { static const int ARRAY13[] = { 210724, 210735, 210746, 210757, 210758, 210759, 210760, 210761, 210762, 210725, 210726, 210727, 210728, 210729, diff --git a/engines/titanic/true_talk/liftbot_script.h b/engines/titanic/true_talk/liftbot_script.h index 55752e1df6..d2f5a3019b 100644 --- a/engines/titanic/true_talk/liftbot_script.h +++ b/engines/titanic/true_talk/liftbot_script.h @@ -53,21 +53,21 @@ public: /** * Chooses and adds a conversation response based on a specified tag Id. */ - virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag); + virtual int chooseResponse(const TTroomScript *roomScript, const TTsentence *sentence, uint tag); /** * Does NPC specific processing of the parsed sentence */ - virtual int process(TTroomScript *roomScript, TTsentence *sentence); + virtual int process(const TTroomScript *roomScript, const TTsentence *sentence); virtual int proc9() const; /** * Called when the script/id changes */ - virtual ScriptChangedResult scriptChanged(TTroomScript *roomScript, uint id); + virtual ScriptChangedResult scriptChanged(const TTroomScript *roomScript, uint id); - virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, + virtual int handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, uint val, uint tagId, uint remainder); /** @@ -88,7 +88,7 @@ public: /** * Process a sentence fragment entry */ - virtual int doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); + virtual int doSentenceEntry(int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence); /** * Sets a given dial to be pointing in a specified region (0 to 2) diff --git a/engines/titanic/true_talk/maitred_script.cpp b/engines/titanic/true_talk/maitred_script.cpp index 7da541f0f7..57ae517db8 100644 --- a/engines/titanic/true_talk/maitred_script.cpp +++ b/engines/titanic/true_talk/maitred_script.cpp @@ -53,7 +53,7 @@ void MaitreDScript::setupSentences() { _entryCount = 0; } -int MaitreDScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { +int MaitreDScript::chooseResponse(const TTroomScript *roomScript, const TTsentence *sentence, uint tag) { if (tag == MKTAG('F', 'O', 'O', 'D') || tag == MKTAG('F', 'I', 'S', 'H') || tag == MKTAG('C', 'H', 'S', 'E')) { addResponse(getDialogueId(260388)); @@ -65,17 +65,17 @@ int MaitreDScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence return TTnpcScript::chooseResponse(roomScript, sentence, tag); } -int MaitreDScript::process(TTroomScript *roomScript, TTsentence *sentence) { +int MaitreDScript::process(const TTroomScript *roomScript, const TTsentence *sentence) { // TODO return 0; } -ScriptChangedResult MaitreDScript::scriptChanged(TTroomScript *roomScript, uint id) { +ScriptChangedResult MaitreDScript::scriptChanged(const TTroomScript *roomScript, uint id) { warning("TODO"); return SCR_1; } -int MaitreDScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, +int MaitreDScript::handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, uint val, uint tagId, uint remainder) { switch (tagId) { case MKTAG('A', 'D', 'V', 'T'): @@ -301,7 +301,7 @@ int MaitreDScript::preResponse(uint id) { return 0; } -int MaitreDScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { +int MaitreDScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/maitred_script.h b/engines/titanic/true_talk/maitred_script.h index 06fc6866ab..bed93fa6c1 100644 --- a/engines/titanic/true_talk/maitred_script.h +++ b/engines/titanic/true_talk/maitred_script.h @@ -63,19 +63,19 @@ public: /** * Chooses and adds a conversation response based on a specified tag Id. */ - virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag); + virtual int chooseResponse(const TTroomScript *roomScript, const TTsentence *sentence, uint tag); /** * Does NPC specific processing of the parsed sentence */ - virtual int process(TTroomScript *roomScript, TTsentence *sentence); + virtual int process(const TTroomScript *roomScript, const TTsentence *sentence); /** * Called when the script/id changes */ - virtual ScriptChangedResult scriptChanged(TTroomScript *roomScript, uint id); + virtual ScriptChangedResult scriptChanged(const TTroomScript *roomScript, uint id); - virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, + virtual int handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, uint val, uint tagId, uint remainder); /** @@ -91,7 +91,7 @@ public: /** * Process a sentence fragment entry */ - virtual int doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); + virtual int doSentenceEntry(int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/parrot_script.cpp b/engines/titanic/true_talk/parrot_script.cpp index 96efc627c1..b09e74505c 100644 --- a/engines/titanic/true_talk/parrot_script.cpp +++ b/engines/titanic/true_talk/parrot_script.cpp @@ -41,7 +41,7 @@ void ParrotScript::setupSentences() { _entryCount = 0; } -int ParrotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { +int ParrotScript::chooseResponse(const TTroomScript *roomScript, const TTsentence *sentence, uint tag) { if (tag == MKTAG('B', 'Y', 'Z', 'A')) { addResponse(getDialogueId(280246)); applyResponse(); @@ -51,7 +51,7 @@ int ParrotScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, } } -int ParrotScript::process(TTroomScript *roomScript, TTsentence *sentence) { +int ParrotScript::process(const TTroomScript *roomScript, const TTsentence *sentence) { if (processEntries(roomScript, sentence) == 2) { int tagId = g_vm->_trueTalkManager->_quotes.find(sentence->_normalizedLine); if (!tagId || chooseResponse(roomScript, sentence, tagId) != 2) { @@ -63,7 +63,7 @@ int ParrotScript::process(TTroomScript *roomScript, TTsentence *sentence) { return 2; } -ScriptChangedResult ParrotScript::scriptChanged(TTroomScript *roomScript, uint id) { +ScriptChangedResult ParrotScript::scriptChanged(const TTroomScript *roomScript, uint id) { if (id >= 280000 && id <= 280276) { if (id == 280258) { if (CTrueTalkManager::_currentNPC) { @@ -103,7 +103,7 @@ ScriptChangedResult ParrotScript::scriptChanged(TTroomScript *roomScript, uint i return (id == 3) ? SCR_2 : SCR_1; } -int ParrotScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { +int ParrotScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence) { return 0; } diff --git a/engines/titanic/true_talk/parrot_script.h b/engines/titanic/true_talk/parrot_script.h index 7e473bf242..ec7bec7629 100644 --- a/engines/titanic/true_talk/parrot_script.h +++ b/engines/titanic/true_talk/parrot_script.h @@ -40,22 +40,22 @@ public: /** * Chooses and adds a conversation response based on a specified tag Id. */ - virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag); + virtual int chooseResponse(const TTroomScript *roomScript, const TTsentence *sentence, uint tag); /** * Does NPC specific processing of the parsed sentence */ - virtual int process(TTroomScript *roomScript, TTsentence *sentence); + virtual int process(const TTroomScript *roomScript, const TTsentence *sentence); /** * Called when the script/id changes */ - virtual ScriptChangedResult scriptChanged(TTroomScript *roomScript, uint id); + virtual ScriptChangedResult scriptChanged(const TTroomScript *roomScript, uint id); /** * Process a sentence fragment entry */ - virtual int doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); + virtual int doSentenceEntry(int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/succubus_script.cpp b/engines/titanic/true_talk/succubus_script.cpp index 9be779513f..e950f549b7 100644 --- a/engines/titanic/true_talk/succubus_script.cpp +++ b/engines/titanic/true_talk/succubus_script.cpp @@ -41,7 +41,7 @@ void SuccUBusScript::setupSentences() { _entryCount = 0; } -int SuccUBusScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { +int SuccUBusScript::chooseResponse(const TTroomScript *roomScript, const TTsentence *sentence, uint tag) { uint dialogueId = tag; switch (tag) { @@ -74,12 +74,12 @@ int SuccUBusScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentenc } } -int SuccUBusScript::process(TTroomScript *roomScript, TTsentence *sentence) { +int SuccUBusScript::process(const TTroomScript *roomScript, const TTsentence *sentence) { // TODO return 0; } -ScriptChangedResult SuccUBusScript::scriptChanged(TTroomScript *roomScript, uint id) { +ScriptChangedResult SuccUBusScript::scriptChanged(const TTroomScript *roomScript, uint id) { warning("TODO"); return SCR_1; } @@ -89,7 +89,7 @@ int SuccUBusScript::updateState(uint oldId, uint newId, int index) { return 0; } -int SuccUBusScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { +int SuccUBusScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence) { warning("TODO"); return 0; } diff --git a/engines/titanic/true_talk/succubus_script.h b/engines/titanic/true_talk/succubus_script.h index 4ea85f1a92..541392eb30 100644 --- a/engines/titanic/true_talk/succubus_script.h +++ b/engines/titanic/true_talk/succubus_script.h @@ -42,17 +42,17 @@ public: /** * Chooses and adds a conversation response based on a specified tag Id. */ - virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag); + virtual int chooseResponse(const TTroomScript *roomScript, const TTsentence *sentence, uint tag); /** * Does NPC specific processing of the parsed sentence */ - virtual int process(TTroomScript *roomScript, TTsentence *sentence); + virtual int process(const TTroomScript *roomScript, const TTsentence *sentence); /** * Called when the script/id changes */ - virtual ScriptChangedResult scriptChanged(TTroomScript *roomScript, uint id); + virtual ScriptChangedResult scriptChanged(const TTroomScript *roomScript, uint id); /** * Handles updating NPC state based on specified dialogue Ids and dial positions @@ -62,7 +62,7 @@ public: /** * Process a sentence fragment entry */ - virtual int doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); + virtual int doSentenceEntry(int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence); }; } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index b61b9d53e1..614b60747f 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -210,7 +210,7 @@ void TTnpcScript::addResponse(int id) { TTscriptBase::addResponse(id); } -int TTnpcScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) { +int TTnpcScript::chooseResponse(const TTroomScript *roomScript, const TTsentence *sentence, uint tag) { for (uint idx = 0; idx < _responses.size(); ++idx) { const TTnpcScriptResponse &response = _responses[idx]; @@ -231,7 +231,7 @@ int TTnpcScript::chooseResponse(TTroomScript *roomScript, TTsentence *sentence, return 1; } -int TTnpcScript::process(TTroomScript *roomScript, TTsentence *sentence) { +int TTnpcScript::process(const TTroomScript *roomScript, const TTsentence *sentence) { return processEntries(&_entries, _entryCount, roomScript, sentence); } @@ -275,7 +275,7 @@ bool TTnpcScript::handleWord(uint id) const { return true; } -int TTnpcScript::handleQuote(TTroomScript *roomScript, TTsentence *sentence, +int TTnpcScript::handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, uint val, uint tagId, uint remainder) { if (_quotes.empty()) return 1; @@ -395,7 +395,7 @@ const TTscriptMapping *TTnpcScript::getMapping(int index) { return nullptr; } -int TTnpcScript::doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence) { +int TTnpcScript::doSentenceEntry(int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence) { return 0; } @@ -698,7 +698,7 @@ CPetControl *TTnpcScript::getPetControl(CGameManager *gameManager) { return nullptr; } -int TTnpcScript::processEntries(const TTsentenceEntries *entries, uint entryCount, TTroomScript *roomScript, TTsentence *sentence) { +int TTnpcScript::processEntries(const TTsentenceEntries *entries, uint entryCount, const TTroomScript *roomScript, const TTsentence *sentence) { if (!entries) return SS_1; if (!entryCount) @@ -769,7 +769,7 @@ int TTnpcScript::processEntries(const TTsentenceEntries *entries, uint entryCoun return 1; } -bool TTnpcScript::defaultProcess(TTroomScript *roomScript, TTsentence *sentence) { +bool TTnpcScript::defaultProcess(const TTroomScript *roomScript, const TTsentence *sentence) { uint remainder; TTtreeResult results[32]; const TTstring &line = sentence->_normalizedLine; @@ -803,7 +803,7 @@ TTscriptRange *TTnpcScript::findRange(uint id) { return nullptr; } -void TTnpcScript::checkItems(TTroomScript *roomScript, TTsentence *sentence) { +void TTnpcScript::checkItems(const TTroomScript *roomScript, const TTsentence *sentence) { _field2CC = 0; ++CTrueTalkManager::_v2; diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index ddb5b8ff64..21ab1be28b 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -59,12 +59,12 @@ public: /** * Chooses and adds a conversation response based on a specified tag Id. */ - virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag) = 0; + virtual int chooseResponse(const TTroomScript *roomScript, const TTsentence *sentence, uint tag) = 0; /** * Does NPC specific processing of the parsed sentence */ - virtual int process(TTroomScript *roomScript, TTsentence *sentence) = 0; + virtual int process(const TTroomScript *roomScript, const TTsentence *sentence) = 0; virtual int proc8() const = 0; virtual int proc9() const = 0; @@ -72,7 +72,7 @@ public: /** * Called when the script/id changes */ - virtual ScriptChangedResult scriptChanged(TTroomScript *roomScript, uint id) = 0; + virtual ScriptChangedResult scriptChanged(const TTroomScript *roomScript, uint id) = 0; virtual int proc11() const = 0; virtual int proc12() const = 0; @@ -168,18 +168,18 @@ protected: /** * Scans through a list of sentence entries for a matching standardized response */ - int processEntries(const TTsentenceEntries *entries, uint entryCount, TTroomScript *roomScript, TTsentence *sentence); + int processEntries(const TTsentenceEntries *entries, uint entryCount, const TTroomScript *roomScript, const TTsentence *sentence); /** * Scans through a list of sentence entries for a matching standardized response */ - int processEntries(TTroomScript *roomScript, TTsentence *sentence) { + int processEntries(const TTroomScript *roomScript, const TTsentence *sentence) { return processEntries(&_entries, _entryCount, roomScript, sentence); } - bool defaultProcess(TTroomScript *roomScript, TTsentence *sentence); + bool defaultProcess(const TTroomScript *roomScript, const TTsentence *sentence); - void checkItems(TTroomScript *roomScript, TTsentence *sentence); + void checkItems(const TTroomScript *roomScript, const TTsentence *sentence); /** * Adds a random conversation response @@ -224,12 +224,12 @@ public: * This default implementation does a lookup into a list of known tags, * and chooses a random dialogue Id from the available ones for that tag */ - virtual int chooseResponse(TTroomScript *roomScript, TTsentence *sentence, uint tag); + virtual int chooseResponse(const TTroomScript *roomScript, const TTsentence *sentence, uint tag); /** * Does NPC specific processing of the parsed sentence */ - virtual int process(TTroomScript *roomScript, TTsentence *sentence); + virtual int process(const TTroomScript *roomScript, const TTsentence *sentence); virtual int proc8() const; virtual int proc9() const; @@ -237,7 +237,7 @@ public: /** * Called when the script/id changes */ - virtual ScriptChangedResult scriptChanged(TTroomScript *roomScript, uint id) { + virtual ScriptChangedResult scriptChanged(const TTroomScript *roomScript, uint id) { return SCR_2; } @@ -256,7 +256,7 @@ public: */ virtual bool handleWord(uint id) const; - virtual int handleQuote(TTroomScript *roomScript, TTsentence *sentence, + virtual int handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, uint val, uint tagId, uint remainder); /** @@ -287,12 +287,12 @@ public: virtual uint getDialsBitset() const { return 0; } virtual const TTscriptMapping *getMapping(int index); - virtual int doSentenceEntry(int val1, const int *srcIdP, TTroomScript *roomScript, TTsentence *sentence); + virtual int doSentenceEntry(int val1, const int *srcIdP, const TTroomScript *roomScript, const TTsentence *sentence); /** * Handles any post-response NPC processing */ - virtual void postResponse(int v1, const TTsentenceEntry *entry, TTroomScript *roomScript, TTsentence *sentence) {} + virtual void postResponse(int v1, const TTsentenceEntry *entry, const TTroomScript *roomScript, const TTsentence *sentence) {} virtual void save(SimpleFile *file); virtual void load(SimpleFile *file); diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp index 467f6a188a..6a8e74d976 100644 --- a/engines/titanic/true_talk/tt_sentence.cpp +++ b/engines/titanic/true_talk/tt_sentence.cpp @@ -108,19 +108,19 @@ int TTsentence::storeVocabHit(TTword *word) { } bool TTsentence::fn1(const CString &str, int wordId1, const CString &str1, const CString &str2, - const CString &str3, int wordId2, int val, int val2, const TTconceptNode *node) { + const CString &str3, int wordId2, int val, int val2, const TTconceptNode *node) const { // TODO return false; } bool TTsentence::fn3(const CString &str1, const CString &str2, const CString &str3, const CString &str4, const CString &str5, const CString &str6, - int val, int val2, const TTconceptNode *node) { + int val, int val2, const TTconceptNode *node) const { // TODO return false; } -bool TTsentence::fn2(int slotIndex, const TTstring &str, TTconceptNode *conceptNode) { +bool TTsentence::fn2(int slotIndex, const TTstring &str, const TTconceptNode *conceptNode) const { if (!conceptNode) conceptNode = &_sentenceConcept; TTconcept *concept = getFrameSlot(slotIndex, conceptNode); @@ -199,7 +199,7 @@ exit: return abortFlag; } -bool TTsentence::fn4(int mode, int wordId, TTconceptNode *node) { +bool TTsentence::fn4(int mode, int wordId, const TTconceptNode *node) const { if (!node) node = &_sentenceConcept; @@ -256,7 +256,7 @@ int TTsentence::is1C(int val, const TTconceptNode *node) const { return node->_field1C == val; } -bool TTsentence::isConcept34(int slotIndex, TTconceptNode *node) { +bool TTsentence::isConcept34(int slotIndex, const TTconceptNode *node) const { TTconcept *concept = getFrameEntry(slotIndex, node); return concept && concept->getState(); } diff --git a/engines/titanic/true_talk/tt_sentence.h b/engines/titanic/true_talk/tt_sentence.h index 2900a4d4b3..8cecaed4f2 100644 --- a/engines/titanic/true_talk/tt_sentence.h +++ b/engines/titanic/true_talk/tt_sentence.h @@ -109,14 +109,14 @@ public: int storeVocabHit(TTword *word); bool fn1(const CString &str, int wordId1, const CString &str1, const CString &str2, - const CString &str3, int wordId2, int val, int val2, const TTconceptNode *node); + const CString &str3, int wordId2, int val, int val2, const TTconceptNode *node) const; bool fn3(const CString &str1, const CString &str2, const CString &str3, const CString &str4, const CString &str5, const CString &str6, - int val, int val2, const TTconceptNode *node); - bool fn2(int slotIndex, const TTstring &str, TTconceptNode *conceptNode); - bool fn4(int mode, int wordId, TTconceptNode *node); + int val, int val2, const TTconceptNode *node) const; + bool fn2(int slotIndex, const TTstring &str, const TTconceptNode *conceptNode) const; + bool fn4(int mode, int wordId, const TTconceptNode *node) const; - bool isConcept34(int slotIndex, TTconceptNode *node = nullptr); + bool isConcept34(int slotIndex, const TTconceptNode *node = nullptr) const; bool localWord(const char *str) const; -- cgit v1.2.3 From af286f2c979c2a959894ec003843c295b04d49ee Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 31 Jul 2016 15:02:09 -0400 Subject: DEVTOOLS: Add entries sentence sets for Deskbot in create_titanic --- devtools/create_titanic/create_titanic_dat.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index bf1da8e427..1f359c4705 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -648,6 +648,8 @@ void writeData() { writeSentenceEntries("Sentences/Bellbot/19", 0x5D61B8); writeSentenceEntries("Sentences/Deskbot", 0x5DCD10); + writeSentenceEntries("Sentences/Deskbot/2", 0x5E8E18); + writeSentenceEntries("Sentences/Deskbot/3", 0x5E8BA8); writeSentenceEntries("Sentences/Doorbot", 0x5EC110); writeSentenceEntries("Sentences/Liftbot", 0x6026B0); writeSentenceEntries("Sentences/MaitreD", 0x60CFD8); -- cgit v1.2.3 From 267b8405fdf71b13eaa68b09ae74b1986deea4fa Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 31 Jul 2016 15:02:29 -0400 Subject: TITANIC: Added DeskbotScript process --- engines/titanic/true_talk/deskbot_script.cpp | 64 +++++++++++++++++++++++++++- engines/titanic/true_talk/deskbot_script.h | 2 + 2 files changed, 64 insertions(+), 2 deletions(-) diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index d9bab2e237..56f20f9581 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -55,6 +55,8 @@ DeskbotScript::DeskbotScript(int val1, const char *charClass, int v2, void DeskbotScript::setupSentences() { _mappings.load("Mappings/Deskbot", 4); _entries.load("Sentences/Deskbot"); + _entries2.load("Sentences/Deskbot/2"); + _entries3.load("Sentences/Deskbot/3"); _dialValues[0] = _dialValues[1] = 0; _field68 = 0; _entryCount = 0; @@ -72,8 +74,66 @@ int DeskbotScript::process(const TTroomScript *roomScript, const TTsentence *sen if (preprocess(roomScript, sentence) != 1) return 1; - // TODO - return 0; + CTrueTalkManager::setFlags(17, 0); + setState(0); + updateCurrentDial(false); + + if (getValue(1) == 3) { + if (sentence->localWord("competition") || sentence->contains("competition") + || sentence->localWord("won") || sentence->contains("won") + || sentence->localWord("winning") || sentence->contains("winning") + || sentence->localWord("winner") || sentence->contains("winner") + || sentence->contains("35279") || sentence->contains("3 5 2 7 9") + ) { + addResponse(getDialogueId(41773)); + applyResponse(); + return 2; + } else if (sentence->localWord("magazine") || sentence->contains("magazine")) { + addResponse(getDialogueId(41771)); + applyResponse(); + return 2; + } else if (sentence->localWord("upgrade") || sentence->contains("upgrade")) { + if (CTrueTalkManager::_currentNPC) { + CGameObject *obj; + if (CTrueTalkManager::_currentNPC->find("Magazine", &obj, FIND_PET)) { + addResponse(getDialogueId(41773)); + applyResponse(); + return 2; + } + } + } + } + + if (processEntries(&_entries, _entryCount, roomScript, sentence) != 2 + && processEntries(&_entries2, 0, roomScript, sentence) != 2) { + if (sentence->localWord("sauce") || sentence->localWord("pureed")) { + addResponse(getDialogueId(240398)); + applyResponse(); + } else if (sentence->contains("cherries")) { + addResponse(getDialogueId(240358)); + applyResponse(); + } else if (sentence->contains("42")) { + addResponse(getDialogueId(240453)); + applyResponse(); + } else if (searchQuotes(roomScript, sentence)) { + addResponse(getDialogueId(241778)); + applyResponse(); + } else { + if (sentence->contains("98129812")) + setDialRegion(1, 1); + + if (!defaultProcess(roomScript, sentence) + && processEntries(&_entries3, 0, roomScript, sentence) != 2 + && processEntries(_defaultEntries, 0, roomScript, sentence) != 2) { + if (flag20) + CTrueTalkManager::setFlags(20, 1); + addResponse(getDialogueId(240569)); + applyResponse(); + } + } + } + + return 2; } ScriptChangedResult DeskbotScript::scriptChanged(const TTroomScript *roomScript, uint id) { diff --git a/engines/titanic/true_talk/deskbot_script.h b/engines/titanic/true_talk/deskbot_script.h index 8f37b4b227..f5978553ce 100644 --- a/engines/titanic/true_talk/deskbot_script.h +++ b/engines/titanic/true_talk/deskbot_script.h @@ -32,6 +32,8 @@ class DeskbotScript : public TTnpcScript { private: static int _oldId; TTupdateStateArray _states; + TTsentenceEntries _entries2; + TTsentenceEntries _entries3; private: /** * Setup sentence data -- cgit v1.2.3 From 16aeae7819c61d7b324564fd4ddf62f86e1cb28c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 31 Jul 2016 15:07:48 -0400 Subject: TITANIC: Added DeskbotScript scriptChanged --- engines/titanic/true_talk/deskbot_script.cpp | 31 ++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/engines/titanic/true_talk/deskbot_script.cpp b/engines/titanic/true_talk/deskbot_script.cpp index 56f20f9581..3f358889dc 100644 --- a/engines/titanic/true_talk/deskbot_script.cpp +++ b/engines/titanic/true_talk/deskbot_script.cpp @@ -137,8 +137,35 @@ int DeskbotScript::process(const TTroomScript *roomScript, const TTsentence *sen } ScriptChangedResult DeskbotScript::scriptChanged(const TTroomScript *roomScript, uint id) { - warning("TODO"); - return SCR_1; + switch (id) { + case 3: + case 100: + case 108: + CTrueTalkManager::setFlags(21, getValue(21) + 1); + addResponse(getDialogueId(getValue(22) ? 240577 : 241261)); + applyResponse(); + break; + + case 109: + addResponse(getDialogueId(241627)); + applyResponse(); + break; + + case 140: + if (getValue(1) == 3) + addAssignedRoomDialogue3(); + break; + + case 148: + CTrueTalkManager::setFlags(3, 1); + break; + + case 150: + CTrueTalkManager::setFlags(2, 1); + break; + } + + return SCR_2; } int DeskbotScript::handleQuote(const TTroomScript *roomScript, const TTsentence *sentence, -- cgit v1.2.3 From 19f8a0965be832a71a101054748cf000adf16add Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 31 Jul 2016 17:16:23 -0400 Subject: TITANIC: Added DoorbotScript process --- devtools/create_titanic/create_titanic_dat.cpp | 15 +- engines/titanic/true_talk/doorbot_script.cpp | 377 ++++++++++++++++++++++++- engines/titanic/true_talk/doorbot_script.h | 3 + 3 files changed, 390 insertions(+), 5 deletions(-) diff --git a/devtools/create_titanic/create_titanic_dat.cpp b/devtools/create_titanic/create_titanic_dat.cpp index 1f359c4705..2fe6679822 100644 --- a/devtools/create_titanic/create_titanic_dat.cpp +++ b/devtools/create_titanic/create_titanic_dat.cpp @@ -55,7 +55,7 @@ */ #define VERSION_NUMBER 1 -#define HEADER_SIZE 0xB00 +#define HEADER_SIZE 0xD00 Common::File inputFile, outputFile; Common::PEResources res; @@ -650,7 +650,20 @@ void writeData() { writeSentenceEntries("Sentences/Deskbot", 0x5DCD10); writeSentenceEntries("Sentences/Deskbot/2", 0x5E8E18); writeSentenceEntries("Sentences/Deskbot/3", 0x5E8BA8); + writeSentenceEntries("Sentences/Doorbot", 0x5EC110); + writeSentenceEntries("Sentences/Doorbot/2", 0x5FD930); + writeSentenceEntries("Sentences/Doorbot/100", 0x5FD930); + writeSentenceEntries("Sentences/Doorbot/101", 0x5FE668); + writeSentenceEntries("Sentences/Doorbot/102", 0x5FDD40); + writeSentenceEntries("Sentences/Doorbot/107", 0x5FFF08); + writeSentenceEntries("Sentences/Doorbot/110", 0x5FE3C0); + writeSentenceEntries("Sentences/Doorbot/111", 0x5FF0C8); + writeSentenceEntries("Sentences/Doorbot/124", 0x5FF780); + writeSentenceEntries("Sentences/Doorbot/129", 0x5FFAC0); + writeSentenceEntries("Sentences/Doorbot/131", 0x5FFC30); + writeSentenceEntries("Sentences/Doorbot/132", 0x6000E0); + writeSentenceEntries("Sentences/Liftbot", 0x6026B0); writeSentenceEntries("Sentences/MaitreD", 0x60CFD8); writeSentenceEntries("Sentences/Parrot", 0x615858); diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp index 6a31f93111..230acf7910 100644 --- a/engines/titanic/true_talk/doorbot_script.cpp +++ b/engines/titanic/true_talk/doorbot_script.cpp @@ -24,6 +24,7 @@ #include "titanic/true_talk/doorbot_script.h" #include "titanic/true_talk/tt_room_script.h" #include "titanic/true_talk/true_talk_manager.h" +#include "titanic/titanic.h" namespace Titanic { @@ -63,12 +64,20 @@ void DoorbotScript::setupSentences() { for (int idx = 35; idx < 40; ++idx) CTrueTalkManager::setFlags(idx, 0); _state = 1; + _field68 = 0; + _entryCount = 0; _dialValues[0] = _dialValues[1] = 100; _mappings.load("Mappings/Doorbot", 4); _entries.load("Sentences/Doorbot"); - _field68 = 0; - _entryCount = 0; + + static const int SENTENCE_NUMS[11] = { + 2, 100, 101, 102, 107, 110, 111, 124, 129, 131, 132 + }; + for (int idx = 0; idx < 11; ++idx) { + _sentences[idx] = TTsentenceEntries(); + _sentences[idx].load(CString::format("Sentences/Doorbot/%d", SENTENCE_NUMS[idx])); + } } int DoorbotScript::chooseResponse(const TTroomScript *roomScript, const TTsentence *sentence, uint tag) { @@ -128,8 +137,368 @@ int DoorbotScript::chooseResponse(const TTroomScript *roomScript, const TTsenten } int DoorbotScript::process(const TTroomScript *roomScript, const TTsentence *sentence) { - // TODO - return 0; + int currState; + + switch (roomScript->_scriptId) { + case 100: + case 101: + case 102: + case 103: + case 104: + case 106: + case 107: + case 108: + case 109: + case 110: + case 111: + case 113: + case 116: + case 117: + case 118: + case 122: + case 123: + case 124: + case 125: + case 126: + case 127: + case 128: + case 129: + case 130: + case 131: + case 132: + break; + + default: + return 2; + } + + checkItems(nullptr, nullptr); + if (getState() == 0) { + if (CTrueTalkManager::_v2 > getValue(36)) { + if (getDialRegion(1) == 1 && getRandomBit()) { + setDialRegion(0, getDialRegion(1) ? 0 : 1); + } else { + setDialRegion(1, getDialRegion(1) ? 0 : 1); + } + CTrueTalkManager::setFlags(36, CTrueTalkManager::_v2 + 3 + getRandomNumber(5)); + + if (getValue(37)) { + CTrueTalkManager::setFlags(37, 0); + setState(0); + return setResponse(getDialogueId(221140)); + } + } + } + + if (getValue(35) == 0 && roomScript->_scriptId != 100 && sentence->localWord("parrot")) { + CTrueTalkManager::setFlags(35, 1); + setState(0); + return setResponse(getDialogueId(220113)); + } + + if (sentence->_field2C == 6 && sentence->contains("why not")) { + return setResponse(11871, 8); + } + + currState = getState(); + if (currState) { + int sentMode = sentence->_field2C; + bool al = sentMode == 11 || sentMode == 13; + bool bl = sentMode == 12; + + switch (currState) { + case 1: + if (al) + return setResponse(11828, 2); + if (bl) + return setResponse(11827, 0); + break; + + case 2: + if (al) + return setResponse(11827, 0); + break; + + case 3: + if (sentMode == 3) + return setResponse(10406, 0); + break; + + case 4: + if (al) + return setResponse(11332, 0); + if (bl) + return setResponse(11331, 0); + break; + + case 5: + return setResponse(11868, 0); + + case 6: + return setResponse(11872, 0); + + case 7: + return setResponse(11869, 0); + + case 8: + return setResponse(11870, 0); + + case 12: + if (al) + return setResponse(11894, 13); + if (bl) + return setResponse(11893, 13); + break; + + case 13: + return setResponse(11895, 12); + + case 15: + if (sentMode == 3 || sentMode == 6) + return setResponse(10257, 0); + break; + + case 16: { + TTtreeResult treeResult; + if (g_vm->_trueTalkManager->_quotesTree.search(sentence->_normalizedLine.c_str(), + TREE_3, &treeResult, 0, nullptr) != -1) + return setResponse(getDialogueId(221380), 0); + break; + } + + case 17: + return setResponse(getDialogueId(221126), 0); + + case 18: + if (al) + return setResponse(getDialogueId(221135), 0); + if (bl) + return setResponse(getDialogueId(221134), 0); + break; + + case 19: + if (al) { + if (addRandomResponse(true)) { + setState(10); + return 2; + } + } + if (bl) + return setResponse(getDialogueId(221966), 0); + break; + + case 20: + if (al) { + if (addRandomResponse(true)) { + setState(19); + return 2; + } + } + if (bl || sentMode == 7 || sentMode == 10) { + return setResponse(getDialogueId(221879), 0); + } + break; + + case 21: + if (bl) + return setResponse(10935, 0); + break; + + case 22: + if (al) { + if (getRandomBit()) { + return setResponse(11211, 23); + } else { + return setResponse(10127, 0); + } + } + if (bl) + return setResponse(10136, 0); + break; + + case 23: + return setResponse(10212, 0); + + case 24: + if (al) + return setResponse(11151, 0); + if (bl) + return setResponse(11150, 0); + break; + + case 25: + case 26: + if (bl) { + if (getRandomBit()) { + return setResponse(11211, 23); + } else { + return setResponse(10127, 0); + } + } + if (al) + return setResponse(10136, 0); + break; + + case 27: + if (al || sentence->localWord("did") || sentence->contains("did")) + return setResponse(221175, 28); + break; + + case 28: + if (al || sentence->localWord("did") || sentence->contains("did")) + return setResponse(getDialogueId(221176), 29); + break; + + case 29: + if (al || sentence->localWord("did") || sentence->contains("did")) + return setResponse(getDialogueId(221177), 30); + break; + + case 30: + return setResponse(getDialogueId(221178), 31); + + case 31: + if (sentMode == 3 || sentMode == 10) + return setResponse(10350, 0); + break; + + case 32: + return setResponse(10110, 0); + + case 33: + if (sentence->contains("sieve") || sentence->contains("colander") + || sentence->contains("vegetable") || sentence->contains("ground") + || sentence->contains("earth") || sentence->contains("garden") + || sentence->contains("cheese") || sentence->contains("strainer")) { + return setResponse(getDialogueId(221375), 0); + } else if (getRandomNumber(100) > 30) { + return setResponse(getDialogueId(221376), 33); + } else { + return setResponse(getDialogueId(221376), 0); + } + break; + + case 34: + if (sentence->localWord("bellbot")) + return setResponse(10094, 0); + if (sentence->localWord("bellbot")) + return setResponse(10349, 0); + if (sentence->localWord("deskbot") || sentence->localWord("titania")) + return setResponse(10148, 0); + if (sentence->localWord("barbot") || sentence->localWord("rowbot") + || sentence->localWord("liftbot") || sentence->localWord("maitredbot")) + return setResponse(10147, 0); + break; + + case 35: + return setResponse(10811, 36); + + case 36: + if (al) + return setResponse(10813, 37); + if (bl) + return setResponse(10812, 37); + break; + + case 37: + if (al) + return setResponse(10815, 37); + if (bl) + return setResponse(10814, 37); + break; + + case 38: + return setResponse(10848, 39); + + case 39: + return setResponse(10823, 40); + + case 40: + return setResponse(10832, 41); + + case 41: + addResponse(10833); + return setResponse(10835, 0); + + case 42: + if (sentence->localWord("please")) + return setResponse(10840, 43); + return setResponse(10844, 0); + + case 43: + case 45: + return setResponse(10844, 0); + + case 44: + if (sentence->localWord("thanks")) + return setResponse(10843, 45); + return setResponse(10844, 0); + + case 46: + if (al) + return setResponse(getDialogueId(222251), 0); + if (bl) + return setResponse(10713, 0); + break; + + } + } + + if (currState != 14) + setState(0); + + if (getDialRegion(1) != 1 && getRandomNumber(100) > 92) + return setResponse(getDialogueId(221043), 0); + + int result = 0; + switch (roomScript->_scriptId) { + case 100: + case 101: + case 102: + case 107: + case 110: + case 111: + case 124: + case 129: + case 131: + case 132: + result = processEntries(&_sentences[roomScript->_scriptId], 0, roomScript, sentence); + break; + default: + break; + } + if (result == 2) + return 2; + + if (processEntries(&_entries, _entryCount, roomScript, sentence) == 2 + || processEntries(_defaultEntries, 0, roomScript, sentence) == 2 + || defaultProcess(roomScript, sentence)) + return 2; + + switch (sentence->_field2C) { + case 11: + if (getRandomNumber(100) > 90) + return setResponse(10839, 42); + return setResponse(222415, 0); + + case 12: + if (getRandomNumber(100) > 90) + return setResponse(10841, 44); + return setResponse(getDialogueId(222416), 0); + + case 13: + return setResponse(getDialogueId(222415), 0); + + default: + if (getRandomNumber(100) > 75 && getStateValue()) + return setResponse(getDialogueId(221095)); + + if (processEntries(&_sentences[2], 0, roomScript, sentence) != 2) + return setResponse(getDialogueId(220000)); + break; + } + + return 2; } ScriptChangedResult DoorbotScript::scriptChanged(const TTroomScript *roomScript, uint id) { diff --git a/engines/titanic/true_talk/doorbot_script.h b/engines/titanic/true_talk/doorbot_script.h index ec615295b5..09bbd56251 100644 --- a/engines/titanic/true_talk/doorbot_script.h +++ b/engines/titanic/true_talk/doorbot_script.h @@ -23,13 +23,16 @@ #ifndef TITANIC_DOORBOT_SCRIPT_H #define TITANIC_DOORBOT_SCRIPT_H +#include "common/hashmap.h" #include "titanic/true_talk/tt_npc_script.h" namespace Titanic { class DoorbotScript : public TTnpcScript { + typedef Common::HashMap SentenceEntriesMap; private: TTupdateStateArray _states; + SentenceEntriesMap _sentences; int _stateIndex; private: /** -- cgit v1.2.3