aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/avalanche/avalanche.cpp69
-rw-r--r--engines/avalanche/avalanche.h2
-rw-r--r--engines/avalanche/avalot.cpp59
-rw-r--r--engines/avalanche/detection.cpp2
-rw-r--r--engines/avalanche/lucerna2.cpp20
-rw-r--r--engines/avalanche/trip6.cpp3
6 files changed, 105 insertions, 50 deletions
diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp
index 8e4577a093..e714f0b5f6 100644
--- a/engines/avalanche/avalanche.cpp
+++ b/engines/avalanche/avalanche.cpp
@@ -108,7 +108,6 @@ Common::ErrorCode AvalancheEngine::initialize() {
_lucerna->init();
_acci->init();
_basher->init();
-
return Common::kNoError;
}
@@ -337,10 +336,6 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) {
_trip->tr[i].appear(_trip->tr[i].x, _trip->tr[i].y, _trip->tr[i].face);
}
-
-
-
-
//groi = 177;
//blockwrite(f, groi, 1);
@@ -380,6 +375,12 @@ bool AvalancheEngine::saveGame(const int16 slot, const Common::String &desc) {
f->write(desc.c_str(), desc.size());
+ 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);
@@ -423,9 +424,19 @@ bool AvalancheEngine::loadGame(const int16 slot) {
if (signature != "AVAL")
return false;
- // We dont care about the description here.
+ // Read the description.
uint32 descSize = f->readUint32LE();
- f->skip(descSize);
+ Common::String description;
+ for (uint32 i = 0; i < descSize; i++) {
+ char actChar = f->readByte();
+ description += actChar;
+ }
+ description.toUppercase();
+
+ TimeDate t;
+ t.tm_mday = f->readSint16LE();
+ t.tm_mon = f->readSint16LE();
+ t.tm_year = f->readSint16LE();
Common::Serializer sz(f, NULL);
@@ -444,6 +455,8 @@ bool AvalancheEngine::loadGame(const int16 slot) {
_lucerna->minor_redraw();
+ _dropdown->standard_bar();
+
_gyro->whereis[0] = _gyro->dna.room;
_gyro->alive = true;
@@ -454,9 +467,49 @@ bool AvalancheEngine::loadGame(const int16 slot) {
_lucerna->showrw();
+ _gyro->ontoolbar = false;
+ _trip->trippancy_link();
+
+ _celer->pics_link();
+
+ _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);
+
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() {
@@ -620,7 +673,7 @@ Common::Error AvalancheEngine::run() {
if (err != Common::kNoError)
return err;
-
+
// From bootstrp:
diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h
index 52472b6128..6b62ad7886 100644
--- a/engines/avalanche/avalanche.h
+++ b/engines/avalanche/avalanche.h
@@ -127,6 +127,8 @@ public:
virtual bool canLoadGameStateCurrently();
Common::Error loadGameState(int slot);
bool loadGame(const int16 slot);
+ Common::String expandDate(int d, int m, int y);
+
void updateEvents();
diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp
index 3069c8aef9..9cf66606ab 100644
--- a/engines/avalanche/avalot.cpp
+++ b/engines/avalanche/avalot.cpp
@@ -50,6 +50,7 @@
#include "common/str.h"
#include "common/textconsole.h"
+#include "common/config-manager.h"
@@ -167,7 +168,6 @@ void Avalot::setup() {
_vm->_gyro->enid_filename = ""; /* undefined. */
_vm->_lucerna->toolbar();
_vm->_scrolls->state(2);
- _vm->_graphics->refreshScreen(); //_vm->_pingo->copy03(); Replace it with refreshScreen() since they 'almost' have the same functionality.
for (byte i = 0; i < 3; i++)
_vm->_gyro->lastscore[i] = -1; /* impossible digits */
@@ -178,35 +178,6 @@ void Avalot::setup() {
_vm->_trip->loadtrip();
- _vm->_gyro->reloaded = false; // TODO: Remove it later: when SAVE/LOAD system is implemented. Until then: we always start a new game.
-
- if ((_vm->_gyro->filetoload.empty()) && (! _vm->_gyro->reloaded))
- _vm->_gyro->newgame(); /* no game was requested- load the default */
- else {
- if (! _vm->_gyro->reloaded)
- _vm->_enid->avvy_background();
- _vm->_dropdown->standard_bar();
- _vm->_lucerna->sprite_run();
- if (_vm->_gyro->reloaded)
- _vm->_enid->edna_reload();
- else {
- /* Filename given on the command line (or loadfirst) */
- _vm->_enid->edna_load(_vm->_gyro->filetoload);
- if (_vm->_enid->there_was_a_problem()) {
- _vm->_scrolls->display("So let's start from the beginning instead...");
- _vm->_gyro->holdthedawn = true;
- _vm->_lucerna->dusk();
- _vm->_gyro->newgame();
- }
- }
- }
-
- if (! _vm->_gyro->reloaded) {
- _vm->_gyro->soundfx = ! _vm->_gyro->soundfx;
- _vm->_lucerna->fxtoggle();
- _vm->_lucerna->thinkabout(_vm->_gyro->money, _vm->_gyro->a_thing);
- }
-
_vm->_trip->get_back_loretta();
//gm = getpixel(0: 0);
//setcolor(7);
@@ -216,13 +187,34 @@ void Avalot::setup() {
_vm->_parser->cursorOn();
_vm->_trip->newspeed();
- if (! _vm->_gyro->reloaded)
+
+
+ int16 loadSlot = Common::ConfigManager::instance().getInt("save_slot");
+ if (loadSlot >= 0) {
+ _vm->loadGame(loadSlot);
+
+ _vm->_gyro->reloaded = true;
+ } else
+ _vm->_gyro->reloaded = false;
+
+
+
+ if (!_vm->_gyro->reloaded) {
+ _vm->_gyro->newgame(); // No game was requested- load the default.
+
+ _vm->_gyro->soundfx = ! _vm->_gyro->soundfx;
+ _vm->_lucerna->fxtoggle();
+ _vm->_lucerna->thinkabout(_vm->_gyro->money, _vm->_gyro->a_thing);
+
_vm->_visa->dixi('q', 83); // Info on the game, etc.
+ }
}
void Avalot::run(Common::String arg) {
setup();
+
+
do {
uint32 beginLoop = _vm->_system->getMillis();
@@ -249,6 +241,11 @@ void Avalot::run(Common::String arg) {
if (delay <= 55)
_vm->_system->delayMillis(55 - delay); // Replaces _vm->_gyro->slowdown(); 55 comes from 18.2 Hz (B Flight).
+
+
+
+
+
} while (! _vm->_gyro->lmo);
//restorecrtmode();
diff --git a/engines/avalanche/detection.cpp b/engines/avalanche/detection.cpp
index fb68e2ec67..a81e9a3b5f 100644
--- a/engines/avalanche/detection.cpp
+++ b/engines/avalanche/detection.cpp
@@ -96,7 +96,7 @@ bool AvalancheMetaEngine::createInstance(OSystem *syst, Engine **engine, const A
}
bool AvalancheMetaEngine::hasFeature(MetaEngineFeature f) const {
- return (f == kSupportsListSaves) || (f == kSupportsDeleteSave);
+ return (f == kSupportsListSaves) || (f == kSupportsDeleteSave) || (f == kSupportsLoadingDuringStartup);
}
SaveStateList AvalancheMetaEngine::listSaves(const char *target) const {
diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp
index 797dabd398..3fcb1acf77 100644
--- a/engines/avalanche/lucerna2.cpp
+++ b/engines/avalanche/lucerna2.cpp
@@ -229,8 +229,13 @@ void Lucerna::load(byte n) { /* Load2, actually */
}
f.seek(146);
- for (byte i = 0; i < 30; i++)
- _vm->_gyro->roomname += f.readByte();
+ if (!_vm->_gyro->roomname.empty())
+ _vm->_gyro->roomname.clear();
+ for (byte i = 0; i < 30; i++) {
+ char actChar = f.readByte();
+ if ((32 <= actChar) && (actChar <= 126))
+ _vm->_gyro->roomname += actChar;
+ }
/* Compression method byte follows this... */
f.seek(177);
@@ -254,16 +259,13 @@ void Lucerna::load(byte n) { /* Load2, actually */
_vm->_graphics->drawPicture(_vm->_graphics->_background, 0, 10);
- _vm->_graphics->refreshScreen();
-
f.close();
load_also(xx);
- _vm->_celer->load_chunks(xx);
- _vm->_graphics->refreshScreen(); // _vm->_pingo->copy03(); - See Avalot::setup()
+ _vm->_celer->load_chunks(xx);
bit = *_vm->_graphics->getPixel(0,0);
@@ -948,11 +950,11 @@ void Lucerna::fxtoggle() {
void Lucerna::objectlist() {
_vm->_gyro->dna.carrying = 0;
- if (_vm->_gyro->thinkthing && ! _vm->_gyro->dna.obj[_vm->_gyro->thinks])
+ if (_vm->_gyro->thinkthing && !_vm->_gyro->dna.obj[_vm->_gyro->thinks])
thinkabout(_vm->_gyro->money, _vm->_gyro->a_thing); /* you always have money */
- for (byte fv = 0; fv < numobjs; fv ++)
+ for (byte fv = 0; fv < numobjs; fv++)
if (_vm->_gyro->dna.obj[fv]) {
- _vm->_gyro->dna.carrying ++;
+ _vm->_gyro->dna.carrying++;
_vm->_gyro->objlist[_vm->_gyro->dna.carrying] = fv + 1;
}
}
diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp
index d4573a0851..54312ce773 100644
--- a/engines/avalanche/trip6.cpp
+++ b/engines/avalanche/trip6.cpp
@@ -79,7 +79,8 @@ void triptype::init(byte spritenum, bool do_check, Trip *tr) {
inf.skip(2); // Replace variable named 'soa' in the original code.
- //inf.skip(1); // We don't need to read the size of the string as in the original code.
+ if (!a.name.empty())
+ a.name.clear();
byte nameSize = inf.readByte();
for (byte i = 0; i < nameSize; i++)
a.name += inf.readByte();