1 /** 2 * @file sprite_paddle.h 3 * @brief A paddle sprite 4 * @date 2007-10-23 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: sprite_paddle.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 __SPRITE_PADDLE__ 29 #define __SPRITE_PADDLE__ 30 31 class sprite_paddle; 32 33 #include "../include/sprite_object.h" 34 #include "../include/sprite_ball.h" 35 #include "../include/controller_projectiles.h" 36 #include "../include/bitmap_data.h" 37 #include "../include/sprite_bullet.h" 38 #include "../include/controller_gigablitz.h" 39 40 class sprite_paddle:public sprite_object 41 { 42 friend class controller_paddles; 43 friend class controller_balls; 44 friend class controller_projectiles; 45 friend class sprite_bullet; 46 friend class controller_viewfinders; 47 friend class controller_gigablitz; 48 public: 49 typedef enum 50 { 51 NOT_OWN_GUN, 52 OWN_GUN, 53 FIRE = 3 54 } FIRE_PADDLE_STATUS; 55 56 typedef enum 57 { 58 NOT_STICKY_PADDLE, 59 FREE_STICKY_PADDLE, 60 BUSY_STICKY_PADDLE 61 } STICKY_PADDLE_STATUS; 62 63 64 private: 65 /** Paddle is enabled if the counter is greater than zero */ 66 Uint32 enable_counter; 67 /** True if the paddle is vertical, otherwise horizontal */ 68 bool is_vertical; 69 /** Paddle number from 0 to 5 */ 70 Uint32 paddle_number; 71 /** Paddle length in pixels */ 72 Uint32 length; 73 /** Minimum with of the paddle 32 or 64 pixels */ 74 Uint32 width_mini; 75 /** Maximum with of the paddle 64 or 128 pixels */ 76 Uint32 width_maxi; 77 /** Shift binary right value (3 or 4) used to convert the length to 78 * convert the paddle's length in a interger from 0 to 6 */ 79 Sint32 shift_width; 80 /** Fire state: NOT_OWN_GUN, OWN_GUN, or FIRE */ 81 Sint32 fire_state; 82 /** Stick paddle state: NOT_STICKY_PADDLE, FREE_STICKY_PADDLE, or 83 * BUSY_STICKY_PADDLE */ 84 Uint32 sticky_state; 85 const Sint32 **rebonds_Ga; //ball rebounds table (move on the left) 86 const Sint32 **rebonds_Dr; //ball rebounds table (move on the right) 87 /** Current directions used for bounce a ball */ 88 const Sint32 *current_bounces; 89 Sint32 *direct_tab; // table direction si la balle collee 90 /** Current stuck ball, NULL if not */ 91 sprite_ball *stuck_ball; 92 /** If true the paddle touched a ball */ 93 bool is_hit_ball; 94 /** Paddle is invinciblei f the counter is greater than zero 95 * available only in the guadians phase */ 96 Sint32 invincible_counter; 97 /** Counter used to blink the padde when it is invincible */ 98 Sint32 blink_counter; 99 /** Used for fire power 1 or fire power 2 */ 100 controller_projectiles *projectiles; 101 /** Used to increase x-coord of a projectile */ 102 Sint32 projectile_xinc0; 103 /** Used to increase y-coord of a projectile */ 104 Sint32 projectile_yinc0; 105 /** Used to increase x-coord of a projectile */ 106 Sint32 projectile_xinc1; 107 /** Used to increase y-coord of a projectile */ 108 Sint32 projectile_yinc1; 109 /** Used to increase x-coord of a projectile */ 110 Sint32 projectile_xinc2; 111 /** Used to increase y-coord of a projectile */ 112 Sint32 projectile_yinc2; 113 /** X-coordinate of center of the circle fire (fire 7) */ 114 Sint32 projectile_xcenter; 115 /** Y-coordinate of center of the circle fire (fire 7) */ 116 Sint32 projectile_ycenter; 117 /** x-offset used for the fire 6 */ 118 Sint32 projectile_xoffset; 119 /** x-offset used for the fire 6 */ 120 Sint32 projectile_yoffset; 121 122 public: 123 sprite_paddle (bool has_projectiles = true); 124 ~sprite_paddle (); 125 void create_projectiles_list (); 126 void fire_projectiles (); 127 void move_projectiles (); 128 void enable_if_ok (bool is_team, Sint32 size, Uint32 counter); 129 void set_width (Uint32 size); 130 void set_height (Uint32 h); 131 void select_image (Uint32 size); 132 void select_image (); 133 Uint32 get_paddle_number (); 134 void set_glue (); 135 void set_fire_1 (); 136 void set_fire_2 (); 137 void release_ball (); 138 void stick_ball (sprite_ball * ball); 139 Uint32 get_length (); 140 bool is_invincible (); 141 void set_invincibility (Sint32 delay); 142 void blink (); 143 }; 144 #endif 145