diff --git a/neo/swf/SWF.h b/neo/swf/SWF.h index 4832ba6d..ef068621 100644 --- a/neo/swf/SWF.h +++ b/neo/swf/SWF.h @@ -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 diff --git a/neo/swf/SWF_Load.cpp b/neo/swf/SWF_Load.cpp index 8154fc30..7f9cdd60 100644 --- a/neo/swf/SWF_Load.cpp +++ b/neo/swf/SWF_Load.cpp @@ -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