]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/client/vehicles/vehicles.qc
76c65111c7ea477a0aae08f77ee281b79f33a330
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / vehicles / vehicles.qc
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"
6
7 #define axh1 "gfx/vehicles/sbot-xhair2.tga"
8 #define axh2 "gfx/vehicles/sbot-xhair2.tga"
9 #define axh3 "gfx/vehicles/sbot-xhair2.tga"
10
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"
18
19 #define raptor_h  "gfx/vehicles/hud_bg.tga"
20 #define raptor_s  "gfx/vehicles/shiled.tga"
21
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"
27
28 entity dropmark;
29
30 void CSQC_WAKIZASHI_HUD();
31 void CSQC_SPIDER_HUD();
32 void CSQC_RAPTOR_HUD();
33 void CSQC_BUMBLE_HUD();
34
35 #define MAX_AXH 4
36 entity AuxiliaryXhair[MAX_AXH];
37 const var void Draw_Not();
38
39 .string axh_image;
40 .float  axh_fadetime;
41 .float  axh_drawflag;
42 .float  axh_scale;
43
44 void AuxiliaryXhair_Draw2D()
45 {
46     vector loc, psize;
47
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)
51     {
52         loc_z = 0;
53         psize_z = 0;
54         drawpic(loc, self.axh_image, psize, self.colormod, self.alpha, self.axh_drawflag);
55     }
56
57     if(time - self.cnt > self.axh_fadetime)
58         self.draw2d = Draw_Not;
59 }
60
61 void Net_Vehicle(float IsNew)
62 {
63     //entnum
64 }
65
66 void Net_AuXair2(float bIsNew)
67 {
68     float axh_id;
69     entity axh;
70
71     axh_id = bound(0, ReadByte(), MAX_AXH);
72     axh = AuxiliaryXhair[axh_id];
73
74     if(axh == world || wasfreed(axh))  // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
75     {
76         axh               = spawn();
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";
82                 axh.axh_scale     = 1;
83         axh.alpha         = 1;
84                 AuxiliaryXhair[axh_id] = axh;
85     }
86
87     axh.draw2d   = AuxiliaryXhair_Draw2D;
88
89         axh.origin_x = ReadCoord();
90         axh.origin_y = ReadCoord();
91         axh.origin_z = ReadCoord();
92
93         axh.colormod_x = ReadByte() / 255;
94         axh.colormod_y = ReadByte() / 255;
95         axh.colormod_z = ReadByte() / 255;
96     axh.cnt = time;
97 }
98
99
100
101 void VehicleRacerDraw()
102 {
103     Movetype_Physics_NoMatchServer();
104     self.drawmask = MASK_NORMAL;
105 }
106
107 void VehicleRacerRemove()
108 {
109 }
110
111 void Net_VehicleRacer(float bIsNew)
112 {
113     if(bIsNew)
114     {
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;
120         self.scale = 0.5;
121     }
122
123     self.cnt = ReadByte();
124
125     self.origin_x = ReadCoord();
126     self.origin_y = ReadCoord();
127     self.origin_z = ReadCoord();
128
129     self.velocity_x = ReadCoord();
130     self.velocity_y = ReadCoord();
131     self.velocity_z = ReadCoord();
132
133     self.angles_x = ReadAngle();
134     self.angles_y = ReadAngle();
135     self.angles_z = ReadAngle();
136
137     self.move_origin    = self.origin;
138     self.move_velocity  = self.velocity;
139     self.move_angles    = self.angles;
140
141     setorigin(self, self.origin);
142 }
143
144
145
146 void Net_VehicleSetup()
147 {
148
149     float hud_id, i;
150     hud_id = bound(HUD_SPIDERBOT, ReadByte(), HUD_RAPTOR);
151
152     // Init auxiliary crosshairs
153     entity axh;
154     for(i = 0; i < MAX_AXH; ++i)
155     {
156         axh = AuxiliaryXhair[i];
157         if(axh != world && !wasfreed(axh))  // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
158             remove(axh);
159
160         axh               = spawn();
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";
166                 axh.axh_scale     = 1;
167         axh.alpha         = 1;
168                 AuxiliaryXhair[i] = axh;
169     }
170
171     switch(hud_id)
172     {
173         case HUD_SPIDERBOT:
174             // Minigun1
175             AuxiliaryXhair[0].axh_image   = "gfx/vehicles/axh-ring.tga";
176             AuxiliaryXhair[0].axh_scale   = 0.25;
177             // Minigun2
178             AuxiliaryXhair[1].axh_image   = "gfx/vehicles/axh-ring.tga";
179             AuxiliaryXhair[1].axh_scale   = 0.25;
180             // Rocket
181             AuxiliaryXhair[2].axh_image   = "gfx/vehicles/axh-special1.tga";
182             AuxiliaryXhair[2].axh_scale   = 0.5;
183             break;
184         case HUD_WAKIZASHI:
185             AuxiliaryXhair[0].axh_image   = "gfx/vehicles/axh-bracket.tga";
186             AuxiliaryXhair[0].axh_scale   = 0.25;
187             break;
188         case HUD_RAPTOR:
189             AuxiliaryXhair[0].axh_image   = "gfx/vehicles/axh-cross.tga";
190             AuxiliaryXhair[0].axh_scale   = 0.5;
191             AuxiliaryXhair[0].alpha       = 0.25;
192
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;
197             break;
198         case HUD_BUMBLEBEE:
199             // Plasma cannons
200             AuxiliaryXhair[0].axh_image   = "gfx/vehicles/axh-ring.tga";
201             AuxiliaryXhair[0].axh_scale   = 0.25;
202             // Raygun
203             AuxiliaryXhair[1].axh_image   = "gfx/vehicles/axh-special1.tga";
204             AuxiliaryXhair[1].axh_scale   = 0.25;
205             break;
206     }
207 }
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);
216
217 void CSQC_BUMBLE_HUD()
218 {
219         vector picsize, hudloc;
220
221     // Fetch health & ammo stats
222         HUD_GETSTATS
223         
224     hudloc_y = 4;
225     hudloc_x = 4;
226     
227     picsize = drawgetimagesize(spider_h) * 0.5;
228     drawpic(hudloc, spider_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
229
230     picsize = drawgetimagesize(spider_a2) * 0.5;
231     drawpic(hudloc + '120 96  0', spider_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
232
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);
236
237     picsize = drawgetimagesize(spider_a1) * 0.85;
238     if(ammo2 == 9)
239     {
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);
242     }
243     else
244     {
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);
247     }
248
249     picsize = drawgetimagesize(spider_b) * 0.5;
250     hudloc_y = 10.5;
251     hudloc_x = 10.5;
252     
253     ammo1  /= 100; 
254     shield /= 100;
255     health /= 100;
256     reload2 /= 100;
257     
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);
262
263
264         if (scoreboard_showscores)
265         {
266                 HUD_DrawScoreboard();
267                 HUD_DrawCenterPrint();
268     }
269     else
270     {
271         picsize = drawgetimagesize(SPIDER_CROSS);
272         picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size;
273         picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size;
274
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);
276     }
277 }
278
279
280 void CSQC_SPIDER_HUD()
281 {
282         vector picsize, hudloc;
283
284     // Fetch health & ammo stats
285         HUD_GETSTATS
286         
287     hudloc_y = 4;
288     hudloc_x = 4;
289     
290     picsize = drawgetimagesize(spider_h) * 0.5;
291     drawpic(hudloc, spider_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
292
293     picsize = drawgetimagesize(spider_a2) * 0.5;
294     drawpic(hudloc + '120 96  0', spider_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
295
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);
299
300     picsize = drawgetimagesize(spider_a1) * 0.85;
301     if(ammo2 == 9)
302     {
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);
305     }
306     else
307     {
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);
310     }
311
312     picsize = drawgetimagesize(spider_b) * 0.5;
313     hudloc_y = 10.5;
314     hudloc_x = 10.5;
315     
316     ammo1  /= 100; 
317     shield /= 100;
318     health /= 100;
319     reload2 /= 100;
320     
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);
325
326
327         if (scoreboard_showscores)
328         {
329                 HUD_DrawScoreboard();
330                 HUD_DrawCenterPrint();
331     }
332     else
333     {
334         picsize = drawgetimagesize(SPIDER_CROSS);
335         picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size;
336         picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size;
337
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);
339     }
340 }
341
342
343 void CSQC_RAPTOR_HUD()
344 {
345         if(autocvar_r_letterbox)
346         return;
347         
348         vector picsize, hudloc, vel;
349         float movedt;
350     vector where;
351
352
353     // Fetch health & ammo stats
354     HUD_GETSTATS
355     
356     // Draw the crosshairs
357     picsize = drawgetimagesize("gfx/vehicles/axh-cross.tga");
358     picsize_x *= 0.75;
359     picsize_y *= 0.75;
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);
361
362     hudloc_y = 4;
363     hudloc_x = 4;
364
365     picsize = drawgetimagesize(raptor_h) * 0.5;
366     drawpic(hudloc, raptor_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
367
368     picsize = drawgetimagesize(spider_a2) * 0.5;
369     drawpic(hudloc + '120 96  0', spider_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
370
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);
374
375     health /= 100;
376     shield /= 100;
377     energy /= 100;
378
379     picsize = drawgetimagesize(spider_a1) * 0.85;
380     if(reload2 == 100)
381     {
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);
384     }
385     else
386     {
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);
389     }
390
391     picsize = drawgetimagesize(raptor_b) * 0.5;
392     hudloc_y = 10.5;
393     hudloc_x = 10.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);
399
400     if(!dropmark)
401     {
402         dropmark = spawn();
403         dropmark.owner = self;
404         dropmark.gravity = 1;
405     }
406
407     if(reload2 == 100)
408     {
409         where = dropmark.origin;
410         setorigin(dropmark, pmove_org);
411         dropmark.velocity = pmove_vel;
412         tracetoss(dropmark, self);
413
414         where = project_3d_to_2d(trace_endpos);
415
416         setorigin(dropmark, trace_endpos);
417         picsize = drawgetimagesize(raptor_d) * 0.2;
418
419         if not (where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)
420         {
421             where_x -= picsize_x * 0.5;
422             where_y -= picsize_y * 0.5;
423             where_z = 0;
424             drawpic(where, raptor_d, picsize, '0 2 0', 1, DRAWFLAG_ADDITIVE);
425         }
426         dropmark.cnt = time + 5;
427     }
428     else
429     {
430         if(dropmark.cnt > time)
431         {
432             where = project_3d_to_2d(dropmark.origin);
433             picsize = drawgetimagesize(raptor_d) * 0.25;
434
435             if not (where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)
436             {
437                 where_x -= picsize_x * 0.5;
438                 where_y -= picsize_y * 0.5;
439                 where_z = 0;
440                 drawpic(where, raptor_d, picsize, '2 0 0', 1, DRAWFLAG_ADDITIVE);
441             }
442         }
443     }
444
445         if (scoreboard_showscores)
446         {
447                 HUD_DrawScoreboard();
448                 HUD_DrawCenterPrint();
449         }
450
451 }
452
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"
459
460 #define waki_a1 "gfx/vehicles/sb_rocket.tga"
461 #define waki_a2 "gfx/vehicles/sb_cells.tga"
462
463 void CSQC_WAKIZASHI_HUD()
464 {
465         vector picsize, hudloc;
466
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);
471
472     /*
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);
477         */
478     
479     HUD_GETSTATS
480     
481     hudloc_y =  4;
482     hudloc_x = 4;
483
484     picsize = drawgetimagesize(waki_h) * 0.5;
485     drawpic(hudloc, waki_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
486
487     picsize = drawgetimagesize(waki_a2) * 0.7;
488     drawpic(hudloc + '116 92  0', waki_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
489
490
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);
494
495     picsize = drawgetimagesize(waki_a1) * 0.75;
496     if(reload1 == 100)
497     {
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);
500     }
501     else
502     {
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);
506     }
507
508     picsize = drawgetimagesize(waki_b) * 0.5;
509     hudloc_y = 10.5;
510     hudloc_x = 10.5;
511     
512     health /= 100;
513     energy /= 100;
514     shield /= 100;
515     reload1 /= 100;
516     
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);
521
522         if (scoreboard_showscores)
523         {
524                 HUD_DrawScoreboard();
525                 HUD_DrawCenterPrint();
526         }
527
528 }
529
530 void Vehicles_Precache()
531 {
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");
537 }
538
539
540 void RaptorCBShellfragDraw()
541 {
542         Movetype_Physics_MatchTicrate(autocvar_cl_gibs_ticrate, autocvar_cl_gibs_sloppy);
543         if(wasfreed(self))
544                 return;
545
546         self.move_avelocity += randomvec() * 15;
547         self.renderflags = 0;
548         if(self.cnt < time)
549         self.alpha = bound(0, self.nextthink - time, 1);
550
551         if(self.alpha < ALPHA_MIN_VISIBLE)
552         remove(self);
553
554 }
555 void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang)
556 {
557     entity sfrag;
558
559     sfrag = spawn();
560     setmodel(sfrag, "models/vehicles/clusterbomb_fragment.md3");
561     setorigin(sfrag, _org);
562
563         sfrag.move_movetype = MOVETYPE_BOUNCE;
564         sfrag.gravity = 0.15;
565         sfrag.solid = SOLID_CORPSE;
566
567         sfrag.draw = RaptorCBShellfragDraw;
568
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;
573
574         sfrag.move_time = time;
575         sfrag.damageforcescale = 4;
576
577         sfrag.nextthink = time + 3;
578         sfrag.cnt = time + 2;
579     sfrag.drawmask = MASK_NORMAL;
580
581
582 }