aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/avalanche/avalanche.cpp2
-rw-r--r--engines/avalanche/avalanche.h5
-rw-r--r--engines/avalanche/timeout2.cpp1151
-rw-r--r--engines/avalanche/timeout2.h157
4 files changed, 662 insertions, 653 deletions
diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp
index 7465ac6b75..d9a37296cb 100644
--- a/engines/avalanche/avalanche.cpp
+++ b/engines/avalanche/avalanche.cpp
@@ -56,6 +56,8 @@ namespace Avalanche {
_lucerna.setParent(this);
_enid.setParent(this);
_celer.setParent(this);
+ _sequence.setParent(this);
+ _timeout.setParent(this);
}
AvalancheEngine::~AvalancheEngine() {
diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h
index 6a3187c072..8200a50116 100644
--- a/engines/avalanche/avalanche.h
+++ b/engines/avalanche/avalanche.h
@@ -38,6 +38,8 @@
#include "avalanche/lucerna2.h"
#include "avalanche/enid2.h"
#include "avalanche/celer2.h"
+#include "avalanche/sequence2.h"
+#include "avalanche/timeout2.h"
#include "engines/engine.h"
#include "engines/advancedDetector.h"
@@ -63,7 +65,8 @@ public:
Lucerna _lucerna;
Enid _enid;
Celer _celer;
-
+ Sequence _sequence;
+ Timeout _timeout;
AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd);
~AvalancheEngine();
diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp
index 6c0099b910..a202aaf9ac 100644
--- a/engines/avalanche/timeout2.cpp
+++ b/engines/avalanche/timeout2.cpp
@@ -33,6 +33,8 @@
#include "avalanche/timeout2.h"
+#include "avalanche/avalanche.h"
+
#include "avalanche/visa2.h"
#include "avalanche/lucerna2.h"
#include "avalanche/trip6.h"
@@ -44,635 +46,626 @@
namespace Avalanche {
- namespace Timeout {
-
- byte fv;
-
- void set_up_timer(int32 howlong, byte whither, byte why) {
- fv = 1;
- while ((fv < 8) && (times[fv].time_left != 0)) fv += 1;
- if (fv == 8) return; /* Oh dear... */
-
- {
- timetype &with = times[fv]; /* Everything's OK here! */
-
- with.time_left = howlong;
- with.then_where = whither;
- with.what_for = why;
- }
- }
-
- void one_tick() {
-
- if (Gyro::ddmnow) return;
-
- for (fv = 1; fv <= 7; fv ++) {
- timetype &with = times[fv];
- if (with.time_left > 0) {
- with.time_left -= 1;
-
- if (with.time_left == 0)
- switch (with.then_where) {
- case procopen_drawbridge :
- open_drawbridge();
- break;
- case procavaricius_talks :
- avaricius_talks();
- break;
- case procurinate :
- urinate();
- break;
- case proctoilet2 :
- toilet2();
- break;
- case procbang:
- bang();
- break;
- case procbang2:
- bang2();
- break;
- case procstairs:
- stairs();
- break;
- case proccardiffsurvey:
- cardiff_survey();
- break;
- case proccardiff_return:
- cardiff_return();
- break;
- case proc_cwytalot_in_herts:
- cwytalot_in_herts();
- break;
- case procget_tied_up:
- get_tied_up();
- break;
- case procget_tied_up2:
- get_tied_up2();
- break;
- case prochang_around:
- hang_around();
- break;
- case prochang_around2:
- hang_around2();
- break;
- case procafter_the_shootemup:
- after_the_shootemup();
- break;
- case procjacques_wakes_up:
- jacques_wakes_up();
- break;
- case procnaughty_duke:
- naughty_duke();
- break;
- case procnaughty_duke2:
- naughty_duke2();
- break;
- case procnaughty_duke3:
- naughty_duke3();
- break;
- case procjump:
- jump();
- break;
- case procsequence:
- Sequence::call_sequencer();
- break;
- case proccrapulus_splud_out:
- crapulus_says_splud_out();
- break;
- case procdawn_delay:
- Lucerna::dawn();
- break;
- case procbuydrinks:
- buydrinks();
- break;
- case procbuywine:
- buywine();
- break;
- case proccallsguards:
- callsguards();
- break;
- case procgreetsmonk:
- greetsmonk();
- break;
- case procfall_down_oubliette:
- fall_down_oubliette();
- break;
- case procmeet_avaroid:
- meet_avaroid();
- break;
- case procrise_up_oubliette:
- rise_up_oubliette();
- break;
- case procrobin_hood_and_geida:
- robin_hood_and_geida();
- break;
- case procrobin_hood_and_geida_talk:
- robin_hood_and_geida_talk();
- break;
- case procavalot_returns:
- avalot_returns();
- break;
- case procavvy_sit_down:
- avvy_sit_down();
- break;
- case procghost_room_phew:
- ghost_room_phew();
- break;
- case procarkata_shouts:
- arkata_shouts();
- break;
- case procwinning:
- winning();
- break;
- case procavalot_falls:
- avalot_falls();
- break;
- case procspludwick_goes_to_cauldron:
- spludwick_goes_to_cauldron();
- break;
- case procspludwick_leaves_cauldron:
- spludwick_leaves_cauldron();
- break;
- case procgive_lute_to_geida:
- give_lute_to_geida();
- break;
- }
- }
- }
- Gyro::roomtime += 1; /* Cycles since you've been in this room. */
- Gyro::dna.total_time += 1; /* Total amount of time for this game. */
- }
-
- void lose_timer(byte which) {
- byte fv;
-
- for (fv = 1; fv <= 7; fv ++) {
- timetype &with = times[fv];
- if (with.what_for == which)
- with.time_left = 0;
- } /* Cancel this one! */
+Timeout::Timeout() {
+ for (int i = 0; i < sizeof(times); i++) {
+ times[i].time_left = 0;
+ times[i].then_where = 0;
+ times[i].what_for = 0;
}
+}
- /*function timer_is_on(which:byte):boolean;
- var fv:byte;
- begin
- for fv:=1 to 7 do
- with times[fv] do
- if (what_for=which) and (time_left>0) then
- begin
- timer_is_on:=true;
- exit;
- end;
- timer_is_on:=false;
- end;*/
-
- /* Timeout procedures: */
-
- void open_drawbridge() {
- {
- Gyro::dna.drawbridge_open ++;
- Celer::show_one(Gyro::dna.drawbridge_open - 1);
-
- if (Gyro::dna.drawbridge_open == 4)
- Gyro::magics[2].op = Gyro::nix; /* You may enter the drawbridge. */
- else set_up_timer(7, procopen_drawbridge, reason_drawbridgefalls);
- }
- }
+void Timeout::setParent(AvalancheEngine *vm) {
+ _vm = vm;
+}
- /* --- */
+void Timeout::set_up_timer(int32 howlong, byte whither, byte why) {
+ fv = 1;
+ while ((fv < 8) && (times[fv].time_left != 0)) fv += 1;
+ if (fv == 8) return; /* Oh dear... */
- void avaricius_talks() {
- {
- Visa::dixi('q', Gyro::dna.avaricius_talk);
- Gyro::dna.avaricius_talk ++;
-
- if (Gyro::dna.avaricius_talk < 17)
- set_up_timer(177, procavaricius_talks, reason_avariciustalks);
- else Lucerna::points(3);
-
- }
- }
+ {
+ timetype &with = times[fv]; /* Everything's OK here! */
- void urinate() {
- Trip::tr[1].turn(Trip::up);
- Trip::stopwalking();
- Lucerna::showrw();
- set_up_timer(14, proctoilet2, reason_gototoilet);
+ with.time_left = howlong;
+ with.then_where = whither;
+ with.what_for = why;
}
+}
- void toilet2() {
- Scrolls::display("That's better!");
- }
+void Timeout::one_tick() {
+ if (_vm->_gyro.ddmnow) return;
- void bang() {
- Scrolls::display("\6< BANG! >");
- set_up_timer(30, procbang2, reason_explosion);
- }
-
- void bang2() {
- Scrolls::display("Hmm... sounds like Spludwick's up to something...");
- }
+ for (fv = 1; fv <= 7; fv ++) {
+ timetype &with = times[fv];
+ if (with.time_left > 0) {
+ with.time_left -= 1;
- void stairs() {
- Gyro::blip();
- Trip::tr[0].walkto(4);
- Celer::show_one(2);
- Gyro::dna.brummie_stairs = 2;
- Gyro::magics[11].op = Gyro::special;
- Gyro::magics[11].data = 2; /* Reached the bottom of the stairs. */
- Gyro::magics[4].op = Gyro::nix; /* Stop them hitting the sides (or the game will hang.) */
- }
-
- void cardiff_survey() {
- {
- switch (Gyro::dna.cardiff_things) {
- case 0: {
- Gyro::dna.cardiff_things += 1;
- Visa::dixi('q', 27);
- }
- break;
- }
- Visa::dixi('z', Gyro::dna.cardiff_things);
+ if (with.time_left == 0)
+ switch (with.then_where) {
+ case procopen_drawbridge :
+ open_drawbridge();
+ break;
+ case procavaricius_talks :
+ avaricius_talks();
+ break;
+ case procurinate :
+ urinate();
+ break;
+ case proctoilet2 :
+ toilet2();
+ break;
+ case procbang:
+ bang();
+ break;
+ case procbang2:
+ bang2();
+ break;
+ case procstairs:
+ stairs();
+ break;
+ case proccardiffsurvey:
+ cardiff_survey();
+ break;
+ case proccardiff_return:
+ cardiff_return();
+ break;
+ case proc_cwytalot_in_herts:
+ cwytalot_in_herts();
+ break;
+ case procget_tied_up:
+ get_tied_up();
+ break;
+ case procget_tied_up2:
+ get_tied_up2();
+ break;
+ case prochang_around:
+ hang_around();
+ break;
+ case prochang_around2:
+ hang_around2();
+ break;
+ case procafter_the_shootemup:
+ after_the_shootemup();
+ break;
+ case procjacques_wakes_up:
+ jacques_wakes_up();
+ break;
+ case procnaughty_duke:
+ naughty_duke();
+ break;
+ case procnaughty_duke2:
+ naughty_duke2();
+ break;
+ case procnaughty_duke3:
+ naughty_duke3();
+ break;
+ case procjump:
+ jump();
+ break;
+ case procsequence:
+ _vm->_sequence.call_sequencer();
+ break;
+ case proccrapulus_splud_out:
+ crapulus_says_splud_out();
+ break;
+ case procdawn_delay:
+ _vm->_lucerna.dawn();
+ break;
+ case procbuydrinks:
+ buydrinks();
+ break;
+ case procbuywine:
+ buywine();
+ break;
+ case proccallsguards:
+ callsguards();
+ break;
+ case procgreetsmonk:
+ greetsmonk();
+ break;
+ case procfall_down_oubliette:
+ fall_down_oubliette();
+ break;
+ case procmeet_avaroid:
+ meet_avaroid();
+ break;
+ case procrise_up_oubliette:
+ rise_up_oubliette();
+ break;
+ case procrobin_hood_and_geida:
+ robin_hood_and_geida();
+ break;
+ case procrobin_hood_and_geida_talk:
+ robin_hood_and_geida_talk();
+ break;
+ case procavalot_returns:
+ avalot_returns();
+ break;
+ case procavvy_sit_down:
+ avvy_sit_down();
+ break;
+ case procghost_room_phew:
+ ghost_room_phew();
+ break;
+ case procarkata_shouts:
+ arkata_shouts();
+ break;
+ case procwinning:
+ winning();
+ break;
+ case procavalot_falls:
+ avalot_falls();
+ break;
+ case procspludwick_goes_to_cauldron:
+ spludwick_goes_to_cauldron();
+ break;
+ case procspludwick_leaves_cauldron:
+ spludwick_leaves_cauldron();
+ break;
+ case procgive_lute_to_geida:
+ give_lute_to_geida();
+ break;
+ }
}
- Gyro::interrogation = Gyro::dna.cardiff_things;
- set_up_timer(182, proccardiffsurvey, reason_cardiffsurvey);
- }
-
- void cardiff_return() {
- Visa::dixi('q', 28);
- cardiff_survey(); /* add end of question. */
- }
-
- void cwytalot_in_herts() {
- Visa::dixi('q', 29);
- }
-
- void get_tied_up() {
- Visa::dixi('q', 34); /* ...Trouble! */
- Gyro::dna.user_moves_avvy = false;
- Gyro::dna.been_tied_up = true;
- Trip::stopwalking();
- Trip::tr[2].stopwalk();
- Trip::tr[2].stophoming();
- Trip::tr[2].call_eachstep = true;
- Trip::tr[2].eachstep = Trip::procgrab_avvy;
- set_up_timer(70, procget_tied_up2, reason_getting_tied_up);
}
+ _vm->_gyro.roomtime += 1; /* Cycles since you've been in this room. */
+ _vm->_gyro.dna.total_time += 1; /* Total amount of time for this game. */
+}
- void get_tied_up2() {
- Trip::tr[1].walkto(4);
- Trip::tr[2].walkto(5);
- Gyro::magics[4].op = Gyro::nix; /* No effect when you touch the boundaries. */
- Gyro::dna.friar_will_tie_you_up = true;
- }
-
- void hang_around() {
- Trip::tr[2].check_me = false;
- Trip::tr[1].init(7, true); /* Robin Hood */
- Gyro::whereis[Gyro::probinhood] = r__robins;
- Trip::apped(1, 2);
- Visa::dixi('q', 39);
- Trip::tr[1].walkto(7);
- set_up_timer(55, prochang_around2, reason_hanging_around);
- }
-
- void hang_around2() {
- Visa::dixi('q', 40);
- Trip::tr[2].vanishifstill = false;
- Trip::tr[2].walkto(4);
- Gyro::whereis[Gyro::pfriartuck] = r__robins;
- Visa::dixi('q', 41);
- Trip::tr[1].done();
- Trip::tr[2].done(); /* Get rid of Robin Hood and Friar Tuck. */
+void Timeout::lose_timer(byte which) {
+ byte fv;
- set_up_timer(1, procafter_the_shootemup, reason_hanging_around);
- /* Immediately call the following proc (when you have a chance). */
+ for (fv = 1; fv <= 7; fv ++) {
+ timetype &with = times[fv];
+ if (with.what_for == which)
+ with.time_left = 0;
+ } /* Cancel this one! */
+}
+
+/*function timer_is_on(which:byte):boolean;
+var fv:byte;
+begin
+ for fv:=1 to 7 do
+ with times[fv] do
+ if (what_for=which) and (time_left>0) then
+ begin
+ timer_is_on:=true;
+ exit;
+ end;
+ timer_is_on:=false;
+end;*/
- Gyro::dna.tied_up = false;
+/* Timeout procedures: */
- Enid::back_to_bootstrap(1); /* Call the shoot-'em-up. */
- }
+void Timeout::open_drawbridge() {
+ {
+ _vm->_gyro.dna.drawbridge_open ++;
+ _vm->_celer.show_one(_vm->_gyro.dna.drawbridge_open - 1);
- void after_the_shootemup() {
- warning("STUB: Timeout::after_the_shootemup()");
+ if (_vm->_gyro.dna.drawbridge_open == 4)
+ _vm->_gyro.magics[2].op = _vm->_gyro.nix; /* You may enter the drawbridge. */
+ else set_up_timer(7, procopen_drawbridge, reason_drawbridgefalls);
}
+}
- void jacques_wakes_up() {
- Gyro::dna.jacques_awake += 1;
+/* --- */
- switch (Gyro::dna.jacques_awake) { /* Additional pictures. */
- case 1 : {
- Celer::show_one(1); /* Eyes open. */
- Visa::dixi('Q', 45);
+void Timeout::avaricius_talks() {
+ {
+ _vm->_visa.dixi('q', _vm->_gyro.dna.avaricius_talk);
+ _vm->_gyro.dna.avaricius_talk ++;
+
+ if (_vm->_gyro.dna.avaricius_talk < 17)
+ set_up_timer(177, procavaricius_talks, reason_avariciustalks);
+ else _vm->_lucerna.points(3);
+
+ }
+}
+
+void Timeout::urinate() {
+ Trip::tr[1].turn(Trip::up);
+ Trip::stopwalking();
+ _vm->_lucerna.showrw();
+ set_up_timer(14, proctoilet2, reason_gototoilet);
+}
+
+void Timeout::toilet2() {
+ _vm->_scrolls.display("That's better!");
+}
+
+void Timeout::bang() {
+ _vm->_scrolls.display("\6< BANG! >");
+ set_up_timer(30, procbang2, reason_explosion);
+}
+
+void Timeout::bang2() {
+ _vm->_scrolls.display("Hmm... sounds like Spludwick's up to something...");
+}
+
+void Timeout::stairs() {
+ _vm->_gyro.blip();
+ Trip::tr[0].walkto(4);
+ _vm->_celer.show_one(2);
+ _vm->_gyro.dna.brummie_stairs = 2;
+ _vm->_gyro.magics[11].op = _vm->_gyro.special;
+ _vm->_gyro.magics[11].data = 2; /* Reached the bottom of the stairs. */
+ _vm->_gyro.magics[4].op = _vm->_gyro.nix; /* Stop them hitting the sides (or the game will hang.) */
+}
+
+void Timeout::cardiff_survey() {
+ {
+ switch (_vm->_gyro.dna.cardiff_things) {
+ case 0: {
+ _vm->_gyro.dna.cardiff_things += 1;
+ _vm->_visa.dixi('q', 27);
}
break;
- case 2 : { /* Going through the door. */
- Celer::show_one(2); /* Not on the floor. */
- Celer::show_one(3); /* But going through the door. */
- Gyro::magics[6].op = Gyro::nix; /* You can't wake him up now. */
}
+ _vm->_visa.dixi('z', _vm->_gyro.dna.cardiff_things);
+ }
+ _vm->_gyro.interrogation = _vm->_gyro.dna.cardiff_things;
+ set_up_timer(182, proccardiffsurvey, reason_cardiffsurvey);
+}
+
+void Timeout::cardiff_return() {
+ _vm->_visa.dixi('q', 28);
+ cardiff_survey(); /* add end of question. */
+}
+
+void Timeout::cwytalot_in_herts() {
+ _vm->_visa.dixi('q', 29);
+}
+
+void Timeout::get_tied_up() {
+ _vm->_visa.dixi('q', 34); /* ...Trouble! */
+ _vm->_gyro.dna.user_moves_avvy = false;
+ _vm->_gyro.dna.been_tied_up = true;
+ Trip::stopwalking();
+ Trip::tr[2].stopwalk();
+ Trip::tr[2].stophoming();
+ Trip::tr[2].call_eachstep = true;
+ Trip::tr[2].eachstep = Trip::procgrab_avvy;
+ set_up_timer(70, procget_tied_up2, reason_getting_tied_up);
+}
+
+void Timeout::get_tied_up2() {
+ Trip::tr[1].walkto(4);
+ Trip::tr[2].walkto(5);
+ _vm->_gyro.magics[4].op = _vm->_gyro.nix; /* No effect when you touch the boundaries. */
+ _vm->_gyro.dna.friar_will_tie_you_up = true;
+}
+
+void Timeout::hang_around() {
+ Trip::tr[2].check_me = false;
+ Trip::tr[1].init(7, true); /* Robin Hood */
+ _vm->_gyro.whereis[_vm->_gyro.probinhood] = r__robins;
+ Trip::apped(1, 2);
+ _vm->_visa.dixi('q', 39);
+ Trip::tr[1].walkto(7);
+ set_up_timer(55, prochang_around2, reason_hanging_around);
+}
+
+void Timeout::hang_around2() {
+ _vm->_visa.dixi('q', 40);
+ Trip::tr[2].vanishifstill = false;
+ Trip::tr[2].walkto(4);
+ _vm->_gyro.whereis[_vm->_gyro.pfriartuck] = r__robins;
+ _vm->_visa.dixi('q', 41);
+ Trip::tr[1].done();
+ Trip::tr[2].done(); /* Get rid of Robin Hood and Friar Tuck. */
+
+ set_up_timer(1, procafter_the_shootemup, reason_hanging_around);
+ /* Immediately call the following proc (when you have a chance). */
+
+ _vm->_gyro.dna.tied_up = false;
+
+ _vm->_enid.back_to_bootstrap(1); /* Call the shoot-'em-up. */
+}
+
+void Timeout::after_the_shootemup() {
+ warning("STUB: Timeout::after_the_shootemup()");
+}
+
+void Timeout::jacques_wakes_up() {
+ _vm->_gyro.dna.jacques_awake += 1;
+
+ switch (_vm->_gyro.dna.jacques_awake) { /* Additional pictures. */
+ case 1 : {
+ _vm->_celer.show_one(1); /* Eyes open. */
+ _vm->_visa.dixi('Q', 45);
+ }
+ break;
+ case 2 : { /* Going through the door. */
+ _vm->_celer.show_one(2); /* Not on the floor. */
+ _vm->_celer.show_one(3); /* But going through the door. */
+ _vm->_gyro.magics[6].op = _vm->_gyro.nix; /* You can't wake him up now. */
+ }
+ break;
+ case 3 : { /* Gone through the door. */
+ _vm->_celer.show_one(2); /* Not on the floor, either. */
+ _vm->_celer.show_one(4); /* He's gone... so the door's open. */
+ _vm->_gyro.whereis[_vm->_gyro.pjacques] = 0; /* Gone! */
+ }
+ break;
+ }
+
+
+ if (_vm->_gyro.dna.jacques_awake == 5) {
+ _vm->_gyro.dna.ringing_bells = true;
+ _vm->_gyro.dna.ayles_is_awake = true;
+ _vm->_lucerna.points(2);
+ }
+
+ switch (_vm->_gyro.dna.jacques_awake) {
+ case 1:
+ case 2:
+ case 3:
+ set_up_timer(12, procjacques_wakes_up, reason_jacques_waking_up);
break;
- case 3 : { /* Gone through the door. */
- Celer::show_one(2); /* Not on the floor, either. */
- Celer::show_one(4); /* He's gone... so the door's open. */
- Gyro::whereis[Gyro::pjacques] = 0; /* Gone! */
- }
+ case 4:
+ set_up_timer(24, procjacques_wakes_up, reason_jacques_waking_up);
break;
- }
+ }
+}
- if (Gyro::dna.jacques_awake == 5) {
- Gyro::dna.ringing_bells = true;
- Gyro::dna.ayles_is_awake = true;
- Lucerna::points(2);
- }
+void Timeout::naughty_duke()
+/* This is when the Duke comes in and takes your money. */
+{
+ Trip::tr[2].init(9, false); /* Here comes the Duke. */
+ Trip::apped(2, 1); /* He starts at the door... */
+ Trip::tr[2].walkto(3); /* He walks over to you. */
- switch (Gyro::dna.jacques_awake) {
- case 1:
- case 2:
- case 3:
- set_up_timer(12, procjacques_wakes_up, reason_jacques_waking_up);
- break;
- case 4:
- set_up_timer(24, procjacques_wakes_up, reason_jacques_waking_up);
- break;
- }
+ /* Let's get the door opening. */
+ _vm->_celer.show_one(1);
+ _vm->_sequence.first_show(2);
+ _vm->_sequence.start_to_close();
- }
+ set_up_timer(50, procnaughty_duke2, reason_naughty_duke);
+}
- void naughty_duke()
- /* This is when the Duke comes in and takes your money. */
- {
- Trip::tr[2].init(9, false); /* Here comes the Duke. */
- Trip::apped(2, 1); /* He starts at the door... */
- Trip::tr[2].walkto(3); /* He walks over to you. */
+void Timeout::naughty_duke2() {
+ _vm->_visa.dixi('q', 48); /* Ha ha, it worked again! */
+ Trip::tr[2].walkto(1); /* Walk to the door. */
+ Trip::tr[2].vanishifstill = true; /* Then go away! */
+ set_up_timer(32, procnaughty_duke3, reason_naughty_duke);
+}
- /* Let's get the door opening. */
- Celer::show_one(1);
- Sequence::first_show(2);
- Sequence::start_to_close();
+void Timeout::naughty_duke3() {
+ _vm->_celer.show_one(1);
+ _vm->_sequence.first_show(2);
+ _vm->_sequence.start_to_close();
+}
- set_up_timer(50, procnaughty_duke2, reason_naughty_duke);
- }
-
- void naughty_duke2() {
- Visa::dixi('q', 48); /* Ha ha, it worked again! */
- Trip::tr[2].walkto(1); /* Walk to the door. */
- Trip::tr[2].vanishifstill = true; /* Then go away! */
- set_up_timer(32, procnaughty_duke3, reason_naughty_duke);
- }
+void Timeout::jump() {
+ {
+ dnatype &with = _vm->_gyro.dna;
- void naughty_duke3() {
- Celer::show_one(1);
- Sequence::first_show(2);
- Sequence::start_to_close();
- }
+ with.jumpstatus += 1;
- void jump() {
{
- Gyro::dnatype &with = Gyro::dna;
-
- with.jumpstatus += 1;
-
- {
- Trip::triptype &with1 = Trip::tr[1];
- switch (with.jumpstatus) {
- case 1:
- case 2:
- case 3:
- case 5:
- case 7:
- case 9:
- with1.y -= 1;
- break;
- case 12:
- case 13:
- case 14:
- case 16:
- case 18:
- case 19:
- with1.y += 1;
- break;
- }
- }
-
- if (with.jumpstatus == 20) {
- /* End of jump. */
- Gyro::dna.user_moves_avvy = true;
- Gyro::dna.jumpstatus = 0;
- } else {
- /* Still jumping. */
- set_up_timer(1, procjump, reason_jumping);
- }
-
- if ((with.jumpstatus == 10) /* You're at the highest point of your jump. */
- && (Gyro::dna.room == r__insidecardiffcastle)
- && (Gyro::dna.arrow_in_the_door == true)
- && (Trip::infield(3))) { /* beside the wall*/
- /* Grab the arrow! */
- if (Gyro::dna.carrying >= Gyro::maxobjs)
- Scrolls::display("You fail to grab it, because your hands are full.");
- else {
- Celer::show_one(2);
- Gyro::dna.arrow_in_the_door = false; /* You've got it. */
- Gyro::dna.obj[Gyro::bolt] = true;
- Lucerna::objectlist();
- Visa::dixi('q', 50);
- Lucerna::points(3);
- }
+ Trip::triptype &with1 = Trip::tr[1];
+ switch (with.jumpstatus) {
+ case 1:
+ case 2:
+ case 3:
+ case 5:
+ case 7:
+ case 9:
+ with1.y -= 1;
+ break;
+ case 12:
+ case 13:
+ case 14:
+ case 16:
+ case 18:
+ case 19:
+ with1.y += 1;
+ break;
}
}
- }
-
- void crapulus_says_splud_out() {
- Visa::dixi('q', 56);
- Gyro::dna.crapulus_will_tell = false;
- }
-
- void buydrinks() {
- Celer::show_one(11); /* Malagauche gets up again. */
- Gyro::dna.malagauche = 0;
-
- Visa::dixi('D', Gyro::dna.drinking); /* Scrolls::display message about it. */
- Pingo::wobble(); /* Do the special effects. */
- Visa::dixi('D', 1); /* That'll be thruppence. */
- if (Gyro::pennycheck(3)) /* Pay 3d. */
- Visa::dixi('D', 3); /* Tell 'em you paid up. */
- Acci::have_a_drink();
- }
- void buywine() {
- Celer::show_one(11); /* Malagauche gets up again. */
- Gyro::dna.malagauche = 0;
-
- Visa::dixi('D', 50); /* You buy the wine. */
- Visa::dixi('D', 1); /* It'll be thruppence. */
- if (Gyro::pennycheck(3)) {
- Visa::dixi('D', 4); /* You paid up. */
- Gyro::dna.obj[Gyro::wine] = true;
- Lucerna::objectlist();
- Gyro::dna.winestate = 1; /* OK Wine */
+ if (with.jumpstatus == 20) {
+ /* End of jump. */
+ _vm->_gyro.dna.user_moves_avvy = true;
+ _vm->_gyro.dna.jumpstatus = 0;
+ } else {
+ /* Still jumping. */
+ set_up_timer(1, procjump, reason_jumping);
}
- }
-
- void callsguards() {
- Visa::dixi('Q', 58); /* GUARDS!!! */
- Lucerna::gameover();
- }
- void greetsmonk() {
- Visa::dixi('Q', 59);
- Gyro::dna.entered_lusties_room_as_monk = true;
- }
-
- void fall_down_oubliette() {
- Gyro::magics[9].op = Gyro::nix;
- Trip::tr[1].iy += 1; /* increments dx/dy! */
- Trip::tr[1].y += Trip::tr[1].iy; /* Dowwwn we go... */
- set_up_timer(3, procfall_down_oubliette, reason_falling_down_oubliette);
- }
-
- void meet_avaroid() {
- if (Gyro::dna.met_avaroid) {
- Scrolls::display("You can't expect to be \6that\22 lucky twice in a row!");
- Lucerna::gameover();
- } else {
- Visa::dixi('Q', 60);
- Gyro::dna.met_avaroid = true;
- set_up_timer(1, procrise_up_oubliette, reason_rising_up_oubliette);
- {
- Trip::triptype &with = Trip::tr[1];
- with.face = Trip::left;
- with.x = 151;
- with.ix = -3;
- with.iy = -5;
+ if ((with.jumpstatus == 10) /* You're at the highest point of your jump. */
+ && (_vm->_gyro.dna.room == r__insidecardiffcastle)
+ && (_vm->_gyro.dna.arrow_in_the_door == true)
+ && (Trip::infield(3))) { /* beside the wall*/
+ /* Grab the arrow! */
+ if (_vm->_gyro.dna.carrying >= maxobjs)
+ _vm->_scrolls.display("You fail to grab it, because your hands are full.");
+ else {
+ _vm->_celer.show_one(2);
+ _vm->_gyro.dna.arrow_in_the_door = false; /* You've got it. */
+ _vm->_gyro.dna.obj[_vm->_gyro.bolt] = true;
+ _vm->_lucerna.objectlist();
+ _vm->_visa.dixi('q', 50);
+ _vm->_lucerna.points(3);
}
- Gyro::background(2);
}
}
-
- void rise_up_oubliette() {
+}
+
+void Timeout::crapulus_says_splud_out() {
+ _vm->_visa.dixi('q', 56);
+ _vm->_gyro.dna.crapulus_will_tell = false;
+}
+
+void Timeout::buydrinks() {
+ _vm->_celer.show_one(11); /* Malagauche gets up again. */
+ _vm->_gyro.dna.malagauche = 0;
+
+ _vm->_visa.dixi('D', _vm->_gyro.dna.drinking); /* _vm->_scrolls.display message about it. */
+ _vm->_pingo.wobble(); /* Do the special effects. */
+ _vm->_visa.dixi('D', 1); /* That'll be thruppence. */
+ if (_vm->_gyro.pennycheck(3)) /* Pay 3d. */
+ _vm->_visa.dixi('D', 3); /* Tell 'em you paid up. */
+ Acci::have_a_drink();
+}
+
+void Timeout::buywine() {
+ _vm->_celer.show_one(11); /* Malagauche gets up again. */
+ _vm->_gyro.dna.malagauche = 0;
+
+ _vm->_visa.dixi('D', 50); /* You buy the wine. */
+ _vm->_visa.dixi('D', 1); /* It'll be thruppence. */
+ if (_vm->_gyro.pennycheck(3)) {
+ _vm->_visa.dixi('D', 4); /* You paid up. */
+ _vm->_gyro.dna.obj[_vm->_gyro.wine] = true;
+ _vm->_lucerna.objectlist();
+ _vm->_gyro.dna.winestate = 1; /* OK Wine */
+ }
+}
+
+void Timeout::callsguards() {
+ _vm->_visa.dixi('Q', 58); /* GUARDS!!! */
+ _vm->_lucerna.gameover();
+}
+
+void Timeout::greetsmonk() {
+ _vm->_visa.dixi('Q', 59);
+ _vm->_gyro.dna.entered_lusties_room_as_monk = true;
+}
+
+void Timeout::fall_down_oubliette() {
+ _vm->_gyro.magics[9].op = _vm->_gyro.nix;
+ Trip::tr[1].iy += 1; /* increments dx/dy! */
+ Trip::tr[1].y += Trip::tr[1].iy; /* Dowwwn we go... */
+ set_up_timer(3, procfall_down_oubliette, reason_falling_down_oubliette);
+}
+
+void Timeout::meet_avaroid() {
+ if (_vm->_gyro.dna.met_avaroid) {
+ _vm->_scrolls.display("You can't expect to be \6that\22 lucky twice in a row!");
+ _vm->_lucerna.gameover();
+ } else {
+ _vm->_visa.dixi('Q', 60);
+ _vm->_gyro.dna.met_avaroid = true;
+ set_up_timer(1, procrise_up_oubliette, reason_rising_up_oubliette);
{
Trip::triptype &with = Trip::tr[1];
-
- with.visible = true;
- with.iy += 1; /* decrements dx/dy! */
- with.y -= with.iy; /* Uuuupppp we go... */
- if (with.iy > 0)
- set_up_timer(3, procrise_up_oubliette, reason_rising_up_oubliette);
- else
- Gyro::dna.user_moves_avvy = true;
+ with.face = Trip::left;
+ with.x = 151;
+ with.ix = -3;
+ with.iy = -5;
}
+ _vm->_gyro.background(2);
}
+}
- void robin_hood_and_geida() {
- Trip::tr[1].init(7, true);
- Trip::apped(1, 7);
- Trip::tr[1].walkto(6);
- Trip::tr[2].stopwalk();
- Trip::tr[2].face = Trip::left;
- set_up_timer(20, procrobin_hood_and_geida_talk, reason_robin_hood_and_geida);
- Gyro::dna.geida_follows = false;
- }
-
- void robin_hood_and_geida_talk() {
- Visa::dixi('q', 66);
- Trip::tr[1].walkto(2);
- Trip::tr[2].walkto(2);
- Trip::tr[1].vanishifstill = true;
- Trip::tr[2].vanishifstill = true;
- set_up_timer(162, procavalot_returns, reason_robin_hood_and_geida);
- }
-
- void avalot_returns() {
- Trip::tr[1].done();
- Trip::tr[2].done();
- Trip::tr[1].init(0, true);
- Trip::apped(1, 1);
- Visa::dixi('q', 67);
- Gyro::dna.user_moves_avvy = true;
- }
-
- void avvy_sit_down()
- /* This is used when you sit down in the pub in Notts. It loops around so
- that it will happen when Avvy stops walking. */
+void Timeout::rise_up_oubliette() {
{
- if (Trip::tr[1].homing) /* Still walking */
- set_up_timer(1, procavvy_sit_down, reason_sitting_down);
- else {
- Celer::show_one(3);
- Gyro::dna.sitting_in_pub = true;
- Gyro::dna.user_moves_avvy = false;
- Trip::tr[1].visible = false;
- }
- }
+ Trip::triptype &with = Trip::tr[1];
- void ghost_room_phew() {
- Scrolls::display("\6PHEW!\22 You're glad to get out of \6there!");
- }
-
- void arkata_shouts() {
- if (Gyro::dna.teetotal) return;
- Visa::dixi('q', 76);
- set_up_timer(160, procarkata_shouts, reason_arkata_shouts);
- }
-
- void winning() {
- Visa::dixi('q', 79);
- Pingo::winning_pic();
- do {
- Lucerna::checkclick();
- } while (!(Gyro::mrelease == 0));
- Lucerna::callverb(Acci::vb_score);
- Scrolls::display(" T H E E N D ");
- Gyro::lmo = true;
- }
-
- void avalot_falls() {
- if (Trip::tr[1].step < 5) {
- Trip::tr[1].step += 1;
- set_up_timer(3, procavalot_falls, reason_falling_over);
- } else
- Scrolls::display("\r\r\r\r\r\r\n\n\n\n\n\n\23Z\26");
- }
-
- void spludwick_goes_to_cauldron() {
- if (Trip::tr[2].homing)
- set_up_timer(1, procspludwick_goes_to_cauldron, reason_spludwalk);
+ with.visible = true;
+ with.iy += 1; /* decrements dx/dy! */
+ with.y -= with.iy; /* Uuuupppp we go... */
+ if (with.iy > 0)
+ set_up_timer(3, procrise_up_oubliette, reason_rising_up_oubliette);
else
- set_up_timer(17, procspludwick_leaves_cauldron, reason_spludwalk);
- }
-
- void spludwick_leaves_cauldron() {
- Trip::tr[2].call_eachstep = true; /* So that normal procs will continue. */
- }
-
- void give_lute_to_geida() { /* Moved here from Acci. */
- Visa::dixi('Q', 86);
- Lucerna::points(4);
- Gyro::dna.lustie_is_asleep = true;
- Sequence::first_show(5);
- Sequence::then_show(6); /* He falls asleep... */
- Sequence::start_to_close(); /* Not really closing, but we're using the same procedure. */
- }
-
- /* "This is all!" */
-
- class unit_timeout_initialize {
- public:
- unit_timeout_initialize();
- };
- static unit_timeout_initialize timeout_constructor;
-
- unit_timeout_initialize::unit_timeout_initialize() {
- for (int i = 0; i < sizeof(times); i++) {
- times[i].time_left = 0;
- times[i].then_where = 0;
- times[i].what_for = 0;
- }
- }
-
+ _vm->_gyro.dna.user_moves_avvy = true;
+ }
+}
+
+void Timeout::robin_hood_and_geida() {
+ Trip::tr[1].init(7, true);
+ Trip::apped(1, 7);
+ Trip::tr[1].walkto(6);
+ Trip::tr[2].stopwalk();
+ Trip::tr[2].face = Trip::left;
+ set_up_timer(20, procrobin_hood_and_geida_talk, reason_robin_hood_and_geida);
+ _vm->_gyro.dna.geida_follows = false;
+}
+
+void Timeout::robin_hood_and_geida_talk() {
+ _vm->_visa.dixi('q', 66);
+ Trip::tr[1].walkto(2);
+ Trip::tr[2].walkto(2);
+ Trip::tr[1].vanishifstill = true;
+ Trip::tr[2].vanishifstill = true;
+ set_up_timer(162, procavalot_returns, reason_robin_hood_and_geida);
+}
+
+void Timeout::avalot_returns() {
+ Trip::tr[1].done();
+ Trip::tr[2].done();
+ Trip::tr[1].init(0, true);
+ Trip::apped(1, 1);
+ _vm->_visa.dixi('q', 67);
+ _vm->_gyro.dna.user_moves_avvy = true;
+}
+
+void Timeout::avvy_sit_down()
+/* This is used when you sit down in the pub in Notts. It loops around so
+ that it will happen when Avvy stops walking. */
+{
+ if (Trip::tr[1].homing) /* Still walking */
+ set_up_timer(1, procavvy_sit_down, reason_sitting_down);
+ else {
+ _vm->_celer.show_one(3);
+ _vm->_gyro.dna.sitting_in_pub = true;
+ _vm->_gyro.dna.user_moves_avvy = false;
+ Trip::tr[1].visible = false;
+ }
+}
+
+void Timeout::ghost_room_phew() {
+ _vm->_scrolls.display("\6PHEW!\22 You're glad to get out of \6there!");
+}
+
+void Timeout::arkata_shouts() {
+ if (_vm->_gyro.dna.teetotal) return;
+ _vm->_visa.dixi('q', 76);
+ set_up_timer(160, procarkata_shouts, reason_arkata_shouts);
+}
+
+void Timeout::winning() {
+ _vm->_visa.dixi('q', 79);
+ _vm->_pingo.winning_pic();
+ do {
+ _vm->_lucerna.checkclick();
+ } while (!(_vm->_gyro.mrelease == 0));
+ _vm->_lucerna.callverb(Acci::vb_score);
+ _vm->_scrolls.display(" T H E E N D ");
+ _vm->_gyro.lmo = true;
+}
+
+void Timeout::avalot_falls() {
+ if (Trip::tr[1].step < 5) {
+ Trip::tr[1].step += 1;
+ set_up_timer(3, procavalot_falls, reason_falling_over);
+ } else
+ _vm->_scrolls.display("\r\r\r\r\r\r\n\n\n\n\n\n\23Z\26");
+}
+
+void Timeout::spludwick_goes_to_cauldron() {
+ if (Trip::tr[2].homing)
+ set_up_timer(1, procspludwick_goes_to_cauldron, reason_spludwalk);
+ else
+ set_up_timer(17, procspludwick_leaves_cauldron, reason_spludwalk);
+}
+
+void Timeout::spludwick_leaves_cauldron() {
+ Trip::tr[2].call_eachstep = true; /* So that normal procs will continue. */
+}
+
+void Timeout::give_lute_to_geida() { /* Moved here from Acci. */
+ _vm->_visa.dixi('Q', 86);
+ _vm->_lucerna.points(4);
+ _vm->_gyro.dna.lustie_is_asleep = true;
+ _vm->_sequence.first_show(5);
+ _vm->_sequence.then_show(6); /* He falls asleep... */
+ _vm->_sequence.start_to_close(); /* Not really closing, but we're using the same procedure. */
+}
+
+/* "This is all!" */
- } // End of namespace Timeout.
} // End of namespace Avalanche.
diff --git a/engines/avalanche/timeout2.h b/engines/avalanche/timeout2.h
index 5130c92bbc..f7e984e42f 100644
--- a/engines/avalanche/timeout2.h
+++ b/engines/avalanche/timeout2.h
@@ -36,123 +36,124 @@
#include "avalanche/celer2.h"
namespace Avalanche {
+class AvalancheEngine;
- namespace Timeout {
-
+class Timeout {
+public:
/* reason_ now runs between 1 and 28. */
- const int16 reason_drawbridgefalls = 2;
- const int16 reason_avariciustalks = 3;
- const int16 reason_gototoilet = 4;
- const int16 reason_explosion = 5;
- const int16 reason_brummiestairs = 6;
- const int16 reason_cardiffsurvey = 7;
- const int16 reason_cwytalot_in_herts = 8;
- const int16 reason_getting_tied_up = 9;
- const int16 reason_hanging_around = 10; /* Tied to the tree in Nottingham. */
- const int16 reason_jacques_waking_up = 11;
- const int16 reason_naughty_duke = 12;
- const int16 reason_jumping = 13;
- const int16 reason_sequencer = 14;
- const int16 reason_crapulus_says_spludwick_out = 15;
- const int16 reason_dawndelay = 16;
- const int16 reason_drinks = 17;
- const int16 reason_du_lustie_talks = 18;
- const int16 reason_falling_down_oubliette = 19;
- const int16 reason_meeting_avaroid = 20;
- const int16 reason_rising_up_oubliette = 21;
- const int16 reason_robin_hood_and_geida = 22;
- const int16 reason_sitting_down = 23;
- const int16 reason_ghost_room_phew = 1;
- const int16 reason_arkata_shouts = 24;
- const int16 reason_winning = 25;
- const int16 reason_falling_over = 26;
- const int16 reason_spludwalk = 27;
- const int16 reason_geida_sings = 28;
+ static const int16 reason_drawbridgefalls = 2;
+ static const int16 reason_avariciustalks = 3;
+ static const int16 reason_gototoilet = 4;
+ static const int16 reason_explosion = 5;
+ static const int16 reason_brummiestairs = 6;
+ static const int16 reason_cardiffsurvey = 7;
+ static const int16 reason_cwytalot_in_herts = 8;
+ static const int16 reason_getting_tied_up = 9;
+ static const int16 reason_hanging_around = 10; /* Tied to the tree in Nottingham. */
+ static const int16 reason_jacques_waking_up = 11;
+ static const int16 reason_naughty_duke = 12;
+ static const int16 reason_jumping = 13;
+ static const int16 reason_sequencer = 14;
+ static const int16 reason_crapulus_says_spludwick_out = 15;
+ static const int16 reason_dawndelay = 16;
+ static const int16 reason_drinks = 17;
+ static const int16 reason_du_lustie_talks = 18;
+ static const int16 reason_falling_down_oubliette = 19;
+ static const int16 reason_meeting_avaroid = 20;
+ static const int16 reason_rising_up_oubliette = 21;
+ static const int16 reason_robin_hood_and_geida = 22;
+ static const int16 reason_sitting_down = 23;
+ static const int16 reason_ghost_room_phew = 1;
+ static const int16 reason_arkata_shouts = 24;
+ static const int16 reason_winning = 25;
+ static const int16 reason_falling_over = 26;
+ static const int16 reason_spludwalk = 27;
+ static const int16 reason_geida_sings = 28;
/* procx now runs between 1 and 41. */
- const int16 procopen_drawbridge = 3;
+ static const int16 procopen_drawbridge = 3;
- const int16 procavaricius_talks = 4;
+ static const int16 procavaricius_talks = 4;
- const int16 procurinate = 5;
+ static const int16 procurinate = 5;
- const int16 proctoilet2 = 6;
+ static const int16 proctoilet2 = 6;
- const int16 procbang = 7;
+ static const int16 procbang = 7;
- const int16 procbang2 = 8;
+ static const int16 procbang2 = 8;
- const int16 procstairs = 9;
+ static const int16 procstairs = 9;
- const int16 proccardiffsurvey = 10;
+ static const int16 proccardiffsurvey = 10;
- const int16 proccardiff_return = 11;
+ static const int16 proccardiff_return = 11;
- const int16 proc_cwytalot_in_herts = 12;
+ static const int16 proc_cwytalot_in_herts = 12;
- const int16 procget_tied_up = 13;
+ static const int16 procget_tied_up = 13;
- const int16 procget_tied_up2 = 1;
+ static const int16 procget_tied_up2 = 1;
- const int16 prochang_around = 14;
+ static const int16 prochang_around = 14;
- const int16 prochang_around2 = 15;
+ static const int16 prochang_around2 = 15;
- const int16 procafter_the_shootemup = 32;
+ static const int16 procafter_the_shootemup = 32;
- const int16 procjacques_wakes_up = 16;
+ static const int16 procjacques_wakes_up = 16;
- const int16 procnaughty_duke = 17;
+ static const int16 procnaughty_duke = 17;
- const int16 procnaughty_duke2 = 18;
+ static const int16 procnaughty_duke2 = 18;
- const int16 procnaughty_duke3 = 38;
+ static const int16 procnaughty_duke3 = 38;
- const int16 procjump = 19;
+ static const int16 procjump = 19;
- const int16 procsequence = 20;
+ static const int16 procsequence = 20;
- const int16 proccrapulus_splud_out = 21;
+ static const int16 proccrapulus_splud_out = 21;
- const int16 procdawn_delay = 22;
+ static const int16 procdawn_delay = 22;
- const int16 procbuydrinks = 23;
+ static const int16 procbuydrinks = 23;
- const int16 procbuywine = 24;
+ static const int16 procbuywine = 24;
- const int16 proccallsguards = 25;
+ static const int16 proccallsguards = 25;
- const int16 procgreetsmonk = 26;
+ static const int16 procgreetsmonk = 26;
- const int16 procfall_down_oubliette = 27;
+ static const int16 procfall_down_oubliette = 27;
- const int16 procmeet_avaroid = 28;
+ static const int16 procmeet_avaroid = 28;
- const int16 procrise_up_oubliette = 29;
+ static const int16 procrise_up_oubliette = 29;
- const int16 procrobin_hood_and_geida = 2;
+ static const int16 procrobin_hood_and_geida = 2;
- const int16 procrobin_hood_and_geida_talk = 30;
+ static const int16 procrobin_hood_and_geida_talk = 30;
- const int16 procavalot_returns = 31;
+ static const int16 procavalot_returns = 31;
- const int16 procavvy_sit_down = 33; /* In Nottingham. */
+ static const int16 procavvy_sit_down = 33; /* In Nottingham. */
- const int16 procghost_room_phew = 34;
+ static const int16 procghost_room_phew = 34;
- const int16 procarkata_shouts = 35;
+ static const int16 procarkata_shouts = 35;
- const int16 procwinning = 36;
+ static const int16 procwinning = 36;
- const int16 procavalot_falls = 37;
+ static const int16 procavalot_falls = 37;
- const int16 procspludwick_goes_to_cauldron = 39;
+ static const int16 procspludwick_goes_to_cauldron = 39;
- const int16 procspludwick_leaves_cauldron = 40;
+ static const int16 procspludwick_leaves_cauldron = 40;
- const int16 procgive_lute_to_geida = 41;
+ static const int16 procgive_lute_to_geida = 41;
struct timetype {
int32 time_left;
@@ -160,9 +161,15 @@ namespace Avalanche {
byte what_for;
};
- timetype times[7] = {{0,0,0}};
+ timetype times[7];
+
+
+
+ Timeout();
+
+ void setParent(AvalancheEngine *vm);
void set_up_timer(int32 howlong, byte whither, byte why);
@@ -252,7 +259,11 @@ namespace Avalanche {
void give_lute_to_geida();
- } // End of namespace Timeout.
+private:
+ AvalancheEngine *_vm;
+
+ byte fv;
+};
} // End of namespace Avalanche.