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();
33 void CSQC_BUMBLE_HUD();
36 entity AuxiliaryXhair[MAX_AXH];
37 const var void Draw_Not();
44 void AuxiliaryXhair_Draw2D()
48 psize = self.axh_scale * drawgetimagesize(self.axh_image);
49 loc = project_3d_to_2d(self.origin) - 0.5 * psize;
50 if not (loc_z < 0 || loc_x < 0 || loc_y < 0 || loc_x > vid_conwidth || loc_y > vid_conheight)
54 drawpic(loc, self.axh_image, psize, self.colormod, self.alpha, self.axh_drawflag);
57 if(time - self.cnt > self.axh_fadetime)
58 self.draw2d = Draw_Not;
61 void Net_AuXair2(float bIsNew)
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;
94 void Net_VehicleSetup()
98 hud_id = bound(HUD_SPIDERBOT, ReadByte(), HUD_RAPTOR);
100 // Init auxiliary crosshairs
102 for(i = 0; i < MAX_AXH; ++i)
104 axh = AuxiliaryXhair[i];
105 if(axh != world && !wasfreed(axh)) // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
109 axh.draw2d = Draw_Not;
110 axh.drawmask = MASK_NORMAL;
111 axh.axh_drawflag = DRAWFLAG_ADDITIVE;
112 axh.axh_fadetime = 0.1;
113 axh.axh_image = "gfx/vehicles/axh-ring.tga";
116 AuxiliaryXhair[i] = axh;
123 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-ring.tga";
124 AuxiliaryXhair[0].axh_scale = 0.25;
126 AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-ring.tga";
127 AuxiliaryXhair[1].axh_scale = 0.25;
129 AuxiliaryXhair[2].axh_image = "gfx/vehicles/axh-special1.tga";
130 AuxiliaryXhair[2].axh_scale = 0.5;
133 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-bracket.tga";
134 AuxiliaryXhair[0].axh_scale = 0.25;
137 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-cross.tga";
138 AuxiliaryXhair[0].axh_scale = 0.5;
139 AuxiliaryXhair[0].alpha = 0.25;
141 AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-bracket.tga";
142 AuxiliaryXhair[1].axh_scale = 0.25;
143 AuxiliaryXhair[1].alpha = 0.75;
144 AuxiliaryXhair[1].axh_drawflag = DRAWFLAG_NORMAL;
148 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-ring.tga";
149 AuxiliaryXhair[0].axh_scale = 0.25;
151 AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-special1.tga";
152 AuxiliaryXhair[1].axh_scale = 0.25;
156 #define HUD_GETSTATS \
157 float health = getstati(STAT_VEHICLESTAT_HEALTH); \
158 float shield = getstati(STAT_VEHICLESTAT_SHIELD); \
159 float energy = getstati(STAT_VEHICLESTAT_ENERGY); \
160 float ammo1 = getstati(STAT_VEHICLESTAT_AMMO1); \
161 float reload1 = getstati(STAT_VEHICLESTAT_RELOAD1); \
162 float ammo2 = getstati(STAT_VEHICLESTAT_AMMO2); \
163 float reload2 = getstati(STAT_VEHICLESTAT_RELOAD2);
165 void CSQC_BUMBLE_HUD()
167 vector picsize, hudloc;
169 // Fetch health & ammo stats
175 picsize = drawgetimagesize(spider_h) * 0.5;
176 drawpic(hudloc, spider_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
178 picsize = drawgetimagesize(spider_a2) * 0.5;
179 drawpic(hudloc + '120 96 0', spider_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
181 drawstring(hudloc + '145 19 0', strcat(ftos(health), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
182 drawstring(hudloc + '175 34 0', strcat(ftos(shield), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
183 drawstring(hudloc + '136 102 0', strcat(ftos(ammo1), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
185 picsize = drawgetimagesize(spider_a1) * 0.85;
188 drawpic(hudloc + '132 54 0', spider_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
189 drawstring(hudloc + '179 69 0', strcat(ftos(reload2), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
193 drawpic(hudloc + '132 54 0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
194 drawstring(hudloc + '179 69 0', strcat(ftos(9 - ammo2), " / 8"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
197 picsize = drawgetimagesize(spider_b) * 0.5;
206 drawpic(hudloc, spider_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
207 drawpic(hudloc, spider_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
208 drawpic(hudloc, spider_r, picsize, '1 1 1' * reload2 + '1 0 0' * (1 - reload2), 1, DRAWFLAG_NORMAL);
209 drawpic(hudloc, spider_g, picsize, '1 1 1' * ammo1 + '1 0 0' * (1 - ammo1), 1, DRAWFLAG_NORMAL);
212 if (scoreboard_showscores)
214 HUD_DrawScoreboard();
215 HUD_DrawCenterPrint();
219 picsize = drawgetimagesize(SPIDER_CROSS);
220 picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size;
221 picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size;
223 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);
228 void CSQC_SPIDER_HUD()
230 vector picsize, hudloc;
232 // Fetch health & ammo stats
238 picsize = drawgetimagesize(spider_h) * 0.5;
239 drawpic(hudloc, spider_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
241 picsize = drawgetimagesize(spider_a2) * 0.5;
242 drawpic(hudloc + '120 96 0', spider_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
244 drawstring(hudloc + '145 19 0', strcat(ftos(health), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
245 drawstring(hudloc + '175 34 0', strcat(ftos(shield), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
246 drawstring(hudloc + '136 102 0', strcat(ftos(ammo1), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
248 picsize = drawgetimagesize(spider_a1) * 0.85;
251 drawpic(hudloc + '132 54 0', spider_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
252 drawstring(hudloc + '179 69 0', strcat(ftos(reload2), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
256 drawpic(hudloc + '132 54 0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
257 drawstring(hudloc + '179 69 0', strcat(ftos(9 - ammo2), " / 8"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
260 picsize = drawgetimagesize(spider_b) * 0.5;
269 drawpic(hudloc, spider_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
270 drawpic(hudloc, spider_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
271 drawpic(hudloc, spider_r, picsize, '1 1 1' * reload2 + '1 0 0' * (1 - reload2), 1, DRAWFLAG_NORMAL);
272 drawpic(hudloc, spider_g, picsize, '1 1 1' * ammo1 + '1 0 0' * (1 - ammo1), 1, DRAWFLAG_NORMAL);
275 if (scoreboard_showscores)
277 HUD_DrawScoreboard();
278 HUD_DrawCenterPrint();
282 picsize = drawgetimagesize(SPIDER_CROSS);
283 picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size;
284 picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size;
286 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);
291 void CSQC_RAPTOR_HUD()
293 if(autocvar_r_letterbox)
296 vector picsize, hudloc;
300 // Fetch health & ammo stats
303 // Draw the crosshairs
304 picsize = drawgetimagesize("gfx/vehicles/axh-cross.tga");
307 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);
312 picsize = drawgetimagesize(raptor_h) * 0.5;
313 drawpic(hudloc, raptor_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
315 picsize = drawgetimagesize(spider_a2) * 0.5;
316 drawpic(hudloc + '120 96 0', spider_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
318 drawstring(hudloc + '145 19 0', strcat(ftos(health), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
319 drawstring(hudloc + '175 34 0', strcat(ftos(shield), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
320 drawstring(hudloc + '136 102 0', strcat(ftos(energy), "%"),'15 15 0','0.5 0.5 1', 1, DRAWFLAG_NORMAL);
326 picsize = drawgetimagesize(spider_a1) * 0.85;
329 drawpic(hudloc + '132 54 0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
330 drawstring(hudloc + '179 69 0', strcat(ftos(reload2), "%"),'14 14 0','0 1 0', 0.5, DRAWFLAG_NORMAL);
334 drawpic(hudloc + '132 54 0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
335 drawstring(hudloc + '179 69 0', strcat(ftos(reload2), "%"),'14 14 0','0 0 1', 1, DRAWFLAG_NORMAL);
338 picsize = drawgetimagesize(raptor_b) * 0.5;
341 reload1 = reload2 / 100;
342 drawpic(hudloc, raptor_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
343 drawpic(hudloc, raptor_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
344 drawpic(hudloc, raptor_g1, picsize, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
345 drawpic(hudloc, raptor_g2, picsize, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
350 dropmark.owner = self;
351 dropmark.gravity = 1;
356 where = dropmark.origin;
357 setorigin(dropmark, pmove_org);
358 dropmark.velocity = pmove_vel;
359 tracetoss(dropmark, self);
361 where = project_3d_to_2d(trace_endpos);
363 setorigin(dropmark, trace_endpos);
364 picsize = drawgetimagesize(raptor_d) * 0.2;
366 if not (where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)
368 where_x -= picsize_x * 0.5;
369 where_y -= picsize_y * 0.5;
371 drawpic(where, raptor_d, picsize, '0 2 0', 1, DRAWFLAG_ADDITIVE);
373 dropmark.cnt = time + 5;
377 if(dropmark.cnt > time)
379 where = project_3d_to_2d(dropmark.origin);
380 picsize = drawgetimagesize(raptor_d) * 0.25;
382 if not (where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)
384 where_x -= picsize_x * 0.5;
385 where_y -= picsize_y * 0.5;
387 drawpic(where, raptor_d, picsize, '2 0 0', 1, DRAWFLAG_ADDITIVE);
392 if (scoreboard_showscores)
394 HUD_DrawScoreboard();
395 HUD_DrawCenterPrint();
400 #define waki_h "gfx/vehicles/hud_bg.tga"
401 #define waki_b "gfx/vehicles/waki.tga"
402 #define waki_e "gfx/vehicles/waki_e.tga"
403 #define waki_g "gfx/vehicles/waki_guns.tga"
404 #define waki_r "gfx/vehicles/waki_rockets.tga"
405 #define waki_s "gfx/vehicles/shiled.tga"
407 #define waki_a1 "gfx/vehicles/sb_rocket.tga"
408 #define waki_a2 "gfx/vehicles/sb_cells.tga"
410 void CSQC_WAKIZASHI_HUD()
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 health = min(getstatf(STAT_VEHICLESTAT_HEALTH), 1);
421 shield = min(getstatf(STAT_VEHICLESTAT_SHIELD), 1);
422 energy = min(getstatf(STAT_VEHICLESTAT_ENERGY), 1);
423 rockets = bound(0,getstatf(STAT_VEHICLESTAT_RELOAD1), 1);
431 picsize = drawgetimagesize(waki_h) * 0.5;
432 drawpic(hudloc, waki_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
434 picsize = drawgetimagesize(waki_a2) * 0.7;
435 drawpic(hudloc + '116 92 0', waki_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
438 drawstring(hudloc + '145 19 0', strcat(ftos(health), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
439 drawstring(hudloc + '175 34 0', strcat(ftos(shield), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
440 drawstring(hudloc + '136 102 0', strcat(ftos(energy), "%"),'14 14 0','1 1 1', 1, DRAWFLAG_NORMAL);
442 picsize = drawgetimagesize(waki_a1) * 0.75;
445 drawpic(hudloc + '140 55 0', waki_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
446 drawpic(hudloc + '144 59 0', waki_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
450 drawpic(hudloc + '140 55 0', waki_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
451 drawpic(hudloc + '144 59 0', waki_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
452 drawstring(hudloc + '165 69 0', strcat(ftos(reload1), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
455 picsize = drawgetimagesize(waki_b) * 0.5;
464 drawpic(hudloc, waki_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
465 drawpic(hudloc, waki_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
466 drawpic(hudloc, waki_r, picsize, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
467 drawpic(hudloc, waki_e, picsize, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
469 if (scoreboard_showscores)
471 HUD_DrawScoreboard();
472 HUD_DrawCenterPrint();
477 void Vehicles_Precache()
479 precache_model("models/vehicles/wakizashi.dpm");
481 precache_model("models/vehicles/bomblet.md3");
482 precache_model("models/vehicles/clusterbomb.md3");
483 precache_model("models/vehicles/clusterbomb_fragment.md3");
484 precache_model("models/vehicles/rocket01.md3");
485 precache_model("models/vehicles/rocket02.md3");
488 void RaptorCBShellfragDraw()
490 Movetype_Physics_MatchTicrate(autocvar_cl_gibs_ticrate, autocvar_cl_gibs_sloppy);
494 self.move_avelocity += randomvec() * 15;
495 self.renderflags = 0;
497 self.alpha = bound(0, self.nextthink - time, 1);
499 if(self.alpha < ALPHA_MIN_VISIBLE)
504 void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang)
509 setmodel(sfrag, "models/vehicles/clusterbomb_fragment.md3");
510 setorigin(sfrag, _org);
512 sfrag.move_movetype = MOVETYPE_BOUNCE;
513 sfrag.gravity = 0.15;
514 sfrag.solid = SOLID_CORPSE;
516 sfrag.draw = RaptorCBShellfragDraw;
518 sfrag.move_origin = sfrag.origin = _org;
519 sfrag.move_velocity = _vel;
520 sfrag.move_avelocity = prandomvec() * vlen(sfrag.move_velocity);
521 sfrag.angles = self.move_angles = _ang;
523 sfrag.move_time = time;
524 sfrag.damageforcescale = 4;
526 sfrag.nextthink = time + 3;
527 sfrag.cnt = time + 2;
528 sfrag.drawmask = MASK_NORMAL;