From 863709ca576652767af00e9dcb84dfaab11e1a9e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 22 Sep 2013 17:45:48 +0200 Subject: AVALANCHE: Move some variables --- engines/avalanche/avalanche.cpp | 10 +++++----- engines/avalanche/avalanche.h | 5 +++-- engines/avalanche/avalot.cpp | 8 ++++---- engines/avalanche/avalot.h | 4 ---- engines/avalanche/parser.cpp | 16 ++++++++-------- engines/avalanche/parser.h | 3 +++ 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 282c629ba1..110cef74e5 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -123,11 +123,11 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsByte(_parser->_wearing); sz.syncAsByte(_parser->_sworeNum); if (sz.isSaving()) - _avalot->_saveNum++; - sz.syncAsByte(_avalot->_saveNum); + _saveNum++; + sz.syncAsByte(_saveNum); sz.syncBytes(_avalot->_roomCount, 100); - sz.syncAsByte(_avalot->_alcoholLevel); - sz.syncAsByte(_avalot->_playedNim); + sz.syncAsByte(_parser->_alcoholLevel); + sz.syncAsByte(_parser->_playedNim); sz.syncAsByte(_avalot->_wonNim); sz.syncAsByte(_avalot->_wineState); sz.syncAsByte(_avalot->_cwytalotGone); @@ -135,7 +135,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsByte(_avalot->_aylesIsAwake); sz.syncAsByte(_avalot->_drawbridgeOpen); sz.syncAsByte(_avalot->_avariciusTalk); - sz.syncAsByte(_avalot->_boughtOnion); + sz.syncAsByte(_parser->_boughtOnion); sz.syncAsByte(_avalot->_rottenOnion); sz.syncAsByte(_avalot->_onionInVinegar); sz.syncAsByte(_avalot->_givenToSpludwick); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 289cf60d30..27a5bd6321 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -61,10 +61,11 @@ static const int kSavegameVersion = 1; class AvalancheEngine : public Engine { public: - Graphics *_graphics; - Parser *_parser; + byte _saveNum; // number of times this game has been saved Avalot *_avalot; + Graphics *_graphics; + Parser *_parser; Pingo *_pingo; Dialogs *_dialogs; Background *_background; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 3979707a5b..86bd7fef1b 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1594,12 +1594,12 @@ void Avalot::resetVariables() { _room = kRoomNowhere; _vm->_parser->_wearing = 0; _vm->_parser->_sworeNum = 0; - _saveNum = 0; + _vm->_saveNum = 0; for (int i = 0; i < 100; i++) _roomCount[i] = 0; - _alcoholLevel = 0; - _playedNim = 0; + _vm->_parser->_alcoholLevel = 0; + _vm->_parser->_playedNim = 0; _wonNim = false; _wineState = 0; _cwytalotGone = false; @@ -1607,7 +1607,7 @@ void Avalot::resetVariables() { _aylesIsAwake = false; _drawbridgeOpen = 0; _avariciusTalk = 0; - _boughtOnion = false; + _vm->_parser->_boughtOnion = false; _rottenOnion = false; _onionInVinegar = false; _givenToSpludwick = 0; diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index cc503749eb..efd04ff35a 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -247,10 +247,7 @@ public: int16 _dnascore; // your score, of course int32 _money; // your current amount of dosh byte _room; // your current room - byte _saveNum; // number of times this game has been saved byte _roomCount[100]; // Add one to each every time you enter a room - byte _alcoholLevel; // Your blood alcohol level. - byte _playedNim; // How many times you've played Nim. bool _wonNim; // Have you *won* Nim? (That's harder.) byte _wineState; // 0=good (Notts), 1=passable(Argent) ... 3=vinegar. bool _cwytalotGone; // Has Cwytalot rushed off to Jerusalem yet? @@ -258,7 +255,6 @@ public: bool _aylesIsAwake; // pretty obvious! byte _drawbridgeOpen; // Between 0 (shut) and 4 (open). byte _avariciusTalk; // How much Avaricius has said to you. - bool _boughtOnion; // Have you bought an onion yet? bool _rottenOnion; // And has it rotted? bool _onionInVinegar; // Is the onion in the vinegar? byte _givenToSpludwick; // 0 = nothing given, 1 = onion... diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index d24a37d2a7..67f4243c18 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -1382,8 +1382,8 @@ bool Parser::giveToSpludwick() { } void Parser::drink() { - _vm->_avalot->_alcoholLevel += 1; - if (_vm->_avalot->_alcoholLevel == 5) { + _alcoholLevel += 1; + if (_alcoholLevel == 5) { _vm->_avalot->_objects[Avalot::kObjectKey - 1] = true; // Get the key. _vm->_avalot->_teetotal = true; _vm->_avalot->_avvyIsAwake = false; @@ -1897,7 +1897,7 @@ void Parser::doThat() { } _vm->_dialogs->displayScrollChain('Q', 3); - _vm->_avalot->_playedNim++; + _playedNim++; // You won - strange! _vm->_dialogs->displayScrollChain('Q', 7); // You won! Give us a lute! @@ -1907,7 +1907,7 @@ void Parser::doThat() { _vm->_background->drawBackgroundSprite(-1, -1, 0); // Show the settle with no lute on it. _vm->_avalot->incScore(7); // 7 points for winning! - if (_vm->_avalot->_playedNim == 1) + if (_playedNim == 1) _vm->_avalot->incScore(3); // 3 points for playing your 1st game. // A warning to the player that there should have been a mini-game. TODO: Remove it later!!! @@ -2062,7 +2062,7 @@ void Parser::doThat() { return; } - if (_vm->_avalot->_alcoholLevel == 0) + if (_alcoholLevel == 0) _vm->_avalot->incScore(3); _vm->_background->drawBackgroundSprite(-1, -1, 11); @@ -2093,7 +2093,7 @@ void Parser::doThat() { _vm->_background->drawBackgroundSprite(-1, -1, 11); Common::String tmpStr = Common::String::format("Wine, please.%c1%c", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble); _vm->_dialogs->displayText(tmpStr); - if (_vm->_avalot->_alcoholLevel == 0) + if (_alcoholLevel == 0) _vm->_avalot->incScore(3); _vm->_background->drawBackgroundSprite(-1, -1, 9); _vm->_avalot->_malagauche = 177; @@ -2114,7 +2114,7 @@ void Parser::doThat() { else if (_vm->_avalot->_carryNum >= kCarryLimit) _vm->_dialogs->displayText("Before you ask, you remember that your hands are full."); else { - if (_vm->_avalot->_boughtOnion) + if (_boughtOnion) _vm->_dialogs->displayScrollChain('D', 11); else { _vm->_dialogs->displayScrollChain('D', 9); @@ -2123,7 +2123,7 @@ void Parser::doThat() { _vm->_avalot->decreaseMoney(3); // It costs thruppence. _vm->_avalot->_objects[Avalot::kObjectOnion - 1] = true; _vm->_avalot->refreshObjectList(); - _vm->_avalot->_boughtOnion = true; + _boughtOnion = true; _vm->_avalot->_rottenOnion = false; // It's OK when it leaves the stall! _vm->_avalot->_onionInVinegar = false; } diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index d117e56bdd..13734136a5 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -80,6 +80,9 @@ public: byte _wearing; // what you're wearing byte _sworeNum; // number of times you've sworn + byte _alcoholLevel; // Your blood alcohol level. + byte _playedNim; // How many times you've played Nim. + bool _boughtOnion; // Have you bought an onion yet? Parser(AvalancheEngine *vm); -- cgit v1.2.3