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);
43 if(time - self.cnt > 0.1)
47 void Ent_AuxiliaryXhair(float isNew)
49 //entity AuxiliaryXhair;
54 remove(AuxiliaryXhair);
56 AuxiliaryXhair = spawn();
57 AuxiliaryXhair.draw2d = AuxiliaryXhair_Draw2D;
58 setmodel(AuxiliaryXhair, "null");
59 setsize(AuxiliaryXhair, '0 0 -1', '0 0 -1');
63 AuxiliaryXhair.origin_x = ReadCoord();
64 AuxiliaryXhair.origin_y = ReadCoord();
65 AuxiliaryXhair.origin_z = ReadCoord();
66 AuxiliaryXhair.drawmask = MASK_NORMAL;
68 AuxiliaryXhair.cnt = time;
69 //AuxiliaryXhair.solid = SOLID_NOT;
72 void Vehicles_Precache()
74 //precache_model("models/ax_shell.mdl");
75 //precache_sound("weapons/brass1.wav");
79 void CSQC_SPIDER_HUD()
81 float rockets, reload, heat, hp, shield;
82 vector picsize, hudloc;
84 // Fetch health & ammo stats
85 hp = bound(0,getstatf(STAT_VEHICLESTAT_HEALTH), 1);
86 shield = bound(0,getstatf(STAT_VEHICLESTAT_SHIELD), 1);
87 heat = min(getstatf(STAT_VEHICLESTAT_RELOAD1), 2);
88 rockets = getstati(STAT_VEHICLESTAT_AMMO2);
89 reload = min(getstatf(STAT_VEHICLESTAT_RELOAD2), 1);
94 drawfill('130 28 0', ('115 0 0' * hp) + '0 10 0', hp * '0 1 0' + (1 - hp) * '1 0 0', 0.5, DRAWFLAG_NORMAL);
95 picsize = drawgetimagesize(spider_h) * 0.5;
96 drawpic(hudloc, spider_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
98 picsize = drawgetimagesize(spider_a2) * 0.5;
99 drawpic(hudloc + '120 96 0', spider_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
101 drawstring(hudloc + '145 19 0', strcat(ftos(rint(hp * 100)), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
102 drawstring(hudloc + '175 34 0', strcat(ftos(rint(shield * 100)), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
103 drawstring(hudloc + '136 102 0', strcat(ftos(100 - rint(heat * 100)), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
105 picsize = drawgetimagesize(spider_a1) * 0.85;
108 drawpic(hudloc + '132 54 0', spider_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
109 drawstring(hudloc + '179 69 0', strcat(ftos(rint(reload * 100)), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
113 drawpic(hudloc + '132 54 0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
114 drawstring(hudloc + '179 69 0', strcat(ftos(9 - rockets), "/8"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
117 picsize = drawgetimagesize(spider_b) * 0.5;
121 drawpic(hudloc, spider_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
122 drawpic(hudloc, spider_b, picsize, '0 1 0' * hp + '1 0 0' * (1 - hp), 1, DRAWFLAG_NORMAL);
123 drawpic(hudloc, spider_r, picsize, '1 1 1' * reload + '1 0 0' * (1 - reload), 1, DRAWFLAG_NORMAL);
124 drawpic(hudloc, spider_g, picsize, '1 1 1' * (1 - heat) + '1 0 0' * heat, 1, DRAWFLAG_NORMAL);
127 if (scoreboard_showscores)
129 HUD_DrawScoreboard();
130 HUD_DrawCenterPrint();
137 movedt = time - self.move_time;
138 self.move_time = time;
139 vel = (view_origin - lastpos) * (1 / movedt);
140 lastpos = view_origin;
141 dprint("vel: ", ftos(vel), " angles: ", vtos(self.angles), "\n");
145 dprint("aim1: ", vtos(aim1), " aim2: ", vtos(aim2), "\n");
148 te_lightning1(self, view_origin, view_origin + v_forward * MAX_SHOT_DISTANCE);
149 traceline(view_origin, view_origin + v_forward * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, self);
153 aim1 = aim1 + view_origin;
155 // Draw the crosshairs
156 aim1 = project_3d_to_2d(aim1);
157 aim2 = project_3d_to_2d(aim2);
159 picsize = 0.5 * drawgetimagesize(SPIDER_CROSS2);
160 aim2 = aim2 - 0.5 * picsize;
163 drawpic(aim2, SPIDER_CROSS2, picsize, '0 1 1', 1, DRAWFLAG_ADDITIVE);
165 picsize = 0.5 * drawgetimagesize(SPIDER_CROSS2);
166 aim1 = aim1 - 0.5 * picsize;
169 drawpic(aim1, SPIDER_CROSS2, picsize, '1 0 0', 1, DRAWFLAG_ADDITIVE);
172 picsize = drawgetimagesize(SPIDER_CROSS);
173 picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size;
174 picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size;
176 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);
183 void CSQC_RAPTOR_HUD()
185 if(autocvar_r_letterbox)
188 float reload, hp, shield, energy;
189 vector picsize, hudloc, vel;
196 dropmark.owner = self;
199 movedt = time - dropmark.move_time;
200 dropmark.move_time = time;
201 vel = (view_origin - lastpos) * (1 / movedt);
202 lastpos = view_origin;
204 // Fetch health & ammo stats
205 hp = bound(0,getstatf(STAT_VEHICLESTAT_HEALTH), 1);
206 shield = bound(0,getstatf(STAT_VEHICLESTAT_SHIELD), 1);
207 reload = min(getstatf(STAT_VEHICLESTAT_RELOAD1), 1);
208 energy = min(getstatf(STAT_VEHICLESTAT_ENERGY), 1);
210 // Draw the crosshairs
211 picsize = drawgetimagesize(raptor_c);
214 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);
219 picsize = drawgetimagesize(raptor_h) * 0.5;
220 drawpic(hudloc, raptor_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
222 picsize = drawgetimagesize(spider_a2) * 0.5;
223 drawpic(hudloc + '120 96 0', spider_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
225 drawstring(hudloc + '145 19 0', strcat(ftos(rint(hp * 100)), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
226 drawstring(hudloc + '175 34 0', strcat(ftos(rint(shield * 100)), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
227 drawstring(hudloc + '136 102 0', strcat(ftos(rint(energy * 100)), "%"),'15 15 0','0.5 0.5 1', 1, DRAWFLAG_NORMAL);
230 picsize = drawgetimagesize(spider_a1) * 0.85;
233 drawpic(hudloc + '132 54 0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
234 drawstring(hudloc + '179 69 0', strcat(ftos(rint(reload * 100)), "%"),'14 14 0','0 1 0', 0.5, DRAWFLAG_NORMAL);
238 drawpic(hudloc + '132 54 0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
239 drawstring(hudloc + '179 69 0', strcat(ftos(rint(reload * 100)), "%"),'14 14 0','0 0 1', 1, DRAWFLAG_NORMAL);
242 picsize = drawgetimagesize(raptor_b) * 0.5;
246 drawpic(hudloc, raptor_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
247 drawpic(hudloc, raptor_b, picsize, '0 1 0' * hp + '1 0 0' * (1 - hp), 1, DRAWFLAG_NORMAL);
248 drawpic(hudloc, raptor_g1, picsize, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
249 drawpic(hudloc, raptor_g2, picsize, '1 1 1' * reload + '1 0 0' * (1 - reload), 1, DRAWFLAG_NORMAL);
253 where = dropmark.origin;
254 setorigin(dropmark, view_origin);
255 dropmark.velocity = vel;
256 tracetoss(dropmark, self);
258 // Blend old with new predicted impact to smooth out jumpyness
259 where = project_3d_to_2d(trace_endpos * 0.5 + where * 0.5);
261 setorigin(dropmark, trace_endpos);
262 picsize = drawgetimagesize(raptor_d) * 0.2;
264 if not (where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)
266 where_x -= picsize_x * 0.5;
267 where_y -= picsize_y * 0.5;
269 drawpic(where, raptor_d, picsize, '0 2 0', 1, DRAWFLAG_ADDITIVE);
271 dropmark.cnt = time + 2;
275 if(dropmark.cnt > time)
277 where = project_3d_to_2d(dropmark.origin);
278 picsize = drawgetimagesize(raptor_d) * 0.25;
280 if not (where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)
282 where_x -= picsize_x * 0.5;
283 where_y -= picsize_y * 0.5;
285 drawpic(where, raptor_d, picsize, '2 0 0', 1, DRAWFLAG_ADDITIVE);
290 if (scoreboard_showscores)
292 HUD_DrawScoreboard();
293 HUD_DrawCenterPrint();
298 #define waki_h "gfx/vehicles/hud_bg.tga"
299 #define waki_b "gfx/vehicles/waki.tga"
300 #define waki_e "gfx/vehicles/waki_e.tga"
301 #define waki_g "gfx/vehicles/waki_guns.tga"
302 #define waki_r "gfx/vehicles/waki_rockets.tga"
303 #define waki_s "gfx/vehicles/shiled.tga"
305 #define waki_a1 "gfx/vehicles/sb_rocket.tga"
306 #define waki_a2 "gfx/vehicles/sb_cells.tga"
308 void CSQC_WAKIZASHI_HUD()
310 // 0--1 floats. 1 = 100%, 0.6 = 50%.
311 float health, shield, energy, rockets;
312 vector picsize, hudloc;
314 picsize = drawgetimagesize(SPIDER_CROSS);
315 picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size;
316 picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size;
317 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);
320 const float STAT_VEHICLESTAT_HEALTH = 60;
321 const float STAT_VEHICLESTAT_SHIELD = 61;
322 const float STAT_VEHICLESTAT_ENERGY = 62;
323 const float STAT_VEHICLESTAT_AMMO1 = 63;
324 const float STAT_VEHICLESTAT_RELAOD1 = 64;
325 const float STAT_VEHICLESTAT_AMMO2 = 65;
326 const float STAT_VEHICLESTAT_RELOAD2 = 66;
328 health = min(getstatf(STAT_VEHICLESTAT_HEALTH), 1);
329 shield = min(getstatf(STAT_VEHICLESTAT_SHIELD), 1);
330 energy = min(getstatf(STAT_VEHICLESTAT_ENERGY), 1);
331 rockets = bound(0,getstatf(STAT_VEHICLESTAT_RELOAD1), 1);
336 picsize = drawgetimagesize(waki_h) * 0.5;
337 drawpic(hudloc, waki_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
339 picsize = drawgetimagesize(waki_a2) * 0.7;
340 drawpic(hudloc + '116 92 0', waki_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
343 drawstring(hudloc + '145 19 0', strcat(ftos(rint(health * 100)), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
344 drawstring(hudloc + '175 34 0', strcat(ftos(rint(shield * 100)), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
346 drawstring(hudloc + '136 102 0', strcat(ftos(rint(energy * 100)), "%"),'14 14 0','1 1 1', 1, DRAWFLAG_NORMAL);
348 picsize = drawgetimagesize(waki_a1) * 0.75;
351 drawpic(hudloc + '140 55 0', waki_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
352 drawpic(hudloc + '144 59 0', waki_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
356 drawpic(hudloc + '140 55 0', waki_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
357 drawpic(hudloc + '144 59 0', waki_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
358 drawstring(hudloc + '165 69 0', strcat(ftos(rint(rockets * 100)), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
361 picsize = drawgetimagesize(waki_b) * 0.5;
365 drawpic(hudloc, waki_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
366 drawpic(hudloc, waki_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
367 drawpic(hudloc, waki_r, picsize, '1 1 1' * rockets + '1 0 0' * (1 - rockets), 1, DRAWFLAG_NORMAL);
368 drawpic(hudloc, waki_e, picsize, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
373 p = '0.5 0 0' * (vid_conwidth - (rkt_size * 8));
374 p = p + '0 1 0' * vid_conheight - '0 32 0';
378 drawfill(p, '256 0 0' * health + '0 8 0' , '0 0.7 0', 0.75, DRAWFLAG_NORMAL);
380 drawfill(p, '256 0 0' * (1 - health) + '0 8 0' , '0 0 0', 0.75, DRAWFLAG_NORMAL);
385 drawfill(p, '256 0 0' * shield + '0 4 0' , '0.25 0.25 1', 0.5, DRAWFLAG_NORMAL);
388 //p_x -= 256 * health;
390 drawfill(p, '256 0 0' * energy + '0 4 0' , '1 1 1', 0.75, DRAWFLAG_NORMAL);
394 drawfill(p, '256 0 0' * rockets + '0 4 0' , '1 0 0', 0.75, DRAWFLAG_NORMAL);
400 if (scoreboard_showscores)
402 HUD_DrawScoreboard();
403 HUD_DrawCenterPrint();