1 #define hud_bg "gfx/vehicles/frame.tga"
2 #define hud_sh "gfx/vehicles/vh-shield.tga"
4 #define hud_hp_bar "gfx/vehicles/bar_up_left.tga"
5 #define hud_hp_ico "gfx/vehicles/health.tga"
6 #define hud_sh_bar "gfx/vehicles/bar_dwn_left.tga"
7 #define hud_sh_ico "gfx/vehicles/shield.tga"
9 #define hud_ammo1_bar "gfx/vehicles/bar_up_right.tga"
10 #define hud_ammo1_ico "gfx/vehicles/bullets.tga"
11 #define hud_ammo2_bar "gfx/vehicles/bar_dwn_right.tga"
12 #define hud_ammo2_ico "gfx/vehicles/rocket.tga"
13 #define hud_energy "gfx/vehicles/energy.tga"
16 var float autocvar_cl_vehicles_hudscale = 0.5;
17 var float autocvar_cl_vehicles_hudalpha = 0.75;
19 void CSQC_BUMBLE_GUN_HUD();
21 const float MAX_AXH = 4;
22 entity AuxiliaryXhair[MAX_AXH];
29 #define bumb_ico "gfx/vehicles/bumb.tga"
30 #define bumb_lgun "gfx/vehicles/bumb_lgun.tga"
31 #define bumb_rgun "gfx/vehicles/bumb_rgun.tga"
33 #define bumb_gun_ico "gfx/vehicles/bumb_side.tga"
34 #define bumb_gun_gun "gfx/vehicles/bumb_side_gun.tga"
39 void vehicle_alarm(entity e, float ch, string s0und)
41 if(!autocvar_cl_vehicles_alarm)
44 sound(e, ch, s0und, VOL_BASEVOICE, ATTEN_NONE);
47 void AuxiliaryXhair_Draw2D()
51 psize = self.axh_scale * draw_getimagesize(self.axh_image);
52 loc = project_3d_to_2d(self.move_origin) - 0.5 * psize;
53 if(!(loc_z < 0 || loc_x < 0 || loc_y < 0 || loc_x > vid_conwidth || loc_y > vid_conheight))
57 drawpic(loc, self.axh_image, psize, self.colormod, self.alpha, self.axh_drawflag);
60 if(time - self.cnt > self.axh_fadetime)
61 self.draw2d = func_null;
64 void Net_AuXair2(float bIsNew)
66 float axh_id = bound(0, ReadByte(), MAX_AXH);
67 entity axh = AuxiliaryXhair[axh_id];
69 if(axh == world || wasfreed(axh)) // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
72 axh.draw2d = func_null;
73 axh.drawmask = MASK_NORMAL;
74 axh.axh_drawflag = DRAWFLAG_ADDITIVE;
75 axh.axh_fadetime = 0.1;
76 axh.axh_image = "gfx/vehicles/axh-ring.tga";
79 AuxiliaryXhair[axh_id] = axh;
82 axh.move_origin_x = ReadCoord();
83 axh.move_origin_y = ReadCoord();
84 axh.move_origin_z = ReadCoord();
85 axh.colormod_x = ReadByte() / 255;
86 axh.colormod_y = ReadByte() / 255;
87 axh.colormod_z = ReadByte() / 255;
89 axh.draw2d = AuxiliaryXhair_Draw2D;
92 void Net_VehicleSetup()
96 float hud_id = ReadByte();
98 // hud_id == 0 means we exited a vehicle, so stop alarm sound/s
101 sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
102 sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
106 // Init auxiliary crosshairs
108 for(i = 0; i < MAX_AXH; ++i)
110 axh = AuxiliaryXhair[i];
111 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_NORMAL;
118 axh.axh_fadetime = 0.1;
119 axh.axh_image = "gfx/vehicles/axh-ring.tga";
122 AuxiliaryXhair[i] = axh;
125 VEH_ACTION(hud_id, VR_SETUP);
127 if(hud_id == HUD_BUMBLEBEE_GUN)
130 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-bracket.tga";
131 AuxiliaryXhair[0].axh_scale = 0.25;
133 AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-bracket.tga";
134 AuxiliaryXhair[1].axh_scale = 0.25;
138 void CSQC_BUMBLE_GUN_HUD()
141 if(autocvar_r_letterbox)
144 vector picsize, hudloc = '0 0 0', pic2size, picloc;
146 // Fetch health & ammo stats
149 picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
150 hudloc_y = vid_conheight - picsize_y;
151 hudloc_x = vid_conwidth * 0.5 - picsize_x * 0.5;
153 drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
160 pic2size = draw_getimagesize(bumb_gun_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
161 picloc = picsize * 0.5 - pic2size * 0.5;
164 drawpic(hudloc + picloc, bumb_gun_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
166 drawpic(hudloc + picloc, bumb_gun_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL);
168 drawpic(hudloc + picloc, bumb_gun_gun, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
169 drawpic(hudloc + picloc, hud_sh, pic2size, '1 1 1', shield, DRAWFLAG_NORMAL);
172 picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
173 picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
174 drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
175 drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
178 picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
179 picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
182 if(alarm1time < time)
184 alarm1time = time + 2;
185 vehicle_alarm(self, CH_PAIN_SINGLE, "vehicles/alarm.wav");
188 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
192 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
195 vehicle_alarm(self, CH_PAIN_SINGLE, "misc/null.wav");
201 picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
202 picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
203 drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - shield)), 0, vid_conwidth, vid_conheight);
204 drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
207 picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
208 picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
211 if(alarm2time < time)
213 alarm2time = time + 1;
214 vehicle_alarm(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav");
216 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
220 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
223 vehicle_alarm(self, CH_TRIGGER_SINGLE, "misc/null.wav");
229 picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
230 picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
231 drawsetcliparea(hudloc_x + picloc_x, picloc_y, picsize_x * energy, vid_conheight);
232 drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
236 picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale;
237 picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
239 drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
241 drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
243 if (scoreboard_showscores)
244 HUD_DrawScoreboard();
248 picsize = draw_getimagesize(waki_xhair);
253 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);
258 void RaptorCBShellfragDraw()
263 Movetype_Physics_MatchTicrate(autocvar_cl_gibs_ticrate, autocvar_cl_gibs_sloppy);
264 self.move_avelocity += randomvec() * 15;
265 self.renderflags = 0;
268 self.alpha = bound(0, self.nextthink - time, 1);
270 if(self.alpha < ALPHA_MIN_VISIBLE)
274 void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang)
279 setmodel(sfrag, "models/vehicles/clusterbomb_fragment.md3");
280 setorigin(sfrag, _org);
282 sfrag.move_movetype = MOVETYPE_BOUNCE;
283 sfrag.gravity = 0.15;
284 sfrag.solid = SOLID_CORPSE;
286 sfrag.draw = RaptorCBShellfragDraw;
288 sfrag.move_origin = sfrag.origin = _org;
289 sfrag.move_velocity = _vel;
290 sfrag.move_avelocity = prandomvec() * vlen(sfrag.move_velocity);
291 sfrag.angles = self.move_angles = _ang;
293 sfrag.move_time = time;
294 sfrag.damageforcescale = 4;
296 sfrag.nextthink = time + 3;
297 sfrag.cnt = time + 2;
299 sfrag.drawmask = MASK_NORMAL;