aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2013-09-25 23:54:35 +0200
committerStrangerke2013-09-25 23:54:35 +0200
commit6cd9bd141ce6d94c274d5fe054a36f46d6064aa0 (patch)
tree7cbe8e7a580ab4718ffeec308c424455ba888c5f
parent890eed446c628c8087d728dcc0b9bfba74ec4fcc (diff)
downloadscummvm-rg350-6cd9bd141ce6d94c274d5fe054a36f46d6064aa0.tar.gz
scummvm-rg350-6cd9bd141ce6d94c274d5fe054a36f46d6064aa0.tar.bz2
scummvm-rg350-6cd9bd141ce6d94c274d5fe054a36f46d6064aa0.zip
AVALANCHE: Move some variables to Animation, break savegame compatibility
-rw-r--r--engines/avalanche/animation.cpp78
-rw-r--r--engines/avalanche/animation.h3
-rw-r--r--engines/avalanche/avalanche.cpp52
-rw-r--r--engines/avalanche/avalot.cpp3
-rw-r--r--engines/avalanche/avalot.h1
5 files changed, 72 insertions, 65 deletions
diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp
index 1369031bff..662ac520df 100644
--- a/engines/avalanche/animation.cpp
+++ b/engines/avalanche/animation.cpp
@@ -414,7 +414,7 @@ void Animation::catacombMove(byte ped) {
// XY_uint16 is cat_x+cat_y*256. Thus, every room in the
// catacombs has a different number for it.
xy_uint16 = _vm->_avalot->_catacombX + _vm->_avalot->_catacombY * 256;
- _vm->_avalot->_geidaSpin = 0;
+ _geidaSpin = 0;
switch (xy_uint16) {
case 1801: // Exit catacombs
@@ -1025,20 +1025,20 @@ void Animation::spin(Direction dir, byte &tripnum) {
if (_sprites[tripnum]._id == 2)
return; // Not for Spludwick
- _vm->_avalot->_geidaSpin += 1;
- _vm->_avalot->_geidaTime = 20;
- if (_vm->_avalot->_geidaSpin == 5) {
+ _geidaSpin++;
+ _geidaTime = 20;
+ if (_geidaSpin == 5) {
_vm->_dialogs->displayText("Steady on, Avvy, you'll make the poor girl dizzy!");
- _vm->_avalot->_geidaSpin = 0;
- _vm->_avalot->_geidaTime = 0; // knock out records
+ _geidaSpin = 0;
+ _geidaTime = 0; // knock out records
}
}
void Animation::geidaProcs(byte tripnum) {
- if (_vm->_avalot->_geidaTime > 0) {
- _vm->_avalot->_geidaTime--;
- if (_vm->_avalot->_geidaTime == 0)
- _vm->_avalot->_geidaSpin = 0;
+ if (_geidaTime > 0) {
+ _geidaTime--;
+ if (_geidaTime == 0)
+ _geidaSpin = 0;
}
if (_sprites[tripnum]._y < (_sprites[0]._y - 2)) {
@@ -1307,8 +1307,66 @@ Direction Animation::getOldDirection() {
return _oldDirection;
}
+void Animation::resetVariables() {
+ _geidaSpin = 0;
+ _geidaTime = 0;
+}
+
void Animation::synchronize(Common::Serializer &sz) {
sz.syncAsByte(_direction);
+ sz.syncAsByte(_geidaSpin);
+ sz.syncAsByte(_geidaTime);
+
+ byte spriteNum = 0;
+ if (sz.isSaving()) {
+ for (int i = 0; i < kSpriteNumbMax; i++) {
+ if (_sprites[i]._quick)
+ spriteNum++;
+ }
+ }
+ sz.syncAsByte(spriteNum);
+
+ if (sz.isLoading()) {
+ for (int i = 0; i < kSpriteNumbMax; i++) { // Deallocate sprites.
+ AnimationType *spr = &_sprites[i];
+ if (spr->_quick)
+ spr->remove();
+ }
+ }
+
+ for (int i = 0; i < spriteNum; i++) {
+ AnimationType *spr = &_sprites[i];
+ sz.syncAsByte(spr->_id);
+ sz.syncAsByte(spr->_doCheck);
+
+ if (sz.isLoading()) {
+ spr->_quick = true;
+ spr->init(spr->_id, spr->_doCheck, this);
+ }
+
+ sz.syncAsByte(spr->_moveX);
+ sz.syncAsByte(spr->_moveY);
+ sz.syncAsByte(spr->_facingDir);
+ sz.syncAsByte(spr->_stepNum);
+ sz.syncAsByte(spr->_visible);
+ sz.syncAsByte(spr->_homing);
+ sz.syncAsByte(spr->_count);
+ sz.syncAsByte(spr->_info._xWidth);
+ sz.syncAsByte(spr->_speedX);
+ sz.syncAsByte(spr->_speedY);
+ sz.syncAsByte(spr->_animCount);
+ sz.syncAsSint16LE(spr->_homingX);
+ sz.syncAsSint16LE(spr->_homingY);
+ sz.syncAsByte(spr->_callEachStepFl);
+ sz.syncAsByte(spr->_eachStepProc);
+ sz.syncAsByte(spr->_vanishIfStill);
+ sz.syncAsSint16LE(spr->_x);
+ sz.syncAsSint16LE(spr->_y);
+
+ if (sz.isLoading() && spr->_visible)
+ spr->appear(spr->_x, spr->_y, spr->_facingDir);
+ }
+
}
} // End of namespace Avalanche.
diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h
index 47fab38d4c..1b616f9fae 100644
--- a/engines/avalanche/animation.h
+++ b/engines/avalanche/animation.h
@@ -136,11 +136,14 @@ public:
Direction getDirection();
Direction getOldDirection();
+ void resetVariables();
void synchronize(Common::Serializer &sz);
private:
Direction _direction; // The direction Avvy is currently facing.
Direction _oldDirection;
+ byte _geidaSpin, _geidaTime; // For the making "Geida dizzy" joke.
+
AvalancheEngine *_vm;
byte checkFeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl);
diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp
index 07203411df..cddb8ba270 100644
--- a/engines/avalanche/avalanche.cpp
+++ b/engines/avalanche/avalanche.cpp
@@ -238,8 +238,6 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) {
sz.syncAsByte(_avalot->_catacombY);
sz.syncAsByte(_avalot->_avvysInTheCupboard);
sz.syncAsByte(_avalot->_geidaFollows);
- sz.syncAsByte(_avalot->_geidaSpin);
- sz.syncAsByte(_avalot->_geidaTime);
sz.syncAsByte(_avalot->_nextBell);
sz.syncAsByte(_avalot->_givenPotionToGeida);
sz.syncAsByte(_avalot->_lustieIsAsleep);
@@ -253,56 +251,6 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) {
sz.syncAsByte(_avalot->_givenPenToAyles);
sz.syncAsByte(_avalot->_askedDogfoodAboutNim);
- byte spriteNum = 0;
- if (sz.isSaving()) {
- for (int i = 0; i < _animation->kSpriteNumbMax; i++) {
- if (_animation->_sprites[i]._quick)
- spriteNum++;
- }
- }
- sz.syncAsByte(spriteNum);
-
- if (sz.isLoading()) {
- for (int i = 0; i < _animation->kSpriteNumbMax; i++) { // Deallocate sprites.
- AnimationType *spr = &_animation->_sprites[i];
- if (spr->_quick)
- spr->remove();
- }
- }
-
- for (int i = 0; i < spriteNum; i++) {
- AnimationType *spr = &_animation->_sprites[i];
- sz.syncAsByte(spr->_id);
- sz.syncAsByte(spr->_doCheck);
-
- if (sz.isLoading()) {
- spr->_quick = true;
- spr->init(spr->_id, spr->_doCheck, _animation);
- }
-
- sz.syncAsByte(spr->_moveX);
- sz.syncAsByte(spr->_moveY);
- sz.syncAsByte(spr->_facingDir);
- sz.syncAsByte(spr->_stepNum);
- sz.syncAsByte(spr->_visible);
- sz.syncAsByte(spr->_homing);
- sz.syncAsByte(spr->_count);
- sz.syncAsByte(spr->_info._xWidth);
- sz.syncAsByte(spr->_speedX);
- sz.syncAsByte(spr->_speedY);
- sz.syncAsByte(spr->_animCount);
- sz.syncAsSint16LE(spr->_homingX);
- sz.syncAsSint16LE(spr->_homingY);
- sz.syncAsByte(spr->_callEachStepFl);
- sz.syncAsByte(spr->_eachStepProc);
- sz.syncAsByte(spr->_vanishIfStill);
- sz.syncAsSint16LE(spr->_x);
- sz.syncAsSint16LE(spr->_y);
-
- if (sz.isLoading() && spr->_visible)
- spr->appear(spr->_x, spr->_y, spr->_facingDir);
- }
-
for (int i = 0; i < 7; i++) {
sz.syncAsSint32LE(_timer->_times[i]._timeLeft);
sz.syncAsByte(_timer->_times[i]._action);
diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp
index a315d5cc90..78bcc2659f 100644
--- a/engines/avalanche/avalot.cpp
+++ b/engines/avalanche/avalot.cpp
@@ -1650,8 +1650,6 @@ void Avalot::resetVariables() {
_catacombY = 0;
_avvysInTheCupboard = false;
_geidaFollows = false;
- _geidaSpin = 0;
- _geidaTime = 0;
_nextBell = 0;
_givenPotionToGeida = false;
_lustieIsAsleep = false;
@@ -1666,6 +1664,7 @@ void Avalot::resetVariables() {
_askedDogfoodAboutNim = false;
_vm->_parser->resetVariables();
+ _vm->_animation->resetVariables();
}
void Avalot::newGame() {
diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h
index bbd01d7123..2a5234af08 100644
--- a/engines/avalanche/avalot.h
+++ b/engines/avalanche/avalot.h
@@ -222,7 +222,6 @@ public:
byte _catacombX, _catacombY; // XY coords in the catacombs.
bool _avvysInTheCupboard; // On screen 22.
bool _geidaFollows; // Is Geida following you?
- byte _geidaSpin, _geidaTime; // For the making "Geida dizzy" joke.
byte _nextBell; // For the ringing.
bool _givenPotionToGeida; // Does Geida have the potion?
bool _lustieIsAsleep; // Is BDL asleep?