aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Gunkel2012-02-04 17:32:26 +0100
committerTobias Gunkel2012-02-11 08:30:05 +0100
commit5d3e1dd0dc7542057779f192c6865e9501eb8e36 (patch)
treeb85c6f55b6b3c0491c990a73340b5691812e321e
parentdaff6f36ae210bea03bc51f0e5293218f439cd89 (diff)
downloadscummvm-rg350-5d3e1dd0dc7542057779f192c6865e9501eb8e36.tar.gz
scummvm-rg350-5d3e1dd0dc7542057779f192c6865e9501eb8e36.tar.bz2
scummvm-rg350-5d3e1dd0dc7542057779f192c6865e9501eb8e36.zip
SCUMM: remove the temporary variable _limb_current
-rw-r--r--engines/scumm/actor.cpp24
-rw-r--r--engines/scumm/actor.h3
-rw-r--r--engines/scumm/costume.cpp40
-rw-r--r--engines/scumm/costume.h5
4 files changed, 37 insertions, 35 deletions
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index c5d2a2b9fb..f58d3fde4e 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -1937,39 +1937,33 @@ void Actor::animateCostume() {
}
}
-void ActorC64::limbFrameCheck() {
- if (_cost.frame[_limb_current] == 0xFFFF )
+void ActorC64::limbFrameCheck(int limb) {
+ if (_cost.frame[limb] == 0xFFFF)
return;
- if (_cost.start[_limb_current] == _cost.frame[_limb_current] )
+ if (_cost.start[limb] == _cost.frame[limb])
return;
// 0x25A4
- _cost.start[_limb_current] = _cost.frame[_limb_current];
+ _cost.start[limb] = _cost.frame[limb];
- _limbFrameRepeat[_limb_current] = _limbFrameRepeatNew[_limb_current];
+ _limbFrameRepeat[limb] = _limbFrameRepeatNew[limb];
// 0x25C3
- _cost.active[_limb_current] = ((C64CostumeLoader*)_vm->_costumeLoader)->getFrame( this );
- _cost.curpos[_limb_current] = 0;
+ _cost.active[limb] = ((C64CostumeLoader*)_vm->_costumeLoader)->getFrame(this, limb);
+ _cost.curpos[limb] = 0;
_needRedraw = true;
}
void ActorC64::animateCostume() {
-
speakCheck();
- for(_limb_current = 0; _limb_current < 8; ++_limb_current) {
- limbFrameCheck();
-
- if (_vm->_costumeLoader->increaseAnims(this))
- _needRedraw = true;
- }
+ if (_vm->_costumeLoader->increaseAnims(this))
+ _needRedraw = true;
}
void ActorC64::speakCheck() {
-
if (v0ActorTalkArray[_number] & 0x80)
return;
diff --git a/engines/scumm/actor.h b/engines/scumm/actor.h
index c82bd641bd..c2ffcf1275 100644
--- a/engines/scumm/actor.h
+++ b/engines/scumm/actor.h
@@ -355,7 +355,6 @@ public:
int8 _animFrameRepeat;
int8 _limbFrameRepeatNew[8], _limbFrameRepeat[8];
- byte _limb_current;
bool _limb_flipped[8];
public:
@@ -382,7 +381,7 @@ public:
virtual void animateActor(int anim);
virtual void animateCostume();
- void limbFrameCheck();
+ void limbFrameCheck(int limb);
void speakCheck();
virtual void setDirection(int direction);
diff --git a/engines/scumm/costume.cpp b/engines/scumm/costume.cpp
index 0b22cf38e2..9fe5296546 100644
--- a/engines/scumm/costume.cpp
+++ b/engines/scumm/costume.cpp
@@ -1337,54 +1337,64 @@ void C64CostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) {
}
}
-byte C64CostumeLoader::getFrame(ActorC64 *A) {
-
- loadCostume(A->_costume);
+byte C64CostumeLoader::getFrame(Actor *a, int limb) {
+ loadCostume(a->_costume);
// Get the frame number for the current limb / Command
- return _frameOffsets[_frameOffsets[A->_limb_current] + A->_cost.start[A->_limb_current]];
+ return _frameOffsets[_frameOffsets[limb] + a->_cost.start[limb]];
}
byte C64CostumeLoader::increaseAnims(Actor *a) {
ActorC64 *A = (ActorC64 *)a;
-
- uint16 limbPrevious = a->_cost.curpos[A->_limb_current]++;
+ int i;
+ byte r = 0;
+
+ for(i = 0; i != 8; i++) {
+ A->limbFrameCheck(i);
+ r += increaseAnim(a, i);
+ }
+ return r;
+}
+
+byte C64CostumeLoader::increaseAnim(Actor *a, int limb) {
+ ActorC64 *A = (ActorC64 *)a;
+ const uint16 limbPrevious = a->_cost.curpos[limb]++;
loadCostume(a->_costume);
// 0x2543
- byte frame = _frameOffsets[a->_cost.curpos[A->_limb_current] + a->_cost.active[A->_limb_current]];
+ byte frame = _frameOffsets[a->_cost.curpos[limb] + a->_cost.active[limb]];
// Is this frame invalid?
if (frame == 0xFF) {
// Repeat timer has reached 0?
- if(A->_limbFrameRepeat[A->_limb_current] == 0) {
+ if(A->_limbFrameRepeat[limb] == 0) {
// Use the previous frame
- --A->_cost.curpos[A->_limb_current];
+ --A->_cost.curpos[limb];
// Reset the comstume command
A->_costCommandNew = 0xFF;
A->_costCommand = 0xFF;
// Set the frame/start to invalid
- A->_cost.frame[A->_limb_current] = 0xFFFF;
- A->_cost.start[A->_limb_current] = 0xFFFF;
+ A->_cost.frame[limb] = 0xFFFF;
+ A->_cost.start[limb] = 0xFFFF;
} else {
// Repeat timer enabled?
- if(A->_limbFrameRepeat[A->_limb_current] != -1)
- --A->_limbFrameRepeat[A->_limb_current];
+ if(A->_limbFrameRepeat[limb] != -1)
+ --A->_limbFrameRepeat[limb];
// No, restart at frame 0
- a->_cost.curpos[A->_limb_current] = 0;
+ a->_cost.curpos[limb] = 0;
}
}
// Limb frame has changed?
- if(limbPrevious == a->_cost.curpos[A->_limb_current])
+ if(limbPrevious == a->_cost.curpos[limb])
return 0;
return 1;
diff --git a/engines/scumm/costume.h b/engines/scumm/costume.h
index 50f23dbacf..16317cb1c9 100644
--- a/engines/scumm/costume.h
+++ b/engines/scumm/costume.h
@@ -73,11 +73,10 @@ public:
void loadCostume(int id);
void costumeDecodeData(Actor *a, int frame, uint usemask);
byte increaseAnims(Actor *a);
-
- byte getFrame(ActorC64 *A);
+ byte getFrame(Actor *a, int limb);
protected:
-
+ byte increaseAnim(Actor *a, int limb);
};
class ClassicCostumeRenderer : public BaseCostumeRenderer {