/* ================ idSaveGame::WriteRenderEntity ================ */ void idSaveGame::WriteRenderEntity( const renderEntity_t &renderEntity ) { int i; WriteModel( renderEntity.hModel ); WriteInt( renderEntity.entityNum ); WriteInt( renderEntity.bodyId ); WriteBounds( renderEntity.bounds ); // callback is set by class's Restore function WriteInt( renderEntity.suppressSurfaceInViewID ); WriteInt( renderEntity.suppressShadowInViewID ); WriteInt( renderEntity.suppressShadowInLightID ); WriteInt( renderEntity.allowSurfaceInViewID ); WriteVec3( renderEntity.origin ); WriteMat3( renderEntity.axis ); WriteMaterial( renderEntity.customShader ); WriteMaterial( renderEntity.referenceShader ); WriteSkin( renderEntity.customSkin ); if( renderEntity.referenceSound != NULL ) { WriteInt( renderEntity.referenceSound->Index() ); } else { WriteInt( 0 ); } for( i = 0; i < MAX_ENTITY_SHADER_PARMS; i++ ) { WriteFloat( renderEntity.shaderParms[ i ] ); } for( i = 0; i < MAX_RENDERENTITY_GUI; i++ ) { WriteUserInterface( renderEntity.gui[ i ], renderEntity.gui[ i ] ? renderEntity.gui[ i ]->IsUniqued() : false ); } WriteFloat( renderEntity.modelDepthHack ); WriteBool( renderEntity.noSelfShadow ); WriteBool( renderEntity.noShadow ); WriteBool( renderEntity.noDynamicInteractions ); WriteBool( renderEntity.weaponDepthHack ); WriteInt( renderEntity.forceUpdate ); }
mEResult mCAseWriter::WriteAseFileData( mCScene const & a_sceneSource, mCIOStreamBinary & a_streamDest, SOptions const a_Options ) { s_bAscFormat = a_Options.m_bGothicAscFormat; a_streamDest.Write( GetTokenLine( "3DSMAX_ASCIIEXPORT", ( a_Options.m_bGothicAscFormat ? "110" : "200" ) ) ); a_streamDest.Write( GetTokenLine( "COMMENT", "\"Created using Baltram's ASC and ASE file writer\"" ) ); a_streamDest.Write( StartBlock( "SCENE" ) ); a_streamDest.Write( GetTokenLine( "SCENE_FILENAME", "\"" + g_GetFileName( a_sceneSource.GetName() ) + "\"" ) ); a_streamDest.Write( GetTokenLine( "SCENE_FIRSTFRAME", "0" ) ); a_streamDest.Write( GetTokenLine( "SCENE_LASTFRAME", "100" ) ); a_streamDest.Write( GetTokenLine( "SCENE_FRAMESPEED", "30" ) ); a_streamDest.Write( GetTokenLine( "SCENE_TICKSPERFRAME", "160" ) ); a_streamDest.Write( GetTokenLine( "SCENE_BACKGROUND_STATIC", "0.0000\t0.0000\t0.0000" ) ); a_streamDest.Write( GetTokenLine( "SCENE_AMBIENT_STATIC", "0.0000\t0.0000\t0.0000" ) ); a_streamDest.Write( EndBlock() ); a_streamDest.Write( StartBlock( "MATERIAL_LIST" ) ); mTArray< mCNode const * > arrNodes; a_sceneSource.GetNodesSortedByLinks( arrNodes ); mCScene sceneTemp; mCScene const & sceneMaterials = s_bAscFormat ? sceneTemp : a_sceneSource; mCNode nodeBip01( "Bip01" ); if ( s_bAscFormat ) { arrNodes.InsertAt( 0, &nodeBip01 ); for ( MIUInt u = a_sceneSource.GetNumNodes(); u--; ) { mCNode const & nodeNode = *a_sceneSource.GetNodeAt( u ); MIUInt uMaterialIndex = a_sceneSource.GetMaterialIndexByName( nodeNode.GetMaterialName() ); if ( ( uMaterialIndex != MI_DW_INVALID ) && ( sceneTemp.GetNumMaterials() == 0 ) ) sceneTemp.AddMaterial( *a_sceneSource.GetMaterialAt( uMaterialIndex ) ); } } MIUInt const uMaterialCount = sceneMaterials.GetNumMaterials(); a_streamDest.Write( GetTokenLine( "MATERIAL_COUNT", mCString().Format( "%u", uMaterialCount ) ) ); for ( MIUInt u = 0; u != uMaterialCount; ++u ) { a_streamDest.Write( StartBlock( mCString().Format( "MATERIAL %u", u ) ) ); WriteMaterial( sceneMaterials.GetMaterialAt( u ), a_streamDest ); a_streamDest.Write( EndBlock() ); } a_streamDest.Write( EndBlock() ); for ( MIUInt u = 0, ue = arrNodes.GetCount(); u != ue; ++u ) { if ( u && ( !arrNodes[ u ]->GetName().CompareNoCase( "Bip01" ) ) ) continue; a_streamDest.Write( StartBlock( ( arrNodes[ u ]->HasMesh() || arrNodes[ u ]->GetIsBone() || !u ) ? "GEOMOBJECT" : "HELPEROBJECT" ) ); WriteNode( a_sceneSource, *arrNodes[ u ], a_streamDest, a_Options ); a_streamDest.Write( EndBlock() ); } if ( a_Options.m_bGothicAscFormat ) { for ( MIUInt u = 0; u != a_sceneSource.GetNumNodes(); ++u ) if ( a_sceneSource.GetNodeAt( u )->HasSkin() && a_sceneSource.GetNodeAt( u )->HasMesh() ) WriteSkin( a_sceneSource, u, a_streamDest ); } return mEResult_Ok; }