1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
/*
* This code is based on the original source code of Lord Avalot d'Argent version 1.3.
* Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman.
*/
#include "avalanche/avalanche.h"
#include "common/system.h"
#include "common/random.h"
#include "common/error.h"
#include "common/events.h"
#include "common/debug-channels.h"
#include "common/config-manager.h"
#include "common/textconsole.h"
#include "common/savefile.h"
#include "engines/util.h"
#include "gui/saveload.h"
#include "graphics/thumbnail.h"
namespace Avalanche {
AvalancheEngine *AvalancheEngine::s_Engine = 0;
AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription *gd) : Engine(syst), _gameDescription(gd) {
_system = syst;
s_Engine = this;
_console = new AvalancheConsole(this);
_rnd = new Common::RandomSource("avalanche");
_rnd->setSeed(42);
}
AvalancheEngine::~AvalancheEngine() {
delete _console;
delete _rnd;
delete _graphics;
delete _parser;
delete _avalot;
delete _gyro;
delete _enhanced;
delete _pingo;
delete _scrolls;
delete _visa;
delete _lucerna;
delete _enid;
delete _celer;
delete _sequence;
delete _timeout;
delete _trip;
delete _acci;
delete _dropdown;
delete _closing;
}
Common::ErrorCode AvalancheEngine::initialize() {
_graphics = new Graphics(this);
_parser = new Parser(this);
_avalot = new Avalot(this);
_gyro = new Gyro(this);
_enhanced = new Enhanced(this);
_pingo = new Pingo(this);
_scrolls = new Scrolls(this);
_visa = new Visa(this);
_lucerna = new Lucerna(this);
_enid = new Enid(this);
_celer = new Celer(this);
_sequence = new Sequence(this);
_timeout = new Timeout(this);
_trip = new Trip(this);
_acci = new Acci(this);
_dropdown = new Dropdown(this);
_closing = new Closing(this);
_graphics->init();
_scrolls->init();
_lucerna->init();
_acci->init();
_parser->init();
return Common::kNoError;
}
GUI::Debugger *AvalancheEngine::getDebugger() {
return _console;
}
Common::Platform AvalancheEngine::getPlatform() const {
return _platform;
}
bool AvalancheEngine::hasFeature(EngineFeature f) const {
return (f == kSupportsSavingDuringRuntime) || (f == kSupportsLoadingDuringRuntime);
}
const char *AvalancheEngine::getCopyrightString() const {
return "Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman.";
}
void AvalancheEngine::synchronize(Common::Serializer &sz) {
//blockwrite(f, dna, sizeof(dna));
sz.syncAsByte(_gyro->dna.rw);
sz.syncAsByte(_gyro->dna.carrying);
for (byte i = 0; i < numobjs; i++)
sz.syncAsByte(_gyro->dna.obj[i]);
sz.syncAsSint16LE(_gyro->dna.score);
sz.syncAsSint32LE(_gyro->dna.pence);
sz.syncAsByte(_gyro->dna.room);
sz.syncAsByte(_gyro->dna.wearing);
sz.syncAsByte(_gyro->dna.swore);
sz.syncAsByte(_gyro->dna.saves);
sz.syncBytes(_gyro->dna.rooms, 100);
sz.syncAsByte(_gyro->dna.alcohol);
sz.syncAsByte(_gyro->dna.playednim);
sz.syncAsByte(_gyro->dna.wonnim);
sz.syncAsByte(_gyro->dna.winestate);
sz.syncAsByte(_gyro->dna.cwytalot_gone);
sz.syncAsByte(_gyro->dna.pass_num);
sz.syncAsByte(_gyro->dna.ayles_is_awake);
sz.syncAsByte(_gyro->dna.drawbridge_open);
sz.syncAsByte(_gyro->dna.avaricius_talk);
sz.syncAsByte(_gyro->dna.bought_onion);
sz.syncAsByte(_gyro->dna.rotten_onion);
sz.syncAsByte(_gyro->dna.onion_in_vinegar);
sz.syncAsByte(_gyro->dna.given2spludwick);
sz.syncAsByte(_gyro->dna.brummie_stairs);
sz.syncAsByte(_gyro->dna.cardiff_things);
sz.syncAsByte(_gyro->dna.cwytalot_in_herts);
sz.syncAsByte(_gyro->dna.avvy_is_awake);
sz.syncAsByte(_gyro->dna.avvy_in_bed);
sz.syncAsByte(_gyro->dna.user_moves_avvy);
sz.syncAsByte(_gyro->dna.dogfoodpos);
sz.syncAsByte(_gyro->dna.givenbadgetoiby);
sz.syncAsByte(_gyro->dna.friar_will_tie_you_up);
sz.syncAsByte(_gyro->dna.tied_up);
sz.syncAsByte(_gyro->dna.box_contents);
sz.syncAsByte(_gyro->dna.talked_to_crapulus);
sz.syncAsByte(_gyro->dna.jacques_awake);
sz.syncAsByte(_gyro->dna.ringing_bells);
sz.syncAsByte(_gyro->dna.standing_on_dais);
sz.syncAsByte(_gyro->dna.taken_pen);
sz.syncAsByte(_gyro->dna.arrow_triggered);
sz.syncAsByte(_gyro->dna.arrow_in_the_door);
if (sz.isSaving()) {
uint16 like2drinkSize = _gyro->dna.like2drink.size();
sz.syncAsUint16LE(like2drinkSize);
for (uint16 i = 0; i < like2drinkSize; i++) {
char actChr = _gyro->dna.like2drink[i];
sz.syncAsByte(actChr);
}
uint16 favourite_songSize = _gyro->dna.favourite_song.size();
sz.syncAsUint16LE(favourite_songSize);
for (uint16 i = 0; i < favourite_songSize; i++) {
char actChr = _gyro->dna.favourite_song[i];
sz.syncAsByte(actChr);
}
uint16 worst_place_on_earthSize = _gyro->dna.worst_place_on_earth.size();
sz.syncAsUint16LE(worst_place_on_earthSize);
for (uint16 i = 0; i < worst_place_on_earthSize; i++) {
char actChr = _gyro->dna.worst_place_on_earth[i];
sz.syncAsByte(actChr);
}
uint16 spare_eveningSize = _gyro->dna.spare_evening.size();
sz.syncAsUint16LE(spare_eveningSize);
for (uint16 i = 0; i < spare_eveningSize; i++) {
char actChr = _gyro->dna.spare_evening[i];
sz.syncAsByte(actChr);
}
} else {
if (!_gyro->dna.like2drink.empty())
_gyro->dna.like2drink.clear();
uint16 like2drinkSize;
sz.syncAsUint16LE(like2drinkSize);
for (uint16 i = 0; i < like2drinkSize; i++) {
char actChr;
sz.syncAsByte(actChr);
_gyro->dna.like2drink += actChr;
}
if (!_gyro->dna.favourite_song.empty())
_gyro->dna.favourite_song.clear();
uint16 favourite_songSize;
sz.syncAsUint16LE(favourite_songSize);
for (uint16 i = 0; i < favourite_songSize; i++) {
char actChr;
sz.syncAsByte(actChr);
_gyro->dna.favourite_song += actChr;
}
if (!_gyro->dna.worst_place_on_earth.empty())
_gyro->dna.worst_place_on_earth.clear();
uint16 worst_place_on_earthSize;
sz.syncAsUint16LE(worst_place_on_earthSize);
for (uint16 i = 0; i < worst_place_on_earthSize; i++) {
char actChr;
sz.syncAsByte(actChr);
_gyro->dna.worst_place_on_earth += actChr;
}
if (!_gyro->dna.spare_evening.empty())
_gyro->dna.spare_evening.clear();
uint16 spare_eveningSize;
sz.syncAsUint16LE(spare_eveningSize);
for (uint16 i = 0; i < spare_eveningSize; i++) {
char actChr;
sz.syncAsByte(actChr);
_gyro->dna.spare_evening += actChr;
}
}
sz.syncAsSint32LE(_gyro->dna.total_time);
sz.syncAsByte(_gyro->dna.jumpstatus);
sz.syncAsByte(_gyro->dna.mushroom_growing);
sz.syncAsByte(_gyro->dna.spludwicks_here);
sz.syncAsByte(_gyro->dna.last_room);
sz.syncAsByte(_gyro->dna.last_room_not_map);
sz.syncAsByte(_gyro->dna.crapulus_will_tell);
sz.syncAsByte(_gyro->dna.enter_catacombs_from_lusties_room);
sz.syncAsByte(_gyro->dna.teetotal);
sz.syncAsByte(_gyro->dna.malagauche);
sz.syncAsByte(_gyro->dna.drinking);
sz.syncAsByte(_gyro->dna.entered_lusties_room_as_monk);
sz.syncAsByte(_gyro->dna.cat_x);
sz.syncAsByte(_gyro->dna.cat_y);
sz.syncAsByte(_gyro->dna.avvys_in_the_cupboard);
sz.syncAsByte(_gyro->dna.geida_follows);
sz.syncAsByte(_gyro->dna.geida_spin);
sz.syncAsByte(_gyro->dna.geida_time);
sz.syncAsByte(_gyro->dna.nextbell);
sz.syncAsByte(_gyro->dna.geida_given_potion);
sz.syncAsByte(_gyro->dna.lustie_is_asleep);
sz.syncAsByte(_gyro->dna.flip_to_where);
sz.syncAsByte(_gyro->dna.flip_to_ped);
sz.syncAsByte(_gyro->dna.been_tied_up);
sz.syncAsByte(_gyro->dna.sitting_in_pub);
sz.syncAsByte(_gyro->dna.spurge_talk);
sz.syncAsByte(_gyro->dna.met_avaroid);
sz.syncAsByte(_gyro->dna.taken_mushroom);
sz.syncAsByte(_gyro->dna.given_pen_to_ayles);
sz.syncAsByte(_gyro->dna.asked_dogfood_about_nim);
//for (byte groi = 0; groi < numtr; groi++) {
// if (tr[groi].quick) {
// blockwrite(f, groi, 1);
// tr[groi].savedata(f);
// }
//}
byte spriteNum;
if (sz.isSaving()) {
spriteNum = 0;
for (byte i = 0; i < _trip->numtr; i++)
if (_trip->tr[i].quick)
spriteNum++;
}
sz.syncAsByte(spriteNum);
if (sz.isLoading())
for (byte i = 0; i < _trip->numtr; i++) { // Deallocate sprites.
if (_trip->tr[i].quick)
_trip->tr[i].done();
}
for (byte i = 0; i < spriteNum; i++) {
sz.syncAsByte(_trip->tr[i].whichsprite);
sz.syncAsByte(_trip->tr[i].check_me);
if (sz.isLoading()) {
_trip->tr[i].quick = true;
_trip->tr[i].init(_trip->tr[i].whichsprite, _trip->tr[i].check_me, _trip);
}
sz.syncAsByte(_trip->tr[i].ix);
sz.syncAsByte(_trip->tr[i].iy);
sz.syncAsByte(_trip->tr[i].face);
sz.syncAsByte(_trip->tr[i].step);
sz.syncAsByte(_trip->tr[i].visible);
sz.syncAsByte(_trip->tr[i].homing);
sz.syncAsByte(_trip->tr[i].count);
sz.syncAsByte(_trip->tr[i]._info.xw);
sz.syncAsByte(_trip->tr[i].xs);
sz.syncAsByte(_trip->tr[i].ys);
sz.syncAsByte(_trip->tr[i].totalnum);
sz.syncAsSint16LE(_trip->tr[i].hx);
sz.syncAsSint16LE(_trip->tr[i].hy);
sz.syncAsByte(_trip->tr[i].call_eachstep);
sz.syncAsByte(_trip->tr[i].eachstep);
sz.syncAsByte(_trip->tr[i].vanishifstill);
sz.syncAsSint16LE(_trip->tr[i].x);
sz.syncAsSint16LE(_trip->tr[i].y);
if (sz.isLoading() && _trip->tr[i].visible)
_trip->tr[i].appear(_trip->tr[i].x, _trip->tr[i].y, _trip->tr[i].face);
}
//groi = 177;
//blockwrite(f, groi, 1);
//blockwrite(f, times, sizeof(times)); // Timeout.times: Timers.
for (byte i = 0; i < 7; i++) {
sz.syncAsSint32LE(_timeout->times[i].time_left);
sz.syncAsByte(_timeout->times[i].then_where);
sz.syncAsByte(_timeout->times[i].what_for);
}
//blockwrite(f, seq, sizeof(seq)); // Sequencer information.
sz.syncBytes(_sequence->seq, _sequence->seq_length);
}
bool AvalancheEngine::canSaveGameStateCurrently() { // TODO: Refine these!!!
return (!_gyro->seescroll && _gyro->alive);
}
Common::Error AvalancheEngine::saveGameState(int slot, const Common::String &desc) {
return (saveGame(slot, desc) ? Common::kNoError : Common::kWritingFailed);
}
bool AvalancheEngine::saveGame(const int16 slot, const Common::String &desc) {
Common::String fileName = getSaveFileName(slot);
Common::OutSaveFile *f = g_system->getSavefileManager()->openForSaving(fileName);
if (!f) {
warning("Can't create file '%s', game not saved.", fileName.c_str());
return false;
}
char *signature = "AVAL";
f->write(signature, 4);
// Write version. We can't restore from obsolete versions.
f->writeByte(kSavegameVersion);
f->writeUint32LE(desc.size());
f->write(desc.c_str(), desc.size());
::Graphics::saveThumbnail(*f);
TimeDate t;
_system->getTimeAndDate(t);
f->writeSint16LE(t.tm_mday);
f->writeSint16LE(t.tm_mon);
f->writeSint16LE(t.tm_year);
Common::Serializer sz(NULL, f);
synchronize(sz);
f->finalize();
delete f;
return true;
}
Common::String AvalancheEngine::getSaveFileName(const int slot) {
Common::String upperName = _targetName;
upperName.toUppercase();
return upperName+ Common::String::format("-%02d.SAV", slot);
}
bool AvalancheEngine::canLoadGameStateCurrently() { // TODO: Refine these!!!
return (!_gyro->seescroll);
}
Common::Error AvalancheEngine::loadGameState(int slot) {
return (loadGame(slot) ? Common::kNoError : Common::kReadingFailed);
}
bool AvalancheEngine::loadGame(const int16 slot) {
Common::String fileName = getSaveFileName(slot);
Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(fileName);
if (!f)
return false;
// Check for our signature.
Common::String signature;
for (byte i = 0; i < 4; i++)
signature += f->readByte();
if (signature != "AVAL")
return false;
// Check version. We can't restore from obsolete versions.
byte saveVersion = f->readByte();
if (saveVersion != kSavegameVersion) {
warning("Savegame of incompatible version!");
delete f;
return false;
}
// Read the description.
uint32 descSize = f->readUint32LE();
Common::String description;
for (uint32 i = 0; i < descSize; i++) {
char actChar = f->readByte();
description += actChar;
}
description.toUppercase();
::Graphics::skipThumbnail(*f);
// Read the time the game was saved.
TimeDate t;
t.tm_mday = f->readSint16LE();
t.tm_mon = f->readSint16LE();
t.tm_year = f->readSint16LE();
Common::Serializer sz(f, NULL);
synchronize(sz);
delete f;
_gyro->isLoaded = true;
_gyro->seescroll = true; // This prevents display of the new sprites before the new picture is loaded.
if (_gyro->holdthedawn) {
_gyro->holdthedawn = false;
_lucerna->dawn();
}
_celer->forgetBackgroundSprites();
_lucerna->minor_redraw();
_dropdown->standard_bar();
_gyro->whereis[0] = _gyro->dna.room;
_gyro->alive = true;
_lucerna->objectlist();
_trip->newspeed();
_lucerna->showrw();
_gyro->ontoolbar = false;
_trip->trippancy_link();
_celer->updateBackgroundSprites();
_scrolls->display(Common::String(_scrolls->kControlItalic) + "Loaded: " + _scrolls->kControlRoman + description + ".ASG"
+ _scrolls->kControlCenter + _scrolls->kControlNewLine + _scrolls->kControlNewLine
+ _gyro->roomname + _scrolls->kControlNewLine + _scrolls->kControlNewLine
+ "saved on " + expandDate(t.tm_mday, t.tm_mon, t.tm_year) + '.');
if (_trip->tr[0].quick && _trip->tr[0].visible)
_trip->rwsp(0, _gyro->dna.rw); // We push Avvy in the right direction is he was moving.
return true;
}
Common::String AvalancheEngine::expandDate(int d, int m, int y) {
const Common::String months[12] = {
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
};
Common::String month = months[m];
Common::String day = _gyro->strf(d);
if (((1 <= d) && (d <= 9)) || ((21 <= d) && (d <= 31)))
switch (d % 10) {
case 1:
day = day + "st";
break;
case 2:
day = day + "nd";
break;
case 3:
day = day + "rd";
break;
default:
day = day + "th";
}
return day + ' ' + month + ' ' + _gyro->strf(y + 1900);
}
void AvalancheEngine::updateEvents() {
Common::Event event;
while (_eventMan->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_LBUTTONDOWN:
_lucerna->holdLeftMouse = true; // Used in Lucerna::checkclick() and Dropdown::menu_link().
break;
case Common::EVENT_LBUTTONUP:
_lucerna->holdLeftMouse = false; // Same as above.
break;
case Common::EVENT_KEYDOWN:
_avalot->handleKeyDown(event);
}
}
}
bool AvalancheEngine::getEvent(Common::Event &event) {
return _eventMan->pollEvent(event);
}
Common::Point AvalancheEngine::getMousePos() {
return _eventMan->getMousePos();
}
// From Bootstrp:
const char AvalancheEngine::kRuncodes[2][3] = {"et", "Go"};
// The original ones were all commented out, so porbably there's no need
// of these two cursor functions at all. TODO: Remove later.
void AvalancheEngine::cursorOff() {
warning("STUB: cursorOff()");
}
void AvalancheEngine::cursorOn() {
warning("STUB: cursorOn()");
}
// Needed later.
void AvalancheEngine::quit() {
cursorOn();
}
// Needed in dos_shell(). TODO: Remove later.
Common::String AvalancheEngine::commandCom() {
warning("STUB: commandCom()");
return ("STUB: commandCom()");
}
// Needed for run_avalot()'s errors. TODO: Remove later.
void AvalancheEngine::explain(byte error) {
warning("STUB: explain()");
}
//TODO: Remove these (b_flight) functions later ( https://github.com/tthurman/avalot/wiki/B-Flight )
void AvalancheEngine::bFlight() { /*interrupt;*/
_storage._skellern++;
}
void AvalancheEngine::bFlightOn() {
_storage._skellern = kReset;
// setintvec(0x1c, &b_flight);
}
void AvalancheEngine::bFlightOff() {
// setintvec(0x1c, old_1c);
}
Common::String AvalancheEngine::elmToStr(Elm how) {
switch (how) {
case kNormal:
case kMusical:
return Common::String("jsb");
case kRegi:
return Common::String("REGI");
case kElmpoyten:
return Common::String("ELMPOYTEN");
// Useless, but silent a warning
default:
return Common::String("");
}
}
void AvalancheEngine::run(Common::String what, bool withJsb, bool withBflight, Elm how) {
warning("STUB: run(%s)", what.c_str());
// Probably there'll be no need of this function, as all *.AVX-es will become classes.
}
void AvalancheEngine::getArguments() {
// This function should mess around with command line arguments,
// but I am not sure if there'll be use of these arguments at all...
warning("STUB: getArguments()");
}
void AvalancheEngine::getSlope() {
// Same as get_arguments()
warning("STUB: getSlope()");
}
void AvalancheEngine::callMenu() {
warning("STUB: callMenu()");
}
void AvalancheEngine::runDemo() {
warning("STUB: runDemo()");
}
void AvalancheEngine::dosShell() {
warning("STUB: dosShell()");
}
// Getting used only in demo() / call_menu(). Going to be implemented at the same time with these.
bool AvalancheEngine::keyPressed() {
warning("STUB: keyPressed()");
return false;
}
// Same as keypressed1().
void AvalancheEngine::flushBuffer() {
warning("STUB: flushBuffer()");
}
// Same as keypressed1().
void AvalancheEngine::demo() {
warning("STUB: demo()");
}
void AvalancheEngine::runAvalot() {
bFlightOn();
_avalot->run(Common::String(kRuncodes[_firstTime]) + _arguments);
// TODO: Check if parameteres are ever used (probably not) and eventually remove them.
// If there's an error initalizing avalot, i'll handle it in there, not here
_firstTime = false;
}
Common::Error AvalancheEngine::run() {
Common::ErrorCode err = initialize();
if (err != Common::kNoError)
return err;
// From bootstrp:
_firstTime = true;
getArguments();
getSlope();
_zoomy = true;
// Don't call the menu by default. Might be modified later, if get_slope() gets implemented,
// becouse zoomy's value is given there. Not sure yet what "zoomy" stands for.
if (!_zoomy)
callMenu(); /* Not run when zoomy. */
do {
runAvalot();
//if (dosexitcode != 77) quit(); /* Didn't stop for us. */
switch (_storage._operation) {
case kRunShootemup:
run("seu.avx", kJsb, kBflight, kNormal);
break;
case kRunDosshell:
dosShell();
break;
case kRunGhostroom:
run("g-room.avx", kJsb, kNoBflight, kNormal);
break;
case kRunGolden:
run("golden.avx", kJsb, kBflight, kMusical);
break;
}
} while (false);
return Common::kNoError;
}
} // End of namespace Avalanche
|