diff options
| author | lukaslw | 2014-06-12 23:57:45 +0200 | 
|---|---|---|
| committer | lukaslw | 2014-06-22 20:08:59 +0200 | 
| commit | 8fd44cbbf3e0d34c71ab2b65d0e861a0e5a6c169 (patch) | |
| tree | 5540140edbad8c40f64cf0b83dc27d8344c97439 | |
| parent | 5163d6ce4e4e793491fc15416892bf7b0ed16dcc (diff) | |
| download | scummvm-rg350-8fd44cbbf3e0d34c71ab2b65d0e861a0e5a6c169.tar.gz scummvm-rg350-8fd44cbbf3e0d34c71ab2b65d0e861a0e5a6c169.tar.bz2 scummvm-rg350-8fd44cbbf3e0d34c71ab2b65d0e861a0e5a6c169.zip | |
PRINCE: Option window texts drawing and highlighting
| -rw-r--r-- | engines/prince/option_text.h | 84 | ||||
| -rw-r--r-- | engines/prince/prince.cpp | 47 | ||||
| -rw-r--r-- | engines/prince/prince.h | 7 | 
3 files changed, 135 insertions, 3 deletions
| diff --git a/engines/prince/option_text.h b/engines/prince/option_text.h new file mode 100644 index 0000000000..0904704547 --- /dev/null +++ b/engines/prince/option_text.h @@ -0,0 +1,84 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +namespace Prince { + +// Mazovia coding (with U2 negation) + +const char invOptionsTextPL[5][18] = { +	{ 'O', 'b', 'e', 'j', 'r', 'z', 'y', 'j', '\0' },  +	{ 'U', -89, 'y', 'j', '\0' }, +	{ 'O', 't', 'w', -94, 'r', 'z', '/', 'P', 'c', 'h', 'n', 'i', 'j', '\0' }, +	{ 'Z', 'a', 'm', 'k', 'n', 'i', 'j', '/', 'P', 'o', 'c', 'i', -122, 'g', 'n', 'i', 'j', '\0' }, +	{ 'D', 'a', 'j', '\0' } +}; + +// TODO +const char *invOptionsTextDE[] = { +	"Anschauen", +	"Benutzen", +	"Öffnen/Stoßen", +	"Schließen/Ziehen", +	"Geben" +}; + +const char *invOptionsTextEN[] = { +	"Examine", +	"Use", +	"Open/Push", +	"Close/Pull", +	"Give" +}; + +const char optionsTextPL[7][18] = { +	{ 'P', 'o', 'd', 'e', 'j', 'd', -90, '\0' }, +	{ 'O', 'b', 'e', 'j', 'r', 'z', 'y', 'j', '\0' }, +	{ 'Z', 'a', 'b', 'i', 'e', 'r', 'z', '\0' }, +	{ 'U', -89, 'y', 'j' }, +	{ 'O', 't', 'w', -94, 'r', 'z', '/', 'P', 'c', 'h', 'n', 'i', 'j', '\0' }, +	{ 'Z', 'a', 'm', 'k', 'n', 'i', 'j', '/', 'P', 'o', 'c', 'i', -122, 'g', 'n', 'i', 'j', '\0' }, +	{ 'P', 'o', 'r', 'o', 'z', 'm', 'a', 'w', 'i', 'a', 'j', '\0' } +}; + +// TODO +const char *optionsTextDE[] = { +	"Hingehen", +	"Anschauen", +	"Wegnehmen", +	"Benutzen", +	"Öffnen/Stoßen", +	"Schließen/Ziehen", +	"Ansprechen" +}; + +const char *optionsTextEN[] = { +	"Walk to", +	"Examine", +	"Pick up", +	"Use", +	"Open/Push", +	"Close/Pull", +	"Talk to" +}; + +} + diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp index 68bc41269b..908d9dbe50 100644 --- a/engines/prince/prince.cpp +++ b/engines/prince/prince.cpp @@ -60,6 +60,7 @@  #include "prince/hero.h"  #include "prince/resource.h"  #include "prince/animation.h" +#include "prince/option_text.h"  namespace Prince { @@ -82,9 +83,10 @@ PrinceEngine::PrinceEngine(OSystem *syst, const PrinceGameDescription *gameDesc)  	_invLineX(134), _invLineY(176), _invLine(5), _invLines(3), _invLineW(70), _invLineH(76), _maxInvW(72), _maxInvH(76),  	_invLineSkipX(2), _invLineSkipY(3), _showInventoryFlag(false), _inventoryBackgroundRemember(false),  	_mst_shadow(0), _mst_shadow2(0), _candleCounter(0), _invX1(53), _invY1(18), _invWidth(536), _invHeight(438), -	_invCurInside(false), _optionsFlag(false), _optionEnabled(0), _invOptionsNumber(5), _invExamY(120), +	_invCurInside(false), _optionsFlag(false), _optionEnabled(0), _invExamY(120),  	_optionsMob(0), _currentPointerNumber(1), _selectedMob(0), _selectedItem(0), _selectedMode(0),  -	_optionsWidth(210), _optionsHeight(170), _invOptionsWidth(210), _invOptionsHeight(130) { +	_optionsWidth(210), _optionsHeight(170), _invOptionsWidth(210), _invOptionsHeight(130), _optionsStep(20), +	_invOptionsStep(20), _optionsNumber(7), _invOptionsNumber(5), _optionsColor1(0xFF00EC), _optionsColor2(0xFF00FC) {  	// Debug/console setup  	DebugMan.addDebugChannel(DebugChannel::kScript, "script", "Prince Script debug channel"); @@ -1666,6 +1668,47 @@ void PrinceEngine::checkInvOptions() {  			return;  		}  		_graph->drawAsShadowSurface(_graph->_screenForInventory, _optionsX, _optionsY, _optionsPicInInventory, _graph->_shadowTable50); + +		_optionEnabled = -1; +		int optionsYCord = mousePos.y - (_optionsY + 16); +		if (optionsYCord >= 0) { +			int selectedOptionNr = optionsYCord / _invOptionsStep; +			if (selectedOptionNr < _optionsNumber) { +				_optionEnabled = selectedOptionNr; +			} +		} +		//NoBackgroundFlag = 1; +		//int eax = _optionsX + _invOptionsWidth / 2; +		//int ecx = _optionsNumber; +		int optionsColor; +		int textY = _optionsY + 16; +		for (int i = 0; i < _invOptionsNumber; i++) { +			if (i != _optionEnabled) { +				optionsColor = _optionsColor1; +			} else { +				optionsColor = _optionsColor2; +			} +			Common::String invText; +			switch(getLanguage()) { +			case Common::PL_POL: +				invText = invOptionsTextPL[i]; +				break; +			case Common::DE_DEU: +				invText = invOptionsTextDE[i]; +				break; +			case Common::EN_ANY: +				invText = invOptionsTextEN[i]; +				break; +			}; +			uint16 textW = 0; +			for (uint16 i = 0; i < invText.size(); i++) { +				textW += _font->getCharWidth(invText[i]); +			} +			uint16 textX = _optionsX + _optionsWidth / 2 - textW / 2; +			_font->drawString(_graph->_screenForInventory, invText, textX, textY, _graph->_screenForInventory->w, optionsColor); +			textY += _invOptionsStep; +		} +		//NoBackgroundFlag = 1;  	}  } diff --git a/engines/prince/prince.h b/engines/prince/prince.h index 172aa565ed..6ec49dad65 100644 --- a/engines/prince/prince.h +++ b/engines/prince/prince.h @@ -295,9 +295,14 @@ public:  	int _optionsHeight;  	int _invOptionsWidth;  	int _invOptionsHeight; +	int _optionsStep; +	int _invOptionsStep; +	int _optionsNumber; +	int _invOptionsNumber; +	int _optionsColor1; // color for non-selected options +	int _optionsColor2; // color for selected option  	bool _showInventoryFlag; -	int _invOptionsNumber;  	int _invExamY;  	bool _inventoryBackgroundRemember;  	int _invLineX; | 
