6 void begintag( FILE *Fp,
const char *tag,
int indent )
9 for (i = 0; i < indent; i++)
10 VSFileSystem::Write(
"\t",
sizeof (
char), 1, Fp );
11 VSFileSystem::Write(
"<",
sizeof (
char), 1, Fp );
12 VSFileSystem::Write( tag,
sizeof (
char)*strlen( tag ), 1, Fp );
14 void midxmltag( FILE *Fp,
const char *tag,
const float value )
16 char value2[100] = {0};
17 sprintf( value2,
"%g", value );
18 VSFileSystem::Write(
" ",
sizeof (
char), 1, Fp );
19 VSFileSystem::Write( tag,
sizeof (
char)*strlen( tag ), 1, Fp );
20 VSFileSystem::Write(
"=\"",
sizeof (
char)*2, 1, Fp );
21 VSFileSystem::Write( value2,
sizeof (
char)*strlen( value2 ), 1, Fp );
22 VSFileSystem::Write(
"\"",
sizeof (
char)*1, 1, Fp );
25 void midxmlchar( FILE *Fp,
const char *tag,
const char *value )
27 VSFileSystem::Write(
" ",
sizeof (
char), 1, Fp );
28 VSFileSystem::Write( tag,
sizeof (
char)*strlen( tag ), 1, Fp );
29 VSFileSystem::Write(
"=\"",
sizeof (
char)*2, 1, Fp );
30 VSFileSystem::Write( value,
sizeof (
char)*strlen( value ), 1, Fp );
31 VSFileSystem::Write(
"\"",
sizeof (
char)*1, 1, Fp );
33 void midxmlint( FILE *Fp,
const char *tag,
const int value )
35 char value2[100] = {0};
36 sprintf( value2,
"%d", value );
37 VSFileSystem::Write(
" ",
sizeof (
char), 1, Fp );
38 VSFileSystem::Write( tag,
sizeof (
char)*strlen( tag ), 1, Fp );
39 VSFileSystem::Write(
"=\"",
sizeof (
char)*2, 1, Fp );
40 VSFileSystem::Write( value2,
sizeof (
char)*strlen( value2 ), 1, Fp );
41 VSFileSystem::Write(
"\"",
sizeof (
char)*1, 1, Fp );
43 void midxmlbool( FILE *Fp,
const char *tag,
const bool value )
46 strcpy( value2, value ==
true ?
"true" :
"false" );
47 VSFileSystem::Write(
" ",
sizeof (
char), 1, Fp );
48 VSFileSystem::Write( tag,
sizeof (
char)*strlen( tag ), 1, Fp );
49 VSFileSystem::Write(
"=\"",
sizeof (
char)*2, 1, Fp );
50 VSFileSystem::Write( value2,
sizeof (
char)*strlen( value2 ), 1, Fp );
51 VSFileSystem::Write(
"\"",
sizeof (
char)*1, 1, Fp );
53 void endtag( FILE *Fp,
bool end =
false )
56 VSFileSystem::Write(
"/",
sizeof (
char), 1, Fp );
57 VSFileSystem::Write(
">\n",
sizeof (
char)*2, 1, Fp );
60 void BaseInterface::Room::Link::EndXML( FILE *fp )
62 midxmlchar( fp,
"Text",
text.c_str() );
63 midxmltag( fp,
"x",
x );
64 midxmltag( fp,
"y",
y );
65 midxmltag( fp,
"wid",
wid );
66 midxmltag( fp,
"hei",
hei );
69 void BaseInterface::Room::Python::EndXML( FILE *fp )
71 begintag( fp,
"Python", 2 );
73 midxmlchar( fp,
"pythonfile",
file.c_str() );
77 void BaseInterface::Room::Goto::EndXML( FILE *fp )
79 begintag( fp,
"Link", 2 );
81 midxmlint( fp,
"index",
index );
85 void BaseInterface::Room::Talk::EndXML( FILE *fp )
87 begintag( fp,
"Talk", 2 );
90 for (
int i = 0; i < say.size(); i++) {
91 begintag( fp,
"say", 3 );
92 for (
int j = 0;
j < say[i].size();
j++)
93 if (say[i][j] ==
'\n')
95 midxmlchar( fp,
"text", say[i].c_str() );
96 midxmlchar( fp,
"soundfile", soundfiles[i].c_str() );
99 begintag( fp,
"/Talk", 2 );
103 void BaseInterface::Room::Launch::EndXML( FILE *fp )
105 begintag( fp,
"Launch", 2 );
110 void BaseInterface::Room::Comp::EndXML( FILE *fp )
112 begintag( fp,
"Comp", 2 );
114 for (
int i = 0; i < modes.size(); i++) {
138 midxmlchar( fp, mode,
"" );
143 void BaseInterface::Room::BaseObj::EndXML( FILE *fp )
148 void BaseInterface::Room::BaseShip::EndXML( FILE *fp )
150 begintag( fp,
"Ship", 2 );
151 midxmltag( fp,
"x", mat.p.i );
152 midxmltag( fp,
"y", mat.p.j );
153 midxmltag( fp,
"z", mat.p.k );
154 midxmltag( fp,
"ri", mat.getR().i );
155 midxmltag( fp,
"rj", mat.getR().j );
156 midxmltag( fp,
"rk", mat.getR().k );
157 midxmltag( fp,
"qi", mat.getQ().i );
158 midxmltag( fp,
"qj", mat.getQ().j );
159 midxmltag( fp,
"qk", mat.getQ().k );
163 void BaseInterface::Room::BaseVSSprite::EndXML( FILE *fp )
166 begintag( fp,
"Texture", 2 );
167 spr.GetPosition( x, y );
168 midxmlchar( fp,
"File", texfile.c_str() );
169 midxmltag( fp,
"x", x );
170 midxmltag( fp,
"y", y );
174 void BaseInterface::Room::EndXML( FILE *fp )
176 begintag( fp,
"Room", 1 );
177 midxmlchar( fp,
"Text",
deftext.c_str() );
180 for (i = 0; i <
links.size(); i++)
182 links[i]->EndXML( fp );
183 for (i = 0; i <
objs.size(); i++)
185 objs[i]->EndXML( fp );
186 begintag( fp,
"/Room", 1 );
190 void BaseInterface::EndXML( FILE *fp )
192 begintag( fp,
"Base", 0 );
194 for (
int i = 0; i <
rooms.size(); i++)
195 rooms[i]->EndXML( fp );
196 begintag( fp,
"/Base", 0 );