From d57d4b876e90d1d043bd171c9de46d93c9e014f4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 17 Mar 2014 08:47:20 +0100 Subject: MADS: Implement some more logic used in scene 201 --- engines/mads/nebular/nebular_scenes2.cpp | 139 +++++++++++++++++++++++++++++-- engines/mads/nebular/nebular_scenes2.h | 2 + engines/mads/player.cpp | 9 ++ engines/mads/player.h | 2 + 4 files changed, 146 insertions(+), 6 deletions(-) (limited to 'engines/mads') diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 53e876b216..d3284cc649 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -54,9 +54,9 @@ void Scene2xx::setPlayerSpritesPrefix() { } if (_scene->_nextSceneId > 212) - _game._player._unk4 = 0; + _game._player._unk4 = false; else - _game._player._unk4 = -1; + _game._player._unk4 = true; if (oldName != _game._player._spritesPrefix) _game._player._spritesChanged = true; @@ -70,6 +70,56 @@ void Scene2xx::setPlayerSpritesPrefix() { /*------------------------------------------------------------------------*/ +void Scene2xx::sceneEntrySound() { + if (_vm->_musicFlag) { + switch (_scene->_nextSceneId) { + case 201: + if ((_globals[39] == 2) || (_globals[39] == 4) || (_globals[33] != 1)) + _vm->_sound->command(17); + else + _vm->_sound->command(9); + break; + case 202: + case 203: + case 204: + case 205: + case 208: + case 209: + case 212: + _vm->_sound->command(9); + break; + case 206: + case 211: + case 215: + _vm->_sound->command(10); + break; + case 207: + case 214: + _vm->_sound->command(11); + break; + case 210: + if (_globals[44] == 0) + _vm->_sound->command(15); + else + _vm->_sound->command(10); + break; + case 213: + if (_globals[38] == 0) + _vm->_sound->command(1); + else + _vm->_sound->command(9); + break; + case 216: + _vm->_sound->command(16); + break; + default: + _vm->_sound->command(10); + break; + } + } else + _vm->_sound->command(2); +} + void Scene201::setup() { setPlayerSpritesPrefix(); setAAName(); @@ -81,6 +131,86 @@ void Scene201::setup() { } void Scene201::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 0), 0); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 1), 0); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('m', -1), 0); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('b', -1), 0); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*SC002Z1"); + _globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 1, 0); + _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 15, 0, 0, 50); + _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 4, 0, 0, 0); + _globals._spriteIndexes[19] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 0, 0, 0); + _scene->_sequences.setDepth(_globals._spriteIndexes[19], 8); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[19], Common::Point(185, 46)); + + int idx = _scene->_dynamicHotspots.add(1159, 209, _globals._spriteIndexes[19], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, 186, 81, 8); + + _globals._v0 = 0; + + if ((_scene->_priorSceneId == 202) || (_scene->_priorSceneId == -1)) { + _game._player._playerPos = Common::Point(165, 152); + } else { + _game._player._playerPos = Common::Point(223, 149); + _game._player._direction = 2; + } + + if (_globals[39] != 0) { + _game._player._visible = false; + _game._player._stepEnabled = false; + int sepChar = (_globals[0] == SEX_UNKNOWN) ? 't' : 'u'; + // Guess values. What is the default value used by the compiler? + int suffixNum = -1; + int abortTimers = -1; + switch(_globals[39]) { + case 1: + suffixNum = 3; + abortTimers = 76; + _globals[41] = -1; + break; + case 2: + suffixNum = 1; + abortTimers = 77; + break; + case 3: + _game._player._visible = true; + _game._player._stepEnabled = true; + suffixNum = -1; + break; + case 4: + suffixNum = 2; + abortTimers = 78; + break; + } + _globals[39] = 0; + if (suffixNum >= 0) + _scene->loadAnimation(formAnimName(sepChar, suffixNum), abortTimers); + } + + if ((_scene->_priorSceneId == 202) && (_globals[33] == 1) && !_scene->_roomChanged) { + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('a', 0), 0); + _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('a', 1), 0); + _game.loadQuoteSet(90, 91, 0); + _game._player._stepEnabled = false; + _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[21], -1, 12); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_FRAME_INDEX, 12, 70); + _scene->_sequences.setDepth(_globals._spriteIndexes[21], 1); + _globals._frameTime = 0; + _game._player.sub7E53C(Common::Point(157, 143), 8); + _vm->_palette->setEntry(252, 45, 63, 45); + _vm->_palette->setEntry(253, 20, 45, 20); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 2, 0, 120, _game.getQuote(90)); + } else + _globals._frameTime = 0xFFFF; + + if (_globals[41] != 0) + _scene->_hotspots.activate(438, false); + + sceneEntrySound(); +} + +void Scene201::step() { if ((_globals._frameTime) && (_vm->getRandomNumber(5000) == 9)) { _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 5, 1, 6, 0); int idx = _scene->_dynamicHotspots.add(351, 13, _globals._spriteIndexes[20], Common::Rect(0, 0, 0, 0)); @@ -89,7 +219,7 @@ void Scene201::enter() { _vm->_sound->command(14); _globals._frameTime = 0; } - + if (_game._abortTimers == 70) { _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 9, 1, 0, 0); _game._player._visible = false; @@ -154,9 +284,6 @@ void Scene201::enter() { } } -void Scene201::step() { -} - void Scene201::actions() { } diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index c4de73192f..4d6e6a20fd 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -43,6 +43,8 @@ protected: * Updates the prefix used for getting player sprites for the scene */ void setPlayerSpritesPrefix(); + + void sceneEntrySound(); public: Scene2xx(MADSEngine *vm) : NebularScene(vm) {} }; diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index 3fc7ca53dd..44dfc88ede 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -737,4 +737,13 @@ void Player::startMovement() { _v8452E = -_v84530; } +void Player::sub7E53C(Common::Point pos, int direction) { + Scene &scene = _vm->_game->_scene; + + reset(); + scene._action._startWalkFlag = true; + scene._action._walkFlag = true; + scene._destPos = pos; + scene._destFacing = direction; +} } // End of namespace MADS diff --git a/engines/mads/player.h b/engines/mads/player.h index 9a615e544f..ed44de2c20 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -153,6 +153,8 @@ public: void setDest(const Common::Point &pt, int facing); void nextFrame(); + + void sub7E53C(Common::Point pos, int direction); }; } // End of namespace MADS -- cgit v1.2.3