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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Tue Jul 29 05:14:36 CEST 2008


Revision: 33392
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33392&view=rev
Author:   peres001
Date:     2008-07-29 03:14:35 +0000 (Tue, 29 Jul 2008)

Log Message:
-----------
* Fixed positioning of balloons and faces in BRA (dos, at least).
* Adapted loading of faces.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/balloons.cpp
    scummvm/trunk/engines/parallaction/dialogue.cpp
    scummvm/trunk/engines/parallaction/disk_br.cpp
    scummvm/trunk/engines/parallaction/exec_ns.cpp

Modified: scummvm/trunk/engines/parallaction/balloons.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/balloons.cpp	2008-07-29 02:12:07 UTC (rev 33391)
+++ scummvm/trunk/engines/parallaction/balloons.cpp	2008-07-29 03:14:35 UTC (rev 33392)
@@ -315,11 +315,11 @@
 	Balloon *balloon = &_intBalloons[id];
 
 	if (winding == 0) {
-		src = _leftBalloon;
+		src = _rightBalloon;
 		srcFrame = 0;
 	} else
 	if (winding == 1) {
-		src = _rightBalloon;
+		src = _leftBalloon;
 		srcFrame = 0;
 	}
 
@@ -332,10 +332,12 @@
 
 	// TODO: extract some text to make a name for obj
 	balloon->obj = _gfx->registerBalloon(new SurfaceToFrames(balloon->surface), 0);
-	balloon->obj->x = x;
-	balloon->obj->y = y;
+	balloon->obj->x = x + balloon->box.left;
+	balloon->obj->y = y + balloon->box.top;
 	balloon->obj->transparentKey = BALLOON_TRANSPARENT_COLOR_BR;
 
+	printf("balloon (%i, %i)\n", balloon->obj->x, balloon->obj->y);
+
 	_numBalloons++;
 
 	return id;
@@ -351,11 +353,11 @@
 	Balloon *balloon = &_intBalloons[id];
 
 	if (winding == 0) {
-		src = _leftBalloon;
+		src = _rightBalloon;
 		srcFrame = id;
 	} else
 	if (winding == 1) {
-		src = _rightBalloon;
+		src = _leftBalloon;
 		srcFrame = 0;
 	}
 
@@ -368,8 +370,8 @@
 
 	// TODO: extract some text to make a name for obj
 	balloon->obj = _gfx->registerBalloon(new SurfaceToFrames(balloon->surface), 0);
