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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Mon Nov 19 21:46:28 CET 2007


Revision: 29571
          http://scummvm.svn.sourceforge.net/scummvm/?rev=29571&view=rev
Author:   peres001
Date:     2007-11-19 12:46:28 -0800 (Mon, 19 Nov 2007)

Log Message:
-----------
* made engine use Inventory and InventoryRenderer
* inventory drawing is now performed directly in the framebuffer instead of using the game screen buffer
* specialized jobs to handle inventory drawing have been deleted as they had become obsolete

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

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2007-11-19 20:41:13 UTC (rev 29570)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2007-11-19 20:46:28 UTC (rev 29571)
@@ -287,6 +287,15 @@
 
 void Gfx::updateScreen() {
 	g_system->copyRectToScreen((const byte*)_buffers[kBitFront]->pixels, _buffers[kBitFront]->pitch, _screenX, _screenY, _vm->_screenWidth, _vm->_screenHeight);
+
+	if (_engineFlags & kEngineInventory) {
+		Common::Rect r;
+		_vm->_inventoryRenderer->getRect(r);
+		byte *data = _vm->_inventoryRenderer->getData();
+
+		g_system->copyRectToScreen(data, r.width(), r.left, r.top, r.width(), r.height());
+	}
+
 	g_system->updateScreen();
 	return;
 }

Modified: scummvm/trunk/engines/parallaction/inventory.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/inventory.cpp	2007-11-19 20:41:13 UTC (rev 29570)
+++ scummvm/trunk/engines/parallaction/inventory.cpp	2007-11-19 20:46:28 UTC (rev 29571)
@@ -47,94 +47,68 @@
 #define INVENTORY_WIDTH 			(INVENTORY_ITEMS_PER_LINE*INVENTORYITEM_WIDTH)
 #define INVENTORY_HEIGHT			(INVENTORY_LINES*INVENTORYITEM_HEIGHT)
 
-Inventory *_inv = 0;
-InventoryRenderer *_re = 0;
 
-
 int16 Parallaction::getHoverInventoryItem(int16 x, int16 y) {
-	return _re->hitTest(Common::Point(x,y));
+	return _inventoryRenderer->hitTest(Common::Point(x,y));
 }
 
