Ejemplo n.º 1
0
MotionID death_anims::motion ( CEntityAlive& ea, const SHit& H, float &angle ) const
{
	angle = 0;
	if( anims.empty( ) )
	{
#ifdef	DEBUG
		if( death_anim_debug )
			Msg(" death anims: obj: %s no death motions loaded ", ea.cName().c_str() );
#endif
		return rnd_anims.motion();
	}
	
	MotionID m;
	xr_vector<type_motion*>::const_iterator i = anims.begin(), e = anims.end();
	for( ; e!=i; ++i )
		if((*i)->predicate( ea, H, m, angle ) && m.valid() )
			return m;

#ifdef	DEBUG
		if( death_anim_debug )
			Msg(" death anims: obj: %s no conditions evaluated  returns random ", ea.cName().c_str() );
#endif
	angle = 0;
	return rnd_anims.motion();
}
void type_motion_diagnostic( LPCSTR message, type_motion::edirection dr, const CEntityAlive& ea, const SHit& H, const MotionID &m )
{
#ifdef DEBUG

	if(! death_anim_debug )
		return;
	
	IKinematicsAnimated *KA = smart_cast<IKinematicsAnimated*>( ea.Visual() );
	VERIFY( KA );
	IKinematics *K  = smart_cast<IKinematics*>( ea.Visual() );
	LPCSTR bone_name = "not_definite";
	if( H.bone() != BI_NONE )
	{
		CBoneData& bd = K->LL_GetData( H.bone() );
		bone_name = bd.name.c_str();
	}
	LPCSTR motion_name = "not_set";
	if( m.valid() )
		motion_name = KA->LL_MotionDefName_dbg( m ).first;

	Msg( "death anims: %s, dir: %s, motion: %s,  obj: %s, model: %s, bone: %s " ,message ,motion_dirs[ dr ].name, motion_name, ea.cName().c_str(), ea.cNameVisual().c_str(), bone_name );

#endif
}