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"
30 void CSQC_WAKIZASHI_HUD();
31 void CSQC_SPIDER_HUD();
32 void CSQC_RAPTOR_HUD();
35 entity AuxiliaryXhair[MAX_AXH];
36 const var void Draw_Not();
43 void AuxiliaryXhair_Draw2D()
47 psize = self.axh_scale * drawgetimagesize(self.axh_image);
48 loc = project_3d_to_2d(self.origin) - 0.5 * psize;
49 if not (loc_z < 0 || loc_x < 0 || loc_y < 0 || loc_x > vid_conwidth || loc_y > vid_conheight)
53 drawpic(loc, self.axh_image, psize, self.colormod, self.alpha, self.axh_drawflag);
56 if(time - self.cnt > self.axh_fadetime)
57 self.draw2d = Draw_Not;
66 axh_id = bound(0, ReadByte(), MAX_AXH);
67 axh = AuxiliaryXhair[axh_id];
69 if(axh == world || wasfreed(axh)) // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
72 axh.draw2d = Draw_Not;
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.draw2d = AuxiliaryXhair_Draw2D;
84 axh.origin_x = ReadCoord();
85 axh.origin_y = ReadCoord();
86 axh.origin_z = ReadCoord();
88 axh.colormod_x = ReadByte() / 255;
89 axh.colormod_y = ReadByte() / 255;
90 axh.colormod_z = ReadByte() / 255;
93 void Net_AuXair2(float blah)
97 void Net_VehicleSetup()
101 hud_id = bound(HUD_SPIDERBOT, ReadByte(), HUD_RAPTOR);
103 // Init auxiliary crosshairs
106 for(i = 0; i < MAX_AXH; ++i)
108 axh = AuxiliaryXhair[i];
109 if(axh != world && !wasfreed(axh)) // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
113 axh.draw2d = Draw_Not;
114 axh.drawmask = MASK_NORMAL;
115 axh.axh_drawflag = DRAWFLAG_ADDITIVE;
116 axh.axh_fadetime = 0.1;
117 axh.axh_image = "gfx/vehicles/axh-ring.tga";
120 AuxiliaryXhair[i] = axh;
124 for(i = 0; i < MAX_AXH; ++i)
126 if(AuxiliaryXhair[i] != world && !wasfreed(AuxiliaryXhair[i]))
127 remove(AuxiliaryXhair[i]);
129 AuxiliaryXhair[i] = spawn();
130 AuxiliaryXhair[i].draw2d = Draw_Not;
131 AuxiliaryXhair[i].drawmask = MASK_NORMAL;
132 AuxiliaryXhair[i].axh_drawflag = DRAWFLAG_ADDITIVE;
133 AuxiliaryXhair[i].axh_fadetime = 0.1;
134 AuxiliaryXhair[i].axh_image = "gfx/vehicles/axh-ring.tga";
135 AuxiliaryXhair[i].axh_scale = 1;
136 AuxiliaryXhair[i].alpha = 1;
144 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-ring.tga";
145 AuxiliaryXhair[0].axh_scale = 0.25;
147 AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-ring.tga";
148 AuxiliaryXhair[1].axh_scale = 0.25;
150 AuxiliaryXhair[2].axh_image = "gfx/vehicles/axh-special1.tga";
151 AuxiliaryXhair[2].axh_scale = 0.5;
154 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-bracket.tga";
155 AuxiliaryXhair[0].axh_scale = 0.5;
158 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-cross.tga";
159 AuxiliaryXhair[0].axh_scale = 0.5;
160 AuxiliaryXhair[1].alpha = 0.25;
161 AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-ring.tga";
162 AuxiliaryXhair[1].axh_scale = 0.5;
163 AuxiliaryXhair[1].alpha = 0.5;
168 void Vehicles_Precache()
170 //precache_model("models/ax_shell.mdl");
171 //precache_sound("weapons/brass1.wav");
175 void CSQC_SPIDER_HUD()
177 float rockets, reload, heat, hp, shield;
178 vector picsize, hudloc;
180 // Fetch health & ammo stats
181 hp = bound(0,getstatf(STAT_VEHICLESTAT_HEALTH), 1);
182 shield = bound(0,getstatf(STAT_VEHICLESTAT_SHIELD), 1);
183 heat = min(getstatf(STAT_VEHICLESTAT_RELOAD1), 2);
184 rockets = getstati(STAT_VEHICLESTAT_AMMO2);
185 reload = min(getstatf(STAT_VEHICLESTAT_RELOAD2), 1);
190 drawfill('130 28 0', ('115 0 0' * hp) + '0 10 0', hp * '0 1 0' + (1 - hp) * '1 0 0', 0.5, DRAWFLAG_NORMAL);
191 picsize = drawgetimagesize(spider_h) * 0.5;
192 drawpic(hudloc, spider_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
194 picsize = drawgetimagesize(spider_a2) * 0.5;
195 drawpic(hudloc + '120 96 0', spider_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
197 drawstring(hudloc + '145 19 0', strcat(ftos(rint(hp * 100)), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
198 drawstring(hudloc + '175 34 0', strcat(ftos(rint(shield * 100)), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
199 drawstring(hudloc + '136 102 0', strcat(ftos(100 - rint(heat * 100)), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
201 picsize = drawgetimagesize(spider_a1) * 0.85;
204 drawpic(hudloc + '132 54 0', spider_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
205 drawstring(hudloc + '179 69 0', strcat(ftos(rint(reload * 100)), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
209 drawpic(hudloc + '132 54 0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
210 drawstring(hudloc + '179 69 0', strcat(ftos(9 - rockets), "/8"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
213 picsize = drawgetimagesize(spider_b) * 0.5;
217 drawpic(hudloc, spider_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
218 drawpic(hudloc, spider_b, picsize, '0 1 0' * hp + '1 0 0' * (1 - hp), 1, DRAWFLAG_NORMAL);
219 drawpic(hudloc, spider_r, picsize, '1 1 1' * reload + '1 0 0' * (1 - reload), 1, DRAWFLAG_NORMAL);
220 drawpic(hudloc, spider_g, picsize, '1 1 1' * (1 - heat) + '1 0 0' * heat, 1, DRAWFLAG_NORMAL);
223 if (scoreboard_showscores)
225 HUD_DrawScoreboard();
226 HUD_DrawCenterPrint();
230 picsize = drawgetimagesize(SPIDER_CROSS);
231 picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size;
232 picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size;
234 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);
239 void CSQC_RAPTOR_HUD()
241 if(autocvar_r_letterbox)
244 float reload, hp, shield, energy;
245 vector picsize, hudloc, vel;
253 dropmark.owner = self;
256 // Fetch health & ammo stats
257 hp = bound(0,getstatf(STAT_VEHICLESTAT_HEALTH), 1);
258 shield = bound(0,getstatf(STAT_VEHICLESTAT_SHIELD), 1);
259 reload = min(getstatf(STAT_VEHICLESTAT_RELOAD1), 1);
260 energy = min(getstatf(STAT_VEHICLESTAT_ENERGY), 1);
262 // Draw the crosshairs
263 picsize = drawgetimagesize("gfx/vehicles/axh-cross.tga");
266 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);
271 picsize = drawgetimagesize(raptor_h) * 0.5;
272 drawpic(hudloc, raptor_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
274 picsize = drawgetimagesize(spider_a2) * 0.5;
275 drawpic(hudloc + '120 96 0', spider_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
277 drawstring(hudloc + '145 19 0', strcat(ftos(rint(hp * 100)), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
278 drawstring(hudloc + '175 34 0', strcat(ftos(rint(shield * 100)), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
279 drawstring(hudloc + '136 102 0', strcat(ftos(rint(energy * 100)), "%"),'15 15 0','0.5 0.5 1', 1, DRAWFLAG_NORMAL);
282 picsize = drawgetimagesize(spider_a1) * 0.85;
285 drawpic(hudloc + '132 54 0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
286 drawstring(hudloc + '179 69 0', strcat(ftos(rint(reload * 100)), "%"),'14 14 0','0 1 0', 0.5, DRAWFLAG_NORMAL);
290 drawpic(hudloc + '132 54 0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
291 drawstring(hudloc + '179 69 0', strcat(ftos(rint(reload * 100)), "%"),'14 14 0','0 0 1', 1, DRAWFLAG_NORMAL);
294 picsize = drawgetimagesize(raptor_b) * 0.5;
298 drawpic(hudloc, raptor_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
299 drawpic(hudloc, raptor_b, picsize, '0 1 0' * hp + '1 0 0' * (1 - hp), 1, DRAWFLAG_NORMAL);
300 drawpic(hudloc, raptor_g1, picsize, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
301 drawpic(hudloc, raptor_g2, picsize, '1 1 1' * reload + '1 0 0' * (1 - reload), 1, DRAWFLAG_NORMAL);
305 where = dropmark.origin;
306 setorigin(dropmark, pmove_org);
307 dropmark.velocity = pmove_vel;
308 tracetoss(dropmark, self);
310 where = project_3d_to_2d(trace_endpos);
312 setorigin(dropmark, trace_endpos);
313 picsize = drawgetimagesize(raptor_d) * 0.2;
315 if not (where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)
317 where_x -= picsize_x * 0.5;
318 where_y -= picsize_y * 0.5;
320 drawpic(where, raptor_d, picsize, '0 2 0', 1, DRAWFLAG_ADDITIVE);
322 dropmark.cnt = time + 5;
326 if(dropmark.cnt > time)
328 where = project_3d_to_2d(dropmark.origin);
329 picsize = drawgetimagesize(raptor_d) * 0.25;
331 if not (where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)
333 where_x -= picsize_x * 0.5;
334 where_y -= picsize_y * 0.5;
336 drawpic(where, raptor_d, picsize, '2 0 0', 1, DRAWFLAG_ADDITIVE);
341 if (scoreboard_showscores)
343 HUD_DrawScoreboard();
344 HUD_DrawCenterPrint();
349 #define waki_h "gfx/vehicles/hud_bg.tga"
350 #define waki_b "gfx/vehicles/waki.tga"
351 #define waki_e "gfx/vehicles/waki_e.tga"
352 #define waki_g "gfx/vehicles/waki_guns.tga"
353 #define waki_r "gfx/vehicles/waki_rockets.tga"
354 #define waki_s "gfx/vehicles/shiled.tga"
356 #define waki_a1 "gfx/vehicles/sb_rocket.tga"
357 #define waki_a2 "gfx/vehicles/sb_cells.tga"
359 void CSQC_WAKIZASHI_HUD()
361 // 0--1 floats. 1 = 100%, 0.6 = 50%.
362 float health, shield, energy, rockets;
363 vector picsize, hudloc;
365 picsize = drawgetimagesize(SPIDER_CROSS);
366 picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size;
367 picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size;
368 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);
371 const float STAT_VEHICLESTAT_HEALTH = 60;
372 const float STAT_VEHICLESTAT_SHIELD = 61;
373 const float STAT_VEHICLESTAT_ENERGY = 62;
374 const float STAT_VEHICLESTAT_AMMO1 = 63;
375 const float STAT_VEHICLESTAT_RELAOD1 = 64;
376 const float STAT_VEHICLESTAT_AMMO2 = 65;
377 const float STAT_VEHICLESTAT_RELOAD2 = 66;
379 health = min(getstatf(STAT_VEHICLESTAT_HEALTH), 1);
380 shield = min(getstatf(STAT_VEHICLESTAT_SHIELD), 1);
381 energy = min(getstatf(STAT_VEHICLESTAT_ENERGY), 1);
382 rockets = bound(0,getstatf(STAT_VEHICLESTAT_RELOAD1), 1);
387 picsize = drawgetimagesize(waki_h) * 0.5;
388 drawpic(hudloc, waki_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
390 picsize = drawgetimagesize(waki_a2) * 0.7;
391 drawpic(hudloc + '116 92 0', waki_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
394 drawstring(hudloc + '145 19 0', strcat(ftos(rint(health * 100)), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
395 drawstring(hudloc + '175 34 0', strcat(ftos(rint(shield * 100)), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
397 drawstring(hudloc + '136 102 0', strcat(ftos(rint(energy * 100)), "%"),'14 14 0','1 1 1', 1, DRAWFLAG_NORMAL);
399 picsize = drawgetimagesize(waki_a1) * 0.75;
402 drawpic(hudloc + '140 55 0', waki_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
403 drawpic(hudloc + '144 59 0', waki_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
407 drawpic(hudloc + '140 55 0', waki_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
408 drawpic(hudloc + '144 59 0', waki_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
409 drawstring(hudloc + '165 69 0', strcat(ftos(rint(rockets * 100)), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
412 picsize = drawgetimagesize(waki_b) * 0.5;
416 drawpic(hudloc, waki_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
417 drawpic(hudloc, waki_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
418 drawpic(hudloc, waki_r, picsize, '1 1 1' * rockets + '1 0 0' * (1 - rockets), 1, DRAWFLAG_NORMAL);
419 drawpic(hudloc, waki_e, picsize, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
424 p = '0.5 0 0' * (vid_conwidth - (rkt_size * 8));
425 p = p + '0 1 0' * vid_conheight - '0 32 0';
429 drawfill(p, '256 0 0' * health + '0 8 0' , '0 0.7 0', 0.75, DRAWFLAG_NORMAL);
431 drawfill(p, '256 0 0' * (1 - health) + '0 8 0' , '0 0 0', 0.75, DRAWFLAG_NORMAL);
436 drawfill(p, '256 0 0' * shield + '0 4 0' , '0.25 0.25 1', 0.5, DRAWFLAG_NORMAL);
439 //p_x -= 256 * health;
441 drawfill(p, '256 0 0' * energy + '0 4 0' , '1 1 1', 0.75, DRAWFLAG_NORMAL);
445 drawfill(p, '256 0 0' * rockets + '0 4 0' , '1 0 0', 0.75, DRAWFLAG_NORMAL);
451 if (scoreboard_showscores)
453 HUD_DrawScoreboard();
454 HUD_DrawCenterPrint();