1 #ifndef _chnkload_hpp
2 #define _chnkload_hpp 1
3 
4 #include "chnkload.h"
5 
6 #ifdef __cplusplus
7 
8 #include "chunk.hpp"
9 #include "shpchunk.hpp"
10 #include "obchunk.hpp"
11 #include "bmpnames.hpp"
12 #include "projload.hpp"
13 
14 class Sprite_Header_Chunk;
15 
16 #if 0
17 extern BOOL copy_to_mainshpl (Shape_Chunk *shape, int list_pos);
18 extern BOOL copy_to_mainshpl (Shape_Sub_Shape_Chunk *shape, int list_pos);
19 #endif
20 
21 extern void copy_to_module (Object_Chunk * ob, int mod_pos, int shplst_pos);
22 
23 extern BOOL copy_to_shapeheader (
24 							RIFFHANDLE,
25 							ChunkShape const & cshp,
26 							SHAPEHEADER *& shphd,
27 							Chunk_With_Children * shape,
28 							int flags,
29 							int local_max_index,
30 							int * local_tex_index_nos,
31 							int listpos = GLS_NOTINLIST,
32 							const ChunkObject* object=0	  //object used so that conversion from float to int can be done in world coordinates
33 							);
34 extern BOOL copy_preprocessed_to_shapeheader (
35 							RIFFHANDLE,
36 							Shape_Preprocessed_Data_Chunk*,
37 							SHAPEHEADER *& shphd,
38 							Chunk_With_Children * shape,
39 							int flags,
40 							int local_max_index,
41 							int * local_tex_index_nos,
42 							int listpos = GLS_NOTINLIST,
43 							const ChunkObject* object=0	  //object used so that conversion from float to int can be done in world coordinates
44 							);
45 
46 extern BOOL copy_sprite_to_shapeheader (RIFFHANDLE, SHAPEHEADER *& shphd,Sprite_Header_Chunk* shc, int listpos = GLS_NOTINLIST);
47 
48 
49 extern BOOL copy_to_map6(Object_Chunk *,MAPBLOCK6*, int shplst_pos);
50 
51 extern void merge_polygons_in_chunkshape (ChunkShape & shp, Shape_Merge_Data_Chunk * smdc);
52 
53 extern File_Chunk * Env_Chunk;
54 
55 extern double local_scale;
56 
57 // copies shape to msl
58 #if SupportMorphing && LOAD_MORPH_SHAPES
59 typedef struct
60 {
61 	int start_list_pos;
62 	int main_list_pos;
63 	MORPHCTRL * mc;
64 
65 } CTM_ReturnType;
66 #else
67 typedef int CTM_ReturnType;
68 #endif
69 
70 CTM_ReturnType copy_to_mainshapelist(RIFFHANDLE,  Shape_Chunk *, int flags,const ChunkObject* object=0);
71 #define CopyToMainshapelist(h,r,p,f) copy_to_mainshapelist(h,r,p,f)
72 
73 // copies sprite to msl
74 int copy_sprite_to_mainshapelist(RIFFHANDLE, Sprite_Header_Chunk *, int flags);
75 #define CopySpriteToMainshapelist(h,p,f) copy_sprite_to_mainshapelist(h,p,f)
76 
77 // hook to load a bitmap - so you can load them from test directories, etc. should return tex index
78 extern int load_rif_bitmap (char const * fname, BMPN_Flags flags);
79 #define LoadRIFBitmap(s,f) load_rif_bitmap(s,f)
80 
81 // project specific shape pre processing - usually merge polys
82 extern void pre_process_shape (RIFFHANDLE, ChunkShape &, Chunk_With_Children * shape_chunk, int flags);
83 #define PreProcessShape(h,r,p,f) pre_process_shape(h,r,p,f)
84 
85 
86 struct _RifHandle : Project_RifHandle
87 {
88 	File_Chunk * fc;
89 	Environment_Data_Chunk * envd;
90 	Chunk_With_Children * palparent;
91 	List<int> shape_nums;
92 	int max_index;
93 	int * tex_index_nos;
94 
~_RifHandle_RifHandle95 	~_RifHandle()
96 		{}
_RifHandle_RifHandle97 	_RifHandle()
98 		: fc(0)
99 		, envd(0)
100 		, palparent(0)
101 		, max_index(0)
102 		, tex_index_nos(0)
103 		{}
104 };
105 
106 #endif
107 
108 #endif
109