diff options
author | lukaslw | 2014-06-06 13:28:14 +0200 |
---|---|---|
committer | lukaslw | 2014-06-22 20:08:43 +0200 |
commit | 5309e52259d65899015af6e9bdaed578f9d52b52 (patch) | |
tree | 5e5b081d66ab617853a5af5574f5c92a8fdd6870 | |
parent | bb85844e7336baaa09fe7edcf16007c7ebe259d9 (diff) | |
download | scummvm-rg350-5309e52259d65899015af6e9bdaed578f9d52b52.tar.gz scummvm-rg350-5309e52259d65899015af6e9bdaed578f9d52b52.tar.bz2 scummvm-rg350-5309e52259d65899015af6e9bdaed578f9d52b52.zip |
PRINCE: Items in inventory - drawing position fix
-rw-r--r-- | engines/prince/prince.cpp | 19 | ||||
-rw-r--r-- | engines/prince/prince.h | 3 |
2 files changed, 15 insertions, 7 deletions
diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp index a535e4f234..6e3b22e07b 100644 --- a/engines/prince/prince.cpp +++ b/engines/prince/prince.cpp @@ -79,8 +79,8 @@ PrinceEngine::PrinceEngine(OSystem *syst, const PrinceGameDescription *gameDesc) _locationNr(0), _debugger(nullptr), _midiPlayer(nullptr), _room(nullptr), testAnimNr(0), testAnimFrame(0), _frameNr(0), _cursor1(nullptr), _cursor2(nullptr), _font(nullptr), _suitcaseBmp(nullptr), _roomBmp(nullptr), _cursorNr(0), _picWindowX(0), _picWindowY(0), _randomSource("prince"), - _invLineX(134), _invLineY(176), _invLine(5), _invLines(3), _invLineW(70), _invLineH(76), _invLineSkipX(2), _invLineSkipY(3), - _showInventoryFlag(false), _inventoryBackgroundRemember(false) { + _invLineX(134), _invLineY(176), _invLine(5), _invLines(3), _invLineW(70), _invLineH(76), _maxInvW(72), _maxInvH(76), + _invLineSkipX(2), _invLineSkipY(3), _showInventoryFlag(false), _inventoryBackgroundRemember(false) { // Debug/console setup DebugMan.addDebugChannel(DebugChannel::kScript, "script", "Prince Script debug channel"); @@ -1262,7 +1262,6 @@ void PrinceEngine::drawScreen() { } void PrinceEngine::rememberScreenInv() { - _backgroundForInventory = _graph->_frontScreen; } void PrinceEngine::inventoryFlagChange() { @@ -1330,7 +1329,16 @@ void PrinceEngine::drawInvItems() { //if (_mainHero->_inventory[item] != 0) { int itemNr = _mainHero->_inventory[item]; if (itemNr != 68) { - _graph->drawTransparentSurface(currInvX, currInvY, _allInvList[itemNr].getSurface(), 0); + Graphics::Surface *itemSurface = _allInvList[itemNr].getSurface(); + int drawX = currInvX; + int drawY = currInvY; + if (itemSurface->w < _maxInvW) { + drawX += (_maxInvW - itemSurface->w) / 2; + } + if (itemSurface->h < _maxInvH) { + drawY += (_maxInvH - itemSurface->h) / 2; + } + _graph->drawTransparentSurface(drawX, drawY, itemSurface, 0); } else { // candle item: } @@ -1345,6 +1353,7 @@ void PrinceEngine::drawInvItems() { } void PrinceEngine::displayInventory() { + // temp: _mainHero->_inventory.clear(); _mainHero->_inventory.push_back(0); _mainHero->_inventory.push_back(1); @@ -1355,7 +1364,7 @@ void PrinceEngine::displayInventory() { prepareInventoryToView(); - _graph->drawTransparentSurface(0, 0, _backgroundForInventory, 0); + _graph->drawTransparentSurface(0, 0, _graph->_frontScreen, 0); Graphics::Surface *suitcase = _suitcaseBmp->getSurface(); _graph->drawTransparentSurface(0, 0, suitcase, 0); diff --git a/engines/prince/prince.h b/engines/prince/prince.h index 6919587271..036043ff13 100644 --- a/engines/prince/prince.h +++ b/engines/prince/prince.h @@ -284,6 +284,7 @@ public: int _invLineW; int _invLineH; int _maxInvW; + int _maxInvH; int _invLineSkipX; int _invLineSkipY; @@ -294,8 +295,6 @@ public: void drawInvItems(); void displayInventory(); - Graphics::Surface *_backgroundForInventory; - int testAnimNr; int testAnimFrame; |