/*
-- ----------------------------------------------------------------------------
--
--  			Copyright 1994 Division Limited.
--			      All Rights Reserved
--
--
--  System       : 
--  Module       : 
--  Object Name  : $RCSfile: mapfile.h,v $
--  Revision     : $Revision: 1.3 $
--  Date         : $Date: 95/04/27 23:01:16 $
--  Author       : $Author: bill $
--
--  Description	
--
--  Notes
--
--  History
--	
--
-- ----------------------------------------------------------------------------
*/

#ifndef __MAPFILE_H__
#define __MAPFILE_H__

#ifdef _PF_LOCAL
#include "ptool.h"
#else
#include <dsys/ptool.h>
#endif

/* Error Numbers */
#define dmpENO_OPEN  0x50001
#define dmpENO_FORM  0x50002

typedef struct dmpMATFILETYPE
{
    char       *name ;
    dpfFILEPTR  file ;
    struct dmpMATFILETYPE *next ;
} dmpMATFILE, *dmpMATFILEPTR ;

typedef struct dmpBLOCKTYPE
{
    char   *name ;
    int32   ignore ;
    struct dmpBLOCKTYPE *next ;
} dmpBLOCK, *dmpBLOCKPTR ;

typedef struct dmpMAPPINGTYPE
{
    char      *from, *to ;
    int32      gotMat ;
    int32      gotText ;
    dptTEXTURE text ;
    struct dmpMAPPINGTYPE *next ;
} dmpMAPPING, *dmpMAPPINGPTR ;

typedef struct
{
    dmpMATFILEPTR  materials ;
    dmpMAPPINGPTR  mappings ;
    dmpBLOCKPTR    blocks ;
} dmpFILE, *dmpFILEPTR ;

dmpFILEPTR
dmpCreateFile(void) ;
dmpMATFILEPTR
dmpCreateMatFile(void) ;
int32 
dmpAddMatFile(dmpFILEPTR mp, dmpMATFILEPTR mat) ;
dmpBLOCKPTR
dmpCreateBlock(void) ;
int32
dmpAddBlock(dmpFILEPTR mp, dmpBLOCKPTR blk) ;
dmpMAPPINGPTR
dmpCreateMapping(void) ;
int32
dmpAddMapping(dmpFILEPTR mp, dmpMAPPINGPTR map) ;
void
dmpFreeFile(dmpFILEPTR mp) ;
dmpMAPPINGPTR
dmpFindMapping(dmpFILEPTR mp, char *name) ;
dpfMATERIALPTR
dmpFindMaterial(dmpFILEPTR mp, char *name) ;
dpfTEXTUREPTR
dmpFindTexture(dmpFILEPTR mp, char *name) ;
dmpBLOCKPTR
dmpFindBlock(dmpFILEPTR mp, char *name) ;

int32
dmpGetMapFile(dmpFILEPTR mp, char *fileName) ;
int32
dmpSaveFile(char *name, dmpFILEPTR file) ;


#endif /* __MAPFILE */
