aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2013-10-17 08:17:03 +0200
committerWillem Jan Palenstijn2013-10-17 22:17:10 +0200
commit1c3fcf22a1b3665fc4bfb0343b6de315bbf9a324 (patch)
tree2fb8a9e038efadbb7dcee11daaac451fa036d9dd /engines
parent5f0361c03a5cfd328872684d8bba51ae12f3d1c0 (diff)
downloadscummvm-rg350-1c3fcf22a1b3665fc4bfb0343b6de315bbf9a324.tar.gz
scummvm-rg350-1c3fcf22a1b3665fc4bfb0343b6de315bbf9a324.tar.bz2
scummvm-rg350-1c3fcf22a1b3665fc4bfb0343b6de315bbf9a324.zip
AVALANCHE: Some more refactoring
Diffstat (limited to 'engines')
-rw-r--r--engines/avalanche/animation.cpp19
-rw-r--r--engines/avalanche/animation.h22
-rw-r--r--engines/avalanche/avalanche.h3
-rw-r--r--engines/avalanche/avalot.cpp2
-rw-r--r--engines/avalanche/enums.h4
-rw-r--r--engines/avalanche/graphics.cpp2
-rw-r--r--engines/avalanche/menu.cpp12
-rw-r--r--engines/avalanche/parser.cpp11
8 files changed, 44 insertions, 31 deletions
diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp
index 8542c6c46e..ef30faa87c 100644
--- a/engines/avalanche/animation.cpp
+++ b/engines/avalanche/animation.cpp
@@ -104,7 +104,7 @@ void AnimationType::init(byte spritenum, bool doCheck) {
_y = 0;
_quick = true;
_visible = false;
- _speedX = 3;
+ _speedX = kWalk;
_speedY = 1;
_homing = false;
_moveX = 0;
@@ -1376,6 +1376,23 @@ Direction Animation::getOldDirection() {
return _oldDirection;
}
+void Animation::setAvvyClothes(int id) {
+ AnimationType *spr = _sprites[0];
+ if (spr->_id == id)
+ return;
+
+ int16 x = spr->_x;
+ int16 y = spr->_y;
+ spr->remove();
+ spr->init(id, true);
+ spr->appear(x, y, kDirLeft);
+ spr->_visible = false;
+}
+
+int Animation::getAvvyClothes() {
+ return _sprites[0]->_id;
+}
+
void Animation::resetVariables() {
_geidaSpin = 0;
_geidaTime = 0;
diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h
index 703d35c832..33f6ab02a6 100644
--- a/engines/avalanche/animation.h
+++ b/engines/avalanche/animation.h
@@ -42,29 +42,25 @@ enum Direction {
class AnimationType {
public:
- // Former SpriteInfo structure
+ byte _id;
+
byte _xLength, _yLength;
ManiType *_mani[24];
SilType *_sil[24];
-
- // Former Stat structure
byte _frameNum; // Number of pictures.
byte _seq; // How many in one stride.
- Color _fgBubbleCol, _bgBubbleCol; // Foreground & background bubble colors.
byte _characterId; // The number according to Acci. (1=Avvy, etc.)
- //
+ byte _count; // Counts before changing step.
Direction _facingDir;
byte _stepNum;
int16 _x, _y; // Current xy coords.
int8 _moveX, _moveY; // Amount to move sprite by, each step.
- byte _id;
bool _quick, _visible, _homing, _doCheck;
int16 _homingX, _homingY; // Homing x & y coords.
- byte _count; // Counts before changing step.
- byte _speedX, _speedY; // x & y speed.
- bool _vanishIfStill; // Do we show this sprite if it's still?
- bool _callEachStepFl; // Do we call the eachstep procedure?
+ byte _speedX, _speedY;
+ bool _vanishIfStill;
+ bool _callEachStepFl;
byte _eachStepProc;
AnimationType(Animation *anim);
@@ -78,7 +74,6 @@ public:
void walk();
void walkTo(byte pednum);
void stopHoming();
- void homeStep();
void setSpeed(int8 xx, int8 yy);
void stopWalk();
void chatter();
@@ -88,9 +83,11 @@ private:
Animation *_anim;
int16 _oldX[2], _oldY[2]; // Last xy coords.
+ Color _fgBubbleCol, _bgBubbleCol; // Foreground & background bubble colors.
bool checkCollision();
int8 getSign(int16 val);
+ void homeStep();
};
class Animation {
@@ -132,6 +129,9 @@ public:
Direction getDirection();
Direction getOldDirection();
+ void setAvvyClothes(int id);
+ int getAvvyClothes();
+
void resetVariables();
void synchronize(Common::Serializer &sz);
private:
diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h
index f4d5f6a1d7..cc9a34d82b 100644
--- a/engines/avalanche/avalanche.h
+++ b/engines/avalanche/avalanche.h
@@ -164,9 +164,6 @@ public:
static const bool kThing = true;
static const bool kPerson = false;
- // These following static constants should be included in CFG when it's written.
- static const int16 kWalk = 3;
- static const int16 kRun = 5;
static const char kSpludwicksOrder[3];
static const uint16 kNotes[12];
diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp
index 497812cb08..8ef41a2c93 100644
--- a/engines/avalanche/avalot.cpp
+++ b/engines/avalanche/avalot.cpp
@@ -851,7 +851,7 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) {
case kRoomLustiesRoom:
_npcFacing = 1; // du Lustie.
- if (_animation->_sprites[0]->_id == 0) // Avvy in his normal clothes
+ if (_animation->getAvvyClothes() == 0) // Avvy in his normal clothes
_timer->addTimer(3, Timer::kProcCallsGuards, Timer::kReasonDuLustieTalks);
else if (!_enteredLustiesRoomAsMonk) // already
// Presumably, Avvy dressed as a monk.
diff --git a/engines/avalanche/enums.h b/engines/avalanche/enums.h
index 155c9ac060..604c62de84 100644
--- a/engines/avalanche/enums.h
+++ b/engines/avalanche/enums.h
@@ -124,6 +124,10 @@ enum ControlCharacter {
static const int16 kScreenWidth = 640;
static const int16 kScreenHeight = 200;
+static const int16 kWalk = 3;
+static const int16 kRun = 5;
+
+
} // End of namespace Avalanche
#endif // AVALANCHE_ENUMS_H
diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp
index a802a01238..25b01d65f3 100644
--- a/engines/avalanche/graphics.cpp
+++ b/engines/avalanche/graphics.cpp
@@ -394,7 +394,7 @@ void GraphicManager::drawMenuItem(int x1, int y1, int x2, int y2) {
}
void GraphicManager::drawSpeedBar(int speed) {
- if (speed == _vm->kRun) {
+ if (speed == kRun) {
_surface.drawLine(336, 199, 338, 199, kColorLightblue);
_surface.drawLine(371, 199, 373, 199, kColorYellow);
} else {
diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp
index 59ac38f644..bba8e862a9 100644
--- a/engines/avalanche/menu.cpp
+++ b/engines/avalanche/menu.cpp
@@ -62,7 +62,9 @@ void HeadType::highlight() {
_menu->_activeMenuItem._activeNum = _position;
_menu->_menuActive = true;
- _menu->_vm->_currentMouse = 177; // Force redraw of cursor.
+ // Force reload and redraw of cursor.
+ _menu->_vm->_currentMouse = 177;
+
}
bool HeadType::parseAltTrigger(char key) {
@@ -431,7 +433,7 @@ void Menu::setupMenuAction() {
_activeMenuItem.setupOption("Open the door", 'O', "f7", _vm->_animation->nearDoor());
_activeMenuItem.setupOption("Look around", 'L', "f8", true);
_activeMenuItem.setupOption("Inventory", 'I', "Tab", true);
- if (_vm->_animation->_sprites[0]->_speedX == _vm->kWalk)
+ if (_vm->_animation->_sprites[0]->_speedX == kWalk)
_activeMenuItem.setupOption("Run fast", 'R', "^R", true);
else
_activeMenuItem.setupOption("Walk slowly", 'W', "^W", true);
@@ -596,10 +598,10 @@ void Menu::runMenuAction() {
break;
case 5: {
AnimationType *avvy = _vm->_animation->_sprites[0];
- if (avvy->_speedX == _vm->kWalk)
- avvy->_speedX = _vm->kRun;
+ if (avvy->_speedX == kWalk)
+ avvy->_speedX = kRun;
else
- avvy->_speedX = _vm->kWalk;
+ avvy->_speedX = kWalk;
_vm->_animation->updateSpeed();
}
break;
diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp
index d85e55032c..fc176c78b0 100644
--- a/engines/avalanche/parser.cpp
+++ b/engines/avalanche/parser.cpp
@@ -1926,15 +1926,8 @@ void Parser::doThat() {
i = 3;
else
i = 0;
- Avalanche::AnimationType *spr = _vm->_animation->_sprites[0];
- if (spr->_id != i) {
- int16 x = spr->_x;
- int16 y = spr->_y;
- spr->remove();
- spr->init(i, true);
- spr->appear(x, y, kDirLeft);
- spr->_visible = false;
- }
+
+ _vm->_animation->setAvvyClothes(i);
}
break;
default: