1406 lines
43 KiB
C++
1406 lines
43 KiB
C++
/*=========================================================================
|
|
*
|
|
* DlgMain2.cpp - implementation file for main window class
|
|
* Conversion functions
|
|
*
|
|
* Version 1.0
|
|
* Revision date
|
|
*
|
|
*=======================================================================*/
|
|
#include "stdafx.h"
|
|
|
|
#include "DlgMain.h"
|
|
|
|
#include "main.h"
|
|
#include "system.h"
|
|
#include "print.h"
|
|
|
|
#include "DlgWarning.h"
|
|
|
|
#include "IniData.h"
|
|
#include "SpoLoad.h"
|
|
|
|
#include "Anims.h"
|
|
#include "Banks.h"
|
|
#include "Classes.h"
|
|
#include "Families.h"
|
|
#include "Levels.h"
|
|
#include "Textures.h"
|
|
|
|
|
|
|
|
//--- Globals ---------------------------------------------------------------
|
|
|
|
int g_iResultIndex[100];
|
|
int g_iCommandIndex[1000];
|
|
|
|
|
|
//--- Global statics --------------------------------------------------------
|
|
|
|
char gs_szCom[20000];
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
/****************************************************************************
|
|
* Description: Convert the selected objects
|
|
*
|
|
* Parameters:
|
|
*---------------------------------------------------------------------------
|
|
* Revision date: Author:
|
|
*****************************************************************************/
|
|
void CDlgMain::m_fn_vConvertData()
|
|
{
|
|
int i;
|
|
int j=2, l=1;
|
|
char szCommand[20000];
|
|
FILE *fileW;
|
|
xString sRaw, sGame;
|
|
xString sDirectory, sGameDir;
|
|
xString sComment, sDate, sTime;
|
|
|
|
// init conversion flags
|
|
m_bConversion = TRUE;
|
|
|
|
// disable buttons during conversion
|
|
m_fn_TabC_vDisableAllButtons();
|
|
// activate result panel
|
|
m_fn_TabC_vShowControlsPanelRes() ;
|
|
m_oMainPanel.SetCurSel(2);
|
|
m_fn_TabC_vShowControlsPanelRes() ;
|
|
RedrawWindow(NULL,NULL, RDW_INVALIDATE |RDW_UPDATENOW );
|
|
|
|
// init all variables
|
|
MLT_vInitVariables();
|
|
|
|
// set default game directories
|
|
sprintf(g_sGameData,g_stInitialData.szGameData);
|
|
sprintf(g_sGameCommon,"%s", g_stInitialData.szGameData);
|
|
sprintf(g_sGameSpecific1,"%s", g_stInitialData.szGameSpecific1);
|
|
sprintf(g_sGameSpecific2,"%s", g_stInitialData.szGameSpecific2);
|
|
// set default raw directories
|
|
sprintf(g_sRawData, "%s", g_stInitialData.szRawData);
|
|
sprintf(g_sRawCommon,"%s", g_stInitialData.szRawData);
|
|
sprintf(g_sRawSpecific1,"%s", g_stInitialData.szRawSpecific1);
|
|
sprintf(g_sRawSpecific2,"%s", g_stInitialData.szRawSpecific2);
|
|
|
|
// empty the result windows
|
|
fn_ComRes_vDeleteLines( &m_oRichEditCom);
|
|
fn_ComRes_vDeleteLines( &m_oRichEditRes);
|
|
|
|
// init parameters
|
|
strcpy(gs_szCom, "");
|
|
for ( i=0; i<100; i++)
|
|
g_iResultIndex[i] = 0;
|
|
|
|
// update specific directories
|
|
if (g_iData==2)
|
|
MLT_vSetDataSpecific2();
|
|
if (g_iData==1)
|
|
MLT_vSetDataSpecific1();
|
|
|
|
// build the command line
|
|
m_fn_vBuildCommandLine(szCommand);
|
|
|
|
// chnage directory
|
|
GetCurrentDirectory(256, sDirectory);
|
|
switch (g_iData)
|
|
{
|
|
case 0:
|
|
strcpy(sGameDir, g_sGameCommon);
|
|
strcpy(sGame, g_stInitialData.szGameData);
|
|
break;
|
|
case 1:
|
|
strcpy(sGameDir, g_sGameSpecific1);
|
|
strcpy(sGame, g_stInitialData.szGameSpecific1);
|
|
break;
|
|
case 2:
|
|
strcpy(sGameDir, g_sGameSpecific2);
|
|
strcpy(sGame, g_stInitialData.szGameSpecific2);
|
|
break;
|
|
}
|
|
SetCurrentDirectory(sGameDir);
|
|
|
|
switch (g_iRaw)
|
|
{
|
|
case 0:
|
|
strcpy(sRaw, g_stInitialData.szRawData);
|
|
break;
|
|
case 1:
|
|
strcpy(sRaw, g_stInitialData.szRawSpecific1);
|
|
break;
|
|
case 2:
|
|
strcpy(sRaw, g_stInitialData.szRawSpecific2);
|
|
break;
|
|
}
|
|
|
|
// write the command line in the result file
|
|
if (!g_bFamilyMode || !m_bRun)
|
|
{
|
|
fileW = fopen("Win_M23D.log", "at+");
|
|
fputs("*****************************************************\n", fileW);
|
|
fputs("Conversion date : ", fileW);
|
|
_strtime(sTime);
|
|
_strdate(sDate);
|
|
sprintf(sComment, "%s %s\n", sDate, sTime);
|
|
fputs(sComment, fileW);
|
|
fputs("Conversion command : \n", fileW);
|
|
fputs(szCommand, fileW);
|
|
fputs("\n", fileW);
|
|
fputs("---------------------Result-------------------------\n", fileW);
|
|
fclose(fileW);
|
|
}
|
|
|
|
SetCurrentDirectory(sDirectory);
|
|
|
|
MLT_vSetData();
|
|
|
|
// init progress line
|
|
m_oProgress.SetRange( 0, m_iCountOfSelections+1 );
|
|
m_oProgress.SetPos( 1 );
|
|
|
|
|
|
// convert all types
|
|
m_fn_vConvertAnimations(sGameDir, sRaw, sGame, &j, &l);
|
|
m_fn_vConvertTextures(sGameDir, sRaw, sGame, &j, &l);
|
|
m_fn_vConvertBanks(sGameDir, sRaw, sGame, &j, &l);
|
|
m_fn_vConvertClasses(sGameDir, sRaw, sGame, &j, &l);
|
|
m_fn_vConvertFamilies(sGameDir, sRaw, sGame, &j, &l);
|
|
m_fn_vConvertLevels(sGameDir, sRaw, sGame, &j, &l);
|
|
|
|
// update dialog
|
|
m_fn_vEnableButtons(FALSE);
|
|
GetDlgItem(IDC_STATIC_PROGRESS)->ShowWindow(FALSE);
|
|
m_fn_TabC_vEnableButtons();
|
|
m_bConversion = FALSE;
|
|
RedrawWindow(NULL,NULL, RDW_INVALIDATE |RDW_UPDATENOW );
|
|
|
|
// reinit conversion parameters
|
|
m_iInd = 0;
|
|
m_nIndexLast = 0;
|
|
g_bApplyAll=FALSE;
|
|
|
|
//set also the objects from the second list box!!!
|
|
m_oMainPanel.SetCurSel(2);
|
|
m_fn_TabC_vShowControlsPanelRes() ;
|
|
RedrawWindow(NULL,NULL, RDW_INVALIDATE |RDW_UPDATENOW );
|
|
}
|
|
|
|
|
|
/****************************************************************************
|
|
* Description: init all the options from the command line and from INI file
|
|
*
|
|
* Parameters: szCommand : command line
|
|
*---------------------------------------------------------------------------
|
|
* Revision date: Author:
|
|
*****************************************************************************/
|
|
void CDlgMain::m_fn_vBuildCommandLine (char *szCommand)
|
|
{
|
|
int i;
|
|
|
|
//if the animations are selected
|
|
if (m_p_oTypeAnims && m_p_oTypeAnims->m_iSelected)
|
|
{
|
|
if(g_bOneAnimMode)
|
|
g_bOneAnimMode = (m_p_oTypeAnims->m_iSelected != m_p_oTypeAnims->m_oList.GetCount());
|
|
g_bAnimMode = TRUE;
|
|
for (i=0; i<m_p_oTypeAnims->m_oList.GetCount(); i++)
|
|
{
|
|
GI_Item * p_oItem = m_p_oTypeAnims->m_oList.RemoveHead();
|
|
if (p_oItem->m_bActived)
|
|
{
|
|
strcpy(g_sAnim[g_lAnimNum], p_oItem->m_fn_p_oGetName());
|
|
g_lAnimNum++;
|
|
strcat(gs_szCom, "##Animation ");
|
|
strcat(gs_szCom, g_sAnim[g_lAnimNum-1]);
|
|
strcat(gs_szCom, " \n");
|
|
}
|
|
m_p_oTypeAnims->m_oList.AddTail(p_oItem);
|
|
}
|
|
g_bOneAnimMode=TRUE;
|
|
}
|
|
|
|
//if the textures are selected
|
|
if (m_p_oTypeTextures && m_p_oTypeTextures->m_iSelected)
|
|
{
|
|
if(g_bOneTextureMode)
|
|
g_bOneTextureMode = (m_p_oTypeTextures->m_iSelected != m_p_oTypeTextures->m_oList.GetCount());
|
|
g_bTextureMode = TRUE;
|
|
for (i=0; i<m_p_oTypeTextures->m_oList.GetCount(); i++)
|
|
{
|
|
GI_Item * p_oItem = m_p_oTypeTextures->m_oList.RemoveHead();
|
|
if (p_oItem->m_bActived)
|
|
{
|
|
strcpy(g_sTexture[g_lTextureNum], p_oItem->m_fn_p_oGetName());
|
|
g_lTextureNum++;
|
|
strcat(gs_szCom, "##Texture ");
|
|
strcat(gs_szCom, g_sTexture[g_lTextureNum-1]);
|
|
strcat(gs_szCom, " \n");
|
|
}
|
|
m_p_oTypeTextures->m_oList.AddTail(p_oItem);
|
|
}
|
|
g_bOneTextureMode=TRUE;
|
|
}
|
|
|
|
//if the banks are selected
|
|
if (m_p_oTypeBanks && m_p_oTypeBanks->m_iSelected)
|
|
{
|
|
if(g_bOneBankMode)
|
|
g_bOneBankMode = (m_p_oTypeBanks->m_iSelected != m_p_oTypeBanks->m_oList.GetCount());
|
|
g_bBankMode = TRUE;
|
|
for (i=0; i<m_p_oTypeBanks->m_oList.GetCount(); i++)
|
|
{
|
|
GI_Item * p_oItem = m_p_oTypeBanks->m_oList.RemoveHead();
|
|
if (p_oItem->m_bActived)
|
|
{
|
|
strcpy(g_sBank[g_lBankNum], p_oItem->m_fn_p_oGetName());
|
|
g_lBankNum++;
|
|
strcat(gs_szCom, "##Bank ");
|
|
strcat(gs_szCom, g_sBank[g_lBankNum-1]);
|
|
strcat(gs_szCom, g_bIgnoreZoo ? " - Take Zones & Collisions from 3Dsmax" : " - Take Zones & Collisions from Editors");
|
|
strcat(gs_szCom, g_bIgnoreGmt ? " - Take Material Interactive Properties from 3Dsmax" : " - Take Material Interactive Properties from Editors");
|
|
strcat(gs_szCom, g_bIgnoreTex ? " - Take Material Visual Properties from 3Dsmax" : " - Take Material Visual Properties from Editors");
|
|
if (g_bCopyTextures)
|
|
strcat(gs_szCom, " - Copy Textures");
|
|
if (g_bGenerateRLI)
|
|
strcat(gs_szCom, " - Generate Blend RLI");
|
|
if (g_bCreateBasicFamily)
|
|
strcat(gs_szCom, " - Create basic family");
|
|
strcat(gs_szCom, " \n");
|
|
}
|
|
m_p_oTypeBanks->m_oList.AddTail(p_oItem);
|
|
}
|
|
g_bOneBankMode=TRUE;
|
|
}
|
|
|
|
//if the classes are selected
|
|
if (m_p_oTypeClasses && m_p_oTypeClasses->m_iSelected)
|
|
{
|
|
if(g_bOneClassMode)
|
|
g_bOneClassMode = (m_p_oTypeClasses->m_iSelected != m_p_oTypeClasses->m_oList.GetCount());
|
|
g_bClassMode = TRUE;
|
|
for (i=0; i<m_p_oTypeClasses->m_oList.GetCount(); i++)
|
|
{
|
|
GI_Item * p_oItem = m_p_oTypeClasses->m_oList.RemoveHead();
|
|
if (p_oItem->m_bActived)
|
|
{
|
|
strcpy(g_sClass[g_lClassNum], p_oItem->m_fn_p_oGetName());
|
|
g_lClassNum++;
|
|
strcat(gs_szCom, "##Class ");
|
|
strcat(gs_szCom, g_sClass[g_lClassNum-1]);
|
|
strcat(gs_szCom, g_bIgnoreZoo ? " - Take Zones & Collisions from 3Dsmax" : " - Take Zones & Collisions from Editors");
|
|
strcat(gs_szCom, g_bIgnoreGmt ? " - Take Material Interactive Properties from 3Dsmax" : " - Take Material Interactive Properties from Editors");
|
|
strcat(gs_szCom, g_bIgnoreTex ? " - Take Material Visual Properties from 3Dsmax" : " - Take Material Visual Properties from Editors");
|
|
if (g_bCopyTextures)
|
|
strcat(gs_szCom, " - Copy Textures");
|
|
strcat(gs_szCom, " \n");
|
|
}
|
|
m_p_oTypeClasses->m_oList.AddTail(p_oItem);
|
|
}
|
|
g_bOneClassMode=TRUE;
|
|
}
|
|
|
|
//if the families are selected
|
|
if (m_p_oTypeFamilies && m_p_oTypeFamilies->m_iSelected)
|
|
{
|
|
if(g_bOneFamilyMode)
|
|
g_bOneFamilyMode = (m_p_oTypeFamilies->m_iSelected != m_p_oTypeFamilies->m_oList.GetCount());
|
|
g_bFamilyMode = TRUE;
|
|
for (i=0; i<m_p_oTypeFamilies->m_oList.GetCount(); i++)
|
|
{
|
|
GI_Item * p_oItem = m_p_oTypeFamilies->m_oList.RemoveHead();
|
|
if (p_oItem->m_bActived)
|
|
{
|
|
strcpy(g_sFamily[g_lFamilyNum], p_oItem->m_fn_p_oGetName());
|
|
g_lFamilyNum++;
|
|
strcat(gs_szCom, "##Family ");
|
|
strcat(gs_szCom, g_sFamily[g_lFamilyNum-1]);
|
|
strcat(gs_szCom, g_bIgnoreZoo ? " - Take Zones & Collisions from 3Dsmax" : " - Take Zones & Collisions from Editors");
|
|
if (g_bCopyAnims)
|
|
strcat(gs_szCom, " - Copy Anims");
|
|
strcat(gs_szCom, " \n");
|
|
}
|
|
m_p_oTypeFamilies->m_oList.AddTail(p_oItem);
|
|
}
|
|
g_bOneFamilyMode=TRUE;
|
|
}
|
|
|
|
//if the levels are selected
|
|
if (m_p_oTypeLevels && m_p_oTypeLevels->m_iSelected)
|
|
{
|
|
if(g_bOneLevelMode)
|
|
g_bOneLevelMode = (m_p_oTypeLevels->m_iSelected != m_p_oTypeLevels->m_oList.GetCount());
|
|
g_bLevelMode = TRUE;
|
|
for (i=0; i<m_p_oTypeLevels->m_oList.GetCount(); i++)
|
|
{
|
|
GI_Item * p_oItem = m_p_oTypeLevels->m_oList.RemoveHead();
|
|
if (p_oItem->m_bActived)
|
|
{
|
|
strcpy(g_sLevel[g_lLevelNum], p_oItem->m_fn_p_oGetName());
|
|
g_lLevelNum++;
|
|
strcat(gs_szCom, "##Level ");
|
|
strcat(gs_szCom, g_sLevel[g_lLevelNum-1]);
|
|
strcat(gs_szCom, g_bIgnoreZoo ? " - Take Zones & Collisions from 3Dsmax" : " - Take Zones & Collisions from Editors");
|
|
strcat(gs_szCom, g_bIgnoreSct ? " - Take Sectors Information from 3Dsmax" : " - Take Sectors Information from Editors");
|
|
strcat(gs_szCom, g_bIgnoreSpo ? " - Take SPO Flags from 3Dsmax" : " - Take SPO Flags from Editors");
|
|
strcat(gs_szCom, g_bIgnoreGmt ? " - Take Material Interactive Properties from 3Dsmax" : " - Take Material Interactive Properties from Editors");
|
|
strcat(gs_szCom, g_bIgnoreTex ? " - Take Material Visual Properties from 3Dsmax" : " - Take Material Visual Properties from Editors");
|
|
if (g_bCopyTextures)
|
|
strcat(gs_szCom, " - Copy Textures");
|
|
if (g_bGenerateRLI)
|
|
strcat(gs_szCom, " - Generate Blend RLI");
|
|
if (g_bUpdateGameDSC)
|
|
strcat(gs_szCom, " - Update level in game.dsc file");
|
|
if (g_bEraseDuplicated)
|
|
strcat(gs_szCom, " - Erase duplicated points");
|
|
if (g_bEraseUnused)
|
|
strcat(gs_szCom, " - Erase unused points");
|
|
strcat(gs_szCom, " \n");
|
|
}
|
|
m_p_oTypeLevels->m_oList.AddTail(p_oItem);
|
|
}
|
|
g_bOneLevelMode=TRUE;
|
|
}
|
|
|
|
// write the complete line
|
|
fn_vAfxOutputStringCom(gs_szCom, C_ComRes_cNormalLine);
|
|
//fn_ComRes_vWriteLine( gs_szCom, C_ComRes_cNormalLine ,&m_oRichEditCom, &m_stCharFormatCom);
|
|
strcat(szCommand, gs_szCom);
|
|
strcpy(gs_szCom, "");
|
|
|
|
}
|
|
|
|
/****************************************************************************
|
|
* Description: convert all selected animations
|
|
*
|
|
* Parameters: sGameDir : game directory
|
|
* sRaw : chosen raw directory
|
|
* sGame : chosen game directory
|
|
* j :
|
|
* l :
|
|
*---------------------------------------------------------------------------
|
|
* Revision date: Author:
|
|
*****************************************************************************/
|
|
void CDlgMain::m_fn_vConvertAnimations (char *sGameDir, char *sRaw, char *sGame, int *j, int *l)
|
|
{
|
|
xString sDirectory;
|
|
FILE *fileW;
|
|
int i;
|
|
|
|
// compute the anim if there is one
|
|
g_cCategoryType = C_Anim;
|
|
|
|
if(g_bAnimMode)
|
|
{ int k;
|
|
|
|
// update anims.txt
|
|
GetCurrentDirectory(256, sDirectory);
|
|
SetCurrentDirectory(sGameDir);
|
|
fileW = fopen("Anims.txt", "at+");
|
|
fputs("Conversion date :", fileW);
|
|
xString sComment, sDate, sTime;
|
|
_strtime(sTime);
|
|
_strdate(sDate);
|
|
sprintf(sComment, "%s %s\n", sDate, sTime);
|
|
fputs(sComment, fileW);
|
|
fclose (fileW);
|
|
SetCurrentDirectory(sDirectory);
|
|
|
|
// convert all animations
|
|
for (i=0; i<g_lAnimNum; i++)
|
|
{
|
|
// compute animation
|
|
MLT_vComputeOneAnim(g_sAnim[i], sRaw, sGame);
|
|
|
|
// update progress line
|
|
k=i+*j;
|
|
m_oProgress.SetPos( k );
|
|
g_iResultIndex[*l] = m_oRichEditRes.LineIndex(m_oRichEditRes.GetLineCount() -1);
|
|
(*l)++;
|
|
m_fn_vWriteInFile( FALSE);
|
|
// update anims.txt
|
|
GetCurrentDirectory(256, sDirectory);
|
|
SetCurrentDirectory(sGameDir);
|
|
fileW = fopen("Anims.txt", "at+");
|
|
fputs("Anim ", fileW);
|
|
fputs(g_sAnim[i], fileW);
|
|
fputs("\n", fileW);
|
|
fclose (fileW);
|
|
SetCurrentDirectory(sDirectory);
|
|
}
|
|
// update anims.txt
|
|
*j=*j+i;
|
|
GetCurrentDirectory(256, sDirectory);
|
|
SetCurrentDirectory(sGameDir);
|
|
fileW = fopen("Anims.txt", "at+");
|
|
fputs("*****************************************************\n", fileW);
|
|
fputs("\n", fileW);
|
|
fputs("\n", fileW);
|
|
fclose (fileW);
|
|
SetCurrentDirectory(sDirectory);
|
|
}
|
|
}
|
|
|
|
|
|
/****************************************************************************
|
|
* Description: convert all selected banks
|
|
*
|
|
* Parameters: sGameDir : game directory
|
|
* sRaw : chosen raw directory
|
|
* sGame : chosen game directory
|
|
* j :
|
|
* l :
|
|
*---------------------------------------------------------------------------
|
|
* Revision date: Author:
|
|
*****************************************************************************/
|
|
void CDlgMain::m_fn_vConvertBanks (char *sGameDir, char *sRaw, char *sGame, int *j, int *l)
|
|
{
|
|
xString sDirectory;
|
|
FILE *fileW;
|
|
int i;
|
|
|
|
// compute the Banks if there is one
|
|
g_cCategoryType = C_Bank;
|
|
|
|
if(g_bBankMode)
|
|
{ int k;
|
|
|
|
//multitextures
|
|
g_bBankConversion = TRUE;
|
|
|
|
// update Banks.txt
|
|
GetCurrentDirectory(256, sDirectory);
|
|
SetCurrentDirectory(sGameDir);
|
|
fileW = fopen("Banks.txt", "at+");
|
|
fputs("Conversion date :", fileW);
|
|
xString sComment, sDate, sTime;
|
|
_strtime(sTime);
|
|
_strdate(sDate);
|
|
sprintf(sComment, "%s %s\n", sDate, sTime);
|
|
fputs(sComment, fileW);
|
|
fclose (fileW);
|
|
SetCurrentDirectory(sDirectory);
|
|
|
|
for (i=0; i<g_lBankNum; i++)
|
|
{
|
|
MLT_vComputeOneBank(g_sBank[i], sRaw, sGame);
|
|
|
|
// update progress line
|
|
k=i+*j;
|
|
m_oProgress.SetPos( k );
|
|
g_iResultIndex[*l] = m_oRichEditRes.LineIndex(m_oRichEditRes.GetLineCount() -1);
|
|
(*l)++;
|
|
m_fn_vWriteInFile( FALSE);
|
|
// update Banks.txt
|
|
GetCurrentDirectory(256, sDirectory);
|
|
SetCurrentDirectory(sGameDir);
|
|
fileW = fopen("Banks.txt", "at+");
|
|
fputs("Bank ", fileW);
|
|
fputs(g_sBank[i], fileW);
|
|
fputs("\n", fileW);
|
|
fclose (fileW);
|
|
SetCurrentDirectory(sDirectory);
|
|
}
|
|
// update Banks.txt
|
|
*j=*j+i;
|
|
GetCurrentDirectory(256, sDirectory);
|
|
SetCurrentDirectory(sGameDir);
|
|
fileW = fopen("Banks.txt", "at+");
|
|
fputs("*****************************************************\n", fileW);
|
|
fputs("\n", fileW);
|
|
fputs("\n", fileW);
|
|
fclose (fileW);
|
|
SetCurrentDirectory(sDirectory);
|
|
//multitextures
|
|
g_bBankConversion = FALSE;
|
|
}
|
|
}
|
|
|
|
/****************************************************************************
|
|
* Description: convert all selected classes
|
|
*
|
|
* Parameters: sGameDir : game directory
|
|
* sRaw : chosen raw directory
|
|
* sGame : chosen game directory
|
|
* j :
|
|
* l :
|
|
*---------------------------------------------------------------------------
|
|
* Revision date: Author:
|
|
*****************************************************************************/
|
|
void CDlgMain::m_fn_vConvertClasses (char *sGameDir, char *sRaw, char *sGame, int *j, int *l)
|
|
{
|
|
xString sDirectory;
|
|
FILE *fileW;
|
|
int i;
|
|
|
|
// compute the Classes if there is one
|
|
g_cCategoryType = C_Classe;
|
|
|
|
if(g_bClassMode)
|
|
{ int k;
|
|
//multitextures
|
|
g_bClassConversion = TRUE;
|
|
|
|
// update Class.txt
|
|
GetCurrentDirectory(256, sDirectory);
|
|
SetCurrentDirectory(sGameDir);
|
|
fileW = fopen("Classes.txt", "at+");
|
|
fputs("Conversion date :", fileW);
|
|
xString sComment, sDate, sTime;
|
|
_strtime(sTime);
|
|
_strdate(sDate);
|
|
sprintf(sComment, "%s %s\n", sDate, sTime);
|
|
fputs(sComment, fileW);
|
|
fclose (fileW);
|
|
SetCurrentDirectory(sDirectory);
|
|
|
|
for(i=0; i<g_lClassNum; i++)
|
|
{
|
|
MLT_vComputeOneClass(g_sClass[i], sRaw, sGame);
|
|
|
|
// update progress line
|
|
k=i+*j;
|
|
m_oProgress.SetPos( k );
|
|
g_iResultIndex[*l] = m_oRichEditRes.LineIndex(m_oRichEditRes.GetLineCount() -1);
|
|
(*l)++;
|
|
m_fn_vWriteInFile(FALSE );
|
|
// update classes.txt
|
|
GetCurrentDirectory(256, sDirectory);
|
|
SetCurrentDirectory(sGameDir);
|
|
fileW = fopen("Classes.txt", "at+");
|
|
fputs("Class ", fileW);
|
|
fputs(g_sClass[i], fileW);
|
|
fputs("\n", fileW);
|
|
fclose (fileW);
|
|
SetCurrentDirectory(sDirectory);
|
|
}
|
|
*j=*j+i;
|
|
GetCurrentDirectory(256, sDirectory);
|
|
SetCurrentDirectory(sGameDir);
|
|
fileW = fopen("Classes.txt", "at+");
|
|
fputs("*****************************************************\n", fileW);
|
|
fputs("\n", fileW);
|
|
fputs("\n", fileW);
|
|
fclose (fileW);
|
|
SetCurrentDirectory(sDirectory);
|
|
//multitextures
|
|
g_bClassConversion = FALSE;
|
|
}
|
|
}
|
|
|
|
/****************************************************************************
|
|
* Description: convert all selected families
|
|
*
|
|
* Parameters: sGameDir : game directory
|
|
* sRaw : chosen raw directory
|
|
* sGame : chosen game directory
|
|
* j :
|
|
* l :
|
|
*---------------------------------------------------------------------------
|
|
* Revision date: Author:
|
|
*****************************************************************************/
|
|
void CDlgMain::m_fn_vConvertFamilies (char *sGameDir, char *sRaw, char *sGame, int *j, int *l)
|
|
{
|
|
xString sDirectory;
|
|
FILE *fileW;
|
|
BOOL bCommon[40];
|
|
BOOL bFirst=FALSE, bContinue[40] ;
|
|
char sFile1[40][_MAX_PATH];
|
|
int p, ii;
|
|
int i;
|
|
|
|
// init flags
|
|
for (i=0; i<40; i++)
|
|
{
|
|
bContinue[i] = TRUE;
|
|
bCommon[i] =FALSE;
|
|
}
|
|
|
|
|
|
// compute the Families if there is one
|
|
g_cCategoryType = C_Family;
|
|
|
|
if(g_bFamilyMode)
|
|
{ int k;
|
|
BOOL bOK = FALSE;
|
|
|
|
for(i = 0; i < g_lFamilyNum; i++)
|
|
{
|
|
k = i+*j;
|
|
|
|
switch (g_iData)
|
|
{
|
|
//the chosen directory is gamedata
|
|
case 0:
|
|
bFirst = FALSE;
|
|
p = 0;
|
|
// check if some specific files exist
|
|
for (ii = 0; ii < g_iNbFiles; ii++)
|
|
{
|
|
sprintf(sFile1[ii], "%s\\World\\Levels\\_Common\\Families\\%s\\%s.%s", g_sGameSpecific1, g_sFamily[i], g_sFamily[i], g_szFiles[ii]);
|
|
if (_access( sFile1[ii], 0) != -1)
|
|
p++;
|
|
sprintf(sFile1[ii+g_iNbFiles], "%s\\World\\Levels\\_Common\\Families\\%s\\%s.%s", g_sGameSpecific2, g_sFamily[i], g_sFamily[i], g_szFiles[ii]);
|
|
if (_access( sFile1[ii+g_iNbFiles], 0) != -1)
|
|
p++;
|
|
}
|
|
// exist at least one file in GameSpecific1 or in GameSpecific2 directories
|
|
if (p)
|
|
{
|
|
// for the automatic conversion, use only the "Force Common" option
|
|
if (!m_bRun)
|
|
m_fn_vPrepareCommonFamily((!strcmp(g_szForceCommon, "1")), sFile1, bContinue, i, k);
|
|
// for the normal conversion, check the "Ask Family" option
|
|
else
|
|
{
|
|
// if the user must answer, and has not already decided
|
|
if (g_bAskFamily && !g_bApplyAll)
|
|
{
|
|
// ask the user
|
|
CDlgWarning dlgWarning;
|
|
dlgWarning.m_fn_vBuildTextMessage(E_ForceCommon, g_sFamily[i]);
|
|
bOK = (dlgWarning.DoModal() == IDOK);
|
|
}
|
|
// otherwise use the "Force Common" option
|
|
else
|
|
bOK = g_bCommonFamily;
|
|
|
|
// prepare the conversion
|
|
m_fn_vPrepareCommonFamily(bOK, sFile1, bContinue, i, k);
|
|
}
|
|
}
|
|
// compute the family
|
|
if (bContinue[i])
|
|
MLT_vComputeOneFamily(g_sFamily[i], sRaw, sGame);
|
|
g_iSpecific1 = 0;
|
|
g_iSpecific2 = 0;
|
|
break;
|
|
|
|
//the chosen directory is gameSpecific1 or GameSpecific2
|
|
case 1:
|
|
case 2:
|
|
bCommon[i] = FALSE;
|
|
bFirst = TRUE;
|
|
p = 0;
|
|
|
|
// check if the gamedata directory contain specific files
|
|
for (ii = 0; ii < g_iNbFiles; ii++)
|
|
{
|
|
sprintf(sFile1[ii], "%s\\World\\Levels\\_Common\\Families\\%s\\%s.%s", g_sGameCommon, g_sFamily[i], g_sFamily[i], g_szFiles[ii]);
|
|
if (_access( sFile1[ii], 0) != -1)
|
|
p++;
|
|
}
|
|
// exist at least one file in Gamedata directory
|
|
if (p)
|
|
{
|
|
// for the automatic conversion, use only the "Force Specific" option
|
|
if (!m_bRun)
|
|
m_fn_vPrepareSpecificFamily((!strcmp(g_szForceSpecific, "1")), sFile1, bCommon, i);
|
|
// for the normal conversion, check the "Ask Family" option
|
|
else
|
|
{
|
|
// if the user must answer, and has not already decided
|
|
if (g_bAskFamily && !g_bApplyAll)
|
|
{
|
|
CDlgWarning dlgWarning;
|
|
dlgWarning.m_fn_vBuildTextMessage(E_ForceSpecific, g_sFamily[i]);
|
|
bOK = (dlgWarning.DoModal() == IDOK);
|
|
}
|
|
// otherwise use the "Force Specific" option
|
|
else
|
|
bOK = g_bSpecificFamily;
|
|
|
|
m_fn_vPrepareSpecificFamily(bOK, sFile1, bCommon, i);
|
|
}
|
|
}
|
|
// convert family
|
|
if (!bCommon[i])
|
|
MLT_vComputeOneFamily(g_sFamily[i], sRaw, sGame);
|
|
else
|
|
MLT_vComputeOneFamily(g_sFamily[i], sRaw, g_stInitialData.szGameData);
|
|
break;
|
|
}
|
|
// update progress bar
|
|
m_oProgress.SetPos( k );
|
|
int iCount = m_oRichEditRes.GetLineCount();
|
|
g_iResultIndex[*l] = m_oRichEditRes.LineIndex(m_oRichEditRes.GetLineCount() -1);
|
|
|
|
(*l)++;
|
|
}
|
|
*j = *j+i;
|
|
|
|
// update Families.txt
|
|
GetCurrentDirectory(256, sDirectory);
|
|
if (!bCommon[0])
|
|
SetCurrentDirectory(sGameDir);
|
|
else
|
|
SetCurrentDirectory(g_sGameCommon);
|
|
fileW = fopen("Families.txt", "at+");
|
|
fputs("Conversion date :", fileW);
|
|
xString sComment, sDate, sTime;
|
|
_strtime(sTime);
|
|
_strdate(sDate);
|
|
sprintf(sComment, "%s %s\n", sDate, sTime);
|
|
fputs(sComment, fileW);
|
|
for(ii = 0; ii < g_lFamilyNum; ii++)
|
|
{
|
|
fputs("Family ", fileW);
|
|
fputs(g_sFamily[ii], fileW);
|
|
if (!bContinue[ii])
|
|
fputs("---> Canceled", fileW);
|
|
fputs("\n", fileW);
|
|
}
|
|
fputs("*****************************************************\n", fileW);
|
|
fputs("\n", fileW);
|
|
fputs("\n", fileW);
|
|
fclose (fileW);
|
|
|
|
// update log file
|
|
fileW = fopen("Win_M23D.log", "at+");
|
|
fputs("*****************************************************\n", fileW);
|
|
fputs("Conversion date : \n", fileW);
|
|
_strtime(sTime);
|
|
_strdate(sDate);
|
|
sprintf(sComment, "%s %s\n", sDate, sTime);
|
|
fputs(sComment, fileW);
|
|
fputs("Conversion command : ", fileW);
|
|
|
|
strcpy(gs_szCom, "");
|
|
for(ii = 0; ii < g_lFamilyNum; ii++)
|
|
{
|
|
strcat(gs_szCom, "##Family ");
|
|
strcat(gs_szCom, g_sFamily[ii]);
|
|
strcat(gs_szCom, g_bIgnoreZoo ? " - Take Zones & Collisions from 3Dsmax" : " - Take Zones & Collisions from Editors");
|
|
if (g_bCopyAnims)
|
|
strcat(gs_szCom, " - Copy Anims");
|
|
strcat(gs_szCom, " \n");
|
|
}
|
|
fputs(gs_szCom, fileW);
|
|
|
|
fputs("\n", fileW);
|
|
fputs("---------------------Result-------------------------\n", fileW);
|
|
//the command was wrote in the file Win_M23D.log
|
|
fclose(fileW);
|
|
m_fn_vWriteInFile( bCommon[0] );
|
|
SetCurrentDirectory(sDirectory);
|
|
}
|
|
}
|
|
|
|
|
|
/****************************************************************************
|
|
* Description: convert all selected levels
|
|
*
|
|
* Parameters: sGameDir : game directory
|
|
* sRaw : chosen raw directory
|
|
* sGame : chosen game directory
|
|
* j :
|
|
* l :
|
|
*---------------------------------------------------------------------------
|
|
* Revision date: Author:
|
|
*****************************************************************************/
|
|
void CDlgMain::m_fn_vConvertLevels (char *sGameDir, char *sRaw, char *sGame, int *j, int *l)
|
|
{
|
|
xString sDirectory;
|
|
FILE *fileW;
|
|
int i;
|
|
|
|
// compute the Levels if there is one
|
|
g_cCategoryType = C_Level;
|
|
|
|
if (g_bLevelMode)
|
|
{ int k;
|
|
xString sGameLevel;
|
|
|
|
//multitextures
|
|
g_bLevelConversion = TRUE;
|
|
|
|
// read SPO flags
|
|
MLT_vReadSPOFlagsFile(g_stInitialData.szRawData);
|
|
|
|
// change directory
|
|
GetCurrentDirectory(256, sDirectory);
|
|
SetCurrentDirectory(sGameDir);
|
|
strcpy(sGameLevel, sGameDir);
|
|
// update Levels.txt
|
|
fileW = fopen("Levels.txt", "at+");
|
|
fputs("Conversion date :", fileW);
|
|
xString sComment, sDate, sTime;
|
|
_strtime(sTime);
|
|
_strdate(sDate);
|
|
sprintf(sComment, "%s %s\n", sDate, sTime);
|
|
fputs(sComment, fileW);
|
|
fclose (fileW);
|
|
SetCurrentDirectory(sDirectory);
|
|
|
|
// update DSC file
|
|
m_fn_vUpdateGameDSC();
|
|
|
|
for (i=0; i<g_lLevelNum; i++)
|
|
{
|
|
xString sFileSub, sFileSct, sTemp, sOption;
|
|
char *p_cChar;
|
|
BOOL bSubFound, bSctFound;
|
|
BOOL bOK = TRUE;
|
|
|
|
GetPrivateProfileString("SubmapOptions", "CheckFiles", "TRUE", sOption, 100, g_szIniFile);
|
|
if (strcmp(sOption, "FALSE"))
|
|
{
|
|
|
|
// check for SUB file
|
|
sprintf(sFileSct, "%s\\World\\Levels\\%s\\%s_Submap.sct", sGameLevel, g_sLevel[i], g_sLevel[i]);
|
|
sprintf(sFileSub, "%s\\World\\Levels\\%s\\%s.sub", sGameLevel, g_sLevel[i], g_sLevel[i]);
|
|
bSubFound = (SearchPath(NULL,sFileSub,NULL,256,sTemp,&p_cChar) != 0);
|
|
bSctFound = (SearchPath(NULL,sFileSct,NULL,256,sTemp,&p_cChar) != 0);
|
|
|
|
|
|
if (bSubFound && !bSctFound)
|
|
{
|
|
xString sMessage;
|
|
strcpy(sMessage, "Your level is using the submap architecture but the _Submap.SCT file is missing. \n");
|
|
strcat(sMessage, "\n");
|
|
strcat(sMessage, "If you want to have different sector links in the global map and in the submaps, you probably forgot to \n");
|
|
strcat(sMessage, "rename the submap SCT file and to restore the normal SCT file. In this case, if you convert this level \n");
|
|
strcat(sMessage, "without renaming the SCT files, ALL THE SUBMAP SECTOR LINKS MAY BE LOST. \n");
|
|
strcat(sMessage, "\n");
|
|
strcat(sMessage, "If you want to keep the same sector links in the global map and in the submaps, then you must keep the \n");
|
|
strcat(sMessage, "SUB file only if there are SOUND ENTRIES in it.\n");
|
|
strcat(sMessage, "\n");
|
|
strcat(sMessage, "Do you want to check this point for the next conversions ?\n");
|
|
strcat(sMessage, "\n");
|
|
strcat(sMessage, "- If you choose 'YES', the conversion will continue and this test will be kept \n");
|
|
strcat(sMessage, "- If you choose 'NO', the conversion will continue and this test will no more be done \n");
|
|
strcat(sMessage, "- If you choose 'Cancel', the conversion will be canceled to let you correct your files \n");
|
|
|
|
int iRes = AfxMessageBox(sMessage, MB_YESNOCANCEL | MB_ICONEXCLAMATION);
|
|
|
|
if (iRes == IDCANCEL)
|
|
{
|
|
MLT_vOutput( C_ComRes_cErrorLine, "\nConversion of level %s was canceled", g_sLevel[i]);
|
|
bOK = FALSE;
|
|
}
|
|
if (iRes == IDNO)
|
|
{
|
|
WritePrivateProfileString("SubmapOptions", "CheckFiles", "FALSE", g_szIniFile);
|
|
}
|
|
}
|
|
}
|
|
|
|
// convert the level
|
|
if (bOK)
|
|
MLT_vComputeOneLevel(g_sLevel[i], sRaw, sGame);
|
|
|
|
// update progress bar
|
|
k = i+*j;
|
|
m_oProgress.SetPos( k );
|
|
g_iResultIndex[*l] = m_oRichEditRes.LineIndex(m_oRichEditRes.GetLineCount() -1);
|
|
(*l)++;
|
|
m_fn_vWriteInFile(FALSE );
|
|
|
|
// update Levels.txt
|
|
GetCurrentDirectory(256, sDirectory);
|
|
SetCurrentDirectory(sGameDir);
|
|
if (bOK)
|
|
{
|
|
fileW = fopen("Levels.txt", "at+");
|
|
fputs("Level ", fileW);
|
|
fputs(g_sLevel[i], fileW);
|
|
fputs("\n", fileW);
|
|
fclose (fileW);
|
|
}
|
|
SetCurrentDirectory(sDirectory);
|
|
}
|
|
*j=*j+i;
|
|
GetCurrentDirectory(256, sDirectory);
|
|
SetCurrentDirectory(sGameDir);
|
|
fileW = fopen("Levels.txt", "at+");
|
|
fputs("*****************************************************\n", fileW);
|
|
fputs("\n", fileW);
|
|
fputs("\n", fileW);
|
|
fclose (fileW);
|
|
SetCurrentDirectory(sDirectory);
|
|
//multitextures
|
|
g_bLevelConversion = FALSE;
|
|
}
|
|
}
|
|
|
|
|
|
/****************************************************************************
|
|
* Description: convert all selected levels
|
|
*
|
|
* Parameters: sGameDir : game directory
|
|
* sRaw : chosen raw directory
|
|
* sGame : chosen game directory
|
|
* j :
|
|
* l :
|
|
*---------------------------------------------------------------------------
|
|
* Revision date: Author:
|
|
*****************************************************************************/
|
|
void CDlgMain::m_fn_vConvertTextures (char *sGameDir, char *sRaw, char *sGame, int *j, int *l)
|
|
{
|
|
xString sDirectory;
|
|
FILE *fileW;
|
|
int i;
|
|
|
|
// compute the Textures if there is one
|
|
g_cCategoryType = C_Texture;
|
|
|
|
if (g_bTextureMode)
|
|
{ int k;
|
|
|
|
// update Textures.txt
|
|
GetCurrentDirectory(256, sDirectory);
|
|
SetCurrentDirectory(sGameDir);
|
|
fileW = fopen("Textures.txt", "at+");
|
|
fputs("Conversion date :", fileW);
|
|
xString sComment, sDate, sTime;
|
|
_strtime(sTime);
|
|
_strdate(sDate);
|
|
sprintf(sComment, "%s %s\n", sDate, sTime);
|
|
fputs(sComment, fileW);
|
|
fclose (fileW);
|
|
SetCurrentDirectory(sDirectory);
|
|
|
|
for(i=0; i<g_lTextureNum; i++)
|
|
{
|
|
// compute the texture
|
|
MLT_vComputeOneTexture(g_sTexture[i], sRaw, sGame);
|
|
// update progress line
|
|
k=i+*j;
|
|
m_oProgress.SetPos( k );
|
|
g_iResultIndex[*l] = m_oRichEditRes.LineIndex(m_oRichEditRes.GetLineCount() -1);
|
|
(*l)++;
|
|
m_fn_vWriteInFile( FALSE);
|
|
// update Textures.txt
|
|
GetCurrentDirectory(256, sDirectory);
|
|
SetCurrentDirectory(sGameDir);
|
|
fileW = fopen("Textures.txt", "at+");
|
|
fputs("Texture ", fileW);
|
|
fputs(g_sTexture[i], fileW);
|
|
fputs("\n", fileW);
|
|
fclose (fileW);
|
|
SetCurrentDirectory(sDirectory);
|
|
}
|
|
*j=*j+i;
|
|
GetCurrentDirectory(256, sDirectory);
|
|
SetCurrentDirectory(sGameDir);
|
|
fileW = fopen("Textures.txt", "at+");
|
|
fputs("*****************************************************\n", fileW);
|
|
fputs("\n", fileW);
|
|
fputs("\n", fileW);
|
|
fclose (fileW);
|
|
SetCurrentDirectory(sDirectory);
|
|
}
|
|
|
|
}
|
|
|
|
/****************************************************************************
|
|
* Description: Prepare the conversion for a common family
|
|
*
|
|
* Parameters: bForce : flag to force the conversion
|
|
* sFile1 : array of specific files
|
|
* bContinue : array of conversion flags
|
|
* iIndex : index of the family
|
|
* iProgress : state of the progress bar
|
|
*---------------------------------------------------------------------------
|
|
* Revision date: Author:
|
|
*****************************************************************************/
|
|
void CDlgMain::m_fn_vPrepareCommonFamily (BOOL bForce, char sFile1[40][_MAX_PATH], BOOL *bContinue, int iIndex, int iProgress)
|
|
{
|
|
int ii;
|
|
|
|
// if must force common, do it
|
|
if (bForce)
|
|
{
|
|
// remove specific files
|
|
for (ii = 0; ii < g_iNbFiles; ii++)
|
|
{
|
|
// special treatment for ZOO file
|
|
if (!g_bIgnoreZoo)
|
|
{
|
|
if (!strstr(sFile1[ii], "ZOO"))
|
|
{
|
|
if (remove(sFile1[ii])!=-1)
|
|
g_iSpecific1=1;
|
|
}
|
|
if (!strstr(sFile1[ii+g_iNbFiles], "ZOO"))
|
|
{
|
|
if (remove(sFile1[ii+g_iNbFiles])!=-1)
|
|
g_iSpecific2=1;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
remove(sFile1[ii]);
|
|
remove(sFile1[ii+g_iNbFiles]);
|
|
}
|
|
}
|
|
// warn the user
|
|
fn_ComRes_vWriteLine( "\n\nThe specific files of the family ", C_ComRes_cNormalLine ,&m_oRichEditRes, &m_stCharFormatRes);
|
|
fn_ComRes_vWriteLine( g_sFamily[iIndex], C_ComRes_cNormalLine ,&m_oRichEditRes, &m_stCharFormatRes);
|
|
fn_ComRes_vWriteLine( " are deleted from GameSpecific1 and/or GameSpecific2 directory(ies)!\n", C_ComRes_cNormalLine ,&m_oRichEditRes, &m_stCharFormatRes);
|
|
}
|
|
// otherwise, the conversion is canceled
|
|
else
|
|
{
|
|
m_oProgress.SetPos(iProgress);
|
|
fn_ComRes_vWriteLine( "\n\nThe conversion of the family ", C_ComRes_cNormalLine ,&m_oRichEditRes, &m_stCharFormatRes);
|
|
fn_ComRes_vWriteLine( g_sFamily[iIndex], C_ComRes_cNormalLine ,&m_oRichEditRes, &m_stCharFormatRes);
|
|
fn_ComRes_vWriteLine( " is canceled!\n", C_ComRes_cNormalLine ,&m_oRichEditRes, &m_stCharFormatRes);
|
|
bContinue[iIndex] = FALSE;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
* Description: Prepare the conversion for a specific family
|
|
*
|
|
* Parameters: bForce : flag to force the conversion
|
|
* sFile1 : array of specific files
|
|
* bCommon : array of conversion flags
|
|
* iIndex : index of the family
|
|
*---------------------------------------------------------------------------
|
|
* Revision date: Author:
|
|
*****************************************************************************/
|
|
void CDlgMain::m_fn_vPrepareSpecificFamily (BOOL bForce, char sFile1[40][_MAX_PATH], BOOL *bCommon, int iIndex)
|
|
{
|
|
int ii;
|
|
|
|
// if must force specific, do it
|
|
if (bForce)
|
|
{
|
|
// remove all specific files
|
|
for (ii = 0; ii < g_iNbFiles; ii++)
|
|
{
|
|
if (!g_bIgnoreZoo)
|
|
{
|
|
if (!strstr(sFile1[ii], "ZOO"))
|
|
remove(sFile1[ii]);
|
|
}
|
|
else
|
|
remove(sFile1[ii]);
|
|
}
|
|
// warn the user
|
|
fn_ComRes_vWriteLine( "\n\nThe family ", C_ComRes_cNormalLine ,&m_oRichEditRes, &m_stCharFormatRes);
|
|
fn_ComRes_vWriteLine( g_sFamily[iIndex], C_ComRes_cNormalLine ,&m_oRichEditRes, &m_stCharFormatRes);
|
|
fn_ComRes_vWriteLine( " is a specific family now!\n", C_ComRes_cNormalLine ,&m_oRichEditRes, &m_stCharFormatRes);
|
|
fn_ComRes_vWriteLine( " It was converted in ", C_ComRes_cNormalLine ,&m_oRichEditRes, &m_stCharFormatRes);
|
|
switch(g_iData)
|
|
{
|
|
case 1:
|
|
fn_ComRes_vWriteLine( g_sGameSpecific1, C_ComRes_cNormalLine ,&m_oRichEditRes, &m_stCharFormatRes);
|
|
break;
|
|
case 2:
|
|
fn_ComRes_vWriteLine( g_sGameSpecific2, C_ComRes_cNormalLine ,&m_oRichEditRes, &m_stCharFormatRes);
|
|
break;
|
|
}
|
|
fn_ComRes_vWriteLine( " directory.\n", C_ComRes_cNormalLine ,&m_oRichEditRes, &m_stCharFormatRes);
|
|
|
|
}
|
|
// otherwise, the family will remain a common one
|
|
else
|
|
{
|
|
bCommon[iIndex] = TRUE;
|
|
fn_ComRes_vWriteLine( "\n\nThe family ", C_ComRes_cNormalLine ,&m_oRichEditRes, &m_stCharFormatRes);
|
|
fn_ComRes_vWriteLine( g_sFamily[iIndex], C_ComRes_cNormalLine ,&m_oRichEditRes, &m_stCharFormatRes);
|
|
fn_ComRes_vWriteLine( " remains a common family!\n", C_ComRes_cNormalLine ,&m_oRichEditRes, &m_stCharFormatRes);
|
|
}
|
|
}
|
|
|
|
|
|
/****************************************************************************
|
|
* Description: init all the options from the command line and from INI file
|
|
*
|
|
* Parameters: p_szCommanLine : command line
|
|
* szBanks : returns the banks to convert
|
|
* szAnims : returns the anims to convert
|
|
* szClasses : returns the classes to convert
|
|
* szFamilies : returns the families to convert
|
|
* szLevels : returns the levels to convert
|
|
* szTextures : returns the textures to convert
|
|
*---------------------------------------------------------------------------
|
|
* Revision date: Author:
|
|
*****************************************************************************/
|
|
void CDlgMain::m_fn_vUpdateGameDSC (void)
|
|
{
|
|
xString sDirectory;
|
|
|
|
// change directory
|
|
GetCurrentDirectory(256, sDirectory);
|
|
SetCurrentDirectory(g_sGameData);
|
|
|
|
if (g_bUpdateGameDSC)
|
|
{
|
|
FILE *fileR;
|
|
FILE *fileW;
|
|
int i;
|
|
|
|
CopyFile("game.dsc", "temp.dsc", FALSE);
|
|
fileR = fopen("temp.dsc", "rt");
|
|
if (fileR)
|
|
{
|
|
BOOL bLevelName[100];
|
|
char sContent[255];
|
|
char szLevelName[100][100];
|
|
int j = 0, k;
|
|
|
|
fileW = fopen( "game.dsc", "wt");
|
|
while (!feof(fileR))
|
|
{
|
|
fgets( sContent, 255, fileR );
|
|
fputs( sContent, fileW);
|
|
if (strstr(sContent, "{FirstLevelDescription:"))
|
|
break;
|
|
}
|
|
for (i=0; i<g_lLevelNum; i++)
|
|
{
|
|
fputs( "LevelName(", fileW);
|
|
fputs(g_sLevel[i], fileW);
|
|
fputs(")\n", fileW);
|
|
}
|
|
|
|
for (i=0; i<100; i++)
|
|
bLevelName[i] = 0;
|
|
|
|
fgets(sContent, 255, fileR);
|
|
while (!feof(fileR) && (strstr(sContent, "LevelName") || strstr(sContent, "}") || strstr(sContent, "\n")))
|
|
{
|
|
if (strstr(sContent, "}"))
|
|
break;
|
|
if (strcmp(sContent, "\n"))
|
|
{
|
|
strcpy(szLevelName[j], sContent);
|
|
j++;
|
|
}
|
|
fgets(sContent, 255, fileR);
|
|
}
|
|
for (k=0; k<j; k++)
|
|
{
|
|
for (i=0; i<g_lLevelNum; i++)
|
|
{
|
|
if (strstr(szLevelName[k], g_sLevel[i]))
|
|
bLevelName[k] = 1;
|
|
}
|
|
}
|
|
|
|
for (k=0; k<j; k++)
|
|
{
|
|
if (!bLevelName[k])
|
|
{
|
|
if (!strchr(szLevelName[k], ';'))
|
|
fputs(";", fileW);
|
|
fputs(szLevelName[k], fileW);
|
|
}
|
|
}
|
|
|
|
|
|
fputs( sContent, fileW);
|
|
while (!feof(fileR))
|
|
{
|
|
fgets( sContent, 255, fileR );
|
|
if (!feof(fileR)) fputs( sContent, fileW);
|
|
}
|
|
|
|
|
|
fclose(fileR);
|
|
fclose(fileW);
|
|
remove("temp.dsc");
|
|
}
|
|
}
|
|
// restore directory
|
|
SetCurrentDirectory(sDirectory);
|
|
}
|
|
|
|
|
|
/****************************************************************************
|
|
* Description: init all the options from the command line and from INI file
|
|
*
|
|
* Parameters: p_szCommanLine : command line
|
|
* szBanks : returns the banks to convert
|
|
* szAnims : returns the anims to convert
|
|
* szClasses : returns the classes to convert
|
|
* szFamilies : returns the families to convert
|
|
* szLevels : returns the levels to convert
|
|
* szTextures : returns the textures to convert
|
|
*---------------------------------------------------------------------------
|
|
* Revision date: Author:
|
|
*****************************************************************************/
|
|
void CDlgMain::m_fn_vInitAllOptions (char *p_szCommanLine, char *szAnims, char *szBanks, char *szClasses, char *szFamilies, char *szLevels, char *szTextures)
|
|
{
|
|
long i,j;
|
|
char *p_Char1;
|
|
char sIdent[_MAX_PATH];
|
|
char szRaw[_MAX_PATH];
|
|
char szGam[_MAX_PATH];
|
|
|
|
// init selection
|
|
strcpy(szAnims, "");
|
|
strcpy(szBanks, "");
|
|
strcpy(szClasses, "");
|
|
strcpy(szFamilies, "");
|
|
strcpy(szLevels, "");
|
|
strcpy(szTextures, "");
|
|
// init directories
|
|
strcpy(szRaw, "");
|
|
strcpy(szGam, "");
|
|
// init main options
|
|
strcpy(g_szRayman2, "");
|
|
strcpy(g_szModifLst, "");
|
|
strcpy(g_szEraseMdf, "");
|
|
// init ignore options
|
|
strcpy(g_szIgnoreZoo, "");
|
|
strcpy(g_szIgnoreSct, "");
|
|
strcpy(g_szIgnoreSpo, "");
|
|
strcpy(g_szIgnoreGmt, "");
|
|
strcpy(g_szIgnoreVmt, "");
|
|
// init conversion options
|
|
strcpy(g_szCopyAnims, "");
|
|
strcpy(g_szCopyTextures, "");
|
|
strcpy(g_szGenerateRLI, "");
|
|
strcpy(g_szUpdateGameDSC, "");
|
|
// init erase options
|
|
strcpy(g_szEraseDuplicated, "");
|
|
strcpy(g_szEraseUnused, "");
|
|
// init family options
|
|
strcpy(g_szForceCommon, "0");
|
|
strcpy(g_szForceSpecific, "0");
|
|
// init bank options
|
|
strcpy(g_szCreateBasicFamily, "");
|
|
|
|
// get configs from command line
|
|
if(strstr(p_szCommanLine,"-dirconf"))
|
|
sscanf(strstr(p_szCommanLine,"-dirconf")+8,"%s",g_szDirConfig);
|
|
if(strstr(p_szCommanLine,"-selconf"))
|
|
sscanf(strstr(p_szCommanLine,"-selconf")+8,"%s",g_szSelectConfig);
|
|
if(strstr(p_szCommanLine,"-optconf"))
|
|
sscanf(strstr(p_szCommanLine,"-optconf")+8,"%s",g_szOptionConfig);
|
|
// get selection from command line
|
|
if(strstr(p_szCommanLine,"-anims"))
|
|
strcpy(szAnims, "All");
|
|
if(strstr(p_szCommanLine,"-banks"))
|
|
strcpy(szBanks, "All");
|
|
if(strstr(p_szCommanLine,"-classes"))
|
|
strcpy(szClasses, "All");
|
|
if(strstr(p_szCommanLine,"-families"))
|
|
strcpy(szFamilies, "All");
|
|
if(strstr(p_szCommanLine,"-levels"))
|
|
strcpy(szLevels, "All");
|
|
if(strstr(p_szCommanLine,"-textures"))
|
|
strcpy(szTextures, "All");
|
|
// get directories from command line
|
|
if(strstr(p_szCommanLine,"-raw"))
|
|
sscanf(strstr(p_szCommanLine,"-raw")+4,"%s",szRaw);
|
|
if(strstr(p_szCommanLine,"-game"))
|
|
sscanf(strstr(p_szCommanLine,"-game")+5,"%s",szGam);
|
|
// get main options from command line
|
|
if(strstr(p_szCommanLine,"-rii"))
|
|
sscanf(strstr(p_szCommanLine,"-rii")+4,"%s",g_szRayman2);
|
|
if(strstr(p_szCommanLine,"-upd"))
|
|
sscanf(strstr(p_szCommanLine,"-upd")+4,"%s",g_szModifLst);
|
|
if(strstr(p_szCommanLine,"-mdf"))
|
|
sscanf(strstr(p_szCommanLine,"-mdf")+4,"%s",g_szEraseMdf);
|
|
// get conflict options from command line
|
|
if(strstr(p_szCommanLine,"-zoo"))
|
|
sscanf(strstr(p_szCommanLine,"-zoo")+4,"%s",g_szIgnoreZoo);
|
|
if(strstr(p_szCommanLine,"-sct"))
|
|
sscanf(strstr(p_szCommanLine,"-sct")+4,"%s",g_szIgnoreSct);
|
|
if(strstr(p_szCommanLine,"-spo"))
|
|
sscanf(strstr(p_szCommanLine,"-spo")+4,"%s",g_szIgnoreSpo);
|
|
if(strstr(p_szCommanLine,"-gmt"))
|
|
sscanf(strstr(p_szCommanLine,"-gmt")+4,"%s",g_szIgnoreGmt);
|
|
if(strstr(p_szCommanLine,"-vmt"))
|
|
sscanf(strstr(p_szCommanLine,"-vmt")+4,"%s",g_szIgnoreVmt);
|
|
// get conversion options from command line
|
|
if(strstr(p_szCommanLine,"-canim"))
|
|
sscanf(strstr(p_szCommanLine,"-canim")+6,"%s",g_szCopyAnims);
|
|
if(strstr(p_szCommanLine,"-ctex"))
|
|
sscanf(strstr(p_szCommanLine,"-ctex")+5,"%s",g_szCopyTextures);
|
|
if(strstr(p_szCommanLine,"-rli"))
|
|
sscanf(strstr(p_szCommanLine,"-rli")+4,"%s",g_szGenerateRLI);
|
|
if(strstr(p_szCommanLine,"-dsc"))
|
|
sscanf(strstr(p_szCommanLine,"-dsc")+4,"%s",g_szUpdateGameDSC);
|
|
// get erase options from command line
|
|
if(strstr(p_szCommanLine,"-eface"))
|
|
sscanf(strstr(p_szCommanLine,"-eface")+6,"%s",g_szEraseDuplicated);
|
|
if(strstr(p_szCommanLine,"-epts"))
|
|
sscanf(strstr(p_szCommanLine,"-epts")+5,"%s",g_szEraseUnused);
|
|
// get family options from command line
|
|
if(strstr(p_szCommanLine,"-fcom"))
|
|
sscanf(strstr(p_szCommanLine,"-i")+2,"%s",g_szForceCommon);
|
|
if(strstr(p_szCommanLine,"-fspec"))
|
|
sscanf(strstr(p_szCommanLine,"-d")+2,"%s",g_szForceSpecific);
|
|
// get bank option from command line
|
|
if(strstr(p_szCommanLine,"-bfam"))
|
|
sscanf(strstr(p_szCommanLine,"-bfam")+5,"%s",g_szCreateBasicFamily);
|
|
|
|
// init directories
|
|
if (strcmp(szRaw, ""))
|
|
g_iRaw=atoi(szRaw);
|
|
if (strcmp(szGam, ""))
|
|
g_iData=atoi(szGam);
|
|
|
|
// obtain all the data from the ini file
|
|
fn_IniData_vGetDatasFromFile(TRUE);
|
|
|
|
strcpy(sIdent, g_stInitialData.szFamily);
|
|
j=0;
|
|
if (strcmp(sIdent, ""))
|
|
{
|
|
p_Char1=sIdent;
|
|
while( (*p_Char1 != ',') && (*p_Char1 != 0))
|
|
{
|
|
i=0;
|
|
while( (*p_Char1 != ',') && (*p_Char1 != 0))
|
|
{
|
|
g_szFiles[j][i]=*p_Char1;
|
|
p_Char1++;
|
|
i++;
|
|
}
|
|
g_szFiles[j][i] = '\0';
|
|
if (*p_Char1 != 0)
|
|
p_Char1++;
|
|
j++;
|
|
}
|
|
}
|
|
|
|
g_iNbFiles= j;
|
|
|
|
//update the values for the main options
|
|
if (strcmp(g_szRayman2, ""))
|
|
g_bRaymanII = atoi(g_szRayman2);
|
|
if (strcmp(g_szModifLst, ""))
|
|
g_bModifLst = atoi(g_szModifLst);
|
|
if (strcmp(g_szEraseMdf, ""))
|
|
g_bEraseMdf = atoi(g_szEraseMdf);
|
|
// update the values for the ignore options
|
|
if (strcmp(g_szIgnoreZoo, ""))
|
|
g_bIgnoreZoo = atoi(g_szIgnoreZoo);
|
|
if (strcmp(g_szIgnoreSct, ""))
|
|
g_bIgnoreSct = atoi(g_szIgnoreSct);
|
|
if (strcmp(g_szIgnoreSpo, ""))
|
|
g_bIgnoreSpo = atoi(g_szIgnoreSpo);
|
|
if (strcmp(g_szIgnoreGmt, ""))
|
|
g_bIgnoreGmt = atoi(g_szIgnoreGmt);
|
|
if (strcmp(g_szIgnoreVmt, ""))
|
|
g_bIgnoreTex = atoi(g_szIgnoreVmt);
|
|
// update the values for the conversion options
|
|
if (strcmp(g_szCopyAnims, ""))
|
|
g_bCopyAnims = atoi(g_szCopyAnims);
|
|
if (strcmp(g_szCopyTextures, ""))
|
|
g_bCopyTextures = atoi(g_szCopyTextures);
|
|
if (strcmp(g_szGenerateRLI, ""))
|
|
g_bGenerateRLI = atoi(g_szGenerateRLI);
|
|
if (strcmp(g_szUpdateGameDSC, ""))
|
|
g_bUpdateGameDSC = atoi(g_szUpdateGameDSC);
|
|
// update the values for the erase options
|
|
if (strcmp(g_szEraseDuplicated, ""))
|
|
g_bEraseDuplicated = atoi(g_szEraseDuplicated);
|
|
if (strcmp(g_szEraseUnused, ""))
|
|
g_bEraseUnused = atoi(g_szEraseUnused);
|
|
// update the values for bank options
|
|
if (strcmp(g_szCreateBasicFamily, ""))
|
|
g_bCreateBasicFamily = atoi(g_szCreateBasicFamily);
|
|
}
|
|
|
|
|