74Variable *
tileset_storage(
Environment * _environment,
char * _source_name,
char * _target_name,
int _mode,
int _flags,
int _transparent_color,
int _background_color,
int _bank_expansion ) {
88 final->originalTileset = tileset;
94 if ( !tileset->
image ) {
104 char * filename = strdup( _source_name );
105 char * filenameWithPath =
malloc( 1024 );
106 memset( filenameWithPath, 0, 1024 );
107 char * separator = strrchr( filename,
'/' );
110 strcopy( filenameWithPath, filename );
112 strcat( filenameWithPath, tsxImage->
source );
117 for(
int i=0; i<atlasDescriptor->
count; ++i ) {
118 result[i] =
image_converter( _environment, frame->
data, frame->
width, frame->
height, frame->
depth, 0, 0, tileset->
tilewidth, tileset->
tileheight, _mode, _transparent_color, _flags );
119 bufferSize += result[i]->
size;
125 char * buffer =
malloc( bufferSize );
127 ptr[0] = atlasDescriptor->
count;
129 ptr[2] = ( tileset->
tilewidth >> 8 ) & 0xff;
131 if ( ( result[0]->
size * atlasDescriptor->
count ) > 0xffff ) {
139 for(
int i=0; i<atlasDescriptor->
count; ++i ) {
140 memcpy( ptr, result[i]->valueBuffer, result[i]->
size );
141 ptr += result[i]->
size;
144 final->originalBitmap = atlasDescriptor->
image->
data;
145 final->originalWidth = atlasDescriptor->
image->
width;
146 final->originalHeight = atlasDescriptor->
image->
height;
147 final->originalDepth = atlasDescriptor->
image->
depth;
152 final->firstGid = tileset->
firstgid;
153 final->frameSize = result[0]->
size;
154 final->frameCount = atlasDescriptor->
count;
156 for(
int i=0; i<atlasDescriptor->
count; ++i ) {
169 final->uncompressedSize =
final->size;
174 if ( memcmp( outputCheck, final->valueBuffer, final->uncompressedSize ) != 0 ) {
182 if ( final->uncompressedSize < final->size ) {
183 final->size =
final->uncompressedSize;
184 final->uncompressedSize = 0;
190 free( final->valueBuffer );
191 final->valueBuffer = output;
193 final->residentAssigned = 1;
void variable_temporary_remove(Environment *_environment, char *_name)
char * resource_load_asserts(Environment *_environment, char *_filename)
void offsetting_add_variable_reference(Environment *_environment, Offsetting *_first, Variable *_var, int _sequence)
Variable * variable_temporary(Environment *_environment, VariableType _type, char *_meaning)
Define a temporary variable.
Offsetting * offsetting_size_count(Environment *_environment, int _size, int _count)
Variable * variable_store_buffer(Environment *_environment, char *_destination, unsigned char *_buffer, int _size, int _at)
Variable * image_converter(Environment *_environment, char *_data, int _width, int _height, int _depth, int _offset_x, int _offset_y, int _frame_width, int _frame_height, int _mode, int _transparent_color, int _flags)
AtlasDescriptor * atlas_descriptor_create(Environment *_environment, char *_filename, int _flags, int _image_origin_x, int _image_origin_y, int _frame_width, int _frame_height, int _frame_offset_x, int _frame_offset_y)
void file_storage(Environment *_environment, char *_source_name, char *_target_name, FileStorageFormat _format, VariableType _type)
Emit code for FILE ... AS ....
MSC1Compressor * msc1_create(int _maximum_repeated_sequences)
void msc1_free(MSC1Compressor *_msc1)
MemoryBlock * msc1_uncompress(MSC1Compressor *_msc1, MemoryBlock *_input, int _size, int *_output_size)
MemoryBlock * msc1_compress(MSC1Compressor *_msc1, MemoryBlock *_input, int _size, int *_output_size)
unsigned char MemoryBlock
struct _MSC1Compressor MSC1Compressor
struct _ImageDescriptor * frames
struct _ImageDescriptor * image
int maxExpansionBankSize[MAX_RESIDENT_SHAREDS]
FileStorage * currentFileStorage
struct _ImageDescriptor * next
Variable * tileset_storage(Environment *_environment, char *_source_name, char *_target_name, int _mode, int _flags, int _transparent_color, int _background_color, int _bank_expansion)
Emit code for LOAD TILESERT(...).
TsxTileset * tsx_load(char *_filename)
struct _TsxTileset TsxTileset
struct _TsxImage TsxImage
struct _ImageDescriptor ImageDescriptor
struct _RGBi RGBi
Structure to store color components (red, green and blue).
#define MAX_TEMPORARY_STORAGE
#define CRITICAL_TILESET_LOAD_IMAGE_TOO_BIG(v)
struct _Variable Variable
Structure of a single variable.
struct _Environment Environment
Structure of compilation environment.
struct _AtlasDescriptor AtlasDescriptor
#define CRITICAL_TILESET_LOAD_MISSING_IMAGE(v)
#define CRITICAL_COMPRESSION_FAILED(v)
#define CRITICAL_TILESET_LOAD_UNKNOWN_FORMAT(v)
char * strcopy(char *_dest, char *_source)