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;
60 void Net_Vehicle(float IsNew)
65 void Net_AuXair2(float bIsNew)
70 axh_id = bound(0, ReadByte(), MAX_AXH);
71 axh = AuxiliaryXhair[axh_id];
73 if(axh == world || wasfreed(axh)) // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
76 axh.draw2d = Draw_Not;
77 axh.drawmask = MASK_NORMAL;
78 axh.axh_drawflag = DRAWFLAG_ADDITIVE;
79 axh.axh_fadetime = 0.1;
80 axh.axh_image = "gfx/vehicles/axh-ring.tga";
83 AuxiliaryXhair[axh_id] = axh;
86 axh.draw2d = AuxiliaryXhair_Draw2D;
88 axh.origin_x = ReadCoord();
89 axh.origin_y = ReadCoord();
90 axh.origin_z = ReadCoord();
92 axh.colormod_x = ReadByte() / 255;
93 axh.colormod_y = ReadByte() / 255;
94 axh.colormod_z = ReadByte() / 255;
100 void VehicleRacerDraw()
102 Movetype_Physics_NoMatchServer();
103 self.drawmask = MASK_NORMAL;
106 void VehicleRacerRemove()
110 void Net_VehicleRacer(float bIsNew)
114 setmodel(self, "models/vehicles/wakizashi.dpm");
115 self.move_movetype = MOVETYPE_BOUNCE;
116 self.entremove = VehicleRacerRemove;
117 setsize(self, '-60 -60 -20', '60 60 20');
118 self.draw = VehicleRacerDraw;
122 self.cnt = ReadByte();
124 self.origin_x = ReadCoord();
125 self.origin_y = ReadCoord();
126 self.origin_z = ReadCoord();
128 self.velocity_x = ReadCoord();
129 self.velocity_y = ReadCoord();
130 self.velocity_z = ReadCoord();
132 self.angles_x = ReadAngle();
133 self.angles_y = ReadAngle();
134 self.angles_z = ReadAngle();
136 self.move_origin = self.origin;
137 self.move_velocity = self.velocity;
138 self.move_angles = self.angles;
140 setorigin(self, self.origin);
145 void Net_VehicleSetup()
149 hud_id = bound(HUD_SPIDERBOT, ReadByte(), HUD_RAPTOR);
151 // Init auxiliary crosshairs
153 for(i = 0; i < MAX_AXH; ++i)
155 axh = AuxiliaryXhair[i];
156 if(axh != world && !wasfreed(axh)) // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
160 axh.draw2d = Draw_Not;
161 axh.drawmask = MASK_NORMAL;
162 axh.axh_drawflag = DRAWFLAG_ADDITIVE;
163 axh.axh_fadetime = 0.1;
164 axh.axh_image = "gfx/vehicles/axh-ring.tga";
167 AuxiliaryXhair[i] = axh;
174 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-ring.tga";
175 AuxiliaryXhair[0].axh_scale = 0.25;
177 AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-ring.tga";
178 AuxiliaryXhair[1].axh_scale = 0.25;
180 AuxiliaryXhair[2].axh_image = "gfx/vehicles/axh-special1.tga";
181 AuxiliaryXhair[2].axh_scale = 0.5;
184 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-bracket.tga";
185 AuxiliaryXhair[0].axh_scale = 0.25;
188 AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-cross.tga";
189 AuxiliaryXhair[0].axh_scale = 0.5;
190 AuxiliaryXhair[0].alpha = 0.25;
192 AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-bracket.tga";
193 AuxiliaryXhair[1].axh_scale = 0.25;
194 AuxiliaryXhair[1].alpha = 0.75;
195 AuxiliaryXhair[1].axh_drawflag = DRAWFLAG_NORMAL;
200 #define HUD_GETSTATS \
201 float health = getstati(STAT_VEHICLESTAT_HEALTH); \
202 float shield = getstati(STAT_VEHICLESTAT_SHIELD); \
203 float energy = getstati(STAT_VEHICLESTAT_ENERGY); \
204 float ammo1 = getstati(STAT_VEHICLESTAT_AMMO1); \
205 float reload1 = getstati(STAT_VEHICLESTAT_RELOAD1); \
206 float ammo2 = getstati(STAT_VEHICLESTAT_AMMO2); \
207 float reload2 = getstati(STAT_VEHICLESTAT_RELOAD2);
209 void CSQC_SPIDER_HUD()
211 vector picsize, hudloc;
213 // Fetch health & ammo stats
219 picsize = drawgetimagesize(spider_h) * 0.5;
220 drawpic(hudloc, spider_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(health), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
226 drawstring(hudloc + '175 34 0', strcat(ftos(shield), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
227 drawstring(hudloc + '136 102 0', strcat(ftos(ammo1), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
229 picsize = drawgetimagesize(spider_a1) * 0.85;
232 drawpic(hudloc + '132 54 0', spider_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
233 drawstring(hudloc + '179 69 0', strcat(ftos(reload2), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
237 drawpic(hudloc + '132 54 0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
238 drawstring(hudloc + '179 69 0', strcat(ftos(9 - ammo2), " / 8"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
241 picsize = drawgetimagesize(spider_b) * 0.5;
250 drawpic(hudloc, spider_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
251 drawpic(hudloc, spider_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
252 drawpic(hudloc, spider_r, picsize, '1 1 1' * reload2 + '1 0 0' * (1 - reload2), 1, DRAWFLAG_NORMAL);
253 drawpic(hudloc, spider_g, picsize, '1 1 1' * ammo1 + '1 0 0' * (1 - ammo1), 1, DRAWFLAG_NORMAL);
256 if (scoreboard_showscores)
258 HUD_DrawScoreboard();
259 HUD_DrawCenterPrint();
263 picsize = drawgetimagesize(SPIDER_CROSS);
264 picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size;
265 picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size;
267 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);
272 void CSQC_RAPTOR_HUD()
274 if(autocvar_r_letterbox)
277 vector picsize, hudloc, vel;
282 // Fetch health & ammo stats
285 // Draw the crosshairs
286 picsize = drawgetimagesize("gfx/vehicles/axh-cross.tga");
289 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);
294 picsize = drawgetimagesize(raptor_h) * 0.5;
295 drawpic(hudloc, raptor_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
297 picsize = drawgetimagesize(spider_a2) * 0.5;
298 drawpic(hudloc + '120 96 0', spider_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
300 drawstring(hudloc + '145 19 0', strcat(ftos(health), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
301 drawstring(hudloc + '175 34 0', strcat(ftos(shield), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
302 drawstring(hudloc + '136 102 0', strcat(ftos(energy), "%"),'15 15 0','0.5 0.5 1', 1, DRAWFLAG_NORMAL);
308 picsize = drawgetimagesize(spider_a1) * 0.85;
311 drawpic(hudloc + '132 54 0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
312 drawstring(hudloc + '179 69 0', strcat(ftos(reload2), "%"),'14 14 0','0 1 0', 0.5, DRAWFLAG_NORMAL);
316 drawpic(hudloc + '132 54 0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
317 drawstring(hudloc + '179 69 0', strcat(ftos(reload2), "%"),'14 14 0','0 0 1', 1, DRAWFLAG_NORMAL);
320 picsize = drawgetimagesize(raptor_b) * 0.5;
323 reload1 = reload2 / 100;
324 drawpic(hudloc, raptor_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
325 drawpic(hudloc, raptor_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
326 drawpic(hudloc, raptor_g1, picsize, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
327 drawpic(hudloc, raptor_g2, picsize, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
332 dropmark.owner = self;
333 dropmark.gravity = 1;
338 where = dropmark.origin;
339 setorigin(dropmark, pmove_org);
340 dropmark.velocity = pmove_vel;
341 tracetoss(dropmark, self);
343 where = project_3d_to_2d(trace_endpos);
345 setorigin(dropmark, trace_endpos);
346 picsize = drawgetimagesize(raptor_d) * 0.2;
348 if not (where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)
350 where_x -= picsize_x * 0.5;
351 where_y -= picsize_y * 0.5;
353 drawpic(where, raptor_d, picsize, '0 2 0', 1, DRAWFLAG_ADDITIVE);
355 dropmark.cnt = time + 5;
359 if(dropmark.cnt > time)
361 where = project_3d_to_2d(dropmark.origin);
362 picsize = drawgetimagesize(raptor_d) * 0.25;
364 if not (where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)
366 where_x -= picsize_x * 0.5;
367 where_y -= picsize_y * 0.5;
369 drawpic(where, raptor_d, picsize, '2 0 0', 1, DRAWFLAG_ADDITIVE);
374 if (scoreboard_showscores)
376 HUD_DrawScoreboard();
377 HUD_DrawCenterPrint();
382 #define waki_h "gfx/vehicles/hud_bg.tga"
383 #define waki_b "gfx/vehicles/waki.tga"
384 #define waki_e "gfx/vehicles/waki_e.tga"
385 #define waki_g "gfx/vehicles/waki_guns.tga"
386 #define waki_r "gfx/vehicles/waki_rockets.tga"
387 #define waki_s "gfx/vehicles/shiled.tga"
389 #define waki_a1 "gfx/vehicles/sb_rocket.tga"
390 #define waki_a2 "gfx/vehicles/sb_cells.tga"
392 void CSQC_WAKIZASHI_HUD()
394 vector picsize, hudloc;
396 picsize = drawgetimagesize(SPIDER_CROSS);
397 picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size;
398 picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size;
399 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);
402 health = min(getstatf(STAT_VEHICLESTAT_HEALTH), 1);
403 shield = min(getstatf(STAT_VEHICLESTAT_SHIELD), 1);
404 energy = min(getstatf(STAT_VEHICLESTAT_ENERGY), 1);
405 rockets = bound(0,getstatf(STAT_VEHICLESTAT_RELOAD1), 1);
413 picsize = drawgetimagesize(waki_h) * 0.5;
414 drawpic(hudloc, waki_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
416 picsize = drawgetimagesize(waki_a2) * 0.7;
417 drawpic(hudloc + '116 92 0', waki_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
420 drawstring(hudloc + '145 19 0', strcat(ftos(health), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
421 drawstring(hudloc + '175 34 0', strcat(ftos(shield), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
422 drawstring(hudloc + '136 102 0', strcat(ftos(energy), "%"),'14 14 0','1 1 1', 1, DRAWFLAG_NORMAL);
424 picsize = drawgetimagesize(waki_a1) * 0.75;
427 drawpic(hudloc + '140 55 0', waki_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
428 drawpic(hudloc + '144 59 0', waki_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
432 drawpic(hudloc + '140 55 0', waki_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
433 drawpic(hudloc + '144 59 0', waki_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
434 drawstring(hudloc + '165 69 0', strcat(ftos(reload1), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
437 picsize = drawgetimagesize(waki_b) * 0.5;
446 drawpic(hudloc, waki_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
447 drawpic(hudloc, waki_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
448 drawpic(hudloc, waki_r, picsize, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
449 drawpic(hudloc, waki_e, picsize, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
451 if (scoreboard_showscores)
453 HUD_DrawScoreboard();
454 HUD_DrawCenterPrint();
459 void Vehicles_Precache()
461 precache_model("models/vehicles/bomblet.md3");
462 precache_model("models/vehicles/clusterbomb.md3");
463 precache_model("models/vehicles/clusterbomb_fragment.md3");
464 precache_model("models/vehicles/rocket01.md3");
465 precache_model("models/vehicles/rocket02.md3");
469 void RaptorCBShellfragDraw()
471 Movetype_Physics_MatchTicrate(autocvar_cl_gibs_ticrate, autocvar_cl_gibs_sloppy);
475 self.move_avelocity += randomvec() * 15;
476 self.renderflags = 0;
478 self.alpha = bound(0, self.nextthink - time, 1);
480 if(self.alpha < ALPHA_MIN_VISIBLE)
484 void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang)
489 setmodel(sfrag, "models/vehicles/clusterbomb_fragment.md3");
490 setorigin(sfrag, _org);
492 sfrag.move_movetype = MOVETYPE_BOUNCE;
493 sfrag.gravity = 0.15;
494 sfrag.solid = SOLID_CORPSE;
496 sfrag.draw = RaptorCBShellfragDraw;
498 sfrag.move_origin = sfrag.origin = _org;
499 sfrag.move_velocity = _vel;
500 sfrag.move_avelocity = prandomvec() * vlen(sfrag.move_velocity);
501 sfrag.angles = self.move_angles = _ang;
503 sfrag.move_time = time;
504 sfrag.damageforcescale = 4;
506 sfrag.nextthink = time + 3;
507 sfrag.cnt = time + 2;
508 sfrag.drawmask = MASK_NORMAL;