Skip to content

Commit

Permalink
PRINCE: Inventory closing - mouse handling
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaslw committed Jun 22, 2014
1 parent 2f1c6ce commit 206211c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
23 changes: 22 additions & 1 deletion engines/prince/prince.cpp
Expand Up @@ -81,7 +81,8 @@ PrinceEngine::PrinceEngine(OSystem *syst, const PrinceGameDescription *gameDesc)
_suitcaseBmp(nullptr), _roomBmp(nullptr), _cursorNr(0), _picWindowX(0), _picWindowY(0), _randomSource("prince"),
_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) {
_mst_shadow(0), _mst_shadow2(0), _candleCounter(0), _invX1(53), _invY1(18), _invWidth(536), _invHeight(438),
_invCurInside(false) {

// Debug/console setup
DebugMan.addDebugChannel(DebugChannel::kScript, "script", "Prince Script debug channel");
Expand Down Expand Up @@ -1450,6 +1451,26 @@ void PrinceEngine::displayInventory() {
_graph->drawTransparentSurface(0, 0, suitcase, 0);

drawInvItems();

Common::Rect _inventoryRect;
_inventoryRect.left = _invX1;
_inventoryRect.top = _invY1;
_inventoryRect.right = _invX1 + _invWidth;
_inventoryRect.bottom = _invY1 + _invHeight;
Common::Point mousePos = _system->getEventManager()->getMousePos();

if (!_invCurInside && _inventoryRect.contains(mousePos)) {
_invCurInside = true;
}

if (_invCurInside && !_inventoryRect.contains(mousePos)) {
inventoryFlagChange();
_invCurInside = false;
}
}

void PrinceEngine::makeInvCursor() {

}

void PrinceEngine::mainLoop() {
Expand Down
6 changes: 6 additions & 0 deletions engines/prince/prince.h
Expand Up @@ -290,6 +290,11 @@ class PrinceEngine : public Engine {
int _maxInvH;
int _invLineSkipX;
int _invLineSkipY;
int _invX1;
int _invY1;
int _invWidth;
int _invHeight;
bool _invCurInside;
int _mst_shadow;
int _mst_shadow2; // blinking after adding new item
int _candleCounter; // special counter for candle inventory item
Expand All @@ -301,6 +306,7 @@ class PrinceEngine : public Engine {
void drawInvItems();
void displayInventory();
void addInvObj();
void makeInvCursor();

int testAnimNr;
int testAnimFrame;
Expand Down

0 comments on commit 206211c

Please sign in to comment.