From 79a961c89d4f8fd46b70a01cc0d717274c415402 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 21 Sep 2013 23:34:21 +0200 Subject: AVALANCHE: Move some variables, fix savegame counter increment when saving --- engines/avalanche/animation.cpp | 2 +- engines/avalanche/avalanche.cpp | 40 +++++++++++++++++++++------------------- engines/avalanche/avalot.cpp | 6 +++--- engines/avalanche/avalot.h | 2 -- engines/avalanche/parser.cpp | 22 +++++++++++----------- engines/avalanche/parser.h | 4 +++- 6 files changed, 39 insertions(+), 37 deletions(-) (limited to 'engines/avalanche') diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 0593b046af..70f007ae4d 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -1230,7 +1230,7 @@ void Animation::stopWalking() { */ void Animation::hideInCupboard() { if (_vm->_avalot->_avvysInTheCupboard) { - if (_vm->_avalot->_wearing == Parser::kNothing) { + if (_vm->_parser->_wearing == Parser::kNothing) { Common::String tmpStr = Common::String::format("%cAVVY!%cGet dressed first!", Dialogs::kControlItalic, Dialogs::kControlRoman); _vm->_dialogs->displayText(tmpStr); } else { diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 7297788321..282c629ba1 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -120,8 +120,10 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsSint16LE(_avalot->_dnascore); sz.syncAsSint32LE(_avalot->_money); sz.syncAsByte(_avalot->_room); - sz.syncAsByte(_avalot->_wearing); - sz.syncAsByte(_avalot->_sworeNum); + sz.syncAsByte(_parser->_wearing); + sz.syncAsByte(_parser->_sworeNum); + if (sz.isSaving()) + _avalot->_saveNum++; sz.syncAsByte(_avalot->_saveNum); sz.syncBytes(_avalot->_roomCount, 100); sz.syncAsByte(_avalot->_alcoholLevel); @@ -474,7 +476,7 @@ void AvalancheEngine::updateEvents() { while (_eventMan->pollEvent(event)) { switch (event.type) { case Common::EVENT_LBUTTONDOWN: - _avalot->_holdLeftMouse = true; // Used in Lucerna::checkclick() and Dropdown::menu_link(). + _avalot->_holdLeftMouse = true; // Used in Avalot::checkclick() and Menu::menu_link(). break; case Common::EVENT_LBUTTONUP: _avalot->_holdLeftMouse = false; // Same as above. @@ -505,20 +507,20 @@ Common::Error AvalancheEngine::run() { _avalot->runAvalot(); #if 0 - //switch (_storage._operation) { - //case kRunShootemup: - // run("seu.avx", kJsb, kBflight, kNormal); - // break; - //case kRunDosshell: - // dosShell(); - // break; - //case kRunGhostroom: - // run("g-room.avx", kJsb, kNoBflight, kNormal); - // break; - //case kRunGolden: - // run("golden.avx", kJsb, kBflight, kMusical); - // break; - //} + switch (_storage._operation) { + case kRunShootemup: + run("seu.avx", kJsb, kBflight, kNormal); + break; + case kRunDosshell: + dosShell(); + break; + case kRunGhostroom: + run("g-room.avx", kJsb, kNoBflight, kNormal); + break; + case kRunGolden: + run("golden.avx", kJsb, kBflight, kMusical); + break; + } #endif } while (!_avalot->_letMeOut && !shouldQuit()); @@ -528,8 +530,8 @@ Common::Error AvalancheEngine::run() { #if 0 void AvalancheEngine::run(Common::String what, bool withJsb, bool withBflight, Elm how) { - warning("STUB: run(%s)", what.c_str()); // Probably there'll be no need of this function, as all *.AVX-es will become classes. + warning("STUB: run(%s)", what.c_str()); } Common::String AvalancheEngine::elmToStr(Elm how) { @@ -541,7 +543,7 @@ Common::String AvalancheEngine::elmToStr(Elm how) { return Common::String("REGI"); case kElmpoyten: return Common::String("ELMPOYTEN"); - // Useless, but silent a warning + // Useless, but silent a warning default: return Common::String(""); } diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 772c1ad6a0..c5d942dc0d 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1560,8 +1560,8 @@ void Avalot::resetVariables() { _dnascore = 0; _money = 0; _room = kRoomNowhere; - _wearing = 0; - _sworeNum = 0; + _vm->_parser->_wearing = 0; + _vm->_parser->_sworeNum = 0; _saveNum = 0; for (int i = 0; i < 100; i++) _roomCount[i] = 0; @@ -1653,7 +1653,7 @@ void Avalot::newGame() { _favouriteDrink = "beer"; _money = 30; // 2/6 _vm->_animation->_direction = Animation::kDirStopped; - _wearing = kObjectClothes; + _vm->_parser->_wearing = kObjectClothes; _objects[kObjectMoney - 1] = true; _objects[kObjectBodkin - 1] = true; _objects[kObjectBell - 1] = true; diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 51be1a3dd4..cc503749eb 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -247,8 +247,6 @@ public: int16 _dnascore; // your score, of course int32 _money; // your current amount of dosh byte _room; // your current room - byte _wearing; // what you're wearing - byte _sworeNum; // number of times you've sworn 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. diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 4a58763d0c..72336280ae 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -1033,7 +1033,7 @@ void Parser::inventory() { tmpStr += _vm->_avalot->getItem(i + 1); - if ((i + 1) == _vm->_avalot->_wearing) + if ((i + 1) == _wearing) tmpStr += ", which you're wearing"; if (itemNum < _vm->_avalot->_carryNum) @@ -1041,7 +1041,7 @@ void Parser::inventory() { } } - if (_vm->_avalot->_wearing == kNothing) + if (_wearing == kNothing) tmpStr += Common::String::format("...%c%c...and you're stark naked!", Dialogs::kControlNewLine, Dialogs::kControlNewLine); else tmpStr += '.'; @@ -1289,7 +1289,7 @@ void Parser::putProc() { _vm->_dialogs->displayText("Just give it to Spludwick, Avvy!"); break; default: // Put the object into the box... - if (_vm->_avalot->_wearing == _thing) { + if (_wearing == _thing) { Common::String tmpStr = Common::String::format("You'd better take %s off first!", _vm->_avalot->getItem(_thing).c_str()); _vm->_dialogs->displayText(tmpStr); } else { @@ -1826,12 +1826,12 @@ void Parser::doThat() { } break; case kVerbCodeUndress: - if (_vm->_avalot->_wearing == kNothing) + if (_wearing == kNothing) _vm->_dialogs->displayText("You're already stark naked!"); else if (_vm->_avalot->_avvysInTheCupboard) { - Common::String tmpStr = Common::String::format("You take off %s.", _vm->_avalot->getItem(_vm->_avalot->_wearing).c_str()); + Common::String tmpStr = Common::String::format("You take off %s.", _vm->_avalot->getItem(_wearing).c_str()); _vm->_dialogs->displayText(tmpStr); - _vm->_avalot->_wearing = kNothing; + _wearing = kNothing; _vm->_avalot->refreshObjectList(); } else _vm->_dialogs->displayText("Hadn't you better find somewhere more private, Avvy?"); @@ -1845,14 +1845,14 @@ void Parser::doThat() { break; case Avalot::kObjectClothes: case Avalot::kObjectHabit: { // Change this! - if (_vm->_avalot->_wearing != kNothing) { - if (_vm->_avalot->_wearing == _thing) + if (_wearing != kNothing) { + if (_wearing == _thing) _vm->_dialogs->displayText("You're already wearing that."); else _vm->_dialogs->displayText("You'll be rather warm wearing two sets of clothes!"); return; } else - _vm->_avalot->_wearing = _thing; + _wearing = _thing; _vm->_avalot->refreshObjectList(); @@ -2013,7 +2013,7 @@ void Parser::doThat() { _vm->_dialogs->displayText("Listen, smart alec, that was just rhetoric."); break; case kVerbCodeExpletive: - switch (_vm->_avalot->_sworeNum) { + switch (_sworeNum) { case 0: { Common::String tmpStr = Common::String::format("Avvy! Do you mind? There might be kids playing!%c%c" \ "(I shouldn't say it again, if I were you!)", Dialogs::kControlNewLine, Dialogs::kControlNewLine); @@ -2034,7 +2034,7 @@ void Parser::doThat() { _vm->_avalot->gameOver(); } } - _vm->_avalot->_sworeNum++; + _sworeNum++; break; case kVerbCodeListen: if ((_vm->_avalot->_bellsAreRinging) & (_vm->_avalot->setFlag('B'))) diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index 1084c01a90..d117e56bdd 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -32,7 +32,6 @@ #include "common/scummsys.h" #include "common/str.h" - namespace Avalanche { class AvalancheEngine; @@ -79,6 +78,9 @@ public: byte _leftMargin; bool _cursorState; + byte _wearing; // what you're wearing + byte _sworeNum; // number of times you've sworn + Parser(AvalancheEngine *vm); void init(); -- cgit v1.2.3