From 3442ea1582869c38c7f122a6586b27baac9bdebb Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Wed, 7 Feb 2007 13:08:17 +0000 Subject: - Fixed another freeze in Ween - Changed cursor visibility handling a bit svn-id: r25407 --- engines/gob/draw.cpp | 1 + engines/gob/draw_v2.cpp | 25 +++++-------------------- engines/gob/game.cpp | 4 +++- engines/gob/game.h | 12 ++++++------ engines/gob/game_v1.cpp | 2 +- engines/gob/game_v2.cpp | 2 +- engines/gob/inter_v1.cpp | 10 +++++++--- 7 files changed, 24 insertions(+), 32 deletions(-) diff --git a/engines/gob/draw.cpp b/engines/gob/draw.cpp index d1d19d0179..2d84800360 100644 --- a/engines/gob/draw.cpp +++ b/engines/gob/draw.cpp @@ -248,6 +248,7 @@ void Draw::invalidateRect(int16 left, int16 top, int16 right, int16 bottom) { void Draw::blitInvalidated(void) { int16 i; + if (_cursorIndex == 4) blitCursor(); diff --git a/engines/gob/draw_v2.cpp b/engines/gob/draw_v2.cpp index 77e95921b7..c703888e0d 100644 --- a/engines/gob/draw_v2.cpp +++ b/engines/gob/draw_v2.cpp @@ -818,8 +818,7 @@ void Draw_v2::blitCursor(void) { if (_cursorIndex == -1) return; - if (_showCursor == 2) - _showCursor = 0; + _showCursor = (_showCursor & ~2) | ((_showCursor & 1) << 1); } void Draw_v2::animateCursor(int16 cursor) { @@ -832,16 +831,7 @@ void Draw_v2::animateCursor(int16 cursor) { int16 maxY; int16 cursorIndex; - _showCursor |= 2; - - /* - if (((_backSurface->width - 9) < _vm->_global->_inter_mouseX) || - ((_backSurface->height - 4) < _vm->_global->_inter_mouseY)) { - _vm->_global->_inter_mouseX = MIN((int) _vm->_global->_inter_mouseX, _backSurface->width - 9); - _vm->_global->_inter_mouseY = MIN((int) _vm->_global->_inter_mouseY, _backSurface->height - 4); - _vm->_util->setMousePos(_vm->_global->_inter_mouseX, _vm->_global->_inter_mouseY); - } - */ + _showCursor |= 1; // .-- _draw_animateCursorSUB1 --- cursorIndex = cursor; @@ -891,8 +881,6 @@ void Draw_v2::animateCursor(int16 cursor) { } else { if ((_noInvalidated != 0) && (_vm->_global->_inter_mouseX == _cursorX) && (_vm->_global->_inter_mouseY == _cursorY)) { - if (!CursorMan.isVisible()) - _showCursor = 0; _vm->_video->waitRetrace(_vm->_global->_videoMode); return; } @@ -932,26 +920,23 @@ void Draw_v2::animateCursor(int16 cursor) { CursorMan.replaceCursor(_scummvmCursor->vidPtr, _cursorWidth, _cursorHeight, 0, 0, 0); if (_frontSurface != _backSurface) { - _showCursor |= 1; if (_noInvalidated == 0) { - _showCursor = CursorMan.isVisible() ? 2 : 0; int16 tmp = _cursorIndex; _cursorIndex = -1; blitInvalidated(); _cursorIndex = tmp; } else { + _showCursor = 3; _vm->_video->waitRetrace(_vm->_global->_videoMode); if (minY < 50) _vm->_util->delay(5); - _showCursor = (_showCursor & ~2) | ((_showCursor & 1) << 1); } - _showCursor &= ~1; } } else blitCursor(); - if (CursorMan.isVisible()) - _showCursor = 2; + _showCursor &= ~1; + _cursorX = newX; _cursorY = newY; } diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp index 87e1eef48b..f28f91e36f 100644 --- a/engines/gob/game.cpp +++ b/engines/gob/game.cpp @@ -754,7 +754,7 @@ void Game::setCollisions(void) { } } -void Game::collSub(int16 offset) { +void Game::collSub(uint16 offset) { char *savedIP; int16 collStackSize; @@ -1156,6 +1156,8 @@ void Game::playImd(int16 frame, int16 arg_2, int16 arg_4, int16 arg_6, int16 arg Video::SurfaceDesc *surfDescBak; Video::SurfaceDesc frontSurfBak; + _vm->_draw->_showCursor = 0; + int8 byte_31344 = 0; if ((frame < 0) || (frame > lastFrame)) diff --git a/engines/gob/game.h b/engines/gob/game.h index 70a5807f4e..3bc60fc818 100644 --- a/engines/gob/game.h +++ b/engines/gob/game.h @@ -43,8 +43,8 @@ public: int16 bottom; int16 flags; int16 key; - int16 funcEnter; - int16 funcLeave; + uint16 funcEnter; + uint16 funcLeave; int16 field_12; // New in GOB2 }; @@ -230,7 +230,7 @@ public: virtual void playTot(int16 skipPlay) = 0; virtual void clearCollisions(void) = 0; virtual int16 addNewCollision(int16 id, int16 left, int16 top, int16 right, - int16 bottom, int16 flags, int16 key, int16 funcEnter, int16 funcLeave) = 0; + int16 bottom, int16 flags, int16 key, uint16 funcEnter, uint16 funcLeave) = 0; virtual void collisionsBlock(void) = 0; virtual int16 multiEdit(int16 time, int16 index, int16 *pCurPos, InputDesc *inpDesc, int16 *collResId, int16 *collIndex) = 0; @@ -274,7 +274,7 @@ protected: GobEngine *_vm; void setCollisions(void); - void collSub(int16 offset); + void collSub(uint16 offset); void collAreaSub(int16 index, int8 enter); int16 openLocTextFile(char *locTextFile, int language); @@ -288,7 +288,7 @@ public: virtual void playTot(int16 skipPlay); virtual void clearCollisions(void); virtual int16 addNewCollision(int16 id, int16 left, int16 top, int16 right, - int16 bottom, int16 flags, int16 key, int16 funcEnter, int16 funcLeave); + int16 bottom, int16 flags, int16 key, uint16 funcEnter, uint16 funcLeave); virtual void collisionsBlock(void); virtual int16 multiEdit(int16 time, int16 index, int16 *pCurPos, InputDesc *inpDesc, int16 *collResId, int16 *collIndex); @@ -313,7 +313,7 @@ public: virtual void playTot(int16 skipPlay); virtual void clearCollisions(void); virtual int16 addNewCollision(int16 id, int16 left, int16 top, int16 right, - int16 bottom, int16 flags, int16 key, int16 funcEnter, int16 funcLeave); + int16 bottom, int16 flags, int16 key, uint16 funcEnter, uint16 funcLeave); virtual void collisionsBlock(void); virtual int16 multiEdit(int16 time, int16 index, int16 *pCurPos, InputDesc *inpDesc, int16 *collResId, int16 *collIndex); diff --git a/engines/gob/game_v1.cpp b/engines/gob/game_v1.cpp index 2ae9406c26..83b74a898c 100644 --- a/engines/gob/game_v1.cpp +++ b/engines/gob/game_v1.cpp @@ -262,7 +262,7 @@ void Game_v1::clearCollisions() { } int16 Game_v1::addNewCollision(int16 id, int16 left, int16 top, int16 right, int16 bottom, - int16 flags, int16 key, int16 funcEnter, int16 funcLeave) { + int16 flags, int16 key, uint16 funcEnter, uint16 funcLeave) { int16 i; Collision *ptr; diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp index 9dff07a6dd..e8b5b67ebc 100644 --- a/engines/gob/game_v2.cpp +++ b/engines/gob/game_v2.cpp @@ -308,7 +308,7 @@ void Game_v2::clearCollisions() { } int16 Game_v2::addNewCollision(int16 id, int16 left, int16 top, int16 right, int16 bottom, - int16 flags, int16 key, int16 funcEnter, int16 funcLeave) { + int16 flags, int16 key, uint16 funcEnter, uint16 funcLeave) { int16 i; Collision *ptr; diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp index 8f7948b92e..5cdb0d5d53 100644 --- a/engines/gob/inter_v1.cpp +++ b/engines/gob/inter_v1.cpp @@ -950,6 +950,7 @@ void Inter_v1::o1_initCursor(void) { void Inter_v1::o1_initCursorAnim(void) { int16 ind; + _vm->_draw->_showCursor = 3; ind = _vm->_parse->parseValExpr(); _vm->_draw->_cursorAnimLow[ind] = load16(); _vm->_draw->_cursorAnimHigh[ind] = load16(); @@ -959,6 +960,7 @@ void Inter_v1::o1_initCursorAnim(void) { void Inter_v1::o1_clearCursorAnim(void) { int16 ind; + _vm->_draw->_showCursor = 0; ind = _vm->_parse->parseValExpr(); _vm->_draw->_cursorAnimLow[ind] = -1; _vm->_draw->_cursorAnimHigh[ind] = 0; @@ -1530,6 +1532,7 @@ bool Inter_v1::o1_keyFunc(char &cmdCount, int16 &counter, int16 &retFlag) { storeKey(key); return false; } else { + _vm->_draw->_showCursor &= ~2; _vm->_util->longDelay(1); key = _vm->_game->checkCollisions(0, 0, 0, 0); storeKey(key); @@ -1814,11 +1817,12 @@ void Inter_v1::o1_freeFontToSprite(void) { } bool Inter_v1::o1_callSub(char &cmdCount, int16 &counter, int16 &retFlag) { - char *storedIP = _vm->_global->_inter_execPtr; + char *storedIP; + uint32 offset; -// _vm->_global->_inter_execPtr = (char *)_vm->_game->_totFileData + READ_LE_UINT16(_vm->_global->_inter_execPtr); + storedIP = _vm->_global->_inter_execPtr; + offset = READ_LE_UINT16(_vm->_global->_inter_execPtr); - uint16 offset = READ_LE_UINT16(_vm->_global->_inter_execPtr); debugC(5, kDebugGameFlow, "tot = \"%s\", offset = %d", _vm->_game->_curTotFile, offset); // Skipping the copy protection screen in Gobliiins -- cgit v1.2.3