From e166f6fc44be9322cd502520af0cd1daa6b07813 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 27 Sep 2013 00:33:08 +0200 Subject: [PATCH] AVALANCHE: Move a couple of variables to Sequence, more private variables --- engines/avalanche/avalanche.cpp | 2 -- engines/avalanche/avalot.cpp | 3 +-- engines/avalanche/avalot.h | 2 -- engines/avalanche/sequence.cpp | 13 ++++++++++--- engines/avalanche/sequence.h | 32 +++++++++++++++++--------------- 5 files changed, 28 insertions(+), 24 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 339d027cf92..222414ca02f 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -242,8 +242,6 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsByte(_avalot->_nextBell); sz.syncAsByte(_avalot->_givenPotionToGeida); sz.syncAsByte(_avalot->_lustieIsAsleep); - sz.syncAsByte(_avalot->_flipToWhere); - sz.syncAsByte(_avalot->_flipToPed); sz.syncAsByte(_avalot->_beenTiedUp); sz.syncAsByte(_avalot->_sittingInPub); sz.syncAsByte(_avalot->_spurgeTalkCount); diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 397d1b7a3c3..6bf1b469136 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1616,8 +1616,6 @@ void Avalot::resetVariables() { _nextBell = 0; _givenPotionToGeida = false; _lustieIsAsleep = false; - _flipToWhere = kRoomNowhere; - _flipToPed = 0; _beenTiedUp = false; _sittingInPub = false; _spurgeTalkCount = 0; @@ -1628,6 +1626,7 @@ void Avalot::resetVariables() { _vm->_parser->resetVariables(); _vm->_animation->resetVariables(); + _vm->_sequence->resetVariables(); } void Avalot::newGame() { diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index fa616902464..a80d80d2754 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -225,8 +225,6 @@ public: byte _nextBell; // For the ringing. bool _givenPotionToGeida; // Does Geida have the potion? bool _lustieIsAsleep; // Is BDL asleep? - Room _flipToWhere; - byte _flipToPed; // For the sequencer. bool _beenTiedUp; // In r__Robins. bool _sittingInPub; // Are you sitting down in the pub? byte _spurgeTalkCount; // Count for talking to Spurge. diff --git a/engines/avalanche/sequence.cpp b/engines/avalanche/sequence.cpp index 707cd9f300f..bbbbf6229c9 100644 --- a/engines/avalanche/sequence.cpp +++ b/engines/avalanche/sequence.cpp @@ -41,6 +41,11 @@ Sequence::Sequence(AvalancheEngine *vm) { _vm = vm; } +void Sequence::resetVariables() { + _flipToWhere = kRoomNowhere; + _flipToPed = 0; +} + void Sequence::init(byte what) { _seq[0] = what; @@ -60,8 +65,8 @@ void Sequence::add(byte what) { void Sequence::switchRoom(Room where, byte ped) { add(kNowFlip); - _vm->_avalot->_flipToWhere = where; - _vm->_avalot->_flipToPed = ped; + _flipToWhere = where; + _flipToPed = ped; } void Sequence::startTimer() { @@ -90,7 +95,7 @@ void Sequence::callSequencer() { break; case kNowFlip: // Flip room. _vm->_avalot->_userMovesAvvy = true; - _vm->_avalot->flipRoom(_vm->_avalot->_flipToWhere, _vm->_avalot->_flipToPed); + _vm->_avalot->flipRoom(_flipToWhere, _flipToPed); // CHECKME: Always true? if (curSeq == kNowFlip) shoveLeft(); @@ -215,5 +220,7 @@ void Sequence::startDummySeq(Room whither, byte ped) { void Sequence::synchronize(Common::Serializer &sz) { sz.syncBytes(_seq, kSeqLength); + sz.syncAsByte(_flipToWhere); + sz.syncAsByte(_flipToPed); } } // End of namespace Avalanche. diff --git a/engines/avalanche/sequence.h b/engines/avalanche/sequence.h index 7f164853e17..94025babf4d 100644 --- a/engines/avalanche/sequence.h +++ b/engines/avalanche/sequence.h @@ -27,8 +27,8 @@ /* SEQUENCE The sequencer. */ -#ifndef AVALANCHE_SEQUENCE2_H -#define AVALANCHE_SEQUENCE2_H +#ifndef AVALANCHE_SEQUENCE_H +#define AVALANCHE_SEQUENCE_H #include "common/scummsys.h" @@ -40,12 +40,24 @@ private: static const int16 kNowFlip = 177; static const int16 kSeqLength = 10; -public: byte _seq[kSeqLength]; + Room _flipToWhere; + byte _flipToPed; + + AvalancheEngine *_vm; + + void shoveLeft(); // This is called by Timer when it's time to do another frame. It shifts everything to the left. + void init(byte what); + void add(byte what); + void switchRoom(Room where, byte ped); + void startTimer(); + void startTimerImmobilized(); + +public: Sequence(AvalancheEngine *vm); void synchronize(Common::Serializer &sz); - + void resetVariables(); void callSequencer(); void startCupboardSeq(); @@ -63,18 +75,8 @@ public: void startDuckSeq(); void startCardiffSeq2(); void startDummySeq(Room whither, byte ped); - -private: - AvalancheEngine *_vm; - - void shoveLeft(); // This is called by Timer when it's time to do another frame. It shifts everything to the left. - void init(byte what); - void add(byte what); - void switchRoom(Room where, byte ped); - void startTimer(); - void startTimerImmobilized(); }; } // End of namespace Avalanche. -#endif // AVALANCHE_SEQUENCE2_H +#endif // AVALANCHE_SEQUENCE_H