[Scummvm-cvs-logs] SF.net SVN: scummvm: [28534] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sat Aug 11 22:44:22 CEST 2007


Revision: 28534
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28534&view=rev
Author:   peres001
Date:     2007-08-11 13:44:22 -0700 (Sat, 11 Aug 2007)

Log Message:
-----------
Moved cursor handling from Gfx to engine subclasses.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/graphics.cpp
    scummvm/trunk/engines/parallaction/graphics.h
    scummvm/trunk/engines/parallaction/parallaction.cpp
    scummvm/trunk/engines/parallaction/parallaction.h
    scummvm/trunk/engines/parallaction/parallaction_br.cpp
    scummvm/trunk/engines/parallaction/parallaction_ns.cpp
    scummvm/trunk/engines/parallaction/staticres.cpp

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2007-08-11 19:35:27 UTC (rev 28533)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2007-08-11 20:44:22 UTC (rev 28534)
@@ -454,47 +454,12 @@
 	return;
 }
 
-void Gfx::initMouse(uint16 arg_0) {
 
-	_mouseComposedArrow = _vm->_disk->loadPointer();
 
-	byte temp[MOUSEARROW_WIDTH*MOUSEARROW_HEIGHT];
-	memcpy(temp, _mouseArrow, MOUSEARROW_WIDTH*MOUSEARROW_HEIGHT);
 
-	uint16 k = 0;
-	for (uint16 i = 0; i < 4; i++) {
-		for (uint16 j = 0; j < 64; j++) _mouseArrow[k++] = temp[i + j * 4];
-	}
 
-	return;
-}
 
 
-void Gfx::setMousePointer(int16 index) {
-
-	if (index == kCursorArrow) {		// standard mouse pointer
-
-		g_system->setMouseCursor(_mouseArrow, MOUSEARROW_WIDTH, MOUSEARROW_HEIGHT, 0, 0, 0);
-		g_system->showMouse(true);
-
-	} else {
-		// inventory item pointer
-		byte *v8 = (byte*)_mouseComposedArrow->pixels;
-
-		// FIXME: destination offseting is not clear
-		byte* s = _vm->_char._objs->getFramePtr(getInventoryItemIndex(index));
-		byte* d = v8 + 7 + MOUSECOMBO_WIDTH * 7;
-		copyRect(INVENTORYITEM_WIDTH, INVENTORYITEM_HEIGHT, d, MOUSECOMBO_WIDTH, s, INVENTORYITEM_PITCH);
-
-		g_system->setMouseCursor(v8, MOUSECOMBO_WIDTH, MOUSECOMBO_HEIGHT, 0, 0, 0);
-	}
-
-	return;
-}
-
-
-
-
 //
 //	Cnv management
 //
@@ -824,8 +789,6 @@
 
 	memset(_palettefx, 0, sizeof(_palettefx));
 
-	initMouse( 0 );
-
 	_halfbrite = false;
 
 	_font = NULL;
@@ -840,9 +803,6 @@
 	_buffers[kBitBack]->free();
 	delete _buffers[kBitBack];
 
-	_mouseComposedArrow->free();
-	delete _mouseComposedArrow;
-
 	return;
 }
 

Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h	2007-08-11 19:35:27 UTC (rev 28533)
+++ scummvm/trunk/engines/parallaction/graphics.h	2007-08-11 20:44:22 UTC (rev 28534)
@@ -37,12 +37,6 @@
 namespace Parallaction {
 
 
-#define MOUSEARROW_WIDTH		16
-#define MOUSEARROW_HEIGHT		16
-
-#define MOUSECOMBO_WIDTH		32	// sizes for cursor + selected inventory item
-#define MOUSECOMBO_HEIGHT		32
-
 #include "common/pack-start.h"	// START STRUCT PACKING
 
 struct PaletteFxRange {
@@ -230,7 +224,6 @@
 
 	// misc
 	int16 queryMask(int16 v);
-	void setMousePointer(int16 index);
 	void setFont(Font* font);
 	void swapBuffers();
 	void updateScreen();
@@ -252,8 +245,6 @@
 	Parallaction*		_vm;
 	Graphics::Surface	*_buffers[NUM_BUFFERS];
 	MaskBuffer			*_depthMask;
-	static byte			_mouseArrow[256];
-	Graphics::Surface			*_mouseComposedArrow;
 	Font				*_font;
 	bool				_halfbrite;
 
@@ -261,7 +252,6 @@
 	void copyRect(uint width, uint height, byte *dst, uint dstPitch, byte *src, uint srcPitch);
 	void flatBlit(const Common::Rect& r, byte *data, Gfx::Buffers buffer, byte transparentColor);
 	void blit(const Common::Rect& r, uint16 z, byte *data, Gfx::Buffers buffer);
-	void initMouse(uint16 arg_0);
 	void screenClip(Common::Rect& r, Common::Point& p);
 };
 

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2007-08-11 19:35:27 UTC (rev 28533)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2007-08-11 20:44:22 UTC (rev 28534)
@@ -675,7 +675,7 @@
 		_activeItem._id = _inventory[index]._id;
 	}
 
-	_gfx->setMousePointer(index);
+	setMousePointer(index);
 
 	return;
 }

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2007-08-11 19:35:27 UTC (rev 28533)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2007-08-11 20:44:22 UTC (rev 28534)
@@ -490,7 +490,9 @@
 public:
 	virtual	void callFunction(uint index, void* parm) { }
 	virtual void renderLabel(Graphics::Surface *cnv, char *text) { }
+	virtual void setMousePointer(int16 index) = 0;
 
+
 public:
 	const char **_zoneFlagNamesRes;
 	const char **_zoneTypeNamesRes;
