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_Vehicle(float IsNew)
66 void Net_AuXair2(float bIsNew)
71 axh_id = bound(0, ReadByte(), MAX_AXH);
72 axh = AuxiliaryXhair[axh_id];
74 if(axh == world || wasfreed(axh)) // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
77 axh.draw2d = Draw_Not;
78 axh.drawmask = MASK_NORMAL;
79 axh.axh_drawflag = DRAWFLAG_ADDITIVE;
80 axh.axh_fadetime = 0.1;
81 axh.axh_image = "gfx/vehicles/axh-ring.tga";
84 AuxiliaryXhair[axh_id] = axh;
87 axh.draw2d = AuxiliaryXhair_Draw2D;
89 axh.origin_x = ReadCoord();
90 axh.origin_y = ReadCoord();
91 axh.origin_z = ReadCoord();
93 axh.colormod_x = ReadByte() / 255;
94 axh.colormod_y = ReadByte() / 255;
95 axh.colormod_z = ReadByte() / 255;
101 void VehicleRacerDraw()
103 Movetype_Physics_NoMatchServer();
104 self.drawmask = MASK_NORMAL;
107 void VehicleRacerRemove()
111 void Net_VehicleRacer(float bIsNew)
115 setmodel(self, "models/vehicles/wakizashi.dpm");
116 self.move_movetype = MOVETYPE_BOUNCE;
117 self.entremove = VehicleRacerRemove;
118 setsize(self, '-60 -60 -20', '60 60 20');
119 self.draw = VehicleRacerDraw;
123 self.cnt = ReadByte();
125 self.origin_x = ReadCoord();
126 self.origin_y = ReadCoord();
127 self.origin_z = ReadCoord();
129 self.velocity_x = ReadCoord();
130 self.velocity_y = ReadCoord();
131 self.velocity_z = ReadCoord();
133 self.angles_x = ReadAngle();
134 self.angles_y = ReadAngle();
135 self.angles_z = ReadAngle();
137 self.move_origin = self.origin;
138 self.move_velocity = self.velocity;
139 self.move_angles = self.angles;
141 setorigin(self, self.origin);
146 void Net_VehicleSetup()
150 hud_id = bound(HUD_SPIDERBOT, ReadByte(), HUD_RAPTOR);
152 // Init auxiliary crosshairs
154 for(i = 0; i < MAX_AXH; ++i)
156 axh = AuxiliaryXhair[i];
157 if(axh != world && !wasfreed(axh)) // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
161 axh.draw2d = Draw_Not;
162 axh.drawmask = MASK_NORMAL;
163 axh.axh_drawflag = DRAWFLAG_ADDITIVE;
164 axh.axh_fadetime = 0.1;
165 axh.axh_image = "gfx/vehicles/axh-ring.tga";
168 AuxiliaryXhair[i] = axh;
175 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-ring.tga";
176 AuxiliaryXhair[0].axh_scale = 0.25;
178 AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-ring.tga";
179 AuxiliaryXhair[1].axh_scale = 0.25;
181 AuxiliaryXhair[2].axh_image = "gfx/vehicles/axh-special1.tga";
182 AuxiliaryXhair[2].axh_scale = 0.5;
185 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-bracket.tga";
186 AuxiliaryXhair[0].axh_scale = 0.25;
189 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-cross.tga";
190 AuxiliaryXhair[0].axh_scale = 0.5;
191 AuxiliaryXhair[0].alpha = 0.25;
193 AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-bracket.tga";
194 AuxiliaryXhair[1].axh_scale = 0.25;
195 AuxiliaryXhair[1].alpha = 0.75;
196 AuxiliaryXhair[1].axh_drawflag = DRAWFLAG_NORMAL;
200 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-ring.tga";
201 AuxiliaryXhair[0].axh_scale = 0.25;
203 AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-special1.tga";
204 AuxiliaryXhair[1].axh_scale = 0.25;
208 #define HUD_GETSTATS \
209 float health = getstati(STAT_VEHICLESTAT_HEALTH); \
210 float shield = getstati(STAT_VEHICLESTAT_SHIELD); \
211 float energy = getstati(STAT_VEHICLESTAT_ENERGY); \
212 float ammo1 = getstati(STAT_VEHICLESTAT_AMMO1); \
213 float reload1 = getstati(STAT_VEHICLESTAT_RELOAD1); \
214 float ammo2 = getstati(STAT_VEHICLESTAT_AMMO2); \
215 float reload2 = getstati(STAT_VEHICLESTAT_RELOAD2);
217 void CSQC_BUMBLE_HUD()
219 vector picsize, hudloc;
221 // Fetch health & ammo stats
227 picsize = drawgetimagesize(spider_h) * 0.5;
228 drawpic(hudloc, spider_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
230 picsize = drawgetimagesize(spider_a2) * 0.5;
231 drawpic(hudloc + '120 96 0', spider_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
233 drawstring(hudloc + '145 19 0', strcat(ftos(health), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
234 drawstring(hudloc + '175 34 0', strcat(ftos(shield), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
235 drawstring(hudloc + '136 102 0', strcat(ftos(ammo1), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
237 picsize = drawgetimagesize(spider_a1) * 0.85;
240 drawpic(hudloc + '132 54 0', spider_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
241 drawstring(hudloc + '179 69 0', strcat(ftos(reload2), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
245 drawpic(hudloc + '132 54 0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
246 drawstring(hudloc + '179 69 0', strcat(ftos(9 - ammo2), " / 8"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
249 picsize = drawgetimagesize(spider_b) * 0.5;
258 drawpic(hudloc, spider_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
259 drawpic(hudloc, spider_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
260 drawpic(hudloc, spider_r, picsize, '1 1 1' * reload2 + '1 0 0' * (1 - reload2), 1, DRAWFLAG_NORMAL);
261 drawpic(hudloc, spider_g, picsize, '1 1 1' * ammo1 + '1 0 0' * (1 - ammo1), 1, DRAWFLAG_NORMAL);
264 if (scoreboard_showscores)
266 HUD_DrawScoreboard();
267 HUD_DrawCenterPrint();
271 picsize = drawgetimagesize(SPIDER_CROSS);
272 picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size;
273 picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size;
275 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);
280 void CSQC_SPIDER_HUD()
282 vector picsize, hudloc;
284 // Fetch health & ammo stats
290 picsize = drawgetimagesize(spider_h) * 0.5;
291 drawpic(hudloc, spider_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
293 picsize = drawgetimagesize(spider_a2) * 0.5;
294 drawpic(hudloc + '120 96 0', spider_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
296 drawstring(hudloc + '145 19 0', strcat(ftos(health), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
297 drawstring(hudloc + '175 34 0', strcat(ftos(shield), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
298 drawstring(hudloc + '136 102 0', strcat(ftos(ammo1), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
300 picsize = drawgetimagesize(spider_a1) * 0.85;
303 drawpic(hudloc + '132 54 0', spider_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
304 drawstring(hudloc + '179 69 0', strcat(ftos(reload2), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
308 drawpic(hudloc + '132 54 0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
309 drawstring(hudloc + '179 69 0', strcat(ftos(9 - ammo2), " / 8"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
312 picsize = drawgetimagesize(spider_b) * 0.5;
321 drawpic(hudloc, spider_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
322 drawpic(hudloc, spider_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
323 drawpic(hudloc, spider_r, picsize, '1 1 1' * reload2 + '1 0 0' * (1 - reload2), 1, DRAWFLAG_NORMAL);
324 drawpic(hudloc, spider_g, picsize, '1 1 1' * ammo1 + '1 0 0' * (1 - ammo1), 1, DRAWFLAG_NORMAL);
327 if (scoreboard_showscores)
329 HUD_DrawScoreboard();
330 HUD_DrawCenterPrint();
334 picsize = drawgetimagesize(SPIDER_CROSS);
335 picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size;
336 picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size;
338 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);
343 void CSQC_RAPTOR_HUD()
345 if(autocvar_r_letterbox)
348 vector picsize, hudloc, vel;
353 // Fetch health & ammo stats
356 // Draw the crosshairs
357 picsize = drawgetimagesize("gfx/vehicles/axh-cross.tga");
360 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);
365 picsize = drawgetimagesize(raptor_h) * 0.5;
366 drawpic(hudloc, raptor_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
368 picsize = drawgetimagesize(spider_a2) * 0.5;
369 drawpic(hudloc + '120 96 0', spider_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
371 drawstring(hudloc + '145 19 0', strcat(ftos(health), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
372 drawstring(hudloc + '175 34 0', strcat(ftos(shield), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
373 drawstring(hudloc + '136 102 0', strcat(ftos(energy), "%"),'15 15 0','0.5 0.5 1', 1, DRAWFLAG_NORMAL);
379 picsize = drawgetimagesize(spider_a1) * 0.85;
382 drawpic(hudloc + '132 54 0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
383 drawstring(hudloc + '179 69 0', strcat(ftos(reload2), "%"),'14 14 0','0 1 0', 0.5, DRAWFLAG_NORMAL);
387 drawpic(hudloc + '132 54 0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
388 drawstring(hudloc + '179 69 0', strcat(ftos(reload2), "%"),'14 14 0','0 0 1', 1, DRAWFLAG_NORMAL);
391 picsize = drawgetimagesize(raptor_b) * 0.5;
394 reload1 = reload2 / 100;
395 drawpic(hudloc, raptor_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
396 drawpic(hudloc, raptor_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
397 drawpic(hudloc, raptor_g1, picsize, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
398 drawpic(hudloc, raptor_g2, picsize, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
403 dropmark.owner = self;
404 dropmark.gravity = 1;
409 where = dropmark.origin;
410 setorigin(dropmark, pmove_org);
411 dropmark.velocity = pmove_vel;
412 tracetoss(dropmark, self);
414 where = project_3d_to_2d(trace_endpos);
416 setorigin(dropmark, trace_endpos);
417 picsize = drawgetimagesize(raptor_d) * 0.2;
419 if not (where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)
421 where_x -= picsize_x * 0.5;
422 where_y -= picsize_y * 0.5;
424 drawpic(where, raptor_d, picsize, '0 2 0', 1, DRAWFLAG_ADDITIVE);
426 dropmark.cnt = time + 5;
430 if(dropmark.cnt > time)
432 where = project_3d_to_2d(dropmark.origin);
433 picsize = drawgetimagesize(raptor_d) * 0.25;
435 if not (where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)
437 where_x -= picsize_x * 0.5;
438 where_y -= picsize_y * 0.5;
440 drawpic(where, raptor_d, picsize, '2 0 0', 1, DRAWFLAG_ADDITIVE);
445 if (scoreboard_showscores)
447 HUD_DrawScoreboard();
448 HUD_DrawCenterPrint();
453 #define waki_h "gfx/vehicles/hud_bg.tga"
454 #define waki_b "gfx/vehicles/waki.tga"
455 #define waki_e "gfx/vehicles/waki_e.tga"
456 #define waki_g "gfx/vehicles/waki_guns.tga"
457 #define waki_r "gfx/vehicles/waki_rockets.tga"
458 #define waki_s "gfx/vehicles/shiled.tga"
460 #define waki_a1 "gfx/vehicles/sb_rocket.tga"
461 #define waki_a2 "gfx/vehicles/sb_cells.tga"
463 void CSQC_WAKIZASHI_HUD()
465 vector picsize, hudloc;
467 picsize = drawgetimagesize(SPIDER_CROSS);
468 picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size;
469 picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size;
470 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);
473 health = min(getstatf(STAT_VEHICLESTAT_HEALTH), 1);
474 shield = min(getstatf(STAT_VEHICLESTAT_SHIELD), 1);
475 energy = min(getstatf(STAT_VEHICLESTAT_ENERGY), 1);
476 rockets = bound(0,getstatf(STAT_VEHICLESTAT_RELOAD1), 1);
484 picsize = drawgetimagesize(waki_h) * 0.5;
485 drawpic(hudloc, waki_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
487 picsize = drawgetimagesize(waki_a2) * 0.7;
488 drawpic(hudloc + '116 92 0', waki_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
491 drawstring(hudloc + '145 19 0', strcat(ftos(health), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
492 drawstring(hudloc + '175 34 0', strcat(ftos(shield), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
493 drawstring(hudloc + '136 102 0', strcat(ftos(energy), "%"),'14 14 0','1 1 1', 1, DRAWFLAG_NORMAL);
495 picsize = drawgetimagesize(waki_a1) * 0.75;
498 drawpic(hudloc + '140 55 0', waki_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
499 drawpic(hudloc + '144 59 0', waki_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
503 drawpic(hudloc + '140 55 0', waki_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
504 drawpic(hudloc + '144 59 0', waki_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
505 drawstring(hudloc + '165 69 0', strcat(ftos(reload1), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
508 picsize = drawgetimagesize(waki_b) * 0.5;
517 drawpic(hudloc, waki_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
518 drawpic(hudloc, waki_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
519 drawpic(hudloc, waki_r, picsize, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
520 drawpic(hudloc, waki_e, picsize, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
522 if (scoreboard_showscores)
524 HUD_DrawScoreboard();
525 HUD_DrawCenterPrint();
530 void Vehicles_Precache()
532 precache_model("models/vehicles/bomblet.md3");
533 precache_model("models/vehicles/clusterbomb.md3");
534 precache_model("models/vehicles/clusterbomb_fragment.md3");
535 precache_model("models/vehicles/rocket01.md3");
536 precache_model("models/vehicles/rocket02.md3");
540 void RaptorCBShellfragDraw()
542 Movetype_Physics_MatchTicrate(autocvar_cl_gibs_ticrate, autocvar_cl_gibs_sloppy);
546 self.move_avelocity += randomvec() * 15;
547 self.renderflags = 0;
549 self.alpha = bound(0, self.nextthink - time, 1);
551 if(self.alpha < ALPHA_MIN_VISIBLE)
555 void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang)
560 setmodel(sfrag, "models/vehicles/clusterbomb_fragment.md3");
561 setorigin(sfrag, _org);
563 sfrag.move_movetype = MOVETYPE_BOUNCE;
564 sfrag.gravity = 0.15;
565 sfrag.solid = SOLID_CORPSE;
567 sfrag.draw = RaptorCBShellfragDraw;
569 sfrag.move_origin = sfrag.origin = _org;
570 sfrag.move_velocity = _vel;
571 sfrag.move_avelocity = prandomvec() * vlen(sfrag.move_velocity);
572 sfrag.angles = self.move_angles = _ang;
574 sfrag.move_time = time;
575 sfrag.damageforcescale = 4;
577 sfrag.nextthink = time + 3;
578 sfrag.cnt = time + 2;
579 sfrag.drawmask = MASK_NORMAL;