MCPcopy Create free account
hub / github.com/JACoders/OpenJK / G_ParseAnimFileSet

Function G_ParseAnimFileSet

code/game/NPC_stats.cpp:1040–1197  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////// G_ParseAnimFileSet This function is responsible for building the animation file and the animation event file. ///////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

1038//
1039////////////////////////////////////////////////////////////////////////
1040int G_ParseAnimFileSet(const char *skeletonName, const char *modelName=0)
1041{
1042 int fileIndex=0;
1043
1044
1045 // Try To Find An Existing Skeleton File For This Animation Set
1046 //--------------------------------------------------------------
1047 for (fileIndex=0; fileIndex<level.numKnownAnimFileSets; fileIndex++)
1048 {
1049 if (Q_stricmp(level.knownAnimFileSets[fileIndex].filename, skeletonName)==0)
1050 {
1051 break;
1052 }
1053 }
1054
1055 // Ok, We Don't Already Have One, So Time To Create A New One And Initialize It
1056 //------------------------------------------------------------------------------
1057 if (fileIndex>=level.numKnownAnimFileSets)
1058 {
1059 if (level.numKnownAnimFileSets==MAX_ANIM_FILES)
1060 {
1061 G_Error( "G_ParseAnimFileSet: MAX_ANIM_FILES" );
1062 return -1;
1063 }
1064
1065 // Allocate A new File Set, And Get Some Shortcut Pointers
1066 //---------------------------------------------------------
1067 fileIndex = level.numKnownAnimFileSets;
1068 level.numKnownAnimFileSets++;
1069 strcpy(level.knownAnimFileSets[fileIndex].filename, skeletonName);
1070
1071 level.knownAnimFileSets[fileIndex].torsoAnimEventCount = 0;
1072 level.knownAnimFileSets[fileIndex].legsAnimEventCount = 0;
1073
1074 animation_t* animations = level.knownAnimFileSets[fileIndex].animations;
1075 animevent_t* legsAnimEvents = level.knownAnimFileSets[fileIndex].legsAnimEvents;
1076 animevent_t* torsoAnimEvents = level.knownAnimFileSets[fileIndex].torsoAnimEvents;
1077
1078 int i, j;
1079
1080 // Initialize The Frames Information
1081 //-----------------------------------
1082 for(i=0; i<MAX_ANIMATIONS; i++)
1083 {
1084 animations[i].firstFrame = 0;
1085 animations[i].numFrames = 0;
1086 animations[i].loopFrames = -1;
1087 animations[i].frameLerp = 100;
1088// animations[i].initialLerp = 100;
1089 animations[i].glaIndex = 0;
1090 }
1091
1092 // Initialize Animation Event Array
1093 //----------------------------------
1094 for(i=0; i<MAX_ANIM_EVENTS; i++)
1095 {
1096 torsoAnimEvents[i].eventType = AEV_NONE; //Type of event
1097 legsAnimEvents[i].eventType = AEV_NONE;

Callers 6

SP_misc_model_ghoulFunction · 0.70
G_LoadAnimFileSetFunction · 0.70
NPC_PrecacheAnimationCFGFunction · 0.70
NPC_ParseParmsFunction · 0.70
NPC_InitGameFunction · 0.70

Calls 8

Q_stricmpFunction · 0.85
G_ParseAnimationEvtFileFunction · 0.85
G_ErrorFunction · 0.70
G_ParseAnimationFileFunction · 0.70
Com_ErrorFunction · 0.70
Com_sprintfFunction · 0.50
vaFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected