[Scummvm-cvs-logs] CVS: scummvm/scumm dialogs.cpp,1.19,1.20 dialogs.h,1.8,1.9 string.cpp,1.36,1.37

Max Horn fingolfin at users.sourceforge.net
Sun Oct 27 04:27:02 CET 2002


Update of /cvsroot/scummvm/scummvm/scumm
In directory usw-pr-cvs1:/tmp/cvs-serv9332/scumm

Modified Files:
	dialogs.cpp dialogs.h string.cpp 
Log Message:
patch #628574: Implementing unkMessage2

Index: dialogs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/dialogs.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- dialogs.cpp	27 Oct 2002 10:02:11 -0000	1.19
+++ dialogs.cpp	27 Oct 2002 12:26:41 -0000	1.20
@@ -645,10 +645,36 @@
 
 #pragma mark -
 
+InfoDialog::InfoDialog(NewGui *gui, Scumm *scumm, int res)
+	: ScummDialog(gui, scumm, 0, 80, 0, 16) // dummy x and w
+{
+	setInfoText(queryResString (res));
+}
+
+InfoDialog::InfoDialog(NewGui *gui, Scumm *scumm, const String& message)
+	: ScummDialog(gui, scumm, 0, 80, 0, 16) // dummy x and w
+{
+	setInfoText(message);
+}
+
+void InfoDialog::setInfoText(const String& message)
+{
+	int width = _gui->getStringWidth(message.c_str()) + 16;
+	
+	_x = (_scumm->_realWidth - width) >> 1;
+	_w = width;
+
+	new StaticTextWidget(this, 4, 4, _w-8, _h, message, kTextAlignCenter);
+}
+
+#pragma mark -
+
+
+#pragma mark -
+
 PauseDialog::PauseDialog(NewGui *gui, Scumm *scumm)
-	: ScummDialog(gui, scumm, 35, 80, 250, 16)
+	: InfoDialog(gui, scumm, 10)
 {
-	addResText(4, 4, 250-8, 16, 10);
 }
 
 #ifdef _WIN32_WCE

Index: dialogs.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/dialogs.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- dialogs.h	22 Oct 2002 22:46:03 -0000	1.8
+++ dialogs.h	27 Oct 2002 12:26:41 -0000	1.9
@@ -109,9 +109,12 @@
 	CheckboxWidget *amigaPalCheckbox;
 };
 
-class PauseDialog : public ScummDialog {
+class InfoDialog : public ScummDialog {
 public:
-	PauseDialog(NewGui *gui, Scumm *scumm);
+	// arbitrary message
+	InfoDialog(NewGui *gui, Scumm *scumm, const String& message);
+	// from resources
+	InfoDialog(NewGui *gui, Scumm *scumm, int res);
 
 	virtual void handleMouseDown(int x, int y, int button, int clickCount)
 		{ close(); }
@@ -122,6 +125,13 @@
 			else
 				ScummDialog::handleKeyDown(key, modifiers);
 		}
+protected:
+	void setInfoText (const String& message);
+};
+
+class PauseDialog : public InfoDialog {
+public:
+	PauseDialog(NewGui *gui, Scumm *scumm);
 };
 
 #ifdef _WIN32_WCE

Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- string.cpp	27 Oct 2002 08:28:41 -0000	1.36
+++ string.cpp	27 Oct 2002 12:26:41 -0000	1.37
@@ -23,6 +23,7 @@
 #include "stdafx.h"
 #include "scumm.h"
 #include "actor.h"
+#include "dialogs.h"
 #include "scumm/sound.h"
 
 int CharsetRenderer::getStringWidth(int arg, byte *text, int pos)
@@ -170,9 +171,10 @@
 	if (_string[3].color == 0)
 		_string[3].color = 4;
 
-	// TODO - it appears the this function should display the given message graphically
-	// to the user in a "dialog" looking like the pause dialog, i.e. a single line.
-	warning("unkMessage2(\"%s\")", buf);
+	InfoDialog* dialog = new InfoDialog(_newgui, this, (char*)buf);
+	runDialog (dialog);
+	delete dialog;
+
 	_messagePtr = tmp;
 }
 





More information about the Scummvm-git-logs mailing list