AVALANCHE: Timeout: replace namespace with class.

This commit is contained in:
uruk 2013-06-28 20:01:47 +02:00
parent e28d3263dc
commit adf4a357ce
4 changed files with 671 additions and 662 deletions

View File

@ -56,6 +56,8 @@ namespace Avalanche {
_lucerna.setParent(this);
_enid.setParent(this);
_celer.setParent(this);
_sequence.setParent(this);
_timeout.setParent(this);
}
AvalancheEngine::~AvalancheEngine() {

View File

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

View File

@ -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,11 +46,19 @@
namespace Avalanche {
namespace Timeout {
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;
}
}
byte fv;
void Timeout::setParent(AvalancheEngine *vm) {
_vm = vm;
}
void set_up_timer(int32 howlong, byte whither, byte why) {
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... */
@ -60,11 +70,10 @@ namespace Avalanche {
with.then_where = whither;
with.what_for = why;
}
}
}
void one_tick() {
if (Gyro::ddmnow) return;
void Timeout::one_tick() {
if (_vm->_gyro.ddmnow) return;
for (fv = 1; fv <= 7; fv ++) {
timetype &with = times[fv];
@ -134,13 +143,13 @@ namespace Avalanche {
jump();
break;
case procsequence:
Sequence::call_sequencer();
_vm->_sequence.call_sequencer();
break;
case proccrapulus_splud_out:
crapulus_says_splud_out();
break;
case procdawn_delay:
Lucerna::dawn();
_vm->_lucerna.dawn();
break;
case procbuydrinks:
buydrinks();
@ -199,11 +208,11 @@ namespace Avalanche {
}
}
}
Gyro::roomtime += 1; /* Cycles since you've been in this room. */
Gyro::dna.total_time += 1; /* Total amount of time for this game. */
}
_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 lose_timer(byte which) {
void Timeout::lose_timer(byte which) {
byte fv;
for (fv = 1; fv <= 7; fv ++) {
@ -211,11 +220,11 @@ namespace Avalanche {
if (with.what_for == which)
with.time_left = 0;
} /* Cancel this one! */
}
}
/*function timer_is_on(which:byte):boolean;
var fv:byte;
begin
/*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
@ -224,170 +233,170 @@ namespace Avalanche {
exit;
end;
timer_is_on:=false;
end;*/
end;*/
/* Timeout procedures: */
/* Timeout procedures: */
void open_drawbridge() {
void Timeout::open_drawbridge() {
{
Gyro::dna.drawbridge_open ++;
Celer::show_one(Gyro::dna.drawbridge_open - 1);
_vm->_gyro.dna.drawbridge_open ++;
_vm->_celer.show_one(_vm->_gyro.dna.drawbridge_open - 1);
if (Gyro::dna.drawbridge_open == 4)
Gyro::magics[2].op = Gyro::nix; /* You may enter the drawbridge. */
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 avaricius_talks() {
void Timeout::avaricius_talks() {
{
Visa::dixi('q', Gyro::dna.avaricius_talk);
Gyro::dna.avaricius_talk ++;
_vm->_visa.dixi('q', _vm->_gyro.dna.avaricius_talk);
_vm->_gyro.dna.avaricius_talk ++;
if (Gyro::dna.avaricius_talk < 17)
if (_vm->_gyro.dna.avaricius_talk < 17)
set_up_timer(177, procavaricius_talks, reason_avariciustalks);
else Lucerna::points(3);
else _vm->_lucerna.points(3);
}
}
}
void urinate() {
void Timeout::urinate() {
Trip::tr[1].turn(Trip::up);
Trip::stopwalking();
Lucerna::showrw();
_vm->_lucerna.showrw();
set_up_timer(14, proctoilet2, reason_gototoilet);
}
}
void toilet2() {
Scrolls::display("That's better!");
}
void Timeout::toilet2() {
_vm->_scrolls.display("That's better!");
}
void bang() {
Scrolls::display("\6< BANG! >");
void Timeout::bang() {
_vm->_scrolls.display("\6< BANG! >");
set_up_timer(30, procbang2, reason_explosion);
}
}
void bang2() {
Scrolls::display("Hmm... sounds like Spludwick's up to something...");
}
void Timeout::bang2() {
_vm->_scrolls.display("Hmm... sounds like Spludwick's up to something...");
}
void stairs() {
Gyro::blip();
void Timeout::stairs() {
_vm->_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.) */
}
_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 cardiff_survey() {
void Timeout::cardiff_survey() {
{
switch (Gyro::dna.cardiff_things) {
switch (_vm->_gyro.dna.cardiff_things) {
case 0: {
Gyro::dna.cardiff_things += 1;
Visa::dixi('q', 27);
_vm->_gyro.dna.cardiff_things += 1;
_vm->_visa.dixi('q', 27);
}
break;
}
Visa::dixi('z', Gyro::dna.cardiff_things);
_vm->_visa.dixi('z', _vm->_gyro.dna.cardiff_things);
}
Gyro::interrogation = Gyro::dna.cardiff_things;
_vm->_gyro.interrogation = _vm->_gyro.dna.cardiff_things;
set_up_timer(182, proccardiffsurvey, reason_cardiffsurvey);
}
}
void cardiff_return() {
Visa::dixi('q', 28);
void Timeout::cardiff_return() {
_vm->_visa.dixi('q', 28);
cardiff_survey(); /* add end of question. */
}
}
void cwytalot_in_herts() {
Visa::dixi('q', 29);
}
void Timeout::cwytalot_in_herts() {
_vm->_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;
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 get_tied_up2() {
void Timeout::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;
}
_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 hang_around() {
void Timeout::hang_around() {
Trip::tr[2].check_me = false;
Trip::tr[1].init(7, true); /* Robin Hood */
Gyro::whereis[Gyro::probinhood] = r__robins;
_vm->_gyro.whereis[_vm->_gyro.probinhood] = r__robins;
Trip::apped(1, 2);
Visa::dixi('q', 39);
_vm->_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);
void Timeout::hang_around2() {
_vm->_visa.dixi('q', 40);
Trip::tr[2].vanishifstill = false;
Trip::tr[2].walkto(4);
Gyro::whereis[Gyro::pfriartuck] = r__robins;
Visa::dixi('q', 41);
_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). */
Gyro::dna.tied_up = false;
_vm->_gyro.dna.tied_up = false;
Enid::back_to_bootstrap(1); /* Call the shoot-'em-up. */
}
_vm->_enid.back_to_bootstrap(1); /* Call the shoot-'em-up. */
}
void after_the_shootemup() {
void Timeout::after_the_shootemup() {
warning("STUB: Timeout::after_the_shootemup()");
}
}
void jacques_wakes_up() {
Gyro::dna.jacques_awake += 1;
void Timeout::jacques_wakes_up() {
_vm->_gyro.dna.jacques_awake += 1;
switch (Gyro::dna.jacques_awake) { /* Additional pictures. */
switch (_vm->_gyro.dna.jacques_awake) { /* Additional pictures. */
case 1 : {
Celer::show_one(1); /* Eyes open. */
Visa::dixi('Q', 45);
_vm->_celer.show_one(1); /* Eyes open. */
_vm->_visa.dixi('Q', 45);
}
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->_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. */
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! */
_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 (Gyro::dna.jacques_awake == 5) {
Gyro::dna.ringing_bells = true;
Gyro::dna.ayles_is_awake = true;
Lucerna::points(2);
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 (Gyro::dna.jacques_awake) {
switch (_vm->_gyro.dna.jacques_awake) {
case 1:
case 2:
case 3:
@ -398,39 +407,39 @@ namespace Avalanche {
break;
}
}
}
void naughty_duke()
/* This is when the Duke comes in and takes your money. */
{
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. */
/* Let's get the door opening. */
Celer::show_one(1);
Sequence::first_show(2);
Sequence::start_to_close();
_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! */
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);
}
}
void naughty_duke3() {
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();
}
void jump() {
void Timeout::jump() {
{
Gyro::dnatype &with = Gyro::dna;
dnatype &with = _vm->_gyro.dna;
with.jumpstatus += 1;
@ -458,87 +467,87 @@ namespace Avalanche {
if (with.jumpstatus == 20) {
/* End of jump. */
Gyro::dna.user_moves_avvy = true;
Gyro::dna.jumpstatus = 0;
_vm->_gyro.dna.user_moves_avvy = true;
_vm->_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)
&& (_vm->_gyro.dna.room == r__insidecardiffcastle)
&& (_vm->_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.");
if (_vm->_gyro.dna.carrying >= maxobjs)
_vm->_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);
}
_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);
}
}
}
}
void crapulus_says_splud_out() {
Visa::dixi('q', 56);
Gyro::dna.crapulus_will_tell = false;
}
void Timeout::crapulus_says_splud_out() {
_vm->_visa.dixi('q', 56);
_vm->_gyro.dna.crapulus_will_tell = false;
}
void buydrinks() {
Celer::show_one(11); /* Malagauche gets up again. */
Gyro::dna.malagauche = 0;
void Timeout::buydrinks() {
_vm->_celer.show_one(11); /* Malagauche gets up again. */
_vm->_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. */
_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 buywine() {
Celer::show_one(11); /* Malagauche gets up again. */
Gyro::dna.malagauche = 0;
void Timeout::buywine() {
_vm->_celer.show_one(11); /* Malagauche gets up again. */
_vm->_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 */
}
_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 callsguards() {
Visa::dixi('Q', 58); /* GUARDS!!! */
Lucerna::gameover();
}
void Timeout::callsguards() {
_vm->_visa.dixi('Q', 58); /* GUARDS!!! */
_vm->_lucerna.gameover();
}
void greetsmonk() {
Visa::dixi('Q', 59);
Gyro::dna.entered_lusties_room_as_monk = true;
}
void Timeout::greetsmonk() {
_vm->_visa.dixi('Q', 59);
_vm->_gyro.dna.entered_lusties_room_as_monk = true;
}
void fall_down_oubliette() {
Gyro::magics[9].op = Gyro::nix;
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 meet_avaroid() {
if (Gyro::dna.met_avaroid) {
Scrolls::display("You can't expect to be \6that\22 lucky twice in a row!");
Lucerna::gameover();
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 {
Visa::dixi('Q', 60);
Gyro::dna.met_avaroid = true;
_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];
@ -547,11 +556,11 @@ namespace Avalanche {
with.ix = -3;
with.iy = -5;
}
Gyro::background(2);
}
_vm->_gyro.background(2);
}
}
void rise_up_oubliette() {
void Timeout::rise_up_oubliette() {
{
Trip::triptype &with = Trip::tr[1];
@ -561,118 +570,102 @@ namespace Avalanche {
if (with.iy > 0)
set_up_timer(3, procrise_up_oubliette, reason_rising_up_oubliette);
else
Gyro::dna.user_moves_avvy = true;
}
_vm->_gyro.dna.user_moves_avvy = true;
}
}
void robin_hood_and_geida() {
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);
Gyro::dna.geida_follows = false;
}
_vm->_gyro.dna.geida_follows = false;
}
void robin_hood_and_geida_talk() {
Visa::dixi('q', 66);
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 avalot_returns() {
void Timeout::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;
}
_vm->_visa.dixi('q', 67);
_vm->_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
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 {
Celer::show_one(3);
Gyro::dna.sitting_in_pub = true;
Gyro::dna.user_moves_avvy = false;
_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 ghost_room_phew() {
Scrolls::display("\6PHEW!\22 You're glad to get out of \6there!");
}
void Timeout::ghost_room_phew() {
_vm->_scrolls.display("\6PHEW!\22 You're glad to get out of \6there!");
}
void arkata_shouts() {
if (Gyro::dna.teetotal) return;
Visa::dixi('q', 76);
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 winning() {
Visa::dixi('q', 79);
Pingo::winning_pic();
void Timeout::winning() {
_vm->_visa.dixi('q', 79);
_vm->_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;
}
_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 avalot_falls() {
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
Scrolls::display("\r\r\r\r\r\r\n\n\n\n\n\n\23Z\26");
}
_vm->_scrolls.display("\r\r\r\r\r\r\n\n\n\n\n\n\23Z\26");
}
void spludwick_goes_to_cauldron() {
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 spludwick_leaves_cauldron() {
void Timeout::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. */
}
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!" */
/* "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;
}
}
} // End of namespace Timeout.
} // End of namespace Avalanche.

View File

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