diff options
| author | Willem Jan Palenstijn | 2015-05-07 23:35:36 +0200 | 
|---|---|---|
| committer | Willem Jan Palenstijn | 2015-05-07 23:35:36 +0200 | 
| commit | 57109ef0a8d30f15aa1fcef7d9d229fc9701f630 (patch) | |
| tree | 230c0a7822875e9c41a4606fce54166d4dc37db0 /engines/mads/nebular/dialogs_nebular.cpp | |
| parent | d9e93f8e015ce27a95090e854494c4b3f7d1c0d4 (diff) | |
| parent | 04931d040085d77d031290fda57ca2c5dc486f54 (diff) | |
| download | scummvm-rg350-57109ef0a8d30f15aa1fcef7d9d229fc9701f630.tar.gz scummvm-rg350-57109ef0a8d30f15aa1fcef7d9d229fc9701f630.tar.bz2 scummvm-rg350-57109ef0a8d30f15aa1fcef7d9d229fc9701f630.zip  | |
Merge branch 'master' into sherlock
Diffstat (limited to 'engines/mads/nebular/dialogs_nebular.cpp')
| -rw-r--r-- | engines/mads/nebular/dialogs_nebular.cpp | 56 | 
1 files changed, 49 insertions, 7 deletions
diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index 4ba5366a60..5b9942db07 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -417,7 +417,7 @@ TextDialog(vm, FONT_INTERFACE, Common::Point(-1, -1), 32) {  		_hogEntry._pageNum, _hogEntry._lineNum, _hogEntry._wordNum);  	wordWrap(line); -	wordWrap("and type it on the line below (we',27h,'ve even given you"); +	wordWrap("and type it on the line below (we've even given you");  	wordWrap("first letter as a hint).  As soon as you do that, we can get");  	wordWrap("right into this really COOL adventure game!\n");  	wordWrap("\n"); @@ -428,17 +428,58 @@ TextDialog(vm, FONT_INTERFACE, Common::Point(-1, -1), 32) {  void CopyProtectionDialog::show() {  	draw(); -	_vm->_events->showCursor(); -	// TODO: Replace with text input -	while (!_vm->shouldQuit() && !_vm->_events->isKeyPressed() && -		!_vm->_events->_mouseClicked) { -		_vm->_events->delay(1); +	Common::KeyState curKey; +	const Common::Rect inputArea(110, 165, 210, 175); +	MSurface *origInput = new MSurface(inputArea.width(), inputArea.height()); +	_vm->_screen.frameRect(inputArea, TEXTDIALOG_BLACK); +	_vm->_screen.copyTo(origInput, inputArea, Common::Point(0, 0)); +	_font->setColors(TEXTDIALOG_FE, TEXTDIALOG_FE, TEXTDIALOG_FE, TEXTDIALOG_FE); +	_vm->_screen.copyRectToScreen(inputArea); +	_vm->_screen.updateScreen(); + +	bool firstTime = true; + +	while (!_vm->shouldQuit()) { +		if (!firstTime) { +			while (!_vm->shouldQuit() && !_vm->_events->isKeyPressed()) { +				_vm->_events->delay(1); +			} + +			if (_vm->shouldQuit()) +				break; + +			curKey = _vm->_events->getKey(); + +			if (curKey.keycode == Common::KEYCODE_RETURN || curKey.keycode == Common::KEYCODE_KP_ENTER) +				break; +			else if (curKey.keycode == Common::KEYCODE_BACKSPACE) +				_textInput.deleteLastChar(); +			else if (_textInput.size() < 14) +				_textInput += curKey.ascii; + +			_vm->_events->_pendingKeys.clear(); +		} else { +			firstTime = false; +			_textInput = _hogEntry._word[0]; +		} + +		_vm->_screen.copyFrom(origInput, Common::Rect(0, 0, inputArea.width(), inputArea.height()), Common::Point(inputArea.left, inputArea.top)); +		_font->writeString(&_vm->_screen, _textInput, +			Common::Point(inputArea.left + 2, inputArea.top + 1), 1); +		_vm->_screen.copyRectToScreen(inputArea); +		_vm->_screen.updateScreen();  	} -	_vm->_events->_pendingKeys.clear(); +	origInput->free(); +	delete origInput;  } +bool CopyProtectionDialog::isCorrectAnswer() { +	return _hogEntry._word == _textInput; +} + +  bool CopyProtectionDialog::getHogAnusEntry(HOGANUS &entry) {  	File f;  	f.open("*HOGANUS.DAT"); @@ -552,6 +593,7 @@ void PictureDialog::save() {  void PictureDialog::restore() {  	if (_savedSurface) {  		_savedSurface->copyTo(&_vm->_screen); +		_savedSurface->free();  		delete _savedSurface;  		_savedSurface = nullptr;  | 
