diff options
author | uruk | 2013-07-24 18:42:41 +0200 |
---|---|---|
committer | uruk | 2013-07-24 18:42:41 +0200 |
commit | ca51bf19c9dae1474ffacfb1a40f955972c368a8 (patch) | |
tree | 0156f22237264f78aff6ada3abb1b9773e65a9d1 /engines/avalanche | |
parent | 10ec7e0e0f2d4cc246db0c3792c5af05e413976b (diff) | |
download | scummvm-rg350-ca51bf19c9dae1474ffacfb1a40f955972c368a8.tar.gz scummvm-rg350-ca51bf19c9dae1474ffacfb1a40f955972c368a8.tar.bz2 scummvm-rg350-ca51bf19c9dae1474ffacfb1a40f955972c368a8.zip |
AVALANCHE: Change _timeout into pointer, update everything accordingly.
Diffstat (limited to 'engines/avalanche')
-rw-r--r-- | engines/avalanche/acci2.cpp | 22 | ||||
-rw-r--r-- | engines/avalanche/avalanche.cpp | 3 | ||||
-rw-r--r-- | engines/avalanche/avalanche.h | 2 | ||||
-rw-r--r-- | engines/avalanche/avalot.cpp | 2 | ||||
-rw-r--r-- | engines/avalanche/lucerna2.cpp | 28 | ||||
-rw-r--r-- | engines/avalanche/sequence2.cpp | 4 | ||||
-rw-r--r-- | engines/avalanche/timeout2.cpp | 8 | ||||
-rw-r--r-- | engines/avalanche/timeout2.h | 2 | ||||
-rw-r--r-- | engines/avalanche/trip6.cpp | 18 |
9 files changed, 44 insertions, 45 deletions
diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 5e2fb23f1d..d9180f49e7 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -622,7 +622,7 @@ void Acci::not_in_order() { void Acci::go_to_cauldron() { _vm->_trip.tr[2].call_eachstep = false; /* Stops Geida_Procs. */ - _vm->_timeout.set_up_timer(1, _vm->_timeout.procspludwick_goes_to_cauldron, _vm->_timeout.reason_spludwalk); + _vm->_timeout->set_up_timer(1, _vm->_timeout->procspludwick_goes_to_cauldron, _vm->_timeout->reason_spludwalk); _vm->_trip.tr[2].walkto(2); } @@ -726,7 +726,7 @@ void Acci::stand_up() { _vm->_celer.show_one(4); /* Picture of empty pillow. */ _vm->_lucerna.points(1); _vm->_gyro->dna.avvy_in_bed = false; - _vm->_timeout.lose_timer(_vm->_timeout.reason_arkata_shouts); + _vm->_timeout->lose_timer(_vm->_timeout->reason_arkata_shouts); } else already(); break; @@ -824,7 +824,7 @@ void Acci::give_geida_the_lute() { /* And the rest has been moved to Timeout... under give_lute_to_Geida. */ - _vm->_timeout.set_up_timer(1, _vm->_timeout.procgive_lute_to_geida, _vm->_timeout.reason_geida_sings); + _vm->_timeout->set_up_timer(1, _vm->_timeout->procgive_lute_to_geida, _vm->_timeout->reason_geida_sings); _vm->_enid.back_to_bootstrap(4); } @@ -841,7 +841,7 @@ void Acci::winsequence() { _vm->_sequence.then_show(8); _vm->_sequence.then_show(9); _vm->_sequence.start_to_close(); - _vm->_timeout.set_up_timer(30, _vm->_timeout.procwinning, _vm->_timeout.reason_winning); + _vm->_timeout->set_up_timer(30, _vm->_timeout->procwinning, _vm->_timeout->reason_winning); } void Acci::person_speaks() { @@ -1250,7 +1250,7 @@ void Acci::do_that() { case vb_pee: if (_vm->_gyro->flagset('P')) { _vm->_scrolls.display("Hmm, I don't think anyone will notice..."); - _vm->_timeout.set_up_timer(4, _vm->_timeout.procurinate, _vm->_timeout.reason_gototoilet); + _vm->_timeout->set_up_timer(4, _vm->_timeout->procurinate, _vm->_timeout->reason_gototoilet); } else _vm->_scrolls.display("It would be \6VERY\22 unwise to do that here, Avvy!"); break; @@ -1274,7 +1274,7 @@ void Acci::do_that() { _vm->_trip.tr[2].call_eachstep = true; _vm->_trip.tr[2].eachstep = _vm->_trip.procback_and_forth; _vm->_gyro->dna.avaricius_talk = 14; - _vm->_timeout.set_up_timer(177, _vm->_timeout.procavaricius_talks, _vm->_timeout.reason_avariciustalks); + _vm->_timeout->set_up_timer(177, _vm->_timeout->procavaricius_talks, _vm->_timeout->reason_avariciustalks); } } else _vm->_scrolls.display("Nothing appears to happen..."); @@ -1339,7 +1339,7 @@ void Acci::do_that() { _vm->_celer.show_one(10); _vm->_gyro->dna.malagauche = 177; - _vm->_timeout.set_up_timer(27, _vm->_timeout.procbuydrinks, _vm->_timeout.reason_drinks); + _vm->_timeout->set_up_timer(27, _vm->_timeout->procbuydrinks, _vm->_timeout->reason_drinks); break; case '\64': examine(); @@ -1365,7 +1365,7 @@ void Acci::do_that() { _vm->_celer.show_one(10); _vm->_gyro->dna.malagauche = 177; - _vm->_timeout.set_up_timer(27, _vm->_timeout.procbuywine, _vm->_timeout.reason_drinks); + _vm->_timeout->set_up_timer(27, _vm->_timeout->procbuywine, _vm->_timeout->reason_drinks); } break; } @@ -1465,7 +1465,7 @@ void Acci::do_that() { else { _vm->_lucerna.points(4); _vm->_scrolls.display("The drawbridge opens!"); - _vm->_timeout.set_up_timer(7, _vm->_timeout.procopen_drawbridge, _vm->_timeout.reason_drawbridgefalls); + _vm->_timeout->set_up_timer(7, _vm->_timeout->procopen_drawbridge, _vm->_timeout->reason_drawbridgefalls); _vm->_gyro->dna.drawbridge_open = 1; } } else @@ -1520,7 +1520,7 @@ void Acci::do_that() { break; case vb_jump: - _vm->_timeout.set_up_timer(1, _vm->_timeout.procjump, _vm->_timeout.reason_jumping); + _vm->_timeout->set_up_timer(1, _vm->_timeout->procjump, _vm->_timeout->reason_jumping); _vm->_gyro->dna.user_moves_avvy = false; break; @@ -1564,7 +1564,7 @@ void Acci::do_that() { _vm->_scrolls.display("You're already sitting!"); else { _vm->_trip.tr[1].walkto(4); /* Move Avvy to the place, and sit _vm->_gyro->him down. */ - _vm->_timeout.set_up_timer(1, _vm->_timeout.procavvy_sit_down, _vm->_timeout.reason_sitting_down); + _vm->_timeout->set_up_timer(1, _vm->_timeout->procavvy_sit_down, _vm->_timeout->reason_sitting_down); } } else { /* Default doodah. */ diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index d5187f1fa8..27dd779374 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -60,6 +60,7 @@ AvalancheEngine::~AvalancheEngine() { delete _avalot; delete _gyro; + delete _timeout; } Common::ErrorCode AvalancheEngine::initialize() { @@ -76,7 +77,7 @@ Common::ErrorCode AvalancheEngine::initialize() { _enid.setParent(this); _celer.setParent(this); _sequence.setParent(this); - _timeout.setParent(this); + _timeout = new Timeout(this); _trip.setParent(this); _acci.setParent(this); _basher.setParent(this); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 49c02ff141..e9de899c1c 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -78,7 +78,7 @@ public: Enid _enid; Celer _celer; Sequence _sequence; - Timeout _timeout; + Timeout *_timeout; Trip _trip; Acci _acci; Basher _basher; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 6ce6348e58..856d8b819f 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -197,7 +197,7 @@ void Avalot::run(Common::String arg) { if (_vm->_gyro->visible == _vm->_gyro->m_virtual) _vm->_gyro->wipe_vmc(_vm->_gyro->cp); - _vm->_timeout.one_tick(); + //_vm->_timeout->one_tick(); diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index f2690085e0..5034e13f8b 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -312,21 +312,21 @@ void Lucerna::exitroom(byte x) { switch (x) { case r__spludwicks: - _vm->_timeout.lose_timer(_vm->_timeout.reason_avariciustalks); + _vm->_timeout->lose_timer(_vm->_timeout->reason_avariciustalks); _vm->_gyro->dna.avaricius_talk = 0; /* He doesn't HAVE to be talking for this to work. It just deletes it IF it exists. */ break; case r__bridge: if (_vm->_gyro->dna.drawbridge_open > 0) { _vm->_gyro->dna.drawbridge_open = 4; /* Fully open. */ - _vm->_timeout.lose_timer(_vm->_timeout.reason_drawbridgefalls); + _vm->_timeout->lose_timer(_vm->_timeout->reason_drawbridgefalls); } break; case r__outsidecardiffcastle: - _vm->_timeout.lose_timer(_vm->_timeout.reason_cardiffsurvey); + _vm->_timeout->lose_timer(_vm->_timeout->reason_cardiffsurvey); break; case r__robins: - _vm->_timeout.lose_timer(_vm->_timeout.reason_getting_tied_up); + _vm->_timeout->lose_timer(_vm->_timeout->reason_getting_tied_up); break; } @@ -406,7 +406,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__yours: if (_vm->_gyro->dna.avvy_in_bed) { _vm->_celer.show_one(3); - _vm->_timeout.set_up_timer(100, _vm->_timeout.procarkata_shouts, _vm->_timeout.reason_arkata_shouts); + _vm->_timeout->set_up_timer(100, _vm->_timeout->procarkata_shouts, _vm->_timeout->reason_arkata_shouts); } break; @@ -434,7 +434,7 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_trip.tr[2].init(8, false, &_vm->_trip); _vm->_trip.apped(2, 2); _vm->_trip.tr[2].walkto(4); - _vm->_timeout.set_up_timer(20, _vm->_timeout.proccrapulus_splud_out, _vm->_timeout.reason_crapulus_says_spludwick_out); + _vm->_timeout->set_up_timer(20, _vm->_timeout->proccrapulus_splud_out, _vm->_timeout->reason_crapulus_says_spludwick_out); _vm->_gyro->dna.crapulus_will_tell = false; } } @@ -444,7 +444,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__outsidespludwicks: if ((_vm->_gyro->dna.rooms[r__outsidespludwicks] == 1) && (ped == 1)) { - _vm->_timeout.set_up_timer(20, _vm->_timeout.procbang, _vm->_timeout.reason_explosion); + _vm->_timeout->set_up_timer(20, _vm->_timeout->procbang, _vm->_timeout->reason_explosion); _vm->_gyro->dna.spludwicks_here = true; } break;*/ @@ -499,7 +499,7 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_trip.tr[2].vanishifstill = true; with.cwytalot_in_herts = true; /*_vm->_gyro->whereis[#157]:=r__Nowhere;*/ /* can we fit this in? */ - _vm->_timeout.set_up_timer(20, _vm->_timeout.proc_cwytalot_in_herts, _vm->_timeout.reason_cwytalot_in_herts); + _vm->_timeout->set_up_timer(20, _vm->_timeout->proc_cwytalot_in_herts, _vm->_timeout->reason_cwytalot_in_herts); } } break; @@ -520,7 +520,7 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_trip.tr[2].init(6, false, &_vm->_trip); _vm->_trip.apped(2, 2); _vm->_trip.tr[2].walkto(3); - _vm->_timeout.set_up_timer(36, _vm->_timeout.procget_tied_up, _vm->_timeout.reason_getting_tied_up); + _vm->_timeout->set_up_timer(36, _vm->_timeout->procget_tied_up, _vm->_timeout->reason_getting_tied_up); } } @@ -544,7 +544,7 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_trip.tr[2].init(9, false, &_vm->_trip); _vm->_trip.apped(2, 2); _vm->_trip.tr[2].walkto(3); - _vm->_timeout.set_up_timer(47, _vm->_timeout.proccardiffsurvey, _vm->_timeout.reason_cardiffsurvey); + _vm->_timeout->set_up_timer(47, _vm->_timeout->proccardiffsurvey, _vm->_timeout->reason_cardiffsurvey); } break; case 5 : @@ -554,7 +554,7 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_trip.tr[2].init(9, false, &_vm->_trip); _vm->_trip.apped(2, 3); _vm->_trip.tr[2].face = _vm->_trip.right; - _vm->_timeout.set_up_timer(3, _vm->_timeout.proccardiff_return, _vm->_timeout.reason_cardiffsurvey); + _vm->_timeout->set_up_timer(3, _vm->_timeout->proccardiff_return, _vm->_timeout->reason_cardiffsurvey); } } if (_vm->_gyro->dna.cardiff_things < 5) @@ -586,10 +586,10 @@ void Lucerna::enterroom(byte x, byte ped) { case r__lustiesroom: { _vm->_gyro->dna.dogfoodpos = 1; /* Actually, du Lustie pos. */ if (_vm->_trip.tr[1].whichsprite == 0) /* Avvy in his normal clothes */ - _vm->_timeout.set_up_timer(3, _vm->_timeout.proccallsguards, _vm->_timeout.reason_du_lustie_talks); + _vm->_timeout->set_up_timer(3, _vm->_timeout->proccallsguards, _vm->_timeout->reason_du_lustie_talks); else if (! _vm->_gyro->dna.entered_lusties_room_as_monk) /*already*/ /* Presumably, Avvy dressed as a monk. */ - _vm->_timeout.set_up_timer(3, _vm->_timeout.procgreetsmonk, _vm->_timeout.reason_du_lustie_talks); + _vm->_timeout->set_up_timer(3, _vm->_timeout->procgreetsmonk, _vm->_timeout->reason_du_lustie_talks); if (_vm->_gyro->dna.geida_follows) { put_geida_at(5, ped); @@ -1231,7 +1231,7 @@ void Lucerna::gameover() { _vm->_trip.tr[1].step = 0; _vm->_trip.tr[1].appear(sx, sy, 0); - _vm->_timeout.set_up_timer(3, _vm->_timeout.procavalot_falls, _vm->_timeout.reason_falling_over); + _vm->_timeout->set_up_timer(3, _vm->_timeout->procavalot_falls, _vm->_timeout->reason_falling_over); /* _vm->_scrolls.display(^m^m^m^m^m^m^i^i^i^i^i^i^s'Z'^v);*/ _vm->_gyro->alive = false; } diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index 61198d297a..5edb00a2be 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -71,8 +71,8 @@ void Sequence::then_flip(byte where, byte ped) { } void Sequence::start_to_close() { - _vm->_timeout.lose_timer(_vm->_timeout.reason_sequencer); - _vm->_timeout.set_up_timer(7, _vm->_timeout.procsequence, _vm->_timeout.reason_sequencer); + _vm->_timeout->lose_timer(_vm->_timeout->reason_sequencer); + _vm->_timeout->set_up_timer(7, _vm->_timeout->procsequence, _vm->_timeout->reason_sequencer); } void Sequence::start_to_open() { diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index b10c1c18d6..420469f920 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -46,7 +46,9 @@ namespace Avalanche { -Timeout::Timeout() { +Timeout::Timeout(AvalancheEngine *vm) { + _vm = vm; + for (int i = 0; i < sizeof(times); i++) { times[i].time_left = 0; times[i].then_where = 0; @@ -54,10 +56,6 @@ Timeout::Timeout() { } } -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)) diff --git a/engines/avalanche/timeout2.h b/engines/avalanche/timeout2.h index 07a48d6ad0..d315d5964a 100644 --- a/engines/avalanche/timeout2.h +++ b/engines/avalanche/timeout2.h @@ -164,7 +164,7 @@ public: - Timeout(); + Timeout(AvalancheEngine *vm); void setParent(AvalancheEngine *vm); diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 00fac658ab..492c6bf7dc 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -837,7 +837,7 @@ void Trip::catamove(byte ped) { /* This proc gets called whenever you touch a line defined as _vm->_gyro->special. */ void Trip::dawndelay() { - _vm->_timeout.set_up_timer(2, _vm->_timeout.procdawn_delay, _vm->_timeout.reason_dawndelay); + _vm->_timeout->set_up_timer(2, _vm->_timeout->procdawn_delay, _vm->_timeout->reason_dawndelay); } void Trip::call_special(uint16 which) { @@ -846,7 +846,7 @@ void Trip::call_special(uint16 which) { _vm->_celer.show_one(1); _vm->_gyro->dna.brummie_stairs = 1; _vm->_gyro->magics[10].op = _vm->_gyro->nix; - _vm->_timeout.set_up_timer(10, _vm->_timeout.procstairs, _vm->_timeout.reason_brummiestairs); + _vm->_timeout->set_up_timer(10, _vm->_timeout->procstairs, _vm->_timeout->reason_brummiestairs); stopwalking(); _vm->_gyro->dna.user_moves_avvy = false; break; @@ -879,7 +879,7 @@ void Trip::call_special(uint16 which) { case 4: /* This is the ghost room link. */ _vm->_lucerna.dusk(); tr[1].turn(right); /* you'll see this after we get back from bootstrap */ - _vm->_timeout.set_up_timer(1, _vm->_timeout.procghost_room_phew, _vm->_timeout.reason_ghost_room_phew); + _vm->_timeout->set_up_timer(1, _vm->_timeout->procghost_room_phew, _vm->_timeout->reason_ghost_room_phew); _vm->_enid.back_to_bootstrap(3); break; case 5: @@ -897,7 +897,7 @@ void Trip::call_special(uint16 which) { tr[2].vanishifstill = true; tr[2].check_me = true; /* One of them must have Check_Me switched on. */ _vm->_gyro->whereis[_vm->_gyro->pfriartuck] = 177; /* Not here, then. */ - _vm->_timeout.set_up_timer(364, _vm->_timeout.prochang_around, _vm->_timeout.reason_hanging_around); + _vm->_timeout->set_up_timer(364, _vm->_timeout->prochang_around, _vm->_timeout->reason_hanging_around); } break; case 6: /* _vm->_gyro->special 6: fall down oubliette. */ @@ -905,17 +905,17 @@ void Trip::call_special(uint16 which) { tr[1].ix = 3; tr[1].iy = 0; tr[1].face = right; - _vm->_timeout.set_up_timer(1, _vm->_timeout.procfall_down_oubliette, _vm->_timeout.reason_falling_down_oubliette); + _vm->_timeout->set_up_timer(1, _vm->_timeout->procfall_down_oubliette, _vm->_timeout->reason_falling_down_oubliette); break; case 7: /* _vm->_gyro->special 7: stop falling down oubliette. */ tr[1].visible = false; _vm->_gyro->magics[10].op = _vm->_gyro->nix; stopwalking(); - _vm->_timeout.lose_timer(_vm->_timeout.reason_falling_down_oubliette); + _vm->_timeout->lose_timer(_vm->_timeout->reason_falling_down_oubliette); _vm->_lucerna.mblit(12, 80, 38, 160, 3, 0); _vm->_lucerna.mblit(12, 80, 38, 160, 3, 1); _vm->_scrolls.display("Oh dear, you seem to be down the bottom of an oubliette."); - _vm->_timeout.set_up_timer(200, _vm->_timeout.procmeet_avaroid, _vm->_timeout.reason_meeting_avaroid); + _vm->_timeout->set_up_timer(200, _vm->_timeout->procmeet_avaroid, _vm->_timeout->reason_meeting_avaroid); break; case 8: /* _vm->_gyro->special 8: leave du Lustie's room. */ if ((_vm->_gyro->dna.geida_follows) && (!_vm->_gyro->dna.lustie_is_asleep)) { @@ -933,7 +933,7 @@ void Trip::call_special(uint16 which) { tr[2].walkto(4); /* She walks to somewhere... */ tr[1].done(); /* Lose Avvy. */ _vm->_gyro->dna.user_moves_avvy = false; - _vm->_timeout.set_up_timer(40, _vm->_timeout.procrobin_hood_and_geida, _vm->_timeout.reason_robin_hood_and_geida); + _vm->_timeout->set_up_timer(40, _vm->_timeout->procrobin_hood_and_geida, _vm->_timeout->reason_robin_hood_and_geida); break; case 10: /* _vm->_gyro->special 10: transfer north in catacombs. */ if ((_vm->_gyro->dna.cat_x == 4) && (_vm->_gyro->dna.cat_y == 1)) { @@ -1214,7 +1214,7 @@ void Trip::arrow_procs(byte tripnum) { _vm->_lucerna.gameover(); _vm->_gyro->dna.user_moves_avvy = false; /* Stop the user from moving him. */ - _vm->_timeout.set_up_timer(55, _vm->_timeout.procnaughty_duke, _vm->_timeout.reason_naughty_duke); + _vm->_timeout->set_up_timer(55, _vm->_timeout->procnaughty_duke, _vm->_timeout->reason_naughty_duke); } } else { /* Arrow has hit the wall! */ tr[tripnum].done(); /* Deallocate the arrow. */ |