diff options
| author | Paul Gilbert | 2014-08-24 16:49:57 -0400 | 
|---|---|---|
| committer | Paul Gilbert | 2014-08-24 16:49:57 -0400 | 
| commit | ce97ba5587daecd262f44cd240efb23f6bd24e8b (patch) | |
| tree | 370c8b7555a8d9276d6c205c04bf99e9e3167fb0 /engines | |
| parent | e53417f91a1305cfb69ef57dd97a5f8fe5311eee (diff) | |
| download | scummvm-rg350-ce97ba5587daecd262f44cd240efb23f6bd24e8b.tar.gz scummvm-rg350-ce97ba5587daecd262f44cd240efb23f6bd24e8b.tar.bz2 scummvm-rg350-ce97ba5587daecd262f44cd240efb23f6bd24e8b.zip | |
ACCeSS: Fix display of items in inventory screen
Diffstat (limited to 'engines')
| -rw-r--r-- | engines/access/inventory.cpp | 43 | ||||
| -rw-r--r-- | engines/access/inventory.h | 9 | 
2 files changed, 45 insertions, 7 deletions
| diff --git a/engines/access/inventory.cpp b/engines/access/inventory.cpp index 1bafdf56c3..f4236cc385 100644 --- a/engines/access/inventory.cpp +++ b/engines/access/inventory.cpp @@ -36,7 +36,7 @@ InventoryManager::InventoryManager(AccessEngine *vm) : Manager(vm) {  	_invModeFlag = false;  	_startAboutItem = 0;  	_startTravelItem = 0; -	_iconDisplayFlag = false; +	_iconDisplayFlag = true;  	const char *const *names;  	switch (vm->getGameID()) { @@ -57,7 +57,7 @@ InventoryManager::InventoryManager(AccessEngine *vm) : Manager(vm) {  	for (uint i = 0; i < 26; ++i) {  		const int *r = INVCOORDS[i]; -		_invCoords.push_back(Common::Rect(r[0], r[1], r[0] + r[2], r[1] + r[3])); +		_invCoords.push_back(Common::Rect(r[0], r[2], r[1], r[3]));  	}  } @@ -99,7 +99,7 @@ int InventoryManager::newDisplayInv() {  	getList();  	initFields(); -	_vm->_files->loadScreen(&_vm->_buffer1, 99, 0); +	files.loadScreen(&_vm->_buffer1, 99, 0);  	_vm->_buffer1.copyTo(&_vm->_buffer2);  	_vm->copyBF2Vid(); @@ -247,9 +247,13 @@ void InventoryManager::initFields() {  void InventoryManager::getList() {  	_items.clear(); +	_tempLOff.clear(); +  	for (uint i = 0; i < _inv.size(); ++i) { -		if (_inv[i]) +		if (_inv[i]) {  			_items.push_back(i); +			_tempLOff.push_back(_names[i]); +		}  	}  } @@ -265,7 +269,7 @@ void InventoryManager::putInvIcon(int itemIndex, int itemId) {  	_vm->_buffer2.plotImage(spr, itemId, pt);  	if (_iconDisplayFlag) { -		_vm->_buffer1.copyBlock(&_vm->_buffer2, Common::Rect(pt.x, pt.y, pt.x + 46, pt.y + 35)); +		_vm->_screen->copyBlock(&_vm->_buffer2, Common::Rect(pt.x, pt.y, pt.x + 46, pt.y + 35));  	}  } @@ -287,7 +291,12 @@ void InventoryManager::chooseItem() {  				_vm->_useItem = -1;  			break;  		} else if (selIndex < (int)_items.size()) { -			warning("TODO: Combine items"); +			_boxNum = selIndex; +			_vm->copyBF2Vid(); +			combineItems(); +			_vm->copyBF2Vid(); +			outlineIcon(_boxNum); +			_vm->_useItem = _items[_boxNum];  		}  	}  } @@ -311,6 +320,8 @@ int InventoryManager::coordIndexOf() {  void InventoryManager::saveScreens() {  	_vm->_buffer1.copyTo(&_savedBuffer1);  	_vm->_screen->copyTo(&_savedScreen); +	_vm->_newRects.push_back(Common::Rect(0, 0, _savedScreen.w, _savedScreen.h)); +	  }  void InventoryManager::restoreScreens() { @@ -319,4 +330,24 @@ void InventoryManager::restoreScreens() {  	_savedScreen.copyTo(_vm->_screen);  } +void InventoryManager::outlineIcon(int itemIndex) { +	Screen &screen = *_vm->_screen; +	screen.frameRect(_invCoords[itemIndex], 7); + +	Common::String s = _tempLOff[itemIndex]; +	Font &font = _vm->_fonts._font2; +	int strWidth = font.stringWidth(s); + +	font._fontColors[0] = 0; +	font._fontColors[1] = 10; +	font._fontColors[2] = 11; +	font._fontColors[3] = 12; +	font.drawString(&screen, s, Common::Point((screen.w - strWidth) / 2, 184)); +} + +void InventoryManager::combineItems() { +	warning("TODO: combineItems"); +} + +  } // End of namespace Access diff --git a/engines/access/inventory.h b/engines/access/inventory.h index 255b6dce40..a95581c2d0 100644 --- a/engines/access/inventory.h +++ b/engines/access/inventory.h @@ -58,6 +58,10 @@ private:  	ASurface _savedScreen;  	SavedFields _fields;  	bool _iconDisplayFlag; +	Common::StringArray _names; +	Common::Array<int> _tempLPtr; +	Common::StringArray _tempLOff; +	int _boxNum;  	void savedFields(); @@ -80,9 +84,12 @@ private:  	void saveScreens();  	void restoreScreens(); + +	void outlineIcon(int itemIndex); + +	void combineItems();  public:  	Common::Array<int> _inv; -	Common::StringArray _names;  	int _startInvItem;  	int _startInvBox;  	bool _invChangeFlag; | 
