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];
63 entityclass(AuxiliaryXhair)
64 class(AuxiliaryXhair) .string axh_image;
65 class(AuxiliaryXhair) .float axh_fadetime;
66 class(AuxiliaryXhair) .float axh_drawflag;
67 class(AuxiliaryXhair) .float axh_scale;
69 const string bumb_ico = "gfx/vehicles/bumb.tga";
70 const string bumb_lgun = "gfx/vehicles/bumb_lgun.tga";
71 const string bumb_rgun = "gfx/vehicles/bumb_rgun.tga";
73 const string bumb_gun_ico = "gfx/vehicles/bumb_side.tga";
74 const string bumb_gun_gun = "gfx/vehicles/bumb_side_gun.tga";
76 const string spider_ico = "gfx/vehicles/sbot.tga";
77 const string spider_rkt = "gfx/vehicles/sbot_rpods.tga";
78 const string spider_mgun = "gfx/vehicles/sbot_mguns.tga";
79 string spider_xhair; // = "gfx/vehicles/axh-special1.tga";
81 const string waki_ico = "gfx/vehicles/waki.tga";
82 const string waki_eng = "gfx/vehicles/waki_e.tga";
83 const string waki_gun = "gfx/vehicles/waki_guns.tga";
84 const string waki_rkt = "gfx/vehicles/waki_rockets.tga";
85 const string waki_xhair = "gfx/vehicles/axh-special1.tga";
91 void AuxiliaryXhair_Draw2D()
95 psize = self.axh_scale * draw_getimagesize(self.axh_image);
96 loc = project_3d_to_2d(self.move_origin) - 0.5 * psize;
97 if (!(loc.z < 0 || loc.x < 0 || loc.y < 0 || loc.x > vid_conwidth || loc.y > vid_conheight))
101 drawpic(loc, self.axh_image, psize, self.colormod, self.alpha, self.axh_drawflag);
104 if(time - self.cnt > self.axh_fadetime)
105 self.draw2d = func_null;
108 void Net_AuXair2(bool bIsNew)
110 int axh_id = bound(0, ReadByte(), MAX_AXH);
111 entity axh = AuxiliaryXhair[axh_id];
113 if(axh == world || wasfreed(axh)) // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
116 axh.draw2d = func_null;
117 axh.drawmask = MASK_NORMAL;
118 axh.axh_drawflag = DRAWFLAG_ADDITIVE;
119 axh.axh_fadetime = 0.1;
120 axh.axh_image = "gfx/vehicles/axh-ring.tga";
123 AuxiliaryXhair[axh_id] = axh;
126 axh.move_origin_x = ReadCoord();
127 axh.move_origin_y = ReadCoord();
128 axh.move_origin_z = ReadCoord();
129 axh.colormod_x = ReadByte() / 255;
130 axh.colormod_y = ReadByte() / 255;
131 axh.colormod_z = ReadByte() / 255;
133 axh.draw2d = AuxiliaryXhair_Draw2D;
136 void Net_VehicleSetup()
138 int hud_id = ReadByte();
141 if(hud_id > HUD_VEHICLE_LAST)
143 weapon2mode = hud_id - HUD_VEHICLE_LAST;
147 // hud_id == 0 means we exited a vehicle, so stop alarm sound/s
150 sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
151 sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
155 hud_id = bound(HUD_VEHICLE_FIRST, hud_id, HUD_VEHICLE_LAST);
157 // Init auxiliary crosshairs
159 for(i = 0; i < MAX_AXH; ++i)
161 entity axh = AuxiliaryXhair[i];
162 if(axh != world && !wasfreed(axh)) // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
166 axh.draw2d = func_null;
167 axh.drawmask = MASK_NORMAL;
168 axh.axh_drawflag = DRAWFLAG_NORMAL;
169 axh.axh_fadetime = 0.1;
170 axh.axh_image = "gfx/vehicles/axh-ring.tga";
173 AuxiliaryXhair[i] = axh;
180 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-ring.tga";
181 AuxiliaryXhair[0].axh_scale = 0.25;
183 AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-ring.tga";
184 AuxiliaryXhair[1].axh_scale = 0.25;
186 AuxiliaryXhair[2].axh_image = "gfx/vehicles/axh-special1.tga";
187 AuxiliaryXhair[2].axh_scale = 0.5;
191 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-bracket.tga";
192 AuxiliaryXhair[0].axh_scale = 0.25;
196 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-special2.tga";
197 AuxiliaryXhair[0].axh_scale = 0.5;
198 //AuxiliaryXhair[0].alpha = 0.5;
200 AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-bracket.tga";
201 AuxiliaryXhair[1].axh_scale = 0.25;
202 //AuxiliaryXhair[1].alpha = 0.75;
203 //AuxiliaryXhair[1].axh_drawflag = DRAWFLAG_NORMAL;
208 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-bracket.tga";
209 AuxiliaryXhair[0].axh_scale = 0.5;
212 AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-target.tga";
213 AuxiliaryXhair[1].axh_scale = 0.75;
216 AuxiliaryXhair[2].axh_image = "gfx/vehicles/axh-target.tga";
217 AuxiliaryXhair[2].axh_scale = 0.75;
219 case HUD_BUMBLEBEE_GUN:
221 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-bracket.tga";
222 AuxiliaryXhair[0].axh_scale = 0.25;
224 AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-bracket.tga";
225 AuxiliaryXhair[1].axh_scale = 0.25;
229 #define HUD_GETSTATS \
230 int vh_health = getstati(STAT_VEHICLESTAT_HEALTH); \
231 float shield = getstati(STAT_VEHICLESTAT_SHIELD); \
232 noref int energy = getstati(STAT_VEHICLESTAT_ENERGY); \
233 noref float ammo1 = getstati(STAT_VEHICLESTAT_AMMO1); \
234 noref float reload1 = getstati(STAT_VEHICLESTAT_RELOAD1); \
235 noref int ammo2 = getstati(STAT_VEHICLESTAT_AMMO2); \
236 noref int reload2 = getstati(STAT_VEHICLESTAT_RELOAD2);
238 void CSQC_BUMBLE_HUD()
241 drawpic(hudloc, waki_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
242 drawpic(hudloc, waki_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
243 drawpic(hudloc, waki_r, picsize, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
244 drawpic(hudloc, waki_e, picsize, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
246 if(autocvar_r_letterbox)
249 vector picsize, hudloc = '0 0 0', pic2size, picloc;
251 // Fetch health & ammo stats
254 picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
255 hudloc.y = vid_conheight - picsize.y;
256 hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
258 drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
265 pic2size = draw_getimagesize(bumb_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
266 picloc = picsize * 0.5 - pic2size * 0.5;
269 drawpic(hudloc + picloc, bumb_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
271 drawpic(hudloc + picloc, bumb_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 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, bumb_lgun, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
275 drawpic(hudloc + picloc, hud_sh, pic2size, '1 1 1', shield, DRAWFLAG_NORMAL);
278 picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
279 picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
280 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
281 drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
284 picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
285 picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
288 if(alarm1time < time)
290 alarm1time = time + 2;
291 sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
294 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
298 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
301 sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
307 picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
308 picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
309 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
310 drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
313 picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
314 picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
317 if(alarm2time < time)
319 alarm2time = time + 1;
320 sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
322 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
326 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
329 sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
338 picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
339 picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
340 drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * ammo1, vid_conheight);
341 drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
344 // Right gunner slot occupied?
345 if(!AuxiliaryXhair[1].draw2d)
347 shield = (picsize.x * 0.5) - (0.5 * stringwidth(_("No right gunner!"), false, '1 0 0' * picsize.y + '0 1 0' * picsize.y));
348 drawfill(hudloc + picloc - '0.2 0.2 0', picsize + '0.4 0.4 0', '0.25 0.25 0.25', 0.75, DRAWFLAG_NORMAL);
349 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);
353 picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale;
354 picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
356 drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
358 drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
361 picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
362 picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
363 drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * ammo2, vid_conheight);
364 drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
366 // Left gunner slot occupied?
367 if(!AuxiliaryXhair[2].draw2d)
369 shield = (picsize.x * 0.5) - (0.5 * stringwidth(_("No left gunner!"), false, '1 0 0' * picsize.y + '0 1 0' * picsize.y));
370 drawfill(hudloc + picloc - '0.2 0.2 0', picsize + '0.4 0.4 0', '0.25 0.25 0.25', 0.75, DRAWFLAG_NORMAL);
371 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);
375 picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale;
376 picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
378 drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
380 drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
382 if (scoreboard_showscores)
383 HUD_DrawScoreboard();
386 picsize = draw_getimagesize(waki_xhair);
389 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);
394 void CSQC_BUMBLE_GUN_HUD()
397 if(autocvar_r_letterbox)
400 vector picsize, hudloc = '0 0 0', pic2size, picloc;
402 // Fetch health & ammo stats
405 picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
406 hudloc.y = vid_conheight - picsize.y;
407 hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
409 drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
416 pic2size = draw_getimagesize(bumb_gun_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
417 picloc = picsize * 0.5 - pic2size * 0.5;
420 drawpic(hudloc + picloc, bumb_gun_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
422 drawpic(hudloc + picloc, bumb_gun_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL);
424 drawpic(hudloc + picloc, bumb_gun_gun, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
425 drawpic(hudloc + picloc, hud_sh, pic2size, '1 1 1', shield, DRAWFLAG_NORMAL);
428 picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
429 picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
430 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
431 drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
434 picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
435 picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
438 if(alarm1time < time)
440 alarm1time = time + 2;
441 sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
444 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
448 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
451 sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
457 picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
458 picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
459 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
460 drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
463 picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
464 picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
467 if(alarm2time < time)
469 alarm2time = time + 1;
470 sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
472 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
476 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
479 sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
485 picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
486 picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
487 drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * energy, vid_conheight);
488 drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
492 picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale;
493 picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
495 drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
497 drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
499 if (scoreboard_showscores)
500 HUD_DrawScoreboard();
504 picsize = draw_getimagesize(waki_xhair);
509 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);
516 void CSQC_SPIDER_HUD()
518 if(autocvar_r_letterbox)
521 vector picsize, hudloc = '0 0 0', pic2size, picloc;
524 // Fetch health & ammo stats
527 picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
528 hudloc.y = vid_conheight - picsize.y;
529 hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
531 drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
538 pic2size = draw_getimagesize(spider_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
539 picloc = picsize * 0.5 - pic2size * 0.5;
541 drawpic(hudloc + picloc, spider_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
543 drawpic(hudloc + picloc, spider_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL);
544 drawpic(hudloc + picloc, spider_rkt, pic2size, '1 1 1' * reload2 + '1 0 0' * (1 - reload2), 1, DRAWFLAG_NORMAL);
545 drawpic(hudloc + picloc, spider_mgun, pic2size, '1 1 1' * ammo1 + '1 0 0' * (1 - ammo1), 1, DRAWFLAG_NORMAL);
546 drawpic(hudloc + picloc, hud_sh, pic2size, '1 1 1', shield, DRAWFLAG_NORMAL);
549 picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
550 picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
551 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
552 drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
555 picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
556 picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
559 if(alarm1time < time)
561 alarm1time = time + 2;
562 sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
564 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
568 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
571 sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
576 picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
577 picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
578 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
579 drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
582 picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
583 picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
586 if(alarm2time < time)
588 alarm2time = time + 1;
589 sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
591 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
595 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
598 sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
604 picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
605 picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
606 drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * ammo1, vid_conheight);
607 drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
610 picsize = draw_getimagesize(hud_ammo1_ico) * autocvar_cl_vehicles_hudscale;
611 picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
613 drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
615 drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
618 picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
619 ammo1 = picsize.x / 8;
620 picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
621 drawsetcliparea(hudloc.x + picloc.x, hudloc.y + picloc.y, picsize.x * reload2, vid_conheight);
622 drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
626 pic2size = 0.35 * draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
627 picloc.x -= pic2size.x;
628 picloc.y += pic2size.y * 2.25;
631 for(i = 1; i < 9; ++i)
634 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, ((8 * reload2 <= i) ? '0 0 0' : '1 1 1'), 0.75, DRAWFLAG_NORMAL);
639 for(i = 1; i < 9; ++i)
642 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, ((i >= ammo2) ? '1 1 1' : '0 0 0'), 0.75, DRAWFLAG_NORMAL);
645 pic2size = draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
646 picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
648 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
650 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 1 1', 1, DRAWFLAG_NORMAL);
652 if (scoreboard_showscores)
653 HUD_DrawScoreboard();
659 spider_xhair = "gfx/vehicles/axh-bracket.tga";
662 spider_xhair = "gfx/vehicles/axh-cross.tga";
665 spider_xhair = "gfx/vehicles/axh-tag.tga";
668 spider_xhair= "gfx/vehicles/axh-tag.tga";
671 picsize = draw_getimagesize(spider_xhair);
672 picsize.x *= autocvar_cl_vehicle_spiderbot_cross_size;
673 picsize.y *= autocvar_cl_vehicle_spiderbot_cross_size;
675 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);
679 void CSQC_RAPTOR_HUD()
681 if(autocvar_r_letterbox)
684 vector picsize, hudloc = '0 0 0', pic2size, picloc;
686 // Fetch health & ammo stats
689 picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
690 hudloc.y = vid_conheight - picsize.y;
691 hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
693 drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
700 reload1 = reload2 * 0.01;
703 pic2size = draw_getimagesize(spider_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
704 picloc = picsize * 0.5 - pic2size * 0.5;
706 drawpic(hudloc + picloc, raptor_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
708 drawpic(hudloc + picloc, raptor_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL);
709 drawpic(hudloc + picloc, raptor_bomb, pic2size, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
710 drawpic(hudloc + picloc, raptor_gun, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
711 drawpic(hudloc + picloc, hud_sh, pic2size, '1 1 1', shield, DRAWFLAG_NORMAL);
714 picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
715 picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
716 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
717 drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
720 picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
721 picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
724 if(alarm1time < time)
726 alarm1time = time + 2;
727 sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
730 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
734 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
737 sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
743 picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
744 picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
745 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
746 drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
749 picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
750 picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
753 if(alarm2time < time)
755 alarm2time = time + 1;
756 sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
758 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
762 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
765 sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
771 picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
772 picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
773 drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * energy, vid_conheight);
774 drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
777 picsize = draw_getimagesize(hud_ammo1_ico) * autocvar_cl_vehicles_hudscale;
778 picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
780 drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
782 drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
785 picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
786 picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
787 drawsetcliparea(hudloc.x + picloc.x, hudloc.y + picloc.y, picsize.x * reload1, vid_conheight);
788 drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
791 pic2size = draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
792 picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
794 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
796 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 1 1', 1, DRAWFLAG_NORMAL);
798 if(weapon2mode == RSM_FLARE)
800 raptor_xhair = "gfx/vehicles/axh-bracket.tga";
804 raptor_xhair = "gfx/vehicles/axh-ring.tga";
810 dropmark.owner = self;
811 dropmark.gravity = 1;
818 setorigin(dropmark, pmove_org);
819 dropmark.velocity = pmove_vel;
820 tracetoss(dropmark, self);
822 where = project_3d_to_2d(trace_endpos);
824 setorigin(dropmark, trace_endpos);
825 picsize = draw_getimagesize(raptor_drop) * 0.2;
827 if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
829 where.x -= picsize.x * 0.5;
830 where.y -= picsize.y * 0.5;
832 drawpic(where, raptor_drop, picsize, '0 2 0', 1, DRAWFLAG_ADDITIVE);
834 dropmark.cnt = time + 5;
839 if(dropmark.cnt > time)
841 where = project_3d_to_2d(dropmark.origin);
842 picsize = draw_getimagesize(raptor_drop) * 0.25;
844 if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
846 where.x -= picsize.x * 0.5;
847 where.y -= picsize.y * 0.5;
849 drawpic(where, raptor_drop, picsize, '2 0 0', 1, DRAWFLAG_ADDITIVE);
855 if (scoreboard_showscores)
856 HUD_DrawScoreboard();
859 picsize = draw_getimagesize(raptor_xhair);
863 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);
867 void CSQC_WAKIZASHI_HUD()
870 drawpic(hudloc, waki_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
871 drawpic(hudloc, waki_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
872 drawpic(hudloc, waki_r, picsize, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
873 drawpic(hudloc, waki_e, picsize, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
875 if(autocvar_r_letterbox)
878 vector picsize, hudloc = '0 0 0', pic2size, picloc;
880 // Fetch health & ammo stats
883 picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
884 hudloc.y = vid_conheight - picsize.y;
885 hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
887 drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
894 pic2size = draw_getimagesize(spider_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
895 picloc = picsize * 0.5 - pic2size * 0.5;
897 drawpic(hudloc + picloc, waki_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
899 drawpic(hudloc + picloc, waki_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL);
900 drawpic(hudloc + picloc, waki_eng, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
901 drawpic(hudloc + picloc, waki_gun, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
902 drawpic(hudloc + picloc, waki_rkt, pic2size, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
903 drawpic(hudloc + picloc, hud_sh, pic2size, '1 1 1', shield, DRAWFLAG_NORMAL);
906 picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
907 picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
908 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
909 drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
912 picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
913 picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
916 if(alarm1time < time)
918 alarm1time = time + 2;
919 sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE);
922 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
926 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
929 sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
936 picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
937 picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
938 drawsetcliparea(hudloc.x + picloc.x + (picsize.x * (1 - shield)), 0, vid_conwidth, vid_conheight);
939 drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
942 picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
943 picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
946 if(alarm2time < time)
948 alarm2time = time + 1;
949 sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE);
951 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
955 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
958 sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
964 picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
965 picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
966 drawsetcliparea(hudloc.x + picloc.x, picloc.y, picsize.x * energy, vid_conheight);
967 drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
970 picsize = draw_getimagesize(hud_ammo1_ico) * autocvar_cl_vehicles_hudscale;
971 picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
973 drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
975 drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
978 picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
979 picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
980 drawsetcliparea(hudloc.x + picloc.x, hudloc.y + picloc.y, picsize.x * reload1, vid_conheight);
981 drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
984 pic2size = draw_getimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
985 picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
987 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
989 drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 1 1', 1, DRAWFLAG_NORMAL);
991 if (scoreboard_showscores)
992 HUD_DrawScoreboard();
995 picsize = draw_getimagesize(waki_xhair);
1000 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);
1004 void Vehicles_Precache()
1006 precache_model("models/vehicles/bomblet.md3");
1007 precache_model("models/vehicles/clusterbomb.md3");
1008 precache_model("models/vehicles/clusterbomb_fragment.md3");
1009 precache_model("models/vehicles/rocket01.md3");
1010 precache_model("models/vehicles/rocket02.md3");
1012 precache_sound ("vehicles/alarm.wav");
1013 precache_sound ("vehicles/alarm_shield.wav");
1016 void RaptorCBShellfragDraw()
1021 Movetype_Physics_MatchTicrate(autocvar_cl_gibs_ticrate, autocvar_cl_gibs_sloppy);
1022 self.move_avelocity += randomvec() * 15;
1023 self.renderflags = 0;
1026 self.alpha = bound(0, self.nextthink - time, 1);
1028 if(self.alpha < ALPHA_MIN_VISIBLE)
1032 void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang)
1037 setmodel(sfrag, "models/vehicles/clusterbomb_fragment.md3");
1038 setorigin(sfrag, _org);
1040 sfrag.move_movetype = MOVETYPE_BOUNCE;
1041 sfrag.gravity = 0.15;
1042 sfrag.solid = SOLID_CORPSE;
1044 sfrag.draw = RaptorCBShellfragDraw;
1046 sfrag.move_origin = sfrag.origin = _org;
1047 sfrag.move_velocity = _vel;
1048 sfrag.move_avelocity = prandomvec() * vlen(sfrag.move_velocity);
1049 sfrag.angles = self.move_angles = _ang;
1051 sfrag.move_time = time;
1052 sfrag.damageforcescale = 4;
1054 sfrag.nextthink = time + 3;
1055 sfrag.cnt = time + 2;
1057 sfrag.drawmask = MASK_NORMAL;