-	balloon->obj->x = 0;
-	balloon->obj->y = 10;
+	balloon->obj->x = balloon->box.left;
+	balloon->obj->y = balloon->box.top;
 	balloon->obj->transparentKey = BALLOON_TRANSPARENT_COLOR_BR;
 
 	if (id > 0) {

Modified: scummvm/trunk/engines/parallaction/dialogue.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/dialogue.cpp	2008-07-29 02:12:07 UTC (rev 33391)
+++ scummvm/trunk/engines/parallaction/dialogue.cpp	2008-07-29 03:14:35 UTC (rev 33392)
@@ -33,7 +33,7 @@
 namespace Parallaction {
 
 #define MAX_PASSWORD_LENGTH			 7
-
+/*
 #define QUESTION_BALLOON_X			140
 #define QUESTION_BALLOON_Y			10
 #define QUESTION_CHARACTER_X		  190
@@ -41,8 +41,27 @@
 
 #define ANSWER_CHARACTER_X			10
 #define ANSWER_CHARACTER_Y			80
+*/
+struct BalloonPositions {
+	Common::Point	_questionBalloon;
+	Common::Point	_questionChar;
 
+	Common::Point	_answerChar;
+};
 
+BalloonPositions _balloonPositions_NS = {
+	Common::Point(140, 10),
+	Common::Point(190, 80),
+	Common::Point(10, 80)
+};
+
+BalloonPositions _balloonPositions_BR = {
+	Common::Point(0, 0),
+	Common::Point(380, 80),
+	Common::Point(10, 80)
+};
+
+
 class DialogueManager {
 
 	enum {
@@ -78,6 +97,7 @@
 	bool			_isKeyDown;
 	uint16			_downKey;
 
+	BalloonPositions	_ballonPos;
 
 public:
 	DialogueManager(Parallaction *vm, ZonePtr z);
@@ -112,6 +132,15 @@
 };
 
 DialogueManager::DialogueManager(Parallaction *vm, ZonePtr z) : _vm(vm), _z(z) {
+	int gtype = vm->getGameType();
+	if (gtype == GType_Nippon) {
+		_ballonPos = _balloonPositions_NS;
+	} else
+	if (gtype == GType_BRA) {
+		_ballonPos = _balloonPositions_BR;
+	} else
+		error("unsupported game in DialogueManager");
+
 	_dialogue = _z->u.speak->_dialogue;
 	isNpc = scumm_stricmp(_z->u.speak->_name, "yourself") && _z->u.speak->_name[0] != '\0';
 	_questioner = isNpc ? _vm->_disk->loadTalk(_z->u.speak->_name) : _vm->_char._talk;
@@ -168,16 +197,16 @@
 	if (_askPassword) {
 		resetPassword();
 //		_vm->_balloonMan->setDialogueBalloon(_q->_answers[0]->_text, 1, 3);
-		int id = _vm->_gfx->setItem(_answerer, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y);
+		int id = _vm->_gfx->setItem(_answerer, _ballonPos._answerChar.x, _ballonPos._answerChar.y);
 		_vm->_gfx->setItemFrame(id, 0);
 	} else
 	if (_numVisAnswers == 1) {
-		int id = _vm->_gfx->setItem(_answerer, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y);
+		int id = _vm->_gfx->setItem(_answerer, _ballonPos._answerChar.x, _ballonPos._answerChar.y);
 		_vm->_gfx->setItemFrame(id, _q->_answers[0]->_mood & 0xF);
 		_vm->_balloonMan->setBalloonText(0, _q->_answers[_visAnswers[0]]->_text, 0);
 	} else
 	if (_numVisAnswers > 1) {
-		int id = _vm->_gfx->setItem(_answerer, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y);
+		int id = _vm->_gfx->setItem(_answerer, _ballonPos._answerChar.x, _ballonPos._answerChar.y);
 		_vm->_gfx->setItemFrame(id, _q->_answers[_visAnswers[0]]->_mood & 0xF);
 		_oldSelection = -1;
 		_selection = 0;
@@ -189,8 +218,8 @@
 bool DialogueManager::displayQuestion() {
 	if (!scumm_stricmp(_q->_text, "NULL")) return false;
 
-	_vm->_balloonMan->setSingleBalloon(_q->_text, QUESTION_BALLOON_X, QUESTION_BALLOON_Y, _q->_mood & 0x10, 0);
-	int id = _vm->_gfx->setItem(_questioner, QUESTION_CHARACTER_X, QUESTION_CHARACTER_Y);
+	_vm->_balloonMan->setSingleBalloon(_q->_text, _ballonPos._questionBalloon.x, _ballonPos._questionBalloon.y, _q->_mood & 0x10, 0);
+	int id = _vm->_gfx->setItem(_questioner, _ballonPos._questionChar.x, _ballonPos._questionChar.y);
 	_vm->_gfx->setItemFrame(id, _q->_mood & 0xF);
 
 	return true;

Modified: scummvm/trunk/engines/parallaction/disk_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/disk_br.cpp	2008-07-29 02:12:07 UTC (rev 33391)
+++ scummvm/trunk/engines/parallaction/disk_br.cpp	2008-07-29 03:14:35 UTC (rev 33392)
@@ -144,7 +144,16 @@
 
 	Common::File stream;
 	stream.open(node);
-	return new GfxObj(0, createSprites(stream), name);
+
+	// talk position is set to (0,0), because talks are always displayed at
+	// absolute coordinates, set in the dialogue manager. The original used
+	// to null out coordinates every time they were needed. We do it better!
+	Sprites *spr = createSprites(stream);
+	for (int i = 0; i < spr->getNum(); i++) {
+		spr->_sprites[i].x = 0;
+		spr->_sprites[i].y = 0;
+	}
+	return new GfxObj(0, spr, name);
 }
 
 Script* DosDisk_br::loadLocation(const char *name) {

Modified: scummvm/trunk/engines/parallaction/exec_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/exec_ns.cpp	2008-07-29 02:12:07 UTC (rev 33391)
+++ scummvm/trunk/engines/parallaction/exec_ns.cpp	2008-07-29 03:14:35 UTC (rev 33392)
@@ -499,25 +499,32 @@
 		return;
 	}
 
-	int id;
+	// TODO: move this balloons stuff into DialogueManager and BalloonManager
+	if (getGameType() == GType_Nippon) {
+		int id;
+		if (data->_filename) {
+			if (data->_cnv == 0) {
+				data->_cnv = _disk->loadStatic(data->_filename);
+			}
 
-	if (data->_filename) {
-		if (data->_cnv == 0) {
-			data->_cnv = _disk->loadStatic(data->_filename);
+			_gfx->setHalfbriteMode(true);
+			_balloonMan->setSingleBalloon(data->_description, 0, 90, 0, 0);
+			Common::Rect r;
+			data->_cnv->getRect(0, r);
+			id = _gfx->setItem(data->_cnv, 140, (_screenHeight - r.height())/2);
+			_gfx->setItemFrame(id, 0);
+			id = _gfx->setItem(_char._head, 100, 152);
+			_gfx->setItemFrame(id, 0);
+		} else {
+			_balloonMan->setSingleBalloon(data->_description, 140, 10, 0, 0);
+			id = _gfx->setItem(_char._talk, 190, 80);
+			_gfx->setItemFrame(id, 0);
 		}
-
-		_gfx->setHalfbriteMode(true);
-		_balloonMan->setSingleBalloon(data->_description, 0, 90, 0, 0);
-		Common::Rect r;
-		data->_cnv->getRect(0, r);
-		id = _gfx->setItem(data->_cnv, 140, (_screenHeight - r.height())/2);
+	} else
+	if (getGameType() == GType_BRA) {
+		_balloonMan->setSingleBalloon(data->_description, 0, 0, 1, 0);
+		int id = _gfx->setItem(_char._talk, 10, 80);
 		_gfx->setItemFrame(id, 0);
-		id = _gfx->setItem(_char._head, 100, 152);
-		_gfx->setItemFrame(id, 0);
-	} else {
-		_balloonMan->setSingleBalloon(data->_description, 140, 10, 0, 0);
-		id = _gfx->setItem(_char._talk, 190, 80);
-		_gfx->setItemFrame(id, 0);
 	}
 
 	_input->_inputMode = Input::kInputModeComment;


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