Fixed looping animations for actors

This commit is contained in:
n00b
2024-11-15 22:19:40 -05:00
parent 378c25ffde
commit c085150def
9 changed files with 1448 additions and 1047 deletions

View File

@@ -583,12 +583,34 @@ class rc_animEndCallBack : public IAnimationEndCallBack
//std::cout << "animating" << std::endl;
irr::scene::IAnimatedMeshSceneNode* node = (irr::scene::IAnimatedMeshSceneNode*) ref_actor->mesh_node;
int animation = ref_actor->current_animation;
if(animation < 0 || animation >= ref_actor->animation.size())
if(animation == RC_ANIMATION_MD2)
{
int start_frame = node->getStartFrame();
int end_frame = node->getEndFrame();
node->setFrameLoop(start_frame, end_frame);
ref_actor->current_animation_loop++;
}
else if(animation == RC_ANIMATION_TRANSITION)
{
//TODO: Transitions are currently broken
}
else if(animation < 0 || animation >= ref_actor->animation.size())
{
return;
int start_frame = ref_actor->animation[animation].start_frame;
int end_frame = ref_actor->animation[animation].end_frame;
node->setFrameLoop(start_frame, end_frame);
ref_actor->current_animation_loop++;
}
else
{
if(!ref_actor->animation[animation].active)
{
ref_actor->isPlaying = false;
ref_actor->current_animation_loop = 0;
return;
}
int start_frame = ref_actor->animation[animation].start_frame;
int end_frame = ref_actor->animation[animation].end_frame;
node->setFrameLoop(start_frame, end_frame);
ref_actor->current_animation_loop++;
}
}
else
{