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;
249 // Fetch health & ammo stats
250 hp = bound(0,getstatf(STAT_VEHICLESTAT_HEALTH), 1);
251 shield = bound(0,getstatf(STAT_VEHICLESTAT_SHIELD), 1);
252 reload = min(getstatf(STAT_VEHICLESTAT_RELOAD1), 1);
253 energy = min(getstatf(STAT_VEHICLESTAT_ENERGY), 1);
255 // Draw the crosshairs
256 picsize = drawgetimagesize("gfx/vehicles/axh-cross.tga");
259 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);
264 picsize = drawgetimagesize(raptor_h) * 0.5;
265 drawpic(hudloc, raptor_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
267 picsize = drawgetimagesize(spider_a2) * 0.5;
268 drawpic(hudloc + '120 96 0', spider_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
270 drawstring(hudloc + '145 19 0', strcat(ftos(rint(hp * 100)), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
271 drawstring(hudloc + '175 34 0', strcat(ftos(rint(shield * 100)), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
272 drawstring(hudloc + '136 102 0', strcat(ftos(rint(energy * 100)), "%"),'15 15 0','0.5 0.5 1', 1, DRAWFLAG_NORMAL);
275 picsize = drawgetimagesize(spider_a1) * 0.85;
278 drawpic(hudloc + '132 54 0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
279 drawstring(hudloc + '179 69 0', strcat(ftos(rint(reload * 100)), "%"),'14 14 0','0 1 0', 0.5, DRAWFLAG_NORMAL);
283 drawpic(hudloc + '132 54 0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
284 drawstring(hudloc + '179 69 0', strcat(ftos(rint(reload * 100)), "%"),'14 14 0','0 0 1', 1, DRAWFLAG_NORMAL);
287 picsize = drawgetimagesize(raptor_b) * 0.5;
291 drawpic(hudloc, raptor_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
292 drawpic(hudloc, raptor_b, picsize, '0 1 0' * hp + '1 0 0' * (1 - hp), 1, DRAWFLAG_NORMAL);
293 drawpic(hudloc, raptor_g1, picsize, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
294 drawpic(hudloc, raptor_g2, picsize, '1 1 1' * reload + '1 0 0' * (1 - reload), 1, DRAWFLAG_NORMAL);
299 dropmark.owner = self;
304 where = dropmark.origin;
305 setorigin(dropmark, pmove_org);
306 dropmark.velocity = pmove_vel;
307 tracetoss(dropmark, self);
309 where = project_3d_to_2d(trace_endpos);
311 setorigin(dropmark, trace_endpos);
312 picsize = drawgetimagesize(raptor_d) * 0.2;
314 if not (where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)
316 where_x -= picsize_x * 0.5;
317 where_y -= picsize_y * 0.5;
319 drawpic(where, raptor_d, picsize, '0 2 0', 1, DRAWFLAG_ADDITIVE);
321 dropmark.cnt = time + 5;
325 if(dropmark.cnt > time)
327 where = project_3d_to_2d(dropmark.origin);
328 picsize = drawgetimagesize(raptor_d) * 0.25;
330 if not (where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)
332 where_x -= picsize_x * 0.5;
333 where_y -= picsize_y * 0.5;
335 drawpic(where, raptor_d, picsize, '2 0 0', 1, DRAWFLAG_ADDITIVE);
340 if (scoreboard_showscores)
342 HUD_DrawScoreboard();
343 HUD_DrawCenterPrint();
348 #define waki_h "gfx/vehicles/hud_bg.tga"
349 #define waki_b "gfx/vehicles/waki.tga"
350 #define waki_e "gfx/vehicles/waki_e.tga"
351 #define waki_g "gfx/vehicles/waki_guns.tga"
352 #define waki_r "gfx/vehicles/waki_rockets.tga"
353 #define waki_s "gfx/vehicles/shiled.tga"
355 #define waki_a1 "gfx/vehicles/sb_rocket.tga"
356 #define waki_a2 "gfx/vehicles/sb_cells.tga"
358 void CSQC_WAKIZASHI_HUD()
360 // 0--1 floats. 1 = 100%, 0.6 = 50%.
361 float health, shield, energy, rockets;
362 vector picsize, hudloc;
364 picsize = drawgetimagesize(SPIDER_CROSS);
365 picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size;
366 picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size;
367 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);
369 health = min(getstatf(STAT_VEHICLESTAT_HEALTH), 1);
370 shield = min(getstatf(STAT_VEHICLESTAT_SHIELD), 1);
371 energy = min(getstatf(STAT_VEHICLESTAT_ENERGY), 1);
372 rockets = bound(0,getstatf(STAT_VEHICLESTAT_RELOAD1), 1);
377 picsize = drawgetimagesize(waki_h) * 0.5;
378 drawpic(hudloc, waki_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
380 picsize = drawgetimagesize(waki_a2) * 0.7;
381 drawpic(hudloc + '116 92 0', waki_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
384 drawstring(hudloc + '145 19 0', strcat(ftos(rint(health * 100)), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
385 drawstring(hudloc + '175 34 0', strcat(ftos(rint(shield * 100)), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
387 drawstring(hudloc + '136 102 0', strcat(ftos(rint(energy * 100)), "%"),'14 14 0','1 1 1', 1, DRAWFLAG_NORMAL);
389 picsize = drawgetimagesize(waki_a1) * 0.75;
392 drawpic(hudloc + '140 55 0', waki_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
393 drawpic(hudloc + '144 59 0', waki_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
397 drawpic(hudloc + '140 55 0', waki_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
398 drawpic(hudloc + '144 59 0', waki_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
399 drawstring(hudloc + '165 69 0', strcat(ftos(rint(rockets * 100)), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
402 picsize = drawgetimagesize(waki_b) * 0.5;
406 drawpic(hudloc, waki_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
407 drawpic(hudloc, waki_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
408 drawpic(hudloc, waki_r, picsize, '1 1 1' * rockets + '1 0 0' * (1 - rockets), 1, DRAWFLAG_NORMAL);
409 drawpic(hudloc, waki_e, picsize, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
411 if (scoreboard_showscores)
413 HUD_DrawScoreboard();
414 HUD_DrawCenterPrint();