Skip to content

Commit

Permalink
ZVISION: Add functions for framedelay controlling in animation_node
Browse files Browse the repository at this point in the history
  • Loading branch information
Marisa-Chan committed Mar 1, 2014
1 parent 3608a0f commit 6650140
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
17 changes: 17 additions & 0 deletions engines/zvision/animation_node.cpp
Expand Up @@ -191,4 +191,21 @@ bool AnimationNode::stop() {
return false;
}

void AnimationNode::setNewFrameDelay(int32 newDelay) {
if (newDelay > 0) {
PlayNodes::iterator it = _playList.begin();
if (it != _playList.end()) {
playnode *nod = &(*it);
float percent = (float)nod->_delay / (float)_frmDelay;
nod->_delay = percent * newDelay; // Scale to new max
}

_frmDelay = newDelay;
}
}

int32 AnimationNode::getFrameDelay() {
return _frmDelay;
}

} // End of namespace ZVision
3 changes: 3 additions & 0 deletions engines/zvision/animation_node.h
Expand Up @@ -74,6 +74,9 @@ class AnimationNode : public SideFX {
void addPlayNode(int32 slot, int x, int y, int x2, int y2, int start_frame, int end_frame, int loops = 1);

bool stop();

void setNewFrameDelay(int32 newDelay);
int32 getFrameDelay();
};

} // End of namespace ZVision
Expand Down

0 comments on commit 6650140

Please sign in to comment.