aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruruk2013-09-03 22:36:28 +0200
committeruruk2013-09-03 22:36:28 +0200
commita6fb557a516fd5deaef5be43b888ecdd9149daca (patch)
tree3f750a277f7de6eb78284ae4edad430fdd85c7bf
parent38ceb705f29c6ddac318b9a62730fb597d647417 (diff)
downloadscummvm-rg350-a6fb557a516fd5deaef5be43b888ecdd9149daca.tar.gz
scummvm-rg350-a6fb557a516fd5deaef5be43b888ecdd9149daca.tar.bz2
scummvm-rg350-a6fb557a516fd5deaef5be43b888ecdd9149daca.zip
AVALANCHE: Some more renaming and a little bit of refactoring in Celer.
-rw-r--r--engines/avalanche/celer2.cpp21
-rw-r--r--engines/avalanche/celer2.h4
-rw-r--r--engines/avalanche/lucerna2.cpp2
3 files changed, 14 insertions, 13 deletions
diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp
index 37329f1a67..ec736490cc 100644
--- a/engines/avalanche/celer2.cpp
+++ b/engines/avalanche/celer2.cpp
@@ -55,8 +55,6 @@ Celer::~Celer() {
}
void Celer::refreshBackgroundSprites() {
- byte direction;
-
if (_vm->_gyro->ddmnow)
return; // No animation when the menus are up.
@@ -119,6 +117,7 @@ void Celer::refreshBackgroundSprites() {
break;
}
+ byte direction;
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;
@@ -154,9 +153,9 @@ void Celer::refreshBackgroundSprites() {
break;
case r__lustiesroom:
if (!(_vm->_gyro->dna.lustie_is_asleep)) {
+ byte direction;
if ((_vm->_gyro->roomtime % 45) > 42)
direction = 4; // du Lustie blinks.
-
// 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)))
direction = 1; // Middle.
@@ -197,6 +196,7 @@ void Celer::refreshBackgroundSprites() {
break;
case r__nottspub: {
// Bearing of Avvy from Port.
+ byte direction;
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))
@@ -227,6 +227,7 @@ void Celer::refreshBackgroundSprites() {
drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->roomtime / 3) % 3);
// Bearing of Avvy from Duck.
+ byte direction;
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))
@@ -251,7 +252,7 @@ void Celer::refreshBackgroundSprites() {
case 1:
if (_vm->_gyro->dna.nextbell < 5)
_vm->_gyro->dna.nextbell = 12;
- _vm->_gyro->dna.nextbell -= 1;
+ _vm->_gyro->dna.nextbell--;
_vm->_gyro->note(_vm->_gyro->notes[_vm->_gyro->dna.nextbell]);
break;
case 2:
@@ -262,8 +263,8 @@ void Celer::refreshBackgroundSprites() {
}
}
-void Celer::loadBackgroundSprites(Common::String xx) {
- _filename = _filename.format("chunk%s.avd", xx.c_str());
+void Celer::loadBackgroundSprites(byte number) {
+ _filename = _filename.format("chunk%d.avd", number);
if (!_f.open(_filename)) {
warning("AVALANCHE: Celer: File not found: %s", _filename.c_str());
return;
@@ -295,7 +296,7 @@ void Celer::loadBackgroundSprites(Common::String xx) {
_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]._type = kNaturalImage; // 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());
@@ -320,13 +321,13 @@ void Celer::forgetBackgroundSprites() {
memset(_memos, 255, sizeof(_memos)); /* x=-1, => on disk. */
}
-void Celer::drawSprite(int16 x, int16 y, int16 xl, int16 yl, PictureType flavour, const ::Graphics::Surface &picture) {
+void Celer::drawSprite(int16 x, int16 y, int16 xl, int16 yl, PictureType type, const ::Graphics::Surface &picture) {
_r.x1 = x;
_r.y1 = y;
_r.y2 = y + yl;
- switch (flavour) {
- case kBaturalImage: // Allow fallthorugh on purpose.
+ switch (type) {
+ case kNaturalImage: // Allow fallthorugh on purpose.
case kBgi : {
_r.x2 = x + xl + 1;
}
diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h
index f85ba34df2..07fb065b59 100644
--- a/engines/avalanche/celer2.h
+++ b/engines/avalanche/celer2.h
@@ -43,7 +43,7 @@ class AvalancheEngine;
class Celer {
public:
- enum PictureType {kEga, kBgi, kBaturalImage};
+ enum PictureType {kEga, kBgi, kNaturalImage};
struct SpriteType {
PictureType _type;
@@ -76,7 +76,7 @@ public:
void refreshBackgroundSprites();
- void loadBackgroundSprites(Common::String xx);
+ void loadBackgroundSprites(byte number);
void forgetBackgroundSprites();
diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp
index 9e04ddbfba..2b4c5fe363 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->loadBackgroundSprites(xx);
+ _vm->_celer->loadBackgroundSprites(n);
bit = *_vm->_graphics->getPixel(0,0);