utils: mdldec: use separate options for sequences and textures.

This commit is contained in:
Andrey Akhmichin
2025-04-07 01:27:25 +05:00
committed by Alibek Omarov
parent 9054b11ebd
commit 54657c149b
7 changed files with 25 additions and 22 deletions

View File

@@ -526,30 +526,32 @@ ShowHelp
*/
static void ShowHelp( const char *app_name )
{
LogPrintf( "usage: %s [-dhlmuVv] <source_file>", app_name );
LogPrintf( " %s [-dhlmuVv] <source_file> <target_directory>", app_name );
LogPutS( "\nnote:");
LogPutS( "\tby default this decompiler aimed to support extended MDL10 format from XashXT/PrimeXT/Paranoia2.");
LogPutS( "\tif you use an old GoldSource studio model compiler you may be need to edit .qc-file after decompilation.");
LogPutS( "\noptions:");
LogPutS( "\t-d\tplace smd and texture files to separate directories." );
LogPrintf( "usage: %s [-ahlmtuVv] <source_file>", app_name );
LogPrintf( " %s [-ahlmtuVv] <source_file> <target_directory>", app_name );
LogPutS( "\nnote:" );
LogPutS( "\tby default this decompiler aimed to support extended MDL10 format from XashXT/PrimeXT/Paranoia2." );
LogPutS( "\tif you use an old GoldSource studio model compiler you may be need to edit .qc-file after decompilation." );
LogPutS( "\noptions:" );
LogPutS( "\t-a\tplace files with animations to separate directory." );
LogPutS( "\t-l\tdo not output logs." );
LogPutS( "\t-m\tuse only GoldSource-compatible motion types and ignore deprecated motion types with \"A\" prefix." );
LogPutS( "\t-u\tenable UV coords shifting for DoomMusic's and Sven-Coop's studio model compilers.");
LogPutS( "\t-V\tignore some validation checks for broken models.");
LogPutS( "\t-l\tdo not output logs.");
LogPutS( "\t-v\tshow version.");
LogPutS( "\t-h\tthis message.");
LogPutS( "\t-t\tplace texture files to separate directory." );
LogPutS( "\t-u\tenable UV coords shifting for DoomMusic's and Sven-Coop's studio model compilers." );
LogPutS( "\t-V\tignore some validation checks for broken models." );
LogPutS( "\t-v\tshow version." );
LogPutS( "\t-h\tthis message." );
}
int main( int argc, char *argv[] )
{
int opt, ret = 0 ;
while( ( opt = getopt( argc, argv, "dhlmuVv" )) != -1 )
while( ( opt = getopt( argc, argv, "ahlmtuVv" )) != -1 )
{
switch( opt )
{
case 'd': globalsettings |= SETTINGS_SEPARATERESOURCES; break;
case 'a': globalsettings |= SETTINGS_SEPARATEANIMSFOLDER; break;
case 't': globalsettings |= SETTINGS_SEPARATETEXTURESFOLDER; break;
case 'l': globalsettings |= SETTINGS_NOLOGS; break;
case 'm': globalsettings |= SETTINGS_LEGACYMOTION; break;
case 'u': globalsettings |= SETTINGS_UVSHIFTING; break;

View File

@@ -481,7 +481,7 @@ static void WriteSequenceInfo( FILE *fp )
seqdesc = (mstudioseqdesc_t *)( (byte *)model_hdr + model_hdr->seqindex );
seq_path = ( globalsettings & SETTINGS_SEPARATERESOURCES ) ? DEFAULT_SEQUENCEPATH : "";
seq_path = ( globalsettings & SETTINGS_SEPARATEANIMSFOLDER ) ? SEQUENCEPATH : "";
for( i = 0; i < model_hdr->numseq; ++i, ++seqdesc )
{
@@ -607,8 +607,8 @@ void WriteQCScript( void )
fprintf( fp, "$modelname \"%s.mdl\"\n", modelfile );
fputs( "$cd \".\"\n", fp );
if( globalsettings & SETTINGS_SEPARATERESOURCES )
fputs( "$cdtexture \"./" DEFAULT_TEXTUREPATH "\"\n", fp );
if( globalsettings & SETTINGS_SEPARATETEXTURESFOLDER )
fputs( "$cdtexture \"./" TEXTUREPATH "\"\n", fp );
else fputs( "$cdtexture \"./\"\n", fp );
fputs( "$cliptotextures\n", fp );
fputs( "$scale 1.0\n", fp );

View File

@@ -10,7 +10,8 @@ enum
SETTINGS_UVSHIFTING = BIT(1),
SETTINGS_NOLOGS = BIT(2),
SETTINGS_NOVALIDATION = BIT(3),
SETTINGS_SEPARATERESOURCES = BIT(4),
SETTINGS_SEPARATEANIMSFOLDER = BIT(4),
SETTINGS_SEPARATETEXTURESFOLDER = BIT(5),
};
#endif // SETTINGS_H

View File

@@ -591,7 +591,7 @@ static void WriteSequences( void )
char path[MAX_SYSPATH];
mstudioseqdesc_t *seqdesc = (mstudioseqdesc_t *)( (byte *)model_hdr + model_hdr->seqindex );
len = Q_snprintf( path, MAX_SYSPATH, ( globalsettings & SETTINGS_SEPARATERESOURCES ) ? "%s" DEFAULT_SEQUENCEPATH : "%s", destdir );
len = Q_snprintf( path, MAX_SYSPATH, ( globalsettings & SETTINGS_SEPARATEANIMSFOLDER ) ? "%s" SEQUENCEPATH : "%s", destdir );
if( len == -1 || !MakeDirectory( path ))
{

View File

@@ -16,7 +16,7 @@ GNU General Public License for more details.
#ifndef SMD_H
#define SMD_H
#define DEFAULT_SEQUENCEPATH "anims/"
#define SEQUENCEPATH "anims/"
void WriteSMD( void );

View File

@@ -137,7 +137,7 @@ void WriteTextures( void )
mstudiotexture_t *texture = (mstudiotexture_t *)( (byte *)texture_hdr + texture_hdr->textureindex );
char path[MAX_SYSPATH];
len = Q_snprintf( path, MAX_SYSPATH, ( globalsettings & SETTINGS_SEPARATERESOURCES ) ? "%s" DEFAULT_TEXTUREPATH : "%s", destdir );
len = Q_snprintf( path, MAX_SYSPATH, ( globalsettings & SETTINGS_SEPARATETEXTURESFOLDER ) ? "%s" TEXTUREPATH : "%s", destdir );
if( len == -1 || !MakeDirectory( path ))
{

View File

@@ -16,7 +16,7 @@ GNU General Public License for more details.
#ifndef TEXTURE_H
#define TEXTURE_H
#define DEFAULT_TEXTUREPATH "textures/"
#define TEXTUREPATH "textures/"
void WriteTextures( void );