diff options
Diffstat (limited to 'engines/avalanche')
-rw-r--r-- | engines/avalanche/acci2.cpp | 36 | ||||
-rw-r--r-- | engines/avalanche/avalanche.cpp | 4 | ||||
-rw-r--r-- | engines/avalanche/avalot.cpp | 2 | ||||
-rw-r--r-- | engines/avalanche/celer2.cpp | 412 | ||||
-rw-r--r-- | engines/avalanche/celer2.h | 56 | ||||
-rw-r--r-- | engines/avalanche/lucerna2.cpp | 50 | ||||
-rw-r--r-- | engines/avalanche/sequence2.cpp | 2 | ||||
-rw-r--r-- | engines/avalanche/timeout2.cpp | 26 | ||||
-rw-r--r-- | engines/avalanche/trip6.cpp | 112 |
9 files changed, 346 insertions, 354 deletions
diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 1f455ec8cb..c75bfa4fcc 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -714,17 +714,17 @@ bool Acci::holding() { void Acci::openBox(bool isOpening) { if ((_vm->_gyro->dna.room == r__yours) && (_thing == 54)) { - _vm->_celer->show_one(-1, -1, 5); + _vm->_celer->drawBackgroundSprite(-1, -1, 5); - _vm->_celer->pics_link(); + _vm->_celer->refreshBackgroundSprites(); _vm->_trip->trippancy_link(); _vm->_graphics->refreshScreen(); _vm->_system->delayMillis(55); if (!isOpening) { - _vm->_celer->show_one(-1, -1, 6); - _vm->_celer->pics_link(); + _vm->_celer->drawBackgroundSprite(-1, -1, 6); + _vm->_celer->refreshBackgroundSprites(); _vm->_trip->trippancy_link(); _vm->_graphics->refreshScreen(); } @@ -1145,7 +1145,7 @@ void Acci::standUp() { _vm->_gyro->dna.user_moves_avvy = true; _vm->_trip->apped(1, 2); _vm->_gyro->dna.rw = _vm->_gyro->left; - _vm->_celer->show_one(-1, -1, 4); // Picture of empty pillow. + _vm->_celer->drawBackgroundSprite(-1, -1, 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); @@ -1159,7 +1159,7 @@ void Acci::standUp() { case r__nottspub: if (_vm->_gyro->dna.sitting_in_pub) { - _vm->_celer->show_one(-1, -1, 4); // Not sitting down. + _vm->_celer->drawBackgroundSprite(-1, -1, 4); // Not sitting down. _vm->_trip->tr[0].visible = true; // But standing up. _vm->_trip->apped(1, 4); // And walking away. _vm->_gyro->dna.sitting_in_pub = false; // Really not sitting down. @@ -1179,12 +1179,12 @@ void Acci::getProc(char thing) { case r__yours: if (_vm->_trip->infield(2)) { if (_vm->_gyro->dna.box_contents == thing) { - _vm->_celer->show_one(-1, -1, 5); + _vm->_celer->drawBackgroundSprite(-1, -1, 5); _vm->_scrolls->display("OK, I've got it."); _vm->_gyro->dna.obj[thing - 1] = true; _vm->_lucerna->objectlist(); _vm->_gyro->dna.box_contents = kNothing; - _vm->_celer->show_one(-1, -1, 6); + _vm->_celer->drawBackgroundSprite(-1, -1, 6); } else _vm->_scrolls->display(Common::String("I can't see ") + _vm->_gyro->get_better(thing) + " in the box."); } else @@ -1198,7 +1198,7 @@ void Acci::getProc(char thing) { _vm->_scrolls->display("It's not there, Avvy."); else { // OK: we're taking the pen, and it's there. - _vm->_celer->show_one(-1, -1, 4); // No pen there now. + _vm->_celer->drawBackgroundSprite(-1, -1, 4); // No pen there now. _vm->_trip->call_special(3); // Zap! _vm->_gyro->dna.taken_pen = true; _vm->_gyro->dna.obj[_vm->_gyro->pen - 1] = true; @@ -1219,7 +1219,7 @@ void Acci::getProc(char thing) { break; case r__robins: if ((thing == _vm->_gyro->mushroom) & (_vm->_trip->infield(1)) & (_vm->_gyro->dna.mushroom_growing)) { - _vm->_celer->show_one(-1, -1, 3); + _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_scrolls->display("Got it!"); _vm->_gyro->dna.mushroom_growing = false; _vm->_gyro->dna.taken_mushroom = true; @@ -1423,8 +1423,8 @@ void Acci::doThat() { _vm->_gyro->dna.obj[_vm->_gyro->badge - 1] = false; _vm->_gyro->dna.obj[_vm->_gyro->habit - 1] = true; _vm->_gyro->dna.givenbadgetoiby = true; - _vm->_celer->show_one(-1, -1, 8); - _vm->_celer->show_one(-1, -1, 9); + _vm->_celer->drawBackgroundSprite(-1, -1, 8); + _vm->_celer->drawBackgroundSprite(-1, -1, 9); } else heyThanks(); break; @@ -1608,7 +1608,7 @@ void Acci::doThat() { _vm->_gyro->dna.obj[_vm->_gyro->lute - 1] = true; _vm->_lucerna->objectlist(); _vm->_gyro->dna.wonnim = true; - _vm->_celer->show_one(-1, -1, 1); // Show the settle with no lute on it. + _vm->_celer->drawBackgroundSprite(-1, -1, 1); // Show the settle with no lute on it. _vm->_lucerna->points(7); // 7 points for winning! if (_vm->_gyro->dna.playednim == 1) @@ -1761,11 +1761,11 @@ void Acci::doThat() { if (_vm->_gyro->dna.alcohol == 0) _vm->_lucerna->points(3); - _vm->_celer->show_one(-1, -1, 12); + _vm->_celer->drawBackgroundSprite(-1, -1, 12); _vm->_scrolls->display(booze[_thing - 51] + ", please." + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); _vm->_gyro->dna.drinking = _thing; - _vm->_celer->show_one(-1, -1, 10); + _vm->_celer->drawBackgroundSprite(-1, -1, 10); _vm->_gyro->dna.malagauche = 177; _vm->_timeout->set_up_timer(27, _vm->_timeout->procbuydrinks, _vm->_timeout->reason_drinks); break; @@ -1786,11 +1786,11 @@ void Acci::doThat() { return; } - _vm->_celer->show_one(-1, -1, 12); + _vm->_celer->drawBackgroundSprite(-1, -1, 12); _vm->_scrolls->display(Common::String("Wine, please.") + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); if (_vm->_gyro->dna.alcohol == 0) _vm->_lucerna->points(3); - _vm->_celer->show_one(-1, -1, 10); + _vm->_celer->drawBackgroundSprite(-1, -1, 10); _vm->_gyro->dna.malagauche = 177; _vm->_timeout->set_up_timer(27, _vm->_timeout->procbuywine, _vm->_timeout->reason_drinks); @@ -1958,7 +1958,7 @@ void Acci::doThat() { _vm->_gyro->dna.avvy_is_awake = true; _vm->_lucerna->points(1); _vm->_gyro->dna.avvy_in_bed = true; - _vm->_celer->show_one(-1, -1, 3); /* Picture of Avvy, awake in bed. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 3); /* Picture of Avvy, awake in bed. */ if (_vm->_gyro->dna.teetotal) _vm->_visa->dixi('d', 13); } else diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 70d79425db..d3dfbff15a 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -463,7 +463,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { _lucerna->dawn(); } - _celer->forget_chunks(); + _celer->forgetBackgroundSprites(); _lucerna->minor_redraw(); @@ -482,7 +482,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { _gyro->ontoolbar = false; _trip->trippancy_link(); - _celer->pics_link(); + _celer->refreshBackgroundSprites(); _scrolls->display(Common::String(_scrolls->kControlItalic) + "Loaded: " + _scrolls->kControlRoman + description + ".ASG" + _scrolls->kControlCenter + _scrolls->kControlNewLine + _scrolls->kControlNewLine diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 2678123d8e..cade90ef3b 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -204,7 +204,7 @@ void Avalot::run(Common::String arg) { _vm->_dropdown->menu_link(); _vm->_gyro->force_numlock(); _vm->_trip->get_back_loretta(); - _vm->_celer->pics_link(); + _vm->_celer->refreshBackgroundSprites(); _vm->_trip->trippancy_link(); _vm->_lucerna->checkclick(); _vm->_timeout->one_tick(); diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 25093a9348..37329f1a67 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -37,224 +37,216 @@ #include "common/textconsole.h" + + namespace Avalanche { -const int16 Celer::on_disk = -1; +const int16 Celer::kOnDisk = -1; Celer::Celer(AvalancheEngine *vm) { _vm = vm; - num_chunks = 0; + _chunkNum = 0; } Celer::~Celer() { for (byte i = 0; i < 40; i++) - memory[i].free(); + _memory[i].free(); } -void Celer::pics_link() { - byte xx; +void Celer::refreshBackgroundSprites() { + byte direction; if (_vm->_gyro->ddmnow) - return; /* No animation when the menus are up. */ + return; // No animation when the menus are up. - switch (_vm->_gyro->dna.room) { case r__outsideargentpub: if ((_vm->_gyro->roomtime % 12) == 0) - show_one(-1, -1, 1 + (_vm->_gyro->roomtime / 12) % 4); + drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->roomtime / 12) % 4); break; - case r__brummieroad: if ((_vm->_gyro->roomtime % 2) == 0) - show_one(-1, -1, 1 + (_vm->_gyro->roomtime / 2) % 4); + drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->roomtime / 2) % 4); break; - case r__bridge: if ((_vm->_gyro->roomtime % 2) == 0) - show_one(-1, -1, 4 + (_vm->_gyro->roomtime / 2) % 4); + drawBackgroundSprite(-1, -1, 4 + (_vm->_gyro->roomtime / 2) % 4); break; - case r__yours: if ((!_vm->_gyro->dna.avvy_is_awake) && ((_vm->_gyro->roomtime % 4) == 0)) - show_one(-1, -1, 1 + (_vm->_gyro->roomtime / 12) % 2); + drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->roomtime / 12) % 2); break; + case r__argentpub: { + if (((_vm->_gyro->roomtime % 7) == 1) && (_vm->_gyro->dna.malagauche != 177)) { + // Malagauche cycle. + _vm->_gyro->dna.malagauche += 1; + switch (_vm->_gyro->dna.malagauche) { + case 1: + case 11: + case 21: + drawBackgroundSprite(-1, -1, 12); // Looks forwards. + break; + case 8: + case 18: + case 28: + case 32: + drawBackgroundSprite(-1, -1, 11); // Looks at you. + break; + case 30: + drawBackgroundSprite(-1, -1, 13); // Winks. + break; + case 33: + _vm->_gyro->dna.malagauche = 0; + break; + } + } - case r__argentpub: - if (((_vm->_gyro->roomtime % 7) == 1) && (_vm->_gyro->dna.malagauche != 177)) { - /* Malagauche cycle */ - _vm->_gyro->dna.malagauche += 1; - switch (_vm->_gyro->dna.malagauche) { - case 1: - case 11: - case 21: - show_one(-1, -1, 12); - break; /* Looks forwards. */ - case 8: - case 18: - case 28: - case 32: - show_one(-1, -1, 11); - break; /* Looks at you. */ - case 30: - show_one(-1, -1, 13); - break; /* Winks. */ - case 33: - _vm->_gyro->dna.malagauche = 0; + switch (_vm->_gyro->roomtime % 200) { + case 179: + case 197: + drawBackgroundSprite(-1, -1, 5); // Dogfood's drinking cycle. + break; + case 182: + case 194: + drawBackgroundSprite(-1, -1, 6); + break; + case 185: + drawBackgroundSprite(-1, -1, 7); break; + case 199: + _vm->_gyro->dna.dogfoodpos = 177; // Impossible value for this. + break; } - } - - switch (_vm->_gyro->roomtime % 200) { - case 179: - case 197: - show_one(-1, -1, 5); - break; /* Dogfood's drinking cycle */ - case 182: - case 194: - show_one(-1, -1, 6); - break; - case 185: - show_one(-1, -1, 7); - break; - case 199: - _vm->_gyro->dna.dogfoodpos = 177; - break; /* Impossible value for this. */ - } - if ((_vm->_gyro->roomtime % 200 >= 0) && (_vm->_gyro->roomtime % 200 <= 178)) { /* Normally. */ - if (((_vm->_lucerna->bearing(2) >= 1) && (_vm->_lucerna->bearing(2) <= 90)) || ((_vm->_lucerna->bearing(2) >= 358) && (_vm->_lucerna->bearing(2) <= 360))) - xx = 3; - else if ((_vm->_lucerna->bearing(2) >= 293) && (_vm->_lucerna->bearing(2) <= 357)) - xx = 2; - else if ((_vm->_lucerna->bearing(2) >= 271) && (_vm->_lucerna->bearing(2) <= 292)) - xx = 4; - - if (xx != _vm->_gyro->dna.dogfoodpos) { /* Only if it's changed.*/ - show_one(-1, -1, xx); - _vm->_gyro->dna.dogfoodpos = xx; + if ((_vm->_gyro->roomtime % 200 >= 0) && (_vm->_gyro->roomtime % 200 <= 178)) { // Normally. + if (((_vm->_lucerna->bearing(2) >= 1) && (_vm->_lucerna->bearing(2) <= 90)) || ((_vm->_lucerna->bearing(2) >= 358) && (_vm->_lucerna->bearing(2) <= 360))) + direction = 3; + else if ((_vm->_lucerna->bearing(2) >= 293) && (_vm->_lucerna->bearing(2) <= 357)) + direction = 2; + else if ((_vm->_lucerna->bearing(2) >= 271) && (_vm->_lucerna->bearing(2) <= 292)) + direction = 4; + + if (direction != _vm->_gyro->dna.dogfoodpos) { // Only if it's changed. + drawBackgroundSprite(-1, -1, direction); + _vm->_gyro->dna.dogfoodpos = direction; + } } } break; - case r__westhall: if ((_vm->_gyro->roomtime % 3) == 0) { switch ((_vm->_gyro->roomtime / int32(3)) % int32(6)) { case 4: - show_one(-1, -1, 1); + drawBackgroundSprite(-1, -1, 1); break; case 1: case 3: case 5: - show_one(-1, -1, 2); + drawBackgroundSprite(-1, -1, 2); break; case 0: case 2: - show_one(-1, -1, 3); + drawBackgroundSprite(-1, -1, 3); break; } } break; - case r__lustiesroom: if (!(_vm->_gyro->dna.lustie_is_asleep)) { if ((_vm->_gyro->roomtime % 45) > 42) - xx = 4; /* du Lustie blinks */ + direction = 4; // du Lustie blinks. - /* Bearing of Avvy from du Lustie. */ + // Bearing of Avvy from du Lustie. else if (((_vm->_lucerna->bearing(2) >= 0) && (_vm->_lucerna->bearing(2) <= 45)) || ((_vm->_lucerna->bearing(2) >= 315) && (_vm->_lucerna->bearing(2) <= 360))) - xx = 1; /* Middle. */ + direction = 1; // Middle. else if ((_vm->_lucerna->bearing(2) >= 45) && (_vm->_lucerna->bearing(2) <= 180)) - xx = 2; /* Left. */ + direction = 2; // Left. else if ((_vm->_lucerna->bearing(2) >= 181) && (_vm->_lucerna->bearing(2) <= 314)) - xx = 3; /* Right. */ + direction = 3; // Right. - if (xx != _vm->_gyro->dna.dogfoodpos) { /* Only if it's changed.*/ - show_one(-1, -1, xx); - _vm->_gyro->dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ + if (direction != _vm->_gyro->dna.dogfoodpos) { // Only if it's changed. + drawBackgroundSprite(-1, -1, direction); + _vm->_gyro->dna.dogfoodpos = direction; // We use DogfoodPos here too - why not? } } break; - case r__aylesoffice: if ((!_vm->_gyro->dna.ayles_is_awake) && (_vm->_gyro->roomtime % 14 == 0)) { switch ((_vm->_gyro->roomtime / 14) % 2) { case 0: - show_one(-1, -1, 1); - break; /* Frame 2: EGA. */ + drawBackgroundSprite(-1, -1, 1); // Frame 2: EGA. + break; case 1: - show_one(-1, -1, 3); - break; /* Frame 1: Natural. */ + drawBackgroundSprite(-1, -1, 3); // Frame 1: Natural. + break; } } break; - case r__robins: if (_vm->_gyro->dna.tied_up) { switch (_vm->_gyro->roomtime % 54) { case 20: - show_one(-1, -1, 4); - break; /* Frame 4: Avalot blinks. */ + drawBackgroundSprite(-1, -1, 4); // Frame 4: Avalot blinks. + break; case 23: - show_one(-1, -1, 2); - break; /* Frame 1: Back to normal. */ + drawBackgroundSprite(-1, -1, 2); // Frame 1: Back to normal. + break; } } break; + case r__nottspub: { + // Bearing of Avvy from Port. + if (((_vm->_lucerna->bearing(5) >= 0) && (_vm->_lucerna->bearing(5) <= 45)) || ((_vm->_lucerna->bearing(5) >= 315) && (_vm->_lucerna->bearing(5) <= 360))) + direction = 2; // Middle. + else if ((_vm->_lucerna->bearing(5) >= 45) && (_vm->_lucerna->bearing(5) <= 180)) + direction = 6; // Left. + else if ((_vm->_lucerna->bearing(5) >= 181) && (_vm->_lucerna->bearing(5) <= 314)) + direction = 8; // Right. + + if ((_vm->_gyro->roomtime % 60) > 57) + direction--; // Blinks. + + if (direction != _vm->_gyro->dna.dogfoodpos) { // Only if it's changed. + drawBackgroundSprite(-1, -1, direction); + _vm->_gyro->dna.dogfoodpos = direction; // We use DogfoodPos here too - why not? + } - case r__nottspub: - /* Bearing of Avvy from Port. */ - if (((_vm->_lucerna->bearing(5) >= 0) && (_vm->_lucerna->bearing(5) <= 45)) || ((_vm->_lucerna->bearing(5) >= 315) && (_vm->_lucerna->bearing(5) <= 360))) - xx = 2; /* Middle. */ - else if ((_vm->_lucerna->bearing(5) >= 45) && (_vm->_lucerna->bearing(5) <= 180)) - xx = 6; /* Left. */ - else if ((_vm->_lucerna->bearing(5) >= 181) && (_vm->_lucerna->bearing(5) <= 314)) - xx = 8; /* Right. */ - - if ((_vm->_gyro->roomtime % int32(60)) > 57) - xx--; /* Blinks */ - - if (xx != _vm->_gyro->dna.dogfoodpos) { /* Only if it's changed.*/ - show_one(-1, -1, xx); - _vm->_gyro->dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ - } - - switch (_vm->_gyro->roomtime % 50) { - case 45 : - show_one(-1, -1, 9); - break; /* Spurge blinks */ - case 49 : - show_one(-1, -1, 10); - break; + switch (_vm->_gyro->roomtime % 50) { + case 45 : + drawBackgroundSprite(-1, -1, 9); // Spurge blinks. + break; + case 49 : + drawBackgroundSprite(-1, -1, 10); + break; + } } break; + case r__ducks: { + if ((_vm->_gyro->roomtime % 3) == 0) // The fire flickers. + drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->roomtime / 3) % 3); - case r__ducks: - if ((_vm->_gyro->roomtime % 3) == 0) /* The fire flickers */ - show_one(-1, -1, 1 + (_vm->_gyro->roomtime / 3) % 3); - - {/* _vm->_lucerna->bearing of Avvy from Duck. */ - if (((_vm->_lucerna->bearing(2) >= 0) && (_vm->_lucerna->bearing(2) <= 45)) || ((_vm->_lucerna->bearing(2) >= 315) && (_vm->_lucerna->bearing(2) <= 360))) - xx = 4; /* Middle. */ - else if ((_vm->_lucerna->bearing(2) >= 45) && (_vm->_lucerna->bearing(2) <= 180)) - xx = 6; /* Left. */ - else if ((_vm->_lucerna->bearing(2) >= 181) && (_vm->_lucerna->bearing(2) <= 314)) - xx = 8; /* Right. */ + // Bearing of Avvy from Duck. + if (((_vm->_lucerna->bearing(2) >= 0) && (_vm->_lucerna->bearing(2) <= 45)) || ((_vm->_lucerna->bearing(2) >= 315) && (_vm->_lucerna->bearing(2) <= 360))) + direction = 4; // Middle. + else if ((_vm->_lucerna->bearing(2) >= 45) && (_vm->_lucerna->bearing(2) <= 180)) + direction = 6; // Left. + else if ((_vm->_lucerna->bearing(2) >= 181) && (_vm->_lucerna->bearing(2) <= 314)) + direction = 8; // Right. - if ((_vm->_gyro->roomtime % 45) > 42) - xx += 1; /* Duck blinks */ + if ((_vm->_gyro->roomtime % 45) > 42) + direction++; // Duck blinks. - if (xx != _vm->_gyro->dna.dogfoodpos) { /* Only if it's changed.*/ - show_one(-1, -1, xx); - _vm->_gyro->dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */ + if (direction != _vm->_gyro->dna.dogfoodpos) { // Only if it's changed. + drawBackgroundSprite(-1, -1, direction); + _vm->_gyro->dna.dogfoodpos = direction; // We use DogfoodPos here too - why not? + } } break; - } -} if ((_vm->_gyro->dna.ringing_bells) && (_vm->_gyro->flagset('B'))) { - /* They're ringing the bells. */ + // They're ringing the bells. switch (_vm->_gyro->roomtime % 4) { case 1: if (_vm->_gyro->dna.nextbell < 5) @@ -263,86 +255,84 @@ void Celer::pics_link() { _vm->_gyro->note(_vm->_gyro->notes[_vm->_gyro->dna.nextbell]); break; case 2: - //nosound; + //nosound(); warning("STUB: Celer::pics_link()"); break; } } } -void Celer::load_chunks(Common::String xx) { - chunkblocktype ch; - byte fv; - - filename = filename.format("chunk%s.avd", xx.c_str()); - if (!f.open(filename)) { - warning("AVALANCHE: Celer: File not found: %s", filename.c_str()); +void Celer::loadBackgroundSprites(Common::String xx) { + _filename = _filename.format("chunk%s.avd", xx.c_str()); + if (!_f.open(_filename)) { + warning("AVALANCHE: Celer: File not found: %s", _filename.c_str()); return; } - f.seek(44); - num_chunks = f.readByte(); - for (byte i = 0; i < num_chunks; i++) - offsets[i] = f.readSint32LE(); + _f.seek(44); + _chunkNum = _f.readByte(); + for (byte i = 0; i < _chunkNum; i++) + _offsets[i] = _f.readSint32LE(); - for (fv = 0; fv < num_chunks; fv++) { - f.seek(offsets[fv]); + for (byte i = 0; i < _chunkNum; i++) { + _f.seek(_offsets[i]); - ch.flavour = flavourtype(f.readByte()); - ch.x = f.readSint16LE(); - ch.y = f.readSint16LE(); - ch.xl = f.readSint16LE(); - ch.yl = f.readSint16LE(); - ch.size = f.readSint32LE(); - ch.natural = f.readByte(); - ch.memorise = f.readByte(); + SpriteType sprite; + sprite._type = PictureType(_f.readByte()); + sprite._x = _f.readSint16LE(); + sprite._y = _f.readSint16LE(); + sprite._xl = _f.readSint16LE(); + sprite._yl = _f.readSint16LE(); + sprite._size = _f.readSint32LE(); + sprite._natural = _f.readByte(); + sprite._memorise = _f.readByte(); - if (ch.memorise) { - memos[fv].x = ch.x; - memos[fv].xl = ch.xl; - memos[fv].y = ch.y; - memos[fv].yl = ch.yl; - memos[fv].flavour = ch.flavour; - - if (ch.natural) { - memos[fv].flavour = ch_natural_image; // We simply read from the screen and later, in display_it() we draw it right back. - memos[fv].size = memos[fv].xl * 8 * memos[fv].yl + 1; - memory[fv].create(memos[fv].xl * 8, memos[fv].yl + 1, ::Graphics::PixelFormat::createFormatCLUT8()); - - for (uint16 j = 0; j < memos[fv].yl + 1; j++) - for (uint16 i = 0; i < memos[fv].xl * 8; i++) - *(byte *)memory[fv].getBasePtr(i, j) = *_vm->_graphics->getPixel(memos[fv].x * 8 + i, memos[fv].y + j); + if (sprite._memorise) { + _memos[i]._x = sprite._x; + _memos[i]._xl = sprite._xl; + _memos[i]._y = sprite._y; + _memos[i]._yl = sprite._yl; + _memos[i]._type = sprite._type; + + if (sprite._natural) { + _memos[i]._type = kBaturalImage; // We simply read from the screen and later, in display_it() we draw it right back. + _memos[i]._size = _memos[i]._xl * 8 * _memos[i]._yl + 1; + _memory[i].create(_memos[i]._xl * 8, _memos[i]._yl + 1, ::Graphics::PixelFormat::createFormatCLUT8()); + + for (uint16 y = 0; y < _memos[i]._yl + 1; y++) + for (uint16 x = 0; x < _memos[i]._xl * 8; x++) + *(byte *)_memory[i].getBasePtr(x, y) = *_vm->_graphics->getPixel(_memos[i]._x * 8 + x, _memos[i]._y + y); } else { - memos[fv].size = ch.size; - memory[fv] = _vm->_graphics->loadPictureRow(f, memos[fv].xl * 8, memos[fv].yl + 1); // Celer::forget_chunks() deallocates it. + _memos[i]._size = sprite._size; + _memory[i] = _vm->_graphics->loadPictureRow(_f, _memos[i]._xl * 8, _memos[i]._yl + 1); // Celer::forget_chunks() deallocates it. } } else - memos[fv].x = on_disk; + _memos[i]._x = kOnDisk; } - f.close(); + _f.close(); } -void Celer::forget_chunks() { - for (byte fv = 0; fv < num_chunks; fv ++) - if (memos[fv].x > on_disk) - memory[fv].free(); +void Celer::forgetBackgroundSprites() { + for (byte i = 0; i < _chunkNum; i ++) + if (_memos[i]._x > kOnDisk) + _memory[i].free(); - memset(memos, 255, sizeof(memos)); /* x=-1, => on disk. */ + memset(_memos, 255, sizeof(_memos)); /* x=-1, => on disk. */ } -void Celer::display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour, const ::Graphics::Surface &picture) { - r.x1 = x; - r.y1 = y; - r.y2 = y + yl; +void Celer::drawSprite(int16 x, int16 y, int16 xl, int16 yl, PictureType flavour, const ::Graphics::Surface &picture) { + _r.x1 = x; + _r.y1 = y; + _r.y2 = y + yl; switch (flavour) { - case ch_natural_image: // Allow fallthorugh on purpose. - case ch_bgi : { - r.x2 = x + xl + 1; + case kBaturalImage: // Allow fallthorugh on purpose. + case kBgi : { + _r.x2 = x + xl + 1; } break; - case ch_ega : { - r.x2 = x + xl; + case kEga : { + _r.x2 = x + xl; } break; } @@ -351,52 +341,52 @@ void Celer::display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour _vm->_graphics->drawPicture(_vm->_graphics->_background, picture, x, y - 10); } -void Celer::show_one(int16 destX, int16 destY, byte which) { - chunkblocktype ch; +void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte which) { which--; // For the difference between the Pascal and C array indexes. //setactivepage(3); warning("STUB: Celer::show_one()"); - if (memos[which].x > on_disk) { - if (destX == -1) { - destX = memos[which].x * 8; - destY = memos[which].y; + if (_memos[which]._x > kOnDisk) { + if (destX < 0) { + destX = _memos[which]._x * 8; + destY = _memos[which]._y; } - display_it(destX, destY, memos[which].xl, memos[which].yl, memos[which].flavour, memory[which]); + drawSprite(destX, destY, _memos[which]._xl, _memos[which]._yl, _memos[which]._type, _memory[which]); } else { - if (!f.open(filename)) { /* Filename was set in load_chunks() */ - warning("AVALANCHE: Celer: File not found: %s", filename.c_str()); + if (!_f.open(_filename)) { /* Filename was set in load_chunks() */ + warning("AVALANCHE: Celer: File not found: %s", _filename.c_str()); return; } - f.seek(offsets[which]); + _f.seek(_offsets[which]); - ch.flavour = flavourtype(f.readByte()); - ch.x = f.readSint16LE(); - ch.y = f.readSint16LE(); - ch.xl = f.readSint16LE(); - ch.yl = f.readSint16LE(); - ch.size = f.readSint32LE(); - ch.natural = f.readByte(); - ch.memorise = f.readByte(); + SpriteType sprite; + sprite._type = PictureType(_f.readByte()); + sprite._x = _f.readSint16LE(); + sprite._y = _f.readSint16LE(); + sprite._xl = _f.readSint16LE(); + sprite._yl = _f.readSint16LE(); + sprite._size = _f.readSint32LE(); + sprite._natural = _f.readByte(); + sprite._memorise = _f.readByte(); - ::Graphics::Surface picture = _vm->_graphics->loadPictureRow(f, ch.xl * 8, ch.yl + 1); + ::Graphics::Surface picture = _vm->_graphics->loadPictureRow(_f, sprite._xl * 8, sprite._yl + 1); - if (destX == -1) { - destX = ch.x * 8; - destY = ch.y; + if (destX < 0) { + destX = sprite._x * 8; + destY = sprite._y; } - display_it(destX, destY, ch.xl, ch.yl, ch.flavour, picture); + drawSprite(destX, destY, sprite._xl, sprite._yl, sprite._type, picture); picture.free(); - f.close(); + _f.close(); } //setactivepage(1 - cp); warning("STUB: Celer::show_one()"); - for (byte fv = 0; fv < 2; fv ++) - _vm->_trip->getset[fv].remember(r); + for (byte i = 0; i < 2; i ++) + _vm->_trip->getset[i].remember(_r); } diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h index 3c7eda3cd9..f85ba34df2 100644 --- a/engines/avalanche/celer2.h +++ b/engines/avalanche/celer2.h @@ -36,35 +36,37 @@ #include "graphics/surface.h" + + namespace Avalanche { class AvalancheEngine; class Celer { public: - enum flavourtype {ch_ega, ch_bgi, ch_natural_image}; + enum PictureType {kEga, kBgi, kBaturalImage}; - struct chunkblocktype { - flavourtype flavour; - int16 x, y; - int16 xl, yl; - int32 size; - bool natural; + struct SpriteType { + PictureType _type; + int16 _x, _y; + int16 _xl, _yl; + int32 _size; + bool _natural; - bool memorise; /* Hold it in memory? */ + bool _memorise; /* Hold it in memory? */ }; - struct memotype { - int16 x, y; - int16 xl, yl; - flavourtype flavour; - uint16 size; + struct MemoType { + int16 _x, _y; + int16 _xl, _yl; + PictureType _type; + uint16 _size; }; - int32 offsets[40]; - byte num_chunks; - memotype memos[40]; - ::Graphics::Surface memory[40]; // .free() is called in ~Celer() - bytefield r; + int32 _offsets[40]; + byte _chunkNum; + MemoType _memos[40]; + ::Graphics::Surface _memory[40]; // .free() is called in ~Celer() + bytefield _r; @@ -72,27 +74,27 @@ public: ~Celer(); - void pics_link(); + void refreshBackgroundSprites(); - void load_chunks(Common::String xx); + void loadBackgroundSprites(Common::String xx); - void forget_chunks(); + void forgetBackgroundSprites(); - // Settint the destination to -1,-1 means the picture should be drawn to it's original position. + // Setting the destination to negative coordinates means the picture should be drawn to it's original position. // If you give it positive values, the picture will be plotted to the desired coordinates on the screen. // By that we get rid of show_one_at(), which would be almost identical and cause a lot of code duplication. - void show_one(int16 destX, int16 destY, byte which); + void drawBackgroundSprite(int16 destX, int16 destY, byte which); private: AvalancheEngine *_vm; - Common::String filename; + Common::String _filename; - Common::File f; + Common::File _f; - static const int16 on_disk; /* Value of memos[fv].x when it's not in memory. */ + static const int16 kOnDisk; /* Value of memos[fv].x when it's not in memory. */ - void display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour, const ::Graphics::Surface &picture); + void drawSprite(int16 x, int16 y, int16 xl, int16 yl, PictureType type, const ::Graphics::Surface &picture); }; } // End of namespace Avalanche. diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index d2f0e8f2b9..9e04ddbfba 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -262,7 +262,7 @@ void Lucerna::load(byte n) { /* Load2, actually */ load_also(xx); - _vm->_celer->load_chunks(xx); + _vm->_celer->loadBackgroundSprites(xx); bit = *_vm->_graphics->getPixel(0,0); @@ -292,7 +292,7 @@ void Lucerna::find_people(byte room) { void Lucerna::exitroom(byte x) { //nosound(); - _vm->_celer->forget_chunks(); + _vm->_celer->forgetBackgroundSprites(); _vm->_gyro->seescroll = true; /* This stops the trippancy system working over the length of this procedure. */ switch (x) { @@ -391,7 +391,7 @@ void Lucerna::enterroom(byte x, byte ped) { switch (x) { case r__yours: if (_vm->_gyro->dna.avvy_in_bed) { - _vm->_celer->show_one(-1, -1, 3); + _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_graphics->refreshBackground(); _vm->_timeout->set_up_timer(100, _vm->_timeout->procarkata_shouts, _vm->_timeout->reason_arkata_shouts); } @@ -492,7 +492,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__bridge: { if (_vm->_gyro->dna.drawbridge_open == 4) { /*open*/ - _vm->_celer->show_one(-1, -1, 3); /* Position of drawbridge */ + _vm->_celer->drawBackgroundSprite(-1, -1, 3); /* Position of drawbridge */ _vm->_graphics->refreshBackground(); _vm->_gyro->magics[green - 1].op = _vm->_gyro->nix; /* You may enter the drawbridge. */ } @@ -518,10 +518,10 @@ void Lucerna::enterroom(byte x, byte ped) { } if (_vm->_gyro->dna.tied_up) - _vm->_celer->show_one(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 2); if (!_vm->_gyro->dna.mushroom_growing) - _vm->_celer->show_one(-1, -1, 3); + _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_graphics->refreshBackground(); } break; @@ -603,11 +603,11 @@ void Lucerna::enterroom(byte x, byte ped) { case r__argentpub: { if (_vm->_gyro->dna.wonnim) - _vm->_celer->show_one(-1, -1, 1); /* No lute by the settle. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 1); /* No lute by the settle. */ _vm->_gyro->dna.malagauche = 0; /* Ready to boot Malagauche */ if (_vm->_gyro->dna.givenbadgetoiby) { - _vm->_celer->show_one(-1, -1, 8); - _vm->_celer->show_one(-1, -1, 9); + _vm->_celer->drawBackgroundSprite(-1, -1, 8); + _vm->_celer->drawBackgroundSprite(-1, -1, 9); } _vm->_graphics->refreshBackground(); } @@ -624,7 +624,7 @@ void Lucerna::enterroom(byte x, byte ped) { if (_vm->_gyro->dna.geida_follows) { put_geida_at(5, ped); if (_vm->_gyro->dna.lustie_is_asleep) { - _vm->_celer->show_one(-1, -1, 5); + _vm->_celer->drawBackgroundSprite(-1, -1, 5); _vm->_graphics->refreshBackground(); } } @@ -634,14 +634,14 @@ void Lucerna::enterroom(byte x, byte ped) { case r__musicroom: { if (_vm->_gyro->dna.jacques_awake > 0) { _vm->_gyro->dna.jacques_awake = 5; - _vm->_celer->show_one(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); - _vm->_celer->show_one(-1, -1, 4); + _vm->_celer->drawBackgroundSprite(-1, -1, 4); _vm->_gyro->magics[brown - 1].op = _vm->_gyro->nix; _vm->_gyro->whereis[_vm->_gyro->pjacques - 150] = 0; } if (ped != 0) { - _vm->_celer->show_one(-1, -1, 6); + _vm->_celer->drawBackgroundSprite(-1, -1, 6); _vm->_graphics->refreshBackground(); _vm->_sequence->first_show(6); _vm->_sequence->then_show(5); @@ -653,7 +653,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__outsidenottspub: if (ped == 2) { - _vm->_celer->show_one(-1, -1, 3); + _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_graphics->refreshBackground(); _vm->_sequence->first_show(3); _vm->_sequence->then_show(2); @@ -665,7 +665,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__outsideargentpub: if (ped == 2) { - _vm->_celer->show_one(-1, -1, 6); + _vm->_celer->drawBackgroundSprite(-1, -1, 6); _vm->_graphics->refreshBackground(); _vm->_sequence->first_show(6); _vm->_sequence->then_show(5); @@ -692,7 +692,7 @@ 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, -1, 1); + _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_graphics->refreshBackground(); _vm->_sequence->first_show(1); if (_vm->_gyro->dna.arrow_in_the_door) @@ -701,22 +701,22 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_sequence->then_show(2); if (_vm->_gyro->dna.taken_pen) - _vm->_celer->show_one(-1, -1, 4); + _vm->_celer->drawBackgroundSprite(-1, -1, 4); _vm->_sequence->start_to_close(); } else { - _vm->_celer->show_one(-1, -1, 1); + _vm->_celer->drawBackgroundSprite(-1, -1, 1); if (_vm->_gyro->dna.arrow_in_the_door) - _vm->_celer->show_one(-1, -1, 3); + _vm->_celer->drawBackgroundSprite(-1, -1, 3); else - _vm->_celer->show_one(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); } break; case r__avvysgarden: if (ped == 1) { - _vm->_celer->show_one(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); _vm->_sequence->first_show(2); _vm->_sequence->then_show(1); @@ -735,7 +735,7 @@ void Lucerna::enterroom(byte x, byte ped) { _vm->_sequence->then_show(3); _vm->_sequence->start_to_close();*/ - _vm->_celer->show_one(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); _vm->_sequence->first_show(2); _vm->_sequence->then_show(1); @@ -746,7 +746,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__aylesoffice: if (_vm->_gyro->dna.ayles_is_awake) - _vm->_celer->show_one(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_graphics->refreshBackground(); break; /* Ayles awake. */ @@ -766,7 +766,7 @@ void Lucerna::enterroom(byte x, byte ped) { break; case r__nottspub: { - if (_vm->_gyro->dna.sitting_in_pub) _vm->_celer->show_one(-1, -1, 3); + if (_vm->_gyro->dna.sitting_in_pub) _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_gyro->dna.dogfoodpos = 1; /* Actually, du Lustie pos. */ } break; @@ -774,7 +774,7 @@ void Lucerna::enterroom(byte x, byte ped) { case r__outsideducks: if (ped == 2) { /* Shut the door */ - _vm->_celer->show_one(-1, -1, 3); + _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_graphics->refreshBackground(); _vm->_sequence->first_show(3); _vm->_sequence->first_show(2); diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index d9f52a3b17..68a8ea33e3 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(-1, -1, seq[0]); + _vm->_celer->drawBackgroundSprite(-1, -1, seq[0]); shove_left(); } diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index ab1fcf072a..7979a8d09a 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -224,7 +224,7 @@ void Timeout::lose_timer(byte which) { void Timeout::open_drawbridge() { _vm->_gyro->dna.drawbridge_open++; - _vm->_celer->show_one(-1, -1, _vm->_gyro->dna.drawbridge_open - 1); + _vm->_celer->drawBackgroundSprite(-1, -1, _vm->_gyro->dna.drawbridge_open - 1); if (_vm->_gyro->dna.drawbridge_open == 4) _vm->_gyro->magics[1].op = _vm->_gyro->nix; // You may enter the drawbridge. @@ -265,7 +265,7 @@ void Timeout::bang2() { void Timeout::stairs() { _vm->_gyro->blip(); _vm->_trip->tr[0].walkto(4); - _vm->_celer->show_one(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_gyro->dna.brummie_stairs = 2; _vm->_gyro->magics[10].op = _vm->_gyro->special; _vm->_gyro->magics[10].data = 2; // Reached the bottom of the stairs. @@ -379,17 +379,17 @@ void Timeout::jacques_wakes_up() { switch (_vm->_gyro->dna.jacques_awake) { // Additional pictures. case 1 : - _vm->_celer->show_one(-1, -1, 1); // Eyes open. + _vm->_celer->drawBackgroundSprite(-1, -1, 1); // Eyes open. _vm->_visa->dixi('Q', 45); break; case 2 : // Going through the door. - _vm->_celer->show_one(-1, -1, 2); // Not on the floor. - _vm->_celer->show_one(-1, -1, 3); // But going through the door. + _vm->_celer->drawBackgroundSprite(-1, -1, 2); // Not on the floor. + _vm->_celer->drawBackgroundSprite(-1, -1, 3); // But going through the door. _vm->_gyro->magics[5].op = _vm->_gyro->nix; // You can't wake him up now. break; case 3 : // Gone through the door. - _vm->_celer->show_one(-1, -1, 2); // Not on the floor, either. - _vm->_celer->show_one(-1, -1, 4); // He's gone... so the door's open. + _vm->_celer->drawBackgroundSprite(-1, -1, 2); // Not on the floor, either. + _vm->_celer->drawBackgroundSprite(-1, -1, 4); // He's gone... so the door's open. _vm->_gyro->whereis[_vm->_gyro->pjacques - 150] = 0; // Gone! break; } @@ -418,7 +418,7 @@ void Timeout::naughty_duke() { // This is when the Duke comes in and takes your _vm->_trip->tr[1].walkto(3); // He walks over to you. // Let's get the door opening. - _vm->_celer->show_one(-1, -1, 1); + _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_sequence->first_show(2); _vm->_sequence->start_to_close(); @@ -433,7 +433,7 @@ void Timeout::naughty_duke2() { } void Timeout::naughty_duke3() { - _vm->_celer->show_one(-1, -1, 1); + _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_sequence->first_show(2); _vm->_sequence->start_to_close(); } @@ -475,7 +475,7 @@ void Timeout::jump() { if (_vm->_gyro->dna.carrying >= maxobjs) _vm->_scrolls->display("You fail to grab it, because your hands are full."); else { - _vm->_celer->show_one(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_gyro->dna.arrow_in_the_door = false; // You've got it. _vm->_gyro->dna.obj[_vm->_gyro->bolt - 1] = true; _vm->_lucerna->objectlist(); @@ -491,7 +491,7 @@ void Timeout::crapulus_says_splud_out() { } void Timeout::buydrinks() { - _vm->_celer->show_one(-1, -1, 11); // Malagauche gets up again. + _vm->_celer->drawBackgroundSprite(-1, -1, 11); // Malagauche gets up again. _vm->_gyro->dna.malagauche = 0; _vm->_visa->dixi('D', _vm->_gyro->dna.drinking); // Display message about it. @@ -503,7 +503,7 @@ void Timeout::buydrinks() { } void Timeout::buywine() { - _vm->_celer->show_one(-1, -1, 11); // Malagauche gets up again. + _vm->_celer->drawBackgroundSprite(-1, -1, 11); // Malagauche gets up again. _vm->_gyro->dna.malagauche = 0; _vm->_visa->dixi('D', 50); // You buy the wine. @@ -595,7 +595,7 @@ void Timeout::avvy_sit_down() { if (_vm->_trip->tr[0].homing) // Still walking. set_up_timer(1, procavvy_sit_down, reason_sitting_down); else { - _vm->_celer->show_one(-1, -1, 3); + _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_gyro->dna.sitting_in_pub = true; _vm->_gyro->dna.user_moves_avvy = false; _vm->_trip->tr[0].visible = false; diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index 5e42839e93..e03444656d 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -578,59 +578,59 @@ void Trip::catamove(byte ped) { _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[4].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer->show_one(-1, -1, 28); + _vm->_celer->drawBackgroundSprite(-1, -1, 28); break; case 0x1: /* no connection (wall + shield), */ _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[4].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer->show_one(-1, -1, 28); /* Wall, plus... */ - _vm->_celer->show_one(-1, -1, 29); /* ...shield. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 28); /* Wall, plus... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 29); /* ...shield. */ break; case 0x2: /* wall with door */ _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[4].op = _vm->_gyro->special; /* Door. */ - _vm->_celer->show_one(-1, -1, 28); /* Wall, plus... */ - _vm->_celer->show_one(-1, -1, 30); /* ...door. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 28); /* Wall, plus... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 30); /* ...door. */ break; case 0x3: /* wall with door and shield */ _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[4].op = _vm->_gyro->special; /* Door. */ - _vm->_celer->show_one(-1, -1, 28); /* Wall, plus... */ - _vm->_celer->show_one(-1, -1, 30); /* ...door, and... */ - _vm->_celer->show_one(-1, -1, 29); /* ...shield. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 28); /* Wall, plus... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 30); /* ...door, and... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 29); /* ...shield. */ break; case 0x4: /* no connection (wall + window), */ _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[4].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer->show_one(-1, -1, 28); /* Wall, plus... */ - _vm->_celer->show_one(-1, -1, 5); /* ...window. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 28); /* Wall, plus... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 5); /* ...window. */ break; case 0x5: /* wall with door and window */ _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[4].op = _vm->_gyro->special; /* Door. */ - _vm->_celer->show_one(-1, -1, 28); /* Wall, plus... */ - _vm->_celer->show_one(-1, -1, 30); /* ...door, and... */ - _vm->_celer->show_one(-1, -1, 5); /* ...window. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 28); /* Wall, plus... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 30); /* ...door, and... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 5); /* ...window. */ break; case 0x6: /* no connection (wall + torches), */ _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[4].op = _vm->_gyro->nix; /* No door. */ - _vm->_celer->show_one(-1, -1, 28); /* Wall, plus... */ - _vm->_celer->show_one(-1, -1, 7); /* ...torches. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 28); /* Wall, plus... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 7); /* ...torches. */ break; case 0x7: /* wall with door and torches */ _vm->_gyro->magics[1].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[2].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[4].op = _vm->_gyro->special; /* Door. */ - _vm->_celer->show_one(-1, -1, 28); /* Wall, plus... */ - _vm->_celer->show_one(-1, -1, 30); /* ...door, and... */ - _vm->_celer->show_one(-1, -1, 7); /* ...torches. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 28); /* Wall, plus... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 30); /* ...door, and... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 7); /* ...torches. */ break; case 0xf: /* straight-through corridor. */ _vm->_gyro->magics[1].op = _vm->_gyro->nix; /* Sloping wall. */ @@ -645,44 +645,44 @@ void Trip::catamove(byte ped) { _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[6].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer->show_one(-1, -1, 19); + _vm->_celer->drawBackgroundSprite(-1, -1, 19); break; case 0x1: /* no connection (wall + window), */ _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[6].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer->show_one(-1, -1, 19); /* Wall, plus... */ - _vm->_celer->show_one(-1, -1, 20); /* ...window. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 19); /* Wall, plus... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 20); /* ...window. */ break; case 0x2: /* wall with door */ _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[6].op = _vm->_gyro->special; /* Door. */ - _vm->_celer->show_one(-1, -1, 19); /* Wall, plus... */ - _vm->_celer->show_one(-1, -1, 21); /* ...door. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 19); /* Wall, plus... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 21); /* ...door. */ break; case 0x3: /* wall with door and window */ _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[6].op = _vm->_gyro->special; /* Door. */ - _vm->_celer->show_one(-1, -1, 19); /* Wall, plus... */ - _vm->_celer->show_one(-1, -1, 20); /* ...door, and... */ - _vm->_celer->show_one(-1, -1, 21); /* ...window. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 19); /* Wall, plus... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 20); /* ...door, and... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 21); /* ...window. */ break; case 0x6: /* no connection (wall + torches), */ _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[6].op = _vm->_gyro->nix; /* No door. */ - _vm->_celer->show_one(-1, -1, 19); /* Wall, plus... */ - _vm->_celer->show_one(-1, -1, 18); /* ...torches. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 19); /* Wall, plus... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 18); /* ...torches. */ break; case 0x7: /* wall with door and torches */ _vm->_gyro->magics[4].op = _vm->_gyro->bounces; /* Sloping wall. */ _vm->_gyro->magics[5].op = _vm->_gyro->nix; /* Straight wall. */ _vm->_gyro->portals[6].op = _vm->_gyro->special; /* Door. */ - _vm->_celer->show_one(-1, -1, 19); /* Wall, plus... */ - _vm->_celer->show_one(-1, -1, 21); /* ...door, and... */ - _vm->_celer->show_one(-1, -1, 18); /* ...torches. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 19); /* Wall, plus... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 21); /* ...door, and... */ + _vm->_celer->drawBackgroundSprite(-1, -1, 18); /* ...torches. */ break; case 0xf: /* straight-through corridor. */ _vm->_gyro->magics[4].op = _vm->_gyro->nix; /* Sloping wall. */ @@ -700,7 +700,7 @@ void Trip::catamove(byte ped) { _vm->_gyro->magics[12].op = _vm->_gyro->bounces; break; case 0x1: - _vm->_celer->show_one(-1, -1, 22); + _vm->_celer->drawBackgroundSprite(-1, -1, 22); if ((xy_uint16 == 2051) && (_vm->_gyro->dna.geida_follows)) _vm->_gyro->magics[12].op = _vm->_gyro->exclaim; @@ -711,13 +711,13 @@ void Trip::catamove(byte ped) { _vm->_gyro->magics[11].op = _vm->_gyro->bounces; break; case 0x2: - _vm->_celer->show_one(-1, -1, 23); + _vm->_celer->drawBackgroundSprite(-1, -1, 23); _vm->_gyro->magics[6].op = _vm->_gyro->special; /* Middle exit south. */ _vm->_gyro->magics[11].op = _vm->_gyro->bounces; _vm->_gyro->magics[12].op = _vm->_gyro->bounces; break; case 0x3: - _vm->_celer->show_one(-1, -1, 24); + _vm->_celer->drawBackgroundSprite(-1, -1, 24); _vm->_gyro->magics[11].op = _vm->_gyro->special; /* Left exit south. */ _vm->_gyro->magics[6].op = _vm->_gyro->bounces; _vm->_gyro->magics[12].op = _vm->_gyro->bounces; @@ -738,7 +738,7 @@ void Trip::catamove(byte ped) { break; */ case 0x2: - _vm->_celer->show_one(-1, -1, 4); + _vm->_celer->drawBackgroundSprite(-1, -1, 4); _vm->_gyro->magics[0].op = _vm->_gyro->bounces; // Middle exit north. _vm->_gyro->portals[3].op = _vm->_gyro->special; // Door. break; @@ -755,7 +755,7 @@ void Trip::catamove(byte ped) { break; */ case 0x5: - _vm->_celer->show_one(-1, -1, 3); + _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_gyro->magics[0].op = _vm->_gyro->bounces; /* Middle exit north. */ _vm->_gyro->portals[3].op = _vm->_gyro->special; /* Door. */ break; @@ -770,12 +770,12 @@ void Trip::catamove(byte ped) { case 0x7: case 0x8: case 0x9: { - _vm->_celer->show_one(-1, -1, 6); + _vm->_celer->drawBackgroundSprite(-1, -1, 6); if (((here & 0xf000) >> 12) > 0x7) - _vm->_celer->show_one(-1, -1, 31); + _vm->_celer->drawBackgroundSprite(-1, -1, 31); if (((here & 0xf000) >> 12) == 0x9) - _vm->_celer->show_one(-1, -1, 32); + _vm->_celer->drawBackgroundSprite(-1, -1, 32); _vm->_gyro->magics[0].op = _vm->_gyro->special; /* Middle arch north. */ _vm->_gyro->portals[3].op = _vm->_gyro->nix; /* Door. */ @@ -785,50 +785,50 @@ void Trip::catamove(byte ped) { case 0xd: /* No connection + WINDOW */ _vm->_gyro->magics[0].op = _vm->_gyro->bounces; _vm->_gyro->portals[3].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer->show_one(-1, -1, 14); + _vm->_celer->drawBackgroundSprite(-1, -1, 14); break; case 0xe: /* No connection + TORCH */ _vm->_gyro->magics[0].op = _vm->_gyro->bounces; _vm->_gyro->portals[3].op = _vm->_gyro->nix; /* Door. */ - _vm->_celer->show_one(-1, -1, 8); + _vm->_celer->drawBackgroundSprite(-1, -1, 8); break; /* Recessed door: */ case 0xf: _vm->_gyro->magics[0].op = _vm->_gyro->nix; /* Door to Geida's room. */ - _vm->_celer->show_one(-1, -1, 1); + _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_gyro->portals[3].op = _vm->_gyro->special; /* Door. */ break; } switch (xy_uint16) { case 514: - _vm->_celer->show_one(-1, -1, 17); + _vm->_celer->drawBackgroundSprite(-1, -1, 17); break; /* [2,2] : "Art Gallery" sign over door. */ case 264: - _vm->_celer->show_one(-1, -1, 9); + _vm->_celer->drawBackgroundSprite(-1, -1, 9); break; /* [8,1] : "The Wrong Way!" sign. */ case 1797: - _vm->_celer->show_one(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 2); break; /* [5,7] : "Ite Mingite" sign. */ case 258: for (fv = 0; fv <= 2; fv++) { /* [2,1] : Art gallery - pictures */ - _vm->_celer->show_one(130 + fv * 120, 70, 15); - _vm->_celer->show_one(184 + fv * 120, 78, 16); + _vm->_celer->drawBackgroundSprite(130 + fv * 120, 70, 15); + _vm->_celer->drawBackgroundSprite(184 + fv * 120, 78, 16); } break; case 1287: for (fv = 10; fv <= 13; fv++) - _vm->_celer->show_one(-1, -1, fv); + _vm->_celer->drawBackgroundSprite(-1, -1, fv); break; /* [7,5] : 4 candles. */ case 776: - _vm->_celer->show_one(-1, -1, 10); + _vm->_celer->drawBackgroundSprite(-1, -1, 10); break; /* [8,3] : 1 candle. */ case 2049: - _vm->_celer->show_one(-1, -1, 11); + _vm->_celer->drawBackgroundSprite(-1, -1, 11); break; /* [1,8] : another candle. */ case 257: - _vm->_celer->show_one(-1, -1, 12); - _vm->_celer->show_one(-1, -1, 13); + _vm->_celer->drawBackgroundSprite(-1, -1, 12); + _vm->_celer->drawBackgroundSprite(-1, -1, 13); break; /* [1,1] : the other two. */ } @@ -851,7 +851,7 @@ void Trip::dawndelay() { void Trip::call_special(uint16 which) { switch (which) { case 1: /* _vm->_gyro->special 1: Room 22: top of stairs. */ - _vm->_celer->show_one(-1, -1, 1); + _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_gyro->dna.brummie_stairs = 1; _vm->_gyro->magics[9].op = _vm->_gyro->nix; _vm->_timeout->set_up_timer(10, _vm->_timeout->procstairs, _vm->_timeout->reason_brummiestairs); @@ -897,7 +897,7 @@ void Trip::call_special(uint16 which) { _vm->_visa->dixi('q', 35); tr[0].done(); /*tr[1].vanishifstill:=true;*/ - _vm->_celer->show_one(-1, -1, 2); + _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_visa->dixi('q', 36); _vm->_gyro->dna.tied_up = true; _vm->_gyro->dna.friar_will_tie_you_up = false; @@ -1246,7 +1246,7 @@ void Trip::arrow_procs(byte tripnum) { } } else { /* Arrow has hit the wall! */ tr[tripnum].done(); /* Deallocate the arrow. */ - _vm->_celer->show_one(-1, -1, 3); /* Show pic of arrow stuck into the door. */ + _vm->_celer->drawBackgroundSprite(-1, -1, 3); /* Show pic of arrow stuck into the door. */ _vm->_gyro->dna.arrow_in_the_door = true; /* So that we can pick it up. */ } @@ -1493,7 +1493,7 @@ void Trip::hide_in_the_cupboard() { _vm->_scrolls->display(Common::String("You walk into the room...") + _vm->_scrolls->kControlParagraph + "It seems to be an empty, but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation."); _vm->_gyro->dna.avvys_in_the_cupboard = true; - _vm->_celer->show_one(-1, -1, 8); + _vm->_celer->drawBackgroundSprite(-1, -1, 8); } } |