diff options
author | Jaromir Wysoglad | 2019-05-28 00:12:01 +0200 |
---|---|---|
committer | Thierry Crozat | 2019-07-28 15:09:14 +0100 |
commit | 7e2ca31be085ab3336e5eff38e46cca60fea6a2a (patch) | |
tree | 17fa24211aee87cdda681fa808577dcb8f34ebd9 /engines/supernova2 | |
parent | 4c03331d07f1a638933775da1eb0e4b1824353b8 (diff) | |
download | scummvm-rg350-7e2ca31be085ab3336e5eff38e46cca60fea6a2a.tar.gz scummvm-rg350-7e2ca31be085ab3336e5eff38e46cca60fea6a2a.tar.bz2 scummvm-rg350-7e2ca31be085ab3336e5eff38e46cca60fea6a2a.zip |
SUPERNOVA2: Add gamemanager skeleton
Diffstat (limited to 'engines/supernova2')
-rw-r--r-- | engines/supernova2/console.cpp | 37 | ||||
-rw-r--r-- | engines/supernova2/console.h | 49 | ||||
-rw-r--r-- | engines/supernova2/module.mk | 2 | ||||
-rw-r--r-- | engines/supernova2/state.cpp | 78 | ||||
-rw-r--r-- | engines/supernova2/state.h | 74 | ||||
-rw-r--r-- | engines/supernova2/supernova2.cpp | 15 | ||||
-rw-r--r-- | engines/supernova2/supernova2.h | 6 |
7 files changed, 255 insertions, 6 deletions
diff --git a/engines/supernova2/console.cpp b/engines/supernova2/console.cpp new file mode 100644 index 0000000000..d6e805fe1e --- /dev/null +++ b/engines/supernova2/console.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 "gui/debugger.h" + +#include "supernova2/supernova2.h" +#include "supernova2/state.h" +#include "supernova2/console.h" + +namespace Supernova2 { + +Console::Console(Supernova2Engine *vm, GameManager *gm) +{ + _vm = vm; + _gm = gm; +} + +} diff --git a/engines/supernova2/console.h b/engines/supernova2/console.h new file mode 100644 index 0000000000..fd7cfe0075 --- /dev/null +++ b/engines/supernova2/console.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 SUPERNOVA2_CONSOLE_H +#define SUPERNOVA2_CONSOLE_H + +#include "gui/debugger.h" + +namespace Supernova2 { + +class Supernova2Engine; +class GameManager; + +enum { + kDebugGeneral = 1 << 0 +}; + +class Console : public GUI::Debugger { +public: + Console(Supernova2::Supernova2Engine *vm, Supernova2::GameManager *gm); + virtual ~Console() {} + +private: + Supernova2Engine *_vm; + GameManager *_gm; +}; + +} + +#endif diff --git a/engines/supernova2/module.mk b/engines/supernova2/module.mk index c6ebe15d04..541008ee26 100644 --- a/engines/supernova2/module.mk +++ b/engines/supernova2/module.mk @@ -2,6 +2,8 @@ MODULE := engines/supernova2 MODULE_OBJS := \ detection.o \ + state.o \ + console.o \ supernova2.o MODULE_DIRS += \ diff --git a/engines/supernova2/state.cpp b/engines/supernova2/state.cpp new file mode 100644 index 0000000000..357a166ca7 --- /dev/null +++ b/engines/supernova2/state.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 "common/system.h" +#include "graphics/cursorman.h" +#include "graphics/palette.h" +#include "gui/message.h" + +//#include "supernova2/screen.h" +#include "supernova2/supernova2.h" +#include "supernova2/state.h" + +namespace Supernova2 { + + +//StringId GameManager::guiCommands[] = { +// kStringCommandGo, kStringCommandLook, kStringCommandTake, kStringCommandOpen, kStringCommandClose, +// kStringCommandPress, kStringCommandPull, kStringCommandUse, kStringCommandTalk, kStringCommandGive +//}; + +//StringId GameManager::guiStatusCommands[] = { +// kStringStatusCommandGo, kStringStatusCommandLook, kStringStatusCommandTake, kStringStatusCommandOpen, kStringStatusCommandClose, +// kStringStatusCommandPress, kStringStatusCommandPull, kStringStatusCommandUse, kStringStatusCommandTalk, kStringStatusCommandGive +//}; + +GameManager::GameManager(Supernova2Engine *vm) + : _vm(vm) + , _mouseClickType(Common::EVENT_INVALID) { + initState(); +} + +GameManager::~GameManager() { +} + +void GameManager::initState() { + _guiEnabled = true; + _animationEnabled = true; + _mouseClicked = false; + _keyPressed = false; + _mouseX = -1; + _mouseY = -1; + _inventoryScroll = 0; + _timerPaused = 0; + _timePaused = false; + _messageDuration = 0; + _animationTimer = 0; + + _currentSentence = -1; + for (int i = 0 ; i < 6 ; ++i) { + _sentenceNumber[i] = -1; +// _texts[i] = kNoString; + _rows[i] = 0; + _rowsStart[i] = 0; + } + + _prevImgId = 0; +} +} + diff --git a/engines/supernova2/state.h b/engines/supernova2/state.h new file mode 100644 index 0000000000..5c8cec4832 --- /dev/null +++ b/engines/supernova2/state.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 SUPERNOVA2_STATE_H +#define SUPERNOVA2_STATE_H + +#include "common/events.h" +#include "common/rect.h" +#include "common/keyboard.h" +//#include "supernova/rooms.h" +//#include "supernova/sound.h" + +namespace Supernova2 { + +const int32 kMaxTimerValue = 0x7FFFFFFF; + +struct GameState { +}; + +class GameManager { +public: + GameManager(Supernova2Engine *vm); + ~GameManager(); + + Supernova2Engine *_vm; + Common::KeyState _key; + Common::EventType _mouseClickType; + bool _mouseClicked; + bool _keyPressed; + int _mouseX; + int _mouseY; + GameState _state; + bool _guiEnabled; + bool _animationEnabled; + uint _timePaused; + bool _timerPaused; + int32 _messageDuration; + int32 _animationTimer; + int _inventoryScroll; + int _exitList[25]; + // Dialog + int _currentSentence; + int _sentenceNumber[6]; + byte _rows[6]; + byte _rowsStart[6]; + + void initState(); + +private: + int _prevImgId; +}; + +} + +#endif // SUPERNOVA_STATE_H diff --git a/engines/supernova2/supernova2.cpp b/engines/supernova2/supernova2.cpp index 3d57eeb3bf..5a2acfbaf9 100644 --- a/engines/supernova2/supernova2.cpp +++ b/engines/supernova2/supernova2.cpp @@ -40,15 +40,17 @@ #include "graphics/palette.h" #include "graphics/thumbnail.h" #include "gui/saveload.h" -#include <stdio.h> #include "supernova2/supernova2.h" +#include "supernova2/state.h" namespace Supernova2 { Supernova2Engine::Supernova2Engine(OSystem *syst) : Engine(syst) + , _console(nullptr) + , _gm(nullptr) , _allowLoadGame(true) , _allowSaveGame(true) , _sleepAutoSave(nullptr) @@ -64,22 +66,21 @@ Supernova2Engine::Supernova2Engine(OSystem *syst) Supernova2Engine::~Supernova2Engine() { DebugMan.clearAllDebugChannels(); + delete _console; + delete _gm; delete _sleepAutoSave; } Common::Error Supernova2Engine::run() { init(); - int i = 0; while (!shouldQuit()) { uint32 start = _system->getMillis(); - Common::String str = getGameString(i); - if (str == _nullString) - break; + _console->onFrame(); + _system->updateScreen(); int end = _delay - (_system->getMillis() - start); if (end > 0) _system->delayMillis(end); - i++; } return Common::kNoError; @@ -96,6 +97,8 @@ void Supernova2Engine::init() { if (status.getCode() != Common::kNoError) error("Failed reading game strings"); + _gm = new GameManager(this); + _console = new Console(this, _gm); setTotalPlayTime(0); } diff --git a/engines/supernova2/supernova2.h b/engines/supernova2/supernova2.h index ee721f5711..043c5cd4a5 100644 --- a/engines/supernova2/supernova2.h +++ b/engines/supernova2/supernova2.h @@ -30,6 +30,8 @@ #include "engines/engine.h" #include "common/file.h" +#include "supernova2/console.h" + namespace Common { class MemoryReadWriteStream; } @@ -43,6 +45,8 @@ namespace Supernova2 { #define SUPERNOVA2_DAT_VERSION 1 class GuiElement; +class console; +class GameManager; class Supernova2Engine : public Engine { public: @@ -52,6 +56,8 @@ public: virtual Common::Error run(); virtual bool hasFeature(EngineFeature f) const; + GameManager *_gm; + Console *_console; bool _allowLoadGame; bool _allowSaveGame; Common::StringArray _gameStrings; |