From 83b27d263e1433a134b53b66919566c3192ca116 Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Sun, 19 Nov 2017 16:40:49 +0100 Subject: MOHAWK: RIVEN: Allow turning book pages more quickly Fixes #10075 --- engines/mohawk/riven_stacks/aspit.cpp | 47 +++++++++++++---------------------- engines/mohawk/riven_stacks/aspit.h | 1 + engines/mohawk/riven_stacks/bspit.cpp | 22 ++++++---------- engines/mohawk/riven_stacks/ospit.cpp | 22 ++++++---------- 4 files changed, 34 insertions(+), 58 deletions(-) (limited to 'engines/mohawk/riven_stacks') diff --git a/engines/mohawk/riven_stacks/aspit.cpp b/engines/mohawk/riven_stacks/aspit.cpp index a31aa902ec..67b416c9ca 100644 --- a/engines/mohawk/riven_stacks/aspit.cpp +++ b/engines/mohawk/riven_stacks/aspit.cpp @@ -106,22 +106,19 @@ void ASpit::xaatrusbookprevpage(const ArgumentArray &args) { uint32 &page = _vm->_vars["aatrusbook"]; // Keep turning pages while the mouse is pressed - bool firstPageTurn = true; - while (mouseIsDown() || firstPageTurn) { + while (keepTurningPages()) { // Check for the first page if (page == 1) return; - if (!pageTurn(kRivenTransitionWipeRight)) { - return; - } - // Update the page number page--; - firstPageTurn = false; + pageTurn(kRivenTransitionWipeRight); _vm->getCard()->drawPicture(page); _vm->doFrame(); + + waitForPageTurnSound(); } } @@ -130,22 +127,20 @@ void ASpit::xaatrusbooknextpage(const ArgumentArray &args) { uint32 &page = _vm->_vars["aatrusbook"]; // Keep turning pages while the mouse is pressed - bool firstPageTurn = true; - while ((mouseIsDown() || firstPageTurn) && !_vm->hasGameEnded()) { + while (keepTurningPages()) { // Check for the last page if (((_vm->getFeatures() & GF_DEMO) && page == 6) || page == 10) return; - if (!pageTurn(kRivenTransitionWipeLeft)) { - return; - } - // Update the page number page++; - firstPageTurn = false; + pageTurn(kRivenTransitionWipeLeft); _vm->getCard()->drawPicture(page); _vm->doFrame(); + + // Wait until the previous page turn sound completes + waitForPageTurnSound(); } } @@ -210,23 +205,19 @@ void ASpit::xacathbookprevpage(const ArgumentArray &args) { uint32 &page = _vm->_vars["acathbook"]; // Keep turning pages while the mouse is pressed - bool firstPageTurn = true; - while (mouseIsDown() || firstPageTurn) { + while (keepTurningPages()) { // Check for the first page if (page == 1) return; - if (!pageTurn(kRivenTransitionWipeDown)) { - return; - } - // Update the page number page--; - firstPageTurn = false; + pageTurn(kRivenTransitionWipeDown); cathBookDrawPage(page); - _vm->doFrame(); + + waitForPageTurnSound(); } } @@ -235,23 +226,19 @@ void ASpit::xacathbooknextpage(const ArgumentArray &args) { uint32 &page = _vm->_vars["acathbook"]; // Keep turning pages while the mouse is pressed - bool firstPageTurn = true; - while ((mouseIsDown() || firstPageTurn) && !_vm->hasGameEnded()) { + while (keepTurningPages()) { // Check for the last page if (page == 49) return; - if (!pageTurn(kRivenTransitionWipeUp)) { - return; - } - // Update the page number page++; - firstPageTurn = false; + pageTurn(kRivenTransitionWipeUp); cathBookDrawPage(page); - _vm->doFrame(); + + waitForPageTurnSound(); } } diff --git a/engines/mohawk/riven_stacks/aspit.h b/engines/mohawk/riven_stacks/aspit.h index 5321db0ff6..b2e5301dad 100644 --- a/engines/mohawk/riven_stacks/aspit.h +++ b/engines/mohawk/riven_stacks/aspit.h @@ -72,6 +72,7 @@ private: void cathBookDrawTelescopeCombination(); void cathBookDrawPage(uint32 page); + }; } // End of namespace RivenStacks diff --git a/engines/mohawk/riven_stacks/bspit.cpp b/engines/mohawk/riven_stacks/bspit.cpp index 824269a989..7a7c36ec30 100644 --- a/engines/mohawk/riven_stacks/bspit.cpp +++ b/engines/mohawk/riven_stacks/bspit.cpp @@ -96,20 +96,15 @@ void BSpit::xblabbookprevpage(const ArgumentArray &args) { uint32 &page = _vm->_vars["blabpage"]; // Keep turning pages while the mouse is pressed - bool firstPageTurn = true; - while (mouseIsDown() || firstPageTurn) { + while (keepTurningPages()) { // Check for the first page if (page == 1) return; - if (!pageTurn(kRivenTransitionWipeRight)) { - return; - } - // Update the page number page--; - firstPageTurn = false; + pageTurn(kRivenTransitionWipeRight); _vm->getCard()->drawPicture(page); if (page == 14) { @@ -117,6 +112,8 @@ void BSpit::xblabbookprevpage(const ArgumentArray &args) { } _vm->doFrame(); + + waitForPageTurnSound(); } } @@ -125,20 +122,15 @@ void BSpit::xblabbooknextpage(const ArgumentArray &args) { uint32 &page = _vm->_vars["blabpage"]; // Keep turning pages while the mouse is pressed - bool firstPageTurn = true; - while ((mouseIsDown() || firstPageTurn) && !_vm->hasGameEnded()) { + while (keepTurningPages()) { // Check for the last page if (page == 22) return; - if (!pageTurn(kRivenTransitionWipeLeft)) { - return; - } - // Update the page number page++; - firstPageTurn = false; + pageTurn(kRivenTransitionWipeLeft); _vm->getCard()->drawPicture(page); if (page == 14) { @@ -146,6 +138,8 @@ void BSpit::xblabbooknextpage(const ArgumentArray &args) { } _vm->doFrame(); + + waitForPageTurnSound(); } } diff --git a/engines/mohawk/riven_stacks/ospit.cpp b/engines/mohawk/riven_stacks/ospit.cpp index 8da1698ad3..beecc05ab9 100644 --- a/engines/mohawk/riven_stacks/ospit.cpp +++ b/engines/mohawk/riven_stacks/ospit.cpp @@ -193,22 +193,19 @@ void OSpit::xogehnbookprevpage(const ArgumentArray &args) { uint32 &page = _vm->_vars["ogehnpage"]; // Keep turning pages while the mouse is pressed - bool firstPageTurn = true; - while (mouseIsDown() || firstPageTurn) { + while (keepTurningPages()) { // Check for the first page if (page == 1) return; - if (!pageTurn(kRivenTransitionWipeRight)) { - return; - } - // Update the page number page--; - firstPageTurn = false; + pageTurn(kRivenTransitionWipeRight); _vm->getCard()->drawPicture(page); _vm->doFrame(); + + waitForPageTurnSound(); } } @@ -217,22 +214,19 @@ void OSpit::xogehnbooknextpage(const ArgumentArray &args) { uint32 &page = _vm->_vars["ogehnpage"]; // Keep turning pages while the mouse is pressed - bool firstPageTurn = true; - while ((mouseIsDown() || firstPageTurn) && !_vm->hasGameEnded()) { + while (keepTurningPages()) { // Check for the last page if (page == 13) return; - if (!pageTurn(kRivenTransitionWipeLeft)) { - return; - } - // Update the page number page++; - firstPageTurn = false; + pageTurn(kRivenTransitionWipeLeft); _vm->getCard()->drawPicture(page); _vm->doFrame(); + + waitForPageTurnSound(); } } -- cgit v1.2.3