aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/avalanche/avalanche.cpp1
-rw-r--r--engines/avalanche/avalanche.h2
-rw-r--r--engines/avalanche/sequence2.cpp122
-rw-r--r--engines/avalanche/sequence2.h28
4 files changed, 82 insertions, 71 deletions
diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp
index c6821711df..7465ac6b75 100644
--- a/engines/avalanche/avalanche.cpp
+++ b/engines/avalanche/avalanche.cpp
@@ -55,6 +55,7 @@ namespace Avalanche {
_visa.setParent(this);
_lucerna.setParent(this);
_enid.setParent(this);
+ _celer.setParent(this);
}
AvalancheEngine::~AvalancheEngine() {
diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h
index 643b97c7f0..6a3187c072 100644
--- a/engines/avalanche/avalanche.h
+++ b/engines/avalanche/avalanche.h
@@ -37,6 +37,7 @@
#include "avalanche/visa2.h"
#include "avalanche/lucerna2.h"
#include "avalanche/enid2.h"
+#include "avalanche/celer2.h"
#include "engines/engine.h"
#include "engines/advancedDetector.h"
@@ -61,6 +62,7 @@ public:
Visa _visa;
Lucerna _lucerna;
Enid _enid;
+ Celer _celer;
AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd);
diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp
index 851dcb139a..79c3e04b2e 100644
--- a/engines/avalanche/sequence2.cpp
+++ b/engines/avalanche/sequence2.cpp
@@ -27,6 +27,8 @@
/* SEQUENCE The sequencer. */
+#include "avalanche/avalanche.h"
+
#include "avalanche/sequence2.h"
#include "common/scummsys.h"
#include "avalanche/gyro2.h"
@@ -36,74 +38,74 @@
namespace Avalanche {
- namespace Sequence {
-
- void then_show(byte what) {
- byte fv;
- for (fv = 1; fv <= seq_length; fv ++)
- if (seq[fv] == 0) {
- seq[fv] = what;
- return;
- }
- }
-
- void first_show(byte what) {
- /* First, we need to blank out the entire array. */
- for (int i = 0; i < sizeof(seq); i++)
- seq[i] = 0;
-
- /* Then it's just the same as then_show. */
- then_show(what);
-
- }
-
- void then_flip(byte where, byte ped) {
- then_show(now_flip);
-
- Gyro::dna.flip_to_where = where;
- Gyro::dna.flip_to_ped = ped;
- }
+void Sequence::setParent(AvalancheEngine *vm) {
+ _vm = vm;
+}
- void start_to_close() {
- Timeout::lose_timer(Timeout::reason_sequencer);
- Timeout::set_up_timer(7, Timeout::PROCsequence, Timeout::reason_sequencer);
- }
+void Sequence::first_show(byte what) {
+ /* First, we need to blank out the entire array. */
+ for (int i = 0; i < sizeof(seq); i++)
+ seq[i] = 0;
- void start_to_open() {
- Gyro::dna.user_moves_avvy = false; /* They can't move. */
- Trip::stopwalking(); /* And they're not moving now. */
- start_to_close(); /* Apart from that, it's the same thing. */
- }
+ /* Then it's just the same as then_show. */
+ then_show(what);
- void call_sequencer();
-
- /* This PROC is called by Timeout when it's time to do another frame. */
- static void shove_left() {
- memcpy(seq, seq+1, seq_length - 1); /* Shift everything to the left. */
- }
+}
- void call_sequencer() {
- switch (seq[0]) {
- case 0:
+void Sequence::then_show(byte what) {
+ byte fv;
+ for (fv = 1; fv <= seq_length; fv ++)
+ if (seq[fv] == 0) {
+ seq[fv] = what;
return;
- break; /* No more routines. */
- case 177: {
- Gyro::dna.user_moves_avvy = true;
- Trip::fliproom(Gyro::dna.flip_to_where, Gyro::dna.flip_to_ped); /* 177 = Flip room. */
- if (seq[0] == 177) shove_left();
- }
- break;
}
-
- if ((seq[0] >= 1) && (seq[0] <= 176)) {
- /* Show a frame. */
- Celer::show_one(seq[1]);
- shove_left();
+}
+
+void Sequence::then_flip(byte where, byte ped) {
+ then_show(now_flip);
+
+ _vm->_gyro.dna.flip_to_where = where;
+ _vm->_gyro.dna.flip_to_ped = ped;
+}
+
+void Sequence::start_to_close() {
+ Timeout::lose_timer(Timeout::reason_sequencer);
+ Timeout::set_up_timer(7, Timeout::procsequence, Timeout::reason_sequencer);
+}
+
+void Sequence::start_to_open() {
+ _vm->_gyro.dna.user_moves_avvy = false; /* They can't move. */
+ Trip::stopwalking(); /* And they're not moving now. */
+ start_to_close(); /* Apart from that, it's the same thing. */
+}
+
+
+
+/* This PROC is called by Timeout when it's time to do another frame. */
+void Sequence::shove_left() {
+ memcpy(seq, seq+1, seq_length - 1); /* Shift everything to the left. */
+}
+
+void Sequence::call_sequencer() {
+ switch (seq[0]) {
+ case 0:
+ return;
+ break; /* No more routines. */
+ case 177: {
+ _vm->_gyro.dna.user_moves_avvy = true;
+ Trip::fliproom(_vm->_gyro.dna.flip_to_where, _vm->_gyro.dna.flip_to_ped); /* 177 = Flip room. */
+ if (seq[0] == 177) shove_left();
}
-
- start_to_close(); /* Make sure this PROC gets called again. */
+ break;
}
- } // End of namespace Sequence .
+ if ((seq[0] >= 1) && (seq[0] <= 176)) {
+ /* Show a frame. */
+ _vm->_celer.show_one(seq[1]);
+ shove_left();
+ }
+
+ start_to_close(); /* Make sure this PROC gets called again. */
+}
} // End of namespace Avalanche.
diff --git a/engines/avalanche/sequence2.h b/engines/avalanche/sequence2.h
index 0e53ccf2a1..7bd79bc61b 100644
--- a/engines/avalanche/sequence2.h
+++ b/engines/avalanche/sequence2.h
@@ -33,32 +33,38 @@
#include "common/scummsys.h"
namespace Avalanche {
+class AvalancheEngine;
- namespace Sequence {
+class Sequence {
+public:
+ static const int16 now_flip = 177;
- const int16 now_flip = 177;
+ static const int16 seq_length = 10;
- const int16 seq_length = 10;
+ byte seq[seq_length];
- byte seq[seq_length];
+ void setParent(AvalancheEngine *vm);
+ void first_show(byte what);
- void first_show(byte what);
+ void then_show(byte what);
- void then_show(byte what);
+ void then_flip(byte where, byte ped);
- void then_flip(byte where, byte ped);
+ void start_to_close();
- void start_to_close();
+ void start_to_open();
- void start_to_open();
+ void call_sequencer();
- void call_sequencer();
+private:
+ AvalancheEngine *_vm;
- } // End of namespace Sequence .
+ void shove_left();
+};
} // End of namespace Avalanche.