diff --git a/neo/swf/SWF.h b/neo/swf/SWF.h
index 926f8e9d..1fb63773 100644
--- a/neo/swf/SWF.h
+++ b/neo/swf/SWF.h
@@ -3,6 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
+Copyright (C) 2013 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@@ -389,9 +390,16 @@ private:
bool LoadSWF( const char* fullpath );
bool LoadBinary( const char* bfilename, ID_TIME_T sourceTime );
void WriteBinary( const char* bfilename );
+<<<<<<< HEAD
void FileAttributes( idSWFBitStream& bitstream );
void Metadata( idSWFBitStream& bitstream );
void SetBackgroundColor( idSWFBitStream& bitstream );
+=======
+ // RB begin
+ void LoadXML( const char* filename );
+ void WriteXML( const char* filename );
+ // RB end
+>>>>>>> c4098bc... XML Flash part 1
//----------------------------------
// SWF_Shapes.cpp
@@ -495,6 +503,9 @@ public:
//----------------------------------
// SWF_Names.cpp
//----------------------------------
+ // RB begin
+ static const char* GetDictTypeName( swfDictType_t type );
+ // RB end
static const char* GetTagName( swfTag_t tag );
static const char* GetActionName( swfAction_t action );
diff --git a/neo/swf/SWF_Load.cpp b/neo/swf/SWF_Load.cpp
index 457b5a27..d36cde33 100644
--- a/neo/swf/SWF_Load.cpp
+++ b/neo/swf/SWF_Load.cpp
@@ -3,6 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
+Copyright (C) 2013 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@@ -34,6 +35,10 @@ If you have questions concerning this license or the applicable additional terms
#define BSWF_VERSION 16 // bumped to 16 for storing atlas image dimensions for unbuffered loads
#define BSWF_MAGIC ( ( 'B' << 24 ) | ( 'S' << 16 ) | ( 'W' << 8 ) | BSWF_VERSION )
+// RB begin
+#define XSWF_VERSION 16
+// RB end
+
/*
===================
idSWF::LoadSWF
@@ -529,6 +534,7 @@ void idSWF::WriteBinary( const char* bfilename )
}
}
+<<<<<<< HEAD
/*
===================
idSWF::FileAttributes
@@ -559,3 +565,447 @@ void idSWF::SetBackgroundColor( idSWFBitStream& bitstream )
{
bitstream.Seek( 4 ); // int
}
+=======
+
+// RB begin
+
+/*
+===================
+idSWF::WriteXML
+===================
+*/
+void idSWF::WriteXML( const char* filename )
+{
+ idFileLocal file( fileSystem->OpenFileWrite( filename, "fs_basepath" ) );
+ if( file == NULL )
+ {
+ return;
+ }
+
+ file->WriteFloatString( "\n" );
+ file->WriteFloatString( "\n", XSWF_VERSION, timestamp, frameWidth, frameHeight, frameRate );
+
+ //file->WriteBig( BSWF_MAGIC );
+ //file->WriteBig( timestamp );
+
+
+ //file->WriteBig( frameWidth );
+ //file->WriteBig( frameHeight );
+ //file->WriteBig( frameRate );
+
+ mainsprite->WriteXML( file );
+
+ file->WriteFloatString( "\t\n" );
+ for( int i = 0; i < dictionary.Num(); i++ )
+ {
+ const idSWFDictionaryEntry& entry = dictionary[i];
+
+ //file->WriteFloatString( "\t\n", idSWF::GetDictTypeName( dictionary[i].type ) );
+ switch( dictionary[i].type )
+ {
+ case SWF_DICT_IMAGE:
+ {
+ file->WriteFloatString( "\t\tWriteFloatString( "%s\"", dictionary[i].material->GetName() );
+ }
+ else
+ {
+ file->WriteFloatString( ".\"" );
+ }
+
+ file->WriteFloatString( " width=\"%i\" height=\"%i\" atlasOffsetX=\"%i\" atlasOffsetY=\"%i\">\n",
+ entry.imageSize[0], entry.imageSize[1], entry.imageAtlasOffset[0], entry.imageAtlasOffset[1] );
+
+ file->WriteFloatString( "\t\t\t\n", entry.channelScale.x, entry.channelScale.y, entry.channelScale.z, entry.channelScale.w );
+
+ file->WriteFloatString( "\t\t\n" );
+ //for( int j = 0 ; j < 2 ; j++ )
+ //{
+ // file->WriteBig( dictionary[i].imageSize[j] );
+ // file->WriteBig( dictionary[i].imageAtlasOffset[j] );
+ //}
+
+ //for( int j = 0 ; j < 4 ; j++ )
+ //{
+ // file->WriteBig( dictionary[i].channelScale[j] );
+ //}
+ break;
+ }
+
+ case SWF_DICT_MORPH:
+ case SWF_DICT_SHAPE:
+ {
+ idSWFShape* shape = dictionary[i].shape;
+
+ file->WriteFloatString( "\t\t\n" );
+
+ float x = shape->startBounds.tl.y;
+ float y = shape->startBounds.tl.x;
+ float width = fabs( shape->startBounds.br.y - shape->startBounds.tl.y );
+ float height = fabs( shape->startBounds.br.x - shape->startBounds.tl.x );
+
+ file->WriteFloatString( "\t\t\t\n", x, y, width, height );
+
+ x = shape->endBounds.tl.y;
+ y = shape->endBounds.tl.x;
+ width = fabs( shape->endBounds.br.y - shape->endBounds.tl.y );
+ height = fabs( shape->endBounds.br.x - shape->endBounds.tl.x );
+
+ file->WriteFloatString( "\t\t\t\n", x, y, width, height );
+
+ for( int d = 0; d < shape->fillDraws.Num(); d++ )
+ {
+ file->WriteFloatString( "\t\t\t\n" );
+
+ idSWFShapeDrawFill& fillDraw = shape->fillDraws[d];
+
+ file->WriteFloatString( "\t\t\t\tWriteFloatString( "\"gradient\"" );
+ }
+ else if( fillDraw.style.type == 4 )
+ {
+ file->WriteFloatString( "\"bitmap\"" );
+ }
+ else
+ {
+ file->WriteFloatString( "\"%i\"", fillDraw.style.type );
+ }
+
+ // 0 = linear, 2 = radial, 3 = focal; 0 = repeat, 1 = clamp, 2 = near repeat, 3 = near clamp
+ file->WriteFloatString( " subType=" );
+ if( fillDraw.style.subType == 0 )
+ {
+ file->WriteFloatString( "\"linear\"" );
+ }
+ else if( fillDraw.style.subType == 1 )
+ {
+ file->WriteFloatString( "\"radial\"" );
+ }
+ else if( fillDraw.style.subType == 2 )
+ {
+ file->WriteFloatString( "\"focal\"" );
+ }
+ else if( fillDraw.style.subType == 3 )
+ {
+ file->WriteFloatString( "\"near clamp\"" );
+ }
+ else
+ {
+ file->WriteFloatString( "\"%i\"", fillDraw.style.subType );
+ }
+
+ if( fillDraw.style.type == 1 && fillDraw.style.subType == 3 )
+ {
+ file->WriteFloatString( " focalPoint=\"%f\"", fillDraw.style.focalPoint );
+ }
+
+ if( fillDraw.style.type == 4 )
+ {
+ file->WriteFloatString( " bitmapID=\"%i\"", fillDraw.style.bitmapID );
+ }
+
+ file->WriteFloatString( ">\n", fillDraw.style.subType );
+
+ if( fillDraw.style.type == 0 )
+ {
+ idVec4 color = fillDraw.style.startColor.ToVec4();
+ file->WriteFloatString( "\t\t\t\t\t\n",
+ color.x, color.y, color.z, color.w );
+
+ color = fillDraw.style.endColor.ToVec4();
+ file->WriteFloatString( "\t\t\t\t\t\n",
+ color.x, color.y, color.z, color.w );
+ }
+
+ if( fillDraw.style.type > 0 )
+ {
+ swfMatrix_t m = fillDraw.style.startMatrix;
+ file->WriteFloatString( "\t\t\t\t\t%f %f %f %f %f %f\n",
+ m.xx, m.yy, m.xy, m.yx, m.tx, m.ty );
+
+ m = fillDraw.style.endMatrix;
+ file->WriteFloatString( "\t\t\t\t\t%f %f %f %f %f %f\n",
+ m.xx, m.yy, m.xy, m.yx, m.tx, m.ty );
+ }
+
+ for( int g = 0; g < fillDraw.style.gradient.numGradients; g++ )
+ {
+ swfGradientRecord_t gr = fillDraw.style.gradient.gradientRecords[g];
+
+ file->WriteFloatString( "\t\t\t\t\t\n", gr.startRatio, gr.endRatio );
+
+ idVec4 color = gr.startColor.ToVec4();
+ file->WriteFloatString( "\t\t\t\t\t\t\n",
+ color.x, color.y, color.z, color.w );
+
+ color = gr.endColor.ToVec4();
+ file->WriteFloatString( "\t\t\t\t\t\t\n",
+ color.x, color.y, color.z, color.w );
+ }
+
+ file->WriteFloatString( "\t\t\t\t\n" );
+
+ /*file->WriteBig( fillDraw.startVerts.Num() );
+ file->WriteBigArray( fillDraw.startVerts.Ptr(), fillDraw.startVerts.Num() );
+ file->WriteBig( fillDraw.endVerts.Num() );
+ file->WriteBigArray( fillDraw.endVerts.Ptr(), fillDraw.endVerts.Num() );
+ file->WriteBig( fillDraw.indices.Num() );
+ file->WriteBigArray( fillDraw.indices.Ptr(), fillDraw.indices.Num() );*/
+
+ //file->WriteBigArray( fillDraw.startVerts.Ptr(), fillDraw.startVerts.Num() );
+ for( int v = 0; v < fillDraw.startVerts.Num(); v++ )
+ {
+ const idVec2& vert = fillDraw.startVerts[v];
+
+ file->WriteFloatString( "\t\t\t\t\n", vert.x, vert.y );
+ }
+
+ for( int v = 0; v < fillDraw.endVerts.Num(); v++ )
+ {
+ const idVec2& vert = fillDraw.endVerts[v];
+
+ file->WriteFloatString( "\t\t\t\t\n", vert.x, vert.y );
+ }
+
+ file->WriteFloatString( "\t\t\t\t", fillDraw.indices.Num() );
+ for( int v = 0; v < fillDraw.indices.Num(); v++ )
+ {
+ const uint16& vert = fillDraw.indices[v];
+
+ file->WriteFloatString( "%i ", vert );
+ }
+ file->WriteFloatString( "\n" );
+
+ file->WriteFloatString( "\t\t\t\n" );
+ }
+
+ // TODO line draws
+
+ /*
+ file->WriteBig( shape->startBounds.tl );
+ file->WriteBig( shape->startBounds.br );
+ file->WriteBig( shape->endBounds.tl );
+ file->WriteBig( shape->endBounds.br );
+ file->WriteBig( shape->fillDraws.Num() );
+
+ for( int d = 0; d < shape->fillDraws.Num(); d++ )
+ {
+ idSWFShapeDrawFill& fillDraw = shape->fillDraws[d];
+ file->WriteBig( fillDraw.style.type );
+ file->WriteBig( fillDraw.style.subType );
+ file->Write( &fillDraw.style.startColor, 4 );
+ file->Write( &fillDraw.style.endColor, 4 );
+ file->WriteBigArray( ( float* )&fillDraw.style.startMatrix, 6 );
+ file->WriteBigArray( ( float* )&fillDraw.style.endMatrix, 6 );
+ file->WriteBig( fillDraw.style.gradient.numGradients );
+ for( int g = 0; g < fillDraw.style.gradient.numGradients; g++ )
+ {
+ file->WriteBig( fillDraw.style.gradient.gradientRecords[g].startRatio );
+ file->WriteBig( fillDraw.style.gradient.gradientRecords[g].endRatio );
+ file->Write( &fillDraw.style.gradient.gradientRecords[g].startColor, 4 );
+ file->Write( &fillDraw.style.gradient.gradientRecords[g].endColor, 4 );
+ }
+ file->WriteBig( fillDraw.style.focalPoint );
+ file->WriteBig( fillDraw.style.bitmapID );
+ file->WriteBig( fillDraw.startVerts.Num() );
+ file->WriteBigArray( fillDraw.startVerts.Ptr(), fillDraw.startVerts.Num() );
+ file->WriteBig( fillDraw.endVerts.Num() );
+ file->WriteBigArray( fillDraw.endVerts.Ptr(), fillDraw.endVerts.Num() );
+ file->WriteBig( fillDraw.indices.Num() );
+ file->WriteBigArray( fillDraw.indices.Ptr(), fillDraw.indices.Num() );
+ }
+ file->WriteBig( shape->lineDraws.Num() );
+ for( int d = 0; d < shape->lineDraws.Num(); d++ )
+ {
+ idSWFShapeDrawLine& lineDraw = shape->lineDraws[d];
+ file->WriteBig( lineDraw.style.startWidth );
+ file->WriteBig( lineDraw.style.endWidth );
+ file->Write( &lineDraw.style.startColor, 4 );
+ file->Write( &lineDraw.style.endColor, 4 );
+ file->WriteBig( lineDraw.startVerts.Num() );
+ file->WriteBigArray( lineDraw.startVerts.Ptr(), lineDraw.startVerts.Num() );
+ file->WriteBig( lineDraw.endVerts.Num() );
+ file->WriteBigArray( lineDraw.endVerts.Ptr(), lineDraw.endVerts.Num() );
+ file->WriteBig( lineDraw.indices.Num() );
+ file->WriteBigArray( lineDraw.indices.Ptr(), lineDraw.indices.Num() );
+ }
+ */
+
+ file->WriteFloatString( "\t\t\n" );
+ break;
+ }
+ }
+
+ //file->WriteFloatString( "\t\n" );
+ }
+
+ file->WriteFloatString( "\t" );
+
+#if 0
+ file->WriteBig( dictionary.Num() );
+ for( int i = 0; i < dictionary.Num(); i++ )
+ {
+ file->WriteBig( dictionary[i].type );
+ switch( dictionary[i].type )
+ {
+ case SWF_DICT_IMAGE:
+ {
+ if( dictionary[i].material )
+ {
+ file->WriteString( dictionary[i].material->GetName() );
+ }
+ else
+ {
+ file->WriteString( "." );
+ }
+ for( int j = 0 ; j < 2 ; j++ )
+ {
+ file->WriteBig( dictionary[i].imageSize[j] );
+ file->WriteBig( dictionary[i].imageAtlasOffset[j] );
+ }
+ for( int j = 0 ; j < 4 ; j++ )
+ {
+ file->WriteBig( dictionary[i].channelScale[j] );
+ }
+ break;
+ }
+ case SWF_DICT_MORPH:
+ case SWF_DICT_SHAPE:
+ {
+ idSWFShape* shape = dictionary[i].shape;
+ file->WriteBig( shape->startBounds.tl );
+ file->WriteBig( shape->startBounds.br );
+ file->WriteBig( shape->endBounds.tl );
+ file->WriteBig( shape->endBounds.br );
+ file->WriteBig( shape->fillDraws.Num() );
+ for( int d = 0; d < shape->fillDraws.Num(); d++ )
+ {
+ idSWFShapeDrawFill& fillDraw = shape->fillDraws[d];
+ file->WriteBig( fillDraw.style.type );
+ file->WriteBig( fillDraw.style.subType );
+ file->Write( &fillDraw.style.startColor, 4 );
+ file->Write( &fillDraw.style.endColor, 4 );
+ file->WriteBigArray( ( float* )&fillDraw.style.startMatrix, 6 );
+ file->WriteBigArray( ( float* )&fillDraw.style.endMatrix, 6 );
+ file->WriteBig( fillDraw.style.gradient.numGradients );
+ for( int g = 0; g < fillDraw.style.gradient.numGradients; g++ )
+ {
+ file->WriteBig( fillDraw.style.gradient.gradientRecords[g].startRatio );
+ file->WriteBig( fillDraw.style.gradient.gradientRecords[g].endRatio );
+ file->Write( &fillDraw.style.gradient.gradientRecords[g].startColor, 4 );
+ file->Write( &fillDraw.style.gradient.gradientRecords[g].endColor, 4 );
+ }
+ file->WriteBig( fillDraw.style.focalPoint );
+ file->WriteBig( fillDraw.style.bitmapID );
+ file->WriteBig( fillDraw.startVerts.Num() );
+ file->WriteBigArray( fillDraw.startVerts.Ptr(), fillDraw.startVerts.Num() );
+ file->WriteBig( fillDraw.endVerts.Num() );
+ file->WriteBigArray( fillDraw.endVerts.Ptr(), fillDraw.endVerts.Num() );
+ file->WriteBig( fillDraw.indices.Num() );
+ file->WriteBigArray( fillDraw.indices.Ptr(), fillDraw.indices.Num() );
+ }
+ file->WriteBig( shape->lineDraws.Num() );
+ for( int d = 0; d < shape->lineDraws.Num(); d++ )
+ {
+ idSWFShapeDrawLine& lineDraw = shape->lineDraws[d];
+ file->WriteBig( lineDraw.style.startWidth );
+ file->WriteBig( lineDraw.style.endWidth );
+ file->Write( &lineDraw.style.startColor, 4 );
+ file->Write( &lineDraw.style.endColor, 4 );
+ file->WriteBig( lineDraw.startVerts.Num() );
+ file->WriteBigArray( lineDraw.startVerts.Ptr(), lineDraw.startVerts.Num() );
+ file->WriteBig( lineDraw.endVerts.Num() );
+ file->WriteBigArray( lineDraw.endVerts.Ptr(), lineDraw.endVerts.Num() );
+ file->WriteBig( lineDraw.indices.Num() );
+ file->WriteBigArray( lineDraw.indices.Ptr(), lineDraw.indices.Num() );
+ }
+ break;
+ }
+ case SWF_DICT_SPRITE:
+ {
+ dictionary[i].sprite->Write( file );
+ break;
+ }
+ case SWF_DICT_FONT:
+ {
+ idSWFFont* font = dictionary[i].font;
+ file->WriteString( font->fontID->GetName() );
+ file->WriteBig( font->ascent );
+ file->WriteBig( font->descent );
+ file->WriteBig( font->leading );
+ file->WriteBig( font->glyphs.Num() );
+ for( int g = 0; g < font->glyphs.Num(); g++ )
+ {
+ file->WriteBig( font->glyphs[g].code );
+ file->WriteBig( font->glyphs[g].advance );
+ file->WriteBig( font->glyphs[g].verts.Num() );
+ file->WriteBigArray( font->glyphs[g].verts.Ptr(), font->glyphs[g].verts.Num() );
+ file->WriteBig( font->glyphs[g].indices.Num() );
+ file->WriteBigArray( font->glyphs[g].indices.Ptr(), font->glyphs[g].indices.Num() );
+ }
+ break;
+ }
+ case SWF_DICT_TEXT:
+ {
+ idSWFText* text = dictionary[i].text;
+ file->WriteBig( text->bounds.tl );
+ file->WriteBig( text->bounds.br );
+ file->WriteBigArray( ( float* )&text->matrix, 6 );
+ file->WriteBig( text->textRecords.Num() );
+ for( int t = 0; t < text->textRecords.Num(); t++ )
+ {
+ idSWFTextRecord& textRecord = text->textRecords[t];
+ file->WriteBig( textRecord.fontID );
+ file->Write( &textRecord.color, 4 );
+ file->WriteBig( textRecord.xOffset );
+ file->WriteBig( textRecord.yOffset );
+ file->WriteBig( textRecord.textHeight );
+ file->WriteBig( textRecord.firstGlyph );
+ file->WriteBig( textRecord.numGlyphs );
+ }
+ file->WriteBig( text->glyphs.Num() );
+ for( int g = 0; g < text->glyphs.Num(); g++ )
+ {
+ file->WriteBig( text->glyphs[g].index );
+ file->WriteBig( text->glyphs[g].advance );
+ }
+ break;
+ }
+ case SWF_DICT_EDITTEXT:
+ {
+ idSWFEditText* edittext = dictionary[i].edittext;
+ file->WriteBig( edittext->bounds.tl );
+ file->WriteBig( edittext->bounds.br );
+ file->WriteBig( edittext->flags );
+ file->WriteBig( edittext->fontID );
+ file->WriteBig( edittext->fontHeight );
+ file->Write( &edittext->color, 4 );
+ file->WriteBig( edittext->maxLength );
+ file->WriteBig( edittext->align );
+ file->WriteBig( edittext->leftMargin );
+ file->WriteBig( edittext->rightMargin );
+ file->WriteBig( edittext->indent );
+ file->WriteBig( edittext->leading );
+ file->WriteString( edittext->variable );
+ file->WriteString( edittext->initialText );
+ break;
+ }
+ }
+ }
+#endif
+
+ file->WriteFloatString( "\n" );
+}
+
+// RB end
+>>>>>>> c4098bc... XML Flash part 1
diff --git a/neo/swf/SWF_Main.cpp b/neo/swf/SWF_Main.cpp
index e56be060..29c84671 100644
--- a/neo/swf/SWF_Main.cpp
+++ b/neo/swf/SWF_Main.cpp
@@ -3,6 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
+Copyright (C) 2013 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@@ -32,6 +33,9 @@ If you have questions concerning this license or the applicable additional terms
#pragma warning(disable: 4355) // 'this' : used in base member initializer list
idCVar swf_loadBinary( "swf_loadBinary", "1", CVAR_INTEGER, "used to set whether to load binary swf from generated" );
+// RB begin
+idCVar swf_exportXML( "swf_exportXML", "1", CVAR_INTEGER, "" );
+// RB end
int idSWF::mouseX = -1;
int idSWF::mouseY = -1;
@@ -143,6 +147,18 @@ idSWF::idSWF( const char* filename_, idSoundWorld* soundWorld_ )
{
LoadSWF( filename );
}
+
+ // RB begin
+ if( swf_exportXML.GetBool() )
+ {
+ idStr xmlFileName = "generated/";
+ xmlFileName += filename;
+ xmlFileName.SetFileExtension( ".xml" );
+
+ WriteXML( xmlFileName );
+ }
+ // RB end
+
idStr atlasFileName = binaryFileName;
atlasFileName.SetFileExtension( ".tga" );
atlasMaterial = declManager->FindMaterial( atlasFileName );
diff --git a/neo/swf/SWF_Names.cpp b/neo/swf/SWF_Names.cpp
index 39f26301..f5d575f3 100644
--- a/neo/swf/SWF_Names.cpp
+++ b/neo/swf/SWF_Names.cpp
@@ -3,6 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
+Copyright (C) 2013 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@@ -28,6 +29,31 @@ If you have questions concerning this license or the applicable additional terms
#pragma hdrstop
#include "precompiled.h"
+// RB begin
+/*
+========================
+idSWF::GetDictTypeName
+========================
+*/
+const char* idSWF::GetDictTypeName( swfDictType_t type )
+{
+#define SWF_DICT_NAME( x ) case SWF_DICT_##x: return #x;
+ switch( type )
+ {
+ SWF_DICT_NAME( NULL );
+ SWF_DICT_NAME( IMAGE );
+ SWF_DICT_NAME( SHAPE );
+ SWF_DICT_NAME( MORPH );
+ SWF_DICT_NAME( SPRITE );
+ SWF_DICT_NAME( FONT );
+ SWF_DICT_NAME( TEXT );
+ SWF_DICT_NAME( EDITTEXT );
+ default:
+ return "????";
+ }
+}
+// RB end
+
/*
========================
idSWF::GetTagName
diff --git a/neo/swf/SWF_Sprites.cpp b/neo/swf/SWF_Sprites.cpp
index b5f4bb9d..bcb49572 100644
--- a/neo/swf/SWF_Sprites.cpp
+++ b/neo/swf/SWF_Sprites.cpp
@@ -3,6 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
+Copyright (C) 2013 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@@ -287,3 +288,55 @@ void idSWFSprite::Write( idFile* f )
f->WriteBig( doInitActions[i].Length() );
}
}
+
+
+// RB begin
+/*
+========================
+idSWFSprite::WriteXML
+========================
+*/
+void idSWFSprite::WriteXML( idFile* f )
+{
+ f->WriteFloatString( "\t\n", frameCount, frameOffsets.Num() );
+
+ f->WriteFloatString( "\t\t" );
+ for( int i = 0; i < frameOffsets.Num(); i++ )
+ {
+ f->WriteFloatString( "%i ", frameOffsets[i] );
+ }
+ f->WriteFloatString( "\n" );
+
+ //f->WriteFloatString( "\t\t", frameLabels.Num() );
+ for( int i = 0; i < frameLabels.Num(); i++ )
+ {
+ f->WriteFloatString( "\t\t\n", frameLabels[i].frameNum, frameLabels[i].frameLabel );
+ }
+
+
+ idBase64 base64;
+
+ for( int i = 0; i < commands.Num(); i++ )
+ {
+ base64.Encode( commands[i].stream.Ptr(), commands[i].stream.Length() );
+ //base64.Decode( src );
+
+ //f->WriteFloatString( "\t\t%s\n", idSWF::GetTagName( commands[i].tag ), src.Length(), src.c_str() );
+
+ f->WriteFloatString( "\t\t%s\n", idSWF::GetTagName( commands[i].tag ), commands[i].stream.Length(), base64.c_str() );
+
+ //f->WriteFloatString( "\t\t%s\n", idSWF::GetTagName( commands[i].tag ), commands[i].stream.Length(), commands[i].stream.Ptr() );
+ }
+
+ for( int i = 0; i < doInitActions.Num(); i++ )
+ {
+ base64.Encode( doInitActions[i].Ptr(), doInitActions[i].Length() );
+
+ f->WriteFloatString( "\t\t%s\n", doInitActions[i].Length(), base64.c_str() );
+
+ //f->WriteFloatString( "\t\t%s\n", doInitActions[i].Length(), doInitActions[i].Ptr() );
+ }
+
+ f->WriteFloatString( "\t\n" );
+}
+// RB end
diff --git a/neo/swf/SWF_Sprites.h b/neo/swf/SWF_Sprites.h
index 7b86e9c9..828a3463 100644
--- a/neo/swf/SWF_Sprites.h
+++ b/neo/swf/SWF_Sprites.h
@@ -3,6 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
+Copyright (C) 2013 Robert Beckebans
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@@ -46,6 +47,10 @@ public:
void Read( idFile* f );
void Write( idFile* f );
+ // RB begin
+ void WriteXML( idFile* f );
+ // RB end
+
class idSWF* GetSWF()
{
return swf;