1 #include "3dc.h"
2 #include "module.h"
3 
4 #include "stratdef.h"
5 #include "gamedef.h"
6 #include "comp_shp.h"
7 
8 #define UseLocalAssert Yes
9 
10 #include "ourasert.h"
11 
12 /*
13 
14 There is a small problem in the destiction between
15 compiled in shapes and binary loaded ones. I am
16 changing chnkmaps.c maps.c and shapes.c into comp_shp.c
17 comp_shp.h, comp_map.c and comp_map.h.
18 
19 We need to generate data for the game by
20 
21 1. Setting up the initial Environment
22 2. Placing the player in the environment
23 3. Generateing Activer blocks at runtime.
24 
25 To deal with these problems we can now do the following
26 
27 1 Binary Load Shapes. Link these to MAPs and SBs
28 
29 2  Have functions to modify a mapblock that describes
30  the player depending on how he entered a level
31 
32 3 Have a list of shapes that is either Compiled in
33 or loaded at game init to represent the shapes that
34 can be generated at run time. Have a set of functions
35 to gnertae MAPBLOCKS for the above.
36 
37 
38 
39 this is the compiled in shape list for AVP. For the
40 Saturn and the Playstation, these shapes may end up
41 being loaded during game init, (not level init) to
42 reduce the overall memory load
43 
44 compiled in shapes are descriptons and strategies of
45 shapes AND functions to spawn mapblocks and attach
46 strategy blocks
47 
48 To generate stuff we have a list of compiled in shapes
49 that are appended to the start of the mainshapelist.
50 
51 We then have functions that cen generate the maps and
52 strategyblocks for each. Texture maps for the shapes
53 are read in at level init along with the rest of the
54 texture maps for each env.
55 
56 procedure:
57 
58 Generate map block using reference into
59 
60 */
61 
62 #define NUM_MAR_SHAPES 14
63 
64 int maxshapes=0;
65 SHAPEHEADER ** mainshapelist=0;
66 
67 /* compiled in shapes that do not exist as yet*/
68 
69 SHAPEHEADER* MarineCompiledShapes[] = {
70 	&CUBE_header,
71 	&CUBE_header,
72     &CUBE_header,			/*MarinePlayer*/
73     &CUBE_header,            /*PredatorPlayer*/
74 	&CUBE_header,			/*AlienPlayer*/
75 	&CUBE_header, /* was &ALIEN_header, but the textures are no longer there. The old alien should be fully purged. << keywords: BUG FIXME OPTIMIZEME OPTIMISEME ERROR MISTAKE HACK >> */
76 	&CUBE_header,
77 	&CUBE_header,
78 	&CUBE_header,
79     &CUBE_header,		/* player crouch shape */
80     &CUBE_header,			/* player lying down shape */
81 	&CUBE_header,
82 	&CUBE_header,
83 	&CUBE_header,
84 	&CUBE_header,
85 	&CUBE_header,
86 	&CUBE_header,
87 	&CUBE_header,
88 	&CUBE_header,
89 	&CUBE_header,
90 	&CUBE_header,
91 	&CUBE_header,
92 	&CUBE_header,			/* alien generator */
93 };
94 
95 
96 #define STARTOF_PRECOMPILEDSHAPES 0
load_precompiled_shapes(void)97 int load_precompiled_shapes(void)
98 {
99 	static int done = 0;
100 	int i,j = 0;
101 
102 	if(!mainshapelist)
103 	{
104 		maxshapes=750;
105 		/*I'm not using AllocateMem because I'll have to realloc this later*/
106 		mainshapelist=(SHAPEHEADER**)malloc(sizeof(SHAPEHEADER*)*maxshapes);
107 		LOCALASSERT(mainshapelist);
108 		if(!mainshapelist)
109 		{
110 	   		ReleaseDirect3D();
111 			exit(0x74363);
112 		}
113 		for(i=0;i<maxshapes;i++)
114 		{
115 			mainshapelist[i]=0;
116 		}
117 	}
118 
119 	i=STARTOF_PRECOMPILEDSHAPES;
120 
121 	if (done) return i+NUM_MAR_SHAPES;
122 
123     /* KJL 11:43:36 09/24/96 - load some marine stuff hacked in 'cos the old way was even worse */
124 	while(j < NUM_MAR_SHAPES)
125 	{
126 		mainshapelist[i] = MarineCompiledShapes[j];
127 		i++;
128 		j++;
129 	}
130 
131 	done = 1;
132 
133 	return i;
134 }
135