]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/client/vehicles/vehicles.qc
fix lots of uninitialized
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / vehicles / vehicles.qc
1 #define hud_bg "gfx/vehicles/frame.tga"
2 #define hud_sh "gfx/vehicles/vh-shield.tga"
3
4 #define hud_hp_bar "gfx/vehicles/bar_up_left.tga"
5 #define hud_hp_ico "gfx/vehicles/health.tga"
6 #define hud_sh_bar "gfx/vehicles/bar_dwn_left.tga"
7 #define hud_sh_ico "gfx/vehicles/shield.tga"
8
9 #define hud_ammo1_bar "gfx/vehicles/bar_up_right.tga"
10 #define hud_ammo1_ico "gfx/vehicles/bullets.tga"
11 #define hud_ammo2_bar "gfx/vehicles/bar_dwn_right.tga"
12 #define hud_ammo2_ico "gfx/vehicles/rocket.tga"
13 #define hud_energy "gfx/vehicles/energy.tga"
14
15 #define SBRM_FIRST 1
16 #define SBRM_VOLLY 1
17 #define SBRM_GUIDE 2
18 #define SBRM_ARTILLERY 3
19 #define SBRM_LAST 3
20
21 #define RSM_FIRST 1
22 #define RSM_BOMB 1
23 #define RSM_FLARE 2
24 #define RSM_LAST 2
25
26 entity dropmark;
27 var float autocvar_cl_vehicles_hudscale = 0.5;
28 var float autocvar_cl_vehicles_hudalpha = 0.75;
29
30 #define raptor_ico  "gfx/vehicles/raptor.tga"
31 #define raptor_gun  "gfx/vehicles/raptor_guns.tga"
32 #define raptor_bomb "gfx/vehicles/raptor_bombs.tga"
33 #define raptor_drop "gfx/vehicles/axh-dropcross.tga"
34 string raptor_xhair;
35
36 void CSQC_WAKIZASHI_HUD();
37 void CSQC_SPIDER_HUD();
38 void CSQC_RAPTOR_HUD();
39 void CSQC_BUMBLE_HUD();
40 void CSQC_BUMBLE_GUN_HUD();
41
42 #define MAX_AXH 4
43 entity AuxiliaryXhair[MAX_AXH];
44 const var void Draw_Not();
45
46 .string axh_image;
47 .float  axh_fadetime;
48 .float  axh_drawflag;
49 .float  axh_scale;
50
51 #define bumb_ico  "gfx/vehicles/bumb.tga"
52 #define bumb_lgun  "gfx/vehicles/bumb_lgun.tga"
53 #define bumb_rgun  "gfx/vehicles/bumb_rgun.tga"
54
55 #define bumb_gun_ico  "gfx/vehicles/bumb_side.tga"
56 #define bumb_gun_gun  "gfx/vehicles/bumb_side_gun.tga"
57
58 #define spider_ico  "gfx/vehicles/sbot.tga"
59 #define spider_rkt  "gfx/vehicles/sbot_rpods.tga"
60 #define spider_mgun "gfx/vehicles/sbot_mguns.tga"
61 string spider_xhair; // = "gfx/vehicles/axh-special1.tga";
62
63 #define waki_ico "gfx/vehicles/waki.tga"
64 #define waki_eng "gfx/vehicles/waki_e.tga"
65 #define waki_gun "gfx/vehicles/waki_guns.tga"
66 #define waki_rkt "gfx/vehicles/waki_rockets.tga"
67 #define waki_xhair "gfx/vehicles/axh-special1.tga"
68
69 float alarm1time;
70 float alarm2time;
71 float weapon2mode;
72
73 void AuxiliaryXhair_Draw2D()
74 {
75     vector loc, psize;
76
77     psize = self.axh_scale * draw_getimagesize(self.axh_image);
78     loc = project_3d_to_2d(self.move_origin) - 0.5 * psize;
79     if not (loc_z < 0 || loc_x < 0 || loc_y < 0 || loc_x > vid_conwidth || loc_y > vid_conheight)
80     {
81         loc_z = 0;
82         psize_z = 0;
83         drawpic(loc, self.axh_image, psize, self.colormod, self.alpha, self.axh_drawflag);
84     }
85
86     if(time - self.cnt > self.axh_fadetime)
87         self.draw2d = Draw_Not;
88 }
89
90 void Net_AuXair2(float bIsNew)
91 {
92     float axh_id        = bound(0, ReadByte(), MAX_AXH);
93     entity axh          = AuxiliaryXhair[axh_id];
94
95     if(axh == world || wasfreed(axh))  // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
96     {
97         axh                                     = spawn();
98                 axh.draw2d                      = Draw_Not;
99                 axh.drawmask            = MASK_NORMAL;
100                 axh.axh_drawflag        = DRAWFLAG_ADDITIVE;
101                 axh.axh_fadetime        = 0.1;
102                 axh.axh_image           = "gfx/vehicles/axh-ring.tga";
103                 axh.axh_scale           = 1;
104         axh.alpha                       = 1;
105                 AuxiliaryXhair[axh_id] = axh;
106     }
107     
108         axh.move_origin_x       = ReadCoord();
109         axh.move_origin_y       = ReadCoord();
110         axh.move_origin_z       = ReadCoord();
111         axh.colormod_x          = ReadByte() / 255;
112         axh.colormod_y          = ReadByte() / 255;
113         axh.colormod_z          = ReadByte() / 255;
114     axh.cnt                     = time;
115     axh.draw2d                  = AuxiliaryXhair_Draw2D;        
116 }
117
118 void Net_VehicleSetup()
119 {
120
121     float i;
122     
123     float hud_id = ReadByte();
124     
125     // Weapon update?
126     if(hud_id > HUD_VEHICLE_LAST)
127     {
128         weapon2mode = hud_id - HUD_VEHICLE_LAST;
129         return;
130     }
131     
132     // hud_id == 0 means we exited a vehicle, so stop alarm sound/s
133     if(hud_id == 0)
134     {
135         sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTN_NONE);
136         sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTN_NONE);    
137         return;
138     }
139     
140     hud_id  = bound(HUD_VEHICLE_FIRST, hud_id, HUD_VEHICLE_LAST);
141
142     // Init auxiliary crosshairs
143     entity axh;
144     for(i = 0; i < MAX_AXH; ++i)
145     {
146         axh = AuxiliaryXhair[i];
147         if(axh != world && !wasfreed(axh))  // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
148             remove(axh);
149
150         axh                                     = spawn();
151                 axh.draw2d                      = Draw_Not;
152                 axh.drawmask            = MASK_NORMAL;
153                 axh.axh_drawflag        = DRAWFLAG_NORMAL;
154                 axh.axh_fadetime        = 0.1;
155                 axh.axh_image           = "gfx/vehicles/axh-ring.tga";
156                 axh.axh_scale           = 1;
157         axh.alpha                       = 1;
158                 AuxiliaryXhair[i]       = axh;
159     }
160
161     switch(hud_id)
162     {
163         case HUD_SPIDERBOT:
164             // Minigun1
165             AuxiliaryXhair[0].axh_image   = "gfx/vehicles/axh-ring.tga";
166             AuxiliaryXhair[0].axh_scale   = 0.25;
167             // Minigun2
168             AuxiliaryXhair[1].axh_image   = "gfx/vehicles/axh-ring.tga";
169             AuxiliaryXhair[1].axh_scale   = 0.25;
170             // Rocket
171             AuxiliaryXhair[2].axh_image   = "gfx/vehicles/axh-special1.tga";
172             AuxiliaryXhair[2].axh_scale   = 0.5;
173             break;
174
175         case HUD_WAKIZASHI:
176             AuxiliaryXhair[0].axh_image   = "gfx/vehicles/axh-bracket.tga";
177             AuxiliaryXhair[0].axh_scale   = 0.25;
178             break;
179
180         case HUD_RAPTOR:
181             AuxiliaryXhair[0].axh_image   = "gfx/vehicles/axh-special2.tga";
182             AuxiliaryXhair[0].axh_scale   = 0.5;
183             //AuxiliaryXhair[0].alpha       = 0.5;
184
185             AuxiliaryXhair[1].axh_image   = "gfx/vehicles/axh-bracket.tga";
186             AuxiliaryXhair[1].axh_scale   = 0.25;
187             //AuxiliaryXhair[1].alpha       = 0.75;
188             //AuxiliaryXhair[1].axh_drawflag  = DRAWFLAG_NORMAL;
189             break;
190
191         case HUD_BUMBLEBEE:
192             // Raygun-locked
193             AuxiliaryXhair[0].axh_image   = "gfx/vehicles/axh-bracket.tga";
194             AuxiliaryXhair[0].axh_scale   = 0.5;
195             
196             // Gunner1
197             AuxiliaryXhair[1].axh_image   = "gfx/vehicles/axh-target.tga";
198             AuxiliaryXhair[1].axh_scale   = 0.75;
199             
200             // Gunner2
201             AuxiliaryXhair[2].axh_image   = "gfx/vehicles/axh-target.tga";
202             AuxiliaryXhair[2].axh_scale   = 0.75;
203             break;        
204         case HUD_BUMBLEBEE_GUN:
205             // Plasma cannons
206             AuxiliaryXhair[0].axh_image   = "gfx/vehicles/axh-bracket.tga";
207             AuxiliaryXhair[0].axh_scale   = 0.25;
208             // Raygun
209             AuxiliaryXhair[1].axh_image   = "gfx/vehicles/axh-bracket.tga";
210             AuxiliaryXhair[1].axh_scale   = 0.25;
211             break;
212     }
213 }
214 #define HUD_GETSTATS \
215     float vh_health    = getstati(STAT_VEHICLESTAT_HEALTH);  \
216         float shield    = getstati(STAT_VEHICLESTAT_SHIELD);  \
217         float energy    = getstati(STAT_VEHICLESTAT_ENERGY);  \
218         float ammo1     = getstati(STAT_VEHICLESTAT_AMMO1);   \
219         float reload1   = getstati(STAT_VEHICLESTAT_RELOAD1); \
220         float ammo2     = getstati(STAT_VEHICLESTAT_AMMO2);   \
221         float reload2   = getstati(STAT_VEHICLESTAT_RELOAD2);
222
223 void CSQC_BUMBLE_HUD()
224 {
225 /*
226     drawpic(hudloc, waki_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
227     drawpic(hudloc, waki_b, picsize, '0 1 0' * health + '1 0 0'  * (1 - health), 1, DRAWFLAG_NORMAL);
228     drawpic(hudloc, waki_r, picsize, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
229     drawpic(hudloc, waki_e, picsize, '1 1 1' * energy + '1 0 0'  * (1 - energy), 1, DRAWFLAG_NORMAL);
230 */
231         if(autocvar_r_letterbox)
232         return;
233
234     vector picsize, hudloc = '0 0 0', pic2size, picloc;
235
236     // Fetch health & ammo stats
237         HUD_GETSTATS
238
239     picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
240     hudloc_y = vid_conheight - picsize_y;
241     hudloc_x = vid_conwidth * 0.5 - picsize_x * 0.5;
242
243     drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
244
245     shield  *= 0.01;
246     vh_health  *= 0.01;
247     energy  *= 0.01;
248     reload1 *= 0.01;
249
250     pic2size = draw_getimagesize(bumb_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
251     picloc = picsize * 0.5 - pic2size * 0.5;
252     
253     if(vh_health < 0.25)
254         drawpic(hudloc + picloc, bumb_ico, pic2size,  '1 0 0' + '0 1 1' * sin(time * 8),  1, DRAWFLAG_NORMAL);
255     else
256         drawpic(hudloc + picloc, bumb_ico, pic2size,  '1 1 1' * vh_health  + '1 0 0' * (1 - vh_health),  1, DRAWFLAG_NORMAL);
257     
258     drawpic(hudloc + picloc, bumb_lgun, pic2size, '1 1 1' * energy   + '1 0 0' * (1 - energy),   1, DRAWFLAG_NORMAL);
259     drawpic(hudloc + picloc, bumb_lgun, pic2size, '1 1 1' * energy   + '1 0 0' * (1 - energy),   1, DRAWFLAG_NORMAL);
260     drawpic(hudloc + picloc, hud_sh, pic2size,  '1 1 1', shield, DRAWFLAG_NORMAL);
261
262 // Health bar
263     picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
264     picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
265     drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
266     drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
267     drawresetcliparea();
268 // ..  and icon
269     picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
270     picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
271     if(vh_health < 0.25)
272     {
273         if(alarm1time < time)
274         {
275             alarm1time = time + 2;
276             sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTN_NONE);
277         }
278         
279         drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
280     }        
281     else
282     {
283         drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
284         if(alarm1time)
285         {
286             sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTN_NONE);
287             alarm1time = 0;
288         }        
289     }
290
291 // Shield bar
292     picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
293     picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
294     drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - shield)), 0, vid_conwidth, vid_conheight);
295     drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
296     drawresetcliparea();
297 // ..  and icon
298     picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
299     picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
300     if(shield < 0.25)
301     {
302         if(alarm2time < time)
303         {
304             alarm2time = time + 1;
305             sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTN_NONE);
306         }
307         drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
308     }
309     else
310     {
311         drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
312         if(alarm2time)
313         {            
314             sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTN_NONE);
315             alarm2time = 0;
316         }
317     }
318     
319         ammo1 *= 0.01;
320         ammo2 *= 0.01;
321         
322 // Gunner1 bar
323     picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
324     picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
325     drawsetcliparea(hudloc_x + picloc_x, picloc_y, picsize_x * ammo1, vid_conheight);
326     drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
327     drawresetcliparea();
328
329 // Right gunner slot occupied?
330         if(AuxiliaryXhair[1].draw2d == Draw_Not)
331         {
332                 shield = (picsize_x * 0.5) - (0.5 * stringwidth(_("No right gunner!"), FALSE, '1 0 0' * picsize_y + '0 1 0' * picsize_y));                              
333                 drawfill(hudloc + picloc - '0.2 0.2 0', picsize + '0.4 0.4 0', '0.25 0.25 0.25', 0.75, DRAWFLAG_NORMAL);
334                 drawstring(hudloc + picloc + '1 0 0' * shield, _("No right gunner!"), '1 0 0' * picsize_y + '0 1 0' * picsize_y, '1 0 0' + '0 1 1' * sin(time * 10), 1, DRAWFLAG_NORMAL);
335         }
336         
337 // ..  and icon
338     picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale;
339     picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
340     if(ammo1 < 0.2)
341         drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
342     else
343         drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
344         
345 // Gunner2 bar
346     picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
347     picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
348     drawsetcliparea(hudloc_x + picloc_x, picloc_y, picsize_x * ammo2, vid_conheight);
349     drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
350     drawresetcliparea();
351 // Left gunner slot occupied?
352         if(AuxiliaryXhair[2].draw2d == Draw_Not)
353         {
354                 shield = (picsize_x * 0.5) - (0.5 * stringwidth(_("No left gunner!"), FALSE, '1 0 0' * picsize_y + '0 1 0' * picsize_y));                               
355                 drawfill(hudloc + picloc - '0.2 0.2 0', picsize + '0.4 0.4 0', '0.25 0.25 0.25', 0.75, DRAWFLAG_NORMAL);
356                 drawstring(hudloc + picloc + '1 0 0' * shield, _("No left gunner!"), '1 0 0' * picsize_y + '0 1 0' * picsize_y, '1 0 0' + '0 1 1' * sin(time * 10), 1, DRAWFLAG_NORMAL);
357         }
358
359 // ..  and icon
360     picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale;
361     picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
362     if(ammo2 < 0.2)
363         drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
364     else
365         drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
366
367         if (scoreboard_showscores)
368                 HUD_DrawScoreboard();
369     else
370     {
371         picsize = draw_getimagesize(waki_xhair);
372         picsize_x *= 0.5;
373         picsize_y *= 0.5;
374         drawpic('0.5 0 0' * (vid_conwidth - picsize_x) + '0 0.5 0' * (vid_conheight - picsize_y), waki_xhair, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
375     }
376     
377 }
378
379 void CSQC_BUMBLE_GUN_HUD()
380 {
381
382         if(autocvar_r_letterbox)
383         return;
384
385     vector picsize, hudloc = '0 0 0', pic2size, picloc;
386
387     // Fetch health & ammo stats
388         HUD_GETSTATS
389
390     picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
391     hudloc_y = vid_conheight - picsize_y;
392     hudloc_x = vid_conwidth * 0.5 - picsize_x * 0.5;
393
394     drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
395
396     shield  *= 0.01;
397     vh_health  *= 0.01;
398     energy  *= 0.01;
399     reload1 *= 0.01;
400
401     pic2size = draw_getimagesize(bumb_gun_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
402     picloc = picsize * 0.5 - pic2size * 0.5;
403     
404     if(vh_health < 0.25)
405         drawpic(hudloc + picloc, bumb_gun_ico, pic2size,  '1 0 0' + '0 1 1' * sin(time * 8),  1, DRAWFLAG_NORMAL);
406     else
407         drawpic(hudloc + picloc, bumb_gun_ico, pic2size,  '1 1 1' * vh_health  + '1 0 0' * (1 - vh_health),  1, DRAWFLAG_NORMAL);
408     
409     drawpic(hudloc + picloc, bumb_gun_gun, pic2size, '1 1 1' * energy   + '1 0 0' * (1 - energy),   1, DRAWFLAG_NORMAL);
410     drawpic(hudloc + picloc, hud_sh, pic2size,  '1 1 1', shield, DRAWFLAG_NORMAL);
411
412 // Health bar
413     picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
414     picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
415     drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
416     drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
417     drawresetcliparea();
418 // ..  and icon
419     picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
420     picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
421     if(vh_health < 0.25)
422     {
423         if(alarm1time < time)
424         {
425             alarm1time = time + 2;
426             sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTN_NONE);
427         }
428         
429         drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
430     }        
431     else
432     {
433         drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
434         if(alarm1time)
435         {
436             sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTN_NONE);
437             alarm1time = 0;
438         }        
439     }
440
441 // Shield bar
442     picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
443     picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
444     drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - shield)), 0, vid_conwidth, vid_conheight);
445     drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
446     drawresetcliparea();
447 // ..  and icon
448     picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
449     picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
450     if(shield < 0.25)
451     {
452         if(alarm2time < time)
453         {
454             alarm2time = time + 1;
455             sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTN_NONE);
456         }
457         drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
458     }
459     else
460     {
461         drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
462         if(alarm2time)
463         {            
464             sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTN_NONE);
465             alarm2time = 0;
466         }
467     }
468     
469 // Gun bar
470     picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
471     picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
472     drawsetcliparea(hudloc_x + picloc_x, picloc_y, picsize_x * energy, vid_conheight);
473     drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
474     drawresetcliparea();
475     
476 // ..  and icon
477     picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale;
478     picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
479     if(energy < 0.2)
480         drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
481     else
482         drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
483
484         if (scoreboard_showscores)
485                 HUD_DrawScoreboard();
486     /*
487     else
488     {
489         picsize = draw_getimagesize(waki_xhair);
490         picsize_x *= 0.5;
491         picsize_y *= 0.5;
492
493
494         drawpic('0.5 0 0' * (vid_conwidth - picsize_x) + '0 0.5 0' * (vid_conheight - picsize_y), waki_xhair, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
495     }
496     */
497 }
498
499
500
501 void CSQC_SPIDER_HUD()
502 {
503         if(autocvar_r_letterbox)
504         return;
505
506     vector picsize, hudloc = '0 0 0', pic2size, picloc;
507     float i;
508
509     // Fetch health & ammo stats
510         HUD_GETSTATS
511
512     picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
513     hudloc_y = vid_conheight - picsize_y;
514     hudloc_x = vid_conwidth * 0.5 - picsize_x * 0.5;
515
516     drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
517
518     ammo1   *= 0.01;
519     shield  *= 0.01;
520     vh_health  *= 0.01;
521     reload2 *= 0.01;
522
523     pic2size = draw_getimagesize(spider_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
524     picloc = picsize * 0.5 - pic2size * 0.5;
525     if(vh_health < 0.25)
526         drawpic(hudloc + picloc, spider_ico, pic2size,  '1 0 0' + '0 1 1' * sin(time * 8),  1, DRAWFLAG_NORMAL);
527     else
528         drawpic(hudloc + picloc, spider_ico, pic2size,  '1 1 1' * vh_health  + '1 0 0' * (1 - vh_health),  1, DRAWFLAG_NORMAL);    
529     drawpic(hudloc + picloc, spider_rkt, pic2size,  '1 1 1' * reload2 + '1 0 0' * (1 - reload2), 1, DRAWFLAG_NORMAL);
530     drawpic(hudloc + picloc, spider_mgun, pic2size, '1 1 1' * ammo1   + '1 0 0' * (1 - ammo1),   1, DRAWFLAG_NORMAL);
531     drawpic(hudloc + picloc, hud_sh, pic2size,  '1 1 1', shield, DRAWFLAG_NORMAL);
532
533 // Health bar
534     picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
535     picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
536     drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
537     drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
538     drawresetcliparea();
539 // ..  and icon
540     picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
541     picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
542     if(vh_health < 0.25)
543     {
544         if(alarm1time < time)
545         {
546             alarm1time = time + 2;
547             sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTN_NONE);
548         }        
549         drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
550     }        
551     else
552     {
553         drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
554         if(alarm1time)
555         {
556             sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTN_NONE);
557             alarm1time = 0;
558         }        
559     }
560 // Shield bar
561     picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
562     picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
563     drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - shield)), 0, vid_conwidth, vid_conheight);
564     drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
565     drawresetcliparea();
566 // ..  and icon
567     picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
568     picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
569     if(shield < 0.25)
570     {
571         if(alarm2time < time)
572         {
573             alarm2time = time + 1;
574             sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTN_NONE);
575         }
576         drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
577     }
578     else
579     {
580         drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
581         if(alarm2time)
582         {            
583             sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTN_NONE);
584             alarm2time = 0;
585         }
586     }
587
588 // Minigun bar
589     picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
590     picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
591     drawsetcliparea(hudloc_x + picloc_x, picloc_y, picsize_x * ammo1, vid_conheight);
592     drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
593     drawresetcliparea();
594 // ..  and icon
595     picsize = draw_getimagesize(hud_ammo1_ico) * autocvar_cl_vehicles_hudscale;
596     picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
597     if(ammo1 < 0.2)
598         drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
599     else
600         drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
601
602 // Rocket ammo bar
603     picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
604     ammo1 = picsize_x / 8;
605     picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
606     drawsetcliparea(hudloc_x + picloc_x, hudloc_y + picloc_y, picsize_x * reload2, vid_conheight);
607     drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
608     drawresetcliparea();
609
610 // ..  and icons
611     pic2size = 0.35 * draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
612     picloc_x -= pic2size_x;
613     picloc_y += pic2size_y * 2.25;
614     if(ammo2 == 9)
615     {
616         for(i = 1; i < 9; ++i)
617         {
618             picloc_x += ammo1;
619             drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, ((8 * reload2 <= i) ? '0 0 0' : '1 1 1'), 0.75, DRAWFLAG_NORMAL);
620         }
621     }
622     else
623     {
624         for(i = 1; i < 9; ++i)
625         {
626             picloc_x += ammo1;
627             drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, ((i >= ammo2) ? '1 1 1' : '0 0 0'), 0.75, DRAWFLAG_NORMAL);
628         }
629     }
630     pic2size = draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
631     picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
632     if(ammo2 == 9)
633         drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
634     else
635         drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 1 1', 1, DRAWFLAG_NORMAL);
636
637         if (scoreboard_showscores)
638                 HUD_DrawScoreboard();
639     else
640     {
641         switch(weapon2mode)
642         {
643             case SBRM_VOLLY:
644                 spider_xhair = "gfx/vehicles/axh-bracket.tga";
645                 break;
646             case SBRM_GUIDE:
647                 spider_xhair = "gfx/vehicles/axh-cross.tga";
648                 break;
649             case SBRM_ARTILLERY:
650                 spider_xhair = "gfx/vehicles/axh-tag.tga";
651                 break;
652             default:
653                 spider_xhair= "gfx/vehicles/axh-tag.tga";
654         }
655
656         picsize = draw_getimagesize(spider_xhair);
657         picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size;
658         picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size;
659
660         drawpic('0.5 0 0' * (vid_conwidth - picsize_x) + '0 0.5 0' * (vid_conheight - picsize_y), spider_xhair, picsize, '1 1 1', autocvar_cl_vehicle_spiderbot_cross_alpha, DRAWFLAG_ADDITIVE);
661     }
662 }
663
664 void CSQC_RAPTOR_HUD()
665 {
666         if(autocvar_r_letterbox)
667         return;
668
669     vector picsize, hudloc = '0 0 0', pic2size, picloc;
670
671     // Fetch health & ammo stats
672         HUD_GETSTATS
673
674     picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
675     hudloc_y = vid_conheight - picsize_y;
676     hudloc_x = vid_conwidth * 0.5 - picsize_x * 0.5;
677
678     drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
679
680     ammo1   *= 0.01;
681     ammo2   *= 0.01;
682     shield  *= 0.01;
683     vh_health  *= 0.01;
684     energy  *= 0.01;
685     reload1 = reload2 * 0.01;
686     //reload2 *= 0.01;
687
688     pic2size = draw_getimagesize(spider_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
689     picloc = picsize * 0.5 - pic2size * 0.5;
690     if(vh_health < 0.25)
691         drawpic(hudloc + picloc, raptor_ico, pic2size,  '1 0 0' + '0 1 1' * sin(time * 8),  1, DRAWFLAG_NORMAL);
692     else
693         drawpic(hudloc + picloc, raptor_ico, pic2size,  '1 1 1' * vh_health  + '1 0 0' * (1 - vh_health),  1, DRAWFLAG_NORMAL);
694     drawpic(hudloc + picloc, raptor_bomb, pic2size,  '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
695     drawpic(hudloc + picloc, raptor_gun, pic2size, '1 1 1' * energy   + '1 0 0' * (1 - energy),   1, DRAWFLAG_NORMAL);
696     drawpic(hudloc + picloc, hud_sh, pic2size,  '1 1 1', shield, DRAWFLAG_NORMAL);
697
698 // Health bar
699     picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
700     picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
701     drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
702     drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
703     drawresetcliparea();
704 // ..  and icon
705     picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
706     picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
707     if(vh_health < 0.25)
708     {
709         if(alarm1time < time)
710         {
711             alarm1time = time + 2;
712             sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTN_NONE);
713         }
714         
715         drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
716     }        
717     else
718     {
719         drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
720         if(alarm1time)
721         {
722             sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTN_NONE);
723             alarm1time = 0;
724         }
725     }
726
727 // Shield bar
728     picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
729     picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
730     drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - shield)), 0, vid_conwidth, vid_conheight);
731     drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
732     drawresetcliparea();
733 // ..  and icon
734     picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
735     picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
736     if(shield < 0.25)
737     {
738         if(alarm2time < time)
739         {
740             alarm2time = time + 1;
741             sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTN_NONE);
742         }
743         drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
744     }
745     else
746     {
747         drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
748         if(alarm2time)
749         {            
750             sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTN_NONE);
751             alarm2time = 0;
752         }
753     }
754     
755 // Gun bar
756     picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
757     picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
758     drawsetcliparea(hudloc_x + picloc_x, picloc_y, picsize_x * energy, vid_conheight);
759     drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
760     drawresetcliparea();
761 // ..  and icon
762     picsize = draw_getimagesize(hud_ammo1_ico) * autocvar_cl_vehicles_hudscale;
763     picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
764     if(energy < 0.2)
765         drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
766     else
767         drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
768
769 // Bomb bar
770     picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
771     picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
772     drawsetcliparea(hudloc_x + picloc_x, hudloc_y + picloc_y, picsize_x * reload1, vid_conheight);
773     drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
774     drawresetcliparea();
775 // ..  and icon
776     pic2size = draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
777     picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
778     if(reload1 != 1)
779         drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
780     else
781         drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 1 1', 1, DRAWFLAG_NORMAL);
782     
783     if(weapon2mode == RSM_FLARE)
784     {
785         raptor_xhair =  "gfx/vehicles/axh-bracket.tga";
786     }
787     else
788     {
789         raptor_xhair =  "gfx/vehicles/axh-ring.tga";
790         
791         // Bombing crosshair
792         if(!dropmark)
793         {
794             dropmark = spawn();
795             dropmark.owner = self;
796             dropmark.gravity = 1;
797         }
798
799         if(reload2 == 100)
800         {
801             vector where;
802
803             setorigin(dropmark, pmove_org);
804             dropmark.velocity = pmove_vel;
805             tracetoss(dropmark, self);
806
807             where = project_3d_to_2d(trace_endpos);
808
809             setorigin(dropmark, trace_endpos);
810             picsize = draw_getimagesize(raptor_drop) * 0.2;
811
812             if not (where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)
813             {
814                 where_x -= picsize_x * 0.5;
815                 where_y -= picsize_y * 0.5;
816                 where_z = 0;
817                 drawpic(where, raptor_drop, picsize, '0 2 0', 1, DRAWFLAG_ADDITIVE);
818             }
819             dropmark.cnt = time + 5;
820         }
821         else
822         {
823             vector where;
824             if(dropmark.cnt > time)
825             {
826                 where = project_3d_to_2d(dropmark.origin);
827                 picsize = draw_getimagesize(raptor_drop) * 0.25;
828
829                 if not (where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)
830                 {
831                     where_x -= picsize_x * 0.5;
832                     where_y -= picsize_y * 0.5;
833                     where_z = 0;
834                     drawpic(where, raptor_drop, picsize, '2 0 0', 1, DRAWFLAG_ADDITIVE);
835                 }
836             }
837         }
838     }
839     
840         if (scoreboard_showscores)
841                 HUD_DrawScoreboard();
842     else
843     {
844         picsize = draw_getimagesize(raptor_xhair);
845         picsize_x *= 0.5;
846         picsize_y *= 0.5;
847
848         drawpic('0.5 0 0' * (vid_conwidth - picsize_x) + '0 0.5 0' * (vid_conheight - picsize_y), raptor_xhair, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
849     }
850 }
851
852 void CSQC_WAKIZASHI_HUD()
853 {
854 /*
855     drawpic(hudloc, waki_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
856     drawpic(hudloc, waki_b, picsize, '0 1 0' * health + '1 0 0'  * (1 - health), 1, DRAWFLAG_NORMAL);
857     drawpic(hudloc, waki_r, picsize, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
858     drawpic(hudloc, waki_e, picsize, '1 1 1' * energy + '1 0 0'  * (1 - energy), 1, DRAWFLAG_NORMAL);
859 */
860         if(autocvar_r_letterbox)
861         return;
862
863     vector picsize, hudloc = '0 0 0', pic2size, picloc;
864
865     // Fetch health & ammo stats
866         HUD_GETSTATS
867
868     picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
869     hudloc_y = vid_conheight - picsize_y;
870     hudloc_x = vid_conwidth * 0.5 - picsize_x * 0.5;
871
872     drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
873
874     shield  *= 0.01;
875     vh_health  *= 0.01;
876     energy  *= 0.01;
877     reload1 *= 0.01;
878
879     pic2size = draw_getimagesize(spider_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
880     picloc = picsize * 0.5 - pic2size * 0.5;
881     if(vh_health < 0.25)
882         drawpic(hudloc + picloc, waki_ico, pic2size,  '1 0 0' + '0 1 1' * sin(time * 8),  1, DRAWFLAG_NORMAL);
883     else
884         drawpic(hudloc + picloc, waki_ico, pic2size,  '1 1 1' * vh_health  + '1 0 0' * (1 - vh_health),  1, DRAWFLAG_NORMAL);
885     drawpic(hudloc + picloc, waki_eng, pic2size, '1 1 1' * energy   + '1 0 0' * (1 - energy),   1, DRAWFLAG_NORMAL);
886     drawpic(hudloc + picloc, waki_gun, pic2size, '1 1 1' * energy   + '1 0 0' * (1 - energy),   1, DRAWFLAG_NORMAL);
887     drawpic(hudloc + picloc, waki_rkt, pic2size,  '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
888     drawpic(hudloc + picloc, hud_sh, pic2size,  '1 1 1', shield, DRAWFLAG_NORMAL);
889
890 // Health bar
891     picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
892     picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
893     drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
894     drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
895     drawresetcliparea();
896 // ..  and icon
897     picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
898     picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
899     if(vh_health < 0.25)
900     {
901         if(alarm1time < time)
902         {
903             alarm1time = time + 2;
904             sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTN_NONE);
905         }
906         
907         drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
908     }        
909     else
910     {
911         drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
912         if(alarm1time)
913         {
914             sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTN_NONE);
915             alarm1time = 0;
916         }        
917     }
918         
919
920 // Shield bar
921     picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
922     picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
923     drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - shield)), 0, vid_conwidth, vid_conheight);
924     drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
925     drawresetcliparea();
926 // ..  and icon
927     picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
928     picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
929     if(shield < 0.25)
930     {
931         if(alarm2time < time)
932         {
933             alarm2time = time + 1;
934             sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTN_NONE);
935         }
936         drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
937     }
938     else
939     {
940         drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
941         if(alarm2time)
942         {            
943             sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTN_NONE);
944             alarm2time = 0;
945         }
946     }
947     
948 // Gun bar
949     picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
950     picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
951     drawsetcliparea(hudloc_x + picloc_x, picloc_y, picsize_x * energy, vid_conheight);
952     drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
953     drawresetcliparea();
954 // ..  and icon
955     picsize = draw_getimagesize(hud_ammo1_ico) * autocvar_cl_vehicles_hudscale;
956     picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
957     if(energy < 0.2)
958         drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
959     else
960         drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
961
962 // Bomb bar
963     picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
964     picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
965     drawsetcliparea(hudloc_x + picloc_x, hudloc_y + picloc_y, picsize_x * reload1, vid_conheight);
966     drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
967     drawresetcliparea();
968 // ..  and icon
969     pic2size = draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
970     picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
971     if(reload1 != 1)
972         drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
973     else
974         drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 1 1', 1, DRAWFLAG_NORMAL);
975
976         if (scoreboard_showscores)
977                 HUD_DrawScoreboard();
978     else
979     {
980         picsize = draw_getimagesize(waki_xhair);
981         picsize_x *= 0.5;
982         picsize_y *= 0.5;
983
984
985         drawpic('0.5 0 0' * (vid_conwidth - picsize_x) + '0 0.5 0' * (vid_conheight - picsize_y), waki_xhair, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
986     }
987 }
988
989 void Vehicles_Precache()
990 {
991         precache_model("models/vehicles/bomblet.md3");
992         precache_model("models/vehicles/clusterbomb.md3");
993         precache_model("models/vehicles/clusterbomb_fragment.md3");
994         precache_model("models/vehicles/rocket01.md3");
995         precache_model("models/vehicles/rocket02.md3");
996         
997         precache_sound ("vehicles/alarm.wav");
998         precache_sound ("vehicles/alarm_shield.wav");
999 }
1000
1001 void RaptorCBShellfragDraw()
1002 {
1003         if(wasfreed(self))
1004                 return;   
1005                 
1006         Movetype_Physics_MatchTicrate(autocvar_cl_gibs_ticrate, autocvar_cl_gibs_sloppy);
1007         self.move_avelocity += randomvec() * 15;
1008         self.renderflags = 0;
1009         
1010         if(self.cnt < time)
1011                 self.alpha = bound(0, self.nextthink - time, 1);
1012
1013         if(self.alpha < ALPHA_MIN_VISIBLE)
1014         remove(self);
1015 }
1016
1017 void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang)
1018 {
1019     entity sfrag;
1020     
1021     sfrag = spawn();
1022     setmodel(sfrag, "models/vehicles/clusterbomb_fragment.md3");
1023     setorigin(sfrag, _org);
1024
1025         sfrag.move_movetype = MOVETYPE_BOUNCE;
1026         sfrag.gravity = 0.15;
1027         sfrag.solid = SOLID_CORPSE;
1028
1029         sfrag.draw = RaptorCBShellfragDraw;
1030
1031         sfrag.move_origin = sfrag.origin = _org;
1032         sfrag.move_velocity = _vel;
1033         sfrag.move_avelocity = prandomvec() * vlen(sfrag.move_velocity);
1034         sfrag.angles = self.move_angles = _ang;
1035
1036         sfrag.move_time = time;
1037         sfrag.damageforcescale = 4;
1038
1039         sfrag.nextthink = time + 3;
1040         sfrag.cnt = time + 2;
1041         sfrag.alpha = 1;
1042     sfrag.drawmask = MASK_NORMAL;
1043 }