-void highlightInventoryItem(ItemPosition pos, byte color) {
-	_re->highlightItem(pos, color);
+void Parallaction::highlightInventoryItem(ItemPosition pos, byte color) {
+	_inventoryRenderer->highlightItem(pos, color);
 }
 
 int Parallaction::addInventoryItem(ItemName item) {
-	return _inv->addItem(item);
+	return _inventory->addItem(item);
 }
 
 int Parallaction::addInventoryItem(ItemName item, uint32 value) {
-	return _inv->addItem(item, value);
+	return _inventory->addItem(item, value);
 }
 
 void Parallaction::dropItem(uint16 v) {
-	_inv->removeItem(v);
+	_inventory->removeItem(v);
 }
 
 bool Parallaction::isItemInInventory(int32 v) {
-	return (_inv->findItem(v) != -1);
+	return (_inventory->findItem(v) != -1);
 }
 
-const InventoryItem* getInventoryItem(int16 pos) {
-	return _inv->getItem(pos);
+const InventoryItem* Parallaction::getInventoryItem(int16 pos) {
+	return _inventory->getItem(pos);
 }
 
-int16 getInventoryItemIndex(int16 pos) {
-	return _inv->getItemName(pos);
+int16 Parallaction::getInventoryItemIndex(int16 pos) {
+	return _inventory->getItemName(pos);
 }
 
-void initInventory() {
-	_inv = new Inventory(INVENTORY_MAX_ITEMS);
-	_re = new InventoryRenderer(_vm);
-	_re->bindInventory(_inv);
+void Parallaction::initInventory() {
+	_inventory = new Inventory(INVENTORY_MAX_ITEMS);
+	_inventoryRenderer = new InventoryRenderer(this);
+	_inventoryRenderer->bindInventory(_inventory);
 }
 
-void destroyInventory() {
-	delete _inv;
-	delete _re;
-}
+void Parallaction::destroyInventory() {
+	delete _inventory;
+	delete _inventoryRenderer;
 
-void cleanInventory(bool keepVerbs) {
-	_inv->clear(keepVerbs);
+	_inventory = 0;
+	_inventoryRenderer = 0;
 }
 
-void openInventory() {
-	_re->showInventory();
+void Parallaction::cleanInventory(bool keepVerbs) {
+	_inventory->clear(keepVerbs);
 }
 
-void closeInventory() {
-	_re->hideInventory();
+void Parallaction::openInventory() {
+	_inventoryRenderer->showInventory();
 }
 
-
-
-
-void Parallaction_ns::showInventory() {
-	Common::Rect r;
-	_re->getRect(r);
-	_gfx->copyRect(Gfx::kBitBack, r, _re->getData(), INVENTORY_WIDTH);
+void Parallaction::closeInventory() {
+	_inventoryRenderer->hideInventory();
 }
 
-void Parallaction_ns::jobHideInventory(void *parm, Job *j) {
-	static uint16 count = 0;
-	_engineFlags |= kEngineBlockInput;
 
-	count++;
-	if (count == 2) {
-		count = 0;
-		j->_finished = 1;
-		_engineFlags &= ~kEngineBlockInput;
-	}
 
-	Common::Rect r;
-	_re->getRect(r);
-	_gfx->restoreBackground(r);
-}
 
-
-
-
-
 InventoryRenderer::InventoryRenderer(Parallaction *vm) : _vm(vm) {
 	_surf.create(INVENTORY_WIDTH, INVENTORY_HEIGHT, 1);
 }
@@ -237,16 +211,6 @@
 
 
 
-
-
-
-
-
-
-
-
-
-
 Inventory::Inventory(uint16 maxItems) : _maxItems(maxItems), _numItems(0) {
 	_items = (InventoryItem*)calloc(_maxItems, sizeof(InventoryItem));
 

Modified: scummvm/trunk/engines/parallaction/inventory.h
===================================================================
--- scummvm/trunk/engines/parallaction/inventory.h	2007-11-19 20:41:13 UTC (rev 29570)
+++ scummvm/trunk/engines/parallaction/inventory.h	2007-11-19 20:46:28 UTC (rev 29571)
@@ -44,20 +44,6 @@
 
 #define MAKE_INVENTORY_ID(x) (((x) & 0xFFFF) << 16)
 
-void initInventory();
-void destroyInventory();
-
-
-
-void openInventory();
-void closeInventory();
-void highlightInventoryItem(int16 pos, byte color);
-
-
-void cleanInventory(bool keepVerbs = true);
-const InventoryItem* getInventoryItem(int16 pos);
-int16 getInventoryItemIndex(int16 pos);
-
 typedef int16 ItemPosition;
 typedef uint16 ItemName;
 

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2007-11-19 20:41:13 UTC (rev 29570)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2007-11-19 20:46:28 UTC (rev 29571)
@@ -296,10 +296,6 @@
 		drawAnimations();
 		drawLabel();
 
-		if (_engineFlags & kEngineInventory) {
-			showInventory();
-		}
-
 		updateView();
 
 	}
@@ -375,7 +371,6 @@
 		closeInventory();
 		setInventoryCursor(data->_inventoryIndex);
 		resumeJobs();
-		addJob(kJobHideInventory, 0, kPriority20);
 		break;
 
 	case kEvHoverInventory:

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2007-11-19 20:41:13 UTC (rev 29570)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2007-11-19 20:46:28 UTC (rev 29571)
@@ -489,10 +489,6 @@
 
 	Common::RandomSource _rnd;
 
-	virtual void showInventory() = 0;
-	virtual void jobHideInventory(void*, Job*) = 0;
-
-
 protected:		// data
 
 	Debugger	*_debugger;
@@ -562,13 +558,7 @@
 
 	void 		freeCharacter();
 
-
-	int 		addInventoryItem(ItemName item, uint32 value);
-	int 		addInventoryItem(ItemName item);
-	void 		dropItem(ItemName item);
 	int16 		pickupItem(Zone *z);
-	bool 		isItemInInventory(int32 v);
-	int16		getHoverInventoryItem(int16 x, int16 y);
 
 public:
 	virtual	void callFunction(uint index, void* parm) { }
@@ -599,6 +589,23 @@
 	const char **_callableNamesRes;
 	const char **_instructionNamesRes;
 
+	void highlightInventoryItem(ItemPosition pos, byte color);
+	int16 getHoverInventoryItem(int16 x, int16 y);
+	int addInventoryItem(ItemName item);
+	int addInventoryItem(ItemName item, uint32 value);
+	void dropItem(uint16 v);
+	bool isItemInInventory(int32 v);
+	const InventoryItem* getInventoryItem(int16 pos);
+	int16 getInventoryItemIndex(int16 pos);
+	void initInventory();
+	void destroyInventory();
+	void cleanInventory(bool keepVerbs = true);
+	void openInventory();
+	void closeInventory();
+
+	Inventory *_inventory;
+	InventoryRenderer *_inventoryRenderer;
+
 };
 
 
@@ -737,7 +744,6 @@
 	void jobDisplayDroppedItem(void*, Job *j);
 	void jobRemovePickedItem(void*, Job *j);
 	void jobToggleDoor(void*, Job *j);
-	void jobHideInventory(void *parm, Job *j);
 
 	void runScripts();
 	void walk();
@@ -745,7 +751,6 @@
 	void eraseAnimations();
 	void drawLabel();
 	void eraseLabel();
-	void showInventory();
 
 
 	// location parser

Modified: scummvm/trunk/engines/parallaction/parallaction_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_ns.cpp	2007-11-19 20:41:13 UTC (rev 29570)
+++ scummvm/trunk/engines/parallaction/parallaction_ns.cpp	2007-11-19 20:46:28 UTC (rev 29571)
@@ -451,7 +451,7 @@
 		0,
 		&Parallaction_ns::jobToggleDoor,
 		0,
-		&Parallaction_ns::jobHideInventory
+		0
 	};
 
 	_jobsFn = jobs;


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