コード例 #1
0
ファイル: g_character.c プロジェクト: dstaesse/etlegacy
/*
===================
G_RegisterCharacter
===================
*/
qboolean G_RegisterCharacter(const char *characterFile, bg_character_t *character)
{
	bg_characterDef_t characterDef;

	memset(&characterDef, 0, sizeof(characterDef));

	if (!BG_ParseCharacterFile(characterFile, &characterDef))
	{
		return qfalse;  // the parser will provide the error message
	}

#ifdef FEATURE_SERVERMDX
	// Register mesh
	if (!(character->mesh = trap_R_RegisterModel(characterDef.mesh)))
	{
		G_Printf(S_COLOR_YELLOW "WARNING: failed to register mesh '%s' referenced from '%s'\n", characterDef.mesh, characterFile);
	}
#endif

	// Parse Animation Files
	if (!G_CheckForExistingAnimModelInfo(characterDef.animationGroup, characterDef.animationScript, &character->animModelInfo))
	{
		if (!G_ParseAnimationFiles(character, characterDef.animationGroup, characterDef.animationScript))
		{
			G_Printf(S_COLOR_YELLOW "WARNING: failed to load animation files referenced from '%s'\n", characterFile);
			return qfalse;
		}

		mdx_LoadHitsFile(characterDef.animationGroup, character->animModelInfo);
	}

	return qtrue;
}
コード例 #2
0
/*
===================
G_RegisterCharacter
===================
*/
qboolean G_RegisterCharacter( const char *characterFile, bg_character_t *character ) {
	bg_characterDef_t characterDef;

	memset( &characterDef, 0, sizeof( characterDef ) );

	if ( !BG_ParseCharacterFile( characterFile, &characterDef ) ) {
		return qfalse;  // the parser will provide the error message
	}

	// Parse Animation Files
	if ( !G_CheckForExistingAnimModelInfo( characterDef.animationGroup, characterDef.animationScript, &character->animModelInfo ) ) {
		if ( !G_ParseAnimationFiles( character, characterDef.animationGroup, characterDef.animationScript ) ) {
			G_Printf( S_COLOR_YELLOW "WARNING: failed to load animation files referenced from '%s'\n", characterFile );
			return qfalse;
		}
	}

	return qtrue;
}
コード例 #3
0
ファイル: g_character.c プロジェクト: lcfx/etet
/*
===================
G_RegisterCharacter
===================
*/
qboolean G_RegisterCharacter( const char *characterFile, bg_character_t *character )
{
	bg_characterDef_t	characterDef;

	memset( &characterDef, 0, sizeof(characterDef) );

	if( !BG_ParseCharacterFile( characterFile, &characterDef ) ) {
		return qfalse;	// the parser will provide the error message
	}

	// Register mesh
	if( !(character->mesh = trap_R_RegisterModel( characterDef.mesh )) )
		G_Printf( S_COLOR_YELLOW "WARNING: failed to register mesh '%s' referenced from '%s'\n", characterDef.mesh, characterFile );

	// Parse Animation Files
	if( !G_CheckForExistingAnimModelInfo( characterDef.animationGroup, characterDef.animationScript, &character->animModelInfo ) ) {
		if( !G_ParseAnimationFiles( character, characterDef.animationGroup, characterDef.animationScript ) ) {
			G_Printf( S_COLOR_YELLOW "WARNING: failed to load animation files referenced from '%s'\n", characterFile );
			return qfalse;
		}

#ifdef BONE_HITTESTS
		{
			char hitsfile[MAX_QPATH], *sep;
			// zinx - mdx hits
			Q_strncpyz(hitsfile, characterDef.animationGroup, sizeof(hitsfile) - 4);
			if ((sep = strrchr(hitsfile, '.'))) { // FIXME: should abort on /'s
				strcpy(sep, ".hit");
			} else {
				strcat(sep, ".hit");
			}
			mdx_RegisterHits( character->animModelInfo, hitsfile );
		}
#endif
	}

	return qtrue;
}