src/demo.cpp

changeset 24
61e2752dd7cd
parent 23
3ce91eac0f24
child 26
9aab482c9125
equal deleted inserted replaced
23:3ce91eac0f24 24:61e2752dd7cd
155 155
156 // Read the demo header and get data 156 // Read the demo header and get data
157 for (;;) { 157 for (;;) {
158 uint8 header; 158 uint8 header;
159 stream >> header; 159 stream >> header;
160 print ("header: %1\n", (int) header);
161 160
162 if (header == DemoBodyStart + offset) { 161 if (header == DemoBodyStart + offset) {
163 ready = true; 162 ready = true;
164 break; 163 break;
165 } elif (header == DemoVersion + offset) { 164 } elif (header == DemoVersion + offset) {
166 print ("Read demo version\n");
167 stream >> zanversionID; 165 stream >> zanversionID;
168 zanversion = readString (stream); 166 zanversion = readString (stream);
169
170 print ("version ID: %1, version: %2\n", zanversionID, zanversion);
171 167
172 if (!zanversion.startsWith ("1.1-") && !zanversion.startsWith ("1.1.1-")) { 168 if (!zanversion.startsWith ("1.1-") && !zanversion.startsWith ("1.1.1-")) {
173 uint8 a; 169 uint8 a;
174 stream >> a; 170 stream >> a;
175 buildID = (BuildType) a; 171 buildID = (BuildType) a;
180 buildID = ReleaseBuild; 176 buildID = ReleaseBuild;
181 } 177 }
182 178
183 stream >> longSink; // rng seed - we don't need it 179 stream >> longSink; // rng seed - we don't need it
184 } elif (header == DemoUserInfo + offset) { 180 } elif (header == DemoUserInfo + offset) {
185 print ("Read userinfo\n");
186 userinfo.netname = readString (stream); 181 userinfo.netname = readString (stream);
187 stream >> userinfo.gender 182 stream >> userinfo.gender
188 >> userinfo.color 183 >> userinfo.color
189 >> userinfo.aimdist; 184 >> userinfo.aimdist;
190 userinfo.skin = readString (stream); 185 userinfo.skin = readString (stream);
205 } 200 }
206 201
207 // The demo has two checksum strings. We're not interested 202 // The demo has two checksum strings. We're not interested
208 // in them though. Down the sink they go... 203 // in them though. Down the sink they go...
209 for (int i = 0; i < 2; ++i) 204 for (int i = 0; i < 2; ++i)
210 stream >> sink; 205 sink = readString (stream);
211 } else { 206 } else {
212 error (fmt (tr ("Unknown header %1!\n"), (int) header)); 207 error (fmt (tr ("Unknown header %1!\n"), (int) header));
213 return 3; 208 return 3;
214 } 209 }
215 } 210 }
280 ui.demoNameLabel->setText (basename (path)); 275 ui.demoNameLabel->setText (basename (path));
281 ui.demoRecorder->setText (uncolorize (userinfo.netname)); 276 ui.demoRecorder->setText (uncolorize (userinfo.netname));
282 ui.versionLabel->setText (zanversion); 277 ui.versionLabel->setText (zanversion);
283 ui.iwadLabel->setText (wads[0]); 278 ui.iwadLabel->setText (wads[0]);
284 ui.pwadsLabel->setText (pwadtext); 279 ui.pwadsLabel->setText (pwadtext);
285 dlg->setWindowTitle (fmt (APPNAME " %1", versionString())); 280 dlg->setWindowTitle (str (APPNAME) + " " + versionString());
286 281
287 if (!dlg->exec()) 282 if (!dlg->exec())
288 return 1; 283 return 1;
289 } 284 }
290 285

mercurial