ACCESS: MM - Implement cmdSpecial7

This commit is contained in:
Strangerke 2015-02-09 19:34:32 +01:00
parent a81fbda3da
commit bdf3042174
7 changed files with 172 additions and 2 deletions

View File

@ -35,6 +35,7 @@ MartianEngine::MartianEngine(OSystem *syst, const AccessGameDescription *gameDes
}
MartianEngine::~MartianEngine() {
_introObjects = _spec7Objects = nullptr;
}
void MartianEngine::initObjects() {

View File

@ -60,6 +60,8 @@ protected:
void setNoteParams();
void displayNote(const Common::String &msg);
public:
SpriteResource *_spec7Objects;
MartianEngine(OSystem *syst, const AccessGameDescription *gameDesc);
virtual ~MartianEngine();

View File

@ -810,6 +810,16 @@ const char *const DEATHMESSAGE[] = {
"ONCE DANGERFIELD GETS OUT OF HIS CHAMBER, HE PULLS OUT A WEAPON AND LETS YOU HAVE IT."
};
const char *const SPEC7MESSAGE = {
"THOMAS DANGERFIELD'S MAD EXPERIMENT OF ATTEMPTING TO HARNESS THE STONE'S POWER, ENDED HIS LIFE. DANGERFIELD WAS A DECENT HUMAN " \
"BEING ONCE, BUT WAS DRIVEN INSANE BY HIS QUEST FOR THE ULTIMATE POWER. ALEXIS AND I DECIDE THAT DEACON HAWKE IS THE ONLY " \
"LOGICAL CHOICE FOR THE STONE. WE ARRIVE AT THE TEMPLE WHERE SHE IS WAITING FOR US. SHE TURNS AND WHISPERS; 'YOU HAVE RETURNED " \
"THE STONE TO THE MISTRESS OF THE LIGHT. YOU HAVE SURELY SAVED THE WORLD FROM ANNIHILATION BUT YOU MUST CONTINUE TO BE DILIGENT. " \
"MANKIND MAY YET PROVE TO BE THE AUTHOR OF HIS OWN DEMISE. REVERENCE LIFE. PROTECT THE LIVING THINGS AND RECYCLE. AND NOW FOR " \
"THE SAFETY OF MANKIND, I MUST TAKE THE STONE. PERHAPS SOMEDAY, WHEN THE HUMAN RACE IS READY, IT WILL BE RETURNED. UNTIL THEN "\
"FAREWELL...'"
};
const byte _byte1EEB5[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1, 1, 1,

View File

@ -65,6 +65,7 @@ extern const char *const TRAVDATA[];
extern const byte DEATH_SCREENS[];
extern const char *const DEATHMESSAGE[];
extern const char *const SPEC7MESSAGE;
extern const byte _byte1EEB5[];
extern const int PICTURERANGE[][2];

View File

@ -104,6 +104,160 @@ void MartianScripts::cmdSpecial6() {
_vm->_midi->stopSong();
}
void MartianScripts::cmdSpecial7() {
_vm->_room->clearRoom();
_vm->_midi->loadMusic(47, 8);
_vm->_sound->freeSounds();
Resource *sound = _vm->_sound->loadSound(46, 14);
_vm->_sound->_soundTable.push_back(SoundEntry(sound, 1));
_vm->_screen->setDisplayScan();
_vm->_screen->forceFadeOut();
_vm->_events->hideCursor();
_vm->_files->loadScreen(40, 3);
_vm->_buffer1.copyBuffer(_vm->_screen);
_vm->_buffer2.copyBuffer(_vm->_screen);
_vm->_events->showCursor();
_vm->_screen->setIconPalette();
_vm->_screen->forceFadeIn();
// Load objects specific to this special scene
Resource *data = _vm->_files->loadFile(40, 2);
_game->_spec7Objects = new SpriteResource(_vm, data);
delete data;
// Load animation data
_vm->_animation->freeAnimationData();
Resource *animResource = _vm->_files->loadFile(40, 1);
_vm->_animation->loadAnimations(animResource);
delete animResource;
// Load script
Resource *newScript = _vm->_files->loadFile(40, 0);
_vm->_scripts->setScript(newScript);
_vm->_images.clear();
_vm->_oldRects.clear();
_vm->_scripts->_sequence = 0;
_vm->_sound->playSound(0);
do {
charLoop();
} while (_vm->_flags[134] != 1);
do {
_vm->_events->pollEvents();
} while (!_vm->shouldQuit() && _vm->_sound->_playingSound);
_game->_numAnimTimers = 0;
_vm->_animation->freeAnimationData();
_vm->_scripts->freeScriptData();
_vm->_sound->freeSounds();
_vm->_screen->forceFadeOut();
_vm->_midi->midiPlay();
_vm->_midi->setLoop(true);
_vm->_events->hideCursor();
_vm->_files->loadScreen(40, 4);
_vm->_buffer1.copyBuffer(_vm->_screen);
_vm->_buffer2.copyBuffer(_vm->_screen);
_vm->_events->showCursor();
_vm->_screen->setIconPalette();
_vm->_screen->forceFadeIn();
// Setup fonts
_vm->_fonts._charSet._hi = 10;
_vm->_fonts._charSet._lo = 1;
_vm->_fonts._charFor._lo = 247;
_vm->_fonts._charFor._hi = 255;
_vm->_screen->_maxChars = 50;
_vm->_screen->_printOrg = Common::Point(24, 18);
_vm->_screen->_printStart = Common::Point(24, 18);
// Display death message
_game->showDeathText(Common::String(SPEC7MESSAGE));
_vm->_events->showCursor();
_vm->_screen->copyBuffer(&_vm->_buffer1);
_vm->_events->hideCursor();
_vm->_video->setVideo(_vm->_screen, Common::Point(120, 16), FileIdent(40, 5), 10);
while (!_vm->shouldQuit() && !_vm->_video->_videoEnd) {
_vm->_video->playVideo();
_vm->_events->pollEventsAndWait();
}
_vm->_sound->freeSounds();
sound = _vm->_sound->loadSound(40, 8);
_vm->_sound->_soundTable.push_back(SoundEntry(sound, 1));
sound = _vm->_sound->loadSound(40, 9);
_vm->_sound->_soundTable.push_back(SoundEntry(sound, 1));
sound = _vm->_sound->loadSound(40, 10);
_vm->_sound->_soundTable.push_back(SoundEntry(sound, 1));
_vm->_screen->forceFadeOut();
_vm->_files->loadScreen(40, 7);
_vm->_destIn = _vm->_screen;
_vm->_screen->plotImage(_game->_spec7Objects, 8, Common::Point(104, 176));
_vm->_screen->plotImage(_game->_spec7Objects, 7, Common::Point(102, 160));
_vm->_events->showCursor();
_vm->_screen->forceFadeIn();
_vm->_events->_vbCount = 100;
while (!_vm->shouldQuit() && _vm->_events->_vbCount > 0)
_vm->_events->pollEventsAndWait();
_vm->_sound->playSound(0);
do {
_vm->_events->pollEvents();
} while (!_vm->shouldQuit() && _vm->_sound->_playingSound);
_vm->_events->_vbCount = 80;
while (!_vm->shouldQuit() && _vm->_events->_vbCount > 0)
_vm->_events->pollEventsAndWait();
_vm->_sound->playSound(1);
do {
_vm->_events->pollEvents();
} while (!_vm->shouldQuit() && _vm->_sound->_playingSound);
_vm->_events->_vbCount = 80;
while (!_vm->shouldQuit() && _vm->_events->_vbCount > 0)
_vm->_events->pollEventsAndWait();
_vm->_sound->playSound(2);
do {
_vm->_events->pollEvents();
} while (!_vm->shouldQuit() && _vm->_sound->_playingSound);
_vm->_sound->freeSounds();
delete _game->_spec7Objects;
_game->_spec7Objects = nullptr;
_vm->_events->hideCursor();
_vm->_screen->forceFadeOut();
_vm->_files->loadScreen(40, 6);
_vm->_events->showCursor();
_vm->_screen->forceFadeIn();
_vm->_events->waitKeyMouse();
_vm->_midi->stopSong();
_vm->_midi->freeMusic();
// The original was jumping to the restart label in main
_vm->_restartFl = true;
_vm->_events->pollEvents();
}
void MartianScripts::executeSpecial(int commandIndex, int param1, int param2) {
switch (commandIndex) {
case 0:
@ -128,7 +282,7 @@ void MartianScripts::executeSpecial(int commandIndex, int param1, int param2) {
cmdSpecial6();
break;
case 7:
warning("TODO: cmdSpecial7");
cmdSpecial7();
break;
default:
warning("Unexpected Special code %d - Skipped", commandIndex);

View File

@ -40,6 +40,7 @@ private:
void cmdSpecial3();
void doIntro(int param1);
void cmdSpecial6();
void cmdSpecial7();
protected:
virtual void executeSpecial(int commandIndex, int param1, int param2);

View File

@ -42,7 +42,6 @@ private:
Resource *_resource;
int _specialFunction;
void charLoop();
void clearWatch();
void printWatch();
@ -53,6 +52,8 @@ protected:
virtual void executeSpecial(int commandIndex, int param1, int param2) = 0;
virtual void executeCommand(int commandIndex);
void charLoop();
/**
* Read a null terminated string from the script
*/