From bb48a153a6479e08fe37c3547e14622226efeeb2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 4 Aug 2014 21:35:49 -0400 Subject: ACCESS: Remove graphics manager, and added more skeleton for Amazon intro --- engines/access/access.cpp | 9 +------ engines/access/access.h | 6 ++--- engines/access/amazon/amazon_game.cpp | 39 +++++++++++++++++++++++++++ engines/access/amazon/amazon_game.h | 22 ++++++++++++++- engines/access/asurface.cpp | 33 +++++++++++++++++++++++ engines/access/asurface.h | 38 ++++++++++++++++++++++++++ engines/access/graphics.cpp | 42 ----------------------------- engines/access/graphics.h | 50 ----------------------------------- engines/access/module.mk | 2 +- engines/access/screen.cpp | 9 +++++++ engines/access/screen.h | 13 +++++++-- 11 files changed, 155 insertions(+), 108 deletions(-) create mode 100644 engines/access/asurface.cpp create mode 100644 engines/access/asurface.h delete mode 100644 engines/access/graphics.cpp delete mode 100644 engines/access/graphics.h (limited to 'engines') diff --git a/engines/access/access.cpp b/engines/access/access.cpp index 1470842e1b..af64612e01 100644 --- a/engines/access/access.cpp +++ b/engines/access/access.cpp @@ -34,7 +34,6 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc) _debugger = nullptr; _events = nullptr; _files = nullptr; - _graphics = nullptr; _screen = nullptr; _sound = nullptr; @@ -46,7 +45,6 @@ AccessEngine::~AccessEngine() { delete _debugger; delete _events; delete _files; - delete _graphics; delete _screen; delete _sound; @@ -68,7 +66,6 @@ void AccessEngine::initialize() { _debugger = new Debugger(this); _events = new EventsManager(this); _files = new FileManager(this); - _graphics = new GraphicsManager(this); _screen = new Screen(this); _sound = new SoundManager(this, _mixer); @@ -80,11 +77,7 @@ Common::Error AccessEngine::run() { setVGA(); initialize(); - _screen->setInitialPalettte(); - _events->setCursor(CURSOR_0); - _events->showCursor(); - _graphics->setPanel(0); - doTitle(); + playGame(); dummyLoop(); return Common::kNoError; diff --git a/engines/access/access.h b/engines/access/access.h index 05ef545e38..f6d51cc744 100644 --- a/engines/access/access.h +++ b/engines/access/access.h @@ -33,7 +33,6 @@ #include "access/debugger.h" #include "access/events.h" #include "access/files.h" -#include "access/graphics.h" #include "access/screen.h" #include "access/sound.h" @@ -87,14 +86,13 @@ protected: virtual bool hasFeature(EngineFeature f) const; protected: /** - * Show game title + * Play the game */ - virtual void doTitle() = 0; + virtual void playGame() = 0; public: Debugger *_debugger; EventsManager *_events; FileManager *_files; - GraphicsManager *_graphics; Screen *_screen; SoundManager *_sound; diff --git a/engines/access/amazon/amazon_game.cpp b/engines/access/amazon/amazon_game.cpp index 30733087dd..681819f602 100644 --- a/engines/access/amazon/amazon_game.cpp +++ b/engines/access/amazon/amazon_game.cpp @@ -28,11 +28,41 @@ namespace Amazon { AmazonEngine::AmazonEngine(OSystem *syst, const AccessGameDescription *gameDesc) : AccessEngine(syst, gameDesc) { + _skipStart = false; } AmazonEngine::~AmazonEngine() { } +void AmazonEngine::playGame() { + _screen->setInitialPalettte(); + _events->setCursor(CURSOR_0); + _events->showCursor(); + _screen->setPanel(0); + + doTitle(); + if (shouldQuit()) + return; + + if (!_skipStart) { + _screen->setPanel(3); + doOpening(); + if (shouldQuit()) + return; + + if (!_skipStart) { + doTent(); + if (shouldQuit()) + return; + } + } + + doTitle(); + if (shouldQuit()) + return; + + _screen->clearScreen(); +} void AmazonEngine::doTitle() { _screen->setDisplayScan(); @@ -70,6 +100,15 @@ void AmazonEngine::doTitle() { int xp = READ_LE_UINT16(COUNTDOWN + _pCount * 4 + 2); _screen->plotImage(_objectsTable, id, Common::Point(xp, 71)); } + // TODO: More to do +} + +void AmazonEngine::doOpening() { + // TODO +} + +void AmazonEngine::doTent() { + // TODO } } // End of namespace Amazon diff --git a/engines/access/amazon/amazon_game.h b/engines/access/amazon/amazon_game.h index 33d7833670..79a74b329f 100644 --- a/engines/access/amazon/amazon_game.h +++ b/engines/access/amazon/amazon_game.h @@ -30,8 +30,28 @@ namespace Access { namespace Amazon { class AmazonEngine : public AccessEngine { +private: + bool _skipStart; + + /** + * Do title sequence + */ + void doTitle(); + + /** + * Do opening sequence + */ + void doOpening(); + + /** + * Do tent scene of introduction + */ + void doTent(); protected: - virtual void doTitle(); + /** + * Play the game + */ + virtual void playGame(); public: AmazonEngine(OSystem *syst, const AccessGameDescription *gameDesc); diff --git a/engines/access/asurface.cpp b/engines/access/asurface.cpp new file mode 100644 index 0000000000..a0a790dbdc --- /dev/null +++ b/engines/access/asurface.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 "common/algorithm.h" +#include "access/asurface.h" + +namespace Access { + +void ASurface::clearBuffer() { + byte *pSrc = (byte *)getPixels(); + Common::fill(pSrc, pSrc + w * h, 0); +} + +} // End of namespace Access diff --git a/engines/access/asurface.h b/engines/access/asurface.h new file mode 100644 index 0000000000..ecd04b9682 --- /dev/null +++ b/engines/access/asurface.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 ACCESS_ASURFACE_H +#define ACCESS_ASURFACE_H + +#include "common/rect.h" +#include "graphics/surface.h" + +namespace Access { + +class ASurface : public Graphics::Surface { +public: + void clearBuffer(); +}; + +} // End of namespace Access + +#endif /* ACCESS_ASURFACE_H */ diff --git a/engines/access/graphics.cpp b/engines/access/graphics.cpp deleted file mode 100644 index c1187f2eb3..0000000000 --- a/engines/access/graphics.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 "graphics/palette.h" -#include "access/access.h" -#include "access/graphics.h" -#include "access/resources.h" - -namespace Access { - -GraphicsManager::GraphicsManager(AccessEngine *vm) : _vm(vm) { - _vesaCurrentWin = 0; - _currentPanel = 0; - _hideFlag = true; -} - -void GraphicsManager::setPanel(int num) { - assert(num < 4); - _currentPanel = num; - _msVirtualOffset = _virtualOffsetsTable[num]; -} - -} // End of namespace Access diff --git a/engines/access/graphics.h b/engines/access/graphics.h deleted file mode 100644 index df626176fa..0000000000 --- a/engines/access/graphics.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 ACCESS_GRAPHICS_H -#define ACCESS_GRAPHICS_H - -#include "common/rect.h" -#include "graphics/surface.h" - -namespace Access { - -class AccessEngine; - -class GraphicsManager { -private: - AccessEngine *_vm; -public: - int _vesaCurrentWin; - int _currentPanel; - Common::Point _msVirtualOffset; - Common::Point _virtualOffsetsTable[4]; - bool _hideFlag; -public: - GraphicsManager(AccessEngine *vm); - - void setPanel(int num); -}; - -} // End of namespace Access - -#endif /* ACCESS_GRAPHICS_H */ diff --git a/engines/access/module.mk b/engines/access/module.mk index c9d593de22..ff4cedbdc6 100644 --- a/engines/access/module.mk +++ b/engines/access/module.mk @@ -1,13 +1,13 @@ MODULE := engines/access MODULE_OBJS := \ + asurface.o \ access.o \ debugger.o \ decompress.o \ detection.o \ events.o \ files.o \ - graphics.o \ resources.o \ screen.o \ sound.o \ diff --git a/engines/access/screen.cpp b/engines/access/screen.cpp index cb0154d56e..591bb67a7f 100644 --- a/engines/access/screen.cpp +++ b/engines/access/screen.cpp @@ -34,6 +34,9 @@ namespace Access { Screen::Screen(AccessEngine *vm) : _vm(vm) { create(320, 200, Graphics::PixelFormat::createFormatCLUT8()); Common::fill(&_tempPalette[0], &_tempPalette[PALETTE_SIZE], 0); + _vesaCurrentWin = 0; + _currentPanel = 0; + _hideFlag = true; _loadPalFlag = false; _leftSkip = _rightSkip = 0; _topSkip = _bottomSkip = 0; @@ -44,6 +47,12 @@ void Screen::setDisplayScan() { warning("TODO: setDisplayScan"); } +void Screen::setPanel(int num) { + assert(num < 4); + _currentPanel = num; + _msVirtualOffset = _virtualOffsetsTable[num]; +} + void Screen::updateScreen() { g_system->updateScreen(); } diff --git a/engines/access/screen.h b/engines/access/screen.h index 0d68c1bc7e..295372770a 100644 --- a/engines/access/screen.h +++ b/engines/access/screen.h @@ -26,7 +26,7 @@ #include "common/scummsys.h" #include "common/rect.h" #include "common/stream.h" -#include "graphics/surface.h" +#include "access/asurface.h" namespace Access { @@ -35,11 +35,16 @@ class AccessEngine; #define PALETTE_COUNT 256 #define PALETTE_SIZE (256 * 3) -class Screen: public Graphics::Surface { +class Screen: public ASurface { private: AccessEngine *_vm; byte _tempPalette[PALETTE_SIZE]; byte _rawPalette[PALETTE_SIZE]; + int _vesaCurrentWin; + int _currentPanel; + Common::Point _msVirtualOffset; + Common::Point _virtualOffsetsTable[4]; + bool _hideFlag; Common::Rect _lastBounds; int _leftSkip, _rightSkip; int _topSkip, _bottomSkip; @@ -57,6 +62,8 @@ public: void setDisplayScan(); + void setPanel(int num); + /** * Update the underlying screen */ @@ -72,6 +79,8 @@ public: */ void forceFadeIn(); + void clearScreen() { clearBuffer(); } + /** * Set the initial palette */ -- cgit v1.2.3