3 #include "../autocvars.qh"
6 #include "../miscfunctions.qh"
7 #include "../movetypes.qh"
8 #include "../movetypes.qh"
9 #include "../prandom.qh"
10 #include "../scoreboard.qh"
11 #include "../t_items.qh"
13 #include "../../common/buffs.qh"
14 #include "../../common/constants.qh"
15 #include "../../common/stats.qh"
16 #include "../../common/util.qh"
18 #include "../../csqcmodellib/cl_model.qh"
20 #include "../../dpdefs/csprogsdefs.qh"
24 const string hud_bg = "gfx/vehicles/frame.tga";
25 const string hud_sh = "gfx/vehicles/vh-shield.tga";
27 const string hud_hp_bar = "gfx/vehicles/bar_up_left.tga";
28 const string hud_hp_ico = "gfx/vehicles/health.tga";
29 const string hud_sh_bar = "gfx/vehicles/bar_dwn_left.tga";
30 const string hud_sh_ico = "gfx/vehicles/shield.tga";
32 const string hud_ammo1_bar = "gfx/vehicles/bar_up_right.tga";
33 const string hud_ammo1_ico = "gfx/vehicles/bullets.tga";
34 const string hud_ammo2_bar = "gfx/vehicles/bar_dwn_right.tga";
35 const string hud_ammo2_ico = "gfx/vehicles/rocket.tga";
36 const string hud_energy = "gfx/vehicles/energy.tga";
38 const int SBRM_FIRST = 1;
39 const int SBRM_VOLLY = 1;
40 const int SBRM_GUIDE = 2;
41 const int SBRM_ARTILLERY = 3;
42 const int SBRM_LAST = 3;
44 const int RSM_FIRST = 1;
45 const int RSM_BOMB = 1;
46 const int RSM_FLARE = 2;
47 const int RSM_LAST = 2;
50 float autocvar_cl_vehicles_hudscale = 0.5;
51 float autocvar_cl_vehicles_hudalpha = 0.75;
53 const string raptor_ico = "gfx/vehicles/raptor.tga";
54 const string raptor_gun = "gfx/vehicles/raptor_guns.tga";
55 const string raptor_bomb = "gfx/vehicles/raptor_bombs.tga";
56 const string raptor_drop = "gfx/vehicles/axh-dropcross.tga";
61 const int MAX_AXH = 4;
62 entity AuxiliaryXhair[MAX_AXH];
64 entityclass(AuxiliaryXhair)
65 class(AuxiliaryXhair) .string axh_image;
66 class(AuxiliaryXhair) .float axh_fadetime;
67 class(AuxiliaryXhair) .float axh_drawflag;
68 class(AuxiliaryXhair) .float axh_scale;
70 const string bumb_ico = "gfx/vehicles/bumb.tga";
71 const string bumb_lgun = "gfx/vehicles/bumb_lgun.tga";
72 const string bumb_rgun = "gfx/vehicles/bumb_rgun.tga";
74 const string bumb_gun_ico = "gfx/vehicles/bumb_side.tga";
75 const string bumb_gun_gun = "gfx/vehicles/bumb_side_gun.tga";
77 const string spider_ico = "gfx/vehicles/sbot.tga";
78 const string spider_rkt = "gfx/vehicles/sbot_rpods.tga";
79 const string spider_mgun = "gfx/vehicles/sbot_mguns.tga";
80 string spider_xhair; // = "gfx/vehicles/axh-special1.tga";
82 const string waki_ico = "gfx/vehicles/waki.tga";
83 const string waki_eng = "gfx/vehicles/waki_e.tga";
84 const string waki_gun = "gfx/vehicles/waki_guns.tga";
85 const string waki_rkt = "gfx/vehicles/waki_rockets.tga";
86 const string waki_xhair = "gfx/vehicles/axh-special1.tga";
92 void AuxiliaryXhair_Draw2D()
96 psize = self.axh_scale * draw_getimagesize(self.axh_image);
97 loc = project_3d_to_2d(self.move_origin) - 0.5 * psize;
98 if (!(loc.z < 0 || loc.x < 0 || loc.y < 0 || loc.x > vid_conwidth || loc.y > vid_conheight))
102 drawpic(loc, self.axh_image, psize, self.colormod, self.alpha, self.axh_drawflag);
105 if(time - self.cnt > self.axh_fadetime)
106 self.draw2d = func_null;
109 void Net_AuXair2(bool bIsNew)
111 int axh_id = bound(0, ReadByte(), MAX_AXH);
112 entity axh = AuxiliaryXhair[axh_id];
114 if(axh == world || wasfreed(axh)) // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
117 axh.draw2d = func_null;
118 axh.drawmask = MASK_NORMAL;
119 axh.axh_drawflag = DRAWFLAG_ADDITIVE;
120 axh.axh_fadetime = 0.1;
121 axh.axh_image = "gfx/vehicles/axh-ring.tga";
124 AuxiliaryXhair[axh_id] = axh;
127 axh.move_origin_x = ReadCoord();
128 axh.move_origin_y = ReadCoord();
129 axh.move_origin_z = ReadCoord();
130 axh.colormod_x = ReadByte() / 255;
131 axh.colormod_y = ReadByte() / 255;
132 axh.colormod_z = ReadByte() / 255;
134 axh.draw2d = AuxiliaryXhair_Draw2D;
137 void Net_VehicleSetup()
139 int hud_id = ReadByte();
142 if(hud_id > HUD_VEHICLE_LAST)
144 weapon2mode = hud_id - HUD_VEHICLE_LAST;
148 // hud_id == 0 means we exited a vehicle, so stop alarm sound/s
151 sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
152 sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
156 hud_id = bound(HUD_VEHICLE_FIRST, hud_id, HUD_VEHICLE_LAST);
158 // Init auxiliary crosshairs
160 for(i = 0; i < MAX_AXH; ++i)
162 entity axh = AuxiliaryXhair[i];
163 if(axh != world && !wasfreed(axh)) // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
167 axh.draw2d = func_null;
168 axh.drawmask = MASK_NORMAL;
169 axh.axh_drawflag = DRAWFLAG_NORMAL;
170 axh.axh_fadetime = 0.1;
171 axh.axh_image = "gfx/vehicles/axh-ring.tga";
174 AuxiliaryXhair[i] = axh;
181 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-ring.tga";
182 AuxiliaryXhair[0].axh_scale = 0.25;
184 AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-ring.tga";
185 AuxiliaryXhair[1].axh_scale = 0.25;
187 AuxiliaryXhair[2].axh_image = "gfx/vehicles/axh-special1.tga";
188 AuxiliaryXhair[2].axh_scale = 0.5;
192 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-bracket.tga";
193 AuxiliaryXhair[0].axh_scale = 0.25;
197 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-special2.tga";
198 AuxiliaryXhair[0].axh_scale = 0.5;
199 //AuxiliaryXhair[0].alpha = 0.5;
201 AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-bracket.tga";
202 AuxiliaryXhair[1].axh_scale = 0.25;
203 //AuxiliaryXhair[1].alpha = 0.75;
204 //AuxiliaryXhair[1].axh_drawflag = DRAWFLAG_NORMAL;
209 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-bracket.tga";
210 AuxiliaryXhair[0].axh_scale = 0.5;
213 AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-target.tga";
214 AuxiliaryXhair[1].axh_scale = 0.75;
217 AuxiliaryXhair[2].axh_image = "gfx/vehicles/axh-target.tga";
218 AuxiliaryXhair[2].axh_scale = 0.75;
220 case HUD_BUMBLEBEE_GUN:
222 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-bracket.tga";
223 AuxiliaryXhair[0].axh_scale = 0.25;
225 AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-bracket.tga";
226 AuxiliaryXhair[1].axh_scale = 0.25;
230 #define HUD_GETSTATS \
231 int vh_health = getstati(STAT_VEHICLESTAT_HEALTH); \
232 float shield = getstati(STAT_VEHICLESTAT_SHIELD); \
233 noref int energy = getstati(STAT_VEHICLESTAT_ENERGY); \
234 noref float ammo1 = getstati(STAT_VEHICLESTAT_AMMO1); \
235 noref float reload1 = getstati(STAT_VEHICLESTAT_RELOAD1); \
236 noref int ammo2 = getstati(STAT_VEHICLESTAT_AMMO2); \
237 noref int reload2 = getstati(STAT_VEHICLESTAT_RELOAD2);
239 void CSQC_BUMBLE_HUD()
242 drawpic(hudloc, waki_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
243 drawpic(hudloc, waki_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
244 drawpic(hudloc, waki_r, picsize, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
245 drawpic(hudloc, waki_e, picsize, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
247 if(autocvar_r_letterbox)
250 vector picsize, hudloc = '0 0 0', pic2size, picloc;
252 // Fetch health & ammo stats
255 picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
256 hudloc.y = vid_conheight - picsize.y;
257 hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
259 drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
266 pic2size = draw_getimagesize(bumb_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
267 picloc = picsize * 0.5 - pic2size * 0.5;
270 drawpic(hudloc + picloc, bumb_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
272 drawpic(hudloc + picloc, bumb_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL);
274 drawpic(hudloc + picloc, bumb_lgun, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
275 drawpic(hudloc + picloc, bumb_lgun, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
276 drawpic(hudloc + picloc, hud_sh, pic2size, '1 1 1', shield, DRAWFLAG_NORMAL);
279 picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
280 picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
281 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
282 drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
285 picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
286 picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
289 if(alarm1time < time)
291 alarm1time = time + 2;
292 sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
295 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
299 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
302 sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
308 picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
309 picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
310 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
311 drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
314 picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
315 picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
318 if(alarm2time < time)
320 alarm2time = time + 1;
321 sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
323 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
327 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
330 sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
339 picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
340 picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
341 drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * ammo1, vid_conheight);
342 drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
345 // Right gunner slot occupied?
346 if(!AuxiliaryXhair[1].draw2d)
348 shield = (picsize.x * 0.5) - (0.5 * stringwidth(_("No right gunner!"), false, '1 0 0' * picsize.y + '0 1 0' * picsize.y));
349 drawfill(hudloc + picloc - '0.2 0.2 0', picsize + '0.4 0.4 0', '0.25 0.25 0.25', 0.75, DRAWFLAG_NORMAL);
350 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);
354 picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale;
355 picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
357 drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
359 drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
362 picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
363 picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
364 drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * ammo2, vid_conheight);
365 drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
367 // Left gunner slot occupied?
368 if(!AuxiliaryXhair[2].draw2d)
370 shield = (picsize.x * 0.5) - (0.5 * stringwidth(_("No left gunner!"), false, '1 0 0' * picsize.y + '0 1 0' * picsize.y));
371 drawfill(hudloc + picloc - '0.2 0.2 0', picsize + '0.4 0.4 0', '0.25 0.25 0.25', 0.75, DRAWFLAG_NORMAL);
372 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);
376 picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale;
377 picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
379 drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
381 drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
383 if (scoreboard_showscores)
384 HUD_DrawScoreboard();
387 picsize = draw_getimagesize(waki_xhair);
390 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);
395 void CSQC_BUMBLE_GUN_HUD()
398 if(autocvar_r_letterbox)
401 vector picsize, hudloc = '0 0 0', pic2size, picloc;
403 // Fetch health & ammo stats
406 picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
407 hudloc.y = vid_conheight - picsize.y;
408 hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
410 drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
417 pic2size = draw_getimagesize(bumb_gun_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
418 picloc = picsize * 0.5 - pic2size * 0.5;
421 drawpic(hudloc + picloc, bumb_gun_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
423 drawpic(hudloc + picloc, bumb_gun_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL);
425 drawpic(hudloc + picloc, bumb_gun_gun, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
426 drawpic(hudloc + picloc, hud_sh, pic2size, '1 1 1', shield, DRAWFLAG_NORMAL);
429 picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
430 picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
431 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
432 drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
435 picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
436 picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
439 if(alarm1time < time)
441 alarm1time = time + 2;
442 sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
445 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
449 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
452 sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
458 picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
459 picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
460 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
461 drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
464 picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
465 picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
468 if(alarm2time < time)
470 alarm2time = time + 1;
471 sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
473 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
477 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
480 sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
486 picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
487 picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
488 drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * energy, vid_conheight);
489 drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
493 picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale;
494 picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
496 drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
498 drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
500 if (scoreboard_showscores)
501 HUD_DrawScoreboard();
505 picsize = draw_getimagesize(waki_xhair);
510 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);
517 void CSQC_SPIDER_HUD()
519 if(autocvar_r_letterbox)
522 vector picsize, hudloc = '0 0 0', pic2size, picloc;
525 // Fetch health & ammo stats
528 picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
529 hudloc.y = vid_conheight - picsize.y;
530 hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
532 drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
539 pic2size = draw_getimagesize(spider_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
540 picloc = picsize * 0.5 - pic2size * 0.5;
542 drawpic(hudloc + picloc, spider_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
544 drawpic(hudloc + picloc, spider_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL);
545 drawpic(hudloc + picloc, spider_rkt, pic2size, '1 1 1' * reload2 + '1 0 0' * (1 - reload2), 1, DRAWFLAG_NORMAL);
546 drawpic(hudloc + picloc, spider_mgun, pic2size, '1 1 1' * ammo1 + '1 0 0' * (1 - ammo1), 1, DRAWFLAG_NORMAL);
547 drawpic(hudloc + picloc, hud_sh, pic2size, '1 1 1', shield, DRAWFLAG_NORMAL);
550 picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
551 picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
552 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
553 drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
556 picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
557 picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
560 if(alarm1time < time)
562 alarm1time = time + 2;
563 sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
565 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
569 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
572 sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
577 picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
578 picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
579 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
580 drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
583 picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
584 picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
587 if(alarm2time < time)
589 alarm2time = time + 1;
590 sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
592 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
596 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
599 sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
605 picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
606 picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
607 drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * ammo1, vid_conheight);
608 drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
611 picsize = draw_getimagesize(hud_ammo1_ico) * autocvar_cl_vehicles_hudscale;
612 picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
614 drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
616 drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
619 picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
620 ammo1 = picsize.x / 8;
621 picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
622 drawsetcliparea(hudloc.x + picloc.x, hudloc.y + picloc.y, picsize.x * reload2, vid_conheight);
623 drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
627 pic2size = 0.35 * draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
628 picloc.x -= pic2size.x;
629 picloc.y += pic2size.y * 2.25;
632 for(i = 1; i < 9; ++i)
635 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, ((8 * reload2 <= i) ? '0 0 0' : '1 1 1'), 0.75, DRAWFLAG_NORMAL);
640 for(i = 1; i < 9; ++i)
643 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, ((i >= ammo2) ? '1 1 1' : '0 0 0'), 0.75, DRAWFLAG_NORMAL);
646 pic2size = draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
647 picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
649 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
651 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 1 1', 1, DRAWFLAG_NORMAL);
653 if (scoreboard_showscores)
654 HUD_DrawScoreboard();
660 spider_xhair = "gfx/vehicles/axh-bracket.tga";
663 spider_xhair = "gfx/vehicles/axh-cross.tga";
666 spider_xhair = "gfx/vehicles/axh-tag.tga";
669 spider_xhair= "gfx/vehicles/axh-tag.tga";
672 picsize = draw_getimagesize(spider_xhair);
673 picsize.x *= autocvar_cl_vehicle_spiderbot_cross_size;
674 picsize.y *= autocvar_cl_vehicle_spiderbot_cross_size;
676 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);
680 void CSQC_RAPTOR_HUD()
682 if(autocvar_r_letterbox)
685 vector picsize, hudloc = '0 0 0', pic2size, picloc;
687 // Fetch health & ammo stats
690 picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
691 hudloc.y = vid_conheight - picsize.y;
692 hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
694 drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
701 reload1 = reload2 * 0.01;
704 pic2size = draw_getimagesize(spider_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
705 picloc = picsize * 0.5 - pic2size * 0.5;
707 drawpic(hudloc + picloc, raptor_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
709 drawpic(hudloc + picloc, raptor_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL);
710 drawpic(hudloc + picloc, raptor_bomb, pic2size, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
711 drawpic(hudloc + picloc, raptor_gun, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
712 drawpic(hudloc + picloc, hud_sh, pic2size, '1 1 1', shield, DRAWFLAG_NORMAL);
715 picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
716 picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
717 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
718 drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
721 picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
722 picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
725 if(alarm1time < time)
727 alarm1time = time + 2;
728 sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
731 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
735 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
738 sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
744 picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
745 picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
746 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
747 drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
750 picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
751 picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
754 if(alarm2time < time)
756 alarm2time = time + 1;
757 sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
759 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
763 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
766 sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
772 picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
773 picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
774 drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * energy, vid_conheight);
775 drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
778 picsize = draw_getimagesize(hud_ammo1_ico) * autocvar_cl_vehicles_hudscale;
779 picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
781 drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
783 drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
786 picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
787 picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
788 drawsetcliparea(hudloc.x + picloc.x, hudloc.y + picloc.y, picsize.x * reload1, vid_conheight);
789 drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
792 pic2size = draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
793 picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
795 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
797 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 1 1', 1, DRAWFLAG_NORMAL);
799 if(weapon2mode == RSM_FLARE)
801 raptor_xhair = "gfx/vehicles/axh-bracket.tga";
805 raptor_xhair = "gfx/vehicles/axh-ring.tga";
811 dropmark.owner = self;
812 dropmark.gravity = 1;
819 setorigin(dropmark, pmove_org);
820 dropmark.velocity = pmove_vel;
821 tracetoss(dropmark, self);
823 where = project_3d_to_2d(trace_endpos);
825 setorigin(dropmark, trace_endpos);
826 picsize = draw_getimagesize(raptor_drop) * 0.2;
828 if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
830 where.x -= picsize.x * 0.5;
831 where.y -= picsize.y * 0.5;
833 drawpic(where, raptor_drop, picsize, '0 2 0', 1, DRAWFLAG_ADDITIVE);
835 dropmark.cnt = time + 5;
840 if(dropmark.cnt > time)
842 where = project_3d_to_2d(dropmark.origin);
843 picsize = draw_getimagesize(raptor_drop) * 0.25;
845 if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
847 where.x -= picsize.x * 0.5;
848 where.y -= picsize.y * 0.5;
850 drawpic(where, raptor_drop, picsize, '2 0 0', 1, DRAWFLAG_ADDITIVE);
856 if (scoreboard_showscores)
857 HUD_DrawScoreboard();
860 picsize = draw_getimagesize(raptor_xhair);
864 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);
868 void CSQC_WAKIZASHI_HUD()
871 drawpic(hudloc, waki_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
872 drawpic(hudloc, waki_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
873 drawpic(hudloc, waki_r, picsize, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
874 drawpic(hudloc, waki_e, picsize, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
876 if(autocvar_r_letterbox)
879 vector picsize, hudloc = '0 0 0', pic2size, picloc;
881 // Fetch health & ammo stats
884 picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
885 hudloc.y = vid_conheight - picsize.y;
886 hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
888 drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
895 pic2size = draw_getimagesize(spider_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
896 picloc = picsize * 0.5 - pic2size * 0.5;
898 drawpic(hudloc + picloc, waki_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
900 drawpic(hudloc + picloc, waki_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL);
901 drawpic(hudloc + picloc, waki_eng, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
902 drawpic(hudloc + picloc, waki_gun, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
903 drawpic(hudloc + picloc, waki_rkt, pic2size, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
904 drawpic(hudloc + picloc, hud_sh, pic2size, '1 1 1', shield, DRAWFLAG_NORMAL);
907 picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
908 picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
909 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
910 drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
913 picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
914 picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
917 if(alarm1time < time)
919 alarm1time = time + 2;
920 sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
923 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
927 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
930 sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
937 picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
938 picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
939 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
940 drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
943 picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
944 picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
947 if(alarm2time < time)
949 alarm2time = time + 1;
950 sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
952 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
956 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
959 sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
965 picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
966 picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
967 drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * energy, vid_conheight);
968 drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
971 picsize = draw_getimagesize(hud_ammo1_ico) * autocvar_cl_vehicles_hudscale;
972 picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
974 drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
976 drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
979 picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
980 picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
981 drawsetcliparea(hudloc.x + picloc.x, hudloc.y + picloc.y, picsize.x * reload1, vid_conheight);
982 drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
985 pic2size = draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
986 picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
988 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
990 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 1 1', 1, DRAWFLAG_NORMAL);
992 if (scoreboard_showscores)
993 HUD_DrawScoreboard();
996 picsize = draw_getimagesize(waki_xhair);
1001 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);
1005 void Vehicles_Precache()
1007 precache_model("models/vehicles/bomblet.md3");
1008 precache_model("models/vehicles/clusterbomb.md3");
1009 precache_model("models/vehicles/clusterbomb_fragment.md3");
1010 precache_model("models/vehicles/rocket01.md3");
1011 precache_model("models/vehicles/rocket02.md3");
1013 precache_sound ("vehicles/alarm.wav");
1014 precache_sound ("vehicles/alarm_shield.wav");
1017 void RaptorCBShellfragDraw()
1022 Movetype_Physics_MatchTicrate(autocvar_cl_gibs_ticrate, autocvar_cl_gibs_sloppy);
1023 self.move_avelocity += randomvec() * 15;
1024 self.renderflags = 0;
1027 self.alpha = bound(0, self.nextthink - time, 1);
1029 if(self.alpha < ALPHA_MIN_VISIBLE)
1033 void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang)
1038 setmodel(sfrag, "models/vehicles/clusterbomb_fragment.md3");
1039 setorigin(sfrag, _org);
1041 sfrag.move_movetype = MOVETYPE_BOUNCE;
1042 sfrag.gravity = 0.15;
1043 sfrag.solid = SOLID_CORPSE;
1045 sfrag.draw = RaptorCBShellfragDraw;
1047 sfrag.move_origin = sfrag.origin = _org;
1048 sfrag.move_velocity = _vel;
1049 sfrag.move_avelocity = prandomvec() * vlen(sfrag.move_velocity);
1050 sfrag.angles = self.move_angles = _ang;
1052 sfrag.move_time = time;
1053 sfrag.damageforcescale = 4;
1055 sfrag.nextthink = time + 3;
1056 sfrag.cnt = time + 2;
1058 sfrag.drawmask = MASK_NORMAL;