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

Function ParseAnimationEvtBlock

code/game/NPC_stats.cpp:416–777  ·  view source on GitHub ↗

====================== ParseAnimationEvtBlock ====================== */

Source from the content-addressed store, hash-verified

414======================
415*/
416static void ParseAnimationEvtBlock(int glaIndex, unsigned short modelIndex, const char* aeb_filename, animevent_t *animEvents, animation_t *animations, unsigned char &lastAnimEvent, const char **text_p, bool bIsFrameSkipped)
417{
418 const char *token;
419 int num, n, animNum, keyFrame, lowestVal, highestVal, curAnimEvent = 0;
420 animEventType_t eventType;
421 char stringData[MAX_QPATH];
422
423 // get past starting bracket
424 while(1)
425 {
426 token = COM_Parse( text_p );
427 if ( !Q_stricmp( token, "{" ) )
428 {
429 break;
430 }
431 }
432
433 //NOTE: instead of a blind increment, increase the index
434 // this way if we have an event on an anim that already
435 // has an event of that type, it stomps it
436
437 // read information for each frame
438 while ( 1 )
439 {
440 // Get base frame of sequence
441 token = COM_Parse( text_p );
442 if ( !token || !token[0])
443 {
444 break;
445 }
446
447 if ( !Q_stricmp( token, "}" ) ) // At end of block
448 {
449 break;
450 }
451
452 //Compare to same table as animations used
453 // so we don't have to use actual numbers for animation first frames,
454 // just need offsets.
455 //This way when animation numbers change, this table won't have to be updated,
456 // at least not much.
457 animNum = GetIDForString(animTable, token);
458 if(animNum == -1)
459 {//Unrecognized ANIM ENUM name,
460 Com_Printf(S_COLOR_YELLOW"WARNING: Unknown ANIM %s in file %s\n", token, aeb_filename );
461 //skip this entry
462 SkipRestOfLine( text_p );
463 continue;
464 }
465
466 if ( animations[animNum].numFrames == 0 )
467 {//we don't use this anim
468#ifndef FINAL_BUILD
469 Com_Printf(S_COLOR_YELLOW"WARNING: %s: anim %s not used by this model\n", aeb_filename, token);
470#endif
471 //skip this entry
472 SkipRestOfLine( text_p );
473 continue;

Callers 1

G_ParseAnimationEvtFileFunction · 0.70

Calls 12

Q_stricmpFunction · 0.85
Q_stricmpnFunction · 0.85
Com_PrintfFunction · 0.70
G_SoundIndexFunction · 0.70
G_NewStringFunction · 0.70
G_EffectIndexFunction · 0.70
COM_ParseFunction · 0.50
GetIDForStringFunction · 0.50
SkipRestOfLineFunction · 0.50
GetStringForIDFunction · 0.50
vaFunction · 0.50

Tested by

no test coverage detected