====================== G_ParseAnimationFile Read a configuration file containing animation coutns and rates models/players/visor/animation.cfg, etc ====================== */
| 877 | ====================== |
| 878 | */ |
| 879 | qboolean G_ParseAnimationFile(int glaIndex, const char *skeletonName, int fileIndex) |
| 880 | { |
| 881 | char text[80000]; |
| 882 | int len = 0; |
| 883 | const char *token = 0; |
| 884 | float fps = 0; |
| 885 | const char* text_p = text; |
| 886 | int animNum = 0; |
| 887 | animation_t* animations = level.knownAnimFileSets[fileIndex].animations; |
| 888 | char skeletonPath[MAX_QPATH]; |
| 889 | |
| 890 | |
| 891 | // Read In The File To The Text Buffer, Make Sure Everything Is Safe To Continue |
| 892 | //------------------------------------------------------------------------------- |
| 893 | Com_sprintf(skeletonPath, MAX_QPATH, "models/players/%s/%s.cfg", skeletonName, skeletonName); |
| 894 | len = gi.RE_GetAnimationCFG(skeletonPath, text, sizeof(text)); |
| 895 | if ( len <= 0 ) |
| 896 | { |
| 897 | Com_sprintf(skeletonPath, MAX_QPATH, "models/players/%s/animation.cfg", skeletonName); |
| 898 | len = gi.RE_GetAnimationCFG(skeletonPath, text, sizeof(text)); |
| 899 | if ( len <= 0 ) |
| 900 | { |
| 901 | return qfalse; |
| 902 | } |
| 903 | } |
| 904 | if ( len >= (int)(sizeof( text ) - 1) ) |
| 905 | { |
| 906 | G_Error( "G_ParseAnimationFile: File %s too long\n (%d > %d)", skeletonName, len, sizeof( text ) - 1); |
| 907 | return qfalse; |
| 908 | } |
| 909 | |
| 910 | |
| 911 | |
| 912 | // Read In Each Token |
| 913 | //-------------------- |
| 914 | COM_BeginParseSession(); |
| 915 | while(1) |
| 916 | { |
| 917 | token = COM_Parse( &text_p ); |
| 918 | |
| 919 | // If No Token, We've Reached The End Of The File |
| 920 | //------------------------------------------------ |
| 921 | if ( !token || !token[0]) |
| 922 | { |
| 923 | break; |
| 924 | } |
| 925 | |
| 926 | // Get The Anim Number Converted From The First Token |
| 927 | //---------------------------------------------------- |
| 928 | animNum = GetIDForString(animTable, token); |
| 929 | if(animNum == -1) |
| 930 | { |
| 931 | #ifndef FINAL_BUILD |
| 932 | if (strcmp(token,"ROOT")) |
| 933 | { |
| 934 | Com_Printf(S_COLOR_RED"WARNING: Unknown token %s in %s\n", token, skeletonPath); |
| 935 | } |
| 936 | #endif |
no test coverage detected