1 /**
2  * @file controller_capsules.cc
3  * @brief Capsules controller
4  * @date 2007-10-31
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_capsules.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_capsules.h"
29 #include "../include/handler_display.h"
30 #include "../include/handler_keyboard.h"
31 #include "../include/handler_players.h"
32 #include "../include/sprite_projectile.h"
33 #include "../include/handler_players.h"
34 
35 /**
36  * Create the capsules controller
37  */
controller_capsules()38 controller_capsules::controller_capsules ()
39 {
40   littleInit ();
41   frame_delay = 0;
42   frame_period = 5;
43   frame_index = 0;
44   capsule_delay_counter = 0;
45   capsule_delay = 0;
46   bricks_breaked_count = 0;
47   num_of_caspules_bought = 0;
48   capsules_released_count = 0;
49   bonus_delay = 0;
50   shopping_cart_index = 0;
51   max_of_sprites = 0;
52   sprites_have_shades = true;
53   /* additional table to drawing pixel by pixel is required
54    * for color cycling of the chance capsule */
55   is_draw_pixel_by_pixel = true;
56   sprite_type_id = sprite_object::CAPSULES;
57   shopping_cart = NULL;
58 }
59 
60 /**
61  *  Release capsules controller
62  */
~controller_capsules()63 controller_capsules::~controller_capsules ()
64 {
65   release_sprites_list ();
66 }
67 
68 /**
69  * Perform some initializations
70  * @param delay Time interval between two penalty/bonus capsules
71  * @param random Pointer to the list of penalties/bonuses capsules
72  */
73 void
initialize(Uint32 delay,const Uint32 * random)74 controller_capsules::initialize (Uint32 delay,
75                                  const Uint32 * random)
76 {
77   controller_paddles *paddles = controller_paddles::get_instance ();
78   paddle_selected = paddles->get_paddle (controller_paddles::BOTTOM_PADDLE);
79   capsule_delay = delay;
80   bonus_delay = 0;
81   random_list = random;
82   capsule_delay_counter = 0;
83   bricks_breaked_count = 0;
84   capsules_released_count = 0;
85   sprite_capsule *capsule = sprites_list[0];
86   for (Uint32 i = 0; i < max_of_sprites; i++)
87     {
88       capsule = sprites_list[i];
89       capsule->init_members ();
90     }
91   frame_period = capsule->frame_period;
92 
93   if (current_phase == BRICKS_LEVEL)
94     {
95       controller_bricks *bricks = controller_bricks::get_instance ();
96       Uint32 numof_bricks = bricks->get_num_of_bricks ();
97       shopping_cart = current_player->get_shopping_cart ();
98       num_of_caspules_bought = current_player->get_numof_items_in_shopping_cart ();
99       /* at least a bought bonus? */
100       if (num_of_caspules_bought > 0)
101         {
102           bonus_delay =
103             (numof_bricks - numof_bricks / 2) / num_of_caspules_bought;
104         }
105       else
106         {
107           /* no bonus bought in the shop,
108            * initialize with the maximum value */
109           bonus_delay = numof_bricks + 1;
110         }
111     }
112 }
113 
114 /**
115  * Check if send a bonus or penalty capsule from brick
116  * @param brick Pointer to the brick touched by a ball
117  */
118 void
send_capsule_from_brick(brick_redraw * brick)119 controller_capsules::send_capsule_from_brick (brick_redraw * brick)
120 {
121   bricks_breaked_count++;
122   for (Uint32 i = 0; i < max_of_sprites; i++)
123     {
124       sprite_capsule *caspule = sprites_list[i];
125       if (caspule->is_enabled)
126         {
127           continue;
128         }
129 
130       /*
131        * Send a random penalty or bonus capsule
132        */
133       capsule_delay_counter++;
134       if (capsule_delay_counter > capsule_delay)
135         {
136           capsule_delay_counter = 0;
137           caspule->enable_capsule (brick, random_list[random_counter & 0x3F]);
138           return;
139         }
140 
141       /*
142        * Send a bonus capsule bought in th shop
143        */
144       if (num_of_caspules_bought > capsules_released_count
145           && bricks_breaked_count > bonus_delay)
146         {
147           bricks_breaked_count = 0;
148           capsules_released_count++;
149           Sint32 id = shopping_cart[shopping_cart_index];
150           if (id == 0)
151             {
152               id = shopping_cart[0];
153               shopping_cart_index = 0;
154             }
155           shopping_cart_index++;
156           caspule->enable_capsule (brick, id);
157         }
158     }
159   return;
160 }
161 
162 /**
163  * Send a penalty from a ship in bricks level
164  * @param ball Pointer to the ball sprite which touched the ship
165  */
166 void
send_penalty_or_bonus(sprite_ball * ball)167 controller_capsules::send_penalty_or_bonus (sprite_ball * ball)
168 {
169   for (Uint32 i = 0; i < max_of_sprites; i++)
170     {
171       sprite_capsule *capsule = sprites_list[i];
172       if (capsule->is_enabled)
173         {
174           continue;
175         }
176       capsule->enable_capsule (ball, random_list[random_counter & 0x3F]);
177       return;
178     }
179 }
180 
181 /**
182  * Send a penalty from a ship in bricks level
183  * @param ball Pointer to the projectile sprite which touched the ship
184  */
185 void
send_penalty_or_bonus(sprite_projectile * blast)186 controller_capsules::send_penalty_or_bonus (sprite_projectile * blast)
187 {
188   for (Uint32 i = 0; i < max_of_sprites; i++)
189     {
190       sprite_capsule *capsule = sprites_list[i];
191       if (capsule->is_enabled)
192         {
193           continue;
194         }
195       capsule->enable_capsule (blast, random_list[random_counter & 0x3F]);
196       return;
197     }
198 }
199 
200 /**
201  * Check if send a bonus capsule in the guards level
202  * @param ball Pointer to a ball sprite which touched the guardian
203  */
204 void
check_if_send_capsule(sprite_ball * ball)205 controller_capsules::check_if_send_capsule (sprite_ball * ball)
206 {
207   capsule_delay_counter++;
208   if (capsule_delay_counter <= capsule_delay)
209     {
210       return;
211     }
212   for (Uint32 i = 0; i < max_of_sprites; i++)
213     {
214       sprite_capsule *capsule = sprites_list[i];
215       if (capsule->is_enabled)
216         {
217           continue;
218         }
219       capsule_delay_counter = 0;
220       capsule->enable_guardian_capsule (ball,
221                                         random_list[random_counter & 0x3F]);
222       return;
223     }
224 }
225 
226 /**
227  * Initialize the coordinattes of the bonus capsules in the shop
228  */
229 void
create_shop_sprites_list()230 controller_capsules::create_shop_sprites_list ()
231 {
232   create_sprites_list (supervisor_shop::MAX_OF_CAPSULES_BOUGHT + 2, false);
233   Uint32 maxof = supervisor_shop::MAX_OF_CAPSULES_BOUGHT;
234   sprite_capsule **caspules = sprites_list;
235   sprite_capsule *caspule = caspules[0];
236   Uint32 h = caspule->sprite_height + 1;
237   Sint32 x = SHOP_XCOORD_CAPSULE * resolution;
238   Sint32 y = SHOP_YCOORD_CAPSULE * resolution;
239   for (Uint32 i = 0; i < maxof; i++)
240     {
241       caspule = *(caspules++);
242       caspule->set_coordinates (x, y);
243       caspule->disable ();
244       y += h;
245     }
246 
247   /* initialize caspule sprite object for the drag and drop */
248   caspule = *(caspules++);
249   caspule->set_coordinates (0, 0);
250   caspule->disable ();
251 
252   /* initialize caspule sprite object that display indicator */
253   caspule = *caspules;
254   caspule->set_coordinates (SHIP_XCOORD_INDICATOR * resolution,
255                             SHIP_YCOORD_INDICATOR * resolution);
256   caspule->disable ();
257   overview_capsule = caspule;
258 }
259 
260 /**
261  * Set the overview capsule in the shop
262  * @id id capsule identifier
263  */
264 void
set_overview_capsule(Uint32 id)265 controller_capsules::set_overview_capsule (Uint32 id)
266 {
267   overview_capsule->set_in_shop (id);
268 }
269 
270 /**
271  *  Move and collision with paddles in bricks levels
272  */
273 void
move_in_bricks_level()274 controller_capsules::move_in_bricks_level ()
275 {
276   for (Uint32 i = 0; i < max_of_sprites; i++)
277     {
278       sprite_capsule *capsule = sprites_list[i];
279       capsule->play_animation_loop ();
280       sprite_paddle *paddle = capsule->move ();
281       if (NULL != paddle)
282         {
283           Uint32 id = capsule->get_id ();
284           run_in_bricks_level (paddle, id);
285         }
286     }
287 }
288 
289 /**
290  * Move and collision with paddle in guardians levels
291  */
292 void
move_in_guardians_level()293 controller_capsules::move_in_guardians_level ()
294 {
295   for (Uint32 i = 0; i < max_of_sprites; i++)
296     {
297       sprite_capsule *capsule = sprites_list[i];
298       capsule->play_animation_loop ();
299       sprite_paddle *paddle = capsule->move ();
300       if (NULL != paddle)
301         {
302           Uint32 id = capsule->get_id ();
303           run_in_guards_level (paddle, id);
304         }
305     }
306 }
307 
308 /**
309  * Play capsules animation in shop
310  * @param speed speed of the animation 1 or 2
311  */
312 void
play_animation_in_shop(Uint32 speed)313 controller_capsules::play_animation_in_shop (Uint32 speed)
314 {
315   if (--frame_delay <= 0)
316     {
317       frame_delay = frame_period / speed;
318       if (++frame_index >= sprite_capsule::NUM_OF_IMAGES)
319         {
320           frame_index = 0;
321         }
322     }
323   Uint32 offset = frame_index;
324   sprite_capsule **caspules = sprites_list;
325   for (Uint32 i = 0; i < max_of_sprites; i++)
326     {
327       sprite_capsule *caspule = *(caspules++);
328       caspule->set_image (caspule->frame_index_min + offset);
329     }
330 }
331 
332 /**
333  * Enable a bonus or a penalty with the keyboard
334  */
335 void
check_cheat_keys()336 controller_capsules::check_cheat_keys ()
337 {
338   if (!is_enabled_cheat_mode)
339     {
340       return;
341     }
342   if (keyboard->key_is_pressed (SDLK_LSHIFT) ||
343       keyboard->key_is_pressed (SDLK_LCTRL) ||
344       keyboard->key_is_pressed (SDLK_RALT) ||
345 #ifndef UNDER_DEVELOPMENT
346       !keyboard->key_is_pressed (SDLK_RSHIFT) ||
347       !keyboard->key_is_pressed (SDLK_RCTRL) ||
348 #else
349       keyboard->key_is_pressed (SDLK_RSHIFT) ||
350       keyboard->key_is_pressed (SDLK_RCTRL) ||
351 #endif
352       keyboard->key_is_pressed (SDLK_LALT))
353     {
354       return;
355     }
356   Sint16 *keys = cheat_keys;
357   /* read SDL key code */
358   while (Sint16 key = *(keys++))
359     {
360       Sint16 capsule_id = *(keys++);
361       if (keyboard->key_is_pressed (key))
362         {
363           *(keys++) = 1;
364         }
365       else
366         {
367           if (*keys == 1)
368             {
369               run_in_bricks_level (paddle_selected, capsule_id);
370             }
371           *(keys++) = 0;
372         }
373     }
374 }
375 
376 /**
377  * Enable an option, bonus or penalty, which can possibly come from
378  * a capsule collected by a paddle in the bricks levels
379  * @param paddle Paddle which collected the caspule
380  * @param capsule_id Option identifier
381  */
382 void
run_in_bricks_level(sprite_paddle * paddle,Uint32 capsule_id)383 controller_capsules::run_in_bricks_level (sprite_paddle * paddle,
384                                           Uint32 capsule_id)
385 {
386   paddle_selected = paddle;
387   controller_paddles *paddles = controller_paddles::get_instance ();
388   short_info_messages *messages = short_info_messages::get_instance ();
389   controller_balls *balls = controller_balls::get_instance ();
390   sprite_wall *wall = sprite_wall::get_instance ();
391   if (capsule_id == sprite_capsule::CHANCE)
392     {
393       capsule_id = randomlist[random_counter & 127];
394     }
395 
396   switch (capsule_id)
397     {
398     case sprite_capsule::GLUE:
399 #ifndef SOUNDISOFF
400       audio->play_sound (handler_audio::PADDLE_TRANSFORMATION);
401 #endif
402       messages->send_message_request (short_info_messages::GLUE_OPTION);
403       paddle->set_glue ();
404       break;
405 
406     case sprite_capsule::NEXT_LEVEL:
407       {
408         messages->send_message_request (short_info_messages::NEXT_LEVEL);
409         right_panel_score *panel = right_panel_score::get_instance ();
410         panel->set_bricks_counter (0);
411       }
412       break;
413 
414     case sprite_capsule::FIRE_POWER_1:
415 #ifndef SOUNDISOFF
416       audio->play_sound (handler_audio::PADDLE_TRANSFORMATION);
417 #endif
418       messages->send_message_request (short_info_messages::SIMPLE_FIRE);
419       paddle->set_fire_1 ();
420       break;
421 
422     case sprite_capsule::FIRE_POWER_2:
423 #ifndef SOUNDISOFF
424       audio->play_sound (handler_audio::PADDLE_TRANSFORMATION);
425 #endif
426       messages->send_message_request (short_info_messages::COOL_FIRE);
427       paddle->set_fire_2 ();
428       break;
429 
430     case sprite_capsule::SHRINK_PADDLE:
431 #ifndef SOUNDISOFF
432       audio->play_sound (handler_audio::PADDLE_TRANSFORMATION);
433 #endif
434       messages->send_message_request (short_info_messages::SMALL_PADDLE);
435       paddles->shrink_paddles ();
436       break;
437 
438     case sprite_capsule::EXPAND_PADDLE:
439 #ifndef SOUNDISOFF
440       audio->play_sound (handler_audio::PADDLE_TRANSFORMATION);
441 #endif
442       messages->send_message_request (short_info_messages::BIG_PADDLE);
443       paddles->expand_paddles ();
444       break;
445 
446     case sprite_capsule::LOSE_A_LIFE:
447 #ifndef SOUNDISOFF
448       audio->play_sound (handler_audio::LOST_LIFE);
449 #endif
450       messages->send_message_request (short_info_messages::LOST_FILE);
451       current_player->remove_life (1);
452       break;
453 
454     case sprite_capsule::EXTRA_LIFE:
455 #ifndef SOUNDISOFF
456       audio->play_sound (handler_audio::EXTRA_LIFE);
457 #endif
458       messages->send_message_request (short_info_messages::WIN_LIFE);
459       current_player->add_life (1);
460       break;
461 
462     case sprite_capsule::EXTRA_BALLS:
463 #ifndef SOUNDISOFF
464       audio->play_sound (handler_audio::COLLECT_CAPSULE);
465 #endif
466       messages->send_message_request (short_info_messages::EXTRA_BALLS);
467       balls->extra_balls ();
468       break;
469 
470     case sprite_capsule::MULTI_BALLS:
471 #ifndef SOUNDISOFF
472       audio->play_sound (handler_audio::COLLECT_CAPSULE);
473 #endif
474       messages->send_message_request (short_info_messages::MULTI_BALLS);
475       balls->multi_balls ();
476       break;
477 
478     case sprite_capsule::POWER_BALL_1:
479       messages->send_message_request (short_info_messages::POWERBALLS);
480 #ifndef SOUNDISOFF
481       audio->play_sound (handler_audio::COLLECT_CAPSULE);
482 #endif
483       balls->set_power_1 ();
484       break;
485 
486     case sprite_capsule::POWER_BALL_2:
487       messages->send_message_request (short_info_messages::MEGA_POWERBALLS);
488 #ifndef SOUNDISOFF
489       audio->play_sound (handler_audio::COLLECT_CAPSULE);
490 #endif
491       balls->set_power_2 ();
492       break;
493 
494     case sprite_capsule::INVERSE_CONTROL:
495       messages->send_message_request (short_info_messages::INVERSE_COMMANDS);
496       paddles->set_reverse_counter (50 * 4);
497       break;
498 
499       /* increase the speed of the balls to the maximum
500        * this option is only available as a part of chance capsule */
501     case sprite_capsule::MAXIMUM_SPEED_OF_BALLS:
502       messages->
503         send_message_request (short_info_messages::MAXIMUM_ACCELERATION);
504       balls->set_maximum_speed ();
505       break;
506 
507       /* this option is never used */
508     case sprite_capsule::ENABLE_BOTTOM_PADDLE:
509       paddle_selected =
510         paddles->get_paddle (controller_paddles::BOTTOM_PADDLE);
511       break;
512 
513       /* the option which enables the right paddle is only
514        * available as a part of chance capsule */
515     case sprite_capsule::ENABLE_RIGHT_PADDLE:
516       messages->send_message_request (short_info_messages::RIGHT_PADDLE);
517       paddle_selected =
518         paddles->get_paddle (controller_paddles::RIGHT_PADDLE);
519       paddle_selected->enable ();
520       break;
521 
522       /* the option which enables the top paddle is only
523        * available as a part of chance capsule */
524     case sprite_capsule::ENABLE_TOP_PADDLE:
525       messages->send_message_request (short_info_messages::TOP_PADDLE);
526       paddle_selected = paddles->get_paddle (controller_paddles::TOP_PADDLE);
527       paddle_selected->enable ();
528       break;
529 
530       /* the option which enables the left paddle is only
531        * available as a part of chance capsule */
532     case sprite_capsule::ENABLE_LEFT_PADDLE:
533       messages->send_message_request (short_info_messages::LEFT_PADDLE);
534       paddle_selected = paddles->get_paddle (controller_paddles::LEFT_PADDLE);
535       paddle_selected->enable ();
536       break;
537 
538     case sprite_capsule::BALL_SIZE_2:
539       messages->send_message_request (short_info_messages::BIG_BALLS);
540 #ifndef SOUNDISOFF
541       audio->play_sound (handler_audio::COLLECT_CAPSULE);
542 #endif
543       balls->set_size_2 ();
544       break;
545 
546     case sprite_capsule::BALL_SIZE_3:
547       messages->send_message_request (short_info_messages::HUGE_BALLS);
548 #ifndef SOUNDISOFF
549       audio->play_sound (handler_audio::COLLECT_CAPSULE);
550 #endif
551       balls->set_size_3 ();
552       break;
553 
554     case sprite_capsule::CHANCE:
555       break;
556 
557     case sprite_capsule::ENABLE_HUGELY_OPTIONS:
558       messages->send_message_request (short_info_messages::MAXIMUM_OPTIONS);
559 #ifndef SOUNDISOFF
560       audio->play_sound (handler_audio::COLLECT_CAPSULE);
561 #endif
562       paddles->set_maximum_paddles_size ();
563       balls->add_balls ();
564       balls->set_power_2 ();
565       balls->set_size_3 ();
566 
567       paddle->set_glue ();
568       paddle->set_fire_2 ();
569 
570       paddle_selected = paddles->get_paddle (2);
571       paddle_selected->enable ();
572       paddle_selected->set_glue ();
573       paddle_selected->set_fire_2 ();
574 
575       paddle_selected = paddles->get_paddle (3);
576       paddle_selected->enable ();
577       paddle_selected->set_glue ();
578       paddle_selected->set_fire_2 ();
579 
580       paddle_selected = paddles->get_paddle (4);
581       paddle_selected->enable ();
582       paddle_selected->set_glue ();
583       paddle_selected->set_fire_2 ();
584       break;
585 
586       /* options prices will be to 1 in the next shop
587        * this bonus is only available as a part of chance capsule */
588     case sprite_capsule::SET_THE_PRICES_TO_1:
589       messages->send_message_request (short_info_messages::BUDGET_PRICES);
590 #ifndef SOUNDISOFF
591       audio->play_sound (handler_audio::COLLECT_CAPSULE);
592 #endif
593       current_player->set_budget_prices (true);
594       break;
595 
596       /* enable the bottom wall */
597     case sprite_capsule::BOTTOM_WALL:
598       messages->send_message_request (short_info_messages::WALL_ENABLE);
599 #ifndef SOUNDISOFF
600       audio->play_sound (handler_audio::COLLECT_CAPSULE);
601 #endif
602       wall->enable (500);
603       paddles->disable_robot ();
604       break;
605 
606       /* enable the paddle robot */
607     case sprite_capsule::ROBOT_PADDLE:
608       messages->send_message_request (short_info_messages::ROBOT_ENABLE);
609 #ifndef SOUNDISOFF
610       audio->play_sound (handler_audio::COLLECT_CAPSULE);
611 #endif
612       paddles->enable_robot ();
613       wall->disable ();
614       break;
615 
616       /* enable the balls control */
617     case sprite_capsule::BALLS_CONTROL:
618       balls->enable_balls_control ();
619       messages->send_message_request (short_info_messages::CONTROL_BALLS);
620 #ifndef SOUNDISOFF
621       audio->play_sound (handler_audio::COLLECT_CAPSULE);
622 #endif
623       break;
624 
625       /* enable the magnetic eye, no capsule exists to activate it
626        * this bonus is only available as a part of chance capsule */
627     case sprite_capsule::MAGNETIC_EYE:
628       {
629         controller_magnetic_eyes *eyes =
630           controller_magnetic_eyes::get_instance ();
631         eyes->create_eye ();
632       }
633       break;
634     }
635 }
636 
637 /**
638  * Enable the capsule option in guardians level
639  * @param paddle Paddle which collected the caspule
640  * @param capsule_id Option identifier
641  */
642 void
run_in_guards_level(sprite_paddle * paddle,Uint32 capsule_id)643 controller_capsules::run_in_guards_level (sprite_paddle * paddle,
644                                           Uint32 capsule_id)
645 {
646   paddle_selected = paddle;
647   controller_balls *balls = controller_balls::get_instance ();
648   switch (capsule_id)
649     {
650     case sprite_capsule::PADDLE_INVINCIBILITY:
651       paddle->set_invincibility (200);
652       break;
653 
654     case sprite_capsule::EXTRA_LIFE:
655 #ifndef SOUNDISOFF
656       audio->play_sound (handler_audio::EXTRA_LIFE);
657 #endif
658       current_player->add_life (1);
659       break;
660 
661     case sprite_capsule::MULTI_BALLS:
662 #ifndef SOUNDISOFF
663       audio->play_sound (handler_audio::COLLECT_CAPSULE);
664 #endif
665       balls->multi_balls ();
666       break;
667 
668       /* power ball 1 (ball size 2) */
669     case sprite_capsule::POWER_BALL_1:
670 #ifndef SOUNDISOFF
671       audio->play_sound (handler_audio::COLLECT_CAPSULE);
672 #endif
673       balls->set_size_2 ();
674       break;
675 
676       /* power ball 2 (ball size 3) */
677     case sprite_capsule::POWER_BALL_2:
678 #ifndef SOUNDISOFF
679       audio->play_sound (handler_audio::COLLECT_CAPSULE);
680 #endif
681       balls->set_size_3 ();
682       break;
683     }
684 }
685 
686 /**
687  * List of the options which can be enabled by a chance capsule
688  */
689 const Uint16
690   controller_capsules::randomlist[128] = { sprite_capsule::BOTTOM_WALL,
691   sprite_capsule::MAGNETIC_EYE,
692   sprite_capsule::FIRE_POWER_2,
693   sprite_capsule::SHRINK_PADDLE,
694   sprite_capsule::ROBOT_PADDLE,
695   sprite_capsule::EXTRA_BALLS,
696   sprite_capsule::MULTI_BALLS,
697   sprite_capsule::POWER_BALL_1,
698   sprite_capsule::BALLS_CONTROL,
699   sprite_capsule::BALL_SIZE_2,
700   sprite_capsule::BALL_SIZE_3,
701   sprite_capsule::MAGNETIC_EYE,
702   sprite_capsule::ENABLE_LEFT_PADDLE,
703   sprite_capsule::MAXIMUM_SPEED_OF_BALLS,
704   sprite_capsule::MAXIMUM_SPEED_OF_BALLS,
705   sprite_capsule::MAXIMUM_SPEED_OF_BALLS,
706   sprite_capsule::LOSE_A_LIFE,
707   sprite_capsule::BALLS_CONTROL,
708   sprite_capsule::GLUE,
709   sprite_capsule::FIRE_POWER_1,
710   sprite_capsule::FIRE_POWER_2,
711   sprite_capsule::SHRINK_PADDLE,
712   sprite_capsule::EXPAND_PADDLE,
713   sprite_capsule::EXTRA_BALLS,
714   sprite_capsule::MULTI_BALLS,
715   sprite_capsule::POWER_BALL_1,
716   sprite_capsule::MAXIMUM_SPEED_OF_BALLS,
717   sprite_capsule::BALL_SIZE_2,
718   sprite_capsule::BALL_SIZE_3,
719   sprite_capsule::BALL_SIZE_3,
720   sprite_capsule::ENABLE_LEFT_PADDLE,
721   sprite_capsule::MAGNETIC_EYE,
722   sprite_capsule::NEXT_LEVEL,
723   sprite_capsule::BALLS_CONTROL,
724   sprite_capsule::LOSE_A_LIFE,
725   sprite_capsule::MAXIMUM_SPEED_OF_BALLS,
726   sprite_capsule::ROBOT_PADDLE,
727   sprite_capsule::FIRE_POWER_1,
728   sprite_capsule::FIRE_POWER_2,
729   sprite_capsule::SHRINK_PADDLE,
730   sprite_capsule::BOTTOM_WALL,
731   sprite_capsule::EXTRA_BALLS,
732   sprite_capsule::ROBOT_PADDLE,
733   sprite_capsule::ROBOT_PADDLE,
734   sprite_capsule::ROBOT_PADDLE,
735   sprite_capsule::BALL_SIZE_2,
736   sprite_capsule::BALL_SIZE_3,
737   sprite_capsule::MAXIMUM_SPEED_OF_BALLS,
738   sprite_capsule::ENABLE_RIGHT_PADDLE,
739   sprite_capsule::ENABLE_RIGHT_PADDLE,
740   sprite_capsule::ENABLE_TOP_PADDLE,
741   sprite_capsule::INVERSE_CONTROL,
742   sprite_capsule::EXTRA_LIFE,
743   sprite_capsule::EXTRA_LIFE,
744   sprite_capsule::BOTTOM_WALL,
745   sprite_capsule::MAGNETIC_EYE,
746   sprite_capsule::SET_THE_PRICES_TO_1,
747   sprite_capsule::SHRINK_PADDLE,
748   sprite_capsule::ROBOT_PADDLE,
749   sprite_capsule::EXTRA_BALLS,
750   sprite_capsule::MULTI_BALLS,
751   sprite_capsule::POWER_BALL_1,
752   sprite_capsule::MAXIMUM_SPEED_OF_BALLS,
753   sprite_capsule::BALL_SIZE_2,
754   sprite_capsule::BOTTOM_WALL,
755   sprite_capsule::FIRE_POWER_1,
756   sprite_capsule::ROBOT_PADDLE,
757   sprite_capsule::MAGNETIC_EYE,
758   sprite_capsule::ROBOT_PADDLE,
759   sprite_capsule::EXTRA_BALLS,
760   sprite_capsule::MULTI_BALLS,
761   sprite_capsule::POWER_BALL_1,
762   sprite_capsule::BOTTOM_WALL,
763   sprite_capsule::BALL_SIZE_2,
764   sprite_capsule::BALL_SIZE_3,
765   sprite_capsule::ENABLE_TOP_PADDLE,
766   sprite_capsule::ENABLE_LEFT_PADDLE,
767   sprite_capsule::MAXIMUM_SPEED_OF_BALLS,
768   sprite_capsule::MAXIMUM_SPEED_OF_BALLS,
769   sprite_capsule::MAGNETIC_EYE,
770   sprite_capsule::LOSE_A_LIFE,
771   sprite_capsule::INVERSE_CONTROL,
772   sprite_capsule::GLUE,
773   sprite_capsule::FIRE_POWER_1,
774   sprite_capsule::FIRE_POWER_2,
775   sprite_capsule::SHRINK_PADDLE,
776   sprite_capsule::EXPAND_PADDLE,
777   sprite_capsule::EXTRA_BALLS,
778   sprite_capsule::MULTI_BALLS,
779   sprite_capsule::POWER_BALL_1,
780   sprite_capsule::MAXIMUM_SPEED_OF_BALLS,
781   sprite_capsule::BALL_SIZE_2,
782   sprite_capsule::BALL_SIZE_3,
783   sprite_capsule::BALL_SIZE_3,
784   sprite_capsule::ENABLE_LEFT_PADDLE,
785   sprite_capsule::BOTTOM_WALL,
786   sprite_capsule::NEXT_LEVEL,
787   sprite_capsule::INVERSE_CONTROL,
788   sprite_capsule::LOSE_A_LIFE,
789   sprite_capsule::BOTTOM_WALL,
790   sprite_capsule::ROBOT_PADDLE,
791   sprite_capsule::FIRE_POWER_1,
792   sprite_capsule::FIRE_POWER_2,
793   sprite_capsule::SHRINK_PADDLE,
794   sprite_capsule::EXPAND_PADDLE,
795   sprite_capsule::EXTRA_BALLS,
796   sprite_capsule::MULTI_BALLS,
797   sprite_capsule::POWER_BALL_1,
798   sprite_capsule::MAXIMUM_SPEED_OF_BALLS,
799   sprite_capsule::BALL_SIZE_2,
800   sprite_capsule::BOTTOM_WALL,
801   sprite_capsule::BOTTOM_WALL,
802   sprite_capsule::ENABLE_RIGHT_PADDLE,
803   sprite_capsule::ENABLE_RIGHT_PADDLE,
804   sprite_capsule::ENABLE_TOP_PADDLE,
805   sprite_capsule::INVERSE_CONTROL,
806   sprite_capsule::BOTTOM_WALL,
807   sprite_capsule::BOTTOM_WALL,
808   sprite_capsule::GLUE,
809   sprite_capsule::FIRE_POWER_1,
810   sprite_capsule::SET_THE_PRICES_TO_1,
811   sprite_capsule::SHRINK_PADDLE,
812   sprite_capsule::EXPAND_PADDLE,
813   sprite_capsule::EXTRA_BALLS,
814   sprite_capsule::MULTI_BALLS,
815   sprite_capsule::POWER_BALL_1,
816   sprite_capsule::BOTTOM_WALL,
817   sprite_capsule::BOTTOM_WALL
818 };
819 
820 /**
821  * Cheat keys to enable options in bricks levels, only under development
822  */
823 Sint16
824   controller_capsules::cheat_keys[] = {
825   SDLK_F1, sprite_capsule::GLUE, 0,
826   SDLK_F2, sprite_capsule::NEXT_LEVEL, 0,
827   SDLK_F3, sprite_capsule::FIRE_POWER_1, 0,
828   SDLK_F4, sprite_capsule::FIRE_POWER_2, 0,
829   SDLK_F5, sprite_capsule::SHRINK_PADDLE, 0,
830   SDLK_F6, sprite_capsule::EXPAND_PADDLE, 0,
831   SDLK_F7, sprite_capsule::LOSE_A_LIFE, 0,
832   SDLK_F8, sprite_capsule::EXTRA_LIFE, 0,
833   SDLK_F9, sprite_capsule::EXTRA_BALLS, 0,
834   SDLK_F10, sprite_capsule::MULTI_BALLS, 0,
835   SDLK_F11, sprite_capsule::POWER_BALL_1, 0,
836   SDLK_F12, sprite_capsule::POWER_BALL_2, 0,
837   SDLK_a, sprite_capsule::INVERSE_CONTROL, 0,
838   SDLK_z, sprite_capsule::MAXIMUM_SPEED_OF_BALLS, 0,
839   SDLK_e, sprite_capsule::ENABLE_BOTTOM_PADDLE, 0,
840   SDLK_r, sprite_capsule::ENABLE_RIGHT_PADDLE, 0,
841   SDLK_t, sprite_capsule::ENABLE_TOP_PADDLE, 0,
842   SDLK_y, sprite_capsule::ENABLE_LEFT_PADDLE, 0,
843   SDLK_u, sprite_capsule::BALL_SIZE_2, 0,
844   SDLK_i, sprite_capsule::BALL_SIZE_3, 0,
845   SDLK_o, sprite_capsule::CHANCE, 0,
846   SDLK_q, sprite_capsule::ENABLE_HUGELY_OPTIONS, 0,
847   SDLK_s, sprite_capsule::SET_THE_PRICES_TO_1, 0,
848   SDLK_d, sprite_capsule::BOTTOM_WALL, 0,
849   SDLK_g, sprite_capsule::BALLS_CONTROL, 0,
850   SDLK_h, sprite_capsule::MAGNETIC_EYE, 0,
851   SDLK_j, sprite_capsule::MAGNETIC_EYE, 0,
852   SDLK_k, sprite_capsule::ROBOT_PADDLE, 0,
853   0, 0, 0
854 };
855