]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/client/vehicles/vehicles.qc
Fix rocket reload displaybug on spider. Disable crosshair-trace-pich for spider....
[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 void Net_VehicleSetup()
100 {
101
102     float hud_id, i;
103     hud_id = bound(HUD_SPIDERBOT, ReadByte(), HUD_RAPTOR);
104
105     // Init auxiliary crosshairs
106     entity axh;
107     for(i = 0; i < MAX_AXH; ++i)
108     {
109         axh = AuxiliaryXhair[i];
110         if(axh != world && !wasfreed(axh))  // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
111             remove(axh);
112
113         axh               = spawn();
114                 axh.draw2d        = Draw_Not;
115                 axh.drawmask      = MASK_NORMAL;
116                 axh.axh_drawflag  = DRAWFLAG_ADDITIVE;
117                 axh.axh_fadetime  = 0.1;
118                 axh.axh_image     = "gfx/vehicles/axh-ring.tga";
119                 axh.axh_scale     = 1;
120         axh.alpha         = 1;
121                 AuxiliaryXhair[i] = axh;
122     }
123
124     switch(hud_id)
125     {
126         case HUD_SPIDERBOT:
127             // Minigun1
128             AuxiliaryXhair[0].axh_image   = "gfx/vehicles/axh-ring.tga";
129             AuxiliaryXhair[0].axh_scale   = 0.25;
130             // Minigun2
131             AuxiliaryXhair[1].axh_image   = "gfx/vehicles/axh-ring.tga";
132             AuxiliaryXhair[1].axh_scale   = 0.25;
133             // Rocket
134             AuxiliaryXhair[2].axh_image   = "gfx/vehicles/axh-special1.tga";
135             AuxiliaryXhair[2].axh_scale   = 0.5;
136             break;
137         case HUD_WAKIZASHI:
138             AuxiliaryXhair[0].axh_image   = "gfx/vehicles/axh-bracket.tga";
139             AuxiliaryXhair[0].axh_scale   = 0.25;
140             break;
141         case HUD_RAPTOR:
142             AuxiliaryXhair[0].axh_image   = "gfx/vehicles/axh-cross.tga";
143             AuxiliaryXhair[0].axh_scale   = 0.5;
144             AuxiliaryXhair[0].alpha       = 0.25;
145
146             AuxiliaryXhair[1].axh_image   = "gfx/vehicles/axh-bracket.tga";
147             AuxiliaryXhair[1].axh_scale   = 0.25;
148             AuxiliaryXhair[1].alpha       = 0.75;
149             AuxiliaryXhair[1].axh_drawflag  = DRAWFLAG_NORMAL;
150             break;
151         case HUD_BUMBLEBEE:
152             // Plasma cannons
153             AuxiliaryXhair[0].axh_image   = "gfx/vehicles/axh-ring.tga";
154             AuxiliaryXhair[0].axh_scale   = 0.25;
155             // Raygun
156             AuxiliaryXhair[1].axh_image   = "gfx/vehicles/axh-special1.tga";
157             AuxiliaryXhair[1].axh_scale   = 0.25;
158             break;
159     }
160 }
161 #define HUD_GETSTATS \
162     float health    = getstati(STAT_VEHICLESTAT_HEALTH); \
163         float shield    = getstati(STAT_VEHICLESTAT_SHIELD); \
164         float energy    = getstati(STAT_VEHICLESTAT_ENERGY); \
165         float ammo1     = getstati(STAT_VEHICLESTAT_AMMO1); \
166         float reload1   = getstati(STAT_VEHICLESTAT_RELOAD1); \
167         float ammo2     = getstati(STAT_VEHICLESTAT_AMMO2); \
168         float reload2   = getstati(STAT_VEHICLESTAT_RELOAD2);
169
170 void CSQC_BUMBLE_HUD()
171 {
172         vector picsize, hudloc;
173
174     // Fetch health & ammo stats
175         HUD_GETSTATS
176         
177     hudloc_y = 4;
178     hudloc_x = 4;
179     
180     picsize = drawgetimagesize(spider_h) * 0.5;
181     drawpic(hudloc, spider_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
182
183     picsize = drawgetimagesize(spider_a2) * 0.5;
184     drawpic(hudloc + '120 96  0', spider_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
185
186     drawstring(hudloc + '145 19  0',  strcat(ftos(health), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
187     drawstring(hudloc + '175 34  0',  strcat(ftos(shield), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
188     drawstring(hudloc + '136 102  0', strcat(ftos(ammo1), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
189
190     picsize = drawgetimagesize(spider_a1) * 0.85;
191     if(ammo2 == 9)
192     {
193         drawpic(hudloc + '132 54  0', spider_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
194         drawstring(hudloc + '179 69 0', strcat(ftos(reload2), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
195     }
196     else
197     {
198         drawpic(hudloc + '132 54  0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
199         drawstring(hudloc + '179 69  0', strcat(ftos(9 - ammo2), " / 8"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
200     }
201
202     picsize = drawgetimagesize(spider_b) * 0.5;
203     hudloc_y = 10.5;
204     hudloc_x = 10.5;
205     
206     ammo1  /= 100; 
207     shield /= 100;
208     health /= 100;
209     reload2 /= 100;
210     
211     drawpic(hudloc, spider_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
212     drawpic(hudloc, spider_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
213     drawpic(hudloc, spider_r, picsize, '1 1 1' * reload2 + '1 0 0' * (1 - reload2), 1, DRAWFLAG_NORMAL);
214     drawpic(hudloc, spider_g, picsize, '1 1 1' * ammo1 + '1 0 0' *  (1 - ammo1), 1, DRAWFLAG_NORMAL);
215
216
217         if (scoreboard_showscores)
218         {
219                 HUD_DrawScoreboard();
220                 HUD_DrawCenterPrint();
221     }
222     else
223     {
224         picsize = drawgetimagesize(SPIDER_CROSS);
225         picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size;
226         picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size;
227
228         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);
229     }
230 }
231
232
233 void CSQC_SPIDER_HUD()
234 {
235         vector picsize, hudloc;
236
237     // Fetch health & ammo stats
238         HUD_GETSTATS
239         
240     hudloc_y = 4;
241     hudloc_x = 4;
242     
243     picsize = drawgetimagesize(spider_h) * 0.5;
244     drawpic(hudloc, spider_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
245
246     picsize = drawgetimagesize(spider_a2) * 0.5;
247     drawpic(hudloc + '120 96  0', spider_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
248
249     drawstring(hudloc + '145 19  0', strcat(ftos(health), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
250     drawstring(hudloc + '175 34  0', strcat(ftos(shield), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
251     drawstring(hudloc + '136 102  0', strcat(ftos(ammo1), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
252
253     picsize = drawgetimagesize(spider_a1) * 0.85;
254     if(ammo2 == 9)
255     {
256         drawpic(hudloc + '132 54  0', spider_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
257         drawstring(hudloc + '179 69 0', strcat(ftos(reload2), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
258     }
259     else
260     {
261         drawpic(hudloc + '132 54  0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
262         drawstring(hudloc + '179 69  0', strcat(ftos(9 - ammo2), " / 8"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
263     }
264
265     picsize = drawgetimagesize(spider_b) * 0.5;
266     hudloc_y = 10.5;
267     hudloc_x = 10.5;
268     
269     ammo1  /= 100; 
270     shield /= 100;
271     health /= 100;
272     reload2 /= 100;
273     
274     drawpic(hudloc, spider_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
275     drawpic(hudloc, spider_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
276     drawpic(hudloc, spider_r, picsize, '1 1 1' * reload2 + '1 0 0' * (1 - reload2), 1, DRAWFLAG_NORMAL);
277     drawpic(hudloc, spider_g, picsize, '1 1 1' * ammo1 + '1 0 0' *  (1 - ammo1), 1, DRAWFLAG_NORMAL);
278
279
280         if (scoreboard_showscores)
281         {
282                 HUD_DrawScoreboard();
283                 HUD_DrawCenterPrint();
284     }
285     else
286     {
287         picsize = drawgetimagesize(SPIDER_CROSS);
288         picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size;
289         picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size;
290
291         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);
292     }
293 }
294
295
296 void CSQC_RAPTOR_HUD()
297 {
298         if(autocvar_r_letterbox)
299         return;
300         
301         vector picsize, hudloc, vel;
302         float movedt;
303     vector where;
304
305
306     // Fetch health & ammo stats
307     HUD_GETSTATS
308     
309     // Draw the crosshairs
310     picsize = drawgetimagesize("gfx/vehicles/axh-cross.tga");
311     picsize_x *= 0.75;
312     picsize_y *= 0.75;
313     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);
314
315     hudloc_y = 4;
316     hudloc_x = 4;
317
318     picsize = drawgetimagesize(raptor_h) * 0.5;
319     drawpic(hudloc, raptor_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
320
321     picsize = drawgetimagesize(spider_a2) * 0.5;
322     drawpic(hudloc + '120 96  0', spider_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
323
324     drawstring(hudloc + '145 19  0', strcat(ftos(health), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
325     drawstring(hudloc + '175 34  0', strcat(ftos(shield), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
326     drawstring(hudloc + '136 102 0', strcat(ftos(energy), "%"),'15 15 0','0.5 0.5 1', 1, DRAWFLAG_NORMAL);
327
328     health /= 100;
329     shield /= 100;
330     energy /= 100;
331
332     picsize = drawgetimagesize(spider_a1) * 0.85;
333     if(reload2 == 100)
334     {
335         drawpic(hudloc + '132 54  0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
336         drawstring(hudloc + '179 69  0', strcat(ftos(reload2), "%"),'14 14 0','0 1 0', 0.5, DRAWFLAG_NORMAL);
337     }
338     else
339     {
340         drawpic(hudloc + '132 54  0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
341         drawstring(hudloc + '179 69  0', strcat(ftos(reload2), "%"),'14 14 0','0 0 1', 1, DRAWFLAG_NORMAL);
342     }
343
344     picsize = drawgetimagesize(raptor_b) * 0.5;
345     hudloc_y = 10.5;
346     hudloc_x = 10.5;
347     reload1 = reload2 / 100;
348     drawpic(hudloc, raptor_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
349     drawpic(hudloc, raptor_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
350     drawpic(hudloc, raptor_g1, picsize, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
351     drawpic(hudloc, raptor_g2, picsize, '1 1 1' * reload1 + '1 0 0' *  (1 - reload1), 1, DRAWFLAG_NORMAL);
352
353     if(!dropmark)
354     {
355         dropmark = spawn();
356         dropmark.owner = self;
357         dropmark.gravity = 1;
358     }
359
360     if(reload2 == 100)
361     {
362         where = dropmark.origin;
363         setorigin(dropmark, pmove_org);
364         dropmark.velocity = pmove_vel;
365         tracetoss(dropmark, self);
366
367         where = project_3d_to_2d(trace_endpos);
368
369         setorigin(dropmark, trace_endpos);
370         picsize = drawgetimagesize(raptor_d) * 0.2;
371
372         if not (where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)
373         {
374             where_x -= picsize_x * 0.5;
375             where_y -= picsize_y * 0.5;
376             where_z = 0;
377             drawpic(where, raptor_d, picsize, '0 2 0', 1, DRAWFLAG_ADDITIVE);
378         }
379         dropmark.cnt = time + 5;
380     }
381     else
382     {
383         if(dropmark.cnt > time)
384         {
385             where = project_3d_to_2d(dropmark.origin);
386             picsize = drawgetimagesize(raptor_d) * 0.25;
387
388             if not (where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)
389             {
390                 where_x -= picsize_x * 0.5;
391                 where_y -= picsize_y * 0.5;
392                 where_z = 0;
393                 drawpic(where, raptor_d, picsize, '2 0 0', 1, DRAWFLAG_ADDITIVE);
394             }
395         }
396     }
397
398         if (scoreboard_showscores)
399         {
400                 HUD_DrawScoreboard();
401                 HUD_DrawCenterPrint();
402         }
403
404 }
405
406 #define waki_h "gfx/vehicles/hud_bg.tga"
407 #define waki_b "gfx/vehicles/waki.tga"
408 #define waki_e "gfx/vehicles/waki_e.tga"
409 #define waki_g "gfx/vehicles/waki_guns.tga"
410 #define waki_r "gfx/vehicles/waki_rockets.tga"
411 #define waki_s "gfx/vehicles/shiled.tga"
412
413 #define waki_a1 "gfx/vehicles/sb_rocket.tga"
414 #define waki_a2 "gfx/vehicles/sb_cells.tga"
415
416 void CSQC_WAKIZASHI_HUD()
417 {
418         vector picsize, hudloc;
419
420     picsize = drawgetimagesize(SPIDER_CROSS);
421     picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size;
422     picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size;
423     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);
424
425     /*
426     health  = min(getstatf(STAT_VEHICLESTAT_HEALTH),  1);
427         shield  = min(getstatf(STAT_VEHICLESTAT_SHIELD),  1);
428         energy  = min(getstatf(STAT_VEHICLESTAT_ENERGY),  1);
429         rockets = bound(0,getstatf(STAT_VEHICLESTAT_RELOAD1), 1);
430         */
431     
432     HUD_GETSTATS
433     
434     hudloc_y =  4;
435     hudloc_x = 4;
436
437     picsize = drawgetimagesize(waki_h) * 0.5;
438     drawpic(hudloc, waki_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
439
440     picsize = drawgetimagesize(waki_a2) * 0.7;
441     drawpic(hudloc + '116 92  0', waki_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
442
443
444     drawstring(hudloc + '145 19  0', strcat(ftos(health), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
445     drawstring(hudloc + '175 34  0', strcat(ftos(shield), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
446     drawstring(hudloc + '136 102  0', strcat(ftos(energy), "%"),'14 14 0','1 1 1', 1, DRAWFLAG_NORMAL);
447
448     picsize = drawgetimagesize(waki_a1) * 0.75;
449     if(reload1 == 100)
450     {
451         drawpic(hudloc + '140 55  0', waki_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
452         drawpic(hudloc + '144 59  0', waki_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
453     }
454     else
455     {
456         drawpic(hudloc + '140 55  0', waki_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
457         drawpic(hudloc + '144 59  0', waki_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
458         drawstring(hudloc + '165 69 0', strcat(ftos(reload1), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
459     }
460
461     picsize = drawgetimagesize(waki_b) * 0.5;
462     hudloc_y = 10.5;
463     hudloc_x = 10.5;
464     
465     health /= 100;
466     energy /= 100;
467     shield /= 100;
468     reload1 /= 100;
469     
470     drawpic(hudloc, waki_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
471     drawpic(hudloc, waki_b, picsize, '0 1 0' * health + '1 0 0'  * (1 - health), 1, DRAWFLAG_NORMAL);
472     drawpic(hudloc, waki_r, picsize, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
473     drawpic(hudloc, waki_e, picsize, '1 1 1' * energy + '1 0 0'  * (1 - energy), 1, DRAWFLAG_NORMAL);
474
475         if (scoreboard_showscores)
476         {
477                 HUD_DrawScoreboard();
478                 HUD_DrawCenterPrint();
479         }
480
481 }
482
483 void Vehicles_Precache()
484 {
485         precache_model("models/vehicles/bomblet.md3");
486         precache_model("models/vehicles/clusterbomb.md3");
487         precache_model("models/vehicles/clusterbomb_fragment.md3");
488         precache_model("models/vehicles/rocket01.md3");
489         precache_model("models/vehicles/rocket02.md3");
490 }
491
492
493 void RaptorCBShellfragDraw()
494 {
495         Movetype_Physics_MatchTicrate(autocvar_cl_gibs_ticrate, autocvar_cl_gibs_sloppy);
496         if(wasfreed(self))
497                 return;
498
499         self.move_avelocity += randomvec() * 15;
500         self.renderflags = 0;
501         if(self.cnt < time)
502         self.alpha = bound(0, self.nextthink - time, 1);
503
504         if(self.alpha < ALPHA_MIN_VISIBLE)
505         remove(self);
506
507 }
508 void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang)
509 {
510     entity sfrag;
511
512     sfrag = spawn();
513     setmodel(sfrag, "models/vehicles/clusterbomb_fragment.md3");
514     setorigin(sfrag, _org);
515
516         sfrag.move_movetype = MOVETYPE_BOUNCE;
517         sfrag.gravity = 0.15;
518         sfrag.solid = SOLID_CORPSE;
519
520         sfrag.draw = RaptorCBShellfragDraw;
521
522         sfrag.move_origin = sfrag.origin = _org;
523         sfrag.move_velocity = _vel;
524         sfrag.move_avelocity = prandomvec() * vlen(sfrag.move_velocity);
525         sfrag.angles = self.move_angles = _ang;
526
527         sfrag.move_time = time;
528         sfrag.damageforcescale = 4;
529
530         sfrag.nextthink = time + 3;
531         sfrag.cnt = time + 2;
532     sfrag.drawmask = MASK_NORMAL;
533
534
535 }