From 720c92e45144891c2079c9a75b87966f4063ebdf Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 28 Oct 2021 17:03:14 +0300 Subject: [PATCH] GROOVIE: More work on the wine rack puzzle --- engines/groovie/logic/winerack.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/engines/groovie/logic/winerack.cpp b/engines/groovie/logic/winerack.cpp index f2d35b05899..7f825676aa1 100644 --- a/engines/groovie/logic/winerack.cpp +++ b/engines/groovie/logic/winerack.cpp @@ -36,22 +36,25 @@ WineRackGame::WineRackGame() : _random("WineRackGame"), _totalBottles(0) { void WineRackGame::run(byte *scriptVariables) { char op = scriptVariables[3]; + byte pos = 0; switch (op) { case 3: initGrid(scriptVariables[4]); break; case 4: - placeBottle(calculateNextMove(2), 2); - scriptVariables[0] = op / 10; - scriptVariables[1] = op % 10; + pos = calculateNextMove(2); + placeBottle(pos, 2); + scriptVariables[0] = pos / 10; + scriptVariables[1] = pos % 10; //scriptVariables[3] = (char)FUN_00412c90(); break; case 5: scriptVariables[3] = 0; - placeBottle(calculateNextMove(1), 1); - scriptVariables[0] = op / 10; - scriptVariables[1] = op % 10; + pos = calculateNextMove(1); + placeBottle(pos, 1); + scriptVariables[0] = pos / 10; + scriptVariables[1] = pos % 10; //if ((char)FUN_00412cf0() != 0) { // scriptVariables[3] = 1; //} @@ -64,9 +67,10 @@ void WineRackGame::run(byte *scriptVariables) { // return; //} - placeBottle(calculateNextMove(1), 1); - scriptVariables[0] = op / 10; - scriptVariables[1] = op % 10; + pos = calculateNextMove(1); + placeBottle(pos, 1); + scriptVariables[0] = pos / 10; + scriptVariables[1] = pos % 10; //if ((char)FUN_00412cf0() != 0) { // scriptVariables[3] = 1;