1 /** 2 * @file short_info_messages.h 3 * @brief Display short info messages in bricks levels 4 * @created 2002-12-30 5 * @date 2007-09-28 6 * @copyright 1991-2014 TLK Games 7 * @author Bruno Ethvignot 8 * @version $Revision: 24 $ 9 */ 10 /* 11 * copyright (c) 1991-2014 TLK Games all rights reserved 12 * $Id: short_info_messages.h 24 2014-09-28 15:30:04Z bruno.ethvignot@gmail.com $ 13 * 14 * TecnoballZ is free software; you can redistribute it and/or modify 15 * it under the terms of the GNU General Public License as published by 16 * the Free Software Foundation; either version 3 of the License, or 17 * (at your option) any later version. 18 * 19 * TecnoballZ is distributed in the hope that it will be useful, but 20 * WITHOUT ANY WARRANTY; without even the implied warranty of 21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 * GNU General Public License for more details. 23 * 24 * You should have received a copy of the GNU General Public License 25 * along with this program; if not, write to the Free Software 26 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 27 * MA 02110-1301, USA. 28 */ 29 #ifndef __SHORT_INFO_MESSAGES__ 30 #define __SHORT_INFO_MESSAGES__ 31 class short_info_messages; 32 #include "../include/handler_display.h" 33 #include "../include/tecnoballz.h" 34 #include "../include/bitmap_data.h" 35 36 class short_info_messages:public virtual tecnoballz 37 { 38 public: 39 typedef enum 40 { 41 ARE_YOU_READY, 42 YEAH_YOU_WHERE, 43 SIMPLE_FIRE, 44 COOL_FIRE, 45 COOL_GUY, 46 LOST_FILE, 47 WIN_LIFE, 48 TOO_LATE, 49 BUDGET_PRICES, 50 GLUE_OPTION, 51 NEXT_LEVEL, 52 SMALL_PADDLE, 53 BIG_PADDLE, 54 EXTRA_BALLS, 55 MULTI_BALLS, 56 POWERBALLS, 57 MEGA_POWERBALLS, 58 INVERSE_COMMANDS, 59 MAXIMUM_ACCELERATION, 60 RIGHT_PADDLE, 61 TOP_PADDLE, 62 LEFT_PADDLE, 63 BIG_BALLS, 64 HUGE_BALLS, 65 MAXIMUM_OPTIONS, 66 WALL_ENABLE, 67 ROBOT_ENABLE, 68 CONTROL_BALLS, 69 MAX_OF_MESSAGES 70 } MESSAGES_ENUM; 71 72 private: 73 static short_info_messages *info_messages_singleton; 74 /** All message strings loaded from a text file */ 75 char **messages; 76 /** Bitmap used to restore the background under message, 77 * if has_background == true */ 78 bitmap_data *restore_surface; 79 /** Pointer to the pixels from the restore surface */ 80 char *restore_pixels; 81 static const Uint32 XCOORD_MESSAGE = 96; 82 static const Uint32 YCOORD_MESSAGE = 37; 83 /** Maximum number of chars of a message */ 84 static const Uint32 MAX_OF_CHARS = 16; 85 /** Time delay counter, if < 5 then clear the message */ 86 Uint32 delay_counter; 87 /** Current char to draw from 0 to 15 */ 88 Sint32 current_char; 89 /** Current required message string */ 90 const char *required_message; 91 /** Modulo destination in the game offscreen */ 92 Sint32 dest_offset; 93 /** Modulo source in the font bitmap */ 94 Sint32 src_offset; 95 /** Font bitmap used to draw a message */ 96 bitmap_data *bitmap_small_fonts; 97 /** Pointer to the pixels of the font bitmap */ 98 char *font_pixels; 99 /** Pointer to the message in the game offscreen */ 100 char *screen; 101 /** Pointer to the message in the background offscreen */ 102 char *background; 103 /** Height of a character in pixels */ 104 Uint32 height_font; 105 /** Width of a character in pixels, 4 or 8 */ 106 Uint32 width_font; 107 /** Width of message's surface 64 or 128 pixels */ 108 Uint32 width_surface; 109 bool messages_request[MAX_OF_MESSAGES]; 110 111 private: 112 short_info_messages (); 113 void init_with_background (); 114 void draw (); 115 void display_in_background (); 116 void display (Uint32 height); 117 void clear_message (); 118 public: 119 ~short_info_messages (); 120 static short_info_messages *get_instance (); 121 void clear_messages_request (); 122 void initialize (); 123 void send_message_request (Uint32 id); 124 void run (); 125 }; 126 #endif 127