From b29fd4dacd54e672ffa52179dd02e0367ef14707 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Sat, 31 Oct 2009 19:48:28 +0000 Subject: SCI/newgui: SciGuiPortrait created svn-id: r45579 --- engines/sci/engine/kgraphics.cpp | 20 +++++++--------- engines/sci/gui/gui.cpp | 10 ++++++++ engines/sci/gui/gui.h | 4 ++++ engines/sci/gui/gui_portrait.cpp | 51 ++++++++++++++++++++++++++++++++++++++++ engines/sci/gui/gui_portrait.h | 49 ++++++++++++++++++++++++++++++++++++++ engines/sci/module.mk | 1 + 6 files changed, 123 insertions(+), 12 deletions(-) create mode 100644 engines/sci/gui/gui_portrait.cpp create mode 100644 engines/sci/gui/gui_portrait.h (limited to 'engines') diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index e3fc3ac947..414d6f160a 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -640,21 +640,19 @@ reg_t kPortrait(EngineState *s, int argc, reg_t *argv) { uint16 operation = argv[0].toUint16(); switch (operation) { - case 0: { // load resource (the corresponding .BIN file from the ACTORS directory) + case 0: { // load if (argc == 2) { Common::String resourceName = s->_segMan->getString(argv[1]); - - // TODO: implement this - + return s->_gui->portraitLoad(resourceName); } else { warning("kPortrait(loadResource) called with unsupported argc %d", argc); } break; } - case 1: { // show portrait + case 1: { // show if (argc == 10) { Common::String resourceName = s->_segMan->getString(argv[1]); - Common::Point portraitPos = Common::Point(argv[2].toUint16(), argv[3].toUint16()); + Common::Point position = Common::Point(argv[2].toUint16(), argv[3].toUint16()); /*uint resourceNum = argv[4].toUint16() & 0xff; uint noun = argv[5].toUint16() & 0xff; uint verb = argv[6].toUint16() & 0xff; @@ -662,20 +660,18 @@ reg_t kPortrait(EngineState *s, int argc, reg_t *argv) { uint seq = argv[8].toUint16() & 0xff;*/ // argv[9] is usually 0??!! + s->_gui->portraitShow(resourceName, position, resourceNum, noun, verb, cond, seq); + return SIGNAL_REG; // TODO: implement this. Looks to be a modified version of kDoSync - - warning("kPortrait(show) %s at %d, %d", resourceName.c_str(), portraitPos.x, portraitPos.y); } else { warning("kPortrait(show) called with unsupported argc %d", argc); } break; } - case 2: { // unload resource + case 2: { // unload if (argc == 2) { //uint16 portraitId = argv[1].toUint16(); - - // TODO: implement this - + s->_gui->portraitUnload(portraitId); } else { warning("kPortrait(unload) called with unsupported argc %d", argc); } diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp index cb53af873a..d2794b34b9 100644 --- a/engines/sci/gui/gui.cpp +++ b/engines/sci/gui/gui.cpp @@ -747,6 +747,16 @@ int16 SciGui::getCelCount(GuiResourceId viewId, int16 loopNo) { return _gfx->getView(viewId)->getLoopInfo(loopNo)->celCount; } +reg_t SciGui::portraitLoad(Common::String resourceName) { + return NULL_REG; +} + +void SciGui::portraitShow(Common::String resourceName, Common::Point position, uint16 resourceNum, uint16 noun, uint16 verb, uint16 cond, uint16 seq) { +} + +void SciGui::portraitUnload(uint16 portraitId) { +} + bool SciGui::debugUndither(bool flag) { _screen->unditherSetState(flag); return false; diff --git a/engines/sci/gui/gui.h b/engines/sci/gui/gui.h index 9088848458..56b5e2fd7c 100644 --- a/engines/sci/gui/gui.h +++ b/engines/sci/gui/gui.h @@ -134,6 +134,10 @@ public: virtual int16 getLoopCount(GuiResourceId viewId); virtual int16 getCelCount(GuiResourceId viewId, int16 loopNo); + virtual reg_t portraitLoad(Common::String resourceName); + virtual void portraitShow(Common::String resourceName, Common::Point position, uint16 resourceNum, uint16 noun, uint16 verb, uint16 cond, uint16 seq); + virtual void portraitUnload(uint16 portraitId); + virtual bool debugUndither(bool flag); virtual bool debugShowMap(int mapNo); diff --git a/engines/sci/gui/gui_portrait.cpp b/engines/sci/gui/gui_portrait.cpp new file mode 100644 index 0000000000..df45f4dd19 --- /dev/null +++ b/engines/sci/gui/gui_portrait.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. + * + * $URL$ + * $Id$ + * + */ + +#include "common/util.h" +#include "common/stack.h" +#include "graphics/primitives.h" + +#include "sci/sci.h" +#include "sci/engine/state.h" +#include "sci/gui/gui_screen.h" +#include "sci/gui/gui_palette.h" +#include "sci/gui/gui_portrait.h" + +namespace Sci { + +SciGuiPortrait::SciGuiPortrait(ResourceManager *resMan, SciGuiScreen *screen, SciGuiPalette *palette, Common::String resourceName) + : _resMan(resMan), _screen(screen), _palette(palette), _resourceName(resourceName) { + init(); +} + +SciGuiPortrait::~SciGuiPortrait() { +} + +void SciGuiPortrait::init() { + // .BIN files are loaded from actors directory and from .\ directory + // seem to have 98 byte header +} + +} // End of namespace Sci diff --git a/engines/sci/gui/gui_portrait.h b/engines/sci/gui/gui_portrait.h new file mode 100644 index 0000000000..3305c53f93 --- /dev/null +++ b/engines/sci/gui/gui_portrait.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. + * + * $URL$ + * $Id$ + * + */ + +#ifndef SCI_GUI_PORTRAITS_H +#define SCI_GUI_PORTRAITS_H + +namespace Sci { + +class SciGuiPortrait { +public: + SciGuiPortrait(ResourceManager *resMan, SciGuiScreen *screen, SciGuiPalette *palette, Common::String resourceName); + ~SciGuiPortrait(); + +private: + void init(void); + + ResourceManager *_resMan; + SciGuiScreen *_screen; + SciGuiPalette *_palette; + + Common::String _resourceName; + byte *_resourceData; +}; + +} // End of namespace Sci + +#endif diff --git a/engines/sci/module.mk b/engines/sci/module.mk index 2335b4b60f..8b05ed3709 100644 --- a/engines/sci/module.mk +++ b/engines/sci/module.mk @@ -54,6 +54,7 @@ MODULE_OBJS := \ gui/gui_gfx.o \ gui/gui_palette.o \ gui/gui_picture.o \ + gui/gui_portrait.o \ gui/gui_screen.o \ gui/gui_text.o \ gui/gui_transitions.o \ -- cgit v1.2.3