本文整理汇总了C++中game_import_t::G2API_SetBoneAnimIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ game_import_t::G2API_SetBoneAnimIndex方法的具体用法?C++ game_import_t::G2API_SetBoneAnimIndex怎么用?C++ game_import_t::G2API_SetBoneAnimIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类game_import_t
的用法示例。
在下文中一共展示了game_import_t::G2API_SetBoneAnimIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: G_Animate
void G_Animate ( gentity_t *self )
{
if ( self->s.eFlags & EF_SHADER_ANIM )
{
return;
}
if ( self->s.frame == self->endFrame )
{
if ( self->svFlags & SVF_ANIMATING )
{
// ghoul2 requires some extra checks to see if the animation is done since it doesn't set the current frame directly
if ( self->ghoul2.size() )
{
float frame, junk2;
int junk;
// I guess query ghoul2 to find out what the current frame is and see if we are done.
gi.G2API_GetBoneAnimIndex( &self->ghoul2[self->playerModel], self->rootBone,
(cg.time?cg.time:level.time), &frame, &junk, &junk, &junk, &junk2, NULL );
// It NEVER seems to get to what you'd think the last frame would be, so I'm doing this to try and catch when the animation has stopped
if ( frame + 1 >= self->endFrame )
{
self->svFlags &= ~SVF_ANIMATING;
Q3_TaskIDComplete( self, TID_ANIM_BOTH );
}
}
else // not ghoul2
{
if ( self->loopAnim )
{
self->s.frame = self->startFrame;
}
else
{
self->svFlags &= ~SVF_ANIMATING;
}
//Finished sequence - FIXME: only do this once even on looping anims?
Q3_TaskIDComplete( self, TID_ANIM_BOTH );
}
}
return;
}
self->svFlags |= SVF_ANIMATING;
// With ghoul2, we'll just set the desired start and end frame and let it do it's thing.
if ( self->ghoul2.size())
{
self->s.frame = self->endFrame;
gi.G2API_SetBoneAnimIndex( &self->ghoul2[self->playerModel], self->rootBone,
self->startFrame, self->endFrame, BONE_ANIM_OVERRIDE_FREEZE, 1.0f, cg.time );
return;
}
if ( self->startFrame < self->endFrame )
{
if ( self->s.frame < self->startFrame || self->s.frame > self->endFrame )
{
self->s.frame = self->startFrame;
}
else
{
self->s.frame++;
}
}
else if ( self->startFrame > self->endFrame )
{
if ( self->s.frame > self->startFrame || self->s.frame < self->endFrame )
{
self->s.frame = self->startFrame;
}
else
{
self->s.frame--;
}
}
else
{
self->s.frame = self->endFrame;
}
}