44 | | // The wall tool |
45 | | function wallTool(style, fortressType) |
46 | | { |
47 | | // General setup |
48 | | this.angle = 0; // Not really needed, may be useful to rotate fortresses after set... |
49 | | this.wallTypes = {}; // An associative array including all wall elements associated with 'wallElement.type'. |
50 | | this.wall = []; // A list of strings (wall element types) for simple wall building |
51 | | this.center = [0, 0] // X/Z offset from first wall element to center, perhaps should be the other way around... |
52 | | |
53 | | // Presets needed for wall style |
54 | | this.wallStyles = {}; |
55 | | this.style = "palisades"; // Not really needed, perhaps helpfull to check current style |
56 | | if (style !== undefined) |
57 | | this.style = style; |
58 | | |
59 | | // Presets needed for tortess types |
60 | | this.fortressTypes = {}; |
61 | | this.fortress = false; // Not really needed, perhaps usefull for getting fortress type, should be renamed somehow but simply 'type' is not very descriptive and 'fortressType' may be mistaken as 'fortressTypes' |
62 | | if (fortressType !== undefined) |
63 | | this.fortress = fortressType; |
64 | | this.calculateCenter = true; // If setFortress(Type) shall recalculate the center |
65 | | |
66 | | // Adding wall styles |
67 | | // Wall style 'palisades' |
68 | | this.wallStyles["palisades"] = {}; |
69 | | this.wallStyles["palisades"]["wall"] = new wallElement("wall"); |
70 | | this.wallStyles["palisades"]["wall"].entity = "other/palisades_rocks_straight"; |
71 | | this.wallStyles["palisades"]["wall"].angle = -PI/2; |
72 | | this.wallStyles["palisades"]["wall"].width = 2.5; |
73 | | |
74 | | this.wallStyles["palisades"]["tower"] = new wallElement("tower"); |
75 | | this.wallStyles["palisades"]["tower"].entity = "other/palisades_rocks_tower"; |
76 | | this.wallStyles["palisades"]["tower"].angle = -PI/2; |
77 | | this.wallStyles["palisades"]["tower"].width = 0.7; |
78 | | |
79 | | this.wallStyles["palisades"]["wallFort"] = new wallElement("wallFort"); |
80 | | this.wallStyles["palisades"]["wallFort"].entity = "other/palisades_rocks_fort"; |
81 | | this.wallStyles["palisades"]["wallFort"].angle = PI; |
82 | | this.wallStyles["palisades"]["wallFort"].width = 1.7; |
83 | | |
84 | | this.wallStyles["palisades"]["outpost"] = new wallElement("outpost"); |
85 | | this.wallStyles["palisades"]["outpost"].entity = "other/palisades_rocks_outpost"; |
86 | | this.wallStyles["palisades"]["outpost"].angle = PI; |
87 | | this.wallStyles["palisades"]["outpost"].indent = -2; |
88 | | |
89 | | this.wallStyles["palisades"]["house"] = new wallElement("house"); |
90 | | this.wallStyles["palisades"]["house"].entity = "other/celt_hut"; |
91 | | this.wallStyles["palisades"]["house"].angle = PI; |
92 | | this.wallStyles["palisades"]["house"].indent = 5; |
93 | | |
94 | | this.wallStyles["palisades"]["gate"] = new wallElement("gate"); |
95 | | this.wallStyles["palisades"]["gate"].entity = "other/palisades_rocks_gate"; |
96 | | this.wallStyles["palisades"]["gate"].angle = -PI/2; |
97 | | this.wallStyles["palisades"]["gate"].width = 3.6; |
98 | | |
99 | | this.wallStyles["palisades"]["entry"] = new wallElement("entry"); |
100 | | this.wallStyles["palisades"]["entry"].entity = "other/palisades_rocks_watchtower"; |
101 | | this.wallStyles["palisades"]["entry"].angle = 0*PI; |
102 | | this.wallStyles["palisades"]["entry"].width = 3.6; |
103 | | this.wallStyles["palisades"]["entry"].indent = -2; |
104 | | |
105 | | this.wallStyles["palisades"]["wideEntry"] = new wallElement("wideEntry"); |
106 | | this.wallStyles["palisades"]["wideEntry"].entity = "other/palisades_rocks_fort"; |
107 | | this.wallStyles["palisades"]["wideEntry"].angle = PI; |
108 | | this.wallStyles["palisades"]["wideEntry"].width = 6; |
109 | | this.wallStyles["palisades"]["wideEntry"].indent = -3; |
110 | | |
111 | | this.wallStyles["palisades"]["endRight"] = new wallElement("endRight"); |
112 | | this.wallStyles["palisades"]["endRight"].entity = "other/palisades_rocks_end"; |
113 | | this.wallStyles["palisades"]["endRight"].angle = -PI/2; |
114 | | this.wallStyles["palisades"]["endRight"].width = 0.2; |
115 | | |
116 | | this.wallStyles["palisades"]["endLeft"] = new wallElement("endLeft"); |
117 | | this.wallStyles["palisades"]["endLeft"].entity = "other/palisades_rocks_end"; |
118 | | this.wallStyles["palisades"]["endLeft"].angle = PI/2; |
119 | | this.wallStyles["palisades"]["endLeft"].width = 0.2; |
120 | | |
121 | | this.wallStyles["palisades"]["cornerIn"] = new wallElement("cornerIn"); |
122 | | this.wallStyles["palisades"]["cornerIn"].entity = "other/palisades_rocks_curve"; |
123 | | this.wallStyles["palisades"]["cornerIn"].angle = -PI/4; |
124 | | this.wallStyles["palisades"]["cornerIn"].width = 2.1; |
125 | | this.wallStyles["palisades"]["cornerIn"].indent = 0.7; |
126 | | this.wallStyles["palisades"]["cornerIn"].bending = PI/2; |
127 | | |
128 | | this.wallStyles["palisades"]["cornerOut"] = new wallElement("cornerOut"); |
129 | | this.wallStyles["palisades"]["cornerOut"].entity = "other/palisades_rocks_curve"; |
130 | | this.wallStyles["palisades"]["cornerOut"].angle = PI/4; |
131 | | this.wallStyles["palisades"]["cornerOut"].width = 2.1; |
132 | | this.wallStyles["palisades"]["cornerOut"].indent = -0.7; |
133 | | this.wallStyles["palisades"]["cornerOut"].bending = -PI/2; |
134 | | |
135 | | // Wall style 'cart' |
136 | | this.wallStyles["cart"] = {}; |
137 | | this.wallStyles["cart"]["wall"] = new wallElement("wall"); |
138 | | this.wallStyles["cart"]["wall"].entity = "structures/cart_wall"; |
139 | | this.wallStyles["cart"]["wall"].angle = 0*PI; |
140 | | this.wallStyles["cart"]["wall"].width = 6.2; |
141 | | |
142 | | this.wallStyles["cart"]["tower"] = new wallElement("tower"); |
143 | | this.wallStyles["cart"]["tower"].entity = "structures/cart_wall_tower"; |
144 | | this.wallStyles["cart"]["tower"].angle = PI; |
145 | | this.wallStyles["cart"]["tower"].width = 2.7; |
146 | | |
147 | | this.wallStyles["cart"]["wallFort"] = new wallElement("wallFort"); |
148 | | this.wallStyles["cart"]["wallFort"].entity = "structures/cart_fortress"; |
149 | | this.wallStyles["cart"]["wallFort"].angle = PI; |
150 | | this.wallStyles["cart"]["wallFort"].width = 5.1; |
151 | | this.wallStyles["cart"]["wallFort"].indent = 1.6; |
152 | | |
153 | | this.wallStyles["cart"]["outpost"] = new wallElement("outpost"); |
154 | | this.wallStyles["cart"]["outpost"].entity = "structures/cart_outpost"; |
155 | | this.wallStyles["cart"]["outpost"].angle = PI; |
156 | | this.wallStyles["cart"]["outpost"].indent = -5; |
157 | | |
158 | | this.wallStyles["cart"]["house"] = new wallElement("house"); |
159 | | this.wallStyles["cart"]["house"].entity = "structures/cart_house"; |
160 | | this.wallStyles["cart"]["house"].angle = PI; |
161 | | this.wallStyles["cart"]["house"].indent = 7; |
162 | | |
163 | | this.wallStyles["cart"]["gate"] = new wallElement("gate"); |
164 | | this.wallStyles["cart"]["gate"].entity = "structures/cart_wall_gate"; |
165 | | this.wallStyles["cart"]["gate"].angle = 0*PI; |
166 | | this.wallStyles["cart"]["gate"].width = 6.2; |
167 | | |
168 | | this.wallStyles["cart"]["entry"] = new wallElement("entry"); |
169 | | this.wallStyles["cart"]["entry"].entity = "structures/cart_defense_tower"; |
170 | | this.wallStyles["cart"]["entry"].angle = PI; |
171 | | this.wallStyles["cart"]["entry"].width = 6.2; |
172 | | this.wallStyles["cart"]["entry"].indent = -5; |
173 | | |
174 | | this.wallStyles["cart"]["wideEntry"] = new wallElement("wideEntry"); |
175 | | this.wallStyles["cart"]["wideEntry"].entity = "structures/cart_fortress"; |
176 | | this.wallStyles["cart"]["wideEntry"].angle = PI; |
177 | | this.wallStyles["cart"]["wideEntry"].width = 12; |
178 | | this.wallStyles["cart"]["wideEntry"].indent = 7; |
179 | | |
180 | | this.wallStyles["cart"]["endRight"] = new wallElement("endRight"); |
181 | | this.wallStyles["cart"]["endRight"].entity = "structures/cart_wall_tower"; |
182 | | this.wallStyles["cart"]["endRight"].angle = PI; |
183 | | this.wallStyles["cart"]["endRight"].width = 2.7; |
184 | | |
185 | | this.wallStyles["cart"]["endLeft"] = new wallElement("endLeft"); |
186 | | this.wallStyles["cart"]["endLeft"].entity = "structures/cart_wall_tower"; |
187 | | this.wallStyles["cart"]["endLeft"].angle = PI; |
188 | | this.wallStyles["cart"]["endLeft"].width = 2.7; |
189 | | |
190 | | this.wallStyles["cart"]["cornerIn"] = new wallElement("cornerIn"); |
191 | | this.wallStyles["cart"]["cornerIn"].entity = "structures/cart_wall_tower"; |
192 | | this.wallStyles["cart"]["cornerIn"].angle = 5*PI/4; |
193 | | this.wallStyles["cart"]["cornerIn"].width = 0.1; |
194 | | this.wallStyles["cart"]["cornerIn"].indent = 0.9; |
195 | | this.wallStyles["cart"]["cornerIn"].bending = PI/2; |
196 | | |
197 | | this.wallStyles["cart"]["cornerOut"] = new wallElement("cornerOut"); |
198 | | this.wallStyles["cart"]["cornerOut"].entity = "structures/cart_wall_tower"; |
199 | | this.wallStyles["cart"]["cornerOut"].angle = 3*PI/4; |
200 | | this.wallStyles["cart"]["cornerOut"].width = 1.3; // 1.6 |
201 | | this.wallStyles["cart"]["cornerOut"].bending = -PI/2; |
202 | | |
203 | | this.wallStyles["cart"]["barracks"] = new wallElement("barracks"); |
204 | | this.wallStyles["cart"]["barracks"].entity = "structures/cart_barracks"; |
205 | | this.wallStyles["cart"]["barracks"].angle = PI; |
206 | | this.wallStyles["cart"]["barracks"].indent = 7; |
207 | | |
208 | | // Wall style 'celt' |
209 | | this.wallStyles["celt"] = {}; |
210 | | this.wallStyles["celt"]["wall"] = new wallElement("wall"); |
211 | | this.wallStyles["celt"]["wall"].entity = "structures/celt_wall"; |
212 | | this.wallStyles["celt"]["wall"].angle = 0*PI; |
213 | | this.wallStyles["celt"]["wall"].width = 5; |
214 | | this.wallStyles["celt"]["wall"].indent = 0.5; |
215 | | |
216 | | this.wallStyles["celt"]["tower"] = new wallElement("tower"); |
217 | | this.wallStyles["celt"]["tower"].entity = "structures/celt_wall_tower"; |
218 | | this.wallStyles["celt"]["tower"].angle = PI; |
219 | | this.wallStyles["celt"]["tower"].width = 0.7; |
220 | | |
221 | | this.wallStyles["celt"]["wallFort"] = new wallElement("wallFort"); |
222 | | this.wallStyles["celt"]["wallFort"].entity = "structures/celt_fortress_g"; |
223 | | this.wallStyles["celt"]["wallFort"].angle = PI; |
224 | | this.wallStyles["celt"]["wallFort"].width = 4.2; |
225 | | this.wallStyles["celt"]["wallFort"].indent = 2; |
226 | | |
227 | | this.wallStyles["celt"]["outpost"] = new wallElement("outpost"); |
228 | | this.wallStyles["celt"]["outpost"].entity = "structures/celt_outpost"; |
229 | | this.wallStyles["celt"]["outpost"].angle = PI; |
230 | | this.wallStyles["celt"]["outpost"].indent = -5; |
231 | | |
232 | | this.wallStyles["celt"]["house"] = new wallElement("house"); |
233 | | this.wallStyles["celt"]["house"].entity = "structures/celt_house"; |
234 | | this.wallStyles["celt"]["house"].angle = PI; |
235 | | this.wallStyles["celt"]["house"].indent = 5; |
236 | | |
237 | | this.wallStyles["celt"]["gate"] = new wallElement("gate"); |
238 | | this.wallStyles["celt"]["gate"].entity = "structures/celt_wall_gate"; |
239 | | this.wallStyles["celt"]["gate"].angle = 0*PI; |
240 | | this.wallStyles["celt"]["gate"].width = 3.2; |
241 | | |
242 | | this.wallStyles["celt"]["entry"] = new wallElement("entry"); |
243 | | this.wallStyles["celt"]["entry"].entity = "structures/celt_defense_tower"; |
244 | | this.wallStyles["celt"]["entry"].angle = PI; |
245 | | this.wallStyles["celt"]["entry"].width = 6; |
246 | | this.wallStyles["celt"]["entry"].indent = -5; |
247 | | |
248 | | this.wallStyles["celt"]["wideEntry"] = new wallElement("wideEntry"); |
249 | | this.wallStyles["celt"]["wideEntry"].entity = "structures/celt_fortress_b"; |
250 | | this.wallStyles["celt"]["wideEntry"].angle = PI; |
251 | | this.wallStyles["celt"]["wideEntry"].width = 12; |
252 | | this.wallStyles["celt"]["wideEntry"].indent = 7; |
253 | | |
254 | | this.wallStyles["celt"]["endRight"] = new wallElement("endRight"); |
255 | | this.wallStyles["celt"]["endRight"].entity = "structures/celt_wall_tower"; |
256 | | this.wallStyles["celt"]["endRight"].angle = PI; |
257 | | this.wallStyles["celt"]["endRight"].width = 0.7; |
258 | | |
259 | | this.wallStyles["celt"]["endLeft"] = new wallElement("endLeft"); |
260 | | this.wallStyles["celt"]["endLeft"].entity = "structures/celt_wall_tower"; |
261 | | this.wallStyles["celt"]["endLeft"].angle = PI; |
262 | | this.wallStyles["celt"]["endLeft"].width = 0.7; |
263 | | |
264 | | this.wallStyles["celt"]["cornerIn"] = new wallElement("cornerIn"); |
265 | | this.wallStyles["celt"]["cornerIn"].entity = "structures/celt_wall_tower"; |
266 | | this.wallStyles["celt"]["cornerIn"].angle = PI; |
267 | | this.wallStyles["celt"]["cornerIn"].width = 0.7; |
268 | | this.wallStyles["celt"]["cornerIn"].indent = 0; |
269 | | this.wallStyles["celt"]["cornerIn"].bending = PI/2; |
270 | | |
271 | | this.wallStyles["celt"]["cornerOut"] = new wallElement("cornerOut"); |
272 | | this.wallStyles["celt"]["cornerOut"].entity = "structures/celt_wall_tower"; |
273 | | this.wallStyles["celt"]["cornerOut"].angle = PI; |
274 | | this.wallStyles["celt"]["cornerOut"].width = 0.7; |
275 | | this.wallStyles["celt"]["cornerOut"].indent = 0; |
276 | | this.wallStyles["celt"]["cornerOut"].bending = -PI/2; |
277 | | |
278 | | this.wallStyles["celt"]["barracks"] = new wallElement("barracks"); |
279 | | this.wallStyles["celt"]["barracks"].entity = "structures/celt_barracks"; |
280 | | this.wallStyles["celt"]["barracks"].angle = PI; |
281 | | this.wallStyles["celt"]["barracks"].indent = 7; |
282 | | |
283 | | // Wall style 'hele' |
284 | | this.wallStyles["hele"] = {}; |
285 | | this.wallStyles["hele"]["wall"] = new wallElement("wall"); |
286 | | this.wallStyles["hele"]["wall"].entity = "structures/hele_wall"; |
287 | | this.wallStyles["hele"]["wall"].angle = 0*PI; |
288 | | this.wallStyles["hele"]["wall"].width = 5.95; |
289 | | |
290 | | this.wallStyles["hele"]["tower"] = new wallElement("tower"); |
291 | | this.wallStyles["hele"]["tower"].entity = "structures/hele_wall_tower"; |
292 | | this.wallStyles["hele"]["tower"].angle = PI; |
293 | | this.wallStyles["hele"]["tower"].width = 1.5; |
294 | | |
295 | | this.wallStyles["hele"]["wallFort"] = new wallElement("wallFort"); |
296 | | this.wallStyles["hele"]["wallFort"].entity = "structures/hele_fortress"; |
297 | | this.wallStyles["hele"]["wallFort"].angle = 2*PI/2; // PI/2 |
298 | | this.wallStyles["hele"]["wallFort"].width = 5.1; // 5.6 |
299 | | this.wallStyles["hele"]["wallFort"].indent = 1.9; // 1.9 |
300 | | |
301 | | this.wallStyles["hele"]["outpost"] = new wallElement("outpost"); |
302 | | this.wallStyles["hele"]["outpost"].entity = "structures/hele_outpost"; |
303 | | this.wallStyles["hele"]["outpost"].angle = PI; |
304 | | this.wallStyles["hele"]["outpost"].indent = -5; |
305 | | |
306 | | this.wallStyles["hele"]["house"] = new wallElement("house"); |
307 | | this.wallStyles["hele"]["house"].entity = "structures/hele_house"; |
308 | | this.wallStyles["hele"]["house"].angle = PI/2; |
309 | | this.wallStyles["hele"]["house"].indent = 6; |
310 | | |
311 | | this.wallStyles["hele"]["gate"] = new wallElement("gate"); |
312 | | this.wallStyles["hele"]["gate"].entity = "structures/hele_wall_gate"; |
313 | | this.wallStyles["hele"]["gate"].angle = 0*PI; |
314 | | this.wallStyles["hele"]["gate"].width = 9.1; |
315 | | |
316 | | this.wallStyles["hele"]["entry"] = new wallElement("entry"); |
317 | | this.wallStyles["hele"]["entry"].entity = "structures/hele_defense_tower"; |
318 | | this.wallStyles["hele"]["entry"].angle = PI; |
319 | | this.wallStyles["hele"]["entry"].width = 9.1; |
320 | | this.wallStyles["hele"]["entry"].indent = -4; |
321 | | |
322 | | this.wallStyles["hele"]["wideEntry"] = new wallElement("wideEntry"); |
323 | | this.wallStyles["hele"]["wideEntry"].entity = "structures/hele_fortress"; |
324 | | this.wallStyles["hele"]["wideEntry"].angle = 5*PI/2; |
325 | | this.wallStyles["hele"]["wideEntry"].width = 12; |
326 | | this.wallStyles["hele"]["wideEntry"].indent = 7; |
327 | | |
328 | | this.wallStyles["hele"]["endRight"] = new wallElement("endRight"); |
329 | | this.wallStyles["hele"]["endRight"].entity = "structures/hele_wall_tower"; |
330 | | this.wallStyles["hele"]["endRight"].angle = PI; |
331 | | this.wallStyles["hele"]["endRight"].width = 1.5; |
332 | | |
333 | | this.wallStyles["hele"]["endLeft"] = new wallElement("endLeft"); |
334 | | this.wallStyles["hele"]["endLeft"].entity = "structures/hele_wall_tower"; |
335 | | this.wallStyles["hele"]["endLeft"].angle = PI; |
336 | | this.wallStyles["hele"]["endLeft"].width = 1.5; |
337 | | |
338 | | this.wallStyles["hele"]["cornerIn"] = new wallElement("cornerIn"); |
339 | | this.wallStyles["hele"]["cornerIn"].entity = "structures/hele_wall_tower"; |
340 | | this.wallStyles["hele"]["cornerIn"].angle = 5*PI/4; |
341 | | this.wallStyles["hele"]["cornerIn"].width = 0; |
342 | | this.wallStyles["hele"]["cornerIn"].indent = 0.5; |
343 | | this.wallStyles["hele"]["cornerIn"].bending = PI/2; |
344 | | |
345 | | this.wallStyles["hele"]["cornerOut"] = new wallElement("cornerOut"); |
346 | | this.wallStyles["hele"]["cornerOut"].entity = "structures/hele_wall_tower"; |
347 | | this.wallStyles["hele"]["cornerOut"].angle = 3*PI/4; |
348 | | this.wallStyles["hele"]["cornerOut"].width = 1; |
349 | | this.wallStyles["hele"]["cornerOut"].bending = -PI/2; |
350 | | |
351 | | this.wallStyles["hele"]["barracks"] = new wallElement("barracks"); |
352 | | this.wallStyles["hele"]["barracks"].entity = "structures/hele_barracks"; |
353 | | this.wallStyles["hele"]["barracks"].angle = PI; |
354 | | this.wallStyles["hele"]["barracks"].indent = 6; |
355 | | |
356 | | // Wall style 'iber' |
357 | | this.wallStyles["iber"] = {}; |
358 | | this.wallStyles["iber"]["wall"] = new wallElement("wall"); |
359 | | this.wallStyles["iber"]["wall"].entity = "structures/iber_wall"; |
360 | | this.wallStyles["iber"]["wall"].angle = 0*PI; |
361 | | this.wallStyles["iber"]["wall"].width = 6.9; |
362 | | |
363 | | this.wallStyles["iber"]["tower"] = new wallElement("tower"); |
364 | | this.wallStyles["iber"]["tower"].entity = "structures/iber_wall_tower"; |
365 | | this.wallStyles["iber"]["tower"].angle = PI; |
366 | | this.wallStyles["iber"]["tower"].width = 2.1; |
367 | | |
368 | | this.wallStyles["iber"]["wallFort"] = new wallElement("wallFort"); |
369 | | this.wallStyles["iber"]["wallFort"].entity = "structures/iber_fortress"; |
370 | | this.wallStyles["iber"]["wallFort"].angle = PI; |
371 | | this.wallStyles["iber"]["wallFort"].width = 4.5; |
372 | | this.wallStyles["iber"]["wallFort"].indent = 0.7; |
373 | | |
374 | | this.wallStyles["iber"]["outpost"] = new wallElement("outpost"); |
375 | | this.wallStyles["iber"]["outpost"].entity = "structures/iber_outpost"; |
376 | | this.wallStyles["iber"]["outpost"].angle = PI; |
377 | | this.wallStyles["iber"]["outpost"].indent = -5; |
378 | | |
379 | | this.wallStyles["iber"]["house"] = new wallElement("house"); |
380 | | this.wallStyles["iber"]["house"].entity = "structures/iber_house"; |
381 | | this.wallStyles["iber"]["house"].angle = PI; |
382 | | this.wallStyles["iber"]["house"].indent = 4; |
383 | | |
384 | | this.wallStyles["iber"]["gate"] = new wallElement("gate"); |
385 | | this.wallStyles["iber"]["gate"].entity = "structures/iber_wall_gate"; |
386 | | this.wallStyles["iber"]["gate"].angle = 0*PI; |
387 | | this.wallStyles["iber"]["gate"].width = 9.2; |
388 | | |
389 | | this.wallStyles["iber"]["entry"] = new wallElement("entry"); |
390 | | this.wallStyles["iber"]["entry"].entity = "structures/iber_wall_tower"; |
391 | | this.wallStyles["iber"]["entry"].angle = PI; |
392 | | this.wallStyles["iber"]["entry"].width = 6.9; |
393 | | this.wallStyles["iber"]["entry"].indent = -5; |
394 | | |
395 | | this.wallStyles["iber"]["wideEntry"] = new wallElement("wideEntry"); |
396 | | this.wallStyles["iber"]["wideEntry"].entity = "structures/iber_fortress"; |
397 | | this.wallStyles["iber"]["wideEntry"].angle = PI/2; |
398 | | this.wallStyles["iber"]["wideEntry"].width = 9.2; |
399 | | this.wallStyles["iber"]["wideEntry"].indent = 7; |
400 | | |
401 | | this.wallStyles["iber"]["endRight"] = new wallElement("endRight"); |
402 | | this.wallStyles["iber"]["endRight"].entity = "structures/iber_wall_tower"; |
403 | | this.wallStyles["iber"]["endRight"].angle = PI; |
404 | | this.wallStyles["iber"]["endRight"].width = 2.1; |
405 | | |
406 | | this.wallStyles["iber"]["endLeft"] = new wallElement("endLeft"); |
407 | | this.wallStyles["iber"]["endLeft"].entity = "structures/iber_wall_tower"; |
408 | | this.wallStyles["iber"]["endLeft"].angle = PI; |
409 | | this.wallStyles["iber"]["endLeft"].width = 2.1; |
410 | | |
411 | | this.wallStyles["iber"]["cornerIn"] = new wallElement("cornerIn"); |
412 | | this.wallStyles["iber"]["cornerIn"].entity = "structures/iber_wall_tower"; |
413 | | this.wallStyles["iber"]["cornerIn"].angle = PI; |
414 | | this.wallStyles["iber"]["cornerIn"].width = 2.1; |
415 | | this.wallStyles["iber"]["cornerIn"].bending = PI/2; |
416 | | |
417 | | this.wallStyles["iber"]["cornerIn2"] = new wallElement("cornerIn2"); |
418 | | this.wallStyles["iber"]["cornerIn2"].entity = "structures/iber_defense_tower"; |
419 | | this.wallStyles["iber"]["cornerIn2"].angle = 5*PI/4; |
420 | | this.wallStyles["iber"]["cornerIn2"].width = 1; |
421 | | this.wallStyles["iber"]["cornerIn2"].indent = 0.2; |
422 | | this.wallStyles["iber"]["cornerIn2"].bending = PI/2; |
423 | | |
424 | | this.wallStyles["iber"]["cornerIn3"] = new wallElement("cornerIn3"); |
425 | | this.wallStyles["iber"]["cornerIn3"].entity = "structures/iber_wall_tower"; |
426 | | this.wallStyles["iber"]["cornerIn3"].angle = 5*PI/4; |
427 | | this.wallStyles["iber"]["cornerIn3"].width = 0.3; |
428 | | this.wallStyles["iber"]["cornerIn3"].indent = 0.5; |
429 | | this.wallStyles["iber"]["cornerIn3"].bending = PI/2; |
430 | | |
431 | | this.wallStyles["iber"]["cornerOut"] = new wallElement("cornerOut"); |
432 | | this.wallStyles["iber"]["cornerOut"].entity = "structures/iber_wall_tower"; |
433 | | this.wallStyles["iber"]["cornerOut"].angle = 3*PI/4; |
434 | | this.wallStyles["iber"]["cornerOut"].width = 1.3; |
435 | | this.wallStyles["iber"]["cornerOut"].indent = 0; |
436 | | this.wallStyles["iber"]["cornerOut"].bending = -PI/2; |
437 | | |
438 | | this.wallStyles["iber"]["barracks"] = new wallElement("barracks"); |
439 | | this.wallStyles["iber"]["barracks"].entity = "structures/iber_barracks"; |
440 | | this.wallStyles["iber"]["barracks"].angle = PI; |
441 | | this.wallStyles["iber"]["barracks"].indent = 7; |
442 | | |
443 | | // Wall style 'pers' |
444 | | this.wallStyles["pers"] = {}; |
445 | | this.wallStyles["pers"]["wall"] = new wallElement("wall"); |
446 | | this.wallStyles["pers"]["wall"].entity = "structures/pers_wall"; |
447 | | this.wallStyles["pers"]["wall"].angle = 0*PI; |
448 | | this.wallStyles["pers"]["wall"].width = 5.9; |
449 | | |
450 | | this.wallStyles["pers"]["tower"] = new wallElement("tower"); |
451 | | this.wallStyles["pers"]["tower"].entity = "structures/pers_wall_tower"; |
452 | | this.wallStyles["pers"]["tower"].angle = PI; |
453 | | this.wallStyles["pers"]["tower"].width = 1.7; |
454 | | |
455 | | this.wallStyles["pers"]["wallFort"] = new wallElement("wallFort"); |
456 | | this.wallStyles["pers"]["wallFort"].entity = "structures/pers_fortress"; |
457 | | this.wallStyles["pers"]["wallFort"].angle = PI; |
458 | | this.wallStyles["pers"]["wallFort"].width = 5.6; // 5.5 |
459 | | this.wallStyles["pers"]["wallFort"].indent = 1.9; // 1.7 |
460 | | |
461 | | this.wallStyles["pers"]["outpost"] = new wallElement("outpost"); |
462 | | this.wallStyles["pers"]["outpost"].entity = "structures/pers_outpost"; |
463 | | this.wallStyles["pers"]["outpost"].angle = PI; |
464 | | this.wallStyles["pers"]["outpost"].indent = -5; |
465 | | |
466 | | this.wallStyles["pers"]["house"] = new wallElement("house"); |
467 | | this.wallStyles["pers"]["house"].entity = "structures/pers_house"; |
468 | | this.wallStyles["pers"]["house"].angle = PI; |
469 | | this.wallStyles["pers"]["house"].indent = 6; |
470 | | |
471 | | this.wallStyles["pers"]["gate"] = new wallElement("gate"); |
472 | | this.wallStyles["pers"]["gate"].entity = "structures/pers_wall_gate"; |
473 | | this.wallStyles["pers"]["gate"].angle = 0*PI; |
474 | | this.wallStyles["pers"]["gate"].width = 6; |
475 | | |
476 | | this.wallStyles["pers"]["entry"] = new wallElement("entry"); |
477 | | this.wallStyles["pers"]["entry"].entity = "structures/pers_defense_tower"; |
478 | | this.wallStyles["pers"]["entry"].angle = PI; |
479 | | this.wallStyles["pers"]["entry"].width = 6; |
480 | | this.wallStyles["pers"]["entry"].indent = -4; |
481 | | |
482 | | this.wallStyles["pers"]["wideEntry"] = new wallElement("wideEntry"); |
483 | | this.wallStyles["pers"]["wideEntry"].entity = "structures/pers_fortress"; |
484 | | this.wallStyles["pers"]["wideEntry"].angle = PI; |
485 | | this.wallStyles["pers"]["wideEntry"].width = 12; |
486 | | this.wallStyles["pers"]["wideEntry"].indent = 7; |
487 | | |
488 | | this.wallStyles["pers"]["endRight"] = new wallElement("endRight"); |
489 | | this.wallStyles["pers"]["endRight"].entity = "structures/pers_wall_tower"; |
490 | | this.wallStyles["pers"]["endRight"].angle = PI; |
491 | | this.wallStyles["pers"]["endRight"].width = 1.7; |
492 | | |
493 | | this.wallStyles["pers"]["endLeft"] = new wallElement("endLeft"); |
494 | | this.wallStyles["pers"]["endLeft"].entity = "structures/pers_wall_tower"; |
495 | | this.wallStyles["pers"]["endLeft"].angle = PI; |
496 | | this.wallStyles["pers"]["endLeft"].width = 1.7; |
497 | | |
498 | | this.wallStyles["pers"]["cornerIn"] = new wallElement("cornerIn"); |
499 | | this.wallStyles["pers"]["cornerIn"].entity = "structures/pers_wall_tower"; |
500 | | this.wallStyles["pers"]["cornerIn"].angle = 5*PI/4; |
501 | | this.wallStyles["pers"]["cornerIn"].width = 0.2; |
502 | | this.wallStyles["pers"]["cornerIn"].indent = 0.5; |
503 | | this.wallStyles["pers"]["cornerIn"].bending = PI/2; |
504 | | |
505 | | this.wallStyles["pers"]["cornerOut"] = new wallElement("cornerOut"); |
506 | | this.wallStyles["pers"]["cornerOut"].entity = "structures/pers_wall_tower"; |
507 | | this.wallStyles["pers"]["cornerOut"].angle = 3*PI/4; |
508 | | this.wallStyles["pers"]["cornerOut"].width = 0.8; |
509 | | this.wallStyles["pers"]["cornerOut"].indent = 0; |
510 | | this.wallStyles["pers"]["cornerOut"].bending = -PI/2; |
511 | | |
512 | | this.wallStyles["pers"]["barracks"] = new wallElement("barracks"); |
513 | | this.wallStyles["pers"]["barracks"].entity = "structures/pers_barracks"; |
514 | | this.wallStyles["pers"]["barracks"].angle = PI; |
515 | | this.wallStyles["pers"]["barracks"].indent = 7; |
516 | | |
517 | | // Wall style 'rome' |
518 | | this.wallStyles["rome"] = {}; |
519 | | this.wallStyles["rome"]["wall"] = new wallElement("wall"); |
520 | | this.wallStyles["rome"]["wall"].entity = "structures/rome_wall"; |
521 | | this.wallStyles["rome"]["wall"].angle = 0*PI; |
522 | | this.wallStyles["rome"]["wall"].width = 5.9; |
523 | | |
524 | | this.wallStyles["rome"]["tower"] = new wallElement("tower"); |
525 | | this.wallStyles["rome"]["tower"].entity = "structures/rome_wall_tower"; |
526 | | this.wallStyles["rome"]["tower"].angle = PI; |
527 | | this.wallStyles["rome"]["tower"].width = 2.1; |
528 | | |
529 | | this.wallStyles["rome"]["wallFort"] = new wallElement("wallFort"); |
530 | | this.wallStyles["rome"]["wallFort"].entity = "structures/rome_fortress"; |
531 | | this.wallStyles["rome"]["wallFort"].angle = PI; |
532 | | this.wallStyles["rome"]["wallFort"].width = 6.3; |
533 | | this.wallStyles["rome"]["wallFort"].indent = 2.1; |
534 | | |
535 | | this.wallStyles["rome"]["outpost"] = new wallElement("outpost"); |
536 | | this.wallStyles["rome"]["outpost"].entity = "structures/rome_outpost"; |
537 | | this.wallStyles["rome"]["outpost"].angle = PI; |
538 | | this.wallStyles["rome"]["outpost"].indent = -5; |
539 | | |
540 | | this.wallStyles["rome"]["house"] = new wallElement("house"); |
541 | | this.wallStyles["rome"]["house"].entity = "structures/rome_house"; |
542 | | this.wallStyles["rome"]["house"].angle = PI; |
543 | | this.wallStyles["rome"]["house"].indent = 7; |
544 | | |
545 | | this.wallStyles["rome"]["gate"] = new wallElement("gate"); |
546 | | this.wallStyles["rome"]["gate"].entity = "structures/rome_wall_gate"; |
547 | | this.wallStyles["rome"]["gate"].angle = 0*PI; |
548 | | this.wallStyles["rome"]["gate"].width = 5.9; |
549 | | |
550 | | this.wallStyles["rome"]["entry"] = new wallElement("entry"); |
551 | | this.wallStyles["rome"]["entry"].entity = "structures/rome_defense_tower"; |
552 | | this.wallStyles["rome"]["entry"].angle = PI; |
553 | | this.wallStyles["rome"]["entry"].width = 5.9; |
554 | | this.wallStyles["rome"]["entry"].indent = -4; |
555 | | |
556 | | this.wallStyles["rome"]["wideEntry"] = new wallElement("wideEntry"); |
557 | | this.wallStyles["rome"]["wideEntry"].entity = "structures/rome_fortress"; |
558 | | this.wallStyles["rome"]["wideEntry"].angle = PI; |
559 | | this.wallStyles["rome"]["wideEntry"].width = 12; |
560 | | this.wallStyles["rome"]["wideEntry"].indent = 7; |
561 | | |
562 | | this.wallStyles["rome"]["endRight"] = new wallElement("endRight"); |
563 | | this.wallStyles["rome"]["endRight"].entity = "structures/rome_wall_tower"; |
564 | | this.wallStyles["rome"]["endRight"].angle = PI; |
565 | | this.wallStyles["rome"]["endRight"].width = 2.1; |
566 | | |
567 | | this.wallStyles["rome"]["endLeft"] = new wallElement("endLeft"); |
568 | | this.wallStyles["rome"]["endLeft"].entity = "structures/rome_wall_tower"; |
569 | | this.wallStyles["rome"]["endLeft"].angle = PI; |
570 | | this.wallStyles["rome"]["endLeft"].width = 2.1; |
571 | | |
572 | | this.wallStyles["rome"]["cornerIn"] = new wallElement("cornerIn"); |
573 | | this.wallStyles["rome"]["cornerIn"].entity = "structures/rome_wall_tower"; |
574 | | this.wallStyles["rome"]["cornerIn"].angle = 5*PI/4; |
575 | | this.wallStyles["rome"]["cornerIn"].width = 0; |
576 | | this.wallStyles["rome"]["cornerIn"].indent = 0.7; |
577 | | this.wallStyles["rome"]["cornerIn"].bending = PI/2; |
578 | | |
579 | | this.wallStyles["rome"]["cornerOut"] = new wallElement("cornerOut"); |
580 | | this.wallStyles["rome"]["cornerOut"].entity = "structures/rome_wall_tower"; |
581 | | this.wallStyles["rome"]["cornerOut"].angle = 3*PI/4; |
582 | | this.wallStyles["rome"]["cornerOut"].width = 1.1; // 1.4 |
583 | | this.wallStyles["rome"]["cornerOut"].indent = 0; |
584 | | this.wallStyles["rome"]["cornerOut"].bending = -PI/2; |
585 | | |
586 | | this.wallStyles["rome"]["barracks"] = new wallElement("barracks"); |
587 | | this.wallStyles["rome"]["barracks"].entity = "structures/rome_barracks"; |
588 | | this.wallStyles["rome"]["barracks"].angle = PI; |
589 | | this.wallStyles["rome"]["barracks"].indent = 6; |
590 | | |
591 | | // Setup some default fortress types |
592 | | // General default fortress types |
593 | | this.fortressTypes["tiny"] = new fortress("tiny"); |
594 | | var wallPart = ['entry', 'endLeft', 'wall', 'cornerIn', 'wall', 'endRight']; |
595 | | var parts = 4; |
596 | | for (var part = 0; part < parts; part++) |
597 | | { |
598 | | for (var wallIndex = 0; wallIndex < wallPart.length; wallIndex++) |
599 | | this.fortressTypes["tiny"].wall.push(wallPart[wallIndex]) |
600 | | }; |
601 | | |
602 | | this.fortressTypes["small"] = new fortress("small"); |
603 | | var wallPart = ['entry', 'endLeft', 'wall', 'tower', 'wall', |
604 | | 'cornerIn', 'wall', 'tower', 'wall', 'endRight']; |
605 | | var parts = 4; |
606 | | for (var part = 0; part < parts; part++) |
607 | | { |
608 | | for (var wallIndex = 0; wallIndex < wallPart.length; wallIndex++) |
609 | | this.fortressTypes["small"].wall.push(wallPart[wallIndex]) |
610 | | }; |
611 | | |
612 | | this.fortressTypes["medium"] = new fortress("medium"); |
613 | | var wallPart = ['entry', 'endLeft', 'wall', 'tower', 'wall', 'cornerIn', 'wall', |
614 | | 'cornerOut', 'wall', 'cornerIn', 'wall', 'tower', 'wall', 'endRight']; |
615 | | var parts = 4; |
616 | | for (var part = 0; part < parts; part++) |
617 | | { |
618 | | for (var wallIndex = 0; wallIndex < wallPart.length; wallIndex++) |
619 | | this.fortressTypes["medium"].wall.push(wallPart[wallIndex]) |
620 | | }; |
621 | | |
622 | | this.fortressTypes["normal"] = new fortress("normal"); |
623 | | var wallPart = ['entry', 'endLeft', 'wall', 'tower', 'wall', 'outpost', 'wall', 'cornerIn', 'wall', |
624 | | 'cornerOut', 'wall', 'cornerIn', 'wall', 'outpost', 'wall', 'tower', 'wall', 'endRight']; |
625 | | var parts = 4; |
626 | | for (var part = 0; part < parts; part++) |
627 | | { |
628 | | for (var wallIndex = 0; wallIndex < wallPart.length; wallIndex++) |
629 | | this.fortressTypes["normal"].wall.push(wallPart[wallIndex]) |
630 | | }; |
631 | | |
632 | | this.fortressTypes["large"] = new fortress("large"); |
633 | | var wallPart = ['entry', 'endLeft', 'wall', 'tower', 'wall', 'outpost', 'wall', 'cornerIn', 'wall', 'tower', 'wall', |
634 | | 'cornerOut', 'wall', 'tower', 'wall', 'cornerIn', 'wall', 'outpost', 'wall', 'tower', 'wall', 'endRight']; |
635 | | var parts = 4; |
636 | | for (var part = 0; part < parts; part++) |
637 | | { |
638 | | for (var wallIndex = 0; wallIndex < wallPart.length; wallIndex++) |
639 | | this.fortressTypes["large"].wall.push(wallPart[wallIndex]) |
640 | | }; |
641 | | |
642 | | this.fortressTypes["very large"] = new fortress("very large"); |
643 | | var wallPart = ['entry', 'endLeft', 'wall', 'tower', 'wall', 'outpost', 'wall', |
644 | | 'tower', 'gate', 'tower', 'wall', 'cornerIn', 'wall', 'tower', 'wall', |
645 | | 'cornerOut', 'wall', 'tower', 'wall', 'cornerIn', 'wall', 'tower', 'gate', |
646 | | 'tower', 'wall', 'outpost', 'wall', 'tower', 'wall', 'endRight']; |
647 | | var parts = 4; |
648 | | for (var part = 0; part < parts; part++) |
649 | | { |
650 | | for (var wallIndex = 0; wallIndex < wallPart.length; wallIndex++) |
651 | | this.fortressTypes["very large"].wall.push(wallPart[wallIndex]) |
652 | | }; |
653 | | |
654 | | this.fortressTypes["giant"] = new fortress("giant"); |
655 | | var wallPart = ['entry', 'endLeft', 'wall', 'tower', 'wall', 'outpost', 'wall', 'tower', |
656 | | 'gate', 'tower', 'wall', 'cornerIn', 'wall', 'outpost', 'wall', 'tower', 'wall', |
657 | | 'cornerOut', 'wall', 'tower', 'wall', 'outpost', 'wall', 'cornerIn', 'wall', 'tower', |
658 | | 'gate', 'tower', 'wall', 'outpost', 'wall', 'tower', 'wall', 'endRight']; |
659 | | var parts = 4; |
660 | | for (var part = 0; part < parts; part++) |
661 | | { |
662 | | for (var wallIndex = 0; wallIndex < wallPart.length; wallIndex++) |
663 | | this.fortressTypes["giant"].wall.push(wallPart[wallIndex]) |
664 | | }; |
665 | | |
666 | | this.fortressTypes["demo"] = new fortress("demo"); |
667 | | var wallPart = ['entry', 'endLeft', 'wall', 'tower', 'wall', 'wallFort', 'wall', 'tower', 'gate', 'tower', 'wall', 'outpost', |
668 | | 'wall', 'cornerIn', 'wall', 'outpost', 'wall', 'endRight', 'wideEntry', 'endLeft', 'wall', 'tower', 'wall', |
669 | | 'cornerOut', 'wall', 'tower', 'wall', 'endRight', 'wideEntry', 'endLeft', 'wall', 'outpost', 'wall', 'cornerIn', |
670 | | 'wall', 'outpost', 'wall', 'tower', 'gate', 'tower', 'wall', 'wallFort', 'wall', 'tower', 'wall', 'endRight']; |
671 | | var parts = 4; |
672 | | for (var part = 0; part < parts; part++) |
673 | | { |
674 | | for (var wallIndex = 0; wallIndex < wallPart.length; wallIndex++) |
675 | | this.fortressTypes["demo"].wall.push(wallPart[wallIndex]) |
676 | | }; |
677 | | |
678 | | // Default civ dependent fortresses for Spahbod |
679 | | this.fortressTypes["cartSB"] = new fortress("cartSB"); |
680 | | this.fortressTypes["cartSB"].wall = ['entry', 'wall', 'wall', |
681 | | 'cornerIn', 'wall', 'barracks', 'wall', 'gate', 'wall', 'wall', |
682 | | 'cornerIn', 'wall', 'house', 'wall', 'entry', 'wall', 'wall', |
683 | | 'cornerIn', 'wall', 'house', 'wall', 'gate', 'wall', 'wall', |
684 | | 'cornerIn', 'wall', 'house', 'wall']; |
685 | | this.fortressTypes["celtSB"] = new fortress("celtSB"); |
686 | | this.fortressTypes["celtSB"].wall = ['entry', 'wall', 'wall', |
687 | | 'cornerIn', 'wall', 'barracks', 'wall', 'gate', 'wall', 'house', 'wall', |
688 | | 'cornerIn', 'wall', 'house', 'wall', 'entry', 'wall', 'house', 'wall', |
689 | | 'cornerIn', 'wall', 'house', 'wall', 'gate', 'wall', 'house', 'wall', |
690 | | 'cornerIn', 'wall', 'house', 'wall']; |
691 | | this.fortressTypes["iberSB"] = this.fortressTypes["celtSB"]; |
692 | | this.fortressTypes["heleSB"] = this.fortressTypes["cartSB"]; |
693 | | this.fortressTypes["persSB"] = this.fortressTypes["cartSB"]; |
694 | | this.fortressTypes["romeSB"] = this.fortressTypes["cartSB"]; |
695 | | |
696 | | // Setup style |
697 | | this.setStyle(this.style); |
698 | | |
699 | | // Setup fortress type if preasent |
700 | | if (this.fortress !== false && this.fortress !== undefined) |
701 | | this.setFortressType(this.fortress); |
702 | | }; |
704 | | wallTool.prototype.setStyle = function(style) |
| 83 | // Setup data structure for some default wall styles. |
| 84 | // A wall style is an associative array with all wall elements of that style in it associated with the wall element type string. |
| 85 | // wallStyles holds all the wall styles within an associative array while a wall style is associated with the civ string or another descriptive strings like 'palisades', 'fence', 'cart', 'celt'... |
| 86 | var wallStyles = {}; |
| 87 | // Add civilisation wall style 'cart' |
| 88 | wallStyles['cart'] = {}; |
| 89 | wallStyles['cart']['wall'] = new WallElement('wall', 'structures/cart_wall', 0*PI, 6.2); |
| 90 | wallStyles['cart']['tower'] = new WallElement('tower', 'structures/cart_wall_tower', PI, 2.7); |
| 91 | wallStyles['cart']['wallFort'] = new WallElement('wallFort', 'structures/cart_fortress', PI, 5.1, 1.6); |
| 92 | wallStyles['cart']['gate'] = new WallElement('gate', 'structures/cart_wall_gate', 0*PI, 6.2); |
| 93 | wallStyles['cart']['entry'] = new WallElement('entry', undefined, wallStyles['cart']['gate'].angle, wallStyles['cart']['gate'].width); |
| 94 | wallStyles['cart']['entryTower'] = new WallElement('entryTower', 'structures/cart_defense_tower', PI, 6.2, -5); |
| 95 | wallStyles['cart']['entryFort'] = new WallElement('entryFort', 'structures/cart_fortress', PI, 12, 7); |
| 96 | wallStyles['cart']['endRight'] = new WallElement('endRight', wallStyles['cart']['tower'].entity, wallStyles['cart']['tower'].angle, wallStyles['cart']['tower'].width); |
| 97 | wallStyles['cart']['endLeft'] = new WallElement('endLeft', wallStyles['cart']['tower'].entity, wallStyles['cart']['tower'].angle, wallStyles['cart']['tower'].width); |
| 98 | wallStyles['cart']['cornerIn'] = new WallElement('cornerIn', 'structures/cart_wall_tower', 5*PI/4, 0, 0.8, PI/2); |
| 99 | wallStyles['cart']['cornerOut'] = new WallElement('cornerOut', 'structures/cart_wall_tower', 3*PI/4, 1.3 /*1.6*/, 0, -PI/2); |
| 100 | wallStyles['cart']['outpost'] = new WallElement('outpost', 'structures/cart_outpost', PI, 0, -5); |
| 101 | wallStyles['cart']['house'] = new WallElement('house', 'structures/cart_house', PI, 0, 7); |
| 102 | wallStyles['cart']['barracks'] = new WallElement('barracks', 'structures/cart_barracks', PI, 0, 7); |
| 103 | // Add civilisation wall style 'celt' |
| 104 | wallStyles['celt'] = {}; |
| 105 | wallStyles['celt']['wall'] = new WallElement('wall', 'structures/celt_wall', 0*PI, 5.9); |
| 106 | wallStyles['celt']['tower'] = new WallElement('tower', 'structures/celt_wall_tower', PI, 1.9); |
| 107 | wallStyles['celt']['wallFort'] = new WallElement('wallFort', 'structures/celt_fortress_g', PI, 4.2, 1.5); |
| 108 | wallStyles['celt']['gate'] = new WallElement('gate', 'structures/celt_wall_gate', 0*PI, 5.6); |
| 109 | wallStyles['celt']['entry'] = new WallElement('entry', undefined, wallStyles['celt']['gate'].angle, wallStyles['celt']['gate'].width); |
| 110 | wallStyles['celt']['entryTower'] = new WallElement('entryTower', 'structures/celt_defense_tower', PI, 6, -5); |
| 111 | wallStyles['celt']['entryFort'] = new WallElement('entryFort', 'structures/celt_fortress_b', PI, 8, 5); |
| 112 | wallStyles['celt']['endRight'] = new WallElement('endRight', wallStyles['celt']['tower'].entity, wallStyles['celt']['tower'].angle, wallStyles['celt']['tower'].width); |
| 113 | wallStyles['celt']['endLeft'] = new WallElement('endLeft', wallStyles['celt']['tower'].entity, wallStyles['celt']['tower'].angle, wallStyles['celt']['tower'].width); |
| 114 | wallStyles['celt']['cornerIn'] = new WallElement('cornerIn', 'structures/celt_wall_tower', 5*PI/4, 0, 0.7, PI/2); |
| 115 | wallStyles['celt']['cornerOut'] = new WallElement('cornerOut', 'structures/celt_wall_tower', 3*PI/4, 1.3, 0, -PI/2); |
| 116 | wallStyles['celt']['outpost'] = new WallElement('outpost', 'structures/celt_outpost', PI, 0, -5); |
| 117 | wallStyles['celt']['house'] = new WallElement('house', 'structures/celt_house', PI, 0, 3); |
| 118 | wallStyles['celt']['barracks'] = new WallElement('barracks', 'structures/celt_barracks', PI, 0, 7); |
| 119 | // Add civilisation wall style 'hele' |
| 120 | wallStyles['hele'] = {}; |
| 121 | wallStyles['hele']['wall'] = new WallElement('wall', 'structures/hele_wall', 0*PI, 5.95); |
| 122 | wallStyles['hele']['tower'] = new WallElement('tower', 'structures/hele_wall_tower', PI, 1.5); |
| 123 | wallStyles['hele']['wallFort'] = new WallElement('wallFort', 'structures/hele_fortress', 2*PI/2 /* PI/2 */, 5.1 /* 5.6 */, 1.9 /* 1.9 */); |
| 124 | wallStyles['hele']['gate'] = new WallElement('gate', 'structures/hele_wall_gate', 0*PI, 9.1); |
| 125 | wallStyles['hele']['entry'] = new WallElement('entry', undefined, wallStyles['hele']['gate'].angle, wallStyles['hele']['gate'].width); |
| 126 | wallStyles['hele']['entryTower'] = new WallElement('entry', 'structures/hele_defense_tower', PI, 9.1, -5); |
| 127 | wallStyles['hele']['entryFort'] = new WallElement('entryFort', 'structures/hele_fortress', 5*PI/2, 12, 7); |
| 128 | wallStyles['hele']['endRight'] = new WallElement('endRight', wallStyles['hele']['tower'].entity, wallStyles['hele']['tower'].angle, wallStyles['hele']['tower'].width); |
| 129 | wallStyles['hele']['endLeft'] = new WallElement('endLeft', wallStyles['hele']['tower'].entity, wallStyles['hele']['tower'].angle, wallStyles['hele']['tower'].width); |
| 130 | wallStyles['hele']['cornerIn'] = new WallElement('cornerIn', 'structures/hele_wall_tower', 5*PI/4, 0, 0.5, PI/2); |
| 131 | wallStyles['hele']['cornerOut'] = new WallElement('cornerOut', 'structures/hele_wall_tower', 3*PI/4, 1, 0, -PI/2); |
| 132 | wallStyles['hele']['outpost'] = new WallElement('outpost', 'structures/hele_outpost', PI, 0, -5); |
| 133 | wallStyles['hele']['house'] = new WallElement('house', 'structures/hele_house', 3*PI/2, 0, 6); |
| 134 | wallStyles['hele']['barracks'] = new WallElement('barracks', 'structures/hele_barracks', PI, 0, 6); |
| 135 | // Add civilisation wall style 'iber' |
| 136 | wallStyles['iber'] = {}; |
| 137 | wallStyles['iber']['wall'] = new WallElement('wall', 'structures/iber_wall', 0*PI, 6); |
| 138 | wallStyles['iber']['tower'] = new WallElement('tower', 'structures/iber_wall_tower', PI, 1.7); |
| 139 | wallStyles['iber']['wallFort'] = new WallElement('wallFort', 'structures/iber_fortress', PI, 4.6, 0.7); |
| 140 | wallStyles['iber']['gate'] = new WallElement('gate', 'structures/iber_wall_gate', 0*PI, 7.9); |
| 141 | wallStyles['iber']['entry'] = new WallElement('entry', undefined, wallStyles['iber']['gate'].angle, wallStyles['iber']['gate'].width); |
| 142 | wallStyles['iber']['entryTower'] = new WallElement('entryTower', 'structures/iber_wall_tower', PI, 6.9, -5); |
| 143 | wallStyles['iber']['entryFort'] = new WallElement('entryFort', 'structures/iber_fortress', PI/2, 12, 7); |
| 144 | wallStyles['iber']['endRight'] = new WallElement('endRight', wallStyles['iber']['tower'].entity, wallStyles['iber']['tower'].angle, wallStyles['iber']['tower'].width); |
| 145 | wallStyles['iber']['endLeft'] = new WallElement('endLeft', wallStyles['iber']['tower'].entity, wallStyles['iber']['tower'].angle, wallStyles['iber']['tower'].width); |
| 146 | wallStyles['iber']['cornerIn'] = new WallElement('cornerIn', 'structures/iber_wall_tower', 5*PI/4, 1.7, 0, PI/2); |
| 147 | wallStyles['iber']['cornerOut'] = new WallElement('cornerOut', 'structures/iber_wall_tower', 3*PI/4, 1.7, 0, -PI/2); |
| 148 | wallStyles['iber']['outpost'] = new WallElement('outpost', 'structures/iber_outpost', PI, 0, -5); |
| 149 | wallStyles['iber']['house'] = new WallElement('house', 'structures/iber_house', PI, 0, 4); |
| 150 | wallStyles['iber']['barracks'] = new WallElement('barracks', 'structures/iber_barracks', PI, 0, 7); |
| 151 | // Add civilisation wall style 'pers' |
| 152 | wallStyles['pers'] = {}; |
| 153 | wallStyles['pers']['wall'] = new WallElement('wall', 'structures/pers_wall', 0*PI, 5.9); |
| 154 | wallStyles['pers']['tower'] = new WallElement('tower', 'structures/pers_wall_tower', PI, 1.7); |
| 155 | wallStyles['pers']['wallFort'] = new WallElement('wallFort', 'structures/pers_fortress', PI, 5.6/*5.5*/, 1.9/*1.7*/); |
| 156 | wallStyles['pers']['gate'] = new WallElement('gate', 'structures/pers_wall_gate', 0*PI, 6); |
| 157 | wallStyles['pers']['entry'] = new WallElement('entry', undefined, wallStyles['pers']['gate'].angle, wallStyles['pers']['gate'].width); |
| 158 | wallStyles['pers']['entryTower'] = new WallElement('entry', 'structures/pers_defense_tower', PI, 6, -5); |
| 159 | wallStyles['pers']['entryFort'] = new WallElement('entryFort', 'structures/pers_fortress', PI, 12, 7); |
| 160 | wallStyles['pers']['endRight'] = new WallElement('endRight', wallStyles['pers']['tower'].entity, wallStyles['pers']['tower'].angle, wallStyles['pers']['tower'].width); |
| 161 | wallStyles['pers']['endLeft'] = new WallElement('endLeft', wallStyles['pers']['tower'].entity, wallStyles['pers']['tower'].angle, wallStyles['pers']['tower'].width); |
| 162 | wallStyles['pers']['cornerIn'] = new WallElement('cornerIn', 'structures/pers_wall_tower', 5*PI/4, 0.2, 0.5, PI/2); |
| 163 | wallStyles['pers']['cornerOut'] = new WallElement('cornerOut', 'structures/pers_wall_tower', 3*PI/4, 0.8, 0, -PI/2); |
| 164 | wallStyles['pers']['outpost'] = new WallElement('outpost', 'structures/pers_outpost', PI, 0, -5); |
| 165 | wallStyles['pers']['house'] = new WallElement('house', 'structures/pers_house', PI, 0, 6); |
| 166 | wallStyles['pers']['barracks'] = new WallElement('barracks', 'structures/pers_barracks', PI, 0, 7); |
| 167 | // Add civilisation wall style 'rome' |
| 168 | wallStyles['rome'] = {}; |
| 169 | wallStyles['rome']['wall'] = new WallElement('wall', 'structures/rome_wall', 0*PI, 5.9); |
| 170 | wallStyles['rome']['tower'] = new WallElement('tower', 'structures/rome_wall_tower', PI, 2.1); |
| 171 | wallStyles['rome']['wallFort'] = new WallElement('wallFort', 'structures/rome_fortress', PI, 6.3, 2.1); |
| 172 | wallStyles['rome']['gate'] = new WallElement('gate', 'structures/rome_wall_gate', 0*PI, 5.9); |
| 173 | wallStyles['rome']['entry'] = new WallElement('entry', undefined, wallStyles['rome']['gate'].angle, wallStyles['rome']['gate'].width); |
| 174 | wallStyles['rome']['entryTower'] = new WallElement('entryTower', 'structures/rome_defense_tower', PI, 5.9, -5); |
| 175 | wallStyles['rome']['entryFort'] = new WallElement('entryFort', 'structures/rome_fortress', PI, 12, 7); |
| 176 | wallStyles['rome']['endRight'] = new WallElement('endRight', wallStyles['rome']['tower'].entity, wallStyles['rome']['tower'].angle, wallStyles['rome']['tower'].width); |
| 177 | wallStyles['rome']['endLeft'] = new WallElement('endLeft', wallStyles['rome']['tower'].entity, wallStyles['rome']['tower'].angle, wallStyles['rome']['tower'].width); |
| 178 | wallStyles['rome']['cornerIn'] = new WallElement('cornerIn', 'structures/rome_wall_tower', 5*PI/4, 0, 0.7, PI/2); |
| 179 | wallStyles['rome']['cornerOut'] = new WallElement('cornerOut', 'structures/rome_wall_tower', 3*PI/4, 1.1, 0, -PI/2); |
| 180 | wallStyles['rome']['outpost'] = new WallElement('outpost', 'structures/rome_outpost', PI, 0, -5); |
| 181 | wallStyles['rome']['house'] = new WallElement('house', 'structures/rome_house', PI, 0, 7); |
| 182 | wallStyles['rome']['barracks'] = new WallElement('barracks', 'structures/rome_barracks', PI, 0, 6); |
| 183 | // Add special wall style 'romeSiege' |
| 184 | wallStyles['romeSiege'] = {}; |
| 185 | wallStyles['romeSiege']['wall'] = new WallElement('wall', 'structures/rome_siege_wall', 0*PI, 6.2); |
| 186 | wallStyles['romeSiege']['tower'] = new WallElement('tower', 'structures/rome_siege_wall_tower', PI, 0); |
| 187 | wallStyles['romeSiege']['wallFort'] = new WallElement('wallFort', 'structures/rome_army_camp', PI, 7.2, 2); |
| 188 | wallStyles['romeSiege']['gate'] = new WallElement('gate', 'structures/rome_siege_wall_gate', 0*PI, 5.9); |
| 189 | wallStyles['romeSiege']['entry'] = new WallElement('entry', undefined, wallStyles['romeSiege']['gate'].angle, wallStyles['romeSiege']['gate'].width); |
| 190 | wallStyles['romeSiege']['entryTower'] = new WallElement('entryTower', 'structures/rome_defense_tower', PI, 5.9, -4); |
| 191 | wallStyles['romeSiege']['entryFort'] = new WallElement('entryFort', 'structures/rome_army_camp', PI, 12, 7); |
| 192 | wallStyles['romeSiege']['endRight'] = new WallElement('endRight', wallStyles['romeSiege']['tower'].entity, wallStyles['romeSiege']['tower'].angle, wallStyles['romeSiege']['tower'].width); |
| 193 | wallStyles['romeSiege']['endLeft'] = new WallElement('endLeft', wallStyles['romeSiege']['tower'].entity, wallStyles['romeSiege']['tower'].angle, wallStyles['romeSiege']['tower'].width); |
| 194 | wallStyles['romeSiege']['cornerIn'] = new WallElement('cornerIn', 'structures/rome_defense_tower', 5*PI/4, 0.1, 0.3, PI/2); |
| 195 | wallStyles['romeSiege']['cornerIn2'] = new WallElement('cornerIn2', undefined, 5*PI/4, -1.6, 0, PI/2); // Grafic glitch |
| 196 | wallStyles['romeSiege']['cornerOut'] = new WallElement('cornerOut', 'structures/rome_siege_wall_tower', 3*PI/4, 1.4, -0.2, -PI/2); |
| 197 | wallStyles['romeSiege']['outpost'] = new WallElement('outpost', 'structures/rome_outpost', PI, 0, -5); |
| 198 | wallStyles['romeSiege']['house'] = new WallElement('house', 'structures/rome_tent', PI, 0, 4); |
| 199 | wallStyles['romeSiege']['barracks'] = new WallElement('barracks', 'structures/rome_barracks', PI, 0, 6); |
| 200 | // Add special wall style 'palisades' |
| 201 | wallStyles['palisades'] = {}; |
| 202 | wallStyles['palisades']['wall'] = new WallElement('wall', 'other/palisades_rocks_straight', -PI/2, 2.5); |
| 203 | wallStyles['palisades']['tower'] = new WallElement('tower', 'other/palisades_rocks_tower', -PI/2, 0.7); |
| 204 | wallStyles['palisades']['wallFort'] = new WallElement('wallFort', 'other/palisades_rocks_fort', PI, 1.7); |
| 205 | wallStyles['palisades']['gate'] = new WallElement('gate', 'other/palisades_rocks_gate', 0*PI, 3.6); |
| 206 | wallStyles['palisades']['entry'] = new WallElement('entry', undefined, wallStyles['palisades']['gate'].angle, wallStyles['palisades']['gate'].width); |
| 207 | wallStyles['palisades']['entryTower'] = new WallElement('entryTower', 'other/palisades_rocks_watchtower', 0*PI, 3.6, -2); |
| 208 | wallStyles['palisades']['entryFort'] = new WallElement('entryFort', 'other/palisades_rocks_fort', PI, 6, 3); |
| 209 | wallStyles['palisades']['endRight'] = new WallElement('endRight', 'other/palisades_rocks_end', -PI/2, 0.2); |
| 210 | wallStyles['palisades']['endLeft'] = new WallElement('endLeft', 'other/palisades_rocks_end', PI/2, 0.2); |
| 211 | wallStyles['palisades']['cornerIn'] = new WallElement('cornerIn', 'other/palisades_rocks_curve', 3*PI/4, 2.1, 0.7, PI/2); |
| 212 | wallStyles['palisades']['cornerOut'] = new WallElement('cornerOut', 'other/palisades_rocks_curve', 5*PI/4, 2.1, -0.7, -PI/2); |
| 213 | wallStyles['palisades']['outpost'] = new WallElement('outpost', 'other/palisades_rocks_outpost', PI, 0, -2); |
| 214 | wallStyles['palisades']['house'] = new WallElement('house', 'other/celt_hut', PI, 0, 5); |
| 215 | wallStyles['palisades']['barracks'] = new WallElement('barracks', 'other/celt_tavern', PI, 0, 5); |
| 216 | // Add special wall style 'road' |
| 217 | // Add special wall element collection 'other' |
| 218 | // NOTE: This is not a wall style in the common sense. Use with care! |
| 219 | wallStyles['other'] = {}; |
| 220 | wallStyles['other']['fence'] = new WallElement('fence', 'other/fence_long', -PI/2, 3.1); |
| 221 | wallStyles['other']['fence_short'] = new WallElement('fence_short', 'other/fence_short', -PI/2, 1.5); |
| 222 | wallStyles['other']['fence_stone'] = new WallElement('fence_stone', 'other/fence_stone', -PI/2, 2.5); |
| 223 | wallStyles['other']['palisade'] = new WallElement('palisade', 'other/palisades_rocks_short', 0, 1.2); |
| 224 | wallStyles['other']['column'] = new WallElement('column', 'other/column_doric', 0, 1); |
| 225 | wallStyles['other']['obelisk'] = new WallElement('obelisk', 'other/obelisk', 0, 2); |
| 226 | wallStyles['other']['spike'] = new WallElement('spike', 'other/palisades_angle_spike', -PI/2, 1); |
| 227 | wallStyles['other']['bench'] = new WallElement('bench', 'other/bench', PI/2, 1.5); |
| 228 | wallStyles['other']['benchForTable'] = new WallElement('benchForTable', 'other/bench', 0, 0.5); |
| 229 | wallStyles['other']['table'] = new WallElement('table', 'other/table_rectangle', 0, 1); |
| 230 | wallStyles['other']['table_square'] = new WallElement('table_square', 'other/table_square', PI/2, 1); |
| 231 | wallStyles['other']['flag'] = new WallElement('flag', 'special/rallypoint', PI, 1); |
| 232 | wallStyles['other']['standing_stone'] = new WallElement('standing_stone', 'gaia/special_ruins_standing_stone', PI, 1); |
| 233 | wallStyles['other']['settlement'] = new WallElement('settlement', 'gaia/special_settlement', PI, 6); |
| 234 | wallStyles['other']['gap'] = new WallElement('gap', undefined, 0, 2); |
| 235 | wallStyles['other']['gapSmall'] = new WallElement('gapSmall', undefined, 0, 1); |
| 236 | wallStyles['other']['gapLarge'] = new WallElement('gapLarge', undefined, 0, 4); |
| 237 | wallStyles['other']['cornerIn'] = new WallElement('cornerIn', undefined, 0, 0, 0, PI/2); |
| 238 | wallStyles['other']['cornerOut'] = new WallElement('cornerOut', undefined, 0, 0, 0, -PI/2); |
| 239 | |
| 240 | |
| 241 | // Setup data structure for some default fortress types |
| 242 | // A fortress type is just an instance of the fortress class with actually something in it. |
| 243 | // fortressTypes holds all the fortressess within an associative array while a fortress is associated with a descriptive string maching the map sizes, example: 'tiny', 'giant' |
| 244 | var fortressTypes = {}; |
| 245 | // Setup some default fortress types |
| 246 | // Add fortress type 'tiny' |
| 247 | fortressTypes['tiny'] = new Fortress('tiny'); |
| 248 | var wallPart = ['entry', 'endLeft', 'wall', 'cornerIn', 'wall', 'endRight']; |
| 249 | fortressTypes['tiny'].wall = wallPart.concat(wallPart, wallPart, wallPart); |
| 250 | // Add fortress type 'small' |
| 251 | fortressTypes['small'] = new Fortress('small'); |
| 252 | var wallPart = ['entry', 'endLeft', 'wall', 'outpost', 'wall', |
| 253 | 'cornerIn', 'wall', 'outpost', 'wall', 'endRight']; |
| 254 | fortressTypes['small'].wall = wallPart.concat(wallPart, wallPart, wallPart); |
| 255 | // Add fortress type 'medium' |
| 256 | fortressTypes['medium'] = new Fortress('medium'); |
| 257 | var wallPart = ['entry', 'endLeft', 'wall', 'tower', 'wall', |
| 258 | 'cornerIn', 'wall', 'tower', 'wall', 'endRight']; |
| 259 | fortressTypes['medium'].wall = wallPart.concat(wallPart, wallPart, wallPart); |
| 260 | // Add fortress type 'normal' |
| 261 | fortressTypes['normal'] = new Fortress('normal'); |
| 262 | var wallPart = ['entry', 'endLeft', 'wall', 'outpost', 'wall', 'cornerIn', 'wall', |
| 263 | 'cornerOut', 'wall', 'cornerIn', 'wall', 'outpost', 'wall', 'endRight']; |
| 264 | fortressTypes['normal'].wall = wallPart.concat(wallPart, wallPart, wallPart); |
| 265 | // Add fortress type 'large' |
| 266 | fortressTypes['large'] = new Fortress('large'); |
| 267 | var wallPart = ['entry', 'endLeft', 'wall', 'tower', 'wall', 'cornerIn', 'wall', |
| 268 | 'cornerOut', 'wall', 'cornerIn', 'wall', 'tower', 'wall', 'endRight']; |
| 269 | fortressTypes['large'].wall = wallPart.concat(wallPart, wallPart, wallPart); |
| 270 | // Add fortress type 'veryLarge' |
| 271 | fortressTypes['veryLarge'] = new Fortress('veryLarge'); |
| 272 | var wallPart = ['entry', 'endLeft', 'wall', 'outpost', 'wall', 'cornerIn', 'wall', 'outpost', 'wall', |
| 273 | 'cornerOut', 'wall', 'outpost', 'wall', 'cornerIn', 'wall', 'outpost', 'wall', 'endRight']; |
| 274 | fortressTypes['veryLarge'].wall = wallPart.concat(wallPart, wallPart, wallPart); |
| 275 | // Add fortress type 'giant' |
| 276 | fortressTypes['giant'] = new Fortress('giant'); |
| 277 | var wallPart = ['entry', 'endLeft', 'wall', 'tower', 'wall', 'cornerIn', 'wall', 'tower', 'wall', |
| 278 | 'cornerOut', 'wall', 'tower', 'wall', 'cornerIn', 'wall', 'tower', 'wall', 'endRight']; |
| 279 | fortressTypes['giant'].wall = wallPart.concat(wallPart, wallPart, wallPart); |
| 280 | |
| 281 | // Setup some semi default fortresses for 'palisades' style |
| 282 | var fortressTypeKeys = ['tiny', 'small', 'medium', 'normal', 'large', 'veryLarge', 'giant'] |
| 283 | for (var i = 0; i < fortressTypeKeys.length; i++) |