1 /** 2 * @file controller_capsules.h 3 * @brief Capsules controller 4 * @date 2012-09-02 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.h 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 #ifndef __CONTROLLER_CAPSULES__ 29 #define __CONTROLLER_CAPSULES__ 30 class controller_capsules; 31 32 #include "../include/objects_list.h" 33 #include "../include/sprite_capsule.h" 34 #include "../include/controller_paddles.h" 35 #include "../include/controller_balls.h" 36 37 class controller_capsules:public objects_list < sprite_capsule, controller_capsules > 38 { 39 public: 40 /** X-coordinate of the first capsule in the shop */ 41 static const Sint32 SHOP_XCOORD_CAPSULE = 146; 42 /** Y-coordinate of the first capsule in the shop */ 43 static const Sint32 SHOP_YCOORD_CAPSULE = 2; 44 /** X-coordinate of the indicator capsule in the shop */ 45 static const Sint32 SHIP_XCOORD_INDICATOR = 280; 46 /** Y-coordinate of the indicator capsule in the shop */ 47 static const Sint32 SHIP_YCOORD_INDICATOR = 204; 48 49 private: 50 /** Paddle selected, used in the cheat mode */ 51 sprite_paddle * paddle_selected; 52 /** Counter time delay before next image */ 53 Sint32 frame_delay; 54 /** Time delay before next image of the animation */ 55 Sint32 frame_period; 56 /** Index of the current image */ 57 Uint32 frame_index; 58 /** Overview capsule of a option in the shop */ 59 sprite_capsule *overview_capsule; 60 /** Counter delay before dropping a penalty/bonus capsule */ 61 Uint32 capsule_delay_counter; 62 /** Appearance frequency of the penalty/bonus capsules */ 63 Uint32 capsule_delay; 64 /** Random list of capsules, bonuses or penalties which can 65 * fall in the current level */ 66 const Uint32 *random_list; 67 /** Counter number of bricks breaked before release a new 68 * bonus caspule bought in the shop */ 69 Uint32 bricks_breaked_count; 70 /** Number of bonus capsules bought in the shop */ 71 Uint32 num_of_caspules_bought; 72 /** Current number of bonus capsules bought in the shop released */ 73 Uint32 capsules_released_count; 74 /** Delay before dropping a bonus capsule bought in the shop */ 75 Uint32 bonus_delay; 76 /** Index of the next bonus capsule of the shopping cart */ 77 Uint32 shopping_cart_index; 78 /** List of the bonus capsules bought in the shop which will fall 79 * regularly to the destruction of bricks */ 80 Sint32 *shopping_cart; 81 /** Cheat keys to enable options in bricks levels, 82 * only under development */ 83 static Sint16 cheat_keys[]; 84 static const Uint16 randomlist[128]; 85 86 public: 87 controller_capsules (); 88 ~controller_capsules (); 89 void initialize (Uint32 delay, const Uint32* random); 90 void send_capsule_from_brick (brick_redraw * brick); 91 void send_penalty_or_bonus (sprite_ball *ball); 92 void send_penalty_or_bonus (sprite_projectile *blast); 93 void check_if_send_capsule (sprite_ball * ball); 94 void create_shop_sprites_list (); 95 void set_overview_capsule (Uint32 id); 96 void move_in_bricks_level (); 97 void move_in_guardians_level (); 98 void play_animation_in_shop (Uint32 value = 0); 99 void check_cheat_keys (); 100 101 private: 102 void run_in_bricks_level (sprite_paddle * paddle, Uint32 capsule_id); 103 void run_in_guards_level (sprite_paddle * paddle, Uint32 capsule_id); 104 105 }; 106 #endif 107