SWF export

This commit is contained in:
Robert Beckebans 2013-10-30 11:44:24 +01:00
parent 9c58fdf6f9
commit b952f3c594
2 changed files with 69 additions and 0 deletions

View file

@ -387,15 +387,22 @@ private:
friend class idSWFSprite;
friend class idSWFSpriteInstance;
// RB begin
bool LoadSWF( const char* fullpath );
void WriteSWF( const char* filename );
bool LoadBinary( const char* bfilename, ID_TIME_T sourceTime );
void WriteBinary( const char* bfilename );
<<<<<<< HEAD
<<<<<<< HEAD
void FileAttributes( idSWFBitStream& bitstream );
void Metadata( idSWFBitStream& bitstream );
void SetBackgroundColor( idSWFBitStream& bitstream );
=======
// RB begin
=======
>>>>>>> 534d415... SWF export
void LoadXML( const char* filename );
void WriteXML( const char* filename );
// RB end

View file

@ -139,6 +139,68 @@ bool idSWF::LoadSWF( const char* fullpath )
return true;
}
/*
===================
idSWF::WriteSWF
RB: bring .bswf back to .swf
===================
*/
void idSWF::WriteSWF( const char* fullpath )
{
idFileLocal file( fileSystem->OpenFileWrite( filename, "fs_basepath" ) );
if( file == NULL )
{
return;
}
swfHeader_t header;
header.W = 'W';
header.S = 'S';
header.version = 9;
header.compression == 'F';
file->Write( &header, sizeof( header ) );
// TODO
/*
swfRect_t frameSize;
bitstream.ReadRect( frameSize );
if( !frameSize.tl.Compare( vec2_zero ) )
{
idLib::Warning( "Invalid frameSize top left" );
Mem_Free( fileData );
return false;
}
frameWidth = frameSize.br.x;
frameHeight = frameSize.br.y;
frameRate = bitstream.ReadU16();
// parse everything
mainsprite->Load( bitstream, true );
// now that all images have been loaded, write out the combined image
idStr atlasFileName = "generated/";
atlasFileName += fullpath;
atlasFileName.SetFileExtension( ".tga" );
WriteSwfImageAtlas( atlasFileName );
Mem_Free( fileData );
*/
// add Tag_End
// go back and write filesize into header
uint32 fileSize = file->Length();
file->Seek( offsetof( swfHeader_t, fileLength ), FS_SEEK_SET );
file->WriteBig( fileSize );
}
/*
===================
idSWF::LoadBinary