From 2d99f761f0bb0a8db4468846f0643fbdc4da450a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 11 Mar 2014 23:26:31 -0400 Subject: MADS: Implemented scene 804 step --- engines/mads/dialogs.h | 4 + engines/mads/game.cpp | 1 + engines/mads/game.h | 1 + engines/mads/nebular/game_nebular.cpp | 1 + engines/mads/nebular/game_nebular.h | 19 ++++ engines/mads/nebular/nebular_scenes.cpp | 3 +- engines/mads/nebular/nebular_scenes.h | 3 + engines/mads/nebular/nebular_scenes8.cpp | 159 ++++++++++++++++++++++++++++++- 8 files changed, 185 insertions(+), 6 deletions(-) (limited to 'engines/mads') diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h index 0f9a098ee1..bec7f84976 100644 --- a/engines/mads/dialogs.h +++ b/engines/mads/dialogs.h @@ -68,6 +68,10 @@ public: * Destructor */ virtual ~Dialog(); + + static void show(int msgId) { + warning("TODO: Dialog::show"); + } }; enum { diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index f290ab0fc3..6a7f6fb18d 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -59,6 +59,7 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _abortTimersMode = ABORTMODE_0; _abortTimersMode2 = ABORTMODE_0; _ticksExpiry = 0; + _exitFlag = 0; } Game::~Game() { diff --git a/engines/mads/game.h b/engines/mads/game.h index 143259dc2f..01f23605d5 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -129,6 +129,7 @@ public: Common::String _aaName; uint32 _ticksExpiry; int _objectHiliteVocabIdx; + int _exitFlag; public: virtual ~Game(); diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index c18561bac0..c2a23b607b 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -36,6 +36,7 @@ namespace Nebular { GameNebular::GameNebular(MADSEngine *vm): Game(vm) { _surface = new MSurface(MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT); + _storyMode = STORYMODE_NAUGHTY; } int GameNebular::checkCopyProtection() { diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h index 0250f66d8e..3d1d915332 100644 --- a/engines/mads/nebular/game_nebular.h +++ b/engines/mads/nebular/game_nebular.h @@ -31,6 +31,24 @@ namespace MADS { namespace Nebular { +enum StoryMode { STORYMODE_NAUGHTY = 1, STORYMODE_NICE = 2 }; + +enum InventoryObject { + OBJ_BURGER = 1, OBJ_DEAD_FISH = 2, OBJ_STUFFED_FISH = 3, OBJ_REBREATHER = 4, + OBJ_TIMER_MODULE = 5, OBJ_BIG_LEAVES = 6, OBJ_POISON_DARTS = 7, OBJ_PLANT_STALK = 8, + OBJ_BLOWGUN = 9, OBJ_TWINKIFRUIT = 10, OBJ_BONE = 11, OBJ_CHICKEN = 12, + OBJ_SCALPEL = 13, OBJ_AUDIO_TAPE = 14, OBJ_CREDIT_CHIP = 15, OBJ_SECURITY_CARD = 16, + OBJ_CHARGE_CASES = 17, OBJ_ESTROTOXIN = 18, OBJ_BOMB = 19, OBJ_TIMEBOMB = 20, + OBJ_REPAIR_LIST = 21, OBJ_ALIEN_LIQUOR = 22, OBJ_TARGET_MODULE = 23, OBJ_SHIELD_MODULATOR = 24, + OBJ_TAPE_PLAYER = 25, OBJ_PHONE_CELLS = 26, OBJ_PENLIGHT = 27, OBJ_DURAFAIL_CELLS = 28, + OBJ_FAKE_ID = 29, OBJ_ID_CARD = 30, OBJ_POLYCEMENT = 31, OBJ_FISHING_LINE = 33, + OBJ_PADLOCK_KEY = 34, OBJ_DOOR_KEY = 35, OBJ_REARVIEW_MIRROR = 36, OBJ_COMPACT_CASE = 37, + OBJ_DETONATORS = 39, OBJ_BOTTLE = 40, OBJ_CHICKEN_BOMB = 41, OBJ_VASE = 42, + OBJ_REMOTE = 43, OBJ_COMPUTER_GAME = 44, OBJ_PHONE_HANDSET = 45, OBJ_BONES = 46, + OBJ_GUARDS_ARM = 47, OBJ_LOG = 48, OBJ_BOMBS = 49, OBJ_NOTE = 50, + OBJ_COMBINATION = 51, OBJ_FORMALDEHYDE = 52, OBJ_PETROX = 53, OBJ_LECITHIN = 54 +}; + class GameNebular: public Game { friend class Game; protected: @@ -46,6 +64,7 @@ protected: public: Globals _globals; + StoryMode _storyMode; }; diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index d14120a5b7..baee40cc47 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -52,7 +52,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { /*------------------------------------------------------------------------*/ NebularScene::NebularScene(MADSEngine *vm) : SceneLogic(vm), - _globals(static_cast(vm->_game)->_globals) { + _globals(static_cast(vm->_game)->_globals), + _game(*static_cast(vm->_game)) { } Common::String NebularScene::formAnimName(char sepChar, int suffixNum) { diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 92b5626bf0..da36c71905 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -26,8 +26,10 @@ #include "common/scummsys.h" #include "mads/game.h" #include "mads/scene.h" +#include "mads/nebular/game_nebular.h" #include "mads/nebular/globals_nebular.h" + namespace MADS { namespace Nebular { @@ -95,6 +97,7 @@ public: class NebularScene : public SceneLogic { protected: Globals &_globals; + GameNebular &_game; /** * Forms an animation resoucre name diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 56c3679409..c912d32eed 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -35,9 +35,9 @@ void Scene8xx::setup1() { if ((_globals[178] && !_globals[179]) || _scene->_nextSceneId == 804 || _scene->_nextSceneId == 805 || _scene->_nextSceneId == 808 || _scene->_nextSceneId == 810) { - _vm->_game->_player._spritesPrefix = ""; + _game._player._spritesPrefix = ""; } else { - _vm->_game->_player._spritesPrefix = _globals[0] == SEX_FEMALE ? "ROX" : "RXM"; + _game._player._spritesPrefix = _globals[0] == SEX_FEMALE ? "ROX" : "RXM"; } _vm->_palette->setEntry(16, 0x0A, 0x3F, 0x3F); @@ -45,7 +45,7 @@ void Scene8xx::setup1() { } void Scene8xx::setup2() { - _vm->_game->_aaName = Resources::formatAAName(5); + _game._aaName = Resources::formatAAName(5); } void Scene8xx::enter1() { @@ -99,7 +99,7 @@ void Scene804::enter() { _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('x', 4)); _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('f', 1)); - _vm->_game->loadQuoteSet(791, 0); + _game.loadQuoteSet(791, 0); if (_globals[165]) { if (_globals[164]) { @@ -113,7 +113,7 @@ void Scene804::enter() { _globals._spriteIndexes[21] = _scene->_sequences.startReverseCycle( _globals._spriteIndexes[6], false, 4, 0, 0, 0); _scene->_sequences.addTimer(160, 70); - _vm->_game->_player._stepEnabled = false; + _game._player._stepEnabled = false; } } else { @@ -144,6 +144,155 @@ void Scene804::enter() { } void Scene804::step() { + if (_globals._chairHotspotIndex) { + if (_scene->_activeAnimation->getCurrentFrame() == 36 && !_globals._v3) { + _scene->_sequences.remove(_globals._spriteIndexes[15]); + _globals._v3 = -1; + } + if (_scene->_activeAnimation->getCurrentFrame() == 39) { + _globals._v2 = 0; + if (_globals._v1 == 3) + _scene->_sequences.addTimer(130, 120); + } + + if (!_globals._v2) { + ++_globals._v1; + _globals._v2 = -1; + + if (_globals._v1 >= 4) { + _globals._chairHotspotIndex = 0; + _globals._v1 = 0; + _game._player._stepEnabled = true; + } else { + _globals._v5 = 34; + } + } + } else { + if (_globals._v3 && _globals._v2 && _scene->_activeAnimation->getCurrentFrame() == 39) { + _globals._spriteIndexes[15] = _scene->_sequences.startCycle( + _globals._spriteIndexes[0], false, 1); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[15], + Common::Point(133, 139)); + _scene->_sequences.setDepth(_globals._spriteIndexes[15], 8); + _globals._v3 = 0; + } + + if (_globals._v2 && _scene->_activeAnimation->getCurrentFrame() == 42) { + _globals._v5 = 0; + _globals._v2 = 0; + } + + if (_game._abortTimers == 70) + _globals._v5 = 42; + if (_scene->_activeAnimation->getCurrentFrame() == 65) + _scene->_sequences.remove(_globals._spriteIndexes[21]); + + switch (_game._storyMode) { + case STORYMODE_NAUGHTY: + if (_scene->_activeAnimation->getCurrentFrame() == 81) { + _globals._v5 = 80; + } else { + _globals[165] = 0; + _globals[167] = -1; + assert(!_globals[5]); + _game._exitFlag = 4; + _vm->quitGame(); + } + break; + + case STORYMODE_NICE: + if (_scene->_activeAnimation->getCurrentFrame() == 68) { + _globals._v5 = 66; + } else { + _globals[165] = 0; + _globals[167] = -1; + assert(!_globals[5]); + _game._exitFlag = 4; + _vm->quitGame(); + } + break; + } + + if (_scene->_activeAnimation->getCurrentFrame() == 34) { + _globals._v5 = 36; + _scene->_sequences.remove(_globals._spriteIndexes[15]); + } + if (_scene->_activeAnimation->getCurrentFrame() == 37) { + _globals._v5 = 36; + if (!_globals._v4) + _scene->_sequences.addTimer(60, 80); + } + + if (_game._abortTimers == 80) + _scene->_nextSceneId = 803; + + if (_scene->_activeAnimation->getCurrentFrame() == 7 && !_globals[164]) { + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + _scene->_sequences.addTimer(20, 110); + _globals[164] = -1; + } + + if (_scene->_activeAnimation->getCurrentFrame() == 10) { + _globals._v5 = 0; + _game._player._stepEnabled = true; + _game._objects.setRoom(OBJ_POLYCEMENT, 1); + } + + switch (_scene->_activeAnimation->getCurrentFrame()) { + case 1: + _globals[29] = _vm->getRandomNumber(29) + 1; + switch (_globals[29]) { + case 1: + _globals._v5 = 25; + break; + case 2: + _globals._v5 = 27; + break; + case 3: + _globals._v5 = 9; + break; + default: + _globals._v5 = 0; + break; + } + break; + + case 26: + case 28: + case 31: + _globals._v5 = 0; + break; + + default: + break; + } + } + + if (_game._abortTimers == 120) + Dialog::show(0x13a26); + if (_game._abortTimers == 110) + Dialog::show(0x13a2a); + + if (_globals._v6) { + _globals._v5 = 32; + _globals._v6 = 0; + } + if (_globals._v5 >= 0 && (_scene->_activeAnimation->getCurrentFrame() != _globals._v5)) { + _scene->_activeAnimation->setCurrentFrame(_globals._v5); + _globals._v5 = -1; + } + + if (_game._abortTimers == 90) + _scene->_nextSceneId = 803; + + if (_scene->_activeAnimation->getCurrentFrame() == 7 &&!_globals._v8) { + _vm->_sound->command(21); + _globals._v8 = -1; + } + if (_scene->_activeAnimation->getCurrentFrame() == 80 && !_globals._v7) { + _vm->_sound->command(22); + _globals._v7 = -1; + } } void Scene804::preActions() { -- cgit v1.2.3