Browse Source

utils: mdldec: qc.c: calculate sequence group size.

pull/2/head
Andrey Akhmichin 9 months ago committed by Alibek Omarov
parent
commit
487a652aa8
  1. 26
      utils/mdldec/qc.c
  2. 1
      utils/mdldec/qc.h

26
utils/mdldec/qc.c

@ -15,6 +15,7 @@ GNU General Public License for more details. @@ -15,6 +15,7 @@ GNU General Public License for more details.
#include <stdlib.h>
#include <string.h>
#include "xash3d_mathlib.h"
#include "eiface.h"
#include "studio.h"
#include "crtlib.h"
@ -435,6 +436,29 @@ static void WriteHitBoxInfo( FILE *fp ) @@ -435,6 +436,29 @@ static void WriteHitBoxInfo( FILE *fp )
fputs( "\n", fp );
}
/*
============
CalcSequenceGroupSize
============
*/
static int CalcSequenceGroupSize( void )
{
int i, maxsize = 0, groupsize = DEFAULT_SEQGROUPSIZE;
for( i = 1; i < model_hdr->numseqgroups; i++ )
maxsize = Q_max( anim_hdr[i]->length, maxsize );
if( maxsize > 0 )
{
groupsize = maxsize / 1024;
if( maxsize % 1024 )
groupsize++;
}
return groupsize;
}
/*
============
WriteSequenceInfo
@ -449,7 +473,7 @@ static void WriteSequenceInfo( FILE *fp ) @@ -449,7 +473,7 @@ static void WriteSequenceInfo( FILE *fp )
mstudioseqdesc_t *seqdesc;
if( model_hdr->numseqgroups > 1 )
fputs( "$sequencegroupsize 64\n\n", fp );
fprintf( fp, "$sequencegroupsize %d\n\n", CalcSequenceGroupSize( ) );
if( model_hdr->numseq > 0 )
fprintf( fp, "// %i animation sequence(s)\n", model_hdr->numseq );

1
utils/mdldec/qc.h

@ -16,6 +16,7 @@ GNU General Public License for more details. @@ -16,6 +16,7 @@ GNU General Public License for more details.
#ifndef QC_H
#define QC_H
#define DEFAULT_SEQGROUPSIZE 64
#define ACTIVITIES_FILE "activities.txt"
qboolean LoadActivityList( const char *appname );

Loading…
Cancel
Save