@@ -513,14 +515,20 @@
 
 	virtual	void callFunction(uint index, void* parm);
 	void renderLabel(Graphics::Surface *cnv, char *text);
+	void setMousePointer(int16 index);
 
+
 private:
 	void initFonts();
 	void freeFonts();
 
 private:
 	void 		initResources();
+	void initCursors();
 
+	static byte			_mouseArrow[256];
+	Graphics::Surface			*_mouseComposedArrow;
+
 	static const Callable _dosCallables[25];
 	static const Callable _amigaCallables[25];
 
@@ -583,6 +591,10 @@
 	void 		initFonts();
 	void 		freeFonts();
 
+	void setMousePointer(int16 index);
+	void initCursors();
+
+
 	int showMenu();
 	void renderMenuItem(Graphics::Surface &surf, const char *text);
 	void invertMenuItem(Graphics::Surface &surf);

Modified: scummvm/trunk/engines/parallaction/parallaction_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_br.cpp	2007-08-11 19:35:27 UTC (rev 28533)
+++ scummvm/trunk/engines/parallaction/parallaction_br.cpp	2007-08-11 20:44:22 UTC (rev 28534)
@@ -223,4 +223,10 @@
 	return;
 }
 
+void Parallaction_br::setMousePointer(int16 index) {
+
+
+
+}
+
 } // namespace Parallaction

Modified: scummvm/trunk/engines/parallaction/parallaction_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_ns.cpp	2007-08-11 19:35:27 UTC (rev 28533)
+++ scummvm/trunk/engines/parallaction/parallaction_ns.cpp	2007-08-11 20:44:22 UTC (rev 28534)
@@ -24,6 +24,8 @@
  */
 
 #include "common/stdafx.h"
+#include "common/system.h"
+
 #include "common/config-manager.h"
 
 #include "parallaction/parallaction.h"
@@ -31,6 +33,12 @@
 
 namespace Parallaction {
 
+#define MOUSEARROW_WIDTH		16
+#define MOUSEARROW_HEIGHT		16
+
+#define MOUSECOMBO_WIDTH		32	// sizes for cursor + selected inventory item
+#define MOUSECOMBO_HEIGHT		32
+
 int Parallaction_ns::init() {
 
 	// Detect game
@@ -63,6 +71,7 @@
 
 	initResources();
 	initFonts();
+	initCursors();
 
 	Parallaction::init();
 
@@ -71,6 +80,9 @@
 
 Parallaction_ns::~Parallaction_ns() {
 	freeFonts();
+
+	_mouseComposedArrow->free();
+	delete _mouseComposedArrow;
 }
 
 
@@ -102,6 +114,49 @@
 
 }
 
+void Parallaction_ns::initCursors() {
+
+	_mouseComposedArrow = _disk->loadPointer();
+
+	byte temp[MOUSEARROW_WIDTH*MOUSEARROW_HEIGHT];
+	memcpy(temp, _mouseArrow, MOUSEARROW_WIDTH*MOUSEARROW_HEIGHT);
+
+	uint16 k = 0;
+	for (uint16 i = 0; i < 4; i++) {
+		for (uint16 j = 0; j < 64; j++) _mouseArrow[k++] = temp[i + j * 4];
+	}
+
+	return;
+}
+
+void Parallaction_ns::setMousePointer(int16 index) {
+
+	if (index == kCursorArrow) {		// standard mouse pointer
+
+		_system->setMouseCursor(_mouseArrow, MOUSEARROW_WIDTH, MOUSEARROW_HEIGHT, 0, 0, 0);
+		_system->showMouse(true);
+
+	} else {
+		// inventory item pointer
+		byte *v8 = (byte*)_mouseComposedArrow->pixels;
+
+		// FIXME: destination offseting is not clear
+		byte* s = _char._objs->getFramePtr(getInventoryItemIndex(index));
+		byte* d = v8 + 7 + MOUSECOMBO_WIDTH * 7;
+
+		for (uint i = 0; i < INVENTORYITEM_HEIGHT; i++) {
+			memcpy(d, s, INVENTORYITEM_WIDTH);
+
+			s += INVENTORYITEM_PITCH;
+			d += MOUSECOMBO_WIDTH;
+		}
+
+		_system->setMouseCursor(v8, MOUSECOMBO_WIDTH, MOUSECOMBO_HEIGHT, 0, 0, 0);
+	}
+
+	return;
+}
+
 void Parallaction_ns::callFunction(uint index, void* parm) {
 	assert(index < 25);	// magic value 25 is maximum # of callables for Nippon Safes
 

Modified: scummvm/trunk/engines/parallaction/staticres.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/staticres.cpp	2007-08-11 19:35:27 UTC (rev 28533)
+++ scummvm/trunk/engines/parallaction/staticres.cpp	2007-08-11 20:44:22 UTC (rev 28534)
@@ -30,7 +30,7 @@
 
 namespace Parallaction {
 
-byte Gfx::_mouseArrow[256] = {
+byte Parallaction_ns::_mouseArrow[256] = {
 	0x12, 0x11, 0x11, 0x11, 0x13, 0x12, 0x12, 0x12, 0x13, 0x12, 0x12, 0x11, 0x13, 0x12, 0x12, 0x00,
 	0x13, 0x12, 0x12, 0x11, 0x13, 0x12, 0x12, 0x12, 0x13, 0x12, 0x12, 0x12, 0x13, 0x12, 0x12, 0x12,
 	0x13, 0x12, 0x12, 0x12, 0x13, 0x12, 0x12, 0x12, 0x13, 0x12, 0x12, 0x13, 0x13, 0x13, 0x12, 0x00,


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