1 /** 2 * @file handler_resources.h 3 * @brief Handler of the files resources 4 * @created 2004-04-20 5 * @date 2013-02-23 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: handler_resources.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 __HANDLER_RESOURCES__ 30 #define __HANDLER_RESOURCES__ 31 #include "../include/tecnoballz.h" 32 33 class handler_resources:public virtual tecnoballz 34 { 35 private: 36 static handler_resources *handler_resources_singleton; 37 static const char *folderlist[]; 38 static const char *bitmap_files[]; 39 static const char *texts_files[]; 40 static const char *standfiles[]; 41 static const char *musicfiles[]; 42 static const char *soundfiles[]; 43 static const char *folderdata; 44 static const char *folder_320; 45 static const char *folder_640; 46 static const char *fnamescore; 47 static char tmp_filename[512]; 48 static char pathstring[512]; 49 static const Uint32 TEXTS_OFFSET = 2048; 50 static const Uint32 BITMAP_OFFSET = 4096; 51 public: 52 53 /** Different identifiers of the resources */ 54 typedef enum 55 { 56 RESCOSLIST = 0, 57 MAP_GUARDIANS_20, 58 MAP_GUARDIANS_40, 59 MAP_CONGRATULATIONS_20, 60 MAP_CONGRATULATIONS_40, 61 MAP_MENU_20, 62 MAP_MENU_40, 63 RESGCURVES, 64 DATA_BRICKS_LEVELS, 65 RES60BACKG, 66 DATA_LEVELS, 67 68 TEXTS_SHOP = TEXTS_OFFSET, 69 TEXTS_MESSAGES, 70 TEXTS_SCROLL_MENU, 71 TEXTS_POPUP_MENU, 72 TEXTS_MAIN_MENU, 73 74 BITMAP_HEAD_ANIMATION = BITMAP_OFFSET, 75 BITMAP_RIGHT_PANEL, 76 BITMAP_PADDLES_1, 77 BITMAP_PADDLES_2, 78 BITMAP_GAME_FONTS, 79 BITMAP_MENU_FONTS, 80 BITMAP_SMALL_FONTS, 81 BITMAP_GIGABLITZ, 82 BITMAP_TILESMAP, 83 BITMAP_SHOP, 84 BITMAP_ALL_SPRITES, 85 BITMAP_BRICKS, 86 BITMAP_SCORES_FONTS, 87 88 MUSICAREA1 = 8192 89 90 } 91 RESOURCE_IDENTFIERS; 92 93 static const Sint16 cosinus360[720]; 94 static const Sint16 *zesinus360; 95 static const Uint32 color_gradations[180]; 96 97 private: 98 /** Size last file loaded in memory */ 99 Uint32 last_filesize_loaded; 100 handler_resources (); 101 102 public: 103 static handler_resources *get_instance (); 104 ~handler_resources (); 105 char *load_data (Uint32 resource_id); 106 char *get_music_filename (Uint32 resource_id); 107 char *get_sound_filename (Uint32 resource_id); 108 char *get_tilemaps_filename (Uint32 tile_num); 109 char *get_full_pathname (Uint32 resource_id); 110 void load_sprites_bitmap (Uint32 resource_id = BITMAP_ALL_SPRITES); 111 void release_sprites_bitmap (); 112 Uint32 get_filesize_loaded (); 113 char *read_complete_file (const char *filename); 114 void load_sinus (); 115 char *load_high_score_file (); 116 void save_high_score_file (char *buffer, Uint32 size); 117 char *locate_data_file (const char *const name); 118 char **load_texts (Uint32 resource_id, Uint32 maxof_lines = 119 0, Uint32 row_length = 0, Uint32 modulo = 0, bool upper_case = true); 120 char *get_filename (Uint32 resource_id, Uint32 res = 0); 121 122 private: 123 char *loadfile_with_lang (const char *const filename, Uint32 * const fsize); 124 char *load_file (const char *fname); 125 char *load_file (const char *fname, Uint32 * fsize); 126 void set_filesize_loaded (Uint32 size); 127 }; 128 129 #endif 130