2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-12-27 11:16:43 +01:00

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

This commit is contained in:
Andrey Akhmichin 2023-10-15 03:52:11 +05:00 committed by Alibek Omarov
parent 64c5d141af
commit 487a652aa8
2 changed files with 26 additions and 1 deletions

View File

@ -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 )
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 )
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 );

View File

@ -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 );