diff options
| author | Max Horn | 2002-10-27 12:26:41 +0000 | 
|---|---|---|
| committer | Max Horn | 2002-10-27 12:26:41 +0000 | 
| commit | ec343e07e4806ac9c384733890a4b50f32cb9d75 (patch) | |
| tree | 1cb57f7c2345514a15a7db7d6527d534ee26eb2e | |
| parent | a0734ef3f987d1716440e81b5e571c00d3ed891c (diff) | |
| download | scummvm-rg350-ec343e07e4806ac9c384733890a4b50f32cb9d75.tar.gz scummvm-rg350-ec343e07e4806ac9c384733890a4b50f32cb9d75.tar.bz2 scummvm-rg350-ec343e07e4806ac9c384733890a4b50f32cb9d75.zip | |
patch #628574: Implementing unkMessage2
svn-id: r5334
| -rw-r--r-- | scumm/dialogs.cpp | 30 | ||||
| -rw-r--r-- | scumm/dialogs.h | 14 | ||||
| -rw-r--r-- | scumm/string.cpp | 8 | 
3 files changed, 45 insertions, 7 deletions
| diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp index 0e3f7a8dfa..a15f469a4e 100644 --- a/scumm/dialogs.cpp +++ b/scumm/dialogs.cpp @@ -645,10 +645,36 @@ AboutDialog::AboutDialog(NewGui *gui, Scumm *scumm)  #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 diff --git a/scumm/dialogs.h b/scumm/dialogs.h index 73a9678a1e..13f2c8c4f2 100644 --- a/scumm/dialogs.h +++ b/scumm/dialogs.h @@ -109,9 +109,12 @@ protected:  	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 @@ public:  			else  				ScummDialog::handleKeyDown(key, modifiers);  		} +protected: +	void setInfoText (const String& message); +}; + +class PauseDialog : public InfoDialog { +public: +	PauseDialog(NewGui *gui, Scumm *scumm);  };  #ifdef _WIN32_WCE diff --git a/scumm/string.cpp b/scumm/string.cpp index 6715e3a86d..3b33ba3d53 100644 --- a/scumm/string.cpp +++ b/scumm/string.cpp @@ -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 @@ void Scumm::unkMessage2()  	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;  } | 
