mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-23 12:44:02 +00:00
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.
This commit is contained in:
parent
dbd330bf2f
commit
457d898ff3
@ -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();
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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
|
||||
|
@ -119,6 +119,8 @@ public:
|
||||
|
||||
void refreshScreen();
|
||||
|
||||
void refreshBackground();
|
||||
|
||||
private:
|
||||
AvalancheEngine *_vm;
|
||||
|
||||
|
@ -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,15 +664,20 @@ 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();
|
||||
}
|
||||
@ -664,10 +685,19 @@ void Lucerna::enterroom(byte x, byte ped) {
|
||||
|
||||
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;
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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--;
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user