Complete disaster-recovery snapshot: engine/game source, game data assets, VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive. Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false, no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
799 lines
19 KiB
C++
799 lines
19 KiB
C++
//*********************************************************************************
|
|
// BRBDialog.cpp : implementation file
|
|
//
|
|
//*********************************************************************************
|
|
//
|
|
// Who When What
|
|
// BDB 10/08/98 Generate MFC Code
|
|
//
|
|
//*********************************************************************************
|
|
|
|
|
|
#include "stdafx.h"
|
|
#include "resource.h" // main symbols
|
|
|
|
#if !defined(STUFF_STUFF_HPP)
|
|
#include "Stuff\Stuff.hpp"
|
|
#endif
|
|
|
|
#if !defined(MAXPROXIES_MAXPROXIES_HPP)
|
|
#include "MAXProxies\MAXProxies.hpp"
|
|
#endif
|
|
|
|
#if !defined(MIDLEVELRENDERER_HPP)
|
|
#include "MLR\MLR.hpp"
|
|
#endif
|
|
|
|
#if !defined(ELEMENTPROXIES_ELEMENTPROXIES_HPP)
|
|
#include "ElementProxies\ElementProxies.hpp"
|
|
#endif
|
|
|
|
#if !defined(ELEMENTRENDERER_ELEMENTRENDERER_HPP)
|
|
#include "ElementRenderer\ElementRenderer.hpp"
|
|
#endif
|
|
|
|
#if !defined(GOSFX_GOSFX_HPP)
|
|
#include <gosFX\gosFX.hpp>
|
|
#endif
|
|
|
|
#if !defined(TOOLOS_HPP)
|
|
#include <GameOS\ToolOS.hpp>
|
|
#endif
|
|
|
|
#include "MAXProxies\MAXProxyHeaders.hpp"
|
|
|
|
|
|
Stuff::Point3D ConvertMaxToMW(Point3 &pnt);
|
|
Stuff::UnitQuaternion ConvertMaxToMW(Quat &quat);
|
|
|
|
#undef Max
|
|
#undef Min
|
|
|
|
|
|
#include "BRBDialog.h"
|
|
#include <DECOMP.H>
|
|
|
|
#define RAD2DEG(x) ((x)*(180/PI))
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
|
|
void DeleteDirectory(CString dir);
|
|
void ClearDirectory(CString dir);
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// BRBDialog dialog
|
|
|
|
BRBDialog::BRBDialog(Interface *i, CString *file_names,CWnd* pParent /*=NULL*/)
|
|
: CDialog(BRBDialog::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(BRBDialog)
|
|
//}}AFX_DATA_INIT
|
|
//
|
|
// set up the radio buttons
|
|
//
|
|
exportCharacter = -1;
|
|
exportShape = 0;
|
|
|
|
for (int w=0;w<MAX_FILES;w++)
|
|
{
|
|
maxFiles[w] = file_names[w];
|
|
m_lodFar[w] = 0;
|
|
m_lodNear[w] = 0;
|
|
}
|
|
|
|
m_lodNear[0] = 0;
|
|
m_lodFar[0] = m_lodNear[1] = 50;
|
|
m_lodFar[1] = m_lodNear[2] = 100;
|
|
m_lodFar[2] = m_lodNear[3] = 150;
|
|
m_lodFar[3] = m_lodNear[4] = 200;
|
|
m_lodFar[4] = m_lodNear[5] = 250;
|
|
m_lodFar[5] = m_lodNear[6] = 300;
|
|
m_lodFar[6] = m_lodNear[7] = 350;
|
|
m_lodFar[7] = 400;
|
|
|
|
maxInterface = i;
|
|
}
|
|
|
|
|
|
void BRBDialog::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(BRBDialog)
|
|
DDX_Control(pDX, IDC_CHARACTER, m_ctrlCharacter);
|
|
//}}AFX_DATA_MAP
|
|
|
|
DDX_Text(pDX, IDC_LOD1_FAR, m_lodFar[0]);
|
|
DDX_Text(pDX, IDC_LOD1_NEAR, m_lodNear[0]);
|
|
DDX_Text(pDX, IDC_LOD2_FAR, m_lodFar[1]);
|
|
DDX_Text(pDX, IDC_LOD2_NEAR, m_lodNear[1]);
|
|
DDX_Text(pDX, IDC_LOD3_FAR, m_lodFar[2]);
|
|
DDX_Text(pDX, IDC_LOD3_NEAR, m_lodNear[2]);
|
|
DDX_Text(pDX, IDC_LOD4_FAR, m_lodFar[3]);
|
|
DDX_Text(pDX, IDC_LOD4_NEAR, m_lodNear[3]);
|
|
DDX_Text(pDX, IDC_LOD5_FAR, m_lodFar[4]);
|
|
DDX_Text(pDX, IDC_LOD5_NEAR, m_lodNear[4]);
|
|
DDX_Text(pDX, IDC_LOD6_FAR, m_lodFar[5]);
|
|
DDX_Text(pDX, IDC_LOD6_NEAR, m_lodNear[5]);
|
|
DDX_Text(pDX, IDC_LOD7_FAR, m_lodFar[6]);
|
|
DDX_Text(pDX, IDC_LOD7_NEAR, m_lodNear[6]);
|
|
DDX_Text(pDX, IDC_LOD8_FAR, m_lodFar[7]);
|
|
DDX_Text(pDX, IDC_LOD8_NEAR, m_lodNear[7]);
|
|
|
|
DDX_Text(pDX, IDC_MAXFILE1, maxFiles[0]);
|
|
DDX_Text(pDX, IDC_MAXFILE2, maxFiles[1]);
|
|
DDX_Text(pDX, IDC_MAXFILE3, maxFiles[2]);
|
|
DDX_Text(pDX, IDC_MAXFILE4, maxFiles[3]);
|
|
DDX_Text(pDX, IDC_MAXFILE5, maxFiles[4]);
|
|
DDX_Text(pDX, IDC_MAXFILE6, maxFiles[5]);
|
|
DDX_Text(pDX, IDC_MAXFILE7, maxFiles[6]);
|
|
DDX_Text(pDX, IDC_MAXFILE8, maxFiles[7]);
|
|
|
|
DDX_Radio(pDX, IDC_CHARACTER, exportCharacter);
|
|
DDX_Radio(pDX, IDC_SHAPE, exportShape);
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(BRBDialog, CDialog)
|
|
//{{AFX_MSG_MAP(BRBDialog)
|
|
ON_BN_CLICKED(IDC_BUTTON1, OnSelectLOD1)
|
|
ON_BN_CLICKED(IDC_BUTTON2, OnSelectLOD2)
|
|
ON_BN_CLICKED(IDC_BUTTON3, OnSelectLOD3)
|
|
ON_BN_CLICKED(IDC_BUTTON4, OnSelectLOD4)
|
|
ON_BN_CLICKED(IDC_BUTTON5, OnSelectLOD5)
|
|
ON_BN_CLICKED(IDC_BUTTON7, OnSelectLOD6)
|
|
ON_BN_CLICKED(IDC_BUTTON8, OnSelectLOD7)
|
|
ON_BN_CLICKED(IDC_BUTTON9, OnSelectLOD8)
|
|
ON_BN_CLICKED(IDC_SHAPE, OnShape)
|
|
ON_BN_CLICKED(IDC_CHARACTER, OnCharacter)
|
|
ON_EN_KILLFOCUS(IDC_LOD1_NEAR,OnKillfocus)
|
|
ON_EN_KILLFOCUS(IDC_LOD1_FAR, OnLod1Far)
|
|
ON_EN_KILLFOCUS(IDC_LOD2_FAR, OnLod2Far)
|
|
ON_EN_KILLFOCUS(IDC_LOD3_FAR, OnLod3Far)
|
|
ON_EN_KILLFOCUS(IDC_LOD4_FAR, OnLod4Far)
|
|
ON_EN_KILLFOCUS(IDC_LOD5_FAR, OnLod5Far)
|
|
ON_EN_KILLFOCUS(IDC_LOD6_FAR, OnLod6Far)
|
|
ON_EN_KILLFOCUS(IDC_LOD7_FAR, OnLod7Far)
|
|
ON_EN_KILLFOCUS(IDC_LOD8_FAR, OnLod8Far)
|
|
ON_EN_KILLFOCUS(IDC_LOD2_NEAR,OnKillfocus)
|
|
ON_EN_KILLFOCUS(IDC_LOD3_NEAR,OnKillfocus)
|
|
ON_EN_KILLFOCUS(IDC_LOD4_NEAR,OnKillfocus)
|
|
ON_EN_KILLFOCUS(IDC_LOD5_NEAR,OnKillfocus)
|
|
ON_EN_KILLFOCUS(IDC_LOD6_NEAR,OnKillfocus)
|
|
ON_EN_KILLFOCUS(IDC_LOD7_NEAR,OnKillfocus)
|
|
ON_EN_KILLFOCUS(IDC_LOD8_NEAR,OnKillfocus)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// BRBDialog message handlers
|
|
|
|
void BRBDialog::OnSelectLOD1()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
CString Content_File_Name = "";
|
|
static char BASED_CODE filter[] = "MAX Files (*.max)|*.max||";
|
|
CFileDialog dlg( TRUE, ".max", Content_File_Name, NULL, filter );
|
|
if (IDOK == dlg.DoModal())
|
|
{
|
|
POSITION pos = dlg.GetStartPosition();
|
|
maxFiles[0] = dlg.GetNextPathName(pos);
|
|
UpdateData(false);
|
|
}
|
|
}
|
|
|
|
void BRBDialog::OnSelectLOD2()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
CString Content_File_Name = "";
|
|
static char BASED_CODE filter[] = "MAX Files (*.max)|*.max||";
|
|
CFileDialog dlg( TRUE, ".max", Content_File_Name, NULL, filter );
|
|
if (IDOK == dlg.DoModal())
|
|
{
|
|
POSITION pos = dlg.GetStartPosition();
|
|
maxFiles[1] = dlg.GetNextPathName(pos);
|
|
UpdateData(false);
|
|
}
|
|
|
|
}
|
|
|
|
void BRBDialog::OnSelectLOD3()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
CString Content_File_Name = "";
|
|
static char BASED_CODE filter[] = "MAX Files (*.max)|*.max||";
|
|
CFileDialog dlg( TRUE, ".max", Content_File_Name, NULL, filter );
|
|
if (IDOK == dlg.DoModal())
|
|
{
|
|
POSITION pos = dlg.GetStartPosition();
|
|
maxFiles[2] = dlg.GetNextPathName(pos);
|
|
UpdateData(false);
|
|
}
|
|
|
|
}
|
|
|
|
void BRBDialog::OnSelectLOD4()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
CString Content_File_Name = "";
|
|
static char BASED_CODE filter[] = "MAX Files (*.max)|*.max||";
|
|
CFileDialog dlg( TRUE, ".max", Content_File_Name, NULL, filter );
|
|
if (IDOK == dlg.DoModal())
|
|
{
|
|
POSITION pos = dlg.GetStartPosition();
|
|
maxFiles[3] = dlg.GetNextPathName(pos);
|
|
UpdateData(false);
|
|
}
|
|
}
|
|
|
|
void BRBDialog::OnSelectLOD5()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
CString Content_File_Name = "";
|
|
static char BASED_CODE filter[] = "MAXs Files (*.max)|*.max||";
|
|
CFileDialog dlg( TRUE, ".max", Content_File_Name, NULL, filter );
|
|
if (IDOK == dlg.DoModal())
|
|
{
|
|
POSITION pos = dlg.GetStartPosition();
|
|
maxFiles[4] = dlg.GetNextPathName(pos);
|
|
UpdateData(false);
|
|
}
|
|
}
|
|
|
|
void BRBDialog::OnSelectLOD6()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
CString Content_File_Name = "";
|
|
static char BASED_CODE filter[] = "MAX Files (*.max)|*.max||";
|
|
CFileDialog dlg( TRUE, ".max", Content_File_Name, NULL, filter );
|
|
if (IDOK == dlg.DoModal())
|
|
{
|
|
POSITION pos = dlg.GetStartPosition();
|
|
maxFiles[5] = dlg.GetNextPathName(pos);
|
|
UpdateData(false);
|
|
}
|
|
}
|
|
|
|
void BRBDialog::OnSelectLOD7()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
CString Content_File_Name = "";
|
|
static char BASED_CODE filter[] = "MAX Files (*.max)|*.max||";
|
|
CFileDialog dlg( TRUE, ".max", Content_File_Name, NULL, filter );
|
|
if (IDOK == dlg.DoModal())
|
|
{
|
|
POSITION pos = dlg.GetStartPosition();
|
|
maxFiles[6] = dlg.GetNextPathName(pos);
|
|
UpdateData(false);
|
|
}
|
|
}
|
|
|
|
void BRBDialog::OnSelectLOD8()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
CString Content_File_Name = "";
|
|
static char BASED_CODE filter[] = "MAX Files (*.max)|*.max||";
|
|
CFileDialog dlg( TRUE, ".max", Content_File_Name, NULL, filter );
|
|
if (IDOK == dlg.DoModal())
|
|
{
|
|
POSITION pos = dlg.GetStartPosition();
|
|
maxFiles[7] = dlg.GetNextPathName(pos);
|
|
UpdateData(false);
|
|
}
|
|
}
|
|
|
|
|
|
void BRBDialog::OnShape()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
if (exportShape < 0)
|
|
{
|
|
exportCharacter = -1;
|
|
exportShape = 0;
|
|
UpdateData(FALSE);
|
|
}
|
|
else
|
|
{
|
|
exportCharacter = 0;
|
|
exportShape = -1;
|
|
UpdateData(TRUE);
|
|
}
|
|
}
|
|
|
|
void BRBDialog::OnCharacter()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
if (exportCharacter < 0)
|
|
{
|
|
exportCharacter = 0;
|
|
exportShape = -1;
|
|
UpdateData(FALSE);
|
|
}
|
|
else
|
|
{
|
|
exportCharacter = -1;
|
|
exportShape = 0;
|
|
UpdateData(TRUE);
|
|
}
|
|
}
|
|
|
|
void BRBDialog::OnCancel()
|
|
{
|
|
// TODO: Add extra cleanup here
|
|
|
|
CDialog::OnCancel();
|
|
}
|
|
|
|
void BRBDialog::OnOK()
|
|
{
|
|
|
|
GetGameDir();
|
|
|
|
CString tstr,batchfilename;
|
|
tstr=brbGamePath + "\\Content\\Games\\Brb\\Data\\";
|
|
ClearDirectory(tstr);
|
|
|
|
|
|
batchfilename=tstr+"BrbBatch.batch";
|
|
/*Stuff::NotationFile *note_file;
|
|
note_file = new Stuff::NotationFile();
|
|
Register_Object(note_file);
|
|
*/
|
|
Stuff::NotationFile note_file;
|
|
Page *page = note_file.SetPage("BRBTestExport");
|
|
Check_Object(page);
|
|
page->SetEntry("path",tstr);
|
|
|
|
if (0 == exportCharacter)
|
|
{
|
|
// Need to specify the skeleton file
|
|
CStr skelfile = maxFiles[0];
|
|
CStr p,f,f1;
|
|
SplitPathFile(skelfile,&p,&f);
|
|
p+= "\\skeleton\\";
|
|
for (int i=0;i<strlen(f);i++)
|
|
{
|
|
if (f[i] == '_')
|
|
break;
|
|
if (f[i] == '.')
|
|
break;
|
|
}
|
|
if (i<strlen(f))
|
|
f1 = f.Substr(0,i);
|
|
if (strlen(f1))
|
|
{
|
|
f1 = p+f1+".max";
|
|
page->SetEntry("LODSkel",f1);
|
|
}
|
|
}
|
|
for (int w=0;w<MAX_FILES;w++)
|
|
{
|
|
if (maxFiles[w] != "")
|
|
{
|
|
CString tag;
|
|
|
|
if (exportCharacter == 0)
|
|
{
|
|
tag.Format("LODChar%i",w);
|
|
}
|
|
else
|
|
{
|
|
tag.Format("LODShape%i",w);
|
|
}
|
|
|
|
page->SetEntry(tag,maxFiles[w]);
|
|
|
|
tag.Format("LODDist%i",w);
|
|
page->SetEntry(tag,(int)m_lodFar[w]);
|
|
}
|
|
}
|
|
note_file.SaveAs(batchfilename);
|
|
|
|
/* FileStream *batch_file = Stuff::FileStream::MakeFileStream(batchfilename, FileStream::WriteOnly);
|
|
Register_Object(batch_file);
|
|
|
|
note_file->Write(batch_file);
|
|
|
|
Unregister_Object(note_file);
|
|
delete note_file;
|
|
|
|
Unregister_Object(batch_file);
|
|
delete batch_file;
|
|
*/
|
|
if (maxInterface->ExportToFile(batchfilename,false))
|
|
{
|
|
if(exportCharacter==0) WriteBrbPropFile(EXPORT_CHARACTER);
|
|
else WriteBrbPropFile(EXPORT_SHAPE);
|
|
CDialog::OnOK();
|
|
return;
|
|
}
|
|
CDialog::OnCancel();
|
|
}
|
|
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
bool BRBDialog::AddPreferences(INode *node)
|
|
{
|
|
INode *data_node = node;
|
|
|
|
if (node->IsRootNode())
|
|
{
|
|
int i = node->NumberOfChildren();
|
|
if (i>0)
|
|
{
|
|
data_node = node->GetChildNode(0);
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
//
|
|
// Allocate memory for this chunk
|
|
//
|
|
size_t size = sizeof(ExportInfo);
|
|
BYTE *data = new BYTE[size];
|
|
Mem_Copy(data, &exportInfo, sizeof(ExportInfo), size);
|
|
//
|
|
// Add a chunk
|
|
//
|
|
data_node->AddAppDataChunk(
|
|
BRBDATA_CLASS_ID,
|
|
BRBDATA_SUPER_CLASS_ID,
|
|
PERM_DATA_ID,
|
|
size,data);
|
|
|
|
return true;
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
bool BRBDialog::RemovePreferences(INode *node)
|
|
{
|
|
INode *data_node = node;
|
|
|
|
if (node->IsRootNode())
|
|
{
|
|
int i = node->NumberOfChildren();
|
|
if (i>0)
|
|
{
|
|
data_node = node->GetChildNode(0);
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
//
|
|
// Remove the chunk if it exists
|
|
//
|
|
data_node->RemoveAppDataChunk(
|
|
BRBDATA_CLASS_ID,
|
|
BRBDATA_SUPER_CLASS_ID,
|
|
PERM_DATA_ID
|
|
);
|
|
return true;
|
|
}
|
|
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
//
|
|
void BRBDialog::GetGameDir()
|
|
{
|
|
TSTR ini_file = maxInterface->GetDir(APP_PLUGCFG_DIR);
|
|
|
|
ini_file += "\\Plugins.ini";
|
|
Check_Pointer(Stuff::FileStreamManager::Instance);
|
|
/* Stuff::FileStream *file_stream = Stuff::FileStream::MakeFileStream();
|
|
Register_Object(file_stream);
|
|
file_stream->Open(ini_file);
|
|
if (!file_stream->IsFileOpened())
|
|
{
|
|
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
|
|
AfxMessageBox("ERROR: Must have the PlugIns.ini file in : " + ini_file, MB_OK);
|
|
Unregister_Object(file_stream);
|
|
delete file_stream;
|
|
brbGamePath = "C:\\MW4\\";
|
|
erfPath = "erf\\";
|
|
|
|
}*/
|
|
|
|
Stuff::NotationFile data_file(ini_file);
|
|
//Register_Object(data_file);
|
|
|
|
const char* read_dir;
|
|
Page *page = data_file.FindPage("BRBData");
|
|
if (page && page->GetEntry("GameDir", &read_dir))
|
|
{
|
|
brbGamePath = read_dir;
|
|
}
|
|
|
|
/*file_stream->Close();
|
|
Unregister_Object(data_file);
|
|
delete data_file;
|
|
Unregister_Object(file_stream);
|
|
delete file_stream;*/
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// method writes the BRBProps.contents file to point the brb game to the exported data
|
|
//
|
|
int BRBDialog::WriteBrbPropFile(ETYPE etype)
|
|
{
|
|
TSTR ini_file = brbGamePath + "\\Content\\Games\\BRB\\Data\\BRBProps.contents";
|
|
|
|
Stuff::NotationFile note_file;
|
|
/*note_file = new Stuff::NotationFile();
|
|
Register_Object(note_file);
|
|
*/
|
|
Page *page = note_file.SetPage("brb_vehicle");
|
|
Check_Object(page);
|
|
switch(etype)
|
|
{
|
|
case EXPORT_SHAPE:
|
|
page->SetEntry("Model","BRBTestExport.data");
|
|
page->SetEntry("ExecutionState","NeverExecuteState");
|
|
break;
|
|
case EXPORT_CHARACTER:
|
|
page->SetEntry("Model","BRBVehicle.data");
|
|
page->SetEntry("Armature","BRBTestExport.contents");
|
|
page->SetEntry("ExecutionState","AnimatedMotionState");
|
|
break;
|
|
case EXPORT_ANIM:
|
|
page->SetEntry("Model","BRBMech.data");
|
|
page->SetEntry("Armature","BRBTestExport.contents");
|
|
page->SetEntry("ExecutionState","AnimatedMotionState");
|
|
break;
|
|
}
|
|
|
|
page->SetEntry("Translation","300.0 0.0 300.0");
|
|
|
|
page = note_file.SetPage("PlayerStart");
|
|
Check_Object(page);
|
|
page->SetEntry("Model","Content\\Misc\\DropZone.data");
|
|
page->SetEntry("ExecutionState","NeverExecuteState");
|
|
page->SetEntry("Translation","150.0 0.0 150.0");
|
|
/*Model=Content\Misc\DropZone.data
|
|
ExecutionState=NeverExecuteState
|
|
Translation=150.0 0.0 150.0
|
|
*/
|
|
|
|
note_file.SaveAs(ini_file);
|
|
/*
|
|
FileStream *prop_file = Stuff::FileStream::MakeFileStream(ini_file, FileStream::WriteOnly);
|
|
Register_Object(prop_file);
|
|
|
|
note_file->Write(prop_file);
|
|
|
|
Unregister_Object(note_file);
|
|
delete note_file;
|
|
|
|
Unregister_Object(prop_file);
|
|
delete prop_file;
|
|
*/
|
|
return 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// upon exiting a edit dialog save the data
|
|
//
|
|
void BRBDialog::OnKillfocus()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
UpdateData(true);
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// upon exiting a edit dialog save the data
|
|
//
|
|
void BRBDialog::OnLod1Far()
|
|
{
|
|
UpdateData(true);
|
|
m_lodNear[1] = m_lodFar[0];
|
|
UpdateData(false);
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// upon exiting a edit dialog save the data
|
|
//
|
|
void BRBDialog::OnLod2Far()
|
|
{
|
|
UpdateData(true);
|
|
m_lodNear[2] = m_lodFar[1];
|
|
UpdateData(false);
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// upon exiting a edit dialog save the data
|
|
//
|
|
void BRBDialog::OnLod3Far()
|
|
{
|
|
UpdateData(true);
|
|
m_lodNear[3] = m_lodFar[2];
|
|
UpdateData(false);
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// upon exiting a edit dialog save the data
|
|
//
|
|
void BRBDialog::OnLod4Far()
|
|
{
|
|
UpdateData(true);
|
|
m_lodNear[4] = m_lodFar[3];
|
|
UpdateData(false);
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// upon exiting a edit dialog save the data
|
|
//
|
|
void BRBDialog::OnLod5Far()
|
|
{
|
|
UpdateData(true);
|
|
m_lodNear[5] = m_lodFar[4];
|
|
UpdateData(false);
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// upon exiting a edit dialog save the data
|
|
//
|
|
void BRBDialog::OnLod6Far()
|
|
{
|
|
UpdateData(true);
|
|
m_lodNear[6] = m_lodFar[5];
|
|
UpdateData(false);
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// upon exiting a edit dialog save the data
|
|
//
|
|
void BRBDialog::OnLod7Far()
|
|
{
|
|
UpdateData(true);
|
|
m_lodNear[7] = m_lodFar[6];
|
|
UpdateData(false);
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// upon exiting a edit dialog save the data
|
|
//
|
|
void BRBDialog::OnLod8Far()
|
|
{
|
|
UpdateData(true);
|
|
}
|
|
|
|
void DeleteDirectory(CString dir)
|
|
{
|
|
|
|
ClearDirectory(dir);
|
|
RemoveDirectory(dir);
|
|
}
|
|
|
|
void ClearDirectory(CString dir)
|
|
{
|
|
|
|
HANDLE hfl;
|
|
WIN32_FIND_DATA fd;
|
|
|
|
if(dir[dir.GetLength()-1]=='\\')
|
|
{
|
|
dir=dir.Left(dir.GetLength()-1);
|
|
}
|
|
|
|
fd.dwFileAttributes=NULL;
|
|
hfl=FindFirstFile(dir+"\\*.*",&fd);
|
|
|
|
if(INVALID_HANDLE_VALUE!=hfl)
|
|
{
|
|
do
|
|
{
|
|
if (fd.dwFileAttributes&FILE_ATTRIBUTE_READONLY)
|
|
{
|
|
fd.dwFileAttributes &= ~FILE_ATTRIBUTE_READONLY;
|
|
::SetFileAttributes(dir+"\\"+fd.cFileName,fd.dwFileAttributes);
|
|
}
|
|
if(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)
|
|
{
|
|
if(strcmp(fd.cFileName,".") && strcmp(fd.cFileName,"..") )
|
|
{
|
|
DeleteDirectory(dir+"\\"+fd.cFileName);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
DeleteFile(dir+"\\"+fd.cFileName);
|
|
}
|
|
|
|
} while(FindNextFile(hfl,&fd));
|
|
}
|
|
|
|
}
|
|
|
|
bool BRBDialog::PreviewAnimation()
|
|
{
|
|
|
|
GetGameDir();
|
|
CString tstr;
|
|
tstr=brbGamePath + "\\Content\\Games\\Brb\\Data\\";
|
|
ClearDirectory(tstr);
|
|
gos_CreateDirectory((LPCSTR)tstr);
|
|
|
|
CString opath;
|
|
TSTR fullpath,path,filename,extension;
|
|
fullpath = maxInterface->GetCurFilePath();
|
|
if (fullpath.Length() == 0)
|
|
return false;
|
|
|
|
SplitFilename(fullpath,&path,&filename,&extension);
|
|
opath=brbGamePath + "\\Content\\Games\\Brb\\Data\\";
|
|
|
|
if (!maxInterface->ExportToFile(opath+"BRBTestExport.armature",false))
|
|
return false;
|
|
if (!maxInterface->ExportToFile(opath+"BRBTestExport.mw4anim",false))
|
|
return false;
|
|
|
|
WriteBrbPropFile(EXPORT_ANIM);
|
|
|
|
Stuff::NotationFile ans_file;
|
|
/* ans_file = new Stuff::NotationFile();
|
|
Register_Object(ans_file);
|
|
*/
|
|
Page *page = ans_file.SetPage("Test1State");
|
|
Check_Object(page);
|
|
page->SetEntry("AnimType","Cycletype");
|
|
page->SetEntry("Start","0.0");
|
|
page->SetEntry("Position","0.0");
|
|
page->SetEntry("Anim","Content\\Games\\BRB\\DATA\\BRBTestExport");
|
|
|
|
CString spath=opath+"BRBTestExport.AnimScript";
|
|
|
|
ans_file.SaveAs(spath);
|
|
/*FileStream *out_file = Stuff::FileStream::MakeFileStream(spath, FileStream::WriteOnly);
|
|
Register_Object(out_file);
|
|
|
|
ans_file->Write(out_file);
|
|
|
|
Unregister_Object(ans_file);
|
|
delete ans_file;
|
|
|
|
Unregister_Object(out_file);
|
|
delete out_file;*/
|
|
return true;
|
|
}
|
|
|
|
BOOL BRBDialog::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
CString fpath = maxFiles[0];
|
|
|
|
return true;
|
|
/*
|
|
if (fpath.GetLength())
|
|
{
|
|
char drive[MAX_PATH],path[MAX_PATH],filename[MAX_PATH],ext[MAX_PATH];
|
|
_splitpath(fpath,drive,path,filename,ext);
|
|
|
|
CString name;
|
|
// name.Format("%s%s\\Skeleton\\%s
|
|
maxInterface->LoadFromFile(name);
|
|
if (maxInterface->GetINodeByName("joint_WORLD"))
|
|
{
|
|
// This is an armatured object, set the default export type to Character
|
|
this->m_ctrlCharacter.SetCheck(1);
|
|
}
|
|
}
|
|
*/
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|