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