aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2014-05-18 12:29:48 +0200
committerStrangerke2014-05-18 12:29:48 +0200
commite7bef9019a71105a19c9f4eff567b8df47387a8b (patch)
treed5e29787f0c703ad25fa99eabd0faca0c331e7d5 /engines
parentbc639c25c8f8e8f6a86235f59352851313753830 (diff)
downloadscummvm-rg350-e7bef9019a71105a19c9f4eff567b8df47387a8b.tar.gz
scummvm-rg350-e7bef9019a71105a19c9f4eff567b8df47387a8b.tar.bz2
scummvm-rg350-e7bef9019a71105a19c9f4eff567b8df47387a8b.zip
MADS: Implement scene 803, add an ongoingGame global flag to exit the multiple game loops
Diffstat (limited to 'engines')
-rw-r--r--engines/mads/game.cpp10
-rw-r--r--engines/mads/game.h2
-rw-r--r--engines/mads/nebular/nebular_scenes8.cpp320
-rw-r--r--engines/mads/nebular/nebular_scenes8.h12
-rw-r--r--engines/mads/scene.cpp4
5 files changed, 340 insertions, 8 deletions
diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp
index 34b229f157..3b00116d25 100644
--- a/engines/mads/game.cpp
+++ b/engines/mads/game.cpp
@@ -77,6 +77,8 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm),
_triggerSetupMode = SEQUENCE_TRIGGER_DAEMON;
_winStatus = 0;
_widepipeCtr = 0;
+ _ongoingGame = true;
+
// Load the inventory object list
_objects.load();
@@ -152,7 +154,7 @@ void Game::run() {
}
void Game::gameLoop() {
- while (!_vm->shouldQuit() && _statusFlag) {
+ while (!_vm->shouldQuit() && _statusFlag && _ongoingGame) {
if (_loadGameSlot != -1) {
loadGame(_loadGameSlot);
_loadGameSlot = -1;
@@ -166,9 +168,8 @@ void Game::gameLoop() {
_scene._spriteSlots.reset();
- if (_sectionNumber == _currentSectionNumber) {
+ if (_sectionNumber == _currentSectionNumber)
sectionLoop();
- }
_player.releasePlayerSprites();
assert(_scene._sprites.size() == 0);
@@ -183,7 +184,7 @@ void Game::gameLoop() {
}
void Game::sectionLoop() {
- while (!_vm->shouldQuit() && _statusFlag && _sectionNumber == _currentSectionNumber) {
+ while (!_vm->shouldQuit() && _statusFlag && (_sectionNumber == _currentSectionNumber) && _ongoingGame) {
_kernelMode = KERNEL_ROOM_PRELOAD;
_player._spritesChanged = true;
_quoteEmergency = false;
@@ -460,6 +461,7 @@ void Game::synchronize(Common::Serializer &s, bool phase1) {
s.syncAsUint16LE(_triggerMode);
synchronizeString(s, _aaName);
s.syncAsSint16LE(_lastSave);
+ s.syncAsByte(_ongoingGame);
_scene.synchronize(s);
_objects.synchronize(s);
diff --git a/engines/mads/game.h b/engines/mads/game.h
index 358a266e09..0e9640594c 100644
--- a/engines/mads/game.h
+++ b/engines/mads/game.h
@@ -149,6 +149,8 @@ public:
int _winStatus;
int _widepipeCtr;
int _loadGameSlot;
+ bool _ongoingGame;
+
public:
virtual ~Game();
diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp
index 2d05ff9a9c..1c7cd7539c 100644
--- a/engines/mads/nebular/nebular_scenes8.cpp
+++ b/engines/mads/nebular/nebular_scenes8.cpp
@@ -36,9 +36,8 @@ void Scene8xx::setPlayerSpritesPrefix() {
_scene->_nextSceneId == 804 || _scene->_nextSceneId == 805 ||
_scene->_nextSceneId == 808 || _scene->_nextSceneId == 810) {
_game._player._spritesPrefix = "";
- } else {
+ } else
_game._player._spritesPrefix = _globals[kSexOfRex] == SEX_FEMALE ? "ROX" : "RXM";
- }
_vm->_palette->setEntry(16, 0x0A, 0x3F, 0x3F);
_vm->_palette->setEntry(17, 0x0A, 0x2D, 0x2D);
@@ -62,12 +61,15 @@ void Scene8xx::sceneEntrySound() {
case 808:
_vm->_sound->command(20);
break;
+
case 805:
_vm->_sound->command(23);
break;
+
case 810:
_vm->_sound->command(10);
break;
+
default:
break;
}
@@ -508,6 +510,320 @@ void Scene802::actions() {
/*------------------------------------------------------------------------*/
+void Scene803::setup() {
+ setPlayerSpritesPrefix();
+ setAAName();
+ _scene->addActiveVocab(0x472);
+ _scene->addActiveVocab(0xD);
+
+ if ((!_globals[kFromCockpit] && _globals[kReturnFromCut] && !_globals[kBeamIsUp])
+ || (_globals[kFromCockpit] && !_globals[kExitShip])) {
+ _game._player._spritesPrefix = "";
+ _game._player._spritesChanged = true;
+ }
+}
+
+void Scene803::enter() {
+ _globals[kBetweenRooms] = false;
+ _game._player._visible = false;
+ _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('f', 1));
+ _globals._spriteIndexes[9] = _scene->_sprites.addSprites("*RXMBD_2");
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('d', 1));
+
+ _game.loadQuoteSet(0x31B, 0x31C, 0x31D, 0x31E, 0x31F, 0x320, 0x321, 0x322, 0);
+
+ if (_globals[kHoppyDead]) {
+ _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('e', 1));
+ _globals._sequenceIndexes[7] = _scene->_sequences.startCycle(_globals._spriteIndexes[7], false, 1);
+ int idx = _scene->_dynamicHotspots.add(0x472, 0xD, _globals._sequenceIndexes[7], Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots.setPosition(idx, Common::Point(66, 123), FACING_SOUTH);
+ }
+
+ if (!_globals[kBeamIsUp] && !_globals[kReturnFromCut] && (!_globals[kFromCockpit] || _globals[kExitShip])) {
+ _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 8, 1, 0, 0);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 2, 2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1);
+ }
+
+ if (!_globals[kFromCockpit]) {
+ if (!_globals[kReturnFromCut]) {
+ if (_scene->_priorSceneId != -2) {
+ _game._player._playerPos = Common::Point(15, 130);
+ _game._player._facing = FACING_EAST;
+ }
+ _game._player._visible = true;
+ } else if (!_globals[kBeamIsUp]){
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 1));
+ _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('a', 3));
+ _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('a', 2));
+ _game._player._visible = false;
+ _game._player._stepEnabled = false;
+ _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 15);
+ _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 80);
+ _vm->_sound->command(14);
+ }
+
+ if (_globals[kBeamIsUp] && !_globals[kReturnFromCut]){
+ if (_globals[kForceBeamDown])
+ _game._player._visible = false;
+ else
+ _game._player._visible = true;
+
+ _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('b', 1));
+ _vm->_sound->command(15);
+ _game._player._stepEnabled = false;
+ _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 12, 1, 0, 0);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 1, 6);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 100);
+ }
+ } else if (!_globals[kExitShip]) {
+ if (!_globals[kBeamIsUp]) {
+ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 1));
+ _game._player._visible = false;
+ _game._player._stepEnabled = false;
+ _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 130);
+ _vm->_sound->command(14);
+ } else {
+ _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('c', 1));
+ _game._player._visible = false;
+ _game._player._stepEnabled = false;
+ _globals._sequenceIndexes[8] = _scene->_sequences.startCycle(_globals._spriteIndexes[8], false, 1);
+ _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 1);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 140);
+ }
+ } else {
+ _game._player._stepEnabled = false;
+ _game._player._playerPos = Common::Point(197, 96);
+ _game._player._facing = FACING_SOUTHWEST;
+ _game._player._visible = true;
+ _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('d', 1));
+ _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, 19);
+ _scene->_sequences.addTimer(1, 150);
+ }
+
+ sceneEntrySound();
+}
+
+void Scene803::step() {
+ if (_game._trigger == 120) {
+ _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, 19);
+ _scene->_nextSceneId = 804;
+ }
+
+ if (_game._trigger == 100) {
+ _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 8, 1, 0, 0);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 2, 2);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1);
+ if (!_globals[kHoppyDead]) {
+ _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 7, 1, 0, 0);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 7, 12);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5],SEQUENCE_TRIGGER_EXPIRE, 0, 101);
+ } else {
+ _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, -2);
+ int idx = _scene->_dynamicHotspots.add(0x472, 0xD, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots.setPosition(idx, Common::Point(66, 123), FACING_SOUTH);
+ _vm->_sound->command(16);
+ _globals[kCameFromCut] = true;
+ _globals[kBeamIsUp] = false;
+ _globals[kReturnFromCut] = false;
+ _globals[kDontRepeat] = false;
+ _globals[kHoppyDead] = true;
+ _globals[kHasWatchedAntigrav] = true;
+
+ if (_globals[kForceBeamDown])
+ _scene->_nextSceneId = _scene->_priorSceneId;
+ else
+ _game._player._stepEnabled = true;
+ }
+ }
+
+ if (_game._trigger == 101) {
+ _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, -2);
+ int idx = _scene->_dynamicHotspots.add(0x472, 0xD, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0));
+ _scene->_dynamicHotspots.setPosition(idx, Common::Point(66, 123), FACING_SOUTH);
+ _vm->_sound->command(16);
+ _globals[kCameFromCut] = true;
+ _globals[kBeamIsUp] = false;
+ _globals[kReturnFromCut] = false;
+ _globals[kDontRepeat] = false;
+ _globals[kHoppyDead] = true;
+ _globals[kHasWatchedAntigrav] = true;
+
+ if (_globals[kForceBeamDown])
+ _scene->_nextSceneId = _scene->_priorSceneId;
+ else
+ _game._player._stepEnabled = true;
+ }
+
+ if (_game._trigger == 80) {
+ if (!_globals[kHoppyDead])
+ _scene->_sequences.addTimer(350, 70);
+
+ _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 12, 1, 0, 0);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 1, 3);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 90);
+ }
+
+ if (_game._trigger == 70) {
+ _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 71);
+ _vm->_sound->command(31);
+ }
+
+ if (_game._trigger == 71)
+ _scene->_sequences.addTimer(200, 110);
+
+ if (_game._trigger == 90) {
+ int syncIdx = _globals._sequenceIndexes[4];
+ _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 15, 0, 0, 0);
+ _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], syncIdx);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 4, 9);
+ if (_globals[kHoppyDead])
+ _scene->_sequences.addTimer(200, 110);
+ }
+
+ if (_game._trigger == 110)
+ _scene->_nextSceneId = 808;
+
+ if (_game._trigger == 130) {
+ _globals[kBeamIsUp] = true;
+ _scene->_nextSceneId = 804;
+ }
+
+ if (_game._trigger == 140) {
+ if (!_globals[kWindowFixed]) {
+ _scene->_nextSceneId = 810;
+ _globals[kInSpace] = true;
+ } else {
+ if (!_globals[kShieldModInstalled])
+ _game._winStatus = 1;
+ else if (!_globals[kTargetModInstalled])
+ _game._winStatus = 2;
+ else
+ _game._winStatus = 3;
+
+ _game._ongoingGame = false;
+ }
+ }
+
+ if (_game._trigger == 150) {
+ _scene->_sequences.remove(_globals._sequenceIndexes[6]);
+ _vm->_sound->command(18);
+ _globals._sequenceIndexes[6] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[6], false, 8, 1, 0, 0);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], 1, 19);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 4);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 151);
+ }
+
+ if (_game._trigger == 151) {
+ _globals[kBeamIsUp] = false;
+ _globals[kFromCockpit] = false;
+ _globals[kExitShip] = false;
+ _game._player._stepEnabled = true;
+ }
+}
+
+void Scene803::preActions() {
+ if (_action.isAction(0x1AD, 0x1AE))
+ _game._player._walkOffScreenSceneId = 802;
+
+ if (_action.isAction(VERB_TAKE, 0x139))
+ _game._player._needToWalk = false;
+}
+
+void Scene803::actions() {
+ if (_action.isAction(VERB_TAKE, 0x472)) {
+ switch (_game._trigger) {
+ case 0:
+ _game._player._stepEnabled = false;
+ _game._player._visible = false;
+ _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], true, 6, 1, 0, 0);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[9], 1, 4);
+ _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[9]);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 160);
+ break;
+
+ case 160: {
+ int syncIdx = _globals._sequenceIndexes[9];
+ _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 4);
+ _scene->_sequences.updateTimeout(_globals._sequenceIndexes[9], syncIdx);
+ _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[9]);
+ _scene->_sequences.addTimer(60, 161);
+ }
+ break;
+
+ case 161: {
+ int quoteId = 0x31A + _vm->getRandomNumber(1, 8);
+ _scene->_kernelMessages.add(Common::Point(64, 67), 0x1110, 32, 0, 80, _game.getQuote(quoteId));
+ _scene->_sequences.addTimer(60, 162);
+ }
+ break;
+
+ case 162:
+ _scene->_sequences.remove(_globals._sequenceIndexes[9]);
+ _globals._sequenceIndexes[9] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[9], true, 6, 1, 0, 0);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[9], 1, 4);
+ _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[9]);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 163);
+ break;
+
+ case 163:
+ _game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount;
+ _game._player._visible = true;
+ _game._player._stepEnabled = true;
+ break;
+
+ default:
+ break;
+ }
+ } else if (_action.isAction(0x3B8, 0x139)) {
+ _vm->_sound->command(17);
+ _game._player._stepEnabled = false;
+ _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON;
+ _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 8, 1, 0, 0);
+ _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], 1, 19);
+ _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 4);
+ _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 120);
+ _globals[kBeamIsUp] = false;
+ } else if (_action.isAction(VERB_LOOK, 0x392))
+ _vm->_dialogs->show(80310);
+ else if (_action._lookFlag)
+ _vm->_dialogs->show(80310);
+ else if (_action.isAction(VERB_LOOK, 0x395))
+ _vm->_dialogs->show(80311);
+ else if (_action.isAction(VERB_LOOK, 0x472)) {
+ if (_game._storyMode == STORYMODE_NICE)
+ _vm->_dialogs->show(80312);
+ else
+ _vm->_dialogs->show(80313);
+ } else if (_action.isAction(VERB_LOOK, 0x39))
+ _vm->_dialogs->show(80315);
+ else if (_action.isAction(VERB_LOOK, 0x139))
+ _vm->_dialogs->show(80317);
+ else if (_action.isAction(VERB_LOOK, 0x396))
+ _vm->_dialogs->show(80318);
+ else if (_action.isAction(VERB_LOOK, 0x174) || _action.isAction(VERB_LOOK, 0x175))
+ _vm->_dialogs->show(80319);
+ else if (_action.isAction(VERB_LOOK, 0x142))
+ _vm->_dialogs->show(80320);
+ else if (_action.isAction(VERB_TAKE, 0x139))
+ _vm->_dialogs->show(80321);
+ else
+ return;
+
+ _action._inProgress = false;
+}
+
+/*------------------------------------------------------------------------*/
+
+
void Scene804::setup() {
Scene8xx::setPlayerSpritesPrefix();
Scene8xx::setAAName();
diff --git a/engines/mads/nebular/nebular_scenes8.h b/engines/mads/nebular/nebular_scenes8.h
index 1e31b897bb..3af0a1cc22 100644
--- a/engines/mads/nebular/nebular_scenes8.h
+++ b/engines/mads/nebular/nebular_scenes8.h
@@ -79,6 +79,18 @@ public:
virtual void postActions() {};
};
+class Scene803: public Scene8xx{
+public:
+ Scene803(MADSEngine *vm) : Scene8xx(vm) {}
+
+ virtual void setup();
+ virtual void enter();
+ virtual void step();
+ virtual void preActions();
+ virtual void actions();
+ virtual void postActions() {};
+};
+
class Scene804: public Scene8xx {
private:
bool _messWithThrottle;
diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp
index 601acc5ec6..3ef88fa630 100644
--- a/engines/mads/scene.cpp
+++ b/engines/mads/scene.cpp
@@ -255,7 +255,7 @@ void Scene::loadVocabStrings() {
}
void Scene::initPaletteAnimation(Common::Array<PaletteCycle> &palCycles, bool animFlag) {
- // Initialise the animation palette and ticks list
+ // Initialize the animation palette and ticks list
_cycleTicks.clear();
_paletteCycles.clear();
@@ -334,7 +334,7 @@ bool Scene::getDepthHighBits(const Common::Point &pt) {
}
void Scene::loop() {
- while (!_vm->shouldQuit() && !_reloadSceneFlag && _nextSceneId == _currentSceneId) {
+ while (!_vm->shouldQuit() && !_reloadSceneFlag && (_nextSceneId == _currentSceneId) && _vm->_game->_ongoingGame) {
// Handle drawing a game frame
doFrame();