1 /**
2  * @file controller_projectiles.cc
3  * @brief Projectiles controller for a single paddle!
4  * @date 2007-10-24
5  * @copyright 1991-2014 TLK Games
6  * @author Bruno Ethvignot
7  * @version $Revision: 24 $
8  */
9 /*
10  * copyright (c) 1991-2014 TLK Games all rights reserved
11  * $Id: controller_projectiles.cc 24 2014-09-28 15:30:04Z bruno.ethvignot@gmail.com $
12  *
13  * TecnoballZ is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 3 of the License, or
16  * (at your option) any later version.
17  *
18  * TecnoballZ is distributed in the hope that it will be useful, but
19  * WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
26  * MA  02110-1301, USA.
27  */
28 #include "../include/controller_projectiles.h"
29 
30 /**
31  * Create the projectiles controller
32  */
controller_projectiles()33 controller_projectiles::controller_projectiles ()
34 {
35   littleInit ();
36   countTempo = 0;
37   max_of_sprites = MAX_OF_PROJECTILES;
38   sprites_have_shades = false;
39   sprite_type_id = sprite_object::PROJECTILES;
40   if (resolution == 1)
41     {
42       circular_sin = &circular_sin_320[0];
43     }
44   else
45     {
46       circular_sin = &circular_sin_640[0];
47     }
48 }
49 
50 /**
51  * Release the projectiles controller
52  */
~controller_projectiles()53 controller_projectiles::~controller_projectiles ()
54 {
55   release_sprites_list ();
56 }
57 
58 /**
59  * Create and initialize the list of projectiles sprites
60  * @param paddle a pointer to a paddle sprite
61  */
62 void
create_projectiles_list(sprite_paddle * paddle)63 controller_projectiles::create_projectiles_list (sprite_paddle * paddle)
64 {
65   create_sprites_list ();
66   gun_paddle = paddle;
67   sprite_projectile **projectiles = sprites_list;
68   for (Uint32 i = 0; i < max_of_sprites; i++)
69     {
70       sprite_projectile *projectile = *(projectiles++);
71       projectile->init_members (paddle);
72     }
73   set_fire_1 ();
74 }
75 
76 /**
77  * Check if fire is available
78  */
79 void
disponible()80 controller_projectiles::disponible ()
81 {
82 
83   if (gun_paddle->fire_state == sprite_paddle::NOT_OWN_GUN)
84     {
85       /* not fire available */
86       return;
87     }
88 
89   Uint32 t = max_of_sprites;
90   sprite_projectile **projectiles = sprites_list;
91 
92   /* special fire 7 (circular fire) */
93   if (gun_paddle->length == gun_paddle->width_maxi)
94     {
95       for (Uint32 i = 0; i < t; i++)
96         {
97           sprite_projectile *projectile = *(projectiles++);
98           if (!projectile->on_paddle)
99             {
100               return;
101             }
102         }
103     }
104 
105   /* other fires */
106   else
107     {
108       for (Uint32 i = 0; i < t; i++)
109         {
110           sprite_projectile *projectile = *(projectiles++);
111           if (projectile->is_enabled)
112             {
113               return;
114             }
115         }
116     }
117   countTempo = 0;
118   /** fire is requested */
119   gun_paddle->fire_state = sprite_paddle::FIRE;
120 #ifndef SOUNDISOFF
121   audio->play_sound (handler_audio::PADDLE_FIRE);
122 #endif
123 }
124 
125 /**
126  * New fire start
127  */
128 void
fire()129 controller_projectiles::fire ()
130 {
131   if (gun_paddle->fire_state != sprite_paddle::NOT_OWN_GUN)
132     {
133       Sint32 i = gun_paddle->length;
134       paddle_length = i;
135       /* smallest paddle is of 16/32 pixels width */
136       i -= gun_paddle->width_mini;
137       /* size of paddle step by 8/16 pixels */
138       i >>= gun_paddle->shift_width;
139       switch (i)
140         {
141         case 0:
142           init_type1 ();
143           break;
144         case 1:
145           init_type2 ();
146           break;
147         case 2:
148           init_type3 ();
149           break;
150         case 3:
151           init_type4 ();
152           break;
153         case 4:
154           init_type5 ();
155           break;
156         case 5:
157           init_type6 ();
158           break;
159         case 6:
160           init_type7 ();
161           break;
162         }
163     }
164 }
165 
166 /**
167  * Fire 1: 16/32 pixels paddle's whidth
168  */
169 void
init_type1()170 controller_projectiles::init_type1 ()
171 {
172   sprite_paddle *paddle = gun_paddle;
173   if (paddle->fire_state != sprite_paddle::FIRE)
174     {
175       return;
176     }
177   paddle->fire_state = sprite_paddle::OWN_GUN;
178   Sint32 x = paddle->x_coord;
179   Sint32 y = paddle->y_coord;
180   if (paddle->is_vertical)
181     {
182       y += (paddle_length / 2) - (SIZE_OF_PROJECTILE / 2);
183     }
184   else
185     {
186       x += (paddle_length / 2) - (SIZE_OF_PROJECTILE / 2);
187     }
188   sprite_projectile *projectile = sprites_list[0];
189   projectile->is_enabled = true;
190   projectile->x_coord = x;
191   projectile->y_coord = y;
192 }
193 
194 /**
195  * Fire 2: 24/48 pixels paddle's whidth
196  */
197 void
init_type2()198 controller_projectiles::init_type2 ()
199 {
200   sprite_paddle *paddle = gun_paddle;
201   if (paddle->fire_state != sprite_paddle::FIRE)
202     {
203       return;
204     }
205   paddle->fire_state = sprite_paddle::OWN_GUN;
206   Sint32 x = paddle->x_coord;
207   Sint32 y = paddle->y_coord;
208   if (paddle->is_vertical)
209     {
210       y += (paddle_length / 2) - (SIZE_OF_PROJECTILE / 2);
211     }
212   else
213     {
214       x += (paddle_length / 2) - (SIZE_OF_PROJECTILE / 2);
215     }
216   sprite_projectile **projectiles = sprites_list;
217   sprite_projectile *projectile;
218   projectile = *(projectiles++);
219   projectile->is_enabled = true;
220   projectile->x_coord = x;
221   projectile->y_coord = y;
222   projectile = *(projectiles++);
223   projectile->is_enabled = true;
224   projectile->x_coord = x;
225   projectile->y_coord = y;
226 }
227 
228 /**
229  * Fire 3: 24/48 pixels paddle's whidth
230  */
231 void
init_type3()232 controller_projectiles::init_type3 ()
233 {
234   sprite_paddle *paddle = gun_paddle;
235   if (paddle->fire_state != sprite_paddle::FIRE)
236     {
237       return;
238     }
239   paddle->fire_state = sprite_paddle::OWN_GUN;
240   Sint32 x = paddle->x_coord;
241   Sint32 y = paddle->y_coord;
242   if (paddle->is_vertical)
243     {
244       y += (paddle_length / 2) - (SIZE_OF_PROJECTILE / 2);
245     }
246   else
247     {
248       x += (paddle_length / 2) - (SIZE_OF_PROJECTILE / 2);
249     }
250   sprite_projectile **projectiles = sprites_list;
251   sprite_projectile *projectile;
252   projectile = *(projectiles++);
253   projectile->is_enabled = true;
254   projectile->x_coord = x;
255   projectile->y_coord = y;
256   projectile = *(projectiles++);
257   projectile->is_enabled = true;
258   projectile->x_coord = x;
259   projectile->y_coord = y;
260   projectile = *projectiles;
261   projectile->is_enabled = true;
262   projectile->x_coord = x;
263   projectile->y_coord = y;
264 }
265 
266 /**
267  * Fire 4: 40/80 pixels paddle's whidth
268  */
269 void
init_type4()270 controller_projectiles::init_type4 ()
271 {
272   sprite_paddle *paddle = gun_paddle;
273   if (paddle->fire_state != sprite_paddle::FIRE)
274     {
275       return;
276     }
277   paddle->fire_state = sprite_paddle::OWN_GUN;
278   Sint32 x = paddle->x_coord;
279   Sint32 y = paddle->y_coord;
280   sprite_projectile **projectiles = sprites_list;
281   sprite_projectile *projectile;
282   projectile = *(projectiles++);
283   projectile->is_enabled = true;
284   projectile->x_coord = x;
285   projectile->y_coord = y;
286   if (paddle->is_vertical)
287     {
288       y += 18 * resolution;
289     }
290   else
291     {
292       x += 18 * resolution;
293     }
294   projectile = *(projectiles++);
295   projectile->is_enabled = true;
296   projectile->x_coord = x;
297   projectile->y_coord = y;
298   projectile = *(projectiles++);
299   projectile->is_enabled = true;
300   projectile->x_coord = x;
301   projectile->y_coord = y;
302   if (paddle->is_vertical)
303     {
304       y = paddle->y_coord + paddle->length - 4;
305     }
306   else
307     {
308       x = paddle->x_coord + paddle->length - 4;
309     }
310   projectile = *projectiles;
311   projectile->is_enabled = true;
312   projectile->x_coord = x;
313   projectile->y_coord = y;
314 }
315 
316 /**
317  * Fire 5: 48/96 pixels paddle's whidth
318  */
319 void
init_type5()320 controller_projectiles::init_type5 ()
321 {
322   sprite_paddle *paddle = gun_paddle;
323   if (paddle->fire_state != sprite_paddle::FIRE)
324     {
325       return;
326     }
327   paddle->fire_state = sprite_paddle::OWN_GUN;
328   Sint32 x = paddle->x_coord;
329   Sint32 y = paddle->y_coord;
330   sprite_projectile **projectiles = sprites_list;
331   sprite_projectile *projectile;
332   projectile = *(projectiles++);
333   projectile->is_enabled = true;
334   projectile->x_coord = x;
335   projectile->y_coord = y;
336   Sint32 quarter = paddle_length / 4;
337   if (paddle->is_vertical)
338     {
339       Sint32 i = paddle->projectile_xinc1;
340       x += i;
341       y += quarter;
342       projectile = *(projectiles++);
343       projectile->is_enabled = true;
344       projectile->x_coord = x;
345       projectile->y_coord = y;
346       x += i;
347       y += quarter;
348       projectile = *(projectiles++);
349       projectile->is_enabled = true;
350       projectile->x_coord = x;
351       projectile->y_coord = y;
352       x -= i;
353       y += quarter;
354       projectile = *(projectiles++);
355       projectile->is_enabled = true;
356       projectile->x_coord = x;
357       projectile->y_coord = y;
358       x -= i;
359       y += quarter - 2 * resolution;
360       projectile = *(projectiles++);
361       projectile->is_enabled = true;
362       projectile->x_coord = x;
363       projectile->y_coord = y;
364     }
365   else
366     {
367       Sint32 i = paddle->projectile_yinc1;
368       y += i;
369       x += quarter;
370       projectile = *(projectiles++);
371       projectile->is_enabled = true;
372       projectile->x_coord = x;
373       projectile->y_coord = y;
374       y += i;
375       x += quarter;
376       projectile = *(projectiles++);
377       projectile->is_enabled = true;
378       projectile->x_coord = x;
379       projectile->y_coord = y;
380       y -= i;
381       x += quarter;
382       projectile = *(projectiles++);
383       projectile->is_enabled = true;
384       projectile->x_coord = x;
385       projectile->y_coord = y;
386       y -= i;
387       x += quarter - 2 * resolution;
388       projectile = *(projectiles++);
389       projectile->is_enabled = true;
390       projectile->x_coord = x;
391       projectile->y_coord = y;
392     }
393 }
394 
395 /**
396  * Fire 6: 56/112 pixels paddle's whidth
397  */
398 void
init_type6()399 controller_projectiles::init_type6 ()
400 {
401   sprite_paddle *paddle = gun_paddle;
402   if (paddle->fire_state != sprite_paddle::FIRE)
403     {
404       return;
405     }
406   paddle->fire_state = sprite_paddle::OWN_GUN;
407   sprite_projectile **projectiles = sprites_list;
408   Sint32 x = paddle->x_coord;
409   Sint32 y = paddle->y_coord;
410   Sint32 offst = 22 * resolution;
411 
412   sprite_projectile *projectile;
413   if (paddle->is_vertical)
414     {
415       Sint32 a = x + paddle->projectile_xoffset;
416       projectile = *(projectiles++);
417       projectile->is_enabled = true;
418       projectile->x_coord = a;
419       projectile->y_coord = y;
420       projectile = *(projectiles++);
421       projectile->is_enabled = true;
422       projectile->x_coord = x;
423       projectile->y_coord = y;
424       y += offst;
425       projectile = *(projectiles++);
426       projectile->is_enabled = true;
427       projectile->x_coord = x;
428       projectile->y_coord = y;
429       projectile = *(projectiles++);
430       projectile->is_enabled = true;
431       projectile->x_coord = x;
432       projectile->y_coord = y;
433       y += offst;
434       projectile = *(projectiles++);
435       projectile->is_enabled = true;
436       projectile->x_coord = a;
437       projectile->y_coord = y;
438       projectile = *(projectiles++);
439       projectile->is_enabled = true;
440       projectile->x_coord = x;
441       projectile->y_coord = y;
442     }
443   else
444     {
445       Sint32 o = y + paddle->projectile_yoffset;
446       projectile = *(projectiles++);
447       projectile->is_enabled = true;
448       projectile->x_coord = x;
449       projectile->y_coord = y;
450       projectile = *(projectiles++);
451       projectile->is_enabled = true;
452       projectile->x_coord = x;
453       projectile->y_coord = o;
454       x += offst;
455       projectile = *(projectiles++);
456       projectile->is_enabled = true;
457       projectile->x_coord = x;
458       projectile->y_coord = y;
459       projectile = *(projectiles++);
460       projectile->is_enabled = true;
461       projectile->x_coord = x;
462       projectile->y_coord = y;
463       x += offst;
464       projectile = *(projectiles++);
465       projectile->is_enabled = true;
466       projectile->x_coord = x;
467       projectile->y_coord = o;
468       projectile = *(projectiles++);
469       projectile->is_enabled = true;
470       projectile->x_coord = x;
471       projectile->y_coord = y;
472     }
473 }
474 
475 /**
476  * Fire 7: 64/128 pixels paddle's width
477  */
478 void
init_type7()479 controller_projectiles::init_type7 ()
480 {
481   sprite_paddle *paddle = gun_paddle;
482 
483   /* paddle is firing? */
484   if (paddle->fire_state == sprite_paddle::FIRE)
485     {
486       paddle->fire_state = sprite_paddle::OWN_GUN;
487       sprite_projectile **projectiles = sprites_list;
488       Sint32 x = paddle->x_coord + paddle->projectile_xcenter;
489       Sint32 y = paddle->y_coord + paddle->projectile_ycenter;
490       Sint32 j = 0;
491       for (Sint32 i = 0; i < 7; i++, j += 8)
492         {
493           sprite_projectile *projectile = *(projectiles++);
494           projectile->on_paddle = false;
495           projectile->fire_Xscie = x;
496           projectile->fire_Yscie = y;
497           projectile->indexSinus = j;
498         }
499     }
500 
501   /* fire on the paddle */
502   else
503     {
504       sprite_projectile **projectiles = sprites_list;
505       paddle->fire_state = sprite_paddle::OWN_GUN;
506       for (Sint32 i = 0; i < 7; i++)
507         {
508           sprite_projectile *projectile = *(projectiles++);
509           if (projectile->is_enabled)
510             {
511               return;
512             }
513         }
514       projectiles = sprites_list;
515       Sint32 x = paddle->x_coord + paddle->projectile_xcenter;
516       Sint32 y = paddle->y_coord + paddle->projectile_ycenter;
517       Sint32 j = 0;
518       for (Sint32 i = 0; i < 7; i++, j += 8)
519         {
520           sprite_projectile *projectile = *(projectiles++);
521           projectile->is_enabled = true;
522           projectile->on_paddle = true;
523           projectile->fire_Xscie = x;
524           projectile->fire_Yscie = y;
525           projectile->indexSinus = j;
526         }
527 
528     }
529 }
530 
531 /**
532  * Move paddle's projectiles
533  */
534 void
move()535 controller_projectiles::move ()
536 {
537   Sint32 i = gun_paddle->length;
538   paddle_length = i;
539   /* smallest paddle width is of 16/32 pixels */
540   i -= gun_paddle->width_mini;
541   /* size of paddle step by 8/16 pixels */
542   i >>= gun_paddle->shift_width;
543   switch (i)
544     {
545     case 0:
546       move_type1 ();
547       break;
548     case 1:
549       move_type2 ();
550       break;
551     case 2:
552       move_type3 ();
553       break;
554     case 3:
555       move_type4 ();
556       break;
557     case 4:
558       move_type5 ();
559       break;
560     case 5:
561       move_type6 ();
562       break;
563     case 6:
564       move_type7 ();
565       break;
566     }
567 }
568 
569 /**
570  * Move linear projectile (paddle's size: 16/32 pixels)
571  */
572 void
move_type1()573 controller_projectiles::move_type1 ()
574 {
575   sprite_projectile *projectile = sprites_list[0];
576   sprite_paddle *paddle = gun_paddle;
577   projectile->x_coord += paddle->projectile_xinc0;
578   projectile->y_coord += paddle->projectile_yinc0;
579 }
580 
581 /**
582  * Move "fishtail fire" (paddle's size: 24/48 pixels)
583  */
584 void
move_type2()585 controller_projectiles::move_type2 ()
586 {
587   sprite_projectile **projectiles = sprites_list;
588   sprite_paddle *paddle = gun_paddle;
589   Sint32 a = countTempo;
590   Sint32 b, c, d;
591   a++;
592   if (a > 20)
593     {
594       a = 0;
595     }
596   countTempo = a;
597   if (a > 10)
598     {
599       a = paddle->projectile_xinc1;
600       b = paddle->projectile_yinc1;
601       c = paddle->projectile_xinc2;
602       d = paddle->projectile_yinc2;
603     }
604   else
605     {
606       a = paddle->projectile_xinc2;
607       b = paddle->projectile_yinc2;
608       c = paddle->projectile_xinc1;
609       d = paddle->projectile_yinc1;
610     }
611   sprite_projectile *projectile;
612   projectile = *(projectiles++);
613   projectile->x_coord += a;
614   projectile->y_coord += b;
615   projectile = *projectiles;
616   projectile->x_coord += c;
617   projectile->y_coord += d;
618 }
619 
620 /**
621  * Move "triangle fire" (paddle's size: 32/64 pixels)
622  */
623 void
move_type3()624 controller_projectiles::move_type3 ()
625 {
626   sprite_projectile **projectiles = sprites_list;
627   sprite_paddle *paddle = gun_paddle;
628   Sint32 i, j;
629   sprite_projectile *projectile;
630   /* shot leaves to the left */
631   projectile = *(projectiles++);
632   i = paddle->projectile_xinc1;
633   j = paddle->projectile_yinc1;
634   projectile->x_coord += i;
635   projectile->y_coord += j;
636   /* shot leaves any right */
637   projectile = *(projectiles++);
638   i = paddle->projectile_xinc0;
639   j = paddle->projectile_yinc0;
640   projectile->x_coord += i;
641   projectile->y_coord += j;
642   /* shot leaves to the right */
643   projectile = *projectiles;
644   i = paddle->projectile_xinc2;
645   j = paddle->projectile_yinc2;
646   projectile->x_coord += i;
647   projectile->y_coord += j;
648 }
649 
650 /**
651  * Move "fishtail fire" + "linear fire" (paddle of 40/80 pixels width)
652  */
653 void
move_type4()654 controller_projectiles::move_type4 ()
655 {
656   Sint32 i, j;
657   i = countTempo;
658   i++;
659   if (i > 20)
660     {
661       i = 0;
662     }
663   countTempo = i;
664   sprite_projectile **projectiles = sprites_list;
665   sprite_paddle *paddle = gun_paddle;
666   sprite_projectile *projectile;
667   /* [1] linar projectile */
668   projectile = *(projectiles++);
669   j = paddle->projectile_xinc0;
670   projectile->x_coord += j;
671   j = paddle->projectile_yinc0;
672   projectile->y_coord += j;
673 
674   if (i > 10)
675     {
676       /* [2] fishtail projectile */
677       projectile = *(projectiles++);
678       i = paddle->projectile_xinc1;
679       j = paddle->projectile_yinc1;
680       projectile->x_coord += i;
681       projectile->y_coord += j;
682       /* [3] fishtail projectile */
683       projectile = *(projectiles++);
684       i = paddle->projectile_xinc2;
685       j = paddle->projectile_yinc2;
686       projectile->x_coord += i;
687       projectile->y_coord += j;
688     }
689   else
690     {
691       /* [2] fishtail projectile */
692       projectile = *(projectiles++);
693       i = paddle->projectile_xinc2;
694       j = paddle->projectile_yinc2;
695       projectile->x_coord += i;
696       projectile->y_coord += j;
697       /* [3] fishtail projectile */
698       projectile = *(projectiles++);
699       i = paddle->projectile_xinc1;
700       j = paddle->projectile_yinc1;
701       projectile->x_coord += i;
702       projectile->y_coord += j;
703     }
704   /* [1] linar projectile */
705   projectile = *projectiles;
706   i = paddle->projectile_xinc0;
707   j = paddle->projectile_yinc0;
708   projectile->x_coord += i;
709   projectile->y_coord += j;
710 }
711 
712 /**
713  * Move 5 linears projectiles (paddle of 48/96 pixels width)
714  */
715 
716 void
move_type5()717 controller_projectiles::move_type5 ()
718 {
719   sprite_projectile **projectiles = sprites_list;
720   sprite_paddle *paddle = gun_paddle;
721   Sint32 x = paddle->projectile_xinc0;
722   Sint32 y = paddle->projectile_yinc0;
723   for (Sint32 i = 0; i < 5; i++)
724     {
725       sprite_projectile *projectile = *(projectiles++);
726       projectile->x_coord += x;
727       projectile->y_coord += y;
728     }
729 }
730 
731 /**
732  * Move 4 linears projectiles + 2 fishtails projectiles
733  * (paddle of 56/112 pixels)
734  */
735 void
move_type6()736 controller_projectiles::move_type6 ()
737 {
738   Sint32 a, i, j;
739 
740   a = countTempo;
741   a++;
742   if (a > 20)
743     {
744       a = 0;
745     }
746   countTempo = a;
747   sprite_projectile **projectiles = sprites_list;
748   sprite_paddle *paddle = gun_paddle;
749 
750   i = paddle->projectile_xinc0;
751   j = paddle->projectile_yinc0;
752   sprite_projectile *projectile = *(projectiles++);
753 
754   projectile->x_coord += i;
755   projectile->y_coord += j;
756   projectile = *(projectiles++);
757   projectile->x_coord += i;
758   projectile->y_coord += j;
759   if (a > 10)
760     {
761       /* [3] fishtail projectile */
762       projectile = *(projectiles++);
763       i = paddle->projectile_xinc1;
764       j = paddle->projectile_yinc1;
765       projectile->x_coord += i;
766       projectile->y_coord += j;
767       /* [4] fishtail prjectile */
768       projectile = *(projectiles++);
769       i = paddle->projectile_xinc2;
770       j = paddle->projectile_yinc2;
771       projectile->x_coord += i;
772       projectile->y_coord += j;
773     }
774   else
775     {
776       /* [3] fishtail projectile */
777       projectile = *(projectiles++);
778       i = paddle->projectile_xinc2;
779       j = paddle->projectile_yinc2;
780       projectile->x_coord += i;
781       projectile->y_coord += j;
782       /* [4] fishtail projectile */
783       projectile = *(projectiles++);
784       i = paddle->projectile_xinc1;
785       j = paddle->projectile_yinc1;
786       projectile->x_coord += i;
787       projectile->y_coord += j;
788     }
789   i = paddle->projectile_xinc0;
790   j = paddle->projectile_yinc0;
791   projectile = *(projectiles++);
792   projectile->x_coord += i;
793   projectile->y_coord += j;
794   projectile = *projectiles;
795   projectile->x_coord += i;
796   projectile->y_coord += j;
797 }
798 
799 /*
800  * Move 7 circular projectiles (paddle of 56/128 pixels)
801  */
802 void
move_type7()803 controller_projectiles::move_type7 ()
804 {
805   sprite_projectile **projectiles = sprites_list;
806   sprite_paddle *paddle = gun_paddle;
807   for (Sint32 i = 0; i < 7; i++)
808     {
809       sprite_projectile *projectile = *(projectiles++);
810       if (!projectile->is_enabled)
811         {
812           continue;
813         }
814       Sint32 j = projectile->indexSinus;
815       j += 2;
816       const Sint16 *table = circular_sin + j;
817       if (*table == 99)
818         {
819           j = 0;
820           table = circular_sin;
821         }
822       projectile->indexSinus = j;
823       if (projectile->on_paddle)
824         {
825           Sint32 k = *(table++);
826           k += paddle->x_coord + paddle->projectile_xcenter;
827           projectile->x_coord = k;
828           k = *table;
829           k += paddle->y_coord + paddle->projectile_ycenter;
830           projectile->y_coord = k;
831         }
832       else
833         {
834           projectile->fire_Xscie += paddle->projectile_xinc0;
835           projectile->fire_Yscie += paddle->projectile_yinc0;
836           Sint32 k = *(table++);
837           k += projectile->fire_Xscie;
838           projectile->x_coord = k;
839           k = *table;
840           k += projectile->fire_Yscie;
841           projectile->y_coord = k;
842         }
843     }
844 }
845 
846 /**
847  * Enable fire power 1
848  */
849 void
set_fire_1()850 controller_projectiles::set_fire_1 ()
851 {
852   sprite_projectile **projectiles = sprites_list;
853   for (Uint32 i = 0; i < max_of_sprites; i++)
854     {
855       sprite_projectile *projectile = *(projectiles++);
856       projectile->set_power1 ();
857     }
858 }
859 
860 /**
861  * Enable fire power 2
862  */
863 void
set_fire_2()864 controller_projectiles::set_fire_2 ()
865 {
866   sprite_projectile **projectiles = sprites_list;
867   for (Uint32 i = 0; i < max_of_sprites; i++)
868     {
869       sprite_projectile *projectile = *(projectiles++);
870       projectile->set_power2 ();
871     }
872 }
873 
874 /**
875  * Sinus used for he fire 7 in 640 pixels resolution
876  */
877 const
878   Sint16
879   controller_projectiles::circular_sin_640[] =
880   { 15 * 2, -3 * 2, 13 * 2, -7 * 2, 11 * 2, -10 * 2, 9 * 2, -12 * 2, 7 * 2,
881   13 * 2, 3 * 2, -15 * 2, 0 * 2, -15 * 2,
882   -3 * 2, -15 * 2, -6 * 2, -14 * 2, -9 * 2, -12 * 2, -11 * 2, -10 * 2,
883   -13 * 2, -07 * 2, -14 * 2, -04 * 2, -15 * 2, -01 * 2,
884   -15 * 2, 3 * 2, -13 * 2, 7 * 2, -11 * 2, 10 * 2, -9 * 2, 12 * 2, -7 * 2,
885   13 * 2, -3 * 2, 15 * 2, 0 * 2, 15 * 2,
886   3 * 2, 15 * 2, 6 * 2, 14 * 2, 9 * 2, 12 * 2, 11 * 2, 10 * 2, 13 * 2, 7 * 2,
887   14 * 2, 4 * 2, 15 * 2, 1 * 2,
888   99, 99, 99, 99
889 };
890 
891 /**
892  * Sinus used for he fire 7 in 320 pixels resolution
893  */
894 const
895   Sint16
896   controller_projectiles::circular_sin_320[] =
897   { 15, -3, 13, -7, 11, -10, 9, -12, 7, -13, 3, -15, 0, -15,
898   -3, -15, -6, -14, -9, -12, -11, -10, -13, -7, -14, -4, -15, -1,
899   -15, 3, -13, 7, -11, 10, -9, 12, -7, 13, -3, 15, 0, 15,
900   3, 15, 6, 14, 9, 12, 11, 10, 13, 7, 14, 4, 15, 1,
901   99, 99, 99, 99
902 };
903