1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
|
#ifndef _shpchunk_hpp
#define _shpchunk_hpp 1
#include "chunk.hpp"
#include "chnktype.hpp"
#include "mishchnk.hpp"
// shape flags
#define SHAPE_FLAG_PALETTISED 0x0000100
#define SHAPE_FLAG_USEZSP 0x0000200
#define SHAPE_FLAG_USEAUGZS 0x0000400
#define SHAPE_FLAG_USEAUGZSL 0x0000800
#define SHAPE_FLAG_EXTERNALFILE 0x0001000
#define SHAPE_FLAG_RECENTRED 0x0002000
#define SHAPE_FLAG_UNSTABLEBOUND_ZPOS 0x00004000
#define SHAPE_FLAG_UNSTABLEBOUND_ZNEG 0x00008000
#define SHAPE_FLAG_UNSTABLEBOUND_YPOS 0x00010000
#define SHAPE_FLAG_UNSTABLEBOUND_YNEG 0x00020000
#define SHAPE_FLAG_UNSTABLEBOUND_XPOS 0x00040000
#define SHAPE_FLAG_UNSTABLEBOUND_XNEG 0x00080000
//flags that need to be removed before being copied into the shapeheaders
#define ChunkInternalItemFlags 0x00000000
class Object_Chunk;
class Shape_Header_Chunk;
class Anim_Shape_Frame_Chunk;
class Console_Shape_Chunk;
// flags structure
enum Console_Type
{
CT_PSX=0,
CT_Saturn=1,
// IMPORTANT
// since enums are not guaranteed to assume any particular
// storage class, code compiled on different compilers or
// with different settings may result in enums to be written
// to the data block as a char and read back in as an int,
// with the three most significant bytes containing junk.
// THIS MASK MUST BE KEPT UP TO DATE AS THE ENUM IS EXTENDED;
// ALSO ENSURE THAT NEW FILES LOADED INTO OLD SOFTWARE WILL
// NOT HAVE THEIR ENUM VALUE OVER-MASKED; THE MASK IS ONLY
// HERE TO ATTEMPT TO REMOVE PROBLEMS FROM FILES MADE
// PRIOR TO ITS INTRODUCTION
CT_MASK=0xff
};
// The shape chunk contains and handles all the interface data for the
// child chunks that it recognises in ChunkShape
/*--------------------------------------------------------------------**
** N.B. all changes to shape formats should be made to the sub shapes **
**--------------------------------------------------------------------*/
class Shape_Chunk : public Lockable_Chunk_With_Children
{
public:
// constructor from buffer
Shape_Chunk (Chunk_With_Children * parent, const char *, size_t);
// constructor from data (public so that other shape tools can call)
Shape_Chunk (Chunk_With_Children * parent, ChunkShape &shp_dat);
// I want the external file load to be as transparent as possible
// i.e. we have a shape which is loaded as usaul - it should then
// load the shape which is its main copy and copy itself over !!!
// Problems will be encountered with the texturing data though -
// but this stuff should onyl be worked with with a hardware
// accelerator - so that should solve many of the problems
// destructor
virtual ~Shape_Chunk();
const ChunkShape shape_data;
Shape_Header_Chunk * get_header();
Shape_Chunk* make_copy_of_chunk();
List<Object_Chunk *> const & list_assoc_objs();
BOOL assoc_with_object(Object_Chunk *);
BOOL deassoc_with_object(Object_Chunk *);
// destroy all auxiliary chunks
// that is all except the header and the chunkshape
void destroy_auxiliary_chunks();
// functions for the locking functionality
BOOL file_equals (HANDLE &);
const char * get_head_id();
void set_lock_user(char *);
virtual void post_input_processing();
Console_Shape_Chunk* get_console_shape_data(Console_Type);
BOOL inc_v_no();
BOOL same_and_updated(Shape_Chunk &);
BOOL assoc_with_object_list(File_Chunk *);
BOOL update_my_chunkshape (ChunkShape & cshp);
// THIS IS A HACK, DO NOT USE AFTER AVP AUGUST DEMO
BOOL has_door;
private:
friend class Object_Chunk;
friend class Shape_Vertex_Chunk;
friend class Shape_Vertex_Normal_Chunk;
friend class Shape_Polygon_Normal_Chunk;
friend class Shape_Polygon_Chunk;
friend class Shape_Texture_Filenames_Chunk;
friend class Shape_UV_Coord_Chunk;
friend class Shape_Header_Chunk;
friend class Shape_External_File_Chunk;
friend class RIF_File_Chunk;
friend class File_Chunk;
friend class Shape_Centre_Chunk;
ChunkShape * shape_data_store;
static int max_id; // for id checking
};
///////////////////////////////////////////////
class Shape_Sub_Shape_Header_Chunk;
class Shape_Sub_Shape_Chunk : public Chunk_With_Children
{
public:
// constructor from buffer
Shape_Sub_Shape_Chunk (Chunk_With_Children * parent, const char *, size_t);
// constructor from data (public so that other shape tools can call)
Shape_Sub_Shape_Chunk (Chunk_With_Children * parent, ChunkShape &shp_dat);
// destructor
virtual ~Shape_Sub_Shape_Chunk();
const ChunkShape shape_data;
Shape_Sub_Shape_Header_Chunk * get_header();
Shape_Sub_Shape_Chunk* make_copy_of_chunk();
BOOL update_my_chunkshape (ChunkShape & cshp);
const char * get_shape_name();
Console_Shape_Chunk* get_console_shape_data(Console_Type);
// Number stored for list_pos when loading
int list_pos_number;
private:
friend class Shape_Vertex_Chunk;
friend class Shape_Vertex_Normal_Chunk;
friend class Shape_Polygon_Normal_Chunk;
friend class Shape_Polygon_Chunk;
friend class Shape_Texture_Filenames_Chunk;
friend class Shape_UV_Coord_Chunk;
friend class Shape_Sub_Shape_Header_Chunk;
friend class Shape_Centre_Chunk;
ChunkShape * shape_data_store;
};
///////////////////////////////////////////////
class Shape_Sub_Shape_Header_Chunk : public Chunk
{
public:
// constructor from buffer
Shape_Sub_Shape_Header_Chunk (Shape_Sub_Shape_Chunk * parent, const char * pdata, size_t psize);
~Shape_Sub_Shape_Header_Chunk();
virtual size_t size_chunk ();
virtual void fill_data_block (char * data_start);
const ChunkShape * const shape_data;
int file_id_num;
int flags;
private:
friend class Shape_Sub_Shape_Chunk;
friend class Shape_Morphing_Frame_Data_Chunk;
// constructor from data
Shape_Sub_Shape_Header_Chunk (Shape_Sub_Shape_Chunk * parent)
: Chunk (parent, "SUBSHPHD"),
shape_data(parent->shape_data_store),
file_id_num(-1), flags(0)
{}
};
///////////////////////////////////////////////
#define AnimCentreFlag_CentreSetByUser 0x00000001 //centre should not be recalculated from the extents of the sequences
class Anim_Shape_Centre_Chunk : public Chunk
{
public:
Anim_Shape_Centre_Chunk(Chunk_With_Children* const parent,const char*,size_t const);
Anim_Shape_Centre_Chunk(Chunk_With_Children* const parent);
ChunkVectorInt Centre;
int flags;
int pad2;
virtual void fill_data_block(char* data_start);
virtual size_t size_chunk();
};
///////////////////////////////////////////////
class Anim_Shape_Sequence_Chunk :public Chunk_With_Children
{
public:
//if the first constructor is used then the vertex normals and extents won't be calculated
//unless the post_input_processing function is called
Anim_Shape_Sequence_Chunk(Chunk_With_Children* const parent,const char*,size_t const);
Anim_Shape_Sequence_Chunk(Chunk_With_Children* const parent,int sequencenum,const char* name);
Anim_Shape_Sequence_Chunk(Chunk_With_Children* const parent,ChunkAnimSequence const* cas);
virtual void post_input_processing();
const ChunkAnimSequence sequence_data;
void update_my_sequencedata (ChunkAnimSequence &);
void set_sequence_flags(int flags);
void set_frame_flags(int frameno,int flags);
void GenerateInterpolatedFrames();
private :
ChunkAnimSequence *sequence_data_store;
int ConstructSequenceDataFromChildren();//copies everyting into the sequence_data
void RegenerateChildChunks();
};
///////////////////////////////////////////////
class Anim_Shape_Sequence_Data_Chunk:public Chunk
{
public:
Anim_Shape_Sequence_Data_Chunk(Anim_Shape_Sequence_Chunk* const parent,const char*,size_t const);
Anim_Shape_Sequence_Data_Chunk(Anim_Shape_Sequence_Chunk* const parent,ChunkAnimSequence* cas);
private:
friend class Anim_Shape_Sequence_Chunk;
int SequenceNum;
int flags,pad2,pad3,pad4;
char* name;
virtual size_t size_chunk();
virtual void fill_data_block(char* data_start);
};
///////////////////////////////////////////////
class Anim_Shape_Frame_Chunk : public Chunk_With_Children
{
public:
Anim_Shape_Frame_Chunk(Anim_Shape_Sequence_Chunk* const parent,const char*,size_t const);
Anim_Shape_Frame_Chunk(Anim_Shape_Sequence_Chunk * const parent,ChunkAnimFrame* caf,int frameno);
};
///////////////////////////////////////////////
class Anim_Shape_Frame_Data_Chunk : public Chunk
{
public:
Anim_Shape_Frame_Data_Chunk(Anim_Shape_Frame_Chunk* const parent,const char*,size_t const);
Anim_Shape_Frame_Data_Chunk(Anim_Shape_Frame_Chunk* const parent,ChunkAnimFrame* caf,int frameno);
private:
friend class Anim_Shape_Frame_Chunk;
friend class Anim_Shape_Sequence_Chunk;
int FrameNum;
int flags,num_interp_frames,pad3,pad4;
char* name;//name of asc file for frame
virtual size_t size_chunk();
virtual void fill_data_block(char* data_start);
};
///////////////////////////////////////////////
class Anim_Shape_Alternate_Texturing_Chunk : public Chunk_With_Children
{
public :
Anim_Shape_Alternate_Texturing_Chunk(Chunk_With_Children* const parent,const char*,size_t const);
Anim_Shape_Alternate_Texturing_Chunk(Chunk_With_Children* const parent)
:Chunk_With_Children(parent,"ASALTTEX")
{}
Shape_Sub_Shape_Chunk* CreateNewSubShape(const char* name);
};
///////////////////////////////////////////////
class Poly_Not_In_Bounding_Box_Chunk : public Chunk
{
public :
Poly_Not_In_Bounding_Box_Chunk(Chunk_With_Children* const parent,const char*,size_t const);
Poly_Not_In_Bounding_Box_Chunk(Chunk_With_Children* const parent);
virtual size_t size_chunk();
virtual void fill_data_block(char* data_start);
List<int> poly_no;
int pad1,pad2;
};
///////////////////////////////////////////////
class Console_Type_Chunk: public Chunk
{
public :
Console_Type_Chunk(Chunk_With_Children* const parent,const char* data,size_t)
:Chunk(parent,"CONSTYPE"),console((Console_Type)(*(int*)data & CT_MASK))
{}
Console_Type_Chunk(Chunk_With_Children* const parent,Console_Type ct)
:Chunk(parent,"CONSTYPE"),console(ct)
{}
Console_Type console;
virtual size_t size_chunk()
{return chunk_size=16;}
virtual void fill_data_block(char * data_start);
};
///////////////////////////////////////////////
class Console_Shape_Chunk : public Chunk_With_Children
{
public :
Console_Shape_Chunk(Chunk_With_Children* const parent,const char*,size_t);
Console_Shape_Chunk(Chunk_With_Children* const parent,Console_Type ct);
const ChunkShape shape_data;
void generate_console_chunkshape();//needs parent's chunkshape to be set up first
void update_my_chunkshape(ChunkShape&);
private:
friend class Shape_Polygon_Chunk;
friend class Shape_UV_Coord_Chunk;
ChunkShape * shape_data_store;
};
///////////////////////////////////////////////
class Shape_Vertex_Chunk : public Chunk
{
public:
virtual size_t size_chunk ()
{
return (chunk_size = (12 + (num_verts*sizeof(ChunkVectorInt))));
}
virtual BOOL output_chunk (HANDLE &);
virtual void fill_data_block (char * data_start);
const ChunkVectorInt * const vert_data;
const int num_verts;
// constructor from buffer
Shape_Vertex_Chunk (Shape_Sub_Shape_Chunk * parent, const char * vtdata, size_t vtsize);
Shape_Vertex_Chunk (Shape_Chunk * parent, const char * vtdata, size_t vtsize);
Shape_Vertex_Chunk (Anim_Shape_Frame_Chunk * parent, const char * vtdata, size_t vtsize);
private:
friend class Shape_Chunk;
friend class Shape_Sub_Shape_Chunk;
friend class Anim_Shape_Frame_Chunk;
// constructor from data
Shape_Vertex_Chunk (Shape_Sub_Shape_Chunk * parent, int n_verts)
: Chunk (parent, "SHPRAWVT"),
vert_data (parent->shape_data_store->v_list), num_verts (n_verts)
{}
Shape_Vertex_Chunk (Shape_Chunk * parent, int n_verts)
: Chunk (parent, "SHPRAWVT"),
vert_data (parent->shape_data_store->v_list), num_verts (n_verts)
{}
Shape_Vertex_Chunk (Anim_Shape_Frame_Chunk * parent,ChunkVectorInt* v_list ,int n_verts)
: Chunk (parent, "SHPRAWVT"),
vert_data (v_list), num_verts (n_verts)
{}
};
///////////////////////////////////////////////
class Shape_Vertex_Normal_Chunk: public Chunk
{
public:
// constructor from buffer
Shape_Vertex_Normal_Chunk (Shape_Sub_Shape_Chunk * parent, const char * vtdata, size_t vtsize);
Shape_Vertex_Normal_Chunk (Shape_Chunk * parent, const char * vtdata, size_t vtsize);
virtual size_t size_chunk ()
{
return (chunk_size = (12 + (num_verts*sizeof(ChunkVectorFloat))));
}
virtual BOOL output_chunk (HANDLE &);
virtual void fill_data_block (char * data_start);
const ChunkVectorFloat * const vert_norm_data;
const int num_verts;
private:
friend class Shape_Chunk;
friend class Shape_Sub_Shape_Chunk;
// constructor from data
Shape_Vertex_Normal_Chunk (Shape_Sub_Shape_Chunk * parent, int n_verts)
: Chunk (parent, "SHPVNORM"),
vert_norm_data (parent->shape_data_store->v_normal_list), num_verts (n_verts)
{}
Shape_Vertex_Normal_Chunk (Shape_Chunk * parent, int n_verts)
: Chunk (parent, "SHPVNORM"),
vert_norm_data (parent->shape_data_store->v_normal_list), num_verts (n_verts)
{}
};
///////////////////////////////////////////////
class Shape_Polygon_Normal_Chunk: public Chunk
{
public:
// constructor from buffer
Shape_Polygon_Normal_Chunk (Shape_Sub_Shape_Chunk * parent, const char * pndata, size_t pnsize);
Shape_Polygon_Normal_Chunk (Shape_Chunk * parent, const char * pndata, size_t pnsize);
Shape_Polygon_Normal_Chunk (Anim_Shape_Frame_Chunk * parent, const char * pndata, size_t pnsize);
virtual size_t size_chunk ()
{
return (chunk_size = (12 + (num_polys*sizeof(ChunkVectorFloat))));
}
virtual BOOL output_chunk (HANDLE &);
virtual void fill_data_block (char * data_start);
const ChunkVectorFloat * const poly_norm_data;
const int num_polys;
private:
friend class Shape_Chunk;
friend class Shape_Sub_Shape_Chunk;
friend class Anim_Shape_Frame_Chunk;
// constructor from data
Shape_Polygon_Normal_Chunk (Shape_Sub_Shape_Chunk * parent, int n_polys)
: Chunk (parent, "SHPPNORM"),
poly_norm_data (parent->shape_data_store->p_normal_list), num_polys (n_polys)
{}
Shape_Polygon_Normal_Chunk (Shape_Chunk * parent, int n_polys)
: Chunk (parent, "SHPPNORM"),
poly_norm_data (parent->shape_data_store->p_normal_list), num_polys (n_polys)
{}
Shape_Polygon_Normal_Chunk (Anim_Shape_Frame_Chunk * parent,ChunkVectorFloat* p_normal_list ,int n_polys)
: Chunk (parent, "SHPPNORM"),
poly_norm_data (p_normal_list), num_polys (n_polys)
{}
};
///////////////////////////////////////////////
class Shape_Polygon_Chunk : public Chunk
{
public:
// constructor from buffer
Shape_Polygon_Chunk (Shape_Sub_Shape_Chunk * parent, const char * pdata, size_t psize);
Shape_Polygon_Chunk (Shape_Chunk * parent, const char * pdata, size_t psize);
Shape_Polygon_Chunk (Console_Shape_Chunk * parent, const char * pdata, size_t psize);
virtual size_t size_chunk ()
{
return (chunk_size = (12 + (num_polys*36)));// 36 bytes per vertex
}
virtual BOOL output_chunk (HANDLE &);
virtual void fill_data_block (char * data_start);
const ChunkPoly * const poly_data;
const int num_polys;
private:
friend class Shape_Chunk;
friend class Shape_Sub_Shape_Chunk;
friend class Console_Shape_Chunk;
// constructor from data
Shape_Polygon_Chunk (Shape_Sub_Shape_Chunk * parent, int n_polys)
: Chunk (parent, "SHPPOLYS"),
poly_data (parent->shape_data_store->poly_list), num_polys (n_polys)
{}
Shape_Polygon_Chunk (Shape_Chunk * parent, int n_polys)
: Chunk (parent, "SHPPOLYS"),
poly_data (parent->shape_data_store->poly_list), num_polys (n_polys)
{}
Shape_Polygon_Chunk (Console_Shape_Chunk * parent, int n_polys)
: Chunk (parent, "SHPPOLYS"),
poly_data (parent->shape_data_store->poly_list), num_polys (n_polys)
{}
};
///////////////////////////////////////////////
class Shape_Header_Chunk : public Chunk
{
public:
// constructor from buffer
Shape_Header_Chunk (Shape_Chunk * parent, const char * pdata, size_t psize);
~Shape_Header_Chunk();
virtual size_t size_chunk ();
virtual BOOL output_chunk (HANDLE &);
virtual void fill_data_block (char * data_start);
const ChunkShape * const shape_data;
virtual void prepare_for_output();
char lock_user[17];
List<char *> object_names_store;
int flags;
private:
friend class Shape_Chunk;
friend class Object_Chunk;
friend class RIF_File_Chunk;
friend class File_Chunk;
friend class Environment;
friend class Shape_Morphing_Frame_Data_Chunk;
friend class Shape_External_File_Chunk;
int version_no;
int file_id_num;
List<Object_Chunk *> associated_objects_store;
// constructor from data
Shape_Header_Chunk (Shape_Chunk * parent)
: Chunk (parent, "SHPHEAD1"),
shape_data(parent->shape_data_store),
flags(0), version_no(0), file_id_num(-1)
{}
};
///////////////////////////////////////////////
class Shape_Centre_Chunk : public Chunk
{
public :
// constructor from buffer
Shape_Centre_Chunk (Chunk_With_Children * parent, const char * data, size_t datasize);
virtual size_t size_chunk ()
{return chunk_size=4*4+12;}
virtual void fill_data_block (char * data_start);
private:
friend class Shape_Chunk;
friend class Shape_Sub_Shape_Chunk;
// constructor from data
Shape_Centre_Chunk (Chunk_With_Children * parent)
: Chunk (parent, "SHPCENTR")
{}
//the data for this chunk is stored in its parent's ChunkShape
};
///////////////////////////////////////////////
class Shape_UV_Coord_Chunk : public Chunk
{
public:
// constructor from buffer
Shape_UV_Coord_Chunk (Shape_Sub_Shape_Chunk * parent, const char * uvdata, size_t uvsize);
Shape_UV_Coord_Chunk (Shape_Chunk * parent, const char * uvdata, size_t uvsize);
Shape_UV_Coord_Chunk (Console_Shape_Chunk * parent, const char * uvdata, size_t uvsize);
virtual size_t size_chunk ();
virtual BOOL output_chunk (HANDLE &);
virtual void fill_data_block (char * data_start);
const ChunkUV_List * const uv_data;
const int num_uvs;
private:
friend class Shape_Chunk;
friend class Shape_Sub_Shape_Chunk;
friend class Console_Shape_Chunk;
// constructor from data
Shape_UV_Coord_Chunk (Shape_Sub_Shape_Chunk * parent, int n_uvs)
: Chunk (parent, "SHPUVCRD"),
uv_data (parent->shape_data_store->uv_list), num_uvs (n_uvs)
{}
Shape_UV_Coord_Chunk (Shape_Chunk * parent, int n_uvs)
: Chunk (parent, "SHPUVCRD"),
uv_data (parent->shape_data_store->uv_list), num_uvs (n_uvs)
{}
Shape_UV_Coord_Chunk (Console_Shape_Chunk * parent, int n_uvs)
: Chunk (parent, "SHPUVCRD"),
uv_data (parent->shape_data_store->uv_list), num_uvs (n_uvs)
{}
};
///////////////////////////////////////////////
class Shape_Texture_Filenames_Chunk : public Chunk
{
public:
// constructor from buffer
Shape_Texture_Filenames_Chunk (Shape_Sub_Shape_Chunk * parent, const char * tfndata, size_t tfnsize);
Shape_Texture_Filenames_Chunk (Shape_Chunk * parent, const char * tfndata, size_t tfnsize);
virtual size_t size_chunk ();
virtual BOOL output_chunk (HANDLE &);
virtual void fill_data_block (char * data_start);
char ** tex_fns;
const int num_tex_fns;
private:
friend class Shape_Chunk;
friend class Shape_Sub_Shape_Chunk;
// constructor from data
Shape_Texture_Filenames_Chunk (Shape_Sub_Shape_Chunk * parent, int n_tfns)
: Chunk (parent, "SHPTEXFN"),
tex_fns (parent->shape_data_store->texture_fns), num_tex_fns (n_tfns)
{}
Shape_Texture_Filenames_Chunk (Shape_Chunk * parent, int n_tfns)
: Chunk (parent, "SHPTEXFN"),
tex_fns (parent->shape_data_store->texture_fns), num_tex_fns (n_tfns)
{}
};
///////////////////////////////////////////////
class Shape_Merge_Data_Chunk : public Chunk
{
public:
Shape_Merge_Data_Chunk (Shape_Sub_Shape_Chunk * parent, int *, int);
Shape_Merge_Data_Chunk (Shape_Chunk * parent, int *, int);
~Shape_Merge_Data_Chunk ();
int * merge_data;
int num_polys;
size_t size_chunk()
{
return chunk_size = 12 + num_polys*4;
}
void fill_data_block (char *);
Shape_Merge_Data_Chunk (Shape_Sub_Shape_Chunk * parent, const char *, size_t);
Shape_Merge_Data_Chunk (Shape_Chunk * parent, const char *, size_t);
};
///////////////////////////////////////////////
class Shape_External_File_Chunk : public Chunk_With_Children
{
public:
Shape_External_File_Chunk (Chunk_With_Children * parent, const char * fname);
Shape_External_File_Chunk (Chunk_With_Children * const parent, const char *, size_t const);
void post_input_processing();
#if cencon || InterfaceEngine
void update_from_external_rif(BOOL force_scale_update);
#endif
//gets name from shape_external_object_name_chunk if it has one
//otherwise takes name from rif_name_chunk
const char * get_shape_name();
private:
friend class Shape_Chunk;
friend class Shape_Sub_Shape_Chunk;
//Used to avoid updating external shapes in files that have been loaded
//by Shape_External_File_Chunk::post_input_processing
static BOOL UpdatingExternalShape;
};
///////////////////////////////////////////////
class Shape_External_Filename_Chunk : public Chunk
{
public:
Shape_External_Filename_Chunk (Chunk_With_Children * parent, const char * fname);
Shape_External_Filename_Chunk (Chunk_With_Children * parent, const char *, size_t);
~Shape_External_Filename_Chunk ();
// Here is stored the shape name, rescale value and version number.
char * file_name;
double rescale;
int version_no;
size_t size_chunk()
{
return chunk_size = 12 + 8 + 4 + strlen(file_name) + (4-strlen(file_name)%4);
}
void fill_data_block (char *);
private:
friend class Shape_External_File_Chunk;
friend class Sprite_Header_Chunk;
};
///////////////////////////////////////////////
//This is needed if more than one shape is being imported from a rif file
class Shape_External_Object_Name_Chunk : public Chunk
{
public :
Shape_External_Object_Name_Chunk(Chunk_With_Children * parent, const char * fname);
Shape_External_Object_Name_Chunk (Chunk_With_Children * parent, const char *, size_t);
~Shape_External_Object_Name_Chunk();
int pad;
char* object_name;
char* shape_name; //a combination of object and file name
size_t size_chunk()
{
return chunk_size = 12 +4+ strlen(object_name) + (4-strlen(object_name)%4);
}
void post_input_processing();
void fill_data_block (char *);
private:
friend class Shape_External_File_Chunk;
};
///////////////////////////////////////////////
class Shape_Morphing_Data_Chunk : public Chunk_With_Children
{
public:
Shape_Morphing_Data_Chunk (Shape_Chunk * parent)
: Chunk_With_Children (parent, "SHPMORPH"), parent_shape (parent) {}
Shape_Chunk * parent_shape;
Shape_Sub_Shape_Chunk * parent_sub_shape;
virtual void prepare_for_output();
Shape_Morphing_Data_Chunk (Shape_Chunk * parent, const char *, size_t);
Shape_Morphing_Data_Chunk (Shape_Sub_Shape_Chunk * parent, const char *, size_t);
};
///////////////////////////////////////////////
class Shape_Morphing_Frame_Data_Chunk : public Chunk
{
public:
// constructor from wherever
Shape_Morphing_Frame_Data_Chunk (Shape_Morphing_Data_Chunk * parent)
: Chunk (parent, "FRMMORPH"), num_frames(0), frame_store(0)
{}
// constructor from buffer
Shape_Morphing_Frame_Data_Chunk (Shape_Morphing_Data_Chunk * parent,const char *, size_t);
~Shape_Morphing_Frame_Data_Chunk();
int a_flags;
int a_speed;
List<a_frame *> anim_frames;
virtual void fill_data_block (char *);
virtual size_t size_chunk ()
{
return (chunk_size = 12 + 12 + num_frames * 12);
}
virtual void prepare_for_output();
virtual void post_input_processing();
private:
int num_frames;
int * frame_store;
friend class Shape_Morphing_Data_Chunk;
};
///////////////////////////////////////////////
class Shape_Poly_Change_Info_Chunk : public Chunk
{
public:
Shape_Poly_Change_Info_Chunk (Shape_Chunk * parent, List<poly_change_info> & pci, int orig_num_v)
: Chunk (parent, "SHPPCINF"), original_num_verts (orig_num_v), change_list (pci)
{}
int original_num_verts;
List<poly_change_info> change_list;
virtual void fill_data_block (char *);
virtual size_t size_chunk ()
{
return (chunk_size = 12 + 4 + 4 + change_list.size() * 12);
}
Shape_Poly_Change_Info_Chunk (Chunk_With_Children * parent,const char *, size_t);
};
///////////////////////////////////////////////
class Shape_Name_Chunk : public Chunk
{
public:
Shape_Name_Chunk (Chunk_With_Children * parent, const char * rname);
// constructor from buffer
Shape_Name_Chunk (Chunk_With_Children * parent, const char * sdata, size_t ssize);
~Shape_Name_Chunk();
char * shape_name;
virtual size_t size_chunk ()
{
return (chunk_size = 12 + strlen (shape_name) + 4 - strlen (shape_name)%4);
}
virtual void fill_data_block (char * data_start);
private:
friend class Shape_Sub_Shape_Chunk;
};
///////////////////////////////////////////////
class Shape_Fragments_Chunk : public Chunk_With_Children
{
public:
Shape_Fragments_Chunk (Chunk_With_Children * parent)
: Chunk_With_Children (parent, "SHPFRAGS")
{}
Shape_Fragments_Chunk (Chunk_With_Children * const parent, char const *, const size_t);
};
///////////////////////////////////////////////
class Shape_Fragment_Type_Chunk : public Chunk
{
public :
Shape_Fragment_Type_Chunk(Chunk_With_Children* parent,const char* name);
Shape_Fragment_Type_Chunk (Chunk_With_Children * const parent,const char *, size_t const);
~Shape_Fragment_Type_Chunk();
size_t size_chunk ();
void fill_data_block (char * data_start);
char* frag_type_name;
int pad1,pad2;
};
///////////////////////////////////////////////
class Shape_Fragments_Data_Chunk : public Chunk
{
public:
Shape_Fragments_Data_Chunk (Chunk_With_Children * parent, int num_frags)
: Chunk (parent, "FRAGDATA"), num_fragments (num_frags),
pad1(0), pad2(0), pad3(0)
{}
Shape_Fragments_Data_Chunk (Chunk_With_Children * parent, const char * sdata, size_t ssize);
int num_fragments;
int pad1, pad2, pad3;
virtual size_t size_chunk ()
{
return (chunk_size = 12 + 16);
}
virtual void fill_data_block (char *);
private:
friend class Shape_Sub_Shape_Chunk;
};
///////////////////////////////////////////////
class Shape_Fragment_Location_Chunk : public Chunk
{
public:
Shape_Fragment_Location_Chunk (Chunk_With_Children * parent, ChunkVectorInt & location)
: Chunk (parent, "FRAGLOCN"), frag_loc (location),
pad1(0), pad2(0), pad3(0), pad4(0)
{}
Shape_Fragment_Location_Chunk (Chunk_With_Children * parent, const char * sdata, size_t ssize);
ChunkVectorInt frag_loc;
int pad1, pad2, pad3, pad4;
virtual size_t size_chunk ()
{
return (chunk_size = 12 + 28);
}
virtual void fill_data_block (char *);
private:
friend class Shape_Sub_Shape_Chunk;
};
///////////////////////////////////////////////
class Shape_Preprocessed_Data_Chunk : public Chunk
{
public:
Shape_Preprocessed_Data_Chunk (Chunk_With_Children * parent,int _blocksize,int _first_pointer,unsigned int* _memory_block);
Shape_Preprocessed_Data_Chunk (Chunk_With_Children * parent, const char * data, size_t ssize);
~Shape_Preprocessed_Data_Chunk ()
{
if(extra_data) delete extra_data;
if(memory_block) delete memory_block;
}
virtual size_t size_chunk ()
{
return (chunk_size = 12 + 12+block_size*4+num_extra_data*4);
}
virtual void fill_data_block (char *);
int num_extra_data;
int* extra_data;
void* GetMemoryBlock();
private:
int block_size;
int first_pointer;
unsigned int* memory_block;
friend class Shape_Chunk;
friend class Shape_Sub_Shape_Chunk;
};
#endif
|