11 #include "../clib/passert.h" 12 #include "../clib/rawtypes.h" 13 #include "../plib/systemstate.h" 22 #define VERFILE_TILEDATA 0x1E 23 #define TILEDATA_TILES 0x68800 24 #define TILEDATA_TILES_HSA 0x78800 40 return landtile_flags_arr[landtile];
46 typedef std::map<unsigned int, Core::USTRUCT_VERSION>
VRecList;
54 vrecs.insert( VRecList::value_type( vrec.
block, vrec ) );
58 VRecList::const_iterator itr = vrecs.find( block );
59 if ( itr == vrecs.end() )
62 vrec = &( ( *itr ).second );
72 return vidx[file].
find( block, vrec );
78 if ( vidx[file].find( block, vrec ) )
91 memset( tile, 0,
sizeof *tile );
95 sprintf( tile->
name,
"multi" );
101 block = ( tilenum / 32 );
105 filepos = 4 + (
sizeof *tile ) * ( tilenum & 0x1F );
124 tile->
name[
sizeof( tile->
name ) - 1] =
'\0';
129 memset( tile, 0,
sizeof *tile );
133 sprintf( tile->
name,
"multi" );
139 block = ( tilenum / 32 );
143 filepos = 4 + (
sizeof *tile ) * ( tilenum & 0x1F );
159 tile->
name[
sizeof( tile->
name ) - 1] =
'\0';
165 memset( landtile, 0,
sizeof( *landtile ) );
167 if ( tilenum <= 0x3FFF )
170 block = ( tilenum / 32 );
174 filepos = 4 + (
sizeof *landtile ) * ( tilenum & 0x1F );
181 filepos = ( block * 4 ) +
190 landtile->
name[
sizeof( landtile->
name ) - 1] =
'\0';
195 memset( landtile, 0,
sizeof( *landtile ) );
197 if ( tilenum <= 0x3FFF )
200 block = ( tilenum / 32 );
204 filepos = 4 + (
sizeof *landtile ) * ( tilenum & 0x1F );
211 filepos = ( block * 4 ) +
220 landtile->
name[
sizeof( landtile->
name ) - 1] =
'\0';
240 height = tiledata[tilenum].
height;
241 flags = tiledata[tilenum].
flags;
262 return ( height / 2 );
267 unsigned char tilelayer(
unsigned short tilenum )
271 return tiledata[tilenum].
layer;
314 return tiledata[tilenum].
flags;
338 int num_version_records;
345 fread( &num_version_records,
sizeof num_version_records, 1,
verfile );
347 for (
int i = 0; i < num_version_records; i++ )
349 fread( &vrec,
sizeof vrec, 1,
verfile );
351 if ( vrec.
file < vidx_count )
365 u16 graphic =
static_cast<u16>( graphic_i );
369 memset( &objinfo, 0,
sizeof objinfo );
379 memset( &objinfo, 0,
sizeof objinfo );
403 landtile_flags_arr[objtype] = landtile.
flags;
410 landtile_flags_arr[objtype] = landtile.
flags;
void readtile(unsigned short tilenum, USTRUCT_TILE *tile)
static void read_veridx()
std::map< unsigned int, Core::USTRUCT_VERSION > VRecList
unsigned int tile_uoflags(unsigned short tilenum)
unsigned char tilelayer(unsigned short tilenum)
const unsigned int vidx_count
void read_objinfo(u16 graphic, struct USTRUCT_TILE &objinfo)
bool cfg_use_new_hsa_format
void readlandtile(unsigned short tilenum, USTRUCT_LAND_TILE *landtile)
bool check_verdata(unsigned int file, unsigned int block, const Core::USTRUCT_VERSION *&vrec)
unsigned int landtile_uoflags(unsigned short landtile)
static void read_tiledata()
#define TILEDATA_TILES_HSA
char tileheight(unsigned short tilenum)
static bool seekto_newer_version(unsigned int file, unsigned int block)
unsigned int landtile_flags_arr[N_LANDTILEDATA]
const unsigned N_LANDTILEDATA
static void read_landtiledata()
bool find(unsigned int block, const Core::USTRUCT_VERSION *&vrec)
unsigned short tileweight(unsigned short tilenum)
#define passert_always(exp)
void insert(const Core::USTRUCT_VERSION &vrec)