]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/client/vehicles/vehicles.qc
New spider hud
[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/axh-special1.tga"
5
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
12 #define hud_bg "gfx/vehicles/frame.tga"
13 #define hud_sh "gfx/vehicles/vh-shield.tga"
14
15 #define hud_hp_bar "gfx/vehicles/bar_up_left.tga"
16 #define hud_hp_ico "gfx/vehicles/health.tga"
17 #define hud_sh_bar "gfx/vehicles/bar_dwn_left.tga"
18 #define hud_sh_ico "gfx/vehicles/shield.tga"
19
20 #define hud_ammo1_bar "gfx/vehicles/bar_up_right.tga"
21 #define hud_ammo1_ico "gfx/vehicles/bullets.tga"
22 #define hud_ammo2_bar "gfx/vehicles/bar_dwn_right.tga"
23 #define hud_ammo2_ico "gfx/vehicles/rocket.tga"
24
25 #define spider_ico  "gfx/vehicles/sbot.tga"
26 #define spider_rkt  "gfx/vehicles/sbot_rpods.tga"
27 #define spider_mgun "gfx/vehicles/sbot_mguns.tga"
28
29 #define raptor_ico  "gfx/vehicles/raptor.tga"
30 #define raptor_gun  "gfx/vehicles/raptor_guns.tga"
31 #define raptor_bomb "gfx/vehicles/raptor_bombs.tga"
32 #define raptor_drop "gfx/vehicles/axh-dropcross.tga"
33
34 #define waki_ico "gfx/vehicles/waki.tga"
35 #define waki_eng "gfx/vehicles/waki_e.tga"
36 #define waki_gun "gfx/vehicles/waki_guns.tga"
37 #define waki_rkt "gfx/vehicles/waki_rockets.tga"
38
39 entity dropmark;
40
41 void CSQC_WAKIZASHI_HUD();
42 void CSQC_SPIDER_HUD();
43 void CSQC_RAPTOR_HUD();
44 void CSQC_BUMBLE_HUD();
45
46 #define MAX_AXH 4
47 entity AuxiliaryXhair[MAX_AXH];
48 const var void Draw_Not();
49
50 .string axh_image;
51 .float  axh_fadetime;
52 .float  axh_drawflag;
53 .float  axh_scale;
54
55 void AuxiliaryXhair_Draw2D()
56 {
57     vector loc, psize;
58
59     psize = self.axh_scale * drawgetimagesize(self.axh_image);
60     loc = project_3d_to_2d(self.origin) - 0.5 * psize;
61     if not (loc_z < 0 || loc_x < 0 || loc_y < 0 || loc_x > vid_conwidth || loc_y > vid_conheight)
62     {
63         loc_z = 0;
64         psize_z = 0;
65         drawpic(loc, self.axh_image, psize, self.colormod, self.alpha, self.axh_drawflag);
66     }
67
68     if(time - self.cnt > self.axh_fadetime)
69         self.draw2d = Draw_Not;
70 }
71
72 void Net_AuXair2(float bIsNew)
73 {
74     float axh_id;
75     entity axh;
76
77     axh_id = bound(0, ReadByte(), MAX_AXH);
78     axh = AuxiliaryXhair[axh_id];
79
80     if(axh == world || wasfreed(axh))  // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
81     {
82         axh               = spawn();
83                 axh.draw2d        = Draw_Not;
84                 axh.drawmask      = MASK_NORMAL;
85                 axh.axh_drawflag  = DRAWFLAG_ADDITIVE;
86                 axh.axh_fadetime  = 0.1;
87                 axh.axh_image     = "gfx/vehicles/axh-ring.tga";
88                 axh.axh_scale     = 1;
89         axh.alpha         = 1;
90                 AuxiliaryXhair[axh_id] = axh;
91     }
92
93     axh.draw2d   = AuxiliaryXhair_Draw2D;
94
95         axh.origin_x = ReadCoord();
96         axh.origin_y = ReadCoord();
97         axh.origin_z = ReadCoord();
98
99         axh.colormod_x = ReadByte() / 255;
100         axh.colormod_y = ReadByte() / 255;
101         axh.colormod_z = ReadByte() / 255;
102     axh.cnt = time;
103 }
104
105 void Net_VehicleSetup()
106 {
107
108     float hud_id, i;
109     hud_id = bound(HUD_SPIDERBOT, ReadByte(), HUD_RAPTOR);
110
111     // Init auxiliary crosshairs
112     entity axh;
113     for(i = 0; i < MAX_AXH; ++i)
114     {
115         axh = AuxiliaryXhair[i];
116         if(axh != world && !wasfreed(axh))  // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
117             remove(axh);
118
119         axh               = spawn();
120                 axh.draw2d        = Draw_Not;
121                 axh.drawmask      = MASK_NORMAL;
122                 axh.axh_drawflag  = DRAWFLAG_ADDITIVE;
123                 axh.axh_fadetime  = 0.1;
124                 axh.axh_image     = "gfx/vehicles/axh-ring.tga";
125                 axh.axh_scale     = 1;
126         axh.alpha         = 1;
127                 AuxiliaryXhair[i] = axh;
128     }
129
130     switch(hud_id)
131     {
132         case HUD_SPIDERBOT:
133             // Minigun1
134             AuxiliaryXhair[0].axh_image   = "gfx/vehicles/axh-ring.tga";
135             AuxiliaryXhair[0].axh_scale   = 0.25;
136             // Minigun2
137             AuxiliaryXhair[1].axh_image   = "gfx/vehicles/axh-ring.tga";
138             AuxiliaryXhair[1].axh_scale   = 0.25;
139             // Rocket
140             AuxiliaryXhair[2].axh_image   = "gfx/vehicles/axh-special1.tga";
141             AuxiliaryXhair[2].axh_scale   = 0.5;
142             break;
143
144         case HUD_WAKIZASHI:
145             AuxiliaryXhair[0].axh_image   = "gfx/vehicles/axh-bracket.tga";
146             AuxiliaryXhair[0].axh_scale   = 0.25;
147             break;
148
149         case HUD_RAPTOR:
150             AuxiliaryXhair[0].axh_image   = "gfx/vehicles/axh-cross.tga";
151             AuxiliaryXhair[0].axh_scale   = 0.5;
152             AuxiliaryXhair[0].alpha       = 0.25;
153
154             AuxiliaryXhair[1].axh_image   = "gfx/vehicles/axh-bracket.tga";
155             AuxiliaryXhair[1].axh_scale   = 0.25;
156             AuxiliaryXhair[1].alpha       = 0.75;
157             AuxiliaryXhair[1].axh_drawflag  = DRAWFLAG_NORMAL;
158             break;
159
160         case HUD_BUMBLEBEE:
161             // Plasma cannons
162             AuxiliaryXhair[0].axh_image   = "gfx/vehicles/axh-ring.tga";
163             AuxiliaryXhair[0].axh_scale   = 0.25;
164             // Raygun
165             AuxiliaryXhair[1].axh_image   = "gfx/vehicles/axh-special1.tga";
166             AuxiliaryXhair[1].axh_scale   = 0.25;
167             break;
168     }
169 }
170 #define HUD_GETSTATS \
171     float health    = getstati(STAT_VEHICLESTAT_HEALTH); \
172         float shield    = getstati(STAT_VEHICLESTAT_SHIELD); \
173         float energy    = getstati(STAT_VEHICLESTAT_ENERGY); \
174         float ammo1     = getstati(STAT_VEHICLESTAT_AMMO1); \
175         float reload1   = getstati(STAT_VEHICLESTAT_RELOAD1); \
176         float ammo2     = getstati(STAT_VEHICLESTAT_AMMO2); \
177         float reload2   = getstati(STAT_VEHICLESTAT_RELOAD2);
178
179 void CSQC_BUMBLE_HUD()
180 {
181     /*
182         vector picsize, hudloc;
183
184     // Fetch health & ammo stats
185         HUD_GETSTATS
186
187     hudloc_y = 4;
188     hudloc_x = 4;
189
190     picsize = drawgetimagesize(spider_h) * 0.5;
191     drawpic(hudloc, spider_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
192
193     picsize = drawgetimagesize(spider_a2) * 0.5;
194     drawpic(hudloc + '120 96  0', spider_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
195
196     drawstring(hudloc + '145 19  0',  strcat(ftos(health), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
197     drawstring(hudloc + '175 34  0',  strcat(ftos(shield), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
198     drawstring(hudloc + '136 102  0', strcat(ftos(ammo1), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
199
200     picsize = drawgetimagesize(spider_a1) * 0.85;
201     if(ammo2 == 9)
202     {
203         drawpic(hudloc + '132 54  0', spider_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
204         drawstring(hudloc + '179 69 0', strcat(ftos(reload2), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
205     }
206     else
207     {
208         drawpic(hudloc + '132 54  0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
209         drawstring(hudloc + '179 69  0', strcat(ftos(9 - ammo2), " / 8"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
210     }
211
212     picsize = drawgetimagesize(spider_b) * 0.5;
213     hudloc_y = 10.5;
214     hudloc_x = 10.5;
215
216     ammo1  /= 100;
217     shield /= 100;
218     health /= 100;
219     reload2 /= 100;
220
221     drawpic(hudloc, spider_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
222     drawpic(hudloc, spider_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
223     drawpic(hudloc, spider_r, picsize, '1 1 1' * reload2 + '1 0 0' * (1 - reload2), 1, DRAWFLAG_NORMAL);
224     drawpic(hudloc, spider_g, picsize, '1 1 1' * ammo1 + '1 0 0' *  (1 - ammo1), 1, DRAWFLAG_NORMAL);
225
226
227         if (scoreboard_showscores)
228         {
229                 HUD_DrawScoreboard();
230                 HUD_DrawCenterPrint();
231     }
232     else
233     {
234         picsize = drawgetimagesize(SPIDER_CROSS);
235         picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size;
236         picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size;
237
238         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);
239     */
240 }
241
242 float autocvar_cl_vehicles_hudscale;
243 float autocvar_cl_vehicles_hudalpha;
244 float flashtime;
245 void CSQC_SPIDER_HUD()
246 {
247     vector picsize, hudloc, pic2size, picloc;
248
249     // Fetch health & ammo stats
250         HUD_GETSTATS
251
252     picsize = drawgetimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
253     hudloc_y = vid_conheight - picsize_y;
254     hudloc_x = vid_conwidth * 0.5 - picsize_x * 0.5;
255
256     drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
257
258     //drawstring(hudloc + '145 19  0', strcat(ftos(health), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
259     //drawstring(hudloc + '175 34  0', strcat(ftos(shield), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
260     //drawstring(hudloc + '136 102  0', strcat(ftos(ammo1), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
261     //drawstring(hudloc + '179 69  0', strcat(ftos(9 - ammo2), " / 8"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
262
263     ammo1   *= 0.01;
264     shield  *= 0.01;
265     health  *= 0.01;
266     reload2 *= 0.01;
267
268     pic2size = drawgetimagesize(spider_ico) * (autocvar_cl_vehicles_hudscale * 0.8);
269     picloc = picsize * 0.5 - pic2size * 0.5;
270     drawpic(hudloc + picloc, spider_ico, pic2size,  '1 1 1' * health  + '1 0 0' * (1 - health),  1, DRAWFLAG_NORMAL);
271     drawpic(hudloc + picloc, spider_rkt, pic2size,  '1 1 1' * reload2 + '1 0 0' * (1 - reload2), 1, DRAWFLAG_NORMAL);
272     drawpic(hudloc + picloc, spider_mgun, pic2size, '1 1 1' * ammo1   + '1 0 0' * (1 - ammo1),   1, DRAWFLAG_NORMAL);
273     drawpic(hudloc + picloc, hud_sh, pic2size,  '1 1 1', shield, DRAWFLAG_NORMAL);
274
275 // Health bar
276     picsize = drawgetimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale;
277     picloc = '69 69 0' * autocvar_cl_vehicles_hudscale;
278     drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - health)), 0, vid_conwidth, vid_conheight);
279     drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL);
280     drawresetcliparea();
281 // ..  and icon
282     picsize = drawgetimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale;
283     picloc = '37 65 0' * autocvar_cl_vehicles_hudscale;
284     if(health < 0.25)
285         drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
286     else
287         drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
288
289 // Shield bar
290     picsize = drawgetimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale;
291     picloc = '69 140 0' * autocvar_cl_vehicles_hudscale;
292     drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - shield)), 0, vid_conwidth, vid_conheight);
293     drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
294     drawresetcliparea();
295 // ..  and icon
296     picloc = '40 136 0' * autocvar_cl_vehicles_hudscale;
297     picsize = drawgetimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale;
298     if(shield < 0.25)
299         drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
300     else
301         drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
302
303     // Minigun bar
304     picsize = drawgetimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale;
305     picloc = '450 69 0' * autocvar_cl_vehicles_hudscale;
306     drawsetcliparea(hudloc_x + picloc_x, picloc_y, picsize_x * ammo1, vid_conheight);
307     drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
308     drawresetcliparea();
309     // ..  and icon
310     picsize = drawgetimagesize(hud_ammo1_ico) * autocvar_cl_vehicles_hudscale;
311     picloc = '664 60 0' * autocvar_cl_vehicles_hudscale;
312     if(ammo1 < 0.2)
313         drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
314     else
315         drawpic(hudloc + picloc, hud_ammo1_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
316
317     // Rocket ammo bar
318     float i;
319     picsize = drawgetimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale;
320     ammo1 = picsize_x / 8;
321     picloc = '450 140 0' * autocvar_cl_vehicles_hudscale;
322     drawsetcliparea(hudloc_x + picloc_x, hudloc_y + picloc_y, picsize_x * reload2, vid_conheight);
323     drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
324     drawresetcliparea();
325
326     // ..  and icon/s
327     pic2size = 0.35 * drawgetimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
328     picloc_x -= pic2size_x;
329     picloc_y += pic2size_y * 2.25;
330     if(ammo2 == 9)
331     {
332         for(i = 1; i < 9; ++i)
333         {
334             picloc_x += ammo1;
335             drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, ((8 * reload2 <= i) ? '0 0 0' : '1 1 1'), 0.75, DRAWFLAG_NORMAL);
336         }
337     }
338     else
339     {
340         for(i = 1; i < 9; ++i)
341         {
342             picloc_x += ammo1;
343             drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, ((i >= ammo2) ? '1 1 1' : '0 0 0'), 0.75, DRAWFLAG_NORMAL);
344         }
345     }
346     pic2size = drawgetimagesize(hud_ammo2_ico) * autocvar_cl_vehicles_hudscale;
347     picloc = '664 130 0' * autocvar_cl_vehicles_hudscale;
348     if(ammo2 == 9)
349         drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL);
350     else
351         drawpic(hudloc + picloc, hud_ammo2_ico, pic2size, '1 1 1', 1, DRAWFLAG_NORMAL);
352
353
354     HUD_DrawCenterPrint();
355
356         if (scoreboard_showscores)
357                 HUD_DrawScoreboard();
358     else
359     {
360         picsize = drawgetimagesize(SPIDER_CROSS);
361         picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size;
362         picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size;
363
364         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);
365     }
366 }
367
368
369 void CSQC_RAPTOR_HUD()
370 {
371 /*
372         if(autocvar_r_letterbox)
373         return;
374
375         vector picsize, hudloc;
376     vector where;
377
378
379     // Fetch health & ammo stats
380     HUD_GETSTATS
381
382     // Draw the crosshairs
383     picsize = drawgetimagesize("gfx/vehicles/axh-cross.tga");
384     picsize_x *= 0.75;
385     picsize_y *= 0.75;
386     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);
387
388     hudloc_y = 4;
389     hudloc_x = 4;
390
391     picsize = drawgetimagesize(raptor_h) * 0.5;
392     drawpic(hudloc, raptor_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
393
394     picsize = drawgetimagesize(spider_a2) * 0.5;
395     drawpic(hudloc + '120 96  0', spider_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
396
397     drawstring(hudloc + '145 19  0', strcat(ftos(health), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
398     drawstring(hudloc + '175 34  0', strcat(ftos(shield), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
399     drawstring(hudloc + '136 102 0', strcat(ftos(energy), "%"),'15 15 0','0.5 0.5 1', 1, DRAWFLAG_NORMAL);
400
401     health /= 100;
402     shield /= 100;
403     energy /= 100;
404
405     picsize = drawgetimagesize(spider_a1) * 0.85;
406     if(reload2 == 100)
407     {
408         drawpic(hudloc + '132 54  0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
409         drawstring(hudloc + '179 69  0', strcat(ftos(reload2), "%"),'14 14 0','0 1 0', 0.5, DRAWFLAG_NORMAL);
410     }
411     else
412     {
413         drawpic(hudloc + '132 54  0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
414         drawstring(hudloc + '179 69  0', strcat(ftos(reload2), "%"),'14 14 0','0 0 1', 1, DRAWFLAG_NORMAL);
415     }
416
417     picsize = drawgetimagesize(raptor_b) * 0.5;
418     hudloc_y = 10.5;
419     hudloc_x = 10.5;
420     reload1 = reload2 / 100;
421     drawpic(hudloc, raptor_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
422     drawpic(hudloc, raptor_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
423     drawpic(hudloc, raptor_g1, picsize, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
424     drawpic(hudloc, raptor_g2, picsize, '1 1 1' * reload1 + '1 0 0' *  (1 - reload1), 1, DRAWFLAG_NORMAL);
425
426     if(!dropmark)
427     {
428         dropmark = spawn();
429         dropmark.owner = self;
430         dropmark.gravity = 1;
431     }
432
433     if(reload2 == 100)
434     {
435         where = dropmark.origin;
436         setorigin(dropmark, pmove_org);
437         dropmark.velocity = pmove_vel;
438         tracetoss(dropmark, self);
439
440         where = project_3d_to_2d(trace_endpos);
441
442         setorigin(dropmark, trace_endpos);
443         picsize = drawgetimagesize(raptor_d) * 0.2;
444
445         if not (where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)
446         {
447             where_x -= picsize_x * 0.5;
448             where_y -= picsize_y * 0.5;
449             where_z = 0;
450             drawpic(where, raptor_d, picsize, '0 2 0', 1, DRAWFLAG_ADDITIVE);
451         }
452         dropmark.cnt = time + 5;
453     }
454     else
455     {
456         if(dropmark.cnt > time)
457         {
458             where = project_3d_to_2d(dropmark.origin);
459             picsize = drawgetimagesize(raptor_d) * 0.25;
460
461             if not (where_z < 0 || where_x < 0 || where_y < 0 || where_x > vid_conwidth || where_y > vid_conheight)
462             {
463                 where_x -= picsize_x * 0.5;
464                 where_y -= picsize_y * 0.5;
465                 where_z = 0;
466                 drawpic(where, raptor_d, picsize, '2 0 0', 1, DRAWFLAG_ADDITIVE);
467             }
468         }
469     }
470
471         if (scoreboard_showscores)
472         {
473                 HUD_DrawScoreboard();
474                 HUD_DrawCenterPrint();
475         }
476 */
477 }
478
479 void CSQC_WAKIZASHI_HUD()
480 {
481 /*
482         vector picsize, hudloc;
483
484     picsize = drawgetimagesize(SPIDER_CROSS);
485     picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size;
486     picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size;
487     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);
488
489     HUD_GETSTATS
490
491     hudloc_y =  4;
492     hudloc_x = 4;
493
494     picsize = drawgetimagesize(waki_h) * 0.5;
495     drawpic(hudloc, waki_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
496
497     picsize = drawgetimagesize(waki_a2) * 0.7;
498     drawpic(hudloc + '116 92  0', waki_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
499
500
501     drawstring(hudloc + '145 19  0', strcat(ftos(health), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
502     drawstring(hudloc + '175 34  0', strcat(ftos(shield), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
503     drawstring(hudloc + '136 102  0', strcat(ftos(energy), "%"),'14 14 0','1 1 1', 1, DRAWFLAG_NORMAL);
504
505     picsize = drawgetimagesize(waki_a1) * 0.75;
506     if(reload1 == 100)
507     {
508         drawpic(hudloc + '140 55  0', waki_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
509         drawpic(hudloc + '144 59  0', waki_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
510     }
511     else
512     {
513         drawpic(hudloc + '140 55  0', waki_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
514         drawpic(hudloc + '144 59  0', waki_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
515         drawstring(hudloc + '165 69 0', strcat(ftos(reload1), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
516     }
517
518     picsize = drawgetimagesize(waki_b) * 0.5;
519     hudloc_y = 10.5;
520     hudloc_x = 10.5;
521
522     health /= 100;
523     energy /= 100;
524     shield /= 100;
525     reload1 /= 100;
526
527     drawpic(hudloc, waki_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
528     drawpic(hudloc, waki_b, picsize, '0 1 0' * health + '1 0 0'  * (1 - health), 1, DRAWFLAG_NORMAL);
529     drawpic(hudloc, waki_r, picsize, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
530     drawpic(hudloc, waki_e, picsize, '1 1 1' * energy + '1 0 0'  * (1 - energy), 1, DRAWFLAG_NORMAL);
531
532         if (scoreboard_showscores)
533         {
534                 HUD_DrawScoreboard();
535                 HUD_DrawCenterPrint();
536         }
537 */
538 }
539
540 void Vehicles_Precache()
541 {
542         precache_model("models/vehicles/wakizashi.dpm");
543
544         precache_model("models/vehicles/bomblet.md3");
545         precache_model("models/vehicles/clusterbomb.md3");
546         precache_model("models/vehicles/clusterbomb_fragment.md3");
547         precache_model("models/vehicles/rocket01.md3");
548         precache_model("models/vehicles/rocket02.md3");
549 }
550
551 void RaptorCBShellfragDraw()
552 {
553         Movetype_Physics_MatchTicrate(autocvar_cl_gibs_ticrate, autocvar_cl_gibs_sloppy);
554         if(wasfreed(self))
555                 return;
556
557         self.move_avelocity += randomvec() * 15;
558         self.renderflags = 0;
559         if(self.cnt < time)
560         self.alpha = bound(0, self.nextthink - time, 1);
561
562         if(self.alpha < ALPHA_MIN_VISIBLE)
563         remove(self);
564
565 }
566
567 void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang)
568 {
569     entity sfrag;
570
571     sfrag = spawn();
572     setmodel(sfrag, "models/vehicles/clusterbomb_fragment.md3");
573     setorigin(sfrag, _org);
574
575         sfrag.move_movetype = MOVETYPE_BOUNCE;
576         sfrag.gravity = 0.15;
577         sfrag.solid = SOLID_CORPSE;
578
579         sfrag.draw = RaptorCBShellfragDraw;
580
581         sfrag.move_origin = sfrag.origin = _org;
582         sfrag.move_velocity = _vel;
583         sfrag.move_avelocity = prandomvec() * vlen(sfrag.move_velocity);
584         sfrag.angles = self.move_angles = _ang;
585
586         sfrag.move_time = time;
587         sfrag.damageforcescale = 4;
588
589         sfrag.nextthink = time + 3;
590         sfrag.cnt = time + 2;
591     sfrag.drawmask = MASK_NORMAL;
592 }