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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sat Dec 6 07:17:11 CET 2008


Revision: 35255
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35255&view=rev
Author:   peres001
Date:     2008-12-06 06:17:10 +0000 (Sat, 06 Dec 2008)

Log Message:
-----------
Fixed positioning of overlayed graphics (dialogues, inventory, labels) in all locations. These items are now all handled in screen coordinates which are translated automatically by the renderer.

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

Modified: scummvm/trunk/engines/parallaction/gfxbase.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/gfxbase.cpp	2008-12-06 06:13:48 UTC (rev 35254)
+++ scummvm/trunk/engines/parallaction/gfxbase.cpp	2008-12-06 06:17:10 UTC (rev 35255)
@@ -174,7 +174,12 @@
 	byte *data;
 
 	obj->getRect(obj->frame, rect);
-	rect.translate(obj->x, obj->y);
+
+	int x = obj->x;
+	if (_overlayMode) {
+		x += _scrollPos;
+	}
+	rect.translate(x, obj->y);
 	data = obj->getData(obj->frame);
 
 	if (obj->getSize(obj->frame) == obj->getRawSize(obj->frame)) {

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2008-12-06 06:13:48 UTC (rev 35254)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2008-12-06 06:17:10 UTC (rev 35255)
@@ -393,7 +393,6 @@
 	}
 
 	_varAnimRenderMode = getRenderMode("anim_render_mode");
-	_varMiscRenderMode = getRenderMode("misc_render_mode");
 }
 
 int32 Gfx::getRenderMode(const char *type) {
@@ -410,6 +409,9 @@
 
 void Gfx::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
 	if (_doubleBuffering) {
+		if (_overlayMode)
+			x += _scrollPos;
+
 		byte *dst = (byte*)_backBuffer.getBasePtr(x, y);
 		for (int i = 0; i < h; i++) {
 			memcpy(dst, buf, w);
@@ -465,6 +467,10 @@
 
 void Gfx::updateScreen() {
 
+	// the scene is calculated in game coordinates, so no translation
+	// is needed
+	_overlayMode = false;
+
 	if (!_skipBackground) {
 		// background may not cover the whole screen, so adjust bulk update size
 		uint w = _backgroundInfo->width;
@@ -527,8 +533,9 @@
 
 	unlockScreen();
 
-	_varRenderMode = _varMiscRenderMode;
-
+	// the following items are handled in screen coordinates, so they need translation before
+	// being drawn
+	_overlayMode = true;
 	drawInventory();
 	drawItems();
 	drawBalloons();
@@ -660,7 +667,7 @@
 		FloatingLabelTraits traits_NS = {
 			Common::Point(16 - r.width()/2, 34),
 			Common::Point(8 - r.width()/2, 21),
-			0, 0, _backgroundInfo->width - r.width(), 190
+			0, 0, _vm->_screenWidth - r.width(), 190
 		};
 		traits = &traits_NS;
 	} else {
@@ -668,13 +675,13 @@
 		FloatingLabelTraits traits_BR = {
 			Common::Point(34 - r.width()/2, 70),
 			Common::Point(16 - r.width()/2, 37),
-			0, 0, _backgroundInfo->width - r.width(), 390
+			0, 0, _vm->_screenWidth - r.width(), 390
 		};
 		traits = &traits_BR;
 	}
 
 	Common::Point	cursor;
-	_vm->_input->getAbsoluteCursorPos(cursor);
+	_vm->_input->getCursorPos(cursor);
 	Common::Point offset = (_vm->_input->_activeItem._id) ? traits->_offsetWithItem : traits->_offsetWithoutItem;
 
 	_labels[_floatingLabel]->x = CLIP(cursor.x + offset.x, traits->_minX, traits->_maxX);
@@ -816,7 +823,6 @@
 	_varBackgroundMode = 1;
 
 	registerVar("anim_render_mode", 1);
-	registerVar("misc_render_mode", 1);
 
 	registerVar("draw_path_zones", 0);
 

Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h	2008-12-06 06:13:48 UTC (rev 35254)
+++ scummvm/trunk/engines/parallaction/graphics.h	2008-12-06 06:17:10 UTC (rev 35255)
@@ -573,7 +573,6 @@
 	// frame data stored in programmable variables
 	int32				_varBackgroundMode;	// 1 = normal, 2 = only mask
 	int32				_varAnimRenderMode;	// 1 = normal, 2 = flat
-	int32				_varMiscRenderMode;	// 1 = normal, 2 = flat
 	int32				_varRenderMode;
 	int32				_varDrawPathZones;	// 0 = don't draw, 1 = draw
 	Graphics::Surface 	_bitmapMask;
@@ -591,6 +590,9 @@
 	int					_scrollPos;
 	int					_minScroll, _maxScroll;
 
+	// overlay mode enables drawing of graphics with automatic screen-to-game coordinate translation
+	bool				_overlayMode;
+
 public:
 
 	struct Item {

Modified: scummvm/trunk/engines/parallaction/input.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/input.cpp	2008-12-06 06:13:48 UTC (rev 35254)
+++ scummvm/trunk/engines/parallaction/input.cpp	2008-12-06 06:17:10 UTC (rev 35255)
@@ -325,7 +325,7 @@
 
 void Input::enterInventoryMode() {
 	Common::Point mousePos;
-	getAbsoluteCursorPos(mousePos);
+	getCursorPos(mousePos);
 	bool hitCharacter = _vm->hitZone(kZoneYou, mousePos.x, mousePos.y);
 
 	if (hitCharacter) {
@@ -349,7 +349,7 @@
 void Input::exitInventoryMode() {
 	// right up hides inventory
 	Common::Point mousePos;
-	getAbsoluteCursorPos(mousePos);
+	getCursorPos(mousePos);
 
 	int pos = _vm->getHoverInventoryItem(mousePos.x, mousePos.y);
 	_vm->highlightInventoryItem(-1);			// disable
@@ -390,7 +390,7 @@
 	}
 
 	Common::Point mousePos;
-	getAbsoluteCursorPos(mousePos);
+	getCursorPos(mousePos);
 
 	int16 _si = _vm->getHoverInventoryItem(mousePos.x, mousePos.y);
 	if (_si != _transCurrentHoverItem) {

Modified: scummvm/trunk/engines/parallaction/inventory.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/inventory.cpp	2008-12-06 06:13:48 UTC (rev 35254)
+++ scummvm/trunk/engines/parallaction/inventory.cpp	2008-12-06 06:17:10 UTC (rev 35255)
@@ -180,9 +180,9 @@
 	uint16 lines = getNumLines();
 
 	Common::Point p;
-	_vm->_input->getAbsoluteCursorPos(p);
+	_vm->_input->getCursorPos(p);
 
-	_pos.x = CLIP((int)(p.x - (_props->_width / 2)), 0, (int)(_vm->_gfx->_backgroundInfo->width - _props->_width));
+	_pos.x = CLIP((int)(p.x - (_props->_width / 2)), 0, (int)(_vm->_screenWidth - _props->_width));
 	_pos.y = CLIP((int)(p.y - 2 - (lines * _props->_itemHeight)), 0, (int)(_vm->_screenHeight - lines * _props->_itemHeight));
 
 	refresh();


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