Hello,
I have been playing with 'ent_bonehandle' and 'ent_boneparent' and as far I undertand when any of both functions are called with a NULL bone handle it returns the bone handle of the bone name the string contains.

'ent_bonehandle' works good as far as the bone name continues been the same but 'ent_boneparent' also overwrites the bone name contained in the string. I guess it should not overwrite the bone name string when called with a null bone handle in order to mantain the source string as it is.

The code I used to test the instructions functionality
Code:
#include <acknex.h>

void main ()
{
	int bone_index = 0, parent_index = 0, child_index = 0;
	video_mode = 12;
	wait(2);
	level_load ( "" );
	FONT *fnt10 = font_create ( "Arial#12" );
	ENTITY *entBones = ent_create ( "biped.mdl", nullvector, NULL );
	int numBones = ent_bones ( entBones );
	int step = screen_size.x / numBones;
	
	//----------------------------------------------------------------------------------------
	
	TEXT **txtBones = sys_malloc ( sizeof(TEXT*) * numBones );
	for ( bone_index=0; bone_index<numBones; bone_index+=1 )
	{
		txtBones[bone_index] = txt_create ( numBones, 1 );
		txtBones[bone_index]->pos_x = bone_index * step;
		txtBones[bone_index]->font = fnt10;
		txtBones[bone_index]->flags = SHOW;
	}
	
	for ( bone_index=0; bone_index<numBones; bone_index+=1 )
		ent_bonehandle ( entBones, (txtBones[bone_index]->pstring)[0], bone_index+1 );
	
	for ( bone_index=0; bone_index<numBones; bone_index+=1 )
	{
		int parent_index = 1;
		long handle = ent_boneparent ( entBones, (txtBones[bone_index]->pstring)[parent_index], bone_index+1 );
		while ( handle )
		{
			parent_index += 1;
			handle = ent_boneparent ( entBones, (txtBones[bone_index]->pstring)[parent_index], (var)handle );
		}
	}
	
	//----------------------------------------------------------------------------------------
	
	TEXT **txtBones2 = sys_malloc ( sizeof(TEXT*) * numBones );
	for ( bone_index=0; bone_index<numBones; bone_index+=1 )
	{
		txtBones2[bone_index] = txt_create ( numBones, 1 );
		txtBones2[bone_index]->pos_x = bone_index * step;
		txtBones2[bone_index]->pos_y = 250;
		txtBones2[bone_index]->font = fnt10;
		txtBones2[bone_index]->flags = SHOW;
	}
	
	for ( bone_index=0; bone_index<numBones; bone_index+=1 )
		ent_bonehandle ( entBones, (txtBones2[bone_index]->pstring)[0], bone_index+1 );
	
	for ( bone_index=0; bone_index<numBones; bone_index+=1 )
	{
		child_index = 0;
		long handle = ent_boneparent ( entBones, (txtBones2[bone_index]->pstring)[child_index], 0 );
		while ( handle )
		{
			child_index += 1;
			ent_bonehandle ( entBones, (txtBones2[bone_index]->pstring)[child_index], (var)handle );
			handle = ent_boneparent ( entBones, (txtBones2[bone_index]->pstring)[child_index], 0 );
		}
	}
	
	//----------------------------------------------------------------------------------------
	
	while ( !key_esc )
		wait(1);
	
	sys_exit ( NULL );
}



The model: https://app.box.com/s/tozj882s0qvlztcp19tm

Is this a desired behavior?

Thanks in advance,
txes

Last edited by txesmi; 04/28/14 10:41.