diff options
author | uruk | 2013-08-23 11:33:37 +0200 |
---|---|---|
committer | uruk | 2013-08-23 11:33:37 +0200 |
commit | 457d898ff3a5fe5ee156a6d03be49b144cab551e (patch) | |
tree | dd3b5865b22137559680a797d33289c37eb4b10b /engines/avalanche | |
parent | dbd330bf2fdfdae94d4e50e9c4e3fff2162de478 (diff) | |
download | scummvm-rg350-457d898ff3a5fe5ee156a6d03be49b144cab551e.tar.gz scummvm-rg350-457d898ff3a5fe5ee156a6d03be49b144cab551e.tar.bz2 scummvm-rg350-457d898ff3a5fe5ee156a6d03be49b144cab551e.zip |
AVALANCHE: Upgrade Lucerna::enterroom(). Add r__yourhall to roomnums.h, handle it's cases in Lucerna:enterroom() and Trip::open_the_door(). Remove unnecessary typecasts in Celer::pics_link(), upgrade Celer::show_one(). Introduce Graphics::refreshBackground(), use it where needed.
Diffstat (limited to 'engines/avalanche')
-rw-r--r-- | engines/avalanche/acci2.cpp | 4 | ||||
-rw-r--r-- | engines/avalanche/celer2.cpp | 36 | ||||
-rw-r--r-- | engines/avalanche/graphics.cpp | 3 | ||||
-rw-r--r-- | engines/avalanche/graphics.h | 2 | ||||
-rw-r--r-- | engines/avalanche/lucerna2.cpp | 61 | ||||
-rw-r--r-- | engines/avalanche/roomnums.h | 2 | ||||
-rw-r--r-- | engines/avalanche/sequence2.cpp | 2 | ||||
-rw-r--r-- | engines/avalanche/timeout2.cpp | 2 | ||||
-rw-r--r-- | engines/avalanche/trip6.cpp | 3 |
9 files changed, 77 insertions, 38 deletions
diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 39dfd88ead..d586519cb1 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -673,7 +673,7 @@ bool Acci::holding() { void Acci::openBox(bool before) { if ((_vm->_gyro->dna.room == r__yours) && (thing == 54)) { - _vm->_celer->show_one(4); + _vm->_celer->show_one(5); _vm->_celer->pics_link(); _vm->_trip->trippancy_link(); @@ -682,7 +682,7 @@ void Acci::openBox(bool before) { _vm->_system->delayMillis(55); if (!before) { - _vm->_celer->show_one(5); + _vm->_celer->show_one(6); _vm->_celer->pics_link(); _vm->_trip->trippancy_link(); _vm->_graphics->refreshScreen(); diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 3667ae1840..7f1966223d 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -61,27 +61,27 @@ void Celer::pics_link() { switch (_vm->_gyro->dna.room) { case r__outsideargentpub: - if ((_vm->_gyro->roomtime % int32(12)) == 0) - show_one(int32(1) + (_vm->_gyro->roomtime / int32(12)) % int32(4)); + if ((_vm->_gyro->roomtime % 12) == 0) + show_one(1 + (_vm->_gyro->roomtime / 12) % 4); break; case r__brummieroad: - if ((_vm->_gyro->roomtime % int32(2)) == 0) - show_one(int32(1) + (_vm->_gyro->roomtime / int32(2)) % int32(4)); + if ((_vm->_gyro->roomtime % 2) == 0) + show_one(1 + (_vm->_gyro->roomtime / 2) % 4); break; case r__bridge: - if ((_vm->_gyro->roomtime % int32(2)) == 0) - show_one(int32(4) + (_vm->_gyro->roomtime / int32(2)) % int32(4)); + if ((_vm->_gyro->roomtime % 2) == 0) + show_one(4 + (_vm->_gyro->roomtime / 2) % 4); break; case r__yours: - if ((!_vm->_gyro->dna.avvy_is_awake) && ((_vm->_gyro->roomtime % int32(4)) == 0)) - show_one(0 + (_vm->_gyro->roomtime / 12) % 2); + if ((!_vm->_gyro->dna.avvy_is_awake) && ((_vm->_gyro->roomtime % 4) == 0)) + show_one(1 + (_vm->_gyro->roomtime / 12) % 2); break; case r__argentpub: - if (((_vm->_gyro->roomtime % int32(7)) == 1) && (_vm->_gyro->dna.malagauche != 177)) { + if (((_vm->_gyro->roomtime % 7) == 1) && (_vm->_gyro->dna.malagauche != 177)) { /* Malagauche cycle */ _vm->_gyro->dna.malagauche += 1; switch (_vm->_gyro->dna.malagauche) { @@ -138,7 +138,7 @@ void Celer::pics_link() { break; case r__westhall: - if ((_vm->_gyro->roomtime % int32(3)) == 0) { + if ((_vm->_gyro->roomtime % 3) == 0) { switch ((_vm->_gyro->roomtime / int32(3)) % int32(6)) { case 4: show_one(1); @@ -158,7 +158,7 @@ void Celer::pics_link() { case r__lustiesroom: if (!(_vm->_gyro->dna.lustie_is_asleep)) { - if ((_vm->_gyro->roomtime % int32(45)) > 42) + if ((_vm->_gyro->roomtime % 45) > 42) xx = 4; /* du Lustie blinks */ /* Bearing of Avvy from du Lustie. */ @@ -177,8 +177,8 @@ void Celer::pics_link() { break; case r__aylesoffice: - if ((!_vm->_gyro->dna.ayles_is_awake) && (_vm->_gyro->roomtime % int32(14) == 0)) { - switch ((_vm->_gyro->roomtime / int32(14)) % int32(2)) { + if ((!_vm->_gyro->dna.ayles_is_awake) && (_vm->_gyro->roomtime % 14 == 0)) { + switch ((_vm->_gyro->roomtime / 14) % 2) { case 0: show_one(1); break; /* Frame 2: EGA. */ @@ -191,7 +191,7 @@ void Celer::pics_link() { case r__robins: if (_vm->_gyro->dna.tied_up) { - switch (_vm->_gyro->roomtime % int32(54)) { + switch (_vm->_gyro->roomtime % 54) { case 20: show_one(4); break; /* Frame 4: Avalot blinks. */ @@ -241,7 +241,7 @@ void Celer::pics_link() { else if ((_vm->_lucerna->bearing(2) >= 181) && (_vm->_lucerna->bearing(2) <= 314)) xx = 8; /* Right. */ - if ((_vm->_gyro->roomtime % int32(45)) > 42) + if ((_vm->_gyro->roomtime % 45) > 42) xx += 1; /* Duck blinks */ if (xx != _vm->_gyro->dna.dogfoodpos) { /* Only if it's changed.*/ @@ -255,7 +255,7 @@ void Celer::pics_link() { if ((_vm->_gyro->dna.ringing_bells) && (_vm->_gyro->flagset('B'))) { /* They're ringing the bells. */ - switch (_vm->_gyro->roomtime % int32(4)) { + switch (_vm->_gyro->roomtime % 4) { case 1: if (_vm->_gyro->dna.nextbell < 5) _vm->_gyro->dna.nextbell = 12; @@ -353,7 +353,7 @@ void Celer::display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour void Celer::show_one(byte which) { chunkblocktype ch; - + which--; // For the difference between the Pascal and C array indexes. //setactivepage(3); warning("STUB: Celer::show_one()"); @@ -376,7 +376,7 @@ void Celer::show_one(byte which) { ch.natural = f.readByte(); ch.memorise = f.readByte(); - ::Graphics::Surface picture = _vm->_graphics->loadPictureRow(f, ch.xl * 8, ch.yl + 1); // There'll may be problems with the width! + ::Graphics::Surface picture = _vm->_graphics->loadPictureRow(f, ch.xl * 8, ch.yl + 1); display_it(ch.x, ch.y, ch.xl, ch.yl, ch.flavour, picture); diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 3821536835..b6dbe16c61 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -328,5 +328,8 @@ void Graphics::refreshScreen() { g_system->updateScreen(); } +void Graphics::refreshBackground() { + _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_graphics->_background, 0, 10); +} } // End of namespace Avalanche diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index e8cf02a12d..ca28772156 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -119,6 +119,8 @@ public: void refreshScreen(); + void refreshBackground(); + private: AvalancheEngine *_vm; diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 18e5858729..3f86eb5ed8 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -251,7 +251,7 @@ void Lucerna::load(byte n) { /* Load2, actually */ _vm->_graphics->_background = _vm->_graphics->loadPictureRow(f, _vm->_graphics->kBackgroundWidth, _vm->_graphics->kBackgroundHeight); - _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_graphics->_background, 0, 10); + _vm->_graphics->refreshBackground(); f.close(); @@ -388,6 +388,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__yours: if (_vm->_gyro->dna.avvy_in_bed) { _vm->_celer->show_one(3); + _vm->_graphics->refreshBackground(); _vm->_timeout->set_up_timer(100, _vm->_timeout->procarkata_shouts, _vm->_timeout->reason_arkata_shouts); } break; @@ -489,6 +490,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__bridge: { if (_vm->_gyro->dna.drawbridge_open == 4) { /*open*/ _vm->_celer->show_one(3); /* Position of drawbridge */ + _vm->_graphics->refreshBackground(); _vm->_gyro->magics[green].op = _vm->_gyro->nix; /* You may enter the drawbridge. */ } if (_vm->_gyro->dna.geida_follows) @@ -517,6 +519,7 @@ void Lucerna::enterroom(byte x, byte ped) { if (! _vm->_gyro->dna.mushroom_growing) _vm->_celer->show_one(3); + _vm->_graphics->refreshBackground(); } break; @@ -557,12 +560,14 @@ void Lucerna::enterroom(byte x, byte ped) { break; case r__argentpub: { - if (_vm->_gyro->dna.wonnim) _vm->_celer->show_one(1); /* No lute by the settle. */ + if (_vm->_gyro->dna.wonnim) + _vm->_celer->show_one(1); /* No lute by the settle. */ _vm->_gyro->dna.malagauche = 0; /* Ready to boot Malagauche */ if (_vm->_gyro->dna.givenbadgetoiby) { _vm->_celer->show_one(8); _vm->_celer->show_one(9); } + _vm->_graphics->refreshBackground(); } break; @@ -576,8 +581,10 @@ void Lucerna::enterroom(byte x, byte ped) { if (_vm->_gyro->dna.geida_follows) { put_geida_at(4, ped); - if (_vm->_gyro->dna.lustie_is_asleep) + if (_vm->_gyro->dna.lustie_is_asleep) { _vm->_celer->show_one(5); + _vm->_graphics->refreshBackground(); + } } } break; @@ -586,13 +593,16 @@ void Lucerna::enterroom(byte x, byte ped) { if (_vm->_gyro->dna.jacques_awake > 0) { _vm->_gyro->dna.jacques_awake = 5; _vm->_celer->show_one(2); + _vm->_graphics->refreshBackground(); _vm->_celer->show_one(4); _vm->_gyro->magics[brown].op = _vm->_gyro->nix; _vm->_gyro->whereis[_vm->_gyro->pjacques] = 0; } if (ped != 0) { _vm->_celer->show_one(6); - _vm->_sequence->first_show(5); + _vm->_graphics->refreshBackground(); + _vm->_sequence->first_show(6); + _vm->_sequence->then_show(5); _vm->_sequence->then_show(7); _vm->_sequence->start_to_close(); } @@ -602,7 +612,9 @@ void Lucerna::enterroom(byte x, byte ped) { case r__outsidenottspub: if (ped == 2) { _vm->_celer->show_one(3); - _vm->_sequence->first_show(2); + _vm->_graphics->refreshBackground(); + _vm->_sequence->first_show(3); + _vm->_sequence->then_show(2); _vm->_sequence->then_show(1); _vm->_sequence->then_show(4); _vm->_sequence->start_to_close(); @@ -612,7 +624,9 @@ void Lucerna::enterroom(byte x, byte ped) { case r__outsideargentpub: if (ped == 2) { _vm->_celer->show_one(6); - _vm->_sequence->first_show(5); + _vm->_graphics->refreshBackground(); + _vm->_sequence->first_show(6); + _vm->_sequence->then_show(5); _vm->_sequence->then_show(7); _vm->_sequence->start_to_close(); } @@ -636,6 +650,8 @@ void Lucerna::enterroom(byte x, byte ped) { case r__insidecardiffcastle: if (ped > 0) { _vm->_trip->tr[1].init(10, false, _vm->_trip); /* Define the dart. */ + _vm->_celer->show_one(1); + _vm->_graphics->refreshBackground(); _vm->_sequence->first_show(1); if (_vm->_gyro->dna.arrow_in_the_door) _vm->_sequence->then_show(3); @@ -648,26 +664,40 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_sequence->start_to_close(); } else { _vm->_celer->show_one(1); - if (_vm->_gyro->dna.arrow_in_the_door) _vm->_celer->show_one(3); - else _vm->_celer->show_one(2); + if (_vm->_gyro->dna.arrow_in_the_door) + _vm->_celer->show_one(3); + else + _vm->_celer->show_one(2); + _vm->_graphics->refreshBackground(); } break; case r__avvysgarden: if (ped == 1) { _vm->_celer->show_one(2); - _vm->_sequence->first_show(1); + _vm->_graphics->refreshBackground(); + _vm->_sequence->first_show(2); + _vm->_sequence->then_show(1); _vm->_sequence->then_show(3); _vm->_sequence->start_to_close(); } break; - + case r__entrancehall: case r__insideabbey: + case r__yourhall: if (ped == 2) { + /* It was the original: _vm->_celer->show_one(2); _vm->_sequence->first_show(1); _vm->_sequence->then_show(3); + _vm->_sequence->start_to_close();*/ + + _vm->_celer->show_one(2); + _vm->_graphics->refreshBackground(); + _vm->_sequence->first_show(2); + _vm->_sequence->then_show(1); + _vm->_sequence->then_show(3); _vm->_sequence->start_to_close(); } break; @@ -675,6 +705,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__aylesoffice: if (_vm->_gyro->dna.ayles_is_awake) _vm->_celer->show_one(2); + _vm->_graphics->refreshBackground(); break; /* Ayles awake. */ case r__geidas: @@ -702,6 +733,8 @@ void Lucerna::enterroom(byte x, byte ped) { if (ped == 2) { /* Shut the door */ _vm->_celer->show_one(3); + _vm->_graphics->refreshBackground(); + _vm->_sequence->first_show(3); _vm->_sequence->first_show(2); _vm->_sequence->then_show(1); _vm->_sequence->then_show(4); @@ -1291,16 +1324,16 @@ uint16 Lucerna::bearing(byte whichped) { uint16 bearing_result; { pedtype &with = _vm->_gyro->peds[whichped]; - if (_vm->_trip->tr[1].x == with.x) + if (_vm->_trip->tr[0].x == with.x) bearing_result = 0; /* This would cause a division by zero if we let it through. */ else { /* bearing:=trunc(((arctan((_vm->_trip->tr[1].y-y)/(_vm->_trip->tr[1].x-x)))*rad2deg)+90) mod 360*/ - if (_vm->_trip->tr[1].x < with.x) - bearing_result = (atan(double((_vm->_trip->tr[1].y - with.y)) / (_vm->_trip->tr[1].x - with.x)) * rad2deg) + 90; + if (_vm->_trip->tr[0].x < with.x) + bearing_result = (atan(double((_vm->_trip->tr[0].y - with.y)) / (_vm->_trip->tr[0].x - with.x)) * rad2deg) + 90; else - bearing_result = (atan(double((_vm->_trip->tr[1].y - with.y)) / (_vm->_trip->tr[1].x - with.x)) * rad2deg) + 270; + bearing_result = (atan(double((_vm->_trip->tr[0].y - with.y)) / (_vm->_trip->tr[0].x - with.x)) * rad2deg) + 270; } } return bearing_result; diff --git a/engines/avalanche/roomnums.h b/engines/avalanche/roomnums.h index a6cb93b3a8..fb99f5c780 100644 --- a/engines/avalanche/roomnums.h +++ b/engines/avalanche/roomnums.h @@ -36,7 +36,7 @@ const byte r__nowhere = 0; const byte r__yours = 1; const byte r__outsideyours = 2; const byte r__outsidespludwicks = 3; -//{ outside your castle = 5; } +const byte r__yourhall = 5; const byte r__musicroom = 7; const byte r__outsideargentpub = 9; const byte r__argentroad = 10; diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index fcca72432f..6439df26fe 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -102,7 +102,7 @@ void Sequence::call_sequencer() { if ((seq[0] >= 1) && (seq[0] <= 176)) { /* Show a frame. */ - _vm->_celer->show_one(seq[0] - 1); + _vm->_celer->show_one(seq[0]); shove_left(); } diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index ece531718d..bbb5e8cc3f 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -79,7 +79,7 @@ void Timeout::one_tick() { if (_vm->_gyro->ddmnow) return; - for (fv = 0; fv < 7; fv++) { + for (byte fv = 0; fv < 7; fv++) { if (times[fv].time_left > 0) { times[fv].time_left--; diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 637c510399..12294ba946 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -1040,6 +1040,7 @@ void Trip::open_the_door(byte whither, byte ped, byte magicnum) { case r__avvysgarden: case r__entrancehall: case r__insideabbey: + case r__yourhall: _vm->_sequence->first_show(1); _vm->_sequence->then_show(2); break; @@ -1393,7 +1394,7 @@ void Trip::call_andexors() { } while (!ok); - _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_graphics->_background, 0, 10); + _vm->_graphics->refreshBackground(); for (fv = 0; fv < 5; fv++) { if (order[fv] > -1) |