diff options
author | Martin Kiewitz | 2010-02-04 19:22:40 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-02-04 19:22:40 +0000 |
commit | 3ce2e229786f1ce81935883ed934d14fbc3444f7 (patch) | |
tree | 599c1b816d48c2cad73cb5b4accb150de4c0e6cc /engines | |
parent | 5dc8f75b68a95e4c6f69921c29d773e902022708 (diff) | |
download | scummvm-rg350-3ce2e229786f1ce81935883ed934d14fbc3444f7.tar.gz scummvm-rg350-3ce2e229786f1ce81935883ed934d14fbc3444f7.tar.bz2 scummvm-rg350-3ce2e229786f1ce81935883ed934d14fbc3444f7.zip |
SCI: adding GfxPaint class, implementing kernelDrawPicture for GfxPaint16 and GfxPaint32, using those classes directly when drawing pictures instead of SciGui/32. Making draw_pic command work in sci32 that way, using _gfxPaint16 for kDrawPic because that command is sci16 exclusive
svn-id: r47883
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/console.cpp | 3 | ||||
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 3 | ||||
-rw-r--r-- | engines/sci/engine/state.h | 5 | ||||
-rw-r--r-- | engines/sci/graphics/gui.cpp | 19 | ||||
-rw-r--r-- | engines/sci/graphics/gui.h | 1 | ||||
-rw-r--r-- | engines/sci/graphics/gui32.cpp | 1 | ||||
-rw-r--r-- | engines/sci/graphics/paint.cpp | 46 | ||||
-rw-r--r-- | engines/sci/graphics/paint.h | 47 | ||||
-rw-r--r-- | engines/sci/graphics/paint16.cpp | 20 | ||||
-rw-r--r-- | engines/sci/graphics/paint16.h | 8 | ||||
-rw-r--r-- | engines/sci/graphics/paint32.cpp | 7 | ||||
-rw-r--r-- | engines/sci/graphics/paint32.h | 5 | ||||
-rw-r--r-- | engines/sci/module.mk | 1 |
13 files changed, 142 insertions, 24 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 3348ed4973..5de034eb4f 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -46,6 +46,7 @@ #include "sci/graphics/gui32.h" #include "sci/graphics/cursor.h" #include "sci/graphics/screen.h" +#include "sci/graphics/paint.h" #include "sci/graphics/palette.h" #include "sci/parser/vocabulary.h" @@ -1075,7 +1076,7 @@ bool Console::cmdDrawPic(int argc, const char **argv) { uint16 resourceId = atoi(argv[1]); - _engine->_gamestate->_gui->drawPicture(resourceId, 100, false, false, false, 0); + _engine->_gamestate->_gfxPaint->kernelDrawPicture(resourceId, 100, false, false, false, 0); _engine->_gamestate->_gfxScreen->copyToScreen(); return true; } diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 762b786a79..2660a50b32 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -41,6 +41,7 @@ #include "sci/graphics/controls.h" #include "sci/graphics/cursor.h" #include "sci/graphics/palette.h" +#include "sci/graphics/paint16.h" #include "sci/graphics/ports.h" #include "sci/graphics/screen.h" #include "sci/graphics/view.h" @@ -559,7 +560,7 @@ reg_t kDrawPic(EngineState *s, int argc, reg_t *argv) { if (argc >= 4) EGApaletteNo = argv[3].toUint16(); - s->_gui->drawPicture(pictureId, animationNr, animationBlackoutFlag, mirroredFlag, addToFlag, EGApaletteNo); + s->_gfxPaint16->kernelDrawPicture(pictureId, animationNr, animationBlackoutFlag, mirroredFlag, addToFlag, EGApaletteNo); return s->r_acc; } diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h index fb39e7d4ca..abf8af4970 100644 --- a/engines/sci/engine/state.h +++ b/engines/sci/engine/state.h @@ -55,6 +55,9 @@ class GfxAnimate; class GfxCache; class GfxControls; class GfxMenu; +class GfxPaint; +class GfxPaint16; +class GfxPaint32; class GfxPalette; class GfxPorts; class GfxScreen; @@ -152,6 +155,8 @@ public: GfxControls *_gfxControls; // Controls for 16-bit gfx GfxMenu *_gfxMenu; // Menu for 16-bit gfx GfxPalette *_gfxPalette; + GfxPaint *_gfxPaint; + GfxPaint16 *_gfxPaint16; // Painting in 16-bit gfx GfxPorts *_gfxPorts; // Port managment for 16-bit gfx GfxScreen *_gfxScreen; SciGui *_gui; /* Currently active Gui */ diff --git a/engines/sci/graphics/gui.cpp b/engines/sci/graphics/gui.cpp index 937f0d8371..16a72df148 100644 --- a/engines/sci/graphics/gui.cpp +++ b/engines/sci/graphics/gui.cpp @@ -54,8 +54,10 @@ SciGui::SciGui(EngineState *state, GfxScreen *screen, GfxPalette *palette, GfxCa : _s(state), _screen(screen), _palette(palette), _cache(cache), _cursor(cursor), _ports(ports), _audio(audio) { _compare = new GfxCompare(_s->_segMan, _s->_kernel, _cache, _screen); - _paint16 = new GfxPaint16(_s->resMan, _s->_segMan, _s->_kernel, _cache, _ports, _screen, _palette); _transitions = new Transitions(this, _screen, _palette, _s->resMan->isVGA()); + _paint16 = new GfxPaint16(_s->resMan, _s->_segMan, _s->_kernel, _cache, _ports, _screen, _palette, _transitions); + _s->_gfxPaint = _paint16; + _s->_gfxPaint16 = _paint16; _animate = new GfxAnimate(_s, _cache, _ports, _paint16, _screen, _palette, _cursor, _transitions); _s->_gfxAnimate = _animate; _text16 = new GfxText16(_s->resMan, _cache, _ports, _paint16, _screen); @@ -276,21 +278,6 @@ void SciGui::drawMenuBar(bool clear) { } } -void SciGui::drawPicture(GuiResourceId pictureId, int16 animationNr, bool animationBlackoutFlag, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo) { - Port *oldPort = _ports->setPort((Port *)_ports->_picWind); - - if (_ports->isFrontWindow(_ports->_picWind)) { - _screen->_picNotValid = 1; - _paint16->drawPicture(pictureId, animationNr, mirroredFlag, addToFlag, EGApaletteNo); - _transitions->setup(animationNr, animationBlackoutFlag); - } else { - _ports->beginUpdate(_ports->_picWind); - _paint16->drawPicture(pictureId, animationNr, mirroredFlag, addToFlag, EGApaletteNo); - _ports->endUpdate(_ports->_picWind); - } - _ports->setPort(oldPort); -} - void SciGui::drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, bool hiresMode, reg_t upscaledHiresHandle) { // some calls are hiresMode even under kq6 DOS, that's why we check for upscaled hires here if ((!hiresMode) || (!_screen->getUpscaledHires())) { diff --git a/engines/sci/graphics/gui.h b/engines/sci/graphics/gui.h index 35caf41457..a996da5d74 100644 --- a/engines/sci/graphics/gui.h +++ b/engines/sci/graphics/gui.h @@ -76,7 +76,6 @@ public: virtual void drawStatus(const char *text, int16 colorPen, int16 colorBack); virtual void drawMenuBar(bool clear); - virtual void drawPicture(GuiResourceId pictureId, int16 animationNr, bool animationBlackoutFlag, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo); virtual void drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo, bool hiresMode = false, reg_t upscaledHiresHandle = NULL_REG); virtual void graphFillBoxForeground(Common::Rect rect); diff --git a/engines/sci/graphics/gui32.cpp b/engines/sci/graphics/gui32.cpp index 4dbab6d722..19e5031ed9 100644 --- a/engines/sci/graphics/gui32.cpp +++ b/engines/sci/graphics/gui32.cpp @@ -50,6 +50,7 @@ SciGui32::SciGui32(EngineState *state, GfxScreen *screen, GfxPalette *palette, G _compare = new GfxCompare(_s->_segMan, _s->_kernel, _cache, _screen); _paint32 = new GfxPaint32(_s->resMan, _s->_segMan, _s->_kernel, _cache, _screen, _palette); + _s->_gfxPaint = _paint32; _frameout = new GfxFrameout(_s->_segMan, _s->resMan, _cache, _screen, _palette, _paint32); } diff --git a/engines/sci/graphics/paint.cpp b/engines/sci/graphics/paint.cpp new file mode 100644 index 0000000000..40b3ad429a --- /dev/null +++ b/engines/sci/graphics/paint.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. + * + * $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/engine/selector.h" +#include "sci/graphics/paint.h" + +namespace Sci { + +GfxPaint::GfxPaint() { +} + +GfxPaint::~GfxPaint() { +} + +void GfxPaint::kernelDrawPicture(GuiResourceId pictureId, int16 animationNr, bool animationBlackoutFlag, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo) { +} + +} // End of namespace Sci diff --git a/engines/sci/graphics/paint.h b/engines/sci/graphics/paint.h new file mode 100644 index 0000000000..1e4ad9fa8e --- /dev/null +++ b/engines/sci/graphics/paint.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. + * + * $URL$ + * $Id$ + * + */ + +#ifndef SCI_GRAPHICS_PAINT_H +#define SCI_GRAPHICS_PAINT_H + +#include "sci/graphics/gui.h" + +#include "common/hashmap.h" + +namespace Sci { + +class GfxPaint { +public: + GfxPaint(); + virtual ~GfxPaint(); + + virtual void kernelDrawPicture(GuiResourceId pictureId, int16 animationNr, bool animationBlackoutFlag, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo); + +private: +}; + +} // End of namespace Sci + +#endif diff --git a/engines/sci/graphics/paint16.cpp b/engines/sci/graphics/paint16.cpp index ca9d0214da..36040500de 100644 --- a/engines/sci/graphics/paint16.cpp +++ b/engines/sci/graphics/paint16.cpp @@ -40,11 +40,12 @@ #include "sci/graphics/screen.h" #include "sci/graphics/palette.h" #include "sci/graphics/text16.h" +#include "sci/graphics/transitions.h" namespace Sci { -GfxPaint16::GfxPaint16(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, GfxCache *cache, GfxPorts *ports, GfxScreen *screen, GfxPalette *palette) - : _resMan(resMan), _segMan(segMan), _kernel(kernel), _cache(cache), _ports(ports), _screen(screen), _palette(palette) { +GfxPaint16::GfxPaint16(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, GfxCache *cache, GfxPorts *ports, GfxScreen *screen, GfxPalette *palette, Transitions *transitions) + : _resMan(resMan), _segMan(segMan), _kernel(kernel), _cache(cache), _ports(ports), _screen(screen), _palette(palette), _transitions(transitions) { } GfxPaint16::~GfxPaint16() { @@ -330,4 +331,19 @@ void GfxPaint16::bitsFree(reg_t memoryHandle) { } } +void GfxPaint16::kernelDrawPicture(GuiResourceId pictureId, int16 animationNr, bool animationBlackoutFlag, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo) { + Port *oldPort = _ports->setPort((Port *)_ports->_picWind); + + if (_ports->isFrontWindow(_ports->_picWind)) { + _screen->_picNotValid = 1; + drawPicture(pictureId, animationNr, mirroredFlag, addToFlag, EGApaletteNo); + _transitions->setup(animationNr, animationBlackoutFlag); + } else { + _ports->beginUpdate(_ports->_picWind); + drawPicture(pictureId, animationNr, mirroredFlag, addToFlag, EGApaletteNo); + _ports->endUpdate(_ports->_picWind); + } + _ports->setPort(oldPort); +} + } // End of namespace Sci diff --git a/engines/sci/graphics/paint16.h b/engines/sci/graphics/paint16.h index 8d2b965219..e3a7989177 100644 --- a/engines/sci/graphics/paint16.h +++ b/engines/sci/graphics/paint16.h @@ -27,6 +27,7 @@ #define SCI_GRAPHICS_PAINT16_H #include "sci/graphics/gui.h" +#include "sci/graphics/paint.h" #include "common/hashmap.h" @@ -39,9 +40,9 @@ class Font; class SciGuiPicture; class View; -class GfxPaint16 { +class GfxPaint16 : public GfxPaint { public: - GfxPaint16(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, GfxCache *cache, GfxPorts *ports, GfxScreen *screen, GfxPalette *palette); + GfxPaint16(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, GfxCache *cache, GfxPorts *ports, GfxScreen *screen, GfxPalette *palette, Transitions *transitions); ~GfxPaint16(); void init(GfxText16 *text16); @@ -68,6 +69,8 @@ public: void bitsRestore(reg_t memoryHandle); void bitsFree(reg_t memoryHandle); + void kernelDrawPicture(GuiResourceId pictureId, int16 animationNr, bool animationBlackoutFlag, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo); + private: ResourceManager *_resMan; SegManager *_segMan; @@ -77,6 +80,7 @@ private: GfxScreen *_screen; GfxPalette *_palette; GfxText16 *_text16; + Transitions *_transitions; // true means make EGA picture drawing visible bool _EGAdrawingVisualize; diff --git a/engines/sci/graphics/paint32.cpp b/engines/sci/graphics/paint32.cpp index 78f0302f45..1f318319f3 100644 --- a/engines/sci/graphics/paint32.cpp +++ b/engines/sci/graphics/paint32.cpp @@ -56,4 +56,11 @@ void GfxPaint32::fillRect(Common::Rect rect, byte color) { } } +void GfxPaint32::kernelDrawPicture(GuiResourceId pictureId, int16 animationNr, bool animationBlackoutFlag, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo) { + SciGuiPicture *picture = new SciGuiPicture(_resMan, 0, _screen, _palette, pictureId, false); + + picture->draw(animationNr, mirroredFlag, addToFlag, EGApaletteNo); + delete picture; +} + } // End of namespace Sci diff --git a/engines/sci/graphics/paint32.h b/engines/sci/graphics/paint32.h index 7ee9eacf72..8b675d0cf7 100644 --- a/engines/sci/graphics/paint32.h +++ b/engines/sci/graphics/paint32.h @@ -27,6 +27,7 @@ #define SCI_GRAPHICS_PAINT32_H #include "sci/graphics/gui.h" +#include "sci/graphics/paint.h" #include "common/hashmap.h" @@ -34,13 +35,15 @@ namespace Sci { class GfxPorts; -class GfxPaint32 { +class GfxPaint32 : public GfxPaint { public: GfxPaint32(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, GfxCache *cache, GfxScreen *screen, GfxPalette *palette); ~GfxPaint32(); void fillRect(Common::Rect rect, byte color); + void kernelDrawPicture(GuiResourceId pictureId, int16 animationNr, bool animationBlackoutFlag, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo); + private: ResourceManager *_resMan; SegManager *_segMan; diff --git a/engines/sci/module.mk b/engines/sci/module.mk index ad664f810e..f09e8a8eeb 100644 --- a/engines/sci/module.mk +++ b/engines/sci/module.mk @@ -42,6 +42,7 @@ MODULE_OBJS := \ graphics/font.o \ graphics/gui.o \ graphics/menu.o \ + graphics/paint.o \ graphics/paint16.o \ graphics/palette.o \ graphics/picture.o \ |