[Scummvm-cvs-logs] SF.net SVN: scummvm:[47883] scummvm/trunk/engines/sci

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Thu Feb 4 20:22:44 CET 2010


Revision: 47883
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47883&view=rev
Author:   m_kiewitz
Date:     2010-02-04 19:22:40 +0000 (Thu, 04 Feb 2010)

Log Message:
-----------
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

Modified Paths:
--------------
    scummvm/trunk/engines/sci/console.cpp
    scummvm/trunk/engines/sci/engine/kgraphics.cpp
    scummvm/trunk/engines/sci/engine/state.h
    scummvm/trunk/engines/sci/graphics/gui.cpp
    scummvm/trunk/engines/sci/graphics/gui.h
    scummvm/trunk/engines/sci/graphics/gui32.cpp
    scummvm/trunk/engines/sci/graphics/paint16.cpp
    scummvm/trunk/engines/sci/graphics/paint16.h
    scummvm/trunk/engines/sci/graphics/paint32.cpp
    scummvm/trunk/engines/sci/graphics/paint32.h
    scummvm/trunk/engines/sci/module.mk

Added Paths:
-----------
    scummvm/trunk/engines/sci/graphics/paint.cpp
    scummvm/trunk/engines/sci/graphics/paint.h

Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp	2010-02-04 18:52:03 UTC (rev 47882)
+++ scummvm/trunk/engines/sci/console.cpp	2010-02-04 19:22:40 UTC (rev 47883)
@@ -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 @@
 
 	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;
 }

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-02-04 18:52:03 UTC (rev 47882)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-02-04 19:22:40 UTC (rev 47883)
@@ -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 @@
 	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;
 }

Modified: scummvm/trunk/engines/sci/engine/state.h
===================================================================
--- scummvm/trunk/engines/sci/engine/state.h	2010-02-04 18:52:03 UTC (rev 47882)
+++ scummvm/trunk/engines/sci/engine/state.h	2010-02-04 19:22:40 UTC (rev 47883)
@@ -55,6 +55,9 @@
 class GfxCache;
 class GfxControls;
 class GfxMenu;
+class GfxPaint;
+class GfxPaint16;
+class GfxPaint32;
 class GfxPalette;
 class GfxPorts;
 class GfxScreen;
@@ -152,6 +155,8 @@
 	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 */

Modified: scummvm/trunk/engines/sci/graphics/gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui.cpp	2010-02-04 18:52:03 UTC (rev 47882)
+++ scummvm/trunk/engines/sci/graphics/gui.cpp	2010-02-04 19:22:40 UTC (rev 47883)
@@ -54,8 +54,10 @@
 	: _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::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())) {

Modified: scummvm/trunk/engines/sci/graphics/gui.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui.h	2010-02-04 18:52:03 UTC (rev 47882)
+++ scummvm/trunk/engines/sci/graphics/gui.h	2010-02-04 19:22:40 UTC (rev 47883)
@@ -76,7 +76,6 @@
 	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);

Modified: scummvm/trunk/engines/sci/graphics/gui32.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui32.cpp	2010-02-04 18:52:03 UTC (rev 47882)
+++ scummvm/trunk/engines/sci/graphics/gui32.cpp	2010-02-04 19:22:40 UTC (rev 47883)
@@ -50,6 +50,7 @@
 
 	_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);
 }
 

Copied: scummvm/trunk/engines/sci/graphics/paint.cpp (from rev 47880, scummvm/trunk/engines/sci/graphics/paint16.cpp)
===================================================================
--- scummvm/trunk/engines/sci/graphics/paint.cpp	                        (rev 0)
+++ scummvm/trunk/engines/sci/graphics/paint.cpp	2010-02-04 19:22:40 UTC (rev 47883)
@@ -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

Copied: scummvm/trunk/engines/sci/graphics/paint.h (from rev 47870, scummvm/trunk/engines/sci/graphics/paint16.h)
===================================================================
--- scummvm/trunk/engines/sci/graphics/paint.h	                        (rev 0)
+++ scummvm/trunk/engines/sci/graphics/paint.h	2010-02-04 19:22:40 UTC (rev 47883)
@@ -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

Modified: scummvm/trunk/engines/sci/graphics/paint16.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/paint16.cpp	2010-02-04 18:52:03 UTC (rev 47882)
+++ scummvm/trunk/engines/sci/graphics/paint16.cpp	2010-02-04 19:22:40 UTC (rev 47883)
@@ -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::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

Modified: scummvm/trunk/engines/sci/graphics/paint16.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/paint16.h	2010-02-04 18:52:03 UTC (rev 47882)
+++ scummvm/trunk/engines/sci/graphics/paint16.h	2010-02-04 19:22:40 UTC (rev 47883)
@@ -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 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 @@
 	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 @@
 	GfxScreen *_screen;
 	GfxPalette *_palette;
 	GfxText16 *_text16;
+	Transitions *_transitions;
 
 	// true means make EGA picture drawing visible
 	bool _EGAdrawingVisualize;

Modified: scummvm/trunk/engines/sci/graphics/paint32.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/paint32.cpp	2010-02-04 18:52:03 UTC (rev 47882)
+++ scummvm/trunk/engines/sci/graphics/paint32.cpp	2010-02-04 19:22:40 UTC (rev 47883)
@@ -56,4 +56,11 @@
 	}
 }
 
+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

Modified: scummvm/trunk/engines/sci/graphics/paint32.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/paint32.h	2010-02-04 18:52:03 UTC (rev 47882)
+++ scummvm/trunk/engines/sci/graphics/paint32.h	2010-02-04 19:22:40 UTC (rev 47883)
@@ -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 @@
 
 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;

Modified: scummvm/trunk/engines/sci/module.mk
===================================================================
--- scummvm/trunk/engines/sci/module.mk	2010-02-04 18:52:03 UTC (rev 47882)
+++ scummvm/trunk/engines/sci/module.mk	2010-02-04 19:22:40 UTC (rev 47883)
@@ -42,6 +42,7 @@
 	graphics/font.o \
 	graphics/gui.o \
 	graphics/menu.o \
+	graphics/paint.o \
 	graphics/paint16.o \
 	graphics/palette.o \
 	graphics/picture.o \


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list