1 /*------------------------------------------------------------------. 2 | Copyright 2001, 2002 Alexandre Duret-Lutz <duret_g@epita.fr> | 3 | | 4 | This file is part of Heroes. | 5 | | 6 | Heroes is free software; you can redistribute it and/or modify it | 7 | under the terms of the GNU General Public License version 2 as | 8 | published by the Free Software Foundation. | 9 | | 10 | Heroes is distributed in the hope that it will be useful, but | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | General Public License for more details. | 14 | | 15 | You should have received a copy of the GNU General Public License | 16 | along with this program; if not, write to the Free Software | 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | 18 | 02111-1307 USA | 19 `------------------------------------------------------------------*/ 20 21 #ifndef HEROES__LVL_PRIV__H 22 #define HEROES__LVL_PRIV__H 23 24 /*-------------------------------------------------------------------. 25 | NOTE: This is a private header, for use in the level loading code | 26 | only. Clients of the `lvl' module should only rely on the `lvl.h' | 27 | interface. | 28 `-------------------------------------------------------------------*/ 29 30 /* We don't want to see constant attribute from here. */ 31 #define LVL_MUTABLE 32 #include "lvl.h" 33 34 typedef struct a_tile_data a_tile_data; 35 struct a_tile_data { 36 a_tile_type type; 37 /* Animation data. */ 38 unsigned int frame_count; 39 unsigned int frame_delay; 40 an_anim_kind anim; 41 /* Tunnel data. */ 42 /* a_dir tunnel_direction; FIXME: Useless ? */ 43 /* Sprite data. */ 44 unsigned int sprite_offset; 45 unsigned int sprite_overlay_offset; 46 }; 47 48 /* Number of players handled by level format. */ 49 #define LVL_PLAYER_COUNT 4 50 51 /* Size in bytes of the level header on disk. */ 52 #define LVL_HEADER_SIZE 64 53 /* The body of the level is made of tile_count records of 54 LVL_RECORD_SIZE bytes. */ 55 #define LVL_RECORD_SIZE 16 56 57 /* The following is declared, but not defined in lvl.h. */ 58 struct a_level_bits { 59 /* Starting position for each player. */ 60 a_square_corrd_pair start_pos[LVL_PLAYER_COUNT]; 61 /* Starting direction for each player. */ 62 a_dir start_dir[LVL_PLAYER_COUNT]; 63 /* Alias for the soundtrack, to be resolved to a true filename by 64 someone else. */ 65 char *sound_track_alias; 66 /* Basename for the tile sprite map, to be expanded as a real 67 filename by someone else. */ 68 char *tile_sprite_map_basename; 69 70 /* Information for each tile (present only if the body is loaded). */ 71 a_tile_data *tile; 72 }; 73 74 void decode_level_header (const a_u8 *data, a_level *lvl); 75 void decode_level_body (const a_u8 *data, a_level *lvl); 76 void initialize_level_body (a_level *out); 77 void initialize_empty_level_body (a_level *lvl); 78 void encode_level_header (a_u8 *data, const a_level *lvl); 79 void encode_level_body (a_u8 *data, const a_level *lvl); 80 81 #endif /* HEROES__LVL_PRIV__H */ 82