AVALANCHE: Move some variables

This commit is contained in:
Strangerke 2013-09-22 17:45:48 +02:00
parent 302e74cac1
commit 863709ca57
6 changed files with 23 additions and 23 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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...

View File

@ -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;
}

View File

@ -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);