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 spider_h "gfx/vehicles/hud_bg.tga"
8 #define spider_b "gfx/vehicles/sbot.tga"
9 #define spider_r "gfx/vehicles/sbot_rpods.tga"
10 #define spider_g "gfx/vehicles/sbot_mguns.tga"
11 #define spider_s "gfx/vehicles/shiled.tga"
12 #define spider_a1 "gfx/vehicles/sb_rocket.tga"
13 #define spider_a2 "gfx/vehicles/sb_bullets.tga"
15 #define raptor_h "gfx/vehicles/hud_bg.tga"
16 #define raptor_s "gfx/vehicles/shiled.tga"
18 #define raptor_b "gfx/vehicles/raptor.tga"
19 #define raptor_g1 "gfx/vehicles/raptor_guns.tga"
20 #define raptor_g2 "gfx/vehicles/raptor_bombs.tga"
21 #define raptor_d "gfx/vehicles/dropcross.tga"
22 #define raptor_c "gfx/vehicles/raptor_cross.tga"
28 void CSQC_WAKIZASHI_HUD();
29 void CSQC_SPIDER_HUD();
30 void CSQC_RAPTOR_HUD();
32 entity AuxiliaryXhair;
33 void AuxiliaryXhair_Draw2D()
37 psize = 0.5 * drawgetimagesize(SPIDER_CROSS2);
38 loc = project_3d_to_2d(self.origin) - 0.5 * psize;
41 drawpic(loc, SPIDER_CROSS2, psize, '0 1 1', 1, DRAWFLAG_ADDITIVE);
45 void Ent_AuxiliaryXhair(float isNew)
51 AuxiliaryXhair = spawn();
52 AuxiliaryXhair.draw2d = AuxiliaryXhair_Draw2D;
53 setmodel(AuxiliaryXhair, "null");
54 setsize(AuxiliaryXhair, '0 0 -1', '0 0 -1');
57 AuxiliaryXhair.origin_x = ReadCoord();
58 AuxiliaryXhair.origin_y = ReadCoord();
59 AuxiliaryXhair.origin_z = ReadCoord();
60 AuxiliaryXhair.drawmask = MASK_NORMAL;
61 //AuxiliaryXhair.solid = SOLID_NOT;
64 void Vehicles_Precache()
66 //precache_model("models/ax_shell.mdl");
67 //precache_sound("weapons/brass1.wav");
71 void CSQC_SPIDER_HUD()
73 float rockets, reload, heat, hp, shield;
74 vector picsize, hudloc;
76 // Fetch health & ammo stats
77 hp = bound(0,getstatf(STAT_VEHICLESTAT_HEALTH), 1);
78 shield = bound(0,getstatf(STAT_VEHICLESTAT_SHIELD), 1);
79 heat = min(getstatf(STAT_VEHICLESTAT_RELOAD1), 2);
80 rockets = getstati(STAT_VEHICLESTAT_AMMO2);
81 reload = min(getstatf(STAT_VEHICLESTAT_RELOAD2), 1);
86 drawfill('130 28 0', ('115 0 0' * hp) + '0 10 0', hp * '0 1 0' + (1 - hp) * '1 0 0', 0.5, DRAWFLAG_NORMAL);
87 picsize = drawgetimagesize(spider_h) * 0.5;
88 drawpic(hudloc, spider_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
90 picsize = drawgetimagesize(spider_a2) * 0.5;
91 drawpic(hudloc + '120 96 0', spider_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
93 drawstring(hudloc + '145 19 0', strcat(ftos(rint(hp * 100)), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
94 drawstring(hudloc + '175 34 0', strcat(ftos(rint(shield * 100)), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
95 drawstring(hudloc + '136 102 0', strcat(ftos(100 - rint(heat * 100)), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
97 picsize = drawgetimagesize(spider_a1) * 0.85;
100 drawpic(hudloc + '132 54 0', spider_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
101 drawstring(hudloc + '179 69 0', strcat(ftos(rint(reload * 100)), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
105 drawpic(hudloc + '132 54 0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
106 drawstring(hudloc + '179 69 0', strcat(ftos(9 - rockets), "/8"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
109 picsize = drawgetimagesize(spider_b) * 0.5;
113 drawpic(hudloc, spider_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
114 drawpic(hudloc, spider_b, picsize, '0 1 0' * hp + '1 0 0' * (1 - hp), 1, DRAWFLAG_NORMAL);
115 drawpic(hudloc, spider_r, picsize, '1 1 1' * reload + '1 0 0' * (1 - reload), 1, DRAWFLAG_NORMAL);
116 drawpic(hudloc, spider_g, picsize, '1 1 1' * (1 - heat) + '1 0 0' * heat, 1, DRAWFLAG_NORMAL);
119 if (scoreboard_showscores)
121 HUD_DrawScoreboard();
122 HUD_DrawCenterPrint();
129 movedt = time - self.move_time;
130 self.move_time = time;
131 vel = (view_origin - lastpos) * (1 / movedt);
132 lastpos = view_origin;
133 dprint("vel: ", ftos(vel), " angles: ", vtos(self.angles), "\n");
137 dprint("aim1: ", vtos(aim1), " aim2: ", vtos(aim2), "\n");
140 te_lightning1(self, view_origin, view_origin + v_forward * MAX_SHOT_DISTANCE);
141 traceline(view_origin, view_origin + v_forward * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, self);
145 aim1 = aim1 + view_origin;
147 // Draw the crosshairs
148 aim1 = project_3d_to_2d(aim1);
149 aim2 = project_3d_to_2d(aim2);
151 picsize = 0.5 * drawgetimagesize(SPIDER_CROSS2);
152 aim2 = aim2 - 0.5 * picsize;
155 drawpic(aim2, SPIDER_CROSS2, picsize, '0 1 1', 1, DRAWFLAG_ADDITIVE);
157 picsize = 0.5 * drawgetimagesize(SPIDER_CROSS2);
158 aim1 = aim1 - 0.5 * picsize;
161 drawpic(aim1, SPIDER_CROSS2, picsize, '1 0 0', 1, DRAWFLAG_ADDITIVE);
164 picsize = drawgetimagesize(SPIDER_CROSS);
165 picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size;
166 picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size;
168 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);
175 void CSQC_RAPTOR_HUD()
177 if(autocvar_r_letterbox)
180 float reload, hp, shield, energy;
181 vector picsize, hudloc, vel;
188 dropmark.owner = self;
191 movedt = time - dropmark.move_time;
192 dropmark.move_time = time;
193 vel = (view_origin - lastpos) * (1 / movedt);
194 lastpos = view_origin;
196 // Fetch health & ammo stats
197 hp = bound(0,getstatf(STAT_VEHICLESTAT_HEALTH), 1);
198 shield = bound(0,getstatf(STAT_VEHICLESTAT_SHIELD), 1);
199 reload = min(getstatf(STAT_VEHICLESTAT_RELOAD1), 1);
200 energy = min(getstatf(STAT_VEHICLESTAT_ENERGY), 1);
202 // Draw the crosshairs
203 picsize = drawgetimagesize(raptor_c);
206 drawpic('0.5 0 0' * (vid_conwidth - picsize_x) + '0 0.5 0' * (vid_conheight - picsize_y), raptor_c, picsize, '1 0 0' + '0 1 1' * energy, 0.5, DRAWFLAG_ADDITIVE);
211 picsize = drawgetimagesize(raptor_h) * 0.5;
212 drawpic(hudloc, raptor_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
214 picsize = drawgetimagesize(spider_a2) * 0.5;
215 drawpic(hudloc + '120 96 0', spider_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
217 drawstring(hudloc + '145 19 0', strcat(ftos(rint(hp * 100)), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
218 drawstring(hudloc + '175 34 0', strcat(ftos(rint(shield * 100)), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
219 drawstring(hudloc + '136 102 0', strcat(ftos(rint(energy * 100)), "%"),'15 15 0','0.5 0.5 1', 1, DRAWFLAG_NORMAL);
222 picsize = drawgetimagesize(spider_a1) * 0.85;
225 drawpic(hudloc + '132 54 0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
226 drawstring(hudloc + '179 69 0', strcat(ftos(rint(reload * 100)), "%"),'14 14 0','0 1 0', 0.5, DRAWFLAG_NORMAL);
230 drawpic(hudloc + '132 54 0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
231 drawstring(hudloc + '179 69 0', strcat(ftos(rint(reload * 100)), "%"),'14 14 0','0 0 1', 1, DRAWFLAG_NORMAL);
234 picsize = drawgetimagesize(raptor_b) * 0.5;
238 drawpic(hudloc, raptor_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
239 drawpic(hudloc, raptor_b, picsize, '0 1 0' * hp + '1 0 0' * (1 - hp), 1, DRAWFLAG_NORMAL);
240 drawpic(hudloc, raptor_g1, picsize, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
241 drawpic(hudloc, raptor_g2, picsize, '1 1 1' * reload + '1 0 0' * (1 - reload), 1, DRAWFLAG_NORMAL);
245 where = dropmark.origin;
246 setorigin(dropmark, view_origin);
247 dropmark.velocity = vel;
248 tracetoss(dropmark, self);
250 // Blend old with new predicted impact to smooth out jumpyness
251 where = project_3d_to_2d(trace_endpos * 0.2 + where * 0.8);
253 setorigin(dropmark, trace_endpos);
254 picsize = drawgetimagesize(raptor_d) * 0.2;
256 if not (where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)
258 where_x -= picsize_x * 0.5;
259 where_y -= picsize_y * 0.5;
261 drawpic(where, raptor_d, picsize, '0 2 0', 1, DRAWFLAG_ADDITIVE);
263 dropmark.cnt = time + 2;
267 if(dropmark.cnt > time)
269 where = project_3d_to_2d(dropmark.origin);
270 picsize = drawgetimagesize(raptor_d) * 0.25;
272 if not (where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)
274 where_x -= picsize_x * 0.5;
275 where_y -= picsize_y * 0.5;
277 drawpic(where, raptor_d, picsize, '2 0 0', 1, DRAWFLAG_ADDITIVE);
282 if (scoreboard_showscores)
284 HUD_DrawScoreboard();
285 HUD_DrawCenterPrint();
290 #define waki_h "gfx/vehicles/hud_bg.tga"
291 #define waki_b "gfx/vehicles/waki.tga"
292 #define waki_e "gfx/vehicles/waki_e.tga"
293 #define waki_g "gfx/vehicles/waki_guns.tga"
294 #define waki_r "gfx/vehicles/waki_rockets.tga"
295 #define waki_s "gfx/vehicles/shiled.tga"
297 #define waki_a1 "gfx/vehicles/sb_rocket.tga"
298 #define waki_a2 "gfx/vehicles/sb_cells.tga"
300 void CSQC_WAKIZASHI_HUD()
302 // 0--1 floats. 1 = 100%, 0.6 = 50%.
303 float health, shield, energy, rockets;
304 vector picsize, hudloc;
306 picsize = drawgetimagesize(SPIDER_CROSS);
307 picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size;
308 picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size;
309 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);
312 const float STAT_VEHICLESTAT_HEALTH = 60;
313 const float STAT_VEHICLESTAT_SHIELD = 61;
314 const float STAT_VEHICLESTAT_ENERGY = 62;
315 const float STAT_VEHICLESTAT_AMMO1 = 63;
316 const float STAT_VEHICLESTAT_RELAOD1 = 64;
317 const float STAT_VEHICLESTAT_AMMO2 = 65;
318 const float STAT_VEHICLESTAT_RELOAD2 = 66;
320 health = min(getstatf(STAT_VEHICLESTAT_HEALTH), 1);
321 shield = min(getstatf(STAT_VEHICLESTAT_SHIELD), 1);
322 energy = min(getstatf(STAT_VEHICLESTAT_ENERGY), 1);
323 rockets = bound(0,getstatf(STAT_VEHICLESTAT_RELOAD1), 1);
328 picsize = drawgetimagesize(waki_h) * 0.5;
329 drawpic(hudloc, waki_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
331 picsize = drawgetimagesize(waki_a2) * 0.7;
332 drawpic(hudloc + '116 92 0', waki_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
335 drawstring(hudloc + '145 19 0', strcat(ftos(rint(health * 100)), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
336 drawstring(hudloc + '175 34 0', strcat(ftos(rint(shield * 100)), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
338 drawstring(hudloc + '136 102 0', strcat(ftos(rint(energy * 100)), "%"),'14 14 0','1 1 1', 1, DRAWFLAG_NORMAL);
340 picsize = drawgetimagesize(waki_a1) * 0.75;
343 drawpic(hudloc + '140 55 0', waki_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
344 drawpic(hudloc + '144 59 0', waki_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
348 drawpic(hudloc + '140 55 0', waki_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
349 drawpic(hudloc + '144 59 0', waki_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
350 drawstring(hudloc + '165 69 0', strcat(ftos(rint(rockets * 100)), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
353 picsize = drawgetimagesize(waki_b) * 0.5;
357 drawpic(hudloc, waki_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
358 drawpic(hudloc, waki_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
359 drawpic(hudloc, waki_r, picsize, '1 1 1' * rockets + '1 0 0' * (1 - rockets), 1, DRAWFLAG_NORMAL);
360 drawpic(hudloc, waki_e, picsize, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
365 p = '0.5 0 0' * (vid_conwidth - (rkt_size * 8));
366 p = p + '0 1 0' * vid_conheight - '0 32 0';
370 drawfill(p, '256 0 0' * health + '0 8 0' , '0 0.7 0', 0.75, DRAWFLAG_NORMAL);
372 drawfill(p, '256 0 0' * (1 - health) + '0 8 0' , '0 0 0', 0.75, DRAWFLAG_NORMAL);
377 drawfill(p, '256 0 0' * shield + '0 4 0' , '0.25 0.25 1', 0.5, DRAWFLAG_NORMAL);
380 //p_x -= 256 * health;
382 drawfill(p, '256 0 0' * energy + '0 4 0' , '1 1 1', 0.75, DRAWFLAG_NORMAL);
386 drawfill(p, '256 0 0' * rockets + '0 4 0' , '1 0 0', 0.75, DRAWFLAG_NORMAL);
392 if (scoreboard_showscores)
394 HUD_DrawScoreboard();
395 HUD_DrawCenterPrint();