annotate shipbitmaps.c @ 3:5a977ccbc7a9 default tip

Empty changelog
author darius
date Sat, 06 Dec 1997 05:41:29 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
1 /* $Id: shipbitmaps.c,v 1.1.1.1 1997/12/06 05:41:30 darius Exp $ */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
2
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
3 /* with this file, now the user can define and develop new ship bitmap
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
4 sets ('albums') more easily.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
5
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
6 The user need only create a file in the proper directory with the
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
7 proper name with the proper format. The directory is specified by the
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
8 shipBitmapPath resource in the .xtrekrc. Its default is
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
9 /usr/games/lib/netrek. The name of the file is "R%d.C%d" where the
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
10 first integer is the race number and the second is the ship class
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
11 number.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
12
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
13 The format of the file is: 3 4-byte integers in network byte order.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
14 The first is the number of views in the file (this field is currently
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
15 ignored but should have the value 16). The second integer is the
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
16 width and the third is the height. Then follows raw bitmap data. I
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
17 don't know what the format is, but it's basically a binary version of
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
18 the X bitmap file format. Translate those hex numbers to raw bytes
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
19 and you have it. I can tell you that each line is padded to 8 bits.
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
20
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
21 */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
22
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
23 #include <stdio.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
24 #ifndef AMIGA
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
25 #include <sys/param.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
26 #include <netinet/in.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
27 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
28 #include <errno.h>
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
29
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
30 #ifdef m_flags
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
31 /* appears under HPUX */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
32 #undef m_flags
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
33 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
34
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
35 #include "Wlib.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
36 #include "defs.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
37 #include "struct.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
38 #include "data.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
39 #include "gameconf.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
40
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
41 #ifdef NOSHIPBITMAPS
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
42 #include "bitmaps_CASB.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
43 #else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
44 #include "bitmaps_NEW.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
45 #ifdef HOCKEY
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
46 #include "puck.h"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
47 #endif /*HOCKEY*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
48 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
49
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
50 static int
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
51 get_ship_width(team, shipn)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
52 int team, shipn;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
53 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
54 #ifndef NOSHIPBITMAPS
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
55 if (shipn == ATT && paradise)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
56 return att_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
57 switch (team) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
58 case 0:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
59 switch (shipn) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
60 #ifdef HOCKEY
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
61 case PUCK:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
62 return puck_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
63 #endif /*HOCKEY*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
64 case SCOUT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
65 return fed_scout_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
66 case DESTROYER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
67 return fed_destroyer_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
68 case CRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
69 return fed_cruiser_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
70 case BATTLESHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
71 return fed_battleship_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
72 case ASSAULT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
73 return fed_assault_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
74 case STARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
75 return fed_starbase_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
76 case JUMPSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
77 return fed_jumpship_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
78 case FLAGSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
79 return fed_galaxy_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
80 case GALAXY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
81 return fed_galaxy_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
82 case WARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
83 return fed_warbase_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
84 case LIGHTCRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
85 return fed_lightcruiser_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
86 case CARRIER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
87 return fed_carrier_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
88 case UTILITY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
89 return fed_utility_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
90 case PATROL:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
91 return fed_patrol_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
92 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
93 case 1:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
94 switch (shipn) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
95 #ifdef HOCKEY
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
96 case PUCK:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
97 return puck_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
98 #endif /*HOCKEY*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
99 case SCOUT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
100 return rom_scout_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
101 case DESTROYER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
102 return rom_destroyer_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
103 case CRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
104 return rom_cruiser_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
105 case BATTLESHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
106 return rom_battleship_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
107 case ASSAULT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
108 return rom_assault_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
109 case STARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
110 return rom_starbase_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
111 case JUMPSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
112 return rom_jumpship_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
113 case FLAGSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
114 return rom_galaxy_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
115 case GALAXY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
116 return rom_galaxy_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
117 case WARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
118 return rom_warbase_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
119 case LIGHTCRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
120 return rom_lightcruiser_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
121 case CARRIER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
122 return rom_carrier_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
123 case UTILITY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
124 return rom_utility_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
125 case PATROL:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
126 return rom_patrol_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
127 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
128 case 2:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
129 switch (shipn) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
130 #ifdef HOCKEY
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
131 case PUCK:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
132 return puck_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
133 #endif /*HOCKEY*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
134 case SCOUT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
135 return kli_scout_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
136 case DESTROYER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
137 return kli_destroyer_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
138 case CRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
139 return kli_cruiser_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
140 case BATTLESHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
141 return kli_battleship_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
142 case ASSAULT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
143 return kli_assault_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
144 case STARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
145 return kli_starbase_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
146 case JUMPSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
147 return kli_jumpship_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
148 case FLAGSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
149 return kli_galaxy_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
150 case GALAXY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
151 return kli_galaxy_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
152 case WARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
153 return kli_warbase_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
154 case LIGHTCRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
155 return kli_lightcruiser_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
156 case CARRIER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
157 return kli_carrier_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
158 case UTILITY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
159 return kli_utility_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
160 case PATROL:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
161 return kli_patrol_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
162 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
163 case 3:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
164 switch (shipn) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
165 #ifdef HOCKEY
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
166 case PUCK:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
167 return puck_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
168 #endif /*HOCKEY*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
169 case SCOUT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
170 return ori_scout_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
171 case DESTROYER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
172 return ori_destroyer_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
173 case CRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
174 return ori_cruiser_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
175 case BATTLESHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
176 return ori_battleship_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
177 case ASSAULT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
178 return ori_assault_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
179 case STARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
180 return ori_starbase_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
181 case JUMPSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
182 return ori_jumpship_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
183 case FLAGSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
184 return ori_galaxy_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
185 case GALAXY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
186 return ori_galaxy_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
187 case WARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
188 return ori_warbase_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
189 case LIGHTCRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
190 return ori_lightcruiser_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
191 case CARRIER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
192 return ori_carrier_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
193 case UTILITY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
194 return ori_utility_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
195 case PATROL:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
196 return ori_patrol_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
197 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
198 case -1:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
199 switch (shipn) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
200 #ifdef HOCKEY
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
201 case PUCK:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
202 return puck_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
203 #endif /*HOCKEY*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
204 case SCOUT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
205 return ind_scout_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
206 case DESTROYER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
207 return ind_destroyer_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
208 case CRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
209 return ind_cruiser_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
210 case BATTLESHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
211 return ind_battleship_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
212 case ASSAULT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
213 return ind_assault_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
214 case STARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
215 return ind_starbase_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
216 case JUMPSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
217 return ind_starbase_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
218 case FLAGSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
219 return ind_galaxy_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
220 case GALAXY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
221 return ind_galaxy_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
222 case WARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
223 return ind_starbase_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
224 case LIGHTCRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
225 return ind_lightcruiser_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
226 case CARRIER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
227 return ind_carrier_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
228 case UTILITY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
229 return ind_utility_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
230 case PATROL:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
231 return ind_patrol_width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
232 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
233 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
234 #endif /* NOSHIPBITMAPS */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
235 return 20;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
236 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
237
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
238
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
239 static int
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
240 get_ship_height(team, shipn)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
241 int team, shipn;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
242 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
243 #ifndef NOSHIPBITMAPS
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
244 if (shipn == ATT && paradise)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
245 return att_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
246 switch (team) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
247 case 0:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
248 switch (shipn) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
249 #ifdef HOCKEY
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
250 case PUCK:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
251 return puck_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
252 #endif /*HOCKEY*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
253 case SCOUT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
254 return fed_scout_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
255 case DESTROYER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
256 return fed_destroyer_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
257 case CRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
258 return fed_cruiser_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
259 case BATTLESHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
260 return fed_battleship_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
261 case ASSAULT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
262 return fed_assault_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
263 case STARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
264 return fed_starbase_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
265 case JUMPSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
266 return fed_jumpship_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
267 case FLAGSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
268 return fed_galaxy_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
269 case GALAXY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
270 return fed_galaxy_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
271 case WARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
272 return fed_warbase_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
273 case LIGHTCRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
274 return fed_lightcruiser_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
275 case CARRIER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
276 return fed_carrier_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
277 case UTILITY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
278 return fed_utility_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
279 case PATROL:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
280 return fed_patrol_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
281 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
282 case 1:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
283 switch (shipn) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
284 #ifdef HOCKEY
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
285 case PUCK:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
286 return puck_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
287 #endif /*HOCKEY*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
288 case SCOUT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
289 return rom_scout_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
290 case DESTROYER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
291 return rom_destroyer_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
292 case CRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
293 return rom_cruiser_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
294 case BATTLESHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
295 return rom_battleship_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
296 case ASSAULT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
297 return rom_assault_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
298 case STARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
299 return rom_starbase_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
300 case JUMPSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
301 return rom_jumpship_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
302 case FLAGSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
303 return rom_galaxy_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
304 case GALAXY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
305 return rom_galaxy_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
306 case WARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
307 return rom_warbase_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
308 case LIGHTCRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
309 return rom_lightcruiser_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
310 case CARRIER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
311 return rom_carrier_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
312 case UTILITY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
313 return rom_utility_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
314 case PATROL:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
315 return rom_patrol_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
316 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
317 case 2:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
318 switch (shipn) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
319 #ifdef HOCKEY
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
320 case PUCK:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
321 return puck_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
322 #endif /*HOCKEY*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
323 case SCOUT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
324 return kli_scout_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
325 case DESTROYER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
326 return kli_destroyer_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
327 case CRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
328 return kli_cruiser_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
329 case BATTLESHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
330 return kli_battleship_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
331 case ASSAULT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
332 return kli_assault_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
333 case STARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
334 return kli_starbase_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
335 case JUMPSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
336 return kli_jumpship_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
337 case FLAGSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
338 return kli_galaxy_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
339 case GALAXY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
340 return kli_galaxy_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
341 case WARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
342 return kli_warbase_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
343 case LIGHTCRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
344 return kli_lightcruiser_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
345 case CARRIER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
346 return kli_carrier_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
347 case UTILITY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
348 return kli_utility_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
349 case PATROL:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
350 return kli_patrol_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
351 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
352 case 3:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
353 switch (shipn) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
354 #ifdef HOCKEY
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
355 case PUCK:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
356 return puck_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
357 #endif /*HOCKEY*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
358 case SCOUT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
359 return ori_scout_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
360 case DESTROYER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
361 return ori_destroyer_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
362 case CRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
363 return ori_cruiser_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
364 case BATTLESHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
365 return ori_battleship_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
366 case ASSAULT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
367 return ori_assault_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
368 case STARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
369 return ori_starbase_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
370 case JUMPSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
371 return ori_jumpship_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
372 case FLAGSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
373 return ori_galaxy_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
374 case GALAXY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
375 return ori_galaxy_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
376 case WARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
377 return ori_warbase_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
378 case LIGHTCRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
379 return ori_lightcruiser_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
380 case CARRIER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
381 return ori_carrier_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
382 case UTILITY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
383 return ori_utility_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
384 case PATROL:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
385 return ori_patrol_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
386 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
387 case -1:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
388 switch (shipn) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
389 #ifdef HOCKEY
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
390 case PUCK:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
391 return puck_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
392 #endif /*HOCKEY*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
393 case SCOUT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
394 return ind_scout_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
395 case DESTROYER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
396 return ind_destroyer_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
397 case CRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
398 return ind_cruiser_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
399 case BATTLESHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
400 return ind_battleship_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
401 case ASSAULT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
402 return ind_assault_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
403 case STARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
404 return ind_starbase_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
405 case JUMPSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
406 return ind_starbase_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
407 case FLAGSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
408 return ind_galaxy_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
409 case GALAXY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
410 return ind_galaxy_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
411 case WARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
412 return ind_starbase_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
413 case LIGHTCRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
414 return ind_lightcruiser_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
415 case CARRIER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
416 return ind_carrier_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
417 case UTILITY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
418 return ind_utility_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
419 case PATROL:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
420 return ind_patrol_height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
421 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
422 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
423 #endif /* NOSHIPBITMAPS */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
424 return 20;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
425 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
426
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
427 static int
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
428 get_ship_nviews(shipn)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
429 int shipn;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
430 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
431 if (shipn == STARBASE ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
432 shipn == WARBASE ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
433 shipn == JUMPSHIP
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
434 #ifdef HOCKEY
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
435 || shipn == PUCK
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
436 #endif /*HOCKEY*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
437 )
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
438 return 1;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
439 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
440 return 16;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
441 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
442
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
443 static unsigned char *
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
444 get_ship_bits(team, shipn, view)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
445 int team, shipn;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
446 int view;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
447 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
448 #ifndef NOSHIPBITMAPS
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
449 if (shipn == ATT && paradise) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
450 if (view > 0)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
451 view = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
452 return att_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
453 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
454 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
455 if (view > 16)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
456 view = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
457 switch (team) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
458 case 0:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
459 #ifndef NOSHIPBITMAPS
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
460 switch (shipn) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
461 #ifdef HOCKEY
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
462 case PUCK:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
463 return puck_bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
464 #endif /*HOCKEY*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
465 case SCOUT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
466 return fed_scout_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
467 case DESTROYER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
468 return fed_destroyer_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
469 case CRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
470 return fed_cruiser_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
471 case BATTLESHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
472 return fed_battleship_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
473 case ASSAULT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
474 return fed_assault_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
475 case STARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
476 return fed_starbase_bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
477 case JUMPSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
478 return fed_jumpship_bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
479 case FLAGSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
480 return fed_galaxy_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
481 case GALAXY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
482 return fed_galaxy_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
483 case WARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
484 return fed_warbase_bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
485 case LIGHTCRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
486 return fed_lightcruiser_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
487 case CARRIER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
488 return fed_carrier_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
489 case UTILITY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
490 return fed_utility_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
491 case PATROL:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
492 return fed_patrol_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
493 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
494 #else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
495 if (get_ship_nviews(shipn) == 1)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
496 return fed_starbase_bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
497 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
498 return fed_cruiser_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
499 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
500 case 1:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
501 #ifndef NOSHIPBITMAPS
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
502 switch (shipn) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
503 #ifdef HOCKEY
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
504 case PUCK:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
505 return puck_bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
506 #endif /*HOCKEY*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
507 case SCOUT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
508 return rom_scout_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
509 case DESTROYER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
510 return rom_destroyer_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
511 case CRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
512 return rom_cruiser_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
513 case BATTLESHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
514 return rom_battleship_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
515 case ASSAULT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
516 return rom_assault_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
517 case STARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
518 return rom_starbase_bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
519 case JUMPSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
520 return rom_jumpship_bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
521 case FLAGSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
522 return rom_galaxy_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
523 case GALAXY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
524 return rom_galaxy_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
525 case WARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
526 return rom_warbase_bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
527 case LIGHTCRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
528 return rom_lightcruiser_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
529 case CARRIER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
530 return rom_carrier_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
531 case UTILITY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
532 return rom_utility_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
533 case PATROL:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
534 return rom_patrol_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
535 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
536 #else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
537 if (get_ship_nviews(shipn) == 1)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
538 return rom_starbase_bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
539 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
540 return rom_cruiser_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
541 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
542 case 2:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
543 #ifndef NOSHIPBITMAPS
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
544 switch (shipn) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
545 #ifdef HOCKEY
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
546 case PUCK:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
547 return puck_bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
548 #endif /*HOCKEY*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
549 case SCOUT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
550 return kli_scout_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
551 case DESTROYER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
552 return kli_destroyer_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
553 case CRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
554 return kli_cruiser_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
555 case BATTLESHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
556 return kli_battleship_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
557 case ASSAULT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
558 return kli_assault_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
559 case STARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
560 return kli_starbase_bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
561 case JUMPSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
562 return kli_jumpship_bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
563 case FLAGSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
564 return kli_galaxy_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
565 case GALAXY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
566 return kli_galaxy_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
567 case WARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
568 return kli_warbase_bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
569 case LIGHTCRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
570 return kli_lightcruiser_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
571 case CARRIER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
572 return kli_carrier_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
573 case UTILITY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
574 return kli_utility_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
575 case PATROL:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
576 return kli_patrol_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
577 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
578 #else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
579 if (get_ship_nviews(shipn) == 1)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
580 return kli_starbase_bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
581 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
582 return kli_cruiser_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
583 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
584 case 3:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
585 #ifndef NOSHIPBITMAPS
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
586 switch (shipn) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
587 #ifdef HOCKEY
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
588 case PUCK:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
589 return puck_bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
590 #endif /*HOCKEY*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
591 case SCOUT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
592 return ori_scout_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
593 case DESTROYER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
594 return ori_destroyer_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
595 case CRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
596 return ori_cruiser_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
597 case BATTLESHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
598 return ori_battleship_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
599 case ASSAULT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
600 return ori_assault_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
601 case STARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
602 return ori_starbase_bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
603 case JUMPSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
604 return ori_jumpship_bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
605 case FLAGSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
606 return ori_galaxy_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
607 case GALAXY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
608 return ori_galaxy_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
609 case WARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
610 return ori_warbase_bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
611 case LIGHTCRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
612 return ori_lightcruiser_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
613 case CARRIER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
614 return ori_carrier_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
615 case UTILITY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
616 return ori_utility_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
617 case PATROL:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
618 return ori_patrol_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
619 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
620 #else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
621 if (get_ship_nviews(shipn) == 1)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
622 return ori_starbase_bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
623 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
624 return ori_cruiser_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
625 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
626 case -1:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
627 #ifndef NOSHIPBITMAPS
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
628 switch (shipn) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
629 #ifdef HOCKEY
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
630 case PUCK:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
631 return puck_bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
632 #endif /*HOCKEY*/
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
633 case SCOUT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
634 return ind_scout_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
635 case DESTROYER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
636 return ind_destroyer_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
637 case CRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
638 return ind_cruiser_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
639 case BATTLESHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
640 return ind_battleship_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
641 case ASSAULT:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
642 return ind_assault_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
643 case STARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
644 return ind_starbase_bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
645 case JUMPSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
646 return ind_starbase_bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
647 case FLAGSHIP:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
648 return ind_galaxy_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
649 case GALAXY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
650 return ind_galaxy_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
651 case WARBASE:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
652 return ind_starbase_bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
653 case LIGHTCRUISER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
654 return ind_lightcruiser_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
655 case CARRIER:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
656 return ind_carrier_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
657 case UTILITY:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
658 return ind_utility_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
659 case PATROL:
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
660 return ind_patrol_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
661 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
662 #else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
663 if (get_ship_nviews(shipn) == 1)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
664 return fed_starbase_bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
665 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
666 return fed_cruiser_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
667 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
668 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
669 return fed_cruiser_bits[view];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
670 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
671
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
672
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
673 /* points at the beginning of the fed ship shapes. Independent are
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
674 at negative indices */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
675 static struct ship_shape *all_ship_shapes = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
676
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
677 struct ship_shape *
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
678 shape_of_ship(team, shipclass)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
679 int team, shipclass;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
680 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
681 if (team < -1 || team >= number_of_teams ||
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
682 shipclass < 0 || shipclass >= nshiptypes)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
683 return &all_ship_shapes[-nshiptypes];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
684 return &all_ship_shapes[team * nshiptypes + shipclass];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
685 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
686
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
687 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
688 clear_one_ship_shape(shp)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
689 struct ship_shape *shp;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
690 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
691 int j;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
692 for (j = 0; j < shp->nviews; j++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
693 W_FreeBitmap(shp->bmap[j]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
694 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
695 shp->nviews = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
696 free(shp->bmap);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
697 shp->bmap = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
698 W_FreeBitmap(shp->shield);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
699 shp->shield = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
700 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
701
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
702 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
703 free_shipshapes()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
704 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
705 /* don't forget that IND offset */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
706 int race, i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
707 if (!all_ship_shapes) /* if nothing there to begin with */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
708 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
709 for (race = -1; race < number_of_teams; race++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
710 for (i = 0; i < nshiptypes; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
711 clear_one_ship_shape(shape_of_ship(race, i));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
712 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
713 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
714 free(all_ship_shapes - nshiptypes);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
715 all_ship_shapes = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
716 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
717
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
718 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
719 slurp_ship_bitmaps()
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
720 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
721 int i, race, k;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
722 int width, height, size = 0;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
723 int nviews; /* NYI */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
724 unsigned char *buf = 0, *buf2;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
725 char *freeme;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
726 char *mainbitmapdir, *bitmapdir;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
727 static char path[MAXPATHLEN];
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
728
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
729 if (all_ship_shapes == 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
730 all_ship_shapes = nshiptypes + (struct ship_shape *)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
731 malloc(sizeof(*all_ship_shapes) * (number_of_teams + 1) * nshiptypes);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
732 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
733 mainbitmapdir = stringDefault("shipBitmapPath",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
734 #ifndef AMIGA /* worked this way, sort of... was annoying. */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
735 "/usr/games/lib/netrek"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
736 #else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
737 "netrek:graphics"
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
738 #endif /* AMIGA */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
739 );
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
740 mainbitmapdir = expandFilename(mainbitmapdir);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
741
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
742 for (race = -1 /* IND */ ; race < number_of_teams; race++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
743 freeme = NULL;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
744 /* you can now have a different bitmapDir for each race [BDyess] */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
745 sprintf(path, "shipBitmapPath.%d", race);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
746 if ((bitmapdir = getdefault(path)) == NULL)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
747 bitmapdir = mainbitmapdir;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
748 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
749 bitmapdir = freeme = expandFilename((char *) strdup(bitmapdir));
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
750 for (k = 0; k < nshiptypes; k++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
751 struct ship_shape *curr_shape = shape_of_ship(race, k);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
752 FILE *fp;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
753 sprintf(path, "%s/R%d.C%d", bitmapdir, race, k);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
754
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
755 fp = fopen(path, "r");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
756 if (fp == 0) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
757 if (errno != ENOENT) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
758 fprintf(stderr, "Error accessing ship bitmap file %s:", path);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
759 perror("");
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
760 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
761 nviews = get_ship_nviews(k, 0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
762 width = get_ship_width(race, k, 0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
763 height = get_ship_height(race, k, 0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
764 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
765 fread(&nviews, sizeof(nviews), 1, fp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
766 nviews = ntohl(nviews);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
767 fread(&width, sizeof(width), 1, fp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
768 width = ntohl(width);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
769 fread(&height, sizeof(height), 1, fp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
770 height = ntohl(height);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
771 if (nviews > get_ship_nviews(k, 0))
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
772 nviews = get_ship_nviews(k, 0);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
773 size = (width + 7) / 8 * height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
774 buf = (unsigned char *) malloc(size);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
775 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
776
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
777 curr_shape->nviews = nviews /* nviews */ ;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
778 curr_shape->width = width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
779 curr_shape->height = height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
780 curr_shape->shield = W_MakeShieldBitmap(width, height, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
781
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
782 curr_shape->bmap = (W_Icon *) malloc(sizeof(*curr_shape->bmap) *
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
783 nviews);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
784
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
785 for (i = 0; i < nviews; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
786 if (fp) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
787 fread(buf, size, 1, fp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
788 curr_shape->bmap[i] =
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
789 W_StoreBitmap(width, height, buf, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
790 } else {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
791 buf2 = get_ship_bits(race, k, i);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
792 curr_shape->bmap[i] =
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
793 W_StoreBitmap(width, height, buf2, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
794 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
795
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
796 #if 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
797 /* these widths and heights are not necessarily correct */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
798 if (fp)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
799 buf2 = get_ship_bits(race, k, i, blk_altbits);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
800 else
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
801 buf2 = get_ship_bits(race, k, i, !blk_altbits);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
802
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
803 curr_shape->bmap[i + (blk_altbits ? 0 : nviews)] =
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
804 W_StoreBitmap(width, height, buf2, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
805 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
806 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
807
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
808 if (fp) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
809 free(buf);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
810 fclose(fp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
811 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
812 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
813 if (freeme)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
814 free(freeme);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
815 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
816 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
817
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
818 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
819 replace_shipshape(race, shiptype, nviews, width, height)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
820 int race, shiptype, nviews, width, height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
821 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
822 struct ship_shape *shp = shape_of_ship(race, shiptype);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
823 int i;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
824
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
825 clear_one_ship_shape(shp);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
826
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
827 shp->nviews = nviews;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
828 shp->bmap = (W_Icon *) malloc(sizeof(*shp->bmap) * nviews);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
829 shp->width = width;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
830 shp->height = height;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
831 shp->shield = W_MakeShieldBitmap(width, height, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
832 for (i = 0; i < nviews; i++) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
833 /* we really should check the files again. */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
834 shp->bmap[i] = W_StoreBitmap(get_ship_width(race, shiptype),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
835 get_ship_height(race, shiptype),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
836 get_ship_bits(race, shiptype, i, 0),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
837 w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
838 #if 0
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
839 shp->bmap[i + nviews] = W_StoreBitmap(get_ship_width(race, shiptype),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
840 get_ship_height(race, shiptype),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
841 get_ship_bits(race, shiptype, i, 0),
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
842 w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
843 #endif
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
844 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
845 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
846
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
847
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
848 void
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
849 replace_ship_bitmap(race, shiptype, view, bits)
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
850 int race, shiptype, view;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
851 unsigned char *bits;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
852 {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
853 struct ship_shape *shp = shape_of_ship(race, shiptype);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
854
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
855 if (view >= shp->nviews) {
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
856 fprintf(stderr, "race %d, ship class %d: view %d out of range (0..%d)\n",
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
857 race, shiptype, view, shp->nviews - 1);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
858 return;
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
859 }
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
860 W_FreeBitmap(shp->bmap[view]);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
861 /* store the bitmaps into the auxiliary view */
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
862 shp->bmap[view] = W_StoreBitmap(shp->width, shp->height, bits, w);
5a977ccbc7a9 Empty changelog
darius
parents:
diff changeset
863 }