198 lines
6.4 KiB
C++
198 lines
6.4 KiB
C++
// **********************************************************************************
|
|
// * "makeanim.c" *
|
|
// * Written by : Mihaela Tancu *
|
|
// **********************************************************************************
|
|
|
|
#define MAKEANIM_C
|
|
|
|
// **********************************************************************************
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <math.h>
|
|
#include <string.h>
|
|
|
|
#include "afx.h"
|
|
#include "SCR.h"
|
|
|
|
#include "l_global_v6.h"
|
|
#include "makeanim.h"
|
|
|
|
#include "Print.h"
|
|
#include "Binary.h"
|
|
#include "Anims.h"
|
|
#include "Levels.h"
|
|
|
|
#include "stdafx.h"
|
|
|
|
#define D_FIL_StructureDefine
|
|
|
|
#include <io.h>
|
|
|
|
#include "LST.h"
|
|
#include "TMP.h"
|
|
#include "ERM.h"
|
|
|
|
#define C_MakeanimVersion "1.0"
|
|
|
|
#define NombreDanimationsParDirectory 1000
|
|
#define FAMILY_NAME_LENGTH 32
|
|
|
|
#define NO_PROBLEMO 0
|
|
#define ERR_WRONG_PARAMETERS 1
|
|
#define ERR_NO_CHL_FILE 2
|
|
#define ERR_NO_TBL_FILE 3
|
|
|
|
unsigned short uwNumOfBank= 1;
|
|
unsigned short uwNumOfAnim, uwAnalysedAnim;
|
|
tdFileName TabShortFileName[NombreDanimationsParDirectory];
|
|
char TabValidAnimations[NombreDanimationsParDirectory];
|
|
char LongActorName[600];
|
|
char LongChannelName[600];
|
|
char LongFileName[600];
|
|
char AnimationName[600];
|
|
|
|
char szFamilyName[FAMILY_NAME_LENGTH];
|
|
|
|
|
|
|
|
/*
|
|
=======================================================================================
|
|
Name: fn_vAnimationsOnly
|
|
Description: binarize animations using alw and lvl files
|
|
Author: Mihaela Tancu
|
|
=======================================================================================
|
|
*/
|
|
void fn_vAnimationsOnly(char *szLevel)
|
|
{
|
|
char szFile[256], szCurrentDir[_MAX_PATH], szAnimDir[_MAX_PATH], szAnimDest[_MAX_PATH] ;
|
|
int i;
|
|
|
|
strcpy(szSource, sSource);
|
|
sprintf(szFile, "%s\\World\\Levels\\%s\\%s.alw", szSource, szLevel, szLevel);
|
|
MLT_vLoadALWFileInLib(szFile);
|
|
for(i=0; i<g_lAlwaysIndex; i++)
|
|
{ GetCurrentDirectory(_MAX_PATH, szCurrentDir);
|
|
SetCurrentDirectory(sInitialDir);
|
|
fn_cExecuteMakeanim("Makeanim.exe", bBatch, bAll, bTbl, g_hAlwaysInFile[i]->sLinkCharacter);
|
|
if (bAll)
|
|
{ strcpy(szAnimDir, sInitialDir);
|
|
strcat(szAnimDir, "\\gamedata\\world\\graphics\\anims\\");
|
|
strcat(szAnimDir, g_hAlwaysInFile[i]->sLinkCharacter);
|
|
strcpy(szAnimDest, szDestBinDir);
|
|
strcat(szAnimDest, "\\world\\graphics\\anims\\");
|
|
strcat(szAnimDest, g_hAlwaysInFile[i]->sLinkCharacter);
|
|
SAVE_fn_bCopyDirectory(szAnimDir, szAnimDest, TRUE, "A3I");
|
|
}
|
|
if (bTbl)
|
|
{
|
|
strcpy(szAnimDir, sInitialDir);
|
|
strcat(szAnimDir, "\\gamedata\\world\\levels\\_common\\families\\");
|
|
strcat(szAnimDir, g_hAlwaysInFile[i]->sLinkCharacter);
|
|
strcpy(szAnimDest, szDestBinDir);
|
|
strcat(szAnimDest, "\\world\\levels\\_common\\families\\");
|
|
strcat(szAnimDest, g_hAlwaysInFile[i]->sLinkCharacter);
|
|
SAVE_fn_bCopyDirectory(szAnimDir, szAnimDest, TRUE, "TBL");
|
|
}
|
|
|
|
SetCurrentDirectory(szCurrentDir);
|
|
}
|
|
MLT_vEraseALWLib();
|
|
|
|
sprintf(szFile, "%s\\World\\Levels\\%s\\%s.lvl", szSource, szLevel, szLevel);
|
|
MLT_vLoadLVLFileInLib(szFile);
|
|
for(i=0; i<g_lInsertCharacterIndex; i++)
|
|
{ GetCurrentDirectory(_MAX_PATH, szCurrentDir);
|
|
SetCurrentDirectory(sInitialDir);
|
|
fn_cExecuteMakeanim("Makeanim.exe", bBatch, bAll, bTbl, g_hInsertCharacterInFile[i]->sLinkCharacter);
|
|
if (bAll)
|
|
{ strcpy(szAnimDir, sInitialDir);
|
|
strcat(szAnimDir, "\\gamedata\\world\\graphics\\anims\\");
|
|
strcat(szAnimDir, g_hInsertCharacterInFile[i]->sLinkCharacter);
|
|
strcpy(szAnimDest, szDestBinDir);
|
|
strcat(szAnimDest, "\\world\\graphics\\anims\\");
|
|
strcat(szAnimDest, g_hInsertCharacterInFile[i]->sLinkCharacter);
|
|
SAVE_fn_bCopyDirectory(szAnimDir, szAnimDest, TRUE, "A3I");
|
|
}
|
|
if (bTbl)
|
|
{
|
|
strcpy(szAnimDir, sInitialDir);
|
|
strcat(szAnimDir, "\\gamedata\\world\\levels\\_common\\families\\");
|
|
strcat(szAnimDir, g_hInsertCharacterInFile[i]->sLinkCharacter);
|
|
strcpy(szAnimDest, szDestBinDir);
|
|
strcat(szAnimDest, "\\world\\levels\\_common\\families\\");
|
|
strcat(szAnimDest, g_hInsertCharacterInFile[i]->sLinkCharacter);
|
|
SAVE_fn_bCopyDirectory(szAnimDir, szAnimDest, TRUE, "TBL");
|
|
}
|
|
|
|
SetCurrentDirectory(szCurrentDir);
|
|
}
|
|
MLT_vEraseLVLLib();
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
=======================================================================================
|
|
Name: fn_vTextures
|
|
Description: binarize textures files using lvl and alw files, and .tex files
|
|
Author: Mihaela Tancu
|
|
=======================================================================================
|
|
*/
|
|
void fn_vTextures(char *szLevel)
|
|
{
|
|
char szFile[256], szCurrentDir[_MAX_PATH];
|
|
int i, j;
|
|
|
|
MLT_vInitALWLoad();
|
|
|
|
sprintf(szFile, "%s\\World\\Levels\\%s\\%s.alw", sSource, szLevel, szLevel);
|
|
MLT_vLoadALWFileInLib(szFile);
|
|
for(i=0; i<g_lAlwaysIndex; i++)
|
|
{ sprintf(szFile, "%s\\World\\Graphics\\Objects\\Banks\\%s\\%s.tex", sSource, g_hAlwaysInFile[i]->sLinkCharacter, g_hAlwaysInFile[i]->sLinkCharacter);
|
|
MLT_vInitTEXLoad();
|
|
MLT_vLoadTEXFileInLib(szFile);
|
|
for(j=0; j<g_lTexturesIndex; j++)
|
|
{ GetCurrentDirectory(_MAX_PATH, szCurrentDir);
|
|
SetCurrentDirectory(sInitialDir);
|
|
fn_cExecuteConvImg("ConvImg.exe", sSource, szDestBinDir, bBMP, bTGA, bConvert16, bConvert32, g_hTexturesInFile[j]->sLoadTexture);
|
|
SetCurrentDirectory(szCurrentDir);
|
|
}
|
|
MLT_vEraseTEXLib();
|
|
}
|
|
MLT_vEraseALWLib();
|
|
|
|
MLT_vInitLVLLoad();
|
|
|
|
sprintf(szFile, "%s\\World\\Levels\\%s\\%s.lvl", sSource, szLevel, szLevel);
|
|
MLT_vLoadLVLFileInLib(szFile);
|
|
for(i=0; i<g_lInsertCharacterIndex; i++)
|
|
{ sprintf(szFile, "%s\\World\\Graphics\\Objects\\Banks\\%s\\%s.tex", sSource, g_hInsertCharacterInFile[i]->sLinkCharacter, g_hInsertCharacterInFile[i]->sLinkCharacter);
|
|
MLT_vInitTEXLoad();
|
|
MLT_vLoadTEXFileInLib(szFile);
|
|
for(j=0; j<g_lTexturesIndex; j++)
|
|
{ GetCurrentDirectory(_MAX_PATH, szCurrentDir);
|
|
SetCurrentDirectory(sInitialDir);
|
|
fn_cExecuteConvImg("ConvImg.exe", sSource, szDestBinDir, bBMP, bTGA, bConvert16, bConvert32, g_hTexturesInFile[j]->sLoadTexture);
|
|
SetCurrentDirectory(szCurrentDir);
|
|
}
|
|
MLT_vEraseTEXLib();
|
|
}
|
|
|
|
MLT_vEraseLVLLib();
|
|
|
|
sprintf(szFile, "%s\\World\\Levels\\%s\\%s.tex", sSource, szLevel, szLevel);
|
|
MLT_vInitTEXLoad();
|
|
MLT_vLoadTEXFileInLib(szFile);
|
|
for(j=0; j<g_lTexturesIndex; j++)
|
|
{ GetCurrentDirectory(_MAX_PATH, szCurrentDir);
|
|
SetCurrentDirectory(sInitialDir);
|
|
fn_cExecuteConvImg("ConvImg.exe", sSource, szDestBinDir, bBMP, bTGA, bConvert16, bConvert32, g_hTexturesInFile[j]->sLoadTexture);
|
|
SetCurrentDirectory(szCurrentDir);
|
|
}
|
|
MLT_vEraseTEXLib();
|
|
|
|
}
|
|
|
|
// **********************************************************************************
|
|
#undef MAKEANIM_C
|