From 6664d26db791866d231e40da1da49a7c5a9ee2fc Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Thu, 4 Feb 2010 17:57:44 +0000 Subject: SCI: adding GfxPaint32 class, adding back support for planes, minor change in GfxPaint16 (using #def instead of fixed value) svn-id: r47880 --- engines/sci/graphics/frameout.cpp | 23 +++++++++------ engines/sci/graphics/frameout.h | 6 ++-- engines/sci/graphics/gui32.cpp | 4 ++- engines/sci/graphics/gui32.h | 2 ++ engines/sci/graphics/paint16.cpp | 6 ++-- engines/sci/graphics/paint32.cpp | 59 +++++++++++++++++++++++++++++++++++++++ engines/sci/graphics/paint32.h | 55 ++++++++++++++++++++++++++++++++++++ engines/sci/module.mk | 1 + 8 files changed, 141 insertions(+), 15 deletions(-) create mode 100644 engines/sci/graphics/paint32.cpp create mode 100644 engines/sci/graphics/paint32.h (limited to 'engines') diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index 04a247bec9..01d089aaad 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -35,13 +35,14 @@ #include "sci/graphics/font.h" #include "sci/graphics/view.h" #include "sci/graphics/screen.h" +#include "sci/graphics/paint32.h" #include "sci/graphics/picture.h" #include "sci/graphics/frameout.h" namespace Sci { -GfxFrameout::GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxCache *cache, GfxScreen *screen, GfxPalette *palette) - : _segMan(segMan), _resMan(resMan), _cache(cache), _screen(screen), _palette(palette) { +GfxFrameout::GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxCache *cache, GfxScreen *screen, GfxPalette *palette, GfxPaint32 *paint32) + : _segMan(segMan), _resMan(resMan), _cache(cache), _screen(screen), _palette(palette), _paint32(paint32) { } GfxFrameout::~GfxFrameout() { @@ -107,6 +108,7 @@ void GfxFrameout::kernelFrameout() { int16 planePriority; Common::Rect planeRect; int16 planeResY, planeResX; + byte planeBack; reg_t itemObject; reg_t itemPlane; @@ -125,12 +127,6 @@ void GfxFrameout::kernelFrameout() { if (planePriority == -1) // Plane currently not meant to be shown continue; - planePictureNr = GET_SEL32V(_segMan, planeObject, picture); - if ((planePictureNr != 0xFFFF) && (planePictureNr != 0xFFFE)) { - planePicture = new SciGuiPicture(_resMan, 0, _screen, _palette, planePictureNr, false); - planePictureCels = planePicture->getSci32celCount(); - } - planeRect.top = GET_SEL32V(_segMan, planeObject, top); planeRect.left = GET_SEL32V(_segMan, planeObject, left); planeRect.bottom = GET_SEL32V(_segMan, planeObject, bottom); @@ -143,6 +139,17 @@ void GfxFrameout::kernelFrameout() { planeRect.bottom = (planeRect.bottom * _screen->getHeight()) / planeResY; planeRect.right = (planeRect.right * _screen->getWidth()) / planeResX; + planeBack = GET_SEL32V(_segMan, planeObject, back); + if (planeBack) { + _paint32->fillRect(planeRect, planeBack); + } + + planePictureNr = GET_SEL32V(_segMan, planeObject, picture); + if ((planePictureNr != 0xFFFF) && (planePictureNr != 0xFFFE)) { + planePicture = new SciGuiPicture(_resMan, 0, _screen, _palette, planePictureNr, false); + planePictureCels = planePicture->getSci32celCount(); + } + // Fill our itemlist for this plane itemCount = 0; itemEntry = itemData; diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h index ce2e9bcf19..34dfc26545 100644 --- a/engines/sci/graphics/frameout.h +++ b/engines/sci/graphics/frameout.h @@ -44,11 +44,10 @@ struct FrameoutEntry { typedef Common::List FrameoutList; class GfxCache; -class Screen; -class SciPalette; +class GfxPaint32; class GfxFrameout { public: - GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxCache *cache, GfxScreen *screen, GfxPalette *palette); + GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxCache *cache, GfxScreen *screen, GfxPalette *palette, GfxPaint32 *paint32); ~GfxFrameout(); void kernelAddPlane(reg_t object); @@ -65,6 +64,7 @@ private: GfxCache *_cache; GfxPalette *_palette; GfxScreen *_screen; + GfxPaint32 *_paint32; Common::Array _screenItems; Common::Array _planes; diff --git a/engines/sci/graphics/gui32.cpp b/engines/sci/graphics/gui32.cpp index f06f783853..4dbab6d722 100644 --- a/engines/sci/graphics/gui32.cpp +++ b/engines/sci/graphics/gui32.cpp @@ -38,6 +38,7 @@ #include "sci/graphics/cache.h" #include "sci/graphics/compare.h" #include "sci/graphics/frameout.h" +#include "sci/graphics/paint32.h" #include "sci/graphics/picture.h" #include "sci/graphics/robot.h" #include "sci/graphics/view.h" @@ -48,7 +49,8 @@ SciGui32::SciGui32(EngineState *state, GfxScreen *screen, GfxPalette *palette, G : _s(state), _screen(screen), _palette(palette), _cache(cache), _cursor(cursor) { _compare = new GfxCompare(_s->_segMan, _s->_kernel, _cache, _screen); - _frameout = new GfxFrameout(_s->_segMan, _s->resMan, _cache, _screen, _palette); + _paint32 = new GfxPaint32(_s->resMan, _s->_segMan, _s->_kernel, _cache, _screen, _palette); + _frameout = new GfxFrameout(_s->_segMan, _s->resMan, _cache, _screen, _palette, _paint32); } SciGui32::~SciGui32() { diff --git a/engines/sci/graphics/gui32.h b/engines/sci/graphics/gui32.h index a6f32618a9..c635646efa 100644 --- a/engines/sci/graphics/gui32.h +++ b/engines/sci/graphics/gui32.h @@ -36,6 +36,7 @@ class GfxPalette; class GfxCache; class GfxCompare; class GfxFrameout; +class GfxPaint32; class SciGui32 { public: @@ -89,6 +90,7 @@ protected: GfxCache *_cache; GfxCompare *_compare; GfxFrameout *_frameout; + GfxPaint32 *_paint32; private: }; diff --git a/engines/sci/graphics/paint16.cpp b/engines/sci/graphics/paint16.cpp index 4ef1682a32..ca9d0214da 100644 --- a/engines/sci/graphics/paint16.cpp +++ b/engines/sci/graphics/paint16.cpp @@ -204,16 +204,16 @@ void GfxPaint16::fillRect(const Common::Rect &rect, int16 drawFlags, byte clrPen for (x = r.left; x < r.right; x++) { curVisual = _screen->getVisual(x, y); if (curVisual == clrPen) { - _screen->putPixel(x, y, 1, clrBack, 0, 0); + _screen->putPixel(x, y, SCI_SCREEN_MASK_VISUAL, clrBack, 0, 0); } else if (curVisual == clrBack) { - _screen->putPixel(x, y, 1, clrPen, 0, 0); + _screen->putPixel(x, y, SCI_SCREEN_MASK_VISUAL, clrPen, 0, 0); } } } } else { // just fill rect with ClrPen for (y = r.top; y < r.bottom; y++) { for (x = r.left; x < r.right; x++) { - _screen->putPixel(x, y, 1, clrPen, 0, 0); + _screen->putPixel(x, y, SCI_SCREEN_MASK_VISUAL, clrPen, 0, 0); } } } diff --git a/engines/sci/graphics/paint32.cpp b/engines/sci/graphics/paint32.cpp new file mode 100644 index 0000000000..78f0302f45 --- /dev/null +++ b/engines/sci/graphics/paint32.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. + * + * $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/cache.h" +#include "sci/graphics/paint32.h" +#include "sci/graphics/font.h" +#include "sci/graphics/picture.h" +#include "sci/graphics/view.h" +#include "sci/graphics/screen.h" +#include "sci/graphics/palette.h" + +namespace Sci { + +GfxPaint32::GfxPaint32(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, GfxCache *cache, GfxScreen *screen, GfxPalette *palette) + : _resMan(resMan), _segMan(segMan), _kernel(kernel), _cache(cache), _screen(screen), _palette(palette) { +} + +GfxPaint32::~GfxPaint32() { +} + +void GfxPaint32::fillRect(Common::Rect rect, byte color) { + int16 y, x; + for (y = rect.top; y < rect.bottom; y++) { + for (x = rect.left; x < rect.right; x++) { + _screen->putPixel(x, y, SCI_SCREEN_MASK_VISUAL, color, 0, 0); + } + } +} + +} // End of namespace Sci diff --git a/engines/sci/graphics/paint32.h b/engines/sci/graphics/paint32.h new file mode 100644 index 0000000000..9bdcc8a61f --- /dev/null +++ b/engines/sci/graphics/paint32.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. + * + * $URL$ + * $Id$ + * + */ + +#ifndef SCI_GRAPHICS_PAINT16_H +#define SCI_GRAPHICS_PAINT16_H + +#include "sci/graphics/gui.h" + +#include "common/hashmap.h" + +namespace Sci { + +class GfxPorts; + +class GfxPaint32 { +public: + GfxPaint32(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, GfxCache *cache, GfxScreen *screen, GfxPalette *palette); + ~GfxPaint32(); + + void fillRect(Common::Rect rect, byte color); + +private: + ResourceManager *_resMan; + SegManager *_segMan; + Kernel *_kernel; + GfxCache *_cache; + GfxScreen *_screen; + GfxPalette *_palette; +}; + +} // End of namespace Sci + +#endif diff --git a/engines/sci/module.mk b/engines/sci/module.mk index 9ebb66f02a..0bb3cdb886 100644 --- a/engines/sci/module.mk +++ b/engines/sci/module.mk @@ -43,6 +43,7 @@ MODULE_OBJS := \ graphics/gui.o \ graphics/menu.o \ graphics/paint16.o \ + graphics/paint32.o \ graphics/palette.o \ graphics/picture.o \ graphics/portrait.o \ -- cgit v1.2.3