reman3/Rayman_X/cpa/Appli/ModExp/ModExp.h

110 lines
3.2 KiB
C++

#define ERROR_MSG_MAX_LEN 128
#define MAX_MOD_COMMAND_LEN 512
#define MAX_NAME_OBJ 40
class WorkFile
{
private:
FILE *stream;
char m_ShortfName[MAX_FILE_NAME];
char m_fileName[MAX_FILE_NAME];
public:
WorkFile(const TCHAR *filename,const TCHAR *mode) { stream = NULL; Open(filename, mode); };
~WorkFile() { Close(); };
FILE * Stream() { return stream; };
int Close() { int result=0; if(stream) result=fclose(stream); stream = NULL; return result; }
void Open(const TCHAR *filename,const TCHAR *mode) { Close(); stream = _tfopen(filename,mode); strcpy(m_fileName, filename); }
void OutLine(char* _txtLine);
char* GetFileName(){return m_fileName;};
char* GetShortfName(){return m_ShortfName;};
void SetShortfName(char* _SFName){ strcpy(m_ShortfName, _SFName);};
};
class CModExport : public SceneExport
{
public:
CModExport();
~CModExport();
int ExtCount(); // Number of extensions supported
const TCHAR * Ext(int n); // Extension #n (i.e. "3DS")
const TCHAR * LongDesc(); // Long ASCII description (i.e. "Autodesk 3D Studio File")
const TCHAR * ShortDesc(); // Short ASCII description (i.e. "3D Studio")
const TCHAR * AuthorName(); // ASCII Author name
const TCHAR * CopyrightMessage(); // ASCII Copyright message
const TCHAR * OtherMessage1(); // Other message #1
const TCHAR * OtherMessage2(); // Other message #2
unsigned int Version(); // Version number * 100 (i.e. v3.01 = 301)
void ShowAbout(HWND hWnd); // Show DLL's "About..." box
int DoExport(const TCHAR *name,ExpInterface *ei,Interface *i, BOOL suppressPrompts, DWORD options); // Export file
BOOL m_exportSelected;
BOOL m_showPrompts;
Interface* m_Gi;
ExpInterface* m_ei;
//void Append(INode *_node);
private:
int GetExportOptions(DWORD options, BOOL suppressPrompts);
int ExportFile(const TCHAR *filename);
int DumpHeader(WorkFile &modFile, BOOL _isSpo = 0);
int DumpData(WorkFile &modFile,WorkFile &_spoFile);
};
class CModExpClassDesc:public ClassDesc
{
public:
inline int IsPublic();
inline void * Create(BOOL loading = FALSE);
inline const TCHAR * ClassName();
inline SClass_ID SuperClassID();
inline Class_ID ClassID();
inline const TCHAR* Category();
};
class CSuperObject
{
CSuperObject* m_Parent;
char m_name[MAX_NAME_OBJ];
std::list <CSuperObject*> m_childs;
char* m_GeomLink;
void GetLocalMatrix(Matrix3 &NodMat, TimeValue _time);
public:
INode* m_maxNode;
CSuperObject(INode *_node);
~CSuperObject();
void DumpSpo(WorkFile &_spoFile, TimeValue _time);
CSuperObject* findSpo(INode *_node);
void AddNode(CSuperObject *_node);
void SetGeomLink(char*);
char* GetGeomLink();
};
class SceneEnumProc : public ITreeEnumProc
{
private:
std::list <CSuperObject *> m_GeomList;
std::list <Mtl *> m_MatList;
void Append(INode *_node);
void AppendMat(Mtl *_mtl);
TimeValue m_time;
void DumpOneGeom(WorkFile &modFile, CSuperObject *_node);
void DumpOneMtl(WorkFile &modFile, Mtl *_mtl);
CSuperObject* m_root;
public:
SceneEnumProc(TimeValue time);
~SceneEnumProc();
int Count(){ return m_count; };
int callback( INode *node );
int m_count;
void DumpGeoms(WorkFile &modFile);
void DumpMtls(WorkFile &modFile);
void DumpRoot(WorkFile &_spoFile);
};