4 #include "../movetypes.qh"
5 #include "../movetypes.qh"
6 #include "../prandom.qh"
7 #include "../scoreboard.qh"
8 #include "../t_items.qh"
10 #include "../../common/buffs.qh"
11 #include "../../common/constants.qh"
12 #include "../../common/stats.qh"
13 #include "../../common/util.qh"
15 #include "../../csqcmodellib/cl_model.qh"
19 const string hud_bg = "gfx/vehicles/frame.tga";
20 const string hud_sh = "gfx/vehicles/vh-shield.tga";
22 const string hud_hp_bar = "gfx/vehicles/bar_up_left.tga";
23 const string hud_hp_ico = "gfx/vehicles/health.tga";
24 const string hud_sh_bar = "gfx/vehicles/bar_dwn_left.tga";
25 const string hud_sh_ico = "gfx/vehicles/shield.tga";
27 const string hud_ammo1_bar = "gfx/vehicles/bar_up_right.tga";
28 const string hud_ammo1_ico = "gfx/vehicles/bullets.tga";
29 const string hud_ammo2_bar = "gfx/vehicles/bar_dwn_right.tga";
30 const string hud_ammo2_ico = "gfx/vehicles/rocket.tga";
31 const string hud_energy = "gfx/vehicles/energy.tga";
33 const int SBRM_FIRST = 1;
34 const int SBRM_VOLLY = 1;
35 const int SBRM_GUIDE = 2;
36 const int SBRM_ARTILLERY = 3;
37 const int SBRM_LAST = 3;
39 const int RSM_FIRST = 1;
40 const int RSM_BOMB = 1;
41 const int RSM_FLARE = 2;
42 const int RSM_LAST = 2;
45 float autocvar_cl_vehicles_hudscale = 0.5;
46 float autocvar_cl_vehicles_hudalpha = 0.75;
48 const string raptor_ico = "gfx/vehicles/raptor.tga";
49 const string raptor_gun = "gfx/vehicles/raptor_guns.tga";
50 const string raptor_bomb = "gfx/vehicles/raptor_bombs.tga";
51 const string raptor_drop = "gfx/vehicles/axh-dropcross.tga";
56 const int MAX_AXH = 4;
57 entity AuxiliaryXhairs[MAX_AXH];
59 entityclass(AuxiliaryXhair);
60 class(AuxiliaryXhair) .string axh_image;
61 class(AuxiliaryXhair) .float axh_fadetime;
62 class(AuxiliaryXhair) .float axh_drawflag;
63 class(AuxiliaryXhair) .float axh_scale;
65 const string bumb_ico = "gfx/vehicles/bumb.tga";
66 const string bumb_lgun = "gfx/vehicles/bumb_lgun.tga";
67 const string bumb_rgun = "gfx/vehicles/bumb_rgun.tga";
69 const string bumb_gun_ico = "gfx/vehicles/bumb_side.tga";
70 const string bumb_gun_gun = "gfx/vehicles/bumb_side_gun.tga";
72 const string spider_ico = "gfx/vehicles/sbot.tga";
73 const string spider_rkt = "gfx/vehicles/sbot_rpods.tga";
74 const string spider_mgun = "gfx/vehicles/sbot_mguns.tga";
75 string spider_xhair; // = "gfx/vehicles/axh-special1.tga";
77 const string waki_ico = "gfx/vehicles/waki.tga";
78 const string waki_eng = "gfx/vehicles/waki_e.tga";
79 const string waki_gun = "gfx/vehicles/waki_guns.tga";
80 const string waki_rkt = "gfx/vehicles/waki_rockets.tga";
81 const string waki_xhair = "gfx/vehicles/axh-special1.tga";
87 void AuxiliaryXhair_Draw2D()
91 psize = self.axh_scale * draw_getimagesize(self.axh_image);
92 loc = project_3d_to_2d(self.move_origin) - 0.5 * psize;
93 if (!(loc.z < 0 || loc.x < 0 || loc.y < 0 || loc.x > vid_conwidth || loc.y > vid_conheight))
97 drawpic(loc, self.axh_image, psize, self.colormod, self.alpha, self.axh_drawflag);
100 if(time - self.cnt > self.axh_fadetime)
101 self.draw2d = func_null;
104 void Net_AuXair2(bool bIsNew)
106 int axh_id = bound(0, ReadByte(), MAX_AXH);
107 entity axh = AuxiliaryXhairs[axh_id];
109 if(axh == world || wasfreed(axh)) // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
112 axh.draw2d = func_null;
113 axh.drawmask = MASK_NORMAL;
114 axh.axh_drawflag = DRAWFLAG_ADDITIVE;
115 axh.axh_fadetime = 0.1;
116 axh.axh_image = "gfx/vehicles/axh-ring.tga";
119 AuxiliaryXhairs[axh_id] = axh;
122 axh.move_origin_x = ReadCoord();
123 axh.move_origin_y = ReadCoord();
124 axh.move_origin_z = ReadCoord();
125 axh.colormod_x = ReadByte() / 255;
126 axh.colormod_y = ReadByte() / 255;
127 axh.colormod_z = ReadByte() / 255;
129 axh.draw2d = AuxiliaryXhair_Draw2D;
132 void Net_VehicleSetup()
134 int hud_id = ReadByte();
137 if(hud_id > HUD_VEHICLE_LAST)
139 weapon2mode = hud_id - HUD_VEHICLE_LAST;
143 // hud_id == 0 means we exited a vehicle, so stop alarm sound/s
146 sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
147 sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
151 hud_id = bound(HUD_VEHICLE_FIRST, hud_id, HUD_VEHICLE_LAST);
153 // Init auxiliary crosshairs
155 for(i = 0; i < MAX_AXH; ++i)
157 entity axh = AuxiliaryXhairs[i];
158 if(axh != world && !wasfreed(axh)) // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
162 axh.draw2d = func_null;
163 axh.drawmask = MASK_NORMAL;
164 axh.axh_drawflag = DRAWFLAG_NORMAL;
165 axh.axh_fadetime = 0.1;
166 axh.axh_image = "gfx/vehicles/axh-ring.tga";
169 AuxiliaryXhairs[i] = axh;
176 AuxiliaryXhairs[0].axh_image = "gfx/vehicles/axh-ring.tga";
177 AuxiliaryXhairs[0].axh_scale = 0.25;
179 AuxiliaryXhairs[1].axh_image = "gfx/vehicles/axh-ring.tga";
180 AuxiliaryXhairs[1].axh_scale = 0.25;
182 AuxiliaryXhairs[2].axh_image = "gfx/vehicles/axh-special1.tga";
183 AuxiliaryXhairs[2].axh_scale = 0.5;
187 AuxiliaryXhairs[0].axh_image = "gfx/vehicles/axh-bracket.tga";
188 AuxiliaryXhairs[0].axh_scale = 0.25;
192 AuxiliaryXhairs[0].axh_image = "gfx/vehicles/axh-special2.tga";
193 AuxiliaryXhairs[0].axh_scale = 0.5;
194 //AuxiliaryXhair[0].alpha = 0.5;
196 AuxiliaryXhairs[1].axh_image = "gfx/vehicles/axh-bracket.tga";
197 AuxiliaryXhairs[1].axh_scale = 0.25;
198 //AuxiliaryXhair[1].alpha = 0.75;
199 //AuxiliaryXhair[1].axh_drawflag = DRAWFLAG_NORMAL;
204 AuxiliaryXhairs[0].axh_image = "gfx/vehicles/axh-bracket.tga";
205 AuxiliaryXhairs[0].axh_scale = 0.5;
208 AuxiliaryXhairs[1].axh_image = "gfx/vehicles/axh-target.tga";
209 AuxiliaryXhairs[1].axh_scale = 0.75;
212 AuxiliaryXhairs[2].axh_image = "gfx/vehicles/axh-target.tga";
213 AuxiliaryXhairs[2].axh_scale = 0.75;
215 case HUD_BUMBLEBEE_GUN:
217 AuxiliaryXhairs[0].axh_image = "gfx/vehicles/axh-bracket.tga";
218 AuxiliaryXhairs[0].axh_scale = 0.25;
220 AuxiliaryXhairs[1].axh_image = "gfx/vehicles/axh-bracket.tga";
221 AuxiliaryXhairs[1].axh_scale = 0.25;
225 #define HUD_GETSTATS \
226 int vh_health = getstati(STAT_VEHICLESTAT_HEALTH); \
227 float shield = getstati(STAT_VEHICLESTAT_SHIELD); \
228 noref int energy = getstati(STAT_VEHICLESTAT_ENERGY); \
229 noref float ammo1 = getstati(STAT_VEHICLESTAT_AMMO1); \
230 noref float reload1 = getstati(STAT_VEHICLESTAT_RELOAD1); \
231 noref int ammo2 = getstati(STAT_VEHICLESTAT_AMMO2); \
232 noref int reload2 = getstati(STAT_VEHICLESTAT_RELOAD2);
234 void CSQC_BUMBLE_HUD()
237 drawpic(hudloc, waki_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
238 drawpic(hudloc, waki_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
239 drawpic(hudloc, waki_r, picsize, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
240 drawpic(hudloc, waki_e, picsize, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
242 if(autocvar_r_letterbox)
245 vector picsize, hudloc = '0 0 0', pic2size, picloc;
247 // Fetch health & ammo stats
250 picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
251 hudloc.y = vid_conheight - picsize.y;
252 hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
254 drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
261 pic2size = draw_getimagesize(bumb_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
262 picloc = picsize * 0.5 - pic2size * 0.5;
265 drawpic(hudloc + picloc, bumb_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
267 drawpic(hudloc + picloc, bumb_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL);
269 drawpic(hudloc + picloc, bumb_lgun, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
270 drawpic(hudloc + picloc, bumb_lgun, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
271 drawpic(hudloc + picloc, hud_sh, pic2size, '1 1 1', shield, DRAWFLAG_NORMAL);
274 picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
275 picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
276 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
277 drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
280 picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
281 picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
284 if(alarm1time < time)
286 alarm1time = time + 2;
287 sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
290 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
294 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
297 sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
303 picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
304 picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
305 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
306 drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
309 picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
310 picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
313 if(alarm2time < time)
315 alarm2time = time + 1;
316 sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
318 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
322 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
325 sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
334 picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
335 picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
336 drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * ammo1, vid_conheight);
337 drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
340 // Right gunner slot occupied?
341 if(!AuxiliaryXhairs[1].draw2d)
343 shield = (picsize.x * 0.5) - (0.5 * stringwidth(_("No right gunner!"), false, '1 0 0' * picsize.y + '0 1 0' * picsize.y));
344 drawfill(hudloc + picloc - '0.2 0.2 0', picsize + '0.4 0.4 0', '0.25 0.25 0.25', 0.75, DRAWFLAG_NORMAL);
345 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);
349 picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale;
350 picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
352 drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
354 drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
357 picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
358 picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
359 drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * ammo2, vid_conheight);
360 drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
362 // Left gunner slot occupied?
363 if(!AuxiliaryXhairs[2].draw2d)
365 shield = (picsize.x * 0.5) - (0.5 * stringwidth(_("No left gunner!"), false, '1 0 0' * picsize.y + '0 1 0' * picsize.y));
366 drawfill(hudloc + picloc - '0.2 0.2 0', picsize + '0.4 0.4 0', '0.25 0.25 0.25', 0.75, DRAWFLAG_NORMAL);
367 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);
371 picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale;
372 picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
374 drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
376 drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
378 if (scoreboard_showscores)
379 HUD_DrawScoreboard();
382 picsize = draw_getimagesize(waki_xhair);
385 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);
390 void CSQC_BUMBLE_GUN_HUD()
393 if(autocvar_r_letterbox)
396 vector picsize, hudloc = '0 0 0', pic2size, picloc;
398 // Fetch health & ammo stats
401 picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
402 hudloc.y = vid_conheight - picsize.y;
403 hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
405 drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
412 pic2size = draw_getimagesize(bumb_gun_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
413 picloc = picsize * 0.5 - pic2size * 0.5;
416 drawpic(hudloc + picloc, bumb_gun_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
418 drawpic(hudloc + picloc, bumb_gun_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL);
420 drawpic(hudloc + picloc, bumb_gun_gun, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
421 drawpic(hudloc + picloc, hud_sh, pic2size, '1 1 1', shield, DRAWFLAG_NORMAL);
424 picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
425 picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
426 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
427 drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
430 picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
431 picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
434 if(alarm1time < time)
436 alarm1time = time + 2;
437 sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
440 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
444 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
447 sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
453 picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
454 picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
455 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
456 drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
459 picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
460 picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
463 if(alarm2time < time)
465 alarm2time = time + 1;
466 sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
468 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
472 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
475 sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
481 picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
482 picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
483 drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * energy, vid_conheight);
484 drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
488 picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale;
489 picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
491 drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
493 drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
495 if (scoreboard_showscores)
496 HUD_DrawScoreboard();
500 picsize = draw_getimagesize(waki_xhair);
505 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);
512 void CSQC_SPIDER_HUD()
514 if(autocvar_r_letterbox)
517 vector picsize, hudloc = '0 0 0', pic2size, picloc;
520 // Fetch health & ammo stats
523 picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
524 hudloc.y = vid_conheight - picsize.y;
525 hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
527 drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
534 pic2size = draw_getimagesize(spider_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
535 picloc = picsize * 0.5 - pic2size * 0.5;
537 drawpic(hudloc + picloc, spider_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
539 drawpic(hudloc + picloc, spider_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL);
540 drawpic(hudloc + picloc, spider_rkt, pic2size, '1 1 1' * reload2 + '1 0 0' * (1 - reload2), 1, DRAWFLAG_NORMAL);
541 drawpic(hudloc + picloc, spider_mgun, pic2size, '1 1 1' * ammo1 + '1 0 0' * (1 - ammo1), 1, DRAWFLAG_NORMAL);
542 drawpic(hudloc + picloc, hud_sh, pic2size, '1 1 1', shield, DRAWFLAG_NORMAL);
545 picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
546 picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
547 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
548 drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
551 picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
552 picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
555 if(alarm1time < time)
557 alarm1time = time + 2;
558 sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
560 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
564 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
567 sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
572 picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
573 picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
574 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
575 drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
578 picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
579 picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
582 if(alarm2time < time)
584 alarm2time = time + 1;
585 sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
587 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
591 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
594 sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
600 picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
601 picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
602 drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * ammo1, vid_conheight);
603 drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
606 picsize = draw_getimagesize(hud_ammo1_ico) * autocvar_cl_vehicles_hudscale;
607 picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
609 drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
611 drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
614 picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
615 ammo1 = picsize.x / 8;
616 picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
617 drawsetcliparea(hudloc.x + picloc.x, hudloc.y + picloc.y, picsize.x * reload2, vid_conheight);
618 drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
622 pic2size = 0.35 * draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
623 picloc.x -= pic2size.x;
624 picloc.y += pic2size.y * 2.25;
627 for(i = 1; i < 9; ++i)
630 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, ((8 * reload2 <= i) ? '0 0 0' : '1 1 1'), 0.75, DRAWFLAG_NORMAL);
635 for(i = 1; i < 9; ++i)
638 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, ((i >= ammo2) ? '1 1 1' : '0 0 0'), 0.75, DRAWFLAG_NORMAL);
641 pic2size = draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
642 picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
644 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
646 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 1 1', 1, DRAWFLAG_NORMAL);
648 if (scoreboard_showscores)
649 HUD_DrawScoreboard();
655 spider_xhair = "gfx/vehicles/axh-bracket.tga";
658 spider_xhair = "gfx/vehicles/axh-cross.tga";
661 spider_xhair = "gfx/vehicles/axh-tag.tga";
664 spider_xhair= "gfx/vehicles/axh-tag.tga";
667 picsize = draw_getimagesize(spider_xhair);
668 picsize.x *= autocvar_cl_vehicle_spiderbot_cross_size;
669 picsize.y *= autocvar_cl_vehicle_spiderbot_cross_size;
671 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);
675 void CSQC_RAPTOR_HUD()
677 if(autocvar_r_letterbox)
680 vector picsize, hudloc = '0 0 0', pic2size, picloc;
682 // Fetch health & ammo stats
685 picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
686 hudloc.y = vid_conheight - picsize.y;
687 hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
689 drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
696 reload1 = reload2 * 0.01;
699 pic2size = draw_getimagesize(spider_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
700 picloc = picsize * 0.5 - pic2size * 0.5;
702 drawpic(hudloc + picloc, raptor_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
704 drawpic(hudloc + picloc, raptor_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL);
705 drawpic(hudloc + picloc, raptor_bomb, pic2size, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
706 drawpic(hudloc + picloc, raptor_gun, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
707 drawpic(hudloc + picloc, hud_sh, pic2size, '1 1 1', shield, DRAWFLAG_NORMAL);
710 picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
711 picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
712 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
713 drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
716 picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
717 picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
720 if(alarm1time < time)
722 alarm1time = time + 2;
723 sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
726 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
730 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
733 sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
739 picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
740 picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
741 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
742 drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
745 picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
746 picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
749 if(alarm2time < time)
751 alarm2time = time + 1;
752 sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
754 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
758 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
761 sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
767 picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
768 picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
769 drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * energy, vid_conheight);
770 drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
773 picsize = draw_getimagesize(hud_ammo1_ico) * autocvar_cl_vehicles_hudscale;
774 picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
776 drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
778 drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
781 picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
782 picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
783 drawsetcliparea(hudloc.x + picloc.x, hudloc.y + picloc.y, picsize.x * reload1, vid_conheight);
784 drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
787 pic2size = draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
788 picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
790 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
792 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 1 1', 1, DRAWFLAG_NORMAL);
794 if(weapon2mode == RSM_FLARE)
796 raptor_xhair = "gfx/vehicles/axh-bracket.tga";
800 raptor_xhair = "gfx/vehicles/axh-ring.tga";
806 dropmark.owner = self;
807 dropmark.gravity = 1;
814 setorigin(dropmark, pmove_org);
815 dropmark.velocity = pmove_vel;
816 tracetoss(dropmark, self);
818 where = project_3d_to_2d(trace_endpos);
820 setorigin(dropmark, trace_endpos);
821 picsize = draw_getimagesize(raptor_drop) * 0.2;
823 if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
825 where.x -= picsize.x * 0.5;
826 where.y -= picsize.y * 0.5;
828 drawpic(where, raptor_drop, picsize, '0 2 0', 1, DRAWFLAG_ADDITIVE);
830 dropmark.cnt = time + 5;
835 if(dropmark.cnt > time)
837 where = project_3d_to_2d(dropmark.origin);
838 picsize = draw_getimagesize(raptor_drop) * 0.25;
840 if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
842 where.x -= picsize.x * 0.5;
843 where.y -= picsize.y * 0.5;
845 drawpic(where, raptor_drop, picsize, '2 0 0', 1, DRAWFLAG_ADDITIVE);
851 if (scoreboard_showscores)
852 HUD_DrawScoreboard();
855 picsize = draw_getimagesize(raptor_xhair);
859 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);
863 void CSQC_WAKIZASHI_HUD()
866 drawpic(hudloc, waki_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
867 drawpic(hudloc, waki_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
868 drawpic(hudloc, waki_r, picsize, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
869 drawpic(hudloc, waki_e, picsize, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
871 if(autocvar_r_letterbox)
874 vector picsize, hudloc = '0 0 0', pic2size, picloc;
876 // Fetch health & ammo stats
879 picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
880 hudloc.y = vid_conheight - picsize.y;
881 hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
883 drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
890 pic2size = draw_getimagesize(spider_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
891 picloc = picsize * 0.5 - pic2size * 0.5;
893 drawpic(hudloc + picloc, waki_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
895 drawpic(hudloc + picloc, waki_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL);
896 drawpic(hudloc + picloc, waki_eng, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
897 drawpic(hudloc + picloc, waki_gun, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
898 drawpic(hudloc + picloc, waki_rkt, pic2size, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
899 drawpic(hudloc + picloc, hud_sh, pic2size, '1 1 1', shield, DRAWFLAG_NORMAL);
902 picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
903 picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
904 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
905 drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
908 picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
909 picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
912 if(alarm1time < time)
914 alarm1time = time + 2;
915 sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
918 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
922 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
925 sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
932 picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
933 picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
934 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
935 drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
938 picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
939 picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
942 if(alarm2time < time)
944 alarm2time = time + 1;
945 sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
947 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
951 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
954 sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
960 picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
961 picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
962 drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * energy, vid_conheight);
963 drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
966 picsize = draw_getimagesize(hud_ammo1_ico) * autocvar_cl_vehicles_hudscale;
967 picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
969 drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
971 drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
974 picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
975 picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
976 drawsetcliparea(hudloc.x + picloc.x, hudloc.y + picloc.y, picsize.x * reload1, vid_conheight);
977 drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
980 pic2size = draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
981 picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
983 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
985 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 1 1', 1, DRAWFLAG_NORMAL);
987 if (scoreboard_showscores)
988 HUD_DrawScoreboard();
991 picsize = draw_getimagesize(waki_xhair);
996 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);
1000 void Vehicles_Precache()
1002 precache_model("models/vehicles/bomblet.md3");
1003 precache_model("models/vehicles/clusterbomb.md3");
1004 precache_model("models/vehicles/clusterbomb_fragment.md3");
1005 precache_model("models/vehicles/rocket01.md3");
1006 precache_model("models/vehicles/rocket02.md3");
1008 precache_sound ("vehicles/alarm.wav");
1009 precache_sound ("vehicles/alarm_shield.wav");
1012 void RaptorCBShellfragDraw()
1017 Movetype_Physics_MatchTicrate(autocvar_cl_gibs_ticrate, autocvar_cl_gibs_sloppy);
1018 self.move_avelocity += randomvec() * 15;
1019 self.renderflags = 0;
1022 self.alpha = bound(0, self.nextthink - time, 1);
1024 if(self.alpha < ALPHA_MIN_VISIBLE)
1028 void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang)
1033 setmodel(sfrag, "models/vehicles/clusterbomb_fragment.md3");
1034 setorigin(sfrag, _org);
1036 sfrag.move_movetype = MOVETYPE_BOUNCE;
1037 sfrag.gravity = 0.15;
1038 sfrag.solid = SOLID_CORPSE;
1040 sfrag.draw = RaptorCBShellfragDraw;
1042 sfrag.move_origin = sfrag.origin = _org;
1043 sfrag.move_velocity = _vel;
1044 sfrag.move_avelocity = prandomvec() * vlen(sfrag.move_velocity);
1045 sfrag.angles = self.move_angles = _ang;
1047 sfrag.move_time = time;
1048 sfrag.damageforcescale = 4;
1050 sfrag.nextthink = time + 3;
1051 sfrag.cnt = time + 2;
1053 sfrag.drawmask = MASK_NORMAL;