[Scummvm-cvs-logs] scummvm master -> 2fefa91d952d775158c1b9bae2d6c5821b62d385

dreammaster dreammaster at scummvm.org
Sun Jul 28 22:51:24 CEST 2013


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
2fefa91d95 TSAGE: Fixes for R2R text positioning in conversation dialogs


Commit: 2fefa91d952d775158c1b9bae2d6c5821b62d385
    https://github.com/scummvm/scummvm/commit/2fefa91d952d775158c1b9bae2d6c5821b62d385
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-07-28T13:50:33-07:00

Commit Message:
TSAGE: Fixes for R2R text positioning in conversation dialogs

Changed paths:
    engines/tsage/converse.cpp
    engines/tsage/converse.h
    engines/tsage/dialogs.cpp
    engines/tsage/ringworld2/ringworld2_scenes0.cpp



diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp
index 76ccb704..d1cc7fb 100644
--- a/engines/tsage/converse.cpp
+++ b/engines/tsage/converse.cpp
@@ -424,17 +424,15 @@ ConversationChoiceDialog::ConversationChoiceDialog() {
 int ConversationChoiceDialog::execute(const Common::StringArray &choiceList) {
 	_gfxManager._font.setFontNumber(_fontNumber);
 
-	_bounds = Rect(20, 0, 20, 0);
+	_bounds = Rect(40, 0, 40, 0);
 	_choiceList.clear();
 
 	// Set up the list of choices
 	int yp = 0;
-	int xp = (g_vm->getGameID() == GType_Ringworld2) ? 40 : 25;
-
 	for (uint idx = 0; idx < choiceList.size(); ++idx) {
 		Rect tempRect;
-		_gfxManager._font.getStringBounds(choiceList[idx].c_str(), tempRect, 265);
-		tempRect.moveTo(xp, yp + 10);
+		_gfxManager._font.getStringBounds(choiceList[idx].c_str(), tempRect, textMaxWidth());
+		tempRect.moveTo(textLeft(), yp + 10);
 
 		_choiceList.push_back(ChoiceEntry(choiceList[idx], tempRect));
 		yp += tempRect.height() + 5;
@@ -515,11 +513,8 @@ void ConversationChoiceDialog::draw() {
 
 	// Fill in the contents of the entire dialog
 	_gfxManager._bounds = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
-	
-	if (g_vm->getGameID() == GType_Ringworld2)
-		GfxElement::drawFrame();
-	else
-		drawFrame();
+
+	drawFrame();
 
 	_gfxManager._bounds = tempRect;
 	_gfxManager._font._colors.foreground = _stdColor;
@@ -530,7 +525,7 @@ void ConversationChoiceDialog::draw() {
 		Common::String strNum = Common::String::format("%d", idx + 1);
 
 		// Write the choice number
-		_gfxManager._font.setPosition(13, _choiceList[idx]._bounds.top);
+		_gfxManager._font.setPosition(numberLeft(), _choiceList[idx]._bounds.top);
 		_gfxManager._font.writeString(strNum.c_str());
 
 		_gfxManager._font.writeLines(_choiceList[idx]._msg.c_str(), _choiceList[idx]._bounds, ALIGN_LEFT);
@@ -551,6 +546,18 @@ void ConversationChoiceDialog::remove() {
 	}
 }
 
+int ConversationChoiceDialog::textLeft() const {
+	return (g_vm->getGameID() == GType_Ringworld2) ? 20 : 25;
+}
+
+int ConversationChoiceDialog::textMaxWidth() const {
+	return (g_vm->getGameID() == GType_Ringworld2) ? 250 : 265;
+}
+
+int ConversationChoiceDialog::numberLeft() const {
+	return (g_vm->getGameID() == GType_Ringworld2) ? 6 : 13;
+}
+
 /*--------------------------------------------------------------------------*/
 
 void Obj44::load(const byte *dataP) {
diff --git a/engines/tsage/converse.h b/engines/tsage/converse.h
index 7f30e96..aedd7b7 100644
--- a/engines/tsage/converse.h
+++ b/engines/tsage/converse.h
@@ -145,6 +145,10 @@ public:
 };
 
 class ConversationChoiceDialog : public ModalDialog {
+private:
+	int textLeft() const;
+	int textMaxWidth() const;
+	int numberLeft() const;
 public:
 	int _stdColor;
 	int _highlightColor;
diff --git a/engines/tsage/dialogs.cpp b/engines/tsage/dialogs.cpp
index 77ac0a2..43833f5 100644
--- a/engines/tsage/dialogs.cpp
+++ b/engines/tsage/dialogs.cpp
@@ -137,43 +137,47 @@ void ModalDialog::drawFrame() {
 	Rect origRect = _bounds;
 	_bounds.collapse(-10, -10);
 
-	// Fill the dialog area
-	g_globals->gfxManager().fillRect(origRect, 54);
-
-	// Draw top line
-	GfxSurface surface = surfaceFromRes(8, 1, 7);
-	for (int xp = _bounds.left + 10; xp < (_bounds.right - 20); xp += 10)
-		surface.draw(Common::Point(xp, _bounds.top));
-	surface.draw(Common::Point(_bounds.right - 20, _bounds.top));
-
-	surface = surfaceFromRes(8, 1, 1);
-	surface.draw(Common::Point(_bounds.left, _bounds.top));
-
-	surface = surfaceFromRes(8, 1, 4);
-	surface.draw(Common::Point(_bounds.right - 10, _bounds.top));
-
-	// Draw vertical edges
-	surface = surfaceFromRes(8, 1, 2);
-	for (int yp = _bounds.top + 10; yp < (_bounds.bottom - 20); yp += 10)
-		surface.draw(Common::Point(_bounds.left, yp));
-	surface.draw(Common::Point(_bounds.left, _bounds.bottom - 20));
-
-	surface = surfaceFromRes(8, 1, 5);
-	for (int yp = _bounds.top + 10; yp < (_bounds.bottom - 20); yp += 10)
-		surface.draw(Common::Point(_bounds.right - 10, yp));
-	surface.draw(Common::Point(_bounds.right - 10, _bounds.bottom - 20));
-
-	// Draw bottom line
-	surface = surfaceFromRes(8, 1, 8);
-	for (int xp = _bounds.left + 10; xp < (_bounds.right - 20); xp += 10)
-		surface.draw(Common::Point(xp, _bounds.bottom - 10));
-	surface.draw(Common::Point(_bounds.right - 20, _bounds.bottom - 10));
-
-	surface = surfaceFromRes(8, 1, 3);
-	surface.draw(Common::Point(_bounds.left, _bounds.bottom - 10));
-
-	surface = surfaceFromRes(8, 1, 6);
-	surface.draw(Common::Point(_bounds.right - 10, _bounds.bottom - 10));
+	if (g_vm->getGameID() == GType_Ringworld2) {
+		GfxElement::drawFrame();
+	} else {
+		// Fill the dialog area
+		g_globals->gfxManager().fillRect(origRect, 54);
+
+		// Draw top line
+		GfxSurface surface = surfaceFromRes(8, 1, 7);
+		for (int xp = _bounds.left + 10; xp < (_bounds.right - 20); xp += 10)
+			surface.draw(Common::Point(xp, _bounds.top));
+		surface.draw(Common::Point(_bounds.right - 20, _bounds.top));
+
+		surface = surfaceFromRes(8, 1, 1);
+		surface.draw(Common::Point(_bounds.left, _bounds.top));
+
+		surface = surfaceFromRes(8, 1, 4);
+		surface.draw(Common::Point(_bounds.right - 10, _bounds.top));
+
+		// Draw vertical edges
+		surface = surfaceFromRes(8, 1, 2);
+		for (int yp = _bounds.top + 10; yp < (_bounds.bottom - 20); yp += 10)
+			surface.draw(Common::Point(_bounds.left, yp));
+		surface.draw(Common::Point(_bounds.left, _bounds.bottom - 20));
+
+		surface = surfaceFromRes(8, 1, 5);
+		for (int yp = _bounds.top + 10; yp < (_bounds.bottom - 20); yp += 10)
+			surface.draw(Common::Point(_bounds.right - 10, yp));
+		surface.draw(Common::Point(_bounds.right - 10, _bounds.bottom - 20));
+
+		// Draw bottom line
+		surface = surfaceFromRes(8, 1, 8);
+		for (int xp = _bounds.left + 10; xp < (_bounds.right - 20); xp += 10)
+			surface.draw(Common::Point(xp, _bounds.bottom - 10));
+		surface.draw(Common::Point(_bounds.right - 20, _bounds.bottom - 10));
+
+		surface = surfaceFromRes(8, 1, 3);
+		surface.draw(Common::Point(_bounds.left, _bounds.bottom - 10));
+
+		surface = surfaceFromRes(8, 1, 6);
+		surface.draw(Common::Point(_bounds.right - 10, _bounds.bottom - 10));
+	}
 
 	// Set the dialog's manager bounds
 	_gfxManager._bounds = origRect;
diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp
index 8401723..fd3b01c 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp
@@ -3173,6 +3173,9 @@ bool Scene300::Doorway::startAction(CursorType action, Event &event) {
 Scene300::Scene300(): SceneExt() {
 	_stripId = 0;
 	_rotation = NULL;
+
+	_stripManager.setColors(60, 255);
+	_stripManager.setFontNumber(3);
 }
 
 void Scene300::synchronize(Serializer &s) {
@@ -3194,8 +3197,6 @@ void Scene300::postInit(SceneObjectList *OwnerList) {
 		R2_GLOBALS._player._characterIndex = R2_QUINN;
 	}
 
-	_stripManager.setColors(60, 255);
-	_stripManager.setFontNumber(3);
 	_stripManager.addSpeaker(&_mirandaSpeaker);
 	_stripManager.addSpeaker(&_seekerSpeaker);
 	_stripManager.addSpeaker(&_quinnSpeaker);
@@ -3627,6 +3628,8 @@ void Scene300::signal() {
 	case 309:
 		signal309();
 		R2_GLOBALS._events.setCursor(CURSOR_ARROW);
+		R2_GLOBALS._events._currentCursor = CURSOR_ARROW;
+
 		_sceneMode = 10;
 		_stripManager.start3(_stripId, this, R2_GLOBALS._stripManager_lookupList);
 		break;






More information about the Scummvm-git-logs mailing list