235Variable *
sequence_load(
Environment * _environment,
char * _filename,
char * _alias,
int _mode,
int _frame_width,
int _frame_height,
int _flags,
int _transparent_color,
int _background_color,
int _bank_expansion,
int _origin_x,
int _origin_y,
int _offset_x,
int _offset_y ) {
244 final->valueBuffer =
malloc( 3 );
257 char *lookfor = _filename;
262 if ( strcmp(lookfor, first->
fileName ) == 0 ) {
277 for(
int i=0; i<atlasDescriptor->
count; ++i) {
278 Variable * partial =
image_converter( _environment, frame->
data, frame->
width, frame->
height, frame->
depth, 0, 0, frame->
width, frame->
height, _mode, _transparent_color, _flags );
279 if ( ! firstImage && ! lastImage ) {
280 firstImage = partial;
283 lastImage->
next = partial;
284 lastImage = lastImage->
next;
286 bufferSize += partial->
size;
294 char * buffer =
malloc( bufferSize );
297 ptr[1] = _frame_width;
300 if ( ( firstImage->
size * atlasDescriptor->
horizontal ) > 0xffff ) {
311 lastImage = firstImage;
312 for(
int i=0; i<atlasDescriptor->
count; ++i ) {
314 ptr += lastImage->
size;
315 lastImage = lastImage->
next;
318 final->originalBitmap = atlasDescriptor->
image->
data;
319 final->originalWidth = atlasDescriptor->
image->
width;
320 final->originalHeight = atlasDescriptor->
image->
height;
321 final->originalDepth = atlasDescriptor->
image->
depth;
324 final->frameSize = firstImage->
size;
325 final->frameCount = atlasDescriptor->
horizontal;
326 final->frameWidth = atlasDescriptor->
frames->
width;
329 lastImage = firstImage;
330 for(
int i=0; i<atlasDescriptor->
count; ++i ) {
332 lastImage = lastImage->
next;
341 if ( !
banks_store( _environment,
final, _bank_expansion ) ) {
352 final->uncompressedSize =
final->size;
357 if ( memcmp( outputCheck, final->valueBuffer, final->uncompressedSize ) != 0 ) {
368 if ( final->uncompressedSize < final->size ) {
369 final->size =
final->uncompressedSize;
370 final->uncompressedSize = 0;
376 final->valueBuffer = output;
380 free( final->valueBuffer );
381 final->valueBuffer = NULL;
387 loaded->
next = first;
void const_define_numeric(Environment *_environment, char *_name, int _value)
void variable_temporary_remove(Environment *_environment, char *_name)
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)
int banks_store(Environment *_environment, Variable *_variable, int _resident)
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
Variable * sequence_load(Environment *_environment, char *_filename, char *_alias, int _mode, int _frame_width, int _frame_height, int _flags, int _transparent_color, int _background_color, int _bank_expansion, int _origin_x, int _origin_y, int _offset_x, int _offset_y)
Emit code for LOAD IMAGE(...).
struct _ImageDescriptor * frames
struct _ImageDescriptor * image
int tenLinerRulesEnforced
struct _ImageDescriptor * next
struct _LoadedFile * next
unsigned char * valueBuffer
#define CRITICAL_10_LINE_RULES_ENFORCED(v)
struct _ImageDescriptor ImageDescriptor
struct _RGBi RGBi
Structure to store color components (red, green and blue).
#define UNIQUE_RESOURCE_ID
struct _Variable Variable
Structure of a single variable.
struct _Environment Environment
Structure of compilation environment.
struct _AtlasDescriptor AtlasDescriptor
#define CRITICAL_EXPANSION_OUT_OF_MEMORY_LOADING(v)
#define CRITICAL_SANDBOX_ENFORCED(v)
#define CRITICAL_SEQUENCE_LOAD_IMAGE_TOO_BIG(v)
struct _LoadedFile LoadedFile
#define CRITICAL_COMPRESSION_FAILED(v)