1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
|
/**
* @file handler_resources.h
* @brief Handler of the files resources
* @created 2004-04-20
* @date 2007-10-09
* @copyright 1991-2007 TLK Games
* @author Bruno Ethvignot
* @version $Revision: 1.19 $
*/
/*
* copyright (c) 1991-2007 TLK Games all rights reserved
* $Id: handler_resources.h,v 1.19 2007/10/09 05:46:24 gurumeditation Exp $
*
* TecnoballZ is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* TecnoballZ is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#ifndef __HANDLER_RESOURCES__
#define __HANDLER_RESOURCES__
#include "../include/tecnoballz.h"
class handler_resources:public virtual tecnoballz
{
private:
static const char *folderlist[];
static const char *bitmap_files[];
static const char *texts_files[];
static const char *standfiles[];
static const char *musicfiles[];
static const char *soundfiles[];
static const char *folderdata;
static const char *folder_320;
static const char *folder_640;
static char *fnamescore;
static char tmp_filename[512];
static char pathstring[512];
static const Uint32 TEXTS_OFFSET = 2048;
static const Uint32 BITMAP_OFFSET = 4096;
public:
/** Different identifiers of the resources */
typedef enum
{
RESCOSLIST = 0,
MAP_GUARDIANS_20,
MAP_GUARDIANS_40,
MAP_CONGRATULATIONS_20,
MAP_CONGRATULATIONS_40,
MAP_MENU_20,
MAP_MENU_40,
RESGCURVES,
DATA_BRICKS_LEVELS,
RES60BACKG,
DATA_LEVELS,
TEXTS_SHOP = TEXTS_OFFSET,
TEXTS_MESSAGES,
TEXTS_SCROLL_MENU,
TEXTS_POPUP_MENU,
TEXTS_MAIN_MENU,
BITMAP_HEAD_ANIMATION = BITMAP_OFFSET,
BITMAP_RIGHT_PANEL,
BITMAP_PADDLES_1,
BITMAP_PADDLES_2,
BITMAP_GAME_FONTS,
BITMAP_MENU_FONTS,
BITMAP_SMALL_FONTS,
BITMAP_GIGABLITZ,
BITMAP_TILESMAP,
BITMAP_SHOP,
BITMAP_ALL_SPRITES,
BITMAP_BRICKS,
BITMAP_SCORES_FONTS,
MUSICAREA1 = 8192,
}
RESOURCE_IDENTFIERS;
static const Sint16 cosinus360[720];
static const Sint16 *zesinus360;
static const Uint32 color_gradations[180];
private:
/** Size last file loaded in memory */
Uint32 last_filesize_loaded;
public:
handler_resources ();
~handler_resources ();
char *load_data (Uint32 resource_id);
char *get_music_filename (Uint32 resource_id);
char *get_sound_filename (Uint32 resource_id);
char *get_tilemaps_filename (Uint32 tile_num);
char *get_full_pathname (Uint32 resource_id);
void load_sprites_bitmap (Uint32 resource_id = BITMAP_ALL_SPRITES);
void release_sprites_bitmap ();
Uint32 get_filesize_loaded ();
void load_sinus ();
char *load_high_score_file ();
void save_high_score_file (char *buffer, Uint32 size);
char *locate_data_file (const char *const name);
char **load_texts (Uint32 resource_id, Uint32 maxof_lines =
0, Uint32 row_length = 0, Uint32 modulo = 0, bool upper_case = true);
char *get_filename (Uint32 resource_id, Uint32 res = 0);
private:
char *loadfile_with_lang (const char *const filename, Uint32 * const fsize);
char *load_file (char *fname);
char *load_file (char *fname, Uint32 * fsize);
};
#endif
|