1 #define spider_rocket_icon "gfx/vehicles/rocket_ico.tga"
2 #define spider_rocket_targ "gfx/vehicles/target.tga"
3 //#define SPIDER_CROSS "textures/spiderbot/cross.tga"
4 #define SPIDER_CROSS "gfx/vehicles/sbot-xhair.tga"
5 #define SPIDER_CROSS2 "gfx/vehicles/sbot-xhair2.tga"
7 #define axh1 "gfx/vehicles/sbot-xhair2.tga"
8 #define axh2 "gfx/vehicles/sbot-xhair2.tga"
9 #define axh3 "gfx/vehicles/sbot-xhair2.tga"
11 #define spider_h "gfx/vehicles/hud_bg.tga"
12 #define spider_b "gfx/vehicles/sbot.tga"
13 #define spider_r "gfx/vehicles/sbot_rpods.tga"
14 #define spider_g "gfx/vehicles/sbot_mguns.tga"
15 #define spider_s "gfx/vehicles/shiled.tga"
16 #define spider_a1 "gfx/vehicles/sb_rocket.tga"
17 #define spider_a2 "gfx/vehicles/sb_bullets.tga"
19 #define raptor_h "gfx/vehicles/hud_bg.tga"
20 #define raptor_s "gfx/vehicles/shiled.tga"
22 #define raptor_b "gfx/vehicles/raptor.tga"
23 #define raptor_g1 "gfx/vehicles/raptor_guns.tga"
24 #define raptor_g2 "gfx/vehicles/raptor_bombs.tga"
25 #define raptor_d "gfx/vehicles/dropcross.tga"
26 #define raptor_c "gfx/vehicles/raptor_cross.tga"
32 void CSQC_WAKIZASHI_HUD();
33 void CSQC_SPIDER_HUD();
34 void CSQC_RAPTOR_HUD();
37 entity AuxiliaryXhair[MAX_AXH];
38 const var void Draw_Not();
45 void AuxiliaryXhair_Draw2D()
49 psize = self.axh_scale * drawgetimagesize(self.axh_image);
50 loc = project_3d_to_2d(self.origin) - 0.5 * psize;
51 if not (loc_z < 0 || loc_x < 0 || loc_y < 0 || loc_x > vid_conwidth || loc_y > vid_conheight)
55 drawpic(loc, self.axh_image, psize, self.colormod, self.alpha, self.axh_drawflag);
58 if(time - self.cnt > self.axh_fadetime)
59 self.draw2d = Draw_Not;
68 axh_id = bound(0, ReadByte(), MAX_AXH);
69 axh = AuxiliaryXhair[axh_id];
71 if(axh == world || wasfreed(axh)) // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
74 axh.draw2d = Draw_Not;
75 axh.drawmask = MASK_NORMAL;
76 axh.axh_drawflag = DRAWFLAG_ADDITIVE;
77 axh.axh_fadetime = 0.1;
78 axh.axh_image = "gfx/vehicles/axh-ring.tga";
81 AuxiliaryXhair[axh_id] = axh;
84 axh.draw2d = AuxiliaryXhair_Draw2D;
86 axh.origin_x = ReadCoord();
87 axh.origin_y = ReadCoord();
88 axh.origin_z = ReadCoord();
90 axh.colormod_x = ReadByte() / 255;
91 axh.colormod_y = ReadByte() / 255;
92 axh.colormod_z = ReadByte() / 255;
95 void Net_AuXair2(float blah)
99 void Net_VehicleSetup()
103 hud_id = bound(HUD_SPIDERBOT, ReadByte(), HUD_RAPTOR);
105 // 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 = Draw_Not;
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[i] = axh;
126 for(i = 0; i < MAX_AXH; ++i)
128 if(AuxiliaryXhair[i] != world && !wasfreed(AuxiliaryXhair[i]))
129 remove(AuxiliaryXhair[i]);
131 AuxiliaryXhair[i] = spawn();
132 AuxiliaryXhair[i].draw2d = Draw_Not;
133 AuxiliaryXhair[i].drawmask = MASK_NORMAL;
134 AuxiliaryXhair[i].axh_drawflag = DRAWFLAG_ADDITIVE;
135 AuxiliaryXhair[i].axh_fadetime = 0.1;
136 AuxiliaryXhair[i].axh_image = "gfx/vehicles/axh-ring.tga";
137 AuxiliaryXhair[i].axh_scale = 1;
138 AuxiliaryXhair[i].alpha = 1;
146 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-ring.tga";
147 AuxiliaryXhair[0].axh_scale = 0.25;
149 AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-ring.tga";
150 AuxiliaryXhair[1].axh_scale = 0.25;
152 AuxiliaryXhair[2].axh_image = "gfx/vehicles/axh-special1.tga";
153 AuxiliaryXhair[2].axh_scale = 0.5;
156 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-bracket.tga";
157 AuxiliaryXhair[0].axh_scale = 0.5;
160 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-cross.tga";
161 AuxiliaryXhair[0].axh_scale = 0.5;
162 AuxiliaryXhair[1].alpha = 0.25;
163 AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-ring.tga";
164 AuxiliaryXhair[1].axh_scale = 0.5;
165 AuxiliaryXhair[1].alpha = 0.5;
170 void Vehicles_Precache()
172 //precache_model("models/ax_shell.mdl");
173 //precache_sound("weapons/brass1.wav");
177 void CSQC_SPIDER_HUD()
179 float rockets, reload, heat, hp, shield;
180 vector picsize, hudloc;
182 // Fetch health & ammo stats
183 hp = bound(0,getstatf(STAT_VEHICLESTAT_HEALTH), 1);
184 shield = bound(0,getstatf(STAT_VEHICLESTAT_SHIELD), 1);
185 heat = min(getstatf(STAT_VEHICLESTAT_RELOAD1), 2);
186 rockets = getstati(STAT_VEHICLESTAT_AMMO2);
187 reload = min(getstatf(STAT_VEHICLESTAT_RELOAD2), 1);
192 drawfill('130 28 0', ('115 0 0' * hp) + '0 10 0', hp * '0 1 0' + (1 - hp) * '1 0 0', 0.5, DRAWFLAG_NORMAL);
193 picsize = drawgetimagesize(spider_h) * 0.5;
194 drawpic(hudloc, spider_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
196 picsize = drawgetimagesize(spider_a2) * 0.5;
197 drawpic(hudloc + '120 96 0', spider_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
199 drawstring(hudloc + '145 19 0', strcat(ftos(rint(hp * 100)), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
200 drawstring(hudloc + '175 34 0', strcat(ftos(rint(shield * 100)), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
201 drawstring(hudloc + '136 102 0', strcat(ftos(100 - rint(heat * 100)), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
203 picsize = drawgetimagesize(spider_a1) * 0.85;
206 drawpic(hudloc + '132 54 0', spider_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
207 drawstring(hudloc + '179 69 0', strcat(ftos(rint(reload * 100)), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
211 drawpic(hudloc + '132 54 0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
212 drawstring(hudloc + '179 69 0', strcat(ftos(9 - rockets), "/8"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
215 picsize = drawgetimagesize(spider_b) * 0.5;
219 drawpic(hudloc, spider_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
220 drawpic(hudloc, spider_b, picsize, '0 1 0' * hp + '1 0 0' * (1 - hp), 1, DRAWFLAG_NORMAL);
221 drawpic(hudloc, spider_r, picsize, '1 1 1' * reload + '1 0 0' * (1 - reload), 1, DRAWFLAG_NORMAL);
222 drawpic(hudloc, spider_g, picsize, '1 1 1' * (1 - heat) + '1 0 0' * heat, 1, DRAWFLAG_NORMAL);
225 if (scoreboard_showscores)
227 HUD_DrawScoreboard();
228 HUD_DrawCenterPrint();
235 movedt = time - self.move_time;
236 self.move_time = time;
237 vel = (view_origin - lastpos) * (1 / movedt);
238 lastpos = view_origin;
239 dprint("vel: ", ftos(vel), " angles: ", vtos(self.angles), "\n");
243 dprint("aim1: ", vtos(aim1), " aim2: ", vtos(aim2), "\n");
246 te_lightning1(self, view_origin, view_origin + v_forward * MAX_SHOT_DISTANCE);
247 traceline(view_origin, view_origin + v_forward * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, self);
251 aim1 = aim1 + view_origin;
253 // Draw the crosshairs
254 aim1 = project_3d_to_2d(aim1);
255 aim2 = project_3d_to_2d(aim2);
257 picsize = 0.5 * drawgetimagesize(SPIDER_CROSS2);
258 aim2 = aim2 - 0.5 * picsize;
261 drawpic(aim2, SPIDER_CROSS2, picsize, '0 1 1', 1, DRAWFLAG_ADDITIVE);
263 picsize = 0.5 * drawgetimagesize(SPIDER_CROSS2);
264 aim1 = aim1 - 0.5 * picsize;
267 drawpic(aim1, SPIDER_CROSS2, picsize, '1 0 0', 1, DRAWFLAG_ADDITIVE);
270 picsize = drawgetimagesize(SPIDER_CROSS);
271 picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size;
272 picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size;
274 drawpic('0.5 0 0' * (vid_conwidth - picsize_x) + '0 0.5 0' * (vid_conheight - picsize_y), SPIDER_CROSS, picsize, '1 1 1', autocvar_cl_vehicle_spiderbot_cross_alpha, DRAWFLAG_ADDITIVE);
279 void CSQC_RAPTOR_HUD()
281 if(autocvar_r_letterbox)
284 float reload, hp, shield, energy;
285 vector picsize, hudloc, vel;
293 dropmark.owner = self;
296 movedt = time - dropmark.move_time;
299 dropmark.move_time = time;
300 vel = (view_origin - lastpos) * (1 / movedt);
301 lastpos = view_origin;
304 // Fetch health & ammo stats
305 hp = bound(0,getstatf(STAT_VEHICLESTAT_HEALTH), 1);
306 shield = bound(0,getstatf(STAT_VEHICLESTAT_SHIELD), 1);
307 reload = min(getstatf(STAT_VEHICLESTAT_RELOAD1), 1);
308 energy = min(getstatf(STAT_VEHICLESTAT_ENERGY), 1);
310 // Draw the crosshairs
311 picsize = drawgetimagesize("gfx/vehicles/axh-cross.tga");
314 drawpic('0.5 0 0' * (vid_conwidth - picsize_x) + '0 0.5 0' * (vid_conheight - picsize_y), "gfx/vehicles/axh-cross.tga", picsize, '1 0 0' + '0 1 1' * energy, 0.5, DRAWFLAG_ADDITIVE);
319 picsize = drawgetimagesize(raptor_h) * 0.5;
320 drawpic(hudloc, raptor_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
322 picsize = drawgetimagesize(spider_a2) * 0.5;
323 drawpic(hudloc + '120 96 0', spider_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
325 drawstring(hudloc + '145 19 0', strcat(ftos(rint(hp * 100)), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
326 drawstring(hudloc + '175 34 0', strcat(ftos(rint(shield * 100)), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
327 drawstring(hudloc + '136 102 0', strcat(ftos(rint(energy * 100)), "%"),'15 15 0','0.5 0.5 1', 1, DRAWFLAG_NORMAL);
330 picsize = drawgetimagesize(spider_a1) * 0.85;
333 drawpic(hudloc + '132 54 0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
334 drawstring(hudloc + '179 69 0', strcat(ftos(rint(reload * 100)), "%"),'14 14 0','0 1 0', 0.5, DRAWFLAG_NORMAL);
338 drawpic(hudloc + '132 54 0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
339 drawstring(hudloc + '179 69 0', strcat(ftos(rint(reload * 100)), "%"),'14 14 0','0 0 1', 1, DRAWFLAG_NORMAL);
342 picsize = drawgetimagesize(raptor_b) * 0.5;
346 drawpic(hudloc, raptor_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
347 drawpic(hudloc, raptor_b, picsize, '0 1 0' * hp + '1 0 0' * (1 - hp), 1, DRAWFLAG_NORMAL);
348 drawpic(hudloc, raptor_g1, picsize, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
349 drawpic(hudloc, raptor_g2, picsize, '1 1 1' * reload + '1 0 0' * (1 - reload), 1, DRAWFLAG_NORMAL);
353 where = dropmark.origin;
354 setorigin(dropmark, view_origin);
355 dropmark.velocity = vel;
356 tracetoss(dropmark, self);
358 // Blend old with new predicted impact to smooth out jumpyness
359 where = project_3d_to_2d(trace_endpos * 0.5 + where * 0.5);
361 setorigin(dropmark, trace_endpos);
362 picsize = drawgetimagesize(raptor_d) * 0.2;
364 if not (where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)
366 where_x -= picsize_x * 0.5;
367 where_y -= picsize_y * 0.5;
369 drawpic(where, raptor_d, picsize, '0 2 0', 1, DRAWFLAG_ADDITIVE);
371 dropmark.cnt = time + 5;
375 if(dropmark.cnt > time)
377 where = project_3d_to_2d(dropmark.origin);
378 picsize = drawgetimagesize(raptor_d) * 0.25;
380 if not (where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)
382 where_x -= picsize_x * 0.5;
383 where_y -= picsize_y * 0.5;
385 drawpic(where, raptor_d, picsize, '2 0 0', 1, DRAWFLAG_ADDITIVE);
390 if (scoreboard_showscores)
392 HUD_DrawScoreboard();
393 HUD_DrawCenterPrint();
398 #define waki_h "gfx/vehicles/hud_bg.tga"
399 #define waki_b "gfx/vehicles/waki.tga"
400 #define waki_e "gfx/vehicles/waki_e.tga"
401 #define waki_g "gfx/vehicles/waki_guns.tga"
402 #define waki_r "gfx/vehicles/waki_rockets.tga"
403 #define waki_s "gfx/vehicles/shiled.tga"
405 #define waki_a1 "gfx/vehicles/sb_rocket.tga"
406 #define waki_a2 "gfx/vehicles/sb_cells.tga"
408 void CSQC_WAKIZASHI_HUD()
410 // 0--1 floats. 1 = 100%, 0.6 = 50%.
411 float health, shield, energy, rockets;
412 vector picsize, hudloc;
414 picsize = drawgetimagesize(SPIDER_CROSS);
415 picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size;
416 picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size;
417 drawpic('0.5 0 0' * (vid_conwidth - picsize_x) + '0 0.5 0' * (vid_conheight - picsize_y), SPIDER_CROSS, picsize, '1 1 1', autocvar_cl_vehicle_spiderbot_cross_alpha, DRAWFLAG_NORMAL);
420 const float STAT_VEHICLESTAT_HEALTH = 60;
421 const float STAT_VEHICLESTAT_SHIELD = 61;
422 const float STAT_VEHICLESTAT_ENERGY = 62;
423 const float STAT_VEHICLESTAT_AMMO1 = 63;
424 const float STAT_VEHICLESTAT_RELAOD1 = 64;
425 const float STAT_VEHICLESTAT_AMMO2 = 65;
426 const float STAT_VEHICLESTAT_RELOAD2 = 66;
428 health = min(getstatf(STAT_VEHICLESTAT_HEALTH), 1);
429 shield = min(getstatf(STAT_VEHICLESTAT_SHIELD), 1);
430 energy = min(getstatf(STAT_VEHICLESTAT_ENERGY), 1);
431 rockets = bound(0,getstatf(STAT_VEHICLESTAT_RELOAD1), 1);
436 picsize = drawgetimagesize(waki_h) * 0.5;
437 drawpic(hudloc, waki_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
439 picsize = drawgetimagesize(waki_a2) * 0.7;
440 drawpic(hudloc + '116 92 0', waki_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
443 drawstring(hudloc + '145 19 0', strcat(ftos(rint(health * 100)), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
444 drawstring(hudloc + '175 34 0', strcat(ftos(rint(shield * 100)), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
446 drawstring(hudloc + '136 102 0', strcat(ftos(rint(energy * 100)), "%"),'14 14 0','1 1 1', 1, DRAWFLAG_NORMAL);
448 picsize = drawgetimagesize(waki_a1) * 0.75;
451 drawpic(hudloc + '140 55 0', waki_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
452 drawpic(hudloc + '144 59 0', waki_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
456 drawpic(hudloc + '140 55 0', waki_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
457 drawpic(hudloc + '144 59 0', waki_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
458 drawstring(hudloc + '165 69 0', strcat(ftos(rint(rockets * 100)), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
461 picsize = drawgetimagesize(waki_b) * 0.5;
465 drawpic(hudloc, waki_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
466 drawpic(hudloc, waki_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
467 drawpic(hudloc, waki_r, picsize, '1 1 1' * rockets + '1 0 0' * (1 - rockets), 1, DRAWFLAG_NORMAL);
468 drawpic(hudloc, waki_e, picsize, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
473 p = '0.5 0 0' * (vid_conwidth - (rkt_size * 8));
474 p = p + '0 1 0' * vid_conheight - '0 32 0';
478 drawfill(p, '256 0 0' * health + '0 8 0' , '0 0.7 0', 0.75, DRAWFLAG_NORMAL);
480 drawfill(p, '256 0 0' * (1 - health) + '0 8 0' , '0 0 0', 0.75, DRAWFLAG_NORMAL);
485 drawfill(p, '256 0 0' * shield + '0 4 0' , '0.25 0.25 1', 0.5, DRAWFLAG_NORMAL);
488 //p_x -= 256 * health;
490 drawfill(p, '256 0 0' * energy + '0 4 0' , '1 1 1', 0.75, DRAWFLAG_NORMAL);
494 drawfill(p, '256 0 0' * rockets + '0 4 0' , '1 0 0', 0.75, DRAWFLAG_NORMAL);
500 if (scoreboard_showscores)
502 HUD_DrawScoreboard();
503 HUD_DrawCenterPrint();