mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-03 09:23:37 +00:00
SCUMM: remove the temporary variable _limb_current
This commit is contained in:
parent
daff6f36ae
commit
5d3e1dd0dc
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user