2013-06-26 14:14:01 +02:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This code is based on the original source code of Lord Avalot d'Argent version 1.3.
|
|
|
|
* Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* CELER The unit for updating the screen pics. */
|
|
|
|
|
2013-06-29 16:36:40 +02:00
|
|
|
#include "avalanche/avalanche.h"
|
|
|
|
|
2013-06-26 14:14:01 +02:00
|
|
|
#include "avalanche/celer2.h"
|
2013-06-28 17:58:22 +02:00
|
|
|
#include "avalanche/trip6.h"
|
2013-06-26 14:14:01 +02:00
|
|
|
#include "avalanche/lucerna2.h"
|
|
|
|
#include "avalanche/gyro2.h"
|
|
|
|
#include "avalanche/roomnums.h"
|
2013-06-29 16:36:40 +02:00
|
|
|
|
|
|
|
#include "common/textconsole.h"
|
2013-06-26 14:14:01 +02:00
|
|
|
|
|
|
|
namespace Avalanche {
|
|
|
|
|
2013-06-28 17:58:22 +02:00
|
|
|
const int16 Celer::on_disk = -1;
|
2013-06-26 14:14:01 +02:00
|
|
|
|
|
|
|
|
2013-07-24 19:43:10 +02:00
|
|
|
Celer::Celer(AvalancheEngine *vm) {
|
2013-06-28 17:58:22 +02:00
|
|
|
_vm = vm;
|
2013-07-24 19:43:10 +02:00
|
|
|
num_chunks = 0;
|
2013-06-28 17:58:22 +02:00
|
|
|
}
|
2013-06-26 14:14:01 +02:00
|
|
|
|
2013-07-26 14:19:54 +02:00
|
|
|
Celer::~Celer() {
|
|
|
|
for (byte i = 0; i < 40; i++)
|
|
|
|
memory[i].free();
|
|
|
|
}
|
|
|
|
|
2013-06-28 17:58:22 +02:00
|
|
|
void Celer::pics_link() {
|
|
|
|
byte xx;
|
2013-06-26 14:14:01 +02:00
|
|
|
|
2013-07-24 18:25:07 +02:00
|
|
|
if (_vm->_gyro->ddmnow)
|
2013-06-30 14:10:33 +02:00
|
|
|
return; /* No animation when the menus are up. */
|
|
|
|
|
|
|
|
|
2013-07-24 18:25:07 +02:00
|
|
|
switch (_vm->_gyro->dna.room) {
|
2013-06-30 14:10:33 +02:00
|
|
|
case r__outsideargentpub:
|
2013-07-24 18:25:07 +02:00
|
|
|
if ((_vm->_gyro->roomtime % int32(12)) == 0)
|
|
|
|
show_one(int32(1) + (_vm->_gyro->roomtime / int32(12)) % int32(4));
|
2013-06-30 22:01:05 +02:00
|
|
|
break;
|
2013-06-26 14:14:01 +02:00
|
|
|
|
2013-06-30 14:10:33 +02:00
|
|
|
case r__brummieroad:
|
2013-07-24 18:25:07 +02:00
|
|
|
if ((_vm->_gyro->roomtime % int32(2)) == 0)
|
|
|
|
show_one(int32(1) + (_vm->_gyro->roomtime / int32(2)) % int32(4));
|
2013-06-28 17:58:22 +02:00
|
|
|
break;
|
2013-06-26 14:14:01 +02:00
|
|
|
|
2013-06-30 14:10:33 +02:00
|
|
|
case r__bridge:
|
2013-07-24 18:25:07 +02:00
|
|
|
if ((_vm->_gyro->roomtime % int32(2)) == 0)
|
|
|
|
show_one(int32(4) + (_vm->_gyro->roomtime / int32(2)) % int32(4));
|
2013-06-30 14:10:33 +02:00
|
|
|
break;
|
2013-06-26 14:14:01 +02:00
|
|
|
|
2013-06-30 14:10:33 +02:00
|
|
|
case r__yours:
|
2013-07-24 18:25:07 +02:00
|
|
|
if ((!_vm->_gyro->dna.avvy_is_awake) && ((_vm->_gyro->roomtime % int32(4)) == 0))
|
2013-07-25 23:10:18 +02:00
|
|
|
show_one(0 + (_vm->_gyro->roomtime / 12) % 2);
|
2013-06-30 14:10:33 +02:00
|
|
|
break;
|
2013-06-26 14:14:01 +02:00
|
|
|
|
2013-06-30 14:10:33 +02:00
|
|
|
case r__argentpub:
|
2013-07-24 18:25:07 +02:00
|
|
|
if (((_vm->_gyro->roomtime % int32(7)) == 1) && (_vm->_gyro->dna.malagauche != 177)) {
|
2013-06-30 14:10:33 +02:00
|
|
|
/* Malagauche cycle */
|
2013-07-24 18:25:07 +02:00
|
|
|
_vm->_gyro->dna.malagauche += 1;
|
|
|
|
switch (_vm->_gyro->dna.malagauche) {
|
2013-06-30 14:10:33 +02:00
|
|
|
case 1:
|
|
|
|
case 11:
|
|
|
|
case 21:
|
|
|
|
show_one(12);
|
|
|
|
break; /* Looks forwards. */
|
|
|
|
case 8:
|
|
|
|
case 18:
|
|
|
|
case 28:
|
|
|
|
case 32:
|
|
|
|
show_one(11);
|
|
|
|
break; /* Looks at you. */
|
|
|
|
case 30:
|
|
|
|
show_one(13);
|
|
|
|
break; /* Winks. */
|
|
|
|
case 33:
|
2013-07-24 18:25:07 +02:00
|
|
|
_vm->_gyro->dna.malagauche = 0;
|
2013-06-26 14:14:01 +02:00
|
|
|
break;
|
2013-06-28 17:58:22 +02:00
|
|
|
}
|
|
|
|
}
|
2013-06-26 14:14:01 +02:00
|
|
|
|
2013-07-24 18:25:07 +02:00
|
|
|
switch (_vm->_gyro->roomtime % 200) {
|
2013-06-30 14:10:33 +02:00
|
|
|
case 179:
|
|
|
|
case 197:
|
|
|
|
show_one(5);
|
|
|
|
break; /* Dogfood's drinking cycle */
|
|
|
|
case 182:
|
|
|
|
case 194:
|
|
|
|
show_one(6);
|
2013-06-28 17:58:22 +02:00
|
|
|
break;
|
2013-06-30 14:10:33 +02:00
|
|
|
case 185:
|
|
|
|
show_one(7);
|
2013-06-28 17:58:22 +02:00
|
|
|
break;
|
2013-06-30 14:10:33 +02:00
|
|
|
case 199:
|
2013-07-24 18:25:07 +02:00
|
|
|
_vm->_gyro->dna.dogfoodpos = 177;
|
2013-06-30 14:10:33 +02:00
|
|
|
break; /* Impossible value for this. */
|
|
|
|
}
|
2013-06-26 14:14:01 +02:00
|
|
|
|
2013-07-24 18:25:07 +02:00
|
|
|
if ((_vm->_gyro->roomtime % 200 >= 0) && (_vm->_gyro->roomtime % 200 <= 178)) { /* Normally. */
|
2013-07-24 19:43:10 +02:00
|
|
|
if (((_vm->_lucerna->bearing(2) >= 1) && (_vm->_lucerna->bearing(2) <= 90)) || ((_vm->_lucerna->bearing(2) >= 358) && (_vm->_lucerna->bearing(2) <= 360)))
|
2013-06-30 14:10:33 +02:00
|
|
|
xx = 3;
|
2013-07-24 19:43:10 +02:00
|
|
|
else if ((_vm->_lucerna->bearing(2) >= 293) && (_vm->_lucerna->bearing(2) <= 357))
|
2013-06-30 14:10:33 +02:00
|
|
|
xx = 2;
|
2013-07-24 19:43:10 +02:00
|
|
|
else if ((_vm->_lucerna->bearing(2) >= 271) && (_vm->_lucerna->bearing(2) <= 292))
|
2013-06-30 14:10:33 +02:00
|
|
|
xx = 4;
|
2013-06-26 14:14:01 +02:00
|
|
|
|
2013-07-24 18:25:07 +02:00
|
|
|
if (xx != _vm->_gyro->dna.dogfoodpos) { /* Only if it's changed.*/
|
2013-06-28 17:58:22 +02:00
|
|
|
show_one(xx);
|
2013-07-24 18:25:07 +02:00
|
|
|
_vm->_gyro->dna.dogfoodpos = xx;
|
2013-06-26 14:14:01 +02:00
|
|
|
}
|
2013-06-30 14:10:33 +02:00
|
|
|
}
|
|
|
|
break;
|
2013-06-26 14:14:01 +02:00
|
|
|
|
2013-06-30 14:10:33 +02:00
|
|
|
case r__westhall:
|
2013-07-24 18:25:07 +02:00
|
|
|
if ((_vm->_gyro->roomtime % int32(3)) == 0) {
|
|
|
|
switch ((_vm->_gyro->roomtime / int32(3)) % int32(6)) {
|
2013-06-30 14:10:33 +02:00
|
|
|
case 4:
|
|
|
|
show_one(1);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
case 3:
|
|
|
|
case 5:
|
|
|
|
show_one(2);
|
|
|
|
break;
|
|
|
|
case 0:
|
|
|
|
case 2:
|
|
|
|
show_one(3);
|
2013-06-28 17:58:22 +02:00
|
|
|
break;
|
2013-06-26 14:14:01 +02:00
|
|
|
}
|
|
|
|
}
|
2013-06-28 17:58:22 +02:00
|
|
|
break;
|
2013-06-26 14:14:01 +02:00
|
|
|
|
2013-06-30 14:10:33 +02:00
|
|
|
case r__lustiesroom:
|
2013-07-24 18:25:07 +02:00
|
|
|
if (!(_vm->_gyro->dna.lustie_is_asleep)) {
|
|
|
|
if ((_vm->_gyro->roomtime % int32(45)) > 42)
|
2013-06-30 14:10:33 +02:00
|
|
|
xx = 4; /* du Lustie blinks */
|
2013-06-26 14:14:01 +02:00
|
|
|
|
2013-06-30 14:10:33 +02:00
|
|
|
/* Bearing of Avvy from du Lustie. */
|
2013-07-24 19:43:10 +02:00
|
|
|
else if (((_vm->_lucerna->bearing(2) >= 0) && (_vm->_lucerna->bearing(2) <= 45)) || ((_vm->_lucerna->bearing(2) >= 315) && (_vm->_lucerna->bearing(2) <= 360)))
|
2013-06-30 14:10:33 +02:00
|
|
|
xx = 1; /* Middle. */
|
2013-07-24 19:43:10 +02:00
|
|
|
else if ((_vm->_lucerna->bearing(2) >= 45) && (_vm->_lucerna->bearing(2) <= 180))
|
2013-06-30 14:10:33 +02:00
|
|
|
xx = 2; /* Left. */
|
2013-07-24 19:43:10 +02:00
|
|
|
else if ((_vm->_lucerna->bearing(2) >= 181) && (_vm->_lucerna->bearing(2) <= 314))
|
2013-06-30 14:10:33 +02:00
|
|
|
xx = 3; /* Right. */
|
2013-06-28 17:58:22 +02:00
|
|
|
|
2013-07-24 18:25:07 +02:00
|
|
|
if (xx != _vm->_gyro->dna.dogfoodpos) { /* Only if it's changed.*/
|
2013-06-28 17:58:22 +02:00
|
|
|
show_one(xx);
|
2013-07-24 18:25:07 +02:00
|
|
|
_vm->_gyro->dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */
|
2013-06-26 14:14:01 +02:00
|
|
|
}
|
|
|
|
}
|
2013-06-28 17:58:22 +02:00
|
|
|
break;
|
2013-06-26 14:14:01 +02:00
|
|
|
|
2013-06-30 14:10:33 +02:00
|
|
|
case r__aylesoffice:
|
2013-07-24 18:25:07 +02:00
|
|
|
if ((!_vm->_gyro->dna.ayles_is_awake) && (_vm->_gyro->roomtime % int32(14) == 0)) {
|
|
|
|
switch ((_vm->_gyro->roomtime / int32(14)) % int32(2)) {
|
2013-06-30 14:10:33 +02:00
|
|
|
case 0:
|
|
|
|
show_one(1);
|
|
|
|
break; /* Frame 2: EGA. */
|
|
|
|
case 1:
|
|
|
|
show_one(3);
|
|
|
|
break; /* Frame 1: Natural. */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case r__robins:
|
2013-07-24 18:25:07 +02:00
|
|
|
if (_vm->_gyro->dna.tied_up) {
|
|
|
|
switch (_vm->_gyro->roomtime % int32(54)) {
|
2013-06-30 14:10:33 +02:00
|
|
|
case 20:
|
|
|
|
show_one(4);
|
|
|
|
break; /* Frame 4: Avalot blinks. */
|
|
|
|
case 23:
|
|
|
|
show_one(2);
|
|
|
|
break; /* Frame 1: Back to normal. */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case r__nottspub:
|
|
|
|
/* Bearing of Avvy from Port. */
|
2013-07-24 19:43:10 +02:00
|
|
|
if (((_vm->_lucerna->bearing(5) >= 0) && (_vm->_lucerna->bearing(5) <= 45)) || ((_vm->_lucerna->bearing(5) >= 315) && (_vm->_lucerna->bearing(5) <= 360)))
|
2013-06-30 14:10:33 +02:00
|
|
|
xx = 2; /* Middle. */
|
2013-07-24 19:43:10 +02:00
|
|
|
else if ((_vm->_lucerna->bearing(5) >= 45) && (_vm->_lucerna->bearing(5) <= 180))
|
2013-06-30 14:10:33 +02:00
|
|
|
xx = 6; /* Left. */
|
2013-07-24 19:43:10 +02:00
|
|
|
else if ((_vm->_lucerna->bearing(5) >= 181) && (_vm->_lucerna->bearing(5) <= 314))
|
2013-06-30 14:10:33 +02:00
|
|
|
xx = 8; /* Right. */
|
|
|
|
|
2013-07-24 18:25:07 +02:00
|
|
|
if ((_vm->_gyro->roomtime % int32(60)) > 57)
|
2013-06-30 14:10:33 +02:00
|
|
|
xx--; /* Blinks */
|
|
|
|
|
2013-07-24 18:25:07 +02:00
|
|
|
if (xx != _vm->_gyro->dna.dogfoodpos) { /* Only if it's changed.*/
|
2013-06-30 14:10:33 +02:00
|
|
|
show_one(xx);
|
2013-07-24 18:25:07 +02:00
|
|
|
_vm->_gyro->dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */
|
2013-06-30 14:10:33 +02:00
|
|
|
}
|
|
|
|
|
2013-07-24 18:25:07 +02:00
|
|
|
switch (_vm->_gyro->roomtime % 50) {
|
2013-06-30 14:10:33 +02:00
|
|
|
case 45 :
|
|
|
|
show_one(9);
|
|
|
|
break; /* Spurge blinks */
|
|
|
|
case 49 :
|
|
|
|
show_one(10);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case r__ducks:
|
2013-07-24 18:25:07 +02:00
|
|
|
if ((_vm->_gyro->roomtime % 3) == 0) /* The fire flickers */
|
|
|
|
show_one(1 + (_vm->_gyro->roomtime / 3) % 3);
|
2013-06-30 14:10:33 +02:00
|
|
|
|
2013-07-24 19:43:10 +02:00
|
|
|
{/* _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)))
|
2013-06-30 14:10:33 +02:00
|
|
|
xx = 4; /* Middle. */
|
2013-07-24 19:43:10 +02:00
|
|
|
else if ((_vm->_lucerna->bearing(2) >= 45) && (_vm->_lucerna->bearing(2) <= 180))
|
2013-06-30 14:10:33 +02:00
|
|
|
xx = 6; /* Left. */
|
2013-07-24 19:43:10 +02:00
|
|
|
else if ((_vm->_lucerna->bearing(2) >= 181) && (_vm->_lucerna->bearing(2) <= 314))
|
2013-06-30 14:10:33 +02:00
|
|
|
xx = 8; /* Right. */
|
|
|
|
|
2013-07-24 18:25:07 +02:00
|
|
|
if ((_vm->_gyro->roomtime % int32(45)) > 42)
|
2013-06-30 14:10:33 +02:00
|
|
|
xx += 1; /* Duck blinks */
|
|
|
|
|
2013-07-24 18:25:07 +02:00
|
|
|
if (xx != _vm->_gyro->dna.dogfoodpos) { /* Only if it's changed.*/
|
2013-06-30 14:10:33 +02:00
|
|
|
show_one(xx);
|
2013-07-24 18:25:07 +02:00
|
|
|
_vm->_gyro->dna.dogfoodpos = xx; /* We use DogfoodPos here too- why not? */
|
2013-06-28 17:58:22 +02:00
|
|
|
}
|
2013-06-30 14:10:33 +02:00
|
|
|
break;
|
|
|
|
|
2013-06-26 14:14:01 +02:00
|
|
|
}
|
2013-06-30 14:10:33 +02:00
|
|
|
}
|
2013-06-26 14:14:01 +02:00
|
|
|
|
2013-07-24 18:25:07 +02:00
|
|
|
if ((_vm->_gyro->dna.ringing_bells) && (_vm->_gyro->flagset('B'))) {
|
2013-06-28 17:58:22 +02:00
|
|
|
/* They're ringing the bells. */
|
2013-07-24 18:25:07 +02:00
|
|
|
switch (_vm->_gyro->roomtime % int32(4)) {
|
2013-06-30 14:10:33 +02:00
|
|
|
case 1:
|
2013-07-24 18:25:07 +02:00
|
|
|
if (_vm->_gyro->dna.nextbell < 5)
|
|
|
|
_vm->_gyro->dna.nextbell = 12;
|
|
|
|
_vm->_gyro->dna.nextbell -= 1;
|
|
|
|
_vm->_gyro->note(_vm->_gyro->notes[_vm->_gyro->dna.nextbell]);
|
2013-06-30 14:10:33 +02:00
|
|
|
break;
|
2013-06-28 17:58:22 +02:00
|
|
|
case 2:
|
|
|
|
//nosound;
|
|
|
|
warning("STUB: Celer::pics_link()");
|
|
|
|
break;
|
|
|
|
}
|
2013-06-26 14:14:01 +02:00
|
|
|
}
|
2013-06-28 17:58:22 +02:00
|
|
|
}
|
2013-06-26 14:14:01 +02:00
|
|
|
|
2013-07-05 15:30:26 +02:00
|
|
|
void Celer::load_chunks(Common::String xx) {
|
2013-07-03 17:06:36 +02:00
|
|
|
chunkblocktype ch;
|
|
|
|
byte fv;
|
|
|
|
|
2013-07-05 15:30:26 +02:00
|
|
|
filename = filename.format("chunk%s.avd", xx.c_str());
|
2013-07-03 17:06:36 +02:00
|
|
|
if (!f.open(filename)) {
|
|
|
|
warning("AVALANCHE: Celer: File not found: %s", filename.c_str());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
f.seek(44);
|
|
|
|
num_chunks = f.readByte();
|
2013-07-05 11:32:49 +02:00
|
|
|
for (byte i = 0; i < num_chunks; i++)
|
2013-07-03 17:06:36 +02:00
|
|
|
offsets[i] = f.readSint32LE();
|
|
|
|
|
|
|
|
for (fv = 0; fv < num_chunks; fv++) {
|
|
|
|
f.seek(offsets[fv]);
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2013-07-25 11:41:33 +02:00
|
|
|
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.
|
2013-07-29 19:17:43 +02:00
|
|
|
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());
|
2013-07-26 14:19:54 +02:00
|
|
|
|
2013-07-29 19:17:43 +02:00
|
|
|
for (uint16 j = 0; j < memos[fv].yl + 1; j++)
|
2013-07-25 21:38:46 +02:00
|
|
|
for (uint16 i = 0; i < memos[fv].xl * 8; i++)
|
2013-07-26 14:19:54 +02:00
|
|
|
*(byte *)memory[fv].getBasePtr(i, j) = *_vm->_graphics->getPixel(memos[fv].x * 8 + i, memos[fv].y + j);
|
2013-07-25 12:15:15 +02:00
|
|
|
} else {
|
|
|
|
memos[fv].size = ch.size;
|
2013-07-26 14:19:54 +02:00
|
|
|
memory[fv] = _vm->_graphics->loadPictureRow(f, memos[fv].xl * 8, memos[fv].yl + 1); // Celer::forget_chunks() deallocates it.
|
2013-07-25 12:15:15 +02:00
|
|
|
}
|
2013-07-03 17:06:36 +02:00
|
|
|
} else
|
|
|
|
memos[fv].x = on_disk;
|
|
|
|
}
|
|
|
|
f.close();
|
2013-06-28 17:58:22 +02:00
|
|
|
}
|
2013-06-26 14:14:01 +02:00
|
|
|
|
2013-06-28 17:58:22 +02:00
|
|
|
void Celer::forget_chunks() {
|
2013-07-05 11:32:49 +02:00
|
|
|
for (byte fv = 0; fv < num_chunks; fv ++)
|
|
|
|
if (memos[fv].x > on_disk)
|
2013-07-26 14:19:54 +02:00
|
|
|
memory[fv].free();
|
2013-07-05 11:32:49 +02:00
|
|
|
|
|
|
|
memset(memos, 255, sizeof(memos)); /* x=-1, => on disk. */
|
2013-06-28 17:58:22 +02:00
|
|
|
}
|
2013-06-26 14:14:01 +02:00
|
|
|
|
2013-07-26 14:19:54 +02:00
|
|
|
void Celer::display_it(int16 x, int16 y, int16 xl, int16 yl, flavourtype flavour, const ::Graphics::Surface &picture) {
|
2013-07-26 13:32:08 +02:00
|
|
|
r.x1 = x;
|
|
|
|
r.y1 = y;
|
|
|
|
r.y2 = y + yl;
|
|
|
|
|
2013-07-25 12:15:15 +02:00
|
|
|
switch (flavour) {
|
2013-07-26 14:19:54 +02:00
|
|
|
case ch_natural_image: // Allow fallthorugh on purpose.
|
2013-07-25 12:15:15 +02:00
|
|
|
case ch_bgi : {
|
|
|
|
r.x2 = x + xl + 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ch_ega : {
|
|
|
|
r.x2 = x + xl;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2013-07-26 14:19:54 +02:00
|
|
|
|
2013-08-21 18:01:31 +02:00
|
|
|
// These pictures are practically parts of the background. -10 is for the drop-down menu.
|
|
|
|
_vm->_graphics->drawPicture(_vm->_graphics->_background, picture, x * 8, y - 10);
|
2013-06-28 17:58:22 +02:00
|
|
|
}
|
2013-06-26 14:14:01 +02:00
|
|
|
|
2013-06-28 17:58:22 +02:00
|
|
|
void Celer::show_one(byte which) {
|
2013-07-05 12:31:12 +02:00
|
|
|
chunkblocktype ch;
|
|
|
|
|
|
|
|
//setactivepage(3);
|
|
|
|
warning("STUB: Celer::show_one()");
|
|
|
|
|
|
|
|
if (memos[which].x > on_disk)
|
|
|
|
display_it(memos[which].x, memos[which].y, memos[which].xl, memos[which].yl, memos[which].flavour, memory[which]);
|
|
|
|
else {
|
|
|
|
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]);
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
2013-07-26 14:19:54 +02:00
|
|
|
::Graphics::Surface picture = _vm->_graphics->loadPictureRow(f, ch.xl * 8, ch.yl + 1); // There'll may be problems with the width!
|
2013-07-05 12:31:12 +02:00
|
|
|
|
2013-07-26 14:19:54 +02:00
|
|
|
display_it(ch.x, ch.y, ch.xl, ch.yl, ch.flavour, picture);
|
2013-07-05 12:31:12 +02:00
|
|
|
|
2013-07-26 14:19:54 +02:00
|
|
|
picture.free();
|
2013-07-05 12:31:12 +02:00
|
|
|
f.close();
|
|
|
|
}
|
|
|
|
|
|
|
|
//setactivepage(1 - cp);
|
2013-06-28 17:58:22 +02:00
|
|
|
warning("STUB: Celer::show_one()");
|
2013-07-05 12:31:12 +02:00
|
|
|
|
|
|
|
for (byte fv = 0; fv < 2; fv ++)
|
2013-07-24 19:43:10 +02:00
|
|
|
_vm->_trip->getset[fv].remember(r);
|
2013-06-28 17:58:22 +02:00
|
|
|
}
|
2013-06-26 14:14:01 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2013-07-26 14:19:54 +02:00
|
|
|
void Celer::display_it_at(int16 xl, int16 yl, flavourtype flavour, const ::Graphics::Surface &picture, int16 &xxx, int16 &yyy) {
|
|
|
|
warning("STUB: Celer::display_it_at()");
|
2013-06-28 17:58:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void Celer::show_one_at(byte which, int16 xxx, int16 yyy) {
|
|
|
|
warning("STUB: Celer::show_one_at()");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-26 14:14:01 +02:00
|
|
|
|
|
|
|
} // End of namespace Avalanche.
|