aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/access/martian/martian_game.cpp97
-rw-r--r--engines/access/martian/martian_game.h6
-rw-r--r--engines/access/martian/martian_scripts.cpp29
-rw-r--r--engines/access/martian/martian_scripts.h4
-rw-r--r--engines/access/sound.cpp7
-rw-r--r--engines/access/sound.h1
6 files changed, 138 insertions, 6 deletions
diff --git a/engines/access/martian/martian_game.cpp b/engines/access/martian/martian_game.cpp
index 6a96160960..a14d7830b3 100644
--- a/engines/access/martian/martian_game.cpp
+++ b/engines/access/martian/martian_game.cpp
@@ -75,6 +75,88 @@ void MartianEngine::initVariables() {
_numAnimTimers = 0;
}
+void MartianEngine::sub13E1F() {
+ _events->hideCursor();
+
+ _screen->_orgX1 = 58;
+ _screen->_orgY1 = 124;
+ _screen->_orgX2 = 297;
+ _screen->_orgY2 = 199;
+ _screen->drawRect();
+
+ _events->showCursor();
+}
+
+void MartianEngine::sub13E4C(const Common::String &msg) {
+ _fonts._charSet._lo = 1;
+ _fonts._charSet._hi = 8;
+ _fonts._charFor._lo = 0;
+ _fonts._charFor._hi = 255;
+
+ _screen->_maxChars = 40;
+ _screen->_printOrg = _screen->_printStart = Common::Point(59, 124);
+
+ sub13E1F();
+
+ Common::String lines = msg;
+ Common::String line;
+ int width = 0;
+ bool lastLine = false;
+ do {
+ lastLine = _fonts._font2.getLine(lines, _screen->_maxChars * 6, line, width);
+
+ // Set font colors
+ _fonts._font2._fontColors[0] = 0;
+ _fonts._font2._fontColors[1] = 27;
+ _fonts._font2._fontColors[2] = 28;
+ _fonts._font2._fontColors[3] = 29;
+
+ _fonts._font2.drawString(_screen, line, _screen->_printOrg);
+ _screen->_printOrg = Common::Point(_screen->_printStart.x, _screen->_printOrg.y + 6);
+
+ if (_screen->_printOrg.y == 196) {
+ _events->waitKeyMouse();
+ sub13E1F();
+ _screen->_printOrg = _screen->_printStart;
+ }
+ } while (!lastLine);
+ _events->waitKeyMouse();
+}
+
+void MartianEngine::doSpecial5(int param1) {
+ warning("TODO: Push midi song");
+ _midi->stopSong();
+ _midi->_byte1F781 = false;
+ _midi->loadMusic(47, 4);
+ _midi->midiPlay();
+ _screen->setDisplayScan();
+ _events->clearEvents();
+ _screen->forceFadeOut();
+ _events->hideCursor();
+ _files->loadScreen("DATA.SC");
+ _events->showCursor();
+ _screen->setIconPalette();
+ _screen->forceFadeIn();
+ warning("TODO: LoadCells");
+ _timers[20]._timer = _timers[20]._initTm = 30;
+ Resource *_word20060 = _files->loadFile("NOTES.DAT");
+ _word20060->_stream->skip(param1 * 2);
+ int pos = _word20060->_stream->readUint16LE();
+ _word20060->_stream->seek(pos);
+ Common::String msg = "";
+ byte c;
+ while ((c = (char)_word20060->_stream->readByte()) != '\0')
+ msg += c;
+
+ sub13E4C(msg);
+
+ _midi->stopSong();
+ _midi->freeMusic();
+
+ warning("TODO: Pop Midi");
+ // _midi->_byte1F781 = true;
+}
+
void MartianEngine::playGame() {
// Initialize Amazon game-specific objects
initObjects();
@@ -85,9 +167,14 @@ void MartianEngine::playGame() {
if (_loadSaveSlot == -1) {
// Do introduction
- doIntroduction();
+// doCredits();
if (shouldQuit())
return;
+
+ doSpecial5(4);
+ if (shouldQuit())
+ return;
+ _screen->forceFadeOut();
}
do {
@@ -135,10 +222,9 @@ bool MartianEngine::showCredits() {
}
_screen->forceFadeIn();
- _timers[6]._timer = val2;
- _timers[6]._initTm = val2;
+ _timers[3]._timer = _timers[3]._initTm = val2;
- while (!shouldQuit() && !_events->isKeyMousePressed() && _timers[6]._timer) {
+ while (!shouldQuit() && !_events->isKeyMousePressed() && _timers[3]._timer) {
_events->pollEventsAndWait();
}
@@ -151,7 +237,8 @@ bool MartianEngine::showCredits() {
return false;
}
-void MartianEngine::doIntroduction() {
+void MartianEngine::doCredits() {
+ _midi->_byte1F781 = false;
_midi->loadMusic(47, 3);
_midi->midiPlay();
_screen->setDisplayScan();
diff --git a/engines/access/martian/martian_game.h b/engines/access/martian/martian_game.h
index 99d4926964..bd32527ffd 100644
--- a/engines/access/martian/martian_game.h
+++ b/engines/access/martian/martian_game.h
@@ -37,7 +37,7 @@ private:
/**
* Do the game introduction
*/
- void doIntroduction();
+ void doCredits();
bool showCredits();
@@ -56,11 +56,15 @@ protected:
virtual void playGame();
virtual void dead(int deathId) {}
+
+ void sub13E1F();
+ void sub13E4C(const Common::String &msg);
public:
MartianEngine(OSystem *syst, const AccessGameDescription *gameDesc);
virtual ~MartianEngine();
+ void doSpecial5(int param1);
void drawHelp();
virtual void establish(int esatabIndex, int sub) {};
};
diff --git a/engines/access/martian/martian_scripts.cpp b/engines/access/martian/martian_scripts.cpp
index 0578872092..8d936ba728 100644
--- a/engines/access/martian/martian_scripts.cpp
+++ b/engines/access/martian/martian_scripts.cpp
@@ -34,7 +34,36 @@ MartianScripts::MartianScripts(AccessEngine *vm) : Scripts(vm) {
_game = (MartianEngine *)_vm;
}
+void MartianScripts::cmdSpecial5(int param1) {
+ _game->doSpecial5(param1);
+}
+
void MartianScripts::executeSpecial(int commandIndex, int param1, int param2) {
+ switch (commandIndex) {
+ case 0:
+ warning("TODO: cmdSpecial0");
+ break;
+ case 1:
+ warning("TODO: cmdSpecial1");
+ break;
+ case 2:
+ warning("TODO: cmdSpecial2");
+ break;
+ case 3:
+ warning("TODO: cmdSpecial3");
+ break;
+ case 4:
+ warning("TODO: cmdSpecial4");
+ break;
+ case 5:
+ cmdSpecial5(param1);
+ break;
+ case 6:
+ warning("TODO: cmdSpecial6");
+ break;
+ default:
+ warning("Unexpected Special code %d - Skipped", commandIndex);
+ }
}
typedef void(MartianScripts::*MartianScriptMethodPtr)();
diff --git a/engines/access/martian/martian_scripts.h b/engines/access/martian/martian_scripts.h
index fc7495fc47..125f1e422d 100644
--- a/engines/access/martian/martian_scripts.h
+++ b/engines/access/martian/martian_scripts.h
@@ -35,9 +35,13 @@ class MartianEngine;
class MartianScripts : public Scripts {
private:
MartianEngine *_game;
+
+ void cmdSpecial5(int param1);
+
protected:
virtual void executeSpecial(int commandIndex, int param1, int param2);
virtual void executeCommand(int commandIndex);
+
public:
MartianScripts(AccessEngine *vm);
};
diff --git a/engines/access/sound.cpp b/engines/access/sound.cpp
index a7d96dac9a..9ade99cb72 100644
--- a/engines/access/sound.cpp
+++ b/engines/access/sound.cpp
@@ -178,6 +178,7 @@ MusicManager::MusicManager(AccessEngine *vm) : _vm(vm) {
_music = nullptr;
_tempMusic = nullptr;
_isLooping = false;
+ _byte1F781 = false;
MidiPlayer::createDriver();
MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_GM);
@@ -217,6 +218,12 @@ void MusicManager::midiPlay() {
if (READ_BE_UINT32(_music->data()) != MKTAG('F', 'O', 'R', 'M')) {
warning("midiPlay() Unexpected signature");
+ Common::DumpFile *outFile = new Common::DumpFile();
+ Common::String outName = "music.dump";
+ outFile->open(outName);
+ outFile->write(_music->data(), _music->_size);
+ outFile->finalize();
+ outFile->close();
_isPlaying = false;
} else {
_parser = MidiParser::createParser_XMIDI();
diff --git a/engines/access/sound.h b/engines/access/sound.h
index d0f4584fac..6bfdbcda7d 100644
--- a/engines/access/sound.h
+++ b/engines/access/sound.h
@@ -82,6 +82,7 @@ private:
public:
Resource *_music;
+ bool _byte1F781;
public:
MusicManager(AccessEngine *vm);