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();
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"
40 void vehicle_alarm(entity e, float ch, string s0und)
42 if(!autocvar_cl_vehicles_alarm)
45 sound(e, ch, s0und, VOL_BASEVOICE, ATTEN_NONE);
48 void AuxiliaryXhair_Draw2D()
52 psize = self.axh_scale * draw_getimagesize(self.axh_image);
53 loc = project_3d_to_2d(self.move_origin) - 0.5 * psize;
54 if(!(loc_z < 0 || loc_x < 0 || loc_y < 0 || loc_x > vid_conwidth || loc_y > vid_conheight))
58 drawpic(loc, self.axh_image, psize, self.colormod, self.alpha, self.axh_drawflag);
61 if(time - self.cnt > self.axh_fadetime)
62 self.draw2d = func_null;
65 void Net_AuXair2(float bIsNew)
67 float axh_id = bound(0, ReadByte(), MAX_AXH);
68 entity axh = AuxiliaryXhair[axh_id];
70 if(axh == world || wasfreed(axh)) // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
73 axh.draw2d = func_null;
74 axh.drawmask = MASK_NORMAL;
75 axh.axh_drawflag = DRAWFLAG_ADDITIVE;
76 axh.axh_fadetime = 0.1;
77 axh.axh_image = "gfx/vehicles/axh-ring.tga";
80 AuxiliaryXhair[axh_id] = axh;
83 axh.move_origin_x = ReadCoord();
84 axh.move_origin_y = ReadCoord();
85 axh.move_origin_z = ReadCoord();
86 axh.colormod_x = ReadByte() / 255;
87 axh.colormod_y = ReadByte() / 255;
88 axh.colormod_z = ReadByte() / 255;
90 axh.draw2d = AuxiliaryXhair_Draw2D;
93 void Net_VehicleSetup()
98 float hud_id = ReadByte();
101 if(hud_id > VEH_LAST && hud_id != HUD_BUMBLEBEE_GUN)
103 weapon2mode = hud_id - VEH_LAST;
107 // hud_id == 0 means we exited a vehicle, so stop alarm sound/s
110 sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
111 sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE);
115 // Init auxiliary crosshairs
117 for(i = 0; i < MAX_AXH; ++i)
119 axh = AuxiliaryXhair[i];
120 if(axh != world && !wasfreed(axh)) // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
124 axh.draw2d = func_null;
125 axh.drawmask = MASK_NORMAL;
126 axh.axh_drawflag = DRAWFLAG_NORMAL;
127 axh.axh_fadetime = 0.1;
128 axh.axh_image = "gfx/vehicles/axh-ring.tga";
131 AuxiliaryXhair[i] = axh;
134 VEH_ACTION(hud_id, VR_SETUP);
136 if(hud_id == HUD_BUMBLEBEE_GUN)
139 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-bracket.tga";
140 AuxiliaryXhair[0].axh_scale = 0.25;
142 AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-bracket.tga";
143 AuxiliaryXhair[1].axh_scale = 0.25;
147 void CSQC_BUMBLE_GUN_HUD()
150 if(autocvar_r_letterbox)
153 vector picsize, hudloc = '0 0 0', pic2size, picloc;
155 // Fetch health & ammo stats
158 picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
159 hudloc_y = vid_conheight - picsize_y;
160 hudloc_x = vid_conwidth * 0.5 - picsize_x * 0.5;
162 drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
169 pic2size = draw_getimagesize(bumb_gun_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
170 picloc = picsize * 0.5 - pic2size * 0.5;
173 drawpic(hudloc + picloc, bumb_gun_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
175 drawpic(hudloc + picloc, bumb_gun_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL);
177 drawpic(hudloc + picloc, bumb_gun_gun, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
178 drawpic(hudloc + picloc, hud_sh, pic2size, '1 1 1', shield, DRAWFLAG_NORMAL);
181 picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
182 picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
183 drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - vh_health)), 0, vid_conwidth, vid_conheight);
184 drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
187 picsize = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
188 picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
191 if(alarm1time < time)
193 alarm1time = time + 2;
194 vehicle_alarm(self, CH_PAIN_SINGLE, "vehicles/alarm.wav");
197 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
201 drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
204 vehicle_alarm(self, CH_PAIN_SINGLE, "misc/null.wav");
210 picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
211 picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
212 drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - shield)), 0, vid_conwidth, vid_conheight);
213 drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
216 picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
217 picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
220 if(alarm2time < time)
222 alarm2time = time + 1;
223 vehicle_alarm(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav");
225 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
229 drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
232 vehicle_alarm(self, CH_TRIGGER_SINGLE, "misc/null.wav");
238 picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
239 picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
240 drawsetcliparea(hudloc_x + picloc_x, picloc_y, picsize_x * energy, vid_conheight);
241 drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
245 picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale;
246 picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
248 drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
250 drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
252 if (scoreboard_showscores)
253 HUD_DrawScoreboard();
257 picsize = draw_getimagesize(waki_xhair);
262 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);
267 void RaptorCBShellfragDraw()
272 Movetype_Physics_MatchTicrate(autocvar_cl_gibs_ticrate, autocvar_cl_gibs_sloppy);
273 self.move_avelocity += randomvec() * 15;
274 self.renderflags = 0;
277 self.alpha = bound(0, self.nextthink - time, 1);
279 if(self.alpha < ALPHA_MIN_VISIBLE)
283 void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang)
288 setmodel(sfrag, "models/vehicles/clusterbomb_fragment.md3");
289 setorigin(sfrag, _org);
291 sfrag.move_movetype = MOVETYPE_BOUNCE;
292 sfrag.gravity = 0.15;
293 sfrag.solid = SOLID_CORPSE;
295 sfrag.draw = RaptorCBShellfragDraw;
297 sfrag.move_origin = sfrag.origin = _org;
298 sfrag.move_velocity = _vel;
299 sfrag.move_avelocity = prandomvec() * vlen(sfrag.move_velocity);
300 sfrag.angles = self.move_angles = _ang;
302 sfrag.move_time = time;
303 sfrag.damageforcescale = 4;
305 sfrag.nextthink = time + 3;
306 sfrag.cnt = time + 2;
308 sfrag.drawmask = MASK_NORMAL;