2 #include "../../dpdefs/csprogsdefs.qh"
4 #include "../../common/constants.qh"
5 #include "../../common/stats.qh"
6 #include "../../common/util.qh"
7 #include "../../common/buffs.qh"
8 #include "../autocvars.qh"
9 #include "../movetypes.qh"
10 #include "../prandom.qh"
12 #include "vehicles.qh"
13 #include "../../csqcmodellib/cl_model.qh"
14 #include "../../server/t_items.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";
54 void CSQC_WAKIZASHI_HUD();
55 void CSQC_SPIDER_HUD();
56 void CSQC_RAPTOR_HUD();
57 void CSQC_BUMBLE_HUD();
58 void CSQC_BUMBLE_GUN_HUD();
60 const int MAX_AXH = 4;
61 entity AuxiliaryXhair[MAX_AXH];
68 const string bumb_ico = "gfx/vehicles/bumb.tga";
69 const string bumb_lgun = "gfx/vehicles/bumb_lgun.tga";
70 const string bumb_rgun = "gfx/vehicles/bumb_rgun.tga";
72 const string bumb_gun_ico = "gfx/vehicles/bumb_side.tga";
73 const string bumb_gun_gun = "gfx/vehicles/bumb_side_gun.tga";
75 const string spider_ico = "gfx/vehicles/sbot.tga";
76 const string spider_rkt = "gfx/vehicles/sbot_rpods.tga";
77 const string spider_mgun = "gfx/vehicles/sbot_mguns.tga";
78 string spider_xhair; // = "gfx/vehicles/axh-special1.tga";
80 const string waki_ico = "gfx/vehicles/waki.tga";
81 const string waki_eng = "gfx/vehicles/waki_e.tga";
82 const string waki_gun = "gfx/vehicles/waki_guns.tga";
83 const string waki_rkt = "gfx/vehicles/waki_rockets.tga";
84 const string waki_xhair = "gfx/vehicles/axh-special1.tga";
90 void AuxiliaryXhair_Draw2D()
94 psize = self.axh_scale * draw_getimagesize(self.axh_image);
95 loc = project_3d_to_2d(self.move_origin) - 0.5 * psize;
96 if (!(loc.z < 0 || loc.x < 0 || loc.y < 0 || loc.x > vid_conwidth || loc.y > vid_conheight))
100 drawpic(loc, self.axh_image, psize, self.colormod, self.alpha, self.axh_drawflag);
103 if(time - self.cnt > self.axh_fadetime)
104 self.draw2d = func_null;
107 void Net_AuXair2(bool bIsNew)
109 int axh_id = bound(0, ReadByte(), MAX_AXH);
110 entity axh = AuxiliaryXhair[axh_id];
112 if(axh == world || wasfreed(axh)) // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
115 axh.draw2d = func_null;
116 axh.drawmask = MASK_NORMAL;
117 axh.axh_drawflag = DRAWFLAG_ADDITIVE;
118 axh.axh_fadetime = 0.1;
119 axh.axh_image = "gfx/vehicles/axh-ring.tga";
122 AuxiliaryXhair[axh_id] = axh;
125 axh.move_origin_x = ReadCoord();
126 axh.move_origin_y = ReadCoord();
127 axh.move_origin_z = ReadCoord();
128 axh.colormod_x = ReadByte() / 255;
129 axh.colormod_y = ReadByte() / 255;
130 axh.colormod_z = ReadByte() / 255;
132 axh.draw2d = AuxiliaryXhair_Draw2D;
135 void Net_VehicleSetup()
137 int hud_id = ReadByte();
140 if(hud_id > HUD_VEHICLE_LAST)
142 weapon2mode = hud_id - HUD_VEHICLE_LAST;
146 // hud_id == 0 means we exited a vehicle, so stop alarm sound/s
149 sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
150 sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
154 hud_id = bound(HUD_VEHICLE_FIRST, hud_id, HUD_VEHICLE_LAST);
156 // Init auxiliary crosshairs
158 for(i = 0; i < MAX_AXH; ++i)
160 entity axh = AuxiliaryXhair[i];
161 if(axh != world && !wasfreed(axh)) // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
165 axh.draw2d = func_null;
166 axh.drawmask = MASK_NORMAL;
167 axh.axh_drawflag = DRAWFLAG_NORMAL;
168 axh.axh_fadetime = 0.1;
169 axh.axh_image = "gfx/vehicles/axh-ring.tga";
172 AuxiliaryXhair[i] = axh;
179 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-ring.tga";
180 AuxiliaryXhair[0].axh_scale = 0.25;
182 AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-ring.tga";
183 AuxiliaryXhair[1].axh_scale = 0.25;
185 AuxiliaryXhair[2].axh_image = "gfx/vehicles/axh-special1.tga";
186 AuxiliaryXhair[2].axh_scale = 0.5;
190 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-bracket.tga";
191 AuxiliaryXhair[0].axh_scale = 0.25;
195 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-special2.tga";
196 AuxiliaryXhair[0].axh_scale = 0.5;
197 //AuxiliaryXhair[0].alpha = 0.5;
199 AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-bracket.tga";
200 AuxiliaryXhair[1].axh_scale = 0.25;
201 //AuxiliaryXhair[1].alpha = 0.75;
202 //AuxiliaryXhair[1].axh_drawflag = DRAWFLAG_NORMAL;
207 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-bracket.tga";
208 AuxiliaryXhair[0].axh_scale = 0.5;
211 AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-target.tga";
212 AuxiliaryXhair[1].axh_scale = 0.75;
215 AuxiliaryXhair[2].axh_image = "gfx/vehicles/axh-target.tga";
216 AuxiliaryXhair[2].axh_scale = 0.75;
218 case HUD_BUMBLEBEE_GUN:
220 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-bracket.tga";
221 AuxiliaryXhair[0].axh_scale = 0.25;
223 AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-bracket.tga";
224 AuxiliaryXhair[1].axh_scale = 0.25;
228 #define HUD_GETSTATS \
229 int vh_health = getstati(STAT_VEHICLESTAT_HEALTH); \
230 float shield = getstati(STAT_VEHICLESTAT_SHIELD); \
231 noref int energy = getstati(STAT_VEHICLESTAT_ENERGY); \
232 noref float ammo1 = getstati(STAT_VEHICLESTAT_AMMO1); \
233 noref float reload1 = getstati(STAT_VEHICLESTAT_RELOAD1); \
234 noref int ammo2 = getstati(STAT_VEHICLESTAT_AMMO2); \
235 noref int reload2 = getstati(STAT_VEHICLESTAT_RELOAD2);
237 void CSQC_BUMBLE_HUD()
240 drawpic(hudloc, waki_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
241 drawpic(hudloc, waki_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
242 drawpic(hudloc, waki_r, picsize, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
243 drawpic(hudloc, waki_e, picsize, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
245 if(autocvar_r_letterbox)
248 vector picsize, hudloc = '0 0 0', pic2size, picloc;
250 // Fetch health & ammo stats
253 picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
254 hudloc.y = vid_conheight - picsize.y;
255 hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
257 drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
264 pic2size = draw_getimagesize(bumb_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
265 picloc = picsize * 0.5 - pic2size * 0.5;
268 drawpic(hudloc + picloc, bumb_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
270 drawpic(hudloc + picloc, bumb_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL);
272 drawpic(hudloc + picloc, bumb_lgun, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
273 drawpic(hudloc + picloc, bumb_lgun, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
274 drawpic(hudloc + picloc, hud_sh, pic2size, '1 1 1', shield, DRAWFLAG_NORMAL);
277 picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
278 picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
279 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
280 drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
283 picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
284 picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
287 if(alarm1time < time)
289 alarm1time = time + 2;
290 sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
293 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
297 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
300 sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
306 picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
307 picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
308 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
309 drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
312 picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
313 picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
316 if(alarm2time < time)
318 alarm2time = time + 1;
319 sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
321 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
325 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
328 sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
337 picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
338 picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
339 drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * ammo1, vid_conheight);
340 drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
343 // Right gunner slot occupied?
344 if(!AuxiliaryXhair[1].draw2d)
346 shield = (picsize.x * 0.5) - (0.5 * stringwidth(_("No right gunner!"), false, '1 0 0' * picsize.y + '0 1 0' * picsize.y));
347 drawfill(hudloc + picloc - '0.2 0.2 0', picsize + '0.4 0.4 0', '0.25 0.25 0.25', 0.75, DRAWFLAG_NORMAL);
348 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);
352 picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale;
353 picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
355 drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
357 drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
360 picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
361 picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
362 drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * ammo2, vid_conheight);
363 drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
365 // Left gunner slot occupied?
366 if(!AuxiliaryXhair[2].draw2d)
368 shield = (picsize.x * 0.5) - (0.5 * stringwidth(_("No left gunner!"), false, '1 0 0' * picsize.y + '0 1 0' * picsize.y));
369 drawfill(hudloc + picloc - '0.2 0.2 0', picsize + '0.4 0.4 0', '0.25 0.25 0.25', 0.75, DRAWFLAG_NORMAL);
370 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);
374 picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale;
375 picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
377 drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
379 drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
381 if (scoreboard_showscores)
382 HUD_DrawScoreboard();
385 picsize = draw_getimagesize(waki_xhair);
388 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);
393 void CSQC_BUMBLE_GUN_HUD()
396 if(autocvar_r_letterbox)
399 vector picsize, hudloc = '0 0 0', pic2size, picloc;
401 // Fetch health & ammo stats
404 picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
405 hudloc.y = vid_conheight - picsize.y;
406 hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
408 drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
415 pic2size = draw_getimagesize(bumb_gun_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
416 picloc = picsize * 0.5 - pic2size * 0.5;
419 drawpic(hudloc + picloc, bumb_gun_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
421 drawpic(hudloc + picloc, bumb_gun_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL);
423 drawpic(hudloc + picloc, bumb_gun_gun, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
424 drawpic(hudloc + picloc, hud_sh, pic2size, '1 1 1', shield, DRAWFLAG_NORMAL);
427 picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
428 picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
429 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
430 drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
433 picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
434 picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
437 if(alarm1time < time)
439 alarm1time = time + 2;
440 sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
443 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
447 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
450 sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
456 picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
457 picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
458 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
459 drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
462 picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
463 picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
466 if(alarm2time < time)
468 alarm2time = time + 1;
469 sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
471 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
475 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
478 sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
484 picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
485 picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
486 drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * energy, vid_conheight);
487 drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
491 picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale;
492 picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
494 drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
496 drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
498 if (scoreboard_showscores)
499 HUD_DrawScoreboard();
503 picsize = draw_getimagesize(waki_xhair);
508 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);
515 void CSQC_SPIDER_HUD()
517 if(autocvar_r_letterbox)
520 vector picsize, hudloc = '0 0 0', pic2size, picloc;
523 // Fetch health & ammo stats
526 picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
527 hudloc.y = vid_conheight - picsize.y;
528 hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
530 drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
537 pic2size = draw_getimagesize(spider_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
538 picloc = picsize * 0.5 - pic2size * 0.5;
540 drawpic(hudloc + picloc, spider_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
542 drawpic(hudloc + picloc, spider_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL);
543 drawpic(hudloc + picloc, spider_rkt, pic2size, '1 1 1' * reload2 + '1 0 0' * (1 - reload2), 1, DRAWFLAG_NORMAL);
544 drawpic(hudloc + picloc, spider_mgun, pic2size, '1 1 1' * ammo1 + '1 0 0' * (1 - ammo1), 1, DRAWFLAG_NORMAL);
545 drawpic(hudloc + picloc, hud_sh, pic2size, '1 1 1', shield, DRAWFLAG_NORMAL);
548 picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
549 picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
550 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
551 drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
554 picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
555 picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
558 if(alarm1time < time)
560 alarm1time = time + 2;
561 sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
563 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
567 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
570 sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
575 picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
576 picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
577 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
578 drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
581 picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
582 picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
585 if(alarm2time < time)
587 alarm2time = time + 1;
588 sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
590 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
594 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
597 sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
603 picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
604 picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
605 drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * ammo1, vid_conheight);
606 drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
609 picsize = draw_getimagesize(hud_ammo1_ico) * autocvar_cl_vehicles_hudscale;
610 picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
612 drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
614 drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
617 picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
618 ammo1 = picsize.x / 8;
619 picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
620 drawsetcliparea(hudloc.x + picloc.x, hudloc.y + picloc.y, picsize.x * reload2, vid_conheight);
621 drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
625 pic2size = 0.35 * draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
626 picloc.x -= pic2size.x;
627 picloc.y += pic2size.y * 2.25;
630 for(i = 1; i < 9; ++i)
633 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, ((8 * reload2 <= i) ? '0 0 0' : '1 1 1'), 0.75, DRAWFLAG_NORMAL);
638 for(i = 1; i < 9; ++i)
641 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, ((i >= ammo2) ? '1 1 1' : '0 0 0'), 0.75, DRAWFLAG_NORMAL);
644 pic2size = draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
645 picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
647 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
649 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 1 1', 1, DRAWFLAG_NORMAL);
651 if (scoreboard_showscores)
652 HUD_DrawScoreboard();
658 spider_xhair = "gfx/vehicles/axh-bracket.tga";
661 spider_xhair = "gfx/vehicles/axh-cross.tga";
664 spider_xhair = "gfx/vehicles/axh-tag.tga";
667 spider_xhair= "gfx/vehicles/axh-tag.tga";
670 picsize = draw_getimagesize(spider_xhair);
671 picsize.x *= autocvar_cl_vehicle_spiderbot_cross_size;
672 picsize.y *= autocvar_cl_vehicle_spiderbot_cross_size;
674 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);
678 void CSQC_RAPTOR_HUD()
680 if(autocvar_r_letterbox)
683 vector picsize, hudloc = '0 0 0', pic2size, picloc;
685 // Fetch health & ammo stats
688 picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
689 hudloc.y = vid_conheight - picsize.y;
690 hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
692 drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
699 reload1 = reload2 * 0.01;
702 pic2size = draw_getimagesize(spider_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
703 picloc = picsize * 0.5 - pic2size * 0.5;
705 drawpic(hudloc + picloc, raptor_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
707 drawpic(hudloc + picloc, raptor_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL);
708 drawpic(hudloc + picloc, raptor_bomb, pic2size, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
709 drawpic(hudloc + picloc, raptor_gun, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
710 drawpic(hudloc + picloc, hud_sh, pic2size, '1 1 1', shield, DRAWFLAG_NORMAL);
713 picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
714 picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
715 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
716 drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
719 picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
720 picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
723 if(alarm1time < time)
725 alarm1time = time + 2;
726 sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
729 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
733 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
736 sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
742 picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
743 picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
744 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
745 drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
748 picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
749 picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
752 if(alarm2time < time)
754 alarm2time = time + 1;
755 sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
757 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
761 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
764 sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
770 picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
771 picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
772 drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * energy, vid_conheight);
773 drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
776 picsize = draw_getimagesize(hud_ammo1_ico) * autocvar_cl_vehicles_hudscale;
777 picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
779 drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
781 drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
784 picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
785 picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
786 drawsetcliparea(hudloc.x + picloc.x, hudloc.y + picloc.y, picsize.x * reload1, vid_conheight);
787 drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
790 pic2size = draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
791 picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
793 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
795 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 1 1', 1, DRAWFLAG_NORMAL);
797 if(weapon2mode == RSM_FLARE)
799 raptor_xhair = "gfx/vehicles/axh-bracket.tga";
803 raptor_xhair = "gfx/vehicles/axh-ring.tga";
809 dropmark.owner = self;
810 dropmark.gravity = 1;
817 setorigin(dropmark, pmove_org);
818 dropmark.velocity = pmove_vel;
819 tracetoss(dropmark, self);
821 where = project_3d_to_2d(trace_endpos);
823 setorigin(dropmark, trace_endpos);
824 picsize = draw_getimagesize(raptor_drop) * 0.2;
826 if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
828 where.x -= picsize.x * 0.5;
829 where.y -= picsize.y * 0.5;
831 drawpic(where, raptor_drop, picsize, '0 2 0', 1, DRAWFLAG_ADDITIVE);
833 dropmark.cnt = time + 5;
838 if(dropmark.cnt > time)
840 where = project_3d_to_2d(dropmark.origin);
841 picsize = draw_getimagesize(raptor_drop) * 0.25;
843 if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
845 where.x -= picsize.x * 0.5;
846 where.y -= picsize.y * 0.5;
848 drawpic(where, raptor_drop, picsize, '2 0 0', 1, DRAWFLAG_ADDITIVE);
854 if (scoreboard_showscores)
855 HUD_DrawScoreboard();
858 picsize = draw_getimagesize(raptor_xhair);
862 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);
866 void CSQC_WAKIZASHI_HUD()
869 drawpic(hudloc, waki_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
870 drawpic(hudloc, waki_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
871 drawpic(hudloc, waki_r, picsize, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
872 drawpic(hudloc, waki_e, picsize, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
874 if(autocvar_r_letterbox)
877 vector picsize, hudloc = '0 0 0', pic2size, picloc;
879 // Fetch health & ammo stats
882 picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
883 hudloc.y = vid_conheight - picsize.y;
884 hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
886 drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
893 pic2size = draw_getimagesize(spider_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
894 picloc = picsize * 0.5 - pic2size * 0.5;
896 drawpic(hudloc + picloc, waki_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
898 drawpic(hudloc + picloc, waki_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL);
899 drawpic(hudloc + picloc, waki_eng, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
900 drawpic(hudloc + picloc, waki_gun, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
901 drawpic(hudloc + picloc, waki_rkt, pic2size, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
902 drawpic(hudloc + picloc, hud_sh, pic2size, '1 1 1', shield, DRAWFLAG_NORMAL);
905 picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
906 picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
907 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
908 drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
911 picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
912 picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
915 if(alarm1time < time)
917 alarm1time = time + 2;
918 sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
921 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
925 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
928 sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
935 picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
936 picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
937 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
938 drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
941 picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
942 picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
945 if(alarm2time < time)
947 alarm2time = time + 1;
948 sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
950 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
954 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
957 sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
963 picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
964 picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
965 drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * energy, vid_conheight);
966 drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
969 picsize = draw_getimagesize(hud_ammo1_ico) * autocvar_cl_vehicles_hudscale;
970 picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
972 drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
974 drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
977 picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
978 picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
979 drawsetcliparea(hudloc.x + picloc.x, hudloc.y + picloc.y, picsize.x * reload1, vid_conheight);
980 drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
983 pic2size = draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
984 picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
986 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
988 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 1 1', 1, DRAWFLAG_NORMAL);
990 if (scoreboard_showscores)
991 HUD_DrawScoreboard();
994 picsize = draw_getimagesize(waki_xhair);
999 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);
1003 void Vehicles_Precache()
1005 precache_model("models/vehicles/bomblet.md3");
1006 precache_model("models/vehicles/clusterbomb.md3");
1007 precache_model("models/vehicles/clusterbomb_fragment.md3");
1008 precache_model("models/vehicles/rocket01.md3");
1009 precache_model("models/vehicles/rocket02.md3");
1011 precache_sound ("vehicles/alarm.wav");
1012 precache_sound ("vehicles/alarm_shield.wav");
1015 void RaptorCBShellfragDraw()
1020 Movetype_Physics_MatchTicrate(autocvar_cl_gibs_ticrate, autocvar_cl_gibs_sloppy);
1021 self.move_avelocity += randomvec() * 15;
1022 self.renderflags = 0;
1025 self.alpha = bound(0, self.nextthink - time, 1);
1027 if(self.alpha < ALPHA_MIN_VISIBLE)
1031 void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang)
1036 setmodel(sfrag, "models/vehicles/clusterbomb_fragment.md3");
1037 setorigin(sfrag, _org);
1039 sfrag.move_movetype = MOVETYPE_BOUNCE;
1040 sfrag.gravity = 0.15;
1041 sfrag.solid = SOLID_CORPSE;
1043 sfrag.draw = RaptorCBShellfragDraw;
1045 sfrag.move_origin = sfrag.origin = _org;
1046 sfrag.move_velocity = _vel;
1047 sfrag.move_avelocity = prandomvec() * vlen(sfrag.move_velocity);
1048 sfrag.angles = self.move_angles = _ang;
1050 sfrag.move_time = time;
1051 sfrag.damageforcescale = 4;
1053 sfrag.nextthink = time + 3;
1054 sfrag.cnt = time + 2;
1056 sfrag.drawmask = MASK_NORMAL;