From e075f0539568c5d14a61889a0233558376cdb5ce Mon Sep 17 00:00:00 2001 From: Arnaud Boutonné Date: Tue, 17 Aug 2010 08:33:50 +0000 Subject: Gob - Clean up: suppress blanks and tabs present at the end of line svn-id: r52136 --- engines/gob/hotspots.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engines/gob/hotspots.cpp') diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index 1edb7fc0cb..1563a39394 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -1393,9 +1393,9 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, ids[i] = _vm->_game->_script->readInt16(); flags = _vm->_game->_script->readInt16(); - if (flags > 3) + if (flags > 3) warning("evaluateNew: Warning, use of type 2 or 20. flags = %d, should be %d\n", flags, flags&3); - + funcEnter = 0; funcLeave = _vm->_game->_script->pos(); @@ -1424,7 +1424,7 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, } bool Hotspots::evaluateFind(uint16 key, int16 timeVal, const uint16 *ids, - uint16 leaveWindowIndex, uint16 hotspotIndex1, uint16 hotspotIndex2, + uint16 leaveWindowIndex, uint16 hotspotIndex1, uint16 hotspotIndex2, uint16 endIndex, int16 &duration, uint16 &id, uint16 &index, bool &finished) { bool fascinCheck = false; @@ -1678,7 +1678,7 @@ int16 Hotspots::findCursor(uint16 x, uint16 y) const { cursor = 0; for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) { const Hotspot &spot = _hotspots[i]; - // this check is /really/ Fascination specific. + // this check is /really/ Fascination specific. // It's illogical, so if it's to be reused in Adi games... Be careful! if ((spot.flags & 0xFF00) == curType) if (spot.isIn(x - deltax, y - deltay)) { -- cgit v1.2.3 From b37b0d9b0ccb534f619c2090255bd685b6d85699 Mon Sep 17 00:00:00 2001 From: Arnaud Boutonné Date: Tue, 17 Aug 2010 16:27:56 +0000 Subject: Fascination - Suppress some debug messages svn-id: r52160 --- engines/gob/hotspots.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'engines/gob/hotspots.cpp') diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index 1563a39394..ad7a678359 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -1232,7 +1232,6 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, height = _vm->_game->_script->readUint16(); } if (_vm->_draw->_renderFlags & 64) { - warning("_renderFlags check added for Fascination"); _vm->_draw->_invalidatedTops[0] = 0; _vm->_draw->_invalidatedLefts[0] = 0; _vm->_draw->_invalidatedRights[0] = 319; -- cgit v1.2.3 From 67c1997bf4cb154d0fb59290d96fa4d5c439581c Mon Sep 17 00:00:00 2001 From: Arnaud Boutonné Date: Thu, 19 Aug 2010 21:32:54 +0000 Subject: Fascination - Fix protection screen (and several other glitches like in the very last screen behavior) svn-id: r52217 --- engines/gob/hotspots.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'engines/gob/hotspots.cpp') diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index ad7a678359..ba0a65f4d4 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -778,9 +778,11 @@ uint16 Hotspots::check(uint8 handleMouse, int16 delay, uint16 &id, uint16 &index ((delay <= 0) || (_vm->_game->_mouseButtons == kMouseButtonsNone))) _vm->_draw->blitCursor(); + + if ((key != _currentKey) && (_vm->getGameType() != kGameTypeFascination)) // If the hotspot changed, leave the old one - if (key != _currentKey) - leave(_currentIndex); + // Code not present in Fascination executables + leave(_currentIndex); _currentKey = 0; break; @@ -800,11 +802,9 @@ uint16 Hotspots::check(uint8 handleMouse, int16 delay, uint16 &id, uint16 &index enter(_currentIndex); } else { WRITE_VAR(16, (int32)i); - if (id) - id = 0; - if (index) - index = 0; - return(0); + id = 0; + index = 0; + return 0; } } else // No mouse button pressed, check whether the position changed at least -- cgit v1.2.3 From 5cd3ea41db71b4521954cd65bc9775c1bbeabb9f Mon Sep 17 00:00:00 2001 From: Arnaud Boutonné Date: Sat, 21 Aug 2010 18:16:04 +0000 Subject: GOB: Clean up of Fascination code Move Fascination specific function to appropriate classes, plus some style modifications svn-id: r52267 --- engines/gob/hotspots.cpp | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'engines/gob/hotspots.cpp') diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index ba0a65f4d4..78b3553aeb 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -431,9 +431,10 @@ void Hotspots::pop() { // Find the end of the filled hotspot space int i; Hotspot *destPtr = _hotspots; - for (i = 0; i < kHotspotCount; i++, destPtr++) + for (i = 0; i < kHotspotCount; i++, destPtr++) { if (destPtr->isEnd()) break; + } if (((uint32) (kHotspotCount - i)) < backup.size) error("Hotspots::pop(): Not enough free space in the current Hotspot " @@ -525,12 +526,12 @@ void Hotspots::leave(uint16 index) { int16 Hotspots::curWindow(int16 &dx, int16 &dy) const { if ((_vm->_draw->_renderFlags & 0x80)==0) return(0); - for (int i = 0; i < 10; i++) - if (_vm->_draw->_fascinWin[i].id != -1) + for (int i = 0; i < 10; i++) { + if (_vm->_draw->_fascinWin[i].id != -1) { if (_vm->_global->_inter_mouseX >= _vm->_draw->_fascinWin[i].left && _vm->_global->_inter_mouseX < _vm->_draw->_fascinWin[i].left + _vm->_draw->_fascinWin[i].width && _vm->_global->_inter_mouseY >= _vm->_draw->_fascinWin[i].top && - _vm->_global->_inter_mouseY < _vm->_draw->_fascinWin[i].top + _vm->_draw->_fascinWin[i].height) + _vm->_global->_inter_mouseY < _vm->_draw->_fascinWin[i].top + _vm->_draw->_fascinWin[i].height) { if (_vm->_draw->_fascinWin[i].id == _vm->_draw->_winCount-1) { dx = _vm->_draw->_fascinWin[i].left; dy = _vm->_draw->_fascinWin[i].top; @@ -546,6 +547,9 @@ int16 Hotspots::curWindow(int16 &dx, int16 &dy) const { return(6); return(-i); } + } + } + } return(0); } @@ -555,10 +559,7 @@ uint16 Hotspots::checkMouse(Type type, uint16 &id, uint16 &index) const { int16 dx = 0; int16 dy = 0; - int16 winId = -1; - - if (_vm->getGameType() == kGameTypeFascination) - winId = _vm->_draw->isOverWin(dx, dy); + int16 winId = _vm->_draw->getWinFromCoord(dx, dy); if (winId < 0) { winId = 0; @@ -753,11 +754,8 @@ uint16 Hotspots::check(uint8 handleMouse, int16 delay, uint16 &id, uint16 &index if (_vm->_game->_mouseButtons != kMouseButtonsNone) { // Mouse button pressed - int i; - if (_vm->getGameType() == kGameTypeFascination) - i = _vm->_draw->handleCurWin(); - else - i = 0; + int i = _vm->_draw->handleCurWin(); + if (!i) { _vm->_draw->animateCursor(2); if (delay > 0) { @@ -1242,7 +1240,7 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, _vm->_video->drawLine(*_vm->_draw->_spritesArray[_vm->_draw->_destSurface], left, top, left, top + height - 1, 0); _vm->_video->drawLine(*_vm->_draw->_spritesArray[_vm->_draw->_destSurface], left, top, left + width - 1, top, 0); _vm->_video->drawLine(*_vm->_draw->_spritesArray[_vm->_draw->_destSurface], left, top + height - 1, left + width - 1, top + height - 1, 0); - } else + } else { if ((_vm->_draw->_fascinWin[windowNum].id != -1) && (_vm->_draw->_fascinWin[windowNum].id == _vm->_draw->_winCount - 1)) { left += _vm->_draw->_fascinWin[windowNum].left; top += _vm->_draw->_fascinWin[windowNum].top; @@ -1253,6 +1251,7 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, left -= _vm->_draw->_fascinWin[windowNum].left; top -= _vm->_draw->_fascinWin[windowNum].top; } + } } type &= 0x7F; @@ -1721,9 +1720,9 @@ void Hotspots::oPlaytoons_F_1B() { // var_4 += unk_var; for (int i = 0; i < kHotspotCount; i++) { - if (_hotspots[i].isEnd()) { + if (_hotspots[i].isEnd()) return; - } + if ((_hotspots[i].id == 0xD000 + shortId) || (_hotspots[i].id == 0xB000 + shortId) || (_hotspots[i].id == 0x4000 + shortId)) { longId = _hotspots[i].id; @@ -1744,7 +1743,6 @@ void Hotspots::oPlaytoons_F_1B() { right -= 2; bottom -= 2; } -// oPlaytoons_sub_F_1B(0x8000 + var2, left, top, right, bottom, _vm->_game->_script->getResultStr(), var3, var4, shortId); _vm->_draw->oPlaytoons_sub_F_1B(0x8000+ var2, left, top, right, bottom, _vm->_game->_script->getResultStr(), fontIndex, var4, shortId); return; } @@ -2052,7 +2050,6 @@ void Hotspots::matchInputStrings(const InputDesc *inputs) const { cleanFloatString(spot); if ((spot.getType() >= kTypeInput2NoLeave) && (spot.getType() <= kTypeInput3Leave)) { - // Look if we find a match between the wanted and the typed string checkStringMatch(spot, inputs[inputIndex], inputPos); strInputCount++; -- cgit v1.2.3 From 51fd528fe56e00466255d54e1e71b19f34729bfd Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Thu, 30 Sep 2010 13:02:16 +0000 Subject: GOB: Change all drawing to use class Surface svn-id: r52947 --- engines/gob/hotspots.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'engines/gob/hotspots.cpp') diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index 78b3553aeb..881481a341 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -1236,18 +1236,18 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, _vm->_draw->_invalidatedBottoms[0] = 199; _vm->_draw->_invalidatedCount = 1; if (windowNum == 0) { - _vm->_video->drawLine(*_vm->_draw->_spritesArray[_vm->_draw->_destSurface], left + width - 1, top, left + width - 1, top + height - 1, 0); - _vm->_video->drawLine(*_vm->_draw->_spritesArray[_vm->_draw->_destSurface], left, top, left, top + height - 1, 0); - _vm->_video->drawLine(*_vm->_draw->_spritesArray[_vm->_draw->_destSurface], left, top, left + width - 1, top, 0); - _vm->_video->drawLine(*_vm->_draw->_spritesArray[_vm->_draw->_destSurface], left, top + height - 1, left + width - 1, top + height - 1, 0); + _vm->_draw->_spritesArray[_vm->_draw->_destSurface]->drawLine(left + width - 1, top, left + width - 1, top + height - 1, 0); + _vm->_draw->_spritesArray[_vm->_draw->_destSurface]->drawLine(left, top, left, top + height - 1, 0); + _vm->_draw->_spritesArray[_vm->_draw->_destSurface]->drawLine(left, top, left + width - 1, top, 0); + _vm->_draw->_spritesArray[_vm->_draw->_destSurface]->drawLine(left, top + height - 1, left + width - 1, top + height - 1, 0); } else { if ((_vm->_draw->_fascinWin[windowNum].id != -1) && (_vm->_draw->_fascinWin[windowNum].id == _vm->_draw->_winCount - 1)) { left += _vm->_draw->_fascinWin[windowNum].left; top += _vm->_draw->_fascinWin[windowNum].top; - _vm->_video->drawLine(*_vm->_draw->_spritesArray[_vm->_draw->_destSurface], left + width - 1, top, left + width - 1, top + height - 1, 0); - _vm->_video->drawLine(*_vm->_draw->_spritesArray[_vm->_draw->_destSurface], left, top, left, top + height - 1, 0); - _vm->_video->drawLine(*_vm->_draw->_spritesArray[_vm->_draw->_destSurface], left, top, left + width - 1, top, 0); - _vm->_video->drawLine(*_vm->_draw->_spritesArray[_vm->_draw->_destSurface], left, top + height - 1, left + width - 1, top + height - 1, 0); + _vm->_draw->_spritesArray[_vm->_draw->_destSurface]->drawLine(left + width - 1, top, left + width - 1, top + height - 1, 0); + _vm->_draw->_spritesArray[_vm->_draw->_destSurface]->drawLine(left, top, left, top + height - 1, 0); + _vm->_draw->_spritesArray[_vm->_draw->_destSurface]->drawLine(left, top, left + width - 1, top, 0); + _vm->_draw->_spritesArray[_vm->_draw->_destSurface]->drawLine(left, top + height - 1, left + width - 1, top + height - 1, 0); left -= _vm->_draw->_fascinWin[windowNum].left; top -= _vm->_draw->_fascinWin[windowNum].top; } -- cgit v1.2.3 From 1d17a4157f068a988fd30e821c62cd2148e1a5f8 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Thu, 30 Sep 2010 13:04:14 +0000 Subject: GOB: Remove extra \n in debug warning()s svn-id: r52951 --- engines/gob/hotspots.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/gob/hotspots.cpp') diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index 881481a341..9525d420c6 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -1295,7 +1295,7 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, uint32 funcEnter = 0, funcLeave = 0; if ((windowNum != 0) && (type != 0) && (type != 2)) - warning("evaluateNew - type %d, win %d\n",type, windowNum); + warning("evaluateNew - type %d, win %d",type, windowNum); // Evaluate parameters for the new hotspot switch (type) { @@ -1392,7 +1392,7 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs, flags = _vm->_game->_script->readInt16(); if (flags > 3) - warning("evaluateNew: Warning, use of type 2 or 20. flags = %d, should be %d\n", flags, flags&3); + warning("evaluateNew: Warning, use of type 2 or 20. flags = %d, should be %d", flags, flags&3); funcEnter = 0; -- cgit v1.2.3 From 54b2a8c98df204dfe64a27fc830936ec62e3f9ed Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Tue, 12 Oct 2010 04:19:58 +0000 Subject: JANITORIAL: Cleanup (mostly whitespace) svn-id: r53161 --- engines/gob/hotspots.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines/gob/hotspots.cpp') diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index 9525d420c6..dad141a254 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -1516,7 +1516,7 @@ void Hotspots::evaluate() { int16 duration = _vm->_game->_script->peekByte(1); byte leaveWindowIndex = 0; - if ( _vm->getGameType() == kGameTypeFascination ) + if (_vm->getGameType() == kGameTypeFascination) leaveWindowIndex = _vm->_game->_script->peekByte(2); byte hotspotIndex1 = _vm->_game->_script->peekByte(3); @@ -1642,7 +1642,7 @@ int16 Hotspots::findCursor(uint16 x, uint16 y) const { int16 deltax = 0; int16 deltay = 0; - if ( _vm->getGameType() == kGameTypeFascination ) + if (_vm->getGameType() == kGameTypeFascination) cursor = curWindow(deltax, deltay); if (cursor == 0) { @@ -2106,7 +2106,7 @@ void Hotspots::fillRect(uint16 x, uint16 y, uint16 width, uint16 height, uint16 _vm->_draw->_spriteBottom = height; _vm->_draw->_backColor = color; - _vm->_draw->spriteOperation(DRAW_FILLRECT | 0x10 ); + _vm->_draw->spriteOperation(DRAW_FILLRECT | 0x10); } void Hotspots::printText(uint16 x, uint16 y, const char *str, uint16 fontIndex, uint16 color) const { -- cgit v1.2.3