aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authoruruk2013-09-08 12:21:02 +0200
committeruruk2013-09-08 12:21:02 +0200
commitb7844c3548a7e911262d35d8ee0a122a5decca7a (patch)
treec8621d053b981ac2cafcc6381bb1ec122e9c4f7f /engines
parentb8d16e894c05aaec679125e25e83abf959608123 (diff)
downloadscummvm-rg350-b7844c3548a7e911262d35d8ee0a122a5decca7a.tar.gz
scummvm-rg350-b7844c3548a7e911262d35d8ee0a122a5decca7a.tar.bz2
scummvm-rg350-b7844c3548a7e911262d35d8ee0a122a5decca7a.zip
AVALANCHE: More renaming/refactoring in Animation.
Diffstat (limited to 'engines')
-rw-r--r--engines/avalanche/animation.cpp46
-rw-r--r--engines/avalanche/animation.h67
2 files changed, 56 insertions, 57 deletions
diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp
index f83173ef77..204121b3bc 100644
--- a/engines/avalanche/animation.cpp
+++ b/engines/avalanche/animation.cpp
@@ -141,7 +141,7 @@ void AnimationType::original() {
_id = 177;
}
-void AnimationType::andexor() {
+void AnimationType::draw() {
if ((_vanishIfStill) && (_moveX == 0) && (_moveY == 0))
return;
byte picnum = _facingDir * _stat._seq + _stepNum; // There'll maybe problem because of the different array indexes in Pascal (starting from 1).
@@ -412,7 +412,7 @@ byte Animation::checkFeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) {
return a;
}
-byte Animation::geida_ped(byte which) {
+byte Animation::geidaPed(byte which) {
switch (which) {
case 1:
return 7;
@@ -730,7 +730,7 @@ void Animation::catacombMove(byte ped) {
if ((_vm->_gyro->_dna._geidaFollows) && (ped > 0)) {
if (!_sprites[1]._quick) // If we don't already have her...
_sprites[1].init(5, true, this); // ...Load Geida.
- appearPed(2, geida_ped(ped));
+ appearPed(2, geidaPed(ped));
_sprites[1]._callEachStepFl = true;
_sprites[1]._eachStepProc = kProcGeida;
}
@@ -739,7 +739,7 @@ void Animation::catacombMove(byte ped) {
// This proc gets called whenever you touch a line defined as _vm->_gyro->special.
-void Animation::dawndelay() {
+void Animation::dawnDelay() {
_vm->_timer->addTimer(2, _vm->_timer->kProcDawnDelay, _vm->_timer->kReasonDawndelay);
}
@@ -864,7 +864,7 @@ void Animation::callSpecial(uint16 which) {
default:
appearPed(1, 4);
}
- dawndelay();
+ dawnDelay();
break;
case 11: // _vm->_gyro->special 11: transfer east in catacombs.
_vm->_lucerna->dusk();
@@ -873,7 +873,7 @@ void Animation::callSpecial(uint16 which) {
if (_vm->_gyro->_dna._room != r__catacombs)
return;
appearPed(1, 1);
- dawndelay();
+ dawnDelay();
break;
case 12: // _vm->_gyro->special 12: transfer south in catacombs.
_vm->_lucerna->dusk();
@@ -882,7 +882,7 @@ void Animation::callSpecial(uint16 which) {
if (_vm->_gyro->_dna._room != r__catacombs)
return;
appearPed(1, 2);
- dawndelay();
+ dawnDelay();
break;
case 13: // _vm->_gyro->special 13: transfer west in catacombs.
_vm->_lucerna->dusk();
@@ -891,7 +891,7 @@ void Animation::callSpecial(uint16 which) {
if (_vm->_gyro->_dna._room != r__catacombs)
return;
appearPed(1, 3);
- dawndelay();
+ dawnDelay();
break;
}
}
@@ -1014,7 +1014,7 @@ void Animation::appearPed(byte trn, byte np) {
}
// Eachstep procedures:
-void Animation::follow_avvy_y(byte tripnum) {
+void Animation::followAvalotY(byte tripnum) {
if (_sprites[0]._facingDir == kDirLeft)
return;
if (_sprites[tripnum]._homing)
@@ -1035,7 +1035,7 @@ void Animation::follow_avvy_y(byte tripnum) {
}
}
-void Animation::back_and_forth(byte tripnum) {
+void Animation::backAndForth(byte tripnum) {
if (!_sprites[tripnum]._homing) {
if (_sprites[tripnum]._facingDir == kDirRight)
_sprites[tripnum].walkTo(4);
@@ -1044,7 +1044,7 @@ void Animation::back_and_forth(byte tripnum) {
}
}
-void Animation::face_avvy(byte tripnum) {
+void Animation::faceAvvy(byte tripnum) {
if (!_sprites[tripnum]._homing) {
if (_sprites[0]._x >= _sprites[tripnum]._x)
_sprites[tripnum]._facingDir = kDirRight;
@@ -1053,7 +1053,7 @@ void Animation::face_avvy(byte tripnum) {
}
}
-void Animation::arrow_procs(byte tripnum) {
+void Animation::arrowProcs(byte tripnum) {
if (_sprites[tripnum]._homing) {
// Arrow is still in flight.
// We must check whether or not the arrow has collided tr[tripnum] Avvy's head.
@@ -1108,7 +1108,7 @@ begin
end;
#endif
-void Animation::grab_avvy(byte tripnum) { // For Friar Tuck, in Nottingham.
+void Animation::grabAvvy(byte tripnum) { // For Friar Tuck, in Nottingham.
int16 tox = _sprites[0]._x + 17;
int16 toy = _sprites[0]._y - 1;
if ((_sprites[tripnum]._x == tox) && (_sprites[tripnum]._y == toy)) {
@@ -1156,7 +1156,7 @@ void Animation::spin(byte whichway, byte &tripnum) {
}
}
-void Animation::geida_procs(byte tripnum) {
+void Animation::geidaProcs(byte tripnum) {
if (_vm->_gyro->_dna._geidaTime > 0) {
_vm->_gyro->_dna._geidaTime--;
if (_vm->_gyro->_dna._geidaTime == 0)
@@ -1196,7 +1196,7 @@ void Animation::geida_procs(byte tripnum) {
// That's all...
-void Animation::call_andexors() {
+void Animation::drawSprites() {
int8 order[5];
byte temp;
bool ok;
@@ -1228,7 +1228,7 @@ void Animation::call_andexors() {
for (byte i = 0; i < 5; i++) {
if (order[i] > -1)
- _sprites[order[i]].andexor();
+ _sprites[order[i]].draw();
}
}
@@ -1244,29 +1244,29 @@ void Animation::animLink() {
_sprites[i].walk();
}
- call_andexors();
+ drawSprites();
for (int16 i = 0; i < kSpriteNumbMax; i++) {
if (_sprites[i]._quick && _sprites[i]._callEachStepFl) {
switch (_sprites[i]._eachStepProc) {
case kProcFollowAvvyY :
- follow_avvy_y(i);
+ followAvalotY(i);
break;
case kProcBackAndForth :
- back_and_forth(i);
+ backAndForth(i);
break;
case kProcFaceAvvy :
- face_avvy(i);
+ faceAvvy(i);
break;
case kProcArrow :
- arrow_procs(i);
+ arrowProcs(i);
break;
// PROCSpludwick_procs : spludwick_procs(fv);
case kProcGrabAvvy :
- grab_avvy(i);
+ grabAvvy(i);
break;
case kProcGeida :
- geida_procs(i);
+ geidaProcs(i);
break;
}
}
diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h
index cfb1cfe97d..d6a87dc547 100644
--- a/engines/avalanche/animation.h
+++ b/engines/avalanche/animation.h
@@ -42,7 +42,6 @@ class Animation;
struct StatType {
Common::String _name; // Name of character.
Common::String _comment; // Comment.
- //
byte _frameNum; // Number of pictures.
byte _seq; // How many in one stride.
byte _fgBubbleCol, _bgBubbleCol; // Foreground & background bubble colors.
@@ -52,7 +51,6 @@ struct StatType {
class AnimationType {
public:
SpriteInfo _info;
-
StatType _stat; // Vital statistics.
byte _facingDir, _stepNum;
int16 _x, _y; // Current xy coords.
@@ -70,7 +68,7 @@ public:
void init(byte spritenum, bool doCheck, Animation *tr); // Loads & sets up the sprite.
void original(); // Just sets 'quick' to false.
- void andexor(); // Drops sprite onto screen.
+ void draw(); // Drops sprite onto screen. Original: andexor().
void turn(byte whichway); // Turns character round.
void appear(int16 wx, int16 wy, byte wf); // Switches it on.
void bounce(); // Bounces off walls.
@@ -94,25 +92,27 @@ class Animation {
public:
friend class AnimationType;
- static const byte kDirUp = 0;
- static const byte kDirRight = 1;
- static const byte kDirDown = 2;
- static const byte kDirLeft = 3;
- static const byte kDirUpRight = 4;
- static const byte kDirDownRight = 5;
- static const byte kDirDownLeft = 6;
- static const byte kDirUpLeft = 7;
- static const byte kDirStopped = 8;
+ enum Direction {
+ kDirUp, kDirRight, kDirDown, kDirLeft,
+ kDirUpRight, kDirDownRight, kDirDownLeft, kDirUpLeft,
+ kDirStopped
+ };
static const int16 kSpriteNumbMax = 5; // current max no. of sprites
- static const byte kProcFollowAvvyY = 1;
- static const byte kProcBackAndForth = 2;
- static const byte kProcFaceAvvy = 3;
- static const byte kProcArrow = 4;
- static const byte kProcsPludwick = 5; // Unused
- static const byte kProcGrabAvvy = 6;
- static const byte kProcGeida = 7;
+ enum Proc {
+ kProcFollowAvvyY = 1,
+ kProcBackAndForth,
+ kProcFaceAvvy,
+ kProcArrow,
+ kProcSpludwick, // Unused
+ kProcGrabAvvy,
+ kProcGeida // Spludwick uses it as well for homing! TODO: Unify it with kProcSpludwick.
+ };
+
+ AnimationType _sprites[kSpriteNumbMax];
+ bool _mustExclaim;
+ uint16 _sayWhat;
Animation(AvalancheEngine *vm);
~Animation();
@@ -131,29 +131,28 @@ public:
void updateSpeed();
void handleMoveKey(const Common::Event &event); // To replace tripkey().
- AnimationType _sprites[kSpriteNumbMax];
-
- bool _mustExclaim;
- uint16 _sayWhat;
-
private:
AvalancheEngine *_vm;
byte checkFeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl);
- byte geida_ped(byte which);
- void dawndelay();
+ byte geidaPed(byte which);
+ void dawnDelay();
+
+ void grabAvvy(byte tripnum);
+ void arrowProcs(byte tripnum);
void hideInCupboard();
- void follow_avvy_y(byte tripnum);
- void back_and_forth(byte tripnum);
- void face_avvy(byte tripnum);
- void arrow_procs(byte tripnum);
- void grab_avvy(byte tripnum);
- void spin(byte whichway, byte &tripnum);
+ // Different movements for NPCs:
+ void followAvalotY(byte tripnum); // Original: follow_avvy_y().
+ void backAndForth(byte tripnum);
+ void faceAvvy(byte tripnum);
+
+ // Movements for Homing NPCs: Spludwick and Geida.
+ void spin(byte whichway, byte &tripnum);
void takeAStep(byte &tripnum);
- void geida_procs(byte tripnum);
+ void geidaProcs(byte tripnum);
- void call_andexors();
+ void drawSprites(); // Original: call_andexors().
};
} // End of namespace Avalanche.